@form-create/element-ui 3.1.28 → 3.1.30
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 +748 -376
- package/dist/form-create.esm.min.js +2 -2
- package/dist/form-create.js +747 -375
- package/dist/form-create.min.js +2 -2
- package/package.json +12 -12
- package/src/core/manager.js +7 -6
- package/src/core/provider.js +1 -0
- package/src/style/index.css +9 -1
package/dist/form-create.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @form-create/element-ui v3.1.
|
|
2
|
+
* @form-create/element-ui v3.1.30
|
|
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, onMounted, onBeforeUnmount, onUpdated, computed, withDirectives, resolveDirective, createApp, h, ref } from 'vue';
|
|
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';
|
|
8
8
|
|
|
9
9
|
function ownKeys(object, enumerableOnly) {
|
|
10
10
|
var keys = Object.keys(object);
|
|
@@ -253,13 +253,15 @@ var Checkbox = defineComponent({
|
|
|
253
253
|
var props = _objectSpread2({}, opt);
|
|
254
254
|
|
|
255
255
|
var value = props.value;
|
|
256
|
+
var label = props.label;
|
|
256
257
|
delete props.value;
|
|
258
|
+
delete props.label;
|
|
257
259
|
return createVNode(Type, mergeProps$1(props, {
|
|
258
|
-
"
|
|
259
|
-
"key": name + index + '-' +
|
|
260
|
+
"value": value,
|
|
261
|
+
"key": name + index + '-' + value
|
|
260
262
|
}), {
|
|
261
263
|
"default": function _default() {
|
|
262
|
-
return [
|
|
264
|
+
return [label || value || ''];
|
|
263
265
|
}
|
|
264
266
|
});
|
|
265
267
|
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
|
|
@@ -997,13 +999,15 @@ var Radio = defineComponent({
|
|
|
997
999
|
var props = _objectSpread2({}, opt);
|
|
998
1000
|
|
|
999
1001
|
var value = props.value;
|
|
1002
|
+
var label = props.label;
|
|
1000
1003
|
delete props.value;
|
|
1004
|
+
delete props.label;
|
|
1001
1005
|
return createVNode(Type, mergeProps$1(props, {
|
|
1002
|
-
"
|
|
1003
|
-
"key": name + index + '-' +
|
|
1006
|
+
"value": value,
|
|
1007
|
+
"key": name + index + '-' + value
|
|
1004
1008
|
}), {
|
|
1005
1009
|
"default": function _default() {
|
|
1006
|
-
return [
|
|
1010
|
+
return [label || value || ''];
|
|
1007
1011
|
}
|
|
1008
1012
|
});
|
|
1009
1013
|
}), (_this$$slots$default = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)];
|
|
@@ -1415,6 +1419,10 @@ var _extends = Object.assign || function (a) {
|
|
|
1415
1419
|
function extend() {
|
|
1416
1420
|
return _extends.apply(this, arguments);
|
|
1417
1421
|
}
|
|
1422
|
+
function copy$1(obj) {
|
|
1423
|
+
if (_typeof(obj) !== 'object' || obj === null) return obj;
|
|
1424
|
+
return obj instanceof Array ? _toConsumableArray(obj) : _objectSpread2({}, obj);
|
|
1425
|
+
}
|
|
1418
1426
|
|
|
1419
1427
|
var css_248z$1 = "._fc-group{display:flex;flex-direction:column;justify-content:center;min-height:38px;width:100%}._fc-group-disabled ._fc-group-add,._fc-group-disabled ._fc-group-btn{cursor:not-allowed}._fc-group-handle{background-color:#fff;border:1px dashed #d9d9d9;border-radius:15px;bottom:-15px;display:flex;flex-direction:row;padding:3px 8px;position:absolute;right:30px}._fc-group-btn{cursor:pointer}._fc-group-idx{align-items:center;background:#eee;border-radius:15px;bottom:-15px;display:flex;font-weight:700;height:30px;justify-content:center;left:10px;position:absolute;width:30px}._fc-group-handle ._fc-group-btn+._fc-group-btn{margin-left:7px}._fc-group-container{border:1px dashed #d9d9d9;border-radius:5px;display:flex;flex-direction:column;margin:5px 5px 25px;padding:20px 20px 25px;position:relative}._fc-group-arrow{height:20px;position:relative;width:20px}._fc-group-arrow:before{border-left:2px solid #999;border-top:2px solid #999;content:\"\";height:9px;left:5px;position:absolute;top:8px;transform:rotate(45deg);width:9px}._fc-group-arrow._fc-group-down{transform:rotate(180deg)}._fc-group-plus-minus{cursor:pointer;height:20px;position:relative;width:20px}._fc-group-plus-minus:after,._fc-group-plus-minus:before{background-color:#409eff;content:\"\";height:2px;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60%}._fc-group-plus-minus:before{transform:translate(-50%,-50%) rotate(90deg)}._fc-group-plus-minus._fc-group-minus:before{display:none}._fc-group-plus-minus._fc-group-minus:after{background-color:#f56c6c}._fc-group-add{border:1px solid rgba(64,158,255,.5);border-radius:15px;cursor:pointer;height:25px;width:25px}._fc-group-add._fc-group-plus-minus:after,._fc-group-add._fc-group-plus-minus:before{width:50%}";
|
|
1420
1428
|
styleInject(css_248z$1);
|
|
@@ -1798,7 +1806,7 @@ var Group = defineComponent({
|
|
|
1798
1806
|
add: this.add
|
|
1799
1807
|
}) : createVNode("div", {
|
|
1800
1808
|
"key": 'a_def',
|
|
1801
|
-
"class": "_fc-group-plus-minus _fc-group-add",
|
|
1809
|
+
"class": "_fc-group-plus-minus _fc-group-add fc-clock",
|
|
1802
1810
|
"onClick": this.add
|
|
1803
1811
|
}, null) : keys.map(function (key, index) {
|
|
1804
1812
|
var _this12$cacheRule$key = _this12.cacheRule[key],
|
|
@@ -1832,7 +1840,7 @@ var Group = defineComponent({
|
|
|
1832
1840
|
}), null), createVNode("div", {
|
|
1833
1841
|
"class": "_fc-group-idx"
|
|
1834
1842
|
}, [index + 1]), btn.length ? createVNode("div", {
|
|
1835
|
-
"class": "_fc-group-handle"
|
|
1843
|
+
"class": "_fc-group-handle fc-clock"
|
|
1836
1844
|
}, [btn]) : null]);
|
|
1837
1845
|
});
|
|
1838
1846
|
return createVNode("div", {
|
|
@@ -1953,6 +1961,142 @@ script.render = render;
|
|
|
1953
1961
|
|
|
1954
1962
|
var components = [Checkbox, Frame, Radio, Select, Tree, Upload, Group, Sub, script];
|
|
1955
1963
|
|
|
1964
|
+
function toString(val) {
|
|
1965
|
+
return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
|
|
1966
|
+
}
|
|
1967
|
+
|
|
1968
|
+
function toLine(name) {
|
|
1969
|
+
var line = name.replace(/([A-Z])/g, '-$1').toLocaleLowerCase();
|
|
1970
|
+
if (line.indexOf('-') === 0) line = line.substr(1);
|
|
1971
|
+
return line;
|
|
1972
|
+
}
|
|
1973
|
+
function upper(str) {
|
|
1974
|
+
return str.replace(str[0], str[0].toLocaleUpperCase());
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
function format(type, msg, rule) {
|
|
1978
|
+
return "[form-create ".concat(type, "]: ").concat(msg) + (rule ? '\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule) : '');
|
|
1979
|
+
}
|
|
1980
|
+
function err(msg, rule) {
|
|
1981
|
+
console.error(format('err', msg, rule));
|
|
1982
|
+
}
|
|
1983
|
+
function logError(e) {
|
|
1984
|
+
err(e.toString());
|
|
1985
|
+
console.error(e);
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
var PREFIX = '[[FORM-CREATE-PREFIX-';
|
|
1989
|
+
var SUFFIX = '-FORM-CREATE-SUFFIX]]';
|
|
1990
|
+
var $T = '$FN:';
|
|
1991
|
+
var $TX = '$FNX:';
|
|
1992
|
+
var $ON = '$GLOBAL:';
|
|
1993
|
+
var FUNCTION = 'function';
|
|
1994
|
+
function toJson(obj, space) {
|
|
1995
|
+
return JSON.stringify(deepExtend(Array.isArray(obj) ? [] : {}, obj, true), function (key, val) {
|
|
1996
|
+
if (val && val._isVue === true) return undefined;
|
|
1997
|
+
|
|
1998
|
+
if (_typeof(val) !== FUNCTION) {
|
|
1999
|
+
return val;
|
|
2000
|
+
}
|
|
2001
|
+
|
|
2002
|
+
if (val.__json) {
|
|
2003
|
+
return val.__json;
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
if (val.__origin) val = val.__origin;
|
|
2007
|
+
if (val.__emit) return undefined;
|
|
2008
|
+
return PREFIX + val + SUFFIX;
|
|
2009
|
+
}, space);
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
function makeFn(fn) {
|
|
2013
|
+
return new Function('return ' + fn)();
|
|
2014
|
+
}
|
|
2015
|
+
|
|
2016
|
+
function parseFn(fn, mode) {
|
|
2017
|
+
if (fn && is.String(fn) && fn.length > 4) {
|
|
2018
|
+
var v = fn.trim();
|
|
2019
|
+
var flag = false;
|
|
2020
|
+
|
|
2021
|
+
try {
|
|
2022
|
+
if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
|
|
2023
|
+
v = v.replace(SUFFIX, '').replace(PREFIX, '');
|
|
2024
|
+
flag = true;
|
|
2025
|
+
} else if (v.indexOf($T) === 0) {
|
|
2026
|
+
v = v.replace($T, '');
|
|
2027
|
+
flag = true;
|
|
2028
|
+
} else if (v.indexOf($ON) === 0) {
|
|
2029
|
+
var name = v.replace($ON, '');
|
|
2030
|
+
|
|
2031
|
+
v = function v() {
|
|
2032
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2033
|
+
args[_key] = arguments[_key];
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
var callback = args[0].api.getGlobalEvent(name);
|
|
2037
|
+
|
|
2038
|
+
if (callback) {
|
|
2039
|
+
return callback.call.apply(callback, [this].concat(args));
|
|
2040
|
+
}
|
|
2041
|
+
|
|
2042
|
+
return undefined;
|
|
2043
|
+
};
|
|
2044
|
+
|
|
2045
|
+
v.__json = fn;
|
|
2046
|
+
v.__inject = true;
|
|
2047
|
+
return v;
|
|
2048
|
+
} else if (v.indexOf($TX) === 0) {
|
|
2049
|
+
v = makeFn('function($inject){' + v.replace($TX, '') + '}');
|
|
2050
|
+
v.__json = fn;
|
|
2051
|
+
v.__inject = true;
|
|
2052
|
+
return v;
|
|
2053
|
+
} else if (!mode && v.indexOf(FUNCTION) === 0 && v !== FUNCTION) {
|
|
2054
|
+
flag = true;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
if (!flag) return fn;
|
|
2058
|
+
var val = makeFn(v.indexOf(FUNCTION) === -1 && v.indexOf('(') !== 0 ? FUNCTION + ' ' + v : v);
|
|
2059
|
+
val.__json = fn;
|
|
2060
|
+
return val;
|
|
2061
|
+
} catch (e) {
|
|
2062
|
+
err("\u89E3\u6790\u5931\u8D25:".concat(v, "\n\nerr: ").concat(e));
|
|
2063
|
+
return undefined;
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
return fn;
|
|
2068
|
+
}
|
|
2069
|
+
function parseJson(json, mode) {
|
|
2070
|
+
return JSON.parse(json, function (k, v) {
|
|
2071
|
+
if (is.Undef(v) || !v.indexOf) return v;
|
|
2072
|
+
return parseFn(v, mode);
|
|
2073
|
+
});
|
|
2074
|
+
}
|
|
2075
|
+
|
|
2076
|
+
var id$2 = 0;
|
|
2077
|
+
function uniqueId() {
|
|
2078
|
+
var num = 370 + ++id$2;
|
|
2079
|
+
return 'F' + Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now())).toString(36) + num.toString(36) + 'c';
|
|
2080
|
+
}
|
|
2081
|
+
|
|
2082
|
+
function deepSet(data, idx, val) {
|
|
2083
|
+
var _data = data,
|
|
2084
|
+
to;
|
|
2085
|
+
(idx || '').split('.').forEach(function (v) {
|
|
2086
|
+
if (to) {
|
|
2087
|
+
if (!_data[to] || _typeof(_data[to]) != 'object') {
|
|
2088
|
+
_data[to] = {};
|
|
2089
|
+
}
|
|
2090
|
+
|
|
2091
|
+
_data = _data[to];
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
to = v;
|
|
2095
|
+
});
|
|
2096
|
+
_data[to] = val;
|
|
2097
|
+
return _data;
|
|
2098
|
+
}
|
|
2099
|
+
|
|
1956
2100
|
var NAME$1 = 'FormCreate';
|
|
1957
2101
|
|
|
1958
2102
|
var getRuleInject = function getRuleInject(vm, parent) {
|
|
@@ -1990,6 +2134,10 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
1990
2134
|
},
|
|
1991
2135
|
extendOption: Boolean,
|
|
1992
2136
|
modelValue: Object,
|
|
2137
|
+
disabled: {
|
|
2138
|
+
type: Boolean,
|
|
2139
|
+
"default": undefined
|
|
2140
|
+
},
|
|
1993
2141
|
api: Object,
|
|
1994
2142
|
name: String,
|
|
1995
2143
|
subForm: {
|
|
@@ -1998,7 +2146,7 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
1998
2146
|
},
|
|
1999
2147
|
inFor: Boolean
|
|
2000
2148
|
},
|
|
2001
|
-
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail'],
|
|
2149
|
+
emits: ['update:api', 'update:modelValue', 'mounted', 'submit', 'change', 'emit-event', 'control', 'remove-rule', 'remove-field', 'sync', 'reload', 'repeat-field', 'update', 'validate-field-fail', 'validate-fail', 'created'],
|
|
2002
2150
|
render: function render() {
|
|
2003
2151
|
return this.fc.render();
|
|
2004
2152
|
},
|
|
@@ -2019,7 +2167,7 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
2019
2167
|
isShow: true,
|
|
2020
2168
|
unique: 1,
|
|
2021
2169
|
renderRule: _toConsumableArray(rule.value || []),
|
|
2022
|
-
updateValue: JSON.stringify(modelValue || {})
|
|
2170
|
+
updateValue: JSON.stringify(modelValue.value || {})
|
|
2023
2171
|
});
|
|
2024
2172
|
var fc = new FormCreate(vm);
|
|
2025
2173
|
var fapi = fc.api();
|
|
@@ -2061,10 +2209,37 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
2061
2209
|
}
|
|
2062
2210
|
};
|
|
2063
2211
|
|
|
2212
|
+
var styleEl = null;
|
|
2213
|
+
onBeforeMount(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
|
+
}
|
|
2229
|
+
});
|
|
2230
|
+
|
|
2231
|
+
if (content) {
|
|
2232
|
+
styleEl = document.createElement('style');
|
|
2233
|
+
styleEl.type = 'text/css';
|
|
2234
|
+
styleEl.innerHTML = content;
|
|
2235
|
+
document.head.appendChild(styleEl);
|
|
2236
|
+
}
|
|
2237
|
+
});
|
|
2064
2238
|
onMounted(function () {
|
|
2065
2239
|
fc.mounted();
|
|
2066
2240
|
});
|
|
2067
2241
|
onBeforeUnmount(function () {
|
|
2242
|
+
styleEl && document.head.removeChild(styleEl);
|
|
2068
2243
|
rmSubForm();
|
|
2069
2244
|
data.destroyed = true;
|
|
2070
2245
|
fc.unmount();
|
|
@@ -2088,12 +2263,17 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
2088
2263
|
});
|
|
2089
2264
|
watch(function () {
|
|
2090
2265
|
return props.option;
|
|
2091
|
-
}, function (
|
|
2092
|
-
fc.initOptions(
|
|
2266
|
+
}, function () {
|
|
2267
|
+
fc.initOptions();
|
|
2093
2268
|
fapi.refresh();
|
|
2094
2269
|
}, {
|
|
2095
2270
|
deep: true
|
|
2096
2271
|
});
|
|
2272
|
+
watch(function () {
|
|
2273
|
+
return props.disabled;
|
|
2274
|
+
}, function () {
|
|
2275
|
+
fapi.refresh();
|
|
2276
|
+
});
|
|
2097
2277
|
watch(modelValue, function (n) {
|
|
2098
2278
|
if (JSON.stringify(n || {}) === data.updateValue) return;
|
|
2099
2279
|
fapi.config.forceCoverValue ? fapi.coverValue(n || {}) : fapi.setValue(n || {});
|
|
@@ -2113,15 +2293,21 @@ function $FormCreate(FormCreate, components, directives) {
|
|
|
2113
2293
|
},
|
|
2114
2294
|
updateValue: function updateValue(value) {
|
|
2115
2295
|
if (data.destroyed) return;
|
|
2116
|
-
|
|
2296
|
+
var json = JSON.stringify(value);
|
|
2297
|
+
|
|
2298
|
+
if (data.updateValue === json) {
|
|
2299
|
+
return;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
data.updateValue = json;
|
|
2117
2303
|
vm.emit('update:modelValue', value);
|
|
2118
2304
|
}
|
|
2119
2305
|
});
|
|
2120
2306
|
},
|
|
2121
2307
|
created: function created() {
|
|
2122
2308
|
var vm = getCurrentInstance();
|
|
2123
|
-
vm.setupState.fc.init();
|
|
2124
2309
|
vm.emit('update:api', vm.setupState.fapi);
|
|
2310
|
+
vm.setupState.fc.init();
|
|
2125
2311
|
}
|
|
2126
2312
|
});
|
|
2127
2313
|
}
|
|
@@ -2195,100 +2381,13 @@ var mergeFn = function mergeFn(fn1, fn2) {
|
|
|
2195
2381
|
};
|
|
2196
2382
|
};
|
|
2197
2383
|
|
|
2198
|
-
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'];
|
|
2384
|
+
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'];
|
|
2199
2385
|
var arrayAttrs = ['validate', 'children', 'control'];
|
|
2200
2386
|
var normalAttrs = ['effect'];
|
|
2201
2387
|
function attrs() {
|
|
2202
2388
|
return [].concat(keyAttrs, _toConsumableArray(normalMerge), _toConsumableArray(toArrayMerge), _toConsumableArray(functionalMerge), arrayAttrs, normalAttrs);
|
|
2203
2389
|
}
|
|
2204
2390
|
|
|
2205
|
-
function format(type, msg, rule) {
|
|
2206
|
-
return "[form-create ".concat(type, "]: ").concat(msg) + (rule ? '\n\nrule: ' + JSON.stringify(rule.getRule ? rule.getRule() : rule) : '');
|
|
2207
|
-
}
|
|
2208
|
-
function err(msg, rule) {
|
|
2209
|
-
console.error(format('err', msg, rule));
|
|
2210
|
-
}
|
|
2211
|
-
function logError(e) {
|
|
2212
|
-
err(e.toString());
|
|
2213
|
-
console.error(e);
|
|
2214
|
-
}
|
|
2215
|
-
|
|
2216
|
-
function toLine(name) {
|
|
2217
|
-
var line = name.replace(/([A-Z])/g, '-$1').toLocaleLowerCase();
|
|
2218
|
-
if (line.indexOf('-') === 0) line = line.substr(1);
|
|
2219
|
-
return line;
|
|
2220
|
-
}
|
|
2221
|
-
function upper(str) {
|
|
2222
|
-
return str.replace(str[0], str[0].toLocaleUpperCase());
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
var PREFIX = '[[FORM-CREATE-PREFIX-';
|
|
2226
|
-
var SUFFIX = '-FORM-CREATE-SUFFIX]]';
|
|
2227
|
-
var $T = '$FN:';
|
|
2228
|
-
var $TX = '$FNX:';
|
|
2229
|
-
var FUNCTION = 'function';
|
|
2230
|
-
function toJson(obj, space) {
|
|
2231
|
-
return JSON.stringify(deepExtend([], obj, true), function (key, val) {
|
|
2232
|
-
if (val && val._isVue === true) return undefined;
|
|
2233
|
-
|
|
2234
|
-
if (_typeof(val) !== FUNCTION) {
|
|
2235
|
-
return val;
|
|
2236
|
-
}
|
|
2237
|
-
|
|
2238
|
-
if (val.__json) {
|
|
2239
|
-
return val.__json;
|
|
2240
|
-
}
|
|
2241
|
-
|
|
2242
|
-
if (val.__origin) val = val.__origin;
|
|
2243
|
-
if (val.__emit) return undefined;
|
|
2244
|
-
return PREFIX + val + SUFFIX;
|
|
2245
|
-
}, space);
|
|
2246
|
-
}
|
|
2247
|
-
|
|
2248
|
-
function makeFn(fn) {
|
|
2249
|
-
return new Function('return ' + fn)();
|
|
2250
|
-
}
|
|
2251
|
-
|
|
2252
|
-
function parseFn(fn, mode) {
|
|
2253
|
-
if (fn && is.String(fn) && fn.length > 4) {
|
|
2254
|
-
var v = fn.trim();
|
|
2255
|
-
var flag = false;
|
|
2256
|
-
|
|
2257
|
-
try {
|
|
2258
|
-
if (v.indexOf(SUFFIX) > 0 && v.indexOf(PREFIX) === 0) {
|
|
2259
|
-
v = v.replace(SUFFIX, '').replace(PREFIX, '');
|
|
2260
|
-
flag = true;
|
|
2261
|
-
} else if (v.indexOf($T) === 0) {
|
|
2262
|
-
v = v.replace($T, '');
|
|
2263
|
-
flag = true;
|
|
2264
|
-
} else if (v.indexOf($TX) === 0) {
|
|
2265
|
-
v = makeFn('function($inject){' + v.replace($TX, '') + '}');
|
|
2266
|
-
v.__json = fn;
|
|
2267
|
-
v.__inject = true;
|
|
2268
|
-
return v;
|
|
2269
|
-
} else if (!mode && v.indexOf(FUNCTION) === 0 && v !== FUNCTION) {
|
|
2270
|
-
flag = true;
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
if (!flag) return fn;
|
|
2274
|
-
var val = makeFn(v.indexOf(FUNCTION) === -1 && v.indexOf('(') !== 0 ? FUNCTION + ' ' + v : v);
|
|
2275
|
-
val.__json = fn;
|
|
2276
|
-
return val;
|
|
2277
|
-
} catch (e) {
|
|
2278
|
-
err("\u89E3\u6790\u5931\u8D25:".concat(v, "\n\nerr: ").concat(e));
|
|
2279
|
-
return undefined;
|
|
2280
|
-
}
|
|
2281
|
-
}
|
|
2282
|
-
|
|
2283
|
-
return fn;
|
|
2284
|
-
}
|
|
2285
|
-
function parseJson(json, mode) {
|
|
2286
|
-
return JSON.parse(json, function (k, v) {
|
|
2287
|
-
if (is.Undef(v) || !v.indexOf) return v;
|
|
2288
|
-
return parseFn(v, mode);
|
|
2289
|
-
});
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
2391
|
function enumerable(value, writable) {
|
|
2293
2392
|
return {
|
|
2294
2393
|
value: value,
|
|
@@ -2445,6 +2544,10 @@ function toProps(rule) {
|
|
|
2445
2544
|
if (prop.slot) delete prop.slot;
|
|
2446
2545
|
return prop;
|
|
2447
2546
|
}
|
|
2547
|
+
function setPrototypeOf(o, proto) {
|
|
2548
|
+
Object.setPrototypeOf(o, proto);
|
|
2549
|
+
return o;
|
|
2550
|
+
}
|
|
2448
2551
|
|
|
2449
2552
|
function baseRule() {
|
|
2450
2553
|
return {
|
|
@@ -2521,6 +2624,107 @@ function makerFactory() {
|
|
|
2521
2624
|
};
|
|
2522
2625
|
}
|
|
2523
2626
|
|
|
2627
|
+
function getError(action, option, xhr) {
|
|
2628
|
+
var msg = "fail to ".concat(action, " ").concat(xhr.status, "'");
|
|
2629
|
+
var err = new Error(msg);
|
|
2630
|
+
err.status = xhr.status;
|
|
2631
|
+
err.url = action;
|
|
2632
|
+
return err;
|
|
2633
|
+
}
|
|
2634
|
+
|
|
2635
|
+
function getBody(xhr) {
|
|
2636
|
+
var text = xhr.responseText || xhr.response;
|
|
2637
|
+
|
|
2638
|
+
if (!text) {
|
|
2639
|
+
return text;
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
try {
|
|
2643
|
+
return JSON.parse(text);
|
|
2644
|
+
} catch (e) {
|
|
2645
|
+
return text;
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
function fetch$1(option) {
|
|
2650
|
+
if (typeof XMLHttpRequest === 'undefined') {
|
|
2651
|
+
return;
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
var xhr = new XMLHttpRequest();
|
|
2655
|
+
var action = option.action;
|
|
2656
|
+
|
|
2657
|
+
xhr.onerror = function error(e) {
|
|
2658
|
+
option.onError(e);
|
|
2659
|
+
};
|
|
2660
|
+
|
|
2661
|
+
xhr.onload = function onload() {
|
|
2662
|
+
if (xhr.status < 200 || xhr.status >= 300) {
|
|
2663
|
+
return option.onError(getError(action, option, xhr), getBody(xhr));
|
|
2664
|
+
}
|
|
2665
|
+
|
|
2666
|
+
option.onSuccess(getBody(xhr));
|
|
2667
|
+
};
|
|
2668
|
+
|
|
2669
|
+
xhr.open(option.method || 'get', action, true);
|
|
2670
|
+
var formData;
|
|
2671
|
+
|
|
2672
|
+
if (option.data) {
|
|
2673
|
+
if ((option.dataType || '').toLowerCase() !== 'json') {
|
|
2674
|
+
formData = new FormData();
|
|
2675
|
+
Object.keys(option.data).map(function (key) {
|
|
2676
|
+
formData.append(key, option.data[key]);
|
|
2677
|
+
});
|
|
2678
|
+
} else {
|
|
2679
|
+
formData = JSON.stringify(option.data);
|
|
2680
|
+
xhr.setRequestHeader('content-type', 'application/json');
|
|
2681
|
+
}
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
if (option.withCredentials && 'withCredentials' in xhr) {
|
|
2685
|
+
xhr.withCredentials = true;
|
|
2686
|
+
}
|
|
2687
|
+
|
|
2688
|
+
var headers = option.headers || {};
|
|
2689
|
+
Object.keys(headers).forEach(function (item) {
|
|
2690
|
+
if (headers[item] !== null) {
|
|
2691
|
+
xhr.setRequestHeader(item, headers[item]);
|
|
2692
|
+
}
|
|
2693
|
+
});
|
|
2694
|
+
xhr.send(formData);
|
|
2695
|
+
}
|
|
2696
|
+
function asyncFetch(config) {
|
|
2697
|
+
return new Promise(function (resolve, reject) {
|
|
2698
|
+
fetch$1(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
2699
|
+
onSuccess: function onSuccess(res) {
|
|
2700
|
+
var fn = function fn(v) {
|
|
2701
|
+
return v;
|
|
2702
|
+
};
|
|
2703
|
+
|
|
2704
|
+
var parse = parseFn(config.parse);
|
|
2705
|
+
|
|
2706
|
+
if (is.Function(parse)) {
|
|
2707
|
+
fn = parse;
|
|
2708
|
+
} else if (parse && is.String(parse)) {
|
|
2709
|
+
fn = function fn(v) {
|
|
2710
|
+
parse.split('.').forEach(function (k) {
|
|
2711
|
+
if (v) {
|
|
2712
|
+
v = v[k];
|
|
2713
|
+
}
|
|
2714
|
+
});
|
|
2715
|
+
return v;
|
|
2716
|
+
};
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
resolve(fn(res));
|
|
2720
|
+
},
|
|
2721
|
+
onError: function onError(err) {
|
|
2722
|
+
reject(err);
|
|
2723
|
+
}
|
|
2724
|
+
}));
|
|
2725
|
+
});
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2524
2728
|
function copy(value) {
|
|
2525
2729
|
return deepCopy(value);
|
|
2526
2730
|
}
|
|
@@ -2576,7 +2780,15 @@ function Api(h) {
|
|
|
2576
2780
|
},
|
|
2577
2781
|
|
|
2578
2782
|
get parent() {
|
|
2579
|
-
return h.vm.parent && h.vm.parent.setupState.fapi;
|
|
2783
|
+
return h.vm.setupState.parent && h.vm.setupState.parent.setupState.fapi;
|
|
2784
|
+
},
|
|
2785
|
+
|
|
2786
|
+
get top() {
|
|
2787
|
+
if (api.parent) {
|
|
2788
|
+
return api.parent.top;
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
return api;
|
|
2580
2792
|
},
|
|
2581
2793
|
|
|
2582
2794
|
get children() {
|
|
@@ -2825,6 +3037,23 @@ function Api(h) {
|
|
|
2825
3037
|
return origin ? ctx.origin : ctx.rule;
|
|
2826
3038
|
}
|
|
2827
3039
|
},
|
|
3040
|
+
getRenderRule: function getRenderRule(id) {
|
|
3041
|
+
var ctx = h.getCtx(id);
|
|
3042
|
+
|
|
3043
|
+
if (ctx) {
|
|
3044
|
+
return ctx.prop;
|
|
3045
|
+
}
|
|
3046
|
+
},
|
|
3047
|
+
getRefRule: function getRefRule(id) {
|
|
3048
|
+
var ctxs = h.getCtxs(id);
|
|
3049
|
+
|
|
3050
|
+
if (ctxs) {
|
|
3051
|
+
var rules = ctxs.map(function (ctx) {
|
|
3052
|
+
return ctx.rule;
|
|
3053
|
+
});
|
|
3054
|
+
return rules.length === 1 ? rules[0] : rules;
|
|
3055
|
+
}
|
|
3056
|
+
},
|
|
2828
3057
|
setEffect: function setEffect(id, attr, value) {
|
|
2829
3058
|
var ctx = h.getCtx(id);
|
|
2830
3059
|
|
|
@@ -2920,6 +3149,84 @@ function Api(h) {
|
|
|
2920
3149
|
var ctx = h.getCtx(field);
|
|
2921
3150
|
return ctx ? h.subForm[ctx.id] : undefined;
|
|
2922
3151
|
},
|
|
3152
|
+
getChildrenRuleList: function getChildrenRuleList(id) {
|
|
3153
|
+
var flag = _typeof(id) === 'object';
|
|
3154
|
+
var ctx = flag ? byCtx(id) : h.getCtx(id);
|
|
3155
|
+
var rule = ctx ? ctx.rule : flag ? id : api.getRule(id);
|
|
3156
|
+
|
|
3157
|
+
if (!rule) {
|
|
3158
|
+
return [];
|
|
3159
|
+
}
|
|
3160
|
+
|
|
3161
|
+
var rules = [];
|
|
3162
|
+
|
|
3163
|
+
var findRules = function findRules(children) {
|
|
3164
|
+
children && children.forEach(function (item) {
|
|
3165
|
+
if (_typeof(item) !== 'object') {
|
|
3166
|
+
return;
|
|
3167
|
+
}
|
|
3168
|
+
|
|
3169
|
+
if (item.field) {
|
|
3170
|
+
rules.push(item);
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
rules.push.apply(rules, _toConsumableArray(api.getChildrenRuleList(item)));
|
|
3174
|
+
});
|
|
3175
|
+
};
|
|
3176
|
+
|
|
3177
|
+
findRules(ctx ? ctx.loadChildrenPending() : rule.children);
|
|
3178
|
+
return rules;
|
|
3179
|
+
},
|
|
3180
|
+
getChildrenFormData: function getChildrenFormData(id) {
|
|
3181
|
+
var rules = api.getChildrenRuleList(id);
|
|
3182
|
+
return rules.reduce(function (formData, rule) {
|
|
3183
|
+
formData[rule.field] = copy(rule.value);
|
|
3184
|
+
return formData;
|
|
3185
|
+
}, {});
|
|
3186
|
+
},
|
|
3187
|
+
setChildrenFormData: function setChildrenFormData(id, formData, cover) {
|
|
3188
|
+
var rules = api.getChildrenRuleList(id);
|
|
3189
|
+
rules.forEach(function (rule) {
|
|
3190
|
+
if (hasProperty(formData, rule.field)) {
|
|
3191
|
+
rule.value = formData[rule.field];
|
|
3192
|
+
} else if (cover) {
|
|
3193
|
+
rule.value = undefined;
|
|
3194
|
+
}
|
|
3195
|
+
});
|
|
3196
|
+
},
|
|
3197
|
+
getGlobalEvent: function getGlobalEvent(name) {
|
|
3198
|
+
var event = api.options.globalEvent[name];
|
|
3199
|
+
|
|
3200
|
+
if (event) {
|
|
3201
|
+
if (_typeof(event) === 'object') {
|
|
3202
|
+
event = event.handle;
|
|
3203
|
+
}
|
|
3204
|
+
|
|
3205
|
+
return parseFn(event);
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
return undefined;
|
|
3209
|
+
},
|
|
3210
|
+
getGlobalData: function getGlobalData(name) {
|
|
3211
|
+
return new Promise(function (resolve, inject) {
|
|
3212
|
+
var config = api.options.globalData[name];
|
|
3213
|
+
|
|
3214
|
+
if (!config) {
|
|
3215
|
+
resolve(h.fc.loadData[name]);
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3218
|
+
if (config.type === 'fetch') {
|
|
3219
|
+
api.fetch(config).then(function (res) {
|
|
3220
|
+
resolve({
|
|
3221
|
+
res: res,
|
|
3222
|
+
config: config
|
|
3223
|
+
});
|
|
3224
|
+
})["catch"](inject);
|
|
3225
|
+
} else {
|
|
3226
|
+
resolve(config.data);
|
|
3227
|
+
}
|
|
3228
|
+
});
|
|
3229
|
+
},
|
|
2923
3230
|
nextTick: function nextTick(fn) {
|
|
2924
3231
|
h.bus.$once('next-tick', fn);
|
|
2925
3232
|
h.refresh();
|
|
@@ -2940,12 +3247,21 @@ function Api(h) {
|
|
|
2940
3247
|
|
|
2941
3248
|
(_h$vm = h.vm).emit.apply(_h$vm, [name].concat(args));
|
|
2942
3249
|
},
|
|
3250
|
+
bus: h.bus,
|
|
3251
|
+
fetch: function fetch(opt) {
|
|
3252
|
+
h.options.beforeFetch && invoke(function () {
|
|
3253
|
+
return h.options.beforeFetch(opt, {
|
|
3254
|
+
api: api
|
|
3255
|
+
});
|
|
3256
|
+
});
|
|
3257
|
+
return asyncFetch(opt);
|
|
3258
|
+
},
|
|
2943
3259
|
helper: {
|
|
2944
3260
|
tidyFields: tidyFields,
|
|
2945
3261
|
props: props
|
|
2946
3262
|
}
|
|
2947
3263
|
};
|
|
2948
|
-
['on', 'once', 'off'
|
|
3264
|
+
['on', 'once', 'off'].forEach(function (n) {
|
|
2949
3265
|
api[n] = function () {
|
|
2950
3266
|
var _h$bus;
|
|
2951
3267
|
|
|
@@ -2967,6 +3283,10 @@ function useCache(Render) {
|
|
|
2967
3283
|
}
|
|
2968
3284
|
|
|
2969
3285
|
if (!this.cache[ctx.id]) {
|
|
3286
|
+
if (ctx.parent) {
|
|
3287
|
+
this.clearCache(ctx.parent);
|
|
3288
|
+
}
|
|
3289
|
+
|
|
2970
3290
|
return;
|
|
2971
3291
|
}
|
|
2972
3292
|
|
|
@@ -2974,6 +3294,10 @@ function useCache(Render) {
|
|
|
2974
3294
|
this.$handle.refresh();
|
|
2975
3295
|
}
|
|
2976
3296
|
|
|
3297
|
+
if (this.cache[ctx.id].parent) {
|
|
3298
|
+
this.clearCache(this.cache[ctx.id].parent);
|
|
3299
|
+
}
|
|
3300
|
+
|
|
2977
3301
|
this.cache[ctx.id] = null;
|
|
2978
3302
|
},
|
|
2979
3303
|
clearCacheAll: function clearCacheAll() {
|
|
@@ -2988,53 +3312,26 @@ function useCache(Render) {
|
|
|
2988
3312
|
};
|
|
2989
3313
|
},
|
|
2990
3314
|
getCache: function getCache(ctx) {
|
|
2991
|
-
var cache = this.cache[ctx.id];
|
|
2992
|
-
|
|
2993
|
-
if (cache) {
|
|
2994
|
-
cache.use = true;
|
|
2995
|
-
return cache.vnode;
|
|
2996
|
-
}
|
|
2997
|
-
|
|
2998
|
-
return undefined;
|
|
2999
|
-
}
|
|
3000
|
-
});
|
|
3001
|
-
}
|
|
3002
|
-
|
|
3003
|
-
function toCase(str) {
|
|
3004
|
-
var to = str.replace(/(-[a-z])/g, function (v) {
|
|
3005
|
-
return v.replace('-', '').toLocaleUpperCase();
|
|
3006
|
-
});
|
|
3007
|
-
return lower(to);
|
|
3008
|
-
}
|
|
3009
|
-
function lower(str) {
|
|
3010
|
-
return str.replace(str[0], str[0].toLowerCase());
|
|
3011
|
-
}
|
|
3012
|
-
|
|
3013
|
-
function toString(val) {
|
|
3014
|
-
return val == null ? '' : _typeof(val) === 'object' ? JSON.stringify(val, null, 2) : String(val);
|
|
3015
|
-
}
|
|
3016
|
-
|
|
3017
|
-
var id$2 = 0;
|
|
3018
|
-
function uniqueId() {
|
|
3019
|
-
return 'F' + Math.random().toString(36).substr(3, 3) + Number("".concat(Date.now()).concat(++id$2)).toString(36);
|
|
3020
|
-
}
|
|
3315
|
+
var cache = this.cache[ctx.id];
|
|
3021
3316
|
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
(idx || '').split('.').forEach(function (v) {
|
|
3026
|
-
if (to) {
|
|
3027
|
-
if (!_data[to] || _typeof(_data[to]) != 'object') {
|
|
3028
|
-
_data[to] = {};
|
|
3317
|
+
if (cache) {
|
|
3318
|
+
cache.use = true;
|
|
3319
|
+
return cache.vnode;
|
|
3029
3320
|
}
|
|
3030
3321
|
|
|
3031
|
-
|
|
3322
|
+
return undefined;
|
|
3032
3323
|
}
|
|
3324
|
+
});
|
|
3325
|
+
}
|
|
3033
3326
|
|
|
3034
|
-
|
|
3327
|
+
function toCase(str) {
|
|
3328
|
+
var to = str.replace(/(-[a-z])/g, function (v) {
|
|
3329
|
+
return v.replace('-', '').toLocaleUpperCase();
|
|
3035
3330
|
});
|
|
3036
|
-
|
|
3037
|
-
|
|
3331
|
+
return lower(to);
|
|
3332
|
+
}
|
|
3333
|
+
function lower(str) {
|
|
3334
|
+
return str.replace(str[0], str[0].toLowerCase());
|
|
3038
3335
|
}
|
|
3039
3336
|
|
|
3040
3337
|
function useRender$1(Render) {
|
|
@@ -3215,7 +3512,7 @@ function useRender$1(Render) {
|
|
|
3215
3512
|
inject.children = children;
|
|
3216
3513
|
_vn = slot(inject);
|
|
3217
3514
|
} else {
|
|
3218
|
-
_vn = preview ? ctx.parser.preview(children, ctx) : ctx.parser.render(children, ctx);
|
|
3515
|
+
_vn = preview ? ctx.parser.preview(copy$1(children), ctx) : ctx.parser.render(copy$1(children), ctx);
|
|
3219
3516
|
}
|
|
3220
3517
|
|
|
3221
3518
|
_vn = _this4.renderSides(_vn, ctx);
|
|
@@ -3225,11 +3522,21 @@ function useRender$1(Render) {
|
|
|
3225
3522
|
}
|
|
3226
3523
|
|
|
3227
3524
|
if (ctx.none) {
|
|
3228
|
-
|
|
3525
|
+
if (Array.isArray(_vn)) {
|
|
3526
|
+
_vn = _vn.map(function (v) {
|
|
3527
|
+
if (!v || !v.__v_isVNode) {
|
|
3528
|
+
return v;
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3531
|
+
return _this4.none(v);
|
|
3532
|
+
});
|
|
3533
|
+
} else {
|
|
3534
|
+
_vn = _this4.none(_vn);
|
|
3535
|
+
}
|
|
3229
3536
|
}
|
|
3230
3537
|
|
|
3231
|
-
cacheFlag &&
|
|
3232
|
-
return _vn;
|
|
3538
|
+
cacheFlag && _this4.setCache(ctx, function () {
|
|
3539
|
+
return _this4.stable(_vn);
|
|
3233
3540
|
}, parent);
|
|
3234
3541
|
return _vn;
|
|
3235
3542
|
};
|
|
@@ -3257,38 +3564,33 @@ function useRender$1(Render) {
|
|
|
3257
3564
|
return;
|
|
3258
3565
|
}
|
|
3259
3566
|
},
|
|
3260
|
-
getModelField: function getModelField(ctx) {
|
|
3261
|
-
return ctx.rule.modelField || ctx.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[ctx.type]] || this.fc.modelFields[ctx.type] || this.fc.modelFields[ctx.originType] || 'modelValue';
|
|
3262
|
-
},
|
|
3263
|
-
display: function display(vn) {
|
|
3264
|
-
var _this5 = this;
|
|
3265
|
-
|
|
3266
|
-
if (Array.isArray(vn)) {
|
|
3267
|
-
var data = [];
|
|
3268
|
-
vn.forEach(function (v) {
|
|
3269
|
-
if (Array.isArray(v)) return _this5.display(v);
|
|
3270
|
-
if (_this5.none(v)) data.push(v);
|
|
3271
|
-
});
|
|
3272
|
-
return data;
|
|
3273
|
-
} else {
|
|
3274
|
-
return this.none(vn);
|
|
3275
|
-
}
|
|
3276
|
-
},
|
|
3277
3567
|
none: function none(vn) {
|
|
3278
3568
|
if (vn) {
|
|
3279
|
-
if (Array.isArray(vn.props
|
|
3280
|
-
vn.props.
|
|
3281
|
-
display: 'none'
|
|
3282
|
-
});
|
|
3569
|
+
if (Array.isArray(vn.props["class"])) {
|
|
3570
|
+
vn.props["class"].push('fc-none');
|
|
3283
3571
|
} else {
|
|
3284
|
-
vn.props
|
|
3285
|
-
display: 'none'
|
|
3286
|
-
}];
|
|
3572
|
+
vn.props["class"] = vn.props["class"] ? [vn.props["class"], 'fc-none'] : 'fc-none';
|
|
3287
3573
|
}
|
|
3288
3574
|
|
|
3289
3575
|
return vn;
|
|
3290
3576
|
}
|
|
3291
3577
|
},
|
|
3578
|
+
stable: function stable(vn) {
|
|
3579
|
+
var _this5 = this;
|
|
3580
|
+
|
|
3581
|
+
var list = Array.isArray(vn) ? vn : [vn];
|
|
3582
|
+
list.forEach(function (v) {
|
|
3583
|
+
if (v && v.__v_isVNode && v.children && _typeof(v.children) === 'object') {
|
|
3584
|
+
v.children.$stable = true;
|
|
3585
|
+
|
|
3586
|
+
_this5.stable(v.children);
|
|
3587
|
+
}
|
|
3588
|
+
});
|
|
3589
|
+
return vn;
|
|
3590
|
+
},
|
|
3591
|
+
getModelField: function getModelField(ctx) {
|
|
3592
|
+
return ctx.rule.modelField || ctx.parser.modelField || this.fc.modelFields[this.vNode.aliasMap[ctx.type]] || this.fc.modelFields[ctx.type] || this.fc.modelFields[ctx.originType] || 'modelValue';
|
|
3593
|
+
},
|
|
3292
3594
|
isFragment: function isFragment(ctx) {
|
|
3293
3595
|
return ctx.type === 'fragment' || ctx.type === 'template';
|
|
3294
3596
|
},
|
|
@@ -3310,6 +3612,7 @@ function useRender$1(Render) {
|
|
|
3310
3612
|
options: [],
|
|
3311
3613
|
children: [],
|
|
3312
3614
|
preview: false,
|
|
3615
|
+
id: ctx.id,
|
|
3313
3616
|
field: ctx.field,
|
|
3314
3617
|
rule: ctx.rule,
|
|
3315
3618
|
input: ctx.input
|
|
@@ -3324,14 +3627,14 @@ function useRender$1(Render) {
|
|
|
3324
3627
|
});
|
|
3325
3628
|
return inject;
|
|
3326
3629
|
},
|
|
3327
|
-
ctxProp: function ctxProp(ctx
|
|
3630
|
+
ctxProp: function ctxProp(ctx) {
|
|
3328
3631
|
var _this7 = this;
|
|
3329
3632
|
|
|
3330
3633
|
var ref = ctx.ref,
|
|
3331
3634
|
key = ctx.key,
|
|
3332
3635
|
rule = ctx.rule;
|
|
3333
|
-
this.$manager.mergeProp(ctx
|
|
3334
|
-
ctx.parser.mergeProp(ctx
|
|
3636
|
+
this.$manager.mergeProp(ctx);
|
|
3637
|
+
ctx.parser.mergeProp(ctx);
|
|
3335
3638
|
var props = [{
|
|
3336
3639
|
ref: ref,
|
|
3337
3640
|
key: rule.key || "".concat(key, "fc"),
|
|
@@ -3352,7 +3655,11 @@ function useRender$1(Render) {
|
|
|
3352
3655
|
}
|
|
3353
3656
|
}];
|
|
3354
3657
|
|
|
3355
|
-
if (
|
|
3658
|
+
if (ctx.input) {
|
|
3659
|
+
if (this.vm.props.disabled !== undefined) {
|
|
3660
|
+
ctx.prop.props.disabled = !!this.vm.props.disabled;
|
|
3661
|
+
}
|
|
3662
|
+
|
|
3356
3663
|
var field = this.getModelField(ctx);
|
|
3357
3664
|
var model = {
|
|
3358
3665
|
callback: function callback(value) {
|
|
@@ -3361,7 +3668,9 @@ function useRender$1(Render) {
|
|
|
3361
3668
|
value: this.$handle.getFormData(ctx)
|
|
3362
3669
|
};
|
|
3363
3670
|
props.push({
|
|
3364
|
-
on: _defineProperty({}, "update:".concat(field), model.callback),
|
|
3671
|
+
on: _objectSpread2(_defineProperty({}, "update:".concat(field), model.callback), ctx.prop.modelEmit ? _defineProperty({}, ctx.prop.modelEmit, function () {
|
|
3672
|
+
return _this7.onEmitInput(ctx);
|
|
3673
|
+
}) : {}),
|
|
3365
3674
|
props: _defineProperty({}, field, model.value)
|
|
3366
3675
|
});
|
|
3367
3676
|
ctx.prop.model = model;
|
|
@@ -3376,8 +3685,16 @@ function useRender$1(Render) {
|
|
|
3376
3685
|
this.$handle.effect(ctx, 'mounted');
|
|
3377
3686
|
},
|
|
3378
3687
|
onInput: function onInput(ctx, value) {
|
|
3688
|
+
if (ctx.prop.modelEmit) {
|
|
3689
|
+
this.$handle.onBaseInput(ctx, value);
|
|
3690
|
+
return;
|
|
3691
|
+
}
|
|
3692
|
+
|
|
3379
3693
|
this.$handle.onInput(ctx, value);
|
|
3380
3694
|
},
|
|
3695
|
+
onEmitInput: function onEmitInput(ctx) {
|
|
3696
|
+
this.$handle.setValue(ctx, ctx.parser.toValue(ctx.modelValue, ctx), ctx.modelValue);
|
|
3697
|
+
},
|
|
3381
3698
|
renderChildren: function renderChildren(children, ctx) {
|
|
3382
3699
|
var _this8 = this;
|
|
3383
3700
|
|
|
@@ -3514,23 +3831,27 @@ function useInject(Handler) {
|
|
|
3514
3831
|
var emit = rule.emit || [];
|
|
3515
3832
|
|
|
3516
3833
|
if (is.trueArray(emit)) {
|
|
3517
|
-
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
}
|
|
3834
|
+
emit.forEach(function (eventName) {
|
|
3835
|
+
if (!eventName) return;
|
|
3836
|
+
var eventInject;
|
|
3837
|
+
var emitKey = emitPrefix || field || name;
|
|
3838
|
+
|
|
3839
|
+
if (is.Object(eventName)) {
|
|
3840
|
+
eventInject = eventName.inject;
|
|
3841
|
+
eventName = eventName.name;
|
|
3842
|
+
emitKey = eventName.prefix || emitKey;
|
|
3843
|
+
}
|
|
3528
3844
|
|
|
3845
|
+
if (emitKey) {
|
|
3529
3846
|
var fieldKey = toLine("".concat(emitKey, "-").concat(eventName));
|
|
3530
3847
|
|
|
3531
3848
|
var fn = function fn() {
|
|
3532
3849
|
var _this2$vm, _this2$vm2, _this2$bus;
|
|
3533
3850
|
|
|
3851
|
+
if (_this2.vm.emitsOptions) {
|
|
3852
|
+
_this2.vm.emitsOptions[fieldKey] = null;
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3534
3855
|
for (var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3535
3856
|
arg[_key] = arguments[_key];
|
|
3536
3857
|
}
|
|
@@ -3551,8 +3872,8 @@ function useInject(Handler) {
|
|
|
3551
3872
|
|
|
3552
3873
|
event[eventName] = is.Undef(_inject) ? fn : _this2.inject(rule, fn, _inject);
|
|
3553
3874
|
}
|
|
3554
|
-
}
|
|
3555
|
-
}
|
|
3875
|
+
}
|
|
3876
|
+
});
|
|
3556
3877
|
}
|
|
3557
3878
|
|
|
3558
3879
|
ctx.computed.on = event;
|
|
@@ -3677,16 +3998,6 @@ function useRender(Handler) {
|
|
|
3677
3998
|
});
|
|
3678
3999
|
}
|
|
3679
4000
|
|
|
3680
|
-
function isNone(ctx) {
|
|
3681
|
-
var none = !(is.Undef(ctx.prop.display) || !!ctx.prop.display);
|
|
3682
|
-
|
|
3683
|
-
if (ctx.parent) {
|
|
3684
|
-
return ctx.parent.none || none;
|
|
3685
|
-
} else {
|
|
3686
|
-
return none;
|
|
3687
|
-
}
|
|
3688
|
-
}
|
|
3689
|
-
|
|
3690
4001
|
function bind(ctx) {
|
|
3691
4002
|
Object.defineProperties(ctx.origin, {
|
|
3692
4003
|
__fc__: enumerable(markRaw(ctx), true)
|
|
@@ -3709,7 +4020,9 @@ function RuleContext(handle, rule, defaultValue) {
|
|
|
3709
4020
|
linkOn: [],
|
|
3710
4021
|
root: [],
|
|
3711
4022
|
ctrlRule: [],
|
|
4023
|
+
children: [],
|
|
3712
4024
|
parent: null,
|
|
4025
|
+
group: rule.subRule ? this : null,
|
|
3713
4026
|
cacheConfig: null,
|
|
3714
4027
|
prop: _objectSpread2({}, rule),
|
|
3715
4028
|
computed: {},
|
|
@@ -3727,6 +4040,17 @@ function RuleContext(handle, rule, defaultValue) {
|
|
|
3727
4040
|
this.update(handle, true);
|
|
3728
4041
|
}
|
|
3729
4042
|
extend(RuleContext.prototype, {
|
|
4043
|
+
getParentGroup: function getParentGroup() {
|
|
4044
|
+
var ctx = this.parent;
|
|
4045
|
+
|
|
4046
|
+
while (ctx) {
|
|
4047
|
+
if (ctx.group) {
|
|
4048
|
+
return ctx;
|
|
4049
|
+
}
|
|
4050
|
+
|
|
4051
|
+
ctx = ctx.parent;
|
|
4052
|
+
}
|
|
4053
|
+
},
|
|
3730
4054
|
loadChildrenPending: function loadChildrenPending() {
|
|
3731
4055
|
var _this = this;
|
|
3732
4056
|
|
|
@@ -3862,7 +4186,21 @@ extend(RuleContext.prototype, {
|
|
|
3862
4186
|
})), [this.computed]));
|
|
3863
4187
|
},
|
|
3864
4188
|
initNone: function initNone() {
|
|
3865
|
-
this.none =
|
|
4189
|
+
this.none = !(is.Undef(this.prop.display) || !!this.prop.display);
|
|
4190
|
+
},
|
|
4191
|
+
injectValidate: function injectValidate() {
|
|
4192
|
+
var _this4 = this;
|
|
4193
|
+
|
|
4194
|
+
return toArray(this.prop.validate).map(function (item) {
|
|
4195
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
4196
|
+
inject: {
|
|
4197
|
+
id: _this4.id,
|
|
4198
|
+
field: _this4.field,
|
|
4199
|
+
rule: _this4.rule,
|
|
4200
|
+
api: _this4.$handle.api
|
|
4201
|
+
}
|
|
4202
|
+
});
|
|
4203
|
+
});
|
|
3866
4204
|
},
|
|
3867
4205
|
check: function check(handle) {
|
|
3868
4206
|
return this.vm === handle.vm;
|
|
@@ -3892,6 +4230,11 @@ extend(RuleContext.prototype, {
|
|
|
3892
4230
|
this.unwatch();
|
|
3893
4231
|
this.unlink();
|
|
3894
4232
|
this.rmCtrl();
|
|
4233
|
+
|
|
4234
|
+
if (this.parent) {
|
|
4235
|
+
this.parent.children.splice(this.parent.children.indexOf(this) >>> 0, 1);
|
|
4236
|
+
}
|
|
4237
|
+
|
|
3895
4238
|
extend(this, {
|
|
3896
4239
|
deleted: true,
|
|
3897
4240
|
prop: _objectSpread2({}, this.rule),
|
|
@@ -3903,6 +4246,7 @@ extend(RuleContext.prototype, {
|
|
|
3903
4246
|
vm: undef,
|
|
3904
4247
|
vNode: undef,
|
|
3905
4248
|
parent: null,
|
|
4249
|
+
children: [],
|
|
3906
4250
|
cacheConfig: null,
|
|
3907
4251
|
none: false
|
|
3908
4252
|
});
|
|
@@ -3914,15 +4258,15 @@ extend(RuleContext.prototype, {
|
|
|
3914
4258
|
this.ctrlRule = [];
|
|
3915
4259
|
},
|
|
3916
4260
|
rm: function rm() {
|
|
3917
|
-
var
|
|
4261
|
+
var _this5 = this;
|
|
3918
4262
|
|
|
3919
4263
|
var _rm = function _rm() {
|
|
3920
|
-
var index =
|
|
4264
|
+
var index = _this5.root.indexOf(_this5.origin);
|
|
3921
4265
|
|
|
3922
4266
|
if (index > -1) {
|
|
3923
|
-
|
|
4267
|
+
_this5.root.splice(index, 1);
|
|
3924
4268
|
|
|
3925
|
-
|
|
4269
|
+
_this5.$handle && _this5.$handle.refresh();
|
|
3926
4270
|
}
|
|
3927
4271
|
};
|
|
3928
4272
|
|
|
@@ -3933,17 +4277,17 @@ extend(RuleContext.prototype, {
|
|
|
3933
4277
|
}
|
|
3934
4278
|
|
|
3935
4279
|
this.$handle.noWatch(function () {
|
|
3936
|
-
|
|
3937
|
-
|
|
4280
|
+
_this5.$handle.deferSyncValue(function () {
|
|
4281
|
+
_this5.rmCtrl();
|
|
3938
4282
|
|
|
3939
4283
|
_rm();
|
|
3940
4284
|
|
|
3941
|
-
|
|
4285
|
+
_this5.$handle.rmCtx(_this5);
|
|
3942
4286
|
|
|
3943
|
-
extend(
|
|
4287
|
+
extend(_this5, {
|
|
3944
4288
|
root: []
|
|
3945
4289
|
});
|
|
3946
|
-
},
|
|
4290
|
+
}, _this5.input);
|
|
3947
4291
|
});
|
|
3948
4292
|
},
|
|
3949
4293
|
update: function update(handle, init) {
|
|
@@ -4163,7 +4507,7 @@ function useLoader(Handler) {
|
|
|
4163
4507
|
}
|
|
4164
4508
|
};
|
|
4165
4509
|
|
|
4166
|
-
rules.map(function (_rule, index) {
|
|
4510
|
+
var ctxs = rules.map(function (_rule, index) {
|
|
4167
4511
|
if (parent && !is.Object(_rule)) return;
|
|
4168
4512
|
if (!_this6.pageEnd && !parent && index >= _this6.first) return;
|
|
4169
4513
|
|
|
@@ -4231,6 +4575,10 @@ function useLoader(Handler) {
|
|
|
4231
4575
|
}
|
|
4232
4576
|
|
|
4233
4577
|
_this6.appendValue(ctx.rule);
|
|
4578
|
+
|
|
4579
|
+
if (ctx.parent && ctx.parent !== parent) {
|
|
4580
|
+
_this6.rmSubRuleData(ctx);
|
|
4581
|
+
}
|
|
4234
4582
|
}
|
|
4235
4583
|
|
|
4236
4584
|
_this6.parseEmit(ctx);
|
|
@@ -4278,7 +4626,13 @@ function useLoader(Handler) {
|
|
|
4278
4626
|
|
|
4279
4627
|
if (_this6.refreshControl(ctx)) _this6.cycleLoad = true;
|
|
4280
4628
|
return ctx;
|
|
4629
|
+
}).filter(function (v) {
|
|
4630
|
+
return !!v;
|
|
4281
4631
|
});
|
|
4632
|
+
|
|
4633
|
+
if (parent) {
|
|
4634
|
+
parent.children = ctxs;
|
|
4635
|
+
}
|
|
4282
4636
|
},
|
|
4283
4637
|
refreshControl: function refreshControl(ctx) {
|
|
4284
4638
|
return ctx.input && ctx.rule.control && this.useCtrl(ctx);
|
|
@@ -4473,6 +4827,11 @@ function useInput(Handler) {
|
|
|
4473
4827
|
this.valueChange(ctx, value);
|
|
4474
4828
|
this.vm.emit('change', ctx.field, value, ctx.origin, this.api, setFlag || false);
|
|
4475
4829
|
this.effect(ctx, 'value');
|
|
4830
|
+
this.emitEvent('change', ctx.field, value, {
|
|
4831
|
+
rule: ctx.origin,
|
|
4832
|
+
api: this.api,
|
|
4833
|
+
setFlag: setFlag || false
|
|
4834
|
+
});
|
|
4476
4835
|
},
|
|
4477
4836
|
onInput: function onInput(ctx, value) {
|
|
4478
4837
|
var val;
|
|
@@ -4481,9 +4840,33 @@ function useInput(Handler) {
|
|
|
4481
4840
|
this.setValue(ctx, val, value);
|
|
4482
4841
|
}
|
|
4483
4842
|
},
|
|
4843
|
+
onBaseInput: function onBaseInput(ctx, value) {
|
|
4844
|
+
this.setFormData(ctx, value);
|
|
4845
|
+
ctx.modelValue = value;
|
|
4846
|
+
this.nextRefresh();
|
|
4847
|
+
this.$render.clearCache(ctx);
|
|
4848
|
+
},
|
|
4484
4849
|
setFormData: function setFormData(ctx, value) {
|
|
4850
|
+
ctx.modelValue = value;
|
|
4851
|
+
var group = ctx.getParentGroup();
|
|
4852
|
+
|
|
4853
|
+
if (group) {
|
|
4854
|
+
if (!this.subRuleData[group.id]) {
|
|
4855
|
+
this.subRuleData[group.id] = {};
|
|
4856
|
+
}
|
|
4857
|
+
|
|
4858
|
+
this.subRuleData[group.id][ctx.field] = ctx.rule.value;
|
|
4859
|
+
}
|
|
4860
|
+
|
|
4485
4861
|
$set(this.formData, ctx.id, value);
|
|
4486
4862
|
},
|
|
4863
|
+
rmSubRuleData: function rmSubRuleData(ctx) {
|
|
4864
|
+
var group = ctx.getParentGroup();
|
|
4865
|
+
|
|
4866
|
+
if (group && this.subRuleData[group.id]) {
|
|
4867
|
+
delete this.subRuleData[group.id][ctx.field];
|
|
4868
|
+
}
|
|
4869
|
+
},
|
|
4487
4870
|
getFormData: function getFormData(ctx) {
|
|
4488
4871
|
return this.formData[ctx.id];
|
|
4489
4872
|
},
|
|
@@ -4540,13 +4923,14 @@ function useInput(Handler) {
|
|
|
4540
4923
|
isQuote: function isQuote(ctx, value) {
|
|
4541
4924
|
return (is.Object(value) || Array.isArray(value)) && value === ctx.rule.value;
|
|
4542
4925
|
},
|
|
4543
|
-
refreshUpdate: function refreshUpdate(ctx, val, origin) {
|
|
4926
|
+
refreshUpdate: function refreshUpdate(ctx, val, origin, field) {
|
|
4544
4927
|
var _this2 = this;
|
|
4545
4928
|
|
|
4546
4929
|
if (is.Function(ctx.rule.update)) {
|
|
4547
4930
|
var state = invoke(function () {
|
|
4548
4931
|
return ctx.rule.update(val, ctx.origin, _this2.api, {
|
|
4549
|
-
origin: origin || 'change'
|
|
4932
|
+
origin: origin || 'change',
|
|
4933
|
+
linkField: field
|
|
4550
4934
|
});
|
|
4551
4935
|
});
|
|
4552
4936
|
if (state === undefined) return;
|
|
@@ -4557,7 +4941,7 @@ function useInput(Handler) {
|
|
|
4557
4941
|
this.refreshRule(ctx, val);
|
|
4558
4942
|
this.bus.$emit('change-' + ctx.field, val);
|
|
4559
4943
|
},
|
|
4560
|
-
refreshRule: function refreshRule(ctx, val, origin) {
|
|
4944
|
+
refreshRule: function refreshRule(ctx, val, origin, field) {
|
|
4561
4945
|
if (this.refreshControl(ctx)) {
|
|
4562
4946
|
this.$render.clearCacheAll();
|
|
4563
4947
|
this.loadRule();
|
|
@@ -4565,7 +4949,7 @@ function useInput(Handler) {
|
|
|
4565
4949
|
this.refresh();
|
|
4566
4950
|
}
|
|
4567
4951
|
|
|
4568
|
-
this.refreshUpdate(ctx, val, origin);
|
|
4952
|
+
this.refreshUpdate(ctx, val, origin, field);
|
|
4569
4953
|
},
|
|
4570
4954
|
appendLink: function appendLink(ctx) {
|
|
4571
4955
|
var _this3 = this;
|
|
@@ -4573,7 +4957,7 @@ function useInput(Handler) {
|
|
|
4573
4957
|
var link = ctx.rule.link;
|
|
4574
4958
|
is.trueArray(link) && link.forEach(function (field) {
|
|
4575
4959
|
var fn = function fn() {
|
|
4576
|
-
return _this3.refreshRule(ctx, ctx.rule.value, 'link');
|
|
4960
|
+
return _this3.refreshRule(ctx, ctx.rule.value, 'link', field);
|
|
4577
4961
|
};
|
|
4578
4962
|
|
|
4579
4963
|
_this3.bus.$on('change-' + field, fn);
|
|
@@ -4611,40 +4995,6 @@ var BaseParser = {
|
|
|
4611
4995
|
mergeProp: function mergeProp(ctx) {}
|
|
4612
4996
|
};
|
|
4613
4997
|
|
|
4614
|
-
var _ = {
|
|
4615
|
-
sum: function sum(arr) {
|
|
4616
|
-
if (Array.isArray(arr)) {
|
|
4617
|
-
var val = 0;
|
|
4618
|
-
arr.map(function (v) {
|
|
4619
|
-
return val += v || 0;
|
|
4620
|
-
});
|
|
4621
|
-
return val;
|
|
4622
|
-
}
|
|
4623
|
-
},
|
|
4624
|
-
column: function column(arr, field) {
|
|
4625
|
-
if (Array.isArray(arr)) {
|
|
4626
|
-
return arr.map(function (v) {
|
|
4627
|
-
return v[field];
|
|
4628
|
-
});
|
|
4629
|
-
}
|
|
4630
|
-
|
|
4631
|
-
return [];
|
|
4632
|
-
},
|
|
4633
|
-
get: function get(obj, field, def) {
|
|
4634
|
-
var lst = field.split('.');
|
|
4635
|
-
var val = obj;
|
|
4636
|
-
|
|
4637
|
-
for (var i = 0; i < lst.length; i++) {
|
|
4638
|
-
if (hasProperty(val, lst[i])) {
|
|
4639
|
-
val = val[lst[i]];
|
|
4640
|
-
} else {
|
|
4641
|
-
return def === undefined ? 0 : def;
|
|
4642
|
-
}
|
|
4643
|
-
}
|
|
4644
|
-
|
|
4645
|
-
return val;
|
|
4646
|
-
}
|
|
4647
|
-
};
|
|
4648
4998
|
var noneKey = ['field', 'value', 'vm', 'template', 'name', 'config', 'control', 'inject', 'sync', 'payload', 'optionsTo', 'update', 'slotUpdate', 'computed', 'component', 'cache'];
|
|
4649
4999
|
function useContext(Handler) {
|
|
4650
5000
|
extend(Handler.prototype, {
|
|
@@ -4756,7 +5106,11 @@ function useContext(Handler) {
|
|
|
4756
5106
|
if (key === 'props' && ctx.input) {
|
|
4757
5107
|
_this.setFormData(ctx, ctx.parser.toFormValue(ctx.rule.value, ctx));
|
|
4758
5108
|
}
|
|
4759
|
-
} else if (key === 'emit')
|
|
5109
|
+
} else if (key === 'emit') {
|
|
5110
|
+
_this.parseEmit(ctx);
|
|
5111
|
+
} else if (key === 'hidden' && Boolean(n) !== Boolean(o)) {
|
|
5112
|
+
_this.$render.clearCacheAll();
|
|
5113
|
+
} else if (['prefix', 'suffix'].indexOf(key) > -1) n && _this.loadFn(n, ctx.rule);else if (key === 'type') {
|
|
4760
5114
|
ctx.updateType();
|
|
4761
5115
|
|
|
4762
5116
|
_this.bindParser(ctx);
|
|
@@ -4794,32 +5148,55 @@ function useContext(Handler) {
|
|
|
4794
5148
|
_this.setValue(ctx, val.value, formValue, true);
|
|
4795
5149
|
}
|
|
4796
5150
|
}));
|
|
4797
|
-
|
|
4798
|
-
|
|
5151
|
+
}
|
|
5152
|
+
|
|
5153
|
+
this.bus.$once('load-end', function () {
|
|
5154
|
+
var computed = ctx.rule.computed;
|
|
5155
|
+
|
|
5156
|
+
if (!computed) {
|
|
5157
|
+
return;
|
|
5158
|
+
}
|
|
5159
|
+
|
|
5160
|
+
if (_typeof(computed) !== 'object') {
|
|
5161
|
+
computed = {
|
|
5162
|
+
value: computed
|
|
5163
|
+
};
|
|
5164
|
+
}
|
|
5165
|
+
|
|
5166
|
+
Object.keys(computed).forEach(function (k) {
|
|
4799
5167
|
ctx.watch.push(watch(function () {
|
|
4800
|
-
var
|
|
4801
|
-
if (!
|
|
5168
|
+
var item = computed[k];
|
|
5169
|
+
if (!item) return undefined;
|
|
4802
5170
|
var fn;
|
|
4803
5171
|
|
|
4804
|
-
if (is.Function(
|
|
5172
|
+
if (is.Function(item)) {
|
|
4805
5173
|
fn = function fn() {
|
|
4806
|
-
return
|
|
5174
|
+
return item(_this.api.form, _this.api);
|
|
4807
5175
|
};
|
|
4808
5176
|
} else {
|
|
5177
|
+
var group = ctx.getParentGroup();
|
|
5178
|
+
|
|
4809
5179
|
fn = function fn() {
|
|
4810
|
-
return new Function('
|
|
5180
|
+
return new Function('formulas', 'top', 'group', '$rule', '$api', "with(top){with(this){with(group){with(formulas){ return ".concat(item, " }}}}")).call(_this.api.form, _this.fc.formulas, _this.api.top.form, group ? _this.subRuleData[group.id] || {} : {}, ctx.rule, _this.api);
|
|
4811
5181
|
};
|
|
4812
5182
|
}
|
|
4813
5183
|
|
|
4814
5184
|
return invoke(fn, undefined);
|
|
4815
5185
|
}, function (n) {
|
|
4816
|
-
|
|
5186
|
+
setTimeout(function () {
|
|
5187
|
+
if (k === 'value') {
|
|
5188
|
+
_this.onInput(ctx, n);
|
|
5189
|
+
} else if (k[0] === '$') {
|
|
5190
|
+
_this.api.setEffect(ctx.id, k, n);
|
|
5191
|
+
} else {
|
|
5192
|
+
deepSet(ctx.rule, k, n);
|
|
5193
|
+
}
|
|
5194
|
+
});
|
|
4817
5195
|
}, {
|
|
4818
|
-
immediate:
|
|
5196
|
+
immediate: true
|
|
4819
5197
|
}));
|
|
4820
5198
|
});
|
|
4821
|
-
}
|
|
4822
|
-
|
|
5199
|
+
});
|
|
4823
5200
|
this.watchEffect(ctx);
|
|
4824
5201
|
},
|
|
4825
5202
|
updateChildren: function updateChildren(ctx, n, o) {
|
|
@@ -4827,7 +5204,7 @@ function useContext(Handler) {
|
|
|
4827
5204
|
|
|
4828
5205
|
this.deferSyncValue(function () {
|
|
4829
5206
|
o && o.forEach(function (child) {
|
|
4830
|
-
if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__ && child.__fc__.parent === ctx && child.__fc__.root
|
|
5207
|
+
if ((n || []).indexOf(child) === -1 && child && !is.String(child) && child.__fc__ && child.__fc__.parent === ctx && child.__fc__.root !== n) {
|
|
4831
5208
|
_this2.rmCtx(child.__fc__);
|
|
4832
5209
|
}
|
|
4833
5210
|
});
|
|
@@ -4858,6 +5235,16 @@ function useContext(Handler) {
|
|
|
4858
5235
|
$del(this.formData, id);
|
|
4859
5236
|
$del(this.subForm, id);
|
|
4860
5237
|
$del(this.vm.setupState.ctxInject, id);
|
|
5238
|
+
var group = ctx.getParentGroup();
|
|
5239
|
+
|
|
5240
|
+
if (group && this.subRuleData[group.id]) {
|
|
5241
|
+
$del(this.subRuleData[group.id], field);
|
|
5242
|
+
}
|
|
5243
|
+
|
|
5244
|
+
if (ctx.group) {
|
|
5245
|
+
$del(this.subRuleData, id);
|
|
5246
|
+
}
|
|
5247
|
+
|
|
4861
5248
|
input && this.rmIdCtx(ctx, field, 'field');
|
|
4862
5249
|
name && this.rmIdCtx(ctx, name, 'name');
|
|
4863
5250
|
|
|
@@ -4916,13 +5303,26 @@ function useLifecycle(Handler) {
|
|
|
4916
5303
|
}
|
|
4917
5304
|
},
|
|
4918
5305
|
lifecycle: function lifecycle(name) {
|
|
4919
|
-
var _this2 = this;
|
|
4920
|
-
|
|
4921
|
-
var fn = this.options[name];
|
|
4922
|
-
is.Function(fn) && invoke(function () {
|
|
4923
|
-
return fn(_this2.api);
|
|
4924
|
-
});
|
|
4925
5306
|
this.vm.emit(name, this.api);
|
|
5307
|
+
this.emitEvent(name, this.api);
|
|
5308
|
+
},
|
|
5309
|
+
emitEvent: function emitEvent(name) {
|
|
5310
|
+
var _this$bus;
|
|
5311
|
+
|
|
5312
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5313
|
+
args[_key - 1] = arguments[_key];
|
|
5314
|
+
}
|
|
5315
|
+
|
|
5316
|
+
var _fn = this.options[name] || this.options[toCase('on-' + name)];
|
|
5317
|
+
|
|
5318
|
+
if (_fn) {
|
|
5319
|
+
var fn = parseFn(_fn);
|
|
5320
|
+
is.Function(fn) && invoke(function () {
|
|
5321
|
+
return fn.apply(void 0, args);
|
|
5322
|
+
});
|
|
5323
|
+
}
|
|
5324
|
+
|
|
5325
|
+
(_this$bus = this.bus).$emit.apply(_this$bus, [name].concat(args));
|
|
4926
5326
|
}
|
|
4927
5327
|
});
|
|
4928
5328
|
}
|
|
@@ -5113,6 +5513,7 @@ function Handler(fc) {
|
|
|
5113
5513
|
deferSyncFn: null,
|
|
5114
5514
|
isMounted: false,
|
|
5115
5515
|
formData: reactive({}),
|
|
5516
|
+
subRuleData: reactive({}),
|
|
5116
5517
|
subForm: {},
|
|
5117
5518
|
form: reactive({}),
|
|
5118
5519
|
appendData: {},
|
|
@@ -5148,6 +5549,8 @@ extend(Handler.prototype, {
|
|
|
5148
5549
|
this.loadRule();
|
|
5149
5550
|
|
|
5150
5551
|
this.$manager.__init();
|
|
5552
|
+
|
|
5553
|
+
this.lifecycle('created');
|
|
5151
5554
|
},
|
|
5152
5555
|
isBreakWatch: function isBreakWatch() {
|
|
5153
5556
|
return this.loading || this.noWatchFn || this.reloading;
|
|
@@ -5162,77 +5565,6 @@ useContext(Handler);
|
|
|
5162
5565
|
useLifecycle(Handler);
|
|
5163
5566
|
useEffect(Handler);
|
|
5164
5567
|
|
|
5165
|
-
// https://github.com/ElemeFE/element/blob/dev/packages/upload/src/ajax.js
|
|
5166
|
-
function getError(action, option, xhr) {
|
|
5167
|
-
var msg = "fail to ".concat(action, " ").concat(xhr.status, "'");
|
|
5168
|
-
var err = new Error(msg);
|
|
5169
|
-
err.status = xhr.status;
|
|
5170
|
-
err.url = action;
|
|
5171
|
-
return err;
|
|
5172
|
-
}
|
|
5173
|
-
|
|
5174
|
-
function getBody(xhr) {
|
|
5175
|
-
var text = xhr.responseText || xhr.response;
|
|
5176
|
-
|
|
5177
|
-
if (!text) {
|
|
5178
|
-
return text;
|
|
5179
|
-
}
|
|
5180
|
-
|
|
5181
|
-
try {
|
|
5182
|
-
return JSON.parse(text);
|
|
5183
|
-
} catch (e) {
|
|
5184
|
-
return text;
|
|
5185
|
-
}
|
|
5186
|
-
}
|
|
5187
|
-
|
|
5188
|
-
function fetch$1(option) {
|
|
5189
|
-
if (typeof XMLHttpRequest === 'undefined') {
|
|
5190
|
-
return;
|
|
5191
|
-
}
|
|
5192
|
-
|
|
5193
|
-
var xhr = new XMLHttpRequest();
|
|
5194
|
-
var action = option.action;
|
|
5195
|
-
|
|
5196
|
-
xhr.onerror = function error(e) {
|
|
5197
|
-
option.onError(e);
|
|
5198
|
-
};
|
|
5199
|
-
|
|
5200
|
-
xhr.onload = function onload() {
|
|
5201
|
-
if (xhr.status < 200 || xhr.status >= 300) {
|
|
5202
|
-
return option.onError(getError(action, option, xhr), getBody(xhr));
|
|
5203
|
-
}
|
|
5204
|
-
|
|
5205
|
-
option.onSuccess(getBody(xhr));
|
|
5206
|
-
};
|
|
5207
|
-
|
|
5208
|
-
xhr.open(option.method || 'get', action, true);
|
|
5209
|
-
var formData;
|
|
5210
|
-
|
|
5211
|
-
if (option.data) {
|
|
5212
|
-
if ((option.dataType || '').toLowerCase() !== 'json') {
|
|
5213
|
-
formData = new FormData();
|
|
5214
|
-
Object.keys(option.data).map(function (key) {
|
|
5215
|
-
formData.append(key, option.data[key]);
|
|
5216
|
-
});
|
|
5217
|
-
} else {
|
|
5218
|
-
formData = JSON.stringify(option.data);
|
|
5219
|
-
xhr.setRequestHeader('content-type', 'application/json');
|
|
5220
|
-
}
|
|
5221
|
-
}
|
|
5222
|
-
|
|
5223
|
-
if (option.withCredentials && 'withCredentials' in xhr) {
|
|
5224
|
-
xhr.withCredentials = true;
|
|
5225
|
-
}
|
|
5226
|
-
|
|
5227
|
-
var headers = option.headers || {};
|
|
5228
|
-
Object.keys(headers).forEach(function (item) {
|
|
5229
|
-
if (headers[item] !== null) {
|
|
5230
|
-
xhr.setRequestHeader(item, headers[item]);
|
|
5231
|
-
}
|
|
5232
|
-
});
|
|
5233
|
-
xhr.send(formData);
|
|
5234
|
-
}
|
|
5235
|
-
|
|
5236
5568
|
var NAME = 'fcFragment';
|
|
5237
5569
|
var fragment = defineComponent({
|
|
5238
5570
|
name: NAME,
|
|
@@ -5515,22 +5847,23 @@ var fetch = function fetch(fc) {
|
|
|
5515
5847
|
function run(inject, rule, api) {
|
|
5516
5848
|
var option = inject.value;
|
|
5517
5849
|
|
|
5850
|
+
if (is.Function(option)) {
|
|
5851
|
+
option = option(rule, api);
|
|
5852
|
+
}
|
|
5853
|
+
|
|
5854
|
+
option = parseOpt(option);
|
|
5855
|
+
|
|
5518
5856
|
var set = function set(val) {
|
|
5519
5857
|
if (val === undefined) {
|
|
5520
5858
|
inject.clearProp();
|
|
5521
|
-
api.sync(rule);
|
|
5522
5859
|
} else {
|
|
5523
5860
|
deepSet(inject.getProp(), option.to || 'options', val);
|
|
5524
5861
|
}
|
|
5525
|
-
};
|
|
5526
|
-
|
|
5527
|
-
if (is.Function(option)) {
|
|
5528
|
-
option = option(rule, api);
|
|
5529
|
-
}
|
|
5530
5862
|
|
|
5531
|
-
|
|
5863
|
+
api.sync(rule);
|
|
5864
|
+
};
|
|
5532
5865
|
|
|
5533
|
-
if (!option || !option.action) {
|
|
5866
|
+
if (!option || !option.action && !option.key) {
|
|
5534
5867
|
set(undefined);
|
|
5535
5868
|
return;
|
|
5536
5869
|
}
|
|
@@ -5539,6 +5872,22 @@ var fetch = function fetch(fc) {
|
|
|
5539
5872
|
option.to = 'options';
|
|
5540
5873
|
}
|
|
5541
5874
|
|
|
5875
|
+
if (option.key) {
|
|
5876
|
+
var item = fc.$handle.options.globalData[option.key];
|
|
5877
|
+
|
|
5878
|
+
if (!item) {
|
|
5879
|
+
set(undefined);
|
|
5880
|
+
return;
|
|
5881
|
+
}
|
|
5882
|
+
|
|
5883
|
+
if (item.type === 'static') {
|
|
5884
|
+
set(item.data);
|
|
5885
|
+
return;
|
|
5886
|
+
} else {
|
|
5887
|
+
option = _objectSpread2(_objectSpread2({}, option), item);
|
|
5888
|
+
}
|
|
5889
|
+
}
|
|
5890
|
+
|
|
5542
5891
|
var _onError = option.onError;
|
|
5543
5892
|
|
|
5544
5893
|
var check = function check() {
|
|
@@ -5559,11 +5908,13 @@ var fetch = function fetch(fc) {
|
|
|
5559
5908
|
return flag ? v : v.data;
|
|
5560
5909
|
};
|
|
5561
5910
|
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5911
|
+
var parse = parseFn(option.parse);
|
|
5912
|
+
|
|
5913
|
+
if (is.Function(parse)) {
|
|
5914
|
+
fn = parse;
|
|
5915
|
+
} else if (parse && is.String(parse)) {
|
|
5565
5916
|
fn = function fn(v) {
|
|
5566
|
-
|
|
5917
|
+
parse.split('.').forEach(function (k) {
|
|
5567
5918
|
if (v) {
|
|
5568
5919
|
v = v[k];
|
|
5569
5920
|
}
|
|
@@ -5695,6 +6046,7 @@ function FormCreateFactory(config) {
|
|
|
5695
6046
|
};
|
|
5696
6047
|
var loadData = {};
|
|
5697
6048
|
var CreateNode = CreateNodeFactory();
|
|
6049
|
+
var formulas = {};
|
|
5698
6050
|
exportAttrs(config.attrs || {});
|
|
5699
6051
|
|
|
5700
6052
|
function getApi(name) {
|
|
@@ -5731,11 +6083,11 @@ function FormCreateFactory(config) {
|
|
|
5731
6083
|
|
|
5732
6084
|
function parser() {
|
|
5733
6085
|
var data = nameProp.apply(void 0, arguments);
|
|
5734
|
-
if (!data.id || !data.prop) return;
|
|
6086
|
+
if (!data.id || !data.prop) return BaseParser;
|
|
5735
6087
|
var name = toCase(data.id);
|
|
5736
6088
|
var parser = data.prop;
|
|
5737
6089
|
var base = parser.merge === true ? parsers[name] : undefined;
|
|
5738
|
-
parsers[name] =
|
|
6090
|
+
parsers[name] = setPrototypeOf(parser, base || BaseParser);
|
|
5739
6091
|
maker[name] = creatorFactory(name);
|
|
5740
6092
|
parser.maker && extend(maker, parser.maker);
|
|
5741
6093
|
}
|
|
@@ -5755,8 +6107,13 @@ function FormCreateFactory(config) {
|
|
|
5755
6107
|
}
|
|
5756
6108
|
|
|
5757
6109
|
if (!name || !component) return;
|
|
6110
|
+
var nameAlias = toCase(name);
|
|
5758
6111
|
components[name] = component;
|
|
5759
|
-
components[
|
|
6112
|
+
components[nameAlias] = component;
|
|
6113
|
+
delete CreateNode.aliasMap[name];
|
|
6114
|
+
delete CreateNode.aliasMap[nameAlias];
|
|
6115
|
+
delete parsers[name];
|
|
6116
|
+
delete parsers[nameAlias];
|
|
5760
6117
|
if (component.formCreateParser) parser(name, component.formCreateParser);
|
|
5761
6118
|
}
|
|
5762
6119
|
|
|
@@ -5816,6 +6173,7 @@ function FormCreateFactory(config) {
|
|
|
5816
6173
|
providers: providers,
|
|
5817
6174
|
useApps: useApps,
|
|
5818
6175
|
maker: maker,
|
|
6176
|
+
formulas: formulas,
|
|
5819
6177
|
loadData: loadData
|
|
5820
6178
|
};
|
|
5821
6179
|
} else {
|
|
@@ -5829,6 +6187,10 @@ function FormCreateFactory(config) {
|
|
|
5829
6187
|
modelFields[name] = field;
|
|
5830
6188
|
}
|
|
5831
6189
|
|
|
6190
|
+
function setFormula(name, fn) {
|
|
6191
|
+
formulas[name] = fn;
|
|
6192
|
+
}
|
|
6193
|
+
|
|
5832
6194
|
function _emitData(id) {
|
|
5833
6195
|
Object.keys(instance).forEach(function (v) {
|
|
5834
6196
|
var apis = Array.isArray(instance[v]) ? instance[v] : [instance[v]];
|
|
@@ -5861,6 +6223,7 @@ function FormCreateFactory(config) {
|
|
|
5861
6223
|
parsers: parsers,
|
|
5862
6224
|
providers: providers,
|
|
5863
6225
|
modelFields: modelFields,
|
|
6226
|
+
formulas: formulas,
|
|
5864
6227
|
rules: vm.props.rule,
|
|
5865
6228
|
name: vm.props.name || uniqueId(),
|
|
5866
6229
|
inFor: vm.props.inFor,
|
|
@@ -5872,7 +6235,7 @@ function FormCreateFactory(config) {
|
|
|
5872
6235
|
CreateNode: CreateNode,
|
|
5873
6236
|
bus: new Mitt(),
|
|
5874
6237
|
unwatch: null,
|
|
5875
|
-
options: ref(
|
|
6238
|
+
options: ref({}),
|
|
5876
6239
|
extendApi: config.extendApi || function (api) {
|
|
5877
6240
|
return api;
|
|
5878
6241
|
}
|
|
@@ -5906,9 +6269,9 @@ function FormCreateFactory(config) {
|
|
|
5906
6269
|
|
|
5907
6270
|
if (this.isSub()) {
|
|
5908
6271
|
this.unwatch = watch(function () {
|
|
5909
|
-
return _this2.vm.parent.
|
|
6272
|
+
return _this2.vm.setupState.parent.setupState.fc.options.value;
|
|
5910
6273
|
}, function () {
|
|
5911
|
-
_this2.initOptions(
|
|
6274
|
+
_this2.initOptions();
|
|
5912
6275
|
|
|
5913
6276
|
_this2.$handle.api.refresh();
|
|
5914
6277
|
}, {
|
|
@@ -5916,28 +6279,33 @@ function FormCreateFactory(config) {
|
|
|
5916
6279
|
});
|
|
5917
6280
|
}
|
|
5918
6281
|
|
|
5919
|
-
this.initOptions(
|
|
6282
|
+
this.initOptions();
|
|
5920
6283
|
this.$handle.init();
|
|
5921
6284
|
},
|
|
5922
6285
|
isSub: function isSub() {
|
|
5923
6286
|
return this.vm.setupState.parent && this.vm.props.extendOption;
|
|
5924
6287
|
},
|
|
5925
|
-
initOptions: function initOptions(
|
|
5926
|
-
this.options.value =
|
|
6288
|
+
initOptions: function initOptions() {
|
|
6289
|
+
this.options.value = {};
|
|
6290
|
+
|
|
6291
|
+
var options = _objectSpread2({
|
|
5927
6292
|
formData: {},
|
|
5928
6293
|
submitBtn: {},
|
|
5929
|
-
resetBtn: {}
|
|
6294
|
+
resetBtn: {},
|
|
6295
|
+
globalEvent: {},
|
|
6296
|
+
globalData: {}
|
|
5930
6297
|
}, deepCopy(globalConfig));
|
|
5931
6298
|
|
|
5932
6299
|
if (this.isSub()) {
|
|
5933
|
-
|
|
6300
|
+
options = this.mergeOptions(options, this.vm.setupState.parent.setupState.fc.options.value || {}, true);
|
|
5934
6301
|
}
|
|
5935
6302
|
|
|
6303
|
+
options = this.mergeOptions(options, this.vm.props.option);
|
|
5936
6304
|
this.updateOptions(options);
|
|
5937
6305
|
},
|
|
5938
6306
|
mergeOptions: function mergeOptions(target, opt, parent) {
|
|
5939
6307
|
opt = deepCopy(opt);
|
|
5940
|
-
parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el'].forEach(function (n) {
|
|
6308
|
+
parent && ['page', 'onSubmit', 'mounted', 'reload', 'formData', 'el', 'globalClass'].forEach(function (n) {
|
|
5941
6309
|
delete opt[n];
|
|
5942
6310
|
});
|
|
5943
6311
|
|
|
@@ -5994,6 +6362,7 @@ function FormCreateFactory(config) {
|
|
|
5994
6362
|
component: component,
|
|
5995
6363
|
directive: directive,
|
|
5996
6364
|
setModelField: setModelField,
|
|
6365
|
+
setFormula: setFormula,
|
|
5997
6366
|
register: register,
|
|
5998
6367
|
$vnode: $vnode,
|
|
5999
6368
|
parser: parser,
|
|
@@ -6060,6 +6429,7 @@ function FormCreateFactory(config) {
|
|
|
6060
6429
|
inherit.useApps && extend(useApps, inherit.useApps);
|
|
6061
6430
|
inherit.maker && extend(maker, inherit.maker);
|
|
6062
6431
|
inherit.loadData && extend(loadData, inherit.loadData);
|
|
6432
|
+
inherit.formulas && extend(formulas, inherit.formulas);
|
|
6063
6433
|
}
|
|
6064
6434
|
|
|
6065
6435
|
return create;
|
|
@@ -6323,8 +6693,8 @@ var manager = {
|
|
|
6323
6693
|
var form = _this.form();
|
|
6324
6694
|
|
|
6325
6695
|
if (form) {
|
|
6326
|
-
form.validateField(field, function (res) {
|
|
6327
|
-
|
|
6696
|
+
form.validateField(field, function (res, err) {
|
|
6697
|
+
err ? reject(err) : resolve(res);
|
|
6328
6698
|
});
|
|
6329
6699
|
} else {
|
|
6330
6700
|
resolve();
|
|
@@ -6339,7 +6709,7 @@ var manager = {
|
|
|
6339
6709
|
}
|
|
6340
6710
|
},
|
|
6341
6711
|
tidyOptions: function tidyOptions(options) {
|
|
6342
|
-
['submitBtn', 'resetBtn', 'row', 'info', 'wrap', 'col'].forEach(function (name) {
|
|
6712
|
+
['submitBtn', 'resetBtn', 'row', 'info', 'wrap', 'col', 'title'].forEach(function (name) {
|
|
6343
6713
|
tidyBool(options, name);
|
|
6344
6714
|
});
|
|
6345
6715
|
return options;
|
|
@@ -6354,7 +6724,8 @@ var manager = {
|
|
|
6354
6724
|
ctx.prop = mergeProps([{
|
|
6355
6725
|
info: this.options.info || {},
|
|
6356
6726
|
wrap: this.options.wrap || {},
|
|
6357
|
-
col: this.options.col || {}
|
|
6727
|
+
col: this.options.col || {},
|
|
6728
|
+
title: this.options.title || {}
|
|
6358
6729
|
}, ctx.prop], {
|
|
6359
6730
|
info: {
|
|
6360
6731
|
trigger: 'hover',
|
|
@@ -6382,7 +6753,7 @@ var manager = {
|
|
|
6382
6753
|
e.preventDefault();
|
|
6383
6754
|
}
|
|
6384
6755
|
},
|
|
6385
|
-
"class": [form.className, form["class"], 'form-create'],
|
|
6756
|
+
"class": [form.className, form["class"], 'form-create', this.options.preview ? 'is-preview' : ''],
|
|
6386
6757
|
style: form.style,
|
|
6387
6758
|
type: 'form'
|
|
6388
6759
|
};
|
|
@@ -6402,7 +6773,7 @@ var manager = {
|
|
|
6402
6773
|
render: function render(children) {
|
|
6403
6774
|
var _this2 = this;
|
|
6404
6775
|
|
|
6405
|
-
if (children.slotLen()) {
|
|
6776
|
+
if (children.slotLen() && !this.options.preview) {
|
|
6406
6777
|
children.setSlot(undefined, function () {
|
|
6407
6778
|
return _this2.makeFormBtn();
|
|
6408
6779
|
});
|
|
@@ -6427,7 +6798,7 @@ var manager = {
|
|
|
6427
6798
|
label: isTitle ? rule.title.title : undefined
|
|
6428
6799
|
}, tidyRule(rule.wrap || {})), {}, {
|
|
6429
6800
|
prop: ctx.id,
|
|
6430
|
-
rules:
|
|
6801
|
+
rules: ctx.injectValidate()
|
|
6431
6802
|
}),
|
|
6432
6803
|
"class": rule.className,
|
|
6433
6804
|
key: "".concat(uni, "fi"),
|
|
@@ -6689,7 +7060,7 @@ function useFrame(maker) {
|
|
|
6689
7060
|
return maker;
|
|
6690
7061
|
}
|
|
6691
7062
|
|
|
6692
|
-
var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}";
|
|
7063
|
+
var css_248z = ".form-create .form-create .el-form-item{margin-bottom:22px}.form-create{width:100%}.form-create .fc-none,.form-create.is-preview .fc-clock{display:none!important}.form-create.is-preview .el-form-item.is-required>.el-form-item__label-wrap>.el-form-item__label:before,.form-create.is-preview .el-form-item.is-required>.el-form-item__label:before{content:\"\"!important}";
|
|
6693
7064
|
styleInject(css_248z);
|
|
6694
7065
|
|
|
6695
7066
|
function tidyBtnProp(btn, def) {
|
|
@@ -6872,6 +7243,7 @@ var required = {
|
|
|
6872
7243
|
|
|
6873
7244
|
if (val.required === false) {
|
|
6874
7245
|
inject.clearProp();
|
|
7246
|
+
api.clearValidateState([rule.field]);
|
|
6875
7247
|
} else {
|
|
6876
7248
|
var validate = _objectSpread2({
|
|
6877
7249
|
required: true,
|
|
@@ -6942,7 +7314,7 @@ function install(FormCreate) {
|
|
|
6942
7314
|
function elmFormCreate() {
|
|
6943
7315
|
return FormCreateFactory({
|
|
6944
7316
|
ui: 'element-ui',
|
|
6945
|
-
version: '3.1.
|
|
7317
|
+
version: '3.1.30',
|
|
6946
7318
|
manager: manager,
|
|
6947
7319
|
extendApi: extendApi,
|
|
6948
7320
|
install: install,
|