@colijnit/corecomponents_v12 262.1.2 → 262.1.4

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.
@@ -7823,7 +7823,11 @@ class InputTextComponent extends BaseInputComponent {
7823
7823
  event.preventDefault();
7824
7824
  }
7825
7825
  }
7826
- if (this.type === 'number' && this.model?.length === this.maxLength && /^\d$/.test(key)) {
7826
+ const value = String(this.model ?? "");
7827
+ if (this.type === "number" &&
7828
+ this.maxLength > 0 &&
7829
+ value.length >= this.maxLength &&
7830
+ /^\d$/.test(key)) {
7827
7831
  event.preventDefault();
7828
7832
  }
7829
7833
  }
@@ -13942,9 +13946,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
13942
13946
  }]
13943
13947
  }] });
13944
13948
 
13949
+ class LovUtils {
13950
+ static getDisplayValue(model, displayField) {
13951
+ if (!model || !displayField) {
13952
+ return '';
13953
+ }
13954
+ return displayField
13955
+ .split('|')
13956
+ .map(field => model[field.trim()])
13957
+ .filter(val => val != null && val !== '')
13958
+ .join(' - ');
13959
+ }
13960
+ }
13961
+
13945
13962
  class ListOfValuesPopupComponent {
13946
13963
  iconCacheService;
13947
13964
  _elementRef;
13965
+ lovUtils = LovUtils;
13948
13966
  set lovItems(children) {
13949
13967
  this._lovItems = children.toArray();
13950
13968
  this._scrollIntoView();
@@ -14075,7 +14093,7 @@ class ListOfValuesPopupComponent {
14075
14093
  this.selectNextOption();
14076
14094
  }
14077
14095
  if (!this.model && this.searchTerm) {
14078
- const wishModel = this.viewModelsMain.find(vmm => vmm.model[this.displayField] === this.searchTerm);
14096
+ const wishModel = this.viewModelsMain.find(vmm => LovUtils.getDisplayValue(vmm.model, this.displayField) === this.searchTerm);
14079
14097
  if (wishModel) {
14080
14098
  this.selectViewModel(wishModel);
14081
14099
  }
@@ -14148,8 +14166,8 @@ class ListOfValuesPopupComponent {
14148
14166
  }
14149
14167
  if (!this.model)
14150
14168
  return false;
14151
- const selected = this.model?.[this.displayField];
14152
- const current = vm.model?.[this.displayField];
14169
+ const selected = LovUtils.getDisplayValue(this.model, this.displayField);
14170
+ const current = LovUtils.getDisplayValue(vm.model, this.displayField);
14153
14171
  return selected != null && current != null && selected === current;
14154
14172
  }
14155
14173
  _prepareViewModelsMain() {
@@ -14198,102 +14216,102 @@ class ListOfValuesPopupComponent {
14198
14216
  }
14199
14217
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfValuesPopupComponent, deps: [{ token: IconCacheService }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component });
14200
14218
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.16", type: ListOfValuesPopupComponent, isStandalone: false, selector: "co-list-of-values-popup", inputs: { model: "model", multiselect: "multiselect", showToggleAll: "showToggleAll", displayField: "displayField", searchPlaceholder: "searchPlaceholder", customCssClass: "customCssClass", searchDisabled: "searchDisabled", parentForOverlay: "parentForOverlay", optionIcon: "optionIcon", collection: "collection" }, outputs: { modelChange: "modelChange", closePopup: "closePopup", keyDown: "keyDown" }, host: { properties: { "class.co-list-of-values-popup": "this.showClass", "class.lov-anim": "this.animBase", "class.lov-anim--open": "this.isOpen" } }, viewQueries: [{ propertyName: "dropDownList", first: true, predicate: ["dropDownList"], descendants: true, read: ElementRef }, { propertyName: "inputSearch", first: true, predicate: InputSearchComponent, descendants: true }, { propertyName: "lovItems", predicate: ["lovItem"], descendants: true, read: ElementRef }], ngImport: i0, template: `
14201
- <div class="lov-options" [overlay]="parentForOverlay" [inheritWidth]="true" [ngClass]="customCssClass"
14202
- id="lov-popup"
14203
- role="listbox" [tabindex]="-1"
14204
- (clickOutside)="closePopup.emit($event)">
14205
- @if (multiselect) {
14206
- <co-input-search
14207
- tabindex="-1"
14208
- [(model)]="searchTerm"
14209
- [placeholder]="searchPlaceholder"
14210
- (keydown)="handleInputKeyDown($event)"
14211
- (modelChange)="filterViewModels()"></co-input-search>
14212
- }
14213
- @if (showToggleAll && multiselect) {
14214
- <div class="row gap">
14215
- <co-input-checkbox [model]="allSelected" (modelChange)="toggleAll()"></co-input-checkbox>
14216
- <span [textContent]="'DESELECT_ALL' | coreLocalize" (click)="toggleAll()"></span>
14217
- </div>
14218
- }
14219
- <ul class="dropdown-list" #dropDownList>
14220
- @for (viewModel of viewModels; track viewModel; let index = $index) {
14221
- <li
14222
- #lovItem
14223
- [class.selected]="viewModel === highLightModel || viewModels.length === 1"
14224
- [class.active]="isActive(viewModel)"
14225
- [class.highlighted]="viewModel === highLightModel"
14226
- [attr.aria-selected]="isActive(viewModel)"
14227
- (click)="selectViewModel(viewModel, !multiselect)"
14228
- role="option">
14229
- @if (!multiselect) {
14230
- @if (viewModel.model[optionIcon]) {
14231
- <co-icon class="input-text-left-icon" [iconData]="iconCacheService.getIcon(viewModel.model[optionIcon])">
14232
- </co-icon>
14219
+ <div class="lov-options" [overlay]="parentForOverlay" [inheritWidth]="true" [ngClass]="customCssClass"
14220
+ id="lov-popup"
14221
+ role="listbox" [tabindex]="-1"
14222
+ (clickOutside)="closePopup.emit($event)">
14223
+ @if (multiselect) {
14224
+ <co-input-search
14225
+ tabindex="-1"
14226
+ [(model)]="searchTerm"
14227
+ [placeholder]="searchPlaceholder"
14228
+ (keydown)="handleInputKeyDown($event)"
14229
+ (modelChange)="filterViewModels()"></co-input-search>
14230
+ }
14231
+ @if (showToggleAll && multiselect) {
14232
+ <div class="row gap">
14233
+ <co-input-checkbox [model]="allSelected" (modelChange)="toggleAll()"></co-input-checkbox>
14234
+ <span [textContent]="'DESELECT_ALL' | coreLocalize" (click)="toggleAll()"></span>
14235
+ </div>
14236
+ }
14237
+ <ul class="dropdown-list" #dropDownList>
14238
+ @for (viewModel of viewModels; track viewModel; let index = $index) {
14239
+ <li
14240
+ #lovItem
14241
+ [class.selected]="viewModel === highLightModel || viewModels.length === 1"
14242
+ [class.active]="isActive(viewModel)"
14243
+ [class.highlighted]="viewModel === highLightModel"
14244
+ [attr.aria-selected]="isActive(viewModel)"
14245
+ (click)="selectViewModel(viewModel, !multiselect)"
14246
+ role="option">
14247
+ @if (!multiselect) {
14248
+ @if (viewModel.model[optionIcon]) {
14249
+ <co-icon class="input-text-left-icon" [iconData]="iconCacheService.getIcon(viewModel.model[optionIcon])">
14250
+ </co-icon>
14251
+ }
14252
+ <span class="lov-options-text" [textContent]="lovUtils.getDisplayValue(viewModel.model, displayField)"></span>
14253
+ }
14254
+ @if (multiselect) {
14255
+ <co-input-checkbox [model]="viewModel.checked"
14256
+ (modelChange)="selectViewModel(viewModel, false)"></co-input-checkbox>
14257
+ <span class="lov-options-text" [textContent]="lovUtils.getDisplayValue(viewModel.model, displayField)"></span>
14258
+ }
14259
+ </li>
14233
14260
  }
14234
- <span class="lov-options-text" [textContent]="viewModel.model[displayField]"></span>
14235
- }
14236
- @if (multiselect) {
14237
- <co-input-checkbox [model]="viewModel.checked"
14238
- (modelChange)="selectViewModel(viewModel, false)"></co-input-checkbox>
14239
- <span class="lov-options-text" [textContent]="viewModel.model[displayField]"></span>
14240
- }
14241
- </li>
14242
- }
14243
- </ul>
14244
- </div>
14245
- `, isInline: true, dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: InputCheckboxComponent, selector: "co-input-checkbox", inputs: ["cssClass", "clickableLabel"], outputs: ["modelChange"] }, { kind: "directive", type: OverlayDirective, selector: "[overlay]", inputs: ["overlay", "view", "inline", "keepInView", "inheritWidth", "rightAlign", "fullSize"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[clickOutside]", inputs: ["clickOutside", "alwaysTrigger"], outputs: ["clickOutside"], exportAs: ["clickOutside"] }, { kind: "component", type: IconComponent, selector: "co-icon", inputs: ["icon", "iconData"] }, { kind: "component", type: InputSearchComponent, selector: "co-input-search", inputs: ["placeholder", "handleKeydown", "useLeftIcon", "useRightIcon", "leftIconData", "rightIconData", "centerLabel"], outputs: ["search", "isFocused", "leftIconClick", "rightIconClick"] }, { kind: "pipe", type: CoreLocalizePipe, name: "coreLocalize" }], encapsulation: i0.ViewEncapsulation.None });
14261
+ </ul>
14262
+ </div>
14263
+ `, isInline: true, dependencies: [{ kind: "directive", type: i1$1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "component", type: InputCheckboxComponent, selector: "co-input-checkbox", inputs: ["cssClass", "clickableLabel"], outputs: ["modelChange"] }, { kind: "directive", type: OverlayDirective, selector: "[overlay]", inputs: ["overlay", "view", "inline", "keepInView", "inheritWidth", "rightAlign", "fullSize"] }, { kind: "directive", type: ClickOutsideDirective, selector: "[clickOutside]", inputs: ["clickOutside", "alwaysTrigger"], outputs: ["clickOutside"], exportAs: ["clickOutside"] }, { kind: "component", type: IconComponent, selector: "co-icon", inputs: ["icon", "iconData"] }, { kind: "component", type: InputSearchComponent, selector: "co-input-search", inputs: ["placeholder", "handleKeydown", "useLeftIcon", "useRightIcon", "leftIconData", "rightIconData", "centerLabel"], outputs: ["search", "isFocused", "leftIconClick", "rightIconClick"] }, { kind: "pipe", type: CoreLocalizePipe, name: "coreLocalize" }], encapsulation: i0.ViewEncapsulation.None });
14246
14264
  }
