@sustaina/shared-ui 1.44.0 → 1.46.0
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/index.d.mts +21 -4
- package/dist/index.d.ts +21 -4
- package/dist/index.js +445 -359
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +282 -197
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var React28 = require('react');
|
|
4
4
|
var reactRouter = require('@tanstack/react-router');
|
|
5
5
|
var zustand = require('zustand');
|
|
6
6
|
var clsx2 = require('clsx');
|
|
@@ -83,7 +83,7 @@ function _interopNamespace(e) {
|
|
|
83
83
|
return Object.freeze(n);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
var
|
|
86
|
+
var React28__namespace = /*#__PURE__*/_interopNamespace(React28);
|
|
87
87
|
var clsx2__default = /*#__PURE__*/_interopDefault(clsx2);
|
|
88
88
|
var AccordionPrimitive__namespace = /*#__PURE__*/_interopNamespace(AccordionPrimitive);
|
|
89
89
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
@@ -273,12 +273,12 @@ function useSafeBlocker({
|
|
|
273
273
|
withResolver = false
|
|
274
274
|
}) {
|
|
275
275
|
const router = reactRouter.useRouter({ warn: false });
|
|
276
|
-
const [resolver, setResolver] =
|
|
276
|
+
const [resolver, setResolver] = React28.useState({
|
|
277
277
|
status: "idle",
|
|
278
278
|
proceed: void 0,
|
|
279
279
|
reset: void 0
|
|
280
280
|
});
|
|
281
|
-
|
|
281
|
+
React28.useEffect(() => {
|
|
282
282
|
if (disabled || !router?.history?.block) {
|
|
283
283
|
return;
|
|
284
284
|
}
|
|
@@ -308,7 +308,7 @@ function useSafeBlocker({
|
|
|
308
308
|
}
|
|
309
309
|
});
|
|
310
310
|
}, [disabled, enableBeforeUnload, router, shouldBlockFn, withResolver]);
|
|
311
|
-
|
|
311
|
+
React28.useEffect(() => {
|
|
312
312
|
if (disabled || router?.history || typeof window === "undefined") {
|
|
313
313
|
return;
|
|
314
314
|
}
|
|
@@ -2285,6 +2285,55 @@ var SuiWarningIcon = ({ size = "1em", className, ...props }) => /* @__PURE__ */
|
|
|
2285
2285
|
}
|
|
2286
2286
|
);
|
|
2287
2287
|
var warning_default = SuiWarningIcon;
|
|
2288
|
+
var FactoryIcon = ({ size = "1em", className, ...props }) => {
|
|
2289
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2290
|
+
"svg",
|
|
2291
|
+
{
|
|
2292
|
+
viewBox: "0 0 11 9",
|
|
2293
|
+
fill: "none",
|
|
2294
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2295
|
+
width: size,
|
|
2296
|
+
height: size,
|
|
2297
|
+
className,
|
|
2298
|
+
"aria-hidden": true,
|
|
2299
|
+
...props,
|
|
2300
|
+
children: [
|
|
2301
|
+
/* @__PURE__ */ jsxRuntime.jsxs("g", { clipPath: "url(#clip0_4362_106915)", children: [
|
|
2302
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2303
|
+
"path",
|
|
2304
|
+
{
|
|
2305
|
+
d: "M4.09997 2.18649L7.16802 0.884405C7.28199 0.818433 7.53766 1.01288 7.53766 1.1344V2.16218L7.6424 2.14482C8.59115 1.8219 9.59843 1.19343 10.541 0.90871C10.7567 0.842738 10.8983 0.90871 10.9877 1.14482L11 8.51982C10.9815 8.72121 10.8675 8.84968 10.6889 8.87052L0.25259 8.86357C0.110893 8.81496 0.0277233 8.71079 0 8.54413V2.70385C0.00308037 2.58579 0.0462056 2.4851 0.129376 2.41565L3.69028 0.887877C3.87202 0.821905 4.09997 1.01982 4.09997 1.22815V2.18302V2.18649ZM1.45393 4.51635C1.28143 4.5476 1.20134 4.70732 1.18286 4.88788C1.15514 5.17607 1.15822 5.73163 1.17978 6.02329C1.19518 6.24899 1.27527 6.41913 1.4909 6.4469C1.74041 6.47815 2.35956 6.47815 2.60907 6.4469C2.75693 6.42954 2.88015 6.31496 2.89863 6.14482C2.92635 5.87399 2.92635 5.08232 2.89863 4.81149C2.88015 4.64135 2.75385 4.52677 2.60907 4.5094C2.38421 4.48163 1.66648 4.47468 1.45393 4.51635ZM6.26239 4.61357C6.22235 4.56843 6.1207 4.51635 6.06525 4.5094C5.82498 4.47468 5.1935 4.48163 4.94707 4.5094C4.77457 4.53024 4.65136 4.66565 4.63596 4.8601C4.61131 5.13788 4.60823 5.84968 4.63596 6.12052C4.65136 6.25593 4.74377 6.38788 4.85774 6.42954C4.97172 6.47121 5.91123 6.47121 6.06525 6.4469C6.21003 6.42607 6.33632 6.28718 6.3548 6.12052C6.38561 5.84968 6.37945 5.13788 6.3548 4.8601C6.34864 4.78024 6.31168 4.6726 6.25931 4.61357H6.26239Z",
|
|
2306
|
+
fill: "currentColor"
|
|
2307
|
+
}
|
|
2308
|
+
),
|
|
2309
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2310
|
+
"path",
|
|
2311
|
+
{
|
|
2312
|
+
d: "M1.45516 4.5178C1.6677 4.47613 2.38543 4.48307 2.6103 4.51085C2.75507 4.52821 2.88137 4.6428 2.89985 4.81293C2.92757 5.08377 2.92757 5.87543 2.89985 6.14627C2.88137 6.31641 2.75507 6.43099 2.6103 6.44835C2.36079 6.4796 1.74163 6.4796 1.49212 6.44835C1.2765 6.42057 1.19641 6.25043 1.181 6.02474C1.15944 5.73307 1.15636 5.17405 1.18408 4.88932C1.20257 4.70877 1.28266 4.54905 1.45516 4.5178Z",
|
|
2313
|
+
fill: "white"
|
|
2314
|
+
}
|
|
2315
|
+
),
|
|
2316
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2317
|
+
"path",
|
|
2318
|
+
{
|
|
2319
|
+
d: "M8.35268 4.51606C8.54982 4.47786 9.32299 4.48134 9.5263 4.51259C9.7296 4.54384 9.80353 4.72092 9.81893 4.93273C9.8405 5.22786 9.8405 5.75564 9.81893 6.04731C9.80045 6.26259 9.71112 6.42231 9.50782 6.44661C9.25831 6.47786 8.63915 6.47786 8.38964 6.44661C8.24486 6.42925 8.11857 6.31467 8.10009 6.14453C8.07236 5.898 8.06928 5.02648 8.10009 4.79036C8.11857 4.65842 8.23562 4.53689 8.3496 4.51606H8.35268Z",
|
|
2320
|
+
fill: "white"
|
|
2321
|
+
}
|
|
2322
|
+
),
|
|
2323
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2324
|
+
"path",
|
|
2325
|
+
{
|
|
2326
|
+
d: "M6.26921 4.6146C6.3185 4.67016 6.35546 4.78127 6.3647 4.86113C6.38935 5.13891 6.39243 5.85071 6.3647 6.12155C6.34622 6.28821 6.21993 6.4271 6.07515 6.44794C5.91805 6.46877 4.98162 6.47224 4.86764 6.43057C4.75367 6.38891 4.66126 6.25696 4.64586 6.12155C4.61505 5.85071 4.62121 5.13891 4.64586 4.86113C4.66434 4.66669 4.78447 4.5278 4.95697 4.51044C5.2034 4.48266 5.83488 4.47919 6.07515 4.51044C6.13059 4.51738 6.23225 4.57294 6.27229 4.6146H6.26921Z",
|
|
2327
|
+
fill: "white"
|
|
2328
|
+
}
|
|
2329
|
+
)
|
|
2330
|
+
] }),
|
|
2331
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsx("clipPath", { id: "clip0_4362_106915", children: /* @__PURE__ */ jsxRuntime.jsx("rect", { width: "11", height: "8", fill: "white", transform: "translate(0 0.871094)" }) }) })
|
|
2332
|
+
]
|
|
2333
|
+
}
|
|
2334
|
+
);
|
|
2335
|
+
};
|
|
2336
|
+
var factory_default = FactoryIcon;
|
|
2288
2337
|
var AuditFooter = ({
|
|
2289
2338
|
createdAt,
|
|
2290
2339
|
createdBy,
|
|
@@ -2391,7 +2440,7 @@ function AccordionContent({
|
|
|
2391
2440
|
);
|
|
2392
2441
|
}
|
|
2393
2442
|
var ExpandCollapse = ({ title, children, portalId }) => {
|
|
2394
|
-
const [isOpen, setIsOpen] =
|
|
2443
|
+
const [isOpen, setIsOpen] = React28.useState(false);
|
|
2395
2444
|
const Panel = /* @__PURE__ */ jsxRuntime.jsx(
|
|
2396
2445
|
"div",
|
|
2397
2446
|
{
|
|
@@ -2501,31 +2550,31 @@ function makeNewRow(field) {
|
|
|
2501
2550
|
};
|
|
2502
2551
|
}
|
|
2503
2552
|
function useAdvanceSearch({ fields, limitRows }) {
|
|
2504
|
-
const [rows, setRows] =
|
|
2505
|
-
const updateRows =
|
|
2553
|
+
const [rows, setRows] = React28.useState([makeNewRow(fields[0])]);
|
|
2554
|
+
const updateRows = React28.useCallback((next) => {
|
|
2506
2555
|
setRows(next);
|
|
2507
2556
|
}, []);
|
|
2508
|
-
const operatorsForField =
|
|
2557
|
+
const operatorsForField = React28.useCallback(
|
|
2509
2558
|
(fieldName) => {
|
|
2510
2559
|
const t = getFieldType(fields, fieldName);
|
|
2511
2560
|
return OPERATOR_MAP[t];
|
|
2512
2561
|
},
|
|
2513
2562
|
[fields]
|
|
2514
2563
|
);
|
|
2515
|
-
const addRow =
|
|
2564
|
+
const addRow = React28.useCallback(() => {
|
|
2516
2565
|
if (limitRows && rows.length >= limitRows) return;
|
|
2517
2566
|
const lastRow = rows[rows.length - 1];
|
|
2518
2567
|
const lastField = fields.find((f) => f.name === lastRow?.fieldName) ?? fields[0];
|
|
2519
2568
|
updateRows([...rows, makeNewRow(lastField)]);
|
|
2520
2569
|
}, [rows, fields, updateRows, limitRows]);
|
|
2521
|
-
const removeRow =
|
|
2570
|
+
const removeRow = React28.useCallback(
|
|
2522
2571
|
(id) => {
|
|
2523
2572
|
if (rows.length === 1) return;
|
|
2524
2573
|
updateRows(rows.filter((r) => r.id !== id));
|
|
2525
2574
|
},
|
|
2526
2575
|
[rows, updateRows]
|
|
2527
2576
|
);
|
|
2528
|
-
const clearRow =
|
|
2577
|
+
const clearRow = React28.useCallback(
|
|
2529
2578
|
(id) => {
|
|
2530
2579
|
updateRows(
|
|
2531
2580
|
rows.map((r) => {
|
|
@@ -2558,10 +2607,10 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2558
2607
|
},
|
|
2559
2608
|
[rows, fields, updateRows]
|
|
2560
2609
|
);
|
|
2561
|
-
const clearAllRow =
|
|
2610
|
+
const clearAllRow = React28.useCallback(() => {
|
|
2562
2611
|
updateRows([makeNewRow(fields[0])]);
|
|
2563
2612
|
}, [fields, updateRows]);
|
|
2564
|
-
const changeField =
|
|
2613
|
+
const changeField = React28.useCallback(
|
|
2565
2614
|
(id, fieldName) => {
|
|
2566
2615
|
updateRows(
|
|
2567
2616
|
rows.map((r) => {
|
|
@@ -2573,7 +2622,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2573
2622
|
},
|
|
2574
2623
|
[rows, fields, updateRows]
|
|
2575
2624
|
);
|
|
2576
|
-
const changeOperator =
|
|
2625
|
+
const changeOperator = React28.useCallback(
|
|
2577
2626
|
(id, operator) => {
|
|
2578
2627
|
updateRows(
|
|
2579
2628
|
rows.map((r) => {
|
|
@@ -2607,7 +2656,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2607
2656
|
},
|
|
2608
2657
|
[rows, updateRows]
|
|
2609
2658
|
);
|
|
2610
|
-
const changeValue =
|
|
2659
|
+
const changeValue = React28.useCallback(
|
|
2611
2660
|
(id, which, val) => {
|
|
2612
2661
|
updateRows(
|
|
2613
2662
|
rows.map((r) => {
|
|
@@ -2619,7 +2668,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2619
2668
|
},
|
|
2620
2669
|
[rows, updateRows]
|
|
2621
2670
|
);
|
|
2622
|
-
const fieldOptions =
|
|
2671
|
+
const fieldOptions = React28.useMemo(
|
|
2623
2672
|
() => fields.map((f) => ({
|
|
2624
2673
|
value: f.name,
|
|
2625
2674
|
label: f.label ?? f.name
|
|
@@ -2814,7 +2863,7 @@ var OPERATOR_LABEL = {
|
|
|
2814
2863
|
containsAll: "Contains all of"
|
|
2815
2864
|
};
|
|
2816
2865
|
var OperatorSelect = ({ row, operators, onChangeOperator, error }) => {
|
|
2817
|
-
|
|
2866
|
+
React28__namespace.default.useEffect(() => {
|
|
2818
2867
|
if (!operators.length) return;
|
|
2819
2868
|
if (!operators.includes(row.operator)) {
|
|
2820
2869
|
onChangeOperator(operators[0]);
|
|
@@ -2850,15 +2899,15 @@ function Label2({ className, ...props }) {
|
|
|
2850
2899
|
);
|
|
2851
2900
|
}
|
|
2852
2901
|
var Form = reactHookForm.FormProvider;
|
|
2853
|
-
var FormFieldContext =
|
|
2902
|
+
var FormFieldContext = React28__namespace.createContext({});
|
|
2854
2903
|
var FormField = ({
|
|
2855
2904
|
...props
|
|
2856
2905
|
}) => {
|
|
2857
2906
|
return /* @__PURE__ */ jsxRuntime.jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsxRuntime.jsx(reactHookForm.Controller, { ...props }) });
|
|
2858
2907
|
};
|
|
2859
2908
|
var useFormField = () => {
|
|
2860
|
-
const fieldContext =
|
|
2861
|
-
const itemContext =
|
|
2909
|
+
const fieldContext = React28__namespace.useContext(FormFieldContext);
|
|
2910
|
+
const itemContext = React28__namespace.useContext(FormItemContext);
|
|
2862
2911
|
const { getFieldState } = reactHookForm.useFormContext();
|
|
2863
2912
|
const formState = reactHookForm.useFormState({ name: fieldContext.name });
|
|
2864
2913
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -2875,9 +2924,9 @@ var useFormField = () => {
|
|
|
2875
2924
|
...fieldState
|
|
2876
2925
|
};
|
|
2877
2926
|
};
|
|
2878
|
-
var FormItemContext =
|
|
2927
|
+
var FormItemContext = React28__namespace.createContext({});
|
|
2879
2928
|
function FormItem({ className, ...props }) {
|
|
2880
|
-
const id =
|
|
2929
|
+
const id = React28__namespace.useId();
|
|
2881
2930
|
return /* @__PURE__ */ jsxRuntime.jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
2882
2931
|
}
|
|
2883
2932
|
function FormLabel({ className, ...props }) {
|
|
@@ -2981,7 +3030,7 @@ var Spinner = ({ className, variant, size = "default", ...props }) => /* @__PURE
|
|
|
2981
3030
|
]
|
|
2982
3031
|
}
|
|
2983
3032
|
);
|
|
2984
|
-
var InputPrimitive =
|
|
3033
|
+
var InputPrimitive = React28__namespace.forwardRef(
|
|
2985
3034
|
({ className, type = "text", ...props }, ref) => {
|
|
2986
3035
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2987
3036
|
"input",
|
|
@@ -3020,7 +3069,7 @@ var inputVariants = classVarianceAuthority.cva("", {
|
|
|
3020
3069
|
appearance: "filled"
|
|
3021
3070
|
}
|
|
3022
3071
|
});
|
|
3023
|
-
var Input =
|
|
3072
|
+
var Input = React28__namespace.forwardRef(
|
|
3024
3073
|
({
|
|
3025
3074
|
className,
|
|
3026
3075
|
wrapperClassName,
|
|
@@ -3053,8 +3102,8 @@ var Input = React27__namespace.forwardRef(
|
|
|
3053
3102
|
onChange: onChangeProp
|
|
3054
3103
|
} = rest;
|
|
3055
3104
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
3056
|
-
const messageId =
|
|
3057
|
-
const handleChange =
|
|
3105
|
+
const messageId = React28__namespace.useId();
|
|
3106
|
+
const handleChange = React28__namespace.useCallback(
|
|
3058
3107
|
(event) => {
|
|
3059
3108
|
onChangeProp?.(event);
|
|
3060
3109
|
onValueChange?.(event.target.value);
|
|
@@ -3442,20 +3491,20 @@ function DatePicker({
|
|
|
3442
3491
|
className,
|
|
3443
3492
|
...props
|
|
3444
3493
|
}) {
|
|
3445
|
-
const today =
|
|
3446
|
-
const [displayed, setDisplayed] =
|
|
3494
|
+
const today = React28__namespace.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
3495
|
+
const [displayed, setDisplayed] = React28__namespace.useState(
|
|
3447
3496
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
3448
3497
|
);
|
|
3449
3498
|
minDate = clampToDay(minDate);
|
|
3450
3499
|
maxDate = clampToDay(maxDate);
|
|
3451
|
-
const disabledSet =
|
|
3500
|
+
const disabledSet = React28__namespace.useMemo(() => {
|
|
3452
3501
|
const s = /* @__PURE__ */ new Set();
|
|
3453
3502
|
disabledDates?.forEach((d) => s.add(startOfDay(d).toISOString()));
|
|
3454
3503
|
return s;
|
|
3455
3504
|
}, [disabledDates]);
|
|
3456
3505
|
const displayYear = displayed.getFullYear();
|
|
3457
3506
|
const displayMonth = displayed.getMonth();
|
|
3458
|
-
const weekdays =
|
|
3507
|
+
const weekdays = React28__namespace.useMemo(() => {
|
|
3459
3508
|
const labels = [];
|
|
3460
3509
|
for (let i = 0; i < 7; i++) {
|
|
3461
3510
|
const idx = i;
|
|
@@ -3464,7 +3513,7 @@ function DatePicker({
|
|
|
3464
3513
|
}
|
|
3465
3514
|
return labels;
|
|
3466
3515
|
}, [callbacks]);
|
|
3467
|
-
const grid =
|
|
3516
|
+
const grid = React28__namespace.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
3468
3517
|
const isDateDisabled = (date) => {
|
|
3469
3518
|
const d = startOfDay(date);
|
|
3470
3519
|
if (minDate && d < minDate) return true;
|
|
@@ -3474,7 +3523,7 @@ function DatePicker({
|
|
|
3474
3523
|
};
|
|
3475
3524
|
const minYear = minDate?.getFullYear();
|
|
3476
3525
|
const maxYear = maxDate?.getFullYear();
|
|
3477
|
-
const getMonthLabel =
|
|
3526
|
+
const getMonthLabel = React28__namespace.useCallback(
|
|
3478
3527
|
(year, monthIndex) => {
|
|
3479
3528
|
const label = callbacks?.monthLabel?.(year, monthIndex);
|
|
3480
3529
|
if (label === null || label === void 0) {
|
|
@@ -3484,7 +3533,7 @@ function DatePicker({
|
|
|
3484
3533
|
},
|
|
3485
3534
|
[callbacks]
|
|
3486
3535
|
);
|
|
3487
|
-
const getYearLabel =
|
|
3536
|
+
const getYearLabel = React28__namespace.useCallback(
|
|
3488
3537
|
(year) => {
|
|
3489
3538
|
const label = callbacks?.yearLabel?.(year);
|
|
3490
3539
|
if (label === null || label === void 0) return String(year);
|
|
@@ -3492,7 +3541,7 @@ function DatePicker({
|
|
|
3492
3541
|
},
|
|
3493
3542
|
[callbacks]
|
|
3494
3543
|
);
|
|
3495
|
-
const clampMonthToBounds =
|
|
3544
|
+
const clampMonthToBounds = React28__namespace.useCallback(
|
|
3496
3545
|
(year, monthIndex) => {
|
|
3497
3546
|
let output = monthIndex;
|
|
3498
3547
|
if (typeof minYear === "number" && year === minYear && minDate) {
|
|
@@ -3507,7 +3556,7 @@ function DatePicker({
|
|
|
3507
3556
|
},
|
|
3508
3557
|
[maxDate, minDate, maxYear, minYear]
|
|
3509
3558
|
);
|
|
3510
|
-
const yearOptions =
|
|
3559
|
+
const yearOptions = React28__namespace.useMemo(() => {
|
|
3511
3560
|
const fallbackWindow = 50;
|
|
3512
3561
|
const start = typeof minYear === "number" ? minYear : displayYear - fallbackWindow;
|
|
3513
3562
|
const end = typeof maxYear === "number" ? maxYear : displayYear + fallbackWindow;
|
|
@@ -3528,7 +3577,7 @@ function DatePicker({
|
|
|
3528
3577
|
}
|
|
3529
3578
|
return years;
|
|
3530
3579
|
}, [displayYear, maxYear, minYear, selectedDate]);
|
|
3531
|
-
const monthOptions =
|
|
3580
|
+
const monthOptions = React28__namespace.useMemo(() => {
|
|
3532
3581
|
const months = Array.from({ length: 12 }, (_, monthIndex) => {
|
|
3533
3582
|
const disabled = typeof minYear === "number" && displayYear === minYear && minDate && monthIndex < minDate.getMonth() || typeof maxYear === "number" && displayYear === maxYear && maxDate && monthIndex > maxDate.getMonth();
|
|
3534
3583
|
return {
|
|
@@ -3547,7 +3596,7 @@ function DatePicker({
|
|
|
3547
3596
|
}
|
|
3548
3597
|
return months.sort((a, b) => a.value - b.value).filter((option, index, arr) => index === 0 || option.value !== arr[index - 1].value);
|
|
3549
3598
|
}, [displayMonth, displayYear, getMonthLabel, maxDate, maxYear, minDate, minYear]);
|
|
3550
|
-
const handleMonthSelect =
|
|
3599
|
+
const handleMonthSelect = React28__namespace.useCallback((nextValue) => {
|
|
3551
3600
|
const nextMonth = Number.parseInt(nextValue, 10);
|
|
3552
3601
|
if (Number.isNaN(nextMonth)) return;
|
|
3553
3602
|
setDisplayed((prev) => {
|
|
@@ -3557,7 +3606,7 @@ function DatePicker({
|
|
|
3557
3606
|
return next;
|
|
3558
3607
|
});
|
|
3559
3608
|
}, []);
|
|
3560
|
-
const handleYearSelect =
|
|
3609
|
+
const handleYearSelect = React28__namespace.useCallback(
|
|
3561
3610
|
(nextValue) => {
|
|
3562
3611
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
3563
3612
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -3705,14 +3754,14 @@ var DatePicker2 = ({
|
|
|
3705
3754
|
ariaLabel,
|
|
3706
3755
|
...calendarProps
|
|
3707
3756
|
}) => {
|
|
3708
|
-
const [open, setOpen] =
|
|
3709
|
-
const parser =
|
|
3710
|
-
const outputFormatter =
|
|
3711
|
-
const labelFormatter =
|
|
3757
|
+
const [open, setOpen] = React28__namespace.default.useState(false);
|
|
3758
|
+
const parser = React28__namespace.default.useMemo(() => valueParser ?? defaultValueParser, [valueParser]);
|
|
3759
|
+
const outputFormatter = React28__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter, [valueFormatter]);
|
|
3760
|
+
const labelFormatter = React28__namespace.default.useMemo(
|
|
3712
3761
|
() => displayFormatter ?? defaultDisplayFormatter,
|
|
3713
3762
|
[displayFormatter]
|
|
3714
3763
|
);
|
|
3715
|
-
const parsedValue =
|
|
3764
|
+
const parsedValue = React28__namespace.default.useMemo(() => {
|
|
3716
3765
|
if (value === null || value === void 0) return void 0;
|
|
3717
3766
|
if (value instanceof Date) return value;
|
|
3718
3767
|
const parsed = parser(value);
|
|
@@ -3721,26 +3770,26 @@ var DatePicker2 = ({
|
|
|
3721
3770
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
3722
3771
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change date, current selection ${labelFormatter(parsedValue)}` : "Open date picker");
|
|
3723
3772
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
3724
|
-
const handleClose =
|
|
3725
|
-
const emitChange =
|
|
3773
|
+
const handleClose = React28__namespace.default.useCallback(() => setOpen(false), []);
|
|
3774
|
+
const emitChange = React28__namespace.default.useCallback(
|
|
3726
3775
|
(next) => {
|
|
3727
3776
|
onChange?.(next);
|
|
3728
3777
|
onValueChange?.(next ? outputFormatter(next) : void 0);
|
|
3729
3778
|
},
|
|
3730
3779
|
[onChange, onValueChange, outputFormatter]
|
|
3731
3780
|
);
|
|
3732
|
-
const handleSelect =
|
|
3781
|
+
const handleSelect = React28__namespace.default.useCallback(
|
|
3733
3782
|
(next) => {
|
|
3734
3783
|
emitChange(next);
|
|
3735
3784
|
if (closeOnSelect && next) handleClose();
|
|
3736
3785
|
},
|
|
3737
3786
|
[closeOnSelect, emitChange, handleClose]
|
|
3738
3787
|
);
|
|
3739
|
-
const handleClear =
|
|
3788
|
+
const handleClear = React28__namespace.default.useCallback(() => {
|
|
3740
3789
|
emitChange(void 0);
|
|
3741
3790
|
handleClose();
|
|
3742
3791
|
}, [emitChange, handleClose]);
|
|
3743
|
-
const handleOpenChange =
|
|
3792
|
+
const handleOpenChange = React28__namespace.default.useCallback(
|
|
3744
3793
|
(nextOpen) => {
|
|
3745
3794
|
if (disabled && nextOpen) return;
|
|
3746
3795
|
setOpen(nextOpen);
|
|
@@ -3804,6 +3853,7 @@ var DatePicker2 = ({
|
|
|
3804
3853
|
|
|
3805
3854
|
// src/components/advanceSearch/components/constants/index.ts
|
|
3806
3855
|
var fallbackShortDateFormat = "DD/MM/YYYY";
|
|
3856
|
+
var UUIDregex = /^[0-9a-f]{8}-?[0-9a-f]{4}-?4[0-9a-f]{3}-?[89ab][0-9a-f]{3}-?[0-9a-f]{12}$/i;
|
|
3807
3857
|
var ConditionDateInput = ({
|
|
3808
3858
|
row,
|
|
3809
3859
|
control,
|
|
@@ -3930,15 +3980,15 @@ function MonthCal({
|
|
|
3930
3980
|
onYearBackward,
|
|
3931
3981
|
onYearForward
|
|
3932
3982
|
}) {
|
|
3933
|
-
const today =
|
|
3983
|
+
const today = React28__namespace.useMemo(() => {
|
|
3934
3984
|
const now = /* @__PURE__ */ new Date();
|
|
3935
3985
|
now.setDate(1);
|
|
3936
3986
|
now.setHours(0, 0, 0, 0);
|
|
3937
3987
|
return now;
|
|
3938
3988
|
}, []);
|
|
3939
|
-
const selectedMonthDate =
|
|
3940
|
-
const min =
|
|
3941
|
-
const max =
|
|
3989
|
+
const selectedMonthDate = React28__namespace.useMemo(() => normalizeMonth(selectedDate), [selectedDate]);
|
|
3990
|
+
const min = React28__namespace.useMemo(() => normalizeMonth(minDate), [minDate]);
|
|
3991
|
+
const max = React28__namespace.useMemo(() => normalizeMonth(maxDate), [maxDate]);
|
|
3942
3992
|
let effectiveMin = min;
|
|
3943
3993
|
if (min && max && min > max) {
|
|
3944
3994
|
effectiveMin = max;
|
|
@@ -3947,10 +3997,10 @@ function MonthCal({
|
|
|
3947
3997
|
const minMonth = effectiveMin?.getMonth();
|
|
3948
3998
|
const maxYear = max?.getFullYear();
|
|
3949
3999
|
const maxMonth = max?.getMonth();
|
|
3950
|
-
const [menuYear, setMenuYear] =
|
|
4000
|
+
const [menuYear, setMenuYear] = React28__namespace.useState(
|
|
3951
4001
|
() => selectedMonthDate?.getFullYear() ?? today.getFullYear()
|
|
3952
4002
|
);
|
|
3953
|
-
|
|
4003
|
+
React28__namespace.useEffect(() => {
|
|
3954
4004
|
if (selectedMonthDate) {
|
|
3955
4005
|
const year = selectedMonthDate.getFullYear();
|
|
3956
4006
|
if (year !== menuYear) {
|
|
@@ -3958,7 +4008,7 @@ function MonthCal({
|
|
|
3958
4008
|
}
|
|
3959
4009
|
}
|
|
3960
4010
|
}, [selectedMonthDate, menuYear]);
|
|
3961
|
-
|
|
4011
|
+
React28__namespace.useEffect(() => {
|
|
3962
4012
|
if (typeof minYear === "number" && menuYear < minYear) {
|
|
3963
4013
|
setMenuYear(minYear);
|
|
3964
4014
|
return;
|
|
@@ -3969,7 +4019,7 @@ function MonthCal({
|
|
|
3969
4019
|
}, [minYear, maxYear, menuYear]);
|
|
3970
4020
|
const disablePrevYear = typeof minYear === "number" ? menuYear <= minYear : false;
|
|
3971
4021
|
const disableNextYear = typeof maxYear === "number" ? menuYear >= maxYear : false;
|
|
3972
|
-
const yearOptions =
|
|
4022
|
+
const yearOptions = React28__namespace.useMemo(() => {
|
|
3973
4023
|
const fallbackWindow = 50;
|
|
3974
4024
|
const start = typeof minYear === "number" ? minYear : menuYear - fallbackWindow;
|
|
3975
4025
|
const end = typeof maxYear === "number" ? maxYear : menuYear + fallbackWindow;
|
|
@@ -3983,7 +4033,7 @@ function MonthCal({
|
|
|
3983
4033
|
}
|
|
3984
4034
|
return years;
|
|
3985
4035
|
}, [maxYear, menuYear, minYear]);
|
|
3986
|
-
const formatYearLabel =
|
|
4036
|
+
const formatYearLabel = React28__namespace.useCallback(
|
|
3987
4037
|
(year) => {
|
|
3988
4038
|
const raw = callbacks?.yearLabel?.(year);
|
|
3989
4039
|
if (raw === null || raw === void 0) return String(year);
|
|
@@ -3991,7 +4041,7 @@ function MonthCal({
|
|
|
3991
4041
|
},
|
|
3992
4042
|
[callbacks]
|
|
3993
4043
|
);
|
|
3994
|
-
const handleYearSelect =
|
|
4044
|
+
const handleYearSelect = React28__namespace.useCallback(
|
|
3995
4045
|
(nextValue) => {
|
|
3996
4046
|
const nextYear = Number.parseInt(nextValue, 10);
|
|
3997
4047
|
if (Number.isNaN(nextYear)) return;
|
|
@@ -4001,7 +4051,7 @@ function MonthCal({
|
|
|
4001
4051
|
},
|
|
4002
4052
|
[maxYear, minYear]
|
|
4003
4053
|
);
|
|
4004
|
-
const disabledPairs =
|
|
4054
|
+
const disabledPairs = React28__namespace.useMemo(() => {
|
|
4005
4055
|
if (!disabledDates?.length) return [];
|
|
4006
4056
|
const pairs = [];
|
|
4007
4057
|
disabledDates.forEach((date) => {
|
|
@@ -4146,14 +4196,14 @@ var MonthPicker2 = ({
|
|
|
4146
4196
|
ariaLabel,
|
|
4147
4197
|
...calendarProps
|
|
4148
4198
|
}) => {
|
|
4149
|
-
const [open, setOpen] =
|
|
4150
|
-
const parser =
|
|
4151
|
-
const outputFormatter =
|
|
4152
|
-
const labelFormatter =
|
|
4199
|
+
const [open, setOpen] = React28__namespace.default.useState(false);
|
|
4200
|
+
const parser = React28__namespace.default.useMemo(() => valueParser ?? defaultValueParser2, [valueParser]);
|
|
4201
|
+
const outputFormatter = React28__namespace.default.useMemo(() => valueFormatter ?? defaultValueFormatter2, [valueFormatter]);
|
|
4202
|
+
const labelFormatter = React28__namespace.default.useMemo(
|
|
4153
4203
|
() => displayFormatter ?? defaultDisplayFormatter2,
|
|
4154
4204
|
[displayFormatter]
|
|
4155
4205
|
);
|
|
4156
|
-
const parsedValue =
|
|
4206
|
+
const parsedValue = React28__namespace.default.useMemo(() => {
|
|
4157
4207
|
if (value === null || value === void 0) return void 0;
|
|
4158
4208
|
if (value instanceof Date) return normalizeMonth2(value);
|
|
4159
4209
|
if (typeof value === "string") {
|
|
@@ -4165,8 +4215,8 @@ var MonthPicker2 = ({
|
|
|
4165
4215
|
const buttonLabel = parsedValue ? labelFormatter(parsedValue) : placeholder2;
|
|
4166
4216
|
const buttonAriaLabel = ariaLabel ?? (parsedValue ? `Change month, current selection ${labelFormatter(parsedValue)}` : "Open month picker");
|
|
4167
4217
|
const shouldShowClear = allowClear && !disabled && !!parsedValue;
|
|
4168
|
-
const handleClose =
|
|
4169
|
-
const emitChange =
|
|
4218
|
+
const handleClose = React28__namespace.default.useCallback(() => setOpen(false), []);
|
|
4219
|
+
const emitChange = React28__namespace.default.useCallback(
|
|
4170
4220
|
(next) => {
|
|
4171
4221
|
const normalized = next ? normalizeMonth2(next) : void 0;
|
|
4172
4222
|
onChange?.(normalized);
|
|
@@ -4174,18 +4224,18 @@ var MonthPicker2 = ({
|
|
|
4174
4224
|
},
|
|
4175
4225
|
[onChange, onValueChange, outputFormatter]
|
|
4176
4226
|
);
|
|
4177
|
-
const handleSelect =
|
|
4227
|
+
const handleSelect = React28__namespace.default.useCallback(
|
|
4178
4228
|
(next) => {
|
|
4179
4229
|
emitChange(next);
|
|
4180
4230
|
if (closeOnSelect && next) handleClose();
|
|
4181
4231
|
},
|
|
4182
4232
|
[closeOnSelect, emitChange, handleClose]
|
|
4183
4233
|
);
|
|
4184
|
-
const handleClear =
|
|
4234
|
+
const handleClear = React28__namespace.default.useCallback(() => {
|
|
4185
4235
|
emitChange(void 0);
|
|
4186
4236
|
handleClose();
|
|
4187
4237
|
}, [emitChange, handleClose]);
|
|
4188
|
-
const handleOpenChange =
|
|
4238
|
+
const handleOpenChange = React28__namespace.default.useCallback(
|
|
4189
4239
|
(nextOpen) => {
|
|
4190
4240
|
if (disabled && nextOpen) return;
|
|
4191
4241
|
setOpen(nextOpen);
|
|
@@ -4293,51 +4343,70 @@ var ConditionMonthInput = ({ row, control, onClear }) => {
|
|
|
4293
4343
|
}
|
|
4294
4344
|
return renderPicker(`value_${row.id}`, "value");
|
|
4295
4345
|
};
|
|
4296
|
-
var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) =>
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4308
|
-
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4346
|
+
var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) => {
|
|
4347
|
+
const [options, setOptions] = React28.useState([]);
|
|
4348
|
+
const [loading, setIsLoading] = React28.useState(false);
|
|
4349
|
+
React28.useEffect(() => {
|
|
4350
|
+
if (!fieldSchema) {
|
|
4351
|
+
return;
|
|
4352
|
+
}
|
|
4353
|
+
if (fieldSchema.fetchOptions) {
|
|
4354
|
+
setIsLoading(true);
|
|
4355
|
+
fieldSchema.fetchOptions().then((fetchedOptions) => {
|
|
4356
|
+
setOptions(fetchedOptions);
|
|
4357
|
+
}).catch((err) => {
|
|
4358
|
+
console.error("Failed to fetch lookup options", err);
|
|
4359
|
+
}).finally(() => setIsLoading(false));
|
|
4360
|
+
} else {
|
|
4361
|
+
setOptions(fieldSchema.options);
|
|
4362
|
+
}
|
|
4363
|
+
}, [fieldSchema]);
|
|
4364
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4365
|
+
FormField,
|
|
4366
|
+
{
|
|
4367
|
+
control,
|
|
4368
|
+
name: `value_${row.id}`,
|
|
4369
|
+
rules: { required: "This field is required." },
|
|
4370
|
+
render: ({ field }) => {
|
|
4371
|
+
const handleClear = () => {
|
|
4372
|
+
field.onChange("");
|
|
4373
|
+
onClear("value");
|
|
4374
|
+
};
|
|
4375
|
+
const hasValue = Boolean(field.value);
|
|
4376
|
+
const clearLabel = "Clear selected value";
|
|
4377
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(FormItem, { className: "relative", children: [
|
|
4378
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Select, { value: field.value ?? "", onValueChange: field.onChange, children: [
|
|
4379
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormControl, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4380
|
+
SelectTrigger,
|
|
4381
|
+
{
|
|
4382
|
+
className: cn(
|
|
4383
|
+
"w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0",
|
|
4384
|
+
hasValue ? "pr-8" : "pr-4"
|
|
4385
|
+
),
|
|
4386
|
+
"data-testid": "advsearch-dropdown-value",
|
|
4387
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select value" })
|
|
4388
|
+
}
|
|
4389
|
+
) }),
|
|
4390
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "w-full min-w-[unset]", children: loading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-2 text-sm text-inherit", children: fieldSchema?.loadingMessage ?? "Loading..." }) }) : options.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 py-2 text-sm text-inherit", children: fieldSchema?.noOptionsMessage ?? "No records found." }) }) : options.map((opt) => /* @__PURE__ */ jsxRuntime.jsxs(SelectItem, { value: opt.value, className: cn(opt.labelStyle), children: [
|
|
4391
|
+
opt.decorator,
|
|
4392
|
+
opt.label
|
|
4393
|
+
] }, opt.value)) })
|
|
4394
|
+
] }),
|
|
4395
|
+
hasValue && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4396
|
+
ClearButton,
|
|
4313
4397
|
{
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
"data-testid": "advsearch-dropdown-value",
|
|
4319
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select value" })
|
|
4398
|
+
onClick: handleClear,
|
|
4399
|
+
ariaLabel: clearLabel,
|
|
4400
|
+
title: clearLabel,
|
|
4401
|
+
className: "absolute right-3 top-1/2 z-10 -translate-y-1/2"
|
|
4320
4402
|
}
|
|
4321
|
-
)
|
|
4322
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
] }, opt.value)) })
|
|
4326
|
-
] }),
|
|
4327
|
-
hasValue && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4328
|
-
ClearButton,
|
|
4329
|
-
{
|
|
4330
|
-
onClick: handleClear,
|
|
4331
|
-
ariaLabel: clearLabel,
|
|
4332
|
-
title: clearLabel,
|
|
4333
|
-
className: "absolute right-3 top-1/2 z-10 -translate-y-1/2"
|
|
4334
|
-
}
|
|
4335
|
-
),
|
|
4336
|
-
/* @__PURE__ */ jsxRuntime.jsx(FormMessage, { className: "absolute left-0 top-full mt-1 text-xs text-red-600" })
|
|
4337
|
-
] });
|
|
4403
|
+
),
|
|
4404
|
+
/* @__PURE__ */ jsxRuntime.jsx(FormMessage, { className: "absolute left-0 top-full mt-1 text-xs text-red-600" })
|
|
4405
|
+
] });
|
|
4406
|
+
}
|
|
4338
4407
|
}
|
|
4339
|
-
|
|
4340
|
-
|
|
4408
|
+
);
|
|
4409
|
+
};
|
|
4341
4410
|
var ConditionCheckboxInput = ({ row, control, onClear }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
4342
4411
|
FormField,
|
|
4343
4412
|
{
|
|
@@ -4396,24 +4465,24 @@ var LookupSelect = ({
|
|
|
4396
4465
|
dropdownPortalId,
|
|
4397
4466
|
multiple = false
|
|
4398
4467
|
}) => {
|
|
4399
|
-
const [inputValue, setInputValue] =
|
|
4400
|
-
const inputRef =
|
|
4401
|
-
const [inputFocused, setInputFocused] =
|
|
4402
|
-
const [suggestions, setSuggestions] =
|
|
4403
|
-
const [optionLabels, setOptionLabels] =
|
|
4404
|
-
const [loading, setLoading] =
|
|
4405
|
-
const [fetchError, setFetchError] =
|
|
4406
|
-
const [isDropdownOpen, setIsDropdownOpen] =
|
|
4407
|
-
const containerRef =
|
|
4408
|
-
const fetchDelayRef =
|
|
4409
|
-
const requestIdRef =
|
|
4410
|
-
const [dropdownStyles, setDropdownStyles] =
|
|
4411
|
-
const dropdownContentRef =
|
|
4412
|
-
const assignDropdownContentRef =
|
|
4468
|
+
const [inputValue, setInputValue] = React28.useState("");
|
|
4469
|
+
const inputRef = React28.useRef(null);
|
|
4470
|
+
const [inputFocused, setInputFocused] = React28.useState(false);
|
|
4471
|
+
const [suggestions, setSuggestions] = React28.useState([]);
|
|
4472
|
+
const [optionLabels, setOptionLabels] = React28.useState({});
|
|
4473
|
+
const [loading, setLoading] = React28.useState(false);
|
|
4474
|
+
const [fetchError, setFetchError] = React28.useState(null);
|
|
4475
|
+
const [isDropdownOpen, setIsDropdownOpen] = React28.useState(false);
|
|
4476
|
+
const containerRef = React28.useRef(null);
|
|
4477
|
+
const fetchDelayRef = React28.useRef(null);
|
|
4478
|
+
const requestIdRef = React28.useRef(0);
|
|
4479
|
+
const [dropdownStyles, setDropdownStyles] = React28.useState();
|
|
4480
|
+
const dropdownContentRef = React28.useRef(null);
|
|
4481
|
+
const assignDropdownContentRef = React28.useCallback((node) => {
|
|
4413
4482
|
dropdownContentRef.current = node;
|
|
4414
4483
|
}, []);
|
|
4415
|
-
const [activeSuggestionIndex, setActiveSuggestionIndex] =
|
|
4416
|
-
const dropdownPortalElement =
|
|
4484
|
+
const [activeSuggestionIndex, setActiveSuggestionIndex] = React28.useState(-1);
|
|
4485
|
+
const dropdownPortalElement = React28.useMemo(() => {
|
|
4417
4486
|
if (typeof document === "undefined") return null;
|
|
4418
4487
|
if (dropdownPortalId) {
|
|
4419
4488
|
const element = document.getElementById(dropdownPortalId);
|
|
@@ -4424,7 +4493,7 @@ var LookupSelect = ({
|
|
|
4424
4493
|
const limitReached = multiple && value.length >= maxTags;
|
|
4425
4494
|
const selectedValue = !multiple && value.length > 0 ? value[0] : void 0;
|
|
4426
4495
|
const selectedLabel = selectedValue ? optionLabels[selectedValue] ?? selectedValue : void 0;
|
|
4427
|
-
const upsertOptionLabels =
|
|
4496
|
+
const upsertOptionLabels = React28.useCallback((options) => {
|
|
4428
4497
|
setOptionLabels((prev) => {
|
|
4429
4498
|
let next = null;
|
|
4430
4499
|
options.forEach((opt) => {
|
|
@@ -4437,7 +4506,7 @@ var LookupSelect = ({
|
|
|
4437
4506
|
return next ?? prev;
|
|
4438
4507
|
});
|
|
4439
4508
|
}, []);
|
|
4440
|
-
const addTag =
|
|
4509
|
+
const addTag = React28.useCallback(
|
|
4441
4510
|
(val) => {
|
|
4442
4511
|
const trimmed = val.trim();
|
|
4443
4512
|
if (!trimmed) return;
|
|
@@ -4452,7 +4521,7 @@ var LookupSelect = ({
|
|
|
4452
4521
|
},
|
|
4453
4522
|
[value, onChange, maxTags, multiple]
|
|
4454
4523
|
);
|
|
4455
|
-
const removeTag =
|
|
4524
|
+
const removeTag = React28.useCallback(
|
|
4456
4525
|
(index) => {
|
|
4457
4526
|
if (index < 0) return;
|
|
4458
4527
|
const newTags = value.filter((_, i) => i !== index);
|
|
@@ -4462,7 +4531,7 @@ var LookupSelect = ({
|
|
|
4462
4531
|
},
|
|
4463
4532
|
[value, onChange]
|
|
4464
4533
|
);
|
|
4465
|
-
const handleClear =
|
|
4534
|
+
const handleClear = React28.useCallback(() => {
|
|
4466
4535
|
setInputValue("");
|
|
4467
4536
|
setSuggestions([]);
|
|
4468
4537
|
setInputFocused(false);
|
|
@@ -4470,7 +4539,7 @@ var LookupSelect = ({
|
|
|
4470
4539
|
setFetchError(null);
|
|
4471
4540
|
if (onClear) onClear();
|
|
4472
4541
|
}, [onClear]);
|
|
4473
|
-
const handleSuggestionSelect =
|
|
4542
|
+
const handleSuggestionSelect = React28.useCallback(
|
|
4474
4543
|
(option) => {
|
|
4475
4544
|
upsertOptionLabels([option]);
|
|
4476
4545
|
addTag(option.value);
|
|
@@ -4488,7 +4557,7 @@ var LookupSelect = ({
|
|
|
4488
4557
|
},
|
|
4489
4558
|
[addTag, multiple, upsertOptionLabels]
|
|
4490
4559
|
);
|
|
4491
|
-
const handleKeyDown =
|
|
4560
|
+
const handleKeyDown = React28.useCallback(
|
|
4492
4561
|
(e) => {
|
|
4493
4562
|
if (e.key === "ArrowDown" && suggestions.length > 0) {
|
|
4494
4563
|
e.preventDefault();
|
|
@@ -4515,7 +4584,7 @@ var LookupSelect = ({
|
|
|
4515
4584
|
},
|
|
4516
4585
|
[suggestions, activeSuggestionIndex, handleSuggestionSelect, inputValue, removeTag, value.length]
|
|
4517
4586
|
);
|
|
4518
|
-
const updateDropdownPosition =
|
|
4587
|
+
const updateDropdownPosition = React28.useCallback(() => {
|
|
4519
4588
|
if (!dropdownPortalElement || !containerRef.current) return;
|
|
4520
4589
|
const rect = containerRef.current.getBoundingClientRect();
|
|
4521
4590
|
setDropdownStyles({
|
|
@@ -4526,7 +4595,7 @@ var LookupSelect = ({
|
|
|
4526
4595
|
zIndex: 50
|
|
4527
4596
|
});
|
|
4528
4597
|
}, [dropdownPortalElement]);
|
|
4529
|
-
|
|
4598
|
+
React28.useEffect(() => {
|
|
4530
4599
|
if (!fetchSuggestions || !inputFocused) return;
|
|
4531
4600
|
if (fetchDelayRef.current) {
|
|
4532
4601
|
clearTimeout(fetchDelayRef.current);
|
|
@@ -4560,7 +4629,7 @@ var LookupSelect = ({
|
|
|
4560
4629
|
}
|
|
4561
4630
|
};
|
|
4562
4631
|
}, [inputValue, fetchSuggestions, suggestionDebounce, upsertOptionLabels, inputFocused]);
|
|
4563
|
-
|
|
4632
|
+
React28.useEffect(() => {
|
|
4564
4633
|
if (!fetchSuggestions) return;
|
|
4565
4634
|
if (value.length === 0) return;
|
|
4566
4635
|
const unresolvedValues = value.filter((v) => !optionLabels[v]);
|
|
@@ -4570,7 +4639,7 @@ var LookupSelect = ({
|
|
|
4570
4639
|
}).catch(() => {
|
|
4571
4640
|
});
|
|
4572
4641
|
}, [value, fetchSuggestions, optionLabels, upsertOptionLabels]);
|
|
4573
|
-
|
|
4642
|
+
React28.useEffect(() => {
|
|
4574
4643
|
const handleDocumentClick = (event) => {
|
|
4575
4644
|
const target = event.target;
|
|
4576
4645
|
if (containerRef.current?.contains(target)) return;
|
|
@@ -4583,11 +4652,11 @@ var LookupSelect = ({
|
|
|
4583
4652
|
document.removeEventListener("mousedown", handleDocumentClick);
|
|
4584
4653
|
};
|
|
4585
4654
|
}, []);
|
|
4586
|
-
|
|
4655
|
+
React28.useEffect(() => {
|
|
4587
4656
|
if (!limitReached) return;
|
|
4588
4657
|
setIsDropdownOpen(false);
|
|
4589
4658
|
}, [limitReached]);
|
|
4590
|
-
|
|
4659
|
+
React28.useEffect(() => {
|
|
4591
4660
|
if (!dropdownPortalElement) return;
|
|
4592
4661
|
if (!isDropdownOpen) return;
|
|
4593
4662
|
updateDropdownPosition();
|
|
@@ -4599,7 +4668,7 @@ var LookupSelect = ({
|
|
|
4599
4668
|
window.removeEventListener("scroll", handleReposition, true);
|
|
4600
4669
|
};
|
|
4601
4670
|
}, [dropdownPortalElement, isDropdownOpen, updateDropdownPosition, value]);
|
|
4602
|
-
|
|
4671
|
+
React28.useEffect(() => {
|
|
4603
4672
|
if (suggestions.length === 0) {
|
|
4604
4673
|
setActiveSuggestionIndex(-1);
|
|
4605
4674
|
return;
|
|
@@ -5295,13 +5364,12 @@ var TextBuilder = class {
|
|
|
5295
5364
|
};
|
|
5296
5365
|
|
|
5297
5366
|
// src/components/advanceSearch/builder/uuid.ts
|
|
5298
|
-
var regex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
5299
5367
|
var UUIDBuilder = class {
|
|
5300
5368
|
build(row) {
|
|
5301
5369
|
if (Array.isArray(row.value)) {
|
|
5302
5370
|
return {};
|
|
5303
5371
|
}
|
|
5304
|
-
if (!
|
|
5372
|
+
if (!UUIDregex.test(row.value)) {
|
|
5305
5373
|
return { [row.fieldName]: {} };
|
|
5306
5374
|
}
|
|
5307
5375
|
const sharedOptions = {
|
|
@@ -5405,7 +5473,7 @@ var sanitizeInput = (val) => {
|
|
|
5405
5473
|
if (/\p{Cc}/u.test(val)) return "__INVALID_CONTROL_CHAR__";
|
|
5406
5474
|
return trimmed.replace(/\s+/g, " ");
|
|
5407
5475
|
};
|
|
5408
|
-
var numericTypes = ["number"
|
|
5476
|
+
var numericTypes = ["number"];
|
|
5409
5477
|
var dateTypes = ["date", "datemonth"];
|
|
5410
5478
|
var validateByFieldType = (value, fieldType) => {
|
|
5411
5479
|
if (!value) return { valid: true };
|
|
@@ -5417,9 +5485,9 @@ var validateByFieldType = (value, fieldType) => {
|
|
|
5417
5485
|
return { valid: false, message: "Please enter a valid number." };
|
|
5418
5486
|
}
|
|
5419
5487
|
}
|
|
5420
|
-
if (fieldType === "
|
|
5421
|
-
if (!
|
|
5422
|
-
return { valid: false, message: "Please enter a
|
|
5488
|
+
if (fieldType === "uuid") {
|
|
5489
|
+
if (!UUIDregex.test(value)) {
|
|
5490
|
+
return { valid: false, message: "Please enter a valid UUID." };
|
|
5423
5491
|
}
|
|
5424
5492
|
}
|
|
5425
5493
|
if (dateTypes.includes(fieldType)) {
|
|
@@ -5439,9 +5507,10 @@ var AdvanceSearch = ({
|
|
|
5439
5507
|
onSearch,
|
|
5440
5508
|
onClear,
|
|
5441
5509
|
shortDateFormat,
|
|
5442
|
-
filterFieldMap = FILTER_FIELD_MAP
|
|
5510
|
+
filterFieldMap = FILTER_FIELD_MAP,
|
|
5511
|
+
customParamsBuilderHook
|
|
5443
5512
|
}) => {
|
|
5444
|
-
const fieldsData =
|
|
5513
|
+
const fieldsData = React28.useMemo(() => {
|
|
5445
5514
|
if (fields.length === 0) throw new Error("fields cannot be an empty array");
|
|
5446
5515
|
return fields || [];
|
|
5447
5516
|
}, [fields]);
|
|
@@ -5461,8 +5530,8 @@ var AdvanceSearch = ({
|
|
|
5461
5530
|
defaultValues: {}
|
|
5462
5531
|
});
|
|
5463
5532
|
const { handleSubmit, unregister, resetField, getValues, clearErrors, setError } = form;
|
|
5464
|
-
const [operatorErrors, setOperatorErrors] =
|
|
5465
|
-
const clearOperatorError =
|
|
5533
|
+
const [operatorErrors, setOperatorErrors] = React28__namespace.default.useState({});
|
|
5534
|
+
const clearOperatorError = React28.useCallback(
|
|
5466
5535
|
(rowId) => {
|
|
5467
5536
|
setOperatorErrors((prev) => {
|
|
5468
5537
|
if (!(rowId in prev)) return prev;
|
|
@@ -5472,7 +5541,7 @@ var AdvanceSearch = ({
|
|
|
5472
5541
|
},
|
|
5473
5542
|
[setOperatorErrors]
|
|
5474
5543
|
);
|
|
5475
|
-
const clearValue =
|
|
5544
|
+
const clearValue = React28.useCallback(
|
|
5476
5545
|
(rowId, which) => {
|
|
5477
5546
|
const fieldName = `${which}_${rowId}`;
|
|
5478
5547
|
resetField(fieldName, { defaultValue: void 0 });
|
|
@@ -5482,14 +5551,14 @@ var AdvanceSearch = ({
|
|
|
5482
5551
|
},
|
|
5483
5552
|
[resetField, clearErrors]
|
|
5484
5553
|
);
|
|
5485
|
-
const parseRangeValue =
|
|
5554
|
+
const parseRangeValue = React28.useCallback((raw, fieldType) => {
|
|
5486
5555
|
if (!raw) return void 0;
|
|
5487
5556
|
if (Array.isArray(raw)) return void 0;
|
|
5488
5557
|
const normalized = fieldType === "datemonth" ? `${raw}-01` : raw;
|
|
5489
5558
|
const parsed = dateFns.parseISO(normalized);
|
|
5490
5559
|
return dateFns.isValid(parsed) ? parsed : void 0;
|
|
5491
5560
|
}, []);
|
|
5492
|
-
const onSubmit =
|
|
5561
|
+
const onSubmit = React28.useCallback(() => {
|
|
5493
5562
|
const operatorValidation = {};
|
|
5494
5563
|
rows.forEach((r) => {
|
|
5495
5564
|
const ops = operatorsForField(r.fieldName);
|
|
@@ -5548,10 +5617,25 @@ var AdvanceSearch = ({
|
|
|
5548
5617
|
});
|
|
5549
5618
|
if (hasError) return;
|
|
5550
5619
|
const cleanedRows = processedRows.filter(Boolean);
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5620
|
+
let params;
|
|
5621
|
+
if (customParamsBuilderHook) {
|
|
5622
|
+
params = {
|
|
5623
|
+
AND: cleanedRows.map(
|
|
5624
|
+
(r) => customParamsBuilderHook({
|
|
5625
|
+
defaultBuildFunc: (r2) => getBuilder(r2.fieldType).build(r2),
|
|
5626
|
+
row: r
|
|
5627
|
+
})
|
|
5628
|
+
)
|
|
5629
|
+
};
|
|
5630
|
+
} else {
|
|
5631
|
+
params = transformFilterKeys(
|
|
5632
|
+
{
|
|
5633
|
+
AND: cleanedRows.map((r) => getBuilder(r.fieldType).build(r)).filter(Boolean)
|
|
5634
|
+
},
|
|
5635
|
+
filterFieldMap
|
|
5636
|
+
);
|
|
5637
|
+
}
|
|
5638
|
+
if (onSearch) onSearch(params);
|
|
5555
5639
|
}, [
|
|
5556
5640
|
rows,
|
|
5557
5641
|
operatorsForField,
|
|
@@ -5560,7 +5644,8 @@ var AdvanceSearch = ({
|
|
|
5560
5644
|
setError,
|
|
5561
5645
|
setOperatorErrors,
|
|
5562
5646
|
filterFieldMap,
|
|
5563
|
-
onSearch
|
|
5647
|
+
onSearch,
|
|
5648
|
+
customParamsBuilderHook
|
|
5564
5649
|
]);
|
|
5565
5650
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5566
5651
|
ExpandCollapse_default,
|
|
@@ -5727,11 +5812,11 @@ function resetVisibleTableState(payload) {
|
|
|
5727
5812
|
table.setSorting(prevState.sorting.filter((s) => isVisible(s.id)));
|
|
5728
5813
|
}
|
|
5729
5814
|
var useHover = () => {
|
|
5730
|
-
const [hovering, setHovering] =
|
|
5731
|
-
const prevRef =
|
|
5732
|
-
const onMouseEnter =
|
|
5733
|
-
const onMouseLeave =
|
|
5734
|
-
const nodeRefCallback =
|
|
5815
|
+
const [hovering, setHovering] = React28.useState(false);
|
|
5816
|
+
const prevRef = React28.useRef(null);
|
|
5817
|
+
const onMouseEnter = React28.useCallback(() => setHovering(true), []);
|
|
5818
|
+
const onMouseLeave = React28.useCallback(() => setHovering(false), []);
|
|
5819
|
+
const nodeRefCallback = React28.useCallback(
|
|
5735
5820
|
(node) => {
|
|
5736
5821
|
if (prevRef.current) {
|
|
5737
5822
|
prevRef.current.removeEventListener("mouseenter", onMouseEnter);
|
|
@@ -5759,15 +5844,15 @@ var useIntersectionObserver = ({
|
|
|
5759
5844
|
initialIsIntersecting = false,
|
|
5760
5845
|
onChange
|
|
5761
5846
|
} = {}) => {
|
|
5762
|
-
const [ref, setRef] =
|
|
5763
|
-
const [state, setState] =
|
|
5847
|
+
const [ref, setRef] = React28.useState(null);
|
|
5848
|
+
const [state, setState] = React28.useState(() => ({
|
|
5764
5849
|
isIntersecting: initialIsIntersecting,
|
|
5765
5850
|
entry: void 0
|
|
5766
5851
|
}));
|
|
5767
|
-
const callbackRef =
|
|
5852
|
+
const callbackRef = React28.useRef(null);
|
|
5768
5853
|
callbackRef.current = onChange;
|
|
5769
5854
|
const frozen = state.entry?.isIntersecting && freezeOnceVisible;
|
|
5770
|
-
|
|
5855
|
+
React28.useEffect(() => {
|
|
5771
5856
|
if (!ref) return;
|
|
5772
5857
|
if (!("IntersectionObserver" in window)) return;
|
|
5773
5858
|
if (frozen) return;
|
|
@@ -5797,8 +5882,8 @@ var useIntersectionObserver = ({
|
|
|
5797
5882
|
frozen,
|
|
5798
5883
|
freezeOnceVisible
|
|
5799
5884
|
]);
|
|
5800
|
-
const prevRef =
|
|
5801
|
-
|
|
5885
|
+
const prevRef = React28.useRef(null);
|
|
5886
|
+
React28.useEffect(() => {
|
|
5802
5887
|
if (!ref && state.entry?.target && !freezeOnceVisible && !frozen && prevRef.current !== state.entry.target) {
|
|
5803
5888
|
prevRef.current = state.entry.target;
|
|
5804
5889
|
setState({ isIntersecting: initialIsIntersecting, entry: void 0 });
|
|
@@ -5815,8 +5900,8 @@ var isValidMediaQueryString = (query) => {
|
|
|
5815
5900
|
return query !== "not all";
|
|
5816
5901
|
};
|
|
5817
5902
|
var useMediaQuery = ({ query }) => {
|
|
5818
|
-
const [matches, setMatches] =
|
|
5819
|
-
|
|
5903
|
+
const [matches, setMatches] = React28.useState(false);
|
|
5904
|
+
React28.useEffect(() => {
|
|
5820
5905
|
if (typeof window === "undefined") {
|
|
5821
5906
|
return;
|
|
5822
5907
|
}
|
|
@@ -5852,8 +5937,8 @@ var useTruncated = ({
|
|
|
5852
5937
|
onChange,
|
|
5853
5938
|
resizeDetectDelay = 150
|
|
5854
5939
|
}) => {
|
|
5855
|
-
const [isTruncated, setIsTruncated] =
|
|
5856
|
-
|
|
5940
|
+
const [isTruncated, setIsTruncated] = React28.useState(false);
|
|
5941
|
+
React28.useEffect(() => {
|
|
5857
5942
|
const element = elementRef.current;
|
|
5858
5943
|
if (!element) return;
|
|
5859
5944
|
const checkTruncate = debounce(() => {
|
|
@@ -5882,14 +5967,14 @@ var useControllableState = ({
|
|
|
5882
5967
|
value
|
|
5883
5968
|
}) => {
|
|
5884
5969
|
const isControlled = typeof value !== "undefined";
|
|
5885
|
-
const [internalValue, setInternalValue] =
|
|
5970
|
+
const [internalValue, setInternalValue] = React28__namespace.useState(() => {
|
|
5886
5971
|
return isControlled ? value : defaultValue;
|
|
5887
5972
|
});
|
|
5888
|
-
|
|
5973
|
+
React28__namespace.useEffect(() => {
|
|
5889
5974
|
if (!isControlled) return;
|
|
5890
5975
|
setInternalValue(value);
|
|
5891
5976
|
}, [isControlled, value]);
|
|
5892
|
-
const setValue =
|
|
5977
|
+
const setValue = React28__namespace.useCallback(
|
|
5893
5978
|
(nextValue) => {
|
|
5894
5979
|
if (isControlled) return;
|
|
5895
5980
|
setInternalValue(nextValue);
|
|
@@ -5903,9 +5988,9 @@ var useControllableState = ({
|
|
|
5903
5988
|
};
|
|
5904
5989
|
};
|
|
5905
5990
|
var useControllableState_default = useControllableState;
|
|
5906
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ?
|
|
5991
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React28.useLayoutEffect : React28.useEffect;
|
|
5907
5992
|
var useBindRef = ({ ref, value }) => {
|
|
5908
|
-
|
|
5993
|
+
React28__namespace.useEffect(() => {
|
|
5909
5994
|
if (!ref) return;
|
|
5910
5995
|
ref.current = value;
|
|
5911
5996
|
return () => {
|
|
@@ -6098,7 +6183,7 @@ var StatusContentSlot = ({
|
|
|
6098
6183
|
content
|
|
6099
6184
|
] });
|
|
6100
6185
|
};
|
|
6101
|
-
var StatusContentSlot_default =
|
|
6186
|
+
var StatusContentSlot_default = React28__namespace.default.memo(StatusContentSlot);
|
|
6102
6187
|
var stateOptions = [
|
|
6103
6188
|
"columnFilters",
|
|
6104
6189
|
"globalFilter",
|
|
@@ -6151,9 +6236,9 @@ var modelOptions = [
|
|
|
6151
6236
|
"getCenterVisibleLeafColumns"
|
|
6152
6237
|
];
|
|
6153
6238
|
var DataTableDevTool = ({ table }) => {
|
|
6154
|
-
const [open, setOpen] =
|
|
6155
|
-
const [visibleStates, setVisibleStates] =
|
|
6156
|
-
const [visibleModels, setVisibleModels] =
|
|
6239
|
+
const [open, setOpen] = React28.useState(false);
|
|
6240
|
+
const [visibleStates, setVisibleStates] = React28.useState([]);
|
|
6241
|
+
const [visibleModels, setVisibleModels] = React28.useState([]);
|
|
6157
6242
|
const tableState = table.getState();
|
|
6158
6243
|
const toggleValue = (arr, value) => arr.includes(value) ? arr.filter((v) => v !== value) : [...arr, value];
|
|
6159
6244
|
const getCircularReplacer = () => {
|
|
@@ -6366,7 +6451,7 @@ var useTableController = ({
|
|
|
6366
6451
|
return table;
|
|
6367
6452
|
};
|
|
6368
6453
|
var useScrollFetch = ({ scrollFetch, containerRef }) => {
|
|
6369
|
-
const fetchMoreOnScrollReached =
|
|
6454
|
+
const fetchMoreOnScrollReached = React28.useCallback(
|
|
6370
6455
|
(containerRefElement) => {
|
|
6371
6456
|
if (!scrollFetch?.enabled || !containerRefElement || scrollFetch?.isFetchingMore || !scrollFetch?.hasMore || !scrollFetch?.fetchMore) {
|
|
6372
6457
|
return;
|
|
@@ -6400,7 +6485,7 @@ var useScrollFetch = ({ scrollFetch, containerRef }) => {
|
|
|
6400
6485
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
6401
6486
|
[scrollFetch?.enabled, scrollFetch?.isFetchingMore, scrollFetch?.hasMore, scrollFetch?.fetchMore]
|
|
6402
6487
|
);
|
|
6403
|
-
|
|
6488
|
+
React28.useEffect(() => {
|
|
6404
6489
|
fetchMoreOnScrollReached(containerRef.current);
|
|
6405
6490
|
}, [fetchMoreOnScrollReached, containerRef]);
|
|
6406
6491
|
return fetchMoreOnScrollReached;
|
|
@@ -6450,7 +6535,7 @@ function useComputedTableState({
|
|
|
6450
6535
|
leftVisibleLeftColumns.length + centerVisibleLeafColumns.length + rightVisibleLeafColumns.length,
|
|
6451
6536
|
1
|
|
6452
6537
|
);
|
|
6453
|
-
const { isSomeColumnsFilterable, filterableColumns } =
|
|
6538
|
+
const { isSomeColumnsFilterable, filterableColumns } = React28.useMemo(() => {
|
|
6454
6539
|
const mergedColumns = [
|
|
6455
6540
|
...leftVisibleLeftColumns,
|
|
6456
6541
|
...centerVisibleLeafColumns,
|
|
@@ -6461,7 +6546,7 @@ function useComputedTableState({
|
|
|
6461
6546
|
);
|
|
6462
6547
|
return { isSomeColumnsFilterable: isSomeColumnsFilterable2, filterableColumns: mergedColumns };
|
|
6463
6548
|
}, [centerVisibleLeafColumns, leftVisibleLeftColumns, rightVisibleLeafColumns]);
|
|
6464
|
-
const autoStatusKey =
|
|
6549
|
+
const autoStatusKey = React28.useMemo(() => {
|
|
6465
6550
|
if (isInitialLoading) return "initialLoading";
|
|
6466
6551
|
if (isTableEmpty) return "emptyData";
|
|
6467
6552
|
if (isTableEmptyAfterFiltering) return "emptyFilteredData";
|
|
@@ -6479,7 +6564,7 @@ function useComputedTableState({
|
|
|
6479
6564
|
scrollFetch?.hasMore,
|
|
6480
6565
|
scrollFetch?.isFetchingMore
|
|
6481
6566
|
]);
|
|
6482
|
-
const activeStatusContentComputed =
|
|
6567
|
+
const activeStatusContentComputed = React28.useMemo(() => {
|
|
6483
6568
|
if (!activeStatusContent) return autoStatusKey;
|
|
6484
6569
|
if (typeof activeStatusContent === "function") {
|
|
6485
6570
|
return activeStatusContent({ defaultComputedValue: autoStatusKey });
|
|
@@ -6530,7 +6615,7 @@ var ColumnSeparator = ({ show, className, ...props }) => {
|
|
|
6530
6615
|
}
|
|
6531
6616
|
);
|
|
6532
6617
|
};
|
|
6533
|
-
var ColumnSeparator_default =
|
|
6618
|
+
var ColumnSeparator_default = React28__namespace.default.memo(ColumnSeparator);
|
|
6534
6619
|
|
|
6535
6620
|
// src/components/data-table/helpers.ts
|
|
6536
6621
|
function getColumnPinningInfo(column) {
|
|
@@ -6688,7 +6773,7 @@ var TableDataRows = ({
|
|
|
6688
6773
|
if (!row) return null;
|
|
6689
6774
|
const virtualIndex = config.isVirtualize ? item.index : void 0;
|
|
6690
6775
|
const tableDataRowProps = typeof components?.tableDataRowProps === "function" ? components.tableDataRowProps({ row, table }) || {} : components?.tableDataRowProps || {};
|
|
6691
|
-
return /* @__PURE__ */
|
|
6776
|
+
return /* @__PURE__ */ React28.createElement(
|
|
6692
6777
|
TableRow,
|
|
6693
6778
|
{
|
|
6694
6779
|
"data-testid": `table-data-row-${row.id}`,
|
|
@@ -6777,7 +6862,7 @@ var DataTable = ({
|
|
|
6777
6862
|
components
|
|
6778
6863
|
}) => {
|
|
6779
6864
|
const virtualEnabled = virtual?.enabled ?? false;
|
|
6780
|
-
const tableContainerRef =
|
|
6865
|
+
const tableContainerRef = React28.useRef(null);
|
|
6781
6866
|
const table = useTableController({
|
|
6782
6867
|
columns,
|
|
6783
6868
|
data,
|
|
@@ -7181,11 +7266,11 @@ function DialogAlert({
|
|
|
7181
7266
|
}) {
|
|
7182
7267
|
const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
|
|
7183
7268
|
const { t } = reactI18next.useTranslation();
|
|
7184
|
-
const handleCancel =
|
|
7269
|
+
const handleCancel = React28.useCallback(() => {
|
|
7185
7270
|
onCancel?.();
|
|
7186
7271
|
onOpenChange(false);
|
|
7187
7272
|
}, [onCancel, onOpenChange]);
|
|
7188
|
-
const handleConfirm =
|
|
7273
|
+
const handleConfirm = React28.useCallback(() => {
|
|
7189
7274
|
let func = onConfirm;
|
|
7190
7275
|
if (variant === "success" && showCancel === false) {
|
|
7191
7276
|
func = onConfirm ?? onCancel;
|
|
@@ -7560,7 +7645,7 @@ var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
|
|
|
7560
7645
|
const open = useDialogAlertStore((state) => state.open);
|
|
7561
7646
|
const setOpen = useDialogAlertStore((state) => state.setOpen);
|
|
7562
7647
|
const dialogProps = useDialogAlertStore((state) => state.dialogProps);
|
|
7563
|
-
|
|
7648
|
+
React28.useEffect(() => {
|
|
7564
7649
|
if (!i18nResource) {
|
|
7565
7650
|
i18n_default.changeLanguage("sharedui");
|
|
7566
7651
|
return;
|
|
@@ -7670,8 +7755,8 @@ var defaultOperatorShortcuts = {
|
|
|
7670
7755
|
};
|
|
7671
7756
|
var DEFAULT_DEBOUNCE = 200;
|
|
7672
7757
|
function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
|
|
7673
|
-
const [selectedIndex, setSelectedIndex] =
|
|
7674
|
-
|
|
7758
|
+
const [selectedIndex, setSelectedIndex] = React28.useState(0);
|
|
7759
|
+
React28.useEffect(() => {
|
|
7675
7760
|
const handler = (event) => {
|
|
7676
7761
|
if (event.key === "ArrowDown") {
|
|
7677
7762
|
event.preventDefault();
|
|
@@ -7694,10 +7779,10 @@ function useKeyboardNavigation(itemsLength, onSelect, isLocked) {
|
|
|
7694
7779
|
return [selectedIndex, setSelectedIndex];
|
|
7695
7780
|
}
|
|
7696
7781
|
function useDropdownPosition(clientRect, itemsCount) {
|
|
7697
|
-
const [rect, setRect] =
|
|
7698
|
-
const [style, setStyle] =
|
|
7699
|
-
const ref =
|
|
7700
|
-
|
|
7782
|
+
const [rect, setRect] = React28.useState(null);
|
|
7783
|
+
const [style, setStyle] = React28.useState({});
|
|
7784
|
+
const ref = React28.useRef(null);
|
|
7785
|
+
React28.useEffect(() => {
|
|
7701
7786
|
if (!clientRect) return;
|
|
7702
7787
|
const update = () => {
|
|
7703
7788
|
const nextRect = clientRect();
|
|
@@ -7714,7 +7799,7 @@ function useDropdownPosition(clientRect, itemsCount) {
|
|
|
7714
7799
|
resizeObserver.disconnect();
|
|
7715
7800
|
};
|
|
7716
7801
|
}, [clientRect]);
|
|
7717
|
-
|
|
7802
|
+
React28.useLayoutEffect(() => {
|
|
7718
7803
|
if (!rect || !ref.current) return;
|
|
7719
7804
|
const dropdown = ref.current;
|
|
7720
7805
|
const dropdownRect = dropdown.getBoundingClientRect();
|
|
@@ -7741,15 +7826,15 @@ var SuggestionList = ({
|
|
|
7741
7826
|
debounceMs = DEFAULT_DEBOUNCE,
|
|
7742
7827
|
query
|
|
7743
7828
|
}) => {
|
|
7744
|
-
const [items, setItems] =
|
|
7745
|
-
const [isLoading, setIsLoading] =
|
|
7746
|
-
const fetchId =
|
|
7747
|
-
const debounceHandle =
|
|
7748
|
-
const itemRefs =
|
|
7829
|
+
const [items, setItems] = React28.useState([]);
|
|
7830
|
+
const [isLoading, setIsLoading] = React28.useState(false);
|
|
7831
|
+
const fetchId = React28.useRef(0);
|
|
7832
|
+
const debounceHandle = React28.useRef(null);
|
|
7833
|
+
const itemRefs = React28.useRef([]);
|
|
7749
7834
|
const { ref, style, rect } = useDropdownPosition(clientRect, items.length);
|
|
7750
|
-
const normalizedMap =
|
|
7751
|
-
const normalizeItem =
|
|
7752
|
-
|
|
7835
|
+
const normalizedMap = React28.useMemo(() => mapItem, [mapItem]);
|
|
7836
|
+
const normalizeItem = React28.useMemo(() => normalizeToken, [normalizeToken]);
|
|
7837
|
+
React28.useEffect(() => {
|
|
7753
7838
|
const runFetch = (input) => {
|
|
7754
7839
|
fetchId.current += 1;
|
|
7755
7840
|
const currentId = fetchId.current;
|
|
@@ -7780,7 +7865,7 @@ var SuggestionList = ({
|
|
|
7780
7865
|
fetchId.current += 1;
|
|
7781
7866
|
};
|
|
7782
7867
|
}, [query, fetchItems, normalizedMap, normalizeItem, debounceMs]);
|
|
7783
|
-
const handleSelect =
|
|
7868
|
+
const handleSelect = React28.useMemo(
|
|
7784
7869
|
() => (item) => {
|
|
7785
7870
|
if (isLoading) return;
|
|
7786
7871
|
command(item);
|
|
@@ -7795,10 +7880,10 @@ var SuggestionList = ({
|
|
|
7795
7880
|
},
|
|
7796
7881
|
isLoading
|
|
7797
7882
|
);
|
|
7798
|
-
|
|
7883
|
+
React28.useEffect(() => {
|
|
7799
7884
|
setSelectedIndex(0);
|
|
7800
7885
|
}, [items, setSelectedIndex]);
|
|
7801
|
-
|
|
7886
|
+
React28.useEffect(() => {
|
|
7802
7887
|
const element = itemRefs.current[selectedIndex];
|
|
7803
7888
|
if (element) element.scrollIntoView({ block: "nearest" });
|
|
7804
7889
|
}, [selectedIndex]);
|
|
@@ -7846,8 +7931,8 @@ var DISALLOWED_MARKS = ["bold", "italic", "link"];
|
|
|
7846
7931
|
var SUGGESTION_DEBOUNCE = 200;
|
|
7847
7932
|
var DEFAULT_CHIP_CLASS = "outline-1 outline-muted bg-muted/40 text-foreground";
|
|
7848
7933
|
var TokenView = ({ node, editor, getPos }) => {
|
|
7849
|
-
const [isFocused, setIsFocused] =
|
|
7850
|
-
|
|
7934
|
+
const [isFocused, setIsFocused] = React28__namespace.default.useState(false);
|
|
7935
|
+
React28__namespace.default.useEffect(() => {
|
|
7851
7936
|
const handler = () => {
|
|
7852
7937
|
const { from, to } = editor.state.selection;
|
|
7853
7938
|
const position = getPos();
|
|
@@ -8834,21 +8919,21 @@ function ToolbarPlugin({
|
|
|
8834
8919
|
acceptImageMimeTypes
|
|
8835
8920
|
}) {
|
|
8836
8921
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
8837
|
-
const [state, setState] =
|
|
8838
|
-
const fileInputRef =
|
|
8839
|
-
const [isLinkDialogOpen, setLinkDialogOpen] =
|
|
8840
|
-
const [editingExistingLink, setEditingExistingLink] =
|
|
8841
|
-
const [linkNodeKey, setLinkNodeKey] =
|
|
8842
|
-
const [isImageDialogOpen, setImageDialogOpen] =
|
|
8843
|
-
const [editingExistingImage, setEditingExistingImage] =
|
|
8844
|
-
const [imageNodeKey, setImageNodeKey] =
|
|
8922
|
+
const [state, setState] = React28.useState(initialToolbarState);
|
|
8923
|
+
const fileInputRef = React28.useRef(null);
|
|
8924
|
+
const [isLinkDialogOpen, setLinkDialogOpen] = React28.useState(false);
|
|
8925
|
+
const [editingExistingLink, setEditingExistingLink] = React28.useState(false);
|
|
8926
|
+
const [linkNodeKey, setLinkNodeKey] = React28.useState(null);
|
|
8927
|
+
const [isImageDialogOpen, setImageDialogOpen] = React28.useState(false);
|
|
8928
|
+
const [editingExistingImage, setEditingExistingImage] = React28.useState(false);
|
|
8929
|
+
const [imageNodeKey, setImageNodeKey] = React28.useState(null);
|
|
8845
8930
|
const linkForm = reactHookForm.useForm({
|
|
8846
8931
|
defaultValues: { url: "", label: "" }
|
|
8847
8932
|
});
|
|
8848
8933
|
const imageForm = reactHookForm.useForm({
|
|
8849
8934
|
defaultValues: { url: "", alt: "", width: "", height: "" }
|
|
8850
8935
|
});
|
|
8851
|
-
const openImageDialog =
|
|
8936
|
+
const openImageDialog = React28.useCallback(() => {
|
|
8852
8937
|
if (disabled || !allowImageUrlInsert) {
|
|
8853
8938
|
return;
|
|
8854
8939
|
}
|
|
@@ -8882,7 +8967,7 @@ function ToolbarPlugin({
|
|
|
8882
8967
|
setImageNodeKey(targetImage?.getKey() ?? null);
|
|
8883
8968
|
setImageDialogOpen(true);
|
|
8884
8969
|
}, [allowImageUrlInsert, disabled, editor, imageForm]);
|
|
8885
|
-
const closeImageDialog =
|
|
8970
|
+
const closeImageDialog = React28.useCallback(() => {
|
|
8886
8971
|
setImageDialogOpen(false);
|
|
8887
8972
|
setEditingExistingImage(false);
|
|
8888
8973
|
setImageNodeKey(null);
|
|
@@ -8891,7 +8976,7 @@ function ToolbarPlugin({
|
|
|
8891
8976
|
editor.focus();
|
|
8892
8977
|
}, 0);
|
|
8893
8978
|
}, [editor, imageForm]);
|
|
8894
|
-
const openLinkDialog =
|
|
8979
|
+
const openLinkDialog = React28.useCallback(() => {
|
|
8895
8980
|
if (disabled) {
|
|
8896
8981
|
return;
|
|
8897
8982
|
}
|
|
@@ -8931,7 +9016,7 @@ function ToolbarPlugin({
|
|
|
8931
9016
|
setLinkNodeKey(detectedLink?.getKey() ?? null);
|
|
8932
9017
|
setLinkDialogOpen(true);
|
|
8933
9018
|
}, [disabled, editor, linkForm]);
|
|
8934
|
-
const closeLinkDialog =
|
|
9019
|
+
const closeLinkDialog = React28.useCallback(() => {
|
|
8935
9020
|
setLinkDialogOpen(false);
|
|
8936
9021
|
setEditingExistingLink(false);
|
|
8937
9022
|
setLinkNodeKey(null);
|
|
@@ -8972,7 +9057,7 @@ function ToolbarPlugin({
|
|
|
8972
9057
|
});
|
|
8973
9058
|
closeLinkDialog();
|
|
8974
9059
|
});
|
|
8975
|
-
const handleRemoveLink =
|
|
9060
|
+
const handleRemoveLink = React28.useCallback(() => {
|
|
8976
9061
|
editor.focus();
|
|
8977
9062
|
editor.update(() => {
|
|
8978
9063
|
if (linkNodeKey) {
|
|
@@ -8989,7 +9074,7 @@ function ToolbarPlugin({
|
|
|
8989
9074
|
});
|
|
8990
9075
|
closeLinkDialog();
|
|
8991
9076
|
}, [closeLinkDialog, editor, linkNodeKey]);
|
|
8992
|
-
const handleLinkDialogOpenChange =
|
|
9077
|
+
const handleLinkDialogOpenChange = React28.useCallback(
|
|
8993
9078
|
(open) => {
|
|
8994
9079
|
if (open) {
|
|
8995
9080
|
setLinkDialogOpen(true);
|
|
@@ -8999,7 +9084,7 @@ function ToolbarPlugin({
|
|
|
8999
9084
|
},
|
|
9000
9085
|
[closeLinkDialog]
|
|
9001
9086
|
);
|
|
9002
|
-
const updateToolbar =
|
|
9087
|
+
const updateToolbar = React28.useCallback(() => {
|
|
9003
9088
|
const selection = lexical.$getSelection();
|
|
9004
9089
|
if (!lexical.$isRangeSelection(selection)) {
|
|
9005
9090
|
return;
|
|
@@ -9039,7 +9124,7 @@ function ToolbarPlugin({
|
|
|
9039
9124
|
isLink: hasLink
|
|
9040
9125
|
}));
|
|
9041
9126
|
}, []);
|
|
9042
|
-
|
|
9127
|
+
React28__namespace.useEffect(() => {
|
|
9043
9128
|
return utils.mergeRegister(
|
|
9044
9129
|
editor.registerCommand(
|
|
9045
9130
|
lexical.CAN_UNDO_COMMAND,
|
|
@@ -9070,7 +9155,7 @@ function ToolbarPlugin({
|
|
|
9070
9155
|
})
|
|
9071
9156
|
);
|
|
9072
9157
|
}, [editor, updateToolbar]);
|
|
9073
|
-
const applyBlock =
|
|
9158
|
+
const applyBlock = React28.useCallback(
|
|
9074
9159
|
(nextBlock) => {
|
|
9075
9160
|
if (disabled) {
|
|
9076
9161
|
return;
|
|
@@ -9132,7 +9217,7 @@ function ToolbarPlugin({
|
|
|
9132
9217
|
},
|
|
9133
9218
|
[disabled, editor, state.blockType]
|
|
9134
9219
|
);
|
|
9135
|
-
const toggleFormat =
|
|
9220
|
+
const toggleFormat = React28.useCallback(
|
|
9136
9221
|
(format5) => {
|
|
9137
9222
|
if (disabled) {
|
|
9138
9223
|
return;
|
|
@@ -9141,10 +9226,10 @@ function ToolbarPlugin({
|
|
|
9141
9226
|
},
|
|
9142
9227
|
[disabled, editor]
|
|
9143
9228
|
);
|
|
9144
|
-
const toggleLink =
|
|
9229
|
+
const toggleLink = React28.useCallback(() => {
|
|
9145
9230
|
openLinkDialog();
|
|
9146
9231
|
}, [openLinkDialog]);
|
|
9147
|
-
const applyElementFormat =
|
|
9232
|
+
const applyElementFormat = React28.useCallback(
|
|
9148
9233
|
(format5) => {
|
|
9149
9234
|
if (disabled) {
|
|
9150
9235
|
return;
|
|
@@ -9155,7 +9240,7 @@ function ToolbarPlugin({
|
|
|
9155
9240
|
);
|
|
9156
9241
|
const canInsertImage = allowImageUrlInsert || Boolean(onImageUpload);
|
|
9157
9242
|
const imageAccept = acceptImageMimeTypes ?? DEFAULT_IMAGE_ACCEPT;
|
|
9158
|
-
const handleInsertImage =
|
|
9243
|
+
const handleInsertImage = React28.useCallback(() => {
|
|
9159
9244
|
if (disabled || !canInsertImage) {
|
|
9160
9245
|
return;
|
|
9161
9246
|
}
|
|
@@ -9166,7 +9251,7 @@ function ToolbarPlugin({
|
|
|
9166
9251
|
}
|
|
9167
9252
|
openImageDialog();
|
|
9168
9253
|
}, [canInsertImage, disabled, editor, onImageUpload, openImageDialog]);
|
|
9169
|
-
const handleFileChange =
|
|
9254
|
+
const handleFileChange = React28.useCallback(
|
|
9170
9255
|
async (event) => {
|
|
9171
9256
|
if (!onImageUpload) {
|
|
9172
9257
|
return;
|
|
@@ -9256,7 +9341,7 @@ function ToolbarPlugin({
|
|
|
9256
9341
|
});
|
|
9257
9342
|
closeImageDialog();
|
|
9258
9343
|
});
|
|
9259
|
-
const handleImageDialogOpenChange =
|
|
9344
|
+
const handleImageDialogOpenChange = React28.useCallback(
|
|
9260
9345
|
(open) => {
|
|
9261
9346
|
if (open) {
|
|
9262
9347
|
setImageDialogOpen(true);
|
|
@@ -9266,7 +9351,7 @@ function ToolbarPlugin({
|
|
|
9266
9351
|
},
|
|
9267
9352
|
[closeImageDialog]
|
|
9268
9353
|
);
|
|
9269
|
-
const handleRemoveImage =
|
|
9354
|
+
const handleRemoveImage = React28.useCallback(() => {
|
|
9270
9355
|
if (!imageNodeKey) {
|
|
9271
9356
|
closeImageDialog();
|
|
9272
9357
|
return;
|
|
@@ -9625,7 +9710,7 @@ function ControlledValuePlugin({
|
|
|
9625
9710
|
trackAppliedValue
|
|
9626
9711
|
}) {
|
|
9627
9712
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
9628
|
-
|
|
9713
|
+
React28__namespace.useEffect(() => {
|
|
9629
9714
|
if (value == null || trackAppliedValue.current === value) {
|
|
9630
9715
|
return;
|
|
9631
9716
|
}
|
|
@@ -9649,14 +9734,14 @@ function ControlledValuePlugin({
|
|
|
9649
9734
|
}
|
|
9650
9735
|
function EditableStatePlugin({ editable }) {
|
|
9651
9736
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
9652
|
-
|
|
9737
|
+
React28__namespace.useEffect(() => {
|
|
9653
9738
|
editor.setEditable(editable);
|
|
9654
9739
|
}, [editor, editable]);
|
|
9655
9740
|
return null;
|
|
9656
9741
|
}
|
|
9657
9742
|
function ImagesPlugin() {
|
|
9658
9743
|
const [editor] = LexicalComposerContext.useLexicalComposerContext();
|
|
9659
|
-
|
|
9744
|
+
React28__namespace.useEffect(() => {
|
|
9660
9745
|
return editor.registerCommand(
|
|
9661
9746
|
INSERT_IMAGE_COMMAND,
|
|
9662
9747
|
(payload) => {
|
|
@@ -9675,7 +9760,7 @@ function ImagesPlugin() {
|
|
|
9675
9760
|
}, [editor]);
|
|
9676
9761
|
return null;
|
|
9677
9762
|
}
|
|
9678
|
-
var RichText =
|
|
9763
|
+
var RichText = React28.forwardRef(function RichText2({
|
|
9679
9764
|
value,
|
|
9680
9765
|
defaultValue,
|
|
9681
9766
|
onChange,
|
|
@@ -9694,11 +9779,11 @@ var RichText = React27.forwardRef(function RichText2({
|
|
|
9694
9779
|
id,
|
|
9695
9780
|
...rest
|
|
9696
9781
|
}, ref) {
|
|
9697
|
-
const initialSerializedStateRef =
|
|
9782
|
+
const initialSerializedStateRef = React28.useRef(void 0);
|
|
9698
9783
|
if (initialSerializedStateRef.current === void 0) {
|
|
9699
9784
|
initialSerializedStateRef.current = parseSerializedEditorState(value ?? defaultValue);
|
|
9700
9785
|
}
|
|
9701
|
-
const initialConfig =
|
|
9786
|
+
const initialConfig = React28.useMemo(
|
|
9702
9787
|
() => ({
|
|
9703
9788
|
namespace: "RichTextEditor",
|
|
9704
9789
|
editable: !(readOnly || disabled),
|
|
@@ -9711,8 +9796,8 @@ var RichText = React27.forwardRef(function RichText2({
|
|
|
9711
9796
|
}),
|
|
9712
9797
|
[disabled, readOnly]
|
|
9713
9798
|
);
|
|
9714
|
-
const appliedValueRef =
|
|
9715
|
-
const handleChange =
|
|
9799
|
+
const appliedValueRef = React28.useRef(value ?? defaultValue);
|
|
9800
|
+
const handleChange = React28.useCallback(
|
|
9716
9801
|
(editorState, editor) => {
|
|
9717
9802
|
const serialized = JSON.stringify(editorState.toJSON());
|
|
9718
9803
|
appliedValueRef.current = serialized;
|
|
@@ -9901,13 +9986,13 @@ function SheetDescription({
|
|
|
9901
9986
|
);
|
|
9902
9987
|
}
|
|
9903
9988
|
function useIsMobile(breakpoint = 768) {
|
|
9904
|
-
const [isMobile, setIsMobile] =
|
|
9989
|
+
const [isMobile, setIsMobile] = React28.useState(() => {
|
|
9905
9990
|
if (typeof window === "undefined") {
|
|
9906
9991
|
return false;
|
|
9907
9992
|
}
|
|
9908
9993
|
return window.innerWidth < breakpoint;
|
|
9909
9994
|
});
|
|
9910
|
-
|
|
9995
|
+
React28.useEffect(() => {
|
|
9911
9996
|
function onResize() {
|
|
9912
9997
|
setIsMobile(window.innerWidth < breakpoint);
|
|
9913
9998
|
}
|
|
@@ -9937,9 +10022,9 @@ var SIDEBAR_WIDTH = "16rem";
|
|
|
9937
10022
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
9938
10023
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
9939
10024
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
9940
|
-
var SidebarContext =
|
|
10025
|
+
var SidebarContext = React28__namespace.createContext(null);
|
|
9941
10026
|
function useSidebar() {
|
|
9942
|
-
const context =
|
|
10027
|
+
const context = React28__namespace.useContext(SidebarContext);
|
|
9943
10028
|
if (!context) {
|
|
9944
10029
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
9945
10030
|
}
|
|
@@ -9955,10 +10040,10 @@ function SidebarProvider({
|
|
|
9955
10040
|
...props
|
|
9956
10041
|
}) {
|
|
9957
10042
|
const isMobile = useIsMobile();
|
|
9958
|
-
const [openMobile, setOpenMobile] =
|
|
9959
|
-
const [_open, _setOpen] =
|
|
10043
|
+
const [openMobile, setOpenMobile] = React28__namespace.useState(false);
|
|
10044
|
+
const [_open, _setOpen] = React28__namespace.useState(defaultOpen);
|
|
9960
10045
|
const open = openProp ?? _open;
|
|
9961
|
-
const setOpen =
|
|
10046
|
+
const setOpen = React28__namespace.useCallback(
|
|
9962
10047
|
(value) => {
|
|
9963
10048
|
const openState = typeof value === "function" ? value(open) : value;
|
|
9964
10049
|
if (setOpenProp) {
|
|
@@ -9970,10 +10055,10 @@ function SidebarProvider({
|
|
|
9970
10055
|
},
|
|
9971
10056
|
[setOpenProp, open]
|
|
9972
10057
|
);
|
|
9973
|
-
const toggleSidebar =
|
|
10058
|
+
const toggleSidebar = React28__namespace.useCallback(() => {
|
|
9974
10059
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
9975
10060
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
9976
|
-
|
|
10061
|
+
React28__namespace.useEffect(() => {
|
|
9977
10062
|
const handleKeyDown = (event) => {
|
|
9978
10063
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
9979
10064
|
event.preventDefault();
|
|
@@ -9984,7 +10069,7 @@ function SidebarProvider({
|
|
|
9984
10069
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
9985
10070
|
}, [toggleSidebar]);
|
|
9986
10071
|
const state = open ? "expanded" : "collapsed";
|
|
9987
|
-
const contextValue =
|
|
10072
|
+
const contextValue = React28__namespace.useMemo(
|
|
9988
10073
|
() => ({
|
|
9989
10074
|
state,
|
|
9990
10075
|
open,
|
|
@@ -10426,7 +10511,7 @@ function SidebarMenuSkeleton({
|
|
|
10426
10511
|
showIcon = false,
|
|
10427
10512
|
...props
|
|
10428
10513
|
}) {
|
|
10429
|
-
const width =
|
|
10514
|
+
const width = React28__namespace.useMemo(() => {
|
|
10430
10515
|
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
10431
10516
|
}, []);
|
|
10432
10517
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -10691,10 +10776,10 @@ var FormulaEditor = ({
|
|
|
10691
10776
|
fieldState,
|
|
10692
10777
|
mode = "edit"
|
|
10693
10778
|
}) => {
|
|
10694
|
-
const [isExpanded, setIsExpanded] =
|
|
10695
|
-
const lastEmittedValueRef =
|
|
10696
|
-
const ignorePropValueRef =
|
|
10697
|
-
const normalizedConfigs =
|
|
10779
|
+
const [isExpanded, setIsExpanded] = React28.useState(false);
|
|
10780
|
+
const lastEmittedValueRef = React28.useRef(null);
|
|
10781
|
+
const ignorePropValueRef = React28.useRef(false);
|
|
10782
|
+
const normalizedConfigs = React28.useMemo(() => {
|
|
10698
10783
|
const configsToUse = tokenConfigs?.length ? tokenConfigs : DEFAULT_TOKEN_CONFIGS;
|
|
10699
10784
|
return configsToUse.map((config) => ({
|
|
10700
10785
|
...config,
|
|
@@ -10703,18 +10788,18 @@ var FormulaEditor = ({
|
|
|
10703
10788
|
outputType: config.outputType ?? config.type
|
|
10704
10789
|
}));
|
|
10705
10790
|
}, [tokenConfigs]);
|
|
10706
|
-
const prefixMap =
|
|
10707
|
-
const configLookup =
|
|
10791
|
+
const prefixMap = React28.useMemo(() => buildPrefixMap(normalizedConfigs), [normalizedConfigs]);
|
|
10792
|
+
const configLookup = React28.useMemo(() => {
|
|
10708
10793
|
const lookup = /* @__PURE__ */ new Map();
|
|
10709
10794
|
normalizedConfigs.forEach((config) => lookup.set(config.prefix, config));
|
|
10710
10795
|
return lookup;
|
|
10711
10796
|
}, [normalizedConfigs]);
|
|
10712
|
-
const allowedOperators =
|
|
10797
|
+
const allowedOperators = React28.useMemo(() => operators.map((operator) => operator.value), [operators]);
|
|
10713
10798
|
const displayError = errorMessage ?? fieldState?.error?.message;
|
|
10714
10799
|
const hasError = Boolean(displayError);
|
|
10715
10800
|
const isEditorReadOnly = mode === "display";
|
|
10716
10801
|
const isEditorDisabled = disabled || loading || isEditorReadOnly;
|
|
10717
|
-
const convertValueToContent =
|
|
10802
|
+
const convertValueToContent = React28.useCallback(
|
|
10718
10803
|
(input) => {
|
|
10719
10804
|
if (!input) return "";
|
|
10720
10805
|
const trimmed = input.trim();
|
|
@@ -10726,8 +10811,8 @@ var FormulaEditor = ({
|
|
|
10726
10811
|
},
|
|
10727
10812
|
[configLookup, prefixMap]
|
|
10728
10813
|
);
|
|
10729
|
-
const resolvedContent =
|
|
10730
|
-
const extensions =
|
|
10814
|
+
const resolvedContent = React28.useMemo(() => convertValueToContent(value), [convertValueToContent, value]);
|
|
10815
|
+
const extensions = React28.useMemo(
|
|
10731
10816
|
() => [
|
|
10732
10817
|
StarterKit__default.default.configure({ bold: false, italic: false }),
|
|
10733
10818
|
Token.configure({ configs: normalizedConfigs, onSelect: onSelectSuggestion }),
|
|
@@ -10759,11 +10844,11 @@ var FormulaEditor = ({
|
|
|
10759
10844
|
}
|
|
10760
10845
|
}
|
|
10761
10846
|
});
|
|
10762
|
-
|
|
10847
|
+
React28.useEffect(() => {
|
|
10763
10848
|
if (!editor) return;
|
|
10764
10849
|
editor.setEditable(!isEditorDisabled);
|
|
10765
10850
|
}, [editor, isEditorDisabled]);
|
|
10766
|
-
|
|
10851
|
+
React28.useEffect(() => {
|
|
10767
10852
|
if (!editor || resolvedContent === void 0) return;
|
|
10768
10853
|
if (ignorePropValueRef.current && typeof value === "string" && value === lastEmittedValueRef.current) {
|
|
10769
10854
|
ignorePropValueRef.current = false;
|
|
@@ -10896,7 +10981,7 @@ function SortableRow({
|
|
|
10896
10981
|
id: value,
|
|
10897
10982
|
disabled: name === "columns.0.id"
|
|
10898
10983
|
});
|
|
10899
|
-
const style =
|
|
10984
|
+
const style = React28__namespace.useMemo(
|
|
10900
10985
|
() => ({
|
|
10901
10986
|
transform: utilities.CSS.Transform.toString(transform),
|
|
10902
10987
|
transition
|
|
@@ -11008,8 +11093,8 @@ var GridSettingsModal = ({
|
|
|
11008
11093
|
onClose,
|
|
11009
11094
|
onSaveColumns
|
|
11010
11095
|
}) => {
|
|
11011
|
-
const [isDragging, setIsDragging] =
|
|
11012
|
-
const scrollRef =
|
|
11096
|
+
const [isDragging, setIsDragging] = React28.useState(false);
|
|
11097
|
+
const scrollRef = React28.useRef(null);
|
|
11013
11098
|
const form = reactHookForm.useForm({
|
|
11014
11099
|
resolver: zod$1.zodResolver(GridSettingsSchema),
|
|
11015
11100
|
defaultValues: { columns: currentColumns },
|
|
@@ -11021,7 +11106,7 @@ var GridSettingsModal = ({
|
|
|
11021
11106
|
name: "columns",
|
|
11022
11107
|
keyName: "fieldId"
|
|
11023
11108
|
});
|
|
11024
|
-
|
|
11109
|
+
React28.useEffect(() => {
|
|
11025
11110
|
if (isOpen) {
|
|
11026
11111
|
form.reset({ columns: currentColumns });
|
|
11027
11112
|
}
|
|
@@ -11298,7 +11383,7 @@ function getCandidateWidths({
|
|
|
11298
11383
|
}
|
|
11299
11384
|
return DEVICE_SIZES;
|
|
11300
11385
|
}
|
|
11301
|
-
var Image2 =
|
|
11386
|
+
var Image2 = React28__namespace.forwardRef(function Image3({
|
|
11302
11387
|
src,
|
|
11303
11388
|
alt,
|
|
11304
11389
|
width,
|
|
@@ -11328,34 +11413,34 @@ var Image2 = React27__namespace.forwardRef(function Image3({
|
|
|
11328
11413
|
} = imgProps;
|
|
11329
11414
|
const widthNumber = toNumber(width);
|
|
11330
11415
|
const heightNumber = toNumber(height);
|
|
11331
|
-
|
|
11416
|
+
React28__namespace.useEffect(() => {
|
|
11332
11417
|
if (!fill && (!widthNumber || !heightNumber)) {
|
|
11333
11418
|
console.warn(
|
|
11334
11419
|
"[Image] When `fill` is false you should provide both `width` and `height` to prevent layout shifts."
|
|
11335
11420
|
);
|
|
11336
11421
|
}
|
|
11337
11422
|
}, [fill, heightNumber, widthNumber]);
|
|
11338
|
-
const candidateWidths =
|
|
11423
|
+
const candidateWidths = React28__namespace.useMemo(
|
|
11339
11424
|
() => getCandidateWidths({ width: widthNumber, sizes, fill }),
|
|
11340
11425
|
[fill, sizes, widthNumber]
|
|
11341
11426
|
);
|
|
11342
11427
|
const largestWidth = candidateWidths[candidateWidths.length - 1] ?? widthNumber ?? DEVICE_SIZES[DEVICE_SIZES.length - 1];
|
|
11343
|
-
const computedSrc =
|
|
11428
|
+
const computedSrc = React28__namespace.useMemo(() => {
|
|
11344
11429
|
if (unoptimized) {
|
|
11345
11430
|
return src;
|
|
11346
11431
|
}
|
|
11347
11432
|
return loader({ src, width: largestWidth, quality });
|
|
11348
11433
|
}, [largestWidth, loader, quality, src, unoptimized]);
|
|
11349
|
-
const computedSrcSet =
|
|
11434
|
+
const computedSrcSet = React28__namespace.useMemo(() => {
|
|
11350
11435
|
if (unoptimized) {
|
|
11351
11436
|
return void 0;
|
|
11352
11437
|
}
|
|
11353
11438
|
return candidateWidths.map((currentWidth) => `${loader({ src, width: currentWidth, quality })} ${currentWidth}w`).join(", ");
|
|
11354
11439
|
}, [candidateWidths, loader, quality, src, unoptimized]);
|
|
11355
11440
|
const sizesValue = sizes ?? (fill ? "100vw" : widthNumber ? `${widthNumber}px` : void 0);
|
|
11356
|
-
const [isLoaded, setIsLoaded] =
|
|
11357
|
-
const internalRef =
|
|
11358
|
-
const setRefs =
|
|
11441
|
+
const [isLoaded, setIsLoaded] = React28__namespace.useState(false);
|
|
11442
|
+
const internalRef = React28__namespace.useRef(null);
|
|
11443
|
+
const setRefs = React28__namespace.useCallback(
|
|
11359
11444
|
(node) => {
|
|
11360
11445
|
internalRef.current = node;
|
|
11361
11446
|
if (!ref) {
|
|
@@ -11369,7 +11454,7 @@ var Image2 = React27__namespace.forwardRef(function Image3({
|
|
|
11369
11454
|
},
|
|
11370
11455
|
[ref]
|
|
11371
11456
|
);
|
|
11372
|
-
|
|
11457
|
+
React28__namespace.useEffect(() => {
|
|
11373
11458
|
const image = internalRef.current;
|
|
11374
11459
|
if (!image) {
|
|
11375
11460
|
return;
|
|
@@ -11381,7 +11466,7 @@ var Image2 = React27__namespace.forwardRef(function Image3({
|
|
|
11381
11466
|
setIsLoaded(false);
|
|
11382
11467
|
}
|
|
11383
11468
|
}, [onLoadingComplete, src]);
|
|
11384
|
-
const handleLoad =
|
|
11469
|
+
const handleLoad = React28__namespace.useCallback(
|
|
11385
11470
|
(event) => {
|
|
11386
11471
|
setIsLoaded(true);
|
|
11387
11472
|
onLoadProp?.(event);
|
|
@@ -11393,7 +11478,7 @@ var Image2 = React27__namespace.forwardRef(function Image3({
|
|
|
11393
11478
|
const fetchPriority = priority ? "high" : fetchPriorityProp;
|
|
11394
11479
|
const decoding = decodingProp ?? "async";
|
|
11395
11480
|
const resolvedObjectFit = objectFit ?? (fill ? "cover" : void 0);
|
|
11396
|
-
const wrapperStyle =
|
|
11481
|
+
const wrapperStyle = React28__namespace.useMemo(
|
|
11397
11482
|
() => ({
|
|
11398
11483
|
position: "relative",
|
|
11399
11484
|
display: fill ? "block" : "inline-block",
|
|
@@ -11403,7 +11488,7 @@ var Image2 = React27__namespace.forwardRef(function Image3({
|
|
|
11403
11488
|
}),
|
|
11404
11489
|
[fill, height, width]
|
|
11405
11490
|
);
|
|
11406
|
-
const imageStyle =
|
|
11491
|
+
const imageStyle = React28__namespace.useMemo(
|
|
11407
11492
|
() => ({
|
|
11408
11493
|
width: fill ? "100%" : formatDimension(width) ?? void 0,
|
|
11409
11494
|
height: fill ? "100%" : formatDimension(height) ?? void 0,
|
|
@@ -11552,7 +11637,7 @@ var InfoIcon = ({ size = "1em", className, ...props }) => {
|
|
|
11552
11637
|
}
|
|
11553
11638
|
);
|
|
11554
11639
|
};
|
|
11555
|
-
var InfoIcon_default =
|
|
11640
|
+
var InfoIcon_default = React28__namespace.default.memo(InfoIcon);
|
|
11556
11641
|
var Navbar = ({
|
|
11557
11642
|
className,
|
|
11558
11643
|
title,
|
|
@@ -11577,7 +11662,7 @@ var Navbar = ({
|
|
|
11577
11662
|
}) => {
|
|
11578
11663
|
const { isMobile, isTablet, isDesktop } = useScreenSize_default();
|
|
11579
11664
|
const Icon2 = lucideReact.CircleHelp;
|
|
11580
|
-
const shouldShowSeparator = !separatorDisable &&
|
|
11665
|
+
const shouldShowSeparator = !separatorDisable && React28.isValidElement(searchButton);
|
|
11581
11666
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
11582
11667
|
"nav",
|
|
11583
11668
|
{
|
|
@@ -11588,8 +11673,8 @@ var Navbar = ({
|
|
|
11588
11673
|
children: [
|
|
11589
11674
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5", children: [
|
|
11590
11675
|
headImageURL !== "" ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: headImageURL, alt: "", className: cn("w-full h-full", headImageURLClassName) }) : /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col", children: [
|
|
11591
|
-
|
|
11592
|
-
|
|
11676
|
+
React28.isValidElement(title) ? title : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-xl font-bold", children: title }),
|
|
11677
|
+
React28.isValidElement(subTitle) ? subTitle : /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-white text-sm font-semibold", children: subTitle })
|
|
11593
11678
|
] }),
|
|
11594
11679
|
tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs(Tooltip2, { children: [
|
|
11595
11680
|
/* @__PURE__ */ jsxRuntime.jsx(TooltipTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("button", { className: "text-white hover:opacity-80 ", children: /* @__PURE__ */ jsxRuntime.jsx(InfoIcon_default, { className: "w-4" }) }) }),
|
|
@@ -11620,10 +11705,10 @@ var Navbar = ({
|
|
|
11620
11705
|
),
|
|
11621
11706
|
children: [
|
|
11622
11707
|
tooltipTitle && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
11623
|
-
|
|
11708
|
+
React28.isValidElement(tooltipIcon) ? tooltipIcon : /* @__PURE__ */ jsxRuntime.jsx(Icon2, { size: 32, "aria-hidden": "true" }),
|
|
11624
11709
|
/* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-bold", children: tooltipTitle })
|
|
11625
11710
|
] }),
|
|
11626
|
-
|
|
11711
|
+
React28.isValidElement(tooltipdescription) && tooltipdescription
|
|
11627
11712
|
]
|
|
11628
11713
|
}
|
|
11629
11714
|
),
|
|
@@ -11678,13 +11763,13 @@ var Navbar = ({
|
|
|
11678
11763
|
}
|
|
11679
11764
|
),
|
|
11680
11765
|
shouldShowSeparator && /* @__PURE__ */ jsxRuntime.jsx("div", { role: "separator", className: "ml-1 w-[1px] h-10 bg-white" }),
|
|
11681
|
-
|
|
11766
|
+
React28.isValidElement(searchButton) ? searchButton : ""
|
|
11682
11767
|
] })
|
|
11683
11768
|
]
|
|
11684
11769
|
}
|
|
11685
11770
|
);
|
|
11686
11771
|
};
|
|
11687
|
-
var navbar_default =
|
|
11772
|
+
var navbar_default = React28__namespace.default.memo(Navbar);
|
|
11688
11773
|
var usePreventPageLeaveStore = zustand.create((set) => ({
|
|
11689
11774
|
isPreventing: false,
|
|
11690
11775
|
setPreventing: (value) => set({ isPreventing: value })
|
|
@@ -11694,7 +11779,7 @@ var usePreventPageLeaveStore_default = usePreventPageLeaveStore;
|
|
|
11694
11779
|
// src/components/prevent-page-leave/PreventPageLeave.tsx
|
|
11695
11780
|
var PreventPageLeave = ({ children }) => {
|
|
11696
11781
|
const { isPreventing } = usePreventPageLeaveStore();
|
|
11697
|
-
|
|
11782
|
+
React28.useEffect(() => {
|
|
11698
11783
|
if (!isPreventing || typeof window === "undefined") {
|
|
11699
11784
|
return;
|
|
11700
11785
|
}
|
|
@@ -11712,7 +11797,7 @@ var PreventPageLeave = ({ children }) => {
|
|
|
11712
11797
|
var PreventPageLeave_default = PreventPageLeave;
|
|
11713
11798
|
var usePreventPageLeave = ({ isPrevening }) => {
|
|
11714
11799
|
const setPreventing = usePreventPageLeaveStore_default((state) => state.setPreventing);
|
|
11715
|
-
|
|
11800
|
+
React28.useEffect(() => {
|
|
11716
11801
|
setPreventing(isPrevening);
|
|
11717
11802
|
}, [isPrevening, setPreventing]);
|
|
11718
11803
|
};
|
|
@@ -11724,7 +11809,7 @@ var DefaultHeader = ({
|
|
|
11724
11809
|
classNames,
|
|
11725
11810
|
rightActions
|
|
11726
11811
|
}) => {
|
|
11727
|
-
const titleRef =
|
|
11812
|
+
const titleRef = React28__namespace.useRef(null);
|
|
11728
11813
|
const isTruncated = useTruncated_default({ elementRef: titleRef });
|
|
11729
11814
|
const textElement = title ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11730
11815
|
"span",
|
|
@@ -11942,20 +12027,20 @@ var CropperModal = ({
|
|
|
11942
12027
|
title,
|
|
11943
12028
|
props
|
|
11944
12029
|
}) => {
|
|
11945
|
-
const [isLoading, setIsLoading] =
|
|
11946
|
-
const [crop, setCrop] =
|
|
11947
|
-
const [zoom, setZoom] =
|
|
11948
|
-
const [croppedAreaPixels, setCroppedAreaPixels] =
|
|
11949
|
-
const handleClose =
|
|
12030
|
+
const [isLoading, setIsLoading] = React28.useState(false);
|
|
12031
|
+
const [crop, setCrop] = React28.useState({ x: 0, y: 0 });
|
|
12032
|
+
const [zoom, setZoom] = React28.useState();
|
|
12033
|
+
const [croppedAreaPixels, setCroppedAreaPixels] = React28.useState(null);
|
|
12034
|
+
const handleClose = React28.useCallback(() => {
|
|
11950
12035
|
onOpenChange(false);
|
|
11951
12036
|
}, [onOpenChange]);
|
|
11952
|
-
const handleCancel =
|
|
12037
|
+
const handleCancel = React28.useCallback(() => {
|
|
11953
12038
|
if (onCancel) {
|
|
11954
12039
|
onCancel();
|
|
11955
12040
|
}
|
|
11956
12041
|
handleClose();
|
|
11957
12042
|
}, [handleClose, onCancel]);
|
|
11958
|
-
const handleCropComplete =
|
|
12043
|
+
const handleCropComplete = React28.useCallback((_, croppedAreaPixels2) => {
|
|
11959
12044
|
setCroppedAreaPixels(croppedAreaPixels2);
|
|
11960
12045
|
}, []);
|
|
11961
12046
|
const handleConfirm = async () => {
|
|
@@ -12063,7 +12148,7 @@ function isFragment(object) {
|
|
|
12063
12148
|
var isValidText = (val) => ["string", "number"].includes(typeof val);
|
|
12064
12149
|
function toArray(children, option = {}) {
|
|
12065
12150
|
let ret = [];
|
|
12066
|
-
|
|
12151
|
+
React28__namespace.Children.forEach(children, (child) => {
|
|
12067
12152
|
if ((child === void 0 || child === null) && !option.keepEmpty) {
|
|
12068
12153
|
return;
|
|
12069
12154
|
}
|
|
@@ -12077,9 +12162,9 @@ function toArray(children, option = {}) {
|
|
|
12077
12162
|
});
|
|
12078
12163
|
return ret;
|
|
12079
12164
|
}
|
|
12080
|
-
var MeasureText =
|
|
12081
|
-
const spanRef =
|
|
12082
|
-
|
|
12165
|
+
var MeasureText = React28__namespace.forwardRef(({ style, children }, ref) => {
|
|
12166
|
+
const spanRef = React28__namespace.useRef(null);
|
|
12167
|
+
React28__namespace.useImperativeHandle(ref, () => ({
|
|
12083
12168
|
isExceed: () => {
|
|
12084
12169
|
const span = spanRef.current;
|
|
12085
12170
|
return span.scrollHeight > span.clientHeight;
|
|
@@ -12137,19 +12222,19 @@ var lineClipStyle = {
|
|
|
12137
12222
|
};
|
|
12138
12223
|
function EllipsisMeasure(props) {
|
|
12139
12224
|
const { enableMeasure, width, text, children, rows, expanded, miscDeps, onEllipsis } = props;
|
|
12140
|
-
const nodeList =
|
|
12141
|
-
const nodeLen =
|
|
12142
|
-
const fullContent =
|
|
12143
|
-
const [ellipsisCutIndex, setEllipsisCutIndex] =
|
|
12144
|
-
const cutMidRef =
|
|
12145
|
-
const measureWhiteSpaceRef =
|
|
12146
|
-
const needEllipsisRef =
|
|
12147
|
-
const descRowsEllipsisRef =
|
|
12148
|
-
const symbolRowEllipsisRef =
|
|
12149
|
-
const [canEllipsis, setCanEllipsis] =
|
|
12150
|
-
const [needEllipsis, setNeedEllipsis] =
|
|
12151
|
-
const [ellipsisHeight, setEllipsisHeight] =
|
|
12152
|
-
const [parentWhiteSpace, setParentWhiteSpace] =
|
|
12225
|
+
const nodeList = React28__namespace.useMemo(() => toArray(text), [text]);
|
|
12226
|
+
const nodeLen = React28__namespace.useMemo(() => getNodesLen(nodeList), [text]);
|
|
12227
|
+
const fullContent = React28__namespace.useMemo(() => children(nodeList, false), [text]);
|
|
12228
|
+
const [ellipsisCutIndex, setEllipsisCutIndex] = React28__namespace.useState(null);
|
|
12229
|
+
const cutMidRef = React28__namespace.useRef(null);
|
|
12230
|
+
const measureWhiteSpaceRef = React28__namespace.useRef(null);
|
|
12231
|
+
const needEllipsisRef = React28__namespace.useRef(null);
|
|
12232
|
+
const descRowsEllipsisRef = React28__namespace.useRef(null);
|
|
12233
|
+
const symbolRowEllipsisRef = React28__namespace.useRef(null);
|
|
12234
|
+
const [canEllipsis, setCanEllipsis] = React28__namespace.useState(false);
|
|
12235
|
+
const [needEllipsis, setNeedEllipsis] = React28__namespace.useState(STATUS_MEASURE_NONE);
|
|
12236
|
+
const [ellipsisHeight, setEllipsisHeight] = React28__namespace.useState(0);
|
|
12237
|
+
const [parentWhiteSpace, setParentWhiteSpace] = React28__namespace.useState(null);
|
|
12153
12238
|
useIsomorphicLayoutEffect(() => {
|
|
12154
12239
|
if (enableMeasure && width && nodeLen) {
|
|
12155
12240
|
setNeedEllipsis(STATUS_MEASURE_PREPARE);
|
|
@@ -12192,7 +12277,7 @@ function EllipsisMeasure(props) {
|
|
|
12192
12277
|
setEllipsisCutIndex(isOverflow ? [minIndex, targetMidIndex] : [targetMidIndex, maxIndex]);
|
|
12193
12278
|
}
|
|
12194
12279
|
}, [ellipsisCutIndex, cutMidIndex]);
|
|
12195
|
-
const finalContent =
|
|
12280
|
+
const finalContent = React28__namespace.useMemo(() => {
|
|
12196
12281
|
if (!enableMeasure) {
|
|
12197
12282
|
return children(nodeList, false);
|
|
12198
12283
|
}
|
|
@@ -12283,10 +12368,10 @@ var Truncated = ({
|
|
|
12283
12368
|
tooltipProps,
|
|
12284
12369
|
tooltipContentProps
|
|
12285
12370
|
}) => {
|
|
12286
|
-
const elementRef =
|
|
12287
|
-
const [open, setOpen] =
|
|
12288
|
-
const [isTruncated, setIsTruncated] =
|
|
12289
|
-
const [measureWidth, setMeasureWidth] =
|
|
12371
|
+
const elementRef = React28__namespace.useRef(null);
|
|
12372
|
+
const [open, setOpen] = React28__namespace.useState(false);
|
|
12373
|
+
const [isTruncated, setIsTruncated] = React28__namespace.useState(false);
|
|
12374
|
+
const [measureWidth, setMeasureWidth] = React28__namespace.useState(0);
|
|
12290
12375
|
const Comp = as;
|
|
12291
12376
|
const normalizedChildren = typeof children === "string" ? children.replace(/>/g, ">\u200B") : children;
|
|
12292
12377
|
const lineClampLines = typeof ellipsis === "number" ? ellipsis : typeof ellipsis === "object" ? ellipsis?.lineClamp ?? 3 : null;
|
|
@@ -12311,13 +12396,13 @@ var Truncated = ({
|
|
|
12311
12396
|
setIsTruncated(false);
|
|
12312
12397
|
}
|
|
12313
12398
|
}, [enableMeasure]);
|
|
12314
|
-
const truncationClass =
|
|
12399
|
+
const truncationClass = React28__namespace.useMemo(() => {
|
|
12315
12400
|
if (!ellipsis) return "";
|
|
12316
12401
|
if (typeof ellipsis === "number") return `line-clamp-${ellipsis}`;
|
|
12317
12402
|
if (typeof ellipsis === "object") return `line-clamp-${lineClampLines ?? 3}`;
|
|
12318
12403
|
return "truncate";
|
|
12319
12404
|
}, [ellipsis, lineClampLines]);
|
|
12320
|
-
const clampedStyle =
|
|
12405
|
+
const clampedStyle = React28__namespace.useMemo(() => {
|
|
12321
12406
|
if (!lineClampLines) return style;
|
|
12322
12407
|
return {
|
|
12323
12408
|
...style,
|
|
@@ -12379,7 +12464,7 @@ var Truncated = ({
|
|
|
12379
12464
|
);
|
|
12380
12465
|
};
|
|
12381
12466
|
var truncated_default = Truncated;
|
|
12382
|
-
var InputPrimitive2 =
|
|
12467
|
+
var InputPrimitive2 = React28__namespace.forwardRef(
|
|
12383
12468
|
({ className, type = "text", ...props }, ref) => {
|
|
12384
12469
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12385
12470
|
"input",
|
|
@@ -12418,7 +12503,7 @@ var inputVariants2 = classVarianceAuthority.cva("", {
|
|
|
12418
12503
|
appearance: "filled"
|
|
12419
12504
|
}
|
|
12420
12505
|
});
|
|
12421
|
-
var Input2 =
|
|
12506
|
+
var Input2 = React28__namespace.forwardRef(
|
|
12422
12507
|
({
|
|
12423
12508
|
className,
|
|
12424
12509
|
wrapperClassName,
|
|
@@ -12451,8 +12536,8 @@ var Input2 = React27__namespace.forwardRef(
|
|
|
12451
12536
|
onChange: onChangeProp
|
|
12452
12537
|
} = rest;
|
|
12453
12538
|
const ariaInvalid = invalid ?? ariaInvalidProp;
|
|
12454
|
-
const messageId =
|
|
12455
|
-
const handleChange =
|
|
12539
|
+
const messageId = React28__namespace.useId();
|
|
12540
|
+
const handleChange = React28__namespace.useCallback(
|
|
12456
12541
|
(event) => {
|
|
12457
12542
|
onChangeProp?.(event);
|
|
12458
12543
|
onValueChange?.(event.target.value);
|
|
@@ -12567,11 +12652,11 @@ var InputNumber = ({
|
|
|
12567
12652
|
onBlur,
|
|
12568
12653
|
...props
|
|
12569
12654
|
}) => {
|
|
12570
|
-
const [internalValue, setInternalValue] =
|
|
12655
|
+
const [internalValue, setInternalValue] = React28__namespace.useState(
|
|
12571
12656
|
() => parseToNumber(value) ?? parseToNumber(defaultValue)
|
|
12572
12657
|
);
|
|
12573
|
-
const [stepperChanged, setStepperChanged] =
|
|
12574
|
-
|
|
12658
|
+
const [stepperChanged, setStepperChanged] = React28__namespace.useState(false);
|
|
12659
|
+
React28__namespace.useEffect(() => {
|
|
12575
12660
|
const parsed = parseToNumber(value);
|
|
12576
12661
|
if (parsed !== void 0) setInternalValue(parsed);
|
|
12577
12662
|
}, [value]);
|
|
@@ -12703,8 +12788,8 @@ var ActionMenu = ({
|
|
|
12703
12788
|
actionButtonClassName,
|
|
12704
12789
|
separatorClassName
|
|
12705
12790
|
}) => {
|
|
12706
|
-
const [open, setOpen] =
|
|
12707
|
-
const isAllowed =
|
|
12791
|
+
const [open, setOpen] = React28.useState(false);
|
|
12792
|
+
const isAllowed = React28.useCallback(
|
|
12708
12793
|
(requiredPermission) => {
|
|
12709
12794
|
if (!checkPermissionFunc || requiredPermission === void 0) {
|
|
12710
12795
|
return true;
|
|
@@ -12713,7 +12798,7 @@ var ActionMenu = ({
|
|
|
12713
12798
|
},
|
|
12714
12799
|
[checkPermissionFunc]
|
|
12715
12800
|
);
|
|
12716
|
-
const filteredButtons =
|
|
12801
|
+
const filteredButtons = React28.useMemo(() => {
|
|
12717
12802
|
return buttons.filter((btn) => isAllowed(btn.requiredPermission));
|
|
12718
12803
|
}, [buttons, isAllowed]);
|
|
12719
12804
|
if (buttons.length === 0) {
|
|
@@ -12969,13 +13054,13 @@ var useFieldNames = ({
|
|
|
12969
13054
|
fieldNames
|
|
12970
13055
|
}) => {
|
|
12971
13056
|
const { label: labelFieldKey = "label", value: valueFieldKey = "value" } = fieldNames || {};
|
|
12972
|
-
const getLabelField =
|
|
13057
|
+
const getLabelField = React28__namespace.default.useCallback(
|
|
12973
13058
|
(option) => {
|
|
12974
13059
|
return option?.[labelFieldKey];
|
|
12975
13060
|
},
|
|
12976
13061
|
[labelFieldKey]
|
|
12977
13062
|
);
|
|
12978
|
-
const getValueField =
|
|
13063
|
+
const getValueField = React28__namespace.default.useCallback(
|
|
12979
13064
|
(option) => {
|
|
12980
13065
|
return option?.[valueFieldKey];
|
|
12981
13066
|
},
|
|
@@ -13007,11 +13092,11 @@ var VirtualizedCommand = ({
|
|
|
13007
13092
|
onFocus
|
|
13008
13093
|
}) => {
|
|
13009
13094
|
const { getLabelField, getValueField } = useFieldNames_default({ fieldNames });
|
|
13010
|
-
const internalOptions =
|
|
13011
|
-
const [filteredOptions, setFilteredOptions] =
|
|
13012
|
-
const [focusedIndex, setFocusedIndex] =
|
|
13013
|
-
const [isKeyboardNavActive, setIsKeyboardNavActive] =
|
|
13014
|
-
const parentRef =
|
|
13095
|
+
const internalOptions = React28__namespace.useMemo(() => options ?? [], [options]);
|
|
13096
|
+
const [filteredOptions, setFilteredOptions] = React28__namespace.useState(internalOptions);
|
|
13097
|
+
const [focusedIndex, setFocusedIndex] = React28__namespace.useState(0);
|
|
13098
|
+
const [isKeyboardNavActive, setIsKeyboardNavActive] = React28__namespace.useState(false);
|
|
13099
|
+
const parentRef = React28__namespace.useRef(null);
|
|
13015
13100
|
const virtualizer = reactVirtual.useVirtualizer({
|
|
13016
13101
|
count: filteredOptions.length,
|
|
13017
13102
|
getScrollElement: () => parentRef.current,
|
|
@@ -13019,14 +13104,14 @@ var VirtualizedCommand = ({
|
|
|
13019
13104
|
overscan: 2
|
|
13020
13105
|
});
|
|
13021
13106
|
const virtualOptions = virtualizer.getVirtualItems();
|
|
13022
|
-
const dynamicHeight =
|
|
13107
|
+
const dynamicHeight = React28__namespace.useMemo(() => {
|
|
13023
13108
|
const contentHeight = filteredOptions.length * ROW_HEIGHT;
|
|
13024
13109
|
if (contentHeight <= 0) {
|
|
13025
13110
|
return MIN_HEIGHT_EMPTY;
|
|
13026
13111
|
}
|
|
13027
13112
|
return Math.max(ROW_HEIGHT, Math.min(height, contentHeight));
|
|
13028
13113
|
}, [filteredOptions.length, height]);
|
|
13029
|
-
const scrollToIndex =
|
|
13114
|
+
const scrollToIndex = React28__namespace.useCallback(
|
|
13030
13115
|
(index) => {
|
|
13031
13116
|
virtualizer.scrollToIndex(index, {
|
|
13032
13117
|
align: "center"
|
|
@@ -13034,7 +13119,7 @@ var VirtualizedCommand = ({
|
|
|
13034
13119
|
},
|
|
13035
13120
|
[virtualizer]
|
|
13036
13121
|
);
|
|
13037
|
-
const handleSearch =
|
|
13122
|
+
const handleSearch = React28__namespace.useCallback(
|
|
13038
13123
|
(search) => {
|
|
13039
13124
|
setIsKeyboardNavActive(false);
|
|
13040
13125
|
setFilteredOptions(
|
|
@@ -13049,7 +13134,7 @@ var VirtualizedCommand = ({
|
|
|
13049
13134
|
},
|
|
13050
13135
|
[filterOption, getLabelField, internalOptions]
|
|
13051
13136
|
);
|
|
13052
|
-
const handleKeyDown =
|
|
13137
|
+
const handleKeyDown = React28__namespace.useCallback(
|
|
13053
13138
|
(event) => {
|
|
13054
13139
|
switch (event.key) {
|
|
13055
13140
|
case "ArrowDown": {
|
|
@@ -13084,7 +13169,7 @@ var VirtualizedCommand = ({
|
|
|
13084
13169
|
},
|
|
13085
13170
|
[filteredOptions, focusedIndex, getValueField, onSelect, scrollToIndex]
|
|
13086
13171
|
);
|
|
13087
|
-
|
|
13172
|
+
React28__namespace.useEffect(() => {
|
|
13088
13173
|
if (value) {
|
|
13089
13174
|
const option = filteredOptions.find((option2) => {
|
|
13090
13175
|
const optionValue = getValueField(option2);
|
|
@@ -13211,13 +13296,13 @@ var ComboboxInner = ({
|
|
|
13211
13296
|
defaultValue,
|
|
13212
13297
|
value
|
|
13213
13298
|
});
|
|
13214
|
-
const currentSelectedOption =
|
|
13299
|
+
const currentSelectedOption = React28__namespace.useMemo(() => {
|
|
13215
13300
|
return options?.find((option) => {
|
|
13216
13301
|
const optionValue = getValueField(option);
|
|
13217
13302
|
return optionValue === selectedValue;
|
|
13218
13303
|
});
|
|
13219
13304
|
}, [getValueField, options, selectedValue]);
|
|
13220
|
-
const renderValue =
|
|
13305
|
+
const renderValue = React28__namespace.useMemo(() => {
|
|
13221
13306
|
if (!selectedValue) return placeholder2;
|
|
13222
13307
|
if (currentSelectedOption) {
|
|
13223
13308
|
return getLabelField(currentSelectedOption);
|
|
@@ -13227,7 +13312,7 @@ var ComboboxInner = ({
|
|
|
13227
13312
|
}
|
|
13228
13313
|
return null;
|
|
13229
13314
|
}, [currentSelectedOption, getLabelField, placeholder2, selectedValue, showValueWhenNoMatch]);
|
|
13230
|
-
const handleSelect =
|
|
13315
|
+
const handleSelect = React28__namespace.useCallback(
|
|
13231
13316
|
(selected, option) => {
|
|
13232
13317
|
setSelectedValue(selected);
|
|
13233
13318
|
setOpenPopover(false);
|
|
@@ -13240,7 +13325,7 @@ var ComboboxInner = ({
|
|
|
13240
13325
|
},
|
|
13241
13326
|
[onOpenChange, onSelect, setOpenPopover, setSelectedValue]
|
|
13242
13327
|
);
|
|
13243
|
-
const handleOpenPopover =
|
|
13328
|
+
const handleOpenPopover = React28__namespace.useCallback(
|
|
13244
13329
|
(isOpen) => {
|
|
13245
13330
|
if (disabled) return;
|
|
13246
13331
|
setOpenPopover(isOpen);
|
|
@@ -13250,7 +13335,7 @@ var ComboboxInner = ({
|
|
|
13250
13335
|
},
|
|
13251
13336
|
[disabled, onOpenChange, setOpenPopover]
|
|
13252
13337
|
);
|
|
13253
|
-
const handleClear =
|
|
13338
|
+
const handleClear = React28__namespace.useCallback(
|
|
13254
13339
|
(event) => {
|
|
13255
13340
|
event.stopPropagation();
|
|
13256
13341
|
setSelectedValue(void 0);
|
|
@@ -13339,7 +13424,7 @@ var ComboboxInner = ({
|
|
|
13339
13424
|
)
|
|
13340
13425
|
] });
|
|
13341
13426
|
};
|
|
13342
|
-
var Combobox =
|
|
13427
|
+
var Combobox = React28__namespace.forwardRef(ComboboxInner);
|
|
13343
13428
|
var Combobox_default = Combobox;
|
|
13344
13429
|
var TruncatedMouseEnterDiv = ({
|
|
13345
13430
|
value,
|
|
@@ -13348,8 +13433,8 @@ var TruncatedMouseEnterDiv = ({
|
|
|
13348
13433
|
tooltipContentProps,
|
|
13349
13434
|
arrowClassName
|
|
13350
13435
|
}) => {
|
|
13351
|
-
const textRef =
|
|
13352
|
-
const [isTruncated, setIsTruncated] =
|
|
13436
|
+
const textRef = React28.useRef(null);
|
|
13437
|
+
const [isTruncated, setIsTruncated] = React28.useState(false);
|
|
13353
13438
|
const checkTruncation = () => {
|
|
13354
13439
|
if (textRef.current) {
|
|
13355
13440
|
const { scrollWidth, clientWidth } = textRef.current;
|
|
@@ -13409,8 +13494,8 @@ var TabSelect = ({
|
|
|
13409
13494
|
separatorClassName,
|
|
13410
13495
|
...rest
|
|
13411
13496
|
}) => {
|
|
13412
|
-
const [selected, setSelected] =
|
|
13413
|
-
|
|
13497
|
+
const [selected, setSelected] = React28.useState(items[0]);
|
|
13498
|
+
React28.useEffect(() => {
|
|
13414
13499
|
onSelectTab(selected.id);
|
|
13415
13500
|
}, [onSelectTab, selected]);
|
|
13416
13501
|
if (items.length === 0) {
|
|
@@ -13514,6 +13599,7 @@ exports.ErrorCreateCanvas = ErrorCreateCanvas;
|
|
|
13514
13599
|
exports.ErrorGeneratingBlob = ErrorGeneratingBlob;
|
|
13515
13600
|
exports.ErrorInvalidSVG = ErrorInvalidSVG;
|
|
13516
13601
|
exports.ErrorSVGExceedSize = ErrorSVGExceedSize;
|
|
13602
|
+
exports.FactoryIcon = factory_default;
|
|
13517
13603
|
exports.FiltersIcon = filters_default;
|
|
13518
13604
|
exports.Form = Form;
|
|
13519
13605
|
exports.FormControl = FormControl;
|