@acorex/components 3.0.46 → 3.0.51

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 (53) hide show
  1. package/acorex-components.metadata.json +1 -1
  2. package/bundles/acorex-components.umd.js +171 -80
  3. package/bundles/acorex-components.umd.js.map +1 -1
  4. package/bundles/acorex-components.umd.min.js +1 -1
  5. package/bundles/acorex-components.umd.min.js.map +1 -1
  6. package/esm2015/lib/calendar/calendar-box/calendar-box.component.js +6 -6
  7. package/esm2015/lib/date-picker/date-picker.component.js +3 -2
  8. package/esm2015/lib/dropdown/dropdown.component.js +3 -2
  9. package/esm2015/lib/menu/menu2.component.js +1 -1
  10. package/esm2015/lib/property-editor/editors/color-editor/color.editor.js +2 -2
  11. package/esm2015/lib/property-editor/editors/column-editor/column.editor.js +2 -2
  12. package/esm2015/lib/property-editor/editors/conditional-color-editor/conditional-color.editor.js +2 -2
  13. package/esm2015/lib/property-editor/editors/date-editor/date.editor.js +2 -2
  14. package/esm2015/lib/property-editor/editors/number-editor/number.editor.js +2 -2
  15. package/esm2015/lib/property-editor/editors/range-editor/range.editor.js +2 -2
  16. package/esm2015/lib/property-editor/editors/selectbox-editor/selectbox.editor.js +22 -12
  17. package/esm2015/lib/property-editor/editors/switch-editor/number.editor.js +2 -2
  18. package/esm2015/lib/property-editor/editors/text-editor/text.editor.js +2 -2
  19. package/esm2015/lib/property-editor/editors/time-editor/time.editor.js +2 -2
  20. package/esm2015/lib/property-editor/property-editor-renderer.directive.js +83 -37
  21. package/esm2015/lib/property-editor/property-editor.class.js +18 -4
  22. package/esm2015/lib/query-builder/query-builder-rule.component.js +5 -1
  23. package/esm2015/lib/query-builder/query-builder.service.js +4 -4
  24. package/esm2015/lib/selection-list/selection-list.component.js +6 -7
  25. package/esm2015/lib/tab-strip/tab-strip.component.js +11 -9
  26. package/esm5/lib/calendar/calendar-box/calendar-box.component.js +6 -6
  27. package/esm5/lib/date-picker/date-picker.component.js +3 -2
  28. package/esm5/lib/dropdown/dropdown.component.js +3 -2
  29. package/esm5/lib/menu/menu2.component.js +1 -1
  30. package/esm5/lib/property-editor/editors/color-editor/color.editor.js +2 -2
  31. package/esm5/lib/property-editor/editors/column-editor/column.editor.js +2 -2
  32. package/esm5/lib/property-editor/editors/conditional-color-editor/conditional-color.editor.js +2 -2
  33. package/esm5/lib/property-editor/editors/date-editor/date.editor.js +2 -2
  34. package/esm5/lib/property-editor/editors/number-editor/number.editor.js +2 -2
  35. package/esm5/lib/property-editor/editors/range-editor/range.editor.js +2 -2
  36. package/esm5/lib/property-editor/editors/selectbox-editor/selectbox.editor.js +26 -12
  37. package/esm5/lib/property-editor/editors/switch-editor/number.editor.js +2 -2
  38. package/esm5/lib/property-editor/editors/text-editor/text.editor.js +2 -2
  39. package/esm5/lib/property-editor/editors/time-editor/time.editor.js +2 -2
  40. package/esm5/lib/property-editor/property-editor-renderer.directive.js +89 -39
  41. package/esm5/lib/property-editor/property-editor.class.js +24 -4
  42. package/esm5/lib/query-builder/query-builder-rule.component.js +5 -1
  43. package/esm5/lib/query-builder/query-builder.service.js +4 -4
  44. package/esm5/lib/selection-list/selection-list.component.js +3 -4
  45. package/esm5/lib/tab-strip/tab-strip.component.js +11 -9
  46. package/fesm2015/acorex-components.js +159 -82
  47. package/fesm2015/acorex-components.js.map +1 -1
  48. package/fesm5/acorex-components.js +172 -81
  49. package/fesm5/acorex-components.js.map +1 -1
  50. package/lib/property-editor/editors/selectbox-editor/selectbox.editor.d.ts +7 -4
  51. package/lib/property-editor/property-editor-renderer.directive.d.ts +5 -3
  52. package/lib/property-editor/property-editor.class.d.ts +4 -2
  53. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { __decorate, __metadata, __param, __awaiter, __asyncValues } from 'tslib';
2
2
  import { Input, Component, EventEmitter, ContentChildren, QueryList, Output, ViewChild, ContentChild, ElementRef, ɵɵdefineInjectable, ɵɵinject, Injectable, ComponentFactoryResolver, Injector, NgZone, Inject, RendererFactory2, INJECTOR, TemplateRef, ApplicationRef, ChangeDetectorRef, HostListener, ViewEncapsulation, NgModule, ChangeDetectionStrategy, Attribute, Directive, ViewContainerRef, Renderer2, ViewChildren } from '@angular/core';
