@form-create/element-ui 3.2.6 → 3.2.8
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.
- package/dist/form-create.esm.js +120 -59
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +119 -58
- package/dist/form-create.min.js +2 -2
- package/package.json +7 -7
- package/src/core/manager.js +2 -1
package/dist/form-create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.2.
|
|
2
|
+
* @form-create/element-ui v3.2.8
|
|
3
3
|
* (c) 2018-2024 xaboy
|
|
4
4
|
* Github https://github.com/xaboy/form-create
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -281,11 +281,12 @@
|
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
return vue.createVNode(Type, {
|
|
284
|
-
"value": customValue.value,
|
|
285
|
-
"label": customValue.value
|
|
284
|
+
"value": customValue.value || undefined,
|
|
285
|
+
"label": customValue.value || undefined
|
|
286
286
|
}, {
|
|
287
287
|
"default": function _default() {
|
|
288
288
|
return [vue.createVNode(vue.resolveComponent("ElInput"), {
|
|
289
|
+
"size": "small",
|
|
289
290
|
"modelValue": customValue.value,
|
|
290
291
|
"onUpdate:modelValue": updateCustomValue
|
|
291
292
|
}, null)];
|
|
@@ -1068,11 +1069,13 @@
|
|
|
1068
1069
|
}
|
|
1069
1070
|
|
|
1070
1071
|
return vue.createVNode(Type, {
|
|
1071
|
-
"
|
|
1072
|
-
"
|
|
1072
|
+
"checked": false,
|
|
1073
|
+
"value": customValue.value || undefined,
|
|
1074
|
+
"label": customValue.value || undefined
|
|
1073
1075
|
}, {
|
|
1074
1076
|
"default": function _default() {
|
|
1075
1077
|
return [vue.createVNode(vue.resolveComponent("ElInput"), {
|
|
1078
|
+
"size": "small",
|
|
1076
1079
|
"modelValue": customValue.value,
|
|
1077
1080
|
"onUpdate:modelValue": updateCustomValue
|
|
1078
1081
|
}, null)];
|
|
@@ -1349,6 +1352,7 @@
|
|
|
1349
1352
|
previewMask: undefined,
|
|
1350
1353
|
onPreview: Function,
|
|
1351
1354
|
modalTitle: String,
|
|
1355
|
+
listType: String,
|
|
1352
1356
|
modelValue: [Array, String]
|
|
1353
1357
|
},
|
|
1354
1358
|
emits: ['update:modelValue', 'change', 'remove', 'fc.el'],
|
|
@@ -1372,7 +1376,7 @@
|
|
|
1372
1376
|
if (this.onPreview) {
|
|
1373
1377
|
this.onPreview.apply(this, arguments);
|
|
1374
1378
|
} else {
|
|
1375
|
-
if ('text' === this
|
|
1379
|
+
if ('text' === this.listType) {
|
|
1376
1380
|
window.open(file.url);
|
|
1377
1381
|
} else {
|
|
1378
1382
|
this.previewImage = file.url;
|
|
@@ -1412,9 +1416,9 @@
|
|
|
1412
1416
|
return vue.createVNode("div", {
|
|
1413
1417
|
"class": "_fc-upload"
|
|
1414
1418
|
}, [vue.createVNode(vue.resolveComponent("ElUpload"), vue.mergeProps({
|
|
1415
|
-
"key": len
|
|
1416
|
-
"list-type": "picture-card"
|
|
1419
|
+
"key": len
|
|
1417
1420
|
}, this.$attrs, {
|
|
1421
|
+
"list-type": this.listType || 'picture-card',
|
|
1418
1422
|
"class": {
|
|
1419
1423
|
'_fc-exceed': this.$attrs.limit ? this.$attrs.limit <= len : false
|
|
1420
1424
|
},
|
|
@@ -1425,7 +1429,7 @@
|
|
|
1425
1429
|
"ref": "upload"
|
|
1426
1430
|
}), _objectSpread2({
|
|
1427
1431
|
"default": function _default() {
|
|
1428
|
-
return [(_this$$slots$default = (_this$$slots = _this.$slots)["default"]) !== null && _this$$slots$default !== void 0 && _this$$slots$default.call(_this$$slots) || ['text', 'picture'].indexOf(_this
|
|
1432
|
+
return [(_this$$slots$default = (_this$$slots = _this.$slots)["default"]) !== null && _this$$slots$default !== void 0 && _this$$slots$default.call(_this$$slots) || ['text', 'picture'].indexOf(_this.listType) === -1 ? vue.createVNode(vue.resolveComponent("ElIcon"), null, {
|
|
1429
1433
|
"default": function _default() {
|
|
1430
1434
|
return [vue.createVNode(script$1, null, null)];
|
|
1431
1435
|
}
|
|
@@ -1824,13 +1828,18 @@
|
|
|
1824
1828
|
}, null);
|
|
1825
1829
|
},
|
|
1826
1830
|
changeSort: function changeSort(index, sort) {
|
|
1831
|
+
var _this10 = this;
|
|
1832
|
+
|
|
1827
1833
|
var a = this.sort[index];
|
|
1828
1834
|
this.sort[index] = this.sort[index + sort];
|
|
1829
1835
|
this.sort[index + sort] = a;
|
|
1836
|
+
this.formCreateInject.subForm(this.sort.map(function (k) {
|
|
1837
|
+
return _this10.cacheRule[k].$f;
|
|
1838
|
+
}));
|
|
1830
1839
|
this.formData(0);
|
|
1831
1840
|
},
|
|
1832
1841
|
makeIcon: function makeIcon(total, index, key) {
|
|
1833
|
-
var
|
|
1842
|
+
var _this11 = this;
|
|
1834
1843
|
|
|
1835
1844
|
if (this.$slots.button) {
|
|
1836
1845
|
return this.$slots.button({
|
|
@@ -1839,7 +1848,7 @@
|
|
|
1839
1848
|
vm: this,
|
|
1840
1849
|
key: key,
|
|
1841
1850
|
del: function del() {
|
|
1842
|
-
return
|
|
1851
|
+
return _this11.del(index, key);
|
|
1843
1852
|
},
|
|
1844
1853
|
add: this.add
|
|
1845
1854
|
});
|
|
@@ -1875,12 +1884,12 @@
|
|
|
1875
1884
|
}
|
|
1876
1885
|
},
|
|
1877
1886
|
created: function created() {
|
|
1878
|
-
var
|
|
1887
|
+
var _this12 = this;
|
|
1879
1888
|
|
|
1880
1889
|
vue.watch(function () {
|
|
1881
|
-
return _objectSpread2({},
|
|
1890
|
+
return _objectSpread2({}, _this12.cacheRule);
|
|
1882
1891
|
}, function (n) {
|
|
1883
|
-
|
|
1892
|
+
_this12.sort = Object.keys(n);
|
|
1884
1893
|
}, {
|
|
1885
1894
|
immediate: true
|
|
1886
1895
|
});
|
|
@@ -1895,7 +1904,7 @@
|
|
|
1895
1904
|
}
|
|
1896
1905
|
},
|
|
1897
1906
|
render: function render() {
|
|
1898
|
-
var
|
|
1907
|
+
var _this13 = this;
|
|
1899
1908
|
|
|
1900
1909
|
var keys = this.sort;
|
|
1901
1910
|
var button = this.button;
|
|
@@ -1909,10 +1918,10 @@
|
|
|
1909
1918
|
"class": "_fc-group-plus-minus _fc-group-add fc-clock",
|
|
1910
1919
|
"onClick": this.add
|
|
1911
1920
|
}, null) : keys.map(function (key, index) {
|
|
1912
|
-
var
|
|
1913
|
-
rule =
|
|
1914
|
-
options =
|
|
1915
|
-
var btn = button && !disabled ?
|
|
1921
|
+
var _this13$cacheRule$key = _this13.cacheRule[key],
|
|
1922
|
+
rule = _this13$cacheRule$key.rule,
|
|
1923
|
+
options = _this13$cacheRule$key.options;
|
|
1924
|
+
var btn = button && !disabled ? _this13.makeIcon(keys.length, index, key) : [];
|
|
1916
1925
|
return vue.createVNode("div", {
|
|
1917
1926
|
"class": "_fc-group-container",
|
|
1918
1927
|
"key": key
|
|
@@ -1921,20 +1930,20 @@
|
|
|
1921
1930
|
}, {
|
|
1922
1931
|
disabled: disabled,
|
|
1923
1932
|
'onUpdate:modelValue': function onUpdateModelValue(formData) {
|
|
1924
|
-
return
|
|
1933
|
+
return _this13.formData(key, formData);
|
|
1925
1934
|
},
|
|
1926
1935
|
'onEmit-event': function onEmitEvent(name) {
|
|
1927
1936
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
1928
1937
|
args[_key - 1] = arguments[_key];
|
|
1929
1938
|
}
|
|
1930
1939
|
|
|
1931
|
-
return
|
|
1940
|
+
return _this13.emitEvent(name, args, index, key);
|
|
1932
1941
|
},
|
|
1933
1942
|
'onUpdate:api': function onUpdateApi($f) {
|
|
1934
|
-
return
|
|
1943
|
+
return _this13.add$f(index, key, $f);
|
|
1935
1944
|
},
|
|
1936
1945
|
inFor: true,
|
|
1937
|
-
modelValue:
|
|
1946
|
+
modelValue: _this13.field ? _defineProperty({}, _this13.field, _this13._value(_this13.modelValue[index])) : _this13.modelValue[index],
|
|
1938
1947
|
rule: rule,
|
|
1939
1948
|
option: options,
|
|
1940
1949
|
extendOption: true
|
|
@@ -2083,7 +2092,7 @@
|
|
|
2083
2092
|
return str.replace(str[0], str[0].toLocaleUpperCase());
|
|
2084
2093
|
}
|
|
2085
2094
|
|
|
2086
|
-
var
|
|
2095
|
+
var _getGroupInject = function getGroupInject(vm, parent) {
|
|
2087
2096
|
if (!vm || vm === parent) {
|
|
2088
2097
|
return;
|
|
2089
2098
|
}
|
|
@@ -2093,7 +2102,7 @@
|
|
|
2093
2102
|
}
|
|
2094
2103
|
|
|
2095
2104
|
if (vm.parent) {
|
|
2096
|
-
return
|
|
2105
|
+
return _getGroupInject(vm.parent, parent);
|
|
2097
2106
|
}
|
|
2098
2107
|
};
|
|
2099
2108
|
|
|
@@ -2117,7 +2126,7 @@
|
|
|
2117
2126
|
}
|
|
2118
2127
|
},
|
|
2119
2128
|
extendOption: Boolean,
|
|
2120
|
-
driver: String,
|
|
2129
|
+
driver: [String, Object],
|
|
2121
2130
|
modelValue: Object,
|
|
2122
2131
|
disabled: {
|
|
2123
2132
|
type: Boolean,
|
|
@@ -2127,6 +2136,7 @@
|
|
|
2127
2136
|
type: Boolean,
|
|
2128
2137
|
"default": undefined
|
|
2129
2138
|
},
|
|
2139
|
+
index: [String, Number],
|
|
2130
2140
|
api: Object,
|
|
2131
2141
|
name: String,
|
|
2132
2142
|
subForm: {
|
|
@@ -2164,7 +2174,7 @@
|
|
|
2164
2174
|
|
|
2165
2175
|
var addSubForm = function addSubForm() {
|
|
2166
2176
|
if (parent) {
|
|
2167
|
-
var _inject =
|
|
2177
|
+
var _inject = _getGroupInject(vm, parent);
|
|
2168
2178
|
|
|
2169
2179
|
if (_inject) {
|
|
2170
2180
|
var sub;
|
|
@@ -2182,7 +2192,7 @@
|
|
|
2182
2192
|
};
|
|
2183
2193
|
|
|
2184
2194
|
var rmSubForm = function rmSubForm() {
|
|
2185
|
-
var inject =
|
|
2195
|
+
var inject = _getGroupInject(vm, parent);
|
|
2186
2196
|
|
|
2187
2197
|
if (inject) {
|
|
2188
2198
|
if (isMore) {
|
|
@@ -2200,33 +2210,36 @@
|
|
|
2200
2210
|
|
|
2201
2211
|
var styleEl = null;
|
|
2202
2212
|
vue.onBeforeMount(function () {
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2213
|
+
vue.watchEffect(function () {
|
|
2214
|
+
var content = '';
|
|
2215
|
+
var globalClass = props.option && props.option.globalClass || {};
|
|
2216
|
+
Object.keys(globalClass).forEach(function (k) {
|
|
2217
|
+
var subCss = '';
|
|
2218
|
+
globalClass[k].style && Object.keys(globalClass[k].style).forEach(function (key) {
|
|
2219
|
+
subCss += toLine(key) + ':' + globalClass[k].style[key] + ';';
|
|
2220
|
+
});
|
|
2221
|
+
|
|
2222
|
+
if (globalClass[k].content) {
|
|
2223
|
+
subCss += globalClass[k].content + ';';
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2226
|
+
if (subCss) {
|
|
2227
|
+
content += ".".concat(k, "{").concat(subCss, "}");
|
|
2228
|
+
}
|
|
2209
2229
|
});
|
|
2210
2230
|
|
|
2211
|
-
if (
|
|
2212
|
-
|
|
2231
|
+
if (props.option && props.option.style) {
|
|
2232
|
+
content += props.option.style;
|
|
2213
2233
|
}
|
|
2214
2234
|
|
|
2215
|
-
if (
|
|
2216
|
-
|
|
2235
|
+
if (!styleEl) {
|
|
2236
|
+
styleEl = document.createElement('style');
|
|
2237
|
+
styleEl.type = 'text/css';
|
|
2238
|
+
document.head.appendChild(styleEl);
|
|
2217
2239
|
}
|
|
2218
|
-
});
|
|
2219
2240
|
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
}
|
|
2223
|
-
|
|
2224
|
-
if (content) {
|
|
2225
|
-
styleEl = document.createElement('style');
|
|
2226
|
-
styleEl.type = 'text/css';
|
|
2227
|
-
styleEl.innerHTML = content;
|
|
2228
|
-
document.head.appendChild(styleEl);
|
|
2229
|
-
}
|
|
2241
|
+
styleEl.innerHTML = content || '';
|
|
2242
|
+
});
|
|
2230
2243
|
});
|
|
2231
2244
|
var emit$topForm = debounce(function () {
|
|
2232
2245
|
fc.bus.$emit('$loadData.$topForm');
|
|
@@ -2292,7 +2305,6 @@
|
|
|
2292
2305
|
if (JSON.stringify(n || {}) === data.updateValue) return;
|
|
2293
2306
|
|
|
2294
2307
|
if (fapi.config.forceCoverValue) {
|
|
2295
|
-
fc.$handle.appendData = {};
|
|
2296
2308
|
fapi.coverValue(n || {});
|
|
2297
2309
|
} else {
|
|
2298
2310
|
fapi.setValue(n || {});
|
|
@@ -2300,11 +2312,26 @@
|
|
|
2300
2312
|
}, {
|
|
2301
2313
|
deep: true
|
|
2302
2314
|
});
|
|
2315
|
+
vue.watch(function () {
|
|
2316
|
+
return props.index;
|
|
2317
|
+
}, function () {
|
|
2318
|
+
fapi.coverValue({});
|
|
2319
|
+
vue.nextTick(function () {
|
|
2320
|
+
vue.nextTick(function () {
|
|
2321
|
+
fapi.clearValidateState();
|
|
2322
|
+
});
|
|
2323
|
+
});
|
|
2324
|
+
}, {
|
|
2325
|
+
flush: 'sync'
|
|
2326
|
+
});
|
|
2303
2327
|
return _objectSpread2(_objectSpread2({
|
|
2304
2328
|
fc: vue.markRaw(fc),
|
|
2305
2329
|
parent: parent ? vue.markRaw(parent) : parent,
|
|
2306
2330
|
fapi: vue.markRaw(fapi)
|
|
2307
2331
|
}, vue.toRefs(data)), {}, {
|
|
2332
|
+
getGroupInject: function getGroupInject() {
|
|
2333
|
+
return _getGroupInject(vm, parent);
|
|
2334
|
+
},
|
|
2308
2335
|
refresh: function refresh() {
|
|
2309
2336
|
++data.unique;
|
|
2310
2337
|
},
|
|
@@ -2410,7 +2437,7 @@
|
|
|
2410
2437
|
|
|
2411
2438
|
var keyAttrs = ['type', 'slot', 'emitPrefix', 'value', 'name', 'native', 'hidden', 'display', 'inject', 'options', 'emit', 'link', 'prefix', 'suffix', 'update', 'sync', 'optionsTo', 'key', 'slotUpdate', 'computed', 'preview', 'component', 'cache', 'modelEmit'];
|
|
2412
2439
|
var arrayAttrs = ['validate', 'children', 'control'];
|
|
2413
|
-
var normalAttrs = ['effect'];
|
|
2440
|
+
var normalAttrs = ['effect', 'deep'];
|
|
2414
2441
|
function attrs() {
|
|
2415
2442
|
return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
|
|
2416
2443
|
}
|
|
@@ -2996,6 +3023,31 @@
|
|
|
2996
3023
|
return allSubForm();
|
|
2997
3024
|
},
|
|
2998
3025
|
|
|
3026
|
+
get siblings() {
|
|
3027
|
+
var inject = h.vm.setupState.getGroupInject();
|
|
3028
|
+
|
|
3029
|
+
if (inject) {
|
|
3030
|
+
var subForm = inject.getSubForm();
|
|
3031
|
+
|
|
3032
|
+
if (Array.isArray(subForm)) {
|
|
3033
|
+
return _toConsumableArray(subForm);
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
|
|
3037
|
+
return undefined;
|
|
3038
|
+
},
|
|
3039
|
+
|
|
3040
|
+
get index() {
|
|
3041
|
+
var siblings = api.siblings;
|
|
3042
|
+
|
|
3043
|
+
if (siblings) {
|
|
3044
|
+
var idx = siblings.indexOf(api);
|
|
3045
|
+
return idx > -1 ? idx : undefined;
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3048
|
+
return undefined;
|
|
3049
|
+
},
|
|
3050
|
+
|
|
2999
3051
|
formData: function formData(fields) {
|
|
3000
3052
|
return tidyFields(fields).reduce(function (initial, id) {
|
|
3001
3053
|
var ctx = h.getFieldCtx(id);
|
|
@@ -3013,6 +3065,7 @@
|
|
|
3013
3065
|
var data = _objectSpread2({}, formData || {});
|
|
3014
3066
|
|
|
3015
3067
|
h.deferSyncValue(function () {
|
|
3068
|
+
h.appendData = {};
|
|
3016
3069
|
api.fields().forEach(function (key) {
|
|
3017
3070
|
var ctxs = h.fieldCtx[key];
|
|
3018
3071
|
|
|
@@ -3025,7 +3078,7 @@
|
|
|
3025
3078
|
}
|
|
3026
3079
|
});
|
|
3027
3080
|
extend(h.appendData, data);
|
|
3028
|
-
});
|
|
3081
|
+
}, true);
|
|
3029
3082
|
},
|
|
3030
3083
|
setValue: function setValue(field) {
|
|
3031
3084
|
var formData = field;
|
|
@@ -3038,7 +3091,7 @@
|
|
|
3038
3091
|
ctx.rule.value = formData[key];
|
|
3039
3092
|
});
|
|
3040
3093
|
});
|
|
3041
|
-
});
|
|
3094
|
+
}, true);
|
|
3042
3095
|
},
|
|
3043
3096
|
removeField: function removeField(field) {
|
|
3044
3097
|
var ctx = h.getCtx(field);
|
|
@@ -3310,6 +3363,9 @@
|
|
|
3310
3363
|
ctx.rule.value = copy(ctx.defaultValue);
|
|
3311
3364
|
});
|
|
3312
3365
|
});
|
|
3366
|
+
vue.nextTick(function () {
|
|
3367
|
+
api.clearValidateState();
|
|
3368
|
+
});
|
|
3313
3369
|
},
|
|
3314
3370
|
method: function method(id, name) {
|
|
3315
3371
|
var el = api.el(id);
|
|
@@ -5219,7 +5275,7 @@
|
|
|
5219
5275
|
this.deferSyncFn = null;
|
|
5220
5276
|
|
|
5221
5277
|
if (fn.sync) {
|
|
5222
|
-
this.
|
|
5278
|
+
this.syncForm();
|
|
5223
5279
|
}
|
|
5224
5280
|
}
|
|
5225
5281
|
},
|
|
@@ -5542,7 +5598,9 @@
|
|
|
5542
5598
|
return or ? false : valid;
|
|
5543
5599
|
};
|
|
5544
5600
|
|
|
5545
|
-
|
|
5601
|
+
var _val = checkCondition(item);
|
|
5602
|
+
|
|
5603
|
+
return item.invert === true ? !_val : _val;
|
|
5546
5604
|
} else if (is.Function(item)) {
|
|
5547
5605
|
fn = function fn() {
|
|
5548
5606
|
return item(_this.api.form, _this.api);
|
|
@@ -6844,7 +6902,7 @@
|
|
|
6844
6902
|
}
|
|
6845
6903
|
|
|
6846
6904
|
if (this.vm.props.driver) {
|
|
6847
|
-
this.renderDriver = this.drivers[this.vm.props.driver];
|
|
6905
|
+
this.renderDriver = _typeof(this.vm.props.driver) === 'object' ? this.vm.props.driver : this.drivers[this.vm.props.driver];
|
|
6848
6906
|
}
|
|
6849
6907
|
|
|
6850
6908
|
if (!this.renderDriver && this.vm.setupState.parent) {
|
|
@@ -6973,6 +7031,8 @@
|
|
|
6973
7031
|
unwatch();
|
|
6974
7032
|
|
|
6975
7033
|
_this5.bus.$emit('$loadData.$var.' + key);
|
|
7034
|
+
|
|
7035
|
+
return val;
|
|
6976
7036
|
}
|
|
6977
7037
|
|
|
6978
7038
|
val = invoke(function () {
|
|
@@ -7618,11 +7678,12 @@
|
|
|
7618
7678
|
var rule = ctx.prop;
|
|
7619
7679
|
var uni = "".concat(this.key).concat(ctx.key);
|
|
7620
7680
|
var col = rule.col;
|
|
7621
|
-
var isTitle = this.isTitle(rule);
|
|
7681
|
+
var isTitle = this.isTitle(rule) && rule.wrap.title !== false;
|
|
7622
7682
|
var labelWidth = !col.labelWidth && !isTitle ? 0 : col.labelWidth;
|
|
7623
7683
|
var _this$rule$props = this.rule.props,
|
|
7624
7684
|
inline = _this$rule$props.inline,
|
|
7625
7685
|
_col = _this$rule$props.col;
|
|
7686
|
+
delete rule.wrap.title;
|
|
7626
7687
|
var item = isFalse(rule.wrap.show) ? children : this.$r(mergeProps([rule.wrap, {
|
|
7627
7688
|
props: _objectSpread2(_objectSpread2({
|
|
7628
7689
|
labelWidth: labelWidth === void 0 ? labelWidth : toString(labelWidth),
|
|
@@ -8146,7 +8207,7 @@
|
|
|
8146
8207
|
function elmFormCreate() {
|
|
8147
8208
|
return FormCreateFactory({
|
|
8148
8209
|
ui: 'element-ui',
|
|
8149
|
-
version: '3.2.
|
|
8210
|
+
version: '3.2.8',
|
|
8150
8211
|
manager: manager,
|
|
8151
8212
|
extendApi: extendApi,
|
|
8152
8213
|
install: install,
|