@zambon-dev/ui 1.6.0 → 1.7.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 +21 -1
- package/fesm2022/zambon-dev-ui-framework.mjs +5 -1
- package/fesm2022/zambon-dev-ui-framework.mjs.map +1 -1
- package/fesm2022/zambon-dev-ui-library.mjs +202 -14
- package/fesm2022/zambon-dev-ui-library.mjs.map +1 -1
- package/i18n/framework/en.json +4 -0
- package/i18n/framework/pt.json +4 -0
- package/package.json +1 -1
- package/types/zambon-dev-ui-library.d.ts +133 -0
package/i18n/framework/en.json
CHANGED
|
@@ -52,6 +52,10 @@
|
|
|
52
52
|
"Grid-Message-Empty": "No records found.",
|
|
53
53
|
"Grid-Message-Failed": "An error occurred while loading the records. Please try again later.",
|
|
54
54
|
"Grid-Message-LazyLoad": "Click the refresh button to load entries.",
|
|
55
|
+
"Grid-No": "No",
|
|
56
|
+
"Grid-TotalRow": "{{ count }} record",
|
|
57
|
+
"Grid-TotalRows": "{{ count }} records",
|
|
58
|
+
"Grid-Yes": "Yes",
|
|
55
59
|
"Language-en": "English",
|
|
56
60
|
"Language-pt": "Português",
|
|
57
61
|
"Loading": "Loading",
|
package/i18n/framework/pt.json
CHANGED
|
@@ -52,6 +52,10 @@
|
|
|
52
52
|
"Grid-Message-Empty": "Nenhum registro encontrado.",
|
|
53
53
|
"Grid-Message-Failed": "Ocorreu um erro ao carregar os registros. Por favor, tente novamente mais tarde.",
|
|
54
54
|
"Grid-Message-LazyLoad": "Clique no botão atualizar para carregar os registros.",
|
|
55
|
+
"Grid-No": "Não",
|
|
56
|
+
"Grid-TotalRow": "{{ count }} registro",
|
|
57
|
+
"Grid-TotalRows": "{{ count }} registros",
|
|
58
|
+
"Grid-Yes": "Sim",
|
|
55
59
|
"Language-en": "English",
|
|
56
60
|
"Language-pt": "Português",
|
|
57
61
|
"Loading": "Carregando",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zambon-dev/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.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",
|
|
@@ -263,6 +263,7 @@ export type GridConfigs = {
|
|
|
263
263
|
rowsToDisplay: number;
|
|
264
264
|
};
|
|
265
265
|
export type DataGridConfigs = GridConfigs & {
|
|
266
|
+
/** Drops the grid's outline and rounded corner, for a grid that sits inside a card of its own. */
|
|
266
267
|
hideBorders?: boolean;
|
|
267
268
|
hideColumnHeaders?: boolean;
|
|
268
269
|
multiSelect?: boolean;
|
|
@@ -275,6 +276,25 @@ export type DataGridConfigs = GridConfigs & {
|
|
|
275
276
|
multiSelectSize?: string;
|
|
276
277
|
selectOnClick?: boolean;
|
|
277
278
|
showMessageOnEmpty?: boolean;
|
|
279
|
+
/**
|
|
280
|
+
* Shows a footer under the rows with the total number of records, when `getData` returns
|
|
281
|
+
* `{ items, totalRows }`. A plain array has no total, so the footer stays hidden. Defaults to `false`.
|
|
282
|
+
*/
|
|
283
|
+
showTotalRows?: boolean;
|
|
284
|
+
/**
|
|
285
|
+
* The footer text, as a translation key or plain text. `{{ count }}` is replaced by the total,
|
|
286
|
+
* formatted in the application's language. Defaults to `{{ count }} records`.
|
|
287
|
+
*/
|
|
288
|
+
totalRowsText?: string;
|
|
289
|
+
/** The footer text when the total is exactly 1. Defaults to `{{ count }} record`. */
|
|
290
|
+
totalRowText?: string;
|
|
291
|
+
/**
|
|
292
|
+
* Hidden text a boolean cell gives screen readers for a true value, when its column sets no
|
|
293
|
+
* `trueText`. A translation key or plain text. Defaults to `Yes`.
|
|
294
|
+
*/
|
|
295
|
+
booleanTrueText?: string;
|
|
296
|
+
/** The same for a false value, when the column sets no `falseText`. Defaults to `No`. */
|
|
297
|
+
booleanFalseText?: string;
|
|
278
298
|
};
|
|
279
299
|
export interface IListParameters extends ISummaryParameters {
|
|
280
300
|
endRow: number;
|
|
@@ -288,13 +308,67 @@ export interface ISummaryParameters {
|
|
|
288
308
|
[key: string]: string;
|
|
289
309
|
};
|
|
290
310
|
}
|
|
311
|
+
/** How a grid column formats its values. See {@link IGridColumn.type}. */
|
|
312
|
+
export type GridColumnType = 'text' | 'number' | 'currency' | 'percent' | 'date' | 'datetime' | 'boolean' | 'enum' | 'badge';
|
|
313
|
+
/** Where a grid column places its cells and header. */
|
|
314
|
+
export type GridColumnAlign = 'start' | 'center' | 'end';
|
|
315
|
+
/** One column of `lib-data-grid`, declared in the dataset's `columns`. */
|
|
291
316
|
export interface IGridColumn {
|
|
317
|
+
/** CSS classes added to every cell of the column. */
|
|
292
318
|
customClass?: string;
|
|
319
|
+
/** The row property the column shows. May be a dot path, such as `customer.name`. */
|
|
293
320
|
field: string;
|
|
321
|
+
/** The column heading, as a translation key or plain text. */
|
|
294
322
|
headerName: string;
|
|
323
|
+
/** The CSS grid track size of the column. Defaults to `minmax(0,1fr)`. */
|
|
295
324
|
size?: string;
|
|
325
|
+
/** The measured width in pixels, set by the grid to line the header up. Do not set it yourself. */
|
|
296
326
|
realSize?: number;
|
|
327
|
+
/** Renders the cells yourself. Receives `rowData` and `column`. Wins over `type`. */
|
|
297
328
|
template?: TemplateRef<any>;
|
|
329
|
+
/**
|
|
330
|
+
* How the cells format the value, in the application's language. Without a type the value shows
|
|
331
|
+
* as it is.
|
|
332
|
+
*
|
|
333
|
+
* - `text`: the value as it is.
|
|
334
|
+
* - `number`: grouped digits, up to 2 decimals unless `decimals` says otherwise.
|
|
335
|
+
* - `currency`: an amount in `currency`, such as `R$ 1.234,50`.
|
|
336
|
+
* - `percent`: a ratio as a percentage, so `0.15` shows `15%`.
|
|
337
|
+
* - `date` and `datetime`: a short date, and the time for `datetime`. See `utc`.
|
|
338
|
+
* - `boolean`: a check icon for true, nothing for false. See `trueText` and `falseText`.
|
|
339
|
+
* - `enum`: the translated `enumValues` entry for the value.
|
|
340
|
+
* - `badge`: the same text as `enum`, in a `lib-badge` coloured by `badgeIntents`.
|
|
341
|
+
*
|
|
342
|
+
* Empty values show an empty cell. A value the type cannot read shows as it is.
|
|
343
|
+
*/
|
|
344
|
+
type?: GridColumnType;
|
|
345
|
+
/** Most digits after the decimal separator, for `number`, `currency` and `percent`. */
|
|
346
|
+
decimals?: number;
|
|
347
|
+
/** Fewest digits after the decimal separator, for `number`, `currency` and `percent`. */
|
|
348
|
+
minDecimals?: number;
|
|
349
|
+
/** ISO 4217 code of the currency, such as `BRL` or `USD`, for `currency`. */
|
|
350
|
+
currency?: string;
|
|
351
|
+
/**
|
|
352
|
+
* For `date` and `datetime`: the value is in UTC but carries no zone marker, as the API sends it.
|
|
353
|
+
* The cell shows it in the user's time zone. A value with `Z` or an offset is read as it is.
|
|
354
|
+
*/
|
|
355
|
+
utc?: boolean;
|
|
356
|
+
/** For `enum` and `badge`: a translation key per value. A value not listed shows as it is. */
|
|
357
|
+
enumValues?: Record<string | number, string>;
|
|
358
|
+
/** For `badge`: the badge intent per value. Values not listed are `neutral`. */
|
|
359
|
+
badgeIntents?: Record<string | number, BadgeIntent>;
|
|
360
|
+
/**
|
|
361
|
+
* For `boolean`: text read out to screen readers for a true value, as a translation key or
|
|
362
|
+
* plain text. It is hidden on screen. Without it a screen reader hears nothing for the cell.
|
|
363
|
+
*/
|
|
364
|
+
trueText?: string;
|
|
365
|
+
/** For `boolean`: text read out to screen readers for a false value. See `trueText`. */
|
|
366
|
+
falseText?: string;
|
|
367
|
+
/**
|
|
368
|
+
* Where the cells and the header sit. Defaults to `end` for `number`, `currency` and `percent`,
|
|
369
|
+
* `center` for `boolean`, and `start` otherwise.
|
|
370
|
+
*/
|
|
371
|
+
align?: GridColumnAlign;
|
|
298
372
|
}
|
|
299
373
|
export interface IListResult<T> {
|
|
300
374
|
items: T[];
|
|
@@ -1074,6 +1148,7 @@ export declare class DataGridComponent extends BaseComponent implements OnInit,
|
|
|
1074
1148
|
private gridRoute;
|
|
1075
1149
|
private isGridCurrentUrl;
|
|
1076
1150
|
private lastPosition;
|
|
1151
|
+
private readonly localeService;
|
|
1077
1152
|
private ngZone;
|
|
1078
1153
|
private router;
|
|
1079
1154
|
private selectionColRealSize?;
|
|
@@ -1090,6 +1165,15 @@ export declare class DataGridComponent extends BaseComponent implements OnInit,
|
|
|
1090
1165
|
protected get messageToDisplayWhenLazyLoad(): string;
|
|
1091
1166
|
protected get messageToDisplayWhenFailed(): string;
|
|
1092
1167
|
protected get selectionColWidth(): string;
|
|
1168
|
+
/**
|
|
1169
|
+
* Whether the total-rows footer shows: the configs ask for it and the last load returned
|
|
1170
|
+
* `{ items, totalRows }`. The dataset's `totalRows` is tracked, so the footer follows each load.
|
|
1171
|
+
*/
|
|
1172
|
+
protected get shouldShowTotalRows(): boolean;
|
|
1173
|
+
/** The total number of records, in the application's language. Reads the locale signal. */
|
|
1174
|
+
protected get formattedTotalRows(): string;
|
|
1175
|
+
/** The footer text, singular for a total of exactly 1. */
|
|
1176
|
+
protected get totalRowsText(): string;
|
|
1093
1177
|
protected get shouldDisplayMessageWhenEmpty(): boolean;
|
|
1094
1178
|
/**
|
|
1095
1179
|
* Whether the grid is in the document, which it is not while the route-reuse strategy holds its
|
|
@@ -1109,6 +1193,12 @@ export declare class DataGridComponent extends BaseComponent implements OnInit,
|
|
|
1109
1193
|
ngAfterViewInit(): void;
|
|
1110
1194
|
ngOnDestroy(): void;
|
|
1111
1195
|
protected onSelectionResized(newSize: number): void;
|
|
1196
|
+
protected alignOf(column: IGridColumn): GridColumnAlign;
|
|
1197
|
+
/**
|
|
1198
|
+
* Puts the count into the footer text. The translate pipe fills `{{ count }}` for a known
|
|
1199
|
+
* key, but returns plain text such as the library default untouched, placeholder and all.
|
|
1200
|
+
*/
|
|
1201
|
+
protected fillCount(text: string): string;
|
|
1112
1202
|
protected isFirstVisibleRow(rowIndex: number): boolean;
|
|
1113
1203
|
private syncHeaderScroll;
|
|
1114
1204
|
protected trackByFn(index: number, item: any): number;
|
|
@@ -1131,6 +1221,41 @@ export declare class DataGridComponent extends BaseComponent implements OnInit,
|
|
|
1131
1221
|
};
|
|
1132
1222
|
}, {}, never, ["[buttons]"], true, never>;
|
|
1133
1223
|
}
|
|
1224
|
+
/** What a typed grid cell shows, worked out by {@link formatGridCellValue}. */
|
|
1225
|
+
export interface GridCellDisplay {
|
|
1226
|
+
/** How the row renders the cell: plain text, a check icon, or a badge. */
|
|
1227
|
+
kind: 'text' | 'boolean' | 'badge';
|
|
1228
|
+
/**
|
|
1229
|
+
* The text to show. When `translate` is `true` it is a translation key: an `enumValues` entry, or
|
|
1230
|
+
* the `trueText`/`falseText` of a boolean column. For a boolean cell it is the hidden text for
|
|
1231
|
+
* screen readers, and empty when the column gives none.
|
|
1232
|
+
*/
|
|
1233
|
+
text: string;
|
|
1234
|
+
/** Whether `text` is a translation key that still has to go through the translate pipe. */
|
|
1235
|
+
translate: boolean;
|
|
1236
|
+
/** For a boolean cell, whether the value is true and the check icon shows. */
|
|
1237
|
+
checked?: boolean;
|
|
1238
|
+
/** For a badge cell, the badge intent. */
|
|
1239
|
+
intent?: BadgeIntent;
|
|
1240
|
+
}
|
|
1241
|
+
/** Texts a boolean cell falls back to when its column names none: the grid's settings. */
|
|
1242
|
+
export interface GridCellTextDefaults {
|
|
1243
|
+
/** Hidden text for a true value, as a translation key or plain text. */
|
|
1244
|
+
trueText?: string;
|
|
1245
|
+
/** Hidden text for a false value, as a translation key or plain text. */
|
|
1246
|
+
falseText?: string;
|
|
1247
|
+
}
|
|
1248
|
+
/** The alignment a column's cells and header take: the column's own, or the default for its type. */
|
|
1249
|
+
export declare function getGridColumnAlign(column: IGridColumn): GridColumnAlign;
|
|
1250
|
+
/** Whether a column holds numbers, which are set in tabular figures so the digits line up. */
|
|
1251
|
+
export declare function isNumericGridColumn(column: IGridColumn): boolean;
|
|
1252
|
+
/**
|
|
1253
|
+
* Formats a cell value by its column's `type`, in `locale`. A column with no type shows the value as
|
|
1254
|
+
* it is. `null`, `undefined` and `''` give an empty cell. A value the type cannot read, such as text
|
|
1255
|
+
* in a number column, falls back to the raw text. A boolean column with no `trueText`/`falseText`
|
|
1256
|
+
* uses `defaults`, so screen readers always hear something.
|
|
1257
|
+
*/
|
|
1258
|
+
export declare function formatGridCellValue(value: unknown, column: IGridColumn, locale: string, defaults?: GridCellTextDefaults): GridCellDisplay;
|
|
1134
1259
|
declare namespace data_grid_row_component_d_exports {
|
|
1135
1260
|
export { DataGridRowComponent };
|
|
1136
1261
|
}
|
|
@@ -1162,6 +1287,7 @@ export declare class DataGridRowComponent extends BaseComponent implements OnIni
|
|
|
1162
1287
|
protected readonly selected: WritableSignal<boolean>;
|
|
1163
1288
|
private _rowData;
|
|
1164
1289
|
private elementRef;
|
|
1290
|
+
private readonly localeService;
|
|
1165
1291
|
/** The record this row shows. */
|
|
1166
1292
|
get rowData(): any;
|
|
1167
1293
|
protected get columns(): IGridColumn[];
|
|
@@ -1173,6 +1299,13 @@ export declare class DataGridRowComponent extends BaseComponent implements OnIni
|
|
|
1173
1299
|
protected onResize(colIndex: number, event: ResizeObserverEntry): void;
|
|
1174
1300
|
protected onResizeSelection(event: ResizeObserverEntry): void;
|
|
1175
1301
|
protected onToggleSelection(): void;
|
|
1302
|
+
protected alignOf(column: IGridColumn): GridColumnAlign;
|
|
1303
|
+
/**
|
|
1304
|
+
* The cell of a column without a template, formatted by the column's type. Reads the locale
|
|
1305
|
+
* signal, so the row renders again when the application language changes.
|
|
1306
|
+
*/
|
|
1307
|
+
protected formatCell(column: IGridColumn): GridCellDisplay;
|
|
1308
|
+
protected isNumeric(column: IGridColumn): boolean;
|
|
1176
1309
|
protected getValue(field: string): any;
|
|
1177
1310
|
private refreshSelection;
|
|
1178
1311
|
static ɵfac: i0.ɵɵFactoryDeclaration<DataGridRowComponent, never>;
|