ud-components 0.7.8 → 0.8.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/fesm2022/ud-components.mjs +385 -16
- package/fesm2022/ud-components.mjs.map +1 -1
- package/lib/button/button.component.d.ts +3 -1
- package/lib/custom-table/custom-table.component.d.ts +8 -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-input.component.d.ts +50 -0
- package/lib/form-fields/money-input/money.utils.d.ts +25 -0
- package/lib/menu/menu.component.d.ts +67 -0
- package/package.json +1 -1
- package/public-api.d.ts +3 -0
|
@@ -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';
|
|
@@ -284,6 +285,13 @@ export declare class CustomTableComponent implements OnInit, OnChanges {
|
|
|
284
285
|
startEditing(row: any, rowIndex: number, column: TableDisplayColumn): void;
|
|
285
286
|
confirmEdit(row: any, column: TableDisplayColumn): void;
|
|
286
287
|
cancelEdit(): void;
|
|
288
|
+
/** menuItems as ud-menu items; the id is the index back into menuItems. */
|
|
289
|
+
tableMenuItems(): UdMenuItem[];
|
|
290
|
+
get pageSizeLabel(): string;
|
|
291
|
+
/** paginationSizeOptions as ud-menu items; the current size carries a check. */
|
|
292
|
+
get pageSizeMenuItems(): UdMenuItem[];
|
|
293
|
+
onPageSizeSelected(item: UdMenuItem): void;
|
|
294
|
+
onTableMenuItemSelected(item: UdMenuItem): void;
|
|
287
295
|
resolveBooleanInput(value: TableBooleanInput | undefined, selection: SelectionModel<any>): boolean;
|
|
288
296
|
protected readonly capitalize: (word: string) => string;
|
|
289
297
|
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
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { FormControl } from '@angular/forms';
|
|
3
|
+
import { UdInputSize } from '../text-input/text-input.component';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export type UdMoneyMode = 'amount' | 'percent';
|
|
6
|
+
/**
|
|
7
|
+
* An amount of money, or a percentage, as a decimal string (UC-23).
|
|
8
|
+
*
|
|
9
|
+
* <p>Same conventions as the other form fields: bound by {@code controlName}
|
|
10
|
+
* inside a parent FormGroup. The control's value is a normalised decimal
|
|
11
|
+
* string ({@code "412.30"}), never a number, so float error never reaches an
|
|
12
|
+
* API. Paste-tolerant ({@code "$1,234.5"}), shown with thousands separators
|
|
13
|
+
* once the field loses focus. While the text cannot be read, the control holds
|
|
14
|
+
* the raw text and carries a {@code udMoney} error.
|
|
15
|
+
*
|
|
16
|
+
* <p>Percent mode: a {@code %} suffix, 0 to 100 unless min / max say
|
|
17
|
+
* otherwise, still two decimals.
|
|
18
|
+
*/
|
|
19
|
+
export declare class MoneyInputComponent implements OnInit, OnChanges {
|
|
20
|
+
controlName: string;
|
|
21
|
+
label: string;
|
|
22
|
+
placeholder: string;
|
|
23
|
+
/** Shown before the amount, e.g. "$" or "CAD". Ignored in percent mode. */
|
|
24
|
+
currency: string;
|
|
25
|
+
mode: UdMoneyMode;
|
|
26
|
+
/** Decimal strings, inclusive. Percent mode defaults to 0 and 100. */
|
|
27
|
+
min?: string;
|
|
28
|
+
max?: string;
|
|
29
|
+
allowNegative: boolean;
|
|
30
|
+
disabled: boolean;
|
|
31
|
+
hint: string;
|
|
32
|
+
size: UdInputSize;
|
|
33
|
+
readonly text: import("@angular/core").WritableSignal<string>;
|
|
34
|
+
readonly focused: import("@angular/core").WritableSignal<boolean>;
|
|
35
|
+
private controlContainer;
|
|
36
|
+
private destroyRef;
|
|
37
|
+
private validator;
|
|
38
|
+
get control(): FormControl;
|
|
39
|
+
get error(): string | null;
|
|
40
|
+
ngOnInit(): void;
|
|
41
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
42
|
+
onInput(raw: string): void;
|
|
43
|
+
onBlur(): void;
|
|
44
|
+
private showValue;
|
|
45
|
+
private get effectiveMin();
|
|
46
|
+
private get effectiveMax();
|
|
47
|
+
private validate;
|
|
48
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MoneyInputComponent, never>;
|
|
49
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MoneyInputComponent, "ud-money-input", never, { "controlName": { "alias": "controlName"; "required": true; }; "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "currency": { "alias": "currency"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "min": { "alias": "min"; "required": false; }; "max": { "alias": "max"; "required": false; }; "allowNegative": { "alias": "allowNegative"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "hint": { "alias": "hint"; "required": false; }; "size": { "alias": "size"; "required": false; }; }, {}, never, never, true, never>;
|
|
50
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Money as decimal strings, never JS numbers (UC-23). `0.1 + 0.2` is
|
|
3
|
+
* `0.30000000000000004`; an amount that went through a float can reach the API
|
|
4
|
+
* a cent off. Everything here works on the digits of the string, and the only
|
|
5
|
+
* arithmetic is on whole cents.
|
|
6
|
+
*/
|
|
7
|
+
export type MoneyParseError = 'format' | 'decimals' | 'negative';
|
|
8
|
+
export interface MoneyParseResult {
|
|
9
|
+
/** Normalised decimal string ("1234.50"), or null for an empty input. Undefined when invalid. */
|
|
10
|
+
value?: string | null;
|
|
11
|
+
error?: MoneyParseError;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Reads what a person typed or pasted: "1,234.5", "$1234.50", " 12 ", "CA$ 3".
|
|
15
|
+
* Currency symbols, letters, spaces and thousands commas are dropped; at most
|
|
16
|
+
* {@link decimals} decimals are allowed; the result is padded to exactly that
|
|
17
|
+
* many ("12" → "12.00").
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseMoney(raw: string | number | null | undefined, decimals?: number, allowNegative?: boolean): MoneyParseResult;
|
|
20
|
+
/** Whole cents of a normalised 2-decimal string: "1234.50" → 123450. */
|
|
21
|
+
export declare function moneyToCents(value: string): number;
|
|
22
|
+
/** The inverse of {@link moneyToCents}: 123450 → "1234.50". Rounds nothing; give it whole cents. */
|
|
23
|
+
export declare function centsToMoney(cents: number): string;
|
|
24
|
+
/** For display only: "1234.50" → "1,234.50". Never parse this back as a number. */
|
|
25
|
+
export declare function groupThousands(value: string): 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';
|
|
@@ -32,6 +33,8 @@ export * from './lib/form-fields/time-picker/time-picker.component';
|
|
|
32
33
|
export * from './lib/form-fields/textarea/textarea.component';
|
|
33
34
|
export * from './lib/form-fields/phone-input/phone-input.component';
|
|
34
35
|
export * from './lib/form-fields/chip-input/chip-input.component';
|
|
36
|
+
export * from './lib/form-fields/money-input/money-input.component';
|
|
37
|
+
export * from './lib/form-fields/money-input/money.utils';
|
|
35
38
|
export * from './lib/calendar/calendar.component';
|
|
36
39
|
export * from './lib/tooltip/tooltip.component';
|
|
37
40
|
export * from './lib/tooltip/tooltip.directive';
|