@acorex/cdk 20.2.0-next.2 → 20.2.0-next.21

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.
Files changed (45) hide show
  1. package/carousel/index.d.ts +1 -0
  2. package/common/index.d.ts +254 -28
  3. package/drag-drop/index.d.ts +1 -0
  4. package/drawer/index.d.ts +15 -0
  5. package/fesm2022/acorex-cdk-accordion.mjs +19 -19
  6. package/fesm2022/acorex-cdk-accordion.mjs.map +1 -1
  7. package/fesm2022/acorex-cdk-carousel.mjs +11 -5
  8. package/fesm2022/acorex-cdk-carousel.mjs.map +1 -1
  9. package/fesm2022/acorex-cdk-clipboard.mjs +6 -6
  10. package/fesm2022/acorex-cdk-clipboard.mjs.map +1 -1
  11. package/fesm2022/acorex-cdk-common.mjs +672 -222
  12. package/fesm2022/acorex-cdk-common.mjs.map +1 -1
  13. package/fesm2022/acorex-cdk-dom.mjs +3 -3
  14. package/fesm2022/acorex-cdk-dom.mjs.map +1 -1
  15. package/fesm2022/acorex-cdk-drag-drop.mjs +22 -19
  16. package/fesm2022/acorex-cdk-drag-drop.mjs.map +1 -1
  17. package/fesm2022/acorex-cdk-drawer.mjs +27 -14
  18. package/fesm2022/acorex-cdk-drawer.mjs.map +1 -1
  19. package/fesm2022/acorex-cdk-focus-trap.mjs +3 -3
  20. package/fesm2022/acorex-cdk-focus-trap.mjs.map +1 -1
  21. package/fesm2022/acorex-cdk-input-mask.mjs +3 -3
  22. package/fesm2022/acorex-cdk-input-mask.mjs.map +1 -1
  23. package/fesm2022/acorex-cdk-list-navigation.mjs +10 -10
  24. package/fesm2022/acorex-cdk-list-navigation.mjs.map +1 -1
  25. package/fesm2022/acorex-cdk-outline.mjs +19 -13
  26. package/fesm2022/acorex-cdk-outline.mjs.map +1 -1
  27. package/fesm2022/acorex-cdk-overlay.mjs +3 -3
  28. package/fesm2022/acorex-cdk-overlay.mjs.map +1 -1
  29. package/fesm2022/acorex-cdk-pan-view.mjs +3 -3
  30. package/fesm2022/acorex-cdk-pan-view.mjs.map +1 -1
  31. package/fesm2022/acorex-cdk-qrcode.mjs.map +1 -1
  32. package/fesm2022/acorex-cdk-resizable.mjs +3 -3
  33. package/fesm2022/acorex-cdk-resizable.mjs.map +1 -1
  34. package/fesm2022/acorex-cdk-selection.mjs +10 -10
  35. package/fesm2022/acorex-cdk-selection.mjs.map +1 -1
  36. package/fesm2022/acorex-cdk-sliding-item.mjs +7 -7
  37. package/fesm2022/acorex-cdk-sliding-item.mjs.map +1 -1
  38. package/fesm2022/acorex-cdk-sticky.mjs +3 -3
  39. package/fesm2022/acorex-cdk-sticky.mjs.map +1 -1
  40. package/fesm2022/acorex-cdk-virtual-scroll.mjs +10 -10
  41. package/fesm2022/acorex-cdk-virtual-scroll.mjs.map +1 -1
  42. package/fesm2022/acorex-cdk-wysiwyg.mjs.map +1 -1
  43. package/outline/index.d.ts +2 -0
  44. package/package.json +1 -2
  45. package/selection/index.d.ts +2 -2
@@ -1,7 +1,7 @@
1
1
  import * as i0 from '@angular/core';
2
2
  import { model, output, Component, inject, ElementRef, signal, afterNextRender, Injectable, ChangeDetectorRef, ViewContainerRef, EventEmitter, DOCUMENT, PLATFORM_ID, Renderer2, Input, Directive, NgModule, InjectionToken, Output, input, effect } from '@angular/core';
3
3
  import { AXHtmlUtil } from '@acorex/core/utils';
4
- import { flatten, clone, cloneDeep, isEqual, omit, set } from 'lodash-es';
4
+ import { flatten, clone, cloneDeep, isEqual, omit, set, get } from 'lodash-es';
5
5
  import { isBrowser } from '@acorex/core/platform';
6
6
  import { AXValidationService } from '@acorex/core/validation';
7
7
  import { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';
@@ -21,10 +21,10 @@ class NXButtonComponent {
21
21
  this.toggleableChange = output();
22
22
  this.selectedChange = output();
23
23
  }
24
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
25
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: NXButtonComponent, isStandalone: true, selector: "ng-component", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { text: "textChange", toggleableChange: "toggleableChange", selectedChange: "selectedChange" }, ngImport: i0, template: '', isInline: true }); }
24
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
25
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.8", type: NXButtonComponent, isStandalone: true, selector: "ng-component", inputs: { text: { classPropertyName: "text", publicName: "text", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { text: "textChange", toggleableChange: "toggleableChange", selectedChange: "selectedChange" }, ngImport: i0, template: '', isInline: true }); }
26
26
  }
