@oliasoft-open-source/react-ui-library 5.8.0-beta-1 → 5.8.0-beta-3
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 +948 -1462
- 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", {
|
|
@@ -2027,20 +2026,20 @@ const Message = ({ message: e }) => {
|
|
|
2027
2026
|
}) : null });
|
|
2028
2027
|
};
|
|
2029
2028
|
var table_module_default = {
|
|
2030
|
-
inputInTable: "
|
|
2031
|
-
inputHover: "
|
|
2032
|
-
inputFocus: "
|
|
2033
|
-
inputError: "
|
|
2034
|
-
inputWarning: "
|
|
2035
|
-
inputDisabled: "
|
|
2036
|
-
hideScrollbars: "
|
|
2037
|
-
wrapper: "
|
|
2038
|
-
bordered: "
|
|
2039
|
-
scroll: "
|
|
2040
|
-
table: "
|
|
2041
|
-
dragOverlay: "
|
|
2042
|
-
virtualScroll: "
|
|
2043
|
-
striped: "
|
|
2029
|
+
inputInTable: "_inputInTable_kaesl_1",
|
|
2030
|
+
inputHover: "_inputHover_kaesl_13",
|
|
2031
|
+
inputFocus: "_inputFocus_kaesl_18",
|
|
2032
|
+
inputError: "_inputError_kaesl_25",
|
|
2033
|
+
inputWarning: "_inputWarning_kaesl_26",
|
|
2034
|
+
inputDisabled: "_inputDisabled_kaesl_61",
|
|
2035
|
+
hideScrollbars: "_hideScrollbars_kaesl_67",
|
|
2036
|
+
wrapper: "_wrapper_kaesl_85",
|
|
2037
|
+
bordered: "_bordered_kaesl_93",
|
|
2038
|
+
scroll: "_scroll_kaesl_98",
|
|
2039
|
+
table: "_table_kaesl_109",
|
|
2040
|
+
dragOverlay: "_dragOverlay_kaesl_145",
|
|
2041
|
+
virtualScroll: "_virtualScroll_kaesl_182",
|
|
2042
|
+
striped: "_striped_kaesl_202"
|
|
2044
2043
|
}, title_module_default = { title: "_title_zn5s7_1" };
|
|
2045
2044
|
const Title$1 = ({ name: e = null, actions: t = null, actionsRight: n = !1, testId: r }) => {
|
|
2046
2045
|
let i = e !== null, a = t !== null;
|
|
@@ -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,119 +3477,122 @@ 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
|
-
}, Row$1 = ({ row: e, rowIndex: t, isHeader: n = !1, columnCount: r, colSpan: i, columnHeaderAlignments: a = [], columnAlignment: o = [], hasRowActions: s, draggableTable:
|
|
4283
|
-
let
|
|
3505
|
+
}, Row$1 = ({ row: e, rowIndex: t, isHeader: n = !1, columnCount: r, colSpan: i, columnHeaderAlignments: a = [], columnAlignment: o = [], hasRowActions: s, draggableTable: l = !1, columnWidths: u, dropDisabled: d = !1, height: f, triggerScrollToActiveRow: p, testId: m }) => {
|
|
3506
|
+
let h = getHeaderAlignment(a, n, t), { onRowClick: _, onRowFocus: v, onRowMouseEnter: y, onRowMouseLeave: b, expandedContent: x, error: S, warning: C, active: w } = e;
|
|
3507
|
+
useEffect(() => {
|
|
3508
|
+
if (w && p) {
|
|
3509
|
+
let e = document.querySelector("tr[data-active=\"true\"]");
|
|
3510
|
+
e && e.scrollIntoView({
|
|
3511
|
+
behavior: "smooth",
|
|
3512
|
+
block: "center"
|
|
3513
|
+
});
|
|
3514
|
+
}
|
|
3515
|
+
}, [w, p]);
|
|
3516
|
+
let T = e.cells.map((e, r) => {
|
|
4284
3517
|
let i = `${n ? 0 : 1}_${t}_${r}`;
|
|
4285
3518
|
return /* @__PURE__ */ jsx(Cell, {
|
|
4286
3519
|
cell: e,
|
|
4287
3520
|
isHeader: n,
|
|
4288
3521
|
columnAlignment: o[r],
|
|
4289
|
-
columnHeaderAlignment:
|
|
4290
|
-
width:
|
|
4291
|
-
testId: e.testId
|
|
4292
|
-
rowIndex: t,
|
|
4293
|
-
columnIndex: r
|
|
3522
|
+
columnHeaderAlignment: h[r],
|
|
3523
|
+
width: u ? u[r] : void 0,
|
|
3524
|
+
testId: e.testId
|
|
4294
3525
|
}, i);
|
|
4295
|
-
}),
|
|
3526
|
+
}), E = s && /* @__PURE__ */ jsx(Cell, {
|
|
4296
3527
|
cell: {
|
|
4297
3528
|
type: CellType.ACTIONS,
|
|
4298
3529
|
actions: e.actions
|
|
4299
3530
|
},
|
|
4300
|
-
isHeader: n
|
|
4301
|
-
|
|
4302
|
-
columnIndex: r
|
|
4303
|
-
}, r), { attributes: T, listeners: E, setNodeRef: D, transform: O, transition: k, isDragging: A } = useSortable({
|
|
3531
|
+
isHeader: n
|
|
3532
|
+
}, r), { attributes: D, listeners: O, setNodeRef: k, transform: A, transition: j, isDragging: M } = useSortable({
|
|
4304
3533
|
id: t.toString(),
|
|
4305
3534
|
animateLayoutChanges: () => !1
|
|
4306
|
-
}),
|
|
4307
|
-
transform:
|
|
4308
|
-
height:
|
|
4309
|
-
transition:
|
|
4310
|
-
opacity:
|
|
4311
|
-
},
|
|
3535
|
+
}), N = {
|
|
3536
|
+
transform: d ? void 0 : CSS.Translate.toString(A),
|
|
3537
|
+
height: f,
|
|
3538
|
+
transition: j,
|
|
3539
|
+
opacity: M ? 0 : void 0
|
|
3540
|
+
}, P = () => e.noDrag ? /* @__PURE__ */ jsx("td", { "aria-labelledby": "unique-label-id" }) : /* @__PURE__ */ jsx("td", {
|
|
4312
3541
|
className: row_module_default$1.dragIconCell,
|
|
4313
3542
|
children: /* @__PURE__ */ jsx("div", {
|
|
4314
|
-
className: cx(row_module_default$1.dragIcon,
|
|
4315
|
-
...
|
|
4316
|
-
...
|
|
3543
|
+
className: cx(row_module_default$1.dragIcon, d ? row_module_default$1.dragIconDisabled : ""),
|
|
3544
|
+
...D,
|
|
3545
|
+
...O,
|
|
4317
3546
|
children: /* @__PURE__ */ jsx(Icon, { icon: IconType.DRAG })
|
|
4318
3547
|
})
|
|
4319
3548
|
});
|
|
4320
3549
|
return n ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
4321
|
-
onClick:
|
|
4322
|
-
onMouseEnter:
|
|
4323
|
-
onMouseLeave:
|
|
4324
|
-
onFocus:
|
|
4325
|
-
className: cx(
|
|
3550
|
+
onClick: _,
|
|
3551
|
+
onMouseEnter: y,
|
|
3552
|
+
onMouseLeave: b,
|
|
3553
|
+
onFocus: v,
|
|
3554
|
+
className: cx(_ ? row_module_default$1.clickableRow : null, y ? row_module_default$1.hoverableRow : null),
|
|
4326
3555
|
children: [
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
3556
|
+
l ? /* @__PURE__ */ jsx("th", {}) : null,
|
|
3557
|
+
T,
|
|
3558
|
+
E
|
|
4330
3559
|
]
|
|
4331
|
-
}, t),
|
|
3560
|
+
}, t), x && x.content ? /* @__PURE__ */ jsx(ExpandedContentRow, {
|
|
4332
3561
|
colSpan: i,
|
|
4333
|
-
flush:
|
|
4334
|
-
children:
|
|
3562
|
+
flush: x.flush === !0,
|
|
3563
|
+
children: x.content
|
|
4335
3564
|
}, `${t}_expanded_content`) : null] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("tr", {
|
|
4336
|
-
ref: e.noDrag ? null :
|
|
4337
|
-
onClick:
|
|
4338
|
-
onMouseEnter:
|
|
4339
|
-
onMouseLeave:
|
|
4340
|
-
onFocus:
|
|
4341
|
-
className: cx(
|
|
4342
|
-
"data-
|
|
4343
|
-
"data-
|
|
3565
|
+
ref: e.noDrag ? null : k,
|
|
3566
|
+
onClick: _,
|
|
3567
|
+
onMouseEnter: y,
|
|
3568
|
+
onMouseLeave: b,
|
|
3569
|
+
onFocus: v,
|
|
3570
|
+
className: cx(_ && !_.noStyle ? row_module_default$1.clickableRow : null, y && !y.noStyle ? row_module_default$1.hoverableRow : null, w ? row_module_default$1.rowActive : null),
|
|
3571
|
+
"data-active": w || null,
|
|
3572
|
+
"data-error": S || null,
|
|
3573
|
+
"data-warning": C || null,
|
|
4344
3574
|
"data-index": t,
|
|
4345
3575
|
"data-even": t % 2 == 0,
|
|
4346
|
-
style:
|
|
3576
|
+
style: N,
|
|
4347
3577
|
children: [
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
3578
|
+
l ? P() : null,
|
|
3579
|
+
T,
|
|
3580
|
+
E
|
|
4351
3581
|
]
|
|
4352
|
-
}, t),
|
|
3582
|
+
}, t), x && x.content ? /* @__PURE__ */ jsx(ExpandedContentRow, {
|
|
4353
3583
|
colSpan: i,
|
|
4354
|
-
flush:
|
|
4355
|
-
children:
|
|
3584
|
+
flush: x.flush === !0,
|
|
3585
|
+
children: x.content
|
|
4356
3586
|
}, `${t}_expanded_content`) : null] });
|
|
4357
3587
|
}, 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, [
|
|
3588
|
+
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
3589
|
return a ? /* @__PURE__ */ jsxs(DndContext, {
|
|
4360
3590
|
collisionDetection: closestCenter,
|
|
4361
3591
|
onDragStart: (e) => {
|
|
4362
3592
|
p(e.active.id);
|
|
4363
3593
|
},
|
|
4364
3594
|
onDragEnd: (e) => {
|
|
4365
|
-
p(null),
|
|
3595
|
+
p(null), _(!1);
|
|
4366
3596
|
let { active: t, over: n } = e;
|
|
4367
3597
|
if (!t || !n || t.id === n.id) return;
|
|
4368
3598
|
let r = Number(t.id), i = Number(n?.id);
|
|
@@ -4379,23 +3609,23 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4379
3609
|
from: r,
|
|
4380
3610
|
to: i
|
|
4381
3611
|
});
|
|
4382
|
-
|
|
3612
|
+
_(a);
|
|
4383
3613
|
},
|
|
4384
3614
|
children: [/* @__PURE__ */ jsx(SortableContext, {
|
|
4385
3615
|
items: v,
|
|
4386
3616
|
strategy: verticalListSortingStrategy,
|
|
4387
|
-
children: t({ dropDisabled:
|
|
4388
|
-
}), !!
|
|
3617
|
+
children: t({ dropDisabled: h })
|
|
3618
|
+
}), !!f && createPortal(/* @__PURE__ */ jsx(DragOverlay, {
|
|
4389
3619
|
dropAnimation: null,
|
|
4390
3620
|
children: /* @__PURE__ */ jsx("table", {
|
|
4391
3621
|
className: cx(table_module_default.table, table_module_default.dragOverlay),
|
|
4392
3622
|
children: /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx(Row$1, {
|
|
4393
|
-
rowIndex: Number(
|
|
4394
|
-
row: l[Number(
|
|
3623
|
+
rowIndex: Number(f),
|
|
3624
|
+
row: l[Number(f)],
|
|
4395
3625
|
columnCount: i,
|
|
4396
3626
|
columnWidths: (() => {
|
|
4397
3627
|
if (!u?.current) return [];
|
|
4398
|
-
let e = u.current.querySelectorAll("tr")[Number(
|
|
3628
|
+
let e = u.current.querySelectorAll("tr")[Number(f)]?.querySelectorAll("td");
|
|
4399
3629
|
if (!e) return [];
|
|
4400
3630
|
let t = Array.from(e).map((e) => `${e.getBoundingClientRect().width}px`);
|
|
4401
3631
|
return t.shift(), t;
|
|
@@ -4404,7 +3634,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4404
3634
|
hasRowActions: c,
|
|
4405
3635
|
columnAlignment: r,
|
|
4406
3636
|
draggableTable: a,
|
|
4407
|
-
dropDisabled:
|
|
3637
|
+
dropDisabled: h
|
|
4408
3638
|
}) })
|
|
4409
3639
|
})
|
|
4410
3640
|
}), document.body)]
|
|
@@ -4446,155 +3676,137 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4446
3676
|
className: table_module_default.scroll,
|
|
4447
3677
|
children: n({})
|
|
4448
3678
|
});
|
|
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" ? {
|
|
3679
|
+
}, Table = (e) => {
|
|
3680
|
+
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, triggerScrollToActiveRow: C = !1 } = i, w = useRef(null), T = useRef(null), E = get(e, "table.headers", []), D = getColumnCount(c, E), O = hasRowActions(c, E), k = D + (O ? 1 : 0), A = o ? o?.pagination?.rowsPerPage?.value === 0 || Number(o?.pagination?.selectedPage) >= Number(o?.pagination?.rowCount) / Number(o?.pagination?.rowsPerPage?.value) : !0, j = v?.cells?.length && y && A, M = {
|
|
3681
|
+
cells: j ? v.cells.map((e, t) => e?.type === "Input" ? {
|
|
4454
3682
|
...e,
|
|
4455
3683
|
onChange: (e) => {
|
|
4456
3684
|
let n = e?.target?.value, r = {
|
|
4457
|
-
...
|
|
4458
|
-
cells:
|
|
3685
|
+
...v,
|
|
3686
|
+
cells: v.cells.map((e, r) => ({
|
|
4459
3687
|
...e,
|
|
4460
3688
|
value: r === t ? n : e?.value
|
|
4461
3689
|
}))
|
|
4462
3690
|
};
|
|
4463
|
-
|
|
3691
|
+
y({ newRow: r });
|
|
4464
3692
|
}
|
|
4465
3693
|
} : {
|
|
4466
3694
|
...e,
|
|
4467
3695
|
disabled: !0
|
|
4468
3696
|
}) : null,
|
|
4469
|
-
testId:
|
|
4470
|
-
},
|
|
3697
|
+
testId: h ? `${h}-last-empty-row` : void 0
|
|
3698
|
+
}, N = j ? c.concat(M) : c, P = {
|
|
4471
3699
|
...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
|
-
|
|
4555
|
-
|
|
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
|
-
})]
|
|
3700
|
+
rows: N
|
|
3701
|
+
}, F = cx(table_module_default.wrapper, b ? table_module_default.bordered : "");
|
|
3702
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3703
|
+
className: F,
|
|
3704
|
+
style: {
|
|
3705
|
+
maxHeight: x,
|
|
3706
|
+
width: S,
|
|
3707
|
+
display: S === "auto" ? "inline-flex" : "flex"
|
|
3708
|
+
},
|
|
3709
|
+
children: [
|
|
3710
|
+
/* @__PURE__ */ jsx(Title$1, {
|
|
3711
|
+
actions: l,
|
|
3712
|
+
actionsRight: u,
|
|
3713
|
+
name: s,
|
|
3714
|
+
testId: h && `${h}-title`
|
|
3715
|
+
}),
|
|
3716
|
+
/* @__PURE__ */ jsx(TableDragWrapper, {
|
|
3717
|
+
colSpan: k,
|
|
3718
|
+
columnAlignment: f,
|
|
3719
|
+
columnCount: D,
|
|
3720
|
+
draggable: _,
|
|
3721
|
+
onListReorder: t,
|
|
3722
|
+
rowActions: O,
|
|
3723
|
+
rows: N,
|
|
3724
|
+
tbodyRef: T,
|
|
3725
|
+
canListReorder: n,
|
|
3726
|
+
children: ({ dropDisabled: e }) => /* @__PURE__ */ jsx(TableScrollWrapper, {
|
|
3727
|
+
table: P,
|
|
3728
|
+
theadRef: w,
|
|
3729
|
+
children: ({ virtualizer: t, tableStyle: n }) => /* @__PURE__ */ jsxs("table", {
|
|
3730
|
+
className: cx(table_module_default.table, m ? table_module_default.striped : ""),
|
|
3731
|
+
"data-testid": h,
|
|
3732
|
+
style: n,
|
|
3733
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
3734
|
+
ref: w,
|
|
3735
|
+
children: E.map((e, t) => /* @__PURE__ */ jsx(Row$1, {
|
|
3736
|
+
rowIndex: t,
|
|
3737
|
+
isHeader: !0,
|
|
3738
|
+
row: e,
|
|
3739
|
+
columnCount: D,
|
|
3740
|
+
columnWidths: a,
|
|
3741
|
+
colSpan: k,
|
|
3742
|
+
hasRowActions: O,
|
|
3743
|
+
columnAlignment: f,
|
|
3744
|
+
columnHeaderAlignments: d,
|
|
3745
|
+
draggableTable: _
|
|
3746
|
+
}, `0_${t}`))
|
|
3747
|
+
}), /* @__PURE__ */ jsx("tbody", {
|
|
3748
|
+
ref: T,
|
|
3749
|
+
children: t ? t.getVirtualItems().map((t) => {
|
|
3750
|
+
let n = t.index, i = N[n], o = r ? r({
|
|
3751
|
+
row: i,
|
|
3752
|
+
rowIndex: n
|
|
3753
|
+
}) : i;
|
|
3754
|
+
return /* @__PURE__ */ jsx(Row$1, {
|
|
3755
|
+
rowIndex: n,
|
|
3756
|
+
row: o,
|
|
3757
|
+
columnCount: D,
|
|
3758
|
+
columnWidths: a,
|
|
3759
|
+
colSpan: k,
|
|
3760
|
+
hasRowActions: O,
|
|
3761
|
+
columnAlignment: f,
|
|
3762
|
+
draggableTable: _,
|
|
3763
|
+
height: t.size,
|
|
3764
|
+
dropDisabled: e,
|
|
3765
|
+
triggerScrollToActiveRow: C
|
|
3766
|
+
}, `1_${n}`);
|
|
3767
|
+
}) : N.map((t, n) => {
|
|
3768
|
+
let i = r ? r({
|
|
3769
|
+
row: t,
|
|
3770
|
+
rowIndex: n
|
|
3771
|
+
}) : t;
|
|
3772
|
+
return /* @__PURE__ */ jsx(Row$1, {
|
|
3773
|
+
rowIndex: n,
|
|
3774
|
+
row: i,
|
|
3775
|
+
columnCount: D,
|
|
3776
|
+
columnWidths: a,
|
|
3777
|
+
colSpan: k,
|
|
3778
|
+
hasRowActions: O,
|
|
3779
|
+
columnAlignment: f,
|
|
3780
|
+
draggableTable: _,
|
|
3781
|
+
dropDisabled: e,
|
|
3782
|
+
triggerScrollToActiveRow: C
|
|
3783
|
+
}, `1_${n}`);
|
|
4572
3784
|
})
|
|
4573
|
-
})
|
|
3785
|
+
})]
|
|
4574
3786
|
})
|
|
4575
|
-
}),
|
|
4576
|
-
s && /* @__PURE__ */ jsx(Footer, {
|
|
4577
|
-
pagination: s.pagination,
|
|
4578
|
-
actions: s.actions,
|
|
4579
|
-
content: s.content
|
|
4580
3787
|
})
|
|
4581
|
-
|
|
4582
|
-
|
|
3788
|
+
}),
|
|
3789
|
+
o && /* @__PURE__ */ jsx(Footer, {
|
|
3790
|
+
pagination: o.pagination,
|
|
3791
|
+
actions: o.actions,
|
|
3792
|
+
content: o.content
|
|
3793
|
+
})
|
|
3794
|
+
]
|
|
4583
3795
|
});
|
|
4584
|
-
}
|
|
3796
|
+
}, placeholder$1 = "blank", getUpdatedErrors = (e, t, n, r) => {
|
|
4585
3797
|
let i = `${t} → ${n}:`, a = e.filter((e) => !e.startsWith(i)), o = r ? [...a, `${i} ${r}`] : a, s = o.length === 0;
|
|
4586
3798
|
return {
|
|
4587
3799
|
updatedErrors: o,
|
|
4588
3800
|
isValid: s
|
|
4589
3801
|
};
|
|
4590
3802
|
}, Table$1 = ({ validationRules: e, parsedResult: t, updateState: n, testId: r }) => {
|
|
4591
|
-
let i = useMemo(() => t.fields.map((e) => ({ value: e })), [t.fields]), [a,
|
|
3803
|
+
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
3804
|
cells: r.map((r, o) => {
|
|
4593
|
-
let { columnMessage: s = {}, validator: c = () => null } = e?.[o] ?? {}, l = i?.[o]?.value, u = `${`Row ${a + 1}`} → ${l}:`,
|
|
3805
|
+
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
3806
|
return {
|
|
4595
3807
|
name: l,
|
|
4596
3808
|
value: r,
|
|
4597
|
-
type:
|
|
3809
|
+
type: f.current[o] ?? "Input",
|
|
4598
3810
|
disableValidationOnFocus: !0,
|
|
4599
3811
|
error: m,
|
|
4600
3812
|
validationCallback: (e, r) => {
|
|
@@ -4679,12 +3891,12 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4679
3891
|
i,
|
|
4680
3892
|
x,
|
|
4681
3893
|
b
|
|
4682
|
-
]), C = useMemo(() => _.slice(
|
|
3894
|
+
]), C = useMemo(() => _.slice(h, g), [
|
|
4683
3895
|
_,
|
|
4684
|
-
|
|
3896
|
+
h,
|
|
4685
3897
|
g
|
|
4686
3898
|
]), w = useCallback(({ rowIndex: e }) => {
|
|
4687
|
-
let n =
|
|
3899
|
+
let n = h + e, r = t.rows[n];
|
|
4688
3900
|
return r ? y(r, n) : {
|
|
4689
3901
|
cells: [],
|
|
4690
3902
|
actions: []
|
|
@@ -4692,7 +3904,7 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4692
3904
|
}, [
|
|
4693
3905
|
t.rows,
|
|
4694
3906
|
y,
|
|
4695
|
-
|
|
3907
|
+
h
|
|
4696
3908
|
]);
|
|
4697
3909
|
return /* @__PURE__ */ jsx(Table, {
|
|
4698
3910
|
beforeRenderRow: w,
|
|
@@ -4718,10 +3930,10 @@ const Cell = ({ cell: e, isHeader: t, columnHeaderAlignment: n, columnAlignment:
|
|
|
4718
3930
|
infiniteScroll: !0,
|
|
4719
3931
|
footer: { pagination: {
|
|
4720
3932
|
rowCount: t.rows.length,
|
|
4721
|
-
selectedPage:
|
|
3933
|
+
selectedPage: l,
|
|
4722
3934
|
rowsPerPage: {
|
|
4723
3935
|
value: a,
|
|
4724
|
-
onChange: (e) =>
|
|
3936
|
+
onChange: (e) => s(Number(e?.target?.value)),
|
|
4725
3937
|
options: [
|
|
4726
3938
|
{
|
|
4727
3939
|
label: "10 / page",
|
|
@@ -4831,7 +4043,210 @@ const Empty = ({ width: e = "auto", height: t = "auto", text: n = "No data", chi
|
|
|
4831
4043
|
}), extraSeparators = (e) => e?.split(/;|\t|\n/)?.some((e) => {
|
|
4832
4044
|
let t = e?.match(/[.,]/g);
|
|
4833
4045
|
return t && t.length > 1;
|
|
4834
|
-
}), hasOneComma = (e) => e?.split(/;|\t|\n/)?.some((e) => !e?.includes(".") && e?.match(/,/g)?.length === 1)
|
|
4046
|
+
}), hasOneComma = (e) => e?.split(/;|\t|\n/)?.some((e) => !e?.includes(".") && e?.match(/,/g)?.length === 1);
|
|
4047
|
+
var isValidLength = (e, t, n) => e >= t - n, isNonPlaceholderUnit = (e) => !!e && e !== "blank" && e.trim() !== "", validateColumnLength = (e, t, n, r, i, a, o) => {
|
|
4048
|
+
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;
|
|
4049
|
+
if (i && !isValidLength(e.length, l, c) && s.push(o("incorrectNumberOfFieldNameHeaderColumns", { expectedLengthMessage: u })), a) {
|
|
4050
|
+
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;
|
|
4051
|
+
isValidLength(n, e, i) || s.push(o("incorrectNumberOfUnitHeaderColumns", { expectedLengthMessage: u }));
|
|
4052
|
+
}
|
|
4053
|
+
return n.length === 0 ? s.push(o("incorrectNumberOfDataColumns", {
|
|
4054
|
+
expectedLengthMessage: u,
|
|
4055
|
+
dataRowStartIndex: d
|
|
4056
|
+
})) : n.forEach((e, t) => {
|
|
4057
|
+
isValidLength(e.length, l, c) || s.push(o("incorrectNumberOfDataColumns", {
|
|
4058
|
+
expectedLengthMessage: u,
|
|
4059
|
+
dataRowStartIndex: d + t
|
|
4060
|
+
}));
|
|
4061
|
+
}), s;
|
|
4062
|
+
}, normalize = (e) => e.toUpperCase().replace(/\(.*?\)/g, "").replace(/[^A-Z0-9]/g, "").trim(), defaultFieldNameValidator = ({ value: e, defaultAllowedValues: t }) => {
|
|
4063
|
+
let n = normalize(e);
|
|
4064
|
+
return t?.some((e) => normalize(e).includes(n) || n.includes(normalize(e))) ?? !1;
|
|
4065
|
+
}, defaultUnitsValidator = ({ value: e, defaultAllowedValues: t }) => t?.includes(e) ?? !1, validateHeadings = (e, t, n, r, i, a) => {
|
|
4066
|
+
let o = [];
|
|
4067
|
+
if (r) {
|
|
4068
|
+
let r = n.map((e) => e.fieldName).filter(Boolean);
|
|
4069
|
+
e.forEach((i, s) => {
|
|
4070
|
+
let c = n[s];
|
|
4071
|
+
!c || !c?.fieldName || (n[s]?.fieldNameValidator ?? defaultFieldNameValidator)({
|
|
4072
|
+
value: i,
|
|
4073
|
+
defaultAllowedValues: r,
|
|
4074
|
+
columnIndex: s,
|
|
4075
|
+
fields: e,
|
|
4076
|
+
units: t
|
|
4077
|
+
}) || o.push(a("incorrectFieldName", {
|
|
4078
|
+
i: s + 1,
|
|
4079
|
+
correctName: n[s]?.fieldName || a("notExist"),
|
|
4080
|
+
wrongName: i || a("notApplicable")
|
|
4081
|
+
}));
|
|
4082
|
+
});
|
|
4083
|
+
}
|
|
4084
|
+
if (i) {
|
|
4085
|
+
let i = n.map((e) => e?.validUnits), s = r ? 1 : 0;
|
|
4086
|
+
t.forEach((r, c) => {
|
|
4087
|
+
let l = n[c];
|
|
4088
|
+
if (!l) return;
|
|
4089
|
+
let u = l.unitsValidator ?? defaultUnitsValidator, d = i?.[c];
|
|
4090
|
+
u({
|
|
4091
|
+
value: r,
|
|
4092
|
+
defaultAllowedValues: d,
|
|
4093
|
+
columnIndex: c,
|
|
4094
|
+
fields: e,
|
|
4095
|
+
units: t
|
|
4096
|
+
}) || o.push(a("incorrectUnitRow", {
|
|
4097
|
+
unitRowIndex: s,
|
|
4098
|
+
i: c + 1,
|
|
4099
|
+
wrongUnit: r || a("notApplicable"),
|
|
4100
|
+
correctUnit: d?.join(",") || a("notExist")
|
|
4101
|
+
}));
|
|
4102
|
+
});
|
|
4103
|
+
}
|
|
4104
|
+
return o;
|
|
4105
|
+
}, validateValues = (e, t, n) => {
|
|
4106
|
+
let r = [];
|
|
4107
|
+
return e.forEach((e, i) => {
|
|
4108
|
+
e.forEach((e, a) => {
|
|
4109
|
+
let o = t[a];
|
|
4110
|
+
if (!o || !o.validator) return;
|
|
4111
|
+
let s = o.validator(e);
|
|
4112
|
+
s && typeof s == "string" && r.push(`${s} ${n("rowColumn", {
|
|
4113
|
+
rowIndex: i + 2,
|
|
4114
|
+
columnIndex: a
|
|
4115
|
+
})}`);
|
|
4116
|
+
});
|
|
4117
|
+
}), r;
|
|
4118
|
+
};
|
|
4119
|
+
const validate = (e, t, n, r, i, a, o) => {
|
|
4120
|
+
let s = validateColumnLength(e, t, n, r, i, a, o);
|
|
4121
|
+
return s.length === 0 && (s = s.concat(validateHeadings(e, t, r, i, a, o), validateValues(n, r, o))), {
|
|
4122
|
+
isValid: s.length === 0,
|
|
4123
|
+
errors: s
|
|
4124
|
+
};
|
|
4125
|
+
}, hasHeaders = (e, t, n) => {
|
|
4126
|
+
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;
|
|
4127
|
+
return {
|
|
4128
|
+
hasFieldNameHeader: o || i && !s && !l || i && a && !l,
|
|
4129
|
+
hasUnitHeader: s || c || i && a && !s && !l && !u || i && a && !l && !u
|
|
4130
|
+
};
|
|
4131
|
+
}, guessMissingHeaders = (e, { validationRules: t }) => {
|
|
4132
|
+
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);
|
|
4133
|
+
return s || e?.unshift(r), c || e?.splice(1, 0, a), {
|
|
4134
|
+
hasFieldNameHeader: s,
|
|
4135
|
+
hasUnitHeader: c
|
|
4136
|
+
};
|
|
4137
|
+
}, depthRound = (e) => Math.round(e * 100) / 100;
|
|
4138
|
+
var joinArray = (e) => e.join(", ").replace(/,\s*$/, ""), basePapaConfig = {
|
|
4139
|
+
skipEmptyLines: !0,
|
|
4140
|
+
transform: (e) => e?.trim(),
|
|
4141
|
+
delimiter: (e) => {
|
|
4142
|
+
let t = e.substring(0, 200), n = (t.match(/\t/g) ?? []).length, r = (t.match(/;/g) ?? []).length;
|
|
4143
|
+
return n === 0 && r === 0 ? "," : n > r ? " " : ";";
|
|
4144
|
+
}
|
|
4145
|
+
}, allowedMimes = [
|
|
4146
|
+
"text/csv",
|
|
4147
|
+
"text/plain",
|
|
4148
|
+
"application/json",
|
|
4149
|
+
"application/vnd.ms-excel"
|
|
4150
|
+
], isAllowedFileType = (e) => allowedMimes.includes(e.type), isFile = (e) => e instanceof File, isJson = (e) => e.trim().startsWith("["), isCustomJson = (e) => {
|
|
4151
|
+
try {
|
|
4152
|
+
return !!JSON.parse(e)?.path;
|
|
4153
|
+
} catch {
|
|
4154
|
+
return !1;
|
|
4155
|
+
}
|
|
4156
|
+
};
|
|
4157
|
+
const readFile$1 = (e) => new Promise((t, n) => {
|
|
4158
|
+
let r = new FileReader();
|
|
4159
|
+
r.onload = () => t(String(r.result)), r.onerror = n, r.readAsText(e);
|
|
4160
|
+
});
|
|
4161
|
+
var parseJson = async (e, t, n) => {
|
|
4162
|
+
try {
|
|
4163
|
+
let r = JSON.parse(e);
|
|
4164
|
+
return onCompleteParse({
|
|
4165
|
+
data: r,
|
|
4166
|
+
errors: []
|
|
4167
|
+
}, t, n);
|
|
4168
|
+
} catch (e) {
|
|
4169
|
+
throw Error(`${n("jsonParseFailed")} ${e.message}`);
|
|
4170
|
+
}
|
|
4171
|
+
}, parseCustomJson = async (e, t, n) => {
|
|
4172
|
+
try {
|
|
4173
|
+
let r = JSON.parse(e).path.map((e) => [
|
|
4174
|
+
depthRound(e.md),
|
|
4175
|
+
depthRound(e.inclination),
|
|
4176
|
+
depthRound(e.gridAzimuth)
|
|
4177
|
+
]);
|
|
4178
|
+
return r.unshift([
|
|
4179
|
+
"m",
|
|
4180
|
+
"deg",
|
|
4181
|
+
"deg"
|
|
4182
|
+
]), onCompleteParse({
|
|
4183
|
+
data: r,
|
|
4184
|
+
errors: []
|
|
4185
|
+
}, t, n);
|
|
4186
|
+
} catch (e) {
|
|
4187
|
+
throw Error(`${n("jsonParseFailed")} ${e.message}`);
|
|
4188
|
+
}
|
|
4189
|
+
};
|
|
4190
|
+
const replaceWithDot = (e) => e.replace(",", "."), replaceDataCommasWithDots = (e) => e.map((e) => e.map((e) => replaceWithDot(e)));
|
|
4191
|
+
var parseDSV = (e, { importLimit: t,...n }, r) => new Promise((i) => {
|
|
4192
|
+
Papa.parse(e, {
|
|
4193
|
+
...basePapaConfig,
|
|
4194
|
+
preview: t,
|
|
4195
|
+
complete: (e) => {
|
|
4196
|
+
let a = onCompleteParse(e, {
|
|
4197
|
+
importLimit: t,
|
|
4198
|
+
...n
|
|
4199
|
+
}, r);
|
|
4200
|
+
a.rows = replaceDataCommasWithDots(a.rows), i(a);
|
|
4201
|
+
}
|
|
4202
|
+
});
|
|
4203
|
+
});
|
|
4204
|
+
const parse = async (e, t, n) => {
|
|
4205
|
+
let r = {
|
|
4206
|
+
isValid: !1,
|
|
4207
|
+
fields: [],
|
|
4208
|
+
units: [],
|
|
4209
|
+
rows: [],
|
|
4210
|
+
errors: []
|
|
4211
|
+
};
|
|
4212
|
+
try {
|
|
4213
|
+
if (isFile(e) && !isAllowedFileType(e)) return r.errors.push(`${n("wrongFileFormatExpectedOneOf")} ${joinArray(Array.from(allowedMimes))}`), r;
|
|
4214
|
+
let i = isFile(e) ? await readFile$1(e) : e;
|
|
4215
|
+
return isJson(i) ? await parseJson(i, t, n) : isCustomJson(i) ? await parseCustomJson(i, t, n) : await parseDSV(e, t, n);
|
|
4216
|
+
} catch (e) {
|
|
4217
|
+
return r.errors.push(e.message), r;
|
|
4218
|
+
}
|
|
4219
|
+
}, unParse = (e, t, n, r) => {
|
|
4220
|
+
let i = r?.delimiter ?? ",", a = [
|
|
4221
|
+
e,
|
|
4222
|
+
t,
|
|
4223
|
+
...n
|
|
4224
|
+
].filter(Boolean);
|
|
4225
|
+
return Papa.unparse(a, {
|
|
4226
|
+
quotes: !1,
|
|
4227
|
+
header: !0,
|
|
4228
|
+
delimiter: i
|
|
4229
|
+
});
|
|
4230
|
+
};
|
|
4231
|
+
var onCompleteParse = (e, t, n) => {
|
|
4232
|
+
let { data: r, errors: i } = e, a = {
|
|
4233
|
+
isValid: !1,
|
|
4234
|
+
fields: [],
|
|
4235
|
+
units: [],
|
|
4236
|
+
rows: [],
|
|
4237
|
+
errors: i.map((e) => e.message)
|
|
4238
|
+
};
|
|
4239
|
+
if (i.length > 0) return a;
|
|
4240
|
+
let { hasFieldNameHeader: o, hasUnitHeader: s } = guessMissingHeaders(r, t);
|
|
4241
|
+
a.fields = r[0].map((e) => e.trim()), a.units = r[1].map((e) => e.trim()).filter(Boolean), a.rows = r.slice(2);
|
|
4242
|
+
let { validationRules: c } = t;
|
|
4243
|
+
if (c.length) {
|
|
4244
|
+
let { isValid: e, errors: t } = validate(a.fields, a.units, a.rows, c, o, s, n);
|
|
4245
|
+
a.errors.push(...t), a.isValid = e && t.length === 0;
|
|
4246
|
+
} else a.isValid = a.errors.length === 0;
|
|
4247
|
+
return a;
|
|
4248
|
+
};
|
|
4249
|
+
const toast = ({ id: e, message: t = {
|
|
4835
4250
|
type: MessageType.INFO,
|
|
4836
4251
|
content: ""
|
|
4837
4252
|
}, autoClose: n = 6e3, onClose: r }) => {
|
|
@@ -4886,10 +4301,10 @@ var toggle_module_default = {
|
|
|
4886
4301
|
noMargin: "_noMargin_1c9wf_110",
|
|
4887
4302
|
helpIconEnabled: "_helpIconEnabled_1c9wf_113"
|
|
4888
4303
|
};
|
|
4889
|
-
const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, small: a = !1, onChange: o, noMargin:
|
|
4304
|
+
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
4305
|
let p = useContext(DisabledContext), m = u || d, h = r || p;
|
|
4891
4306
|
return /* @__PURE__ */ jsxs("div", {
|
|
4892
|
-
className: cx(toggle_module_default.toggle, h ? toggle_module_default.disabled : null, a ? toggle_module_default.small : null,
|
|
4307
|
+
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
4308
|
style: { display: i },
|
|
4894
4309
|
onClick: (t) => {
|
|
4895
4310
|
h || (t.target.name = e, t.target.checked = !n, t.target.value = !n, o(t));
|
|
@@ -4915,7 +4330,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4915
4330
|
})
|
|
4916
4331
|
]
|
|
4917
4332
|
});
|
|
4918
|
-
}, PasteWithReviewModal = ({ config: e, state: t, updateState: n, setModalVisibility: r, onCloseModal: i, readAndParseInput: a, validationRules:
|
|
4333
|
+
}, 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
4334
|
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
4335
|
pastedText: "",
|
|
4921
4336
|
parsedResult: {
|
|
@@ -4936,15 +4351,15 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4936
4351
|
let O = useCallback((t) => {
|
|
4937
4352
|
if (t) {
|
|
4938
4353
|
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:
|
|
4354
|
+
validationRules: s,
|
|
4940
4355
|
importLimit: n
|
|
4941
|
-
}, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2),
|
|
4356
|
+
}, i = N.fields.slice(0, 2), a = (N.units ?? []).slice(0, 2), o = unParse(i, a, t, r);
|
|
4942
4357
|
f(() => D({
|
|
4943
4358
|
parsedResult: {
|
|
4944
4359
|
...N,
|
|
4945
4360
|
rows: t
|
|
4946
4361
|
},
|
|
4947
|
-
pastedText:
|
|
4362
|
+
pastedText: o
|
|
4948
4363
|
})), C.current = E;
|
|
4949
4364
|
} else f(() => {
|
|
4950
4365
|
C.current && D(C.current);
|
|
@@ -4953,7 +4368,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
4953
4368
|
}, [
|
|
4954
4369
|
E,
|
|
4955
4370
|
n,
|
|
4956
|
-
|
|
4371
|
+
s
|
|
4957
4372
|
]), k = () => {
|
|
4958
4373
|
D({
|
|
4959
4374
|
pastedText: "",
|
|
@@ -5006,7 +4421,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5006
4421
|
]
|
|
5007
4422
|
}),
|
|
5008
4423
|
_ && /* @__PURE__ */ jsx(Help, {
|
|
5009
|
-
validationRules:
|
|
4424
|
+
validationRules: s,
|
|
5010
4425
|
t: u
|
|
5011
4426
|
}),
|
|
5012
4427
|
R ? /* @__PURE__ */ jsx("div", {
|
|
@@ -5039,7 +4454,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5039
4454
|
},
|
|
5040
4455
|
colored: !0,
|
|
5041
4456
|
loading: d,
|
|
5042
|
-
testId: `${
|
|
4457
|
+
testId: `${h}-paste-from-clipboard-button`
|
|
5043
4458
|
})
|
|
5044
4459
|
]
|
|
5045
4460
|
})
|
|
@@ -5071,7 +4486,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5071
4486
|
} })
|
|
5072
4487
|
]
|
|
5073
4488
|
}), /* @__PURE__ */ jsx(Table$1, {
|
|
5074
|
-
validationRules:
|
|
4489
|
+
validationRules: s,
|
|
5075
4490
|
parsedResult: N,
|
|
5076
4491
|
updateState: (e) => D((t) => ({
|
|
5077
4492
|
...t,
|
|
@@ -5098,7 +4513,7 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5098
4513
|
onClick: () => f(() => j()),
|
|
5099
4514
|
disabled: R || !F,
|
|
5100
4515
|
loading: d,
|
|
5101
|
-
testId: `${
|
|
4516
|
+
testId: `${h}-paste-with-review-modal-button-okay`
|
|
5102
4517
|
}),
|
|
5103
4518
|
/* @__PURE__ */ jsx(Button, {
|
|
5104
4519
|
label: u("cancel"),
|
|
@@ -5144,7 +4559,75 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5144
4559
|
return;
|
|
5145
4560
|
}
|
|
5146
4561
|
return t;
|
|
5147
|
-
}, [t, n]),
|
|
4562
|
+
}, [t, n]), enTranslations = {
|
|
4563
|
+
cancel: "Cancel",
|
|
4564
|
+
chooseFile: "Choose file",
|
|
4565
|
+
copyDecimalComma: "Copy (decimal comma)",
|
|
4566
|
+
copyDecimalDot: "Copy (decimal dot)",
|
|
4567
|
+
copyToClipboard: "Copy to clipboard",
|
|
4568
|
+
copiedToClipboard: "Copied to clipboard",
|
|
4569
|
+
deleteAllRows: "Delete all rows",
|
|
4570
|
+
downloadFile: "Download file",
|
|
4571
|
+
export: "Export",
|
|
4572
|
+
help: "Help",
|
|
4573
|
+
import: "Import",
|
|
4574
|
+
noFileSelected: "No file selected",
|
|
4575
|
+
notApplicable: "N/A",
|
|
4576
|
+
notExist: "not exist",
|
|
4577
|
+
okay: "Okay",
|
|
4578
|
+
uploadCapitalized: "Upload",
|
|
4579
|
+
uploadFile: "Upload file",
|
|
4580
|
+
pasteShortcutHint: "You can also press Ctrl+V or Command+V to paste from clipboard",
|
|
4581
|
+
pasteFromClipboard: "Paste from clipboard",
|
|
4582
|
+
clipboardIsEmpty: "Clipboard is empty",
|
|
4583
|
+
clipboardReadFailed: "Unable to read data from clipboard. Check formatting or try Paste with Review.",
|
|
4584
|
+
clipboardReadNotAllowed: "Your browser did not allow reading the clipboard. Upgrade browser or try Paste with Review.",
|
|
4585
|
+
pasteSuccessful: "Paste successful",
|
|
4586
|
+
pasteWithReview: "Paste with review",
|
|
4587
|
+
pasteWithReviewRoundBrackets: "Paste (with review)",
|
|
4588
|
+
quickPasteFromClipboard: "Quick paste from clipboard",
|
|
4589
|
+
unableToCopyToClipboard: "Unable to copy to clipboard",
|
|
4590
|
+
fileParsingFailed: "Failed to read or validate the file. Please check the format and try again.",
|
|
4591
|
+
importWarning: "Large data detected: More than 500 rows have been imported. You can choose to import all or downsample for better performance.",
|
|
4592
|
+
importLimitExceeded: "Import failed: The data exceeds the 5000-row limit. Please reduce the number of rows and try again.",
|
|
4593
|
+
importingData: "Importing data",
|
|
4594
|
+
incorrectFieldName: "Incorrect field name (row 0, column {{i}}: has name {{wrongName}}, but should be {{correctName}})",
|
|
4595
|
+
incorrectNumberOfDataColumns: "Incorrect number of data columns, expected {{expectedLengthMessage}} columns in row {{dataRowStartIndex}}",
|
|
4596
|
+
incorrectNumberOfFieldNameHeaderColumns: "Incorrect number of field name header columns, expected {{expectedLengthMessage}} columns in row 0",
|
|
4597
|
+
incorrectNumberOfUnitHeaderColumns: "Incorrect number of unit header columns, expected {{expectedLengthMessage}} columns in row 1",
|
|
4598
|
+
incorrectUnitRow: "Incorrect unit (row {{unitRowIndex}}, column {{i}}: has unit [{{wrongUnit}}], but should be [{{correctUnit}}])",
|
|
4599
|
+
jsonParseFailed: "JSON parse failed",
|
|
4600
|
+
pasteYourTableDataHereToImportIt: "Paste your table data here to import it",
|
|
4601
|
+
rowColumn: "(row {{rowIndex}}, column {{columnIndex}})",
|
|
4602
|
+
theValuesCanBeSeparatedByDifferentDelimiters: "The values can be separated by different delimiters",
|
|
4603
|
+
unableToImportPleaseCorrectError: "Unable to import - {{rows}} rows have errors. Please correct input data and try again.",
|
|
4604
|
+
unableToPrepareExportData: "Unable to prepare export – see console for details.",
|
|
4605
|
+
validInputForPaste: "Valid input for paste.",
|
|
4606
|
+
wrongFileFormatExpectedOneOf: "Wrong file format: expected one of",
|
|
4607
|
+
youCanImportDataByPastingOrByMessage: "You can import data by pasting (e.g. from a spreadsheet), or by uploading a text file ( .txt or .csv ).",
|
|
4608
|
+
commasAsDecimals: "Comma is treated as a decimal separator when it is the only separator",
|
|
4609
|
+
deletePastedContent: "Delete pasted content",
|
|
4610
|
+
downsampled: "Downsampled",
|
|
4611
|
+
downsampleSuccess: "Successfully downsampled from {{from}} rows to {{to}} rows.",
|
|
4612
|
+
downsampleTooltip: "Reduces number of data rows (decimation) using the Ramer–Douglas–Peucker algorithm.",
|
|
4613
|
+
extraSeparators: "Two or more separators detected. Kept only last one as decimal separator, please control your import results",
|
|
4614
|
+
noDataPastedYet: "No data pasted yet.",
|
|
4615
|
+
semicolonSeparatedValues: "Semicolon-separated values",
|
|
4616
|
+
tabSeparatedValues: "Tab-separated values",
|
|
4617
|
+
examples: "Examples",
|
|
4618
|
+
smartUpload_description: "Upload image and extract table content using a LLM",
|
|
4619
|
+
smartUpload_smartUpload: "Smart Upload",
|
|
4620
|
+
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"
|
|
4621
|
+
}, interpolate = (e, t = {}) => e?.replace(/\{\{(\w+)\}\}/g, (e, n) => t?.[n] === void 0 ? "" : String(t?.[n])), useTranslationMap = (e) => useMemo(() => {
|
|
4622
|
+
let t = Object.keys(enTranslations).reduce((t, n) => {
|
|
4623
|
+
let r = enTranslations?.[n];
|
|
4624
|
+
return t[n] = e?.[n] ?? r, t;
|
|
4625
|
+
}, {});
|
|
4626
|
+
return (e, n) => {
|
|
4627
|
+
let r = t[e];
|
|
4628
|
+
return n ? interpolate(r, n) : r;
|
|
4629
|
+
};
|
|
4630
|
+
}, [e]), normalizeParsedResult = (e) => {
|
|
5148
4631
|
let { rows: t } = e, n = Array(t.length);
|
|
5149
4632
|
for (let e = 0; e < t.length; e++) {
|
|
5150
4633
|
let r = t[e], i = Array(r.length);
|
|
@@ -5156,16 +4639,16 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5156
4639
|
rows: n
|
|
5157
4640
|
};
|
|
5158
4641
|
}, useDataImportActions = ({ config: e, state: t, setState: n, smartUploadConfig: r, startTransition: i }) => {
|
|
5159
|
-
let { exportData: a, beforeExportData:
|
|
4642
|
+
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
4643
|
n((t) => ({
|
|
5161
4644
|
...t,
|
|
5162
4645
|
...e
|
|
5163
4646
|
}));
|
|
5164
|
-
}, [n]),
|
|
4647
|
+
}, [n]), b = useCallback(({ name: e, callback: n } = {}) => {
|
|
5165
4648
|
let r = { ...t.modalVisibility }, i = !e, a = [];
|
|
5166
4649
|
if (i) for (let e of Object.keys(r)) a.push(e), r[e] = !1;
|
|
5167
4650
|
else r?.[e] && (a.push(e), r[e] = !1);
|
|
5168
|
-
a
|
|
4651
|
+
a.length > 0 && y({
|
|
5169
4652
|
modalVisibility: r,
|
|
5170
4653
|
pastedText: "",
|
|
5171
4654
|
parsedResult: {
|
|
@@ -5175,9 +4658,9 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5175
4658
|
units: [],
|
|
5176
4659
|
errors: []
|
|
5177
4660
|
}
|
|
5178
|
-
}), typeof n == "function" && a
|
|
5179
|
-
}, [t.modalVisibility,
|
|
5180
|
-
i(() =>
|
|
4661
|
+
}), typeof n == "function" && a.length > 0 && n();
|
|
4662
|
+
}, [t.modalVisibility, y]), x = useCallback(() => {
|
|
4663
|
+
i(() => y({
|
|
5181
4664
|
pastedText: "",
|
|
5182
4665
|
parsedResult: {
|
|
5183
4666
|
isValid: !1,
|
|
@@ -5186,52 +4669,55 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5186
4669
|
units: [],
|
|
5187
4670
|
errors: []
|
|
5188
4671
|
}
|
|
5189
|
-
})),
|
|
5190
|
-
}, [t.modalVisibility,
|
|
5191
|
-
|
|
4672
|
+
})), m && m?.("all");
|
|
4673
|
+
}, [t.modalVisibility, y]), S = useCallback((e, n) => {
|
|
4674
|
+
y({ modalVisibility: {
|
|
5192
4675
|
...t.modalVisibility,
|
|
5193
4676
|
[e]: n
|
|
5194
4677
|
} });
|
|
5195
|
-
}, [t.modalVisibility,
|
|
4678
|
+
}, [t.modalVisibility, y]), C = useCallback(async (e) => {
|
|
5196
4679
|
let t = {
|
|
5197
|
-
validationRules:
|
|
4680
|
+
validationRules: l,
|
|
5198
4681
|
importLimit: c
|
|
5199
|
-
}, n = await
|
|
5200
|
-
if (
|
|
4682
|
+
}, n = await parse(e, t, _), r = normalizeParsedResult(n);
|
|
4683
|
+
if (g && g(h)) {
|
|
5201
4684
|
let { fields: e, units: n, rows: a, isValid: o } = r, s = unParse(e, n ?? [], a, t);
|
|
5202
|
-
return i(() =>
|
|
4685
|
+
return i(() => y({
|
|
5203
4686
|
pastedText: s,
|
|
5204
|
-
parsedResult:
|
|
4687
|
+
parsedResult: h
|
|
5205
4688
|
})), r;
|
|
5206
4689
|
}
|
|
5207
|
-
return i(() =>
|
|
4690
|
+
return i(() => y({
|
|
5208
4691
|
pastedText: e,
|
|
5209
4692
|
parsedResult: r
|
|
5210
4693
|
})), r;
|
|
5211
4694
|
}, [
|
|
5212
|
-
|
|
4695
|
+
l,
|
|
5213
4696
|
c,
|
|
4697
|
+
_,
|
|
5214
4698
|
g,
|
|
5215
4699
|
h,
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
]), T = useCallback(async (e) => {
|
|
4700
|
+
y
|
|
4701
|
+
]), w = useCallback(async (e) => {
|
|
5219
4702
|
let { fromFile: t, showSuccessToast: n = !0 } = e ?? {}, r;
|
|
5220
4703
|
try {
|
|
5221
4704
|
if (r = t ? await t.text() : await navigator.clipboard.readText(), !r) {
|
|
5222
4705
|
transitionToast({ message: {
|
|
5223
4706
|
type: "Error",
|
|
5224
|
-
content:
|
|
4707
|
+
content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed")
|
|
5225
4708
|
} }, i);
|
|
5226
4709
|
return;
|
|
5227
4710
|
}
|
|
5228
|
-
let e = await
|
|
4711
|
+
let e = await parse(r, {
|
|
4712
|
+
validationRules: l,
|
|
4713
|
+
importLimit: c
|
|
4714
|
+
}, _), a = normalizeParsedResult(e);
|
|
5229
4715
|
return a?.isValid || transitionToast({ message: {
|
|
5230
4716
|
type: "Error",
|
|
5231
|
-
content:
|
|
4717
|
+
content: _("clipboardReadFailed")
|
|
5232
4718
|
} }, i), n && transitionToast({ message: {
|
|
5233
4719
|
type: "Success",
|
|
5234
|
-
content:
|
|
4720
|
+
content: _("pasteSuccessful")
|
|
5235
4721
|
} }, i), {
|
|
5236
4722
|
pastedText: r,
|
|
5237
4723
|
parsedResult: a
|
|
@@ -5239,78 +4725,78 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5239
4725
|
} catch (e) {
|
|
5240
4726
|
transitionToast({ message: {
|
|
5241
4727
|
type: "Error",
|
|
5242
|
-
content:
|
|
4728
|
+
content: _(t ? "fileReadOrParseFailed" : "clipboardReadNotAllowed"),
|
|
5243
4729
|
details: e.message
|
|
5244
4730
|
} }, i);
|
|
5245
4731
|
return;
|
|
5246
4732
|
}
|
|
5247
|
-
}, [
|
|
4733
|
+
}, [l, c]), T = useCallback(async (e) => {
|
|
5248
4734
|
let t = e?.target?.files?.[0];
|
|
5249
4735
|
if (!t) return;
|
|
5250
|
-
let n = await t.text(), r = await
|
|
5251
|
-
r.isValid ? (
|
|
4736
|
+
let n = await t.text(), r = await C(n);
|
|
4737
|
+
r.isValid ? (f || transitionToast({ message: {
|
|
5252
4738
|
type: "Success",
|
|
5253
|
-
content:
|
|
5254
|
-
} }, i), i(() =>
|
|
4739
|
+
content: _("pasteSuccessful")
|
|
4740
|
+
} }, i), i(() => d(r))) : transitionToast({ message: {
|
|
5255
4741
|
type: "Error",
|
|
5256
|
-
content:
|
|
4742
|
+
content: _("fileParsingFailed")
|
|
5257
4743
|
} }, i);
|
|
5258
4744
|
}, [
|
|
5259
|
-
|
|
4745
|
+
l,
|
|
5260
4746
|
c,
|
|
5261
|
-
|
|
5262
|
-
|
|
5263
|
-
]),
|
|
4747
|
+
y,
|
|
4748
|
+
d
|
|
4749
|
+
]), E = useCallback(async (e = !0) => {
|
|
5264
4750
|
try {
|
|
5265
4751
|
let t = await navigator.clipboard.readText();
|
|
5266
4752
|
if (!t) {
|
|
5267
4753
|
transitionToast({ message: {
|
|
5268
4754
|
type: "Error",
|
|
5269
|
-
content:
|
|
4755
|
+
content: _("clipboardIsEmpty")
|
|
5270
4756
|
} }, i);
|
|
5271
4757
|
return;
|
|
5272
4758
|
}
|
|
5273
|
-
let n = await
|
|
4759
|
+
let n = await C(t);
|
|
5274
4760
|
if (!n.isValid) {
|
|
5275
4761
|
transitionToast({ message: {
|
|
5276
4762
|
type: "Error",
|
|
5277
|
-
content:
|
|
4763
|
+
content: _("clipboardReadFailed")
|
|
5278
4764
|
} }, i);
|
|
5279
4765
|
return;
|
|
5280
4766
|
}
|
|
5281
|
-
|
|
4767
|
+
f || transitionToast({ message: {
|
|
5282
4768
|
type: "Success",
|
|
5283
|
-
content:
|
|
5284
|
-
} }, i), e && i(() =>
|
|
4769
|
+
content: _("pasteSuccessful")
|
|
4770
|
+
} }, i), e && i(() => d(n));
|
|
5285
4771
|
} catch {
|
|
5286
4772
|
transitionToast({ message: {
|
|
5287
4773
|
type: "Error",
|
|
5288
|
-
content:
|
|
4774
|
+
content: _("clipboardReadNotAllowed")
|
|
5289
4775
|
} }, i);
|
|
5290
4776
|
}
|
|
5291
4777
|
}, [
|
|
5292
|
-
|
|
4778
|
+
l,
|
|
5293
4779
|
c,
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
]),
|
|
5298
|
-
let t = await
|
|
4780
|
+
_,
|
|
4781
|
+
y,
|
|
4782
|
+
d
|
|
4783
|
+
]), D = useCallback(async (e) => {
|
|
4784
|
+
let t = await v();
|
|
5299
4785
|
if (!t) return;
|
|
5300
|
-
let { fields: n = [], units: r = [], rows: a = [] } = t, o = (r ?? []).map((e) => e?.length ? e : placeholder$1).slice(0, n
|
|
4786
|
+
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
4787
|
try {
|
|
5302
4788
|
await navigator.clipboard.writeText(l), transitionToast({ message: {
|
|
5303
4789
|
type: "Success",
|
|
5304
|
-
content:
|
|
4790
|
+
content: _("copiedToClipboard")
|
|
5305
4791
|
} }, i);
|
|
5306
4792
|
} catch (e) {
|
|
5307
4793
|
transitionToast({ message: {
|
|
5308
4794
|
type: "Error",
|
|
5309
|
-
content:
|
|
4795
|
+
content: _("unableToCopyToClipboard"),
|
|
5310
4796
|
details: e.message
|
|
5311
4797
|
} }, i);
|
|
5312
4798
|
}
|
|
5313
|
-
}, [
|
|
4799
|
+
}, [v, _]), O = useCallback((e) => {
|
|
5314
4800
|
if (!e || e.errorMessage) {
|
|
5315
4801
|
transitionToast({ message: {
|
|
5316
4802
|
type: "Error",
|
|
@@ -5325,24 +4811,24 @@ const Toggle = ({ name: e, label: t, checked: n = !1, disabled: r, display: i, s
|
|
|
5325
4811
|
rows: n.map((e) => Object.values(e)),
|
|
5326
4812
|
errors: []
|
|
5327
4813
|
};
|
|
5328
|
-
i(() =>
|
|
4814
|
+
i(() => y({ parsedResult: a })), i(() => d(a));
|
|
5329
4815
|
let { onComplete: o } = r ?? {};
|
|
5330
|
-
typeof o == "function" && o(a),
|
|
4816
|
+
typeof o == "function" && o(a), b();
|
|
5331
4817
|
}, [
|
|
5332
|
-
|
|
5333
|
-
|
|
4818
|
+
y,
|
|
4819
|
+
d,
|
|
5334
4820
|
r
|
|
5335
4821
|
]);
|
|
5336
4822
|
return {
|
|
5337
|
-
updateState:
|
|
5338
|
-
closeModals:
|
|
5339
|
-
setModalVisibility:
|
|
5340
|
-
readAndParseInput:
|
|
5341
|
-
onFileChange:
|
|
5342
|
-
onClickQuickPasteFromClipBoard:
|
|
5343
|
-
onClickCopyClipboard:
|
|
5344
|
-
onSmartUploadResult:
|
|
5345
|
-
deleteAllRows:
|
|
4823
|
+
updateState: y,
|
|
4824
|
+
closeModals: b,
|
|
4825
|
+
setModalVisibility: S,
|
|
4826
|
+
readAndParseInput: w,
|
|
4827
|
+
onFileChange: T,
|
|
4828
|
+
onClickQuickPasteFromClipBoard: E,
|
|
4829
|
+
onClickCopyClipboard: D,
|
|
4830
|
+
onSmartUploadResult: O,
|
|
4831
|
+
deleteAllRows: x
|
|
5346
4832
|
};
|
|
5347
4833
|
}, onClickDownLoad = (e, t) => {
|
|
5348
4834
|
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 +4864,165 @@ var initialState = {
|
|
|
5378
4864
|
helpModal: !1
|
|
5379
4865
|
}
|
|
5380
4866
|
};
|
|
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({
|
|
4867
|
+
const TableImportExport = ({ config: e, smartUploadConfig: t, testId: n }) => {
|
|
4868
|
+
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
4869
|
config: e,
|
|
5386
|
-
state:
|
|
5387
|
-
setState:
|
|
4870
|
+
state: y,
|
|
4871
|
+
setState: b,
|
|
5388
4872
|
smartUploadConfig: t,
|
|
5389
|
-
startTransition:
|
|
4873
|
+
startTransition: M
|
|
5390
4874
|
}) ?? {};
|
|
5391
|
-
useKeyboardEvent("Escape", () =>
|
|
5392
|
-
let
|
|
4875
|
+
useKeyboardEvent("Escape", () => F());
|
|
4876
|
+
let H = u ? [
|
|
5393
4877
|
{
|
|
5394
4878
|
type: "Option",
|
|
5395
|
-
label:
|
|
4879
|
+
label: k("uploadFile"),
|
|
5396
4880
|
upload: !0,
|
|
5397
4881
|
uploadType: ".csv,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
5398
|
-
onChange:
|
|
4882
|
+
onChange: L,
|
|
5399
4883
|
testId: `${n}-option-upload-file`
|
|
5400
4884
|
},
|
|
5401
|
-
...
|
|
4885
|
+
...d ? [{
|
|
5402
4886
|
type: "Option",
|
|
5403
|
-
label:
|
|
5404
|
-
onClick:
|
|
4887
|
+
label: k("quickPasteFromClipboard"),
|
|
4888
|
+
onClick: R,
|
|
5405
4889
|
testId: `${n}-option-quick-paste-from-clipboard`
|
|
5406
4890
|
}] : [],
|
|
5407
|
-
...
|
|
4891
|
+
...d ? [{
|
|
5408
4892
|
type: "Option",
|
|
5409
|
-
label:
|
|
5410
|
-
onClick: () =>
|
|
4893
|
+
label: k("pasteWithReview"),
|
|
4894
|
+
onClick: () => I("reviewPasteModal", !S),
|
|
5411
4895
|
testId: `${n}-paste-with-review`
|
|
5412
4896
|
}] : [],
|
|
5413
|
-
...
|
|
4897
|
+
...T && w && t ? [{
|
|
5414
4898
|
type: "Option",
|
|
5415
|
-
label:
|
|
5416
|
-
onClick: () =>
|
|
4899
|
+
label: k("smartUpload_smartUpload"),
|
|
4900
|
+
onClick: () => I("smartUploadModal", !x),
|
|
5417
4901
|
testId: `${n}-smart-upload`
|
|
5418
4902
|
}] : [],
|
|
5419
|
-
...applyModalHandlers(
|
|
5420
|
-
] : [],
|
|
4903
|
+
...applyModalHandlers(_?.importOptions ?? [], y, I)
|
|
4904
|
+
] : [], U = [
|
|
5421
4905
|
{
|
|
5422
4906
|
type: "Option",
|
|
5423
|
-
label:
|
|
4907
|
+
label: k("downloadFile"),
|
|
5424
4908
|
onClick: async () => {
|
|
5425
|
-
let e = await
|
|
5426
|
-
e && e && onClickDownLoad(e,
|
|
4909
|
+
let e = await A();
|
|
4910
|
+
e && e && onClickDownLoad(e, s);
|
|
5427
4911
|
}
|
|
5428
4912
|
},
|
|
5429
|
-
...
|
|
4913
|
+
...l ? [{
|
|
5430
4914
|
type: "Option",
|
|
5431
|
-
label:
|
|
5432
|
-
onClick: () =>
|
|
4915
|
+
label: k("copyToClipboard"),
|
|
4916
|
+
onClick: () => z("dot")
|
|
5433
4917
|
}] : [{
|
|
5434
4918
|
type: "Menu",
|
|
5435
4919
|
testId: `${n}-menu-copy-to-clipboard`,
|
|
5436
4920
|
menu: {
|
|
5437
4921
|
trigger: "Text",
|
|
5438
|
-
label:
|
|
4922
|
+
label: k("copyToClipboard"),
|
|
5439
4923
|
sections: [{
|
|
5440
4924
|
type: "Option",
|
|
5441
|
-
label:
|
|
5442
|
-
onClick: () =>
|
|
4925
|
+
label: k("copyDecimalDot"),
|
|
4926
|
+
onClick: () => z("dot"),
|
|
5443
4927
|
testId: `${n}-option-copy-decimal-dot`
|
|
5444
4928
|
}, {
|
|
5445
4929
|
type: "Option",
|
|
5446
|
-
label:
|
|
5447
|
-
onClick: () =>
|
|
4930
|
+
label: k("copyDecimalComma"),
|
|
4931
|
+
onClick: () => z("comma")
|
|
5448
4932
|
}]
|
|
5449
4933
|
}
|
|
5450
4934
|
}],
|
|
5451
|
-
...applyModalHandlers(
|
|
5452
|
-
],
|
|
4935
|
+
...applyModalHandlers(_?.exportOptions ?? [], y, I)
|
|
4936
|
+
], W = f ? [{
|
|
5453
4937
|
type: "Option",
|
|
5454
|
-
label:
|
|
5455
|
-
onClick: () =>
|
|
4938
|
+
label: k("deleteAllRows"),
|
|
4939
|
+
onClick: () => V(),
|
|
5456
4940
|
testId: `${n}-delete-all-rows`
|
|
5457
|
-
}, ...applyModalHandlers(
|
|
4941
|
+
}, ...applyModalHandlers(_?.deleteOptions ?? [], y, I)] : [], G = p ? [
|
|
5458
4942
|
{ type: "Divider" },
|
|
5459
4943
|
{
|
|
5460
4944
|
type: "Option",
|
|
5461
|
-
label:
|
|
5462
|
-
onClick: () =>
|
|
4945
|
+
label: k("help"),
|
|
4946
|
+
onClick: () => I("helpModal", !C)
|
|
5463
4947
|
},
|
|
5464
|
-
...applyModalHandlers(
|
|
5465
|
-
] : [],
|
|
5466
|
-
...
|
|
5467
|
-
section: [...
|
|
4948
|
+
...applyModalHandlers(_?.helpOptions ?? [], y, I)
|
|
4949
|
+
] : [], K = [
|
|
4950
|
+
...H.length ? [{
|
|
4951
|
+
section: [...H, ...G],
|
|
5468
4952
|
name: "import-options",
|
|
5469
4953
|
iconName: "upload",
|
|
5470
|
-
tooltip:
|
|
4954
|
+
tooltip: k("import")
|
|
5471
4955
|
}] : [],
|
|
5472
|
-
...
|
|
5473
|
-
section:
|
|
4956
|
+
...U.length ? [{
|
|
4957
|
+
section: U,
|
|
5474
4958
|
name: "export-options",
|
|
5475
4959
|
iconName: "download",
|
|
5476
|
-
tooltip:
|
|
4960
|
+
tooltip: k("export")
|
|
5477
4961
|
}] : [],
|
|
5478
|
-
...
|
|
5479
|
-
section:
|
|
4962
|
+
...W.length ? [{
|
|
4963
|
+
section: W,
|
|
5480
4964
|
name: "delete-options",
|
|
5481
4965
|
iconName: "delete",
|
|
5482
|
-
tooltip:
|
|
4966
|
+
tooltip: k("deleteAllRows")
|
|
5483
4967
|
}] : []
|
|
5484
4968
|
];
|
|
5485
4969
|
return /* @__PURE__ */ jsxs("span", { children: [
|
|
5486
|
-
|
|
4970
|
+
j && /* @__PURE__ */ jsx(Spinner, {
|
|
5487
4971
|
small: !0,
|
|
5488
4972
|
dark: !0
|
|
5489
4973
|
}),
|
|
5490
|
-
|
|
4974
|
+
K.map((e, t) => /* @__PURE__ */ jsx(MenuComponent, {
|
|
5491
4975
|
sections: e.section,
|
|
5492
4976
|
iconName: e.iconName,
|
|
5493
4977
|
tooltip: e.tooltip,
|
|
5494
4978
|
testId: `data-${e?.name}-menu`
|
|
5495
4979
|
}, t)),
|
|
5496
|
-
|
|
4980
|
+
S && /* @__PURE__ */ jsx(PasteWithReviewModal, {
|
|
5497
4981
|
config: e,
|
|
5498
|
-
state:
|
|
5499
|
-
updateState:
|
|
5500
|
-
setModalVisibility:
|
|
5501
|
-
readAndParseInput:
|
|
5502
|
-
onCloseModal:
|
|
5503
|
-
validationRules:
|
|
5504
|
-
onCompleteImport:
|
|
5505
|
-
prevalidationConfig:
|
|
5506
|
-
t:
|
|
5507
|
-
loading:
|
|
5508
|
-
startTransition:
|
|
4982
|
+
state: y,
|
|
4983
|
+
updateState: P,
|
|
4984
|
+
setModalVisibility: I,
|
|
4985
|
+
readAndParseInput: N,
|
|
4986
|
+
onCloseModal: F,
|
|
4987
|
+
validationRules: o,
|
|
4988
|
+
onCompleteImport: v,
|
|
4989
|
+
prevalidationConfig: a,
|
|
4990
|
+
t: k,
|
|
4991
|
+
loading: j,
|
|
4992
|
+
startTransition: M,
|
|
5509
4993
|
testId: n
|
|
5510
4994
|
}),
|
|
5511
|
-
|
|
5512
|
-
visible: T,
|
|
5513
|
-
setModalVisibility: R,
|
|
5514
|
-
validationRules: s,
|
|
5515
|
-
t: j
|
|
5516
|
-
}),
|
|
5517
|
-
E && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
4995
|
+
C && /* @__PURE__ */ jsx(HelpModal, {
|
|
5518
4996
|
visible: C,
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
4997
|
+
setModalVisibility: I,
|
|
4998
|
+
validationRules: o,
|
|
4999
|
+
t: k
|
|
5000
|
+
}),
|
|
5001
|
+
w && t && /* @__PURE__ */ jsx(SmartUploadModal, {
|
|
5002
|
+
visible: x,
|
|
5003
|
+
prompt: T,
|
|
5004
|
+
onUpload: O,
|
|
5005
|
+
onCloseModal: () => F({ callback: E }),
|
|
5006
|
+
onComplete: B,
|
|
5007
|
+
onError: D,
|
|
5008
|
+
heading: k("smartUpload_smartUpload"),
|
|
5009
|
+
dialogText: k("smartUpload_description"),
|
|
5010
|
+
fileInputText: k("chooseFile"),
|
|
5011
|
+
fileInputPlaceholder: k("noFileSelected"),
|
|
5012
|
+
uploadText: k("uploadCapitalized"),
|
|
5013
|
+
cancelText: k("cancel"),
|
|
5530
5014
|
testId: n
|
|
5531
5015
|
}),
|
|
5532
5016
|
/* @__PURE__ */ jsx(ModalsRenderer, {
|
|
5533
|
-
modals:
|
|
5534
|
-
modalVisibility:
|
|
5535
|
-
onCloseModal:
|
|
5017
|
+
modals: g,
|
|
5018
|
+
modalVisibility: y?.modalVisibility,
|
|
5019
|
+
onCloseModal: F,
|
|
5536
5020
|
testId: n
|
|
5537
5021
|
})
|
|
5538
5022
|
] });
|
|
5539
5023
|
}, FileButton = ({ file: e, accept: t, multi: n, name: r, disabled: i, onChange: a = noop,...o }) => {
|
|
5540
|
-
let
|
|
5541
|
-
i ||
|
|
5024
|
+
let c = useContext(DisabledContext), l = useRef(null), u = () => {
|
|
5025
|
+
i || c || l.current?.click();
|
|
5542
5026
|
}, d = (e) => {
|
|
5543
5027
|
let t = n ? e.target.files : e.target.files?.[0], r = {
|
|
5544
5028
|
...e,
|
|
@@ -5817,15 +5301,15 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5817
5301
|
},
|
|
5818
5302
|
children: e.content
|
|
5819
5303
|
}) : null, ListSubheading = forwardRef(({ item: e, index: t }, n) => {
|
|
5820
|
-
let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick:
|
|
5304
|
+
let r = useContext(DisabledContext), { actions: i, disabled: a, expanded: o, onClick: c, title: l, name: u, icon: d, testId: f } = e;
|
|
5821
5305
|
return /* @__PURE__ */ jsx("div", {
|
|
5822
5306
|
ref: (e) => {
|
|
5823
5307
|
n && "current" in n && Array.isArray(n.current) && t !== void 0 && (n.current[t] = e);
|
|
5824
5308
|
},
|
|
5825
5309
|
"data-testid": f ?? null,
|
|
5826
|
-
className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "",
|
|
5310
|
+
className: cx(list_module_default.item, list_module_default.heading, a || r ? list_module_default.disabled : "", c ? list_module_default.action : ""),
|
|
5827
5311
|
onClick: (e) => {
|
|
5828
|
-
|
|
5312
|
+
c && c(e);
|
|
5829
5313
|
},
|
|
5830
5314
|
title: l,
|
|
5831
5315
|
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -5850,7 +5334,7 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5850
5334
|
}) })
|
|
5851
5335
|
});
|
|
5852
5336
|
}), ListRow = forwardRef(({ item: e, index: t, expanding: n, invokeEditOnRowClick: r, draggable: i }, a) => {
|
|
5853
|
-
let o = useContext(DisabledContext),
|
|
5337
|
+
let o = useContext(DisabledContext), c = (e, t, s, c, l, u) => {
|
|
5854
5338
|
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
5339
|
return /* @__PURE__ */ jsx(m, {
|
|
5856
5340
|
href: t.url,
|
|
@@ -5904,16 +5388,16 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5904
5388
|
item: e,
|
|
5905
5389
|
index: t
|
|
5906
5390
|
}, t) : i ? ((e, t) => {
|
|
5907
|
-
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging:
|
|
5391
|
+
let { attributes: n, listeners: r, setNodeRef: i, transform: a, transition: o, isDragging: s } = useSortable({
|
|
5908
5392
|
id: e.toString(),
|
|
5909
5393
|
animateLayoutChanges: () => !1
|
|
5910
5394
|
}), l = {
|
|
5911
5395
|
transform: CSS.Translate.toString(a),
|
|
5912
5396
|
transition: o,
|
|
5913
|
-
opacity:
|
|
5397
|
+
opacity: s ? 0 : 1
|
|
5914
5398
|
};
|
|
5915
|
-
return
|
|
5916
|
-
})(t, e) :
|
|
5399
|
+
return c(e, t, l, n, r, i);
|
|
5400
|
+
})(t, e) : c(t, e);
|
|
5917
5401
|
}), ListDragWrapper = ({ children: e, draggable: t, list: n, onListReorder: r }) => {
|
|
5918
5402
|
let [i, a] = useState(null), o = (e) => {
|
|
5919
5403
|
a(e.active.id);
|
|
@@ -5946,9 +5430,9 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5946
5430
|
}), document.body)]
|
|
5947
5431
|
}) : e;
|
|
5948
5432
|
}, ListVirtualScrollWrapper = ({ items: e, scrollDetails: t, children: n }) => {
|
|
5949
|
-
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll:
|
|
5433
|
+
let { scrollable: r, hideScrollbar: i, triggerScrollToActiveItem: a, infiniteScroll: s } = t, l = useRef(null), u = useVirtualizer({
|
|
5950
5434
|
count: e.length,
|
|
5951
|
-
getScrollElement: () =>
|
|
5435
|
+
getScrollElement: () => l.current,
|
|
5952
5436
|
estimateSize: useCallback(() => {
|
|
5953
5437
|
let t = 37;
|
|
5954
5438
|
if (e.length > 0) {
|
|
@@ -5970,8 +5454,8 @@ const ToggleNarrow = ({ toggleNarrow: e, onClickToggleNarrow: t }) => e ? /* @__
|
|
|
5970
5454
|
f(t);
|
|
5971
5455
|
}
|
|
5972
5456
|
}, [a]), /* @__PURE__ */ jsx("div", {
|
|
5973
|
-
className: cx(list_module_default.listContent, r ||
|
|
5974
|
-
ref:
|
|
5457
|
+
className: cx(list_module_default.listContent, r || s ? list_module_default.scrollableList : "", i ? list_module_default.hideScrollbar : ""),
|
|
5458
|
+
ref: l,
|
|
5975
5459
|
children: /* @__PURE__ */ jsx("div", {
|
|
5976
5460
|
className: list_module_default.virtualRows,
|
|
5977
5461
|
style: { height: `${u.getTotalSize()}px` },
|
|
@@ -6242,12 +5726,12 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
6242
5726
|
})
|
|
6243
5727
|
]
|
|
6244
5728
|
});
|
|
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:
|
|
5729
|
+
}, 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" }) => {
|
|
5730
|
+
let m = useContext(DisabledContext), h = f !== void 0, { simpleInputs: _, options: v, selectedOptions: y } = h ? {
|
|
6247
5731
|
simpleInputs: !1,
|
|
6248
5732
|
options: f,
|
|
6249
5733
|
selectedOptions: void 0
|
|
6250
|
-
} : standardizeInputs(n, r), b = h || y == null ? void 0 :
|
|
5734
|
+
} : standardizeInputs(n, r), b = h || y == null ? void 0 : _ ? y : y.value, x = h ? d : t;
|
|
6251
5735
|
return /* @__PURE__ */ jsxs("div", {
|
|
6252
5736
|
className: cx(radio_button_module_default.wrapper, u ? radio_button_module_default.inline : null, p === "inline fields" ? radio_button_module_default.inline : null),
|
|
6253
5737
|
children: [d && /* @__PURE__ */ jsx("label", {
|
|
@@ -6262,7 +5746,7 @@ const RadioInput = ({ name: e, label: t, value: n, selected: r, disabled: i = !1
|
|
|
6262
5746
|
selected: r,
|
|
6263
5747
|
disabled: a || t.disabled || m,
|
|
6264
5748
|
small: o,
|
|
6265
|
-
noMargin:
|
|
5749
|
+
noMargin: c,
|
|
6266
5750
|
onChange: t.disabled ? void 0 : (n) => {
|
|
6267
5751
|
h ? l(n.target) : (n.target.name = e, n.target.value = t.value.toString(), n.target.label = t.label.toString(), i && i(n));
|
|
6268
5752
|
},
|
|
@@ -6339,7 +5823,7 @@ var rich_text_input_module_default = {
|
|
|
6339
5823
|
richTextInput: "_richTextInput_1fb4l_77"
|
|
6340
5824
|
};
|
|
6341
5825
|
const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disabled: r, toolbarComponent: i }, a) => {
|
|
6342
|
-
let o = useContext(DisabledContext),
|
|
5826
|
+
let o = useContext(DisabledContext), c = r || o, { manager: u, state: d, setState: f, getContext: p } = useRemirror({
|
|
6343
5827
|
extensions: () => [
|
|
6344
5828
|
new BoldExtension({}),
|
|
6345
5829
|
new BulletListExtension({}),
|
|
@@ -6356,31 +5840,31 @@ const RichTextInput = forwardRef(({ placeholder: e, onChange: t, value: n, disab
|
|
|
6356
5840
|
return useImperativeHandle(a, () => p(), [p]), /* @__PURE__ */ jsx("div", {
|
|
6357
5841
|
className: rich_text_input_module_default.richTextInput,
|
|
6358
5842
|
children: /* @__PURE__ */ jsxs(Remirror, {
|
|
6359
|
-
manager:
|
|
5843
|
+
manager: u,
|
|
6360
5844
|
state: d,
|
|
6361
5845
|
placeholder: e,
|
|
6362
5846
|
onChange: ({ helpers: e, state: n }) => {
|
|
6363
5847
|
let r = e.getMarkdown(n);
|
|
6364
5848
|
t && t(r), f(n);
|
|
6365
5849
|
},
|
|
6366
|
-
editable: !
|
|
5850
|
+
editable: !c,
|
|
6367
5851
|
children: [/* @__PURE__ */ jsx(RichTextToolbar, {
|
|
6368
|
-
disabled:
|
|
5852
|
+
disabled: c,
|
|
6369
5853
|
toolbarComponent: i
|
|
6370
5854
|
}), /* @__PURE__ */ jsx(EditorComponent, {})]
|
|
6371
5855
|
})
|
|
6372
5856
|
});
|
|
6373
5857
|
});
|
|
6374
5858
|
var row_module_default = { row: "_row_n16je_1" };
|
|
6375
|
-
const Row = ({ alignItems: t = "initial", justifyContent: n = "initial", children: r = null, flex:
|
|
5859
|
+
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
5860
|
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
5861
|
return /* @__PURE__ */ jsx("div", {
|
|
6378
5862
|
className: cx(row_module_default.row),
|
|
6379
5863
|
style: {
|
|
6380
5864
|
alignItems: t,
|
|
6381
5865
|
justifyContent: n,
|
|
6382
|
-
flexGrow:
|
|
6383
|
-
flexShrink:
|
|
5866
|
+
flexGrow: a ? 1 : 0,
|
|
5867
|
+
flexShrink: a ? 1 : 0,
|
|
6384
5868
|
flexWrap: u ? "wrap" : "nowrap",
|
|
6385
5869
|
height: o,
|
|
6386
5870
|
marginLeft: `calc(${f} * -0.5)`,
|
|
@@ -6530,7 +6014,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6530
6014
|
}, Content$1 = ({ children: e, activeTabIndex: t, contentPadding: n }) => Array.isArray(e) ? /* @__PURE__ */ jsx("div", {
|
|
6531
6015
|
className: cx(n ? tabs_module_default.contentPadding : ""),
|
|
6532
6016
|
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:
|
|
6017
|
+
}) : 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
6018
|
let p = useContext(DisabledContext), m = l !== void 0, h = n ? n.map((e, t) => ({
|
|
6535
6019
|
value: t,
|
|
6536
6020
|
url: e.props.url,
|
|
@@ -6539,11 +6023,11 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6539
6023
|
disabled: e.props.disabled || p,
|
|
6540
6024
|
badge: e.props.badge,
|
|
6541
6025
|
testId: e.props?.testId && `${e.props.testId}-${t}`
|
|
6542
|
-
})) : t || d, { simpleInputs:
|
|
6026
|
+
})) : t || d, { simpleInputs: _, options: v, selectedOptions: y } = m ? {
|
|
6543
6027
|
simpleInputs: !1,
|
|
6544
6028
|
options: h,
|
|
6545
6029
|
selectedOptions: void 0
|
|
6546
|
-
} : standardizeInputs(h, r), b = m || y == null ? void 0 :
|
|
6030
|
+
} : 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
6031
|
if (m) {
|
|
6548
6032
|
let e = n.key || n.label || null;
|
|
6549
6033
|
l(t, e);
|
|
@@ -6572,7 +6056,7 @@ const Label$1 = ({ label: e, url: t, hidden: n, disabled: r, active: i, onClick:
|
|
|
6572
6056
|
children: v.map(w)
|
|
6573
6057
|
}), /* @__PURE__ */ jsx(Content$1, {
|
|
6574
6058
|
activeTabIndex: S ?? 0,
|
|
6575
|
-
contentPadding:
|
|
6059
|
+
contentPadding: c,
|
|
6576
6060
|
children: n
|
|
6577
6061
|
})] }) : null;
|
|
6578
6062
|
}, TextLink = ({ children: e, href: t = void 0, target: n = void 0, testId: r, onClick: i, component: a = "a" }) => /* @__PURE__ */ jsx(a, {
|
|
@@ -6598,7 +6082,7 @@ var textarea_module_default = {
|
|
|
6598
6082
|
small: "_small_q0tl0_116",
|
|
6599
6083
|
monospace: "_monospace_q0tl0_155"
|
|
6600
6084
|
};
|
|
6601
|
-
const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows: i, disabled: a = !1, onChange: o = noop, onKeyPress:
|
|
6085
|
+
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
6086
|
let b = useContext(DisabledContext), x = /* @__PURE__ */ jsx("textarea", {
|
|
6603
6087
|
className: cx(textarea_module_default.textarea, f ? textarea_module_default.error : "", p ? textarea_module_default.warning : "", v ? textarea_module_default.monospace : ""),
|
|
6604
6088
|
name: e,
|
|
@@ -6608,11 +6092,11 @@ const TextArea = ({ name: e, value: t = "", placeholder: n = "", cols: r, rows:
|
|
|
6608
6092
|
rows: i,
|
|
6609
6093
|
onChange: o,
|
|
6610
6094
|
disabled: a || b,
|
|
6611
|
-
onKeyPress:
|
|
6095
|
+
onKeyPress: c,
|
|
6612
6096
|
onFocus: l,
|
|
6613
6097
|
onBlur: u,
|
|
6614
6098
|
tabIndex: d,
|
|
6615
|
-
style: { resize:
|
|
6099
|
+
style: { resize: _ },
|
|
6616
6100
|
"data-error": f || null,
|
|
6617
6101
|
"data-warning": p || null,
|
|
6618
6102
|
"data-testid": y
|
|
@@ -6692,9 +6176,9 @@ const Warning = ({ warning: e }) => /* @__PURE__ */ jsx("div", {
|
|
|
6692
6176
|
let ElementType = /* @__PURE__ */ function(e) {
|
|
6693
6177
|
return e.LINK = "Link", e.BUTTON = "Button", e.MENU = "Menu", e.COMPONENT = "Component", e;
|
|
6694
6178
|
}({});
|
|
6695
|
-
const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, testId: o, component:
|
|
6179
|
+
const Link = ({ label: e, url: t, icon: n, onClick: r, active: i, disabled: a, testId: o, component: c = "a" }) => {
|
|
6696
6180
|
let l = useContext(DisabledContext);
|
|
6697
|
-
return /* @__PURE__ */ jsxs(
|
|
6181
|
+
return /* @__PURE__ */ jsxs(c, {
|
|
6698
6182
|
className: cx(top_bar_module_default.link, i ? top_bar_module_default.active : ""),
|
|
6699
6183
|
href: t || "#",
|
|
6700
6184
|
to: t,
|
|
@@ -6839,16 +6323,16 @@ var tree_module_default = {
|
|
|
6839
6323
|
placeholder: "_placeholder_15yn1_29"
|
|
6840
6324
|
};
|
|
6841
6325
|
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,
|
|
6326
|
+
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
6327
|
e.stopPropagation(), i(l);
|
|
6844
6328
|
}, x = (e) => {
|
|
6845
|
-
e.preventDefault(), e.stopPropagation(), h || (
|
|
6329
|
+
e.preventDefault(), e.stopPropagation(), h || (_(!0), y((/* @__PURE__ */ new Date()).getTime()));
|
|
6846
6330
|
}, S = (e) => {
|
|
6847
|
-
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 &&
|
|
6331
|
+
e.preventDefault(), e.stopPropagation(), (/* @__PURE__ */ new Date()).getTime() - v > 20 && _(!1);
|
|
6848
6332
|
}, C = (e) => {
|
|
6849
6333
|
e.preventDefault(), e.stopPropagation(), a && !r && (/* @__PURE__ */ new Date()).getTime() - v > 200 && b(e);
|
|
6850
6334
|
}, w = (e) => {
|
|
6851
|
-
e.preventDefault(), e.stopPropagation(),
|
|
6335
|
+
e.preventDefault(), e.stopPropagation(), _(!1), y((/* @__PURE__ */ new Date()).getTime()), c?.(e);
|
|
6852
6336
|
};
|
|
6853
6337
|
return /* @__PURE__ */ jsx("div", {
|
|
6854
6338
|
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 +6560,18 @@ var unit_input_module_default = {
|
|
|
7076
6560
|
predefinedMenuActive: "_predefinedMenuActive_ye9w9_1",
|
|
7077
6561
|
inputWrapper: "_inputWrapper_ye9w9_4"
|
|
7078
6562
|
};
|
|
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:
|
|
6563
|
+
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
6564
|
name: "",
|
|
7081
6565
|
error: null
|
|
7082
6566
|
}), 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
6567
|
let L = useUnitContext(), R = useRunAfterUpdate();
|
|
7084
|
-
typeof
|
|
7085
|
-
let [z = "", B = ""] =
|
|
6568
|
+
typeof l == "number" && (l = `${l}`);
|
|
6569
|
+
let [z = "", B = ""] = l === void 0 ? [] : split(l), V = useMemo(() => getPreferredUnit(u, b || L?.unitTemplate), [
|
|
7086
6570
|
u,
|
|
7087
6571
|
b,
|
|
7088
6572
|
L?.unitTemplate
|
|
7089
|
-
]), H = isKnownUnit(
|
|
7090
|
-
value:
|
|
6573
|
+
]), H = isKnownUnit(l, V), U = f || V || B, W = usePrevious(U), { value: G } = safeConvertValue({
|
|
6574
|
+
value: l,
|
|
7091
6575
|
toUnit: U,
|
|
7092
6576
|
unitkey: u,
|
|
7093
6577
|
defaultFromUnit: B,
|
|
@@ -7098,17 +6582,17 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7098
6582
|
} : {
|
|
7099
6583
|
value: G,
|
|
7100
6584
|
unit: U
|
|
7101
|
-
}),
|
|
6585
|
+
}), Od = k || K?.value === void 0, [J, kd] = useState(w ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM), Ad = !!(O || n), Y = C && C.find((e) => {
|
|
7102
6586
|
if (!e?.value) return;
|
|
7103
6587
|
if (E) return E === e.valueKey;
|
|
7104
|
-
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n =
|
|
7105
|
-
value: String(
|
|
6588
|
+
let t = isValueWithUnit(e.value) ? getUnit(e.value) : "", { value: n = l } = convertUnit({
|
|
6589
|
+
value: String(l),
|
|
7106
6590
|
unitkey: u,
|
|
7107
6591
|
toUnit: t
|
|
7108
6592
|
});
|
|
7109
6593
|
return withUnit(n, t) === e.value;
|
|
7110
|
-
}),
|
|
7111
|
-
let e =
|
|
6594
|
+
}), jd = () => {
|
|
6595
|
+
let e = l ?? "", t = K.unit;
|
|
7112
6596
|
if (checkConversion({
|
|
7113
6597
|
value: e,
|
|
7114
6598
|
unitkey: u,
|
|
@@ -7121,9 +6605,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7121
6605
|
return null;
|
|
7122
6606
|
}
|
|
7123
6607
|
} else return getAltUnitsListByQuantity(u)?.map((e) => ["", e?.unit]);
|
|
7124
|
-
},
|
|
6608
|
+
}, Md = (t) => {
|
|
7125
6609
|
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
|
-
|
|
6610
|
+
h({ target: {
|
|
7127
6611
|
value: s,
|
|
7128
6612
|
name: n
|
|
7129
6613
|
} });
|
|
@@ -7134,7 +6618,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7134
6618
|
}), R(() => {
|
|
7135
6619
|
r.selectionStart = a, r.selectionEnd = a;
|
|
7136
6620
|
});
|
|
7137
|
-
},
|
|
6621
|
+
}, Nd = (e, t) => {
|
|
7138
6622
|
t === K.unit || isNaN(Number(e)) || (q({
|
|
7139
6623
|
value: e,
|
|
7140
6624
|
unit: t
|
|
@@ -7145,16 +6629,16 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7145
6629
|
let e, t = "";
|
|
7146
6630
|
if (W !== U) {
|
|
7147
6631
|
let { value: n } = safeConvertValue({
|
|
7148
|
-
value:
|
|
6632
|
+
value: l,
|
|
7149
6633
|
toUnit: U,
|
|
7150
6634
|
unitkey: u,
|
|
7151
6635
|
defaultFromUnit: B,
|
|
7152
6636
|
doNotConvertValue: p
|
|
7153
6637
|
});
|
|
7154
6638
|
e = n, t = U;
|
|
7155
|
-
} else if (withUnit(K.value, K.unit) !==
|
|
6639
|
+
} else if (withUnit(K.value, K.unit) !== l) {
|
|
7156
6640
|
let { value: n } = safeConvertValue({
|
|
7157
|
-
value:
|
|
6641
|
+
value: l,
|
|
7158
6642
|
toUnit: K.unit,
|
|
7159
6643
|
unitkey: u,
|
|
7160
6644
|
defaultFromUnit: B,
|
|
@@ -7165,15 +6649,15 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7165
6649
|
e !== void 0 && q({
|
|
7166
6650
|
value: e,
|
|
7167
6651
|
unit: t
|
|
7168
|
-
}), C &&
|
|
6652
|
+
}), C && kd(Y && T ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM);
|
|
7169
6653
|
}
|
|
7170
6654
|
}, [
|
|
7171
6655
|
U,
|
|
7172
|
-
|
|
6656
|
+
l,
|
|
7173
6657
|
i,
|
|
7174
6658
|
T
|
|
7175
6659
|
]);
|
|
7176
|
-
let
|
|
6660
|
+
let X = jd(), Z = label(K.unit) || K.unit || "", Pd = p || !X || X && X.length === 1, Q = getStringName(e), $, Fd = (t) => {
|
|
7177
6661
|
let r = t?.value ? t.value : "", [i = "", a = ""] = isValueWithUnit(r) ? split(r) : [r], o = withPrettyUnitLabel(r);
|
|
7178
6662
|
if (checkConversion({
|
|
7179
6663
|
value: r,
|
|
@@ -7193,7 +6677,7 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7193
6677
|
type: MenuType.OPTION,
|
|
7194
6678
|
inline: !0,
|
|
7195
6679
|
onClick: () => {
|
|
7196
|
-
validateNumber(i).valid && !n && (
|
|
6680
|
+
validateNumber(i).valid && !n && (kd(PredefinedOptionsMenuState.PREDEFINED), h({ target: {
|
|
7197
6681
|
value: r,
|
|
7198
6682
|
name: typeof e == "string" ? e : e?.fieldName || "",
|
|
7199
6683
|
predefinedSelected: !0,
|
|
@@ -7205,25 +6689,25 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7205
6689
|
height: "0"
|
|
7206
6690
|
})] }),
|
|
7207
6691
|
description: o,
|
|
7208
|
-
selected:
|
|
6692
|
+
selected: Y === t && J === PredefinedOptionsMenuState.PREDEFINED
|
|
7209
6693
|
};
|
|
7210
6694
|
};
|
|
7211
6695
|
if ($ = [{
|
|
7212
6696
|
type: MenuType.OPTION,
|
|
7213
6697
|
inline: !0,
|
|
7214
6698
|
onClick: () => {
|
|
7215
|
-
|
|
6699
|
+
J !== PredefinedOptionsMenuState.CUSTOM && !n && h({ target: {
|
|
7216
6700
|
value: withUnit(K.value, K.unit),
|
|
7217
6701
|
name: typeof e == "string" ? e : e?.fieldName || ""
|
|
7218
6702
|
} });
|
|
7219
6703
|
},
|
|
7220
6704
|
label: "Custom",
|
|
7221
|
-
selected:
|
|
6705
|
+
selected: J === PredefinedOptionsMenuState.CUSTOM
|
|
7222
6706
|
}], C?.length) {
|
|
7223
|
-
let e = C.map(
|
|
6707
|
+
let e = C.map(Fd);
|
|
7224
6708
|
$ = [...$, ...e];
|
|
7225
6709
|
}
|
|
7226
|
-
let
|
|
6710
|
+
let Id = (e) => {
|
|
7227
6711
|
if (isValueWithUnit(e)) {
|
|
7228
6712
|
let t = getUnit(e), { value: n } = safeConvertValue({
|
|
7229
6713
|
value: e,
|
|
@@ -7235,9 +6719,9 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7235
6719
|
return n;
|
|
7236
6720
|
}
|
|
7237
6721
|
return e;
|
|
7238
|
-
},
|
|
6722
|
+
}, Ld = !C && (!F || F === GroupOrder.FIRST) ? GroupOrder.FIRST : GroupOrder.MIDDLE, Rd = !F || F === GroupOrder.LAST ? GroupOrder.LAST : GroupOrder.MIDDLE;
|
|
7239
6723
|
return /* @__PURE__ */ jsx("div", {
|
|
7240
|
-
className:
|
|
6724
|
+
className: J === PredefinedOptionsMenuState.PREDEFINED ? cx(unit_input_module_default.predefinedMenuActive) : "",
|
|
7241
6725
|
children: /* @__PURE__ */ jsxs(InputGroup, {
|
|
7242
6726
|
small: o,
|
|
7243
6727
|
width: s,
|
|
@@ -7252,65 +6736,65 @@ const UnitInput = ({ name: e, placeholder: t = "", disabled: n = !1, disabledUni
|
|
|
7252
6736
|
trigger: "Component",
|
|
7253
6737
|
component: /* @__PURE__ */ jsx(Button, {
|
|
7254
6738
|
groupOrder: "first",
|
|
7255
|
-
active:
|
|
7256
|
-
icon:
|
|
6739
|
+
active: J === PredefinedOptionsMenuState.PREDEFINED,
|
|
6740
|
+
icon: J === PredefinedOptionsMenuState.PREDEFINED ? "link" : "unlink",
|
|
7257
6741
|
small: o
|
|
7258
6742
|
}),
|
|
7259
6743
|
small: o,
|
|
7260
6744
|
sections: $
|
|
7261
6745
|
},
|
|
7262
|
-
tooltip:
|
|
6746
|
+
tooltip: J === PredefinedOptionsMenuState.PREDEFINED ? Y?.label : ""
|
|
7263
6747
|
}),
|
|
7264
6748
|
/* @__PURE__ */ jsx("div", {
|
|
7265
6749
|
className: unit_input_module_default.inputWrapper,
|
|
7266
6750
|
children: /* @__PURE__ */ jsx(NumberInput, {
|
|
7267
|
-
name:
|
|
6751
|
+
name: Q,
|
|
7268
6752
|
testId: x,
|
|
7269
6753
|
disabled: n,
|
|
7270
|
-
placeholder:
|
|
6754
|
+
placeholder: Id(t),
|
|
7271
6755
|
value: K.value,
|
|
7272
|
-
onChange:
|
|
6756
|
+
onChange: Md,
|
|
7273
6757
|
onFocus: v,
|
|
7274
6758
|
error: i === null ? void 0 : i,
|
|
7275
6759
|
warning: S === null ? void 0 : S,
|
|
7276
6760
|
left: a,
|
|
7277
|
-
allowEmpty:
|
|
7278
|
-
validationCallback: (e, t) => D(
|
|
6761
|
+
allowEmpty: Od,
|
|
6762
|
+
validationCallback: (e, t) => D(Q, t),
|
|
7279
6763
|
enableCosmeticRounding: j,
|
|
7280
6764
|
enableDisplayRounding: M,
|
|
7281
6765
|
roundDisplayValue: N,
|
|
7282
|
-
groupOrder:
|
|
7283
|
-
disableInternalErrorValidationMessages:
|
|
6766
|
+
groupOrder: Ld,
|
|
6767
|
+
disableInternalErrorValidationMessages: Ad,
|
|
7284
6768
|
small: o,
|
|
7285
6769
|
selectOnFocus: P,
|
|
7286
6770
|
tooltip: I
|
|
7287
|
-
},
|
|
6771
|
+
}, Q)
|
|
7288
6772
|
}),
|
|
7289
|
-
|
|
7290
|
-
groupOrder:
|
|
6773
|
+
Z && (Pd || !H ? /* @__PURE__ */ jsx(InputGroupAddon, {
|
|
6774
|
+
groupOrder: Rd,
|
|
7291
6775
|
small: o,
|
|
7292
|
-
children:
|
|
6776
|
+
children: Z
|
|
7293
6777
|
}) : /* @__PURE__ */ jsx(Menu, {
|
|
7294
|
-
groupOrder:
|
|
6778
|
+
groupOrder: Rd,
|
|
7295
6779
|
maxHeight: 380,
|
|
7296
6780
|
disabled: r,
|
|
7297
6781
|
testId: x && `${x}-menu`,
|
|
7298
6782
|
tabIndex: -1,
|
|
7299
6783
|
menu: {
|
|
7300
|
-
label:
|
|
6784
|
+
label: Z,
|
|
7301
6785
|
trigger: "DropDownButton",
|
|
7302
6786
|
small: o,
|
|
7303
|
-
sections:
|
|
6787
|
+
sections: X.map(([e = "", t = "", n]) => {
|
|
7304
6788
|
let r = n || t || "", i = isValidNum(e) ? e : "";
|
|
7305
6789
|
return {
|
|
7306
6790
|
type: "Option",
|
|
7307
6791
|
label: j ? safeRoundNumbers(i) : i,
|
|
7308
6792
|
inline: !0,
|
|
7309
6793
|
onClick: (n) => {
|
|
7310
|
-
n.stopPropagation(),
|
|
6794
|
+
n.stopPropagation(), Nd(e, t);
|
|
7311
6795
|
},
|
|
7312
6796
|
description: r,
|
|
7313
|
-
selected: r ===
|
|
6797
|
+
selected: r === Z,
|
|
7314
6798
|
testId: `${x}-unit-${r}`
|
|
7315
6799
|
};
|
|
7316
6800
|
})
|
|
@@ -7443,61 +6927,60 @@ var normalizeUnits = (e) => e.reduce(({ preferredUnits: e, storageUnits: t }, {
|
|
|
7443
6927
|
})
|
|
7444
6928
|
})) : [];
|
|
7445
6929
|
};
|
|
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
|
-
...
|
|
6930
|
+
const UnitTable = ({ table: e, unitConfig: t, convertBackToStorageUnit: n = !0, enableCosmeticRounding: r = !0, enableDisplayRounding: i = !0, onListReorder: a, canListReorder: s, beforeRenderRow: l }) => {
|
|
6931
|
+
let { headers: u,...d } = e, { storageUnits: f, preferredUnits: p } = normalizeUnits(t), h = usePrevious(p), [g, _] = useState(p), v = ({ unitKey: e, value: n }) => {
|
|
6932
|
+
_({
|
|
6933
|
+
...g,
|
|
7450
6934
|
[e]: n
|
|
7451
6935
|
});
|
|
7452
6936
|
let r = t.find((t) => t.unitKey === e);
|
|
7453
6937
|
r && typeof r.onChange == "function" && r.onChange({
|
|
7454
|
-
oldUnit:
|
|
6938
|
+
oldUnit: g[e],
|
|
7455
6939
|
newUnit: n,
|
|
7456
6940
|
unitKey: e
|
|
7457
6941
|
});
|
|
7458
|
-
},
|
|
7459
|
-
let a =
|
|
6942
|
+
}, y = useCallback(({ row: e, rowIndex: t }) => {
|
|
6943
|
+
let a = l ? l({
|
|
7460
6944
|
row: e,
|
|
7461
6945
|
rowIndex: t
|
|
7462
6946
|
}) : e;
|
|
7463
6947
|
return convertRow({
|
|
7464
6948
|
row: a,
|
|
7465
6949
|
rowIndex: t,
|
|
7466
|
-
selectedUnits:
|
|
7467
|
-
storageUnits:
|
|
6950
|
+
selectedUnits: g,
|
|
6951
|
+
storageUnits: f,
|
|
7468
6952
|
convertBackToStorageUnit: n,
|
|
7469
6953
|
enableCosmeticRounding: r,
|
|
7470
6954
|
enableDisplayRounding: i
|
|
7471
6955
|
});
|
|
7472
6956
|
}, [
|
|
7473
|
-
|
|
7474
|
-
|
|
6957
|
+
g,
|
|
6958
|
+
f,
|
|
7475
6959
|
n,
|
|
7476
6960
|
r,
|
|
7477
6961
|
i
|
|
7478
6962
|
]);
|
|
7479
6963
|
return useEffect(() => {
|
|
7480
|
-
isEqual(
|
|
7481
|
-
let t =
|
|
7482
|
-
t !== n &&
|
|
6964
|
+
isEqual(p, h) || Object.keys(p).forEach((e) => {
|
|
6965
|
+
let t = h?.[e], n = p[e];
|
|
6966
|
+
t !== n && v({
|
|
7483
6967
|
unitKey: e,
|
|
7484
6968
|
value: n
|
|
7485
6969
|
});
|
|
7486
6970
|
});
|
|
7487
6971
|
}, [t]), /* @__PURE__ */ jsx(Table, {
|
|
7488
6972
|
table: {
|
|
7489
|
-
...
|
|
6973
|
+
...d,
|
|
7490
6974
|
headers: convertHeaderRows({
|
|
7491
6975
|
headers: e.headers,
|
|
7492
|
-
selectedUnits:
|
|
7493
|
-
storageUnits:
|
|
7494
|
-
onChangeUnit:
|
|
6976
|
+
selectedUnits: g,
|
|
6977
|
+
storageUnits: f,
|
|
6978
|
+
onChangeUnit: v
|
|
7495
6979
|
})
|
|
7496
6980
|
},
|
|
7497
6981
|
onListReorder: a,
|
|
7498
|
-
canListReorder:
|
|
7499
|
-
beforeRenderRow:
|
|
7500
|
-
enableMultiSelect: u
|
|
6982
|
+
canListReorder: s,
|
|
6983
|
+
beforeRenderRow: y
|
|
7501
6984
|
});
|
|
7502
6985
|
};
|
|
7503
6986
|
var setting_field_module_default = { settingField: "_settingField_1x02n_1" };
|
|
@@ -7570,7 +7053,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7570
7053
|
}, [n]);
|
|
7571
7054
|
let s = ({ target: { value: e } }) => {
|
|
7572
7055
|
a(e);
|
|
7573
|
-
}, { added:
|
|
7056
|
+
}, { added: l, removed: u } = renderLinesCount(e, t), d = l + u > 3500;
|
|
7574
7057
|
return /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(Card, {
|
|
7575
7058
|
bordered: !0,
|
|
7576
7059
|
heading: /* @__PURE__ */ jsxs(Flex, {
|
|
@@ -7579,7 +7062,7 @@ const DiffViewer = ({ oldJson: e, newJson: t, viewType: n = SPLIT_VIEW }) => {
|
|
|
7579
7062
|
success: !0,
|
|
7580
7063
|
children: [
|
|
7581
7064
|
"+",
|
|
7582
|
-
|
|
7065
|
+
l,
|
|
7583
7066
|
" "
|
|
7584
7067
|
]
|
|
7585
7068
|
}), /* @__PURE__ */ jsxs(Text, {
|
|
@@ -8988,25 +8471,27 @@ const createDiffJson = (e, t, n) => {
|
|
|
8988
8471
|
oldJson: a,
|
|
8989
8472
|
newJson: o
|
|
8990
8473
|
};
|
|
8991
|
-
}, ChangesOverview = ({ sectionNames: e,
|
|
8992
|
-
let
|
|
8474
|
+
}, ChangesOverview = ({ sectionNames: e, userName: t, diffs: n }) => {
|
|
8475
|
+
let r = {
|
|
8993
8476
|
headers: [{ cells: [
|
|
8477
|
+
{ value: "Modified By" },
|
|
8994
8478
|
{ value: "Type" },
|
|
8995
8479
|
{ value: "Before" },
|
|
8996
8480
|
{ value: "After" },
|
|
8997
8481
|
{ value: "" }
|
|
8998
8482
|
] }],
|
|
8999
|
-
rows:
|
|
9000
|
-
let { deltaFormat:
|
|
8483
|
+
rows: n.map((n) => {
|
|
8484
|
+
let { deltaFormat: r, path: i } = n, a = getSectionName(e, i), { type: o, before: s, after: c } = defaultMessage(r);
|
|
9001
8485
|
return { cells: [
|
|
9002
|
-
{ value:
|
|
8486
|
+
{ value: t },
|
|
9003
8487
|
{ value: o },
|
|
9004
8488
|
{ value: s },
|
|
9005
|
-
{ value:
|
|
8489
|
+
{ value: c },
|
|
8490
|
+
{ value: a }
|
|
9006
8491
|
] };
|
|
9007
8492
|
})
|
|
9008
8493
|
};
|
|
9009
|
-
return /* @__PURE__ */ jsx(Table, { table:
|
|
8494
|
+
return /* @__PURE__ */ jsx(Table, { table: r });
|
|
9010
8495
|
}, viewTypes = Object.freeze({
|
|
9011
8496
|
summary: {
|
|
9012
8497
|
label: "Summary",
|
|
@@ -9047,6 +8532,7 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
|
|
|
9047
8532
|
options: s,
|
|
9048
8533
|
value: c
|
|
9049
8534
|
}), c.value === "summary" ? /* @__PURE__ */ jsx(ChangesOverview, {
|
|
8535
|
+
userName: e.userName,
|
|
9050
8536
|
sectionNames: i,
|
|
9051
8537
|
diffs: transformDiffs(o)
|
|
9052
8538
|
}) : /* @__PURE__ */ jsx(DiffViewer, {
|
|
@@ -9063,7 +8549,7 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
|
|
|
9063
8549
|
} })
|
|
9064
8550
|
});
|
|
9065
8551
|
}, 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),
|
|
8552
|
+
let [u, d] = useState(!1), [f, p] = useState(null), h = [
|
|
9067
8553
|
{
|
|
9068
8554
|
label: "10 / page",
|
|
9069
8555
|
value: 10
|
|
@@ -9157,7 +8643,7 @@ const ComparisonViewModal = ({ auditLog: e, auditLogs: t, data: n, isOpen: r, se
|
|
|
9157
8643
|
let { value: t } = e.target;
|
|
9158
8644
|
c(Number(t));
|
|
9159
8645
|
},
|
|
9160
|
-
options:
|
|
8646
|
+
options: h,
|
|
9161
8647
|
value: a
|
|
9162
8648
|
},
|
|
9163
8649
|
onSelectPage: (e) => l(e),
|