@basis-ng/primitives 0.0.1-alpha.76 → 0.0.1-alpha.78

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.
@@ -76,6 +76,11 @@ export declare class ComboboxComponent implements OnInit, ControlValueAccessor {
76
76
  * This ensures that the dropdown overlay matches the width of the button.
77
77
  */
78
78
  setButtonWidth(): void;
79
+ /**
80
+ * Computed signal indicando si se permite selección múltiple.
81
+ * Se obtiene de CommandOptionsComponent.
82
+ */
83
+ readonly multiple: import("@angular/core").Signal<boolean>;
79
84
  /**
80
85
  * Callback function to propagate changes to the model.
81
86
  * This is called whenever the value changes.
@@ -88,15 +93,14 @@ export declare class ComboboxComponent implements OnInit, ControlValueAccessor {
88
93
  private onTouched;
89
94
  /**
90
95
  * Writes a new value to the component.
91
- * This method is called by Angular Forms to update the value of the combobox component.
92
- * @param value - The new value to set.
96
+ * Este método ahora soporta selección múltiple.
93
97
  */
94
- writeValue(value: string[]): void;
98
+ writeValue(value: string | string[]): void;
95
99
  /**
96
100
  * Registers a callback function to be called when the value changes.
97
- * @param fn - The callback function.
101
+ * Ahora soporta selección múltiple.
98
102
  */
99
- registerOnChange(fn: (value: string[]) => void): void;
103
+ registerOnChange(fn: (value: string | string[]) => void): void;
100
104
  /**
101
105
  * Registers a callback function to be called when the component is touched.
102
106
  * @param fn - The callback function.
@@ -36,6 +36,10 @@ export declare class CommandOptionsComponent implements OnInit {
36
36
  * Emitter for closing the command options.
37
37
  */
38
38
  closeEmitter: import("@angular/core").OutputEmitterRef<void>;
39
+ /**
40
+ * Signal indicando si se permite selección múltiple.
41
+ */
42
+ readonly multiple: import("@angular/core").InputSignal<boolean>;
39
43
  /**
40
44
  * Lifecycle hook that initializes the component.
41
45
  * Enables the use of active descendant for the listbox.
@@ -57,6 +61,8 @@ export declare class CommandOptionsComponent implements OnInit {
57
61
  * Updates the CSS class of options to reflect the currently highlighted option.
58
62
  */
59
63
  updateHighlightedOption(): void;
64
+ handleValueChange(value: string[]): void;
65
+ onEnter(): void;
60
66
  static ɵfac: i0.ɵɵFactoryDeclaration<CommandOptionsComponent, never>;
61
- static ɵcmp: i0.ɵɵComponentDeclaration<CommandOptionsComponent, "ul[b-command-options]", never, { "noOptionsMessage": { "alias": "noOptionsMessage"; "required": false; "isSignal": true; }; }, { "closeEmitter": "closeEmitter"; }, ["options"], ["*"], true, [{ directive: typeof i1.CdkListbox; inputs: {}; outputs: { "cdkListboxValueChange": "cdkListboxValueChange"; }; }]>;
67
+ static ɵcmp: i0.ɵɵComponentDeclaration<CommandOptionsComponent, "ul[b-command-options]", never, { "noOptionsMessage": { "alias": "noOptionsMessage"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; }, { "closeEmitter": "closeEmitter"; }, ["options"], ["*"], true, [{ directive: typeof i1.CdkListbox; inputs: { "cdkListboxValue": "cdkListboxValue"; "cdkListboxMultiple": "multiple"; }; outputs: { "cdkListboxValueChange": "cdkListboxValueChange"; }; }]>;
62
68
  }
@@ -9,30 +9,53 @@ import * as i1 from "@angular/cdk/listbox";
9
9
  */
10
10
  export declare class SelectOptionsComponent {
11
11
  /**
12
- * Whether multiple selection is enabled.
12
+ * Signal representing the selected values in the listbox.
13
+ * This is an array of strings corresponding to the selected option values.
13
14
  */
14
- readonly multiple: import("@angular/core").InputSignal<boolean>;
15
- /**
16
- * Signal representing the selected value(s).
17
- * - If `multiple` is true: string[]
18
- * - If `multiple` is false: string | null
19
- */
20
- readonly value: import("@angular/core").WritableSignal<string | string[] | null>;
15
+ readonly value: import("@angular/core").WritableSignal<string[]>;
21
16
  /**
22
17
  * Event emitter triggered when the dropdown should close.
18
+ * This is used to notify the parent component to close the dropdown.
23
19
  */
24
20
  closeEmitter: import("@angular/core").OutputEmitterRef<void>;
21
+ /**
22
+ * Reference to the host element of the component.
23
+ * This provides access to the DOM element of the options list.
24
+ */
25
25
  el: ElementRef<any>;
26
- listBox: CdkListbox<any>;
26
+ /**
27
+ * Input for setting the maximum height of the dropdown.
28
+ * Defaults to '300px'. This controls the vertical size of the dropdown.
29
+ */
27
30
  readonly maxHeight: import("@angular/core").InputSignal<string>;
31
+ /**
32
+ * No options message displayed when there are no available options in the dropdown.
33
+ */
28
34
  readonly noOptionsMessage: import("@angular/core").InputSignal<string>;
35
+ /**
36
+ * Signal indicating whether multiple selections are allowed.
37
+ * If true, the select component allows selecting multiple options.
38
+ */
39
+ readonly multiple: import("@angular/core").InputSignal<boolean>;
40
+ /**
41
+ * Reference to the CDK Listbox directive.
42
+ * This is used to manage the options and their selection state.
43
+ */
44
+ listBox: CdkListbox<any>;
45
+ /**
46
+ * Reference to the list of options in the dropdown.
47
+ * This is a collection of `OptionComponent` instances representing the available options.
48
+ */
29
49
  readonly options: import("@angular/core").Signal<readonly OptionComponent[]>;
30
50
  /**
31
51
  * Handles changes to the selected value in the listbox.
52
+ * This method updates the `value` signal, emits the `closeEmitter` event,
53
+ * and ensures the parent component is notified of the selection change.
32
54
  *
33
- * @param valueArray - The new array of selected values from the CDK listbox.
55
+ * @param value - The new array of selected values.
34
56
  */
35
- handleValueChange(valueArray: string[]): void;
57
+ handleValueChange(value: string[]): void;
58
+ onEnter(): void;
36
59
  static ɵfac: i0.ɵɵFactoryDeclaration<SelectOptionsComponent, never>;
37
- static ɵcmp: i0.ɵɵComponentDeclaration<SelectOptionsComponent, "ul[b-select-options]", never, { "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "noOptionsMessage": { "alias": "noOptionsMessage"; "required": false; "isSignal": true; }; }, { "closeEmitter": "closeEmitter"; }, ["options"], ["*"], true, [{ directive: typeof i1.CdkListbox; inputs: { "cdkListboxValue": "cdkListboxValue"; }; outputs: { "cdkListboxValueChange": "cdkListboxValueChange"; }; }]>;
60
+ static ɵcmp: i0.ɵɵComponentDeclaration<SelectOptionsComponent, "ul[b-select-options]", never, { "maxHeight": { "alias": "maxHeight"; "required": false; "isSignal": true; }; "noOptionsMessage": { "alias": "noOptionsMessage"; "required": false; "isSignal": true; }; "multiple": { "alias": "multiple"; "required": false; "isSignal": true; }; }, { "closeEmitter": "closeEmitter"; }, ["options"], ["*"], true, [{ directive: typeof i1.CdkListbox; inputs: { "cdkListboxValue": "cdkListboxValue"; "cdkListboxMultiple": "multiple"; }; outputs: { "cdkListboxValueChange": "cdkListboxValueChange"; }; }]>;
38
61
  }
@@ -30,7 +30,7 @@ export declare class SelectComponent implements OnInit, ControlValueAccessor {
30
30
  * Computed signal representing the selected values from the dropdown.
31
31
  * This is linked to the value of the `OptionsListComponent`.
32
32
  */
33
- readonly value: import("@angular/core").WritableSignal<string | string[] | null | undefined>;
33
+ readonly value: import("@angular/core").WritableSignal<string[] | undefined>;
34
34
  /**
35
35
  * Linked signal for the width of the button element.
36
36
  * This is used to set the width of the dropdown overlay.
@@ -41,6 +41,11 @@ export declare class SelectComponent implements OnInit, ControlValueAccessor {
41
41
  * When disabled, the dropdown cannot be opened or interacted with.
42
42
  */
43
43
  readonly disabled: import("@angular/core").ModelSignal<boolean>;
44
+ /**
45
+ * Computed signal indicating whether multiple selections are allowed.
46
+ * This retrieves the `multiple` property from the `OptionsListComponent`.
47
+ */
48
+ readonly multiple: import("@angular/core").Signal<boolean>;
44
49
  /**
45
50
  * Computed signal representing the options available in the dropdown.
46
51
  * This retrieves the options from the `OptionsListComponent`.
@@ -91,12 +96,12 @@ export declare class SelectComponent implements OnInit, ControlValueAccessor {
91
96
  * This method is called by Angular Forms to update the value of the select component.
92
97
  * @param value - The new value to set.
93
98
  */
94
- writeValue(value: string | string[] | null): void;
99
+ writeValue(value: string | string[]): void;
95
100
  /**
96
101
  * Registers a callback function to be called when the value changes.
97
102
  * @param fn - The callback function.
98
103
  */
99
- registerOnChange(fn: (value: string | string[] | null) => void): void;
104
+ registerOnChange(fn: (value: string | string[]) => void): void;
100
105
  /**
101
106
  * Registers a callback function to be called when the component is touched.
102
107
  * @param fn - The callback function.
@@ -294,7 +294,7 @@ class OptionComponent {
294
294
  */
295
295
  cdkOption = inject(CdkOption);
296
296
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: OptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
297
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: OptionComponent, isStandalone: true, selector: "li[b-option]", hostDirectives: [{ directive: i1.CdkOption, inputs: ["cdkOption", "value"] }], ngImport: i0, template: `<ng-content />`, isInline: true });
297
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.10", type: OptionComponent, isStandalone: true, selector: "li[b-option]", hostDirectives: [{ directive: i1.CdkOption, inputs: ["cdkOption", "value", "cdkOptionDisabled", "disabled"] }], ngImport: i0, template: `<ng-content />`, isInline: true });
298
298
  }
