@decaf-ts/for-angular 0.0.62 → 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.
@@ -5092,6 +5125,17 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5092
5125
  * @memberOf ListComponent
5093
5126
  */
5094
5127
  showSearchbar: boolean;
5128
+ /**
5129
+ * @description Controls the visibility of the search bar.
5130
+ * @summary When set to true, displays a search bar at the top of the list that allows
5131
+ * users to filter the list items. The search functionality works by filtering the
5132
+ * existing data or by triggering a new data fetch with search parameters.
5133
+ *
5134
+ * @type {boolean}
5135
+ * @default true
5136
+ * @memberOf ListComponent
5137
+ */
5138
+ searchbarPlaceholder: string;
5095
5139
  /**
5096
5140
  * @description Direct data input for the list component.
5097
5141
  * @summary Provides a way to directly pass data to the list component instead of
@@ -5376,28 +5420,6 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5376
5420
  * @memberOf ListComponent
5377
5421
  */
5378
5422
  private clickItemSubject;
5379
- /**
5380
- * @description Subject for debouncing repository observation events.
5381
- * @summary RxJS Subject that collects repository change events and emits them after
5382
- * a debounce period. This prevents multiple rapid repository changes from triggering
5383
- * multiple list refresh operations, improving performance and user experience.
5384
- *
5385
- * @private
5386
- * @type {Subject<any>}
5387
- * @memberOf ListComponent
5388
- */
5389
- private observerSubjet;
5390
- /**
5391
- * @description Observer object for repository change notifications.
5392
- * @summary Implements the Observer interface to receive notifications when the
5393
- * underlying data repository changes. This enables automatic list updates when
5394
- * data is created, updated, or deleted through the repository.
5395
- *
5396
- * @private
5397
- * @type {Observer}
5398
- * @memberOf ListComponent
5399
- */
5400
- private observer;
5401
5423
  /**
5402
5424
  * @description List of available indexes for data querying and filtering.
5403
5425
  * @summary Provides a list of index names that can be used to optimize data querying and filtering
@@ -5459,21 +5481,63 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5459
5481
  * @summary Performs cleanup operations when the component is being removed from the DOM.
5460
5482
  * This includes clearing references to models and data to prevent memory leaks.
5461
5483
  *
5462
- * @returns {void}
5484
+ * @returns {Promise<void>}
5463
5485
  * @memberOf ListComponent
5464
5486
  */
5465
- ngOnDestroy(): void;
5487
+ ngOnDestroy(): Promise<void>;
5488
+ destroy(): Promise<void>;
5466
5489
  /**
5467
- * @description Handles repository observation events with debouncing.
5468
- * @summary Processes repository change notifications and routes them appropriately.
5469
- * For CREATE events with a UID, handles them immediately. For other events,
5470
- * 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
5471
5537
  *
5472
- * @param {...unknown[]} args - The repository event arguments including table, event type, and UID
5473
- * @returns {Promise<void>}
5474
5538
  * @memberOf ListComponent
5475
5539
  */
5476
- observeRepository(...args: unknown[]): Promise<void>;
5540
+ refresh(event?: InfiniteScrollCustomEvent | RefresherCustomEvent | boolean): Promise<void>;
5477
5541
  /**
5478
5542
  * @description Handles specific repository events and updates the list accordingly.
5479
5543
  * @summary Processes repository change events (CREATE, UPDATE, DELETE) and performs
@@ -5613,58 +5677,6 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5613
5677
  * @memberOf ListComponent
5614
5678
  */
5615
5679
  private clickEventEmit;
