@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,10 +1,10 @@
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.
6
6
  */
7
- import { defineComponent, toRef, resolveComponent, createVNode, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, Fragment, markRaw, watch, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, onMounted, onBeforeUnmount, onUpdated, computed, withDirectives, resolveDirective, createApp, h, ref } from 'vue';
7
+ import { defineComponent, toRef, ref, watch, createVNode, resolveComponent, mergeProps as mergeProps$1, openBlock, createElementBlock, createElementVNode, isVNode, nextTick, Fragment, markRaw, reactive, getCurrentInstance, provide, inject, toRefs, onBeforeMount, onMounted, onBeforeUnmount, onUpdated, computed, withDirectives, resolveDirective, createApp, h } from 'vue';
8
8
 
9
9
  function ownKeys(object, enumerableOnly) {
10
10
  var keys = Object.keys(object);
@@ -205,6 +205,10 @@ function getSlot(slots, exclude) {
205
205
  }, []);
206
206
  }
207
207
 
208
+ function toArray(value) {
209
+ return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value];
210
+ }
211
+
208
212
  var NAME$9 = 'fcCheckbox';
209
213
  var Checkbox = defineComponent({
210
214
  name: NAME$9,
@@ -217,22 +221,72 @@ var Checkbox = defineComponent({
217
221
  return [];
218
222
  }
219
223
  },
220
- type: String
224
+ type: String,
225
+ input: Boolean,
226
+ inputValue: String
221
227
  },
222
228
  emits: ['update:modelValue', 'fc.el'],
223
229
  setup: function setup(props, _) {
224
230
  var options = toRef(props.formCreateInject, 'options', []);
225
231
  var value = toRef(props, 'modelValue');
232
+ var inputValue = toRef(props, 'inputValue', '');
233
+ var customValue = ref(inputValue.value);
234
+ var input = toRef(props, 'input', false);
235
+
236
+ var updateCustomValue = function updateCustomValue(n) {
237
+ var _value = _toConsumableArray(toArray(value.value));
238
+
239
+ var idx = _value.indexOf(customValue.value);
240
+
241
+ customValue.value = n;
242
+
243
+ if (idx > -1) {
244
+ _value.splice(idx, 1);
245
+
246
+ _value.push(n);
247
+
248
+ onInput(_value);
249
+ }
250
+ };
251
+
252
+ watch(inputValue, function (n) {
253
+ if (!input.value) {
254
+ customValue.value = n;
255
+ return undefined;
256
+ }
257
+
258
+ updateCustomValue(n);
259
+ });
226
260
 
227
261
  var _options = function _options() {
228
262
  return Array.isArray(options.value) ? options.value : [];
229
263
  };
230
264
 
265
+ var onInput = function onInput(n) {
266
+ _.emit('update:modelValue', n);
267
+ };
268
+
231
269
  return {
232
270
  options: _options,
233
271
  value: value,
234
- onInput: function onInput(n) {
235
- _.emit('update:modelValue', n);
272
+ onInput: onInput,
273
+ updateCustomValue: updateCustomValue,
274
+ makeInput: function makeInput(Type) {
275
+ if (!input.value) {
276
+ return undefined;
277
+ }
278
+
279
+ return createVNode(Type, {
280
+ "value": customValue.value,
281
+ "label": customValue.value
282
+ }, {
283
+ "default": function _default() {
284
+ return [createVNode(resolveComponent("ElInput"), {
285
+ "modelValue": customValue.value,
286
+ "onUpdate:modelValue": updateCustomValue
287
+ }, null)];
288
+ }
289
+ });
236
290
  }
237
291
  };
238
292
  },
@@ -257,7 +311,7 @@ var Checkbox = defineComponent({
257
311
  delete props.value;
258
312
  delete props.label;
259
313
  return createVNode(Type, mergeProps$1(props, {
260
- "label": label,
314
+ "label": value,
261
315
  "value": value,
262
316
  "key": name + index + '-' + value
263
317
  }), {
@@ -265,7 +319,7 @@ var Checkbox = defineComponent({
265
319
  return [label || value || ''];
266
320
  }
267
321
  });
268
- }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
322
+ }), (_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)];
269
323
  }
270
324
  }, getSlot(this.$slots, ['default'])));
271
325
  },
@@ -274,10 +328,6 @@ var Checkbox = defineComponent({
274
328
  }
275
329
  });
276
330
 
277
- function toArray(value) {
278
- return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value];
279
- }
280
-
281
331
  // https://github.com/developit/mitt
