@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,267 @@
1
+ import { HttpClient, HttpContextToken } from '@angular/common/http';
2
+ import { AfterViewInit, EventEmitter, Injector, QueryList, TemplateRef } from '@angular/core';
3
+ import { MatSnackBar } from '@angular/material/snack-bar';
4
+ import { MatColumnDef } from '@angular/material/table';
5
+ import { SPContextMenuItem } from '@smallpearl/ngx-helper/mat-context-menu';
6
+ import { SPMatEntityListComponent } from '@smallpearl/ngx-helper/mat-entity-list';
7
+ import { DomSanitizer } from '@angular/platform-browser';
8
+ import { SPEntityFieldSpec } from '@smallpearl/ngx-helper/entity-field';
9
+ import { Observable, Subscription } from 'rxjs';
10
+ import { FormViewHostComponent } from './form-view-host.component';
11
+ import { SPMatEntityCrudComponentBase } from './mat-entity-crud-internal-types';
12
+ import { ALLOW_ITEM_ACTION_FN, CRUD_OP_FN, NewItemSubType, SPMatEntityCrudConfig, SPMatEntityCrudResponseParser } from './mat-entity-crud-types';
13
+ import { PreviewHostComponent } from './preview-host.component';
14
+ import * as i0 from "@angular/core";
15
+ export declare class SPMatEntityCrudComponent<TEntity extends {
16
+ [P in IdKey]: PropertyKey;
17
+ }, IdKey extends string = 'id'> extends SPMatEntityListComponent<TEntity, IdKey> implements SPMatEntityCrudComponentBase<TEntity>, AfterViewInit {
18
+ private snackBar;
19
+ itemLabel: import("@angular/core").InputSignal<string | undefined>;
20
+ itemLabelPlural: import("@angular/core").InputSignal<string | undefined>;
21
+ /**
22
+ * Title string displayed above the component. If not specified, will use
23
+ * itemLabelPlural() as the title.
24
+ */
25
+ title: import("@angular/core").InputSignal<string | undefined>;
26
+ /**
27
+ *
28
+ */
29
+ itemActions: import("@angular/core").InputSignal<SPContextMenuItem[]>;
30
+ /**
31
+ * Specify the list of router paths that will be set as the value for
32
+ * [routerLink] for the 'New {{ item }}' button. If not specified,
33
+ * if createEditTemplate is specified, it will be shown. If not, `action`
34
+ * out event will be raised with `{ role: '_new_' }`.
35
+ */
36
+ newItemLink: import("@angular/core").InputSignal<string | string[] | undefined>;
37
+ /**
38
+ * If not specified, will use label from SPMatEntityCrudConfig.i18n.newItemLabel.
39
+ */
40
+ newItemLabel: import("@angular/core").InputSignal<string | string[] | undefined>;
41
+ /**
42
+ * Text for the Edit <item> pane title
43
+ */
44
+ editItemTitle: import("@angular/core").InputSignal<string | undefined>;
45
+ /**
46
+ * If you want "New {{item}}" button to support multiple entity types,
47
+ * you can set this to `NewItemSubType[]`, where each element stands for for
48
+ * a dropdown menu item. Refer to `NewItemSubType` for details on this
49
+ * interface.
50
+ */
51
+ newItemSubTypes: import("@angular/core").InputSignal<NewItemSubType[] | undefined>;
52
+ /**
53
+ * If you want to take control of the network operations for the CRUD
54
+ * operations (GET/CREATE/UPDATE/DELETE), provide a value for this property.
55
+ */
56
+ crudOpFn: import("@angular/core").InputSignal<CRUD_OP_FN<TEntity, IdKey> | undefined>;
57
+ /**
58
+ * Item preview template.
59
+ */
60
+ previewTemplate: import("@angular/core").InputSignal<TemplateRef<any> | undefined>;
61
+ /**
62
+ * Whether to allow a context menu action or not. Return false to disable
63
+ * the action.
64
+ */
65
+ allowEntityActionFn: import("@angular/core").InputSignal<ALLOW_ITEM_ACTION_FN<TEntity> | undefined>;
66
+ /**
67
+ * A template that allows the header to be replaced. Usage:-
68
+ *
69
+ * ```
70
+ * <sp-map-entity-crud
71
+ * [headerTemplate]="myCrudViewHeader"
72
+ * ></sp-map-entity-crud>
73
+ * <ng-template #myCrudViewHeader>...</ng-template>
74
+ * ```
75
+ */
76
+ headerTemplate: import("@angular/core").InputSignal<TemplateRef<any> | undefined>;
77
+ /**
78
+ * Set this to the custom template identifier that will replace the
79
+ * "New {{Item}}" button portion. This template will expand towards the
80
+ * title which will be placed to its left (right in rtl).
81
+ *
82
+ * ```
83
+ * <sp-map-entity-crud
84
+ * [actionsTemplate]="myCrudActions"
85
+ * ></sp-map-entity-crud>
86
+ * <ng-template #myCrudActions>...</ng-template>
87
+ * ```
88
+ */
89
+ actionsTemplate: import("@angular/core").InputSignal<TemplateRef<any> | undefined>;
90
+ /**
91
+ * CRUD action response parser. This will be called with the response
92
+ * from CREATE & UPDATE operations to parse the response JSON and return
93
+ * the created/updated TEntity.
94
+ */
95
+ crudResponseParser: import("@angular/core").InputSignal<SPMatEntityCrudResponseParser | undefined>;
96
+ /**
97
+ * An ng-template name that contains the component which provides the
98
+ * create/edit CRUD action.
99
+ *
100
+ * ```
101
+ * <ng-template #createEdit let-data>
102
+ * <app-create-edit-entity-demo [bridge]="data.bridge" [entity]="data.entity"></app-create-edit-entity-demo>
103
+ * </ng-template>
104
+ * ```
105
+ * Note how [bridge] & [entity] properties are set deriving them from the
106
+ * implicit template context. [entity] will be undefined for Create
107
+ * opreation and will be the valid entity for an Update.
108
+ * (app-create-edit-entity-demo here is the client code that implements the
109
+ * Create/Edit form)
110
+ */
111
+ createEditFormTemplate: import("@angular/core").InputSignal<TemplateRef<any> | null>;
112
+ /**
113
+ * Disables the per item actions column, preventing 'Edit' & 'Delete'
114
+ * (and other user defined) item operations.
115
+ */
116
+ disableItemActions: import("@angular/core").InputSignal<boolean>;
117
+ /**
118
+ * Disables the Create function.
119
+ */
120
+ disableCreate: import("@angular/core").InputSignal<boolean>;
121
+ /**
122
+ * View refresh policy after a CREATE/UPDATE operation. Values
123
+ * 'none' - Objects are not refreshed after an edit operation. The return
124
+ * value of the edit operation is used as the object to
125
+ * add/update the component's internal store. This is the default.
126
+ * 'object' - Refresh just the object that was returned from the
127
+ * CREATE/UPDATE operation. Use this if the JSON object returned
128
+ * after a successful CREATE/UPDATE op differs from the JSON
129
+ * object returned for the GET request.
130
+ * 'all' - Refresh the entire list after a CREATE/UPDATE operation. This
131
+ * mimics the behaviour of legacy HTML apps with pure server
132
+ * defined UI.
133
+ */
134
+ refreshAfterEdit: import("@angular/core").InputSignal<"object" | "none" | "all">;
135
+ /**
136
+ * HttpContext for crud requests - list, create, retrieve, update & delete.
137
+ * The value can be an object where the property names reflect the CRUD
138
+ * methods with each of these keys taking
139
+ * `[[HttpContextToken<any>, any]] | [HttpContextToken<any>, any]` as its
140
+ * value. This object has a special key 'crud', which if given a value for,
141
+ * would be used for all CRUD requests (CREATE|READ|UPDATE|DELETE).
142
+ *
143
+ * Alternatively the property can be set a
144
+ * `[[HttpContextToken<any>, any]] | [HttpContextToken<any>, any]` as its
145
+ * value, in which case the same context would be used for all HTTP requests.
146
+ */
147
+ crudHttpReqContext: import("@angular/core").InputSignal<[HttpContextToken<any>, any] | [[HttpContextToken<any>, any]] | {
148
+ create?: [[HttpContextToken<any>, any]] | [HttpContextToken<any>, any];
149
+ retrieve?: [[HttpContextToken<any>, any]] | [HttpContextToken<any>, any];
150
+ update?: [[HttpContextToken<any>, any]] | [HttpContextToken<any>, any];
151
+ delete?: [[HttpContextToken<any>, any]] | [HttpContextToken<any>, any];
152
+ } | undefined>;
153
+ /**
154
+ * Width of the edit pane as a percentange of the overall <as-split> width.
155
+ */
156
+ editPaneWidth: import("@angular/core").InputSignal<number>;
157
+ /**
158
+ * Width of the preview pane as a percentange of the overall <as-split> width.
159
+ */
160
+ previewPaneWidth: import("@angular/core").InputSignal<number>;
161
+ private getLabel;
162
+ _itemLabel: import("@angular/core").Signal<string>;
163
+ _itemLabelPlural: import("@angular/core").Signal<string>;
164
+ _title: import("@angular/core").Signal<string | undefined>;
165
+ _endpointSansParams: import("@angular/core").Signal<string>;
166
+ _endpointParams: import("@angular/core").Signal<void>;
167
+ componentColumns: import("@angular/core").Signal<readonly MatColumnDef[]>;
168
+ _clientColumnDefs: QueryList<MatColumnDef>;
169
+ /**
170
+ * Event raised for user selecting an item action. It's also raised
171
+ * for 'New <Item>' action, if 'newItemLink' property is not set.
172
+ */
173
+ action: EventEmitter<{
174
+ role: string;
175
+ entity?: TEntity;
176
+ }>;
177
+ /**
178
+ * Event raised when create Create/Edit pane is activated & deactivated.
179
+ * Event contains two flags:-
180
+ * activated - whether the createEdit form view was activated or
181
+ * deactivated.
182
+ * cancelled - whether the form view was cancelled by user. False for this
183
+ * indicates that the form view was closed after a successful
184
+ * edit operation.
185
+ */
186
+ entityViewPaneActivated: EventEmitter<{
187
+ activated: boolean;
188
+ cancelled: boolean | undefined;
189
+ mode: "edit" | "preview";
190
+ }>;
191
+ busyWheelId: string;
192
+ sub$: Subscription;
193
+ spEntitiesList: import("@angular/core").Signal<SPMatEntityListComponent<TEntity, IdKey> | undefined>;
194
+ crudConfig: SPMatEntityCrudConfig;
195
+ createEditHostComponent: import("@angular/core").Signal<FormViewHostComponent<any> | undefined>;
196
+ createEditViewActive: import("@angular/core").WritableSignal<boolean>;
197
+ canCancelEditCallback: () => boolean;
198
+ previewHostComponent: import("@angular/core").Signal<PreviewHostComponent<any> | undefined>;
199
+ previewActive: import("@angular/core").Signal<boolean>;
200
+ previewedEntity: import("@angular/core").WritableSignal<TEntity | undefined>;
201
+ entityPaneActive: import("@angular/core").Signal<boolean>;
202
+ entityPaneWidth: import("@angular/core").Signal<number>;
203
+ entitiesPaneWidth: import("@angular/core").Signal<number>;
204
+ entitiesPaneHidden: import("@angular/core").Signal<boolean>;
205
+ defaultItemCrudActions: import("@angular/core").WritableSignal<SPContextMenuItem[]>;
206
+ columnsWithAction: import("@angular/core").Signal<(string | SPEntityFieldSpec<TEntity, IdKey>)[]>;
207
+ _itemActions: import("@angular/core").Signal<SPContextMenuItem[]>;
208
+ visibleColumns: import("@angular/core").Signal<string[]>;
209
+ constructor(http: HttpClient, snackBar: MatSnackBar, sanitizer: DomSanitizer, injector: Injector);
210
+ ngOnInit(): void;
211
+ ngOnDestroy(): void;
212
+ ngAfterViewInit(): void;
213
+ /**
214
+ * If the create/edit entity form is active, it calls its registered
215
+ * canCancelEdit callback to determine if it's okay to cancel the edit.
216
+ * You can use this method from the host component's router guard to
217
+ * ensure that any changes made to the form are not accidentally lost by
218
+ * navigating away from the CRUD page.
219
+ *
220
+ * If your CRUD page has multiple sp-mat-entity-crud components, you have to
221
+ * implement the logic to call this method on the appropriate component.
222
+ *
223
+ * If the the create/edit form is not active, this method returns true.
224
+ * @returns
225
+ */
226
+ canDeactivate(): boolean;
227
+ refresh(): void;
228
+ closeCreateEdit(cancelled: boolean): void;
229
+ canCancelEdit(): boolean;
230
+ registerCanCancelEditCallback(callback: () => boolean): void;
231
+ triggerEntityUpdate(entity: TEntity): void;
232
+ triggerEntityDelete(entity: TEntity): void;
233
+ create(entityValue: any): Observable<any>;
234
+ update(id: TEntity[IdKey], entityValue: any): Observable<any>;
235
+ /**
236
+ * Refresh the entity list, after a CRUD CREATE or UPDATE operation.
237
+ * @param resp This is the response from the CRUD operation (CREATE/UPDATE).
238
+ * @param method The CRUD operation post which REFRESH is requested.
239
+ * @returns Observable<TEntity|null>
240
+ */
241
+ doRefreshAfterEdit(resp: any, method: 'create' | 'update'): Observable<any>;
242
+ getCrudOpResponseParser(): SPMatEntityCrudResponseParser;
243
+ closePreview(): void;
244
+ private closePreviewImpl;
245
+ onItemAction(role: string, entity: TEntity): void;
246
+ onCreate(event: Event): void;
247
+ onUpdate(entity: TEntity): void;
248
+ /**
249
+ * Show the create/edit component. This is deliberately made public so as to
250
+ * be callable from the client. This allows the client to dynamically
251
+ * set the form edit template and then show the edit pane by calling this
252
+ * method.
253
+ * @param entity
254
+ * @param params
255
+ */
256
+ showCreateEditView(entity?: TEntity | undefined, params?: any): void;
257
+ showPreviewView(entity?: TEntity, params?: any): void;
258
+ hidePreviewView(): void;
259
+ onDelete(entity: TEntity): Promise<void>;
260
+ getUrl(endpoint: string): string;
261
+ getEntityUrl(entityId: TEntity[IdKey]): string;
262
+ handleSelectEntity(entity: TEntity | undefined): void;
263
+ handleNewItemSubType(subtype: NewItemSubType): void;
264
+ private getCrudReqHttpContext;
265
+ static ɵfac: i0.ɵɵFactoryDeclaration<SPMatEntityCrudComponent<any, any>, never>;
266
+ static ɵcmp: i0.ɵɵComponentDeclaration<SPMatEntityCrudComponent<any, any>, "sp-mat-entity-crud", never, { "itemLabel": { "alias": "itemLabel"; "required": false; "isSignal": true; }; "itemLabelPlural": { "alias": "itemLabelPlural"; "required": false; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "itemActions": { "alias": "itemActions"; "required": false; "isSignal": true; }; "newItemLink": { "alias": "newItemLink"; "required": false; "isSignal": true; }; "newItemLabel": { "alias": "newItemLabel"; "required": false; "isSignal": true; }; "editItemTitle": { "alias": "editItemTitle"; "required": false; "isSignal": true; }; "newItemSubTypes": { "alias": "newItemSubTypes"; "required": false; "isSignal": true; }; "crudOpFn": { "alias": "crudOpFn"; "required": false; "isSignal": true; }; "previewTemplate": { "alias": "previewTemplate"; "required": false; "isSignal": true; }; "allowEntityActionFn": { "alias": "allowEntityActionFn"; "required": false; "isSignal": true; }; "headerTemplate": { "alias": "headerTemplate"; "required": false; "isSignal": true; }; "actionsTemplate": { "alias": "actionsTemplate"; "required": false; "isSignal": true; }; "crudResponseParser": { "alias": "crudResponseParser"; "required": false; "isSignal": true; }; "createEditFormTemplate": { "alias": "createEditFormTemplate"; "required": false; "isSignal": true; }; "disableItemActions": { "alias": "disableItemActions"; "required": false; "isSignal": true; }; "disableCreate": { "alias": "disableCreate"; "required": false; "isSignal": true; }; "refreshAfterEdit": { "alias": "refreshAfterEdit"; "required": false; "isSignal": true; }; "crudHttpReqContext": { "alias": "crudHttpReqContext"; "required": false; "isSignal": true; }; "editPaneWidth": { "alias": "editPaneWidth"; "required": false; "isSignal": true; }; "previewPaneWidth": { "alias": "previewPaneWidth"; "required": false; "isSignal": true; }; }, { "action": "action"; "entityViewPaneActivated": "entityViewPaneActivated"; }, ["_clientColumnDefs"], ["[breadCrumbs]"], true, never>;
267
+ }
@@ -0,0 +1,19 @@
1
+ import { EmbeddedViewRef, OnDestroy, OnInit, TemplateRef, ViewContainerRef } from '@angular/core';
2
+ import { SPMatEntityCrudComponentBase } from './mat-entity-crud-internal-types';
3
+ import * as i0 from "@angular/core";
4
+ export declare class PreviewHostComponent<TEntity> implements OnInit, OnDestroy {
5
+ vc: import("@angular/core").Signal<ViewContainerRef | undefined>;
6
+ entityCrudComponentBase: import("@angular/core").InputSignal<SPMatEntityCrudComponentBase<TEntity>>;
7
+ clientViewTemplate: import("@angular/core").InputSignal<TemplateRef<any> | null>;
8
+ entity: import("@angular/core").WritableSignal<TEntity | undefined>;
9
+ clientView: EmbeddedViewRef<any> | null;
10
+ constructor();
11
+ ngOnInit(): void;
12
+ ngOnDestroy(): void;
13
+ show(entity: TEntity | undefined, params?: any): void;
14
+ close(): void;
15
+ private createClientView;
16
+ destroyClientView(): void;
17
+ static ɵfac: i0.ɵɵFactoryDeclaration<PreviewHostComponent<any>, never>;
18
+ static ɵcmp: i0.ɵɵComponentDeclaration<PreviewHostComponent<any>, "sp-entity-crud-preview-host", never, { "entityCrudComponentBase": { "alias": "entityCrudComponentBase"; "required": true; "isSignal": true; }; "clientViewTemplate": { "alias": "clientViewTemplate"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
19
+ }
@@ -0,0 +1,27 @@
1
+ import { OnDestroy, OnInit } from '@angular/core';
2
+ import { SPMatEntityCrudComponentBase } from './mat-entity-crud-internal-types';
3
+ import { SPMatEntityCrudConfig } from './mat-entity-crud-types';
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * A preview pane container to provide a consistent UX for all preview panes.
7
+ * It consits of a toolbar on the top and a container div below that takes up
8
+ * the rest of the preview pane area.
9
+ */
10
+ export declare class SPMatEntityCrudPreviewPaneComponent<TEntity> implements OnInit, OnDestroy {
11
+ entity: import("@angular/core").InputSignal<TEntity>;
12
+ entityCrudComponent: import("@angular/core").InputSignal<SPMatEntityCrudComponentBase<TEntity>>;
13
+ title: import("@angular/core").InputSignal<string | undefined>;
14
+ disableUpdate: import("@angular/core").InputSignal<boolean>;
15
+ hideUpdate: import("@angular/core").InputSignal<boolean>;
16
+ disableDelete: import("@angular/core").InputSignal<boolean>;
17
+ hideDelete: import("@angular/core").InputSignal<boolean>;
18
+ config: SPMatEntityCrudConfig;
19
+ constructor();
20
+ ngOnInit(): void;
21
+ ngOnDestroy(): void;
22
+ onEdit(): void;
23
+ onDelete(): void;
24
+ onClose(): void;
25
+ static ɵfac: i0.ɵɵFactoryDeclaration<SPMatEntityCrudPreviewPaneComponent<any>, never>;
26
+ static ɵcmp: i0.ɵɵComponentDeclaration<SPMatEntityCrudPreviewPaneComponent<any>, "sp-mat-entity-crud-preview-pane", never, { "entity": { "alias": "entity"; "required": true; "isSignal": true; }; "entityCrudComponent": { "alias": "entityCrudComponent"; "required": true; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "disableUpdate": { "alias": "disableUpdate"; "required": false; "isSignal": true; }; "hideUpdate": { "alias": "hideUpdate"; "required": false; "isSignal": true; }; "disableDelete": { "alias": "disableDelete"; "required": false; "isSignal": true; }; "hideDelete": { "alias": "hideDelete"; "required": false; "isSignal": true; }; }, {}, never, ["[previewToolbarContent]", "[previewContent]"], true, never>;
27
+ }
@@ -0,0 +1,3 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { SPMatEntityCrudConfig } from './mat-entity-crud-types';
3
+ export declare const SP_MAT_ENTITY_CRUD_CONFIG: InjectionToken<SPMatEntityCrudConfig>;
@@ -0,0 +1,3 @@
1
+ export * from './src/mat-entity-list-types';
2
+ export * from './src/providers';
3
+ export * from './src/mat-entity-list.component';
@@ -0,0 +1,6 @@
1
+ import { SPMatEntityListConfig } from './mat-entity-list-types';
2
+ export declare const DefaultSPMatEntityListConfig: SPMatEntityListConfig;
3
+ /**
4
+ * To be called from an object's constructor.
5
+ */
6
+ export declare function getEntityListConfig(): SPMatEntityListConfig;
@@ -0,0 +1,53 @@
1
+ import { HttpContextToken } from "@angular/common/http";
2
+ import { Observable } from "rxjs";
3
+ export interface SPMatEntityListHttpContext {
4
+ entityName: string;
5
+ entityNamePlural: string;
6
+ endpoint: string;
7
+ }
8
+ export declare const SP_MAT_ENTITY_LIST_HTTP_CONTEXT: HttpContextToken<SPMatEntityListHttpContext>;
9
+ /**
10
+ * Pagination HTTP request params. Actually copied from Angular's HttpParams
11
+ * declaration. The ReadonlyArray<string|number|boolean> is a bit of an
12
+ * overkill for pagination params, but what the heck. When you copy-paste,
13
+ * do it in full!
14
+ */
15
+ export type SPPageParams = {
16
+ [param: string]: string | number | boolean | ReadonlyArray<string | number | boolean>;
17
+ };
18
+ /**
19
+ * An interface that the clients should provide, either via a global config
20
+ * (see above), that handles parsing the GET response and returns the entities
21
+ * stored therein. This class will allow the entity-list component to be
22
+ * used across different pagination response types as long as the appropriate
23
+ * SPMatEntityListPaginator class is provided to the component.
24
+ */
25
+ export interface SPMatEntityListPaginator {
26
+ getRequestPageParams: (endpoint: string, pageIndex: number, pageSize: number) => SPPageParams;
27
+ parseRequestResponse: <TEntity extends {
28
+ [P in IdKey]: PropertyKey;
29
+ }, IdKey extends string = 'id'>(entityName: string, entityNamePlural: string, endpoint: string, params: SPPageParams, resp: any) => {
30
+ total: number;
31
+ entities: TEntity[];
32
+ };
33
+ }
34
+ /**
35
+ * 'entity' is really TEntity arg of SPMatEntityListComponent<TEntity>.
36
+ * 'column' is the column name. This allows the same value function to support
37
+ * multiple columns further enabing DRY.
38
+ */
39
+ export type COLUMN_VALUE_FN = (entity: any, column: string) => string | number | Date | boolean;
40
+ /**
41
+ * Global config for SPMatEntityList component.
42
+ */
43
+ export interface SPMatEntityListConfig {
44
+ urlResolver?: (endpoint: string) => string;
45
+ paginator?: SPMatEntityListPaginator;
46
+ defaultPageSize?: number;
47
+ pageSizes?: Array<number>;
48
+ }
49
+ /**
50
+ * Type for custom entities loader function, which if provided will be called
51
+ * instead of HttpClient.get.
52
+ */
53
+ export type SPMatEntityListEntityLoaderFn = (params: any) => Observable<any>;
@@ -0,0 +1,209 @@
1
+ import { HttpClient, HttpContext, HttpContextToken } from '@angular/common/http';
2
+ import { AfterViewInit, ElementRef, EventEmitter, Injector, OnDestroy, OnInit, QueryList } from '@angular/core';
3
+ import { PageEvent } from '@angular/material/paginator';
4
+ import { MatSort } from '@angular/material/sort';
5
+ import { MatColumnDef, MatTable, MatTableDataSource } from '@angular/material/table';
6
+ import { DomSanitizer } from '@angular/platform-browser';
7
+ import { SPEntityField, SPEntityFieldSpec } from '@smallpearl/ngx-helper/entity-field';
8
+ import { Observable, Subscription } from 'rxjs';
9
+ import { SPMatEntityListEntityLoaderFn, SPMatEntityListPaginator } from './mat-entity-list-types';
10
+ import * as i0 from "@angular/core";
11
+ export declare class HeaderAlignmentDirective implements AfterViewInit {
12
+ private el;
13
+ headerAlignment: import("@angular/core").InputSignal<string | undefined>;
14
+ constructor(el: ElementRef);
15
+ ngAfterViewInit(): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<HeaderAlignmentDirective, never>;
17
+ static ɵdir: i0.ɵɵDirectiveDeclaration<HeaderAlignmentDirective, "[headerAlignment]", never, { "headerAlignment": { "alias": "headerAlignment"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
18
+ }
19
+ /**
20
+ * A component to display a list of entities loaded from remote.
21
+ */
22
+ export declare class SPMatEntityListComponent<TEntity extends {
23
+ [P in IdKey]: PropertyKey;
24
+ }, IdKey extends string = 'id'> implements OnInit, OnDestroy, AfterViewInit {
25
+ protected http: HttpClient;
26
+ private sanitizer;
27
+ private injector;
28
+ entityName: import("@angular/core").InputSignal<string>;
29
+ entityNamePlural: import("@angular/core").InputSignal<string | undefined>;
30
+ /**
31
+ * The endpoint from where the entities are to be retrieved
32
+ */
33
+ endpoint: import("@angular/core").InputSignal<string>;
34
+ /**
35
+ * Custom entities loader function, which if provided will be called
36
+ * instead of HttpClient.get.
37
+ */
38
+ entityLoaderFn: import("@angular/core").InputSignal<SPMatEntityListEntityLoaderFn | undefined>;
39
+ /**
40
+ * The columns of the entity to be displayed. This is an array of
41
+ * SPEntityFieldSpec objects. If there's a one-to-one mapping between the
42
+ * column's field name, its title & the rendered value, a string can be
43
+ * specified instead. That is, the value of this property is a heterogeneous
44
+ * array consisting of SPEntityFieldSpec<> objects and strings.
45
+ */
46
+ columns: import("@angular/core").InputSignal<(string | SPEntityFieldSpec<TEntity, IdKey>)[]>;
47
+ /**
48
+ * Names of columns that are displayed. This will default to all the columns
49
+ * listed in columns.
50
+ */
51
+ displayedColumns: import("@angular/core").InputSignal<string[]>;
52
+ /**
53
+ * Number of entities per page. If this is not set and paginator is defined,
54
+ * the number of entities int in the first request, will be taken as the
55
+ * page size.
56
+ */
57
+ pageSize: import("@angular/core").InputSignal<number>;
58
+ /**
59
+ * Entity idKey, if idKey is different from the default 'id'.
60
+ */
61
+ idKey: import("@angular/core").InputSignal<string>;
62
+ /**
63
+ * Type of pagination -- continuous or discrete. 'infinite' pagination
64
+ * uses an 'infiniteScroll' and 'discrete' pagination uses a mat-paginator
65
+ * at the bottom to navigate between pages.
66
+ */
67
+ pagination: import("@angular/core").InputSignal<"infinite" | "discrete" | "none">;
68
+ /**
69
+ * Component specific paginator. Only used if pagination != 'none'.
70
+ */
71
+ paginator: import("@angular/core").InputSignal<SPMatEntityListPaginator | undefined>;
72
+ /**
73
+ *
74
+ */
75
+ sorter: import("@angular/core").InputSignal<MatSort | undefined>;
76
+ /**
77
+ * Disable sorting of rows
78
+ */
79
+ disableSort: import("@angular/core").InputSignal<boolean>;
80
+ /**
81
+ * Wrappers for infiniteScroll properties, for customization by the client
82
+ */
83
+ infiniteScrollContainer: import("@angular/core").InputSignal<any>;
84
+ infiniteScrollDistance: import("@angular/core").InputSignal<number>;
85
+ infiniteScrollThrottle: import("@angular/core").InputSignal<number>;
86
+ infiniteScrollWindow: import("@angular/core").InputSignal<boolean>;
87
+ /**
88
+ * Custom context to be set for HttpClient requests. In the client code
89
+ * specify this property by initializing a member variable as:
90
+
91
+ ```
92
+ Component({
93
+ ...
94
+ template: `
95
+ <sp-mat-entity-list
96
+ [httpReqContext]="httpReqContext"
97
+ ></sp-mat-entity-list>
98
+ `
99
+ })
100
+ export class YourComponent {
101
+ httpReqContext: [HttpContextToken<any>, any] = [
102
+ SIDELOAD_TO_COMPOSITE_PARAMS, 'customers'
103
+ ];
104
+ }
105
+ ```
106
+ *
107
+ * Of course if you want to pass multiple context properties, declare the type
108
+ * as an array of array. That is, `[[HttpContextToken<any>, any]]` and
109
+ * initialize it appropriately.
110
+ */
111
+ httpReqContext: import("@angular/core").InputSignal<[HttpContextToken<any>, any] | [[HttpContextToken<any>, any]] | undefined>;
112
+ _entityNamePlural: import("@angular/core").Signal<string | undefined>;
113
+ _httpReqContext: import("@angular/core").Signal<HttpContext>;
114
+ _deferViewInit: import("@angular/core").InputSignal<boolean>;
115
+ firstLoadDone: boolean;
116
+ allColumnNames: import("@angular/core").WritableSignal<string[]>;
117
+ _displayedColumns: import("@angular/core").Signal<string[]>;
118
+ dataSource: import("@angular/core").WritableSignal<MatTableDataSource<TEntity, import("@angular/material/paginator").MatPaginator>>;
119
+ table: import("@angular/core").Signal<MatTable<any> | undefined>;
120
+ sort: import("@angular/core").Signal<MatSort | undefined>;
121
+ viewColumnDefs: import("@angular/core").Signal<readonly MatColumnDef[]>;
122
+ clientColumnDefs: QueryList<MatColumnDef>;
123
+ contentColumnDefs: MatColumnDef[];
124
+ subs$: Subscription;
125
+ entityCount: import("@angular/core").WritableSignal<number>;
126
+ pageIndex: import("@angular/core").WritableSignal<number>;
127
+ lastFetchedEntitiesCount: import("@angular/core").WritableSignal<number>;
128
+ _pageSize: import("@angular/core").Signal<number>;
129
+ _columns: import("@angular/core").Signal<SPEntityFieldSpec<TEntity, IdKey>[]>;
130
+ __columns: import("@angular/core").Signal<SPEntityField<TEntity, IdKey>[]>;
131
+ store: import("@ngneat/elf").Store<{
132
+ name: string;
133
+ state: {
134
+ entities: Record<TEntity[IdKey], TEntity>;
135
+ ids: TEntity[IdKey][];
136
+ };
137
+ config: {
138
+ idKey: IdKey;
139
+ };
140
+ }, {
141
+ entities: Record<TEntity[IdKey], TEntity>;
142
+ ids: TEntity[IdKey][];
143
+ }>;
144
+ entities$: Observable<TEntity[]>;
145
+ _paginator: SPMatEntityListPaginator | undefined;
146
+ loading: import("@angular/core").WritableSignal<boolean>;
147
+ hasMore: import("@angular/core").WritableSignal<boolean>;
148
+ activeEntity: import("@angular/core").WritableSignal<TEntity | undefined>;
149
+ activeEntityId: import("@angular/core").Signal<any>;
150
+ _prevActiveEntity: TEntity | undefined;
151
+ _activeEntityChange: import("@angular/core").EffectRef;
152
+ selectEntity: EventEmitter<TEntity | undefined>;
153
+ ngxHelperConfig: import("@smallpearl/ngx-helper/core").SPNgxHelperConfig;
154
+ fieldConfig: import("@smallpearl/ngx-helper/entity-field").SPEntityFieldConfig;
155
+ entityListConfig: import("./mat-entity-list-types").SPMatEntityListConfig;
156
+ endpointChanged: import("@angular/core").EffectRef;
157
+ constructor(http: HttpClient, sanitizer: DomSanitizer, injector: Injector);
158
+ ngOnInit(): void;
159
+ ngOnDestroy(): void;
160
+ ngAfterViewInit(): void;
161
+ /**
162
+ * Clear all entities in store and reload them from endpoint as if
163
+ * the entities are being loaded for the first time.
164
+ */
165
+ refresh(): void;
166
+ addEntity(entity: TEntity): void;
167
+ /**
168
+ * Update an entity with a modified version. Can be used by CRUD UPDATE
169
+ * operation to update an entity in the local store that is used to as the
170
+ * source of MatTableDataSource.
171
+ * @param id
172
+ * @param entity
173
+ */
174
+ updateEntity(id: TEntity[IdKey], entity: TEntity): void;
175
+ /**
176
+ * Clients can call this method when it has deleted and entity via a CRUD
177
+ * operation. Depending on the pagination mode, MatEntityList implements
178
+ * an appropriate behavior.
179
+ *
180
+ * If the pagination is 'infinite', the relevent entity is removed from our
181
+ * entity list. View will be repained as data store has changed.
182
+ *
183
+ * If the pagination is 'discrete', the entity is removed from the page.
184
+ * If this is the only entity in the page, the current pageNumber is
185
+ * decremented by 1 if it's possible (if the current pageNumber > 1).
186
+ * The page is reloaded from remote.
187
+ */
188
+ removeEntity(id: TEntity[IdKey]): void;
189
+ /**
190
+ * Build the contentColumnDefs array by enumerating all of client's projected
191
+ * content with matColumnDef directive.
192
+ */
193
+ buildContentColumnDefs(): void;
194
+ /**
195
+ * Build the effective columns by parsing our own <ng-container matColumnDef>
196
+ * statements for each column in columns() property and client's
197
+ * <ng-container matColumnDef> provided via content projection.
198
+ */
199
+ buildColumns(): void;
200
+ setupSort(): void;
201
+ infiniteScrollLoadNextPage(ev: any): void;
202
+ loadMoreEntities(): void;
203
+ private findArrayInResult;
204
+ handlePageEvent(e: PageEvent): void;
205
+ getUrl(endpoint: string): string;
206
+ toggleActiveEntity(entity: TEntity | undefined): void;
207
+ static ɵfac: i0.ɵɵFactoryDeclaration<SPMatEntityListComponent<any, any>, never>;
208
+ static ɵcmp: i0.ɵɵComponentDeclaration<SPMatEntityListComponent<any, any>, "sp-mat-entity-list", never, { "entityName": { "alias": "entityName"; "required": true; "isSignal": true; }; "entityNamePlural": { "alias": "entityNamePlural"; "required": false; "isSignal": true; }; "endpoint": { "alias": "endpoint"; "required": false; "isSignal": true; }; "entityLoaderFn": { "alias": "entityLoaderFn"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": true; "isSignal": true; }; "displayedColumns": { "alias": "displayedColumns"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "idKey": { "alias": "idKey"; "required": false; "isSignal": true; }; "pagination": { "alias": "pagination"; "required": false; "isSignal": true; }; "paginator": { "alias": "paginator"; "required": false; "isSignal": true; }; "sorter": { "alias": "sorter"; "required": false; "isSignal": true; }; "disableSort": { "alias": "disableSort"; "required": false; "isSignal": true; }; "infiniteScrollContainer": { "alias": "infiniteScrollContainer"; "required": false; "isSignal": true; }; "infiniteScrollDistance": { "alias": "infiniteScrollDistance"; "required": false; "isSignal": true; }; "infiniteScrollThrottle": { "alias": "infiniteScrollThrottle"; "required": false; "isSignal": true; }; "infiniteScrollWindow": { "alias": "infiniteScrollWindow"; "required": false; "isSignal": true; }; "httpReqContext": { "alias": "httpReqContext"; "required": false; "isSignal": true; }; "_deferViewInit": { "alias": "_deferViewInit"; "required": false; "isSignal": true; }; }, { "selectEntity": "selectEntity"; }, ["clientColumnDefs"], never, true, never>;
209
+ }
@@ -0,0 +1,3 @@
1
+ import { InjectionToken } from '@angular/core';
2
+ import { SPMatEntityListConfig } from './mat-entity-list-types';
3
+ export declare const SP_MAT_ENTITY_LIST_CONFIG: InjectionToken<SPMatEntityListConfig>;