@form-create/element-ui 3.0.0-alpha.4 → 3.0.1

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.0.0-alpha.4
2
+ * @form-create/element-ui v3.0.1
3
3
  * (c) 2018-2022 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -15,14 +15,9 @@
15
15
 
16
16
  if (Object.getOwnPropertySymbols) {
17
17
  var symbols = Object.getOwnPropertySymbols(object);
18
-
19
- if (enumerableOnly) {
20
- symbols = symbols.filter(function (sym) {
21
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
22
- });
23
- }
24
-
25
- keys.push.apply(keys, symbols);
18
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
19
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
20
+ })), keys.push.apply(keys, symbols);
26
21
  }
27
22
 
28
23
  return keys;
@@ -30,19 +25,12 @@
30
25
 
31
26
  function _objectSpread2(target) {
32
27
  for (var i = 1; i < arguments.length; i++) {
33
- var source = arguments[i] != null ? arguments[i] : {};
34
-
35
- if (i % 2) {
36
- ownKeys(Object(source), true).forEach(function (key) {
37
- _defineProperty(target, key, source[key]);
38
- });
39
- } else if (Object.getOwnPropertyDescriptors) {
40
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
41
- } else {
42
- ownKeys(Object(source)).forEach(function (key) {
43
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
44
- });
45
- }
28
+ var source = null != arguments[i] ? arguments[i] : {};
29
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
30
+ _defineProperty(target, key, source[key]);
31
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
32
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
33
+ });
46
34
  }
47
35
 
48
36
  return target;
@@ -51,17 +39,11 @@
51
39
  function _typeof(obj) {
52
40
  "@babel/helpers - typeof";
53
41
 
54
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
55
- _typeof = function (obj) {
56
- return typeof obj;
57
- };
58
- } else {
59
- _typeof = function (obj) {
60
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
61
- };
62
- }
63
-
64
- return _typeof(obj);
42
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
43
+ return typeof obj;
44
+ } : function (obj) {
45
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
46
+ }, _typeof(obj);
65
47
  }
66
48
 
67
49
  function _classCallCheck(instance, Constructor) {
@@ -70,6 +52,25 @@
70
52
  }
71
53
  }
72
54
 
55
+ function _defineProperties(target, props) {
56
+ for (var i = 0; i < props.length; i++) {
57
+ var descriptor = props[i];
58
+ descriptor.enumerable = descriptor.enumerable || false;
59
+ descriptor.configurable = true;
60
+ if ("value" in descriptor) descriptor.writable = true;
61
+ Object.defineProperty(target, descriptor.key, descriptor);
62
+ }
63
+ }
64
+
65
+ function _createClass(Constructor, protoProps, staticProps) {
66
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
67
+ if (staticProps) _defineProperties(Constructor, staticProps);
68
+ Object.defineProperty(Constructor, "prototype", {
69
+ writable: false
70
+ });
71
+ return Constructor;
72
+ }
73
+
73
74
  function _defineProperty(obj, key, value) {
74
75
  if (key in obj) {
75
76
  Object.defineProperty(obj, key, {
@@ -97,6 +98,9 @@
97
98
  configurable: true
98
99
  }
99
100
  });
101
+ Object.defineProperty(subClass, "prototype", {
102
+ writable: false
103
+ });
100
104
  if (superClass) _setPrototypeOf(subClass, superClass);
101
105
  }
102
106
 
@@ -784,7 +788,6 @@
784
788
  }, {
785
789
  "default": function _default() {
786
790
  return [vue.createVNode("img", {
787
- "alt": "example",
788
791
  "style": "width: 100%",
789
792
  "src": _this9.previewImage
790
793
  }, null)];
@@ -841,10 +844,8 @@
841
844
  inheritAttrs: false,
842
845
  props: {
843
846
  modelValue: {
844
- type: [String, Number],
845
- "default": function _default() {
846
- return [];
847
- }
847
+ type: [String, Number, Boolean],
848
+ "default": ''
848
849
  },
849
850
  type: String
850
851
  },
@@ -924,10 +925,8 @@
924
925
  inheritAttrs: false,
925
926
  props: {
926
927
  modelValue: {
927
- type: Array,
928
- "default": function _default() {
929
- return [];
930
- }
928
+ type: [Array, String, Number, Boolean, Object],
929
+ "default": undefined
931
930
  },
932
931
  type: String
933
932
  },
@@ -2680,6 +2679,10 @@
2680
2679
  }
2681
2680
 
2682
2681
  (_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
2682
+ },
2683
+ helper: {
2684
+ tidyFields: tidyFields,
2685
+ props: props
2683
2686
  }
2684
2687
  };
2685
2688
  ['on', 'once', 'off', 'set'].forEach(function (n) {
@@ -2929,7 +2932,6 @@
2929
2932
  };
2930
2933
 
2931
2934
  this.setCache(ctx, vn, parent);
2932
- ctx._vnode = vn;
2933
2935
  return vn;
2934
2936
  }
2935
2937
 
@@ -3094,7 +3096,11 @@
3094
3096
  });
3095
3097
  }
3096
3098
 
3097
- return this.vNode.make(type, rule, slotBag.mergeBag(children).getSlots());
3099
+ var props = _objectSpread2({}, rule);
3100
+
3101
+ delete props.type;
3102
+ delete props.is;
3103
+ return this.vNode.make(type, props, slotBag.mergeBag(children).getSlots());
3098
3104
  }
3099
3105
  });
3100
3106
  }
@@ -3922,7 +3928,7 @@
3922
3928
  this.setFormData(ctx, formValue);
