@zambon-dev/ui 1.12.2 → 1.13.0
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 +28 -1
- package/fesm2022/zambon-dev-ui-framework.mjs +2 -1
- package/fesm2022/zambon-dev-ui-framework.mjs.map +1 -1
- package/fesm2022/zambon-dev-ui-library.mjs +97 -7
- package/fesm2022/zambon-dev-ui-library.mjs.map +1 -1
- package/i18n/framework/en.json +1 -0
- package/i18n/framework/pt.json +1 -0
- package/package.json +1 -1
- package/types/zambon-dev-ui-library.d.ts +96 -0
package/i18n/framework/en.json
CHANGED
package/i18n/framework/pt.json
CHANGED
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"Grid-No": "Não",
|
|
60
60
|
"Grid-ResetColumns": "Restaurar colunas",
|
|
61
61
|
"Grid-ResizeColumn": "Redimensionar {{ column }}",
|
|
62
|
+
"Grid-Search": "Pesquisar",
|
|
62
63
|
"Grid-SelectAll": "Selecionar todas as linhas",
|
|
63
64
|
"Grid-SelectRow": "Selecionar linha",
|
|
64
65
|
"Grid-TotalRow": "{{ count }} registro",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zambon-dev/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "Angular 22 component library and application shell: form controls, a virtual-scroll data grid, modals, ribbon, sidebar, tabbed navigation, view base classes and authentication layouts, themed with Tailwind CSS 4 tokens.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -375,9 +375,28 @@ export type DataGridConfigs = GridConfigs & {
|
|
|
375
375
|
* to the grid. No default: without it nothing is saved.
|
|
376
376
|
*/
|
|
377
377
|
columnsStateKey?: string;
|
|
378
|
+
/**
|
|
379
|
+
* Makes the column headings sort buttons. A click sorts by the column, ascending, then descending,
|
|
380
|
+
* then no longer. The dataset sends the sort to `getData` as `sort: { [field]: 'asc' | 'desc' }`,
|
|
381
|
+
* and the API sorts. See `IGridColumn.sortable` and `sortField`. Defaults to `false`.
|
|
382
|
+
*/
|
|
383
|
+
sortable?: boolean;
|
|
384
|
+
/**
|
|
385
|
+
* Shows a search box above the grid. What the user types reaches `getData` as `search` once
|
|
386
|
+
* typing pauses, and the API matches it. Defaults to `false`.
|
|
387
|
+
*/
|
|
388
|
+
quickSearch?: boolean;
|
|
389
|
+
/**
|
|
390
|
+
* The search box's accessible name and placeholder, as a translation key or plain text. Defaults
|
|
391
|
+
* to `Search`.
|
|
392
|
+
*/
|
|
393
|
+
quickSearchText?: string;
|
|
378
394
|
};
|
|
379
395
|
export interface IListParameters extends ISummaryParameters {
|
|
380
396
|
endRow: number;
|
|
397
|
+
/** The quick search text, trimmed. Absent when the user searches for nothing. */
|
|
398
|
+
search?: string;
|
|
399
|
+
/** The sort, as `{ [field]: 'asc' | 'desc' }`. Absent when the grid is not sorted. */
|
|
381
400
|
sort?: {
|
|
382
401
|
[key: string]: string;
|
|
383
402
|
};
|
|
@@ -388,6 +407,14 @@ export interface ISummaryParameters {
|
|
|
388
407
|
[key: string]: string;
|
|
389
408
|
};
|
|
390
409
|
}
|
|
410
|
+
/** Which way a grid column sorts. */
|
|
411
|
+
export type GridSortDirection = 'asc' | 'desc';
|
|
412
|
+
/** The sort a grid asks its dataset for: one field and a direction. */
|
|
413
|
+
export interface IGridSort {
|
|
414
|
+
/** The field the API sorts by: the column's `sortField`, or its `field`. */
|
|
415
|
+
field: string;
|
|
416
|
+
direction: GridSortDirection;
|
|
417
|
+
}
|
|
391
418
|
/** How a grid column formats its values. See {@link IGridColumn.type}. */
|
|
392
419
|
export type GridColumnType = 'text' | 'number' | 'currency' | 'percent' | 'date' | 'datetime' | 'boolean' | 'enum' | 'badge' | 'actions';
|
|
393
420
|
/** Where a grid column places its cells and header. */
|
|
@@ -485,6 +512,18 @@ export interface IGridColumn {
|
|
|
485
512
|
* must always see, such as the record's name. Defaults to `true`, and to `false` for `actions`.
|
|
486
513
|
*/
|
|
487
514
|
hideable?: boolean;
|
|
515
|
+
/**
|
|
516
|
+
* Whether a click on the heading sorts by the column, in a grid whose `sortable` setting is on.
|
|
517
|
+
* Set `false` for a column the API cannot sort, such as one filled in after the query. Defaults
|
|
518
|
+
* to `true`, and to `false` for `actions`.
|
|
519
|
+
*/
|
|
520
|
+
sortable?: boolean;
|
|
521
|
+
/**
|
|
522
|
+
* The field name the API sorts by when the user sorts by this column. Defaults to `field` with its
|
|
523
|
+
* dot path flattened, as a flattened list model names it: `customer.name` sorts by `customerName`.
|
|
524
|
+
* Set it when the API names the field otherwise.
|
|
525
|
+
*/
|
|
526
|
+
sortField?: string;
|
|
488
527
|
}
|
|
489
528
|
/**
|
|
490
529
|
* What a grid with `columnsStateKey` keeps in `localStorage`: the fields of the hidden columns and
|
|
@@ -1008,12 +1047,22 @@ export declare abstract class GridDataset extends BaseDataset {
|
|
|
1008
1047
|
private _loadedKeys?;
|
|
1009
1048
|
private _loadedRows?;
|
|
1010
1049
|
private queryFilters?;
|
|
1050
|
+
private _sort;
|
|
1051
|
+
private _search;
|
|
1052
|
+
/** The load in flight, so a refresh can drop it and its answer never lands. */
|
|
1053
|
+
private loadSubscription?;
|
|
1054
|
+
/** Whether any load was asked for yet. A lazy grid has none until something loads it. */
|
|
1055
|
+
private loadRequested;
|
|
1011
1056
|
get isLoading(): boolean;
|
|
1012
1057
|
set isLoading(value: boolean);
|
|
1013
1058
|
get loadedLastRow(): boolean;
|
|
1014
1059
|
set loadedLastRow(value: boolean);
|
|
1015
1060
|
get totalRows(): number | undefined;
|
|
1016
1061
|
set totalRows(value: number | undefined);
|
|
1062
|
+
/** The sort the grid asks for, or `null` when it is not sorted. Change it with `setSort`. */
|
|
1063
|
+
get sort(): IGridSort | null;
|
|
1064
|
+
/** The quick search text, trimmed, or `''`. Change it with `setSearch`. */
|
|
1065
|
+
get search(): string;
|
|
1017
1066
|
get filters(): {
|
|
1018
1067
|
[key: string]: string;
|
|
1019
1068
|
} | undefined;
|
|
@@ -1052,11 +1101,26 @@ export declare abstract class GridDataset extends BaseDataset {
|
|
|
1052
1101
|
* `false` when the rows only leave the grid, such as a removal still to be saved.
|
|
1053
1102
|
*/
|
|
1054
1103
|
removeKeys(keys: string[], deletedFromSource?: boolean): void;
|
|
1104
|
+
/**
|
|
1105
|
+
* Sorts by one field, or clears the sort with `null`, and reloads from the first block. The API
|
|
1106
|
+
* receives it as `sort: { [field]: direction }`.
|
|
1107
|
+
*/
|
|
1108
|
+
setSort(sort: IGridSort | null): void;
|
|
1109
|
+
/**
|
|
1110
|
+
* Sets the quick search text and reloads from the first block. The text is trimmed. The API
|
|
1111
|
+
* receives it as `search`, and nothing when it is empty. The same text again does nothing.
|
|
1112
|
+
*/
|
|
1113
|
+
setSearch(text: string | null | undefined): void;
|
|
1055
1114
|
setFilters(filters?: {
|
|
1056
1115
|
[key: string]: string;
|
|
1057
1116
|
}): void;
|
|
1058
1117
|
setFocusedRow(key: string): void;
|
|
1059
1118
|
updateRow(key: string, newRowData: any): void;
|
|
1119
|
+
/**
|
|
1120
|
+
* Reloads a grid that has loaded or is loading. A lazy grid still waiting for its first load keeps
|
|
1121
|
+
* the change for that load instead, as `parentEntityId` does.
|
|
1122
|
+
*/
|
|
1123
|
+
private refreshIfStarted;
|
|
1060
1124
|
protected clearLoadedRows(): void;
|
|
1061
1125
|
protected updateLoadedRows(rows: any[]): void;
|
|
1062
1126
|
abstract getData(params?: any): Observable<any[] | {
|
|
@@ -1376,6 +1440,14 @@ export declare class DataGridComponent extends BaseComponent implements OnInit,
|
|
|
1376
1440
|
protected readonly minColumnWidth: number;
|
|
1377
1441
|
private bodyResized$;
|
|
1378
1442
|
private copiedTimer?;
|
|
1443
|
+
private quickSearchTimer?;
|
|
1444
|
+
/**
|
|
1445
|
+
* What the search box holds, exactly as typed. It follows the dataset's search when code changes
|
|
1446
|
+
* it, such as a "Clear filters" button calling `setSearch('')`. When the change is only the
|
|
1447
|
+
* trimmed form of what is in the box, the box keeps its text: writing the trimmed text back would
|
|
1448
|
+
* eat a space the user just typed between two words.
|
|
1449
|
+
*/
|
|
1450
|
+
protected readonly quickSearchValue: WritableSignal<string>;
|
|
1379
1451
|
/**
|
|
1380
1452
|
* The key of a row the keyboard moved to that was not rendered yet. It gets the DOM focus after
|
|
1381
1453
|
* the virtual scroll renders it; see focusPendingRow.
|
|
@@ -1424,6 +1496,9 @@ export declare class DataGridComponent extends BaseComponent implements OnInit,
|
|
|
1424
1496
|
protected get showColumnChooser(): boolean;
|
|
1425
1497
|
protected get columnChooserText(): string;
|
|
1426
1498
|
protected get resetColumnsText(): string;
|
|
1499
|
+
/** Whether the grid shows its quick search box, from the `quickSearch` setting. */
|
|
1500
|
+
protected get showQuickSearch(): boolean;
|
|
1501
|
+
protected get quickSearchText(): string;
|
|
1427
1502
|
protected get resizeColumnText(): string;
|
|
1428
1503
|
/** The grid's accessible name, a translation key or plain text, or none. */
|
|
1429
1504
|
protected get gridLabel(): string | null;
|
|
@@ -1524,6 +1599,27 @@ export declare class DataGridComponent extends BaseComponent implements OnInit,
|
|
|
1524
1599
|
protected onResizeReset(event: MouseEvent, column: IGridColumn): void;
|
|
1525
1600
|
protected onSelectionResized(newSize: number): void;
|
|
1526
1601
|
protected alignOf(column: IGridColumn): GridColumnAlign;
|
|
1602
|
+
/**
|
|
1603
|
+
* Whether the column's heading sorts: the grid's `sortable` setting is on, the column does not opt
|
|
1604
|
+
* out, and it has a field to sort by. An `actions` column never sorts.
|
|
1605
|
+
*/
|
|
1606
|
+
protected isSortable(column: IGridColumn): boolean;
|
|
1607
|
+
/** The direction the grid is sorted by this column, or `null` when it is not. */
|
|
1608
|
+
protected sortDirectionOf(column: IGridColumn): GridSortDirection | null;
|
|
1609
|
+
/** The column header's `aria-sort`, or nothing for a column that does not sort. */
|
|
1610
|
+
protected ariaSortOf(column: IGridColumn): 'ascending' | 'descending' | 'none' | null;
|
|
1611
|
+
/** A click on a sortable heading: ascending, then descending, then no sort. */
|
|
1612
|
+
protected onSortClick(column: IGridColumn): void;
|
|
1613
|
+
/** Each keystroke in the quick search box. The grid reloads once typing pauses. */
|
|
1614
|
+
protected onQuickSearchInput(text: string): void;
|
|
1615
|
+
/** Enter in the quick search box searches at once, without waiting for the pause. */
|
|
1616
|
+
protected onQuickSearchEnter(event: Event): void;
|
|
1617
|
+
private runQuickSearch;
|
|
1618
|
+
/**
|
|
1619
|
+
* The name the API sorts by: `sortField`, or `field` with its dot path flattened, so
|
|
1620
|
+
* `customer.name` sorts by `customerName`, the name a flattened list model gives it.
|
|
1621
|
+
*/
|
|
1622
|
+
private sortFieldOf;
|
|
1527
1623
|
/**
|
|
1528
1624
|
* Puts the count into the footer text. The translate pipe fills `{{ count }}` for a known
|
|
1529
1625
|
* key, but returns plain text such as the library default untouched, placeholder and all.
|