@patter/ngx-components 20.0.4 → 20.0.6

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
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { OnInit, EventEmitter, ElementRef, OnDestroy, Signal, AfterViewInit, TemplateRef, ApplicationRef, EnvironmentInjector, QueryList } from '@angular/core';
2
+ import { OnInit, EventEmitter, ElementRef, OnDestroy, Signal, AfterViewInit, TemplateRef, QueryList } from '@angular/core';
3
3
  import { ValidatorFn, AsyncValidatorFn, FormGroup, ControlValueAccessor, FormControl } from '@angular/forms';
4
4
  import { Observable } from 'rxjs';
5
5
 
@@ -34,7 +34,7 @@ interface PtrOptionGroup {
34
34
  }
35
35
  type OptionInputs = (string | PtrOption)[] | PtrOptionGroup[];
36
36
  interface PtrFormField {
37
- type: 'text' | 'textarea' | 'number' | 'email' | 'password' | 'search' | 'select' | 'date' | 'hidden' | 'chips';
37
+ type: 'text' | 'textarea' | 'number' | 'email' | 'password' | 'search' | 'select' | 'multi-select' | 'date' | 'hidden' | 'chips';
38
38
  name: string;
39
39
  label: string;
40
40
  description?: string;
@@ -47,6 +47,7 @@ interface PtrFormField {
47
47
  validationMessages?: Record<string, string>;
48
48
  options?: OptionInputs;
49
49
  dialogHelpText?: string;
50
+ maxSelections?: number;
50
51
  searchFn?: (term: string) => Observable<string[]>;
51
52
  maxItems?: number;
52
53
  conditional?: PtrConditionalConfig;
@@ -84,11 +85,11 @@ declare class PtrFormComponent implements OnInit {
84
85
  static ɵcmp: i0.ɵɵComponentDeclaration<PtrFormComponent, "ptr-form", never, { "config": { "alias": "config"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "error": { "alias": "error"; "required": false; }; }, { "formSubmit": "formSubmit"; "formGroupCreated": "formGroupCreated"; }, never, never, true, never>;
85
86
  }
86
87
 
87
- interface ProcessedOption {
88
+ interface ProcessedOption$1 {
88
89
  type: 'option' | 'group';
89
90
  label: string;
90
91
  value?: string;
91
- options?: ProcessedOption[];
92
+ options?: ProcessedOption$1[];
92
93
  }
93
94
  declare class PtrDialogListComponent {
94
95
  set options(value: (PtrOption | PtrOptionGroup | string)[] | undefined);
@@ -106,7 +107,7 @@ declare class PtrDialogListComponent {
106
107
  isOpen: i0.WritableSignal<boolean>;
107
108
  private componentId;
108
109
  listId: string;
109
- filteredOptions: i0.Signal<ProcessedOption[]>;
110
+ filteredOptions: i0.Signal<ProcessedOption$1[]>;
110
111
  openDialog(): void;
111
112
  openDialogSilent(): void;
112
113
  closeDialog(): void;
@@ -154,6 +155,90 @@ declare class PtrSelectComponent {
154
155
  static ɵcmp: i0.ɵɵComponentDeclaration<PtrSelectComponent, "ptr-select", never, { "options": { "alias": "options"; "required": false; }; "showSearch": { "alias": "showSearch"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "label": { "alias": "label"; "required": false; }; "description": { "alias": "description"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; }, { "selectionChange": "selectionChange"; }, never, never, true, never>;
155
156
  }
156
157
 
158
+ interface ProcessedOption {
159
+ type: 'option' | 'group';
160
+ label: string;
161
+ value?: string;
162
+ options?: ProcessedOption[];
163
+ }
164
+ declare class PtrMultiDialogListComponent {
165
+ set options(value: (PtrOption | PtrOptionGroup | string)[] | undefined);
166
+ showSearch: boolean;
167
+ searchPlaceholder: string;
168
+ dialogTitle?: string | undefined;
169
+ selectedValues: string[];
170
+ maxSelections?: number;
171
+ showSelectAll: boolean;
172
+ selectionChange: EventEmitter<string[]>;
173
+ dialogClosed: EventEmitter<void>;
174
+ searchTermChanged: EventEmitter<string>;
175
+ dialog: ElementRef<HTMLDialogElement>;
176
+ private _options;
177
+ selectedItems: i0.WritableSignal<string[]>;
178
+ searchTerm: i0.WritableSignal<string>;
179
+ highlightedIndex: i0.WritableSignal<number>;
180
+ isOpen: i0.WritableSignal<boolean>;
181
+ private componentId;
182
+ listId: string;
183
+ filteredOptions: i0.Signal<ProcessedOption[]>;
184
+ allFilteredOptionValues: i0.Signal<string[]>;
185
+ allSelectedState: i0.Signal<boolean | "indeterminate">;
186
+ shouldShowSelectAll: i0.Signal<boolean>;
187
+ openDialog(): void;
188
+ openDialogSilent(): void;
189
+ closeDialog(): void;
190
+ updateSearchTerm(term: string): void;
191
+ onDialogKeyDown(event: KeyboardEvent): void;
192
+ onInputKeyDown(event: KeyboardEvent): void;
193
+ onOptionKeyDown(event: KeyboardEvent, optionValue: string): void;
194
+ onSelectAllKeyDown(event: KeyboardEvent): void;
195
+ focusOption(): void;
196
+ toggleOption(optionValue: string): void;
197
+ toggleSelectAll(): void;
198
+ isOptionSelected(optionValue: string): boolean;
199
+ canSelectMore(): boolean;
200
+ private getTotalOptionsCount;
201
+ private processOptions;
202
+ adjustDialogPosition(): void;
203
+ resetDialogPosition(): void;
204
+ static ɵfac: i0.ɵɵFactoryDeclaration<PtrMultiDialogListComponent, never>;
205
+ static ɵcmp: i0.ɵɵComponentDeclaration<PtrMultiDialogListComponent, "ptr-multi-dialog-list", never, { "options": { "alias": "options"; "required": false; }; "showSearch": { "alias": "showSearch"; "required": false; }; "searchPlaceholder": { "alias": "searchPlaceholder"; "required": false; }; "dialogTitle": { "alias": "dialogTitle"; "required": false; }; "selectedValues": { "alias": "selectedValues"; "required": false; }; "maxSelections": { "alias": "maxSelections"; "required": false; }; "showSelectAll": { "alias": "showSelectAll"; "required": false; }; }, { "selectionChange": "selectionChange"; "dialogClosed": "dialogClosed"; "searchTermChanged": "searchTermChanged"; }, never, never, true, never>;
206
+ }
207
+
208
+ declare class PtrMultiSelectComponent {
209
+ options: (PtrOption | PtrOptionGroup | string)[] | undefined;
210
+ showSearch: boolean;
211
+ placeholder?: string | null;
212
+ label?: string | undefined;
213
+ description?: string | undefined;
214
+ labelPosition?: 'top' | 'inline';
215
+ maxSelections?: number;
216
+ showSelectAll: boolean;
217
+ selectionChange: EventEmitter<string[]>;
218
+ selectButton: ElementRef<HTMLButtonElement>;
219
+ dialogList: PtrMultiDialogListComponent;
220
+ value: i0.WritableSignal<string[]>;
221
+ selectedOptions: i0.Signal<PtrOption[]>;
222
+ displayText: i0.Signal<string>;
223
+ effectivePlaceholder: i0.Signal<string>;
224
+ private componentId;
225
+ labelId: string;
226
+ inputId: string;
227
+ onChange: (value: string[]) => void;
228
+ onTouched: () => void;
229
+ onDocumentClick(event: MouseEvent): void;
230
+ toggleDialog(): void;
231
+ onSelectionChanged(selectedValues: string[]): void;
232
+ removeSelectedItem(valueToRemove: string): void;
233
+ writeValue(value: string[]): void;
234
+ registerOnChange(fn: (value: string[]) => void): void;
235
+ registerOnTouched(fn: () => void): void;
236
+ setDisabledState?(isDisabled: boolean): void;
237
+ private flattenOptions;
238
+ static ɵfac: i0.ɵɵFactoryDeclaration<PtrMultiSelectComponent, never>;
239
+ static ɵcmp: i0.ɵɵComponentDeclaration<PtrMultiSelectComponent, "ptr-multi-select", never, { "options": { "alias": "options"; "required": false; }; "showSearch": { "alias": "showSearch"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "label": { "alias": "label"; "required": false; }; "description": { "alias": "description"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "maxSelections": { "alias": "maxSelections"; "required": false; }; "showSelectAll": { "alias": "showSelectAll"; "required": false; }; }, { "selectionChange": "selectionChange"; }, never, never, true, never>;
240
+ }
241
+
157
242
  declare class PtrInputComponent implements ControlValueAccessor, OnInit {
158
243
  type: 'text' | 'number' | 'email' | 'password' | 'search' | 'hidden' | 'date' | 'textarea';
159
244
  label: string;
@@ -195,7 +280,14 @@ declare class PtrChipInputComponent implements ControlValueAccessor, OnInit {
195
280
  description?: string | undefined;
196
281
  labelPosition?: 'top' | 'inline';
197
282
  maxItems?: number;
283
+ suggestions: (PtrOption | PtrOptionGroup | string)[] | undefined;
284
+ /**
285
+ * Auto reopen the suggestions dialog after adding/selecting a chip (default true)
286
+ * as long as maxItems has not been reached.
287
+ */
288
+ autoReopenAfterSelect: boolean;
198
289
  chipInput: ElementRef<HTMLInputElement>;
290
+ dialogList?: PtrDialogListComponent;
199
291
  private componentId;
200
292
  inputId: string;
201
293
  inputValue: i0.WritableSignal<string>;
@@ -209,12 +301,19 @@ declare class PtrChipInputComponent implements ControlValueAccessor, OnInit {
209
301
  removeChip(index: number): void;
210
302
  onKeyDown(event: KeyboardEvent): void;
211
303
  onBlur(): void;
304
+ onDocumentClick(event: MouseEvent): void;
305
+ openDialog(): void;
306
+ closeDialog(): void;
307
+ onSuggestionSelected(optionValue: string | null): void;
308
+ private addChipFromValue;
309
+ private maybeReopenDialog;
310
+ private hasSuggestions;
212
311
  writeValue(value: string[]): void;
213
312
  registerOnChange(fn: (value: string[]) => void): void;
214
313
  registerOnTouched(fn: () => void): void;
215
314
  setDisabledState(isDisabled: boolean): void;
216
315
  static ɵfac: i0.ɵɵFactoryDeclaration<PtrChipInputComponent, never>;
217
- static ɵcmp: i0.ɵɵComponentDeclaration<PtrChipInputComponent, "ptr-chip-input", never, { "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "description": { "alias": "description"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "maxItems": { "alias": "maxItems"; "required": false; }; }, {}, never, never, true, never>;
316
+ static ɵcmp: i0.ɵɵComponentDeclaration<PtrChipInputComponent, "ptr-chip-input", never, { "label": { "alias": "label"; "required": false; }; "placeholder": { "alias": "placeholder"; "required": false; }; "description": { "alias": "description"; "required": false; }; "labelPosition": { "alias": "labelPosition"; "required": false; }; "maxItems": { "alias": "maxItems"; "required": false; }; "suggestions": { "alias": "suggestions"; "required": false; }; "autoReopenAfterSelect": { "alias": "autoReopenAfterSelect"; "required": false; }; }, {}, never, never, true, never>;
218
317
  }
219
318
 
220
319
  declare class PtrTitleComponent implements OnInit {
@@ -356,7 +455,6 @@ declare class PtrDialogService {
356
455
  private appRef;
357
456
  private injector;
358
457
  private dialogComponentRef;
359
- constructor(appRef: ApplicationRef, injector: EnvironmentInjector);
360
458
  open<T = unknown>(options: PtrDialogOptions<T>): Observable<DialogResult<T>>;
361
459
  private removeDialog;
362
460
  static ɵfac: i0.ɵɵFactoryDeclaration<PtrDialogService, never>;
@@ -448,5 +546,5 @@ declare class PtrToasterComponent {
448
546
  static ɵcmp: i0.ɵɵComponentDeclaration<PtrToasterComponent, "ptr-toaster", never, {}, {}, never, never, true, never>;
449
547
  }
450
548
 
451
- export { PtrBreadcrumbsComponent, PtrButtonComponent, PtrChipInputComponent, PtrDialogComponent, PtrDialogService, PtrFormComponent, PtrInputComponent, PtrLoadingService, PtrLoadingSpinnerComponent, PtrLoadingSpinnerDirective, PtrMenuComponent, PtrSelectComponent, PtrTabComponent, PtrTabsComponent, PtrTitleComponent, PtrToasterComponent, PtrToasterService, PtrTooltipComponent };
549
+ export { PtrBreadcrumbsComponent, PtrButtonComponent, PtrChipInputComponent, PtrDialogComponent, PtrDialogService, PtrFormComponent, PtrInputComponent, PtrLoadingService, PtrLoadingSpinnerComponent, PtrLoadingSpinnerDirective, PtrMenuComponent, PtrMultiSelectComponent, PtrSelectComponent, PtrTabComponent, PtrTabsComponent, PtrTitleComponent, PtrToasterComponent, PtrToasterService, PtrTooltipComponent };
452
550
  export type { OptionInputs, PtrBreadcrumb, PtrConditionalConfig, PtrConditionalRule, PtrFormConfig, PtrFormField, PtrMenuItem, PtrOption, PtrOptionGroup, PtrToast };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patter/ngx-components",
3
- "version": "20.0.4",
3
+ "version": "20.0.6",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.0.0",
6
6
  "@angular/core": "^20.0.0"
Binary file
Binary file