@easyvision/easyvision-ui 1.7.6 → 1.8.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/README.md +86 -0
- package/dist/easyvision.css +51 -0
- package/dist/index.cjs +254 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -1
- package/dist/index.d.ts +59 -1
- package/dist/index.js +152 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require('./easyvision.css');
|
|
4
4
|
require('./EasyVisionTable.css');
|
|
5
|
-
var
|
|
5
|
+
var React9 = require('react');
|
|
6
6
|
var lucideReact = require('lucide-react');
|
|
7
7
|
var clsx = require('clsx');
|
|
8
8
|
var tailwindMerge = require('tailwind-merge');
|
|
@@ -39,7 +39,7 @@ function _interopNamespace(e) {
|
|
|
39
39
|
return Object.freeze(n);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
var
|
|
42
|
+
var React9__namespace = /*#__PURE__*/_interopNamespace(React9);
|
|
43
43
|
var SelectPrimitive__namespace = /*#__PURE__*/_interopNamespace(SelectPrimitive);
|
|
44
44
|
var PopoverPrimitive__namespace = /*#__PURE__*/_interopNamespace(PopoverPrimitive);
|
|
45
45
|
var CheckboxPrimitive__namespace = /*#__PURE__*/_interopNamespace(CheckboxPrimitive);
|
|
@@ -49,7 +49,7 @@ var DropdownMenuPrimitive__namespace = /*#__PURE__*/_interopNamespace(DropdownMe
|
|
|
49
49
|
function cn(...inputs) {
|
|
50
50
|
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
51
51
|
}
|
|
52
|
-
var Input =
|
|
52
|
+
var Input = React9__namespace.forwardRef(
|
|
53
53
|
({ className, type, ...props }, ref) => {
|
|
54
54
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
55
55
|
"input",
|
|
@@ -113,26 +113,26 @@ var KIND_SUFFIX = {
|
|
|
113
113
|
var fullIdOf = (id, kind) => `${id}${KIND_SUFFIX[kind]}`;
|
|
114
114
|
var childIdOf = (parentFullId, childLocalId) => `${parentFullId}.${childLocalId}`;
|
|
115
115
|
var childFullIdOf = (parentFullId, childLocalId, childKind) => parentFullId ? `${childIdOf(parentFullId, childLocalId)}${KIND_SUFFIX[childKind]}` : fullIdOf(childLocalId, childKind);
|
|
116
|
-
var NamespaceContext =
|
|
116
|
+
var NamespaceContext = React9.createContext(null);
|
|
117
117
|
function NamespaceProvider({
|
|
118
118
|
fullId,
|
|
119
119
|
children
|
|
120
120
|
}) {
|
|
121
121
|
return /* @__PURE__ */ jsxRuntime.jsx(NamespaceContext.Provider, { value: fullId, children });
|
|
122
122
|
}
|
|
123
|
-
var useParentFullId = () =>
|
|
123
|
+
var useParentFullId = () => React9.useContext(NamespaceContext);
|
|
124
124
|
|
|
125
125
|
// store/useEasyVisionSlice.ts
|
|
126
126
|
function useEasyVisionSlice(kind, localId, opts) {
|
|
127
127
|
const parentFullId = useParentFullId();
|
|
128
|
-
const fullId =
|
|
128
|
+
const fullId = React9.useMemo(
|
|
129
129
|
() => childFullIdOf(parentFullId, localId, kind),
|
|
130
130
|
[parentFullId, localId, kind]
|
|
131
131
|
);
|
|
132
132
|
if (!easyVisionRegistry.getState().slices[fullId]) {
|
|
133
133
|
easyVisionRegistry.getState().ensure(kind, fullId, opts.init);
|
|
134
134
|
}
|
|
135
|
-
const slice =
|
|
135
|
+
const slice = React9.useSyncExternalStore(
|
|
136
136
|
easyVisionRegistry.subscribe,
|
|
137
137
|
() => {
|
|
138
138
|
const s = easyVisionRegistry.getState().slices[fullId];
|
|
@@ -141,27 +141,27 @@ function useEasyVisionSlice(kind, localId, opts) {
|
|
|
141
141
|
},
|
|
142
142
|
() => easyVisionRegistry.getState().ensure(kind, fullId, opts.init)
|
|
143
143
|
);
|
|
144
|
-
|
|
144
|
+
React9.useEffect(() => {
|
|
145
145
|
if (opts.clearWhen && opts.clearWhen(slice)) {
|
|
146
146
|
easyVisionRegistry.getState().drop(fullId);
|
|
147
147
|
easyVisionRegistry.getState().ensure(kind, fullId, opts.init);
|
|
148
148
|
}
|
|
149
149
|
}, [slice, fullId, kind, opts]);
|
|
150
|
-
|
|
150
|
+
React9.useEffect(() => {
|
|
151
151
|
opts.onStateChange?.(slice);
|
|
152
152
|
}, [slice]);
|
|
153
|
-
|
|
153
|
+
React9.useEffect(() => {
|
|
154
154
|
return () => {
|
|
155
155
|
if (!opts.persist) {
|
|
156
156
|
easyVisionRegistry.getState().drop(fullId);
|
|
157
157
|
}
|
|
158
158
|
};
|
|
159
159
|
}, [fullId]);
|
|
160
|
-
const patch =
|
|
160
|
+
const patch = React9.useMemo(
|
|
161
161
|
() => (partial) => easyVisionRegistry.getState().patch(fullId, partial),
|
|
162
162
|
[fullId]
|
|
163
163
|
);
|
|
164
|
-
const reset =
|
|
164
|
+
const reset = React9.useMemo(
|
|
165
165
|
() => () => {
|
|
166
166
|
easyVisionRegistry.getState().drop(fullId);
|
|
167
167
|
easyVisionRegistry.getState().ensure(kind, fullId, opts.init);
|
|
@@ -171,8 +171,8 @@ function useEasyVisionSlice(kind, localId, opts) {
|
|
|
171
171
|
return { fullId, slice, patch, reset };
|
|
172
172
|
}
|
|
173
173
|
function useDebouncedValue(value, delayMs) {
|
|
174
|
-
const [debounced, setDebounced] =
|
|
175
|
-
|
|
174
|
+
const [debounced, setDebounced] = React9.useState(value);
|
|
175
|
+
React9.useEffect(() => {
|
|
176
176
|
if (delayMs <= 0) {
|
|
177
177
|
setDebounced(value);
|
|
178
178
|
return;
|
|
@@ -205,8 +205,8 @@ function EasyVisionInput({
|
|
|
205
205
|
onStateChange: onStateChange ? (s) => onStateChange(s.value) : void 0
|
|
206
206
|
});
|
|
207
207
|
const debounced = useDebouncedValue(slice.value, debounceMs);
|
|
208
|
-
const lastEmittedRef =
|
|
209
|
-
|
|
208
|
+
const lastEmittedRef = React9.useRef(slice.value);
|
|
209
|
+
React9.useEffect(() => {
|
|
210
210
|
if (debounced !== lastEmittedRef.current) {
|
|
211
211
|
lastEmittedRef.current = debounced;
|
|
212
212
|
onChange?.(debounced);
|
|
@@ -257,7 +257,7 @@ function EasyVisionInput({
|
|
|
257
257
|
}
|
|
258
258
|
var Select = SelectPrimitive__namespace.Root;
|
|
259
259
|
var SelectValue = SelectPrimitive__namespace.Value;
|
|
260
|
-
var SelectTrigger =
|
|
260
|
+
var SelectTrigger = React9__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
261
261
|
SelectPrimitive__namespace.Trigger,
|
|
262
262
|
{
|
|
263
263
|
ref,
|
|
@@ -270,7 +270,7 @@ var SelectTrigger = React8__namespace.forwardRef(({ className, children, ...prop
|
|
|
270
270
|
}
|
|
271
271
|
));
|
|
272
272
|
SelectTrigger.displayName = SelectPrimitive__namespace.Trigger.displayName;
|
|
273
|
-
var SelectScrollUpButton =
|
|
273
|
+
var SelectScrollUpButton = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
274
274
|
SelectPrimitive__namespace.ScrollUpButton,
|
|
275
275
|
{
|
|
276
276
|
ref,
|
|
@@ -280,7 +280,7 @@ var SelectScrollUpButton = React8__namespace.forwardRef(({ className, ...props }
|
|
|
280
280
|
}
|
|
281
281
|
));
|
|
282
282
|
SelectScrollUpButton.displayName = SelectPrimitive__namespace.ScrollUpButton.displayName;
|
|
283
|
-
var SelectScrollDownButton =
|
|
283
|
+
var SelectScrollDownButton = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
284
284
|
SelectPrimitive__namespace.ScrollDownButton,
|
|
285
285
|
{
|
|
286
286
|
ref,
|
|
@@ -290,7 +290,7 @@ var SelectScrollDownButton = React8__namespace.forwardRef(({ className, ...props
|
|
|
290
290
|
}
|
|
291
291
|
));
|
|
292
292
|
SelectScrollDownButton.displayName = SelectPrimitive__namespace.ScrollDownButton.displayName;
|
|
293
|
-
var SelectContent =
|
|
293
|
+
var SelectContent = React9__namespace.forwardRef(({ className, children, position = "popper", ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(SelectPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
294
294
|
SelectPrimitive__namespace.Content,
|
|
295
295
|
{
|
|
296
296
|
ref,
|
|
@@ -314,7 +314,7 @@ var SelectContent = React8__namespace.forwardRef(({ className, children, positio
|
|
|
314
314
|
}
|
|
315
315
|
) }));
|
|
316
316
|
SelectContent.displayName = SelectPrimitive__namespace.Content.displayName;
|
|
317
|
-
var SelectLabel =
|
|
317
|
+
var SelectLabel = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
318
318
|
SelectPrimitive__namespace.Label,
|
|
319
319
|
{
|
|
320
320
|
ref,
|
|
@@ -323,7 +323,7 @@ var SelectLabel = React8__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
323
323
|
}
|
|
324
324
|
));
|
|
325
325
|
SelectLabel.displayName = SelectPrimitive__namespace.Label.displayName;
|
|
326
|
-
var SelectItem =
|
|
326
|
+
var SelectItem = React9__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
327
327
|
SelectPrimitive__namespace.Item,
|
|
328
328
|
{
|
|
329
329
|
ref,
|
|
@@ -336,7 +336,7 @@ var SelectItem = React8__namespace.forwardRef(({ className, children, ...props }
|
|
|
336
336
|
}
|
|
337
337
|
));
|
|
338
338
|
SelectItem.displayName = SelectPrimitive__namespace.Item.displayName;
|
|
339
|
-
var SelectSeparator =
|
|
339
|
+
var SelectSeparator = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
340
340
|
SelectPrimitive__namespace.Separator,
|
|
341
341
|
{
|
|
342
342
|
ref,
|
|
@@ -367,7 +367,7 @@ var buttonVariants = classVarianceAuthority.cva("ev-btn", {
|
|
|
367
367
|
size: "default"
|
|
368
368
|
}
|
|
369
369
|
});
|
|
370
|
-
var Button =
|
|
370
|
+
var Button = React9__namespace.forwardRef(
|
|
371
371
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
372
372
|
const Comp = asChild ? reactSlot.Slot : "button";
|
|
373
373
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -383,7 +383,7 @@ var Button = React8__namespace.forwardRef(
|
|
|
383
383
|
Button.displayName = "Button";
|
|
384
384
|
var Popover = PopoverPrimitive__namespace.Root;
|
|
385
385
|
var PopoverTrigger = PopoverPrimitive__namespace.Trigger;
|
|
386
|
-
var PopoverContent =
|
|
386
|
+
var PopoverContent = React9__namespace.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(PopoverPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
387
387
|
PopoverPrimitive__namespace.Content,
|
|
388
388
|
{
|
|
389
389
|
ref,
|
|
@@ -394,7 +394,7 @@ var PopoverContent = React8__namespace.forwardRef(({ className, align = "center"
|
|
|
394
394
|
}
|
|
395
395
|
) }));
|
|
396
396
|
PopoverContent.displayName = PopoverPrimitive__namespace.Content.displayName;
|
|
397
|
-
var Command =
|
|
397
|
+
var Command = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
398
398
|
cmdk.Command,
|
|
399
399
|
{
|
|
400
400
|
ref,
|
|
@@ -403,7 +403,7 @@ var Command = React8__namespace.forwardRef(({ className, ...props }, ref) => /*
|
|
|
403
403
|
}
|
|
404
404
|
));
|
|
405
405
|
Command.displayName = cmdk.Command.displayName;
|
|
406
|
-
var CommandInput =
|
|
406
|
+
var CommandInput = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ev-cmd-input-wrapper", "cmdk-input-wrapper": "", children: [
|
|
407
407
|
/* @__PURE__ */ jsxRuntime.jsx(reactIcons.MagnifyingGlassIcon, { className: "ev-cmd-input-icon" }),
|
|
408
408
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
409
409
|
cmdk.Command.Input,
|
|
@@ -415,7 +415,7 @@ var CommandInput = React8__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
415
415
|
)
|
|
416
416
|
] }));
|
|
417
417
|
CommandInput.displayName = cmdk.Command.Input.displayName;
|
|
418
|
-
var CommandList =
|
|
418
|
+
var CommandList = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
419
419
|
cmdk.Command.List,
|
|
420
420
|
{
|
|
421
421
|
ref,
|
|
@@ -424,7 +424,7 @@ var CommandList = React8__namespace.forwardRef(({ className, ...props }, ref) =>
|
|
|
424
424
|
}
|
|
425
425
|
));
|
|
426
426
|
CommandList.displayName = cmdk.Command.List.displayName;
|
|
427
|
-
var CommandEmpty =
|
|
427
|
+
var CommandEmpty = React9__namespace.forwardRef((props, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
428
428
|
cmdk.Command.Empty,
|
|
429
429
|
{
|
|
430
430
|
ref,
|
|
@@ -433,7 +433,7 @@ var CommandEmpty = React8__namespace.forwardRef((props, ref) => /* @__PURE__ */
|
|
|
433
433
|
}
|
|
434
434
|
));
|
|
435
435
|
CommandEmpty.displayName = cmdk.Command.Empty.displayName;
|
|
436
|
-
var CommandGroup =
|
|
436
|
+
var CommandGroup = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
437
437
|
cmdk.Command.Group,
|
|
438
438
|
{
|
|
439
439
|
ref,
|
|
@@ -442,7 +442,7 @@ var CommandGroup = React8__namespace.forwardRef(({ className, ...props }, ref) =
|
|
|
442
442
|
}
|
|
443
443
|
));
|
|
444
444
|
CommandGroup.displayName = cmdk.Command.Group.displayName;
|
|
445
|
-
var CommandSeparator =
|
|
445
|
+
var CommandSeparator = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
446
446
|
cmdk.Command.Separator,
|
|
447
447
|
{
|
|
448
448
|
ref,
|
|
@@ -451,7 +451,7 @@ var CommandSeparator = React8__namespace.forwardRef(({ className, ...props }, re
|
|
|
451
451
|
}
|
|
452
452
|
));
|
|
453
453
|
CommandSeparator.displayName = cmdk.Command.Separator.displayName;
|
|
454
|
-
var CommandItem =
|
|
454
|
+
var CommandItem = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
455
455
|
cmdk.Command.Item,
|
|
456
456
|
{
|
|
457
457
|
ref,
|
|
@@ -485,10 +485,10 @@ function EasyVisionSelector({
|
|
|
485
485
|
onStateChange: onStateChange ? (s) => onStateChange(s.value) : void 0
|
|
486
486
|
});
|
|
487
487
|
const value = slice.value;
|
|
488
|
-
const [resolved, setResolved] =
|
|
488
|
+
const [resolved, setResolved] = React9.useState(
|
|
489
489
|
Array.isArray(options) ? options : null
|
|
490
490
|
);
|
|
491
|
-
|
|
491
|
+
React9.useEffect(() => {
|
|
492
492
|
if (typeof options === "function" && resolved === null) {
|
|
493
493
|
void options().then(setResolved).catch(() => setResolved([]));
|
|
494
494
|
} else if (Array.isArray(options)) {
|
|
@@ -496,10 +496,10 @@ function EasyVisionSelector({
|
|
|
496
496
|
}
|
|
497
497
|
}, [options, resolved]);
|
|
498
498
|
const opts = resolved ?? [];
|
|
499
|
-
const [pending, setPending] =
|
|
500
|
-
|
|
501
|
-
const lastEmittedRef =
|
|
502
|
-
|
|
499
|
+
const [pending, setPending] = React9.useState(value);
|
|
500
|
+
React9.useEffect(() => setPending(value), [value]);
|
|
501
|
+
const lastEmittedRef = React9.useRef(value);
|
|
502
|
+
React9.useEffect(() => {
|
|
503
503
|
if (value !== lastEmittedRef.current) {
|
|
504
504
|
lastEmittedRef.current = value;
|
|
505
505
|
onChange?.(value);
|
|
@@ -618,11 +618,11 @@ function TextWidget({ definition, value, onChange, onRemove }) {
|
|
|
618
618
|
}
|
|
619
619
|
var SENTINEL = "__easyvision_undef__";
|
|
620
620
|
function SelectorWidget({ definition, value, onChange, onRemove }) {
|
|
621
|
-
const [open, setOpen] =
|
|
622
|
-
const [resolved, setResolved] =
|
|
621
|
+
const [open, setOpen] = React9.useState(false);
|
|
622
|
+
const [resolved, setResolved] = React9.useState(
|
|
623
623
|
Array.isArray(definition.options) ? definition.options : null
|
|
624
624
|
);
|
|
625
|
-
|
|
625
|
+
React9.useEffect(() => {
|
|
626
626
|
if (typeof definition.options === "function" && resolved === null) {
|
|
627
627
|
void definition.options().then((o) => setResolved(o)).catch(() => setResolved([]));
|
|
628
628
|
} else if (Array.isArray(definition.options)) {
|
|
@@ -674,7 +674,7 @@ function SelectorWidget({ definition, value, onChange, onRemove }) {
|
|
|
674
674
|
)
|
|
675
675
|
] });
|
|
676
676
|
}
|
|
677
|
-
var Checkbox =
|
|
677
|
+
var Checkbox = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
678
678
|
CheckboxPrimitive__namespace.Root,
|
|
679
679
|
{
|
|
680
680
|
ref,
|
|
@@ -690,22 +690,22 @@ function MultiSelectWidget({
|
|
|
690
690
|
onChange,
|
|
691
691
|
onRemove
|
|
692
692
|
}) {
|
|
693
|
-
const [search, setSearch] =
|
|
694
|
-
const [open, setOpen] =
|
|
693
|
+
const [search, setSearch] = React9.useState("");
|
|
694
|
+
const [open, setOpen] = React9.useState(false);
|
|
695
695
|
const searchFn = definition.searchOptions;
|
|
696
696
|
const hasSearchOptions = typeof searchFn === "function";
|
|
697
|
-
const [resolved, setResolved] =
|
|
697
|
+
const [resolved, setResolved] = React9.useState(
|
|
698
698
|
Array.isArray(definition.options) ? definition.options : null
|
|
699
699
|
);
|
|
700
|
-
|
|
700
|
+
React9.useEffect(() => {
|
|
701
701
|
if (typeof definition.options === "function" && resolved === null) {
|
|
702
702
|
void definition.options().then(setResolved).catch(() => setResolved([]));
|
|
703
703
|
} else if (Array.isArray(definition.options)) {
|
|
704
704
|
setResolved(definition.options);
|
|
705
705
|
}
|
|
706
706
|
}, [definition.options, resolved]);
|
|
707
|
-
const [searchResults, setSearchResults] =
|
|
708
|
-
|
|
707
|
+
const [searchResults, setSearchResults] = React9.useState([]);
|
|
708
|
+
React9.useEffect(() => {
|
|
709
709
|
if (!searchFn) return;
|
|
710
710
|
if (search.trim() === "") {
|
|
711
711
|
setSearchResults([]);
|
|
@@ -726,11 +726,11 @@ function MultiSelectWidget({
|
|
|
726
726
|
}, [search, searchFn]);
|
|
727
727
|
const selected = Array.isArray(value) ? value : [];
|
|
728
728
|
const baseOpts = resolved ?? [];
|
|
729
|
-
const labelCache =
|
|
730
|
-
|
|
729
|
+
const labelCache = React9.useRef(/* @__PURE__ */ new Map());
|
|
730
|
+
React9.useEffect(() => {
|
|
731
731
|
baseOpts.forEach((o) => labelCache.current.set(o.value, o.label));
|
|
732
732
|
}, [baseOpts]);
|
|
733
|
-
const listOpts =
|
|
733
|
+
const listOpts = React9.useMemo(() => {
|
|
734
734
|
if (hasSearchOptions) return searchResults;
|
|
735
735
|
return baseOpts.filter(
|
|
736
736
|
(o) => o.label.toLowerCase().includes(search.toLowerCase())
|
|
@@ -1063,7 +1063,7 @@ function buildCondition(def, value) {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
1065
|
function useBuildQuery(config, values, childQueries) {
|
|
1066
|
-
return
|
|
1066
|
+
return React9.useCallback(() => {
|
|
1067
1067
|
const where = {};
|
|
1068
1068
|
if (config.searchField) {
|
|
1069
1069
|
const c = buildCondition(config.searchField, values[config.searchField.id]);
|
|
@@ -1160,7 +1160,7 @@ function isMandatorySatisfied(def, value) {
|
|
|
1160
1160
|
if (!def.mandatory) return true;
|
|
1161
1161
|
return isNonEmpty(value);
|
|
1162
1162
|
}
|
|
1163
|
-
var EasyVisionMultifilter =
|
|
1163
|
+
var EasyVisionMultifilter = React9.forwardRef(function EasyVisionMultifilter2(props, ref) {
|
|
1164
1164
|
const {
|
|
1165
1165
|
id,
|
|
1166
1166
|
config,
|
|
@@ -1185,7 +1185,7 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1185
1185
|
const resolvedPerformMode = performMode === "live" ? "live" : "manual";
|
|
1186
1186
|
const labels = { ...DEFAULT_LABELS, ...labelOverrides };
|
|
1187
1187
|
const showClear = showClearAll ?? editable;
|
|
1188
|
-
const initialActive =
|
|
1188
|
+
const initialActive = React9.useMemo(() => {
|
|
1189
1189
|
const ids = [];
|
|
1190
1190
|
if (config.searchField) ids.push(config.searchField.id);
|
|
1191
1191
|
for (const f of config.fields) {
|
|
@@ -1193,7 +1193,7 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1193
1193
|
}
|
|
1194
1194
|
return ids;
|
|
1195
1195
|
}, [config]);
|
|
1196
|
-
const initialValues =
|
|
1196
|
+
const initialValues = React9.useMemo(() => {
|
|
1197
1197
|
const v = {};
|
|
1198
1198
|
if (config.searchField?.defaultValue !== void 0) {
|
|
1199
1199
|
v[config.searchField.id] = config.searchField.defaultValue;
|
|
@@ -1220,12 +1220,12 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1220
1220
|
}) : void 0
|
|
1221
1221
|
});
|
|
1222
1222
|
const { activeFields, values, lastConfirmedSnapshotJSON } = slice;
|
|
1223
|
-
const registryState =
|
|
1223
|
+
const registryState = React9.useSyncExternalStore(
|
|
1224
1224
|
easyVisionRegistry.subscribe,
|
|
1225
1225
|
easyVisionRegistry.getState,
|
|
1226
1226
|
easyVisionRegistry.getState
|
|
1227
1227
|
);
|
|
1228
|
-
const childSnapshots =
|
|
1228
|
+
const childSnapshots = React9.useMemo(() => {
|
|
1229
1229
|
const out = {};
|
|
1230
1230
|
for (const f of config.fields) {
|
|
1231
1231
|
if (f.type !== "multifilter") continue;
|
|
@@ -1240,7 +1240,7 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1240
1240
|
}
|
|
1241
1241
|
return out;
|
|
1242
1242
|
}, [fullId, config.fields, registryState]);
|
|
1243
|
-
const childQueries =
|
|
1243
|
+
const childQueries = React9.useMemo(() => {
|
|
1244
1244
|
const out = {};
|
|
1245
1245
|
for (const f of config.fields) {
|
|
1246
1246
|
if (f.type !== "multifilter") continue;
|
|
@@ -1251,7 +1251,7 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1251
1251
|
return out;
|
|
1252
1252
|
}, [config.fields, childSnapshots]);
|
|
1253
1253
|
const buildQuery = useBuildQuery(config, values, childQueries);
|
|
1254
|
-
const composedValues =
|
|
1254
|
+
const composedValues = React9.useMemo(() => {
|
|
1255
1255
|
const out = { ...values };
|
|
1256
1256
|
for (const f of config.fields) {
|
|
1257
1257
|
if (f.type === "multifilter") {
|
|
@@ -1260,7 +1260,7 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1260
1260
|
}
|
|
1261
1261
|
return out;
|
|
1262
1262
|
}, [values, config.fields, childSnapshots]);
|
|
1263
|
-
const isValid =
|
|
1263
|
+
const isValid = React9.useMemo(() => {
|
|
1264
1264
|
if (config.searchField && !isMandatorySatisfied(config.searchField, values[config.searchField.id])) {
|
|
1265
1265
|
return false;
|
|
1266
1266
|
}
|
|
@@ -1282,15 +1282,15 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1282
1282
|
}
|
|
1283
1283
|
return true;
|
|
1284
1284
|
}, [config, values, childSnapshots]);
|
|
1285
|
-
const snapshotKey =
|
|
1285
|
+
const snapshotKey = React9.useMemo(
|
|
1286
1286
|
() => buildSnapshotKey({ activeFields, values: composedValues }),
|
|
1287
1287
|
[activeFields, composedValues]
|
|
1288
1288
|
);
|
|
1289
|
-
const dirty =
|
|
1289
|
+
const dirty = React9.useMemo(
|
|
1290
1290
|
() => isDirty({ activeFields, values: composedValues }, lastConfirmedSnapshotJSON),
|
|
1291
1291
|
[activeFields, composedValues, lastConfirmedSnapshotJSON]
|
|
1292
1292
|
);
|
|
1293
|
-
const snapshot =
|
|
1293
|
+
const snapshot = React9.useMemo(
|
|
1294
1294
|
() => ({
|
|
1295
1295
|
values: composedValues,
|
|
1296
1296
|
activeFields,
|
|
@@ -1300,15 +1300,15 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1300
1300
|
}),
|
|
1301
1301
|
[composedValues, activeFields, isValid, dirty, buildQuery]
|
|
1302
1302
|
);
|
|
1303
|
-
const lastEmittedKeyRef =
|
|
1304
|
-
|
|
1303
|
+
const lastEmittedKeyRef = React9.useRef("");
|
|
1304
|
+
React9.useEffect(() => {
|
|
1305
1305
|
const key = `${snapshotKey}|${dirty}|${isValid}`;
|
|
1306
1306
|
if (key === lastEmittedKeyRef.current) return;
|
|
1307
1307
|
lastEmittedKeyRef.current = key;
|
|
1308
1308
|
onChange?.(snapshot);
|
|
1309
1309
|
onStateChange?.(snapshot);
|
|
1310
1310
|
}, [snapshotKey, dirty, isValid, snapshot, onChange, onStateChange]);
|
|
1311
|
-
const performAction =
|
|
1311
|
+
const performAction = React9.useCallback(() => {
|
|
1312
1312
|
const key = buildSnapshotKey({ activeFields, values: composedValues });
|
|
1313
1313
|
patch({ lastConfirmedSnapshotJSON: key });
|
|
1314
1314
|
if (onPerform) {
|
|
@@ -1316,16 +1316,16 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1316
1316
|
queueMicrotask(() => onPerform(emitted));
|
|
1317
1317
|
}
|
|
1318
1318
|
}, [activeFields, composedValues, patch, onPerform, snapshot]);
|
|
1319
|
-
const didPerformOnMountRef =
|
|
1320
|
-
|
|
1319
|
+
const didPerformOnMountRef = React9.useRef(false);
|
|
1320
|
+
React9.useEffect(() => {
|
|
1321
1321
|
if (performOnMount && !didPerformOnMountRef.current && Object.values(composedValues).some(isNonEmpty)) {
|
|
1322
1322
|
didPerformOnMountRef.current = true;
|
|
1323
1323
|
performAction();
|
|
1324
1324
|
}
|
|
1325
1325
|
}, [performOnMount]);
|
|
1326
|
-
const liveTimerRef =
|
|
1327
|
-
const livePrevKeyRef =
|
|
1328
|
-
|
|
1326
|
+
const liveTimerRef = React9.useRef(null);
|
|
1327
|
+
const livePrevKeyRef = React9.useRef(null);
|
|
1328
|
+
React9.useEffect(() => {
|
|
1329
1329
|
if (resolvedPerformMode !== "live") return;
|
|
1330
1330
|
if (livePrevKeyRef.current === null) {
|
|
1331
1331
|
livePrevKeyRef.current = snapshotKey;
|
|
@@ -1345,24 +1345,24 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1345
1345
|
}
|
|
1346
1346
|
};
|
|
1347
1347
|
}, [snapshotKey, resolvedPerformMode, performDebounceMs, performAction]);
|
|
1348
|
-
|
|
1348
|
+
React9.useImperativeHandle(ref, () => ({
|
|
1349
1349
|
perform: performAction,
|
|
1350
1350
|
getSnapshot: () => snapshot
|
|
1351
1351
|
}));
|
|
1352
|
-
const updateValue =
|
|
1352
|
+
const updateValue = React9.useCallback(
|
|
1353
1353
|
(fieldId, value) => {
|
|
1354
1354
|
patch({ values: { ...values, [fieldId]: value } });
|
|
1355
1355
|
},
|
|
1356
1356
|
[patch, values]
|
|
1357
1357
|
);
|
|
1358
|
-
const addField =
|
|
1358
|
+
const addField = React9.useCallback(
|
|
1359
1359
|
(fieldId) => {
|
|
1360
1360
|
if (activeFields.includes(fieldId)) return;
|
|
1361
1361
|
patch({ activeFields: [...activeFields, fieldId] });
|
|
1362
1362
|
},
|
|
1363
1363
|
[activeFields, patch]
|
|
1364
1364
|
);
|
|
1365
|
-
const removeField =
|
|
1365
|
+
const removeField = React9.useCallback(
|
|
1366
1366
|
(fieldId) => {
|
|
1367
1367
|
const nextValues = { ...values };
|
|
1368
1368
|
delete nextValues[fieldId];
|
|
@@ -1373,7 +1373,7 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1373
1373
|
},
|
|
1374
1374
|
[activeFields, values, patch]
|
|
1375
1375
|
);
|
|
1376
|
-
const clearAll =
|
|
1376
|
+
const clearAll = React9.useCallback(() => {
|
|
1377
1377
|
const seed = {};
|
|
1378
1378
|
if (config.searchField?.defaultValue !== void 0) {
|
|
1379
1379
|
seed[config.searchField.id] = config.searchField.defaultValue;
|
|
@@ -1387,22 +1387,22 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1387
1387
|
lastConfirmedSnapshotJSON: null
|
|
1388
1388
|
});
|
|
1389
1389
|
}, [config, patch, initialActive]);
|
|
1390
|
-
const visibleConfigFields =
|
|
1390
|
+
const visibleConfigFields = React9.useMemo(
|
|
1391
1391
|
() => config.fields.filter((f) => isFieldVisible(f, composedValues)),
|
|
1392
1392
|
[config.fields, composedValues]
|
|
1393
1393
|
);
|
|
1394
1394
|
const isProminentTextField = (f) => f.type === "text" && f.prominent === true;
|
|
1395
|
-
const pinnedFields =
|
|
1395
|
+
const pinnedFields = React9.useMemo(
|
|
1396
1396
|
() => visibleConfigFields.filter((f) => f.pinned && !isProminentTextField(f)),
|
|
1397
1397
|
[visibleConfigFields]
|
|
1398
1398
|
);
|
|
1399
|
-
const chipFields =
|
|
1399
|
+
const chipFields = React9.useMemo(
|
|
1400
1400
|
() => visibleConfigFields.filter(
|
|
1401
1401
|
(f) => !f.pinned && !isProminentTextField(f) && activeFields.includes(f.id)
|
|
1402
1402
|
),
|
|
1403
1403
|
[visibleConfigFields, activeFields]
|
|
1404
1404
|
);
|
|
1405
|
-
const prominentSlots =
|
|
1405
|
+
const prominentSlots = React9.useMemo(() => {
|
|
1406
1406
|
const slots = [];
|
|
1407
1407
|
if (config.searchField) {
|
|
1408
1408
|
slots.push({
|
|
@@ -1423,7 +1423,7 @@ var EasyVisionMultifilter = React8.forwardRef(function EasyVisionMultifilter2(pr
|
|
|
1423
1423
|
}
|
|
1424
1424
|
return slots;
|
|
1425
1425
|
}, [config.searchField, visibleConfigFields, activeFields, editable]);
|
|
1426
|
-
const availableToAdd =
|
|
1426
|
+
const availableToAdd = React9.useMemo(
|
|
1427
1427
|
() => visibleConfigFields.filter(
|
|
1428
1428
|
(f) => !f.pinned && !activeFields.includes(f.id)
|
|
1429
1429
|
),
|
|
@@ -1628,33 +1628,143 @@ function buildChildQueryDirect(field, values) {
|
|
|
1628
1628
|
return Object.keys(where).length > 0 ? { where } : {};
|
|
1629
1629
|
}
|
|
1630
1630
|
var join = (...parts) => parts.filter(Boolean).join(" ");
|
|
1631
|
-
var EasyVisionCard =
|
|
1631
|
+
var EasyVisionCard = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: join("ev-card", className), ...props }));
|
|
1632
1632
|
EasyVisionCard.displayName = "EasyVisionCard";
|
|
1633
|
-
var EasyVisionCardHeader =
|
|
1633
|
+
var EasyVisionCardHeader = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: join("ev-card-header", className), ...props }));
|
|
1634
1634
|
EasyVisionCardHeader.displayName = "EasyVisionCardHeader";
|
|
1635
|
-
var EasyVisionCardTitle =
|
|
1635
|
+
var EasyVisionCardTitle = React9__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("h3", { ref, className: join("ev-card-title", className), ...props, children }));
|
|
1636
1636
|
EasyVisionCardTitle.displayName = "EasyVisionCardTitle";
|
|
1637
|
-
var EasyVisionCardDescription =
|
|
1637
|
+
var EasyVisionCardDescription = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("p", { ref, className: join("ev-card-description", className), ...props }));
|
|
1638
1638
|
EasyVisionCardDescription.displayName = "EasyVisionCardDescription";
|
|
1639
|
-
var EasyVisionCardContent =
|
|
1639
|
+
var EasyVisionCardContent = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: join("ev-card-content", className), ...props }));
|
|
1640
1640
|
EasyVisionCardContent.displayName = "EasyVisionCardContent";
|
|
1641
|
-
var EasyVisionCardFooter =
|
|
1641
|
+
var EasyVisionCardFooter = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: join("ev-card-footer", className), ...props }));
|
|
1642
1642
|
EasyVisionCardFooter.displayName = "EasyVisionCardFooter";
|
|
1643
|
-
var
|
|
1643
|
+
var join2 = (...parts) => parts.filter(Boolean).join(" ");
|
|
1644
|
+
function EasyVisionAccordionItem(_props) {
|
|
1645
|
+
return null;
|
|
1646
|
+
}
|
|
1647
|
+
EasyVisionAccordionItem.displayName = "EasyVisionAccordionItem";
|
|
1648
|
+
function normalizeFromChildren(children) {
|
|
1649
|
+
const out = [];
|
|
1650
|
+
React9__namespace.Children.forEach(children, (child) => {
|
|
1651
|
+
if (!React9__namespace.isValidElement(child)) return;
|
|
1652
|
+
if (child.type !== EasyVisionAccordionItem) return;
|
|
1653
|
+
const p = child.props;
|
|
1654
|
+
out.push({
|
|
1655
|
+
id: p.id,
|
|
1656
|
+
question: p.question,
|
|
1657
|
+
content: p.children,
|
|
1658
|
+
defaultOpen: p.defaultOpen,
|
|
1659
|
+
disabled: p.disabled,
|
|
1660
|
+
className: p.className
|
|
1661
|
+
});
|
|
1662
|
+
});
|
|
1663
|
+
return out;
|
|
1664
|
+
}
|
|
1665
|
+
function normalizeFromItems(items) {
|
|
1666
|
+
return items.map((it) => ({
|
|
1667
|
+
id: it.id,
|
|
1668
|
+
question: it.question,
|
|
1669
|
+
content: it.content,
|
|
1670
|
+
defaultOpen: it.defaultOpen,
|
|
1671
|
+
disabled: it.disabled
|
|
1672
|
+
}));
|
|
1673
|
+
}
|
|
1674
|
+
function AccordionRow({ item, open, onToggle }) {
|
|
1675
|
+
const panelId = `ev-accordion-panel-${item.id}`;
|
|
1676
|
+
const triggerId = `ev-accordion-trigger-${item.id}`;
|
|
1677
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: join2("ev-accordion-item", item.className), children: [
|
|
1678
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1679
|
+
"button",
|
|
1680
|
+
{
|
|
1681
|
+
type: "button",
|
|
1682
|
+
id: triggerId,
|
|
1683
|
+
className: join2("ev-accordion-trigger", open && "ev-accordion-trigger-open"),
|
|
1684
|
+
"aria-expanded": open,
|
|
1685
|
+
"aria-controls": panelId,
|
|
1686
|
+
disabled: item.disabled,
|
|
1687
|
+
onClick: () => onToggle(item.id),
|
|
1688
|
+
children: [
|
|
1689
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "ev-accordion-question", children: item.question }),
|
|
1690
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "ev-accordion-icon", "aria-hidden": "true" })
|
|
1691
|
+
]
|
|
1692
|
+
}
|
|
1693
|
+
),
|
|
1694
|
+
open && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1695
|
+
"div",
|
|
1696
|
+
{
|
|
1697
|
+
id: panelId,
|
|
1698
|
+
role: "region",
|
|
1699
|
+
"aria-labelledby": triggerId,
|
|
1700
|
+
className: "ev-accordion-panel",
|
|
1701
|
+
children: item.content
|
|
1702
|
+
}
|
|
1703
|
+
)
|
|
1704
|
+
] });
|
|
1705
|
+
}
|
|
1706
|
+
function EasyVisionAccordion({
|
|
1707
|
+
items,
|
|
1708
|
+
children,
|
|
1709
|
+
mode = "single",
|
|
1710
|
+
openIds,
|
|
1711
|
+
defaultOpenIds,
|
|
1712
|
+
onOpenChange,
|
|
1713
|
+
className
|
|
1714
|
+
}) {
|
|
1715
|
+
const normalized = React9__namespace.useMemo(
|
|
1716
|
+
() => items ? normalizeFromItems(items) : normalizeFromChildren(children),
|
|
1717
|
+
[items, children]
|
|
1718
|
+
);
|
|
1719
|
+
const isControlled = openIds !== void 0;
|
|
1720
|
+
const [internalOpen, setInternalOpen] = React9__namespace.useState(() => {
|
|
1721
|
+
if (defaultOpenIds) return new Set(defaultOpenIds);
|
|
1722
|
+
return new Set(normalized.filter((it) => it.defaultOpen).map((it) => it.id));
|
|
1723
|
+
});
|
|
1724
|
+
const openSet = React9__namespace.useMemo(
|
|
1725
|
+
() => isControlled ? new Set(openIds) : internalOpen,
|
|
1726
|
+
[isControlled, openIds, internalOpen]
|
|
1727
|
+
);
|
|
1728
|
+
const handleToggle = React9__namespace.useCallback(
|
|
1729
|
+
(id) => {
|
|
1730
|
+
const next = new Set(openSet);
|
|
1731
|
+
if (next.has(id)) {
|
|
1732
|
+
next.delete(id);
|
|
1733
|
+
} else {
|
|
1734
|
+
if (mode === "single") next.clear();
|
|
1735
|
+
next.add(id);
|
|
1736
|
+
}
|
|
1737
|
+
if (!isControlled) setInternalOpen(next);
|
|
1738
|
+
onOpenChange?.(Array.from(next));
|
|
1739
|
+
},
|
|
1740
|
+
[openSet, mode, isControlled, onOpenChange]
|
|
1741
|
+
);
|
|
1742
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: join2("ev-accordion", className), children: normalized.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1743
|
+
AccordionRow,
|
|
1744
|
+
{
|
|
1745
|
+
item,
|
|
1746
|
+
open: openSet.has(item.id),
|
|
1747
|
+
onToggle: handleToggle
|
|
1748
|
+
},
|
|
1749
|
+
item.id
|
|
1750
|
+
)) });
|
|
1751
|
+
}
|
|
1752
|
+
EasyVisionAccordion.displayName = "EasyVisionAccordion";
|
|
1753
|
+
var Table = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("table", { ref, className: cn("ev-table", className), ...props }));
|
|
1644
1754
|
Table.displayName = "Table";
|
|
1645
|
-
var TableHeader =
|
|
1755
|
+
var TableHeader = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("thead", { ref, className, ...props }));
|
|
1646
1756
|
TableHeader.displayName = "TableHeader";
|
|
1647
|
-
var TableBody =
|
|
1757
|
+
var TableBody = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("tbody", { ref, className, ...props }));
|
|
1648
1758
|
TableBody.displayName = "TableBody";
|
|
1649
|
-
var TableFooter =
|
|
1759
|
+
var TableFooter = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("tfoot", { ref, className, ...props }));
|
|
1650
1760
|
TableFooter.displayName = "TableFooter";
|
|
1651
|
-
var TableRow =
|
|
1761
|
+
var TableRow = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("tr", { ref, className, ...props }));
|
|
1652
1762
|
TableRow.displayName = "TableRow";
|
|
1653
|
-
var TableHead =
|
|
1763
|
+
var TableHead = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("th", { ref, className, ...props }));
|
|
1654
1764
|
TableHead.displayName = "TableHead";
|
|
1655
|
-
var TableCell =
|
|
1765
|
+
var TableCell = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("td", { ref, className, ...props }));
|
|
1656
1766
|
TableCell.displayName = "TableCell";
|
|
1657
|
-
var TableCaption =
|
|
1767
|
+
var TableCaption = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("caption", { ref, className, ...props }));
|
|
1658
1768
|
TableCaption.displayName = "TableCaption";
|
|
1659
1769
|
var isNestedField = (field) => field.includes(".");
|
|
1660
1770
|
var resolvePath = (obj, path) => path.split(".").reduce(
|
|
@@ -1683,7 +1793,7 @@ function adaptColumns(columns, orderingMode, defaultSorting = "nonNested") {
|
|
|
1683
1793
|
};
|
|
1684
1794
|
const isUi = c.type === "ui";
|
|
1685
1795
|
const userCell = c.cell;
|
|
1686
|
-
const wrappedCell = userCell ? ({ row }) => userCell(row.original) : ({ getValue }) =>
|
|
1796
|
+
const wrappedCell = userCell ? ({ row }) => userCell(row.original) : ({ getValue }) => React9.createElement(
|
|
1687
1797
|
"span",
|
|
1688
1798
|
{ className: "text-sm text-foreground" },
|
|
1689
1799
|
String(getValue() ?? "-")
|
|
@@ -1763,7 +1873,7 @@ function useTableData({
|
|
|
1763
1873
|
paginationMode,
|
|
1764
1874
|
orderingMode
|
|
1765
1875
|
}) {
|
|
1766
|
-
return
|
|
1876
|
+
return React9.useMemo(() => {
|
|
1767
1877
|
let rows = data ?? [];
|
|
1768
1878
|
if (orderingMode === "local" && sort) {
|
|
1769
1879
|
const col = columns.find((c) => c.field === sort.column);
|
|
@@ -1784,7 +1894,7 @@ function useTableData({
|
|
|
1784
1894
|
var DropdownMenu = DropdownMenuPrimitive__namespace.Root;
|
|
1785
1895
|
var DropdownMenuTrigger = DropdownMenuPrimitive__namespace.Trigger;
|
|
1786
1896
|
var DropdownMenuRadioGroup = DropdownMenuPrimitive__namespace.RadioGroup;
|
|
1787
|
-
var DropdownMenuSubTrigger =
|
|
1897
|
+
var DropdownMenuSubTrigger = React9__namespace.forwardRef(({ className, inset, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1788
1898
|
DropdownMenuPrimitive__namespace.SubTrigger,
|
|
1789
1899
|
{
|
|
1790
1900
|
ref,
|
|
@@ -1801,7 +1911,7 @@ var DropdownMenuSubTrigger = React8__namespace.forwardRef(({ className, inset, c
|
|
|
1801
1911
|
}
|
|
1802
1912
|
));
|
|
1803
1913
|
DropdownMenuSubTrigger.displayName = DropdownMenuPrimitive__namespace.SubTrigger.displayName;
|
|
1804
|
-
var DropdownMenuSubContent =
|
|
1914
|
+
var DropdownMenuSubContent = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1805
1915
|
DropdownMenuPrimitive__namespace.SubContent,
|
|
1806
1916
|
{
|
|
1807
1917
|
ref,
|
|
@@ -1810,7 +1920,7 @@ var DropdownMenuSubContent = React8__namespace.forwardRef(({ className, ...props
|
|
|
1810
1920
|
}
|
|
1811
1921
|
));
|
|
1812
1922
|
DropdownMenuSubContent.displayName = DropdownMenuPrimitive__namespace.SubContent.displayName;
|
|
1813
|
-
var DropdownMenuContent =
|
|
1923
|
+
var DropdownMenuContent = React9__namespace.forwardRef(({ className, sideOffset = 4, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuPrimitive__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1814
1924
|
DropdownMenuPrimitive__namespace.Content,
|
|
1815
1925
|
{
|
|
1816
1926
|
ref,
|
|
@@ -1820,7 +1930,7 @@ var DropdownMenuContent = React8__namespace.forwardRef(({ className, sideOffset
|
|
|
1820
1930
|
}
|
|
1821
1931
|
) }));
|
|
1822
1932
|
DropdownMenuContent.displayName = DropdownMenuPrimitive__namespace.Content.displayName;
|
|
1823
|
-
var DropdownMenuItem =
|
|
1933
|
+
var DropdownMenuItem = React9__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1824
1934
|
DropdownMenuPrimitive__namespace.Item,
|
|
1825
1935
|
{
|
|
1826
1936
|
ref,
|
|
@@ -1833,7 +1943,7 @@ var DropdownMenuItem = React8__namespace.forwardRef(({ className, inset, ...prop
|
|
|
1833
1943
|
}
|
|
1834
1944
|
));
|
|
1835
1945
|
DropdownMenuItem.displayName = DropdownMenuPrimitive__namespace.Item.displayName;
|
|
1836
|
-
var DropdownMenuCheckboxItem =
|
|
1946
|
+
var DropdownMenuCheckboxItem = React9__namespace.forwardRef(({ className, children, checked, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1837
1947
|
DropdownMenuPrimitive__namespace.CheckboxItem,
|
|
1838
1948
|
{
|
|
1839
1949
|
ref,
|
|
@@ -1847,7 +1957,7 @@ var DropdownMenuCheckboxItem = React8__namespace.forwardRef(({ className, childr
|
|
|
1847
1957
|
}
|
|
1848
1958
|
));
|
|
1849
1959
|
DropdownMenuCheckboxItem.displayName = DropdownMenuPrimitive__namespace.CheckboxItem.displayName;
|
|
1850
|
-
var DropdownMenuRadioItem =
|
|
1960
|
+
var DropdownMenuRadioItem = React9__namespace.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1851
1961
|
DropdownMenuPrimitive__namespace.RadioItem,
|
|
1852
1962
|
{
|
|
1853
1963
|
ref,
|
|
@@ -1860,7 +1970,7 @@ var DropdownMenuRadioItem = React8__namespace.forwardRef(({ className, children,
|
|
|
1860
1970
|
}
|
|
1861
1971
|
));
|
|
1862
1972
|
DropdownMenuRadioItem.displayName = DropdownMenuPrimitive__namespace.RadioItem.displayName;
|
|
1863
|
-
var DropdownMenuLabel =
|
|
1973
|
+
var DropdownMenuLabel = React9__namespace.forwardRef(({ className, inset, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1864
1974
|
DropdownMenuPrimitive__namespace.Label,
|
|
1865
1975
|
{
|
|
1866
1976
|
ref,
|
|
@@ -1873,7 +1983,7 @@ var DropdownMenuLabel = React8__namespace.forwardRef(({ className, inset, ...pro
|
|
|
1873
1983
|
}
|
|
1874
1984
|
));
|
|
1875
1985
|
DropdownMenuLabel.displayName = DropdownMenuPrimitive__namespace.Label.displayName;
|
|
1876
|
-
var DropdownMenuSeparator =
|
|
1986
|
+
var DropdownMenuSeparator = React9__namespace.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1877
1987
|
DropdownMenuPrimitive__namespace.Separator,
|
|
1878
1988
|
{
|
|
1879
1989
|
ref,
|
|
@@ -2229,7 +2339,7 @@ function EasyVisionTable(props) {
|
|
|
2229
2339
|
const lbIncludeKey = JSON.stringify(loopback?.include ?? null);
|
|
2230
2340
|
const lbFieldsKey = JSON.stringify(loopback?.fields ?? null);
|
|
2231
2341
|
const lbOrderKey = JSON.stringify(loopback?.defaultOrder ?? null);
|
|
2232
|
-
const loopbackFetcher =
|
|
2342
|
+
const loopbackFetcher = React9.useMemo(
|
|
2233
2343
|
() => loopback ? createLoopbackTableFetcher(loopback) : void 0,
|
|
2234
2344
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2235
2345
|
[lbFetchPage, lbFetchCount, lbIncludeKey, lbFieldsKey, lbOrderKey]
|
|
@@ -2237,7 +2347,7 @@ function EasyVisionTable(props) {
|
|
|
2237
2347
|
const fetchData = fetchDataProp ?? loopbackFetcher;
|
|
2238
2348
|
const paginationMode = loopback ? "api" : paginationModeProp;
|
|
2239
2349
|
const orderingMode = loopback ? "api" : orderingModeProp;
|
|
2240
|
-
const getRowId =
|
|
2350
|
+
const getRowId = React9.useMemo(
|
|
2241
2351
|
() => getRowIdProp ?? ((row) => String(row?.id ?? "")),
|
|
2242
2352
|
[getRowIdProp]
|
|
2243
2353
|
);
|
|
@@ -2260,10 +2370,10 @@ function EasyVisionTable(props) {
|
|
|
2260
2370
|
persist
|
|
2261
2371
|
});
|
|
2262
2372
|
const { page, itemsPerPage, sort, selection } = slice;
|
|
2263
|
-
const lastSnapshotRef =
|
|
2264
|
-
const [localFilterTick, setLocalFilterTick] =
|
|
2265
|
-
const innerMultifilterRef =
|
|
2266
|
-
const setMultifilterRef =
|
|
2373
|
+
const lastSnapshotRef = React9.useRef(null);
|
|
2374
|
+
const [localFilterTick, setLocalFilterTick] = React9.useState(0);
|
|
2375
|
+
const innerMultifilterRef = React9.useRef(null);
|
|
2376
|
+
const setMultifilterRef = React9.useCallback(
|
|
2267
2377
|
(handle) => {
|
|
2268
2378
|
innerMultifilterRef.current = handle;
|
|
2269
2379
|
if (typeof multifilterRef === "function") {
|
|
@@ -2274,16 +2384,16 @@ function EasyVisionTable(props) {
|
|
|
2274
2384
|
},
|
|
2275
2385
|
[multifilterRef]
|
|
2276
2386
|
);
|
|
2277
|
-
const [apiRows, setApiRows] =
|
|
2278
|
-
const [apiTotalCount, setApiTotalCount] =
|
|
2279
|
-
const [apiLoading, setApiLoading] =
|
|
2280
|
-
const fetchSeqRef =
|
|
2387
|
+
const [apiRows, setApiRows] = React9.useState([]);
|
|
2388
|
+
const [apiTotalCount, setApiTotalCount] = React9.useState(0);
|
|
2389
|
+
const [apiLoading, setApiLoading] = React9.useState(false);
|
|
2390
|
+
const fetchSeqRef = React9.useRef(0);
|
|
2281
2391
|
const isApi = paginationMode === "api" || orderingMode === "api";
|
|
2282
|
-
const [eagerAllIds, setEagerAllIds] =
|
|
2283
|
-
const [eagerAllRows, setEagerAllRows] =
|
|
2284
|
-
const [isResolvingEager, setIsResolvingEager] =
|
|
2285
|
-
const eagerSeqRef =
|
|
2286
|
-
const runFetch =
|
|
2392
|
+
const [eagerAllIds, setEagerAllIds] = React9.useState(null);
|
|
2393
|
+
const [eagerAllRows, setEagerAllRows] = React9.useState([]);
|
|
2394
|
+
const [isResolvingEager, setIsResolvingEager] = React9.useState(false);
|
|
2395
|
+
const eagerSeqRef = React9.useRef(0);
|
|
2396
|
+
const runFetch = React9.useCallback(async () => {
|
|
2287
2397
|
if (!fetchData) return;
|
|
2288
2398
|
const seq = ++fetchSeqRef.current;
|
|
2289
2399
|
setApiLoading(true);
|
|
@@ -2310,10 +2420,10 @@ function EasyVisionTable(props) {
|
|
|
2310
2420
|
if (seq === fetchSeqRef.current) setApiLoading(false);
|
|
2311
2421
|
}
|
|
2312
2422
|
}, [fetchData, page, itemsPerPage, sort, externalFilter, onDataLoaded]);
|
|
2313
|
-
|
|
2423
|
+
React9.useEffect(() => {
|
|
2314
2424
|
if (isApi && fetchData) void runFetch();
|
|
2315
2425
|
}, [isApi, page, itemsPerPage, sort, refetchSignal]);
|
|
2316
|
-
const resolveEagerAll =
|
|
2426
|
+
const resolveEagerAll = React9.useCallback(async () => {
|
|
2317
2427
|
if (!fetchData) return;
|
|
2318
2428
|
const collectRows = selectAllResolution === "eager";
|
|
2319
2429
|
const seq = ++eagerSeqRef.current;
|
|
@@ -2357,8 +2467,8 @@ function EasyVisionTable(props) {
|
|
|
2357
2467
|
if (seq === eagerSeqRef.current) setIsResolvingEager(false);
|
|
2358
2468
|
}
|
|
2359
2469
|
}, [fetchData, externalFilter, sort, getRowId, selectAllResolution]);
|
|
2360
|
-
const prevRefetchRef =
|
|
2361
|
-
|
|
2470
|
+
const prevRefetchRef = React9.useRef(refetchSignal);
|
|
2471
|
+
React9.useEffect(() => {
|
|
2362
2472
|
if (prevRefetchRef.current !== refetchSignal && page !== 1) {
|
|
2363
2473
|
prevRefetchRef.current = refetchSignal;
|
|
2364
2474
|
patch({ page: 1 });
|
|
@@ -2370,7 +2480,7 @@ function EasyVisionTable(props) {
|
|
|
2370
2480
|
eagerSeqRef.current++;
|
|
2371
2481
|
setIsResolvingEager(false);
|
|
2372
2482
|
}, [refetchSignal]);
|
|
2373
|
-
const filteredData =
|
|
2483
|
+
const filteredData = React9.useMemo(() => {
|
|
2374
2484
|
if (paginationMode !== "local") return data;
|
|
2375
2485
|
if (!data || data.length === 0) return data;
|
|
2376
2486
|
const mfWhere = lastSnapshotRef.current?.query?.where;
|
|
@@ -2391,11 +2501,11 @@ function EasyVisionTable(props) {
|
|
|
2391
2501
|
const rows = isApi ? apiRows : local.rows;
|
|
2392
2502
|
const totalCount = isApi ? apiTotalCount : local.totalCount;
|
|
2393
2503
|
const isLoading = isLoadingProp || apiLoading;
|
|
2394
|
-
const tanstackColumns =
|
|
2504
|
+
const tanstackColumns = React9.useMemo(
|
|
2395
2505
|
() => adaptColumns(columns, orderingMode, defaultSorting),
|
|
2396
2506
|
[columns, orderingMode, defaultSorting]
|
|
2397
2507
|
);
|
|
2398
|
-
const allColumns =
|
|
2508
|
+
const allColumns = React9.useMemo(() => {
|
|
2399
2509
|
if (!enableRowSelection) return tanstackColumns;
|
|
2400
2510
|
const checkboxCol = {
|
|
2401
2511
|
id: "_select",
|
|
@@ -2415,24 +2525,24 @@ function EasyVisionTable(props) {
|
|
|
2415
2525
|
};
|
|
2416
2526
|
return [checkboxCol, ...tanstackColumns];
|
|
2417
2527
|
}, [enableRowSelection, tanstackColumns]);
|
|
2418
|
-
const visibilityDefaults =
|
|
2528
|
+
const visibilityDefaults = React9.useMemo(() => {
|
|
2419
2529
|
const v = {};
|
|
2420
2530
|
for (const c of columns) {
|
|
2421
2531
|
if (c.initiallyHidden) v[c.field] = false;
|
|
2422
2532
|
}
|
|
2423
2533
|
return v;
|
|
2424
2534
|
}, [columns]);
|
|
2425
|
-
const columnVisibility =
|
|
2535
|
+
const columnVisibility = React9.useMemo(
|
|
2426
2536
|
() => ({ ...visibilityDefaults, ...slice.columnVisibility }),
|
|
2427
2537
|
[visibilityDefaults, slice.columnVisibility]
|
|
2428
2538
|
);
|
|
2429
|
-
const resizableFields =
|
|
2539
|
+
const resizableFields = React9.useMemo(() => {
|
|
2430
2540
|
const s = /* @__PURE__ */ new Set();
|
|
2431
2541
|
for (const c of columns) if (c.resizable) s.add(c.field);
|
|
2432
2542
|
return s;
|
|
2433
2543
|
}, [columns]);
|
|
2434
2544
|
const columnSizing = slice.columnSizing;
|
|
2435
|
-
const rowSelection =
|
|
2545
|
+
const rowSelection = React9.useMemo(() => {
|
|
2436
2546
|
if (selection.scope === "all") return {};
|
|
2437
2547
|
const r = {};
|
|
2438
2548
|
for (const id2 of Object.keys(selection.ids)) r[id2] = true;
|
|
@@ -2485,8 +2595,8 @@ function EasyVisionTable(props) {
|
|
|
2485
2595
|
pageCount: Math.ceil(totalCount / itemsPerPage),
|
|
2486
2596
|
getRowId
|
|
2487
2597
|
});
|
|
2488
|
-
const lastSelectionEmittedRef =
|
|
2489
|
-
|
|
2598
|
+
const lastSelectionEmittedRef = React9.useRef("");
|
|
2599
|
+
React9.useEffect(() => {
|
|
2490
2600
|
if (!enableRowSelection) return;
|
|
2491
2601
|
if (isEagerWildcard && (isResolvingEager || eagerAllIds === null)) return;
|
|
2492
2602
|
let event;
|
|
@@ -2568,11 +2678,11 @@ function EasyVisionTable(props) {
|
|
|
2568
2678
|
isResolvingEager,
|
|
2569
2679
|
isEagerWildcard
|
|
2570
2680
|
]);
|
|
2571
|
-
const rowIdOf =
|
|
2681
|
+
const rowIdOf = React9.useCallback(
|
|
2572
2682
|
(row) => getRowId(row),
|
|
2573
2683
|
[getRowId]
|
|
2574
2684
|
);
|
|
2575
|
-
const headerState =
|
|
2685
|
+
const headerState = React9.useMemo(() => {
|
|
2576
2686
|
if (selection.scope === "all") {
|
|
2577
2687
|
const except = Object.keys(selection.exceptIds ?? {}).length;
|
|
2578
2688
|
if (except === 0) return "checked";
|
|
@@ -2588,7 +2698,7 @@ function EasyVisionTable(props) {
|
|
|
2588
2698
|
if (selectedOnPage === visibleIds.length) return "checked";
|
|
2589
2699
|
return "indeterminate";
|
|
2590
2700
|
}, [selection, rows, rowIdOf]);
|
|
2591
|
-
const onHeaderToggle =
|
|
2701
|
+
const onHeaderToggle = React9.useCallback(
|
|
2592
2702
|
(checked) => {
|
|
2593
2703
|
if (selection.scope === "all") {
|
|
2594
2704
|
if (checked) {
|
|
@@ -2614,7 +2724,7 @@ function EasyVisionTable(props) {
|
|
|
2614
2724
|
},
|
|
2615
2725
|
[patch, selection, rows, rowIdOf]
|
|
2616
2726
|
);
|
|
2617
|
-
const onScopeChange =
|
|
2727
|
+
const onScopeChange = React9.useCallback(
|
|
2618
2728
|
(scope) => {
|
|
2619
2729
|
if (scope === "all") {
|
|
2620
2730
|
patch({ selection: { ids: {}, scope: "all", exceptIds: {} } });
|
|
@@ -2633,8 +2743,8 @@ function EasyVisionTable(props) {
|
|
|
2633
2743
|
},
|
|
2634
2744
|
[patch, selectAllResolution, isApi, resolveEagerAll]
|
|
2635
2745
|
);
|
|
2636
|
-
const firstPerformAfterMountRef =
|
|
2637
|
-
const handlePerform =
|
|
2746
|
+
const firstPerformAfterMountRef = React9.useRef(true);
|
|
2747
|
+
const handlePerform = React9.useCallback(
|
|
2638
2748
|
(snap) => {
|
|
2639
2749
|
const isFirstAfterMount = firstPerformAfterMountRef.current;
|
|
2640
2750
|
firstPerformAfterMountRef.current = false;
|
|
@@ -2654,8 +2764,8 @@ function EasyVisionTable(props) {
|
|
|
2654
2764
|
[isApi, multifilter, patch, runFetch, selection.scope]
|
|
2655
2765
|
);
|
|
2656
2766
|
const totalPages = Math.max(1, Math.ceil(totalCount / itemsPerPage));
|
|
2657
|
-
const hasResolvedDataRef =
|
|
2658
|
-
|
|
2767
|
+
const hasResolvedDataRef = React9.useRef(false);
|
|
2768
|
+
React9.useEffect(() => {
|
|
2659
2769
|
if (isApi) {
|
|
2660
2770
|
if (apiLoading) return;
|
|
2661
2771
|
if (!hasResolvedDataRef.current) {
|
|
@@ -2668,7 +2778,7 @@ function EasyVisionTable(props) {
|
|
|
2668
2778
|
}
|
|
2669
2779
|
if (page > totalPages) patch({ page: totalPages });
|
|
2670
2780
|
}, [page, totalPages, patch, isApi, apiLoading, apiTotalCount, apiRows.length]);
|
|
2671
|
-
|
|
2781
|
+
React9.useEffect(() => {
|
|
2672
2782
|
if (isApi) return;
|
|
2673
2783
|
if (paginationMode === "page") return;
|
|
2674
2784
|
if (page > 1 && page > Math.max(1, Math.ceil(totalCount / itemsPerPage))) {
|
|
@@ -2887,6 +2997,8 @@ function EasyVisionTable(props) {
|
|
|
2887
2997
|
}
|
|
2888
2998
|
var defaultCell = (content, title) => /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-foreground", title, children: content });
|
|
2889
2999
|
|
|
3000
|
+
exports.EasyVisionAccordion = EasyVisionAccordion;
|
|
3001
|
+
exports.EasyVisionAccordionItem = EasyVisionAccordionItem;
|
|
2890
3002
|
exports.EasyVisionCard = EasyVisionCard;
|
|
2891
3003
|
exports.EasyVisionCardContent = EasyVisionCardContent;
|
|
2892
3004
|
exports.EasyVisionCardDescription = EasyVisionCardDescription;
|