ngx-rs-ant 2.0.6 → 2.0.8

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.
@@ -240,6 +240,10 @@ class PluginManager {
240
240
  instance.oid = boxItem.boxContainer.context?.__form?.oid;
241
241
  instance.model = boxItem.boxContainer.context?.__model;
242
242
  instance.opener = boxItem.boxContainer.context?.__opener;
243
+ instance.valueChange = boxItem.boxContainer.context?.__valueChange;
244
+ if (instance.valueChange) {
245
+ instance.valueChange.subscribe(instance.defaultValueChanged.bind(instance));
246
+ }
243
247
  if (boxItem.boxContainer.readonly) {
244
248
  instance.readonly = true;
245
249
  }
@@ -2518,6 +2522,7 @@ class FormComponent extends UniqueId {
2518
2522
  this.submitCallback = new EventEmitter();
2519
2523
  this.loading = false;
2520
2524
  this.changeFilter = new ChangeFilter();
2525
+ this.valueChange = new Subject();
2521
2526
  this.extraValidate = this.extraValidate.bind(this);
2522
2527
  }
2523
2528
  ngOnInit() {
@@ -2531,6 +2536,7 @@ class FormComponent extends UniqueId {
2531
2536
  }
2532
2537
  ngOnDestroy() {
2533
2538
  this.changeFilter.dispose();
2539
+ this.valueChange.unsubscribe();
2534
2540
  }
2535
2541
  load() {
2536
2542
  this.loading = true;
@@ -2544,7 +2550,8 @@ class FormComponent extends UniqueId {
2544
2550
  template: this.template
2545
2551
  },
2546
2552
  __model: this.model || {},
2547
- __opener: this
2553
+ __opener: this,
2554
+ __valueChange: this.valueChange
2548
2555
  };
2549
2556
  this.service.getFormTemplateConfig(this.tenant, this.className, this.template).subscribe(response => {
2550
2557
  this.config = response.data.template;
@@ -3350,7 +3357,10 @@ class IconSelectorComponent {
3350
3357
  for (let j = 0; j < styles[i].cssRules.length; j++) {
3351
3358
  let cssSelectorText = styles[i].cssRules[j].selectorText;
3352
3359
  if (cssSelectorText && cssSelectorText.indexOf('.coast-icon-') === 0 && regex.test(cssSelectorText)) {
3353
- this.iconList.push(cssSelectorText.substring(1, cssSelectorText.length - 8));
3360
+ const icon = cssSelectorText.substring(1, cssSelectorText.length - 8);
3361
+ if (!this.iconList.includes(icon)) {
3362
+ this.iconList.push(icon);
3363
+ }
3354
3364
  }
3355
3365
  }
3356
3366
  }
@@ -3646,6 +3656,28 @@ class FormItemComponentBase extends ComponentBase {
3646
3656
  */
3647
3657
  this.readonly = false;
3648
3658
  }
3659
+ defaultValueChanged(change) {
3660
+ if (!this.field) {
3661
+ return;
3662
+ }
3663
+ const thisField = this.field;
3664
+ if (Array.isArray(thisField)) {
3665
+ if (!thisField.includes(change.field)) {
3666
+ return;
3667
+ }
3668
+ }
3669
+ else if (thisField !== change.field) {
3670
+ return;
3671
+ }
3672
+ if (this.customValueChanged) {
3673
+ this.customValueChanged(change);
3674
+ return;
3675
+ }
3676
+ if (change.onlyInit && this.model[change.field]) {
3677
+ return;
3678
+ }
3679
+ this.model[change.field] = change.value;
3680
+ }
3649
3681
  }
3650
3682
 
3651
3683
  class ModalComponentBase extends ComponentBase {
@@ -3668,26 +3700,12 @@ class CellConfigBase extends ConfigBase {
3668
3700
  }
3669
3701
 
3670
3702
  class FormItemConfigBase extends ConfigBase {
3671
- constructor() {
3672
- super(...arguments);
3673
- /**
3674
- * 配置更新事件,emit()将更新配置到组件,emit(true)将更新配置到组件并重新加载组件
3675
- */
3676
- this.configChange = new EventEmitter();
3677
- }
3678
3703
  }
3679
3704
 
3680
3705
  class ModalConfigBase extends ConfigBase {
3681
3706
  }
3682
3707
 
3683
3708
  class PageItemConfigBase extends ConfigBase {
3684
- constructor() {
3685
- super(...arguments);
3686
- /**
3687
- * 配置更新事件,emit()将更新配置到组件,emit(true)将更新配置到组件并重新加载组件
3688
- */
3689
- this.configChange = new EventEmitter();
3690
- }
3691
3709
  }
3692
3710
 
3693
3711
  class WebsocketModule {