@krak-stack/registry 0.1.55 → 0.1.57

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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # @krak-stack/registry
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Patch Changes
6
+
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
+
9
+ ## 0.1.57
10
+
11
+ ### Patch Changes
12
+
13
+ - 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.
14
+
15
+ 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.
16
+
17
+ 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.
18
+
19
+ - 4d7f3c2: Use Effect CSV for DataTable downloads, including correct escaping of carriage returns and empty single-column records.
20
+
21
+ ## 0.1.56
22
+
23
+ ### Patch Changes
24
+
25
+ - Upgrade to Effect 4.1.0 and use Effect crypto services for UUIDv7 entity IDs, hashing, and secure capability generation. Preserve existing deterministic fingerprints and random upload capability tokens.
26
+ - d3000ed: Use exact matching for documentation sidebar links so Introduction is only highlighted on its own page.
27
+
3
28
  ## 0.1.55
4
29
 
5
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 { QueryType } from "../../lib/query.js";
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
- /** Both scopes operate only on rows already supplied to the table. */
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[];