@decaf-ts/for-angular 0.0.63 → 0.0.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import { IonInput, IonSelect, IonTextarea, IonCheckbox, SpinnerTypes, InfiniteSc
4
4
  import { TextFieldTypes, SelectInterface, AutocompleteTypes, CheckboxCustomEvent, Color, PredefinedColors, OverlayEventDetail } from '@ionic/core';
5
5
  import * as i2 from '@angular/forms';
6
6
  import { FormGroup, FormControl, FormArray, ControlValueAccessor, AbstractControl } from '@angular/forms';
7
- import { OrderDirection, Repository, Adapter, EventIds, AttributeOption, Paginator, Condition } from '@decaf-ts/core';
7
+ import { OrderDirection, Repository, Adapter, EventIds, AttributeOption, Observer, Paginator, Condition } from '@decaf-ts/core';
8
8
  import { FieldProperties, IPagedComponentProperties, CrudOperationKeys, UIFunctionLike, HTML5InputTypes, DecafComponent, UIModelMetadata, FieldDefinition, UIMediaBreakPointsType, UIElementMetadata, RenderingEngine, DecafEventHandler } from '@decaf-ts/ui-decorators';
9
9
  import * as _decaf_ts_decorator_validation from '@decaf-ts/decorator-validation';
10
10
  import { VALIDATION_PARENT_KEY, Model, ModelConstructor } from '@decaf-ts/decorator-validation';
@@ -17,8 +17,8 @@ import * as i1 from '@angular/common';
17
17
  import { Location } from '@angular/common';
18
18
  import * as i3 from '@ngx-translate/core';
19
19
  import { TranslateService, TranslateLoader, TranslationObject, TranslateParser, RootTranslateServiceConfig } from '@ngx-translate/core';
20
+ import { Observable, Subject, Subscription } from 'rxjs';
20
21
  import { HttpClient } from '@angular/common/http';
21
- import { Observable, Subscription } from 'rxjs';
22
22
  import { SafeHtml, DomSanitizer, Title } from '@angular/platform-browser';
23
23
  import { InjectablesRegistry } from '@decaf-ts/injectable-decorators';
24
24
  import { LoggedClass, Logger } from '@decaf-ts/logging';
@@ -1621,6 +1621,27 @@ declare abstract class NgxComponentDirective extends DecafComponent implements O
1621
1621
  * @default WindowColorSchemes.light
1622
1622
  */
1623
1623
  protected colorSchema: WindowColorScheme;
1624
+ /**
1625
+ * @description Observer object for repository change notifications.
1626
+ * @summary Implements the Observer interface to receive notifications when the
1627
+ * underlying data repository changes. This enables automatic list updates when
1628
+ * data is created, updated, or deleted through the repository.
1629
+ *
1630
+ * @private
1631
+ * @type {Observer}
1632
+ */
1633
+ protected repositoryObserver: Observer;
1634
+ protected destroySubscriptions$: Subject<void>;
1635
+ /**
1636
+ * @description Subject for debouncing repository observation events.
1637
+ * @summary RxJS Subject that collects repository change events and emits them after
1638
+ * a debounce period. This prevents multiple rapid repository changes from triggering
1639
+ * multiple list refresh operations, improving performance and user experience.
1640
+ *
1641
+ * @private
1642
+ * @type {Subject<any>}
1643
+ */
1644
+ protected repositoryObserverSubject: Subject<any>;
1624
1645
  /**
1625
1646
  * @description Constructor for NgxComponentDirective.
1626
1647
  * @summary Initializes the directive by setting up the component name, locale root,
@@ -1638,9 +1659,9 @@ declare abstract class NgxComponentDirective extends DecafComponent implements O
1638
1659
  * released (DOM listeners, timers, subscriptions, etc.). Implementations should
1639
1660
  * keep `mediaService.destroy()` idempotent; calling it here prevents leaks when
1640
1661
  * components are torn down.
1641
- * @returns {void}
1662
+ * @returns {Promise<void>}
1642
1663
  */
1643
- ngOnDestroy(): Promise<void> | void;
1664
+ ngOnDestroy(): Promise<void>;
1644
1665
  refresh(...args: unknown[]): Promise<void>;
1645
1666
  /**
1646
1667
  * @description Getter for the current locale context identifier.
@@ -1686,6 +1707,18 @@ declare abstract class NgxComponentDirective extends DecafComponent implements O
1686
1707
  */
1687
1708
  translate(phrase: string | string[], params?: object | string): Promise<string>;
1688
1709
  protected checkDarkMode(): void;
1710
+ /**
1711
+ * @description Handles repository observation events with debouncing.
1712
+ * @summary Processes repository change notifications and routes them appropriately.
1713
+ * For CREATE events with a UID, handles them immediately. For other events,
1714
+ * passes them to the debounced observer subject to prevent excessive updates.
1715
+ *
1716
+ * @param {...unknown[]} args - The repository event arguments including table, event type, and UID
1717
+ * @returns {Promise<void>}
1718
+ * @memberOf ListComponent
1719
+ */
1720
+ handleRepositoryRefresh(...args: unknown[]): Promise<void>;
1721
+ handleObserveEvent(...args: unknown[]): Promise<void>;
1689
1722
  /**
1690
1723
  * @description Retrieves or sets the locale context for the component.
1691
1724
  * @summary Gets the locale identifier from the locale context system. If a locale parameter
@@ -3055,7 +3088,7 @@ declare class CrudFieldComponent extends NgxFormFieldDirective implements OnInit
3055
3088
  * @returns {void}
3056
3089
  * @memberOf CrudFieldComponent
3057
3090
  */
3058
- ngOnDestroy(): void;
3091
+ ngOnDestroy(): Promise<void>;
3059
3092
  toggleOptionSelection(val: string, event: CheckboxCustomEvent): void;
3060
3093
  isOptionChecked(value: string): boolean;
3061
3094
  static ɵfac: i0.ɵɵFactoryDeclaration<CrudFieldComponent, never>;
@@ -3215,7 +3248,7 @@ declare class NgxParentComponentDirective extends NgxComponentDirective implemen
3215
3248
  */
3216
3249
  protected timerSubscription: Subscription;
3217
3250
  ngOnInit(model?: Model | string): Promise<void>;
3218
- ngOnDestroy(): Promise<void> | void;
3251
+ ngOnDestroy(): Promise<void>;
3219
3252
  protected getActivePage(page: number, firstClick?: boolean): UIModelMetadata | UIModelMetadata[] | FieldDefinition | undefined;
3220
3253
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxParentComponentDirective, never>;
3221
3254
  static ɵdir: i0.ɵɵDirectiveDeclaration<NgxParentComponentDirective, never, never, { "page": { "alias": "page"; "required": false; }; "pages": { "alias": "pages"; "required": false; }; "parentForm": { "alias": "parentForm"; "required": false; }; "children": { "alias": "children"; "required": false; }; "cols": { "alias": "cols"; "required": false; }; "rows": { "alias": "rows"; "required": false; }; "cardBody": { "alias": "cardBody"; "required": false; }; "cardType": { "alias": "cardType"; "required": false; }; "breakpoint": { "alias": "breakpoint"; "required": false; }; "match": { "alias": "match"; "required": false; }; }, {}, never, never, true, never>;
@@ -3359,7 +3392,7 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
3359
3392
  *
3360
3393
  * @returns {void}
3361
3394
  */
3362
- ngOnDestroy(): void;
3395
+ ngOnDestroy(): Promise<void>;
3363
3396
  getFormArrayIndex(index: number): FormParent | undefined;
3364
3397
  /**
3365
3398
  * @description Handles form reset or navigation back functionality.
@@ -5387,28 +5420,6 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5387
5420
  * @memberOf ListComponent
5388
5421
  */
5389
5422
  private clickItemSubject;
5390
- /**
5391
- * @description Subject for debouncing repository observation events.
5392
- * @summary RxJS Subject that collects repository change events and emits them after
5393
- * a debounce period. This prevents multiple rapid repository changes from triggering
5394
- * multiple list refresh operations, improving performance and user experience.
5395
- *
5396
- * @private
5397
- * @type {Subject<any>}
5398
- * @memberOf ListComponent
5399
- */
5400
- private observerSubjet;
5401
- /**
5402
- * @description Observer object for repository change notifications.
5403
- * @summary Implements the Observer interface to receive notifications when the
5404
- * underlying data repository changes. This enables automatic list updates when
5405
- * data is created, updated, or deleted through the repository.
5406
- *
5407
- * @private
5408
- * @type {Observer}
5409
- * @memberOf ListComponent
5410
- */
5411
- private observer;
5412
5423
  /**
5413
5424
  * @description List of available indexes for data querying and filtering.
5414
5425
  * @summary Provides a list of index names that can be used to optimize data querying and filtering
@@ -5470,21 +5481,63 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5470
5481
  * @summary Performs cleanup operations when the component is being removed from the DOM.
5471
5482
  * This includes clearing references to models and data to prevent memory leaks.
5472
5483
  *
5473
- * @returns {void}
5484
+ * @returns {Promise<void>}
5474
5485
  * @memberOf ListComponent
5475
5486
  */
5476
- ngOnDestroy(): void;
5487
+ ngOnDestroy(): Promise<void>;
5488
+ destroy(): Promise<void>;
5477
5489
  /**
5478
- * @description Handles repository observation events with debouncing.
5479
- * @summary Processes repository change notifications and routes them appropriately.
5480
- * For CREATE events with a UID, handles them immediately. For other events,
5481
- * passes them to the debounced observer subject to prevent excessive updates.
5490
+ * @description Refreshes the list data from the configured source.
5491
+ * @summary This method handles both initial data loading and subsequent refresh operations,
5492
+ * including pull-to-refresh and infinite scrolling. It manages the data fetching process,
5493
+ * updates the component's state, and handles pagination or infinite scrolling logic based
5494
+ * on the component's configuration.
5495
+ *
5496
+ * The method performs the following steps:
5497
+ * 1. Sets the refreshing flag to indicate a data fetch is in progress
5498
+ * 2. Calculates the appropriate start and limit values based on pagination settings
5499
+ * 3. Fetches data from the appropriate source (model or request)
5500
+ * 4. Updates the component's data and emits a refresh event
5501
+ * 5. Handles pagination or infinite scrolling state updates
5502
+ * 6. Completes any provided event (like InfiniteScrollCustomEvent)
5503
+ *
5504
+ * @param {InfiniteScrollCustomEvent | RefresherCustomEvent | boolean} event - The event that triggered the refresh,
5505
+ * or a boolean flag indicating if this is a forced refresh
5506
+ * @returns {Promise<void>} A promise that resolves when the refresh operation is complete
5507
+ *
5508
+ * @mermaid
5509
+ * sequenceDiagram
5510
+ * participant L as ListComponent
5511
+ * participant D as Data Source
5512
+ * participant E as Event System
5513
+ *
5514
+ * L->>L: refresh(event)
5515
+ * L->>L: Set refreshing flag
5516
+ * L->>L: Calculate start and limit
5517
+ * alt Using model
5518
+ * L->>D: getFromModel(force, start, limit)
5519
+ * D-->>L: Return data
5520
+ * else Using request
5521
+ * L->>D: getFromRequest(force, start, limit)
5522
+ * D-->>L: Return data
5523
+ * end
5524
+ * L->>E: refreshEventEmit()
5525
+ * alt Infinite scrolling mode
5526
+ * L->>L: Check if reached last page
5527
+ * alt Last page reached
5528
+ * L->>L: Complete scroll event
5529
+ * L->>L: Disable loadMoreData
5530
+ * else More pages available
5531
+ * L->>L: Increment page number
5532
+ * L->>L: Complete scroll event after delay
5533
+ * end
5534
+ * else Paginated mode
5535
+ * L->>L: Clear refreshing flag after delay
5536
+ * end
5482
5537
  *
5483
- * @param {...unknown[]} args - The repository event arguments including table, event type, and UID
5484
- * @returns {Promise<void>}
5485
5538
  * @memberOf ListComponent
5486
5539
  */
5487
- observeRepository(...args: unknown[]): Promise<void>;
5540
+ refresh(event?: InfiniteScrollCustomEvent | RefresherCustomEvent | boolean): Promise<void>;
5488
5541
  /**
5489
5542
  * @description Handles specific repository events and updates the list accordingly.
5490
5543
  * @summary Processes repository change events (CREATE, UPDATE, DELETE) and performs
@@ -5624,58 +5677,6 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5624
5677
  * @memberOf ListComponent
5625
5678
  */
5626
5679
  private clickEventEmit;
5627
- /**
5628
- * @description Refreshes the list data from the configured source.
5629
- * @summary This method handles both initial data loading and subsequent refresh operations,
5630
- * including pull-to-refresh and infinite scrolling. It manages the data fetching process,
5631
- * updates the component's state, and handles pagination or infinite scrolling logic based
5632
- * on the component's configuration.
5633
- *
5634
- * The method performs the following steps:
5635
- * 1. Sets the refreshing flag to indicate a data fetch is in progress
5636
- * 2. Calculates the appropriate start and limit values based on pagination settings
5637
- * 3. Fetches data from the appropriate source (model or request)
5638
- * 4. Updates the component's data and emits a refresh event
5639
- * 5. Handles pagination or infinite scrolling state updates
5640
- * 6. Completes any provided event (like InfiniteScrollCustomEvent)
5641
- *
5642
- * @param {InfiniteScrollCustomEvent | RefresherCustomEvent | boolean} event - The event that triggered the refresh,
5643
- * or a boolean flag indicating if this is a forced refresh
5644
- * @returns {Promise<void>} A promise that resolves when the refresh operation is complete
5645
- *
5646
- * @mermaid
5647
- * sequenceDiagram
5648
- * participant L as ListComponent
5649
- * participant D as Data Source
5650
- * participant E as Event System
5651
- *
5652
- * L->>L: refresh(event)
5653
- * L->>L: Set refreshing flag
5654
- * L->>L: Calculate start and limit
5655
- * alt Using model
5656
- * L->>D: getFromModel(force, start, limit)
5657
- * D-->>L: Return data
5658
- * else Using request
5659
- * L->>D: getFromRequest(force, start, limit)
5660
- * D-->>L: Return data
5661
- * end
5662
- * L->>E: refreshEventEmit()
5663
- * alt Infinite scrolling mode
5664
- * L->>L: Check if reached last page
5665
- * alt Last page reached
5666
- * L->>L: Complete scroll event
5667
- * L->>L: Disable loadMoreData
5668
- * else More pages available
5669
- * L->>L: Increment page number
5670
- * L->>L: Complete scroll event after delay
5671
- * end
5672
- * else Paginated mode
5673
- * L->>L: Clear refreshing flag after delay
5674
- * end
5675
- *
5676
- * @memberOf ListComponent
5677
- */
5678
- refresh(event?: InfiniteScrollCustomEvent | RefresherCustomEvent | boolean): Promise<void>;
5679
5680
  /**
5680
5681
  * @description Handles pagination events from the pagination component.
5681
5682
  * @summary Processes pagination events by updating the current page number and
@@ -7084,7 +7085,7 @@ declare class SteppedFormComponent extends NgxFormDirective implements OnInit, O
7084
7085
  *
7085
7086
  * @memberOf SteppedFormComponent
7086
7087
  */
7087
- ngOnDestroy(): void;
7088
+ ngOnDestroy(): Promise<void>;
7088
7089
  /**
7089
7090
  * @description Handles navigation to the next page or form submission.
7090
7091
  * @summary Validates the current page's form fields and either navigates to the next page
@@ -7636,9 +7637,9 @@ declare class FileUploadComponent extends NgxFormFieldDirective implements OnIni
7636
7637
  * @description Lifecycle hook that is called when a directive, pipe, or service is destroyed.
7637
7638
  * @summary Cleans up the component by calling the parent ngOnDestroy method and clearing the file upload state.
7638
7639
  *
7639
- * @returns {Promise<void> | void}
7640
+ * @returns {Promise<void>}
7640
7641
  */
7641
- ngOnDestroy(): Promise<void> | void;
7642
+ ngOnDestroy(): Promise<void>;
7642
7643
  /**
7643
7644
  * @description Handles the click event to trigger file selection.
7644
7645
  * @summary Simulates a click on the hidden file input element to open the file selection dialog.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decaf-ts/for-angular",
3
- "version": "0.0.63",
3
+ "version": "0.0.64",
4
4
  "author": "Tiago Venceslau and Contributors",
5
5
  "license": "MPL-2.0 OR AGPL-3.0",
6
6
  "repository": {