@sustaina/shared-ui 1.7.2 → 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/dist/index.css +26 -0
- package/dist/index.d.mts +61 -14
- package/dist/index.d.ts +61 -14
- package/dist/index.js +824 -346
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +768 -290
- 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,13 @@ 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
|
+
show: components?.columnSeparatorProps?.headerCell?.show ?? showSeparator,
|
|
1172
|
+
...components?.columnSeparatorProps?.headerCell
|
|
1173
|
+
}
|
|
1174
|
+
),
|
|
924
1175
|
/* @__PURE__ */ jsx(ColumnResizer_default, { header, ...components?.columnResizerProps })
|
|
925
1176
|
]
|
|
926
1177
|
},
|
|
@@ -944,7 +1195,6 @@ var DataTable = ({
|
|
|
944
1195
|
column.columnDef?.meta?.filterCellProps?.className
|
|
945
1196
|
),
|
|
946
1197
|
style: {
|
|
947
|
-
// TODO: should we separate styles for filter or use same columns styles
|
|
948
1198
|
...style,
|
|
949
1199
|
width: useColumnSizing ? column.getSize() : void 0,
|
|
950
1200
|
minWidth: useColumnSizing ? column.columnDef.minSize : void 0,
|
|
@@ -1013,20 +1263,39 @@ var DataTable = ({
|
|
|
1013
1263
|
);
|
|
1014
1264
|
}) })
|
|
1015
1265
|
] }),
|
|
1016
|
-
isTableEmptyAfterFiltering && /* @__PURE__ */ jsx(
|
|
1017
|
-
|
|
1018
|
-
content: "No records found. Please try a different search."
|
|
1019
|
-
},
|
|
1266
|
+
isTableEmptyAfterFiltering && /* @__PURE__ */ jsx(
|
|
1267
|
+
StatusContentSlot_default,
|
|
1020
1268
|
{
|
|
1021
|
-
|
|
1269
|
+
content: statusContent?.emptyFilteredData?.content ?? "No records found. Please try a different search.",
|
|
1270
|
+
icon: statusContent?.emptyFilteredData?.icon,
|
|
1271
|
+
wrapperProps: statusContent?.emptyFilteredData?.wrapperProps,
|
|
1272
|
+
defaultWrapperProps: {
|
|
1273
|
+
className: "flex flex-col h-[calc(100%-76px)] items-center justify-center text-sm py-4 gap-2"
|
|
1274
|
+
},
|
|
1275
|
+
defaultIcon: /* @__PURE__ */ jsx(empty_data_default, { className: "text-[128px]" })
|
|
1022
1276
|
}
|
|
1023
|
-
)
|
|
1024
|
-
scrollFetch?.enabled && !isFiltering && !isInitialLoading && scrollFetch?.isFetchingMore && /* @__PURE__ */ jsx(
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1277
|
+
),
|
|
1278
|
+
scrollFetch?.enabled && !isFiltering && !isInitialLoading && scrollFetch?.isFetchingMore && /* @__PURE__ */ jsx(
|
|
1279
|
+
StatusContentSlot_default,
|
|
1280
|
+
{
|
|
1281
|
+
content: statusContent?.fetchingMore?.content ?? "Loading more...",
|
|
1282
|
+
wrapperProps: statusContent?.fetchingMore?.wrapperProps,
|
|
1283
|
+
defaultWrapperProps: {
|
|
1284
|
+
className: "flex flex-col items-center justify-center text-sm py-4 gap-2"
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
),
|
|
1288
|
+
scrollFetch?.enabled && !isFiltering && !isInitialLoading && !scrollFetch?.hasMore && !scrollFetch?.isFetchingMore && /* @__PURE__ */ jsx(
|
|
1289
|
+
StatusContentSlot_default,
|
|
1290
|
+
{
|
|
1291
|
+
content: statusContent?.noMoreData?.content,
|
|
1292
|
+
icon: statusContent?.noMoreData?.icon,
|
|
1293
|
+
wrapperProps: statusContent?.noMoreData?.wrapperProps,
|
|
1294
|
+
defaultWrapperProps: {
|
|
1295
|
+
className: "flex flex-col items-center justify-center text-sm py-4 gap-2"
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
)
|
|
1030
1299
|
] }),
|
|
1031
1300
|
debug && /* @__PURE__ */ jsx(DataTableDevTool_default, { table })
|
|
1032
1301
|
]
|
|
@@ -1134,15 +1403,15 @@ var t2 = function(o3, t3, s2) {
|
|
|
1134
1403
|
};
|
|
1135
1404
|
};
|
|
1136
1405
|
var Form = FormProvider;
|
|
1137
|
-
var FormFieldContext2 =
|
|
1406
|
+
var FormFieldContext2 = React5.createContext({});
|
|
1138
1407
|
var FormField2 = ({
|
|
1139
1408
|
...props
|
|
1140
1409
|
}) => {
|
|
1141
1410
|
return /* @__PURE__ */ jsx(FormFieldContext2.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
1142
1411
|
};
|
|
1143
1412
|
var useFormField2 = () => {
|
|
1144
|
-
const fieldContext =
|
|
1145
|
-
const itemContext =
|
|
1413
|
+
const fieldContext = React5.useContext(FormFieldContext2);
|
|
1414
|
+
const itemContext = React5.useContext(FormItemContext2);
|
|
1146
1415
|
const { getFieldState } = useFormContext();
|
|
1147
1416
|
const formState = useFormState({ name: fieldContext.name });
|
|
1148
1417
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -1159,9 +1428,9 @@ var useFormField2 = () => {
|
|
|
1159
1428
|
...fieldState
|
|
1160
1429
|
};
|
|
1161
1430
|
};
|
|
1162
|
-
var FormItemContext2 =
|
|
1431
|
+
var FormItemContext2 = React5.createContext({});
|
|
1163
1432
|
function FormItem2({ className, ...props }) {
|
|
1164
|
-
const id =
|
|
1433
|
+
const id = React5.useId();
|
|
1165
1434
|
return /* @__PURE__ */ jsx(FormItemContext2.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) });
|
|
1166
1435
|
}
|
|
1167
1436
|
function FormControl({ ...props }) {
|
|
@@ -1464,7 +1733,7 @@ function SortableRow({
|
|
|
1464
1733
|
id: value,
|
|
1465
1734
|
disabled: name == "columns.0.id"
|
|
1466
1735
|
});
|
|
1467
|
-
const style =
|
|
1736
|
+
const style = React5.useMemo(
|
|
1468
1737
|
() => ({
|
|
1469
1738
|
transform: CSS.Transform.toString(transform),
|
|
1470
1739
|
transition
|
|
@@ -1688,12 +1957,12 @@ var GridSettingsModal = ({
|
|
|
1688
1957
|
children: /* @__PURE__ */ jsx(X, { className: "w-6 h-6 text-white" })
|
|
1689
1958
|
}
|
|
1690
1959
|
) }),
|
|
1691
|
-
/* @__PURE__ */ jsxs(DialogHeader, { className: cn("bg-[#
|
|
1692
|
-
/* @__PURE__ */ jsx(DialogTitle, { className: "text-
|
|
1960
|
+
/* @__PURE__ */ jsxs(DialogHeader, { className: cn("bg-[#41875C] text-white h-20 rounded-t-lg", headerClassname), children: [
|
|
1961
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "text-xl p-2 px-4", children: "Grid Settings" }),
|
|
1693
1962
|
/* @__PURE__ */ jsx(
|
|
1694
1963
|
DialogDescription,
|
|
1695
1964
|
{
|
|
1696
|
-
className: cn("bg-[#
|
|
1965
|
+
className: cn("bg-[#A7ADB8] text-white px-4 py-2.5", descriptionClassname),
|
|
1697
1966
|
children: "Add or remove columns. To change the column order, drag and drop a field."
|
|
1698
1967
|
}
|
|
1699
1968
|
)
|
|
@@ -1897,7 +2166,7 @@ var InfoIcon = (props) => {
|
|
|
1897
2166
|
}
|
|
1898
2167
|
);
|
|
1899
2168
|
};
|
|
1900
|
-
var InfoIcon_default =
|
|
2169
|
+
var InfoIcon_default = React5__default.memo(InfoIcon);
|
|
1901
2170
|
function TooltipProvider2({
|
|
1902
2171
|
delayDuration = 0,
|
|
1903
2172
|
...props
|
|
@@ -2074,13 +2343,13 @@ var Navbar = ({
|
|
|
2074
2343
|
}
|
|
2075
2344
|
);
|
|
2076
2345
|
};
|
|
2077
|
-
var navbar_default =
|
|
2346
|
+
var navbar_default = React5__default.memo(Navbar);
|
|
2078
2347
|
var ExpandCollapse = ({ title, children, portalId }) => {
|
|
2079
2348
|
const [isOpen, setIsOpen] = useState(false);
|
|
2080
2349
|
const Panel = /* @__PURE__ */ jsx(
|
|
2081
2350
|
"div",
|
|
2082
2351
|
{
|
|
2083
|
-
className:
|
|
2352
|
+
className: clsx2(
|
|
2084
2353
|
"overflow-hidden transition-all duration-500 ease-in-out bg-white border-b shadow-md w-full",
|
|
2085
2354
|
isOpen ? "max-h-[700px] opacity-100" : "max-h-0 opacity-0"
|
|
2086
2355
|
),
|
|
@@ -2113,7 +2382,6 @@ var ExpandCollapse_default = ExpandCollapse;
|
|
|
2113
2382
|
|
|
2114
2383
|
// src/components/advanceSearch/operatorMap.ts
|
|
2115
2384
|
var OPERATOR_MAP = {
|
|
2116
|
-
uuid: ["equals", "notEquals", "gt", "gte", "lt", "lte"],
|
|
2117
2385
|
text: [
|
|
2118
2386
|
"contains",
|
|
2119
2387
|
"equals",
|
|
@@ -2129,7 +2397,18 @@ var OPERATOR_MAP = {
|
|
|
2129
2397
|
datetime: ["on", "after", "before", "between"],
|
|
2130
2398
|
checkbox: ["is", "isNot"],
|
|
2131
2399
|
dropdown: ["is", "isNot"],
|
|
2132
|
-
lookup: ["containsAny", "containsOnly", "containsAll", "notContains"]
|
|
2400
|
+
lookup: ["containsAny", "containsOnly", "containsAll", "notContains"],
|
|
2401
|
+
uuid: ["equals", "notEquals", "gt", "gte", "lt", "lte"],
|
|
2402
|
+
json: [
|
|
2403
|
+
"contains",
|
|
2404
|
+
"equals",
|
|
2405
|
+
"beginsWith",
|
|
2406
|
+
"endsWith",
|
|
2407
|
+
"notEquals",
|
|
2408
|
+
"notBeginsWith",
|
|
2409
|
+
"notEndsWith",
|
|
2410
|
+
"notContains"
|
|
2411
|
+
]
|
|
2133
2412
|
};
|
|
2134
2413
|
|
|
2135
2414
|
// src/components/advanceSearch/hooks/useAdvanceSearch.ts
|
|
@@ -2153,7 +2432,8 @@ function makeNewRow(field) {
|
|
|
2153
2432
|
operator: "between",
|
|
2154
2433
|
value: "",
|
|
2155
2434
|
value2: "",
|
|
2156
|
-
multiTableSearch: field.multiTableSearch
|
|
2435
|
+
multiTableSearch: field.multiTableSearch,
|
|
2436
|
+
jsonPath: field.jsonPath
|
|
2157
2437
|
};
|
|
2158
2438
|
}
|
|
2159
2439
|
return {
|
|
@@ -2162,7 +2442,8 @@ function makeNewRow(field) {
|
|
|
2162
2442
|
fieldType: field.type,
|
|
2163
2443
|
operator: op,
|
|
2164
2444
|
value: "",
|
|
2165
|
-
multiTableSearch: field.multiTableSearch
|
|
2445
|
+
multiTableSearch: field.multiTableSearch,
|
|
2446
|
+
jsonPath: field.jsonPath
|
|
2166
2447
|
};
|
|
2167
2448
|
}
|
|
2168
2449
|
function useAdvanceSearch({ fields, limitRows }) {
|
|
@@ -2234,6 +2515,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2234
2515
|
fieldName: r2.fieldName,
|
|
2235
2516
|
fieldType: r2.fieldType,
|
|
2236
2517
|
multiTableSearch: r2.multiTableSearch,
|
|
2518
|
+
jsonPath: r2.jsonPath,
|
|
2237
2519
|
operator,
|
|
2238
2520
|
value: "",
|
|
2239
2521
|
value2: ""
|
|
@@ -2244,6 +2526,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2244
2526
|
fieldName: r2.fieldName,
|
|
2245
2527
|
fieldType: r2.fieldType,
|
|
2246
2528
|
multiTableSearch: r2.multiTableSearch,
|
|
2529
|
+
jsonPath: r2.jsonPath,
|
|
2247
2530
|
operator,
|
|
2248
2531
|
value: ""
|
|
2249
2532
|
};
|
|
@@ -2271,16 +2554,6 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2271
2554
|
})),
|
|
2272
2555
|
[fields]
|
|
2273
2556
|
);
|
|
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
2557
|
return {
|
|
2285
2558
|
rows,
|
|
2286
2559
|
addRow,
|
|
@@ -2291,8 +2564,7 @@ function useAdvanceSearch({ fields, limitRows }) {
|
|
|
2291
2564
|
changeOperator,
|
|
2292
2565
|
changeValue,
|
|
2293
2566
|
operatorsForField,
|
|
2294
|
-
fieldOptions
|
|
2295
|
-
buildFilter
|
|
2567
|
+
fieldOptions
|
|
2296
2568
|
};
|
|
2297
2569
|
}
|
|
2298
2570
|
|
|
@@ -2320,6 +2592,9 @@ var OPERATOR_LABEL = {
|
|
|
2320
2592
|
containsOnly: "Contains only",
|
|
2321
2593
|
containsAll: "Contains all of"
|
|
2322
2594
|
};
|
|
2595
|
+
function cn2(...inputs) {
|
|
2596
|
+
return twMerge(clsx(inputs));
|
|
2597
|
+
}
|
|
2323
2598
|
function Select2({ ...props }) {
|
|
2324
2599
|
return /* @__PURE__ */ jsx(SelectPrimitive.Root, { "data-slot": "select", ...props });
|
|
2325
2600
|
}
|
|
@@ -2601,13 +2876,13 @@ function DatePicker({
|
|
|
2601
2876
|
className,
|
|
2602
2877
|
...props
|
|
2603
2878
|
}) {
|
|
2604
|
-
const today =
|
|
2605
|
-
const [displayed, setDisplayed] =
|
|
2879
|
+
const today = React5.useMemo(() => startOfDay(/* @__PURE__ */ new Date()), []);
|
|
2880
|
+
const [displayed, setDisplayed] = React5.useState(
|
|
2606
2881
|
selectedDate ? new Date(selectedDate) : /* @__PURE__ */ new Date()
|
|
2607
2882
|
);
|
|
2608
2883
|
minDate = clampToDay(minDate);
|
|
2609
2884
|
maxDate = clampToDay(maxDate);
|
|
2610
|
-
const disabledSet =
|
|
2885
|
+
const disabledSet = React5.useMemo(() => {
|
|
2611
2886
|
const s2 = /* @__PURE__ */ new Set();
|
|
2612
2887
|
disabledDates?.forEach((d) => s2.add(startOfDay(d).toISOString()));
|
|
2613
2888
|
return s2;
|
|
@@ -2616,7 +2891,7 @@ function DatePicker({
|
|
|
2616
2891
|
const displayMonth = displayed.getMonth();
|
|
2617
2892
|
const monthLabel = callbacks?.monthLabel?.(displayYear, displayMonth) ?? new Intl.DateTimeFormat(void 0, { month: "short" }).format(displayed);
|
|
2618
2893
|
const yearLabel = callbacks?.yearLabel?.(displayYear) ?? String(displayYear);
|
|
2619
|
-
const weekdays =
|
|
2894
|
+
const weekdays = React5.useMemo(() => {
|
|
2620
2895
|
const labels = [];
|
|
2621
2896
|
for (let i2 = 0; i2 < 7; i2++) {
|
|
2622
2897
|
const idx = i2;
|
|
@@ -2625,7 +2900,7 @@ function DatePicker({
|
|
|
2625
2900
|
}
|
|
2626
2901
|
return labels;
|
|
2627
2902
|
}, [callbacks]);
|
|
2628
|
-
const grid =
|
|
2903
|
+
const grid = React5.useMemo(() => buildCalendarGrid(displayed, true), [displayed]);
|
|
2629
2904
|
const isDateDisabled = (date) => {
|
|
2630
2905
|
const d = startOfDay(date);
|
|
2631
2906
|
if (minDate && d < minDate) return true;
|
|
@@ -4399,10 +4674,10 @@ function splitDateString(dateString) {
|
|
|
4399
4674
|
return dateStrings;
|
|
4400
4675
|
}
|
|
4401
4676
|
function parseYear(dateString, additionalDigits) {
|
|
4402
|
-
const
|
|
4677
|
+
const regex2 = new RegExp(
|
|
4403
4678
|
"^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)"
|
|
4404
4679
|
);
|
|
4405
|
-
const captures = dateString.match(
|
|
4680
|
+
const captures = dateString.match(regex2);
|
|
4406
4681
|
if (!captures) return { year: NaN, restDateString: "" };
|
|
4407
4682
|
const year = captures[1] ? parseInt(captures[1]) : null;
|
|
4408
4683
|
const century = captures[2] ? parseInt(captures[2]) : null;
|
|
@@ -4508,15 +4783,15 @@ function Label4({ className, ...props }) {
|
|
|
4508
4783
|
);
|
|
4509
4784
|
}
|
|
4510
4785
|
var Form2 = FormProvider;
|
|
4511
|
-
var FormFieldContext3 =
|
|
4786
|
+
var FormFieldContext3 = React5.createContext({});
|
|
4512
4787
|
var FormField3 = ({
|
|
4513
4788
|
...props
|
|
4514
4789
|
}) => {
|
|
4515
4790
|
return /* @__PURE__ */ jsx(FormFieldContext3.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
4516
4791
|
};
|
|
4517
4792
|
var useFormField3 = () => {
|
|
4518
|
-
const fieldContext =
|
|
4519
|
-
const itemContext =
|
|
4793
|
+
const fieldContext = React5.useContext(FormFieldContext3);
|
|
4794
|
+
const itemContext = React5.useContext(FormItemContext3);
|
|
4520
4795
|
const { getFieldState } = useFormContext();
|
|
4521
4796
|
const formState = useFormState({ name: fieldContext.name });
|
|
4522
4797
|
const fieldState = getFieldState(fieldContext.name, formState);
|
|
@@ -4533,9 +4808,9 @@ var useFormField3 = () => {
|
|
|
4533
4808
|
...fieldState
|
|
4534
4809
|
};
|
|
4535
4810
|
};
|
|
4536
|
-
var FormItemContext3 =
|
|
4811
|
+
var FormItemContext3 = React5.createContext({});
|
|
4537
4812
|
function FormItem3({ className, ...props }) {
|
|
4538
|
-
const id =
|
|
4813
|
+
const id = React5.useId();
|
|
4539
4814
|
return /* @__PURE__ */ jsx(FormItemContext3.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { "data-slot": "form-item", className: cn2("grid gap-2", className), ...props }) });
|
|
4540
4815
|
}
|
|
4541
4816
|
function FormControl2({ ...props }) {
|
|
@@ -4567,7 +4842,7 @@ var AdvanceSearchRow = ({
|
|
|
4567
4842
|
const { control } = form;
|
|
4568
4843
|
const fieldSchema = fields.find((f) => f.name === row.fieldName);
|
|
4569
4844
|
const fieldType = fieldSchema?.type ?? "text";
|
|
4570
|
-
|
|
4845
|
+
React5__default.useEffect(() => {
|
|
4571
4846
|
if (operators && operators.length > 0 && !operators.includes(row.operator)) {
|
|
4572
4847
|
onChangeOperator(operators[0]);
|
|
4573
4848
|
}
|
|
@@ -4578,8 +4853,8 @@ var AdvanceSearchRow = ({
|
|
|
4578
4853
|
const isLookup = fieldType === "lookup";
|
|
4579
4854
|
const isNumber = fieldType === "number";
|
|
4580
4855
|
const isDate2 = fieldType === "date" || fieldType === "datetime";
|
|
4581
|
-
const [openDateValue1, setOpenDateValue1] =
|
|
4582
|
-
const [openDateValue2, setOpenDateValue2] =
|
|
4856
|
+
const [openDateValue1, setOpenDateValue1] = React5__default.useState(false);
|
|
4857
|
+
const [openDateValue2, setOpenDateValue2] = React5__default.useState(false);
|
|
4583
4858
|
const toDateFromISO = (v) => {
|
|
4584
4859
|
if (!v) return void 0;
|
|
4585
4860
|
try {
|
|
@@ -4810,6 +5085,372 @@ var AdvanceSearchRow = ({
|
|
|
4810
5085
|
) })
|
|
4811
5086
|
] });
|
|
4812
5087
|
};
|
|
5088
|
+
|
|
5089
|
+
// src/components/advanceSearch/builder/checkbox.ts
|
|
5090
|
+
var CheckboxBuilder = class {
|
|
5091
|
+
build(row) {
|
|
5092
|
+
switch (row.operator) {
|
|
5093
|
+
case "is":
|
|
5094
|
+
return { [row.fieldName]: row.value };
|
|
5095
|
+
case "isNot":
|
|
5096
|
+
return { [row.fieldName]: { not: row.value } };
|
|
5097
|
+
default:
|
|
5098
|
+
return {};
|
|
5099
|
+
}
|
|
5100
|
+
}
|
|
5101
|
+
};
|
|
5102
|
+
|
|
5103
|
+
// src/components/advanceSearch/builder/helper.ts
|
|
5104
|
+
var helper = (prismaFilter, options) => {
|
|
5105
|
+
return options?.multiTableSearch ? {
|
|
5106
|
+
some: {
|
|
5107
|
+
value: { ...prismaFilter, ...options?.insensitive ? { mode: "insensitive" } : void 0 }
|
|
5108
|
+
}
|
|
5109
|
+
} : prismaFilter;
|
|
5110
|
+
};
|
|
5111
|
+
|
|
5112
|
+
// src/components/advanceSearch/builder/datetime.ts
|
|
5113
|
+
var DatetimeBuilder = class {
|
|
5114
|
+
build(row) {
|
|
5115
|
+
try {
|
|
5116
|
+
const start = new Date(row.value);
|
|
5117
|
+
start.setHours(0, 0, 0, 0);
|
|
5118
|
+
const end = new Date(row.value);
|
|
5119
|
+
end.setHours(23, 59, 59, 59);
|
|
5120
|
+
switch (row.operator) {
|
|
5121
|
+
case "on": {
|
|
5122
|
+
return {
|
|
5123
|
+
[row.fieldName]: helper(
|
|
5124
|
+
{ gte: start.toISOString(), lt: end.toISOString() },
|
|
5125
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5126
|
+
)
|
|
5127
|
+
};
|
|
5128
|
+
}
|
|
5129
|
+
case "after":
|
|
5130
|
+
return {
|
|
5131
|
+
[row.fieldName]: helper(
|
|
5132
|
+
{ gte: start.toISOString() },
|
|
5133
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5134
|
+
)
|
|
5135
|
+
};
|
|
5136
|
+
case "before":
|
|
5137
|
+
return {
|
|
5138
|
+
[row.fieldName]: helper(
|
|
5139
|
+
{ lt: start.toISOString() },
|
|
5140
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5141
|
+
)
|
|
5142
|
+
};
|
|
5143
|
+
case "between": {
|
|
5144
|
+
const start2 = new Date(row.value);
|
|
5145
|
+
start2.setHours(0, 0, 0, 0);
|
|
5146
|
+
const end2 = new Date(row.value2);
|
|
5147
|
+
end2.setHours(23, 59, 59, 59);
|
|
5148
|
+
return {
|
|
5149
|
+
[row.fieldName]: helper(
|
|
5150
|
+
{ gte: start2.toISOString(), lt: end2.toISOString() },
|
|
5151
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5152
|
+
)
|
|
5153
|
+
};
|
|
5154
|
+
}
|
|
5155
|
+
default:
|
|
5156
|
+
return {};
|
|
5157
|
+
}
|
|
5158
|
+
} catch {
|
|
5159
|
+
return {};
|
|
5160
|
+
}
|
|
5161
|
+
}
|
|
5162
|
+
};
|
|
5163
|
+
|
|
5164
|
+
// src/components/advanceSearch/builder/dropdown.ts
|
|
5165
|
+
var DropdownBuilder = class {
|
|
5166
|
+
build(row) {
|
|
5167
|
+
switch (row.operator) {
|
|
5168
|
+
case "is":
|
|
5169
|
+
return { [row.fieldName]: row.value };
|
|
5170
|
+
case "isNot":
|
|
5171
|
+
return { [row.fieldName]: { not: row.value } };
|
|
5172
|
+
default:
|
|
5173
|
+
return {};
|
|
5174
|
+
}
|
|
5175
|
+
}
|
|
5176
|
+
};
|
|
5177
|
+
|
|
5178
|
+
// src/components/advanceSearch/builder/json.ts
|
|
5179
|
+
var JSONBuilder = class {
|
|
5180
|
+
build(row) {
|
|
5181
|
+
switch (row.operator) {
|
|
5182
|
+
case "contains":
|
|
5183
|
+
return { [row.fieldName]: { path: row.jsonPath, string_contains: row.value } };
|
|
5184
|
+
case "equals":
|
|
5185
|
+
return { [row.fieldName]: { path: row.jsonPath, equals: row.value } };
|
|
5186
|
+
case "beginsWith":
|
|
5187
|
+
return { [row.fieldName]: { path: row.jsonPath, string_starts_with: row.value } };
|
|
5188
|
+
case "endsWith":
|
|
5189
|
+
return { [row.fieldName]: { path: row.jsonPath, string_ends_with: row.value } };
|
|
5190
|
+
case "notContains":
|
|
5191
|
+
return { [row.fieldName]: { path: row.jsonPath, not: { string_contains: row.value } } };
|
|
5192
|
+
case "notEquals":
|
|
5193
|
+
return { [row.fieldName]: { path: row.jsonPath, not: { equals: row.value } } };
|
|
5194
|
+
case "notBeginsWith":
|
|
5195
|
+
return { [row.fieldName]: { path: row.jsonPath, not: { string_starts_with: row.value } } };
|
|
5196
|
+
case "notEndsWith":
|
|
5197
|
+
return { [row.fieldName]: { path: row.jsonPath, not: { string_ends_with: row.value } } };
|
|
5198
|
+
default:
|
|
5199
|
+
return {};
|
|
5200
|
+
}
|
|
5201
|
+
}
|
|
5202
|
+
};
|
|
5203
|
+
|
|
5204
|
+
// src/components/advanceSearch/builder/lookup.ts
|
|
5205
|
+
var LookupBuilder = class {
|
|
5206
|
+
build(row) {
|
|
5207
|
+
switch (row.operator) {
|
|
5208
|
+
case "containsAny":
|
|
5209
|
+
return {
|
|
5210
|
+
[row.fieldName]: helper(
|
|
5211
|
+
{ hasSome: String(row.value).split(",") },
|
|
5212
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5213
|
+
)
|
|
5214
|
+
};
|
|
5215
|
+
case "containsAll":
|
|
5216
|
+
return {
|
|
5217
|
+
[row.fieldName]: helper(
|
|
5218
|
+
{ hasEvery: String(row.value).split(",") },
|
|
5219
|
+
{ multiTableSearch: row.multiTableSearch }
|
|
5220
|
+
)
|
|
5221
|
+
};
|
|
5222
|
+
case "containsOnly":
|
|
5223
|
+
return {
|
|
5224
|
+
[row.fieldName]: helper(
|
|
5225
|
+
{ equals: String(row.value).split(",") },
|
|
5226
|
+
{
|
|
5227
|
+
multiTableSearch: row.multiTableSearch,
|
|
5228
|
+
insensitive: true
|
|
5229
|
+
}
|
|
5230
|
+
)
|
|
5231
|
+
};
|
|
5232
|
+
case "notContains":
|
|
5233
|
+
return {
|
|
5234
|
+
[row.fieldName]: helper(
|
|
5235
|
+
{ not: { contains: row.value } },
|
|
5236
|
+
{
|
|
5237
|
+
multiTableSearch: row.multiTableSearch,
|
|
5238
|
+
insensitive: true
|
|
5239
|
+
}
|
|
5240
|
+
)
|
|
5241
|
+
};
|
|
5242
|
+
default:
|
|
5243
|
+
return {};
|
|
5244
|
+
}
|
|
5245
|
+
}
|
|
5246
|
+
};
|
|
5247
|
+
|
|
5248
|
+
// src/components/advanceSearch/builder/number.ts
|
|
5249
|
+
var NumberBuilder = class {
|
|
5250
|
+
build(row) {
|
|
5251
|
+
const value = Number(row.value);
|
|
5252
|
+
switch (row.operator) {
|
|
5253
|
+
case "gt":
|
|
5254
|
+
return {
|
|
5255
|
+
[row.fieldName]: helper({ gt: value }, { multiTableSearch: row.multiTableSearch })
|
|
5256
|
+
};
|
|
5257
|
+
case "gte":
|
|
5258
|
+
return {
|
|
5259
|
+
[row.fieldName]: helper({ gte: value }, { multiTableSearch: row.multiTableSearch })
|
|
5260
|
+
};
|
|
5261
|
+
case "lt":
|
|
5262
|
+
return {
|
|
5263
|
+
[row.fieldName]: helper({ lt: value }, { multiTableSearch: row.multiTableSearch })
|
|
5264
|
+
};
|
|
5265
|
+
case "lte":
|
|
5266
|
+
return {
|
|
5267
|
+
[row.fieldName]: helper({ lte: value }, { multiTableSearch: row.multiTableSearch })
|
|
5268
|
+
};
|
|
5269
|
+
case "equals":
|
|
5270
|
+
return {
|
|
5271
|
+
[row.fieldName]: helper(
|
|
5272
|
+
{ equals: value },
|
|
5273
|
+
{
|
|
5274
|
+
multiTableSearch: row.multiTableSearch
|
|
5275
|
+
}
|
|
5276
|
+
)
|
|
5277
|
+
};
|
|
5278
|
+
case "notEquals":
|
|
5279
|
+
return {
|
|
5280
|
+
[row.fieldName]: helper(
|
|
5281
|
+
{ not: value },
|
|
5282
|
+
{
|
|
5283
|
+
multiTableSearch: row.multiTableSearch
|
|
5284
|
+
}
|
|
5285
|
+
)
|
|
5286
|
+
};
|
|
5287
|
+
default:
|
|
5288
|
+
return {};
|
|
5289
|
+
}
|
|
5290
|
+
}
|
|
5291
|
+
};
|
|
5292
|
+
|
|
5293
|
+
// src/components/advanceSearch/builder/text.ts
|
|
5294
|
+
var TextBuilder = class {
|
|
5295
|
+
build(row) {
|
|
5296
|
+
switch (row.operator) {
|
|
5297
|
+
case "contains":
|
|
5298
|
+
return {
|
|
5299
|
+
[row.fieldName]: helper(
|
|
5300
|
+
{ contains: row.value },
|
|
5301
|
+
{
|
|
5302
|
+
multiTableSearch: row.multiTableSearch,
|
|
5303
|
+
insensitive: true
|
|
5304
|
+
}
|
|
5305
|
+
)
|
|
5306
|
+
};
|
|
5307
|
+
case "equals":
|
|
5308
|
+
return {
|
|
5309
|
+
[row.fieldName]: helper(
|
|
5310
|
+
{ equals: row.value },
|
|
5311
|
+
{
|
|
5312
|
+
multiTableSearch: row.multiTableSearch,
|
|
5313
|
+
insensitive: true
|
|
5314
|
+
}
|
|
5315
|
+
)
|
|
5316
|
+
};
|
|
5317
|
+
case "beginsWith":
|
|
5318
|
+
return {
|
|
5319
|
+
[row.fieldName]: helper(
|
|
5320
|
+
{ startsWith: row.value },
|
|
5321
|
+
{
|
|
5322
|
+
multiTableSearch: row.multiTableSearch,
|
|
5323
|
+
insensitive: true
|
|
5324
|
+
}
|
|
5325
|
+
)
|
|
5326
|
+
};
|
|
5327
|
+
case "endsWith":
|
|
5328
|
+
return {
|
|
5329
|
+
[row.fieldName]: helper(
|
|
5330
|
+
{ endsWith: row.value },
|
|
5331
|
+
{
|
|
5332
|
+
multiTableSearch: row.multiTableSearch,
|
|
5333
|
+
insensitive: true
|
|
5334
|
+
}
|
|
5335
|
+
)
|
|
5336
|
+
};
|
|
5337
|
+
case "notEquals":
|
|
5338
|
+
return {
|
|
5339
|
+
[row.fieldName]: helper(
|
|
5340
|
+
{ not: row.value },
|
|
5341
|
+
{
|
|
5342
|
+
multiTableSearch: row.multiTableSearch,
|
|
5343
|
+
insensitive: true
|
|
5344
|
+
}
|
|
5345
|
+
)
|
|
5346
|
+
};
|
|
5347
|
+
case "notBeginsWith":
|
|
5348
|
+
return {
|
|
5349
|
+
[row.fieldName]: helper(
|
|
5350
|
+
{ not: { startsWith: row.value } },
|
|
5351
|
+
{
|
|
5352
|
+
multiTableSearch: row.multiTableSearch,
|
|
5353
|
+
insensitive: true
|
|
5354
|
+
}
|
|
5355
|
+
)
|
|
5356
|
+
};
|
|
5357
|
+
case "notEndsWith":
|
|
5358
|
+
return {
|
|
5359
|
+
[row.fieldName]: helper(
|
|
5360
|
+
{ not: { endsWith: row.value } },
|
|
5361
|
+
{
|
|
5362
|
+
multiTableSearch: row.multiTableSearch,
|
|
5363
|
+
insensitive: true
|
|
5364
|
+
}
|
|
5365
|
+
)
|
|
5366
|
+
};
|
|
5367
|
+
case "notContains":
|
|
5368
|
+
return {
|
|
5369
|
+
[row.fieldName]: helper(
|
|
5370
|
+
{ not: { contains: row.value } },
|
|
5371
|
+
{
|
|
5372
|
+
multiTableSearch: row.multiTableSearch,
|
|
5373
|
+
insensitive: true
|
|
5374
|
+
}
|
|
5375
|
+
)
|
|
5376
|
+
};
|
|
5377
|
+
default:
|
|
5378
|
+
return {};
|
|
5379
|
+
}
|
|
5380
|
+
}
|
|
5381
|
+
};
|
|
5382
|
+
|
|
5383
|
+
// src/components/advanceSearch/builder/uuid.ts
|
|
5384
|
+
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;
|
|
5385
|
+
var UUIDBuilder = class {
|
|
5386
|
+
build(row) {
|
|
5387
|
+
if (!regex.test(row.value)) {
|
|
5388
|
+
return { [row.fieldName]: {} };
|
|
5389
|
+
}
|
|
5390
|
+
switch (row.operator) {
|
|
5391
|
+
case "gt":
|
|
5392
|
+
return {
|
|
5393
|
+
[row.fieldName]: helper({ gt: row.value }, { multiTableSearch: row.multiTableSearch })
|
|
5394
|
+
};
|
|
5395
|
+
case "gte":
|
|
5396
|
+
return {
|
|
5397
|
+
[row.fieldName]: helper({ gte: row.value }, { multiTableSearch: row.multiTableSearch })
|
|
5398
|
+
};
|
|
5399
|
+
case "lt":
|
|
5400
|
+
return {
|
|
5401
|
+
[row.fieldName]: helper({ lt: row.value }, { multiTableSearch: row.multiTableSearch })
|
|
5402
|
+
};
|
|
5403
|
+
case "lte":
|
|
5404
|
+
return {
|
|
5405
|
+
[row.fieldName]: helper({ lte: row.value }, { multiTableSearch: row.multiTableSearch })
|
|
5406
|
+
};
|
|
5407
|
+
case "equals":
|
|
5408
|
+
return {
|
|
5409
|
+
[row.fieldName]: helper(
|
|
5410
|
+
{ equals: row.value },
|
|
5411
|
+
{
|
|
5412
|
+
multiTableSearch: row.multiTableSearch
|
|
5413
|
+
}
|
|
5414
|
+
)
|
|
5415
|
+
};
|
|
5416
|
+
case "notEquals":
|
|
5417
|
+
return {
|
|
5418
|
+
[row.fieldName]: helper(
|
|
5419
|
+
{ not: row.value },
|
|
5420
|
+
{
|
|
5421
|
+
multiTableSearch: row.multiTableSearch
|
|
5422
|
+
}
|
|
5423
|
+
)
|
|
5424
|
+
};
|
|
5425
|
+
default:
|
|
5426
|
+
return {};
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
};
|
|
5430
|
+
|
|
5431
|
+
// src/components/advanceSearch/builder/index.ts
|
|
5432
|
+
function getBuilder(fieldType) {
|
|
5433
|
+
switch (fieldType) {
|
|
5434
|
+
case "text":
|
|
5435
|
+
return new TextBuilder();
|
|
5436
|
+
case "number":
|
|
5437
|
+
return new NumberBuilder();
|
|
5438
|
+
case "date":
|
|
5439
|
+
return new DatetimeBuilder();
|
|
5440
|
+
case "datetime":
|
|
5441
|
+
return new DatetimeBuilder();
|
|
5442
|
+
case "checkbox":
|
|
5443
|
+
return new CheckboxBuilder();
|
|
5444
|
+
case "dropdown":
|
|
5445
|
+
return new DropdownBuilder();
|
|
5446
|
+
case "lookup":
|
|
5447
|
+
return new LookupBuilder();
|
|
5448
|
+
case "uuid":
|
|
5449
|
+
return new UUIDBuilder();
|
|
5450
|
+
case "json":
|
|
5451
|
+
return new JSONBuilder();
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
4813
5454
|
var AdvanceSearch = ({
|
|
4814
5455
|
fields,
|
|
4815
5456
|
portalId,
|
|
@@ -4831,8 +5472,7 @@ var AdvanceSearch = ({
|
|
|
4831
5472
|
changeField,
|
|
4832
5473
|
changeOperator,
|
|
4833
5474
|
operatorsForField,
|
|
4834
|
-
fieldOptions
|
|
4835
|
-
buildFilter
|
|
5475
|
+
fieldOptions
|
|
4836
5476
|
} = useAdvanceSearch({ fields: fieldsData, limitRows });
|
|
4837
5477
|
const form = useForm({
|
|
4838
5478
|
mode: "onSubmit",
|
|
@@ -4842,183 +5482,21 @@ var AdvanceSearch = ({
|
|
|
4842
5482
|
const { handleSubmit, unregister, resetField, getValues, setValue } = form;
|
|
4843
5483
|
const onSubmit = useCallback(() => {
|
|
4844
5484
|
const currentValues = getValues();
|
|
5485
|
+
const rawRows = rows.map((r2) => {
|
|
5486
|
+
r2.value = currentValues[`value_${r2.id}`] ?? "";
|
|
5487
|
+
r2.value2 = currentValues[`value2_${r2.id}`] ?? "";
|
|
5488
|
+
return r2;
|
|
5489
|
+
});
|
|
4845
5490
|
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
|
-
}
|
|
5491
|
+
AND: rawRows.map((r2) => {
|
|
5492
|
+
const builder = getBuilder(r2.fieldType);
|
|
5493
|
+
return builder.build(r2);
|
|
5016
5494
|
}).filter(Boolean)
|
|
5017
5495
|
};
|
|
5018
5496
|
if (onSearch) {
|
|
5019
|
-
onSearch(param);
|
|
5497
|
+
onSearch(param, rawRows);
|
|
5020
5498
|
}
|
|
5021
|
-
}, [
|
|
5499
|
+
}, [getValues, rows, onSearch]);
|
|
5022
5500
|
return /* @__PURE__ */ jsx(
|
|
5023
5501
|
ExpandCollapse_default,
|
|
5024
5502
|
{
|
|
@@ -5277,6 +5755,6 @@ function variantClass(variant) {
|
|
|
5277
5755
|
}
|
|
5278
5756
|
}
|
|
5279
5757
|
|
|
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,
|
|
5758
|
+
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
5759
|
//# sourceMappingURL=index.mjs.map
|
|
5282
5760
|
//# sourceMappingURL=index.mjs.map
|