@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.
@@ -3073,14 +3073,13 @@ function Api(h) {
3073
3073
 
3074
3074
  formData: function formData(fields) {
3075
3075
  if (fields == null) {
3076
- return api.fields().reduce(function (initial, id) {
3077
- var ctx = (h.fieldCtx[id] || []).filter(function (ctx) {
3078
- return !h.isIgnore(ctx.rule);
3079
- })[0];
3080
- if (!ctx) return initial;
3081
- initial[ctx.field] = copy(ctx.rule.value);
3082
- return initial;
3083
- }, h.options.appendValue !== false ? copy(h.appendData) : {});
3076
+ var data = {};
3077
+ Object.keys(h.form).forEach(function (k) {
3078
+ if (h.ignoreFields.indexOf(k) === -1) {
3079
+ data[k] = copy(h.form[k]);
3080
+ }
3081
+ });
3082
+ return data;
3084
3083
  } else {
3085
3084
  return tidyFields(fields).reduce(function (initial, id) {
3086
3085
  initial[id] = api.getValue(id);
@@ -5086,9 +5085,9 @@ function useLoader(Handler) {
5086
5085
  __ctrl: true,
5087
5086
  children: rule,
5088
5087
  valid: valid
5089
- }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
5088
+ }) : ctrl && ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl) >>> 0, 1);
5090
5089
  hideLst[valid ? 'push' : 'unshift'](function () {
5091
- if (method === 'disabled') {
5090
+ if (method === 'disabled' || method === 'enabled') {
5092
5091
  _this7.api.disabled(!valid, rule);
5093
5092
  } else if (method === 'display') {
5094
5093
  _this7.api.display(valid, rule);
@@ -5308,6 +5307,7 @@ function useInput(Handler) {
5308
5307
 
5309
5308
  var data = reactive({});
5310
5309
  var fields = this.fields();
5310
+ var ignoreFields = [];
5311
5311
 
5312
5312
  if (this.options.appendValue !== false) {
5313
5313
  Object.keys(this.appendData).reduce(function (initial, field) {
@@ -5320,15 +5320,19 @@ function useInput(Handler) {
5320
5320
  }
5321
5321
 
5322
5322
  fields.reduce(function (initial, field) {
5323
- var ctx = _this2.getCtx(field);
5323
+ var ctx = (_this2.fieldCtx[field] || []).filter(function (ctx) {
5324
+ return !_this2.isIgnore(ctx.rule);
5325
+ })[0] || _this2.fieldCtx[field][0];
5324
5326
 
5325
- if (!_this2.isIgnore(ctx.rule)) {
5326
- initial[field] = toRef(ctx.rule, 'value');
5327
+ if (_this2.isIgnore(ctx.rule)) {
5328
+ ignoreFields.push(field);
5327
5329
  }
5328
5330
 
5331
+ initial[field] = toRef(ctx.rule, 'value');
5329
5332
  return initial;
5330
5333
  }, data);
5331
5334
  this.form = data;
5335
+ this.ignoreFields = ignoreFields;
5332
5336
  this.syncValue();
5333
5337
  },
5334
5338
  isIgnore: function isIgnore(rule) {
@@ -5365,11 +5369,19 @@ function useInput(Handler) {
5365
5369
  }
5366
5370
  },
5367
5371
  syncValue: function syncValue() {
5372
+ var _this3 = this;
5373
+
5368
5374
  if (this.deferSyncFn) {
5369
5375
  return this.deferSyncFn.sync = true;
5370
5376
  }
5371
5377
 
5372
- this.vm.setupState.updateValue(_objectSpread2({}, this.form));
5378
+ var data = {};
5379
+ Object.keys(this.form).forEach(function (k) {
5380
+ if (_this3.ignoreFields.indexOf(k) === -1) {
5381
+ data[k] = _this3.form[k];
5382
+ }
5383
+ });
5384
+ this.vm.setupState.updateValue(data);
5373
5385
  },
5374
5386
  isChange: function isChange(ctx, value) {
5375
5387
  return JSON.stringify(this.getFormData(ctx), strFn) !== JSON.stringify(value, strFn);
@@ -5378,11 +5390,11 @@ function useInput(Handler) {
5378
5390
  return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
5379
5391
  },
5380
5392
  refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
5381
- var _this3 = this;
5393
+ var _this4 = this;
5382
5394
 
5383
5395
  if (is.Function(ctx.rule.update)) {
5384
5396
  var state = invoke(function () {
5385
- return ctx.rule.update(val, ctx.origin, _this3.api, {
5397
+ return ctx.rule.update(val, ctx.origin, _this4.api, {
5386
5398
  origin: origin || 'change',
5387
5399
  linkField: field
5388
5400
  });
@@ -5406,18 +5418,18 @@ function useInput(Handler) {
5406
5418
  this.refreshUpdate(ctx, val, origin, field);
5407
5419
  },
5408
5420
  appendLink: function appendLink(ctx) {
5409
- var _this4 = this;
5421
+ var _this5 = this;
5410
5422
 
5411
5423
  var link = ctx.rule.link;
5412
5424
  is.trueArray(link) && link.forEach(function (field) {
5413
5425
  var fn = function fn() {
5414
- return _this4.refreshRule(ctx, ctx.rule.value, 'link', field);
5426
+ return _this5.refreshRule(ctx, ctx.rule.value, 'link', field);
5415
5427
  };
5416
5428
 
5417
- _this4.bus.$on('change-' + field, fn);
5429
+ _this5.bus.$on('change-' + field, fn);
5418
5430
 
5419
5431
  ctx.linkOn.push(function () {
5420
- return _this4.bus.$off('change-' + field, fn);
5432
+ return _this5.bus.$off('change-' + field, fn);
5421
5433
  });
5422
5434
  });
5423
5435
  },
@@ -6093,6 +6105,7 @@ function Handler(fc) {
6093
6105
  subForm: {},
6094
6106
  form: reactive({}),
6095
6107
  appendData: {},
6108
+ ignoreFields: [],
6096
6109
  providers: {},
6097
6110
  cycleLoad: null,
6098
6111
  loadedId: 1,
@@ -8373,7 +8386,7 @@ function install(FormCreate) {
8373
8386
  function elmFormCreate() {
8374
8387
  return FormCreateFactory({
8375
8388
  ui: 'element-ui',
8376
- version: '3.2.11',
8389
+ version: '3.2.12',
8377
8390
  manager: manager,
8378
8391
  extendApi: extendApi,
8379
8392
  install: install,