5616
- /**
5617
- * @description Refreshes the list data from the configured source.
5618
- * @summary This method handles both initial data loading and subsequent refresh operations,
5619
- * including pull-to-refresh and infinite scrolling. It manages the data fetching process,
5620
- * updates the component's state, and handles pagination or infinite scrolling logic based
5621
- * on the component's configuration.
5622
- *
5623
- * The method performs the following steps:
5624
- * 1. Sets the refreshing flag to indicate a data fetch is in progress
5625
- * 2. Calculates the appropriate start and limit values based on pagination settings
5626
- * 3. Fetches data from the appropriate source (model or request)
5627
- * 4. Updates the component's data and emits a refresh event
5628
- * 5. Handles pagination or infinite scrolling state updates
5629
- * 6. Completes any provided event (like InfiniteScrollCustomEvent)
5630
- *
5631
- * @param {InfiniteScrollCustomEvent | RefresherCustomEvent | boolean} event - The event that triggered the refresh,
5632
- * or a boolean flag indicating if this is a forced refresh
5633
- * @returns {Promise<void>} A promise that resolves when the refresh operation is complete
5634
- *
5635
- * @mermaid
5636
- * sequenceDiagram
5637
- * participant L as ListComponent
5638
- * participant D as Data Source
5639
- * participant E as Event System
5640
- *
5641
- * L->>L: refresh(event)
5642
- * L->>L: Set refreshing flag
5643
- * L->>L: Calculate start and limit
5644
- * alt Using model
5645
- * L->>D: getFromModel(force, start, limit)
5646
- * D-->>L: Return data
5647
- * else Using request
5648
- * L->>D: getFromRequest(force, start, limit)
5649
- * D-->>L: Return data
5650
- * end
5651
- * L->>E: refreshEventEmit()
5652
- * alt Infinite scrolling mode
5653
- * L->>L: Check if reached last page
5654
- * alt Last page reached
5655
- * L->>L: Complete scroll event
5656
- * L->>L: Disable loadMoreData
5657
- * else More pages available
5658
- * L->>L: Increment page number
5659
- * L->>L: Complete scroll event after delay
5660
- * end
5661
- * else Paginated mode
5662
- * L->>L: Clear refreshing flag after delay
5663
- * end
5664
- *
5665
- * @memberOf ListComponent
5666
- */
5667
- refresh(event?: InfiniteScrollCustomEvent | RefresherCustomEvent | boolean): Promise<void>;
5668
5680
  /**
5669
5681
  * @description Handles pagination events from the pagination component.
5670
5682
  * @summary Processes pagination events by updating the current page number and
@@ -5806,7 +5818,7 @@ declare class ListComponent extends NgxComponentDirective implements OnInit, OnD
5806
5818
  mapResults(data: KeyValue[]): KeyValue[];
5807
5819
  parseSearchValue(): string | IFilterQuery;
5808
5820
  static ɵfac: i0.ɵɵFactoryDeclaration<ListComponent, never>;
5809
- static ɵcmp: i0.ɵɵComponentDeclaration<ListComponent, "ngx-decaf-list", never, { "type": { "alias": "type"; "required": false; }; "showSearchbar": { "alias": "showSearchbar"; "required": false; }; "data": { "alias": "data"; "required": false; }; "source": { "alias": "source"; "required": false; }; "start": { "alias": "start"; "required": false; }; "limit": { "alias": "limit"; "required": false; }; "loadMoreData": { "alias": "loadMoreData"; "required": false; }; "lines": { "alias": "lines"; "required": false; }; "inset": { "alias": "inset"; "required": false; }; "scrollThreshold": { "alias": "scrollThreshold"; "required": false; }; "scrollPosition": { "alias": "scrollPosition"; "required": false; }; "loadingText": { "alias": "loadingText"; "required": false; }; "showRefresher": { "alias": "showRefresher"; "required": false; }; "createButton": { "alias": "createButton"; "required": false; }; "loadingSpinner": { "alias": "loadingSpinner"; "required": false; }; "enableFilter": { "alias": "enableFilter"; "required": false; }; "sortBy": { "alias": "sortBy"; "required": false; }; "sortDirection": { "alias": "sortDirection"; "required": false; }; "disableSort": { "alias": "disableSort"; "required": false; }; "empty": { "alias": "empty"; "required": false; }; }, { "clickEvent": "clickEvent"; }, never, ["*"], true, never>;
5821
+ static ɵcmp: i0.ɵɵComponentDeclaration<ListComponent, "ngx-decaf-list", never, { "type": { "alias": "type"; "required": false; }; "showSearchbar": { "alias": "showSearchbar"; "required": false; }; "searchbarPlaceholder": { "alias": "searchbarPlaceholder"; "required": false; }; "data": { "alias": "data"; "required": false; }; "source": { "alias": "source"; "required": false; }; "start": { "alias": "start"; "required": false; }; "limit": { "alias": "limit"; "required": false; }; "loadMoreData": { "alias": "loadMoreData"; "required": false; }; "lines": { "alias": "lines"; "required": false; }; "inset": { "alias": "inset"; "required": false; }; "scrollThreshold": { "alias": "scrollThreshold"; "required": false; }; "scrollPosition": { "alias": "scrollPosition"; "required": false; }; "loadingText": { "alias": "loadingText"; "required": false; }; "showRefresher": { "alias": "showRefresher"; "required": false; }; "createButton": { "alias": "createButton"; "required": false; }; "loadingSpinner": { "alias": "loadingSpinner"; "required": false; }; "enableFilter": { "alias": "enableFilter"; "required": false; }; "sortBy": { "alias": "sortBy"; "required": false; }; "sortDirection": { "alias": "sortDirection"; "required": false; }; "disableSort": { "alias": "disableSort"; "required": false; }; "empty": { "alias": "empty"; "required": false; }; }, { "clickEvent": "clickEvent"; }, never, ["*"], true, never>;
5810
5822
  }
5811
5823
 
5812
5824
  /**
@@ -6567,7 +6579,7 @@ declare class SearchbarComponent extends NgxComponentDirective implements OnInit
6567
6579
  * @default "off"
6568
6580
  * @memberOf SearchbarComponent
6569
6581
  */
