raise-common-lib 0.0.195 → 0.0.197

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.
@@ -22282,19 +22282,22 @@ var DrawerFormComponent = /** @class */ (function () {
22282
22282
  * @return {?}
22283
22283
  */
22284
22284
  function (changes) {
22285
+ if (changes._sections) {
22286
+ this.sections = filterShowSection(changes._sections.currentValue);
22287
+ this.form = this.getFormProxy(this.formatForm(this.sections, __assign({}, this.form)));
22288
+ this.syncFormField();
22289
+ this.formChange.emit(this.form);
22290
+ }
22285
22291
  if (changes._form) {
22286
22292
  if (!changes._form.currentValue[FORM_PROXY_TAG]) {
22287
- this.form = this.getFormProxy(changes._form.currentValue);
22293
+ this.form = this.getFormProxy(this.formatForm(this.sections, changes._form.currentValue));
22294
+ this.syncFormField();
22288
22295
  this.formChange.emit(this.form);
22289
22296
  }
22290
22297
  if (!changes._form.firstChange) {
22291
22298
  this.checkFormChange(changes._form.previousValue, changes._form.currentValue);
22292
22299
  }
22293
22300
  }
22294
- if (changes._sections) {
22295
- this.sections = filterShowSection(changes._sections.currentValue);
22296
- this.formatForm(this.sections);
22297
- }
22298
22301
  };
22299
22302
  /**
22300
22303
  * @return {?}
@@ -22399,6 +22402,29 @@ var DrawerFormComponent = /** @class */ (function () {
22399
22402
  }));
22400
22403
  }
22401
22404
  };
22405
+ /**
22406
+ * @param {?} value
22407
+ * @param {?} compareValue
22408
+ * @return {?}
22409
+ */
22410
+ DrawerFormComponent.prototype.equal = /**
22411
+ * @param {?} value
22412
+ * @param {?} compareValue
22413
+ * @return {?}
22414
+ */
22415
+ function (value, compareValue) {
22416
+ // 只对数组进行特殊判断
22417
+ if (Array.isArray(value) && Array.isArray(compareValue)) {
22418
+ return (value.length === compareValue.length &&
22419
+ value.every((/**
22420
+ * @param {?} i
22421
+ * @param {?} index
22422
+ * @return {?}
22423
+ */
22424
+ function (i, index) { return i === compareValue[index]; })));
22425
+ }
22426
+ return Object.is(value, compareValue);
22427
+ };
22402
22428
  /**
22403
22429
  * @param {?} previous
22404
22430
  * @param {?} current
@@ -22417,7 +22443,7 @@ var DrawerFormComponent = /** @class */ (function () {
22417
22443
  */
22418
22444
  function (_a) {
22419
22445
  var _b = __read(_a, 2), key = _b[0], currentValue = _b[1];
22420
- if (previous[key] !== currentValue) {
22446
+ if (!_this.equal(previous[key], currentValue)) {
22421
22447
  /** @type {?} */
22422
22448
  var field = _this.getField(key);
22423
22449
  if (field) {
@@ -22446,16 +22472,43 @@ var DrawerFormComponent = /** @class */ (function () {
22446
22472
  this.dateForm[field.formKey] = null;
22447
22473
  }
22448
22474
  };
22475
+ /**
22476
+ * @return {?}
22477
+ */
22478
+ DrawerFormComponent.prototype.syncFormField = /**
22479
+ * @return {?}
22480
+ */
22481
+ function () {
22482
+ var _this = this;
22483
+ this.sections.forEach((/**
22484
+ * @param {?} section
22485
+ * @return {?}
22486
+ */
22487
+ function (section) {
22488
+ section.fields.forEach((/**
22489
+ * @param {?} field
22490
+ * @return {?}
22491
+ */
22492
+ function (field) {
22493
+ switch (field.fieldFormType) {
22494
+ case "Datepicker":
22495
+ _this.syncFormToDateForm(field, _this.form[field.formKey]);
22496
+ break;
22497
+ }
22498
+ }));
22499
+ }));
22500
+ };
22449
22501
  /**
22450
22502
  * @param {?} sections
22503
+ * @param {?} form
22451
22504
  * @return {?}
22452
22505
  */
22453
22506
  DrawerFormComponent.prototype.formatForm = /**
22454
22507
  * @param {?} sections
22508
+ * @param {?} form
22455
22509
  * @return {?}
22456
22510
  */
22457
- function (sections) {
22458
- var _this = this;
22511
+ function (sections, form) {
22459
22512
  sections.forEach((/**
22460
22513
  * @param {?} section
22461
22514
  * @return {?}
@@ -22470,30 +22523,28 @@ var DrawerFormComponent = /** @class */ (function () {
22470
22523
  case "Text":
22471
22524
  case "Email":
22472
22525
  case "Textarea":
22473
- if (_this.form[field.formKey] === undefined) {
22474
- _this.form[field.formKey] = "";
22526
+ if (form[field.formKey] === undefined) {
22527
+ form[field.formKey] = "";
22475
22528
  }
22476
22529
  break;
22477
22530
  case "Tags":
22478
22531
  case "Checkbox":
22479
22532
  case "MultiSelect":
22480
- if (!Array.isArray(_this.form[field.formKey])) {
22481
- _this.form[field.formKey] = [];
22533
+ if (!Array.isArray(form[field.formKey])) {
22534
+ form[field.formKey] = [];
22482
22535
  }
22483
22536
  break;
22484
22537
  case "Switch":
22485
- _this.form[field.formKey] = !!_this.form[field.formKey];
22486
- break;
22487
- case "Datepicker":
22488
- _this.syncFormToDateForm(field, _this.form[field.formKey]);
22538
+ form[field.formKey] = !!form[field.formKey];
22489
22539
  break;
22490
22540
  default:
22491
- if (_this.form[field.formKey] === undefined) {
22492
- _this.form[field.formKey] = null;
22541
+ if (form[field.formKey] === undefined) {
22542
+ form[field.formKey] = null;
22493
22543
  }
22494
22544
  }
22495
22545
  }));
22496
22546
  }));
22547
+ return form;
22497
22548
  };
22498
22549
  /**
22499
22550
  * @param {?} form
@@ -22505,7 +22556,7 @@ var DrawerFormComponent = /** @class */ (function () {
22505
22556
  */
22506
22557
  function (form) {
22507
22558
  var _this = this;
22508
- // 现在除了 tag 之外不支持嵌套 form 属性,只对浅层进行处理
22559
+ // 现在不支持嵌套 form 属性,只对浅层进行处理
22509
22560
  /** @type {?} */
22510
22561
  var proxyForm = new Proxy(form, {
22511
22562
  set: (/**
@@ -22518,8 +22569,11 @@ var DrawerFormComponent = /** @class */ (function () {
22518
22569
  target[prop] = value;
22519
22570
  /** @type {?} */
22520
22571
  var field = _this.getField(prop);
22521
- if (field && field.fieldFormType === "Datepicker") {
22522
- _this.syncFormToDateForm(field, value);
22572
+ if (field) {
22573
+ if (field.fieldFormType === "Datepicker") {
22574
+ _this.syncFormToDateForm(field, value);
22575
+ }
22576
+ _this.formItemValidator(field);
22523
22577
  }
22524
22578
  return true;
22525
22579
  }),