@decaf-ts/for-angular 0.0.11 → 0.0.13

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 (85) hide show
  1. package/package.json +19 -91
  2. package/LICENSE.md +0 -659
  3. package/dist/lib/README.md +0 -92
  4. package/dist/lib/assets/i18n/en.json +0 -140
  5. package/dist/lib/assets/images/angular-logo.svg +0 -45
  6. package/dist/lib/assets/images/decaf-logo-black.svg +0 -22
  7. package/dist/lib/assets/images/decaf-logo-lw.svg +0 -50
  8. package/dist/lib/assets/images/decaf-logo-white.svg +0 -22
  9. package/dist/lib/assets/images/decaf-logo.svg +0 -54
  10. package/dist/lib/components/component-renderer/component-renderer.component.d.ts +0 -276
  11. package/dist/lib/components/crud-field/crud-field.component.d.ts +0 -445
  12. package/dist/lib/components/crud-form/constants.d.ts +0 -5
  13. package/dist/lib/components/crud-form/crud-form.component.d.ts +0 -102
  14. package/dist/lib/components/crud-form/types.d.ts +0 -17
  15. package/dist/lib/components/empty-state/empty-state.component.d.ts +0 -301
  16. package/dist/lib/components/fieldset/fieldset.component.d.ts +0 -199
  17. package/dist/lib/components/filter/filter.component.d.ts +0 -505
  18. package/dist/lib/components/for-angular-components.module.d.ts +0 -20
  19. package/dist/lib/components/index.d.ts +0 -16
  20. package/dist/lib/components/layout/layout.component.d.ts +0 -133
  21. package/dist/lib/components/list/constants.d.ts +0 -29
  22. package/dist/lib/components/list/list.component.d.ts +0 -849
  23. package/dist/lib/components/list-item/list-item.component.d.ts +0 -390
  24. package/dist/lib/components/model-renderer/model-renderer.component.d.ts +0 -96
  25. package/dist/lib/components/pagination/constants.d.ts +0 -7
  26. package/dist/lib/components/pagination/pagination.component.d.ts +0 -264
  27. package/dist/lib/components/searchbar/searchbar.component.d.ts +0 -407
  28. package/dist/lib/directives/collapsable.directive.d.ts +0 -8
  29. package/dist/lib/directives/index.d.ts +0 -1
  30. package/dist/lib/engine/DynamicModule.d.ts +0 -17
  31. package/dist/lib/engine/NgxBaseComponent.d.ts +0 -541
  32. package/dist/lib/engine/NgxCrudFormField.d.ts +0 -118
  33. package/dist/lib/engine/NgxFormService.d.ts +0 -167
  34. package/dist/lib/engine/NgxRenderingEngine.d.ts +0 -127
  35. package/dist/lib/engine/NgxRenderingEngine2.d.ts +0 -250
  36. package/dist/lib/engine/ValidatorFactory.d.ts +0 -15
  37. package/dist/lib/engine/constants.d.ts +0 -151
  38. package/dist/lib/engine/decorators.d.ts +0 -25
  39. package/dist/lib/engine/index.d.ts +0 -16
  40. package/dist/lib/engine/types.d.ts +0 -381
  41. package/dist/lib/esm2022/components/component-renderer/component-renderer.component.mjs +0 -313
  42. package/dist/lib/esm2022/components/crud-field/crud-field.component.mjs +0 -301
  43. package/dist/lib/esm2022/components/crud-form/constants.mjs +0 -14
  44. package/dist/lib/esm2022/components/crud-form/crud-form.component.mjs +0 -139
  45. package/dist/lib/esm2022/components/crud-form/types.mjs +0 -2
  46. package/dist/lib/esm2022/components/empty-state/empty-state.component.mjs +0 -348
  47. package/dist/lib/esm2022/components/fieldset/fieldset.component.mjs +0 -225
  48. package/dist/lib/esm2022/components/filter/filter.component.mjs +0 -689
  49. package/dist/lib/esm2022/components/for-angular-components.module.mjs +0 -71
  50. package/dist/lib/esm2022/components/index.mjs +0 -20
  51. package/dist/lib/esm2022/components/layout/layout.component.mjs +0 -176
  52. package/dist/lib/esm2022/components/list/constants.mjs +0 -6
  53. package/dist/lib/esm2022/components/list/list.component.mjs +0 -1236
  54. package/dist/lib/esm2022/components/list-item/list-item.component.mjs +0 -408
  55. package/dist/lib/esm2022/components/model-renderer/model-renderer.component.mjs +0 -138
  56. package/dist/lib/esm2022/components/pagination/constants.mjs +0 -2
  57. package/dist/lib/esm2022/components/pagination/pagination.component.mjs +0 -323
  58. package/dist/lib/esm2022/components/searchbar/searchbar.component.mjs +0 -493
  59. package/dist/lib/esm2022/decaf-ts-for-angular.mjs +0 -5
  60. package/dist/lib/esm2022/directives/collapsable.directive.mjs +0 -28
  61. package/dist/lib/esm2022/directives/index.mjs +0 -2
  62. package/dist/lib/esm2022/engine/DynamicModule.mjs +0 -18
  63. package/dist/lib/esm2022/engine/NgxBaseComponent.mjs +0 -539
  64. package/dist/lib/esm2022/engine/NgxCrudFormField.mjs +0 -125
  65. package/dist/lib/esm2022/engine/NgxFormService.mjs +0 -315
  66. package/dist/lib/esm2022/engine/NgxRenderingEngine.mjs +0 -192
  67. package/dist/lib/esm2022/engine/NgxRenderingEngine2.mjs +0 -332
  68. package/dist/lib/esm2022/engine/ValidatorFactory.mjs +0 -102
  69. package/dist/lib/esm2022/engine/constants.mjs +0 -160
  70. package/dist/lib/esm2022/engine/decorators.mjs +0 -38
  71. package/dist/lib/esm2022/engine/index.mjs +0 -17
  72. package/dist/lib/esm2022/engine/types.mjs +0 -4
  73. package/dist/lib/esm2022/for-angular.module.mjs +0 -118
  74. package/dist/lib/esm2022/helpers/index.mjs +0 -13
  75. package/dist/lib/esm2022/helpers/utils.mjs +0 -415
  76. package/dist/lib/esm2022/interfaces.mjs +0 -2
  77. package/dist/lib/esm2022/public-apis.mjs +0 -14
  78. package/dist/lib/fesm2022/decaf-ts-for-angular.mjs +0 -7109
  79. package/dist/lib/fesm2022/decaf-ts-for-angular.mjs.map +0 -1
  80. package/dist/lib/for-angular.module.d.ts +0 -45
  81. package/dist/lib/helpers/index.d.ts +0 -12
  82. package/dist/lib/helpers/utils.d.ts +0 -253
  83. package/dist/lib/index.d.ts +0 -5
  84. package/dist/lib/interfaces.d.ts +0 -28
  85. package/dist/lib/public-apis.d.ts +0 -13
