@form-create/element-ui 3.1.31 → 3.1.32

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.31
2
+ * @form-create/element-ui v3.1.32
3
3
  * (c) 2018-2024 xaboy
4
4
  * Github https://github.com/xaboy/form-create
5
5
  * Released under the MIT License.
@@ -209,6 +209,10 @@
209
209
  }, []);
210
210
  }
211
211
 
212
+ function toArray(value) {
213
+ return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value];
214
+ }
215
+
212
216
  var NAME$9 = 'fcCheckbox';
213
217
  var Checkbox = vue.defineComponent({
214
218
  name: NAME$9,
@@ -221,22 +225,72 @@
221
225
  return [];
222
226
  }
223
227
  },
224
- type: String
228
+ type: String,
229
+ input: Boolean,
230
+ inputValue: String
225
231
  },
226
232
  emits: ['update:modelValue', 'fc.el'],
227
233
  setup: function setup(props, _) {
228
234
  var options = vue.toRef(props.formCreateInject, 'options', []);
229
235
  var value = vue.toRef(props, 'modelValue');
236
+ var inputValue = vue.toRef(props, 'inputValue', '');
237
+ var customValue = vue.ref(inputValue.value);
238
+ var input = vue.toRef(props, 'input', false);
239
+
240
+ var updateCustomValue = function updateCustomValue(n) {
241
+ var _value = _toConsumableArray(toArray(value.value));
242
+
243
+ var idx = _value.indexOf(customValue.value);
244
+
245
+ customValue.value = n;
246
+
247
+ if (idx > -1) {
248
+ _value.splice(idx, 1);
249
+
250
+ _value.push(n);
251
+
252
+ onInput(_value);
253
+ }
254
+ };
255
+
256
+ vue.watch(inputValue, function (n) {
257
+ if (!input.value) {
258
+ customValue.value = n;
259
+ return undefined;
260
+ }
261
+
262
+ updateCustomValue(n);
263
+ });
230
264
 
231
265
  var _options = function _options() {
232
266
  return Array.isArray(options.value) ? options.value : [];
233
267
  };
234
268
 
269
+ var onInput = function onInput(n) {
270
+ _.emit('update:modelValue', n);
271
+ };
272
+
235
273
  return {
236
274
  options: _options,
237
275
  value: value,
238
- onInput: function onInput(n) {
239
- _.emit('update:modelValue', n);
276
+ onInput: onInput,
277
+ updateCustomValue: updateCustomValue,
278
+ makeInput: function makeInput(Type) {
279
+ if (!input.value) {
280
+ return undefined;
281
+ }
282
+
283
+ return vue.createVNode(Type, {
284
+ "value": customValue.value,
285
+ "label": customValue.value
286
+ }, {
287
+ "default": function _default() {
288
+ return [vue.createVNode(vue.resolveComponent("ElInput"), {
289
+ "modelValue": customValue.value,
290
+ "onUpdate:modelValue": updateCustomValue
291
+ }, null)];
292
+ }
293
+ });
240
294
  }
241
295
  };
242
296
  },
@@ -261,7 +315,7 @@
261
315
  delete props.value;
262
316
  delete props.label;
263
317
  return vue.createVNode(Type, vue.mergeProps(props, {
264
- "label": label,
318
+ "label": value,
265
319
  "value": value,
266
320
  "key": name + index + '-' + value
267
321
  }), {
@@ -269,7 +323,7 @@
269
323
  return [label || value || ''];
270
324
  }
271
325
  });
272
- }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
326
+ }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots), _this.makeInput(Type)];
273
327
  }
274
328
  }, getSlot(this.$slots, ['default'])));
275
329
  },
@@ -278,10 +332,6 @@
278
332
  }
279
333
  });
280
334
 
281
- function toArray(value) {
282
- return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value];
283
- }
284
-
285
335
  // https://github.com/developit/mitt
286
336
  function Mitt(all) {
287
337
  all = all || new Map();
@@ -968,22 +1018,66 @@
968
1018
  type: [String, Number, Boolean],
969
1019
  "default": ''
970
1020
  },