282
332
  function Mitt(all) {
283
333
  all = all || new Map();
@@ -964,22 +1014,66 @@ var Radio = defineComponent({
964
1014
  type: [String, Number, Boolean],
965
1015
  "default": ''
966
1016
  },
967
- type: String
1017
+ type: String,
1018
+ input: Boolean,
1019
+ inputValue: String
968
1020
  },
969
1021
  emits: ['update:modelValue', 'fc.el'],
970
1022
  setup: function setup(props, _) {
971
1023
  var options = toRef(props.formCreateInject, 'options', []);
972
1024
  var value = toRef(props, 'modelValue');
1025
+ var inputValue = toRef(props, 'inputValue', '');
1026
+ var customValue = ref(inputValue.value);
1027
+ var input = toRef(props, 'input', false);
973
1028
 
974
1029
  var _options = function _options() {
975
1030
  return Array.isArray(options.value) ? options.value : [];
976
1031
  };
977
1032
 
1033
+ watch(inputValue, function (n) {
1034
+ if (!input.value) {
1035
+ customValue.value = n;
1036
+ return undefined;
1037
+ }
1038
+
1039
+ updateCustomValue(n);
1040
+ });
1041
+
1042
+ var onInput = function onInput(n) {
1043
+ _.emit('update:modelValue', n);
1044
+ };
1045
+
1046
+ var updateCustomValue = function updateCustomValue(n) {
1047
+ var o = customValue.value;
1048
+ customValue.value = n;
1049
+
1050
+ if (value.value === o) {
1051
+ onInput(n);
1052
+ }
1053
+ };
1054
+
978
1055
  return {
979
1056
  options: _options,
980
1057
  value: value,
981
- onInput: function onInput(n) {
982
- _.emit('update:modelValue', n);
1058
+ onInput: onInput,
1059
+ updateCustomValue: updateCustomValue,
1060
+ customValue: customValue,
1061
+ makeInput: function makeInput(Type) {
1062
+ if (!input.value) {
1063
+ return undefined;
1064
+ }
1065
+
1066
+ return createVNode(Type, {
1067
+ "value": customValue.value,
1068
+ "label": customValue.value
1069
+ }, {
1070
+ "default": function _default() {
1071
+ return [createVNode(resolveComponent("ElInput"), {
1072
+ "modelValue": customValue.value,
1073
+ "onUpdate:modelValue": updateCustomValue
1074
+ }, null)];
1075
+ }
1076
+ });
983
1077
  }
984
1078
  };
985
1079
  },
@@ -1004,7 +1098,7 @@ var Radio = defineComponent({
1004
1098
  delete props.value;
1005
1099
  delete props.label;
1006
1100
  return createVNode(Type, mergeProps$1(props, {
1007
- "label": label,
1101
+ "label": value,
1008
1102
  "value": value,
1009
1103
  "key": name + index + '-' + value
1010
1104
  }), {
@@ -1012,7 +1106,7 @@ var Radio = defineComponent({
1012
1106
  return [label || value || ''];
1013
1107
  }
1014
1108
  });
1015
- }), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
1109
+ }), (_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)];
1016
1110
  }
1017
1111
  }, getSlot(this.$slots, ['default'])));
1018
1112
  },
@@ -2230,6 +2324,10 @@ function $FormCreate(FormCreate, components, directives) {
2230
2324
  }
2231
2325
  });
2232
2326
 
2327
+ if (props.option && props.option.style) {
2328
+ content += props.option.style;
2329
+ }
2330
+
2233
2331
  if (content) {
2234
2332
  styleEl = document.createElement('style');
2235
2333
  styleEl.type = 'text/css';
@@ -6307,7 +6405,7 @@ function FormCreateFactory(config) {
6307
6405
  },
6308
6406
  mergeOptions: function mergeOptions(target, opt, parent) {
6309
6407
  opt = deepCopy(opt);
6310
- parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass'].forEach(function (n) {
6408
+ parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
6311
6409
  delete opt[n];
6312
6410
  });
6313
6411
 
@@ -7316,7 +7414,7 @@ function install(FormCreate) {
7316
7414
  function elmFormCreate() {
7317
7415
  return FormCreateFactory({
7318
7416
  ui: 'element-ui',
7319
- version: '3.1.31',
7417
+ version: '3.1.32',
7320
7418
  manager: manager,
7321
7419
  extendApi: extendApi,
7322
7420
  install: install,