@coreui/angular-pro 4.0.0-alpha.4 → 4.0.0-alpha.5

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.
@@ -4340,10 +4340,10 @@ class MultiSelectOptgroupLabelComponent {
4340
4340
  }
4341
4341
  }
4342
4342
  MultiSelectOptgroupLabelComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptgroupLabelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4343
- MultiSelectOptgroupLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectOptgroupLabelComponent, selector: "c-multi-select-optgroup-label", host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<ng-content></ng-content>\n", styles: [":host{display:block}\n"] });
4343
+ MultiSelectOptgroupLabelComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectOptgroupLabelComponent, selector: "c-multi-select-optgroup-label", host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<ng-content></ng-content>\r\n", styles: [":host{display:block}\n"] });
4344
4344
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptgroupLabelComponent, decorators: [{
4345
4345
  type: Component,
4346
- args: [{ selector: 'c-multi-select-optgroup-label', template: "<ng-content></ng-content>\n", styles: [":host{display:block}\n"] }]
4346
+ args: [{ selector: 'c-multi-select-optgroup-label', template: "<ng-content></ng-content>\r\n", styles: [":host{display:block}\n"] }]
4347
4347
  }], ctorParameters: function () { return []; }, propDecorators: { hostClasses: [{
4348
4348
  type: HostBinding,
4349
4349
  args: ['class']
@@ -4357,10 +4357,10 @@ class MultiSelectOptgroupComponent {
4357
4357
  }
4358
4358
  }
4359
4359
  MultiSelectOptgroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptgroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
4360
- 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>\n<ng-content></ng-content>\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"] }] });
4360
+ 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"] }] });
4361
4361
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptgroupComponent, decorators: [{
4362
4362
  type: Component,
4363
- args: [{ selector: 'c-multi-select-optgroup', template: "<c-multi-select-optgroup-label *ngIf=\"label\">{{label}}</c-multi-select-optgroup-label>\n<ng-content></ng-content>\n", styles: [":host{display:block}\n"] }]
4363
+ 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"] }]
4364
4364
  }], propDecorators: { label: [{
4365
4365
  type: Input
4366
4366
  }], disabled: [{
@@ -4473,10 +4473,10 @@ class MultiSelectOptionComponent {
4473
4473
  }
4474
4474
  }
4475
4475
  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 });
4476
- 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>\n<div *ngIf=\"!hasContent\">\n {{label ?? value}}\n</div>\n\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"] }] });
4476
+ 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"] }] });
4477
4477
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectOptionComponent, decorators: [{
4478
4478
  type: Component,
4479
- args: [{ selector: 'c-multi-select-option', template: "<div #contentDiv><ng-content></ng-content></div>\n<div *ngIf=\"!hasContent\">\n {{label ?? value}}\n</div>\n\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"] }]
4479
+ 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"] }]
4480
4480
  }], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i1$1.FocusMonitor }, { type: MultiSelectService }]; }, propDecorators: { disabled: [{
4481
4481
  type: Input
4482
4482
  }], selected: [{
@@ -4555,10 +4555,10 @@ class MultiSelectTagComponent {
4555
4555
  }
4556
4556
  }
4557
4557
  MultiSelectTagComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectTagComponent, deps: [{ token: MultiSelectService }], target: i0.ɵɵFactoryTarget.Component });
