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

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,11 +1,10 @@
1
1
  /*!
2
- * @form-create/element-ui v3.0.0-alpha.3
3
- * (c) 2018-2021 xaboy
2
+ * @form-create/element-ui v3.0.0-alpha.4
3
+ * (c) 2018-2022 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
6
6
  */
7
7
  import { defineComponent, toRefs, inject, ref, toRef, watch, resolveComponent, createVNode, mergeProps as mergeProps$1, isVNode, nextTick, markRaw, reactive, getCurrentInstance, provide, onMounted, onBeforeUnmount, onUpdated, computed, customRef, withDirectives, resolveDirective, createApp, h } from 'vue';
8
- import ElementPlus from 'element-plus';
9
8
 
10
9
  function ownKeys(object, enumerableOnly) {
11
10
  var keys = Object.keys(object);
@@ -1394,7 +1393,8 @@ var Group = defineComponent({
1394
1393
  });
1395
1394
  }
1396
1395
  },
1397
- deep: true
1396
+ deep: true,
1397
+ flush: 'post'
1398
1398
  }
1399
1399
  },
1400
1400
  methods: {
@@ -1569,13 +1569,13 @@ var Group = defineComponent({
1569
1569
  created: function created() {
1570
1570
  var d = (this.expand || 0) - this.modelValue.length;
1571
1571
 
1572
- if (d > 0) {
1573
- this.expandRule(d);
1574
- }
1575
-
1576
1572
  for (var i = 0; i < this.modelValue.length; i++) {
1577
1573
  this.addRule(i);
1578
1574
  }
1575
+
1576
+ if (d > 0) {
1577
+ this.expandRule(d);
1578
+ }
1579
1579
  },
1580
1580
  render: function render() {
1581
1581
  var _this9 = this;
@@ -1968,11 +1968,11 @@ function deepExtend(origin) {
1968
1968
  $set(origin, key, clone);
1969
1969
 
1970
1970
  if (!is.Undef(clone)) {
1971
- if (clone.__json !== undefined) {
1971
+ if (!is.Undef(clone.__json)) {
1972
1972
  origin[key].__json = clone.__json;
1973
1973
  }
1974
1974
 
1975
- if (clone.__origin !== undefined) {
1975
+ if (!is.Undef(clone.__origin)) {
1976
1976
  origin[key].__origin = clone.__origin;
1977
1977
  }
1978
1978
  }
@@ -2023,7 +2023,7 @@ function toJson(obj, space) {
2023
2023
  return val;
2024
2024
  }
2025
2025
 
2026
- if (hasProperty(val, '__json')) {
2026
+ if (val.__json) {
2027
2027
  return val.__json;
2028
2028
  }
2029
2029
 
@@ -2224,33 +2224,6 @@ function toProps(rule) {
2224
2224
  return prop;
2225
2225
  }
2226
2226
 
2227
- function toString(val) {
2228
- return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
2229
- }
2230
-
2231
- var id$1 = 0;
2232
- function uniqueId() {
2233
- return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$1)).toString(36);
2234
- }
2235
-
2236
- function deepSet(data, idx, val) {
2237
- var _data = data,
2238
- to;
2239
- (idx || '').split('.').forEach(function (v) {
2240
- if (to) {
2241
- if (!_data[to] || _typeof(_data[to]) != 'object') {
2242
- _data[to] = {};
2243
- }
2244
-
2245
- _data = _data[to];
2246
- }
2247
-
2248
- to = v;
2249
- });
2250
- _data[to] = val;
2251
- return _data;
2252
- }
2253
-
2254
2227
  function baseRule() {
2255
2228
  return {
2256
2229
  props: {},
@@ -2764,11 +2737,55 @@ function lower(str) {
2764
2737
  return str.replace(str[0], str[0].toLowerCase());
2765
2738
  }
2766
2739
 
2740
+ function toString(val) {
2741
+ return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
2742
+ }
2743
+
2744
+ var id$1 = 0;
2745
+ function uniqueId() {
2746
+ return Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$1)).toString(36);
2747
+ }
2748
+
2749
+ function deepSet(data, idx, val) {
2750
+ var _data = data,
2751
+ to;
2752
+ (idx || '').split('.').forEach(function (v) {
2753
+ if (to) {
2754
+ if (!_data[to] || _typeof(_data[to]) != 'object') {
2755
+ _data[to] = {};
2756
+ }
2757
+
2758
+ _data = _data[to];
2759
+ }
2760
+
2761
+ to = v;
2762
+ });
2763
+ _data[to] = val;
2764
+ return _data;
2765
+ }
2766
+
2767
2767
  function useRender$1(Render) {
2768
2768
  extend(Render.prototype, {
2769
2769
  initRender: function initRender() {
2770
2770
  this.cacheConfig = {};
2771
2771
  },
2772
+ getTypeSlot: function getTypeSlot(type) {
2773
+ var name = 'type-' + toLine(type);
2774
+
2775
+ var _fn = function _fn(vm) {
2776
+ if (vm) {
2777
+ var slot = vm.slots[name] || vm.slots['type-' + type];
2778
+
2779
+ if (slot) {
2780
+ return slot;
2781
+ }
2782
+
2783
+ return _fn(vm.setupState.parent);
2784
+ }
2785
+ };
2786
+
2787
+ return _fn(this.vm);
2788
+ },
2772
2789
  render: function render() {
2773
2790
  var _this = this;
2774
2791
 
@@ -2876,12 +2893,12 @@ function useRender$1(Render) {
2876
2893
  children = _this4.renderChildren(ctx);
2877
2894
  }
2878
2895
 
2879
- var slot = 'type-' + toLine(ctx.type);
2896
+ var slot = _this4.getTypeSlot(ctx.type);
2880
2897
 
2881
2898
  var _vn;
2882
2899
 
2883
- if (_this4.vm.slots[slot]) {
2884
- _vn = _this4.vm.slots[slot]({
2900
+ if (slot) {
2901
+ _vn = slot({
2885
2902
  rule: rule,
2886
2903
  prop: prop,
2887
2904
  preview: preview,
@@ -3415,7 +3432,7 @@ extend(RuleContext.prototype, {
3415
3432
  var _this2 = this;
3416
3433
 
3417
3434
  nextTick(function () {
3418
- _this2.$handle.watchCtx(_this2);
3435
+ _this2.$handle && _this2.$handle.watchCtx(_this2);
3419
3436
  });
3420
3437
  },
3421
3438
  "delete": function _delete() {
@@ -4134,7 +4151,7 @@ function useContext(Handler) {
4134
4151
  var none = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update'];
4135
4152
  var all = attrs();
4136
4153
  all.filter(function (k) {
4137
- return none.indexOf(k) === -1;
4154
+ return k[0] !== '_' && none.indexOf(k) === -1;
4138
4155
  }).forEach(function (key) {
4139
4156
  var ref = toRef(ctx.rule, key);
4140
4157
  var flag = key === 'children';
@@ -4588,8 +4605,12 @@ var vnode = defineComponent({
4588
4605
 
4589
4606
  function tidyDirectives(directives) {
4590
4607
  return Object.keys(directives).map(function (n) {
4591
- var directive = directives[n];
4592
- return [resolveDirective(n), directive.arg, directive.value, directive.modifiers];
4608
+ var data = directives[n];
4609
+ var directive = resolveDirective(n);
4610
+ if (!directive) return;
4611
+ return [directive, data.value, data.arg, data.modifiers];
4612
+ }).filter(function (v) {
4613
+ return !!v;
4593
4614
  });
4594
4615
  }
4595
4616
 
@@ -5861,16 +5882,11 @@ function install(FormCreate) {
5861
5882
  });
5862
5883
  }
5863
5884
 
5864
- function appUse(app) {
5865
- app.use(ElementPlus);
5866
- }
5867
-
5868
5885
  function elmFormCreate() {
5869
5886
  return FormCreateFactory({
5870
5887
  ui: 'element-ui',
5871
- version: '3.0.0-alpha.3',
5888
+ version: '3.0.0-alpha.4',
5872
5889
  manager: manager,
5873
- appUse: appUse,
5874
5890
  extendApi: extendApi,
5875
5891
  install: install,
5876
5892
  attrs: {