@oliasoft-open-source/react-ui-library 5.6.5-beta-3 → 5.6.5-beta-5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/global.css +1 -1
- package/dist/index.d.ts +53 -16
- package/dist/index.js +1315 -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,729 @@ 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
|
+
let t = e.target, n = Number(t.closest("td")?.dataset.rowIndex), r = Number(t.closest("td")?.dataset.columnIndex);
|
|
3640
|
+
b(n, r), o || s({
|
|
3641
|
+
row: n,
|
|
3642
|
+
column: r
|
|
3643
|
+
}), u(!0);
|
|
3644
|
+
}, S = (e) => {
|
|
3645
|
+
s(void 0), u(!1);
|
|
3646
|
+
}, C = (e) => {
|
|
3647
|
+
if (e.preventDefault(), !c) return;
|
|
3648
|
+
let t = e.target, n = Number(t.closest("td")?.dataset.rowIndex), r = Number(t.closest("td")?.dataset.columnIndex);
|
|
3649
|
+
b(n, r);
|
|
3650
|
+
}, w = () => {
|
|
3651
|
+
if (T(), !i || !t.current) return;
|
|
3652
|
+
let { row: e, column: n } = i, r = t.current?.querySelector(`td[data-row-index="${e.start}"][data-column-index="${n.start}"]`), a = e.end === e.start && n.end === n.start ? r : t.current?.querySelector(`td[data-row-index="${e.end}"][data-column-index="${n.end}"]`);
|
|
3653
|
+
if (!r || !a) return;
|
|
3654
|
+
let o = f(), s = o.getBoundingClientRect(), c = r?.getBoundingClientRect(), l = a?.getBoundingClientRect(), u = Math.round(c?.left - s.left + o.scrollLeft), d = Math.round(c?.top - s.top + o.scrollTop), p = Math.round(l?.right - s.left + o.scrollLeft), m = Math.round(l?.bottom - s.top + o.scrollTop), h = document.createElement("div");
|
|
3655
|
+
h.className = "selection-frame", h.style.position = "absolute", h.style.pointerEvents = "none", h.style.zIndex = "4", h.style.left = `${u}px`, h.style.top = `${d}px`, h.style.width = `${p - u}px`, h.style.height = `${m - d}px`, h.style.border = "1px solid var(--color-border-focus)", h.style.borderRadius = "0", o.appendChild(h);
|
|
3656
|
+
}, T = () => {
|
|
3657
|
+
f().querySelectorAll(".selection-frame,.drag-handle").forEach((e) => e.remove());
|
|
3658
|
+
};
|
|
3659
|
+
return {
|
|
3660
|
+
selectedIndexes: i,
|
|
3661
|
+
setSelectedIndexes: a,
|
|
3662
|
+
onCopy: g,
|
|
3663
|
+
onPaste: _,
|
|
3664
|
+
onKeyDown: v,
|
|
3665
|
+
onKeyUp: y,
|
|
3666
|
+
onMouseDown: x,
|
|
3667
|
+
onMouseUp: S,
|
|
3668
|
+
onMouseMove: C,
|
|
3669
|
+
onBlur: (e) => {
|
|
3670
|
+
e.currentTarget.contains(e.relatedTarget) || (a(void 0), s(void 0));
|
|
3671
|
+
}
|
|
3672
|
+
};
|
|
3673
|
+
}, InputCell = ({ cell: e, columnAlignment: t, testId: n, type: r }) => {
|
|
3674
|
+
let { selectedIndexes: i } = useContext(CellSelectionContext), a = i?.row.start !== i?.row.end || i?.column.start !== i?.column.end;
|
|
3675
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
3676
|
+
name: e.name,
|
|
3677
|
+
value: e.value,
|
|
3678
|
+
onChange: (t) => e.onChange?.(t),
|
|
3679
|
+
onFocus: e.onFocus,
|
|
3680
|
+
onBlur: e.onBlur,
|
|
3681
|
+
onPaste: (t) => e.onPaste?.(t),
|
|
3682
|
+
placeholder: e.placeholder,
|
|
3683
|
+
error: e.error,
|
|
3684
|
+
warning: e.warning,
|
|
3685
|
+
disabled: e.disabled,
|
|
3686
|
+
isInTable: !0,
|
|
3687
|
+
maxTooltipWidth: e.maxTooltipWidth,
|
|
3688
|
+
right: t === Align.RIGHT,
|
|
3689
|
+
selectOnFocus: !a,
|
|
3690
|
+
testId: n,
|
|
3691
|
+
tabIndex: e.disabled ? -1 : 0,
|
|
3692
|
+
tooltip: e.tooltip,
|
|
3693
|
+
type: r
|
|
3694
|
+
});
|
|
3695
|
+
}, safeToString = (e) => String(toString(e)), roundNumberCosmetic = (e) => isScientificStringNum(e) ? e : safeToString(roundToPrecision(toNum(e), 14));
|
|
3024
3696
|
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:
|
|
3697
|
+
const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r = !1, left: i = !1, small: a = !1, width: o = "100%", value: s = "", onChange: c = () => {}, onFocus: u = () => {}, onBlur: d = () => {}, selectOnFocus: f, tabIndex: p = 0, testId: g, tooltip: _ = null, warning: v = !1, validationCallback: y = () => {}, allowEmpty: b = !1, isInTable: x, groupOrder: S, enableCosmeticRounding: C = !0, enableDisplayRounding: w = !1, roundDisplayValue: T, disableInternalErrorValidationMessages: E = !1, disableValidationOnFocus: D = !1 }) => {
|
|
3026
3698
|
let O = (e) => {
|
|
3027
3699
|
let n = validateNumber(e), r = t && isEmptyNullOrUndefined(e);
|
|
3028
3700
|
return [Infinity, -Infinity].includes(Number(e)) || r ? {
|
|
@@ -3062,7 +3734,7 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3062
3734
|
name: F
|
|
3063
3735
|
}
|
|
3064
3736
|
};
|
|
3065
|
-
|
|
3737
|
+
c(t);
|
|
3066
3738
|
}
|
|
3067
3739
|
};
|
|
3068
3740
|
useEffect(() => {
|
|
@@ -3100,7 +3772,7 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3100
3772
|
isInTable: x,
|
|
3101
3773
|
groupOrder: S,
|
|
3102
3774
|
selectOnFocus: f,
|
|
3103
|
-
tabIndex:
|
|
3775
|
+
tabIndex: p,
|
|
3104
3776
|
tooltip: _,
|
|
3105
3777
|
ref: A
|
|
3106
3778
|
}, F);
|
|
@@ -3169,14 +3841,14 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3169
3841
|
testId: n
|
|
3170
3842
|
}) : null
|
|
3171
3843
|
}), LinkCell = ({ cell: e, testId: t }) => {
|
|
3172
|
-
let n = useContext(DisabledContext), { error: r, warning: i, tooltip: a, maxTooltipWidth: o } = e,
|
|
3844
|
+
let n = useContext(DisabledContext), { error: r, warning: i, tooltip: a, maxTooltipWidth: o } = e, s = (e) => isStringNumberOrNode(e);
|
|
3173
3845
|
return /* @__PURE__ */ jsx("div", {
|
|
3174
3846
|
className: cell_module_default.inputWrapper,
|
|
3175
3847
|
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
3176
3848
|
error: !!r,
|
|
3177
3849
|
warning: !!i,
|
|
3178
3850
|
text: a || r || i,
|
|
3179
|
-
enabled:
|
|
3851
|
+
enabled: s(a) || s(r) || s(i) || !1,
|
|
3180
3852
|
maxWidth: o,
|
|
3181
3853
|
children: /* @__PURE__ */ jsx("div", {
|
|
3182
3854
|
className: cell_module_default.staticCellContent,
|
|
@@ -3219,7 +3891,7 @@ var slider_module_default = {
|
|
|
3219
3891
|
] }),
|
|
3220
3892
|
children: /* @__PURE__ */ jsx("div", { className: slider_module_default.dot })
|
|
3221
3893
|
}), e), {}), isEqual$1);
|
|
3222
|
-
const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto", value: i, min: a, max: o, step:
|
|
3894
|
+
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
3895
|
enabled: !1,
|
|
3224
3896
|
width: "100px",
|
|
3225
3897
|
height: "400px"
|
|
@@ -3252,13 +3924,13 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3252
3924
|
})
|
|
3253
3925
|
});
|
|
3254
3926
|
return /* @__PURE__ */ jsxs("div", {
|
|
3255
|
-
className: cx(slider_module_default.container, h ? slider_module_default.small : "",
|
|
3256
|
-
style:
|
|
3257
|
-
width:
|
|
3258
|
-
height:
|
|
3927
|
+
className: cx(slider_module_default.container, h ? slider_module_default.small : "", g.enabled ? slider_module_default.vertical : ""),
|
|
3928
|
+
style: g.enabled ? {
|
|
3929
|
+
width: g.width,
|
|
3930
|
+
height: g.height
|
|
3259
3931
|
} : { width: n },
|
|
3260
3932
|
children: [
|
|
3261
|
-
u && (
|
|
3933
|
+
u && (g.enabled ? /* @__PURE__ */ jsx(C, {}) : /* @__PURE__ */ jsx(S, {})),
|
|
3262
3934
|
/* @__PURE__ */ jsx(RcSlider, {
|
|
3263
3935
|
range: m,
|
|
3264
3936
|
allowCross: !1,
|
|
@@ -3266,11 +3938,11 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3266
3938
|
value: i,
|
|
3267
3939
|
max: o,
|
|
3268
3940
|
min: a,
|
|
3269
|
-
step:
|
|
3941
|
+
step: s,
|
|
3270
3942
|
marks: b,
|
|
3271
3943
|
onChange: (e) => x(e),
|
|
3272
3944
|
disabled: p || y,
|
|
3273
|
-
vertical:
|
|
3945
|
+
vertical: g.enabled,
|
|
3274
3946
|
handleRender: (e, t) => {
|
|
3275
3947
|
let n = d && t.dragging;
|
|
3276
3948
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -3287,7 +3959,7 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3287
3959
|
});
|
|
3288
3960
|
}
|
|
3289
3961
|
}),
|
|
3290
|
-
u && (
|
|
3962
|
+
u && (g.enabled ? /* @__PURE__ */ jsx(S, {}) : /* @__PURE__ */ jsx(C, {})),
|
|
3291
3963
|
t && /* @__PURE__ */ jsx("label", {
|
|
3292
3964
|
className: slider_module_default.label,
|
|
3293
3965
|
style: { width: r },
|
|
@@ -3328,17 +4000,17 @@ var popover_module_default = {
|
|
|
3328
4000
|
fullWidthStyleFix: "_fullWidthStyleFix_lhie5_8",
|
|
3329
4001
|
dismiss: "_dismiss_lhie5_13"
|
|
3330
4002
|
};
|
|
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 && !
|
|
4003
|
+
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 }) => {
|
|
4004
|
+
let m = useContext(DisabledContext), [g, v] = f === void 0 ? useState(!1) : [f, p], y = () => {
|
|
4005
|
+
!u && !m && v && v(!1);
|
|
3334
4006
|
}, b = () => {
|
|
3335
|
-
u ||
|
|
4007
|
+
u || m || v && v(!g);
|
|
3336
4008
|
};
|
|
3337
4009
|
useEffect(() => {
|
|
3338
|
-
(u ||
|
|
3339
|
-
}, [u,
|
|
4010
|
+
(u || m) && y();
|
|
4011
|
+
}, [u, m]);
|
|
3340
4012
|
let { renderLayer: x, arrowProps: S, layerProps: C, triggerProps: w } = useLayer({
|
|
3341
|
-
isOpen:
|
|
4013
|
+
isOpen: g,
|
|
3342
4014
|
placement: r,
|
|
3343
4015
|
auto: !0,
|
|
3344
4016
|
triggerOffset: 6,
|
|
@@ -3349,9 +4021,9 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
|
|
|
3349
4021
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
3350
4022
|
ref: w.ref,
|
|
3351
4023
|
onClick: b,
|
|
3352
|
-
"data-testid":
|
|
4024
|
+
"data-testid": s,
|
|
3353
4025
|
children: t
|
|
3354
|
-
}),
|
|
4026
|
+
}), g && x(/* @__PURE__ */ jsxs("div", {
|
|
3355
4027
|
className: a ? cx(popover_module_default.toggleBox, popover_module_default.fullWidthStyleFix) : cx(popover_module_default.toggleBox),
|
|
3356
4028
|
...C,
|
|
3357
4029
|
children: [/* @__PURE__ */ jsxs("div", { children: [React.isValidElement(n) ? React.cloneElement(n, { close: y }) : n, o && /* @__PURE__ */ jsx("div", {
|
|
@@ -3477,33 +4149,36 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
|
|
|
3477
4149
|
let CellType = /* @__PURE__ */ function(e) {
|
|
3478
4150
|
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
4151
|
}({});
|
|
3480
|
-
const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a }) => {
|
|
4152
|
+
const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a, rowIndex: o, columnIndex: s }) => {
|
|
4153
|
+
let { selectedIndexes: l, setSelectedIndexes: u } = useContext(CellSelectionContext), d = !t && l && l.row.start <= o && o <= l.row.end && l.column.start <= s && s <= l.column.end;
|
|
3481
4154
|
if (!e) return null;
|
|
3482
|
-
let { style:
|
|
4155
|
+
let { style: f, colSpan: p, rowSpan: h, width: g } = e, v = useRef(null), y = {
|
|
3483
4156
|
bodyAlignment: r,
|
|
3484
4157
|
headerAlignment: n,
|
|
3485
4158
|
isHeader: t
|
|
3486
|
-
},
|
|
3487
|
-
width:
|
|
3488
|
-
minWidth:
|
|
3489
|
-
textTransform:
|
|
3490
|
-
...
|
|
4159
|
+
}, 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 = {
|
|
4160
|
+
width: w,
|
|
4161
|
+
minWidth: w,
|
|
4162
|
+
textTransform: E,
|
|
4163
|
+
...f
|
|
3491
4164
|
};
|
|
3492
4165
|
return /* @__PURE__ */ jsx(t ? "th" : "td", {
|
|
3493
|
-
ref:
|
|
3494
|
-
className:
|
|
3495
|
-
style:
|
|
3496
|
-
colSpan:
|
|
3497
|
-
rowSpan:
|
|
4166
|
+
ref: v,
|
|
4167
|
+
className: C,
|
|
4168
|
+
style: D,
|
|
4169
|
+
colSpan: p,
|
|
4170
|
+
rowSpan: h,
|
|
4171
|
+
"data-row-index": o,
|
|
4172
|
+
"data-column-index": s,
|
|
3498
4173
|
children: /* @__PURE__ */ jsx(CellWrapper, {
|
|
3499
4174
|
cell: e,
|
|
3500
|
-
columnAlignment:
|
|
4175
|
+
columnAlignment: x ?? Align.RIGHT,
|
|
3501
4176
|
isHeader: t,
|
|
3502
4177
|
testId: a
|
|
3503
4178
|
})
|
|
3504
4179
|
});
|
|
3505
4180
|
}, 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:
|
|
4181
|
+
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
4182
|
let i = `${n ? 0 : 1}_${t}_${r}`;
|
|
3508
4183
|
return /* @__PURE__ */ jsx(Cell, {
|
|
3509
4184
|
cell: e,
|
|
@@ -3511,14 +4186,18 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3511
4186
|
columnAlignment: o[r],
|
|
3512
4187
|
columnHeaderAlignment: p[r],
|
|
3513
4188
|
width: l ? l[r] : void 0,
|
|
3514
|
-
testId: e.testId
|
|
4189
|
+
testId: e.testId,
|
|
4190
|
+
rowIndex: t,
|
|
4191
|
+
columnIndex: r
|
|
3515
4192
|
}, i);
|
|
3516
4193
|
}), w = s && /* @__PURE__ */ jsx(Cell, {
|
|
3517
4194
|
cell: {
|
|
3518
4195
|
type: CellType.ACTIONS,
|
|
3519
4196
|
actions: e.actions
|
|
3520
4197
|
},
|
|
3521
|
-
isHeader: n
|
|
4198
|
+
isHeader: n,
|
|
4199
|
+
rowIndex: t,
|
|
4200
|
+
columnIndex: r
|
|
3522
4201
|
}, r), { attributes: T, listeners: E, setNodeRef: D, transform: O, transition: k, isDragging: A } = useSortable({
|
|
3523
4202
|
id: t.toString(),
|
|
3524
4203
|
animateLayoutChanges: () => !1
|
|
@@ -3538,10 +4217,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3538
4217
|
});
|
|
3539
4218
|
return n ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
3540
4219
|
onClick: m,
|
|
3541
|
-
onMouseEnter:
|
|
4220
|
+
onMouseEnter: g,
|
|
3542
4221
|
onMouseLeave: v,
|
|
3543
4222
|
onFocus: h,
|
|
3544
|
-
className: cx(m ? row_module_default$1.clickableRow : null,
|
|
4223
|
+
className: cx(m ? row_module_default$1.clickableRow : null, g ? row_module_default$1.hoverableRow : null),
|
|
3545
4224
|
children: [
|
|
3546
4225
|
c ? /* @__PURE__ */ jsx("th", {}) : null,
|
|
3547
4226
|
C,
|
|
@@ -3554,10 +4233,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3554
4233
|
}, `${t}_expanded_content`) : null] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
3555
4234
|
ref: e.noDrag ? null : D,
|
|
3556
4235
|
onClick: m,
|
|
3557
|
-
onMouseEnter:
|
|
4236
|
+
onMouseEnter: g,
|
|
3558
4237
|
onMouseLeave: v,
|
|
3559
4238
|
onFocus: h,
|
|
3560
|
-
className: cx(m && !m.noStyle ? row_module_default$1.clickableRow : null,
|
|
4239
|
+
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
4240
|
"data-error": b || null,
|
|
3562
4241
|
"data-warning": x || null,
|
|
3563
4242
|
"data-index": t,
|
|
@@ -3574,14 +4253,14 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3574
4253
|
children: y.content
|
|
3575
4254
|
}, `${t}_expanded_content`) : null] });
|
|
3576
4255
|
}, 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, [
|
|
4256
|
+
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
4257
|
return a ? /* @__PURE__ */ jsxs(DndContext, {
|
|
3579
4258
|
collisionDetection: closestCenter,
|
|
3580
4259
|
onDragStart: (e) => {
|
|
3581
4260
|
p(e.active.id);
|
|
3582
4261
|
},
|
|
3583
4262
|
onDragEnd: (e) => {
|
|
3584
|
-
p(null),
|
|
4263
|
+
p(null), g(!1);
|
|
3585
4264
|
let { active: t, over: n } = e;
|
|
3586
4265
|
if (!t || !n || t.id === n.id) return;
|
|
3587
4266
|
let r = Number(t.id), i = Number(n?.id);
|
|
@@ -3598,23 +4277,23 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3598
4277
|
from: r,
|
|
3599
4278
|
to: i
|
|
3600
4279
|
});
|
|
3601
|
-
|
|
4280
|
+
g(a);
|
|
3602
4281
|
},
|
|
3603
4282
|
children: [/* @__PURE__ */ jsx(SortableContext, {
|
|
3604
4283
|
items: v,
|
|
3605
4284
|
strategy: verticalListSortingStrategy,
|
|
3606
|
-
children: t({ dropDisabled:
|
|
3607
|
-
}), !!
|
|
4285
|
+
children: t({ dropDisabled: m })
|
|
4286
|
+
}), !!d && createPortal(/* @__PURE__ */ jsx(DragOverlay, {
|
|
3608
4287
|
dropAnimation: null,
|
|
3609
4288
|
children: /* @__PURE__ */ jsx("table", {
|
|
3610
4289
|
className: cx(table_module_default.table, table_module_default.dragOverlay),
|
|
3611
4290
|
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(Row$1, {
|
|
3612
|
-
rowIndex: Number(
|
|
3613
|
-
row: l[Number(
|
|
4291
|
+
rowIndex: Number(d),
|
|
4292
|
+
row: l[Number(d)],
|
|
3614
4293
|
columnCount: i,
|
|
3615
4294
|
columnWidths: (() => {
|
|
3616
4295
|
if (!u?.current) return [];
|
|
3617
|
-
let e = u.current.querySelectorAll("tr")[Number(
|
|
4296
|
+
let e = u.current.querySelectorAll("tr")[Number(d)]?.querySelectorAll("td");
|
|
3618
4297
|
if (!e) return [];
|
|
3619
4298
|
let t = Array.from(e).map((e) => `${e.getBoundingClientRect().width}px`);
|
|
3620
4299
|
return t.shift(), t;
|
|
@@ -3623,7 +4302,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3623
4302
|
hasRowActions: c,
|
|
3624
4303
|
columnAlignment: r,
|
|
3625
4304
|
draggableTable: a,
|
|
3626
|
-
dropDisabled:
|
|
4305
|
+
dropDisabled: m
|
|
3627
4306
|
}) })
|
|
3628
4307
|
})
|
|
3629
4308
|
}), document.body)]
|
|
@@ -3665,135 +4344,155 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3665
4344
|
className: table_module_default.scroll,
|
|
3666
4345
|
children: n({})
|
|
3667
4346
|
});
|
|
3668
|
-
}, Table = (e) => {
|
|
3669
|
-
let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i } = e, { columnWidths:
|
|
3670
|
-
|
|
4347
|
+
}, Table = withValidationScope((e) => {
|
|
4348
|
+
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;
|
|
4349
|
+
useRegisterValidationRules(D, T);
|
|
4350
|
+
let O = useRef(null), k = useRef(null), { selectedIndexes: A, setSelectedIndexes: j, onCopy: M, onPaste: N, onKeyDown: P, onKeyUp: F, onMouseUp: I, onBlur: L, onMouseDown: R, onMouseMove: z } = useCellSelection(!!a, k, e.table.rows || [], w), B = get(e, "table.headers", []), V = getColumnCount(l, B), H = hasRowActions(l, B), U = V + (H ? 1 : 0), W = s ? s?.pagination?.rowsPerPage?.value === 0 || Number(s?.pagination?.selectedPage) >= Number(s?.pagination?.rowCount) / Number(s?.pagination?.rowsPerPage?.value) : !0, G = y?.cells?.length && b && W, K = {
|
|
4351
|
+
cells: G ? y.cells.map((e, t) => e?.type === "Input" ? {
|
|
3671
4352
|
...e,
|
|
3672
4353
|
onChange: (e) => {
|
|
3673
4354
|
let n = e?.target?.value, r = {
|
|
3674
|
-
...
|
|
3675
|
-
cells:
|
|
4355
|
+
...y,
|
|
4356
|
+
cells: y.cells.map((e, r) => ({
|
|
3676
4357
|
...e,
|
|
3677
4358
|
value: r === t ? n : e?.value
|
|
3678
4359
|
}))
|
|
3679
4360
|
};
|
|
3680
|
-
|
|
4361
|
+
b({ newRow: r });
|
|
3681
4362
|
}
|
|
3682
4363
|
} : {
|
|
3683
4364
|
...e,
|
|
3684
4365
|
disabled: !0
|
|
3685
4366
|
}) : null,
|
|
3686
|
-
testId:
|
|
3687
|
-
},
|
|
4367
|
+
testId: g ? `${g}-last-empty-row` : void 0
|
|
4368
|
+
}, q = G ? l.concat(K) : l, J = {
|
|
3688
4369
|
...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
|
-
|
|
4370
|
+
rows: q
|
|
4371
|
+
}, Y = cx(table_module_default.wrapper, x ? table_module_default.bordered : ""), X = {
|
|
4372
|
+
maxHeight: S,
|
|
4373
|
+
width: C,
|
|
4374
|
+
display: C === "auto" ? "inline-flex" : "flex"
|
|
4375
|
+
};
|
|
4376
|
+
return /* @__PURE__ */ jsx(ValidationScopeContext.Provider, {
|
|
4377
|
+
value: D,
|
|
4378
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4379
|
+
className: Y,
|
|
4380
|
+
style: X,
|
|
4381
|
+
children: [
|
|
4382
|
+
/* @__PURE__ */ jsx(Title$1, {
|
|
4383
|
+
actions: u,
|
|
4384
|
+
actionsRight: d,
|
|
4385
|
+
name: c,
|
|
4386
|
+
testId: g && `${g}-title`
|
|
4387
|
+
}),
|
|
4388
|
+
/* @__PURE__ */ jsx(TableDragWrapper, {
|
|
4389
|
+
colSpan: U,
|
|
4390
|
+
columnAlignment: p,
|
|
4391
|
+
columnCount: V,
|
|
4392
|
+
draggable: v,
|
|
4393
|
+
onListReorder: t,
|
|
4394
|
+
rowActions: H,
|
|
4395
|
+
rows: q,
|
|
4396
|
+
tbodyRef: k,
|
|
4397
|
+
canListReorder: n,
|
|
4398
|
+
children: ({ dropDisabled: e }) => /* @__PURE__ */ jsx(TableScrollWrapper, {
|
|
4399
|
+
table: J,
|
|
4400
|
+
theadRef: O,
|
|
4401
|
+
children: ({ virtualizer: t, tableStyle: n }) => /* @__PURE__ */ jsx(CellSelectionContext.Provider, {
|
|
4402
|
+
value: {
|
|
4403
|
+
selectedIndexes: A,
|
|
4404
|
+
setSelectedIndexes: j
|
|
4405
|
+
},
|
|
4406
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
4407
|
+
className: cx(table_module_default.table, h ? table_module_default.striped : ""),
|
|
4408
|
+
"data-testid": g,
|
|
4409
|
+
"data-multiselect": !!a,
|
|
4410
|
+
style: n,
|
|
4411
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
4412
|
+
ref: O,
|
|
4413
|
+
children: B.map((e, t) => /* @__PURE__ */ jsx(Row$1, {
|
|
4414
|
+
rowIndex: t,
|
|
4415
|
+
isHeader: !0,
|
|
4416
|
+
row: e,
|
|
4417
|
+
columnCount: V,
|
|
4418
|
+
columnWidths: o,
|
|
4419
|
+
colSpan: U,
|
|
4420
|
+
hasRowActions: H,
|
|
4421
|
+
columnAlignment: p,
|
|
4422
|
+
columnHeaderAlignments: f,
|
|
4423
|
+
draggableTable: v
|
|
4424
|
+
}, `0_${t}`))
|
|
4425
|
+
}), /* @__PURE__ */ jsx("tbody", {
|
|
4426
|
+
ref: k,
|
|
4427
|
+
onCopy: M,
|
|
4428
|
+
onPaste: N,
|
|
4429
|
+
onKeyDown: P,
|
|
4430
|
+
onKeyUp: F,
|
|
4431
|
+
onMouseDown: R,
|
|
4432
|
+
onMouseUp: I,
|
|
4433
|
+
onMouseMove: z,
|
|
4434
|
+
onBlur: L,
|
|
4435
|
+
children: t ? t.getVirtualItems().map((t) => {
|
|
4436
|
+
let n = t.index, i = q[n], a = r ? r({
|
|
4437
|
+
row: i,
|
|
4438
|
+
rowIndex: n
|
|
4439
|
+
}) : i;
|
|
4440
|
+
return /* @__PURE__ */ jsx(Row$1, {
|
|
4441
|
+
rowIndex: n,
|
|
4442
|
+
row: a,
|
|
4443
|
+
columnCount: V,
|
|
4444
|
+
columnWidths: o,
|
|
4445
|
+
colSpan: U,
|
|
4446
|
+
hasRowActions: H,
|
|
4447
|
+
columnAlignment: p,
|
|
4448
|
+
draggableTable: v,
|
|
4449
|
+
height: t.size,
|
|
4450
|
+
dropDisabled: e
|
|
4451
|
+
}, `1_${n}`);
|
|
4452
|
+
}) : q.map((t, n) => {
|
|
4453
|
+
let i = r ? r({
|
|
4454
|
+
row: t,
|
|
4455
|
+
rowIndex: n
|
|
4456
|
+
}) : t;
|
|
4457
|
+
return /* @__PURE__ */ jsx(Row$1, {
|
|
4458
|
+
rowIndex: n,
|
|
4459
|
+
row: i,
|
|
4460
|
+
columnCount: V,
|
|
4461
|
+
columnWidths: o,
|
|
4462
|
+
colSpan: U,
|
|
4463
|
+
hasRowActions: H,
|
|
4464
|
+
columnAlignment: p,
|
|
4465
|
+
draggableTable: v,
|
|
4466
|
+
dropDisabled: e
|
|
4467
|
+
}, `1_${n}`);
|
|
4468
|
+
})
|
|
4469
|
+
})]
|
|
3771
4470
|
})
|
|
3772
|
-
})
|
|
4471
|
+
})
|
|
3773
4472
|
})
|
|
4473
|
+
}),
|
|
4474
|
+
s && /* @__PURE__ */ jsx(Footer, {
|
|
4475
|
+
pagination: s.pagination,
|
|
4476
|
+
actions: s.actions,
|
|
4477
|
+
content: s.content
|
|
3774
4478
|
})
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
pagination: o.pagination,
|
|
3778
|
-
actions: o.actions,
|
|
3779
|
-
content: o.content
|
|
3780
|
-
})
|
|
3781
|
-
]
|
|
4479
|
+
]
|
|
4480
|
+
})
|
|
3782
4481
|
});
|
|
3783
|
-
}, placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
|
|
4482
|
+
}), placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
|
|
3784
4483
|
let i = `${t} → ${n}:`, a = e.filter((e) => !e.startsWith(i)), o = r ? [...a, `${i} ${r}`] : a, s = o.length === 0;
|
|
3785
4484
|
return {
|
|
3786
4485
|
updatedErrors: o,
|
|
3787
4486
|
isValid: s
|
|
3788
4487
|
};
|
|
3789
4488
|
}, Table$1 = ({ validationRules: e, parsedResult: t, updateState: n, testId: r }) => {
|
|
3790
|
-
let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a,
|
|
4489
|
+
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
4490
|
cells: r.map((r, o) => {
|
|
3792
|
-
let { columnMessage: s = {}, validator: c = () => null } = e?.[o] ?? {}, l = i?.[o]?.value, u = `${`Row ${a + 1}`} → ${l}:`,
|
|
4491
|
+
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
4492
|
return {
|
|
3794
4493
|
name: l,
|
|
3795
4494
|
value: r,
|
|
3796
|
-
type:
|
|
4495
|
+
type: d.current[o] ?? "Input",
|
|
3797
4496
|
disableValidationOnFocus: !0,
|
|
3798
4497
|
error: m,
|
|
3799
4498
|
validationCallback: (e, r) => {
|
|
@@ -3878,12 +4577,12 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3878
4577
|
i,
|
|
3879
4578
|
x,
|
|
3880
4579
|
b
|
|
3881
|
-
]), C = useMemo(() => _.slice(
|
|
4580
|
+
]), C = useMemo(() => _.slice(p, g), [
|
|
3882
4581
|
_,
|
|
3883
|
-
|
|
4582
|
+
p,
|
|
3884
4583
|
g
|
|
3885
4584
|
]), w = useCallback(({ rowIndex: e }) => {
|
|
3886
|
-
let n =
|
|
4585
|
+
let n = p + e, r = t.rows[n];
|
|
3887
4586
|
return r ? y(r, n) : {
|
|
3888
4587
|
cells: [],
|
|
3889
4588
|
actions: []
|
|
@@ -3891,7 +4590,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3891
4590
|
}, [
|
|
3892
4591
|
t.rows,
|
|
3893
4592
|
y,
|
|
3894
|
-
|
|
4593
|
+
p
|
|
3895
4594
|
]);
|
|
3896
4595
|
return /* @__PURE__ */ jsx(Table, {
|
|
3897
4596
|
beforeRenderRow: w,
|
|
@@ -3917,10 +4616,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3917
4616
|
infiniteScroll: !0,
|
|
3918
4617
|
footer: { pagination: {
|
|
3919
4618
|
rowCount: t.rows.length,
|
|
3920
|
-
selectedPage:
|
|
4619
|
+
selectedPage: c,
|
|
3921
4620
|
rowsPerPage: {
|
|
3922
4621
|
value: a,
|
|
3923
|
-
onChange: (e) =>
|
|
4622
|
+
onChange: (e) => o(Number(e?.target?.value)),
|
|
3924
4623
|
options: [
|
|
3925
4624
|
{
|
|
3926
4625
|
label: "10 / page",
|
|
@@ -4030,210 +4729,7 @@ const Empty = ({ width: e = "auto", height: t = "auto", text: n = "No data", chi
|
|
|
4030
4729
|
}), extraSeparators = (e) => e?.split(/;|\t|\n/)?.some((e) => {
|
|
4031
4730
|
let t = e?.match(/[.,]/g);
|
|
4032
4731
|
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 = {
|
|
4732
|
+
}), hasOneComma = (e) => e?.split(/;|\t|\n/)?.some((e) => !e?.includes(".") && e?.match(/,/g)?.length === 1), toast = ({ id: e, message: t = {
|
|
4237
4733
|
type: MessageType.INFO,
|
|
4238
4734
|
content: ""
|
|
4239
4735
|
}, autoClose: n = 6e3, onClose: r }) => {
|
|
@@ -4288,13 +4784,13 @@ var toggle_module_default = {
|
|
|
4288
4784
|
noMargin: "_noMargin_1c9wf_110",
|
|
4289
4785
|
helpIconEnabled: "_helpIconEnabled_1c9wf_113"
|
|
4290
4786
|
};
|
|
4291
|
-
const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, small: a = !1, onChange: o, noMargin:
|
|
4292
|
-
let
|
|
4787
|
+
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 }) => {
|
|
4788
|
+
let f = useContext(DisabledContext), p = u || d, m = r || f;
|
|
4293
4789
|
return /* @__PURE__ */ jsxs("div", {
|
|
4294
|
-
className: cx(toggle_module_default.toggle,
|
|
4790
|
+
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
4791
|
style: { display: i },
|
|
4296
4792
|
onClick: (t) => {
|
|
4297
|
-
|
|
4793
|
+
m || (t.target.name = e, t.target.checked = !n, t.target.value = !n, o(t));
|
|
4298
4794
|
},
|
|
4299
4795
|
"data-testid": l,
|
|
4300
4796
|
children: [
|
|
@@ -4302,22 +4798,19 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4302
4798
|
type: InputType.CHECKBOX,
|
|
4303
4799
|
name: e,
|
|
4304
4800
|
value: n?.toString(),
|
|
4305
|
-
disabled:
|
|
4801
|
+
disabled: m,
|
|
4306
4802
|
checked: n,
|
|
4307
4803
|
onChange: () => {}
|
|
4308
4804
|
}),
|
|
4309
|
-
/* @__PURE__ */ jsx("label", {
|
|
4310
|
-
|
|
4311
|
-
children: t
|
|
4312
|
-
}),
|
|
4313
|
-
m && /* @__PURE__ */ jsx("div", {
|
|
4805
|
+
/* @__PURE__ */ jsx("label", { children: t }),
|
|
4806
|
+
p && /* @__PURE__ */ jsx("div", {
|
|
4314
4807
|
className: toggle_module_default.helpIconEnabled,
|
|
4315
4808
|
onClick: d,
|
|
4316
4809
|
children: /* @__PURE__ */ jsx(HelpIcon, { text: u })
|
|
4317
4810
|
})
|
|
4318
4811
|
]
|
|
4319
4812
|
});
|
|
4320
|
-
}, PasteWithReviewModal = ({ config: e, state: t, updateState: n, setModalVisibility: r, onCloseModal: i, readAndParseInput: a, validationRules:
|
|
4813
|
+
}, 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
4814
|
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
4815
|
pastedText: "",
|
|
4323
4816
|
parsedResult: {
|
|
@@ -4338,15 +4831,15 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4338
4831
|
let O = useCallback((t) => {
|
|
4339
4832
|
if (t) {
|
|
4340
4833
|
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:
|
|
4834
|
+
validationRules: o,
|
|
4342
4835
|
importLimit: n
|
|
4343
|
-
}, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2),
|
|
4836
|
+
}, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2), s = unParse(i, a, t, r);
|
|
4344
4837
|
f(() => D({
|
|
4345
4838
|
parsedResult: {
|
|
4346
4839
|
...N,
|
|
4347
4840
|
rows: t
|
|
4348
4841
|
},
|
|
4349
|
-
pastedText:
|
|
4842
|
+
pastedText: s
|
|
4350
4843
|
})), C.current = E;
|
|
4351
4844
|
} else f(() => {
|
|
4352
4845
|
C.current && D(C.current);
|
|
@@ -4355,7 +4848,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4355
4848
|
}, [
|
|
4356
4849
|
E,
|
|
4357
4850
|
n,
|
|
4358
|
-
|
|
4851
|
+
o
|
|
4359
4852
|
]), k = () => {
|
|
4360
4853
|
D({
|
|
4361
4854
|
pastedText: "",
|
|
@@ -4408,7 +4901,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4408
4901
|
]
|
|
4409
4902
|
}),
|
|
4410
4903
|
_ && /* @__PURE__ */ jsx(Help, {
|
|
4411
|
-
validationRules:
|
|
4904
|
+
validationRules: o,
|
|
4412
4905
|
t: u
|
|
4413
4906
|
}),
|
|
4414
4907
|
R ? /* @__PURE__ */ jsx("div", {
|
|
@@ -4441,7 +4934,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4441
4934
|
},
|
|
4442
4935
|
colored: !0,
|
|
4443
4936
|
loading: d,
|
|
4444
|
-
testId: `${
|
|
4937
|
+
testId: `${p}-paste-from-clipboard-button`
|
|
4445
4938
|
})
|
|
4446
4939
|
]
|
|
4447
4940
|
})
|
|
@@ -4473,7 +4966,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4473
4966
|
} })
|
|
4474
4967
|
]
|
|
4475
4968
|
}), /* @__PURE__ */ jsx(Table$1, {
|
|
4476
|
-
validationRules:
|
|
4969
|
+
validationRules: o,
|
|
4477
4970
|
parsedResult: N,
|
|
4478
4971
|
updateState: (e) => D((t) => ({
|
|
4479
4972
|
...t,
|
|
@@ -4500,7 +4993,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4500
4993
|
onClick: () => f(() => j()),
|
|
4501
4994
|
disabled: R || !F,
|
|
4502
4995
|
loading: d,
|
|
4503
|
-
testId: `${
|
|
4996
|
+
testId: `${p}-paste-with-review-modal-button-okay`
|
|
4504
4997
|
}),
|
|
4505
4998
|
/* @__PURE__ */ jsx(Button, {
|
|
4506
4999
|
label: u("cancel"),
|
|
@@ -4546,75 +5039,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4546
5039
|
return;
|
|
4547
5040
|
}
|
|
4548
5041
|
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) => {
|
|
5042
|
+
}, [t, n]), normalizeParsedResult = (e) => {
|
|
4618
5043
|
let { rows: t } = e, n = Array(t.length);
|
|
4619
5044
|
for (let e = 0; e < t.length; e++) {
|
|
4620
5045
|
let r = t[e], i = Array(r.length);
|
|
@@ -4626,16 +5051,16 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4626
5051
|
rows: n
|
|
4627
5052
|
};
|
|
4628
5053
|
}, useDataImportActions = ({ config: e, state: t, setState: n, smartUploadConfig: r, startTransition: i }) => {
|
|
4629
|
-
let { exportData: a, beforeExportData:
|
|
5054
|
+
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
5055
|
n((t) => ({
|
|
4631
5056
|
...t,
|
|
4632
5057
|
...e
|
|
4633
5058
|
}));
|
|
4634
|
-
}, [n]),
|
|
5059
|
+
}, [n]), x = useCallback(({ name: e, callback: n } = {}) => {
|
|
4635
5060
|
let r = { ...t.modalVisibility }, i = !e, a = [];
|
|
4636
5061
|
if (i) for (let e of Object.keys(r)) a.push(e), r[e] = !1;
|
|
4637
5062
|
else r?.[e] && (a.push(e), r[e] = !1);
|
|
4638
|
-
a
|
|
5063
|
+
a?.length > 0 && b({
|
|
4639
5064
|
modalVisibility: r,
|
|
4640
5065
|
pastedText: "",
|
|
4641
5066
|
parsedResult: {
|
|
@@ -4645,9 +5070,9 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4645
5070
|
units: [],
|
|
4646
5071
|
errors: []
|
|
4647
5072
|
}
|
|
4648
|
-
}), typeof n == "function" && a
|
|
4649
|
-
}, [t.modalVisibility,
|
|
4650
|
-
i(() =>
|
|
5073
|
+
}), typeof n == "function" && a?.length > 0 && n();
|
|
5074
|
+
}, [t.modalVisibility, b]), S = useCallback(() => {
|
|
5075
|
+
i(() => b({
|
|
4651
5076
|
pastedText: "",
|
|
4652
5077
|
parsedResult: {
|
|
4653
5078
|
isValid: !1,
|
|
@@ -4656,55 +5081,52 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4656
5081
|
units: [],
|
|
4657
5082
|
errors: []
|
|
4658
5083
|
}
|
|
4659
|
-
})),
|
|
4660
|
-
}, [t.modalVisibility,
|
|
4661
|
-
|
|
5084
|
+
})), p && p?.("all");
|
|
5085
|
+
}, [t.modalVisibility, b]), C = useCallback((e, n) => {
|
|
5086
|
+
b({ modalVisibility: {
|
|
4662
5087
|
...t.modalVisibility,
|
|
4663
5088
|
[e]: n
|
|
4664
5089
|
} });
|
|
4665
|
-
}, [t.modalVisibility,
|
|
5090
|
+
}, [t.modalVisibility, b]), w = useCallback(async (e) => {
|
|
4666
5091
|
let t = {
|
|
4667
|
-
validationRules:
|
|
5092
|
+
validationRules: y,
|
|
4668
5093
|
importLimit: c
|
|
4669
|
-
}, n = await
|
|
4670
|
-
if (
|
|
5094
|
+
}, n = await v(e, g), r = normalizeParsedResult(n);
|
|
5095
|
+
if (h && h(m)) {
|
|
4671
5096
|
let { fields: e, units: n, rows: a, isValid: o } = r, s = unParse(e, n ?? [], a, t);
|
|
4672
|
-
return i(() =>
|
|
5097
|
+
return i(() => b({
|
|
4673
5098
|
pastedText: s,
|
|
4674
|
-
parsedResult:
|
|
5099
|
+
parsedResult: m
|
|
4675
5100
|
})), r;
|
|
4676
5101
|
}
|
|
4677
|
-
return i(() =>
|
|
5102
|
+
return i(() => b({
|
|
4678
5103
|
pastedText: e,
|
|
4679
5104
|
parsedResult: r
|
|
4680
5105
|
})), r;
|
|
4681
5106
|
}, [
|
|
4682
|
-
|
|
5107
|
+
y,
|
|
4683
5108
|
c,
|
|
4684
|
-
_,
|
|
4685
5109
|
g,
|
|
4686
5110
|
h,
|
|
4687
|
-
|
|
4688
|
-
|
|
5111
|
+
m,
|
|
5112
|
+
b
|
|
5113
|
+
]), T = useCallback(async (e) => {
|
|
4689
5114
|
let { fromFile: t, showSuccessToast: n = !0 } = e ?? {}, r;
|
|
4690
5115
|
try {
|
|
4691
5116
|
if (r = t ? await t.text() : await navigator.clipboard.readText(), !r) {
|
|
4692
5117
|
transitionToast({ message: {
|
|
4693
5118
|
type: "Error",
|
|
4694
|
-
content:
|
|
5119
|
+
content: g(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed")
|
|
4695
5120
|
} }, i);
|
|
4696
5121
|
return;
|
|
4697
5122
|
}
|
|
4698
|
-
let e = await
|
|
4699
|
-
validationRules: l,
|
|
4700
|
-
importLimit: c
|
|
4701
|
-
}, _), a = normalizeParsedResult(e);
|
|
5123
|
+
let e = await v(r, g), a = normalizeParsedResult(e);
|
|
4702
5124
|
return a?.isValid || transitionToast({ message: {
|
|
4703
5125
|
type: "Error",
|
|
4704
|
-
content:
|
|
5126
|
+
content: g("clipboardReadFailed")
|
|
4705
5127
|
} }, i), n && transitionToast({ message: {
|
|
4706
5128
|
type: "Success",
|
|
4707
|
-
content:
|
|
5129
|
+
content: g("pasteSuccessful")
|
|
4708
5130
|
} }, i), {
|
|
4709
5131
|
pastedText: r,
|
|
4710
5132
|
parsedResult: a
|
|
@@ -4712,78 +5134,78 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4712
5134
|
} catch (e) {
|
|
4713
5135
|
transitionToast({ message: {
|
|
4714
5136
|
type: "Error",
|
|
4715
|
-
content:
|
|
5137
|
+
content: g(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed"),
|
|
4716
5138
|
details: e.message
|
|
4717
5139
|
} }, i);
|
|
4718
5140
|
return;
|
|
4719
5141
|
}
|
|
4720
|
-
}, [
|
|
5142
|
+
}, [y, c]), E = useCallback(async (e) => {
|
|
4721
5143
|
let t = e?.target?.files?.[0];
|
|
4722
5144
|
if (!t) return;
|
|
4723
|
-
let n = await t.text(), r = await
|
|
4724
|
-
r.isValid ? (
|
|
5145
|
+
let n = await t.text(), r = await w(n);
|
|
5146
|
+
r.isValid ? (d || transitionToast({ message: {
|
|
4725
5147
|
type: "Success",
|
|
4726
|
-
content:
|
|
4727
|
-
} }, i), i(() =>
|
|
5148
|
+
content: g("pasteSuccessful")
|
|
5149
|
+
} }, i), i(() => u(r))) : transitionToast({ message: {
|
|
4728
5150
|
type: "Error",
|
|
4729
|
-
content:
|
|
5151
|
+
content: g("fileParsingFailed")
|
|
4730
5152
|
} }, i);
|
|
4731
5153
|
}, [
|
|
4732
|
-
l,
|
|
4733
|
-
c,
|
|
4734
5154
|
y,
|
|
4735
|
-
|
|
4736
|
-
|
|
5155
|
+
c,
|
|
5156
|
+
b,
|
|
5157
|
+
u
|
|
5158
|
+
]), D = useCallback(async (e = !0) => {
|
|
4737
5159
|
try {
|
|
4738
5160
|
let t = await navigator.clipboard.readText();
|
|
4739
5161
|
if (!t) {
|
|
4740
5162
|
transitionToast({ message: {
|
|
4741
5163
|
type: "Error",
|
|
4742
|
-
content:
|
|
5164
|
+
content: g("clipboardIsEmpty")
|
|
4743
5165
|
} }, i);
|
|
4744
5166
|
return;
|
|
4745
5167
|
}
|
|
4746
|
-
let n = await
|
|
5168
|
+
let n = await w(t);
|
|
4747
5169
|
if (!n.isValid) {
|
|
4748
5170
|
transitionToast({ message: {
|
|
4749
5171
|
type: "Error",
|
|
4750
|
-
content:
|
|
5172
|
+
content: g("clipboardReadFailed")
|
|
4751
5173
|
} }, i);
|
|
4752
5174
|
return;
|
|
4753
5175
|
}
|
|
4754
|
-
|
|
5176
|
+
d || transitionToast({ message: {
|
|
4755
5177
|
type: "Success",
|
|
4756
|
-
content:
|
|
4757
|
-
} }, i), e && i(() =>
|
|
5178
|
+
content: g("pasteSuccessful")
|
|
5179
|
+
} }, i), e && i(() => u(n));
|
|
4758
5180
|
} catch {
|
|
4759
5181
|
transitionToast({ message: {
|
|
4760
5182
|
type: "Error",
|
|
4761
|
-
content:
|
|
5183
|
+
content: g("clipboardReadNotAllowed")
|
|
4762
5184
|
} }, i);
|
|
4763
5185
|
}
|
|
4764
5186
|
}, [
|
|
4765
|
-
l,
|
|
4766
|
-
c,
|
|
4767
|
-
_,
|
|
4768
5187
|
y,
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
5188
|
+
c,
|
|
5189
|
+
g,
|
|
5190
|
+
b,
|
|
5191
|
+
u
|
|
5192
|
+
]), O = useCallback(async (e) => {
|
|
5193
|
+
let t = await _();
|
|
4772
5194
|
if (!t) return;
|
|
4773
|
-
let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r ?? []).map((e) => e?.length ? e : placeholder$1).slice(0, n
|
|
5195
|
+
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
5196
|
try {
|
|
4775
5197
|
await navigator.clipboard.writeText(l), transitionToast({ message: {
|
|
4776
5198
|
type: "Success",
|
|
4777
|
-
content:
|
|
5199
|
+
content: g("copiedToClipboard")
|
|
4778
5200
|
} }, i);
|
|
4779
5201
|
} catch (e) {
|
|
4780
5202
|
transitionToast({ message: {
|
|
4781
5203
|
type: "Error",
|
|
4782
|
-
content:
|
|
5204
|
+
content: g("unableToCopyToClipboard"),
|
|
4783
5205
|
details: e.message
|
|
4784
5206
|
} }, i);
|
|
4785
5207
|
}
|
|
4786
|
-
}, [
|
|
5208
|
+
}, [_, g]), k = useCallback((e) => {
|
|
4787
5209
|
if (!e || e.errorMessage) {
|
|
4788
5210
|
transitionToast({ message: {
|
|
4789
5211
|
type: "Error",
|
|
@@ -4798,24 +5220,24 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4798
5220
|
rows: n.map((e) => Object.values(e)),
|
|
4799
5221
|
errors: []
|
|
4800
5222
|
};
|
|
4801
|
-
i(() =>
|
|
5223
|
+
i(() => b({ parsedResult: a })), i(() => u(a));
|
|
4802
5224
|
let { onComplete: o } = r ?? {};
|
|
4803
|
-
typeof o == "function" && o(a),
|
|
5225
|
+
typeof o == "function" && o(a), x();
|
|
4804
5226
|
}, [
|
|
4805
|
-
|
|
4806
|
-
|
|
5227
|
+
b,
|
|
5228
|
+
u,
|
|
4807
5229
|
r
|
|
4808
5230
|
]);
|
|
4809
5231
|
return {
|
|
4810
|
-
updateState:
|
|
4811
|
-
closeModals:
|
|
4812
|
-
setModalVisibility:
|
|
4813
|
-
readAndParseInput:
|
|
4814
|
-
onFileChange:
|
|
4815
|
-
onClickQuickPasteFromClipBoard:
|
|
4816
|
-
onClickCopyClipboard:
|
|
4817
|
-
onSmartUploadResult:
|
|
4818
|
-
deleteAllRows:
|
|
5232
|
+
updateState: b,
|
|
5233
|
+
closeModals: x,
|
|
5234
|
+
setModalVisibility: C,
|
|
5235
|
+
readAndParseInput: T,
|
|
5236
|
+
onFileChange: E,
|
|
5237
|
+
onClickQuickPasteFromClipBoard: D,
|
|
5238
|
+
onClickCopyClipboard: O,
|
|
5239
|
+
onSmartUploadResult: k,
|
|
5240
|
+
deleteAllRows: S
|
|
4819
5241
|
};
|
|
4820
5242
|
}, onClickDownLoad = (e, t) => {
|
|
4821
5243
|
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 +5273,167 @@ var initialState = {
|
|
|
4851
5273
|
helpModal: !1
|
|
4852
5274
|
}
|
|
4853
5275
|
};
|
|
4854
|
-
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
|
|
4855
|
-
let { exportData:
|
|
5276
|
+
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n, __validationScopeId: r }) => {
|
|
5277
|
+
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();
|
|
5278
|
+
useRegisterValidationRules(r ?? b, s);
|
|
5279
|
+
let [x, S] = useState(initialState), { modalVisibility: { smartUploadModal: C = !1, reviewPasteModal: w = !1, helpModal: T = !1 } } = x, { enabled: E, prompt: D = "", onClose: O, onError: k, service: A = () => Promise.resolve() } = t ?? {}, j = useTranslationMap(l), M = useExportData(j, i, a), [N, P] = useTransition(), { readAndParseInput: F, updateState: I, closeModals: L, setModalVisibility: R, onFileChange: z, onClickQuickPasteFromClipBoard: B, onClickCopyClipboard: V, onSmartUploadResult: H, deleteAllRows: U } = useDataImportActions({
|
|
4856
5280
|
config: e,
|
|
4857
|
-
state:
|
|
4858
|
-
setState:
|
|
5281
|
+
state: x,
|
|
5282
|
+
setState: S,
|
|
4859
5283
|
smartUploadConfig: t,
|
|
4860
|
-
startTransition:
|
|
5284
|
+
startTransition: P
|
|
4861
5285
|
}) ?? {};
|
|
4862
|
-
useKeyboardEvent("Escape", () =>
|
|
4863
|
-
let
|
|
5286
|
+
useKeyboardEvent("Escape", () => L());
|
|
5287
|
+
let W = d ? [
|
|
4864
5288
|
{
|
|
4865
5289
|
type: "Option",
|
|
4866
|
-
label:
|
|
5290
|
+
label: j("uploadFile"),
|
|
4867
5291
|
upload: !0,
|
|
4868
5292
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
4869
|
-
onChange:
|
|
5293
|
+
onChange: z,
|
|
4870
5294
|
testId: `${n}-option-upload-file`
|
|
4871
5295
|
},
|
|
4872
|
-
...
|
|
5296
|
+
...f ? [{
|
|
4873
5297
|
type: "Option",
|
|
4874
|
-
label:
|
|
4875
|
-
onClick:
|
|
5298
|
+
label: j("quickPasteFromClipboard"),
|
|
5299
|
+
onClick: B,
|
|
4876
5300
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
4877
5301
|
}] : [],
|
|
4878
|
-
...
|
|
5302
|
+
...f ? [{
|
|
4879
5303
|
type: "Option",
|
|
4880
|
-
label:
|
|
4881
|
-
onClick: () =>
|
|
5304
|
+
label: j("pasteWithReview"),
|
|
5305
|
+
onClick: () => R("reviewPasteModal", !w),
|
|
4882
5306
|
testId: `${n}-paste-with-review`
|
|
4883
5307
|
}] : [],
|
|
4884
|
-
...
|
|
5308
|
+
...D && E && t ? [{
|
|
4885
5309
|
type: "Option",
|
|
4886
|
-
label:
|
|
4887
|
-
onClick: () =>
|
|
5310
|
+
label: j("smartUpload_smartUpload"),
|
|
5311
|
+
onClick: () => R("smartUploadModal", !C),
|
|
4888
5312
|
testId: `${n}-smart-upload`
|
|
4889
5313
|
}] : [],
|
|
4890
|
-
...applyModalHandlers(
|
|
4891
|
-
] : [],
|
|
5314
|
+
...applyModalHandlers(v?.importOptions ?? [], x, R)
|
|
5315
|
+
] : [], G = [
|
|
4892
5316
|
{
|
|
4893
5317
|
type: "Option",
|
|
4894
|
-
label:
|
|
5318
|
+
label: j("downloadFile"),
|
|
4895
5319
|
onClick: async () => {
|
|
4896
|
-
let e = await
|
|
4897
|
-
e && e && onClickDownLoad(e,
|
|
5320
|
+
let e = await M();
|
|
5321
|
+
e && e && onClickDownLoad(e, c);
|
|
4898
5322
|
}
|
|
4899
5323
|
},
|
|
4900
|
-
...
|
|
5324
|
+
...u ? [{
|
|
4901
5325
|
type: "Option",
|
|
4902
|
-
label:
|
|
4903
|
-
onClick: () =>
|
|
5326
|
+
label: j("copyToClipboard"),
|
|
5327
|
+
onClick: () => V("dot")
|
|
4904
5328
|
}] : [{
|
|
4905
5329
|
type: "Menu",
|
|
4906
5330
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
4907
5331
|
menu: {
|
|
4908
5332
|
trigger: "Text",
|
|
4909
|
-
label:
|
|
5333
|
+
label: j("copyToClipboard"),
|
|
4910
5334
|
sections: [{
|
|
4911
5335
|
type: "Option",
|
|
4912
|
-
label:
|
|
4913
|
-
onClick: () =>
|
|
5336
|
+
label: j("copyDecimalDot"),
|
|
5337
|
+
onClick: () => V("dot"),
|
|
4914
5338
|
testId: `${n}-option-copy-decimal-dot`
|
|
4915
5339
|
}, {
|
|
4916
5340
|
type: "Option",
|
|
4917
|
-
label:
|
|
4918
|
-
onClick: () =>
|
|
5341
|
+
label: j("copyDecimalComma"),
|
|
5342
|
+
onClick: () => V("comma")
|
|
4919
5343
|
}]
|
|
4920
5344
|
}
|
|
4921
5345
|
}],
|
|
4922
|
-
...applyModalHandlers(
|
|
4923
|
-
],
|
|
5346
|
+
...applyModalHandlers(v?.exportOptions ?? [], x, R)
|
|
5347
|
+
], K = p ? [{
|
|
4924
5348
|
type: "Option",
|
|
4925
|
-
label:
|
|
4926
|
-
onClick: () =>
|
|
5349
|
+
label: j("deleteAllRows"),
|
|
5350
|
+
onClick: () => U(),
|
|
4927
5351
|
testId: `${n}-delete-all-rows`
|
|
4928
|
-
}, ...applyModalHandlers(
|
|
5352
|
+
}, ...applyModalHandlers(v?.deleteOptions ?? [], x, R)] : [], q = m ? [
|
|
4929
5353
|
{ type: "Divider" },
|
|
4930
5354
|
{
|
|
4931
5355
|
type: "Option",
|
|
4932
|
-
label:
|
|
4933
|
-
onClick: () =>
|
|
5356
|
+
label: j("help"),
|
|
5357
|
+
onClick: () => R("helpModal", !T)
|
|
4934
5358
|
},
|
|
4935
|
-
...applyModalHandlers(
|
|
4936
|
-
] : [],
|
|
4937
|
-
...
|
|
4938
|
-
section: [...
|
|
5359
|
+
...applyModalHandlers(v?.helpOptions ?? [], x, R)
|
|
5360
|
+
] : [], J = [
|
|
5361
|
+
...W?.length ? [{
|
|
5362
|
+
section: [...W, ...q],
|
|
4939
5363
|
name: "import-options",
|
|
4940
5364
|
iconName: "upload",
|
|
4941
|
-
tooltip:
|
|
5365
|
+
tooltip: j("import")
|
|
4942
5366
|
}] : [],
|
|
4943
|
-
...
|
|
4944
|
-
section:
|
|
5367
|
+
...G?.length ? [{
|
|
5368
|
+
section: G,
|
|
4945
5369
|
name: "export-options",
|
|
4946
5370
|
iconName: "download",
|
|
4947
|
-
tooltip:
|
|
5371
|
+
tooltip: j("export")
|
|
4948
5372
|
}] : [],
|
|
4949
|
-
...
|
|
4950
|
-
section:
|
|
5373
|
+
...K?.length ? [{
|
|
5374
|
+
section: K,
|
|
4951
5375
|
name: "delete-options",
|
|
4952
5376
|
iconName: "delete",
|
|
4953
|
-
tooltip:
|
|
5377
|
+
tooltip: j("deleteAllRows")
|
|
4954
5378
|
}] : []
|
|
4955
5379
|
];
|
|
4956
5380
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
4957
|
-
|
|
5381
|
+
N && /* @__PURE__ */ jsx(Spinner, {
|
|
4958
5382
|
small: !0,
|
|
4959
5383
|
dark: !0
|
|
4960
5384
|
}),
|
|
4961
|
-
|
|
5385
|
+
J.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
4962
5386
|
sections: e.section,
|
|
4963
5387
|
iconName: e.iconName,
|
|
4964
5388
|
tooltip: e.tooltip,
|
|
4965
5389
|
testId: `data-${e?.name}-menu`
|
|
4966
5390
|
}, t)),
|
|
4967
|
-
|
|
5391
|
+
w && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
4968
5392
|
config: e,
|
|
4969
|
-
state:
|
|
4970
|
-
updateState:
|
|
4971
|
-
setModalVisibility:
|
|
4972
|
-
readAndParseInput:
|
|
4973
|
-
onCloseModal:
|
|
4974
|
-
validationRules:
|
|
4975
|
-
onCompleteImport:
|
|
4976
|
-
prevalidationConfig:
|
|
4977
|
-
t:
|
|
4978
|
-
loading:
|
|
4979
|
-
startTransition:
|
|
5393
|
+
state: x,
|
|
5394
|
+
updateState: I,
|
|
5395
|
+
setModalVisibility: R,
|
|
5396
|
+
readAndParseInput: F,
|
|
5397
|
+
onCloseModal: L,
|
|
5398
|
+
validationRules: s,
|
|
5399
|
+
onCompleteImport: y,
|
|
5400
|
+
prevalidationConfig: o,
|
|
5401
|
+
t: j,
|
|
5402
|
+
loading: N,
|
|
5403
|
+
startTransition: P,
|
|
4980
5404
|
testId: n
|
|
4981
5405
|
}),
|
|
4982
|
-
|
|
4983
|
-
visible:
|
|
4984
|
-
setModalVisibility:
|
|
4985
|
-
validationRules:
|
|
4986
|
-
t:
|
|
5406
|
+
T && /* @__PURE__ */ jsx(HelpModal, {
|
|
5407
|
+
visible: T,
|
|
5408
|
+
setModalVisibility: R,
|
|
5409
|
+
validationRules: s,
|
|
5410
|
+
t: j
|
|
4987
5411
|
}),
|
|
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:
|
|
5412
|
+
E && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
5413
|
+
visible: C,
|
|
5414
|
+
prompt: D,
|
|
5415
|
+
onUpload: A,
|
|
5416
|
+
onCloseModal: () => L({ callback: O }),
|
|
5417
|
+
onComplete: H,
|
|
5418
|
+
onError: k,
|
|
5419
|
+
heading: j("smartUpload_smartUpload"),
|
|
5420
|
+
dialogText: j("smartUpload_description"),
|
|
5421
|
+
fileInputText: j("chooseFile"),
|
|
5422
|
+
fileInputPlaceholder: j("noFileSelected"),
|
|
5423
|
+
uploadText: j("uploadCapitalized"),
|
|
5424
|
+
cancelText: j("cancel"),
|
|
5001
5425
|
testId: n
|
|
5002
5426
|
}),
|
|
5003
5427
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5004
|
-
modals:
|
|
5005
|
-
modalVisibility:
|
|
5006
|
-
onCloseModal:
|
|
5428
|
+
modals: _,
|
|
5429
|
+
modalVisibility: x?.modalVisibility,
|
|
5430
|
+
onCloseModal: L,
|
|
5007
5431
|
testId: n
|
|
5008
5432
|
})
|
|
5009
5433
|
] });
|
|
5010
5434
|
}, FileButton = ({ file: e, accept: t, multi: n, name: r, disabled: i, onChange: a = noop,...o }) => {
|
|
5011
|
-
let
|
|
5012
|
-
i ||
|
|
5435
|
+
let s = useContext(DisabledContext), l = useRef(null), u = () => {
|
|
5436
|
+
i || s || l.current?.click();
|
|
5013
5437
|
}, d = (e) => {
|
|
5014
5438
|
let t = n ? e.target.files : e.target.files?.[0], r = {
|
|
5015
5439
|
...e,
|
|
@@ -5288,15 +5712,15 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5288
5712
|
},
|
|
5289
5713
|
children: e.content
|
|
5290
5714
|
}) : null, ListSubheading = forwardRef(({ item: e, index: t }, n) => {
|
|
5291
|
-
let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick:
|
|
5715
|
+
let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick: s, title: l, name: u, icon: d, testId: f } = e;
|
|
5292
5716
|
return /* @__PURE__ */ jsx("div", {
|
|
5293
5717
|
ref: (e) => {
|
|
5294
5718
|
n && "current" in n && Array.isArray(n.current) && t !== void 0 && (n.current[t] = e);
|
|
5295
5719
|
},
|
|
5296
5720
|
"data-testid": f ?? null,
|
|
5297
|
-
className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "",
|
|
5721
|
+
className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "", s ? list_module_default.action : ""),
|
|
5298
5722
|
onClick: (e) => {
|
|
5299
|
-
|
|
5723
|
+
s && s(e);
|
|
5300
5724
|
},
|
|
5301
5725
|
title: l,
|
|
5302
5726
|
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -5321,7 +5745,7 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5321
5745
|
}) })
|
|
5322
5746
|
});
|
|
5323
5747
|
}), ListRow = forwardRef(({ item: e, index: t, expanding: n, invokeEditOnRowClick: r, draggable: i }, a) => {
|
|
5324
|
-
let o = useContext(DisabledContext),
|
|
5748
|
+
let o = useContext(DisabledContext), s = (e, t, s, c, l, u) => {
|
|
5325
5749
|
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
5750
|
return /* @__PURE__ */ jsx(m, {
|
|
5327
5751
|
href: t.url,
|
|
@@ -5375,16 +5799,16 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5375
5799
|
item: e,
|
|
5376
5800
|
index: t
|
|
5377
5801
|
}, t) : i ? ((e, t) => {
|
|
5378
|
-
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging:
|
|
5802
|
+
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging: c } = useSortable({
|
|
5379
5803
|
id: e.toString(),
|
|
5380
5804
|
animateLayoutChanges: () => !1
|
|
5381
5805
|
}), l = {
|
|
5382
5806
|
transform: CSS.Translate.toString(a),
|
|
5383
5807
|
transition: o,
|
|
5384
|
-
opacity:
|
|
5808
|
+
opacity: c ? 0 : 1
|
|
5385
5809
|
};
|
|
5386
|
-
return
|
|
5387
|
-
})(t, e) :
|
|
5810
|
+
return s(e, t, l, n, r, i);
|
|
5811
|
+
})(t, e) : s(t, e);
|
|
5388
5812
|
}), ListDragWrapper = ({ children: e, draggable: t, list: n, onListReorder: r }) => {
|
|
5389
5813
|
let [i, a] = useState(null), o = (e) => {
|
|
5390
5814
|
a(e.active.id);
|
|
@@ -5417,9 +5841,9 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5417
5841
|
}), document.body)]
|
|
5418
5842
|
}) : e;
|
|
5419
5843
|
}, ListVirtualScrollWrapper = ({ items: e, scrollDetails: t, children: n }) => {
|
|
5420
|
-
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll:
|
|
5844
|
+
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll: o } = t, c = useRef(null), u = useVirtualizer({
|
|
5421
5845
|
count: e.length,
|
|
5422
|
-
getScrollElement: () =>
|
|
5846
|
+
getScrollElement: () => c.current,
|
|
5423
5847
|
estimateSize: useCallback(() => {
|
|
5424
5848
|
let t = 37;
|
|
5425
5849
|
if (e.length > 0) {
|
|
@@ -5441,8 +5865,8 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5441
5865
|
f(t);
|
|
5442
5866
|
}
|
|
5443
5867
|
}, [a]), /* @__PURE__ */ jsx("div", {
|
|
5444
|
-
className: cx(list_module_default.listContent, r ||
|
|
5445
|
-
ref:
|
|
5868
|
+
className: cx(list_module_default.listContent, r || o ? list_module_default.scrollableList : "", i ? list_module_default.hideScrollbar : ""),
|
|
5869
|
+
ref: c,
|
|
5446
5870
|
children: /* @__PURE__ */ jsx("div", {
|
|
5447
5871
|
className: list_module_default.virtualRows,
|
|
5448
5872
|
style: { height: `${u.getTotalSize()}px` },
|
|
@@ -5686,8 +6110,8 @@ var radio_button_module_default = {
|
|
|
5686
6110
|
isInTable: "_isInTable_1fbik_106",
|
|
5687
6111
|
helpIconEnabled: "_helpIconEnabled_1fbik_111"
|
|
5688
6112
|
};
|
|
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
|
|
6113
|
+
const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1, small: a = !1, onChange: o, noMargin: s = !1, testId: c, helpText: l, onClickHelp: u }) => {
|
|
6114
|
+
let d = l || u;
|
|
5691
6115
|
return /* @__PURE__ */ jsxs("div", {
|
|
5692
6116
|
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
6117
|
onClick: o,
|
|
@@ -5703,22 +6127,21 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
5703
6127
|
/* @__PURE__ */ jsx("label", {
|
|
5704
6128
|
"data-name": e,
|
|
5705
6129
|
"data-value": n,
|
|
5706
|
-
style: { textTransform: d },
|
|
5707
6130
|
children: t
|
|
5708
6131
|
}),
|
|
5709
|
-
|
|
6132
|
+
d && /* @__PURE__ */ jsx("div", {
|
|
5710
6133
|
className: radio_button_module_default.helpIconEnabled,
|
|
5711
6134
|
onClick: u,
|
|
5712
6135
|
children: /* @__PURE__ */ jsx(HelpIcon, { text: l })
|
|
5713
6136
|
})
|
|
5714
6137
|
]
|
|
5715
6138
|
});
|
|
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:
|
|
6139
|
+
}, 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" }) => {
|
|
6140
|
+
let m = useContext(DisabledContext), h = f !== void 0, { simpleInputs: g, options: v, selectedOptions: y } = h ? {
|
|
5718
6141
|
simpleInputs: !1,
|
|
5719
6142
|
options: f,
|
|
5720
6143
|
selectedOptions: void 0
|
|
5721
|
-
} : standardizeInputs(n, r), b = h || y == null ? void 0 :
|
|
6144
|
+
} : standardizeInputs(n, r), b = h || y == null ? void 0 : g ? y : y.value, x = h ? d : t;
|
|
5722
6145
|
return /* @__PURE__ */ jsxs("div", {
|
|
5723
6146
|
className: cx(radio_button_module_default.wrapper, u ? radio_button_module_default.inline : null, p === "inline fields" ? radio_button_module_default.inline : null),
|
|
5724
6147
|
children: [d && /* @__PURE__ */ jsx("label", {
|
|
@@ -5733,14 +6156,13 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
5733
6156
|
selected: r,
|
|
5734
6157
|
disabled: a || t.disabled || m,
|
|
5735
6158
|
small: o,
|
|
5736
|
-
noMargin:
|
|
6159
|
+
noMargin: s,
|
|
5737
6160
|
onChange: t.disabled ? void 0 : (n) => {
|
|
5738
6161
|
h ? l(n.target) : (n.target.name = e, n.target.value = t.value.toString(), n.target.label = t.label.toString(), i && i(n));
|
|
5739
6162
|
},
|
|
5740
6163
|
testId: t.testId,
|
|
5741
6164
|
helpText: t.helpText,
|
|
5742
|
-
onClickHelp: t.onClickHelp
|
|
5743
|
-
textTransform: t.textTransform
|
|
6165
|
+
onClickHelp: t.onClickHelp
|
|
5744
6166
|
}, n);
|
|
5745
6167
|
})]
|
|
5746
6168
|
});
|
|
@@ -5810,7 +6232,7 @@ var rich_text_input_module_default = {
|
|
|
5810
6232
|
richTextInput: "_richTextInput_1fb4l_77"
|
|
5811
6233
|
};
|
|
5812
6234
|
const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
|
|
5813
|
-
let o = useContext(DisabledContext),
|
|
6235
|
+
let o = useContext(DisabledContext), s = r || o, { manager: l, state: d, setState: f, getContext: p } = useRemirror({
|
|
5814
6236
|
extensions: () => [
|
|
5815
6237
|
new BoldExtension({}),
|
|
5816
6238
|
new BulletListExtension({}),
|
|
@@ -5827,31 +6249,31 @@ const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disab
|
|
|
5827
6249
|
return useImperativeHandle(a, () => p(), [p]), /* @__PURE__ */ jsx("div", {
|
|
5828
6250
|
className: rich_text_input_module_default.richTextInput,
|
|
5829
6251
|
children: /* @__PURE__ */ jsxs(Remirror, {
|
|
5830
|
-
manager:
|
|
6252
|
+
manager: l,
|
|
5831
6253
|
state: d,
|
|
5832
6254
|
placeholder: e,
|
|
5833
6255
|
onChange: ({ helpers: e, state: n }) => {
|
|
5834
6256
|
let r = e.getMarkdown(n);
|
|
5835
6257
|
t && t(r), f(n);
|
|
5836
6258
|
},
|
|
5837
|
-
editable: !
|
|
6259
|
+
editable: !s,
|
|
5838
6260
|
children: [/* @__PURE__ */ jsx(RichTextToolbar, {
|
|
5839
|
-
disabled:
|
|
6261
|
+
disabled: s,
|
|
5840
6262
|
toolbarComponent: i
|
|
5841
6263
|
}), /* @__PURE__ */ jsx(EditorComponent, {})]
|
|
5842
6264
|
})
|
|
5843
6265
|
});
|
|
5844
6266
|
});
|
|
5845
6267
|
var row_module_default = { row: "_row_n16je_1" };
|
|
5846
|
-
const Row = ({ alignItems: t = "initial", justifyContent: n = "initial", children: r = null, flex:
|
|
6268
|
+
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
6269
|
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
6270
|
return /* @__PURE__ */ jsx("div", {
|
|
5849
6271
|
className: cx(row_module_default.row),
|
|
5850
6272
|
style: {
|
|
5851
6273
|
alignItems: t,
|
|
5852
6274
|
justifyContent: n,
|
|
5853
|
-
flexGrow:
|
|
5854
|
-
flexShrink:
|
|
6275
|
+
flexGrow: i ? 1 : 0,
|
|
6276
|
+
flexShrink: i ? 1 : 0,
|
|
5855
6277
|
flexWrap: u ? "wrap" : "nowrap",
|
|
5856
6278
|
height: o,
|
|
5857
6279
|
marginLeft: `calc(${f} * -0.5)`,
|
|
@@ -6001,7 +6423,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6001
6423
|
}, Content$1 = ({ children: e, activeTabIndex: t, contentPadding: n }) => Array.isArray(e) ? /* @__PURE__ */ jsx("div", {
|
|
6002
6424
|
className: cx(n ? tabs_module_default.contentPadding : ""),
|
|
6003
6425
|
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:
|
|
6426
|
+
}) : null, Tabs = ({ name: e = void 0, options: t = null, children: n = null, value: r = void 0, onChange: i = noop, padding: a = !1, margin: o = !0, contentPadding: s = !0, onChangeTab: l, activeTabIndex: u = void 0, tabs: d = void 0, testId: f }) => {
|
|
6005
6427
|
let p = useContext(DisabledContext), m = l !== void 0, h = n ? n.map((e, t) => ({
|
|
6006
6428
|
value: t,
|
|
6007
6429
|
url: e.props.url,
|
|
@@ -6010,11 +6432,11 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6010
6432
|
disabled: e.props.disabled || p,
|
|
6011
6433
|
badge: e.props.badge,
|
|
6012
6434
|
testId: e.props?.testId && `${e.props.testId}-${t}`
|
|
6013
|
-
})) : t || d, { simpleInputs:
|
|
6435
|
+
})) : t || d, { simpleInputs: g, options: v, selectedOptions: y } = m ? {
|
|
6014
6436
|
simpleInputs: !1,
|
|
6015
6437
|
options: h,
|
|
6016
6438
|
selectedOptions: void 0
|
|
6017
|
-
} : standardizeInputs(h, r), b = m || y == null ? void 0 :
|
|
6439
|
+
} : 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
6440
|
if (m) {
|
|
6019
6441
|
let e = n.key || n.label || null;
|
|
6020
6442
|
l(t, e);
|
|
@@ -6043,7 +6465,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6043
6465
|
children: v.map(w)
|
|
6044
6466
|
}), /* @__PURE__ */ jsx(Content$1, {
|
|
6045
6467
|
activeTabIndex: S ?? 0,
|
|
6046
|
-
contentPadding:
|
|
6468
|
+
contentPadding: s,
|
|
6047
6469
|
children: n
|
|
6048
6470
|
})] }) : null;
|
|
6049
6471
|
}, TextLink = ({ children: e, href: t = void 0, target: n = void 0, testId: r, onClick: i, component: a = "a" }) => /* @__PURE__ */ jsx(a, {
|
|
@@ -6069,7 +6491,7 @@ var textarea_module_default = {
|
|
|
6069
6491
|
small: "_small_q0tl0_116",
|
|
6070
6492
|
monospace: "_monospace_q0tl0_155"
|
|
6071
6493
|
};
|
|
6072
|
-
const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows: i, disabled: a = !1, onChange: o = noop, onKeyPress:
|
|
6494
|
+
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
6495
|
let b = useContext(DisabledContext), x = /* @__PURE__ */ jsx("textarea", {
|
|
6074
6496
|
className: cx(textarea_module_default.textarea, f ? textarea_module_default.error : "", p ? textarea_module_default.warning : "", v ? textarea_module_default.monospace : ""),
|
|
6075
6497
|
name: e,
|
|
@@ -6079,11 +6501,11 @@ const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows:
|
|
|
6079
6501
|
rows: i,
|
|
6080
6502
|
onChange: o,
|
|
6081
6503
|
disabled: a || b,
|
|
6082
|
-
onKeyPress:
|
|
6504
|
+
onKeyPress: s,
|
|
6083
6505
|
onFocus: l,
|
|
6084
6506
|
onBlur: u,
|
|
6085
6507
|
tabIndex: d,
|
|
6086
|
-
style: { resize:
|
|
6508
|
+
style: { resize: g },
|
|
6087
6509
|
"data-error": f || null,
|
|
6088
6510
|
"data-warning": p || null,
|
|
6089
6511
|
"data-testid": y
|
|
@@ -6163,9 +6585,9 @@ const Warning = ({ warning: e }) => /* @__PURE__ */ jsx("div", {
|
|
|
6163
6585
|
let ElementType = /* @__PURE__ */ function(e) {
|
|
6164
6586
|
return e.LINK = "Link", e.BUTTON = "Button", e.MENU = "Menu", e.COMPONENT = "Component", e;
|
|
6165
6587
|
}({});
|
|
6166
|
-
const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, testId: o, component:
|
|
6588
|
+
const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, testId: o, component: s = "a" }) => {
|
|
6167
6589
|
let l = useContext(DisabledContext);
|
|
6168
|
-
return /* @__PURE__ */ jsxs(
|
|
6590
|
+
return /* @__PURE__ */ jsxs(s, {
|
|
6169
6591
|
className: cx(top_bar_module_default.link, i ? top_bar_module_default.active : ""),
|
|
6170
6592
|
href: t || "#",
|
|
6171
6593
|
to: t,
|
|
@@ -6310,16 +6732,16 @@ var tree_module_default = {
|
|
|
6310
6732
|
placeholder: "_placeholder_15yn1_29"
|
|
6311
6733
|
};
|
|
6312
6734
|
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,
|
|
6735
|
+
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
6736
|
e.stopPropagation(), i(l);
|
|
6315
6737
|
}, x = (e) => {
|
|
6316
|
-
e.preventDefault(), e.stopPropagation(), h || (
|
|
6738
|
+
e.preventDefault(), e.stopPropagation(), h || (g(!0), y((/* @__PURE__ */ new Date()).getTime()));
|
|
6317
6739
|
}, S = (e) => {
|
|
6318
|
-
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 &&
|
|
6740
|
+
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 && g(!1);
|
|
6319
6741
|
}, C = (e) => {
|
|
6320
6742
|
e.preventDefault(), e.stopPropagation(), a && !r && (/* @__PURE__ */ new Date()).getTime() - v > 200 && b(e);
|
|
6321
6743
|
}, w = (e) => {
|
|
6322
|
-
e.preventDefault(), e.stopPropagation(),
|
|
6744
|
+
e.preventDefault(), e.stopPropagation(), g(!1), y((/* @__PURE__ */ new Date()).getTime()), c?.(e);
|
|
6323
6745
|
};
|
|
6324
6746
|
return /* @__PURE__ */ jsx("div", {
|
|
6325
6747
|
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 +6969,18 @@ var unit_input_module_default = {
|
|
|
6547
6969
|
predefinedMenuActive: "_predefinedMenuActive_ye9w9_1",
|
|
6548
6970
|
inputWrapper: "_inputWrapper_ye9w9_4"
|
|
6549
6971
|
};
|
|
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:
|
|
6972
|
+
const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUnit: r = !1, error: i = null, left: a = !1, small: o = !1, width: s = "100%", value: 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
6973
|
name: "",
|
|
6552
6974
|
error: null
|
|
6553
6975
|
}), 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
6976
|
let L = useUnitContext(), R = useRunAfterUpdate();
|
|
6555
|
-
typeof
|
|
6556
|
-
let [z = "", B = ""] =
|
|
6977
|
+
typeof c == "number" && (c = `${c}`);
|
|
6978
|
+
let [z = "", B = ""] = c === void 0 ? [] : split(c), V = useMemo(() => getPreferredUnit(u, b || L?.unitTemplate), [
|
|
6557
6979
|
u,
|
|
6558
6980
|
b,
|
|
6559
6981
|
L?.unitTemplate
|
|
6560
|
-
]), H = isKnownUnit(
|
|
6561
|
-
value:
|
|
6982
|
+
]), H = isKnownUnit(c, V), U = d || V || B, W = usePrevious(U), { value: G } = safeConvertValue({
|
|
6983
|
+
value: c,
|
|
6562
6984
|
toUnit: U,
|
|
6563
6985
|
unitkey: u,
|
|
6564
6986
|
defaultFromUnit: B,
|
|
@@ -6569,17 +6991,17 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6569
6991
|
} : {
|
|
6570
6992
|
value: G,
|
|
6571
6993
|
unit: U
|
|
6572
|
-
}),
|
|
6994
|
+
}), J = k || K?.value === void 0, [Y, X] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Xu = !!(O || n), Zu = C && C.find((e) => {
|
|
6573
6995
|
if (!e?.value) return;
|
|
6574
6996
|
if (E) return E === e.valueKey;
|
|
6575
|
-
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n =
|
|
6576
|
-
value: String(
|
|
6997
|
+
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = c } = convertUnit({
|
|
6998
|
+
value: String(c),
|
|
6577
6999
|
unitkey: u,
|
|
6578
7000
|
toUnit: t
|
|
6579
7001
|
});
|
|
6580
7002
|
return withUnit(n, t) === e.value;
|
|
6581
|
-
}),
|
|
6582
|
-
let e =
|
|
7003
|
+
}), Qu = () => {
|
|
7004
|
+
let e = c ?? "", t = K.unit;
|
|
6583
7005
|
if (checkConversion({
|
|
6584
7006
|
value: e,
|
|
6585
7007
|
unitkey: u,
|
|
@@ -6592,9 +7014,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6592
7014
|
return null;
|
|
6593
7015
|
}
|
|
6594
7016
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
6595
|
-
},
|
|
7017
|
+
}, $u = (t) => {
|
|
6596
7018
|
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
|
-
|
|
7019
|
+
m({ target: {
|
|
6598
7020
|
value: s,
|
|
6599
7021
|
name: n
|
|
6600
7022
|
} });
|
|
@@ -6605,7 +7027,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6605
7027
|
}), R(() => {
|
|
6606
7028
|
r.selectionStart = a, r.selectionEnd = a;
|
|
6607
7029
|
});
|
|
6608
|
-
},
|
|
7030
|
+
}, ed = (e, t) => {
|
|
6609
7031
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
6610
7032
|
value: e,
|
|
6611
7033
|
unit: t
|
|
@@ -6616,16 +7038,16 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6616
7038
|
let e, t = "";
|
|
6617
7039
|
if (W !== U) {
|
|
6618
7040
|
let { value: n } = safeConvertValue({
|
|
6619
|
-
value:
|
|
7041
|
+
value: c,
|
|
6620
7042
|
toUnit: U,
|
|
6621
7043
|
unitkey: u,
|
|
6622
7044
|
defaultFromUnit: B,
|
|
6623
7045
|
doNotConvertValue: p
|
|
6624
7046
|
});
|
|
6625
7047
|
e = n, t = U;
|
|
6626
|
-
} else if (withUnit(K.value, K.unit) !==
|
|
7048
|
+
} else if (withUnit(K.value, K.unit) !== c) {
|
|
6627
7049
|
let { value: n } = safeConvertValue({
|
|
6628
|
-
value:
|
|
7050
|
+
value: c,
|
|
6629
7051
|
toUnit: K.unit,
|
|
6630
7052
|
unitkey: u,
|
|
6631
7053
|
defaultFromUnit: B,
|
|
@@ -6636,15 +7058,15 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6636
7058
|
e !== void 0 && q({
|
|
6637
7059
|
value: e,
|
|
6638
7060
|
unit: t
|
|
6639
|
-
}), C &&
|
|
7061
|
+
}), C && X(Zu && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
6640
7062
|
}
|
|
6641
7063
|
}, [
|
|
6642
7064
|
U,
|
|
6643
|
-
|
|
7065
|
+
c,
|
|
6644
7066
|
i,
|
|
6645
7067
|
T
|
|
6646
7068
|
]);
|
|
6647
|
-
let
|
|
7069
|
+
let Z = Qu(), Q = label(K.unit) || K.unit || "", td = p || !Z || Z && Z.length === 1, nd = getStringName(e), $, rd = (t) => {
|
|
6648
7070
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
6649
7071
|
if (checkConversion({
|
|
6650
7072
|
value: r,
|
|
@@ -6664,7 +7086,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6664
7086
|
type: MenuType.OPTION,
|
|
6665
7087
|
inline: !0,
|
|
6666
7088
|
onClick: () => {
|
|
6667
|
-
validateNumber(i).valid && !n && (
|
|
7089
|
+
validateNumber(i).valid && !n && (X(PredefinedOptionsMenuState.PREDEFINED), m({ target: {
|
|
6668
7090
|
value: r,
|
|
6669
7091
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
6670
7092
|
predefinedSelected: !0,
|
|
@@ -6676,25 +7098,25 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6676
7098
|
height: "0"
|
|
6677
7099
|
})] }),
|
|
6678
7100
|
description: o,
|
|
6679
|
-
selected:
|
|
7101
|
+
selected: Zu === t && Y === PredefinedOptionsMenuState.PREDEFINED
|
|
6680
7102
|
};
|
|
6681
7103
|
};
|
|
6682
7104
|
if ($ = [{
|
|
6683
7105
|
type: MenuType.OPTION,
|
|
6684
7106
|
inline: !0,
|
|
6685
7107
|
onClick: () => {
|
|
6686
|
-
|
|
7108
|
+
Y !== PredefinedOptionsMenuState.CUSTOM && !n && m({ target: {
|
|
6687
7109
|
value: withUnit(K.value, K.unit),
|
|
6688
7110
|
name: typeof e == "string" ? e : e?.fieldName || ""
|
|
6689
7111
|
} });
|
|
6690
7112
|
},
|
|
6691
7113
|
label: "Custom",
|
|
6692
|
-
selected:
|
|
7114
|
+
selected: Y === PredefinedOptionsMenuState.CUSTOM
|
|
6693
7115
|
}], C?.length) {
|
|
6694
|
-
let e = C.map(
|
|
7116
|
+
let e = C.map(rd);
|
|
6695
7117
|
$ = [...$, ...e];
|
|
6696
7118
|
}
|
|
6697
|
-
let
|
|
7119
|
+
let id = (e) => {
|
|
6698
7120
|
if (isValueWithUnit(e)) {
|
|
6699
7121
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
6700
7122
|
value: e,
|
|
@@ -6706,9 +7128,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6706
7128
|
return n;
|
|
6707
7129
|
}
|
|
6708
7130
|
return e;
|
|
6709
|
-
},
|
|
7131
|
+
}, ad = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, od = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
6710
7132
|
return /* @__PURE__ */ jsx("div", {
|
|
6711
|
-
className:
|
|
7133
|
+
className: Y === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
6712
7134
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
6713
7135
|
small: o,
|
|
6714
7136
|
width: s,
|
|
@@ -6723,65 +7145,65 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6723
7145
|
trigger: "Component",
|
|
6724
7146
|
component: /* @__PURE__ */ jsx(Button, {
|
|
6725
7147
|
groupOrder: "first",
|
|
6726
|
-
active:
|
|
6727
|
-
icon:
|
|
7148
|
+
active: Y === PredefinedOptionsMenuState.PREDEFINED,
|
|
7149
|
+
icon: Y === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
|
|
6728
7150
|
small: o
|
|
6729
7151
|
}),
|
|
6730
7152
|
small: o,
|
|
6731
7153
|
sections: $
|
|
6732
7154
|
},
|
|
6733
|
-
tooltip:
|
|
7155
|
+
tooltip: Y === PredefinedOptionsMenuState.PREDEFINED ? Zu?.label : ""
|
|
6734
7156
|
}),
|
|
6735
7157
|
/* @__PURE__ */ jsx("div", {
|
|
6736
7158
|
className: unit_input_module_default.inputWrapper,
|
|
6737
7159
|
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
6738
|
-
name:
|
|
7160
|
+
name: nd,
|
|
6739
7161
|
testId: x,
|
|
6740
7162
|
disabled: n,
|
|
6741
|
-
placeholder:
|
|
7163
|
+
placeholder: id(t),
|
|
6742
7164
|
value: K.value,
|
|
6743
|
-
onChange:
|
|
7165
|
+
onChange: $u,
|
|
6744
7166
|
onFocus: v,
|
|
6745
7167
|
error: i === null ? void 0 : i,
|
|
6746
7168
|
warning: S === null ? void 0 : S,
|
|
6747
7169
|
left: a,
|
|
6748
|
-
allowEmpty:
|
|
6749
|
-
validationCallback: (e, t) => D(
|
|
7170
|
+
allowEmpty: J,
|
|
7171
|
+
validationCallback: (e, t) => D(nd, t),
|
|
6750
7172
|
enableCosmeticRounding: j,
|
|
6751
7173
|
enableDisplayRounding: M,
|
|
6752
7174
|
roundDisplayValue: N,
|
|
6753
|
-
groupOrder:
|
|
6754
|
-
disableInternalErrorValidationMessages:
|
|
7175
|
+
groupOrder: ad,
|
|
7176
|
+
disableInternalErrorValidationMessages: Xu,
|
|
6755
7177
|
small: o,
|
|
6756
7178
|
selectOnFocus: P,
|
|
6757
7179
|
tooltip: I
|
|
6758
|
-
},
|
|
7180
|
+
}, nd)
|
|
6759
7181
|
}),
|
|
6760
|
-
|
|
6761
|
-
groupOrder:
|
|
7182
|
+
Q && (td || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
7183
|
+
groupOrder: od,
|
|
6762
7184
|
small: o,
|
|
6763
|
-
children:
|
|
7185
|
+
children: Q
|
|
6764
7186
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6765
|
-
groupOrder:
|
|
7187
|
+
groupOrder: od,
|
|
6766
7188
|
maxHeight: 380,
|
|
6767
7189
|
disabled: r,
|
|
6768
7190
|
testId: x && `${x}-menu`,
|
|
6769
7191
|
tabIndex: -1,
|
|
6770
7192
|
menu: {
|
|
6771
|
-
label:
|
|
7193
|
+
label: Q,
|
|
6772
7194
|
trigger: "DropDownButton",
|
|
6773
7195
|
small: o,
|
|
6774
|
-
sections:
|
|
7196
|
+
sections: Z.map(([e = "", t = "", n]) => {
|
|
6775
7197
|
let r = n || t || "", i = isValidNum(e) ? e : "";
|
|
6776
7198
|
return {
|
|
6777
7199
|
type: "Option",
|
|
6778
7200
|
label: j ? safeRoundNumbers(i) : i,
|
|
6779
7201
|
inline: !0,
|
|
6780
7202
|
onClick: (n) => {
|
|
6781
|
-
n.stopPropagation(),
|
|
7203
|
+
n.stopPropagation(), ed(e, t);
|
|
6782
7204
|
},
|
|
6783
7205
|
description: r,
|
|
6784
|
-
selected: r ===
|
|
7206
|
+
selected: r === Q,
|
|
6785
7207
|
testId: `${x}-unit-${r}`
|
|
6786
7208
|
};
|
|
6787
7209
|
})
|
|
@@ -6894,60 +7316,61 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
|
|
|
6894
7316
|
})
|
|
6895
7317
|
})) : [];
|
|
6896
7318
|
};
|
|
6897
|
-
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder:
|
|
6898
|
-
let { headers:
|
|
6899
|
-
|
|
6900
|
-
...
|
|
7319
|
+
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder: o, beforeRenderRow: c, enableMultiSelect: u = !1 }) => {
|
|
7320
|
+
let { headers: d,...f } = e, { storageUnits: p, preferredUnits: m } = normalizeUnits(t), g = usePrevious(m), [_, v] = useState(m), y = ({ unitKey: e, value: n }) => {
|
|
7321
|
+
v({
|
|
7322
|
+
..._,
|
|
6901
7323
|
[e]: n
|
|
6902
7324
|
});
|
|
6903
7325
|
let r = t.find((t) => t.unitKey === e);
|
|
6904
7326
|
r && typeof r.onChange == "function" && r.onChange({
|
|
6905
|
-
oldUnit:
|
|
7327
|
+
oldUnit: _[e],
|
|
6906
7328
|
newUnit: n,
|
|
6907
7329
|
unitKey: e
|
|
6908
7330
|
});
|
|
6909
|
-
},
|
|
6910
|
-
let a =
|
|
7331
|
+
}, b = useCallback(({ row: e, rowIndex: t }) => {
|
|
7332
|
+
let a = c ? c({
|
|
6911
7333
|
row: e,
|
|
6912
7334
|
rowIndex: t
|
|
6913
7335
|
}) : e;
|
|
6914
7336
|
return convertRow({
|
|
6915
7337
|
row: a,
|
|
6916
7338
|
rowIndex: t,
|
|
6917
|
-
selectedUnits:
|
|
6918
|
-
storageUnits:
|
|
7339
|
+
selectedUnits: _,
|
|
7340
|
+
storageUnits: p,
|
|
6919
7341
|
convertBackToStorageUnit: n,
|
|
6920
7342
|
enableCosmeticRounding: r,
|
|
6921
7343
|
enableDisplayRounding: i
|
|
6922
7344
|
});
|
|
6923
7345
|
}, [
|
|
6924
|
-
|
|
6925
|
-
|
|
7346
|
+
_,
|
|
7347
|
+
p,
|
|
6926
7348
|
n,
|
|
6927
7349
|
r,
|
|
6928
7350
|
i
|
|
6929
7351
|
]);
|
|
6930
7352
|
return useEffect(() => {
|
|
6931
|
-
isEqual(
|
|
6932
|
-
let t =
|
|
6933
|
-
t !== n &&
|
|
7353
|
+
isEqual(m, g) || Object.keys(m).forEach((e) => {
|
|
7354
|
+
let t = g?.[e], n = m[e];
|
|
7355
|
+
t !== n && y({
|
|
6934
7356
|
unitKey: e,
|
|
6935
7357
|
value: n
|
|
6936
7358
|
});
|
|
6937
7359
|
});
|
|
6938
7360
|
}, [t]), /* @__PURE__ */ jsx(Table, {
|
|
6939
7361
|
table: {
|
|
6940
|
-
...
|
|
7362
|
+
...f,
|
|
6941
7363
|
headers: convertHeaderRows({
|
|
6942
7364
|
headers: e.headers,
|
|
6943
|
-
selectedUnits:
|
|
6944
|
-
storageUnits:
|
|
6945
|
-
onChangeUnit:
|
|
7365
|
+
selectedUnits: _,
|
|
7366
|
+
storageUnits: p,
|
|
7367
|
+
onChangeUnit: y
|
|
6946
7368
|
})
|
|
6947
7369
|
},
|
|
6948
7370
|
onListReorder: a,
|
|
6949
|
-
canListReorder:
|
|
6950
|
-
beforeRenderRow:
|
|
7371
|
+
canListReorder: o,
|
|
7372
|
+
beforeRenderRow: b,
|
|
7373
|
+
enableMultiSelect: u
|
|
6951
7374
|
});
|
|
6952
7375
|
};
|
|
6953
7376
|
var setting_field_module_default = { settingField: "_settingField_1x02n_1" };
|
|
@@ -7020,7 +7443,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7020
7443
|
}, [n]);
|
|
7021
7444
|
let s = ({ target: { value: e } }) => {
|
|
7022
7445
|
a(e);
|
|
7023
|
-
}, { added:
|
|
7446
|
+
}, { added: c, removed: u } = renderLinesCount(e, t), d = c + u > 3500;
|
|
7024
7447
|
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Card, {
|
|
7025
7448
|
bordered: !0,
|
|
7026
7449
|
heading: /* @__PURE__ */ jsxs(Flex, {
|
|
@@ -7029,7 +7452,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7029
7452
|
success: !0,
|
|
7030
7453
|
children: [
|
|
7031
7454
|
"+",
|
|
7032
|
-
|
|
7455
|
+
c,
|
|
7033
7456
|
" "
|
|
7034
7457
|
]
|
|
7035
7458
|
}), /* @__PURE__ */ jsxs(Text, {
|
|
@@ -7066,4 +7489,4 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7066
7489
|
}
|
|
7067
7490
|
});
|
|
7068
7491
|
};
|
|
7069
|
-
export { Accordion, AccordionWithDefaultToggle, Actions, Align, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Color, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink,
|
|
7492
|
+
export { Accordion, AccordionWithDefaultToggle, Actions, Align, Badge, Breadcrumb, BreadcrumbLinkType, Button, ButtonGroup, ButtonPosition, ButtonType, Card, CheckBox, Chevron, Color, Column, Dialog, DiffViewer, DisabledContext, Divider, Drawer, ElementType, Empty, Field, FileButton, FileInput, Flex, FormRow, Grid, GroupOrder, Heading, HelpIcon, Icon, IconType, Input, InputGroup, InputGroupAddon, InputReaderMethods, InputType, Label, List, ListHeading, ListSubheading, Loader, Menu, MenuCarat, MenuType, Message, MessageType, Modal, NativeSelect, NumberInput, OptionDropdown, Page, Pagination, PopConfirm, Popover, Portal, PrintHeader, ProgressBar, RadioButton, RichTextInput, Row, Select, SettingField, SideBar, Slider, SmartUploadModal, Spacer, Spinner, Table, TableImportExport, Tabs, Text, TextArea, TextLink, Theme, Toaster, Toggle, Tooltip, TopBar, Tree, TriggerType, UnitInput, UnitTable, dismissToast, initializeContext, initializeGuiLibrary, readFile, toast, useFocus, useKeyboardEvent, useWindowWidth };
|