3923
3929
  this.syncValue();
3924
3930
  this.valueChange(ctx, value);
3925
- this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag);
3931
+ this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
3926
3932
  this.effect(ctx, 'value');
3927
3933
  },
3928
3934
  onInput: function onInput(ctx, value) {
@@ -3933,7 +3939,7 @@
3933
3939
  }
3934
3940
  },
3935
3941
  setFormData: function setFormData(ctx, value) {
3936
- $set(this.formData, ctx.id, value);
3942
+ $set(this.formData, ctx.id, value === undefined ? null : value);
3937
3943
  },
3938
3944
  getFormData: function getFormData(ctx) {
3939
3945
  return this.formData[ctx.id];
@@ -4344,7 +4350,6 @@
4344
4350
  watchEffect: function watchEffect(ctx) {
4345
4351
  var _this3 = this;
4346
4352
 
4347
- this.vm;
4348
4353
  Object.keys(ctx.rule.effect || {}).forEach(function (k) {
4349
4354
  ctx.watch.push(vue.watch(function () {
4350
4355
  return ctx.rule.effect[k];
@@ -4641,7 +4646,12 @@
4641
4646
  return makeDirective(data, this.h(tag, toProps(data), children));
4642
4647
  },
4643
4648
  h: function h(tag, data, children) {
4644
- return vue.createVNode(vue.getCurrentInstance().appContext.config.isNativeTag(tag) ? tag : vue.resolveComponent(tag), data, children);
4649
+ try {
4650
+ return vue.createVNode(vue.getCurrentInstance().appContext.config.isNativeTag(tag) ? tag : vue.resolveComponent(tag), data, children);
4651
+ } catch (e) {
4652
+ console.error(e);
4653
+ return vue.createVNode('');
4654
+ }
4645
4655
  },
4646
4656
  aliasMap: aliasMap
4647
4657
  });
@@ -4680,7 +4690,7 @@
4680
4690
  return _super.apply(this, arguments);
4681
4691
  }
4682
4692
 
4683
- return CustomManager;
4693
+ return _createClass(CustomManager);
4684
4694
  }(Manager);
4685
4695
 
4686
4696
  Object.assign(CustomManager.prototype, proto);
@@ -5369,15 +5379,29 @@
5369
5379
 
5370
5380
  var manager = {
5371
5381
  validate: function validate() {
5372
- return this.form().validate();
5382
+ var form = this.form();
5383
+
5384
+ if (form) {
5385
+ return form.validate();
5386
+ } else {
5387
+ return new Promise(function (v) {
5388
+ return v();
5389
+ });
5390
+ }
5373
5391
  },
5374
5392
  validateField: function validateField(field) {
5375
5393
  var _this = this;
5376
5394
 
5377
5395
  return new Promise(function (resolve, reject) {
5378
- _this.form().validateField(field, function (res) {
5379
- res ? reject(res) : resolve(null);
5380
- });
5396
+ var form = _this.form();
5397
+
5398
+ if (form) {
5399
+ form.validateField(field, function (res) {
5400
+ res ? reject(res) : resolve(null);
5401
+ });
5402
+ } else {
5403
+ resolve();
5404
+ }
5381
5405
  });
5382
5406
  },
5383
5407
  clearValidateState: function clearValidateState(ctx) {
@@ -5589,7 +5613,7 @@
5589
5613
 
5590
5614
  var resetBtn = _objectSpread2({}, this.options.resetBtn);
5591
5615
 
5592
- var text = resetBtn.innerText;
5616
+ var innerText = resetBtn.innerText;
5593
5617
  delete resetBtn.innerText;
5594
5618
  return this.$r({
5595
5619
  type: 'button',
@@ -5604,14 +5628,14 @@
5604
5628
  }
5605
5629
  },
5606
5630
  key: "".concat(this.key, "b2")
5607
- }, [text]);
5631
+ }, [innerText]);
5608
5632
  },
5609
5633
  makeSubmitBtn: function makeSubmitBtn() {
5610
5634
  var _this6 = this;
5611
5635
 
5612
5636
  var submitBtn = _objectSpread2({}, this.options.submitBtn);
5613
5637
 
5614
- var text = submitBtn.innerText;
5638
+ var innerText = submitBtn.innerText;
5615
5639
  delete submitBtn.innerText;
5616
5640
  return this.$r({
5617
5641
  type: 'button',
@@ -5626,7 +5650,7 @@
5626
5650
  }
5627
5651
  },
5628
5652
  key: "".concat(this.key, "b1")
5629
- }, [text]);
5653
+ }, [innerText]);
5630
5654
  }
5631
5655
  };
5632
5656
 
@@ -5712,7 +5736,7 @@
5712
5736
  return maker;
5713
5737
  }
5714
5738
 
5715
- var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create .form-create .el-form-item .el-form-item{margin-bottom:0}.form-create{transform:rotate(0)}";
5739
+ var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create .form-create .el-form-item .el-form-item{margin-bottom:0}.form-create{width:100%}";
5716
5740
  styleInject(css_248z);
5717
5741
 
5718
5742
  function tidyBtnProp(btn, def) {
@@ -5889,7 +5913,7 @@
5889
5913
  function elmFormCreate() {
5890
5914
  return FormCreateFactory({
5891
5915
  ui: 'element-ui',
5892
- version: '3.0.0-alpha.4',
5916
+ version: '3.0.1',
5893
5917
  manager: manager,
5894
5918
  extendApi: extendApi,
5895
5919
  install: install,