@krak-stack/registry 0.1.56 → 0.1.58
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/CHANGELOG.md +19 -0
- package/dist/components/ui/data-table.d.ts +85 -2
- package/dist/components/ui/data-table.js +1407 -622
- package/dist/lib/query.d.ts +216 -0
- package/dist/lib/query.js +50 -2
- package/dist/services/events/browser.js +54 -1
- package/dist/services/events/client/audit-log-table.js +1444 -677
- package/dist/services/events/index.d.ts +48 -0
- package/dist/services/events/index.js +93 -10
- package/dist/services/events/schema.d.ts +218 -0
- package/dist/services/events/schema.js +56 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,25 @@
|
|
|
6
6
|
|
|
7
7
|
- Merge the error component's homepage link classes with `cn` so its outline border is visible instead of being overridden by the base transparent border.
|
|
8
8
|
|
|
9
|
+
## 0.1.58
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Replace the audit table's custom Action menu with the shared Action multi-select filter, populated from the application's full localized action catalog. Preserve legacy eventName links and migrate edits to shared filter state. Execute action, UTC date-range, actor/target text, and method filters on the server before pagination, sharing the same service-, organization-, and category-scoped predicate with the total count. Validate supported field/kind combinations and method values, and escape literal text searches.
|
|
14
|
+
- Give the data table View menu a localized heading and separator, matching the other toolbar menus.
|
|
15
|
+
|
|
16
|
+
## 0.1.57
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Add logical `fields` to data-table columns for independent search, sorting, filtering, and separate CSV/JSON fields while keeping combined cells. Built-in exports default to all filtered, sorted loaded rows; use `scope: "currentPage"` for the current page.
|
|
21
|
+
|
|
22
|
+
Add typed column filters with text operators, numeric/UTC date ranges, boolean choices, and multi-select values. Share filter state between toolbar and column headers, including logical-field submenus, active indicators, and scoped clearing. Preserve validated filters in router, JSON, and HTTP query state. Server pagination and fetching unloaded exports remain application-owned.
|
|
23
|
+
|
|
24
|
+
Support stable `filterValueGetter` values, searchable option lists, application-owned count badges, and wider filter menus. Put Selected bulk actions first in the menubar and give Sort by and Filters consistent popup headings and separators.
|
|
25
|
+
|
|
26
|
+
- 4d7f3c2: Use Effect CSV for DataTable downloads, including correct escaping of carriage returns and empty single-column records.
|
|
27
|
+
|
|
9
28
|
## 0.1.56
|
|
10
29
|
|
|
11
30
|
### Patch Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import { type PaginationMessages } from "./pagination.js";
|
|
3
|
-
import type
|
|
3
|
+
import { ColumnFilter, type QueryType } from "../../lib/query.js";
|
|
4
4
|
type RowData = object;
|
|
5
5
|
export type DataTableView = "table" | "gallery";
|
|
6
6
|
export type DataTablePublicState = QueryType;
|
|
@@ -171,16 +171,40 @@ type DataTableColumnType<TData> = {
|
|
|
171
171
|
typeOptions: DataTableListColumn<TData>;
|
|
172
172
|
};
|
|
173
173
|
export type DataTableColDef<TData extends RowData> = DataTableBaseColDef<TData> & DataTableColumnType<TData>;
|
|
174
|
+
/** A logical field within one visual column. IDs are local to the parent column. */
|
|
175
|
+
export type DataTableColumnField<TData extends RowData> = Pick<DataTableBaseColDef<TData>, "headerName" | "comparator" | "sortable" | "searchable" | "filterable" | "filterOptions" | "filterValueGetter"> & {
|
|
176
|
+
id: string;
|
|
177
|
+
valueGetter: NonNullable<DataTableBaseColDef<TData>["valueGetter"]>;
|
|
178
|
+
/** Exclude a field from export without removing it from search or sorting. */
|
|
179
|
+
export?: boolean;
|
|
180
|
+
} & DataTableColumnType<TData>;
|
|
181
|
+
export interface DataTableFilterOption {
|
|
182
|
+
value: string;
|
|
183
|
+
label: string;
|
|
184
|
+
/** Optional application-owned count (for example, actionable requests). */
|
|
185
|
+
count?: number;
|
|
186
|
+
}
|
|
174
187
|
export interface DataTableBaseColDef<TData extends RowData> {
|
|
175
188
|
field?: keyof TData & string;
|
|
176
189
|
colId?: string;
|
|
177
190
|
headerName: ReactNode;
|
|
178
191
|
valueGetter?: (params: DataTableValueGetterParams<TData>) => unknown;
|
|
192
|
+
/** Independently searchable, sortable, and exported values; display stays combined.
|
|
193
|
+
* Sort state and JSON exports use stable IDs such as `learner.email`.
|
|
194
|
+
* Hiding the visual column also hides its fields from export.
|
|
195
|
+
*/
|
|
196
|
+
fields?: readonly DataTableColumnField<TData>[];
|
|
179
197
|
valueFormatter?: (params: DataTableCellRendererParams<TData>) => ReactNode;
|
|
180
198
|
cellRenderer?: (params: DataTableCellRendererParams<TData>) => ReactNode;
|
|
181
199
|
sortable?: boolean;
|
|
182
200
|
comparator?: (left: unknown, right: unknown, leftData: TData, rightData: TData) => number;
|
|
183
201
|
searchable?: boolean;
|
|
202
|
+
/** Typed filters are inferred from the column type. Parent false disables all fields. */
|
|
203
|
+
filterable?: boolean;
|
|
204
|
+
/** Offer a multi-select filter instead of free text; values match the model value. */
|
|
205
|
+
filterOptions?: readonly DataTableFilterOption[];
|
|
206
|
+
/** A stable scalar value for filtering, independent of display/search/export. */
|
|
207
|
+
filterValueGetter?: DataTableBaseColDef<TData>["valueGetter"];
|
|
184
208
|
hideable?: boolean;
|
|
185
209
|
resizable?: boolean;
|
|
186
210
|
width?: number;
|
|
@@ -238,7 +262,7 @@ export interface DataTableExportAction {
|
|
|
238
262
|
}
|
|
239
263
|
export interface DataTableExportFeature {
|
|
240
264
|
baseName: string;
|
|
241
|
-
/**
|
|
265
|
+
/** Defaults to all filtered, sorted rows. Both scopes use only loaded rows. */
|
|
242
266
|
scope?: "currentPage" | "filteredRows";
|
|
243
267
|
/** Set false to offer only app-provided actions. Defaults to true. */
|
|
244
268
|
builtIn?: boolean;
|
|
@@ -251,6 +275,7 @@ export interface DataTableFeatures<TData> {
|
|
|
251
275
|
items: ReactNode;
|
|
252
276
|
};
|
|
253
277
|
search?: boolean;
|
|
278
|
+
filtering?: boolean;
|
|
254
279
|
sorting?: boolean;
|
|
255
280
|
pagination?: DataTablePaginationFeature;
|
|
256
281
|
columnVisibility?: boolean;
|
|
@@ -288,6 +313,23 @@ export type DataTableMessages = PaginationMessages & {
|
|
|
288
313
|
empty: string;
|
|
289
314
|
loading: string;
|
|
290
315
|
filter: string;
|
|
316
|
+
filters: string;
|
|
317
|
+
filtersClear: string;
|
|
318
|
+
filterClear: string;
|
|
319
|
+
filterApply: string;
|
|
320
|
+
filterValue: string;
|
|
321
|
+
filterOperator: string;
|
|
322
|
+
filterContains: string;
|
|
323
|
+
filterEquals: string;
|
|
324
|
+
filterStartsWith: string;
|
|
325
|
+
filterEndsWith: string;
|
|
326
|
+
filterMin: string;
|
|
327
|
+
filterMax: string;
|
|
328
|
+
filterFrom: string;
|
|
329
|
+
filterTo: string;
|
|
330
|
+
filterTrue: string;
|
|
331
|
+
filterFalse: string;
|
|
332
|
+
filterInvalid: string;
|
|
291
333
|
export: string;
|
|
292
334
|
exportCsv: string;
|
|
293
335
|
exportJson: string;
|
|
@@ -329,6 +371,23 @@ export declare const dataTableMessages: (locale?: string, translations?: DataTab
|
|
|
329
371
|
empty: string;
|
|
330
372
|
loading: string;
|
|
331
373
|
filter: string;
|
|
374
|
+
filters: string;
|
|
375
|
+
filtersClear: string;
|
|
376
|
+
filterClear: string;
|
|
377
|
+
filterApply: string;
|
|
378
|
+
filterValue: string;
|
|
379
|
+
filterOperator: string;
|
|
380
|
+
filterContains: string;
|
|
381
|
+
filterEquals: string;
|
|
382
|
+
filterStartsWith: string;
|
|
383
|
+
filterEndsWith: string;
|
|
384
|
+
filterMin: string;
|
|
385
|
+
filterMax: string;
|
|
386
|
+
filterFrom: string;
|
|
387
|
+
filterTo: string;
|
|
388
|
+
filterTrue: string;
|
|
389
|
+
filterFalse: string;
|
|
390
|
+
filterInvalid: string;
|
|
332
391
|
export: string;
|
|
333
392
|
exportCsv: string;
|
|
334
393
|
exportJson: string;
|
|
@@ -367,6 +426,23 @@ export declare const dataTableMessages: (locale?: string, translations?: DataTab
|
|
|
367
426
|
empty: string;
|
|
368
427
|
loading: string;
|
|
369
428
|
filter: string;
|
|
429
|
+
filters: string;
|
|
430
|
+
filtersClear: string;
|
|
431
|
+
filterClear: string;
|
|
432
|
+
filterApply: string;
|
|
433
|
+
filterValue: string;
|
|
434
|
+
filterOperator: string;
|
|
435
|
+
filterContains: string;
|
|
436
|
+
filterEquals: string;
|
|
437
|
+
filterStartsWith: string;
|
|
438
|
+
filterEndsWith: string;
|
|
439
|
+
filterMin: string;
|
|
440
|
+
filterMax: string;
|
|
441
|
+
filterFrom: string;
|
|
442
|
+
filterTo: string;
|
|
443
|
+
filterTrue: string;
|
|
444
|
+
filterFalse: string;
|
|
445
|
+
filterInvalid: string;
|
|
370
446
|
export: string;
|
|
371
447
|
exportCsv: string;
|
|
372
448
|
exportJson: string;
|
|
@@ -430,10 +506,17 @@ export interface DataTableModel<TData extends RowData> {
|
|
|
430
506
|
totalRows: number;
|
|
431
507
|
}
|
|
432
508
|
export declare const normalizeDataTableColumns: <TData extends RowData>(columnDefs: readonly DataTableColDef<TData>[], columnSizing?: Readonly<Record<string, number>>) => DataTableColumn<TData>[];
|
|
509
|
+
/** Resolve logical sort targets without adding visual columns. */
|
|
510
|
+
export declare const getDataTableSortColumns: <TData extends RowData>(columns: readonly DataTableColumn<TData>[]) => DataTableColumn<TData>[];
|
|
511
|
+
/** Expand only visible columns, retaining field labels and typed export formats. */
|
|
512
|
+
export declare const getDataTableExportColumns: <TData extends RowData>(visibleColumns: readonly DataTableColumn<TData>[]) => DataTableColumn<TData>[];
|
|
433
513
|
export declare const getDataTableWidth: <TData extends RowData>(columns: readonly DataTableColumn<TData>[], utilityColumns?: number) => number;
|
|
434
514
|
export declare const buildDataTableRows: <TData extends RowData>(rowData: readonly TData[], columns: readonly DataTableColumn<TData>[], getRowId?: (row: TData) => string) => DataTableModelRow<TData>[];
|
|
435
515
|
export declare const getDataTableExportValue: <TData extends RowData>(row: DataTableModelRow<TData>, column: DataTableColumn<TData>, locale?: string) => unknown;
|
|
436
516
|
export declare const filterDataTableRows: <TData extends RowData>(rows: readonly DataTableModelRow<TData>[], columns: readonly DataTableColumn<TData>[], globalFilter: string, locale?: string) => DataTableModelRow<TData>[];
|
|
517
|
+
export declare const getDataTableFilterColumns: <TData extends RowData>(columns: readonly DataTableColumn<TData>[]) => DataTableColumn<TData>[];
|
|
518
|
+
/** AND across columns, OR within a multi-select filter. Unknown/stale IDs are ignored. */
|
|
519
|
+
export declare const filterDataTableColumnRows: <TData extends RowData>(rows: readonly DataTableModelRow<TData>[], columns: readonly DataTableColumn<TData>[], filters: readonly ColumnFilter[]) => DataTableModelRow<TData>[];
|
|
437
520
|
export declare const sortDataTableRows: <TData extends RowData>(rows: readonly DataTableModelRow<TData>[], columns: readonly DataTableColumn<TData>[], sorting: NonNullable<QueryType["sort"]>) => DataTableModelRow<TData>[];
|
|
438
521
|
export declare const paginateDataTableRows: <TData extends RowData>(rows: readonly DataTableModelRow<TData>[], pagination: Pick<QueryType, "page" | "pageSize">) => DataTableModelRow<TData>[];
|
|
439
522
|
export declare const reorderDataTableRows: <TData extends RowData>(rows: readonly DataTableModelRow<TData>[], sourceRowId: string, targetRowId: string) => TData[];
|