299
299
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: OptionComponent, decorators: [{
300
300
  type: Component,
@@ -305,7 +305,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
305
305
  hostDirectives: [
306
306
  {
307
307
  directive: CdkOption,
308
- inputs: ['cdkOption: value'],
308
+ inputs: ['cdkOption: value', 'cdkOptionDisabled: disabled'],
309
309
  },
310
310
  ],
311
311
  }]
@@ -317,45 +317,72 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
317
317
  */
318
318
  class SelectOptionsComponent {
319
319
  /**
320
- * Whether multiple selection is enabled.
320
+ * Signal representing the selected values in the listbox.
321
+ * This is an array of strings corresponding to the selected option values.
321
322
  */
322
- multiple = input(false);
323
- /**
324
- * Signal representing the selected value(s).
325
- * - If `multiple` is true: string[]
326
- * - If `multiple` is false: string | null
327
- */
328
- value = signal(null);
323
+ value = signal([]);
329
324
  /**
330
325
  * Event emitter triggered when the dropdown should close.
326
+ * This is used to notify the parent component to close the dropdown.
331
327
  */
332
328
  closeEmitter = output();
329
+ /**
330
+ * Reference to the host element of the component.
331
+ * This provides access to the DOM element of the options list.
332
+ */
333
333
  el = inject(ElementRef);
334
- listBox = inject(CdkListbox);
334
+ /**
335
+ * Input for setting the maximum height of the dropdown.
336
+ * Defaults to '300px'. This controls the vertical size of the dropdown.
337
+ */
335
338
  maxHeight = input('300px');
339
+ /**
340
+ * No options message displayed when there are no available options in the dropdown.
341
+ */
336
342
  noOptionsMessage = input('');
343
+ /**
344
+ * Signal indicating whether multiple selections are allowed.
345
+ * If true, the select component allows selecting multiple options.
346
+ */
347
+ multiple = input(false);
348
+ /**
349
+ * Reference to the CDK Listbox directive.
350
+ * This is used to manage the options and their selection state.
351
+ */
352
+ listBox = inject(CdkListbox);
353
+ /**
354
+ * Reference to the list of options in the dropdown.
355
+ * This is a collection of `OptionComponent` instances representing the available options.
356
+ */
337
357
  options = contentChildren(OptionComponent);
338
358
  /**
339
359
  * Handles changes to the selected value in the listbox.
360
+ * This method updates the `value` signal, emits the `closeEmitter` event,
361
+ * and ensures the parent component is notified of the selection change.
340
362
  *
341
- * @param valueArray - The new array of selected values from the CDK listbox.
363
+ * @param value - The new array of selected values.
342
364
  */
343
- handleValueChange(valueArray) {
344
- if (valueArray.length === 1 && valueArray[0] === '') {
345
- this.value.set(this.multiple() ? [] : null);
346
- this.closeEmitter.emit();
365
+ handleValueChange(value) {
366
+ // If the value is an empty array or contains a single empty string, clear the selection.
367
+ if (value.length === 1 && value[0] === '') {
368
+ this.value.set([]);
369
+ if (!this.multiple()) {
370
+ this.closeEmitter.emit();
371
+ }
347
372
  return;
348
373
  }
349
- if (this.multiple()) {
350
- this.value.set(valueArray);
374
+ this.value.set(value);
375
+ if (!this.multiple()) {
376
+ this.closeEmitter.emit();
351
377
  }
352
- else {
353
- this.value.set(valueArray[0] ?? null);
378
+ }
379
+ onEnter() {
380
+ if (!this.multiple()) {
381
+ this.closeEmitter.emit();
354
382
  }
355
- this.closeEmitter.emit();
356
383
  }
357
384
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: SelectOptionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
358
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: SelectOptionsComponent, isStandalone: true, selector: "ul[b-select-options]", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, noOptionsMessage: { classPropertyName: "noOptionsMessage", publicName: "noOptionsMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeEmitter: "closeEmitter" }, host: { listeners: { "cdkListboxValueChange": "handleValueChange($event.value)", "keydown.enter": "closeEmitter.emit()" }, properties: { "cdkListboxValue": "value()", "style.max-height": "maxHeight()" } }, queries: [{ propertyName: "options", predicate: OptionComponent, isSignal: true }], hostDirectives: [{ directive: i1.CdkListbox, inputs: ["cdkListboxValue", "cdkListboxValue"], outputs: ["cdkListboxValueChange", "cdkListboxValueChange"] }], ngImport: i0, template: `<ng-content />
385
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: SelectOptionsComponent, isStandalone: true, selector: "ul[b-select-options]", inputs: { maxHeight: { classPropertyName: "maxHeight", publicName: "maxHeight", isSignal: true, isRequired: false, transformFunction: null }, noOptionsMessage: { classPropertyName: "noOptionsMessage", publicName: "noOptionsMessage", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeEmitter: "closeEmitter" }, host: { listeners: { "cdkListboxValueChange": "handleValueChange($event.value)", "keydown.enter": "onEnter()" }, properties: { "cdkListboxValue": "value()", "style.max-height": "maxHeight()" } }, queries: [{ propertyName: "options", predicate: OptionComponent, isSignal: true }], hostDirectives: [{ directive: i1.CdkListbox, inputs: ["cdkListboxValue", "cdkListboxValue", "cdkListboxMultiple", "multiple"], outputs: ["cdkListboxValueChange", "cdkListboxValueChange"] }], ngImport: i0, template: `<ng-content />
359
386
  @if (options().length === 0) {
360
387
  <div class="no-options-message">
361
388
  {{ noOptionsMessage() }}
@@ -376,7 +403,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
376
403
  hostDirectives: [
377
404
  {
378
405
  directive: CdkListbox,
379
- inputs: ['cdkListboxValue'],
406
+ inputs: ['cdkListboxValue', 'cdkListboxMultiple: multiple'],
380
407
  outputs: ['cdkListboxValueChange'],
381
408
  },
382
409
  ],
@@ -384,7 +411,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
384
411
  '[cdkListboxValue]': 'value()',
385
412
  '(cdkListboxValueChange)': 'handleValueChange($event.value)',
386
413
  '[style.max-height]': 'maxHeight()',
387
- '(keydown.enter)': 'closeEmitter.emit()',
414
+ '(keydown.enter)': 'onEnter()',
388
415
  },
389
416
  }]
390
417
  }] });
@@ -781,6 +808,11 @@ class SelectComponent {
781
808
  * When disabled, the dropdown cannot be opened or interacted with.
782
809
  */
783
810
  disabled = model(false);
811
+ /**
812
+ * Computed signal indicating whether multiple selections are allowed.
813
+ * This retrieves the `multiple` property from the `OptionsListComponent`.
814
+ */
815
+ multiple = computed(() => this.optionsList()?.multiple() ?? false);
784
816
  /**
785
817
  * Computed signal representing the options available in the dropdown.
786
818
  * This retrieves the options from the `OptionsListComponent`.
@@ -792,12 +824,11 @@ class SelectComponent {
792
824
  */
793
825
  content = computed(() => {
794
826
  const selected = this.value();
795
- const selectedArray = Array.isArray(selected) ? selected : [selected];
796
- const valid = selectedArray.length > 0 &&
797
- !(selectedArray.length === 1 && selectedArray[0] === '');
798
- if (valid) {
827
+ if (selected &&
828
+ selected.length > 0 &&
829
+ !(selected.length === 1 && selected[0] === '')) {
799
830
  return this.options()?.reduce((acc, option) => {
800
- if (selectedArray.includes(option.cdkOption.value)) {
831
+ if (selected.includes(option.cdkOption.value)) {
801
832
  return acc
802
833
  ? acc + ', ' + option.el.nativeElement.innerText
803
834
  : option.el.nativeElement.innerText;
@@ -828,20 +859,7 @@ class SelectComponent {
828
859
  */
829
860
  handleSelectedValueChange() {
830
861
  this.optionsList()?.closeEmitter.subscribe(() => {
831
- const selected = this.value();
832
- const isMultiple = this.optionsList()?.multiple();
833
- let emitValue;
834
- if (isMultiple) {
835
- emitValue = Array.isArray(selected) ? selected : [];
836
- }
837
- else {
838
- emitValue = Array.isArray(selected)
839
- ? (selected[0] ?? null)
840
- : typeof selected === 'string'
841
- ? selected
842
- : null;
843
- }
844
- this.onChange(emitValue);
862
+ this.onChange(this.value());
845
863
  this.onTouched();
846
864
  this.isOpen.set(false);
847
865
  });
@@ -877,19 +895,34 @@ class SelectComponent {
877
895
  * @param value - The new value to set.
878
896
  */
879
897
  writeValue(value) {
880
- if (value == null)
898
+ if (!value) {
881
899
  return;
882
- const isMultiple = this.optionsList()?.multiple();
883
- const values = isMultiple ? value : [value];
884
- values.forEach(v => this.optionsList()?.listBox?.selectValue(v));
885
- this.value.set(isMultiple ? values : values[0]);
900
+ }
901
+ const values = this.multiple()
902
+ ? Array.isArray(value)
903
+ ? value
904
+ : [value]
905
+ : [typeof value === 'string' ? value : value?.[0]];
906
+ if (values) {
907
+ values.forEach(val => {
908
+ this.optionsList()?.listBox?.selectValue(val);
909
+ });
910
+ this.value.set(values);
911
+ }
886
912
  }
887
913
  /**
888
914
  * Registers a callback function to be called when the value changes.
889
915
  * @param fn - The callback function.
890
916
  */
891
917
  registerOnChange(fn) {
892
- this.onChange = fn;
918
+ this.onChange = (val) => {
919
+ if (this.multiple()) {
920
+ fn(val);
921
+ }
922
+ else {
923
+ fn(val?.[0] ?? '');
924
+ }
925
+ };
893
926
  }
894
927
  /**
895
928
  * Registers a callback function to be called when the component is touched.
@@ -2580,6 +2613,10 @@ class CommandOptionsComponent {
2580
2613
  * Emitter for closing the command options.
2581
2614
  */
2582
2615
  closeEmitter = output();
2616
+ /**
2617
+ * Signal indicando si se permite selección múltiple.
2618
+ */
2619
+ multiple = input(false);
2583
2620
  /**
2584
2621
  * Lifecycle hook that initializes the component.
2585
2622
  * Enables the use of active descendant for the listbox.
@@ -2634,8 +2671,27 @@ class CommandOptionsComponent {
2634
2671
  }
2635
2672
  });
2636
2673
  }
2674
+ handleValueChange(value) {
2675
+ // If the value is an empty array or contains a single empty string, clear the selection.
2676
+ if (value.length === 1 && value[0] === '') {
2677
+ this.value.set([]);
2678
+ if (!this.multiple()) {
2679
+ this.closeEmitter.emit();
2680
+ }
2681
+ return;
2682
+ }
2683
+ this.value.set(value);
2684
+ if (!this.multiple()) {
2685
+ this.closeEmitter.emit();
2686
+ }
2687
+ }
2688
+ onEnter() {
2689
+ if (!this.multiple()) {
2690
+ this.closeEmitter.emit();
2691
+ }
2692
+ }
2637
2693
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.10", ngImport: i0, type: CommandOptionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2638
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: CommandOptionsComponent, isStandalone: true, selector: "ul[b-command-options]", inputs: { noOptionsMessage: { classPropertyName: "noOptionsMessage", publicName: "noOptionsMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeEmitter: "closeEmitter" }, host: { listeners: { "cdkListboxValueChange": "selectOption($event.value)", "keydown.enter": "closeEmitter.emit()" } }, queries: [{ propertyName: "options", predicate: CdkOption, isSignal: true }], hostDirectives: [{ directive: i1.CdkListbox, outputs: ["cdkListboxValueChange", "cdkListboxValueChange"] }], ngImport: i0, template: `<ng-content />
2694
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.10", type: CommandOptionsComponent, isStandalone: true, selector: "ul[b-command-options]", inputs: { noOptionsMessage: { classPropertyName: "noOptionsMessage", publicName: "noOptionsMessage", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { closeEmitter: "closeEmitter" }, host: { listeners: { "cdkListboxValueChange": "handleValueChange($event.value)", "keydown.enter": "onEnter()" }, properties: { "cdkListboxValue": "value()", "cdkListboxMultiple": "multiple()" } }, queries: [{ propertyName: "options", predicate: CdkOption, isSignal: true }], hostDirectives: [{ directive: i1.CdkListbox, inputs: ["cdkListboxValue", "cdkListboxValue", "cdkListboxMultiple", "multiple"], outputs: ["cdkListboxValueChange", "cdkListboxValueChange"] }], ngImport: i0, template: `<ng-content />
2639
2695
  @if (options().length === 0) {
2640
2696
  <div class="no-options-message">
2641
2697
  {{ noOptionsMessage() }}
@@ -2656,12 +2712,15 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.10", ngImpo
2656
2712
  hostDirectives: [
2657
2713
  {
2658
2714
  directive: CdkListbox,
2715
+ inputs: ['cdkListboxValue', 'cdkListboxMultiple: multiple'],
2659
2716
  outputs: ['cdkListboxValueChange'],
2660
2717
  },
2661
2718
  ],
2662
2719
  host: {
2663
- '(cdkListboxValueChange)': 'selectOption($event.value)',
2664
- '(keydown.enter)': 'closeEmitter.emit()',
2720
+ '[cdkListboxValue]': 'value()',
2721
+ '[cdkListboxMultiple]': 'multiple()',
2722
+ '(cdkListboxValueChange)': 'handleValueChange($event.value)',
2723
+ '(keydown.enter)': 'onEnter()',
2665
2724
  },
2666
2725
  }]
2667
2726
  }] });
@@ -2877,6 +2936,11 @@ class ComboboxComponent {
2877
2936
  setButtonWidth() {
2878
2937
  this.buttonWidth.set(this.button()?.el.nativeElement.offsetWidth);
2879
2938
  }
2939
+ /**
2940
+ * Computed signal indicando si se permite selección múltiple.
2941
+ * Se obtiene de CommandOptionsComponent.
2942
+ */
2943
+ multiple = computed(() => this.command()?.commandOptions()?.multiple() ?? false);
2880
2944
  // Control Value Accessor methods
2881
2945
  /**
2882
2946
  * Callback function to propagate changes to the model.
@@ -2890,23 +2954,37 @@ class ComboboxComponent {
2890
2954
  onTouched = () => undefined;
2891
2955
  /**
2892
2956
  * Writes a new value to the component.
2893
- * This method is called by Angular Forms to update the value of the combobox component.
2894
- * @param value - The new value to set.
2957
+ * Este método ahora soporta selección múltiple.
2895
2958
  */
2896
2959
  writeValue(value) {
2897
- if (value) {
2898
- value.forEach(value => {
2899
- this.command()?.commandOptions()?.cdkListbox?.selectValue(value);
2960
+ if (!value) {
2961
+ return;
2962
+ }
2963
+ const values = this.multiple()
2964
+ ? Array.isArray(value)
2965
+ ? value
2966
+ : [value]
2967
+ : [typeof value === 'string' ? value : value?.[0]];
2968
+ if (values) {
2969
+ values.forEach(val => {
2970
+ this.command()?.commandOptions()?.cdkListbox?.selectValue(val);
2900
2971
  });
2901
- this.value.set(value);
2972
+ this.value.set(values);
2902
2973
  }
2903
2974
  }
2904
2975
  /**
2905
2976
  * Registers a callback function to be called when the value changes.
2906
- * @param fn - The callback function.
2977
+ * Ahora soporta selección múltiple.
2907
2978
  */
2908
2979
  registerOnChange(fn) {
2909
- this.onChange = fn;
2980
+ this.onChange = (val) => {
2981
+ if (this.multiple()) {
2982
+ fn(val);
2983
+ }
2984
+ else {
2985
+ fn(val?.[0] ?? '');
2986
+ }
2987
+ };
2910
2988
  }
2911
2989
  /**
2912
2990
  * Registers a callback function to be called when the component is touched.