@decaf-ts/for-angular 0.0.63 → 0.0.65

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';
@@ -173,6 +173,7 @@ declare const ComponentEventNames: {
173
173
  readonly FIELDSET_REMOVE_GROUP: "fieldsetRemoveGroupEvent";
174
174
  readonly THEME_CHANGE: "themeChangeEvent";
175
175
  readonly FORM_GROUP_LOADED: "formGroupLoadedEvent";
176
+ readonly DISABLE_MENU: "disableMenuEvent";
176
177
  };
177
178
  /**
178
179
  * @description Logger level constants.
@@ -1621,6 +1622,27 @@ declare abstract class NgxComponentDirective extends DecafComponent implements O
1621
1622
  * @default WindowColorSchemes.light
1622
1623
  */
1623
1624
  protected colorSchema: WindowColorScheme;
1625
+ /**
1626
+ * @description Observer object for repository change notifications.
1627
+ * @summary Implements the Observer interface to receive notifications when the
1628
+ * underlying data repository changes. This enables automatic list updates when
1629
+ * data is created, updated, or deleted through the repository.
1630
+ *
1631
+ * @private
1632
+ * @type {Observer}
1633
+ */
1634
+ protected repositoryObserver: Observer;
1635
+ protected destroySubscriptions$: Subject<void>;
1636
+ /**
1637
+ * @description Subject for debouncing repository observation events.
1638
+ * @summary RxJS Subject that collects repository change events and emits them after
1639
+ * a debounce period. This prevents multiple rapid repository changes from triggering
1640
+ * multiple list refresh operations, improving performance and user experience.
1641
+ *
1642
+ * @private
1643
+ * @type {Subject<any>}
1644
+ */
1645
+ protected repositoryObserverSubject: Subject<any>;
1624
1646
  /**
1625
1647
  * @description Constructor for NgxComponentDirective.
1626
1648
  * @summary Initializes the directive by setting up the component name, locale root,
@@ -1638,9 +1660,9 @@ declare abstract class NgxComponentDirective extends DecafComponent implements O
1638
1660
  * released (DOM listeners, timers, subscriptions, etc.). Implementations should
1639
1661
  * keep `mediaService.destroy()` idempotent; calling it here prevents leaks when
1640
1662
  * components are torn down.
1641
- * @returns {void}
1663
+ * @returns {Promise<void>}
1642
1664
  */
1643
- ngOnDestroy(): Promise<void> | void;
1665
+ ngOnDestroy(): Promise<void>;
1644
1666
  refresh(...args: unknown[]): Promise<void>;
1645
1667
  /**
1646
1668
  * @description Getter for the current locale context identifier.
@@ -1686,6 +1708,18 @@ declare abstract class NgxComponentDirective extends DecafComponent implements O
1686
1708
  */
1687
1709
  translate(phrase: string | string[], params?: object | string): Promise<string>;
1688
1710
  protected checkDarkMode(): void;
1711
+ /**
1712
+ * @description Handles repository observation events with debouncing.
1713
+ * @summary Processes repository change notifications and routes them appropriately.
1714
+ * For CREATE events with a UID, handles them immediately. For other events,
1715
+ * passes them to the debounced observer subject to prevent excessive updates.
1716
+ *
1717
+ * @param {...unknown[]} args - The repository event arguments including table, event type, and UID
1718
+ * @returns {Promise<void>}
1719
+ * @memberOf ListComponent
1720
+ */
1721
+ handleRepositoryRefresh(...args: unknown[]): Promise<void>;
1722
+ handleObserveEvent(...args: unknown[]): Promise<void>;
1689
1723
  /**
1690
1724
  * @description Retrieves or sets the locale context for the component.
1691
1725
  * @summary Gets the locale identifier from the locale context system. If a locale parameter
@@ -3055,7 +3089,7 @@ declare class CrudFieldComponent extends NgxFormFieldDirective implements OnInit
3055
3089
  * @returns {void}
3056
3090
  * @memberOf CrudFieldComponent
3057
3091
  */
