@yibozhang/pro-table 0.0.13 → 0.0.15

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.
@@ -3004,6 +3004,10 @@
3004
3004
  if (value === null || value === undefined) {
3005
3005
  return value;
3006
3006
  }
3007
+ // 特殊处理 Date 对象,直接返回不做转换
3008
+ if (value instanceof Date) {
3009
+ return value;
3010
+ }
3007
3011
  if (Array.isArray(value)) {
3008
3012
  return value.map(function (item) { return _this.excludeInternalFields(item); });
3009
3013
  }
@@ -3443,6 +3447,31 @@
3443
3447
  // 5. 如果配置了自动更新,更新外部数组引用
3444
3448
  this.autoUpdateArrayReference(name);
3445
3449
  };
3450
+ /** 批量设置表单数据(用于回填数据) */
3451
+ ArrayFormService.prototype.setFormData = function (formName, data) {
3452
+ var _this = this;
3453
+ var form = this.formStore[formName];
3454
+ if (!form) {
3455
+ return;
3456
+ }
3457
+ // 1. 初始化数据(添加 uid、isEdit 等字段)
3458
+ var initializedData = this.initializeData(data);
3459
+ // 2. 更新表单数据
3460
+ form.data = initializedData;
3461
+ // 3. 重新创建初始值快照
3462
+ form.initialSnapshot = {};
3463
+ initializedData.forEach(function (row) {
3464
+ form.initialSnapshot[row.uid] = _this.createRowSnapshot(row, form.config.fields);
3465
+ });
3466
+ // 4. 清理编辑快照和校验结果
3467
+ form.editingSnapshot = {};
3468
+ form.validationResults = {};
3469
+ // 5. 重置 touched 状态
3470
+ form.allTouched = false;
3471
+ form.rowTouched = {};
3472
+ // 6. 如果配置了自动更新,更新外部数组引用
3473
+ this.autoUpdateArrayReference(formName);
3474
+ };
3446
3475
  return ArrayFormService;
3447
3476
  }());
3448
3477
  ArrayFormService.ɵprov = i0__namespace.ɵɵdefineInjectable({ factory: function ArrayFormService_Factory() { return new ArrayFormService(); }, token: ArrayFormService, providedIn: "root" });