@cerberus-design/data-grid 1.1.2 → 1.2.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/components/data-grid.client.cjs +13 -4
  2. package/dist/components/data-grid.client.js +13 -4
  3. package/dist/components/features.client.cjs +32 -9
  4. package/dist/components/features.client.js +33 -10
  5. package/dist/components/filter-item.client.cjs +38 -0
  6. package/dist/components/filter-item.client.d.cts +6 -0
  7. package/dist/components/filter-item.client.d.ts +6 -0
  8. package/dist/components/filter-item.client.js +38 -0
  9. package/dist/components/grid.client.cjs +101 -104
  10. package/dist/components/grid.client.d.cts +7 -2
  11. package/dist/components/grid.client.d.ts +7 -2
  12. package/dist/components/grid.client.js +105 -109
  13. package/dist/components/no-content.client.cjs +23 -0
  14. package/dist/components/no-content.client.d.cts +1 -0
  15. package/dist/components/no-content.client.d.ts +1 -0
  16. package/dist/components/no-content.client.js +23 -0
  17. package/dist/components/overlays.cjs +69 -0
  18. package/dist/components/overlays.d.cts +14 -0
  19. package/dist/components/overlays.d.ts +14 -0
  20. package/dist/components/overlays.js +68 -0
  21. package/dist/components/pinned-items.client.cjs +5 -4
  22. package/dist/components/pinned-items.client.js +5 -4
  23. package/dist/components/popover.client.cjs +186 -0
  24. package/dist/components/popover.client.d.cts +9 -0
  25. package/dist/components/popover.client.d.ts +9 -0
  26. package/dist/components/popover.client.js +184 -0
  27. package/dist/components/sort-items.client.cjs +4 -3
  28. package/dist/components/sort-items.client.js +4 -3
  29. package/dist/components/viewport.client.cjs +115 -0
  30. package/dist/components/viewport.client.d.cts +8 -0
  31. package/dist/components/viewport.client.d.ts +8 -0
  32. package/dist/components/viewport.client.js +115 -0
  33. package/dist/const.cjs +26 -0
  34. package/dist/const.d.cts +16 -1
  35. package/dist/const.d.ts +16 -1
  36. package/dist/const.js +25 -1
  37. package/dist/index.cjs +2 -0
  38. package/dist/index.d.cts +1 -0
  39. package/dist/index.d.ts +1 -0
  40. package/dist/index.js +2 -1
  41. package/dist/panda.buildinfo.json +55 -30
  42. package/dist/store.cjs +63 -20
  43. package/dist/store.js +65 -22
  44. package/dist/types.d.cts +52 -6
  45. package/dist/types.d.ts +52 -6
  46. package/dist/utils.cjs +23 -0
  47. package/dist/utils.d.cts +2 -1
  48. package/dist/utils.d.ts +2 -1
  49. package/dist/utils.js +24 -2
  50. package/package.json +6 -6
package/dist/store.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { DEFAULT_THEME } from "./const.js";
3
- import { determineInitialCount, determinePageIndex, determinePageRange, determinePageSize, determineRowHeight } from "./utils.js";
2
+ import { DEFAULT_THEME, OPERATORS } from "./const.js";
3
+ import { applyFilterOperator, determineInitialCount, determinePageIndex, determinePageRange, determinePageSize, determineRowHeight } from "./utils.js";
4
4
  import { batch, createComputed, createSignal } from "@cerberus-design/signals";
5
5
  //#region src/store.ts
