@form-create/element-ui 3.2.18 → 3.2.19

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.18
2
+ * @form-create/element-ui v3.2.19
3
3
  * (c) 2018-2025 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -1787,7 +1787,7 @@
1787
1787
  return;
1788
1788
  }
1789
1789
 
1790
- this.cacheRule[key].$f && this.cacheRule[key].$f.setValue(value);
1790
+ this.cacheRule[key].$f && this.cacheRule[key].$f.coverValue(value);
1791
1791
  this.cache(key, value);
1792
1792
  },
1793
1793
  addRule: function addRule(i, emit) {
@@ -3021,10 +3021,12 @@
3021
3021
  if (option.query) {
3022
3022
  var queryString = new URLSearchParams(option.query).toString();
3023
3023
 
3024
- if (action.includes('?')) {
3025
- action += "&".concat(queryString);
3026
- } else {
3027
- action += "?".concat(queryString);
3024
+ if (queryString) {
3025
+ if (action.includes('?')) {
3026
+ action += "&".concat(queryString);
3027
+ } else {
3028
+ action += "?".concat(queryString);
3029
+ }
3028
3030
  }
3029
3031
  }
3030
3032
 
@@ -3672,6 +3674,16 @@
3672
3674
  }
3673
3675
  });
3674
3676
  },
