@form-create/element-ui 3.1.30 → 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.30
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,6 +311,7 @@ var Checkbox = defineComponent({
257
311
  delete props.value;
258
312
  delete props.label;
259
313
  return createVNode(Type, mergeProps$1(props, {
314
+ "label": value,
260
315
  "value": value,
261
316
  "key": name + index + '-' + value
262
317
  }), {
@@ -264,7 +319,7 @@ var Checkbox = defineComponent({
264
319
  return [label || value || ''];
265
320
  }
266
321
  });
267
- }), (_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)];
268
323
  }
269
324
  }, getSlot(this.$slots, ['default'])));
270
325
  },
@@ -273,10 +328,6 @@ var Checkbox = defineComponent({
273
328
  }
274
329
  });
275
330
 
276
- function toArray(value) {
277
- return Array.isArray(value) ? value : [null, undefined, ''].indexOf(value) > -1 ? [] : [value];
278
- }
279
-
280
331
  // https://github.com/developit/mitt
281
332
  function Mitt(all) {
282
333
  all = all || new Map();
@@ -963,22 +1014,66 @@ var Radio = defineComponent({
963
1014
  type: [String, Number, Boolean],
964
1015
  "default": ''
965
1016
  },
966
- type: String
1017
+ type: String,
1018
+ input: Boolean,
1019
+ inputValue: String
967
1020
  },
968
1021
  emits: ['update:modelValue', 'fc.el'],
969
1022
  setup: function setup(props, _) {
970
1023
  var options = toRef(props.formCreateInject, 'options', []);
971
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);
972
1028
 
973
1029
  var _options = function _options() {
974
1030
  return Array.isArray(options.value) ? options.value : [];
975
1031
  };
976
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
+
977
1055
  return {
978
1056
  options: _options,
979
1057
  value: value,
980
- onInput: function onInput(n) {
981
- _.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
+ });
982
1077
  }
983
1078
  };
984
1079
  },
@@ -1003,6 +1098,7 @@ var Radio = defineComponent({
1003
1098
  delete props.value;
1004
1099
  delete props.label;
1005
1100
  return createVNode(Type, mergeProps$1(props, {
1101
+ "label": value,
1006
1102
  "value": value,
1007
1103
  "key": name + index + '-' + value
1008
1104
  }), {
@@ -1010,7 +1106,7 @@ var Radio = defineComponent({
1010
1106
  return [label || value || ''];
1011
1107
  }
1012
1108
  });
1013
- }), (_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)];
1014
1110
  }
1015
1111
  }, getSlot(this.$slots, ['default'])));
1016
1112
  },
@@ -2228,6 +2324,10 @@ function $FormCreate(FormCreate, components, directives) {
2228
2324
  }
2229
2325
  });
2230
2326
 
2327
+ if (props.option && props.option.style) {
2328
+ content += props.option.style;
2329
+ }
2330
+
2231
2331
  if (content) {
2232
2332
  styleEl = document.createElement('style');
2233
2333
  styleEl.type = 'text/css';
@@ -6305,7 +6405,7 @@ function FormCreateFactory(config) {
6305
6405
  },
6306
6406
  mergeOptions: function mergeOptions(target, opt, parent) {
6307
6407
  opt = deepCopy(opt);
6308
- parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass'].forEach(function (n) {
6408
+ parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass', 'style'].forEach(function (n) {
6309
6409
  delete opt[n];
6310
6410
  });
6311
6411
 
@@ -7314,7 +7414,7 @@ function install(FormCreate) {
7314
7414
  function elmFormCreate() {
7315
7415
  return FormCreateFactory({
7316
7416
  ui: 'element-ui',
7317
- version: '3.1.30',
7417
+ version: '3.1.32',
7318
7418
  manager: manager,
7319
7419
  extendApi: extendApi,
7320
7420
  install: install,