3058
- ngOnDestroy(): void;
3092
+ ngOnDestroy(): Promise<void>;
3059
3093
  toggleOptionSelection(val: string, event: CheckboxCustomEvent): void;
3060
3094
  isOptionChecked(value: string): boolean;
3061
3095
  static ɵfac: i0.ɵɵFactoryDeclaration<CrudFieldComponent, never>;
@@ -3215,7 +3249,7 @@ declare class NgxParentComponentDirective extends NgxComponentDirective implemen
3215
3249
  */
3216
3250
  protected timerSubscription: Subscription;
3217
3251
  ngOnInit(model?: Model | string): Promise<void>;
3218
- ngOnDestroy(): Promise<void> | void;
3252
+ ngOnDestroy(): Promise<void>;
3219
3253
  protected getActivePage(page: number, firstClick?: boolean): UIModelMetadata | UIModelMetadata[] | FieldDefinition | undefined;
3220
3254
  static ɵfac: i0.ɵɵFactoryDeclaration<NgxParentComponentDirective, never>;
3221
3255
  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 +3393,7 @@ declare abstract class NgxFormDirective extends NgxParentComponentDirective impl
3359
3393
  *
3360
3394
  * @returns {void}
3361
3395
  */
3362
- ngOnDestroy(): void;
3396
+ ngOnDestroy(): Promise<void>;
3363
3397
  getFormArrayIndex(index: number): FormParent | undefined;
3364
3398
  /**
3365
3399
  * @description Handles form reset or navigation back functionality.
@@ -5387,28 +5421,6 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5387
5421
  * @memberOf ListComponent
5388
5422
  */
5389
5423
  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
5424
  /**
5413
5425
  * @description List of available indexes for data querying and filtering.
5414
5426
  * @summary Provides a list of index names that can be used to optimize data querying and filtering
@@ -5470,21 +5482,63 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5470
5482
  * @summary Performs cleanup operations when the component is being removed from the DOM.
5471
5483
  * This includes clearing references to models and data to prevent memory leaks.
5472
5484
  *
5473
- * @returns {void}
5485
+ * @returns {Promise<void>}
5474
5486
  * @memberOf ListComponent
5475
5487
  */
5476
- ngOnDestroy(): void;
5488
+ ngOnDestroy(): Promise<void>;
5489
+ destroy(): Promise<void>;
5477
5490
  /**
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.
5491
+ * @description Refreshes the list data from the configured source.
5492
+ * @summary This method handles both initial data loading and subsequent refresh operations,
5493
+ * including pull-to-refresh and infinite scrolling. It manages the data fetching process,
5494
+ * updates the component's state, and handles pagination or infinite scrolling logic based
5495
+ * on the component's configuration.
5496
+ *
5497
+ * The method performs the following steps:
5498
+ * 1. Sets the refreshing flag to indicate a data fetch is in progress
5499
+ * 2. Calculates the appropriate start and limit values based on pagination settings
5500
+ * 3. Fetches data from the appropriate source (model or request)
5501
+ * 4. Updates the component's data and emits a refresh event
5502
+ * 5. Handles pagination or infinite scrolling state updates
5503
+ * 6. Completes any provided event (like InfiniteScrollCustomEvent)
5504
+ *
5505
+ * @param {InfiniteScrollCustomEvent | RefresherCustomEvent | boolean} event - The event that triggered the refresh,
5506
+ * or a boolean flag indicating if this is a forced refresh
5507
+ * @returns {Promise<void>} A promise that resolves when the refresh operation is complete
5508
+ *
5509
+ * @mermaid
5510
+ * sequenceDiagram
5511
+ * participant L as ListComponent
5512
+ * participant D as Data Source
5513
+ * participant E as Event System
5514
+ *
5515
+ * L->>L: refresh(event)
5516
+ * L->>L: Set refreshing flag
5517
+ * L->>L: Calculate start and limit
5518
+ * alt Using model
5519
+ * L->>D: getFromModel(force, start, limit)
5520
+ * D-->>L: Return data
5521
+ * else Using request
5522
+ * L->>D: getFromRequest(force, start, limit)
5523
+ * D-->>L: Return data
5524
+ * end
5525
+ * L->>E: refreshEventEmit()
5526
+ * alt Infinite scrolling mode
5527
+ * L->>L: Check if reached last page
5528
+ * alt Last page reached
5529
+ * L->>L: Complete scroll event
5530
+ * L->>L: Disable loadMoreData
5531
+ * else More pages available
5532
+ * L->>L: Increment page number
5533
+ * L->>L: Complete scroll event after delay
5534
+ * end
5535
+ * else Paginated mode
5536
+ * L->>L: Clear refreshing flag after delay
5537
+ * end
5482
5538
  *
5483
- * @param {...unknown[]} args - The repository event arguments including table, event type, and UID
5484
- * @returns {Promise<void>}
5485
5539
  * @memberOf ListComponent
5486
5540
  */