6570
- autocorrect: "on" | "off";
6582
+ autocorrect: 'on' | 'off';
6571
6583
  /**
6572
6584
  * @description Whether the searchbar should animate.
6573
6585
  * @summary Controls the animation behavior of the searchbar during appearance and disappearance transitions.
@@ -6630,7 +6642,7 @@ declare class SearchbarComponent extends NgxComponentDirective implements OnInit
6630
6642
  * @default "enter"
6631
6643
  * @memberOf SearchbarComponent
6632
6644
  */
6633
- enterkeyhint: "search" | "enter" | "done" | "go" | "next" | "previous" | "send" | undefined;
6645
+ enterkeyhint: 'search' | 'enter' | 'done' | 'go' | 'next' | 'previous' | 'send' | undefined;
6634
6646
  /**
6635
6647
  * @description The input mode for the searchbar.
6636
6648
  * @summary Specifies the type of data that might be entered by the user while editing the element or its contents.
@@ -6638,7 +6650,7 @@ declare class SearchbarComponent extends NgxComponentDirective implements OnInit
6638
6650
  * @default 'search'
6639
6651
  * @memberOf SearchbarComponent
6640
6652
  */
6641
- inputmode: "text" | "search" | "none" | "email" | "tel" | "url" | "numeric" | "decimal" | undefined;
6653
+ inputmode: 'text' | 'search' | 'none' | 'email' | 'tel' | 'url' | 'numeric' | 'decimal' | undefined;
6642
6654
  /**
6643
6655
  * @description The placeholder for the searchbar input.
6644
6656
  * @summary Specifies the placeholder text to be displayed in the searchbar when it's empty.
@@ -6662,7 +6674,7 @@ declare class SearchbarComponent extends NgxComponentDirective implements OnInit
6662
6674
  * @default "never"
6663
6675
  * @memberOf SearchbarComponent
6664
6676
  */
6665
- showCancelButton: "always" | "focus" | "never";
6677
+ showCancelButton: 'always' | 'focus' | 'never';
6666
6678
  /**
6667
6679
  * @description When to show the clear button.
6668
6680
  * @summary Controls the visibility of the clear button in different states of the searchbar.
@@ -6670,7 +6682,7 @@ declare class SearchbarComponent extends NgxComponentDirective implements OnInit
6670
6682
  * @default "focus"
6671
6683
  * @memberOf SearchbarComponent
6672
6684
  */
6673
- showClearButton: "always" | "focus" | "never";
6685
+ showClearButton: 'always' | 'focus' | 'never';
6674
6686
  /**
6675
6687
  * @description Whether to enable spellcheck on the searchbar input.
6676
6688
  * @summary Controls whether the browser's spellcheck feature is enabled for the searchbar input.
@@ -6686,7 +6698,7 @@ declare class SearchbarComponent extends NgxComponentDirective implements OnInit
6686
6698
  * @default "search"
6687
6699
  * @memberOf SearchbarComponent
6688
6700
  */
6689
- type: 'number' | "text" | "search" | "email" | "password" | "tel" | "url" | undefined;
6701
+ type: 'number' | 'text' | 'search' | 'email' | 'password' | 'tel' | 'url' | undefined;
6690
6702
  /**
6691
6703
  * @description The value of the searchbar input.
6692
6704
  * @summary Specifies the current value of the searchbar input.
@@ -7073,7 +7085,7 @@ declare class SteppedFormComponent extends NgxFormDirective implements OnInit, O
7073
7085
  *
7074
7086
  * @memberOf SteppedFormComponent
7075
7087
  */
7076
- ngOnDestroy(): void;
7088
+ ngOnDestroy(): Promise<void>;
7077
7089
  /**
7078
7090
  * @description Handles navigation to the next page or form submission.
7079
7091
  * @summary Validates the current page's form fields and either navigates to the next page
@@ -7625,9 +7637,9 @@ declare class FileUploadComponent extends NgxFormFieldDirective implements OnIni
7625
7637
  * @description Lifecycle hook that is called when a directive, pipe, or service is destroyed.
7626
7638
  * @summary Cleans up the component by calling the parent ngOnDestroy method and clearing the file upload state.
7627
7639
  *
7628
- * @returns {Promise<void> | void}
7640
+ * @returns {Promise<void>}
7629
7641
  */
7630
- ngOnDestroy(): Promise<void> | void;
7642
+ ngOnDestroy(): Promise<void>;
7631
7643
  /**
7632
7644
  * @description Handles the click event to trigger file selection.
7633
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.62",
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": {