@acorex/platform 20.2.0-next.1 → 20.2.0-next.2

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.
@@ -639,18 +639,29 @@ class AXPColorChooserWidgetEditComponent extends AXPValueWidgetComponent {
639
639
  super(...arguments);
640
640
  this.colorService = inject(AXPColorChooserService);
641
641
  this.colors = signal([], ...(ngDevMode ? [{ debugName: "colors" }] : []));
642
+ this.selectedColor = computed(() => {
643
+ const color = this.getValue();
644
+ if (typeof color === 'string') {
645
+ return color;
646
+ }
647
+ return color?.name;
648
+ }, ...(ngDevMode ? [{ debugName: "selectedColor" }] : []));
642
649
  }
643
650
  async ngOnInit() {
651
+ const allColors = await this.colorService.getColors();
652
+ this.colors.set(allColors);
644
653
  super.ngOnInit();
645
- this.colors.set(await this.colorService.getColors());
646
654
  }
647
- handleValueChange(name) {
648
- if (!name) {
649
- this.setValue(undefined);
650
- return;
655
+ handleValueChange(event) {
656
+ if (event.isUserInteraction) {
657
+ if (!event.value) {
658
+ this.setValue(undefined);
659
+ return;
660
+ }
661
+ // const color = this.colors().find((c) => c.name === event.value);
662
+ const color = event.component.selectedItems[0];
663
+ this.setValue(color);
651
664
  }
652
- const color = this.colors().find((c) => c.name === name);
653
- this.setValue(color);
654
665
  }
655
666
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: AXPColorChooserWidgetEditComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
656
667
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.1.3", type: AXPColorChooserWidgetEditComponent, isStandalone: true, selector: "ax-color-chooser-widget", usesInheritance: true, ngImport: i0, template: `
@@ -663,8 +674,9 @@ class AXPColorChooserWidgetEditComponent extends AXPValueWidgetComponent {
663
674
  valueField="name"
664
675
  [placeholder]="options()?.placeholder || 'Select a color...'"
665
676
  [itemTemplate]="customItemTemplate"
666
- [ngModel]="getValue()?.name"
667
- (ngModelChange)="handleValueChange($event)"
677
+ [ngModel]="selectedColor()"
678
+ (onValueChanged)="handleValueChange($event)"
679
+ [selectedTemplate]="customItemTemplate"
668
680
  >
669
681
  <ng-template #customItemTemplate let-item>
670
682
  <div class="ax-flex ax-items-center ax-gap-2 ax-p-2">
@@ -699,8 +711,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImpor
699
711
  valueField="name"
700
712
  [placeholder]="options()?.placeholder || 'Select a color...'"
701
713
  [itemTemplate]="customItemTemplate"
702
- [ngModel]="getValue()?.name"
703
- (ngModelChange)="handleValueChange($event)"
714
+ [ngModel]="selectedColor()"
715
+ (onValueChanged)="handleValueChange($event)"
716
+ [selectedTemplate]="customItemTemplate"
704
717
  >
705
718
  <ng-template #customItemTemplate let-item>
706
719
  <div class="ax-flex ax-items-center ax-gap-2 ax-p-2">