@coreui/angular-pro 4.0.0-alpha.5 → 4.0.0-alpha.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.
@@ -4371,27 +4371,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4371
4371
  args: ['class']
4372
4372
  }] } });
4373
4373
 
4374
- class MultiSelectOptgroupComponent {
4375
- get hostClasses() {
4376
- return {
4377
- 'form-multi-select-options': true
4378
- };
4379
- }
4380
- }
4381
- MultiSelectOptgroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptgroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4382
- MultiSelectOptgroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectOptgroupComponent, selector: "c-multi-select-optgroup", inputs: { label: "label", disabled: "disabled" }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<c-multi-select-optgroup-label *ngIf=\"label\">{{label}}</c-multi-select-optgroup-label>\r\n<ng-content></ng-content>\r\n", styles: [":host{display:block}\n"], components: [{ type: MultiSelectOptgroupLabelComponent, selector: "c-multi-select-optgroup-label" }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4383
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptgroupComponent, decorators: [{
4384
- type: Component,
4385
- args: [{ selector: 'c-multi-select-optgroup', template: "<c-multi-select-optgroup-label *ngIf=\"label\">{{label}}</c-multi-select-optgroup-label>\r\n<ng-content></ng-content>\r\n", styles: [":host{display:block}\n"] }]
4386
- }], propDecorators: { label: [{
4387
- type: Input
4388
- }], disabled: [{
4389
- type: Input
4390
- }], hostClasses: [{
4391
- type: HostBinding,
4392
- args: ['class']
4393
- }] } });
4394
-
4395
4374
  class MultiSelectService {
4396
4375
  constructor() {
4397
4376
  this.multiSelectState = new BehaviorSubject({});
@@ -4413,17 +4392,19 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4413
4392
  }], ctorParameters: function () { return []; } });
4414
4393
 
4415
4394
  class MultiSelectOptionComponent {
4416
- constructor(elementRef, renderer, focusMonitor, multiSelectService) {
4395
+ constructor(elementRef, renderer, changeDetectorRef, focusMonitor, multiSelectService) {
4417
4396
  this.elementRef = elementRef;
4418
4397
  this.renderer = renderer;
4398
+ this.changeDetectorRef = changeDetectorRef;
4419
4399
  this.focusMonitor = focusMonitor;
4420
4400
  this.multiSelectService = multiSelectService;
4421
- this._disabled = false;
4422
- this._selected = false;
4423
4401
  this.optionsStyle = 'checkbox';
4424
4402
  this.visible = true;
4425
4403
  this.selectedChange = new EventEmitter();
4426
4404
  this.hasContent = true;
4405
+ this.dropdownVisible = false;
4406
+ this._disabled = false;
4407
+ this._selected = false;
4427
4408
  }
4428
4409
  set disabled(value) {
4429
4410
  this._disabled = coerceBooleanProperty(value);
@@ -4437,9 +4418,6 @@ class MultiSelectOptionComponent {
4437
4418
  this._selected = newValue;
4438
4419
  this.selectedChange.emit(newValue);
4439
4420
  this.multiSelectService.toggleOption(this);
4440
- if (newValue) {
4441
- this.focus();
4442
- }
4443
4421
  }
4444
4422
  }
4445
4423
  get selected() {
@@ -4463,14 +4441,16 @@ class MultiSelectOptionComponent {
4463
4441
  get ariaSelected() {
4464
4442
  return this.selected;
4465
4443
  }
4466
- onKeyUp($event) {
4467
- if ($event.key === 'Enter' || $event.code === 'Space') {
4444
+ onKeyDown($event) {
4445
+ if (['Enter', ' '].includes($event.key)) {
4468
4446
  $event.preventDefault();
4469
4447
  this.selected = this.disabled ? this.selected : !this.selected;
4448
+ this.focus('keyboard');
4470
4449
  }
4471
4450
  }
4472
4451
  onClick() {
4473
4452
  this.selected = this.disabled ? this.selected : !this.selected;
4453
+ this.focus('mouse');
4474
4454
  }
4475
4455
  ngAfterContentInit() {
4476
4456
  setTimeout(() => {
@@ -4484,28 +4464,31 @@ class MultiSelectOptionComponent {
4484
4464
  this.value = this.elementRef.nativeElement.innerText || this.label;
4485
4465
  }
4486
4466
  }
4487
- setActiveStyles() {
4488
- }
4489
- setInactiveStyles() {
4490
- }
4491
4467
  getLabel() {
4492
4468
  var _a;
4493
4469
  return ((_a = this.label) !== null && _a !== void 0 ? _a : this.value);
4494
4470
  }
4495
4471
  focus(origin) {
4496
- this.focusMonitor.focusVia(this.elementRef, 'program');
4472
+ if (this.dropdownVisible) {
4473
+ this.focusMonitor.focusVia(this.elementRef, origin !== null && origin !== void 0 ? origin : 'program', { preventScroll: false });
4474
+ this.changeDetectorRef.markForCheck();
4475
+ }
4476
+ }
4477
+ ngOnDestroy() {
4478
+ this.multiselectVisibleSubscription.unsubscribe();
4479
+ }
4480
+ ngOnInit() {
4481
+ this.multiselectVisibleSubscription = this.multiSelectService.multiSelectVisible$.subscribe(visible => {
4482
+ this.dropdownVisible = visible;
4483
+ });
4497
4484
  }
4498
4485
  }
4499
- MultiSelectOptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptionComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i1$1.FocusMonitor }, { token: MultiSelectService }], target: i0.ɵɵFactoryTarget.Component });
4500
- MultiSelectOptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectOptionComponent, selector: "c-multi-select-option", inputs: { disabled: "disabled", selected: "selected", optionsStyle: "optionsStyle", label: "label", value: "value", visible: "visible" }, outputs: { selectedChange: "selectedChange" }, host: { listeners: { "keydown": "onKeyUp($event)", "click": "onClick($event)" }, properties: { "class": "this.hostClasses", "attr.tabindex": "this.tabIndex", "attr.disabled": "this.ariaDisabled", "attr.aria-disabled": "this.ariaDisabled", "attr.aria-selected": "this.ariaSelected" } }, viewQueries: [{ propertyName: "content", first: true, predicate: ["contentDiv"], descendants: true }], ngImport: i0, template: "<div #contentDiv><ng-content></ng-content></div>\r\n<div *ngIf=\"!hasContent\">\r\n {{label ?? value}}\r\n</div>\r\n\r\n", styles: [":host{display:block;-webkit-user-select:none;user-select:none}:host.form-multi-select-option.disabled,:host.form-multi-select-option:disabled{pointer-events:all;cursor:default}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4486
+ MultiSelectOptionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptionComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.ChangeDetectorRef }, { token: i1$1.FocusMonitor }, { token: MultiSelectService }], target: i0.ɵɵFactoryTarget.Component });
4487
+ MultiSelectOptionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectOptionComponent, selector: "c-multi-select-option", inputs: { optionsStyle: "optionsStyle", label: "label", value: "value", visible: "visible", disabled: "disabled", selected: "selected" }, outputs: { selectedChange: "selectedChange" }, host: { listeners: { "keydown": "onKeyDown($event)", "click": "onClick($event)" }, properties: { "class": "this.hostClasses", "attr.tabindex": "this.tabIndex", "attr.disabled": "this.ariaDisabled", "attr.aria-disabled": "this.ariaDisabled", "attr.aria-selected": "this.ariaSelected" } }, viewQueries: [{ propertyName: "content", first: true, predicate: ["contentDiv"], descendants: true }], ngImport: i0, template: "<div #contentDiv><ng-content></ng-content></div>\r\n<div *ngIf=\"!hasContent\">\r\n {{label ?? value}}\r\n</div>\r\n\r\n", styles: [":host{display:block;-webkit-user-select:none;user-select:none}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4501
4488
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptionComponent, decorators: [{
4502
4489
  type: Component,
4503
- args: [{ selector: 'c-multi-select-option', template: "<div #contentDiv><ng-content></ng-content></div>\r\n<div *ngIf=\"!hasContent\">\r\n {{label ?? value}}\r\n</div>\r\n\r\n", styles: [":host{display:block;-webkit-user-select:none;user-select:none}:host.form-multi-select-option.disabled,:host.form-multi-select-option:disabled{pointer-events:all;cursor:default}\n"] }]
4504
- }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1$1.FocusMonitor }, { type: MultiSelectService }]; }, propDecorators: { disabled: [{
4505
- type: Input
4506
- }], selected: [{
4507
- type: Input
4508
- }], optionsStyle: [{
4490
+ args: [{ selector: 'c-multi-select-option', template: "<div #contentDiv><ng-content></ng-content></div>\r\n<div *ngIf=\"!hasContent\">\r\n {{label ?? value}}\r\n</div>\r\n\r\n", styles: [":host{display:block;-webkit-user-select:none;user-select:none}\n"] }]
4491
+ }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.ChangeDetectorRef }, { type: i1$1.FocusMonitor }, { type: MultiSelectService }]; }, propDecorators: { optionsStyle: [{
4509
4492
  type: Input
4510
4493
  }], label: [{
4511
4494
  type: Input
@@ -4518,6 +4501,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4518
4501
  }], content: [{
4519
4502
  type: ViewChild,
4520
4503
  args: ['contentDiv']
4504
+ }], disabled: [{
4505
+ type: Input
4506
+ }], selected: [{
4507
+ type: Input
4521
4508
  }], hostClasses: [{
4522
4509
  type: HostBinding,
4523
4510
  args: ['class']
@@ -4533,7 +4520,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4533
4520
  }], ariaSelected: [{
4534
4521
  type: HostBinding,
4535
4522
  args: ['attr.aria-selected']
4536
- }], onKeyUp: [{
4523
+ }], onKeyDown: [{
4537
4524
  type: HostListener,
4538
4525
  args: ['keydown', ['$event']]
4539
4526
  }], onClick: [{
@@ -4541,6 +4528,53 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4541
4528
  args: ['click', ['$event']]
4542
4529
  }] } });
