@form-create/element-ui 3.2.11 → 3.2.12

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.
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @form-create/element-ui v3.2.11
2
+ * @form-create/element-ui v3.2.12
3
3
  * (c) 2018-2024 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -3077,14 +3077,13 @@
3077
3077
 
3078
3078
  formData: function formData(fields) {
3079
3079
  if (fields == null) {
3080
- return api.fields().reduce(function (initial, id) {
3081
- var ctx = (h.fieldCtx[id] || []).filter(function (ctx) {
3082
- return !h.isIgnore(ctx.rule);
3083
- })[0];
3084
- if (!ctx) return initial;
3085
- initial[ctx.field] = copy(ctx.rule.value);
3086
- return initial;
3087
- }, h.options.appendValue !== false ? copy(h.appendData) : {});
3080
+ var data = {};
3081
+ Object.keys(h.form).forEach(function (k) {
3082
+ if (h.ignoreFields.indexOf(k) === -1) {
3083
+ data[k] = copy(h.form[k]);
3084
+ }
3085
+ });
3086
+ return data;
3088
3087
  } else {
3089
3088
  return tidyFields(fields).reduce(function (initial, id) {
3090
3089
  initial[id] = api.getValue(id);
@@ -5090,9 +5089,9 @@
5090
5089
  __ctrl: true,
5091
5090
  children: rule,
5092
5091
  valid: valid
5093
- }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
5092
+ }) : ctrl && ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl) >>> 0, 1);
5094
5093
  hideLst[valid ? 'push' : 'unshift'](function () {
5095
- if (method === 'disabled') {
5094
+ if (method === 'disabled' || method === 'enabled') {
5096
5095
  _this7.api.disabled(!valid, rule);
5097
5096
  } else if (method === 'display') {
5098
5097
  _this7.api.display(valid, rule);
@@ -5312,6 +5311,7 @@
5312
5311
 
5313
5312
  var data = vue.reactive({});
5314
5313
  var fields = this.fields();
5314
+ var ignoreFields = [];
5315
5315
 
5316
5316
  if (this.options.appendValue !== false) {
5317
5317
  Object.keys(this.appendData).reduce(function (initial, field) {
@@ -5324,15 +5324,19 @@
5324
5324
  }
5325
5325
 
5326
5326
  fields.reduce(function (initial, field) {
5327
- var ctx = _this2.getCtx(field);
5327
+ var ctx = (_this2.fieldCtx[field] || []).filter(function (ctx) {
5328
+ return !_this2.isIgnore(ctx.rule);
5329
+ })[0] || _this2.fieldCtx[field][0];
5328
5330
 
5329
- if (!_this2.isIgnore(ctx.rule)) {
5330
- initial[field] = vue.toRef(ctx.rule, 'value');
5331
+ if (_this2.isIgnore(ctx.rule)) {
5332
+ ignoreFields.push(field);
5331
5333
  }
5332
5334
 
5335
+ initial[field] = vue.toRef(ctx.rule, 'value');
5333
5336
  return initial;
5334
5337
  }, data);
5335
5338
  this.form = data;
5339
+ this.ignoreFields = ignoreFields;
5336
5340
  this.syncValue();
5337
5341
  },
5338
5342
  isIgnore: function isIgnore(rule) {
@@ -5369,11 +5373,19 @@
5369
5373
  }
5370
5374
  },
5371
5375
  syncValue: function syncValue() {
5376
+ var _this3 = this;
5377
+
5372
5378
  if (this.deferSyncFn) {
5373
5379
  return this.deferSyncFn.sync = true;
5374
5380
  }
5375
5381
 
5376
- this.vm.setupState.updateValue(_objectSpread2({}, this.form));
5382
+ var data = {};
5383
+ Object.keys(this.form).forEach(function (k) {
5384
+ if (_this3.ignoreFields.indexOf(k) === -1) {
5385
+ data[k] = _this3.form[k];
5386
+ }
5387
+ });
5388
+ this.vm.setupState.updateValue(data);
5377
5389
  },
5378
5390
  isChange: function isChange(ctx, value) {
5379
5391
  return JSON.stringify(this.getFormData(ctx), strFn) !== JSON.stringify(value, strFn);
@@ -5382,11 +5394,11 @@
5382
5394
  return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
5383
5395
  },
5384
5396
  refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
5385
- var _this3 = this;
5397
+ var _this4 = this;
5386
5398
 
5387
5399
  if (is.Function(ctx.rule.update)) {
5388
5400
  var state = invoke(function () {
5389
- return ctx.rule.update(val, ctx.origin, _this3.api, {
5401
+ return ctx.rule.update(val, ctx.origin, _this4.api, {
5390
5402
  origin: origin || 'change',
5391
5403
  linkField: field
5392
5404
  });
@@ -5410,18 +5422,18 @@
5410
5422
  this.refreshUpdate(ctx, val, origin, field);
5411
5423
  },
5412
5424
  appendLink: function appendLink(ctx) {
5413
- var _this4 = this;
5425
+ var _this5 = this;
5414
5426
 
5415
5427
  var link = ctx.rule.link;
5416
5428
  is.trueArray(link) && link.forEach(function (field) {
5417
5429
  var fn = function fn() {
5418
- return _this4.refreshRule(ctx, ctx.rule.value, 'link', field);
5430
+ return _this5.refreshRule(ctx, ctx.rule.value, 'link', field);
5419
5431
  };
5420
5432
 
5421
- _this4.bus.$on('change-' + field, fn);
5433
+ _this5.bus.$on('change-' + field, fn);
5422
5434
 
5423
5435
  ctx.linkOn.push(function () {
5424
- return _this4.bus.$off('change-' + field, fn);
5436
+ return _this5.bus.$off('change-' + field, fn);
5425
5437
  });
5426
5438
  });
5427
5439
  },
@@ -6097,6 +6109,7 @@
6097
6109
  subForm: {},
6098
6110
  form: vue.reactive({}),
6099
6111
  appendData: {},
6112
+ ignoreFields: [],
6100
6113
  providers: {},
6101
6114
  cycleLoad: null,
6102
6115
  loadedId: 1,
@@ -8377,7 +8390,7 @@
8377
8390
  function elmFormCreate() {
8378
8391
  return FormCreateFactory({
8379
8392
  ui: 'element-ui',
8380
- version: '3.2.11',
8393
+ version: '3.2.12',
8381
8394
  manager: manager,
8382
8395
  extendApi: extendApi,
8383
8396
  install: install,