@sustaina/shared-ui 1.7.3 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +26 -0
- package/dist/index.d.mts +62 -14
- package/dist/index.d.ts +62 -14
- package/dist/index.js +822 -343
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +766 -287
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import
|
|
1
|
+
import * as React5 from 'react';
|
|
2
|
+
import React5__default, { createContext, isValidElement, useState, useEffect, useId, useContext, useRef, useCallback, useMemo, createElement } from 'react';
|
|
3
3
|
import { Controller, useFormContext, useForm, useFieldArray, FormProvider, useWatch, get, set, appendErrors, useFormState } from 'react-hook-form';
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
4
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
import clsx2, { clsx } from 'clsx';
|
|
6
6
|
import { twMerge } from 'tailwind-merge';
|
|
7
7
|
import { reSplitAlphaNumeric, useReactTable, getCoreRowModel, getGroupedRowModel, getExpandedRowModel, getSortedRowModel, getFilteredRowModel, flexRender } from '@tanstack/react-table';
|
|
8
|
-
import { CircleHelp,
|
|
8
|
+
import { CircleHelp, ChevronUp, ChevronDown, X, Plus, Search, Bug, XIcon, GripVertical, Info, CircleMinus, CalendarIcon, Minus, ChevronDownIcon, CheckIcon, Triangle, ChevronLeft, ChevronRight, Tag, ChevronUpIcon } from 'lucide-react';
|
|
9
|
+
import { cva } from 'class-variance-authority';
|
|
9
10
|
import { create } from 'zustand';
|
|
10
11
|
import { Slot } from '@radix-ui/react-slot';
|
|
11
12
|
import * as LabelPrimitive2 from '@radix-ui/react-label';
|
|
@@ -16,7 +17,6 @@ import * as SelectPrimitive from '@radix-ui/react-select';
|
|
|
16
17
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
17
18
|
import { useSensors, useSensor, PointerSensor, DndContext, closestCenter } from '@dnd-kit/core';
|
|
18
19
|
import { restrictToParentElement, restrictToVerticalAxis } from '@dnd-kit/modifiers';
|
|
19
|
-
import { cva } from 'class-variance-authority';
|
|
20
20
|
import { z } from 'zod';
|
|
21
21
|
import { createPortal } from 'react-dom';
|
|
22
22
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
@@ -131,14 +131,105 @@ function isDefined(value) {
|
|
|
131
131
|
function isEmptyObject(value) {
|
|
132
132
|
return !!value && Object.keys(value).length === 0 && value.constructor === Object;
|
|
133
133
|
}
|
|
134
|
-
function debounce(
|
|
135
|
-
let
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
134
|
+
function debounce(func, wait = 150, options) {
|
|
135
|
+
let lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
136
|
+
if (typeof func !== "function") {
|
|
137
|
+
throw new TypeError("Expected a function");
|
|
138
|
+
}
|
|
139
|
+
wait = Number(wait) || 0;
|
|
140
|
+
if (options && typeof options === "object") {
|
|
141
|
+
leading = !!options.leading;
|
|
142
|
+
maxing = "maxWait" in options;
|
|
143
|
+
maxWait = maxing ? Math.max(Number(options.maxWait) || 0, wait) : void 0;
|
|
144
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
145
|
+
}
|
|
146
|
+
function invokeFunc(time) {
|
|
147
|
+
const args = lastArgs;
|
|
148
|
+
const thisArg = lastThis;
|
|
149
|
+
lastArgs = lastThis = void 0;
|
|
150
|
+
lastInvokeTime = time;
|
|
151
|
+
result = func.apply(thisArg, args);
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
function leadingEdge(time) {
|
|
155
|
+
lastInvokeTime = time;
|
|
156
|
+
timerId = setTimeout(timerExpired, wait);
|
|
157
|
+
return leading ? invokeFunc(time) : result;
|
|
158
|
+
}
|
|
159
|
+
function remainingWait(time) {
|
|
160
|
+
const timeSinceLastCall = time - (lastCallTime ?? 0);
|
|
161
|
+
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
162
|
+
const remaining = wait - timeSinceLastCall;
|
|
163
|
+
return maxing ? Math.min(remaining, (maxWait ?? 0) - timeSinceLastInvoke) : remaining;
|
|
164
|
+
}
|
|
165
|
+
function shouldInvoke(time) {
|
|
166
|
+
const timeSinceLastCall = time - (lastCallTime ?? 0);
|
|
167
|
+
const timeSinceLastInvoke = time - lastInvokeTime;
|
|
168
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= (maxWait ?? 0);
|
|
169
|
+
}
|
|
170
|
+
function timerExpired() {
|
|
171
|
+
const time = Date.now();
|
|
172
|
+
if (shouldInvoke(time)) {
|
|
173
|
+
return trailingEdge(time);
|
|
174
|
+
}
|
|
175
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
176
|
+
}
|
|
177
|
+
function trailingEdge(time) {
|
|
178
|
+
timerId = void 0;
|
|
179
|
+
if (trailing && lastArgs) {
|
|
180
|
+
return invokeFunc(time);
|
|
181
|
+
}
|
|
182
|
+
lastArgs = lastThis = void 0;
|
|
183
|
+
return result;
|
|
184
|
+
}
|
|
185
|
+
function cancel() {
|
|
186
|
+
if (timerId !== void 0) {
|
|
187
|
+
clearTimeout(timerId);
|
|
188
|
+
}
|
|
189
|
+
lastInvokeTime = 0;
|
|
190
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
191
|
+
}
|
|
192
|
+
function flush() {
|
|
193
|
+
return timerId === void 0 ? result : trailingEdge(Date.now());
|
|
194
|
+
}
|
|
195
|
+
function debounced(...args) {
|
|
196
|
+
const time = Date.now();
|
|
197
|
+
const isInvoking = shouldInvoke(time);
|
|
198
|
+
lastArgs = args;
|
|
199
|
+
lastThis = this;
|
|
200
|
+
lastCallTime = time;
|
|
201
|
+
if (isInvoking) {
|
|
202
|
+
if (timerId === void 0) {
|
|
203
|
+
return leadingEdge(lastCallTime);
|
|
204
|
+
}
|
|
205
|
+
if (maxing) {
|
|
206
|
+
timerId = setTimeout(timerExpired, wait);
|
|
207
|
+
return invokeFunc(lastCallTime);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (timerId === void 0) {
|
|
211
|
+
timerId = setTimeout(timerExpired, wait);
|
|
212
|
+
}
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
debounced.cancel = cancel;
|
|
216
|
+
debounced.flush = flush;
|
|
217
|
+
return debounced;
|
|
218
|
+
}
|
|
219
|
+
function throttle(func, wait, options) {
|
|
220
|
+
let leading = true, trailing = true;
|
|
221
|
+
if (typeof func !== "function") {
|
|
222
|
+
throw new TypeError("Expected a function");
|
|
223
|
+
}
|
|
224
|
+
if (options) {
|
|
225
|
+
leading = "leading" in options ? !!options.leading : leading;
|
|
226
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
227
|
+
}
|
|
228
|
+
return debounce(func, wait, {
|
|
229
|
+
leading,
|
|
230
|
+
maxWait: wait,
|
|
231
|
+
trailing
|
|
232
|
+
});
|
|
142
233
|
}
|
|
143
234
|
|
|
144
235
|
// src/utils/filters.ts
|
|
@@ -188,9 +279,8 @@ function compareAlphanumeric(aStr, bStr) {
|
|
|
188
279
|
}
|
|
189
280
|
return a.length - b.length;
|
|
190
281
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
282
|
+
|
|
283
|
+
// src/components/data-table/utils.tsx
|
|
194
284
|
function booleanToSelectValue(value, options) {
|
|
195
285
|
if (value === true) return "true";
|
|
196
286
|
if (value === false) return "false";
|
|
@@ -201,18 +291,6 @@ function selectValueToBoolean(value) {
|
|
|
201
291
|
if (value === "false") return false;
|
|
202
292
|
return void 0;
|
|
203
293
|
}
|
|
204
|
-
function renderContentSlot(slot, defaultWrapperProps) {
|
|
205
|
-
const { content, wrapperProps = {} } = slot;
|
|
206
|
-
const mergedProps = {
|
|
207
|
-
...defaultWrapperProps,
|
|
208
|
-
...wrapperProps,
|
|
209
|
-
className: cn2(defaultWrapperProps?.className, wrapperProps?.className)
|
|
210
|
-
};
|
|
211
|
-
if (!content) {
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
return /* @__PURE__ */ jsx("div", { ...mergedProps, children: content });
|
|
215
|
-
}
|
|
216
294
|
var useHover = () => {
|
|
217
295
|
const [hovering, setHovering] = useState(false);
|
|
218
296
|
const prevRef = useRef(null);
|
|
@@ -364,7 +442,14 @@ var useTruncated = ({
|
|
|
364
442
|
return isTruncated;
|
|
365
443
|
};
|
|
366
444
|
var useTruncated_default = useTruncated;
|
|
367
|
-
var HeaderCell = ({
|
|
445
|
+
var HeaderCell = ({
|
|
446
|
+
rootClassName,
|
|
447
|
+
labelClassName,
|
|
448
|
+
context,
|
|
449
|
+
label,
|
|
450
|
+
sorterProps,
|
|
451
|
+
align = "left"
|
|
452
|
+
}) => {
|
|
368
453
|
const { ref, hovering } = useHover_default();
|
|
369
454
|
const showSorter = sorterProps?.show ?? context.column.getCanSort();
|
|
370
455
|
return /* @__PURE__ */ jsxs(
|
|
@@ -372,46 +457,56 @@ var HeaderCell = ({ rootClassName, labelClassName, context, label, sorterProps }
|
|
|
372
457
|
{
|
|
373
458
|
ref,
|
|
374
459
|
className: cn(
|
|
375
|
-
"flex items-center gap-2",
|
|
460
|
+
"flex items-center justify-between gap-2",
|
|
376
461
|
{
|
|
377
462
|
"cursor-pointer": context?.column?.getCanSort()
|
|
378
463
|
},
|
|
379
464
|
rootClassName
|
|
380
465
|
),
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
context?.column?.toggleSorting();
|
|
386
|
-
}
|
|
466
|
+
onClick: (event) => {
|
|
467
|
+
event.preventDefault();
|
|
468
|
+
if (context?.column?.getCanSort()) {
|
|
469
|
+
context?.column?.toggleSorting();
|
|
387
470
|
}
|
|
388
|
-
}
|
|
471
|
+
},
|
|
389
472
|
children: [
|
|
390
|
-
/* @__PURE__ */ jsx(
|
|
473
|
+
/* @__PURE__ */ jsx(
|
|
474
|
+
"div",
|
|
475
|
+
{
|
|
476
|
+
className: cn("flex-1 flex items-center", {
|
|
477
|
+
"justify-start": align === "left",
|
|
478
|
+
"justify-center": align === "center",
|
|
479
|
+
"justify-end": align === "right"
|
|
480
|
+
}),
|
|
481
|
+
children: /* @__PURE__ */ jsx("span", { className: cn("inline-block font-bold", labelClassName), children: label })
|
|
482
|
+
}
|
|
483
|
+
),
|
|
391
484
|
showSorter && /* @__PURE__ */ jsxs(
|
|
392
485
|
"div",
|
|
393
486
|
{
|
|
394
|
-
className: "flex flex-col",
|
|
487
|
+
className: "flex flex-col -space-y-2",
|
|
395
488
|
title: context.column.getCanSort() ? context.column.getNextSortingOrder() === "asc" ? "Sort ascending" : context.column.getNextSortingOrder() === "desc" ? "Sort descending" : "Clear sort" : void 0,
|
|
396
489
|
children: [
|
|
397
490
|
/* @__PURE__ */ jsx(
|
|
398
|
-
|
|
491
|
+
ChevronUp,
|
|
399
492
|
{
|
|
400
|
-
className: cn("
|
|
401
|
-
"
|
|
402
|
-
"
|
|
493
|
+
className: cn("stroke-[#BBBBBB]", {
|
|
494
|
+
"stroke-[#41875c]": context?.column?.getIsSorted() === "asc",
|
|
495
|
+
"stroke-[#41875c]/45": context?.column?.getNextSortingOrder() === "asc" && hovering
|
|
403
496
|
}),
|
|
404
|
-
size:
|
|
497
|
+
size: 16,
|
|
498
|
+
strokeWidth: 3
|
|
405
499
|
}
|
|
406
500
|
),
|
|
407
501
|
/* @__PURE__ */ jsx(
|
|
408
|
-
|
|
502
|
+
ChevronDown,
|
|
409
503
|
{
|
|
410
|
-
className: cn("
|
|
411
|
-
"
|
|
412
|
-
"
|
|
504
|
+
className: cn("stroke-[#BBBBBB]", {
|
|
505
|
+
"stroke-[#41875c]": context?.column?.getIsSorted() === "desc",
|
|
506
|
+
"stroke-[#41875c]/45": context?.column?.getNextSortingOrder() === "desc" && hovering
|
|
413
507
|
}),
|
|
414
|
-
size:
|
|
508
|
+
size: 16,
|
|
509
|
+
strokeWidth: 3
|
|
415
510
|
}
|
|
416
511
|
)
|
|
417
512
|
]
|
|
@@ -472,7 +567,7 @@ function TableHead({ className, ...props }) {
|
|
|
472
567
|
{
|
|
473
568
|
"data-slot": "table-head",
|
|
474
569
|
className: cn(
|
|
475
|
-
"text-foreground h-9 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] hover:bg-gray-200 bg-[#
|
|
570
|
+
"text-foreground h-9 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] hover:bg-gray-200 bg-[#F0F0F0] truncate",
|
|
476
571
|
className
|
|
477
572
|
),
|
|
478
573
|
...props
|
|
@@ -501,7 +596,7 @@ var ColumnResizer = ({ header, className, style }) => {
|
|
|
501
596
|
"div",
|
|
502
597
|
{
|
|
503
598
|
className: cn(
|
|
504
|
-
"absolute top-0 right-0 h-full w-1 select-none touch-none cursor-col-resize hover:bg-[#41875c]/45 active:bg-[#41875c]",
|
|
599
|
+
"z-[2] absolute top-0 right-0 h-full w-1 select-none touch-none cursor-col-resize hover:bg-[#41875c]/45 active:bg-[#41875c]",
|
|
505
600
|
className
|
|
506
601
|
),
|
|
507
602
|
onDoubleClick: () => header.column.resetSize(),
|
|
@@ -512,6 +607,37 @@ var ColumnResizer = ({ header, className, style }) => {
|
|
|
512
607
|
);
|
|
513
608
|
};
|
|
514
609
|
var ColumnResizer_default = ColumnResizer;
|
|
610
|
+
var ColumnSeparator = ({ show, className, ...props }) => {
|
|
611
|
+
if (!show) return null;
|
|
612
|
+
return /* @__PURE__ */ jsx(
|
|
613
|
+
"span",
|
|
614
|
+
{
|
|
615
|
+
"data-slot": "table-head-separator",
|
|
616
|
+
className: cn("absolute right-0 top-1/2 h-4 w-px -translate-y-1/2 bg-gray-300", className),
|
|
617
|
+
...props
|
|
618
|
+
}
|
|
619
|
+
);
|
|
620
|
+
};
|
|
621
|
+
var ColumnSeparator_default = React5__default.memo(ColumnSeparator);
|
|
622
|
+
var StatusContentSlot = ({
|
|
623
|
+
content,
|
|
624
|
+
icon,
|
|
625
|
+
wrapperProps = {},
|
|
626
|
+
defaultWrapperProps,
|
|
627
|
+
defaultIcon
|
|
628
|
+
}) => {
|
|
629
|
+
if (!content && !icon && !defaultIcon) return null;
|
|
630
|
+
const mergedProps = {
|
|
631
|
+
...defaultWrapperProps,
|
|
632
|
+
...wrapperProps,
|
|
633
|
+
className: cn(defaultWrapperProps?.className, wrapperProps?.className)
|
|
634
|
+
};
|
|
635
|
+
return /* @__PURE__ */ jsxs("div", { ...mergedProps, children: [
|
|
636
|
+
icon ?? defaultIcon,
|
|
637
|
+
content
|
|
638
|
+
] });
|
|
639
|
+
};
|
|
640
|
+
var StatusContentSlot_default = StatusContentSlot;
|
|
515
641
|
var stateOptions = [
|
|
516
642
|
"columnFilters",
|
|
517
643
|
"globalFilter",
|
|
@@ -677,12 +803,107 @@ var DataTableDevTool = ({ table }) => {
|
|
|
677
803
|
] });
|
|
678
804
|
};
|
|
679
805
|
var DataTableDevTool_default = DataTableDevTool;
|
|
806
|
+
var SuiEmptyDataIcon = (props) => /* @__PURE__ */ jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 184 152", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxs("g", { fill: "none", fillRule: "evenodd", children: [
|
|
807
|
+
/* @__PURE__ */ jsxs("g", { transform: "translate(24 31.67)", children: [
|
|
808
|
+
/* @__PURE__ */ jsx("ellipse", { fillOpacity: ".8", cx: "67.797", cy: "106.89", rx: "67.797", ry: "12.668", fill: "#B0DFAA" }),
|
|
809
|
+
/* @__PURE__ */ jsx(
|
|
810
|
+
"path",
|
|
811
|
+
{
|
|
812
|
+
d: "M122.034 69.674L98.109 40.229c-1.148-1.386-2.826-2.225-4.593-2.225h-51.44c-1.766 0-3.444.839-4.592 2.225L13.56 69.674v15.383h108.475V69.674z",
|
|
813
|
+
fill: "#CEE5D6"
|
|
814
|
+
}
|
|
815
|
+
),
|
|
816
|
+
/* @__PURE__ */ jsx(
|
|
817
|
+
"path",
|
|
818
|
+
{
|
|
819
|
+
d: "M101.537 86.214L80.63 61.102c-1.001-1.207-2.507-1.867-4.048-1.867H31.724c-1.54 0-3.047.66-4.048 1.867L6.769 86.214v13.792h94.768V86.214z",
|
|
820
|
+
fill: "#DDEEE3",
|
|
821
|
+
transform: "translate(13.56)"
|
|
822
|
+
}
|
|
823
|
+
),
|
|
824
|
+
/* @__PURE__ */ jsx(
|
|
825
|
+
"path",
|
|
826
|
+
{
|
|
827
|
+
d: "M33.83 0h67.933a4 4 0 0 1 4 4v93.344a4 4 0 0 1-4 4H33.83a4 4 0 0 1-4-4V4a4 4 0 0 1 4-4z",
|
|
828
|
+
fill: "#F9F9F9"
|
|
829
|
+
}
|
|
830
|
+
),
|
|
831
|
+
/* @__PURE__ */ jsx(
|
|
832
|
+
"path",
|
|
833
|
+
{
|
|
834
|
+
d: "M42.678 9.953h50.237a2 2 0 0 1 2 2V36.91a2 2 0 0 1-2 2H42.678a2 2 0 0 1-2-2V11.953a2 2 0 0 1 2-2zM42.94 49.767h49.713a2.262 2.262 0 1 1 0 4.524H42.94a2.262 2.262 0 0 1 0-4.524zM42.94 61.53h49.713a2.262 2.262 0 1 1 0 4.525H42.94a2.262 2.262 0 0 1 0-4.525zM121.813 105.032c-.775 3.071-3.497 5.36-6.735 5.36H20.515c-3.238 0-5.96-2.29-6.734-5.36a7.309 7.309 0 0 1-.222-1.79V69.675h26.318c2.907 0 5.25 2.448 5.25 5.42v.04c0 2.971 2.37 5.37 5.277 5.37h34.785c2.907 0 5.277-2.421 5.277-5.393V75.1c0-2.972 2.343-5.426 5.25-5.426h26.318v33.569c0 .617-.077 1.216-.221 1.789z",
|
|
835
|
+
fill: "#DDEEE3"
|
|
836
|
+
}
|
|
837
|
+
)
|
|
838
|
+
] }),
|
|
839
|
+
/* @__PURE__ */ jsx(
|
|
840
|
+
"path",
|
|
841
|
+
{
|
|
842
|
+
d: "M149.121 33.292l-6.83 2.65a1 1 0 0 1-1.317-1.23l1.937-6.207c-2.589-2.944-4.109-6.534-4.109-10.408C138.802 8.102 148.92 0 161.402 0 173.881 0 184 8.102 184 18.097c0 9.995-10.118 18.097-22.599 18.097-4.528 0-8.744-1.066-12.28-2.902z",
|
|
843
|
+
fill: "#DDEEE3"
|
|
844
|
+
}
|
|
845
|
+
),
|
|
846
|
+
/* @__PURE__ */ jsxs("g", { transform: "translate(149.65 15.383)", fill: "#FFF", children: [
|
|
847
|
+
/* @__PURE__ */ jsx("ellipse", { cx: "20.654", cy: "3.167", rx: "2.849", ry: "2.815" }),
|
|
848
|
+
/* @__PURE__ */ jsx("path", { d: "M5.698 5.63H0L2.898.704zM9.259.704h4.985V5.63H9.259z" })
|
|
849
|
+
] })
|
|
850
|
+
] }) });
|
|
851
|
+
var empty_data_default = SuiEmptyDataIcon;
|
|
852
|
+
var spinnerVariants = cva("relative inline-block aspect-square transform-gpu", {
|
|
853
|
+
variants: {
|
|
854
|
+
variant: {
|
|
855
|
+
primary: "[&>div]:bg-[#77ab8a]",
|
|
856
|
+
secondary: "[&>div]:bg-[#ab9555]",
|
|
857
|
+
destructive: "[&>div]:bg-destructive",
|
|
858
|
+
muted: "[&>div]:bg-muted-foreground"
|
|
859
|
+
},
|
|
860
|
+
size: {
|
|
861
|
+
sm: "size-7",
|
|
862
|
+
default: "size-8",
|
|
863
|
+
lg: "size-9",
|
|
864
|
+
xl: "size-10",
|
|
865
|
+
"2xl": "size-12"
|
|
866
|
+
}
|
|
867
|
+
},
|
|
868
|
+
defaultVariants: { variant: "primary", size: "default" }
|
|
869
|
+
});
|
|
870
|
+
var Spinner = ({ className, variant, size = "default" }) => /* @__PURE__ */ jsxs(
|
|
871
|
+
"div",
|
|
872
|
+
{
|
|
873
|
+
role: "status",
|
|
874
|
+
"aria-label": "Loading",
|
|
875
|
+
className: cn(
|
|
876
|
+
typeof size === "string" ? spinnerVariants({ variant, size }) : spinnerVariants({ variant }),
|
|
877
|
+
className
|
|
878
|
+
),
|
|
879
|
+
style: typeof size === "number" ? { width: size, height: size } : void 0,
|
|
880
|
+
children: [
|
|
881
|
+
Array.from({ length: 12 }).map((_, i2) => /* @__PURE__ */ jsx(
|
|
882
|
+
"div",
|
|
883
|
+
{
|
|
884
|
+
className: "animate-sus-spinner absolute left-[46.5%] top-[4.4%] h-[24%] w-[7%] origin-[center_190%] rounded-full opacity-[0.1] will-change-transform",
|
|
885
|
+
style: {
|
|
886
|
+
transform: `rotate(${i2 * 30}deg)`,
|
|
887
|
+
animationDelay: `${(i2 * 0.083).toFixed(3)}s`
|
|
888
|
+
},
|
|
889
|
+
"aria-hidden": "true"
|
|
890
|
+
},
|
|
891
|
+
i2
|
|
892
|
+
)),
|
|
893
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading..." })
|
|
894
|
+
]
|
|
895
|
+
}
|
|
896
|
+
);
|
|
680
897
|
|
|
681
898
|
// src/components/data-table/helpers.ts
|
|
682
|
-
function
|
|
899
|
+
function getColumnPinningInfo(column) {
|
|
683
900
|
const isPinned = column.getIsPinned();
|
|
684
901
|
const isLastLeftPinnedColumn = isPinned === "left" && column.getIsLastColumn("left");
|
|
685
902
|
const isFirstRightPinnedColumn = isPinned === "right" && column.getIsFirstColumn("right");
|
|
903
|
+
return { isPinned, isLastLeftPinnedColumn, isFirstRightPinnedColumn };
|
|
904
|
+
}
|
|
905
|
+
function getColumnPinningStyles(column) {
|
|
906
|
+
const { isPinned, isFirstRightPinnedColumn, isLastLeftPinnedColumn } = getColumnPinningInfo(column);
|
|
686
907
|
const classes = cn(
|
|
687
908
|
isPinned ? "sticky" : "relative",
|
|
688
909
|
isPinned ? "z-[1]" : "z-0",
|
|
@@ -842,7 +1063,7 @@ var DataTable = ({
|
|
|
842
1063
|
}
|
|
843
1064
|
const { scrollHeight, scrollTop, clientHeight } = containerRefElement;
|
|
844
1065
|
const scrollableHeight = scrollHeight - clientHeight;
|
|
845
|
-
const distanceToBottom =
|
|
1066
|
+
const distanceToBottom = scrollableHeight - scrollTop;
|
|
846
1067
|
const ratioToBottom = scrollableHeight > 0 ? scrollTop / scrollableHeight : 1;
|
|
847
1068
|
const info = {
|
|
848
1069
|
scrollTop,
|
|
@@ -883,11 +1104,29 @@ var DataTable = ({
|
|
|
883
1104
|
),
|
|
884
1105
|
onScroll: (e2) => fetchMoreOnScrollReached(e2.currentTarget),
|
|
885
1106
|
children: [
|
|
886
|
-
isInitialLoading ? /* @__PURE__ */ jsx(
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
1107
|
+
isInitialLoading ? /* @__PURE__ */ jsx(
|
|
1108
|
+
StatusContentSlot_default,
|
|
1109
|
+
{
|
|
1110
|
+
content: statusContent?.initialLoading?.content ?? "Loading...",
|
|
1111
|
+
icon: statusContent?.initialLoading?.icon,
|
|
1112
|
+
wrapperProps: statusContent?.initialLoading?.wrapperProps,
|
|
1113
|
+
defaultWrapperProps: {
|
|
1114
|
+
className: "flex flex-col h-full items-center justify-center text-sm py-4 gap-2"
|
|
1115
|
+
},
|
|
1116
|
+
defaultIcon: /* @__PURE__ */ jsx(Spinner, { size: 48 })
|
|
1117
|
+
}
|
|
1118
|
+
) : isTableEmpty ? /* @__PURE__ */ jsx(
|
|
1119
|
+
StatusContentSlot_default,
|
|
1120
|
+
{
|
|
1121
|
+
content: statusContent?.emptyData?.content ?? "There's nothing here yet.",
|
|
1122
|
+
icon: statusContent?.emptyData?.icon,
|
|
1123
|
+
wrapperProps: statusContent?.emptyData?.wrapperProps,
|
|
1124
|
+
defaultWrapperProps: {
|
|
1125
|
+
className: "flex flex-col h-full items-center justify-center text-sm py-4 gap-2"
|
|
1126
|
+
},
|
|
1127
|
+
defaultIcon: /* @__PURE__ */ jsx(empty_data_default, { className: "text-[128px]" })
|
|
1128
|
+
}
|
|
1129
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
891
1130
|
/* @__PURE__ */ jsxs(Table, { ...components?.tableProps, children: [
|
|
892
1131
|
/* @__PURE__ */ jsxs(
|
|
893
1132
|
TableHeader,
|
|
@@ -900,6 +1139,11 @@ var DataTable = ({
|
|
|
900
1139
|
const { classes, style } = getColumnPinningStyles(header.column);
|
|
901
1140
|
const useColumnSizing = header.column.columnDef?.meta?.useColumnSizing ?? columnResizing?.enabled ?? false;
|
|
902
1141
|
const tableHeadCellProps = typeof components?.tableHeadCellProps === "function" ? components?.tableHeadCellProps({ header, table }) : components?.tableHeadCellProps;
|
|
1142
|
+
const nextHeader = headerGroup.headers?.[header.index + 1] || header;
|
|
1143
|
+
const { isLastLeftPinnedColumn } = getColumnPinningInfo(header.column);
|
|
1144
|
+
const { isFirstRightPinnedColumn } = getColumnPinningInfo(nextHeader.column);
|
|
1145
|
+
const headerGroupLength = header.headerGroup.headers.length;
|
|
1146
|
+
const showSeparator = header.index !== headerGroupLength - 1 && !isLastLeftPinnedColumn && !isFirstRightPinnedColumn;
|
|
903
1147
|
return /* @__PURE__ */ jsxs(
|
|
904
1148
|
TableHead,
|
|
905
1149
|
{
|
|
@@ -921,6 +1165,14 @@ var DataTable = ({
|
|
|
921
1165
|
},
|
|
922
1166
|
children: [
|
|
923
1167
|
header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()),
|
|
1168
|
+
/* @__PURE__ */ jsx(
|
|
1169
|
+
ColumnSeparator_default,
|
|
1170
|
+
{
|
|
1171
|
+
...components?.columnSeparatorProps?.headerCell,
|
|
1172
|
+
...header.column.columnDef?.meta?.columnSeparatorProps,
|
|
1173
|
+
show: header.column.columnDef?.meta?.columnSeparatorProps?.show ?? components?.columnSeparatorProps?.headerCell?.show ?? showSeparator
|
|
1174
|
+
}
|
|
1175
|
+
),
|
|
924
1176
|
/* @__PURE__ */ jsx(ColumnResizer_default, { header, ...components?.columnResizerProps })
|
|
925
1177
|
]
|
|
926
1178
|
},
|
|
@@ -944,7 +1196,6 @@ var DataTable = ({
|
|
|
944
1196
|
column.columnDef?.meta?.filterCellProps?.className
|
|
945
1197
|
),
|
|
946
1198
|
style: {
|
|
947
|
-
// TODO: should we separate styles for filter or use same columns styles
|
|
948
1199
|
...style,
|
|
949
1200
|
width: useColumnSizing ? column.getSize() : void 0,
|
|
950
1201
|
minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
|
|
@@ -1013,20 +1264,39 @@ var DataTable = ({
|
|
|
1013
1264
|
);
|
|
1014
1265
|
}) })
|
|
1015
1266
|
] }),
|
|
1016
|
-
isTableEmptyAfterFiltering && /* @__PURE__ */ jsx(
|
|
1017
|
-
|
|
1018
|
-
content: "No records found. Please try a different search."
|
|
1019
|
-
},
|
|
1267
|
+
isTableEmptyAfterFiltering && /* @__PURE__ */ jsx(
|
|
1268
|
+
StatusContentSlot_default,
|
|
1020
1269
|
{
|
|
1021
|
-
|
|
1270
|
+
content: statusContent?.emptyFilteredData?.content ?? "No records found. Please try a different search.",
|
|
1271
|
+
icon: statusContent?.emptyFilteredData?.icon,
|
|
1272
|
+
wrapperProps: statusContent?.emptyFilteredData?.wrapperProps,
|
|
1273
|
+
defaultWrapperProps: {
|
|
1274
|
+
className: "flex flex-col h-[calc(100%-76px)] items-center justify-center text-sm py-4 gap-2"
|
|
1275
|
+
},
|
|
1276
|
+
defaultIcon: /* @__PURE__ */ jsx(empty_data_default, { className: "text-[128px]" })
|
|
1022
1277
|
}
|
|
1023
|
-
)
|
|
1024
|
-
scrollFetch?.enabled && !isFiltering && !isInitialLoading && scrollFetch?.isFetchingMore && /* @__PURE__ */ jsx(
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1278
|
+
),
|
|
1279
|
+
scrollFetch?.enabled && !isFiltering && !isInitialLoading && scrollFetch?.isFetchingMore && /* @__PURE__ */ jsx(
|
|
1280
|
+
StatusContentSlot_default,
|
|
1281
|
+
{
|
|
1282
|
+
content: statusContent?.fetchingMore?.content ?? "Loading more...",
|
|
1283
|
+
wrapperProps: statusContent?.fetchingMore?.wrapperProps,
|
|
1284
|
+
defaultWrapperProps: {
|
|
1285
|
+
className: "flex flex-col items-center justify-center text-sm py-4 gap-2"
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
),
|
|
1289
|
+
scrollFetch?.enabled && !isFiltering && !isInitialLoading && !scrollFetch?.hasMore && !scrollFetch?.isFetchingMore && /* @__PURE__ */ jsx(
|
|
1290
|
+
StatusContentSlot_default,
|
|
1291
|
+
{
|
|
1292
|
+
content: statusContent?.noMoreData?.content,
|
|
1293
|
+
icon: statusContent?.noMoreData?.icon,
|
|
1294
|
+
wrapperProps: statusContent?.noMoreData?.wrapperProps,
|
|
1295
|
+
defaultWrapperProps: {
|
|
1296
|
+
className: "flex flex-col items-center justify-center text-sm py-4 gap-2"
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
)
|
|
1030
1300
|
] }),
|
|
1031
1301
|
debug && /* @__PURE__ */ jsx(DataTableDevTool_default, { table })
|
|
1032
1302
|
]
|
|
@@ -1134,15 +1404,15 @@ var t2 = function(o3, t3, s2) {
|
|
|
1134
1404
|
};
|
|
1135
1405
|
};
|
|
1136
1406
|
var Form = FormProvider;
|
|
1137
|
-
var FormFieldContext2 =
|
|
1407
|
+
var FormFieldContext2 = React5.createContext({});
|
|
1138
1408
|
var FormField2 = ({
|
|
1139
1409
|
...props
|
|
1140
1410
|
}) => {
|
|
1141
1411
|
return /* @__PURE__ */ jsx(FormFieldContext2.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
1142
1412
|
};
|
|
1143
1413
|
var useFormField2 = () => {
|
|
1144
|
-
const fieldContext =
|
|
1145
|
-
const itemContext =
|
|
1414
|
+
const fieldContext = React5.useContext(FormFieldContext2);
|
|
1415
|
+
const itemContext = React5.useContext(FormItemContext2);
|
|
1146
1416
|
const { getFieldState } = useFormContext();
|
|
1147
1417
|
const formState = useFormState({ name: fieldContext.name });
|
|
1148
1418
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1159,9 +1429,9 @@ var useFormField2 = () => {
|
|
|
1159
1429
|
...fieldState
|
|
1160
1430
|
};
|
|
1161
1431
|
};
|
|
1162
|
-
var FormItemContext2 =
|
|
1432
|
+
var FormItemContext2 = React5.createContext({});
|
|
1163
1433
|
function FormItem2({ className, ...props }) {
|
|
1164
|
-
const id =
|
|
1434
|
+
const id = React5.useId();
|
|
1165
1435
|
return /* @__PURE__ */ jsx(FormItemContext2.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
1166
1436
|
}
|
|
1167
1437
|
function FormControl({ ...props }) {
|
|
@@ -1464,7 +1734,7 @@ function SortableRow({
|
|
|
1464
1734
|
id: value,
|
|
1465
1735
|
disabled: name == "columns.0.id"
|
|
1466
1736
|
});
|
|
1467
|
-
const style =
|
|
1737
|
+
const style = React5.useMemo(
|
|
1468
1738
|
() => ({
|
|
1469
1739
|
transform: CSS.Transform.toString(transform),
|
|
1470
1740
|
transition
|
|
@@ -1897,7 +2167,7 @@ var InfoIcon = (props) => {
|
|
|
1897
2167
|
}
|
|
1898
2168
|
);
|
|
1899
2169
|
};
|
|
1900
|
-
var InfoIcon_default =
|
|
2170
|
+
var InfoIcon_default = React5__default.memo(InfoIcon);
|
|
1901
2171
|
function TooltipProvider2({
|
|
1902
2172
|
delayDuration = 0,
|
|
1903
2173
|
...props
|
|
@@ -2074,13 +2344,13 @@ var Navbar = ({
|
|
|
2074
2344
|
}
|
|
2075
2345
|
);
|
|
2076
2346
|
};
|
|
2077
|
-
var navbar_default =
|
|
2347
|
+
var navbar_default = React5__default.memo(Navbar);
|
|
2078
2348
|
var ExpandCollapse = ({ title, children, portalId }) => {
|
|
2079
2349
|
const [isOpen, setIsOpen] = useState(false);
|
|
2080
2350
|
const Panel = /* @__PURE__ */ jsx(
|
|
2081
2351
|
"div",
|
|
2082
2352
|
{
|
|
2083
|
-
className:
|
|
2353
|
+
className: clsx2(
|
|
2084
2354
|
"overflow-hidden transition-all duration-500 ease-in-out bg-white border-b shadow-md w-full",
|
|
2085
2355
|
isOpen ? "max-h-[700px] opacity-100" : "max-h-0 opacity-0"
|
|
2086
2356
|
),
|
|
@@ -2113,7 +2383,6 @@ var ExpandCollapse_default = ExpandCollapse;
|
|
|
2113
2383
|
|
|
2114
2384
|
// src/components/advanceSearch/operatorMap.ts
|
|
2115
2385
|
var OPERATOR_MAP = {
|
|
2116
|
-
uuid: ["equals", "notEquals", "gt", "gte", "lt", "lte"],
|
|
2117
2386
|
text: [
|
|
2118
2387
|
"contains",
|
|
2119
2388
|
"equals",
|
|
@@ -2129,7 +2398,18 @@ var OPERATOR_MAP = {
|
|
|
2129
2398
|
datetime: ["on", "after", "before", "between"],
|
|
2130
2399
|
checkbox: ["is", "isNot"],
|
|
2131
2400
|
dropdown: ["is", "isNot"],
|
|
2132
|
-
lookup: ["containsAny", "containsOnly", "containsAll", "notContains"]
|
|
2401
|
+
lookup: ["containsAny", "containsOnly", "containsAll", "notContains"],
|
|
2402
|
+
uuid: ["equals", "notEquals", "gt", "gte", "lt", "lte"],
|
|
2403
|
+
json: [
|
|
2404
|
+
"contains",
|
|
2405
|
+
"equals",
|
|
2406
|
+
"beginsWith",
|
|
2407
|
+
"endsWith",
|
|
2408
|
+
"notEquals",
|
|
2409
|
+
"notBeginsWith",
|
|
2410
|
+
"notEndsWith",
|
|
2411
|
+
"notContains"
|
|
2412
|
+
]
|
|
2133
2413
|
};
|
|
2134
2414
|
|
|
2135
2415
|
// src/components/advanceSearch/hooks/useAdvanceSearch.ts
|
|
@@ -2153,7 +2433,8 @@ function makeNewRow(field) {
|
|
|
2153
2433
|
operator: "between",
|
|
2154
2434
|
value: "",
|
|
2155
2435
|
value2: "",
|
|
2156
|
-
multiTableSearch: field.multiTableSearch
|
|
2436
|
+
multiTableSearch: field.multiTableSearch,
|
|
2437
|
+
jsonPath: field.jsonPath
|
|
2157
2438
|
};
|
|
2158
2439
|
}
|
|
2159
2440
|
return {
|
|
@@ -2162,7 +2443,8 @@ function makeNewRow(field) {
|
|
|
2162
2443
|
fieldType: field.type,
|
|
2163
2444
|
operator: op,
|
|
2164
2445
|
value: "",
|
|
2165
|
-
multiTableSearch: field.multiTableSearch
|
|
2446
|
+
multiTableSearch: field.multiTableSearch,
|
|
2447
|
+
jsonPath: field.jsonPath
|
|
2166
2448
|
};
|
|
2167
2449
|
}
|
|
2168
2450
|
function useAdvanceSearch({ fields, limitRows }) {
|
|
@@ -2234,6 +2516,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2234
2516
|
fieldName: r2.fieldName,
|
|
2235
2517
|
fieldType: r2.fieldType,
|
|
2236
2518
|
multiTableSearch: r2.multiTableSearch,
|
|
2519
|
+
jsonPath: r2.jsonPath,
|
|
2237
2520
|
operator,
|
|
2238
2521
|
value: "",
|
|
2239
2522
|
value2: ""
|
|
@@ -2244,6 +2527,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2244
2527
|
fieldName: r2.fieldName,
|
|
2245
2528
|
fieldType: r2.fieldType,
|
|
2246
2529
|
multiTableSearch: r2.multiTableSearch,
|
|
2530
|
+
jsonPath: r2.jsonPath,
|
|
2247
2531
|
operator,
|
|
2248
2532
|
value: ""
|
|
2249
2533
|
};
|
|
@@ -2271,16 +2555,6 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2271
2555
|
})),
|
|
2272
2556
|
[fields]
|
|
2273
2557
|
);
|
|
2274
|
-
const buildFilter = useCallback(
|
|
2275
|
-
(prismaFilter, options) => {
|
|
2276
|
-
return options?.multiTableSearch ? {
|
|
2277
|
-
some: {
|
|
2278
|
-
value: { ...prismaFilter, ...options?.insensitive ? { mode: "insensitive" } : void 0 }
|
|
2279
|
-
}
|
|
2280
|
-
} : prismaFilter;
|
|
2281
|
-
},
|
|
2282
|
-
[]
|
|
2283
|
-
);
|
|
2284
2558
|
return {
|
|
2285
2559
|
rows,
|
|
2286
2560
|
addRow,
|
|
@@ -2291,8 +2565,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2291
2565
|
changeOperator,
|
|
2292
2566
|
changeValue,
|
|
2293
2567
|
operatorsForField,
|
|
2294
|
-
fieldOptions
|
|
2295
|
-
buildFilter
|
|
2568
|
+
fieldOptions
|
|
2296
2569
|
};
|
|
2297
2570
|
}
|
|
2298
2571
|
|
|
@@ -2320,6 +2593,9 @@ var OPERATOR_LABEL = {
|
|
|
2320
2593
|
containsOnly: "Contains only",
|
|
2321
2594
|
containsAll: "Contains all of"
|
|
2322
2595
|
};
|
|
2596
|
+
function cn2(...inputs) {
|
|
2597
|
+
return twMerge(clsx(inputs));
|
|
2598
|
+
}
|
|
2323
2599
|
function Select2({ ...props }) {
|
|
2324
2600
|
return /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
2325
2601
|
}
|
|
@@ -2601,13 +2877,13 @@ function DatePicker({
|
|
|
2601
2877
|
className,
|
|
2602
2878
|
...props
|
|
2603
2879
|
}) {
|
|
2604
|
-
const today =
|
|
2605
|
-
const [displayed, setDisplayed] =
|
|
2880
|
+
const today = React5.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
2881
|
+
const [displayed, setDisplayed] = React5.useState(
|
|
2606
2882
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
2607
2883
|
);
|
|
2608
2884
|
minDate = clampToDay(minDate);
|
|
2609
2885
|
maxDate = clampToDay(maxDate);
|
|
2610
|
-
const disabledSet =
|
|
2886
|
+
const disabledSet = React5.useMemo(() => {
|
|
2611
2887
|
const s2 = /* @__PURE__ */ new Set();
|
|
2612
2888
|
disabledDates?.forEach((d) => s2.add(startOfDay(d).toISOString()));
|
|
2613
2889
|
return s2;
|
|
@@ -2616,7 +2892,7 @@ function DatePicker({
|
|
|
2616
2892
|
const displayMonth = displayed.getMonth();
|
|
2617
2893
|
const monthLabel = callbacks?.monthLabel?.(displayYear, displayMonth) ?? new Intl.DateTimeFormat(void 0, { month: "short" }).format(displayed);
|
|
2618
2894
|
const yearLabel = callbacks?.yearLabel?.(displayYear) ?? String(displayYear);
|
|
2619
|
-
const weekdays =
|
|
2895
|
+
const weekdays = React5.useMemo(() => {
|
|
2620
2896
|
const labels = [];
|
|
2621
2897
|
for (let i2 = 0; i2 < 7; i2++) {
|
|
2622
2898
|
const idx = i2;
|
|
@@ -2625,7 +2901,7 @@ function DatePicker({
|
|
|
2625
2901
|
}
|
|
2626
2902
|
return labels;
|
|
2627
2903
|
}, [callbacks]);
|
|
2628
|
-
const grid =
|
|
2904
|
+
const grid = React5.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
2629
2905
|
const isDateDisabled = (date) => {
|
|
2630
2906
|
const d = startOfDay(date);
|
|
2631
2907
|
if (minDate && d < minDate) return true;
|
|
@@ -4399,10 +4675,10 @@ function splitDateString(dateString) {
|
|
|
4399
4675
|
return dateStrings;
|
|
4400
4676
|
}
|
|
4401
4677
|
function parseYear(dateString, additionalDigits) {
|
|
4402
|
-
const
|
|
4678
|
+
const regex2 = new RegExp(
|
|
4403
4679
|
"^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
|
|
4404
4680
|
);
|
|
4405
|
-
const captures = dateString.match(
|
|
4681
|
+
const captures = dateString.match(regex2);
|
|
4406
4682
|
if (!captures) return { year: NaN, restDateString: "" };
|
|
4407
4683
|
const year = captures[1] ? parseInt(captures[1]) : null;
|
|
4408
4684
|
const century = captures[2] ? parseInt(captures[2]) : null;
|
|
@@ -4508,15 +4784,15 @@ function Label4({ className, ...props }) {
|
|
|
4508
4784
|
);
|
|
4509
4785
|
}
|
|
4510
4786
|
var Form2 = FormProvider;
|
|
4511
|
-
var FormFieldContext3 =
|
|
4787
|
+
var FormFieldContext3 = React5.createContext({});
|
|
4512
4788
|
var FormField3 = ({
|
|
4513
4789
|
...props
|
|
4514
4790
|
}) => {
|
|
4515
4791
|
return /* @__PURE__ */ jsx(FormFieldContext3.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
4516
4792
|
};
|
|
4517
4793
|
var useFormField3 = () => {
|
|
4518
|
-
const fieldContext =
|
|
4519
|
-
const itemContext =
|
|
4794
|
+
const fieldContext = React5.useContext(FormFieldContext3);
|
|
4795
|
+
const itemContext = React5.useContext(FormItemContext3);
|
|
4520
4796
|
const { getFieldState } = useFormContext();
|
|
4521
4797
|
const formState = useFormState({ name: fieldContext.name });
|
|
4522
4798
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -4533,9 +4809,9 @@ var useFormField3 = () => {
|
|
|
4533
4809
|
...fieldState
|
|
4534
4810
|
};
|
|
4535
4811
|
};
|
|
4536
|
-
var FormItemContext3 =
|
|
4812
|
+
var FormItemContext3 = React5.createContext({});
|
|
4537
4813
|
function FormItem3({ className, ...props }) {
|
|
4538
|
-
const id =
|
|
4814
|
+
const id = React5.useId();
|
|
4539
4815
|
return /* @__PURE__ */ jsx(FormItemContext3.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn2("grid gap-2", className), ...props }) });
|
|
4540
4816
|
}
|
|
4541
4817
|
function FormControl2({ ...props }) {
|
|
@@ -4567,7 +4843,7 @@ var AdvanceSearchRow = ({
|
|
|
4567
4843
|
const { control } = form;
|
|
4568
4844
|
const fieldSchema = fields.find((f) => f.name === row.fieldName);
|
|
4569
4845
|
const fieldType = fieldSchema?.type ?? "text";
|
|
4570
|
-
|
|
4846
|
+
React5__default.useEffect(() => {
|
|
4571
4847
|
if (operators && operators.length > 0 && !operators.includes(row.operator)) {
|
|
4572
4848
|
onChangeOperator(operators[0]);
|
|
4573
4849
|
}
|
|
@@ -4578,8 +4854,8 @@ var AdvanceSearchRow = ({
|
|
|
4578
4854
|
const isLookup = fieldType === "lookup";
|
|
4579
4855
|
const isNumber = fieldType === "number";
|
|
4580
4856
|
const isDate2 = fieldType === "date" || fieldType === "datetime";
|
|
4581
|
-
const [openDateValue1, setOpenDateValue1] =
|
|
4582
|
-
const [openDateValue2, setOpenDateValue2] =
|
|
4857
|
+
const [openDateValue1, setOpenDateValue1] = React5__default.useState(false);
|
|
4858
|
+
const [openDateValue2, setOpenDateValue2] = React5__default.useState(false);
|
|
4583
4859
|
const toDateFromISO = (v) => {
|
|
4584
4860
|
if (!v) return void 0;
|
|
4585
4861
|
try {
|
|
@@ -4810,6 +5086,372 @@ var AdvanceSearchRow = ({
|
|
|
4810
5086
|
) })
|
|
4811
5087
|
] });
|
|
4812
5088
|
};
|
|
5089
|
+
|
|
5090
|
+
// src/components/advanceSearch/builder/checkbox.ts
|
|
5091
|
+
var CheckboxBuilder = class {
|
|
5092
|
+
build(row) {
|
|
5093
|
+
switch (row.operator) {
|
|
5094
|
+
case "is":
|
|
5095
|
+
return { [row.fieldName]: row.value };
|
|
5096
|
+
case "isNot":
|
|
5097
|
+
return { [row.fieldName]: { not: row.value } };
|
|
5098
|
+
default:
|
|
5099
|
+
return {};
|
|
5100
|
+
}
|
|
5101
|
+
}
|
|
5102
|
+
};
|
|
5103
|
+
|
|
5104
|
+
// src/components/advanceSearch/builder/helper.ts
|
|
5105
|
+
var helper = (prismaFilter, options) => {
|
|
5106
|
+
return options?.multiTableSearch ? {
|
|
5107
|
+
some: {
|
|
5108
|
+
value: { ...prismaFilter, ...options?.insensitive ? { mode: "insensitive" } : void 0 }
|
|
5109
|
+
}
|
|
5110
|
+
} : prismaFilter;
|
|
5111
|
+
};
|
|
5112
|
+
|
|
5113
|
+
// src/components/advanceSearch/builder/datetime.ts
|
|
5114
|
+
var DatetimeBuilder = class {
|
|
5115
|
+
build(row) {
|
|
5116
|
+
try {
|
|
5117
|
+
const start = new Date(row.value);
|
|
5118
|
+
start.setHours(0, 0, 0, 0);
|
|
5119
|
+
const end = new Date(row.value);
|
|
5120
|
+
end.setHours(23, 59, 59, 59);
|
|
5121
|
+
switch (row.operator) {
|
|
5122
|
+
case "on": {
|
|
5123
|
+
return {
|
|
5124
|
+
[row.fieldName]: helper(
|
|
5125
|
+
{ gte: start.toISOString(), lt: end.toISOString() },
|
|
5126
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5127
|
+
)
|
|
5128
|
+
};
|
|
5129
|
+
}
|
|
5130
|
+
case "after":
|
|
5131
|
+
return {
|
|
5132
|
+
[row.fieldName]: helper(
|
|
5133
|
+
{ gte: start.toISOString() },
|
|
5134
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5135
|
+
)
|
|
5136
|
+
};
|
|
5137
|
+
case "before":
|
|
5138
|
+
return {
|
|
5139
|
+
[row.fieldName]: helper(
|
|
5140
|
+
{ lt: start.toISOString() },
|
|
5141
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5142
|
+
)
|
|
5143
|
+
};
|
|
5144
|
+
case "between": {
|
|
5145
|
+
const start2 = new Date(row.value);
|
|
5146
|
+
start2.setHours(0, 0, 0, 0);
|
|
5147
|
+
const end2 = new Date(row.value2);
|
|
5148
|
+
end2.setHours(23, 59, 59, 59);
|
|
5149
|
+
return {
|
|
5150
|
+
[row.fieldName]: helper(
|
|
5151
|
+
{ gte: start2.toISOString(), lt: end2.toISOString() },
|
|
5152
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5153
|
+
)
|
|
5154
|
+
};
|
|
5155
|
+
}
|
|
5156
|
+
default:
|
|
5157
|
+
return {};
|
|
5158
|
+
}
|
|
5159
|
+
} catch {
|
|
5160
|
+
return {};
|
|
5161
|
+
}
|
|
5162
|
+
}
|
|
5163
|
+
};
|
|
5164
|
+
|
|
5165
|
+
// src/components/advanceSearch/builder/dropdown.ts
|
|
5166
|
+
var DropdownBuilder = class {
|
|
5167
|
+
build(row) {
|
|
5168
|
+
switch (row.operator) {
|
|
5169
|
+
case "is":
|
|
5170
|
+
return { [row.fieldName]: row.value };
|
|
5171
|
+
case "isNot":
|
|
5172
|
+
return { [row.fieldName]: { not: row.value } };
|
|
5173
|
+
default:
|
|
5174
|
+
return {};
|
|
5175
|
+
}
|
|
5176
|
+
}
|
|
5177
|
+
};
|
|
5178
|
+
|
|
5179
|
+
// src/components/advanceSearch/builder/json.ts
|
|
5180
|
+
var JSONBuilder = class {
|
|
5181
|
+
build(row) {
|
|
5182
|
+
switch (row.operator) {
|
|
5183
|
+
case "contains":
|
|
5184
|
+
return { [row.fieldName]: { path: row.jsonPath, string_contains: row.value } };
|
|
5185
|
+
case "equals":
|
|
5186
|
+
return { [row.fieldName]: { path: row.jsonPath, equals: row.value } };
|
|
5187
|
+
case "beginsWith":
|
|
5188
|
+
return { [row.fieldName]: { path: row.jsonPath, string_starts_with: row.value } };
|
|
5189
|
+
case "endsWith":
|
|
5190
|
+
return { [row.fieldName]: { path: row.jsonPath, string_ends_with: row.value } };
|
|
5191
|
+
case "notContains":
|
|
5192
|
+
return { [row.fieldName]: { path: row.jsonPath, not: { string_contains: row.value } } };
|
|
5193
|
+
case "notEquals":
|
|
5194
|
+
return { [row.fieldName]: { path: row.jsonPath, not: { equals: row.value } } };
|
|
5195
|
+
case "notBeginsWith":
|
|
5196
|
+
return { [row.fieldName]: { path: row.jsonPath, not: { string_starts_with: row.value } } };
|
|
5197
|
+
case "notEndsWith":
|
|
5198
|
+
return { [row.fieldName]: { path: row.jsonPath, not: { string_ends_with: row.value } } };
|
|
5199
|
+
default:
|
|
5200
|
+
return {};
|
|
5201
|
+
}
|
|
5202
|
+
}
|
|
5203
|
+
};
|
|
5204
|
+
|
|
5205
|
+
// src/components/advanceSearch/builder/lookup.ts
|
|
5206
|
+
var LookupBuilder = class {
|
|
5207
|
+
build(row) {
|
|
5208
|
+
switch (row.operator) {
|
|
5209
|
+
case "containsAny":
|
|
5210
|
+
return {
|
|
5211
|
+
[row.fieldName]: helper(
|
|
5212
|
+
{ hasSome: String(row.value).split(",") },
|
|
5213
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5214
|
+
)
|
|
5215
|
+
};
|
|
5216
|
+
case "containsAll":
|
|
5217
|
+
return {
|
|
5218
|
+
[row.fieldName]: helper(
|
|
5219
|
+
{ hasEvery: String(row.value).split(",") },
|
|
5220
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5221
|
+
)
|
|
5222
|
+
};
|
|
5223
|
+
case "containsOnly":
|
|
5224
|
+
return {
|
|
5225
|
+
[row.fieldName]: helper(
|
|
5226
|
+
{ equals: String(row.value).split(",") },
|
|
5227
|
+
{
|
|
5228
|
+
multiTableSearch: row.multiTableSearch,
|
|
5229
|
+
insensitive: true
|
|
5230
|
+
}
|
|
5231
|
+
)
|
|
5232
|
+
};
|
|
5233
|
+
case "notContains":
|
|
5234
|
+
return {
|
|
5235
|
+
[row.fieldName]: helper(
|
|
5236
|
+
{ not: { contains: row.value } },
|
|
5237
|
+
{
|
|
5238
|
+
multiTableSearch: row.multiTableSearch,
|
|
5239
|
+
insensitive: true
|
|
5240
|
+
}
|
|
5241
|
+
)
|
|
5242
|
+
};
|
|
5243
|
+
default:
|
|
5244
|
+
return {};
|
|
5245
|
+
}
|
|
5246
|
+
}
|
|
5247
|
+
};
|
|
5248
|
+
|
|
5249
|
+
// src/components/advanceSearch/builder/number.ts
|
|
5250
|
+
var NumberBuilder = class {
|
|
5251
|
+
build(row) {
|
|
5252
|
+
const value = Number(row.value);
|
|
5253
|
+
switch (row.operator) {
|
|
5254
|
+
case "gt":
|
|
5255
|
+
return {
|
|
5256
|
+
[row.fieldName]: helper({ gt: value }, { multiTableSearch: row.multiTableSearch })
|
|
5257
|
+
};
|
|
5258
|
+
case "gte":
|
|
5259
|
+
return {
|
|
5260
|
+
[row.fieldName]: helper({ gte: value }, { multiTableSearch: row.multiTableSearch })
|
|
5261
|
+
};
|
|
5262
|
+
case "lt":
|
|
5263
|
+
return {
|
|
5264
|
+
[row.fieldName]: helper({ lt: value }, { multiTableSearch: row.multiTableSearch })
|
|
5265
|
+
};
|
|
5266
|
+
case "lte":
|
|
5267
|
+
return {
|
|
5268
|
+
[row.fieldName]: helper({ lte: value }, { multiTableSearch: row.multiTableSearch })
|
|
5269
|
+
};
|
|
5270
|
+
case "equals":
|
|
5271
|
+
return {
|
|
5272
|
+
[row.fieldName]: helper(
|
|
5273
|
+
{ equals: value },
|
|
5274
|
+
{
|
|
5275
|
+
multiTableSearch: row.multiTableSearch
|
|
5276
|
+
}
|
|
5277
|
+
)
|
|
5278
|
+
};
|
|
5279
|
+
case "notEquals":
|
|
5280
|
+
return {
|
|
5281
|
+
[row.fieldName]: helper(
|
|
5282
|
+
{ not: value },
|
|
5283
|
+
{
|
|
5284
|
+
multiTableSearch: row.multiTableSearch
|
|
5285
|
+
}
|
|
5286
|
+
)
|
|
5287
|
+
};
|
|
5288
|
+
default:
|
|
5289
|
+
return {};
|
|
5290
|
+
}
|
|
5291
|
+
}
|
|
5292
|
+
};
|
|
5293
|
+
|
|
5294
|
+
// src/components/advanceSearch/builder/text.ts
|
|
5295
|
+
var TextBuilder = class {
|
|
5296
|
+
build(row) {
|
|
5297
|
+
switch (row.operator) {
|
|
5298
|
+
case "contains":
|
|
5299
|
+
return {
|
|
5300
|
+
[row.fieldName]: helper(
|
|
5301
|
+
{ contains: row.value },
|
|
5302
|
+
{
|
|
5303
|
+
multiTableSearch: row.multiTableSearch,
|
|
5304
|
+
insensitive: true
|
|
5305
|
+
}
|
|
5306
|
+
)
|
|
5307
|
+
};
|
|
5308
|
+
case "equals":
|
|
5309
|
+
return {
|
|
5310
|
+
[row.fieldName]: helper(
|
|
5311
|
+
{ equals: row.value },
|
|
5312
|
+
{
|
|
5313
|
+
multiTableSearch: row.multiTableSearch,
|
|
5314
|
+
insensitive: true
|
|
5315
|
+
}
|
|
5316
|
+
)
|
|
5317
|
+
};
|
|
5318
|
+
case "beginsWith":
|
|
5319
|
+
return {
|
|
5320
|
+
[row.fieldName]: helper(
|
|
5321
|
+
{ startsWith: row.value },
|
|
5322
|
+
{
|
|
5323
|
+
multiTableSearch: row.multiTableSearch,
|
|
5324
|
+
insensitive: true
|
|
5325
|
+
}
|
|
5326
|
+
)
|
|
5327
|
+
};
|
|
5328
|
+
case "endsWith":
|
|
5329
|
+
return {
|
|
5330
|
+
[row.fieldName]: helper(
|
|
5331
|
+
{ endsWith: row.value },
|
|
5332
|
+
{
|
|
5333
|
+
multiTableSearch: row.multiTableSearch,
|
|
5334
|
+
insensitive: true
|
|
5335
|
+
}
|
|
5336
|
+
)
|
|
5337
|
+
};
|
|
5338
|
+
case "notEquals":
|
|
5339
|
+
return {
|
|
5340
|
+
[row.fieldName]: helper(
|
|
5341
|
+
{ not: row.value },
|
|
5342
|
+
{
|
|
5343
|
+
multiTableSearch: row.multiTableSearch,
|
|
5344
|
+
insensitive: true
|
|
5345
|
+
}
|
|
5346
|
+
)
|
|
5347
|
+
};
|
|
5348
|
+
case "notBeginsWith":
|
|
5349
|
+
return {
|
|
5350
|
+
[row.fieldName]: helper(
|
|
5351
|
+
{ not: { startsWith: row.value } },
|
|
5352
|
+
{
|
|
5353
|
+
multiTableSearch: row.multiTableSearch,
|
|
5354
|
+
insensitive: true
|
|
5355
|
+
}
|
|
5356
|
+
)
|
|
5357
|
+
};
|
|
5358
|
+
case "notEndsWith":
|
|
5359
|
+
return {
|
|
5360
|
+
[row.fieldName]: helper(
|
|
5361
|
+
{ not: { endsWith: row.value } },
|
|
5362
|
+
{
|
|
5363
|
+
multiTableSearch: row.multiTableSearch,
|
|
5364
|
+
insensitive: true
|
|
5365
|
+
}
|
|
5366
|
+
)
|
|
5367
|
+
};
|
|
5368
|
+
case "notContains":
|
|
5369
|
+
return {
|
|
5370
|
+
[row.fieldName]: helper(
|
|
5371
|
+
{ not: { contains: row.value } },
|
|
5372
|
+
{
|
|
5373
|
+
multiTableSearch: row.multiTableSearch,
|
|
5374
|
+
insensitive: true
|
|
5375
|
+
}
|
|
5376
|
+
)
|
|
5377
|
+
};
|
|
5378
|
+
default:
|
|
5379
|
+
return {};
|
|
5380
|
+
}
|
|
5381
|
+
}
|
|
5382
|
+
};
|
|
5383
|
+
|
|
5384
|
+
// src/components/advanceSearch/builder/uuid.ts
|
|
5385
|
+
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;
|
|
5386
|
+
var UUIDBuilder = class {
|
|
5387
|
+
build(row) {
|
|
5388
|
+
if (!regex.test(row.value)) {
|
|
5389
|
+
return { [row.fieldName]: {} };
|
|
5390
|
+
}
|
|
5391
|
+
switch (row.operator) {
|
|
5392
|
+
case "gt":
|
|
5393
|
+
return {
|
|
5394
|
+
[row.fieldName]: helper({ gt: row.value }, { multiTableSearch: row.multiTableSearch })
|
|
5395
|
+
};
|
|
5396
|
+
case "gte":
|
|
5397
|
+
return {
|
|
5398
|
+
[row.fieldName]: helper({ gte: row.value }, { multiTableSearch: row.multiTableSearch })
|
|
5399
|
+
};
|
|
5400
|
+
case "lt":
|
|
5401
|
+
return {
|
|
5402
|
+
[row.fieldName]: helper({ lt: row.value }, { multiTableSearch: row.multiTableSearch })
|
|
5403
|
+
};
|
|
5404
|
+
case "lte":
|
|
5405
|
+
return {
|
|
5406
|
+
[row.fieldName]: helper({ lte: row.value }, { multiTableSearch: row.multiTableSearch })
|
|
5407
|
+
};
|
|
5408
|
+
case "equals":
|
|
5409
|
+
return {
|
|
5410
|
+
[row.fieldName]: helper(
|
|
5411
|
+
{ equals: row.value },
|
|
5412
|
+
{
|
|
5413
|
+
multiTableSearch: row.multiTableSearch
|
|
5414
|
+
}
|
|
5415
|
+
)
|
|
5416
|
+
};
|
|
5417
|
+
case "notEquals":
|
|
5418
|
+
return {
|
|
5419
|
+
[row.fieldName]: helper(
|
|
5420
|
+
{ not: row.value },
|
|
5421
|
+
{
|
|
5422
|
+
multiTableSearch: row.multiTableSearch
|
|
5423
|
+
}
|
|
5424
|
+
)
|
|
5425
|
+
};
|
|
5426
|
+
default:
|
|
5427
|
+
return {};
|
|
5428
|
+
}
|
|
5429
|
+
}
|
|
5430
|
+
};
|
|
5431
|
+
|
|
5432
|
+
// src/components/advanceSearch/builder/index.ts
|
|
5433
|
+
function getBuilder(fieldType) {
|
|
5434
|
+
switch (fieldType) {
|
|
5435
|
+
case "text":
|
|
5436
|
+
return new TextBuilder();
|
|
5437
|
+
case "number":
|
|
5438
|
+
return new NumberBuilder();
|
|
5439
|
+
case "date":
|
|
5440
|
+
return new DatetimeBuilder();
|
|
5441
|
+
case "datetime":
|
|
5442
|
+
return new DatetimeBuilder();
|
|
5443
|
+
case "checkbox":
|
|
5444
|
+
return new CheckboxBuilder();
|
|
5445
|
+
case "dropdown":
|
|
5446
|
+
return new DropdownBuilder();
|
|
5447
|
+
case "lookup":
|
|
5448
|
+
return new LookupBuilder();
|
|
5449
|
+
case "uuid":
|
|
5450
|
+
return new UUIDBuilder();
|
|
5451
|
+
case "json":
|
|
5452
|
+
return new JSONBuilder();
|
|
5453
|
+
}
|
|
5454
|
+
}
|
|
4813
5455
|
var AdvanceSearch = ({
|
|
4814
5456
|
fields,
|
|
4815
5457
|
portalId,
|
|
@@ -4831,8 +5473,7 @@ var AdvanceSearch = ({
|
|
|
4831
5473
|
changeField,
|
|
4832
5474
|
changeOperator,
|
|
4833
5475
|
operatorsForField,
|
|
4834
|
-
fieldOptions
|
|
4835
|
-
buildFilter
|
|
5476
|
+
fieldOptions
|
|
4836
5477
|
} = useAdvanceSearch({ fields: fieldsData, limitRows });
|
|
4837
5478
|
const form = useForm({
|
|
4838
5479
|
mode: "onSubmit",
|
|
@@ -4842,183 +5483,21 @@ var AdvanceSearch = ({
|
|
|
4842
5483
|
const { handleSubmit, unregister, resetField, getValues, setValue } = form;
|
|
4843
5484
|
const onSubmit = useCallback(() => {
|
|
4844
5485
|
const currentValues = getValues();
|
|
5486
|
+
const rawRows = rows.map((r2) => {
|
|
5487
|
+
r2.value = currentValues[`value_${r2.id}`] ?? "";
|
|
5488
|
+
r2.value2 = currentValues[`value2_${r2.id}`] ?? "";
|
|
5489
|
+
return r2;
|
|
5490
|
+
});
|
|
4845
5491
|
const param = {
|
|
4846
|
-
AND:
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
if (r2.operator === "between") {
|
|
4850
|
-
if (!val1 || !val2) return null;
|
|
4851
|
-
const start = new Date(val1);
|
|
4852
|
-
start.setHours(0, 0, 0, 0);
|
|
4853
|
-
const end = new Date(val2);
|
|
4854
|
-
end.setHours(23, 59, 59, 59);
|
|
4855
|
-
return {
|
|
4856
|
-
[r2.fieldName]: {
|
|
4857
|
-
gte: start.toISOString(),
|
|
4858
|
-
lt: end.toISOString()
|
|
4859
|
-
}
|
|
4860
|
-
};
|
|
4861
|
-
}
|
|
4862
|
-
if (!val1) return null;
|
|
4863
|
-
val1 = r2.fieldType === "number" ? Number(val1) : val1;
|
|
4864
|
-
switch (r2.operator) {
|
|
4865
|
-
case "contains":
|
|
4866
|
-
return {
|
|
4867
|
-
[r2.fieldName]: buildFilter(
|
|
4868
|
-
{ contains: val1 },
|
|
4869
|
-
{
|
|
4870
|
-
multiTableSearch: r2.multiTableSearch,
|
|
4871
|
-
insensitive: true
|
|
4872
|
-
}
|
|
4873
|
-
)
|
|
4874
|
-
};
|
|
4875
|
-
case "beginsWith":
|
|
4876
|
-
return {
|
|
4877
|
-
[r2.fieldName]: buildFilter(
|
|
4878
|
-
{ startsWith: val1 },
|
|
4879
|
-
{
|
|
4880
|
-
multiTableSearch: r2.multiTableSearch,
|
|
4881
|
-
insensitive: true
|
|
4882
|
-
}
|
|
4883
|
-
)
|
|
4884
|
-
};
|
|
4885
|
-
case "endsWith":
|
|
4886
|
-
return {
|
|
4887
|
-
[r2.fieldName]: buildFilter(
|
|
4888
|
-
{ endsWith: val1 },
|
|
4889
|
-
{
|
|
4890
|
-
multiTableSearch: r2.multiTableSearch,
|
|
4891
|
-
insensitive: true
|
|
4892
|
-
}
|
|
4893
|
-
)
|
|
4894
|
-
};
|
|
4895
|
-
case "equals":
|
|
4896
|
-
return {
|
|
4897
|
-
[r2.fieldName]: buildFilter(
|
|
4898
|
-
{ equals: val1 },
|
|
4899
|
-
{
|
|
4900
|
-
multiTableSearch: r2.multiTableSearch,
|
|
4901
|
-
insensitive: true
|
|
4902
|
-
}
|
|
4903
|
-
)
|
|
4904
|
-
};
|
|
4905
|
-
case "notEquals":
|
|
4906
|
-
return {
|
|
4907
|
-
[r2.fieldName]: buildFilter(
|
|
4908
|
-
{ not: val1 },
|
|
4909
|
-
{
|
|
4910
|
-
multiTableSearch: r2.multiTableSearch,
|
|
4911
|
-
insensitive: true
|
|
4912
|
-
}
|
|
4913
|
-
)
|
|
4914
|
-
};
|
|
4915
|
-
case "gt":
|
|
4916
|
-
return {
|
|
4917
|
-
[r2.fieldName]: buildFilter({ gt: val1 }, { multiTableSearch: r2.multiTableSearch })
|
|
4918
|
-
};
|
|
4919
|
-
case "gte":
|
|
4920
|
-
return {
|
|
4921
|
-
[r2.fieldName]: buildFilter({ gte: val1 }, { multiTableSearch: r2.multiTableSearch })
|
|
4922
|
-
};
|
|
4923
|
-
case "lt":
|
|
4924
|
-
return {
|
|
4925
|
-
[r2.fieldName]: buildFilter({ lt: val1 }, { multiTableSearch: r2.multiTableSearch })
|
|
4926
|
-
};
|
|
4927
|
-
case "lte":
|
|
4928
|
-
return {
|
|
4929
|
-
[r2.fieldName]: buildFilter({ lte: val1 }, { multiTableSearch: r2.multiTableSearch })
|
|
4930
|
-
};
|
|
4931
|
-
case "is":
|
|
4932
|
-
return { [r2.fieldName]: val1 };
|
|
4933
|
-
case "isNot":
|
|
4934
|
-
return { [r2.fieldName]: { not: val1 } };
|
|
4935
|
-
case "notContains":
|
|
4936
|
-
return {
|
|
4937
|
-
[r2.fieldName]: buildFilter(
|
|
4938
|
-
{ not: { contains: val1 } },
|
|
4939
|
-
{
|
|
4940
|
-
multiTableSearch: r2.multiTableSearch,
|
|
4941
|
-
insensitive: true
|
|
4942
|
-
}
|
|
4943
|
-
)
|
|
4944
|
-
};
|
|
4945
|
-
case "notBeginsWith":
|
|
4946
|
-
return {
|
|
4947
|
-
[r2.fieldName]: buildFilter(
|
|
4948
|
-
{ not: { startsWith: val1 } },
|
|
4949
|
-
{
|
|
4950
|
-
multiTableSearch: r2.multiTableSearch,
|
|
4951
|
-
insensitive: true
|
|
4952
|
-
}
|
|
4953
|
-
)
|
|
4954
|
-
};
|
|
4955
|
-
case "notEndsWith":
|
|
4956
|
-
return {
|
|
4957
|
-
[r2.fieldName]: buildFilter(
|
|
4958
|
-
{ not: { endsWith: val1 } },
|
|
4959
|
-
{
|
|
4960
|
-
multiTableSearch: r2.multiTableSearch,
|
|
4961
|
-
insensitive: true
|
|
4962
|
-
}
|
|
4963
|
-
)
|
|
4964
|
-
};
|
|
4965
|
-
case "containsAny":
|
|
4966
|
-
return {
|
|
4967
|
-
[r2.fieldName]: buildFilter(
|
|
4968
|
-
{ hasSome: String(val1).split(",") },
|
|
4969
|
-
{ multiTableSearch: r2.multiTableSearch }
|
|
4970
|
-
)
|
|
4971
|
-
};
|
|
4972
|
-
case "containsAll":
|
|
4973
|
-
return {
|
|
4974
|
-
[r2.fieldName]: buildFilter(
|
|
4975
|
-
{ hasEvery: String(val1).split(",") },
|
|
4976
|
-
{ multiTableSearch: r2.multiTableSearch }
|
|
4977
|
-
)
|
|
4978
|
-
};
|
|
4979
|
-
case "containsOnly":
|
|
4980
|
-
return {
|
|
4981
|
-
[r2.fieldName]: buildFilter(
|
|
4982
|
-
{ equals: String(val1).split(",") },
|
|
4983
|
-
{
|
|
4984
|
-
multiTableSearch: r2.multiTableSearch,
|
|
4985
|
-
insensitive: true
|
|
4986
|
-
}
|
|
4987
|
-
)
|
|
4988
|
-
};
|
|
4989
|
-
case "on": {
|
|
4990
|
-
const start = new Date(val1);
|
|
4991
|
-
start.setHours(0, 0, 0, 0);
|
|
4992
|
-
const end = new Date(val1);
|
|
4993
|
-
end.setHours(23, 59, 59, 59);
|
|
4994
|
-
return {
|
|
4995
|
-
[r2.fieldName]: buildFilter(
|
|
4996
|
-
{ gte: start.toISOString(), lt: end.toISOString() },
|
|
4997
|
-
{ multiTableSearch: r2.multiTableSearch }
|
|
4998
|
-
)
|
|
4999
|
-
};
|
|
5000
|
-
}
|
|
5001
|
-
case "after":
|
|
5002
|
-
return {
|
|
5003
|
-
[r2.fieldName]: buildFilter(
|
|
5004
|
-
{ gte: new Date(val1).toISOString() },
|
|
5005
|
-
{ multiTableSearch: r2.multiTableSearch }
|
|
5006
|
-
)
|
|
5007
|
-
};
|
|
5008
|
-
case "before":
|
|
5009
|
-
return {
|
|
5010
|
-
[r2.fieldName]: buildFilter(
|
|
5011
|
-
{ lt: new Date(val1).toISOString() },
|
|
5012
|
-
{ multiTableSearch: r2.multiTableSearch }
|
|
5013
|
-
)
|
|
5014
|
-
};
|
|
5015
|
-
}
|
|
5492
|
+
AND: rawRows.map((r2) => {
|
|
5493
|
+
const builder = getBuilder(r2.fieldType);
|
|
5494
|
+
return builder.build(r2);
|
|
5016
5495
|
}).filter(Boolean)
|
|
5017
5496
|
};
|
|
5018
5497
|
if (onSearch) {
|
|
5019
|
-
onSearch(param);
|
|
5498
|
+
onSearch(param, rawRows);
|
|
5020
5499
|
}
|
|
5021
|
-
}, [
|
|
5500
|
+
}, [getValues, rows, onSearch]);
|
|
5022
5501
|
return /* @__PURE__ */ jsx(
|
|
5023
5502
|
ExpandCollapse_default,
|
|
5024
5503
|
{
|
|
@@ -5277,6 +5756,6 @@ function variantClass(variant) {
|
|
|
5277
5756
|
}
|
|
5278
5757
|
}
|
|
5279
5758
|
|
|
5280
|
-
export { AdvanceSearch_default as AdvanceSearch, Button2 as Button, DataTable_default as DataTable, DialogAlert, FormErrorMessage, FormField, FormFieldContext, FormItem, FormItemContext, FormLabel, GridSettingsModal_default as GridSettingsModal, HeaderCell_default as HeaderCell, navbar_default as Navbar, NumberInput, PreventPageLeave_default as PreventPageLeave, TextInput, booleanToSelectValue, buttonVariants2 as buttonVariants, cn, compareAlphanumeric, debounce, isDefined, isEmptyObject,
|
|
5759
|
+
export { AdvanceSearch_default as AdvanceSearch, Button2 as Button, DataTable_default as DataTable, DialogAlert, FormErrorMessage, FormField, FormFieldContext, FormItem, FormItemContext, FormLabel, GridSettingsModal_default as GridSettingsModal, HeaderCell_default as HeaderCell, navbar_default as Navbar, NumberInput, PreventPageLeave_default as PreventPageLeave, TextInput, booleanToSelectValue, buttonVariants2 as buttonVariants, cn, compareAlphanumeric, debounce, isDefined, isEmptyObject, selectValueToBoolean, stripNullishObject, throttle, useFormField, useGridSettingsStore_default as useGridSettingsStore, useHover_default as useHover, useIntersectionObserver_default as useIntersectionObserver, useMediaQuery_default as useMediaQuery, usePreventPageLeave_default as usePreventPageLeave, usePreventPageLeaveStore_default as usePreventPageLeaveStore, useScreenSize_default as useScreenSize, useTruncated_default as useTruncated };
|
|
5281
5760
|
//# sourceMappingURL=index.mjs.map
|
|
5282
5761
|
//# sourceMappingURL=index.mjs.map
|