@form-create/element-ui 3.2.11 → 3.2.13

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.13
3
3
  * (c) 2018-2024 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -1325,13 +1325,25 @@
1325
1325
  script$1.render = render$1;
1326
1326
 
1327
1327
  function parseFile(file, i) {
1328
+ if (_typeof(file) === 'object') {
1329
+ return file;
1330
+ }
1331
+
1328
1332
  return {
1329
1333
  url: file,
1334
+ is_string: true,
1330
1335
  name: getFileName(file),
1331
1336
  uid: i
1332
1337
  };
1333
1338
  }
1334
1339
 
1340
+ function parseUpload(file) {
1341
+ return _objectSpread2(_objectSpread2({}, file), {}, {
1342
+ file: file,
1343
+ value: file
1344
+ });
1345
+ }
1346
+
1335
1347
  function getFileName(file) {
1336
1348
  return ('' + file).split('/').pop();
1337
1349
  }
@@ -1364,11 +1376,11 @@
1364
1376
  };
1365
1377
  },
1366
1378
  created: function created() {
1367
- this.fileList = toArray(this.modelValue).map(parseFile);
1379
+ this.fileList = toArray(this.modelValue).map(parseFile).map(parseUpload);
1368
1380
  },
1369
1381
  watch: {
1370
1382
  modelValue: function modelValue(n) {
1371
- this.fileList = toArray(n).map(parseFile);
1383
+ this.fileList = toArray(n).map(parseFile).map(parseUpload);
1372
1384
  }
1373
1385
  },
1374
1386
  methods: {
@@ -1385,8 +1397,8 @@
1385
1397
  }
1386
1398
  },
