@smallpearl/ngx-helper 0.29.23

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.
Files changed (117) hide show
  1. package/README.md +230 -0
  2. package/core/index.d.ts +2 -0
  3. package/core/src/ngx-helper.d.ts +7 -0
  4. package/core/src/version.d.ts +1 -0
  5. package/entity-field/index.d.ts +2 -0
  6. package/entity-field/src/entity-field-spec.d.ts +69 -0
  7. package/entity-field/src/provider.d.ts +27 -0
  8. package/fesm2022/smallpearl-ngx-helper-core.mjs +23 -0
  9. package/fesm2022/smallpearl-ngx-helper-core.mjs.map +1 -0
  10. package/fesm2022/smallpearl-ngx-helper-entity-field.mjs +112 -0
  11. package/fesm2022/smallpearl-ngx-helper-entity-field.mjs.map +1 -0
  12. package/fesm2022/smallpearl-ngx-helper-forms.mjs +112 -0
  13. package/fesm2022/smallpearl-ngx-helper-forms.mjs.map +1 -0
  14. package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs +108 -0
  15. package/fesm2022/smallpearl-ngx-helper-hover-dropdown.mjs.map +1 -0
  16. package/fesm2022/smallpearl-ngx-helper-locale.mjs +296 -0
  17. package/fesm2022/smallpearl-ngx-helper-locale.mjs.map +1 -0
  18. package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs +504 -0
  19. package/fesm2022/smallpearl-ngx-helper-mat-busy-wheel.mjs.map +1 -0
  20. package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs +184 -0
  21. package/fesm2022/smallpearl-ngx-helper-mat-context-menu.mjs.map +1 -0
  22. package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs +1486 -0
  23. package/fesm2022/smallpearl-ngx-helper-mat-entity-crud.mjs.map +1 -0
  24. package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs +800 -0
  25. package/fesm2022/smallpearl-ngx-helper-mat-entity-list.mjs.map +1 -0
  26. package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs +328 -0
  27. package/fesm2022/smallpearl-ngx-helper-mat-file-input.mjs.map +1 -0
  28. package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs +468 -0
  29. package/fesm2022/smallpearl-ngx-helper-mat-form-error.mjs.map +1 -0
  30. package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs +854 -0
  31. package/fesm2022/smallpearl-ngx-helper-mat-select-entity.mjs.map +1 -0
  32. package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs +930 -0
  33. package/fesm2022/smallpearl-ngx-helper-mat-side-menu-layout.mjs.map +1 -0
  34. package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs +926 -0
  35. package/fesm2022/smallpearl-ngx-helper-mat-tel-input.mjs.map +1 -0
  36. package/fesm2022/smallpearl-ngx-helper-sideload.mjs +111 -0
  37. package/fesm2022/smallpearl-ngx-helper-sideload.mjs.map +1 -0
  38. package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs +384 -0
  39. package/fesm2022/smallpearl-ngx-helper-stationary-with-line-items.mjs.map +1 -0
  40. package/fesm2022/smallpearl-ngx-helper.mjs +13 -0
  41. package/fesm2022/smallpearl-ngx-helper.mjs.map +1 -0
  42. package/forms/index.d.ts +1 -0
  43. package/forms/src/validation-error-handler.d.ts +52 -0
  44. package/hover-dropdown/index.d.ts +1 -0
  45. package/hover-dropdown/src/hover-dropdown.directive.d.ts +41 -0
  46. package/index.d.ts +5 -0
  47. package/locale/index.d.ts +5 -0
  48. package/locale/src/currency.pipe.d.ts +14 -0
  49. package/locale/src/date.pipe.d.ts +14 -0
  50. package/locale/src/format-currency.d.ts +1 -0
  51. package/locale/src/format-date.d.ts +2 -0
  52. package/locale/src/is-empty.d.ts +1 -0
  53. package/locale/src/providers.d.ts +20 -0
  54. package/mat-busy-wheel/index.d.ts +4 -0
  55. package/mat-busy-wheel/src/busy-wheel-op.d.ts +65 -0
  56. package/mat-busy-wheel/src/busy-wheel.component.d.ts +12 -0
  57. package/mat-busy-wheel/src/busy-wheel.service.d.ts +42 -0
  58. package/mat-busy-wheel/src/host-busy-wheel.directive.d.ts +35 -0
  59. package/mat-context-menu/index.d.ts +1 -0
  60. package/mat-context-menu/src/mat-context-menu.component.d.ts +54 -0
  61. package/mat-entity-crud/index.d.ts +5 -0
  62. package/mat-entity-crud/src/default-config.d.ts +9 -0
  63. package/mat-entity-crud/src/form-view-host.component.d.ts +34 -0
  64. package/mat-entity-crud/src/mat-entity-crud-form-base.d.ts +95 -0
  65. package/mat-entity-crud/src/mat-entity-crud-internal-types.d.ts +66 -0
  66. package/mat-entity-crud/src/mat-entity-crud-types.d.ts +141 -0
  67. package/mat-entity-crud/src/mat-entity-crud.component.d.ts +267 -0
  68. package/mat-entity-crud/src/preview-host.component.d.ts +19 -0
  69. package/mat-entity-crud/src/preview-pane.component.d.ts +27 -0
  70. package/mat-entity-crud/src/providers.d.ts +3 -0
  71. package/mat-entity-list/index.d.ts +3 -0
  72. package/mat-entity-list/src/config.d.ts +6 -0
  73. package/mat-entity-list/src/mat-entity-list-types.d.ts +53 -0
  74. package/mat-entity-list/src/mat-entity-list.component.d.ts +209 -0
  75. package/mat-entity-list/src/providers.d.ts +3 -0
  76. package/mat-file-input/README.md +63 -0
  77. package/mat-file-input/index.d.ts +1 -0
  78. package/mat-file-input/src/mat-file-input.component.d.ts +58 -0
  79. package/mat-form-error/README.md +306 -0
  80. package/mat-form-error/index.d.ts +6 -0
  81. package/mat-form-error/src/locales/en.d.ts +4 -0
  82. package/mat-form-error/src/locales/hu.d.ts +4 -0
  83. package/mat-form-error/src/locales/index.d.ts +3 -0
  84. package/mat-form-error/src/locales/pt-br.d.ts +4 -0
  85. package/mat-form-error/src/ngx-error-list.component.d.ts +9 -0
  86. package/mat-form-error/src/ngx-mat-error-control.d.ts +17 -0
  87. package/mat-form-error/src/ngx-mat-error-def.directive.d.ts +30 -0
  88. package/mat-form-error/src/ngx-mat-errors-for-date-range-picker.directive.d.ts +8 -0
  89. package/mat-form-error/src/ngx-mat-errors.component.d.ts +23 -0
  90. package/mat-form-error/src/types.d.ts +68 -0
  91. package/mat-form-error/src/utils/coerce-to-observable.d.ts +3 -0
  92. package/mat-form-error/src/utils/distinct-until-error-changed.d.ts +2 -0
  93. package/mat-form-error/src/utils/find-error-for-control.d.ts +9 -0
  94. package/mat-form-error/src/utils/get-abstract-controls.d.ts +3 -0
  95. package/mat-form-error/src/utils/get-control-with-error.d.ts +3 -0
  96. package/mat-select-entity/index.d.ts +2 -0
  97. package/mat-select-entity/src/mat-select-entity.component.d.ts +207 -0
  98. package/mat-select-entity/src/providers.d.ts +9 -0
  99. package/mat-side-menu-layout/index.d.ts +6 -0
  100. package/mat-side-menu-layout/src/layout.service.d.ts +23 -0
  101. package/mat-side-menu-layout/src/mat-menu-layout.component.d.ts +39 -0
  102. package/mat-side-menu-layout/src/mat-menu-layout.module.d.ts +18 -0
  103. package/mat-side-menu-layout/src/mat-menu-list-item.component.d.ts +36 -0
  104. package/mat-side-menu-layout/src/mat-menu-pane.component.d.ts +66 -0
  105. package/mat-side-menu-layout/src/nav-item.d.ts +10 -0
  106. package/mat-tel-input/README.md +18 -0
  107. package/mat-tel-input/index.d.ts +2 -0
  108. package/mat-tel-input/src/country-codes.d.ts +5 -0
  109. package/mat-tel-input/src/mat-telephone.component.d.ts +129 -0
  110. package/mat-tel-input/src/providers.d.ts +38 -0
  111. package/ngx-helper.d.ts +2 -0
  112. package/package.json +114 -0
  113. package/public-api.d.ts +1 -0
  114. package/sideload/index.d.ts +1 -0
  115. package/sideload/src/sideload.d.ts +17 -0
  116. package/stationary-with-line-items/index.d.ts +1 -0
  117. package/stationary-with-line-items/src/stationary-with-line-items.component.d.ts +74 -0
