@decaf-ts/for-angular 0.0.25 → 0.0.27

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 (78) hide show
  1. package/fesm2022/decaf-ts-for-angular.mjs +1486 -1505
  2. package/fesm2022/decaf-ts-for-angular.mjs.map +1 -1
  3. package/index.d.ts +7482 -3
  4. package/package.json +15 -18
  5. package/components/component-renderer/component-renderer.component.d.ts +0 -278
  6. package/components/crud-field/crud-field.component.d.ts +0 -611
  7. package/components/crud-form/constants.d.ts +0 -5
  8. package/components/crud-form/crud-form.component.d.ts +0 -288
  9. package/components/crud-form/types.d.ts +0 -17
  10. package/components/empty-state/empty-state.component.d.ts +0 -300
  11. package/components/fieldset/fieldset.component.d.ts +0 -555
  12. package/components/filter/filter.component.d.ts +0 -514
  13. package/components/for-angular-components.module.d.ts +0 -20
  14. package/components/index.d.ts +0 -16
  15. package/components/layout/layout.component.d.ts +0 -110
  16. package/components/list/list.component.d.ts +0 -848
  17. package/components/list-item/list-item.component.d.ts +0 -390
  18. package/components/model-renderer/model-renderer.component.d.ts +0 -97
  19. package/components/pagination/constants.d.ts +0 -7
  20. package/components/pagination/pagination.component.d.ts +0 -264
  21. package/components/searchbar/searchbar.component.d.ts +0 -407
  22. package/components/stepped-form/stepped-form.component.d.ts +0 -255
  23. package/directives/collapsable.directive.d.ts +0 -9
  24. package/directives/index.d.ts +0 -1
  25. package/engine/DynamicModule.d.ts +0 -17
  26. package/engine/NgxBaseComponent.d.ts +0 -541
  27. package/engine/NgxCrudFormField.d.ts +0 -123
  28. package/engine/NgxFormService.d.ts +0 -601
  29. package/engine/NgxRenderingEngine.d.ts +0 -282
  30. package/engine/ValidatorFactory.d.ts +0 -15
  31. package/engine/constants.d.ts +0 -168
  32. package/engine/decorators.d.ts +0 -25
  33. package/engine/index.d.ts +0 -18
  34. package/engine/interfaces.d.ts +0 -271
  35. package/engine/types.d.ts +0 -200
  36. package/esm2022/components/component-renderer/component-renderer.component.mjs +0 -321
  37. package/esm2022/components/crud-field/crud-field.component.mjs +0 -518
  38. package/esm2022/components/crud-form/constants.mjs +0 -14
  39. package/esm2022/components/crud-form/crud-form.component.mjs +0 -259
  40. package/esm2022/components/crud-form/types.mjs +0 -2
  41. package/esm2022/components/empty-state/empty-state.component.mjs +0 -345
  42. package/esm2022/components/fieldset/fieldset.component.mjs +0 -677
  43. package/esm2022/components/filter/filter.component.mjs +0 -700
  44. package/esm2022/components/for-angular-components.module.mjs +0 -84
  45. package/esm2022/components/index.mjs +0 -20
  46. package/esm2022/components/layout/layout.component.mjs +0 -150
  47. package/esm2022/components/list/list.component.mjs +0 -1238
  48. package/esm2022/components/list-item/list-item.component.mjs +0 -405
  49. package/esm2022/components/model-renderer/model-renderer.component.mjs +0 -144
  50. package/esm2022/components/pagination/constants.mjs +0 -2
  51. package/esm2022/components/pagination/pagination.component.mjs +0 -321
  52. package/esm2022/components/searchbar/searchbar.component.mjs +0 -491
  53. package/esm2022/components/stepped-form/stepped-form.component.mjs +0 -306
  54. package/esm2022/decaf-ts-for-angular.mjs +0 -5
  55. package/esm2022/directives/collapsable.directive.mjs +0 -29
  56. package/esm2022/directives/index.mjs +0 -2
  57. package/esm2022/engine/DynamicModule.mjs +0 -18
  58. package/esm2022/engine/NgxBaseComponent.mjs +0 -541
  59. package/esm2022/engine/NgxCrudFormField.mjs +0 -137
  60. package/esm2022/engine/NgxFormService.mjs +0 -917
  61. package/esm2022/engine/NgxRenderingEngine.mjs +0 -376
  62. package/esm2022/engine/ValidatorFactory.mjs +0 -106
  63. package/esm2022/engine/constants.mjs +0 -170
  64. package/esm2022/engine/decorators.mjs +0 -38
  65. package/esm2022/engine/index.mjs +0 -19
  66. package/esm2022/engine/interfaces.mjs +0 -4
  67. package/esm2022/engine/types.mjs +0 -2
  68. package/esm2022/for-angular-common.module.mjs +0 -84
  69. package/esm2022/helpers/index.mjs +0 -13
  70. package/esm2022/helpers/utils.mjs +0 -436
  71. package/esm2022/i18n/Loader.mjs +0 -86
  72. package/esm2022/i18n/data/en.json +0 -85
  73. package/esm2022/public-apis.mjs +0 -15
  74. package/for-angular-common.module.d.ts +0 -50
  75. package/helpers/index.d.ts +0 -12
  76. package/helpers/utils.d.ts +0 -279
  77. package/i18n/Loader.d.ts +0 -43
  78. package/public-apis.d.ts +0 -14