4543
4530
 
4531
+ class MultiSelectOptgroupComponent {
4532
+ constructor() {
4533
+ this._disabled = false;
4534
+ }
4535
+ set disabled(value) {
4536
+ this._disabled = coerceBooleanProperty(value);
4537
+ }
4538
+ get disabled() {
4539
+ return this._disabled;
4540
+ }
4541
+ get hostClasses() {
4542
+ return {
4543
+ 'form-multi-select-options': true
4544
+ };
4545
+ }
4546
+ ngAfterContentInit() {
4547
+ this.updateMultiSelectOptions();
4548
+ }
4549
+ ngOnChanges(changes) {
4550
+ if (changes['disabled']) {
4551
+ this.updateMultiSelectOptions();
4552
+ }
4553
+ }
4554
+ updateMultiSelectOptions() {
4555
+ var _a;
4556
+ (_a = this.multiSelectOptions) === null || _a === void 0 ? void 0 : _a.forEach((option) => {
4557
+ option.disabled = this.disabled;
4558
+ });
4559
+ }
4560
+ }
4561
+ MultiSelectOptgroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptgroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4562
+ MultiSelectOptgroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectOptgroupComponent, selector: "c-multi-select-optgroup", inputs: { label: "label", disabled: "disabled" }, host: { properties: { "class": "this.hostClasses" } }, queries: [{ propertyName: "multiSelectOptions", predicate: MultiSelectOptionComponent, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<c-multi-select-optgroup-label *ngIf=\"label\">{{label}}</c-multi-select-optgroup-label>\r\n<ng-content></ng-content>\r\n", styles: [":host{display:block}\n"], components: [{ type: MultiSelectOptgroupLabelComponent, selector: "c-multi-select-optgroup-label" }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
4563
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptgroupComponent, decorators: [{
4564
+ type: Component,
4565
+ args: [{ selector: 'c-multi-select-optgroup', template: "<c-multi-select-optgroup-label *ngIf=\"label\">{{label}}</c-multi-select-optgroup-label>\r\n<ng-content></ng-content>\r\n", styles: [":host{display:block}\n"] }]
4566
+ }], propDecorators: { label: [{
4567
+ type: Input
4568
+ }], disabled: [{
4569
+ type: Input
4570
+ }], multiSelectOptions: [{
4571
+ type: ContentChildren,
4572
+ args: [MultiSelectOptionComponent, { descendants: true }]
4573
+ }], hostClasses: [{
4574
+ type: HostBinding,
4575
+ args: ['class']
4576
+ }] } });
4577
+
4544
4578
  class MultiSelectTagComponent {
4545
4579
  constructor(multiSelectService) {
4546
4580
  this.multiSelectService = multiSelectService;
@@ -4600,10 +4634,10 @@ class MultiSelectNativeSelectComponent {
4600
4634
  }
4601
4635
  }
4602
4636
  MultiSelectNativeSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectNativeSelectComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
4603
- MultiSelectNativeSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectNativeSelectComponent, selector: "c-multi-select-native-select", inputs: { form: "form", id: "id", multiple: "multiple", name: "name", options: "options", disabled: "disabled" }, ngImport: i0, template: "<select [multiple]=\"multiple\" [name]=\"name\" style=\"display: none\" tabindex=\"-1\" [id]=\"id\" [disabled]=\"disabled\">\r\n <option\r\n *ngFor=\"let option of options\"\r\n [label]=\"option.label\"\r\n [selected]=\"option.selected\"\r\n [value]=\"option.value\"\r\n [disabled]=\"disabled\"\r\n tabindex=\"-1\"\r\n ></option>\r\n</select>\r\n\r\n", styles: [":host{display:none}\n"], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i5.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4637
+ MultiSelectNativeSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectNativeSelectComponent, selector: "c-multi-select-native-select", inputs: { form: "form", id: "id", multiple: "multiple", name: "name", options: "options", disabled: "disabled" }, ngImport: i0, template: "<select [multiple]=\"multiple\" [name]=\"name\" style=\"display: none\" tabindex=\"-1\" [id]=\"id\" [disabled]=\"disabled\">\n <option\n *ngFor=\"let option of options\"\n [label]=\"option.label\"\n [attr.selected]=\"option.selected ? '' : null\"\n [value]=\"option.value\"\n [disabled]=\"disabled\"\n tabindex=\"-1\"\n ></option>\n</select>\n\n", styles: [":host{display:none}\n"], directives: [{ type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { type: i5.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
4604
4638
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectNativeSelectComponent, decorators: [{
4605
4639
  type: Component,
4606
- args: [{ selector: 'c-multi-select-native-select', changeDetection: ChangeDetectionStrategy.OnPush, template: "<select [multiple]=\"multiple\" [name]=\"name\" style=\"display: none\" tabindex=\"-1\" [id]=\"id\" [disabled]=\"disabled\">\r\n <option\r\n *ngFor=\"let option of options\"\r\n [label]=\"option.label\"\r\n [selected]=\"option.selected\"\r\n [value]=\"option.value\"\r\n [disabled]=\"disabled\"\r\n tabindex=\"-1\"\r\n ></option>\r\n</select>\r\n\r\n", styles: [":host{display:none}\n"] }]
4640
+ args: [{ selector: 'c-multi-select-native-select', changeDetection: ChangeDetectionStrategy.OnPush, template: "<select [multiple]=\"multiple\" [name]=\"name\" style=\"display: none\" tabindex=\"-1\" [id]=\"id\" [disabled]=\"disabled\">\n <option\n *ngFor=\"let option of options\"\n [label]=\"option.label\"\n [attr.selected]=\"option.selected ? '' : null\"\n [value]=\"option.value\"\n [disabled]=\"disabled\"\n tabindex=\"-1\"\n ></option>\n</select>\n\n", styles: [":host{display:none}\n"] }]
4607
4641
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { form: [{
4608
4642
  type: Input
4609
4643
  }], id: [{
@@ -4618,20 +4652,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4618
4652
  type: Input
4619
4653
  }] } });
4620
4654
 
4621
- // const flattenArray = (options: IOption[]): IOption[] => {
4622
- // return options.reduce((acc: IOption[], val: IOption) => {
4623
- // return acc.concat(Array.isArray(val.options) ? flattenArray(val.options) : val);
4624
- // }, []);
4625
- // };
4626
- //
4627
- // const getSelectedOptions = (options: IOption[]) => {
4628
- // return flattenArray(options).filter((option: IOption) => {
4629
- // if (option.selected) {
4630
- // return option;
4631
- // }
4632
- // return;
4633
- // });
4634
- // };
4635
4655
  class MultiSelectComponent {
4636
4656
  constructor(elementRef, renderer, ngZone, changeDetectorRef, viewContainerRef, focusMonitor, multiSelectService
4637
4657
  // private listenersService: ListenersService
@@ -4659,6 +4679,7 @@ class MultiSelectComponent {
4659
4679
  this.selectAllLabel = 'Select all options';
4660
4680
  this.selectionType = 'tags';
4661
4681
  this.selectionTypeCounterText = 'item(s) selected';
4682
+ this.selectionTypeCounterTextPluralMap = { '=1': 'item selected', 'other': 'items selected' };
4662
4683
  this._value = [''];
4663
4684
  this.valueChange = new EventEmitter();
4664
4685
  this._visible = false;
@@ -4667,14 +4688,12 @@ class MultiSelectComponent {
4667
4688
  this._selectedOptions = [];
4668
4689
  this._tabIndex = '-1';
4669
4690
  this.visibleOptions = 0;
4670
- this._inputValue = '';
4691
+ this._searchValue = '';
4671
4692
  this._subtreeFocused = this.focusOrigin(null);
4672
4693
  }
4673
4694
  writeValue(value) {
4674
- // console.log('writeValue', value)
4675
4695
  if (value !== null) {
4676
4696
  this.value = value;
4677
- // this.onChange(this.value);
4678
4697
  }
4679
4698
  }
4680
4699
  registerOnChange(fn) {
@@ -4700,7 +4719,6 @@ class MultiSelectComponent {
4700
4719
  set value(value) {
4701
4720
  const newValue = Array.isArray(value) ? [...value] : [value !== null && value !== void 0 ? value : ''];
4702
4721
  if (this._value.toString() !== newValue.toString()) {
4703
- // console.log('set value', value)
4704
4722
  this._value = newValue;
4705
4723
  this.onChange(newValue);
4706
4724
  this.updateNativeSelect();
@@ -4716,11 +4734,19 @@ class MultiSelectComponent {
4716
4734
  if (newValue !== this._visible) {
4717
4735
  this._visible = newValue;
4718
4736
  this.multiSelectService.toggleVisible(newValue);
4737
+ if (newValue) {
4738
+ this.listKeyManager.setFirstItemActive();
4739
+ }
4719
4740
  }
4720
4741
  }
4721
4742
  get visible() {
4722
4743
  return this._visible;
4723
4744
  }
4745
+ set selectedOptions(value) {
4746
+ this._selectedOptions = value;
4747
+ this.value = this.selectedOptions.map(item => item.value);
4748
+ this.inputElementSize();
4749
+ }
4724
4750
  get selectedOptions() {
4725
4751
  return this._selectedOptions;
4726
4752
  }
@@ -4730,6 +4756,11 @@ class MultiSelectComponent {
4730
4756
  get counterText() {
4731
4757
  return `${this.selectedOptions.length} ${this.selectionTypeCounterText}`;
4732
4758
  }
4759
+ get counterTextType() {
4760
+ var _a;
4761
+ return (_a = typeof this.selectionTypeCounterTextPluralMap) !== null && _a !== void 0 ? _a : typeof this.selectionTypeCounterText;
4762
+ }
4763
+ ;
4733
4764
  get hostClasses() {
4734
4765
  return {
4735
4766
  'form-multi-select': true,
@@ -4743,52 +4774,54 @@ class MultiSelectComponent {
4743
4774
  }
4744
4775
  set tabIndex(value) {
4745
4776
  setTimeout(() => {
4746
- this._tabIndex = this._disabled || this.search ? '-1' : value === null ? null : '0';
4777
+ this._tabIndex = this.disabled || this.search ? '-1' : value === null ? null : '0';
4747
4778
  });
4748
4779
  }
4749
4780
  onKeyUp($event) {
4750
- // console.log('keyup', $event.key);
4751
- if (!this.disabled) {
4752
- if ($event.key === 'Escape') {
4753
- this.visible = false;
4754
- this.inputValue = '';
4781
+ var _a, _b;
4782
+ if (this.disabled)
4783
+ return;
4784
+ if ($event.key === 'Escape') {
4785
+ this.visible = false;
4786
+ this.searchValue = '';
4787
+ this.setFocus();
4788
+ return;
4789
+ }
4790
+ if (['Enter', ' ', 'ArrowDown'].includes($event.key) && [(_b = (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.nativeElement) !== null && _b !== void 0 ? _b : this.elementRef.nativeElement].includes($event.target)) {
4791
+ this.visible = true;
4792
+ if (!this.search) {
4755
4793
  this.setFocus();
4756
- // this.focusMonitor.focusVia(this.inputElement ?? this.elementRef, 'keyboard');
4757
- }
4758
- else if ($event.key === 'Enter') {
4759
- // } else {
4760
- this.visible = true;
4761
- if (!this.search) {
4762
- this.setFocus();
4763
- }
4764
4794
  }
4795
+ return;
4765
4796
  }
4766
- }
4767
- manage($event) {
4768
- // console.log('keydown', $event.key);
4769
- if (!this.disabled) {
4770
- if ($event.key === 'Enter' && $event.target === this.inputElement.nativeElement) {
4771
- $event.preventDefault();
4797
+ if ($event.key === 'Tab' && $event.target === this.elementRef.nativeElement) {
4798
+ this.visible = true;
4799
+ if (!this.search) {
4800
+ this.setFocus();
4772
4801
  }
4773
- this.listKeyManager.onKeydown($event);
4802
+ return;
4774
4803
  }
4775
4804
  }
4805
+ onKeyDown($event) {
4806
+ if (this.disabled)
4807
+ return;
4808
+ this.listKeyManager.onKeydown($event);
4809
+ }
4776
4810
  onClick($event) {
4777
- if (!this.disabled) {
4778
- if (!this.visible) {
4779
- this.visible = !this.visible;
4780
- }
4781
- this.setFocus();
4811
+ if (this.disabled)
4812
+ return;
4813
+ if (!this.visible) {
4814
+ this.visible = true;
4782
4815
  }
4783
4816
  }
4784
- set inputValue(value) {
4785
- // console.log('inputValue', value);
4786
- this._inputValue = value;
4787
- // this.visible = !!value ?? this.visible;
4788
- this.filterOptions(value);
4817
+ set searchValue(value) {
4818
+ this._searchValue = value.trim();
4819
+ this.visible = !!this.searchValue.length || this.visible;
4820
+ this.filterOptions(this.searchValue);
4821
+ this.inputElementSize();
4789
4822
  }
4790
- get inputValue() {
4791
- return this._inputValue;
4823
+ get searchValue() {
4824
+ return this._searchValue;
4792
4825
  }
4793
4826
  get subtreeFocused() {
4794
4827
  return this._subtreeFocused;
@@ -4799,7 +4832,7 @@ class MultiSelectComponent {
4799
4832
  }
4800
4833
  focusOrigin(origin) {
4801
4834
  const focused = !!origin;
4802
- this.inputValue = focused ? this.inputValue : '';
4835
+ this.searchValue = focused ? this.searchValue : '';
4803
4836
  return focused;
4804
4837
  }
4805
4838
  ngOnInit() {
@@ -4818,13 +4851,11 @@ class MultiSelectComponent {
4818
4851
  option.optionsStyle = this.optionsStyle;
4819
4852
  option.selected = option.value !== undefined ? this.value.includes(option.value) || option.selected : option.selected;
4820
4853
  });
4821
- this._selectedOptions = this.multiSelectOptions.filter((option) => !!option.selected);
4822
- setTimeout(() => {
4823
- this.value = this._selectedOptions.map(item => item.value);
4824
- });
4825
- // this.value = this._selectedOptions.map(item => item.value);
4826
- this.listKeyManager = new FocusKeyManager(this.multiSelectOptions).withHomeAndEnd();
4827
- this.listKeyManager.skipPredicate(item => !item.visible);
4854
+ this.selectedOptionsUpdate();
4855
+ this.inputElementSize();
4856
+ this.listKeyManager = new FocusKeyManager(this.multiSelectOptions).withHomeAndEnd().withTypeAhead();
4857
+ this.listKeyManager.skipPredicate(item => (!item.visible || item.disabled));
4858
+ this.listKeyManager.setFirstItemActive();
4828
4859
  this.multiselectSubscribe();
4829
4860
  this.createNativeSelect();
4830
4861
  }
@@ -4836,11 +4867,8 @@ class MultiSelectComponent {
4836
4867
  this.changeDetectorRef.markForCheck();
4837
4868
  }
4838
4869
  }));
4870
+ this.inputElementSize();
4839
4871
  }
4840
- // handleInputClick($event: MouseEvent) {
4841
- // console.log('handleInputClick', $event);
4842
- // // this.visible = !this.visible;
4843
- // }
4844
4872
  multiselectSubscribe(subscribe = true) {
4845
4873
  var _a, _b, _c;
4846
4874
  if (subscribe) {
@@ -4850,17 +4878,14 @@ class MultiSelectComponent {
4850
4878
  });
4851
4879
  this.multiselectStateSubscription = this.multiSelectService.multiSelectState$.subscribe((option) => {
4852
4880
  if (option.selected === true && !this.multiple) {
4853
- const selectedOptions = this.multiSelectOptions
4854
- .toArray()
4855
- .filter((item) => item.selected);
4881
+ const selectedOptions = this.multiSelectOptions.toArray().filter((item) => item.selected);
4856
4882
  selectedOptions.reverse().forEach((item) => {
4857
4883
  if (item !== option) {
4858
4884
  item.selected = false;
4859
4885
  }
4860
4886
  });
4861
4887
  }
4862
- this._selectedOptions = this.multiSelectOptions.filter((option) => !!option.selected);
4863
- this.value = this._selectedOptions.map(item => item.value);
4888
+ this.selectedOptionsUpdate();
4864
4889
  });
4865
4890
  }
4866
4891
  else {
@@ -4870,7 +4895,7 @@ class MultiSelectComponent {
4870
4895
  }
4871
4896
  }
4872
4897
  clearAllOptions($event) {
4873
- this._selectedOptions.forEach((option) => {
4898
+ this.selectedOptions.forEach((option) => {
4874
4899
  if (!option._disabled)
4875
4900
  option.selected = false;
4876
4901
  });
@@ -4912,26 +4937,31 @@ class MultiSelectComponent {
4912
4937
  // };
4913
4938
  // this.listenersService.setListeners(configForHost);
4914
4939
  // }
4915
- clearListeners() {
4916
- // this.listenersService.clearListeners();
4917
- }
4940
+ // private clearListeners() {
4941
+ // this.listenersService.clearListeners();
4942
+ // }
4918
4943
  handleTagRemove($event) {
4919
4944
  this.setFocus();
4920
4945
  }
4921
4946
  setFocus() {
4922
- var _a, _b;
4923
- const firstSelectedOption = (_a = this.selectedOptions.find((item) => item.selected)) !== null && _a !== void 0 ? _a : this.multiSelectOptions.find((item, index) => index === 0);
4924
- if (firstSelectedOption && this.isDropdownVisible) {
4925
- this.listKeyManager.setActiveItem(firstSelectedOption);
4926
- this.changeDetectorRef.markForCheck();
4927
- if (!this.search) {
4928
- return;
4929
- }
4930
- }
4931
- if (!this.disabled) {
4932
- this.focusMonitor.focusVia((_b = this.inputElement) !== null && _b !== void 0 ? _b : this.elementRef, 'program');
4933
- }
4934
- }
4947
+ var _a;
4948
+ if (this.disabled)
4949
+ return;
4950
+ this.focusMonitor.focusVia((_a = this.inputElement) !== null && _a !== void 0 ? _a : this.elementRef, 'program');
4951
+ }
4952
+ // setFirstSelectedOptionActive() {
4953
+ // const firstSelectedOption = this.selectedOptions.find((item) => item.selected) ??
4954
+ // this.multiSelectOptions.find((item, index) => index === 0);
4955
+ // if (firstSelectedOption && this.isDropdownVisible) {
4956
+ // // this.listKeyManager.setFocusOrigin('keyboard');
4957
+ // this.listKeyManager.setActiveItem(firstSelectedOption);
4958
+ // this.changeDetectorRef.markForCheck();
4959
+ // } else {
4960
+ // // this.listKeyManager.setFocusOrigin('keyboard');
4961
+ // this.listKeyManager.setFirstItemActive();
4962
+ // this.changeDetectorRef.markForCheck();
4963
+ // }
4964
+ // }
4935
4965
  filterOptions(value) {
4936
4966
  var _a, _b, _c;
4937
4967
  const searchString = (_a = value.toLowerCase()) !== null && _a !== void 0 ? _a : '';
@@ -4948,8 +4978,7 @@ class MultiSelectComponent {
4948
4978
  }
4949
4979
  createNativeSelect() {
4950
4980
  this.viewContainerRef.clear();
4951
- const nativeSelectRef = this.viewContainerRef.createComponent(MultiSelectNativeSelectComponent);
4952
- this.nativeSelectRef = nativeSelectRef;
4981
+ this.nativeSelectRef = this.viewContainerRef.createComponent(MultiSelectNativeSelectComponent);
4953
4982
  this.updateNativeSelect();
4954
4983
  }
4955
4984
  updateNativeSelect() {
@@ -4959,17 +4988,46 @@ class MultiSelectComponent {
4959
4988
  const { selected, value, label } = item;
4960
4989
  return { selected, value, label };
4961
4990
  });
4962
- // const nativeSelectRef = this.nativeSelectRef;
4963
4991
  this.nativeSelectRef.instance.multiple = this.multiple;
4964
4992
  this.nativeSelectRef.instance.name = this.nativeName;
4965
4993
  this.nativeSelectRef.instance.form = this.nativeId;
4966
- this.nativeSelectRef.instance.options = options;
4994
+ this.nativeSelectRef.instance.options = [...options];
4967
4995
  this.nativeSelectRef.instance.disabled = this.disabled;
4968
4996
  this.nativeSelectRef.instance.changeDetectorRef.detectChanges();
4969
4997
  }
4998
+ inputElementSize() {
4999
+ if (this.inputElement) {
5000
+ if (this.selectedOptions.length > 0 || this.selectionType === 'counter') {
5001
+ this.renderer.setAttribute(this.inputElement.nativeElement, 'size', (this.searchValue.length + 2).toString());
5002
+ }
5003
+ else {
5004
+ this.renderer.removeAttribute(this.inputElement.nativeElement, 'size');
5005
+ }
5006
+ }
5007
+ }
5008
+ handleSearchKeyDown($event) {
5009
+ if (this.searchValue.length || this.selectedOptions.length === 0)
5010
+ return;
5011
+ if (['Backspace', 'Delete'].includes($event.key)) {
5012
+ $event.stopPropagation();
5013
+ const last = this.selectedOptions.filter(option => !option.disabled).pop();
5014
+ this.selectOption(last, false);
5015
+ }
5016
+ }
5017
+ selectOption(option, selected) {
5018
+ this.multiSelectOptions.forEach(item => {
5019
+ if (item === option) {
5020
+ option.selected = selected;
5021
+ }
5022
+ });
5023
+ this.selectedOptionsUpdate();
5024
+ }
5025
+ selectedOptionsUpdate() {
5026
+ this.selectedOptions = this.multiSelectOptions.filter((option) => !!option.selected);
5027
+ }
4970
5028
  }
4971
5029
  MultiSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i0.ViewContainerRef }, { token: i1$1.FocusMonitor }, { token: MultiSelectService }], target: i0.ɵɵFactoryTarget.Component });
4972
- MultiSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectComponent, selector: "c-multi-select", inputs: { cleaner: "cleaner", disabled: "disabled", multiple: "multiple", nativeName: "nativeName", nativeId: "nativeId", optionsMaxHeight: "optionsMaxHeight", optionsStyle: "optionsStyle", placeholder: "placeholder", search: "search", searchNoResultsLabel: "searchNoResultsLabel", selectAll: "selectAll", selectAllLabel: "selectAllLabel", selectionType: "selectionType", selectionTypeCounterText: "selectionTypeCounterText", value: "value", visible: "visible" }, outputs: { valueChange: "valueChange", visibleChange: "visibleChange" }, host: { listeners: { "keyup": "onKeyUp($event)", "keydown": "manage($event)", "click": "onClick($event)" }, properties: { "class": "this.hostClasses", "attr.tabindex": "this.tabIndex" } }, providers: [
5030
+ MultiSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectComponent, selector: "c-multi-select", inputs: { cleaner: "cleaner", disabled: "disabled", multiple: "multiple", nativeName: "nativeName", nativeId: "nativeId", optionsMaxHeight: "optionsMaxHeight", optionsStyle: "optionsStyle", placeholder: "placeholder", search: "search", searchNoResultsLabel: "searchNoResultsLabel", selectAll: "selectAll", selectAllLabel: "selectAllLabel", selectionType: "selectionType", selectionTypeCounterText: "selectionTypeCounterText", selectionTypeCounterTextPluralMap: "selectionTypeCounterTextPluralMap", value: "value", visible: "visible" }, outputs: { valueChange: "valueChange", visibleChange: "visibleChange" }, host: { listeners: { "keyup": "onKeyUp($event)", "keydown": "onKeyDown($event)", "click": "onClick($event)" }, properties: { "class": "this.hostClasses", "attr.tabindex": "this.tabIndex" } }, providers: [
4973
5031
  MultiSelectService,
4974
5032
  // ListenersService,
4975
5033
  {
@@ -4977,7 +5035,7 @@ MultiSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
4977
5035
  useExisting: forwardRef(() => MultiSelectComponent),
4978
5036
  multi: true
4979
5037
  }
4980
- ], queries: [{ propertyName: "multiSelectOptions", predicate: MultiSelectOptionComponent, descendants: true }], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }, { propertyName: "dropdownElement", first: true, predicate: ["dropdownElement"], descendants: true }], exportAs: ["cMultiSelect"], ngImport: i0, template: "<div class=\"form-multi-select-selection\">\r\n <ng-template [ngIf]=\"selectionType==='tags'\">\r\n <c-multi-select-tag (remove)=\"handleTagRemove($event)\" *ngFor=\"let option of selectedOptions; index as i\"\r\n [option]=\"option\" tabindex=\"-1\"></c-multi-select-tag>\r\n </ng-template>\r\n <ng-template [ngIf]=\"selectionType==='text'\">\r\n <span class=\"bg-light\">{{selectedOptionsText}}</span>\r\n </ng-template>\r\n <ng-template [ngIf]=\"selectionType==='counter'\">\r\n <span>{{counterText}}</span>\r\n </ng-template>\r\n</div>\r\n\r\n<input #inputElement\r\n [(ngModel)]=\"inputValue\"\r\n [disabled]=\"disabled || !search\"\r\n [placeholder]=\"(selectedOptions.length === 0 && selectionType!=='counter') ? placeholder : ''\"\r\n autocomplete=\"off\"\r\n [ngClass]=\"{'form-multi-select-search ms-1': true, disabled: disabled}\" tabindex=\"{{disabled ? '-1' : '0'}}\"\r\n type=\"text\">\r\n\r\n<button (click)=\"clearAllOptions($event)\"\r\n *ngIf=\"cleaner && selectedOptions.length > 0\"\r\n [disabled]=\"disabled || !isDropdownVisible\"\r\n aria-label=\"Clear all\"\r\n cButtonClose\r\n class=\"form-multi-select-selection-cleaner\"\r\n size=\"sm\">\r\n</button>\r\n\r\n<div #dropdownElement class=\"form-multi-select-dropdown\">\r\n <ng-template [ngIf]=\"visibleOptions>0\" [ngIfElse]=\"optionsEmpty\">\r\n <button (click)=\"selectAllOptions()\"\r\n *ngIf=\"selectAll && multiple\"\r\n class=\"form-multi-select-all\">\r\n {{selectAllLabel}}\r\n </button>\r\n <div #multiselectOptionsDiv\r\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'maxHeight.px': optionsMaxHeight, 'overflow': 'scroll'} : {}\"\r\n class=\"form-multi-select-options\">\r\n <ng-content></ng-content>\r\n </div>\r\n </ng-template>\r\n <ng-template #optionsEmpty>\r\n <div class=\"form-multi-select-options-empty\">{{searchNoResultsLabel}}</div>\r\n </ng-template>\r\n</div>\r\n\r\n", styles: [":host{display:block}:host.cdk-focused:not(.disabled){color:var(--cui-form-multi-select-focus-color, rgba(44, 56, 74, .95));background-color:var(--cui-form-multi-select-focus-bg, #fff);border-color:var(--cui-form-multi-select-focus-border-color, #6557e4);box-shadow:0 0 0 .25rem #321fdb40}:host .form-multi-select-search:disabled,:host .form-multi-select-search.disabled{background-color:var(--cui-input-disabled-bg, #d8dbe0);border-color:var(--cui-input-disabled-border-color, #b1b7c1);opacity:1}\n"], components: [{ type: MultiSelectTagComponent, selector: "c-multi-select-tag", inputs: ["option"], outputs: ["remove"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: ButtonCloseDirective, selector: "[cButtonClose]", inputs: ["white"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
5038
+ ], queries: [{ propertyName: "multiSelectOptions", predicate: MultiSelectOptionComponent, descendants: true }], viewQueries: [{ propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }, { propertyName: "dropdownElement", first: true, predicate: ["dropdownElement"], descendants: true }], exportAs: ["cMultiSelect"], ngImport: i0, template: "<div class=\"form-multi-select-selection\">\n <ng-template [ngIf]=\"selectionType === 'tags'\">\n <c-multi-select-tag *ngFor=\"let option of selectedOptions; index as i\"\n (remove)=\"handleTagRemove($event)\"\n [option]=\"option\"\n tabindex=\"-1\">\n </c-multi-select-tag>\n </ng-template>\n <ng-template [ngIf]=\"selectionType === 'text' && !!selectedOptionsText\">\n <span>{{ selectedOptionsText }}</span>\n </ng-template>\n <ng-template [ngIf]=\"selectionType === 'counter'\">\n <span *ngIf=\"counterTextType === 'string'; else pluralMap\">{{ counterText }}</span>\n <ng-template #pluralMap>\n <span>{{selectedOptions.length}} {{ selectedOptions.length | i18nPlural: selectionTypeCounterTextPluralMap ?? { other: counterText } }}</span>\n </ng-template>\n </ng-template>\n <ng-template [ngIf]=\"!search && selectedOptions.length === 0 && selectionType !== 'counter'\">\n <span>{{ placeholder }}</span>\n </ng-template>\n</div>\n\n<input\n #inputElement\n (keydown)=\"handleSearchKeyDown($event)\"\n *ngIf=\"search && !disabled\"\n [(ngModel)]=\"searchValue\"\n [disabled]=\"disabled || !search\"\n [ngClass]=\"{ 'form-multi-select-search': true, disabled: disabled }\"\n [placeholder]=\"selectedOptions.length === 0 && selectionType !== 'counter' ? placeholder : ''\"\n autocomplete=\"off\"\n tabindex=\"{{ disabled ? '-1' : '0' }}\"\n type=\"text\"\n>\n\n<button\n (click)=\"clearAllOptions($event)\"\n *ngIf=\"cleaner && selectedOptions.length > 0 && !disabled\"\n [disabled]=\"disabled || !isDropdownVisible\"\n aria-label=\"Clear all\"\n cButtonClose\n class=\"form-multi-select-selection-cleaner\"\n size=\"sm\"\n></button>\n\n<div #dropdownElement *ngIf=\"!disabled\" class=\"form-multi-select-dropdown\">\n <ng-template [ngIfElse]=\"optionsEmpty\" [ngIf]=\"visibleOptions > 0\">\n <button (click)=\"selectAllOptions()\" *ngIf=\"selectAll && multiple\" class=\"form-multi-select-all\">\n {{ selectAllLabel }}\n </button>\n <div #multiselectOptionsDiv\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'maxHeight.px': optionsMaxHeight, overflow: 'scroll' } : {}\"\n class=\"form-multi-select-options\"\n >\n <ng-content></ng-content>\n </div>\n </ng-template>\n <ng-template #optionsEmpty>\n <div class=\"form-multi-select-options-empty\">{{ searchNoResultsLabel }}</div>\n </ng-template>\n</div>\n", styles: [":host{display:block}:host.cdk-focused:not(.disabled){color:var(--cui-form-multi-select-focus-color, rgba(44, 56, 74, .95));background-color:var(--cui-form-multi-select-focus-bg, #fff);border-color:var(--cui-form-multi-select-focus-border-color, #6557e4);box-shadow:0 0 0 .25rem #321fdb40}:host .form-multi-select-search:disabled,:host .form-multi-select-search.disabled{background-color:var(--cui-input-disabled-bg, #d8dbe0);border-color:var(--cui-input-disabled-border-color, #b1b7c1);opacity:1}:host .form-multi-select-search[size]{display:inline}\n"], components: [{ type: MultiSelectTagComponent, selector: "c-multi-select-tag", inputs: ["option"], outputs: ["remove"] }], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { type: i5.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i5.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i5.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { type: ButtonCloseDirective, selector: "[cButtonClose]", inputs: ["white"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }], pipes: { "i18nPlural": i2.I18nPluralPipe } });
4981
5039
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectComponent, decorators: [{
4982
5040
  type: Component,
4983
5041
  args: [{ selector: 'c-multi-select', exportAs: 'cMultiSelect', providers: [
@@ -4988,7 +5046,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4988
5046
  useExisting: forwardRef(() => MultiSelectComponent),
4989
5047
  multi: true
4990
5048
  }
4991
- ], template: "<div class=\"form-multi-select-selection\">\r\n <ng-template [ngIf]=\"selectionType==='tags'\">\r\n <c-multi-select-tag (remove)=\"handleTagRemove($event)\" *ngFor=\"let option of selectedOptions; index as i\"\r\n [option]=\"option\" tabindex=\"-1\"></c-multi-select-tag>\r\n </ng-template>\r\n <ng-template [ngIf]=\"selectionType==='text'\">\r\n <span class=\"bg-light\">{{selectedOptionsText}}</span>\r\n </ng-template>\r\n <ng-template [ngIf]=\"selectionType==='counter'\">\r\n <span>{{counterText}}</span>\r\n </ng-template>\r\n</div>\r\n\r\n<input #inputElement\r\n [(ngModel)]=\"inputValue\"\r\n [disabled]=\"disabled || !search\"\r\n [placeholder]=\"(selectedOptions.length === 0 && selectionType!=='counter') ? placeholder : ''\"\r\n autocomplete=\"off\"\r\n [ngClass]=\"{'form-multi-select-search ms-1': true, disabled: disabled}\" tabindex=\"{{disabled ? '-1' : '0'}}\"\r\n type=\"text\">\r\n\r\n<button (click)=\"clearAllOptions($event)\"\r\n *ngIf=\"cleaner && selectedOptions.length > 0\"\r\n [disabled]=\"disabled || !isDropdownVisible\"\r\n aria-label=\"Clear all\"\r\n cButtonClose\r\n class=\"form-multi-select-selection-cleaner\"\r\n size=\"sm\">\r\n</button>\r\n\r\n<div #dropdownElement class=\"form-multi-select-dropdown\">\r\n <ng-template [ngIf]=\"visibleOptions>0\" [ngIfElse]=\"optionsEmpty\">\r\n <button (click)=\"selectAllOptions()\"\r\n *ngIf=\"selectAll && multiple\"\r\n class=\"form-multi-select-all\">\r\n {{selectAllLabel}}\r\n </button>\r\n <div #multiselectOptionsDiv\r\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'maxHeight.px': optionsMaxHeight, 'overflow': 'scroll'} : {}\"\r\n class=\"form-multi-select-options\">\r\n <ng-content></ng-content>\r\n </div>\r\n </ng-template>\r\n <ng-template #optionsEmpty>\r\n <div class=\"form-multi-select-options-empty\">{{searchNoResultsLabel}}</div>\r\n </ng-template>\r\n</div>\r\n\r\n", styles: [":host{display:block}:host.cdk-focused:not(.disabled){color:var(--cui-form-multi-select-focus-color, rgba(44, 56, 74, .95));background-color:var(--cui-form-multi-select-focus-bg, #fff);border-color:var(--cui-form-multi-select-focus-border-color, #6557e4);box-shadow:0 0 0 .25rem #321fdb40}:host .form-multi-select-search:disabled,:host .form-multi-select-search.disabled{background-color:var(--cui-input-disabled-bg, #d8dbe0);border-color:var(--cui-input-disabled-border-color, #b1b7c1);opacity:1}\n"] }]
5049
+ ], template: "<div class=\"form-multi-select-selection\">\n <ng-template [ngIf]=\"selectionType === 'tags'\">\n <c-multi-select-tag *ngFor=\"let option of selectedOptions; index as i\"\n (remove)=\"handleTagRemove($event)\"\n [option]=\"option\"\n tabindex=\"-1\">\n </c-multi-select-tag>\n </ng-template>\n <ng-template [ngIf]=\"selectionType === 'text' && !!selectedOptionsText\">\n <span>{{ selectedOptionsText }}</span>\n </ng-template>\n <ng-template [ngIf]=\"selectionType === 'counter'\">\n <span *ngIf=\"counterTextType === 'string'; else pluralMap\">{{ counterText }}</span>\n <ng-template #pluralMap>\n <span>{{selectedOptions.length}} {{ selectedOptions.length | i18nPlural: selectionTypeCounterTextPluralMap ?? { other: counterText } }}</span>\n </ng-template>\n </ng-template>\n <ng-template [ngIf]=\"!search && selectedOptions.length === 0 && selectionType !== 'counter'\">\n <span>{{ placeholder }}</span>\n </ng-template>\n</div>\n\n<input\n #inputElement\n (keydown)=\"handleSearchKeyDown($event)\"\n *ngIf=\"search && !disabled\"\n [(ngModel)]=\"searchValue\"\n [disabled]=\"disabled || !search\"\n [ngClass]=\"{ 'form-multi-select-search': true, disabled: disabled }\"\n [placeholder]=\"selectedOptions.length === 0 && selectionType !== 'counter' ? placeholder : ''\"\n autocomplete=\"off\"\n tabindex=\"{{ disabled ? '-1' : '0' }}\"\n type=\"text\"\n>\n\n<button\n (click)=\"clearAllOptions($event)\"\n *ngIf=\"cleaner && selectedOptions.length > 0 && !disabled\"\n [disabled]=\"disabled || !isDropdownVisible\"\n aria-label=\"Clear all\"\n cButtonClose\n class=\"form-multi-select-selection-cleaner\"\n size=\"sm\"\n></button>\n\n<div #dropdownElement *ngIf=\"!disabled\" class=\"form-multi-select-dropdown\">\n <ng-template [ngIfElse]=\"optionsEmpty\" [ngIf]=\"visibleOptions > 0\">\n <button (click)=\"selectAllOptions()\" *ngIf=\"selectAll && multiple\" class=\"form-multi-select-all\">\n {{ selectAllLabel }}\n </button>\n <div #multiselectOptionsDiv\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'maxHeight.px': optionsMaxHeight, overflow: 'scroll' } : {}\"\n class=\"form-multi-select-options\"\n >\n <ng-content></ng-content>\n </div>\n </ng-template>\n <ng-template #optionsEmpty>\n <div class=\"form-multi-select-options-empty\">{{ searchNoResultsLabel }}</div>\n </ng-template>\n</div>\n", styles: [":host{display:block}:host.cdk-focused:not(.disabled){color:var(--cui-form-multi-select-focus-color, rgba(44, 56, 74, .95));background-color:var(--cui-form-multi-select-focus-bg, #fff);border-color:var(--cui-form-multi-select-focus-border-color, #6557e4);box-shadow:0 0 0 .25rem #321fdb40}:host .form-multi-select-search:disabled,:host .form-multi-select-search.disabled{background-color:var(--cui-input-disabled-bg, #d8dbe0);border-color:var(--cui-input-disabled-border-color, #b1b7c1);opacity:1}:host .form-multi-select-search[size]{display:inline}\n"] }]
4992
5050
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i0.ViewContainerRef }, { type: i1$1.FocusMonitor }, { type: MultiSelectService }]; }, propDecorators: { cleaner: [{
4993
5051
  type: Input
4994
5052
  }], disabled: [{
@@ -5017,6 +5075,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
5017
5075
  type: Input
5018
5076
  }], selectionTypeCounterText: [{
5019
5077
  type: Input
5078
+ }], selectionTypeCounterTextPluralMap: [{
5079
+ type: Input
5020
5080
  }], value: [{
5021
5081
  type: Input
5022
5082
  }], valueChange: [{
@@ -5043,7 +5103,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
5043
5103
  }], onKeyUp: [{
5044
5104
  type: HostListener,
5045
5105
  args: ['keyup', ['$event']]
5046
- }], manage: [{
5106
+ }], onKeyDown: [{
5047
5107
  type: HostListener,
5048
5108
  args: ['keydown', ['$event']]
5049
5109
  }], onClick: [{