@@ -0,0 +1,207 @@
1
+ import { BooleanInput } from '@angular/cdk/coercion';
2
+ import { HttpClient, HttpContextToken, HttpParams } from '@angular/common/http';
3
+ import { AfterViewInit, ChangeDetectorRef, ElementRef, EventEmitter, Injector, OnDestroy, OnInit } from '@angular/core';
4
+ import { ControlValueAccessor, NgControl } from '@angular/forms';
5
+ import { MatFormField, MatFormFieldControl } from '@angular/material/form-field';
6
+ import { MatSelect, MatSelectChange } from '@angular/material/select';
7
+ import { BehaviorSubject, Observable, Subject } from 'rxjs';
8
+ import { SPMatSelectEntityConfig } from './providers';
9
+ import * as i0 from "@angular/core";
10
+ export interface SPMatSelectEntityHttpContext {
11
+ entityName: string;
12
+ entityNamePlural: string;
13
+ endpoint: string;
14
+ }
15
+ export declare const SP_MAT_SELECT_ENTITY_HTTP_CONTEXT: HttpContextToken<SPMatSelectEntityHttpContext>;
16
+ type EntityGroup<T> = {
17
+ id?: PropertyKey;
18
+ name?: string;
19
+ label?: string;
20
+ description?: string;
21
+ items?: T[];
22
+ __items__?: T[];
23
+ };
24
+ export type SPMatSelectEntityResponseParser = <TEntity extends {
25
+ [P in IdKey]: PropertyKey;
26
+ }, IdKey extends string = 'id'>(response: any) => Array<TEntity>;
27
+ /**
28
+ * This is a generic component to display a <mat-select> for a FK field
29
+ * where the select's options are dynamically loaded from the server using
30
+ * the given url (or URL). The objects thus retrieved should have a
31
+ * unique 'id' field that will be used as the value of each `option` element.
32
+ * Therefore upon selection of an `option` element, the `select` value will
33
+ * be set to the object's `id` property. By default 'id' is used as its id,
34
+ * but this can be customized by specifying the `idKey' property value.
35
+ */
36
+ export declare class SPMatSelectEntityComponent<TEntity extends {
37
+ [P in IdKey]: PropertyKey;
38
+ }, IdKey extends string = 'id'> implements OnInit, OnDestroy, AfterViewInit, ControlValueAccessor, MatFormFieldControl<string | number | string[] | number[]> {
39
+ protected http: HttpClient;
40
+ protected cdr: ChangeDetectorRef;
41
+ protected _elementRef: ElementRef<HTMLElement>;
42
+ protected injector: Injector;
43
+ _formField: MatFormField;
44
+ ngControl: NgControl;
45
+ private config;
46
+ static _entitiesCache: Map<string, {
47
+ refCount: number;
48
+ entities: Array<any>;
49
+ }>;
50
+ matSel: MatSelect;
51
+ /**
52
+ * Entity label function. Given an entity return its natural label
53
+ * to display to the user.
54
+ */
55
+ entityLabelFn: (entity: TEntity) => string;
56
+ /**
57
+ * Entity filter function - return a boolean if the entity is to be included
58
+ * in the filtered entities list.
59
+ * @param entity: TEntity object to test for 'search' string.
60
+ * @param search - search string
61
+ */
62
+ entityFilterFn: (entity: TEntity, search: string) => boolean;
63
+ /**
64
+ * Entity idKey, if idKey is different from the default 'id'.
65
+ */
66
+ idKey: string;
67
+ /**
68
+ * URL of the remote from where entities are to be loaded.
69
+ * This won't be used if `loadFromRemoteFn` is specified.
70
+ */
71
+ url: string;
72
+ /**
73
+ * Parameters to be added to the HTTP request to retrieve data from
74
+ * remote. This won't be used if `loadFromRemoteFn` is specified.
75
+ */
76
+ httpParams: HttpParams;
77
+ /**
78
+ * Function to load entities from remote.
79
+ */
80
+ loadFromRemoteFn: (injector: Injector) => Observable<TEntity[]>;
81
+ inlineNew: boolean;
82
+ /**
83
+ * Entity name, that is used to form the "New { item }" menu item if
84
+ * inlineNew=true. This is also used as the key of the object in GET response
85
+ * if the reponse JSON is not an array and rather an object, where the values
86
+ * are stored indexed by the server model name. For eg:-
87
+ *
88
+ * {
89
+ * 'customers': [
90
+ * {...},
91
+ * {...},
92
+ * {...},
93
+ * ]
94
+ * }
95
+ */
96
+ entityName: string;
97
+ multiple: boolean;
98
+ group: boolean;
99
+ /**
100
+ * The group object key name under which options are stored. Defaults to
101
+ * 'items' or pluralized 'entityName'. Ideally the client class should
102
+ * explicitly set this property value.
103
+ */
104
+ groupOptionsKey: string;
105
+ /**
106
+ * If groupOptions = true, specify this to provide accurate label for each
107
+ * group. If not specified, group label will be determined by looking up one
108
+ * of the standard fields - name, label or description - whichever comes
109
+ * first.
110
+ */
111
+ groupLabelFn: (group: any) => string;
112
+ /**
113
+ * Sideload data key name.
114
+ */
115
+ sideloadDataKey: import("@angular/core").InputSignal<string | undefined>;
116
+ /**
117
+ * Parser function to return the list of entities from the GET response.
118
+ */
119
+ responseParserFn: import("@angular/core").InputSignal<SPMatSelectEntityResponseParser | undefined>;
120
+ selectionChange: EventEmitter<TEntity | TEntity[]>;
121
+ createNewItemSelected: EventEmitter<void>;
122
+ searchText: string;
123
+ notFoundText: string;
124
+ addItemText: string;
125
+ _sideloadDataKey: import("@angular/core").Signal<string>;
126
+ private _entities;
127
+ private _groupedEntities;
128
+ stateChanges: Subject<void>;
129
+ focused: boolean;
130
+ touched: boolean;
131
+ selectValue: string | number | string[] | number[];
132
+ lastSelectValue: string | number | string[] | number[];
133
+ searching: boolean;
134
+ filterStr: string;
135
+ filter$: BehaviorSubject<string>;
136
+ onChanged: (_: any) => void;
137
+ onTouched: () => void;
138
+ matSelect: MatSelect;
139
+ filteredValues: Subject<TEntity[]>;
140
+ filteredGroupedValues: Subject<EntityGroup<TEntity>[]>;
141
+ destroy: Subject<void>;
142
+ private loaded;
143
+ private load$;
144
+ static nextId: number;
145
+ id: string;
146
+ private _placeholder;
147
+ ngxHelperConfig: import("@smallpearl/ngx-helper/core").SPNgxHelperConfig;
148
+ constructor(http: HttpClient, cdr: ChangeDetectorRef, _elementRef: ElementRef<HTMLElement>, injector: Injector, _formField: MatFormField, ngControl: NgControl, config: SPMatSelectEntityConfig);
149
+ ngOnInit(): void;
150
+ ngOnDestroy(): void;
151
+ ngAfterViewInit(): void;
152
+ private _initStrings;
153
+ addEntity(entity: TEntity): void;
154
+ get selectTriggerValue(): string;
155
+ get selectTriggerValueAsArray(): (string | number)[];
156
+ entityId(entity: TEntity): any;
157
+ writeValue(entityId: string | number | string[] | number[]): void;
158
+ registerOnChange(fn: any): void;
159
+ registerOnTouched(fn: any): void;
160
+ get entities(): TEntity[];
161
+ set entities(items: TEntity[]);
162
+ get value(): string | number | string[] | number[];
163
+ set value(val: string | number | string[] | number[]);
164
+ get shouldLabelFloat(): boolean;
165
+ userAriaDescribedBy: string;
166
+ get placeholder(): string;
167
+ set placeholder(value: string);
168
+ get required(): boolean;
169
+ set required(req: boolean);
170
+ private _required;
171
+ get disabled(): boolean;
172
+ set disabled(value: BooleanInput);
173
+ private _disabled;
174
+ get empty(): boolean;
175
+ get errorState(): boolean;
176
+ onFocusIn(event: FocusEvent): void;
177
+ onFocusOut(event: FocusEvent): void;
178
+ setDescribedByIds(ids: string[]): void;
179
+ onContainerClick(): void;
180
+ setDisabledState(isDisabled: boolean): void;
181
+ onSelectOpened(ev: any): void;
182
+ onSelectionChange(ev: MatSelectChange): void;
183
+ filterValues(search: string): void;
184
+ /**
185
+ * Filtering grouped entities logic works like this. If the search string
186
+ * matches a group label, the entire group is to be included in the results.
187
+ * However, if the search string only matches certain entities, only those
188
+ * groups are to be included and within those groups, only entities whose
189
+ * label matches the search string are to be included in the result set.
190
+ * @param search
191
+ * @returns
192
+ */
193
+ filterGroupedValues(search: string): void;
194
+ loadFromRemote(): Observable<TEntity[] | ((group: EntityGroup<TEntity>) => TEntity[])>;
195
+ groupLabel(group: EntityGroup<TEntity>): string;
196
+ groupEntities(group: EntityGroup<TEntity>): TEntity[];
197
+ groupEntitiesKey(): string;
198
+ private existsInCache;
199
+ private getCacheKey;
200
+ private getFromCache;
201
+ private addToCache;
202
+ private removeFromCache;
203
+ private getHttpReqContext;
204
+ static ɵfac: i0.ɵɵFactoryDeclaration<SPMatSelectEntityComponent<any, any>, [null, null, null, null, { optional: true; }, { optional: true; self: true; }, { optional: true; }]>;
205
+ static ɵcmp: i0.ɵɵComponentDeclaration<SPMatSelectEntityComponent<any, any>, "sp-mat-select-entity", never, { "entityLabelFn": { "alias": "entityLabelFn"; "required": true; }; "entityFilterFn": { "alias": "entityFilterFn"; "required": false; }; "idKey": { "alias": "idKey"; "required": false; }; "url": { "alias": "url"; "required": false; }; "httpParams": { "alias": "httpParams"; "required": false; }; "loadFromRemoteFn": { "alias": "loadFromRemoteFn"; "required": false; }; "inlineNew": { "alias": "inlineNew"; "required": false; }; "entityName": { "alias": "entityName"; "required": false; }; "multiple": { "alias": "multiple"; "required": false; }; "group": { "alias": "group"; "required": false; }; "groupOptionsKey": { "alias": "groupOptionsKey"; "required": false; }; "groupLabelFn": { "alias": "groupLabelFn"; "required": false; }; "sideloadDataKey": { "alias": "sideloadDataKey"; "required": false; "isSignal": true; }; "responseParserFn": { "alias": "responseParserFn"; "required": false; "isSignal": true; }; "searchText": { "alias": "searchText"; "required": false; }; "notFoundText": { "alias": "notFoundText"; "required": false; }; "addItemText": { "alias": "addItemText"; "required": false; }; "entities": { "alias": "entities"; "required": false; }; "value": { "alias": "value"; "required": false; }; "userAriaDescribedBy": { "alias": "aria-describedby"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "required": { "alias": "required"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; }, { "selectionChange": "selectionChange"; "createNewItemSelected": "createNewItemSelected"; }, never, never, true, never>;
206
+ }
207
+ export {};
@@ -0,0 +1,9 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ export interface SPMatSelectEntityConfig {
3
+ i18n: {
4
+ search: string;
5
+ notFound: string;
6
+ addItem: string;
7
+ };
8
+ }
9
+ export declare const SP_MAT_SELECT_ENTITY_CONFIG: InjectionToken<SPMatSelectEntityConfig>;
@@ -0,0 +1,6 @@
1
+ export * from './src/layout.service';
2
+ export * from './src/nav-item';
3
+ export * from './src/mat-menu-list-item.component';
4
+ export * from './src/mat-menu-pane.component';
5
+ export * from './src/mat-menu-layout.component';
6
+ export * from './src/mat-menu-layout.module';
@@ -0,0 +1,23 @@
1
+ import { BreakpointObserver } from '@angular/cdk/layout';
2
+ import { OnDestroy } from '@angular/core';
3
+ import { Router } from '@angular/router';
4
+ import { BehaviorSubject, Subject } from 'rxjs';
5
+ import * as i0 from "@angular/core";
6
+ export interface SideMenuLayoutProps {
7
+ smallScreen: boolean;
8
+ toolbarHeight: number;
9
+ }
10
+ export declare class LayoutService implements OnDestroy {
11
+ breakpointObserver: BreakpointObserver;
12
+ marginTop: number;
13
+ toolbarHeight: number;
14
+ smallScreen: boolean;
15
+ destroy: Subject<void>;
16
+ _previousUrl: string;
17
+ layoutChanged: BehaviorSubject<SideMenuLayoutProps>;
18
+ constructor(breakpointObserver: BreakpointObserver, router: Router);
19
+ ngOnDestroy(): void;
20
+ get previousUrl(): string;
21
+ static ɵfac: i0.ɵɵFactoryDeclaration<LayoutService, never>;
22
+ static ɵprov: i0.ɵɵInjectableDeclaration<LayoutService>;
23
+ }
@@ -0,0 +1,39 @@
1
+ import { ChangeDetectorRef, OnDestroy, OnInit, TemplateRef } from '@angular/core';
2
+ import { MatSidenav } from '@angular/material/sidenav';
3
+ import { Subject } from 'rxjs';
4
+ import { LayoutService, SideMenuLayoutProps } from './layout.service';
5
+ import { NavItem } from './nav-item';
6
+ import * as i0 from "@angular/core";
7
+ export declare class SPMatMenuLayoutComponent implements OnInit, OnDestroy {
8
+ private layoutService;
9
+ private cdr;
10
+ menuNav: MatSidenav;
11
+ layout: SideMenuLayoutProps;
12
+ destroy: Subject<void>;
13
+ containerHeight: number;
14
+ topBottomPadding: number;
15
+ baseUrl: string;
16
+ showBackButton: boolean;
17
+ defaultBackButtonHref: string;
18
+ backButtonText: string;
19
+ brandingImage: string;
20
+ brandingText: string;
21
+ appTitle: string;
22
+ menuTitle: string;
23
+ menuItems: NavItem[];
24
+ menuPaneFooterContent: TemplateRef<any>;
25
+ toolbarEndContent: TemplateRef<any>;
26
+ infoPaneContent: TemplateRef<any>;
27
+ toolbarTitleContent: TemplateRef<any>;
28
+ infoPaneMinWidth: number;
29
+ infoPaneMaxWidth: number;
30
+ contentContainerClass: string;
31
+ showIcons: boolean;
32
+ readonly infoPane: MatSidenav;
33
+ constructor(layoutService: LayoutService, cdr: ChangeDetectorRef);
34
+ ngOnInit(): void;
35
+ ngOnDestroy(): void;
36
+ onToggleMenuPane(): void;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<SPMatMenuLayoutComponent, never>;
38
+ static ɵcmp: i0.ɵɵComponentDeclaration<SPMatMenuLayoutComponent, "sp-mat-menu-layout", never, { "baseUrl": { "alias": "baseUrl"; "required": false; }; "showBackButton": { "alias": "showBackButton"; "required": false; }; "defaultBackButtonHref": { "alias": "defaultBackButtonHref"; "required": false; }; "backButtonText": { "alias": "backButtonText"; "required": false; }; "brandingImage": { "alias": "brandingImage"; "required": false; }; "brandingText": { "alias": "brandingText"; "required": false; }; "appTitle": { "alias": "appTitle"; "required": false; }; "menuTitle": { "alias": "menuTitle"; "required": false; }; "menuItems": { "alias": "menuItems"; "required": false; }; "menuPaneFooterContent": { "alias": "menuPaneFooterContent"; "required": false; }; "toolbarEndContent": { "alias": "toolbarEndContent"; "required": false; }; "infoPaneContent": { "alias": "infoPaneContent"; "required": false; }; "toolbarTitleContent": { "alias": "toolbarTitleContent"; "required": false; }; "infoPaneMinWidth": { "alias": "infoPaneMinWidth"; "required": false; }; "infoPaneMaxWidth": { "alias": "infoPaneMaxWidth"; "required": false; }; "contentContainerClass": { "alias": "contentContainerClass"; "required": false; }; "showIcons": { "alias": "showIcons"; "required": false; }; }, {}, never, never, false, never>;
39
+ }
@@ -0,0 +1,18 @@
1
+ import * as i0 from "@angular/core";
2
+ import * as i1 from "./mat-menu-pane.component";
3
+ import * as i2 from "./mat-menu-list-item.component";
4
+ import * as i3 from "./mat-menu-layout.component";
5
+ import * as i4 from "@angular/common";
6
+ import * as i5 from "@angular/router";
7
+ import * as i6 from "@angular/material/sidenav";
8
+ import * as i7 from "@angular/material/toolbar";
9
+ import * as i8 from "@angular/material/icon";
10
+ import * as i9 from "@angular/material/button";
11
+ import * as i10 from "@angular/material/menu";
12
+ import * as i11 from "@angular/material/dialog";
13
+ import * as i12 from "@angular/material/list";
14
+ export declare class SPMatMenuLayoutModule {
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<SPMatMenuLayoutModule, never>;
16
+ static ɵmod: i0.ɵɵNgModuleDeclaration<SPMatMenuLayoutModule, [typeof i1.SPMatMenuPaneComponent, typeof i2.SPMatMenuListItemComponent, typeof i3.SPMatMenuLayoutComponent], [typeof i4.CommonModule, typeof i5.RouterOutlet, typeof i6.MatSidenavModule, typeof i7.MatToolbarModule, typeof i8.MatIconModule, typeof i9.MatButtonModule, typeof i10.MatMenuModule, typeof i11.MatDialogModule, typeof i12.MatListModule], [typeof i1.SPMatMenuPaneComponent, typeof i2.SPMatMenuListItemComponent, typeof i3.SPMatMenuLayoutComponent]>;
17
+ static ɵinj: i0.ɵɵInjectorDeclaration<SPMatMenuLayoutModule>;
18
+ }
@@ -0,0 +1,36 @@
1
+ import { ChangeDetectorRef, OnDestroy, OnInit, QueryList } from '@angular/core';
2
+ import { MatDialog } from '@angular/material/dialog';
3
+ import { ActivatedRoute, Router } from '@angular/router';
4
+ import { NavItem } from './nav-item';
5
+ import * as i0 from "@angular/core";
6
+ export declare class SPMatMenuListItemComponent implements OnInit, OnDestroy {
7
+ route: ActivatedRoute;
8
+ router: Router;
9
+ private dialog;
10
+ private cdr;
11
+ expanded: boolean;
12
+ highlighted: boolean;
13
+ ariaExpanded: boolean;
14
+ item: NavItem;
15
+ depth: number;
16
+ parent: SPMatMenuListItemComponent;
17
+ showIcon: boolean;
18
+ children: QueryList<SPMatMenuListItemComponent>;
19
+ constructor(route: ActivatedRoute, router: Router, dialog: MatDialog, cdr: ChangeDetectorRef);
20
+ ngOnInit(): void;
21
+ ngOnDestroy(): void;
22
+ get isHighlighted(): boolean;
23
+ toggleHighlight(highlight: boolean): void;
24
+ /**
25
+ * Expand a parent container menu item.
26
+ */
27
+ expand(): void;
28
+ /**
29
+ * Collapse an expanded parent container menu item.
30
+ */
31
+ collapse(): void;
32
+ checkChildrenForHighlight(lastUrlSegment: string): boolean;
33
+ onItemSelected(ev: Event, item: NavItem): void;
34
+ static ɵfac: i0.ɵɵFactoryDeclaration<SPMatMenuListItemComponent, never>;
35
+ static ɵcmp: i0.ɵɵComponentDeclaration<SPMatMenuListItemComponent, "ngx-mat-menu-list-item", never, { "highlighted": { "alias": "highlighted"; "required": false; }; "item": { "alias": "item"; "required": false; }; "depth": { "alias": "depth"; "required": false; }; "parent": { "alias": "parent"; "required": false; }; "showIcon": { "alias": "showIcon"; "required": false; }; }, {}, never, never, false, never>;
36
+ }
@@ -0,0 +1,66 @@
1
+ import { AfterViewInit, ChangeDetectorRef, Injector, OnChanges, OnDestroy, OnInit, SimpleChanges, TemplateRef } from '@angular/core';
2
+ import { MatSidenav } from '@angular/material/sidenav';
3
+ import { Router } from '@angular/router';
4
+ import { Subject } from 'rxjs';
5
+ import { LayoutService, SideMenuLayoutProps } from './layout.service';
6
+ import { SPMatMenuListItemComponent } from './mat-menu-list-item.component';
7
+ import { NavItem } from './nav-item';
8
+ import * as i0 from "@angular/core";
9
+ export declare class SPMatMenuPaneComponent implements OnInit, OnDestroy, AfterViewInit, OnChanges {
10
+ cdr: ChangeDetectorRef;
11
+ private layoutService;
12
+ private router;
13
+ private injector;
14
+ menuTitle: string;
15
+ showBackButton: boolean;
16
+ defaultBackButtonHref: string;
17
+ backButtonText: string;
18
+ menuItems: NavItem[];
19
+ brandingText: string;
20
+ brandingImage: string;
21
+ matSideNav: MatSidenav | undefined;
22
+ appVersion: string;
23
+ menuPaneFooterContent: TemplateRef<any>;
24
+ showIcons: boolean;
25
+ baseUrl: string;
26
+ layout: SideMenuLayoutProps;
27
+ backButtonNavItem: NavItem | undefined;
28
+ destroy: Subject<void>;
29
+ menuItemComps: import("@angular/core").Signal<readonly SPMatMenuListItemComponent[]>;
30
+ menuItemComps$: import("@angular/core").EffectRef;
31
+ constructor(cdr: ChangeDetectorRef, layoutService: LayoutService, router: Router, injector: Injector);
32
+ ngOnInit(): void;
33
+ ngOnDestroy(): void;
34
+ ngOnChanges(changes: SimpleChanges): void;
35
+ ngAfterViewInit(): void;
36
+ /**
37
+ * Highlights the menu item for the specified URL.
38
+ *
39
+ * @param url the full url of the current navigation
40
+ *
41
+ * The way this function works is like this.
42
+ *
43
+ * It first finds the NavItem matching the given URL in url arg. It does
44
+ * this by removing the baseUrl from the url and then comparing the
45
+ * NavItem.route attached to each SPMatMenuListItemComponent. This is done
46
+ * recursively covering all NavItem.children. When a matching NavItem is
47
+ * found, the function goes on to find the SPMatMenuListItemComponent which
48
+ * has this NavItem attached to it. This too is done recursively to find
49
+ * the innermost NavItem with matching URL.
50
+ *
51
+ * When a matching SPMatMenuListItemComponent is found, it first deselects
52
+ * the previous SPMatMenuListItemComponent selection and then goes on to
53
+ * select the newly matched SPMatMenuListItemComponent. If the
54
+ * SPMatMenuListItemComponent is a child of a parent NavItem, the parent
55
+ * NavItem is expanded. Similarly when deselecting the current selection,
56
+ * if it belongs to a parent NavItem and the parent is not shared by the
57
+ * currently matched SPMatMenuListItemComponent, it collapses the parent
58
+ * of the previously selected SPMatMenuListItemComponent. (Quite a mouthful
59
+ * of a sentence, but it's exactly how it works.)
60
+ */
61
+ highlightUrlMenuItem(url: string): void;
62
+ private _curHighlitedMenuItemComp;
63
+ highlightMenuItemComp(menuItemComp: SPMatMenuListItemComponent): void;
64
+ static ɵfac: i0.ɵɵFactoryDeclaration<SPMatMenuPaneComponent, never>;
65
+ static ɵcmp: i0.ɵɵComponentDeclaration<SPMatMenuPaneComponent, "ngx-mat-menu-pane", never, { "menuTitle": { "alias": "menuTitle"; "required": false; }; "showBackButton": { "alias": "showBackButton"; "required": false; }; "defaultBackButtonHref": { "alias": "defaultBackButtonHref"; "required": false; }; "backButtonText": { "alias": "backButtonText"; "required": false; }; "menuItems": { "alias": "menuItems"; "required": false; }; "brandingText": { "alias": "brandingText"; "required": false; }; "brandingImage": { "alias": "brandingImage"; "required": false; }; "matSideNav": { "alias": "matSideNav"; "required": false; }; "appVersion": { "alias": "appVersion"; "required": false; }; "menuPaneFooterContent": { "alias": "menuPaneFooterContent"; "required": false; }; "showIcons": { "alias": "showIcons"; "required": false; }; "baseUrl": { "alias": "baseUrl"; "required": false; }; }, {}, never, never, false, never>;
66
+ }
@@ -0,0 +1,10 @@
1
+ export interface NavItem {
2
+ text: string;
3
+ disabled?: boolean;
4
+ icon?: string;
5
+ iconType?: 'mat' | 'bi' | 'fa';
6
+ route?: string;
7
+ children?: NavItem[];
8
+ backButton?: boolean;
9
+ backHref?: string;
10
+ }
@@ -0,0 +1,18 @@
1
+ # QQMatTelephoneInputComponent (qq-mat-telephone-input)
2
+
3
+ A telephone number input control, which allows selecting the country code and
4
+ entering a national number.
5
+
6
+ # Dependencies
7
+
8
+ * Angular, v15.x
9
+ * Material, v15.x
10
+ * ngx-mat-select-search, v7.x
11
+
12
+ # How to use
13
+
14
+
15
+ # Events
16
+ This control does not raise any events.
17
+
18
+ # Notes
@@ -0,0 +1,2 @@
1
+ export * from './src/providers';
2
+ export * from './src/mat-telephone.component';
@@ -0,0 +1,5 @@
1
+ export declare const COUNTRY_CODES: {
2
+ name: string;
3
+ code: string;
4
+ callingCode: number;
5
+ }[];
@@ -0,0 +1,129 @@
1
+ import { FocusMonitor } from '@angular/cdk/a11y';
2
+ import { BooleanInput } from '@angular/cdk/coercion';
3
+ import { HttpClient } from '@angular/common/http';
4
+ import { ChangeDetectorRef, ElementRef, Injector, OnDestroy, OnInit } from '@angular/core';
5
+ import { AbstractControl, ControlValueAccessor, FormBuilder, FormControl, FormGroup, NgControl } from '@angular/forms';
6
+ import { MatFormField, MatFormFieldControl } from '@angular/material/form-field';
7
+ import { BehaviorSubject, ReplaySubject, Subject } from 'rxjs';
8
+ import { MatSelect, MatSelectChange } from '@angular/material/select';
9
+ import * as i0 from "@angular/core";
10
+ interface CountryInfo {
11
+ name: string;
12
+ code: string;
13
+ callingCode: number;
14
+ }
15
+ /** Data structure for holding telephone number. */
16
+ export declare class ISOTelNumber {
17
+ country: string;
18
+ national: string;
19
+ constructor(country: string, national: string);
20
+ }
21
+ export declare class SPMatTelephoneInputComponent implements OnInit, OnDestroy, ControlValueAccessor, MatFormFieldControl<ISOTelNumber> {
22
+ private injector;
23
+ private cdr;
24
+ private http;
25
+ private _focusMonitor;
26
+ private _elementRef;
27
+ _formField: MatFormField;
28
+ ngControl: NgControl;
29
+ static nextId: number;
30
+ countrySelect: MatSelect;
31
+ nationalInput: ElementRef;
32
+ mobile: boolean;
33
+ allowedCountries: string;
34
+ defaultCountry: string;
35
+ filter$: BehaviorSubject<string>;
36
+ countries$: import("rxjs").Observable<CountryInfo[]>;
37
+ countries: Array<CountryInfo>;
38
+ filteredCountries: ReplaySubject<CountryInfo[]>;
39
+ isDisabled: boolean;
40
+ private _onChange;
41
+ private control;
42
+ private onCountrySelectFocus;
43
+ private onCountrySelectBlur;
44
+ phoneUtil: any;
45
+ parts: FormGroup<{
46
+ country: FormControl<CountryInfo | null>;
47
+ national: FormControl<string | null>;
48
+ }>;
49
+ stateChanges: Subject<void>;
50
+ focused: boolean;
51
+ touched: boolean;
52
+ controlType: string;
53
+ id: string;
54
+ onChange: (_: any) => void;
55
+ onTouched: () => void;
56
+ telForm: FormGroup<{}>;
57
+ /** control for the MatSelect filter keyword */
58
+ countryFilterCtrl: FormControl<string | null>;
59
+ get empty(): boolean;
60
+ get shouldLabelFloat(): boolean;
61
+ userAriaDescribedBy: string;
62
+ get placeholder(): string;
63
+ set placeholder(value: string);
64
+ private _placeholder;
65
+ get required(): boolean;
66
+ set required(value: BooleanInput);
67
+ private _required;
68
+ searchText: string;
69
+ noEntriesFoundLabel: string;
70
+ get disabled(): boolean;
71
+ set disabled(value: BooleanInput);
72
+ private _disabled;
73
+ destroy: Subject<void>;
74
+ get value(): ISOTelNumber | null;
75
+ set value(tel: ISOTelNumber | null);
76
+ get errorState(): boolean;
77
+ onFocusIn(event: FocusEvent): void;
78
+ onFocusOut(event: FocusEvent): void;
79
+ autoFocusNext(control: AbstractControl, nextElement?: HTMLInputElement): void;
80
+ autoFocusPrev(control: AbstractControl, prevElement: HTMLInputElement): void;
81
+ setDescribedByIds(ids: string[]): void;
82
+ onContainerClick(): void;
83
+ constructor(injector: Injector, cdr: ChangeDetectorRef, http: HttpClient, _focusMonitor: FocusMonitor, _elementRef: ElementRef<HTMLElement>, _formField: MatFormField, ngControl: NgControl, formBuilder: FormBuilder);
84
+ ngOnInit(): void;
85
+ protected setInitialValue(): void;
86
+ private filterCountries;
87
+ ngAfterViewInit(): void;
88
+ ngOnDestroy(): void;
89
+ /**
90
+ * Set the country code to the given code.
91
+ *
92
+ * @param code Numeric country code to set the value of the country
93
+ * ion-select to. Will validate the code against a built-in country
94
+ * code list.
95
+ */
96
+ setCountryCode(code: string): void;
97
+ writeValue(telNumber: string): void;
98
+ registerOnChange(fn: any): void;
99
+ registerOnTouched(fn: any): void;
100
+ setDisabledState(isDisabled: boolean): void;
101
+ onCountryChange(ev: MatSelectChange): void;
102
+ onNationalNumberChange(ev: Event): void;
103
+ /**
104
+ * Returns the telephone number in ISO8601 format.
105
+ * @param numberParts
106
+ * @returns
107
+ */
108
+ private ISOTelephoneNumber;
109
+ private notifyChange;
110
+ get placeholderText(): string;
111
+ get hasErrors(): boolean;
112
+ private disableComponents;
113
+ /**
114
+ * Returns the full telephone number, combining the selected
115
+ * country code with the national number.
116
+ *
117
+ * Leading zeros in the national number are removed.
118
+ *
119
+ * Validates the entered number using google-libphonenumber and if
120
+ * invalid, returns an empty string.
121
+ */
122
+ private getTelephoneNumberParts;
123
+ private getAllowedCountries;
124
+ private detectCountry;
125
+ private initCountries;
126
+ static ɵfac: i0.ɵɵFactoryDeclaration<SPMatTelephoneInputComponent, [null, null, null, null, null, { optional: true; }, { optional: true; self: true; }, null]>;
127
+ static ɵcmp: i0.ɵɵComponentDeclaration<SPMatTelephoneInputComponent, "sp-mat-telephone-input", never, { "mobile": { "alias": "mobile"; "required": false; }; "allowedCountries": { "alias": "allowedCountries"; "required": false; }; "defaultCountry": { "alias": "defaultCountry"; "required": false; }; "userAriaDescribedBy": { "alias": "aria-describedby"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "required": { "alias": "required"; "required": false; }; "searchText": { "alias": "searchText"; "required": false; }; "noEntriesFoundLabel": { "alias": "noEntriesFoundLabel"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "value": { "alias": "value"; "required": false; }; }, {}, never, never, true, never>;
128
+ }
129
+ export {};
@@ -0,0 +1,38 @@
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { InjectionToken } from '@angular/core';
3
+ import { Observable } from 'rxjs';
4
+ export interface QQMatTelephoneInputConfig {
5
+ /**
6
+ * Provider function to detect geographi location and return it
7
+ * to the control. If implemented, the control would call this
8
+ * function during initialization and auto-select the
9
+ * country returned.
10
+ * @param http
11
+ * @returns
12
+ */
13
+ getCountryCode?: (http: HttpClient) => Observable<{
14
+ ip: string;
15
+ countryCode: string;
16
+ regionCode: string;
17
+ city: string;
18
+ }>;
19
+ /**
20
+ * When user explicitly selects a country from the country
21
+ * drop down, this function will be called giving the client a chance
22
+ * to save it either to a persistent storage or a session variable.
23
+ */
24
+ saveCountrySelection?: (countryInfo: {
25
+ code: string;
26
+ name: string;
27
+ callingCode: number;
28
+ }) => Promise<void>;
29
+ /**
30
+ * Countries supported by the telephone control. The string is a
31
+ * regex pattern that will be used to filter supported countries.
32
+ * So if you specify ".*", it'll list all countries of the world.
33
+ * "TW|SG|MY" restricts the coutries list to Taiwan, Singapore &
34
+ * Malaysia.
35
+ */
36
+ countries?: string;
37
+ }
38
+ export declare const QQMAT_TELEPHONE_INPUT_CONFIG_PROVIDER: InjectionToken<QQMatTelephoneInputConfig>;
@@ -0,0 +1,2 @@
1
+ /** Version of the ngx-helper library */
2
+ export declare const VERSION = "0.1.0";