@@ -1,17 +0,0 @@
1
- /**
2
- * @description Abstract base class for dynamic Angular modules
3
- * @summary The DynamicModule serves as a base class for Angular modules that need to be
4
- * dynamically loaded or configured at runtime. It provides a common type for the rendering
5
- * engine to identify and work with dynamic modules.
6
- * @class DynamicModule
7
- * @example
8
- * ```typescript
9
- * @NgModule({
10
- * declarations: [MyComponent],
11
- * imports: [CommonModule]
12
- * })
13
- * export class MyDynamicModule extends DynamicModule {}
14
- * ```
15
- */
16
- export declare abstract class DynamicModule {
17
- }
@@ -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 { NgxRenderingEngine2 } from './NgxRenderingEngine2';
6
- import { Logger } from '@decaf-ts/logging';
7
- import { DecafRepository } from '../components/list/constants';
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 NgxRenderingEngine2
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 getLocaleFromClassName 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 NgxRenderingEngine2 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 {NgxRenderingEngine2}
310
- */
311
- renderingEngine: NgxRenderingEngine2;
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 ForAngularModule.
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: getLocaleFromClassName(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 Parses and applies properties from the props object to the component instance.
379
- * @summary This method iterates through the properties of the provided instance object
380
- * and applies any matching properties from the component's props configuration to the
381
- * component instance. This allows for dynamic property assignment based on configuration
382
- * stored in the props object, enabling flexible component customization without requiring
383
- * explicit property binding for every possible configuration option.
384
- *
385
- * The method performs a safe property assignment by checking if each key from the instance
386
- * exists in the props object before applying it. This prevents accidental property
387
- * overwriting and ensures only intended properties are modified.
388
- *
389
- * @param {KeyValue} instance - The component instance object to process
390
- * @return {void}
391
- *
392
- * @mermaid
393
- * sequenceDiagram
394
- * participant C as Component
395
- * participant B as NgxBaseComponent
396
- * participant P as Props Object
397
- *
398
- * C->>B: parseProps(instance)
399
- * B->>B: Get Object.keys(instance)
400
- * loop For each key in instance
401
- * B->>P: Check if key exists in this.props
402
- * alt Key exists in props
403
- * B->>B: Set this[key] = this.props[key]
404
- * else Key not in props
405
- * Note over B: Skip this key
406
- * end
407
- * end
408
- *
409
- * @protected
410
- * @memberOf NgxBaseComponent
411
- */
412
- protected parseProps(instance: KeyValue): void;
413
- /**
414
- * @description Handles changes to component inputs
415
- * @summary This Angular lifecycle hook is called when input properties change.
416
- * It responds to changes in the model, locale, or translatable properties by
417
- * updating the component's internal state accordingly. When the model changes,
418
- * it calls getModel to process the new model and getLocale to update the locale.
419
- * When locale or translatable properties change, it calls getLocale to update
420
- * the translation settings.
421
- *
422
- * @param {SimpleChanges} changes - Object containing changed properties
423
- * @return {void}
424
- */
425
- ngOnChanges(changes: SimpleChanges): void;
426
- /**
427
- * @description Gets the appropriate locale string based on the translatable flag and available locales.
428
- * @summary Determines which locale string to use for translation based on the translatable flag
429
- * and available locale settings. This method first converts the translatable parameter to a boolean
430
- * using the stringToBoolean utility function. If translatable is false, it returns an empty string,
431
- * indicating no translation should be performed. If translatable is true, it checks for an explicitly
432
- * provided locale via the locale property. If no explicit locale is available, it falls back to the
433
- * componentLocale derived from the component's class name.
434
- *
435
- * @param {StringOrBoolean} translatable - Whether the component should be translated
436
- * @return {string} The locale string to use for translation, or empty string if not translatable
437
- *
438
- * @mermaid
439
- * sequenceDiagram
440
- * participant C as Component
441
- * participant N as NgxBaseComponent
442
- * participant S as StringUtils
443
- *
444
- * C->>N: getLocale(translatable)
445
- * N->>S: stringToBoolean(translatable)
446
- * S-->>N: Return boolean value
447
- * N->>N: Store in this.translatable
448
- * alt translatable is false
449
- * N-->>C: Return empty string
450
- * else translatable is true
451
- * alt this.locale is defined
452
- * N-->>C: Return this.locale
453
- * else this.locale is not defined
454
- * N-->>C: Return this.componentLocale
455
- * end
456
- * end
457
- */
458
- getLocale(translatable: StringOrBoolean): string;
459
- /**
460
- * @description Gets the route for the component
461
- * @summary Retrieves the route path for the component, generating one based on the model
462
- * if no route is explicitly set. This method checks if a route is already defined, and if not,
463
- * it creates a default route based on the model's constructor name. The generated route follows
464
- * the pattern '/model/{ModelName}'. This is useful for automatic routing in CRUD operations.
465
- *
466
- * @return {string} The route path for the component, or empty string if no route is available
467
- */
468
- getRoute(): string;
469
- /**
470
- * @description Resolves and sets the component's model
471
- * @summary Processes the provided model parameter, which can be either a Model instance
472
- * or a string identifier. If a string is provided, it attempts to resolve the actual model
473
- * from the injectables registry. After resolving the model, it calls setModelDefinitions
474
- * to configure the component based on the model's metadata.
475
- *
476
- * @param {string | Model} model - The model instance or identifier string
477
- * @return {void}
478
- */
479
- getModel(model: string | Model): void;
480
- /**
481
- * @description Configures component properties based on model metadata
482
- * @summary Extracts and applies configuration from the model's decorators to set up
483
- * the component. This method uses the rendering engine to retrieve decorator metadata
484
- * from the model, then configures the component's mapper and item properties accordingly.
485
- * It ensures the route is properly set and merges various properties from the model's
486
- * metadata into the component's configuration.
487
- *
488
- * @param {Model} model - The model to extract configuration from
489
- * @return {void}
490
- */
491
- setModelDefinitions(model: Model): void;
492
- /**
493
- * @description Initializes the component
494
- * @summary Performs one-time initialization of the component. This method checks if
495
- * the component has already been initialized to prevent duplicate initialization.
496
- * When called for the first time, it sets the initialized flag to true and logs
497
- * an initialization message with the component name. This method is typically called
498
- * during the component's lifecycle setup.
499
- */
500
- initialize(): void;
501
- /**
502
- * @description Handles custom events from child components.
503
- * @summary Receives events from child renderer components and forwards them to parent
504
- * components through the listenEvent output. This creates an event propagation chain
505
- * that allows events to bubble up through the component hierarchy, enabling coordinated
506
- * responses to user interactions across the layout structure.
507
- *
508
- * @param {RendererCustomEvent} event - The custom event from a child component
509
- * @return {void}
510
- *
511
- * @mermaid
512
- * sequenceDiagram
513
- * participant C as Child Component
514
- * participant L as NgxBaseComponent
515
- * participant P as Parent Component
516
- *
517
- * C->>L: Emit RendererCustomEvent
518
- * L->>L: handleEvent(event)
519
- * L->>P: listenEvent.emit(event)
520
- * Note over P: Handle event in parent
521
- *
522
- * @memberOf NgxBaseComponent
523
- */
524
- handleEvent(event: RendererCustomEvent): void;
525
- /**
526
- * @description Tracks items in ngFor loops for optimal change detection.
527
- * @summary Provides a tracking function for Angular's *ngFor directive to optimize rendering
528
- * performance. This method generates unique identifiers for list items based on their index
529
- * and content, allowing Angular to efficiently track changes and minimize DOM manipulations
530
- * during list updates. The tracking function is essential for maintaining component state
531
- * and preventing unnecessary re-rendering of unchanged items.
532
- *
533
- * @param {number} index - The index of the item in the list
534
- * @param {KeyValue | string | number} item - The item data to track
535
- * @returns {string | number} A unique identifier for the item
536
- * @memberOf NgxBaseComponent
537
- */
538
- trackItemFn(index: number, item: KeyValue | string | number): string | number;
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,118 +0,0 @@
1
- import { 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
- /**
7
- * @class NgxCrudFormField
8
- * @implements {FieldProperties}
9
- * @implements {ControlValueAccessor}
10
- * @summary Abstract class representing a CRUD form field for Angular applications
11
- * @description This class provides the base implementation for CRUD form fields in Angular,
12
- * implementing both CrudFormField and ControlValueAccessor interfaces.
13
- */
14
- export declare abstract class NgxCrudFormField implements ControlValueAccessor, FieldProperties {
15
- /**
16
- * @summary Reference to the component's element
17
- * @description ElementRef representing the component's native element
18
- */
19
- component: ElementRef;
20
- /**
21
- * @summary Current CRUD operation
22
- * @description Represents the current CRUD operation being performed
23
- */
24
- operation: CrudOperations;
25
- /**
26
- * @summary Form group for the field
27
- * @description Angular FormGroup instance for the field
28
- */
29
- formGroup: FormGroup | undefined;
30
- formControl: FormControl;
31
- name: string;
32
- path: string;
33
- childOf?: string;
34
- type: PossibleInputTypes;
35
- disabled?: boolean;
36
- format?: string;
37
- hidden?: boolean;
38
- max?: number | Date;
39
- maxlength?: number;
40
- min?: number | Date;
41
- minlength?: number;
42
- pattern?: string | undefined;
43
- readonly?: boolean;
44
- required?: boolean;
45
- step?: number;
46
- equals?: string;
47
- different?: string;
48
- lessThan?: string;
49
- lessThanOrEqual?: string;
50
- greaterThan?: string;
51
- greaterThanOrEqual?: string;
52
- value: string | number | Date;
53
- private translateService;
54
- /**
55
- * @summary Parent HTML element
56
- * @description Reference to the parent HTML element of the field
57
- */
58
- protected parent?: HTMLElement;
59
- /**
60
- * @summary String formatting function
61
- * @description Provides access to the sf function for error message formatting
62
- * @prop {function(string, ...string): string} sf - String formatting function
63
- */
64
- sf: typeof import("@decaf-ts/decorator-validation").stringFormat;
65
- /**
66
- * @summary Change callback function
67
- * @description Function called when the field value changes
68
- * @property {function(): unknown} onChange - onChange event handler
69
- */
70
- onChange: () => unknown;
71
- /**
72
- * @summary Touch callback function
73
- * @description Function called when the field is touched
74
- * @property {function(): unknown} onTouch - onTouch event handler
75
- */
76
- onTouch: () => unknown;
77
- /**
78
- * @summary Write value to the field
79
- * @description Sets the value of the field
80
- * @param {string} obj - The value to be set
81
- */
82
- writeValue(obj: string): void;
83
- /**
84
- * @summary Register change callback
85
- * @description Registers a function to be called when the field value changes
86
- * @param {function(): unknown} fn - The function to be called on change
87
- */
88
- registerOnChange(fn: () => unknown): void;
89
- /**
90
- * @summary Register touch callback
91
- * @description Registers a function to be called when the field is touched
92
- * @param {function(): unknown} fn - The function to be called on touch
93
- */
94
- registerOnTouched(fn: () => unknown): void;
95
- /**
96
- * @summary Set disabled state
97
- * @description Sets the disabled state of the field
98
- * @param {boolean} isDisabled - Whether the field should be disabled
99
- */
100
- setDisabledState?(isDisabled: boolean): void;
101
- /**
102
- * @summary After view initialization logic
103
- * @description Performs necessary setup after the view has been initialized
104
- * @returns {HTMLElement} The parent element of the field
105
- */
106
- afterViewInit(): HTMLElement;
107
- /**
108
- * @summary Cleanup on component destruction
109
- * @description Unregisters the field when the component is destroyed
110
- */
111
- onDestroy(): void;
112
- /**
113
- * @summary Get field errors
114
- * @description Retrieves all errors associated with the field
115
- * @returns {string|void} An array of error objects
116
- */
117
- getErrors(parent: HTMLElement): string | void;
118
- }