1387
1399
  update: function update(fileList) {
1388
- var files = fileList.map(function (file) {
1389
- return file.url;
1400
+ var files = fileList.map(function (v) {
1401
+ return v.is_string ? v.url : v.value || v.url;
1390
1402
  }).filter(function (url) {
1391
1403
  return url !== undefined;
1392
1404
  });
@@ -3077,14 +3089,13 @@
3077
3089
 
3078
3090
  formData: function formData(fields) {
3079
3091
  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) : {});
3092
+ var data = {};
3093
+ Object.keys(h.form).forEach(function (k) {
3094
+ if (h.ignoreFields.indexOf(k) === -1) {
3095
+ data[k] = copy(h.form[k]);
3096
+ }
3097
+ });
3098
+ return data;
3088
3099
  } else {
3089
3100
  return tidyFields(fields).reduce(function (initial, id) {
3090
3101
  initial[id] = api.getValue(id);
@@ -5090,9 +5101,9 @@
5090
5101
  __ctrl: true,
5091
5102
  children: rule,
5092
5103
  valid: valid
5093
- }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
5104
+ }) : ctrl && ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl) >>> 0, 1);
5094
5105
  hideLst[valid ? 'push' : 'unshift'](function () {
5095
- if (method === 'disabled') {
5106
+ if (method === 'disabled' || method === 'enabled') {
5096
5107
  _this7.api.disabled(!valid, rule);
5097
5108
  } else if (method === 'display') {
5098
5109
  _this7.api.display(valid, rule);
@@ -5312,6 +5323,7 @@
5312
5323
 
5313
5324
  var data = vue.reactive({});
5314
5325
  var fields = this.fields();
5326
+ var ignoreFields = [];
5315
5327
 
5316
5328
  if (this.options.appendValue !== false) {
5317
5329
  Object.keys(this.appendData).reduce(function (initial, field) {
@@ -5324,19 +5336,23 @@
5324
5336
  }
5325
5337
 
5326
5338
  fields.reduce(function (initial, field) {
5327
- var ctx = _this2.getCtx(field);
5339
+ var ctx = (_this2.fieldCtx[field] || []).filter(function (ctx) {
5340
+ return !_this2.isIgnore(ctx.rule);
5341
+ })[0] || _this2.fieldCtx[field][0];
5328
5342
 
5329
- if (!_this2.isIgnore(ctx.rule)) {
5330
- initial[field] = vue.toRef(ctx.rule, 'value');
5343
+ if (_this2.isIgnore(ctx.rule)) {
5344
+ ignoreFields.push(field);
5331
5345
  }
5332
5346
 
5347
+ initial[field] = vue.toRef(ctx.rule, 'value');
5333
5348
  return initial;
5334
5349
  }, data);
5335
5350
  this.form = data;
5351
+ this.ignoreFields = ignoreFields;
5336
5352
  this.syncValue();
5337
5353
  },
5338
5354
  isIgnore: function isIgnore(rule) {
5339
- return rule.ignore || this.options.ignoreHiddenFields && rule.hidden;
5355
+ return rule.ignore === true || rule.ignore === 'hidden' && rule.hidden || this.options.ignoreHiddenFields && rule.hidden;
5340
5356
  },
5341
5357
  appendValue: function appendValue(rule) {
5342
5358
  if ((!rule.field || !hasProperty(this.appendData, rule.field)) && !this.options.forceCoverValue) {
@@ -5369,11 +5385,19 @@
5369
5385
  }
5370
5386
  },
5371
5387
  syncValue: function syncValue() {
5388
+ var _this3 = this;
5389
+
5372
5390
  if (this.deferSyncFn) {
5373
5391
  return this.deferSyncFn.sync = true;
5374
5392
  }
5375
5393
 
5376
- this.vm.setupState.updateValue(_objectSpread2({}, this.form));
5394
+ var data = {};
5395
+ Object.keys(this.form).forEach(function (k) {
5396
+ if (_this3.ignoreFields.indexOf(k) === -1) {
5397
+ data[k] = _this3.form[k];
5398
+ }
5399
+ });
5400
+ this.vm.setupState.updateValue(data);
5377
5401
  },
5378
5402
  isChange: function isChange(ctx, value) {
5379
5403
  return JSON.stringify(this.getFormData(ctx), strFn) !== JSON.stringify(value, strFn);
@@ -5382,11 +5406,11 @@
5382
5406
  return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
5383
5407
  },
5384
5408
  refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
5385
- var _this3 = this;
5409
+ var _this4 = this;
5386
5410
 
5387
5411
  if (is.Function(ctx.rule.update)) {
5388
5412
  var state = invoke(function () {
5389
- return ctx.rule.update(val, ctx.origin, _this3.api, {
5413
+ return ctx.rule.update(val, ctx.origin, _this4.api, {
5390
5414
  origin: origin || 'change',
5391
5415
  linkField: field
5392
5416
  });
@@ -5410,18 +5434,18 @@
5410
5434
  this.refreshUpdate(ctx, val, origin, field);
5411
5435
  },
5412
5436
  appendLink: function appendLink(ctx) {
5413
- var _this4 = this;
5437
+ var _this5 = this;
5414
5438
 
5415
5439
  var link = ctx.rule.link;
5416
5440
  is.trueArray(link) && link.forEach(function (field) {
5417
5441
  var fn = function fn() {
5418
- return _this4.refreshRule(ctx, ctx.rule.value, 'link', field);
5442
+ return _this5.refreshRule(ctx, ctx.rule.value, 'link', field);
5419
5443
  };
5420
5444
 
5421
- _this4.bus.$on('change-' + field, fn);
5445
+ _this5.bus.$on('change-' + field, fn);
5422
5446
 
5423
5447
  ctx.linkOn.push(function () {
5424
- return _this4.bus.$off('change-' + field, fn);
5448
+ return _this5.bus.$off('change-' + field, fn);
5425
5449
  });
5426
5450
  });
5427
5451
  },
@@ -5579,7 +5603,7 @@
5579
5603
  _this.$render.clearCacheAll();
5580
5604
  }
5581
5605
 
5582
- if (key === 'ignore' && ctx.input || key === 'hidden' && ctx.input && _this.options.ignoreHiddenFields) {
5606
+ if (key === 'ignore' && ctx.input || key === 'hidden' && ctx.input && (ctx.rule.ignore === 'hidden' || _this.options.ignoreHiddenFields)) {
5583
5607
  _this.syncForm();
5584
5608
  } else if (key === 'link') {
5585
5609
  ctx.link();
@@ -6097,6 +6121,7 @@
6097
6121
  subForm: {},
6098
6122
  form: vue.reactive({}),
6099
6123
  appendData: {},
6124
+ ignoreFields: [],
6100
6125
  providers: {},
6101
6126
  cycleLoad: null,
6102
6127
  loadedId: 1,
@@ -7499,6 +7524,7 @@
7499
7524
  var DEFAULT_FORMATS = {
7500
7525
  date: 'YYYY-MM-DD',
7501
7526
  month: 'YYYY-MM',
7527
+ week: 'YYYY-wo',
7502
7528
  datetime: 'YYYY-MM-DD HH:mm:ss',
7503
7529
  timerange: 'HH:mm:ss',
7504
7530
  daterange: 'YYYY-MM-DD',
@@ -7828,7 +7854,7 @@
7828
7854
  ref: ref
7829
7855
  });
7830
7856
  extend(this.rule.props, {
7831
- model: _objectSpread2({}, $handle.formData)
7857
+ model: $handle.formData
7832
7858
  });
7833
7859
  },
7834
7860
  render: function render(children) {
@@ -8124,7 +8150,7 @@
8124
8150
  return maker;
8125
8151
  }
8126
8152
 
8127
- var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}.form-create .fc-none,.form-create.is-preview .el-form-item.is-required>.el-form-item__label-wrap>.el-form-item__label:before,.form-create.is-preview .el-form-item.is-required>.el-form-item__label:before,.form-create.is-preview .fc-clock{display:none!important}.fc-wrap-left .el-form-item__label{justify-content:flex-start;justify-content:flex-end}.fc-wrap-top.el-form-item{display:block}.fc-wrap-top.el-form-item .el-form-item__label{display:block;height:auto;line-height:22px;margin-bottom:8px;text-align:left}.el-form--large .fc-wrap-top.el-form-item .el-form-item__label{line-height:22px;margin-bottom:12px}.el-form--default .fc-wrap-top.el-form-item .el-form-item__label{line-height:22px;margin-bottom:8px}.el-form--small .fc-wrap-top.el-form-item .el-form-item__label{line-height:20px;margin-bottom:4px}";
8153
+ var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}.form-create .fc-none,.form-create.is-preview .el-form-item.is-required>.el-form-item__label-wrap>.el-form-item__label:before,.form-create.is-preview .el-form-item.is-required>.el-form-item__label:before,.form-create.is-preview .fc-clock{display:none!important}.fc-wrap-right .el-form-item__label{justify-content:flex-end}.fc-wrap-left .el-form-item__label{justify-content:flex-start}.fc-wrap-top.el-form-item{display:block}.fc-wrap-top.el-form-item .el-form-item__label{display:block;height:auto;line-height:22px;margin-bottom:8px;text-align:left}.el-form--large .fc-wrap-top.el-form-item .el-form-item__label{line-height:22px;margin-bottom:12px}.el-form--default .fc-wrap-top.el-form-item .el-form-item__label{line-height:22px;margin-bottom:8px}.el-form--small .fc-wrap-top.el-form-item .el-form-item__label{line-height:20px;margin-bottom:4px}";
8128
8154
  styleInject(css_248z);
8129
8155
 
8130
8156
  function tidyBtnProp(btn, def) {
@@ -8377,7 +8403,7 @@
8377
8403
  function elmFormCreate() {
8378
8404
  return FormCreateFactory({
8379
8405
  ui: 'element-ui',
8380
- version: '3.2.11',
8406
+ version: '3.2.13',
8381
8407
  manager: manager,
8382
8408
  extendApi: extendApi,
8383
8409
  install: install,