971
- type: String
1021
+ type: String,
1022
+ input: Boolean,
1023
+ inputValue: String
972
1024
  },
973
1025
  emits: ['update:modelValue', 'fc.el'],
974
1026
  setup: function setup(props, _) {
975
1027
  var options = vue.toRef(props.formCreateInject, 'options', []);
976
1028
  var value = vue.toRef(props, 'modelValue');
1029
+ var inputValue = vue.toRef(props, 'inputValue', '');
1030
+ var customValue = vue.ref(inputValue.value);
1031
+ var input = vue.toRef(props, 'input', false);
977
1032
 
978
1033
  var _options = function _options() {
979
1034
  return Array.isArray(options.value) ? options.value : [];
980
1035
  };
981
1036
 
1037
+ vue.watch(inputValue, function (n) {
1038
+ if (!input.value) {
1039
+ customValue.value = n;
1040
+ return undefined;
1041
+ }
1042
+
1043
+ updateCustomValue(n);
1044
+ });
1045
+
1046
+ var onInput = function onInput(n) {
1047
+ _.emit('update:modelValue', n);
1048
+ };
1049
+
1050
+ var updateCustomValue = function updateCustomValue(n) {
1051
+ var o = customValue.value;
1052
+ customValue.value = n;
1053
+
1054
+ if (value.value === o) {
1055
+ onInput(n);
1056
+ }
1057
+ };
1058
+
982
1059
  return {
983
1060
  options: _options,
984
1061
  value: value,
985
- onInput: function onInput(n) {
986
- _.emit('update:modelValue', n);
1062
+ onInput: onInput,
1063
+ updateCustomValue: updateCustomValue,
1064
+ customValue: customValue,
1065
+ makeInput: function makeInput(Type) {
1066
+ if (!input.value) {
1067
+ return undefined;
1068
+ }
1069
+
1070
+ return vue.createVNode(Type, {
1071
+ "value": customValue.value,
1072
+ "label": customValue.value
1073
+ }, {
1074
+ "default": function _default() {
1075
+ return [vue.createVNode(vue.resolveComponent("ElInput"), {
1076
+ "modelValue": customValue.value,
1077
+ "onUpdate:modelValue": updateCustomValue
1078
+ }, null)];
1079
+ }
1080
+ });
987
1081
  }
988
1082
  };
989
1083
  },
@@ -1008,7 +1102,7 @@
1008
1102
  delete props.value;
1009
1103
  delete props.label;
1010
1104
  return vue.createVNode(Type, vue.mergeProps(props, {
1011
- "label": label,
1105
+ "label": value,
1012
1106
  "value": value,
1013
1107
  "key": name + index + '-' + value
1014
1108
  }), {
@@ -1016,7 +1110,7 @@
1016
1110
  return [label || value || ''];
1017
1111
  }
1018
1112
  });
1019
- }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1113
+ }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots), _this.makeInput(Type)];
1020
1114
  }
1021
1115
  }, getSlot(this.$slots, ['default'])));
1022
1116
  },
@@ -2234,6 +2328,10 @@
2234
2328
  }
2235
2329
  });
2236
2330
 
2331
+ if (props.option && props.option.style) {
2332
+ content += props.option.style;
2333
+ }
2334
+
2237
2335
  if (content) {
2238
2336
  styleEl = document.createElement('style');
2239
2337
  styleEl.type = 'text/css';
@@ -6311,7 +6409,7 @@
6311
6409
  },
6312
6410
  mergeOptions: function mergeOptions(target, opt, parent) {
6313
6411
  opt = deepCopy(opt);
6314
- parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass'].forEach(function (n) {
6412
+ parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
6315
6413
  delete opt[n];
6316
6414
  });
6317
6415
 
@@ -7320,7 +7418,7 @@
7320
7418
  function elmFormCreate() {
7321
7419
  return FormCreateFactory({
7322
7420
  ui: 'element-ui',
7323
- version: '3.1.31',
7421
+ version: '3.1.32',
7324
7422
  manager: manager,
7325
7423
  extendApi: extendApi,
7326
7424
  install: install,