27
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXButtonComponent, decorators: [{
27
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXButtonComponent, decorators: [{
28
28
  type: Component,
29
29
  args: [{
30
30
  template: '',
@@ -35,10 +35,10 @@ class NXColorComponent {
35
35
  constructor() {
36
36
  this.color = model('default', ...(ngDevMode ? [{ debugName: "color" }] : []));
37
37
  }
38
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXColorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
39
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: NXColorComponent, isStandalone: true, selector: "ng-component", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { color: "colorChange" }, ngImport: i0, template: '', isInline: true }); }
38
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXColorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
39
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.8", type: NXColorComponent, isStandalone: true, selector: "ng-component", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { color: "colorChange" }, ngImport: i0, template: '', isInline: true }); }
40
40
  }
41
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXColorComponent, decorators: [{
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXColorComponent, decorators: [{
42
42
  type: Component,
43
43
  args: [{
44
44
  template: '',
@@ -63,10 +63,10 @@ class NXComponent {
63
63
  get nativeElement() {
64
64
  return this.#elementRef.nativeElement;
65
65
  }
66
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
67
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXComponent }); }
66
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
67
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXComponent }); }
68
68
  }
69
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXComponent, decorators: [{
69
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXComponent, decorators: [{
70
70
  type: Injectable
71
71
  }] });
72
72
 
@@ -106,10 +106,10 @@ class NXInteractiveComponent extends NXComponent {
106
106
  hasFocus() {
107
107
  return AXHtmlUtil.hasFocus(this.nativeElement);
108
108
  }
109
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXInteractiveComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
110
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: NXInteractiveComponent, isStandalone: true, selector: "ng-component", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", tabIndex: "tabIndexChange", onFocus: "onFocus", onBlur: "onBlur" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
109
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXInteractiveComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
110
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.8", type: NXInteractiveComponent, isStandalone: true, selector: "ng-component", inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, tabIndex: { classPropertyName: "tabIndex", publicName: "tabIndex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", tabIndex: "tabIndexChange", onFocus: "onFocus", onBlur: "onBlur" }, usesInheritance: true, ngImport: i0, template: '', isInline: true }); }
111
111
  }
112
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXInteractiveComponent, decorators: [{
112
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXInteractiveComponent, decorators: [{
113
113
  type: Component,
114
114
  args: [{
115
115
  template: '',
@@ -120,10 +120,10 @@ class NXLookComponent {
120
120
  constructor() {
121
121
  this.look = model('solid', ...(ngDevMode ? [{ debugName: "look" }] : []));
122
122
  }
123
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXLookComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
124
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: NXLookComponent, isStandalone: true, selector: "ng-component", inputs: { look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { look: "lookChange" }, ngImport: i0, template: '', isInline: true }); }
123
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXLookComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
124
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.8", type: NXLookComponent, isStandalone: true, selector: "ng-component", inputs: { look: { classPropertyName: "look", publicName: "look", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { look: "lookChange" }, ngImport: i0, template: '', isInline: true }); }
125
125
  }
126
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXLookComponent, decorators: [{
126
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXLookComponent, decorators: [{
127
127
  type: Component,
128
128
  args: [{
129
129
  template: '',
@@ -137,10 +137,10 @@ class NXValueComponent {
137
137
  this.value = model(...(ngDevMode ? [undefined, { debugName: "value" }] : []));
138
138
  this.onValueChanged = output();
139
139
  }
140
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
141
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.3", type: NXValueComponent, isStandalone: true, selector: "ng-component", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { readonly: "readonlyChange", name: "nameChange", value: "valueChange", onValueChanged: "onValueChanged" }, ngImport: i0, template: '', isInline: true }); }
140
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXValueComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
141
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.1.8", type: NXValueComponent, isStandalone: true, selector: "ng-component", inputs: { readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { readonly: "readonlyChange", name: "nameChange", value: "valueChange", onValueChanged: "onValueChanged" }, ngImport: i0, template: '', isInline: true }); }
142
142
  }
143
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: NXValueComponent, decorators: [{
143
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: NXValueComponent, decorators: [{
144
144
  type: Component,
145
145
  args: [{
146
146
  template: '',
@@ -316,10 +316,10 @@ class AXDomService {
316
316
  const randomness = Math.random().toString(36).substr(2);
317
317
  return dateString + randomness;
318
318
  }
319
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXDomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
320
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXDomService, providedIn: 'root' }); }
319
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXDomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
320
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXDomService, providedIn: 'root' }); }
321
321
  }
322
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXDomService, decorators: [{
322
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXDomService, decorators: [{
323
323
  type: Injectable,
324
324
  args: [{ providedIn: 'root' }]
325
325
  }] });
@@ -347,6 +347,11 @@ class MXBaseComponent {
347
347
  get cdr() {
348
348
  return this._cdr;
349
349
  }
350
+ /**
351
+ * Gets the host HTML element of the component.
352
+ *
353
+ * @returns T - The native DOM element associated with this component.
354
+ */
350
355
  getHostElement() {
351
356
  return this._elementRef?.nativeElement;
352
357
  }
@@ -363,6 +368,11 @@ class MXBaseComponent {
363
368
  ngOnInit() {
364
369
  this.getHostElement().__axContext__ = this;
365
370
  }
371
+ /**
372
+ * Sets a component option with optional lifecycle callbacks.
373
+ *
374
+ * @param option - The option configuration containing the name, value and optional before/after callbacks.
375
+ */
366
376
  setOption(option) {
367
377
  const oldValue = this[option.name];
368
378
  let newValue = this.internalOptionChanging({
@@ -388,10 +398,10 @@ class MXBaseComponent {
388
398
  if (option.afterCallback)
389
399
  option.afterCallback(oldValue, newValue);
390
400
  }
391
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
392
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXBaseComponent }); }
401
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXBaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
402
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXBaseComponent }); }
393
403
  }
394
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXBaseComponent, decorators: [{
404
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXBaseComponent, decorators: [{
395
405
  type: Injectable
396
406
  }] });
397
407
 
@@ -428,6 +438,11 @@ class MXInteractiveComponent extends MXBaseComponent {
428
438
  // this._focused.set(false);
429
439
  // }
430
440
  }
441
+ /**
442
+ * Registers a touched callback function (ControlValueAccessor method).
443
+ *
444
+ * @param fn - The callback function to register.
445
+ */
431
446
  registerOnTouched(fn) {
432
447
  this.onTouchedCallback = fn;
433
448
  }
@@ -463,6 +478,11 @@ class MXInteractiveComponent extends MXBaseComponent {
463
478
  },
464
479
  });
465
480
  }
481
+ /**
482
+ * Sets the disabled state of the component.
483
+ *
484
+ * @param isDisabled - Whether the component should be disabled.
485
+ */
466
486
  setDisabledState(isDisabled) {
467
487
  this.disabled = isDisabled;
468
488
  }
@@ -505,14 +525,22 @@ class MXInteractiveComponent extends MXBaseComponent {
505
525
  // nativeEvent: e,
506
526
  // });
507
527
  // }
528
+ /**
529
+ * Focuses the component.
530
+ */
508
531
  focus() {
509
532
  AXHtmlUtil.focusElement(this.getHostElement());
510
533
  }
534
+ /**
535
+ * Removes focus from the component.
536
+ */
511
537
  blur() {
512
538
  AXHtmlUtil.blurElement(this.getHostElement());
513
539
  }
514
540
  /**
515
- * Check component is focused or has any focused element.
541
+ * Checks if the component is focused or has any focused element.
542
+ *
543
+ * @returns boolean - True if the component has focus.
516
544
  */
517
545
  hasFocus() {
518
546
  return AXHtmlUtil.hasFocus(this.getHostElement());
@@ -639,10 +667,20 @@ class MXValueComponent extends MXInteractiveComponent {
639
667
  get isRequired() {
640
668
  return this.validationRules?.some((c) => c.rule == 'required');
641
669
  }
670
+ /**
671
+ * Adds a validation rule.
672
+ *
673
+ * @param rule - The validation rule to add.
674
+ */
642
675
  addValidationRule(rule) {
643
676
  this.validationRules.push(rule);
644
677
  this.validationRulesChange.emit(this.validationRules);
645
678
  }
679
+ /**
680
+ * Removes a validation rule.
681
+ *
682
+ * @param ruleToRemove - The validation rule to remove.
683
+ */
646
684
  removeValidationRule(ruleToRemove) {
647
685
  this.validationRules = this.validationRules.filter((r) => {
648
686
  if (r.rule !== ruleToRemove.rule) {
@@ -656,6 +694,11 @@ class MXValueComponent extends MXInteractiveComponent {
656
694
  this.validationRulesChange.emit(this.validationRules);
657
695
  this.setState('clear');
658
696
  }
697
+ /**
698
+ * Validates the component.
699
+ *
700
+ * @returns Promise<AXValidationSummary> - Validation result.
701
+ */
659
702
  async validate() {
660
703
  const container_classes = ['ax-editor-container', 'ax-checkbox', 'ax-radio'];
661
704
  const container = container_classes.some((c) => this.getHostElement().classList.contains(c))
@@ -724,12 +767,28 @@ class MXValueComponent extends MXInteractiveComponent {
724
767
  this.cdr.markForCheck();
725
768
  }
726
769
  }
770
+ /**
771
+ * Registers a change callback function (ControlValueAccessor method).
772
+ *
773
+ * @param fn - The callback function to register.
774
+ */
727
775
  registerOnChange(fn) {
728
776
  this.onChangeCallback = fn;
729
777
  }
778
+ /**
779
+ * Writes a value to the component (ControlValueAccessor method).
780
+ *
781
+ * @param value - The value to write.
782
+ */
730
783
  writeValue(value) {
731
784
  this.value = value;
732
785
  }
786
+ /**
787
+ * Commits a value with optional user interaction flag.
788
+ *
789
+ * @param value - The value to commit.
790
+ * @param u - Optional flag indicating if this is a user interaction.
791
+ */
733
792
  commitValue(value, u = false) {
734
793
  if (u) {
735
794
  this.markAsTouched();
@@ -738,16 +797,24 @@ class MXValueComponent extends MXInteractiveComponent {
738
797
  }
739
798
  this.writeValue(value);
740
799
  }
800
+ /**
801
+ * Resets the component value.
802
+ *
803
+ * @param e - Optional flag indicating if this is a user interaction.
804
+ */
741
805
  reset(e = false) {
742
806
  this.commitValue(null, e);
743
807
  }
808
+ /**
809
+ * Resets validation errors.
810
+ */
744
811
  resetErrors() {
745
812
  this.setState('clear');
746
813
  }
747
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXValueComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
748
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXValueComponent }); }
814
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXValueComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
815
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXValueComponent }); }
749
816
  }
750
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXValueComponent, decorators: [{
817
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXValueComponent, decorators: [{
751
818
  type: Injectable
752
819
  }] });
753
820
 
@@ -804,6 +871,12 @@ class AXButtonClickEvent extends AXClickEvent {
804
871
  */
805
872
  class AXItemClickEvent extends AXClickEvent {
806
873
  }
874
+ /**
875
+ * Fires each time the user select the element.
876
+ * @category Events
877
+ */
878
+ class AXItemSelectedEvent extends AXEvent {
879
+ }
807
880
  /**
808
881
  * Fires each time the component gets focused.
809
882
  * @category Events
@@ -854,52 +927,52 @@ class AXComponentClosedPromise extends Promise {
854
927
  }
855
928
  }
856
929
  class AXComponent {
857
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
858
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXComponent }); }
930
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
931
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXComponent }); }
859
932
  }
860
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXComponent, decorators: [{
933
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXComponent, decorators: [{
861
934
  type: Injectable
862
935
  }] });
863
936
  class AXClosableComponent extends AXComponent {
864
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXClosableComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
865
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXClosableComponent }); }
937
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXClosableComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
938
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXClosableComponent }); }
866
939
  }
867
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXClosableComponent, decorators: [{
940
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXClosableComponent, decorators: [{
868
941
  type: Injectable
869
942
  }] });
870
943
  class AXClearableComponent extends AXComponent {
871
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXClearableComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
872
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXClearableComponent }); }
944
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXClearableComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
945
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXClearableComponent }); }
873
946
  }
874
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXClearableComponent, decorators: [{
947
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXClearableComponent, decorators: [{
875
948
  type: Injectable
876
949
  }] });
877
950
  class AXSearchableComponent extends AXComponent {
878
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXSearchableComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
879
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXSearchableComponent }); }
951
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXSearchableComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
952
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXSearchableComponent }); }
880
953
  }
881
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXSearchableComponent, decorators: [{
954
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXSearchableComponent, decorators: [{
882
955
  type: Injectable
883
956
  }] });
884
957
  class AXValuableComponent extends AXComponent {
885
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXValuableComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
886
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXValuableComponent }); }
958
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXValuableComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
959
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXValuableComponent }); }
887
960
  }
888
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXValuableComponent, decorators: [{
961
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXValuableComponent, decorators: [{
889
962
  type: Injectable
890
963
  }] });
891
964
  class AXFocusableComponent extends AXComponent {
892
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXFocusableComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
893
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXFocusableComponent }); }
965
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXFocusableComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
966
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXFocusableComponent }); }
894
967
  }
895
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXFocusableComponent, decorators: [{
968
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXFocusableComponent, decorators: [{
896
969
  type: Injectable
897
970
  }] });
898
971
  class AXPagedComponent extends AXComponent {
899
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXPagedComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
900
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXPagedComponent }); }
972
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXPagedComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
973
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXPagedComponent }); }
901
974
  }
902
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXPagedComponent, decorators: [{
975
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXPagedComponent, decorators: [{
903
976
  type: Injectable
904
977
  }] });
905
978
  class AXAutocompleteParentComponent extends MXValueComponent {
@@ -921,10 +994,10 @@ class AXAutocompleteParentComponent extends MXValueComponent {
921
994
  });
922
995
  this.oldInputEmitValue = value;
923
996
  }
924
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXAutocompleteParentComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
925
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXAutocompleteParentComponent }); }
997
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXAutocompleteParentComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
998
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXAutocompleteParentComponent }); }
926
999
  }
927
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXAutocompleteParentComponent, decorators: [{
1000
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXAutocompleteParentComponent, decorators: [{
928
1001
  type: Injectable
929
1002
  }] });
930
1003
 
@@ -1100,34 +1173,50 @@ class AXDataSource {
1100
1173
  }
1101
1174
  }
1102
1175
  function convertArrayToDataSource(items, options = { key: 'id', pageSize: 100 }) {
1176
+ // Normalize primitives to objects so consumers (e.g., select/list) can rely on
1177
+ // value and text fields without triggering extra byKey lookups.
1178
+ const normalizedItems = items.map((candidate) => {
1179
+ const isObjectItem = candidate != null && typeof candidate === 'object';
1180
+ if (isObjectItem) {
1181
+ return candidate;
1182
+ }
1183
+ // For primitive values, create an object with both key and text
1184
+ return { [options.key]: candidate, text: String(candidate ?? '') };
1185
+ });
1103
1186
  const config = {
1104
1187
  key: options.key,
1105
1188
  pageSize: options.pageSize,
1106
1189
  load: async (e) => {
1107
- const result = e.filter ? handleSearch(items, e.filter) : items;
1190
+ const itemsForFilter = normalizedItems;
1191
+ const resultNormalized = e.filter
1192
+ ? applyDataSourceQuery(itemsForFilter, e.filter)
1193
+ : itemsForFilter;
1194
+ const result = resultNormalized;
1108
1195
  return {
1109
1196
  items: result.slice(e.skip, e.skip + e.take),
1110
- total: result.length,
1197
+ total: resultNormalized.length,
1111
1198
  };
1112
1199
  },
1113
- byKey: (v) => Promise.resolve(items.find((c) => {
1114
- return c[options.key] == v;
1115
- })),
1116
- };
1117
- const handleSearch = (items, filter) => {
1118
- if (!filter?.field || filter.value === undefined || filter.value === null) {
1119
- return items; // No filter applied
1120
- }
1121
- return items.filter((item) => {
1122
- const itemField = item[filter.field];
1123
- if (typeof itemField === 'string' && typeof filter.value === 'string') {
1124
- return itemField.toLowerCase().includes(filter.value.toLowerCase());
1125
- }
1126
- return false; // Return false if itemField isn't comparable
1127
- });
1200
+ byKey: async (v) =>
1201
+ // Search in the normalized list (supports primitive and object arrays)
1202
+ normalizedItems.find((record) => {
1203
+ return record[options.key] == v;
1204
+ }),
1128
1205
  };
1129
1206
  return new AXDataSource(config);
1130
1207
  }
1208
+ function applyDataSourceQuery(items, filter) {
1209
+ if (!filter?.field || filter.value === undefined || filter.value === null) {
1210
+ return items; // No filter applied
1211
+ }
1212
+ return items.filter((item) => {
1213
+ const itemField = item[filter.field];
1214
+ if (typeof itemField === 'string' && typeof filter.value === 'string') {
1215
+ return itemField.toLowerCase().includes(filter.value.toLowerCase());
1216
+ }
1217
+ return false; // Return false if itemField isn't comparable
1218
+ });
1219
+ }
1131
1220
 
1132
1221
  const AX_STYLE_COLOR_TYPES = [
1133
1222
  'primary',
@@ -1185,10 +1274,10 @@ class AXAutoFocusDirective {
1185
1274
  }, this.time);
1186
1275
  }
1187
1276
  }
1188
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXAutoFocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1189
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: AXAutoFocusDirective, isStandalone: true, selector: "[axAutoFocus]", inputs: { autoFocus: ["axAutoFocus", "autoFocus"], time: ["axAutoFocusTime", "time"] }, ngImport: i0 }); }
1277
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXAutoFocusDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1278
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.8", type: AXAutoFocusDirective, isStandalone: true, selector: "[axAutoFocus]", inputs: { autoFocus: ["axAutoFocus", "autoFocus"], time: ["axAutoFocusTime", "time"] }, ngImport: i0 }); }
1190
1279
  }
1191
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXAutoFocusDirective, decorators: [{
1280
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXAutoFocusDirective, decorators: [{
1192
1281
  type: Directive,
1193
1282
  args: [{ selector: '[axAutoFocus]' }]
1194
1283
  }], propDecorators: { autoFocus: [{
@@ -1235,10 +1324,10 @@ class AXHotkeysService {
1235
1324
  }
1236
1325
  });
1237
1326
  }
1238
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXHotkeysService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1239
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXHotkeysService }); }
1327
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXHotkeysService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1328
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXHotkeysService }); }
1240
1329
  }
1241
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXHotkeysService, decorators: [{
1330
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXHotkeysService, decorators: [{
1242
1331
  type: Injectable
1243
1332
  }] });
1244
1333
 
@@ -1298,10 +1387,10 @@ class AXHotkeyDirective {
1298
1387
  s.unsubscribe();
1299
1388
  });
1300
1389
  }
1301
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXHotkeyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1302
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: AXHotkeyDirective, isStandalone: true, selector: "[axHotkey]", inputs: { axHotkey: "axHotkey" }, ngImport: i0 }); }
1390
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXHotkeyDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1391
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.8", type: AXHotkeyDirective, isStandalone: true, selector: "[axHotkey]", inputs: { axHotkey: "axHotkey" }, ngImport: i0 }); }
1303
1392
  }
1304
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXHotkeyDirective, decorators: [{
1393
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXHotkeyDirective, decorators: [{
1305
1394
  type: Directive,
1306
1395
  args: [{ selector: '[axHotkey]' }]
1307
1396
  }], propDecorators: { axHotkey: [{
@@ -1348,10 +1437,10 @@ class AXInfiniteScrollerDirective {
1348
1437
  return this.scrollCallback();
1349
1438
  }));
1350
1439
  }
1351
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXInfiniteScrollerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1352
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: AXInfiniteScrollerDirective, isStandalone: true, selector: "[axInfiniteScroller]", inputs: { scrollCallback: "scrollCallback", immediateCallback: "immediateCallback", scrollPercent: "scrollPercent" }, ngImport: i0 }); }
1440
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXInfiniteScrollerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1441
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.8", type: AXInfiniteScrollerDirective, isStandalone: true, selector: "[axInfiniteScroller]", inputs: { scrollCallback: "scrollCallback", immediateCallback: "immediateCallback", scrollPercent: "scrollPercent" }, ngImport: i0 }); }
1353
1442
  }
1354
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXInfiniteScrollerDirective, decorators: [{
1443
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXInfiniteScrollerDirective, decorators: [{
1355
1444
  type: Directive,
1356
1445
  args: [{ selector: '[axInfiniteScroller]' }]
1357
1446
  }], propDecorators: { scrollCallback: [{
@@ -1390,20 +1479,20 @@ class AXResponsiveDirective {
1390
1479
  this._observer?.disconnect();
1391
1480
  this._observer?.unobserve(this._elementRef.nativeElement);
1392
1481
  }
1393
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXResponsiveDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1394
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: AXResponsiveDirective, isStandalone: true, selector: "[axResponsive]", ngImport: i0 }); }
1482
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXResponsiveDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1483
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.8", type: AXResponsiveDirective, isStandalone: true, selector: "[axResponsive]", ngImport: i0 }); }
1395
1484
  }
1396
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXResponsiveDirective, decorators: [{
1485
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXResponsiveDirective, decorators: [{
1397
1486
  type: Directive,
1398
1487
  args: [{ selector: '[axResponsive]' }]
1399
1488
  }], ctorParameters: () => [] });
1400
1489
 
1401
1490
  class AXCommonModule {
1402
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1403
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.3", ngImport: i0, type: AXCommonModule, imports: [AXResponsiveDirective, AXInfiniteScrollerDirective, AXAutoFocusDirective, AXHotkeyDirective], exports: [AXResponsiveDirective, AXInfiniteScrollerDirective, AXAutoFocusDirective, AXHotkeyDirective] }); }
1404
- static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXCommonModule, providers: [AXHotkeysService] }); }
1491
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCommonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1492
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.8", ngImport: i0, type: AXCommonModule, imports: [AXResponsiveDirective, AXInfiniteScrollerDirective, AXAutoFocusDirective, AXHotkeyDirective], exports: [AXResponsiveDirective, AXInfiniteScrollerDirective, AXAutoFocusDirective, AXHotkeyDirective] }); }
1493
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCommonModule, providers: [AXHotkeysService] }); }
1405
1494
  }
1406
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXCommonModule, decorators: [{
1495
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXCommonModule, decorators: [{
1407
1496
  type: NgModule,
1408
1497
  args: [{
1409
1498
  imports: [AXResponsiveDirective, AXInfiniteScrollerDirective, AXAutoFocusDirective, AXHotkeyDirective],
@@ -1436,10 +1525,10 @@ class MXColorComponent extends MXBaseComponent {
1436
1525
  }
1437
1526
 
1438
1527
  class MXLookableComponent {
1439
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXLookableComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1440
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXLookableComponent }); }
1528
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXLookableComponent, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1529
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXLookableComponent }); }
1441
1530
  }
1442
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXLookableComponent, decorators: [{
1531
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXLookableComponent, decorators: [{
1443
1532
  type: Injectable
1444
1533
  }] });
1445
1534
  class MXLookComponent extends MXBaseComponent {
@@ -1614,231 +1703,592 @@ class MXInputBaseValueComponent extends MXValueComponent {
1614
1703
  else
1615
1704
  super.focus();
1616
1705
  }
1617
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXInputBaseValueComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1618
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXInputBaseValueComponent }); }
1706
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXInputBaseValueComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1707
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXInputBaseValueComponent }); }
1619
1708
  }
1620
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXInputBaseValueComponent, decorators: [{
1709
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXInputBaseValueComponent, decorators: [{
1621
1710
  type: Injectable
1622
1711
  }] });
1623
1712
 
1713
+ /**
1714
+ * Service that manages selection state and caching for selection components
1715
+ */
1624
1716
  class MXSelectionBridgeService {
1625
1717
  constructor() {
1718
+ /** Array of currently selected items */
1626
1719
  this.selectedItems = [];
1720
+ /** Cache for normalized items keyed by their unique identifier */
1627
1721
  this.cacheList = {};
1628
1722
  }
1629
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXSelectionBridgeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1630
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXSelectionBridgeService }); }
1723
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXSelectionBridgeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
1724
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXSelectionBridgeService }); }
1631
1725
  }
1632
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXSelectionBridgeService, decorators: [{
1726
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXSelectionBridgeService, decorators: [{
1633
1727
  type: Injectable
1634
1728
  }] });
1729
+ /**
1730
+ * Injection token for the selection bridge service
1731
+ */
1635
1732
  const AX_SELECTION_DATA_TOKEN = new InjectionToken('AX_SELECTION_DATA_TOKEN');
1733
+ /**
1734
+ * Abstract base component for selection-based value components
1735
+ * Provides common functionality for components that support item selection
1736
+ */
1636
1737
  class MXSelectionValueComponent extends MXValueComponent {
1637
1738
  constructor() {
1638
1739
  super(...arguments);
1740
+ // #region Services
1639
1741
  this.formatService = inject(AXFormatService);
1640
1742
  this.dataService = inject(AX_SELECTION_DATA_TOKEN);
1743
+ // #region Field Configuration Properties
1641
1744
  this._valueField = 'id';
1642
- this._textTemplate = '';
1643
1745
  this._textField = 'text';
1746
+ this._textTemplate = '';
1747
+ this._defaultText = '-';
1644
1748
  this._disabledField = 'disabled';
1645
1749
  this._multiple = false;
1750
+ // #endregion
1751
+ // #region Events
1752
+ this.onItemSelected = new EventEmitter();
1753
+ /**
1754
+ * Emitted when an item in the list is clicked.
1755
+ *
1756
+ * @event
1757
+ */
1758
+ this.onItemClick = new EventEmitter();
1646
1759
  }
1760
+ /** Field name used to extract the unique value from items */
1647
1761
  get valueField() {
1648
1762
  return this._valueField;
1649
1763
  }
1650
- set valueField(v) {
1651
- this.setOption({
1652
- name: 'valueField',
1653
- value: v,
1654
- });
1764
+ set valueField(value) {
1765
+ this.setOption({ name: 'valueField', value });
1766
+ }
1767
+ /** Field name used to extract the display text from items */
1768
+ get textField() {
1769
+ return this._textField;
1655
1770
  }
1771
+ set textField(value) {
1772
+ this.setOption({ name: 'textField', value });
1773
+ }
1774
+ /** Template string for formatting item display text */
1656
1775
  get textTemplate() {
1657
1776
  return this._textTemplate;
1658
1777
  }
1659
- set textTemplate(v) {
1660
- this.setOption({
1661
- name: 'textTemplate',
1662
- value: v,
1663
- });
1778
+ set textTemplate(value) {
1779
+ this.setOption({ name: 'textTemplate', value });
1664
1780
  }
1665
- get textField() {
1666
- return this._textField;
1781
+ /** Text to display when neither textField nor valueField exist on the item */
1782
+ get defaultText() {
1783
+ return this._defaultText;
1667
1784
  }
1668
- set textField(v) {
1669
- this.setOption({
1670
- name: 'textField',
1671
- value: v,
1672
- });
1785
+ set defaultText(value) {
1786
+ this.setOption({ name: 'defaultText', value });
1673
1787
  }
1788
+ /** Field name used to determine if an item is disabled */
1674
1789
  get disabledField() {
1675
1790
  return this._disabledField;
1676
1791
  }
1677
- set disabledField(v) {
1678
- this.setOption({
1679
- name: 'disabledField',
1680
- value: v,
1681
- });
1792
+ set disabledField(value) {
1793
+ this.setOption({ name: 'disabledField', value });
1682
1794
  }
1795
+ /** Whether multiple items can be selected */
1683
1796
  get multiple() {
1684
1797
  return this._multiple;
1685
1798
  }
1686
- set multiple(v) {
1799
+ set multiple(value) {
1687
1800
  this.setOption({
1688
1801
  name: 'multiple',
1689
- value: v,
1690
- afterCallback: () => {
1691
- this.reset(false);
1692
- },
1802
+ value,
1803
+ afterCallback: () => this.reset(false),
1693
1804
  });
1694
1805
  }
1806
+ // #endregion
1807
+ // #region Computed Properties
1808
+ /** Gets the currently selected items */
1695
1809
  get selectedItems() {
1696
1810
  return this.dataService.selectedItems || [];
1697
1811
  }
1812
+ // #endregion
1813
+ // #region Override Methods
1814
+ /**
1815
+ * Internal method to set and normalize the component value
1816
+ * @param value The value to set (can be single item or array)
1817
+ * @returns Normalized value based on multiple selection mode
1818
+ */
1698
1819
  internalSetValue(value) {
1699
1820
  const isArray = Array.isArray(value);
1700
- if (value == null || (isArray && value.length == 0)) {
1821
+ // Handle null/empty values
1822
+ if (value == null || (isArray && value.length === 0)) {
1701
1823
  return this.multiple ? [] : null;
1702
1824
  }
1703
- const normalizedItems = isArray ? this.normalizeItemsList(value, true) : this.normalizeItemsList([value], true);
1704
- if (normalizedItems.length == 0) {
1825
+ // Check if items already have text properties to avoid unnecessary findByKey calls
1826
+ const itemsToNormalize = isArray ? value : [value];
1827
+ const needsFindByKey = itemsToNormalize.some(item => {
1828
+ if (typeof item === 'object' && item !== null) {
1829
+ return get(item, this.textField) == null;
1830
+ }
1831
+ return true; // Primitive values need findByKey
1832
+ });
1833
+ const normalizedItems = this.normalizeItemsList(itemsToNormalize, needsFindByKey);
1834
+ if (normalizedItems.length === 0) {
1705
1835
  return this.multiple ? [] : null;
1706
1836
  }
1707
- const result = this.multiple ? normalizedItems.map((c) => c[this.valueField]) : normalizedItems[0][this.valueField];
1708
- return result;
1837
+ // Extract values based on selection mode
1838
+ return this.multiple
1839
+ ? normalizedItems.map(item => get(item, this.valueField))
1840
+ : get(normalizedItems[0], this.valueField) ?? null;
1709
1841
  }
1842
+ /**
1843
+ * Override to normalize selected items when value changes
1844
+ */
1710
1845
  emitOnValueChangedEvent(oldValue, newValue) {
1711
1846
  this._normalizeSelectedItems();
1712
1847
  super.emitOnValueChangedEvent(oldValue, newValue);
1713
1848
  }
1714
- normalizeItemsList(items, findBykey = false) {
1715
- if (items == null)
1849
+ // #endregion
1850
+ // #region Private Normalization Methods
1851
+ /**
1852
+ * Normalizes a list of items, filtering out null values
1853
+ * @param items Array of items to normalize
1854
+ * @param findByKey Whether to attempt finding items by key
1855
+ * @returns Array of normalized items
1856
+ */
1857
+ normalizeItemsList(items, findByKey = false) {
1858
+ if (!items?.length)
1716
1859
  return [];
1717
- return items.filter((c) => c != null).map((i) => this.normalizeItem(i, findBykey));
1860
+ return items
1861
+ .filter(item => item != null)
1862
+ .map(item => this.normalizeItem(item, findByKey));
1718
1863
  }
1719
- normalizeItem(item, findBykey = false) {
1720
- const complex = typeof item == 'object';
1721
- const key = complex ? item[this.valueField] : `${item}`;
1722
- const cacheKey = `k-${key}`;
1723
- const hasText = !complex || item[this.textField] != null;
1724
- //
1725
- if (this.dataService.cacheList[cacheKey] && this.dataService.cacheList[cacheKey][this.textField])
1726
- return this.dataService.cacheList[cacheKey];
1727
- //
1728
- const obj = {};
1729
- if (complex && hasText) {
1730
- Object.assign(obj, item);
1864
+ /**
1865
+ * Normalizes a single item, handling caching and async loading
1866
+ * @param item Item to normalize
1867
+ * @param findByKey Whether to attempt finding the item by key
1868
+ * @returns Normalized item object
1869
+ */
1870
+ normalizeItem(item, findByKey = false) {
1871
+ const isComplexObject = typeof item === 'object' && item !== null;
1872
+ const itemRecord = item;
1873
+ const valueKey = isComplexObject ? get(itemRecord, this.valueField) : item;
1874
+ const key = valueKey != null ? String(valueKey) : String(item);
1875
+ const cacheKey = this.createCacheKey(key);
1876
+ // Return cached item if available and has text
1877
+ const cachedItem = this.dataService.cacheList[cacheKey];
1878
+ if (cachedItem && get(cachedItem, this.textField) != null) {
1879
+ return cachedItem;
1880
+ }
1881
+ const hasTextProperty = !isComplexObject || get(itemRecord, this.textField) != null;
1882
+ const normalizedObj = {};
1883
+ // If findByKey is true, we need to resolve the item to get its text
1884
+ // This is needed for string values like 'ir', 'us' that don't have text
1885
+ if (findByKey) {
1886
+ this.handleItemNormalization(normalizedObj, item, key, true, cacheKey);
1731
1887
  }
1732
1888
  else {
1733
- const existsItem = findBykey ? this.getItemByKey(key) : null;
1734
- if (existsItem && existsItem instanceof Promise) {
1735
- obj[this.valueField] = key;
1736
- obj['isLoading'] = true;
1737
- obj[this.textField] = 'Loading';
1738
- //
1739
- existsItem
1740
- .then((r) => {
1741
- if (typeof r === 'object' && r) {
1742
- // obj[this.valueField] = r[this.valueField];
1743
- // obj[this.textField] = r[this.textField];
1744
- Object.assign(obj, cloneDeep(r));
1745
- }
1746
- else {
1747
- obj[this.valueField] = r || key;
1748
- obj[this.textField] = r;
1749
- }
1750
- })
1751
- .finally(() => {
1752
- delete obj['isLoading'];
1753
- this.dataService.cacheList[cacheKey] = obj;
1754
- this.cdr.markForCheck();
1755
- });
1756
- }
1757
- else if (existsItem) {
1758
- obj[this.valueField] = complex ? existsItem[this.valueField] : existsItem;
1759
- obj[this.textField] = complex ? existsItem[this.textField] : existsItem;
1889
+ // Item already has all required properties, just copy them
1890
+ Object.assign(normalizedObj, item);
1891
+ }
1892
+ this.dataService.cacheList[cacheKey] = normalizedObj;
1893
+ return normalizedObj;
1894
+ }
1895
+ /**
1896
+ * Handles the normalization logic for items that need property assignment
1897
+ */
1898
+ handleItemNormalization(normalizedObj, originalItem, key, findByKey, cacheKey) {
1899
+ const existingItem = findByKey ? this.getItemByKey(key) : null;
1900
+ if (existingItem instanceof Promise) {
1901
+ this.handleAsyncItem(normalizedObj, key, existingItem, cacheKey);
1902
+ }
1903
+ else if (existingItem) {
1904
+ this.assignItemProperties(normalizedObj, existingItem, true);
1905
+ }
1906
+ else {
1907
+ this.assignItemProperties(normalizedObj, originalItem, false);
1908
+ }
1909
+ }
1910
+ /**
1911
+ * Handles async item loading with loading state
1912
+ */
1913
+ handleAsyncItem(obj, key, promise, cacheKey) {
1914
+ // Set loading state
1915
+ obj[this.valueField] = key;
1916
+ obj['isLoading'] = true;
1917
+ obj[this.textField] = 'Loading...';
1918
+ promise
1919
+ .then(result => {
1920
+ if (typeof result === 'object' && result) {
1921
+ Object.assign(obj, cloneDeep(result));
1760
1922
  }
1761
1923
  else {
1762
- obj[this.valueField] = complex ? item[this.valueField] : item;
1763
- obj[this.textField] = complex ? item[this.textField] : item;
1924
+ obj[this.valueField] = result || key;
1925
+ obj[this.textField] = result;
1764
1926
  }
1927
+ })
1928
+ .catch(error => {
1929
+ console.warn('Failed to load item by key:', key, error);
1930
+ // On error, keep the original value but mark as failed
1931
+ obj[this.textField] = this.defaultText;
1932
+ })
1933
+ .finally(() => {
1934
+ delete obj['isLoading'];
1935
+ delete obj['_displayTextLoading'];
1936
+ delete obj['_loadingTriggered'];
1937
+ this.dataService.cacheList[cacheKey] = obj;
1938
+ // Use setTimeout to defer change detection and prevent immediate re-rendering
1939
+ setTimeout(() => {
1940
+ if (this.cdr) {
1941
+ this.cdr.markForCheck();
1942
+ }
1943
+ }, 0);
1944
+ });
1945
+ }
1946
+ /**
1947
+ * Assigns value and text properties to the normalized object
1948
+ */
1949
+ assignItemProperties(obj, sourceItem, isComplexSource) {
1950
+ const isSourceObject = typeof sourceItem === 'object' && sourceItem !== null;
1951
+ const sourceRecord = sourceItem;
1952
+ if (isComplexSource && isSourceObject) {
1953
+ const valueFromSource = get(sourceRecord, this.valueField);
1954
+ const textFromSource = get(sourceRecord, this.textField);
1955
+ obj[this.valueField] = (valueFromSource ?? textFromSource);
1956
+ obj[this.textField] = (textFromSource ?? valueFromSource ?? this.defaultText);
1957
+ }
1958
+ else {
1959
+ const valueFromSource = isSourceObject ? get(sourceRecord, this.valueField) : sourceItem;
1960
+ const textFromSource = isSourceObject ? get(sourceRecord, this.textField) : sourceItem;
1961
+ obj[this.valueField] = (valueFromSource ?? textFromSource);
1962
+ obj[this.textField] = (textFromSource ?? valueFromSource ?? this.defaultText);
1765
1963
  }
1766
- this.dataService.cacheList[cacheKey] = obj;
1767
- return obj;
1768
1964
  }
1965
+ /**
1966
+ * Creates a consistent cache key for an item
1967
+ */
1968
+ createCacheKey(key) {
1969
+ return `k-${key}`;
1970
+ }
1971
+ /**
1972
+ * Normalizes currently selected items and updates the data service
1973
+ */
1769
1974
  _normalizeSelectedItems() {
1770
- const values = Array.isArray(this.value) ? this.value : this.value != null ? [this.value] : [];
1771
- this.dataService.selectedItems = values.map((v) => this.normalizeItem(v));
1975
+ const values = Array.isArray(this.value)
1976
+ ? this.value
1977
+ : this.value != null ? [this.value] : [];
1978
+ // Only call normalizeItem with findByKey=true if the item doesn't have text
1979
+ // This prevents unnecessary API calls for items that already have text
1980
+ this.dataService.selectedItems = values.map(value => {
1981
+ const hasText = typeof value === 'object' && value !== null &&
1982
+ get(value, this.textField) != null;
1983
+ return this.normalizeItem(value, !hasText);
1984
+ });
1772
1985
  }
1986
+ // #endregion
1987
+ // #region Public Selection Methods
1988
+ /**
1989
+ * Unselects the specified items from the selection
1990
+ * @param items Items to unselect
1991
+ */
1773
1992
  unselectItems(...items) {
1774
- if (!items || items.length === 0) {
1993
+ if (!items?.length) {
1775
1994
  this.commitValue([], true);
1776
1995
  return;
1777
1996
  }
1778
- const normalizeItems = Array.isArray(items) ? this.normalizeItemsList(items) : [this.normalizeItem(items)];
1779
- const newSelectedItems = this.selectedItems.filter((i) => !normalizeItems.some((n) => n[this.valueField] == i[this.valueField]));
1997
+ const normalizedItems = this.normalizeItemsList(items);
1998
+ const newSelectedItems = this.selectedItems.filter(selectedItem => !normalizedItems.some(normalizedItem => get(normalizedItem, this.valueField) === get(selectedItem, this.valueField)));
1780
1999
  this.commitValue(newSelectedItems, true);
1781
2000
  }
2001
+ /**
2002
+ * Selects the specified items
2003
+ * @param items Items to select
2004
+ */
1782
2005
  selectItems(...items) {
1783
- if (items && items.length) {
1784
- let newSelectedItems = Array.isArray(this.value) ? this.value : [this.value];
1785
- const normalizeItems = Array.isArray(items) ? this.normalizeItemsList(items) : [this.normalizeItem(items)];
1786
- if (this.multiple) {
1787
- newSelectedItems = [...newSelectedItems, ...normalizeItems];
1788
- }
1789
- else {
1790
- newSelectedItems = normalizeItems;
1791
- }
1792
- this.commitValue(newSelectedItems, true);
2006
+ if (!items?.length) {
2007
+ return;
1793
2008
  }
2009
+ const currentValue = Array.isArray(this.value) ? this.value : [this.value];
2010
+ const normalizedItems = this.normalizeItemsList(items);
2011
+ const newSelectedItems = this.multiple
2012
+ ? [...currentValue, ...normalizedItems]
2013
+ : normalizedItems;
2014
+ this.onItemSelected.emit({
2015
+ component: this,
2016
+ isUserInteraction: true,
2017
+ item: newSelectedItems[0],
2018
+ htmlElement: this.getHostElement()
2019
+ });
2020
+ this.commitValue(newSelectedItems, true);
1794
2021
  }
2022
+ /**
2023
+ * Toggles the selection state of the specified items
2024
+ * @param items Items to toggle
2025
+ */
1795
2026
  toggleSelect(...items) {
1796
- items?.forEach((item) => {
2027
+ items?.forEach(item => {
1797
2028
  if (this.multiple) {
1798
- this.isItemSelected(item) ? this.unselectItems(item) : this.selectItems(item);
2029
+ this.isItemSelected(item)
2030
+ ? this.unselectItems(item)
2031
+ : this.selectItems(item);
1799
2032
  }
1800
2033
  else {
1801
2034
  this.selectItems(item);
1802
2035
  }
1803
2036
  });
1804
2037
  }
2038
+ // #endregion
2039
+ // #region Public Utility Methods
2040
+ /**
2041
+ * Checks if an item is currently selected
2042
+ * @param item Item to check
2043
+ * @returns True if the item is selected
2044
+ */
1805
2045
  isItemSelected(item) {
1806
- return this.selectedItems.some((c) => c[this.valueField] === this.normalizeItem(item)[this.valueField]);
2046
+ const normalizedItem = this.normalizeItem(item);
2047
+ const normalizedValue = get(normalizedItem, this.valueField);
2048
+ return this.selectedItems.some(selectedItem => get(selectedItem, this.valueField) === normalizedValue);
1807
2049
  }
2050
+ /**
2051
+ * Checks if an item is disabled
2052
+ * @param item Item to check
2053
+ * @returns True if the item is disabled
2054
+ */
1808
2055
  isItemDisabled(item) {
2056
+ const itemRecord = item;
1809
2057
  return (this.disabled ||
1810
- coerceBooleanProperty(item[this.disabledField]) === true ||
1811
- (this.disabledCallback ? this.disabledCallback({ item, index: -1 }) : false));
2058
+ coerceBooleanProperty(get(itemRecord, this.disabledField)) === true ||
2059
+ (this.disabledCallback?.({ item, index: -1 }) ?? false));
1812
2060
  }
1813
- // protected getDisplayText(item: T) {
1814
- // const normalizeItem = this.normalizeItem(item) as any;
1815
- // return formattedText || normalizeItem[this.valueField];
1816
- // }
2061
+ /**
2062
+ * Checks if an item is currently loading
2063
+ * @param item Item to check
2064
+ * @returns True if the item is loading
2065
+ */
2066
+ isItemLoading(item) {
2067
+ const normalizedItem = this.normalizeItem(item);
2068
+ return normalizedItem['isLoading'] === true;
2069
+ }
2070
+ // #endregion
2071
+ // #region Protected Utility Methods
2072
+ /**
2073
+ * Gets the display text for an item using template or text field
2074
+ * @param item Item to get display text for
2075
+ * @returns Formatted display text
2076
+ */
1817
2077
  getDisplayText(item) {
1818
- const normalizeItem = this.normalizeItem(item);
1819
- const formattedTemplate = this.formatService.format(this.textTemplate, 'string', normalizeItem);
1820
- if (this.textTemplate && formattedTemplate != this.textTemplate)
1821
- return formattedTemplate;
1822
- else
1823
- return normalizeItem[this.textField] || normalizeItem[this.valueField];
2078
+ // Prevent recursive calls that could cause infinite loops
2079
+ if (item && typeof item === 'object' && item['_displayTextLoading']) {
2080
+ return 'Loading...';
2081
+ }
2082
+ // Add timestamp-based debouncing to prevent excessive calls for ALL item types
2083
+ const now = Date.now();
2084
+ const itemKey = typeof item === 'string' ? item : get(item, this.valueField);
2085
+ const cacheKey = this.createCacheKey(String(itemKey));
2086
+ // Check if we have a recent result in the cache to prevent duplicate processing
2087
+ const cachedResult = this.dataService.cacheList[cacheKey];
2088
+ if (cachedResult && cachedResult['_lastDisplayTextCall']) {
2089
+ const timeSinceLastCall = now - cachedResult['_lastDisplayTextCall'];
2090
+ if (timeSinceLastCall < 50) { // 50ms debounce
2091
+ return cachedResult['_lastDisplayTextResult'] || String(itemKey || '');
2092
+ }
2093
+ }
2094
+ // For string values, we need to normalize with findByKey=true to trigger async loading
2095
+ const isStringValue = typeof item === 'string';
2096
+ const normalizedItem = this.normalizeItem(item, isStringValue);
2097
+ // Check if this item is already in the cache with proper text
2098
+ const itemValue = get(normalizedItem, this.valueField);
2099
+ if (itemValue != null && itemValue !== '') {
2100
+ const cacheKey = this.createCacheKey(String(itemValue));
2101
+ const cachedItem = this.dataService.cacheList[cacheKey];
2102
+ if (cachedItem && get(cachedItem, this.textField) != null) {
2103
+ // Use cached text if available
2104
+ const cachedText = get(cachedItem, this.textField);
2105
+ if (cachedText && cachedText !== 'Loading...') {
2106
+ const result = String(cachedText);
2107
+ // Cache the timestamp and result for debouncing in the cache (works for all item types)
2108
+ if (cachedItem) {
2109
+ cachedItem['_lastDisplayTextCall'] = now;
2110
+ cachedItem['_lastDisplayTextResult'] = result;
2111
+ }
2112
+ return result;
2113
+ }
2114
+ }
2115
+ }
2116
+ // Try template formatting first
2117
+ if (this.textTemplate) {
2118
+ const formattedTemplate = this.formatService.format(this.textTemplate, 'string', normalizedItem);
2119
+ if (formattedTemplate !== this.textTemplate) {
2120
+ const result = formattedTemplate;
2121
+ // Cache the timestamp and result for debouncing in the cache
2122
+ if (normalizedItem) {
2123
+ normalizedItem['_lastDisplayTextCall'] = now;
2124
+ normalizedItem['_lastDisplayTextResult'] = result;
2125
+ }
2126
+ return result;
2127
+ }
2128
+ }
2129
+ // Use text field or fallback to value field
2130
+ const textValue = get(normalizedItem, this.textField);
2131
+ if (textValue != null && textValue !== '') {
2132
+ const result = String(textValue);
2133
+ // Cache the timestamp and result for debouncing in the cache
2134
+ if (normalizedItem) {
2135
+ normalizedItem['_lastDisplayTextCall'] = now;
2136
+ normalizedItem['_lastDisplayTextResult'] = result;
2137
+ }
2138
+ return result;
2139
+ }
2140
+ // If text is missing and item is loading, show loading state
2141
+ if (normalizedItem['isLoading']) {
2142
+ const result = 'Loading...';
2143
+ // Cache the timestamp and result for debouncing in the cache
2144
+ if (normalizedItem) {
2145
+ normalizedItem['_lastDisplayTextCall'] = now;
2146
+ normalizedItem['_lastDisplayTextResult'] = result;
2147
+ }
2148
+ return result;
2149
+ }
2150
+ // Attempt to load item by key if text is missing
2151
+ const value = get(normalizedItem, this.valueField);
2152
+ if (value == null || value === '') {
2153
+ const result = this.defaultText;
2154
+ // Cache the timestamp and result for debouncing in the cache
2155
+ if (normalizedItem) {
2156
+ normalizedItem['_lastDisplayTextCall'] = now;
2157
+ normalizedItem['_lastDisplayTextResult'] = result;
2158
+ }
2159
+ return result;
2160
+ }
2161
+ // If we have a value but no text, trigger async loading only once
2162
+ // Use a flag to prevent multiple calls
2163
+ if (!normalizedItem['_loadingTriggered'] && !normalizedItem[this.textField]) {
2164
+ normalizedItem['_loadingTriggered'] = true;
2165
+ normalizedItem['_displayTextLoading'] = true;
2166
+ // Use setTimeout to defer the async loading and prevent immediate change detection
2167
+ setTimeout(() => {
2168
+ this.loadAndCacheItemByKey(value);
2169
+ }, 0);
2170
+ }
2171
+ // Return the value itself as a fallback
2172
+ // This will be updated once the async loading completes
2173
+ const result = String(value);
2174
+ // Cache the timestamp and result for debouncing in the cache
2175
+ if (normalizedItem) {
2176
+ normalizedItem['_lastDisplayTextCall'] = now;
2177
+ normalizedItem['_lastDisplayTextResult'] = result;
2178
+ }
2179
+ return result;
1824
2180
  }
2181
+ /**
2182
+ * Gets the value of an item
2183
+ * @param item Item to get value from
2184
+ * @returns Item value
2185
+ */
1825
2186
  getValue(item) {
1826
- const normalizeItem = this.normalizeItem(item);
1827
- return normalizeItem[this.valueField];
2187
+ const normalizedItem = this.normalizeItem(item);
2188
+ return get(normalizedItem, this.valueField);
1828
2189
  }
2190
+ /**
2191
+ * Clears the selection cache and selected items
2192
+ */
1829
2193
  clearSelectionCache() {
1830
2194
  this.dataService.cacheList = {};
1831
2195
  this.dataService.selectedItems = [];
1832
2196
  this.cdr.markForCheck();
1833
2197
  }
2198
+ /**
2199
+ * Clears only the cache while preserving selected items
2200
+ */
1834
2201
  softClearSelectionCache() {
1835
2202
  this.dataService.cacheList = {};
1836
2203
  this.cdr.markForCheck();
1837
2204
  }
1838
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXSelectionValueComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
1839
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXSelectionValueComponent }); }
2205
+ /**
2206
+ * Clears the debouncing cache for specific items to ensure fresh data is displayed
2207
+ */
2208
+ clearItemDebouncingCache(item) {
2209
+ // Get the cache key for this item
2210
+ const itemKey = typeof item === 'string' ? item : get(item, this.valueField);
2211
+ if (itemKey != null) {
2212
+ const cacheKey = this.createCacheKey(String(itemKey));
2213
+ const cachedItem = this.dataService.cacheList[cacheKey];
2214
+ if (cachedItem) {
2215
+ delete cachedItem['_lastDisplayTextCall'];
2216
+ delete cachedItem['_lastDisplayTextResult'];
2217
+ delete cachedItem['_displayTextLoading'];
2218
+ delete cachedItem['_loadingTriggered'];
2219
+ }
2220
+ }
2221
+ }
2222
+ /**
2223
+ * Forces a refresh of the display when items are loaded asynchronously
2224
+ * This should be called when the data source is updated
2225
+ */
2226
+ refreshDisplay() {
2227
+ this.cdr.markForCheck();
2228
+ }
2229
+ /**
2230
+ * Refreshes the display for all selected items to ensure consistency
2231
+ * This is useful when the data source has been updated
2232
+ */
2233
+ refreshSelectedItemsDisplay() {
2234
+ // Force a refresh of the display without re-normalizing to avoid infinite loops
2235
+ if (this.selectedItems.length > 0) {
2236
+ this.cdr.markForCheck();
2237
+ }
2238
+ }
2239
+ /**
2240
+ * Forces a refresh of all selected items by clearing their debouncing cache
2241
+ * This ensures fresh data is displayed when the data source is updated
2242
+ */
2243
+ forceRefreshSelectedItems() {
2244
+ if (this.selectedItems.length > 0) {
2245
+ this.selectedItems.forEach(item => {
2246
+ this.clearItemDebouncingCache(item);
2247
+ });
2248
+ this.cdr.markForCheck();
2249
+ }
2250
+ }
2251
+ // #endregion
2252
+ // #region Private Helper Methods
2253
+ /**
2254
+ * Asynchronously loads an item by its key and caches the result
2255
+ * @param key Key to load item by
2256
+ */
2257
+ async loadAndCacheItemByKey(key) {
2258
+ try {
2259
+ const item = await this.getItemByKey(key);
2260
+ if (item) {
2261
+ const normalizedItem = this.normalizeItem(item);
2262
+ const cacheKey = this.createCacheKey(String(normalizedItem[this.valueField]));
2263
+ // Update the cache with the loaded item
2264
+ this.dataService.cacheList[cacheKey] = normalizedItem;
2265
+ // Clear loading flags
2266
+ if (this.dataService.cacheList[cacheKey]) {
2267
+ delete this.dataService.cacheList[cacheKey]['_displayTextLoading'];
2268
+ delete this.dataService.cacheList[cacheKey]['_loadingTriggered'];
2269
+ }
2270
+ // Use setTimeout to defer change detection and prevent immediate re-rendering
2271
+ setTimeout(() => {
2272
+ if (this.cdr) {
2273
+ this.cdr.markForCheck();
2274
+ }
2275
+ }, 0);
2276
+ }
2277
+ }
2278
+ catch (error) {
2279
+ console.warn('Failed to load item by key:', key, error);
2280
+ // Clear loading flags on error too
2281
+ const cacheKey = this.createCacheKey(String(key));
2282
+ if (this.dataService.cacheList[cacheKey]) {
2283
+ delete this.dataService.cacheList[cacheKey]['_displayTextLoading'];
2284
+ delete this.dataService.cacheList[cacheKey]['_loadingTriggered'];
2285
+ }
2286
+ }
2287
+ }
2288
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXSelectionValueComponent, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
2289
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXSelectionValueComponent }); }
1840
2290
  }
1841
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: MXSelectionValueComponent, decorators: [{
2291
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: MXSelectionValueComponent, decorators: [{
1842
2292
  type: Injectable
1843
2293
  }] });
1844
2294
 
@@ -1871,10 +2321,10 @@ class AXNgModelDelayedValueChangedDirective {
1871
2321
  distinctUntilChanged(), debounceTime(this.delayTime))
1872
2322
  .subscribe((value) => this.axDelayedValueChanged.emit(value));
1873
2323
  }
1874
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXNgModelDelayedValueChangedDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1875
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: AXNgModelDelayedValueChangedDirective, isStandalone: true, selector: "[axDelayedValueChanged]", inputs: { delayTime: "delayTime" }, outputs: { axDelayedValueChanged: "axDelayedValueChanged", axDelayTimeChange: "axDelayTimeChange" }, ngImport: i0 }); }
2324
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXNgModelDelayedValueChangedDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2325
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.8", type: AXNgModelDelayedValueChangedDirective, isStandalone: true, selector: "[axDelayedValueChanged]", inputs: { delayTime: "delayTime" }, outputs: { axDelayedValueChanged: "axDelayedValueChanged", axDelayTimeChange: "axDelayTimeChange" }, ngImport: i0 }); }
1876
2326
  }
1877
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXNgModelDelayedValueChangedDirective, decorators: [{
2327
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXNgModelDelayedValueChangedDirective, decorators: [{
1878
2328
  type: Directive,
1879
2329
  args: [{
1880
2330
  selector: '[axDelayedValueChanged]',
@@ -1925,10 +2375,10 @@ class AXInvertedColorDirective {
1925
2375
  });
1926
2376
  }
1927
2377
  }
1928
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXInvertedColorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1929
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.1.3", type: AXInvertedColorDirective, isStandalone: true, selector: "[axInvertedColor]", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
2378
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXInvertedColorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2379
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.1.8", type: AXInvertedColorDirective, isStandalone: true, selector: "[axInvertedColor]", inputs: { color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 }); }
1930
2380
  }
1931
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXInvertedColorDirective, decorators: [{
2381
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXInvertedColorDirective, decorators: [{
1932
2382
  type: Directive,
1933
2383
  args: [{
1934
2384
  selector: '[axInvertedColor]',
@@ -1981,10 +2431,10 @@ class AXRippleDirective {
1981
2431
  });
1982
2432
  }
1983
2433
  }
1984
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXRippleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
1985
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.3", type: AXRippleDirective, isStandalone: true, selector: "[axRipple]", inputs: { enabled: ["axRipple", "enabled"], axRippleColor: "axRippleColor" }, ngImport: i0 }); }
2434
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXRippleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2435
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.8", type: AXRippleDirective, isStandalone: true, selector: "[axRipple]", inputs: { enabled: ["axRipple", "enabled"], axRippleColor: "axRippleColor" }, ngImport: i0 }); }
1986
2436
  }
1987
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXRippleDirective, decorators: [{
2437
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.8", ngImport: i0, type: AXRippleDirective, decorators: [{
1988
2438
  type: Directive,
1989
2439
  args: [{
1990
2440
  selector: '[axRipple]',
@@ -2000,5 +2450,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
2000
2450
  * Generated bundle index. Do not edit.
2001
2451
  */
2002
2452
 
2003
- export { AXAutoFocusDirective, AXAutocompleteParentComponent, AXButtonClickEvent, AXClearableComponent, AXClickEvent, AXClosableComponent, AXCommonModule, AXComponent, AXComponentCloseEvent, AXComponentClosedPromise, AXComponentClosing, AXComponentResult, AXDataSource, AXDomService, AXEvent, AXFocusEvent, AXFocusableComponent, AXHotkeyDirective, AXHotkeysService, AXHtmlEvent, AXInfiniteScrollerDirective, AXInvertedColorDirective, AXItemClickEvent, AXListDataSource, AXNgModelDelayedValueChangedDirective, AXOptionChangedEvent, AXPagedComponent, AXRangeChangedEvent, AXResponsiveDirective, AXRippleDirective, AXSearchableComponent, AXSelectionValueChangedEvent, AXValuableComponent, AXValueChangedEvent, AX_LOCATIONS, AX_PLACEMENT_BOTTOM, AX_PLACEMENT_BOTTOM_END, AX_PLACEMENT_BOTTOM_START, AX_PLACEMENT_END, AX_PLACEMENT_END_BOTTOM, AX_PLACEMENT_END_TOP, AX_PLACEMENT_MAP, AX_PLACEMENT_START, AX_PLACEMENT_START_BOTTOM, AX_PLACEMENT_START_TOP, AX_PLACEMENT_TOP, AX_PLACEMENT_TOP_END, AX_PLACEMENT_TOP_START, AX_SELECTION_DATA_TOKEN, AX_STYLE_COLOR_TYPES, AX_STYLE_LOOK_TYPES, MXBaseComponent, MXButtonBaseComponent, MXColorComponent, MXColorLookComponent, MXInputBaseValueComponent, MXInteractiveComponent, MXLookComponent, MXLookableComponent, MXSelectionBridgeService, MXSelectionValueComponent, MXValueComponent, NXButtonComponent, NXClickEvent, NXColorComponent, NXComponent, NXEvent, NXInteractiveComponent, NXLookComponent, NXNativeEvent, NXValueComponent, TAB_META_KEY, convertArrayToDataSource, convertToPlacement };
2453
+ export { AXAutoFocusDirective, AXAutocompleteParentComponent, AXButtonClickEvent, AXClearableComponent, AXClickEvent, AXClosableComponent, AXCommonModule, AXComponent, AXComponentCloseEvent, AXComponentClosedPromise, AXComponentClosing, AXComponentResult, AXDataSource, AXDomService, AXEvent, AXFocusEvent, AXFocusableComponent, AXHotkeyDirective, AXHotkeysService, AXHtmlEvent, AXInfiniteScrollerDirective, AXInvertedColorDirective, AXItemClickEvent, AXItemSelectedEvent, AXListDataSource, AXNgModelDelayedValueChangedDirective, AXOptionChangedEvent, AXPagedComponent, AXRangeChangedEvent, AXResponsiveDirective, AXRippleDirective, AXSearchableComponent, AXSelectionValueChangedEvent, AXValuableComponent, AXValueChangedEvent, AX_LOCATIONS, AX_PLACEMENT_BOTTOM, AX_PLACEMENT_BOTTOM_END, AX_PLACEMENT_BOTTOM_START, AX_PLACEMENT_END, AX_PLACEMENT_END_BOTTOM, AX_PLACEMENT_END_TOP, AX_PLACEMENT_MAP, AX_PLACEMENT_START, AX_PLACEMENT_START_BOTTOM, AX_PLACEMENT_START_TOP, AX_PLACEMENT_TOP, AX_PLACEMENT_TOP_END, AX_PLACEMENT_TOP_START, AX_SELECTION_DATA_TOKEN, AX_STYLE_COLOR_TYPES, AX_STYLE_LOOK_TYPES, MXBaseComponent, MXButtonBaseComponent, MXColorComponent, MXColorLookComponent, MXInputBaseValueComponent, MXInteractiveComponent, MXLookComponent, MXLookableComponent, MXSelectionBridgeService, MXSelectionValueComponent, MXValueComponent, NXButtonComponent, NXClickEvent, NXColorComponent, NXComponent, NXEvent, NXInteractiveComponent, NXLookComponent, NXNativeEvent, NXValueComponent, TAB_META_KEY, applyDataSourceQuery, convertArrayToDataSource, convertToPlacement };
2004
2454
  //# sourceMappingURL=acorex-cdk-common.mjs.map