ngx-rs-ant 2.0.7 → 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;
@@ -3649,6 +3656,28 @@ class FormItemComponentBase extends ComponentBase {
3649
3656
  */
3650
3657
  this.readonly = false;
3651
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
+ }
3652
3681
  }
3653
3682
 
3654
3683
  class ModalComponentBase extends ComponentBase {
@@ -3671,26 +3700,12 @@ class CellConfigBase extends ConfigBase {
3671
3700
  }
3672
3701
 
3673
3702
  class FormItemConfigBase extends ConfigBase {
3674
- constructor() {
3675
- super(...arguments);
3676
- /**
3677
- * 配置更新事件,emit()将更新配置到组件,emit(true)将更新配置到组件并重新加载组件
3678
- */
3679
- this.configChange = new EventEmitter();
3680
- }
3681
3703
  }
3682
3704
 
3683
3705
  class ModalConfigBase extends ConfigBase {
3684
3706
  }
3685
3707
 
3686
3708
  class PageItemConfigBase extends ConfigBase {
3687
- constructor() {
3688
- super(...arguments);
3689
- /**
3690
- * 配置更新事件,emit()将更新配置到组件,emit(true)将更新配置到组件并重新加载组件
3691
- */
3692
- this.configChange = new EventEmitter();
3693
- }
3694
3709
  }
3695
3710
 
3696
3711
  class WebsocketModule {