4558
- MultiSelectTagComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectTagComponent, selector: "c-multi-select-tag", inputs: { option: "option" }, outputs: { remove: "remove" }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<ng-template [ngIfElse]=\"elseContent\"\n [ngIf]=\"!!option\">{{option.label ?? option.value ?? 'undefined'}}</ng-template>\n<ng-template #elseContent>\n <ng-content></ng-content>\n</ng-template>\n<button (click)=\"handleRemove($event)\" *ngIf=\"!option?.disabled\" [disabled]=\"!multiselectVisible\" aria-label=\"Clear\"\n cButtonClose class=\"form-multi-select-tag-delete close btn btn-xs\" type=\"button\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">x</span>\n</button>\n", styles: [":host .btn-xs{padding-left:.125rem;padding-right:.125rem;font-size:.575rem;border-radius:.2rem}:host.form-multi-select-tag{-webkit-user-select:none;user-select:none;pointer-events:all}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: ButtonCloseDirective, selector: "[cButtonClose]", inputs: ["white"] }] });
4558
+ MultiSelectTagComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.0.3", type: MultiSelectTagComponent, selector: "c-multi-select-tag", inputs: { option: "option" }, outputs: { remove: "remove" }, host: { properties: { "class": "this.hostClasses" } }, ngImport: i0, template: "<ng-template [ngIfElse]=\"elseContent\"\r\n [ngIf]=\"!!option\">{{option.label ?? option.value ?? 'undefined'}}</ng-template>\r\n<ng-template #elseContent>\r\n <ng-content></ng-content>\r\n</ng-template>\r\n<button (click)=\"handleRemove($event)\" *ngIf=\"!option?.disabled\" [disabled]=\"!multiselectVisible\" aria-label=\"Clear\"\r\n cButtonClose class=\"form-multi-select-tag-delete close btn btn-xs\" type=\"button\">\r\n <span aria-hidden=\"true\" class=\"visually-hidden\">x</span>\r\n</button>\r\n", styles: [":host .btn-xs{padding-left:.125rem;padding-right:.125rem;font-size:.575rem;border-radius:.2rem}:host.form-multi-select-tag{-webkit-user-select:none;user-select:none;pointer-events:all}\n"], directives: [{ type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: ButtonCloseDirective, selector: "[cButtonClose]", inputs: ["white"] }] });
4559
4559
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectTagComponent, decorators: [{
4560
4560
  type: Component,
4561
- args: [{ selector: 'c-multi-select-tag', template: "<ng-template [ngIfElse]=\"elseContent\"\n [ngIf]=\"!!option\">{{option.label ?? option.value ?? 'undefined'}}</ng-template>\n<ng-template #elseContent>\n <ng-content></ng-content>\n</ng-template>\n<button (click)=\"handleRemove($event)\" *ngIf=\"!option?.disabled\" [disabled]=\"!multiselectVisible\" aria-label=\"Clear\"\n cButtonClose class=\"form-multi-select-tag-delete close btn btn-xs\" type=\"button\">\n <span aria-hidden=\"true\" class=\"visually-hidden\">x</span>\n</button>\n", styles: [":host .btn-xs{padding-left:.125rem;padding-right:.125rem;font-size:.575rem;border-radius:.2rem}:host.form-multi-select-tag{-webkit-user-select:none;user-select:none;pointer-events:all}\n"] }]
4561
+ args: [{ selector: 'c-multi-select-tag', template: "<ng-template [ngIfElse]=\"elseContent\"\r\n [ngIf]=\"!!option\">{{option.label ?? option.value ?? 'undefined'}}</ng-template>\r\n<ng-template #elseContent>\r\n <ng-content></ng-content>\r\n</ng-template>\r\n<button (click)=\"handleRemove($event)\" *ngIf=\"!option?.disabled\" [disabled]=\"!multiselectVisible\" aria-label=\"Clear\"\r\n cButtonClose class=\"form-multi-select-tag-delete close btn btn-xs\" type=\"button\">\r\n <span aria-hidden=\"true\" class=\"visually-hidden\">x</span>\r\n</button>\r\n", styles: [":host .btn-xs{padding-left:.125rem;padding-right:.125rem;font-size:.575rem;border-radius:.2rem}:host.form-multi-select-tag{-webkit-user-select:none;user-select:none;pointer-events:all}\n"] }]
4562
4562
  }], ctorParameters: function () { return [{ type: MultiSelectService }]; }, propDecorators: { option: [{
4563
4563
  type: Input
4564
4564
  }], remove: [{
@@ -4576,10 +4576,10 @@ class MultiSelectNativeSelectComponent {
4576
4576
  }
4577
4577
  }
4578
4578
  MultiSelectNativeSelectComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectNativeSelectComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
4579
- 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" }, ngImport: i0, template: "<select [multiple]=\"multiple\" [name]=\"name\" style=\"display: none\" tabindex=\"-1\" [id]=\"id\">\n <option\n *ngFor=\"let option of options\"\n [label]=\"option.label\"\n [selected]=\"option.selected\"\n [value]=\"option.value\"\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 });
4579
+ 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 });
4580
4580
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectNativeSelectComponent, decorators: [{
4581
4581
  type: Component,
4582
- args: [{ selector: 'c-multi-select-native-select', changeDetection: ChangeDetectionStrategy.OnPush, template: "<select [multiple]=\"multiple\" [name]=\"name\" style=\"display: none\" tabindex=\"-1\" [id]=\"id\">\n <option\n *ngFor=\"let option of options\"\n [label]=\"option.label\"\n [selected]=\"option.selected\"\n [value]=\"option.value\"\n tabindex=\"-1\"\n ></option>\n</select>\n\n", styles: [":host{display:none}\n"] }]
4582
+ 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"] }]
4583
4583
  }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { form: [{
4584
4584
  type: Input
4585
4585
  }], id: [{
@@ -4590,6 +4590,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4590
4590
  type: Input
4591
4591
  }], options: [{
4592
4592
  type: Input
4593
+ }], disabled: [{
4594
+ type: Input
4593
4595
  }] } });