3677
+ renderRule: function renderRule(id, onInput, force) {
3678
+ var flag = _typeof(id) === 'object';
3679
+ var ctx = flag ? byCtx(id) : h.getCtx(id);
3680
+ return ctx ? h.$render.createRuleVnode(ctx, onInput, force) : undefined;
3681
+ },
3682
+ renderChildren: function renderChildren(id, onInput, force) {
3683
+ var flag = _typeof(id) === 'object';
3684
+ var ctx = flag ? byCtx(id) : h.getCtx(id);
3685
+ return ctx ? h.$render.createChildrenVnodes(ctx, onInput, force) : undefined;
3686
+ },
3675
3687
  nextTick: function nextTick(fn) {
3676
3688
  h.bus.$once('next-tick', fn);
3677
3689
  h.refresh();
@@ -3975,7 +3987,7 @@
3975
3987
  if (ctx.type === 'hidden') return;
3976
3988
  var rule = ctx.rule;
3977
3989
 
3978
- if (!this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
3990
+ if (this.force || !this.cache[ctx.id] || this.cache[ctx.id].slot !== rule.slot) {
3979
3991
  var vn;
3980
3992
  ctx.initProp();
3981
3993
  this.mergeGlobal(ctx);
@@ -4027,6 +4039,18 @@
4027
4039
 
4028
4040
  Object.keys(prop.renderSlots || {}).forEach(function (key) {
4029
4041
  children[key] = function () {
4042
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
4043
+ args[_key2] = arguments[_key2];
4044
+ }
4045
+
4046
+ if (is.Function(prop.renderSlots[key])) {
4047
+ return invoke(function () {
4048
+ var _prop$renderSlots;
4049
+
4050
+ return (_prop$renderSlots = prop.renderSlots)[key].apply(_prop$renderSlots, args);
4051
+ });
4052
+ }
4053
+
4030
4054
  var rule = _this4.parseSide(prop.renderSlots[key], ctx);
4031
4055
 
4032
4056
  return _this4.renderRule(rule);
@@ -4205,6 +4229,8 @@
4205
4229
  }];
4206
4230
 
4207
4231
  if (ctx.input) {
4232
+ var tmpInput = this.tmpInput;
4233
+
4208
4234
  if (this.vm.props.disabled === true) {
4209
4235
  ctx.prop.props.disabled = true;
4210
4236
  }
@@ -4212,6 +4238,8 @@
4212
4238
  var field = this.getModelField(ctx);
4213
4239
  var model = {
4214
4240
  callback: function callback(value) {
4241
+ tmpInput && tmpInput(ctx.field, value, ctx.rule);
4242
+
4215
4243
  _this7.onInput(ctx, value);
4216
4244
  },
4217
4245
  modelField: field,
@@ -4284,6 +4312,23 @@
4284
4312
  if (this.vNode[ctx.originType]) return this.vNode[ctx.originType](prop, children);
4285
4313
  return this.vNode.make(lower(prop.type), prop, children);
4286
4314
  },
4315
+ createChildrenVnodes: function createChildrenVnodes(ctx, onInput, force) {
4316
+ this.force = force !== false;
4317
+ this.tmpInput = onInput;
4318
+ var res = this.renderChildren(ctx.rule.children, ctx);
4319
+ this.force = false;
4320
+ this.tmpInput = null;
4321
+ return res;
4322
+ },
4323
+ createRuleVnode: function createRuleVnode(ctx, onInput, force) {
4324
+ this.force = force !== false;
4325
+ this.tmpInput = onInput;
4326
+ var slotBag = makeSlotBag();
4327
+ this.renderSlot(slotBag, ctx, ctx.parent);
4328
+ this.force = false;
4329
+ this.tmpInput = null;
4330
+ return slotBag.getSlots();
4331
+ },
4287
4332
  renderRule: function renderRule(rule, children, origin) {
4288
4333
  var _this9 = this;
4289
4334
 
@@ -4331,6 +4376,8 @@
4331
4376
  vm: handle.vm,
4332
4377
  $manager: handle.$manager,
4333
4378
  vNode: new handle.fc.CreateNode(handle.vm),
4379
+ force: false,
4380
+ tmpInput: null,
4334
4381
  id: id$1++
4335
4382
  });
4336
4383
  funcProxy(this, {
@@ -4477,7 +4524,7 @@
4477
4524
  fn.__json = _fn.__json;
4478
4525
  return fn;
4479
4526
  },
4480
- loadStrVar: function loadStrVar(str, get) {
4527
+ loadStrVar: function loadStrVar(str, get, group) {
4481
4528
  var _this3 = this;
4482
4529
 
4483
4530
  if (str && typeof str === 'string' && str.indexOf('{{') > -1 && str.indexOf('}}') > -1) {
@@ -4490,7 +4537,29 @@
4490
4537
 
4491
4538
  if (field) {
4492
4539
  var def = (split[1] || '').trim();
4493
- var val = get ? get(field, def) : _this3.fc.getLoadData(field, def);
4540
+ var val;
4541
+ var flag = false;
4542
+
4543
+ if (group && field.indexOf('$form.') === 0) {
4544
+ var _split = field.split('.');
4545
+
4546
+ _split.shift();
4547
+
4548
+ if (hasProperty(group.value, _split[0])) {
4549
+ flag = true;
4550
+ val = get ? get({
4551
+ id: '$form.' + _split[0] + '_' + group.rule.__fc__.id,
4552
+ getValue: function getValue() {
4553
+ return deepGet(group.value, _split);
4554
+ }
4555
+ }) : deepGet(group.value, _split);
4556
+ }
4557
+ }
4558
+
4559
+ if (!flag) {
4560
+ val = get ? get(field, def) : _this3.fc.getLoadData(field, def);
4561
+ }
4562
+
4494
4563
  lastVal = val;
4495
4564
  str = str.replaceAll("{{".concat(v, "}}"), val == null ? '' : val);
4496
4565
  }
@@ -4503,11 +4572,20 @@
4503
4572
 
4504
4573
  return str;
4505
4574
  },
4506
- loadFetchVar: function loadFetchVar(options, get) {
4575
+ loadFetchVar: function loadFetchVar(options, get, rule) {
4507
4576
  var _this4 = this;
4508
4577
 
4578
+ var group;
4579
+
4580
+ if (rule && rule.__fc__) {
4581
+ group = rule.__fc__.getParentGroup();
4582
+ }
4583
+
4509
4584
  var loadVal = function loadVal(str) {
4510
- return _this4.loadStrVar(str, get);
4585
+ return _this4.loadStrVar(str, get, group ? {
4586
+ rule: rule,
4587
+ value: _this4.subRuleData[group.id] || {}
4588
+ } : null);
4511
4589
  };
4512
4590
 
4513
4591
  options.action = loadVal(options.action || '');
@@ -5978,7 +6056,9 @@
5978
6056
  return one.handler(_this2.api, ctx.rule);
5979
6057
  });
5980
6058
  } else {
5981
- flag = new Function('$condition', '$val', '$form', '$group', '$rule', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(field, ", ").concat(compare ? compare : '$val', "); }}}")).call(_this2.api.form, condition, one.value, _this2.api.top.form, group ? _this2.subRuleData[group.id] || {} : {}, ctx.rule);
6059
+ flag = invoke(function () {
6060
+ return new Function('$condition', '$val', '$form', '$group', '$rule', "with($form){with(this){with($group){ return $condition['".concat(one.condition, "'](").concat(field, ", ").concat(compare ? compare : '$val', "); }}}")).call(_this2.api.form, condition, one.value, _this2.api.top.form, group ? _this2.subRuleData[group.id] || {} : {}, ctx.rule);
6061
+ });
5982
6062
  }
5983
6063
 
5984
6064
  if (or && flag) {
@@ -6912,7 +6992,7 @@
6912
6992
  return fetchAttr._fn[inject.id]();
6913
6993
  }
6914
6994
 
6915
- var _option = fc.$handle.loadFetchVar(deepCopy(option), get);
6995
+ var _option = fc.$handle.loadFetchVar(deepCopy(option), get, rule);
6916
6996
 
6917
6997
  var config = _objectSpread2(_objectSpread2({
6918
6998
  headers: {}
@@ -7153,10 +7233,12 @@
7153
7233
  var globalConfig = {
7154
7234
  global: {}
7155
7235
  };
7156
- var loadData = vue.reactive({});
7236
+ var isMobile = config.isMobile === true;
7237
+ var loadData = vue.reactive({
7238
+ $mobile: isMobile
7239
+ });
7157
7240
  var CreateNode = CreateNodeFactory();
7158
7241
  var formulas = {};
7159
- var isMobile = config.isMobile === true;
7160
7242
  var prototype = {};
7161
7243
  exportAttrs(config.attrs || {});
7162
7244
 
@@ -7414,7 +7496,6 @@
7414
7496
  },
7415
7497
  drivers: drivers,
7416
7498
  renderDriver: null,
7417
- get: null,
7418
7499
  refreshData: refreshData,
7419
7500
  loadData: loadData,
7420
7501
  CreateNode: CreateNode,
@@ -7639,11 +7720,18 @@
7639
7720
  var handle = is.Function(option) ? option : parseFn(option.handle);
7640
7721
 
7641
7722
  if (handle) {
7642
- return deepGet(invoke(function () {
7643
- return handle(_this5.get || function () {
7644
- return _this5.getLoadData.apply(_this5, arguments);
7645
- }, _this5.$handle.api);
7646
- }), split);
7723
+ var val;
7724
+ var unwatch = this.watchLoadData(function (get, flag) {
7725
+ if (flag) {
7726
+ _this5.bus.$emit('$loadData.$var.' + key);
7727
+
7728
+ unwatch();
7729
+ } else {
7730
+ val = handle(get, _this5.$handle.api);
7731
+ }
7732
+ });
7733
+ this.unwatch.push(unwatch);
7734
+ return val;
7647
7735
  }
7648
7736
  }
7649
7737
  },
@@ -7680,6 +7768,8 @@
7680
7768
  } else if (key === '$t') {
7681
7769
  val = this.globalLanguageDriver(split.join('.'));
7682
7770
  split = [];
7771
+ } else if (key === '$preview') {
7772
+ return this.$handle.preview;
7683
7773
  } else {
7684
7774
  var tmpData = this.vm.setupState.top.setupState.fc.tmpData;
7685
7775
 
@@ -7704,32 +7794,31 @@
7704
7794
  var unwatch = {};
7705
7795
 
7706
7796
  var run = function run(flag) {
7707
- if (!_this6.get) {
7708
- _this6.get = get;
7709
- }
7710
-
7711
7797
  invoke(function () {
7712
7798
  fn(get, flag);
7713
7799
  });
7714
-
7715
- if (_this6.get === get) {
7716
- _this6.get = undefined;
7717
- }
7718
7800
  };
7719
7801
 
7720
7802
  var get = function get(id, def) {
7803
+ var getValue;
7804
+
7805
+ if (_typeof(id) === 'object') {
7806
+ getValue = id.getValue;
7807
+ id = id.id;
7808
+ }
7809
+
7721
7810
  if (unwatch[id]) {
7722
7811
  return unwatch[id].val;
7723
7812
  }
7724
7813
 
7725
7814
  var data = vue.computed(function () {
7726
- return _this6.getLoadData(id, def);
7815
+ return getValue ? getValue() : _this6.getLoadData(id, def);
7727
7816
  });
7728
7817
  var split = id.split('.');
7729
7818
  var key = split.shift();
7730
7819
  var key2 = split.shift() || '';
7731
7820
  var callback = debounce(function () {
7732
- var temp = _this6.getLoadData(id, def);
7821
+ var temp = getValue ? getValue() : _this6.getLoadData(id, def);
7733
7822
 
7734
7823
  if (!unwatch[id]) {
7735
7824
  return;
@@ -8863,7 +8952,7 @@
8863
8952
  function elmFormCreate() {
8864
8953
  return FormCreateFactory({
8865
8954
  ui: 'element-ui',
8866
- version: '3.2.18',
8955
+ version: '3.2.19',
8867
8956
  manager: manager,
8868
8957
  extendApi: extendApi,
8869
8958
  install: install,