@vritti/quantum-ui 0.6.2 → 0.6.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/SelectFilter.js +19 -19
- package/dist/SelectFilter.js.map +1 -1
- package/dist/ValueFilter.js +21 -6
- package/dist/ValueFilter.js.map +1 -1
- package/dist/assets/quantum-ui.css +16 -8
- package/dist/lib/components/DataTable/DataTable.d.ts +1 -1
- package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/lib/components/DataTable/components/DataTableFilters.d.ts.map +1 -1
- package/dist/lib/components/DataTable/components/DataTableViewsMenu.d.ts.map +1 -1
- package/dist/lib/components/DataTable/components/bindFilters.d.ts +14 -0
- package/dist/lib/components/DataTable/components/bindFilters.d.ts.map +1 -0
- package/dist/lib/components/DataTable/hooks/useAutoUpsert.d.ts +1 -2
- package/dist/lib/components/DataTable/hooks/useAutoUpsert.d.ts.map +1 -1
- package/dist/lib/components/DataTable/hooks/useDataTable.d.ts +6 -3
- package/dist/lib/components/DataTable/hooks/useDataTable.d.ts.map +1 -1
- package/dist/lib/components/DataTable/store/store.d.ts +4 -3
- package/dist/lib/components/DataTable/store/store.d.ts.map +1 -1
- package/dist/lib/components/DataTable/store/useTableSlice.d.ts +2 -1
- package/dist/lib/components/DataTable/store/useTableSlice.d.ts.map +1 -1
- package/dist/lib/components/DataTable/types.d.ts +5 -0
- package/dist/lib/components/DataTable/types.d.ts.map +1 -1
- package/dist/lib/components/Select/SelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts +1 -1
- package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -1
- package/dist/lib/components/ValueFilter/ValueFilter.d.ts +14 -3
- package/dist/lib/components/ValueFilter/ValueFilter.d.ts.map +1 -1
- package/dist/lib/types/table-filter.d.ts +5 -1
- package/dist/lib/types/table-filter.d.ts.map +1 -1
- package/dist/lib/utils/filter.d.ts +22 -0
- package/dist/lib/utils/filter.d.ts.map +1 -0
- package/dist/types/table-filter.js +1 -1
- package/dist/types/table-filter.js.map +1 -1
- package/dist/useDataTable.js +215 -160
- package/dist/useDataTable.js.map +1 -1
- package/dist/utils/filter.js +21 -0
- package/dist/utils/filter.js.map +1 -0
- package/package.json +7 -1
- package/dist/lib/components/DataTable/components/FilterWrapper.d.ts +0 -21
- package/dist/lib/components/DataTable/components/FilterWrapper.d.ts.map +0 -1
package/dist/useDataTable.js
CHANGED
|
@@ -10,15 +10,15 @@ import { d as usePermissionGate, l as lockedTip, c as usePermission, b as Permis
|
|
|
10
10
|
import { A as ArrowDown, a as ArrowUp, I as Inbox, S as Settings, C as ChevronsLeft, b as ChevronsRight, c as Columns2, P as Pin, E as EllipsisVertical, F as FileUp, d as FilePlusCorner, R as RefreshCw, e as Equal, f as ArrowLeft, B as BookmarkPlus, L as LayoutList, g as Settings2, h as Funnel, i as ArrowUpFromLine, j as ArrowDownToLine, T as TableProperties } from './table-properties.js';
|
|
11
11
|
import { useMutation, useQueryClient, useQuery } from '@tanstack/react-query';
|
|
12
12
|
import * as React from 'react';
|
|
13
|
-
import React__default, {
|
|
13
|
+
import React__default, { Children, isValidElement, cloneElement, useMemo, useState, useRef, useEffect, forwardRef, useCallback, useLayoutEffect } from 'react';
|
|
14
14
|
import { EMPTY_TABLE_STATE } from './types/table-filter.js';
|
|
15
15
|
import { axios } from './utils/axios.js';
|
|
16
16
|
import { E as Empty } from './Empty.js';
|
|
17
17
|
import { b as SortableList, a as SortableItem } from './Sortable.js';
|
|
18
|
-
import { u as useForm, C as Controller } from './index.esm.js';
|
|
19
18
|
import { P as Popover, a as PopoverTrigger, b as PopoverContent } from './popover.js';
|
|
20
19
|
import { G as GripVertical } from './grip-vertical.js';
|
|
21
20
|
import { a as Eye, E as EyeOff } from './eye.js';
|
|
21
|
+
import { u as useForm } from './index.esm.js';
|
|
22
22
|
import { B as Badge } from './Badge.js';
|
|
23
23
|
import { F as Form } from './Form.js';
|
|
24
24
|
import { U as UploadFile } from './UploadFile.js';
|
|
@@ -820,12 +820,22 @@ const MAX_TABLES = 20;
|
|
|
820
820
|
function viewStatesEqual(a, b) {
|
|
821
821
|
return deepEqual(a, b);
|
|
822
822
|
}
|
|
823
|
+
function normalizeViewState(raw) {
|
|
824
|
+
return { ...EMPTY_TABLE_STATE, ...raw };
|
|
825
|
+
}
|
|
826
|
+
function withCondition(conditions, field, condition) {
|
|
827
|
+
const index = conditions.findIndex((c) => c.field === field);
|
|
828
|
+
if (condition === null) return index === -1 ? conditions : conditions.filter((_, i) => i !== index);
|
|
829
|
+
if (index === -1) return [...conditions, condition];
|
|
830
|
+
if (deepEqual(conditions[index], condition)) return conditions;
|
|
831
|
+
return conditions.map((c, i) => i === index ? condition : c);
|
|
832
|
+
}
|
|
823
833
|
const DEFAULT_TABLE_STATE = {
|
|
824
834
|
activeState: EMPTY_TABLE_STATE,
|
|
825
835
|
activeViewState: null,
|
|
826
836
|
activeViewId: null,
|
|
827
837
|
lastAccessed: 0,
|
|
828
|
-
|
|
838
|
+
saveRequest: 0
|
|
829
839
|
};
|
|
830
840
|
const useDataTableStore = create((set, get) => ({
|
|
831
841
|
tables: {},
|
|
@@ -850,22 +860,23 @@ const useDataTableStore = create((set, get) => ({
|
|
|
850
860
|
return { tables };
|
|
851
861
|
});
|
|
852
862
|
},
|
|
853
|
-
// Sets activeState/viewId/viewState
|
|
854
|
-
|
|
863
|
+
// Sets activeState/viewId/viewState from a stored state. A page load (the default) only shows it; a view the user
|
|
864
|
+
// switches to is also saved as the table's live state
|
|
865
|
+
loadViewState: (slug, state, viewId, fromUser = false) => {
|
|
855
866
|
set((prev) => {
|
|
856
867
|
const currentTable = prev.tables[slug];
|
|
857
868
|
if (!currentTable) return prev;
|
|
858
|
-
const
|
|
869
|
+
const loaded = normalizeViewState(state);
|
|
859
870
|
return {
|
|
860
871
|
tables: {
|
|
861
872
|
...prev.tables,
|
|
862
873
|
[slug]: {
|
|
863
874
|
...currentTable,
|
|
864
|
-
activeState:
|
|
875
|
+
activeState: loaded,
|
|
865
876
|
activeViewId: viewId,
|
|
866
877
|
// On page-load, activeViewState is set later via setActiveViewState; on user tab activation, set it immediately
|
|
867
|
-
activeViewState:
|
|
868
|
-
|
|
878
|
+
activeViewState: fromUser && viewId !== null ? loaded : null,
|
|
879
|
+
saveRequest: fromUser ? currentTable.saveRequest + 1 : currentTable.saveRequest,
|
|
869
880
|
lastAccessed: Date.now()
|
|
870
881
|
}
|
|
871
882
|
}
|
|
@@ -884,13 +895,14 @@ const useDataTableStore = create((set, get) => ({
|
|
|
884
895
|
[slug]: {
|
|
885
896
|
...currentTable,
|
|
886
897
|
activeState: newActiveState,
|
|
898
|
+
saveRequest: currentTable.saveRequest + 1,
|
|
887
899
|
lastAccessed: Date.now()
|
|
888
900
|
}
|
|
889
901
|
}
|
|
890
902
|
};
|
|
891
903
|
});
|
|
892
904
|
},
|
|
893
|
-
// Sets activeState.filters and returns to the first page, since the old page may be past the new result count
|
|
905
|
+
// Sets activeState.filters.panel and returns to the first page, since the old page may be past the new result count
|
|
894
906
|
setFilters: (slug, filters) => {
|
|
895
907
|
set((prev) => {
|
|
896
908
|
const currentTable = prev.tables[slug];
|
|
@@ -900,9 +912,10 @@ const useDataTableStore = create((set, get) => ({
|
|
|
900
912
|
...prev.tables,
|
|
901
913
|
[slug]: {
|
|
902
914
|
...currentTable,
|
|
915
|
+
saveRequest: currentTable.saveRequest + 1,
|
|
903
916
|
activeState: {
|
|
904
917
|
...currentTable.activeState,
|
|
905
|
-
filters,
|
|
918
|
+
filters: { ...currentTable.activeState.filters, panel: filters },
|
|
906
919
|
pagination: { ...currentTable.activeState.pagination, offset: 0 }
|
|
907
920
|
},
|
|
908
921
|
lastAccessed: Date.now()
|
|
@@ -911,6 +924,56 @@ const useDataTableStore = create((set, get) => ({
|
|
|
911
924
|
};
|
|
912
925
|
});
|
|
913
926
|
},
|
|
927
|
+
// Replaces or removes one condition in filters.panel and returns to the first page
|
|
928
|
+
setFilter: (slug, field, condition) => {
|
|
929
|
+
set((prev) => {
|
|
930
|
+
const currentTable = prev.tables[slug];
|
|
931
|
+
if (!currentTable) return prev;
|
|
932
|
+
const { filters, pagination } = currentTable.activeState;
|
|
933
|
+
const panel = withCondition(filters.panel, field, condition);
|
|
934
|
+
if (panel === filters.panel) return prev;
|
|
935
|
+
return {
|
|
936
|
+
tables: {
|
|
937
|
+
...prev.tables,
|
|
938
|
+
[slug]: {
|
|
939
|
+
...currentTable,
|
|
940
|
+
saveRequest: currentTable.saveRequest + 1,
|
|
941
|
+
activeState: {
|
|
942
|
+
...currentTable.activeState,
|
|
943
|
+
filters: { ...filters, panel },
|
|
944
|
+
pagination: { ...pagination, offset: 0 }
|
|
945
|
+
},
|
|
946
|
+
lastAccessed: Date.now()
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
});
|
|
951
|
+
},
|
|
952
|
+
// Replaces or removes one condition in filters.context and returns to the first page
|
|
953
|
+
setContext: (slug, field, condition) => {
|
|
954
|
+
set((prev) => {
|
|
955
|
+
const currentTable = prev.tables[slug];
|
|
956
|
+
if (!currentTable) return prev;
|
|
957
|
+
const { filters, pagination } = currentTable.activeState;
|
|
958
|
+
const context = withCondition(filters.context, field, condition);
|
|
959
|
+
if (context === filters.context) return prev;
|
|
960
|
+
return {
|
|
961
|
+
tables: {
|
|
962
|
+
...prev.tables,
|
|
963
|
+
[slug]: {
|
|
964
|
+
...currentTable,
|
|
965
|
+
saveRequest: currentTable.saveRequest + 1,
|
|
966
|
+
activeState: {
|
|
967
|
+
...currentTable.activeState,
|
|
968
|
+
filters: { ...filters, context },
|
|
969
|
+
pagination: { ...pagination, offset: 0 }
|
|
970
|
+
},
|
|
971
|
+
lastAccessed: Date.now()
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
};
|
|
975
|
+
});
|
|
976
|
+
},
|
|
914
977
|
// Sets activeState.search and returns to the first page, since the old page may be past the new result count
|
|
915
978
|
setSearch: (slug, search) => {
|
|
916
979
|
set((prev) => {
|
|
@@ -921,6 +984,7 @@ const useDataTableStore = create((set, get) => ({
|
|
|
921
984
|
...prev.tables,
|
|
922
985
|
[slug]: {
|
|
923
986
|
...currentTable,
|
|
987
|
+
saveRequest: currentTable.saveRequest + 1,
|
|
924
988
|
activeState: {
|
|
925
989
|
...currentTable.activeState,
|
|
926
990
|
search,
|
|
@@ -943,6 +1007,7 @@ const useDataTableStore = create((set, get) => ({
|
|
|
943
1007
|
[slug]: {
|
|
944
1008
|
...currentTable,
|
|
945
1009
|
activeState: { ...currentTable.activeState, pagination },
|
|
1010
|
+
saveRequest: currentTable.saveRequest + 1,
|
|
946
1011
|
lastAccessed: Date.now()
|
|
947
1012
|
}
|
|
948
1013
|
}
|
|
@@ -954,23 +1019,18 @@ const useDataTableStore = create((set, get) => ({
|
|
|
954
1019
|
set((prev) => {
|
|
955
1020
|
const currentTable = prev.tables[slug];
|
|
956
1021
|
if (!currentTable) return prev;
|
|
1022
|
+
const state = normalizeViewState(viewState);
|
|
957
1023
|
return {
|
|
958
1024
|
tables: {
|
|
959
1025
|
...prev.tables,
|
|
960
|
-
[slug]: {
|
|
1026
|
+
[slug]: {
|
|
1027
|
+
...currentTable,
|
|
1028
|
+
activeViewState: state
|
|
1029
|
+
}
|
|
961
1030
|
}
|
|
962
1031
|
};
|
|
963
1032
|
});
|
|
964
1033
|
},
|
|
965
|
-
// Reads _skipUpsert, clears it, and returns whether it was set — consumed once per load
|
|
966
|
-
consumeSkipUpsert: (slug) => {
|
|
967
|
-
const table = get().tables[slug];
|
|
968
|
-
if (!table?._skipUpsert) return false;
|
|
969
|
-
set((prev) => ({
|
|
970
|
-
tables: { ...prev.tables, [slug]: { ...prev.tables[slug], _skipUpsert: false } }
|
|
971
|
-
}));
|
|
972
|
-
return true;
|
|
973
|
-
},
|
|
974
1034
|
// Syncs activeViewState to current activeState after a view is saved in-place
|
|
975
1035
|
syncActiveViewState: (slug) => {
|
|
976
1036
|
set((prev) => {
|
|
@@ -989,77 +1049,43 @@ const useDataTableStore = create((set, get) => ({
|
|
|
989
1049
|
}
|
|
990
1050
|
}));
|
|
991
1051
|
|
|
992
|
-
function
|
|
993
|
-
return
|
|
1052
|
+
function filterStatics(el) {
|
|
1053
|
+
return typeof el.type === "function" || typeof el.type === "object" ? el.type : {};
|
|
994
1054
|
}
|
|
995
|
-
function
|
|
996
|
-
|
|
1055
|
+
function filterName(el) {
|
|
1056
|
+
const { name } = el.props;
|
|
1057
|
+
return typeof name === "string" ? name : filterStatics(el).defaultName;
|
|
997
1058
|
}
|
|
998
|
-
function
|
|
1059
|
+
function filterLabel(el) {
|
|
1060
|
+
const { label } = el.props;
|
|
1061
|
+
return typeof label === "string" ? label : filterStatics(el).defaultLabel ?? "";
|
|
1062
|
+
}
|
|
1063
|
+
function bindFilters(children, binding) {
|
|
999
1064
|
return Children.map(children, (child) => {
|
|
1000
1065
|
if (!isValidElement(child)) return child;
|
|
1001
1066
|
const el = child;
|
|
1002
|
-
const
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
if (typeof name === "string") {
|
|
1006
|
-
return /* @__PURE__ */ jsx(
|
|
1007
|
-
Controller,
|
|
1008
|
-
{
|
|
1009
|
-
control,
|
|
1010
|
-
name,
|
|
1011
|
-
render: ({ field }) => cloneElement(el, { ...props, fieldKey: name, value: field.value, onChange: field.onChange })
|
|
1012
|
-
},
|
|
1013
|
-
name
|
|
1014
|
-
);
|
|
1015
|
-
}
|
|
1016
|
-
if (props.children != null) {
|
|
1067
|
+
const name = filterName(el);
|
|
1068
|
+
if (name !== void 0) {
|
|
1069
|
+
if (binding.keepControlled && "value" in el.props) return el;
|
|
1017
1070
|
return cloneElement(el, {
|
|
1018
|
-
|
|
1019
|
-
|
|
1071
|
+
value: binding.conditions.find((c) => c.field === name) ?? null,
|
|
1072
|
+
onChange: (condition) => binding.onChange(name, condition ?? null),
|
|
1073
|
+
...binding.required?.has(name) ? { clearable: false } : {}
|
|
1020
1074
|
});
|
|
1021
1075
|
}
|
|
1076
|
+
if (el.props.children != null) {
|
|
1077
|
+
return cloneElement(el, { children: bindFilters(el.props.children, binding) });
|
|
1078
|
+
}
|
|
1022
1079
|
return child;
|
|
1023
1080
|
});
|
|
1024
1081
|
}
|
|
1025
|
-
function FilterWrapper({
|
|
1026
|
-
onSubmit,
|
|
1027
|
-
onReset,
|
|
1028
|
-
defaultValues,
|
|
1029
|
-
activeFilters,
|
|
1030
|
-
resetValues,
|
|
1031
|
-
renderActions,
|
|
1032
|
-
children,
|
|
1033
|
-
...props
|
|
1034
|
-
}) {
|
|
1035
|
-
const form = useForm({ defaultValues: defaultValues ?? {} });
|
|
1036
|
-
const isSubmitting = form.formState.isSubmitting;
|
|
1037
|
-
const formValues = form.watch();
|
|
1038
|
-
const isPending = !deepEqual(normalizeFormValues(formValues), normalizeActiveFilters(activeFilters ?? []));
|
|
1039
|
-
const onResetRef = useRef(onReset);
|
|
1040
|
-
onResetRef.current = onReset;
|
|
1041
|
-
function handleReset() {
|
|
1042
|
-
form.reset(resetValues ?? {});
|
|
1043
|
-
onResetRef.current?.();
|
|
1044
|
-
}
|
|
1045
|
-
const handleSubmit = form.handleSubmit(async (data) => {
|
|
1046
|
-
await onSubmit(data);
|
|
1047
|
-
});
|
|
1048
|
-
return /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, onReset: handleReset, ...props, children: [
|
|
1049
|
-
processChildren(children, form.control),
|
|
1050
|
-
renderActions?.({ isPending, isSubmitting })
|
|
1051
|
-
] });
|
|
1052
|
-
}
|
|
1053
|
-
FilterWrapper.displayName = "FilterWrapper";
|
|
1054
1082
|
|
|
1055
1083
|
function getFilterProps(node) {
|
|
1056
1084
|
if (!isValidElement(node)) return null;
|
|
1057
|
-
const
|
|
1058
|
-
const
|
|
1059
|
-
const id = typeof props.name === "string" ? props.name : meta.defaultName ?? null;
|
|
1060
|
-
const label = typeof props.label === "string" ? props.label : meta.defaultLabel ?? "";
|
|
1085
|
+
const el = node;
|
|
1086
|
+
const id = filterName(el);
|
|
1061
1087
|
if (!id) return null;
|
|
1062
|
-
return { id, label };
|
|
1088
|
+
return { id, label: filterLabel(el) };
|
|
1063
1089
|
}
|
|
1064
1090
|
function SortableFilterItem({
|
|
1065
1091
|
filter,
|
|
@@ -1101,27 +1127,13 @@ function SortableFilterItem({
|
|
|
1101
1127
|
}
|
|
1102
1128
|
) });
|
|
1103
1129
|
}
|
|
1104
|
-
const NO_FILTERS = [];
|
|
1130
|
+
const NO_FILTERS$1 = [];
|
|
1105
1131
|
function DataTableFilters({ filters, table }) {
|
|
1106
1132
|
const metaRaw = table.options.meta;
|
|
1107
1133
|
const slug = metaRaw?.slug ?? "";
|
|
1108
|
-
const activeFilters = useDataTableStore((s) => s.tables[slug]?.activeState?.filters ?? NO_FILTERS);
|
|
1134
|
+
const activeFilters = useDataTableStore((s) => s.tables[slug]?.activeState?.filters.panel ?? NO_FILTERS$1);
|
|
1109
1135
|
const activeViewId = useDataTableStore((s) => s.tables[slug]?.activeViewId ?? null);
|
|
1110
|
-
const activeViewStateFilters = useDataTableStore((s) => s.tables[slug]?.activeViewState?.filters ?? NO_FILTERS);
|
|
1111
|
-
const defaultValues = useMemo(
|
|
1112
|
-
() => activeFilters.reduce((acc, f) => {
|
|
1113
|
-
acc[f.field] = f;
|
|
1114
|
-
return acc;
|
|
1115
|
-
}, {}),
|
|
1116
|
-
[activeFilters]
|
|
1117
|
-
);
|
|
1118
|
-
const resetValues = useMemo(
|
|
1119
|
-
() => activeViewId !== null ? activeViewStateFilters.reduce((acc, f) => {
|
|
1120
|
-
acc[f.field] = f;
|
|
1121
|
-
return acc;
|
|
1122
|
-
}, {}) : {},
|
|
1123
|
-
[activeViewId, activeViewStateFilters]
|
|
1124
|
-
);
|
|
1136
|
+
const activeViewStateFilters = useDataTableStore((s) => s.tables[slug]?.activeViewState?.filters.panel ?? NO_FILTERS$1);
|
|
1125
1137
|
const filterEntries = useMemo(() => {
|
|
1126
1138
|
const entries = [];
|
|
1127
1139
|
for (const node of filters) {
|
|
@@ -1145,38 +1157,22 @@ function DataTableFilters({ filters, table }) {
|
|
|
1145
1157
|
function handleReorder(reordered) {
|
|
1146
1158
|
meta.setFilterOrder(reordered.map((r) => r.id));
|
|
1147
1159
|
}
|
|
1148
|
-
|
|
1149
|
-
const applied = Object.values(data).filter((c) => c != null);
|
|
1150
|
-
meta.setFilters(applied);
|
|
1151
|
-
}
|
|
1160
|
+
const resetFilters = activeViewId !== null ? activeViewStateFilters : NO_FILTERS$1;
|
|
1152
1161
|
function handleReset() {
|
|
1153
|
-
meta.setFilters(
|
|
1162
|
+
meta.setFilters(resetFilters);
|
|
1154
1163
|
}
|
|
1155
1164
|
const toFilterMap = (filters2) => Object.fromEntries(filters2.map((f) => [f.field, f]));
|
|
1156
|
-
const hasResetChanges =
|
|
1165
|
+
const hasResetChanges = !deepEqual(toFilterMap(activeFilters), toFilterMap(resetFilters));
|
|
1157
1166
|
const hiddenFilterCount = filterEntries.filter((f) => meta.filterVisibility[f.id] === false).length;
|
|
1158
1167
|
const sortableItems = effectiveOrder.map((s) => {
|
|
1159
1168
|
const filter = filterMap.get(s);
|
|
1160
1169
|
return filter ? { id: s, label: filter.label } : null;
|
|
1161
1170
|
}).filter((item) => item !== null);
|
|
1162
1171
|
return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 px-4 py-3 border-b flex-wrap", children: [
|
|
1163
|
-
/* @__PURE__ */
|
|
1164
|
-
|
|
1165
|
-
{
|
|
1166
|
-
|
|
1167
|
-
activeFilters,
|
|
1168
|
-
resetValues,
|
|
1169
|
-
onSubmit: handleApply,
|
|
1170
|
-
onReset: handleReset,
|
|
1171
|
-
className: "flex items-center gap-2 flex-1 flex-wrap",
|
|
1172
|
-
renderActions: ({ isPending, isSubmitting }) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 ml-auto", children: [
|
|
1173
|
-
hasResetChanges && /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", type: "reset", children: "Reset" }),
|
|
1174
|
-
isPending && /* @__PURE__ */ jsx(Button, { size: "sm", type: "submit", isLoading: isSubmitting, children: "Apply" })
|
|
1175
|
-
] }),
|
|
1176
|
-
children: visibleFilters.map((f) => /* @__PURE__ */ jsx("span", { children: f.node }, f.id))
|
|
1177
|
-
},
|
|
1178
|
-
activeViewId + JSON.stringify(defaultValues)
|
|
1179
|
-
),
|
|
1172
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 flex-1 flex-wrap", children: [
|
|
1173
|
+
visibleFilters.map((f) => /* @__PURE__ */ jsx("span", { children: bindFilters(f.node, { conditions: activeFilters, onChange: meta.setFilter }) }, f.id)),
|
|
1174
|
+
hasResetChanges && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 ml-auto", children: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", onClick: handleReset, children: "Reset" }) })
|
|
1175
|
+
] }),
|
|
1180
1176
|
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
1181
1177
|
/* @__PURE__ */ jsxs(Popover, { children: [
|
|
1182
1178
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
@@ -1191,12 +1187,12 @@ function DataTableFilters({ filters, table }) {
|
|
|
1191
1187
|
]
|
|
1192
1188
|
}
|
|
1193
1189
|
) }),
|
|
1194
|
-
/* @__PURE__ */ jsxs(PopoverContent, { align: "end", className: "w-
|
|
1190
|
+
/* @__PURE__ */ jsxs(PopoverContent, { align: "end", className: "w-60 p-0", children: [
|
|
1195
1191
|
/* @__PURE__ */ jsxs("div", { className: "px-3 py-3 border-b", children: [
|
|
1196
1192
|
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Filter Settings" }),
|
|
1197
1193
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-0.5", children: "Drag to reorder or hide filters" })
|
|
1198
1194
|
] }),
|
|
1199
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-
|
|
1195
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-75 overflow-y-auto py-1", children: /* @__PURE__ */ jsx(SortableList, { items: sortableItems, onReorder: handleReorder, children: sortableItems.map(({ id, label }) => /* @__PURE__ */ jsx(
|
|
1200
1196
|
SortableFilterItem,
|
|
1201
1197
|
{
|
|
1202
1198
|
filter: { id, label },
|
|
@@ -1519,7 +1515,7 @@ function DataTableSearch({ columns, search, onSearchChange, searchAll, className
|
|
|
1519
1515
|
if (e.key === "Escape") handleCollapse();
|
|
1520
1516
|
},
|
|
1521
1517
|
placeholder: `Search ${selectedLabel.toLowerCase()}...`,
|
|
1522
|
-
className: "bg-background text-sm outline-none w-full min-w-
|
|
1518
|
+
className: "bg-background text-sm outline-none w-full min-w-35 placeholder:text-muted-foreground text-foreground"
|
|
1523
1519
|
}
|
|
1524
1520
|
)
|
|
1525
1521
|
] }),
|
|
@@ -20143,7 +20139,7 @@ function DataTableViewOptions({ table, className }) {
|
|
|
20143
20139
|
}
|
|
20144
20140
|
)
|
|
20145
20141
|
] }),
|
|
20146
|
-
/* @__PURE__ */ jsx("div", { className: "max-h-
|
|
20142
|
+
/* @__PURE__ */ jsx("div", { className: "max-h-75 overflow-y-auto py-1", children: /* @__PURE__ */ jsx(SortableList, { items: sortableColumns, onReorder: handleReorder, children: sortableColumns.map((item) => /* @__PURE__ */ jsx(SortableColumnItem, { column: item.column }, item.id)) }) })
|
|
20147
20143
|
] })
|
|
20148
20144
|
}
|
|
20149
20145
|
]
|
|
@@ -24040,7 +24036,7 @@ function DataTableViewsMenu({ slug: tableSlug }) {
|
|
|
24040
24036
|
const hasNonEmptyState = useDataTableStore((s) => {
|
|
24041
24037
|
const st = s.tables[tableSlug]?.activeState;
|
|
24042
24038
|
if (!st) return false;
|
|
24043
|
-
return st.filters.length > 0 || st.sort.length > 0 || Object.keys(st.columnVisibility).length > 0 || st.density !== "normal" || st.columnPinning.left.filter((c) => c !== "select").length > 0 || st.columnPinning.right.length > 0;
|
|
24039
|
+
return st.filters.panel.length > 0 || st.filters.context.length > 0 || st.sort.length > 0 || Object.keys(st.columnVisibility).length > 0 || st.density !== "normal" || st.columnPinning.left.filter((c) => c !== "select").length > 0 || st.columnPinning.right.length > 0;
|
|
24044
24040
|
});
|
|
24045
24041
|
const syncActiveViewState = useDataTableStore((s) => s.syncActiveViewState);
|
|
24046
24042
|
const hasView = activeViewId !== null;
|
|
@@ -24170,10 +24166,10 @@ function DataTableViewTabs({ slug }) {
|
|
|
24170
24166
|
});
|
|
24171
24167
|
function doActivate(viewId) {
|
|
24172
24168
|
if (activeViewId === viewId) {
|
|
24173
|
-
loadViewState(tableSlug, EMPTY_TABLE_STATE, null,
|
|
24169
|
+
loadViewState(tableSlug, EMPTY_TABLE_STATE, null, true);
|
|
24174
24170
|
} else {
|
|
24175
24171
|
const view = views.find((v) => v.id === viewId);
|
|
24176
|
-
if (view) loadViewState(tableSlug, view.state, viewId,
|
|
24172
|
+
if (view) loadViewState(tableSlug, view.state, viewId, true);
|
|
24177
24173
|
}
|
|
24178
24174
|
}
|
|
24179
24175
|
function proceedWithSwitch() {
|
|
@@ -24263,6 +24259,7 @@ const densityClasses = {
|
|
|
24263
24259
|
normal: "py-2 px-3 text-sm",
|
|
24264
24260
|
comfortable: "py-4 px-3 text-sm"
|
|
24265
24261
|
};
|
|
24262
|
+
const NO_FILTERS = [];
|
|
24266
24263
|
const MODE_HEIGHTS = {
|
|
24267
24264
|
page: "calc(100vh - 280px)",
|
|
24268
24265
|
tab: "calc(100vh - 320px)",
|
|
@@ -24284,7 +24281,8 @@ function DataTable({
|
|
|
24284
24281
|
toolbarActions,
|
|
24285
24282
|
filters,
|
|
24286
24283
|
contextBar,
|
|
24287
|
-
isLoading = false,
|
|
24284
|
+
isLoading: isLoadingProp = false,
|
|
24285
|
+
isFetching = false,
|
|
24288
24286
|
className,
|
|
24289
24287
|
enableViews = true,
|
|
24290
24288
|
importExport,
|
|
@@ -24307,8 +24305,11 @@ function DataTable({
|
|
|
24307
24305
|
const exportGate = usePermission(importExport?.exportPermission);
|
|
24308
24306
|
const meta = table.options.meta;
|
|
24309
24307
|
const slug = meta?.slug;
|
|
24310
|
-
const
|
|
24308
|
+
const panelFilters = useDataTableStore((s) => slug ? s.tables[slug]?.activeState?.filters.panel : void 0);
|
|
24309
|
+
const contextFilters = useDataTableStore((s) => slug ? s.tables[slug]?.activeState?.filters.context : void 0);
|
|
24310
|
+
const appliedFilterCount = panelFilters?.length ?? 0;
|
|
24311
24311
|
const activeViewId = useDataTableStore((s) => slug ? s.tables[slug]?.activeViewId ?? null : null);
|
|
24312
|
+
const isLoading = isLoadingProp || !!meta?.isAwaitingDefaults;
|
|
24312
24313
|
const loadViewState = useDataTableStore((s) => s.loadViewState);
|
|
24313
24314
|
const density = meta?.density ?? "normal";
|
|
24314
24315
|
const columnCount = table.getAllColumns().length;
|
|
@@ -24321,10 +24322,19 @@ function DataTable({
|
|
|
24321
24322
|
const hasActiveFilters = hasActiveView ? !!meta?.isFiltersDirty : appliedFilterCount > 0;
|
|
24322
24323
|
const hasActiveSearch = hasActiveView ? !!meta?.isSearchDirty : !!(search?.value && search.value.trim() !== "");
|
|
24323
24324
|
const isFiltered = hasActiveSearch || hasActiveFilters || hasActiveView;
|
|
24324
|
-
const filtersBaseline = meta?.activeViewState?.filters ??
|
|
24325
|
+
const filtersBaseline = meta?.activeViewState?.filters.panel ?? NO_FILTERS;
|
|
24325
24326
|
const searchBaseline = meta?.activeViewState?.search ?? null;
|
|
24326
24327
|
const onSearchChange = (s) => meta?.setSearch?.(s);
|
|
24327
24328
|
const selectedCount = table.getFilteredSelectedRowModel().rows.length;
|
|
24329
|
+
const setContext = meta?.setContext;
|
|
24330
|
+
const defaultContext = meta?.defaultContext ?? NO_FILTERS;
|
|
24331
|
+
const requiredContext = useMemo(() => new Set(defaultContext.map((c) => c.field)), [defaultContext]);
|
|
24332
|
+
const boundContextBar = contextBar && setContext ? bindFilters(contextBar, {
|
|
24333
|
+
conditions: contextFilters ?? NO_FILTERS,
|
|
24334
|
+
onChange: setContext,
|
|
24335
|
+
keepControlled: true,
|
|
24336
|
+
required: requiredContext
|
|
24337
|
+
}) : contextBar;
|
|
24328
24338
|
useEffect(() => {
|
|
24329
24339
|
if (selectedCount > 0) setFiltersOpen(false);
|
|
24330
24340
|
}, [selectedCount]);
|
|
@@ -24346,7 +24356,7 @@ function DataTable({
|
|
|
24346
24356
|
showToolbar && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
24347
24357
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
24348
24358
|
contextBar && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24349
|
-
/* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-2", children:
|
|
24359
|
+
/* @__PURE__ */ jsx("div", { className: "flex shrink-0 items-center gap-2", children: boundContextBar }),
|
|
24350
24360
|
/* @__PURE__ */ jsx(Separator, { orientation: "vertical", className: "data-[orientation=vertical]:h-6" })
|
|
24351
24361
|
] }),
|
|
24352
24362
|
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 flex-1", children: enableViews && slug && /* @__PURE__ */ jsx(DataTableViewTabs, { slug }) })
|
|
@@ -24447,7 +24457,24 @@ function DataTable({
|
|
|
24447
24457
|
toolbarActions?.actions
|
|
24448
24458
|
] })
|
|
24449
24459
|
] }),
|
|
24450
|
-
/* @__PURE__ */ jsxs("div", { className: "border rounded-lg overflow-hidden flex flex-col", style: { height: MODE_HEIGHTS[mode] }, children: [
|
|
24460
|
+
/* @__PURE__ */ jsxs("div", { className: "relative border rounded-lg overflow-hidden flex flex-col", style: { height: MODE_HEIGHTS[mode] }, children: [
|
|
24461
|
+
isFetching && !isLoading && /* @__PURE__ */ jsx(
|
|
24462
|
+
"div",
|
|
24463
|
+
{
|
|
24464
|
+
role: "progressbar",
|
|
24465
|
+
"aria-label": "Loading",
|
|
24466
|
+
className: "pointer-events-none absolute inset-x-0 top-0 z-30 h-0.5 overflow-hidden bg-primary/15",
|
|
24467
|
+
children: /* @__PURE__ */ jsx(
|
|
24468
|
+
motion.div,
|
|
24469
|
+
{
|
|
24470
|
+
className: "h-full w-1/3 bg-primary",
|
|
24471
|
+
initial: { x: "-100%" },
|
|
24472
|
+
animate: { x: "300%" },
|
|
24473
|
+
transition: { duration: 1.1, ease: "easeInOut", repeat: Number.POSITIVE_INFINITY }
|
|
24474
|
+
}
|
|
24475
|
+
)
|
|
24476
|
+
}
|
|
24477
|
+
),
|
|
24451
24478
|
/* @__PURE__ */ jsx(AnimatePresence, { mode: "wait", children: selectedCount > 0 ? /* @__PURE__ */ jsx(
|
|
24452
24479
|
motion.div,
|
|
24453
24480
|
{
|
|
@@ -24614,7 +24641,7 @@ function DataTable({
|
|
|
24614
24641
|
{
|
|
24615
24642
|
variant: "outline",
|
|
24616
24643
|
size: "sm",
|
|
24617
|
-
onClick: () => loadViewState(slug, EMPTY_TABLE_STATE, null,
|
|
24644
|
+
onClick: () => loadViewState(slug, EMPTY_TABLE_STATE, null, true),
|
|
24618
24645
|
children: "Clear View"
|
|
24619
24646
|
}
|
|
24620
24647
|
)
|
|
@@ -24662,7 +24689,7 @@ function useTableSlice(slug) {
|
|
|
24662
24689
|
const isFiltersDirty = useDataTableStore((s) => {
|
|
24663
24690
|
const t = s.tables[slug];
|
|
24664
24691
|
if (!t?.activeViewState) return false;
|
|
24665
|
-
return !deepEqual(t.activeState.filters, t.activeViewState.filters);
|
|
24692
|
+
return !deepEqual(t.activeState.filters.panel, t.activeViewState.filters.panel);
|
|
24666
24693
|
});
|
|
24667
24694
|
const isSearchDirty = useDataTableStore((s) => {
|
|
24668
24695
|
const t = s.tables[slug];
|
|
@@ -24671,20 +24698,28 @@ function useTableSlice(slug) {
|
|
|
24671
24698
|
});
|
|
24672
24699
|
const _updateActiveState = useDataTableStore((s) => s.updateActiveState);
|
|
24673
24700
|
const _setFilters = useDataTableStore((s) => s.setFilters);
|
|
24701
|
+
const _setFilter = useDataTableStore((s) => s.setFilter);
|
|
24702
|
+
const _setContext = useDataTableStore((s) => s.setContext);
|
|
24674
24703
|
const _setSearch = useDataTableStore((s) => s.setSearch);
|
|
24675
24704
|
const _setPagination = useDataTableStore((s) => s.setPagination);
|
|
24676
|
-
const _consumeSkipUpsert = useDataTableStore((s) => s.consumeSkipUpsert);
|
|
24677
24705
|
const updateActiveState = useCallback(
|
|
24678
24706
|
(updater) => _updateActiveState(slug, updater),
|
|
24679
24707
|
[slug, _updateActiveState]
|
|
24680
24708
|
);
|
|
24681
24709
|
const setFilters = useCallback((filters) => _setFilters(slug, filters), [slug, _setFilters]);
|
|
24710
|
+
const setFilter = useCallback(
|
|
24711
|
+
(field, condition) => _setFilter(slug, field, condition),
|
|
24712
|
+
[slug, _setFilter]
|
|
24713
|
+
);
|
|
24714
|
+
const setContext = useCallback(
|
|
24715
|
+
(field, condition) => _setContext(slug, field, condition),
|
|
24716
|
+
[slug, _setContext]
|
|
24717
|
+
);
|
|
24682
24718
|
const setSearch = useCallback((search) => _setSearch(slug, search), [slug, _setSearch]);
|
|
24683
24719
|
const setPagination = useCallback(
|
|
24684
24720
|
(pagination) => _setPagination(slug, pagination),
|
|
24685
24721
|
[slug, _setPagination]
|
|
24686
24722
|
);
|
|
24687
|
-
const consumeSkipUpsert = useCallback(() => _consumeSkipUpsert(slug), [slug, _consumeSkipUpsert]);
|
|
24688
24723
|
const sorting = useMemo(() => sortConditionsToTanstack(activeState.sort), [activeState.sort]);
|
|
24689
24724
|
const handleSortingChange = useCallback(
|
|
24690
24725
|
(updater) => {
|
|
@@ -24703,34 +24738,33 @@ function useTableSlice(slug) {
|
|
|
24703
24738
|
isSearchDirty,
|
|
24704
24739
|
updateActiveState,
|
|
24705
24740
|
setFilters,
|
|
24741
|
+
setFilter,
|
|
24742
|
+
setContext,
|
|
24706
24743
|
setSearch,
|
|
24707
24744
|
setPagination,
|
|
24708
|
-
handleSortingChange
|
|
24709
|
-
consumeSkipUpsert
|
|
24745
|
+
handleSortingChange
|
|
24710
24746
|
};
|
|
24711
24747
|
}
|
|
24712
24748
|
|
|
24713
|
-
function useAutoUpsert(slug,
|
|
24749
|
+
function useAutoUpsert(slug, isReady, onStatePush) {
|
|
24714
24750
|
const onStatePushRef = useRef(onStatePush);
|
|
24715
24751
|
onStatePushRef.current = onStatePush;
|
|
24716
|
-
const
|
|
24717
|
-
const
|
|
24752
|
+
const saveRequest = useDataTableStore((s) => s.tables[slug]?.saveRequest ?? 0);
|
|
24753
|
+
const handledRef = useRef({ slug, saveRequest });
|
|
24718
24754
|
useEffect(() => {
|
|
24719
|
-
|
|
24720
|
-
|
|
24721
|
-
|
|
24722
|
-
return;
|
|
24723
|
-
}
|
|
24724
|
-
if (prevActiveStateRef.current === activeState) return;
|
|
24725
|
-
prevActiveStateRef.current = activeState;
|
|
24726
|
-
if (consumeSkipUpsert()) return;
|
|
24755
|
+
const handled = handledRef.current;
|
|
24756
|
+
handledRef.current = { slug, saveRequest };
|
|
24757
|
+
if (!isReady || handled.slug !== slug || handled.saveRequest === saveRequest) return;
|
|
24727
24758
|
const timer = setTimeout(() => {
|
|
24728
|
-
|
|
24759
|
+
const table = useDataTableStore.getState().tables[slug];
|
|
24760
|
+
if (!table) return;
|
|
24761
|
+
pushTableState(slug, table.activeState, table.activeViewId).then(() => onStatePushRef.current?.());
|
|
24729
24762
|
}, 150);
|
|
24730
24763
|
return () => clearTimeout(timer);
|
|
24731
|
-
}, [
|
|
24764
|
+
}, [slug, saveRequest, isReady]);
|
|
24732
24765
|
}
|
|
24733
24766
|
|
|
24767
|
+
const NO_CONDITIONS = [];
|
|
24734
24768
|
function useDataTable({
|
|
24735
24769
|
columns,
|
|
24736
24770
|
slug,
|
|
@@ -24741,12 +24775,12 @@ function useDataTable({
|
|
|
24741
24775
|
enableHiding = true,
|
|
24742
24776
|
enableSorting = true,
|
|
24743
24777
|
enableColumnResizing = true,
|
|
24744
|
-
onStatePush
|
|
24778
|
+
onStatePush,
|
|
24779
|
+
defaultContext
|
|
24745
24780
|
}) {
|
|
24746
24781
|
const {
|
|
24747
24782
|
// State
|
|
24748
24783
|
activeState,
|
|
24749
|
-
activeViewId,
|
|
24750
24784
|
activeViewState,
|
|
24751
24785
|
sorting,
|
|
24752
24786
|
// Dirty flags
|
|
@@ -24756,17 +24790,12 @@ function useDataTable({
|
|
|
24756
24790
|
// Actions
|
|
24757
24791
|
updateActiveState,
|
|
24758
24792
|
setFilters,
|
|
24793
|
+
setFilter,
|
|
24794
|
+
setContext,
|
|
24759
24795
|
setSearch,
|
|
24760
24796
|
setPagination,
|
|
24761
|
-
handleSortingChange
|
|
24762
|
-
consumeSkipUpsert
|
|
24797
|
+
handleSortingChange
|
|
24763
24798
|
} = useTableSlice(slug);
|
|
24764
|
-
const hasInitRef = useRef(false);
|
|
24765
|
-
useEffect(() => {
|
|
24766
|
-
if (!serverState?.state || hasInitRef.current) return;
|
|
24767
|
-
hasInitRef.current = true;
|
|
24768
|
-
useDataTableStore.getState().loadViewState(slug, serverState.state, serverState.activeViewId ?? null);
|
|
24769
|
-
}, [serverState?.state, serverState?.activeViewId, slug]);
|
|
24770
24799
|
const initializedSlug = useRef(null);
|
|
24771
24800
|
useLayoutEffect(() => {
|
|
24772
24801
|
if (initializedSlug.current !== slug) {
|
|
@@ -24774,6 +24803,24 @@ function useDataTable({
|
|
|
24774
24803
|
initializedSlug.current = slug;
|
|
24775
24804
|
}
|
|
24776
24805
|
}, [slug, enableRowSelection]);
|
|
24806
|
+
const nextDefaults = defaultContext ?? NO_CONDITIONS;
|
|
24807
|
+
const [defaults, setDefaults] = useState(nextDefaults);
|
|
24808
|
+
if (!deepEqual(defaults, nextDefaults)) setDefaults(nextDefaults);
|
|
24809
|
+
const [loadedSlug, setLoadedSlug] = useState(null);
|
|
24810
|
+
useLayoutEffect(() => {
|
|
24811
|
+
if (!serverState?.state || loadedSlug === slug) return;
|
|
24812
|
+
useDataTableStore.getState().loadViewState(slug, serverState.state, serverState.activeViewId ?? null);
|
|
24813
|
+
setLoadedSlug(slug);
|
|
24814
|
+
}, [serverState?.state, serverState?.activeViewId, slug, loadedSlug]);
|
|
24815
|
+
const isReady = loadedSlug === slug || serverState != null && serverState.state == null;
|
|
24816
|
+
const context = activeState.filters.context;
|
|
24817
|
+
useLayoutEffect(() => {
|
|
24818
|
+
if (loadedSlug !== slug) return;
|
|
24819
|
+
for (const condition of defaults) {
|
|
24820
|
+
if (!context.some((c) => c.field === condition.field)) setContext(condition.field, condition);
|
|
24821
|
+
}
|
|
24822
|
+
}, [loadedSlug, slug, defaults, context, setContext]);
|
|
24823
|
+
const isAwaitingDefaults = serverState?.state != null && defaults.some((d) => !serverState.state?.filters.context.some((c) => c.field === d.field));
|
|
24777
24824
|
const { columnVisibility, columnOrder, columnSizing, columnPinning, lockedColumnSizing } = activeState;
|
|
24778
24825
|
const { filterOrder, filterVisibility, density } = activeState;
|
|
24779
24826
|
const capitalizedLabel = label.charAt(0).toUpperCase() + label.slice(1);
|
|
@@ -24804,6 +24851,10 @@ function useDataTable({
|
|
|
24804
24851
|
activeViewState,
|
|
24805
24852
|
// Filters
|
|
24806
24853
|
setFilters: (filters) => setFilters(filters),
|
|
24854
|
+
setFilter,
|
|
24855
|
+
setContext,
|
|
24856
|
+
defaultContext: defaults,
|
|
24857
|
+
isAwaitingDefaults,
|
|
24807
24858
|
// Search
|
|
24808
24859
|
search: activeState.search,
|
|
24809
24860
|
setSearch
|
|
@@ -24821,11 +24872,15 @@ function useDataTable({
|
|
|
24821
24872
|
activeViewState,
|
|
24822
24873
|
updateActiveState,
|
|
24823
24874
|
setFilters,
|
|
24875
|
+
setFilter,
|
|
24876
|
+
setContext,
|
|
24877
|
+
defaults,
|
|
24878
|
+
isAwaitingDefaults,
|
|
24824
24879
|
activeState.search,
|
|
24825
24880
|
setSearch
|
|
24826
24881
|
]
|
|
24827
24882
|
);
|
|
24828
|
-
useAutoUpsert(slug,
|
|
24883
|
+
useAutoUpsert(slug, isReady, onStatePush);
|
|
24829
24884
|
const data = serverState?.result ?? [];
|
|
24830
24885
|
const totalRows = serverState?.count;
|
|
24831
24886
|
const table = useReactTable({
|
|
@@ -24887,7 +24942,7 @@ function useDataTable({
|
|
|
24887
24942
|
enableHiding,
|
|
24888
24943
|
meta
|
|
24889
24944
|
});
|
|
24890
|
-
return { table };
|
|
24945
|
+
return { table, context, isLoaded: isReady };
|
|
24891
24946
|
}
|
|
24892
24947
|
|
|
24893
24948
|
export { CompactTableSkeleton as C, DataTable as D, NumberCell as N, RowActions as R, StringCell as S, CurrencyCell as a, DataTableColumnHeader as b, DataTableEmpty as c, DataTableFilters as d, DataTablePagination as e, DataTableRowDensity as f, DataTableSearch as g, DataTableSelectionBar as h, DataTableViewOptions as i, DateCell as j, DateTimeCell as k, getSelectionColumn as l, useDataTableStore as m, useDataTable as u };
|