@zambon-dev/ui 1.12.0 → 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 +49 -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 +105 -13
- package/fesm2022/zambon-dev-ui-library.mjs.map +1 -1
- package/fesm2022/zambon-dev-ui-shared.mjs +3 -1
- package/fesm2022/zambon-dev-ui-shared.mjs.map +1 -1
- package/i18n/framework/en.json +1 -0
- package/i18n/framework/pt.json +1 -0
- package/package.json +1 -1
- package/schematics/ng-add/index.js +2 -1
- package/types/zambon-dev-ui-library.d.ts +100 -0
- package/types/zambon-dev-ui-shared.d.ts +4 -2
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",
|
|
@@ -48,7 +48,8 @@ const THEME_SCRIPT = ` <script>
|
|
|
48
48
|
`;
|
|
49
49
|
const DOCS_URL = 'https://ricardozambon.github.io/ZLibraries/guides/getting-started';
|
|
50
50
|
const NEXT_STEPS = `
|
|
51
|
-
@zambon-dev/ui is set up.
|
|
51
|
+
@zambon-dev/ui is set up. Once its packages are installed, library components such as lib-button
|
|
52
|
+
render.
|
|
52
53
|
|
|
53
54
|
The full application shell (MainLayoutComponent and the sign-in screen) needs values only your
|
|
54
55
|
application knows, so add these to the application config yourself:
|
|
@@ -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[] | {
|
|
@@ -1091,6 +1155,10 @@ export declare abstract class DataGridDataset extends GridDataset {
|
|
|
1091
1155
|
private readonly hiddenFields;
|
|
1092
1156
|
/** The width in pixels of each column the user resized, keyed by `field`. */
|
|
1093
1157
|
private readonly columnWidths;
|
|
1158
|
+
/**
|
|
1159
|
+
* The keys of the selected rows, as a copy. Keep it as long as you need: later selection changes
|
|
1160
|
+
* do not reach it, and changing it does not change the selection. Setting it keeps a copy too.
|
|
1161
|
+
*/
|
|
1094
1162
|
get selectedRowKeys(): string[];
|
|
1095
1163
|
set selectedRowKeys(value: string[]);
|
|
1096
1164
|
/**
|
|
@@ -1372,6 +1440,14 @@ export declare class DataGridComponent extends BaseComponent implements OnInit,
|
|
|
1372
1440
|
protected readonly minColumnWidth: number;
|
|
1373
1441
|
private bodyResized$;
|
|
1374
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>;
|
|
1375
1451
|
/**
|
|
1376
1452
|
* The key of a row the keyboard moved to that was not rendered yet. It gets the DOM focus after
|
|
1377
1453
|
* the virtual scroll renders it; see focusPendingRow.
|
|
@@ -1420,6 +1496,9 @@ export declare class DataGridComponent extends BaseComponent implements OnInit,
|
|
|
1420
1496
|
protected get showColumnChooser(): boolean;
|
|
1421
1497
|
protected get columnChooserText(): string;
|
|
1422
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;
|
|
1423
1502
|
protected get resizeColumnText(): string;
|
|
1424
1503
|
/** The grid's accessible name, a translation key or plain text, or none. */
|
|
1425
1504
|
protected get gridLabel(): string | null;
|
|
@@ -1520,6 +1599,27 @@ export declare class DataGridComponent extends BaseComponent implements OnInit,
|
|
|
1520
1599
|
protected onResizeReset(event: MouseEvent, column: IGridColumn): void;
|
|
1521
1600
|
protected onSelectionResized(newSize: number): void;
|
|
1522
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;
|
|
1523
1623
|
/**
|
|
1524
1624
|
* Puts the count into the footer text. The translate pipe fills `{{ count }}` for a known
|
|
1525
1625
|
* key, but returns plain text such as the library default untouched, placeholder and all.
|
|
@@ -966,11 +966,13 @@ export declare class EnumLabelPipe implements PipeTransform {
|
|
|
966
966
|
}
|
|
967
967
|
/**
|
|
968
968
|
* Reads a date the API sent in UTC without a timezone marker and returns it as the right instant.
|
|
969
|
-
* Values that already carry `Z` or an offset are kept as they are
|
|
970
|
-
* `
|
|
969
|
+
* Values that already carry `Z` or an offset are kept as they are. A date with no time, such as
|
|
970
|
+
* `2026-12-05`, is a calendar day and comes back as the start of that day in local time. Empty or
|
|
971
|
+
* invalid values give `null`. Chain it before `date`, e.g. `{{ value | utcDate | date }}`.
|
|
971
972
|
*/
|
|
972
973
|
export declare class UtcDatePipe implements PipeTransform {
|
|
973
974
|
private static readonly timeZoneMarker;
|
|
975
|
+
private static readonly dateOnly;
|
|
974
976
|
transform(value?: Date | string): Date | null;
|
|
975
977
|
static ɵfac: i0.ɵɵFactoryDeclaration<UtcDatePipe, never>;
|
|
976
978
|
static ɵpipe: i0.ɵɵPipeDeclaration<UtcDatePipe, "utcDate", true>;
|