@js-smart/ng-kit 21.4.0 → 21.6.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@js-smart/ng-kit",
3
- "version": "21.4.0",
3
+ "version": "21.6.0",
4
4
  "license": "MIT",
5
5
  "author": "Pavan Kumar Jadda",
6
6
  "private": false,
@@ -45,4 +45,4 @@
45
45
  "default": "./fesm2022/js-smart-ng-kit.mjs"
46
46
  }
47
47
  }
48
- }
48
+ }
@@ -1,9 +1,10 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { OnInit, ChangeDetectorRef, OnDestroy, OnChanges, AfterContentChecked, ElementRef, SimpleChanges, ViewContainerRef, ComponentRef, WritableSignal } from '@angular/core';
2
+ import { OnInit, ChangeDetectorRef, OnDestroy, ElementRef, ViewContainerRef, ComponentRef, WritableSignal } from '@angular/core';
3
3
  import { BehaviorSubject, Observable, Subject } from 'rxjs';
4
- import { ThemePalette, MatOptionSelectionChange } from '@angular/material/core';
4
+ import { ThemePalette } from '@angular/material/core';
5
5
  import { ControlValueAccessor, FormControl } from '@angular/forms';
6
6
  import { MatAutocompleteTrigger } from '@angular/material/autocomplete';
7
+ import { MatFormFieldAppearance } from '@angular/material/form-field';
7
8
  import { MatPaginator } from '@angular/material/paginator';
8
9
  import { MatTableDataSource } from '@angular/material/table';
9
10
  import { MatIconRegistry } from '@angular/material/icon';