14247
14265
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ListOfValuesPopupComponent, decorators: [{
14248
14266
  type: Component,
14249
14267
  args: [{
14250
14268
  selector: 'co-list-of-values-popup',
14251
14269
  template: `
14252
- <div class="lov-options" [overlay]="parentForOverlay" [inheritWidth]="true" [ngClass]="customCssClass"
14253
- id="lov-popup"
14254
- role="listbox" [tabindex]="-1"
14255
- (clickOutside)="closePopup.emit($event)">
14256
- @if (multiselect) {
14257
- <co-input-search
14258
- tabindex="-1"
14259
- [(model)]="searchTerm"
14260
- [placeholder]="searchPlaceholder"
14261
- (keydown)="handleInputKeyDown($event)"
14262
- (modelChange)="filterViewModels()"></co-input-search>
14263
- }
14264
- @if (showToggleAll && multiselect) {
14265
- <div class="row gap">
14266
- <co-input-checkbox [model]="allSelected" (modelChange)="toggleAll()"></co-input-checkbox>
14267
- <span [textContent]="'DESELECT_ALL' | coreLocalize" (click)="toggleAll()"></span>
14268
- </div>
14269
- }
14270
- <ul class="dropdown-list" #dropDownList>
14271
- @for (viewModel of viewModels; track viewModel; let index = $index) {
14272
- <li
14273
- #lovItem
14274
- [class.selected]="viewModel === highLightModel || viewModels.length === 1"
14275
- [class.active]="isActive(viewModel)"
14276
- [class.highlighted]="viewModel === highLightModel"
14277
- [attr.aria-selected]="isActive(viewModel)"
14278
- (click)="selectViewModel(viewModel, !multiselect)"
14279
- role="option">
14280
- @if (!multiselect) {
14281
- @if (viewModel.model[optionIcon]) {
14282
- <co-icon class="input-text-left-icon" [iconData]="iconCacheService.getIcon(viewModel.model[optionIcon])">
14283
- </co-icon>
14270
+ <div class="lov-options" [overlay]="parentForOverlay" [inheritWidth]="true" [ngClass]="customCssClass"
14271
+ id="lov-popup"
14272
+ role="listbox" [tabindex]="-1"
14273
+ (clickOutside)="closePopup.emit($event)">
14274
+ @if (multiselect) {
14275
+ <co-input-search
14276
+ tabindex="-1"
14277
+ [(model)]="searchTerm"
14278
+ [placeholder]="searchPlaceholder"
14279
+ (keydown)="handleInputKeyDown($event)"
14280
+ (modelChange)="filterViewModels()"></co-input-search>
14281
+ }
14282
+ @if (showToggleAll && multiselect) {
14283
+ <div class="row gap">
14284
+ <co-input-checkbox [model]="allSelected" (modelChange)="toggleAll()"></co-input-checkbox>
14285
+ <span [textContent]="'DESELECT_ALL' | coreLocalize" (click)="toggleAll()"></span>
14286
+ </div>
14287
+ }
14288
+ <ul class="dropdown-list" #dropDownList>
14289
+ @for (viewModel of viewModels; track viewModel; let index = $index) {
14290
+ <li
14291
+ #lovItem
14292
+ [class.selected]="viewModel === highLightModel || viewModels.length === 1"
14293
+ [class.active]="isActive(viewModel)"
14294
+ [class.highlighted]="viewModel === highLightModel"
14295
+ [attr.aria-selected]="isActive(viewModel)"
14296
+ (click)="selectViewModel(viewModel, !multiselect)"
14297
+ role="option">
14298
+ @if (!multiselect) {
14299
+ @if (viewModel.model[optionIcon]) {
14300
+ <co-icon class="input-text-left-icon" [iconData]="iconCacheService.getIcon(viewModel.model[optionIcon])">
14301
+ </co-icon>
14302
+ }
14303
+ <span class="lov-options-text" [textContent]="lovUtils.getDisplayValue(viewModel.model, displayField)"></span>
14304
+ }
14305
+ @if (multiselect) {
14306
+ <co-input-checkbox [model]="viewModel.checked"
14307
+ (modelChange)="selectViewModel(viewModel, false)"></co-input-checkbox>
14308
+ <span class="lov-options-text" [textContent]="lovUtils.getDisplayValue(viewModel.model, displayField)"></span>
14309
+ }
14310
+ </li>
14284
14311
  }
14285
- <span class="lov-options-text" [textContent]="viewModel.model[displayField]"></span>
14286
- }
14287
- @if (multiselect) {
14288
- <co-input-checkbox [model]="viewModel.checked"
14289
- (modelChange)="selectViewModel(viewModel, false)"></co-input-checkbox>
14290
- <span class="lov-options-text" [textContent]="viewModel.model[displayField]"></span>
14291
- }
14292
- </li>
14293
- }
14294
- </ul>
14295
- </div>
14296
- `,
14312
+ </ul>
14313
+ </div>
14314
+ `,
14297
14315
  encapsulation: ViewEncapsulation.None,
14298
14316
  standalone: false
14299
14317
  }]
@@ -14352,6 +14370,7 @@ class ListOfValuesComponent extends BaseInputComponent {
14352
14370
  ngZoneWrapper;
14353
14371
  elementRef;
14354
14372
  icons = CoreComponentsIcon;
14373
+ lovUtils = LovUtils;
14355
14374
  set model(value) {
14356
14375
  super.model = value;
14357
14376
  this._setSelectedModel();
@@ -14526,12 +14545,12 @@ class ListOfValuesComponent extends BaseInputComponent {
14526
14545
  optionChosen(option) {
14527
14546
  if (option) {
14528
14547
  if (this.multiselect) {
14529
- this.selectedModels = option.map(o => o[this.displayField]);
14548
+ this.selectedModels = option.map(o => LovUtils.getDisplayValue(o, this.displayField));
14530
14549
  }
14531
14550
  else {
14532
- this.selectedModel = option[this.displayField];
14551
+ this.selectedModel = LovUtils.getDisplayValue(option, this.displayField);
14533
14552
  if (this.largeCollection) {
14534
- this.filterText = option[this.displayField];
14553
+ this.filterText = LovUtils.getDisplayValue(option, this.displayField);
14535
14554
  }
14536
14555
  }
14537
14556
  }
@@ -14556,7 +14575,7 @@ class ListOfValuesComponent extends BaseInputComponent {
14556
14575
  }
14557
14576
  checkModel() {
14558
14577
  if (!this.multiselect && this.selectedModel && this.collection) {
14559
- const model = this.collection.find(c => c[this.displayField] === this.selectedModel);
14578
+ const model = this.collection.find(c => LovUtils.getDisplayValue(c, this.displayField) === this.selectedModel);
14560
14579
  if (model) {
14561
14580
  this.model = model;
14562
14581
  }
@@ -14571,7 +14590,7 @@ class ListOfValuesComponent extends BaseInputComponent {
14571
14590
  if (this.model) {
14572
14591
  this.selectedModels.length = 0;
14573
14592
  this.model.forEach(m => {
14574
- this.selectedModels.push(m[this.displayField]);
14593
+ this.selectedModels.push(LovUtils.getDisplayValue(m, this.displayField));
14575
14594
  });
14576
14595
  }
14577
14596
  else {
@@ -14580,9 +14599,9 @@ class ListOfValuesComponent extends BaseInputComponent {
14580
14599
  }
14581
14600
  else {
14582
14601
  if (this.model) {
14583
- this.selectedModel = this.model[this.displayField];
14602
+ this.selectedModel = LovUtils.getDisplayValue(this.model, this.displayField);
14584
14603
  if (this.largeCollection) {
14585
- this.filterText = this.model[this.displayField];
14604
+ this.filterText = LovUtils.getDisplayValue(this.model, this.displayField);
14586
14605
  }
14587
14606
  }
14588
14607
  else {
@@ -14632,8 +14651,8 @@ class ListOfValuesComponent extends BaseInputComponent {
14632
14651
  <div class="multiselect-chips-wrapper">
14633
14652
  @for (chip of model; track chip) {
14634
14653
  <div class="chips">
14635
- <span class="chips-description" [textContent]="chip[displayField]"></span>
14636
- <co-icon class="remove-chip-icon" [icon]="icons.CrossSkinny" (click)="removeOptionFromModel(chip)"></co-icon>
14654
+ <span class="chips-description" [textContent]="lovUtils.getDisplayValue(chip, displayField)"></span>
14655
+ <co-icon class="remove-chip-icon" [icon]="icons.CrossSkinny" (click)="removeOptionFromModel(chip)"></co-icon>
14637
14656
  </div>
14638
14657
  }
14639
14658
  </div>
@@ -14696,8 +14715,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.16", ngImpo
14696
14715
  <div class="multiselect-chips-wrapper">
14697
14716
  @for (chip of model; track chip) {
14698
14717
  <div class="chips">
14699
- <span class="chips-description" [textContent]="chip[displayField]"></span>
14700
- <co-icon class="remove-chip-icon" [icon]="icons.CrossSkinny" (click)="removeOptionFromModel(chip)"></co-icon>
14718
+ <span class="chips-description" [textContent]="lovUtils.getDisplayValue(chip, displayField)"></span>
14719
+ <co-icon class="remove-chip-icon" [icon]="icons.CrossSkinny" (click)="removeOptionFromModel(chip)"></co-icon>
14701
14720
  </div>
14702
14721
  }
14703
14722
  </div>
@@ -16419,6 +16438,7 @@ class FilterItemComponent {
16419
16438
  this.mode === this.modes.Slider;
16420
16439
  const canApplyDefaults = (modeWithoutCollection || (!modeWithoutCollection && this.collection && this.collection.length > 0)) &&
16421
16440
  this.defaultValue &&
16441
+ !this.hidden &&
16422
16442
  !(this._model?.length || this._model > 0);
16423
16443
  if (!canApplyDefaults) {
16424
16444
  return;