6
6
  /**
@@ -11,7 +11,18 @@ function createGridStore(options) {
11
11
  const [containerWidth, setContainerWidth] = createSignal(0);
12
12
  const [rows, setRows] = createSignal(options.data);
13
13
  const [rowSize] = createSignal(determineRowHeight(options.rowSize));
14
- const [globalFilter, setGlobalFilter] = createSignal("");
14
+ const [pending, setPending] = createSignal(options.pending ?? false);
15
+ const [hasSkeleton] = createSignal(options.overlays?.pending === "skeleton");
16
+ const [showColFilter, setShowColFilter] = createSignal(false);
17
+ const [globalFilter, setGlobalFilter] = createSignal({
18
+ operator: OPERATORS.contains,
19
+ value: null
20
+ });
21
+ const [colFilters, setColFilters] = createSignal({
22
+ active: [],
23
+ filters: {},
24
+ editing: null
25
+ });
15
26
  const [sorting, setSorting] = createSignal([]);
16
27
  const [pageIndex, setPageIndex] = createSignal(determinePageIndex(options.initialState?.pagination));
17
28
  const [pageSize, setPageSize] = createSignal(determinePageSize(options.initialState?.pagination));
@@ -52,17 +63,33 @@ function createGridStore(options) {
52
63
  end: pageIndex() * pageSize()
53
64
  };
54
65
  });
55
- const processedRows = createComputed(() => {
66
+ const filteredRows = createComputed(() => {
56
67
  let result = [...rows()];
57
- const filter = globalFilter().toLowerCase();
58
- const sortState = sorting();
59
- if (filter) result = result.filter((row) => {
68
+ const gFilter = globalFilter();
69
+ const cFilters = colFilters();
70
+ if (cFilters.active.length > 0) result = result.filter((row) => {
71
+ return cFilters.active.every((filterId) => {
72
+ const col = columns().find((c) => c.id === filterId);
73
+ const filter = cFilters.filters[filterId];
74
+ if (!col || !col.filterable) return true;
75
+ const customFn = typeof col.original.features?.filter === "function" ? col.original.features.filter : void 0;
76
+ if (customFn) return customFn(row, col.id, filter.value);
77
+ return applyFilterOperator(col.getValue(row), filter.value, filter.operator);
78
+ });
79
+ });
80
+ if (gFilter.value) result = result.filter((row) => {
60
81
  return columns().some((col) => {
61
82
  if (!col.filterable) return false;
62
- return String(col.getValue(row)).toLowerCase().includes(filter);
83
+ return applyFilterOperator(col.getValue(row), gFilter.value, gFilter.operator);
63
84
  });
64
85
  });
65
- if (sortState.length > 0) result.sort((a, b) => {
86
+ return result;
87
+ });
88
+ const sortedRows = createComputed(() => {
89
+ const currentRows = [...filteredRows()];
90
+ const sortState = sorting();
91
+ if (sortState.length === 0) return currentRows;
92
+ return currentRows.sort((a, b) => {
66
93
  for (const sort of sortState) {
67
94
  const col = columns().find((c) => c.id === sort.id);
68
95
  if (!col) continue;
@@ -77,9 +104,10 @@ function createGridStore(options) {
77
104
  }
78
105
  return 0;
79
106
  });
80
- return result;
81
107
  });
82
- const rowCount = createComputed(() => determineInitialCount(options?.initialState?.pagination) ?? processedRows().length);
108
+ const rowCount = createComputed(() => {
109
+ return determineInitialCount(options?.initialState?.pagination) ?? sortedRows().length;
110
+ });
83
111
  const pageCount = createComputed(() => Math.ceil(rowCount() / pageSize()));
84
112
  const orderedColumns = createComputed(() => {
85
113
  const left = [];
@@ -97,18 +125,24 @@ function createGridStore(options) {
97
125
  ...right
98
126
  ];
99
127
  });
100
- const visibleRows = createComputed(() => {
101
- if (pageSize() && pageCount() > 1) {
102
- const currentRange = currentPageRange();
103
- return processedRows().slice(currentRange.start, currentRange.end);
104
- }
105
- return processedRows();
106
- });
107
128
  return {
108
129
  columns,
109
130
  rows,
131
+ rowCount,
132
+ rowSize,
133
+ visibleRows: createComputed(() => {
134
+ if (pageSize() && pageCount() > 1) {
135
+ const currentRange = currentPageRange();
136
+ return sortedRows().slice(currentRange.start, currentRange.end);
137
+ }
138
+ return sortedRows();
139
+ }),
140
+ showColFilter,
110
141
  globalFilter,
142
+ colFilters,
111
143
  sorting,
144
+ pending,
145
+ hasSkeleton,
112
146
  pageCount,
113
147
  pageIndex,
114
148
  pageSize,
@@ -174,13 +208,13 @@ function createGridStore(options) {
174
208
  vars["--grid-cell-pinned-border-color"] = theme.gridCellPinnedBorderColor;
175
209
  return vars;
176
210
  }),
177
- rowCount,
178
- rowSize,
179
211
  totalWidth: createComputed(() => columns().reduce((acc, c) => acc + c.width(), 0)),
180
- visibleRows,
181
212
  updateData: (newData) => {
182
213
  setRows(newData);
183
214
  },
215
+ updatePending: (newState) => {
216
+ setPending(newState);
217
+ },
184
218
  setSort: (colId, direction, multi = false) => {
185
219
  if (direction === null) {
186
220
  setSorting(sorting().filter((s) => s.id !== colId));
@@ -233,10 +267,19 @@ function createGridStore(options) {
233
267
  },
234
268
  setGlobalFilter: (val) => {
235
269
  batch(() => {
236
- setGlobalFilter(val);
270
+ setGlobalFilter((prev) => ({
271
+ ...prev,
272
+ ...val
273
+ }));
237
274
  setPageIndex(1);
238
275
  });
239
276
  },
277
+ setColFilter: (val) => {
278
+ setColFilters(val);
279
+ },
280
+ setShowColFilter: (val) => {
281
+ setShowColFilter(val);
282
+ },
240
283
  setContainerWidth: (w) => {
241
284
  setContainerWidth(w);
242
285
  },
package/dist/types.d.cts CHANGED
@@ -21,10 +21,18 @@ export interface GridOptions<TData> {
21
21
  * Called when a user clicks on a pagination page trigger.
22
22
  */