4594
4596
 
4595
4597
  // const flattenArray = (options: IOption[]): IOption[] => {
@@ -4607,7 +4609,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4607
4609
  // });
4608
4610
  // };
4609
4611
  class MultiSelectComponent {
4610
- constructor(elementRef, renderer, ngZone, changeDetectorRef, viewContainerRef, focusMonitor, multiSelectService) {
4612
+ constructor(elementRef, renderer, ngZone, changeDetectorRef, viewContainerRef, focusMonitor, multiSelectService
4613
+ // private listenersService: ListenersService
4614
+ ) {
4611
4615
  this.elementRef = elementRef;
4612
4616
  this.renderer = renderer;
4613
4617
  this.ngZone = ngZone;
@@ -4621,7 +4625,7 @@ class MultiSelectComponent {
4621
4625
  this._multiple = false;
4622
4626
  this.nativeName = '';
4623
4627
  this.nativeId = '';
4624
- this.options = [];
4628
+ // @Input() options = [];
4625
4629
  this.optionsMaxHeight = 'auto';
4626
4630
  this.optionsStyle = 'checkbox';
4627
4631
  this.placeholder = 'Select...';
@@ -4643,7 +4647,11 @@ class MultiSelectComponent {
4643
4647
  this._subtreeFocused = this.focusOrigin(null);
4644
4648
  }
4645
4649
  writeValue(value) {
4646
- this.onChange(this.value);
4650
+ // console.log('writeValue', value)
4651
+ if (value !== null) {
4652
+ this.value = value;
4653
+ // this.onChange(this.value);
4654
+ }
4647
4655
  }
4648
4656
  registerOnChange(fn) {
4649
4657
  this.onChange = fn;
@@ -4668,8 +4676,9 @@ class MultiSelectComponent {
4668
4676
  set value(value) {
4669
4677
  const newValue = Array.isArray(value) ? [...value] : [value ?? ''];
4670
4678
  if (this._value.toString() !== newValue.toString()) {
4679
+ // console.log('set value', value)
4671
4680
  this._value = newValue;
4672
- this.writeValue(this.value);
4681
+ this.onChange(newValue);
4673
4682
  this.updateNativeSelect();
4674
4683
  this.valueChange.emit(this.value);
4675
4684
  }
@@ -4700,7 +4709,8 @@ class MultiSelectComponent {
4700
4709
  return {
4701
4710
  'form-multi-select': true,
4702
4711
  'form-multi-select-selection-tags': this.selectionType === 'tags',
4703
- show: this.visible
4712
+ show: this.visible,
4713
+ disabled: this.disabled
4704
4714
  };
4705
4715
  }
4706
4716
  get tabIndex() {
@@ -4712,36 +4722,42 @@ class MultiSelectComponent {
4712
4722
  });
4713
4723
  }
4714
4724
  onKeyUp($event) {
4715
- console.log('keyup', $event.key);
4716
- if ($event.key === 'Escape') {
4717
- this.visible = false;
4718
- this.inputValue = '';
4719
- this.setFocus();
4720
- // this.focusMonitor.focusVia(this.inputElement ?? this.elementRef, 'keyboard');
4721
- }
4722
- else if ($event.key === 'Enter') {
4723
- // } else {
4724
- this.visible = true;
4725
- if (!this.search) {
4725
+ // console.log('keyup', $event.key);
4726
+ if (!this.disabled) {
4727
+ if ($event.key === 'Escape') {
4728
+ this.visible = false;
4729
+ this.inputValue = '';
4726
4730
  this.setFocus();
4731
+ // this.focusMonitor.focusVia(this.inputElement ?? this.elementRef, 'keyboard');
4732
+ }
4733
+ else if ($event.key === 'Enter') {
4734
+ // } else {
4735
+ this.visible = true;
4736
+ if (!this.search) {
4737
+ this.setFocus();
4738
+ }
4727
4739
  }
4728
4740
  }
4729
4741
  }
4730
4742
  manage($event) {
4731
- console.log('keydown', $event.key);
4732
- if ($event.key === 'Enter' && $event.target === this.inputElement.nativeElement) {
4733
- $event.preventDefault();
4743
+ // console.log('keydown', $event.key);
4744
+ if (!this.disabled) {
4745
+ if ($event.key === 'Enter' && $event.target === this.inputElement.nativeElement) {
4746
+ $event.preventDefault();
4747
+ }
4748
+ this.listKeyManager.onKeydown($event);
4734
4749
  }
4735
- this.listKeyManager.onKeydown($event);
4736
4750
  }
4737
4751
  onClick($event) {
4738
- if (!this.visible) {
4739
- this.visible = !this.visible;
4752
+ if (!this.disabled) {
4753
+ if (!this.visible) {
4754
+ this.visible = !this.visible;
4755
+ }
4756
+ this.setFocus();
4740
4757
  }
4741
- this.setFocus();
4742
4758
  }
4743
4759
  set inputValue(value) {
4744
- console.log('inputValue', value);
4760
+ // console.log('inputValue', value);
4745
4761
  this._inputValue = value;
4746
4762
  // this.visible = !!value ?? this.visible;
4747
4763
  this.filterOptions(value);
@@ -4753,7 +4769,7 @@ class MultiSelectComponent {
4753
4769
  return this._subtreeFocused;
4754
4770
  }
4755
4771
  set subtreeFocused(value) {
4756
- this._subtreeFocused = value;
4772
+ this._subtreeFocused = this.disabled ? false : value;
4757
4773
  this.visible = value === false ? false : this.visible;
4758
4774
  }
4759
4775
  focusOrigin(origin) {
@@ -4774,12 +4790,13 @@ class MultiSelectComponent {
4774
4790
  this.visibleOptions = this.multiSelectOptions.length;
4775
4791
  this.multiSelectOptions.forEach((option, index) => {
4776
4792
  option.optionsStyle = this.optionsStyle;
4793
+ option.selected = option.value !== undefined ? this.value.includes(option.value) || option.selected : option.selected;
4777
4794
  });
4778
- this._selectedOptions = this.multiSelectOptions.filter((option) => option.selected);
4795
+ this._selectedOptions = this.multiSelectOptions.filter((option) => !!option.selected);
4779
4796
  setTimeout(() => {
4780
4797
  this.value = this._selectedOptions.map(item => item.value);
4781
4798
  });
4782
- this.value = this._selectedOptions.map(item => item.value);
4799
+ // this.value = this._selectedOptions.map(item => item.value);
4783
4800
  this.listKeyManager = new FocusKeyManager(this.multiSelectOptions).withHomeAndEnd();
4784
4801
  this.listKeyManager.skipPredicate(item => !item.visible);
4785
4802
  this.multiselectSubscribe();
@@ -4788,14 +4805,16 @@ class MultiSelectComponent {
4788
4805
  ngAfterViewInit() {
4789
4806
  // this.setListeners();
4790
4807
  this.focusMonitorSubscription = this.focusMonitor.monitor(this.elementRef, true).subscribe((origin) => this.ngZone.run(() => {
4791
- this.subtreeFocused = this.focusOrigin(origin);
4792
- this.changeDetectorRef.markForCheck();
4808
+ if (!this.disabled) {
4809
+ this.subtreeFocused = this.focusOrigin(origin);
4810
+ this.changeDetectorRef.markForCheck();
4811
+ }
4793
4812
  }));
4794
4813
  }
4795
- handleInputClick($event) {
4796
- console.log('handleInputClick', $event);
4797
- // this.visible = !this.visible;
4798
- }
4814
+ // handleInputClick($event: MouseEvent) {
4815
+ // console.log('handleInputClick', $event);
4816
+ // // this.visible = !this.visible;
4817
+ // }
4799
4818
  multiselectSubscribe(subscribe = true) {
4800
4819
  if (subscribe) {
4801
4820
  this.multiselectVisibleSubscription = this.multiSelectService.multiSelectVisible$.subscribe((visible) => {
@@ -4813,7 +4832,7 @@ class MultiSelectComponent {
4813
4832
  }
4814
4833
  });
4815
4834
  }
4816
- this._selectedOptions = this.multiSelectOptions.filter((option) => option.selected);
4835
+ this._selectedOptions = this.multiSelectOptions.filter((option) => !!option.selected);
4817
4836
  this.value = this._selectedOptions.map(item => item.value);
4818
4837
  });
4819
4838
  }
@@ -4882,7 +4901,9 @@ class MultiSelectComponent {
4882
4901
  return;
4883
4902
  }
4884
4903
  }
4885
- this.focusMonitor.focusVia(this.inputElement ?? this.elementRef, 'program');
4904
+ if (!this.disabled) {
4905
+ this.focusMonitor.focusVia(this.inputElement ?? this.elementRef, 'program');
4906
+ }
4886
4907
  }
4887
4908
  filterOptions(value) {
4888
4909
  const searchString = value.toLowerCase() ?? '';
@@ -4914,11 +4935,12 @@ class MultiSelectComponent {
4914
4935
  this.nativeSelectRef.instance.name = this.nativeName;
4915
4936
  this.nativeSelectRef.instance.form = this.nativeId;
4916
4937
  this.nativeSelectRef.instance.options = options;
4938
+ this.nativeSelectRef.instance.disabled = this.disabled;
4917
4939
  this.nativeSelectRef.instance.changeDetectorRef.detectChanges();
4918
4940
  }
4919
4941
  }
4920
4942
  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 });
4921
- 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", options: "options", 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: [
4943
+ 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: [
4922
4944
  MultiSelectService,
4923
4945
  // ListenersService,
4924
4946
  {
@@ -4926,7 +4948,7 @@ MultiSelectComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", v
4926
4948
  useExisting: forwardRef(() => MultiSelectComponent),
4927
4949
  multi: true
4928
4950
  }
4929
- ], 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 (remove)=\"handleTagRemove($event)\" *ngFor=\"let option of selectedOptions; index as i\"\n [option]=\"option\" tabindex=\"-1\"></c-multi-select-tag>\n </ng-template>\n <ng-template [ngIf]=\"selectionType==='text'\">\n <span class=\"bg-light\">{{selectedOptionsText}}</span>\n </ng-template>\n <ng-template [ngIf]=\"selectionType==='counter'\">\n <span>{{counterText}}</span>\n </ng-template>\n</div>\n\n<input #inputElement\n [(ngModel)]=\"inputValue\"\n [disabled]=\"!search\"\n [placeholder]=\"(selectedOptions.length === 0 && selectionType!=='counter') ? placeholder : ''\"\n autocomplete=\"off\"\n class=\"form-multi-select-search ms-1\" tabindex=\"0\"\n type=\"text\">\n\n<button (click)=\"clearAllOptions($event)\"\n *ngIf=\"cleaner && selectedOptions.length > 0\"\n [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 class=\"form-multi-select-dropdown\">\n <ng-template [ngIf]=\"visibleOptions>0\" [ngIfElse]=\"optionsEmpty\">\n <button (click)=\"selectAllOptions()\"\n *ngIf=\"selectAll && multiple\"\n 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 <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\n", styles: [":host{display:block}:host.cdk-focused{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-selection-tags{padding-top:.0625rem}\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: ButtonCloseDirective, selector: "[cButtonClose]", inputs: ["white"] }, { type: i2.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }] });
4951
+ ], 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"] }] });
4930
4952
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: MultiSelectComponent, decorators: [{
4931
4953
  type: Component,
4932
4954
  args: [{ selector: 'c-multi-select', exportAs: 'cMultiSelect', providers: [
@@ -4937,7 +4959,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4937
4959
  useExisting: forwardRef(() => MultiSelectComponent),
4938
4960
  multi: true
4939
4961
  }
4940
- ], template: "<div class=\"form-multi-select-selection\">\n <ng-template [ngIf]=\"selectionType==='tags'\">\n <c-multi-select-tag (remove)=\"handleTagRemove($event)\" *ngFor=\"let option of selectedOptions; index as i\"\n [option]=\"option\" tabindex=\"-1\"></c-multi-select-tag>\n </ng-template>\n <ng-template [ngIf]=\"selectionType==='text'\">\n <span class=\"bg-light\">{{selectedOptionsText}}</span>\n </ng-template>\n <ng-template [ngIf]=\"selectionType==='counter'\">\n <span>{{counterText}}</span>\n </ng-template>\n</div>\n\n<input #inputElement\n [(ngModel)]=\"inputValue\"\n [disabled]=\"!search\"\n [placeholder]=\"(selectedOptions.length === 0 && selectionType!=='counter') ? placeholder : ''\"\n autocomplete=\"off\"\n class=\"form-multi-select-search ms-1\" tabindex=\"0\"\n type=\"text\">\n\n<button (click)=\"clearAllOptions($event)\"\n *ngIf=\"cleaner && selectedOptions.length > 0\"\n [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 class=\"form-multi-select-dropdown\">\n <ng-template [ngIf]=\"visibleOptions>0\" [ngIfElse]=\"optionsEmpty\">\n <button (click)=\"selectAllOptions()\"\n *ngIf=\"selectAll && multiple\"\n 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 <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\n", styles: [":host{display:block}:host.cdk-focused{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-selection-tags{padding-top:.0625rem}\n"] }]
4962
+ ], 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"] }]
4941
4963
  }], 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: [{
4942
4964
  type: Input
4943
4965
  }], disabled: [{
@@ -4948,8 +4970,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImpor
4948
4970
  type: Input
4949
4971
  }], nativeId: [{
4950
4972
  type: Input
4951
- }], options: [{
4952
- type: Input
4953
4973
  }], optionsMaxHeight: [{
4954
4974
  type: Input
4955
4975
  }], optionsStyle: [{