5487
- observeRepository(...args: unknown[]): Promise<void>;
5541
+ refresh(event?: InfiniteScrollCustomEvent | RefresherCustomEvent | boolean): Promise<void>;
5488
5542
  /**
5489
5543
  * @description Handles specific repository events and updates the list accordingly.
5490
5544
  * @summary Processes repository change events (CREATE, UPDATE, DELETE) and performs
@@ -5624,58 +5678,6 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5624
5678
  * @memberOf ListComponent
5625
5679
  */
5626
5680
  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
5681
  /**
5680
5682
  * @description Handles pagination events from the pagination component.
5681
5683
  * @summary Processes pagination events by updating the current page number and
@@ -7084,7 +7086,7 @@ declare class SteppedFormComponent extends NgxFormDirective implements OnInit, O
7084
7086
  *
7085
7087
  * @memberOf SteppedFormComponent
7086
7088
  */
7087
- ngOnDestroy(): void;
7089
+ ngOnDestroy(): Promise<void>;
7088
7090
  /**
7089
7091
  * @description Handles navigation to the next page or form submission.
7090
7092
  * @summary Validates the current page's form fields and either navigates to the next page
@@ -7636,9 +7638,9 @@ declare class FileUploadComponent extends NgxFormFieldDirective implements OnIni
7636
7638
  * @description Lifecycle hook that is called when a directive, pipe, or service is destroyed.
7637
7639
  * @summary Cleans up the component by calling the parent ngOnDestroy method and clearing the file upload state.
7638
7640
  *
7639
- * @returns {Promise<void> | void}
7641
+ * @returns {Promise<void>}
7640
7642
  */
7641
- ngOnDestroy(): Promise<void> | void;
7643
+ ngOnDestroy(): Promise<void>;
7642
7644
  /**
7643
7645
  * @description Handles the click event to trigger file selection.
7644
7646
  * @summary Simulates a click on the hidden file input element to open the file selection dialog.
@@ -8837,7 +8839,7 @@ declare abstract class NgxPageDirective extends NgxComponentDirective implements
8837
8839
  */
8838
8840
  constructor(localeRoot?: string, hasMenu?: boolean);
8839
8841
  get pageTitle(): string;
8840
- ngOnInit(): Promise<void> | void;
8842
+ ngOnInit(): Promise<void>;
8841
8843
  /**
8842
8844
  * @description Ionic lifecycle hook called when the page is about to enter view.
8843
8845
  * @summary This lifecycle hook is triggered just before the page becomes visible to the user.
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.65",
4
4
  "author": "Tiago Venceslau and Contributors",
5
5
  "license": "MPL-2.0 OR AGPL-3.0",
6
6
  "repository": {