@form-create/element-ui 3.1.24 → 3.1.26

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.1.24
2
+ * @form-create/element-ui v3.1.26
3
3
  * (c) 2018-2023 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -350,7 +350,7 @@
350
350
  }
351
351
  }
352
352
 
353
- var css_248z$3 = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-icon{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}";
353
+ var css_248z$3 = "._fc-frame ._fc-files img{display:inline-block;height:100%;vertical-align:top;width:100%}._fc-frame ._fc-upload-btn{border:1px dashed #c0ccda;cursor:pointer}._fc-frame._fc-disabled ._fc-upload-btn,._fc-frame._fc-disabled .el-button{color:#999;cursor:not-allowed!important}._fc-frame ._fc-upload-cover{background:rgba(0,0,0,.6);bottom:0;left:0;opacity:0;position:absolute;right:0;top:0;-webkit-transition:opacity .3s;-o-transition:opacity .3s;transition:opacity .3s}._fc-frame ._fc-upload-cover i{color:#fff;cursor:pointer;font-size:20px;margin:0 2px}._fc-frame ._fc-files:hover ._fc-upload-cover{opacity:1}._fc-frame .el-upload{display:block}._fc-frame ._fc-upload-icon{cursor:pointer}._fc-files,._fc-frame ._fc-upload-btn{background:#fff;border:1px solid #c0ccda;border-radius:4px;-webkit-box-shadow:2px 2px 5px rgba(0,0,0,.1);box-shadow:2px 2px 5px rgba(0,0,0,.1);-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;height:58px;line-height:58px;margin-right:4px;overflow:hidden;position:relative;text-align:center;width:58px}";
354
354
  styleInject(css_248z$3);
355
355
 
356
356
  var script$6 = {
@@ -649,7 +649,7 @@
649
649
  }, null);
650
650
  },
