@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.
@@ -1321,13 +1321,25 @@ function render$1(_ctx, _cache, $props, $setup, $data, $options) {
1321
1321
  script$1.render = render$1;
1322
1322
 
1323
1323
  function parseFile(file, i) {
1324
+ if (_typeof(file) === 'object') {
1325
+ return file;
1326
+ }
1327
+
1324
1328
  return {
1325
1329
  url: file,
1330
+ is_string: true,
1326
1331
  name: getFileName(file),
1327
1332
  uid: i
1328
1333
  };
1329
1334
  }
1330
1335
 
1336
+ function parseUpload(file) {
1337
+ return _objectSpread2(_objectSpread2({}, file), {}, {
1338
+ file: file,
1339
+ value: file
1340
+ });
1341
+ }
1342
+
1331
1343
  function getFileName(file) {
1332
1344
  return ('' + file).split('/').pop();
1333
1345
  }
@@ -1360,11 +1372,11 @@ var Upload = defineComponent({
1360
1372
  };
1361
1373
  },
1362
1374
  created: function created() {
1363
- this.fileList = toArray(this.modelValue).map(parseFile);
1375
+ this.fileList = toArray(this.modelValue).map(parseFile).map(parseUpload);
1364
1376
  },
1365
1377
  watch: {
1366
1378
  modelValue: function modelValue(n) {
1367
- this.fileList = toArray(n).map(parseFile);
1379
+ this.fileList = toArray(n).map(parseFile).map(parseUpload);
1368
1380
  }
1369
1381
  },
1370
1382
  methods: {
@@ -1381,8 +1393,8 @@ var Upload = defineComponent({
1381
1393
  }
1382
1394
  },
1383
1395
  update: function update(fileList) {
1384
- var files = fileList.map(function (file) {
1385
- return file.url;
1396
+ var files = fileList.map(function (v) {
1397
+ return v.is_string ? v.url : v.value || v.url;
1386
1398
  }).filter(function (url) {
1387
1399
  return url !== undefined;
1388
1400
  });
@@ -3073,14 +3085,13 @@ function Api(h) {
3073
3085
 
3074
3086
  formData: function formData(fields) {
3075
3087
  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) : {});
3088
+ var data = {};
3089
+ Object.keys(h.form).forEach(function (k) {
3090
+ if (h.ignoreFields.indexOf(k) === -1) {
3091
+ data[k] = copy(h.form[k]);
3092
+ }
3093
+ });
3094
+ return data;
3084
3095
  } else {
3085
3096
  return tidyFields(fields).reduce(function (initial, id) {
3086
3097
  initial[id] = api.getValue(id);
@@ -5086,9 +5097,9 @@ function useLoader(Handler) {
5086
5097
  __ctrl: true,
5087
5098
  children: rule,
5088
5099
  valid: valid
5089
- }) : ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl), 1);
5100
+ }) : ctrl && ctx.ctrlRule.splice(ctx.ctrlRule.indexOf(ctrl) >>> 0, 1);
5090
5101
  hideLst[valid ? 'push' : 'unshift'](function () {
5091
- if (method === 'disabled') {
5102
+ if (method === 'disabled' || method === 'enabled') {
5092
5103
  _this7.api.disabled(!valid, rule);
5093
5104
  } else if (method === 'display') {
5094
5105
  _this7.api.display(valid, rule);
@@ -5308,6 +5319,7 @@ function useInput(Handler) {
5308
5319
 
5309
5320
  var data = reactive({});
5310
5321
  var fields = this.fields();
5322
+ var ignoreFields = [];
5311
5323
 
5312
5324
  if (this.options.appendValue !== false) {
5313
5325
  Object.keys(this.appendData).reduce(function (initial, field) {
@@ -5320,19 +5332,23 @@ function useInput(Handler) {
5320
5332
  }
5321
5333
 
5322
5334
  fields.reduce(function (initial, field) {
5323
- var ctx = _this2.getCtx(field);
5335
+ var ctx = (_this2.fieldCtx[field] || []).filter(function (ctx) {
5336
+ return !_this2.isIgnore(ctx.rule);
5337
+ })[0] || _this2.fieldCtx[field][0];
5324
5338
 
5325
- if (!_this2.isIgnore(ctx.rule)) {
5326
- initial[field] = toRef(ctx.rule, 'value');
5339
+ if (_this2.isIgnore(ctx.rule)) {
5340
+ ignoreFields.push(field);
5327
5341
  }
5328
5342
 
5343
+ initial[field] = toRef(ctx.rule, 'value');
5329
5344
  return initial;
5330
5345
  }, data);
5331
5346
  this.form = data;
5347
+ this.ignoreFields = ignoreFields;
5332
5348
  this.syncValue();
5333
5349
  },
5334
5350
  isIgnore: function isIgnore(rule) {
5335
- return rule.ignore || this.options.ignoreHiddenFields && rule.hidden;
5351
+ return rule.ignore === true || rule.ignore === 'hidden' && rule.hidden || this.options.ignoreHiddenFields && rule.hidden;
5336
5352
  },
5337
5353
  appendValue: function appendValue(rule) {
5338
5354
  if ((!rule.field || !hasProperty(this.appendData, rule.field)) && !this.options.forceCoverValue) {
@@ -5365,11 +5381,19 @@ function useInput(Handler) {
5365
5381
  }
5366
5382
  },
5367
5383
  syncValue: function syncValue() {
5384
+ var _this3 = this;
5385
+
5368
5386
  if (this.deferSyncFn) {
5369
5387
  return this.deferSyncFn.sync = true;
5370
5388
  }
5371
5389
 
5372
- this.vm.setupState.updateValue(_objectSpread2({}, this.form));
5390
+ var data = {};
5391
+ Object.keys(this.form).forEach(function (k) {
5392
+ if (_this3.ignoreFields.indexOf(k) === -1) {
5393
+ data[k] = _this3.form[k];
5394
+ }
5395
+ });
5396
+ this.vm.setupState.updateValue(data);
5373
5397
  },
5374
5398
  isChange: function isChange(ctx, value) {
5375
5399
  return JSON.stringify(this.getFormData(ctx), strFn) !== JSON.stringify(value, strFn);
@@ -5378,11 +5402,11 @@ function useInput(Handler) {
5378
5402
  return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
5379
5403
  },
5380
5404
  refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
5381
- var _this3 = this;
5405
+ var _this4 = this;
5382
5406
 
5383
5407
  if (is.Function(ctx.rule.update)) {
5384
5408
  var state = invoke(function () {
5385
- return ctx.rule.update(val, ctx.origin, _this3.api, {
5409
+ return ctx.rule.update(val, ctx.origin, _this4.api, {
5386
5410
  origin: origin || 'change',
5387
5411
  linkField: field
5388
5412
  });
@@ -5406,18 +5430,18 @@ function useInput(Handler) {
5406
5430
  this.refreshUpdate(ctx, val, origin, field);
5407
5431
  },
5408
5432
  appendLink: function appendLink(ctx) {
5409
- var _this4 = this;
5433
+ var _this5 = this;
5410
5434
 
5411
5435
  var link = ctx.rule.link;
5412
5436
  is.trueArray(link) && link.forEach(function (field) {
5413
5437
  var fn = function fn() {
5414
- return _this4.refreshRule(ctx, ctx.rule.value, 'link', field);
5438
+ return _this5.refreshRule(ctx, ctx.rule.value, 'link', field);
5415
5439
  };
5416
5440
 
5417
- _this4.bus.$on('change-' + field, fn);
5441
+ _this5.bus.$on('change-' + field, fn);
5418
5442
 
5419
5443
  ctx.linkOn.push(function () {
5420
- return _this4.bus.$off('change-' + field, fn);
5444
+ return _this5.bus.$off('change-' + field, fn);
5421
5445
  });
5422
5446
  });
5423
5447
  },
@@ -5575,7 +5599,7 @@ function useContext(Handler) {
5575
5599
  _this.$render.clearCacheAll();
5576
5600
  }
5577
5601
 
5578
- if (key === 'ignore' && ctx.input || key === 'hidden' && ctx.input && _this.options.ignoreHiddenFields) {
5602
+ if (key === 'ignore' && ctx.input || key === 'hidden' && ctx.input && (ctx.rule.ignore === 'hidden' || _this.options.ignoreHiddenFields)) {
5579
5603
  _this.syncForm();
5580
5604
  } else if (key === 'link') {
5581
5605
  ctx.link();
@@ -6093,6 +6117,7 @@ function Handler(fc) {
6093
6117
  subForm: {},
6094
6118
  form: reactive({}),
6095
6119
  appendData: {},
6120
+ ignoreFields: [],
6096
6121
  providers: {},
6097
6122
  cycleLoad: null,
6098
6123
  loadedId: 1,
@@ -7495,6 +7520,7 @@ function FormCreateFactory(config) {
7495
7520
  var DEFAULT_FORMATS = {
7496
7521
  date: 'YYYY-MM-DD',
7497
7522
  month: 'YYYY-MM',
7523
+ week: 'YYYY-wo',
7498
7524
  datetime: 'YYYY-MM-DD HH:mm:ss',
7499
7525
  timerange: 'HH:mm:ss',
7500
7526
  daterange: 'YYYY-MM-DD',
@@ -7824,7 +7850,7 @@ var manager = {
7824
7850
  ref: ref
7825
7851
  });
7826
7852
  extend(this.rule.props, {
7827
- model: _objectSpread2({}, $handle.formData)
7853
+ model: $handle.formData
7828
7854
  });
7829
7855
  },
7830
7856
  render: function render(children) {
@@ -8120,7 +8146,7 @@ function useFrame(maker) {
8120
8146
  return maker;
8121
8147
  }
8122
8148
 
8123
- 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}";
8149
+ 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}";
8124
8150
  styleInject(css_248z);
8125
8151
 
8126
8152
  function tidyBtnProp(btn, def) {
@@ -8373,7 +8399,7 @@ function install(FormCreate) {
8373
8399
  function elmFormCreate() {
8374
8400
  return FormCreateFactory({
8375
8401
  ui: 'element-ui',
8376
- version: '3.2.11',
8402
+ version: '3.2.13',
8377
8403
  manager: manager,
8378
8404
  extendApi: extendApi,
8379
8405
  install: install,