@unifiedsoftware/react-ui 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -9
- package/dist/index.mjs +9 -9
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -201,7 +201,7 @@ interface Props$2 {
|
|
|
201
201
|
* The nav mode of the menu, which can be 'manual' or 'automatic'.
|
|
202
202
|
* Search for the last level of the menu and validate if the value matches.
|
|
203
203
|
*/
|
|
204
|
-
|
|
204
|
+
navMode?: 'manual' | 'automatic';
|
|
205
205
|
/**
|
|
206
206
|
* A callback function called when the selected values of the menu change.
|
|
207
207
|
*/
|
|
@@ -227,7 +227,7 @@ interface MenuContextValue {
|
|
|
227
227
|
originalValue: any;
|
|
228
228
|
openValues: any[];
|
|
229
229
|
expandMode: 'single' | 'multiple';
|
|
230
|
-
|
|
230
|
+
navMode: 'manual' | 'automatic';
|
|
231
231
|
onChange: (value: any) => void;
|
|
232
232
|
onOpen: (values: any) => void;
|
|
233
233
|
onItemSelect: (props: MenuItemProps) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -201,7 +201,7 @@ interface Props$2 {
|
|
|
201
201
|
* The nav mode of the menu, which can be 'manual' or 'automatic'.
|
|
202
202
|
* Search for the last level of the menu and validate if the value matches.
|
|
203
203
|
*/
|
|
204
|
-
|
|
204
|
+
navMode?: 'manual' | 'automatic';
|
|
205
205
|
/**
|
|
206
206
|
* A callback function called when the selected values of the menu change.
|
|
207
207
|
*/
|
|
@@ -227,7 +227,7 @@ interface MenuContextValue {
|
|
|
227
227
|
originalValue: any;
|
|
228
228
|
openValues: any[];
|
|
229
229
|
expandMode: 'single' | 'multiple';
|
|
230
|
-
|
|
230
|
+
navMode: 'manual' | 'automatic';
|
|
231
231
|
onChange: (value: any) => void;
|
|
232
232
|
onOpen: (values: any) => void;
|
|
233
233
|
onItemSelect: (props: MenuItemProps) => void;
|
package/dist/index.js
CHANGED
|
@@ -443,7 +443,7 @@ var MenuValueContext_default = MenuValueContext;
|
|
|
443
443
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
444
444
|
var MenuItem = (0, import_react13.forwardRef)((props, ref) => {
|
|
445
445
|
const _a = props, { as: Component = "div", className, style, value, title, icon, level = 1, disabled, onClick } = _a, rest = __objRest(_a, ["as", "className", "style", "value", "title", "icon", "level", "disabled", "onClick"]);
|
|
446
|
-
const { value: menuValue, originalValue,
|
|
446
|
+
const { value: menuValue, originalValue, navMode, onChange, onOpen, onItemSelect } = useMenu();
|
|
447
447
|
const values = (0, import_react13.useContext)(MenuValueContext_default);
|
|
448
448
|
const mergedValues = [...values, value];
|
|
449
449
|
const handleClick = (event) => {
|
|
@@ -454,11 +454,11 @@ var MenuItem = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
454
454
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
455
455
|
};
|
|
456
456
|
(0, import_react13.useEffect)(() => {
|
|
457
|
-
if (
|
|
457
|
+
if (navMode === "automatic" && originalValue.length > 0 && originalValue[originalValue.length - 1] === value) {
|
|
458
458
|
onOpen(values);
|
|
459
459
|
onChange(mergedValues);
|
|
460
460
|
}
|
|
461
|
-
}, [value, originalValue,
|
|
461
|
+
}, [value, originalValue, navMode]);
|
|
462
462
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
463
463
|
Component,
|
|
464
464
|
__spreadProps(__spreadValues({
|
|
@@ -591,7 +591,7 @@ var MenuSubmenu = (_a) => {
|
|
|
591
591
|
"ul",
|
|
592
592
|
{
|
|
593
593
|
className: (0, import_clsx7.default)(`${PREFIX_CLS}menu`, {
|
|
594
|
-
[`${PREFIX_CLS}menu-open`]: !
|
|
594
|
+
[`${PREFIX_CLS}menu-open`]: !isOpen
|
|
595
595
|
}),
|
|
596
596
|
children: content || children
|
|
597
597
|
}
|
|
@@ -655,7 +655,7 @@ var Menu = (_a) => {
|
|
|
655
655
|
defaultValue,
|
|
656
656
|
openValues: openValuesProp,
|
|
657
657
|
expandMode = "multiple",
|
|
658
|
-
|
|
658
|
+
navMode = "manual",
|
|
659
659
|
items,
|
|
660
660
|
onChange,
|
|
661
661
|
onOpen,
|
|
@@ -666,7 +666,7 @@ var Menu = (_a) => {
|
|
|
666
666
|
"defaultValue",
|
|
667
667
|
"openValues",
|
|
668
668
|
"expandMode",
|
|
669
|
-
"
|
|
669
|
+
"navMode",
|
|
670
670
|
"items",
|
|
671
671
|
"onChange",
|
|
672
672
|
"onOpen",
|
|
@@ -682,7 +682,7 @@ var Menu = (_a) => {
|
|
|
682
682
|
});
|
|
683
683
|
}, [items]);
|
|
684
684
|
const handleChange = (value) => {
|
|
685
|
-
if (valueProp !== void 0 &&
|
|
685
|
+
if (valueProp !== void 0 && navMode !== "automatic") {
|
|
686
686
|
onChange == null ? void 0 : onChange(value);
|
|
687
687
|
} else {
|
|
688
688
|
setSelfValue(value);
|
|
@@ -699,7 +699,7 @@ var Menu = (_a) => {
|
|
|
699
699
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
700
700
|
};
|
|
701
701
|
(0, import_react16.useEffect)(() => {
|
|
702
|
-
if (valueProp !== void 0 &&
|
|
702
|
+
if (valueProp !== void 0 && navMode !== "automatic") {
|
|
703
703
|
setSelfValue(valueProp);
|
|
704
704
|
}
|
|
705
705
|
}, [valueProp]);
|
|
@@ -716,7 +716,7 @@ var Menu = (_a) => {
|
|
|
716
716
|
originalValue: valueProp,
|
|
717
717
|
openValues: selfOpenValues,
|
|
718
718
|
expandMode,
|
|
719
|
-
|
|
719
|
+
navMode,
|
|
720
720
|
onOpen: handleOpen,
|
|
721
721
|
onChange: handleChange,
|
|
722
722
|
onItemSelect: handleItemSelect
|
package/dist/index.mjs
CHANGED
|
@@ -388,7 +388,7 @@ var MenuValueContext_default = MenuValueContext;
|
|
|
388
388
|
import { jsx as jsx7, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
389
389
|
var MenuItem = forwardRef9((props, ref) => {
|
|
390
390
|
const _a = props, { as: Component = "div", className, style, value, title, icon, level = 1, disabled, onClick } = _a, rest = __objRest(_a, ["as", "className", "style", "value", "title", "icon", "level", "disabled", "onClick"]);
|
|
391
|
-
const { value: menuValue, originalValue,
|
|
391
|
+
const { value: menuValue, originalValue, navMode, onChange, onOpen, onItemSelect } = useMenu();
|
|
392
392
|
const values = useContext4(MenuValueContext_default);
|
|
393
393
|
const mergedValues = [...values, value];
|
|
394
394
|
const handleClick = (event) => {
|
|
@@ -399,11 +399,11 @@ var MenuItem = forwardRef9((props, ref) => {
|
|
|
399
399
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
400
400
|
};
|
|
401
401
|
useEffect2(() => {
|
|
402
|
-
if (
|
|
402
|
+
if (navMode === "automatic" && originalValue.length > 0 && originalValue[originalValue.length - 1] === value) {
|
|
403
403
|
onOpen(values);
|
|
404
404
|
onChange(mergedValues);
|
|
405
405
|
}
|
|
406
|
-
}, [value, originalValue,
|
|
406
|
+
}, [value, originalValue, navMode]);
|
|
407
407
|
return /* @__PURE__ */ jsxs8(
|
|
408
408
|
Component,
|
|
409
409
|
__spreadProps(__spreadValues({
|
|
@@ -536,7 +536,7 @@ var MenuSubmenu = (_a) => {
|
|
|
536
536
|
"ul",
|
|
537
537
|
{
|
|
538
538
|
className: clsx7(`${PREFIX_CLS}menu`, {
|
|
539
|
-
[`${PREFIX_CLS}menu-open`]: !
|
|
539
|
+
[`${PREFIX_CLS}menu-open`]: !isOpen
|
|
540
540
|
}),
|
|
541
541
|
children: content || children
|
|
542
542
|
}
|
|
@@ -600,7 +600,7 @@ var Menu = (_a) => {
|
|
|
600
600
|
defaultValue,
|
|
601
601
|
openValues: openValuesProp,
|
|
602
602
|
expandMode = "multiple",
|
|
603
|
-
|
|
603
|
+
navMode = "manual",
|
|
604
604
|
items,
|
|
605
605
|
onChange,
|
|
606
606
|
onOpen,
|
|
@@ -611,7 +611,7 @@ var Menu = (_a) => {
|
|
|
611
611
|
"defaultValue",
|
|
612
612
|
"openValues",
|
|
613
613
|
"expandMode",
|
|
614
|
-
"
|
|
614
|
+
"navMode",
|
|
615
615
|
"items",
|
|
616
616
|
"onChange",
|
|
617
617
|
"onOpen",
|
|
@@ -627,7 +627,7 @@ var Menu = (_a) => {
|
|
|
627
627
|
});
|
|
628
628
|
}, [items]);
|
|
629
629
|
const handleChange = (value) => {
|
|
630
|
-
if (valueProp !== void 0 &&
|
|
630
|
+
if (valueProp !== void 0 && navMode !== "automatic") {
|
|
631
631
|
onChange == null ? void 0 : onChange(value);
|
|
632
632
|
} else {
|
|
633
633
|
setSelfValue(value);
|
|
@@ -644,7 +644,7 @@ var Menu = (_a) => {
|
|
|
644
644
|
onItemSelect == null ? void 0 : onItemSelect(props);
|
|
645
645
|
};
|
|
646
646
|
useEffect3(() => {
|
|
647
|
-
if (valueProp !== void 0 &&
|
|
647
|
+
if (valueProp !== void 0 && navMode !== "automatic") {
|
|
648
648
|
setSelfValue(valueProp);
|
|
649
649
|
}
|
|
650
650
|
}, [valueProp]);
|
|
@@ -661,7 +661,7 @@ var Menu = (_a) => {
|
|
|
661
661
|
originalValue: valueProp,
|
|
662
662
|
openValues: selfOpenValues,
|
|
663
663
|
expandMode,
|
|
664
|
-
|
|
664
|
+
navMode,
|
|
665
665
|
onOpen: handleOpen,
|
|
666
666
|
onChange: handleChange,
|
|
667
667
|
onItemSelect: handleItemSelect
|