@oliasoft-open-source/react-ui-library 5.8.0-beta-2 → 5.8.0-beta-4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/global.css +1 -1
- package/dist/index.d.ts +4 -50
- package/dist/index.js +922 -1418
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { Fragment,
|
|
1
|
+
import React, { Fragment, createContext, forwardRef, isValidElement, memo, useCallback, useContext, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useReducer, useRef, useState, useTransition } from "react";
|
|
2
2
|
import cx from "classnames";
|
|
3
3
|
import { ReactSVG } from "react-svg";
|
|
4
4
|
import { TbAlertTriangle, TbArrowDown, TbArrowLeft, TbArrowRight, TbArrowUp, TbArrowsDiagonal, TbArrowsMaximize, TbArrowsMinimize, TbArrowsMove, TbArrowsSplit, TbBell, TbBold, TbBolt, TbBook2, TbBuildingSkyscraper, TbCamera, TbChartBar, TbChartLine, TbChartPie2, TbCheck, TbChevronDown, TbChevronLeft, TbChevronRight, TbChevronUp, TbChevronsLeft, TbChevronsRight, TbCircle, TbCircleCheck, TbCircleX, TbClipboard, TbClock, TbCode, TbCopy, TbCornerDownRight, TbDeviceFloppy, TbDeviceLaptop, TbDotsVertical, TbDownload, TbDroplet, TbExclamationMark, TbExternalLink, TbEye, TbEyeOff, TbFile, TbFilter, TbFilterOff, TbFocusCentered, TbFolder, TbFolderSearch, TbGauge, TbGitFork, TbGripVertical, TbHelp, TbInfoCircle, TbItalic, TbKey, TbLayoutColumns, TbLayoutRows, TbLink, TbLinkOff, TbList, TbListNumbers, TbLoader2, TbLock, TbLockOpen, TbMapPin, TbMessageCircle, TbMinus, TbMoon, TbMovie, TbNote, TbPencil, TbPlayerPause, TbPlayerPlay, TbPlayerSkipBack, TbPlayerSkipForward, TbPlayerStop, TbPlayerTrackNext, TbPlayerTrackPrev, TbPlus, TbQuestionMark, TbRefresh, TbReload, TbRotate, TbRowInsertBottom, TbRowInsertTop, TbRuler3, TbScale, TbSearch, TbServer, TbSettings, TbSortAscending, TbSortDescending, TbStar, TbSun, TbTable, TbTarget, TbTrash, TbUpload, TbUser, TbUsers, TbX } from "react-icons/tb";
|
|
@@ -15,13 +15,13 @@ import { ALT_UNITS, KNOWN_UNITS, altUnitsList, cleanNumStr, convertAndGetValue,
|
|
|
15
15
|
import { FixedSizeList } from "react-window";
|
|
16
16
|
import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
17
17
|
import { CSS } from "@dnd-kit/utilities";
|
|
18
|
-
import Papa from "papaparse";
|
|
19
18
|
import RcSlider from "rc-slider";
|
|
20
19
|
import memoizeOne from "memoize-one";
|
|
21
20
|
import isEqual$1 from "react-fast-compare";
|
|
22
21
|
import { DndContext, DragOverlay, closestCenter } from "@dnd-kit/core";
|
|
23
22
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
24
23
|
import { SimplifyAP } from "simplify-ts";
|
|
24
|
+
import Papa from "papaparse";
|
|
25
25
|
import { Slide, ToastContainer as Toaster, toast as toast$1 } from "react-toastify";
|
|
26
26
|
import { isNullOrUndefined } from "remirror";
|
|
27
27
|
import { BoldExtension, BulletListExtension, CodeExtension, ItalicExtension, MarkdownExtension, OrderedListExtension, PlaceholderExtension } from "remirror/extensions";
|
|
@@ -214,23 +214,23 @@ const NamedIcon = ({ icon: e }) => {
|
|
|
214
214
|
case "": return null;
|
|
215
215
|
default: return /* @__PURE__ */ jsx(TbCircle, {});
|
|
216
216
|
}
|
|
217
|
-
}, Icon = ({ icon: e, onClick: t, clickable: n = !1, color: r, size:
|
|
218
|
-
let
|
|
217
|
+
}, Icon = ({ icon: e, onClick: t, clickable: n = !1, color: r, size: a, testId: o }) => {
|
|
218
|
+
let c = useContext(DisabledContext), l = {
|
|
219
219
|
color: r,
|
|
220
220
|
fill: r,
|
|
221
|
-
fontSize:
|
|
222
|
-
width:
|
|
223
|
-
height:
|
|
221
|
+
fontSize: a || "inherit",
|
|
222
|
+
width: a || "auto",
|
|
223
|
+
height: a || "auto"
|
|
224
224
|
};
|
|
225
225
|
return /* @__PURE__ */ jsx("div", {
|
|
226
|
-
className: cx(icon_module_default.wrapper, (n || t) && !
|
|
226
|
+
className: cx(icon_module_default.wrapper, (n || t) && !c ? icon_module_default.clickable : ""),
|
|
227
227
|
style: l,
|
|
228
|
-
onClick: (e) => t && !
|
|
228
|
+
onClick: (e) => t && !c ? t(e) : void 0,
|
|
229
229
|
"data-testid": o,
|
|
230
230
|
children: isValidElement(e) ? e : typeof e == "string" && (e.includes(".svg") || e.includes("image/svg")) ? /* @__PURE__ */ jsx(ReactSVG, {
|
|
231
231
|
className: icon_module_default.customSvg,
|
|
232
232
|
beforeInjection: (e) => {
|
|
233
|
-
|
|
233
|
+
a && (e.setAttribute("width", String(a)), e.setAttribute("height", String(a)));
|
|
234
234
|
},
|
|
235
235
|
src: e
|
|
236
236
|
}) : typeof e == "string" && (e.includes(".png") || e.includes("image/png")) ? /* @__PURE__ */ jsx("img", {
|
|
@@ -325,7 +325,7 @@ const TooltipLayer = ({ text: e = "", error: t = !1, warning: n = !1, maxWidth:
|
|
|
325
325
|
...s,
|
|
326
326
|
size: 6
|
|
327
327
|
})]
|
|
328
|
-
}), Tooltip = ({ children: e, text: t = "", error: n = !1, placement: r = "top-center", possiblePlacements:
|
|
328
|
+
}), Tooltip = ({ children: e, text: t = "", error: n = !1, placement: r = "top-center", possiblePlacements: a = [
|
|
329
329
|
"top-center",
|
|
330
330
|
"left-center",
|
|
331
331
|
"bottom-center",
|
|
@@ -341,7 +341,7 @@ const TooltipLayer = ({ text: e = "", error: t = !1, warning: n = !1, maxWidth:
|
|
|
341
341
|
auto: !0,
|
|
342
342
|
triggerOffset: l,
|
|
343
343
|
placement: r,
|
|
344
|
-
possiblePlacements:
|
|
344
|
+
possiblePlacements: a,
|
|
345
345
|
onParentClose: v
|
|
346
346
|
});
|
|
347
347
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [y && b(/* @__PURE__ */ jsx(TooltipLayer, {
|
|
@@ -385,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 b = useContext(DisabledContext), x =
|
|
388
|
+
}), CheckBox = ({ noMargin: e = !1, dataix: t = 0, isInTable: n = !1, tabIndex: r = 0, checked: i = !1, indeterminate: a = !1, name: o, label: l = "", disabled: u = !1, small: d = !1, onChange: f, testId: m, value: h, helpText: _, onClickHelp: v, textTransform: y = TextTransform.CAPITALIZE }) => {
|
|
389
|
+
let b = useContext(DisabledContext), x = _ || v, S = u || b, C = useRef(null);
|
|
390
390
|
return useEffect(() => {
|
|
391
391
|
C.current && (C.current.indeterminate = a);
|
|
392
392
|
}, [a]), /* @__PURE__ */ jsxs("div", {
|
|
393
|
-
className: cx(check_box_module_default.checkbox, e && check_box_module_default.noMargin, n && check_box_module_default.isInTable, S && 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, S && check_box_module_default.disabled, d && check_box_module_default.small, !l && check_box_module_default.noLabel),
|
|
394
394
|
"data-ix": t,
|
|
395
395
|
onClick: (e) => {
|
|
396
396
|
if (!S) {
|
|
@@ -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": m,
|
|
408
408
|
children: [
|
|
409
409
|
/* @__PURE__ */ jsx("input", {
|
|
410
410
|
ref: C,
|
|
@@ -422,12 +422,12 @@ const HelpIcon = ({ text: e, onClick: t, icon: n = "help", active: r = !1, maxWi
|
|
|
422
422
|
children: [/* @__PURE__ */ jsx("span", {
|
|
423
423
|
className: check_box_module_default.checkmark,
|
|
424
424
|
children: /* @__PURE__ */ jsx(Icon, { icon: IconType.CHECK })
|
|
425
|
-
}),
|
|
425
|
+
}), l]
|
|
426
426
|
}),
|
|
427
427
|
x && /* @__PURE__ */ jsx("div", {
|
|
428
428
|
className: check_box_module_default.helpIconEnabled,
|
|
429
429
|
onClick: v,
|
|
430
|
-
children: /* @__PURE__ */ jsx(HelpIcon, { text:
|
|
430
|
+
children: /* @__PURE__ */ jsx(HelpIcon, { text: _ })
|
|
431
431
|
})
|
|
432
432
|
]
|
|
433
433
|
});
|
|
@@ -527,7 +527,7 @@ var ButtonTooltipWrapper = ({ children: e, tooltip: t = null }) => t ? /* @__PUR
|
|
|
527
527
|
display: "inline-flex",
|
|
528
528
|
children: e
|
|
529
529
|
}) : /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
530
|
-
const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r = !1, ignoreDisabledContext: i = !1, groupOrder: a, icon: o = null, label:
|
|
530
|
+
const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r = !1, ignoreDisabledContext: i = !1, groupOrder: a, icon: o = null, label: c = "", loading: l = !1, name: u, pill: d = !1, round: f = !1, small: p = !1, styles: m = "", width: h = "", title: _ = "", type: v = ButtonType.BUTTON, onClick: y = () => {}, error: b, warning: x, testId: S, tooltip: C, inverted: w = !1, component: T = "button", url: E, tabIndex: D }) => {
|
|
531
531
|
let O = useContext(DisabledContext), k = (() => {
|
|
532
532
|
if (n) switch (n) {
|
|
533
533
|
case Color.DANGER:
|
|
@@ -550,11 +550,11 @@ const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r =
|
|
|
550
550
|
tooltip: C,
|
|
551
551
|
children: /* @__PURE__ */ jsxs(T, {
|
|
552
552
|
type: v === ButtonType.SUBMIT ? ButtonType.SUBMIT : ButtonType.BUTTON,
|
|
553
|
-
className: cx(button_module_default.button, e ? button_module_default.active : "", t ? button_module_default.basic : "", k, j ? button_module_default.disabled : "", (o || l) && !
|
|
553
|
+
className: cx(button_module_default.button, e ? button_module_default.active : "", t ? button_module_default.basic : "", k, j ? button_module_default.disabled : "", (o || l) && !c ? button_module_default.iconOnly : "", w ? button_module_default.inverted : "", A, d ? button_module_default.pill : "", f ? button_module_default.round : "", p ? button_module_default.small : "", m),
|
|
554
554
|
disabled: j,
|
|
555
555
|
name: u ?? "",
|
|
556
556
|
onClick: y,
|
|
557
|
-
...
|
|
557
|
+
..._ ? { title: _ } : {},
|
|
558
558
|
style: { width: h },
|
|
559
559
|
"data-error": b || null,
|
|
560
560
|
"data-warning": x || null,
|
|
@@ -575,7 +575,7 @@ const Button = ({ active: e = !1, basic: t = !1, colored: n = !1, disabled: r =
|
|
|
575
575
|
colored: t
|
|
576
576
|
})
|
|
577
577
|
}),
|
|
578
|
-
|
|
578
|
+
c
|
|
579
579
|
]
|
|
580
580
|
})
|
|
581
581
|
});
|
|
@@ -625,7 +625,7 @@ const Heading$3 = ({ label: e, onClick: t, icon: n, testId: r }) => /* @__PURE__
|
|
|
625
625
|
onClick: t,
|
|
626
626
|
children: /* @__PURE__ */ jsx(Icon, { icon: n })
|
|
627
627
|
})]
|
|
628
|
-
}), Divider$1 = () => /* @__PURE__ */ jsx("hr", { className: menu_module_default.divider }), Option$2 = ({ actions: e, label: t, url: n, onClick: r, description: i, icon: a, selected: o, closeOnOptionClick: s, close: c, disabled: l, inline: u, title: d, upload: f, uploadType: p, onChange: m = noop, testId: h, component:
|
|
628
|
+
}), Divider$1 = () => /* @__PURE__ */ jsx("hr", { className: menu_module_default.divider }), Option$2 = ({ actions: e, label: t, url: n, onClick: r, description: i, icon: a, selected: o, closeOnOptionClick: s, close: c, disabled: l, inline: u, title: d, upload: f, uploadType: p, onChange: m = noop, testId: h, component: _ = "a" }) => {
|
|
629
629
|
let v = (e) => {
|
|
630
630
|
if (e.stopPropagation(), l) {
|
|
631
631
|
e.preventDefault();
|
|
@@ -647,7 +647,7 @@ const Heading$3 = ({ label: e, onClick: t, icon: n, testId: r }) => /* @__PURE__
|
|
|
647
647
|
m?.(n), c?.();
|
|
648
648
|
}
|
|
649
649
|
};
|
|
650
|
-
return /* @__PURE__ */ jsxs(
|
|
650
|
+
return /* @__PURE__ */ jsxs(_, {
|
|
651
651
|
href: n,
|
|
652
652
|
to: n,
|
|
653
653
|
className: cx(menu_module_default.option, l ? menu_module_default.disabled : "", u ? menu_module_default.inline : "", o ? menu_module_default?.selected : ""),
|
|
@@ -741,13 +741,13 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
741
741
|
});
|
|
742
742
|
default: return null;
|
|
743
743
|
}
|
|
744
|
-
}, parentPath = (e) => e.includes("[") ? e.substr(0, e.lastIndexOf("[")) : e, childPath = (e, t) => `${e}.sections[${t}]`.replace(/^\./, ""), closePath = (e) => `${e}.close`.replace(/^\./, ""), siblings = (e, t) => get(e, parentPath(t), []), registerClose = (e, t, n) => set(e, closePath(t), n), Layer$2 = ({ sections: e, isNested: t, width: n, closeOnOptionClick: r, close:
|
|
744
|
+
}, parentPath = (e) => e.includes("[") ? e.substr(0, e.lastIndexOf("[")) : e, childPath = (e, t) => `${e}.sections[${t}]`.replace(/^\./, ""), closePath = (e) => `${e}.close`.replace(/^\./, ""), siblings = (e, t) => get(e, parentPath(t), []), registerClose = (e, t, n) => set(e, closePath(t), n), Layer$2 = ({ sections: e, isNested: t, width: n, closeOnOptionClick: r, close: a = () => {}, tree: o, path: s, maxHeight: c, showAllButton: l, testId: u }) => {
|
|
745
745
|
if (isValidElement(e)) return /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
746
|
-
let [d, f] = useState(!l?.visible), p = e,
|
|
746
|
+
let [d, f] = useState(!l?.visible), p = e, h = l?.additionalSections?.map((e) => ({
|
|
747
747
|
...e,
|
|
748
748
|
closeOnOptionClick: r,
|
|
749
749
|
visible: !0
|
|
750
|
-
})) ?? [],
|
|
750
|
+
})) ?? [], _ = p.length > 4 ? [{
|
|
751
751
|
type: MenuType.OPTION,
|
|
752
752
|
label: d ? l?.showLessTitle || "Show less" : l?.showAllTitle || "Show all",
|
|
753
753
|
onClick: () => f(!d),
|
|
@@ -757,7 +757,7 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
757
757
|
...e,
|
|
758
758
|
visible: !0,
|
|
759
759
|
closeOnOptionClick: r
|
|
760
|
-
} : e).concat(
|
|
760
|
+
} : e).concat(_, h).filter((e) => e?.visible) : p.map((e) => ({
|
|
761
761
|
...e,
|
|
762
762
|
closeOnOptionClick: r
|
|
763
763
|
}));
|
|
@@ -771,7 +771,7 @@ const Section$1 = ({ section: e, closeOnOptionClick: t, close: n, tree: r, path:
|
|
|
771
771
|
children: /* @__PURE__ */ jsx("ul", { children: v.map((e, t) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Section$1, {
|
|
772
772
|
section: e,
|
|
773
773
|
closeOnOptionClick: e.closeOnOptionClick,
|
|
774
|
-
close:
|
|
774
|
+
close: a,
|
|
775
775
|
tree: o,
|
|
776
776
|
path: childPath(s, t),
|
|
777
777
|
maxHeight: c
|
|
@@ -809,7 +809,7 @@ const Badge = ({ children: e, color: t = "", title: n = null, dot: r = !1, margi
|
|
|
809
809
|
children: n
|
|
810
810
|
}), e]
|
|
811
811
|
});
|
|
812
|
-
}, Button$1 = ({ trigger: e, label: t, colored: n, small: r, width: i, disabled: a, groupOrder: o, loading:
|
|
812
|
+
}, Button$1 = ({ trigger: e, label: t, colored: n, small: r, width: i, disabled: a, groupOrder: o, loading: c, error: l, warning: u, active: d, tabIndex: f }) => {
|
|
813
813
|
let p = useContext(DisabledContext), m = e === TriggerType.BUTTON ? t : e === TriggerType.DROP_DOWN_BUTTON ? /* @__PURE__ */ jsxs("span", {
|
|
814
814
|
className: menu_module_default.middleAlignedInline,
|
|
815
815
|
children: [/* @__PURE__ */ jsx("span", {
|
|
@@ -830,7 +830,7 @@ const Badge = ({ children: e, color: t = "", title: n = null, dot: r = !1, margi
|
|
|
830
830
|
width: i,
|
|
831
831
|
groupOrder: o,
|
|
832
832
|
onClick: () => {},
|
|
833
|
-
loading:
|
|
833
|
+
loading: c,
|
|
834
834
|
disabled: a,
|
|
835
835
|
error: l,
|
|
836
836
|
warning: u,
|
|
@@ -944,7 +944,7 @@ var isMenuEmpty = (e) => {
|
|
|
944
944
|
testId: d && `${d}-layer`
|
|
945
945
|
})
|
|
946
946
|
})), m];
|
|
947
|
-
}, ContextMenu = ({ menu: e, width: t, disabled: n = !1, closeOnOptionClick: r = !0, closeParent: i, tree: a, path: o, groupOrder:
|
|
947
|
+
}, ContextMenu = ({ menu: e, width: t, disabled: n = !1, closeOnOptionClick: r = !0, closeParent: i, tree: a, path: o, groupOrder: c, testId: l }) => {
|
|
948
948
|
let u = useContext(DisabledContext), { label: d, trigger: f, fullHeightTrigger: p, colored: m, small: h, component: g, placement: _, possiblePlacements: v = ["bottom-start", "top-start"] } = e, [y, b] = useContextMenu({
|
|
949
949
|
sections: e.sections,
|
|
950
950
|
width: t,
|
|
@@ -954,7 +954,7 @@ var isMenuEmpty = (e) => {
|
|
|
954
954
|
closeParent: i,
|
|
955
955
|
tree: a,
|
|
956
956
|
path: o,
|
|
957
|
-
groupOrder:
|
|
957
|
+
groupOrder: c,
|
|
958
958
|
overflowContainer: !0,
|
|
959
959
|
maxHeight: void 0,
|
|
960
960
|
testId: l
|
|
@@ -974,11 +974,11 @@ var isMenuEmpty = (e) => {
|
|
|
974
974
|
isNested: !0,
|
|
975
975
|
component: g,
|
|
976
976
|
contextMenu: !0,
|
|
977
|
-
groupOrder:
|
|
977
|
+
groupOrder: c
|
|
978
978
|
}), y]
|
|
979
979
|
});
|
|
980
980
|
};
|
|
981
|
-
const DropDownMenu = ({ menu: e, width: t, disabled: n = !1, badgeTitle: r, badgeDot: i = !1, loading: a = !1, isNested: o = !1, closeOnOptionClick:
|
|
981
|
+
const DropDownMenu = ({ menu: e, width: t, disabled: n = !1, badgeTitle: r, badgeDot: i = !1, loading: a = !1, isNested: o = !1, closeOnOptionClick: c = !0, closeParent: l, tree: u, path: d, groupOrder: f, overflowContainer: p = !0, maxHeight: h, testId: g, open: _, setOpen: v, tooltip: y, error: b, warning: x, selected: S, tabIndex: C, active: w }) => {
|
|
982
982
|
let T = useContext(DisabledContext), { label: E, title: D, trigger: O, fullHeightTrigger: k, colored: A, small: j, sections: M, component: N, placement: P, showAllButton: F, possiblePlacements: I = ["bottom-start", "top-start"] } = e, [L, R] = isBoolean(_) && isFunction(v) ? [_, v] : useState(!1), z = () => R(!1), B = () => R(!0), { triggerProps: V, layerProps: H, renderLayer: U } = useLayer({
|
|
983
983
|
isOpen: L,
|
|
984
984
|
...placementOptions$1(P, o),
|
|
@@ -1032,11 +1032,11 @@ const DropDownMenu = ({ menu: e, width: t, disabled: n = !1, badgeTitle: r, badg
|
|
|
1032
1032
|
sections: M,
|
|
1033
1033
|
isNested: o,
|
|
1034
1034
|
width: t,
|
|
1035
|
-
closeOnOptionClick:
|
|
1035
|
+
closeOnOptionClick: c,
|
|
1036
1036
|
close: l || z,
|
|
1037
1037
|
tree: u,
|
|
1038
1038
|
path: d,
|
|
1039
|
-
maxHeight:
|
|
1039
|
+
maxHeight: h,
|
|
1040
1040
|
showAllButton: F,
|
|
1041
1041
|
testId: g && `${g}-layer`
|
|
1042
1042
|
})
|
|
@@ -1125,15 +1125,15 @@ var breadcrumb_module_default = {
|
|
|
1125
1125
|
let BreadcrumbLinkType = /* @__PURE__ */ function(e) {
|
|
1126
1126
|
return e.LABEL = "label", e.LINK = "link", e.CUSTOM = "custom", e;
|
|
1127
1127
|
}({});
|
|
1128
|
-
const Link$2 = ({ type: e = BreadcrumbLinkType.LABEL, label: t, url: n, onClick: r, active:
|
|
1129
|
-
let l = useContext(DisabledContext), u = e === BreadcrumbLinkType.LINK && n !== void 0, d = e === BreadcrumbLinkType.CUSTOM && isValidElement(
|
|
1128
|
+
const Link$2 = ({ type: e = BreadcrumbLinkType.LABEL, label: t, url: n, onClick: r, active: a, disabled: o, element: c }) => {
|
|
1129
|
+
let l = useContext(DisabledContext), u = e === BreadcrumbLinkType.LINK && n !== void 0, d = e === BreadcrumbLinkType.CUSTOM && isValidElement(c);
|
|
1130
1130
|
return /* @__PURE__ */ jsx("span", {
|
|
1131
1131
|
onClick: r,
|
|
1132
|
-
className: cx(breadcrumb_module_default.labelContainer,
|
|
1132
|
+
className: cx(breadcrumb_module_default.labelContainer, a && breadcrumb_module_default.active, (o || l) && breadcrumb_module_default.disabled),
|
|
1133
1133
|
children: u ? /* @__PURE__ */ jsx("a", {
|
|
1134
1134
|
href: n,
|
|
1135
1135
|
children: t
|
|
1136
|
-
}) : d ?
|
|
1136
|
+
}) : d ? c : t
|
|
1137
1137
|
});
|
|
1138
1138
|
}, Breadcrumb = ({ links: e, small: t = !1 }) => /* @__PURE__ */ jsx("div", {
|
|
1139
1139
|
className: cx(breadcrumb_module_default.breadcrumb, t && breadcrumb_module_default.small),
|
|
@@ -1158,7 +1158,7 @@ var button_group_module_default = {
|
|
|
1158
1158
|
buttonGroup: "_buttonGroup_iu2wi_11"
|
|
1159
1159
|
};
|
|
1160
1160
|
const ButtonGroup = (e) => {
|
|
1161
|
-
let { basic: t = !1, items: n = [], header: r = "", onSelected: i = () => {}, small: a = !1, value: o = "", testId:
|
|
1161
|
+
let { basic: t = !1, items: n = [], header: r = "", onSelected: i = () => {}, small: a = !1, value: o = "", testId: c = void 0, disabled: l } = e, u = useContext(DisabledContext), d = (e, t, n, r, a) => {
|
|
1162
1162
|
e.preventDefault(), e.stopPropagation(), !(l || a || u) && i(t, n, r);
|
|
1163
1163
|
}, f = (e, t) => t === "string" ? e : t === "object" ? e.label : t === "array" ? e[1] : null, p = (e, t) => t === "string" ? e : t === "object" ? e.value ?? "" : t === "array" ? e[0] ?? "" : "", m = (e, t, n) => t === "object" && "key" in e ? e.key : n, h = (e, t) => t === "object" ? e.hidden : !1, g = (e, t) => t === "object" ? e.icon : void 0, _ = (e, t, n) => e === "object" ? String(t) === String(o) : n === o, v = () => {
|
|
1164
1164
|
if (r) return /* @__PURE__ */ jsx("label", {
|
|
@@ -1191,7 +1191,7 @@ const ButtonGroup = (e) => {
|
|
|
1191
1191
|
});
|
|
1192
1192
|
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { children: [v(), /* @__PURE__ */ jsx("div", {
|
|
1193
1193
|
className: button_group_module_default.buttonGroup,
|
|
1194
|
-
"data-testid":
|
|
1194
|
+
"data-testid": c,
|
|
1195
1195
|
children: y()
|
|
1196
1196
|
})] }) });
|
|
1197
1197
|
};
|
|
@@ -1494,16 +1494,16 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1494
1494
|
},
|
|
1495
1495
|
children: e
|
|
1496
1496
|
}) : /* @__PURE__ */ jsx(Fragment$1, { children: e });
|
|
1497
|
-
}, Drawer = ({ background: e = "var(--color-background-raised)", fixed: t = !1, open: n = !1, setOpen: r, right:
|
|
1498
|
-
let D = u === !0, O = !D && isValidElement(u), [k, A] = r ? [n, r] : D ||
|
|
1497
|
+
}, Drawer = ({ background: e = "var(--color-background-raised)", fixed: t = !1, open: n = !1, setOpen: r, right: a = !1, width: o = 400, closedWidth: s = 0, shadow: c = !1, top: l = 0, button: u = null, buttonAnimate: d = !0, buttonPosition: f = ButtonPosition.BOTTOM, border: p = !1, children: h = null, tabs: _, defaultTabIndex: v = 0, activeTab: y, setActiveTab: b, testId: x, onResize: S, getActiveTab: C, onClose: w, onOpen: T, maxOpenWidth: E }) => {
|
|
1498
|
+
let D = u === !0, O = !D && isValidElement(u), [k, A] = r ? [n, r] : D || _ ? useState(n) : [n, () => {}], [j, M] = useState(v), N = r ? n : k, P = r || A, F = b === void 0 ? j : y, I = b || M, L = Array.isArray(o) ? o[F || 0] : o, R = N ? L : _ ? 35 : s;
|
|
1499
1499
|
return /* @__PURE__ */ jsx(DrawerResizeWrapper, {
|
|
1500
1500
|
width: R,
|
|
1501
1501
|
onResize: S,
|
|
1502
1502
|
setOpen: P,
|
|
1503
|
-
right:
|
|
1503
|
+
right: a,
|
|
1504
1504
|
maxOpenWidth: E,
|
|
1505
1505
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1506
|
-
className: cx(drawer_module_default.drawer, c ? drawer_module_default.shadow : "", t ? drawer_module_default.fixed : drawer_module_default.inline,
|
|
1506
|
+
className: cx(drawer_module_default.drawer, c ? drawer_module_default.shadow : "", t ? drawer_module_default.fixed : drawer_module_default.inline, a ? drawer_module_default.right : drawer_module_default.left),
|
|
1507
1507
|
style: { top: l },
|
|
1508
1508
|
children: [/* @__PURE__ */ jsx("div", {
|
|
1509
1509
|
className: cx(drawer_module_default.drawerContent, p && drawer_module_default.border),
|
|
@@ -1512,16 +1512,16 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1512
1512
|
borderColor: typeof p == "string" ? p : void 0,
|
|
1513
1513
|
width: R
|
|
1514
1514
|
},
|
|
1515
|
-
children:
|
|
1515
|
+
children: _ ? /* @__PURE__ */ jsx(DrawerTabs, {
|
|
1516
1516
|
width: L,
|
|
1517
1517
|
testId: x,
|
|
1518
|
-
tabs:
|
|
1518
|
+
tabs: _,
|
|
1519
1519
|
open: N,
|
|
1520
1520
|
activeTab: F || 0,
|
|
1521
1521
|
background: e,
|
|
1522
1522
|
handleTabClick: (e) => {
|
|
1523
1523
|
let t = (t) => {
|
|
1524
|
-
|
|
1524
|
+
_ && t && t(_[e]);
|
|
1525
1525
|
};
|
|
1526
1526
|
F === e && N && P ? (t(w), P(!1)) : !N && P && (t(T), P(!0), S && ((e) => {
|
|
1527
1527
|
let t;
|
|
@@ -1534,21 +1534,21 @@ const DrawerResizeWrapper = ({ children: e = null, width: t = 400, right: n = !1
|
|
|
1534
1534
|
}
|
|
1535
1535
|
}) : /* @__PURE__ */ jsx("div", {
|
|
1536
1536
|
style: { width: L },
|
|
1537
|
-
children:
|
|
1537
|
+
children: h
|
|
1538
1538
|
})
|
|
1539
1539
|
}), u && /* @__PURE__ */ jsx("span", {
|
|
1540
1540
|
className: cx(drawer_module_default.toggleButton, k && (D || O && d) ? drawer_module_default.toggleButtonOpen : "", f === "top" ? drawer_module_default.top : drawer_module_default.bottom),
|
|
1541
1541
|
children: O ? u : /* @__PURE__ */ jsx(Button, {
|
|
1542
1542
|
onClick: P ? () => P(!N) : void 0,
|
|
1543
1543
|
round: !0,
|
|
1544
|
-
icon:
|
|
1544
|
+
icon: a ? IconType.CHEVRON_RIGHT : IconType.CHEVRON_LEFT
|
|
1545
1545
|
})
|
|
1546
1546
|
})]
|
|
1547
1547
|
})
|
|
1548
1548
|
});
|
|
1549
1549
|
};
|
|
1550
1550
|
var input_group_module_default = { inputGroup: "_inputGroup_biuoa_1" }, isDOMTypeElement = (e) => isValidElement(e) && typeof e.type == "string";
|
|
1551
|
-
const InputGroup = ({ children: n, small: r = !1, width:
|
|
1551
|
+
const InputGroup = ({ children: n, small: r = !1, width: a = "100%" }) => {
|
|
1552
1552
|
let o = Array.isArray(n) ? n.filter((e) => isValidElement(e)) : [n], s = o.map((n, i) => {
|
|
1553
1553
|
let a = isDOMTypeElement(n), { groupOrder: s } = a ? { groupOrder: null } : n.props, c = o.length, l = i === 0, u = i === c - 1, d = s || (!c || c === 1 ? null : l ? GroupOrder.FIRST : u ? GroupOrder.LAST : GroupOrder.MIDDLE);
|
|
1554
1554
|
return a ? n : /* @__PURE__ */ jsx(Fragment, { children: React.cloneElement(n, {
|
|
@@ -1558,27 +1558,27 @@ const InputGroup = ({ children: n, small: r = !1, width: i = "100%" }) => {
|
|
|
1558
1558
|
});
|
|
1559
1559
|
return /* @__PURE__ */ jsx("div", {
|
|
1560
1560
|
className: cx(input_group_module_default.inputGroup),
|
|
1561
|
-
style: { width:
|
|
1561
|
+
style: { width: a },
|
|
1562
1562
|
children: s
|
|
1563
1563
|
});
|
|
1564
1564
|
};
|
|
1565
1565
|
var input_module_default = {
|
|
1566
|
-
inputInTable: "
|
|
1567
|
-
inputHover: "
|
|
1568
|
-
inputFocus: "
|
|
1569
|
-
inputError: "
|
|
1570
|
-
inputWarning: "
|
|
1571
|
-
inputDisabled: "
|
|
1572
|
-
hideScrollbars: "
|
|
1573
|
-
input: "
|
|
1574
|
-
isInTable: "
|
|
1575
|
-
small: "
|
|
1576
|
-
right: "
|
|
1577
|
-
groupOrderFirst: "
|
|
1578
|
-
groupOrderMiddle: "
|
|
1579
|
-
groupOrderLast: "
|
|
1580
|
-
};
|
|
1581
|
-
const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, width: r = void 0, small: i = !1, onChange: a = noop, placeholder: o = "", value:
|
|
1566
|
+
inputInTable: "_inputInTable_1285q_1",
|
|
1567
|
+
inputHover: "_inputHover_1285q_13",
|
|
1568
|
+
inputFocus: "_inputFocus_1285q_18",
|
|
1569
|
+
inputError: "_inputError_1285q_25",
|
|
1570
|
+
inputWarning: "_inputWarning_1285q_26",
|
|
1571
|
+
inputDisabled: "_inputDisabled_1285q_61",
|
|
1572
|
+
hideScrollbars: "_hideScrollbars_1285q_67",
|
|
1573
|
+
input: "_input_1285q_1",
|
|
1574
|
+
isInTable: "_isInTable_1285q_100",
|
|
1575
|
+
small: "_small_1285q_124",
|
|
1576
|
+
right: "_right_1285q_170",
|
|
1577
|
+
groupOrderFirst: "_groupOrderFirst_1285q_173",
|
|
1578
|
+
groupOrderMiddle: "_groupOrderMiddle_1285q_174",
|
|
1579
|
+
groupOrderLast: "_groupOrderLast_1285q_175"
|
|
1580
|
+
};
|
|
1581
|
+
const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, width: r = void 0, small: i = !1, onChange: a = noop, placeholder: o = "", value: c = "", onKeyPress: l = () => {}, onFocus: u = () => {}, onBlur: d = () => {}, onPaste: f = () => {}, onKeyDown: p = () => {}, selectOnFocus: m = !0, name: h = void 0, type: _ = "text", tabIndex: v = 0, disabled: y = !1, right: b = !1, warning: x = null, groupOrder: S = null, maxTooltipWidth: C = void 0, testId: w = void 0, size: T = null }, E) => {
|
|
1582
1582
|
let D = useContext(DisabledContext), O = (() => {
|
|
1583
1583
|
if (S) switch (S) {
|
|
1584
1584
|
case GroupOrder.FIRST: return input_module_default.groupOrderFirst;
|
|
@@ -1599,10 +1599,10 @@ const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, wi
|
|
|
1599
1599
|
display: "block",
|
|
1600
1600
|
children: /* @__PURE__ */ jsx("input", {
|
|
1601
1601
|
ref: E,
|
|
1602
|
-
type:
|
|
1602
|
+
type: _ || "text",
|
|
1603
1603
|
size: T || 20,
|
|
1604
1604
|
placeholder: o ?? "",
|
|
1605
|
-
value:
|
|
1605
|
+
value: c ?? "",
|
|
1606
1606
|
onChange: a,
|
|
1607
1607
|
onKeyPress: l,
|
|
1608
1608
|
onKeyDown: p,
|
|
@@ -1621,8 +1621,7 @@ const Input = forwardRef(({ error: e = null, tooltip: t = null, isInTable: n, wi
|
|
|
1621
1621
|
style: { width: k },
|
|
1622
1622
|
"data-error": e || null,
|
|
1623
1623
|
"data-warning": x || null,
|
|
1624
|
-
"data-testid": w
|
|
1625
|
-
onDragStart: (e) => e.preventDefault()
|
|
1624
|
+
"data-testid": w
|
|
1626
1625
|
})
|
|
1627
1626
|
})
|
|
1628
1627
|
});
|
|
@@ -1648,11 +1647,11 @@ var getName = (e, t) => {
|
|
|
1648
1647
|
let n;
|
|
1649
1648
|
return e ? (n = t ? `Selected - ${Object.keys(e)?.length} files` : e?.name, n || null) : null;
|
|
1650
1649
|
};
|
|
1651
|
-
const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No file selected", disabled: r = !1, file: i, accept: a, multi: o, name:
|
|
1652
|
-
let f = useContext(DisabledContext),
|
|
1650
|
+
const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No file selected", disabled: r = !1, file: i, accept: a, multi: o, name: c, width: l, onChange: u = noop, testId: d }) => {
|
|
1651
|
+
let f = useContext(DisabledContext), m = useRef(null), h = getName(i, o);
|
|
1653
1652
|
return /* @__PURE__ */ jsxs("div", {
|
|
1654
1653
|
onClick: () => {
|
|
1655
|
-
r || f ||
|
|
1654
|
+
r || f || m.current?.click();
|
|
1656
1655
|
},
|
|
1657
1656
|
style: { width: l },
|
|
1658
1657
|
children: [/* @__PURE__ */ jsxs(InputGroup, { children: [/* @__PURE__ */ jsx(Input, {
|
|
@@ -1665,8 +1664,8 @@ const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No
|
|
|
1665
1664
|
disabled: t || r || f,
|
|
1666
1665
|
groupOrder: "last"
|
|
1667
1666
|
})] }), /* @__PURE__ */ jsx("input", {
|
|
1668
|
-
name:
|
|
1669
|
-
ref:
|
|
1667
|
+
name: c,
|
|
1668
|
+
ref: m,
|
|
1670
1669
|
className: file_input_module_default.fileInput,
|
|
1671
1670
|
type: "file",
|
|
1672
1671
|
accept: a,
|
|
@@ -1680,7 +1679,7 @@ const FileInput = ({ label: e = "Select", loading: t = !1, placeholder: n = "No
|
|
|
1680
1679
|
name: e.target.name
|
|
1681
1680
|
}
|
|
1682
1681
|
};
|
|
1683
|
-
u(r),
|
|
1682
|
+
u(r), m.current && (m.current.value = "");
|
|
1684
1683
|
},
|
|
1685
1684
|
"data-testid": d
|
|
1686
1685
|
})]
|
|
@@ -1783,7 +1782,7 @@ const ProgressBar = ({ width: e = "auto", inverted: t = !1, colored: n = !0, sho
|
|
|
1783
1782
|
})
|
|
1784
1783
|
});
|
|
1785
1784
|
var REQUEST_TIME = 4e4;
|
|
1786
|
-
const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r, onComplete: i, onFailed: a, onError: o, width: s, heading:
|
|
1785
|
+
const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r, onComplete: i, onFailed: a, onError: o, width: s, heading: l, dialogText: u, fileInputText: d, fileInputPlaceholder: f, uploadText: p, cancelText: h, testId: g }) => {
|
|
1787
1786
|
let [_, v] = useState(null), [y, b] = useState(!1), [x, S] = useState(0), C = 0, w = () => {
|
|
1788
1787
|
C += 250, S(C);
|
|
1789
1788
|
}, T = (e) => {
|
|
@@ -1838,7 +1837,7 @@ const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r,
|
|
|
1838
1837
|
disabled: !_ || y,
|
|
1839
1838
|
testId: `${g}-button-upload`
|
|
1840
1839
|
}), /* @__PURE__ */ jsx(Button, {
|
|
1841
|
-
label:
|
|
1840
|
+
label: h || "Cancel",
|
|
1842
1841
|
onClick: k,
|
|
1843
1842
|
testId: `${g}-button-cancel`
|
|
1844
1843
|
})] });
|
|
@@ -1847,7 +1846,7 @@ const SmartUploadModal = ({ visible: e, prompt: t, onCloseModal: n, onUpload: r,
|
|
|
1847
1846
|
centered: !0,
|
|
1848
1847
|
children: /* @__PURE__ */ jsx(Dialog, { dialog: {
|
|
1849
1848
|
scroll: !0,
|
|
1850
|
-
heading:
|
|
1849
|
+
heading: l || "Smart Upload",
|
|
1851
1850
|
content: A,
|
|
1852
1851
|
footer: j,
|
|
1853
1852
|
onClose: k,
|
|
@@ -1988,12 +1987,12 @@ var reducer$1 = (e, t) => {
|
|
|
1988
1987
|
}
|
|
1989
1988
|
};
|
|
1990
1989
|
const Message = ({ message: e }) => {
|
|
1991
|
-
let { visible: t, type: n = MessageType.INFO, icon: r, heading: i, content: a, details: o, detailsVisible: s = !1, footer: c, withDismiss: l, onClose: u, width: d, maxHeight:
|
|
1990
|
+
let { visible: t, type: n = MessageType.INFO, icon: r, heading: i, content: a, details: o, detailsVisible: s = !1, footer: c, withDismiss: l, onClose: u, width: d, maxHeight: p } = e, [m, h] = useReducer(reducer$1, { detailsVisible: s });
|
|
1992
1991
|
return /* @__PURE__ */ jsx(Fragment$1, { children: t ? /* @__PURE__ */ jsxs("div", {
|
|
1993
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),
|
|
1994
1993
|
style: {
|
|
1995
1994
|
width: d,
|
|
1996
|
-
maxHeight:
|
|
1995
|
+
maxHeight: p
|
|
1997
1996
|
},
|
|
1998
1997
|
children: [
|
|
1999
1998
|
/* @__PURE__ */ jsx("div", { children: r ? /* @__PURE__ */ jsx("div", {
|
|
@@ -2078,7 +2077,7 @@ var footer_module_default = {
|
|
|
2078
2077
|
groupOrderMiddle: "_groupOrderMiddle_sl2b5_194",
|
|
2079
2078
|
groupOrderLast: "_groupOrderLast_sl2b5_198"
|
|
2080
2079
|
};
|
|
2081
|
-
const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, tooltip: r = null, options: i, onChange: a = noop, onFocus: o = noop, onBlur:
|
|
2080
|
+
const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, tooltip: r = null, options: i, onChange: a = noop, onFocus: o = noop, onBlur: c = noop, right: l = !1, small: u = !1, tabIndex: d = 0, selectedOption: f, width: p = null, groupOrder: m, testId: h, isInTable: _ = !1, clearable: v, placeholder: y, hasNonExistentValue: b, maxTooltipWidth: x, borderRadius: S }) => {
|
|
2082
2081
|
let C = useContext(DisabledContext), w = f === null || f?.value === null ? "unselected" : f?.value, T = w === "unselected", E = (w === "unselected" || v ? [/* @__PURE__ */ jsx("option", {
|
|
2083
2082
|
value: "unselected",
|
|
2084
2083
|
disabled: !v,
|
|
@@ -2107,7 +2106,7 @@ const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, to
|
|
|
2107
2106
|
enabled: r && isStringNumberOrNode(r) || t && isStringNumberOrNode(t) || n && isStringNumberOrNode(n) || !1,
|
|
2108
2107
|
maxWidth: x,
|
|
2109
2108
|
children: /* @__PURE__ */ jsx("select", {
|
|
2110
|
-
className: cx(native_select_module_default.select, T ? native_select_module_default.unSelected : "", l ? native_select_module_default.right : "", u ? native_select_module_default.small : "",
|
|
2109
|
+
className: cx(native_select_module_default.select, T ? native_select_module_default.unSelected : "", l ? native_select_module_default.right : "", u ? native_select_module_default.small : "", _ ? native_select_module_default.isInTable : "", D),
|
|
2111
2110
|
style: {
|
|
2112
2111
|
width: p || "",
|
|
2113
2112
|
borderRadius: S || ""
|
|
@@ -2117,7 +2116,7 @@ const NativeSelect = ({ disabled: e = !1, error: t = null, warning: n = null, to
|
|
|
2117
2116
|
n = t === "unselected" ? { value: null } : i.find((e) => String(e.value) === String(t)) || { value: null }, a(e, n);
|
|
2118
2117
|
},
|
|
2119
2118
|
onFocus: o,
|
|
2120
|
-
onBlur:
|
|
2119
|
+
onBlur: c,
|
|
2121
2120
|
tabIndex: d,
|
|
2122
2121
|
value: w,
|
|
2123
2122
|
disabled: e || C,
|
|
@@ -2240,10 +2239,10 @@ const getWidestOptionWidth = (e, t, n, r) => {
|
|
|
2240
2239
|
return Math.ceil(i + a);
|
|
2241
2240
|
};
|
|
2242
2241
|
var List$1 = FixedSizeList;
|
|
2243
|
-
const Layer$1 = ({ listRef: e, isMulti: t, sections: n, selectedOptions: r, onSelectOption: i, focusedOptionIndex: a, width: o, small: s, firstSelectedOptionIndex:
|
|
2242
|
+
const Layer$1 = ({ listRef: e, isMulti: t, sections: n, selectedOptions: r, onSelectOption: i, focusedOptionIndex: a, width: o, small: s, firstSelectedOptionIndex: l, closeLayer: u, testId: d }) => {
|
|
2244
2243
|
useEffect(() => {
|
|
2245
|
-
|
|
2246
|
-
}, [
|
|
2244
|
+
l != null && e.current !== null && typeof e.current.scrollToItem == "function" && e.current.scrollToItem(l, "start");
|
|
2245
|
+
}, [l, e]);
|
|
2247
2246
|
let f = s ? 24 : 30;
|
|
2248
2247
|
return /* @__PURE__ */ jsx("div", {
|
|
2249
2248
|
"data-testid": d,
|
|
@@ -2303,12 +2302,12 @@ var trigger_module_default = {
|
|
|
2303
2302
|
detailedLabel: "_detailedLabel_7uwhv_307"
|
|
2304
2303
|
};
|
|
2305
2304
|
const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId: r }) => {
|
|
2306
|
-
let i = useFontsReady(), [a, o] = useState([]), [s,
|
|
2305
|
+
let i = useFontsReady(), [a, o] = useState([]), [s, l] = useState([]);
|
|
2307
2306
|
return useEffect(() => {
|
|
2308
2307
|
let r = [], a = [], s = 0;
|
|
2309
2308
|
e.forEach((o, c) => {
|
|
2310
2309
|
s += getMultiOptionWidth(o, t, i), c === e.length - 1 && s < n || s < n - 24 ? r.push(o) : a.push(o);
|
|
2311
|
-
}), o(r),
|
|
2310
|
+
}), o(r), l(a);
|
|
2312
2311
|
}, [
|
|
2313
2312
|
e,
|
|
2314
2313
|
i,
|
|
@@ -2362,7 +2361,7 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
|
|
|
2362
2361
|
"data-testid": c && `${c}-input`
|
|
2363
2362
|
}) : null]
|
|
2364
2363
|
});
|
|
2365
|
-
}, Trigger = ({ selectedOptions: e, searchValue: t, searchable: n, clearable: r, onClickTrigger: i, element: a, error: o, warning: s, tooltip: c, small: l, isInTable: u, disabled: d, onChangeSearch: f, onClickDeselect: p, onClickClear: m, tabIndex: h, isOpen:
|
|
2364
|
+
}, Trigger = ({ selectedOptions: e, searchValue: t, searchable: n, clearable: r, onClickTrigger: i, element: a, error: o, warning: s, tooltip: c, small: l, isInTable: u, disabled: d, onChangeSearch: f, onClickDeselect: p, onClickClear: m, tabIndex: h, isOpen: _, triggerRef: v, clearAllIsFocused: y, focusedSelectedOptionIndex: b, onFocus: x, onBlur: S, groupOrder: C, maxTooltipWidth: w, placeholder: T, right: E, testId: D }) => {
|
|
2366
2365
|
let [O, k] = useFocus(), A = Array.isArray(e) ? e.length > 0 && e[0]?.value : e?.value, j = r && A, M = (() => {
|
|
2367
2366
|
if (C) switch (C) {
|
|
2368
2367
|
case GroupOrder.FIRST: return trigger_module_default.groupOrderFirst;
|
|
@@ -2382,7 +2381,7 @@ const MultiSelectedOptions = ({ selectedOptions: e, small: t, width: n, testId:
|
|
|
2382
2381
|
} : e, P = /* @__PURE__ */ jsxs(Fragment$1, { children: [a, /* @__PURE__ */ jsxs("div", {
|
|
2383
2382
|
ref: v,
|
|
2384
2383
|
tabIndex: h,
|
|
2385
|
-
className: cx(trigger_module_default.trigger,
|
|
2384
|
+
className: cx(trigger_module_default.trigger, _ ? trigger_module_default.isOpen : "", d ? trigger_module_default.disabled : "", l ? trigger_module_default.small : "", u ? trigger_module_default.isInTable : "", E ? trigger_module_default.right : "", M),
|
|
2386
2385
|
onClick: (e) => {
|
|
2387
2386
|
e.stopPropagation(), requestAnimationFrame(() => {
|
|
2388
2387
|
i(e), typeof k == "function" && k();
|
|
@@ -2533,7 +2532,7 @@ let ActionTypes = /* @__PURE__ */ function(e) {
|
|
|
2533
2532
|
}({}), EventKey = /* @__PURE__ */ function(e) {
|
|
2534
2533
|
return e.RIGHT = "ArrowRight", e.LEFT = "ArrowLeft", e.UP = "ArrowUp", e.DOWN = "ArrowDown", e.ENTER = "Enter", e.ESC = "Escape", e.TAB = "Tab", e;
|
|
2535
2534
|
}({});
|
|
2536
|
-
const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFocus: r, disabled: i, disabledContext: a, onCreate:
|
|
2535
|
+
const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFocus: r, disabled: i, disabledContext: a, onCreate: s, onChange: l, selectedOptions: u, width: d, small: f, isFontLoaded: m, placeholder: h, firstSelectedOptionIndex: g, createAble: _, listRef: v, autoLayerWidth: y }) => {
|
|
2537
2536
|
let b = () => {
|
|
2538
2537
|
e.isLayerOpen && t({ type: ActionTypes.CLOSE_LAYER }), r();
|
|
2539
2538
|
}, x = () => t({ type: ActionTypes.OPEN_LAYER }), S = useRef(!0);
|
|
@@ -2543,21 +2542,21 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2543
2542
|
options: n
|
|
2544
2543
|
});
|
|
2545
2544
|
}, [n]);
|
|
2546
|
-
let C = (e,
|
|
2545
|
+
let C = (e, o, c) => {
|
|
2547
2546
|
if (!(i || a)) {
|
|
2548
|
-
if (
|
|
2549
|
-
if (
|
|
2550
|
-
else if (!
|
|
2551
|
-
let t = u.some((e) => String(e.value) === String(
|
|
2552
|
-
|
|
2553
|
-
} else
|
|
2547
|
+
if (c && c(), o) {
|
|
2548
|
+
if (o.createAble && s) s(o.value);
|
|
2549
|
+
else if (!o.disabled) if (Array.isArray(u)) {
|
|
2550
|
+
let t = u.some((e) => String(e.value) === String(o.value)) ? u.filter((e) => String(e.value) !== String(o.value)) : [...u, o];
|
|
2551
|
+
l && l(e, t);
|
|
2552
|
+
} else l && l(e, o);
|
|
2554
2553
|
}
|
|
2555
2554
|
t({
|
|
2556
2555
|
type: ActionTypes.CLEAR_SEARCH,
|
|
2557
2556
|
options: n
|
|
2558
2557
|
}), r();
|
|
2559
2558
|
}
|
|
2560
|
-
}, w = useCallback(() => d ? d === "auto" ? getWidestOptionWidth(n, f,
|
|
2559
|
+
}, w = useCallback(() => d ? d === "auto" ? getWidestOptionWidth(n, f, m, h) : d : "100%", [n, m]), T = useCallback((e) => y ? Math.max(getWidestOptionWidth(n, f, m, h), e?.width) : e?.width, [n, m]), { renderLayer: E, layerProps: D, triggerProps: O, triggerBounds: k } = useLayer({
|
|
2561
2560
|
isOpen: e?.isLayerOpen ?? !1,
|
|
2562
2561
|
overflowContainer: !0,
|
|
2563
2562
|
...placementOptions,
|
|
@@ -2585,10 +2584,10 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2585
2584
|
}, [e.isLayerOpen]);
|
|
2586
2585
|
let M = (e, t) => {
|
|
2587
2586
|
let n = u instanceof Array ? u.filter((e) => e.value !== t.value) : null;
|
|
2588
|
-
|
|
2587
|
+
l && l(e, n);
|
|
2589
2588
|
}, N = (e) => {
|
|
2590
2589
|
let t = u instanceof Array ? [] : { value: null };
|
|
2591
|
-
|
|
2590
|
+
l && l(e, t);
|
|
2592
2591
|
}, P = (e) => t({
|
|
2593
2592
|
type: ActionTypes.ON_CHANGE_SEARCH,
|
|
2594
2593
|
options: n,
|
|
@@ -2657,7 +2656,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2657
2656
|
triggerBounds: k
|
|
2658
2657
|
};
|
|
2659
2658
|
}, CustomSelect = (e) => {
|
|
2660
|
-
let { multi: t = !1, disabled: n = !1, error: r = null, warning: i = null, tooltip: a = null, options: o, selectedOptions:
|
|
2659
|
+
let { multi: t = !1, disabled: n = !1, error: r = null, warning: i = null, tooltip: a = null, options: o, selectedOptions: c, onCreate: l = null, placeholder: u = "", small: d = !1, tabIndex: m = 0, onFocus: h = () => {}, onBlur: g = () => {}, searchable: _ = !0, clearable: v = !1, maxTooltipWidth: y, closeOnOptionActionClick: b, isInTable: x = !1, groupOrder: S, firstSelectedOptionIndex: C = 0, right: w = !1, testId: T = void 0 } = e, E = useContext(DisabledContext), D = l !== null, O = useRef(null), [k, A] = useFocus(), j = useFontsReady(), [M, N] = useReducer(reducer, {
|
|
2661
2660
|
options: o,
|
|
2662
2661
|
firstSelectedOptionIndex: C
|
|
2663
2662
|
}, ({ options: e }) => ({
|
|
@@ -2682,7 +2681,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2682
2681
|
Object.values(EventKey).includes(e.key) && F(e.key, e);
|
|
2683
2682
|
},
|
|
2684
2683
|
children: [/* @__PURE__ */ jsx(Trigger, {
|
|
2685
|
-
selectedOptions:
|
|
2684
|
+
selectedOptions: c,
|
|
2686
2685
|
searchValue: M.searchValue,
|
|
2687
2686
|
isOpen: M.isLayerOpen,
|
|
2688
2687
|
focusedSelectedOptionIndex: M.triggerFocus.currentOption,
|
|
@@ -2696,7 +2695,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2696
2695
|
isInTable: x,
|
|
2697
2696
|
disabled: n || E,
|
|
2698
2697
|
clearable: v,
|
|
2699
|
-
tabIndex:
|
|
2698
|
+
tabIndex: m,
|
|
2700
2699
|
onClickTrigger: R,
|
|
2701
2700
|
onChangeSearch: z,
|
|
2702
2701
|
onClickDeselect: B,
|
|
@@ -2715,7 +2714,7 @@ const useCustomSelectLogic = ({ state: e, dispatch: t, options: n, setTriggerFoc
|
|
|
2715
2714
|
listRef: O,
|
|
2716
2715
|
isMulti: t,
|
|
2717
2716
|
sections: M.visibleOptions,
|
|
2718
|
-
selectedOptions:
|
|
2717
|
+
selectedOptions: c,
|
|
2719
2718
|
onSelectOption: (e, n) => {
|
|
2720
2719
|
G(e, n, t ? void 0 : W);
|
|
2721
2720
|
},
|
|
@@ -2835,11 +2834,11 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2835
2834
|
children: e
|
|
2836
2835
|
});
|
|
2837
2836
|
}, Pagination = ({ pagination: e }) => {
|
|
2838
|
-
let { rowCount: t, selectedPage: n, small: r, onSelectPage: i, rowsPerPage: a, errorMessageTemplate: o, testIds: s } = e,
|
|
2837
|
+
let { rowCount: t, selectedPage: n, small: r, onSelectPage: i, rowsPerPage: a, errorMessageTemplate: o, testIds: s } = e, l = Number(a?.value) === 0, u = numberOfPages(t, a), [d, f] = useState(String(n));
|
|
2839
2838
|
useEffect(() => {
|
|
2840
2839
|
f(String(n));
|
|
2841
2840
|
}, [n]);
|
|
2842
|
-
let { error: p } = validateSelectedPage(d, u, o),
|
|
2841
|
+
let { error: p } = validateSelectedPage(d, u, o), h = (e) => {
|
|
2843
2842
|
let { valid: t } = validateSelectedPage(e, u, o);
|
|
2844
2843
|
f(e), t && e !== "" && i && i(Number(e));
|
|
2845
2844
|
};
|
|
@@ -2850,7 +2849,7 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2850
2849
|
style: { flexShrink: 0 },
|
|
2851
2850
|
children: /* @__PURE__ */ jsx(Select, {
|
|
2852
2851
|
onChange: (e) => {
|
|
2853
|
-
a.onChange && a.onChange(e),
|
|
2852
|
+
a.onChange && a.onChange(e), h("1");
|
|
2854
2853
|
},
|
|
2855
2854
|
options: a.options,
|
|
2856
2855
|
native: !!a.options,
|
|
@@ -2864,16 +2863,16 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2864
2863
|
round: !0,
|
|
2865
2864
|
basic: !0,
|
|
2866
2865
|
icon: IconType.CHEVRON_DOUBLE_LEFT,
|
|
2867
|
-
onClick: () =>
|
|
2868
|
-
disabled:
|
|
2866
|
+
onClick: () => h("1"),
|
|
2867
|
+
disabled: l || n === 1
|
|
2869
2868
|
}),
|
|
2870
2869
|
/* @__PURE__ */ jsx(Button, {
|
|
2871
2870
|
small: r,
|
|
2872
2871
|
round: !0,
|
|
2873
2872
|
basic: !0,
|
|
2874
2873
|
icon: IconType.CHEVRON_LEFT,
|
|
2875
|
-
onClick: () =>
|
|
2876
|
-
disabled:
|
|
2874
|
+
onClick: () => h(String(Number(n) - 1)),
|
|
2875
|
+
disabled: l || n === 1
|
|
2877
2876
|
}),
|
|
2878
2877
|
/* @__PURE__ */ jsxs(InputGroup, {
|
|
2879
2878
|
small: r,
|
|
@@ -2882,9 +2881,9 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2882
2881
|
right: !0,
|
|
2883
2882
|
value: d,
|
|
2884
2883
|
placeholder: String(n),
|
|
2885
|
-
onChange: (e) =>
|
|
2884
|
+
onChange: (e) => h(e.target.value),
|
|
2886
2885
|
width: "50px",
|
|
2887
|
-
disabled:
|
|
2886
|
+
disabled: l || u <= 1,
|
|
2888
2887
|
error: p
|
|
2889
2888
|
}), /* @__PURE__ */ jsxs(InputGroupAddon, { children: ["of ", u] })]
|
|
2890
2889
|
}),
|
|
@@ -2893,16 +2892,16 @@ const InputGroupAddon = ({ children: e, groupOrder: t, small: n = !1 }) => {
|
|
|
2893
2892
|
round: !0,
|
|
2894
2893
|
basic: !0,
|
|
2895
2894
|
icon: IconType.CHEVRON_RIGHT,
|
|
2896
|
-
onClick: () =>
|
|
2897
|
-
disabled:
|
|
2895
|
+
onClick: () => h(String(Number(n) + 1)),
|
|
2896
|
+
disabled: l || n === u
|
|
2898
2897
|
}),
|
|
2899
2898
|
/* @__PURE__ */ jsx(Button, {
|
|
2900
2899
|
small: r,
|
|
2901
2900
|
round: !0,
|
|
2902
2901
|
basic: !0,
|
|
2903
2902
|
icon: IconType.CHEVRON_DOUBLE_RIGHT,
|
|
2904
|
-
onClick: () =>
|
|
2905
|
-
disabled:
|
|
2903
|
+
onClick: () => h(String(u)),
|
|
2904
|
+
disabled: l || n === u,
|
|
2906
2905
|
testId: s?.doubleRightBtn
|
|
2907
2906
|
})
|
|
2908
2907
|
]
|
|
@@ -2973,829 +2972,57 @@ const ExpandedContentRow = ({ colSpan: e, children: t, flush: n }) => /* @__PURE
|
|
|
2973
2972
|
return r && t ? e[n] || [] : i ? e : (console.warn("getHeaderAlignment: alignments array contains a mix of strings and arrays, returning an empty array."), []);
|
|
2974
2973
|
};
|
|
2975
2974
|
var cell_module_default = {
|
|
2976
|
-
inputInTable: "
|
|
2977
|
-
inputHover: "
|
|
2978
|
-
inputFocus: "
|
|
2979
|
-
inputError: "
|
|
2980
|
-
inputWarning: "
|
|
2981
|
-
inputDisabled: "
|
|
2982
|
-
hideScrollbars: "
|
|
2983
|
-
cell: "
|
|
2984
|
-
disabledLink: "
|
|
2985
|
-
inputWrapper: "
|
|
2986
|
-
numberInputWrapper: "
|
|
2987
|
-
breakWord: "
|
|
2988
|
-
inputCell: "
|
|
2989
|
-
sliderCell: "
|
|
2990
|
-
staticCell: "
|
|
2991
|
-
staticCellContent: "
|
|
2992
|
-
unit: "
|
|
2993
|
-
sortingCell: "
|
|
2994
|
-
sortingCellIcon: "
|
|
2995
|
-
icon: "
|
|
2996
|
-
checkBoxCell: "
|
|
2997
|
-
iconCellWrapper: "
|
|
2998
|
-
actionsCell: "
|
|
2999
|
-
rightAligned: "
|
|
3000
|
-
centerAligned: "
|
|
3001
|
-
leftAligned: "
|
|
3002
|
-
popover: "
|
|
3003
|
-
disabledPointerEvents: "
|
|
3004
|
-
|
|
3005
|
-
}
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
},
|
|
3025
|
-
let o = [];
|
|
3026
|
-
if (r) {
|
|
3027
|
-
let r = n.map((e) => e.fieldName).filter(Boolean);
|
|
3028
|
-
e.forEach((i, s) => {
|
|
3029
|
-
let c = n[s];
|
|
3030
|
-
!c || !c.fieldName || (c.fieldNameValidator ?? defaultFieldNameValidator)({
|
|
3031
|
-
value: i,
|
|
3032
|
-
defaultAllowedValues: r,
|
|
3033
|
-
columnIndex: s,
|
|
3034
|
-
fields: e,
|
|
3035
|
-
units: t
|
|
3036
|
-
}) || o.push(a("incorrectFieldName", {
|
|
3037
|
-
i: s + 1,
|
|
3038
|
-
correctName: c.fieldName || a("notExist"),
|
|
3039
|
-
wrongName: i || a("notApplicable")
|
|
3040
|
-
}));
|
|
3041
|
-
});
|
|
3042
|
-
}
|
|
3043
|
-
if (i) {
|
|
3044
|
-
let i = n.map((e) => e.validUnits), s = r ? 1 : 0;
|
|
3045
|
-
t.forEach((r, c) => {
|
|
3046
|
-
let l = n[c];
|
|
3047
|
-
if (!l) return;
|
|
3048
|
-
let u = l.unitsValidator ?? defaultUnitsValidator, d = i[c];
|
|
3049
|
-
u({
|
|
3050
|
-
value: r,
|
|
3051
|
-
defaultAllowedValues: d,
|
|
3052
|
-
columnIndex: c,
|
|
3053
|
-
fields: e,
|
|
3054
|
-
units: t
|
|
3055
|
-
}) || o.push(a("incorrectUnitRow", {
|
|
3056
|
-
unitRowIndex: s,
|
|
3057
|
-
i: c + 1,
|
|
3058
|
-
wrongUnit: r || a("notApplicable"),
|
|
3059
|
-
correctUnit: d?.join(",") || a("notExist")
|
|
3060
|
-
}));
|
|
3061
|
-
});
|
|
3062
|
-
}
|
|
3063
|
-
return o;
|
|
3064
|
-
}, validateValues = (e, t, n, r, i) => {
|
|
3065
|
-
let a = [];
|
|
3066
|
-
return e.forEach((e, o) => {
|
|
3067
|
-
e.forEach((e, s) => {
|
|
3068
|
-
let c = t[s];
|
|
3069
|
-
if (!c || !c.validator) return;
|
|
3070
|
-
let l = c.validator(e);
|
|
3071
|
-
if (l && typeof l == "string") {
|
|
3072
|
-
let e = r + o, t = i + s, c = n("rowColumn", {
|
|
3073
|
-
rowIndex: e,
|
|
3074
|
-
columnIndex: t
|
|
3075
|
-
}) ?? `(row ${e}, column ${t})`;
|
|
3076
|
-
a.push(`${l} ${c}`);
|
|
3077
|
-
}
|
|
3078
|
-
});
|
|
3079
|
-
}), a;
|
|
3080
|
-
}, hasHeaders$1 = (e, t, n) => {
|
|
3081
|
-
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);
|
|
3082
|
-
return {
|
|
3083
|
-
hasFieldNameHeader: c || d && !l && !p || d && f && !p,
|
|
3084
|
-
hasUnitHeader: l || u || d && f && !l && !p && !m || d && f && !p && !m
|
|
3085
|
-
};
|
|
3086
|
-
}, 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
|
-
}, guessMissingHeaders$1 = (e = [], t = [], n = [], r = []) => {
|
|
3097
|
-
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);
|
|
3098
|
-
return {
|
|
3099
|
-
effectiveFields: p,
|
|
3100
|
-
effectiveUnits: m,
|
|
3101
|
-
bodyRows: g,
|
|
3102
|
-
hasFieldNameHeader: d,
|
|
3103
|
-
hasUnitHeader: f
|
|
3104
|
-
};
|
|
3105
|
-
}, validate = ({ fields: e, units: t, rows: n, rules: r, t: i }) => {
|
|
3106
|
-
let a = asT(i);
|
|
3107
|
-
if (!Array.isArray(r) || r.length === 0) return {
|
|
3108
|
-
isValid: !0,
|
|
3109
|
-
errors: []
|
|
3110
|
-
};
|
|
3111
|
-
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);
|
|
3112
|
-
return f.length === 0 && (f = f.concat(validateHeadings(o, s, r, l, u, a), validateValues(c, r, a, d, 1))), {
|
|
3113
|
-
isValid: f.length === 0,
|
|
3114
|
-
errors: f
|
|
3115
|
-
};
|
|
3116
|
-
}, validationRegistry = new class {
|
|
3117
|
-
rules = /* @__PURE__ */ new Map();
|
|
3118
|
-
register(e, t) {
|
|
3119
|
-
this.rules.set(e, t);
|
|
3120
|
-
}
|
|
3121
|
-
get(e) {
|
|
3122
|
-
return this.rules.get(e);
|
|
3123
|
-
}
|
|
3124
|
-
unregister(e) {
|
|
3125
|
-
this.rules.delete(e);
|
|
3126
|
-
}
|
|
3127
|
-
clear() {
|
|
3128
|
-
this.rules.clear();
|
|
3129
|
-
}
|
|
3130
|
-
}(), ValidationScopeContext = createContext(null), useValidationScopeId = () => useContext(ValidationScopeContext), enTranslations = {
|
|
3131
|
-
cancel: "Cancel",
|
|
3132
|
-
chooseFile: "Choose file",
|
|
3133
|
-
copyDecimalComma: "Copy (decimal comma)",
|
|
3134
|
-
copyDecimalDot: "Copy (decimal dot)",
|
|
3135
|
-
copyToClipboard: "Copy to clipboard",
|
|
3136
|
-
copiedToClipboard: "Copied to clipboard",
|
|
3137
|
-
deleteAllRows: "Delete all rows",
|
|
3138
|
-
downloadFile: "Download file",
|
|
3139
|
-
export: "Export",
|
|
3140
|
-
help: "Help",
|
|
3141
|
-
import: "Import",
|
|
3142
|
-
noFileSelected: "No file selected",
|
|
3143
|
-
notApplicable: "N/A",
|
|
3144
|
-
notExist: "not exist",
|
|
3145
|
-
okay: "Okay",
|
|
3146
|
-
uploadCapitalized: "Upload",
|
|
3147
|
-
uploadFile: "Upload file",
|
|
3148
|
-
pasteShortcutHint: "You can also press Ctrl+V or Command+V to paste from clipboard",
|
|
3149
|
-
pasteFromClipboard: "Paste from clipboard",
|
|
3150
|
-
clipboardIsEmpty: "Clipboard is empty",
|
|
3151
|
-
clipboardReadFailed: "Unable to read data from clipboard. Check formatting or try Paste with Review.",
|
|
3152
|
-
clipboardReadNotAllowed: "Your browser did not allow reading the clipboard. Upgrade browser or try Paste with Review.",
|
|
3153
|
-
pasteSuccessful: "Paste successful",
|
|
3154
|
-
pasteWithReview: "Paste with review",
|
|
3155
|
-
pasteWithReviewRoundBrackets: "Paste (with review)",
|
|
3156
|
-
quickPasteFromClipboard: "Quick paste from clipboard",
|
|
3157
|
-
unableToCopyToClipboard: "Unable to copy to clipboard",
|
|
3158
|
-
fileParsingFailed: "Failed to read or validate the file. Please check the format and try again.",
|
|
3159
|
-
importWarning: "Large data detected: More than 500 rows have been imported. You can choose to import all or downsample for better performance.",
|
|
3160
|
-
importLimitExceeded: "Import failed: The data exceeds the 5000-row limit. Please reduce the number of rows and try again.",
|
|
3161
|
-
importingData: "Importing data",
|
|
3162
|
-
incorrectFieldName: "Incorrect field name (row 0, column {{i}}: has name {{wrongName}}, but should be {{correctName}})",
|
|
3163
|
-
incorrectNumberOfDataColumns: "Incorrect number of data columns, expected {{expectedLengthMessage}} columns in row {{dataRowStartIndex}}",
|
|
3164
|
-
incorrectNumberOfFieldNameHeaderColumns: "Incorrect number of field name header columns, expected {{expectedLengthMessage}} columns in row 0",
|
|
3165
|
-
incorrectNumberOfUnitHeaderColumns: "Incorrect number of unit header columns, expected {{expectedLengthMessage}} columns in row 1",
|
|
3166
|
-
incorrectUnitRow: "Incorrect unit (row {{unitRowIndex}}, column {{i}}: has unit [{{wrongUnit}}], but should be [{{correctUnit}}])",
|
|
3167
|
-
jsonParseFailed: "JSON parse failed",
|
|
3168
|
-
pasteYourTableDataHereToImportIt: "Paste your table data here to import it",
|
|
3169
|
-
rowColumn: "(row {{rowIndex}}, column {{columnIndex}})",
|
|
3170
|
-
theValuesCanBeSeparatedByDifferentDelimiters: "The values can be separated by different delimiters",
|
|
3171
|
-
unableToImportPleaseCorrectError: "Unable to import - {{rows}} rows have errors. Please correct input data and try again.",
|
|
3172
|
-
unableToPrepareExportData: "Unable to prepare export – see console for details.",
|
|
3173
|
-
validInputForPaste: "Valid input for paste.",
|
|
3174
|
-
wrongFileFormatExpectedOneOf: "Wrong file format: expected one of",
|
|
3175
|
-
youCanImportDataByPastingOrByMessage: "You can import data by pasting (e.g. from a spreadsheet), or by uploading a text file ( .txt or .csv ).",
|
|
3176
|
-
commasAsDecimals: "Comma is treated as a decimal separator when it is the only separator",
|
|
3177
|
-
deletePastedContent: "Delete pasted content",
|
|
3178
|
-
downsampled: "Downsampled",
|
|
3179
|
-
downsampleSuccess: "Successfully downsampled from {{from}} rows to {{to}} rows.",
|
|
3180
|
-
downsampleTooltip: "Reduces number of data rows (decimation) using the Ramer–Douglas–Peucker algorithm.",
|
|
3181
|
-
extraSeparators: "Two or more separators detected. Kept only last one as decimal separator, please control your import results",
|
|
3182
|
-
noDataPastedYet: "No data pasted yet.",
|
|
3183
|
-
semicolonSeparatedValues: "Semicolon-separated values",
|
|
3184
|
-
tabSeparatedValues: "Tab-separated values",
|
|
3185
|
-
examples: "Examples",
|
|
3186
|
-
smartUpload_description: "Upload image and extract table content using a LLM",
|
|
3187
|
-
smartUpload_smartUpload: "Smart Upload",
|
|
3188
|
-
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"
|
|
3189
|
-
}, interpolate = (e, t = {}) => e?.replace(/\{\{(\w+)\}\}/g, (e, n) => t?.[n] === void 0 ? "" : String(t?.[n])), useTranslationMap = (e) => useMemo(() => {
|
|
3190
|
-
let t = Object.keys(enTranslations).reduce((t, n) => {
|
|
3191
|
-
let r = enTranslations?.[n];
|
|
3192
|
-
return t[n] = e?.[n] ?? r, t;
|
|
3193
|
-
}, {});
|
|
3194
|
-
return (e, n) => {
|
|
3195
|
-
let r = t[e];
|
|
3196
|
-
return n ? interpolate(r, n) : r;
|
|
3197
|
-
};
|
|
3198
|
-
}, [e]);
|
|
3199
|
-
function useScopedValidate() {
|
|
3200
|
-
let e = useValidationScopeId(), t = useTranslationMap(), n;
|
|
3201
|
-
return {
|
|
3202
|
-
scopeId: e,
|
|
3203
|
-
rules: n,
|
|
3204
|
-
validate: (r) => {
|
|
3205
|
-
let { fields: i = [], units: a = [], rows: o, t: s = t, options: c } = r;
|
|
3206
|
-
return n = e ? validationRegistry.get(e) : void 0, n ? validate({
|
|
3207
|
-
fields: i,
|
|
3208
|
-
units: a,
|
|
3209
|
-
rows: o,
|
|
3210
|
-
rules: n,
|
|
3211
|
-
t: s
|
|
3212
|
-
}) : {
|
|
3213
|
-
isValid: !0,
|
|
3214
|
-
errors: []
|
|
3215
|
-
};
|
|
3216
|
-
}
|
|
3217
|
-
};
|
|
3218
|
-
}
|
|
3219
|
-
function useRegisterValidationRules(e, t) {
|
|
3220
|
-
useEffect(() => {
|
|
3221
|
-
if (!(!e || !t)) return validationRegistry.register(e, t), () => validationRegistry.unregister(e);
|
|
3222
|
-
}, [e, t]);
|
|
3223
|
-
}
|
|
3224
|
-
var counter = 0;
|
|
3225
|
-
const nextScopeId = () => (counter += 1, `table-${counter}`), depthRound = (e) => Math.round(e * 100) / 100, joinArray = (e) => e.join(", ").replace(/,\s*$/, ""), guessDelimiter = (e) => {
|
|
3226
|
-
let t = e.substring(0, 200), n = (t.match(/\t/g) ?? [])?.length, r = (t.match(/;/g) ?? [])?.length;
|
|
3227
|
-
return n === 0 && r === 0 ? "," : n > r ? " " : ";";
|
|
3228
|
-
}, allowedMimes = [
|
|
3229
|
-
"text/csv",
|
|
3230
|
-
"text/plain",
|
|
3231
|
-
"application/json",
|
|
3232
|
-
"application/vnd.ms-excel"
|
|
3233
|
-
], isAllowedFileType = (e) => allowedMimes.includes(e.type), isFile = (e) => e instanceof File, isJson = (e) => e.trim().startsWith("["), isCustomJson = (e) => {
|
|
3234
|
-
try {
|
|
3235
|
-
return !!JSON.parse(e)?.path;
|
|
3236
|
-
} catch {
|
|
3237
|
-
return !1;
|
|
3238
|
-
}
|
|
3239
|
-
}, readFile$1 = (e) => new Promise((t, n) => {
|
|
3240
|
-
let r = new FileReader();
|
|
3241
|
-
r.onload = () => t(String(r.result)), r.onerror = n, r.readAsText(e);
|
|
3242
|
-
}), replaceWithDot = (e) => e.replace(",", "."), replaceDataCommasWithDots = (e) => e.map((e) => e.map((e) => replaceWithDot(e))), hasHeaders = (e, t, n) => {
|
|
3243
|
-
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;
|
|
3244
|
-
return {
|
|
3245
|
-
hasFieldNameHeader: o || i && !s && !l || i && a && !l,
|
|
3246
|
-
hasUnitHeader: s || c || i && a && !s && !l && !u || i && a && !l && !u
|
|
3247
|
-
};
|
|
3248
|
-
};
|
|
3249
|
-
var buildHeadersFromRules = (e, t) => {
|
|
3250
|
-
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();
|
|
3251
|
-
return {
|
|
3252
|
-
fieldHeader: r,
|
|
3253
|
-
unitHeader: i,
|
|
3254
|
-
allowedUnits: a
|
|
3255
|
-
};
|
|
3256
|
-
};
|
|
3257
|
-
const guessMissingHeaders = (e, t) => {
|
|
3258
|
-
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;
|
|
3259
|
-
return !s && !c ? l = [
|
|
3260
|
-
i,
|
|
3261
|
-
a,
|
|
3262
|
-
...n
|
|
3263
|
-
] : !s && c ? l = [i, ...n] : s && !c && (l = [
|
|
3264
|
-
n[0] ?? [],
|
|
3265
|
-
a,
|
|
3266
|
-
...n.slice(1)
|
|
3267
|
-
]), {
|
|
3268
|
-
matrix: l,
|
|
3269
|
-
hasFieldNameHeader: s,
|
|
3270
|
-
hasUnitHeader: c
|
|
3271
|
-
};
|
|
3272
|
-
}, mapCustomJsonToRows = (e) => {
|
|
3273
|
-
let t = JSON.parse(e).path.map((e) => [
|
|
3274
|
-
depthRound(e.md),
|
|
3275
|
-
depthRound(e.inclination),
|
|
3276
|
-
depthRound(e.gridAzimuth)
|
|
3277
|
-
]);
|
|
3278
|
-
return t.unshift([
|
|
3279
|
-
"m",
|
|
3280
|
-
"deg",
|
|
3281
|
-
"deg"
|
|
3282
|
-
]), t;
|
|
3283
|
-
};
|
|
3284
|
-
var basePapaConfig = {
|
|
3285
|
-
skipEmptyLines: !0,
|
|
3286
|
-
transform: (e) => e?.trim(),
|
|
3287
|
-
delimiter: guessDelimiter
|
|
3288
|
-
}, initParsedResult = () => ({
|
|
3289
|
-
isValid: !1,
|
|
3290
|
-
fields: [],
|
|
3291
|
-
units: [],
|
|
3292
|
-
rows: [],
|
|
3293
|
-
errors: []
|
|
3294
|
-
}), buildResultFromMatrix = (e, t) => {
|
|
3295
|
-
let n = initParsedResult(), { matrix: r } = guessMissingHeaders(e, t.validationRules);
|
|
3296
|
-
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;
|
|
3297
|
-
}, parseJson = async (e, t, n) => {
|
|
3298
|
-
let r = JSON.parse(e);
|
|
3299
|
-
return buildResultFromMatrix(r, t);
|
|
3300
|
-
}, parseCustomJson = async (e, t, n) => {
|
|
3301
|
-
let r = mapCustomJsonToRows(e).map((e) => e.map(String));
|
|
3302
|
-
return buildResultFromMatrix(r, t);
|
|
3303
|
-
}, parseDSV = (e, t, n) => new Promise((n) => {
|
|
3304
|
-
let { importLimit: r } = t;
|
|
3305
|
-
Papa.parse(e, {
|
|
3306
|
-
...basePapaConfig,
|
|
3307
|
-
preview: r,
|
|
3308
|
-
complete: (e) => {
|
|
3309
|
-
let r = e.data ?? [];
|
|
3310
|
-
n(buildResultFromMatrix(r, t));
|
|
3311
|
-
}
|
|
3312
|
-
});
|
|
3313
|
-
});
|
|
3314
|
-
const parse = async (e, t, n) => {
|
|
3315
|
-
let r = initParsedResult();
|
|
3316
|
-
try {
|
|
3317
|
-
if (isFile(e) && !isAllowedFileType(e)) return r.errors.push(`${n("wrongFileFormatExpectedOneOf")} ${joinArray(Array.from(allowedMimes))}`), r;
|
|
3318
|
-
let i = isFile(e) ? await readFile$1(e) : String(e);
|
|
3319
|
-
return isJson(i) ? await parseJson(i, t, n) : isCustomJson(i) ? await parseCustomJson(i, t, n) : await parseDSV(e, t, n);
|
|
3320
|
-
} catch (e) {
|
|
3321
|
-
return r.errors.push(e?.message ?? "Unknown parse error"), r;
|
|
3322
|
-
}
|
|
3323
|
-
}, unParse = (e, t, n, r) => {
|
|
3324
|
-
let i = r?.delimiter ?? ",", a = [
|
|
3325
|
-
e,
|
|
3326
|
-
t,
|
|
3327
|
-
...n
|
|
3328
|
-
].filter(Boolean);
|
|
3329
|
-
return Papa.unparse(a, {
|
|
3330
|
-
quotes: !1,
|
|
3331
|
-
header: !0,
|
|
3332
|
-
delimiter: i
|
|
3333
|
-
});
|
|
3334
|
-
};
|
|
3335
|
-
function useScopedParser(e = {}) {
|
|
3336
|
-
let t = useValidationScopeId(), n = (t ? validationRegistry.get(t) : []) ?? [];
|
|
3337
|
-
return {
|
|
3338
|
-
scopeId: t,
|
|
3339
|
-
rules: n,
|
|
3340
|
-
parse: async (t, r, i) => parse(t, {
|
|
3341
|
-
validationRules: n,
|
|
3342
|
-
...e,
|
|
3343
|
-
...i
|
|
3344
|
-
}, r)
|
|
3345
|
-
};
|
|
3346
|
-
}
|
|
3347
|
-
function useScopedParseAndValidate() {
|
|
3348
|
-
let { parse: e, scopeId: t, rules: n } = useScopedParser(), { validate: r } = useScopedValidate();
|
|
3349
|
-
return {
|
|
3350
|
-
scopeId: t,
|
|
3351
|
-
rules: n,
|
|
3352
|
-
parseAndValidate: async (t, n) => {
|
|
3353
|
-
let i = await e(t, n), { isValid: a, errors: o } = r({
|
|
3354
|
-
fields: i.fields,
|
|
3355
|
-
units: i.units,
|
|
3356
|
-
rows: i.rows,
|
|
3357
|
-
t: n
|
|
3358
|
-
});
|
|
3359
|
-
return {
|
|
3360
|
-
...i,
|
|
3361
|
-
errors: [...i.errors, ...o],
|
|
3362
|
-
isValid: a && [...i.errors, ...o].length === 0
|
|
3363
|
-
};
|
|
3364
|
-
}
|
|
3365
|
-
};
|
|
3366
|
-
}
|
|
3367
|
-
const injectScopeIntoActions = (e, t) => {
|
|
3368
|
-
if (!e) return e;
|
|
3369
|
-
if (isValidElement(e)) return cloneElement(e, { __validationScopeId: t });
|
|
3370
|
-
if (Array.isArray(e)) return e.map((e) => injectScopeIntoActions(e, t));
|
|
3371
|
-
if (typeof e == "object") {
|
|
3372
|
-
let r = e, i = [
|
|
3373
|
-
"childComponent",
|
|
3374
|
-
"component",
|
|
3375
|
-
"render",
|
|
3376
|
-
"element"
|
|
3377
|
-
], o = !1, s = { ...r };
|
|
3378
|
-
for (let e of i) {
|
|
3379
|
-
let i = r[e];
|
|
3380
|
-
i && isValidElement(i) && (s[e] = cloneElement(i, { __validationScopeId: t }), o = !0);
|
|
3381
|
-
}
|
|
3382
|
-
for (let [e, n] of Object.entries(r)) if (Array.isArray(n)) {
|
|
3383
|
-
let r = n.map((e) => injectScopeIntoActions(e, t));
|
|
3384
|
-
r !== n && (s[e] = r, o = !0);
|
|
3385
|
-
}
|
|
3386
|
-
return o ? s : e;
|
|
3387
|
-
}
|
|
3388
|
-
return e;
|
|
3389
|
-
}, withValidationScope = (e) => {
|
|
3390
|
-
let t = forwardRef((t, n) => {
|
|
3391
|
-
let r = useRef(nextScopeId()), i = useMemo(() => {
|
|
3392
|
-
let e = injectScopeIntoActions(t.table?.actions, r.current);
|
|
3393
|
-
return {
|
|
3394
|
-
...t.table,
|
|
3395
|
-
actions: e
|
|
3396
|
-
};
|
|
3397
|
-
}, [t.table]);
|
|
3398
|
-
return /* @__PURE__ */ jsx(ValidationScopeContext.Provider, {
|
|
3399
|
-
value: r.current,
|
|
3400
|
-
children: /* @__PURE__ */ jsx(e, {
|
|
3401
|
-
ref: n,
|
|
3402
|
-
...t,
|
|
3403
|
-
table: i
|
|
3404
|
-
})
|
|
3405
|
-
});
|
|
3406
|
-
});
|
|
3407
|
-
return t.displayName = `withValidationScope(${e.displayName || e.name || "Component"})`, memo(t);
|
|
3408
|
-
}, getOverlayContainer = (e) => {
|
|
3409
|
-
let t = e?.closest("#scrollWrapper") ?? null ?? ((e) => {
|
|
3410
|
-
let t = e;
|
|
3411
|
-
for (; t && t !== document.body;) {
|
|
3412
|
-
let e = getComputedStyle(t);
|
|
3413
|
-
if ((/(auto|scroll|overlay)/.test(e.overflowY) || /(auto|scroll|overlay)/.test(e.overflow)) && t.scrollHeight > t.clientHeight) return t;
|
|
3414
|
-
t = t.parentElement;
|
|
3415
|
-
}
|
|
3416
|
-
return document.scrollingElement || document.body;
|
|
3417
|
-
})(e) ?? document.body;
|
|
3418
|
-
return t === document.documentElement || t === document.scrollingElement || t === document.body || getComputedStyle(t).position === "static" && (t.style.position = "relative"), t;
|
|
3419
|
-
}, getInputAtIndex = (e, t, n) => {
|
|
3420
|
-
if (!e) return null;
|
|
3421
|
-
let r = e.querySelector(`tr:nth-child(${t + 1})`);
|
|
3422
|
-
if (!r) return null;
|
|
3423
|
-
let i = r.querySelector(`td:nth-child(${n + 1})`);
|
|
3424
|
-
return i ? i.querySelector("input") : null;
|
|
3425
|
-
}, focusInputAtIndex = (e, t, n) => {
|
|
3426
|
-
let r = getInputAtIndex(e, t, n);
|
|
3427
|
-
r && r.focus();
|
|
3428
|
-
}, drawSelectionFrame = (e, t, n) => {
|
|
3429
|
-
if (!t || !n) return;
|
|
3430
|
-
let r = e.getBoundingClientRect(), i = t?.getBoundingClientRect(), a = n?.getBoundingClientRect(), o = Math.round(i?.left - r.left + e.scrollLeft), s = Math.round(i?.top - r.top + e.scrollTop), c = Math.round(a?.right - r.left + e.scrollLeft), l = Math.round(a?.bottom - r.top + e.scrollTop), u = document.createElement("div");
|
|
3431
|
-
u.className = "selection-frame", u.style.position = "absolute", u.style.pointerEvents = "none", u.style.zIndex = "4", u.style.left = `${o}px`, u.style.top = `${s}px`, u.style.width = `${c - o}px`, u.style.height = `${l - s}px`, u.style.border = "1px solid var(--color-border-focus)", u.style.borderRadius = "0", e.appendChild(u);
|
|
3432
|
-
}, removeSelectionFrame = (e) => {
|
|
3433
|
-
e.querySelectorAll(".selection-frame,.drag-handle").forEach((e) => e.remove());
|
|
3434
|
-
}, clamp = (e, t, n) => Math.min(n, Math.max(t, e)), normalizeClipboard = (e) => e?.replace(/\r\n/g, "\n")?.replace(/\r/g, "\n"), toGrid = (e) => (e?.endsWith("\n") ? e?.slice(0, -1)?.split("\n") : e?.split("\n"))?.filter(Boolean)?.map((e) => e?.split(" ")), snapshotRows = (e) => e?.map((e) => e?.cells?.map((e) => String(e?.value ?? ""))), buildReplacementRow = (e, t, n, r) => {
|
|
3435
|
-
let i = Math.min(t?.length, Math.max(r - n, 0)), a = e ? e?.slice() : Array(r)?.fill("");
|
|
3436
|
-
for (let e = 0; e < i; e++) a[n + e] = t?.[e] ?? "";
|
|
3437
|
-
return a;
|
|
3438
|
-
}, KEYS = {
|
|
3439
|
-
ARROW_UP: "ArrowUp",
|
|
3440
|
-
ARROW_DOWN: "ArrowDown",
|
|
3441
|
-
ARROW_LEFT: "ArrowLeft",
|
|
3442
|
-
ARROW_RIGHT: "ArrowRight",
|
|
3443
|
-
DELETE: "Delete",
|
|
3444
|
-
BACKSPACE: "Backspace",
|
|
3445
|
-
SHIFT: "Shift",
|
|
3446
|
-
A: "a",
|
|
3447
|
-
A_UPPER: "A"
|
|
3448
|
-
}, ARROW_KEYS = [
|
|
3449
|
-
KEYS.ARROW_UP,
|
|
3450
|
-
KEYS.ARROW_DOWN,
|
|
3451
|
-
KEYS.ARROW_LEFT,
|
|
3452
|
-
KEYS.ARROW_RIGHT
|
|
3453
|
-
], onMouseDown = (e, t, n, r, i, a) => {
|
|
3454
|
-
let o = e.target.closest("td");
|
|
3455
|
-
if (!o) return;
|
|
3456
|
-
let s = Number(o.dataset.rowIndex), c = Number(o.dataset.columnIndex);
|
|
3457
|
-
if (!(Number.isNaN(s) || Number.isNaN(c))) {
|
|
3458
|
-
if (e.shiftKey) {
|
|
3459
|
-
let e = t ?? (n ? {
|
|
3460
|
-
row: n.row.start,
|
|
3461
|
-
column: n.column.start
|
|
3462
|
-
} : {
|
|
3463
|
-
row: s,
|
|
3464
|
-
column: c
|
|
3465
|
-
});
|
|
3466
|
-
r(e), a({
|
|
3467
|
-
row: {
|
|
3468
|
-
start: Math.min(e.row, s),
|
|
3469
|
-
end: Math.max(e.row, s)
|
|
3470
|
-
},
|
|
3471
|
-
column: {
|
|
3472
|
-
start: Math.min(e.column, c),
|
|
3473
|
-
end: Math.max(e.column, c)
|
|
3474
|
-
}
|
|
3475
|
-
}), i(!1);
|
|
3476
|
-
return;
|
|
3477
|
-
}
|
|
3478
|
-
r({
|
|
3479
|
-
row: s,
|
|
3480
|
-
column: c
|
|
3481
|
-
}), a({
|
|
3482
|
-
row: {
|
|
3483
|
-
start: s,
|
|
3484
|
-
end: s
|
|
3485
|
-
},
|
|
3486
|
-
column: {
|
|
3487
|
-
start: c,
|
|
3488
|
-
end: c
|
|
3489
|
-
}
|
|
3490
|
-
}), i(!0);
|
|
3491
|
-
}
|
|
3492
|
-
}, onMouseUp = (e, t) => {
|
|
3493
|
-
e(void 0), t(!1);
|
|
3494
|
-
}, onMouseMove = (e, t, n) => {
|
|
3495
|
-
if (e.preventDefault(), !t) return;
|
|
3496
|
-
let r = e?.currentTarget ?? e.target, { clientX: i, clientY: a } = e, o = document.elementFromPoint(i, a);
|
|
3497
|
-
if (!o) return;
|
|
3498
|
-
let s = o.closest("td");
|
|
3499
|
-
if (!s || !r?.contains(s)) return;
|
|
3500
|
-
let c = s.getAttribute("data-row-index"), l = s.getAttribute("data-column-index"), u = c == null ? NaN : parseInt(c, 10), d = l == null ? NaN : parseInt(l, 10);
|
|
3501
|
-
Number.isNaN(u) || Number.isNaN(d) || n(u, d);
|
|
3502
|
-
}, onKeyUp = (e, t) => {
|
|
3503
|
-
e.key === KEYS.SHIFT && t(void 0);
|
|
3504
|
-
}, onBlur = (e, t, n) => {
|
|
3505
|
-
e.currentTarget.contains(e.relatedTarget) || (t(void 0), n(void 0));
|
|
3506
|
-
}, onKeyDown = (e, t) => {
|
|
3507
|
-
let { rows: n, selectedIndexes: r, startIndex: i, setStartIndex: a, setSelectedIndexes: o, focusInputAtIndex: s, validate: c, onPasteApply: l } = t;
|
|
3508
|
-
if ((e.key === KEYS.A || e.key === KEYS.A_UPPER) && (e.metaKey || e.ctrlKey)) {
|
|
3509
|
-
n?.length && n[0]?.cells?.length && (e.preventDefault(), o({
|
|
3510
|
-
row: {
|
|
3511
|
-
start: 0,
|
|
3512
|
-
end: n.length - 1
|
|
3513
|
-
},
|
|
3514
|
-
column: {
|
|
3515
|
-
start: 0,
|
|
3516
|
-
end: n[0].cells.length - 1
|
|
3517
|
-
}
|
|
3518
|
-
}));
|
|
3519
|
-
return;
|
|
3520
|
-
}
|
|
3521
|
-
if (!n?.length || !n[0]?.cells?.length) return;
|
|
3522
|
-
if ((e.key === KEYS.DELETE || e.key === KEYS.BACKSPACE) && r) {
|
|
3523
|
-
e.preventDefault();
|
|
3524
|
-
let t = n.map((e) => e.cells.map((e) => String(e?.value ?? ""))), { row: i, column: a } = r;
|
|
3525
|
-
for (let e = i.start; e <= i.end; e++) for (let n = a.start; n <= a.end; n++) t[e][n] = "";
|
|
3526
|
-
let o = Array(i.end - i.start + 1).fill(null).map(() => Array(a.end - a.start + 1).fill("")), u = {
|
|
3527
|
-
row: {
|
|
3528
|
-
start: i.start,
|
|
3529
|
-
end: i.end
|
|
3530
|
-
},
|
|
3531
|
-
column: {
|
|
3532
|
-
start: a.start,
|
|
3533
|
-
end: a.end
|
|
3534
|
-
}
|
|
3535
|
-
}, { errors: d, isValid: f } = c({ rows: t });
|
|
3536
|
-
l?.({
|
|
3537
|
-
allValues: t,
|
|
3538
|
-
affectedRange: u,
|
|
3539
|
-
insertedValues: o,
|
|
3540
|
-
errors: d,
|
|
3541
|
-
isValid: f
|
|
3542
|
-
}), s(i.start, a.start);
|
|
3543
|
-
return;
|
|
3544
|
-
}
|
|
3545
|
-
if (!((e) => ARROW_KEYS.includes(e))(e.key) || !e.shiftKey) return;
|
|
3546
|
-
e.preventDefault();
|
|
3547
|
-
let u = r ?? {
|
|
3548
|
-
row: {
|
|
3549
|
-
start: 0,
|
|
3550
|
-
end: 0
|
|
3551
|
-
},
|
|
3552
|
-
column: {
|
|
3553
|
-
start: 0,
|
|
3554
|
-
end: 0
|
|
3555
|
-
}
|
|
3556
|
-
}, d = n.length - 1, f = n[0].cells.length - 1, p = e.key === KEYS.ARROW_UP ? {
|
|
3557
|
-
dr: -1,
|
|
3558
|
-
dc: 0
|
|
3559
|
-
} : e.key === KEYS.ARROW_DOWN ? {
|
|
3560
|
-
dr: 1,
|
|
3561
|
-
dc: 0
|
|
3562
|
-
} : e.key === KEYS.ARROW_LEFT ? {
|
|
3563
|
-
dr: 0,
|
|
3564
|
-
dc: -1
|
|
3565
|
-
} : {
|
|
3566
|
-
dr: 0,
|
|
3567
|
-
dc: 1
|
|
3568
|
-
};
|
|
3569
|
-
if (e.shiftKey) {
|
|
3570
|
-
let e = i ?? {
|
|
3571
|
-
row: u.row.start,
|
|
3572
|
-
column: u.column.start
|
|
3573
|
-
}, t = {
|
|
3574
|
-
row: e.row === u.row.start ? u.row.end : u.row.start,
|
|
3575
|
-
column: e.column === u.column.start ? u.column.end : u.column.start
|
|
3576
|
-
}, n = {
|
|
3577
|
-
row: clamp(t.row + p.dr, 0, d),
|
|
3578
|
-
column: clamp(t.column + p.dc, 0, f)
|
|
3579
|
-
}, r = {
|
|
3580
|
-
row: {
|
|
3581
|
-
start: Math.min(e.row, n.row),
|
|
3582
|
-
end: Math.max(e.row, n.row)
|
|
3583
|
-
},
|
|
3584
|
-
column: {
|
|
3585
|
-
start: Math.min(e.column, n.column),
|
|
3586
|
-
end: Math.max(e.column, n.column)
|
|
3587
|
-
}
|
|
3588
|
-
};
|
|
3589
|
-
i || a({
|
|
3590
|
-
row: e.row,
|
|
3591
|
-
column: e.column
|
|
3592
|
-
}), o(r);
|
|
3593
|
-
} else {
|
|
3594
|
-
let e = {
|
|
3595
|
-
row: u.row.end,
|
|
3596
|
-
column: u.column.end
|
|
3597
|
-
}, t = {
|
|
3598
|
-
row: clamp(e.row + p.dr, 0, d),
|
|
3599
|
-
column: clamp(e.column + p.dc, 0, f)
|
|
3600
|
-
};
|
|
3601
|
-
a(void 0), o({
|
|
3602
|
-
row: {
|
|
3603
|
-
start: t.row,
|
|
3604
|
-
end: t.row
|
|
3605
|
-
},
|
|
3606
|
-
column: {
|
|
3607
|
-
start: t.column,
|
|
3608
|
-
end: t.column
|
|
3609
|
-
}
|
|
3610
|
-
}), s(t.row, t.column);
|
|
3611
|
-
}
|
|
3612
|
-
}, CellSelectionContext = createContext({
|
|
3613
|
-
selectedIndexes: void 0,
|
|
3614
|
-
setSelectedIndexes: () => {}
|
|
3615
|
-
}), useCellSelection = (e, t, n, r) => {
|
|
3616
|
-
if (!e) return {
|
|
3617
|
-
selectedIndexes: void 0,
|
|
3618
|
-
setSelectedIndexes: () => {},
|
|
3619
|
-
onCopy: () => {},
|
|
3620
|
-
onPaste: () => {},
|
|
3621
|
-
onKeyDown: () => {},
|
|
3622
|
-
onKeyUp: () => {},
|
|
3623
|
-
onMouseUp: () => {},
|
|
3624
|
-
onBlur: () => {},
|
|
3625
|
-
onMouseDown: () => {},
|
|
3626
|
-
onMouseMove: () => {}
|
|
3627
|
-
};
|
|
3628
|
-
let [i, a] = useState(void 0), [o, s] = useState(void 0), [c, u] = useState(!1), { validate: d } = useScopedValidate(), f = () => getOverlayContainer(t.current);
|
|
3629
|
-
useEffect(() => {
|
|
3630
|
-
let e = f();
|
|
3631
|
-
if (!e) return;
|
|
3632
|
-
let t = e === document.documentElement || e === document.body || e === document.scrollingElement, n = null, r = () => {
|
|
3633
|
-
n ??= requestAnimationFrame(() => {
|
|
3634
|
-
n = null, i ? C() : w();
|
|
3635
|
-
});
|
|
3636
|
-
}, a = new AbortController();
|
|
3637
|
-
return e.addEventListener("scroll", r, {
|
|
3638
|
-
passive: !0,
|
|
3639
|
-
signal: a.signal
|
|
3640
|
-
}), t && window.addEventListener("scroll", r, {
|
|
3641
|
-
passive: !0,
|
|
3642
|
-
signal: a.signal
|
|
3643
|
-
}), window.addEventListener("resize", r, {
|
|
3644
|
-
passive: !0,
|
|
3645
|
-
signal: a.signal
|
|
3646
|
-
}), r(), () => {
|
|
3647
|
-
n != null && cancelAnimationFrame(n), a.abort(), w();
|
|
3648
|
-
};
|
|
3649
|
-
}, [i]);
|
|
3650
|
-
let p = (e, n) => focusInputAtIndex(t.current, e, n), m = (e) => {
|
|
3651
|
-
if (!i) return;
|
|
3652
|
-
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");
|
|
3653
|
-
if (!t) return;
|
|
3654
|
-
if (e?.clipboardData) {
|
|
3655
|
-
e.clipboardData.setData("text/plain", t), e.preventDefault();
|
|
3656
|
-
return;
|
|
3657
|
-
}
|
|
3658
|
-
if (navigator?.clipboard?.writeText) {
|
|
3659
|
-
navigator.clipboard.writeText(t).catch(() => {
|
|
3660
|
-
let e = document.createElement("textarea");
|
|
3661
|
-
e.value = t, e.style.position = "fixed", e.style.opacity = "0", document.body.appendChild(e), e.select();
|
|
3662
|
-
try {
|
|
3663
|
-
document.execCommand("copy");
|
|
3664
|
-
} catch {}
|
|
3665
|
-
document.body.removeChild(e);
|
|
3666
|
-
});
|
|
3667
|
-
return;
|
|
3668
|
-
}
|
|
3669
|
-
let r = document.createElement("textarea");
|
|
3670
|
-
r.value = t, r.style.position = "fixed", r.style.opacity = "0", document.body.appendChild(r), r.select();
|
|
3671
|
-
try {
|
|
3672
|
-
document.execCommand("copy");
|
|
3673
|
-
} catch {}
|
|
3674
|
-
document.body.removeChild(r);
|
|
3675
|
-
}, g = (e) => {
|
|
3676
|
-
e.preventDefault();
|
|
3677
|
-
let t = e?.clipboardData?.getData("text") || "", a = normalizeClipboard(t), o = toGrid(a);
|
|
3678
|
-
if (!o?.length || !n?.length || !n?.[0]?.cells?.length) return;
|
|
3679
|
-
let s = snapshotRows(n?.map((e) => ({ cells: e?.cells?.map((e) => ({ value: e?.value })) }))), c = s?.length, l = s?.[0]?.length, u = (e, t, n) => buildReplacementRow(e, t, n, l), f, p, m;
|
|
3680
|
-
if (i) {
|
|
3681
|
-
let e = i?.row?.start, t = i?.column?.start, n = i?.row?.start, r = i?.row?.end, a = r - n + 1, c = s?.slice(0, n), d = s?.slice(r + 1), h = o?.length, g = Math.min(a, h), _ = Math.max(0, a - h), v = [];
|
|
3682
|
-
for (let e = 0; e < g; e++) {
|
|
3683
|
-
let r = s[n + e];
|
|
3684
|
-
v.push(u(r, o[e], t));
|
|
3685
|
-
}
|
|
3686
|
-
let y = _ > 0 ? s?.slice(n + g, n + g + _) : [], b = [];
|
|
3687
|
-
for (let e = g; e < h; e++) b?.push(u(void 0, o?.[e], t));
|
|
3688
|
-
p = v?.concat(b), f = c?.concat(v)?.concat(y)?.concat(b)?.concat(d);
|
|
3689
|
-
let x = Math.min(o?.[0]?.length, Math.max(l - t, 0));
|
|
3690
|
-
m = {
|
|
3691
|
-
row: {
|
|
3692
|
-
start: e,
|
|
3693
|
-
end: e + g - 1
|
|
3694
|
-
},
|
|
3695
|
-
column: {
|
|
3696
|
-
start: t,
|
|
3697
|
-
end: t + Math.max(x - 1, 0)
|
|
3698
|
-
}
|
|
3699
|
-
};
|
|
3700
|
-
} else {
|
|
3701
|
-
let e = c;
|
|
3702
|
-
p = o?.map((e) => u(void 0, e, 0)), f = [...s || [], ...p || []];
|
|
3703
|
-
let t = Math.min(o?.[0]?.length, l);
|
|
3704
|
-
m = {
|
|
3705
|
-
row: {
|
|
3706
|
-
start: e,
|
|
3707
|
-
end: e + p?.length - 1
|
|
3708
|
-
},
|
|
3709
|
-
column: {
|
|
3710
|
-
start: 0,
|
|
3711
|
-
end: 0 + Math.max(t - 1, 0)
|
|
3712
|
-
}
|
|
3713
|
-
};
|
|
3714
|
-
}
|
|
3715
|
-
let { errors: h, isValid: g } = d({ rows: f });
|
|
3716
|
-
r?.({
|
|
3717
|
-
allValues: f,
|
|
3718
|
-
affectedRange: m,
|
|
3719
|
-
insertedValues: p,
|
|
3720
|
-
errors: h,
|
|
3721
|
-
isValid: g
|
|
3722
|
-
});
|
|
3723
|
-
}, _ = (e) => onKeyDown(e, {
|
|
3724
|
-
rows: n,
|
|
3725
|
-
selectedIndexes: i,
|
|
3726
|
-
startIndex: o,
|
|
3727
|
-
setStartIndex: s,
|
|
3728
|
-
setSelectedIndexes: a,
|
|
3729
|
-
focusInputAtIndex: p,
|
|
3730
|
-
validate: d,
|
|
3731
|
-
onPasteApply: r
|
|
3732
|
-
}), v = (e) => onKeyUp(e, s), y = (e, t) => {
|
|
3733
|
-
a(o ? {
|
|
3734
|
-
row: {
|
|
3735
|
-
start: Math.min(e, o.row),
|
|
3736
|
-
end: Math.max(e, o.row)
|
|
3737
|
-
},
|
|
3738
|
-
column: {
|
|
3739
|
-
start: Math.min(t, o.column),
|
|
3740
|
-
end: Math.max(t, o.column)
|
|
3741
|
-
}
|
|
3742
|
-
} : {
|
|
3743
|
-
row: {
|
|
3744
|
-
start: e,
|
|
3745
|
-
end: e
|
|
3746
|
-
},
|
|
3747
|
-
column: {
|
|
3748
|
-
start: t,
|
|
3749
|
-
end: t
|
|
3750
|
-
}
|
|
3751
|
-
});
|
|
3752
|
-
}, b = (e) => onMouseDown(e, o, i, s, u, (e) => a(e)), x = () => onMouseUp(s, u), S = (e) => onMouseMove(e, c, y), C = () => {
|
|
3753
|
-
if (w(), !i || !t.current) return;
|
|
3754
|
-
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}"]`);
|
|
3755
|
-
if (!r || !a) return;
|
|
3756
|
-
let o = f();
|
|
3757
|
-
drawSelectionFrame(o, r, a);
|
|
3758
|
-
}, w = () => {
|
|
3759
|
-
let e = f();
|
|
3760
|
-
removeSelectionFrame(e);
|
|
3761
|
-
};
|
|
3762
|
-
return {
|
|
3763
|
-
selectedIndexes: i,
|
|
3764
|
-
setSelectedIndexes: a,
|
|
3765
|
-
onCopy: m,
|
|
3766
|
-
onPaste: g,
|
|
3767
|
-
onKeyDown: _,
|
|
3768
|
-
onKeyUp: v,
|
|
3769
|
-
onMouseDown: b,
|
|
3770
|
-
onMouseUp: x,
|
|
3771
|
-
onMouseMove: S,
|
|
3772
|
-
onBlur: (e) => onBlur(e, a, s)
|
|
3773
|
-
};
|
|
3774
|
-
}, InputCell = ({ cell: e, columnAlignment: t, testId: n, type: r }) => {
|
|
3775
|
-
let { selectedIndexes: i } = useContext(CellSelectionContext), a = i?.row.start !== i?.row.end || i?.column.start !== i?.column.end;
|
|
3776
|
-
return /* @__PURE__ */ jsx(Input, {
|
|
3777
|
-
name: e.name,
|
|
3778
|
-
value: e.value,
|
|
3779
|
-
onChange: (t) => e.onChange?.(t),
|
|
3780
|
-
onFocus: e.onFocus,
|
|
3781
|
-
onBlur: e.onBlur,
|
|
3782
|
-
onPaste: (t) => e.onPaste?.(t),
|
|
3783
|
-
placeholder: e.placeholder,
|
|
3784
|
-
error: e.error,
|
|
3785
|
-
warning: e.warning,
|
|
3786
|
-
disabled: e.disabled,
|
|
3787
|
-
isInTable: !0,
|
|
3788
|
-
maxTooltipWidth: e.maxTooltipWidth,
|
|
3789
|
-
right: t === Align.RIGHT,
|
|
3790
|
-
selectOnFocus: !a,
|
|
3791
|
-
testId: n,
|
|
3792
|
-
tabIndex: e.disabled ? -1 : 0,
|
|
3793
|
-
tooltip: e.tooltip,
|
|
3794
|
-
type: r
|
|
3795
|
-
});
|
|
3796
|
-
}, safeToString = (e) => String(toString(e)), roundNumberCosmetic = (e) => isScientificStringNum(e) ? e : safeToString(roundToPrecision(toNum(e), 14));
|
|
2975
|
+
inputInTable: "_inputInTable_ie6ng_1",
|
|
2976
|
+
inputHover: "_inputHover_ie6ng_13",
|
|
2977
|
+
inputFocus: "_inputFocus_ie6ng_18",
|
|
2978
|
+
inputError: "_inputError_ie6ng_25",
|
|
2979
|
+
inputWarning: "_inputWarning_ie6ng_26",
|
|
2980
|
+
inputDisabled: "_inputDisabled_ie6ng_61",
|
|
2981
|
+
hideScrollbars: "_hideScrollbars_ie6ng_67",
|
|
2982
|
+
cell: "_cell_ie6ng_77",
|
|
2983
|
+
disabledLink: "_disabledLink_ie6ng_87",
|
|
2984
|
+
inputWrapper: "_inputWrapper_ie6ng_91",
|
|
2985
|
+
numberInputWrapper: "_numberInputWrapper_ie6ng_106",
|
|
2986
|
+
breakWord: "_breakWord_ie6ng_113",
|
|
2987
|
+
inputCell: "_inputCell_ie6ng_116",
|
|
2988
|
+
sliderCell: "_sliderCell_ie6ng_119",
|
|
2989
|
+
staticCell: "_staticCell_ie6ng_123",
|
|
2990
|
+
staticCellContent: "_staticCellContent_ie6ng_126",
|
|
2991
|
+
unit: "_unit_ie6ng_148",
|
|
2992
|
+
sortingCell: "_sortingCell_ie6ng_151",
|
|
2993
|
+
sortingCellIcon: "_sortingCellIcon_ie6ng_162",
|
|
2994
|
+
icon: "_icon_ie6ng_173",
|
|
2995
|
+
checkBoxCell: "_checkBoxCell_ie6ng_177",
|
|
2996
|
+
iconCellWrapper: "_iconCellWrapper_ie6ng_181",
|
|
2997
|
+
actionsCell: "_actionsCell_ie6ng_185",
|
|
2998
|
+
rightAligned: "_rightAligned_ie6ng_193",
|
|
2999
|
+
centerAligned: "_centerAligned_ie6ng_199",
|
|
3000
|
+
leftAligned: "_leftAligned_ie6ng_205",
|
|
3001
|
+
popover: "_popover_ie6ng_208",
|
|
3002
|
+
disabledPointerEvents: "_disabledPointerEvents_ie6ng_211"
|
|
3003
|
+
};
|
|
3004
|
+
const InputCell = ({ cell: e, columnAlignment: t, testId: n, type: r }) => /* @__PURE__ */ jsx(Input, {
|
|
3005
|
+
name: e.name,
|
|
3006
|
+
value: e.value,
|
|
3007
|
+
onChange: (t) => e.onChange?.(t),
|
|
3008
|
+
onFocus: e.onFocus,
|
|
3009
|
+
onBlur: e.onBlur,
|
|
3010
|
+
onPaste: (t) => e.onPaste?.(t),
|
|
3011
|
+
placeholder: e.placeholder,
|
|
3012
|
+
error: e.error,
|
|
3013
|
+
warning: e.warning,
|
|
3014
|
+
disabled: e.disabled,
|
|
3015
|
+
isInTable: !0,
|
|
3016
|
+
maxTooltipWidth: e.maxTooltipWidth,
|
|
3017
|
+
right: t === Align.RIGHT,
|
|
3018
|
+
selectOnFocus: e.selectOnFocus,
|
|
3019
|
+
testId: n,
|
|
3020
|
+
tabIndex: e.disabled ? -1 : 0,
|
|
3021
|
+
tooltip: e.tooltip,
|
|
3022
|
+
type: r
|
|
3023
|
+
}), safeToString = (e) => String(toString(e)), roundNumberCosmetic = (e) => isScientificStringNum(e) ? e : safeToString(roundToPrecision(toNum(e), 14));
|
|
3797
3024
|
var getStringName$1 = (e) => e ? typeof e == "string" ? e : isArray(e) ? e[0] : e.fieldName : "";
|
|
3798
|
-
const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r = !1, left: i = !1, small: a = !1, width: o = "100%", value: s = "", onChange:
|
|
3025
|
+
const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r = !1, left: i = !1, small: a = !1, width: o = "100%", value: s = "", onChange: l = () => {}, onFocus: u = () => {}, onBlur: d = () => {}, selectOnFocus: f, tabIndex: h = 0, testId: g, tooltip: _ = null, warning: v = !1, validationCallback: y = () => {}, allowEmpty: b = !1, isInTable: x, groupOrder: S, enableCosmeticRounding: C = !0, enableDisplayRounding: w = !1, roundDisplayValue: T, disableInternalErrorValidationMessages: E = !1, disableValidationOnFocus: D = !1 }) => {
|
|
3799
3026
|
let O = (e) => {
|
|
3800
3027
|
let n = validateNumber(e), r = t && isEmptyNullOrUndefined(e);
|
|
3801
3028
|
return [Infinity, -Infinity].includes(Number(e)) || r ? {
|
|
@@ -3835,7 +3062,7 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3835
3062
|
name: F
|
|
3836
3063
|
}
|
|
3837
3064
|
};
|
|
3838
|
-
|
|
3065
|
+
l(t);
|
|
3839
3066
|
}
|
|
3840
3067
|
};
|
|
3841
3068
|
useEffect(() => {
|
|
@@ -3873,7 +3100,7 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3873
3100
|
isInTable: x,
|
|
3874
3101
|
groupOrder: S,
|
|
3875
3102
|
selectOnFocus: f,
|
|
3876
|
-
tabIndex:
|
|
3103
|
+
tabIndex: h,
|
|
3877
3104
|
tooltip: _,
|
|
3878
3105
|
ref: A
|
|
3879
3106
|
}, F);
|
|
@@ -3942,14 +3169,14 @@ const NumberInput = ({ name: e, placeholder: t = "", disabled: n = !1, error: r
|
|
|
3942
3169
|
testId: n
|
|
3943
3170
|
}) : null
|
|
3944
3171
|
}), LinkCell = ({ cell: e, testId: t }) => {
|
|
3945
|
-
let n = useContext(DisabledContext), { error: r, warning: i, tooltip: a, maxTooltipWidth: o } = e,
|
|
3172
|
+
let n = useContext(DisabledContext), { error: r, warning: i, tooltip: a, maxTooltipWidth: o } = e, c = (e) => isStringNumberOrNode(e);
|
|
3946
3173
|
return /* @__PURE__ */ jsx("div", {
|
|
3947
3174
|
className: cell_module_default.inputWrapper,
|
|
3948
3175
|
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
3949
3176
|
error: !!r,
|
|
3950
3177
|
warning: !!i,
|
|
3951
3178
|
text: a || r || i,
|
|
3952
|
-
enabled:
|
|
3179
|
+
enabled: c(a) || c(r) || c(i) || !1,
|
|
3953
3180
|
maxWidth: o,
|
|
3954
3181
|
children: /* @__PURE__ */ jsx("div", {
|
|
3955
3182
|
className: cell_module_default.staticCellContent,
|
|
@@ -3992,7 +3219,7 @@ var slider_module_default = {
|
|
|
3992
3219
|
] }),
|
|
3993
3220
|
children: /* @__PURE__ */ jsx("div", { className: slider_module_default.dot })
|
|
3994
3221
|
}), e), {}), isEqual$1);
|
|
3995
|
-
const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto", value: i, min: a, max: o, step:
|
|
3222
|
+
const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto", value: i, min: a, max: o, step: c = 1, marks: l = [], showArrows: u = !1, showTooltip: d = !1, tooltipFormatter: f = (e) => e, disabled: p = !1, range: m = !1, small: h = !1, vertical: _ = {
|
|
3996
3223
|
enabled: !1,
|
|
3997
3224
|
width: "100px",
|
|
3998
3225
|
height: "400px"
|
|
@@ -4025,13 +3252,13 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
4025
3252
|
})
|
|
4026
3253
|
});
|
|
4027
3254
|
return /* @__PURE__ */ jsxs("div", {
|
|
4028
|
-
className: cx(slider_module_default.container, h ? slider_module_default.small : "",
|
|
4029
|
-
style:
|
|
4030
|
-
width:
|
|
4031
|
-
height:
|
|
3255
|
+
className: cx(slider_module_default.container, h ? slider_module_default.small : "", _.enabled ? slider_module_default.vertical : ""),
|
|
3256
|
+
style: _.enabled ? {
|
|
3257
|
+
width: _.width,
|
|
3258
|
+
height: _.height
|
|
4032
3259
|
} : { width: n },
|
|
4033
3260
|
children: [
|
|
4034
|
-
u && (
|
|
3261
|
+
u && (_.enabled ? /* @__PURE__ */ jsx(C, {}) : /* @__PURE__ */ jsx(S, {})),
|
|
4035
3262
|
/* @__PURE__ */ jsx(RcSlider, {
|
|
4036
3263
|
range: m,
|
|
4037
3264
|
allowCross: !1,
|
|
@@ -4039,11 +3266,11 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
4039
3266
|
value: i,
|
|
4040
3267
|
max: o,
|
|
4041
3268
|
min: a,
|
|
4042
|
-
step:
|
|
3269
|
+
step: c,
|
|
4043
3270
|
marks: b,
|
|
4044
3271
|
onChange: (e) => x(e),
|
|
4045
3272
|
disabled: p || y,
|
|
4046
|
-
vertical:
|
|
3273
|
+
vertical: _.enabled,
|
|
4047
3274
|
handleRender: (e, t) => {
|
|
4048
3275
|
let n = d && t.dragging;
|
|
4049
3276
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -4060,7 +3287,7 @@ const Slider = ({ name: e, label: t, width: n = "100%", labelWidth: r = "auto",
|
|
|
4060
3287
|
});
|
|
4061
3288
|
}
|
|
4062
3289
|
}),
|
|
4063
|
-
u && (
|
|
3290
|
+
u && (_.enabled ? /* @__PURE__ */ jsx(S, {}) : /* @__PURE__ */ jsx(C, {})),
|
|
4064
3291
|
t && /* @__PURE__ */ jsx("label", {
|
|
4065
3292
|
className: slider_module_default.label,
|
|
4066
3293
|
style: { width: r },
|
|
@@ -4101,17 +3328,17 @@ var popover_module_default = {
|
|
|
4101
3328
|
fullWidthStyleFix: "_fullWidthStyleFix_lhie5_8",
|
|
4102
3329
|
dismiss: "_dismiss_lhie5_13"
|
|
4103
3330
|
};
|
|
4104
|
-
const Popover = ({ children: t, content: n, placement: r = "top-center", closeOnOutsideClick: i = !0, fullWidth: a = !1, showCloseButton: o = !1, testId:
|
|
4105
|
-
let
|
|
4106
|
-
!u && !
|
|
3331
|
+
const Popover = ({ children: t, content: n, placement: r = "top-center", closeOnOutsideClick: i = !0, fullWidth: a = !1, showCloseButton: o = !1, testId: l, disabled: u = !1, overflowContainer: d = !1, isOpen: f, onToggle: p }) => {
|
|
3332
|
+
let h = useContext(DisabledContext), [_, v] = f === void 0 ? useState(!1) : [f, p], y = () => {
|
|
3333
|
+
!u && !h && v && v(!1);
|
|
4107
3334
|
}, b = () => {
|
|
4108
|
-
u ||
|
|
3335
|
+
u || h || v && v(!_);
|
|
4109
3336
|
};
|
|
4110
3337
|
useEffect(() => {
|
|
4111
|
-
(u ||
|
|
4112
|
-
}, [u,
|
|
3338
|
+
(u || h) && y();
|
|
3339
|
+
}, [u, h]);
|
|
4113
3340
|
let { renderLayer: x, arrowProps: S, layerProps: C, triggerProps: w } = useLayer({
|
|
4114
|
-
isOpen:
|
|
3341
|
+
isOpen: _,
|
|
4115
3342
|
placement: r,
|
|
4116
3343
|
auto: !0,
|
|
4117
3344
|
triggerOffset: 6,
|
|
@@ -4122,9 +3349,9 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
|
|
|
4122
3349
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
4123
3350
|
ref: w.ref,
|
|
4124
3351
|
onClick: b,
|
|
4125
|
-
"data-testid":
|
|
3352
|
+
"data-testid": l,
|
|
4126
3353
|
children: t
|
|
4127
|
-
}),
|
|
3354
|
+
}), _ && x(/* @__PURE__ */ jsxs("div", {
|
|
4128
3355
|
className: a ? cx(popover_module_default.toggleBox, popover_module_default.fullWidthStyleFix) : cx(popover_module_default.toggleBox),
|
|
4129
3356
|
...C,
|
|
4130
3357
|
children: [/* @__PURE__ */ jsxs("div", { children: [React.isValidElement(n) ? React.cloneElement(n, { close: y }) : n, o && /* @__PURE__ */ jsx("div", {
|
|
@@ -4250,37 +3477,33 @@ const Popover = ({ children: t, content: n, placement: r = "top-center", closeOn
|
|
|
4250
3477
|
let CellType = /* @__PURE__ */ function(e) {
|
|
4251
3478
|
return e.INPUT = "Input", e.NUMBER_INPUT = "NumberInput", e.SELECT = "Select", e.POPOVER = "Popover", e.SLIDER = "Slider", e.CHECKBOX = "CheckBox", e.ACTIONS = "Actions", e.AUTO_UNIT = "AutoUnit", e.UNIT = "Unit", e.STATIC = "Static", e;
|
|
4252
3479
|
}({});
|
|
4253
|
-
const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a
|
|
4254
|
-
let { selectedIndexes: l, setSelectedIndexes: u } = useContext(CellSelectionContext), d = !t && l && l.row.start <= o && o <= l.row.end && l.column.start <= s && s <= l.column.end;
|
|
3480
|
+
const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment: r = Align.LEFT, width: i, testId: a }) => {
|
|
4255
3481
|
if (!e) return null;
|
|
4256
|
-
let { style:
|
|
3482
|
+
let { style: o, colSpan: s, rowSpan: c, width: l } = e, u = useRef(null), d = {
|
|
4257
3483
|
bodyAlignment: r,
|
|
4258
3484
|
headerAlignment: n,
|
|
4259
3485
|
isHeader: t
|
|
4260
|
-
},
|
|
4261
|
-
width:
|
|
4262
|
-
minWidth:
|
|
4263
|
-
textTransform:
|
|
4264
|
-
...
|
|
3486
|
+
}, f = getCellAlignment(d, cell_module_default), m = getCellAlignment(d, cell_module_default, !0), h = e.type === CellType.INPUT || e.type === CellType.NUMBER_INPUT || e.type === CellType.SELECT || e.type === CellType.POPOVER ? cell_module_default.inputCell : e.type === CellType.SLIDER ? cell_module_default.sliderCell : e.type === CellType.CHECKBOX ? cell_module_default.checkBoxCell : e.type === CellType.ACTIONS ? cell_module_default.actionsCell : cell_module_default.staticCell, _ = cx(cell_module_default.cell, h, e.hasSort ? cell_module_default.sortingCell : null, f, e.breakWord ? cell_module_default.breakWord : ""), v = l ?? i ?? void 0, y = e.type === CellType.STATIC || !e.type, b = t && y ? TextTransform.CAPITALIZE : void 0, x = {
|
|
3487
|
+
width: v,
|
|
3488
|
+
minWidth: v,
|
|
3489
|
+
textTransform: b,
|
|
3490
|
+
...o
|
|
4265
3491
|
};
|
|
4266
3492
|
return /* @__PURE__ */ jsx(t ? "th" : "td", {
|
|
4267
|
-
ref:
|
|
4268
|
-
className:
|
|
4269
|
-
style:
|
|
4270
|
-
colSpan:
|
|
4271
|
-
rowSpan:
|
|
4272
|
-
"data-row-index": o,
|
|
4273
|
-
"data-column-index": s,
|
|
4274
|
-
"data-selected": d,
|
|
3493
|
+
ref: u,
|
|
3494
|
+
className: _,
|
|
3495
|
+
style: x,
|
|
3496
|
+
colSpan: s,
|
|
3497
|
+
rowSpan: c,
|
|
4275
3498
|
children: /* @__PURE__ */ jsx(CellWrapper, {
|
|
4276
3499
|
cell: e,
|
|
4277
|
-
columnAlignment:
|
|
3500
|
+
columnAlignment: m ?? Align.RIGHT,
|
|
4278
3501
|
isHeader: t,
|
|
4279
3502
|
testId: a
|
|
4280
3503
|
})
|
|
4281
3504
|
});
|
|
4282
3505
|
}, Row$1 = ({ row: e, rowIndex: t, isHeader: n = !1, columnCount: r, colSpan: i, columnHeaderAlignments: a = [], columnAlignment: o = [], hasRowActions: s, draggableTable: c = !1, columnWidths: l, dropDisabled: u = !1, height: d, testId: f }) => {
|
|
4283
|
-
let p = getHeaderAlignment(a, n, t), { onRowClick: m, onRowFocus: h, onRowMouseEnter:
|
|
3506
|
+
let p = getHeaderAlignment(a, n, t), { onRowClick: m, onRowFocus: h, onRowMouseEnter: _, onRowMouseLeave: v, expandedContent: y, error: b, warning: x, active: S } = e, C = e.cells.map((e, r) => {
|
|
4284
3507
|
let i = `${n ? 0 : 1}_${t}_${r}`;
|
|
4285
3508
|
return /* @__PURE__ */ jsx(Cell, {
|
|
4286
3509
|
cell: e,
|
|
@@ -4288,18 +3511,14 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4288
3511
|
columnAlignment: o[r],
|
|
4289
3512
|
columnHeaderAlignment: p[r],
|
|
4290
3513
|
width: l ? l[r] : void 0,
|
|
4291
|
-
testId: e.testId
|
|
4292
|
-
rowIndex: t,
|
|
4293
|
-
columnIndex: r
|
|
3514
|
+
testId: e.testId
|
|
4294
3515
|
}, i);
|
|
4295
3516
|
}), w = s && /* @__PURE__ */ jsx(Cell, {
|
|
4296
3517
|
cell: {
|
|
4297
3518
|
type: CellType.ACTIONS,
|
|
4298
3519
|
actions: e.actions
|
|
4299
3520
|
},
|
|
4300
|
-
isHeader: n
|
|
4301
|
-
rowIndex: t,
|
|
4302
|
-
columnIndex: r
|
|
3521
|
+
isHeader: n
|
|
4303
3522
|
}, r), { attributes: T, listeners: E, setNodeRef: D, transform: O, transition: k, isDragging: A } = useSortable({
|
|
4304
3523
|
id: t.toString(),
|
|
4305
3524
|
animateLayoutChanges: () => !1
|
|
@@ -4319,10 +3538,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4319
3538
|
});
|
|
4320
3539
|
return n ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
4321
3540
|
onClick: m,
|
|
4322
|
-
onMouseEnter:
|
|
3541
|
+
onMouseEnter: _,
|
|
4323
3542
|
onMouseLeave: v,
|
|
4324
3543
|
onFocus: h,
|
|
4325
|
-
className: cx(m ? row_module_default$1.clickableRow : null,
|
|
3544
|
+
className: cx(m ? row_module_default$1.clickableRow : null, _ ? row_module_default$1.hoverableRow : null),
|
|
4326
3545
|
children: [
|
|
4327
3546
|
c ? /* @__PURE__ */ jsx("th", {}) : null,
|
|
4328
3547
|
C,
|
|
@@ -4335,10 +3554,11 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4335
3554
|
}, `${t}_expanded_content`) : null] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
4336
3555
|
ref: e.noDrag ? null : D,
|
|
4337
3556
|
onClick: m,
|
|
4338
|
-
onMouseEnter:
|
|
3557
|
+
onMouseEnter: _,
|
|
4339
3558
|
onMouseLeave: v,
|
|
4340
3559
|
onFocus: h,
|
|
4341
|
-
className: cx(m && !m.noStyle ? row_module_default$1.clickableRow : null,
|
|
3560
|
+
className: cx(m && !m.noStyle ? row_module_default$1.clickableRow : null, _ && !_.noStyle ? row_module_default$1.hoverableRow : null, S ? row_module_default$1.rowActive : null),
|
|
3561
|
+
"data-active": S || null,
|
|
4342
3562
|
"data-error": b || null,
|
|
4343
3563
|
"data-warning": x || null,
|
|
4344
3564
|
"data-index": t,
|
|
@@ -4355,14 +3575,14 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4355
3575
|
children: y.content
|
|
4356
3576
|
}, `${t}_expanded_content`) : null] });
|
|
4357
3577
|
}, TableDragWrapper = (e) => {
|
|
4358
|
-
let { children: t, colSpan: n, columnAlignment: r, columnCount: i, draggable: a, onListReorder: o = () => {}, canListReorder: s = () => !0, rowActions: c, rows: l = [], tbodyRef: u } = e, [
|
|
3578
|
+
let { children: t, colSpan: n, columnAlignment: r, columnCount: i, draggable: a, onListReorder: o = () => {}, canListReorder: s = () => !0, rowActions: c, rows: l = [], tbodyRef: u } = e, [f, p] = useState(null), [h, _] = useState(!1), v = useMemo(() => l.map((e, t) => t.toString()), [l]);
|
|
4359
3579
|
return a ? /* @__PURE__ */ jsxs(DndContext, {
|
|
4360
3580
|
collisionDetection: closestCenter,
|
|
4361
3581
|
onDragStart: (e) => {
|
|
4362
3582
|
p(e.active.id);
|
|
4363
3583
|
},
|
|
4364
3584
|
onDragEnd: (e) => {
|
|
4365
|
-
p(null),
|
|
3585
|
+
p(null), _(!1);
|
|
4366
3586
|
let { active: t, over: n } = e;
|
|
4367
3587
|
if (!t || !n || t.id === n.id) return;
|
|
4368
3588
|
let r = Number(t.id), i = Number(n?.id);
|
|
@@ -4379,23 +3599,23 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4379
3599
|
from: r,
|
|
4380
3600
|
to: i
|
|
4381
3601
|
});
|
|
4382
|
-
|
|
3602
|
+
_(a);
|
|
4383
3603
|
},
|
|
4384
3604
|
children: [/* @__PURE__ */ jsx(SortableContext, {
|
|
4385
3605
|
items: v,
|
|
4386
3606
|
strategy: verticalListSortingStrategy,
|
|
4387
|
-
children: t({ dropDisabled:
|
|
4388
|
-
}), !!
|
|
3607
|
+
children: t({ dropDisabled: h })
|
|
3608
|
+
}), !!f && createPortal(/* @__PURE__ */ jsx(DragOverlay, {
|
|
4389
3609
|
dropAnimation: null,
|
|
4390
3610
|
children: /* @__PURE__ */ jsx("table", {
|
|
4391
3611
|
className: cx(table_module_default.table, table_module_default.dragOverlay),
|
|
4392
3612
|
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(Row$1, {
|
|
4393
|
-
rowIndex: Number(
|
|
4394
|
-
row: l[Number(
|
|
3613
|
+
rowIndex: Number(f),
|
|
3614
|
+
row: l[Number(f)],
|
|
4395
3615
|
columnCount: i,
|
|
4396
3616
|
columnWidths: (() => {
|
|
4397
3617
|
if (!u?.current) return [];
|
|
4398
|
-
let e = u.current.querySelectorAll("tr")[Number(
|
|
3618
|
+
let e = u.current.querySelectorAll("tr")[Number(f)]?.querySelectorAll("td");
|
|
4399
3619
|
if (!e) return [];
|
|
4400
3620
|
let t = Array.from(e).map((e) => `${e.getBoundingClientRect().width}px`);
|
|
4401
3621
|
return t.shift(), t;
|
|
@@ -4404,7 +3624,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4404
3624
|
hasRowActions: c,
|
|
4405
3625
|
columnAlignment: r,
|
|
4406
3626
|
draggableTable: a,
|
|
4407
|
-
dropDisabled:
|
|
3627
|
+
dropDisabled: h
|
|
4408
3628
|
}) })
|
|
4409
3629
|
})
|
|
4410
3630
|
}), document.body)]
|
|
@@ -4432,169 +3652,179 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4432
3652
|
})()
|
|
4433
3653
|
})
|
|
4434
3654
|
});
|
|
4435
|
-
}
|
|
4436
|
-
|
|
3655
|
+
};
|
|
3656
|
+
var ScrollToActiveRow = ({ activeIndex: e, triggerScrollToActiveRow: t, isVirtualized: n, virtualizer: r }) => (useEffect(() => {
|
|
3657
|
+
if (t && !(e == null || e < 0)) {
|
|
3658
|
+
if (n && r) r.scrollToIndex(e, {
|
|
3659
|
+
align: "center",
|
|
3660
|
+
behavior: "auto"
|
|
3661
|
+
});
|
|
3662
|
+
else if (!n) {
|
|
3663
|
+
let t = document.querySelector(`tr[data-index="${e}"]`);
|
|
3664
|
+
t && t.scrollIntoView({
|
|
3665
|
+
behavior: "auto",
|
|
3666
|
+
block: "center"
|
|
3667
|
+
});
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
}, [
|
|
3671
|
+
e,
|
|
3672
|
+
t,
|
|
3673
|
+
n,
|
|
3674
|
+
r
|
|
3675
|
+
]), null);
|
|
3676
|
+
const TableScrollWrapper = ({ table: e, theadRef: t, children: n }) => {
|
|
3677
|
+
let { infiniteScroll: r = !1, triggerScrollToActiveRow: i = !1, rows: a } = e, o = useMemo(() => typeof e.activeRowIndex == "number" ? e.activeRowIndex : Array.isArray(a) && a.length ? a.findIndex((e) => e && e.active) : -1, [a, e.activeRowIndex]);
|
|
4437
3678
|
return r ? /* @__PURE__ */ jsx(TableVirtualScrollWrapper, {
|
|
4438
3679
|
table: e,
|
|
4439
3680
|
theadRef: t,
|
|
4440
|
-
children: ({ virtualizer: e, tableStyle: t }) =>
|
|
3681
|
+
children: ({ virtualizer: e, tableStyle: t }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(ScrollToActiveRow, {
|
|
3682
|
+
isVirtualized: !0,
|
|
3683
|
+
virtualizer: e,
|
|
3684
|
+
activeIndex: o,
|
|
3685
|
+
triggerScrollToActiveRow: i
|
|
3686
|
+
}), n({
|
|
4441
3687
|
virtualizer: e,
|
|
4442
3688
|
tableStyle: t
|
|
4443
|
-
})
|
|
4444
|
-
}) : /* @__PURE__ */
|
|
3689
|
+
})] })
|
|
3690
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
4445
3691
|
id: "scrollWrapper",
|
|
4446
3692
|
className: table_module_default.scroll,
|
|
4447
|
-
children:
|
|
3693
|
+
children: [/* @__PURE__ */ jsx(ScrollToActiveRow, {
|
|
3694
|
+
isVirtualized: !1,
|
|
3695
|
+
activeIndex: o,
|
|
3696
|
+
triggerScrollToActiveRow: i
|
|
3697
|
+
}), n({})]
|
|
4448
3698
|
});
|
|
4449
|
-
}, Table =
|
|
4450
|
-
let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i
|
|
4451
|
-
|
|
4452
|
-
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 = {
|
|
4453
|
-
cells: G ? y.cells.map((e, t) => e?.type === "Input" ? {
|
|
3699
|
+
}, Table = (e) => {
|
|
3700
|
+
let { onListReorder: t = () => {}, canListReorder: n = () => !0, beforeRenderRow: r, table: i } = e, { columnWidths: a, footer: o, name: s, rows: c = [], actions: l, actionsRight: u, columnHeaderAlignments: d, columnAlignment: f, striped: m = !0, testId: h, draggable: _, defaultEmptyRow: v = null, onAddRow: y = null, bordered: b = !0, maxHeight: x, fixedWidth: S } = i, C = useRef(null), w = useRef(null), T = get(e, "table.headers", []), E = getColumnCount(c, T), D = hasRowActions(c, T), O = E + (D ? 1 : 0), k = o ? o?.pagination?.rowsPerPage?.value === 0 || Number(o?.pagination?.selectedPage) >= Number(o?.pagination?.rowCount) / Number(o?.pagination?.rowsPerPage?.value) : !0, A = v?.cells?.length && y && k, j = {
|
|
3701
|
+
cells: A ? v.cells.map((e, t) => e?.type === "Input" ? {
|
|
4454
3702
|
...e,
|
|
4455
3703
|
onChange: (e) => {
|
|
4456
3704
|
let n = e?.target?.value, r = {
|
|
4457
|
-
...
|
|
4458
|
-
cells:
|
|
3705
|
+
...v,
|
|
3706
|
+
cells: v.cells.map((e, r) => ({
|
|
4459
3707
|
...e,
|
|
4460
3708
|
value: r === t ? n : e?.value
|
|
4461
3709
|
}))
|
|
4462
3710
|
};
|
|
4463
|
-
|
|
3711
|
+
y({ newRow: r });
|
|
4464
3712
|
}
|
|
4465
3713
|
} : {
|
|
4466
3714
|
...e,
|
|
4467
3715
|
disabled: !0
|
|
4468
3716
|
}) : null,
|
|
4469
|
-
testId:
|
|
4470
|
-
},
|
|
3717
|
+
testId: h ? `${h}-last-empty-row` : void 0
|
|
3718
|
+
}, M = A ? c.concat(j) : c, N = {
|
|
4471
3719
|
...i,
|
|
4472
|
-
rows:
|
|
4473
|
-
},
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4484
|
-
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
|
|
4553
|
-
|
|
4554
|
-
}) : q.map((t, n) => {
|
|
4555
|
-
let i = r ? r({
|
|
4556
|
-
row: t,
|
|
4557
|
-
rowIndex: n
|
|
4558
|
-
}) : t;
|
|
4559
|
-
return /* @__PURE__ */ jsx(Row$1, {
|
|
4560
|
-
rowIndex: n,
|
|
4561
|
-
row: i,
|
|
4562
|
-
columnCount: V,
|
|
4563
|
-
columnWidths: o,
|
|
4564
|
-
colSpan: U,
|
|
4565
|
-
hasRowActions: H,
|
|
4566
|
-
columnAlignment: p,
|
|
4567
|
-
draggableTable: v,
|
|
4568
|
-
dropDisabled: e
|
|
4569
|
-
}, `1_${n}`);
|
|
4570
|
-
})
|
|
4571
|
-
})]
|
|
3720
|
+
rows: M
|
|
3721
|
+
}, P = cx(table_module_default.wrapper, b ? table_module_default.bordered : "");
|
|
3722
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3723
|
+
className: P,
|
|
3724
|
+
style: {
|
|
3725
|
+
maxHeight: x,
|
|
3726
|
+
width: S,
|
|
3727
|
+
display: S === "auto" ? "inline-flex" : "flex"
|
|
3728
|
+
},
|
|
3729
|
+
children: [
|
|
3730
|
+
/* @__PURE__ */ jsx(Title$1, {
|
|
3731
|
+
actions: l,
|
|
3732
|
+
actionsRight: u,
|
|
3733
|
+
name: s,
|
|
3734
|
+
testId: h && `${h}-title`
|
|
3735
|
+
}),
|
|
3736
|
+
/* @__PURE__ */ jsx(TableDragWrapper, {
|
|
3737
|
+
colSpan: O,
|
|
3738
|
+
columnAlignment: f,
|
|
3739
|
+
columnCount: E,
|
|
3740
|
+
draggable: _,
|
|
3741
|
+
onListReorder: t,
|
|
3742
|
+
rowActions: D,
|
|
3743
|
+
rows: M,
|
|
3744
|
+
tbodyRef: w,
|
|
3745
|
+
canListReorder: n,
|
|
3746
|
+
children: ({ dropDisabled: e }) => /* @__PURE__ */ jsx(TableScrollWrapper, {
|
|
3747
|
+
table: N,
|
|
3748
|
+
theadRef: C,
|
|
3749
|
+
children: ({ virtualizer: t, tableStyle: n }) => /* @__PURE__ */ jsxs("table", {
|
|
3750
|
+
className: cx(table_module_default.table, m ? table_module_default.striped : ""),
|
|
3751
|
+
"data-testid": h,
|
|
3752
|
+
style: n,
|
|
3753
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
3754
|
+
ref: C,
|
|
3755
|
+
children: T.map((e, t) => /* @__PURE__ */ jsx(Row$1, {
|
|
3756
|
+
rowIndex: t,
|
|
3757
|
+
isHeader: !0,
|
|
3758
|
+
row: e,
|
|
3759
|
+
columnCount: E,
|
|
3760
|
+
columnWidths: a,
|
|
3761
|
+
colSpan: O,
|
|
3762
|
+
hasRowActions: D,
|
|
3763
|
+
columnAlignment: f,
|
|
3764
|
+
columnHeaderAlignments: d,
|
|
3765
|
+
draggableTable: _
|
|
3766
|
+
}, `0_${t}`))
|
|
3767
|
+
}), /* @__PURE__ */ jsx("tbody", {
|
|
3768
|
+
ref: w,
|
|
3769
|
+
children: t ? t.getVirtualItems().map((t) => {
|
|
3770
|
+
let n = t.index, i = M[n], o = r ? r({
|
|
3771
|
+
row: i,
|
|
3772
|
+
rowIndex: n
|
|
3773
|
+
}) : i;
|
|
3774
|
+
return /* @__PURE__ */ jsx(Row$1, {
|
|
3775
|
+
rowIndex: n,
|
|
3776
|
+
row: o,
|
|
3777
|
+
columnCount: E,
|
|
3778
|
+
columnWidths: a,
|
|
3779
|
+
colSpan: O,
|
|
3780
|
+
hasRowActions: D,
|
|
3781
|
+
columnAlignment: f,
|
|
3782
|
+
draggableTable: _,
|
|
3783
|
+
height: t.size,
|
|
3784
|
+
dropDisabled: e
|
|
3785
|
+
}, `1_${n}`);
|
|
3786
|
+
}) : M.map((t, n) => {
|
|
3787
|
+
let i = r ? r({
|
|
3788
|
+
row: t,
|
|
3789
|
+
rowIndex: n
|
|
3790
|
+
}) : t;
|
|
3791
|
+
return /* @__PURE__ */ jsx(Row$1, {
|
|
3792
|
+
rowIndex: n,
|
|
3793
|
+
row: i,
|
|
3794
|
+
columnCount: E,
|
|
3795
|
+
columnWidths: a,
|
|
3796
|
+
colSpan: O,
|
|
3797
|
+
hasRowActions: D,
|
|
3798
|
+
columnAlignment: f,
|
|
3799
|
+
draggableTable: _,
|
|
3800
|
+
dropDisabled: e
|
|
3801
|
+
}, `1_${n}`);
|
|
4572
3802
|
})
|
|
4573
|
-
})
|
|
3803
|
+
})]
|
|
4574
3804
|
})
|
|
4575
|
-
}),
|
|
4576
|
-
s && /* @__PURE__ */ jsx(Footer, {
|
|
4577
|
-
pagination: s.pagination,
|
|
4578
|
-
actions: s.actions,
|
|
4579
|
-
content: s.content
|
|
4580
3805
|
})
|
|
4581
|
-
|
|
4582
|
-
|
|
3806
|
+
}),
|
|
3807
|
+
o && /* @__PURE__ */ jsx(Footer, {
|
|
3808
|
+
pagination: o.pagination,
|
|
3809
|
+
actions: o.actions,
|
|
3810
|
+
content: o.content
|
|
3811
|
+
})
|
|
3812
|
+
]
|
|
4583
3813
|
});
|
|
4584
|
-
}
|
|
3814
|
+
}, placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
|
|
4585
3815
|
let i = `${t} → ${n}:`, a = e.filter((e) => !e.startsWith(i)), o = r ? [...a, `${i} ${r}`] : a, s = o.length === 0;
|
|
4586
3816
|
return {
|
|
4587
3817
|
updatedErrors: o,
|
|
4588
3818
|
isValid: s
|
|
4589
3819
|
};
|
|
4590
3820
|
}, Table$1 = ({ validationRules: e, parsedResult: t, updateState: n, testId: r }) => {
|
|
4591
|
-
let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a,
|
|
3821
|
+
let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a, s] = useState(20), [l, u] = useState(1), f = useRef([]), h = (l - 1) * a, g = a === 0 ? t.rows.length : h + a, [_, v] = useState([]), y = useCallback((r, a) => (!f.current.length && t.rows.length && (f.current = t.rows[0].map((e) => isNumericLike(e) ? "NumberInput" : "Input")), {
|
|
4592
3822
|
cells: r.map((r, o) => {
|
|
4593
|
-
let { columnMessage: s = {}, validator: c = () => null } = e?.[o] ?? {}, l = i?.[o]?.value, u = `${`Row ${a + 1}`} → ${l}:`,
|
|
3823
|
+
let { columnMessage: s = {}, validator: c = () => null } = e?.[o] ?? {}, l = i?.[o]?.value, u = `${`Row ${a + 1}`} → ${l}:`, d = c(r), p = t?.errors?.find((e) => e.startsWith(u)) ?? null, m = d || p || null;
|
|
4594
3824
|
return {
|
|
4595
3825
|
name: l,
|
|
4596
3826
|
value: r,
|
|
4597
|
-
type:
|
|
3827
|
+
type: f.current[o] ?? "Input",
|
|
4598
3828
|
disableValidationOnFocus: !0,
|
|
4599
3829
|
error: m,
|
|
4600
3830
|
validationCallback: (e, r) => {
|
|
@@ -4679,12 +3909,12 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4679
3909
|
i,
|
|
4680
3910
|
x,
|
|
4681
3911
|
b
|
|
4682
|
-
]), C = useMemo(() => _.slice(
|
|
3912
|
+
]), C = useMemo(() => _.slice(h, g), [
|
|
4683
3913
|
_,
|
|
4684
|
-
|
|
3914
|
+
h,
|
|
4685
3915
|
g
|
|
4686
3916
|
]), w = useCallback(({ rowIndex: e }) => {
|
|
4687
|
-
let n =
|
|
3917
|
+
let n = h + e, r = t.rows[n];
|
|
4688
3918
|
return r ? y(r, n) : {
|
|
4689
3919
|
cells: [],
|
|
4690
3920
|
actions: []
|
|
@@ -4692,7 +3922,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4692
3922
|
}, [
|
|
4693
3923
|
t.rows,
|
|
4694
3924
|
y,
|
|
4695
|
-
|
|
3925
|
+
h
|
|
4696
3926
|
]);
|
|
4697
3927
|
return /* @__PURE__ */ jsx(Table, {
|
|
4698
3928
|
beforeRenderRow: w,
|
|
@@ -4718,10 +3948,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4718
3948
|
infiniteScroll: !0,
|
|
4719
3949
|
footer: { pagination: {
|
|
4720
3950
|
rowCount: t.rows.length,
|
|
4721
|
-
selectedPage:
|
|
3951
|
+
selectedPage: l,
|
|
4722
3952
|
rowsPerPage: {
|
|
4723
3953
|
value: a,
|
|
4724
|
-
onChange: (e) =>
|
|
3954
|
+
onChange: (e) => s(Number(e?.target?.value)),
|
|
4725
3955
|
options: [
|
|
4726
3956
|
{
|
|
4727
3957
|
label: "10 / page",
|
|
@@ -4831,7 +4061,210 @@ const Empty = ({ width: e = "auto", height: t = "auto", text: n = "No data", chi
|
|
|
4831
4061
|
}), extraSeparators = (e) => e?.split(/;|\t|\n/)?.some((e) => {
|
|
4832
4062
|
let t = e?.match(/[.,]/g);
|
|
4833
4063
|
return t && t.length > 1;
|
|
4834
|
-
}), hasOneComma = (e) => e?.split(/;|\t|\n/)?.some((e) => !e?.includes(".") && e?.match(/,/g)?.length === 1)
|
|
4064
|
+
}), hasOneComma = (e) => e?.split(/;|\t|\n/)?.some((e) => !e?.includes(".") && e?.match(/,/g)?.length === 1);
|
|
4065
|
+
var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e && e !== "blank" && e.trim() !== "", validateColumnLength = (e, t, n, r, i, a, o) => {
|
|
4066
|
+
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;
|
|
4067
|
+
if (i && !isValidLength(e.length, l, c) && s.push(o("incorrectNumberOfFieldNameHeaderColumns", { expectedLengthMessage: u })), a) {
|
|
4068
|
+
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;
|
|
4069
|
+
isValidLength(n, e, i) || s.push(o("incorrectNumberOfUnitHeaderColumns", { expectedLengthMessage: u }));
|
|
4070
|
+
}
|
|
4071
|
+
return n.length === 0 ? s.push(o("incorrectNumberOfDataColumns", {
|
|
4072
|
+
expectedLengthMessage: u,
|
|
4073
|
+
dataRowStartIndex: d
|
|
4074
|
+
})) : n.forEach((e, t) => {
|
|
4075
|
+
isValidLength(e.length, l, c) || s.push(o("incorrectNumberOfDataColumns", {
|
|
4076
|
+
expectedLengthMessage: u,
|
|
4077
|
+
dataRowStartIndex: d + t
|
|
4078
|
+
}));
|
|
4079
|
+
}), s;
|
|
4080
|
+
}, normalize = (e) => e.toUpperCase().replace(/\(.*?\)/g, "").replace(/[^A-Z0-9]/g, "").trim(), defaultFieldNameValidator = ({ value: e, defaultAllowedValues: t }) => {
|
|
4081
|
+
let n = normalize(e);
|
|
4082
|
+
return t?.some((e) => normalize(e).includes(n) || n.includes(normalize(e))) ?? !1;
|
|
4083
|
+
}, defaultUnitsValidator = ({ value: e, defaultAllowedValues: t }) => t?.includes(e) ?? !1, validateHeadings = (e, t, n, r, i, a) => {
|
|
4084
|
+
let o = [];
|
|
4085
|
+
if (r) {
|
|
4086
|
+
let r = n.map((e) => e.fieldName).filter(Boolean);
|
|
4087
|
+
e.forEach((i, s) => {
|
|
4088
|
+
let c = n[s];
|
|
4089
|
+
!c || !c?.fieldName || (n[s]?.fieldNameValidator ?? defaultFieldNameValidator)({
|
|
4090
|
+
value: i,
|
|
4091
|
+
defaultAllowedValues: r,
|
|
4092
|
+
columnIndex: s,
|
|
4093
|
+
fields: e,
|
|
4094
|
+
units: t
|
|
4095
|
+
}) || o.push(a("incorrectFieldName", {
|
|
4096
|
+
i: s + 1,
|
|
4097
|
+
correctName: n[s]?.fieldName || a("notExist"),
|
|
4098
|
+
wrongName: i || a("notApplicable")
|
|
4099
|
+
}));
|
|
4100
|
+
});
|
|
4101
|
+
}
|
|
4102
|
+
if (i) {
|
|
4103
|
+
let i = n.map((e) => e?.validUnits), s = r ? 1 : 0;
|
|
4104
|
+
t.forEach((r, c) => {
|
|
4105
|
+
let l = n[c];
|
|
4106
|
+
if (!l) return;
|
|
4107
|
+
let u = l.unitsValidator ?? defaultUnitsValidator, d = i?.[c];
|
|
4108
|
+
u({
|
|
4109
|
+
value: r,
|
|
4110
|
+
defaultAllowedValues: d,
|
|
4111
|
+
columnIndex: c,
|
|
4112
|
+
fields: e,
|
|
4113
|
+
units: t
|
|
4114
|
+
}) || o.push(a("incorrectUnitRow", {
|
|
4115
|
+
unitRowIndex: s,
|
|
4116
|
+
i: c + 1,
|
|
4117
|
+
wrongUnit: r || a("notApplicable"),
|
|
4118
|
+
correctUnit: d?.join(",") || a("notExist")
|
|
4119
|
+
}));
|
|
4120
|
+
});
|
|
4121
|
+
}
|
|
4122
|
+
return o;
|
|
4123
|
+
}, validateValues = (e, t, n) => {
|
|
4124
|
+
let r = [];
|
|
4125
|
+
return e.forEach((e, i) => {
|
|
4126
|
+
e.forEach((e, a) => {
|
|
4127
|
+
let o = t[a];
|
|
4128
|
+
if (!o || !o.validator) return;
|
|
4129
|
+
let s = o.validator(e);
|
|
4130
|
+
s && typeof s == "string" && r.push(`${s} ${n("rowColumn", {
|
|
4131
|
+
rowIndex: i + 2,
|
|
4132
|
+
columnIndex: a
|
|
4133
|
+
})}`);
|
|
4134
|
+
});
|
|
4135
|
+
}), r;
|
|
4136
|
+
};
|
|
4137
|
+
const validate = (e, t, n, r, i, a, o) => {
|
|
4138
|
+
let s = validateColumnLength(e, t, n, r, i, a, o);
|
|
4139
|
+
return s.length === 0 && (s = s.concat(validateHeadings(e, t, r, i, a, o), validateValues(n, r, o))), {
|
|
4140
|
+
isValid: s.length === 0,
|
|
4141
|
+
errors: s
|
|
4142
|
+
};
|
|
4143
|
+
}, hasHeaders = (e, t, n) => {
|
|
4144
|
+
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;
|
|
4145
|
+
return {
|
|
4146
|
+
hasFieldNameHeader: o || i && !s && !l || i && a && !l,
|
|
4147
|
+
hasUnitHeader: s || c || i && a && !s && !l && !u || i && a && !l && !u
|
|
4148
|
+
};
|
|
4149
|
+
}, guessMissingHeaders = (e, { validationRules: t }) => {
|
|
4150
|
+
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);
|
|
4151
|
+
return s || e?.unshift(r), c || e?.splice(1, 0, a), {
|
|
4152
|
+
hasFieldNameHeader: s,
|
|
4153
|
+
hasUnitHeader: c
|
|
4154
|
+
};
|
|
4155
|
+
}, depthRound = (e) => Math.round(e * 100) / 100;
|
|
4156
|
+
var joinArray = (e) => e.join(", ").replace(/,\s*$/, ""), basePapaConfig = {
|
|
4157
|
+
skipEmptyLines: !0,
|
|
4158
|
+
transform: (e) => e?.trim(),
|
|
4159
|
+
delimiter: (e) => {
|
|
4160
|
+
let t = e.substring(0, 200), n = (t.match(/\t/g) ?? []).length, r = (t.match(/;/g) ?? []).length;
|
|
4161
|
+
return n === 0 && r === 0 ? "," : n > r ? " " : ";";
|
|
4162
|
+
}
|
|
4163
|
+
}, allowedMimes = [
|
|
4164
|
+
"text/csv",
|
|
4165
|
+
"text/plain",
|
|
4166
|
+
"application/json",
|
|
4167
|
+
"application/vnd.ms-excel"
|
|
4168
|
+
], isAllowedFileType = (e) => allowedMimes.includes(e.type), isFile = (e) => e instanceof File, isJson = (e) => e.trim().startsWith("["), isCustomJson = (e) => {
|
|
4169
|
+
try {
|
|
4170
|
+
return !!JSON.parse(e)?.path;
|
|
4171
|
+
} catch {
|
|
4172
|
+
return !1;
|
|
4173
|
+
}
|
|
4174
|
+
};
|
|
4175
|
+
const readFile$1 = (e) => new Promise((t, n) => {
|
|
4176
|
+
let r = new FileReader();
|
|
4177
|
+
r.onload = () => t(String(r.result)), r.onerror = n, r.readAsText(e);
|
|
4178
|
+
});
|
|
4179
|
+
var parseJson = async (e, t, n) => {
|
|
4180
|
+
try {
|
|
4181
|
+
let r = JSON.parse(e);
|
|
4182
|
+
return onCompleteParse({
|
|
4183
|
+
data: r,
|
|
4184
|
+
errors: []
|
|
4185
|
+
}, t, n);
|
|
4186
|
+
} catch (e) {
|
|
4187
|
+
throw Error(`${n("jsonParseFailed")} ${e.message}`);
|
|
4188
|
+
}
|
|
4189
|
+
}, parseCustomJson = async (e, t, n) => {
|
|
4190
|
+
try {
|
|
4191
|
+
let r = JSON.parse(e).path.map((e) => [
|
|
4192
|
+
depthRound(e.md),
|
|
4193
|
+
depthRound(e.inclination),
|
|
4194
|
+
depthRound(e.gridAzimuth)
|
|
4195
|
+
]);
|
|
4196
|
+
return r.unshift([
|
|
4197
|
+
"m",
|
|
4198
|
+
"deg",
|
|
4199
|
+
"deg"
|
|
4200
|
+
]), onCompleteParse({
|
|
4201
|
+
data: r,
|
|
4202
|
+
errors: []
|
|
4203
|
+
}, t, n);
|
|
4204
|
+
} catch (e) {
|
|
4205
|
+
throw Error(`${n("jsonParseFailed")} ${e.message}`);
|
|
4206
|
+
}
|
|
4207
|
+
};
|
|
4208
|
+
const replaceWithDot = (e) => e.replace(",", "."), replaceDataCommasWithDots = (e) => e.map((e) => e.map((e) => replaceWithDot(e)));
|
|
4209
|
+
var parseDSV = (e, { importLimit: t,...n }, r) => new Promise((i) => {
|
|
4210
|
+
Papa.parse(e, {
|
|
4211
|
+
...basePapaConfig,
|
|
4212
|
+
preview: t,
|
|
4213
|
+
complete: (e) => {
|
|
4214
|
+
let a = onCompleteParse(e, {
|
|
4215
|
+
importLimit: t,
|
|
4216
|
+
...n
|
|
4217
|
+
}, r);
|
|
4218
|
+
a.rows = replaceDataCommasWithDots(a.rows), i(a);
|
|
4219
|
+
}
|
|
4220
|
+
});
|
|
4221
|
+
});
|
|
4222
|
+
const parse = async (e, t, n) => {
|
|
4223
|
+
let r = {
|
|
4224
|
+
isValid: !1,
|
|
4225
|
+
fields: [],
|
|
4226
|
+
units: [],
|
|
4227
|
+
rows: [],
|
|
4228
|
+
errors: []
|
|
4229
|
+
};
|
|
4230
|
+
try {
|
|
4231
|
+
if (isFile(e) && !isAllowedFileType(e)) return r.errors.push(`${n("wrongFileFormatExpectedOneOf")} ${joinArray(Array.from(allowedMimes))}`), r;
|
|
4232
|
+
let i = isFile(e) ? await readFile$1(e) : e;
|
|
4233
|
+
return isJson(i) ? await parseJson(i, t, n) : isCustomJson(i) ? await parseCustomJson(i, t, n) : await parseDSV(e, t, n);
|
|
4234
|
+
} catch (e) {
|
|
4235
|
+
return r.errors.push(e.message), r;
|
|
4236
|
+
}
|
|
4237
|
+
}, unParse = (e, t, n, r) => {
|
|
4238
|
+
let i = r?.delimiter ?? ",", a = [
|
|
4239
|
+
e,
|
|
4240
|
+
t,
|
|
4241
|
+
...n
|
|
4242
|
+
].filter(Boolean);
|
|
4243
|
+
return Papa.unparse(a, {
|
|
4244
|
+
quotes: !1,
|
|
4245
|
+
header: !0,
|
|
4246
|
+
delimiter: i
|
|
4247
|
+
});
|
|
4248
|
+
};
|
|
4249
|
+
var onCompleteParse = (e, t, n) => {
|
|
4250
|
+
let { data: r, errors: i } = e, a = {
|
|
4251
|
+
isValid: !1,
|
|
4252
|
+
fields: [],
|
|
4253
|
+
units: [],
|
|
4254
|
+
rows: [],
|
|
4255
|
+
errors: i.map((e) => e.message)
|
|
4256
|
+
};
|
|
4257
|
+
if (i.length > 0) return a;
|
|
4258
|
+
let { hasFieldNameHeader: o, hasUnitHeader: s } = guessMissingHeaders(r, t);
|
|
4259
|
+
a.fields = r[0].map((e) => e.trim()), a.units = r[1].map((e) => e.trim()).filter(Boolean), a.rows = r.slice(2);
|
|
4260
|
+
let { validationRules: c } = t;
|
|
4261
|
+
if (c.length) {
|
|
4262
|
+
let { isValid: e, errors: t } = validate(a.fields, a.units, a.rows, c, o, s, n);
|
|
4263
|
+
a.errors.push(...t), a.isValid = e && t.length === 0;
|
|
4264
|
+
} else a.isValid = a.errors.length === 0;
|
|
4265
|
+
return a;
|
|
4266
|
+
};
|
|
4267
|
+
const toast = ({ id: e, message: t = {
|
|
4835
4268
|
type: MessageType.INFO,
|
|
4836
4269
|
content: ""
|
|
4837
4270
|
}, autoClose: n = 6e3, onClose: r }) => {
|
|
@@ -4886,10 +4319,10 @@ var toggle_module_default = {
|
|
|
4886
4319
|
noMargin: "_noMargin_1c9wf_110",
|
|
4887
4320
|
helpIconEnabled: "_helpIconEnabled_1c9wf_113"
|
|
4888
4321
|
};
|
|
4889
|
-
const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, small: a = !1, onChange: o, noMargin:
|
|
4322
|
+
const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, small: a = !1, onChange: o, noMargin: c = !1, testId: l, helpText: u, onClickHelp: d, textTransform: f = TextTransform.CAPITALIZE }) => {
|
|
4890
4323
|
let p = useContext(DisabledContext), m = u || d, h = r || p;
|
|
4891
4324
|
return /* @__PURE__ */ jsxs("div", {
|
|
4892
|
-
className: cx(toggle_module_default.toggle, h ? toggle_module_default.disabled : null, a ? toggle_module_default.small : null,
|
|
4325
|
+
className: cx(toggle_module_default.toggle, h ? toggle_module_default.disabled : null, a ? toggle_module_default.small : null, c ? toggle_module_default.noMargin : null),
|
|
4893
4326
|
style: { display: i },
|
|
4894
4327
|
onClick: (t) => {
|
|
4895
4328
|
h || (t.target.name = e, t.target.checked = !n, t.target.value = !n, o(t));
|
|
@@ -4915,7 +4348,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4915
4348
|
})
|
|
4916
4349
|
]
|
|
4917
4350
|
});
|
|
4918
|
-
}, PasteWithReviewModal = ({ config: e, state: t, updateState: n, setModalVisibility: r, onCloseModal: i, readAndParseInput: a, validationRules:
|
|
4351
|
+
}, PasteWithReviewModal = ({ config: e, state: t, updateState: n, setModalVisibility: r, onCloseModal: i, readAndParseInput: a, validationRules: s = [], onCompleteImport: c = () => {}, prevalidationConfig: l, t: u, loading: d, startTransition: f, testId: h }) => {
|
|
4919
4352
|
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({
|
|
4920
4353
|
pastedText: "",
|
|
4921
4354
|
parsedResult: {
|
|
@@ -4936,15 +4369,15 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4936
4369
|
let O = useCallback((t) => {
|
|
4937
4370
|
if (t) {
|
|
4938
4371
|
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 = {
|
|
4939
|
-
validationRules:
|
|
4372
|
+
validationRules: s,
|
|
4940
4373
|
importLimit: n
|
|
4941
|
-
}, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2),
|
|
4374
|
+
}, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2), o = unParse(i, a, t, r);
|
|
4942
4375
|
f(() => D({
|
|
4943
4376
|
parsedResult: {
|
|
4944
4377
|
...N,
|
|
4945
4378
|
rows: t
|
|
4946
4379
|
},
|
|
4947
|
-
pastedText:
|
|
4380
|
+
pastedText: o
|
|
4948
4381
|
})), C.current = E;
|
|
4949
4382
|
} else f(() => {
|
|
4950
4383
|
C.current && D(C.current);
|
|
@@ -4953,7 +4386,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4953
4386
|
}, [
|
|
4954
4387
|
E,
|
|
4955
4388
|
n,
|
|
4956
|
-
|
|
4389
|
+
s
|
|
4957
4390
|
]), k = () => {
|
|
4958
4391
|
D({
|
|
4959
4392
|
pastedText: "",
|
|
@@ -5006,7 +4439,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5006
4439
|
]
|
|
5007
4440
|
}),
|
|
5008
4441
|
_ && /* @__PURE__ */ jsx(Help, {
|
|
5009
|
-
validationRules:
|
|
4442
|
+
validationRules: s,
|
|
5010
4443
|
t: u
|
|
5011
4444
|
}),
|
|
5012
4445
|
R ? /* @__PURE__ */ jsx("div", {
|
|
@@ -5039,7 +4472,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5039
4472
|
},
|
|
5040
4473
|
colored: !0,
|
|
5041
4474
|
loading: d,
|
|
5042
|
-
testId: `${
|
|
4475
|
+
testId: `${h}-paste-from-clipboard-button`
|
|
5043
4476
|
})
|
|
5044
4477
|
]
|
|
5045
4478
|
})
|
|
@@ -5071,7 +4504,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5071
4504
|
} })
|
|
5072
4505
|
]
|
|
5073
4506
|
}), /* @__PURE__ */ jsx(Table$1, {
|
|
5074
|
-
validationRules:
|
|
4507
|
+
validationRules: s,
|
|
5075
4508
|
parsedResult: N,
|
|
5076
4509
|
updateState: (e) => D((t) => ({
|
|
5077
4510
|
...t,
|
|
@@ -5098,7 +4531,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5098
4531
|
onClick: () => f(() => j()),
|
|
5099
4532
|
disabled: R || !F,
|
|
5100
4533
|
loading: d,
|
|
5101
|
-
testId: `${
|
|
4534
|
+
testId: `${h}-paste-with-review-modal-button-okay`
|
|
5102
4535
|
}),
|
|
5103
4536
|
/* @__PURE__ */ jsx(Button, {
|
|
5104
4537
|
label: u("cancel"),
|
|
@@ -5144,7 +4577,75 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5144
4577
|
return;
|
|
5145
4578
|
}
|
|
5146
4579
|
return t;
|
|
5147
|
-
}, [t, n]),
|
|
4580
|
+
}, [t, n]), enTranslations = {
|
|
4581
|
+
cancel: "Cancel",
|
|
4582
|
+
chooseFile: "Choose file",
|
|
4583
|
+
copyDecimalComma: "Copy (decimal comma)",
|
|
4584
|
+
copyDecimalDot: "Copy (decimal dot)",
|
|
4585
|
+
copyToClipboard: "Copy to clipboard",
|
|
4586
|
+
copiedToClipboard: "Copied to clipboard",
|
|
4587
|
+
deleteAllRows: "Delete all rows",
|
|
4588
|
+
downloadFile: "Download file",
|
|
4589
|
+
export: "Export",
|
|
4590
|
+
help: "Help",
|
|
4591
|
+
import: "Import",
|
|
4592
|
+
noFileSelected: "No file selected",
|
|
4593
|
+
notApplicable: "N/A",
|
|
4594
|
+
notExist: "not exist",
|
|
4595
|
+
okay: "Okay",
|
|
4596
|
+
uploadCapitalized: "Upload",
|
|
4597
|
+
uploadFile: "Upload file",
|
|
4598
|
+
pasteShortcutHint: "You can also press Ctrl+V or Command+V to paste from clipboard",
|
|
4599
|
+
pasteFromClipboard: "Paste from clipboard",
|
|
4600
|
+
clipboardIsEmpty: "Clipboard is empty",
|
|
4601
|
+
clipboardReadFailed: "Unable to read data from clipboard. Check formatting or try Paste with Review.",
|
|
4602
|
+
clipboardReadNotAllowed: "Your browser did not allow reading the clipboard. Upgrade browser or try Paste with Review.",
|
|
4603
|
+
pasteSuccessful: "Paste successful",
|
|
4604
|
+
pasteWithReview: "Paste with review",
|
|
4605
|
+
pasteWithReviewRoundBrackets: "Paste (with review)",
|
|
4606
|
+
quickPasteFromClipboard: "Quick paste from clipboard",
|
|
4607
|
+
unableToCopyToClipboard: "Unable to copy to clipboard",
|
|
4608
|
+
fileParsingFailed: "Failed to read or validate the file. Please check the format and try again.",
|
|
4609
|
+
importWarning: "Large data detected: More than 500 rows have been imported. You can choose to import all or downsample for better performance.",
|
|
4610
|
+
importLimitExceeded: "Import failed: The data exceeds the 5000-row limit. Please reduce the number of rows and try again.",
|
|
4611
|
+
importingData: "Importing data",
|
|
4612
|
+
incorrectFieldName: "Incorrect field name (row 0, column {{i}}: has name {{wrongName}}, but should be {{correctName}})",
|
|
4613
|
+
incorrectNumberOfDataColumns: "Incorrect number of data columns, expected {{expectedLengthMessage}} columns in row {{dataRowStartIndex}}",
|
|
4614
|
+
incorrectNumberOfFieldNameHeaderColumns: "Incorrect number of field name header columns, expected {{expectedLengthMessage}} columns in row 0",
|
|
4615
|
+
incorrectNumberOfUnitHeaderColumns: "Incorrect number of unit header columns, expected {{expectedLengthMessage}} columns in row 1",
|
|
4616
|
+
incorrectUnitRow: "Incorrect unit (row {{unitRowIndex}}, column {{i}}: has unit [{{wrongUnit}}], but should be [{{correctUnit}}])",
|
|
4617
|
+
jsonParseFailed: "JSON parse failed",
|
|
4618
|
+
pasteYourTableDataHereToImportIt: "Paste your table data here to import it",
|
|
4619
|
+
rowColumn: "(row {{rowIndex}}, column {{columnIndex}})",
|
|
4620
|
+
theValuesCanBeSeparatedByDifferentDelimiters: "The values can be separated by different delimiters",
|
|
4621
|
+
unableToImportPleaseCorrectError: "Unable to import - {{rows}} rows have errors. Please correct input data and try again.",
|
|
4622
|
+
unableToPrepareExportData: "Unable to prepare export – see console for details.",
|
|
4623
|
+
validInputForPaste: "Valid input for paste.",
|
|
4624
|
+
wrongFileFormatExpectedOneOf: "Wrong file format: expected one of",
|
|
4625
|
+
youCanImportDataByPastingOrByMessage: "You can import data by pasting (e.g. from a spreadsheet), or by uploading a text file ( .txt or .csv ).",
|
|
4626
|
+
commasAsDecimals: "Comma is treated as a decimal separator when it is the only separator",
|
|
4627
|
+
deletePastedContent: "Delete pasted content",
|
|
4628
|
+
downsampled: "Downsampled",
|
|
4629
|
+
downsampleSuccess: "Successfully downsampled from {{from}} rows to {{to}} rows.",
|
|
4630
|
+
downsampleTooltip: "Reduces number of data rows (decimation) using the Ramer–Douglas–Peucker algorithm.",
|
|
4631
|
+
extraSeparators: "Two or more separators detected. Kept only last one as decimal separator, please control your import results",
|
|
4632
|
+
noDataPastedYet: "No data pasted yet.",
|
|
4633
|
+
semicolonSeparatedValues: "Semicolon-separated values",
|
|
4634
|
+
tabSeparatedValues: "Tab-separated values",
|
|
4635
|
+
examples: "Examples",
|
|
4636
|
+
smartUpload_description: "Upload image and extract table content using a LLM",
|
|
4637
|
+
smartUpload_smartUpload: "Smart Upload",
|
|
4638
|
+
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"
|
|
4639
|
+
}, interpolate = (e, t = {}) => e?.replace(/\{\{(\w+)\}\}/g, (e, n) => t?.[n] === void 0 ? "" : String(t?.[n])), useTranslationMap = (e) => useMemo(() => {
|
|
4640
|
+
let t = Object.keys(enTranslations).reduce((t, n) => {
|
|
4641
|
+
let r = enTranslations?.[n];
|
|
4642
|
+
return t[n] = e?.[n] ?? r, t;
|
|
4643
|
+
}, {});
|
|
4644
|
+
return (e, n) => {
|
|
4645
|
+
let r = t[e];
|
|
4646
|
+
return n ? interpolate(r, n) : r;
|
|
4647
|
+
};
|
|
4648
|
+
}, [e]), normalizeParsedResult = (e) => {
|
|
5148
4649
|
let { rows: t } = e, n = Array(t.length);
|
|
5149
4650
|
for (let e = 0; e < t.length; e++) {
|
|
5150
4651
|
let r = t[e], i = Array(r.length);
|
|
@@ -5156,16 +4657,16 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5156
4657
|
rows: n
|
|
5157
4658
|
};
|
|
5158
4659
|
}, useDataImportActions = ({ config: e, state: t, setState: n, smartUploadConfig: r, startTransition: i }) => {
|
|
5159
|
-
let { exportData: a, beforeExportData:
|
|
4660
|
+
let { exportData: a, beforeExportData: s, importLimit: c = 1e4, validationRules: l = [], translations: u, onImportComplete: d = () => {}, disablePasteSuccessfulToast: f, prevalidationConfig: p, onDeleteRows: m } = e ?? {}, { parsedResult: h } = t, { checkPrevalidationNeed: g } = p ?? {}, _ = useTranslationMap(u), v = useExportData(_, a, s), y = useCallback((e) => {
|
|
5160
4661
|
n((t) => ({
|
|
5161
4662
|
...t,
|
|
5162
4663
|
...e
|
|
5163
4664
|
}));
|
|
5164
|
-
}, [n]),
|
|
4665
|
+
}, [n]), b = useCallback(({ name: e, callback: n } = {}) => {
|
|
5165
4666
|
let r = { ...t.modalVisibility }, i = !e, a = [];
|
|
5166
4667
|
if (i) for (let e of Object.keys(r)) a.push(e), r[e] = !1;
|
|
5167
4668
|
else r?.[e] && (a.push(e), r[e] = !1);
|
|
5168
|
-
a
|
|
4669
|
+
a.length > 0 && y({
|
|
5169
4670
|
modalVisibility: r,
|
|
5170
4671
|
pastedText: "",
|
|
5171
4672
|
parsedResult: {
|
|
@@ -5175,9 +4676,9 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5175
4676
|
units: [],
|
|
5176
4677
|
errors: []
|
|
5177
4678
|
}
|
|
5178
|
-
}), typeof n == "function" && a
|
|
5179
|
-
}, [t.modalVisibility,
|
|
5180
|
-
i(() =>
|
|
4679
|
+
}), typeof n == "function" && a.length > 0 && n();
|
|
4680
|
+
}, [t.modalVisibility, y]), x = useCallback(() => {
|
|
4681
|
+
i(() => y({
|
|
5181
4682
|
pastedText: "",
|
|
5182
4683
|
parsedResult: {
|
|
5183
4684
|
isValid: !1,
|
|
@@ -5186,52 +4687,55 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5186
4687
|
units: [],
|
|
5187
4688
|
errors: []
|
|
5188
4689
|
}
|
|
5189
|
-
})),
|
|
5190
|
-
}, [t.modalVisibility,
|
|
5191
|
-
|
|
4690
|
+
})), m && m?.("all");
|
|
4691
|
+
}, [t.modalVisibility, y]), S = useCallback((e, n) => {
|
|
4692
|
+
y({ modalVisibility: {
|
|
5192
4693
|
...t.modalVisibility,
|
|
5193
4694
|
[e]: n
|
|
5194
4695
|
} });
|
|
5195
|
-
}, [t.modalVisibility,
|
|
4696
|
+
}, [t.modalVisibility, y]), C = useCallback(async (e) => {
|
|
5196
4697
|
let t = {
|
|
5197
|
-
validationRules:
|
|
4698
|
+
validationRules: l,
|
|
5198
4699
|
importLimit: c
|
|
5199
|
-
}, n = await
|
|
5200
|
-
if (
|
|
4700
|
+
}, n = await parse(e, t, _), r = normalizeParsedResult(n);
|
|
4701
|
+
if (g && g(h)) {
|
|
5201
4702
|
let { fields: e, units: n, rows: a, isValid: o } = r, s = unParse(e, n ?? [], a, t);
|
|
5202
|
-
return i(() =>
|
|
4703
|
+
return i(() => y({
|
|
5203
4704
|
pastedText: s,
|
|
5204
|
-
parsedResult:
|
|
4705
|
+
parsedResult: h
|
|
5205
4706
|
})), r;
|
|
5206
4707
|
}
|
|
5207
|
-
return i(() =>
|
|
4708
|
+
return i(() => y({
|
|
5208
4709
|
pastedText: e,
|
|
5209
4710
|
parsedResult: r
|
|
5210
4711
|
})), r;
|
|
5211
4712
|
}, [
|
|
5212
|
-
|
|
4713
|
+
l,
|
|
5213
4714
|
c,
|
|
4715
|
+
_,
|
|
5214
4716
|
g,
|
|
5215
4717
|
h,
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
]), T = useCallback(async (e) => {
|
|
4718
|
+
y
|
|
4719
|
+
]), w = useCallback(async (e) => {
|
|
5219
4720
|
let { fromFile: t, showSuccessToast: n = !0 } = e ?? {}, r;
|
|
5220
4721
|
try {
|
|
5221
4722
|
if (r = t ? await t.text() : await navigator.clipboard.readText(), !r) {
|
|
5222
4723
|
transitionToast({ message: {
|
|
5223
4724
|
type: "Error",
|
|
5224
|
-
content:
|
|
4725
|
+
content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed")
|
|
5225
4726
|
} }, i);
|
|
5226
4727
|
return;
|
|
5227
4728
|
}
|
|
5228
|
-
let e = await
|
|
4729
|
+
let e = await parse(r, {
|
|
4730
|
+
validationRules: l,
|
|
4731
|
+
importLimit: c
|
|
4732
|
+
}, _), a = normalizeParsedResult(e);
|
|
5229
4733
|
return a?.isValid || transitionToast({ message: {
|
|
5230
4734
|
type: "Error",
|
|
5231
|
-
content:
|
|
4735
|
+
content: _("clipboardReadFailed")
|
|
5232
4736
|
} }, i), n && transitionToast({ message: {
|
|
5233
4737
|
type: "Success",
|
|
5234
|
-
content:
|
|
4738
|
+
content: _("pasteSuccessful")
|
|
5235
4739
|
} }, i), {
|
|
5236
4740
|
pastedText: r,
|
|
5237
4741
|
parsedResult: a
|
|
@@ -5239,78 +4743,78 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5239
4743
|
} catch (e) {
|
|
5240
4744
|
transitionToast({ message: {
|
|
5241
4745
|
type: "Error",
|
|
5242
|
-
content:
|
|
4746
|
+
content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed"),
|
|
5243
4747
|
details: e.message
|
|
5244
4748
|
} }, i);
|
|
5245
4749
|
return;
|
|
5246
4750
|
}
|
|
5247
|
-
}, [
|
|
4751
|
+
}, [l, c]), T = useCallback(async (e) => {
|
|
5248
4752
|
let t = e?.target?.files?.[0];
|
|
5249
4753
|
if (!t) return;
|
|
5250
|
-
let n = await t.text(), r = await
|
|
5251
|
-
r.isValid ? (
|
|
4754
|
+
let n = await t.text(), r = await C(n);
|
|
4755
|
+
r.isValid ? (f || transitionToast({ message: {
|
|
5252
4756
|
type: "Success",
|
|
5253
|
-
content:
|
|
5254
|
-
} }, i), i(() =>
|
|
4757
|
+
content: _("pasteSuccessful")
|
|
4758
|
+
} }, i), i(() => d(r))) : transitionToast({ message: {
|
|
5255
4759
|
type: "Error",
|
|
5256
|
-
content:
|
|
4760
|
+
content: _("fileParsingFailed")
|
|
5257
4761
|
} }, i);
|
|
5258
4762
|
}, [
|
|
5259
|
-
|
|
4763
|
+
l,
|
|
5260
4764
|
c,
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
]),
|
|
4765
|
+
y,
|
|
4766
|
+
d
|
|
4767
|
+
]), E = useCallback(async (e = !0) => {
|
|
5264
4768
|
try {
|
|
5265
4769
|
let t = await navigator.clipboard.readText();
|
|
5266
4770
|
if (!t) {
|
|
5267
4771
|
transitionToast({ message: {
|
|
5268
4772
|
type: "Error",
|
|
5269
|
-
content:
|
|
4773
|
+
content: _("clipboardIsEmpty")
|
|
5270
4774
|
} }, i);
|
|
5271
4775
|
return;
|
|
5272
4776
|
}
|
|
5273
|
-
let n = await
|
|
4777
|
+
let n = await C(t);
|
|
5274
4778
|
if (!n.isValid) {
|
|
5275
4779
|
transitionToast({ message: {
|
|
5276
4780
|
type: "Error",
|
|
5277
|
-
content:
|
|
4781
|
+
content: _("clipboardReadFailed")
|
|
5278
4782
|
} }, i);
|
|
5279
4783
|
return;
|
|
5280
4784
|
}
|
|
5281
|
-
|
|
4785
|
+
f || transitionToast({ message: {
|
|
5282
4786
|
type: "Success",
|
|
5283
|
-
content:
|
|
5284
|
-
} }, i), e && i(() =>
|
|
4787
|
+
content: _("pasteSuccessful")
|
|
4788
|
+
} }, i), e && i(() => d(n));
|
|
5285
4789
|
} catch {
|
|
5286
4790
|
transitionToast({ message: {
|
|
5287
4791
|
type: "Error",
|
|
5288
|
-
content:
|
|
4792
|
+
content: _("clipboardReadNotAllowed")
|
|
5289
4793
|
} }, i);
|
|
5290
4794
|
}
|
|
5291
4795
|
}, [
|
|
5292
|
-
|
|
4796
|
+
l,
|
|
5293
4797
|
c,
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
]),
|
|
5298
|
-
let t = await
|
|
4798
|
+
_,
|
|
4799
|
+
y,
|
|
4800
|
+
d
|
|
4801
|
+
]), D = useCallback(async (e) => {
|
|
4802
|
+
let t = await v();
|
|
5299
4803
|
if (!t) return;
|
|
5300
|
-
let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r ?? []).map((e) => e?.length ? e : placeholder$1).slice(0, n
|
|
4804
|
+
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: " " });
|
|
5301
4805
|
try {
|
|
5302
4806
|
await navigator.clipboard.writeText(l), transitionToast({ message: {
|
|
5303
4807
|
type: "Success",
|
|
5304
|
-
content:
|
|
4808
|
+
content: _("copiedToClipboard")
|
|
5305
4809
|
} }, i);
|
|
5306
4810
|
} catch (e) {
|
|
5307
4811
|
transitionToast({ message: {
|
|
5308
4812
|
type: "Error",
|
|
5309
|
-
content:
|
|
4813
|
+
content: _("unableToCopyToClipboard"),
|
|
5310
4814
|
details: e.message
|
|
5311
4815
|
} }, i);
|
|
5312
4816
|
}
|
|
5313
|
-
}, [
|
|
4817
|
+
}, [v, _]), O = useCallback((e) => {
|
|
5314
4818
|
if (!e || e.errorMessage) {
|
|
5315
4819
|
transitionToast({ message: {
|
|
5316
4820
|
type: "Error",
|
|
@@ -5325,24 +4829,24 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5325
4829
|
rows: n.map((e) => Object.values(e)),
|
|
5326
4830
|
errors: []
|
|
5327
4831
|
};
|
|
5328
|
-
i(() =>
|
|
4832
|
+
i(() => y({ parsedResult: a })), i(() => d(a));
|
|
5329
4833
|
let { onComplete: o } = r ?? {};
|
|
5330
|
-
typeof o == "function" && o(a),
|
|
4834
|
+
typeof o == "function" && o(a), b();
|
|
5331
4835
|
}, [
|
|
5332
|
-
|
|
5333
|
-
|
|
4836
|
+
y,
|
|
4837
|
+
d,
|
|
5334
4838
|
r
|
|
5335
4839
|
]);
|
|
5336
4840
|
return {
|
|
5337
|
-
updateState:
|
|
5338
|
-
closeModals:
|
|
5339
|
-
setModalVisibility:
|
|
5340
|
-
readAndParseInput:
|
|
5341
|
-
onFileChange:
|
|
5342
|
-
onClickQuickPasteFromClipBoard:
|
|
5343
|
-
onClickCopyClipboard:
|
|
5344
|
-
onSmartUploadResult:
|
|
5345
|
-
deleteAllRows:
|
|
4841
|
+
updateState: y,
|
|
4842
|
+
closeModals: b,
|
|
4843
|
+
setModalVisibility: S,
|
|
4844
|
+
readAndParseInput: w,
|
|
4845
|
+
onFileChange: T,
|
|
4846
|
+
onClickQuickPasteFromClipBoard: E,
|
|
4847
|
+
onClickCopyClipboard: D,
|
|
4848
|
+
onSmartUploadResult: O,
|
|
4849
|
+
deleteAllRows: x
|
|
5346
4850
|
};
|
|
5347
4851
|
}, onClickDownLoad = (e, t) => {
|
|
5348
4852
|
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");
|
|
@@ -5378,167 +4882,165 @@ var initialState = {
|
|
|
5378
4882
|
helpModal: !1
|
|
5379
4883
|
}
|
|
5380
4884
|
};
|
|
5381
|
-
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n
|
|
5382
|
-
let { exportData:
|
|
5383
|
-
useRegisterValidationRules(r ?? b, s);
|
|
5384
|
-
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({
|
|
4885
|
+
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
|
|
4886
|
+
let { exportData: r, beforeExportData: i, prevalidationConfig: a, validationRules: o, title: s, translations: c, textOnly: l = !1, showImportOptions: u = !0, copyFromClipBoard: d = !0, showDeleteOptions: f = !0, showHelpOption: p = !0, modals: g = [], dynamicOptions: _, onImportComplete: v } = e ?? {}, [y, b] = useState(initialState), { modalVisibility: { smartUploadModal: x = !1, reviewPasteModal: S = !1, helpModal: C = !1 } } = y, { enabled: w, prompt: T = "", onClose: E, onError: D, service: O = () => Promise.resolve() } = t ?? {}, k = useTranslationMap(c), A = useExportData(k, r, i), [j, M] = useTransition(), { readAndParseInput: N, updateState: P, closeModals: F, setModalVisibility: I, onFileChange: L, onClickQuickPasteFromClipBoard: R, onClickCopyClipboard: z, onSmartUploadResult: B, deleteAllRows: V } = useDataImportActions({
|
|
5385
4887
|
config: e,
|
|
5386
|
-
state:
|
|
5387
|
-
setState:
|
|
4888
|
+
state: y,
|
|
4889
|
+
setState: b,
|
|
5388
4890
|
smartUploadConfig: t,
|
|
5389
|
-
startTransition:
|
|
4891
|
+
startTransition: M
|
|
5390
4892
|
}) ?? {};
|
|
5391
|
-
useKeyboardEvent("Escape", () =>
|
|
5392
|
-
let
|
|
4893
|
+
useKeyboardEvent("Escape", () => F());
|
|
4894
|
+
let H = u ? [
|
|
5393
4895
|
{
|
|
5394
4896
|
type: "Option",
|
|
5395
|
-
label:
|
|
4897
|
+
label: k("uploadFile"),
|
|
5396
4898
|
upload: !0,
|
|
5397
4899
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5398
|
-
onChange:
|
|
4900
|
+
onChange: L,
|
|
5399
4901
|
testId: `${n}-option-upload-file`
|
|
5400
4902
|
},
|
|
5401
|
-
...
|
|
4903
|
+
...d ? [{
|
|
5402
4904
|
type: "Option",
|
|
5403
|
-
label:
|
|
5404
|
-
onClick:
|
|
4905
|
+
label: k("quickPasteFromClipboard"),
|
|
4906
|
+
onClick: R,
|
|
5405
4907
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
5406
4908
|
}] : [],
|
|
5407
|
-
...
|
|
4909
|
+
...d ? [{
|
|
5408
4910
|
type: "Option",
|
|
5409
|
-
label:
|
|
5410
|
-
onClick: () =>
|
|
4911
|
+
label: k("pasteWithReview"),
|
|
4912
|
+
onClick: () => I("reviewPasteModal", !S),
|
|
5411
4913
|
testId: `${n}-paste-with-review`
|
|
5412
4914
|
}] : [],
|
|
5413
|
-
...
|
|
4915
|
+
...T && w && t ? [{
|
|
5414
4916
|
type: "Option",
|
|
5415
|
-
label:
|
|
5416
|
-
onClick: () =>
|
|
4917
|
+
label: k("smartUpload_smartUpload"),
|
|
4918
|
+
onClick: () => I("smartUploadModal", !x),
|
|
5417
4919
|
testId: `${n}-smart-upload`
|
|
5418
4920
|
}] : [],
|
|
5419
|
-
...applyModalHandlers(
|
|
5420
|
-
] : [],
|
|
4921
|
+
...applyModalHandlers(_?.importOptions ?? [], y, I)
|
|
4922
|
+
] : [], U = [
|
|
5421
4923
|
{
|
|
5422
4924
|
type: "Option",
|
|
5423
|
-
label:
|
|
4925
|
+
label: k("downloadFile"),
|
|
5424
4926
|
onClick: async () => {
|
|
5425
|
-
let e = await
|
|
5426
|
-
e && e && onClickDownLoad(e,
|
|
4927
|
+
let e = await A();
|
|
4928
|
+
e && e && onClickDownLoad(e, s);
|
|
5427
4929
|
}
|
|
5428
4930
|
},
|
|
5429
|
-
...
|
|
4931
|
+
...l ? [{
|
|
5430
4932
|
type: "Option",
|
|
5431
|
-
label:
|
|
5432
|
-
onClick: () =>
|
|
4933
|
+
label: k("copyToClipboard"),
|
|
4934
|
+
onClick: () => z("dot")
|
|
5433
4935
|
}] : [{
|
|
5434
4936
|
type: "Menu",
|
|
5435
4937
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
5436
4938
|
menu: {
|
|
5437
4939
|
trigger: "Text",
|
|
5438
|
-
label:
|
|
4940
|
+
label: k("copyToClipboard"),
|
|
5439
4941
|
sections: [{
|
|
5440
4942
|
type: "Option",
|
|
5441
|
-
label:
|
|
5442
|
-
onClick: () =>
|
|
4943
|
+
label: k("copyDecimalDot"),
|
|
4944
|
+
onClick: () => z("dot"),
|
|
5443
4945
|
testId: `${n}-option-copy-decimal-dot`
|
|
5444
4946
|
}, {
|
|
5445
4947
|
type: "Option",
|
|
5446
|
-
label:
|
|
5447
|
-
onClick: () =>
|
|
4948
|
+
label: k("copyDecimalComma"),
|
|
4949
|
+
onClick: () => z("comma")
|
|
5448
4950
|
}]
|
|
5449
4951
|
}
|
|
5450
4952
|
}],
|
|
5451
|
-
...applyModalHandlers(
|
|
5452
|
-
],
|
|
4953
|
+
...applyModalHandlers(_?.exportOptions ?? [], y, I)
|
|
4954
|
+
], W = f ? [{
|
|
5453
4955
|
type: "Option",
|
|
5454
|
-
label:
|
|
5455
|
-
onClick: () =>
|
|
4956
|
+
label: k("deleteAllRows"),
|
|
4957
|
+
onClick: () => V(),
|
|
5456
4958
|
testId: `${n}-delete-all-rows`
|
|
5457
|
-
}, ...applyModalHandlers(
|
|
4959
|
+
}, ...applyModalHandlers(_?.deleteOptions ?? [], y, I)] : [], G = p ? [
|
|
5458
4960
|
{ type: "Divider" },
|
|
5459
4961
|
{
|
|
5460
4962
|
type: "Option",
|
|
5461
|
-
label:
|
|
5462
|
-
onClick: () =>
|
|
4963
|
+
label: k("help"),
|
|
4964
|
+
onClick: () => I("helpModal", !C)
|
|
5463
4965
|
},
|
|
5464
|
-
...applyModalHandlers(
|
|
5465
|
-
] : [],
|
|
5466
|
-
...
|
|
5467
|
-
section: [...
|
|
4966
|
+
...applyModalHandlers(_?.helpOptions ?? [], y, I)
|
|
4967
|
+
] : [], K = [
|
|
4968
|
+
...H.length ? [{
|
|
4969
|
+
section: [...H, ...G],
|
|
5468
4970
|
name: "import-options",
|
|
5469
4971
|
iconName: "upload",
|
|
5470
|
-
tooltip:
|
|
4972
|
+
tooltip: k("import")
|
|
5471
4973
|
}] : [],
|
|
5472
|
-
...
|
|
5473
|
-
section:
|
|
4974
|
+
...U.length ? [{
|
|
4975
|
+
section: U,
|
|
5474
4976
|
name: "export-options",
|
|
5475
4977
|
iconName: "download",
|
|
5476
|
-
tooltip:
|
|
4978
|
+
tooltip: k("export")
|
|
5477
4979
|
}] : [],
|
|
5478
|
-
...
|
|
5479
|
-
section:
|
|
4980
|
+
...W.length ? [{
|
|
4981
|
+
section: W,
|
|
5480
4982
|
name: "delete-options",
|
|
5481
4983
|
iconName: "delete",
|
|
5482
|
-
tooltip:
|
|
4984
|
+
tooltip: k("deleteAllRows")
|
|
5483
4985
|
}] : []
|
|
5484
4986
|
];
|
|
5485
4987
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
5486
|
-
|
|
4988
|
+
j && /* @__PURE__ */ jsx(Spinner, {
|
|
5487
4989
|
small: !0,
|
|
5488
4990
|
dark: !0
|
|
5489
4991
|
}),
|
|
5490
|
-
|
|
4992
|
+
K.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
5491
4993
|
sections: e.section,
|
|
5492
4994
|
iconName: e.iconName,
|
|
5493
4995
|
tooltip: e.tooltip,
|
|
5494
4996
|
testId: `data-${e?.name}-menu`
|
|
5495
4997
|
}, t)),
|
|
5496
|
-
|
|
4998
|
+
S && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
5497
4999
|
config: e,
|
|
5498
|
-
state:
|
|
5499
|
-
updateState:
|
|
5500
|
-
setModalVisibility:
|
|
5501
|
-
readAndParseInput:
|
|
5502
|
-
onCloseModal:
|
|
5503
|
-
validationRules:
|
|
5504
|
-
onCompleteImport:
|
|
5505
|
-
prevalidationConfig:
|
|
5506
|
-
t:
|
|
5507
|
-
loading:
|
|
5508
|
-
startTransition:
|
|
5000
|
+
state: y,
|
|
5001
|
+
updateState: P,
|
|
5002
|
+
setModalVisibility: I,
|
|
5003
|
+
readAndParseInput: N,
|
|
5004
|
+
onCloseModal: F,
|
|
5005
|
+
validationRules: o,
|
|
5006
|
+
onCompleteImport: v,
|
|
5007
|
+
prevalidationConfig: a,
|
|
5008
|
+
t: k,
|
|
5009
|
+
loading: j,
|
|
5010
|
+
startTransition: M,
|
|
5509
5011
|
testId: n
|
|
5510
5012
|
}),
|
|
5511
|
-
|
|
5512
|
-
visible: T,
|
|
5513
|
-
setModalVisibility: R,
|
|
5514
|
-
validationRules: s,
|
|
5515
|
-
t: j
|
|
5516
|
-
}),
|
|
5517
|
-
E && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
5013
|
+
C && /* @__PURE__ */ jsx(HelpModal, {
|
|
5518
5014
|
visible: C,
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5015
|
+
setModalVisibility: I,
|
|
5016
|
+
validationRules: o,
|
|
5017
|
+
t: k
|
|
5018
|
+
}),
|
|
5019
|
+
w && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
5020
|
+
visible: x,
|
|
5021
|
+
prompt: T,
|
|
5022
|
+
onUpload: O,
|
|
5023
|
+
onCloseModal: () => F({ callback: E }),
|
|
5024
|
+
onComplete: B,
|
|
5025
|
+
onError: D,
|
|
5026
|
+
heading: k("smartUpload_smartUpload"),
|
|
5027
|
+
dialogText: k("smartUpload_description"),
|
|
5028
|
+
fileInputText: k("chooseFile"),
|
|
5029
|
+
fileInputPlaceholder: k("noFileSelected"),
|
|
5030
|
+
uploadText: k("uploadCapitalized"),
|
|
5031
|
+
cancelText: k("cancel"),
|
|
5530
5032
|
testId: n
|
|
5531
5033
|
}),
|
|
5532
5034
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5533
|
-
modals:
|
|
5534
|
-
modalVisibility:
|
|
5535
|
-
onCloseModal:
|
|
5035
|
+
modals: g,
|
|
5036
|
+
modalVisibility: y?.modalVisibility,
|
|
5037
|
+
onCloseModal: F,
|
|
5536
5038
|
testId: n
|
|
5537
5039
|
})
|
|
5538
5040
|
] });
|
|
5539
5041
|
}, FileButton = ({ file: e, accept: t, multi: n, name: r, disabled: i, onChange: a = noop,...o }) => {
|
|
5540
|
-
let
|
|
5541
|
-
i ||
|
|
5042
|
+
let c = useContext(DisabledContext), l = useRef(null), u = () => {
|
|
5043
|
+
i || c || l.current?.click();
|
|
5542
5044
|
}, d = (e) => {
|
|
5543
5045
|
let t = n ? e.target.files : e.target.files?.[0], r = {
|
|
5544
5046
|
...e,
|
|
@@ -5817,15 +5319,15 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5817
5319
|
},
|
|
5818
5320
|
children: e.content
|
|
5819
5321
|
}) : null, ListSubheading = forwardRef(({ item: e, index: t }, n) => {
|
|
5820
|
-
let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick:
|
|
5322
|
+
let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick: c, title: l, name: u, icon: d, testId: f } = e;
|
|
5821
5323
|
return /* @__PURE__ */ jsx("div", {
|
|
5822
5324
|
ref: (e) => {
|
|
5823
5325
|
n && "current" in n && Array.isArray(n.current) && t !== void 0 && (n.current[t] = e);
|
|
5824
5326
|
},
|
|
5825
5327
|
"data-testid": f ?? null,
|
|
5826
|
-
className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "",
|
|
5328
|
+
className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "", c ? list_module_default.action : ""),
|
|
5827
5329
|
onClick: (e) => {
|
|
5828
|
-
|
|
5330
|
+
c && c(e);
|
|
5829
5331
|
},
|
|
5830
5332
|
title: l,
|
|
5831
5333
|
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -5850,7 +5352,7 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5850
5352
|
}) })
|
|
5851
5353
|
});
|
|
5852
5354
|
}), ListRow = forwardRef(({ item: e, index: t, expanding: n, invokeEditOnRowClick: r, draggable: i }, a) => {
|
|
5853
|
-
let o = useContext(DisabledContext),
|
|
5355
|
+
let o = useContext(DisabledContext), c = (e, t, s, c, l, u) => {
|
|
5854
5356
|
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";
|
|
5855
5357
|
return /* @__PURE__ */ jsx(m, {
|
|
5856
5358
|
href: t.url,
|
|
@@ -5904,16 +5406,16 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5904
5406
|
item: e,
|
|
5905
5407
|
index: t
|
|
5906
5408
|
}, t) : i ? ((e, t) => {
|
|
5907
|
-
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging:
|
|
5409
|
+
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging: s } = useSortable({
|
|
5908
5410
|
id: e.toString(),
|
|
5909
5411
|
animateLayoutChanges: () => !1
|
|
5910
5412
|
}), l = {
|
|
5911
5413
|
transform: CSS.Translate.toString(a),
|
|
5912
5414
|
transition: o,
|
|
5913
|
-
opacity:
|
|
5415
|
+
opacity: s ? 0 : 1
|
|
5914
5416
|
};
|
|
5915
|
-
return
|
|
5916
|
-
})(t, e) :
|
|
5417
|
+
return c(e, t, l, n, r, i);
|
|
5418
|
+
})(t, e) : c(t, e);
|
|
5917
5419
|
}), ListDragWrapper = ({ children: e, draggable: t, list: n, onListReorder: r }) => {
|
|
5918
5420
|
let [i, a] = useState(null), o = (e) => {
|
|
5919
5421
|
a(e.active.id);
|
|
@@ -5946,9 +5448,9 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5946
5448
|
}), document.body)]
|
|
5947
5449
|
}) : e;
|
|
5948
5450
|
}, ListVirtualScrollWrapper = ({ items: e, scrollDetails: t, children: n }) => {
|
|
5949
|
-
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll:
|
|
5451
|
+
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll: s } = t, l = useRef(null), u = useVirtualizer({
|
|
5950
5452
|
count: e.length,
|
|
5951
|
-
getScrollElement: () =>
|
|
5453
|
+
getScrollElement: () => l.current,
|
|
5952
5454
|
estimateSize: useCallback(() => {
|
|
5953
5455
|
let t = 37;
|
|
5954
5456
|
if (e.length > 0) {
|
|
@@ -5970,8 +5472,8 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5970
5472
|
f(t);
|
|
5971
5473
|
}
|
|
5972
5474
|
}, [a]), /* @__PURE__ */ jsx("div", {
|
|
5973
|
-
className: cx(list_module_default.listContent, r ||
|
|
5974
|
-
ref:
|
|
5475
|
+
className: cx(list_module_default.listContent, r || s ? list_module_default.scrollableList : "", i ? list_module_default.hideScrollbar : ""),
|
|
5476
|
+
ref: l,
|
|
5975
5477
|
children: /* @__PURE__ */ jsx("div", {
|
|
5976
5478
|
className: list_module_default.virtualRows,
|
|
5977
5479
|
style: { height: `${u.getTotalSize()}px` },
|
|
@@ -6242,12 +5744,12 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
6242
5744
|
})
|
|
6243
5745
|
]
|
|
6244
5746
|
});
|
|
6245
|
-
}, RadioButton = ({ name: e, label: t, options: n, value: r, onChange: i, disabled: a = !1, small: o = !1, noMargin:
|
|
6246
|
-
let m = useContext(DisabledContext), h = f !== void 0, { simpleInputs:
|
|
5747
|
+
}, RadioButton = ({ name: e, label: t, options: n, value: r, onChange: i, disabled: a = !1, small: o = !1, noMargin: c = !1, onClick: l = () => {}, inline: u = !1, mainLabel: d = "", radioButtonsData: f, classForContainer: p = "grouped fields" }) => {
|
|
5748
|
+
let m = useContext(DisabledContext), h = f !== void 0, { simpleInputs: _, options: v, selectedOptions: y } = h ? {
|
|
6247
5749
|
simpleInputs: !1,
|
|
6248
5750
|
options: f,
|
|
6249
5751
|
selectedOptions: void 0
|
|
6250
|
-
} : standardizeInputs(n, r), b = h || y == null ? void 0 :
|
|
5752
|
+
} : standardizeInputs(n, r), b = h || y == null ? void 0 : _ ? y : y.value, x = h ? d : t;
|
|
6251
5753
|
return /* @__PURE__ */ jsxs("div", {
|
|
6252
5754
|
className: cx(radio_button_module_default.wrapper, u ? radio_button_module_default.inline : null, p === "inline fields" ? radio_button_module_default.inline : null),
|
|
6253
5755
|
children: [d && /* @__PURE__ */ jsx("label", {
|
|
@@ -6262,7 +5764,7 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
6262
5764
|
selected: r,
|
|
6263
5765
|
disabled: a || t.disabled || m,
|
|
6264
5766
|
small: o,
|
|
6265
|
-
noMargin:
|
|
5767
|
+
noMargin: c,
|
|
6266
5768
|
onChange: t.disabled ? void 0 : (n) => {
|
|
6267
5769
|
h ? l(n.target) : (n.target.name = e, n.target.value = t.value.toString(), n.target.label = t.label.toString(), i && i(n));
|
|
6268
5770
|
},
|
|
@@ -6339,7 +5841,7 @@ var rich_text_input_module_default = {
|
|
|
6339
5841
|
richTextInput: "_richTextInput_1fb4l_77"
|
|
6340
5842
|
};
|
|
6341
5843
|
const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
|
|
6342
|
-
let o = useContext(DisabledContext),
|
|
5844
|
+
let o = useContext(DisabledContext), c = r || o, { manager: u, state: d, setState: f, getContext: p } = useRemirror({
|
|
6343
5845
|
extensions: () => [
|
|
6344
5846
|
new BoldExtension({}),
|
|
6345
5847
|
new BulletListExtension({}),
|
|
@@ -6356,31 +5858,31 @@ const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disab
|
|
|
6356
5858
|
return useImperativeHandle(a, () => p(), [p]), /* @__PURE__ */ jsx("div", {
|
|
6357
5859
|
className: rich_text_input_module_default.richTextInput,
|
|
6358
5860
|
children: /* @__PURE__ */ jsxs(Remirror, {
|
|
6359
|
-
manager:
|
|
5861
|
+
manager: u,
|
|
6360
5862
|
state: d,
|
|
6361
5863
|
placeholder: e,
|
|
6362
5864
|
onChange: ({ helpers: e, state: n }) => {
|
|
6363
5865
|
let r = e.getMarkdown(n);
|
|
6364
5866
|
t && t(r), f(n);
|
|
6365
5867
|
},
|
|
6366
|
-
editable: !
|
|
5868
|
+
editable: !c,
|
|
6367
5869
|
children: [/* @__PURE__ */ jsx(RichTextToolbar, {
|
|
6368
|
-
disabled:
|
|
5870
|
+
disabled: c,
|
|
6369
5871
|
toolbarComponent: i
|
|
6370
5872
|
}), /* @__PURE__ */ jsx(EditorComponent, {})]
|
|
6371
5873
|
})
|
|
6372
5874
|
});
|
|
6373
5875
|
});
|
|
6374
5876
|
var row_module_default = { row: "_row_n16je_1" };
|
|
6375
|
-
const Row = ({ alignItems: t = "initial", justifyContent: n = "initial", children: r = null, flex:
|
|
5877
|
+
const Row = ({ alignItems: t = "initial", justifyContent: n = "initial", children: r = null, flex: a = !1, height: o = "auto", marginBottom: s = "0", marginTop: c = "0", spacing: l = "var(--padding)", wrap: u = !1, testId: d = null }) => {
|
|
6376
5878
|
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));
|
|
6377
5879
|
return /* @__PURE__ */ jsx("div", {
|
|
6378
5880
|
className: cx(row_module_default.row),
|
|
6379
5881
|
style: {
|
|
6380
5882
|
alignItems: t,
|
|
6381
5883
|
justifyContent: n,
|
|
6382
|
-
flexGrow:
|
|
6383
|
-
flexShrink:
|
|
5884
|
+
flexGrow: a ? 1 : 0,
|
|
5885
|
+
flexShrink: a ? 1 : 0,
|
|
6384
5886
|
flexWrap: u ? "wrap" : "nowrap",
|
|
6385
5887
|
height: o,
|
|
6386
5888
|
marginLeft: `calc(${f} * -0.5)`,
|
|
@@ -6530,7 +6032,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6530
6032
|
}, Content$1 = ({ children: e, activeTabIndex: t, contentPadding: n }) => Array.isArray(e) ? /* @__PURE__ */ jsx("div", {
|
|
6531
6033
|
className: cx(n ? tabs_module_default.contentPadding : ""),
|
|
6532
6034
|
children: e.map((e, n) => t === n && e)
|
|
6533
|
-
}) : 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:
|
|
6035
|
+
}) : null, Tabs = ({ name: e = void 0, options: t = null, children: n = null, value: r = void 0, onChange: i = noop, padding: a = !1, margin: o = !0, contentPadding: c = !0, onChangeTab: l, activeTabIndex: u = void 0, tabs: d = void 0, testId: f }) => {
|
|
6534
6036
|
let p = useContext(DisabledContext), m = l !== void 0, h = n ? n.map((e, t) => ({
|
|
6535
6037
|
value: t,
|
|
6536
6038
|
url: e.props.url,
|
|
@@ -6539,11 +6041,11 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6539
6041
|
disabled: e.props.disabled || p,
|
|
6540
6042
|
badge: e.props.badge,
|
|
6541
6043
|
testId: e.props?.testId && `${e.props.testId}-${t}`
|
|
6542
|
-
})) : t || d, { simpleInputs:
|
|
6044
|
+
})) : t || d, { simpleInputs: _, options: v, selectedOptions: y } = m ? {
|
|
6543
6045
|
simpleInputs: !1,
|
|
6544
6046
|
options: h,
|
|
6545
6047
|
selectedOptions: void 0
|
|
6546
|
-
} : standardizeInputs(h, r), b = m || y == null ? void 0 :
|
|
6048
|
+
} : standardizeInputs(h, r), b = m || y == null ? void 0 : _ ? y : y.value, x = u === void 0 ? v?.findIndex((e) => e.value === b) : u, S = x === -1 ? 0 : x, C = (t, n, r) => {
|
|
6547
6049
|
if (m) {
|
|
6548
6050
|
let e = n.key || n.label || null;
|
|
6549
6051
|
l(t, e);
|
|
@@ -6572,7 +6074,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6572
6074
|
children: v.map(w)
|
|
6573
6075
|
}), /* @__PURE__ */ jsx(Content$1, {
|
|
6574
6076
|
activeTabIndex: S ?? 0,
|
|
6575
|
-
contentPadding:
|
|
6077
|
+
contentPadding: c,
|
|
6576
6078
|
children: n
|
|
6577
6079
|
})] }) : null;
|
|
6578
6080
|
}, TextLink = ({ children: e, href: t = void 0, target: n = void 0, testId: r, onClick: i, component: a = "a" }) => /* @__PURE__ */ jsx(a, {
|
|
@@ -6598,7 +6100,7 @@ var textarea_module_default = {
|
|
|
6598
6100
|
small: "_small_q0tl0_116",
|
|
6599
6101
|
monospace: "_monospace_q0tl0_155"
|
|
6600
6102
|
};
|
|
6601
|
-
const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows: i, disabled: a = !1, onChange: o = noop, onKeyPress:
|
|
6103
|
+
const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows: i, disabled: a = !1, onChange: o = noop, onKeyPress: c = noop, onFocus: l = noop, onBlur: u = noop, tabIndex: d = 0, error: f = null, warning: p = null, tooltip: m = null, maxTooltipWidth: h, resize: _, monospace: v = !1, testId: y }) => {
|
|
6602
6104
|
let b = useContext(DisabledContext), x = /* @__PURE__ */ jsx("textarea", {
|
|
6603
6105
|
className: cx(textarea_module_default.textarea, f ? textarea_module_default.error : "", p ? textarea_module_default.warning : "", v ? textarea_module_default.monospace : ""),
|
|
6604
6106
|
name: e,
|
|
@@ -6608,11 +6110,11 @@ const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows:
|
|
|
6608
6110
|
rows: i,
|
|
6609
6111
|
onChange: o,
|
|
6610
6112
|
disabled: a || b,
|
|
6611
|
-
onKeyPress:
|
|
6113
|
+
onKeyPress: c,
|
|
6612
6114
|
onFocus: l,
|
|
6613
6115
|
onBlur: u,
|
|
6614
6116
|
tabIndex: d,
|
|
6615
|
-
style: { resize:
|
|
6117
|
+
style: { resize: _ },
|
|
6616
6118
|
"data-error": f || null,
|
|
6617
6119
|
"data-warning": p || null,
|
|
6618
6120
|
"data-testid": y
|
|
@@ -6692,9 +6194,9 @@ const Warning = ({ warning: e }) => /* @__PURE__ */ jsx("div", {
|
|
|
6692
6194
|
let ElementType = /* @__PURE__ */ function(e) {
|
|
6693
6195
|
return e.LINK = "Link", e.BUTTON = "Button", e.MENU = "Menu", e.COMPONENT = "Component", e;
|
|
6694
6196
|
}({});
|
|
6695
|
-
const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, testId: o, component:
|
|
6197
|
+
const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, testId: o, component: c = "a" }) => {
|
|
6696
6198
|
let l = useContext(DisabledContext);
|
|
6697
|
-
return /* @__PURE__ */ jsxs(
|
|
6199
|
+
return /* @__PURE__ */ jsxs(c, {
|
|
6698
6200
|
className: cx(top_bar_module_default.link, i ? top_bar_module_default.active : ""),
|
|
6699
6201
|
href: t || "#",
|
|
6700
6202
|
to: t,
|
|
@@ -6839,16 +6341,16 @@ var tree_module_default = {
|
|
|
6839
6341
|
placeholder: "_placeholder_15yn1_29"
|
|
6840
6342
|
};
|
|
6841
6343
|
const TreeItem = ({ node: t, depth: n, isOpen: r, onToggle: i, hasChild: a, draggable: o, icons: s, onDrop: c }) => {
|
|
6842
|
-
let { id: l, data: u } = t, { active: d, testId: f, onClick: p, actions: m = [] } = u, [h,
|
|
6344
|
+
let { id: l, data: u } = t, { active: d, testId: f, onClick: p, actions: m = [] } = u, [h, _] = React.useState(!1), [v, y] = React.useState(0), b = (e) => {
|
|
6843
6345
|
e.stopPropagation(), i(l);
|
|
6844
6346
|
}, x = (e) => {
|
|
6845
|
-
e.preventDefault(), e.stopPropagation(), h || (
|
|
6347
|
+
e.preventDefault(), e.stopPropagation(), h || (_(!0), y((/* @__PURE__ */ new Date()).getTime()));
|
|
6846
6348
|
}, S = (e) => {
|
|
6847
|
-
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 &&
|
|
6349
|
+
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 && _(!1);
|
|
6848
6350
|
}, C = (e) => {
|
|
6849
6351
|
e.preventDefault(), e.stopPropagation(), a && !r && (/* @__PURE__ */ new Date()).getTime() - v > 200 && b(e);
|
|
6850
6352
|
}, w = (e) => {
|
|
6851
|
-
e.preventDefault(), e.stopPropagation(),
|
|
6353
|
+
e.preventDefault(), e.stopPropagation(), _(!1), y((/* @__PURE__ */ new Date()).getTime()), c?.(e);
|
|
6852
6354
|
};
|
|
6853
6355
|
return /* @__PURE__ */ jsx("div", {
|
|
6854
6356
|
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 : ""),
|
|
@@ -7076,18 +6578,18 @@ var unit_input_module_default = {
|
|
|
7076
6578
|
predefinedMenuActive: "_predefinedMenuActive_ye9w9_1",
|
|
7077
6579
|
inputWrapper: "_inputWrapper_ye9w9_4"
|
|
7078
6580
|
};
|
|
7079
|
-
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:
|
|
6581
|
+
const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUnit: r = !1, error: i = null, left: a = !1, small: o = !1, width: s = "100%", value: l, unitkey: u = "", initUnit: f, noConversion: p = !1, onChange: h = noop, onClick: _ = noop, onFocus: v = noop, onSwitchUnit: y = noop, unitTemplate: b, testId: x, warning: S = null, predefinedOptions: C, initialPredefinedOption: w = !1, shouldLinkAutomaticly: T = !0, selectedPredefinedOptionKey: E, validationCallback: D = () => ({
|
|
7080
6582
|
name: "",
|
|
7081
6583
|
error: null
|
|
7082
6584
|
}), disabledValidation: O = !1, allowEmpty: k = !1, convertBackToStorageUnit: A = !1, enableCosmeticRounding: j = !0, enableDisplayRounding: M = !1, roundDisplayValue: N, selectOnFocus: P, groupOrder: F, tooltip: I = null }) => {
|
|
7083
6585
|
let L = useUnitContext(), R = useRunAfterUpdate();
|
|
7084
|
-
typeof
|
|
7085
|
-
let [z = "", B = ""] =
|
|
6586
|
+
typeof l == "number" && (l = `${l}`);
|
|
6587
|
+
let [z = "", B = ""] = l === void 0 ? [] : split(l), V = useMemo(() => getPreferredUnit(u, b || L?.unitTemplate), [
|
|
7086
6588
|
u,
|
|
7087
6589
|
b,
|
|
7088
6590
|
L?.unitTemplate
|
|
7089
|
-
]), H = isKnownUnit(
|
|
7090
|
-
value:
|
|
6591
|
+
]), H = isKnownUnit(l, V), U = f || V || B, W = usePrevious(U), { value: G } = safeConvertValue({
|
|
6592
|
+
value: l,
|
|
7091
6593
|
toUnit: U,
|
|
7092
6594
|
unitkey: u,
|
|
7093
6595
|
defaultFromUnit: B,
|
|
@@ -7098,17 +6600,17 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7098
6600
|
} : {
|
|
7099
6601
|
value: G,
|
|
7100
6602
|
unit: U
|
|
7101
|
-
}),
|
|
6603
|
+
}), kd = k || K?.value === void 0, [J, Ad] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), jd = !!(O || n), Y = C && C.find((e) => {
|
|
7102
6604
|
if (!e?.value) return;
|
|
7103
6605
|
if (E) return E === e.valueKey;
|
|
7104
|
-
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n =
|
|
7105
|
-
value: String(
|
|
6606
|
+
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
6607
|
+
value: String(l),
|
|
7106
6608
|
unitkey: u,
|
|
7107
6609
|
toUnit: t
|
|
7108
6610
|
});
|
|
7109
6611
|
return withUnit(n, t) === e.value;
|
|
7110
|
-
}),
|
|
7111
|
-
let e =
|
|
6612
|
+
}), Md = () => {
|
|
6613
|
+
let e = l ?? "", t = K.unit;
|
|
7112
6614
|
if (checkConversion({
|
|
7113
6615
|
value: e,
|
|
7114
6616
|
unitkey: u,
|
|
@@ -7121,9 +6623,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7121
6623
|
return null;
|
|
7122
6624
|
}
|
|
7123
6625
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
7124
|
-
},
|
|
6626
|
+
}, Nd = (t) => {
|
|
7125
6627
|
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;
|
|
7126
|
-
|
|
6628
|
+
h({ target: {
|
|
7127
6629
|
value: s,
|
|
7128
6630
|
name: n
|
|
7129
6631
|
} });
|
|
@@ -7134,7 +6636,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7134
6636
|
}), R(() => {
|
|
7135
6637
|
r.selectionStart = a, r.selectionEnd = a;
|
|
7136
6638
|
});
|
|
7137
|
-
},
|
|
6639
|
+
}, Pd = (e, t) => {
|
|
7138
6640
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
7139
6641
|
value: e,
|
|
7140
6642
|
unit: t
|
|
@@ -7145,16 +6647,16 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7145
6647
|
let e, t = "";
|
|
7146
6648
|
if (W !== U) {
|
|
7147
6649
|
let { value: n } = safeConvertValue({
|
|
7148
|
-
value:
|
|
6650
|
+
value: l,
|
|
7149
6651
|
toUnit: U,
|
|
7150
6652
|
unitkey: u,
|
|
7151
6653
|
defaultFromUnit: B,
|
|
7152
6654
|
doNotConvertValue: p
|
|
7153
6655
|
});
|
|
7154
6656
|
e = n, t = U;
|
|
7155
|
-
} else if (withUnit(K.value, K.unit) !==
|
|
6657
|
+
} else if (withUnit(K.value, K.unit) !== l) {
|
|
7156
6658
|
let { value: n } = safeConvertValue({
|
|
7157
|
-
value:
|
|
6659
|
+
value: l,
|
|
7158
6660
|
toUnit: K.unit,
|
|
7159
6661
|
unitkey: u,
|
|
7160
6662
|
defaultFromUnit: B,
|
|
@@ -7165,15 +6667,15 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7165
6667
|
e !== void 0 && q({
|
|
7166
6668
|
value: e,
|
|
7167
6669
|
unit: t
|
|
7168
|
-
}), C &&
|
|
6670
|
+
}), C && Ad(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
7169
6671
|
}
|
|
7170
6672
|
}, [
|
|
7171
6673
|
U,
|
|
7172
|
-
|
|
6674
|
+
l,
|
|
7173
6675
|
i,
|
|
7174
6676
|
T
|
|
7175
6677
|
]);
|
|
7176
|
-
let
|
|
6678
|
+
let X = Md(), Z = label(K.unit) || K.unit || "", Fd = p || !X || X && X.length === 1, Q = getStringName(e), $, Id = (t) => {
|
|
7177
6679
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
7178
6680
|
if (checkConversion({
|
|
7179
6681
|
value: r,
|
|
@@ -7193,7 +6695,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7193
6695
|
type: MenuType.OPTION,
|
|
7194
6696
|
inline: !0,
|
|
7195
6697
|
onClick: () => {
|
|
7196
|
-
validateNumber(i).valid && !n && (
|
|
6698
|
+
validateNumber(i).valid && !n && (Ad(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
7197
6699
|
value: r,
|
|
7198
6700
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
7199
6701
|
predefinedSelected: !0,
|
|
@@ -7205,25 +6707,25 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7205
6707
|
height: "0"
|
|
7206
6708
|
})] }),
|
|
7207
6709
|
description: o,
|
|
7208
|
-
selected:
|
|
6710
|
+
selected: Y === t && J === PredefinedOptionsMenuState.PREDEFINED
|
|
7209
6711
|
};
|
|
7210
6712
|
};
|
|
7211
6713
|
if ($ = [{
|
|
7212
6714
|
type: MenuType.OPTION,
|
|
7213
6715
|
inline: !0,
|
|
7214
6716
|
onClick: () => {
|
|
7215
|
-
|
|
6717
|
+
J !== PredefinedOptionsMenuState.CUSTOM && !n && h({ target: {
|
|
7216
6718
|
value: withUnit(K.value, K.unit),
|
|
7217
6719
|
name: typeof e == "string" ? e : e?.fieldName || ""
|
|
7218
6720
|
} });
|
|
7219
6721
|
},
|
|
7220
6722
|
label: "Custom",
|
|
7221
|
-
selected:
|
|
6723
|
+
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
7222
6724
|
}], C?.length) {
|
|
7223
|
-
let e = C.map(
|
|
6725
|
+
let e = C.map(Id);
|
|
7224
6726
|
$ = [...$, ...e];
|
|
7225
6727
|
}
|
|
7226
|
-
let
|
|
6728
|
+
let Ld = (e) => {
|
|
7227
6729
|
if (isValueWithUnit(e)) {
|
|
7228
6730
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
7229
6731
|
value: e,
|
|
@@ -7235,9 +6737,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7235
6737
|
return n;
|
|
7236
6738
|
}
|
|
7237
6739
|
return e;
|
|
7238
|
-
},
|
|
6740
|
+
}, Rd = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, zd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
7239
6741
|
return /* @__PURE__ */ jsx("div", {
|
|
7240
|
-
className:
|
|
6742
|
+
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
7241
6743
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
7242
6744
|
small: o,
|
|
7243
6745
|
width: s,
|
|
@@ -7252,65 +6754,65 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7252
6754
|
trigger: "Component",
|
|
7253
6755
|
component: /* @__PURE__ */ jsx(Button, {
|
|
7254
6756
|
groupOrder: "first",
|
|
7255
|
-
active:
|
|
7256
|
-
icon:
|
|
6757
|
+
active: J === PredefinedOptionsMenuState.PREDEFINED,
|
|
6758
|
+
icon: J === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
|
|
7257
6759
|
small: o
|
|
7258
6760
|
}),
|
|
7259
6761
|
small: o,
|
|
7260
6762
|
sections: $
|
|
7261
6763
|
},
|
|
7262
|
-
tooltip:
|
|
6764
|
+
tooltip: J === PredefinedOptionsMenuState.PREDEFINED ? Y?.label : ""
|
|
7263
6765
|
}),
|
|
7264
6766
|
/* @__PURE__ */ jsx("div", {
|
|
7265
6767
|
className: unit_input_module_default.inputWrapper,
|
|
7266
6768
|
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
7267
|
-
name:
|
|
6769
|
+
name: Q,
|
|
7268
6770
|
testId: x,
|
|
7269
6771
|
disabled: n,
|
|
7270
|
-
placeholder:
|
|
6772
|
+
placeholder: Ld(t),
|
|
7271
6773
|
value: K.value,
|
|
7272
|
-
onChange:
|
|
6774
|
+
onChange: Nd,
|
|
7273
6775
|
onFocus: v,
|
|
7274
6776
|
error: i === null ? void 0 : i,
|
|
7275
6777
|
warning: S === null ? void 0 : S,
|
|
7276
6778
|
left: a,
|
|
7277
|
-
allowEmpty:
|
|
7278
|
-
validationCallback: (e, t) => D(
|
|
6779
|
+
allowEmpty: kd,
|
|
6780
|
+
validationCallback: (e, t) => D(Q, t),
|
|
7279
6781
|
enableCosmeticRounding: j,
|
|
7280
6782
|
enableDisplayRounding: M,
|
|
7281
6783
|
roundDisplayValue: N,
|
|
7282
|
-
groupOrder:
|
|
7283
|
-
disableInternalErrorValidationMessages:
|
|
6784
|
+
groupOrder: Rd,
|
|
6785
|
+
disableInternalErrorValidationMessages: jd,
|
|
7284
6786
|
small: o,
|
|
7285
6787
|
selectOnFocus: P,
|
|
7286
6788
|
tooltip: I
|
|
7287
|
-
},
|
|
6789
|
+
}, Q)
|
|
7288
6790
|
}),
|
|
7289
|
-
|
|
7290
|
-
groupOrder:
|
|
6791
|
+
Z && (Fd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6792
|
+
groupOrder: zd,
|
|
7291
6793
|
small: o,
|
|
7292
|
-
children:
|
|
6794
|
+
children: Z
|
|
7293
6795
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
7294
|
-
groupOrder:
|
|
6796
|
+
groupOrder: zd,
|
|
7295
6797
|
maxHeight: 380,
|
|
7296
6798
|
disabled: r,
|
|
7297
6799
|
testId: x && `${x}-menu`,
|
|
7298
6800
|
tabIndex: -1,
|
|
7299
6801
|
menu: {
|
|
7300
|
-
label:
|
|
6802
|
+
label: Z,
|
|
7301
6803
|
trigger: "DropDownButton",
|
|
7302
6804
|
small: o,
|
|
7303
|
-
sections:
|
|
6805
|
+
sections: X.map(([e = "", t = "", n]) => {
|
|
7304
6806
|
let r = n || t || "", i = isValidNum(e) ? e : "";
|
|
7305
6807
|
return {
|
|
7306
6808
|
type: "Option",
|
|
7307
6809
|
label: j ? safeRoundNumbers(i) : i,
|
|
7308
6810
|
inline: !0,
|
|
7309
6811
|
onClick: (n) => {
|
|
7310
|
-
n.stopPropagation(),
|
|
6812
|
+
n.stopPropagation(), Pd(e, t);
|
|
7311
6813
|
},
|
|
7312
6814
|
description: r,
|
|
7313
|
-
selected: r ===
|
|
6815
|
+
selected: r === Z,
|
|
7314
6816
|
testId: `${x}-unit-${r}`
|
|
7315
6817
|
};
|
|
7316
6818
|
})
|
|
@@ -7443,61 +6945,60 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
|
|
|
7443
6945
|
})
|
|
7444
6946
|
})) : [];
|
|
7445
6947
|
};
|
|
7446
|
-
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder:
|
|
7447
|
-
let { headers: d
|
|
7448
|
-
|
|
7449
|
-
...
|
|
6948
|
+
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder: s, beforeRenderRow: l }) => {
|
|
6949
|
+
let { headers: u,...d } = e, { storageUnits: f, preferredUnits: p } = normalizeUnits(t), h = usePrevious(p), [g, _] = useState(p), v = ({ unitKey: e, value: n }) => {
|
|
6950
|
+
_({
|
|
6951
|
+
...g,
|
|
7450
6952
|
[e]: n
|
|
7451
6953
|
});
|
|
7452
6954
|
let r = t.find((t) => t.unitKey === e);
|
|
7453
6955
|
r && typeof r.onChange == "function" && r.onChange({
|
|
7454
|
-
oldUnit:
|
|
6956
|
+
oldUnit: g[e],
|
|
7455
6957
|
newUnit: n,
|
|
7456
6958
|
unitKey: e
|
|
7457
6959
|
});
|
|
7458
|
-
},
|
|
7459
|
-
let a =
|
|
6960
|
+
}, y = useCallback(({ row: e, rowIndex: t }) => {
|
|
6961
|
+
let a = l ? l({
|
|
7460
6962
|
row: e,
|
|
7461
6963
|
rowIndex: t
|
|
7462
6964
|
}) : e;
|
|
7463
6965
|
return convertRow({
|
|
7464
6966
|
row: a,
|
|
7465
6967
|
rowIndex: t,
|
|
7466
|
-
selectedUnits:
|
|
7467
|
-
storageUnits:
|
|
6968
|
+
selectedUnits: g,
|
|
6969
|
+
storageUnits: f,
|
|
7468
6970
|
convertBackToStorageUnit: n,
|
|
7469
6971
|
enableCosmeticRounding: r,
|
|
7470
6972
|
enableDisplayRounding: i
|
|
7471
6973
|
});
|
|
7472
6974
|
}, [
|
|
7473
|
-
|
|
7474
|
-
|
|
6975
|
+
g,
|
|
6976
|
+
f,
|
|
7475
6977
|
n,
|
|
7476
6978
|
r,
|
|
7477
6979
|
i
|
|
7478
6980
|
]);
|
|
7479
6981
|
return useEffect(() => {
|
|
7480
|
-
isEqual(
|
|
7481
|
-
let t =
|
|
7482
|
-
t !== n &&
|
|
6982
|
+
isEqual(p, h) || Object.keys(p).forEach((e) => {
|
|
6983
|
+
let t = h?.[e], n = p[e];
|
|
6984
|
+
t !== n && v({
|
|
7483
6985
|
unitKey: e,
|
|
7484
6986
|
value: n
|
|
7485
6987
|
});
|
|
7486
6988
|
});
|
|
7487
6989
|
}, [t]), /* @__PURE__ */ jsx(Table, {
|
|
7488
6990
|
table: {
|
|
7489
|
-
...
|
|
6991
|
+
...d,
|
|
7490
6992
|
headers: convertHeaderRows({
|
|
7491
6993
|
headers: e.headers,
|
|
7492
|
-
selectedUnits:
|
|
7493
|
-
storageUnits:
|
|
7494
|
-
onChangeUnit:
|
|
6994
|
+
selectedUnits: g,
|
|
6995
|
+
storageUnits: f,
|
|
6996
|
+
onChangeUnit: v
|
|
7495
6997
|
})
|
|
7496
6998
|
},
|
|
7497
6999
|
onListReorder: a,
|
|
7498
|
-
canListReorder:
|
|
7499
|
-
beforeRenderRow:
|
|
7500
|
-
enableMultiSelect: u
|
|
7000
|
+
canListReorder: s,
|
|
7001
|
+
beforeRenderRow: y
|
|
7501
7002
|
});
|
|
7502
7003
|
};
|
|
7503
7004
|
var setting_field_module_default = { settingField: "_settingField_1x02n_1" };
|
|
@@ -7570,7 +7071,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7570
7071
|
}, [n]);
|
|
7571
7072
|
let s = ({ target: { value: e } }) => {
|
|
7572
7073
|
a(e);
|
|
7573
|
-
}, { added:
|
|
7074
|
+
}, { added: l, removed: u } = renderLinesCount(e, t), d = l + u > 3500;
|
|
7574
7075
|
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Card, {
|
|
7575
7076
|
bordered: !0,
|
|
7576
7077
|
heading: /* @__PURE__ */ jsxs(Flex, {
|
|
@@ -7579,7 +7080,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7579
7080
|
success: !0,
|
|
7580
7081
|
children: [
|
|
7581
7082
|
"+",
|
|
7582
|
-
|
|
7083
|
+
l,
|
|
7583
7084
|
" "
|
|
7584
7085
|
]
|
|
7585
7086
|
}), /* @__PURE__ */ jsxs(Text, {
|
|
@@ -8988,25 +8489,27 @@ const createDiffJson = (e, t, n) => {
|
|
|
8988
8489
|
oldJson: a,
|
|
8989
8490
|
newJson: o
|
|
8990
8491
|
};
|
|
8991
|
-
}, ChangesOverview = ({ sectionNames: e,
|
|
8992
|
-
let
|
|
8492
|
+
}, ChangesOverview = ({ sectionNames: e, userName: t, diffs: n }) => {
|
|
8493
|
+
let r = {
|
|
8993
8494
|
headers: [{ cells: [
|
|
8495
|
+
{ value: "Modified By" },
|
|
8994
8496
|
{ value: "Type" },
|
|
8995
8497
|
{ value: "Before" },
|
|
8996
8498
|
{ value: "After" },
|
|
8997
8499
|
{ value: "" }
|
|
8998
8500
|
] }],
|
|
8999
|
-
rows:
|
|
9000
|
-
let { deltaFormat:
|
|
8501
|
+
rows: n.map((n) => {
|
|
8502
|
+
let { deltaFormat: r, path: i } = n, a = getSectionName(e, i), { type: o, before: s, after: c } = defaultMessage(r);
|
|
9001
8503
|
return { cells: [
|
|
9002
|
-
{ value:
|
|
8504
|
+
{ value: t },
|
|
9003
8505
|
{ value: o },
|
|
9004
8506
|
{ value: s },
|
|
9005
|
-
{ value:
|
|
8507
|
+
{ value: c },
|
|
8508
|
+
{ value: a }
|
|
9006
8509
|
] };
|
|
9007
8510
|
})
|
|
9008
8511
|
};
|
|
9009
|
-
return /* @__PURE__ */ jsx(Table, { table:
|
|
8512
|
+
return /* @__PURE__ */ jsx(Table, { table: r });
|
|
9010
8513
|
}, viewTypes = Object.freeze({
|
|
9011
8514
|
summary: {
|
|
9012
8515
|
label: "Summary",
|
|
@@ -9047,6 +8550,7 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
|
|
|
9047
8550
|
options: s,
|
|
9048
8551
|
value: c
|
|
9049
8552
|
}), c.value === "summary" ? /* @__PURE__ */ jsx(ChangesOverview, {
|
|
8553
|
+
userName: e.userName,
|
|
9050
8554
|
sectionNames: i,
|
|
9051
8555
|
diffs: transformDiffs(o)
|
|
9052
8556
|
}) : /* @__PURE__ */ jsx(DiffViewer, {
|
|
@@ -9063,7 +8567,7 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
|
|
|
9063
8567
|
} })
|
|
9064
8568
|
});
|
|
9065
8569
|
}, AuditLog = ({ logs: e, data: t, total: n, loading: r, selectedPage: i, rowsPerPage: a, sectionNames: o, filterToggles: s = [], onChangeRowsPerPage: c, onSelectPage: l }) => {
|
|
9066
|
-
let [u, d] = useState(!1), [f, p] = useState(null),
|
|
8570
|
+
let [u, d] = useState(!1), [f, p] = useState(null), h = [
|
|
9067
8571
|
{
|
|
9068
8572
|
label: "10 / page",
|
|
9069
8573
|
value: 10
|
|
@@ -9157,7 +8661,7 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
|
|
|
9157
8661
|
let { value: t } = e.target;
|
|
9158
8662
|
c(Number(t));
|
|
9159
8663
|
},
|
|
9160
|
-
options:
|
|
8664
|
+
options: h,
|
|
9161
8665
|
value: a
|
|
9162
8666
|
},
|
|
9163
8667
|
onSelectPage: (e) => l(e),
|