@oliasoft-open-source/react-ui-library 5.6.5-beta-7 → 5.7.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 +38 -53
- package/dist/index.js +1053 -1354
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Fragment,
|
|
1
|
+
import React, { Fragment, createContext, forwardRef, isValidElement, memo, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useTransition } from "react";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import { ReactSVG } from "react-svg";
|
|
4
4
|
import { TbAlertTriangle, TbArrowDown, TbArrowLeft, TbArrowRight, TbArrowUp, TbArrowsDiagonal, TbArrowsMaximize, TbArrowsMinimize, TbArrowsMove, TbArrowsSplit, TbBell, TbBold, TbBolt, TbBook2, TbBuildingSkyscraper, TbCamera, TbChartBar, TbChartLine, TbChartPie2, TbCheck, TbChevronDown, TbChevronLeft, TbChevronRight, TbChevronUp, TbChevronsLeft, TbChevronsRight, TbCircle, TbCircleCheck, TbCircleX, TbClipboard, TbClock, TbCode, TbCopy, TbCornerDownRight, TbDeviceFloppy, TbDeviceLaptop, TbDotsVertical, TbDownload, TbDroplet, TbExclamationMark, TbExternalLink, TbEye, TbEyeOff, TbFile, TbFilter, TbFilterOff, TbFocusCentered, TbFolder, TbFolderSearch, TbGauge, TbGitFork, TbGripVertical, TbHelp, TbInfoCircle, TbItalic, TbKey, TbLayoutColumns, TbLayoutRows, TbLink, TbLinkOff, TbList, TbListNumbers, TbLoader2, TbLock, TbLockOpen, TbMapPin, TbMessageCircle, TbMinus, TbMoon, TbMovie, TbNote, TbPencil, TbPlayerPause, TbPlayerPlay, TbPlayerSkipBack, TbPlayerSkipForward, TbPlayerStop, TbPlayerTrackNext, TbPlayerTrackPrev, TbPlus, TbQuestionMark, TbRefresh, TbReload, TbRotate, TbRowInsertBottom, TbRowInsertTop, TbRuler3, TbScale, TbSearch, TbServer, TbSettings, TbSortAscending, TbSortDescending, TbStar, TbSun, TbTable, TbTarget, TbTrash, TbUpload, TbUser, TbUsers, TbX } from "react-icons/tb";
|
|
@@ -15,13 +15,13 @@ import { ALT_UNITS, KNOWN_UNITS, altUnitsList, cleanNumStr, convertAndGetValue,
|
|
|
15
15
|
import { FixedSizeList } from "react-window";
|
|
16
16
|
import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
17
17
|
import { CSS } from "@dnd-kit/utilities";
|
|
18
|
-
import Papa from "papaparse";
|
|
19
18
|
import RcSlider from "rc-slider";
|
|
20
19
|
import memoizeOne from "memoize-one";
|
|
21
20
|
import isEqual$1 from "react-fast-compare";
|
|
22
21
|
import { DndContext, DragOverlay, closestCenter } from "@dnd-kit/core";
|
|
23
22
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
24
23
|
import { SimplifyAP } from "simplify-ts";
|
|
24
|
+
import Papa from "papaparse";
|
|
25
25
|
import { Slide, ToastContainer as Toaster, toast as toast$1 } from "react-toastify";
|
|
26
26
|
import { isNullOrUndefined } from "remirror";
|
|
27
27
|
import { BoldExtension, BulletListExtension, CodeExtension, ItalicExtension, MarkdownExtension, OrderedListExtension, PlaceholderExtension } from "remirror/extensions";
|
|
@@ -214,23 +214,23 @@ const NamedIcon = ({ icon: e }) => {
|
|
|
214
214
|
case "": return null;
|
|
215
215
|
default: return /* @__PURE__ */ jsx(TbCircle, {});
|
|
216
216
|
}
|
|
217
|
-
}, Icon = ({ icon: e, onClick: t, clickable: n = !1, color: r, size:
|
|
218
|
-
let
|
|
217
|
+
}, Icon = ({ icon: e, onClick: t, clickable: n = !1, color: r, size: a, testId: o }) => {
|
|
218
|
+
let c = useContext(DisabledContext), l = {
|
|
219
219
|
color: r,
|
|
220
220
|
fill: r,
|
|
221
|
-
fontSize:
|
|
222
|
-
width:
|
|
223
|
-
height:
|
|
221
|
+
fontSize: a || "inherit",
|
|
222
|
+
width: a || "auto",
|
|
223
|
+
height: a || "auto"
|
|
224
224
|
};
|
|
225
225
|
return /* @__PURE__ */ jsx("div", {
|
|
226
|
-
className: cx(icon_module_default.wrapper, (n || t) && !
|
|
226
|
+
className: cx(icon_module_default.wrapper, (n || t) && !c ? icon_module_default.clickable : ""),
|
|
227
227
|
style: l,
|
|
228
|
-
onClick: (e) => t && !
|
|
228
|
+
onClick: (e) => t && !c ? t(e) : void 0,
|
|
229
229
|
"data-testid": o,
|
|
230
230
|
children: isValidElement(e) ? e : typeof e == "string" && (e.includes(".svg") || e.includes("image/svg")) ? /* @__PURE__ */ jsx(ReactSVG, {
|
|
231
231
|
className: icon_module_default.customSvg,
|
|
232
232
|
beforeInjection: (e) => {
|
|
233
|
-
|
|
233
|
+
a && (e.setAttribute("width", String(a)), e.setAttribute("height", String(a)));
|
|
234
234
|
},
|
|
235
235
|
src: e
|
|
236
236
|
}) : typeof e == "string" && (e.includes(".png") || e.includes("image/png")) ? /* @__PURE__ */ jsx("img", {
|
|
@@ -325,7 +325,7 @@ const TooltipLayer = ({ text: e = "", error: t = !1, warning: n = !1, maxWidth:
|
|
|
325
325
|
...s,
|
|
326
326
|
size: 6
|
|
327
327
|
})]
|
|
328
|
-
}), Tooltip = ({ children: e, text: t = "", error: n = !1, placement: r = "top-center", possiblePlacements:
|
|
328
|
+
}), Tooltip = ({ children: e, text: t = "", error: n = !1, placement: r = "top-center", possiblePlacements: a = [
|
|
329
329
|
"top-center",
|
|
330
330
|
"left-center",
|
|
331
331
|
"bottom-center",
|
|
@@ -341,7 +341,7 @@ const TooltipLayer = ({ text: e = "", error: t = !1, warning: n = !1, maxWidth:
|
|
|
341
341
|
auto: !0,
|
|
342
342
|
triggerOffset: l,
|
|
343
343
|
placement: r,
|
|
344
|
-
possiblePlacements:
|
|
344
|
+
possiblePlacements: a,
|
|
345
345
|
onParentClose: v
|
|
346
346
|
});
|
|
347
347
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [y && b(/* @__PURE__ */ jsx(TooltipLayer, {
|
|
@@ -385,15 +385,15 @@ const HelpIcon = ({ text: e, onClick: t, icon: n = "help", active: r = !1, maxWi
|
|
|
385
385
|
maxWidth: i,
|
|
386
386
|
children: /* @__PURE__ */ jsx(Icon, { icon: n })
|
|
387
387
|
})
|
|
388
|
-
}), CheckBox = ({ noMargin: e = !1, dataix: t = 0, isInTable: n = !1, tabIndex: r = 0, checked: i = !1, indeterminate: a = !1, name: o, label:
|
|
389
|
-
let
|
|
388
|
+
}), CheckBox = ({ noMargin: e = !1, dataix: t = 0, isInTable: n = !1, tabIndex: r = 0, checked: i = !1, indeterminate: a = !1, name: o, label: l = "", disabled: u = !1, small: d = !1, onChange: f, testId: m, value: h, helpText: _, onClickHelp: v, textTransform: y = TextTransform.CAPITALIZE }) => {
|
|
389
|
+
let b = useContext(DisabledContext), x = _ || v, S = u || b, C = useRef(null);
|
|
390
390
|
return useEffect(() => {
|
|
391
|
-
|
|
391
|
+
C.current && (C.current.indeterminate = a);
|
|
392
392
|
}, [a]), /* @__PURE__ */ jsxs("div", {
|
|
393
|
-
className: cx(check_box_module_default.checkbox, e && check_box_module_default.noMargin, n && check_box_module_default.isInTable,
|
|
393
|
+
className: cx(check_box_module_default.checkbox, e && check_box_module_default.noMargin, n && check_box_module_default.isInTable, S && check_box_module_default.disabled, d && check_box_module_default.small, !l && check_box_module_default.noLabel),
|
|
394
394
|
"data-ix": t,
|
|
395
395
|
onClick: (e) => {
|
|
396
|
-
if (!
|
|
396
|
+
if (!S) {
|
|
397
397
|
let t = e.target;
|
|
398
398
|
t.name = o, t.checked = !i, f({
|
|
399
399
|
...e,
|
|
@@ -404,29 +404,30 @@ const HelpIcon = ({ text: e, onClick: t, icon: n = "help", active: r = !1, maxWi
|
|
|
404
404
|
});
|
|
405
405
|
}
|
|
406
406
|
},
|
|
407
|
-
"data-testid":
|
|
407
|
+
"data-testid": m,
|
|
408
408
|
children: [
|
|
409
409
|
/* @__PURE__ */ jsx("input", {
|
|
410
|
-
ref:
|
|
410
|
+
ref: C,
|
|
411
411
|
type: "checkbox",
|
|
412
412
|
tabIndex: r,
|
|
413
413
|
checked: i,
|
|
414
414
|
name: o,
|
|
415
415
|
onChange: () => {},
|
|
416
|
-
disabled:
|
|
416
|
+
disabled: S,
|
|
417
417
|
"data-indeterminate": a
|
|
418
418
|
}),
|
|
419
419
|
/* @__PURE__ */ jsxs("label", {
|
|
420
420
|
htmlFor: o,
|
|
421
|
+
style: { textTransform: y },
|
|
421
422
|
children: [/* @__PURE__ */ jsx("span", {
|
|
422
423
|
className: check_box_module_default.checkmark,
|
|
423
424
|
children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHECK })
|
|
424
|
-
}),
|
|
425
|
+
}), l]
|
|
425
426
|
}),
|
|
426
|
-
|
|
427
|
+
x && /* @__PURE__ */ jsx("div", {
|
|
427
428
|
className: check_box_module_default.helpIconEnabled,
|
|
428
429
|
onClick: v,
|
|
429
|
-
children: /* @__PURE__ */ jsx(HelpIcon, { text:
|
|
430
|
+
children: /* @__PURE__ */ jsx(HelpIcon, { text: _ })
|
|
430
431
|
})
|
|
431
432
|
]
|
|
432
433
|
});
|
|
@@ -526,7 +527,7 @@ var ButtonTooltipWrapper = ({ children: e, tooltip: t = null }) => t ? /* @__PUR
|
|
|
526
527
|
display: "inline-flex",
|
|
527
528
|
children: e
|
|
528
529
|
}) : /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
529
|
-
const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r = !1, ignoreDisabledContext: i = !1, groupOrder: a, icon: o = null, label:
|
|
530
|
+
const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r = !1, ignoreDisabledContext: i = !1, groupOrder: a, icon: o = null, label: c = "", loading: l = !1, name: u, pill: d = !1, round: f = !1, small: p = !1, styles: m = "", width: h = "", title: _ = "", type: v = ButtonType.BUTTON, onClick: y = () => {}, error: b, warning: x, testId: S, tooltip: C, inverted: w = !1, component: T = "button", url: E, tabIndex: D }) => {
|
|
530
531
|
let O = useContext(DisabledContext), k = (() => {
|
|
531
532
|
if (n) switch (n) {
|
|
532
533
|
case Color.DANGER:
|
|
@@ -549,11 +550,11 @@ const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r =
|
|
|
549
550
|
tooltip: C,
|
|
550
551
|
children: /* @__PURE__ */ jsxs(T, {
|
|
551
552
|
type: v === ButtonType.SUBMIT ? ButtonType.SUBMIT : ButtonType.BUTTON,
|
|
552
|
-
className: cx(button_module_default.button, e ? button_module_default.active : "", t ? button_module_default.basic : "", k, j ? button_module_default.disabled : "", (o || l) && !
|
|
553
|
+
className: cx(button_module_default.button, e ? button_module_default.active : "", t ? button_module_default.basic : "", k, j ? button_module_default.disabled : "", (o || l) && !c ? button_module_default.iconOnly : "", w ? button_module_default.inverted : "", A, d ? button_module_default.pill : "", f ? button_module_default.round : "", p ? button_module_default.small : "", m),
|
|
553
554
|
disabled: j,
|
|
554
555
|
name: u ?? "",
|
|
555
556
|
onClick: y,
|
|
556
|
-
...
|
|
557
|
+
..._ ? { title: _ } : {},
|
|
557
558
|
style: { width: h },
|
|
558
559
|
"data-error": b || null,
|
|
559
560
|
"data-warning": x || null,
|
|
@@ -574,7 +575,7 @@ const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r =
|
|
|
574
575
|
colored: t
|
|
575
576
|
})
|
|
576
577
|
}),
|
|
577
|
-
|
|
578
|
+
c
|
|
578
579
|
]
|
|
579
580
|
})
|
|
580
581
|
});
|
|
@@ -624,7 +625,7 @@ const Heading$3 = ({ label: e, onClick: t, icon: n, testId: r }) => /* @__PURE__
|
|
|
624
625
|
onClick: t,
|
|
625
626
|
children: /* @__PURE__ */ jsx(Icon, { icon: n })
|
|
626
627
|
})]
|
|
627
|
-
}), Divider$1 = () => /* @__PURE__ */ jsx("hr", { className: menu_module_default.divider }), Option$2 = ({ actions: e, label: t, url: n, onClick: r, description: i, icon: a, selected: o, closeOnOptionClick: s, close: c, disabled: l, inline: u, title: d, upload: f, uploadType: p, onChange: m = noop, testId: h, component:
|
|
628
|
+
}), Divider$1 = () => /* @__PURE__ */ jsx("hr", { className: menu_module_default.divider }), Option$2 = ({ actions: e, label: t, url: n, onClick: r, description: i, icon: a, selected: o, closeOnOptionClick: s, close: c, disabled: l, inline: u, title: d, upload: f, uploadType: p, onChange: m = noop, testId: h, component: _ = "a" }) => {
|
|
628
629
|
let v = (e) => {
|
|
629
630
|
if (e.stopPropagation(), l) {
|
|
630
631
|
e.preventDefault();
|
|
@@ -646,7 +647,7 @@ const Heading$3 = ({ label: e, onClick: t, icon: n, testId: r }) => /* @__PURE__
|
|
|
646
647
|
m?.(n), c?.();
|
|
647
648
|
}
|
|
648
649
|
};
|
|
649
|
-
return /* @__PURE__ */ jsxs(
|
|
650
|
+
return /* @__PURE__ */ jsxs(_, {
|
|
650
651
|
href: n,
|
|
651
652
|
to: n,
|
|
652
653
|
className: cx(menu_module_default.option, l ? menu_module_default.disabled : "", u ? menu_module_default.inline : "", o ? menu_module_default?.selected : ""),
|
|
@@ -740,13 +741,13 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
740
741
|
});
|
|
741
742
|
default: return null;
|
|
742
743
|
}
|
|
743
|
-
}, parentPath = (e) => e.includes("[") ? e.substr(0, e.lastIndexOf("[")) : e, childPath = (e, t) => `${e}.sections[${t}]`.replace(/^\./, ""), closePath = (e) => `${e}.close`.replace(/^\./, ""), siblings = (e, t) => get(e, parentPath(t), []), registerClose = (e, t, n) => set(e, closePath(t), n), Layer$2 = ({ sections: e, isNested: t, width: n, closeOnOptionClick: r, close:
|
|
744
|
+
}, parentPath = (e) => e.includes("[") ? e.substr(0, e.lastIndexOf("[")) : e, childPath = (e, t) => `${e}.sections[${t}]`.replace(/^\./, ""), closePath = (e) => `${e}.close`.replace(/^\./, ""), siblings = (e, t) => get(e, parentPath(t), []), registerClose = (e, t, n) => set(e, closePath(t), n), Layer$2 = ({ sections: e, isNested: t, width: n, closeOnOptionClick: r, close: a = () => {}, tree: o, path: s, maxHeight: c, showAllButton: l, testId: u }) => {
|
|
744
745
|
if (isValidElement(e)) return /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
745
|
-
let [d, f] = useState(!l?.visible), p = e,
|
|
746
|
+
let [d, f] = useState(!l?.visible), p = e, h = l?.additionalSections?.map((e) => ({
|
|
746
747
|
...e,
|
|
747
748
|
closeOnOptionClick: r,
|
|
748
749
|
visible: !0
|
|
749
|
-
})) ?? [],
|
|
750
|
+
})) ?? [], _ = p.length > 4 ? [{
|
|
750
751
|
type: MenuType.OPTION,
|
|
751
752
|
label: d ? l?.showLessTitle || "Show less" : l?.showAllTitle || "Show all",
|
|
752
753
|
onClick: () => f(!d),
|
|
@@ -756,7 +757,7 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
756
757
|
...e,
|
|
757
758
|
visible: !0,
|
|
758
759
|
closeOnOptionClick: r
|
|
759
|
-
} : e).concat(
|
|
760
|
+
} : e).concat(_, h).filter((e) => e?.visible) : p.map((e) => ({
|
|
760
761
|
...e,
|
|
761
762
|
closeOnOptionClick: r
|
|
762
763
|
}));
|
|
@@ -770,7 +771,7 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
770
771
|
children: /* @__PURE__ */ jsx("ul", { children: v.map((e, t) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Section$1, {
|
|
771
772
|
section: e,
|
|
772
773
|
closeOnOptionClick: e.closeOnOptionClick,
|
|
773
|
-
close:
|
|
774
|
+
close: a,
|
|
774
775
|
tree: o,
|
|
775
776
|
path: childPath(s, t),
|
|
776
777
|
maxHeight: c
|
|
@@ -808,7 +809,7 @@ const Badge = ({ children: e, color: t = "", title: n = null, dot: r = !1, margi
|
|
|
808
809
|
children: n
|
|
809
810
|
}), e]
|
|
810
811
|
});
|
|
811
|
-
}, Button$1 = ({ trigger: e, label: t, colored: n, small: r, width: i, disabled: a, groupOrder: o, loading:
|
|
812
|
+
}, Button$1 = ({ trigger: e, label: t, colored: n, small: r, width: i, disabled: a, groupOrder: o, loading: c, error: l, warning: u, active: d, tabIndex: f }) => {
|
|
812
813
|
let p = useContext(DisabledContext), m = e === TriggerType.BUTTON ? t : e === TriggerType.DROP_DOWN_BUTTON ? /* @__PURE__ */ jsxs("span", {
|
|
813
814
|
className: menu_module_default.middleAlignedInline,
|
|
814
815
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -829,7 +830,7 @@ const Badge = ({ children: e, color: t = "", title: n = null, dot: r = !1, margi
|
|
|
829
830
|
width: i,
|
|
830
831
|
groupOrder: o,
|
|
831
832
|
onClick: () => {},
|
|
832
|
-
loading:
|
|
833
|
+
loading: c,
|
|
833
834
|
disabled: a,
|
|
834
835
|
error: l,
|
|
835
836
|
warning: u,
|
|
@@ -943,7 +944,7 @@ var isMenuEmpty = (e) => {
|
|
|
943
944
|
testId: d && `${d}-layer`
|
|
944
945
|
})
|
|
945
946
|
})), m];
|
|
946
|
-
}, ContextMenu = ({ menu: e, width: t, disabled: n = !1, closeOnOptionClick: r = !0, closeParent: i, tree: a, path: o, groupOrder:
|
|
947
|
+
}, ContextMenu = ({ menu: e, width: t, disabled: n = !1, closeOnOptionClick: r = !0, closeParent: i, tree: a, path: o, groupOrder: c, testId: l }) => {
|
|
947
948
|
let u = useContext(DisabledContext), { label: d, trigger: f, fullHeightTrigger: p, colored: m, small: h, component: g, placement: _, possiblePlacements: v = ["bottom-start", "top-start"] } = e, [y, b] = useContextMenu({
|
|
948
949
|
sections: e.sections,
|
|
949
950
|
width: t,
|
|
@@ -953,7 +954,7 @@ var isMenuEmpty = (e) => {
|
|
|
953
954
|
closeParent: i,
|
|
954
955
|
tree: a,
|
|
955
956
|
path: o,
|
|
956
|
-
groupOrder:
|
|
957
|
+
groupOrder: c,
|
|
957
958
|
overflowContainer: !0,
|
|
958
959
|
maxHeight: void 0,
|
|
959
960
|
testId: l
|
|
@@ -973,11 +974,11 @@ var isMenuEmpty = (e) => {
|
|
|
973
974
|
isNested: !0,
|
|
974
975
|
component: g,
|
|
975
976
|
contextMenu: !0,
|
|
976
|
-
groupOrder:
|
|
977
|
+
groupOrder: c
|
|
977
978
|
}), y]
|
|
978
979
|
});
|
|
979
980
|
};
|
|
980
|
-
const DropDownMenu = ({ menu: e, width: t, disabled: n = !1, badgeTitle: r, badgeDot: i = !1, loading: a = !1, isNested: o = !1, closeOnOptionClick:
|
|
981
|
+
const DropDownMenu = ({ menu: e, width: t, disabled: n = !1, badgeTitle: r, badgeDot: i = !1, loading: a = !1, isNested: o = !1, closeOnOptionClick: c = !0, closeParent: l, tree: u, path: d, groupOrder: f, overflowContainer: p = !0, maxHeight: h, testId: g, open: _, setOpen: v, tooltip: y, error: b, warning: x, selected: S, tabIndex: C, active: w }) => {
|
|
981
982
|
let T = useContext(DisabledContext), { label: E, title: D, trigger: O, fullHeightTrigger: k, colored: A, small: j, sections: M, component: N, placement: P, showAllButton: F, possiblePlacements: I = ["bottom-start", "top-start"] } = e, [L, R] = isBoolean(_) && isFunction(v) ? [_, v] : useState(!1), z = () => R(!1), B = () => R(!0), { triggerProps: V, layerProps: H, renderLayer: U } = useLayer({
|
|
982
983
|
isOpen: L,
|
|
983
984
|
...placementOptions$1(P, o),
|
|
@@ -1031,11 +1032,11 @@ const DropDownMenu = ({ menu: e, width: t, disabled: n = !1, badgeTitle: r, badg
|
|
|
1031
1032
|
sections: M,
|
|
1032
1033
|
isNested: o,
|
|
1033
1034
|
width: t,
|
|
1034
|
-
closeOnOptionClick:
|
|
1035
|
+
closeOnOptionClick: c,
|
|
1035
1036
|
close: l || z,
|
|
1036
1037
|
tree: u,
|
|
1037
1038
|
path: d,
|
|
1038
|
-
maxHeight:
|
|
1039
|
+
maxHeight: h,
|
|
1039
1040
|
showAllButton: F,
|
|
1040
1041
|
testId: g && `${g}-layer`
|
|
1041
1042
|
})
|
|
@@ -1124,15 +1125,15 @@ var breadcrumb_module_default = {
|
|
|
1124
1125
|
let BreadcrumbLinkType = /* @__PURE__ */ function(e) {
|
|
1125
1126
|
return e.LABEL = "label", e.LINK = "link", e.CUSTOM = "custom", e;
|
|
1126
1127
|
}({});
|
|
1127
|
-
const Link$2 = ({ type: e = BreadcrumbLinkType.LABEL, label: t, url: n, onClick: r, active:
|
|
1128
|
-
let l = useContext(DisabledContext), u = e === BreadcrumbLinkType.LINK && n !== void 0, d = e === BreadcrumbLinkType.CUSTOM && isValidElement(
|
|
1128
|
+
const Link$2 = ({ type: e = BreadcrumbLinkType.LABEL, label: t, url: n, onClick: r, active: a, disabled: o, element: c }) => {
|
|
1129
|
+
let l = useContext(DisabledContext), u = e === BreadcrumbLinkType.LINK && n !== void 0, d = e === BreadcrumbLinkType.CUSTOM && isValidElement(c);
|
|
1129
1130
|
return /* @__PURE__ */ jsx("span", {
|
|
1130
1131
|
onClick: r,
|
|
1131
|
-
className: cx(breadcrumb_module_default.labelContainer,
|
|
1132
|
+
className: cx(breadcrumb_module_default.labelContainer, a && breadcrumb_module_default.active, (o || l) && breadcrumb_module_default.disabled),
|
|
1132
1133
|
children: u ? /* @__PURE__ */ jsx("a", {
|
|
1133
1134
|
href: n,
|
|
1134
1135
|
children: t
|
|
1135
|
-
}) : d ?
|
|
1136
|
+
}) : d ? c : t
|
|
1136
1137
|
});
|
|
1137
1138
|
}, Breadcrumb = ({ links: e, small: t = !1 }) => /* @__PURE__ */ jsx("div", {
|
|
1138
1139
|
className: cx(breadcrumb_module_default.breadcrumb, t && breadcrumb_module_default.small),
|
|
@@ -1157,7 +1158,7 @@ var button_group_module_default = {
|
|
|
1157
1158
|
buttonGroup: "_buttonGroup_iu2wi_11"
|
|
1158
1159
|
};
|
|
1159
1160
|
const ButtonGroup = (e) => {
|
|
1160
|
-
let { basic: t = !1, items: n = [], header: r = "", onSelected: i = () => {}, small: a = !1, value: o = "", testId:
|
|
1161
|
+
let { basic: t = !1, items: n = [], header: r = "", onSelected: i = () => {}, small: a = !1, value: o = "", testId: c = void 0, disabled: l } = e, u = useContext(DisabledContext), d = (e, t, n, r, a) => {
|
|
1161
1162
|
e.preventDefault(), e.stopPropagation(), !(l || a || u) && i(t, n, r);
|
|
1162
1163
|
}, f = (e, t) => t === "string" ? e : t === "object" ? e.label : t === "array" ? e[1] : null, p = (e, t) => t === "string" ? e : t === "object" ? e.value ?? "" : t === "array" ? e[0] ?? "" : "", m = (e, t, n) => t === "object" && "key" in e ? e.key : n, h = (e, t) => t === "object" ? e.hidden : !1, g = (e, t) => t === "object" ? e.icon : void 0, _ = (e, t, n) => e === "object" ? String(t) === String(o) : n === o, v = () => {
|
|
1163
1164
|
if (r) return /* @__PURE__ */ jsx("label", {
|
|
@@ -1190,7 +1191,7 @@ const ButtonGroup = (e) => {
|
|
|
1190
1191
|
});
|
|
1191
1192
|
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { children: [v(), /* @__PURE__ */ jsx("div", {
|
|
1192
1193
|
className: button_group_module_default.buttonGroup,
|
|
1193
|
-
"data-testid":
|
|
1194
|
+
"data-testid": c,
|
|
1194
1195
|
children: y()
|
|
1195
1196
|
})] }) });
|
|
1196
1197
|
};
|
|
@@ -1493,16 +1494,16 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1493
1494
|
},
|
|
1494
1495
|
children: e
|
|
1495
1496
|
}) : /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
1496
|
-
}, Drawer = ({ background: e = "var(--color-background-raised)", fixed: t = !1, open: n = !1, setOpen: r, right:
|
|
1497
|
-
let D = u === !0, O = !D && isValidElement(u), [k, A] = r ? [n, r] : D ||
|
|
1497
|
+
}, Drawer = ({ background: e = "var(--color-background-raised)", fixed: t = !1, open: n = !1, setOpen: r, right: a = !1, width: o = 400, closedWidth: s = 0, shadow: c = !1, top: l = 0, button: u = null, buttonAnimate: d = !0, buttonPosition: f = ButtonPosition.BOTTOM, border: p = !1, children: h = null, tabs: _, defaultTabIndex: v = 0, activeTab: y, setActiveTab: b, testId: x, onResize: S, getActiveTab: C, onClose: w, onOpen: T, maxOpenWidth: E }) => {
|
|
1498
|
+
let D = u === !0, O = !D && isValidElement(u), [k, A] = r ? [n, r] : D || _ ? useState(n) : [n, () => {}], [j, M] = useState(v), N = r ? n : k, P = r || A, F = b === void 0 ? j : y, I = b || M, L = Array.isArray(o) ? o[F || 0] : o, R = N ? L : _ ? 35 : s;
|
|
1498
1499
|
return /* @__PURE__ */ jsx(DrawerResizeWrapper, {
|
|
1499
1500
|
width: R,
|
|
1500
1501
|
onResize: S,
|
|
1501
1502
|
setOpen: P,
|
|
1502
|
-
right:
|
|
1503
|
+
right: a,
|
|
1503
1504
|
maxOpenWidth: E,
|
|
1504
1505
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1505
|
-
className: cx(drawer_module_default.drawer, c ? drawer_module_default.shadow : "", t ? drawer_module_default.fixed : drawer_module_default.inline,
|
|
1506
|
+
className: cx(drawer_module_default.drawer, c ? drawer_module_default.shadow : "", t ? drawer_module_default.fixed : drawer_module_default.inline, a ? drawer_module_default.right : drawer_module_default.left),
|
|
1506
1507
|
style: { top: l },
|
|
1507
1508
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1508
1509
|
className: cx(drawer_module_default.drawerContent, p && drawer_module_default.border),
|
|
@@ -1511,16 +1512,16 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1511
1512
|
borderColor: typeof p == "string" ? p : void 0,
|
|
1512
1513
|
width: R
|
|
1513
1514
|
},
|
|
1514
|
-
children:
|
|
1515
|
+
children: _ ? /* @__PURE__ */ jsx(DrawerTabs, {
|
|
1515
1516
|
width: L,
|
|
1516
1517
|
testId: x,
|
|
1517
|
-
tabs:
|
|
1518
|
+
tabs: _,
|
|
1518
1519
|
open: N,
|
|
1519
1520
|
activeTab: F || 0,
|
|
1520
1521
|
background: e,
|
|
1521
1522
|
handleTabClick: (e) => {
|
|
1522
1523
|
let t = (t) => {
|
|
1523
|
-
|
|
1524
|
+
_ && t && t(_[e]);
|
|
1524
1525
|
};
|
|
1525
1526
|
F === e && N && P ? (t(w), P(!1)) : !N && P && (t(T), P(!0), S && ((e) => {
|
|
1526
1527
|
let t;
|
|
@@ -1533,21 +1534,21 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1533
1534
|
}
|
|
1534
1535
|
}) : /* @__PURE__ */ jsx("div", {
|
|
1535
1536
|
style: { width: L },
|
|
1536
|
-
children:
|
|
1537
|
+
children: h
|
|
1537
1538
|
})
|
|
1538
1539
|
}), u && /* @__PURE__ */ jsx("span", {
|
|
1539
1540
|
className: cx(drawer_module_default.toggleButton, k && (D || O && d) ? drawer_module_default.toggleButtonOpen : "", f === "top" ? drawer_module_default.top : drawer_module_default.bottom),
|
|
1540
1541
|
children: O ? u : /* @__PURE__ */ jsx(Button, {
|
|
1541
1542
|
onClick: P ? () => P(!N) : void 0,
|
|
1542
1543
|
round: !0,
|
|
1543
|
-
icon:
|
|
1544
|
+
icon: a ? IconType.CHEVRON_RIGHT : IconType.CHEVRON_LEFT
|
|
1544
1545
|
})
|
|
1545
1546
|
})]
|
|
1546
1547
|
})
|
|
1547
1548
|
});
|
|
1548
1549
|
};
|
|
1549
1550
|
var input_group_module_default = { inputGroup: "_inputGroup_biuoa_1" }, isDOMTypeElement = (e) => isValidElement(e) && typeof e.type == "string";
|
|
1550
|
-
const InputGroup = ({ children: n, small: r = !1, width:
|
|
1551
|
+
const InputGroup = ({ children: n, small: r = !1, width: a = "100%" }) => {
|
|
1551
1552
|
let o = Array.isArray(n) ? n.filter((e) => isValidElement(e)) : [n], s = o.map((n, i) => {
|
|
1552
1553
|
let a = isDOMTypeElement(n), { groupOrder: s } = a ? { groupOrder: null } : n.props, c = o.length, l = i === 0, u = i === c - 1, d = s || (!c || c === 1 ? null : l ? GroupOrder.FIRST : u ? GroupOrder.LAST : GroupOrder.MIDDLE);
|
|
1553
1554
|
return a ? n : /* @__PURE__ */ jsx(Fragment, { children: React.cloneElement(n, {
|
|
@@ -1557,27 +1558,27 @@ const InputGroup = ({ children: n, small: r = !1, width: i = "100%" }) => {
|
|
|
1557
1558
|
});
|
|
1558
1559
|
return /* @__PURE__ */ jsx("div", {
|
|
1559
1560
|
className: cx(input_group_module_default.inputGroup),
|
|
1560
|
-
style: { width:
|
|
1561
|
+
style: { width: a },
|
|
1561
1562
|
children: s
|
|
1562
1563
|
});
|
|
1563
1564
|
};
|
|
1564
1565
|
var input_module_default = {
|
|
1565
|
-
inputInTable: "
|
|
1566
|
-
inputHover: "
|
|
1567
|
-
inputFocus: "
|
|
1568
|
-
inputError: "
|
|
1569
|
-
inputWarning: "
|
|
1570
|
-
inputDisabled: "
|
|
1571
|
-
hideScrollbars: "
|
|
1572
|
-
input: "
|
|
1573
|
-
isInTable: "
|
|
1574
|
-
small: "
|
|
1575
|
-
right: "
|
|
1576
|
-
groupOrderFirst: "
|
|
1577
|
-
groupOrderMiddle: "
|
|
1578
|
-
groupOrderLast: "
|
|
1566
|
+
inputInTable: "_inputInTable_1285q_1",
|
|
1567
|
+
inputHover: "_inputHover_1285q_13",
|
|
1568
|
+
inputFocus: "_inputFocus_1285q_18",
|
|
1569
|
+
inputError: "_inputError_1285q_25",
|
|
1570
|
+
inputWarning: "_inputWarning_1285q_26",
|
|
1571
|
+
inputDisabled: "_inputDisabled_1285q_61",
|
|
1572
|
+
hideScrollbars: "_hideScrollbars_1285q_67",
|
|
1573
|
+
input: "_input_1285q_1",
|
|
1574
|
+
isInTable: "_isInTable_1285q_100",
|
|
1575
|
+
small: "_small_1285q_124",
|
|
1576
|
+
right: "_right_1285q_170",
|
|
1577
|
+
groupOrderFirst: "_groupOrderFirst_1285q_173",
|
|
1578
|
+
groupOrderMiddle: "_groupOrderMiddle_1285q_174",
|
|
1579
|
+
groupOrderLast: "_groupOrderLast_1285q_175"
|
|
1579
1580
|
};
|
|
1580
|
-
const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, width: r = void 0, small: i = !1, onChange: a = noop, placeholder: o = "", value:
|
|
1581
|
+
const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, width: r = void 0, small: i = !1, onChange: a = noop, placeholder: o = "", value: c = "", onKeyPress: l = () => {}, onFocus: u = () => {}, onBlur: d = () => {}, onPaste: f = () => {}, onKeyDown: p = () => {}, selectOnFocus: m = !0, name: h = void 0, type: _ = "text", tabIndex: v = 0, disabled: y = !1, right: b = !1, warning: x = null, groupOrder: S = null, maxTooltipWidth: C = void 0, testId: w = void 0, size: T = null }, E) => {
|
|
1581
1582
|
let D = useContext(DisabledContext), O = (() => {
|
|
1582
1583
|
if (S) switch (S) {
|
|
1583
1584
|
case GroupOrder.FIRST: return input_module_default.groupOrderFirst;
|
|
@@ -1598,10 +1599,10 @@ const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, wi
|
|
|
1598
1599
|
display: "block",
|
|
1599
1600
|
children: /* @__PURE__ */ jsx("input", {
|
|
1600
1601
|
ref: E,
|
|
1601
|
-
type:
|
|
1602
|
+
type: _ || "text",
|
|
1602
1603
|
size: T || 20,
|
|
1603
1604
|
placeholder: o ?? "",
|
|
1604
|
-
value:
|
|
1605
|
+
value: c ?? "",
|
|
1605
1606
|
onChange: a,
|
|
1606
1607
|
onKeyPress: l,
|
|
1607
1608
|
onKeyDown: p,
|
|
@@ -1620,8 +1621,7 @@ const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, wi
|
|
|
1620
1621
|
style: { width: k },
|
|
1621
1622
|
"data-error": e || null,
|
|
1622
1623
|
"data-warning": x || null,
|
|
1623
|
-
"data-testid": w
|
|
1624
|
-
onDragStart: (e) => e.preventDefault()
|
|
1624
|
+
"data-testid": w
|
|
1625
1625
|
})
|
|
1626
1626
|
})
|
|
1627
1627
|
});
|
|
@@ -1647,11 +1647,11 @@ var getName = (e, t) => {
|
|
|
1647
1647
|
let n;
|
|
1648
1648
|
return e ? (n = t ? `Selected - ${Object.keys(e)?.length} files` : e?.name, n || null) : null;
|
|
1649
1649
|
};
|
|
1650
|
-
const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No file selected", disabled: r = !1, file: i, accept: a, multi: o, name:
|
|
1651
|
-
let f = useContext(DisabledContext),
|
|
1650
|
+
const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No file selected", disabled: r = !1, file: i, accept: a, multi: o, name: c, width: l, onChange: u = noop, testId: d }) => {
|
|
1651
|
+
let f = useContext(DisabledContext), m = useRef(null), h = getName(i, o);
|
|
1652
1652
|
return /* @__PURE__ */ jsxs("div", {
|
|
1653
1653
|
onClick: () => {
|
|
1654
|
-
r || f ||
|
|
1654
|
+
r || f || m.current?.click();
|
|
1655
1655
|
},
|
|
1656
1656
|
style: { width: l },
|
|
1657
1657
|
children: [/* @__PURE__ */ jsxs(InputGroup, { children: [/* @__PURE__ */ jsx(Input, {
|
|
@@ -1664,8 +1664,8 @@ const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No
|
|
|
1664
1664
|
disabled: t || r || f,
|
|
1665
1665
|
groupOrder: "last"
|
|
1666
1666
|
})] }), /* @__PURE__ */ jsx("input", {
|
|
1667
|
-
name:
|
|
1668
|
-
ref:
|
|
1667
|
+
name: c,
|
|
1668
|
+
ref: m,
|
|
1669
1669
|
className: file_input_module_default.fileInput,
|
|
1670
1670
|
type: "file",
|
|
1671
1671
|
accept: a,
|
|
@@ -1679,7 +1679,7 @@ const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No
|
|
|
1679
1679
|
name: e.target.name
|
|
1680
1680
|
}
|
|
1681
1681
|
};
|
|
1682
|
-
u(r),
|
|
1682
|
+
u(r), m.current && (m.current.value = "");
|
|
1683
1683
|
},
|
|
1684
1684
|
"data-testid": d
|
|
1685
1685
|
})]
|
|
@@ -1782,7 +1782,7 @@ const ProgressBar = ({ width: e = "auto", inverted: t = !1, colored: n = !0, sho
|
|
|
1782
1782
|
})
|
|
1783
1783
|
});
|
|
1784
1784
|
var REQUEST_TIME = 4e4;
|
|
1785
|
-
const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r, onComplete: i, onFailed: a, onError: o, width: s, heading:
|
|
1785
|
+
const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r, onComplete: i, onFailed: a, onError: o, width: s, heading: l, dialogText: u, fileInputText: d, fileInputPlaceholder: f, uploadText: p, cancelText: h, testId: g }) => {
|
|
1786
1786
|
let [_, v] = useState(null), [y, b] = useState(!1), [x, S] = useState(0), C = 0, w = () => {
|
|
1787
1787
|
C += 250, S(C);
|
|
1788
1788
|
}, T = (e) => {
|
|
@@ -1837,7 +1837,7 @@ const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r,
|
|
|
1837
1837
|
disabled: !_ || y,
|
|
1838
1838
|
testId: `${g}-button-upload`
|
|
1839
1839
|
}), /* @__PURE__ */ jsx(Button, {
|
|
1840
|
-
label:
|
|
1840
|
+
label: h || "Cancel",
|
|
1841
1841
|
onClick: k,
|
|
1842
1842
|
testId: `${g}-button-cancel`
|
|
1843
1843
|
})] });
|
|
@@ -1846,7 +1846,7 @@ const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r,
|
|
|
1846
1846
|
centered: !0,
|
|
1847
1847
|
children: /* @__PURE__ */ jsx(Dialog, { dialog: {
|
|
1848
1848
|
scroll: !0,
|
|
1849
|
-
heading:
|
|
1849
|
+
heading: l || "Smart Upload",
|
|
1850
1850
|
content: A,
|
|
1851
1851
|
footer: j,
|
|
1852
1852
|
onClose: k,
|
|
@@ -1987,12 +1987,12 @@ var reducer$1 = (e, t) => {
|
|
|
1987
1987
|
}
|
|
1988
1988
|
};
|
|
1989
1989
|
const Message = ({ message: e }) => {
|
|
1990
|
-
let { visible: t, type: n = MessageType.INFO, icon: r, heading: i, content: a, details: o, detailsVisible: s = !1, footer: c, withDismiss: l, onClose: u, width: d, maxHeight:
|
|
1990
|
+
let { visible: t, type: n = MessageType.INFO, icon: r, heading: i, content: a, details: o, detailsVisible: s = !1, footer: c, withDismiss: l, onClose: u, width: d, maxHeight: p } = e, [m, h] = useReducer(reducer$1, { detailsVisible: s });
|
|
1991
1991
|
return /* @__PURE__ */ jsx(Fragment$1, { children: t ? /* @__PURE__ */ jsxs("div", {
|
|
1992
1992
|
className: cx(message_module_default.container, d ? message_module_default.block : null, n === MessageType.SUCCESS ? message_module_default.success : n === MessageType.WARNING ? message_module_default.warning : n === MessageType.ERROR ? message_module_default.error : message_module_default.info),
|
|
1993
1993
|
style: {
|
|
1994
1994
|
width: d,
|
|
1995
|
-
maxHeight:
|
|
1995
|
+
maxHeight: p
|
|
1996
1996
|
},
|
|
1997
1997
|
children: [
|
|
1998
1998
|
/* @__PURE__ */ jsx("div", { children: r ? /* @__PURE__ */ jsx("div", {
|
|
@@ -2077,7 +2077,7 @@ var footer_module_default = {
|
|
|
2077
2077
|
groupOrderMiddle: "_groupOrderMiddle_sl2b5_194",
|
|
2078
2078
|
groupOrderLast: "_groupOrderLast_sl2b5_198"
|
|
2079
2079
|
};
|
|
2080
|
-
const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, tooltip: r = null, options: i, onChange: a = noop, onFocus: o = noop, onBlur:
|
|
2080
|
+
const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, tooltip: r = null, options: i, onChange: a = noop, onFocus: o = noop, onBlur: c = noop, right: l = !1, small: u = !1, tabIndex: d = 0, selectedOption: f, width: p = null, groupOrder: m, testId: h, isInTable: _ = !1, clearable: v, placeholder: y, hasNonExistentValue: b, maxTooltipWidth: x, borderRadius: S }) => {
|
|
2081
2081
|
let C = useContext(DisabledContext), w = f === null || f?.value === null ? "unselected" : f?.value, T = w === "unselected", E = (w === "unselected" || v ? [/* @__PURE__ */ jsx("option", {
|
|
2082
2082
|
value: "unselected",
|
|
2083
2083
|
disabled: !v,
|
|
@@ -2106,7 +2106,7 @@ const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, to
|
|
|
2106
2106
|
enabled: r && isStringNumberOrNode(r) || t && isStringNumberOrNode(t) || n && isStringNumberOrNode(n) || !1,
|
|
2107
2107
|
maxWidth: x,
|
|
2108
2108
|
children: /* @__PURE__ */ jsx("select", {
|
|
2109
|
-
className: cx(native_select_module_default.select, T ? native_select_module_default.unSelected : "", l ? native_select_module_default.right : "", u ? native_select_module_default.small : "",
|
|
2109
|
+
className: cx(native_select_module_default.select, T ? native_select_module_default.unSelected : "", l ? native_select_module_default.right : "", u ? native_select_module_default.small : "", _ ? native_select_module_default.isInTable : "", D),
|
|
2110
2110
|
style: {
|
|
2111
2111
|
width: p || "",
|
|
2112
2112
|
borderRadius: S || ""
|
|
@@ -2116,7 +2116,7 @@ const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, to
|
|
|
2116
2116
|
n = t === "unselected" ? { value: null } : i.find((e) => String(e.value) === String(t)) || { value: null }, a(e, n);
|
|
2117
2117
|
},
|
|
2118
2118
|
onFocus: o,
|
|
2119
|
-
onBlur:
|
|
2119
|
+
onBlur: c,
|
|
2120
2120
|
tabIndex: d,
|
|
2121
2121
|
value: w,
|
|
2122
2122
|
disabled: e || C,
|
|
@@ -2239,10 +2239,10 @@ const getWidestOptionWidth = (e, t, n, r) => {
|
|
|
2239
2239
|
return Math.ceil(i + a);
|
|
2240
2240
|
};
|
|
2241
2241
|
var List$1 = FixedSizeList;
|
|
2242
|
-
const Layer$1 = ({ listRef: e, isMulti: t, sections: n, selectedOptions: r, onSelectOption: i, focusedOptionIndex: a, width: o, small: s, firstSelectedOptionIndex:
|
|
2242
|
+
const Layer$1 = ({ listRef: e, isMulti: t, sections: n, selectedOptions: r, onSelectOption: i, focusedOptionIndex: a, width: o, small: s, firstSelectedOptionIndex: l, closeLayer: u, testId: d }) => {
|
|
2243
2243
|
useEffect(() => {
|
|
2244
|
-
|
|
2245
|
-
}, [
|
|
2244
|
+
l != null && e.current !== null && typeof e.current.scrollToItem == "function" && e.current.scrollToItem(l, "start");
|
|
2245
|
+
}, [l, e]);
|
|
2246
2246
|
let f = s ? 24 : 30;
|
|
2247
2247
|
return /* @__PURE__ */ jsx("div", {
|
|
2248
2248
|
"data-testid": d,
|
|
@@ -2302,12 +2302,12 @@ var trigger_module_default = {
|
|
|
2302
2302
|
detailedLabel: "_detailedLabel_7uwhv_307"
|
|
2303
2303
|
};
|
|
2304
2304
|
const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId: r }) => {
|
|
2305
|
-
let i = useFontsReady(), [a, o] = useState([]), [s,
|
|
2305
|
+
let i = useFontsReady(), [a, o] = useState([]), [s, l] = useState([]);
|
|
2306
2306
|
return useEffect(() => {
|
|
2307
2307
|
let r = [], a = [], s = 0;
|
|
2308
2308
|
e.forEach((o, c) => {
|
|
2309
2309
|
s += getMultiOptionWidth(o, t, i), c === e.length - 1 && s < n || s < n - 24 ? r.push(o) : a.push(o);
|
|
2310
|
-
}), o(r),
|
|
2310
|
+
}), o(r), l(a);
|
|
2311
2311
|
}, [
|
|
2312
2312
|
e,
|
|
2313
2313
|
i,
|
|
@@ -2361,7 +2361,7 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
|
|
|
2361
2361
|
"data-testid": c && `${c}-input`
|
|
2362
2362
|
}) : null]
|
|
2363
2363
|
});
|
|
2364
|
-
}, Trigger = ({ selectedOptions: e, searchValue: t, searchable: n, clearable: r, onClickTrigger: i, element: a, error: o, warning: s, tooltip: c, small: l, isInTable: u, disabled: d, onChangeSearch: f, onClickDeselect: p, onClickClear: m, tabIndex: h, isOpen:
|
|
2364
|
+
}, Trigger = ({ selectedOptions: e, searchValue: t, searchable: n, clearable: r, onClickTrigger: i, element: a, error: o, warning: s, tooltip: c, small: l, isInTable: u, disabled: d, onChangeSearch: f, onClickDeselect: p, onClickClear: m, tabIndex: h, isOpen: _, triggerRef: v, clearAllIsFocused: y, focusedSelectedOptionIndex: b, onFocus: x, onBlur: S, groupOrder: C, maxTooltipWidth: w, placeholder: T, right: E, testId: D }) => {
|
|
2365
2365
|
let [O, k] = useFocus(), A = Array.isArray(e) ? e.length > 0 && e[0]?.value : e?.value, j = r && A, M = (() => {
|
|
2366
2366
|
if (C) switch (C) {
|
|
2367
2367
|
case GroupOrder.FIRST: return trigger_module_default.groupOrderFirst;
|
|
@@ -2381,7 +2381,7 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
|
|
|
2381
2381
|
} : e, P = /* @__PURE__ */ jsxs(Fragment$1, { children: [a, /* @__PURE__ */ jsxs("div", {
|
|
2382
2382
|
ref: v,
|
|
2383
2383
|
tabIndex: h,
|
|
2384
|
-
className: cx(trigger_module_default.trigger,
|
|
2384
|
+
className: cx(trigger_module_default.trigger, _ ? trigger_module_default.isOpen : "", d ? trigger_module_default.disabled : "", l ? trigger_module_default.small : "", u ? trigger_module_default.isInTable : "", E ? trigger_module_default.right : "", M),
|
|
2385
2385
|
onClick: (e) => {
|
|
2386
2386
|
e.stopPropagation(), requestAnimationFrame(() => {
|
|
2387
2387
|
i(e), typeof k == "function" && k();
|
|
@@ -2532,7 +2532,7 @@ let ActionTypes = /* @__PURE__ */ function(e) {
|
|
|
2532
2532
|
}({}), EventKey = /* @__PURE__ */ function(e) {
|
|
2533
2533
|
return e.RIGHT = "ArrowRight", e.LEFT = "ArrowLeft", e.UP = "ArrowUp", e.DOWN = "ArrowDown", e.ENTER = "Enter", e.ESC = "Escape", e.TAB = "Tab", e;
|
|
2534
2534
|
}({});
|
|
2535
|
-
const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFocus: r, disabled: i, disabledContext: a, onCreate:
|
|
2535
|
+
const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFocus: r, disabled: i, disabledContext: a, onCreate: s, onChange: l, selectedOptions: u, width: d, small: f, isFontLoaded: m, placeholder: h, firstSelectedOptionIndex: g, createAble: _, listRef: v, autoLayerWidth: y }) => {
|
|
2536
2536
|
let b = () => {
|
|
2537
2537
|
e.isLayerOpen && t({ type: ActionTypes.CLOSE_LAYER }), r();
|
|
2538
2538
|
}, x = () => t({ type: ActionTypes.OPEN_LAYER }), S = useRef(!0);
|
|
@@ -2542,21 +2542,21 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2542
2542
|
options: n
|
|
2543
2543
|
});
|
|
2544
2544
|
}, [n]);
|
|
2545
|
-
let C = (e,
|
|
2545
|
+
let C = (e, o, c) => {
|
|
2546
2546
|
if (!(i || a)) {
|
|
2547
|
-
if (
|
|
2548
|
-
if (
|
|
2549
|
-
else if (!
|
|
2550
|
-
let t = u.some((e) => String(e.value) === String(
|
|
2551
|
-
|
|
2552
|
-
} else
|
|
2547
|
+
if (c && c(), o) {
|
|
2548
|
+
if (o.createAble && s) s(o.value);
|
|
2549
|
+
else if (!o.disabled) if (Array.isArray(u)) {
|
|
2550
|
+
let t = u.some((e) => String(e.value) === String(o.value)) ? u.filter((e) => String(e.value) !== String(o.value)) : [...u, o];
|
|
2551
|
+
l && l(e, t);
|
|
2552
|
+
} else l && l(e, o);
|
|
2553
2553
|
}
|
|
2554
2554
|
t({
|
|
2555
2555
|
type: ActionTypes.CLEAR_SEARCH,
|
|
2556
2556
|
options: n
|
|
2557
2557
|
}), r();
|
|
2558
2558
|
}
|
|
2559
|
-
}, w = useCallback(() => d ? d === "auto" ? getWidestOptionWidth(n, f,
|
|
2559
|
+
}, w = useCallback(() => d ? d === "auto" ? getWidestOptionWidth(n, f, m, h) : d : "100%", [n, m]), T = useCallback((e) => y ? Math.max(getWidestOptionWidth(n, f, m, h), e?.width) : e?.width, [n, m]), { renderLayer: E, layerProps: D, triggerProps: O, triggerBounds: k } = useLayer({
|
|
2560
2560
|
isOpen: e?.isLayerOpen ?? !1,
|
|
2561
2561
|
overflowContainer: !0,
|
|
2562
2562
|
...placementOptions,
|
|
@@ -2584,10 +2584,10 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2584
2584
|
}, [e.isLayerOpen]);
|
|
2585
2585
|
let M = (e, t) => {
|
|
2586
2586
|
let n = u instanceof Array ? u.filter((e) => e.value !== t.value) : null;
|
|
2587
|
-
|
|
2587
|
+
l && l(e, n);
|
|
2588
2588
|
}, N = (e) => {
|
|
2589
2589
|
let t = u instanceof Array ? [] : { value: null };
|
|
2590
|
-
|
|
2590
|
+
l && l(e, t);
|
|
2591
2591
|
}, P = (e) => t({
|
|
2592
2592
|
type: ActionTypes.ON_CHANGE_SEARCH,
|
|
2593
2593
|
options: n,
|
|
@@ -2656,7 +2656,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2656
2656
|
triggerBounds: k
|
|
2657
2657
|
};
|
|
2658
2658
|
}, CustomSelect = (e) => {
|
|
2659
|
-
let { multi: t = !1, disabled: n = !1, error: r = null, warning: i = null, tooltip: a = null, options: o, selectedOptions:
|
|
2659
|
+
let { multi: t = !1, disabled: n = !1, error: r = null, warning: i = null, tooltip: a = null, options: o, selectedOptions: c, onCreate: l = null, placeholder: u = "", small: d = !1, tabIndex: m = 0, onFocus: h = () => {}, onBlur: g = () => {}, searchable: _ = !0, clearable: v = !1, maxTooltipWidth: y, closeOnOptionActionClick: b, isInTable: x = !1, groupOrder: S, firstSelectedOptionIndex: C = 0, right: w = !1, testId: T = void 0 } = e, E = useContext(DisabledContext), D = l !== null, O = useRef(null), [k, A] = useFocus(), j = useFontsReady(), [M, N] = useReducer(reducer, {
|
|
2660
2660
|
options: o,
|
|
2661
2661
|
firstSelectedOptionIndex: C
|
|
2662
2662
|
}, ({ options: e }) => ({
|
|
@@ -2681,7 +2681,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2681
2681
|
Object.values(EventKey).includes(e.key) && F(e.key, e);
|
|
2682
2682
|
},
|
|
2683
2683
|
children: [/* @__PURE__ */ jsx(Trigger, {
|
|
2684
|
-
selectedOptions:
|
|
2684
|
+
selectedOptions: c,
|
|
2685
2685
|
searchValue: M.searchValue,
|
|
2686
2686
|
isOpen: M.isLayerOpen,
|
|
2687
2687
|
focusedSelectedOptionIndex: M.triggerFocus.currentOption,
|
|
@@ -2695,7 +2695,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2695
2695
|
isInTable: x,
|
|
2696
2696
|
disabled: n || E,
|
|
2697
2697
|
clearable: v,
|
|
2698
|
-
tabIndex:
|
|
2698
|
+
tabIndex: m,
|
|
2699
2699
|
onClickTrigger: R,
|
|
2700
2700
|
onChangeSearch: z,
|
|
2701
2701
|
onClickDeselect: B,
|
|
@@ -2714,7 +2714,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2714
2714
|
listRef: O,
|
|
2715
2715
|
isMulti: t,
|
|
2716
2716
|
sections: M.visibleOptions,
|
|
2717
|
-
selectedOptions:
|
|
2717
|
+
selectedOptions: c,
|
|
2718
2718
|
onSelectOption: (e, n) => {
|
|
2719
2719
|
G(e, n, t ? void 0 : W);
|
|
2720
2720
|
},
|
|
@@ -2834,11 +2834,11 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2834
2834
|
children: e
|
|
2835
2835
|
});
|
|
2836
2836
|
}, Pagination = ({ pagination: e }) => {
|
|
2837
|
-
let { rowCount: t, selectedPage: n, small: r, onSelectPage: i, rowsPerPage: a, errorMessageTemplate: o, testIds: s } = e,
|
|
2837
|
+
let { rowCount: t, selectedPage: n, small: r, onSelectPage: i, rowsPerPage: a, errorMessageTemplate: o, testIds: s } = e, l = Number(a?.value) === 0, u = numberOfPages(t, a), [d, f] = useState(String(n));
|
|
2838
2838
|
useEffect(() => {
|
|
2839
2839
|
f(String(n));
|
|
2840
2840
|
}, [n]);
|
|
2841
|
-
let { error: p } = validateSelectedPage(d, u, o),
|
|
2841
|
+
let { error: p } = validateSelectedPage(d, u, o), h = (e) => {
|
|
2842
2842
|
let { valid: t } = validateSelectedPage(e, u, o);
|
|
2843
2843
|
f(e), t && e !== "" && i && i(Number(e));
|
|
2844
2844
|
};
|
|
@@ -2849,7 +2849,7 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2849
2849
|
style: { flexShrink: 0 },
|
|
2850
2850
|
children: /* @__PURE__ */ jsx(Select, {
|
|
2851
2851
|
onChange: (e) => {
|
|
2852
|
-
a.onChange && a.onChange(e),
|
|
2852
|
+
a.onChange && a.onChange(e), h("1");
|
|
2853
2853
|
},
|
|
2854
2854
|
options: a.options,
|
|
2855
2855
|
native: !!a.options,
|
|
@@ -2863,16 +2863,16 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2863
2863
|
round: !0,
|
|
2864
2864
|
basic: !0,
|
|
2865
2865
|
icon: IconType.CHEVRON_DOUBLE_LEFT,
|
|
2866
|
-
onClick: () =>
|
|
2867
|
-
disabled:
|
|
2866
|
+
onClick: () => h("1"),
|
|
2867
|
+
disabled: l || n === 1
|
|
2868
2868
|
}),
|
|
2869
2869
|
/* @__PURE__ */ jsx(Button, {
|
|
2870
2870
|
small: r,
|
|
2871
2871
|
round: !0,
|
|
2872
2872
|
basic: !0,
|
|
2873
2873
|
icon: IconType.CHEVRON_LEFT,
|
|
2874
|
-
onClick: () =>
|
|
2875
|
-
disabled:
|
|
2874
|
+
onClick: () => h(String(Number(n) - 1)),
|
|
2875
|
+
disabled: l || n === 1
|
|
2876
2876
|
}),
|
|
2877
2877
|
/* @__PURE__ */ jsxs(InputGroup, {
|
|
2878
2878
|
small: r,
|
|
@@ -2881,9 +2881,9 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2881
2881
|
right: !0,
|
|
2882
2882
|
value: d,
|
|
2883
2883
|
placeholder: String(n),
|
|
2884
|
-
onChange: (e) =>
|
|
2884
|
+
onChange: (e) => h(e.target.value),
|
|
2885
2885
|
width: "50px",
|
|
2886
|
-
disabled:
|
|
2886
|
+
disabled: l || u <= 1,
|
|
2887
2887
|
error: p
|
|
2888
2888
|
}), /* @__PURE__ */ jsxs(InputGroupAddon, { children: ["of ", u] })]
|
|
2889
2889
|
}),
|
|
@@ -2892,16 +2892,16 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2892
2892
|
round: !0,
|
|
2893
2893
|
basic: !0,
|
|
2894
2894
|
icon: IconType.CHEVRON_RIGHT,
|
|
2895
|
-
onClick: () =>
|
|
2896
|
-
disabled:
|
|
2895
|
+
onClick: () => h(String(Number(n) + 1)),
|
|
2896
|
+
disabled: l || n === u
|
|
2897
2897
|
}),
|
|
2898
2898
|
/* @__PURE__ */ jsx(Button, {
|
|
2899
2899
|
small: r,
|
|
2900
2900
|
round: !0,
|
|
2901
2901
|
basic: !0,
|
|
2902
2902
|
icon: IconType.CHEVRON_DOUBLE_RIGHT,
|
|
2903
|
-
onClick: () =>
|
|
2904
|
-
disabled:
|
|
2903
|
+
onClick: () => h(String(u)),
|
|
2904
|
+
disabled: l || n === u,
|
|
2905
2905
|
testId: s?.doubleRightBtn
|
|
2906
2906
|
})
|
|
2907
2907
|
]
|
|
@@ -2972,769 +2972,97 @@ const ExpandedContentRow = ({ colSpan: e, children: t, flush: n }) => /* @__PURE
|
|
|
2972
2972
|
return r && t ? e[n] || [] : i ? e : (console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."), []);
|
|
2973
2973
|
};
|
|
2974
2974
|
var cell_module_default = {
|
|
2975
|
-
inputInTable: "
|
|
2976
|
-
inputHover: "
|
|
2977
|
-
inputFocus: "
|
|
2978
|
-
inputError: "
|
|
2979
|
-
inputWarning: "
|
|
2980
|
-
inputDisabled: "
|
|
2981
|
-
hideScrollbars: "
|
|
2982
|
-
cell: "
|
|
2983
|
-
disabledLink: "
|
|
2984
|
-
inputWrapper: "
|
|
2985
|
-
numberInputWrapper: "
|
|
2986
|
-
breakWord: "
|
|
2987
|
-
inputCell: "
|
|
2988
|
-
sliderCell: "
|
|
2989
|
-
staticCell: "
|
|
2990
|
-
staticCellContent: "
|
|
2991
|
-
unit: "
|
|
2992
|
-
sortingCell: "
|
|
2993
|
-
sortingCellIcon: "
|
|
2994
|
-
icon: "
|
|
2995
|
-
checkBoxCell: "
|
|
2996
|
-
iconCellWrapper: "
|
|
2997
|
-
actionsCell: "
|
|
2998
|
-
rightAligned: "
|
|
2999
|
-
centerAligned: "
|
|
3000
|
-
leftAligned: "
|
|
3001
|
-
popover: "
|
|
3002
|
-
disabledPointerEvents: "
|
|
3003
|
-
selectedCell: "_selectedCell_1dumn_214"
|
|
3004
|
-
}, asT = (e) => typeof e == "function" ? e : (e) => String(e), parseNum = (e) => Number(String(e ?? "").replace(",", ".").trim()), isNumeric = (e) => !Number.isNaN(parseNum(e)), hasAnyText = (e) => (e ?? []).some((e) => String(e ?? "").trim().length > 0 && !isNumeric(e)), isNonPlaceholderUnit = (e) => !!e && e !== "blank" && e.trim() !== "", isValidLength = (e, t, n) => e >= t - n, validateColumnLength = (e, t, n, r, i, a, o, s) => {
|
|
3005
|
-
let c = [], l = r.filter((e) => e.optionalColumn).length, u = r.length, d = l ? `${u - l} or ${u}` : `${u}`, f = (i ? 1 : 0) + (a ? 1 : 0) + Math.max(0, s);
|
|
3006
|
-
if (i && !isValidLength(e.length, u, l) && c.push(o("incorrectNumberOfFieldNameHeaderColumns", { expectedLengthMessage: d })), a) {
|
|
3007
|
-
let e = r.filter((e) => Array.isArray(e.validUnits) && e.validUnits.some(isNonPlaceholderUnit)).length, n = t.filter(isNonPlaceholderUnit).length, i = r.filter((e) => e.optionalColumn || !e.validUnits || e.validUnits.includes("blank")).length;
|
|
3008
|
-
isValidLength(n, e, i) || c.push(o("incorrectNumberOfUnitHeaderColumns", { expectedLengthMessage: d }));
|
|
3009
|
-
}
|
|
3010
|
-
return n.length === 0 ? c.push(o("incorrectNumberOfDataColumns", {
|
|
3011
|
-
expectedLengthMessage: d,
|
|
3012
|
-
dataRowStartIndex: f
|
|
3013
|
-
})) : n.forEach((e, t) => {
|
|
3014
|
-
isValidLength(e.length, u, l) || c.push(o("incorrectNumberOfDataColumns", {
|
|
3015
|
-
expectedLengthMessage: d,
|
|
3016
|
-
dataRowStartIndex: f + t
|
|
3017
|
-
}));
|
|
3018
|
-
}), c;
|
|
3019
|
-
}, normalize = (e) => e.toUpperCase().replace(/\(.*?\)/g, "").replace(/[^A-Z0-9]/g, "").trim(), defaultFieldNameValidator = ({ value: e, defaultAllowedValues: t }) => {
|
|
3020
|
-
let n = normalize(e);
|
|
3021
|
-
return t?.some((e) => normalize(e).includes(n) || n.includes(normalize(e))) ?? !1;
|
|
3022
|
-
}, defaultUnitsValidator = ({ value: e, defaultAllowedValues: t }) => t?.includes(e) ?? !1, validateHeadings = (e, t, n, r, i, a) => {
|
|
3023
|
-
let o = [];
|
|
3024
|
-
if (r) {
|
|
3025
|
-
let r = n.map((e) => e.fieldName).filter(Boolean);
|
|
3026
|
-
e.forEach((i, s) => {
|
|
3027
|
-
let c = n[s];
|
|
3028
|
-
!c || !c.fieldName || (c.fieldNameValidator ?? defaultFieldNameValidator)({
|
|
3029
|
-
value: i,
|
|
3030
|
-
defaultAllowedValues: r,
|
|
3031
|
-
columnIndex: s,
|
|
3032
|
-
fields: e,
|
|
3033
|
-
units: t
|
|
3034
|
-
}) || o.push(a("incorrectFieldName", {
|
|
3035
|
-
i: s + 1,
|
|
3036
|
-
correctName: c.fieldName || a("notExist"),
|
|
3037
|
-
wrongName: i || a("notApplicable")
|
|
3038
|
-
}));
|
|
3039
|
-
});
|
|
3040
|
-
}
|
|
3041
|
-
if (i) {
|
|
3042
|
-
let i = n.map((e) => e.validUnits), s = r ? 1 : 0;
|
|
3043
|
-
t.forEach((r, c) => {
|
|
3044
|
-
let l = n[c];
|
|
3045
|
-
if (!l) return;
|
|
3046
|
-
let u = l.unitsValidator ?? defaultUnitsValidator, d = i[c];
|
|
3047
|
-
u({
|
|
3048
|
-
value: r,
|
|
3049
|
-
defaultAllowedValues: d,
|
|
3050
|
-
columnIndex: c,
|
|
3051
|
-
fields: e,
|
|
3052
|
-
units: t
|
|
3053
|
-
}) || o.push(a("incorrectUnitRow", {
|
|
3054
|
-
unitRowIndex: s,
|
|
3055
|
-
i: c + 1,
|
|
3056
|
-
wrongUnit: r || a("notApplicable"),
|
|
3057
|
-
correctUnit: d?.join(",") || a("notExist")
|
|
3058
|
-
}));
|
|
3059
|
-
});
|
|
3060
|
-
}
|
|
3061
|
-
return o;
|
|
3062
|
-
}, validateValues = (e, t, n, r, i) => {
|
|
3063
|
-
let a = [];
|
|
3064
|
-
return e.forEach((e, o) => {
|
|
3065
|
-
e.forEach((e, s) => {
|
|
3066
|
-
let c = t[s];
|
|
3067
|
-
if (!c || !c.validator) return;
|
|
3068
|
-
let l = c.validator(e);
|
|
3069
|
-
if (l && typeof l == "string") {
|
|
3070
|
-
let e = r + o, t = i + s, c = n("rowColumn", {
|
|
3071
|
-
rowIndex: e,
|
|
3072
|
-
columnIndex: t
|
|
3073
|
-
}) ?? `(row ${e}, column ${t})`;
|
|
3074
|
-
a.push(`${l} ${c}`);
|
|
3075
|
-
}
|
|
3076
|
-
});
|
|
3077
|
-
}), a;
|
|
3078
|
-
};
|
|
3079
|
-
const hasHeaders$1 = (e, t, n) => {
|
|
3080
|
-
let r = (e) => e.replace(/,/g, "."), i = e[0] ?? [], a = e[1] ?? [], o = (e) => e.some((e) => isNaN(Number(r(e)))), s = (e) => e.some((e) => !isNaN(Number(r(e)))), c = i.some((e) => t.includes(e)), l = i.some((e) => n.includes(e)), u = a.some((e) => n.includes(e)), d = o(i), f = o(a), p = s(i), m = s(a);
|
|
3081
|
-
return {
|
|
3082
|
-
hasFieldNameHeader: c || d && !l && !p || d && f && !p,
|
|
3083
|
-
hasUnitHeader: l || u || d && f && !l && !p && !m || d && f && !p && !m
|
|
3084
|
-
};
|
|
2975
|
+
inputInTable: "_inputInTable_ie6ng_1",
|
|
2976
|
+
inputHover: "_inputHover_ie6ng_13",
|
|
2977
|
+
inputFocus: "_inputFocus_ie6ng_18",
|
|
2978
|
+
inputError: "_inputError_ie6ng_25",
|
|
2979
|
+
inputWarning: "_inputWarning_ie6ng_26",
|
|
2980
|
+
inputDisabled: "_inputDisabled_ie6ng_61",
|
|
2981
|
+
hideScrollbars: "_hideScrollbars_ie6ng_67",
|
|
2982
|
+
cell: "_cell_ie6ng_77",
|
|
2983
|
+
disabledLink: "_disabledLink_ie6ng_87",
|
|
2984
|
+
inputWrapper: "_inputWrapper_ie6ng_91",
|
|
2985
|
+
numberInputWrapper: "_numberInputWrapper_ie6ng_106",
|
|
2986
|
+
breakWord: "_breakWord_ie6ng_113",
|
|
2987
|
+
inputCell: "_inputCell_ie6ng_116",
|
|
2988
|
+
sliderCell: "_sliderCell_ie6ng_119",
|
|
2989
|
+
staticCell: "_staticCell_ie6ng_123",
|
|
2990
|
+
staticCellContent: "_staticCellContent_ie6ng_126",
|
|
2991
|
+
unit: "_unit_ie6ng_148",
|
|
2992
|
+
sortingCell: "_sortingCell_ie6ng_151",
|
|
2993
|
+
sortingCellIcon: "_sortingCellIcon_ie6ng_162",
|
|
2994
|
+
icon: "_icon_ie6ng_173",
|
|
2995
|
+
checkBoxCell: "_checkBoxCell_ie6ng_177",
|
|
2996
|
+
iconCellWrapper: "_iconCellWrapper_ie6ng_181",
|
|
2997
|
+
actionsCell: "_actionsCell_ie6ng_185",
|
|
2998
|
+
rightAligned: "_rightAligned_ie6ng_193",
|
|
2999
|
+
centerAligned: "_centerAligned_ie6ng_199",
|
|
3000
|
+
leftAligned: "_leftAligned_ie6ng_205",
|
|
3001
|
+
popover: "_popover_ie6ng_208",
|
|
3002
|
+
disabledPointerEvents: "_disabledPointerEvents_ie6ng_211"
|
|
3085
3003
|
};
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
}
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
}
|
|
3122
|
-
get(e) {
|
|
3123
|
-
return this.rules.get(e);
|
|
3124
|
-
}
|
|
3125
|
-
unregister(e) {
|
|
3126
|
-
this.rules.delete(e);
|
|
3127
|
-
}
|
|
3128
|
-
clear() {
|
|
3129
|
-
this.rules.clear();
|
|
3130
|
-
}
|
|
3131
|
-
}(), ValidationScopeContext = createContext(null), useValidationScopeId = () => useContext(ValidationScopeContext), enTranslations = {
|
|
3132
|
-
cancel: "Cancel",
|
|
3133
|
-
chooseFile: "Choose file",
|
|
3134
|
-
copyDecimalComma: "Copy (decimal comma)",
|
|
3135
|
-
copyDecimalDot: "Copy (decimal dot)",
|
|
3136
|
-
copyToClipboard: "Copy to clipboard",
|
|
3137
|
-
copiedToClipboard: "Copied to clipboard",
|
|
3138
|
-
deleteAllRows: "Delete all rows",
|
|
3139
|
-
downloadFile: "Download file",
|
|
3140
|
-
export: "Export",
|
|
3141
|
-
help: "Help",
|
|
3142
|
-
import: "Import",
|
|
3143
|
-
noFileSelected: "No file selected",
|
|
3144
|
-
notApplicable: "N/A",
|
|
3145
|
-
notExist: "not exist",
|
|
3146
|
-
okay: "Okay",
|
|
3147
|
-
uploadCapitalized: "Upload",
|
|
3148
|
-
uploadFile: "Upload file",
|
|
3149
|
-
pasteShortcutHint: "You can also press Ctrl+V or Command+V to paste from clipboard",
|
|
3150
|
-
pasteFromClipboard: "Paste from clipboard",
|
|
3151
|
-
clipboardIsEmpty: "Clipboard is empty",
|
|
3152
|
-
clipboardReadFailed: "Unable to read data from clipboard. Check formatting or try Paste with Review.",
|
|
3153
|
-
clipboardReadNotAllowed: "Your browser did not allow reading the clipboard. Upgrade browser or try Paste with Review.",
|
|
3154
|
-
pasteSuccessful: "Paste successful",
|
|
3155
|
-
pasteWithReview: "Paste with review",
|
|
3156
|
-
pasteWithReviewRoundBrackets: "Paste (with review)",
|
|
3157
|
-
quickPasteFromClipboard: "Quick paste from clipboard",
|
|
3158
|
-
unableToCopyToClipboard: "Unable to copy to clipboard",
|
|
3159
|
-
fileParsingFailed: "Failed to read or validate the file. Please check the format and try again.",
|
|
3160
|
-
importWarning: "Large data detected: More than 500 rows have been imported. You can choose to import all or downsample for better performance.",
|
|
3161
|
-
importLimitExceeded: "Import failed: The data exceeds the 5000-row limit. Please reduce the number of rows and try again.",
|
|
3162
|
-
importingData: "Importing data",
|
|
3163
|
-
incorrectFieldName: "Incorrect field name (row 0, column {{i}}: has name {{wrongName}}, but should be {{correctName}})",
|
|
3164
|
-
incorrectNumberOfDataColumns: "Incorrect number of data columns, expected {{expectedLengthMessage}} columns in row {{dataRowStartIndex}}",
|
|
3165
|
-
incorrectNumberOfFieldNameHeaderColumns: "Incorrect number of field name header columns, expected {{expectedLengthMessage}} columns in row 0",
|
|
3166
|
-
incorrectNumberOfUnitHeaderColumns: "Incorrect number of unit header columns, expected {{expectedLengthMessage}} columns in row 1",
|
|
3167
|
-
incorrectUnitRow: "Incorrect unit (row {{unitRowIndex}}, column {{i}}: has unit [{{wrongUnit}}], but should be [{{correctUnit}}])",
|
|
3168
|
-
jsonParseFailed: "JSON parse failed",
|
|
3169
|
-
pasteYourTableDataHereToImportIt: "Paste your table data here to import it",
|
|
3170
|
-
rowColumn: "(row {{rowIndex}}, column {{columnIndex}})",
|
|
3171
|
-
theValuesCanBeSeparatedByDifferentDelimiters: "The values can be separated by different delimiters",
|
|
3172
|
-
unableToImportPleaseCorrectError: "Unable to import - {{rows}} rows have errors. Please correct input data and try again.",
|
|
3173
|
-
unableToPrepareExportData: "Unable to prepare export – see console for details.",
|
|
3174
|
-
validInputForPaste: "Valid input for paste.",
|
|
3175
|
-
wrongFileFormatExpectedOneOf: "Wrong file format: expected one of",
|
|
3176
|
-
youCanImportDataByPastingOrByMessage: "You can import data by pasting (e.g. from a spreadsheet), or by uploading a text file ( .txt or .csv ).",
|
|
3177
|
-
commasAsDecimals: "Comma is treated as a decimal separator when it is the only separator",
|
|
3178
|
-
deletePastedContent: "Delete pasted content",
|
|
3179
|
-
downsampled: "Downsampled",
|
|
3180
|
-
downsampleSuccess: "Successfully downsampled from {{from}} rows to {{to}} rows.",
|
|
3181
|
-
downsampleTooltip: "Reduces number of data rows (decimation) using the Ramer–Douglas–Peucker algorithm.",
|
|
3182
|
-
extraSeparators: "Two or more separators detected. Kept only last one as decimal separator, please control your import results",
|
|
3183
|
-
noDataPastedYet: "No data pasted yet.",
|
|
3184
|
-
semicolonSeparatedValues: "Semicolon-separated values",
|
|
3185
|
-
tabSeparatedValues: "Tab-separated values",
|
|
3186
|
-
examples: "Examples",
|
|
3187
|
-
smartUpload_description: "Upload image and extract table content using a LLM",
|
|
3188
|
-
smartUpload_smartUpload: "Smart Upload",
|
|
3189
|
-
toUploadOrImportFromClipboardMessage: "To upload or import from clipboard please select your preferred unit in the table header and upload or paste numbers only for Depth, Inc, Azi. Follow example below"
|
|
3190
|
-
}, interpolate = (e, t = {}) => e?.replace(/\{\{(\w+)\}\}/g, (e, n) => t?.[n] === void 0 ? "" : String(t?.[n])), useTranslationMap = (e) => useMemo(() => {
|
|
3191
|
-
let t = Object.keys(enTranslations).reduce((t, n) => {
|
|
3192
|
-
let r = enTranslations?.[n];
|
|
3193
|
-
return t[n] = e?.[n] ?? r, t;
|
|
3194
|
-
}, {});
|
|
3195
|
-
return (e, n) => {
|
|
3196
|
-
let r = t[e];
|
|
3197
|
-
return n ? interpolate(r, n) : r;
|
|
3198
|
-
};
|
|
3199
|
-
}, [e]);
|
|
3200
|
-
function useScopedValidate() {
|
|
3201
|
-
let e = useValidationScopeId(), t = useTranslationMap(), n;
|
|
3202
|
-
return {
|
|
3203
|
-
scopeId: e,
|
|
3204
|
-
rules: n,
|
|
3205
|
-
validate: (r) => {
|
|
3206
|
-
let { fields: i = [], units: a = [], rows: o, t: s = t, options: c } = r;
|
|
3207
|
-
return n = e ? validationRegistry.get(e) : void 0, n ? validate({
|
|
3208
|
-
fields: i,
|
|
3209
|
-
units: a,
|
|
3210
|
-
rows: o,
|
|
3211
|
-
rules: n,
|
|
3212
|
-
t: s
|
|
3213
|
-
}) : {
|
|
3214
|
-
isValid: !0,
|
|
3215
|
-
errors: []
|
|
3216
|
-
};
|
|
3217
|
-
}
|
|
3218
|
-
};
|
|
3219
|
-
}
|
|
3220
|
-
function useRegisterValidationRules(e, t) {
|
|
3004
|
+
const InputCell = ({ cell: e, columnAlignment: t, testId: n, type: r }) => /* @__PURE__ */ jsx(Input, {
|
|
3005
|
+
name: e.name,
|
|
3006
|
+
value: e.value,
|
|
3007
|
+
onChange: (t) => e.onChange?.(t),
|
|
3008
|
+
onFocus: e.onFocus,
|
|
3009
|
+
onBlur: e.onBlur,
|
|
3010
|
+
onPaste: (t) => e.onPaste?.(t),
|
|
3011
|
+
placeholder: e.placeholder,
|
|
3012
|
+
error: e.error,
|
|
3013
|
+
warning: e.warning,
|
|
3014
|
+
disabled: e.disabled,
|
|
3015
|
+
isInTable: !0,
|
|
3016
|
+
maxTooltipWidth: e.maxTooltipWidth,
|
|
3017
|
+
right: t === Align.RIGHT,
|
|
3018
|
+
selectOnFocus: e.selectOnFocus,
|
|
3019
|
+
testId: n,
|
|
3020
|
+
tabIndex: e.disabled ? -1 : 0,
|
|
3021
|
+
tooltip: e.tooltip,
|
|
3022
|
+
type: r
|
|
3023
|
+
}), safeToString = (e) => String(toString(e)), roundNumberCosmetic = (e) => isScientificStringNum(e) ? e : safeToString(roundToPrecision(toNum(e), 14));
|
|
3024
|
+
var getStringName$1 = (e) => e ? typeof e == "string" ? e : isArray(e) ? e[0] : e.fieldName : "";
|
|
3025
|
+
const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r = !1, left: i = !1, small: a = !1, width: o = "100%", value: s = "", onChange: l = () => {}, onFocus: u = () => {}, onBlur: d = () => {}, selectOnFocus: f, tabIndex: h = 0, testId: g, tooltip: _ = null, warning: v = !1, validationCallback: y = () => {}, allowEmpty: b = !1, isInTable: x, groupOrder: S, enableCosmeticRounding: C = !0, enableDisplayRounding: w = !1, roundDisplayValue: T, disableInternalErrorValidationMessages: E = !1, disableValidationOnFocus: D = !1 }) => {
|
|
3026
|
+
let O = (e) => {
|
|
3027
|
+
let n = validateNumber(e), r = t && isEmptyNullOrUndefined(e);
|
|
3028
|
+
return [Infinity, -Infinity].includes(Number(e)) || r ? {
|
|
3029
|
+
valid: !0,
|
|
3030
|
+
errors: []
|
|
3031
|
+
} : b && e === "" || n.valid ? {
|
|
3032
|
+
...n,
|
|
3033
|
+
valid: !0,
|
|
3034
|
+
errors: void 0
|
|
3035
|
+
} : n;
|
|
3036
|
+
}, k = (e) => {
|
|
3037
|
+
let t = !!e?.endsWith("0"), n = C && e && !t && O(e)?.valid ? roundNumberCosmetic(e) : e;
|
|
3038
|
+
return safeToString(n);
|
|
3039
|
+
}, A = useRef(null), [j, M] = useState(k(safeToString(s))), [N, P] = useState(!1), F = getStringName$1(e), { valid: I, errors: L } = O(j), R = L && L.length && !E ? L[0] : null;
|
|
3221
3040
|
useEffect(() => {
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
"text/plain",
|
|
3235
|
-
"application/json",
|
|
3236
|
-
"application/vnd.ms-excel"
|
|
3237
|
-
], isAllowedFileType = (e) => allowedMimes.includes(e.type), isFile = (e) => e instanceof File, isJson = (e) => e.trim().startsWith("["), isCustomJson = (e) => {
|
|
3238
|
-
try {
|
|
3239
|
-
return !!JSON.parse(e)?.path;
|
|
3240
|
-
} catch {
|
|
3241
|
-
return !1;
|
|
3242
|
-
}
|
|
3243
|
-
}, readFile$1 = (e) => new Promise((t, n) => {
|
|
3244
|
-
let r = new FileReader();
|
|
3245
|
-
r.onload = () => t(String(r.result)), r.onerror = n, r.readAsText(e);
|
|
3246
|
-
}), replaceWithDot = (e) => e.replace(",", "."), replaceDataCommasWithDots = (e) => e.map((e) => e.map((e) => replaceWithDot(e))), hasHeaders = (e, t, n) => {
|
|
3247
|
-
let r = (e) => e.replace(/,/g, "."), i = e[0]?.some((e) => isNaN(Number(r(e)))) ?? !1, a = e[1]?.some((e) => isNaN(Number(r(e)))) ?? !1, o = e[0]?.some((e) => t.includes(e)) ?? !1, s = e[0]?.some((e) => n.includes(e)) ?? !1, c = e[1]?.some((e) => n.includes(e)) ?? !1, l = e[0]?.some((e) => !isNaN(Number(r(e)))) ?? !1, u = e[1]?.some((e) => !isNaN(Number(r(e)))) ?? !1;
|
|
3248
|
-
return {
|
|
3249
|
-
hasFieldNameHeader: o || i && !s && !l || i && a && !l,
|
|
3250
|
-
hasUnitHeader: s || c || i && a && !s && !l && !u || i && a && !l && !u
|
|
3251
|
-
};
|
|
3252
|
-
};
|
|
3253
|
-
var buildHeadersFromRules = (e, t) => {
|
|
3254
|
-
let n = e.length === t ? e : e.filter((e) => !e.optionalColumn), r = n.map((e) => e.fieldName), i = n.map((e) => e.defaultUnit ?? e.validUnits?.[0] ?? ""), a = n.map((e) => e.validUnits).filter((e) => !!e).flat();
|
|
3255
|
-
return {
|
|
3256
|
-
fieldHeader: r,
|
|
3257
|
-
unitHeader: i,
|
|
3258
|
-
allowedUnits: a
|
|
3259
|
-
};
|
|
3260
|
-
};
|
|
3261
|
-
const guessMissingHeaders = (e, t) => {
|
|
3262
|
-
let n = e.map((e) => [...e]), r = n[0]?.length ?? 0, { fieldHeader: i, unitHeader: a, allowedUnits: o } = buildHeadersFromRules(t, r), { hasFieldNameHeader: s, hasUnitHeader: c } = hasHeaders(n, i, o), l = n;
|
|
3263
|
-
return !s && !c ? l = [
|
|
3264
|
-
i,
|
|
3265
|
-
a,
|
|
3266
|
-
...n
|
|
3267
|
-
] : !s && c ? l = [i, ...n] : s && !c && (l = [
|
|
3268
|
-
n[0] ?? [],
|
|
3269
|
-
a,
|
|
3270
|
-
...n.slice(1)
|
|
3271
|
-
]), {
|
|
3272
|
-
matrix: l,
|
|
3273
|
-
hasFieldNameHeader: s,
|
|
3274
|
-
hasUnitHeader: c
|
|
3275
|
-
};
|
|
3276
|
-
}, mapCustomJsonToRows = (e) => {
|
|
3277
|
-
let t = JSON.parse(e).path.map((e) => [
|
|
3278
|
-
depthRound(e.md),
|
|
3279
|
-
depthRound(e.inclination),
|
|
3280
|
-
depthRound(e.gridAzimuth)
|
|
3041
|
+
let e = k(safeToString(s));
|
|
3042
|
+
toNum(j) !== toNum(e) && M(e);
|
|
3043
|
+
}, [
|
|
3044
|
+
s,
|
|
3045
|
+
C,
|
|
3046
|
+
w
|
|
3047
|
+
]), useEffect(() => {
|
|
3048
|
+
(D || !N) && !I ? y(F, R) : y(F, null);
|
|
3049
|
+
}, [
|
|
3050
|
+
N,
|
|
3051
|
+
I,
|
|
3052
|
+
r
|
|
3281
3053
|
]);
|
|
3282
|
-
|
|
3283
|
-
"
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
}, initParsedResult = () => ({
|
|
3293
|
-
isValid: !1,
|
|
3294
|
-
fields: [],
|
|
3295
|
-
units: [],
|
|
3296
|
-
rows: [],
|
|
3297
|
-
errors: []
|
|
3298
|
-
}), buildResultFromMatrix = (e, t) => {
|
|
3299
|
-
let n = initParsedResult(), { matrix: r } = guessMissingHeaders(e, t.validationRules);
|
|
3300
|
-
return n.fields = (r[0] ?? []).map((e) => e.trim()), n.units = (r[1] ?? []).map((e) => e.trim()).filter(Boolean), n.rows = r.slice(2) ?? [], n.rows = replaceDataCommasWithDots(n.rows), n.isValid = n.errors.length === 0, n;
|
|
3301
|
-
}, parseJson = async (e, t, n) => {
|
|
3302
|
-
let r = JSON.parse(e);
|
|
3303
|
-
return buildResultFromMatrix(r, t);
|
|
3304
|
-
}, parseCustomJson = async (e, t, n) => {
|
|
3305
|
-
let r = mapCustomJsonToRows(e).map((e) => e.map(String));
|
|
3306
|
-
return buildResultFromMatrix(r, t);
|
|
3307
|
-
}, parseDSV = (e, t, n) => new Promise((n) => {
|
|
3308
|
-
let { importLimit: r } = t;
|
|
3309
|
-
Papa.parse(e, {
|
|
3310
|
-
...basePapaConfig,
|
|
3311
|
-
preview: r,
|
|
3312
|
-
complete: (e) => {
|
|
3313
|
-
let r = e.data ?? [];
|
|
3314
|
-
n(buildResultFromMatrix(r, t));
|
|
3315
|
-
}
|
|
3316
|
-
});
|
|
3317
|
-
});
|
|
3318
|
-
const parse = async (e, t, n) => {
|
|
3319
|
-
let r = initParsedResult();
|
|
3320
|
-
try {
|
|
3321
|
-
if (isFile(e) && !isAllowedFileType(e)) return r.errors.push(`${n("wrongFileFormatExpectedOneOf")} ${joinArray(Array.from(allowedMimes))}`), r;
|
|
3322
|
-
let i = isFile(e) ? await readFile$1(e) : String(e);
|
|
3323
|
-
return isJson(i) ? await parseJson(i, t, n) : isCustomJson(i) ? await parseCustomJson(i, t, n) : await parseDSV(e, t, n);
|
|
3324
|
-
} catch (e) {
|
|
3325
|
-
return r.errors.push(e?.message ?? "Unknown parse error"), r;
|
|
3326
|
-
}
|
|
3327
|
-
}, unParse = (e, t, n, r) => {
|
|
3328
|
-
let i = r?.delimiter ?? ",", a = [
|
|
3329
|
-
e,
|
|
3330
|
-
t,
|
|
3331
|
-
...n
|
|
3332
|
-
].filter(Boolean);
|
|
3333
|
-
return Papa.unparse(a, {
|
|
3334
|
-
quotes: !1,
|
|
3335
|
-
header: !0,
|
|
3336
|
-
delimiter: i
|
|
3337
|
-
});
|
|
3338
|
-
};
|
|
3339
|
-
function useScopedParser(e = {}) {
|
|
3340
|
-
let t = useValidationScopeId(), n = (t ? validationRegistry.get(t) : []) ?? [];
|
|
3341
|
-
return {
|
|
3342
|
-
scopeId: t,
|
|
3343
|
-
rules: n,
|
|
3344
|
-
parse: async (t, r, i) => parse(t, {
|
|
3345
|
-
validationRules: n,
|
|
3346
|
-
...e,
|
|
3347
|
-
...i
|
|
3348
|
-
}, r)
|
|
3349
|
-
};
|
|
3350
|
-
}
|
|
3351
|
-
function useScopedParseAndValidate() {
|
|
3352
|
-
let { parse: e, scopeId: t, rules: n } = useScopedParser(), { validate: r } = useScopedValidate();
|
|
3353
|
-
return {
|
|
3354
|
-
scopeId: t,
|
|
3355
|
-
rules: n,
|
|
3356
|
-
parseAndValidate: async (t, n) => {
|
|
3357
|
-
let i = await e(t, n), { isValid: a, errors: o } = r({
|
|
3358
|
-
fields: i.fields,
|
|
3359
|
-
units: i.units,
|
|
3360
|
-
rows: i.rows,
|
|
3361
|
-
t: n
|
|
3362
|
-
});
|
|
3363
|
-
return {
|
|
3364
|
-
...i,
|
|
3365
|
-
errors: [...i.errors, ...o],
|
|
3366
|
-
isValid: a && [...i.errors, ...o].length === 0
|
|
3054
|
+
let z = (e) => {
|
|
3055
|
+
let n = "key" in e ? j : e?.target?.value, r = cleanNumStr(n.replaceAll(" ", "").replaceAll("|", ""));
|
|
3056
|
+
if (M(r), O(r)?.valid || t && isEmptyNullOrUndefined(n)) {
|
|
3057
|
+
let t = {
|
|
3058
|
+
...e,
|
|
3059
|
+
target: {
|
|
3060
|
+
...e.target,
|
|
3061
|
+
value: stripLeadingZeros(safeToString(r)),
|
|
3062
|
+
name: F
|
|
3063
|
+
}
|
|
3367
3064
|
};
|
|
3368
|
-
|
|
3369
|
-
};
|
|
3370
|
-
}
|
|
3371
|
-
const injectScopeIntoActions = (e, t) => {
|
|
3372
|
-
if (!e) return e;
|
|
3373
|
-
if (isValidElement(e)) return cloneElement(e, { __validationScopeId: t });
|
|
3374
|
-
if (Array.isArray(e)) return e.map((e) => injectScopeIntoActions(e, t));
|
|
3375
|
-
if (typeof e == "object") {
|
|
3376
|
-
let r = e, i = [
|
|
3377
|
-
"childComponent",
|
|
3378
|
-
"component",
|
|
3379
|
-
"render",
|
|
3380
|
-
"element"
|
|
3381
|
-
], o = !1, s = { ...r };
|
|
3382
|
-
for (let e of i) {
|
|
3383
|
-
let i = r[e];
|
|
3384
|
-
i && isValidElement(i) && (s[e] = cloneElement(i, { __validationScopeId: t }), o = !0);
|
|
3385
|
-
}
|
|
3386
|
-
for (let [e, n] of Object.entries(r)) if (Array.isArray(n)) {
|
|
3387
|
-
let r = n.map((e) => injectScopeIntoActions(e, t));
|
|
3388
|
-
r !== n && (s[e] = r, o = !0);
|
|
3389
|
-
}
|
|
3390
|
-
return o ? s : e;
|
|
3391
|
-
}
|
|
3392
|
-
return e;
|
|
3393
|
-
}, withValidationScope = (e) => {
|
|
3394
|
-
let t = forwardRef((t, n) => {
|
|
3395
|
-
let r = useRef(nextScopeId()), i = useMemo(() => {
|
|
3396
|
-
let e = injectScopeIntoActions(t.table?.actions, r.current);
|
|
3397
|
-
return {
|
|
3398
|
-
...t.table,
|
|
3399
|
-
actions: e
|
|
3400
|
-
};
|
|
3401
|
-
}, [t.table]);
|
|
3402
|
-
return /* @__PURE__ */ jsx(ValidationScopeContext.Provider, {
|
|
3403
|
-
value: r.current,
|
|
3404
|
-
children: /* @__PURE__ */ jsx(e, {
|
|
3405
|
-
ref: n,
|
|
3406
|
-
...t,
|
|
3407
|
-
table: i
|
|
3408
|
-
})
|
|
3409
|
-
});
|
|
3410
|
-
});
|
|
3411
|
-
return t.displayName = `withValidationScope(${e.displayName || e.name || "Component"})`, memo(t);
|
|
3412
|
-
}, CellSelectionContext = createContext({
|
|
3413
|
-
selectedIndexes: void 0,
|
|
3414
|
-
setSelectedIndexes: () => {}
|
|
3415
|
-
}), useCellSelection = (e, t, n, r) => {
|
|
3416
|
-
if (!e) return {
|
|
3417
|
-
selectedIndexes: void 0,
|
|
3418
|
-
setSelectedIndexes: () => {},
|
|
3419
|
-
onCopy: () => {},
|
|
3420
|
-
onPaste: () => {},
|
|
3421
|
-
onKeyDown: () => {},
|
|
3422
|
-
onKeyUp: () => {},
|
|
3423
|
-
onMouseUp: () => {},
|
|
3424
|
-
onBlur: () => {},
|
|
3425
|
-
onMouseDown: () => {},
|
|
3426
|
-
onMouseMove: () => {}
|
|
3427
|
-
};
|
|
3428
|
-
let [i, a] = useState(void 0), [o, s] = useState(void 0), [c, u] = useState(!1), { validate: d } = useScopedValidate(), f = () => {
|
|
3429
|
-
let e = t.current?.closest("#scrollWrapper") ?? null ?? ((e) => {
|
|
3430
|
-
let t = e;
|
|
3431
|
-
for (; t && t !== document.body;) {
|
|
3432
|
-
let e = getComputedStyle(t);
|
|
3433
|
-
if ((/(auto|scroll|overlay)/.test(e.overflowY) || /(auto|scroll|overlay)/.test(e.overflow)) && t.scrollHeight > t.clientHeight) return t;
|
|
3434
|
-
t = t.parentElement;
|
|
3435
|
-
}
|
|
3436
|
-
return document.scrollingElement || document.body;
|
|
3437
|
-
})(t.current) ?? document.body;
|
|
3438
|
-
return e !== document.body && getComputedStyle(e).position === "static" && (e.style.position = "relative"), e;
|
|
3439
|
-
};
|
|
3440
|
-
useEffect(() => {
|
|
3441
|
-
let e = f(), t = () => w();
|
|
3442
|
-
return e.addEventListener("scroll", t, { passive: !0 }), window.addEventListener("resize", t), w(), () => {
|
|
3443
|
-
e.removeEventListener("scroll", t), window.removeEventListener("resize", t), T();
|
|
3444
|
-
};
|
|
3445
|
-
}, [i]);
|
|
3446
|
-
let p = (e, n) => {
|
|
3447
|
-
if (!t.current) return null;
|
|
3448
|
-
let r = t.current.querySelector(`tr:nth-child(${e + 1})`);
|
|
3449
|
-
if (!r) return null;
|
|
3450
|
-
let i = r.querySelector(`td:nth-child(${n + 1})`);
|
|
3451
|
-
return i ? i.querySelector("input") : null;
|
|
3452
|
-
}, m = (e, t) => {
|
|
3453
|
-
let n = p(e, t);
|
|
3454
|
-
n && n.focus();
|
|
3455
|
-
}, g = (e) => {
|
|
3456
|
-
if (!i) return;
|
|
3457
|
-
let t = n.slice(i.row.start, i.row.end + 1).map((e) => e.cells.slice(i.column.start, i.column.end + 1).map((e) => e.value)).map((e) => e.join(" ")).join("\n");
|
|
3458
|
-
navigator.clipboard.writeText(t);
|
|
3459
|
-
}, _ = (e) => {
|
|
3460
|
-
e.preventDefault();
|
|
3461
|
-
let t = (e?.clipboardData?.getData("text") || "")?.replace(/\r\n/g, "\n")?.replace(/\r/g, "\n"), a = (t?.endsWith("\n") ? t?.slice(0, -1)?.split("\n") : t?.split("\n"))?.filter(Boolean)?.map((e) => e?.split(" "));
|
|
3462
|
-
if (!a?.length || !n?.length || !n?.[0]?.cells?.length) return;
|
|
3463
|
-
let o = n?.map((e) => e?.cells?.map((e) => String(e?.value ?? ""))), s = o?.length, c = o?.[0]?.length, l = (e, t, n) => {
|
|
3464
|
-
let r = Math.min(t?.length, Math.max(c - n, 0)), i = e ? e?.slice() : Array(c)?.fill("");
|
|
3465
|
-
for (let e = 0; e < r; e++) i[n + e] = t[e] ?? "";
|
|
3466
|
-
return i;
|
|
3467
|
-
}, u, f, p;
|
|
3468
|
-
if (i) {
|
|
3469
|
-
let e = i?.row?.start, t = i?.column?.start, n = i?.row?.start, r = i?.row?.end, s = r - n + 1, d = o?.slice(0, n), m = o?.slice(r + 1), h = a?.length, g = Math.min(s, h), _ = Math.max(0, s - h), v = [];
|
|
3470
|
-
for (let e = 0; e < g; e++) {
|
|
3471
|
-
let r = o[n + e];
|
|
3472
|
-
v.push(l(r, a[e], t));
|
|
3473
|
-
}
|
|
3474
|
-
let y = _ > 0 ? o?.slice(n + g, n + g + _) : [], b = [];
|
|
3475
|
-
for (let e = g; e < h; e++) b?.push(l(void 0, a?.[e], t));
|
|
3476
|
-
f = v?.concat(b), u = d?.concat(v)?.concat(y)?.concat(b)?.concat(m);
|
|
3477
|
-
let x = Math.min(a?.[0]?.length, Math.max(c - t, 0));
|
|
3478
|
-
p = {
|
|
3479
|
-
row: {
|
|
3480
|
-
start: e,
|
|
3481
|
-
end: e + g - 1
|
|
3482
|
-
},
|
|
3483
|
-
column: {
|
|
3484
|
-
start: t,
|
|
3485
|
-
end: t + Math.max(x - 1, 0)
|
|
3486
|
-
}
|
|
3487
|
-
};
|
|
3488
|
-
} else {
|
|
3489
|
-
let e = s;
|
|
3490
|
-
f = a?.map((e) => l(void 0, e, 0)), u = [...o || [], ...f || []];
|
|
3491
|
-
let t = Math.min(a?.[0]?.length, c);
|
|
3492
|
-
p = {
|
|
3493
|
-
row: {
|
|
3494
|
-
start: e,
|
|
3495
|
-
end: e + f?.length - 1
|
|
3496
|
-
},
|
|
3497
|
-
column: {
|
|
3498
|
-
start: 0,
|
|
3499
|
-
end: 0 + Math.max(t - 1, 0)
|
|
3500
|
-
}
|
|
3501
|
-
};
|
|
3502
|
-
}
|
|
3503
|
-
let { errors: m, isValid: h } = d({ rows: u });
|
|
3504
|
-
r?.({
|
|
3505
|
-
allValues: u,
|
|
3506
|
-
affectedRange: p,
|
|
3507
|
-
insertedValues: f,
|
|
3508
|
-
errors: m,
|
|
3509
|
-
isValid: h
|
|
3510
|
-
});
|
|
3511
|
-
}, v = (e) => {
|
|
3512
|
-
if ((e.key === "a" || e.key === "A") && (e.metaKey || e.ctrlKey)) {
|
|
3513
|
-
n?.length && n[0]?.cells?.length && (e.preventDefault(), a({
|
|
3514
|
-
row: {
|
|
3515
|
-
start: 0,
|
|
3516
|
-
end: n.length - 1
|
|
3517
|
-
},
|
|
3518
|
-
column: {
|
|
3519
|
-
start: 0,
|
|
3520
|
-
end: n[0].cells.length - 1
|
|
3521
|
-
}
|
|
3522
|
-
}));
|
|
3523
|
-
return;
|
|
3524
|
-
}
|
|
3525
|
-
if (!n?.length || !n[0]?.cells?.length) return;
|
|
3526
|
-
if ((e.key === "Delete" || e.key === "Backspace") && i) {
|
|
3527
|
-
e.preventDefault();
|
|
3528
|
-
let t = n.map((e) => e.cells.map((e) => String(e?.value ?? ""))), { row: a, column: o } = i;
|
|
3529
|
-
for (let e = a.start; e <= a.end; e++) for (let n = o.start; n <= o.end; n++) t[e][n] = "";
|
|
3530
|
-
let s = Array(a.end - a.start + 1).fill(null).map(() => Array(o.end - o.start + 1).fill("")), c = {
|
|
3531
|
-
row: {
|
|
3532
|
-
start: a.start,
|
|
3533
|
-
end: a.end
|
|
3534
|
-
},
|
|
3535
|
-
column: {
|
|
3536
|
-
start: o.start,
|
|
3537
|
-
end: o.end
|
|
3538
|
-
}
|
|
3539
|
-
}, { errors: l, isValid: u } = d({ rows: t });
|
|
3540
|
-
r?.({
|
|
3541
|
-
allValues: t,
|
|
3542
|
-
affectedRange: c,
|
|
3543
|
-
insertedValues: s,
|
|
3544
|
-
errors: l,
|
|
3545
|
-
isValid: u
|
|
3546
|
-
}), m(a.start, o.start);
|
|
3547
|
-
return;
|
|
3548
|
-
}
|
|
3549
|
-
if (!(e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight") || !e.shiftKey) return;
|
|
3550
|
-
e.preventDefault();
|
|
3551
|
-
let t = (e, t, n) => Math.min(n, Math.max(t, e)), c = i ?? {
|
|
3552
|
-
row: {
|
|
3553
|
-
start: 0,
|
|
3554
|
-
end: 0
|
|
3555
|
-
},
|
|
3556
|
-
column: {
|
|
3557
|
-
start: 0,
|
|
3558
|
-
end: 0
|
|
3559
|
-
}
|
|
3560
|
-
}, l = n.length - 1, u = n[0].cells.length - 1, f = e.key === "ArrowUp" ? {
|
|
3561
|
-
dr: -1,
|
|
3562
|
-
dc: 0
|
|
3563
|
-
} : e.key === "ArrowDown" ? {
|
|
3564
|
-
dr: 1,
|
|
3565
|
-
dc: 0
|
|
3566
|
-
} : e.key === "ArrowLeft" ? {
|
|
3567
|
-
dr: 0,
|
|
3568
|
-
dc: -1
|
|
3569
|
-
} : {
|
|
3570
|
-
dr: 0,
|
|
3571
|
-
dc: 1
|
|
3572
|
-
};
|
|
3573
|
-
if (e.shiftKey) {
|
|
3574
|
-
let e = o ?? {
|
|
3575
|
-
row: c.row.start,
|
|
3576
|
-
column: c.column.start
|
|
3577
|
-
}, n = {
|
|
3578
|
-
row: e.row === c.row.start ? c.row.end : c.row.start,
|
|
3579
|
-
column: e.column === c.column.start ? c.column.end : c.column.start
|
|
3580
|
-
}, r = {
|
|
3581
|
-
row: t(n.row + f.dr, 0, l),
|
|
3582
|
-
column: t(n.column + f.dc, 0, u)
|
|
3583
|
-
}, i = {
|
|
3584
|
-
row: {
|
|
3585
|
-
start: Math.min(e.row, r.row),
|
|
3586
|
-
end: Math.max(e.row, r.row)
|
|
3587
|
-
},
|
|
3588
|
-
column: {
|
|
3589
|
-
start: Math.min(e.column, r.column),
|
|
3590
|
-
end: Math.max(e.column, r.column)
|
|
3591
|
-
}
|
|
3592
|
-
};
|
|
3593
|
-
o || s({
|
|
3594
|
-
row: e.row,
|
|
3595
|
-
column: e.column
|
|
3596
|
-
}), a(i);
|
|
3597
|
-
} else {
|
|
3598
|
-
let e = {
|
|
3599
|
-
row: c.row.end,
|
|
3600
|
-
column: c.column.end
|
|
3601
|
-
}, n = {
|
|
3602
|
-
row: t(e.row + f.dr, 0, l),
|
|
3603
|
-
column: t(e.column + f.dc, 0, u)
|
|
3604
|
-
};
|
|
3605
|
-
s(void 0), a({
|
|
3606
|
-
row: {
|
|
3607
|
-
start: n.row,
|
|
3608
|
-
end: n.row
|
|
3609
|
-
},
|
|
3610
|
-
column: {
|
|
3611
|
-
start: n.column,
|
|
3612
|
-
end: n.column
|
|
3613
|
-
}
|
|
3614
|
-
}), m(n.row, n.column);
|
|
3615
|
-
}
|
|
3616
|
-
}, y = (e) => {
|
|
3617
|
-
e.key === "Shift" && s(void 0);
|
|
3618
|
-
}, b = (e, t) => {
|
|
3619
|
-
a(o ? {
|
|
3620
|
-
row: {
|
|
3621
|
-
start: Math.min(e, o.row),
|
|
3622
|
-
end: Math.max(e, o.row)
|
|
3623
|
-
},
|
|
3624
|
-
column: {
|
|
3625
|
-
start: Math.min(t, o.column),
|
|
3626
|
-
end: Math.max(t, o.column)
|
|
3627
|
-
}
|
|
3628
|
-
} : {
|
|
3629
|
-
row: {
|
|
3630
|
-
start: e,
|
|
3631
|
-
end: e
|
|
3632
|
-
},
|
|
3633
|
-
column: {
|
|
3634
|
-
start: t,
|
|
3635
|
-
end: t
|
|
3636
|
-
}
|
|
3637
|
-
});
|
|
3638
|
-
}, x = (e) => {
|
|
3639
|
-
let t = e.target, n = Number(t.closest("td")?.dataset.rowIndex), r = Number(t.closest("td")?.dataset.columnIndex);
|
|
3640
|
-
b(n, r), o || s({
|
|
3641
|
-
row: n,
|
|
3642
|
-
column: r
|
|
3643
|
-
}), u(!0);
|
|
3644
|
-
}, S = (e) => {
|
|
3645
|
-
s(void 0), u(!1);
|
|
3646
|
-
}, C = (e) => {
|
|
3647
|
-
if (e.preventDefault(), !c) return;
|
|
3648
|
-
let t = e.target, n = Number(t.closest("td")?.dataset.rowIndex), r = Number(t.closest("td")?.dataset.columnIndex);
|
|
3649
|
-
b(n, r);
|
|
3650
|
-
}, w = () => {
|
|
3651
|
-
if (T(), !i || !t.current) return;
|
|
3652
|
-
let { row: e, column: n } = i, r = t.current?.querySelector(`td[data-row-index="${e.start}"][data-column-index="${n.start}"]`), a = e.end === e.start && n.end === n.start ? r : t.current?.querySelector(`td[data-row-index="${e.end}"][data-column-index="${n.end}"]`);
|
|
3653
|
-
if (!r || !a) return;
|
|
3654
|
-
let o = f(), s = o.getBoundingClientRect(), c = r?.getBoundingClientRect(), l = a?.getBoundingClientRect(), u = Math.round(c?.left - s.left + o.scrollLeft), d = Math.round(c?.top - s.top + o.scrollTop), p = Math.round(l?.right - s.left + o.scrollLeft), m = Math.round(l?.bottom - s.top + o.scrollTop), h = document.createElement("div");
|
|
3655
|
-
h.className = "selection-frame", h.style.position = "absolute", h.style.pointerEvents = "none", h.style.zIndex = "4", h.style.left = `${u}px`, h.style.top = `${d}px`, h.style.width = `${p - u}px`, h.style.height = `${m - d}px`, h.style.border = "1px solid var(--color-border-focus)", h.style.borderRadius = "0", o.appendChild(h);
|
|
3656
|
-
}, T = () => {
|
|
3657
|
-
f().querySelectorAll(".selection-frame,.drag-handle").forEach((e) => e.remove());
|
|
3658
|
-
};
|
|
3659
|
-
return {
|
|
3660
|
-
selectedIndexes: i,
|
|
3661
|
-
setSelectedIndexes: a,
|
|
3662
|
-
onCopy: g,
|
|
3663
|
-
onPaste: _,
|
|
3664
|
-
onKeyDown: v,
|
|
3665
|
-
onKeyUp: y,
|
|
3666
|
-
onMouseDown: x,
|
|
3667
|
-
onMouseUp: S,
|
|
3668
|
-
onMouseMove: C,
|
|
3669
|
-
onBlur: (e) => {
|
|
3670
|
-
e.currentTarget.contains(e.relatedTarget) || (a(void 0), s(void 0));
|
|
3671
|
-
}
|
|
3672
|
-
};
|
|
3673
|
-
}, InputCell = ({ cell: e, columnAlignment: t, testId: n, type: r }) => {
|
|
3674
|
-
let { selectedIndexes: i } = useContext(CellSelectionContext), a = i?.row.start !== i?.row.end || i?.column.start !== i?.column.end;
|
|
3675
|
-
return /* @__PURE__ */ jsx(Input, {
|
|
3676
|
-
name: e.name,
|
|
3677
|
-
value: e.value,
|
|
3678
|
-
onChange: (t) => e.onChange?.(t),
|
|
3679
|
-
onFocus: e.onFocus,
|
|
3680
|
-
onBlur: e.onBlur,
|
|
3681
|
-
onPaste: (t) => e.onPaste?.(t),
|
|
3682
|
-
placeholder: e.placeholder,
|
|
3683
|
-
error: e.error,
|
|
3684
|
-
warning: e.warning,
|
|
3685
|
-
disabled: e.disabled,
|
|
3686
|
-
isInTable: !0,
|
|
3687
|
-
maxTooltipWidth: e.maxTooltipWidth,
|
|
3688
|
-
right: t === Align.RIGHT,
|
|
3689
|
-
selectOnFocus: !a,
|
|
3690
|
-
testId: n,
|
|
3691
|
-
tabIndex: e.disabled ? -1 : 0,
|
|
3692
|
-
tooltip: e.tooltip,
|
|
3693
|
-
type: r
|
|
3694
|
-
});
|
|
3695
|
-
}, safeToString = (e) => String(toString(e)), roundNumberCosmetic = (e) => isScientificStringNum(e) ? e : safeToString(roundToPrecision(toNum(e), 14));
|
|
3696
|
-
var getStringName$1 = (e) => e ? typeof e == "string" ? e : isArray(e) ? e[0] : e.fieldName : "";
|
|
3697
|
-
const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r = !1, left: i = !1, small: a = !1, width: o = "100%", value: s = "", onChange: c = () => {}, onFocus: u = () => {}, onBlur: d = () => {}, selectOnFocus: f, tabIndex: p = 0, testId: g, tooltip: _ = null, warning: v = !1, validationCallback: y = () => {}, allowEmpty: b = !1, isInTable: x, groupOrder: S, enableCosmeticRounding: C = !0, enableDisplayRounding: w = !1, roundDisplayValue: T, disableInternalErrorValidationMessages: E = !1, disableValidationOnFocus: D = !1 }) => {
|
|
3698
|
-
let O = (e) => {
|
|
3699
|
-
let n = validateNumber(e), r = t && isEmptyNullOrUndefined(e);
|
|
3700
|
-
return [Infinity, -Infinity].includes(Number(e)) || r ? {
|
|
3701
|
-
valid: !0,
|
|
3702
|
-
errors: []
|
|
3703
|
-
} : b && e === "" || n.valid ? {
|
|
3704
|
-
...n,
|
|
3705
|
-
valid: !0,
|
|
3706
|
-
errors: void 0
|
|
3707
|
-
} : n;
|
|
3708
|
-
}, k = (e) => {
|
|
3709
|
-
let t = !!e?.endsWith("0"), n = C && e && !t && O(e)?.valid ? roundNumberCosmetic(e) : e;
|
|
3710
|
-
return safeToString(n);
|
|
3711
|
-
}, A = useRef(null), [j, M] = useState(k(safeToString(s))), [N, P] = useState(!1), F = getStringName$1(e), { valid: I, errors: L } = O(j), R = L && L.length && !E ? L[0] : null;
|
|
3712
|
-
useEffect(() => {
|
|
3713
|
-
let e = k(safeToString(s));
|
|
3714
|
-
toNum(j) !== toNum(e) && M(e);
|
|
3715
|
-
}, [
|
|
3716
|
-
s,
|
|
3717
|
-
C,
|
|
3718
|
-
w
|
|
3719
|
-
]), useEffect(() => {
|
|
3720
|
-
(D || !N) && !I ? y(F, R) : y(F, null);
|
|
3721
|
-
}, [
|
|
3722
|
-
N,
|
|
3723
|
-
I,
|
|
3724
|
-
r
|
|
3725
|
-
]);
|
|
3726
|
-
let z = (e) => {
|
|
3727
|
-
let n = "key" in e ? j : e?.target?.value, r = cleanNumStr(n.replaceAll(" ", "").replaceAll("|", ""));
|
|
3728
|
-
if (M(r), O(r)?.valid || t && isEmptyNullOrUndefined(n)) {
|
|
3729
|
-
let t = {
|
|
3730
|
-
...e,
|
|
3731
|
-
target: {
|
|
3732
|
-
...e.target,
|
|
3733
|
-
value: stripLeadingZeros(safeToString(r)),
|
|
3734
|
-
name: F
|
|
3735
|
-
}
|
|
3736
|
-
};
|
|
3737
|
-
c(t);
|
|
3065
|
+
l(t);
|
|
3738
3066
|
}
|
|
3739
3067
|
};
|
|
3740
3068
|
useEffect(() => {
|
|
@@ -3772,7 +3100,7 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3772
3100
|
isInTable: x,
|
|
3773
3101
|
groupOrder: S,
|
|
3774
3102
|
selectOnFocus: f,
|
|
3775
|
-
tabIndex:
|
|
3103
|
+
tabIndex: h,
|
|
3776
3104
|
tooltip: _,
|
|
3777
3105
|
ref: A
|
|
3778
3106
|
}, F);
|
|
@@ -3841,14 +3169,14 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3841
3169
|
testId: n
|
|
3842
3170
|
}) : null
|
|
3843
3171
|
}), LinkCell = ({ cell: e, testId: t }) => {
|
|
3844
|
-
let n = useContext(DisabledContext), { error: r, warning: i, tooltip: a, maxTooltipWidth: o } = e,
|
|
3172
|
+
let n = useContext(DisabledContext), { error: r, warning: i, tooltip: a, maxTooltipWidth: o } = e, c = (e) => isStringNumberOrNode(e);
|
|
3845
3173
|
return /* @__PURE__ */ jsx("div", {
|
|
3846
3174
|
className: cell_module_default.inputWrapper,
|
|
3847
3175
|
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
3848
3176
|
error: !!r,
|
|
3849
3177
|
warning: !!i,
|
|
3850
3178
|
text: a || r || i,
|
|
3851
|
-
enabled:
|
|
3179
|
+
enabled: c(a) || c(r) || c(i) || !1,
|
|
3852
3180
|
maxWidth: o,
|
|
3853
3181
|
children: /* @__PURE__ */ jsx("div", {
|
|
3854
3182
|
className: cell_module_default.staticCellContent,
|
|
@@ -3891,7 +3219,7 @@ var slider_module_default = {
|
|
|
3891
3219
|
] }),
|
|
3892
3220
|
children: /* @__PURE__ */ jsx("div", { className: slider_module_default.dot })
|
|
3893
3221
|
}), e), {}), isEqual$1);
|
|
3894
|
-
const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto", value: i, min: a, max: o, step:
|
|
3222
|
+
const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto", value: i, min: a, max: o, step: c = 1, marks: l = [], showArrows: u = !1, showTooltip: d = !1, tooltipFormatter: f = (e) => e, disabled: p = !1, range: m = !1, small: h = !1, vertical: _ = {
|
|
3895
3223
|
enabled: !1,
|
|
3896
3224
|
width: "100px",
|
|
3897
3225
|
height: "400px"
|
|
@@ -3924,13 +3252,13 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3924
3252
|
})
|
|
3925
3253
|
});
|
|
3926
3254
|
return /* @__PURE__ */ jsxs("div", {
|
|
3927
|
-
className: cx(slider_module_default.container, h ? slider_module_default.small : "",
|
|
3928
|
-
style:
|
|
3929
|
-
width:
|
|
3930
|
-
height:
|
|
3255
|
+
className: cx(slider_module_default.container, h ? slider_module_default.small : "", _.enabled ? slider_module_default.vertical : ""),
|
|
3256
|
+
style: _.enabled ? {
|
|
3257
|
+
width: _.width,
|
|
3258
|
+
height: _.height
|
|
3931
3259
|
} : { width: n },
|
|
3932
3260
|
children: [
|
|
3933
|
-
u && (
|
|
3261
|
+
u && (_.enabled ? /* @__PURE__ */ jsx(C, {}) : /* @__PURE__ */ jsx(S, {})),
|
|
3934
3262
|
/* @__PURE__ */ jsx(RcSlider, {
|
|
3935
3263
|
range: m,
|
|
3936
3264
|
allowCross: !1,
|
|
@@ -3938,11 +3266,11 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3938
3266
|
value: i,
|
|
3939
3267
|
max: o,
|
|
3940
3268
|
min: a,
|
|
3941
|
-
step:
|
|
3269
|
+
step: c,
|
|
3942
3270
|
marks: b,
|
|
3943
3271
|
onChange: (e) => x(e),
|
|
3944
3272
|
disabled: p || y,
|
|
3945
|
-
vertical:
|
|
3273
|
+
vertical: _.enabled,
|
|
3946
3274
|
handleRender: (e, t) => {
|
|
3947
3275
|
let n = d && t.dragging;
|
|
3948
3276
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -3959,7 +3287,7 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3959
3287
|
});
|
|
3960
3288
|
}
|
|
3961
3289
|
}),
|
|
3962
|
-
u && (
|
|
3290
|
+
u && (_.enabled ? /* @__PURE__ */ jsx(S, {}) : /* @__PURE__ */ jsx(C, {})),
|
|
3963
3291
|
t && /* @__PURE__ */ jsx("label", {
|
|
3964
3292
|
className: slider_module_default.label,
|
|
3965
3293
|
style: { width: r },
|
|
@@ -4000,17 +3328,17 @@ var popover_module_default = {
|
|
|
4000
3328
|
fullWidthStyleFix: "_fullWidthStyleFix_lhie5_8",
|
|
4001
3329
|
dismiss: "_dismiss_lhie5_13"
|
|
4002
3330
|
};
|
|
4003
|
-
const Popover = ({ children: t, content: n, placement: r = "top-center", closeOnOutsideClick: i = !0, fullWidth: a = !1, showCloseButton: o = !1, testId:
|
|
4004
|
-
let
|
|
4005
|
-
!u && !
|
|
3331
|
+
const Popover = ({ children: t, content: n, placement: r = "top-center", closeOnOutsideClick: i = !0, fullWidth: a = !1, showCloseButton: o = !1, testId: l, disabled: u = !1, overflowContainer: d = !1, isOpen: f, onToggle: p }) => {
|
|
3332
|
+
let h = useContext(DisabledContext), [_, v] = f === void 0 ? useState(!1) : [f, p], y = () => {
|
|
3333
|
+
!u && !h && v && v(!1);
|
|
4006
3334
|
}, b = () => {
|
|
4007
|
-
u ||
|
|
3335
|
+
u || h || v && v(!_);
|
|
4008
3336
|
};
|
|
4009
3337
|
useEffect(() => {
|
|
4010
|
-
(u ||
|
|
4011
|
-
}, [u,
|
|
3338
|
+
(u || h) && y();
|
|
3339
|
+
}, [u, h]);
|
|
4012
3340
|
let { renderLayer: x, arrowProps: S, layerProps: C, triggerProps: w } = useLayer({
|
|
4013
|
-
isOpen:
|
|
3341
|
+
isOpen: _,
|
|
4014
3342
|
placement: r,
|
|
4015
3343
|
auto: !0,
|
|
4016
3344
|
triggerOffset: 6,
|
|
@@ -4021,9 +3349,9 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
|
|
|
4021
3349
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
4022
3350
|
ref: w.ref,
|
|
4023
3351
|
onClick: b,
|
|
4024
|
-
"data-testid":
|
|
3352
|
+
"data-testid": l,
|
|
4025
3353
|
children: t
|
|
4026
|
-
}),
|
|
3354
|
+
}), _ && x(/* @__PURE__ */ jsxs("div", {
|
|
4027
3355
|
className: a ? cx(popover_module_default.toggleBox, popover_module_default.fullWidthStyleFix) : cx(popover_module_default.toggleBox),
|
|
4028
3356
|
...C,
|
|
4029
3357
|
children: [/* @__PURE__ */ jsxs("div", { children: [React.isValidElement(n) ? React.cloneElement(n, { close: y }) : n, o && /* @__PURE__ */ jsx("div", {
|
|
@@ -4149,37 +3477,33 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
|
|
|
4149
3477
|
let CellType = /* @__PURE__ */ function(e) {
|
|
4150
3478
|
return e.INPUT = "Input", e.NUMBER_INPUT = "NumberInput", e.SELECT = "Select", e.POPOVER = "Popover", e.SLIDER = "Slider", e.CHECKBOX = "CheckBox", e.ACTIONS = "Actions", e.AUTO_UNIT = "AutoUnit", e.UNIT = "Unit", e.STATIC = "Static", e;
|
|
4151
3479
|
}({});
|
|
4152
|
-
const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a
|
|
4153
|
-
let { selectedIndexes: l, setSelectedIndexes: u } = useContext(CellSelectionContext), d = !t && l && l.row.start <= o && o <= l.row.end && l.column.start <= s && s <= l.column.end;
|
|
3480
|
+
const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a }) => {
|
|
4154
3481
|
if (!e) return null;
|
|
4155
|
-
let { style:
|
|
3482
|
+
let { style: o, colSpan: s, rowSpan: c, width: l } = e, u = useRef(null), d = {
|
|
4156
3483
|
bodyAlignment: r,
|
|
4157
3484
|
headerAlignment: n,
|
|
4158
3485
|
isHeader: t
|
|
4159
|
-
},
|
|
4160
|
-
width:
|
|
4161
|
-
minWidth:
|
|
4162
|
-
textTransform:
|
|
4163
|
-
...
|
|
3486
|
+
}, f = getCellAlignment(d, cell_module_default), m = getCellAlignment(d, cell_module_default, !0), h = e.type === CellType.INPUT || e.type === CellType.NUMBER_INPUT || e.type === CellType.SELECT || e.type === CellType.POPOVER ? cell_module_default.inputCell : e.type === CellType.SLIDER ? cell_module_default.sliderCell : e.type === CellType.CHECKBOX ? cell_module_default.checkBoxCell : e.type === CellType.ACTIONS ? cell_module_default.actionsCell : cell_module_default.staticCell, _ = cx(cell_module_default.cell, h, e.hasSort ? cell_module_default.sortingCell : null, f, e.breakWord ? cell_module_default.breakWord : ""), v = l ?? i ?? void 0, y = e.type === CellType.STATIC || !e.type, b = t && y ? TextTransform.CAPITALIZE : void 0, x = {
|
|
3487
|
+
width: v,
|
|
3488
|
+
minWidth: v,
|
|
3489
|
+
textTransform: b,
|
|
3490
|
+
...o
|
|
4164
3491
|
};
|
|
4165
3492
|
return /* @__PURE__ */ jsx(t ? "th" : "td", {
|
|
4166
|
-
ref:
|
|
4167
|
-
className:
|
|
4168
|
-
style:
|
|
4169
|
-
colSpan:
|
|
4170
|
-
rowSpan:
|
|
4171
|
-
"data-row-index": o,
|
|
4172
|
-
"data-column-index": s,
|
|
4173
|
-
"data-selected": d,
|
|
3493
|
+
ref: u,
|
|
3494
|
+
className: _,
|
|
3495
|
+
style: x,
|
|
3496
|
+
colSpan: s,
|
|
3497
|
+
rowSpan: c,
|
|
4174
3498
|
children: /* @__PURE__ */ jsx(CellWrapper, {
|
|
4175
3499
|
cell: e,
|
|
4176
|
-
columnAlignment:
|
|
3500
|
+
columnAlignment: m ?? Align.RIGHT,
|
|
4177
3501
|
isHeader: t,
|
|
4178
3502
|
testId: a
|
|
4179
3503
|
})
|
|
4180
3504
|
});
|
|
4181
3505
|
}, Row$1 = ({ row: e, rowIndex: t, isHeader: n = !1, columnCount: r, colSpan: i, columnHeaderAlignments: a = [], columnAlignment: o = [], hasRowActions: s, draggableTable: c = !1, columnWidths: l, dropDisabled: u = !1, height: d, testId: f }) => {
|
|
4182
|
-
let p = getHeaderAlignment(a, n, t), { onRowClick: m, onRowFocus: h, onRowMouseEnter:
|
|
3506
|
+
let p = getHeaderAlignment(a, n, t), { onRowClick: m, onRowFocus: h, onRowMouseEnter: _, onRowMouseLeave: v, expandedContent: y, error: b, warning: x, active: S } = e, C = e.cells.map((e, r) => {
|
|
4183
3507
|
let i = `${n ? 0 : 1}_${t}_${r}`;
|
|
4184
3508
|
return /* @__PURE__ */ jsx(Cell, {
|
|
4185
3509
|
cell: e,
|
|
@@ -4187,18 +3511,14 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4187
3511
|
columnAlignment: o[r],
|
|
4188
3512
|
columnHeaderAlignment: p[r],
|
|
4189
3513
|
width: l ? l[r] : void 0,
|
|
4190
|
-
testId: e.testId
|
|
4191
|
-
rowIndex: t,
|
|
4192
|
-
columnIndex: r
|
|
3514
|
+
testId: e.testId
|
|
4193
3515
|
}, i);
|
|
4194
3516
|
}), w = s && /* @__PURE__ */ jsx(Cell, {
|
|
4195
3517
|
cell: {
|
|
4196
3518
|
type: CellType.ACTIONS,
|
|
4197
3519
|
actions: e.actions
|
|
4198
3520
|
},
|
|
4199
|
-
isHeader: n
|
|
4200
|
-
rowIndex: t,
|
|
4201
|
-
columnIndex: r
|
|
3521
|
+
isHeader: n
|
|
4202
3522
|
}, r), { attributes: T, listeners: E, setNodeRef: D, transform: O, transition: k, isDragging: A } = useSortable({
|
|
4203
3523
|
id: t.toString(),
|
|
4204
3524
|
animateLayoutChanges: () => !1
|
|
@@ -4218,10 +3538,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4218
3538
|
});
|
|
4219
3539
|
return n ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
4220
3540
|
onClick: m,
|
|
4221
|
-
onMouseEnter:
|
|
3541
|
+
onMouseEnter: _,
|
|
4222
3542
|
onMouseLeave: v,
|
|
4223
3543
|
onFocus: h,
|
|
4224
|
-
className: cx(m ? row_module_default$1.clickableRow : null,
|
|
3544
|
+
className: cx(m ? row_module_default$1.clickableRow : null, _ ? row_module_default$1.hoverableRow : null),
|
|
4225
3545
|
children: [
|
|
4226
3546
|
c ? /* @__PURE__ */ jsx("th", {}) : null,
|
|
4227
3547
|
C,
|
|
@@ -4234,10 +3554,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4234
3554
|
}, `${t}_expanded_content`) : null] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
4235
3555
|
ref: e.noDrag ? null : D,
|
|
4236
3556
|
onClick: m,
|
|
4237
|
-
onMouseEnter:
|
|
3557
|
+
onMouseEnter: _,
|
|
4238
3558
|
onMouseLeave: v,
|
|
4239
3559
|
onFocus: h,
|
|
4240
|
-
className: cx(m && !m.noStyle ? row_module_default$1.clickableRow : null,
|
|
3560
|
+
className: cx(m && !m.noStyle ? row_module_default$1.clickableRow : null, _ && !_.noStyle ? row_module_default$1.hoverableRow : null, S ? row_module_default$1.rowActive : null),
|
|
4241
3561
|
"data-error": b || null,
|
|
4242
3562
|
"data-warning": x || null,
|
|
4243
3563
|
"data-index": t,
|
|
@@ -4254,14 +3574,14 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4254
3574
|
children: y.content
|
|
4255
3575
|
}, `${t}_expanded_content`) : null] });
|
|
4256
3576
|
}, TableDragWrapper = (e) => {
|
|
4257
|
-
let { children: t, colSpan: n, columnAlignment: r, columnCount: i, draggable: a, onListReorder: o = () => {}, canListReorder: s = () => !0, rowActions: c, rows: l = [], tbodyRef: u } = e, [
|
|
3577
|
+
let { children: t, colSpan: n, columnAlignment: r, columnCount: i, draggable: a, onListReorder: o = () => {}, canListReorder: s = () => !0, rowActions: c, rows: l = [], tbodyRef: u } = e, [f, p] = useState(null), [h, _] = useState(!1), v = useMemo(() => l.map((e, t) => t.toString()), [l]);
|
|
4258
3578
|
return a ? /* @__PURE__ */ jsxs(DndContext, {
|
|
4259
3579
|
collisionDetection: closestCenter,
|
|
4260
3580
|
onDragStart: (e) => {
|
|
4261
3581
|
p(e.active.id);
|
|
4262
3582
|
},
|
|
4263
3583
|
onDragEnd: (e) => {
|
|
4264
|
-
p(null),
|
|
3584
|
+
p(null), _(!1);
|
|
4265
3585
|
let { active: t, over: n } = e;
|
|
4266
3586
|
if (!t || !n || t.id === n.id) return;
|
|
4267
3587
|
let r = Number(t.id), i = Number(n?.id);
|
|
@@ -4278,23 +3598,23 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4278
3598
|
from: r,
|
|
4279
3599
|
to: i
|
|
4280
3600
|
});
|
|
4281
|
-
|
|
3601
|
+
_(a);
|
|
4282
3602
|
},
|
|
4283
3603
|
children: [/* @__PURE__ */ jsx(SortableContext, {
|
|
4284
3604
|
items: v,
|
|
4285
3605
|
strategy: verticalListSortingStrategy,
|
|
4286
|
-
children: t({ dropDisabled:
|
|
4287
|
-
}), !!
|
|
3606
|
+
children: t({ dropDisabled: h })
|
|
3607
|
+
}), !!f && createPortal(/* @__PURE__ */ jsx(DragOverlay, {
|
|
4288
3608
|
dropAnimation: null,
|
|
4289
3609
|
children: /* @__PURE__ */ jsx("table", {
|
|
4290
3610
|
className: cx(table_module_default.table, table_module_default.dragOverlay),
|
|
4291
3611
|
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(Row$1, {
|
|
4292
|
-
rowIndex: Number(
|
|
4293
|
-
row: l[Number(
|
|
3612
|
+
rowIndex: Number(f),
|
|
3613
|
+
row: l[Number(f)],
|
|
4294
3614
|
columnCount: i,
|
|
4295
3615
|
columnWidths: (() => {
|
|
4296
3616
|
if (!u?.current) return [];
|
|
4297
|
-
let e = u.current.querySelectorAll("tr")[Number(
|
|
3617
|
+
let e = u.current.querySelectorAll("tr")[Number(f)]?.querySelectorAll("td");
|
|
4298
3618
|
if (!e) return [];
|
|
4299
3619
|
let t = Array.from(e).map((e) => `${e.getBoundingClientRect().width}px`);
|
|
4300
3620
|
return t.shift(), t;
|
|
@@ -4303,7 +3623,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4303
3623
|
hasRowActions: c,
|
|
4304
3624
|
columnAlignment: r,
|
|
4305
3625
|
draggableTable: a,
|
|
4306
|
-
dropDisabled:
|
|
3626
|
+
dropDisabled: h
|
|
4307
3627
|
}) })
|
|
4308
3628
|
})
|
|
4309
3629
|
}), document.body)]
|
|
@@ -4345,155 +3665,135 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4345
3665
|
className: table_module_default.scroll,
|
|
4346
3666
|
children: n({})
|
|
4347
3667
|
});
|
|
4348
|
-
}, Table =
|
|
4349
|
-
let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i
|
|
4350
|
-
|
|
4351
|
-
let O = useRef(null), k = useRef(null), { selectedIndexes: A, setSelectedIndexes: j, onCopy: M, onPaste: N, onKeyDown: P, onKeyUp: F, onMouseUp: I, onBlur: L, onMouseDown: R, onMouseMove: z } = useCellSelection(!!a, k, e.table.rows || [], w), B = get(e, "table.headers", []), V = getColumnCount(l, B), H = hasRowActions(l, B), U = V + (H ? 1 : 0), W = s ? s?.pagination?.rowsPerPage?.value === 0 || Number(s?.pagination?.selectedPage) >= Number(s?.pagination?.rowCount) / Number(s?.pagination?.rowsPerPage?.value) : !0, G = y?.cells?.length && b && W, K = {
|
|
4352
|
-
cells: G ? y.cells.map((e, t) => e?.type === "Input" ? {
|
|
3668
|
+
}, Table = (e) => {
|
|
3669
|
+
let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i } = e, { columnWidths: a, footer: o, name: s, rows: c = [], actions: l, actionsRight: u, columnHeaderAlignments: d, columnAlignment: f, striped: m = !0, testId: h, draggable: _, defaultEmptyRow: v = null, onAddRow: y = null, bordered: b = !0, maxHeight: x, fixedWidth: S } = i, C = useRef(null), w = useRef(null), T = get(e, "table.headers", []), E = getColumnCount(c, T), D = hasRowActions(c, T), O = E + (D ? 1 : 0), k = o ? o?.pagination?.rowsPerPage?.value === 0 || Number(o?.pagination?.selectedPage) >= Number(o?.pagination?.rowCount) / Number(o?.pagination?.rowsPerPage?.value) : !0, A = v?.cells?.length && y && k, j = {
|
|
3670
|
+
cells: A ? v.cells.map((e, t) => e?.type === "Input" ? {
|
|
4353
3671
|
...e,
|
|
4354
3672
|
onChange: (e) => {
|
|
4355
3673
|
let n = e?.target?.value, r = {
|
|
4356
|
-
...
|
|
4357
|
-
cells:
|
|
3674
|
+
...v,
|
|
3675
|
+
cells: v.cells.map((e, r) => ({
|
|
4358
3676
|
...e,
|
|
4359
3677
|
value: r === t ? n : e?.value
|
|
4360
3678
|
}))
|
|
4361
3679
|
};
|
|
4362
|
-
|
|
3680
|
+
y({ newRow: r });
|
|
4363
3681
|
}
|
|
4364
3682
|
} : {
|
|
4365
3683
|
...e,
|
|
4366
3684
|
disabled: !0
|
|
4367
3685
|
}) : null,
|
|
4368
|
-
testId:
|
|
4369
|
-
},
|
|
3686
|
+
testId: h ? `${h}-last-empty-row` : void 0
|
|
3687
|
+
}, M = A ? c.concat(j) : c, N = {
|
|
4370
3688
|
...i,
|
|
4371
|
-
rows:
|
|
4372
|
-
},
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
}) : q.map((t, n) => {
|
|
4454
|
-
let i = r ? r({
|
|
4455
|
-
row: t,
|
|
4456
|
-
rowIndex: n
|
|
4457
|
-
}) : t;
|
|
4458
|
-
return /* @__PURE__ */ jsx(Row$1, {
|
|
4459
|
-
rowIndex: n,
|
|
4460
|
-
row: i,
|
|
4461
|
-
columnCount: V,
|
|
4462
|
-
columnWidths: o,
|
|
4463
|
-
colSpan: U,
|
|
4464
|
-
hasRowActions: H,
|
|
4465
|
-
columnAlignment: p,
|
|
4466
|
-
draggableTable: v,
|
|
4467
|
-
dropDisabled: e
|
|
4468
|
-
}, `1_${n}`);
|
|
4469
|
-
})
|
|
4470
|
-
})]
|
|
3689
|
+
rows: M
|
|
3690
|
+
}, P = cx(table_module_default.wrapper, b ? table_module_default.bordered : "");
|
|
3691
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3692
|
+
className: P,
|
|
3693
|
+
style: {
|
|
3694
|
+
maxHeight: x,
|
|
3695
|
+
width: S,
|
|
3696
|
+
display: S === "auto" ? "inline-flex" : "flex"
|
|
3697
|
+
},
|
|
3698
|
+
children: [
|
|
3699
|
+
/* @__PURE__ */ jsx(Title$1, {
|
|
3700
|
+
actions: l,
|
|
3701
|
+
actionsRight: u,
|
|
3702
|
+
name: s,
|
|
3703
|
+
testId: h && `${h}-title`
|
|
3704
|
+
}),
|
|
3705
|
+
/* @__PURE__ */ jsx(TableDragWrapper, {
|
|
3706
|
+
colSpan: O,
|
|
3707
|
+
columnAlignment: f,
|
|
3708
|
+
columnCount: E,
|
|
3709
|
+
draggable: _,
|
|
3710
|
+
onListReorder: t,
|
|
3711
|
+
rowActions: D,
|
|
3712
|
+
rows: M,
|
|
3713
|
+
tbodyRef: w,
|
|
3714
|
+
canListReorder: n,
|
|
3715
|
+
children: ({ dropDisabled: e }) => /* @__PURE__ */ jsx(TableScrollWrapper, {
|
|
3716
|
+
table: N,
|
|
3717
|
+
theadRef: C,
|
|
3718
|
+
children: ({ virtualizer: t, tableStyle: n }) => /* @__PURE__ */ jsxs("table", {
|
|
3719
|
+
className: cx(table_module_default.table, m ? table_module_default.striped : ""),
|
|
3720
|
+
"data-testid": h,
|
|
3721
|
+
style: n,
|
|
3722
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
3723
|
+
ref: C,
|
|
3724
|
+
children: T.map((e, t) => /* @__PURE__ */ jsx(Row$1, {
|
|
3725
|
+
rowIndex: t,
|
|
3726
|
+
isHeader: !0,
|
|
3727
|
+
row: e,
|
|
3728
|
+
columnCount: E,
|
|
3729
|
+
columnWidths: a,
|
|
3730
|
+
colSpan: O,
|
|
3731
|
+
hasRowActions: D,
|
|
3732
|
+
columnAlignment: f,
|
|
3733
|
+
columnHeaderAlignments: d,
|
|
3734
|
+
draggableTable: _
|
|
3735
|
+
}, `0_${t}`))
|
|
3736
|
+
}), /* @__PURE__ */ jsx("tbody", {
|
|
3737
|
+
ref: w,
|
|
3738
|
+
children: t ? t.getVirtualItems().map((t) => {
|
|
3739
|
+
let n = t.index, i = M[n], o = r ? r({
|
|
3740
|
+
row: i,
|
|
3741
|
+
rowIndex: n
|
|
3742
|
+
}) : i;
|
|
3743
|
+
return /* @__PURE__ */ jsx(Row$1, {
|
|
3744
|
+
rowIndex: n,
|
|
3745
|
+
row: o,
|
|
3746
|
+
columnCount: E,
|
|
3747
|
+
columnWidths: a,
|
|
3748
|
+
colSpan: O,
|
|
3749
|
+
hasRowActions: D,
|
|
3750
|
+
columnAlignment: f,
|
|
3751
|
+
draggableTable: _,
|
|
3752
|
+
height: t.size,
|
|
3753
|
+
dropDisabled: e
|
|
3754
|
+
}, `1_${n}`);
|
|
3755
|
+
}) : M.map((t, n) => {
|
|
3756
|
+
let i = r ? r({
|
|
3757
|
+
row: t,
|
|
3758
|
+
rowIndex: n
|
|
3759
|
+
}) : t;
|
|
3760
|
+
return /* @__PURE__ */ jsx(Row$1, {
|
|
3761
|
+
rowIndex: n,
|
|
3762
|
+
row: i,
|
|
3763
|
+
columnCount: E,
|
|
3764
|
+
columnWidths: a,
|
|
3765
|
+
colSpan: O,
|
|
3766
|
+
hasRowActions: D,
|
|
3767
|
+
columnAlignment: f,
|
|
3768
|
+
draggableTable: _,
|
|
3769
|
+
dropDisabled: e
|
|
3770
|
+
}, `1_${n}`);
|
|
4471
3771
|
})
|
|
4472
|
-
})
|
|
3772
|
+
})]
|
|
4473
3773
|
})
|
|
4474
|
-
}),
|
|
4475
|
-
s && /* @__PURE__ */ jsx(Footer, {
|
|
4476
|
-
pagination: s.pagination,
|
|
4477
|
-
actions: s.actions,
|
|
4478
|
-
content: s.content
|
|
4479
3774
|
})
|
|
4480
|
-
|
|
4481
|
-
|
|
3775
|
+
}),
|
|
3776
|
+
o && /* @__PURE__ */ jsx(Footer, {
|
|
3777
|
+
pagination: o.pagination,
|
|
3778
|
+
actions: o.actions,
|
|
3779
|
+
content: o.content
|
|
3780
|
+
})
|
|
3781
|
+
]
|
|
4482
3782
|
});
|
|
4483
|
-
}
|
|
3783
|
+
}, placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
|
|
4484
3784
|
let i = `${t} → ${n}:`, a = e.filter((e) => !e.startsWith(i)), o = r ? [...a, `${i} ${r}`] : a, s = o.length === 0;
|
|
4485
3785
|
return {
|
|
4486
3786
|
updatedErrors: o,
|
|
4487
3787
|
isValid: s
|
|
4488
3788
|
};
|
|
4489
3789
|
}, Table$1 = ({ validationRules: e, parsedResult: t, updateState: n, testId: r }) => {
|
|
4490
|
-
let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a,
|
|
3790
|
+
let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a, s] = useState(20), [l, u] = useState(1), f = useRef([]), h = (l - 1) * a, g = a === 0 ? t.rows.length : h + a, [_, v] = useState([]), y = useCallback((r, a) => (!f.current.length && t.rows.length && (f.current = t.rows[0].map((e) => isNumericLike(e) ? "NumberInput" : "Input")), {
|
|
4491
3791
|
cells: r.map((r, o) => {
|
|
4492
|
-
let { columnMessage: s = {}, validator: c = () => null } = e?.[o] ?? {}, l = i?.[o]?.value, u = `${`Row ${a + 1}`} → ${l}:`,
|
|
3792
|
+
let { columnMessage: s = {}, validator: c = () => null } = e?.[o] ?? {}, l = i?.[o]?.value, u = `${`Row ${a + 1}`} → ${l}:`, d = c(r), p = t?.errors?.find((e) => e.startsWith(u)) ?? null, m = d || p || null;
|
|
4493
3793
|
return {
|
|
4494
3794
|
name: l,
|
|
4495
3795
|
value: r,
|
|
4496
|
-
type:
|
|
3796
|
+
type: f.current[o] ?? "Input",
|
|
4497
3797
|
disableValidationOnFocus: !0,
|
|
4498
3798
|
error: m,
|
|
4499
3799
|
validationCallback: (e, r) => {
|
|
@@ -4578,12 +3878,12 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4578
3878
|
i,
|
|
4579
3879
|
x,
|
|
4580
3880
|
b
|
|
4581
|
-
]), C = useMemo(() => _.slice(
|
|
3881
|
+
]), C = useMemo(() => _.slice(h, g), [
|
|
4582
3882
|
_,
|
|
4583
|
-
|
|
3883
|
+
h,
|
|
4584
3884
|
g
|
|
4585
3885
|
]), w = useCallback(({ rowIndex: e }) => {
|
|
4586
|
-
let n =
|
|
3886
|
+
let n = h + e, r = t.rows[n];
|
|
4587
3887
|
return r ? y(r, n) : {
|
|
4588
3888
|
cells: [],
|
|
4589
3889
|
actions: []
|
|
@@ -4591,7 +3891,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4591
3891
|
}, [
|
|
4592
3892
|
t.rows,
|
|
4593
3893
|
y,
|
|
4594
|
-
|
|
3894
|
+
h
|
|
4595
3895
|
]);
|
|
4596
3896
|
return /* @__PURE__ */ jsx(Table, {
|
|
4597
3897
|
beforeRenderRow: w,
|
|
@@ -4617,10 +3917,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4617
3917
|
infiniteScroll: !0,
|
|
4618
3918
|
footer: { pagination: {
|
|
4619
3919
|
rowCount: t.rows.length,
|
|
4620
|
-
selectedPage:
|
|
3920
|
+
selectedPage: l,
|
|
4621
3921
|
rowsPerPage: {
|
|
4622
3922
|
value: a,
|
|
4623
|
-
onChange: (e) =>
|
|
3923
|
+
onChange: (e) => s(Number(e?.target?.value)),
|
|
4624
3924
|
options: [
|
|
4625
3925
|
{
|
|
4626
3926
|
label: "10 / page",
|
|
@@ -4730,7 +4030,210 @@ const Empty = ({ width: e = "auto", height: t = "auto", text: n = "No data", chi
|
|
|
4730
4030
|
}), extraSeparators = (e) => e?.split(/;|\t|\n/)?.some((e) => {
|
|
4731
4031
|
let t = e?.match(/[.,]/g);
|
|
4732
4032
|
return t && t.length > 1;
|
|
4733
|
-
}), hasOneComma = (e) => e?.split(/;|\t|\n/)?.some((e) => !e?.includes(".") && e?.match(/,/g)?.length === 1)
|
|
4033
|
+
}), hasOneComma = (e) => e?.split(/;|\t|\n/)?.some((e) => !e?.includes(".") && e?.match(/,/g)?.length === 1);
|
|
4034
|
+
var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e && e !== "blank" && e.trim() !== "", validateColumnLength = (e, t, n, r, i, a, o) => {
|
|
4035
|
+
let s = [], c = r.filter((e) => e.optionalColumn).length, l = r.length, u = c ? `${l - c} or ${l}` : `${l}`, d = i && a ? 2 : i || a ? 1 : 0;
|
|
4036
|
+
if (i && !isValidLength(e.length, l, c) && s.push(o("incorrectNumberOfFieldNameHeaderColumns", { expectedLengthMessage: u })), a) {
|
|
4037
|
+
let e = r.filter((e) => Array.isArray(e?.validUnits) && e?.validUnits?.some(isNonPlaceholderUnit)).length, n = t?.filter(isNonPlaceholderUnit)?.length, i = r?.filter((e) => e?.optionalColumn || !Array.isArray(e?.validUnits) || e.validUnits.includes("blank"))?.length;
|
|
4038
|
+
isValidLength(n, e, i) || s.push(o("incorrectNumberOfUnitHeaderColumns", { expectedLengthMessage: u }));
|
|
4039
|
+
}
|
|
4040
|
+
return n.length === 0 ? s.push(o("incorrectNumberOfDataColumns", {
|
|
4041
|
+
expectedLengthMessage: u,
|
|
4042
|
+
dataRowStartIndex: d
|
|
4043
|
+
})) : n.forEach((e, t) => {
|
|
4044
|
+
isValidLength(e.length, l, c) || s.push(o("incorrectNumberOfDataColumns", {
|
|
4045
|
+
expectedLengthMessage: u,
|
|
4046
|
+
dataRowStartIndex: d + t
|
|
4047
|
+
}));
|
|
4048
|
+
}), s;
|
|
4049
|
+
}, normalize = (e) => e.toUpperCase().replace(/\(.*?\)/g, "").replace(/[^A-Z0-9]/g, "").trim(), defaultFieldNameValidator = ({ value: e, defaultAllowedValues: t }) => {
|
|
4050
|
+
let n = normalize(e);
|
|
4051
|
+
return t?.some((e) => normalize(e).includes(n) || n.includes(normalize(e))) ?? !1;
|
|
4052
|
+
}, defaultUnitsValidator = ({ value: e, defaultAllowedValues: t }) => t?.includes(e) ?? !1, validateHeadings = (e, t, n, r, i, a) => {
|
|
4053
|
+
let o = [];
|
|
4054
|
+
if (r) {
|
|
4055
|
+
let r = n.map((e) => e.fieldName).filter(Boolean);
|
|
4056
|
+
e.forEach((i, s) => {
|
|
4057
|
+
let c = n[s];
|
|
4058
|
+
!c || !c?.fieldName || (n[s]?.fieldNameValidator ?? defaultFieldNameValidator)({
|
|
4059
|
+
value: i,
|
|
4060
|
+
defaultAllowedValues: r,
|
|
4061
|
+
columnIndex: s,
|
|
4062
|
+
fields: e,
|
|
4063
|
+
units: t
|
|
4064
|
+
}) || o.push(a("incorrectFieldName", {
|
|
4065
|
+
i: s + 1,
|
|
4066
|
+
correctName: n[s]?.fieldName || a("notExist"),
|
|
4067
|
+
wrongName: i || a("notApplicable")
|
|
4068
|
+
}));
|
|
4069
|
+
});
|
|
4070
|
+
}
|
|
4071
|
+
if (i) {
|
|
4072
|
+
let i = n.map((e) => e?.validUnits), s = r ? 1 : 0;
|
|
4073
|
+
t.forEach((r, c) => {
|
|
4074
|
+
let l = n[c];
|
|
4075
|
+
if (!l) return;
|
|
4076
|
+
let u = l.unitsValidator ?? defaultUnitsValidator, d = i?.[c];
|
|
4077
|
+
u({
|
|
4078
|
+
value: r,
|
|
4079
|
+
defaultAllowedValues: d,
|
|
4080
|
+
columnIndex: c,
|
|
4081
|
+
fields: e,
|
|
4082
|
+
units: t
|
|
4083
|
+
}) || o.push(a("incorrectUnitRow", {
|
|
4084
|
+
unitRowIndex: s,
|
|
4085
|
+
i: c + 1,
|
|
4086
|
+
wrongUnit: r || a("notApplicable"),
|
|
4087
|
+
correctUnit: d?.join(",") || a("notExist")
|
|
4088
|
+
}));
|
|
4089
|
+
});
|
|
4090
|
+
}
|
|
4091
|
+
return o;
|
|
4092
|
+
}, validateValues = (e, t, n) => {
|
|
4093
|
+
let r = [];
|
|
4094
|
+
return e.forEach((e, i) => {
|
|
4095
|
+
e.forEach((e, a) => {
|
|
4096
|
+
let o = t[a];
|
|
4097
|
+
if (!o || !o.validator) return;
|
|
4098
|
+
let s = o.validator(e);
|
|
4099
|
+
s && typeof s == "string" && r.push(`${s} ${n("rowColumn", {
|
|
4100
|
+
rowIndex: i + 2,
|
|
4101
|
+
columnIndex: a
|
|
4102
|
+
})}`);
|
|
4103
|
+
});
|
|
4104
|
+
}), r;
|
|
4105
|
+
};
|
|
4106
|
+
const validate = (e, t, n, r, i, a, o) => {
|
|
4107
|
+
let s = validateColumnLength(e, t, n, r, i, a, o);
|
|
4108
|
+
return s.length === 0 && (s = s.concat(validateHeadings(e, t, r, i, a, o), validateValues(n, r, o))), {
|
|
4109
|
+
isValid: s.length === 0,
|
|
4110
|
+
errors: s
|
|
4111
|
+
};
|
|
4112
|
+
}, hasHeaders = (e, t, n) => {
|
|
4113
|
+
let r = (e) => e.replace(/,/g, "."), i = e[0]?.some((e) => isNaN(Number(r(e)))) ?? !1, a = e[1]?.some((e) => isNaN(Number(r(e)))) ?? !1, o = e[0]?.some((e) => t.includes(e)) ?? !1, s = e[0]?.some((e) => n.includes(e)) ?? !1, c = e[1]?.some((e) => n.includes(e)) ?? !1, l = e[0]?.some((e) => !isNaN(Number(r(e)))) ?? !1, u = e[1]?.some((e) => !isNaN(Number(r(e)))) ?? !1;
|
|
4114
|
+
return {
|
|
4115
|
+
hasFieldNameHeader: o || i && !s && !l || i && a && !l,
|
|
4116
|
+
hasUnitHeader: s || c || i && a && !s && !l && !u || i && a && !l && !u
|
|
4117
|
+
};
|
|
4118
|
+
}, guessMissingHeaders = (e, { validationRules: t }) => {
|
|
4119
|
+
let n = t?.length === (e?.[0]?.length ?? 0) ? t : t?.filter((e) => !e?.optionalColumn), r = n?.map((e) => e?.fieldName), i = (e) => Array.isArray(e) && e.length ? e[0] : "", a = n?.map((e) => e?.defaultUnit ?? i(e?.validUnits)), o = n?.map((e) => e?.validUnits)?.filter((e) => !!e)?.flat(), { hasFieldNameHeader: s, hasUnitHeader: c } = hasHeaders(e, r, o);
|
|
4120
|
+
return s || e?.unshift(r), c || e?.splice(1, 0, a), {
|
|
4121
|
+
hasFieldNameHeader: s,
|
|
4122
|
+
hasUnitHeader: c
|
|
4123
|
+
};
|
|
4124
|
+
}, depthRound = (e) => Math.round(e * 100) / 100;
|
|
4125
|
+
var joinArray = (e) => e.join(", ").replace(/,\s*$/, ""), basePapaConfig = {
|
|
4126
|
+
skipEmptyLines: !0,
|
|
4127
|
+
transform: (e) => e?.trim(),
|
|
4128
|
+
delimiter: (e) => {
|
|
4129
|
+
let t = e.substring(0, 200), n = (t.match(/\t/g) ?? []).length, r = (t.match(/;/g) ?? []).length;
|
|
4130
|
+
return n === 0 && r === 0 ? "," : n > r ? " " : ";";
|
|
4131
|
+
}
|
|
4132
|
+
}, allowedMimes = [
|
|
4133
|
+
"text/csv",
|
|
4134
|
+
"text/plain",
|
|
4135
|
+
"application/json",
|
|
4136
|
+
"application/vnd.ms-excel"
|
|
4137
|
+
], isAllowedFileType = (e) => allowedMimes.includes(e.type), isFile = (e) => e instanceof File, isJson = (e) => e.trim().startsWith("["), isCustomJson = (e) => {
|
|
4138
|
+
try {
|
|
4139
|
+
return !!JSON.parse(e)?.path;
|
|
4140
|
+
} catch {
|
|
4141
|
+
return !1;
|
|
4142
|
+
}
|
|
4143
|
+
};
|
|
4144
|
+
const readFile$1 = (e) => new Promise((t, n) => {
|
|
4145
|
+
let r = new FileReader();
|
|
4146
|
+
r.onload = () => t(String(r.result)), r.onerror = n, r.readAsText(e);
|
|
4147
|
+
});
|
|
4148
|
+
var parseJson = async (e, t, n) => {
|
|
4149
|
+
try {
|
|
4150
|
+
let r = JSON.parse(e);
|
|
4151
|
+
return onCompleteParse({
|
|
4152
|
+
data: r,
|
|
4153
|
+
errors: []
|
|
4154
|
+
}, t, n);
|
|
4155
|
+
} catch (e) {
|
|
4156
|
+
throw Error(`${n("jsonParseFailed")} ${e.message}`);
|
|
4157
|
+
}
|
|
4158
|
+
}, parseCustomJson = async (e, t, n) => {
|
|
4159
|
+
try {
|
|
4160
|
+
let r = JSON.parse(e).path.map((e) => [
|
|
4161
|
+
depthRound(e.md),
|
|
4162
|
+
depthRound(e.inclination),
|
|
4163
|
+
depthRound(e.gridAzimuth)
|
|
4164
|
+
]);
|
|
4165
|
+
return r.unshift([
|
|
4166
|
+
"m",
|
|
4167
|
+
"deg",
|
|
4168
|
+
"deg"
|
|
4169
|
+
]), onCompleteParse({
|
|
4170
|
+
data: r,
|
|
4171
|
+
errors: []
|
|
4172
|
+
}, t, n);
|
|
4173
|
+
} catch (e) {
|
|
4174
|
+
throw Error(`${n("jsonParseFailed")} ${e.message}`);
|
|
4175
|
+
}
|
|
4176
|
+
};
|
|
4177
|
+
const replaceWithDot = (e) => e.replace(",", "."), replaceDataCommasWithDots = (e) => e.map((e) => e.map((e) => replaceWithDot(e)));
|
|
4178
|
+
var parseDSV = (e, { importLimit: t,...n }, r) => new Promise((i) => {
|
|
4179
|
+
Papa.parse(e, {
|
|
4180
|
+
...basePapaConfig,
|
|
4181
|
+
preview: t,
|
|
4182
|
+
complete: (e) => {
|
|
4183
|
+
let a = onCompleteParse(e, {
|
|
4184
|
+
importLimit: t,
|
|
4185
|
+
...n
|
|
4186
|
+
}, r);
|
|
4187
|
+
a.rows = replaceDataCommasWithDots(a.rows), i(a);
|
|
4188
|
+
}
|
|
4189
|
+
});
|
|
4190
|
+
});
|
|
4191
|
+
const parse = async (e, t, n) => {
|
|
4192
|
+
let r = {
|
|
4193
|
+
isValid: !1,
|
|
4194
|
+
fields: [],
|
|
4195
|
+
units: [],
|
|
4196
|
+
rows: [],
|
|
4197
|
+
errors: []
|
|
4198
|
+
};
|
|
4199
|
+
try {
|
|
4200
|
+
if (isFile(e) && !isAllowedFileType(e)) return r.errors.push(`${n("wrongFileFormatExpectedOneOf")} ${joinArray(Array.from(allowedMimes))}`), r;
|
|
4201
|
+
let i = isFile(e) ? await readFile$1(e) : e;
|
|
4202
|
+
return isJson(i) ? await parseJson(i, t, n) : isCustomJson(i) ? await parseCustomJson(i, t, n) : await parseDSV(e, t, n);
|
|
4203
|
+
} catch (e) {
|
|
4204
|
+
return r.errors.push(e.message), r;
|
|
4205
|
+
}
|
|
4206
|
+
}, unParse = (e, t, n, r) => {
|
|
4207
|
+
let i = r?.delimiter ?? ",", a = [
|
|
4208
|
+
e,
|
|
4209
|
+
t,
|
|
4210
|
+
...n
|
|
4211
|
+
].filter(Boolean);
|
|
4212
|
+
return Papa.unparse(a, {
|
|
4213
|
+
quotes: !1,
|
|
4214
|
+
header: !0,
|
|
4215
|
+
delimiter: i
|
|
4216
|
+
});
|
|
4217
|
+
};
|
|
4218
|
+
var onCompleteParse = (e, t, n) => {
|
|
4219
|
+
let { data: r, errors: i } = e, a = {
|
|
4220
|
+
isValid: !1,
|
|
4221
|
+
fields: [],
|
|
4222
|
+
units: [],
|
|
4223
|
+
rows: [],
|
|
4224
|
+
errors: i.map((e) => e.message)
|
|
4225
|
+
};
|
|
4226
|
+
if (i.length > 0) return a;
|
|
4227
|
+
let { hasFieldNameHeader: o, hasUnitHeader: s } = guessMissingHeaders(r, t);
|
|
4228
|
+
a.fields = r[0].map((e) => e.trim()), a.units = r[1].map((e) => e.trim()).filter(Boolean), a.rows = r.slice(2);
|
|
4229
|
+
let { validationRules: c } = t;
|
|
4230
|
+
if (c.length) {
|
|
4231
|
+
let { isValid: e, errors: t } = validate(a.fields, a.units, a.rows, c, o, s, n);
|
|
4232
|
+
a.errors.push(...t), a.isValid = e && t.length === 0;
|
|
4233
|
+
} else a.isValid = a.errors.length === 0;
|
|
4234
|
+
return a;
|
|
4235
|
+
};
|
|
4236
|
+
const toast = ({ id: e, message: t = {
|
|
4734
4237
|
type: MessageType.INFO,
|
|
4735
4238
|
content: ""
|
|
4736
4239
|
}, autoClose: n = 6e3, onClose: r }) => {
|
|
@@ -4785,13 +4288,13 @@ var toggle_module_default = {
|
|
|
4785
4288
|
noMargin: "_noMargin_1c9wf_110",
|
|
4786
4289
|
helpIconEnabled: "_helpIconEnabled_1c9wf_113"
|
|
4787
4290
|
};
|
|
4788
|
-
const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, small: a = !1, onChange: o, noMargin:
|
|
4789
|
-
let
|
|
4291
|
+
const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, small: a = !1, onChange: o, noMargin: c = !1, testId: l, helpText: u, onClickHelp: d, textTransform: f = TextTransform.CAPITALIZE }) => {
|
|
4292
|
+
let p = useContext(DisabledContext), m = u || d, h = r || p;
|
|
4790
4293
|
return /* @__PURE__ */ jsxs("div", {
|
|
4791
|
-
className: cx(toggle_module_default.toggle,
|
|
4294
|
+
className: cx(toggle_module_default.toggle, h ? toggle_module_default.disabled : null, a ? toggle_module_default.small : null, c ? toggle_module_default.noMargin : null),
|
|
4792
4295
|
style: { display: i },
|
|
4793
4296
|
onClick: (t) => {
|
|
4794
|
-
|
|
4297
|
+
h || (t.target.name = e, t.target.checked = !n, t.target.value = !n, o(t));
|
|
4795
4298
|
},
|
|
4796
4299
|
"data-testid": l,
|
|
4797
4300
|
children: [
|
|
@@ -4799,19 +4302,22 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4799
4302
|
type: InputType.CHECKBOX,
|
|
4800
4303
|
name: e,
|
|
4801
4304
|
value: n?.toString(),
|
|
4802
|
-
disabled:
|
|
4305
|
+
disabled: h,
|
|
4803
4306
|
checked: n,
|
|
4804
4307
|
onChange: () => {}
|
|
4805
4308
|
}),
|
|
4806
|
-
/* @__PURE__ */ jsx("label", {
|
|
4807
|
-
|
|
4309
|
+
/* @__PURE__ */ jsx("label", {
|
|
4310
|
+
style: { textTransform: f },
|
|
4311
|
+
children: t
|
|
4312
|
+
}),
|
|
4313
|
+
m && /* @__PURE__ */ jsx("div", {
|
|
4808
4314
|
className: toggle_module_default.helpIconEnabled,
|
|
4809
4315
|
onClick: d,
|
|
4810
4316
|
children: /* @__PURE__ */ jsx(HelpIcon, { text: u })
|
|
4811
4317
|
})
|
|
4812
4318
|
]
|
|
4813
4319
|
});
|
|
4814
|
-
}, PasteWithReviewModal = ({ config: e, state: t, updateState: n, setModalVisibility: r, onCloseModal: i, readAndParseInput: a, validationRules:
|
|
4320
|
+
}, PasteWithReviewModal = ({ config: e, state: t, updateState: n, setModalVisibility: r, onCloseModal: i, readAndParseInput: a, validationRules: s = [], onCompleteImport: c = () => {}, prevalidationConfig: l, t: u, loading: d, startTransition: f, testId: h }) => {
|
|
4815
4321
|
let { modalVisibility: { reviewPasteModal: g, pasteModalHelpVisible: _, helpModal: v } } = t, { warningMessage: y, actionButtonLabel: b, changeRulesAction: x, checkPrevalidationNeed: S } = l ?? {}, C = useRef(null), [w, T] = useState(!1), [E, D] = useState({
|
|
4816
4322
|
pastedText: "",
|
|
4817
4323
|
parsedResult: {
|
|
@@ -4832,15 +4338,15 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4832
4338
|
let O = useCallback((t) => {
|
|
4833
4339
|
if (t) {
|
|
4834
4340
|
let t = SimplifyAP(N?.rows?.map(([e, t]) => [Number(e), Number(t)]), .001).map(([e, t]) => [e.toString(), t.toString()]), n = e.importLimit ?? 1e4, r = {
|
|
4835
|
-
validationRules:
|
|
4341
|
+
validationRules: s,
|
|
4836
4342
|
importLimit: n
|
|
4837
|
-
}, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2),
|
|
4343
|
+
}, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2), o = unParse(i, a, t, r);
|
|
4838
4344
|
f(() => D({
|
|
4839
4345
|
parsedResult: {
|
|
4840
4346
|
...N,
|
|
4841
4347
|
rows: t
|
|
4842
4348
|
},
|
|
4843
|
-
pastedText:
|
|
4349
|
+
pastedText: o
|
|
4844
4350
|
})), C.current = E;
|
|
4845
4351
|
} else f(() => {
|
|
4846
4352
|
C.current && D(C.current);
|
|
@@ -4849,7 +4355,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4849
4355
|
}, [
|
|
4850
4356
|
E,
|
|
4851
4357
|
n,
|
|
4852
|
-
|
|
4358
|
+
s
|
|
4853
4359
|
]), k = () => {
|
|
4854
4360
|
D({
|
|
4855
4361
|
pastedText: "",
|
|
@@ -4902,7 +4408,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4902
4408
|
]
|
|
4903
4409
|
}),
|
|
4904
4410
|
_ && /* @__PURE__ */ jsx(Help, {
|
|
4905
|
-
validationRules:
|
|
4411
|
+
validationRules: s,
|
|
4906
4412
|
t: u
|
|
4907
4413
|
}),
|
|
4908
4414
|
R ? /* @__PURE__ */ jsx("div", {
|
|
@@ -4935,7 +4441,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4935
4441
|
},
|
|
4936
4442
|
colored: !0,
|
|
4937
4443
|
loading: d,
|
|
4938
|
-
testId: `${
|
|
4444
|
+
testId: `${h}-paste-from-clipboard-button`
|
|
4939
4445
|
})
|
|
4940
4446
|
]
|
|
4941
4447
|
})
|
|
@@ -4967,7 +4473,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4967
4473
|
} })
|
|
4968
4474
|
]
|
|
4969
4475
|
}), /* @__PURE__ */ jsx(Table$1, {
|
|
4970
|
-
validationRules:
|
|
4476
|
+
validationRules: s,
|
|
4971
4477
|
parsedResult: N,
|
|
4972
4478
|
updateState: (e) => D((t) => ({
|
|
4973
4479
|
...t,
|
|
@@ -4994,7 +4500,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4994
4500
|
onClick: () => f(() => j()),
|
|
4995
4501
|
disabled: R || !F,
|
|
4996
4502
|
loading: d,
|
|
4997
|
-
testId: `${
|
|
4503
|
+
testId: `${h}-paste-with-review-modal-button-okay`
|
|
4998
4504
|
}),
|
|
4999
4505
|
/* @__PURE__ */ jsx(Button, {
|
|
5000
4506
|
label: u("cancel"),
|
|
@@ -5040,7 +4546,75 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5040
4546
|
return;
|
|
5041
4547
|
}
|
|
5042
4548
|
return t;
|
|
5043
|
-
}, [t, n]),
|
|
4549
|
+
}, [t, n]), enTranslations = {
|
|
4550
|
+
cancel: "Cancel",
|
|
4551
|
+
chooseFile: "Choose file",
|
|
4552
|
+
copyDecimalComma: "Copy (decimal comma)",
|
|
4553
|
+
copyDecimalDot: "Copy (decimal dot)",
|
|
4554
|
+
copyToClipboard: "Copy to clipboard",
|
|
4555
|
+
copiedToClipboard: "Copied to clipboard",
|
|
4556
|
+
deleteAllRows: "Delete all rows",
|
|
4557
|
+
downloadFile: "Download file",
|
|
4558
|
+
export: "Export",
|
|
4559
|
+
help: "Help",
|
|
4560
|
+
import: "Import",
|
|
4561
|
+
noFileSelected: "No file selected",
|
|
4562
|
+
notApplicable: "N/A",
|
|
4563
|
+
notExist: "not exist",
|
|
4564
|
+
okay: "Okay",
|
|
4565
|
+
uploadCapitalized: "Upload",
|
|
4566
|
+
uploadFile: "Upload file",
|
|
4567
|
+
pasteShortcutHint: "You can also press Ctrl+V or Command+V to paste from clipboard",
|
|
4568
|
+
pasteFromClipboard: "Paste from clipboard",
|
|
4569
|
+
clipboardIsEmpty: "Clipboard is empty",
|
|
4570
|
+
clipboardReadFailed: "Unable to read data from clipboard. Check formatting or try Paste with Review.",
|
|
4571
|
+
clipboardReadNotAllowed: "Your browser did not allow reading the clipboard. Upgrade browser or try Paste with Review.",
|
|
4572
|
+
pasteSuccessful: "Paste successful",
|
|
4573
|
+
pasteWithReview: "Paste with review",
|
|
4574
|
+
pasteWithReviewRoundBrackets: "Paste (with review)",
|
|
4575
|
+
quickPasteFromClipboard: "Quick paste from clipboard",
|
|
4576
|
+
unableToCopyToClipboard: "Unable to copy to clipboard",
|
|
4577
|
+
fileParsingFailed: "Failed to read or validate the file. Please check the format and try again.",
|
|
4578
|
+
importWarning: "Large data detected: More than 500 rows have been imported. You can choose to import all or downsample for better performance.",
|
|
4579
|
+
importLimitExceeded: "Import failed: The data exceeds the 5000-row limit. Please reduce the number of rows and try again.",
|
|
4580
|
+
importingData: "Importing data",
|
|
4581
|
+
incorrectFieldName: "Incorrect field name (row 0, column {{i}}: has name {{wrongName}}, but should be {{correctName}})",
|
|
4582
|
+
incorrectNumberOfDataColumns: "Incorrect number of data columns, expected {{expectedLengthMessage}} columns in row {{dataRowStartIndex}}",
|
|
4583
|
+
incorrectNumberOfFieldNameHeaderColumns: "Incorrect number of field name header columns, expected {{expectedLengthMessage}} columns in row 0",
|
|
4584
|
+
incorrectNumberOfUnitHeaderColumns: "Incorrect number of unit header columns, expected {{expectedLengthMessage}} columns in row 1",
|
|
4585
|
+
incorrectUnitRow: "Incorrect unit (row {{unitRowIndex}}, column {{i}}: has unit [{{wrongUnit}}], but should be [{{correctUnit}}])",
|
|
4586
|
+
jsonParseFailed: "JSON parse failed",
|
|
4587
|
+
pasteYourTableDataHereToImportIt: "Paste your table data here to import it",
|
|
4588
|
+
rowColumn: "(row {{rowIndex}}, column {{columnIndex}})",
|
|
4589
|
+
theValuesCanBeSeparatedByDifferentDelimiters: "The values can be separated by different delimiters",
|
|
4590
|
+
unableToImportPleaseCorrectError: "Unable to import - {{rows}} rows have errors. Please correct input data and try again.",
|
|
4591
|
+
unableToPrepareExportData: "Unable to prepare export – see console for details.",
|
|
4592
|
+
validInputForPaste: "Valid input for paste.",
|
|
4593
|
+
wrongFileFormatExpectedOneOf: "Wrong file format: expected one of",
|
|
4594
|
+
youCanImportDataByPastingOrByMessage: "You can import data by pasting (e.g. from a spreadsheet), or by uploading a text file ( .txt or .csv ).",
|
|
4595
|
+
commasAsDecimals: "Comma is treated as a decimal separator when it is the only separator",
|
|
4596
|
+
deletePastedContent: "Delete pasted content",
|
|
4597
|
+
downsampled: "Downsampled",
|
|
4598
|
+
downsampleSuccess: "Successfully downsampled from {{from}} rows to {{to}} rows.",
|
|
4599
|
+
downsampleTooltip: "Reduces number of data rows (decimation) using the Ramer–Douglas–Peucker algorithm.",
|
|
4600
|
+
extraSeparators: "Two or more separators detected. Kept only last one as decimal separator, please control your import results",
|
|
4601
|
+
noDataPastedYet: "No data pasted yet.",
|
|
4602
|
+
semicolonSeparatedValues: "Semicolon-separated values",
|
|
4603
|
+
tabSeparatedValues: "Tab-separated values",
|
|
4604
|
+
examples: "Examples",
|
|
4605
|
+
smartUpload_description: "Upload image and extract table content using a LLM",
|
|
4606
|
+
smartUpload_smartUpload: "Smart Upload",
|
|
4607
|
+
toUploadOrImportFromClipboardMessage: "To upload or import from clipboard please select your preferred unit in the table header and upload or paste numbers only for Depth, Inc, Azi. Follow example below"
|
|
4608
|
+
}, interpolate = (e, t = {}) => e?.replace(/\{\{(\w+)\}\}/g, (e, n) => t?.[n] === void 0 ? "" : String(t?.[n])), useTranslationMap = (e) => useMemo(() => {
|
|
4609
|
+
let t = Object.keys(enTranslations).reduce((t, n) => {
|
|
4610
|
+
let r = enTranslations?.[n];
|
|
4611
|
+
return t[n] = e?.[n] ?? r, t;
|
|
4612
|
+
}, {});
|
|
4613
|
+
return (e, n) => {
|
|
4614
|
+
let r = t[e];
|
|
4615
|
+
return n ? interpolate(r, n) : r;
|
|
4616
|
+
};
|
|
4617
|
+
}, [e]), normalizeParsedResult = (e) => {
|
|
5044
4618
|
let { rows: t } = e, n = Array(t.length);
|
|
5045
4619
|
for (let e = 0; e < t.length; e++) {
|
|
5046
4620
|
let r = t[e], i = Array(r.length);
|
|
@@ -5052,16 +4626,16 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5052
4626
|
rows: n
|
|
5053
4627
|
};
|
|
5054
4628
|
}, useDataImportActions = ({ config: e, state: t, setState: n, smartUploadConfig: r, startTransition: i }) => {
|
|
5055
|
-
let { exportData: a, beforeExportData:
|
|
4629
|
+
let { exportData: a, beforeExportData: s, importLimit: c = 1e4, validationRules: l = [], translations: u, onImportComplete: d = () => {}, disablePasteSuccessfulToast: f, prevalidationConfig: p, onDeleteRows: m } = e ?? {}, { parsedResult: h } = t, { checkPrevalidationNeed: g } = p ?? {}, _ = useTranslationMap(u), v = useExportData(_, a, s), y = useCallback((e) => {
|
|
5056
4630
|
n((t) => ({
|
|
5057
4631
|
...t,
|
|
5058
4632
|
...e
|
|
5059
4633
|
}));
|
|
5060
|
-
}, [n]),
|
|
4634
|
+
}, [n]), b = useCallback(({ name: e, callback: n } = {}) => {
|
|
5061
4635
|
let r = { ...t.modalVisibility }, i = !e, a = [];
|
|
5062
4636
|
if (i) for (let e of Object.keys(r)) a.push(e), r[e] = !1;
|
|
5063
4637
|
else r?.[e] && (a.push(e), r[e] = !1);
|
|
5064
|
-
a
|
|
4638
|
+
a.length > 0 && y({
|
|
5065
4639
|
modalVisibility: r,
|
|
5066
4640
|
pastedText: "",
|
|
5067
4641
|
parsedResult: {
|
|
@@ -5071,9 +4645,9 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5071
4645
|
units: [],
|
|
5072
4646
|
errors: []
|
|
5073
4647
|
}
|
|
5074
|
-
}), typeof n == "function" && a
|
|
5075
|
-
}, [t.modalVisibility,
|
|
5076
|
-
i(() =>
|
|
4648
|
+
}), typeof n == "function" && a.length > 0 && n();
|
|
4649
|
+
}, [t.modalVisibility, y]), x = useCallback(() => {
|
|
4650
|
+
i(() => y({
|
|
5077
4651
|
pastedText: "",
|
|
5078
4652
|
parsedResult: {
|
|
5079
4653
|
isValid: !1,
|
|
@@ -5082,52 +4656,55 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5082
4656
|
units: [],
|
|
5083
4657
|
errors: []
|
|
5084
4658
|
}
|
|
5085
|
-
})),
|
|
5086
|
-
}, [t.modalVisibility,
|
|
5087
|
-
|
|
4659
|
+
})), m && m?.("all");
|
|
4660
|
+
}, [t.modalVisibility, y]), S = useCallback((e, n) => {
|
|
4661
|
+
y({ modalVisibility: {
|
|
5088
4662
|
...t.modalVisibility,
|
|
5089
4663
|
[e]: n
|
|
5090
4664
|
} });
|
|
5091
|
-
}, [t.modalVisibility,
|
|
4665
|
+
}, [t.modalVisibility, y]), C = useCallback(async (e) => {
|
|
5092
4666
|
let t = {
|
|
5093
|
-
validationRules:
|
|
4667
|
+
validationRules: l,
|
|
5094
4668
|
importLimit: c
|
|
5095
|
-
}, n = await
|
|
5096
|
-
if (
|
|
4669
|
+
}, n = await parse(e, t, _), r = normalizeParsedResult(n);
|
|
4670
|
+
if (g && g(h)) {
|
|
5097
4671
|
let { fields: e, units: n, rows: a, isValid: o } = r, s = unParse(e, n ?? [], a, t);
|
|
5098
|
-
return i(() =>
|
|
4672
|
+
return i(() => y({
|
|
5099
4673
|
pastedText: s,
|
|
5100
|
-
parsedResult:
|
|
4674
|
+
parsedResult: h
|
|
5101
4675
|
})), r;
|
|
5102
4676
|
}
|
|
5103
|
-
return i(() =>
|
|
4677
|
+
return i(() => y({
|
|
5104
4678
|
pastedText: e,
|
|
5105
4679
|
parsedResult: r
|
|
5106
4680
|
})), r;
|
|
5107
4681
|
}, [
|
|
5108
|
-
|
|
4682
|
+
l,
|
|
5109
4683
|
c,
|
|
4684
|
+
_,
|
|
5110
4685
|
g,
|
|
5111
4686
|
h,
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
]), T = useCallback(async (e) => {
|
|
4687
|
+
y
|
|
4688
|
+
]), w = useCallback(async (e) => {
|
|
5115
4689
|
let { fromFile: t, showSuccessToast: n = !0 } = e ?? {}, r;
|
|
5116
4690
|
try {
|
|
5117
4691
|
if (r = t ? await t.text() : await navigator.clipboard.readText(), !r) {
|
|
5118
4692
|
transitionToast({ message: {
|
|
5119
4693
|
type: "Error",
|
|
5120
|
-
content:
|
|
4694
|
+
content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed")
|
|
5121
4695
|
} }, i);
|
|
5122
4696
|
return;
|
|
5123
4697
|
}
|
|
5124
|
-
let e = await
|
|
4698
|
+
let e = await parse(r, {
|
|
4699
|
+
validationRules: l,
|
|
4700
|
+
importLimit: c
|
|
4701
|
+
}, _), a = normalizeParsedResult(e);
|
|
5125
4702
|
return a?.isValid || transitionToast({ message: {
|
|
5126
4703
|
type: "Error",
|
|
5127
|
-
content:
|
|
4704
|
+
content: _("clipboardReadFailed")
|
|
5128
4705
|
} }, i), n && transitionToast({ message: {
|
|
5129
4706
|
type: "Success",
|
|
5130
|
-
content:
|
|
4707
|
+
content: _("pasteSuccessful")
|
|
5131
4708
|
} }, i), {
|
|
5132
4709
|
pastedText: r,
|
|
5133
4710
|
parsedResult: a
|
|
@@ -5135,78 +4712,78 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5135
4712
|
} catch (e) {
|
|
5136
4713
|
transitionToast({ message: {
|
|
5137
4714
|
type: "Error",
|
|
5138
|
-
content:
|
|
4715
|
+
content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed"),
|
|
5139
4716
|
details: e.message
|
|
5140
4717
|
} }, i);
|
|
5141
4718
|
return;
|
|
5142
4719
|
}
|
|
5143
|
-
}, [
|
|
4720
|
+
}, [l, c]), T = useCallback(async (e) => {
|
|
5144
4721
|
let t = e?.target?.files?.[0];
|
|
5145
4722
|
if (!t) return;
|
|
5146
|
-
let n = await t.text(), r = await
|
|
5147
|
-
r.isValid ? (
|
|
4723
|
+
let n = await t.text(), r = await C(n);
|
|
4724
|
+
r.isValid ? (f || transitionToast({ message: {
|
|
5148
4725
|
type: "Success",
|
|
5149
|
-
content:
|
|
5150
|
-
} }, i), i(() =>
|
|
4726
|
+
content: _("pasteSuccessful")
|
|
4727
|
+
} }, i), i(() => d(r))) : transitionToast({ message: {
|
|
5151
4728
|
type: "Error",
|
|
5152
|
-
content:
|
|
4729
|
+
content: _("fileParsingFailed")
|
|
5153
4730
|
} }, i);
|
|
5154
4731
|
}, [
|
|
5155
|
-
|
|
4732
|
+
l,
|
|
5156
4733
|
c,
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
]),
|
|
4734
|
+
y,
|
|
4735
|
+
d
|
|
4736
|
+
]), E = useCallback(async (e = !0) => {
|
|
5160
4737
|
try {
|
|
5161
4738
|
let t = await navigator.clipboard.readText();
|
|
5162
4739
|
if (!t) {
|
|
5163
4740
|
transitionToast({ message: {
|
|
5164
4741
|
type: "Error",
|
|
5165
|
-
content:
|
|
4742
|
+
content: _("clipboardIsEmpty")
|
|
5166
4743
|
} }, i);
|
|
5167
4744
|
return;
|
|
5168
4745
|
}
|
|
5169
|
-
let n = await
|
|
4746
|
+
let n = await C(t);
|
|
5170
4747
|
if (!n.isValid) {
|
|
5171
4748
|
transitionToast({ message: {
|
|
5172
4749
|
type: "Error",
|
|
5173
|
-
content:
|
|
4750
|
+
content: _("clipboardReadFailed")
|
|
5174
4751
|
} }, i);
|
|
5175
4752
|
return;
|
|
5176
4753
|
}
|
|
5177
|
-
|
|
4754
|
+
f || transitionToast({ message: {
|
|
5178
4755
|
type: "Success",
|
|
5179
|
-
content:
|
|
5180
|
-
} }, i), e && i(() =>
|
|
4756
|
+
content: _("pasteSuccessful")
|
|
4757
|
+
} }, i), e && i(() => d(n));
|
|
5181
4758
|
} catch {
|
|
5182
4759
|
transitionToast({ message: {
|
|
5183
4760
|
type: "Error",
|
|
5184
|
-
content:
|
|
4761
|
+
content: _("clipboardReadNotAllowed")
|
|
5185
4762
|
} }, i);
|
|
5186
4763
|
}
|
|
5187
4764
|
}, [
|
|
5188
|
-
|
|
4765
|
+
l,
|
|
5189
4766
|
c,
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
]),
|
|
5194
|
-
let t = await
|
|
4767
|
+
_,
|
|
4768
|
+
y,
|
|
4769
|
+
d
|
|
4770
|
+
]), D = useCallback(async (e) => {
|
|
4771
|
+
let t = await v();
|
|
5195
4772
|
if (!t) return;
|
|
5196
|
-
let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r ?? []).map((e) => e?.length ? e : placeholder$1).slice(0, n
|
|
4773
|
+
let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r ?? []).map((e) => e?.length ? e : placeholder$1).slice(0, n.length), s = (e, t) => t === "comma" ? e.replace(/\./g, ",") : e, c = a.map((t) => t.map((t) => isNullOrUndefined(t) ? "" : s(t.toString(), e))), l = unParse(n, o, c, { delimiter: " " });
|
|
5197
4774
|
try {
|
|
5198
4775
|
await navigator.clipboard.writeText(l), transitionToast({ message: {
|
|
5199
4776
|
type: "Success",
|
|
5200
|
-
content:
|
|
4777
|
+
content: _("copiedToClipboard")
|
|
5201
4778
|
} }, i);
|
|
5202
4779
|
} catch (e) {
|
|
5203
4780
|
transitionToast({ message: {
|
|
5204
4781
|
type: "Error",
|
|
5205
|
-
content:
|
|
4782
|
+
content: _("unableToCopyToClipboard"),
|
|
5206
4783
|
details: e.message
|
|
5207
4784
|
} }, i);
|
|
5208
4785
|
}
|
|
5209
|
-
}, [
|
|
4786
|
+
}, [v, _]), O = useCallback((e) => {
|
|
5210
4787
|
if (!e || e.errorMessage) {
|
|
5211
4788
|
transitionToast({ message: {
|
|
5212
4789
|
type: "Error",
|
|
@@ -5221,24 +4798,24 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5221
4798
|
rows: n.map((e) => Object.values(e)),
|
|
5222
4799
|
errors: []
|
|
5223
4800
|
};
|
|
5224
|
-
i(() =>
|
|
4801
|
+
i(() => y({ parsedResult: a })), i(() => d(a));
|
|
5225
4802
|
let { onComplete: o } = r ?? {};
|
|
5226
|
-
typeof o == "function" && o(a),
|
|
4803
|
+
typeof o == "function" && o(a), b();
|
|
5227
4804
|
}, [
|
|
5228
|
-
|
|
5229
|
-
|
|
4805
|
+
y,
|
|
4806
|
+
d,
|
|
5230
4807
|
r
|
|
5231
4808
|
]);
|
|
5232
4809
|
return {
|
|
5233
|
-
updateState:
|
|
5234
|
-
closeModals:
|
|
5235
|
-
setModalVisibility:
|
|
5236
|
-
readAndParseInput:
|
|
5237
|
-
onFileChange:
|
|
5238
|
-
onClickQuickPasteFromClipBoard:
|
|
5239
|
-
onClickCopyClipboard:
|
|
5240
|
-
onSmartUploadResult:
|
|
5241
|
-
deleteAllRows:
|
|
4810
|
+
updateState: y,
|
|
4811
|
+
closeModals: b,
|
|
4812
|
+
setModalVisibility: S,
|
|
4813
|
+
readAndParseInput: w,
|
|
4814
|
+
onFileChange: T,
|
|
4815
|
+
onClickQuickPasteFromClipBoard: E,
|
|
4816
|
+
onClickCopyClipboard: D,
|
|
4817
|
+
onSmartUploadResult: O,
|
|
4818
|
+
deleteAllRows: x
|
|
5242
4819
|
};
|
|
5243
4820
|
}, onClickDownLoad = (e, t) => {
|
|
5244
4821
|
let { fields: n, rows: r } = e, i = e.units?.map((e) => e || "blank") ?? [], a = unParse(n, i, r, { delimiter: " " }), o = new Blob([a], { type: "text/plain" }), s = document.createElement("a");
|
|
@@ -5274,167 +4851,165 @@ var initialState = {
|
|
|
5274
4851
|
helpModal: !1
|
|
5275
4852
|
}
|
|
5276
4853
|
};
|
|
5277
|
-
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n
|
|
5278
|
-
let { exportData:
|
|
5279
|
-
useRegisterValidationRules(r ?? b, s);
|
|
5280
|
-
let [x, S] = useState(initialState), { modalVisibility: { smartUploadModal: C = !1, reviewPasteModal: w = !1, helpModal: T = !1 } } = x, { enabled: E, prompt: D = "", onClose: O, onError: k, service: A = () => Promise.resolve() } = t ?? {}, j = useTranslationMap(l), M = useExportData(j, i, a), [N, P] = useTransition(), { readAndParseInput: F, updateState: I, closeModals: L, setModalVisibility: R, onFileChange: z, onClickQuickPasteFromClipBoard: B, onClickCopyClipboard: V, onSmartUploadResult: H, deleteAllRows: U } = useDataImportActions({
|
|
4854
|
+
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
|
|
4855
|
+
let { exportData: r, beforeExportData: i, prevalidationConfig: a, validationRules: o, title: s, translations: c, textOnly: l = !1, showImportOptions: u = !0, copyFromClipBoard: d = !0, showDeleteOptions: f = !0, showHelpOption: p = !0, modals: g = [], dynamicOptions: _, onImportComplete: v } = e ?? {}, [y, b] = useState(initialState), { modalVisibility: { smartUploadModal: x = !1, reviewPasteModal: S = !1, helpModal: C = !1 } } = y, { enabled: w, prompt: T = "", onClose: E, onError: D, service: O = () => Promise.resolve() } = t ?? {}, k = useTranslationMap(c), A = useExportData(k, r, i), [j, M] = useTransition(), { readAndParseInput: N, updateState: P, closeModals: F, setModalVisibility: I, onFileChange: L, onClickQuickPasteFromClipBoard: R, onClickCopyClipboard: z, onSmartUploadResult: B, deleteAllRows: V } = useDataImportActions({
|
|
5281
4856
|
config: e,
|
|
5282
|
-
state:
|
|
5283
|
-
setState:
|
|
4857
|
+
state: y,
|
|
4858
|
+
setState: b,
|
|
5284
4859
|
smartUploadConfig: t,
|
|
5285
|
-
startTransition:
|
|
4860
|
+
startTransition: M
|
|
5286
4861
|
}) ?? {};
|
|
5287
|
-
useKeyboardEvent("Escape", () =>
|
|
5288
|
-
let
|
|
4862
|
+
useKeyboardEvent("Escape", () => F());
|
|
4863
|
+
let H = u ? [
|
|
5289
4864
|
{
|
|
5290
4865
|
type: "Option",
|
|
5291
|
-
label:
|
|
4866
|
+
label: k("uploadFile"),
|
|
5292
4867
|
upload: !0,
|
|
5293
4868
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5294
|
-
onChange:
|
|
4869
|
+
onChange: L,
|
|
5295
4870
|
testId: `${n}-option-upload-file`
|
|
5296
4871
|
},
|
|
5297
|
-
...
|
|
4872
|
+
...d ? [{
|
|
5298
4873
|
type: "Option",
|
|
5299
|
-
label:
|
|
5300
|
-
onClick:
|
|
4874
|
+
label: k("quickPasteFromClipboard"),
|
|
4875
|
+
onClick: R,
|
|
5301
4876
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
5302
4877
|
}] : [],
|
|
5303
|
-
...
|
|
4878
|
+
...d ? [{
|
|
5304
4879
|
type: "Option",
|
|
5305
|
-
label:
|
|
5306
|
-
onClick: () =>
|
|
4880
|
+
label: k("pasteWithReview"),
|
|
4881
|
+
onClick: () => I("reviewPasteModal", !S),
|
|
5307
4882
|
testId: `${n}-paste-with-review`
|
|
5308
4883
|
}] : [],
|
|
5309
|
-
...
|
|
4884
|
+
...T && w && t ? [{
|
|
5310
4885
|
type: "Option",
|
|
5311
|
-
label:
|
|
5312
|
-
onClick: () =>
|
|
4886
|
+
label: k("smartUpload_smartUpload"),
|
|
4887
|
+
onClick: () => I("smartUploadModal", !x),
|
|
5313
4888
|
testId: `${n}-smart-upload`
|
|
5314
4889
|
}] : [],
|
|
5315
|
-
...applyModalHandlers(
|
|
5316
|
-
] : [],
|
|
4890
|
+
...applyModalHandlers(_?.importOptions ?? [], y, I)
|
|
4891
|
+
] : [], U = [
|
|
5317
4892
|
{
|
|
5318
4893
|
type: "Option",
|
|
5319
|
-
label:
|
|
4894
|
+
label: k("downloadFile"),
|
|
5320
4895
|
onClick: async () => {
|
|
5321
|
-
let e = await
|
|
5322
|
-
e && e && onClickDownLoad(e,
|
|
4896
|
+
let e = await A();
|
|
4897
|
+
e && e && onClickDownLoad(e, s);
|
|
5323
4898
|
}
|
|
5324
4899
|
},
|
|
5325
|
-
...
|
|
4900
|
+
...l ? [{
|
|
5326
4901
|
type: "Option",
|
|
5327
|
-
label:
|
|
5328
|
-
onClick: () =>
|
|
4902
|
+
label: k("copyToClipboard"),
|
|
4903
|
+
onClick: () => z("dot")
|
|
5329
4904
|
}] : [{
|
|
5330
4905
|
type: "Menu",
|
|
5331
4906
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
5332
4907
|
menu: {
|
|
5333
4908
|
trigger: "Text",
|
|
5334
|
-
label:
|
|
4909
|
+
label: k("copyToClipboard"),
|
|
5335
4910
|
sections: [{
|
|
5336
4911
|
type: "Option",
|
|
5337
|
-
label:
|
|
5338
|
-
onClick: () =>
|
|
4912
|
+
label: k("copyDecimalDot"),
|
|
4913
|
+
onClick: () => z("dot"),
|
|
5339
4914
|
testId: `${n}-option-copy-decimal-dot`
|
|
5340
4915
|
}, {
|
|
5341
4916
|
type: "Option",
|
|
5342
|
-
label:
|
|
5343
|
-
onClick: () =>
|
|
4917
|
+
label: k("copyDecimalComma"),
|
|
4918
|
+
onClick: () => z("comma")
|
|
5344
4919
|
}]
|
|
5345
4920
|
}
|
|
5346
4921
|
}],
|
|
5347
|
-
...applyModalHandlers(
|
|
5348
|
-
],
|
|
4922
|
+
...applyModalHandlers(_?.exportOptions ?? [], y, I)
|
|
4923
|
+
], W = f ? [{
|
|
5349
4924
|
type: "Option",
|
|
5350
|
-
label:
|
|
5351
|
-
onClick: () =>
|
|
4925
|
+
label: k("deleteAllRows"),
|
|
4926
|
+
onClick: () => V(),
|
|
5352
4927
|
testId: `${n}-delete-all-rows`
|
|
5353
|
-
}, ...applyModalHandlers(
|
|
4928
|
+
}, ...applyModalHandlers(_?.deleteOptions ?? [], y, I)] : [], G = p ? [
|
|
5354
4929
|
{ type: "Divider" },
|
|
5355
4930
|
{
|
|
5356
4931
|
type: "Option",
|
|
5357
|
-
label:
|
|
5358
|
-
onClick: () =>
|
|
4932
|
+
label: k("help"),
|
|
4933
|
+
onClick: () => I("helpModal", !C)
|
|
5359
4934
|
},
|
|
5360
|
-
...applyModalHandlers(
|
|
5361
|
-
] : [],
|
|
5362
|
-
...
|
|
5363
|
-
section: [...
|
|
4935
|
+
...applyModalHandlers(_?.helpOptions ?? [], y, I)
|
|
4936
|
+
] : [], K = [
|
|
4937
|
+
...H.length ? [{
|
|
4938
|
+
section: [...H, ...G],
|
|
5364
4939
|
name: "import-options",
|
|
5365
4940
|
iconName: "upload",
|
|
5366
|
-
tooltip:
|
|
4941
|
+
tooltip: k("import")
|
|
5367
4942
|
}] : [],
|
|
5368
|
-
...
|
|
5369
|
-
section:
|
|
4943
|
+
...U.length ? [{
|
|
4944
|
+
section: U,
|
|
5370
4945
|
name: "export-options",
|
|
5371
4946
|
iconName: "download",
|
|
5372
|
-
tooltip:
|
|
4947
|
+
tooltip: k("export")
|
|
5373
4948
|
}] : [],
|
|
5374
|
-
...
|
|
5375
|
-
section:
|
|
4949
|
+
...W.length ? [{
|
|
4950
|
+
section: W,
|
|
5376
4951
|
name: "delete-options",
|
|
5377
4952
|
iconName: "delete",
|
|
5378
|
-
tooltip:
|
|
4953
|
+
tooltip: k("deleteAllRows")
|
|
5379
4954
|
}] : []
|
|
5380
4955
|
];
|
|
5381
4956
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
5382
|
-
|
|
4957
|
+
j && /* @__PURE__ */ jsx(Spinner, {
|
|
5383
4958
|
small: !0,
|
|
5384
4959
|
dark: !0
|
|
5385
4960
|
}),
|
|
5386
|
-
|
|
4961
|
+
K.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
5387
4962
|
sections: e.section,
|
|
5388
4963
|
iconName: e.iconName,
|
|
5389
4964
|
tooltip: e.tooltip,
|
|
5390
4965
|
testId: `data-${e?.name}-menu`
|
|
5391
4966
|
}, t)),
|
|
5392
|
-
|
|
4967
|
+
S && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
5393
4968
|
config: e,
|
|
5394
|
-
state:
|
|
5395
|
-
updateState:
|
|
5396
|
-
setModalVisibility:
|
|
5397
|
-
readAndParseInput:
|
|
5398
|
-
onCloseModal:
|
|
5399
|
-
validationRules:
|
|
5400
|
-
onCompleteImport:
|
|
5401
|
-
prevalidationConfig:
|
|
5402
|
-
t:
|
|
5403
|
-
loading:
|
|
5404
|
-
startTransition:
|
|
4969
|
+
state: y,
|
|
4970
|
+
updateState: P,
|
|
4971
|
+
setModalVisibility: I,
|
|
4972
|
+
readAndParseInput: N,
|
|
4973
|
+
onCloseModal: F,
|
|
4974
|
+
validationRules: o,
|
|
4975
|
+
onCompleteImport: v,
|
|
4976
|
+
prevalidationConfig: a,
|
|
4977
|
+
t: k,
|
|
4978
|
+
loading: j,
|
|
4979
|
+
startTransition: M,
|
|
5405
4980
|
testId: n
|
|
5406
4981
|
}),
|
|
5407
|
-
|
|
5408
|
-
visible: T,
|
|
5409
|
-
setModalVisibility: R,
|
|
5410
|
-
validationRules: s,
|
|
5411
|
-
t: j
|
|
5412
|
-
}),
|
|
5413
|
-
E && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
4982
|
+
C && /* @__PURE__ */ jsx(HelpModal, {
|
|
5414
4983
|
visible: C,
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
4984
|
+
setModalVisibility: I,
|
|
4985
|
+
validationRules: o,
|
|
4986
|
+
t: k
|
|
4987
|
+
}),
|
|
4988
|
+
w && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
4989
|
+
visible: x,
|
|
4990
|
+
prompt: T,
|
|
4991
|
+
onUpload: O,
|
|
4992
|
+
onCloseModal: () => F({ callback: E }),
|
|
4993
|
+
onComplete: B,
|
|
4994
|
+
onError: D,
|
|
4995
|
+
heading: k("smartUpload_smartUpload"),
|
|
4996
|
+
dialogText: k("smartUpload_description"),
|
|
4997
|
+
fileInputText: k("chooseFile"),
|
|
4998
|
+
fileInputPlaceholder: k("noFileSelected"),
|
|
4999
|
+
uploadText: k("uploadCapitalized"),
|
|
5000
|
+
cancelText: k("cancel"),
|
|
5426
5001
|
testId: n
|
|
5427
5002
|
}),
|
|
5428
5003
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5429
|
-
modals:
|
|
5430
|
-
modalVisibility:
|
|
5431
|
-
onCloseModal:
|
|
5004
|
+
modals: g,
|
|
5005
|
+
modalVisibility: y?.modalVisibility,
|
|
5006
|
+
onCloseModal: F,
|
|
5432
5007
|
testId: n
|
|
5433
5008
|
})
|
|
5434
5009
|
] });
|
|
5435
5010
|
}, FileButton = ({ file: e, accept: t, multi: n, name: r, disabled: i, onChange: a = noop,...o }) => {
|
|
5436
|
-
let
|
|
5437
|
-
i ||
|
|
5011
|
+
let c = useContext(DisabledContext), l = useRef(null), u = () => {
|
|
5012
|
+
i || c || l.current?.click();
|
|
5438
5013
|
}, d = (e) => {
|
|
5439
5014
|
let t = n ? e.target.files : e.target.files?.[0], r = {
|
|
5440
5015
|
...e,
|
|
@@ -5713,15 +5288,15 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5713
5288
|
},
|
|
5714
5289
|
children: e.content
|
|
5715
5290
|
}) : null, ListSubheading = forwardRef(({ item: e, index: t }, n) => {
|
|
5716
|
-
let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick:
|
|
5291
|
+
let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick: c, title: l, name: u, icon: d, testId: f } = e;
|
|
5717
5292
|
return /* @__PURE__ */ jsx("div", {
|
|
5718
5293
|
ref: (e) => {
|
|
5719
5294
|
n && "current" in n && Array.isArray(n.current) && t !== void 0 && (n.current[t] = e);
|
|
5720
5295
|
},
|
|
5721
5296
|
"data-testid": f ?? null,
|
|
5722
|
-
className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "",
|
|
5297
|
+
className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "", c ? list_module_default.action : ""),
|
|
5723
5298
|
onClick: (e) => {
|
|
5724
|
-
|
|
5299
|
+
c && c(e);
|
|
5725
5300
|
},
|
|
5726
5301
|
title: l,
|
|
5727
5302
|
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -5746,7 +5321,7 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5746
5321
|
}) })
|
|
5747
5322
|
});
|
|
5748
5323
|
}), ListRow = forwardRef(({ item: e, index: t, expanding: n, invokeEditOnRowClick: r, draggable: i }, a) => {
|
|
5749
|
-
let o = useContext(DisabledContext),
|
|
5324
|
+
let o = useContext(DisabledContext), c = (e, t, s, c, l, u) => {
|
|
5750
5325
|
let d = t.actions && t.actions.find((e) => e.label && String(e.label)?.toLowerCase() === "edit"), f = !!(d || t.url || t.onClick), p = t.level && t.level > 1 ? (t.level - 1) * 20 : 0, m = t.component || "a";
|
|
5751
5326
|
return /* @__PURE__ */ jsx(m, {
|
|
5752
5327
|
href: t.url,
|
|
@@ -5800,16 +5375,16 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5800
5375
|
item: e,
|
|
5801
5376
|
index: t
|
|
5802
5377
|
}, t) : i ? ((e, t) => {
|
|
5803
|
-
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging:
|
|
5378
|
+
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging: s } = useSortable({
|
|
5804
5379
|
id: e.toString(),
|
|
5805
5380
|
animateLayoutChanges: () => !1
|
|
5806
5381
|
}), l = {
|
|
5807
5382
|
transform: CSS.Translate.toString(a),
|
|
5808
5383
|
transition: o,
|
|
5809
|
-
opacity:
|
|
5384
|
+
opacity: s ? 0 : 1
|
|
5810
5385
|
};
|
|
5811
|
-
return
|
|
5812
|
-
})(t, e) :
|
|
5386
|
+
return c(e, t, l, n, r, i);
|
|
5387
|
+
})(t, e) : c(t, e);
|
|
5813
5388
|
}), ListDragWrapper = ({ children: e, draggable: t, list: n, onListReorder: r }) => {
|
|
5814
5389
|
let [i, a] = useState(null), o = (e) => {
|
|
5815
5390
|
a(e.active.id);
|
|
@@ -5842,9 +5417,9 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5842
5417
|
}), document.body)]
|
|
5843
5418
|
}) : e;
|
|
5844
5419
|
}, ListVirtualScrollWrapper = ({ items: e, scrollDetails: t, children: n }) => {
|
|
5845
|
-
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll:
|
|
5420
|
+
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll: s } = t, l = useRef(null), u = useVirtualizer({
|
|
5846
5421
|
count: e.length,
|
|
5847
|
-
getScrollElement: () =>
|
|
5422
|
+
getScrollElement: () => l.current,
|
|
5848
5423
|
estimateSize: useCallback(() => {
|
|
5849
5424
|
let t = 37;
|
|
5850
5425
|
if (e.length > 0) {
|
|
@@ -5866,8 +5441,8 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5866
5441
|
f(t);
|
|
5867
5442
|
}
|
|
5868
5443
|
}, [a]), /* @__PURE__ */ jsx("div", {
|
|
5869
|
-
className: cx(list_module_default.listContent, r ||
|
|
5870
|
-
ref:
|
|
5444
|
+
className: cx(list_module_default.listContent, r || s ? list_module_default.scrollableList : "", i ? list_module_default.hideScrollbar : ""),
|
|
5445
|
+
ref: l,
|
|
5871
5446
|
children: /* @__PURE__ */ jsx("div", {
|
|
5872
5447
|
className: list_module_default.virtualRows,
|
|
5873
5448
|
style: { height: `${u.getTotalSize()}px` },
|
|
@@ -6111,8 +5686,8 @@ var radio_button_module_default = {
|
|
|
6111
5686
|
isInTable: "_isInTable_1fbik_106",
|
|
6112
5687
|
helpIconEnabled: "_helpIconEnabled_1fbik_111"
|
|
6113
5688
|
};
|
|
6114
|
-
const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1, small: a = !1, onChange: o, noMargin: s = !1, testId: c, helpText: l, onClickHelp: u }) => {
|
|
6115
|
-
let
|
|
5689
|
+
const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1, small: a = !1, onChange: o, noMargin: s = !1, testId: c, helpText: l, onClickHelp: u, textTransform: d = TextTransform.CAPITALIZE }) => {
|
|
5690
|
+
let f = l || u;
|
|
6116
5691
|
return /* @__PURE__ */ jsxs("div", {
|
|
6117
5692
|
className: cx(radio_button_module_default.radio, i ? radio_button_module_default.disabled : null, a ? radio_button_module_default.small : null, s ? radio_button_module_default.noMargin : null),
|
|
6118
5693
|
onClick: o,
|
|
@@ -6128,21 +5703,22 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
6128
5703
|
/* @__PURE__ */ jsx("label", {
|
|
6129
5704
|
"data-name": e,
|
|
6130
5705
|
"data-value": n,
|
|
5706
|
+
style: { textTransform: d },
|
|
6131
5707
|
children: t
|
|
6132
5708
|
}),
|
|
6133
|
-
|
|
5709
|
+
f && /* @__PURE__ */ jsx("div", {
|
|
6134
5710
|
className: radio_button_module_default.helpIconEnabled,
|
|
6135
5711
|
onClick: u,
|
|
6136
5712
|
children: /* @__PURE__ */ jsx(HelpIcon, { text: l })
|
|
6137
5713
|
})
|
|
6138
5714
|
]
|
|
6139
5715
|
});
|
|
6140
|
-
}, RadioButton = ({ name: e, label: t, options: n, value: r, onChange: i, disabled: a = !1, small: o = !1, noMargin:
|
|
6141
|
-
let m = useContext(DisabledContext), h = f !== void 0, { simpleInputs:
|
|
5716
|
+
}, RadioButton = ({ name: e, label: t, options: n, value: r, onChange: i, disabled: a = !1, small: o = !1, noMargin: c = !1, onClick: l = () => {}, inline: u = !1, mainLabel: d = "", radioButtonsData: f, classForContainer: p = "grouped fields" }) => {
|
|
5717
|
+
let m = useContext(DisabledContext), h = f !== void 0, { simpleInputs: _, options: v, selectedOptions: y } = h ? {
|
|
6142
5718
|
simpleInputs: !1,
|
|
6143
5719
|
options: f,
|
|
6144
5720
|
selectedOptions: void 0
|
|
6145
|
-
} : standardizeInputs(n, r), b = h || y == null ? void 0 :
|
|
5721
|
+
} : standardizeInputs(n, r), b = h || y == null ? void 0 : _ ? y : y.value, x = h ? d : t;
|
|
6146
5722
|
return /* @__PURE__ */ jsxs("div", {
|
|
6147
5723
|
className: cx(radio_button_module_default.wrapper, u ? radio_button_module_default.inline : null, p === "inline fields" ? radio_button_module_default.inline : null),
|
|
6148
5724
|
children: [d && /* @__PURE__ */ jsx("label", {
|
|
@@ -6157,13 +5733,14 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
6157
5733
|
selected: r,
|
|
6158
5734
|
disabled: a || t.disabled || m,
|
|
6159
5735
|
small: o,
|
|
6160
|
-
noMargin:
|
|
5736
|
+
noMargin: c,
|
|
6161
5737
|
onChange: t.disabled ? void 0 : (n) => {
|
|
6162
5738
|
h ? l(n.target) : (n.target.name = e, n.target.value = t.value.toString(), n.target.label = t.label.toString(), i && i(n));
|
|
6163
5739
|
},
|
|
6164
5740
|
testId: t.testId,
|
|
6165
5741
|
helpText: t.helpText,
|
|
6166
|
-
onClickHelp: t.onClickHelp
|
|
5742
|
+
onClickHelp: t.onClickHelp,
|
|
5743
|
+
textTransform: t.textTransform
|
|
6167
5744
|
}, n);
|
|
6168
5745
|
})]
|
|
6169
5746
|
});
|
|
@@ -6233,7 +5810,7 @@ var rich_text_input_module_default = {
|
|
|
6233
5810
|
richTextInput: "_richTextInput_1fb4l_77"
|
|
6234
5811
|
};
|
|
6235
5812
|
const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
|
|
6236
|
-
let o = useContext(DisabledContext),
|
|
5813
|
+
let o = useContext(DisabledContext), c = r || o, { manager: u, state: d, setState: f, getContext: p } = useRemirror({
|
|
6237
5814
|
extensions: () => [
|
|
6238
5815
|
new BoldExtension({}),
|
|
6239
5816
|
new BulletListExtension({}),
|
|
@@ -6250,31 +5827,31 @@ const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disab
|
|
|
6250
5827
|
return useImperativeHandle(a, () => p(), [p]), /* @__PURE__ */ jsx("div", {
|
|
6251
5828
|
className: rich_text_input_module_default.richTextInput,
|
|
6252
5829
|
children: /* @__PURE__ */ jsxs(Remirror, {
|
|
6253
|
-
manager:
|
|
5830
|
+
manager: u,
|
|
6254
5831
|
state: d,
|
|
6255
5832
|
placeholder: e,
|
|
6256
5833
|
onChange: ({ helpers: e, state: n }) => {
|
|
6257
5834
|
let r = e.getMarkdown(n);
|
|
6258
5835
|
t && t(r), f(n);
|
|
6259
5836
|
},
|
|
6260
|
-
editable: !
|
|
5837
|
+
editable: !c,
|
|
6261
5838
|
children: [/* @__PURE__ */ jsx(RichTextToolbar, {
|
|
6262
|
-
disabled:
|
|
5839
|
+
disabled: c,
|
|
6263
5840
|
toolbarComponent: i
|
|
6264
5841
|
}), /* @__PURE__ */ jsx(EditorComponent, {})]
|
|
6265
5842
|
})
|
|
6266
5843
|
});
|
|
6267
5844
|
});
|
|
6268
5845
|
var row_module_default = { row: "_row_n16je_1" };
|
|
6269
|
-
const Row = ({ alignItems: t = "initial", justifyContent: n = "initial", children: r = null, flex:
|
|
5846
|
+
const Row = ({ alignItems: t = "initial", justifyContent: n = "initial", children: r = null, flex: a = !1, height: o = "auto", marginBottom: s = "0", marginTop: c = "0", spacing: l = "var(--padding)", wrap: u = !1, testId: d = null }) => {
|
|
6270
5847
|
let f = typeof l == "number" ? `${l}px` : l, p = (r === null || r === !1 ? [] : Array.isArray(r) ? r.filter((e) => isValidElement(e)) : [r]).map((t, n) => /* @__PURE__ */ jsx(React.Fragment, { children: React.cloneElement(t, { spacing: f }) }, n));
|
|
6271
5848
|
return /* @__PURE__ */ jsx("div", {
|
|
6272
5849
|
className: cx(row_module_default.row),
|
|
6273
5850
|
style: {
|
|
6274
5851
|
alignItems: t,
|
|
6275
5852
|
justifyContent: n,
|
|
6276
|
-
flexGrow:
|
|
6277
|
-
flexShrink:
|
|
5853
|
+
flexGrow: a ? 1 : 0,
|
|
5854
|
+
flexShrink: a ? 1 : 0,
|
|
6278
5855
|
flexWrap: u ? "wrap" : "nowrap",
|
|
6279
5856
|
height: o,
|
|
6280
5857
|
marginLeft: `calc(${f} * -0.5)`,
|
|
@@ -6424,7 +6001,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6424
6001
|
}, Content$1 = ({ children: e, activeTabIndex: t, contentPadding: n }) => Array.isArray(e) ? /* @__PURE__ */ jsx("div", {
|
|
6425
6002
|
className: cx(n ? tabs_module_default.contentPadding : ""),
|
|
6426
6003
|
children: e.map((e, n) => t === n && e)
|
|
6427
|
-
}) : null, Tabs = ({ name: e = void 0, options: t = null, children: n = null, value: r = void 0, onChange: i = noop, padding: a = !1, margin: o = !0, contentPadding:
|
|
6004
|
+
}) : null, Tabs = ({ name: e = void 0, options: t = null, children: n = null, value: r = void 0, onChange: i = noop, padding: a = !1, margin: o = !0, contentPadding: c = !0, onChangeTab: l, activeTabIndex: u = void 0, tabs: d = void 0, testId: f }) => {
|
|
6428
6005
|
let p = useContext(DisabledContext), m = l !== void 0, h = n ? n.map((e, t) => ({
|
|
6429
6006
|
value: t,
|
|
6430
6007
|
url: e.props.url,
|
|
@@ -6433,11 +6010,11 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6433
6010
|
disabled: e.props.disabled || p,
|
|
6434
6011
|
badge: e.props.badge,
|
|
6435
6012
|
testId: e.props?.testId && `${e.props.testId}-${t}`
|
|
6436
|
-
})) : t || d, { simpleInputs:
|
|
6013
|
+
})) : t || d, { simpleInputs: _, options: v, selectedOptions: y } = m ? {
|
|
6437
6014
|
simpleInputs: !1,
|
|
6438
6015
|
options: h,
|
|
6439
6016
|
selectedOptions: void 0
|
|
6440
|
-
} : standardizeInputs(h, r), b = m || y == null ? void 0 :
|
|
6017
|
+
} : standardizeInputs(h, r), b = m || y == null ? void 0 : _ ? y : y.value, x = u === void 0 ? v?.findIndex((e) => e.value === b) : u, S = x === -1 ? 0 : x, C = (t, n, r) => {
|
|
6441
6018
|
if (m) {
|
|
6442
6019
|
let e = n.key || n.label || null;
|
|
6443
6020
|
l(t, e);
|
|
@@ -6466,7 +6043,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6466
6043
|
children: v.map(w)
|
|
6467
6044
|
}), /* @__PURE__ */ jsx(Content$1, {
|
|
6468
6045
|
activeTabIndex: S ?? 0,
|
|
6469
|
-
contentPadding:
|
|
6046
|
+
contentPadding: c,
|
|
6470
6047
|
children: n
|
|
6471
6048
|
})] }) : null;
|
|
6472
6049
|
}, TextLink = ({ children: e, href: t = void 0, target: n = void 0, testId: r, onClick: i, component: a = "a" }) => /* @__PURE__ */ jsx(a, {
|
|
@@ -6492,7 +6069,7 @@ var textarea_module_default = {
|
|
|
6492
6069
|
small: "_small_q0tl0_116",
|
|
6493
6070
|
monospace: "_monospace_q0tl0_155"
|
|
6494
6071
|
};
|
|
6495
|
-
const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows: i, disabled: a = !1, onChange: o = noop, onKeyPress:
|
|
6072
|
+
const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows: i, disabled: a = !1, onChange: o = noop, onKeyPress: c = noop, onFocus: l = noop, onBlur: u = noop, tabIndex: d = 0, error: f = null, warning: p = null, tooltip: m = null, maxTooltipWidth: h, resize: _, monospace: v = !1, testId: y }) => {
|
|
6496
6073
|
let b = useContext(DisabledContext), x = /* @__PURE__ */ jsx("textarea", {
|
|
6497
6074
|
className: cx(textarea_module_default.textarea, f ? textarea_module_default.error : "", p ? textarea_module_default.warning : "", v ? textarea_module_default.monospace : ""),
|
|
6498
6075
|
name: e,
|
|
@@ -6502,11 +6079,11 @@ const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows:
|
|
|
6502
6079
|
rows: i,
|
|
6503
6080
|
onChange: o,
|
|
6504
6081
|
disabled: a || b,
|
|
6505
|
-
onKeyPress:
|
|
6082
|
+
onKeyPress: c,
|
|
6506
6083
|
onFocus: l,
|
|
6507
6084
|
onBlur: u,
|
|
6508
6085
|
tabIndex: d,
|
|
6509
|
-
style: { resize:
|
|
6086
|
+
style: { resize: _ },
|
|
6510
6087
|
"data-error": f || null,
|
|
6511
6088
|
"data-warning": p || null,
|
|
6512
6089
|
"data-testid": y
|
|
@@ -6586,9 +6163,9 @@ const Warning = ({ warning: e }) => /* @__PURE__ */ jsx("div", {
|
|
|
6586
6163
|
let ElementType = /* @__PURE__ */ function(e) {
|
|
6587
6164
|
return e.LINK = "Link", e.BUTTON = "Button", e.MENU = "Menu", e.COMPONENT = "Component", e;
|
|
6588
6165
|
}({});
|
|
6589
|
-
const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, testId: o, component:
|
|
6166
|
+
const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, testId: o, component: c = "a" }) => {
|
|
6590
6167
|
let l = useContext(DisabledContext);
|
|
6591
|
-
return /* @__PURE__ */ jsxs(
|
|
6168
|
+
return /* @__PURE__ */ jsxs(c, {
|
|
6592
6169
|
className: cx(top_bar_module_default.link, i ? top_bar_module_default.active : ""),
|
|
6593
6170
|
href: t || "#",
|
|
6594
6171
|
to: t,
|
|
@@ -6733,16 +6310,16 @@ var tree_module_default = {
|
|
|
6733
6310
|
placeholder: "_placeholder_15yn1_29"
|
|
6734
6311
|
};
|
|
6735
6312
|
const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, draggable: o, icons: s, onDrop: c }) => {
|
|
6736
|
-
let { id: l, data: u } = t, { active: d, testId: f, onClick: p, actions: m = [] } = u, [h,
|
|
6313
|
+
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) => {
|
|
6737
6314
|
e.stopPropagation(), i(l);
|
|
6738
6315
|
}, x = (e) => {
|
|
6739
|
-
e.preventDefault(), e.stopPropagation(), h || (
|
|
6316
|
+
e.preventDefault(), e.stopPropagation(), h || (_(!0), y((/* @__PURE__ */ new Date()).getTime()));
|
|
6740
6317
|
}, S = (e) => {
|
|
6741
|
-
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 &&
|
|
6318
|
+
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 && _(!1);
|
|
6742
6319
|
}, C = (e) => {
|
|
6743
6320
|
e.preventDefault(), e.stopPropagation(), a && !r && (/* @__PURE__ */ new Date()).getTime() - v > 200 && b(e);
|
|
6744
6321
|
}, w = (e) => {
|
|
6745
|
-
e.preventDefault(), e.stopPropagation(),
|
|
6322
|
+
e.preventDefault(), e.stopPropagation(), _(!1), y((/* @__PURE__ */ new Date()).getTime()), c?.(e);
|
|
6746
6323
|
};
|
|
6747
6324
|
return /* @__PURE__ */ jsx("div", {
|
|
6748
6325
|
className: cx(list_module_default.item, list_module_default.action, d ? list_module_default.active : "", n > 0 ? list_module_default.indented : "", h ? list_module_default.bordered : ""),
|
|
@@ -6970,18 +6547,18 @@ var unit_input_module_default = {
|
|
|
6970
6547
|
predefinedMenuActive: "_predefinedMenuActive_ye9w9_1",
|
|
6971
6548
|
inputWrapper: "_inputWrapper_ye9w9_4"
|
|
6972
6549
|
};
|
|
6973
|
-
const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUnit: r = !1, error: i = null, left: a = !1, small: o = !1, width: s = "100%", value:
|
|
6550
|
+
const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUnit: r = !1, error: i = null, left: a = !1, small: o = !1, width: s = "100%", value: l, unitkey: u = "", initUnit: f, noConversion: p = !1, onChange: h = noop, onClick: _ = noop, onFocus: v = noop, onSwitchUnit: y = noop, unitTemplate: b, testId: x, warning: S = null, predefinedOptions: C, initialPredefinedOption: w = !1, shouldLinkAutomaticly: T = !0, selectedPredefinedOptionKey: E, validationCallback: D = () => ({
|
|
6974
6551
|
name: "",
|
|
6975
6552
|
error: null
|
|
6976
6553
|
}), disabledValidation: O = !1, allowEmpty: k = !1, convertBackToStorageUnit: A = !1, enableCosmeticRounding: j = !0, enableDisplayRounding: M = !1, roundDisplayValue: N, selectOnFocus: P, groupOrder: F, tooltip: I = null }) => {
|
|
6977
6554
|
let L = useUnitContext(), R = useRunAfterUpdate();
|
|
6978
|
-
typeof
|
|
6979
|
-
let [z = "", B = ""] =
|
|
6555
|
+
typeof l == "number" && (l = `${l}`);
|
|
6556
|
+
let [z = "", B = ""] = l === void 0 ? [] : split(l), V = useMemo(() => getPreferredUnit(u, b || L?.unitTemplate), [
|
|
6980
6557
|
u,
|
|
6981
6558
|
b,
|
|
6982
6559
|
L?.unitTemplate
|
|
6983
|
-
]), H = isKnownUnit(
|
|
6984
|
-
value:
|
|
6560
|
+
]), H = isKnownUnit(l, V), U = f || V || B, W = usePrevious(U), { value: G } = safeConvertValue({
|
|
6561
|
+
value: l,
|
|
6985
6562
|
toUnit: U,
|
|
6986
6563
|
unitkey: u,
|
|
6987
6564
|
defaultFromUnit: B,
|
|
@@ -6992,17 +6569,17 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6992
6569
|
} : {
|
|
6993
6570
|
value: G,
|
|
6994
6571
|
unit: U
|
|
6995
|
-
}),
|
|
6572
|
+
}), Eu = k || K?.value === void 0, [J, Du] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Ou = !!(O || n), Y = C && C.find((e) => {
|
|
6996
6573
|
if (!e?.value) return;
|
|
6997
6574
|
if (E) return E === e.valueKey;
|
|
6998
|
-
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n =
|
|
6999
|
-
value: String(
|
|
6575
|
+
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
6576
|
+
value: String(l),
|
|
7000
6577
|
unitkey: u,
|
|
7001
6578
|
toUnit: t
|
|
7002
6579
|
});
|
|
7003
6580
|
return withUnit(n, t) === e.value;
|
|
7004
|
-
}),
|
|
7005
|
-
let e =
|
|
6581
|
+
}), ku = () => {
|
|
6582
|
+
let e = l ?? "", t = K.unit;
|
|
7006
6583
|
if (checkConversion({
|
|
7007
6584
|
value: e,
|
|
7008
6585
|
unitkey: u,
|
|
@@ -7015,9 +6592,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7015
6592
|
return null;
|
|
7016
6593
|
}
|
|
7017
6594
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
7018
|
-
},
|
|
6595
|
+
}, Au = (t) => {
|
|
7019
6596
|
let n = getStringName(e), r = t.target, { value: i, selectionStart: a } = r, o = withUnit(i, K?.unit || ""), s = A ? withUnit(convertAndGetValue(o, B), B) : o;
|
|
7020
|
-
|
|
6597
|
+
h({ target: {
|
|
7021
6598
|
value: s,
|
|
7022
6599
|
name: n
|
|
7023
6600
|
} });
|
|
@@ -7028,7 +6605,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7028
6605
|
}), R(() => {
|
|
7029
6606
|
r.selectionStart = a, r.selectionEnd = a;
|
|
7030
6607
|
});
|
|
7031
|
-
},
|
|
6608
|
+
}, ju = (e, t) => {
|
|
7032
6609
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
7033
6610
|
value: e,
|
|
7034
6611
|
unit: t
|
|
@@ -7039,16 +6616,16 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7039
6616
|
let e, t = "";
|
|
7040
6617
|
if (W !== U) {
|
|
7041
6618
|
let { value: n } = safeConvertValue({
|
|
7042
|
-
value:
|
|
6619
|
+
value: l,
|
|
7043
6620
|
toUnit: U,
|
|
7044
6621
|
unitkey: u,
|
|
7045
6622
|
defaultFromUnit: B,
|
|
7046
6623
|
doNotConvertValue: p
|
|
7047
6624
|
});
|
|
7048
6625
|
e = n, t = U;
|
|
7049
|
-
} else if (withUnit(K.value, K.unit) !==
|
|
6626
|
+
} else if (withUnit(K.value, K.unit) !== l) {
|
|
7050
6627
|
let { value: n } = safeConvertValue({
|
|
7051
|
-
value:
|
|
6628
|
+
value: l,
|
|
7052
6629
|
toUnit: K.unit,
|
|
7053
6630
|
unitkey: u,
|
|
7054
6631
|
defaultFromUnit: B,
|
|
@@ -7059,15 +6636,15 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7059
6636
|
e !== void 0 && q({
|
|
7060
6637
|
value: e,
|
|
7061
6638
|
unit: t
|
|
7062
|
-
}), C &&
|
|
6639
|
+
}), C && Du(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
7063
6640
|
}
|
|
7064
6641
|
}, [
|
|
7065
6642
|
U,
|
|
7066
|
-
|
|
6643
|
+
l,
|
|
7067
6644
|
i,
|
|
7068
6645
|
T
|
|
7069
6646
|
]);
|
|
7070
|
-
let
|
|
6647
|
+
let X = ku(), Z = label(K.unit) || K.unit || "", Mu = p || !X || X && X.length === 1, Q = getStringName(e), $, Nu = (t) => {
|
|
7071
6648
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
7072
6649
|
if (checkConversion({
|
|
7073
6650
|
value: r,
|
|
@@ -7087,7 +6664,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7087
6664
|
type: MenuType.OPTION,
|
|
7088
6665
|
inline: !0,
|
|
7089
6666
|
onClick: () => {
|
|
7090
|
-
validateNumber(i).valid && !n && (
|
|
6667
|
+
validateNumber(i).valid && !n && (Du(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
7091
6668
|
value: r,
|
|
7092
6669
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
7093
6670
|
predefinedSelected: !0,
|
|
@@ -7099,25 +6676,25 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7099
6676
|
height: "0"
|
|
7100
6677
|
})] }),
|
|
7101
6678
|
description: o,
|
|
7102
|
-
selected:
|
|
6679
|
+
selected: Y === t && J === PredefinedOptionsMenuState.PREDEFINED
|
|
7103
6680
|
};
|
|
7104
6681
|
};
|
|
7105
6682
|
if ($ = [{
|
|
7106
6683
|
type: MenuType.OPTION,
|
|
7107
6684
|
inline: !0,
|
|
7108
6685
|
onClick: () => {
|
|
7109
|
-
|
|
6686
|
+
J !== PredefinedOptionsMenuState.CUSTOM && !n && h({ target: {
|
|
7110
6687
|
value: withUnit(K.value, K.unit),
|
|
7111
6688
|
name: typeof e == "string" ? e : e?.fieldName || ""
|
|
7112
6689
|
} });
|
|
7113
6690
|
},
|
|
7114
6691
|
label: "Custom",
|
|
7115
|
-
selected:
|
|
6692
|
+
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
7116
6693
|
}], C?.length) {
|
|
7117
|
-
let e = C.map(
|
|
6694
|
+
let e = C.map(Nu);
|
|
7118
6695
|
$ = [...$, ...e];
|
|
7119
6696
|
}
|
|
7120
|
-
let
|
|
6697
|
+
let Pu = (e) => {
|
|
7121
6698
|
if (isValueWithUnit(e)) {
|
|
7122
6699
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
7123
6700
|
value: e,
|
|
@@ -7129,9 +6706,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7129
6706
|
return n;
|
|
7130
6707
|
}
|
|
7131
6708
|
return e;
|
|
7132
|
-
},
|
|
6709
|
+
}, Fu = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Iu = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
7133
6710
|
return /* @__PURE__ */ jsx("div", {
|
|
7134
|
-
className:
|
|
6711
|
+
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
7135
6712
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
7136
6713
|
small: o,
|
|
7137
6714
|
width: s,
|
|
@@ -7146,65 +6723,65 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7146
6723
|
trigger: "Component",
|
|
7147
6724
|
component: /* @__PURE__ */ jsx(Button, {
|
|
7148
6725
|
groupOrder: "first",
|
|
7149
|
-
active:
|
|
7150
|
-
icon:
|
|
6726
|
+
active: J === PredefinedOptionsMenuState.PREDEFINED,
|
|
6727
|
+
icon: J === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
|
|
7151
6728
|
small: o
|
|
7152
6729
|
}),
|
|
7153
6730
|
small: o,
|
|
7154
6731
|
sections: $
|
|
7155
6732
|
},
|
|
7156
|
-
tooltip:
|
|
6733
|
+
tooltip: J === PredefinedOptionsMenuState.PREDEFINED ? Y?.label : ""
|
|
7157
6734
|
}),
|
|
7158
6735
|
/* @__PURE__ */ jsx("div", {
|
|
7159
6736
|
className: unit_input_module_default.inputWrapper,
|
|
7160
6737
|
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
7161
|
-
name:
|
|
6738
|
+
name: Q,
|
|
7162
6739
|
testId: x,
|
|
7163
6740
|
disabled: n,
|
|
7164
|
-
placeholder:
|
|
6741
|
+
placeholder: Pu(t),
|
|
7165
6742
|
value: K.value,
|
|
7166
|
-
onChange:
|
|
6743
|
+
onChange: Au,
|
|
7167
6744
|
onFocus: v,
|
|
7168
6745
|
error: i === null ? void 0 : i,
|
|
7169
6746
|
warning: S === null ? void 0 : S,
|
|
7170
6747
|
left: a,
|
|
7171
|
-
allowEmpty:
|
|
7172
|
-
validationCallback: (e, t) => D(
|
|
6748
|
+
allowEmpty: Eu,
|
|
6749
|
+
validationCallback: (e, t) => D(Q, t),
|
|
7173
6750
|
enableCosmeticRounding: j,
|
|
7174
6751
|
enableDisplayRounding: M,
|
|
7175
6752
|
roundDisplayValue: N,
|
|
7176
|
-
groupOrder:
|
|
7177
|
-
disableInternalErrorValidationMessages:
|
|
6753
|
+
groupOrder: Fu,
|
|
6754
|
+
disableInternalErrorValidationMessages: Ou,
|
|
7178
6755
|
small: o,
|
|
7179
6756
|
selectOnFocus: P,
|
|
7180
6757
|
tooltip: I
|
|
7181
|
-
},
|
|
6758
|
+
}, Q)
|
|
7182
6759
|
}),
|
|
7183
|
-
|
|
7184
|
-
groupOrder:
|
|
6760
|
+
Z && (Mu || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6761
|
+
groupOrder: Iu,
|
|
7185
6762
|
small: o,
|
|
7186
|
-
children:
|
|
6763
|
+
children: Z
|
|
7187
6764
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
7188
|
-
groupOrder:
|
|
6765
|
+
groupOrder: Iu,
|
|
7189
6766
|
maxHeight: 380,
|
|
7190
6767
|
disabled: r,
|
|
7191
6768
|
testId: x && `${x}-menu`,
|
|
7192
6769
|
tabIndex: -1,
|
|
7193
6770
|
menu: {
|
|
7194
|
-
label:
|
|
6771
|
+
label: Z,
|
|
7195
6772
|
trigger: "DropDownButton",
|
|
7196
6773
|
small: o,
|
|
7197
|
-
sections:
|
|
6774
|
+
sections: X.map(([e = "", t = "", n]) => {
|
|
7198
6775
|
let r = n || t || "", i = isValidNum(e) ? e : "";
|
|
7199
6776
|
return {
|
|
7200
6777
|
type: "Option",
|
|
7201
6778
|
label: j ? safeRoundNumbers(i) : i,
|
|
7202
6779
|
inline: !0,
|
|
7203
6780
|
onClick: (n) => {
|
|
7204
|
-
n.stopPropagation(),
|
|
6781
|
+
n.stopPropagation(), ju(e, t);
|
|
7205
6782
|
},
|
|
7206
6783
|
description: r,
|
|
7207
|
-
selected: r ===
|
|
6784
|
+
selected: r === Z,
|
|
7208
6785
|
testId: `${x}-unit-${r}`
|
|
7209
6786
|
};
|
|
7210
6787
|
})
|
|
@@ -7317,61 +6894,60 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
|
|
|
7317
6894
|
})
|
|
7318
6895
|
})) : [];
|
|
7319
6896
|
};
|
|
7320
|
-
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder:
|
|
7321
|
-
let { headers: d
|
|
7322
|
-
|
|
7323
|
-
...
|
|
6897
|
+
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder: s, beforeRenderRow: l }) => {
|
|
6898
|
+
let { headers: u,...d } = e, { storageUnits: f, preferredUnits: p } = normalizeUnits(t), h = usePrevious(p), [g, _] = useState(p), v = ({ unitKey: e, value: n }) => {
|
|
6899
|
+
_({
|
|
6900
|
+
...g,
|
|
7324
6901
|
[e]: n
|
|
7325
6902
|
});
|
|
7326
6903
|
let r = t.find((t) => t.unitKey === e);
|
|
7327
6904
|
r && typeof r.onChange == "function" && r.onChange({
|
|
7328
|
-
oldUnit:
|
|
6905
|
+
oldUnit: g[e],
|
|
7329
6906
|
newUnit: n,
|
|
7330
6907
|
unitKey: e
|
|
7331
6908
|
});
|
|
7332
|
-
},
|
|
7333
|
-
let a =
|
|
6909
|
+
}, y = useCallback(({ row: e, rowIndex: t }) => {
|
|
6910
|
+
let a = l ? l({
|
|
7334
6911
|
row: e,
|
|
7335
6912
|
rowIndex: t
|
|
7336
6913
|
}) : e;
|
|
7337
6914
|
return convertRow({
|
|
7338
6915
|
row: a,
|
|
7339
6916
|
rowIndex: t,
|
|
7340
|
-
selectedUnits:
|
|
7341
|
-
storageUnits:
|
|
6917
|
+
selectedUnits: g,
|
|
6918
|
+
storageUnits: f,
|
|
7342
6919
|
convertBackToStorageUnit: n,
|
|
7343
6920
|
enableCosmeticRounding: r,
|
|
7344
6921
|
enableDisplayRounding: i
|
|
7345
6922
|
});
|
|
7346
6923
|
}, [
|
|
7347
|
-
|
|
7348
|
-
|
|
6924
|
+
g,
|
|
6925
|
+
f,
|
|
7349
6926
|
n,
|
|
7350
6927
|
r,
|
|
7351
6928
|
i
|
|
7352
6929
|
]);
|
|
7353
6930
|
return useEffect(() => {
|
|
7354
|
-
isEqual(
|
|
7355
|
-
let t =
|
|
7356
|
-
t !== n &&
|
|
6931
|
+
isEqual(p, h) || Object.keys(p).forEach((e) => {
|
|
6932
|
+
let t = h?.[e], n = p[e];
|
|
6933
|
+
t !== n && v({
|
|
7357
6934
|
unitKey: e,
|
|
7358
6935
|
value: n
|
|
7359
6936
|
});
|
|
7360
6937
|
});
|
|
7361
6938
|
}, [t]), /* @__PURE__ */ jsx(Table, {
|
|
7362
6939
|
table: {
|
|
7363
|
-
...
|
|
6940
|
+
...d,
|
|
7364
6941
|
headers: convertHeaderRows({
|
|
7365
6942
|
headers: e.headers,
|
|
7366
|
-
selectedUnits:
|
|
7367
|
-
storageUnits:
|
|
7368
|
-
onChangeUnit:
|
|
6943
|
+
selectedUnits: g,
|
|
6944
|
+
storageUnits: f,
|
|
6945
|
+
onChangeUnit: v
|
|
7369
6946
|
})
|
|
7370
6947
|
},
|
|
7371
6948
|
onListReorder: a,
|
|
7372
|
-
canListReorder:
|
|
7373
|
-
beforeRenderRow:
|
|
7374
|
-
enableMultiSelect: u
|
|
6949
|
+
canListReorder: s,
|
|
6950
|
+
beforeRenderRow: y
|
|
7375
6951
|
});
|
|
7376
6952
|
};
|
|
7377
6953
|
var setting_field_module_default = { settingField: "_settingField_1x02n_1" };
|
|
@@ -7444,7 +7020,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7444
7020
|
}, [n]);
|
|
7445
7021
|
let s = ({ target: { value: e } }) => {
|
|
7446
7022
|
a(e);
|
|
7447
|
-
}, { added:
|
|
7023
|
+
}, { added: l, removed: u } = renderLinesCount(e, t), d = l + u > 3500;
|
|
7448
7024
|
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Card, {
|
|
7449
7025
|
bordered: !0,
|
|
7450
7026
|
heading: /* @__PURE__ */ jsxs(Flex, {
|
|
@@ -7453,7 +7029,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7453
7029
|
success: !0,
|
|
7454
7030
|
children: [
|
|
7455
7031
|
"+",
|
|
7456
|
-
|
|
7032
|
+
l,
|
|
7457
7033
|
" "
|
|
7458
7034
|
]
|
|
7459
7035
|
}), /* @__PURE__ */ jsxs(Text, {
|
|
@@ -7481,7 +7057,130 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7481
7057
|
compareMethod: DiffMethod.WORDS
|
|
7482
7058
|
})
|
|
7483
7059
|
}) });
|
|
7484
|
-
}
|
|
7060
|
+
};
|
|
7061
|
+
function formatDate({ date: e, showTime: t, showSeconds: n, timeZone: r, showTimeZone: i, locale: a }) {
|
|
7062
|
+
return e ? new Date(e).toLocaleString(a, {
|
|
7063
|
+
year: "numeric",
|
|
7064
|
+
month: "short",
|
|
7065
|
+
day: "2-digit",
|
|
7066
|
+
hour: t ? "2-digit" : void 0,
|
|
7067
|
+
minute: t ? "2-digit" : void 0,
|
|
7068
|
+
second: n ? "2-digit" : void 0,
|
|
7069
|
+
timeZone: r,
|
|
7070
|
+
timeZoneName: i ? "short" : void 0
|
|
7071
|
+
}) : null;
|
|
7072
|
+
}
|
|
7073
|
+
function AuditLogTable({ logs: e, onClick: t, loading: n }) {
|
|
7074
|
+
let [r, i] = useState(!0), [a, o] = useState(!0), s = [
|
|
7075
|
+
{
|
|
7076
|
+
label: "10 / page",
|
|
7077
|
+
value: 10
|
|
7078
|
+
},
|
|
7079
|
+
{
|
|
7080
|
+
label: "20 / page",
|
|
7081
|
+
value: 20
|
|
7082
|
+
},
|
|
7083
|
+
{
|
|
7084
|
+
label: "50 / page",
|
|
7085
|
+
value: 50
|
|
7086
|
+
},
|
|
7087
|
+
{
|
|
7088
|
+
label: "Show all",
|
|
7089
|
+
value: 0
|
|
7090
|
+
}
|
|
7091
|
+
], [c, l] = useState(10), [u, d] = useState(1), f = ({ diffs: e = [], userName: t, source: n, operation: r, operationMetaData: i }) => {
|
|
7092
|
+
if (n === "API") return r === "Created" ? `Created through API by ${t || "Unknown user"}` : `Changed through API by ${t || "Unknown user"}`;
|
|
7093
|
+
switch (r) {
|
|
7094
|
+
case "Created": return `Created by ${t}`;
|
|
7095
|
+
case "Cloned": return `Cloned by ${t} (from ${i || "unknown"})`;
|
|
7096
|
+
case "Reverted": return `Reverted by ${t}`;
|
|
7097
|
+
case "Imported": return `Imported by ${t}`;
|
|
7098
|
+
case "Updated": return `Updated by ${t} (${e.length} changes)`;
|
|
7099
|
+
default: return `Change by ${t}`;
|
|
7100
|
+
}
|
|
7101
|
+
}, p = (u - 1) * (c || e.length || 1), h = c === 0 ? e.length : p + c, g = e.slice(p, h), _ = [{ cells: [
|
|
7102
|
+
{ value: "Change" },
|
|
7103
|
+
{ value: "Modified by" },
|
|
7104
|
+
{ value: "Using" },
|
|
7105
|
+
{ value: "Operation" },
|
|
7106
|
+
{ value: "Date" }
|
|
7107
|
+
] }], v = g.map((e) => ({ cells: [
|
|
7108
|
+
{
|
|
7109
|
+
value: f(e),
|
|
7110
|
+
type: "Link",
|
|
7111
|
+
onClick: () => t(e),
|
|
7112
|
+
breakWord: !0
|
|
7113
|
+
},
|
|
7114
|
+
{
|
|
7115
|
+
value: e.userName || "Unknown",
|
|
7116
|
+
type: "Static"
|
|
7117
|
+
},
|
|
7118
|
+
{
|
|
7119
|
+
value: e.source || "System",
|
|
7120
|
+
type: "Static"
|
|
7121
|
+
},
|
|
7122
|
+
{
|
|
7123
|
+
value: e.operation,
|
|
7124
|
+
type: "Static"
|
|
7125
|
+
},
|
|
7126
|
+
{
|
|
7127
|
+
value: formatDate({
|
|
7128
|
+
date: e.createdAt,
|
|
7129
|
+
showTime: !0
|
|
7130
|
+
}),
|
|
7131
|
+
type: "Static"
|
|
7132
|
+
}
|
|
7133
|
+
] }));
|
|
7134
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Card, {
|
|
7135
|
+
heading: /* @__PURE__ */ jsxs(Flex, {
|
|
7136
|
+
gap: !0,
|
|
7137
|
+
wrap: !0,
|
|
7138
|
+
children: [
|
|
7139
|
+
/* @__PURE__ */ jsx(Heading, { children: "CHANGES" }),
|
|
7140
|
+
/* @__PURE__ */ jsx(Toggle, {
|
|
7141
|
+
small: !0,
|
|
7142
|
+
checked: r,
|
|
7143
|
+
onChange: () => i(!r),
|
|
7144
|
+
label: "Include company settings"
|
|
7145
|
+
}),
|
|
7146
|
+
/* @__PURE__ */ jsx(Toggle, {
|
|
7147
|
+
small: !0,
|
|
7148
|
+
checked: a,
|
|
7149
|
+
onChange: () => o(!a),
|
|
7150
|
+
label: "Include migrations"
|
|
7151
|
+
})
|
|
7152
|
+
]
|
|
7153
|
+
}),
|
|
7154
|
+
padding: !1,
|
|
7155
|
+
children: n ? /* @__PURE__ */ jsx(Loader, {
|
|
7156
|
+
height: "100px",
|
|
7157
|
+
cover: !0,
|
|
7158
|
+
theme: Theme.WHITE,
|
|
7159
|
+
children: /* @__PURE__ */ jsx(Spinner, { dark: !0 })
|
|
7160
|
+
}) : /* @__PURE__ */ jsx(Table, { table: {
|
|
7161
|
+
headers: _,
|
|
7162
|
+
rows: v,
|
|
7163
|
+
fixedWidth: "100%",
|
|
7164
|
+
bordered: !1,
|
|
7165
|
+
actionsRight: !0,
|
|
7166
|
+
footer: { pagination: {
|
|
7167
|
+
rowCount: e.length,
|
|
7168
|
+
selectedPage: u,
|
|
7169
|
+
rowsPerPage: {
|
|
7170
|
+
onChange: (e) => {
|
|
7171
|
+
let { value: t } = e.target;
|
|
7172
|
+
l(Number(t)), d(1);
|
|
7173
|
+
},
|
|
7174
|
+
options: s,
|
|
7175
|
+
value: c
|
|
7176
|
+
},
|
|
7177
|
+
onSelectPage: (e) => d(e),
|
|
7178
|
+
small: !0
|
|
7179
|
+
} }
|
|
7180
|
+
} })
|
|
7181
|
+
}) });
|
|
7182
|
+
}
|
|
7183
|
+
const isPrimitiveValue = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || e === null, initializeGuiLibrary = (e) => {
|
|
7485
7184
|
setConfig(ConfigKeyType.LanguageKey, e.languageKey), Object.entries(e).forEach(([e, t]) => {
|
|
7486
7185
|
if (e === ConfigKeyType.Translations) setConfig(e, getTranslations(t));
|
|
7487
7186
|
else {
|
|
@@ -7490,4 +7189,4 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7490
7189
|
}
|
|
7491
7190
|
});
|
|
7492
7191
|
};
|
|
7493
|
-
export { Accordion, AccordionWithDefaultToggle, Actions, Align, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Color, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TriggerType, UnitInput, UnitTable, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };
|
|
7192
|
+
export { Accordion, AccordionWithDefaultToggle, Actions, Align, AuditLogTable, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Color, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, TextTransform, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TriggerType, UnitInput, UnitTable, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };
|