@oliasoft-open-source/react-ui-library 5.15.4 → 5.17.0-beta-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 +3 -2
- package/dist/index.js +80 -65
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1799,6 +1799,7 @@ export declare interface ITreeProps {
|
|
|
1799
1799
|
isOpen: boolean;
|
|
1800
1800
|
onToggle: (id: TStringOrNumber) => void;
|
|
1801
1801
|
}) => ReactElement;
|
|
1802
|
+
placeholderIndent?: TStringOrNumber;
|
|
1802
1803
|
}
|
|
1803
1804
|
|
|
1804
1805
|
declare interface ITreeRowItem extends TRowType_2 {
|
|
@@ -1811,7 +1812,7 @@ declare interface ITreeRowItem extends TRowType_2 {
|
|
|
1811
1812
|
|
|
1812
1813
|
export declare interface ITreeTableProps extends ITreeProps {
|
|
1813
1814
|
table: {
|
|
1814
|
-
columnAlignment?: (Align.LEFT | Align.RIGHT)[];
|
|
1815
|
+
columnAlignment?: (Align.LEFT | Align.RIGHT | null)[];
|
|
1815
1816
|
columnWidths?: string[];
|
|
1816
1817
|
fixedWidth?: string;
|
|
1817
1818
|
headers?: TRowType_2[];
|
|
@@ -2211,7 +2212,7 @@ declare const TRANSLATION_FALLBACK: {
|
|
|
2211
2212
|
unknown: string;
|
|
2212
2213
|
};
|
|
2213
2214
|
|
|
2214
|
-
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;
|
|
2215
|
+
export declare const Tree: ({ list, canDrop, draggable, onListReorder, onChangeOpen, testId, isInitialOpen, autoOpenActiveItems, treeRef: treeRefProp, itemHasChild, onItemToggle, icons, allowParentReassignment, stickyHeader, height, render, placeholderIndent, }: ITreeProps) => JSX_2.Element;
|
|
2215
2216
|
|
|
2216
2217
|
export declare const TreeTable: ({ allowParentReassignment, autoOpenActiveItems, canDrop, draggable, icons, isInitialOpen, itemHasChild, onItemToggle, onListReorder, onChangeOpen, table, testId, treeRef, }: ITreeTableProps) => JSX_2.Element;
|
|
2217
2218
|
|
package/dist/index.js
CHANGED
|
@@ -6680,32 +6680,32 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
|
|
|
6680
6680
|
]
|
|
6681
6681
|
})
|
|
6682
6682
|
});
|
|
6683
|
-
}, TreePlaceholder = ({ depth: e }) => /* @__PURE__ */ jsx("div", {
|
|
6683
|
+
}, TreePlaceholder = ({ depth: e, indent: t = "var(--size-sm)" }) => /* @__PURE__ */ jsx("div", {
|
|
6684
6684
|
className: tree_module_default.placeholder,
|
|
6685
|
-
style: { left:
|
|
6686
|
-
}), 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: _ }) => {
|
|
6687
|
-
var
|
|
6688
|
-
let
|
|
6685
|
+
style: { left: `calc(${t} * ${e})` }
|
|
6686
|
+
}), 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: _, placeholderIndent: v }) => {
|
|
6687
|
+
var y;
|
|
6688
|
+
let b = l == null ? useRef(null) : l, x = (e) => {
|
|
6689
6689
|
i && i(e);
|
|
6690
|
-
},
|
|
6690
|
+
}, S = (t) => {
|
|
6691
6691
|
let n = e.items.find((e) => e.id === t);
|
|
6692
|
-
return n && n.parent ? [n.parent, ...
|
|
6692
|
+
return n && n.parent ? [n.parent, ...S(n.parent)] : [];
|
|
6693
6693
|
};
|
|
6694
6694
|
useEffect(() => {
|
|
6695
6695
|
if (s) {
|
|
6696
6696
|
let n = e.items.find((e) => e.active);
|
|
6697
6697
|
if (n) {
|
|
6698
6698
|
var t;
|
|
6699
|
-
let e =
|
|
6700
|
-
(t =
|
|
6699
|
+
let e = S(n.id);
|
|
6700
|
+
(t = b.current) == null || t.open(e);
|
|
6701
6701
|
}
|
|
6702
6702
|
}
|
|
6703
6703
|
}, [s, e.items]);
|
|
6704
|
-
let
|
|
6704
|
+
let C = (e, t) => {
|
|
6705
6705
|
var n;
|
|
6706
6706
|
return (n = e == null ? void 0 : e.findIndex((e) => (e == null ? void 0 : e.id) === t)) == null ? -1 : n;
|
|
6707
|
-
},
|
|
6708
|
-
let n =
|
|
6707
|
+
}, w = (e, t) => {
|
|
6708
|
+
let n = C(t, e == null ? void 0 : e.parent);
|
|
6709
6709
|
if (n >= 0) {
|
|
6710
6710
|
let r = t == null ? void 0 : t.find((e) => {
|
|
6711
6711
|
var r;
|
|
@@ -6713,20 +6713,20 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
|
|
|
6713
6713
|
});
|
|
6714
6714
|
e.parent = r ? r.id : 0;
|
|
6715
6715
|
}
|
|
6716
|
-
},
|
|
6716
|
+
}, T = (e, t) => {
|
|
6717
6717
|
var n;
|
|
6718
6718
|
return (n = t == null ? void 0 : t.filter((t) => (t == null ? void 0 : t.id) !== (e == null ? void 0 : e.id))) == null ? [] : n;
|
|
6719
|
-
},
|
|
6719
|
+
}, E = (e, t, n) => (n == null || n.splice(t, 0, e), n), D = (e) => e.map(({ id: e, parent: t, droppable: n, data: r }) => ({
|
|
6720
6720
|
id: e,
|
|
6721
6721
|
parent: t,
|
|
6722
6722
|
droppable: n,
|
|
6723
6723
|
...r
|
|
6724
|
-
})),
|
|
6724
|
+
})), O = (e, t) => {
|
|
6725
6725
|
let { dragSource: n, dropTarget: i } = t, a = [...e];
|
|
6726
6726
|
if (!r) return;
|
|
6727
|
-
let o =
|
|
6728
|
-
(n == null ? void 0 : n.parent) === (i == null ? void 0 : i.id) && o === 0 && m && (
|
|
6729
|
-
},
|
|
6727
|
+
let o = C(a, n == null ? void 0 : n.id), s = C(a, n == null ? void 0 : n.parent), c = [];
|
|
6728
|
+
(n == null ? void 0 : n.parent) === (i == null ? void 0 : i.id) && o === 0 && m && (w(n, a), a = T(n, a), a = E(n, s, a)), c = D(a), r(c);
|
|
6729
|
+
}, k = e == null || (y = e.items) == null ? void 0 : y.map(({ id: e, droppable: t, parent: n, name: r, onDrop: i, ...a }) => ({
|
|
6730
6730
|
id: e,
|
|
6731
6731
|
text: r,
|
|
6732
6732
|
droppable: t,
|
|
@@ -6750,8 +6750,8 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
|
|
|
6750
6750
|
options: getBackendOptions(),
|
|
6751
6751
|
context: window,
|
|
6752
6752
|
children: /* @__PURE__ */ jsx(Tree$1, {
|
|
6753
|
-
ref:
|
|
6754
|
-
tree:
|
|
6753
|
+
ref: b,
|
|
6754
|
+
tree: k,
|
|
6755
6755
|
sort: !1,
|
|
6756
6756
|
insertDroppableFirst: !1,
|
|
6757
6757
|
canDrag: () => n,
|
|
@@ -6781,10 +6781,13 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
|
|
|
6781
6781
|
onDrop: (s = e.data) == null ? void 0 : s.onDrop
|
|
6782
6782
|
});
|
|
6783
6783
|
},
|
|
6784
|
-
onDrop:
|
|
6785
|
-
onChangeOpen:
|
|
6784
|
+
onDrop: O,
|
|
6785
|
+
onChangeOpen: x,
|
|
6786
6786
|
dropTargetOffset: 10,
|
|
6787
|
-
placeholderRender: (e, { depth: t }) => /* @__PURE__ */ jsx(TreePlaceholder, {
|
|
6787
|
+
placeholderRender: (e, { depth: t }) => /* @__PURE__ */ jsx(TreePlaceholder, {
|
|
6788
|
+
depth: t,
|
|
6789
|
+
indent: v
|
|
6790
|
+
}),
|
|
6788
6791
|
placeholderComponent: "div",
|
|
6789
6792
|
listComponent: "div",
|
|
6790
6793
|
listItemComponent: "div",
|
|
@@ -6801,17 +6804,19 @@ const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, drag
|
|
|
6801
6804
|
});
|
|
6802
6805
|
};
|
|
6803
6806
|
var tree_table_module_default = {
|
|
6804
|
-
treeTable: "
|
|
6805
|
-
treeTableHeader: "
|
|
6806
|
-
folderCell: "
|
|
6807
|
-
dragCell: "
|
|
6808
|
-
drag: "
|
|
6809
|
-
folder: "
|
|
6810
|
-
|
|
6811
|
-
nested: "_nested_3rlrs_63"
|
|
6807
|
+
treeTable: "_treeTable_1ywvy_1",
|
|
6808
|
+
treeTableHeader: "_treeTableHeader_1ywvy_22",
|
|
6809
|
+
folderCell: "_folderCell_1ywvy_30",
|
|
6810
|
+
dragCell: "_dragCell_1ywvy_31",
|
|
6811
|
+
drag: "_drag_1ywvy_31",
|
|
6812
|
+
folder: "_folder_1ywvy_30",
|
|
6813
|
+
active: "_active_1ywvy_61"
|
|
6812
6814
|
};
|
|
6813
6815
|
const TreeTableRow = ({ columnAlignment: e, columnWidths: t, depth: n, draggable: r, handleRef: i, hasChild: a, hasRowActions: o, icons: s, isOpen: c, node: l, onDragEnter: u, onDragOver: d, onDragLeave: f, onDrop: p, onToggle: m }) => {
|
|
6814
|
-
let { data: h, droppable: _ } = l, { id: v, cells: y, testId: b, actions: x = [] } = h,
|
|
6816
|
+
let { data: h, droppable: _ } = l, { id: v, cells: y, testId: b, actions: x = [], active: S, onRowClick: C } = h, w = _ || a, T = (e) => {
|
|
6817
|
+
let r = t ? t[e] : void 0;
|
|
6818
|
+
return e === 0 ? `calc(${r} - ${`calc(var(--size) * ${w ? n + 1 : n})`})` : r;
|
|
6819
|
+
};
|
|
6815
6820
|
return /* @__PURE__ */ jsx("table", {
|
|
6816
6821
|
className: table_module_default.table,
|
|
6817
6822
|
"data-testid": b,
|
|
@@ -6820,7 +6825,8 @@ const TreeTableRow = ({ columnAlignment: e, columnWidths: t, depth: n, draggable
|
|
|
6820
6825
|
onDragOver: d,
|
|
6821
6826
|
onDragLeave: f,
|
|
6822
6827
|
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", {
|
|
6823
|
-
|
|
6828
|
+
onClick: C,
|
|
6829
|
+
className: cx(tree_table_module_default.treeTableRow, S ? tree_table_module_default.active : void 0),
|
|
6824
6830
|
children: [
|
|
6825
6831
|
r && /* @__PURE__ */ jsx("td", {
|
|
6826
6832
|
className: tree_table_module_default.dragCell,
|
|
@@ -6831,14 +6837,10 @@ const TreeTableRow = ({ columnAlignment: e, columnWidths: t, depth: n, draggable
|
|
|
6831
6837
|
children: /* @__PURE__ */ jsx(Icon, { icon: IconType.DRAG })
|
|
6832
6838
|
})
|
|
6833
6839
|
}),
|
|
6834
|
-
/* @__PURE__ */ jsx("td", {
|
|
6840
|
+
Array.from({ length: n }).map((e, t) => /* @__PURE__ */ jsx("td", { className: tree_table_module_default.folderCell }, t)),
|
|
6841
|
+
w && /* @__PURE__ */ jsx("td", {
|
|
6835
6842
|
className: tree_table_module_default.folderCell,
|
|
6836
|
-
|
|
6837
|
-
width: S,
|
|
6838
|
-
minWidth: S,
|
|
6839
|
-
maxWidth: S
|
|
6840
|
-
},
|
|
6841
|
-
children: (_ || a) && /* @__PURE__ */ jsx("div", {
|
|
6843
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
6842
6844
|
className: tree_table_module_default.folder,
|
|
6843
6845
|
onClick: () => m(v),
|
|
6844
6846
|
onMouseDown: (e) => e.stopPropagation(),
|
|
@@ -6852,15 +6854,12 @@ const TreeTableRow = ({ columnAlignment: e, columnWidths: t, depth: n, draggable
|
|
|
6852
6854
|
})
|
|
6853
6855
|
})
|
|
6854
6856
|
}),
|
|
6855
|
-
y.map((
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
columnAlignment: e ? e[r] : null
|
|
6862
|
-
}, r);
|
|
6863
|
-
}),
|
|
6857
|
+
y.map((t, n) => /* @__PURE__ */ jsx(Cell, {
|
|
6858
|
+
isHeader: !1,
|
|
6859
|
+
cell: t,
|
|
6860
|
+
width: T(n),
|
|
6861
|
+
columnAlignment: e ? e[n] : null
|
|
6862
|
+
}, n)),
|
|
6864
6863
|
o && /* @__PURE__ */ jsx(Cell, {
|
|
6865
6864
|
isHeader: !1,
|
|
6866
6865
|
cell: {
|
|
@@ -6875,7 +6874,6 @@ const TreeTableRow = ({ columnAlignment: e, columnWidths: t, depth: n, draggable
|
|
|
6875
6874
|
className: cx(table_module_default.table, tree_table_module_default.treeTableHeader),
|
|
6876
6875
|
children: /* @__PURE__ */ jsx("thead", { children: i.map((i, a) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
6877
6876
|
n && /* @__PURE__ */ jsx("th", { className: tree_table_module_default.dragCell }),
|
|
6878
|
-
/* @__PURE__ */ jsx("th", { className: tree_table_module_default.folderCell }),
|
|
6879
6877
|
i.cells.map((n, r) => /* @__PURE__ */ jsx(Cell, {
|
|
6880
6878
|
isHeader: !0,
|
|
6881
6879
|
cell: n,
|
|
@@ -6918,6 +6916,7 @@ const TreeTableRow = ({ columnAlignment: e, columnWidths: t, depth: n, draggable
|
|
|
6918
6916
|
onChangeOpen: l,
|
|
6919
6917
|
onItemToggle: s,
|
|
6920
6918
|
onListReorder: c,
|
|
6919
|
+
placeholderIndent: "var(--size)",
|
|
6921
6920
|
render: (e, { depth: t, draggable: n, handleRef: r, hasChild: a, isOpen: o, onToggle: s }) => /* @__PURE__ */ jsx(TreeTableRow, {
|
|
6922
6921
|
node: e,
|
|
6923
6922
|
columnAlignment: p,
|
|
@@ -8964,23 +8963,39 @@ const createDiffJson = (e, t, n) => {
|
|
|
8964
8963
|
oldJson: a,
|
|
8965
8964
|
newJson: o
|
|
8966
8965
|
};
|
|
8967
|
-
}
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8966
|
+
};
|
|
8967
|
+
var humanize = (e) => e.replace(/\[\d+\]/g, "").replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/[_-]/g, " ").replace(/\s+/g, " ").trim().replace(/^./, (e) => e.toUpperCase()), formatValue = (e) => {
|
|
8968
|
+
if (e == null || e === "") return "empty";
|
|
8969
|
+
if (typeof e == "boolean") return e ? "true" : "false";
|
|
8970
|
+
if (typeof e == "string") return e;
|
|
8971
|
+
if (typeof e == "number") return String(e);
|
|
8972
|
+
if (Array.isArray(e)) return e.length ? e.join(", ") : "empty";
|
|
8973
|
+
try {
|
|
8974
|
+
return JSON.stringify(e);
|
|
8975
|
+
} catch {
|
|
8976
|
+
return String(e);
|
|
8977
|
+
}
|
|
8978
|
+
}, getChangedProperty = (e) => humanize(e.length > 0 ? e[e.length - 1] : ""), buildChangeSentence = ({ userName: e, type: t, property: n, before: r, after: i, sectionName: a }) => {
|
|
8979
|
+
let o = formatValue(r), s = formatValue(i);
|
|
8980
|
+
switch (t.toLowerCase()) {
|
|
8981
|
+
case "Modified": return `${e} updated ${n} from ${o} to ${s} in ${a}.`;
|
|
8982
|
+
case "Created": return s === "empty" ? `${e} created ${n} in ${a}.` : `${e} created ${n} with value ${s} in ${a}.`;
|
|
8983
|
+
case "Deleted": return o === "empty" ? `${e} deleted ${n} in ${a}.` : `${e} deleted ${n} (previously ${o}) in ${a}.`;
|
|
8984
|
+
default: return `${e} changed ${n} in ${a}.`;
|
|
8985
|
+
}
|
|
8986
|
+
};
|
|
8987
|
+
const ChangesOverview = ({ sectionNames: e, userName: t, diffs: n }) => /* @__PURE__ */ jsx(Table, { table: {
|
|
8988
|
+
headers: [{ cells: [{ value: "Type" }] }],
|
|
8975
8989
|
rows: n.map((n) => {
|
|
8976
8990
|
let { deltaFormat: r, path: i } = n, a = getSectionName(e, i), { type: o, before: s, after: c } = defaultMessage(r);
|
|
8977
|
-
return { cells: [
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8991
|
+
return { cells: [{ value: buildChangeSentence({
|
|
8992
|
+
userName: t,
|
|
8993
|
+
type: o,
|
|
8994
|
+
property: getChangedProperty(i),
|
|
8995
|
+
before: s,
|
|
8996
|
+
after: c,
|
|
8997
|
+
sectionName: a
|
|
8998
|
+
}) }] };
|
|
8984
8999
|
})
|
|
8985
9000
|
} }), viewTypes = Object.freeze({
|
|
8986
9001
|
summary: {
|
package/package.json
CHANGED