3
- import { AXTranslator, AXHtmlUtil, AXRenderService, AXConfig, AXDateTime, AXDateTimeRange, AXCoreModule, AXMenuItem, AXTranslatorModule, AXObjectUtil, AXScrollModule, getPropByPath, AXColorUtil } from '@acorex/core';
3
+ import { AXTranslator, AXHtmlUtil, AXRenderService, AXConfig, AXDateTime, AXDateTimeRange, AXCoreModule, AXMenuItem, AXTranslatorModule, AXObjectUtil, AXScrollModule, setPropByPath, AXEventService, AXColorUtil } from '@acorex/core';
4
4
  import { OverlayContainer, Overlay, ScrollStrategyOptions, OverlayPositionBuilder, OverlayKeyboardDispatcher, OverlayModule } from '@angular/cdk/overlay';
5
5
  import { TemplatePortal, ComponentPortal, CdkPortalOutlet, PortalModule } from '@angular/cdk/portal';
6
6
  import { merge, Subject, Observable } from 'rxjs';
@@ -1047,7 +1047,7 @@ let AXCalendarBoxComponent = class AXCalendarBoxComponent {
1047
1047
  return new AXDateTime(new Date(), this.type);
1048
1048
  }
1049
1049
  findDay(date) {
1050
- if (this.dayStyle.find((c) => c.date == date.toISOString().split('T')[0])) {
1050
+ if (this.dayStyle.find((c) => c.date.split('T')[0] == date.toISOString().split('T')[0])) {
1051
1051
  return true;
1052
1052
  }
1053
1053
  else {
@@ -1055,16 +1055,16 @@ let AXCalendarBoxComponent = class AXCalendarBoxComponent {
1055
1055
  }
1056
1056
  }
1057
1057
  getStyle(date) {
1058
- if (this.dayStyle.find((c) => c.date == date.toISOString().split('T')[0])) {
1059
- return this.dayStyle.find((c) => c.date == date.toISOString().split('T')[0]).style;
1058
+ if (this.dayStyle.find((c) => c.date.split('T')[0] == date.toISOString().split('T')[0])) {
1059
+ return this.dayStyle.find((c) => c.date.split('T')[0] == date.toISOString().split('T')[0]).style;
1060
1060
  }
1061
1061
  else {
1062
1062
  return '';
1063
1063
  }
1064
1064
  }
1065
1065
  getTitle(date) {
1066
- if (this.dayStyle.find((c) => c.date == date.toISOString().split('T')[0])) {
1067
- return this.dayStyle.find((c) => c.date == date.toISOString().split('T')[0]).text;
1066
+ if (this.dayStyle.find((c) => c.date.split('T')[0] == date.toISOString().split('T')[0])) {
1067
+ return this.dayStyle.find((c) => c.date.split('T')[0] == date.toISOString().split('T')[0]).text;
1068
1068
  }
1069
1069
  else {
1070
1070
  return '';
@@ -3025,7 +3025,7 @@ AXMenu2Component = AXMenu2Component_1 = __decorate([
3025
3025
  </div>
3026
3026
  `,
3027
3027
  encapsulation: ViewEncapsulation.None,
3028
- styles: [".ax.ax-menu{display:flex}.ax.ax-menu.ax-menu-vertical[data-level=\"0\"]{display:flex;flex-direction:row}.ax.ax-menu.ax-menu-vertical:not([data-level=\"0\"]){display:flex;transition:opacity .3s;min-width:12em;box-shadow:0 1px 7px 0 var(--ax-border-color);background:#fff;flex-direction:column}.ax.ax-menu.ax-menu-vertical .ax-menu-item{display:flex;white-space:nowrap;cursor:pointer;padding:0 10px;font-weight:400;font-size:1rem;line-height:40px;text-decoration:none;align-items:center}.ax.ax-menu.ax-menu-vertical .ax-menu-item .icon:first-child{-webkit-margin-end:var(--ax-size-md);margin-inline-end:var(--ax-size-md)}.ax.ax-menu.ax-menu-vertical .ax-menu-item .icon:last-child{-webkit-margin-start:var(--ax-size-md);margin-inline-start:var(--ax-size-md)}.ax.ax-menu.ax-menu-vertical .ax-menu-item span{flex:1}.ax.ax-menu.ax-menu-vertical .ax-menu-item.disabled{color:var(--ax-gray-color)!important;background-color:var(--ax-gray-trans-light-color)!important;cursor:not-allowed!important}.ax.ax-menu.ax-menu-vertical .ax-menu-item.disabled .icon{color:var(--ax-gray-dark-color)!important}.ax.ax-menu.ax-menu-vertical .ax-menu-item.disabled:hover{background:var(--ax-light-light-color)!important;border-color:var(--ax-light-light-color)!important;color:var(--ax-gray-dark-color)!important;cursor:not-allowed!important}"]
3028
+ styles: [".ax.ax-menu{display:flex}.ax.ax-menu.ax-menu-vertical[data-level=\"0\"]{display:flex;flex-direction:row}.ax.ax-menu.ax-menu-vertical:not([data-level=\"0\"]){display:flex;transition:opacity .3s;min-width:12em;box-shadow:0 1px 7px 0 var(--ax-border-color);background:#fff;flex-direction:column}.ax.ax-menu.ax-menu-vertical .ax-menu-item{display:flex;white-space:nowrap;cursor:pointer;padding:0 10px;font-weight:400;font-size:1rem;line-height:40px;text-decoration:none;align-items:center}.ax.ax-menu.ax-menu-vertical .ax-menu-item .icon:first-child{-webkit-margin-end:var(--ax-size-md);margin-inline-end:var(--ax-size-md)}.ax.ax-menu.ax-menu-vertical .ax-menu-item .icon:last-child{-webkit-margin-start:var(--ax-size-md);margin-inline-start:var(--ax-size-md)}.ax.ax-menu.ax-menu-vertical .ax-menu-item span{flex:1}.ax.ax-menu.ax-menu-vertical .ax-menu-item.disabled{opacity:.6;cursor:not-allowed!important}.ax.ax-menu.ax-menu-vertical .ax-menu-item.disabled .icon{color:var(--ax-gray-dark-color)!important}.ax.ax-menu.ax-menu-vertical .ax-menu-item.disabled:hover{cursor:not-allowed!important}"]
3029
3029
  }),
3030
3030
  __metadata("design:paramtypes", [Overlay,
3031
3031
  ViewContainerRef,
@@ -3714,7 +3714,7 @@ let AXSelectionListComponent = class AXSelectionListComponent extends AXBaseComp
3714
3714
  this.cdr.detectChanges();
3715
3715
  }
3716
3716
  get selectedValues() {
3717
- return this._selectedItems.map(c => c[this.valueField]) || [];
3717
+ return this._selectedItems.map((c) => c[this.valueField]) || [];
3718
3718
  }
3719
3719
  set selectedValues(v) {
3720
3720
  const old = this.selectedValues;
@@ -3722,7 +3722,7 @@ let AXSelectionListComponent = class AXSelectionListComponent extends AXBaseComp
3722
3722
  v = [];
3723
3723
  }
3724
3724
  if (JSON.stringify(old) != JSON.stringify(v)) {
3725
- this.selectedItems = this.items.filter(c => v.includes(c[this.valueField]));
3725
+ this.selectedItems = this.items.filter((c) => v.includes(c[this.valueField]));
3726
3726
  this.selectedValuesChange.emit(this.selectedValues);
3727
3727
  }
3728
3728
  }
@@ -3741,13 +3741,12 @@ let AXSelectionListComponent = class AXSelectionListComponent extends AXBaseComp
3741
3741
  }
3742
3742
  }
3743
3743
  else {
3744
- this.selectedValues = this.selectedValues.filter(c => c !== value);
3744
+ this.selectedValues = this.selectedValues.filter((c) => c !== value);
3745
3745
  }
3746
3746
  }
3747
3747
  }
3748
3748
  }
3749
- focus() {
3750
- }
3749
+ focus() { }
3751
3750
  onvalueChanged(e) {
3752
3751
  if (!this.disabled) {
3753
3752
  this.selectedItemsChange.emit([e]);
@@ -3814,7 +3813,7 @@ __decorate([
3814
3813
  AXSelectionListComponent = __decorate([
3815
3814
  Component({
3816
3815
  selector: 'ax-selection-list',
3817
- template: "<ng-container *ngIf=\" mode == 'multiple'; then checkboxList; else radioButtonList\"></ng-container>\r\n<ng-template #checkboxList>\r\n <div class=\"ax selection-list {{size}}\" [ngClass]=\"direction\">\r\n <ax-check-box label=\"{{item[textField]}}\" *ngFor=\"let item of items\" [disabled]=\"disabled\" [readonly]=\"disabled\"\r\n [value]=\"selectedValues.indexOf(item[valueField])>-1\"\r\n (onValueChanged)=\"onCheckValueChange(item[valueField],$event.value)\">\r\n </ax-check-box>\r\n </div>\r\n</ng-template>\r\n<ng-template #radioButtonList>\r\n <div class=\"ax selection-list {{size}}\" [ngClass]=\"direction\">\r\n <label class=\"ax radio\" for=\"{{uid}}\" [class.disabled]=\"disabled\" [class.readonly]=\"disabled\"\r\n *ngFor=\"let item of items\" (click)=\"onvalueChanged(item)\">\r\n {{ item[textField] }}\r\n <input type=\"radio\" (change)=\"onCheckValueChange(item[valueField],true)\" [value]=\"item[valueField]\"\r\n [checked]=\"selectedValues==item[valueField]\" [name]=\"uid\" [disabled]=\"disabled\" [readonly]=\"readonly\" />\r\n <span class=\"checkmark\"></span>\r\n </label>\r\n </div>\r\n</ng-template>",
3816
+ template: "<ng-container *ngIf=\" mode == 'multiple'; then checkboxList; else radioButtonList\"></ng-container>\r\n<ng-template #checkboxList>\r\n <div class=\"ax selection-list {{size}}\" [ngClass]=\"direction\">\r\n <ax-check-box label=\"{{item[textField]}}\" *ngFor=\"let item of items\" [disabled]=\"item.disable || disabled\"\r\n [readonly]=\"item.readonly || readonly\" [value]=\"selectedValues.indexOf(item[valueField])>-1\"\r\n (onValueChanged)=\"onCheckValueChange(item[valueField],$event.value)\">\r\n </ax-check-box>\r\n </div>\r\n</ng-template>\r\n<ng-template #radioButtonList>\r\n <div class=\"ax selection-list {{size}}\" [ngClass]=\"direction\">\r\n <label class=\"ax radio\" for=\"{{uid}}\" [class.disabled]=\"disabled\" [class.readonly]=\"disabled\"\r\n *ngFor=\"let item of items\" (click)=\"onvalueChanged(item)\">\r\n {{ item[textField] }}\r\n <input type=\"radio\" (change)=\"onCheckValueChange(item[valueField],true)\" [value]=\"item[valueField]\"\r\n [checked]=\"selectedValues==item[valueField]\" [name]=\"uid\" [disabled]=\"item.disable || disabled\"\r\n [readonly]=\"item.readonly || readonly\" />\r\n <span class=\"checkmark\"></span>\r\n </label>\r\n </div>\r\n</ng-template>",
3818
3817
  encapsulation: ViewEncapsulation.None,
3819
3818
  changeDetection: ChangeDetectionStrategy.OnPush
3820
3819
  }),
@@ -5003,7 +5002,8 @@ let AXDropdownComponent = class AXDropdownComponent extends AXBaseDropdownCompon
5003
5002
  ensureOverlayCreated() {
5004
5003
  if (!this.overlayRef) {
5005
5004
  const targetEl = document.querySelector('#' + this.uid);
5006
- const positionStrategy = this.overlay.position()
5005
+ const positionStrategy = this.overlay
5006
+ .position()
5007
5007
  .flexibleConnectedTo(targetEl)
5008
5008
  .withPositions([
5009
5009
  {
@@ -5173,7 +5173,8 @@ let AXDatePickerComponent = AXDatePickerComponent_1 = class AXDatePickerComponen
5173
5173
  this.value = new Date();
5174
5174
  }
5175
5175
  focus() {
5176
- this.dropdown.focus();
5176
+ // this.dropdown.focus();
5177
+ this.input.focus();
5177
5178
  }
5178
5179
  convertMaskToDate(text) {
5179
5180
  if (this.type == 'jalali') {
@@ -8927,6 +8928,10 @@ let AXQueryBuilderRuleComponent = class AXQueryBuilderRuleComponent {
8927
8928
  value: 'not-contains',
8928
8929
  text: AXTranslator.get('queryBuilder.not-contains')
8929
8930
  },
8931
+ {
8932
+ value: 'contains-all',
8933
+ text: AXTranslator.get('queryBuilder.contains-all')
8934
+ },
8930
8935
  {
8931
8936
  value: 'null',
8932
8937
  text: AXTranslator.get('queryBuilder.null')
@@ -9472,7 +9477,6 @@ let AXQueryBuilderService = class AXQueryBuilderService {
9472
9477
  return __awaiter(this, void 0, void 0, function* () {
9473
9478
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
9474
9479
  var e_1, _a;
9475
- ;
9476
9480
  var query;
9477
9481
  if (group.items.length > 0) {
9478
9482
  query = ' ( ';
@@ -9523,8 +9527,10 @@ let AXQueryBuilderService = class AXQueryBuilderService {
9523
9527
  case 'end-with':
9524
9528
  codeOperator = item.operator;
9525
9529
  break;
9530
+ default:
9531
+ codeOperator = item.operator;
9532
+ break;
9526
9533
  }
9527
- ;
9528
9534
  query = query + ' ' + item.caption + ' ' + codeOperator + ' ' + item.text;
9529
9535
  }
9530
9536
  if (id !== group.items.length - 1 && query != ' ( ') {
@@ -9551,7 +9557,6 @@ let AXQueryBuilderService = class AXQueryBuilderService {
9551
9557
  let query = '';
9552
9558
  switch (type) {
9553
9559
  case 'simple':
9554
- ;
9555
9560
  if (group.items.length > 0) {
9556
9561
  query = ' ( ';
9557
9562
  }
@@ -10952,13 +10957,15 @@ let AXTabStripComponent = class AXTabStripComponent {
10952
10957
  }
10953
10958
  ngOnInit() { }
10954
10959
  handleClick(i) {
10955
- this.items.forEach((c) => (c.active = false));
10956
- i.active = true;
10957
- this.onTabChanged.emit({
10958
- component: this,
10959
- seledtedTab: i,
10960
- htmlElement: this.ref.nativeElement
10961
- });
10960
+ if (!i.disable) {
10961
+ this.items.forEach((c) => (c.active = false));
10962
+ i.active = true;
10963
+ this.onTabChanged.emit({
10964
+ component: this,
10965
+ seledtedTab: i,
10966
+ htmlElement: this.ref.nativeElement
10967
+ });
10968
+ }
10962
10969
  }
10963
10970
  };
10964
10971
  AXTabStripComponent.ctorParameters = () => [
@@ -10975,7 +10982,7 @@ __decorate([
10975
10982
  AXTabStripComponent = __decorate([
10976
10983
  Component({
10977
10984
  selector: 'ax-tab-strip',
10978
- template: "<ul class=\"tab-strip-container\">\r\n <ng-container *ngFor=\"let item of items\">\r\n <li [class.active]=\"item.active\" (click)=\"handleClick(item)\">{{item.text}}</li>\r\n </ng-container>\r\n</ul>"
10985
+ template: "<ul class=\"tab-strip-container\">\r\n <ng-container *ngFor=\"let item of items\">\r\n <li *ngIf=\"!!item.visible || item.visible == undefined\" [class.active]=\"item.active\"\r\n [class.disabled]=\"item.disable\" (click)=\"handleClick(item)\">{{item.text}}</li>\r\n </ng-container>\r\n</ul>"
10979
10986
  }),
10980
10987
  __metadata("design:paramtypes", [ElementRef])
10981
10988
  ], AXTabStripComponent);
@@ -13938,9 +13945,17 @@ class AXProperyEditorComponent {
13938
13945
  constructor(cdr) {
13939
13946
  this.cdr = cdr;
13940
13947
  this.readonly = false;
13941
- this.initiated = false;
13948
+ this._initiated = false;
13949
+ this._valueBound = false;
13942
13950
  this.validatableComponentRegistered = new Subject();
13943
13951
  this.valueChange = new EventEmitter();
13952
+ this.onRenderCompleted = new EventEmitter();
13953
+ this.onRenderCompleted.subscribe(() => {
13954
+ this._initiated = true;
13955
+ });
13956
+ }
13957
+ get initiated() {
13958
+ return this._initiated && this._valueBound;
13944
13959
  }
13945
13960
  registerForValidationForm(component) {
13946
13961
  this.validatableComponentRegistered.next(component);
@@ -13953,18 +13968,24 @@ class AXProperyEditorComponent {
13953
13968
  this._value = v;
13954
13969
  this.valueChange.emit(v);
13955
13970
  this.cdr.detectChanges();
13971
+ //TODO: find better solution
13972
+ setTimeout(() => {
13973
+ this._valueBound = true;
13974
+ }, 100);
13956
13975
  }
13957
13976
  }
13958
13977
  handleValueChange(v) {
13959
13978
  this.value = v;
13960
13979
  }
13961
- initiat() {
13962
- }
13963
13980
  }
13964
13981
  __decorate([
13965
13982
  Output(),
13966
13983
  __metadata("design:type", EventEmitter)
13967
13984
  ], AXProperyEditorComponent.prototype, "valueChange", void 0);
13985
+ __decorate([
13986
+ Output(),
13987
+ __metadata("design:type", EventEmitter)
13988
+ ], AXProperyEditorComponent.prototype, "onRenderCompleted", void 0);
13968
13989
  __decorate([
13969
13990
  Input(),
13970
13991
  __metadata("design:type", Object),
@@ -14021,11 +14042,12 @@ function propertyEditor(options) {
14021
14042
  }
14022
14043
 
14023
14044
  let AXPropertyEditorRendererDirective = class AXPropertyEditorRendererDirective {
14024
- constructor(target, componentFactoryResolver, renderService) {
14045
+ constructor(target, componentFactoryResolver, renderService, eventService) {
14025
14046
  this.target = target;
14026
14047
  this.componentFactoryResolver = componentFactoryResolver;
14027
14048
  this.renderService = renderService;
14028
- this.readonly = false;
14049
+ this.eventService = eventService;
14050
+ this._context = {};
14029
14051
  this.onValueChange = new EventEmitter();
14030
14052
  }
14031
14053
  get context() {
@@ -14033,9 +14055,6 @@ let AXPropertyEditorRendererDirective = class AXPropertyEditorRendererDirective
14033
14055
  }
14034
14056
  set context(v) {
14035
14057
  this._context = v;
14036
- if (v && this.instance) {
14037
- this.assignProps();
14038
- }
14039
14058
  }
14040
14059
  clear() {
14041
14060
  this.instance.value = null;
@@ -14050,52 +14069,98 @@ let AXPropertyEditorRendererDirective = class AXPropertyEditorRendererDirective
14050
14069
  const cmpRef = this.target.createComponent(factory);
14051
14070
  this.instance = cmpRef.instance;
14052
14071
  this.subscription = this.instance.valueChange.subscribe(value => {
14053
- if (this.instance.initiated === true) {
14054
- this.property.value = value;
14055
- this.onValueChange.emit(this.property);
14072
+ var _a, _b;
14073
+ this.property.value = value;
14074
+ this.onValueChange.emit(this.property);
14075
+ if ((_b = (_a = this.property) === null || _a === void 0 ? void 0 : _a.property) === null || _b === void 0 ? void 0 : _b.name) {
14076
+ setTimeout(() => {
14077
+ this.eventService.broadcast(`props-${this.groupId}-${this.property.property.name}`, this.property);
14078
+ }, 0);
14056
14079
  }
14057
14080
  });
14058
- //
14081
+ this.watchChanges();
14082
+ this.assignProps();
14083
+ this.instance.value = this.property.value;
14084
+ // this.instance.onRenderCompleted.subscribe(() => {
14085
+ // });
14059
14086
  if (this.validationForm) {
14060
14087
  this.instance.validatableComponentRegistered.subscribe(v => {
14061
14088
  this.validationForm.addWidget(v);
14062
14089
  });
14063
14090
  }
14064
- //
14065
- //setTimeout(() => {
14066
- this.instance.readonly = this.readonly;
14067
- this.assignProps();
14068
- this.instance.value = this.property.value;
14069
- this.instance.initiat();
14070
- cmpRef.changeDetectorRef.markForCheck();
14071
- //});
14072
14091
  }
14073
14092
  });
14074
14093
  }
14094
+ watchChanges() {
14095
+ var _a, _b;
14096
+ const varsRegx = /((\$\{[a-zA-Z_0-9]+\})+)/gm;
14097
+ const varNameRegx = /[a-zA-Z_0-9]+/gm;
14098
+ const options = this.property.property.editorOptions;
14099
+ if (!options) {
14100
+ return;
14101
+ }
14102
+ for (const p in options) {
14103
+ if (options.hasOwnProperty(p)) {
14104
+ const opt = options[p];
14105
+ const vars = typeof opt === 'string' ? (_a = opt) === null || _a === void 0 ? void 0 : _a.match(varsRegx) : [];
14106
+ // bind the props
14107
+ if ((_b = vars) === null || _b === void 0 ? void 0 : _b.length) {
14108
+ vars.forEach(v => {
14109
+ var _a;
14110
+ const path = ((_a = v.match(varNameRegx)) === null || _a === void 0 ? void 0 : _a.length) ? v.match(varNameRegx)[0] : null;
14111
+ if (path) {
14112
+ this.eventService.on(`props-${this.groupId}-${path}`, (e) => {
14113
+ let execCode = opt.slice();
14114
+ const params = {};
14115
+ vars.forEach(vv => {
14116
+ var _a;
14117
+ const p2 = ((_a = vv.match(varNameRegx)) === null || _a === void 0 ? void 0 : _a.length) ? vv.match(varNameRegx)[0] : null;
14118
+ params[p2] = AXObjectUtil.deepCopy(this.context[p2]) || null;
14119
+ execCode = execCode.replace(vv, `__params__.${p2}`);
14120
+ });
14121
+ const func = new Function('__params__', `try { return ${execCode}} catch(e){ console.log(e); return null; }`);
14122
+ const val = func(params);
14123
+ const keys = p.split('.');
14124
+ const prop = Object.assign({}, this.instance[keys[0]]);
14125
+ if (keys.length > 1) {
14126
+ this.instance[keys[0]] = setPropByPath(prop, p, val);
14127
+ }
14128
+ else {
14129
+ setPropByPath(this.instance, p, val);
14130
+ }
14131
+ });
14132
+ }
14133
+ });
14134
+ }
14135
+ // else {
14136
+ // this.assignProps();
14137
+ // }
14138
+ }
14139
+ }
14140
+ }
14075
14141
  assignProps() {
14142
+ var _a, _b;
14076
14143
  const options = this.property.property.editorOptions;
14077
14144
  if (!options) {
14078
14145
  return;
14079
14146
  }
14147
+ const varsRegx = /((\$\{[a-zA-Z_0-9]+\})+)/gm;
14080
14148
  for (const p in options) {
14081
14149
  if (options.hasOwnProperty(p)) {
14082
14150
  const opt = options[p];
14083
- if (typeof opt === 'string' && opt.startsWith('$$')) {
14084
- const key = opt.substring(2);
14085
- const val = getPropByPath(this.context, key);
14086
- if (val) {
14087
- this.instance[p] = typeof val === 'function' ? val({ data: this.context, host: this.host }, this.property) : val;
14088
- }
14151
+ const vars = typeof opt === 'string' ? (_a = opt) === null || _a === void 0 ? void 0 : _a.match(varsRegx) : [];
14152
+ if ((_b = vars) === null || _b === void 0 ? void 0 : _b.length) {
14153
+ continue;
14089
14154
  }
14090
14155
  else {
14091
- const res = typeof opt === 'function' ? opt({ data: this.context, host: this.host }, this.property) : opt;
14092
- if (res instanceof Promise) {
14093
- res.then(v => {
14094
- this.instance[p] = v;
14156
+ const val = typeof opt === 'function' ? opt({ data: this.context, host: this.host }, this.property) : opt;
14157
+ if (val instanceof Promise) {
14158
+ val.then(v => {
14159
+ setPropByPath(this.instance, p, val);
14095
14160
  });
14096
14161
  }
14097
14162
  else {
14098
- this.instance[p] = res;
14163
+ setPropByPath(this.instance, p, val);
14099
14164
  }
14100
14165
  }
14101
14166
  }
@@ -14110,16 +14175,13 @@ let AXPropertyEditorRendererDirective = class AXPropertyEditorRendererDirective
14110
14175
  AXPropertyEditorRendererDirective.ctorParameters = () => [
14111
14176
  { type: ViewContainerRef },
14112
14177
  { type: ComponentFactoryResolver },
14113
- { type: AXRenderService }
14178
+ { type: AXRenderService },
14179
+ { type: AXEventService }
14114
14180
  ];
14115
14181
  __decorate([
14116
14182
  Input(),
14117
14183
  __metadata("design:type", Object)
14118
14184
  ], AXPropertyEditorRendererDirective.prototype, "property", void 0);
14119
- __decorate([
14120
- Input(),
14121
- __metadata("design:type", Boolean)
14122
- ], AXPropertyEditorRendererDirective.prototype, "readonly", void 0);
14123
14185
  __decorate([
14124
14186
  Input(),
14125
14187
  __metadata("design:type", AXValidationFormComponent)
@@ -14133,6 +14195,10 @@ __decorate([
14133
14195
  Input(),
14134
14196
  __metadata("design:type", Object)
14135
14197
  ], AXPropertyEditorRendererDirective.prototype, "host", void 0);
14198
+ __decorate([
14199
+ Input(),
14200
+ __metadata("design:type", Object)
14201
+ ], AXPropertyEditorRendererDirective.prototype, "groupId", void 0);
14136
14202
  __decorate([
14137
14203
  Output(),
14138
14204
  __metadata("design:type", EventEmitter)
@@ -14143,7 +14209,8 @@ AXPropertyEditorRendererDirective = __decorate([
14143
14209
  }),
14144
14210
  __metadata("design:paramtypes", [ViewContainerRef,
14145
14211
  ComponentFactoryResolver,
14146
- AXRenderService])
14212
+ AXRenderService,
14213
+ AXEventService])
14147
14214
  ], AXPropertyEditorRendererDirective);
14148
14215
 
14149
14216
  let AXTextPropertyEditorComponent = class AXTextPropertyEditorComponent extends AXProperyEditorComponent {
@@ -14157,7 +14224,7 @@ let AXTextPropertyEditorComponent = class AXTextPropertyEditorComponent extends
14157
14224
  }
14158
14225
  ngAfterViewInit() {
14159
14226
  this.registerForValidationForm(this.textBox);
14160
- this.initiated = true;
14227
+ this.onRenderCompleted.emit();
14161
14228
  }
14162
14229
  };
14163
14230
  AXTextPropertyEditorComponent.ctorParameters = () => [
@@ -14203,8 +14270,8 @@ let AXNumberBoxPropertyEditorComponent = class AXNumberBoxPropertyEditorComponen
14203
14270
  super.handleValueChange(e.value);
14204
14271
  }
14205
14272
  ngAfterViewInit() {
14206
- this.initiated = true;
14207
14273
  this.registerForValidationForm(this.textBox);
14274
+ this.onRenderCompleted.emit();
14208
14275
  }
14209
14276
  };
14210
14277
  AXNumberBoxPropertyEditorComponent.ctorParameters = () => [
@@ -14258,16 +14325,18 @@ let AXSelectBoxPropertyEditorComponent = class AXSelectBoxPropertyEditorComponen
14258
14325
  this.selectionDataMode = 'value';
14259
14326
  this.allowSearch = true;
14260
14327
  this.allowNull = false;
14328
+ this.disabled = false;
14261
14329
  this.items = [];
14262
14330
  this.remoteOperation = false;
14263
14331
  this.provideData = (e) => {
14264
14332
  return new Promise((resolve) => {
14265
14333
  const func = () => {
14266
14334
  if (Array.isArray(this.items)) {
14267
- resolve(this.items);
14335
+ resolve(this.items.slice());
14268
14336
  }
14269
14337
  else if (typeof this.items === 'function') {
14270
- resolve(this.items(e));
14338
+ const a = Object.assign(e, { sender: this });
14339
+ resolve(this.items(a));
14271
14340
  }
14272
14341
  else {
14273
14342
  resolve([]);
@@ -14282,27 +14351,35 @@ let AXSelectBoxPropertyEditorComponent = class AXSelectBoxPropertyEditorComponen
14282
14351
  });
14283
14352
  };
14284
14353
  }
14354
+ get filter() {
14355
+ return this._filter;
14356
+ }
14357
+ set filter(v) {
14358
+ var _a;
14359
+ this._filter = v;
14360
+ if (this.value && this.initiated) {
14361
+ this.value = null;
14362
+ (_a = this.selectBox) === null || _a === void 0 ? void 0 : _a.refresh();
14363
+ }
14364
+ }
14285
14365
  handleValueChange(e) {
14286
- super.handleValueChange(e.value);
14366
+ super.handleValueChange(e.selectedValues);
14287
14367
  }
14288
14368
  ngAfterViewInit() {
14289
- this.selectBox.refresh();
14290
14369
  this.registerForValidationForm(this.selectBox);
14291
- }
14292
- initiat() {
14293
- this.initiated = true;
14370
+ this.onRenderCompleted.emit();
14294
14371
  }
14295
14372
  };
14296
14373
  AXSelectBoxPropertyEditorComponent.ctorParameters = () => [
14297
14374
  { type: ChangeDetectorRef }
14298
14375
  ];
14299
14376
  __decorate([
14300
- ViewChild(AXSelectBox2Component, { static: true }),
14301
- __metadata("design:type", AXSelectBox2Component)
14377
+ ViewChild(AXSelectBoxComponent, { static: true }),
14378
+ __metadata("design:type", AXSelectBoxComponent)
14302
14379
  ], AXSelectBoxPropertyEditorComponent.prototype, "selectBox", void 0);
14303
14380
  AXSelectBoxPropertyEditorComponent = __decorate([
14304
14381
  Component({
14305
- template: "<ax-select-box2 [selectionMode]=\"selectionMode\"\r\n [selectionDataMode]=\"selectionDataMode\" \r\n [textField]=\"textField\" \r\n [valueField]=\"valueField\" \r\n [value]=\"value\" \r\n [remoteOperation]=\"remoteOperation\"\r\n [allowSearch]=\"allowSearch\" \r\n [allowNull]=\"allowNull\"\r\n (onValueChanged)=\"handleValueChange($event)\">\r\n <ax-data-source [provideData]=\"provideData\">\r\n </ax-data-source>\r\n <ax-validation [rules]=\"validation?.rules\">\r\n </ax-validation>\r\n</ax-select-box2>"
14382
+ template: "<ax-select-box [mode]=\"selectionMode\"\r\n [textField]=\"textField\" \r\n [valueField]=\"valueField\" \r\n [selectedValues]=\"value\" \r\n [remoteOperation]=\"remoteOperation\"\r\n [allowSearch]=\"allowSearch\" \r\n [allowNull]=\"allowNull\"\r\n [readonly]=\"readonly\"\r\n [disabled]=\"disabled\"\r\n (selectionChanged)=\"handleValueChange($event)\">\r\n <ax-data-source [provideData]=\"provideData\">\r\n </ax-data-source>\r\n <ax-validation [rules]=\"validation?.rules\">\r\n </ax-validation>\r\n</ax-select-box>"
14306
14383
  }),
14307
14384
  __metadata("design:paramtypes", [ChangeDetectorRef])
14308
14385
  ], AXSelectBoxPropertyEditorComponent);
@@ -14336,7 +14413,7 @@ let AXRangePropertyEditorComponent = class AXRangePropertyEditorComponent extend
14336
14413
  this.cdr.detectChanges();
14337
14414
  }
14338
14415
  ngAfterViewInit() {
14339
- this.initiated = true;
14416
+ this.onRenderCompleted.emit();
14340
14417
  }
14341
14418
  // getRanges() {
14342
14419
  // return this.ranges.sort((a, b) => a.minValue - b.minValue);
@@ -15017,7 +15094,7 @@ let AXColorPropertyEditorComponent = class AXColorPropertyEditorComponent extend
15017
15094
  }
15018
15095
  ngAfterViewInit() {
15019
15096
  this.registerForValidationForm(this.textBox);
15020
- this.initiated = true;
15097
+ this.onRenderCompleted.emit();
15021
15098
  }
15022
15099
  };
15023
15100
  AXColorPropertyEditorComponent.ctorParameters = () => [
@@ -15076,7 +15153,7 @@ let ColumnPropertyEditorComponent = class ColumnPropertyEditorComponent extends
15076
15153
  this.columns = this.value ? JSON.parse(JSON.stringify(this.value)) : [];
15077
15154
  }
15078
15155
  ngAfterViewInit() {
15079
- this.initiated = true;
15156
+ this.onRenderCompleted.emit();
15080
15157
  }
15081
15158
  drop(event) {
15082
15159
  moveItemInArray(this.columns, event.previousIndex, event.currentIndex);
@@ -15230,8 +15307,8 @@ let AXConditionalColorPropertyEditorComponent = class AXConditionalColorProperty
15230
15307
  ].filter(c => c.dataTypes == null || c.dataTypes.includes(this.dataType));
15231
15308
  }
15232
15309
  ngAfterViewInit() {
15233
- this.initiated = true;
15234
15310
  this.cdr.detectChanges();
15311
+ this.onRenderCompleted.emit();
15235
15312
  }
15236
15313
  handleEditClick(item) {
15237
15314
  this.updateOperations();
@@ -15424,7 +15501,7 @@ let AXSwitchPropertyEditorComponent = class AXSwitchPropertyEditorComponent exte
15424
15501
  super.handleValueChange(e.value);
15425
15502
  }
15426
15503
  ngAfterViewInit() {
15427
- this.initiated = true;
15504
+ this.onRenderCompleted.emit();
15428
15505
  }
15429
15506
  };
15430
15507
  AXSwitchPropertyEditorComponent.ctorParameters = () => [
@@ -15471,8 +15548,8 @@ let AXDatePropertyEditorComponent = class AXDatePropertyEditorComponent extends
15471
15548
  super.handleValueChange(e.value);
15472
15549
  }
15473
15550
  ngAfterViewInit() {
15474
- this.initiated = true;
15475
15551
  this.registerForValidationForm(this.date);
15552
+ this.onRenderCompleted.emit();
15476
15553
  }
15477
15554
  };
15478
15555
  AXDatePropertyEditorComponent.ctorParameters = () => [
@@ -15522,8 +15599,8 @@ let AXTimePropertyEditorComponent = class AXTimePropertyEditorComponent extends
15522
15599
  super.handleValueChange((_a = e.value) === null || _a === void 0 ? void 0 : _a.time);
15523
15600
  }
15524
15601
  ngAfterViewInit() {
15525
- this.initiated = true;
15526
15602
  this.registerForValidationForm(this.time);
15603
+ this.onRenderCompleted.emit();
15527
15604
  }
15528
15605
  };
15529
15606
  AXTimePropertyEditorComponent.ctorParameters = () => [