ud-components 0.5.42 → 0.6.2
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/fesm2022/ud-components.mjs +1868 -1433
- package/fesm2022/ud-components.mjs.map +1 -1
- package/i18n/ud-components-translate-loader.d.ts +32 -0
- package/i18n/ud-components.translations.d.ts +32 -0
- package/interfaces/table-display-column.interface.d.ts +19 -0
- package/lib/custom-table/column-visibility-modal/column-visibility-modal.component.d.ts +63 -0
- package/lib/custom-table/custom-table.component.d.ts +55 -1
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TranslateLoader } from '@ngx-translate/core';
|
|
2
|
+
/**
|
|
3
|
+
* Wraps a consumer's TranslateLoader so the library's own strings are there
|
|
4
|
+
* without every app copying them into its en.json.
|
|
5
|
+
*
|
|
6
|
+
* Layered rather than merged after the fact: the app's loader is asynchronous,
|
|
7
|
+
* and racing setTranslation against an HTTP response is how precedence bugs are
|
|
8
|
+
* born. Here the order is structural — the library is the base, the app's
|
|
9
|
+
* translations are laid over it — so an app override wins by construction
|
|
10
|
+
* whenever the app's file happens to arrive.
|
|
11
|
+
*
|
|
12
|
+
* The app always wins. `actions.save` and `names.phone` are generic enough that
|
|
13
|
+
* an app may legitimately want its own wording, and a library that could not be
|
|
14
|
+
* overridden would be reserving six namespaces across every consumer.
|
|
15
|
+
*
|
|
16
|
+
* ```ts
|
|
17
|
+
* TranslateModule.forRoot({
|
|
18
|
+
* loader: {
|
|
19
|
+
* provide: TranslateLoader,
|
|
20
|
+
* useFactory: (http: HttpClient) =>
|
|
21
|
+
* withUdComponentsTranslations(new TranslateHttpLoader(http)),
|
|
22
|
+
* deps: [HttpClient],
|
|
23
|
+
* },
|
|
24
|
+
* })
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function withUdComponentsTranslations(appLoader: TranslateLoader): TranslateLoader;
|
|
28
|
+
/**
|
|
29
|
+
* For an app with no translation files of its own — the library's strings and
|
|
30
|
+
* nothing else. Mostly useful in tests and in the explorer.
|
|
31
|
+
*/
|
|
32
|
+
export declare function udComponentsOnlyTranslateLoader(): TranslateLoader;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every string the library renders, in every language it ships.
|
|
3
|
+
*
|
|
4
|
+
* These are defaults, not overrides. A consuming app's own translations win —
|
|
5
|
+
* see `withUdComponentsTranslations` — so an app that wants different wording
|
|
6
|
+
* for a generic key like `actions.save` simply keeps defining it.
|
|
7
|
+
*
|
|
8
|
+
* They live here as constants rather than as JSON assets on purpose: an asset
|
|
9
|
+
* would need every consumer to add a glob to angular.json, which is more setup
|
|
10
|
+
* than the duplication it replaces. A constant is an import, versioned with the
|
|
11
|
+
* code that reads it.
|
|
12
|
+
*
|
|
13
|
+
* Keys are grouped by the namespace the components actually ask for. Adding a
|
|
14
|
+
* key to a component means adding it here in the same change, or the string
|
|
15
|
+
* ships as a raw key to every app that has not guessed it — which is exactly
|
|
16
|
+
* what happened when the table gained its clear-filters control and three apps
|
|
17
|
+
* had to be edited to catch up.
|
|
18
|
+
*/
|
|
19
|
+
export interface UdTranslations {
|
|
20
|
+
[namespace: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
/** Languages the library ships strings for. */
|
|
23
|
+
export declare const UD_COMPONENTS_TRANSLATIONS: Record<string, UdTranslations>;
|
|
24
|
+
/**
|
|
25
|
+
* The library's strings for one language.
|
|
26
|
+
*
|
|
27
|
+
* Falls back to the base tag, so `fr-CA` gets the French strings rather than
|
|
28
|
+
* none. An unknown language returns nothing at all: shipping English under a
|
|
29
|
+
* label that says otherwise is worse than a visible missing key, because it
|
|
30
|
+
* looks translated.
|
|
31
|
+
*/
|
|
32
|
+
export declare function udComponentsTranslationsFor(lang: string): UdTranslations;
|
|
@@ -50,6 +50,25 @@ export interface TableDisplayColumn {
|
|
|
50
50
|
* Enable/disable filtering on column. Enabled by default
|
|
51
51
|
*/
|
|
52
52
|
disableFiltering?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Hides the column from the table without removing it from this array.
|
|
55
|
+
*
|
|
56
|
+
* The column stays declared, so it keeps its place in the ordering and comes
|
|
57
|
+
* back where it belongs when shown again — and a consumer restoring a saved
|
|
58
|
+
* layout only has to set this flag rather than rebuild the array.
|
|
59
|
+
*
|
|
60
|
+
* The column-visibility modal writes this. Persisting it is the consumer's
|
|
61
|
+
* business: `columnVisibilityChanged` emits the hidden properties on save,
|
|
62
|
+
* and it is up to them whether that goes to localStorage, a user preference,
|
|
63
|
+
* or nowhere.
|
|
64
|
+
*/
|
|
65
|
+
hidden?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Keeps a column out of the visibility modal, so it can never be hidden.
|
|
68
|
+
* Use for the column that identifies the row — a table whose every remaining
|
|
69
|
+
* column is a detail is a table you cannot read.
|
|
70
|
+
*/
|
|
71
|
+
alwaysVisible?: boolean;
|
|
53
72
|
/**
|
|
54
73
|
* If present, it will use this property to send to the backend instead of the default property
|
|
55
74
|
* Useful in cases where were not sending the whole object to the client but still need to filter
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { MatDialogRef } from '@angular/material/dialog';
|
|
2
|
+
import { FormControl, FormGroup } from '@angular/forms';
|
|
3
|
+
import { TableDisplayColumn } from '../../../interfaces/table-display-column.interface';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/** One switch in the modal. */
|
|
6
|
+
interface ColumnToggle {
|
|
7
|
+
key: string;
|
|
8
|
+
property: string;
|
|
9
|
+
name: TableDisplayColumn['name'];
|
|
10
|
+
}
|
|
11
|
+
/** One block in the ribbon — pinned columns appear here but get no switch. */
|
|
12
|
+
interface RibbonBlock {
|
|
13
|
+
key: string | null;
|
|
14
|
+
name: TableDisplayColumn['name'];
|
|
15
|
+
pinned: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface ColumnVisibilityModalData {
|
|
18
|
+
/**
|
|
19
|
+
* Every column the table renders, pinned ones included, in table order.
|
|
20
|
+
* The ribbon draws all of them so it is a true miniature of the result; only
|
|
21
|
+
* the unpinned ones get a switch.
|
|
22
|
+
*/
|
|
23
|
+
columns: TableDisplayColumn[];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Picks which columns a table shows.
|
|
27
|
+
*
|
|
28
|
+
* Edits its own form and hands the result back only on save, so Cancel
|
|
29
|
+
* genuinely cancels — flipping switches and closing leaves the table as it
|
|
30
|
+
* was. The table owns applying the result; this only decides it.
|
|
31
|
+
*/
|
|
32
|
+
export declare class ColumnVisibilityModalComponent {
|
|
33
|
+
private readonly dialogRef;
|
|
34
|
+
protected readonly toggles: ColumnToggle[];
|
|
35
|
+
protected readonly ribbon: RibbonBlock[];
|
|
36
|
+
protected readonly form: FormGroup<Record<string, FormControl<boolean>>>;
|
|
37
|
+
constructor(data: ColumnVisibilityModalData, dialogRef: MatDialogRef<ColumnVisibilityModalComponent, string[]>);
|
|
38
|
+
/** Pinned blocks are always on; the rest follow their switch. */
|
|
39
|
+
protected isBlockOn(block: RibbonBlock): boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Counted over every column, pinned included, so this line and the ribbon
|
|
42
|
+
* describe the same table. Counting only the switchable ones read as "2 of 5"
|
|
43
|
+
* beside a ribbon showing three columns still on.
|
|
44
|
+
*/
|
|
45
|
+
protected get visibleCount(): number;
|
|
46
|
+
protected get totalCount(): number;
|
|
47
|
+
protected get hiddenCount(): number;
|
|
48
|
+
protected showAll(): void;
|
|
49
|
+
/**
|
|
50
|
+
* A table showing no columns is not a state worth reaching. Save is blocked
|
|
51
|
+
* rather than the last switch being pinned on — a toggle that refuses to
|
|
52
|
+
* move reads as broken, where a blocked save sits next to the sentence
|
|
53
|
+
* explaining it.
|
|
54
|
+
*/
|
|
55
|
+
protected get nothingVisible(): boolean;
|
|
56
|
+
/** Anything still switchable that is currently off. */
|
|
57
|
+
protected get canShowMore(): boolean;
|
|
58
|
+
protected onConfirm(): void;
|
|
59
|
+
protected onCancel(): void;
|
|
60
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ColumnVisibilityModalComponent, never>;
|
|
61
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ColumnVisibilityModalComponent, "ud-column-visibility-modal", never, {}, {}, never, never, true, never>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -106,6 +106,14 @@ export declare class CustomTableComponent implements OnInit, OnChanges {
|
|
|
106
106
|
* Remove header
|
|
107
107
|
*/
|
|
108
108
|
disableHeader?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Shows the column picker in the header.
|
|
111
|
+
*
|
|
112
|
+
* Opt-in, matching the other feature flags here: this component backs every
|
|
113
|
+
* table in three apps, and a new control appearing in all of their headers
|
|
114
|
+
* is not something a library upgrade should decide for them.
|
|
115
|
+
*/
|
|
116
|
+
columnVisibilityEnabled?: boolean;
|
|
109
117
|
/**
|
|
110
118
|
* Emits the action id and current selection when an action button is clicked
|
|
111
119
|
*/
|
|
@@ -129,6 +137,20 @@ export declare class CustomTableComponent implements OnInit, OnChanges {
|
|
|
129
137
|
property: string;
|
|
130
138
|
value: any;
|
|
131
139
|
}>;
|
|
140
|
+
/**
|
|
141
|
+
* Emits the properties of the now-hidden columns when the picker is saved.
|
|
142
|
+
*
|
|
143
|
+
* The table has already applied the change by the time this fires — the
|
|
144
|
+
* event is for persisting it, not for enacting it, so a consumer that
|
|
145
|
+
* ignores it still gets a working picker for the session. Restore a saved
|
|
146
|
+
* layout by setting `hidden` on the matching entries of `displayedColumns`.
|
|
147
|
+
*
|
|
148
|
+
* Hidden rather than visible on purpose: a column added to the table later
|
|
149
|
+
* is visible to everyone by default. Had this emitted the visible list, that
|
|
150
|
+
* new column would be invisible to every user who had ever saved a layout,
|
|
151
|
+
* and nobody would know to go looking for it.
|
|
152
|
+
*/
|
|
153
|
+
columnVisibilityChanged: EventEmitter<string[]>;
|
|
132
154
|
actionsTemplate: TemplateRef<any>;
|
|
133
155
|
selection: SelectionModel<any>;
|
|
134
156
|
selectedFilters: TableDisplayColumn[];
|
|
@@ -172,6 +194,7 @@ export declare class CustomTableComponent implements OnInit, OnChanges {
|
|
|
172
194
|
set paginator(val: MatPaginator);
|
|
173
195
|
set sort(val: MatSort);
|
|
174
196
|
allFilterInput: ElementRef<HTMLInputElement>;
|
|
197
|
+
private readonly dialog;
|
|
175
198
|
constructor(translateService: TranslateWrapperService);
|
|
176
199
|
ngOnInit(): void;
|
|
177
200
|
applyFilterToAllColumns(event: Event): void;
|
|
@@ -219,6 +242,18 @@ export declare class CustomTableComponent implements OnInit, OnChanges {
|
|
|
219
242
|
/** Resolves a (possibly dot-notation) property path against a data row. */
|
|
220
243
|
private resolveValue;
|
|
221
244
|
hasFilterValue(property: string): boolean;
|
|
245
|
+
/** How many filters currently hold a value — drives the clear-all button. */
|
|
246
|
+
get activeFilterCount(): number;
|
|
247
|
+
/**
|
|
248
|
+
* Clears every filter in one go.
|
|
249
|
+
*
|
|
250
|
+
* Resets the controls individually rather than calling reset() on the whole
|
|
251
|
+
* group, because the multi-select filters carry a match-mode control that
|
|
252
|
+
* has to survive with its default — a blanket reset nulls it and leaves the
|
|
253
|
+
* toggle in an invalid state. The form's own valueChanges pipeline is
|
|
254
|
+
* debounced, so the burst of resets still lands as a single query.
|
|
255
|
+
*/
|
|
256
|
+
clearAllFilters(): void;
|
|
222
257
|
clearFilter(property: string): void;
|
|
223
258
|
private isApplicationSubmitted;
|
|
224
259
|
get hasSelectedRow(): boolean;
|
|
@@ -226,6 +261,25 @@ export declare class CustomTableComponent implements OnInit, OnChanges {
|
|
|
226
261
|
getColumnWidth(column: TableDisplayColumn): string;
|
|
227
262
|
get displayedColumnsProperty(): string[];
|
|
228
263
|
get displayedColumnsWithoutSelect(): TableDisplayColumn[];
|
|
264
|
+
/**
|
|
265
|
+
* The columns actually rendered. Must be the single source for both the
|
|
266
|
+
* matColumnDef list and the row definitions — Material throws
|
|
267
|
+
* "Could not find column with id" the moment those two disagree.
|
|
268
|
+
*
|
|
269
|
+
* `select` is never hideable: it is the checkbox, owned by `haveCheckbox`.
|
|
270
|
+
*/
|
|
271
|
+
get visibleColumns(): TableDisplayColumn[];
|
|
272
|
+
/** What the picker offers — everything the consumer has not pinned. */
|
|
273
|
+
get hideableColumns(): TableDisplayColumn[];
|
|
274
|
+
/**
|
|
275
|
+
* Every data column, pinned ones included. The picker's ribbon draws all of
|
|
276
|
+
* them so it is a true miniature of the resulting table; leaving the pinned
|
|
277
|
+
* ones out would show a table missing a column that is always there.
|
|
278
|
+
*/
|
|
279
|
+
get pickerColumns(): TableDisplayColumn[];
|
|
280
|
+
get hiddenColumnCount(): number;
|
|
281
|
+
openColumnVisibility(): void;
|
|
282
|
+
private applyColumnVisibility;
|
|
229
283
|
get displayCheckbox(): boolean;
|
|
230
284
|
startEditing(row: any, rowIndex: number, column: TableDisplayColumn): void;
|
|
231
285
|
confirmEdit(row: any, column: TableDisplayColumn): void;
|
|
@@ -235,5 +289,5 @@ export declare class CustomTableComponent implements OnInit, OnChanges {
|
|
|
235
289
|
protected readonly TableDisplayColumnType: typeof TableDisplayColumnType;
|
|
236
290
|
protected readonly NumberOperator: typeof NumberOperator;
|
|
237
291
|
static ɵfac: i0.ɵɵFactoryDeclaration<CustomTableComponent, never>;
|
|
238
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<CustomTableComponent, "ud-table", never, { "id": { "alias": "id"; "required": false; }; "title": { "alias": "title"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; "haveCheckbox": { "alias": "haveCheckbox"; "required": false; }; "displayedColumns": { "alias": "displayedColumns"; "required": false; }; "dataSource": { "alias": "dataSource"; "required": false; }; "paginationSizeOptions": { "alias": "paginationSizeOptions"; "required": false; }; "initialPageSize": { "alias": "initialPageSize"; "required": false; }; "specificSelectRow": { "alias": "specificSelectRow"; "required": false; }; "hasFilter": { "alias": "hasFilter"; "required": false; }; "expandableRows": { "alias": "expandableRows"; "required": false; }; "expandedItem": { "alias": "expandedItem"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; "separateFilters": { "alias": "separateFilters"; "required": false; }; "showPaginator": { "alias": "showPaginator"; "required": false; }; "noTableDataMessage": { "alias": "noTableDataMessage"; "required": false; }; "actionsMenuEnabled": { "alias": "actionsMenuEnabled"; "required": false; }; "menuItems": { "alias": "menuItems"; "required": false; }; "totalElements": { "alias": "totalElements"; "required": false; }; "serverSideFiltering": { "alias": "serverSideFiltering"; "required": false; }; "disableHeader": { "alias": "disableHeader"; "required": false; }; }, { "actionClicked": "actionClicked"; "clicked": "clicked"; "queryChange": "queryChange"; "cellEdited": "cellEdited"; }, ["actionsTemplate"], never, true, never>;
|
|
292
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<CustomTableComponent, "ud-table", never, { "id": { "alias": "id"; "required": false; }; "title": { "alias": "title"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "actions": { "alias": "actions"; "required": false; }; "haveCheckbox": { "alias": "haveCheckbox"; "required": false; }; "displayedColumns": { "alias": "displayedColumns"; "required": false; }; "dataSource": { "alias": "dataSource"; "required": false; }; "paginationSizeOptions": { "alias": "paginationSizeOptions"; "required": false; }; "initialPageSize": { "alias": "initialPageSize"; "required": false; }; "specificSelectRow": { "alias": "specificSelectRow"; "required": false; }; "hasFilter": { "alias": "hasFilter"; "required": false; }; "expandableRows": { "alias": "expandableRows"; "required": false; }; "expandedItem": { "alias": "expandedItem"; "required": false; }; "isLoading": { "alias": "isLoading"; "required": false; }; "separateFilters": { "alias": "separateFilters"; "required": false; }; "showPaginator": { "alias": "showPaginator"; "required": false; }; "noTableDataMessage": { "alias": "noTableDataMessage"; "required": false; }; "actionsMenuEnabled": { "alias": "actionsMenuEnabled"; "required": false; }; "menuItems": { "alias": "menuItems"; "required": false; }; "totalElements": { "alias": "totalElements"; "required": false; }; "serverSideFiltering": { "alias": "serverSideFiltering"; "required": false; }; "disableHeader": { "alias": "disableHeader"; "required": false; }; "columnVisibilityEnabled": { "alias": "columnVisibilityEnabled"; "required": false; }; }, { "actionClicked": "actionClicked"; "clicked": "clicked"; "queryChange": "queryChange"; "cellEdited": "cellEdited"; "columnVisibilityChanged": "columnVisibilityChanged"; }, ["actionsTemplate"], never, true, never>;
|
|
239
293
|
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './lib/carousel/carousel.component';
|
|
|
2
2
|
export * from './lib/custom-input/custom-input.component';
|
|
3
3
|
export * from './lib/custom-snackbar/custom-snackbar.component';
|
|
4
4
|
export * from './lib/custom-table/custom-table.component';
|
|
5
|
+
export * from './lib/custom-table/column-visibility-modal/column-visibility-modal.component';
|
|
5
6
|
export * from './lib/dynamic-component/dynamic-component.component';
|
|
6
7
|
export * from './lib/edit-view/edit-view.component';
|
|
7
8
|
export * from './lib/edit-view/edit-view-section.directive';
|
|
@@ -33,6 +34,8 @@ export * from './lib/button-toggle/button-toggle.component';
|
|
|
33
34
|
export * from './lib/preview-container/preview-container.component';
|
|
34
35
|
export * from './lib/toggle/toggle.component';
|
|
35
36
|
export * from './lib/toggle-option/toggle-option.component';
|
|
37
|
+
export * from './i18n/ud-components.translations';
|
|
38
|
+
export * from './i18n/ud-components-translate-loader';
|
|
36
39
|
export * from './enums/feature-flag-key.enum';
|
|
37
40
|
export * from './enums/loading-status.enum';
|
|
38
41
|
export * from './enums/application-status.enum';
|