@js-smart/ng-kit 21.5.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.5.0",
3
+ "version": "21.6.0",
4
4
  "license": "MIT",
5
5
  "author": "Pavan Kumar Jadda",
6
6
  "private": false,
@@ -1,9 +1,10 @@
1
1
  import * as _angular_core from '@angular/core';
2
- import { OnInit, ChangeDetectorRef, OnDestroy, OnChanges, 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';
@@ -257,140 +258,98 @@ declare class SpinnerComponent {
257
258
  static ɵcmp: _angular_core.ɵɵComponentDeclaration<SpinnerComponent, "spinner,lib-spinner", never, { "bootstrapSpinner": { "alias": "bootstrapSpinner"; "required": false; "isSignal": true; }; "diameter": { "alias": "diameter"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "strokeWidth": { "alias": "strokeWidth"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
258
259
  }
259
260
 
260
- type AutocompleteOption = Record<string, any>;
261
261
  /**
262
262
  * Reusable Auto Complete component that extends MatAutoComplete to show Clear icon and Arrow buttons
263
263
  *
264
264
  * @author Pavan Kumar Jadda
265
265
  * @since 12.0.0
266
266
  */
267
- declare class AutocompleteComponent implements OnInit, OnChanges, ControlValueAccessor {
268
- /**
269
- * Gets reference inputAutoComplete HTML attribute
270
- */
271
- inputAutoComplete: ElementRef;
272
- private destroyRef;
273
- /**
274
- * Internal form control for the autocomplete
275
- */
276
- control: FormControl<string | AutocompleteOption | null>;
277
- /**
278
- * Label of the AutoComplete
279
- */
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 */
280
273
  label: _angular_core.InputSignal<string>;
281
- /**
282
- * Placeholder of the AutoComplete
283
- */
284
- placeHolder: _angular_core.InputSignal<string>;
285
- /**
286
- * Appearance of the AutoComplete, defaults to `fill`
287
- */
288
- appearance: _angular_core.InputSignal<"fill" | "outline">;
289
- /**
290
- * List of CSS classes that need to applied to autocomplete
291
- */
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 */
292
279
  classes: _angular_core.InputSignal<string>;
280
+ /** List of options to display in the dropdown */
281
+ options: _angular_core.InputSignal<T[]>;
293
282
  /**
294
- * Attribute of the Object whose value would be shown when searching for data. Defaults to `ID`
295
- */
296
- bindLabel: _angular_core.InputSignal<string>;
297
- /**
298
- * Attribute of the Object whose value would be used for search
299
- */
300
- bindValue: _angular_core.InputSignal<string>;
301
- /**
302
- * Function that maps an option's control value to its display value in the trigger.
303
- */
304
- displayWith: _angular_core.InputSignal<((value: string | AutocompleteOption) => string) | null>;
305
- /**
306
- * Specifies if the autocomplete is required. Default is not required.
307
- */
308
- required: _angular_core.InputSignal<boolean>;
309
- /**
310
- * Specifies if the autocomplete is disabled. Default is not required.
311
- */
312
- disabled: _angular_core.InputSignal<boolean>;
313
- /**
314
- * Text displayed when no options match the input. Defaults to 'No options'
315
- */
316
- noOptionsText: _angular_core.InputSignal<string>;
317
- /**
318
- * Whether the autocomplete is in a loading state. Shows a loading message instead of options
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.
319
286
  */
287
+ displayWith: _angular_core.InputSignal<(value: T) => string>;
288
+ /** Whether the autocomplete is in a loading state. Shows a spinner instead of options */
320
289
  loading: _angular_core.InputSignal<boolean>;
321
- /**
322
- * Text displayed when the autocomplete is in a loading state. Defaults to 'Loading...'
323
- */
290
+ /** Text displayed when the autocomplete is in a loading state. Defaults to 'Loading...' */
324
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>;
325
302
  /**
326
- * List of Objects that need to be bind and searched for
327
- */
328
- data: _angular_core.InputSignal<(string | AutocompleteOption)[] | undefined>;
329
- /**
330
- * Emit selected value on selection changes
331
- */
332
- onSelectionChange: _angular_core.OutputEmitterRef<string | AutocompleteOption>;
333
- /**
334
- * Signal that tracks the current arrow icon state
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.
335
306
  */
336
- arrowIcon: _angular_core.WritableSignal<string>;
307
+ filteredOptions: _angular_core.Signal<T[]>;
337
308
  /**
338
- * Filtered options when user types
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.
339
311
  */
340
- filteredOptions: Observable<(string | AutocompleteOption)[] | undefined> | undefined;
312
+ displayFn: (value: T) => string;
341
313
  /**
342
- * Writes a new value to the control
314
+ * Writes a new value to the internal control. Called by the parent form
315
+ * when the form control value is set programmatically.
343
316
  */
344
- writeValue(value: string | AutocompleteOption): void;
317
+ writeValue(value: T | null): void;
345
318
  /**
346
- * Registers a callback function that is called when the control's value changes
319
+ * Registers a callback function that is called when the control's value
320
+ * changes in the UI (option selected or input cleared).
347
321
  */
348
- registerOnChange(fn: (value: string | AutocompleteOption | null) => void): void;
322
+ registerOnChange(fn: (value: T | null) => void): void;
349
323
  /**
350
- * Registers a callback function that is called when the control is touched
324
+ * Registers a callback function that is called when the control is
325
+ * first interacted with (blur or selection).
351
326
  */
352
327
  registerOnTouched(fn: () => void): void;
353
328
  /**
354
- * Sets the disabled state of the control
329
+ * Sets the disabled state of the internal control. Called by the parent form
330
+ * when `control.disable()` or `control.enable()` is invoked.
355
331
  */
356
332
  setDisabledState(isDisabled: boolean): void;
333
+ /** Updates the filter text signal as the user types in the input */
334
+ onInput(event: Event): void;
357
335
  /**
358
- * Initializes the filtered options observable pipeline
359
- */
360
- ngOnInit(): void;
361
- /**
362
- * Binds the displayFn to the component context on input changes
363
- */
364
- ngOnChanges(_changes: SimpleChanges): void;
365
- /**
366
- * Clears the input value, resets the control, and re-focuses the input
367
- */
368
- clearInput(evt: Event): void;
369
- /**
370
- * Toggles the autocomplete panel open or closed
371
- */
372
- openOrClosePanel(evt: Event, trigger: MatAutocompleteTrigger): void;
373
- /**
374
- * Returns the display value for the given option. Uses custom displayWith function if provided,
375
- * otherwise falls back to the bindLabel property or the string value itself.
376
- */
377
- displayFn(object: string | AutocompleteOption): string;
378
- /**
379
- * Emits the selected value and notifies the parent form of the selection change
380
- */
381
- emitSelectedValue($event: MatOptionSelectionChange): void;
382
- /**
383
- * Updates the arrow icon to point up when the panel opens
336
+ * Clears the input value, resets the filter, notifies the parent form,
337
+ * and re-focuses the input element.
384
338
  */
385
- onPanelOpened(): void;
339
+ clearInput(event: Event): void;
340
+ /** Opens the autocomplete panel programmatically */
341
+ openPanel(): void;
386
342
  /**
387
- * Updates the arrow icon to point down when the panel closes
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.
388
345
  */
389
- onPanelClosed(): void;
346
+ onOptionSelected(value: T): void;
347
+ /** Callback function registered by the parent form to propagate value changes */
390
348
  private onChange;
349
+ /** Callback function registered by the parent form to propagate touched state */
391
350
  private onTouched;
392
- static ɵfac: _angular_core.ɵɵFactoryDeclaration<AutocompleteComponent, never>;
393
- 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; "isSignal": true; }; "required": { "alias": "required"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "noOptionsText": { "alias": "noOptionsText"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "loadingText": { "alias": "loadingText"; "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>;
394
353
  }
395
354
 
396
355
  declare class PrintOptions {
@@ -1131,4 +1090,4 @@ declare const markSuccess: (progressState: WritableSignal<ProgressState>, messag
1131
1090
  declare const markError: (progressState: WritableSignal<ProgressState>, message?: string) => void;
1132
1091
 
1133
1092
  export { AlertComponent, AutocompleteComponent, BaseButtonDirective, BsLinkButtonComponent, BsLinkButtonDirective, CloseButtonDirective, ConfirmDialogComponent, DeleteButtonComponent, DeleteButtonDirective, EditBsButtonComponent, EditBsButtonDirective, EditButtonComponent, EditButtonDirective, EditSolidSvgComponent, EditSvgIconButtonComponent, EditSvgIconButtonDirective, EntityStore, ExcelExportButtonComponent, ExcelExportButtonDirective, ManageButtonComponent, ManageButtonDirective, MatSnackBarService, NgxPrintDirective, NgxSpinnerComponent, NgxSpinnerService, PdfExportButtonComponent, PdfExportButtonDirective, PreventMultipleClicksDirective, PrimaryButtonComponent, PrimaryButtonDirective, SavePrimaryButtonComponent, SavePrimaryButtonDirective, SearchButtonComponent, SpinnerComponent, Store, SuccessButtonComponent, SuccessButtonDirective, ViewButtonComponent, ViewButtonDirective, ViewPrimaryButtonComponent, ViewPrimaryButtonDirective, initializeState, markError, markLoading, markSuccess };
1134
- export type { AlertType, AutocompleteOption, ConfirmDialogData, MatSnackBarOptions, ProgressState };
1093
+ export type { AlertType, ConfirmDialogData, MatSnackBarOptions, ProgressState };