@sustaina/shared-ui 1.30.1 → 1.30.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +28 -6
- package/dist/index.d.ts +28 -6
- package/dist/index.js +63 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -369,6 +369,10 @@ declare function booleanToSelectValue(value: boolean | undefined, options?: {
|
|
|
369
369
|
fallbackUndefinedValue?: string;
|
|
370
370
|
}): string;
|
|
371
371
|
declare function selectValueToBoolean(value: string): boolean | undefined;
|
|
372
|
+
declare function resetVisibleTableState(payload: {
|
|
373
|
+
table: Table$1<any> | null;
|
|
374
|
+
visibility: Record<string, boolean>;
|
|
375
|
+
}): void;
|
|
372
376
|
|
|
373
377
|
type SorterProps = {
|
|
374
378
|
show?: boolean;
|
|
@@ -659,6 +663,16 @@ type TanstackTableInstance = {
|
|
|
659
663
|
getAllColumns(): any[];
|
|
660
664
|
getVisibleLeafColumns(): any[];
|
|
661
665
|
};
|
|
666
|
+
type SyncColumnsStateOptions<TData> = {
|
|
667
|
+
excludeColumns?: KeyOrString<TData>[];
|
|
668
|
+
labelMap?: Partial<Record<KeyOrString<TData>, string>>;
|
|
669
|
+
visibility?: Partial<Record<KeyOrString<TData>, boolean>>;
|
|
670
|
+
ordering?: KeyOrString<TData>[];
|
|
671
|
+
pinning?: {
|
|
672
|
+
left?: KeyOrString<TData>[];
|
|
673
|
+
};
|
|
674
|
+
};
|
|
675
|
+
type SyncColumnsStateFn = <TData = RowData$1>(table: Table$1<TData>, options?: SyncColumnsStateOptions<TData>) => void;
|
|
662
676
|
type UseGridSettingsStoreActions = {
|
|
663
677
|
setAvailableColumns: (cols: Column[]) => void;
|
|
664
678
|
setCurrentColumns: (cols: Column[]) => void;
|
|
@@ -668,11 +682,7 @@ type UseGridSettingsStoreActions = {
|
|
|
668
682
|
availableColumns: Column[];
|
|
669
683
|
currentColumns: Column[];
|
|
670
684
|
};
|
|
671
|
-
syncColumnsState:
|
|
672
|
-
excludeColumns: KeyOrString<TData>[];
|
|
673
|
-
labelMap?: Partial<Record<KeyOrString<TData>, string>>;
|
|
674
|
-
visibility?: Record<keyof TData, boolean>;
|
|
675
|
-
}) => void;
|
|
685
|
+
syncColumnsState: SyncColumnsStateFn;
|
|
676
686
|
};
|
|
677
687
|
type UseGridSettingsStoreState = {
|
|
678
688
|
availableColumns: Column[];
|
|
@@ -1433,4 +1443,16 @@ type UseTruncatedOptions<T> = {
|
|
|
1433
1443
|
type UseTruncatedResult = boolean;
|
|
1434
1444
|
declare const useTruncated: <T extends HTMLElement = any>({ elementRef, onChange, resizeDetectDelay }: UseTruncatedOptions<T>) => UseTruncatedResult;
|
|
1435
1445
|
|
|
1436
|
-
|
|
1446
|
+
type ExtractObjects<T> = T extends infer U ? U extends object ? U : never : never;
|
|
1447
|
+
type BrowserNativeObject = Date | FileList | File | null;
|
|
1448
|
+
type EmptyObject = {
|
|
1449
|
+
[K in string | number]: never;
|
|
1450
|
+
};
|
|
1451
|
+
type DeepPartial<T> = T extends BrowserNativeObject ? T : {
|
|
1452
|
+
[K in keyof T]?: ExtractObjects<T[K]> extends never ? T[K] : DeepPartial<T[K]>;
|
|
1453
|
+
};
|
|
1454
|
+
type DeepPartialNullish<T> = T extends BrowserNativeObject ? T | null : {
|
|
1455
|
+
[K in keyof T]?: ExtractObjects<T[K]> extends never ? T[K] | null : DeepPartialNullish<T[K]> | null;
|
|
1456
|
+
};
|
|
1457
|
+
|
|
1458
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch, ArrowIcon, type Breakpoints, type BrowserNativeObject, Button, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type Column, type CroppedImagePayload, type CroppedImagePayloadWithBlobUrl, CropperModal, CropperModalError, type CropperModalErrorType, type CropperModalProps, DIALOG_ALERT_I18N_SUBNAMESPACE, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSeparatorProps, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, DatePicker, type DatePickerProps, type DebounceOptions, type DebouncedFunction, type DeepPartial, type DeepPartialNullish, Dialog, DialogAlert, type DialogAlertI18nResource, type DialogAlertProps, DialogAlertProvider, type DialogAlertTemplateUnit, type DialogAlertTemplates, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, type DialogVariant, type EllipsisConfig, type EmptyObject, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, type ExtractObjects, type FieldSchema, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormulaEditor, type FormulaEditorProps, type FormulaOperator, type FormulaTokenAttributes, type FormulaTokenConfig, type FormulaTokenSuggestion, type FormulaTokenType, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, Image, type ImageLoader, type ImageLoaderProps, type ImageProps, Input, type InputCustomInputProps, InputNumber, type InputNumberProps, type InputProps$1 as InputProps, Label, List, ListContainer, type ListContainerProps, ListHeader, type ListHeaderProps, type ListProps, ListTable, type ListTableProps, LookupSelect, type LookupSelectOption, type LookupSelectProps, MonthPicker, type MonthPickerProps, _default as Navbar, type NavbarProps, NotFoundIcon, type Params, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, type PrefixMap, PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, type RawFormulaSegment, RichText, type RowClickType, type RowState, type ScrollInfo, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SorterProps, Spinner, type SpinnerProps, type StatusContentKey, SuiCalendarIcon, SuiCheckIcon, SuiDotsVerticalIcon, SuiEmptyDataIcon, SuiExpandIcon, SuiFilterIcon, SuiSettingIcon, SuiTriangleDownIcon, SuiWarningIcon, Switch, type TemplateKeys, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, Truncated, type TruncatedProps, index as UI, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UsePreventPageLeaveOptions, type UseScreenSizeResult, type UseTruncatedOptions, type UseTruncatedResult, booleanToSelectValue, buildPrefixMap, buttonVariants, cn, compareAlphanumeric, debounce, defaultOperatorShortcuts, defaultOperators, formatISODate, getDialogAlertControls, getDialogTemplates, inputVariants$1 as inputVariants, isDefined, isEmptyObject, isValidParentheses, mapTokensToOutput, parseFormula, parseFormulaToToken, resetVisibleTableState, selectValueToBoolean, spinnerVariants, splitOperators, stripNullishObject, throttle, tokenizeFormulaString, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useSidebar, useTruncated, validateTokenPrefixes };
|
package/dist/index.d.ts
CHANGED
|
@@ -369,6 +369,10 @@ declare function booleanToSelectValue(value: boolean | undefined, options?: {
|
|
|
369
369
|
fallbackUndefinedValue?: string;
|
|
370
370
|
}): string;
|
|
371
371
|
declare function selectValueToBoolean(value: string): boolean | undefined;
|
|
372
|
+
declare function resetVisibleTableState(payload: {
|
|
373
|
+
table: Table$1<any> | null;
|
|
374
|
+
visibility: Record<string, boolean>;
|
|
375
|
+
}): void;
|
|
372
376
|
|
|
373
377
|
type SorterProps = {
|
|
374
378
|
show?: boolean;
|
|
@@ -659,6 +663,16 @@ type TanstackTableInstance = {
|
|
|
659
663
|
getAllColumns(): any[];
|
|
660
664
|
getVisibleLeafColumns(): any[];
|
|
661
665
|
};
|
|
666
|
+
type SyncColumnsStateOptions<TData> = {
|
|
667
|
+
excludeColumns?: KeyOrString<TData>[];
|
|
668
|
+
labelMap?: Partial<Record<KeyOrString<TData>, string>>;
|
|
669
|
+
visibility?: Partial<Record<KeyOrString<TData>, boolean>>;
|
|
670
|
+
ordering?: KeyOrString<TData>[];
|
|
671
|
+
pinning?: {
|
|
672
|
+
left?: KeyOrString<TData>[];
|
|
673
|
+
};
|
|
674
|
+
};
|
|
675
|
+
type SyncColumnsStateFn = <TData = RowData$1>(table: Table$1<TData>, options?: SyncColumnsStateOptions<TData>) => void;
|
|
662
676
|
type UseGridSettingsStoreActions = {
|
|
663
677
|
setAvailableColumns: (cols: Column[]) => void;
|
|
664
678
|
setCurrentColumns: (cols: Column[]) => void;
|
|
@@ -668,11 +682,7 @@ type UseGridSettingsStoreActions = {
|
|
|
668
682
|
availableColumns: Column[];
|
|
669
683
|
currentColumns: Column[];
|
|
670
684
|
};
|
|
671
|
-
syncColumnsState:
|
|
672
|
-
excludeColumns: KeyOrString<TData>[];
|
|
673
|
-
labelMap?: Partial<Record<KeyOrString<TData>, string>>;
|
|
674
|
-
visibility?: Record<keyof TData, boolean>;
|
|
675
|
-
}) => void;
|
|
685
|
+
syncColumnsState: SyncColumnsStateFn;
|
|
676
686
|
};
|
|
677
687
|
type UseGridSettingsStoreState = {
|
|
678
688
|
availableColumns: Column[];
|
|
@@ -1433,4 +1443,16 @@ type UseTruncatedOptions<T> = {
|
|
|
1433
1443
|
type UseTruncatedResult = boolean;
|
|
1434
1444
|
declare const useTruncated: <T extends HTMLElement = any>({ elementRef, onChange, resizeDetectDelay }: UseTruncatedOptions<T>) => UseTruncatedResult;
|
|
1435
1445
|
|
|
1436
|
-
|
|
1446
|
+
type ExtractObjects<T> = T extends infer U ? U extends object ? U : never : never;
|
|
1447
|
+
type BrowserNativeObject = Date | FileList | File | null;
|
|
1448
|
+
type EmptyObject = {
|
|
1449
|
+
[K in string | number]: never;
|
|
1450
|
+
};
|
|
1451
|
+
type DeepPartial<T> = T extends BrowserNativeObject ? T : {
|
|
1452
|
+
[K in keyof T]?: ExtractObjects<T[K]> extends never ? T[K] : DeepPartial<T[K]>;
|
|
1453
|
+
};
|
|
1454
|
+
type DeepPartialNullish<T> = T extends BrowserNativeObject ? T | null : {
|
|
1455
|
+
[K in keyof T]?: ExtractObjects<T[K]> extends never ? T[K] | null : DeepPartialNullish<T[K]> | null;
|
|
1456
|
+
};
|
|
1457
|
+
|
|
1458
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch, ArrowIcon, type Breakpoints, type BrowserNativeObject, Button, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type Column, type CroppedImagePayload, type CroppedImagePayloadWithBlobUrl, CropperModal, CropperModalError, type CropperModalErrorType, type CropperModalProps, DIALOG_ALERT_I18N_SUBNAMESPACE, DataTable, type DataTableChildrenKeyHandler, type DataTableColumnFilter, type DataTableColumnFilterProps, type DataTableColumnGrouping, type DataTableColumnOrdering, type DataTableColumnPinning, type DataTableColumnSeparatorProps, type DataTableColumnSorting, type DataTableColumnVisibility, type DataTableComponentProps, type DataTableFilterConfig, type DataTableFilters, type DataTableGlobalFilter, type DataTableHeaderCell, type DataTableProps, type DataTableRenderHeaderHandler, type DataTableRenderHeaderProps, type DataTableRenderRowHandler, type DataTableRenderRowProps, type DataTableRowCell, type DataTableRowClickHandler, type DataTableRowExpansion, type DataTableRowIdKeyHandler, type DataTableRowSelection, type DataTableScrollFetch, type DataTableStatusContent, type DatatableColumnResizing, DatePicker, type DatePickerProps, type DebounceOptions, type DebouncedFunction, type DeepPartial, type DeepPartialNullish, Dialog, DialogAlert, type DialogAlertI18nResource, type DialogAlertProps, DialogAlertProvider, type DialogAlertTemplateUnit, type DialogAlertTemplates, DialogContent, type DialogContentProps, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, type DialogVariant, type EllipsisConfig, type EmptyObject, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, type ExtractObjects, type FieldSchema, type FieldType, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, FormulaEditor, type FormulaEditorProps, type FormulaOperator, type FormulaTokenAttributes, type FormulaTokenConfig, type FormulaTokenSuggestion, type FormulaTokenType, type GridPayload, GridSettingsModal, type GridSettingsModalProps, HeaderCell, type HeaderCellProps, Image, type ImageLoader, type ImageLoaderProps, type ImageProps, Input, type InputCustomInputProps, InputNumber, type InputNumberProps, type InputProps$1 as InputProps, Label, List, ListContainer, type ListContainerProps, ListHeader, type ListHeaderProps, type ListProps, ListTable, type ListTableProps, LookupSelect, type LookupSelectOption, type LookupSelectProps, MonthPicker, type MonthPickerProps, _default as Navbar, type NavbarProps, NotFoundIcon, type Params, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, type PrefixMap, PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, type RawFormulaSegment, RichText, type RowClickType, type RowState, type ScrollInfo, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, type SorterProps, Spinner, type SpinnerProps, type StatusContentKey, SuiCalendarIcon, SuiCheckIcon, SuiDotsVerticalIcon, SuiEmptyDataIcon, SuiExpandIcon, SuiFilterIcon, SuiSettingIcon, SuiTriangleDownIcon, SuiWarningIcon, Switch, type TemplateKeys, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, Truncated, type TruncatedProps, index as UI, type UseHoverResult, type UseMediaQueryOptions, type UseMediaQueryResult, type UsePreventPageLeaveOptions, type UseScreenSizeResult, type UseTruncatedOptions, type UseTruncatedResult, booleanToSelectValue, buildPrefixMap, buttonVariants, cn, compareAlphanumeric, debounce, defaultOperatorShortcuts, defaultOperators, formatISODate, getDialogAlertControls, getDialogTemplates, inputVariants$1 as inputVariants, isDefined, isEmptyObject, isValidParentheses, mapTokensToOutput, parseFormula, parseFormulaToToken, resetVisibleTableState, selectValueToBoolean, spinnerVariants, splitOperators, stripNullishObject, throttle, tokenizeFormulaString, useFormField, useGridSettingsStore, useHover, useIntersectionObserver, useMediaQuery, usePreventPageLeave, usePreventPageLeaveStore, useScreenSize, useSidebar, useTruncated, validateTokenPrefixes };
|
package/dist/index.js
CHANGED
|
@@ -692,7 +692,8 @@ var OPERATOR_MAP = {
|
|
|
692
692
|
dropdown: ["is", "isNot"],
|
|
693
693
|
lookup: ["containsAny", "containsOnly", "containsAll", "notContains"],
|
|
694
694
|
uuid: ["equals", "notEquals", "gt", "gte", "lt", "lte"],
|
|
695
|
-
json: ["equals", "notEquals"
|
|
695
|
+
json: ["equals", "notEquals"]
|
|
696
|
+
// removed containsAny from json
|
|
696
697
|
};
|
|
697
698
|
|
|
698
699
|
// src/components/advanceSearch/hooks/useAdvanceSearch.ts
|
|
@@ -2640,12 +2641,16 @@ var LookupSelect = ({
|
|
|
2640
2641
|
(option) => {
|
|
2641
2642
|
upsertOptionLabels([option]);
|
|
2642
2643
|
addTag(option.value);
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2644
|
+
if (multiple) {
|
|
2645
|
+
inputRef.current?.focus();
|
|
2646
|
+
setTimeout(() => {
|
|
2647
|
+
inputRef.current?.scrollIntoView({ behavior: "smooth" });
|
|
2648
|
+
}, 100);
|
|
2649
|
+
} else {
|
|
2650
|
+
inputRef.current?.blur();
|
|
2651
|
+
}
|
|
2647
2652
|
},
|
|
2648
|
-
[addTag, upsertOptionLabels]
|
|
2653
|
+
[addTag, multiple, upsertOptionLabels]
|
|
2649
2654
|
);
|
|
2650
2655
|
const handleKeyDown = React4.useCallback(
|
|
2651
2656
|
(e) => {
|
|
@@ -2805,7 +2810,7 @@ var LookupSelect = ({
|
|
|
2805
2810
|
}
|
|
2806
2811
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: assignDropdownContentRef, className: "absolute left-0 right-0 top-full z-10 mt-1", children: dropdownContent });
|
|
2807
2812
|
};
|
|
2808
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full", ref: containerRef, children: [
|
|
2813
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative w-full truncate", ref: containerRef, children: [
|
|
2809
2814
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2810
2815
|
"div",
|
|
2811
2816
|
{
|
|
@@ -2836,7 +2841,7 @@ var LookupSelect = ({
|
|
|
2836
2841
|
`${tag}-${i}`
|
|
2837
2842
|
);
|
|
2838
2843
|
}),
|
|
2839
|
-
!multiple && selectedLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm text-gray-700", children: selectedLabel }),
|
|
2844
|
+
!multiple && selectedLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-sm text-gray-700 max-w-full", children: selectedLabel }),
|
|
2840
2845
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2841
2846
|
"input",
|
|
2842
2847
|
{
|
|
@@ -2850,6 +2855,7 @@ var LookupSelect = ({
|
|
|
2850
2855
|
setIsDropdownOpen(true);
|
|
2851
2856
|
}
|
|
2852
2857
|
},
|
|
2858
|
+
hidden: !multiple && selectedLabel !== void 0,
|
|
2853
2859
|
placeholder: value.length === 0 && resolvedPlaceholder || "",
|
|
2854
2860
|
className: "min-w-[120px] flex-1 border-none bg-transparent py-1 text-sm text-gray-600 placeholder:text-gray-400 outline-none",
|
|
2855
2861
|
disabled: multiple && limitReached
|
|
@@ -2951,7 +2957,6 @@ var ConditionJSONInput = ({
|
|
|
2951
2957
|
onClear: handleClear,
|
|
2952
2958
|
error: Boolean(fieldState.error),
|
|
2953
2959
|
placeholder: fieldSchema?.placeholder,
|
|
2954
|
-
maxTags: row.operator === "containsAny" ? fieldSchema?.maxTags : 1,
|
|
2955
2960
|
fetchSuggestions: fieldSchema?.fetchSuggestions,
|
|
2956
2961
|
suggestionDebounce: fieldSchema?.suggestionDebounce,
|
|
2957
2962
|
noOptionsMessage: fieldSchema?.noOptionsMessage,
|
|
@@ -3267,12 +3272,12 @@ var JSONBuilder = class {
|
|
|
3267
3272
|
return {
|
|
3268
3273
|
NOT: { [row.fieldName]: { path: row.jsonPath, equals: isArray ? row.value[0] : row.value } }
|
|
3269
3274
|
};
|
|
3270
|
-
case "containsAny":
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3275
|
+
// case "containsAny":
|
|
3276
|
+
// if (!isArray)
|
|
3277
|
+
// return { [row.fieldName]: { path: row.jsonPath, equals: isArray ? row.value[0] : row.value } };
|
|
3278
|
+
// return {
|
|
3279
|
+
// OR: (row.value as any[]).map((v) => ({ [row.fieldName]: { path: row.jsonPath, equals: v } }))
|
|
3280
|
+
// };
|
|
3276
3281
|
default:
|
|
3277
3282
|
return {};
|
|
3278
3283
|
}
|
|
@@ -3545,7 +3550,9 @@ function transformFilterKeys(obj, fieldMap = FILTER_FIELD_MAP) {
|
|
|
3545
3550
|
}
|
|
3546
3551
|
var sanitizeInput = (val) => {
|
|
3547
3552
|
if (!val) return val;
|
|
3548
|
-
if (
|
|
3553
|
+
if (Array.isArray(val)) {
|
|
3554
|
+
return val.map((v) => sanitizeInput(v));
|
|
3555
|
+
}
|
|
3549
3556
|
if (val.includes("\n") || val.includes("\r") || /[\u2028\u2029]/u.test(val))
|
|
3550
3557
|
return "__INVALID_NEWLINE__";
|
|
3551
3558
|
if (/\\\\/.test(val)) return "__INVALID_ESCAPE__";
|
|
@@ -3564,6 +3571,9 @@ var numericTypes = ["number", "integer", "decimal"];
|
|
|
3564
3571
|
var dateTypes = ["date", "datemonth"];
|
|
3565
3572
|
var validateByFieldType = (value, fieldType) => {
|
|
3566
3573
|
if (!value) return { valid: true };
|
|
3574
|
+
if (Array.isArray(value)) {
|
|
3575
|
+
return { valid: true };
|
|
3576
|
+
}
|
|
3567
3577
|
if (numericTypes.includes(fieldType)) {
|
|
3568
3578
|
if (!/^\d+(\.\d+)?$/.test(value)) {
|
|
3569
3579
|
return { valid: false, message: "Please enter a valid number." };
|
|
@@ -3636,6 +3646,7 @@ var AdvanceSearch = ({
|
|
|
3636
3646
|
);
|
|
3637
3647
|
const parseRangeValue = React4.useCallback((raw, fieldType) => {
|
|
3638
3648
|
if (!raw) return void 0;
|
|
3649
|
+
if (Array.isArray(raw)) return void 0;
|
|
3639
3650
|
const normalized = fieldType === "datemonth" ? `${raw}-01` : raw;
|
|
3640
3651
|
const parsed = dateFns.parseISO(normalized);
|
|
3641
3652
|
return dateFns.isValid(parsed) ? parsed : void 0;
|
|
@@ -3654,10 +3665,10 @@ var AdvanceSearch = ({
|
|
|
3654
3665
|
const processedRows = rows.map((r) => {
|
|
3655
3666
|
const startField = `value_${r.id}`;
|
|
3656
3667
|
const endField = `value2_${r.id}`;
|
|
3657
|
-
let v1 = currentValues[startField]
|
|
3658
|
-
let v2 = currentValues[endField]
|
|
3668
|
+
let v1 = currentValues[startField];
|
|
3669
|
+
let v2 = currentValues[endField];
|
|
3659
3670
|
const s1 = sanitizeInput(v1);
|
|
3660
|
-
if (s1?.startsWith("__INVALID")) {
|
|
3671
|
+
if (Array.isArray(s1) && s1.some((v) => v?.startsWith("__INVALID")) || typeof s1 === "string" && s1?.startsWith("__INVALID")) {
|
|
3661
3672
|
hasError = true;
|
|
3662
3673
|
setError(startField, { type: "validate", message: "Invalid input." });
|
|
3663
3674
|
return null;
|
|
@@ -3671,7 +3682,7 @@ var AdvanceSearch = ({
|
|
|
3671
3682
|
}
|
|
3672
3683
|
if (r.operator === "between") {
|
|
3673
3684
|
const s2 = sanitizeInput(v2);
|
|
3674
|
-
if (s2?.startsWith("__INVALID")) {
|
|
3685
|
+
if (Array.isArray(s2) && s2.some((v) => v?.startsWith("__INVALID")) || typeof s2 === "string" && s2?.startsWith("__INVALID")) {
|
|
3675
3686
|
hasError = true;
|
|
3676
3687
|
setError(endField, { type: "validate", message: "Invalid input." });
|
|
3677
3688
|
return null;
|
|
@@ -3861,6 +3872,15 @@ function selectValueToBoolean(value) {
|
|
|
3861
3872
|
if (value === "false") return false;
|
|
3862
3873
|
return void 0;
|
|
3863
3874
|
}
|
|
3875
|
+
function resetVisibleTableState(payload) {
|
|
3876
|
+
const { table, visibility } = payload;
|
|
3877
|
+
if (!table) return;
|
|
3878
|
+
table.setColumnVisibility(visibility);
|
|
3879
|
+
const isVisible = (id) => payload.visibility?.[id] === true;
|
|
3880
|
+
const prevState = table.getState();
|
|
3881
|
+
table.setColumnFilters(prevState.columnFilters.filter((f) => isVisible(f.id)));
|
|
3882
|
+
table.setSorting(prevState.sorting.filter((s) => isVisible(s.id)));
|
|
3883
|
+
}
|
|
3864
3884
|
var useHover = () => {
|
|
3865
3885
|
const [hovering, setHovering] = React4.useState(false);
|
|
3866
3886
|
const prevRef = React4.useRef(null);
|
|
@@ -6907,8 +6927,15 @@ var useGridSettingsStore = zustand.create(
|
|
|
6907
6927
|
return { availableColumns, currentColumns };
|
|
6908
6928
|
},
|
|
6909
6929
|
syncColumnsState: (table, options) => {
|
|
6930
|
+
const {
|
|
6931
|
+
excludeColumns = [],
|
|
6932
|
+
labelMap = {},
|
|
6933
|
+
visibility = {},
|
|
6934
|
+
ordering = [],
|
|
6935
|
+
pinning
|
|
6936
|
+
} = options || {};
|
|
6910
6937
|
const { availableColumns, currentColumns } = get().extractColumns(table);
|
|
6911
|
-
const
|
|
6938
|
+
const orderMap = new Map(ordering.map((columnId, index) => [columnId, index]));
|
|
6912
6939
|
const filteredExcludeColumnFn = (column) => !excludeColumns.includes(column.id);
|
|
6913
6940
|
const mapLabel = (col) => ({
|
|
6914
6941
|
id: col.id,
|
|
@@ -6923,7 +6950,20 @@ var useGridSettingsStore = zustand.create(
|
|
|
6923
6950
|
}
|
|
6924
6951
|
}
|
|
6925
6952
|
return true;
|
|
6926
|
-
}).map(mapLabel)
|
|
6953
|
+
}).map(mapLabel).sort((a, b) => {
|
|
6954
|
+
const columnIdA = a.id;
|
|
6955
|
+
const columnIdB = b.id;
|
|
6956
|
+
const aOrder = orderMap.get(columnIdA) ?? Infinity;
|
|
6957
|
+
const bOrder = orderMap.get(columnIdB) ?? Infinity;
|
|
6958
|
+
return aOrder - bOrder;
|
|
6959
|
+
}),
|
|
6960
|
+
payload: {
|
|
6961
|
+
ordering,
|
|
6962
|
+
pinning: {
|
|
6963
|
+
left: pinning?.left || []
|
|
6964
|
+
},
|
|
6965
|
+
visibility
|
|
6966
|
+
}
|
|
6927
6967
|
});
|
|
6928
6968
|
}
|
|
6929
6969
|
})
|
|
@@ -10254,6 +10294,7 @@ exports.isValidParentheses = isValidParentheses;
|
|
|
10254
10294
|
exports.mapTokensToOutput = mapTokensToOutput;
|
|
10255
10295
|
exports.parseFormula = parseFormula;
|
|
10256
10296
|
exports.parseFormulaToToken = parseFormulaToToken;
|
|
10297
|
+
exports.resetVisibleTableState = resetVisibleTableState;
|
|
10257
10298
|
exports.selectValueToBoolean = selectValueToBoolean;
|
|
10258
10299
|
exports.spinnerVariants = spinnerVariants;
|
|
10259
10300
|
exports.splitOperators = splitOperators;
|