@oliasoft-open-source/react-ui-library 5.6.5-beta-2 → 5.6.5-beta-4
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 +52 -8
- package/dist/index.js +1316 -892
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Fragment, createContext, forwardRef, isValidElement, memo, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useTransition } from "react";
|
|
1
|
+
import React, { Fragment, cloneElement, 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";
|
|
18
19
|
import RcSlider from "rc-slider";
|
|
19
20
|
import memoizeOne from "memoize-one";
|
|
20
21
|
import isEqual$1 from "react-fast-compare";
|
|
21
22
|
import { DndContext, DragOverlay, closestCenter } from "@dnd-kit/core";
|
|
22
23
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
23
24
|
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: i, testId: o }) => {
|
|
218
|
+
let s = useContext(DisabledContext), l = {
|
|
219
219
|
color: r,
|
|
220
220
|
fill: r,
|
|
221
|
-
fontSize:
|
|
222
|
-
width:
|
|
223
|
-
height:
|
|
221
|
+
fontSize: i || "inherit",
|
|
222
|
+
width: i || "auto",
|
|
223
|
+
height: i || "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) && !s ? icon_module_default.clickable : ""),
|
|
227
227
|
style: l,
|
|
228
|
-
onClick: (e) => t && !
|
|
228
|
+
onClick: (e) => t && !s ? 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
|
+
i && (e.setAttribute("width", String(i)), e.setAttribute("height", String(i)));
|
|
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: i = [
|
|
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: i,
|
|
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: s = "", disabled: u = !1, small: d = !1, onChange: f, testId: p, value: h, helpText: g, onClickHelp: v }) => {
|
|
389
|
+
let y = useContext(DisabledContext), b = g || v, x = u || y, S = useRef(null);
|
|
390
390
|
return useEffect(() => {
|
|
391
|
-
|
|
391
|
+
S.current && (S.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, x && check_box_module_default.disabled, d && check_box_module_default.small, !s && check_box_module_default.noLabel),
|
|
394
394
|
"data-ix": t,
|
|
395
395
|
onClick: (e) => {
|
|
396
|
-
if (!
|
|
396
|
+
if (!x) {
|
|
397
397
|
let t = e.target;
|
|
398
398
|
t.name = o, t.checked = !i, f({
|
|
399
399
|
...e,
|
|
@@ -404,30 +404,29 @@ 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": p,
|
|
408
408
|
children: [
|
|
409
409
|
/* @__PURE__ */ jsx("input", {
|
|
410
|
-
ref:
|
|
410
|
+
ref: S,
|
|
411
411
|
type: "checkbox",
|
|
412
412
|
tabIndex: r,
|
|
413
413
|
checked: i,
|
|
414
414
|
name: o,
|
|
415
415
|
onChange: () => {},
|
|
416
|
-
disabled:
|
|
416
|
+
disabled: x,
|
|
417
417
|
"data-indeterminate": a
|
|
418
418
|
}),
|
|
419
419
|
/* @__PURE__ */ jsxs("label", {
|
|
420
420
|
htmlFor: o,
|
|
421
|
-
style: { textTransform: y },
|
|
422
421
|
children: [/* @__PURE__ */ jsx("span", {
|
|
423
422
|
className: check_box_module_default.checkmark,
|
|
424
423
|
children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHECK })
|
|
425
|
-
}),
|
|
424
|
+
}), s]
|
|
426
425
|
}),
|
|
427
|
-
|
|
426
|
+
b && /* @__PURE__ */ jsx("div", {
|
|
428
427
|
className: check_box_module_default.helpIconEnabled,
|
|
429
428
|
onClick: v,
|
|
430
|
-
children: /* @__PURE__ */ jsx(HelpIcon, { text:
|
|
429
|
+
children: /* @__PURE__ */ jsx(HelpIcon, { text: g })
|
|
431
430
|
})
|
|
432
431
|
]
|
|
433
432
|
});
|
|
@@ -527,7 +526,7 @@ var ButtonTooltipWrapper = ({ children: e, tooltip: t = null }) => t ? /* @__PUR
|
|
|
527
526
|
display: "inline-flex",
|
|
528
527
|
children: e
|
|
529
528
|
}) : /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
530
|
-
const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r = !1, ignoreDisabledContext: i = !1, groupOrder: a, icon: o = null, label:
|
|
529
|
+
const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r = !1, ignoreDisabledContext: i = !1, groupOrder: a, icon: o = null, label: s = "", loading: l = !1, name: u, pill: d = !1, round: f = !1, small: p = !1, styles: m = "", width: h = "", title: g = "", type: v = ButtonType.BUTTON, onClick: y = () => {}, error: b, warning: x, testId: S, tooltip: C, inverted: w = !1, component: T = "button", url: E, tabIndex: D }) => {
|
|
531
530
|
let O = useContext(DisabledContext), k = (() => {
|
|
532
531
|
if (n) switch (n) {
|
|
533
532
|
case Color.DANGER:
|
|
@@ -550,11 +549,11 @@ const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r =
|
|
|
550
549
|
tooltip: C,
|
|
551
550
|
children: /* @__PURE__ */ jsxs(T, {
|
|
552
551
|
type: v === ButtonType.SUBMIT ? ButtonType.SUBMIT : ButtonType.BUTTON,
|
|
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) && !
|
|
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) && !s ? 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),
|
|
554
553
|
disabled: j,
|
|
555
554
|
name: u ?? "",
|
|
556
555
|
onClick: y,
|
|
557
|
-
...
|
|
556
|
+
...g ? { title: g } : {},
|
|
558
557
|
style: { width: h },
|
|
559
558
|
"data-error": b || null,
|
|
560
559
|
"data-warning": x || null,
|
|
@@ -575,7 +574,7 @@ const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r =
|
|
|
575
574
|
colored: t
|
|
576
575
|
})
|
|
577
576
|
}),
|
|
578
|
-
|
|
577
|
+
s
|
|
579
578
|
]
|
|
580
579
|
})
|
|
581
580
|
});
|
|
@@ -625,7 +624,7 @@ const Heading$3 = ({ label: e, onClick: t, icon: n, testId: r }) => /* @__PURE__
|
|
|
625
624
|
onClick: t,
|
|
626
625
|
children: /* @__PURE__ */ jsx(Icon, { icon: n })
|
|
627
626
|
})]
|
|
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:
|
|
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: g = "a" }) => {
|
|
629
628
|
let v = (e) => {
|
|
630
629
|
if (e.stopPropagation(), l) {
|
|
631
630
|
e.preventDefault();
|
|
@@ -647,7 +646,7 @@ const Heading$3 = ({ label: e, onClick: t, icon: n, testId: r }) => /* @__PURE__
|
|
|
647
646
|
m?.(n), c?.();
|
|
648
647
|
}
|
|
649
648
|
};
|
|
650
|
-
return /* @__PURE__ */ jsxs(
|
|
649
|
+
return /* @__PURE__ */ jsxs(g, {
|
|
651
650
|
href: n,
|
|
652
651
|
to: n,
|
|
653
652
|
className: cx(menu_module_default.option, l ? menu_module_default.disabled : "", u ? menu_module_default.inline : "", o ? menu_module_default?.selected : ""),
|
|
@@ -741,13 +740,13 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
741
740
|
});
|
|
742
741
|
default: return null;
|
|
743
742
|
}
|
|
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:
|
|
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: i = () => {}, tree: o, path: s, maxHeight: c, showAllButton: l, testId: u }) => {
|
|
745
744
|
if (isValidElement(e)) return /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
746
|
-
let [d, f] = useState(!l?.visible), p = e,
|
|
745
|
+
let [d, f] = useState(!l?.visible), p = e, m = l?.additionalSections?.map((e) => ({
|
|
747
746
|
...e,
|
|
748
747
|
closeOnOptionClick: r,
|
|
749
748
|
visible: !0
|
|
750
|
-
})) ?? [],
|
|
749
|
+
})) ?? [], g = p.length > 4 ? [{
|
|
751
750
|
type: MenuType.OPTION,
|
|
752
751
|
label: d ? l?.showLessTitle || "Show less" : l?.showAllTitle || "Show all",
|
|
753
752
|
onClick: () => f(!d),
|
|
@@ -757,7 +756,7 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
757
756
|
...e,
|
|
758
757
|
visible: !0,
|
|
759
758
|
closeOnOptionClick: r
|
|
760
|
-
} : e).concat(
|
|
759
|
+
} : e).concat(g, m).filter((e) => e?.visible) : p.map((e) => ({
|
|
761
760
|
...e,
|
|
762
761
|
closeOnOptionClick: r
|
|
763
762
|
}));
|
|
@@ -771,7 +770,7 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
771
770
|
children: /* @__PURE__ */ jsx("ul", { children: v.map((e, t) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Section$1, {
|
|
772
771
|
section: e,
|
|
773
772
|
closeOnOptionClick: e.closeOnOptionClick,
|
|
774
|
-
close:
|
|
773
|
+
close: i,
|
|
775
774
|
tree: o,
|
|
776
775
|
path: childPath(s, t),
|
|
777
776
|
maxHeight: c
|
|
@@ -809,7 +808,7 @@ const Badge = ({ children: e, color: t = "", title: n = null, dot: r = !1, margi
|
|
|
809
808
|
children: n
|
|
810
809
|
}), e]
|
|
811
810
|
});
|
|
812
|
-
}, Button$1 = ({ trigger: e, label: t, colored: n, small: r, width: i, disabled: a, groupOrder: o, loading:
|
|
811
|
+
}, Button$1 = ({ trigger: e, label: t, colored: n, small: r, width: i, disabled: a, groupOrder: o, loading: s, error: l, warning: u, active: d, tabIndex: f }) => {
|
|
813
812
|
let p = useContext(DisabledContext), m = e === TriggerType.BUTTON ? t : e === TriggerType.DROP_DOWN_BUTTON ? /* @__PURE__ */ jsxs("span", {
|
|
814
813
|
className: menu_module_default.middleAlignedInline,
|
|
815
814
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -830,7 +829,7 @@ const Badge = ({ children: e, color: t = "", title: n = null, dot: r = !1, margi
|
|
|
830
829
|
width: i,
|
|
831
830
|
groupOrder: o,
|
|
832
831
|
onClick: () => {},
|
|
833
|
-
loading:
|
|
832
|
+
loading: s,
|
|
834
833
|
disabled: a,
|
|
835
834
|
error: l,
|
|
836
835
|
warning: u,
|
|
@@ -944,7 +943,7 @@ var isMenuEmpty = (e) => {
|
|
|
944
943
|
testId: d && `${d}-layer`
|
|
945
944
|
})
|
|
946
945
|
})), m];
|
|
947
|
-
}, ContextMenu = ({ menu: e, width: t, disabled: n = !1, closeOnOptionClick: r = !0, closeParent: i, tree: a, path: o, groupOrder:
|
|
946
|
+
}, ContextMenu = ({ menu: e, width: t, disabled: n = !1, closeOnOptionClick: r = !0, closeParent: i, tree: a, path: o, groupOrder: s, testId: l }) => {
|
|
948
947
|
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({
|
|
949
948
|
sections: e.sections,
|
|
950
949
|
width: t,
|
|
@@ -954,7 +953,7 @@ var isMenuEmpty = (e) => {
|
|
|
954
953
|
closeParent: i,
|
|
955
954
|
tree: a,
|
|
956
955
|
path: o,
|
|
957
|
-
groupOrder:
|
|
956
|
+
groupOrder: s,
|
|
958
957
|
overflowContainer: !0,
|
|
959
958
|
maxHeight: void 0,
|
|
960
959
|
testId: l
|
|
@@ -974,11 +973,11 @@ var isMenuEmpty = (e) => {
|
|
|
974
973
|
isNested: !0,
|
|
975
974
|
component: g,
|
|
976
975
|
contextMenu: !0,
|
|
977
|
-
groupOrder:
|
|
976
|
+
groupOrder: s
|
|
978
977
|
}), y]
|
|
979
978
|
});
|
|
980
979
|
};
|
|
981
|
-
const DropDownMenu = ({ menu: e, width: t, disabled: n = !1, badgeTitle: r, badgeDot: i = !1, loading: a = !1, isNested: o = !1, closeOnOptionClick:
|
|
980
|
+
const DropDownMenu = ({ menu: e, width: t, disabled: n = !1, badgeTitle: r, badgeDot: i = !1, loading: a = !1, isNested: o = !1, closeOnOptionClick: s = !0, closeParent: l, tree: u, path: d, groupOrder: f, overflowContainer: p = !0, maxHeight: m, testId: g, open: _, setOpen: v, tooltip: y, error: b, warning: x, selected: S, tabIndex: C, active: w }) => {
|
|
982
981
|
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({
|
|
983
982
|
isOpen: L,
|
|
984
983
|
...placementOptions$1(P, o),
|
|
@@ -1032,11 +1031,11 @@ const DropDownMenu = ({ menu: e, width: t, disabled: n = !1, badgeTitle: r, badg
|
|
|
1032
1031
|
sections: M,
|
|
1033
1032
|
isNested: o,
|
|
1034
1033
|
width: t,
|
|
1035
|
-
closeOnOptionClick:
|
|
1034
|
+
closeOnOptionClick: s,
|
|
1036
1035
|
close: l || z,
|
|
1037
1036
|
tree: u,
|
|
1038
1037
|
path: d,
|
|
1039
|
-
maxHeight:
|
|
1038
|
+
maxHeight: m,
|
|
1040
1039
|
showAllButton: F,
|
|
1041
1040
|
testId: g && `${g}-layer`
|
|
1042
1041
|
})
|
|
@@ -1125,15 +1124,15 @@ var breadcrumb_module_default = {
|
|
|
1125
1124
|
let BreadcrumbLinkType = /* @__PURE__ */ function(e) {
|
|
1126
1125
|
return e.LABEL = "label", e.LINK = "link", e.CUSTOM = "custom", e;
|
|
1127
1126
|
}({});
|
|
1128
|
-
const Link$2 = ({ type: e = BreadcrumbLinkType.LABEL, label: t, url: n, onClick: r, active:
|
|
1129
|
-
let l = useContext(DisabledContext), u = e === BreadcrumbLinkType.LINK && n !== void 0, d = e === BreadcrumbLinkType.CUSTOM && isValidElement(
|
|
1127
|
+
const Link$2 = ({ type: e = BreadcrumbLinkType.LABEL, label: t, url: n, onClick: r, active: i, disabled: o, element: s }) => {
|
|
1128
|
+
let l = useContext(DisabledContext), u = e === BreadcrumbLinkType.LINK && n !== void 0, d = e === BreadcrumbLinkType.CUSTOM && isValidElement(s);
|
|
1130
1129
|
return /* @__PURE__ */ jsx("span", {
|
|
1131
1130
|
onClick: r,
|
|
1132
|
-
className: cx(breadcrumb_module_default.labelContainer,
|
|
1131
|
+
className: cx(breadcrumb_module_default.labelContainer, i && breadcrumb_module_default.active, (o || l) && breadcrumb_module_default.disabled),
|
|
1133
1132
|
children: u ? /* @__PURE__ */ jsx("a", {
|
|
1134
1133
|
href: n,
|
|
1135
1134
|
children: t
|
|
1136
|
-
}) : d ?
|
|
1135
|
+
}) : d ? s : t
|
|
1137
1136
|
});
|
|
1138
1137
|
}, Breadcrumb = ({ links: e, small: t = !1 }) => /* @__PURE__ */ jsx("div", {
|
|
1139
1138
|
className: cx(breadcrumb_module_default.breadcrumb, t && breadcrumb_module_default.small),
|
|
@@ -1158,7 +1157,7 @@ var button_group_module_default = {
|
|
|
1158
1157
|
buttonGroup: "_buttonGroup_iu2wi_11"
|
|
1159
1158
|
};
|
|
1160
1159
|
const ButtonGroup = (e) => {
|
|
1161
|
-
let { basic: t = !1, items: n = [], header: r = "", onSelected: i = () => {}, small: a = !1, value: o = "", testId:
|
|
1160
|
+
let { basic: t = !1, items: n = [], header: r = "", onSelected: i = () => {}, small: a = !1, value: o = "", testId: s = void 0, disabled: l } = e, u = useContext(DisabledContext), d = (e, t, n, r, a) => {
|
|
1162
1161
|
e.preventDefault(), e.stopPropagation(), !(l || a || u) && i(t, n, r);
|
|
1163
1162
|
}, 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 = () => {
|
|
1164
1163
|
if (r) return /* @__PURE__ */ jsx("label", {
|
|
@@ -1191,7 +1190,7 @@ const ButtonGroup = (e) => {
|
|
|
1191
1190
|
});
|
|
1192
1191
|
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { children: [v(), /* @__PURE__ */ jsx("div", {
|
|
1193
1192
|
className: button_group_module_default.buttonGroup,
|
|
1194
|
-
"data-testid":
|
|
1193
|
+
"data-testid": s,
|
|
1195
1194
|
children: y()
|
|
1196
1195
|
})] }) });
|
|
1197
1196
|
};
|
|
@@ -1494,16 +1493,16 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1494
1493
|
},
|
|
1495
1494
|
children: e
|
|
1496
1495
|
}) : /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
1497
|
-
}, Drawer = ({ background: e = "var(--color-background-raised)", fixed: t = !1, open: n = !1, setOpen: r, right:
|
|
1498
|
-
let D = u === !0, O = !D && isValidElement(u), [k, A] = r ? [n, r] : D ||
|
|
1496
|
+
}, Drawer = ({ background: e = "var(--color-background-raised)", fixed: t = !1, open: n = !1, setOpen: r, right: i = !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: m = null, tabs: g, defaultTabIndex: v = 0, activeTab: y, setActiveTab: b, testId: x, onResize: S, getActiveTab: C, onClose: w, onOpen: T, maxOpenWidth: E }) => {
|
|
1497
|
+
let D = u === !0, O = !D && isValidElement(u), [k, A] = r ? [n, r] : D || g ? 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 : g ? 35 : s;
|
|
1499
1498
|
return /* @__PURE__ */ jsx(DrawerResizeWrapper, {
|
|
1500
1499
|
width: R,
|
|
1501
1500
|
onResize: S,
|
|
1502
1501
|
setOpen: P,
|
|
1503
|
-
right:
|
|
1502
|
+
right: i,
|
|
1504
1503
|
maxOpenWidth: E,
|
|
1505
1504
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1506
|
-
className: cx(drawer_module_default.drawer, c ? drawer_module_default.shadow : "", t ? drawer_module_default.fixed : drawer_module_default.inline,
|
|
1505
|
+
className: cx(drawer_module_default.drawer, c ? drawer_module_default.shadow : "", t ? drawer_module_default.fixed : drawer_module_default.inline, i ? drawer_module_default.right : drawer_module_default.left),
|
|
1507
1506
|
style: { top: l },
|
|
1508
1507
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1509
1508
|
className: cx(drawer_module_default.drawerContent, p && drawer_module_default.border),
|
|
@@ -1512,16 +1511,16 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1512
1511
|
borderColor: typeof p == "string" ? p : void 0,
|
|
1513
1512
|
width: R
|
|
1514
1513
|
},
|
|
1515
|
-
children:
|
|
1514
|
+
children: g ? /* @__PURE__ */ jsx(DrawerTabs, {
|
|
1516
1515
|
width: L,
|
|
1517
1516
|
testId: x,
|
|
1518
|
-
tabs:
|
|
1517
|
+
tabs: g,
|
|
1519
1518
|
open: N,
|
|
1520
1519
|
activeTab: F || 0,
|
|
1521
1520
|
background: e,
|
|
1522
1521
|
handleTabClick: (e) => {
|
|
1523
1522
|
let t = (t) => {
|
|
1524
|
-
|
|
1523
|
+
g && t && t(g[e]);
|
|
1525
1524
|
};
|
|
1526
1525
|
F === e && N && P ? (t(w), P(!1)) : !N && P && (t(T), P(!0), S && ((e) => {
|
|
1527
1526
|
let t;
|
|
@@ -1534,21 +1533,21 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1534
1533
|
}
|
|
1535
1534
|
}) : /* @__PURE__ */ jsx("div", {
|
|
1536
1535
|
style: { width: L },
|
|
1537
|
-
children:
|
|
1536
|
+
children: m
|
|
1538
1537
|
})
|
|
1539
1538
|
}), u && /* @__PURE__ */ jsx("span", {
|
|
1540
1539
|
className: cx(drawer_module_default.toggleButton, k && (D || O && d) ? drawer_module_default.toggleButtonOpen : "", f === "top" ? drawer_module_default.top : drawer_module_default.bottom),
|
|
1541
1540
|
children: O ? u : /* @__PURE__ */ jsx(Button, {
|
|
1542
1541
|
onClick: P ? () => P(!N) : void 0,
|
|
1543
1542
|
round: !0,
|
|
1544
|
-
icon:
|
|
1543
|
+
icon: i ? IconType.CHEVRON_RIGHT : IconType.CHEVRON_LEFT
|
|
1545
1544
|
})
|
|
1546
1545
|
})]
|
|
1547
1546
|
})
|
|
1548
1547
|
});
|
|
1549
1548
|
};
|
|
1550
1549
|
var input_group_module_default = { inputGroup: "_inputGroup_biuoa_1" }, isDOMTypeElement = (e) => isValidElement(e) && typeof e.type == "string";
|
|
1551
|
-
const InputGroup = ({ children: n, small: r = !1, width:
|
|
1550
|
+
const InputGroup = ({ children: n, small: r = !1, width: i = "100%" }) => {
|
|
1552
1551
|
let o = Array.isArray(n) ? n.filter((e) => isValidElement(e)) : [n], s = o.map((n, i) => {
|
|
1553
1552
|
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);
|
|
1554
1553
|
return a ? n : /* @__PURE__ */ jsx(Fragment, { children: React.cloneElement(n, {
|
|
@@ -1558,27 +1557,27 @@ const InputGroup = ({ children: n, small: r = !1, width: a = "100%" }) => {
|
|
|
1558
1557
|
});
|
|
1559
1558
|
return /* @__PURE__ */ jsx("div", {
|
|
1560
1559
|
className: cx(input_group_module_default.inputGroup),
|
|
1561
|
-
style: { width:
|
|
1560
|
+
style: { width: i },
|
|
1562
1561
|
children: s
|
|
1563
1562
|
});
|
|
1564
1563
|
};
|
|
1565
1564
|
var input_module_default = {
|
|
1566
|
-
inputInTable: "
|
|
1567
|
-
inputHover: "
|
|
1568
|
-
inputFocus: "
|
|
1569
|
-
inputError: "
|
|
1570
|
-
inputWarning: "
|
|
1571
|
-
inputDisabled: "
|
|
1572
|
-
hideScrollbars: "
|
|
1573
|
-
input: "
|
|
1574
|
-
isInTable: "
|
|
1575
|
-
small: "
|
|
1576
|
-
right: "
|
|
1577
|
-
groupOrderFirst: "
|
|
1578
|
-
groupOrderMiddle: "
|
|
1579
|
-
groupOrderLast: "
|
|
1565
|
+
inputInTable: "_inputInTable_180g1_1",
|
|
1566
|
+
inputHover: "_inputHover_180g1_13",
|
|
1567
|
+
inputFocus: "_inputFocus_180g1_18",
|
|
1568
|
+
inputError: "_inputError_180g1_25",
|
|
1569
|
+
inputWarning: "_inputWarning_180g1_26",
|
|
1570
|
+
inputDisabled: "_inputDisabled_180g1_61",
|
|
1571
|
+
hideScrollbars: "_hideScrollbars_180g1_67",
|
|
1572
|
+
input: "_input_180g1_1",
|
|
1573
|
+
isInTable: "_isInTable_180g1_100",
|
|
1574
|
+
small: "_small_180g1_129",
|
|
1575
|
+
right: "_right_180g1_175",
|
|
1576
|
+
groupOrderFirst: "_groupOrderFirst_180g1_178",
|
|
1577
|
+
groupOrderMiddle: "_groupOrderMiddle_180g1_179",
|
|
1578
|
+
groupOrderLast: "_groupOrderLast_180g1_180"
|
|
1580
1579
|
};
|
|
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:
|
|
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: s = "", onKeyPress: l = () => {}, onFocus: u = () => {}, onBlur: d = () => {}, onPaste: f = () => {}, onKeyDown: p = () => {}, selectOnFocus: m = !0, name: h = void 0, type: g = "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) => {
|
|
1582
1581
|
let D = useContext(DisabledContext), O = (() => {
|
|
1583
1582
|
if (S) switch (S) {
|
|
1584
1583
|
case GroupOrder.FIRST: return input_module_default.groupOrderFirst;
|
|
@@ -1599,10 +1598,10 @@ const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, wi
|
|
|
1599
1598
|
display: "block",
|
|
1600
1599
|
children: /* @__PURE__ */ jsx("input", {
|
|
1601
1600
|
ref: E,
|
|
1602
|
-
type:
|
|
1601
|
+
type: g || "text",
|
|
1603
1602
|
size: T || 20,
|
|
1604
1603
|
placeholder: o ?? "",
|
|
1605
|
-
value:
|
|
1604
|
+
value: s ?? "",
|
|
1606
1605
|
onChange: a,
|
|
1607
1606
|
onKeyPress: l,
|
|
1608
1607
|
onKeyDown: p,
|
|
@@ -1621,7 +1620,8 @@ const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, wi
|
|
|
1621
1620
|
style: { width: k },
|
|
1622
1621
|
"data-error": e || null,
|
|
1623
1622
|
"data-warning": x || null,
|
|
1624
|
-
"data-testid": w
|
|
1623
|
+
"data-testid": w,
|
|
1624
|
+
onDragStart: (e) => e.preventDefault()
|
|
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: s, width: l, onChange: u = noop, testId: d }) => {
|
|
1651
|
+
let f = useContext(DisabledContext), p = useRef(null), h = getName(i, o);
|
|
1652
1652
|
return /* @__PURE__ */ jsxs("div", {
|
|
1653
1653
|
onClick: () => {
|
|
1654
|
-
r || f ||
|
|
1654
|
+
r || f || p.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: s,
|
|
1668
|
+
ref: p,
|
|
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), p.current && (p.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: c, dialogText: u, fileInputText: d, fileInputPlaceholder: f, uploadText: p, cancelText: m, 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: m || "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: c || "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: f } = 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: f
|
|
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: s = noop, right: l = !1, small: u = !1, tabIndex: d = 0, selectedOption: f, width: p = null, groupOrder: m, testId: h, isInTable: g = !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 : "", g ? 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: s,
|
|
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: c, closeLayer: u, testId: d }) => {
|
|
2243
2243
|
useEffect(() => {
|
|
2244
|
-
|
|
2245
|
-
}, [
|
|
2244
|
+
c != null && e.current !== null && typeof e.current.scrollToItem == "function" && e.current.scrollToItem(c, "start");
|
|
2245
|
+
}, [c, 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, c] = 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), c(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: g, 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, g ? 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: o, onChange: c, selectedOptions: u, width: d, small: f, isFontLoaded: p, 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, s, l) => {
|
|
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 (l && l(), s) {
|
|
2548
|
+
if (s.createAble && o) o(s.value);
|
|
2549
|
+
else if (!s.disabled) if (Array.isArray(u)) {
|
|
2550
|
+
let t = u.some((e) => String(e.value) === String(s.value)) ? u.filter((e) => String(e.value) !== String(s.value)) : [...u, s];
|
|
2551
|
+
c && c(e, t);
|
|
2552
|
+
} else c && c(e, s);
|
|
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, p, h) : d : "100%", [n, p]), T = useCallback((e) => y ? Math.max(getWidestOptionWidth(n, f, p, h), e?.width) : e?.width, [n, p]), { 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
|
+
c && c(e, n);
|
|
2588
2588
|
}, N = (e) => {
|
|
2589
2589
|
let t = u instanceof Array ? [] : { value: null };
|
|
2590
|
-
|
|
2590
|
+
c && c(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: s, onCreate: l = null, placeholder: u = "", small: d = !1, tabIndex: f = 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: s,
|
|
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: f,
|
|
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: s,
|
|
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, c = 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), m = (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), m("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: () => m("1"),
|
|
2867
|
+
disabled: c || 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: () => m(String(Number(n) - 1)),
|
|
2875
|
+
disabled: c || 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) => m(e.target.value),
|
|
2885
2885
|
width: "50px",
|
|
2886
|
-
disabled:
|
|
2886
|
+
disabled: c || 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: () => m(String(Number(n) + 1)),
|
|
2896
|
+
disabled: c || 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: () => m(String(u)),
|
|
2904
|
+
disabled: c || n === u,
|
|
2905
2905
|
testId: s?.doubleRightBtn
|
|
2906
2906
|
})
|
|
2907
2907
|
]
|
|
@@ -2972,57 +2972,730 @@ 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: "
|
|
2975
|
+
inputInTable: "_inputInTable_1dumn_1",
|
|
2976
|
+
inputHover: "_inputHover_1dumn_13",
|
|
2977
|
+
inputFocus: "_inputFocus_1dumn_18",
|
|
2978
|
+
inputError: "_inputError_1dumn_25",
|
|
2979
|
+
inputWarning: "_inputWarning_1dumn_26",
|
|
2980
|
+
inputDisabled: "_inputDisabled_1dumn_61",
|
|
2981
|
+
hideScrollbars: "_hideScrollbars_1dumn_67",
|
|
2982
|
+
cell: "_cell_1dumn_77",
|
|
2983
|
+
disabledLink: "_disabledLink_1dumn_87",
|
|
2984
|
+
inputWrapper: "_inputWrapper_1dumn_91",
|
|
2985
|
+
numberInputWrapper: "_numberInputWrapper_1dumn_106",
|
|
2986
|
+
breakWord: "_breakWord_1dumn_113",
|
|
2987
|
+
inputCell: "_inputCell_1dumn_116",
|
|
2988
|
+
sliderCell: "_sliderCell_1dumn_119",
|
|
2989
|
+
staticCell: "_staticCell_1dumn_123",
|
|
2990
|
+
staticCellContent: "_staticCellContent_1dumn_126",
|
|
2991
|
+
unit: "_unit_1dumn_148",
|
|
2992
|
+
sortingCell: "_sortingCell_1dumn_151",
|
|
2993
|
+
sortingCellIcon: "_sortingCellIcon_1dumn_162",
|
|
2994
|
+
icon: "_icon_1dumn_173",
|
|
2995
|
+
checkBoxCell: "_checkBoxCell_1dumn_177",
|
|
2996
|
+
iconCellWrapper: "_iconCellWrapper_1dumn_181",
|
|
2997
|
+
actionsCell: "_actionsCell_1dumn_185",
|
|
2998
|
+
rightAligned: "_rightAligned_1dumn_193",
|
|
2999
|
+
centerAligned: "_centerAligned_1dumn_199",
|
|
3000
|
+
leftAligned: "_leftAligned_1dumn_205",
|
|
3001
|
+
popover: "_popover_1dumn_208",
|
|
3002
|
+
disabledPointerEvents: "_disabledPointerEvents_1dumn_211",
|
|
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;
|
|
3003
3078
|
};
|
|
3004
|
-
const
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
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
|
+
};
|
|
3085
|
+
};
|
|
3086
|
+
var getExpectedUnits = (e) => {
|
|
3087
|
+
let t = (e) => (e ?? []).find((e) => isNonPlaceholderUnit(e)) ?? "";
|
|
3088
|
+
return e.map((e) => isNonPlaceholderUnit(e.defaultUnit) ? e.defaultUnit : t(e.validUnits));
|
|
3089
|
+
}, getAllowedUnitsSet = (e) => {
|
|
3090
|
+
let t = /* @__PURE__ */ new Set();
|
|
3091
|
+
for (let n of e) for (let e of n.validUnits ?? []) {
|
|
3092
|
+
let n = (e ?? "").trim();
|
|
3093
|
+
isNonPlaceholderUnit(n) && t.add(n);
|
|
3094
|
+
}
|
|
3095
|
+
return t;
|
|
3096
|
+
};
|
|
3097
|
+
const guessMissingHeaders$1 = (e = [], t = [], n = [], r = []) => {
|
|
3098
|
+
let i = getAllowedUnitsSet(r), a = r.map((e) => e.fieldName ?? ""), o = getExpectedUnits(r), s = e.length > 0 && hasAnyText(e), c = t.length > 0 && t.every((e) => i.has(String(e ?? "").trim())), { hasFieldNameHeader: l, hasUnitHeader: u } = hasHeaders$1(n, a, Array.from(i)), d = s || l, f = c || u, p = s ? e.slice() : l ? (n[0] ?? []).slice() : a, m = c ? t.slice() : u ? (n[d ? 1 : 0] ?? []).slice() : o, h = (d ? 1 : 0) + (f ? 1 : 0), g = n.slice(h);
|
|
3099
|
+
return {
|
|
3100
|
+
effectiveFields: p,
|
|
3101
|
+
effectiveUnits: m,
|
|
3102
|
+
bodyRows: g,
|
|
3103
|
+
hasFieldNameHeader: d,
|
|
3104
|
+
hasUnitHeader: f
|
|
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
|
+
e.preventDefault();
|
|
3640
|
+
let t = e.target, n = Number(t.closest("td")?.dataset.rowIndex), r = Number(t.closest("td")?.dataset.columnIndex);
|
|
3641
|
+
b(n, r), o || s({
|
|
3642
|
+
row: n,
|
|
3643
|
+
column: r
|
|
3644
|
+
}), u(!0);
|
|
3645
|
+
}, S = (e) => {
|
|
3646
|
+
e.preventDefault(), s(void 0), u(!1);
|
|
3647
|
+
}, C = (e) => {
|
|
3648
|
+
if (e.preventDefault(), !c) return;
|
|
3649
|
+
let t = e.target, n = Number(t.closest("td")?.dataset.rowIndex), r = Number(t.closest("td")?.dataset.columnIndex);
|
|
3650
|
+
b(n, r);
|
|
3651
|
+
}, w = () => {
|
|
3652
|
+
if (T(), !i || !t.current) return;
|
|
3653
|
+
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}"]`);
|
|
3654
|
+
if (!r || !a) return;
|
|
3655
|
+
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");
|
|
3656
|
+
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);
|
|
3657
|
+
}, T = () => {
|
|
3658
|
+
f().querySelectorAll(".selection-frame,.drag-handle").forEach((e) => e.remove());
|
|
3659
|
+
};
|
|
3660
|
+
return {
|
|
3661
|
+
selectedIndexes: i,
|
|
3662
|
+
setSelectedIndexes: a,
|
|
3663
|
+
onCopy: g,
|
|
3664
|
+
onPaste: _,
|
|
3665
|
+
onKeyDown: v,
|
|
3666
|
+
onKeyUp: y,
|
|
3667
|
+
onMouseDown: x,
|
|
3668
|
+
onMouseUp: S,
|
|
3669
|
+
onMouseMove: C,
|
|
3670
|
+
onBlur: (e) => {
|
|
3671
|
+
e.currentTarget.contains(e.relatedTarget) || (a(void 0), s(void 0));
|
|
3672
|
+
}
|
|
3673
|
+
};
|
|
3674
|
+
}, InputCell = ({ cell: e, columnAlignment: t, testId: n, type: r }) => {
|
|
3675
|
+
let { selectedIndexes: i } = useContext(CellSelectionContext), a = i?.row.start !== i?.row.end || i?.column.start !== i?.column.end;
|
|
3676
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
3677
|
+
name: e.name,
|
|
3678
|
+
value: e.value,
|
|
3679
|
+
onChange: (t) => e.onChange?.(t),
|
|
3680
|
+
onFocus: e.onFocus,
|
|
3681
|
+
onBlur: e.onBlur,
|
|
3682
|
+
onPaste: (t) => e.onPaste?.(t),
|
|
3683
|
+
placeholder: e.placeholder,
|
|
3684
|
+
error: e.error,
|
|
3685
|
+
warning: e.warning,
|
|
3686
|
+
disabled: e.disabled,
|
|
3687
|
+
isInTable: !0,
|
|
3688
|
+
maxTooltipWidth: e.maxTooltipWidth,
|
|
3689
|
+
right: t === Align.RIGHT,
|
|
3690
|
+
selectOnFocus: !a,
|
|
3691
|
+
testId: n,
|
|
3692
|
+
tabIndex: e.disabled ? -1 : 0,
|
|
3693
|
+
tooltip: e.tooltip,
|
|
3694
|
+
type: r
|
|
3695
|
+
});
|
|
3696
|
+
}, safeToString = (e) => String(toString(e)), roundNumberCosmetic = (e) => isScientificStringNum(e) ? e : safeToString(roundToPrecision(toNum(e), 14));
|
|
3024
3697
|
var getStringName$1 = (e) => e ? typeof e == "string" ? e : isArray(e) ? e[0] : e.fieldName : "";
|
|
3025
|
-
const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r = !1, left: i = !1, small: a = !1, width: o = "100%", value: s = "", onChange:
|
|
3698
|
+
const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r = !1, left: i = !1, small: a = !1, width: o = "100%", value: s = "", onChange: c = () => {}, onFocus: u = () => {}, onBlur: d = () => {}, selectOnFocus: f, tabIndex: p = 0, testId: g, tooltip: _ = null, warning: v = !1, validationCallback: y = () => {}, allowEmpty: b = !1, isInTable: x, groupOrder: S, enableCosmeticRounding: C = !0, enableDisplayRounding: w = !1, roundDisplayValue: T, disableInternalErrorValidationMessages: E = !1, disableValidationOnFocus: D = !1 }) => {
|
|
3026
3699
|
let O = (e) => {
|
|
3027
3700
|
let n = validateNumber(e), r = t && isEmptyNullOrUndefined(e);
|
|
3028
3701
|
return [Infinity, -Infinity].includes(Number(e)) || r ? {
|
|
@@ -3062,7 +3735,7 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3062
3735
|
name: F
|
|
3063
3736
|
}
|
|
3064
3737
|
};
|
|
3065
|
-
|
|
3738
|
+
c(t);
|
|
3066
3739
|
}
|
|
3067
3740
|
};
|
|
3068
3741
|
useEffect(() => {
|
|
@@ -3100,7 +3773,7 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3100
3773
|
isInTable: x,
|
|
3101
3774
|
groupOrder: S,
|
|
3102
3775
|
selectOnFocus: f,
|
|
3103
|
-
tabIndex:
|
|
3776
|
+
tabIndex: p,
|
|
3104
3777
|
tooltip: _,
|
|
3105
3778
|
ref: A
|
|
3106
3779
|
}, F);
|
|
@@ -3169,14 +3842,14 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3169
3842
|
testId: n
|
|
3170
3843
|
}) : null
|
|
3171
3844
|
}), LinkCell = ({ cell: e, testId: t }) => {
|
|
3172
|
-
let n = useContext(DisabledContext), { error: r, warning: i, tooltip: a, maxTooltipWidth: o } = e,
|
|
3845
|
+
let n = useContext(DisabledContext), { error: r, warning: i, tooltip: a, maxTooltipWidth: o } = e, s = (e) => isStringNumberOrNode(e);
|
|
3173
3846
|
return /* @__PURE__ */ jsx("div", {
|
|
3174
3847
|
className: cell_module_default.inputWrapper,
|
|
3175
3848
|
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
3176
3849
|
error: !!r,
|
|
3177
3850
|
warning: !!i,
|
|
3178
3851
|
text: a || r || i,
|
|
3179
|
-
enabled:
|
|
3852
|
+
enabled: s(a) || s(r) || s(i) || !1,
|
|
3180
3853
|
maxWidth: o,
|
|
3181
3854
|
children: /* @__PURE__ */ jsx("div", {
|
|
3182
3855
|
className: cell_module_default.staticCellContent,
|
|
@@ -3219,7 +3892,7 @@ var slider_module_default = {
|
|
|
3219
3892
|
] }),
|
|
3220
3893
|
children: /* @__PURE__ */ jsx("div", { className: slider_module_default.dot })
|
|
3221
3894
|
}), e), {}), isEqual$1);
|
|
3222
|
-
const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto", value: i, min: a, max: o, step:
|
|
3895
|
+
const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto", value: i, min: a, max: o, step: s = 1, marks: l = [], showArrows: u = !1, showTooltip: d = !1, tooltipFormatter: f = (e) => e, disabled: p = !1, range: m = !1, small: h = !1, vertical: g = {
|
|
3223
3896
|
enabled: !1,
|
|
3224
3897
|
width: "100px",
|
|
3225
3898
|
height: "400px"
|
|
@@ -3252,13 +3925,13 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3252
3925
|
})
|
|
3253
3926
|
});
|
|
3254
3927
|
return /* @__PURE__ */ jsxs("div", {
|
|
3255
|
-
className: cx(slider_module_default.container, h ? slider_module_default.small : "",
|
|
3256
|
-
style:
|
|
3257
|
-
width:
|
|
3258
|
-
height:
|
|
3928
|
+
className: cx(slider_module_default.container, h ? slider_module_default.small : "", g.enabled ? slider_module_default.vertical : ""),
|
|
3929
|
+
style: g.enabled ? {
|
|
3930
|
+
width: g.width,
|
|
3931
|
+
height: g.height
|
|
3259
3932
|
} : { width: n },
|
|
3260
3933
|
children: [
|
|
3261
|
-
u && (
|
|
3934
|
+
u && (g.enabled ? /* @__PURE__ */ jsx(C, {}) : /* @__PURE__ */ jsx(S, {})),
|
|
3262
3935
|
/* @__PURE__ */ jsx(RcSlider, {
|
|
3263
3936
|
range: m,
|
|
3264
3937
|
allowCross: !1,
|
|
@@ -3266,11 +3939,11 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3266
3939
|
value: i,
|
|
3267
3940
|
max: o,
|
|
3268
3941
|
min: a,
|
|
3269
|
-
step:
|
|
3942
|
+
step: s,
|
|
3270
3943
|
marks: b,
|
|
3271
3944
|
onChange: (e) => x(e),
|
|
3272
3945
|
disabled: p || y,
|
|
3273
|
-
vertical:
|
|
3946
|
+
vertical: g.enabled,
|
|
3274
3947
|
handleRender: (e, t) => {
|
|
3275
3948
|
let n = d && t.dragging;
|
|
3276
3949
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -3287,7 +3960,7 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3287
3960
|
});
|
|
3288
3961
|
}
|
|
3289
3962
|
}),
|
|
3290
|
-
u && (
|
|
3963
|
+
u && (g.enabled ? /* @__PURE__ */ jsx(S, {}) : /* @__PURE__ */ jsx(C, {})),
|
|
3291
3964
|
t && /* @__PURE__ */ jsx("label", {
|
|
3292
3965
|
className: slider_module_default.label,
|
|
3293
3966
|
style: { width: r },
|
|
@@ -3328,17 +4001,17 @@ var popover_module_default = {
|
|
|
3328
4001
|
fullWidthStyleFix: "_fullWidthStyleFix_lhie5_8",
|
|
3329
4002
|
dismiss: "_dismiss_lhie5_13"
|
|
3330
4003
|
};
|
|
3331
|
-
const Popover = ({ children: t, content: n, placement: r = "top-center", closeOnOutsideClick: i = !0, fullWidth: a = !1, showCloseButton: o = !1, testId:
|
|
3332
|
-
let
|
|
3333
|
-
!u && !
|
|
4004
|
+
const Popover = ({ children: t, content: n, placement: r = "top-center", closeOnOutsideClick: i = !0, fullWidth: a = !1, showCloseButton: o = !1, testId: s, disabled: u = !1, overflowContainer: d = !1, isOpen: f, onToggle: p }) => {
|
|
4005
|
+
let m = useContext(DisabledContext), [g, v] = f === void 0 ? useState(!1) : [f, p], y = () => {
|
|
4006
|
+
!u && !m && v && v(!1);
|
|
3334
4007
|
}, b = () => {
|
|
3335
|
-
u ||
|
|
4008
|
+
u || m || v && v(!g);
|
|
3336
4009
|
};
|
|
3337
4010
|
useEffect(() => {
|
|
3338
|
-
(u ||
|
|
3339
|
-
}, [u,
|
|
4011
|
+
(u || m) && y();
|
|
4012
|
+
}, [u, m]);
|
|
3340
4013
|
let { renderLayer: x, arrowProps: S, layerProps: C, triggerProps: w } = useLayer({
|
|
3341
|
-
isOpen:
|
|
4014
|
+
isOpen: g,
|
|
3342
4015
|
placement: r,
|
|
3343
4016
|
auto: !0,
|
|
3344
4017
|
triggerOffset: 6,
|
|
@@ -3349,9 +4022,9 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
|
|
|
3349
4022
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
3350
4023
|
ref: w.ref,
|
|
3351
4024
|
onClick: b,
|
|
3352
|
-
"data-testid":
|
|
4025
|
+
"data-testid": s,
|
|
3353
4026
|
children: t
|
|
3354
|
-
}),
|
|
4027
|
+
}), g && x(/* @__PURE__ */ jsxs("div", {
|
|
3355
4028
|
className: a ? cx(popover_module_default.toggleBox, popover_module_default.fullWidthStyleFix) : cx(popover_module_default.toggleBox),
|
|
3356
4029
|
...C,
|
|
3357
4030
|
children: [/* @__PURE__ */ jsxs("div", { children: [React.isValidElement(n) ? React.cloneElement(n, { close: y }) : n, o && /* @__PURE__ */ jsx("div", {
|
|
@@ -3477,33 +4150,36 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
|
|
|
3477
4150
|
let CellType = /* @__PURE__ */ function(e) {
|
|
3478
4151
|
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;
|
|
3479
4152
|
}({});
|
|
3480
|
-
const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a }) => {
|
|
4153
|
+
const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a, rowIndex: o, columnIndex: s }) => {
|
|
4154
|
+
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;
|
|
3481
4155
|
if (!e) return null;
|
|
3482
|
-
let { style:
|
|
4156
|
+
let { style: f, colSpan: p, rowSpan: h, width: g } = e, v = useRef(null), y = {
|
|
3483
4157
|
bodyAlignment: r,
|
|
3484
4158
|
headerAlignment: n,
|
|
3485
4159
|
isHeader: t
|
|
3486
|
-
},
|
|
3487
|
-
width:
|
|
3488
|
-
minWidth:
|
|
3489
|
-
textTransform:
|
|
3490
|
-
...
|
|
4160
|
+
}, b = getCellAlignment(y, cell_module_default), x = getCellAlignment(y, cell_module_default, !0), S = 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, C = cx(cell_module_default.cell, S, e.hasSort ? cell_module_default.sortingCell : null, b, e.breakWord ? cell_module_default.breakWord : "", d ? cell_module_default.selectedCell : ""), w = g ?? i ?? void 0, T = e.type === CellType.STATIC || !e.type, E = t && T ? TextTransform.CAPITALIZE : void 0, D = {
|
|
4161
|
+
width: w,
|
|
4162
|
+
minWidth: w,
|
|
4163
|
+
textTransform: E,
|
|
4164
|
+
...f
|
|
3491
4165
|
};
|
|
3492
4166
|
return /* @__PURE__ */ jsx(t ? "th" : "td", {
|
|
3493
|
-
ref:
|
|
3494
|
-
className:
|
|
3495
|
-
style:
|
|
3496
|
-
colSpan:
|
|
3497
|
-
rowSpan:
|
|
4167
|
+
ref: v,
|
|
4168
|
+
className: C,
|
|
4169
|
+
style: D,
|
|
4170
|
+
colSpan: p,
|
|
4171
|
+
rowSpan: h,
|
|
4172
|
+
"data-row-index": o,
|
|
4173
|
+
"data-column-index": s,
|
|
3498
4174
|
children: /* @__PURE__ */ jsx(CellWrapper, {
|
|
3499
4175
|
cell: e,
|
|
3500
|
-
columnAlignment:
|
|
4176
|
+
columnAlignment: x ?? Align.RIGHT,
|
|
3501
4177
|
isHeader: t,
|
|
3502
4178
|
testId: a
|
|
3503
4179
|
})
|
|
3504
4180
|
});
|
|
3505
4181
|
}, 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 }) => {
|
|
3506
|
-
let p = getHeaderAlignment(a, n, t), { onRowClick: m, onRowFocus: h, onRowMouseEnter:
|
|
4182
|
+
let p = getHeaderAlignment(a, n, t), { onRowClick: m, onRowFocus: h, onRowMouseEnter: g, onRowMouseLeave: v, expandedContent: y, error: b, warning: x, active: S } = e, C = e.cells.map((e, r) => {
|
|
3507
4183
|
let i = `${n ? 0 : 1}_${t}_${r}`;
|
|
3508
4184
|
return /* @__PURE__ */ jsx(Cell, {
|
|
3509
4185
|
cell: e,
|
|
@@ -3511,14 +4187,18 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3511
4187
|
columnAlignment: o[r],
|
|
3512
4188
|
columnHeaderAlignment: p[r],
|
|
3513
4189
|
width: l ? l[r] : void 0,
|
|
3514
|
-
testId: e.testId
|
|
4190
|
+
testId: e.testId,
|
|
4191
|
+
rowIndex: t,
|
|
4192
|
+
columnIndex: r
|
|
3515
4193
|
}, i);
|
|
3516
4194
|
}), w = s && /* @__PURE__ */ jsx(Cell, {
|
|
3517
4195
|
cell: {
|
|
3518
4196
|
type: CellType.ACTIONS,
|
|
3519
4197
|
actions: e.actions
|
|
3520
4198
|
},
|
|
3521
|
-
isHeader: n
|
|
4199
|
+
isHeader: n,
|
|
4200
|
+
rowIndex: t,
|
|
4201
|
+
columnIndex: r
|
|
3522
4202
|
}, r), { attributes: T, listeners: E, setNodeRef: D, transform: O, transition: k, isDragging: A } = useSortable({
|
|
3523
4203
|
id: t.toString(),
|
|
3524
4204
|
animateLayoutChanges: () => !1
|
|
@@ -3538,10 +4218,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3538
4218
|
});
|
|
3539
4219
|
return n ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
3540
4220
|
onClick: m,
|
|
3541
|
-
onMouseEnter:
|
|
4221
|
+
onMouseEnter: g,
|
|
3542
4222
|
onMouseLeave: v,
|
|
3543
4223
|
onFocus: h,
|
|
3544
|
-
className: cx(m ? row_module_default$1.clickableRow : null,
|
|
4224
|
+
className: cx(m ? row_module_default$1.clickableRow : null, g ? row_module_default$1.hoverableRow : null),
|
|
3545
4225
|
children: [
|
|
3546
4226
|
c ? /* @__PURE__ */ jsx("th", {}) : null,
|
|
3547
4227
|
C,
|
|
@@ -3554,10 +4234,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3554
4234
|
}, `${t}_expanded_content`) : null] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
3555
4235
|
ref: e.noDrag ? null : D,
|
|
3556
4236
|
onClick: m,
|
|
3557
|
-
onMouseEnter:
|
|
4237
|
+
onMouseEnter: g,
|
|
3558
4238
|
onMouseLeave: v,
|
|
3559
4239
|
onFocus: h,
|
|
3560
|
-
className: cx(m && !m.noStyle ? row_module_default$1.clickableRow : null,
|
|
4240
|
+
className: cx(m && !m.noStyle ? row_module_default$1.clickableRow : null, g && !g.noStyle ? row_module_default$1.hoverableRow : null, S ? row_module_default$1.rowActive : null),
|
|
3561
4241
|
"data-error": b || null,
|
|
3562
4242
|
"data-warning": x || null,
|
|
3563
4243
|
"data-index": t,
|
|
@@ -3574,14 +4254,14 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3574
4254
|
children: y.content
|
|
3575
4255
|
}, `${t}_expanded_content`) : null] });
|
|
3576
4256
|
}, TableDragWrapper = (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, [
|
|
4257
|
+
let { children: t, colSpan: n, columnAlignment: r, columnCount: i, draggable: a, onListReorder: o = () => {}, canListReorder: s = () => !0, rowActions: c, rows: l = [], tbodyRef: u } = e, [d, p] = useState(null), [m, g] = useState(!1), v = useMemo(() => l.map((e, t) => t.toString()), [l]);
|
|
3578
4258
|
return a ? /* @__PURE__ */ jsxs(DndContext, {
|
|
3579
4259
|
collisionDetection: closestCenter,
|
|
3580
4260
|
onDragStart: (e) => {
|
|
3581
4261
|
p(e.active.id);
|
|
3582
4262
|
},
|
|
3583
4263
|
onDragEnd: (e) => {
|
|
3584
|
-
p(null),
|
|
4264
|
+
p(null), g(!1);
|
|
3585
4265
|
let { active: t, over: n } = e;
|
|
3586
4266
|
if (!t || !n || t.id === n.id) return;
|
|
3587
4267
|
let r = Number(t.id), i = Number(n?.id);
|
|
@@ -3598,23 +4278,23 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3598
4278
|
from: r,
|
|
3599
4279
|
to: i
|
|
3600
4280
|
});
|
|
3601
|
-
|
|
4281
|
+
g(a);
|
|
3602
4282
|
},
|
|
3603
4283
|
children: [/* @__PURE__ */ jsx(SortableContext, {
|
|
3604
4284
|
items: v,
|
|
3605
4285
|
strategy: verticalListSortingStrategy,
|
|
3606
|
-
children: t({ dropDisabled:
|
|
3607
|
-
}), !!
|
|
4286
|
+
children: t({ dropDisabled: m })
|
|
4287
|
+
}), !!d && createPortal(/* @__PURE__ */ jsx(DragOverlay, {
|
|
3608
4288
|
dropAnimation: null,
|
|
3609
4289
|
children: /* @__PURE__ */ jsx("table", {
|
|
3610
4290
|
className: cx(table_module_default.table, table_module_default.dragOverlay),
|
|
3611
4291
|
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(Row$1, {
|
|
3612
|
-
rowIndex: Number(
|
|
3613
|
-
row: l[Number(
|
|
4292
|
+
rowIndex: Number(d),
|
|
4293
|
+
row: l[Number(d)],
|
|
3614
4294
|
columnCount: i,
|
|
3615
4295
|
columnWidths: (() => {
|
|
3616
4296
|
if (!u?.current) return [];
|
|
3617
|
-
let e = u.current.querySelectorAll("tr")[Number(
|
|
4297
|
+
let e = u.current.querySelectorAll("tr")[Number(d)]?.querySelectorAll("td");
|
|
3618
4298
|
if (!e) return [];
|
|
3619
4299
|
let t = Array.from(e).map((e) => `${e.getBoundingClientRect().width}px`);
|
|
3620
4300
|
return t.shift(), t;
|
|
@@ -3623,7 +4303,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3623
4303
|
hasRowActions: c,
|
|
3624
4304
|
columnAlignment: r,
|
|
3625
4305
|
draggableTable: a,
|
|
3626
|
-
dropDisabled:
|
|
4306
|
+
dropDisabled: m
|
|
3627
4307
|
}) })
|
|
3628
4308
|
})
|
|
3629
4309
|
}), document.body)]
|
|
@@ -3665,135 +4345,155 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3665
4345
|
className: table_module_default.scroll,
|
|
3666
4346
|
children: n({})
|
|
3667
4347
|
});
|
|
3668
|
-
}, Table = (e) => {
|
|
3669
|
-
let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i } = e, { columnWidths:
|
|
3670
|
-
|
|
4348
|
+
}, Table = withValidationScope((e) => {
|
|
4349
|
+
let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i, enableMultiSelect: a } = e, { columnWidths: o, footer: s, name: c, rows: l = [], actions: u, actionsRight: d, columnHeaderAlignments: f, columnAlignment: p, striped: h = !0, testId: g, draggable: v, defaultEmptyRow: y = null, onAddRow: b = null, bordered: x = !0, maxHeight: S, fixedWidth: C, onPasteApply: w, validationRules: T } = i, E = useValidationScopeId(), D = useRef(E ?? nextScopeId()).current;
|
|
4350
|
+
useRegisterValidationRules(D, T);
|
|
4351
|
+
let O = useRef(null), k = useRef(null), { selectedIndexes: A, setSelectedIndexes: j, onCopy: M, onPaste: N, onKeyDown: P, onKeyUp: F, onMouseUp: I, onBlur: L, onMouseDown: R, onMouseMove: z } = useCellSelection(!!a, k, e.table.rows || [], w), B = get(e, "table.headers", []), V = getColumnCount(l, B), H = hasRowActions(l, B), U = V + (H ? 1 : 0), W = s ? s?.pagination?.rowsPerPage?.value === 0 || Number(s?.pagination?.selectedPage) >= Number(s?.pagination?.rowCount) / Number(s?.pagination?.rowsPerPage?.value) : !0, G = y?.cells?.length && b && W, K = {
|
|
4352
|
+
cells: G ? y.cells.map((e, t) => e?.type === "Input" ? {
|
|
3671
4353
|
...e,
|
|
3672
4354
|
onChange: (e) => {
|
|
3673
4355
|
let n = e?.target?.value, r = {
|
|
3674
|
-
...
|
|
3675
|
-
cells:
|
|
4356
|
+
...y,
|
|
4357
|
+
cells: y.cells.map((e, r) => ({
|
|
3676
4358
|
...e,
|
|
3677
4359
|
value: r === t ? n : e?.value
|
|
3678
4360
|
}))
|
|
3679
4361
|
};
|
|
3680
|
-
|
|
4362
|
+
b({ newRow: r });
|
|
3681
4363
|
}
|
|
3682
4364
|
} : {
|
|
3683
4365
|
...e,
|
|
3684
4366
|
disabled: !0
|
|
3685
4367
|
}) : null,
|
|
3686
|
-
testId:
|
|
3687
|
-
},
|
|
4368
|
+
testId: g ? `${g}-last-empty-row` : void 0
|
|
4369
|
+
}, q = G ? l.concat(K) : l, J = {
|
|
3688
4370
|
...i,
|
|
3689
|
-
rows:
|
|
3690
|
-
},
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
4371
|
+
rows: q
|
|
4372
|
+
}, Y = cx(table_module_default.wrapper, x ? table_module_default.bordered : ""), X = {
|
|
4373
|
+
maxHeight: S,
|
|
4374
|
+
width: C,
|
|
4375
|
+
display: C === "auto" ? "inline-flex" : "flex"
|
|
4376
|
+
};
|
|
4377
|
+
return /* @__PURE__ */ jsx(ValidationScopeContext.Provider, {
|
|
4378
|
+
value: D,
|
|
4379
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4380
|
+
className: Y,
|
|
4381
|
+
style: X,
|
|
4382
|
+
children: [
|
|
4383
|
+
/* @__PURE__ */ jsx(Title$1, {
|
|
4384
|
+
actions: u,
|
|
4385
|
+
actionsRight: d,
|
|
4386
|
+
name: c,
|
|
4387
|
+
testId: g && `${g}-title`
|
|
4388
|
+
}),
|
|
4389
|
+
/* @__PURE__ */ jsx(TableDragWrapper, {
|
|
4390
|
+
colSpan: U,
|
|
4391
|
+
columnAlignment: p,
|
|
4392
|
+
columnCount: V,
|
|
4393
|
+
draggable: v,
|
|
4394
|
+
onListReorder: t,
|
|
4395
|
+
rowActions: H,
|
|
4396
|
+
rows: q,
|
|
4397
|
+
tbodyRef: k,
|
|
4398
|
+
canListReorder: n,
|
|
4399
|
+
children: ({ dropDisabled: e }) => /* @__PURE__ */ jsx(TableScrollWrapper, {
|
|
4400
|
+
table: J,
|
|
4401
|
+
theadRef: O,
|
|
4402
|
+
children: ({ virtualizer: t, tableStyle: n }) => /* @__PURE__ */ jsx(CellSelectionContext.Provider, {
|
|
4403
|
+
value: {
|
|
4404
|
+
selectedIndexes: A,
|
|
4405
|
+
setSelectedIndexes: j
|
|
4406
|
+
},
|
|
4407
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
4408
|
+
className: cx(table_module_default.table, h ? table_module_default.striped : ""),
|
|
4409
|
+
"data-testid": g,
|
|
4410
|
+
"data-multiselect": !!a,
|
|
4411
|
+
style: n,
|
|
4412
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
4413
|
+
ref: O,
|
|
4414
|
+
children: B.map((e, t) => /* @__PURE__ */ jsx(Row$1, {
|
|
4415
|
+
rowIndex: t,
|
|
4416
|
+
isHeader: !0,
|
|
4417
|
+
row: e,
|
|
4418
|
+
columnCount: V,
|
|
4419
|
+
columnWidths: o,
|
|
4420
|
+
colSpan: U,
|
|
4421
|
+
hasRowActions: H,
|
|
4422
|
+
columnAlignment: p,
|
|
4423
|
+
columnHeaderAlignments: f,
|
|
4424
|
+
draggableTable: v
|
|
4425
|
+
}, `0_${t}`))
|
|
4426
|
+
}), /* @__PURE__ */ jsx("tbody", {
|
|
4427
|
+
ref: k,
|
|
4428
|
+
onCopy: M,
|
|
4429
|
+
onPaste: N,
|
|
4430
|
+
onKeyDown: P,
|
|
4431
|
+
onKeyUp: F,
|
|
4432
|
+
onMouseDown: R,
|
|
4433
|
+
onMouseUp: I,
|
|
4434
|
+
onMouseMove: z,
|
|
4435
|
+
onBlur: L,
|
|
4436
|
+
children: t ? t.getVirtualItems().map((t) => {
|
|
4437
|
+
let n = t.index, i = q[n], a = r ? r({
|
|
4438
|
+
row: i,
|
|
4439
|
+
rowIndex: n
|
|
4440
|
+
}) : i;
|
|
4441
|
+
return /* @__PURE__ */ jsx(Row$1, {
|
|
4442
|
+
rowIndex: n,
|
|
4443
|
+
row: a,
|
|
4444
|
+
columnCount: V,
|
|
4445
|
+
columnWidths: o,
|
|
4446
|
+
colSpan: U,
|
|
4447
|
+
hasRowActions: H,
|
|
4448
|
+
columnAlignment: p,
|
|
4449
|
+
draggableTable: v,
|
|
4450
|
+
height: t.size,
|
|
4451
|
+
dropDisabled: e
|
|
4452
|
+
}, `1_${n}`);
|
|
4453
|
+
}) : q.map((t, n) => {
|
|
4454
|
+
let i = r ? r({
|
|
4455
|
+
row: t,
|
|
4456
|
+
rowIndex: n
|
|
4457
|
+
}) : t;
|
|
4458
|
+
return /* @__PURE__ */ jsx(Row$1, {
|
|
4459
|
+
rowIndex: n,
|
|
4460
|
+
row: i,
|
|
4461
|
+
columnCount: V,
|
|
4462
|
+
columnWidths: o,
|
|
4463
|
+
colSpan: U,
|
|
4464
|
+
hasRowActions: H,
|
|
4465
|
+
columnAlignment: p,
|
|
4466
|
+
draggableTable: v,
|
|
4467
|
+
dropDisabled: e
|
|
4468
|
+
}, `1_${n}`);
|
|
4469
|
+
})
|
|
4470
|
+
})]
|
|
3771
4471
|
})
|
|
3772
|
-
})
|
|
4472
|
+
})
|
|
3773
4473
|
})
|
|
4474
|
+
}),
|
|
4475
|
+
s && /* @__PURE__ */ jsx(Footer, {
|
|
4476
|
+
pagination: s.pagination,
|
|
4477
|
+
actions: s.actions,
|
|
4478
|
+
content: s.content
|
|
3774
4479
|
})
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
pagination: o.pagination,
|
|
3778
|
-
actions: o.actions,
|
|
3779
|
-
content: o.content
|
|
3780
|
-
})
|
|
3781
|
-
]
|
|
4480
|
+
]
|
|
4481
|
+
})
|
|
3782
4482
|
});
|
|
3783
|
-
}, placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
|
|
4483
|
+
}), placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
|
|
3784
4484
|
let i = `${t} → ${n}:`, a = e.filter((e) => !e.startsWith(i)), o = r ? [...a, `${i} ${r}`] : a, s = o.length === 0;
|
|
3785
4485
|
return {
|
|
3786
4486
|
updatedErrors: o,
|
|
3787
4487
|
isValid: s
|
|
3788
4488
|
};
|
|
3789
4489
|
}, Table$1 = ({ validationRules: e, parsedResult: t, updateState: n, testId: r }) => {
|
|
3790
|
-
let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a,
|
|
4490
|
+
let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a, o] = useState(20), [c, u] = useState(1), d = useRef([]), p = (c - 1) * a, g = a === 0 ? t.rows.length : p + a, [_, v] = useState([]), y = useCallback((r, a) => (!d.current.length && t.rows.length && (d.current = t.rows[0].map((e) => isNumericLike(e) ? "NumberInput" : "Input")), {
|
|
3791
4491
|
cells: r.map((r, o) => {
|
|
3792
|
-
let { columnMessage: s = {}, validator: c = () => null } = e?.[o] ?? {}, l = i?.[o]?.value, u = `${`Row ${a + 1}`} → ${l}:`,
|
|
4492
|
+
let { columnMessage: s = {}, validator: c = () => null } = e?.[o] ?? {}, l = i?.[o]?.value, u = `${`Row ${a + 1}`} → ${l}:`, f = c(r), p = t?.errors?.find((e) => e.startsWith(u)) ?? null, m = f || p || null;
|
|
3793
4493
|
return {
|
|
3794
4494
|
name: l,
|
|
3795
4495
|
value: r,
|
|
3796
|
-
type:
|
|
4496
|
+
type: d.current[o] ?? "Input",
|
|
3797
4497
|
disableValidationOnFocus: !0,
|
|
3798
4498
|
error: m,
|
|
3799
4499
|
validationCallback: (e, r) => {
|
|
@@ -3878,12 +4578,12 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3878
4578
|
i,
|
|
3879
4579
|
x,
|
|
3880
4580
|
b
|
|
3881
|
-
]), C = useMemo(() => _.slice(
|
|
4581
|
+
]), C = useMemo(() => _.slice(p, g), [
|
|
3882
4582
|
_,
|
|
3883
|
-
|
|
4583
|
+
p,
|
|
3884
4584
|
g
|
|
3885
4585
|
]), w = useCallback(({ rowIndex: e }) => {
|
|
3886
|
-
let n =
|
|
4586
|
+
let n = p + e, r = t.rows[n];
|
|
3887
4587
|
return r ? y(r, n) : {
|
|
3888
4588
|
cells: [],
|
|
3889
4589
|
actions: []
|
|
@@ -3891,7 +4591,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3891
4591
|
}, [
|
|
3892
4592
|
t.rows,
|
|
3893
4593
|
y,
|
|
3894
|
-
|
|
4594
|
+
p
|
|
3895
4595
|
]);
|
|
3896
4596
|
return /* @__PURE__ */ jsx(Table, {
|
|
3897
4597
|
beforeRenderRow: w,
|
|
@@ -3917,10 +4617,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3917
4617
|
infiniteScroll: !0,
|
|
3918
4618
|
footer: { pagination: {
|
|
3919
4619
|
rowCount: t.rows.length,
|
|
3920
|
-
selectedPage:
|
|
4620
|
+
selectedPage: c,
|
|
3921
4621
|
rowsPerPage: {
|
|
3922
4622
|
value: a,
|
|
3923
|
-
onChange: (e) =>
|
|
4623
|
+
onChange: (e) => o(Number(e?.target?.value)),
|
|
3924
4624
|
options: [
|
|
3925
4625
|
{
|
|
3926
4626
|
label: "10 / page",
|
|
@@ -4030,210 +4730,7 @@ const Empty = ({ width: e = "auto", height: t = "auto", text: n = "No data", chi
|
|
|
4030
4730
|
}), extraSeparators = (e) => e?.split(/;|\t|\n/)?.some((e) => {
|
|
4031
4731
|
let t = e?.match(/[.,]/g);
|
|
4032
4732
|
return t && t.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
|
+
}), hasOneComma = (e) => e?.split(/;|\t|\n/)?.some((e) => !e?.includes(".") && e?.match(/,/g)?.length === 1), toast = ({ id: e, message: t = {
|
|
4237
4734
|
type: MessageType.INFO,
|
|
4238
4735
|
content: ""
|
|
4239
4736
|
}, autoClose: n = 6e3, onClose: r }) => {
|
|
@@ -4288,13 +4785,13 @@ var toggle_module_default = {
|
|
|
4288
4785
|
noMargin: "_noMargin_1c9wf_110",
|
|
4289
4786
|
helpIconEnabled: "_helpIconEnabled_1c9wf_113"
|
|
4290
4787
|
};
|
|
4291
|
-
const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, small: a = !1, onChange: o, noMargin:
|
|
4292
|
-
let
|
|
4788
|
+
const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, small: a = !1, onChange: o, noMargin: s = !1, testId: l, helpText: u, onClickHelp: d }) => {
|
|
4789
|
+
let f = useContext(DisabledContext), p = u || d, m = r || f;
|
|
4293
4790
|
return /* @__PURE__ */ jsxs("div", {
|
|
4294
|
-
className: cx(toggle_module_default.toggle,
|
|
4791
|
+
className: cx(toggle_module_default.toggle, m ? toggle_module_default.disabled : null, a ? toggle_module_default.small : null, s ? toggle_module_default.noMargin : null),
|
|
4295
4792
|
style: { display: i },
|
|
4296
4793
|
onClick: (t) => {
|
|
4297
|
-
|
|
4794
|
+
m || (t.target.name = e, t.target.checked = !n, t.target.value = !n, o(t));
|
|
4298
4795
|
},
|
|
4299
4796
|
"data-testid": l,
|
|
4300
4797
|
children: [
|
|
@@ -4302,22 +4799,19 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4302
4799
|
type: InputType.CHECKBOX,
|
|
4303
4800
|
name: e,
|
|
4304
4801
|
value: n?.toString(),
|
|
4305
|
-
disabled:
|
|
4802
|
+
disabled: m,
|
|
4306
4803
|
checked: n,
|
|
4307
4804
|
onChange: () => {}
|
|
4308
4805
|
}),
|
|
4309
|
-
/* @__PURE__ */ jsx("label", {
|
|
4310
|
-
|
|
4311
|
-
children: t
|
|
4312
|
-
}),
|
|
4313
|
-
m && /* @__PURE__ */ jsx("div", {
|
|
4806
|
+
/* @__PURE__ */ jsx("label", { children: t }),
|
|
4807
|
+
p && /* @__PURE__ */ jsx("div", {
|
|
4314
4808
|
className: toggle_module_default.helpIconEnabled,
|
|
4315
4809
|
onClick: d,
|
|
4316
4810
|
children: /* @__PURE__ */ jsx(HelpIcon, { text: u })
|
|
4317
4811
|
})
|
|
4318
4812
|
]
|
|
4319
4813
|
});
|
|
4320
|
-
}, PasteWithReviewModal = ({ config: e, state: t, updateState: n, setModalVisibility: r, onCloseModal: i, readAndParseInput: a, validationRules:
|
|
4814
|
+
}, PasteWithReviewModal = ({ config: e, state: t, updateState: n, setModalVisibility: r, onCloseModal: i, readAndParseInput: a, validationRules: o = [], onCompleteImport: c = () => {}, prevalidationConfig: l, t: u, loading: d, startTransition: f, testId: p }) => {
|
|
4321
4815
|
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({
|
|
4322
4816
|
pastedText: "",
|
|
4323
4817
|
parsedResult: {
|
|
@@ -4338,15 +4832,15 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4338
4832
|
let O = useCallback((t) => {
|
|
4339
4833
|
if (t) {
|
|
4340
4834
|
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 = {
|
|
4341
|
-
validationRules:
|
|
4835
|
+
validationRules: o,
|
|
4342
4836
|
importLimit: n
|
|
4343
|
-
}, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2),
|
|
4837
|
+
}, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2), s = unParse(i, a, t, r);
|
|
4344
4838
|
f(() => D({
|
|
4345
4839
|
parsedResult: {
|
|
4346
4840
|
...N,
|
|
4347
4841
|
rows: t
|
|
4348
4842
|
},
|
|
4349
|
-
pastedText:
|
|
4843
|
+
pastedText: s
|
|
4350
4844
|
})), C.current = E;
|
|
4351
4845
|
} else f(() => {
|
|
4352
4846
|
C.current && D(C.current);
|
|
@@ -4355,7 +4849,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4355
4849
|
}, [
|
|
4356
4850
|
E,
|
|
4357
4851
|
n,
|
|
4358
|
-
|
|
4852
|
+
o
|
|
4359
4853
|
]), k = () => {
|
|
4360
4854
|
D({
|
|
4361
4855
|
pastedText: "",
|
|
@@ -4408,7 +4902,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4408
4902
|
]
|
|
4409
4903
|
}),
|
|
4410
4904
|
_ && /* @__PURE__ */ jsx(Help, {
|
|
4411
|
-
validationRules:
|
|
4905
|
+
validationRules: o,
|
|
4412
4906
|
t: u
|
|
4413
4907
|
}),
|
|
4414
4908
|
R ? /* @__PURE__ */ jsx("div", {
|
|
@@ -4441,7 +4935,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4441
4935
|
},
|
|
4442
4936
|
colored: !0,
|
|
4443
4937
|
loading: d,
|
|
4444
|
-
testId: `${
|
|
4938
|
+
testId: `${p}-paste-from-clipboard-button`
|
|
4445
4939
|
})
|
|
4446
4940
|
]
|
|
4447
4941
|
})
|
|
@@ -4473,7 +4967,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4473
4967
|
} })
|
|
4474
4968
|
]
|
|
4475
4969
|
}), /* @__PURE__ */ jsx(Table$1, {
|
|
4476
|
-
validationRules:
|
|
4970
|
+
validationRules: o,
|
|
4477
4971
|
parsedResult: N,
|
|
4478
4972
|
updateState: (e) => D((t) => ({
|
|
4479
4973
|
...t,
|
|
@@ -4500,7 +4994,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4500
4994
|
onClick: () => f(() => j()),
|
|
4501
4995
|
disabled: R || !F,
|
|
4502
4996
|
loading: d,
|
|
4503
|
-
testId: `${
|
|
4997
|
+
testId: `${p}-paste-with-review-modal-button-okay`
|
|
4504
4998
|
}),
|
|
4505
4999
|
/* @__PURE__ */ jsx(Button, {
|
|
4506
5000
|
label: u("cancel"),
|
|
@@ -4546,75 +5040,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4546
5040
|
return;
|
|
4547
5041
|
}
|
|
4548
5042
|
return t;
|
|
4549
|
-
}, [t, n]),
|
|
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
|
+
}, [t, n]), normalizeParsedResult = (e) => {
|
|
4618
5044
|
let { rows: t } = e, n = Array(t.length);
|
|
4619
5045
|
for (let e = 0; e < t.length; e++) {
|
|
4620
5046
|
let r = t[e], i = Array(r.length);
|
|
@@ -4626,16 +5052,16 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4626
5052
|
rows: n
|
|
4627
5053
|
};
|
|
4628
5054
|
}, useDataImportActions = ({ config: e, state: t, setState: n, smartUploadConfig: r, startTransition: i }) => {
|
|
4629
|
-
let { exportData: a, beforeExportData:
|
|
5055
|
+
let { exportData: a, beforeExportData: o, importLimit: c = 1e4, translations: l, onImportComplete: u = () => {}, disablePasteSuccessfulToast: d, prevalidationConfig: f, onDeleteRows: p } = e ?? {}, { parsedResult: m } = t, { checkPrevalidationNeed: h } = f ?? {}, g = useTranslationMap(l), _ = useExportData(g, a, o), { parseAndValidate: v, rules: y } = useScopedParseAndValidate(), b = useCallback((e) => {
|
|
4630
5056
|
n((t) => ({
|
|
4631
5057
|
...t,
|
|
4632
5058
|
...e
|
|
4633
5059
|
}));
|
|
4634
|
-
}, [n]),
|
|
5060
|
+
}, [n]), x = useCallback(({ name: e, callback: n } = {}) => {
|
|
4635
5061
|
let r = { ...t.modalVisibility }, i = !e, a = [];
|
|
4636
5062
|
if (i) for (let e of Object.keys(r)) a.push(e), r[e] = !1;
|
|
4637
5063
|
else r?.[e] && (a.push(e), r[e] = !1);
|
|
4638
|
-
a
|
|
5064
|
+
a?.length > 0 && b({
|
|
4639
5065
|
modalVisibility: r,
|
|
4640
5066
|
pastedText: "",
|
|
4641
5067
|
parsedResult: {
|
|
@@ -4645,9 +5071,9 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4645
5071
|
units: [],
|
|
4646
5072
|
errors: []
|
|
4647
5073
|
}
|
|
4648
|
-
}), typeof n == "function" && a
|
|
4649
|
-
}, [t.modalVisibility,
|
|
4650
|
-
i(() =>
|
|
5074
|
+
}), typeof n == "function" && a?.length > 0 && n();
|
|
5075
|
+
}, [t.modalVisibility, b]), S = useCallback(() => {
|
|
5076
|
+
i(() => b({
|
|
4651
5077
|
pastedText: "",
|
|
4652
5078
|
parsedResult: {
|
|
4653
5079
|
isValid: !1,
|
|
@@ -4656,55 +5082,52 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4656
5082
|
units: [],
|
|
4657
5083
|
errors: []
|
|
4658
5084
|
}
|
|
4659
|
-
})),
|
|
4660
|
-
}, [t.modalVisibility,
|
|
4661
|
-
|
|
5085
|
+
})), p && p?.("all");
|
|
5086
|
+
}, [t.modalVisibility, b]), C = useCallback((e, n) => {
|
|
5087
|
+
b({ modalVisibility: {
|
|
4662
5088
|
...t.modalVisibility,
|
|
4663
5089
|
[e]: n
|
|
4664
5090
|
} });
|
|
4665
|
-
}, [t.modalVisibility,
|
|
5091
|
+
}, [t.modalVisibility, b]), w = useCallback(async (e) => {
|
|
4666
5092
|
let t = {
|
|
4667
|
-
validationRules:
|
|
5093
|
+
validationRules: y,
|
|
4668
5094
|
importLimit: c
|
|
4669
|
-
}, n = await
|
|
4670
|
-
if (
|
|
5095
|
+
}, n = await v(e, g), r = normalizeParsedResult(n);
|
|
5096
|
+
if (h && h(m)) {
|
|
4671
5097
|
let { fields: e, units: n, rows: a, isValid: o } = r, s = unParse(e, n ?? [], a, t);
|
|
4672
|
-
return i(() =>
|
|
5098
|
+
return i(() => b({
|
|
4673
5099
|
pastedText: s,
|
|
4674
|
-
parsedResult:
|
|
5100
|
+
parsedResult: m
|
|
4675
5101
|
})), r;
|
|
4676
5102
|
}
|
|
4677
|
-
return i(() =>
|
|
5103
|
+
return i(() => b({
|
|
4678
5104
|
pastedText: e,
|
|
4679
5105
|
parsedResult: r
|
|
4680
5106
|
})), r;
|
|
4681
5107
|
}, [
|
|
4682
|
-
|
|
5108
|
+
y,
|
|
4683
5109
|
c,
|
|
4684
|
-
_,
|
|
4685
5110
|
g,
|
|
4686
5111
|
h,
|
|
4687
|
-
|
|
4688
|
-
|
|
5112
|
+
m,
|
|
5113
|
+
b
|
|
5114
|
+
]), T = useCallback(async (e) => {
|
|
4689
5115
|
let { fromFile: t, showSuccessToast: n = !0 } = e ?? {}, r;
|
|
4690
5116
|
try {
|
|
4691
5117
|
if (r = t ? await t.text() : await navigator.clipboard.readText(), !r) {
|
|
4692
5118
|
transitionToast({ message: {
|
|
4693
5119
|
type: "Error",
|
|
4694
|
-
content:
|
|
5120
|
+
content: g(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed")
|
|
4695
5121
|
} }, i);
|
|
4696
5122
|
return;
|
|
4697
5123
|
}
|
|
4698
|
-
let e = await
|
|
4699
|
-
validationRules: l,
|
|
4700
|
-
importLimit: c
|
|
4701
|
-
}, _), a = normalizeParsedResult(e);
|
|
5124
|
+
let e = await v(r, g), a = normalizeParsedResult(e);
|
|
4702
5125
|
return a?.isValid || transitionToast({ message: {
|
|
4703
5126
|
type: "Error",
|
|
4704
|
-
content:
|
|
5127
|
+
content: g("clipboardReadFailed")
|
|
4705
5128
|
} }, i), n && transitionToast({ message: {
|
|
4706
5129
|
type: "Success",
|
|
4707
|
-
content:
|
|
5130
|
+
content: g("pasteSuccessful")
|
|
4708
5131
|
} }, i), {
|
|
4709
5132
|
pastedText: r,
|
|
4710
5133
|
parsedResult: a
|
|
@@ -4712,78 +5135,78 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4712
5135
|
} catch (e) {
|
|
4713
5136
|
transitionToast({ message: {
|
|
4714
5137
|
type: "Error",
|
|
4715
|
-
content:
|
|
5138
|
+
content: g(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed"),
|
|
4716
5139
|
details: e.message
|
|
4717
5140
|
} }, i);
|
|
4718
5141
|
return;
|
|
4719
5142
|
}
|
|
4720
|
-
}, [
|
|
5143
|
+
}, [y, c]), E = useCallback(async (e) => {
|
|
4721
5144
|
let t = e?.target?.files?.[0];
|
|
4722
5145
|
if (!t) return;
|
|
4723
|
-
let n = await t.text(), r = await
|
|
4724
|
-
r.isValid ? (
|
|
5146
|
+
let n = await t.text(), r = await w(n);
|
|
5147
|
+
r.isValid ? (d || transitionToast({ message: {
|
|
4725
5148
|
type: "Success",
|
|
4726
|
-
content:
|
|
4727
|
-
} }, i), i(() =>
|
|
5149
|
+
content: g("pasteSuccessful")
|
|
5150
|
+
} }, i), i(() => u(r))) : transitionToast({ message: {
|
|
4728
5151
|
type: "Error",
|
|
4729
|
-
content:
|
|
5152
|
+
content: g("fileParsingFailed")
|
|
4730
5153
|
} }, i);
|
|
4731
5154
|
}, [
|
|
4732
|
-
l,
|
|
4733
|
-
c,
|
|
4734
5155
|
y,
|
|
4735
|
-
|
|
4736
|
-
|
|
5156
|
+
c,
|
|
5157
|
+
b,
|
|
5158
|
+
u
|
|
5159
|
+
]), D = useCallback(async (e = !0) => {
|
|
4737
5160
|
try {
|
|
4738
5161
|
let t = await navigator.clipboard.readText();
|
|
4739
5162
|
if (!t) {
|
|
4740
5163
|
transitionToast({ message: {
|
|
4741
5164
|
type: "Error",
|
|
4742
|
-
content:
|
|
5165
|
+
content: g("clipboardIsEmpty")
|
|
4743
5166
|
} }, i);
|
|
4744
5167
|
return;
|
|
4745
5168
|
}
|
|
4746
|
-
let n = await
|
|
5169
|
+
let n = await w(t);
|
|
4747
5170
|
if (!n.isValid) {
|
|
4748
5171
|
transitionToast({ message: {
|
|
4749
5172
|
type: "Error",
|
|
4750
|
-
content:
|
|
5173
|
+
content: g("clipboardReadFailed")
|
|
4751
5174
|
} }, i);
|
|
4752
5175
|
return;
|
|
4753
5176
|
}
|
|
4754
|
-
|
|
5177
|
+
d || transitionToast({ message: {
|
|
4755
5178
|
type: "Success",
|
|
4756
|
-
content:
|
|
4757
|
-
} }, i), e && i(() =>
|
|
5179
|
+
content: g("pasteSuccessful")
|
|
5180
|
+
} }, i), e && i(() => u(n));
|
|
4758
5181
|
} catch {
|
|
4759
5182
|
transitionToast({ message: {
|
|
4760
5183
|
type: "Error",
|
|
4761
|
-
content:
|
|
5184
|
+
content: g("clipboardReadNotAllowed")
|
|
4762
5185
|
} }, i);
|
|
4763
5186
|
}
|
|
4764
5187
|
}, [
|
|
4765
|
-
l,
|
|
4766
|
-
c,
|
|
4767
|
-
_,
|
|
4768
5188
|
y,
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
5189
|
+
c,
|
|
5190
|
+
g,
|
|
5191
|
+
b,
|
|
5192
|
+
u
|
|
5193
|
+
]), O = useCallback(async (e) => {
|
|
5194
|
+
let t = await _();
|
|
4772
5195
|
if (!t) return;
|
|
4773
|
-
let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r ?? []).map((e) => e?.length ? e : placeholder$1).slice(0, n
|
|
5196
|
+
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: " " });
|
|
4774
5197
|
try {
|
|
4775
5198
|
await navigator.clipboard.writeText(l), transitionToast({ message: {
|
|
4776
5199
|
type: "Success",
|
|
4777
|
-
content:
|
|
5200
|
+
content: g("copiedToClipboard")
|
|
4778
5201
|
} }, i);
|
|
4779
5202
|
} catch (e) {
|
|
4780
5203
|
transitionToast({ message: {
|
|
4781
5204
|
type: "Error",
|
|
4782
|
-
content:
|
|
5205
|
+
content: g("unableToCopyToClipboard"),
|
|
4783
5206
|
details: e.message
|
|
4784
5207
|
} }, i);
|
|
4785
5208
|
}
|
|
4786
|
-
}, [
|
|
5209
|
+
}, [_, g]), k = useCallback((e) => {
|
|
4787
5210
|
if (!e || e.errorMessage) {
|
|
4788
5211
|
transitionToast({ message: {
|
|
4789
5212
|
type: "Error",
|
|
@@ -4798,24 +5221,24 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4798
5221
|
rows: n.map((e) => Object.values(e)),
|
|
4799
5222
|
errors: []
|
|
4800
5223
|
};
|
|
4801
|
-
i(() =>
|
|
5224
|
+
i(() => b({ parsedResult: a })), i(() => u(a));
|
|
4802
5225
|
let { onComplete: o } = r ?? {};
|
|
4803
|
-
typeof o == "function" && o(a),
|
|
5226
|
+
typeof o == "function" && o(a), x();
|
|
4804
5227
|
}, [
|
|
4805
|
-
|
|
4806
|
-
|
|
5228
|
+
b,
|
|
5229
|
+
u,
|
|
4807
5230
|
r
|
|
4808
5231
|
]);
|
|
4809
5232
|
return {
|
|
4810
|
-
updateState:
|
|
4811
|
-
closeModals:
|
|
4812
|
-
setModalVisibility:
|
|
4813
|
-
readAndParseInput:
|
|
4814
|
-
onFileChange:
|
|
4815
|
-
onClickQuickPasteFromClipBoard:
|
|
4816
|
-
onClickCopyClipboard:
|
|
4817
|
-
onSmartUploadResult:
|
|
4818
|
-
deleteAllRows:
|
|
5233
|
+
updateState: b,
|
|
5234
|
+
closeModals: x,
|
|
5235
|
+
setModalVisibility: C,
|
|
5236
|
+
readAndParseInput: T,
|
|
5237
|
+
onFileChange: E,
|
|
5238
|
+
onClickQuickPasteFromClipBoard: D,
|
|
5239
|
+
onClickCopyClipboard: O,
|
|
5240
|
+
onSmartUploadResult: k,
|
|
5241
|
+
deleteAllRows: S
|
|
4819
5242
|
};
|
|
4820
5243
|
}, onClickDownLoad = (e, t) => {
|
|
4821
5244
|
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");
|
|
@@ -4851,165 +5274,167 @@ var initialState = {
|
|
|
4851
5274
|
helpModal: !1
|
|
4852
5275
|
}
|
|
4853
5276
|
};
|
|
4854
|
-
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
|
|
4855
|
-
let { exportData:
|
|
5277
|
+
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n, __validationScopeId: r }) => {
|
|
5278
|
+
let { exportData: i, beforeExportData: a, prevalidationConfig: o, validationRules: s, title: c, translations: l, textOnly: u = !1, showImportOptions: d = !0, copyFromClipBoard: f = !0, showDeleteOptions: p = !0, showHelpOption: m = !0, modals: _ = [], dynamicOptions: v, onImportComplete: y } = e ?? {}, b = useValidationScopeId();
|
|
5279
|
+
useRegisterValidationRules(r ?? b, s);
|
|
5280
|
+
let [x, S] = useState(initialState), { modalVisibility: { smartUploadModal: C = !1, reviewPasteModal: w = !1, helpModal: T = !1 } } = x, { enabled: E, prompt: D = "", onClose: O, onError: k, service: A = () => Promise.resolve() } = t ?? {}, j = useTranslationMap(l), M = useExportData(j, i, a), [N, P] = useTransition(), { readAndParseInput: F, updateState: I, closeModals: L, setModalVisibility: R, onFileChange: z, onClickQuickPasteFromClipBoard: B, onClickCopyClipboard: V, onSmartUploadResult: H, deleteAllRows: U } = useDataImportActions({
|
|
4856
5281
|
config: e,
|
|
4857
|
-
state:
|
|
4858
|
-
setState:
|
|
5282
|
+
state: x,
|
|
5283
|
+
setState: S,
|
|
4859
5284
|
smartUploadConfig: t,
|
|
4860
|
-
startTransition:
|
|
5285
|
+
startTransition: P
|
|
4861
5286
|
}) ?? {};
|
|
4862
|
-
useKeyboardEvent("Escape", () =>
|
|
4863
|
-
let
|
|
5287
|
+
useKeyboardEvent("Escape", () => L());
|
|
5288
|
+
let W = d ? [
|
|
4864
5289
|
{
|
|
4865
5290
|
type: "Option",
|
|
4866
|
-
label:
|
|
5291
|
+
label: j("uploadFile"),
|
|
4867
5292
|
upload: !0,
|
|
4868
5293
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
4869
|
-
onChange:
|
|
5294
|
+
onChange: z,
|
|
4870
5295
|
testId: `${n}-option-upload-file`
|
|
4871
5296
|
},
|
|
4872
|
-
...
|
|
5297
|
+
...f ? [{
|
|
4873
5298
|
type: "Option",
|
|
4874
|
-
label:
|
|
4875
|
-
onClick:
|
|
5299
|
+
label: j("quickPasteFromClipboard"),
|
|
5300
|
+
onClick: B,
|
|
4876
5301
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
4877
5302
|
}] : [],
|
|
4878
|
-
...
|
|
5303
|
+
...f ? [{
|
|
4879
5304
|
type: "Option",
|
|
4880
|
-
label:
|
|
4881
|
-
onClick: () =>
|
|
5305
|
+
label: j("pasteWithReview"),
|
|
5306
|
+
onClick: () => R("reviewPasteModal", !w),
|
|
4882
5307
|
testId: `${n}-paste-with-review`
|
|
4883
5308
|
}] : [],
|
|
4884
|
-
...
|
|
5309
|
+
...D && E && t ? [{
|
|
4885
5310
|
type: "Option",
|
|
4886
|
-
label:
|
|
4887
|
-
onClick: () =>
|
|
5311
|
+
label: j("smartUpload_smartUpload"),
|
|
5312
|
+
onClick: () => R("smartUploadModal", !C),
|
|
4888
5313
|
testId: `${n}-smart-upload`
|
|
4889
5314
|
}] : [],
|
|
4890
|
-
...applyModalHandlers(
|
|
4891
|
-
] : [],
|
|
5315
|
+
...applyModalHandlers(v?.importOptions ?? [], x, R)
|
|
5316
|
+
] : [], G = [
|
|
4892
5317
|
{
|
|
4893
5318
|
type: "Option",
|
|
4894
|
-
label:
|
|
5319
|
+
label: j("downloadFile"),
|
|
4895
5320
|
onClick: async () => {
|
|
4896
|
-
let e = await
|
|
4897
|
-
e && e && onClickDownLoad(e,
|
|
5321
|
+
let e = await M();
|
|
5322
|
+
e && e && onClickDownLoad(e, c);
|
|
4898
5323
|
}
|
|
4899
5324
|
},
|
|
4900
|
-
...
|
|
5325
|
+
...u ? [{
|
|
4901
5326
|
type: "Option",
|
|
4902
|
-
label:
|
|
4903
|
-
onClick: () =>
|
|
5327
|
+
label: j("copyToClipboard"),
|
|
5328
|
+
onClick: () => V("dot")
|
|
4904
5329
|
}] : [{
|
|
4905
5330
|
type: "Menu",
|
|
4906
5331
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
4907
5332
|
menu: {
|
|
4908
5333
|
trigger: "Text",
|
|
4909
|
-
label:
|
|
5334
|
+
label: j("copyToClipboard"),
|
|
4910
5335
|
sections: [{
|
|
4911
5336
|
type: "Option",
|
|
4912
|
-
label:
|
|
4913
|
-
onClick: () =>
|
|
5337
|
+
label: j("copyDecimalDot"),
|
|
5338
|
+
onClick: () => V("dot"),
|
|
4914
5339
|
testId: `${n}-option-copy-decimal-dot`
|
|
4915
5340
|
}, {
|
|
4916
5341
|
type: "Option",
|
|
4917
|
-
label:
|
|
4918
|
-
onClick: () =>
|
|
5342
|
+
label: j("copyDecimalComma"),
|
|
5343
|
+
onClick: () => V("comma")
|
|
4919
5344
|
}]
|
|
4920
5345
|
}
|
|
4921
5346
|
}],
|
|
4922
|
-
...applyModalHandlers(
|
|
4923
|
-
],
|
|
5347
|
+
...applyModalHandlers(v?.exportOptions ?? [], x, R)
|
|
5348
|
+
], K = p ? [{
|
|
4924
5349
|
type: "Option",
|
|
4925
|
-
label:
|
|
4926
|
-
onClick: () =>
|
|
5350
|
+
label: j("deleteAllRows"),
|
|
5351
|
+
onClick: () => U(),
|
|
4927
5352
|
testId: `${n}-delete-all-rows`
|
|
4928
|
-
}, ...applyModalHandlers(
|
|
5353
|
+
}, ...applyModalHandlers(v?.deleteOptions ?? [], x, R)] : [], q = m ? [
|
|
4929
5354
|
{ type: "Divider" },
|
|
4930
5355
|
{
|
|
4931
5356
|
type: "Option",
|
|
4932
|
-
label:
|
|
4933
|
-
onClick: () =>
|
|
5357
|
+
label: j("help"),
|
|
5358
|
+
onClick: () => R("helpModal", !T)
|
|
4934
5359
|
},
|
|
4935
|
-
...applyModalHandlers(
|
|
4936
|
-
] : [],
|
|
4937
|
-
...
|
|
4938
|
-
section: [...
|
|
5360
|
+
...applyModalHandlers(v?.helpOptions ?? [], x, R)
|
|
5361
|
+
] : [], J = [
|
|
5362
|
+
...W?.length ? [{
|
|
5363
|
+
section: [...W, ...q],
|
|
4939
5364
|
name: "import-options",
|
|
4940
5365
|
iconName: "upload",
|
|
4941
|
-
tooltip:
|
|
5366
|
+
tooltip: j("import")
|
|
4942
5367
|
}] : [],
|
|
4943
|
-
...
|
|
4944
|
-
section:
|
|
5368
|
+
...G?.length ? [{
|
|
5369
|
+
section: G,
|
|
4945
5370
|
name: "export-options",
|
|
4946
5371
|
iconName: "download",
|
|
4947
|
-
tooltip:
|
|
5372
|
+
tooltip: j("export")
|
|
4948
5373
|
}] : [],
|
|
4949
|
-
...
|
|
4950
|
-
section:
|
|
5374
|
+
...K?.length ? [{
|
|
5375
|
+
section: K,
|
|
4951
5376
|
name: "delete-options",
|
|
4952
5377
|
iconName: "delete",
|
|
4953
|
-
tooltip:
|
|
5378
|
+
tooltip: j("deleteAllRows")
|
|
4954
5379
|
}] : []
|
|
4955
5380
|
];
|
|
4956
5381
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
4957
|
-
|
|
5382
|
+
N && /* @__PURE__ */ jsx(Spinner, {
|
|
4958
5383
|
small: !0,
|
|
4959
5384
|
dark: !0
|
|
4960
5385
|
}),
|
|
4961
|
-
|
|
5386
|
+
J.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
4962
5387
|
sections: e.section,
|
|
4963
5388
|
iconName: e.iconName,
|
|
4964
5389
|
tooltip: e.tooltip,
|
|
4965
5390
|
testId: `data-${e?.name}-menu`
|
|
4966
5391
|
}, t)),
|
|
4967
|
-
|
|
5392
|
+
w && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
4968
5393
|
config: e,
|
|
4969
|
-
state:
|
|
4970
|
-
updateState:
|
|
4971
|
-
setModalVisibility:
|
|
4972
|
-
readAndParseInput:
|
|
4973
|
-
onCloseModal:
|
|
4974
|
-
validationRules:
|
|
4975
|
-
onCompleteImport:
|
|
4976
|
-
prevalidationConfig:
|
|
4977
|
-
t:
|
|
4978
|
-
loading:
|
|
4979
|
-
startTransition:
|
|
5394
|
+
state: x,
|
|
5395
|
+
updateState: I,
|
|
5396
|
+
setModalVisibility: R,
|
|
5397
|
+
readAndParseInput: F,
|
|
5398
|
+
onCloseModal: L,
|
|
5399
|
+
validationRules: s,
|
|
5400
|
+
onCompleteImport: y,
|
|
5401
|
+
prevalidationConfig: o,
|
|
5402
|
+
t: j,
|
|
5403
|
+
loading: N,
|
|
5404
|
+
startTransition: P,
|
|
4980
5405
|
testId: n
|
|
4981
5406
|
}),
|
|
4982
|
-
|
|
4983
|
-
visible:
|
|
4984
|
-
setModalVisibility:
|
|
4985
|
-
validationRules:
|
|
4986
|
-
t:
|
|
5407
|
+
T && /* @__PURE__ */ jsx(HelpModal, {
|
|
5408
|
+
visible: T,
|
|
5409
|
+
setModalVisibility: R,
|
|
5410
|
+
validationRules: s,
|
|
5411
|
+
t: j
|
|
4987
5412
|
}),
|
|
4988
|
-
|
|
4989
|
-
visible:
|
|
4990
|
-
prompt:
|
|
4991
|
-
onUpload:
|
|
4992
|
-
onCloseModal: () =>
|
|
4993
|
-
onComplete:
|
|
4994
|
-
onError:
|
|
4995
|
-
heading:
|
|
4996
|
-
dialogText:
|
|
4997
|
-
fileInputText:
|
|
4998
|
-
fileInputPlaceholder:
|
|
4999
|
-
uploadText:
|
|
5000
|
-
cancelText:
|
|
5413
|
+
E && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
5414
|
+
visible: C,
|
|
5415
|
+
prompt: D,
|
|
5416
|
+
onUpload: A,
|
|
5417
|
+
onCloseModal: () => L({ callback: O }),
|
|
5418
|
+
onComplete: H,
|
|
5419
|
+
onError: k,
|
|
5420
|
+
heading: j("smartUpload_smartUpload"),
|
|
5421
|
+
dialogText: j("smartUpload_description"),
|
|
5422
|
+
fileInputText: j("chooseFile"),
|
|
5423
|
+
fileInputPlaceholder: j("noFileSelected"),
|
|
5424
|
+
uploadText: j("uploadCapitalized"),
|
|
5425
|
+
cancelText: j("cancel"),
|
|
5001
5426
|
testId: n
|
|
5002
5427
|
}),
|
|
5003
5428
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5004
|
-
modals:
|
|
5005
|
-
modalVisibility:
|
|
5006
|
-
onCloseModal:
|
|
5429
|
+
modals: _,
|
|
5430
|
+
modalVisibility: x?.modalVisibility,
|
|
5431
|
+
onCloseModal: L,
|
|
5007
5432
|
testId: n
|
|
5008
5433
|
})
|
|
5009
5434
|
] });
|
|
5010
5435
|
}, FileButton = ({ file: e, accept: t, multi: n, name: r, disabled: i, onChange: a = noop,...o }) => {
|
|
5011
|
-
let
|
|
5012
|
-
i ||
|
|
5436
|
+
let s = useContext(DisabledContext), l = useRef(null), u = () => {
|
|
5437
|
+
i || s || l.current?.click();
|
|
5013
5438
|
}, d = (e) => {
|
|
5014
5439
|
let t = n ? e.target.files : e.target.files?.[0], r = {
|
|
5015
5440
|
...e,
|
|
@@ -5288,15 +5713,15 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5288
5713
|
},
|
|
5289
5714
|
children: e.content
|
|
5290
5715
|
}) : null, ListSubheading = forwardRef(({ item: e, index: t }, n) => {
|
|
5291
|
-
let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick:
|
|
5716
|
+
let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick: s, title: l, name: u, icon: d, testId: f } = e;
|
|
5292
5717
|
return /* @__PURE__ */ jsx("div", {
|
|
5293
5718
|
ref: (e) => {
|
|
5294
5719
|
n && "current" in n && Array.isArray(n.current) && t !== void 0 && (n.current[t] = e);
|
|
5295
5720
|
},
|
|
5296
5721
|
"data-testid": f ?? null,
|
|
5297
|
-
className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "",
|
|
5722
|
+
className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "", s ? list_module_default.action : ""),
|
|
5298
5723
|
onClick: (e) => {
|
|
5299
|
-
|
|
5724
|
+
s && s(e);
|
|
5300
5725
|
},
|
|
5301
5726
|
title: l,
|
|
5302
5727
|
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -5321,7 +5746,7 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5321
5746
|
}) })
|
|
5322
5747
|
});
|
|
5323
5748
|
}), ListRow = forwardRef(({ item: e, index: t, expanding: n, invokeEditOnRowClick: r, draggable: i }, a) => {
|
|
5324
|
-
let o = useContext(DisabledContext),
|
|
5749
|
+
let o = useContext(DisabledContext), s = (e, t, s, c, l, u) => {
|
|
5325
5750
|
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";
|
|
5326
5751
|
return /* @__PURE__ */ jsx(m, {
|
|
5327
5752
|
href: t.url,
|
|
@@ -5375,16 +5800,16 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5375
5800
|
item: e,
|
|
5376
5801
|
index: t
|
|
5377
5802
|
}, t) : i ? ((e, t) => {
|
|
5378
|
-
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging:
|
|
5803
|
+
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging: c } = useSortable({
|
|
5379
5804
|
id: e.toString(),
|
|
5380
5805
|
animateLayoutChanges: () => !1
|
|
5381
5806
|
}), l = {
|
|
5382
5807
|
transform: CSS.Translate.toString(a),
|
|
5383
5808
|
transition: o,
|
|
5384
|
-
opacity:
|
|
5809
|
+
opacity: c ? 0 : 1
|
|
5385
5810
|
};
|
|
5386
|
-
return
|
|
5387
|
-
})(t, e) :
|
|
5811
|
+
return s(e, t, l, n, r, i);
|
|
5812
|
+
})(t, e) : s(t, e);
|
|
5388
5813
|
}), ListDragWrapper = ({ children: e, draggable: t, list: n, onListReorder: r }) => {
|
|
5389
5814
|
let [i, a] = useState(null), o = (e) => {
|
|
5390
5815
|
a(e.active.id);
|
|
@@ -5417,9 +5842,9 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5417
5842
|
}), document.body)]
|
|
5418
5843
|
}) : e;
|
|
5419
5844
|
}, ListVirtualScrollWrapper = ({ items: e, scrollDetails: t, children: n }) => {
|
|
5420
|
-
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll:
|
|
5845
|
+
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll: o } = t, c = useRef(null), u = useVirtualizer({
|
|
5421
5846
|
count: e.length,
|
|
5422
|
-
getScrollElement: () =>
|
|
5847
|
+
getScrollElement: () => c.current,
|
|
5423
5848
|
estimateSize: useCallback(() => {
|
|
5424
5849
|
let t = 37;
|
|
5425
5850
|
if (e.length > 0) {
|
|
@@ -5441,8 +5866,8 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5441
5866
|
f(t);
|
|
5442
5867
|
}
|
|
5443
5868
|
}, [a]), /* @__PURE__ */ jsx("div", {
|
|
5444
|
-
className: cx(list_module_default.listContent, r ||
|
|
5445
|
-
ref:
|
|
5869
|
+
className: cx(list_module_default.listContent, r || o ? list_module_default.scrollableList : "", i ? list_module_default.hideScrollbar : ""),
|
|
5870
|
+
ref: c,
|
|
5446
5871
|
children: /* @__PURE__ */ jsx("div", {
|
|
5447
5872
|
className: list_module_default.virtualRows,
|
|
5448
5873
|
style: { height: `${u.getTotalSize()}px` },
|
|
@@ -5686,9 +6111,9 @@ var radio_button_module_default = {
|
|
|
5686
6111
|
isInTable: "_isInTable_1fbik_106",
|
|
5687
6112
|
helpIconEnabled: "_helpIconEnabled_1fbik_111"
|
|
5688
6113
|
};
|
|
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
|
|
5690
|
-
let
|
|
5691
|
-
return
|
|
6114
|
+
const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1, small: a = !1, onChange: o, noMargin: s = !1, testId: c, helpText: l, onClickHelp: u }) => {
|
|
6115
|
+
let d = l || u;
|
|
6116
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
5692
6117
|
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),
|
|
5693
6118
|
onClick: o,
|
|
5694
6119
|
"data-testid": c,
|
|
@@ -5703,22 +6128,21 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
5703
6128
|
/* @__PURE__ */ jsx("label", {
|
|
5704
6129
|
"data-name": e,
|
|
5705
6130
|
"data-value": n,
|
|
5706
|
-
style: { textTransform: d },
|
|
5707
6131
|
children: t
|
|
5708
6132
|
}),
|
|
5709
|
-
|
|
6133
|
+
d && /* @__PURE__ */ jsx("div", {
|
|
5710
6134
|
className: radio_button_module_default.helpIconEnabled,
|
|
5711
6135
|
onClick: u,
|
|
5712
6136
|
children: /* @__PURE__ */ jsx(HelpIcon, { text: l })
|
|
5713
6137
|
})
|
|
5714
6138
|
]
|
|
5715
6139
|
});
|
|
5716
|
-
}, RadioButton = ({ name: e, label: t, options: n, value: r, onChange: i, disabled: a = !1, small: o = !1, noMargin:
|
|
5717
|
-
let m = useContext(DisabledContext), h = f !== void 0, { simpleInputs:
|
|
6140
|
+
}, RadioButton = ({ name: e, label: t, options: n, value: r, onChange: i, disabled: a = !1, small: o = !1, noMargin: s = !1, onClick: l = () => {}, inline: u = !1, mainLabel: d = "", radioButtonsData: f, classForContainer: p = "grouped fields" }) => {
|
|
6141
|
+
let m = useContext(DisabledContext), h = f !== void 0, { simpleInputs: g, options: v, selectedOptions: y } = h ? {
|
|
5718
6142
|
simpleInputs: !1,
|
|
5719
6143
|
options: f,
|
|
5720
6144
|
selectedOptions: void 0
|
|
5721
|
-
} : standardizeInputs(n, r), b = h || y == null ? void 0 :
|
|
6145
|
+
} : standardizeInputs(n, r), b = h || y == null ? void 0 : g ? y : y.value, x = h ? d : t;
|
|
5722
6146
|
return /* @__PURE__ */ jsxs("div", {
|
|
5723
6147
|
className: cx(radio_button_module_default.wrapper, u ? radio_button_module_default.inline : null, p === "inline fields" ? radio_button_module_default.inline : null),
|
|
5724
6148
|
children: [d && /* @__PURE__ */ jsx("label", {
|
|
@@ -5733,14 +6157,13 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
5733
6157
|
selected: r,
|
|
5734
6158
|
disabled: a || t.disabled || m,
|
|
5735
6159
|
small: o,
|
|
5736
|
-
noMargin:
|
|
6160
|
+
noMargin: s,
|
|
5737
6161
|
onChange: t.disabled ? void 0 : (n) => {
|
|
5738
6162
|
h ? l(n.target) : (n.target.name = e, n.target.value = t.value.toString(), n.target.label = t.label.toString(), i && i(n));
|
|
5739
6163
|
},
|
|
5740
6164
|
testId: t.testId,
|
|
5741
6165
|
helpText: t.helpText,
|
|
5742
|
-
onClickHelp: t.onClickHelp
|
|
5743
|
-
textTransform: t.textTransform
|
|
6166
|
+
onClickHelp: t.onClickHelp
|
|
5744
6167
|
}, n);
|
|
5745
6168
|
})]
|
|
5746
6169
|
});
|
|
@@ -5810,7 +6233,7 @@ var rich_text_input_module_default = {
|
|
|
5810
6233
|
richTextInput: "_richTextInput_1fb4l_77"
|
|
5811
6234
|
};
|
|
5812
6235
|
const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
|
|
5813
|
-
let o = useContext(DisabledContext),
|
|
6236
|
+
let o = useContext(DisabledContext), s = r || o, { manager: l, state: d, setState: f, getContext: p } = useRemirror({
|
|
5814
6237
|
extensions: () => [
|
|
5815
6238
|
new BoldExtension({}),
|
|
5816
6239
|
new BulletListExtension({}),
|
|
@@ -5827,31 +6250,31 @@ const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disab
|
|
|
5827
6250
|
return useImperativeHandle(a, () => p(), [p]), /* @__PURE__ */ jsx("div", {
|
|
5828
6251
|
className: rich_text_input_module_default.richTextInput,
|
|
5829
6252
|
children: /* @__PURE__ */ jsxs(Remirror, {
|
|
5830
|
-
manager:
|
|
6253
|
+
manager: l,
|
|
5831
6254
|
state: d,
|
|
5832
6255
|
placeholder: e,
|
|
5833
6256
|
onChange: ({ helpers: e, state: n }) => {
|
|
5834
6257
|
let r = e.getMarkdown(n);
|
|
5835
6258
|
t && t(r), f(n);
|
|
5836
6259
|
},
|
|
5837
|
-
editable: !
|
|
6260
|
+
editable: !s,
|
|
5838
6261
|
children: [/* @__PURE__ */ jsx(RichTextToolbar, {
|
|
5839
|
-
disabled:
|
|
6262
|
+
disabled: s,
|
|
5840
6263
|
toolbarComponent: i
|
|
5841
6264
|
}), /* @__PURE__ */ jsx(EditorComponent, {})]
|
|
5842
6265
|
})
|
|
5843
6266
|
});
|
|
5844
6267
|
});
|
|
5845
6268
|
var row_module_default = { row: "_row_n16je_1" };
|
|
5846
|
-
const Row = ({ alignItems: t = "initial", justifyContent: n = "initial", children: r = null, flex:
|
|
6269
|
+
const Row = ({ alignItems: t = "initial", justifyContent: n = "initial", children: r = null, flex: i = !1, height: o = "auto", marginBottom: s = "0", marginTop: c = "0", spacing: l = "var(--padding)", wrap: u = !1, testId: d = null }) => {
|
|
5847
6270
|
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));
|
|
5848
6271
|
return /* @__PURE__ */ jsx("div", {
|
|
5849
6272
|
className: cx(row_module_default.row),
|
|
5850
6273
|
style: {
|
|
5851
6274
|
alignItems: t,
|
|
5852
6275
|
justifyContent: n,
|
|
5853
|
-
flexGrow:
|
|
5854
|
-
flexShrink:
|
|
6276
|
+
flexGrow: i ? 1 : 0,
|
|
6277
|
+
flexShrink: i ? 1 : 0,
|
|
5855
6278
|
flexWrap: u ? "wrap" : "nowrap",
|
|
5856
6279
|
height: o,
|
|
5857
6280
|
marginLeft: `calc(${f} * -0.5)`,
|
|
@@ -6001,7 +6424,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6001
6424
|
}, Content$1 = ({ children: e, activeTabIndex: t, contentPadding: n }) => Array.isArray(e) ? /* @__PURE__ */ jsx("div", {
|
|
6002
6425
|
className: cx(n ? tabs_module_default.contentPadding : ""),
|
|
6003
6426
|
children: e.map((e, n) => t === n && e)
|
|
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:
|
|
6427
|
+
}) : null, Tabs = ({ name: e = void 0, options: t = null, children: n = null, value: r = void 0, onChange: i = noop, padding: a = !1, margin: o = !0, contentPadding: s = !0, onChangeTab: l, activeTabIndex: u = void 0, tabs: d = void 0, testId: f }) => {
|
|
6005
6428
|
let p = useContext(DisabledContext), m = l !== void 0, h = n ? n.map((e, t) => ({
|
|
6006
6429
|
value: t,
|
|
6007
6430
|
url: e.props.url,
|
|
@@ -6010,11 +6433,11 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6010
6433
|
disabled: e.props.disabled || p,
|
|
6011
6434
|
badge: e.props.badge,
|
|
6012
6435
|
testId: e.props?.testId && `${e.props.testId}-${t}`
|
|
6013
|
-
})) : t || d, { simpleInputs:
|
|
6436
|
+
})) : t || d, { simpleInputs: g, options: v, selectedOptions: y } = m ? {
|
|
6014
6437
|
simpleInputs: !1,
|
|
6015
6438
|
options: h,
|
|
6016
6439
|
selectedOptions: void 0
|
|
6017
|
-
} : standardizeInputs(h, r), b = m || y == null ? void 0 :
|
|
6440
|
+
} : standardizeInputs(h, r), b = m || y == null ? void 0 : g ? y : y.value, x = u === void 0 ? v?.findIndex((e) => e.value === b) : u, S = x === -1 ? 0 : x, C = (t, n, r) => {
|
|
6018
6441
|
if (m) {
|
|
6019
6442
|
let e = n.key || n.label || null;
|
|
6020
6443
|
l(t, e);
|
|
@@ -6043,7 +6466,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6043
6466
|
children: v.map(w)
|
|
6044
6467
|
}), /* @__PURE__ */ jsx(Content$1, {
|
|
6045
6468
|
activeTabIndex: S ?? 0,
|
|
6046
|
-
contentPadding:
|
|
6469
|
+
contentPadding: s,
|
|
6047
6470
|
children: n
|
|
6048
6471
|
})] }) : null;
|
|
6049
6472
|
}, TextLink = ({ children: e, href: t = void 0, target: n = void 0, testId: r, onClick: i, component: a = "a" }) => /* @__PURE__ */ jsx(a, {
|
|
@@ -6069,7 +6492,7 @@ var textarea_module_default = {
|
|
|
6069
6492
|
small: "_small_q0tl0_116",
|
|
6070
6493
|
monospace: "_monospace_q0tl0_155"
|
|
6071
6494
|
};
|
|
6072
|
-
const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows: i, disabled: a = !1, onChange: o = noop, onKeyPress:
|
|
6495
|
+
const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows: i, disabled: a = !1, onChange: o = noop, onKeyPress: s = noop, onFocus: l = noop, onBlur: u = noop, tabIndex: d = 0, error: f = null, warning: p = null, tooltip: m = null, maxTooltipWidth: h, resize: g, monospace: v = !1, testId: y }) => {
|
|
6073
6496
|
let b = useContext(DisabledContext), x = /* @__PURE__ */ jsx("textarea", {
|
|
6074
6497
|
className: cx(textarea_module_default.textarea, f ? textarea_module_default.error : "", p ? textarea_module_default.warning : "", v ? textarea_module_default.monospace : ""),
|
|
6075
6498
|
name: e,
|
|
@@ -6079,11 +6502,11 @@ const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows:
|
|
|
6079
6502
|
rows: i,
|
|
6080
6503
|
onChange: o,
|
|
6081
6504
|
disabled: a || b,
|
|
6082
|
-
onKeyPress:
|
|
6505
|
+
onKeyPress: s,
|
|
6083
6506
|
onFocus: l,
|
|
6084
6507
|
onBlur: u,
|
|
6085
6508
|
tabIndex: d,
|
|
6086
|
-
style: { resize:
|
|
6509
|
+
style: { resize: g },
|
|
6087
6510
|
"data-error": f || null,
|
|
6088
6511
|
"data-warning": p || null,
|
|
6089
6512
|
"data-testid": y
|
|
@@ -6163,9 +6586,9 @@ const Warning = ({ warning: e }) => /* @__PURE__ */ jsx("div", {
|
|
|
6163
6586
|
let ElementType = /* @__PURE__ */ function(e) {
|
|
6164
6587
|
return e.LINK = "Link", e.BUTTON = "Button", e.MENU = "Menu", e.COMPONENT = "Component", e;
|
|
6165
6588
|
}({});
|
|
6166
|
-
const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, testId: o, component:
|
|
6589
|
+
const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, testId: o, component: s = "a" }) => {
|
|
6167
6590
|
let l = useContext(DisabledContext);
|
|
6168
|
-
return /* @__PURE__ */ jsxs(
|
|
6591
|
+
return /* @__PURE__ */ jsxs(s, {
|
|
6169
6592
|
className: cx(top_bar_module_default.link, i ? top_bar_module_default.active : ""),
|
|
6170
6593
|
href: t || "#",
|
|
6171
6594
|
to: t,
|
|
@@ -6310,16 +6733,16 @@ var tree_module_default = {
|
|
|
6310
6733
|
placeholder: "_placeholder_15yn1_29"
|
|
6311
6734
|
};
|
|
6312
6735
|
const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, draggable: o, icons: s, onDrop: c }) => {
|
|
6313
|
-
let { id: l, data: u } = t, { active: d, testId: f, onClick: p, actions: m = [] } = u, [h,
|
|
6736
|
+
let { id: l, data: u } = t, { active: d, testId: f, onClick: p, actions: m = [] } = u, [h, g] = React.useState(!1), [v, y] = React.useState(0), b = (e) => {
|
|
6314
6737
|
e.stopPropagation(), i(l);
|
|
6315
6738
|
}, x = (e) => {
|
|
6316
|
-
e.preventDefault(), e.stopPropagation(), h || (
|
|
6739
|
+
e.preventDefault(), e.stopPropagation(), h || (g(!0), y((/* @__PURE__ */ new Date()).getTime()));
|
|
6317
6740
|
}, S = (e) => {
|
|
6318
|
-
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 &&
|
|
6741
|
+
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 && g(!1);
|
|
6319
6742
|
}, C = (e) => {
|
|
6320
6743
|
e.preventDefault(), e.stopPropagation(), a && !r && (/* @__PURE__ */ new Date()).getTime() - v > 200 && b(e);
|
|
6321
6744
|
}, w = (e) => {
|
|
6322
|
-
e.preventDefault(), e.stopPropagation(),
|
|
6745
|
+
e.preventDefault(), e.stopPropagation(), g(!1), y((/* @__PURE__ */ new Date()).getTime()), c?.(e);
|
|
6323
6746
|
};
|
|
6324
6747
|
return /* @__PURE__ */ jsx("div", {
|
|
6325
6748
|
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 : ""),
|
|
@@ -6547,18 +6970,18 @@ var unit_input_module_default = {
|
|
|
6547
6970
|
predefinedMenuActive: "_predefinedMenuActive_ye9w9_1",
|
|
6548
6971
|
inputWrapper: "_inputWrapper_ye9w9_4"
|
|
6549
6972
|
};
|
|
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:
|
|
6973
|
+
const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUnit: r = !1, error: i = null, left: a = !1, small: o = !1, width: s = "100%", value: c, unitkey: u = "", initUnit: d, noConversion: p = !1, onChange: m = noop, onClick: g = 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 = () => ({
|
|
6551
6974
|
name: "",
|
|
6552
6975
|
error: null
|
|
6553
6976
|
}), disabledValidation: O = !1, allowEmpty: k = !1, convertBackToStorageUnit: A = !1, enableCosmeticRounding: j = !0, enableDisplayRounding: M = !1, roundDisplayValue: N, selectOnFocus: P, groupOrder: F, tooltip: I = null }) => {
|
|
6554
6977
|
let L = useUnitContext(), R = useRunAfterUpdate();
|
|
6555
|
-
typeof
|
|
6556
|
-
let [z = "", B = ""] =
|
|
6978
|
+
typeof c == "number" && (c = `${c}`);
|
|
6979
|
+
let [z = "", B = ""] = c === void 0 ? [] : split(c), V = useMemo(() => getPreferredUnit(u, b || L?.unitTemplate), [
|
|
6557
6980
|
u,
|
|
6558
6981
|
b,
|
|
6559
6982
|
L?.unitTemplate
|
|
6560
|
-
]), H = isKnownUnit(
|
|
6561
|
-
value:
|
|
6983
|
+
]), H = isKnownUnit(c, V), U = d || V || B, W = usePrevious(U), { value: G } = safeConvertValue({
|
|
6984
|
+
value: c,
|
|
6562
6985
|
toUnit: U,
|
|
6563
6986
|
unitkey: u,
|
|
6564
6987
|
defaultFromUnit: B,
|
|
@@ -6569,17 +6992,17 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6569
6992
|
} : {
|
|
6570
6993
|
value: G,
|
|
6571
6994
|
unit: U
|
|
6572
|
-
}),
|
|
6995
|
+
}), J = k || K?.value === void 0, [Y, X] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Xu = !!(O || n), Zu = C && C.find((e) => {
|
|
6573
6996
|
if (!e?.value) return;
|
|
6574
6997
|
if (E) return E === e.valueKey;
|
|
6575
|
-
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n =
|
|
6576
|
-
value: String(
|
|
6998
|
+
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = c } = convertUnit({
|
|
6999
|
+
value: String(c),
|
|
6577
7000
|
unitkey: u,
|
|
6578
7001
|
toUnit: t
|
|
6579
7002
|
});
|
|
6580
7003
|
return withUnit(n, t) === e.value;
|
|
6581
|
-
}),
|
|
6582
|
-
let e =
|
|
7004
|
+
}), Qu = () => {
|
|
7005
|
+
let e = c ?? "", t = K.unit;
|
|
6583
7006
|
if (checkConversion({
|
|
6584
7007
|
value: e,
|
|
6585
7008
|
unitkey: u,
|
|
@@ -6592,9 +7015,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6592
7015
|
return null;
|
|
6593
7016
|
}
|
|
6594
7017
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
6595
|
-
},
|
|
7018
|
+
}, $u = (t) => {
|
|
6596
7019
|
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;
|
|
6597
|
-
|
|
7020
|
+
m({ target: {
|
|
6598
7021
|
value: s,
|
|
6599
7022
|
name: n
|
|
6600
7023
|
} });
|
|
@@ -6605,7 +7028,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6605
7028
|
}), R(() => {
|
|
6606
7029
|
r.selectionStart = a, r.selectionEnd = a;
|
|
6607
7030
|
});
|
|
6608
|
-
},
|
|
7031
|
+
}, ed = (e, t) => {
|
|
6609
7032
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
6610
7033
|
value: e,
|
|
6611
7034
|
unit: t
|
|
@@ -6616,16 +7039,16 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6616
7039
|
let e, t = "";
|
|
6617
7040
|
if (W !== U) {
|
|
6618
7041
|
let { value: n } = safeConvertValue({
|
|
6619
|
-
value:
|
|
7042
|
+
value: c,
|
|
6620
7043
|
toUnit: U,
|
|
6621
7044
|
unitkey: u,
|
|
6622
7045
|
defaultFromUnit: B,
|
|
6623
7046
|
doNotConvertValue: p
|
|
6624
7047
|
});
|
|
6625
7048
|
e = n, t = U;
|
|
6626
|
-
} else if (withUnit(K.value, K.unit) !==
|
|
7049
|
+
} else if (withUnit(K.value, K.unit) !== c) {
|
|
6627
7050
|
let { value: n } = safeConvertValue({
|
|
6628
|
-
value:
|
|
7051
|
+
value: c,
|
|
6629
7052
|
toUnit: K.unit,
|
|
6630
7053
|
unitkey: u,
|
|
6631
7054
|
defaultFromUnit: B,
|
|
@@ -6636,15 +7059,15 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6636
7059
|
e !== void 0 && q({
|
|
6637
7060
|
value: e,
|
|
6638
7061
|
unit: t
|
|
6639
|
-
}), C &&
|
|
7062
|
+
}), C && X(Zu && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
6640
7063
|
}
|
|
6641
7064
|
}, [
|
|
6642
7065
|
U,
|
|
6643
|
-
|
|
7066
|
+
c,
|
|
6644
7067
|
i,
|
|
6645
7068
|
T
|
|
6646
7069
|
]);
|
|
6647
|
-
let
|
|
7070
|
+
let Z = Qu(), Q = label(K.unit) || K.unit || "", td = p || !Z || Z && Z.length === 1, nd = getStringName(e), $, rd = (t) => {
|
|
6648
7071
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
6649
7072
|
if (checkConversion({
|
|
6650
7073
|
value: r,
|
|
@@ -6664,7 +7087,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6664
7087
|
type: MenuType.OPTION,
|
|
6665
7088
|
inline: !0,
|
|
6666
7089
|
onClick: () => {
|
|
6667
|
-
validateNumber(i).valid && !n && (
|
|
7090
|
+
validateNumber(i).valid && !n && (X(PredefinedOptionsMenuState.PREDEFINED), m({ target: {
|
|
6668
7091
|
value: r,
|
|
6669
7092
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
6670
7093
|
predefinedSelected: !0,
|
|
@@ -6676,25 +7099,25 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6676
7099
|
height: "0"
|
|
6677
7100
|
})] }),
|
|
6678
7101
|
description: o,
|
|
6679
|
-
selected:
|
|
7102
|
+
selected: Zu === t && Y === PredefinedOptionsMenuState.PREDEFINED
|
|
6680
7103
|
};
|
|
6681
7104
|
};
|
|
6682
7105
|
if ($ = [{
|
|
6683
7106
|
type: MenuType.OPTION,
|
|
6684
7107
|
inline: !0,
|
|
6685
7108
|
onClick: () => {
|
|
6686
|
-
|
|
7109
|
+
Y !== PredefinedOptionsMenuState.CUSTOM && !n && m({ target: {
|
|
6687
7110
|
value: withUnit(K.value, K.unit),
|
|
6688
7111
|
name: typeof e == "string" ? e : e?.fieldName || ""
|
|
6689
7112
|
} });
|
|
6690
7113
|
},
|
|
6691
7114
|
label: "Custom",
|
|
6692
|
-
selected:
|
|
7115
|
+
selected: Y === PredefinedOptionsMenuState.CUSTOM
|
|
6693
7116
|
}], C?.length) {
|
|
6694
|
-
let e = C.map(
|
|
7117
|
+
let e = C.map(rd);
|
|
6695
7118
|
$ = [...$, ...e];
|
|
6696
7119
|
}
|
|
6697
|
-
let
|
|
7120
|
+
let id = (e) => {
|
|
6698
7121
|
if (isValueWithUnit(e)) {
|
|
6699
7122
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
6700
7123
|
value: e,
|
|
@@ -6706,9 +7129,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6706
7129
|
return n;
|
|
6707
7130
|
}
|
|
6708
7131
|
return e;
|
|
6709
|
-
},
|
|
7132
|
+
}, ad = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, od = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
6710
7133
|
return /* @__PURE__ */ jsx("div", {
|
|
6711
|
-
className:
|
|
7134
|
+
className: Y === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
6712
7135
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
6713
7136
|
small: o,
|
|
6714
7137
|
width: s,
|
|
@@ -6723,65 +7146,65 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6723
7146
|
trigger: "Component",
|
|
6724
7147
|
component: /* @__PURE__ */ jsx(Button, {
|
|
6725
7148
|
groupOrder: "first",
|
|
6726
|
-
active:
|
|
6727
|
-
icon:
|
|
7149
|
+
active: Y === PredefinedOptionsMenuState.PREDEFINED,
|
|
7150
|
+
icon: Y === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
|
|
6728
7151
|
small: o
|
|
6729
7152
|
}),
|
|
6730
7153
|
small: o,
|
|
6731
7154
|
sections: $
|
|
6732
7155
|
},
|
|
6733
|
-
tooltip:
|
|
7156
|
+
tooltip: Y === PredefinedOptionsMenuState.PREDEFINED ? Zu?.label : ""
|
|
6734
7157
|
}),
|
|
6735
7158
|
/* @__PURE__ */ jsx("div", {
|
|
6736
7159
|
className: unit_input_module_default.inputWrapper,
|
|
6737
7160
|
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
6738
|
-
name:
|
|
7161
|
+
name: nd,
|
|
6739
7162
|
testId: x,
|
|
6740
7163
|
disabled: n,
|
|
6741
|
-
placeholder:
|
|
7164
|
+
placeholder: id(t),
|
|
6742
7165
|
value: K.value,
|
|
6743
|
-
onChange:
|
|
7166
|
+
onChange: $u,
|
|
6744
7167
|
onFocus: v,
|
|
6745
7168
|
error: i === null ? void 0 : i,
|
|
6746
7169
|
warning: S === null ? void 0 : S,
|
|
6747
7170
|
left: a,
|
|
6748
|
-
allowEmpty:
|
|
6749
|
-
validationCallback: (e, t) => D(
|
|
7171
|
+
allowEmpty: J,
|
|
7172
|
+
validationCallback: (e, t) => D(nd, t),
|
|
6750
7173
|
enableCosmeticRounding: j,
|
|
6751
7174
|
enableDisplayRounding: M,
|
|
6752
7175
|
roundDisplayValue: N,
|
|
6753
|
-
groupOrder:
|
|
6754
|
-
disableInternalErrorValidationMessages:
|
|
7176
|
+
groupOrder: ad,
|
|
7177
|
+
disableInternalErrorValidationMessages: Xu,
|
|
6755
7178
|
small: o,
|
|
6756
7179
|
selectOnFocus: P,
|
|
6757
7180
|
tooltip: I
|
|
6758
|
-
},
|
|
7181
|
+
}, nd)
|
|
6759
7182
|
}),
|
|
6760
|
-
|
|
6761
|
-
groupOrder:
|
|
7183
|
+
Q && (td || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
7184
|
+
groupOrder: od,
|
|
6762
7185
|
small: o,
|
|
6763
|
-
children:
|
|
7186
|
+
children: Q
|
|
6764
7187
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6765
|
-
groupOrder:
|
|
7188
|
+
groupOrder: od,
|
|
6766
7189
|
maxHeight: 380,
|
|
6767
7190
|
disabled: r,
|
|
6768
7191
|
testId: x && `${x}-menu`,
|
|
6769
7192
|
tabIndex: -1,
|
|
6770
7193
|
menu: {
|
|
6771
|
-
label:
|
|
7194
|
+
label: Q,
|
|
6772
7195
|
trigger: "DropDownButton",
|
|
6773
7196
|
small: o,
|
|
6774
|
-
sections:
|
|
7197
|
+
sections: Z.map(([e = "", t = "", n]) => {
|
|
6775
7198
|
let r = n || t || "", i = isValidNum(e) ? e : "";
|
|
6776
7199
|
return {
|
|
6777
7200
|
type: "Option",
|
|
6778
7201
|
label: j ? safeRoundNumbers(i) : i,
|
|
6779
7202
|
inline: !0,
|
|
6780
7203
|
onClick: (n) => {
|
|
6781
|
-
n.stopPropagation(),
|
|
7204
|
+
n.stopPropagation(), ed(e, t);
|
|
6782
7205
|
},
|
|
6783
7206
|
description: r,
|
|
6784
|
-
selected: r ===
|
|
7207
|
+
selected: r === Q,
|
|
6785
7208
|
testId: `${x}-unit-${r}`
|
|
6786
7209
|
};
|
|
6787
7210
|
})
|
|
@@ -6894,60 +7317,61 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
|
|
|
6894
7317
|
})
|
|
6895
7318
|
})) : [];
|
|
6896
7319
|
};
|
|
6897
|
-
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder:
|
|
6898
|
-
let { headers:
|
|
6899
|
-
|
|
6900
|
-
...
|
|
7320
|
+
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder: o, beforeRenderRow: c, enableMultiSelect: u = !1 }) => {
|
|
7321
|
+
let { headers: d,...f } = e, { storageUnits: p, preferredUnits: m } = normalizeUnits(t), g = usePrevious(m), [_, v] = useState(m), y = ({ unitKey: e, value: n }) => {
|
|
7322
|
+
v({
|
|
7323
|
+
..._,
|
|
6901
7324
|
[e]: n
|
|
6902
7325
|
});
|
|
6903
7326
|
let r = t.find((t) => t.unitKey === e);
|
|
6904
7327
|
r && typeof r.onChange == "function" && r.onChange({
|
|
6905
|
-
oldUnit:
|
|
7328
|
+
oldUnit: _[e],
|
|
6906
7329
|
newUnit: n,
|
|
6907
7330
|
unitKey: e
|
|
6908
7331
|
});
|
|
6909
|
-
},
|
|
6910
|
-
let a =
|
|
7332
|
+
}, b = useCallback(({ row: e, rowIndex: t }) => {
|
|
7333
|
+
let a = c ? c({
|
|
6911
7334
|
row: e,
|
|
6912
7335
|
rowIndex: t
|
|
6913
7336
|
}) : e;
|
|
6914
7337
|
return convertRow({
|
|
6915
7338
|
row: a,
|
|
6916
7339
|
rowIndex: t,
|
|
6917
|
-
selectedUnits:
|
|
6918
|
-
storageUnits:
|
|
7340
|
+
selectedUnits: _,
|
|
7341
|
+
storageUnits: p,
|
|
6919
7342
|
convertBackToStorageUnit: n,
|
|
6920
7343
|
enableCosmeticRounding: r,
|
|
6921
7344
|
enableDisplayRounding: i
|
|
6922
7345
|
});
|
|
6923
7346
|
}, [
|
|
6924
|
-
|
|
6925
|
-
|
|
7347
|
+
_,
|
|
7348
|
+
p,
|
|
6926
7349
|
n,
|
|
6927
7350
|
r,
|
|
6928
7351
|
i
|
|
6929
7352
|
]);
|
|
6930
7353
|
return useEffect(() => {
|
|
6931
|
-
isEqual(
|
|
6932
|
-
let t =
|
|
6933
|
-
t !== n &&
|
|
7354
|
+
isEqual(m, g) || Object.keys(m).forEach((e) => {
|
|
7355
|
+
let t = g?.[e], n = m[e];
|
|
7356
|
+
t !== n && y({
|
|
6934
7357
|
unitKey: e,
|
|
6935
7358
|
value: n
|
|
6936
7359
|
});
|
|
6937
7360
|
});
|
|
6938
7361
|
}, [t]), /* @__PURE__ */ jsx(Table, {
|
|
6939
7362
|
table: {
|
|
6940
|
-
...
|
|
7363
|
+
...f,
|
|
6941
7364
|
headers: convertHeaderRows({
|
|
6942
7365
|
headers: e.headers,
|
|
6943
|
-
selectedUnits:
|
|
6944
|
-
storageUnits:
|
|
6945
|
-
onChangeUnit:
|
|
7366
|
+
selectedUnits: _,
|
|
7367
|
+
storageUnits: p,
|
|
7368
|
+
onChangeUnit: y
|
|
6946
7369
|
})
|
|
6947
7370
|
},
|
|
6948
7371
|
onListReorder: a,
|
|
6949
|
-
canListReorder:
|
|
6950
|
-
beforeRenderRow:
|
|
7372
|
+
canListReorder: o,
|
|
7373
|
+
beforeRenderRow: b,
|
|
7374
|
+
enableMultiSelect: u
|
|
6951
7375
|
});
|
|
6952
7376
|
};
|
|
6953
7377
|
var setting_field_module_default = { settingField: "_settingField_1x02n_1" };
|
|
@@ -7020,7 +7444,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7020
7444
|
}, [n]);
|
|
7021
7445
|
let s = ({ target: { value: e } }) => {
|
|
7022
7446
|
a(e);
|
|
7023
|
-
}, { added:
|
|
7447
|
+
}, { added: c, removed: u } = renderLinesCount(e, t), d = c + u > 3500;
|
|
7024
7448
|
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Card, {
|
|
7025
7449
|
bordered: !0,
|
|
7026
7450
|
heading: /* @__PURE__ */ jsxs(Flex, {
|
|
@@ -7029,7 +7453,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7029
7453
|
success: !0,
|
|
7030
7454
|
children: [
|
|
7031
7455
|
"+",
|
|
7032
|
-
|
|
7456
|
+
c,
|
|
7033
7457
|
" "
|
|
7034
7458
|
]
|
|
7035
7459
|
}), /* @__PURE__ */ jsxs(Text, {
|