@@ -1,541 +0,0 @@
1
- import { ElementRef, OnChanges, SimpleChanges, EventEmitter } from '@angular/core';
2
- import { KeyValue, RendererCustomEvent, StringOrBoolean } from './types';
3
- import { Model } from '@decaf-ts/decorator-validation';
4
- import { CrudOperations } from '@decaf-ts/db-decorators';
5
- import { NgxRenderingEngine } from './NgxRenderingEngine';
6
- import { Logger } from '@decaf-ts/logging';
7
- import { DecafRepository } from './types';
8
- import * as i0 from "@angular/core";
9
- /**
10
- * @description Base component class that provides common functionality for all Decaf components.
11
- * @summary The NgxBaseComponent serves as the foundation for all Decaf UI components, providing
12
- * shared functionality for localization, element references, and styling. This abstract class
13
- * implements common properties and methods that are used across the component library, ensuring
14
- * consistent behavior and reducing code duplication. Components that extend this class inherit
15
- * its capabilities for handling translations, accessing DOM elements, and applying custom styling.
16
- *
17
- * @template M - The model type that this component works with
18
- * @param {string} instance - The component instance token used for identification
19
- * @param {string} locale - The locale to be used for translations
20
- * @param {StringOrBoolean} translatable - Whether the component should be translated
21
- * @param {string} className - Additional CSS classes to apply to the component
22
- * @param {"ios" | "md" | undefined} mode - Component platform style
23
- *
24
- * @component NgxBaseComponent
25
- * @example
26
- * ```typescript
27
- * @Component({
28
- * selector: 'app-my-component',
29
- * templateUrl: './my-component.component.html',
30
- * styleUrls: ['./my-component.component.scss']
31
- * })
32
- * export class MyComponent extends NgxBaseComponent {
33
- * constructor(@Inject('instanceToken') instance: string) {
34
- * super(instance);
35
- * }
36
- *
37
- * ngOnInit() {
38
- * this.initialize();
39
- * // Component-specific initialization
40
- * }
41
- * }
42
- * ```
43
- * @mermaid
44
- * sequenceDiagram
45
- * participant App as Application
46
- * participant Comp as Component
47
- * participant Base as NgxBaseComponent
48
- * participant Engine as NgxRenderingEngine
49
- *
50
- * App->>Comp: Create component
51
- * Comp->>Base: super(instance)
52
- * Base->>Base: Set componentName & componentLocale
53
- *
54
- * App->>Comp: Set @Input properties
55
- * Comp->>Base: ngOnChanges(changes)
56
- *
57
- * alt model changed
58
- * Base->>Base: getModel(model)
59
- * Base->>Engine: getDecorators(model, {})
60
- * Engine-->>Base: Return decorator metadata
61
- * Base->>Base: Configure mapper and item
62
- * Base->>Base: getLocale(translatable)
63
- * else locale/translatable changed
64
- * Base->>Base: getLocale(translatable)
65
- * end
66
- *
67
- * App->>Comp: ngOnInit()
68
- * Comp->>Base: initialize()
69
- * Base->>Base: Set initialized flag
70
- */
71
- export declare abstract class NgxBaseComponent implements OnChanges {
72
- protected instance: string;
73
- /**
74
- * @description Reference to the component's element.
75
- * @summary Provides direct access to the native DOM element of the component through Angular's
76
- * ViewChild decorator. This reference can be used to manipulate the DOM element directly,
77
- * apply custom styles, or access native element properties and methods. The element is
78
- * identified by the 'component' template reference variable.
79
- *
80
- * @type {ElementRef}
81
- * @memberOf NgxBaseComponent
82
- */
83
- component: ElementRef;
84
- /**
85
- * @description The name of the component.
86
- * @summary Stores the name of the component, which is typically derived from the class name.
87
- * This property is used internally for various purposes such as logging, deriving the default
88
- * locale, and potentially for component identification in debugging or error reporting.
89
- *
90
- * The `componentName` is set during the component's initialization process and should not
91
- * be modified externally. It's marked as protected to allow access in derived classes while
92
- * preventing direct access from outside the component hierarchy.
93
- *
94
- * @type {string}
95
- * @protected
96
- * @memberOf NgxBaseComponent
97
- *
98
- * @example
99
- * // Inside a derived component class
100
- * console.log(this.componentName); // Outputs: "MyCustomComponent"
101
- */
102
- componentName: string;
103
- /**
104
- * @description Unique identifier for the renderer.
105
- * @summary A unique identifier used to reference the component's renderer instance.
106
- * This can be used for targeting specific renderer instances when multiple components
107
- * are present on the same page.
108
- *
109
- * @type {string}
110
- * @memberOf NgxBaseComponent
111
- */
112
- rendererId: string;
113
- /**
114
- * @description Repository model for data operations.
115
- * @summary The data model repository that this component will use for CRUD operations.
116
- * This provides a connection to the data layer for retrieving and manipulating data.
117
- *
118
- * @type {Model| undefined}
119
- * @memberOf NgxBaseComponent
120
- */
121
- model: Model | undefined;
122
- /**
123
- * @description The repository for interacting with the data model.
124
- * @summary Provides a connection to the data layer for retrieving and manipulating data.
125
- * This is an instance of the `DecafRepository` class from the `@decaf-ts/core` package,
126
- * which is initialized in the `repository` getter method.
127
- *
128
- * The repository is used to perform CRUD (Create, Read, Update, Delete) operations on the
129
- * data model, such as fetching data, creating new items, updating existing items, and deleting
130
- * items. It also provides methods for querying and filtering data based on specific criteria.
131
- *
132
- * @type {DecafRepository<Model>}
133
- * @private
134
- * @memberOf NgxBaseComponent
135
- */
136
- protected _repository?: DecafRepository<Model>;
137
- /**
138
- * @description Dynamic properties configuration object.
139
- * @summary Contains key-value pairs of dynamic properties that can be applied to the component
140
- * at runtime. This flexible configuration object allows for dynamic property assignment without
141
- * requiring explicit input bindings for every possible configuration option. Properties from
142
- * this object are parsed and applied to the component instance through the parseProps method,
143
- * enabling customizable component behavior based on external configuration.
144
- *
145
- * @type {Record<string, unknown>}
146
- * @default {}
147
- * @memberOf NgxBaseComponent
148
- */
149
- props: Record<string, unknown>;
150
- /**
151
- * @description Configuration for list item rendering
152
- * @summary Defines how list items should be rendered in the component.
153
- * This property holds a configuration object that specifies the tag name
154
- * and other properties needed to render list items correctly. The tag property
155
- * identifies which component should be used to render each item in a list.
156
- * Additional properties can be included to customize the rendering behavior.
157
- *
158
- * @type {Record<string, unknown>}
159
- * @default {tag: ""}
160
- * @memberOf NgxBaseComponent
161
- */
162
- item: Record<string, unknown>;
163
- /**
164
- * @description Primary key field name for the model.
165
- * @summary Specifies which field in the model should be used as the primary key.
166
- * This is typically used for identifying unique records in operations like update and delete.
167
- *
168
- * @type {string}
169
- * @default 'id'
170
- * @memberOf NgxBaseComponent
171
- */
172
- pk: string;
173
- /**
174
- * @description Base route for navigation related to this component.
175
- * @summary Defines the base route path used for navigation actions related to this component.
176
- * This is often used as a prefix for constructing navigation URLs.
177
- *
178
- * @type {string}
179
- * @memberOf NgxBaseComponent
180
- */
181
- route: string;
182
- /**
183
- * @description Available CRUD operations for this component.
184
- * @summary Defines which CRUD operations (Create, Read, Update, Delete) are available
185
- * for this component. This affects which operations can be performed on the data.
186
- *
187
- * @default [OperationKeys.READ]
188
- * @memberOf NgxBaseComponent
189
- */
190
- operations: CrudOperations[];
191
- /**
192
- * @description Unique identifier for the current record.
193
- * @summary A unique identifier for the current record being displayed or manipulated.
194
- * This is typically used in conjunction with the primary key for operations on specific records.
195
- *
196
- * @type {string | number}
197
- * @memberOf NgxBaseComponent
198
- */
199
- uid: string | number;
200
- /**
201
- * @description Field mapping configuration.
202
- * @summary Defines how fields from the data model should be mapped to properties used by the component.
203
- * This allows for flexible data binding between the model and the component's display logic.
204
- *
205
- * @type {Record<string, string>}
206
- * @memberOf NgxBaseComponent
207
- */
208
- mapper: Record<string, string>;
209
- /**
210
- * @description The locale to be used for translations.
211
- * @summary Specifies the locale identifier to use when translating component text.
212
- * This can be set explicitly via input property to override the automatically derived
213
- * locale from the component name. The locale is typically a language code (e.g., 'en', 'fr')
214
- * or a language-region code (e.g., 'en-US', 'fr-CA') that determines which translation
215
- * set to use for the component's text content.
216
- *
217
- * @type {string}
218
- * @memberOf NgxBaseComponent
219
- */
220
- locale: string;
221
- /**
222
- * @description Determines if the component should be translated.
223
- * @summary Controls whether the component's text content should be processed for translation.
224
- * When true, the component will attempt to translate text using the specified locale.
225
- * When false, text is displayed as-is without translation. This property accepts either
226
- * a boolean value or a string that can be converted to a boolean (e.g., 'true', 'false', '1', '0').
227
- *
228
- * @type {StringOrBoolean}
229
- * @default false
230
- * @memberOf NgxBaseComponent
231
- */
232
- translatable: StringOrBoolean;
233
- /**
234
- * @description Additional CSS class names to apply to the component.
235
- * @summary Allows custom CSS classes to be added to the component's root element.
236
- * These classes are appended to any automatically generated classes based on other
237
- * component properties. Multiple classes can be provided as a space-separated string.
238
- * This provides a way to customize the component's appearance beyond the built-in styling options.
239
- *
240
- * @type {string}
241
- * @default ""
242
- * @memberOf NgxBaseComponent
243
- */
244
- className: string;
245
- /**
246
- * @description Component platform style.
247
- * @summary Controls the visual appearance of the component based on platform design guidelines.
248
- * The 'ios' mode follows iOS design patterns, while 'md' (Material Design) follows Android/Google
249
- * design patterns. This property affects various visual aspects such as animations, form elements,
250
- * and icons. Setting this property allows components to maintain platform-specific styling
251
- * for a more native look and feel.
252
- *
253
- * @type {("ios" | "md" | undefined)}
254
- * @default "md"
255
- * @memberOf NgxBaseComponent
256
- */
257
- mode: 'ios' | 'md' | undefined;
258
- /**
259
- * @description The locale derived from the component's class name.
260
- * @summary Stores the automatically derived locale based on the component's class name.
261
- * This is determined during component initialization and serves as a fallback when no
262
- * explicit locale is provided via the locale input property. The derivation is handled
263
- * by the getLocaleContext utility function, which extracts a locale identifier
264
- * from the component's class name.
265
- *
266
- * @type {string}
267
- * @memberOf NgxBaseComponent
268
- */
269
- componentLocale: string;
270
- /**
271
- * @description Controls whether child components should be rendered
272
- * @summary Determines if child components should be rendered by the component.
273
- * This can be set to a boolean value or a string that can be converted to a boolean.
274
- * When true, child components defined in the model will be rendered. When false,
275
- * child components will be skipped. This provides control over the rendering depth.
276
- *
277
- * @type {string | StringOrBoolean}
278
- * @default true
279
- * @memberOf NgxBaseComponent
280
- */
281
- renderChild: string | StringOrBoolean;
282
- /**
283
- * @description Flag indicating if the component has been initialized
284
- * @summary Tracks whether the component has completed its initialization process.
285
- * This flag is used to prevent duplicate initialization and to determine if
286
- * certain operations that require initialization can be performed.
287
- *
288
- * @type {boolean}
289
- * @default false
290
- */
291
- initialized: boolean;
292
- /**
293
- * @description Event emitter for custom renderer events.
294
- * @summary Emits custom events that occur within child components or the layout itself.
295
- * This allows parent components to listen for and respond to user interactions or
296
- * state changes within the grid layout. Events are passed up the component hierarchy
297
- * to enable coordinated behavior across the application.
298
- *
299
- * @type {EventEmitter<RendererCustomEvent>}
300
- * @memberOf NgxBaseComponent
301
- */
302
- listenEvent: EventEmitter<RendererCustomEvent>;
303
- /**
304
- * @description Reference to the rendering engine instance
305
- * @summary Provides access to the NgxRenderingEngine singleton instance,
306
- * which handles the rendering of components based on model definitions.
307
- * This engine is used to extract decorator metadata and render child components.
308
- *
309
- * @type {NgxRenderingEngine}
310
- */
311
- renderingEngine: NgxRenderingEngine;
312
- /**
313
- * @description Logger instance for the component.
314
- * @summary Provides logging capabilities for the component, allowing for consistent
315
- * and structured logging of information, warnings, and errors. This logger is initialized
316
- * in the ngOnInit method using the getLogger function from the ForAngularCommonModule.
317
- *
318
- * The logger is used throughout the component to record important events, debug information,
319
- * and potential issues. It helps in monitoring the component's behavior, tracking the flow
320
- * of operations, and facilitating easier debugging and maintenance.
321
- *
322
- * @type {Logger}
323
- * @private
324
- * @memberOf NgxBaseComponent
325
- */
326
- logger: Logger;
327
- /**
328
- * @description Creates an instance of NgxBaseComponent.
329
- * @summary Initializes a new instance of the base component with the provided instance token.
330
- * This constructor sets up the fundamental properties required by all Decaf components,
331
- * including the component name, locale settings, and logging capabilities. The instance
332
- * token is used for component identification and locale derivation.
333
- *
334
- * The constructor performs the following initialization steps:
335
- * 1. Sets the componentName from the provided instance token
336
- * 2. Derives the componentLocale from the class name using utility functions
337
- * 3. Initializes the logger instance for the component
338
- *
339
- * @param {string} instance - The component instance token used for identification
340
- *
341
- * @mermaid
342
- * sequenceDiagram
343
- * participant A as Angular
344
- * participant C as Component
345
- * participant B as NgxBaseComponent
346
- * participant U as Utils
347
- * participant L as Logger
348
- *
349
- * A->>C: new Component(instance)
350
- * C->>B: super(instance)
351
- * B->>B: Set componentName = instance
352
- * B->>U: getLocaleContext(instance)
353
- * U-->>B: Return derived locale
354
- * B->>B: Set componentLocale
355
- * B->>L: getLogger(this)
356
- * L-->>B: Return logger instance
357
- * B->>B: Set logger
358
- *
359
- * @memberOf NgxBaseComponent
360
- */
361
- protected constructor(instance: string);
362
- /**
363
- * @description Getter for the repository instance.
364
- * @summary Provides a connection to the data layer for retrieving and manipulating data.
365
- * This method initializes the `_repository` property if it is not already set, ensuring
366
- * that a single instance of the repository is used throughout the component.
367
- *
368
- * The repository is used to perform CRUD operations on the data model, such as fetching data,
369
- * creating new items, updating existing items, and deleting items. It also provides methods
370
- * for querying and filtering data based on specific criteria.
371
- *
372
- * @returns {DecafRepository<Model>} The initialized repository instance.
373
- * @private
374
- * @memberOf NgxBaseComponent
375
- */
376
- protected get repository(): DecafRepository<Model>;
377
- /**
378
- * @description Handles changes to component inputs
379
- * @summary This Angular lifecycle hook is called when input properties change.
380
- * It responds to changes in the model, locale, or translatable properties by
381
- * updating the component's internal state accordingly. When the model changes,
382
- * it calls getModel to process the new model and getLocale to update the locale.
383
- * When locale or translatable properties change, it calls getLocale to update
384
- * the translation settings.
385
- *
386
- * @param {SimpleChanges} changes - Object containing changed properties
387
- * @return {void}
388
- */
389
- ngOnChanges(changes: SimpleChanges): void;
390
- /**
391
- * @description Gets the appropriate locale string based on the translatable flag and available locales.
392
- * @summary Determines which locale string to use for translation based on the translatable flag
393
- * and available locale settings. This method first converts the translatable parameter to a boolean
394
- * using the stringToBoolean utility function. If translatable is false, it returns an empty string,
395
- * indicating no translation should be performed. If translatable is true, it checks for an explicitly
396
- * provided locale via the locale property. If no explicit locale is available, it falls back to the
397
- * componentLocale derived from the component's class name.
398
- *
399
- * @param {StringOrBoolean} translatable - Whether the component should be translated
400
- * @return {string} The locale string to use for translation, or empty string if not translatable
401
- *
402
- * @mermaid
403
- * sequenceDiagram
404
- * participant C as Component
405
- * participant N as NgxBaseComponent
406
- * participant S as StringUtils
407
- *
408
- * C->>N: getLocale(translatable)
409
- * N->>S: stringToBoolean(translatable)
410
- * S-->>N: Return boolean value
411
- * N->>N: Store in this.translatable
412
- * alt translatable is false
413
- * N-->>C: Return empty string
414
- * else translatable is true
415
- * alt this.locale is defined
416
- * N-->>C: Return this.locale
417
- * else this.locale is not defined
418
- * N-->>C: Return this.componentLocale
419
- * end
420
- * end
421
- */
422
- getLocale(translatable: StringOrBoolean): string;
423
- /**
424
- * @description Gets the route for the component
425
- * @summary Retrieves the route path for the component, generating one based on the model
426
- * if no route is explicitly set. This method checks if a route is already defined, and if not,
427
- * it creates a default route based on the model's constructor name. The generated route follows
428
- * the pattern '/model/{ModelName}'. This is useful for automatic routing in CRUD operations.
429
- *
430
- * @return {string} The route path for the component, or empty string if no route is available
431
- */
432
- getRoute(): string;
433
- /**
434
- * @description Resolves and sets the component's model
435
- * @summary Processes the provided model parameter, which can be either a Model instance
436
- * or a string identifier. If a string is provided, it attempts to resolve the actual model
437
- * from the injectables registry. After resolving the model, it calls setModelDefinitions
438
- * to configure the component based on the model's metadata.
439
- *
440
- * @param {string | Model} model - The model instance or identifier string
441
- * @return {void}
442
- */
443
- getModel(model: string | Model): void;
444
- /**
445
- * @description Configures component properties based on model metadata
446
- * @summary Extracts and applies configuration from the model's decorators to set up
447
- * the component. This method uses the rendering engine to retrieve decorator metadata
448
- * from the model, then configures the component's mapper and item properties accordingly.
449
- * It ensures the route is properly set and merges various properties from the model's
450
- * metadata into the component's configuration.
451
- *
452
- * @param {Model} model - The model to extract configuration from
453
- * @return {void}
454
- */
455
- setModelDefinitions(model: Model): void;
456
- /**
457
- * @description Initializes the component
458
- * @summary Performs one-time initialization of the component. This method checks if
459
- * the component has already been initialized to prevent duplicate initialization.
460
- * When called for the first time, it sets the initialized flag to true and logs
461
- * an initialization message with the component name. This method is typically called
462
- * during the component's lifecycle setup.
463
- */
464
- initialize(parseProps?: boolean, skip?: string[]): Promise<void>;
465
- /**
466
- * @description Handles custom events from child components.
467
- * @summary Receives events from child renderer components and forwards them to parent
468
- * components through the listenEvent output. This creates an event propagation chain
469
- * that allows events to bubble up through the component hierarchy, enabling coordinated
470
- * responses to user interactions across the layout structure.
471
- *
472
- * @param {RendererCustomEvent} event - The custom event from a child component
473
- * @return {void}
474
- *
475
- * @mermaid
476
- * sequenceDiagram
477
- * participant C as Child Component
478
- * participant L as NgxBaseComponent
479
- * participant P as Parent Component
480
- *
481
- * C->>L: Emit RendererCustomEvent
482
- * L->>L: handleEvent(event)
483
- * L->>P: listenEvent.emit(event)
484
- * Note over P: Handle event in parent
485
- *
486
- * @memberOf NgxBaseComponent
487
- */
488
- handleEvent(event: RendererCustomEvent): void;
489
- /**
490
- * @description Tracks items in ngFor loops for optimal change detection.
491
- * @summary Provides a tracking function for Angular's *ngFor directive to optimize rendering
492
- * performance. This method generates unique identifiers for list items based on their index
493
- * and content, allowing Angular to efficiently track changes and minimize DOM manipulations
494
- * during list updates. The tracking function is essential for maintaining component state
495
- * and preventing unnecessary re-rendering of unchanged items.
496
- *
497
- * @param {number} index - The index of the item in the list
498
- * @param {KeyValue | string | number} item - The item data to track
499
- * @returns {string | number} A unique identifier for the item
500
- * @memberOf NgxBaseComponent
501
- */
502
- trackItemFn(index: number, item: KeyValue | string | number): string | number;
503
- /**
504
- * @description Parses and applies properties from the props object to the component instance.
505
- * @summary This method iterates through the properties of the provided instance object
506
- * and applies any matching properties from the component's props configuration to the
507
- * component instance. This allows for dynamic property assignment based on configuration
508
- * stored in the props object, enabling flexible component customization without requiring
509
- * explicit property binding for every possible configuration option.
510
- *
511
- * The method performs a safe property assignment by checking if each key from the instance
512
- * exists in the props object before applying it. This prevents accidental property
513
- * overwriting and ensures only intended properties are modified.
514
- *
515
- * @param {KeyValue} instance - The component instance object to process
516
- * @return {void}
517
- *
518
- * @mermaid
519
- * sequenceDiagram
520
- * participant C as Component
521
- * participant B as NgxBaseComponent
522
- * participant P as Props Object
523
- *
524
- * C->>B: parseProps(instance)
525
- * B->>B: Get Object.keys(instance)
526
- * loop For each key in instance
527
- * B->>P: Check if key exists in this.props
528
- * alt Key exists in props
529
- * B->>B: Set this[key] = this.props[key]
530
- * else Key not in props
531
- * Note over B: Skip this key
532
- * end
533
- * end
534
- *
535
- * @protected
536
- * @memberOf NgxBaseComponent
537
- */
538
- protected parseProps(instance: KeyValue, skip: string[]): void;
539
- static ɵfac: i0.ɵɵFactoryDeclaration<NgxBaseComponent, never>;
540
- static ɵcmp: i0.ɵɵComponentDeclaration<NgxBaseComponent, "ng-component", never, { "rendererId": { "alias": "rendererId"; "required": false; }; "model": { "alias": "model"; "required": false; }; "props": { "alias": "props"; "required": false; }; "item": { "alias": "item"; "required": false; }; "pk": { "alias": "pk"; "required": false; }; "route": { "alias": "route"; "required": false; }; "operations": { "alias": "operations"; "required": false; }; "uid": { "alias": "uid"; "required": false; }; "mapper": { "alias": "mapper"; "required": false; }; "locale": { "alias": "locale"; "required": false; }; "translatable": { "alias": "translatable"; "required": false; }; "className": { "alias": "className"; "required": false; }; "mode": { "alias": "mode"; "required": false; }; "renderChild": { "alias": "renderChild"; "required": false; }; }, { "listenEvent": "listenEvent"; }, never, never, true, never>;
541
- }
@@ -1,123 +0,0 @@
1
- import { CrudOperationKeys, FieldProperties } from '@decaf-ts/ui-decorators';
2
- import { PossibleInputTypes } from './types';
3
- import { CrudOperations } from '@decaf-ts/db-decorators';
4
- import { ControlValueAccessor, FormControl, FormGroup } from '@angular/forms';
5
- import { ElementRef } from '@angular/core';
6
- import { TranslateService } from '@ngx-translate/core';
7
- /**
8
- * @class NgxCrudFormField
9
- * @implements {FieldProperties}
10
- * @implements {ControlValueAccessor}
11
- * @summary Abstract class representing a CRUD form field for Angular applications
12
- * @description This class provides the base implementation for CRUD form fields in Angular,
13
- * implementing both CrudFormField and ControlValueAccessor interfaces.
14
- */
15
- export declare abstract class NgxCrudFormField implements ControlValueAccessor, FieldProperties {
16
- /**
17
- * @summary Reference to the component's element
18
- * @description ElementRef representing the component's native element
19
- */
20
- component: ElementRef;
21
- /**
22
- * @summary Current CRUD operation
23
- * @description Represents the current CRUD operation being performed
24
- */
25
- operation: CrudOperations;
26
- /**
27
- * @summary Form group for the field
28
- * @description Angular FormGroup instance for the field
29
- */
30
- formGroup: FormGroup | undefined;
31
- formControl: FormControl;
32
- name: string;
33
- path: string;
34
- childOf?: string;
35
- type: PossibleInputTypes;
36
- disabled?: boolean;
37
- uid?: string;
38
- page: number;
39
- format?: string;
40
- hidden?: boolean | CrudOperationKeys[];
41
- max?: number | Date;
42
- maxlength?: number;
43
- min?: number | Date;
44
- minlength?: number;
45
- pattern?: string | undefined;
46
- readonly?: boolean;
47
- required?: boolean;
48
- step?: number;
49
- equals?: string;
50
- different?: string;
51
- lessThan?: string;
52
- lessThanOrEqual?: string;
53
- greaterThan?: string;
54
- greaterThanOrEqual?: string;
55
- value: string | number | Date;
56
- multiple: boolean;
57
- protected translateService: TranslateService;
58
- private validationErrorEventDispateched;
59
- /**
60
- * @summary Parent HTML element
61
- * @description Reference to the parent HTML element of the field
62
- */
63
- protected parent?: HTMLElement;
64
- /**
65
- * @summary String formatting function
66
- * @description Provides access to the sf function for error message formatting
67
- * @prop {function(string, ...string): string} sf - String formatting function
68
- */
69
- sf: typeof import("@decaf-ts/decorator-validation").stringFormat;
70
- /**
71
- * @summary Change callback function
72
- * @description Function called when the field value changes
73
- * @property {function(): unknown} onChange - onChange event handler
74
- */
75
- onChange: () => unknown;
76
- /**
77
- * @summary Touch callback function
78
- * @description Function called when the field is touched
79
- * @property {function(): unknown} onTouch - onTouch event handler
80
- */
81
- onTouch: () => unknown;
82
- /**
83
- * @summary Write value to the field
84
- * @description Sets the value of the field
85
- * @param {string} obj - The value to be set
86
- */
87
- writeValue(obj: string): void;
88
- /**
89
- * @summary Register change callback
90
- * @description Registers a function to be called when the field value changes
91
- * @param {function(): unknown} fn - The function to be called on change
92
- */
93
- registerOnChange(fn: () => unknown): void;
94
- /**
95
- * @summary Register touch callback
96
- * @description Registers a function to be called when the field is touched
97
- * @param {function(): unknown} fn - The function to be called on touch
98
- */
99
- registerOnTouched(fn: () => unknown): void;
100
- /**
101
- * @summary Set disabled state
102
- * @description Sets the disabled state of the field
103
- * @param {boolean} isDisabled - Whether the field should be disabled
104
- */
105
- setDisabledState?(isDisabled: boolean): void;
106
- /**
107
- * @summary After view initialization logic
108
- * @description Performs necessary setup after the view has been initialized
109
- * @returns {HTMLElement} The parent element of the field
110
- */
111
- afterViewInit(): HTMLElement;
112
- /**
113
- * @summary Cleanup on component destruction
114
- * @description Unregisters the field when the component is destroyed
115
- */
116
- onDestroy(): void;
117
- /**
118
- * @summary Get field errors
119
- * @description Retrieves all errors associated with the field
120
- * @returns {string|void} An array of error objects
121
- */
122
- getErrors(parent: HTMLElement): string | void;
123
- }