651
651
  suffix: function suffix() {
652
- return _this.fileList.length ? vue.createVNode(vue.resolveComponent("ElIcon"), {
652
+ return _this.fileList.length && !_this.disabled ? vue.createVNode(vue.resolveComponent("ElIcon"), {
653
653
  "class": "el-input__icon _fc-upload-icon",
654
654
  "onClick": function onClick() {
655
655
  _this.fileList = [];
@@ -892,7 +892,10 @@
892
892
  }
893
893
  });
894
894
  return vue.createVNode("div", {
895
- "class": "_fc-frame"
895
+ "class": {
896
+ '_fc-frame': true,
897
+ '_fc-disabled': this.disabled
898
+ }
896
899
  }, [node, vue.createVNode(vue.resolveComponent("ElDialog"), {
897
900
  "appendToBody": true,
898
901
  "modal": this.previewMask,
@@ -1016,6 +1019,48 @@
1016
1019
  }
1017
1020
  });
1018
1021
 
1022
+ var is = {
1023
+ type: function type(arg, _type) {
1024
+ return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
1025
+ },
1026
+ Undef: function Undef(v) {
1027
+ return v === undefined || v === null;
1028
+ },
1029
+ Element: function Element(arg) {
1030
+ return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
1031
+ },
1032
+ trueArray: function trueArray(data) {
1033
+ return Array.isArray(data) && data.length > 0;
1034
+ },
1035
+ Function: function Function(v) {
1036
+ var type = this.getType(v);
1037
+ return type === 'Function' || type === 'AsyncFunction';
1038
+ },
1039
+ getType: function getType(v) {
1040
+ var str = Object.prototype.toString.call(v);
1041
+ return /^\[object (.*)\]$/.exec(str)[1];
1042
+ },
1043
+ empty: function empty(value) {
1044
+ if (value === undefined || value === null) {
1045
+ return true;
1046
+ }
1047
+
1048
+ if (Array.isArray(value) && Array.isArray(value) && !value.length) {
1049
+ return true;
1050
+ }
1051
+
1052
+ return typeof value === 'string' && !value;
1053
+ }
1054
+ };
1055
+ ['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1056
+ is[t] = function (arg) {
1057
+ return is.type(arg, t);
1058
+ };
1059
+ });
1060
+ function hasProperty(rule, k) {
1061
+ return {}.hasOwnProperty.call(rule, k);
1062
+ }
1063
+
1019
1064
  var NAME$6 = 'fcSelect';
1020
1065
  var Select = vue.defineComponent({
1021
1066
  name: NAME$6,
@@ -1047,6 +1092,26 @@
1047
1092
  _this$$slots$default,
1048
1093
  _this$$slots;
1049
1094
 
1095
+ var makeOption = function makeOption(props, index) {
1096
+ return vue.createVNode(vue.resolveComponent("ElOption"), vue.mergeProps(props, {
1097
+ "key": '' + index + '-' + props.value
1098
+ }), null);
1099
+ };
1100
+
1101
+ var makeOptionGroup = function makeOptionGroup(props, index) {
1102
+ return vue.createVNode(vue.resolveComponent("ElOptionGroup"), {
1103
+ "label": props.label,
1104
+ "key": '' + index + '-' + props.label
1105
+ }, {
1106
+ "default": function _default() {
1107
+ return [is.trueArray(props.options) && props.options.map(function (v, index) {
1108
+ return makeOption(v, index);
1109
+ })];
1110
+ }
1111
+ });
1112
+ };
1113
+
1114
+ var options = this.options();
1050
1115
  return vue.createVNode(vue.resolveComponent("ElSelect"), vue.mergeProps(this.$attrs, {
1051
1116
  "modelValue": this.value,
1052
1117
  "onUpdate:modelValue": function onUpdateModelValue(v) {
@@ -1055,10 +1120,8 @@
1055
1120
  "ref": "el"
1056
1121
  }), _objectSpread2({
1057
1122
  "default": function _default() {
1058
- return [_this.options().map(function (props, index) {
1059
- return vue.createVNode(vue.resolveComponent("ElOption"), vue.mergeProps(props, {
1060
- "key": '' + index + '-' + props.value
1061
- }), null);
1123
+ return [options.map(function (props, index) {
1124
+ return hasProperty(props || '', 'options') ? makeOptionGroup(props, index) : makeOption(props, index);
1062
1125
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1063
1126
  }
1064
1127
  }, getSlot(this.$slots, ['default'])));
@@ -1133,7 +1196,7 @@
1133
1196
  }
1134
1197
  });
1135
1198
 
1136
- var css_248z$2 = "._fc-exceed .el-upload{display:none}";
1199
+ var css_248z$2 = "._fc-exceed .el-upload{display:none}.el-upload-list.is-disabled .el-upload{cursor:not-allowed!important}";
1137
1200
  styleInject(css_248z$2);
1138
1201
 
1139
1202
  var script$1 = {
@@ -1282,48 +1345,6 @@
1282
1345
  }
1283
1346
  });
1284
1347
 
1285
- var is = {
1286
- type: function type(arg, _type) {
1287
- return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
1288
- },
1289
- Undef: function Undef(v) {
1290
- return v === undefined || v === null;
1291
- },
1292
- Element: function Element(arg) {
1293
- return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
1294
- },
1295
- trueArray: function trueArray(data) {
1296
- return Array.isArray(data) && data.length > 0;
1297
- },
1298
- Function: function Function(v) {
1299
- var type = this.getType(v);
1300
- return type === 'Function' || type === 'AsyncFunction';
1301
- },
1302
- getType: function getType(v) {
1303
- var str = Object.prototype.toString.call(v);
1304
- return /^\[object (.*)\]$/.exec(str)[1];
1305
- },
1306
- empty: function empty(value) {
1307
- if (value === undefined || value === null) {
1308
- return true;
1309
- }
1310
-
1311
- if (Array.isArray(value) && Array.isArray(value) && !value.length) {
1312
- return true;
1313
- }
1314
-
1315
- return typeof value === 'string' && !value;
1316
- }
1317
- };
1318
- ['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1319
- is[t] = function (arg) {
1320
- return is.type(arg, t);
1321
- };
1322
- });
1323
- function hasProperty(rule, k) {
1324
- return {}.hasOwnProperty.call(rule, k);
1325
- }
1326
-
1327
1348
  function $set(target, field, value) {
1328
1349
  target[field] = value;
1329
1350
  }
@@ -3785,6 +3806,8 @@
3785
3806
 
3786
3807
  onLoad && onLoad(value);
3787
3808
  _this2.$api && _this2.$api.sync(_this2.rule);
3809
+ })["catch"](function (e) {
3810
+ console.error(e);
3788
3811
  });
3789
3812
  value = def;
3790
3813
  this.setPending(key, origin, value);
@@ -3936,7 +3959,8 @@
3936
3959
  vm: handle.vm,
3937
3960
  trueType: handle.getType(this.originType),
3938
3961
  vNode: handle.$render.vNode,
3939
- updated: false
3962
+ updated: false,
3963
+ cacheValue: this.rule.value
3940
3964
  });
3941
3965
  !init && this.unwatch();
3942
3966
  this.watchTo();
@@ -5478,6 +5502,15 @@
5478
5502
  function run(inject, rule, api) {
5479
5503
  var option = inject.value;
5480
5504
 
5505
+ var set = function set(val) {
5506
+ if (val === undefined) {
5507
+ inject.clearProp();
5508
+ api.sync(rule);
5509
+ } else {
5510
+ deepSet(inject.getProp(), option.to || 'options', val);
5511
+ }
5512
+ };
5513
+
5481
5514
  if (is.Function(option)) {
5482
5515
  option = option(rule, api);
5483
5516
  }
@@ -5485,7 +5518,8 @@
5485
5518
  option = parseOpt(option);
5486
5519
 
5487
5520
  if (!option || !option.action) {
5488
- return false;
5521
+ set(undefined);
5522
+ return;
5489
5523
  }
5490
5524
 
5491
5525
  if (!option.to) {
@@ -5502,55 +5536,65 @@
5502
5536
  }
5503
5537
  };
5504
5538
 
5505
- var set = function set(val) {
5506
- if (val === undefined) {
5507
- inject.clearProp();
5508
- api.sync(rule);
5509
- } else {
5510
- deepSet(inject.getProp(), option.to, val);
5511
- }
5512
- };
5539
+ var config = _objectSpread2(_objectSpread2({
5540
+ headers: {}
5541
+ }, option), {}, {
5542
+ onSuccess: function onSuccess(body, flag) {
5543
+ if (check()) return;
5513
5544
 
5514
- invoke(function () {
5515
- return fc.create.fetch(_objectSpread2(_objectSpread2({}, option), {}, {
5516
- onSuccess: function onSuccess(body) {
5517
- if (check()) return;
5545
+ var fn = function fn(v) {
5546
+ return flag ? v : v.data;
5547
+ };
5518
5548
 
5519
- var fn = function fn(v) {
5520
- return v.data;
5549
+ if (is.Function(option.parse)) {
5550
+ fn = option.parse;
5551
+ } else if (option.parse && is.String(option.parse)) {
5552
+ fn = function fn(v) {
5553
+ option.parse.split('.').forEach(function (k) {
5554
+ if (v) {
5555
+ v = v[k];
5556
+ }
5557
+ });
5558
+ return v;
5521
5559
  };
5560
+ }
5522
5561
 
5523
- if (is.Function(option.parse)) {
5524
- fn = option.parse;
5525
- } else if (option.parse && is.String(option.parse)) {
5526
- fn = function fn(v) {
5527
- option.parse.split('.').forEach(function (k) {
5528
- if (v) {
5529
- v = v[k];
5530
- }
5531
- });
5532
- return v;
5533
- };
5534
- }
5562
+ set(fn(body, rule, api));
5563
+ api.sync(rule);
5564
+ },
5565
+ onError: function onError(e) {
5566
+ set(undefined);
5567
+ if (check()) return;
5535
5568
 
5536
- set(fn(body, rule, api));
5537
- api.sync(rule);
5538
- },
5539
- onError: function onError(e) {
5540
- set(undefined);
5541
- if (check()) return;
5569
+ (_onError || function (e) {
5570
+ return err(e.message || 'fetch fail ' + option.action);
5571
+ })(e, rule, api);
5572
+ }
5573
+ });
5542
5574
 
5543
- (_onError || function (e) {
5544
- return err(e.message || 'fetch fail ' + option.action);
5545
- })(e, rule, api);
5546
- }
5547
- }), {
5575
+ fc.options.beforeFetch && invoke(function () {
5576
+ return fc.options.beforeFetch(config, {
5577
+ rule: rule,
5578
+ api: api
5579
+ });
5580
+ });
5581
+
5582
+ if (is.Function(option.action)) {
5583
+ option.action(rule, api).then(function (val) {
5584
+ config.onSuccess(val, true);
5585
+ })["catch"](function (e) {
5586
+ config.onError(e);
5587
+ });
5588
+ return;
5589
+ }
5590
+
5591
+ invoke(function () {
5592
+ return fc.create.fetch(config, {
5548
5593
  inject: inject,
5549
5594
  rule: rule,
5550
5595
  api: api
5551
5596
  });
5552
5597
  });
5553
- return true;
5554
5598
  }
5555
5599
 
5556
5600
  return {
@@ -5558,11 +5602,8 @@
5558
5602
  loaded: function loaded() {
5559
5603
  run.apply(void 0, arguments);
5560
5604
  },
5561
- watch: function watch(inject, rule, api) {
5562
- if (!run(inject, rule, api)) {
5563
- inject.clearProp();
5564
- api.sync(rule);
5565
- }
5605
+ watch: function watch() {
5606
+ run.apply(void 0, arguments);
5566
5607
  }
5567
5608
  };
5568
5609
  };
@@ -6540,7 +6581,7 @@
6540
6581
  on: {
6541
6582
  click: function click() {
6542
6583
  var fApi = _this6.$handle.api;
6543
- _this6.options.submitBtn.click ? _this6.options.submitBtn.click(fApi) : fApi.submit();
6584
+ _this6.options.submitBtn.click ? _this6.options.submitBtn.click(fApi) : fApi.submit()["catch"](function () {});
6544
6585
  }
6545
6586
  },
6546
6587
  key: "".concat(this.key, "b1")
@@ -6883,7 +6924,7 @@
6883
6924
  function elmFormCreate() {
6884
6925
  return FormCreateFactory({
6885
6926
  ui: 'element-ui',
6886
- version: '3.1.24',
6927
+ version: '3.1.26',
6887
6928
  manager: manager,
6888
6929
  extendApi: extendApi,
6889
6930
  install: install,