23
23
  onPageChange?: (details: PageDetails) => void;
24
+ /**
25
+ * When set to true, renders the `overlays.loading` component.
26
+ */
27
+ pending?: boolean;
24
28
  /**
25
29
  * Content to display above the Data Grid and within the Grid context.
26
30
  */
27
31
  toolbar?: ReactNode;
32
+ /**
33
+ * Content to within the Data Grid and within the Grid context.
34
+ */
35
+ overlays?: OverlaySlots;
28
36
  /**
29
37
  * Content to display below the Data Grid and within the Grid context.
30
38
  */
@@ -140,8 +148,12 @@ export type SortState = {
140
148
  export interface GridStore<TData> {
141
149
  columns: Accessor<InternalColumn<TData>[]>;
142
150
  rows: Accessor<TData[]>;
143
- globalFilter: Accessor<string>;
151
+ pending: Accessor<boolean>;
152
+ showColFilter: Accessor<boolean>;
153
+ globalFilter: Accessor<BaseFilterState>;
154
+ colFilters: Accessor<ColumnFilterState>;
144
155
  sorting: Accessor<SortState[]>;
156
+ visibleRows: Accessor<TData[]>;
145
157
  pageIndex: Accessor<number>;
146
158
  pageSize: Accessor<number>;
147
159
  pageRange: Accessor<number[]>;
@@ -151,20 +163,23 @@ export interface GridStore<TData> {
151
163
  end: number;
152
164
  }>;
153
165
  isServerPaginated: Accessor<boolean>;
166
+ hasSkeleton: Accessor<boolean>;
154
167
  rootCssVars: Accessor<Record<string, string>>;
155
168
  rowCount: Accessor<number>;
156
169
  rowSize: Accessor<number>;
157
170
  totalWidth: Accessor<number>;
158
- visibleRows: Accessor<TData[]>;
159
171
  resizeColumn: (colId: string, delta: number) => void;
160
172
  setContainerWidth: (val: number) => void;
161
173
  setPage: (details: PageDetails) => void;
162
174
  setPageSize: (size: number) => void;
163
- setGlobalFilter: (val: string) => void;
175
+ setGlobalFilter: (val: BaseFilterState) => void;
176
+ setColFilter: Setter<ColumnFilterState>;
177
+ setShowColFilter: (val: boolean) => void;
164
178
  setSort: (colId: string, direction: SortDirection, multi?: boolean) => void;
165
179
  togglePinned: (colId: string, state: PinnedState) => void;
166
180
  toggleSort: (colId: string, multi?: boolean) => void;
167
181
  updateData: (newData: TData[]) => void;
182
+ updatePending: (newState: boolean) => void;
168
183
  }
169
184
  export type RowSizeOptions = RowSize | number;
170
185
  export type ColumnFeatures<TData, TKey extends keyof TData> = {
@@ -175,9 +190,7 @@ export type ColumnFeatures<TData, TKey extends keyof TData> = {
175
190
  /**
176
191
  * Allow the column to be filtered and the rules to use.
177
192
  */
178
- filter?: boolean | {
179
- operator?: 'contains' | 'equals' | 'startsWith';
180
- };
193
+ filter?: boolean | FilterFn<TData>;
181
194
  /**
182
195
  * Show pinning options in the column menu
183
196
  */
@@ -200,6 +213,39 @@ export type AccessorFn<TData> = (row: TData) => ReactNode;
200
213
  export type Comparator<TValue> = (a: TValue, b: TValue) => number;
201
214
  export type SortDirection = 'asc' | 'desc' | null;
202
215
  export type PinnedState = 'left' | 'right' | undefined | boolean;
216
+ export type LoadingVariant = 'skeleton' | 'linear' | 'circular' | ReactNode;
217
+ export type FilterFn<TData> = (row: TData, columnId: string, filterValue: unknown) => boolean;
218
+ export type FilterOperator = 'contains' | 'equals' | 'starts_with' | 'ends_with' | 'greater_than' | 'less_than' | 'between' | 'includes_some';
219
+ export type BaseFilterState = {
220
+ /**
221
+ * The preferred operator to use for filtering the data.
222
+ */
223
+ operator: FilterOperator;
224
+ value: unknown;
225
+ };
226
+ export type ColumnFilter = BaseFilterState & {
227
+ /**
228
+ * The column.id the filter is meant to be applied to.
229
+ */
230
+ id: string;
231
+ };
232
+ export type ColumnFilterState = {
233
+ active: string[];
234
+ filters: Record<string, ColumnFilter>;
235
+ editing: string | null;
236
+ };
237
+ export type OverlaySlots = {
238
+ /**
239
+ * A custom component to display within the Grid Viewport when no rows are
240
+ * present in the data or filtered out. Defaults to a basic fallback.
241
+ */
242
+ noContent?: ReactNode;
243
+ /**
244
+ * A custom component to display within the Grid Viewport when the `pending`
245
+ * prop is set to true.
246
+ */
247
+ pending?: LoadingVariant;
248
+ };
203
249
  export type ThemeOptions = {
204
250
  /**
205
251
  * The external border of the Data Grid container.
package/dist/types.d.ts CHANGED
@@ -21,10 +21,18 @@ export interface GridOptions<TData> {
21
21
  * Called when a user clicks on a pagination page trigger.
22
22
  */
23
23
  onPageChange?: (details: PageDetails) => void;
24
+ /**
25
+ * When set to true, renders the `overlays.loading` component.
26
+ */
27
+ pending?: boolean;
24
28
  /**
25
29
  * Content to display above the Data Grid and within the Grid context.
26
30
  */
27
31
  toolbar?: ReactNode;
32
+ /**
33
+ * Content to within the Data Grid and within the Grid context.
34
+ */
35
+ overlays?: OverlaySlots;
28
36
  /**
29
37
  * Content to display below the Data Grid and within the Grid context.
30
38
  */
@@ -140,8 +148,12 @@ export type SortState = {
140
148
  export interface GridStore<TData> {
141
149
  columns: Accessor<InternalColumn<TData>[]>;
142
150
  rows: Accessor<TData[]>;
143
- globalFilter: Accessor<string>;
151
+ pending: Accessor<boolean>;
152
+ showColFilter: Accessor<boolean>;
153
+ globalFilter: Accessor<BaseFilterState>;
154
+ colFilters: Accessor<ColumnFilterState>;
144
155
  sorting: Accessor<SortState[]>;
156
+ visibleRows: Accessor<TData[]>;
145
157
  pageIndex: Accessor<number>;
146
158
  pageSize: Accessor<number>;
147
159
  pageRange: Accessor<number[]>;
@@ -151,20 +163,23 @@ export interface GridStore<TData> {
151
163
  end: number;
152
164
  }>;
153
165
  isServerPaginated: Accessor<boolean>;
166
+ hasSkeleton: Accessor<boolean>;
154
167
  rootCssVars: Accessor<Record<string, string>>;
155
168
  rowCount: Accessor<number>;
156
169
  rowSize: Accessor<number>;
157
170
  totalWidth: Accessor<number>;
158
- visibleRows: Accessor<TData[]>;
159
171
  resizeColumn: (colId: string, delta: number) => void;
160
172
  setContainerWidth: (val: number) => void;
161
173
  setPage: (details: PageDetails) => void;
162
174
  setPageSize: (size: number) => void;
163
- setGlobalFilter: (val: string) => void;
175
+ setGlobalFilter: (val: BaseFilterState) => void;
176
+ setColFilter: Setter<ColumnFilterState>;
177
+ setShowColFilter: (val: boolean) => void;
164
178
  setSort: (colId: string, direction: SortDirection, multi?: boolean) => void;
165
179
  togglePinned: (colId: string, state: PinnedState) => void;
166
180
  toggleSort: (colId: string, multi?: boolean) => void;
167
181
  updateData: (newData: TData[]) => void;
182
+ updatePending: (newState: boolean) => void;
168
183
  }
169
184
  export type RowSizeOptions = RowSize | number;
170
185
  export type ColumnFeatures<TData, TKey extends keyof TData> = {
@@ -175,9 +190,7 @@ export type ColumnFeatures<TData, TKey extends keyof TData> = {
175
190
  /**
176
191
  * Allow the column to be filtered and the rules to use.
177
192
  */
178
- filter?: boolean | {
179
- operator?: 'contains' | 'equals' | 'startsWith';
180
- };
193
+ filter?: boolean | FilterFn<TData>;
181
194
  /**
182
195
  * Show pinning options in the column menu
183
196
  */
@@ -200,6 +213,39 @@ export type AccessorFn<TData> = (row: TData) => ReactNode;
200
213
  export type Comparator<TValue> = (a: TValue, b: TValue) => number;
201
214
  export type SortDirection = 'asc' | 'desc' | null;
202
215
  export type PinnedState = 'left' | 'right' | undefined | boolean;
216
+ export type LoadingVariant = 'skeleton' | 'linear' | 'circular' | ReactNode;
217
+ export type FilterFn<TData> = (row: TData, columnId: string, filterValue: unknown) => boolean;
218
+ export type FilterOperator = 'contains' | 'equals' | 'starts_with' | 'ends_with' | 'greater_than' | 'less_than' | 'between' | 'includes_some';
219
+ export type BaseFilterState = {
220
+ /**
221
+ * The preferred operator to use for filtering the data.
222
+ */
223
+ operator: FilterOperator;
224
+ value: unknown;
225
+ };
226
+ export type ColumnFilter = BaseFilterState & {
227
+ /**
228
+ * The column.id the filter is meant to be applied to.
229
+ */
230
+ id: string;
231
+ };
232
+ export type ColumnFilterState = {
233
+ active: string[];
234
+ filters: Record<string, ColumnFilter>;
235
+ editing: string | null;
236
+ };
237
+ export type OverlaySlots = {
238
+ /**
239
+ * A custom component to display within the Grid Viewport when no rows are
240
+ * present in the data or filtered out. Defaults to a basic fallback.
241
+ */
242
+ noContent?: ReactNode;
243
+ /**
244
+ * A custom component to display within the Grid Viewport when the `pending`
245
+ * prop is set to true.
246
+ */
247
+ pending?: LoadingVariant;
248
+ };
203
249
  export type ThemeOptions = {
204
250
  /**
205
251
  * The external border of the Data Grid container.
package/dist/utils.cjs CHANGED
@@ -29,7 +29,30 @@ function determineInitialCount(options) {
29
29
  if (typeof options === "boolean" && options === true) return;
30
30
  return options?.count ?? void 0;
31
31
  }
32
+ function applyFilterOperator(cellValue, filterValue, operator = require_const.OPERATORS.contains) {
33
+ if (filterValue === void 0 || filterValue === null || filterValue === "") return true;
34
+ if (cellValue === void 0 || cellValue === null) return false;
35
+ const cellStr = String(cellValue).toLowerCase();
36
+ const filterStr = String(filterValue).toLowerCase();
37
+ switch (operator) {
38
+ case require_const.OPERATORS.contains: return cellStr.includes(filterStr);
39
+ case require_const.OPERATORS.equals: return cellValue == filterValue || cellStr === filterStr;
40
+ case require_const.OPERATORS.starts_with: return cellStr.startsWith(filterStr);
41
+ case require_const.OPERATORS.ends_with: return cellStr.endsWith(filterStr);
42
+ case require_const.OPERATORS.greater_than: return Number(cellValue) > Number(filterValue);
43
+ case require_const.OPERATORS.less_than: return Number(cellValue) < Number(filterValue);
44
+ case require_const.OPERATORS.between:
45
+ if (!Array.isArray(filterValue)) return false;
46
+ const val = Number(cellValue);
47
+ return val >= Number(filterValue[0]) && val <= Number(filterValue[1]);
48
+ case require_const.OPERATORS.includes_some:
49
+ if (!Array.isArray(filterValue)) return false;
50
+ return filterValue.includes(cellValue);
51
+ default: return true;
52
+ }
53
+ }
32
54
  //#endregion
55
+ exports.applyFilterOperator = applyFilterOperator;
33
56
  exports.determineInitialCount = determineInitialCount;
34
57
  exports.determinePageIndex = determinePageIndex;
35
58
  exports.determinePageRange = determinePageRange;
package/dist/utils.d.cts CHANGED
@@ -1,6 +1,7 @@
1
- import { PaginationOptions, RowSizeOptions } from './types';
1
+ import { FilterOperator, PaginationOptions, RowSizeOptions } from './types';
2
2
  export declare function determineRowHeight(rowSize?: RowSizeOptions): number;
3
3
  export declare function determinePageSize(options?: boolean | PaginationOptions): number;
4
4
  export declare function determinePageIndex(options?: boolean | PaginationOptions): number;
5
5
  export declare function determinePageRange(options?: boolean | PaginationOptions): number[];
6
6
  export declare function determineInitialCount(options?: boolean | PaginationOptions): number | undefined;
7
+ export declare function applyFilterOperator(cellValue: unknown, filterValue: unknown, operator?: FilterOperator): boolean;
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { PaginationOptions, RowSizeOptions } from './types';
1
+ import { FilterOperator, PaginationOptions, RowSizeOptions } from './types';
2
2
  export declare function determineRowHeight(rowSize?: RowSizeOptions): number;
3
3
  export declare function determinePageSize(options?: boolean | PaginationOptions): number;
4
4
  export declare function determinePageIndex(options?: boolean | PaginationOptions): number;
5
5
  export declare function determinePageRange(options?: boolean | PaginationOptions): number[];
6
6
  export declare function determineInitialCount(options?: boolean | PaginationOptions): number | undefined;
7
+ export declare function applyFilterOperator(cellValue: unknown, filterValue: unknown, operator?: FilterOperator): boolean;
package/dist/utils.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { DEFAULT_PAGE_SIZES, ROW_SIZES } from "./const.js";
2
+ import { DEFAULT_PAGE_SIZES, OPERATORS, ROW_SIZES } from "./const.js";
3
3
  //#region src/utils.ts
4
4
  function determineRowHeight(rowSize = "sm") {
5
5
  const prebuiltSizes = ROW_SIZES.items;
@@ -29,5 +29,27 @@ function determineInitialCount(options) {
29
29
  if (typeof options === "boolean" && options === true) return;
30
30
  return options?.count ?? void 0;
31
31
  }
32
+ function applyFilterOperator(cellValue, filterValue, operator = OPERATORS.contains) {
33
+ if (filterValue === void 0 || filterValue === null || filterValue === "") return true;
34
+ if (cellValue === void 0 || cellValue === null) return false;
35
+ const cellStr = String(cellValue).toLowerCase();
36
+ const filterStr = String(filterValue).toLowerCase();
37
+ switch (operator) {
38
+ case OPERATORS.contains: return cellStr.includes(filterStr);
39
+ case OPERATORS.equals: return cellValue == filterValue || cellStr === filterStr;
40
+ case OPERATORS.starts_with: return cellStr.startsWith(filterStr);
41
+ case OPERATORS.ends_with: return cellStr.endsWith(filterStr);
42
+ case OPERATORS.greater_than: return Number(cellValue) > Number(filterValue);
43
+ case OPERATORS.less_than: return Number(cellValue) < Number(filterValue);
44
+ case OPERATORS.between:
45
+ if (!Array.isArray(filterValue)) return false;
46
+ const val = Number(cellValue);
47
+ return val >= Number(filterValue[0]) && val <= Number(filterValue[1]);
48
+ case OPERATORS.includes_some:
49
+ if (!Array.isArray(filterValue)) return false;
50
+ return filterValue.includes(cellValue);
51
+ default: return true;
52
+ }
53
+ }
32
54
  //#endregion
33
- export { determineInitialCount, determinePageIndex, determinePageRange, determinePageSize, determineRowHeight };
55
+ export { applyFilterOperator, determineInitialCount, determinePageIndex, determinePageRange, determinePageSize, determineRowHeight };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cerberus-design/data-grid",
3
- "version": "1.1.2",
3
+ "version": "1.2.0-rc.1",
4
4
  "description": "The Cerberus Design React DataGrid component.",
5
5
  "keywords": [
6
6
  "data grid",
@@ -27,20 +27,20 @@
27
27
  "access": "public"
28
28
  },
29
29
  "dependencies": {
30
- "@cerberus-design/react": "1.1.2",
31
- "@cerberus-design/signals": "1.1.2"
30
+ "@cerberus-design/react": "1.2.0-rc.1",
31
+ "@cerberus-design/signals": "1.2.0-rc.1"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@pandacss/dev": "^1.9.1",
35
35
  "@types/react": "^19.2.14",
36
36
  "@types/react-dom": "^19.2.3",
37
37
  "@vitejs/plugin-react": "^6.0.1",
38
- "globby": "^16.1.1",
38
+ "globby": "^16.2.0",
39
39
  "react": "^19.2.4",
40
40
  "react-dom": "^19.2.4",
41
- "vite": "^8.0.2",
41
+ "vite": "^8.0.8",
42
42
  "vite-plugin-dts": "^4.5.4",
43
- "@cerberus/panda-preset": "1.1.2",
43
+ "@cerberus/panda-preset": "1.2.0-rc.1",
44
44
  "styled-system": "0.0.0"
45
45
  },
46
46
  "peerDependencies": {