raise-common-lib 0.0.195 → 0.0.196

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.
@@ -22474,19 +22474,21 @@
22474
22474
  * @return {?}
22475
22475
  */
22476
22476
  function (changes) {
22477
+ if (changes._sections) {
22478
+ this.sections = filterShowSection(changes._sections.currentValue);
22479
+ this.form = this.getFormProxy(this.formatForm(this.sections, __assign({}, this.form)));
22480
+ this.syncFormField();
22481
+ }
22477
22482
  if (changes._form) {
22478
22483
  if (!changes._form.currentValue[FORM_PROXY_TAG]) {
22479
- this.form = this.getFormProxy(changes._form.currentValue);
22484
+ this.form = this.getFormProxy(this.formatForm(this.sections, changes._form.currentValue));
22485
+ this.syncFormField();
22480
22486
  this.formChange.emit(this.form);
22481
22487
  }
22482
22488
  if (!changes._form.firstChange) {
22483
22489
  this.checkFormChange(changes._form.previousValue, changes._form.currentValue);
22484
22490
  }
22485
22491
  }
22486
- if (changes._sections) {
22487
- this.sections = filterShowSection(changes._sections.currentValue);
22488
- this.formatForm(this.sections);
22489
- }
22490
22492
  };
22491
22493
  /**
22492
22494
  * @return {?}
@@ -22591,6 +22593,29 @@
22591
22593
  }));
22592
22594
  }
22593
22595
  };
22596
+ /**
22597
+ * @param {?} value
22598
+ * @param {?} compareValue
22599
+ * @return {?}
22600
+ */
22601
+ DrawerFormComponent.prototype.equal = /**
22602
+ * @param {?} value
22603
+ * @param {?} compareValue
22604
+ * @return {?}
22605
+ */
22606
+ function (value, compareValue) {
22607
+ // 只对数组进行特殊判断
22608
+ if (Array.isArray(value) && Array.isArray(compareValue)) {
22609
+ return (value.length === compareValue.length &&
22610
+ value.every((/**
22611
+ * @param {?} i
22612
+ * @param {?} index
22613
+ * @return {?}
22614
+ */
22615
+ function (i, index) { return i === compareValue[index]; })));
22616
+ }
22617
+ return Object.is(value, compareValue);
22618
+ };
22594
22619
  /**
22595
22620
  * @param {?} previous
22596
22621
  * @param {?} current
@@ -22609,7 +22634,7 @@
22609
22634
  */
22610
22635
  function (_a) {
22611
22636
  var _b = __read(_a, 2), key = _b[0], currentValue = _b[1];
22612
- if (previous[key] !== currentValue) {
22637
+ if (!_this.equal(previous[key], currentValue)) {
22613
22638
  /** @type {?} */
22614
22639
  var field = _this.getField(key);
22615
22640
  if (field) {
@@ -22638,16 +22663,43 @@
22638
22663
  this.dateForm[field.formKey] = null;
22639
22664
  }
22640
22665
  };
22666
+ /**
22667
+ * @return {?}
22668
+ */
22669
+ DrawerFormComponent.prototype.syncFormField = /**
22670
+ * @return {?}
22671
+ */
22672
+ function () {
22673
+ var _this = this;
22674
+ this.sections.forEach((/**
22675
+ * @param {?} section
22676
+ * @return {?}
22677
+ */
22678
+ function (section) {
22679
+ section.fields.forEach((/**
22680
+ * @param {?} field
22681
+ * @return {?}
22682
+ */
22683
+ function (field) {
22684
+ switch (field.fieldFormType) {
22685
+ case "Datepicker":
22686
+ _this.syncFormToDateForm(field, _this.form[field.formKey]);
22687
+ break;
22688
+ }
22689
+ }));
22690
+ }));
22691
+ };
22641
22692
  /**
22642
22693
  * @param {?} sections
22694
+ * @param {?} form
22643
22695
  * @return {?}
22644
22696
  */
22645
22697
  DrawerFormComponent.prototype.formatForm = /**
22646
22698
  * @param {?} sections
22699
+ * @param {?} form
22647
22700
  * @return {?}
22648
22701
  */
22649
- function (sections) {
22650
- var _this = this;
22702
+ function (sections, form) {
22651
22703
  sections.forEach((/**
22652
22704
  * @param {?} section
22653
22705
  * @return {?}
@@ -22662,30 +22714,28 @@
22662
22714
  case "Text":
22663
22715
  case "Email":
22664
22716
  case "Textarea":
22665
- if (_this.form[field.formKey] === undefined) {
22666
- _this.form[field.formKey] = "";
22717
+ if (form[field.formKey] === undefined) {
22718
+ form[field.formKey] = "";
22667
22719
  }
22668
22720
  break;
22669
22721
  case "Tags":
22670
22722
  case "Checkbox":
22671
22723
  case "MultiSelect":
22672
- if (!Array.isArray(_this.form[field.formKey])) {
22673
- _this.form[field.formKey] = [];
22724
+ if (!Array.isArray(form[field.formKey])) {
22725
+ form[field.formKey] = [];
22674
22726
  }
22675
22727
  break;
22676
22728
  case "Switch":
22677
- _this.form[field.formKey] = !!_this.form[field.formKey];
22678
- break;
22679
- case "Datepicker":
22680
- _this.syncFormToDateForm(field, _this.form[field.formKey]);
22729
+ form[field.formKey] = !!form[field.formKey];
22681
22730
  break;
22682
22731
  default:
22683
- if (_this.form[field.formKey] === undefined) {
22684
- _this.form[field.formKey] = null;
22732
+ if (form[field.formKey] === undefined) {
22733
+ form[field.formKey] = null;
22685
22734
  }
22686
22735
  }
22687
22736
  }));
22688
22737
  }));
22738
+ return form;
22689
22739
  };
22690
22740
  /**
22691
22741
  * @param {?} form
@@ -22697,7 +22747,7 @@
22697
22747
  */
22698
22748
  function (form) {
22699
22749
  var _this = this;
22700
- // 现在除了 tag 之外不支持嵌套 form 属性,只对浅层进行处理
22750
+ // 现在不支持嵌套 form 属性,只对浅层进行处理
22701
22751
  /** @type {?} */
22702
22752
  var proxyForm = new Proxy(form, {
22703
22753
  set: (/**
@@ -22710,8 +22760,11 @@
22710
22760
  target[prop] = value;
22711
22761
  /** @type {?} */
22712
22762
  var field = _this.getField(prop);
22713
- if (field && field.fieldFormType === "Datepicker") {
22714
- _this.syncFormToDateForm(field, value);
22763
+ if (field) {
22764
+ if (field.fieldFormType === "Datepicker") {
22765
+ _this.syncFormToDateForm(field, value);
22766
+ }
22767
+ _this.formItemValidator(field);
22715
22768
  }
22716
22769
  return true;
22717
22770
  }),