@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.
@@ -346,7 +346,7 @@ function styleInject(css, ref) {
346
346
  }
347
347
  }
348
348
 
349
- 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}";
349
+ 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}";
350
350
  styleInject(css_248z$3);
351
351
 
352
352
  var script$6 = {
@@ -645,7 +645,7 @@ var Frame = defineComponent({
645
645
  }, null);
646
646
  },
647
647
  suffix: function suffix() {
648
- return _this.fileList.length ? createVNode(resolveComponent("ElIcon"), {
648
+ return _this.fileList.length && !_this.disabled ? createVNode(resolveComponent("ElIcon"), {
649
649
  "class": "el-input__icon _fc-upload-icon",
650
650
  "onClick": function onClick() {
651
651
  _this.fileList = [];
@@ -888,7 +888,10 @@ var Frame = defineComponent({
888
888
  }
889
889
  });
890
890
  return createVNode("div", {
891
- "class": "_fc-frame"
891
+ "class": {
892
+ '_fc-frame': true,
893
+ '_fc-disabled': this.disabled
894
+ }
892
895
  }, [node, createVNode(resolveComponent("ElDialog"), {
893
896
  "appendToBody": true,
894
897
  "modal": this.previewMask,
@@ -1012,6 +1015,48 @@ var Radio = defineComponent({
1012
1015
  }
1013
1016
  });
1014
1017
 
1018
+ var is = {
1019
+ type: function type(arg, _type) {
1020
+ return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
1021
+ },
1022
+ Undef: function Undef(v) {
1023
+ return v === undefined || v === null;
1024
+ },
1025
+ Element: function Element(arg) {
1026
+ return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
1027
+ },
1028
+ trueArray: function trueArray(data) {
1029
+ return Array.isArray(data) && data.length > 0;
1030
+ },
1031
+ Function: function Function(v) {
1032
+ var type = this.getType(v);
1033
+ return type === 'Function' || type === 'AsyncFunction';
1034
+ },
1035
+ getType: function getType(v) {
1036
+ var str = Object.prototype.toString.call(v);
1037
+ return /^\[object (.*)\]$/.exec(str)[1];
1038
+ },
1039
+ empty: function empty(value) {
1040
+ if (value === undefined || value === null) {
1041
+ return true;
1042
+ }
1043
+
1044
+ if (Array.isArray(value) && Array.isArray(value) && !value.length) {
1045
+ return true;
1046
+ }
1047
+
1048
+ return typeof value === 'string' && !value;
1049
+ }
1050
+ };
1051
+ ['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1052
+ is[t] = function (arg) {
1053
+ return is.type(arg, t);
1054
+ };
1055
+ });
1056
+ function hasProperty(rule, k) {
1057
+ return {}.hasOwnProperty.call(rule, k);
1058
+ }
1059
+
1015
1060
  var NAME$6 = 'fcSelect';
1016
1061
  var Select = defineComponent({
1017
1062
  name: NAME$6,
@@ -1043,6 +1088,26 @@ var Select = defineComponent({
1043
1088
  _this$$slots$default,
1044
1089
  _this$$slots;
1045
1090
 
1091
+ var makeOption = function makeOption(props, index) {
1092
+ return createVNode(resolveComponent("ElOption"), mergeProps$1(props, {
1093
+ "key": '' + index + '-' + props.value
1094
+ }), null);
1095
+ };
1096
+
1097
+ var makeOptionGroup = function makeOptionGroup(props, index) {
1098
+ return createVNode(resolveComponent("ElOptionGroup"), {
1099
+ "label": props.label,
1100
+ "key": '' + index + '-' + props.label
1101
+ }, {
1102
+ "default": function _default() {
1103
+ return [is.trueArray(props.options) && props.options.map(function (v, index) {
1104
+ return makeOption(v, index);
1105
+ })];
1106
+ }
1107
+ });
1108
+ };
1109
+
1110
+ var options = this.options();
1046
1111
  return createVNode(resolveComponent("ElSelect"), mergeProps$1(this.$attrs, {
1047
1112
  "modelValue": this.value,
1048
1113
  "onUpdate:modelValue": function onUpdateModelValue(v) {
@@ -1051,10 +1116,8 @@ var Select = defineComponent({
1051
1116
  "ref": "el"
1052
1117
  }), _objectSpread2({
1053
1118
  "default": function _default() {
1054
- return [_this.options().map(function (props, index) {
1055
- return createVNode(resolveComponent("ElOption"), mergeProps$1(props, {
1056
- "key": '' + index + '-' + props.value
1057
- }), null);
1119
+ return [options.map(function (props, index) {
1120
+ return hasProperty(props || '', 'options') ? makeOptionGroup(props, index) : makeOption(props, index);
1058
1121
  }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1059
1122
  }
1060
1123
  }, getSlot(this.$slots, ['default'])));
@@ -1129,7 +1192,7 @@ var Tree = defineComponent({
1129
1192
  }
1130
1193
  });
1131
1194
 
1132
- var css_248z$2 = "._fc-exceed .el-upload{display:none}";
1195
+ var css_248z$2 = "._fc-exceed .el-upload{display:none}.el-upload-list.is-disabled .el-upload{cursor:not-allowed!important}";
1133
1196
  styleInject(css_248z$2);
1134
1197
 
1135
1198
  var script$1 = {
@@ -1278,48 +1341,6 @@ var Upload = defineComponent({
1278
1341
  }
1279
1342
  });
1280
1343
 
1281
- var is = {
1282
- type: function type(arg, _type) {
1283
- return Object.prototype.toString.call(arg) === '[object ' + _type + ']';
1284
- },
1285
- Undef: function Undef(v) {
1286
- return v === undefined || v === null;
1287
- },
1288
- Element: function Element(arg) {
1289
- return _typeof(arg) === 'object' && arg !== null && arg.nodeType === 1 && !is.Object(arg);
1290
- },
1291
- trueArray: function trueArray(data) {
1292
- return Array.isArray(data) && data.length > 0;
1293
- },
1294
- Function: function Function(v) {
1295
- var type = this.getType(v);
1296
- return type === 'Function' || type === 'AsyncFunction';
1297
- },
1298
- getType: function getType(v) {
1299
- var str = Object.prototype.toString.call(v);
1300
- return /^\[object (.*)\]$/.exec(str)[1];
1301
- },
1302
- empty: function empty(value) {
1303
- if (value === undefined || value === null) {
1304
- return true;
1305
- }
1306
-
1307
- if (Array.isArray(value) && Array.isArray(value) && !value.length) {
1308
- return true;
1309
- }
1310
-
1311
- return typeof value === 'string' && !value;
1312
- }
1313
- };
1314
- ['Date', 'Object', 'String', 'Boolean', 'Array', 'Number'].forEach(function (t) {
1315
- is[t] = function (arg) {
1316
- return is.type(arg, t);
1317
- };
1318
- });
1319
- function hasProperty(rule, k) {
1320
- return {}.hasOwnProperty.call(rule, k);
1321
- }
1322
-
1323
1344
  function $set(target, field, value) {
1324
1345
  target[field] = value;
1325
1346
  }
@@ -3781,6 +3802,8 @@ extend(RuleContext.prototype, {
3781
3802
 
3782
3803
  onLoad && onLoad(value);
3783
3804
  _this2.$api && _this2.$api.sync(_this2.rule);
3805
+ })["catch"](function (e) {
3806
+ console.error(e);
3784
3807
  });
3785
3808
  value = def;
3786
3809
  this.setPending(key, origin, value);
@@ -3932,7 +3955,8 @@ extend(RuleContext.prototype, {
3932
3955
  vm: handle.vm,
3933
3956
  trueType: handle.getType(this.originType),
3934
3957
  vNode: handle.$render.vNode,
3935
- updated: false
3958
+ updated: false,
3959
+ cacheValue: this.rule.value
3936
3960
  });
3937
3961
  !init && this.unwatch();
3938
3962
  this.watchTo();
@@ -5474,6 +5498,15 @@ var fetch = function fetch(fc) {
5474
5498
  function run(inject, rule, api) {
5475
5499
  var option = inject.value;
5476
5500
 
5501
+ var set = function set(val) {
5502
+ if (val === undefined) {
5503
+ inject.clearProp();
5504
+ api.sync(rule);
5505
+ } else {
5506
+ deepSet(inject.getProp(), option.to || 'options', val);
5507
+ }
5508
+ };
5509
+
5477
5510
  if (is.Function(option)) {
5478
5511
  option = option(rule, api);
5479
5512
  }
@@ -5481,7 +5514,8 @@ var fetch = function fetch(fc) {
5481
5514
  option = parseOpt(option);
5482
5515
 
5483
5516
  if (!option || !option.action) {
5484
- return false;
5517
+ set(undefined);
5518
+ return;
5485
5519
  }
5486
5520
 
5487
5521
  if (!option.to) {
@@ -5498,55 +5532,65 @@ var fetch = function fetch(fc) {
5498
5532
  }
5499
5533
  };
5500
5534
 
5501
- var set = function set(val) {
5502
- if (val === undefined) {
5503
- inject.clearProp();
5504
- api.sync(rule);
5505
- } else {
5506
- deepSet(inject.getProp(), option.to, val);
5507
- }
5508
- };
5535
+ var config = _objectSpread2(_objectSpread2({
5536
+ headers: {}
5537
+ }, option), {}, {
5538
+ onSuccess: function onSuccess(body, flag) {
5539
+ if (check()) return;
5509
5540
 
5510
- invoke(function () {
5511
- return fc.create.fetch(_objectSpread2(_objectSpread2({}, option), {}, {
5512
- onSuccess: function onSuccess(body) {
5513
- if (check()) return;
5541
+ var fn = function fn(v) {
5542
+ return flag ? v : v.data;
5543
+ };
5514
5544
 
5515
- var fn = function fn(v) {
5516
- return v.data;
5545
+ if (is.Function(option.parse)) {
5546
+ fn = option.parse;
5547
+ } else if (option.parse && is.String(option.parse)) {
5548
+ fn = function fn(v) {
5549
+ option.parse.split('.').forEach(function (k) {
5550
+ if (v) {
5551
+ v = v[k];
5552
+ }
5553
+ });
5554
+ return v;
5517
5555
  };
5556
+ }
5518
5557
 
5519
- if (is.Function(option.parse)) {
5520
- fn = option.parse;
5521
- } else if (option.parse && is.String(option.parse)) {
5522
- fn = function fn(v) {
5523
- option.parse.split('.').forEach(function (k) {
5524
- if (v) {
5525
- v = v[k];
5526
- }
5527
- });
5528
- return v;
5529
- };
5530
- }
5558
+ set(fn(body, rule, api));
5559
+ api.sync(rule);
5560
+ },
5561
+ onError: function onError(e) {
5562
+ set(undefined);
5563
+ if (check()) return;
5531
5564
 
5532
- set(fn(body, rule, api));
5533
- api.sync(rule);
5534
- },
5535
- onError: function onError(e) {
5536
- set(undefined);
5537
- if (check()) return;
5565
+ (_onError || function (e) {
5566
+ return err(e.message || 'fetch fail ' + option.action);
5567
+ })(e, rule, api);
5568
+ }
5569
+ });
5538
5570
 
5539
- (_onError || function (e) {
5540
- return err(e.message || 'fetch fail ' + option.action);
5541
- })(e, rule, api);
5542
- }
5543
- }), {
5571
+ fc.options.beforeFetch && invoke(function () {
5572
+ return fc.options.beforeFetch(config, {
5573
+ rule: rule,
5574
+ api: api
5575
+ });
5576
+ });
5577
+
5578
+ if (is.Function(option.action)) {
5579
+ option.action(rule, api).then(function (val) {
5580
+ config.onSuccess(val, true);
5581
+ })["catch"](function (e) {
5582
+ config.onError(e);
5583
+ });
5584
+ return;
5585
+ }
5586
+
5587
+ invoke(function () {
5588
+ return fc.create.fetch(config, {
5544
5589
  inject: inject,
5545
5590
  rule: rule,
5546
5591
  api: api
5547
5592
  });
5548
5593
  });
5549
- return true;
5550
5594
  }
5551
5595
 
5552
5596
  return {
@@ -5554,11 +5598,8 @@ var fetch = function fetch(fc) {
5554
5598
  loaded: function loaded() {
5555
5599
  run.apply(void 0, arguments);
5556
5600
  },
5557
- watch: function watch(inject, rule, api) {
5558
- if (!run(inject, rule, api)) {
5559
- inject.clearProp();
5560
- api.sync(rule);
5561
- }
5601
+ watch: function watch() {
5602
+ run.apply(void 0, arguments);
5562
5603
  }
5563
5604
  };
5564
5605
  };
@@ -6536,7 +6577,7 @@ var manager = {
6536
6577
  on: {
6537
6578
  click: function click() {
6538
6579
  var fApi = _this6.$handle.api;
6539
- _this6.options.submitBtn.click ? _this6.options.submitBtn.click(fApi) : fApi.submit();
6580
+ _this6.options.submitBtn.click ? _this6.options.submitBtn.click(fApi) : fApi.submit()["catch"](function () {});
6540
6581
  }
6541
6582
  },
6542
6583
  key: "".concat(this.key, "b1")
@@ -6879,7 +6920,7 @@ function install(FormCreate) {
6879
6920
  function elmFormCreate() {
6880
6921
  return FormCreateFactory({
6881
6922
  ui: 'element-ui',
6882
- version: '3.1.24',
6923
+ version: '3.1.26',
6883
6924
  manager: manager,
6884
6925
  extendApi: extendApi,
6885
6926
  install: install,