@oliasoft-open-source/react-ui-library 5.6.4 → 5.6.5-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/global.css +1 -1
- package/dist/index.d.ts +50 -3
- package/dist/index.js +1300 -871
- package/package.json +9 -9
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,12 +385,12 @@ 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 y = useContext(DisabledContext), b =
|
|
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, x && check_box_module_default.disabled, d && check_box_module_default.small, !
|
|
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
396
|
if (!x) {
|
|
@@ -404,7 +404,7 @@ 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
410
|
ref: S,
|
|
@@ -421,12 +421,12 @@ const HelpIcon = ({ text: e, onClick: t, icon: n = "help", active: r = !1, maxWi
|
|
|
421
421
|
children: [/* @__PURE__ */ jsx("span", {
|
|
422
422
|
className: check_box_module_default.checkmark,
|
|
423
423
|
children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHECK })
|
|
424
|
-
}),
|
|
424
|
+
}), s]
|
|
425
425
|
}),
|
|
426
426
|
b && /* @__PURE__ */ jsx("div", {
|
|
427
427
|
className: check_box_module_default.helpIconEnabled,
|
|
428
428
|
onClick: v,
|
|
429
|
-
children: /* @__PURE__ */ jsx(HelpIcon, { text:
|
|
429
|
+
children: /* @__PURE__ */ jsx(HelpIcon, { text: g })
|
|
430
430
|
})
|
|
431
431
|
]
|
|
432
432
|
});
|
|
@@ -526,7 +526,7 @@ var ButtonTooltipWrapper = ({ children: e, tooltip: t = null }) => t ? /* @__PUR
|
|
|
526
526
|
display: "inline-flex",
|
|
527
527
|
children: e
|
|
528
528
|
}) : /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
529
|
-
const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r = !1, ignoreDisabledContext: i = !1, groupOrder: a, icon: o = null, label:
|
|
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 }) => {
|
|
530
530
|
let O = useContext(DisabledContext), k = (() => {
|
|
531
531
|
if (n) switch (n) {
|
|
532
532
|
case Color.DANGER:
|
|
@@ -549,11 +549,11 @@ const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r =
|
|
|
549
549
|
tooltip: C,
|
|
550
550
|
children: /* @__PURE__ */ jsxs(T, {
|
|
551
551
|
type: v === ButtonType.SUBMIT ? ButtonType.SUBMIT : ButtonType.BUTTON,
|
|
552
|
-
className: cx(button_module_default.button, e ? button_module_default.active : "", t ? button_module_default.basic : "", k, j ? button_module_default.disabled : "", (o || l) && !
|
|
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),
|
|
553
553
|
disabled: j,
|
|
554
554
|
name: u ?? "",
|
|
555
555
|
onClick: y,
|
|
556
|
-
...
|
|
556
|
+
...g ? { title: g } : {},
|
|
557
557
|
style: { width: h },
|
|
558
558
|
"data-error": b || null,
|
|
559
559
|
"data-warning": x || null,
|
|
@@ -574,7 +574,7 @@ const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r =
|
|
|
574
574
|
colored: t
|
|
575
575
|
})
|
|
576
576
|
}),
|
|
577
|
-
|
|
577
|
+
s
|
|
578
578
|
]
|
|
579
579
|
})
|
|
580
580
|
});
|
|
@@ -624,7 +624,7 @@ const Heading$3 = ({ label: e, onClick: t, icon: n, testId: r }) => /* @__PURE__
|
|
|
624
624
|
onClick: t,
|
|
625
625
|
children: /* @__PURE__ */ jsx(Icon, { icon: n })
|
|
626
626
|
})]
|
|
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:
|
|
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" }) => {
|
|
628
628
|
let v = (e) => {
|
|
629
629
|
if (e.stopPropagation(), l) {
|
|
630
630
|
e.preventDefault();
|
|
@@ -646,7 +646,7 @@ const Heading$3 = ({ label: e, onClick: t, icon: n, testId: r }) => /* @__PURE__
|
|
|
646
646
|
m?.(n), c?.();
|
|
647
647
|
}
|
|
648
648
|
};
|
|
649
|
-
return /* @__PURE__ */ jsxs(
|
|
649
|
+
return /* @__PURE__ */ jsxs(g, {
|
|
650
650
|
href: n,
|
|
651
651
|
to: n,
|
|
652
652
|
className: cx(menu_module_default.option, l ? menu_module_default.disabled : "", u ? menu_module_default.inline : "", o ? menu_module_default?.selected : ""),
|
|
@@ -740,13 +740,13 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
740
740
|
});
|
|
741
741
|
default: return null;
|
|
742
742
|
}
|
|
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:
|
|
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 }) => {
|
|
744
744
|
if (isValidElement(e)) return /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
745
|
-
let [d, f] = useState(!l?.visible), p = e,
|
|
745
|
+
let [d, f] = useState(!l?.visible), p = e, m = l?.additionalSections?.map((e) => ({
|
|
746
746
|
...e,
|
|
747
747
|
closeOnOptionClick: r,
|
|
748
748
|
visible: !0
|
|
749
|
-
})) ?? [],
|
|
749
|
+
})) ?? [], g = p.length > 4 ? [{
|
|
750
750
|
type: MenuType.OPTION,
|
|
751
751
|
label: d ? l?.showLessTitle || "Show less" : l?.showAllTitle || "Show all",
|
|
752
752
|
onClick: () => f(!d),
|
|
@@ -756,7 +756,7 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
756
756
|
...e,
|
|
757
757
|
visible: !0,
|
|
758
758
|
closeOnOptionClick: r
|
|
759
|
-
} : e).concat(
|
|
759
|
+
} : e).concat(g, m).filter((e) => e?.visible) : p.map((e) => ({
|
|
760
760
|
...e,
|
|
761
761
|
closeOnOptionClick: r
|
|
762
762
|
}));
|
|
@@ -770,7 +770,7 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
770
770
|
children: /* @__PURE__ */ jsx("ul", { children: v.map((e, t) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Section$1, {
|
|
771
771
|
section: e,
|
|
772
772
|
closeOnOptionClick: e.closeOnOptionClick,
|
|
773
|
-
close:
|
|
773
|
+
close: i,
|
|
774
774
|
tree: o,
|
|
775
775
|
path: childPath(s, t),
|
|
776
776
|
maxHeight: c
|
|
@@ -808,7 +808,7 @@ const Badge = ({ children: e, color: t = "", title: n = null, dot: r = !1, margi
|
|
|
808
808
|
children: n
|
|
809
809
|
}), e]
|
|
810
810
|
});
|
|
811
|
-
}, 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 }) => {
|
|
812
812
|
let p = useContext(DisabledContext), m = e === TriggerType.BUTTON ? t : e === TriggerType.DROP_DOWN_BUTTON ? /* @__PURE__ */ jsxs("span", {
|
|
813
813
|
className: menu_module_default.middleAlignedInline,
|
|
814
814
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -829,7 +829,7 @@ const Badge = ({ children: e, color: t = "", title: n = null, dot: r = !1, margi
|
|
|
829
829
|
width: i,
|
|
830
830
|
groupOrder: o,
|
|
831
831
|
onClick: () => {},
|
|
832
|
-
loading:
|
|
832
|
+
loading: s,
|
|
833
833
|
disabled: a,
|
|
834
834
|
error: l,
|
|
835
835
|
warning: u,
|
|
@@ -943,7 +943,7 @@ var isMenuEmpty = (e) => {
|
|
|
943
943
|
testId: d && `${d}-layer`
|
|
944
944
|
})
|
|
945
945
|
})), m];
|
|
946
|
-
}, 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 }) => {
|
|
947
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({
|
|
948
948
|
sections: e.sections,
|
|
949
949
|
width: t,
|
|
@@ -953,7 +953,7 @@ var isMenuEmpty = (e) => {
|
|
|
953
953
|
closeParent: i,
|
|
954
954
|
tree: a,
|
|
955
955
|
path: o,
|
|
956
|
-
groupOrder:
|
|
956
|
+
groupOrder: s,
|
|
957
957
|
overflowContainer: !0,
|
|
958
958
|
maxHeight: void 0,
|
|
959
959
|
testId: l
|
|
@@ -973,11 +973,11 @@ var isMenuEmpty = (e) => {
|
|
|
973
973
|
isNested: !0,
|
|
974
974
|
component: g,
|
|
975
975
|
contextMenu: !0,
|
|
976
|
-
groupOrder:
|
|
976
|
+
groupOrder: s
|
|
977
977
|
}), y]
|
|
978
978
|
});
|
|
979
979
|
};
|
|
980
|
-
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 }) => {
|
|
981
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({
|
|
982
982
|
isOpen: L,
|
|
983
983
|
...placementOptions$1(P, o),
|
|
@@ -1031,11 +1031,11 @@ const DropDownMenu = ({ menu: e, width: t, disabled: n = !1, badgeTitle: r, badg
|
|
|
1031
1031
|
sections: M,
|
|
1032
1032
|
isNested: o,
|
|
1033
1033
|
width: t,
|
|
1034
|
-
closeOnOptionClick:
|
|
1034
|
+
closeOnOptionClick: s,
|
|
1035
1035
|
close: l || z,
|
|
1036
1036
|
tree: u,
|
|
1037
1037
|
path: d,
|
|
1038
|
-
maxHeight:
|
|
1038
|
+
maxHeight: m,
|
|
1039
1039
|
showAllButton: F,
|
|
1040
1040
|
testId: g && `${g}-layer`
|
|
1041
1041
|
})
|
|
@@ -1124,15 +1124,15 @@ var breadcrumb_module_default = {
|
|
|
1124
1124
|
let BreadcrumbLinkType = /* @__PURE__ */ function(e) {
|
|
1125
1125
|
return e.LABEL = "label", e.LINK = "link", e.CUSTOM = "custom", e;
|
|
1126
1126
|
}({});
|
|
1127
|
-
const Link$2 = ({ type: e = BreadcrumbLinkType.LABEL, label: t, url: n, onClick: r, active:
|
|
1128
|
-
let l = useContext(DisabledContext), u = e === BreadcrumbLinkType.LINK && n !== void 0, d = e === BreadcrumbLinkType.CUSTOM && isValidElement(
|
|
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);
|
|
1129
1129
|
return /* @__PURE__ */ jsx("span", {
|
|
1130
1130
|
onClick: r,
|
|
1131
|
-
className: cx(breadcrumb_module_default.labelContainer,
|
|
1131
|
+
className: cx(breadcrumb_module_default.labelContainer, i && breadcrumb_module_default.active, (o || l) && breadcrumb_module_default.disabled),
|
|
1132
1132
|
children: u ? /* @__PURE__ */ jsx("a", {
|
|
1133
1133
|
href: n,
|
|
1134
1134
|
children: t
|
|
1135
|
-
}) : d ?
|
|
1135
|
+
}) : d ? s : t
|
|
1136
1136
|
});
|
|
1137
1137
|
}, Breadcrumb = ({ links: e, small: t = !1 }) => /* @__PURE__ */ jsx("div", {
|
|
1138
1138
|
className: cx(breadcrumb_module_default.breadcrumb, t && breadcrumb_module_default.small),
|
|
@@ -1157,7 +1157,7 @@ var button_group_module_default = {
|
|
|
1157
1157
|
buttonGroup: "_buttonGroup_iu2wi_11"
|
|
1158
1158
|
};
|
|
1159
1159
|
const ButtonGroup = (e) => {
|
|
1160
|
-
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) => {
|
|
1161
1161
|
e.preventDefault(), e.stopPropagation(), !(l || a || u) && i(t, n, r);
|
|
1162
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 = () => {
|
|
1163
1163
|
if (r) return /* @__PURE__ */ jsx("label", {
|
|
@@ -1190,7 +1190,7 @@ const ButtonGroup = (e) => {
|
|
|
1190
1190
|
});
|
|
1191
1191
|
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { children: [v(), /* @__PURE__ */ jsx("div", {
|
|
1192
1192
|
className: button_group_module_default.buttonGroup,
|
|
1193
|
-
"data-testid":
|
|
1193
|
+
"data-testid": s,
|
|
1194
1194
|
children: y()
|
|
1195
1195
|
})] }) });
|
|
1196
1196
|
};
|
|
@@ -1493,16 +1493,16 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1493
1493
|
},
|
|
1494
1494
|
children: e
|
|
1495
1495
|
}) : /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
1496
|
-
}, Drawer = ({ background: e = "var(--color-background-raised)", fixed: t = !1, open: n = !1, setOpen: r, right:
|
|
1497
|
-
let D = u === !0, O = !D && isValidElement(u), [k, A] = r ? [n, r] : D ||
|
|
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;
|
|
1498
1498
|
return /* @__PURE__ */ jsx(DrawerResizeWrapper, {
|
|
1499
1499
|
width: R,
|
|
1500
1500
|
onResize: S,
|
|
1501
1501
|
setOpen: P,
|
|
1502
|
-
right:
|
|
1502
|
+
right: i,
|
|
1503
1503
|
maxOpenWidth: E,
|
|
1504
1504
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1505
|
-
className: cx(drawer_module_default.drawer, c ? drawer_module_default.shadow : "", t ? drawer_module_default.fixed : drawer_module_default.inline,
|
|
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),
|
|
1506
1506
|
style: { top: l },
|
|
1507
1507
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1508
1508
|
className: cx(drawer_module_default.drawerContent, p && drawer_module_default.border),
|
|
@@ -1511,16 +1511,16 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1511
1511
|
borderColor: typeof p == "string" ? p : void 0,
|
|
1512
1512
|
width: R
|
|
1513
1513
|
},
|
|
1514
|
-
children:
|
|
1514
|
+
children: g ? /* @__PURE__ */ jsx(DrawerTabs, {
|
|
1515
1515
|
width: L,
|
|
1516
1516
|
testId: x,
|
|
1517
|
-
tabs:
|
|
1517
|
+
tabs: g,
|
|
1518
1518
|
open: N,
|
|
1519
1519
|
activeTab: F || 0,
|
|
1520
1520
|
background: e,
|
|
1521
1521
|
handleTabClick: (e) => {
|
|
1522
1522
|
let t = (t) => {
|
|
1523
|
-
|
|
1523
|
+
g && t && t(g[e]);
|
|
1524
1524
|
};
|
|
1525
1525
|
F === e && N && P ? (t(w), P(!1)) : !N && P && (t(T), P(!0), S && ((e) => {
|
|
1526
1526
|
let t;
|
|
@@ -1533,21 +1533,21 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1533
1533
|
}
|
|
1534
1534
|
}) : /* @__PURE__ */ jsx("div", {
|
|
1535
1535
|
style: { width: L },
|
|
1536
|
-
children:
|
|
1536
|
+
children: m
|
|
1537
1537
|
})
|
|
1538
1538
|
}), u && /* @__PURE__ */ jsx("span", {
|
|
1539
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),
|
|
1540
1540
|
children: O ? u : /* @__PURE__ */ jsx(Button, {
|
|
1541
1541
|
onClick: P ? () => P(!N) : void 0,
|
|
1542
1542
|
round: !0,
|
|
1543
|
-
icon:
|
|
1543
|
+
icon: i ? IconType.CHEVRON_RIGHT : IconType.CHEVRON_LEFT
|
|
1544
1544
|
})
|
|
1545
1545
|
})]
|
|
1546
1546
|
})
|
|
1547
1547
|
});
|
|
1548
1548
|
};
|
|
1549
1549
|
var input_group_module_default = { inputGroup: "_inputGroup_biuoa_1" }, isDOMTypeElement = (e) => isValidElement(e) && typeof e.type == "string";
|
|
1550
|
-
const InputGroup = ({ children: n, small: r = !1, width:
|
|
1550
|
+
const InputGroup = ({ children: n, small: r = !1, width: i = "100%" }) => {
|
|
1551
1551
|
let o = Array.isArray(n) ? n.filter((e) => isValidElement(e)) : [n], s = o.map((n, i) => {
|
|
1552
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);
|
|
1553
1553
|
return a ? n : /* @__PURE__ */ jsx(Fragment, { children: React.cloneElement(n, {
|
|
@@ -1557,27 +1557,27 @@ const InputGroup = ({ children: n, small: r = !1, width: a = "100%" }) => {
|
|
|
1557
1557
|
});
|
|
1558
1558
|
return /* @__PURE__ */ jsx("div", {
|
|
1559
1559
|
className: cx(input_group_module_default.inputGroup),
|
|
1560
|
-
style: { width:
|
|
1560
|
+
style: { width: i },
|
|
1561
1561
|
children: s
|
|
1562
1562
|
});
|
|
1563
1563
|
};
|
|
1564
1564
|
var input_module_default = {
|
|
1565
|
-
inputInTable: "
|
|
1566
|
-
inputHover: "
|
|
1567
|
-
inputFocus: "
|
|
1568
|
-
inputError: "
|
|
1569
|
-
inputWarning: "
|
|
1570
|
-
inputDisabled: "
|
|
1571
|
-
hideScrollbars: "
|
|
1572
|
-
input: "
|
|
1573
|
-
isInTable: "
|
|
1574
|
-
small: "
|
|
1575
|
-
right: "
|
|
1576
|
-
groupOrderFirst: "
|
|
1577
|
-
groupOrderMiddle: "
|
|
1578
|
-
groupOrderLast: "
|
|
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"
|
|
1579
1579
|
};
|
|
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:
|
|
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) => {
|
|
1581
1581
|
let D = useContext(DisabledContext), O = (() => {
|
|
1582
1582
|
if (S) switch (S) {
|
|
1583
1583
|
case GroupOrder.FIRST: return input_module_default.groupOrderFirst;
|
|
@@ -1598,10 +1598,10 @@ const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, wi
|
|
|
1598
1598
|
display: "block",
|
|
1599
1599
|
children: /* @__PURE__ */ jsx("input", {
|
|
1600
1600
|
ref: E,
|
|
1601
|
-
type:
|
|
1601
|
+
type: g || "text",
|
|
1602
1602
|
size: T || 20,
|
|
1603
1603
|
placeholder: o ?? "",
|
|
1604
|
-
value:
|
|
1604
|
+
value: s ?? "",
|
|
1605
1605
|
onChange: a,
|
|
1606
1606
|
onKeyPress: l,
|
|
1607
1607
|
onKeyDown: p,
|
|
@@ -1620,7 +1620,8 @@ const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, wi
|
|
|
1620
1620
|
style: { width: k },
|
|
1621
1621
|
"data-error": e || null,
|
|
1622
1622
|
"data-warning": x || null,
|
|
1623
|
-
"data-testid": w
|
|
1623
|
+
"data-testid": w,
|
|
1624
|
+
onDragStart: (e) => e.preventDefault()
|
|
1624
1625
|
})
|
|
1625
1626
|
})
|
|
1626
1627
|
});
|
|
@@ -1646,11 +1647,11 @@ var getName = (e, t) => {
|
|
|
1646
1647
|
let n;
|
|
1647
1648
|
return e ? (n = t ? `Selected - ${Object.keys(e)?.length} files` : e?.name, n || null) : null;
|
|
1648
1649
|
};
|
|
1649
|
-
const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No file selected", disabled: r = !1, file: i, accept: a, multi: o, name:
|
|
1650
|
-
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);
|
|
1651
1652
|
return /* @__PURE__ */ jsxs("div", {
|
|
1652
1653
|
onClick: () => {
|
|
1653
|
-
r || f ||
|
|
1654
|
+
r || f || p.current?.click();
|
|
1654
1655
|
},
|
|
1655
1656
|
style: { width: l },
|
|
1656
1657
|
children: [/* @__PURE__ */ jsxs(InputGroup, { children: [/* @__PURE__ */ jsx(Input, {
|
|
@@ -1663,8 +1664,8 @@ const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No
|
|
|
1663
1664
|
disabled: t || r || f,
|
|
1664
1665
|
groupOrder: "last"
|
|
1665
1666
|
})] }), /* @__PURE__ */ jsx("input", {
|
|
1666
|
-
name:
|
|
1667
|
-
ref:
|
|
1667
|
+
name: s,
|
|
1668
|
+
ref: p,
|
|
1668
1669
|
className: file_input_module_default.fileInput,
|
|
1669
1670
|
type: "file",
|
|
1670
1671
|
accept: a,
|
|
@@ -1678,7 +1679,7 @@ const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No
|
|
|
1678
1679
|
name: e.target.name
|
|
1679
1680
|
}
|
|
1680
1681
|
};
|
|
1681
|
-
u(r),
|
|
1682
|
+
u(r), p.current && (p.current.value = "");
|
|
1682
1683
|
},
|
|
1683
1684
|
"data-testid": d
|
|
1684
1685
|
})]
|
|
@@ -1781,7 +1782,7 @@ const ProgressBar = ({ width: e = "auto", inverted: t = !1, colored: n = !0, sho
|
|
|
1781
1782
|
})
|
|
1782
1783
|
});
|
|
1783
1784
|
var REQUEST_TIME = 4e4;
|
|
1784
|
-
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 }) => {
|
|
1785
1786
|
let [_, v] = useState(null), [y, b] = useState(!1), [x, S] = useState(0), C = 0, w = () => {
|
|
1786
1787
|
C += 250, S(C);
|
|
1787
1788
|
}, T = (e) => {
|
|
@@ -1836,7 +1837,7 @@ const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r,
|
|
|
1836
1837
|
disabled: !_ || y,
|
|
1837
1838
|
testId: `${g}-button-upload`
|
|
1838
1839
|
}), /* @__PURE__ */ jsx(Button, {
|
|
1839
|
-
label:
|
|
1840
|
+
label: m || "Cancel",
|
|
1840
1841
|
onClick: k,
|
|
1841
1842
|
testId: `${g}-button-cancel`
|
|
1842
1843
|
})] });
|
|
@@ -1845,7 +1846,7 @@ const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r,
|
|
|
1845
1846
|
centered: !0,
|
|
1846
1847
|
children: /* @__PURE__ */ jsx(Dialog, { dialog: {
|
|
1847
1848
|
scroll: !0,
|
|
1848
|
-
heading:
|
|
1849
|
+
heading: c || "Smart Upload",
|
|
1849
1850
|
content: A,
|
|
1850
1851
|
footer: j,
|
|
1851
1852
|
onClose: k,
|
|
@@ -1986,12 +1987,12 @@ var reducer$1 = (e, t) => {
|
|
|
1986
1987
|
}
|
|
1987
1988
|
};
|
|
1988
1989
|
const Message = ({ message: e }) => {
|
|
1989
|
-
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 });
|
|
1990
1991
|
return /* @__PURE__ */ jsx(Fragment$1, { children: t ? /* @__PURE__ */ jsxs("div", {
|
|
1991
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),
|
|
1992
1993
|
style: {
|
|
1993
1994
|
width: d,
|
|
1994
|
-
maxHeight:
|
|
1995
|
+
maxHeight: f
|
|
1995
1996
|
},
|
|
1996
1997
|
children: [
|
|
1997
1998
|
/* @__PURE__ */ jsx("div", { children: r ? /* @__PURE__ */ jsx("div", {
|
|
@@ -2076,7 +2077,7 @@ var footer_module_default = {
|
|
|
2076
2077
|
groupOrderMiddle: "_groupOrderMiddle_sl2b5_194",
|
|
2077
2078
|
groupOrderLast: "_groupOrderLast_sl2b5_198"
|
|
2078
2079
|
};
|
|
2079
|
-
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 }) => {
|
|
2080
2081
|
let C = useContext(DisabledContext), w = f === null || f?.value === null ? "unselected" : f?.value, T = w === "unselected", E = (w === "unselected" || v ? [/* @__PURE__ */ jsx("option", {
|
|
2081
2082
|
value: "unselected",
|
|
2082
2083
|
disabled: !v,
|
|
@@ -2105,7 +2106,7 @@ const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, to
|
|
|
2105
2106
|
enabled: r && isStringNumberOrNode(r) || t && isStringNumberOrNode(t) || n && isStringNumberOrNode(n) || !1,
|
|
2106
2107
|
maxWidth: x,
|
|
2107
2108
|
children: /* @__PURE__ */ jsx("select", {
|
|
2108
|
-
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),
|
|
2109
2110
|
style: {
|
|
2110
2111
|
width: p || "",
|
|
2111
2112
|
borderRadius: S || ""
|
|
@@ -2115,7 +2116,7 @@ const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, to
|
|
|
2115
2116
|
n = t === "unselected" ? { value: null } : i.find((e) => String(e.value) === String(t)) || { value: null }, a(e, n);
|
|
2116
2117
|
},
|
|
2117
2118
|
onFocus: o,
|
|
2118
|
-
onBlur:
|
|
2119
|
+
onBlur: s,
|
|
2119
2120
|
tabIndex: d,
|
|
2120
2121
|
value: w,
|
|
2121
2122
|
disabled: e || C,
|
|
@@ -2238,10 +2239,10 @@ const getWidestOptionWidth = (e, t, n, r) => {
|
|
|
2238
2239
|
return Math.ceil(i + a);
|
|
2239
2240
|
};
|
|
2240
2241
|
var List$1 = FixedSizeList;
|
|
2241
|
-
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 }) => {
|
|
2242
2243
|
useEffect(() => {
|
|
2243
|
-
|
|
2244
|
-
}, [
|
|
2244
|
+
c != null && e.current !== null && typeof e.current.scrollToItem == "function" && e.current.scrollToItem(c, "start");
|
|
2245
|
+
}, [c, e]);
|
|
2245
2246
|
let f = s ? 24 : 30;
|
|
2246
2247
|
return /* @__PURE__ */ jsx("div", {
|
|
2247
2248
|
"data-testid": d,
|
|
@@ -2301,12 +2302,12 @@ var trigger_module_default = {
|
|
|
2301
2302
|
detailedLabel: "_detailedLabel_7uwhv_307"
|
|
2302
2303
|
};
|
|
2303
2304
|
const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId: r }) => {
|
|
2304
|
-
let i = useFontsReady(), [a, o] = useState([]), [s,
|
|
2305
|
+
let i = useFontsReady(), [a, o] = useState([]), [s, c] = useState([]);
|
|
2305
2306
|
return useEffect(() => {
|
|
2306
2307
|
let r = [], a = [], s = 0;
|
|
2307
2308
|
e.forEach((o, c) => {
|
|
2308
2309
|
s += getMultiOptionWidth(o, t, i), c === e.length - 1 && s < n || s < n - 24 ? r.push(o) : a.push(o);
|
|
2309
|
-
}), o(r),
|
|
2310
|
+
}), o(r), c(a);
|
|
2310
2311
|
}, [
|
|
2311
2312
|
e,
|
|
2312
2313
|
i,
|
|
@@ -2360,7 +2361,7 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
|
|
|
2360
2361
|
"data-testid": c && `${c}-input`
|
|
2361
2362
|
}) : null]
|
|
2362
2363
|
});
|
|
2363
|
-
}, 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 }) => {
|
|
2364
2365
|
let [O, k] = useFocus(), A = Array.isArray(e) ? e.length > 0 && e[0]?.value : e?.value, j = r && A, M = (() => {
|
|
2365
2366
|
if (C) switch (C) {
|
|
2366
2367
|
case GroupOrder.FIRST: return trigger_module_default.groupOrderFirst;
|
|
@@ -2380,7 +2381,7 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
|
|
|
2380
2381
|
} : e, P = /* @__PURE__ */ jsxs(Fragment$1, { children: [a, /* @__PURE__ */ jsxs("div", {
|
|
2381
2382
|
ref: v,
|
|
2382
2383
|
tabIndex: h,
|
|
2383
|
-
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),
|
|
2384
2385
|
onClick: (e) => {
|
|
2385
2386
|
e.stopPropagation(), requestAnimationFrame(() => {
|
|
2386
2387
|
i(e), typeof k == "function" && k();
|
|
@@ -2531,7 +2532,7 @@ let ActionTypes = /* @__PURE__ */ function(e) {
|
|
|
2531
2532
|
}({}), EventKey = /* @__PURE__ */ function(e) {
|
|
2532
2533
|
return e.RIGHT = "ArrowRight", e.LEFT = "ArrowLeft", e.UP = "ArrowUp", e.DOWN = "ArrowDown", e.ENTER = "Enter", e.ESC = "Escape", e.TAB = "Tab", e;
|
|
2533
2534
|
}({});
|
|
2534
|
-
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 }) => {
|
|
2535
2536
|
let b = () => {
|
|
2536
2537
|
e.isLayerOpen && t({ type: ActionTypes.CLOSE_LAYER }), r();
|
|
2537
2538
|
}, x = () => t({ type: ActionTypes.OPEN_LAYER }), S = useRef(!0);
|
|
@@ -2541,21 +2542,21 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2541
2542
|
options: n
|
|
2542
2543
|
});
|
|
2543
2544
|
}, [n]);
|
|
2544
|
-
let C = (e,
|
|
2545
|
+
let C = (e, s, l) => {
|
|
2545
2546
|
if (!(i || a)) {
|
|
2546
|
-
if (
|
|
2547
|
-
if (
|
|
2548
|
-
else if (!
|
|
2549
|
-
let t = u.some((e) => String(e.value) === String(
|
|
2550
|
-
|
|
2551
|
-
} 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);
|
|
2552
2553
|
}
|
|
2553
2554
|
t({
|
|
2554
2555
|
type: ActionTypes.CLEAR_SEARCH,
|
|
2555
2556
|
options: n
|
|
2556
2557
|
}), r();
|
|
2557
2558
|
}
|
|
2558
|
-
}, 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({
|
|
2559
2560
|
isOpen: e?.isLayerOpen ?? !1,
|
|
2560
2561
|
overflowContainer: !0,
|
|
2561
2562
|
...placementOptions,
|
|
@@ -2583,10 +2584,10 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2583
2584
|
}, [e.isLayerOpen]);
|
|
2584
2585
|
let M = (e, t) => {
|
|
2585
2586
|
let n = u instanceof Array ? u.filter((e) => e.value !== t.value) : null;
|
|
2586
|
-
|
|
2587
|
+
c && c(e, n);
|
|
2587
2588
|
}, N = (e) => {
|
|
2588
2589
|
let t = u instanceof Array ? [] : { value: null };
|
|
2589
|
-
|
|
2590
|
+
c && c(e, t);
|
|
2590
2591
|
}, P = (e) => t({
|
|
2591
2592
|
type: ActionTypes.ON_CHANGE_SEARCH,
|
|
2592
2593
|
options: n,
|
|
@@ -2655,7 +2656,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2655
2656
|
triggerBounds: k
|
|
2656
2657
|
};
|
|
2657
2658
|
}, CustomSelect = (e) => {
|
|
2658
|
-
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, {
|
|
2659
2660
|
options: o,
|
|
2660
2661
|
firstSelectedOptionIndex: C
|
|
2661
2662
|
}, ({ options: e }) => ({
|
|
@@ -2680,7 +2681,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2680
2681
|
Object.values(EventKey).includes(e.key) && F(e.key, e);
|
|
2681
2682
|
},
|
|
2682
2683
|
children: [/* @__PURE__ */ jsx(Trigger, {
|
|
2683
|
-
selectedOptions:
|
|
2684
|
+
selectedOptions: s,
|
|
2684
2685
|
searchValue: M.searchValue,
|
|
2685
2686
|
isOpen: M.isLayerOpen,
|
|
2686
2687
|
focusedSelectedOptionIndex: M.triggerFocus.currentOption,
|
|
@@ -2694,7 +2695,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2694
2695
|
isInTable: x,
|
|
2695
2696
|
disabled: n || E,
|
|
2696
2697
|
clearable: v,
|
|
2697
|
-
tabIndex:
|
|
2698
|
+
tabIndex: f,
|
|
2698
2699
|
onClickTrigger: R,
|
|
2699
2700
|
onChangeSearch: z,
|
|
2700
2701
|
onClickDeselect: B,
|
|
@@ -2713,7 +2714,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2713
2714
|
listRef: O,
|
|
2714
2715
|
isMulti: t,
|
|
2715
2716
|
sections: M.visibleOptions,
|
|
2716
|
-
selectedOptions:
|
|
2717
|
+
selectedOptions: s,
|
|
2717
2718
|
onSelectOption: (e, n) => {
|
|
2718
2719
|
G(e, n, t ? void 0 : W);
|
|
2719
2720
|
},
|
|
@@ -2833,11 +2834,11 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2833
2834
|
children: e
|
|
2834
2835
|
});
|
|
2835
2836
|
}, Pagination = ({ pagination: e }) => {
|
|
2836
|
-
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));
|
|
2837
2838
|
useEffect(() => {
|
|
2838
2839
|
f(String(n));
|
|
2839
2840
|
}, [n]);
|
|
2840
|
-
let { error: p } = validateSelectedPage(d, u, o),
|
|
2841
|
+
let { error: p } = validateSelectedPage(d, u, o), m = (e) => {
|
|
2841
2842
|
let { valid: t } = validateSelectedPage(e, u, o);
|
|
2842
2843
|
f(e), t && e !== "" && i && i(Number(e));
|
|
2843
2844
|
};
|
|
@@ -2848,7 +2849,7 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2848
2849
|
style: { flexShrink: 0 },
|
|
2849
2850
|
children: /* @__PURE__ */ jsx(Select, {
|
|
2850
2851
|
onChange: (e) => {
|
|
2851
|
-
a.onChange && a.onChange(e),
|
|
2852
|
+
a.onChange && a.onChange(e), m("1");
|
|
2852
2853
|
},
|
|
2853
2854
|
options: a.options,
|
|
2854
2855
|
native: !!a.options,
|
|
@@ -2862,16 +2863,16 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2862
2863
|
round: !0,
|
|
2863
2864
|
basic: !0,
|
|
2864
2865
|
icon: IconType.CHEVRON_DOUBLE_LEFT,
|
|
2865
|
-
onClick: () =>
|
|
2866
|
-
disabled:
|
|
2866
|
+
onClick: () => m("1"),
|
|
2867
|
+
disabled: c || n === 1
|
|
2867
2868
|
}),
|
|
2868
2869
|
/* @__PURE__ */ jsx(Button, {
|
|
2869
2870
|
small: r,
|
|
2870
2871
|
round: !0,
|
|
2871
2872
|
basic: !0,
|
|
2872
2873
|
icon: IconType.CHEVRON_LEFT,
|
|
2873
|
-
onClick: () =>
|
|
2874
|
-
disabled:
|
|
2874
|
+
onClick: () => m(String(Number(n) - 1)),
|
|
2875
|
+
disabled: c || n === 1
|
|
2875
2876
|
}),
|
|
2876
2877
|
/* @__PURE__ */ jsxs(InputGroup, {
|
|
2877
2878
|
small: r,
|
|
@@ -2880,9 +2881,9 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2880
2881
|
right: !0,
|
|
2881
2882
|
value: d,
|
|
2882
2883
|
placeholder: String(n),
|
|
2883
|
-
onChange: (e) =>
|
|
2884
|
+
onChange: (e) => m(e.target.value),
|
|
2884
2885
|
width: "50px",
|
|
2885
|
-
disabled:
|
|
2886
|
+
disabled: c || u <= 1,
|
|
2886
2887
|
error: p
|
|
2887
2888
|
}), /* @__PURE__ */ jsxs(InputGroupAddon, { children: ["of ", u] })]
|
|
2888
2889
|
}),
|
|
@@ -2891,16 +2892,16 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2891
2892
|
round: !0,
|
|
2892
2893
|
basic: !0,
|
|
2893
2894
|
icon: IconType.CHEVRON_RIGHT,
|
|
2894
|
-
onClick: () =>
|
|
2895
|
-
disabled:
|
|
2895
|
+
onClick: () => m(String(Number(n) + 1)),
|
|
2896
|
+
disabled: c || n === u
|
|
2896
2897
|
}),
|
|
2897
2898
|
/* @__PURE__ */ jsx(Button, {
|
|
2898
2899
|
small: r,
|
|
2899
2900
|
round: !0,
|
|
2900
2901
|
basic: !0,
|
|
2901
2902
|
icon: IconType.CHEVRON_DOUBLE_RIGHT,
|
|
2902
|
-
onClick: () =>
|
|
2903
|
-
disabled:
|
|
2903
|
+
onClick: () => m(String(u)),
|
|
2904
|
+
disabled: c || n === u,
|
|
2904
2905
|
testId: s?.doubleRightBtn
|
|
2905
2906
|
})
|
|
2906
2907
|
]
|
|
@@ -2971,57 +2972,729 @@ const ExpandedContentRow = ({ colSpan: e, children: t, flush: n }) => /* @__PURE
|
|
|
2971
2972
|
return r && t ? e[n] || [] : i ? e : (console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."), []);
|
|
2972
2973
|
};
|
|
2973
2974
|
var cell_module_default = {
|
|
2974
|
-
inputInTable: "
|
|
2975
|
-
inputHover: "
|
|
2976
|
-
inputFocus: "
|
|
2977
|
-
inputError: "
|
|
2978
|
-
inputWarning: "
|
|
2979
|
-
inputDisabled: "
|
|
2980
|
-
hideScrollbars: "
|
|
2981
|
-
cell: "
|
|
2982
|
-
disabledLink: "
|
|
2983
|
-
inputWrapper: "
|
|
2984
|
-
numberInputWrapper: "
|
|
2985
|
-
breakWord: "
|
|
2986
|
-
inputCell: "
|
|
2987
|
-
sliderCell: "
|
|
2988
|
-
staticCell: "
|
|
2989
|
-
staticCellContent: "
|
|
2990
|
-
unit: "
|
|
2991
|
-
sortingCell: "
|
|
2992
|
-
sortingCellIcon: "
|
|
2993
|
-
icon: "
|
|
2994
|
-
checkBoxCell: "
|
|
2995
|
-
iconCellWrapper: "
|
|
2996
|
-
actionsCell: "
|
|
2997
|
-
rightAligned: "
|
|
2998
|
-
centerAligned: "
|
|
2999
|
-
leftAligned: "
|
|
3000
|
-
popover: "
|
|
3001
|
-
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;
|
|
3002
3078
|
};
|
|
3003
|
-
const
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
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));
|
|
3023
3696
|
var getStringName$1 = (e) => e ? typeof e == "string" ? e : isArray(e) ? e[0] : e.fieldName : "";
|
|
3024
|
-
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 }) => {
|
|
3025
3698
|
let O = (e) => {
|
|
3026
3699
|
let n = validateNumber(e), r = t && isEmptyNullOrUndefined(e);
|
|
3027
3700
|
return [Infinity, -Infinity].includes(Number(e)) || r ? {
|
|
@@ -3061,7 +3734,7 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3061
3734
|
name: F
|
|
3062
3735
|
}
|
|
3063
3736
|
};
|
|
3064
|
-
|
|
3737
|
+
c(t);
|
|
3065
3738
|
}
|
|
3066
3739
|
};
|
|
3067
3740
|
useEffect(() => {
|
|
@@ -3099,7 +3772,7 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3099
3772
|
isInTable: x,
|
|
3100
3773
|
groupOrder: S,
|
|
3101
3774
|
selectOnFocus: f,
|
|
3102
|
-
tabIndex:
|
|
3775
|
+
tabIndex: p,
|
|
3103
3776
|
tooltip: _,
|
|
3104
3777
|
ref: A
|
|
3105
3778
|
}, F);
|
|
@@ -3168,14 +3841,14 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3168
3841
|
testId: n
|
|
3169
3842
|
}) : null
|
|
3170
3843
|
}), LinkCell = ({ cell: e, testId: t }) => {
|
|
3171
|
-
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);
|
|
3172
3845
|
return /* @__PURE__ */ jsx("div", {
|
|
3173
3846
|
className: cell_module_default.inputWrapper,
|
|
3174
3847
|
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
3175
3848
|
error: !!r,
|
|
3176
3849
|
warning: !!i,
|
|
3177
3850
|
text: a || r || i,
|
|
3178
|
-
enabled:
|
|
3851
|
+
enabled: s(a) || s(r) || s(i) || !1,
|
|
3179
3852
|
maxWidth: o,
|
|
3180
3853
|
children: /* @__PURE__ */ jsx("div", {
|
|
3181
3854
|
className: cell_module_default.staticCellContent,
|
|
@@ -3218,7 +3891,7 @@ var slider_module_default = {
|
|
|
3218
3891
|
] }),
|
|
3219
3892
|
children: /* @__PURE__ */ jsx("div", { className: slider_module_default.dot })
|
|
3220
3893
|
}), e), {}), isEqual$1);
|
|
3221
|
-
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 = {
|
|
3222
3895
|
enabled: !1,
|
|
3223
3896
|
width: "100px",
|
|
3224
3897
|
height: "400px"
|
|
@@ -3251,13 +3924,13 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3251
3924
|
})
|
|
3252
3925
|
});
|
|
3253
3926
|
return /* @__PURE__ */ jsxs("div", {
|
|
3254
|
-
className: cx(slider_module_default.container, h ? slider_module_default.small : "",
|
|
3255
|
-
style:
|
|
3256
|
-
width:
|
|
3257
|
-
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
|
|
3258
3931
|
} : { width: n },
|
|
3259
3932
|
children: [
|
|
3260
|
-
u && (
|
|
3933
|
+
u && (g.enabled ? /* @__PURE__ */ jsx(C, {}) : /* @__PURE__ */ jsx(S, {})),
|
|
3261
3934
|
/* @__PURE__ */ jsx(RcSlider, {
|
|
3262
3935
|
range: m,
|
|
3263
3936
|
allowCross: !1,
|
|
@@ -3265,11 +3938,11 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3265
3938
|
value: i,
|
|
3266
3939
|
max: o,
|
|
3267
3940
|
min: a,
|
|
3268
|
-
step:
|
|
3941
|
+
step: s,
|
|
3269
3942
|
marks: b,
|
|
3270
3943
|
onChange: (e) => x(e),
|
|
3271
3944
|
disabled: p || y,
|
|
3272
|
-
vertical:
|
|
3945
|
+
vertical: g.enabled,
|
|
3273
3946
|
handleRender: (e, t) => {
|
|
3274
3947
|
let n = d && t.dragging;
|
|
3275
3948
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -3286,7 +3959,7 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
3286
3959
|
});
|
|
3287
3960
|
}
|
|
3288
3961
|
}),
|
|
3289
|
-
u && (
|
|
3962
|
+
u && (g.enabled ? /* @__PURE__ */ jsx(S, {}) : /* @__PURE__ */ jsx(C, {})),
|
|
3290
3963
|
t && /* @__PURE__ */ jsx("label", {
|
|
3291
3964
|
className: slider_module_default.label,
|
|
3292
3965
|
style: { width: r },
|
|
@@ -3327,17 +4000,17 @@ var popover_module_default = {
|
|
|
3327
4000
|
fullWidthStyleFix: "_fullWidthStyleFix_lhie5_8",
|
|
3328
4001
|
dismiss: "_dismiss_lhie5_13"
|
|
3329
4002
|
};
|
|
3330
|
-
const Popover = ({ children: t, content: n, placement: r = "top-center", closeOnOutsideClick: i = !0, fullWidth: a = !1, showCloseButton: o = !1, testId:
|
|
3331
|
-
let
|
|
3332
|
-
!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);
|
|
3333
4006
|
}, b = () => {
|
|
3334
|
-
u ||
|
|
4007
|
+
u || m || v && v(!g);
|
|
3335
4008
|
};
|
|
3336
4009
|
useEffect(() => {
|
|
3337
|
-
(u ||
|
|
3338
|
-
}, [u,
|
|
4010
|
+
(u || m) && y();
|
|
4011
|
+
}, [u, m]);
|
|
3339
4012
|
let { renderLayer: x, arrowProps: S, layerProps: C, triggerProps: w } = useLayer({
|
|
3340
|
-
isOpen:
|
|
4013
|
+
isOpen: g,
|
|
3341
4014
|
placement: r,
|
|
3342
4015
|
auto: !0,
|
|
3343
4016
|
triggerOffset: 6,
|
|
@@ -3348,9 +4021,9 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
|
|
|
3348
4021
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
3349
4022
|
ref: w.ref,
|
|
3350
4023
|
onClick: b,
|
|
3351
|
-
"data-testid":
|
|
4024
|
+
"data-testid": s,
|
|
3352
4025
|
children: t
|
|
3353
|
-
}),
|
|
4026
|
+
}), g && x(/* @__PURE__ */ jsxs("div", {
|
|
3354
4027
|
className: a ? cx(popover_module_default.toggleBox, popover_module_default.fullWidthStyleFix) : cx(popover_module_default.toggleBox),
|
|
3355
4028
|
...C,
|
|
3356
4029
|
children: [/* @__PURE__ */ jsxs("div", { children: [React.isValidElement(n) ? React.cloneElement(n, { close: y }) : n, o && /* @__PURE__ */ jsx("div", {
|
|
@@ -3476,33 +4149,36 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
|
|
|
3476
4149
|
let CellType = /* @__PURE__ */ function(e) {
|
|
3477
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;
|
|
3478
4151
|
}({});
|
|
3479
|
-
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;
|
|
3480
4154
|
if (!e) return null;
|
|
3481
|
-
let { style:
|
|
4155
|
+
let { style: f, colSpan: p, rowSpan: h, width: g } = e, v = useRef(null), y = {
|
|
3482
4156
|
bodyAlignment: r,
|
|
3483
4157
|
headerAlignment: n,
|
|
3484
4158
|
isHeader: t
|
|
3485
|
-
},
|
|
3486
|
-
width:
|
|
3487
|
-
minWidth:
|
|
3488
|
-
textTransform:
|
|
3489
|
-
...
|
|
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
|
|
3490
4164
|
};
|
|
3491
4165
|
return /* @__PURE__ */ jsx(t ? "th" : "td", {
|
|
3492
|
-
ref:
|
|
3493
|
-
className:
|
|
3494
|
-
style:
|
|
3495
|
-
colSpan:
|
|
3496
|
-
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,
|
|
3497
4173
|
children: /* @__PURE__ */ jsx(CellWrapper, {
|
|
3498
4174
|
cell: e,
|
|
3499
|
-
columnAlignment:
|
|
4175
|
+
columnAlignment: x ?? Align.RIGHT,
|
|
3500
4176
|
isHeader: t,
|
|
3501
4177
|
testId: a
|
|
3502
4178
|
})
|
|
3503
4179
|
});
|
|
3504
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 }) => {
|
|
3505
|
-
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) => {
|
|
3506
4182
|
let i = `${n ? 0 : 1}_${t}_${r}`;
|
|
3507
4183
|
return /* @__PURE__ */ jsx(Cell, {
|
|
3508
4184
|
cell: e,
|
|
@@ -3510,14 +4186,18 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3510
4186
|
columnAlignment: o[r],
|
|
3511
4187
|
columnHeaderAlignment: p[r],
|
|
3512
4188
|
width: l ? l[r] : void 0,
|
|
3513
|
-
testId: e.testId
|
|
4189
|
+
testId: e.testId,
|
|
4190
|
+
rowIndex: t,
|
|
4191
|
+
columnIndex: r
|
|
3514
4192
|
}, i);
|
|
3515
4193
|
}), w = s && /* @__PURE__ */ jsx(Cell, {
|
|
3516
4194
|
cell: {
|
|
3517
4195
|
type: CellType.ACTIONS,
|
|
3518
4196
|
actions: e.actions
|
|
3519
4197
|
},
|
|
3520
|
-
isHeader: n
|
|
4198
|
+
isHeader: n,
|
|
4199
|
+
rowIndex: t,
|
|
4200
|
+
columnIndex: r
|
|
3521
4201
|
}, r), { attributes: T, listeners: E, setNodeRef: D, transform: O, transition: k, isDragging: A } = useSortable({
|
|
3522
4202
|
id: t.toString(),
|
|
3523
4203
|
animateLayoutChanges: () => !1
|
|
@@ -3537,10 +4217,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3537
4217
|
});
|
|
3538
4218
|
return n ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
3539
4219
|
onClick: m,
|
|
3540
|
-
onMouseEnter:
|
|
4220
|
+
onMouseEnter: g,
|
|
3541
4221
|
onMouseLeave: v,
|
|
3542
4222
|
onFocus: h,
|
|
3543
|
-
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),
|
|
3544
4224
|
children: [
|
|
3545
4225
|
c ? /* @__PURE__ */ jsx("th", {}) : null,
|
|
3546
4226
|
C,
|
|
@@ -3553,10 +4233,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3553
4233
|
}, `${t}_expanded_content`) : null] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
3554
4234
|
ref: e.noDrag ? null : D,
|
|
3555
4235
|
onClick: m,
|
|
3556
|
-
onMouseEnter:
|
|
4236
|
+
onMouseEnter: g,
|
|
3557
4237
|
onMouseLeave: v,
|
|
3558
4238
|
onFocus: h,
|
|
3559
|
-
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),
|
|
3560
4240
|
"data-error": b || null,
|
|
3561
4241
|
"data-warning": x || null,
|
|
3562
4242
|
"data-index": t,
|
|
@@ -3573,14 +4253,14 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3573
4253
|
children: y.content
|
|
3574
4254
|
}, `${t}_expanded_content`) : null] });
|
|
3575
4255
|
}, TableDragWrapper = (e) => {
|
|
3576
|
-
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]);
|
|
3577
4257
|
return a ? /* @__PURE__ */ jsxs(DndContext, {
|
|
3578
4258
|
collisionDetection: closestCenter,
|
|
3579
4259
|
onDragStart: (e) => {
|
|
3580
4260
|
p(e.active.id);
|
|
3581
4261
|
},
|
|
3582
4262
|
onDragEnd: (e) => {
|
|
3583
|
-
p(null),
|
|
4263
|
+
p(null), g(!1);
|
|
3584
4264
|
let { active: t, over: n } = e;
|
|
3585
4265
|
if (!t || !n || t.id === n.id) return;
|
|
3586
4266
|
let r = Number(t.id), i = Number(n?.id);
|
|
@@ -3597,23 +4277,23 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3597
4277
|
from: r,
|
|
3598
4278
|
to: i
|
|
3599
4279
|
});
|
|
3600
|
-
|
|
4280
|
+
g(a);
|
|
3601
4281
|
},
|
|
3602
4282
|
children: [/* @__PURE__ */ jsx(SortableContext, {
|
|
3603
4283
|
items: v,
|
|
3604
4284
|
strategy: verticalListSortingStrategy,
|
|
3605
|
-
children: t({ dropDisabled:
|
|
3606
|
-
}), !!
|
|
4285
|
+
children: t({ dropDisabled: m })
|
|
4286
|
+
}), !!d && createPortal(/* @__PURE__ */ jsx(DragOverlay, {
|
|
3607
4287
|
dropAnimation: null,
|
|
3608
4288
|
children: /* @__PURE__ */ jsx("table", {
|
|
3609
4289
|
className: cx(table_module_default.table, table_module_default.dragOverlay),
|
|
3610
4290
|
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(Row$1, {
|
|
3611
|
-
rowIndex: Number(
|
|
3612
|
-
row: l[Number(
|
|
4291
|
+
rowIndex: Number(d),
|
|
4292
|
+
row: l[Number(d)],
|
|
3613
4293
|
columnCount: i,
|
|
3614
4294
|
columnWidths: (() => {
|
|
3615
4295
|
if (!u?.current) return [];
|
|
3616
|
-
let e = u.current.querySelectorAll("tr")[Number(
|
|
4296
|
+
let e = u.current.querySelectorAll("tr")[Number(d)]?.querySelectorAll("td");
|
|
3617
4297
|
if (!e) return [];
|
|
3618
4298
|
let t = Array.from(e).map((e) => `${e.getBoundingClientRect().width}px`);
|
|
3619
4299
|
return t.shift(), t;
|
|
@@ -3622,7 +4302,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3622
4302
|
hasRowActions: c,
|
|
3623
4303
|
columnAlignment: r,
|
|
3624
4304
|
draggableTable: a,
|
|
3625
|
-
dropDisabled:
|
|
4305
|
+
dropDisabled: m
|
|
3626
4306
|
}) })
|
|
3627
4307
|
})
|
|
3628
4308
|
}), document.body)]
|
|
@@ -3664,135 +4344,155 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3664
4344
|
className: table_module_default.scroll,
|
|
3665
4345
|
children: n({})
|
|
3666
4346
|
});
|
|
3667
|
-
}, Table = (e) => {
|
|
3668
|
-
let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i } = e, { columnWidths:
|
|
3669
|
-
|
|
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" ? {
|
|
3670
4352
|
...e,
|
|
3671
4353
|
onChange: (e) => {
|
|
3672
4354
|
let n = e?.target?.value, r = {
|
|
3673
|
-
...
|
|
3674
|
-
cells:
|
|
4355
|
+
...y,
|
|
4356
|
+
cells: y.cells.map((e, r) => ({
|
|
3675
4357
|
...e,
|
|
3676
4358
|
value: r === t ? n : e?.value
|
|
3677
4359
|
}))
|
|
3678
4360
|
};
|
|
3679
|
-
|
|
4361
|
+
b({ newRow: r });
|
|
3680
4362
|
}
|
|
3681
4363
|
} : {
|
|
3682
4364
|
...e,
|
|
3683
4365
|
disabled: !0
|
|
3684
4366
|
}) : null,
|
|
3685
|
-
testId:
|
|
3686
|
-
},
|
|
4367
|
+
testId: g ? `${g}-last-empty-row` : void 0
|
|
4368
|
+
}, q = G ? l.concat(K) : l, J = {
|
|
3687
4369
|
...i,
|
|
3688
|
-
rows:
|
|
3689
|
-
},
|
|
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
|
-
|
|
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
|
+
})]
|
|
3770
4470
|
})
|
|
3771
|
-
})
|
|
4471
|
+
})
|
|
3772
4472
|
})
|
|
4473
|
+
}),
|
|
4474
|
+
s && /* @__PURE__ */ jsx(Footer, {
|
|
4475
|
+
pagination: s.pagination,
|
|
4476
|
+
actions: s.actions,
|
|
4477
|
+
content: s.content
|
|
3773
4478
|
})
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
pagination: o.pagination,
|
|
3777
|
-
actions: o.actions,
|
|
3778
|
-
content: o.content
|
|
3779
|
-
})
|
|
3780
|
-
]
|
|
4479
|
+
]
|
|
4480
|
+
})
|
|
3781
4481
|
});
|
|
3782
|
-
}, placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
|
|
4482
|
+
}), placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
|
|
3783
4483
|
let i = `${t} → ${n}:`, a = e.filter((e) => !e.startsWith(i)), o = r ? [...a, `${i} ${r}`] : a, s = o.length === 0;
|
|
3784
4484
|
return {
|
|
3785
4485
|
updatedErrors: o,
|
|
3786
4486
|
isValid: s
|
|
3787
4487
|
};
|
|
3788
4488
|
}, Table$1 = ({ validationRules: e, parsedResult: t, updateState: n, testId: r }) => {
|
|
3789
|
-
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")), {
|
|
3790
4490
|
cells: r.map((r, o) => {
|
|
3791
|
-
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;
|
|
3792
4492
|
return {
|
|
3793
4493
|
name: l,
|
|
3794
4494
|
value: r,
|
|
3795
|
-
type:
|
|
4495
|
+
type: d.current[o] ?? "Input",
|
|
3796
4496
|
disableValidationOnFocus: !0,
|
|
3797
4497
|
error: m,
|
|
3798
4498
|
validationCallback: (e, r) => {
|
|
@@ -3877,12 +4577,12 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3877
4577
|
i,
|
|
3878
4578
|
x,
|
|
3879
4579
|
b
|
|
3880
|
-
]), C = useMemo(() => _.slice(
|
|
4580
|
+
]), C = useMemo(() => _.slice(p, g), [
|
|
3881
4581
|
_,
|
|
3882
|
-
|
|
4582
|
+
p,
|
|
3883
4583
|
g
|
|
3884
4584
|
]), w = useCallback(({ rowIndex: e }) => {
|
|
3885
|
-
let n =
|
|
4585
|
+
let n = p + e, r = t.rows[n];
|
|
3886
4586
|
return r ? y(r, n) : {
|
|
3887
4587
|
cells: [],
|
|
3888
4588
|
actions: []
|
|
@@ -3890,7 +4590,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3890
4590
|
}, [
|
|
3891
4591
|
t.rows,
|
|
3892
4592
|
y,
|
|
3893
|
-
|
|
4593
|
+
p
|
|
3894
4594
|
]);
|
|
3895
4595
|
return /* @__PURE__ */ jsx(Table, {
|
|
3896
4596
|
beforeRenderRow: w,
|
|
@@ -3916,10 +4616,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
3916
4616
|
infiniteScroll: !0,
|
|
3917
4617
|
footer: { pagination: {
|
|
3918
4618
|
rowCount: t.rows.length,
|
|
3919
|
-
selectedPage:
|
|
4619
|
+
selectedPage: c,
|
|
3920
4620
|
rowsPerPage: {
|
|
3921
4621
|
value: a,
|
|
3922
|
-
onChange: (e) =>
|
|
4622
|
+
onChange: (e) => o(Number(e?.target?.value)),
|
|
3923
4623
|
options: [
|
|
3924
4624
|
{
|
|
3925
4625
|
label: "10 / page",
|
|
@@ -4029,210 +4729,7 @@ const Empty = ({ width: e = "auto", height: t = "auto", text: n = "No data", chi
|
|
|
4029
4729
|
}), extraSeparators = (e) => e?.split(/;|\t|\n/)?.some((e) => {
|
|
4030
4730
|
let t = e?.match(/[.,]/g);
|
|
4031
4731
|
return t && t.length > 1;
|
|
4032
|
-
}), hasOneComma = (e) => e?.split(/;|\t|\n/)?.some((e) => !e?.includes(".") && e?.match(/,/g)?.length === 1)
|
|
4033
|
-
var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e && e !== "blank" && e.trim() !== "", validateColumnLength = (e, t, n, r, i, a, o) => {
|
|
4034
|
-
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;
|
|
4035
|
-
if (i && !isValidLength(e.length, l, c) && s.push(o("incorrectNumberOfFieldNameHeaderColumns", { expectedLengthMessage: u })), a) {
|
|
4036
|
-
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;
|
|
4037
|
-
isValidLength(n, e, i) || s.push(o("incorrectNumberOfUnitHeaderColumns", { expectedLengthMessage: u }));
|
|
4038
|
-
}
|
|
4039
|
-
return n.length === 0 ? s.push(o("incorrectNumberOfDataColumns", {
|
|
4040
|
-
expectedLengthMessage: u,
|
|
4041
|
-
dataRowStartIndex: d
|
|
4042
|
-
})) : n.forEach((e, t) => {
|
|
4043
|
-
isValidLength(e.length, l, c) || s.push(o("incorrectNumberOfDataColumns", {
|
|
4044
|
-
expectedLengthMessage: u,
|
|
4045
|
-
dataRowStartIndex: d + t
|
|
4046
|
-
}));
|
|
4047
|
-
}), s;
|
|
4048
|
-
}, normalize = (e) => e.toUpperCase().replace(/\(.*?\)/g, "").replace(/[^A-Z0-9]/g, "").trim(), defaultFieldNameValidator = ({ value: e, defaultAllowedValues: t }) => {
|
|
4049
|
-
let n = normalize(e);
|
|
4050
|
-
return t?.some((e) => normalize(e).includes(n) || n.includes(normalize(e))) ?? !1;
|
|
4051
|
-
}, defaultUnitsValidator = ({ value: e, defaultAllowedValues: t }) => t?.includes(e) ?? !1, validateHeadings = (e, t, n, r, i, a) => {
|
|
4052
|
-
let o = [];
|
|
4053
|
-
if (r) {
|
|
4054
|
-
let r = n.map((e) => e.fieldName).filter(Boolean);
|
|
4055
|
-
e.forEach((i, s) => {
|
|
4056
|
-
let c = n[s];
|
|
4057
|
-
!c || !c?.fieldName || (n[s]?.fieldNameValidator ?? defaultFieldNameValidator)({
|
|
4058
|
-
value: i,
|
|
4059
|
-
defaultAllowedValues: r,
|
|
4060
|
-
columnIndex: s,
|
|
4061
|
-
fields: e,
|
|
4062
|
-
units: t
|
|
4063
|
-
}) || o.push(a("incorrectFieldName", {
|
|
4064
|
-
i: s + 1,
|
|
4065
|
-
correctName: n[s]?.fieldName || a("notExist"),
|
|
4066
|
-
wrongName: i || a("notApplicable")
|
|
4067
|
-
}));
|
|
4068
|
-
});
|
|
4069
|
-
}
|
|
4070
|
-
if (i) {
|
|
4071
|
-
let i = n.map((e) => e?.validUnits), s = r ? 1 : 0;
|
|
4072
|
-
t.forEach((r, c) => {
|
|
4073
|
-
let l = n[c];
|
|
4074
|
-
if (!l) return;
|
|
4075
|
-
let u = l.unitsValidator ?? defaultUnitsValidator, d = i?.[c];
|
|
4076
|
-
u({
|
|
4077
|
-
value: r,
|
|
4078
|
-
defaultAllowedValues: d,
|
|
4079
|
-
columnIndex: c,
|
|
4080
|
-
fields: e,
|
|
4081
|
-
units: t
|
|
4082
|
-
}) || o.push(a("incorrectUnitRow", {
|
|
4083
|
-
unitRowIndex: s,
|
|
4084
|
-
i: c + 1,
|
|
4085
|
-
wrongUnit: r || a("notApplicable"),
|
|
4086
|
-
correctUnit: d?.join(",") || a("notExist")
|
|
4087
|
-
}));
|
|
4088
|
-
});
|
|
4089
|
-
}
|
|
4090
|
-
return o;
|
|
4091
|
-
}, validateValues = (e, t, n) => {
|
|
4092
|
-
let r = [];
|
|
4093
|
-
return e.forEach((e, i) => {
|
|
4094
|
-
e.forEach((e, a) => {
|
|
4095
|
-
let o = t[a];
|
|
4096
|
-
if (!o || !o.validator) return;
|
|
4097
|
-
let s = o.validator(e);
|
|
4098
|
-
s && typeof s == "string" && r.push(`${s} ${n("rowColumn", {
|
|
4099
|
-
rowIndex: i + 2,
|
|
4100
|
-
columnIndex: a
|
|
4101
|
-
})}`);
|
|
4102
|
-
});
|
|
4103
|
-
}), r;
|
|
4104
|
-
};
|
|
4105
|
-
const validate = (e, t, n, r, i, a, o) => {
|
|
4106
|
-
let s = validateColumnLength(e, t, n, r, i, a, o);
|
|
4107
|
-
return s.length === 0 && (s = s.concat(validateHeadings(e, t, r, i, a, o), validateValues(n, r, o))), {
|
|
4108
|
-
isValid: s.length === 0,
|
|
4109
|
-
errors: s
|
|
4110
|
-
};
|
|
4111
|
-
}, hasHeaders = (e, t, n) => {
|
|
4112
|
-
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;
|
|
4113
|
-
return {
|
|
4114
|
-
hasFieldNameHeader: o || i && !s && !l || i && a && !l,
|
|
4115
|
-
hasUnitHeader: s || c || i && a && !s && !l && !u || i && a && !l && !u
|
|
4116
|
-
};
|
|
4117
|
-
}, guessMissingHeaders = (e, { validationRules: t }) => {
|
|
4118
|
-
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);
|
|
4119
|
-
return s || e?.unshift(r), c || e?.splice(1, 0, a), {
|
|
4120
|
-
hasFieldNameHeader: s,
|
|
4121
|
-
hasUnitHeader: c
|
|
4122
|
-
};
|
|
4123
|
-
}, depthRound = (e) => Math.round(e * 100) / 100;
|
|
4124
|
-
var joinArray = (e) => e.join(", ").replace(/,\s*$/, ""), basePapaConfig = {
|
|
4125
|
-
skipEmptyLines: !0,
|
|
4126
|
-
transform: (e) => e?.trim(),
|
|
4127
|
-
delimiter: (e) => {
|
|
4128
|
-
let t = e.substring(0, 200), n = (t.match(/\t/g) ?? []).length, r = (t.match(/;/g) ?? []).length;
|
|
4129
|
-
return n === 0 && r === 0 ? "," : n > r ? " " : ";";
|
|
4130
|
-
}
|
|
4131
|
-
}, allowedMimes = [
|
|
4132
|
-
"text/csv",
|
|
4133
|
-
"text/plain",
|
|
4134
|
-
"application/json",
|
|
4135
|
-
"application/vnd.ms-excel"
|
|
4136
|
-
], isAllowedFileType = (e) => allowedMimes.includes(e.type), isFile = (e) => e instanceof File, isJson = (e) => e.trim().startsWith("["), isCustomJson = (e) => {
|
|
4137
|
-
try {
|
|
4138
|
-
return !!JSON.parse(e)?.path;
|
|
4139
|
-
} catch {
|
|
4140
|
-
return !1;
|
|
4141
|
-
}
|
|
4142
|
-
};
|
|
4143
|
-
const readFile$1 = (e) => new Promise((t, n) => {
|
|
4144
|
-
let r = new FileReader();
|
|
4145
|
-
r.onload = () => t(String(r.result)), r.onerror = n, r.readAsText(e);
|
|
4146
|
-
});
|
|
4147
|
-
var parseJson = async (e, t, n) => {
|
|
4148
|
-
try {
|
|
4149
|
-
let r = JSON.parse(e);
|
|
4150
|
-
return onCompleteParse({
|
|
4151
|
-
data: r,
|
|
4152
|
-
errors: []
|
|
4153
|
-
}, t, n);
|
|
4154
|
-
} catch (e) {
|
|
4155
|
-
throw Error(`${n("jsonParseFailed")} ${e.message}`);
|
|
4156
|
-
}
|
|
4157
|
-
}, parseCustomJson = async (e, t, n) => {
|
|
4158
|
-
try {
|
|
4159
|
-
let r = JSON.parse(e).path.map((e) => [
|
|
4160
|
-
depthRound(e.md),
|
|
4161
|
-
depthRound(e.inclination),
|
|
4162
|
-
depthRound(e.gridAzimuth)
|
|
4163
|
-
]);
|
|
4164
|
-
return r.unshift([
|
|
4165
|
-
"m",
|
|
4166
|
-
"deg",
|
|
4167
|
-
"deg"
|
|
4168
|
-
]), onCompleteParse({
|
|
4169
|
-
data: r,
|
|
4170
|
-
errors: []
|
|
4171
|
-
}, t, n);
|
|
4172
|
-
} catch (e) {
|
|
4173
|
-
throw Error(`${n("jsonParseFailed")} ${e.message}`);
|
|
4174
|
-
}
|
|
4175
|
-
};
|
|
4176
|
-
const replaceWithDot = (e) => e.replace(",", "."), replaceDataCommasWithDots = (e) => e.map((e) => e.map((e) => replaceWithDot(e)));
|
|
4177
|
-
var parseDSV = (e, { importLimit: t,...n }, r) => new Promise((i) => {
|
|
4178
|
-
Papa.parse(e, {
|
|
4179
|
-
...basePapaConfig,
|
|
4180
|
-
preview: t,
|
|
4181
|
-
complete: (e) => {
|
|
4182
|
-
let a = onCompleteParse(e, {
|
|
4183
|
-
importLimit: t,
|
|
4184
|
-
...n
|
|
4185
|
-
}, r);
|
|
4186
|
-
a.rows = replaceDataCommasWithDots(a.rows), i(a);
|
|
4187
|
-
}
|
|
4188
|
-
});
|
|
4189
|
-
});
|
|
4190
|
-
const parse = async (e, t, n) => {
|
|
4191
|
-
let r = {
|
|
4192
|
-
isValid: !1,
|
|
4193
|
-
fields: [],
|
|
4194
|
-
units: [],
|
|
4195
|
-
rows: [],
|
|
4196
|
-
errors: []
|
|
4197
|
-
};
|
|
4198
|
-
try {
|
|
4199
|
-
if (isFile(e) && !isAllowedFileType(e)) return r.errors.push(`${n("wrongFileFormatExpectedOneOf")} ${joinArray(Array.from(allowedMimes))}`), r;
|
|
4200
|
-
let i = isFile(e) ? await readFile$1(e) : e;
|
|
4201
|
-
return isJson(i) ? await parseJson(i, t, n) : isCustomJson(i) ? await parseCustomJson(i, t, n) : await parseDSV(e, t, n);
|
|
4202
|
-
} catch (e) {
|
|
4203
|
-
return r.errors.push(e.message), r;
|
|
4204
|
-
}
|
|
4205
|
-
}, unParse = (e, t, n, r) => {
|
|
4206
|
-
let i = r?.delimiter ?? ",", a = [
|
|
4207
|
-
e,
|
|
4208
|
-
t,
|
|
4209
|
-
...n
|
|
4210
|
-
].filter(Boolean);
|
|
4211
|
-
return Papa.unparse(a, {
|
|
4212
|
-
quotes: !1,
|
|
4213
|
-
header: !0,
|
|
4214
|
-
delimiter: i
|
|
4215
|
-
});
|
|
4216
|
-
};
|
|
4217
|
-
var onCompleteParse = (e, t, n) => {
|
|
4218
|
-
let { data: r, errors: i } = e, a = {
|
|
4219
|
-
isValid: !1,
|
|
4220
|
-
fields: [],
|
|
4221
|
-
units: [],
|
|
4222
|
-
rows: [],
|
|
4223
|
-
errors: i.map((e) => e.message)
|
|
4224
|
-
};
|
|
4225
|
-
if (i.length > 0) return a;
|
|
4226
|
-
let { hasFieldNameHeader: o, hasUnitHeader: s } = guessMissingHeaders(r, t);
|
|
4227
|
-
a.fields = r[0].map((e) => e.trim()), a.units = r[1].map((e) => e.trim()).filter(Boolean), a.rows = r.slice(2);
|
|
4228
|
-
let { validationRules: c } = t;
|
|
4229
|
-
if (c.length) {
|
|
4230
|
-
let { isValid: e, errors: t } = validate(a.fields, a.units, a.rows, c, o, s, n);
|
|
4231
|
-
a.errors.push(...t), a.isValid = e && t.length === 0;
|
|
4232
|
-
} else a.isValid = a.errors.length === 0;
|
|
4233
|
-
return a;
|
|
4234
|
-
};
|
|
4235
|
-
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 = {
|
|
4236
4733
|
type: MessageType.INFO,
|
|
4237
4734
|
content: ""
|
|
4238
4735
|
}, autoClose: n = 6e3, onClose: r }) => {
|
|
@@ -4287,10 +4784,10 @@ var toggle_module_default = {
|
|
|
4287
4784
|
noMargin: "_noMargin_1c9wf_110",
|
|
4288
4785
|
helpIconEnabled: "_helpIconEnabled_1c9wf_113"
|
|
4289
4786
|
};
|
|
4290
|
-
const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, small: a = !1, onChange: o, noMargin:
|
|
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 }) => {
|
|
4291
4788
|
let f = useContext(DisabledContext), p = u || d, m = r || f;
|
|
4292
4789
|
return /* @__PURE__ */ jsxs("div", {
|
|
4293
|
-
className: cx(toggle_module_default.toggle, m ? toggle_module_default.disabled : null, a ? toggle_module_default.small : null,
|
|
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),
|
|
4294
4791
|
style: { display: i },
|
|
4295
4792
|
onClick: (t) => {
|
|
4296
4793
|
m || (t.target.name = e, t.target.checked = !n, t.target.value = !n, o(t));
|
|
@@ -4313,7 +4810,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4313
4810
|
})
|
|
4314
4811
|
]
|
|
4315
4812
|
});
|
|
4316
|
-
}, 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 }) => {
|
|
4317
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({
|
|
4318
4815
|
pastedText: "",
|
|
4319
4816
|
parsedResult: {
|
|
@@ -4334,15 +4831,15 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4334
4831
|
let O = useCallback((t) => {
|
|
4335
4832
|
if (t) {
|
|
4336
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 = {
|
|
4337
|
-
validationRules:
|
|
4834
|
+
validationRules: o,
|
|
4338
4835
|
importLimit: n
|
|
4339
|
-
}, 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);
|
|
4340
4837
|
f(() => D({
|
|
4341
4838
|
parsedResult: {
|
|
4342
4839
|
...N,
|
|
4343
4840
|
rows: t
|
|
4344
4841
|
},
|
|
4345
|
-
pastedText:
|
|
4842
|
+
pastedText: s
|
|
4346
4843
|
})), C.current = E;
|
|
4347
4844
|
} else f(() => {
|
|
4348
4845
|
C.current && D(C.current);
|
|
@@ -4351,7 +4848,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4351
4848
|
}, [
|
|
4352
4849
|
E,
|
|
4353
4850
|
n,
|
|
4354
|
-
|
|
4851
|
+
o
|
|
4355
4852
|
]), k = () => {
|
|
4356
4853
|
D({
|
|
4357
4854
|
pastedText: "",
|
|
@@ -4404,7 +4901,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4404
4901
|
]
|
|
4405
4902
|
}),
|
|
4406
4903
|
_ && /* @__PURE__ */ jsx(Help, {
|
|
4407
|
-
validationRules:
|
|
4904
|
+
validationRules: o,
|
|
4408
4905
|
t: u
|
|
4409
4906
|
}),
|
|
4410
4907
|
R ? /* @__PURE__ */ jsx("div", {
|
|
@@ -4437,7 +4934,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4437
4934
|
},
|
|
4438
4935
|
colored: !0,
|
|
4439
4936
|
loading: d,
|
|
4440
|
-
testId: `${
|
|
4937
|
+
testId: `${p}-paste-from-clipboard-button`
|
|
4441
4938
|
})
|
|
4442
4939
|
]
|
|
4443
4940
|
})
|
|
@@ -4469,7 +4966,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4469
4966
|
} })
|
|
4470
4967
|
]
|
|
4471
4968
|
}), /* @__PURE__ */ jsx(Table$1, {
|
|
4472
|
-
validationRules:
|
|
4969
|
+
validationRules: o,
|
|
4473
4970
|
parsedResult: N,
|
|
4474
4971
|
updateState: (e) => D((t) => ({
|
|
4475
4972
|
...t,
|
|
@@ -4496,7 +4993,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4496
4993
|
onClick: () => f(() => j()),
|
|
4497
4994
|
disabled: R || !F,
|
|
4498
4995
|
loading: d,
|
|
4499
|
-
testId: `${
|
|
4996
|
+
testId: `${p}-paste-with-review-modal-button-okay`
|
|
4500
4997
|
}),
|
|
4501
4998
|
/* @__PURE__ */ jsx(Button, {
|
|
4502
4999
|
label: u("cancel"),
|
|
@@ -4542,75 +5039,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4542
5039
|
return;
|
|
4543
5040
|
}
|
|
4544
5041
|
return t;
|
|
4545
|
-
}, [t, n]),
|
|
4546
|
-
cancel: "Cancel",
|
|
4547
|
-
chooseFile: "Choose file",
|
|
4548
|
-
copyDecimalComma: "Copy (decimal comma)",
|
|
4549
|
-
copyDecimalDot: "Copy (decimal dot)",
|
|
4550
|
-
copyToClipboard: "Copy to clipboard",
|
|
4551
|
-
copiedToClipboard: "Copied to clipboard",
|
|
4552
|
-
deleteAllRows: "Delete all rows",
|
|
4553
|
-
downloadFile: "Download file",
|
|
4554
|
-
export: "Export",
|
|
4555
|
-
help: "Help",
|
|
4556
|
-
import: "Import",
|
|
4557
|
-
noFileSelected: "No file selected",
|
|
4558
|
-
notApplicable: "N/A",
|
|
4559
|
-
notExist: "not exist",
|
|
4560
|
-
okay: "Okay",
|
|
4561
|
-
uploadCapitalized: "Upload",
|
|
4562
|
-
uploadFile: "Upload file",
|
|
4563
|
-
pasteShortcutHint: "You can also press Ctrl+V or Command+V to paste from clipboard",
|
|
4564
|
-
pasteFromClipboard: "Paste from clipboard",
|
|
4565
|
-
clipboardIsEmpty: "Clipboard is empty",
|
|
4566
|
-
clipboardReadFailed: "Unable to read data from clipboard. Check formatting or try Paste with Review.",
|
|
4567
|
-
clipboardReadNotAllowed: "Your browser did not allow reading the clipboard. Upgrade browser or try Paste with Review.",
|
|
4568
|
-
pasteSuccessful: "Paste successful",
|
|
4569
|
-
pasteWithReview: "Paste with review",
|
|
4570
|
-
pasteWithReviewRoundBrackets: "Paste (with review)",
|
|
4571
|
-
quickPasteFromClipboard: "Quick paste from clipboard",
|
|
4572
|
-
unableToCopyToClipboard: "Unable to copy to clipboard",
|
|
4573
|
-
fileParsingFailed: "Failed to read or validate the file. Please check the format and try again.",
|
|
4574
|
-
importWarning: "Large data detected: More than 500 rows have been imported. You can choose to import all or downsample for better performance.",
|
|
4575
|
-
importLimitExceeded: "Import failed: The data exceeds the 5000-row limit. Please reduce the number of rows and try again.",
|
|
4576
|
-
importingData: "Importing data",
|
|
4577
|
-
incorrectFieldName: "Incorrect field name (row 0, column {{i}}: has name {{wrongName}}, but should be {{correctName}})",
|
|
4578
|
-
incorrectNumberOfDataColumns: "Incorrect number of data columns, expected {{expectedLengthMessage}} columns in row {{dataRowStartIndex}}",
|
|
4579
|
-
incorrectNumberOfFieldNameHeaderColumns: "Incorrect number of field name header columns, expected {{expectedLengthMessage}} columns in row 0",
|
|
4580
|
-
incorrectNumberOfUnitHeaderColumns: "Incorrect number of unit header columns, expected {{expectedLengthMessage}} columns in row 1",
|
|
4581
|
-
incorrectUnitRow: "Incorrect unit (row {{unitRowIndex}}, column {{i}}: has unit [{{wrongUnit}}], but should be [{{correctUnit}}])",
|
|
4582
|
-
jsonParseFailed: "JSON parse failed",
|
|
4583
|
-
pasteYourTableDataHereToImportIt: "Paste your table data here to import it",
|
|
4584
|
-
rowColumn: "(row {{rowIndex}}, column {{columnIndex}})",
|
|
4585
|
-
theValuesCanBeSeparatedByDifferentDelimiters: "The values can be separated by different delimiters",
|
|
4586
|
-
unableToImportPleaseCorrectError: "Unable to import - {{rows}} rows have errors. Please correct input data and try again.",
|
|
4587
|
-
unableToPrepareExportData: "Unable to prepare export – see console for details.",
|
|
4588
|
-
validInputForPaste: "Valid input for paste.",
|
|
4589
|
-
wrongFileFormatExpectedOneOf: "Wrong file format: expected one of",
|
|
4590
|
-
youCanImportDataByPastingOrByMessage: "You can import data by pasting (e.g. from a spreadsheet), or by uploading a text file ( .txt or .csv ).",
|
|
4591
|
-
commasAsDecimals: "Comma is treated as a decimal separator when it is the only separator",
|
|
4592
|
-
deletePastedContent: "Delete pasted content",
|
|
4593
|
-
downsampled: "Downsampled",
|
|
4594
|
-
downsampleSuccess: "Successfully downsampled from {{from}} rows to {{to}} rows.",
|
|
4595
|
-
downsampleTooltip: "Reduces number of data rows (decimation) using the Ramer–Douglas–Peucker algorithm.",
|
|
4596
|
-
extraSeparators: "Two or more separators detected. Kept only last one as decimal separator, please control your import results",
|
|
4597
|
-
noDataPastedYet: "No data pasted yet.",
|
|
4598
|
-
semicolonSeparatedValues: "Semicolon-separated values",
|
|
4599
|
-
tabSeparatedValues: "Tab-separated values",
|
|
4600
|
-
examples: "Examples",
|
|
4601
|
-
smartUpload_description: "Upload image and extract table content using a LLM",
|
|
4602
|
-
smartUpload_smartUpload: "Smart Upload",
|
|
4603
|
-
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"
|
|
4604
|
-
}, interpolate = (e, t = {}) => e?.replace(/\{\{(\w+)\}\}/g, (e, n) => t?.[n] === void 0 ? "" : String(t?.[n])), useTranslationMap = (e) => useMemo(() => {
|
|
4605
|
-
let t = Object.keys(enTranslations).reduce((t, n) => {
|
|
4606
|
-
let r = enTranslations?.[n];
|
|
4607
|
-
return t[n] = e?.[n] ?? r, t;
|
|
4608
|
-
}, {});
|
|
4609
|
-
return (e, n) => {
|
|
4610
|
-
let r = t[e];
|
|
4611
|
-
return n ? interpolate(r, n) : r;
|
|
4612
|
-
};
|
|
4613
|
-
}, [e]), normalizeParsedResult = (e) => {
|
|
5042
|
+
}, [t, n]), normalizeParsedResult = (e) => {
|
|
4614
5043
|
let { rows: t } = e, n = Array(t.length);
|
|
4615
5044
|
for (let e = 0; e < t.length; e++) {
|
|
4616
5045
|
let r = t[e], i = Array(r.length);
|
|
@@ -4622,16 +5051,16 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4622
5051
|
rows: n
|
|
4623
5052
|
};
|
|
4624
5053
|
}, useDataImportActions = ({ config: e, state: t, setState: n, smartUploadConfig: r, startTransition: i }) => {
|
|
4625
|
-
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) => {
|
|
4626
5055
|
n((t) => ({
|
|
4627
5056
|
...t,
|
|
4628
5057
|
...e
|
|
4629
5058
|
}));
|
|
4630
|
-
}, [n]),
|
|
5059
|
+
}, [n]), x = useCallback(({ name: e, callback: n } = {}) => {
|
|
4631
5060
|
let r = { ...t.modalVisibility }, i = !e, a = [];
|
|
4632
5061
|
if (i) for (let e of Object.keys(r)) a.push(e), r[e] = !1;
|
|
4633
5062
|
else r?.[e] && (a.push(e), r[e] = !1);
|
|
4634
|
-
a
|
|
5063
|
+
a?.length > 0 && b({
|
|
4635
5064
|
modalVisibility: r,
|
|
4636
5065
|
pastedText: "",
|
|
4637
5066
|
parsedResult: {
|
|
@@ -4641,9 +5070,9 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4641
5070
|
units: [],
|
|
4642
5071
|
errors: []
|
|
4643
5072
|
}
|
|
4644
|
-
}), typeof n == "function" && a
|
|
4645
|
-
}, [t.modalVisibility,
|
|
4646
|
-
i(() =>
|
|
5073
|
+
}), typeof n == "function" && a?.length > 0 && n();
|
|
5074
|
+
}, [t.modalVisibility, b]), S = useCallback(() => {
|
|
5075
|
+
i(() => b({
|
|
4647
5076
|
pastedText: "",
|
|
4648
5077
|
parsedResult: {
|
|
4649
5078
|
isValid: !1,
|
|
@@ -4652,55 +5081,52 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4652
5081
|
units: [],
|
|
4653
5082
|
errors: []
|
|
4654
5083
|
}
|
|
4655
|
-
})),
|
|
4656
|
-
}, [t.modalVisibility,
|
|
4657
|
-
|
|
5084
|
+
})), p && p?.("all");
|
|
5085
|
+
}, [t.modalVisibility, b]), C = useCallback((e, n) => {
|
|
5086
|
+
b({ modalVisibility: {
|
|
4658
5087
|
...t.modalVisibility,
|
|
4659
5088
|
[e]: n
|
|
4660
5089
|
} });
|
|
4661
|
-
}, [t.modalVisibility,
|
|
5090
|
+
}, [t.modalVisibility, b]), w = useCallback(async (e) => {
|
|
4662
5091
|
let t = {
|
|
4663
|
-
validationRules:
|
|
5092
|
+
validationRules: y,
|
|
4664
5093
|
importLimit: c
|
|
4665
|
-
}, n = await
|
|
4666
|
-
if (
|
|
5094
|
+
}, n = await v(e, g), r = normalizeParsedResult(n);
|
|
5095
|
+
if (h && h(m)) {
|
|
4667
5096
|
let { fields: e, units: n, rows: a, isValid: o } = r, s = unParse(e, n ?? [], a, t);
|
|
4668
|
-
return i(() =>
|
|
5097
|
+
return i(() => b({
|
|
4669
5098
|
pastedText: s,
|
|
4670
|
-
parsedResult:
|
|
5099
|
+
parsedResult: m
|
|
4671
5100
|
})), r;
|
|
4672
5101
|
}
|
|
4673
|
-
return i(() =>
|
|
5102
|
+
return i(() => b({
|
|
4674
5103
|
pastedText: e,
|
|
4675
5104
|
parsedResult: r
|
|
4676
5105
|
})), r;
|
|
4677
5106
|
}, [
|
|
4678
|
-
|
|
5107
|
+
y,
|
|
4679
5108
|
c,
|
|
4680
|
-
_,
|
|
4681
5109
|
g,
|
|
4682
5110
|
h,
|
|
4683
|
-
|
|
4684
|
-
|
|
5111
|
+
m,
|
|
5112
|
+
b
|
|
5113
|
+
]), T = useCallback(async (e) => {
|
|
4685
5114
|
let { fromFile: t, showSuccessToast: n = !0 } = e ?? {}, r;
|
|
4686
5115
|
try {
|
|
4687
5116
|
if (r = t ? await t.text() : await navigator.clipboard.readText(), !r) {
|
|
4688
5117
|
transitionToast({ message: {
|
|
4689
5118
|
type: "Error",
|
|
4690
|
-
content:
|
|
5119
|
+
content: g(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed")
|
|
4691
5120
|
} }, i);
|
|
4692
5121
|
return;
|
|
4693
5122
|
}
|
|
4694
|
-
let e = await
|
|
4695
|
-
validationRules: l,
|
|
4696
|
-
importLimit: c
|
|
4697
|
-
}, _), a = normalizeParsedResult(e);
|
|
5123
|
+
let e = await v(r, g), a = normalizeParsedResult(e);
|
|
4698
5124
|
return a?.isValid || transitionToast({ message: {
|
|
4699
5125
|
type: "Error",
|
|
4700
|
-
content:
|
|
5126
|
+
content: g("clipboardReadFailed")
|
|
4701
5127
|
} }, i), n && transitionToast({ message: {
|
|
4702
5128
|
type: "Success",
|
|
4703
|
-
content:
|
|
5129
|
+
content: g("pasteSuccessful")
|
|
4704
5130
|
} }, i), {
|
|
4705
5131
|
pastedText: r,
|
|
4706
5132
|
parsedResult: a
|
|
@@ -4708,78 +5134,78 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4708
5134
|
} catch (e) {
|
|
4709
5135
|
transitionToast({ message: {
|
|
4710
5136
|
type: "Error",
|
|
4711
|
-
content:
|
|
5137
|
+
content: g(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed"),
|
|
4712
5138
|
details: e.message
|
|
4713
5139
|
} }, i);
|
|
4714
5140
|
return;
|
|
4715
5141
|
}
|
|
4716
|
-
}, [
|
|
5142
|
+
}, [y, c]), E = useCallback(async (e) => {
|
|
4717
5143
|
let t = e?.target?.files?.[0];
|
|
4718
5144
|
if (!t) return;
|
|
4719
|
-
let n = await t.text(), r = await
|
|
4720
|
-
r.isValid ? (
|
|
5145
|
+
let n = await t.text(), r = await w(n);
|
|
5146
|
+
r.isValid ? (d || transitionToast({ message: {
|
|
4721
5147
|
type: "Success",
|
|
4722
|
-
content:
|
|
4723
|
-
} }, i), i(() =>
|
|
5148
|
+
content: g("pasteSuccessful")
|
|
5149
|
+
} }, i), i(() => u(r))) : transitionToast({ message: {
|
|
4724
5150
|
type: "Error",
|
|
4725
|
-
content:
|
|
5151
|
+
content: g("fileParsingFailed")
|
|
4726
5152
|
} }, i);
|
|
4727
5153
|
}, [
|
|
4728
|
-
l,
|
|
4729
|
-
c,
|
|
4730
5154
|
y,
|
|
4731
|
-
|
|
4732
|
-
|
|
5155
|
+
c,
|
|
5156
|
+
b,
|
|
5157
|
+
u
|
|
5158
|
+
]), D = useCallback(async (e = !0) => {
|
|
4733
5159
|
try {
|
|
4734
5160
|
let t = await navigator.clipboard.readText();
|
|
4735
5161
|
if (!t) {
|
|
4736
5162
|
transitionToast({ message: {
|
|
4737
5163
|
type: "Error",
|
|
4738
|
-
content:
|
|
5164
|
+
content: g("clipboardIsEmpty")
|
|
4739
5165
|
} }, i);
|
|
4740
5166
|
return;
|
|
4741
5167
|
}
|
|
4742
|
-
let n = await
|
|
5168
|
+
let n = await w(t);
|
|
4743
5169
|
if (!n.isValid) {
|
|
4744
5170
|
transitionToast({ message: {
|
|
4745
5171
|
type: "Error",
|
|
4746
|
-
content:
|
|
5172
|
+
content: g("clipboardReadFailed")
|
|
4747
5173
|
} }, i);
|
|
4748
5174
|
return;
|
|
4749
5175
|
}
|
|
4750
|
-
|
|
5176
|
+
d || transitionToast({ message: {
|
|
4751
5177
|
type: "Success",
|
|
4752
|
-
content:
|
|
4753
|
-
} }, i), e && i(() =>
|
|
5178
|
+
content: g("pasteSuccessful")
|
|
5179
|
+
} }, i), e && i(() => u(n));
|
|
4754
5180
|
} catch {
|
|
4755
5181
|
transitionToast({ message: {
|
|
4756
5182
|
type: "Error",
|
|
4757
|
-
content:
|
|
5183
|
+
content: g("clipboardReadNotAllowed")
|
|
4758
5184
|
} }, i);
|
|
4759
5185
|
}
|
|
4760
5186
|
}, [
|
|
4761
|
-
l,
|
|
4762
|
-
c,
|
|
4763
|
-
_,
|
|
4764
5187
|
y,
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
5188
|
+
c,
|
|
5189
|
+
g,
|
|
5190
|
+
b,
|
|
5191
|
+
u
|
|
5192
|
+
]), O = useCallback(async (e) => {
|
|
5193
|
+
let t = await _();
|
|
4768
5194
|
if (!t) return;
|
|
4769
|
-
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: " " });
|
|
4770
5196
|
try {
|
|
4771
5197
|
await navigator.clipboard.writeText(l), transitionToast({ message: {
|
|
4772
5198
|
type: "Success",
|
|
4773
|
-
content:
|
|
5199
|
+
content: g("copiedToClipboard")
|
|
4774
5200
|
} }, i);
|
|
4775
5201
|
} catch (e) {
|
|
4776
5202
|
transitionToast({ message: {
|
|
4777
5203
|
type: "Error",
|
|
4778
|
-
content:
|
|
5204
|
+
content: g("unableToCopyToClipboard"),
|
|
4779
5205
|
details: e.message
|
|
4780
5206
|
} }, i);
|
|
4781
5207
|
}
|
|
4782
|
-
}, [
|
|
5208
|
+
}, [_, g]), k = useCallback((e) => {
|
|
4783
5209
|
if (!e || e.errorMessage) {
|
|
4784
5210
|
transitionToast({ message: {
|
|
4785
5211
|
type: "Error",
|
|
@@ -4794,24 +5220,24 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4794
5220
|
rows: n.map((e) => Object.values(e)),
|
|
4795
5221
|
errors: []
|
|
4796
5222
|
};
|
|
4797
|
-
i(() =>
|
|
5223
|
+
i(() => b({ parsedResult: a })), i(() => u(a));
|
|
4798
5224
|
let { onComplete: o } = r ?? {};
|
|
4799
|
-
typeof o == "function" && o(a),
|
|
5225
|
+
typeof o == "function" && o(a), x();
|
|
4800
5226
|
}, [
|
|
4801
|
-
|
|
4802
|
-
|
|
5227
|
+
b,
|
|
5228
|
+
u,
|
|
4803
5229
|
r
|
|
4804
5230
|
]);
|
|
4805
5231
|
return {
|
|
4806
|
-
updateState:
|
|
4807
|
-
closeModals:
|
|
4808
|
-
setModalVisibility:
|
|
4809
|
-
readAndParseInput:
|
|
4810
|
-
onFileChange:
|
|
4811
|
-
onClickQuickPasteFromClipBoard:
|
|
4812
|
-
onClickCopyClipboard:
|
|
4813
|
-
onSmartUploadResult:
|
|
4814
|
-
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
|
|
4815
5241
|
};
|
|
4816
5242
|
}, onClickDownLoad = (e, t) => {
|
|
4817
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");
|
|
@@ -4847,165 +5273,167 @@ var initialState = {
|
|
|
4847
5273
|
helpModal: !1
|
|
4848
5274
|
}
|
|
4849
5275
|
};
|
|
4850
|
-
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
|
|
4851
|
-
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({
|
|
4852
5280
|
config: e,
|
|
4853
|
-
state:
|
|
4854
|
-
setState:
|
|
5281
|
+
state: x,
|
|
5282
|
+
setState: S,
|
|
4855
5283
|
smartUploadConfig: t,
|
|
4856
|
-
startTransition:
|
|
5284
|
+
startTransition: P
|
|
4857
5285
|
}) ?? {};
|
|
4858
|
-
useKeyboardEvent("Escape", () =>
|
|
4859
|
-
let
|
|
5286
|
+
useKeyboardEvent("Escape", () => L());
|
|
5287
|
+
let W = d ? [
|
|
4860
5288
|
{
|
|
4861
5289
|
type: "Option",
|
|
4862
|
-
label:
|
|
5290
|
+
label: j("uploadFile"),
|
|
4863
5291
|
upload: !0,
|
|
4864
5292
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
4865
|
-
onChange:
|
|
5293
|
+
onChange: z,
|
|
4866
5294
|
testId: `${n}-option-upload-file`
|
|
4867
5295
|
},
|
|
4868
|
-
...
|
|
5296
|
+
...f ? [{
|
|
4869
5297
|
type: "Option",
|
|
4870
|
-
label:
|
|
4871
|
-
onClick:
|
|
5298
|
+
label: j("quickPasteFromClipboard"),
|
|
5299
|
+
onClick: B,
|
|
4872
5300
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
4873
5301
|
}] : [],
|
|
4874
|
-
...
|
|
5302
|
+
...f ? [{
|
|
4875
5303
|
type: "Option",
|
|
4876
|
-
label:
|
|
4877
|
-
onClick: () =>
|
|
5304
|
+
label: j("pasteWithReview"),
|
|
5305
|
+
onClick: () => R("reviewPasteModal", !w),
|
|
4878
5306
|
testId: `${n}-paste-with-review`
|
|
4879
5307
|
}] : [],
|
|
4880
|
-
...
|
|
5308
|
+
...D && E && t ? [{
|
|
4881
5309
|
type: "Option",
|
|
4882
|
-
label:
|
|
4883
|
-
onClick: () =>
|
|
5310
|
+
label: j("smartUpload_smartUpload"),
|
|
5311
|
+
onClick: () => R("smartUploadModal", !C),
|
|
4884
5312
|
testId: `${n}-smart-upload`
|
|
4885
5313
|
}] : [],
|
|
4886
|
-
...applyModalHandlers(
|
|
4887
|
-
] : [],
|
|
5314
|
+
...applyModalHandlers(v?.importOptions ?? [], x, R)
|
|
5315
|
+
] : [], G = [
|
|
4888
5316
|
{
|
|
4889
5317
|
type: "Option",
|
|
4890
|
-
label:
|
|
5318
|
+
label: j("downloadFile"),
|
|
4891
5319
|
onClick: async () => {
|
|
4892
|
-
let e = await
|
|
4893
|
-
e && e && onClickDownLoad(e,
|
|
5320
|
+
let e = await M();
|
|
5321
|
+
e && e && onClickDownLoad(e, c);
|
|
4894
5322
|
}
|
|
4895
5323
|
},
|
|
4896
|
-
...
|
|
5324
|
+
...u ? [{
|
|
4897
5325
|
type: "Option",
|
|
4898
|
-
label:
|
|
4899
|
-
onClick: () =>
|
|
5326
|
+
label: j("copyToClipboard"),
|
|
5327
|
+
onClick: () => V("dot")
|
|
4900
5328
|
}] : [{
|
|
4901
5329
|
type: "Menu",
|
|
4902
5330
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
4903
5331
|
menu: {
|
|
4904
5332
|
trigger: "Text",
|
|
4905
|
-
label:
|
|
5333
|
+
label: j("copyToClipboard"),
|
|
4906
5334
|
sections: [{
|
|
4907
5335
|
type: "Option",
|
|
4908
|
-
label:
|
|
4909
|
-
onClick: () =>
|
|
5336
|
+
label: j("copyDecimalDot"),
|
|
5337
|
+
onClick: () => V("dot"),
|
|
4910
5338
|
testId: `${n}-option-copy-decimal-dot`
|
|
4911
5339
|
}, {
|
|
4912
5340
|
type: "Option",
|
|
4913
|
-
label:
|
|
4914
|
-
onClick: () =>
|
|
5341
|
+
label: j("copyDecimalComma"),
|
|
5342
|
+
onClick: () => V("comma")
|
|
4915
5343
|
}]
|
|
4916
5344
|
}
|
|
4917
5345
|
}],
|
|
4918
|
-
...applyModalHandlers(
|
|
4919
|
-
],
|
|
5346
|
+
...applyModalHandlers(v?.exportOptions ?? [], x, R)
|
|
5347
|
+
], K = p ? [{
|
|
4920
5348
|
type: "Option",
|
|
4921
|
-
label:
|
|
4922
|
-
onClick: () =>
|
|
5349
|
+
label: j("deleteAllRows"),
|
|
5350
|
+
onClick: () => U(),
|
|
4923
5351
|
testId: `${n}-delete-all-rows`
|
|
4924
|
-
}, ...applyModalHandlers(
|
|
5352
|
+
}, ...applyModalHandlers(v?.deleteOptions ?? [], x, R)] : [], q = m ? [
|
|
4925
5353
|
{ type: "Divider" },
|
|
4926
5354
|
{
|
|
4927
5355
|
type: "Option",
|
|
4928
|
-
label:
|
|
4929
|
-
onClick: () =>
|
|
5356
|
+
label: j("help"),
|
|
5357
|
+
onClick: () => R("helpModal", !T)
|
|
4930
5358
|
},
|
|
4931
|
-
...applyModalHandlers(
|
|
4932
|
-
] : [],
|
|
4933
|
-
...
|
|
4934
|
-
section: [...
|
|
5359
|
+
...applyModalHandlers(v?.helpOptions ?? [], x, R)
|
|
5360
|
+
] : [], J = [
|
|
5361
|
+
...W?.length ? [{
|
|
5362
|
+
section: [...W, ...q],
|
|
4935
5363
|
name: "import-options",
|
|
4936
5364
|
iconName: "upload",
|
|
4937
|
-
tooltip:
|
|
5365
|
+
tooltip: j("import")
|
|
4938
5366
|
}] : [],
|
|
4939
|
-
...
|
|
4940
|
-
section:
|
|
5367
|
+
...G?.length ? [{
|
|
5368
|
+
section: G,
|
|
4941
5369
|
name: "export-options",
|
|
4942
5370
|
iconName: "download",
|
|
4943
|
-
tooltip:
|
|
5371
|
+
tooltip: j("export")
|
|
4944
5372
|
}] : [],
|
|
4945
|
-
...
|
|
4946
|
-
section:
|
|
5373
|
+
...K?.length ? [{
|
|
5374
|
+
section: K,
|
|
4947
5375
|
name: "delete-options",
|
|
4948
5376
|
iconName: "delete",
|
|
4949
|
-
tooltip:
|
|
5377
|
+
tooltip: j("deleteAllRows")
|
|
4950
5378
|
}] : []
|
|
4951
5379
|
];
|
|
4952
5380
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
4953
|
-
|
|
5381
|
+
N && /* @__PURE__ */ jsx(Spinner, {
|
|
4954
5382
|
small: !0,
|
|
4955
5383
|
dark: !0
|
|
4956
5384
|
}),
|
|
4957
|
-
|
|
5385
|
+
J.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
4958
5386
|
sections: e.section,
|
|
4959
5387
|
iconName: e.iconName,
|
|
4960
5388
|
tooltip: e.tooltip,
|
|
4961
5389
|
testId: `data-${e?.name}-menu`
|
|
4962
5390
|
}, t)),
|
|
4963
|
-
|
|
5391
|
+
w && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
4964
5392
|
config: e,
|
|
4965
|
-
state:
|
|
4966
|
-
updateState:
|
|
4967
|
-
setModalVisibility:
|
|
4968
|
-
readAndParseInput:
|
|
4969
|
-
onCloseModal:
|
|
4970
|
-
validationRules:
|
|
4971
|
-
onCompleteImport:
|
|
4972
|
-
prevalidationConfig:
|
|
4973
|
-
t:
|
|
4974
|
-
loading:
|
|
4975
|
-
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,
|
|
4976
5404
|
testId: n
|
|
4977
5405
|
}),
|
|
4978
|
-
|
|
4979
|
-
visible:
|
|
4980
|
-
setModalVisibility:
|
|
4981
|
-
validationRules:
|
|
4982
|
-
t:
|
|
5406
|
+
T && /* @__PURE__ */ jsx(HelpModal, {
|
|
5407
|
+
visible: T,
|
|
5408
|
+
setModalVisibility: R,
|
|
5409
|
+
validationRules: s,
|
|
5410
|
+
t: j
|
|
4983
5411
|
}),
|
|
4984
|
-
|
|
4985
|
-
visible:
|
|
4986
|
-
prompt:
|
|
4987
|
-
onUpload:
|
|
4988
|
-
onCloseModal: () =>
|
|
4989
|
-
onComplete:
|
|
4990
|
-
onError:
|
|
4991
|
-
heading:
|
|
4992
|
-
dialogText:
|
|
4993
|
-
fileInputText:
|
|
4994
|
-
fileInputPlaceholder:
|
|
4995
|
-
uploadText:
|
|
4996
|
-
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"),
|
|
4997
5425
|
testId: n
|
|
4998
5426
|
}),
|
|
4999
5427
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5000
|
-
modals:
|
|
5001
|
-
modalVisibility:
|
|
5002
|
-
onCloseModal:
|
|
5428
|
+
modals: _,
|
|
5429
|
+
modalVisibility: x?.modalVisibility,
|
|
5430
|
+
onCloseModal: L,
|
|
5003
5431
|
testId: n
|
|
5004
5432
|
})
|
|
5005
5433
|
] });
|
|
5006
5434
|
}, FileButton = ({ file: e, accept: t, multi: n, name: r, disabled: i, onChange: a = noop,...o }) => {
|
|
5007
|
-
let
|
|
5008
|
-
i ||
|
|
5435
|
+
let s = useContext(DisabledContext), l = useRef(null), u = () => {
|
|
5436
|
+
i || s || l.current?.click();
|
|
5009
5437
|
}, d = (e) => {
|
|
5010
5438
|
let t = n ? e.target.files : e.target.files?.[0], r = {
|
|
5011
5439
|
...e,
|
|
@@ -5284,15 +5712,15 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5284
5712
|
},
|
|
5285
5713
|
children: e.content
|
|
5286
5714
|
}) : null, ListSubheading = forwardRef(({ item: e, index: t }, n) => {
|
|
5287
|
-
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;
|
|
5288
5716
|
return /* @__PURE__ */ jsx("div", {
|
|
5289
5717
|
ref: (e) => {
|
|
5290
5718
|
n && "current" in n && Array.isArray(n.current) && t !== void 0 && (n.current[t] = e);
|
|
5291
5719
|
},
|
|
5292
5720
|
"data-testid": f ?? null,
|
|
5293
|
-
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 : ""),
|
|
5294
5722
|
onClick: (e) => {
|
|
5295
|
-
|
|
5723
|
+
s && s(e);
|
|
5296
5724
|
},
|
|
5297
5725
|
title: l,
|
|
5298
5726
|
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -5317,7 +5745,7 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5317
5745
|
}) })
|
|
5318
5746
|
});
|
|
5319
5747
|
}), ListRow = forwardRef(({ item: e, index: t, expanding: n, invokeEditOnRowClick: r, draggable: i }, a) => {
|
|
5320
|
-
let o = useContext(DisabledContext),
|
|
5748
|
+
let o = useContext(DisabledContext), s = (e, t, s, c, l, u) => {
|
|
5321
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";
|
|
5322
5750
|
return /* @__PURE__ */ jsx(m, {
|
|
5323
5751
|
href: t.url,
|
|
@@ -5371,16 +5799,16 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5371
5799
|
item: e,
|
|
5372
5800
|
index: t
|
|
5373
5801
|
}, t) : i ? ((e, t) => {
|
|
5374
|
-
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({
|
|
5375
5803
|
id: e.toString(),
|
|
5376
5804
|
animateLayoutChanges: () => !1
|
|
5377
5805
|
}), l = {
|
|
5378
5806
|
transform: CSS.Translate.toString(a),
|
|
5379
5807
|
transition: o,
|
|
5380
|
-
opacity:
|
|
5808
|
+
opacity: c ? 0 : 1
|
|
5381
5809
|
};
|
|
5382
|
-
return
|
|
5383
|
-
})(t, e) :
|
|
5810
|
+
return s(e, t, l, n, r, i);
|
|
5811
|
+
})(t, e) : s(t, e);
|
|
5384
5812
|
}), ListDragWrapper = ({ children: e, draggable: t, list: n, onListReorder: r }) => {
|
|
5385
5813
|
let [i, a] = useState(null), o = (e) => {
|
|
5386
5814
|
a(e.active.id);
|
|
@@ -5413,9 +5841,9 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5413
5841
|
}), document.body)]
|
|
5414
5842
|
}) : e;
|
|
5415
5843
|
}, ListVirtualScrollWrapper = ({ items: e, scrollDetails: t, children: n }) => {
|
|
5416
|
-
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll:
|
|
5844
|
+
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll: o } = t, c = useRef(null), u = useVirtualizer({
|
|
5417
5845
|
count: e.length,
|
|
5418
|
-
getScrollElement: () =>
|
|
5846
|
+
getScrollElement: () => c.current,
|
|
5419
5847
|
estimateSize: useCallback(() => {
|
|
5420
5848
|
let t = 37;
|
|
5421
5849
|
if (e.length > 0) {
|
|
@@ -5437,8 +5865,8 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5437
5865
|
f(t);
|
|
5438
5866
|
}
|
|
5439
5867
|
}, [a]), /* @__PURE__ */ jsx("div", {
|
|
5440
|
-
className: cx(list_module_default.listContent, r ||
|
|
5441
|
-
ref:
|
|
5868
|
+
className: cx(list_module_default.listContent, r || o ? list_module_default.scrollableList : "", i ? list_module_default.hideScrollbar : ""),
|
|
5869
|
+
ref: c,
|
|
5442
5870
|
children: /* @__PURE__ */ jsx("div", {
|
|
5443
5871
|
className: list_module_default.virtualRows,
|
|
5444
5872
|
style: { height: `${u.getTotalSize()}px` },
|
|
@@ -5708,12 +6136,12 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
5708
6136
|
})
|
|
5709
6137
|
]
|
|
5710
6138
|
});
|
|
5711
|
-
}, RadioButton = ({ name: e, label: t, options: n, value: r, onChange: i, disabled: a = !1, small: o = !1, noMargin:
|
|
5712
|
-
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 ? {
|
|
5713
6141
|
simpleInputs: !1,
|
|
5714
6142
|
options: f,
|
|
5715
6143
|
selectedOptions: void 0
|
|
5716
|
-
} : 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;
|
|
5717
6145
|
return /* @__PURE__ */ jsxs("div", {
|
|
5718
6146
|
className: cx(radio_button_module_default.wrapper, u ? radio_button_module_default.inline : null, p === "inline fields" ? radio_button_module_default.inline : null),
|
|
5719
6147
|
children: [d && /* @__PURE__ */ jsx("label", {
|
|
@@ -5728,7 +6156,7 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
5728
6156
|
selected: r,
|
|
5729
6157
|
disabled: a || t.disabled || m,
|
|
5730
6158
|
small: o,
|
|
5731
|
-
noMargin:
|
|
6159
|
+
noMargin: s,
|
|
5732
6160
|
onChange: t.disabled ? void 0 : (n) => {
|
|
5733
6161
|
h ? l(n.target) : (n.target.name = e, n.target.value = t.value.toString(), n.target.label = t.label.toString(), i && i(n));
|
|
5734
6162
|
},
|
|
@@ -5804,7 +6232,7 @@ var rich_text_input_module_default = {
|
|
|
5804
6232
|
richTextInput: "_richTextInput_1fb4l_77"
|
|
5805
6233
|
};
|
|
5806
6234
|
const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
|
|
5807
|
-
let o = useContext(DisabledContext),
|
|
6235
|
+
let o = useContext(DisabledContext), s = r || o, { manager: l, state: d, setState: f, getContext: p } = useRemirror({
|
|
5808
6236
|
extensions: () => [
|
|
5809
6237
|
new BoldExtension({}),
|
|
5810
6238
|
new BulletListExtension({}),
|
|
@@ -5821,31 +6249,31 @@ const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disab
|
|
|
5821
6249
|
return useImperativeHandle(a, () => p(), [p]), /* @__PURE__ */ jsx("div", {
|
|
5822
6250
|
className: rich_text_input_module_default.richTextInput,
|
|
5823
6251
|
children: /* @__PURE__ */ jsxs(Remirror, {
|
|
5824
|
-
manager:
|
|
6252
|
+
manager: l,
|
|
5825
6253
|
state: d,
|
|
5826
6254
|
placeholder: e,
|
|
5827
6255
|
onChange: ({ helpers: e, state: n }) => {
|
|
5828
6256
|
let r = e.getMarkdown(n);
|
|
5829
6257
|
t && t(r), f(n);
|
|
5830
6258
|
},
|
|
5831
|
-
editable: !
|
|
6259
|
+
editable: !s,
|
|
5832
6260
|
children: [/* @__PURE__ */ jsx(RichTextToolbar, {
|
|
5833
|
-
disabled:
|
|
6261
|
+
disabled: s,
|
|
5834
6262
|
toolbarComponent: i
|
|
5835
6263
|
}), /* @__PURE__ */ jsx(EditorComponent, {})]
|
|
5836
6264
|
})
|
|
5837
6265
|
});
|
|
5838
6266
|
});
|
|
5839
6267
|
var row_module_default = { row: "_row_n16je_1" };
|
|
5840
|
-
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 }) => {
|
|
5841
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));
|
|
5842
6270
|
return /* @__PURE__ */ jsx("div", {
|
|
5843
6271
|
className: cx(row_module_default.row),
|
|
5844
6272
|
style: {
|
|
5845
6273
|
alignItems: t,
|
|
5846
6274
|
justifyContent: n,
|
|
5847
|
-
flexGrow:
|
|
5848
|
-
flexShrink:
|
|
6275
|
+
flexGrow: i ? 1 : 0,
|
|
6276
|
+
flexShrink: i ? 1 : 0,
|
|
5849
6277
|
flexWrap: u ? "wrap" : "nowrap",
|
|
5850
6278
|
height: o,
|
|
5851
6279
|
marginLeft: `calc(${f} * -0.5)`,
|
|
@@ -5995,7 +6423,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
5995
6423
|
}, Content$1 = ({ children: e, activeTabIndex: t, contentPadding: n }) => Array.isArray(e) ? /* @__PURE__ */ jsx("div", {
|
|
5996
6424
|
className: cx(n ? tabs_module_default.contentPadding : ""),
|
|
5997
6425
|
children: e.map((e, n) => t === n && e)
|
|
5998
|
-
}) : 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 }) => {
|
|
5999
6427
|
let p = useContext(DisabledContext), m = l !== void 0, h = n ? n.map((e, t) => ({
|
|
6000
6428
|
value: t,
|
|
6001
6429
|
url: e.props.url,
|
|
@@ -6004,11 +6432,11 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6004
6432
|
disabled: e.props.disabled || p,
|
|
6005
6433
|
badge: e.props.badge,
|
|
6006
6434
|
testId: e.props?.testId && `${e.props.testId}-${t}`
|
|
6007
|
-
})) : t || d, { simpleInputs:
|
|
6435
|
+
})) : t || d, { simpleInputs: g, options: v, selectedOptions: y } = m ? {
|
|
6008
6436
|
simpleInputs: !1,
|
|
6009
6437
|
options: h,
|
|
6010
6438
|
selectedOptions: void 0
|
|
6011
|
-
} : 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) => {
|
|
6012
6440
|
if (m) {
|
|
6013
6441
|
let e = n.key || n.label || null;
|
|
6014
6442
|
l(t, e);
|
|
@@ -6037,7 +6465,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6037
6465
|
children: v.map(w)
|
|
6038
6466
|
}), /* @__PURE__ */ jsx(Content$1, {
|
|
6039
6467
|
activeTabIndex: S ?? 0,
|
|
6040
|
-
contentPadding:
|
|
6468
|
+
contentPadding: s,
|
|
6041
6469
|
children: n
|
|
6042
6470
|
})] }) : null;
|
|
6043
6471
|
}, TextLink = ({ children: e, href: t = void 0, target: n = void 0, testId: r, onClick: i, component: a = "a" }) => /* @__PURE__ */ jsx(a, {
|
|
@@ -6063,7 +6491,7 @@ var textarea_module_default = {
|
|
|
6063
6491
|
small: "_small_q0tl0_116",
|
|
6064
6492
|
monospace: "_monospace_q0tl0_155"
|
|
6065
6493
|
};
|
|
6066
|
-
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 }) => {
|
|
6067
6495
|
let b = useContext(DisabledContext), x = /* @__PURE__ */ jsx("textarea", {
|
|
6068
6496
|
className: cx(textarea_module_default.textarea, f ? textarea_module_default.error : "", p ? textarea_module_default.warning : "", v ? textarea_module_default.monospace : ""),
|
|
6069
6497
|
name: e,
|
|
@@ -6073,11 +6501,11 @@ const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows:
|
|
|
6073
6501
|
rows: i,
|
|
6074
6502
|
onChange: o,
|
|
6075
6503
|
disabled: a || b,
|
|
6076
|
-
onKeyPress:
|
|
6504
|
+
onKeyPress: s,
|
|
6077
6505
|
onFocus: l,
|
|
6078
6506
|
onBlur: u,
|
|
6079
6507
|
tabIndex: d,
|
|
6080
|
-
style: { resize:
|
|
6508
|
+
style: { resize: g },
|
|
6081
6509
|
"data-error": f || null,
|
|
6082
6510
|
"data-warning": p || null,
|
|
6083
6511
|
"data-testid": y
|
|
@@ -6157,9 +6585,9 @@ const Warning = ({ warning: e }) => /* @__PURE__ */ jsx("div", {
|
|
|
6157
6585
|
let ElementType = /* @__PURE__ */ function(e) {
|
|
6158
6586
|
return e.LINK = "Link", e.BUTTON = "Button", e.MENU = "Menu", e.COMPONENT = "Component", e;
|
|
6159
6587
|
}({});
|
|
6160
|
-
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" }) => {
|
|
6161
6589
|
let l = useContext(DisabledContext);
|
|
6162
|
-
return /* @__PURE__ */ jsxs(
|
|
6590
|
+
return /* @__PURE__ */ jsxs(s, {
|
|
6163
6591
|
className: cx(top_bar_module_default.link, i ? top_bar_module_default.active : ""),
|
|
6164
6592
|
href: t || "#",
|
|
6165
6593
|
to: t,
|
|
@@ -6304,16 +6732,16 @@ var tree_module_default = {
|
|
|
6304
6732
|
placeholder: "_placeholder_15yn1_29"
|
|
6305
6733
|
};
|
|
6306
6734
|
const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, draggable: o, icons: s, onDrop: c }) => {
|
|
6307
|
-
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) => {
|
|
6308
6736
|
e.stopPropagation(), i(l);
|
|
6309
6737
|
}, x = (e) => {
|
|
6310
|
-
e.preventDefault(), e.stopPropagation(), h || (
|
|
6738
|
+
e.preventDefault(), e.stopPropagation(), h || (g(!0), y((/* @__PURE__ */ new Date()).getTime()));
|
|
6311
6739
|
}, S = (e) => {
|
|
6312
|
-
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 &&
|
|
6740
|
+
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 && g(!1);
|
|
6313
6741
|
}, C = (e) => {
|
|
6314
6742
|
e.preventDefault(), e.stopPropagation(), a && !r && (/* @__PURE__ */ new Date()).getTime() - v > 200 && b(e);
|
|
6315
6743
|
}, w = (e) => {
|
|
6316
|
-
e.preventDefault(), e.stopPropagation(),
|
|
6744
|
+
e.preventDefault(), e.stopPropagation(), g(!1), y((/* @__PURE__ */ new Date()).getTime()), c?.(e);
|
|
6317
6745
|
};
|
|
6318
6746
|
return /* @__PURE__ */ jsx("div", {
|
|
6319
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 : ""),
|
|
@@ -6541,18 +6969,18 @@ var unit_input_module_default = {
|
|
|
6541
6969
|
predefinedMenuActive: "_predefinedMenuActive_ye9w9_1",
|
|
6542
6970
|
inputWrapper: "_inputWrapper_ye9w9_4"
|
|
6543
6971
|
};
|
|
6544
|
-
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 = () => ({
|
|
6545
6973
|
name: "",
|
|
6546
6974
|
error: null
|
|
6547
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 }) => {
|
|
6548
6976
|
let L = useUnitContext(), R = useRunAfterUpdate();
|
|
6549
|
-
typeof
|
|
6550
|
-
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), [
|
|
6551
6979
|
u,
|
|
6552
6980
|
b,
|
|
6553
6981
|
L?.unitTemplate
|
|
6554
|
-
]), H = isKnownUnit(
|
|
6555
|
-
value:
|
|
6982
|
+
]), H = isKnownUnit(c, V), U = d || V || B, W = usePrevious(U), { value: G } = safeConvertValue({
|
|
6983
|
+
value: c,
|
|
6556
6984
|
toUnit: U,
|
|
6557
6985
|
unitkey: u,
|
|
6558
6986
|
defaultFromUnit: B,
|
|
@@ -6563,17 +6991,17 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6563
6991
|
} : {
|
|
6564
6992
|
value: G,
|
|
6565
6993
|
unit: U
|
|
6566
|
-
}),
|
|
6994
|
+
}), J = k || K?.value === void 0, [Y, X] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Xu = !!(O || n), Zu = C && C.find((e) => {
|
|
6567
6995
|
if (!e?.value) return;
|
|
6568
6996
|
if (E) return E === e.valueKey;
|
|
6569
|
-
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n =
|
|
6570
|
-
value: String(
|
|
6997
|
+
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = c } = convertUnit({
|
|
6998
|
+
value: String(c),
|
|
6571
6999
|
unitkey: u,
|
|
6572
7000
|
toUnit: t
|
|
6573
7001
|
});
|
|
6574
7002
|
return withUnit(n, t) === e.value;
|
|
6575
|
-
}),
|
|
6576
|
-
let e =
|
|
7003
|
+
}), Qu = () => {
|
|
7004
|
+
let e = c ?? "", t = K.unit;
|
|
6577
7005
|
if (checkConversion({
|
|
6578
7006
|
value: e,
|
|
6579
7007
|
unitkey: u,
|
|
@@ -6586,9 +7014,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6586
7014
|
return null;
|
|
6587
7015
|
}
|
|
6588
7016
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
6589
|
-
},
|
|
7017
|
+
}, $u = (t) => {
|
|
6590
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;
|
|
6591
|
-
|
|
7019
|
+
m({ target: {
|
|
6592
7020
|
value: s,
|
|
6593
7021
|
name: n
|
|
6594
7022
|
} });
|
|
@@ -6599,7 +7027,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6599
7027
|
}), R(() => {
|
|
6600
7028
|
r.selectionStart = a, r.selectionEnd = a;
|
|
6601
7029
|
});
|
|
6602
|
-
},
|
|
7030
|
+
}, ed = (e, t) => {
|
|
6603
7031
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
6604
7032
|
value: e,
|
|
6605
7033
|
unit: t
|
|
@@ -6610,16 +7038,16 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6610
7038
|
let e, t = "";
|
|
6611
7039
|
if (W !== U) {
|
|
6612
7040
|
let { value: n } = safeConvertValue({
|
|
6613
|
-
value:
|
|
7041
|
+
value: c,
|
|
6614
7042
|
toUnit: U,
|
|
6615
7043
|
unitkey: u,
|
|
6616
7044
|
defaultFromUnit: B,
|
|
6617
7045
|
doNotConvertValue: p
|
|
6618
7046
|
});
|
|
6619
7047
|
e = n, t = U;
|
|
6620
|
-
} else if (withUnit(K.value, K.unit) !==
|
|
7048
|
+
} else if (withUnit(K.value, K.unit) !== c) {
|
|
6621
7049
|
let { value: n } = safeConvertValue({
|
|
6622
|
-
value:
|
|
7050
|
+
value: c,
|
|
6623
7051
|
toUnit: K.unit,
|
|
6624
7052
|
unitkey: u,
|
|
6625
7053
|
defaultFromUnit: B,
|
|
@@ -6630,15 +7058,15 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6630
7058
|
e !== void 0 && q({
|
|
6631
7059
|
value: e,
|
|
6632
7060
|
unit: t
|
|
6633
|
-
}), C &&
|
|
7061
|
+
}), C && X(Zu && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
6634
7062
|
}
|
|
6635
7063
|
}, [
|
|
6636
7064
|
U,
|
|
6637
|
-
|
|
7065
|
+
c,
|
|
6638
7066
|
i,
|
|
6639
7067
|
T
|
|
6640
7068
|
]);
|
|
6641
|
-
let
|
|
7069
|
+
let Z = Qu(), Q = label(K.unit) || K.unit || "", td = p || !Z || Z && Z.length === 1, nd = getStringName(e), $, rd = (t) => {
|
|
6642
7070
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
6643
7071
|
if (checkConversion({
|
|
6644
7072
|
value: r,
|
|
@@ -6658,7 +7086,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6658
7086
|
type: MenuType.OPTION,
|
|
6659
7087
|
inline: !0,
|
|
6660
7088
|
onClick: () => {
|
|
6661
|
-
validateNumber(i).valid && !n && (
|
|
7089
|
+
validateNumber(i).valid && !n && (X(PredefinedOptionsMenuState.PREDEFINED), m({ target: {
|
|
6662
7090
|
value: r,
|
|
6663
7091
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
6664
7092
|
predefinedSelected: !0,
|
|
@@ -6670,25 +7098,25 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6670
7098
|
height: "0"
|
|
6671
7099
|
})] }),
|
|
6672
7100
|
description: o,
|
|
6673
|
-
selected:
|
|
7101
|
+
selected: Zu === t && Y === PredefinedOptionsMenuState.PREDEFINED
|
|
6674
7102
|
};
|
|
6675
7103
|
};
|
|
6676
7104
|
if ($ = [{
|
|
6677
7105
|
type: MenuType.OPTION,
|
|
6678
7106
|
inline: !0,
|
|
6679
7107
|
onClick: () => {
|
|
6680
|
-
|
|
7108
|
+
Y !== PredefinedOptionsMenuState.CUSTOM && !n && m({ target: {
|
|
6681
7109
|
value: withUnit(K.value, K.unit),
|
|
6682
7110
|
name: typeof e == "string" ? e : e?.fieldName || ""
|
|
6683
7111
|
} });
|
|
6684
7112
|
},
|
|
6685
7113
|
label: "Custom",
|
|
6686
|
-
selected:
|
|
7114
|
+
selected: Y === PredefinedOptionsMenuState.CUSTOM
|
|
6687
7115
|
}], C?.length) {
|
|
6688
|
-
let e = C.map(
|
|
7116
|
+
let e = C.map(rd);
|
|
6689
7117
|
$ = [...$, ...e];
|
|
6690
7118
|
}
|
|
6691
|
-
let
|
|
7119
|
+
let id = (e) => {
|
|
6692
7120
|
if (isValueWithUnit(e)) {
|
|
6693
7121
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
6694
7122
|
value: e,
|
|
@@ -6700,9 +7128,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6700
7128
|
return n;
|
|
6701
7129
|
}
|
|
6702
7130
|
return e;
|
|
6703
|
-
},
|
|
7131
|
+
}, ad = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, od = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
6704
7132
|
return /* @__PURE__ */ jsx("div", {
|
|
6705
|
-
className:
|
|
7133
|
+
className: Y === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
6706
7134
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
6707
7135
|
small: o,
|
|
6708
7136
|
width: s,
|
|
@@ -6717,65 +7145,65 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
6717
7145
|
trigger: "Component",
|
|
6718
7146
|
component: /* @__PURE__ */ jsx(Button, {
|
|
6719
7147
|
groupOrder: "first",
|
|
6720
|
-
active:
|
|
6721
|
-
icon:
|
|
7148
|
+
active: Y === PredefinedOptionsMenuState.PREDEFINED,
|
|
7149
|
+
icon: Y === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
|
|
6722
7150
|
small: o
|
|
6723
7151
|
}),
|
|
6724
7152
|
small: o,
|
|
6725
7153
|
sections: $
|
|
6726
7154
|
},
|
|
6727
|
-
tooltip:
|
|
7155
|
+
tooltip: Y === PredefinedOptionsMenuState.PREDEFINED ? Zu?.label : ""
|
|
6728
7156
|
}),
|
|
6729
7157
|
/* @__PURE__ */ jsx("div", {
|
|
6730
7158
|
className: unit_input_module_default.inputWrapper,
|
|
6731
7159
|
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
6732
|
-
name:
|
|
7160
|
+
name: nd,
|
|
6733
7161
|
testId: x,
|
|
6734
7162
|
disabled: n,
|
|
6735
|
-
placeholder:
|
|
7163
|
+
placeholder: id(t),
|
|
6736
7164
|
value: K.value,
|
|
6737
|
-
onChange:
|
|
7165
|
+
onChange: $u,
|
|
6738
7166
|
onFocus: v,
|
|
6739
7167
|
error: i === null ? void 0 : i,
|
|
6740
7168
|
warning: S === null ? void 0 : S,
|
|
6741
7169
|
left: a,
|
|
6742
|
-
allowEmpty:
|
|
6743
|
-
validationCallback: (e, t) => D(
|
|
7170
|
+
allowEmpty: J,
|
|
7171
|
+
validationCallback: (e, t) => D(nd, t),
|
|
6744
7172
|
enableCosmeticRounding: j,
|
|
6745
7173
|
enableDisplayRounding: M,
|
|
6746
7174
|
roundDisplayValue: N,
|
|
6747
|
-
groupOrder:
|
|
6748
|
-
disableInternalErrorValidationMessages:
|
|
7175
|
+
groupOrder: ad,
|
|
7176
|
+
disableInternalErrorValidationMessages: Xu,
|
|
6749
7177
|
small: o,
|
|
6750
7178
|
selectOnFocus: P,
|
|
6751
7179
|
tooltip: I
|
|
6752
|
-
},
|
|
7180
|
+
}, nd)
|
|
6753
7181
|
}),
|
|
6754
|
-
|
|
6755
|
-
groupOrder:
|
|
7182
|
+
Q && (td || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
7183
|
+
groupOrder: od,
|
|
6756
7184
|
small: o,
|
|
6757
|
-
children:
|
|
7185
|
+
children: Q
|
|
6758
7186
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
6759
|
-
groupOrder:
|
|
7187
|
+
groupOrder: od,
|
|
6760
7188
|
maxHeight: 380,
|
|
6761
7189
|
disabled: r,
|
|
6762
7190
|
testId: x && `${x}-menu`,
|
|
6763
7191
|
tabIndex: -1,
|
|
6764
7192
|
menu: {
|
|
6765
|
-
label:
|
|
7193
|
+
label: Q,
|
|
6766
7194
|
trigger: "DropDownButton",
|
|
6767
7195
|
small: o,
|
|
6768
|
-
sections:
|
|
7196
|
+
sections: Z.map(([e = "", t = "", n]) => {
|
|
6769
7197
|
let r = n || t || "", i = isValidNum(e) ? e : "";
|
|
6770
7198
|
return {
|
|
6771
7199
|
type: "Option",
|
|
6772
7200
|
label: j ? safeRoundNumbers(i) : i,
|
|
6773
7201
|
inline: !0,
|
|
6774
7202
|
onClick: (n) => {
|
|
6775
|
-
n.stopPropagation(),
|
|
7203
|
+
n.stopPropagation(), ed(e, t);
|
|
6776
7204
|
},
|
|
6777
7205
|
description: r,
|
|
6778
|
-
selected: r ===
|
|
7206
|
+
selected: r === Q,
|
|
6779
7207
|
testId: `${x}-unit-${r}`
|
|
6780
7208
|
};
|
|
6781
7209
|
})
|
|
@@ -6888,60 +7316,61 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
|
|
|
6888
7316
|
})
|
|
6889
7317
|
})) : [];
|
|
6890
7318
|
};
|
|
6891
|
-
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder:
|
|
6892
|
-
let { headers:
|
|
6893
|
-
|
|
6894
|
-
...
|
|
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
|
+
..._,
|
|
6895
7323
|
[e]: n
|
|
6896
7324
|
});
|
|
6897
7325
|
let r = t.find((t) => t.unitKey === e);
|
|
6898
7326
|
r && typeof r.onChange == "function" && r.onChange({
|
|
6899
|
-
oldUnit:
|
|
7327
|
+
oldUnit: _[e],
|
|
6900
7328
|
newUnit: n,
|
|
6901
7329
|
unitKey: e
|
|
6902
7330
|
});
|
|
6903
|
-
},
|
|
6904
|
-
let a =
|
|
7331
|
+
}, b = useCallback(({ row: e, rowIndex: t }) => {
|
|
7332
|
+
let a = c ? c({
|
|
6905
7333
|
row: e,
|
|
6906
7334
|
rowIndex: t
|
|
6907
7335
|
}) : e;
|
|
6908
7336
|
return convertRow({
|
|
6909
7337
|
row: a,
|
|
6910
7338
|
rowIndex: t,
|
|
6911
|
-
selectedUnits:
|
|
6912
|
-
storageUnits:
|
|
7339
|
+
selectedUnits: _,
|
|
7340
|
+
storageUnits: p,
|
|
6913
7341
|
convertBackToStorageUnit: n,
|
|
6914
7342
|
enableCosmeticRounding: r,
|
|
6915
7343
|
enableDisplayRounding: i
|
|
6916
7344
|
});
|
|
6917
7345
|
}, [
|
|
6918
|
-
|
|
6919
|
-
|
|
7346
|
+
_,
|
|
7347
|
+
p,
|
|
6920
7348
|
n,
|
|
6921
7349
|
r,
|
|
6922
7350
|
i
|
|
6923
7351
|
]);
|
|
6924
7352
|
return useEffect(() => {
|
|
6925
|
-
isEqual(
|
|
6926
|
-
let t =
|
|
6927
|
-
t !== n &&
|
|
7353
|
+
isEqual(m, g) || Object.keys(m).forEach((e) => {
|
|
7354
|
+
let t = g?.[e], n = m[e];
|
|
7355
|
+
t !== n && y({
|
|
6928
7356
|
unitKey: e,
|
|
6929
7357
|
value: n
|
|
6930
7358
|
});
|
|
6931
7359
|
});
|
|
6932
7360
|
}, [t]), /* @__PURE__ */ jsx(Table, {
|
|
6933
7361
|
table: {
|
|
6934
|
-
...
|
|
7362
|
+
...f,
|
|
6935
7363
|
headers: convertHeaderRows({
|
|
6936
7364
|
headers: e.headers,
|
|
6937
|
-
selectedUnits:
|
|
6938
|
-
storageUnits:
|
|
6939
|
-
onChangeUnit:
|
|
7365
|
+
selectedUnits: _,
|
|
7366
|
+
storageUnits: p,
|
|
7367
|
+
onChangeUnit: y
|
|
6940
7368
|
})
|
|
6941
7369
|
},
|
|
6942
7370
|
onListReorder: a,
|
|
6943
|
-
canListReorder:
|
|
6944
|
-
beforeRenderRow:
|
|
7371
|
+
canListReorder: o,
|
|
7372
|
+
beforeRenderRow: b,
|
|
7373
|
+
enableMultiSelect: u
|
|
6945
7374
|
});
|
|
6946
7375
|
};
|
|
6947
7376
|
var setting_field_module_default = { settingField: "_settingField_1x02n_1" };
|
|
@@ -7014,7 +7443,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7014
7443
|
}, [n]);
|
|
7015
7444
|
let s = ({ target: { value: e } }) => {
|
|
7016
7445
|
a(e);
|
|
7017
|
-
}, { added:
|
|
7446
|
+
}, { added: c, removed: u } = renderLinesCount(e, t), d = c + u > 3500;
|
|
7018
7447
|
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Card, {
|
|
7019
7448
|
bordered: !0,
|
|
7020
7449
|
heading: /* @__PURE__ */ jsxs(Flex, {
|
|
@@ -7023,7 +7452,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7023
7452
|
success: !0,
|
|
7024
7453
|
children: [
|
|
7025
7454
|
"+",
|
|
7026
|
-
|
|
7455
|
+
c,
|
|
7027
7456
|
" "
|
|
7028
7457
|
]
|
|
7029
7458
|
}), /* @__PURE__ */ jsxs(Text, {
|