Skip to content

Commit

Permalink
Merge branch 'master' into fix-5686
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored Jan 10, 2024
2 parents 061d863 + eb9a574 commit b943724
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 16 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [10.3.1](https://github.com/primefaces/primereact/tree/10.3.1) (2024-01-10)

[Full Changelog](https://github.com/primefaces/primereact/compare/10.3.0...10.3.1)

**Fixed bugs:**

- Port missing fixes [\#5707](https://github.com/primefaces/primereact/issues/5707)
- Image: ReferenceError: rotate is not defined image.esm.js (948:0) [\#5704](https://github.com/primefaces/primereact/issues/5704)
- 'content' property now required for several components [\#5701](https://github.com/primefaces/primereact/issues/5701)
- MegaMenu: Menu Items not showing without StrictMode (production) only after a stateupdate [\#5699](https://github.com/primefaces/primereact/issues/5699)
- Confirm Dialog: Demo opening dialog 3 times [\#5697](https://github.com/primefaces/primereact/issues/5697)
- Primereact in the Shadow DOM has problems with the Dropdown component style [\#5246](https://github.com/primefaces/primereact/issues/5246)
- TypeScript: 10.3.0 Components complaining content is required [\#5692](https://github.com/primefaces/primereact/issues/5692)

## [10.3.0](https://github.com/primefaces/primereact/tree/10.3.0) (2024-01-05)

[Full Changelog](https://github.com/primefaces/primereact/compare/10.2.1...10.3.0)
Expand Down Expand Up @@ -678,6 +692,7 @@
- Calendar: `view` typescript missing `year` [\#4163](https://github.com/primefaces/primereact/issues/4163)
- Ripple: first click on component has incorrect location [\#4160](https://github.com/primefaces/primereact/issues/4160)
- primereact.min.css Error at background:transparent URL\(\) with base64 image [\#4097](https://github.com/primefaces/primereact/issues/4097)
- ConfirmDialog: is not loading inside a Shadow DOM [\#4096](https://github.com/primefaces/primereact/issues/4096)

## [9.2.1](https://github.com/primefaces/primereact/tree/9.2.1) (2023-03-15)

Expand Down
25 changes: 13 additions & 12 deletions components/lib/picklist/PickList.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export const PickList = React.memo(
props.onBlur && props.onBlur(event);
};

const onItemClick = (event, type) => {
const onItemClick = (event, type, arrowKeyClick = false) => {
let originalEvent = event.originalEvent;
let item = event.value;
let selectedId = event.id;
Expand All @@ -258,10 +258,10 @@ export const PickList = React.memo(
let selected = index !== -1;
let metaSelection = props.metaKeySelection;

setFocusedOptionIndex(selectedId);
if (!arrowKeyClick) setFocusedOptionIndex(selectedId);

if (metaSelection) {
const metaKey = originalEvent.metaKey || originalEvent.ctrlKey;
const metaKey = originalEvent.metaKey || originalEvent.ctrlKey || originalEvent.shiftKey;

if (selected && metaKey) {
selection.splice(index, 1);
Expand Down Expand Up @@ -334,31 +334,33 @@ export const PickList = React.memo(

const onArrowDownKey = (event, type) => {
const optionIndex = findNextOptionIndex(focusedOptionIndex, type);
const visibleList = getVisibleList(type === 'source' ? props.source : props.target, type);

changeFocusedOptionIndex(optionIndex, type);

if (event.shiftKey) {
onEnterKey(event, type);
if (visibleList && visibleList.length > 0 && event.shiftKey) {
onItemClick({ originalEvent: event, value: visibleList[optionIndex] }, type, true);
}

event.preventDefault();
};

const onArrowUpKey = (event, type) => {
const optionIndex = findPrevOptionIndex(focusedOptionIndex, type);
const visibleList = getVisibleList(type === 'source' ? props.source : props.target, type);

changeFocusedOptionIndex(optionIndex, type);

if (event.shiftKey) {
onEnterKey(event, type);
if (visibleList && visibleList.length > 0 && event.shiftKey) {
onItemClick({ originalEvent: event, value: visibleList[optionIndex] }, type, true);
}

event.preventDefault();
};

const onEnterKey = (event, type) => {
const listElement = getListElement(type);
const visibleList = type === 'source' ? props.source : props.target;
const visibleList = getVisibleList(type === 'source' ? props.source : props.target, type);
const items = DomHandler.find(listElement, '[data-pc-section="item"]');
const focusedItem = DomHandler.findSingle(listElement, `[data-pc-section="item"][id=${focusedOptionIndex}]`);
const id = focusedItem && focusedItem.getAttribute('id');
Expand Down Expand Up @@ -399,14 +401,13 @@ export const PickList = React.memo(

const onHomeKey = (event, type) => {
if (event.ctrlKey && event.shiftKey) {
const isSource = type === 'sourceList';
const isSource = type === 'source';
const listItems = isSource ? sourceList : targetList;
const listElement = getListElement(type);
const items = DomHandler.find(listElement, '[data-pc-section="item"]');
const focusedItem = DomHandler.findSingle(listElement, `[data-pc-section="item"][id=${focusedOptionIndex}]`);
const matchedOptionIndex = [...items].findIndex((item) => item === focusedItem);

selection = [...listItems].slice(0, matchedOptionIndex + 1);
const selection = [...listItems].slice(0, matchedOptionIndex + 1);

if (isSource) {
onSelectionChange({ originalEvent: event, value: selection }, 'sourceSelection', props.onSourceSelectionChange);
Expand All @@ -425,7 +426,7 @@ export const PickList = React.memo(
const items = DomHandler.find(listElement, '[data-pc-section="item"]');

if (event.ctrlKey && event.shiftKey) {
const isSource = type === 'sourceList';
const isSource = type === 'source';
const listItems = isSource ? sourceList : targetList;
const focusedItem = DomHandler.findSingle(listElement, `[data-pc-section="item"][id=${focusedOptionIndex}]`);
const matchedOptionIndex = [...items].findIndex((item) => item === focusedItem);
Expand Down
9 changes: 8 additions & 1 deletion components/lib/treeselect/TreeSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,13 @@ export const TreeSelect = React.memo(
break;

case 'Tab':
onTabKey(event);
if (overlayVisibleState) {
event.preventDefault();

if (event.shiftKey) setFocusToFocusableFirstNode();
else onTabKey(event);
}

break;

default:
Expand Down Expand Up @@ -856,6 +862,7 @@ export const TreeSelect = React.memo(
scrollHeight={props.scrollHeight}
onClick={onOverlayClick}
header={header}
hide={hide}
footer={footer}
firstHiddenFocusableElementOnOverlay={<span {...firstHiddenFocusableElementOnOverlayProps}></span>}
lastHiddenFocusableElementOnOverlay={<span {...lastHiddenFocusableElementOnOverlayProps}></span>}
Expand Down
8 changes: 8 additions & 0 deletions components/lib/treeselect/TreeSelectPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@ export const TreeSelectPanel = React.forwardRef((props, ref) => {
});
};

const onKeyDown = (event) => {
if (event.key === 'Escape') {
event.preventDefault();
props.hide();
}
};

const createElement = () => {
const wrapperStyle = { maxHeight: props.scrollHeight || 'auto' };

const panelProps = mergeProps(
{
className: cx('panel', { panelProps: props, context }),
style: props.panelStyle,
onKeyDown: onKeyDown,
onClick: props.onClick
},
getPTOptions('panel')
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "primereact",
"private": false,
"version": "10.3.1-SNAPSHOT",
"version": "10.4.0-SNAPSHOT",
"scripts": {
"dev": "next dev",
"start": "next start",
Expand Down

0 comments on commit b943724

Please sign in to comment.