ud-components 0.7.9 → 0.8.1
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 +279 -76
- package/fesm2022/ud-components.mjs.map +1 -1
- package/interfaces/table-display-column.interface.d.ts +14 -0
- package/lib/button/button.component.d.ts +3 -1
- package/lib/custom-table/custom-table.component.d.ts +10 -0
- package/lib/form-fields/date-input/date-input.component.d.ts +8 -1
- package/lib/form-fields/date-range-input/date-range-input.component.d.ts +8 -1
- package/lib/form-fields/money-input/money.utils.d.ts +8 -0
- package/lib/menu/menu.component.d.ts +67 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -107,4 +107,18 @@ export interface TableDisplayColumn {
|
|
|
107
107
|
* For PILL type columns. Receives the row and returns the KpiPillType to apply.
|
|
108
108
|
*/
|
|
109
109
|
pillTypeFn?: (row: any) => KpiPillType;
|
|
110
|
+
/**
|
|
111
|
+
* For MONEY columns. ISO 4217 code every row is shown in. Defaults to USD,
|
|
112
|
+
* so a table that sets nothing still reads "$12.50".
|
|
113
|
+
*/
|
|
114
|
+
currency?: string;
|
|
115
|
+
/**
|
|
116
|
+
* For MONEY columns. Row property holding each row's ISO 4217 code; wins
|
|
117
|
+
* over {@link currency} when the row has a value there.
|
|
118
|
+
*/
|
|
119
|
+
currencyProperty?: string;
|
|
120
|
+
/**
|
|
121
|
+
* For MONEY columns. Shows credits as "($12.50)" instead of "-$12.50".
|
|
122
|
+
*/
|
|
123
|
+
accountingNegatives?: boolean;
|
|
110
124
|
}
|
|
@@ -32,6 +32,8 @@ export declare class UdButtonComponent {
|
|
|
32
32
|
loading: boolean;
|
|
33
33
|
/** Explicitly disable the button */
|
|
34
34
|
disabled: boolean;
|
|
35
|
+
/** Accessible name on the native button; needed for icon-only buttons */
|
|
36
|
+
ariaLabel?: string;
|
|
35
37
|
/** Stretch to fill the container width */
|
|
36
38
|
fullWidth: boolean;
|
|
37
39
|
/**
|
|
@@ -44,5 +46,5 @@ export declare class UdButtonComponent {
|
|
|
44
46
|
get isDisabled(): boolean;
|
|
45
47
|
onClick(event: MouseEvent): void;
|
|
46
48
|
static ɵfac: i0.ɵɵFactoryDeclaration<UdButtonComponent, never>;
|
|
47
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<UdButtonComponent, "ud-button", never, { "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "type": { "alias": "type"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconPosition": { "alias": "iconPosition"; "required": false; }; "iconFontSet": { "alias": "iconFontSet"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; }, { "buttonClick": "buttonClick"; }, never, ["*"], true, never>;
|
|
49
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UdButtonComponent, "ud-button", never, { "variant": { "alias": "variant"; "required": false; }; "color": { "alias": "color"; "required": false; }; "size": { "alias": "size"; "required": false; }; "type": { "alias": "type"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconPosition": { "alias": "iconPosition"; "required": false; }; "iconFontSet": { "alias": "iconFontSet"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; }, { "buttonClick": "buttonClick"; }, never, ["*"], true, never>;
|
|
48
50
|
}
|
|
@@ -8,6 +8,7 @@ import { ElementRef, EventEmitter, OnChanges, OnInit, SimpleChanges, TemplateRef
|
|
|
8
8
|
import { FormControl, FormGroup } from '@angular/forms';
|
|
9
9
|
import { MatPaginator, PageEvent } from '@angular/material/paginator';
|
|
10
10
|
import { UdSelectOption } from '../form-fields/multi-select/multi-select.component';
|
|
11
|
+
import { UdMenuItem } from '../menu/menu.component';
|
|
11
12
|
import { ButtonToggleOption } from '../button-toggle/button-toggle.component';
|
|
12
13
|
import { MatSort } from '@angular/material/sort';
|
|
13
14
|
import { MatTableDataSource } from '@angular/material/table';
|
|
@@ -195,6 +196,7 @@ export declare class CustomTableComponent implements OnInit, OnChanges {
|
|
|
195
196
|
set sort(val: MatSort);
|
|
196
197
|
allFilterInput: ElementRef<HTMLInputElement>;
|
|
197
198
|
private readonly dialog;
|
|
199
|
+
private readonly locale;
|
|
198
200
|
constructor(translateService: TranslateWrapperService);
|
|
199
201
|
ngOnInit(): void;
|
|
200
202
|
applyFilterToAllColumns(event: Event): void;
|
|
@@ -234,6 +236,7 @@ export declare class CustomTableComponent implements OnInit, OnChanges {
|
|
|
234
236
|
private restoreFiltersFromCriteria;
|
|
235
237
|
private setTableQuery;
|
|
236
238
|
buildColumnFilterControls(): void;
|
|
239
|
+
formatMoneyCell(row: any, column: TableDisplayColumn): string;
|
|
237
240
|
formatPhoneNumber(value: string): string;
|
|
238
241
|
getRowBackgroundColor(index: number): "bg-accent" | "bg-white";
|
|
239
242
|
getHyperlinkRoute(row: any, column: TableDisplayColumn): string;
|
|
@@ -284,6 +287,13 @@ export declare class CustomTableComponent implements OnInit, OnChanges {
|
|
|
284
287
|
startEditing(row: any, rowIndex: number, column: TableDisplayColumn): void;
|
|
285
288
|
confirmEdit(row: any, column: TableDisplayColumn): void;
|
|
286
289
|
cancelEdit(): void;
|
|
290
|
+
/** menuItems as ud-menu items; the id is the index back into menuItems. */
|
|
291
|
+
tableMenuItems(): UdMenuItem[];
|
|
292
|
+
get pageSizeLabel(): string;
|
|
293
|
+
/** paginationSizeOptions as ud-menu items; the current size carries a check. */
|
|
294
|
+
get pageSizeMenuItems(): UdMenuItem[];
|
|
295
|
+
onPageSizeSelected(item: UdMenuItem): void;
|
|
296
|
+
onTableMenuItemSelected(item: UdMenuItem): void;
|
|
287
297
|
resolveBooleanInput(value: TableBooleanInput | undefined, selection: SelectionModel<any>): boolean;
|
|
288
298
|
protected readonly capitalize: (word: string) => string;
|
|
289
299
|
protected readonly TableDisplayColumnType: typeof TableDisplayColumnType;
|
|
@@ -20,10 +20,17 @@ export declare class DateInputComponent implements OnChanges {
|
|
|
20
20
|
max?: Date;
|
|
21
21
|
disabled: boolean;
|
|
22
22
|
hint: string;
|
|
23
|
+
/**
|
|
24
|
+
* Where an empty field's calendar opens. Not a min: earlier dates stay
|
|
25
|
+
* selectable, and a value in the field still wins.
|
|
26
|
+
*/
|
|
27
|
+
startAt?: Date | null;
|
|
28
|
+
startView: 'month' | 'year' | 'multi-year';
|
|
23
29
|
focused: boolean;
|
|
24
30
|
private controlContainer;
|
|
25
31
|
get control(): FormControl;
|
|
32
|
+
get calendarStartAt(): Date | null;
|
|
26
33
|
ngOnChanges(changes: SimpleChanges): void;
|
|
27
34
|
static ɵfac: i0.ɵɵFactoryDeclaration<DateInputComponent, never>;
|
|
28
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DateInputComponent, "ud-date-input", never, { "controlName": { "alias": "controlName"; "required": true; }; "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconFontSet": { "alias": "iconFontSet"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; }, {}, never, never, true, never>;
|
|
35
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DateInputComponent, "ud-date-input", never, { "controlName": { "alias": "controlName"; "required": true; }; "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconFontSet": { "alias": "iconFontSet"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; "startAt": { "alias": "startAt"; "required": false; }; "startView": { "alias": "startView"; "required": false; }; }, {}, never, never, true, never>;
|
|
29
36
|
}
|
|
@@ -24,11 +24,18 @@ export declare class DateRangeInputComponent implements OnChanges {
|
|
|
24
24
|
max?: Date;
|
|
25
25
|
disabled: boolean;
|
|
26
26
|
hint: string;
|
|
27
|
+
/**
|
|
28
|
+
* Where an empty field's calendar opens. Not a min: earlier dates stay
|
|
29
|
+
* selectable, and a value in the field still wins.
|
|
30
|
+
*/
|
|
31
|
+
startAt?: Date | null;
|
|
32
|
+
startView: 'month' | 'year' | 'multi-year';
|
|
27
33
|
focused: boolean;
|
|
28
34
|
private controlContainer;
|
|
29
35
|
get startControl(): FormControl;
|
|
30
36
|
get endControl(): FormControl;
|
|
37
|
+
get calendarStartAt(): Date | null;
|
|
31
38
|
ngOnChanges(changes: SimpleChanges): void;
|
|
32
39
|
static ɵfac: i0.ɵɵFactoryDeclaration<DateRangeInputComponent, never>;
|
|
33
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DateRangeInputComponent, "ud-date-range-input", never, { "startControlName": { "alias": "startControlName"; "required": true; }; "endControlName": { "alias": "endControlName"; "required": true; }; "label": { "alias": "label"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconFontSet": { "alias": "iconFontSet"; "required": false; }; "startPlaceholder": { "alias": "startPlaceholder"; "required": false; }; "endPlaceholder": { "alias": "endPlaceholder"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; }, {}, never, never, true, never>;
|
|
40
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DateRangeInputComponent, "ud-date-range-input", never, { "startControlName": { "alias": "startControlName"; "required": true; }; "endControlName": { "alias": "endControlName"; "required": true; }; "label": { "alias": "label"; "required": false; }; "icon": { "alias": "icon"; "required": false; }; "iconFontSet": { "alias": "iconFontSet"; "required": false; }; "startPlaceholder": { "alias": "startPlaceholder"; "required": false; }; "endPlaceholder": { "alias": "endPlaceholder"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; "startAt": { "alias": "startAt"; "required": false; }; "startView": { "alias": "startView"; "required": false; }; }, {}, never, never, true, never>;
|
|
34
41
|
}
|
|
@@ -23,3 +23,11 @@ export declare function moneyToCents(value: string): number;
|
|
|
23
23
|
export declare function centsToMoney(cents: number): string;
|
|
24
24
|
/** For display only: "1234.50" → "1,234.50". Never parse this back as a number. */
|
|
25
25
|
export declare function groupThousands(value: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* For display only: an API amount in its currency, always 2 decimals.
|
|
28
|
+
* `formatMoney('1234.5', 'CAD', 'en-US')` gives "$1,234.50", a credit "-$12.50",
|
|
29
|
+
* or "($12.50)" with {@link accounting}. The value goes to Intl as a string, so
|
|
30
|
+
* it is never rounded through a float. Empty input gives "", anything that is
|
|
31
|
+
* not a number is shown as it came.
|
|
32
|
+
*/
|
|
33
|
+
export declare function formatMoney(value: string | number | null | undefined, currency?: string, locale?: string, accounting?: boolean): string;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { UdButtonColor, UdButtonSize, UdButtonVariant } from '../button/button.component';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export interface UdMenuItem {
|
|
6
|
+
/** What itemSelected reports; also the @for track. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Already translated. */
|
|
9
|
+
label: string | Observable<string>;
|
|
10
|
+
icon?: string;
|
|
11
|
+
/** Default 'material-icons-outlined'. */
|
|
12
|
+
iconFontSet?: string;
|
|
13
|
+
/** Muted second line. */
|
|
14
|
+
description?: string;
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Muted second line when disabled: why it is closed. */
|
|
17
|
+
disabledReason?: string;
|
|
18
|
+
/** 'danger' for destructive actions (void, delete). */
|
|
19
|
+
color?: 'default' | 'danger';
|
|
20
|
+
/** Hairline above, for grouping. */
|
|
21
|
+
dividerBefore?: boolean;
|
|
22
|
+
/** Left out entirely (no permission), unlike disabled. */
|
|
23
|
+
hidden?: boolean;
|
|
24
|
+
/** Navigates instead of emitting. */
|
|
25
|
+
routerLink?: string | any[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A trigger button plus its dropdown panel, with ud-table's Actions-menu look.
|
|
29
|
+
*
|
|
30
|
+
* Usage:
|
|
31
|
+
* <ud-menu [items]="items" ariaLabel="Charge actions" (itemSelected)="onAction($event)" />
|
|
32
|
+
* <ud-menu [items]="items" triggerVariant="stroked" triggerIcon="keyboard_arrow_down"
|
|
33
|
+
* [triggerLabel]="'Actions'" (itemSelected)="onAction($event)" />
|
|
34
|
+
*
|
|
35
|
+
* Prefer `disabled` + `disabledReason` over `hidden`, so the reader can tell
|
|
36
|
+
* "not possible here" from "does not exist".
|
|
37
|
+
*/
|
|
38
|
+
export declare class UdMenuComponent {
|
|
39
|
+
items: UdMenuItem[];
|
|
40
|
+
triggerVariant: UdButtonVariant;
|
|
41
|
+
triggerIcon: string;
|
|
42
|
+
/** Text for stroked/flat triggers, translated by the caller. */
|
|
43
|
+
triggerLabel?: string | Observable<string>;
|
|
44
|
+
triggerColor: UdButtonColor;
|
|
45
|
+
triggerSize: UdButtonSize;
|
|
46
|
+
/** Required in practice for icon-only triggers. */
|
|
47
|
+
ariaLabel?: string;
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
/** Spinner on the trigger; the menu cannot open. */
|
|
50
|
+
loading: boolean;
|
|
51
|
+
xPosition: 'before' | 'after';
|
|
52
|
+
yPosition: 'above' | 'below';
|
|
53
|
+
/** Keeps a click on the trigger from reaching a clickable table row. */
|
|
54
|
+
stopPropagation: boolean;
|
|
55
|
+
panelClass?: string;
|
|
56
|
+
/** Only for enabled items. */
|
|
57
|
+
itemSelected: EventEmitter<UdMenuItem>;
|
|
58
|
+
opened: EventEmitter<void>;
|
|
59
|
+
closed: EventEmitter<void>;
|
|
60
|
+
get visibleItems(): UdMenuItem[];
|
|
61
|
+
get hasIcons(): boolean;
|
|
62
|
+
get panelClasses(): string;
|
|
63
|
+
onHostClick(event: Event): void;
|
|
64
|
+
select(item: UdMenuItem): void;
|
|
65
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<UdMenuComponent, never>;
|
|
66
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<UdMenuComponent, "ud-menu", never, { "items": { "alias": "items"; "required": true; }; "triggerVariant": { "alias": "triggerVariant"; "required": false; }; "triggerIcon": { "alias": "triggerIcon"; "required": false; }; "triggerLabel": { "alias": "triggerLabel"; "required": false; }; "triggerColor": { "alias": "triggerColor"; "required": false; }; "triggerSize": { "alias": "triggerSize"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "xPosition": { "alias": "xPosition"; "required": false; }; "yPosition": { "alias": "yPosition"; "required": false; }; "stopPropagation": { "alias": "stopPropagation"; "required": false; }; "panelClass": { "alias": "panelClass"; "required": false; }; }, { "itemSelected": "itemSelected"; "opened": "opened"; "closed": "closed"; }, never, never, true, never>;
|
|
67
|
+
}
|
package/package.json
CHANGED
package/public-api.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from './lib/edit-view/edit-view.component';
|
|
|
9
9
|
export * from './lib/edit-view/edit-view-section.directive';
|
|
10
10
|
export * from './lib/file-input/file-input.component';
|
|
11
11
|
export * from './lib/kpi/kpi.component';
|
|
12
|
+
export * from './lib/menu/menu.component';
|
|
12
13
|
export * from './lib/modal/modal.component';
|
|
13
14
|
export * from './lib/occupancy-grid/occupancy-grid.component';
|
|
14
15
|
export * from './lib/occupancy-grid/occupancy-grid.interface';
|