@oliasoft-open-source/react-ui-library 5.11.7 → 5.12.1
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/global.css +1 -1
- package/dist/index.d.ts +49 -27
- package/dist/index.js +82 -71
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Context } from 'react';
|
|
|
3
3
|
import { CSSProperties } from 'react';
|
|
4
4
|
import { default as default_2 } from 'react';
|
|
5
5
|
import { DependencyList } from 'react';
|
|
6
|
+
import { DropOptions } from '@minoru/react-dnd-treeview';
|
|
6
7
|
import { ElementType as ElementType_2 } from 'react';
|
|
7
8
|
import { FC } from 'react';
|
|
8
9
|
import { FocusEvent as FocusEvent_2 } from 'react';
|
|
@@ -1060,6 +1061,11 @@ export declare interface INumberInputProps {
|
|
|
1060
1061
|
disableValidationOnFocus?: boolean;
|
|
1061
1062
|
}
|
|
1062
1063
|
|
|
1064
|
+
declare interface IOnRowClickFunction {
|
|
1065
|
+
(): any;
|
|
1066
|
+
noStyle?: boolean;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1063
1069
|
export declare interface IOptionDropdownProps {
|
|
1064
1070
|
name?: string;
|
|
1065
1071
|
disabled?: boolean;
|
|
@@ -1720,41 +1726,24 @@ declare interface ITopBarTitleProps {
|
|
|
1720
1726
|
onClick?: MouseEventHandler<HTMLDivElement | HTMLAnchorElement>;
|
|
1721
1727
|
}
|
|
1722
1728
|
|
|
1729
|
+
declare interface ITreeListItemProps extends IListItem {
|
|
1730
|
+
id: TStringOrNumber;
|
|
1731
|
+
parent: TStringOrNumber;
|
|
1732
|
+
droppable?: boolean;
|
|
1733
|
+
onDrop?: (event: default_2.DragEvent<HTMLDivElement>) => void;
|
|
1734
|
+
}
|
|
1735
|
+
|
|
1723
1736
|
declare interface ITreeListProps {
|
|
1724
1737
|
name?: string | default_2.ReactNode;
|
|
1725
1738
|
noHeader?: boolean;
|
|
1726
|
-
items:
|
|
1727
|
-
id: TStringOrNumber;
|
|
1728
|
-
name: string | default_2.ReactNode;
|
|
1729
|
-
parent: TStringOrNumber;
|
|
1730
|
-
droppable?: boolean;
|
|
1731
|
-
details?: string | default_2.ReactNode;
|
|
1732
|
-
active?: boolean;
|
|
1733
|
-
testId?: string;
|
|
1734
|
-
icon?: {
|
|
1735
|
-
icon: default_2.ReactNode;
|
|
1736
|
-
color: string;
|
|
1737
|
-
tooltip?: {
|
|
1738
|
-
text: TStringOrNumber | default_2.ReactNode;
|
|
1739
|
-
error?: boolean;
|
|
1740
|
-
warning?: boolean;
|
|
1741
|
-
placement?: string;
|
|
1742
|
-
enabled?: boolean;
|
|
1743
|
-
maxWidth?: TStringOrNumber;
|
|
1744
|
-
triggerOffset?: TStringOrNumber;
|
|
1745
|
-
possiblePlacements?: string[];
|
|
1746
|
-
fontSize?: TStringOrNumber;
|
|
1747
|
-
padding?: TStringOrNumber;
|
|
1748
|
-
};
|
|
1749
|
-
};
|
|
1750
|
-
onDrop?: (event: default_2.DragEvent<HTMLDivElement>) => void;
|
|
1751
|
-
}[];
|
|
1739
|
+
items: ITreeListItemProps[] | ITreeRowItem[];
|
|
1752
1740
|
onClick?: TEmpty;
|
|
1753
1741
|
actions?: any[];
|
|
1754
1742
|
}
|
|
1755
1743
|
|
|
1756
1744
|
export declare interface ITreeProps {
|
|
1757
1745
|
list: ITreeListProps;
|
|
1746
|
+
canDrop?: (tree: NodeModel[], options: DropOptions) => boolean | void;
|
|
1758
1747
|
draggable?: boolean;
|
|
1759
1748
|
onListReorder?: (newList: any[]) => void;
|
|
1760
1749
|
onChangeOpen?: (id: TStringOrNumber[]) => void;
|
|
@@ -1771,6 +1760,22 @@ export declare interface ITreeProps {
|
|
|
1771
1760
|
allowParentReassignment?: boolean;
|
|
1772
1761
|
stickyHeader?: boolean;
|
|
1773
1762
|
height?: number | string;
|
|
1763
|
+
render?: (node: NodeModel<any>, options: {
|
|
1764
|
+
depth: number;
|
|
1765
|
+
draggable: boolean;
|
|
1766
|
+
handleRef: RefObject<HTMLDivElement>;
|
|
1767
|
+
hasChild: boolean;
|
|
1768
|
+
isOpen: boolean;
|
|
1769
|
+
onToggle: (id: TStringOrNumber) => void;
|
|
1770
|
+
}) => ReactElement;
|
|
1771
|
+
}
|
|
1772
|
+
|
|
1773
|
+
declare interface ITreeRowItem extends TRowType_2 {
|
|
1774
|
+
id: TStringOrNumber;
|
|
1775
|
+
name?: string;
|
|
1776
|
+
parent: TStringOrNumber;
|
|
1777
|
+
droppable?: boolean;
|
|
1778
|
+
onDrop?: (event: default_2.DragEvent<HTMLDivElement>) => void;
|
|
1774
1779
|
}
|
|
1775
1780
|
|
|
1776
1781
|
declare interface IUnitConfigItem {
|
|
@@ -2165,7 +2170,7 @@ declare const TRANSLATION_FALLBACK: {
|
|
|
2165
2170
|
unknown: string;
|
|
2166
2171
|
};
|
|
2167
2172
|
|
|
2168
|
-
export declare const Tree: ({ list, draggable, onListReorder, onChangeOpen, testId, isInitialOpen, autoOpenActiveItems, treeRef: treeRefProp, itemHasChild, onItemToggle, icons, allowParentReassignment, stickyHeader, height, }: ITreeProps) => JSX_2.Element;
|
|
2173
|
+
export declare const Tree: ({ list, canDrop, draggable, onListReorder, onChangeOpen, testId, isInitialOpen, autoOpenActiveItems, treeRef: treeRefProp, itemHasChild, onItemToggle, icons, allowParentReassignment, stickyHeader, height, render, }: ITreeProps) => JSX_2.Element;
|
|
2169
2174
|
|
|
2170
2175
|
export declare enum TriggerType {
|
|
2171
2176
|
TEXT = "Text",
|
|
@@ -2185,6 +2190,23 @@ declare type TRowType = {
|
|
|
2185
2190
|
onRowMouseLeave?: TEmpty;
|
|
2186
2191
|
};
|
|
2187
2192
|
|
|
2193
|
+
declare type TRowType_2 = {
|
|
2194
|
+
active?: boolean;
|
|
2195
|
+
error?: boolean;
|
|
2196
|
+
warning?: boolean;
|
|
2197
|
+
cells: TCellShape[];
|
|
2198
|
+
noDrag?: boolean;
|
|
2199
|
+
onRowClick?: IOnRowClickFunction;
|
|
2200
|
+
onRowFocus?: IOnRowClickFunction;
|
|
2201
|
+
onRowMouseEnter?: IOnRowClickFunction;
|
|
2202
|
+
onRowMouseLeave?: IOnRowClickFunction;
|
|
2203
|
+
expandedContent?: {
|
|
2204
|
+
content: ReactNode;
|
|
2205
|
+
flush?: boolean;
|
|
2206
|
+
};
|
|
2207
|
+
actions?: any[];
|
|
2208
|
+
};
|
|
2209
|
+
|
|
2188
2210
|
declare type TSliderMark = {
|
|
2189
2211
|
value: number | string;
|
|
2190
2212
|
label?: number | string | ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -3061,34 +3061,34 @@ const ExpandedContentRow = ({ colSpan: e, children: t, flush: n }) => /* @__PURE
|
|
|
3061
3061
|
return r && t ? e[n] || [] : i ? e : (console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."), []);
|
|
3062
3062
|
};
|
|
3063
3063
|
var cell_module_default = {
|
|
3064
|
-
inputInTable: "
|
|
3065
|
-
inputHover: "
|
|
3066
|
-
inputFocus: "
|
|
3067
|
-
inputError: "
|
|
3068
|
-
inputWarning: "
|
|
3069
|
-
inputDisabled: "
|
|
3070
|
-
hideScrollbars: "
|
|
3071
|
-
cell: "
|
|
3072
|
-
disabledLink: "
|
|
3073
|
-
inputWrapper: "
|
|
3074
|
-
numberInputWrapper: "
|
|
3075
|
-
breakWord: "
|
|
3076
|
-
inputCell: "
|
|
3077
|
-
sliderCell: "
|
|
3078
|
-
staticCell: "
|
|
3079
|
-
staticCellContent: "
|
|
3080
|
-
unit: "
|
|
3081
|
-
sortingCell: "
|
|
3082
|
-
sortingCellIcon: "
|
|
3083
|
-
icon: "
|
|
3084
|
-
checkBoxCell: "
|
|
3085
|
-
iconCellWrapper: "
|
|
3086
|
-
actionsCell: "
|
|
3087
|
-
rightAligned: "
|
|
3088
|
-
centerAligned: "
|
|
3089
|
-
leftAligned: "
|
|
3090
|
-
popover: "
|
|
3091
|
-
disabledPointerEvents: "
|
|
3064
|
+
inputInTable: "_inputInTable_1b0yl_1",
|
|
3065
|
+
inputHover: "_inputHover_1b0yl_13",
|
|
3066
|
+
inputFocus: "_inputFocus_1b0yl_18",
|
|
3067
|
+
inputError: "_inputError_1b0yl_25",
|
|
3068
|
+
inputWarning: "_inputWarning_1b0yl_26",
|
|
3069
|
+
inputDisabled: "_inputDisabled_1b0yl_61",
|
|
3070
|
+
hideScrollbars: "_hideScrollbars_1b0yl_67",
|
|
3071
|
+
cell: "_cell_1b0yl_77",
|
|
3072
|
+
disabledLink: "_disabledLink_1b0yl_87",
|
|
3073
|
+
inputWrapper: "_inputWrapper_1b0yl_91",
|
|
3074
|
+
numberInputWrapper: "_numberInputWrapper_1b0yl_106",
|
|
3075
|
+
breakWord: "_breakWord_1b0yl_113",
|
|
3076
|
+
inputCell: "_inputCell_1b0yl_116",
|
|
3077
|
+
sliderCell: "_sliderCell_1b0yl_119",
|
|
3078
|
+
staticCell: "_staticCell_1b0yl_123",
|
|
3079
|
+
staticCellContent: "_staticCellContent_1b0yl_126",
|
|
3080
|
+
unit: "_unit_1b0yl_147",
|
|
3081
|
+
sortingCell: "_sortingCell_1b0yl_150",
|
|
3082
|
+
sortingCellIcon: "_sortingCellIcon_1b0yl_161",
|
|
3083
|
+
icon: "_icon_1b0yl_172",
|
|
3084
|
+
checkBoxCell: "_checkBoxCell_1b0yl_176",
|
|
3085
|
+
iconCellWrapper: "_iconCellWrapper_1b0yl_180",
|
|
3086
|
+
actionsCell: "_actionsCell_1b0yl_184",
|
|
3087
|
+
rightAligned: "_rightAligned_1b0yl_192",
|
|
3088
|
+
centerAligned: "_centerAligned_1b0yl_198",
|
|
3089
|
+
leftAligned: "_leftAligned_1b0yl_204",
|
|
3090
|
+
popover: "_popover_1b0yl_207",
|
|
3091
|
+
disabledPointerEvents: "_disabledPointerEvents_1b0yl_210"
|
|
3092
3092
|
};
|
|
3093
3093
|
const InputCell = ({ cell: e, columnAlignment: t, testId: n, type: r }) => /* @__PURE__ */ jsx(Input, {
|
|
3094
3094
|
name: e.name,
|
|
@@ -6460,12 +6460,12 @@ const Content = ({ title: e, okText: t, onClickOk: n, disableConfirmButton: r, c
|
|
|
6460
6460
|
children: e
|
|
6461
6461
|
});
|
|
6462
6462
|
var tree_module_default = {
|
|
6463
|
-
tree: "
|
|
6464
|
-
toggle: "
|
|
6465
|
-
dropTarget: "
|
|
6466
|
-
placeholder: "
|
|
6467
|
-
draggingSource: "
|
|
6468
|
-
placeholderContainer: "
|
|
6463
|
+
tree: "_tree_1cqsz_1",
|
|
6464
|
+
toggle: "_toggle_1cqsz_7",
|
|
6465
|
+
dropTarget: "_dropTarget_1cqsz_14",
|
|
6466
|
+
placeholder: "_placeholder_1cqsz_29",
|
|
6467
|
+
draggingSource: "_draggingSource_1cqsz_35",
|
|
6468
|
+
placeholderContainer: "_placeholderContainer_1cqsz_38"
|
|
6469
6469
|
};
|
|
6470
6470
|
const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, draggable: o, icons: s, onDrop: c }) => {
|
|
6471
6471
|
let { id: l, data: u } = t, { active: d, testId: f, onClick: p, actions: m = [] } = u, [h, _] = React.useState(!1), [v, y] = React.useState(0), b = (e) => {
|
|
@@ -6522,39 +6522,39 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
|
|
|
6522
6522
|
}, TreePlaceholder = ({ depth: e }) => /* @__PURE__ */ jsx("div", {
|
|
6523
6523
|
className: tree_module_default.placeholder,
|
|
6524
6524
|
style: { left: e * 24 }
|
|
6525
|
-
}), Tree = ({ list: e,
|
|
6526
|
-
let
|
|
6527
|
-
|
|
6528
|
-
},
|
|
6525
|
+
}), Tree = ({ list: e, canDrop: t, draggable: n = !1, onListReorder: r, onChangeOpen: i, testId: a, isInitialOpen: o = !1, autoOpenActiveItems: s = !1, treeRef: l, itemHasChild: u, onItemToggle: d, icons: f, allowParentReassignment: m, stickyHeader: h, height: g, render: _ }) => {
|
|
6526
|
+
let v = l ?? useRef(null), y = (e) => {
|
|
6527
|
+
i && i(e);
|
|
6528
|
+
}, b = (t) => {
|
|
6529
6529
|
let n = e.items.find((e) => e.id === t);
|
|
6530
|
-
return n && n.parent ? [n.parent, ...
|
|
6530
|
+
return n && n.parent ? [n.parent, ...b(n.parent)] : [];
|
|
6531
6531
|
};
|
|
6532
6532
|
useEffect(() => {
|
|
6533
|
-
if (
|
|
6533
|
+
if (s) {
|
|
6534
6534
|
let t = e.items.find((e) => e.active);
|
|
6535
6535
|
if (t) {
|
|
6536
|
-
let e =
|
|
6537
|
-
|
|
6536
|
+
let e = b(t.id);
|
|
6537
|
+
v.current?.open(e);
|
|
6538
6538
|
}
|
|
6539
6539
|
}
|
|
6540
|
-
}, [
|
|
6541
|
-
let
|
|
6542
|
-
let n =
|
|
6540
|
+
}, [s, e.items]);
|
|
6541
|
+
let x = (e, t) => e?.findIndex((e) => e?.id === t) ?? -1, S = (e, t) => {
|
|
6542
|
+
let n = x(t, e?.parent);
|
|
6543
6543
|
if (n >= 0) {
|
|
6544
6544
|
let r = t?.find((e) => e?.id === t[n]?.parent);
|
|
6545
6545
|
e.parent = r ? r.id : 0;
|
|
6546
6546
|
}
|
|
6547
|
-
},
|
|
6547
|
+
}, C = (e, t) => t?.filter((t) => t?.id !== e?.id) ?? [], w = (e, t, n) => (n?.splice(t, 0, e), n), T = (e) => e.map(({ id: e, parent: t, droppable: n, data: r }) => ({
|
|
6548
6548
|
id: e,
|
|
6549
6549
|
parent: t,
|
|
6550
6550
|
droppable: n,
|
|
6551
6551
|
...r
|
|
6552
|
-
})),
|
|
6553
|
-
let { dragSource:
|
|
6554
|
-
if (!
|
|
6555
|
-
let o =
|
|
6556
|
-
|
|
6557
|
-
},
|
|
6552
|
+
})), E = (e, t) => {
|
|
6553
|
+
let { dragSource: n, dropTarget: i } = t, a = [...e];
|
|
6554
|
+
if (!r) return;
|
|
6555
|
+
let o = x(a, n?.id), s = x(a, n?.parent), c = [];
|
|
6556
|
+
n?.parent === i?.id && o === 0 && m && (S(n, a), a = C(n, a), a = w(n, s, a)), c = T(a), r(c);
|
|
6557
|
+
}, D = e?.items?.map(({ id: e, droppable: t, parent: n, name: r, onDrop: i,...a }) => ({
|
|
6558
6558
|
id: e,
|
|
6559
6559
|
text: r,
|
|
6560
6560
|
droppable: t,
|
|
@@ -6566,41 +6566,48 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
|
|
|
6566
6566
|
}
|
|
6567
6567
|
}));
|
|
6568
6568
|
return /* @__PURE__ */ jsxs("div", {
|
|
6569
|
-
"data-testid":
|
|
6569
|
+
"data-testid": a,
|
|
6570
6570
|
className: list_module_default.list,
|
|
6571
|
-
style: { height:
|
|
6571
|
+
style: { height: g },
|
|
6572
6572
|
children: [e.name && !e.noHeader && /* @__PURE__ */ jsx(ListHeading, {
|
|
6573
6573
|
name: e.name,
|
|
6574
6574
|
actions: e.actions,
|
|
6575
|
-
stickyHeader:
|
|
6575
|
+
stickyHeader: h
|
|
6576
6576
|
}), /* @__PURE__ */ jsx(DndProvider, {
|
|
6577
6577
|
backend: MultiBackend,
|
|
6578
6578
|
options: getBackendOptions(),
|
|
6579
6579
|
context: window,
|
|
6580
6580
|
children: /* @__PURE__ */ jsx(Tree$1, {
|
|
6581
|
-
ref:
|
|
6582
|
-
tree:
|
|
6581
|
+
ref: v,
|
|
6582
|
+
tree: D,
|
|
6583
6583
|
sort: !1,
|
|
6584
6584
|
insertDroppableFirst: !1,
|
|
6585
|
-
canDrag: () =>
|
|
6586
|
-
canDrop: (e, { dragSource: t, dropTargetId: n }) => {
|
|
6585
|
+
canDrag: () => n,
|
|
6586
|
+
canDrop: t || ((e, { dragSource: t, dropTargetId: n }) => {
|
|
6587
6587
|
if (t?.parent === n) return !0;
|
|
6588
|
-
},
|
|
6588
|
+
}),
|
|
6589
6589
|
rootId: 0,
|
|
6590
|
-
render: (e, { depth:
|
|
6591
|
-
|
|
6590
|
+
render: (e, { depth: t, hasChild: r, handleRef: i, isOpen: a, onToggle: o }) => _ ? _(e, {
|
|
6591
|
+
depth: t,
|
|
6592
|
+
draggable: n,
|
|
6593
|
+
handleRef: i,
|
|
6594
|
+
hasChild: r,
|
|
6595
|
+
isOpen: a,
|
|
6596
|
+
onToggle: o
|
|
6597
|
+
}) : /* @__PURE__ */ jsx(TreeItem, {
|
|
6598
|
+
hasChild: u ? u(e) : r,
|
|
6592
6599
|
node: e,
|
|
6593
|
-
depth:
|
|
6594
|
-
isOpen:
|
|
6600
|
+
depth: t,
|
|
6601
|
+
isOpen: a,
|
|
6595
6602
|
onToggle: () => {
|
|
6596
|
-
|
|
6603
|
+
d?.(e, !a), o();
|
|
6597
6604
|
},
|
|
6598
|
-
draggable:
|
|
6599
|
-
icons:
|
|
6605
|
+
draggable: n,
|
|
6606
|
+
icons: f,
|
|
6600
6607
|
onDrop: e.data?.onDrop
|
|
6601
6608
|
}),
|
|
6602
|
-
onDrop:
|
|
6603
|
-
onChangeOpen:
|
|
6609
|
+
onDrop: E,
|
|
6610
|
+
onChangeOpen: y,
|
|
6604
6611
|
dropTargetOffset: 10,
|
|
6605
6612
|
placeholderRender: (e, { depth: t }) => /* @__PURE__ */ jsx(TreePlaceholder, { depth: t }),
|
|
6606
6613
|
placeholderComponent: "div",
|
|
@@ -6612,7 +6619,8 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
|
|
|
6612
6619
|
dropTarget: tree_module_default.dropTarget,
|
|
6613
6620
|
placeholder: tree_module_default.placeholderContainer
|
|
6614
6621
|
},
|
|
6615
|
-
initialOpen:
|
|
6622
|
+
initialOpen: o,
|
|
6623
|
+
enableAnimateExpand: !0
|
|
6616
6624
|
})
|
|
6617
6625
|
})]
|
|
6618
6626
|
});
|
|
@@ -8573,7 +8581,10 @@ const countDeltas = (e) => (Array.isArray(e) ? e : e ? [e] : []).reduce((e, t) =
|
|
|
8573
8581
|
if (i) return i;
|
|
8574
8582
|
}
|
|
8575
8583
|
return "";
|
|
8576
|
-
}, toText = (e) =>
|
|
8584
|
+
}, toText = (e) => {
|
|
8585
|
+
let t = (e) => isValueWithUnit(e) ? withPrettyUnitLabel(e) : String(e);
|
|
8586
|
+
return Array.isArray(e) ? e.length === 0 ? "" : e.some((e) => e && typeof e == "object") ? "Multiple changes..." : e.map(t).join(", ") : e && typeof e == "object" ? Object.keys(e).length === 0 ? "" : "Multiple changes..." : t(e);
|
|
8587
|
+
}, defaultMessage = (e) => {
|
|
8577
8588
|
switch (e.length) {
|
|
8578
8589
|
case 1: {
|
|
8579
8590
|
let [t] = e;
|
package/package.json
CHANGED