@oliasoft-open-source/react-ui-library 5.6.5-beta-6 → 5.6.5
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 +16 -53
- package/dist/index.js +892 -1315
- package/package.json +9 -9
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,729 +2972,57 @@ 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
|
-
}, validate = ({ fields: e, units: t, rows: n, rules: r, t: i }) => {
|
|
3107
|
-
let a = asT(i);
|
|
3108
|
-
if (!Array.isArray(r) || r.length === 0) return {
|
|
3109
|
-
isValid: !0,
|
|
3110
|
-
errors: []
|
|
3111
|
-
};
|
|
3112
|
-
let { effectiveFields: o, effectiveUnits: s, bodyRows: c, hasFieldNameHeader: l, hasUnitHeader: u } = guessMissingHeaders$1(e, t, n, r), d = 1 + ((l ? 1 : 0) + (u ? 1 : 0)), f = validateColumnLength(o, s, c, r, l, u, a, 0);
|
|
3113
|
-
return f.length === 0 && (f = f.concat(validateHeadings(o, s, r, l, u, a), validateValues(c, r, a, d, 1))), {
|
|
3114
|
-
isValid: f.length === 0,
|
|
3115
|
-
errors: f
|
|
3116
|
-
};
|
|
3117
|
-
}, validationRegistry = new class {
|
|
3118
|
-
rules = /* @__PURE__ */ new Map();
|
|
3119
|
-
register(e, t) {
|
|
3120
|
-
this.rules.set(e, t);
|
|
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) {
|
|
3221
|
-
useEffect(() => {
|
|
3222
|
-
if (!(!e || !t)) return validationRegistry.register(e, t), () => validationRegistry.unregister(e);
|
|
3223
|
-
}, [e, t]);
|
|
3224
|
-
}
|
|
3225
|
-
var counter = 0;
|
|
3226
|
-
function nextScopeId() {
|
|
3227
|
-
return counter += 1, `table-${counter}`;
|
|
3228
|
-
}
|
|
3229
|
-
const depthRound = (e) => Math.round(e * 100) / 100, joinArray = (e) => e.join(", ").replace(/,\s*$/, ""), guessDelimiter = (e) => {
|
|
3230
|
-
let t = e.substring(0, 200), n = (t.match(/\t/g) ?? [])?.length, r = (t.match(/;/g) ?? [])?.length;
|
|
3231
|
-
return n === 0 && r === 0 ? "," : n > r ? " " : ";";
|
|
3232
|
-
}, allowedMimes = [
|
|
3233
|
-
"text/csv",
|
|
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)
|
|
3281
|
-
]);
|
|
3282
|
-
return t.unshift([
|
|
3283
|
-
"m",
|
|
3284
|
-
"deg",
|
|
3285
|
-
"deg"
|
|
3286
|
-
]), t;
|
|
3287
|
-
};
|
|
3288
|
-
var basePapaConfig = {
|
|
3289
|
-
skipEmptyLines: !0,
|
|
3290
|
-
transform: (e) => e?.trim(),
|
|
3291
|
-
delimiter: guessDelimiter
|
|
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
|
|
3367
|
-
};
|
|
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));
|
|
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));
|
|
3696
3024
|
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:
|
|
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 }) => {
|
|
3698
3026
|
let O = (e) => {
|
|
3699
3027
|
let n = validateNumber(e), r = t && isEmptyNullOrUndefined(e);
|
|
3700
3028
|
return [Infinity, -Infinity].includes(Number(e)) || r ? {
|
|
@@ -3734,7 +3062,7 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3734
3062
|
name: F
|
|
3735
3063
|
}
|
|
3736
3064
|
};
|
|
3737
|
-
|
|
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,36 +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,
|
|
3493
|
+
ref: u,
|
|
3494
|
+
className: _,
|
|
3495
|
+
style: x,
|
|
3496
|
+
colSpan: s,
|
|
3497
|
+
rowSpan: c,
|
|
4173
3498
|
children: /* @__PURE__ */ jsx(CellWrapper, {
|
|
4174
3499
|
cell: e,
|
|
4175
|
-
columnAlignment:
|
|
3500
|
+
columnAlignment: m ?? Align.RIGHT,
|
|
4176
3501
|
isHeader: t,
|
|
4177
3502
|
testId: a
|
|
4178
3503
|
})
|
|
4179
3504
|
});
|
|
4180
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 }) => {
|
|
4181
|
-
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) => {
|
|
4182
3507
|
let i = `${n ? 0 : 1}_${t}_${r}`;
|
|
4183
3508
|
return /* @__PURE__ */ jsx(Cell, {
|
|
4184
3509
|
cell: e,
|
|
@@ -4186,18 +3511,14 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4186
3511
|
columnAlignment: o[r],
|
|
4187
3512
|
columnHeaderAlignment: p[r],
|
|
4188
3513
|
width: l ? l[r] : void 0,
|
|
4189
|
-
testId: e.testId
|
|
4190
|
-
rowIndex: t,
|
|
4191
|
-
columnIndex: r
|
|
3514
|
+
testId: e.testId
|
|
4192
3515
|
}, i);
|
|
4193
3516
|
}), w = s && /* @__PURE__ */ jsx(Cell, {
|
|
4194
3517
|
cell: {
|
|
4195
3518
|
type: CellType.ACTIONS,
|
|
4196
3519
|
actions: e.actions
|
|
4197
3520
|
},
|
|
4198
|
-
isHeader: n
|
|
4199
|
-
rowIndex: t,
|
|
4200
|
-
columnIndex: r
|
|
3521
|
+
isHeader: n
|
|
4201
3522
|
}, r), { attributes: T, listeners: E, setNodeRef: D, transform: O, transition: k, isDragging: A } = useSortable({
|
|
4202
3523
|
id: t.toString(),
|
|
4203
3524
|
animateLayoutChanges: () => !1
|
|
@@ -4217,10 +3538,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4217
3538
|
});
|
|
4218
3539
|
return n ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
4219
3540
|
onClick: m,
|
|
4220
|
-
onMouseEnter:
|
|
3541
|
+
onMouseEnter: _,
|
|
4221
3542
|
onMouseLeave: v,
|
|
4222
3543
|
onFocus: h,
|
|
4223
|
-
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),
|
|
4224
3545
|
children: [
|
|
4225
3546
|
c ? /* @__PURE__ */ jsx("th", {}) : null,
|
|
4226
3547
|
C,
|
|
@@ -4233,10 +3554,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4233
3554
|
}, `${t}_expanded_content`) : null] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
4234
3555
|
ref: e.noDrag ? null : D,
|
|
4235
3556
|
onClick: m,
|
|
4236
|
-
onMouseEnter:
|
|
3557
|
+
onMouseEnter: _,
|
|
4237
3558
|
onMouseLeave: v,
|
|
4238
3559
|
onFocus: h,
|
|
4239
|
-
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),
|
|
4240
3561
|
"data-error": b || null,
|
|
4241
3562
|
"data-warning": x || null,
|
|
4242
3563
|
"data-index": t,
|
|
@@ -4253,14 +3574,14 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4253
3574
|
children: y.content
|
|
4254
3575
|
}, `${t}_expanded_content`) : null] });
|
|
4255
3576
|
}, TableDragWrapper = (e) => {
|
|
4256
|
-
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]);
|
|
4257
3578
|
return a ? /* @__PURE__ */ jsxs(DndContext, {
|
|
4258
3579
|
collisionDetection: closestCenter,
|
|
4259
3580
|
onDragStart: (e) => {
|
|
4260
3581
|
p(e.active.id);
|
|
4261
3582
|
},
|
|
4262
3583
|
onDragEnd: (e) => {
|
|
4263
|
-
p(null),
|
|
3584
|
+
p(null), _(!1);
|
|
4264
3585
|
let { active: t, over: n } = e;
|
|
4265
3586
|
if (!t || !n || t.id === n.id) return;
|
|
4266
3587
|
let r = Number(t.id), i = Number(n?.id);
|
|
@@ -4277,23 +3598,23 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4277
3598
|
from: r,
|
|
4278
3599
|
to: i
|
|
4279
3600
|
});
|
|
4280
|
-
|
|
3601
|
+
_(a);
|
|
4281
3602
|
},
|
|
4282
3603
|
children: [/* @__PURE__ */ jsx(SortableContext, {
|
|
4283
3604
|
items: v,
|
|
4284
3605
|
strategy: verticalListSortingStrategy,
|
|
4285
|
-
children: t({ dropDisabled:
|
|
4286
|
-
}), !!
|
|
3606
|
+
children: t({ dropDisabled: h })
|
|
3607
|
+
}), !!f && createPortal(/* @__PURE__ */ jsx(DragOverlay, {
|
|
4287
3608
|
dropAnimation: null,
|
|
4288
3609
|
children: /* @__PURE__ */ jsx("table", {
|
|
4289
3610
|
className: cx(table_module_default.table, table_module_default.dragOverlay),
|
|
4290
3611
|
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(Row$1, {
|
|
4291
|
-
rowIndex: Number(
|
|
4292
|
-
row: l[Number(
|
|
3612
|
+
rowIndex: Number(f),
|
|
3613
|
+
row: l[Number(f)],
|
|
4293
3614
|
columnCount: i,
|
|
4294
3615
|
columnWidths: (() => {
|
|
4295
3616
|
if (!u?.current) return [];
|
|
4296
|
-
let e = u.current.querySelectorAll("tr")[Number(
|
|
3617
|
+
let e = u.current.querySelectorAll("tr")[Number(f)]?.querySelectorAll("td");
|
|
4297
3618
|
if (!e) return [];
|
|
4298
3619
|
let t = Array.from(e).map((e) => `${e.getBoundingClientRect().width}px`);
|
|
4299
3620
|
return t.shift(), t;
|
|
@@ -4302,7 +3623,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4302
3623
|
hasRowActions: c,
|
|
4303
3624
|
columnAlignment: r,
|
|
4304
3625
|
draggableTable: a,
|
|
4305
|
-
dropDisabled:
|
|
3626
|
+
dropDisabled: h
|
|
4306
3627
|
}) })
|
|
4307
3628
|
})
|
|
4308
3629
|
}), document.body)]
|
|
@@ -4344,155 +3665,135 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4344
3665
|
className: table_module_default.scroll,
|
|
4345
3666
|
children: n({})
|
|
4346
3667
|
});
|
|
4347
|
-
}, Table =
|
|
4348
|
-
let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i
|
|
4349
|
-
|
|
4350
|
-
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 = {
|
|
4351
|
-
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" ? {
|
|
4352
3671
|
...e,
|
|
4353
3672
|
onChange: (e) => {
|
|
4354
3673
|
let n = e?.target?.value, r = {
|
|
4355
|
-
...
|
|
4356
|
-
cells:
|
|
3674
|
+
...v,
|
|
3675
|
+
cells: v.cells.map((e, r) => ({
|
|
4357
3676
|
...e,
|
|
4358
3677
|
value: r === t ? n : e?.value
|
|
4359
3678
|
}))
|
|
4360
3679
|
};
|
|
4361
|
-
|
|
3680
|
+
y({ newRow: r });
|
|
4362
3681
|
}
|
|
4363
3682
|
} : {
|
|
4364
3683
|
...e,
|
|
4365
3684
|
disabled: !0
|
|
4366
3685
|
}) : null,
|
|
4367
|
-
testId:
|
|
4368
|
-
},
|
|
3686
|
+
testId: h ? `${h}-last-empty-row` : void 0
|
|
3687
|
+
}, M = A ? c.concat(j) : c, N = {
|
|
4369
3688
|
...i,
|
|
4370
|
-
rows:
|
|
4371
|
-
},
|
|
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
|
-
}) : q.map((t, n) => {
|
|
4453
|
-
let i = r ? r({
|
|
4454
|
-
row: t,
|
|
4455
|
-
rowIndex: n
|
|
4456
|
-
}) : t;
|
|
4457
|
-
return /* @__PURE__ */ jsx(Row$1, {
|
|
4458
|
-
rowIndex: n,
|
|
4459
|
-
row: i,
|
|
4460
|
-
columnCount: V,
|
|
4461
|
-
columnWidths: o,
|
|
4462
|
-
colSpan: U,
|
|
4463
|
-
hasRowActions: H,
|
|
4464
|
-
columnAlignment: p,
|
|
4465
|
-
draggableTable: v,
|
|
4466
|
-
dropDisabled: e
|
|
4467
|
-
}, `1_${n}`);
|
|
4468
|
-
})
|
|
4469
|
-
})]
|
|
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}`);
|
|
4470
3771
|
})
|
|
4471
|
-
})
|
|
3772
|
+
})]
|
|
4472
3773
|
})
|
|
4473
|
-
}),
|
|
4474
|
-
s && /* @__PURE__ */ jsx(Footer, {
|
|
4475
|
-
pagination: s.pagination,
|
|
4476
|
-
actions: s.actions,
|
|
4477
|
-
content: s.content
|
|
4478
3774
|
})
|
|
4479
|
-
|
|
4480
|
-
|
|
3775
|
+
}),
|
|
3776
|
+
o && /* @__PURE__ */ jsx(Footer, {
|
|
3777
|
+
pagination: o.pagination,
|
|
3778
|
+
actions: o.actions,
|
|
3779
|
+
content: o.content
|
|
3780
|
+
})
|
|
3781
|
+
]
|
|
4481
3782
|
});
|
|
4482
|
-
}
|
|
3783
|
+
}, placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
|
|
4483
3784
|
let i = `${t} → ${n}:`, a = e.filter((e) => !e.startsWith(i)), o = r ? [...a, `${i} ${r}`] : a, s = o.length === 0;
|
|
4484
3785
|
return {
|
|
4485
3786
|
updatedErrors: o,
|
|
4486
3787
|
isValid: s
|
|
4487
3788
|
};
|
|
4488
3789
|
}, Table$1 = ({ validationRules: e, parsedResult: t, updateState: n, testId: r }) => {
|
|
4489
|
-
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")), {
|
|
4490
3791
|
cells: r.map((r, o) => {
|
|
4491
|
-
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;
|
|
4492
3793
|
return {
|
|
4493
3794
|
name: l,
|
|
4494
3795
|
value: r,
|
|
4495
|
-
type:
|
|
3796
|
+
type: f.current[o] ?? "Input",
|
|
4496
3797
|
disableValidationOnFocus: !0,
|
|
4497
3798
|
error: m,
|
|
4498
3799
|
validationCallback: (e, r) => {
|
|
@@ -4577,12 +3878,12 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4577
3878
|
i,
|
|
4578
3879
|
x,
|
|
4579
3880
|
b
|
|
4580
|
-
]), C = useMemo(() => _.slice(
|
|
3881
|
+
]), C = useMemo(() => _.slice(h, g), [
|
|
4581
3882
|
_,
|
|
4582
|
-
|
|
3883
|
+
h,
|
|
4583
3884
|
g
|
|
4584
3885
|
]), w = useCallback(({ rowIndex: e }) => {
|
|
4585
|
-
let n =
|
|
3886
|
+
let n = h + e, r = t.rows[n];
|
|
4586
3887
|
return r ? y(r, n) : {
|
|
4587
3888
|
cells: [],
|
|
4588
3889
|
actions: []
|
|
@@ -4590,7 +3891,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4590
3891
|
}, [
|
|
4591
3892
|
t.rows,
|
|
4592
3893
|
y,
|
|
4593
|
-
|
|
3894
|
+
h
|
|
4594
3895
|
]);
|
|
4595
3896
|
return /* @__PURE__ */ jsx(Table, {
|
|
4596
3897
|
beforeRenderRow: w,
|
|
@@ -4616,10 +3917,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4616
3917
|
infiniteScroll: !0,
|
|
4617
3918
|
footer: { pagination: {
|
|
4618
3919
|
rowCount: t.rows.length,
|
|
4619
|
-
selectedPage:
|
|
3920
|
+
selectedPage: l,
|
|
4620
3921
|
rowsPerPage: {
|
|
4621
3922
|
value: a,
|
|
4622
|
-
onChange: (e) =>
|
|
3923
|
+
onChange: (e) => s(Number(e?.target?.value)),
|
|
4623
3924
|
options: [
|
|
4624
3925
|
{
|
|
4625
3926
|
label: "10 / page",
|
|
@@ -4729,7 +4030,210 @@ const Empty = ({ width: e = "auto", height: t = "auto", text: n = "No data", chi
|
|
|
4729
4030
|
}), extraSeparators = (e) => e?.split(/;|\t|\n/)?.some((e) => {
|
|
4730
4031
|
let t = e?.match(/[.,]/g);
|
|
4731
4032
|
return t && t.length > 1;
|
|
4732
|
-
}), 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 = {
|
|
4733
4237
|
type: MessageType.INFO,
|
|
4734
4238
|
content: ""
|
|
4735
4239
|
}, autoClose: n = 6e3, onClose: r }) => {
|
|
@@ -4784,13 +4288,13 @@ var toggle_module_default = {
|
|
|
4784
4288
|
noMargin: "_noMargin_1c9wf_110",
|
|
4785
4289
|
helpIconEnabled: "_helpIconEnabled_1c9wf_113"
|
|
4786
4290
|
};
|
|
4787
|
-
const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, small: a = !1, onChange: o, noMargin:
|
|
4788
|
-
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;
|
|
4789
4293
|
return /* @__PURE__ */ jsxs("div", {
|
|
4790
|
-
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),
|
|
4791
4295
|
style: { display: i },
|
|
4792
4296
|
onClick: (t) => {
|
|
4793
|
-
|
|
4297
|
+
h || (t.target.name = e, t.target.checked = !n, t.target.value = !n, o(t));
|
|
4794
4298
|
},
|
|
4795
4299
|
"data-testid": l,
|
|
4796
4300
|
children: [
|
|
@@ -4798,19 +4302,22 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4798
4302
|
type: InputType.CHECKBOX,
|
|
4799
4303
|
name: e,
|
|
4800
4304
|
value: n?.toString(),
|
|
4801
|
-
disabled:
|
|
4305
|
+
disabled: h,
|
|
4802
4306
|
checked: n,
|
|
4803
4307
|
onChange: () => {}
|
|
4804
4308
|
}),
|
|
4805
|
-
/* @__PURE__ */ jsx("label", {
|
|
4806
|
-
|
|
4309
|
+
/* @__PURE__ */ jsx("label", {
|
|
4310
|
+
style: { textTransform: f },
|
|
4311
|
+
children: t
|
|
4312
|
+
}),
|
|
4313
|
+
m && /* @__PURE__ */ jsx("div", {
|
|
4807
4314
|
className: toggle_module_default.helpIconEnabled,
|
|
4808
4315
|
onClick: d,
|
|
4809
4316
|
children: /* @__PURE__ */ jsx(HelpIcon, { text: u })
|
|
4810
4317
|
})
|
|
4811
4318
|
]
|
|
4812
4319
|
});
|
|
4813
|
-
}, 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 }) => {
|
|
4814
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({
|
|
4815
4322
|
pastedText: "",
|
|
4816
4323
|
parsedResult: {
|
|
@@ -4831,15 +4338,15 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4831
4338
|
let O = useCallback((t) => {
|
|
4832
4339
|
if (t) {
|
|
4833
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 = {
|
|
4834
|
-
validationRules:
|
|
4341
|
+
validationRules: s,
|
|
4835
4342
|
importLimit: n
|
|
4836
|
-
}, 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);
|
|
4837
4344
|
f(() => D({
|
|
4838
4345
|
parsedResult: {
|
|
4839
4346
|
...N,
|
|
4840
4347
|
rows: t
|
|
4841
4348
|
},
|
|
4842
|
-
pastedText:
|
|
4349
|
+
pastedText: o
|
|
4843
4350
|
})), C.current = E;
|
|
4844
4351
|
} else f(() => {
|
|
4845
4352
|
C.current && D(C.current);
|
|
@@ -4848,7 +4355,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4848
4355
|
}, [
|
|
4849
4356
|
E,
|
|
4850
4357
|
n,
|
|
4851
|
-
|
|
4358
|
+
s
|
|
4852
4359
|
]), k = () => {
|
|
4853
4360
|
D({
|
|
4854
4361
|
pastedText: "",
|
|
@@ -4901,7 +4408,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4901
4408
|
]
|
|
4902
4409
|
}),
|
|
4903
4410
|
_ && /* @__PURE__ */ jsx(Help, {
|
|
4904
|
-
validationRules:
|
|
4411
|
+
validationRules: s,
|
|
4905
4412
|
t: u
|
|
4906
4413
|
}),
|
|
4907
4414
|
R ? /* @__PURE__ */ jsx("div", {
|
|
@@ -4934,7 +4441,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4934
4441
|
},
|
|
4935
4442
|
colored: !0,
|
|
4936
4443
|
loading: d,
|
|
4937
|
-
testId: `${
|
|
4444
|
+
testId: `${h}-paste-from-clipboard-button`
|
|
4938
4445
|
})
|
|
4939
4446
|
]
|
|
4940
4447
|
})
|
|
@@ -4966,7 +4473,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4966
4473
|
} })
|
|
4967
4474
|
]
|
|
4968
4475
|
}), /* @__PURE__ */ jsx(Table$1, {
|
|
4969
|
-
validationRules:
|
|
4476
|
+
validationRules: s,
|
|
4970
4477
|
parsedResult: N,
|
|
4971
4478
|
updateState: (e) => D((t) => ({
|
|
4972
4479
|
...t,
|
|
@@ -4993,7 +4500,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4993
4500
|
onClick: () => f(() => j()),
|
|
4994
4501
|
disabled: R || !F,
|
|
4995
4502
|
loading: d,
|
|
4996
|
-
testId: `${
|
|
4503
|
+
testId: `${h}-paste-with-review-modal-button-okay`
|
|
4997
4504
|
}),
|
|
4998
4505
|
/* @__PURE__ */ jsx(Button, {
|
|
4999
4506
|
label: u("cancel"),
|
|
@@ -5039,7 +4546,75 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5039
4546
|
return;
|
|
5040
4547
|
}
|
|
5041
4548
|
return t;
|
|
5042
|
-
}, [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) => {
|
|
5043
4618
|
let { rows: t } = e, n = Array(t.length);
|
|
5044
4619
|
for (let e = 0; e < t.length; e++) {
|
|
5045
4620
|
let r = t[e], i = Array(r.length);
|
|
@@ -5051,16 +4626,16 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5051
4626
|
rows: n
|
|
5052
4627
|
};
|
|
5053
4628
|
}, useDataImportActions = ({ config: e, state: t, setState: n, smartUploadConfig: r, startTransition: i }) => {
|
|
5054
|
-
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) => {
|
|
5055
4630
|
n((t) => ({
|
|
5056
4631
|
...t,
|
|
5057
4632
|
...e
|
|
5058
4633
|
}));
|
|
5059
|
-
}, [n]),
|
|
4634
|
+
}, [n]), b = useCallback(({ name: e, callback: n } = {}) => {
|
|
5060
4635
|
let r = { ...t.modalVisibility }, i = !e, a = [];
|
|
5061
4636
|
if (i) for (let e of Object.keys(r)) a.push(e), r[e] = !1;
|
|
5062
4637
|
else r?.[e] && (a.push(e), r[e] = !1);
|
|
5063
|
-
a
|
|
4638
|
+
a.length > 0 && y({
|
|
5064
4639
|
modalVisibility: r,
|
|
5065
4640
|
pastedText: "",
|
|
5066
4641
|
parsedResult: {
|
|
@@ -5070,9 +4645,9 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5070
4645
|
units: [],
|
|
5071
4646
|
errors: []
|
|
5072
4647
|
}
|
|
5073
|
-
}), typeof n == "function" && a
|
|
5074
|
-
}, [t.modalVisibility,
|
|
5075
|
-
i(() =>
|
|
4648
|
+
}), typeof n == "function" && a.length > 0 && n();
|
|
4649
|
+
}, [t.modalVisibility, y]), x = useCallback(() => {
|
|
4650
|
+
i(() => y({
|
|
5076
4651
|
pastedText: "",
|
|
5077
4652
|
parsedResult: {
|
|
5078
4653
|
isValid: !1,
|
|
@@ -5081,52 +4656,55 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5081
4656
|
units: [],
|
|
5082
4657
|
errors: []
|
|
5083
4658
|
}
|
|
5084
|
-
})),
|
|
5085
|
-
}, [t.modalVisibility,
|
|
5086
|
-
|
|
4659
|
+
})), m && m?.("all");
|
|
4660
|
+
}, [t.modalVisibility, y]), S = useCallback((e, n) => {
|
|
4661
|
+
y({ modalVisibility: {
|
|
5087
4662
|
...t.modalVisibility,
|
|
5088
4663
|
[e]: n
|
|
5089
4664
|
} });
|
|
5090
|
-
}, [t.modalVisibility,
|
|
4665
|
+
}, [t.modalVisibility, y]), C = useCallback(async (e) => {
|
|
5091
4666
|
let t = {
|
|
5092
|
-
validationRules:
|
|
4667
|
+
validationRules: l,
|
|
5093
4668
|
importLimit: c
|
|
5094
|
-
}, n = await
|
|
5095
|
-
if (
|
|
4669
|
+
}, n = await parse(e, t, _), r = normalizeParsedResult(n);
|
|
4670
|
+
if (g && g(h)) {
|
|
5096
4671
|
let { fields: e, units: n, rows: a, isValid: o } = r, s = unParse(e, n ?? [], a, t);
|
|
5097
|
-
return i(() =>
|
|
4672
|
+
return i(() => y({
|
|
5098
4673
|
pastedText: s,
|
|
5099
|
-
parsedResult:
|
|
4674
|
+
parsedResult: h
|
|
5100
4675
|
})), r;
|
|
5101
4676
|
}
|
|
5102
|
-
return i(() =>
|
|
4677
|
+
return i(() => y({
|
|
5103
4678
|
pastedText: e,
|
|
5104
4679
|
parsedResult: r
|
|
5105
4680
|
})), r;
|
|
5106
4681
|
}, [
|
|
5107
|
-
|
|
4682
|
+
l,
|
|
5108
4683
|
c,
|
|
4684
|
+
_,
|
|
5109
4685
|
g,
|
|
5110
4686
|
h,
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
]), T = useCallback(async (e) => {
|
|
4687
|
+
y
|
|
4688
|
+
]), w = useCallback(async (e) => {
|
|
5114
4689
|
let { fromFile: t, showSuccessToast: n = !0 } = e ?? {}, r;
|
|
5115
4690
|
try {
|
|
5116
4691
|
if (r = t ? await t.text() : await navigator.clipboard.readText(), !r) {
|
|
5117
4692
|
transitionToast({ message: {
|
|
5118
4693
|
type: "Error",
|
|
5119
|
-
content:
|
|
4694
|
+
content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed")
|
|
5120
4695
|
} }, i);
|
|
5121
4696
|
return;
|
|
5122
4697
|
}
|
|
5123
|
-
let e = await
|
|
4698
|
+
let e = await parse(r, {
|
|
4699
|
+
validationRules: l,
|
|
4700
|
+
importLimit: c
|
|
4701
|
+
}, _), a = normalizeParsedResult(e);
|
|
5124
4702
|
return a?.isValid || transitionToast({ message: {
|
|
5125
4703
|
type: "Error",
|
|
5126
|
-
content:
|
|
4704
|
+
content: _("clipboardReadFailed")
|
|
5127
4705
|
} }, i), n && transitionToast({ message: {
|
|
5128
4706
|
type: "Success",
|
|
5129
|
-
content:
|
|
4707
|
+
content: _("pasteSuccessful")
|
|
5130
4708
|
} }, i), {
|
|
5131
4709
|
pastedText: r,
|
|
5132
4710
|
parsedResult: a
|
|
@@ -5134,78 +4712,78 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5134
4712
|
} catch (e) {
|
|
5135
4713
|
transitionToast({ message: {
|
|
5136
4714
|
type: "Error",
|
|
5137
|
-
content:
|
|
4715
|
+
content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed"),
|
|
5138
4716
|
details: e.message
|
|
5139
4717
|
} }, i);
|
|
5140
4718
|
return;
|
|
5141
4719
|
}
|
|
5142
|
-
}, [
|
|
4720
|
+
}, [l, c]), T = useCallback(async (e) => {
|
|
5143
4721
|
let t = e?.target?.files?.[0];
|
|
5144
4722
|
if (!t) return;
|
|
5145
|
-
let n = await t.text(), r = await
|
|
5146
|
-
r.isValid ? (
|
|
4723
|
+
let n = await t.text(), r = await C(n);
|
|
4724
|
+
r.isValid ? (f || transitionToast({ message: {
|
|
5147
4725
|
type: "Success",
|
|
5148
|
-
content:
|
|
5149
|
-
} }, i), i(() =>
|
|
4726
|
+
content: _("pasteSuccessful")
|
|
4727
|
+
} }, i), i(() => d(r))) : transitionToast({ message: {
|
|
5150
4728
|
type: "Error",
|
|
5151
|
-
content:
|
|
4729
|
+
content: _("fileParsingFailed")
|
|
5152
4730
|
} }, i);
|
|
5153
4731
|
}, [
|
|
5154
|
-
|
|
4732
|
+
l,
|
|
5155
4733
|
c,
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
]),
|
|
4734
|
+
y,
|
|
4735
|
+
d
|
|
4736
|
+
]), E = useCallback(async (e = !0) => {
|
|
5159
4737
|
try {
|
|
5160
4738
|
let t = await navigator.clipboard.readText();
|
|
5161
4739
|
if (!t) {
|
|
5162
4740
|
transitionToast({ message: {
|
|
5163
4741
|
type: "Error",
|
|
5164
|
-
content:
|
|
4742
|
+
content: _("clipboardIsEmpty")
|
|
5165
4743
|
} }, i);
|
|
5166
4744
|
return;
|
|
5167
4745
|
}
|
|
5168
|
-
let n = await
|
|
4746
|
+
let n = await C(t);
|
|
5169
4747
|
if (!n.isValid) {
|
|
5170
4748
|
transitionToast({ message: {
|
|
5171
4749
|
type: "Error",
|
|
5172
|
-
content:
|
|
4750
|
+
content: _("clipboardReadFailed")
|
|
5173
4751
|
} }, i);
|
|
5174
4752
|
return;
|
|
5175
4753
|
}
|
|
5176
|
-
|
|
4754
|
+
f || transitionToast({ message: {
|
|
5177
4755
|
type: "Success",
|
|
5178
|
-
content:
|
|
5179
|
-
} }, i), e && i(() =>
|
|
4756
|
+
content: _("pasteSuccessful")
|
|
4757
|
+
} }, i), e && i(() => d(n));
|
|
5180
4758
|
} catch {
|
|
5181
4759
|
transitionToast({ message: {
|
|
5182
4760
|
type: "Error",
|
|
5183
|
-
content:
|
|
4761
|
+
content: _("clipboardReadNotAllowed")
|
|
5184
4762
|
} }, i);
|
|
5185
4763
|
}
|
|
5186
4764
|
}, [
|
|
5187
|
-
|
|
4765
|
+
l,
|
|
5188
4766
|
c,
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
]),
|
|
5193
|
-
let t = await
|
|
4767
|
+
_,
|
|
4768
|
+
y,
|
|
4769
|
+
d
|
|
4770
|
+
]), D = useCallback(async (e) => {
|
|
4771
|
+
let t = await v();
|
|
5194
4772
|
if (!t) return;
|
|
5195
|
-
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: " " });
|
|
5196
4774
|
try {
|
|
5197
4775
|
await navigator.clipboard.writeText(l), transitionToast({ message: {
|
|
5198
4776
|
type: "Success",
|
|
5199
|
-
content:
|
|
4777
|
+
content: _("copiedToClipboard")
|
|
5200
4778
|
} }, i);
|
|
5201
4779
|
} catch (e) {
|
|
5202
4780
|
transitionToast({ message: {
|
|
5203
4781
|
type: "Error",
|
|
5204
|
-
content:
|
|
4782
|
+
content: _("unableToCopyToClipboard"),
|
|
5205
4783
|
details: e.message
|
|
5206
4784
|
} }, i);
|
|
5207
4785
|
}
|
|
5208
|
-
}, [
|
|
4786
|
+
}, [v, _]), O = useCallback((e) => {
|
|
5209
4787
|
if (!e || e.errorMessage) {
|
|
5210
4788
|
transitionToast({ message: {
|
|
5211
4789
|
type: "Error",
|
|
@@ -5220,24 +4798,24 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5220
4798
|
rows: n.map((e) => Object.values(e)),
|
|
5221
4799
|
errors: []
|
|
5222
4800
|
};
|
|
5223
|
-
i(() =>
|
|
4801
|
+
i(() => y({ parsedResult: a })), i(() => d(a));
|
|
5224
4802
|
let { onComplete: o } = r ?? {};
|
|
5225
|
-
typeof o == "function" && o(a),
|
|
4803
|
+
typeof o == "function" && o(a), b();
|
|
5226
4804
|
}, [
|
|
5227
|
-
|
|
5228
|
-
|
|
4805
|
+
y,
|
|
4806
|
+
d,
|
|
5229
4807
|
r
|
|
5230
4808
|
]);
|
|
5231
4809
|
return {
|
|
5232
|
-
updateState:
|
|
5233
|
-
closeModals:
|
|
5234
|
-
setModalVisibility:
|
|
5235
|
-
readAndParseInput:
|
|
5236
|
-
onFileChange:
|
|
5237
|
-
onClickQuickPasteFromClipBoard:
|
|
5238
|
-
onClickCopyClipboard:
|
|
5239
|
-
onSmartUploadResult:
|
|
5240
|
-
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
|
|
5241
4819
|
};
|
|
5242
4820
|
}, onClickDownLoad = (e, t) => {
|
|
5243
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");
|
|
@@ -5273,167 +4851,165 @@ var initialState = {
|
|
|
5273
4851
|
helpModal: !1
|
|
5274
4852
|
}
|
|
5275
4853
|
};
|
|
5276
|
-
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n
|
|
5277
|
-
let { exportData:
|
|
5278
|
-
useRegisterValidationRules(r ?? b, s);
|
|
5279
|
-
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({
|
|
5280
4856
|
config: e,
|
|
5281
|
-
state:
|
|
5282
|
-
setState:
|
|
4857
|
+
state: y,
|
|
4858
|
+
setState: b,
|
|
5283
4859
|
smartUploadConfig: t,
|
|
5284
|
-
startTransition:
|
|
4860
|
+
startTransition: M
|
|
5285
4861
|
}) ?? {};
|
|
5286
|
-
useKeyboardEvent("Escape", () =>
|
|
5287
|
-
let
|
|
4862
|
+
useKeyboardEvent("Escape", () => F());
|
|
4863
|
+
let H = u ? [
|
|
5288
4864
|
{
|
|
5289
4865
|
type: "Option",
|
|
5290
|
-
label:
|
|
4866
|
+
label: k("uploadFile"),
|
|
5291
4867
|
upload: !0,
|
|
5292
4868
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5293
|
-
onChange:
|
|
4869
|
+
onChange: L,
|
|
5294
4870
|
testId: `${n}-option-upload-file`
|
|
5295
4871
|
},
|
|
5296
|
-
...
|
|
4872
|
+
...d ? [{
|
|
5297
4873
|
type: "Option",
|
|
5298
|
-
label:
|
|
5299
|
-
onClick:
|
|
4874
|
+
label: k("quickPasteFromClipboard"),
|
|
4875
|
+
onClick: R,
|
|
5300
4876
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
5301
4877
|
}] : [],
|
|
5302
|
-
...
|
|
4878
|
+
...d ? [{
|
|
5303
4879
|
type: "Option",
|
|
5304
|
-
label:
|
|
5305
|
-
onClick: () =>
|
|
4880
|
+
label: k("pasteWithReview"),
|
|
4881
|
+
onClick: () => I("reviewPasteModal", !S),
|
|
5306
4882
|
testId: `${n}-paste-with-review`
|
|
5307
4883
|
}] : [],
|
|
5308
|
-
...
|
|
4884
|
+
...T && w && t ? [{
|
|
5309
4885
|
type: "Option",
|
|
5310
|
-
label:
|
|
5311
|
-
onClick: () =>
|
|
4886
|
+
label: k("smartUpload_smartUpload"),
|
|
4887
|
+
onClick: () => I("smartUploadModal", !x),
|
|
5312
4888
|
testId: `${n}-smart-upload`
|
|
5313
4889
|
}] : [],
|
|
5314
|
-
...applyModalHandlers(
|
|
5315
|
-
] : [],
|
|
4890
|
+
...applyModalHandlers(_?.importOptions ?? [], y, I)
|
|
4891
|
+
] : [], U = [
|
|
5316
4892
|
{
|
|
5317
4893
|
type: "Option",
|
|
5318
|
-
label:
|
|
4894
|
+
label: k("downloadFile"),
|
|
5319
4895
|
onClick: async () => {
|
|
5320
|
-
let e = await
|
|
5321
|
-
e && e && onClickDownLoad(e,
|
|
4896
|
+
let e = await A();
|
|
4897
|
+
e && e && onClickDownLoad(e, s);
|
|
5322
4898
|
}
|
|
5323
4899
|
},
|
|
5324
|
-
...
|
|
4900
|
+
...l ? [{
|
|
5325
4901
|
type: "Option",
|
|
5326
|
-
label:
|
|
5327
|
-
onClick: () =>
|
|
4902
|
+
label: k("copyToClipboard"),
|
|
4903
|
+
onClick: () => z("dot")
|
|
5328
4904
|
}] : [{
|
|
5329
4905
|
type: "Menu",
|
|
5330
4906
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
5331
4907
|
menu: {
|
|
5332
4908
|
trigger: "Text",
|
|
5333
|
-
label:
|
|
4909
|
+
label: k("copyToClipboard"),
|
|
5334
4910
|
sections: [{
|
|
5335
4911
|
type: "Option",
|
|
5336
|
-
label:
|
|
5337
|
-
onClick: () =>
|
|
4912
|
+
label: k("copyDecimalDot"),
|
|
4913
|
+
onClick: () => z("dot"),
|
|
5338
4914
|
testId: `${n}-option-copy-decimal-dot`
|
|
5339
4915
|
}, {
|
|
5340
4916
|
type: "Option",
|
|
5341
|
-
label:
|
|
5342
|
-
onClick: () =>
|
|
4917
|
+
label: k("copyDecimalComma"),
|
|
4918
|
+
onClick: () => z("comma")
|
|
5343
4919
|
}]
|
|
5344
4920
|
}
|
|
5345
4921
|
}],
|
|
5346
|
-
...applyModalHandlers(
|
|
5347
|
-
],
|
|
4922
|
+
...applyModalHandlers(_?.exportOptions ?? [], y, I)
|
|
4923
|
+
], W = f ? [{
|
|
5348
4924
|
type: "Option",
|
|
5349
|
-
label:
|
|
5350
|
-
onClick: () =>
|
|
4925
|
+
label: k("deleteAllRows"),
|
|
4926
|
+
onClick: () => V(),
|
|
5351
4927
|
testId: `${n}-delete-all-rows`
|
|
5352
|
-
}, ...applyModalHandlers(
|
|
4928
|
+
}, ...applyModalHandlers(_?.deleteOptions ?? [], y, I)] : [], G = p ? [
|
|
5353
4929
|
{ type: "Divider" },
|
|
5354
4930
|
{
|
|
5355
4931
|
type: "Option",
|
|
5356
|
-
label:
|
|
5357
|
-
onClick: () =>
|
|
4932
|
+
label: k("help"),
|
|
4933
|
+
onClick: () => I("helpModal", !C)
|
|
5358
4934
|
},
|
|
5359
|
-
...applyModalHandlers(
|
|
5360
|
-
] : [],
|
|
5361
|
-
...
|
|
5362
|
-
section: [...
|
|
4935
|
+
...applyModalHandlers(_?.helpOptions ?? [], y, I)
|
|
4936
|
+
] : [], K = [
|
|
4937
|
+
...H.length ? [{
|
|
4938
|
+
section: [...H, ...G],
|
|
5363
4939
|
name: "import-options",
|
|
5364
4940
|
iconName: "upload",
|
|
5365
|
-
tooltip:
|
|
4941
|
+
tooltip: k("import")
|
|
5366
4942
|
}] : [],
|
|
5367
|
-
...
|
|
5368
|
-
section:
|
|
4943
|
+
...U.length ? [{
|
|
4944
|
+
section: U,
|
|
5369
4945
|
name: "export-options",
|
|
5370
4946
|
iconName: "download",
|
|
5371
|
-
tooltip:
|
|
4947
|
+
tooltip: k("export")
|
|
5372
4948
|
}] : [],
|
|
5373
|
-
...
|
|
5374
|
-
section:
|
|
4949
|
+
...W.length ? [{
|
|
4950
|
+
section: W,
|
|
5375
4951
|
name: "delete-options",
|
|
5376
4952
|
iconName: "delete",
|
|
5377
|
-
tooltip:
|
|
4953
|
+
tooltip: k("deleteAllRows")
|
|
5378
4954
|
}] : []
|
|
5379
4955
|
];
|
|
5380
4956
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
5381
|
-
|
|
4957
|
+
j && /* @__PURE__ */ jsx(Spinner, {
|
|
5382
4958
|
small: !0,
|
|
5383
4959
|
dark: !0
|
|
5384
4960
|
}),
|
|
5385
|
-
|
|
4961
|
+
K.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
5386
4962
|
sections: e.section,
|
|
5387
4963
|
iconName: e.iconName,
|
|
5388
4964
|
tooltip: e.tooltip,
|
|
5389
4965
|
testId: `data-${e?.name}-menu`
|
|
5390
4966
|
}, t)),
|
|
5391
|
-
|
|
4967
|
+
S && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
5392
4968
|
config: e,
|
|
5393
|
-
state:
|
|
5394
|
-
updateState:
|
|
5395
|
-
setModalVisibility:
|
|
5396
|
-
readAndParseInput:
|
|
5397
|
-
onCloseModal:
|
|
5398
|
-
validationRules:
|
|
5399
|
-
onCompleteImport:
|
|
5400
|
-
prevalidationConfig:
|
|
5401
|
-
t:
|
|
5402
|
-
loading:
|
|
5403
|
-
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,
|
|
5404
4980
|
testId: n
|
|
5405
4981
|
}),
|
|
5406
|
-
|
|
5407
|
-
visible: T,
|
|
5408
|
-
setModalVisibility: R,
|
|
5409
|
-
validationRules: s,
|
|
5410
|
-
t: j
|
|
5411
|
-
}),
|
|
5412
|
-
E && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
4982
|
+
C && /* @__PURE__ */ jsx(HelpModal, {
|
|
5413
4983
|
visible: C,
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
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"),
|
|
5425
5001
|
testId: n
|
|
5426
5002
|
}),
|
|
5427
5003
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5428
|
-
modals:
|
|
5429
|
-
modalVisibility:
|
|
5430
|
-
onCloseModal:
|
|
5004
|
+
modals: g,
|
|
5005
|
+
modalVisibility: y?.modalVisibility,
|
|
5006
|
+
onCloseModal: F,
|
|
5431
5007
|
testId: n
|
|
5432
5008
|
})
|
|
5433
5009
|
] });
|
|
5434
5010
|
}, FileButton = ({ file: e, accept: t, multi: n, name: r, disabled: i, onChange: a = noop,...o }) => {
|
|
5435
|
-
let
|
|
5436
|
-
i ||
|
|
5011
|
+
let c = useContext(DisabledContext), l = useRef(null), u = () => {
|
|
5012
|
+
i || c || l.current?.click();
|
|
5437
5013
|
}, d = (e) => {
|
|
5438
5014
|
let t = n ? e.target.files : e.target.files?.[0], r = {
|
|
5439
5015
|
...e,
|
|
@@ -5712,15 +5288,15 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5712
5288
|
},
|
|
5713
5289
|
children: e.content
|
|
5714
5290
|
}) : null, ListSubheading = forwardRef(({ item: e, index: t }, n) => {
|
|
5715
|
-
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;
|
|
5716
5292
|
return /* @__PURE__ */ jsx("div", {
|
|
5717
5293
|
ref: (e) => {
|
|
5718
5294
|
n && "current" in n && Array.isArray(n.current) && t !== void 0 && (n.current[t] = e);
|
|
5719
5295
|
},
|
|
5720
5296
|
"data-testid": f ?? null,
|
|
5721
|
-
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 : ""),
|
|
5722
5298
|
onClick: (e) => {
|
|
5723
|
-
|
|
5299
|
+
c && c(e);
|
|
5724
5300
|
},
|
|
5725
5301
|
title: l,
|
|
5726
5302
|
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -5745,7 +5321,7 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5745
5321
|
}) })
|
|
5746
5322
|
});
|
|
5747
5323
|
}), ListRow = forwardRef(({ item: e, index: t, expanding: n, invokeEditOnRowClick: r, draggable: i }, a) => {
|
|
5748
|
-
let o = useContext(DisabledContext),
|
|
5324
|
+
let o = useContext(DisabledContext), c = (e, t, s, c, l, u) => {
|
|
5749
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";
|
|
5750
5326
|
return /* @__PURE__ */ jsx(m, {
|
|
5751
5327
|
href: t.url,
|
|
@@ -5799,16 +5375,16 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5799
5375
|
item: e,
|
|
5800
5376
|
index: t
|
|
5801
5377
|
}, t) : i ? ((e, t) => {
|
|
5802
|
-
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({
|
|
5803
5379
|
id: e.toString(),
|
|
5804
5380
|
animateLayoutChanges: () => !1
|
|
5805
5381
|
}), l = {
|
|
5806
5382
|
transform: CSS.Translate.toString(a),
|
|
5807
5383
|
transition: o,
|
|
5808
|
-
opacity:
|
|
5384
|
+
opacity: s ? 0 : 1
|
|
5809
5385
|
};
|
|
5810
|
-
return
|
|
5811
|
-
})(t, e) :
|
|
5386
|
+
return c(e, t, l, n, r, i);
|
|
5387
|
+
})(t, e) : c(t, e);
|
|
5812
5388
|
}), ListDragWrapper = ({ children: e, draggable: t, list: n, onListReorder: r }) => {
|
|
5813
5389
|
let [i, a] = useState(null), o = (e) => {
|
|
5814
5390
|
a(e.active.id);
|
|
@@ -5841,9 +5417,9 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5841
5417
|
}), document.body)]
|
|
5842
5418
|
}) : e;
|
|
5843
5419
|
}, ListVirtualScrollWrapper = ({ items: e, scrollDetails: t, children: n }) => {
|
|
5844
|
-
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll:
|
|
5420
|
+
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll: s } = t, l = useRef(null), u = useVirtualizer({
|
|
5845
5421
|
count: e.length,
|
|
5846
|
-
getScrollElement: () =>
|
|
5422
|
+
getScrollElement: () => l.current,
|
|
5847
5423
|
estimateSize: useCallback(() => {
|
|
5848
5424
|
let t = 37;
|
|
5849
5425
|
if (e.length > 0) {
|
|
@@ -5865,8 +5441,8 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5865
5441
|
f(t);
|
|
5866
5442
|
}
|
|
5867
5443
|
}, [a]), /* @__PURE__ */ jsx("div", {
|
|
5868
|
-
className: cx(list_module_default.listContent, r ||
|
|
5869
|
-
ref:
|
|
5444
|
+
className: cx(list_module_default.listContent, r || s ? list_module_default.scrollableList : "", i ? list_module_default.hideScrollbar : ""),
|
|
5445
|
+
ref: l,
|
|
5870
5446
|
children: /* @__PURE__ */ jsx("div", {
|
|
5871
5447
|
className: list_module_default.virtualRows,
|
|
5872
5448
|
style: { height: `${u.getTotalSize()}px` },
|
|
@@ -6110,8 +5686,8 @@ var radio_button_module_default = {
|
|
|
6110
5686
|
isInTable: "_isInTable_1fbik_106",
|
|
6111
5687
|
helpIconEnabled: "_helpIconEnabled_1fbik_111"
|
|
6112
5688
|
};
|
|
6113
|
-
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 }) => {
|
|
6114
|
-
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;
|
|
6115
5691
|
return /* @__PURE__ */ jsxs("div", {
|
|
6116
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),
|
|
6117
5693
|
onClick: o,
|
|
@@ -6127,21 +5703,22 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
6127
5703
|
/* @__PURE__ */ jsx("label", {
|
|
6128
5704
|
"data-name": e,
|
|
6129
5705
|
"data-value": n,
|
|
5706
|
+
style: { textTransform: d },
|
|
6130
5707
|
children: t
|
|
6131
5708
|
}),
|
|
6132
|
-
|
|
5709
|
+
f && /* @__PURE__ */ jsx("div", {
|
|
6133
5710
|
className: radio_button_module_default.helpIconEnabled,
|
|
6134
5711
|
onClick: u,
|
|
6135
5712
|
children: /* @__PURE__ */ jsx(HelpIcon, { text: l })
|
|
6136
5713
|
})
|
|
6137
5714
|
]
|
|
6138
5715
|
});
|
|
6139
|
-
}, RadioButton = ({ name: e, label: t, options: n, value: r, onChange: i, disabled: a = !1, small: o = !1, noMargin:
|
|
6140
|
-
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 ? {
|
|
6141
5718
|
simpleInputs: !1,
|
|
6142
5719
|
options: f,
|
|
6143
5720
|
selectedOptions: void 0
|
|
6144
|
-
} : 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;
|
|
6145
5722
|
return /* @__PURE__ */ jsxs("div", {
|
|
6146
5723
|
className: cx(radio_button_module_default.wrapper, u ? radio_button_module_default.inline : null, p === "inline fields" ? radio_button_module_default.inline : null),
|
|
6147
5724
|
children: [d && /* @__PURE__ */ jsx("label", {
|
|
@@ -6156,13 +5733,14 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
6156
5733
|
selected: r,
|
|
6157
5734
|
disabled: a || t.disabled || m,
|
|
6158
5735
|
small: o,
|
|
6159
|
-
noMargin:
|
|
5736
|
+
noMargin: c,
|
|
6160
5737
|
onChange: t.disabled ? void 0 : (n) => {
|
|
6161
5738
|
h ? l(n.target) : (n.target.name = e, n.target.value = t.value.toString(), n.target.label = t.label.toString(), i && i(n));
|
|
6162
5739
|
},
|
|
6163
5740
|
testId: t.testId,
|
|
6164
5741
|
helpText: t.helpText,
|
|
6165
|
-
onClickHelp: t.onClickHelp
|
|
5742
|
+
onClickHelp: t.onClickHelp,
|
|
5743
|
+
textTransform: t.textTransform
|
|
6166
5744
|
}, n);
|
|
6167
5745
|
})]
|
|
6168
5746
|
});
|
|
@@ -6232,7 +5810,7 @@ var rich_text_input_module_default = {
|
|
|
6232
5810
|
richTextInput: "_richTextInput_1fb4l_77"
|
|
6233
5811
|
};
|
|
6234
5812
|
const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
|
|
6235
|
-
let o = useContext(DisabledContext),
|
|
5813
|
+
let o = useContext(DisabledContext), c = r || o, { manager: u, state: d, setState: f, getContext: p } = useRemirror({
|
|
6236
5814
|
extensions: () => [
|
|
6237
5815
|
new BoldExtension({}),
|
|
6238
5816
|
new BulletListExtension({}),
|
|
@@ -6249,31 +5827,31 @@ const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disab
|
|
|
6249
5827
|
return useImperativeHandle(a, () => p(), [p]), /* @__PURE__ */ jsx("div", {
|
|
6250
5828
|
className: rich_text_input_module_default.richTextInput,
|
|
6251
5829
|
children: /* @__PURE__ */ jsxs(Remirror, {
|
|
6252
|
-
manager:
|
|
5830
|
+
manager: u,
|
|
6253
5831
|
state: d,
|
|
6254
5832
|
placeholder: e,
|
|
6255
5833
|
onChange: ({ helpers: e, state: n }) => {
|
|
6256
5834
|
let r = e.getMarkdown(n);
|
|
6257
5835
|
t && t(r), f(n);
|
|
6258
5836
|
},
|
|
6259
|
-
editable: !
|
|
5837
|
+
editable: !c,
|
|
6260
5838
|
children: [/* @__PURE__ */ jsx(RichTextToolbar, {
|
|
6261
|
-
disabled:
|
|
5839
|
+
disabled: c,
|
|
6262
5840
|
toolbarComponent: i
|
|
6263
5841
|
}), /* @__PURE__ */ jsx(EditorComponent, {})]
|
|
6264
5842
|
})
|
|
6265
5843
|
});
|
|
6266
5844
|
});
|
|
6267
5845
|
var row_module_default = { row: "_row_n16je_1" };
|
|
6268
|
-
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 }) => {
|
|
6269
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));
|
|
6270
5848
|
return /* @__PURE__ */ jsx("div", {
|
|
6271
5849
|
className: cx(row_module_default.row),
|
|
6272
5850
|
style: {
|
|
6273
5851
|
alignItems: t,
|
|
6274
5852
|
justifyContent: n,
|
|
6275
|
-
flexGrow:
|
|
6276
|
-
flexShrink:
|
|
5853
|
+
flexGrow: a ? 1 : 0,
|
|
5854
|
+
flexShrink: a ? 1 : 0,
|
|
6277
5855
|
flexWrap: u ? "wrap" : "nowrap",
|
|
6278
5856
|
height: o,
|
|
6279
5857
|
marginLeft: `calc(${f} * -0.5)`,
|
|
@@ -6423,7 +6001,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6423
6001
|
}, Content$1 = ({ children: e, activeTabIndex: t, contentPadding: n }) => Array.isArray(e) ? /* @__PURE__ */ jsx("div", {
|
|
6424
6002
|
className: cx(n ? tabs_module_default.contentPadding : ""),
|
|
6425
6003
|
children: e.map((e, n) => t === n && e)
|
|
6426
|
-
}) : 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 }) => {
|
|
6427
6005
|
let p = useContext(DisabledContext), m = l !== void 0, h = n ? n.map((e, t) => ({
|
|
6428
6006
|
value: t,
|
|
6429
6007
|
url: e.props.url,
|
|
@@ -6432,11 +6010,11 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6432
6010
|
disabled: e.props.disabled || p,
|
|
6433
6011
|
badge: e.props.badge,
|
|
6434
6012
|
testId: e.props?.testId && `${e.props.testId}-${t}`
|
|
6435
|
-
})) : t || d, { simpleInputs:
|
|
6013
|
+
})) : t || d, { simpleInputs: _, options: v, selectedOptions: y } = m ? {
|
|
6436
6014
|
simpleInputs: !1,
|
|
6437
6015
|
options: h,
|
|
6438
6016
|
selectedOptions: void 0
|
|
6439
|
-
} : 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) => {
|
|
6440
6018
|
if (m) {
|
|
6441
6019
|
let e = n.key || n.label || null;
|
|
6442
6020
|
l(t, e);
|
|
@@ -6465,7 +6043,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6465
6043
|
children: v.map(w)
|
|
6466
6044
|
}), /* @__PURE__ */ jsx(Content$1, {
|
|
6467
6045
|
activeTabIndex: S ?? 0,
|
|
6468
|
-
contentPadding:
|
|
6046
|
+
contentPadding: c,
|
|
6469
6047
|
children: n
|
|
6470
6048
|
})] }) : null;
|
|
6471
6049
|
}, TextLink = ({ children: e, href: t = void 0, target: n = void 0, testId: r, onClick: i, component: a = "a" }) => /* @__PURE__ */ jsx(a, {
|
|
@@ -6491,7 +6069,7 @@ var textarea_module_default = {
|
|
|
6491
6069
|
small: "_small_q0tl0_116",
|
|
6492
6070
|
monospace: "_monospace_q0tl0_155"
|
|
6493
6071
|
};
|
|
6494
|
-
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 }) => {
|
|
6495
6073
|
let b = useContext(DisabledContext), x = /* @__PURE__ */ jsx("textarea", {
|
|
6496
6074
|
className: cx(textarea_module_default.textarea, f ? textarea_module_default.error : "", p ? textarea_module_default.warning : "", v ? textarea_module_default.monospace : ""),
|
|
6497
6075
|
name: e,
|
|
@@ -6501,11 +6079,11 @@ const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows:
|
|
|
6501
6079
|
rows: i,
|
|
6502
6080
|
onChange: o,
|
|
6503
6081
|
disabled: a || b,
|
|
6504
|
-
onKeyPress:
|
|
6082
|
+
onKeyPress: c,
|
|
6505
6083
|
onFocus: l,
|
|
6506
6084
|
onBlur: u,
|
|
6507
6085
|
tabIndex: d,
|
|
6508
|
-
style: { resize:
|
|
6086
|
+
style: { resize: _ },
|
|
6509
6087
|
"data-error": f || null,
|
|
6510
6088
|
"data-warning": p || null,
|
|
6511
6089
|
"data-testid": y
|
|
@@ -6585,9 +6163,9 @@ const Warning = ({ warning: e }) => /* @__PURE__ */ jsx("div", {
|
|
|
6585
6163
|
let ElementType = /* @__PURE__ */ function(e) {
|
|
6586
6164
|
return e.LINK = "Link", e.BUTTON = "Button", e.MENU = "Menu", e.COMPONENT = "Component", e;
|
|
6587
6165
|
}({});
|
|
6588
|
-
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" }) => {
|
|
6589
6167
|
let l = useContext(DisabledContext);
|
|
6590
|
-
return /* @__PURE__ */ jsxs(
|
|
6168
|
+
return /* @__PURE__ */ jsxs(c, {
|
|
6591
6169
|
className: cx(top_bar_module_default.link, i ? top_bar_module_default.active : ""),
|
|
6592
6170
|
href: t || "#",
|
|
6593
6171
|
to: t,
|
|
@@ -6732,16 +6310,16 @@ var tree_module_default = {
|
|
|
6732
6310
|
placeholder: "_placeholder_15yn1_29"
|
|
6733
6311
|
};
|
|
6734
6312
|
const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, draggable: o, icons: s, onDrop: c }) => {
|
|
6735
|
-
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) => {
|
|
6736
6314
|
e.stopPropagation(), i(l);
|
|
6737
6315
|
}, x = (e) => {
|
|
6738
|
-
e.preventDefault(), e.stopPropagation(), h || (
|
|
6316
|
+
e.preventDefault(), e.stopPropagation(), h || (_(!0), y((/* @__PURE__ */ new Date()).getTime()));
|
|
6739
6317
|
}, S = (e) => {
|
|
6740
|
-
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 &&
|
|
6318
|
+
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 && _(!1);
|
|
6741
6319
|
}, C = (e) => {
|
|
6742
6320
|
e.preventDefault(), e.stopPropagation(), a && !r && (/* @__PURE__ */ new Date()).getTime() - v > 200 && b(e);
|
|
6743
6321
|
}, w = (e) => {
|
|
6744
|
-
e.preventDefault(), e.stopPropagation(),
|
|
6322
|
+
e.preventDefault(), e.stopPropagation(), _(!1), y((/* @__PURE__ */ new Date()).getTime()), c?.(e);
|
|
6745
6323
|
};
|
|
6746
6324
|
return /* @__PURE__ */ jsx("div", {
|
|
6747
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 : ""),
|
|
@@ -6969,18 +6547,18 @@ var unit_input_module_default = {
|
|
|
6969
6547
|
predefinedMenuActive: "_predefinedMenuActive_ye9w9_1",
|
|
6970
6548
|
inputWrapper: "_inputWrapper_ye9w9_4"
|
|
6971
6549
|
};
|
|
6972
|
-
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 = () => ({
|
|
6973
6551
|
name: "",
|
|
6974
6552
|
error: null
|
|
6975
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 }) => {
|
|
6976
6554
|
let L = useUnitContext(), R = useRunAfterUpdate();
|
|
6977
|
-
typeof
|
|
6978
|
-
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), [
|
|
6979
6557
|
u,
|
|
6980
6558
|
b,
|
|
6981
6559
|
L?.unitTemplate
|
|
6982
|
-
]), H = isKnownUnit(
|
|
6983
|
-
value:
|
|
6560
|
+
]), H = isKnownUnit(l, V), U = f || V || B, W = usePrevious(U), { value: G } = safeConvertValue({
|
|
6561
|
+
value: l,
|
|
6984
6562
|
toUnit: U,
|
|
6985
6563
|
unitkey: u,
|
|
6986
6564
|
defaultFromUnit: B,
|
|
@@ -6991,17 +6569,17 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6991
6569
|
} : {
|
|
6992
6570
|
value: G,
|
|
6993
6571
|
unit: U
|
|
6994
|
-
}),
|
|
6572
|
+
}), wu = k || K?.value === void 0, [J, Tu] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Eu = !!(O || n), Y = C && C.find((e) => {
|
|
6995
6573
|
if (!e?.value) return;
|
|
6996
6574
|
if (E) return E === e.valueKey;
|
|
6997
|
-
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n =
|
|
6998
|
-
value: String(
|
|
6575
|
+
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
6576
|
+
value: String(l),
|
|
6999
6577
|
unitkey: u,
|
|
7000
6578
|
toUnit: t
|
|
7001
6579
|
});
|
|
7002
6580
|
return withUnit(n, t) === e.value;
|
|
7003
|
-
}),
|
|
7004
|
-
let e =
|
|
6581
|
+
}), Du = () => {
|
|
6582
|
+
let e = l ?? "", t = K.unit;
|
|
7005
6583
|
if (checkConversion({
|
|
7006
6584
|
value: e,
|
|
7007
6585
|
unitkey: u,
|
|
@@ -7014,9 +6592,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7014
6592
|
return null;
|
|
7015
6593
|
}
|
|
7016
6594
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
7017
|
-
},
|
|
6595
|
+
}, Ou = (t) => {
|
|
7018
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;
|
|
7019
|
-
|
|
6597
|
+
h({ target: {
|
|
7020
6598
|
value: s,
|
|
7021
6599
|
name: n
|
|
7022
6600
|
} });
|
|
@@ -7027,7 +6605,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7027
6605
|
}), R(() => {
|
|
7028
6606
|
r.selectionStart = a, r.selectionEnd = a;
|
|
7029
6607
|
});
|
|
7030
|
-
},
|
|
6608
|
+
}, ku = (e, t) => {
|
|
7031
6609
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
7032
6610
|
value: e,
|
|
7033
6611
|
unit: t
|
|
@@ -7038,16 +6616,16 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7038
6616
|
let e, t = "";
|
|
7039
6617
|
if (W !== U) {
|
|
7040
6618
|
let { value: n } = safeConvertValue({
|
|
7041
|
-
value:
|
|
6619
|
+
value: l,
|
|
7042
6620
|
toUnit: U,
|
|
7043
6621
|
unitkey: u,
|
|
7044
6622
|
defaultFromUnit: B,
|
|
7045
6623
|
doNotConvertValue: p
|
|
7046
6624
|
});
|
|
7047
6625
|
e = n, t = U;
|
|
7048
|
-
} else if (withUnit(K.value, K.unit) !==
|
|
6626
|
+
} else if (withUnit(K.value, K.unit) !== l) {
|
|
7049
6627
|
let { value: n } = safeConvertValue({
|
|
7050
|
-
value:
|
|
6628
|
+
value: l,
|
|
7051
6629
|
toUnit: K.unit,
|
|
7052
6630
|
unitkey: u,
|
|
7053
6631
|
defaultFromUnit: B,
|
|
@@ -7058,15 +6636,15 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7058
6636
|
e !== void 0 && q({
|
|
7059
6637
|
value: e,
|
|
7060
6638
|
unit: t
|
|
7061
|
-
}), C &&
|
|
6639
|
+
}), C && Tu(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
7062
6640
|
}
|
|
7063
6641
|
}, [
|
|
7064
6642
|
U,
|
|
7065
|
-
|
|
6643
|
+
l,
|
|
7066
6644
|
i,
|
|
7067
6645
|
T
|
|
7068
6646
|
]);
|
|
7069
|
-
let
|
|
6647
|
+
let X = Du(), Z = label(K.unit) || K.unit || "", Au = p || !X || X && X.length === 1, Q = getStringName(e), $, ju = (t) => {
|
|
7070
6648
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
7071
6649
|
if (checkConversion({
|
|
7072
6650
|
value: r,
|
|
@@ -7086,7 +6664,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7086
6664
|
type: MenuType.OPTION,
|
|
7087
6665
|
inline: !0,
|
|
7088
6666
|
onClick: () => {
|
|
7089
|
-
validateNumber(i).valid && !n && (
|
|
6667
|
+
validateNumber(i).valid && !n && (Tu(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
7090
6668
|
value: r,
|
|
7091
6669
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
7092
6670
|
predefinedSelected: !0,
|
|
@@ -7098,25 +6676,25 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7098
6676
|
height: "0"
|
|
7099
6677
|
})] }),
|
|
7100
6678
|
description: o,
|
|
7101
|
-
selected:
|
|
6679
|
+
selected: Y === t && J === PredefinedOptionsMenuState.PREDEFINED
|
|
7102
6680
|
};
|
|
7103
6681
|
};
|
|
7104
6682
|
if ($ = [{
|
|
7105
6683
|
type: MenuType.OPTION,
|
|
7106
6684
|
inline: !0,
|
|
7107
6685
|
onClick: () => {
|
|
7108
|
-
|
|
6686
|
+
J !== PredefinedOptionsMenuState.CUSTOM && !n && h({ target: {
|
|
7109
6687
|
value: withUnit(K.value, K.unit),
|
|
7110
6688
|
name: typeof e == "string" ? e : e?.fieldName || ""
|
|
7111
6689
|
} });
|
|
7112
6690
|
},
|
|
7113
6691
|
label: "Custom",
|
|
7114
|
-
selected:
|
|
6692
|
+
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
7115
6693
|
}], C?.length) {
|
|
7116
|
-
let e = C.map(
|
|
6694
|
+
let e = C.map(ju);
|
|
7117
6695
|
$ = [...$, ...e];
|
|
7118
6696
|
}
|
|
7119
|
-
let
|
|
6697
|
+
let Mu = (e) => {
|
|
7120
6698
|
if (isValueWithUnit(e)) {
|
|
7121
6699
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
7122
6700
|
value: e,
|
|
@@ -7128,9 +6706,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7128
6706
|
return n;
|
|
7129
6707
|
}
|
|
7130
6708
|
return e;
|
|
7131
|
-
},
|
|
6709
|
+
}, Nu = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Pu = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
7132
6710
|
return /* @__PURE__ */ jsx("div", {
|
|
7133
|
-
className:
|
|
6711
|
+
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
7134
6712
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
7135
6713
|
small: o,
|
|
7136
6714
|
width: s,
|
|
@@ -7145,65 +6723,65 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7145
6723
|
trigger: "Component",
|
|
7146
6724
|
component: /* @__PURE__ */ jsx(Button, {
|
|
7147
6725
|
groupOrder: "first",
|
|
7148
|
-
active:
|
|
7149
|
-
icon:
|
|
6726
|
+
active: J === PredefinedOptionsMenuState.PREDEFINED,
|
|
6727
|
+
icon: J === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
|
|
7150
6728
|
small: o
|
|
7151
6729
|
}),
|
|
7152
6730
|
small: o,
|
|
7153
6731
|
sections: $
|
|
7154
6732
|
},
|
|
7155
|
-
tooltip:
|
|
6733
|
+
tooltip: J === PredefinedOptionsMenuState.PREDEFINED ? Y?.label : ""
|
|
7156
6734
|
}),
|
|
7157
6735
|
/* @__PURE__ */ jsx("div", {
|
|
7158
6736
|
className: unit_input_module_default.inputWrapper,
|
|
7159
6737
|
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
7160
|
-
name:
|
|
6738
|
+
name: Q,
|
|
7161
6739
|
testId: x,
|
|
7162
6740
|
disabled: n,
|
|
7163
|
-
placeholder:
|
|
6741
|
+
placeholder: Mu(t),
|
|
7164
6742
|
value: K.value,
|
|
7165
|
-
onChange:
|
|
6743
|
+
onChange: Ou,
|
|
7166
6744
|
onFocus: v,
|
|
7167
6745
|
error: i === null ? void 0 : i,
|
|
7168
6746
|
warning: S === null ? void 0 : S,
|
|
7169
6747
|
left: a,
|
|
7170
|
-
allowEmpty:
|
|
7171
|
-
validationCallback: (e, t) => D(
|
|
6748
|
+
allowEmpty: wu,
|
|
6749
|
+
validationCallback: (e, t) => D(Q, t),
|
|
7172
6750
|
enableCosmeticRounding: j,
|
|
7173
6751
|
enableDisplayRounding: M,
|
|
7174
6752
|
roundDisplayValue: N,
|
|
7175
|
-
groupOrder:
|
|
7176
|
-
disableInternalErrorValidationMessages:
|
|
6753
|
+
groupOrder: Nu,
|
|
6754
|
+
disableInternalErrorValidationMessages: Eu,
|
|
7177
6755
|
small: o,
|
|
7178
6756
|
selectOnFocus: P,
|
|
7179
6757
|
tooltip: I
|
|
7180
|
-
},
|
|
6758
|
+
}, Q)
|
|
7181
6759
|
}),
|
|
7182
|
-
|
|
7183
|
-
groupOrder:
|
|
6760
|
+
Z && (Au || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6761
|
+
groupOrder: Pu,
|
|
7184
6762
|
small: o,
|
|
7185
|
-
children:
|
|
6763
|
+
children: Z
|
|
7186
6764
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
7187
|
-
groupOrder:
|
|
6765
|
+
groupOrder: Pu,
|
|
7188
6766
|
maxHeight: 380,
|
|
7189
6767
|
disabled: r,
|
|
7190
6768
|
testId: x && `${x}-menu`,
|
|
7191
6769
|
tabIndex: -1,
|
|
7192
6770
|
menu: {
|
|
7193
|
-
label:
|
|
6771
|
+
label: Z,
|
|
7194
6772
|
trigger: "DropDownButton",
|
|
7195
6773
|
small: o,
|
|
7196
|
-
sections:
|
|
6774
|
+
sections: X.map(([e = "", t = "", n]) => {
|
|
7197
6775
|
let r = n || t || "", i = isValidNum(e) ? e : "";
|
|
7198
6776
|
return {
|
|
7199
6777
|
type: "Option",
|
|
7200
6778
|
label: j ? safeRoundNumbers(i) : i,
|
|
7201
6779
|
inline: !0,
|
|
7202
6780
|
onClick: (n) => {
|
|
7203
|
-
n.stopPropagation(),
|
|
6781
|
+
n.stopPropagation(), ku(e, t);
|
|
7204
6782
|
},
|
|
7205
6783
|
description: r,
|
|
7206
|
-
selected: r ===
|
|
6784
|
+
selected: r === Z,
|
|
7207
6785
|
testId: `${x}-unit-${r}`
|
|
7208
6786
|
};
|
|
7209
6787
|
})
|
|
@@ -7316,61 +6894,60 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
|
|
|
7316
6894
|
})
|
|
7317
6895
|
})) : [];
|
|
7318
6896
|
};
|
|
7319
|
-
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder:
|
|
7320
|
-
let { headers: d
|
|
7321
|
-
|
|
7322
|
-
...
|
|
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,
|
|
7323
6901
|
[e]: n
|
|
7324
6902
|
});
|
|
7325
6903
|
let r = t.find((t) => t.unitKey === e);
|
|
7326
6904
|
r && typeof r.onChange == "function" && r.onChange({
|
|
7327
|
-
oldUnit:
|
|
6905
|
+
oldUnit: g[e],
|
|
7328
6906
|
newUnit: n,
|
|
7329
6907
|
unitKey: e
|
|
7330
6908
|
});
|
|
7331
|
-
},
|
|
7332
|
-
let a =
|
|
6909
|
+
}, y = useCallback(({ row: e, rowIndex: t }) => {
|
|
6910
|
+
let a = l ? l({
|
|
7333
6911
|
row: e,
|
|
7334
6912
|
rowIndex: t
|
|
7335
6913
|
}) : e;
|
|
7336
6914
|
return convertRow({
|
|
7337
6915
|
row: a,
|
|
7338
6916
|
rowIndex: t,
|
|
7339
|
-
selectedUnits:
|
|
7340
|
-
storageUnits:
|
|
6917
|
+
selectedUnits: g,
|
|
6918
|
+
storageUnits: f,
|
|
7341
6919
|
convertBackToStorageUnit: n,
|
|
7342
6920
|
enableCosmeticRounding: r,
|
|
7343
6921
|
enableDisplayRounding: i
|
|
7344
6922
|
});
|
|
7345
6923
|
}, [
|
|
7346
|
-
|
|
7347
|
-
|
|
6924
|
+
g,
|
|
6925
|
+
f,
|
|
7348
6926
|
n,
|
|
7349
6927
|
r,
|
|
7350
6928
|
i
|
|
7351
6929
|
]);
|
|
7352
6930
|
return useEffect(() => {
|
|
7353
|
-
isEqual(
|
|
7354
|
-
let t =
|
|
7355
|
-
t !== n &&
|
|
6931
|
+
isEqual(p, h) || Object.keys(p).forEach((e) => {
|
|
6932
|
+
let t = h?.[e], n = p[e];
|
|
6933
|
+
t !== n && v({
|
|
7356
6934
|
unitKey: e,
|
|
7357
6935
|
value: n
|
|
7358
6936
|
});
|
|
7359
6937
|
});
|
|
7360
6938
|
}, [t]), /* @__PURE__ */ jsx(Table, {
|
|
7361
6939
|
table: {
|
|
7362
|
-
...
|
|
6940
|
+
...d,
|
|
7363
6941
|
headers: convertHeaderRows({
|
|
7364
6942
|
headers: e.headers,
|
|
7365
|
-
selectedUnits:
|
|
7366
|
-
storageUnits:
|
|
7367
|
-
onChangeUnit:
|
|
6943
|
+
selectedUnits: g,
|
|
6944
|
+
storageUnits: f,
|
|
6945
|
+
onChangeUnit: v
|
|
7368
6946
|
})
|
|
7369
6947
|
},
|
|
7370
6948
|
onListReorder: a,
|
|
7371
|
-
canListReorder:
|
|
7372
|
-
beforeRenderRow:
|
|
7373
|
-
enableMultiSelect: u
|
|
6949
|
+
canListReorder: s,
|
|
6950
|
+
beforeRenderRow: y
|
|
7374
6951
|
});
|
|
7375
6952
|
};
|
|
7376
6953
|
var setting_field_module_default = { settingField: "_settingField_1x02n_1" };
|
|
@@ -7443,7 +7020,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7443
7020
|
}, [n]);
|
|
7444
7021
|
let s = ({ target: { value: e } }) => {
|
|
7445
7022
|
a(e);
|
|
7446
|
-
}, { added:
|
|
7023
|
+
}, { added: l, removed: u } = renderLinesCount(e, t), d = l + u > 3500;
|
|
7447
7024
|
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Card, {
|
|
7448
7025
|
bordered: !0,
|
|
7449
7026
|
heading: /* @__PURE__ */ jsxs(Flex, {
|
|
@@ -7452,7 +7029,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7452
7029
|
success: !0,
|
|
7453
7030
|
children: [
|
|
7454
7031
|
"+",
|
|
7455
|
-
|
|
7032
|
+
l,
|
|
7456
7033
|
" "
|
|
7457
7034
|
]
|
|
7458
7035
|
}), /* @__PURE__ */ jsxs(Text, {
|
|
@@ -7489,4 +7066,4 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7489
7066
|
}
|
|
7490
7067
|
});
|
|
7491
7068
|
};
|
|
7492
|
-
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 };
|
|
7069
|
+
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, TextTransform, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TriggerType, UnitInput, UnitTable, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };
|