@@ -263,83 +264,92 @@ declare class SpinnerComponent {
263
264
  * @author Pavan Kumar Jadda
264
265
  * @since 12.0.0
265
266
  */
266
- declare class AutocompleteComponent implements OnInit, OnChanges, AfterContentChecked, ControlValueAccessor {
267
- /**
268
- * Gets reference inputAutoComplete HTML attribute
269
- */
270
- inputAutoComplete: ElementRef;
271
- cdRef: ChangeDetectorRef;
272
- /**
273
- * Internal form control for the autocomplete
274
- */
275
- control: FormControl<string | null>;
276
- /**
277
- * Label of the AutoComplete
278
- */
267
+ declare class AutocompleteComponent<T = string> implements ControlValueAccessor {
268
+ /** Gets reference to the MatAutocompleteTrigger to programmatically open/close the panel */
269
+ autocompleteTrigger: _angular_core.Signal<MatAutocompleteTrigger>;
270
+ /** Gets reference to the input element for re-focusing after clear */
271
+ inputElement: _angular_core.Signal<ElementRef<HTMLInputElement>>;
272
+ /** Label of the autocomplete form field */
279
273
  label: _angular_core.InputSignal<string>;
280
- /**
281
- * Placeholder of the AutoComplete
282
- */
283
- placeHolder: _angular_core.InputSignal<string>;
284
- /**
285
- * Appearance of the AutoComplete, defaults to `fill`
286
- */
287
- appearance: _angular_core.InputSignal<string>;
288
- /**
289
- * List of CSS classes that need to applied to autocomplete
290
- */
274
+ /** Placeholder text displayed inside the input when empty */
275
+ placeholder: _angular_core.InputSignal<string>;
276
+ /** Appearance of the form field. Defaults to `outline` */
277
+ appearance: _angular_core.InputSignal<MatFormFieldAppearance>;
278
+ /** List of CSS classes to apply to the form field */
291
279
  classes: _angular_core.InputSignal<string>;
280
+ /** List of options to display in the dropdown */
281
+ options: _angular_core.InputSignal<T[]>;
292
282
  /**
293
- * Attribute of the Object whose value would be shown when searching for data. Defaults to `ID`
283
+ * Function that maps an option to its display string.
284
+ * Used for rendering options in the dropdown and showing the selected value in the input.
285
+ * Defaults to `String(value)` which works for primitive string options.
294
286
  */
295
- bindLabel: _angular_core.InputSignal<string>;
287
+ displayWith: _angular_core.InputSignal<(value: T) => string>;
288
+ /** Whether the autocomplete is in a loading state. Shows a spinner instead of options */
289
+ loading: _angular_core.InputSignal<boolean>;
290
+ /** Text displayed when the autocomplete is in a loading state. Defaults to 'Loading...' */
291
+ loadingText: _angular_core.InputSignal<string>;
292
+ /** Text displayed when no options match the filter input. Defaults to 'No values found' */
293
+ noOptionsText: _angular_core.InputSignal<string>;
294
+ /** Emits the selected value when an option is picked from the dropdown */
295
+ selectionChange: _angular_core.OutputEmitterRef<T>;
296
+ /** Internal form control for the autocomplete input */
297
+ control: FormControl<string | null>;
298
+ /** Signal that tracks whether the autocomplete panel is currently open */
299
+ isExpanded: _angular_core.WritableSignal<boolean>;
300
+ /** Signal that tracks the current filter text typed by the user */
301
+ filterText: _angular_core.WritableSignal<string>;
296
302
  /**
297
- * Attribute of the Object whose value would be used for search
303
+ * Computed signal that filters options based on the current filter text.
304
+ * Uses the `displayWith` function to extract searchable text from each option.
305
+ * Returns all options when filter text is empty.
298
306
  */
299
- bindValue: _angular_core.InputSignal<string>;
307
+ filteredOptions: _angular_core.Signal<T[]>;
300
308
  /**
301
- * Function that maps an option's control value to its display value in the trigger.
309
+ * Display function passed to mat-autocomplete's [displayWith] to render the
310
+ * selected value in the input field. Returns empty string for null/undefined values.
302
311
  */
303
- displayWith: ((value: any) => string) | null;
312
+ displayFn: (value: T) => string;
304
313
  /**
305
- * Specifies if the autocomplete is required. Default is not required.
314
+ * Writes a new value to the internal control. Called by the parent form
315
+ * when the form control value is set programmatically.
306
316
  */
307
- required: _angular_core.InputSignal<boolean>;
317
+ writeValue(value: T | null): void;
308
318
  /**
309
- * Specifies if the autocomplete is disabled. Default is not required.
319
+ * Registers a callback function that is called when the control's value
320
+ * changes in the UI (option selected or input cleared).
310
321
  */
311
- disabled: _angular_core.InputSignal<boolean>;
322
+ registerOnChange(fn: (value: T | null) => void): void;
312
323
  /**
313
- * List of Objects that need to be bind and searched for
324
+ * Registers a callback function that is called when the control is
325
+ * first interacted with (blur or selection).
314
326
  */
315
- data: _angular_core.InputSignal<any[] | string[] | undefined>;
327
+ registerOnTouched(fn: () => void): void;
316
328
  /**
317
- * Emit selected value on selection changes
329
+ * Sets the disabled state of the internal control. Called by the parent form
330
+ * when `control.disable()` or `control.enable()` is invoked.
318
331
  */
319
- onSelectionChange: _angular_core.OutputEmitterRef<any>;
332
+ setDisabledState(isDisabled: boolean): void;
333
+ /** Updates the filter text signal as the user types in the input */
334
+ onInput(event: Event): void;
320
335
  /**
321
- * BehaviorSubject that shows the current active arrow icon
336
+ * Clears the input value, resets the filter, notifies the parent form,
337
+ * and re-focuses the input element.
322
338
  */
323
- arrowIconSubject: BehaviorSubject<string>;
339
+ clearInput(event: Event): void;
340
+ /** Opens the autocomplete panel programmatically */
341
+ openPanel(): void;
324
342
  /**
325
- * Filtered options when user types
343
+ * Handles option selection from the dropdown. Resets the filter text,
344
+ * notifies the parent form of the new value, and emits the selectionChange output.
326
345
  */
327
- filteredOptions: Observable<any[] | undefined> | undefined;
328
- writeValue(value: any): void;
329
- registerOnChange(fn: any): void;
330
- registerOnTouched(fn: any): void;
331
- setDisabledState(isDisabled: boolean): void;
332
- ngAfterContentChecked(): void;
333
- ngOnInit(): void;
334
- ngOnChanges(_changes: SimpleChanges): void;
335
- clearInput(evt: any): void;
336
- openOrClosePanel(evt: any, trigger: MatAutocompleteTrigger): void;
337
- displayFn(object: any): string;
338
- emitSelectedValue($event: MatOptionSelectionChange): void;
346
+ onOptionSelected(value: T): void;
347
+ /** Callback function registered by the parent form to propagate value changes */
339
348
  private onChange;
349
+ /** Callback function registered by the parent form to propagate touched state */
340
350
  private onTouched;
341
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<AutocompleteComponent, never>;
342
- static ɵcmp: _angular_core.ɵɵComponentDeclaration<AutocompleteComponent, "autocomplete, lib-autocomplete", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeHolder": { "alias": "placeHolder"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "classes": { "alias": "classes"; "required": false; "isSignal": true; }; "bindLabel": { "alias": "bindLabel"; "required": false; "isSignal": true; }; "bindValue": { "alias": "bindValue"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "required": false; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "data": { "alias": "data"; "required": false; "isSignal": true; }; }, { "onSelectionChange": "onSelectionChange"; }, never, never, true, never>;
351
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<AutocompleteComponent<any>, never>;
352
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<AutocompleteComponent<any>, "autocomplete, lib-autocomplete", never, { "label": { "alias": "label"; "required": false; "isSignal": true; }; "placeholder": { "alias": "placeholder"; "required": false; "isSignal": true; }; "appearance": { "alias": "appearance"; "required": false; "isSignal": true; }; "classes": { "alias": "classes"; "required": false; "isSignal": true; }; "options": { "alias": "options"; "required": false; "isSignal": true; }; "displayWith": { "alias": "displayWith"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "loadingText": { "alias": "loadingText"; "required": false; "isSignal": true; }; "noOptionsText": { "alias": "noOptionsText"; "required": false; "isSignal": true; }; }, { "selectionChange": "selectionChange"; }, never, never, true, never>;
343
353
  }
344
354
 
345
355
  declare class PrintOptions {