@blueking/bkui-form 0.0.31 → 0.0.33
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/adapter/vue2/common/FieldGroupWrap.d.ts +34 -0
- package/dist/adapter/vue2/field/ArrayField.d.ts +19 -0
- package/dist/adapter/vue2/field/BooleanField.d.ts +18 -0
- package/dist/adapter/vue2/field/CompositionField.d.ts +22 -0
- package/dist/adapter/vue2/field/FieldProps.d.ts +65 -0
- package/dist/adapter/vue2/field/NumberField.d.ts +18 -0
- package/dist/adapter/vue2/field/ObjectField.d.ts +3 -0
- package/dist/adapter/vue2/field/SchemaField.d.ts +3 -0
- package/dist/adapter/vue2/field/StringField.d.ts +18 -0
- package/dist/adapter/vue2/widget/ArrayWidget.d.ts +9 -0
- package/dist/adapter/vue2/widget/ButtonWidget.d.ts +9 -0
- package/dist/adapter/vue2/widget/CheckboxWidget.d.ts +12 -0
- package/dist/adapter/vue2/widget/CollapseGroupWidget.d.ts +16 -0
- package/dist/adapter/vue2/widget/ColorPickerWidget.d.ts +9 -0
- package/dist/adapter/vue2/widget/InputWidget.d.ts +15 -0
- package/dist/adapter/vue2/widget/KeyValueArrayWidget.d.ts +26 -0
- package/dist/adapter/vue2/widget/RadioWidget.d.ts +12 -0
- package/dist/adapter/vue2/widget/SelectWidget.d.ts +12 -0
- package/dist/adapter/vue2/widget/SwitchWidget.d.ts +9 -0
- package/dist/adapter/vue2/widget/TabGroupWidget.d.ts +17 -0
- package/dist/adapter/vue2/widget/TableWidget.d.ts +25 -0
- package/dist/adapter/vue2/widget/Widget.d.ts +22 -0
- package/dist/bkui-form-es-min.js +6 -8
- package/dist/bkui-form-es.js +533 -926
- package/dist/bkui-form-es.js.map +1 -1
- package/dist/bkui-form-umd-min.js +6 -8
- package/dist/bkui-form-umd.js +533 -926
- package/dist/bkui-form-umd.js.map +1 -1
- package/dist/controller/form-vue2.d.ts +26 -0
- package/dist/controller/props.d.ts +51 -0
- package/dist/core/events.d.ts +10 -0
- package/dist/core/expression.d.ts +13 -0
- package/dist/core/form.d.ts +4 -0
- package/dist/core/layout.d.ts +19 -0
- package/dist/core/path.d.ts +9 -0
- package/dist/core/proxy.d.ts +2 -0
- package/dist/core/reaction.d.ts +4 -0
- package/dist/core/register.d.ts +19 -0
- package/dist/core/schema.d.ts +24 -0
- package/dist/core/validator.d.ts +34 -0
- package/dist/core/widgetTree.d.ts +40 -0
- package/dist/index.d.ts +5 -0
- package/dist/util/fetch.d.ts +9 -0
- package/dist/util/index.d.ts +16 -0
- package/package.json +7 -7
package/dist/bkui-form-umd.js
CHANGED
|
@@ -8,19 +8,43 @@
|
|
|
8
8
|
|
|
9
9
|
var Vue__default = /*#__PURE__*/_interopDefaultLegacy(Vue);
|
|
10
10
|
|
|
11
|
+
function _iterableToArrayLimit(arr, i) {
|
|
12
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
13
|
+
if (null != _i) {
|
|
14
|
+
var _s,
|
|
15
|
+
_e,
|
|
16
|
+
_x,
|
|
17
|
+
_r,
|
|
18
|
+
_arr = [],
|
|
19
|
+
_n = !0,
|
|
20
|
+
_d = !1;
|
|
21
|
+
try {
|
|
22
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
23
|
+
if (Object(_i) !== _i) return;
|
|
24
|
+
_n = !1;
|
|
25
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
26
|
+
} catch (err) {
|
|
27
|
+
_d = !0, _e = err;
|
|
28
|
+
} finally {
|
|
29
|
+
try {
|
|
30
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
31
|
+
} finally {
|
|
32
|
+
if (_d) throw _e;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return _arr;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
11
38
|
function ownKeys(object, enumerableOnly) {
|
|
12
39
|
var keys = Object.keys(object);
|
|
13
|
-
|
|
14
40
|
if (Object.getOwnPropertySymbols) {
|
|
15
41
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
16
42
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
17
43
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
18
44
|
})), keys.push.apply(keys, symbols);
|
|
19
45
|
}
|
|
20
|
-
|
|
21
46
|
return keys;
|
|
22
47
|
}
|
|
23
|
-
|
|
24
48
|
function _objectSpread2(target) {
|
|
25
49
|
for (var i = 1; i < arguments.length; i++) {
|
|
26
50
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -30,25 +54,22 @@
|
|
|
30
54
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
31
55
|
});
|
|
32
56
|
}
|
|
33
|
-
|
|
34
57
|
return target;
|
|
35
58
|
}
|
|
36
|
-
|
|
37
59
|
function _regeneratorRuntime() {
|
|
38
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
39
|
-
|
|
40
60
|
_regeneratorRuntime = function () {
|
|
41
61
|
return exports;
|
|
42
62
|
};
|
|
43
|
-
|
|
44
63
|
var exports = {},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
Op = Object.prototype,
|
|
65
|
+
hasOwn = Op.hasOwnProperty,
|
|
66
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
67
|
+
obj[key] = desc.value;
|
|
68
|
+
},
|
|
69
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
70
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
71
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
72
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
52
73
|
function define(obj, key, value) {
|
|
53
74
|
return Object.defineProperty(obj, key, {
|
|
54
75
|
value: value,
|
|
@@ -57,7 +78,6 @@
|
|
|
57
78
|
writable: !0
|
|
58
79
|
}), obj[key];
|
|
59
80
|
}
|
|
60
|
-
|
|
61
81
|
try {
|
|
62
82
|
define({}, "");
|
|
63
83
|
} catch (err) {
|
|
@@ -65,54 +85,14 @@
|
|
|
65
85
|
return obj[key] = value;
|
|
66
86
|
};
|
|
67
87
|
}
|
|
68
|
-
|
|
69
88
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
70
89
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return generator
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
77
|
-
|
|
78
|
-
if ("completed" === state) {
|
|
79
|
-
if ("throw" === method) throw arg;
|
|
80
|
-
return doneResult();
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
for (context.method = method, context.arg = arg;;) {
|
|
84
|
-
var delegate = context.delegate;
|
|
85
|
-
|
|
86
|
-
if (delegate) {
|
|
87
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
88
|
-
|
|
89
|
-
if (delegateResult) {
|
|
90
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
91
|
-
return delegateResult;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
96
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
97
|
-
context.dispatchException(context.arg);
|
|
98
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
99
|
-
state = "executing";
|
|
100
|
-
var record = tryCatch(innerFn, self, context);
|
|
101
|
-
|
|
102
|
-
if ("normal" === record.type) {
|
|
103
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
104
|
-
return {
|
|
105
|
-
value: record.arg,
|
|
106
|
-
done: context.done
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}(innerFn, self, context), generator;
|
|
90
|
+
generator = Object.create(protoGenerator.prototype),
|
|
91
|
+
context = new Context(tryLocsList || []);
|
|
92
|
+
return defineProperty(generator, "_invoke", {
|
|
93
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
94
|
+
}), generator;
|
|
114
95
|
}
|
|
115
|
-
|
|
116
96
|
function tryCatch(fn, obj, arg) {
|
|
117
97
|
try {
|
|
118
98
|
return {
|
|
@@ -126,25 +106,19 @@
|
|
|
126
106
|
};
|
|
127
107
|
}
|
|
128
108
|
}
|
|
129
|
-
|
|
130
109
|
exports.wrap = wrap;
|
|
131
110
|
var ContinueSentinel = {};
|
|
132
|
-
|
|
133
111
|
function Generator() {}
|
|
134
|
-
|
|
135
112
|
function GeneratorFunction() {}
|
|
136
|
-
|
|
137
113
|
function GeneratorFunctionPrototype() {}
|
|
138
|
-
|
|
139
114
|
var IteratorPrototype = {};
|
|
140
115
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
141
116
|
return this;
|
|
142
117
|
});
|
|
143
118
|
var getProto = Object.getPrototypeOf,
|
|
144
|
-
|
|
119
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
145
120
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
146
121
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
147
|
-
|
|
148
122
|
function defineIteratorMethods(prototype) {
|
|
149
123
|
["next", "throw", "return"].forEach(function (method) {
|
|
150
124
|
define(prototype, method, function (arg) {
|
|
@@ -152,14 +126,12 @@
|
|
|
152
126
|
});
|
|
153
127
|
});
|
|
154
128
|
}
|
|
155
|
-
|
|
156
129
|
function AsyncIterator(generator, PromiseImpl) {
|
|
157
130
|
function invoke(method, arg, resolve, reject) {
|
|
158
131
|
var record = tryCatch(generator[method], generator, arg);
|
|
159
|
-
|
|
160
132
|
if ("throw" !== record.type) {
|
|
161
133
|
var result = record.arg,
|
|
162
|
-
|
|
134
|
+
value = result.value;
|
|
163
135
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
164
136
|
invoke("next", value, resolve, reject);
|
|
165
137
|
}, function (err) {
|
|
@@ -170,90 +142,109 @@
|
|
|
170
142
|
return invoke("throw", error, resolve, reject);
|
|
171
143
|
});
|
|
172
144
|
}
|
|
173
|
-
|
|
174
145
|
reject(record.arg);
|
|
175
146
|
}
|
|
176
|
-
|
|
177
147
|
var previousPromise;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
148
|
+
defineProperty(this, "_invoke", {
|
|
149
|
+
value: function (method, arg) {
|
|
150
|
+
function callInvokeWithMethodAndArg() {
|
|
151
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
152
|
+
invoke(method, arg, resolve, reject);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
160
|
+
var state = "suspendedStart";
|
|
161
|
+
return function (method, arg) {
|
|
162
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
163
|
+
if ("completed" === state) {
|
|
164
|
+
if ("throw" === method) throw arg;
|
|
165
|
+
return doneResult();
|
|
166
|
+
}
|
|
167
|
+
for (context.method = method, context.arg = arg;;) {
|
|
168
|
+
var delegate = context.delegate;
|
|
169
|
+
if (delegate) {
|
|
170
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
171
|
+
if (delegateResult) {
|
|
172
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
173
|
+
return delegateResult;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
177
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
178
|
+
context.dispatchException(context.arg);
|
|
179
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
180
|
+
state = "executing";
|
|
181
|
+
var record = tryCatch(innerFn, self, context);
|
|
182
|
+
if ("normal" === record.type) {
|
|
183
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
184
|
+
return {
|
|
185
|
+
value: record.arg,
|
|
186
|
+
done: context.done
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
184
190
|
}
|
|
185
|
-
|
|
186
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
187
191
|
};
|
|
188
192
|
}
|
|
189
|
-
|
|
190
193
|
function maybeInvokeDelegate(delegate, context) {
|
|
191
|
-
var
|
|
192
|
-
|
|
193
|
-
if (undefined === method)
|
|
194
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
195
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
196
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return ContinueSentinel;
|
|
200
|
-
}
|
|
201
|
-
|
|
194
|
+
var methodName = context.method,
|
|
195
|
+
method = delegate.iterator[methodName];
|
|
196
|
+
if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
|
|
202
197
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
203
198
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
204
199
|
var info = record.arg;
|
|
205
200
|
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
206
201
|
}
|
|
207
|
-
|
|
208
202
|
function pushTryEntry(locs) {
|
|
209
203
|
var entry = {
|
|
210
204
|
tryLoc: locs[0]
|
|
211
205
|
};
|
|
212
206
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
213
207
|
}
|
|
214
|
-
|
|
215
208
|
function resetTryEntry(entry) {
|
|
216
209
|
var record = entry.completion || {};
|
|
217
210
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
218
211
|
}
|
|
219
|
-
|
|
220
212
|
function Context(tryLocsList) {
|
|
221
213
|
this.tryEntries = [{
|
|
222
214
|
tryLoc: "root"
|
|
223
215
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
224
216
|
}
|
|
225
|
-
|
|
226
217
|
function values(iterable) {
|
|
227
218
|
if (iterable) {
|
|
228
219
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
229
220
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
230
221
|
if ("function" == typeof iterable.next) return iterable;
|
|
231
|
-
|
|
232
222
|
if (!isNaN(iterable.length)) {
|
|
233
223
|
var i = -1,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
};
|
|
239
|
-
|
|
224
|
+
next = function next() {
|
|
225
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
226
|
+
return next.value = undefined, next.done = !0, next;
|
|
227
|
+
};
|
|
240
228
|
return next.next = next;
|
|
241
229
|
}
|
|
242
230
|
}
|
|
243
|
-
|
|
244
231
|
return {
|
|
245
232
|
next: doneResult
|
|
246
233
|
};
|
|
247
234
|
}
|
|
248
|
-
|
|
249
235
|
function doneResult() {
|
|
250
236
|
return {
|
|
251
237
|
value: undefined,
|
|
252
238
|
done: !0
|
|
253
239
|
};
|
|
254
240
|
}
|
|
255
|
-
|
|
256
|
-
|
|
241
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
242
|
+
value: GeneratorFunctionPrototype,
|
|
243
|
+
configurable: !0
|
|
244
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
245
|
+
value: GeneratorFunction,
|
|
246
|
+
configurable: !0
|
|
247
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
257
248
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
258
249
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
259
250
|
}, exports.mark = function (genFun) {
|
|
@@ -274,17 +265,15 @@
|
|
|
274
265
|
return this;
|
|
275
266
|
}), define(Gp, "toString", function () {
|
|
276
267
|
return "[object Generator]";
|
|
277
|
-
}), exports.keys = function (
|
|
278
|
-
var
|
|
279
|
-
|
|
268
|
+
}), exports.keys = function (val) {
|
|
269
|
+
var object = Object(val),
|
|
270
|
+
keys = [];
|
|
280
271
|
for (var key in object) keys.push(key);
|
|
281
|
-
|
|
282
272
|
return keys.reverse(), function next() {
|
|
283
273
|
for (; keys.length;) {
|
|
284
274
|
var key = keys.pop();
|
|
285
275
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
286
276
|
}
|
|
287
|
-
|
|
288
277
|
return next.done = !0, next;
|
|
289
278
|
};
|
|
290
279
|
}, exports.values = values, Context.prototype = {
|
|
@@ -301,20 +290,16 @@
|
|
|
301
290
|
dispatchException: function (exception) {
|
|
302
291
|
if (this.done) throw exception;
|
|
303
292
|
var context = this;
|
|
304
|
-
|
|
305
293
|
function handle(loc, caught) {
|
|
306
294
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
307
295
|
}
|
|
308
|
-
|
|
309
296
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
310
297
|
var entry = this.tryEntries[i],
|
|
311
|
-
|
|
298
|
+
record = entry.completion;
|
|
312
299
|
if ("root" === entry.tryLoc) return handle("end");
|
|
313
|
-
|
|
314
300
|
if (entry.tryLoc <= this.prev) {
|
|
315
301
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
316
|
-
|
|
317
|
-
|
|
302
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
318
303
|
if (hasCatch && hasFinally) {
|
|
319
304
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
320
305
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -330,13 +315,11 @@
|
|
|
330
315
|
abrupt: function (type, arg) {
|
|
331
316
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
332
317
|
var entry = this.tryEntries[i];
|
|
333
|
-
|
|
334
318
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
335
319
|
var finallyEntry = entry;
|
|
336
320
|
break;
|
|
337
321
|
}
|
|
338
322
|
}
|
|
339
|
-
|
|
340
323
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
341
324
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
342
325
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -354,19 +337,15 @@
|
|
|
354
337
|
catch: function (tryLoc) {
|
|
355
338
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
356
339
|
var entry = this.tryEntries[i];
|
|
357
|
-
|
|
358
340
|
if (entry.tryLoc === tryLoc) {
|
|
359
341
|
var record = entry.completion;
|
|
360
|
-
|
|
361
342
|
if ("throw" === record.type) {
|
|
362
343
|
var thrown = record.arg;
|
|
363
344
|
resetTryEntry(entry);
|
|
364
345
|
}
|
|
365
|
-
|
|
366
346
|
return thrown;
|
|
367
347
|
}
|
|
368
348
|
}
|
|
369
|
-
|
|
370
349
|
throw new Error("illegal catch attempt");
|
|
371
350
|
},
|
|
372
351
|
delegateYield: function (iterable, resultName, nextLoc) {
|
|
@@ -378,7 +357,6 @@
|
|
|
378
357
|
}
|
|
379
358
|
}, exports;
|
|
380
359
|
}
|
|
381
|
-
|
|
382
360
|
function _typeof(obj) {
|
|
383
361
|
"@babel/helpers - typeof";
|
|
384
362
|
|
|
@@ -388,7 +366,6 @@
|
|
|
388
366
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
389
367
|
}, _typeof(obj);
|
|
390
368
|
}
|
|
391
|
-
|
|
392
369
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
393
370
|
try {
|
|
394
371
|
var info = gen[key](arg);
|
|
@@ -397,50 +374,42 @@
|
|
|
397
374
|
reject(error);
|
|
398
375
|
return;
|
|
399
376
|
}
|
|
400
|
-
|
|
401
377
|
if (info.done) {
|
|
402
378
|
resolve(value);
|
|
403
379
|
} else {
|
|
404
380
|
Promise.resolve(value).then(_next, _throw);
|
|
405
381
|
}
|
|
406
382
|
}
|
|
407
|
-
|
|
408
383
|
function _asyncToGenerator(fn) {
|
|
409
384
|
return function () {
|
|
410
385
|
var self = this,
|
|
411
|
-
|
|
386
|
+
args = arguments;
|
|
412
387
|
return new Promise(function (resolve, reject) {
|
|
413
388
|
var gen = fn.apply(self, args);
|
|
414
|
-
|
|
415
389
|
function _next(value) {
|
|
416
390
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
417
391
|
}
|
|
418
|
-
|
|
419
392
|
function _throw(err) {
|
|
420
393
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
421
394
|
}
|
|
422
|
-
|
|
423
395
|
_next(undefined);
|
|
424
396
|
});
|
|
425
397
|
};
|
|
426
398
|
}
|
|
427
|
-
|
|
428
399
|
function _classCallCheck(instance, Constructor) {
|
|
429
400
|
if (!(instance instanceof Constructor)) {
|
|
430
401
|
throw new TypeError("Cannot call a class as a function");
|
|
431
402
|
}
|
|
432
403
|
}
|
|
433
|
-
|
|
434
404
|
function _defineProperties(target, props) {
|
|
435
405
|
for (var i = 0; i < props.length; i++) {
|
|
436
406
|
var descriptor = props[i];
|
|
437
407
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
438
408
|
descriptor.configurable = true;
|
|
439
409
|
if ("value" in descriptor) descriptor.writable = true;
|
|
440
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
410
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
441
411
|
}
|
|
442
412
|
}
|
|
443
|
-
|
|
444
413
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
445
414
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
446
415
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -449,8 +418,8 @@
|
|
|
449
418
|
});
|
|
450
419
|
return Constructor;
|
|
451
420
|
}
|
|
452
|
-
|
|
453
421
|
function _defineProperty(obj, key, value) {
|
|
422
|
+
key = _toPropertyKey(key);
|
|
454
423
|
if (key in obj) {
|
|
455
424
|
Object.defineProperty(obj, key, {
|
|
456
425
|
value: value,
|
|
@@ -461,52 +430,43 @@
|
|
|
461
430
|
} else {
|
|
462
431
|
obj[key] = value;
|
|
463
432
|
}
|
|
464
|
-
|
|
465
433
|
return obj;
|
|
466
434
|
}
|
|
467
|
-
|
|
468
435
|
function _extends$1() {
|
|
469
436
|
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
470
437
|
for (var i = 1; i < arguments.length; i++) {
|
|
471
438
|
var source = arguments[i];
|
|
472
|
-
|
|
473
439
|
for (var key in source) {
|
|
474
440
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
475
441
|
target[key] = source[key];
|
|
476
442
|
}
|
|
477
443
|
}
|
|
478
444
|
}
|
|
479
|
-
|
|
480
445
|
return target;
|
|
481
446
|
};
|
|
482
447
|
return _extends$1.apply(this, arguments);
|
|
483
448
|
}
|
|
484
|
-
|
|
449
|
+
function _objectDestructuringEmpty(obj) {
|
|
450
|
+
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
451
|
+
}
|
|
485
452
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
486
453
|
if (source == null) return {};
|
|
487
454
|
var target = {};
|
|
488
455
|
var sourceKeys = Object.keys(source);
|
|
489
456
|
var key, i;
|
|
490
|
-
|
|
491
457
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
492
458
|
key = sourceKeys[i];
|
|
493
459
|
if (excluded.indexOf(key) >= 0) continue;
|
|
494
460
|
target[key] = source[key];
|
|
495
461
|
}
|
|
496
|
-
|
|
497
462
|
return target;
|
|
498
463
|
}
|
|
499
|
-
|
|
500
464
|
function _objectWithoutProperties(source, excluded) {
|
|
501
465
|
if (source == null) return {};
|
|
502
|
-
|
|
503
466
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
504
|
-
|
|
505
467
|
var key, i;
|
|
506
|
-
|
|
507
468
|
if (Object.getOwnPropertySymbols) {
|
|
508
469
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
509
|
-
|
|
510
470
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
511
471
|
key = sourceSymbolKeys[i];
|
|
512
472
|
if (excluded.indexOf(key) >= 0) continue;
|
|
@@ -514,60 +474,23 @@
|
|
|
514
474
|
target[key] = source[key];
|
|
515
475
|
}
|
|
516
476
|
}
|
|
517
|
-
|
|
518
477
|
return target;
|
|
519
478
|
}
|
|
520
|
-
|
|
521
479
|
function _slicedToArray(arr, i) {
|
|
522
480
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
523
481
|
}
|
|
524
|
-
|
|
525
482
|
function _toConsumableArray(arr) {
|
|
526
483
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
527
484
|
}
|
|
528
|
-
|
|
529
485
|
function _arrayWithoutHoles(arr) {
|
|
530
486
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
531
487
|
}
|
|
532
|
-
|
|
533
488
|
function _arrayWithHoles(arr) {
|
|
534
489
|
if (Array.isArray(arr)) return arr;
|
|
535
490
|
}
|
|
536
|
-
|
|
537
491
|
function _iterableToArray(iter) {
|
|
538
492
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
539
493
|
}
|
|
540
|
-
|
|
541
|
-
function _iterableToArrayLimit(arr, i) {
|
|
542
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
543
|
-
|
|
544
|
-
if (_i == null) return;
|
|
545
|
-
var _arr = [];
|
|
546
|
-
var _n = true;
|
|
547
|
-
var _d = false;
|
|
548
|
-
|
|
549
|
-
var _s, _e;
|
|
550
|
-
|
|
551
|
-
try {
|
|
552
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
553
|
-
_arr.push(_s.value);
|
|
554
|
-
|
|
555
|
-
if (i && _arr.length === i) break;
|
|
556
|
-
}
|
|
557
|
-
} catch (err) {
|
|
558
|
-
_d = true;
|
|
559
|
-
_e = err;
|
|
560
|
-
} finally {
|
|
561
|
-
try {
|
|
562
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
563
|
-
} finally {
|
|
564
|
-
if (_d) throw _e;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
return _arr;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
494
|
function _unsupportedIterableToArray(o, minLen) {
|
|
572
495
|
if (!o) return;
|
|
573
496
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -576,33 +499,24 @@
|
|
|
576
499
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
577
500
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
578
501
|
}
|
|
579
|
-
|
|
580
502
|
function _arrayLikeToArray(arr, len) {
|
|
581
503
|
if (len == null || len > arr.length) len = arr.length;
|
|
582
|
-
|
|
583
504
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
584
|
-
|
|
585
505
|
return arr2;
|
|
586
506
|
}
|
|
587
|
-
|
|
588
507
|
function _nonIterableSpread() {
|
|
589
508
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
590
509
|
}
|
|
591
|
-
|
|
592
510
|
function _nonIterableRest() {
|
|
593
511
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
594
512
|
}
|
|
595
|
-
|
|
596
513
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
597
514
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
598
|
-
|
|
599
515
|
if (!it) {
|
|
600
516
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
601
517
|
if (it) o = it;
|
|
602
518
|
var i = 0;
|
|
603
|
-
|
|
604
519
|
var F = function () {};
|
|
605
|
-
|
|
606
520
|
return {
|
|
607
521
|
s: F,
|
|
608
522
|
n: function () {
|
|
@@ -620,13 +534,11 @@
|
|
|
620
534
|
f: F
|
|
621
535
|
};
|
|
622
536
|
}
|
|
623
|
-
|
|
624
537
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
625
538
|
}
|
|
626
|
-
|
|
627
539
|
var normalCompletion = true,
|
|
628
|
-
|
|
629
|
-
|
|
540
|
+
didErr = false,
|
|
541
|
+
err;
|
|
630
542
|
return {
|
|
631
543
|
s: function () {
|
|
632
544
|
it = it.call(o);
|
|
@@ -649,11 +561,24 @@
|
|
|
649
561
|
}
|
|
650
562
|
};
|
|
651
563
|
}
|
|
564
|
+
function _toPrimitive(input, hint) {
|
|
565
|
+
if (typeof input !== "object" || input === null) return input;
|
|
566
|
+
var prim = input[Symbol.toPrimitive];
|
|
567
|
+
if (prim !== undefined) {
|
|
568
|
+
var res = prim.call(input, hint || "default");
|
|
569
|
+
if (typeof res !== "object") return res;
|
|
570
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
571
|
+
}
|
|
572
|
+
return (hint === "string" ? String : Number)(input);
|
|
573
|
+
}
|
|
574
|
+
function _toPropertyKey(arg) {
|
|
575
|
+
var key = _toPrimitive(arg, "string");
|
|
576
|
+
return typeof key === "symbol" ? key : String(key);
|
|
577
|
+
}
|
|
652
578
|
|
|
653
579
|
// eslint-disable-next-line no-new-func
|
|
654
580
|
var isRegExp = function isRegExp(regExpStr) {
|
|
655
581
|
var _Function;
|
|
656
|
-
|
|
657
582
|
return ((_Function = new Function("return ".concat(regExpStr, ";"))()) === null || _Function === void 0 ? void 0 : _Function.constructor) === RegExp;
|
|
658
583
|
};
|
|
659
584
|
var isObj = function isObj(val) {
|
|
@@ -665,20 +590,17 @@
|
|
|
665
590
|
return self;
|
|
666
591
|
}
|
|
667
592
|
} catch (e) {}
|
|
668
|
-
|
|
669
593
|
try {
|
|
670
594
|
if (typeof window !== 'undefined') {
|
|
671
595
|
return window;
|
|
672
596
|
}
|
|
673
597
|
} catch (e) {}
|
|
674
|
-
|
|
675
598
|
try {
|
|
676
599
|
if (typeof global !== 'undefined') {
|
|
677
600
|
return global;
|
|
678
601
|
}
|
|
679
|
-
} catch (e) {}
|
|
680
|
-
|
|
681
|
-
|
|
602
|
+
} catch (e) {}
|
|
603
|
+
// eslint-disable-next-line no-new-func
|
|
682
604
|
return Function('return this')();
|
|
683
605
|
})();
|
|
684
606
|
var hasOwnProperty = function hasOwnProperty(obj, key) {
|
|
@@ -688,82 +610,64 @@
|
|
|
688
610
|
if (Array.isArray(value)) {
|
|
689
611
|
return 'array';
|
|
690
612
|
}
|
|
691
|
-
|
|
692
613
|
if (typeof value === 'string') {
|
|
693
614
|
return 'string';
|
|
694
615
|
}
|
|
695
|
-
|
|
696
616
|
if (typeof value === 'boolean') {
|
|
697
617
|
return 'boolean';
|
|
698
618
|
}
|
|
699
|
-
|
|
700
619
|
if (!isNaN(value)) {
|
|
701
620
|
return 'number';
|
|
702
621
|
}
|
|
703
|
-
|
|
704
622
|
if (value === null) {
|
|
705
623
|
return 'null';
|
|
706
624
|
}
|
|
707
|
-
|
|
708
625
|
if (_typeof(value) === 'object') {
|
|
709
626
|
return 'object';
|
|
710
627
|
}
|
|
711
|
-
|
|
712
628
|
return _typeof(value);
|
|
713
629
|
};
|
|
714
630
|
var merge = function merge(target, source) {
|
|
715
631
|
if (isObj(source)) {
|
|
716
632
|
return Object.keys(source).reduce(function (pre, key) {
|
|
717
633
|
var _target;
|
|
718
|
-
|
|
719
634
|
pre[key] = merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
|
|
720
635
|
return pre;
|
|
721
636
|
}, JSON.parse(JSON.stringify(target)));
|
|
722
637
|
}
|
|
723
|
-
|
|
724
638
|
if (Array.isArray(source)) {
|
|
725
639
|
target = Array.isArray(target) ? target : [];
|
|
726
640
|
return source.map(function (item, index) {
|
|
727
641
|
if (target[index]) {
|
|
728
642
|
return merge(target[index], item);
|
|
729
643
|
}
|
|
730
|
-
|
|
731
644
|
return item;
|
|
732
645
|
});
|
|
733
646
|
}
|
|
734
|
-
|
|
735
647
|
return source;
|
|
736
648
|
};
|
|
737
|
-
|
|
649
|
+
// 获取type对应的初始化值
|
|
738
650
|
function initializationValue(type) {
|
|
739
651
|
var defaultInitValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
740
652
|
integer: undefined,
|
|
741
653
|
number: undefined // 默认初始化值(number类型0值会有特殊含义)
|
|
742
|
-
|
|
743
654
|
};
|
|
744
655
|
|
|
745
656
|
switch (type) {
|
|
746
657
|
case 'any':
|
|
747
658
|
return undefined;
|
|
748
|
-
|
|
749
659
|
case 'array':
|
|
750
660
|
return [];
|
|
751
|
-
|
|
752
661
|
case 'boolean':
|
|
753
662
|
return false;
|
|
754
|
-
|
|
755
663
|
case 'integer':
|
|
756
664
|
return defaultInitValue.integer;
|
|
757
|
-
|
|
758
665
|
case 'null':
|
|
759
666
|
return null;
|
|
760
|
-
|
|
761
667
|
case 'number':
|
|
762
668
|
return defaultInitValue.number;
|
|
763
|
-
|
|
764
669
|
case 'object':
|
|
765
670
|
return {};
|
|
766
|
-
|
|
767
671
|
case 'string':
|
|
768
672
|
return '';
|
|
769
673
|
}
|
|
@@ -772,10 +676,8 @@
|
|
|
772
676
|
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
773
677
|
sources[_key - 1] = arguments[_key];
|
|
774
678
|
}
|
|
775
|
-
|
|
776
679
|
if (!sources.length) return target;
|
|
777
680
|
var source = sources.shift();
|
|
778
|
-
|
|
779
681
|
if (isObj(target) && isObj(source)) {
|
|
780
682
|
for (var key in source) {
|
|
781
683
|
if (isObj(source[key])) {
|
|
@@ -786,100 +688,81 @@
|
|
|
786
688
|
}
|
|
787
689
|
}
|
|
788
690
|
}
|
|
789
|
-
|
|
790
691
|
return mergeDeep.apply(void 0, [target].concat(sources));
|
|
791
692
|
}
|
|
792
|
-
|
|
793
693
|
function isArguments(object) {
|
|
794
694
|
return Object.prototype.toString.call(object) === '[object Arguments]';
|
|
795
695
|
}
|
|
796
|
-
|
|
797
696
|
function deepEquals(a, b) {
|
|
798
697
|
var ca = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
799
698
|
var cb = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
800
|
-
|
|
801
699
|
// Partially extracted from node-deeper and adapted to exclude comparison
|
|
802
700
|
// checks for functions.
|
|
803
701
|
// https://github.com/othiym23/node-deeper
|
|
804
702
|
if (a === b) {
|
|
805
703
|
return true;
|
|
806
704
|
}
|
|
807
|
-
|
|
808
705
|
if (typeof a === 'function' || typeof b === 'function') {
|
|
809
706
|
// Assume all functions are equivalent
|
|
810
707
|
// see https://github.com/mozilla-services/react-jsonschema-form/issues/255
|
|
811
708
|
return true;
|
|
812
709
|
}
|
|
813
|
-
|
|
814
710
|
if (_typeof(a) !== 'object' || _typeof(b) !== 'object') {
|
|
815
711
|
return false;
|
|
816
712
|
}
|
|
817
|
-
|
|
818
713
|
if (a === null || b === null) {
|
|
819
714
|
return false;
|
|
820
715
|
}
|
|
821
|
-
|
|
822
716
|
if (a instanceof Date && b instanceof Date) {
|
|
823
717
|
return a.getTime() === b.getTime();
|
|
824
718
|
}
|
|
825
|
-
|
|
826
719
|
if (a instanceof RegExp && b instanceof RegExp) {
|
|
827
720
|
return a.source === b.source && a.global === b.global && a.multiline === b.multiline && a.lastIndex === b.lastIndex && a.ignoreCase === b.ignoreCase;
|
|
828
721
|
}
|
|
829
|
-
|
|
830
722
|
if (isArguments(a) || isArguments(b)) {
|
|
831
723
|
if (!(isArguments(a) && isArguments(b))) {
|
|
832
724
|
return false;
|
|
833
725
|
}
|
|
834
|
-
|
|
835
726
|
var slice = Array.prototype.slice;
|
|
836
727
|
return deepEquals(slice.call(a), slice.call(b), ca, cb);
|
|
837
728
|
}
|
|
838
|
-
|
|
839
729
|
if (a.constructor !== b.constructor) {
|
|
840
730
|
return false;
|
|
841
731
|
}
|
|
842
|
-
|
|
843
732
|
var ka = Object.keys(a);
|
|
844
|
-
var kb = Object.keys(b);
|
|
845
|
-
|
|
733
|
+
var kb = Object.keys(b);
|
|
734
|
+
// don't bother with stack acrobatics if there's nothing there
|
|
846
735
|
if (ka.length === 0 && kb.length === 0) {
|
|
847
736
|
return true;
|
|
848
737
|
}
|
|
849
|
-
|
|
850
738
|
if (ka.length !== kb.length) {
|
|
851
739
|
return false;
|
|
852
740
|
}
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
741
|
+
var cal = ca.length;
|
|
742
|
+
// eslint-disable-next-line no-plusplus
|
|
856
743
|
while (cal--) {
|
|
857
744
|
if (ca[cal] === a) {
|
|
858
745
|
return cb[cal] === b;
|
|
859
746
|
}
|
|
860
747
|
}
|
|
861
|
-
|
|
862
748
|
ca.push(a);
|
|
863
749
|
cb.push(b);
|
|
864
750
|
ka.sort();
|
|
865
|
-
kb.sort();
|
|
866
|
-
|
|
751
|
+
kb.sort();
|
|
752
|
+
// eslint-disable-next-line no-plusplus
|
|
867
753
|
for (var j = ka.length - 1; j >= 0; j--) {
|
|
868
754
|
if (ka[j] !== kb[j]) {
|
|
869
755
|
return false;
|
|
870
756
|
}
|
|
871
757
|
}
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
758
|
+
var key;
|
|
759
|
+
// eslint-disable-next-line no-plusplus
|
|
875
760
|
for (var k = ka.length - 1; k >= 0; k--) {
|
|
876
761
|
key = ka[k];
|
|
877
|
-
|
|
878
762
|
if (!deepEquals(a[key], b[key], ca, cb)) {
|
|
879
763
|
return false;
|
|
880
764
|
}
|
|
881
765
|
}
|
|
882
|
-
|
|
883
766
|
ca.pop();
|
|
884
767
|
cb.pop();
|
|
885
768
|
return true;
|
|
@@ -888,18 +771,15 @@
|
|
|
888
771
|
if (!Array.isArray(order) || !order.length) {
|
|
889
772
|
return properties;
|
|
890
773
|
}
|
|
891
|
-
|
|
892
774
|
var arrayToHash = function arrayToHash(arr) {
|
|
893
775
|
return arr.reduce(function (prev, curr) {
|
|
894
776
|
prev[curr] = true;
|
|
895
777
|
return prev;
|
|
896
778
|
}, {});
|
|
897
779
|
};
|
|
898
|
-
|
|
899
780
|
var errorPropList = function errorPropList(arr) {
|
|
900
781
|
return arr.length > 1 ? "properties '".concat(arr.join('\', \''), "'") : "property '".concat(arr[0], "'");
|
|
901
782
|
};
|
|
902
|
-
|
|
903
783
|
var propertyHash = arrayToHash(properties);
|
|
904
784
|
var orderFiltered = order.filter(function (prop) {
|
|
905
785
|
return prop === '*' || propertyHash[prop];
|
|
@@ -909,21 +789,16 @@
|
|
|
909
789
|
return !orderHash[prop];
|
|
910
790
|
});
|
|
911
791
|
var restIndex = orderFiltered.indexOf('*');
|
|
912
|
-
|
|
913
792
|
if (restIndex === -1) {
|
|
914
793
|
if (rest.length) {
|
|
915
794
|
throw new Error("uiSchema order list does not contain ".concat(errorPropList(rest)));
|
|
916
795
|
}
|
|
917
|
-
|
|
918
796
|
return orderFiltered;
|
|
919
797
|
}
|
|
920
|
-
|
|
921
798
|
if (restIndex !== orderFiltered.lastIndexOf('*')) {
|
|
922
799
|
throw new Error('uiSchema order list contains more than one wildcard item');
|
|
923
800
|
}
|
|
924
|
-
|
|
925
801
|
var complete = _toConsumableArray(orderFiltered);
|
|
926
|
-
|
|
927
802
|
complete.splice.apply(complete, [restIndex, 1].concat(_toConsumableArray(rest)));
|
|
928
803
|
return complete;
|
|
929
804
|
}
|
|
@@ -934,12 +809,13 @@
|
|
|
934
809
|
var Registry = /*#__PURE__*/function () {
|
|
935
810
|
function Registry() {
|
|
936
811
|
_classCallCheck(this, Registry);
|
|
937
|
-
|
|
812
|
+
// 基础类型控件
|
|
938
813
|
this.widgets = new Map();
|
|
814
|
+
// 自定义组件
|
|
939
815
|
this.components = new Map();
|
|
816
|
+
// 每种Schema type对于的处理器
|
|
940
817
|
this.fields = new Map();
|
|
941
818
|
}
|
|
942
|
-
|
|
943
819
|
_createClass(Registry, [{
|
|
944
820
|
key: "addComponentsMap",
|
|
945
821
|
value: function addComponentsMap() {
|
|
@@ -967,58 +843,51 @@
|
|
|
967
843
|
value: function addBaseWidgets() {
|
|
968
844
|
var widgets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
969
845
|
this.addMap('widgets', widgets);
|
|
970
|
-
}
|
|
971
|
-
|
|
846
|
+
}
|
|
847
|
+
// 获取基础控件
|
|
972
848
|
}, {
|
|
973
849
|
key: "getBaseWidget",
|
|
974
850
|
value: function getBaseWidget(name) {
|
|
975
851
|
if (this.widgets.has(name)) {
|
|
976
852
|
return this.widgets.get(name);
|
|
977
853
|
}
|
|
978
|
-
|
|
979
854
|
if (name && name.indexOf(Registry.namespace) !== 0) {
|
|
980
855
|
return "".concat(Registry.namespace, "-").concat(name);
|
|
981
856
|
}
|
|
982
|
-
|
|
983
857
|
return name;
|
|
984
858
|
}
|
|
985
859
|
}, {
|
|
986
860
|
key: "addMap",
|
|
987
861
|
value: function addMap(props, map) {
|
|
988
862
|
var _this = this;
|
|
989
|
-
|
|
990
863
|
if (!props || !map) return;
|
|
991
864
|
Object.entries(map).forEach(function (_ref) {
|
|
992
865
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
866
|
+
key = _ref2[0],
|
|
867
|
+
value = _ref2[1];
|
|
996
868
|
if (_this[props].has(key)) {
|
|
997
869
|
console.warn('repeat key', key);
|
|
998
870
|
return;
|
|
999
871
|
}
|
|
1000
|
-
|
|
1001
872
|
_this[props].set(key, value);
|
|
1002
873
|
});
|
|
1003
874
|
}
|
|
1004
875
|
}]);
|
|
1005
|
-
|
|
1006
876
|
return Registry;
|
|
1007
877
|
}();
|
|
878
|
+
// 全局命名空间
|
|
1008
879
|
Registry.namespace = 'bk';
|
|
880
|
+
// 全局上下
|
|
1009
881
|
Registry.context = {};
|
|
1010
882
|
var registry = new Registry();
|
|
1011
883
|
|
|
1012
884
|
var _excluded$6 = ["name"],
|
|
1013
|
-
|
|
1014
|
-
|
|
885
|
+
_excluded2$1 = ["name"];
|
|
1015
886
|
var Schema = /*#__PURE__*/function () {
|
|
1016
887
|
function Schema(rootSchema) {
|
|
1017
888
|
_classCallCheck(this, Schema);
|
|
1018
|
-
|
|
1019
889
|
Schema.rootSchema = rootSchema;
|
|
1020
890
|
}
|
|
1021
|
-
|
|
1022
891
|
_createClass(Schema, null, [{
|
|
1023
892
|
key: "resolveRef",
|
|
1024
893
|
value: function resolveRef() {}
|
|
@@ -1032,65 +901,50 @@
|
|
|
1032
901
|
key: "resolveSchema",
|
|
1033
902
|
value: function resolveSchema(schema) {
|
|
1034
903
|
if (!isObj(schema)) return {};
|
|
1035
|
-
|
|
1036
904
|
if (hasOwnProperty(schema, 'allOf')) ;
|
|
1037
|
-
|
|
1038
905
|
if (hasOwnProperty(schema, '$ref')) ;
|
|
1039
|
-
|
|
1040
906
|
return schema;
|
|
1041
|
-
}
|
|
1042
|
-
|
|
907
|
+
}
|
|
908
|
+
// 获取Schema字段默认值
|
|
1043
909
|
}, {
|
|
1044
910
|
key: "getSchemaDefaultValue",
|
|
1045
911
|
value: function getSchemaDefaultValue(_schema) {
|
|
1046
912
|
var _this = this;
|
|
1047
|
-
|
|
1048
913
|
var schema = isObj(_schema) ? _schema : {};
|
|
1049
|
-
|
|
1050
914
|
switch (this.getSchemaType(schema)) {
|
|
1051
915
|
case 'null':
|
|
1052
916
|
return null;
|
|
1053
|
-
|
|
1054
917
|
case 'object':
|
|
1055
918
|
return Object.keys(schema.properties || {}).reduce(function (pre, key) {
|
|
1056
919
|
var _schema$properties;
|
|
1057
|
-
|
|
1058
920
|
var defaultValue = _this.getSchemaDefaultValue((_schema$properties = schema.properties) === null || _schema$properties === void 0 ? void 0 : _schema$properties[key]);
|
|
1059
|
-
|
|
1060
921
|
pre[key] = defaultValue;
|
|
1061
922
|
return pre;
|
|
1062
923
|
}, {});
|
|
1063
|
-
|
|
1064
924
|
case 'array':
|
|
1065
925
|
// todo
|
|
1066
926
|
if (schema.default && Array.isArray(schema.default)) {
|
|
1067
927
|
return schema.default;
|
|
1068
928
|
}
|
|
1069
|
-
|
|
1070
929
|
return Array.isArray(schema.items) ? schema.items.map(function (item) {
|
|
1071
930
|
return _this.getSchemaDefaultValue(item);
|
|
1072
931
|
}) : [];
|
|
1073
932
|
}
|
|
1074
|
-
|
|
1075
933
|
return schema.default !== undefined ? schema.default : initializationValue(schema.type || 'any');
|
|
1076
934
|
}
|
|
1077
935
|
}, {
|
|
1078
936
|
key: "getSchemaType",
|
|
1079
937
|
value: function getSchemaType(schema) {
|
|
1080
938
|
var type = schema.type;
|
|
1081
|
-
|
|
1082
939
|
if (!type && schema.const) {
|
|
1083
940
|
return valueType(schema.const);
|
|
1084
941
|
}
|
|
1085
|
-
|
|
1086
942
|
if (!type && schema.enum) {
|
|
1087
943
|
return 'string';
|
|
1088
944
|
}
|
|
1089
|
-
|
|
1090
945
|
if (!type && schema.items) {
|
|
1091
946
|
return 'array';
|
|
1092
947
|
}
|
|
1093
|
-
|
|
1094
948
|
return type;
|
|
1095
949
|
}
|
|
1096
950
|
}, {
|
|
@@ -1099,22 +953,18 @@
|
|
|
1099
953
|
if (!props || !props.startsWith('ui:')) {
|
|
1100
954
|
console.warn('ui props must start with ui:');
|
|
1101
955
|
}
|
|
1102
|
-
|
|
1103
956
|
return schema[props] || {};
|
|
1104
957
|
}
|
|
1105
958
|
}, {
|
|
1106
959
|
key: "getSchemaField",
|
|
1107
960
|
value: function getSchemaField(schema) {
|
|
1108
961
|
var _schema$oneOf, _schema$anyOf;
|
|
1109
|
-
|
|
1110
962
|
// 自定义Field组件
|
|
1111
963
|
var field = schema['ui:field'];
|
|
1112
|
-
|
|
1113
964
|
if (field) {
|
|
1114
965
|
return field;
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
|
|
966
|
+
}
|
|
967
|
+
// oneOf field
|
|
1118
968
|
if ((_schema$oneOf = schema.oneOf) !== null && _schema$oneOf !== void 0 && _schema$oneOf.length) {
|
|
1119
969
|
return {
|
|
1120
970
|
name: registry.getField('composition'),
|
|
@@ -1122,9 +972,8 @@
|
|
|
1122
972
|
composition: 'oneOf'
|
|
1123
973
|
}
|
|
1124
974
|
};
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
|
|
975
|
+
}
|
|
976
|
+
// anyOf field
|
|
1128
977
|
if ((_schema$anyOf = schema.anyOf) !== null && _schema$anyOf !== void 0 && _schema$anyOf.length) {
|
|
1129
978
|
return {
|
|
1130
979
|
name: registry.getField('composition'),
|
|
@@ -1132,17 +981,14 @@
|
|
|
1132
981
|
composition: 'anyOf'
|
|
1133
982
|
}
|
|
1134
983
|
};
|
|
1135
|
-
}
|
|
1136
|
-
|
|
1137
|
-
|
|
984
|
+
}
|
|
985
|
+
// default field
|
|
1138
986
|
var defaultField = registry.getField(this.getSchemaType(schema));
|
|
1139
|
-
|
|
1140
987
|
if (defaultField) {
|
|
1141
988
|
return {
|
|
1142
989
|
name: defaultField
|
|
1143
990
|
};
|
|
1144
991
|
}
|
|
1145
|
-
|
|
1146
992
|
return {
|
|
1147
993
|
name: null
|
|
1148
994
|
};
|
|
@@ -1153,24 +999,21 @@
|
|
|
1153
999
|
if (!schema.uniqueItems || !schema.items) {
|
|
1154
1000
|
return false;
|
|
1155
1001
|
}
|
|
1156
|
-
|
|
1157
1002
|
return Array.isArray(schema.items.enum);
|
|
1158
1003
|
}
|
|
1159
1004
|
}, {
|
|
1160
1005
|
key: "isTupleArray",
|
|
1161
1006
|
value: function isTupleArray(schema) {
|
|
1162
1007
|
var _schema$items;
|
|
1163
|
-
|
|
1164
1008
|
return Array.isArray(schema.items) && ((_schema$items = schema.items) === null || _schema$items === void 0 ? void 0 : _schema$items.length) > 0 && schema.items.every(function (item) {
|
|
1165
1009
|
return isObj(item);
|
|
1166
1010
|
});
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1011
|
+
}
|
|
1012
|
+
// 是否是自定义数组类型控件(如:label)
|
|
1169
1013
|
}, {
|
|
1170
1014
|
key: "isCustomArrayWidget",
|
|
1171
1015
|
value: function isCustomArrayWidget(schema) {
|
|
1172
1016
|
var _schema$uiComponent;
|
|
1173
|
-
|
|
1174
1017
|
var com = (_schema$uiComponent = schema['ui:component']) === null || _schema$uiComponent === void 0 ? void 0 : _schema$uiComponent.name;
|
|
1175
1018
|
return schema.type === 'array' && com;
|
|
1176
1019
|
}
|
|
@@ -1178,9 +1021,8 @@
|
|
|
1178
1021
|
key: "getGroupWrap",
|
|
1179
1022
|
value: function getGroupWrap(schema) {
|
|
1180
1023
|
var _ref = schema['ui:group'] || {},
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1024
|
+
name = _ref.name,
|
|
1025
|
+
groupVnode = _objectWithoutProperties(_ref, _excluded$6);
|
|
1184
1026
|
return _objectSpread2(_objectSpread2({}, groupVnode), {}, {
|
|
1185
1027
|
name: registry.getComponent(name) || name || registry.getComponent('group')
|
|
1186
1028
|
});
|
|
@@ -1189,9 +1031,8 @@
|
|
|
1189
1031
|
key: "getUiComponent",
|
|
1190
1032
|
value: function getUiComponent(schema) {
|
|
1191
1033
|
var _ref2 = schema['ui:component'] || {},
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1034
|
+
name = _ref2.name,
|
|
1035
|
+
vnodeData = _objectWithoutProperties(_ref2, _excluded2$1);
|
|
1195
1036
|
return _objectSpread2({
|
|
1196
1037
|
name: registry.getComponent(name) || name
|
|
1197
1038
|
}, vnodeData);
|
|
@@ -1200,21 +1041,17 @@
|
|
|
1200
1041
|
key: "getDefaultWidget",
|
|
1201
1042
|
value: function getDefaultWidget(schema) {
|
|
1202
1043
|
var _schema$oneOf2, _schema$oneOf3, _schema$anyOf2, _schema$anyOf3;
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1044
|
+
var type = this.getSchemaType(schema);
|
|
1045
|
+
// 默认转换策略
|
|
1206
1046
|
var defaultComponent = null;
|
|
1207
|
-
|
|
1208
1047
|
if (type === 'string' && Array.isArray(schema.enum)) {
|
|
1209
1048
|
// string类型的枚举数据默认用select组件
|
|
1210
1049
|
defaultComponent = registry.getComponent('select');
|
|
1211
1050
|
}
|
|
1212
|
-
|
|
1213
1051
|
if (type === 'array' && Schema.isMultiSelect(schema)) {
|
|
1214
1052
|
// array类型多选默认用checkbox组件
|
|
1215
1053
|
defaultComponent = registry.getComponent('checkbox');
|
|
1216
1054
|
}
|
|
1217
|
-
|
|
1218
1055
|
if (_typeof(type) !== 'object' && ((_schema$oneOf2 = schema.oneOf) !== null && _schema$oneOf2 !== void 0 && _schema$oneOf2.length && (_schema$oneOf3 = schema.oneOf) !== null && _schema$oneOf3 !== void 0 && _schema$oneOf3.every(function (item) {
|
|
1219
1056
|
return item.const;
|
|
1220
1057
|
}) || (_schema$anyOf2 = schema.anyOf) !== null && _schema$anyOf2 !== void 0 && _schema$anyOf2.length && (_schema$anyOf3 = schema.anyOf) !== null && _schema$anyOf3 !== void 0 && _schema$anyOf3.every(function (item) {
|
|
@@ -1222,12 +1059,10 @@
|
|
|
1222
1059
|
}))) {
|
|
1223
1060
|
defaultComponent = registry.getComponent('select');
|
|
1224
1061
|
}
|
|
1225
|
-
|
|
1226
1062
|
if (defaultComponent) {
|
|
1227
1063
|
return defaultComponent;
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
|
|
1064
|
+
}
|
|
1065
|
+
// 找不到对应组件就使用默认type对应的widget
|
|
1231
1066
|
var typeComponentMap = {
|
|
1232
1067
|
string: 'input',
|
|
1233
1068
|
number: 'input',
|
|
@@ -1237,11 +1072,9 @@
|
|
|
1237
1072
|
};
|
|
1238
1073
|
var name = typeComponentMap[type];
|
|
1239
1074
|
var defaultWidget = registry.getComponent(name) || registry.getBaseWidget(name);
|
|
1240
|
-
|
|
1241
1075
|
if (defaultWidget) {
|
|
1242
1076
|
return defaultWidget;
|
|
1243
1077
|
}
|
|
1244
|
-
|
|
1245
1078
|
console.warn("\u672A\u6CE8\u518C\u7C7B\u578B".concat(type, "\u5BF9\u5E94\u7684\u9ED8\u8BA4\u8868\u5355\u9879"));
|
|
1246
1079
|
return null;
|
|
1247
1080
|
}
|
|
@@ -1260,13 +1093,12 @@
|
|
|
1260
1093
|
minLength: schema.minLength,
|
|
1261
1094
|
maxLength: schema.maxLength
|
|
1262
1095
|
}, schema['ui:props'] || {});
|
|
1263
|
-
|
|
1264
1096
|
return _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1265
1097
|
// 0.1 兼容formItem设置 labelWidth 0 不生效问题
|
|
1266
1098
|
labelWidth: options.showTitle ? options.labelWidth : 0.1
|
|
1267
1099
|
});
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1100
|
+
}
|
|
1101
|
+
// 当前属性是否被依赖
|
|
1270
1102
|
}, {
|
|
1271
1103
|
key: "getDependencies",
|
|
1272
1104
|
value: function getDependencies(schema, name) {
|
|
@@ -1278,11 +1110,9 @@
|
|
|
1278
1110
|
key: "resolveDefaultDatasource",
|
|
1279
1111
|
value: function resolveDefaultDatasource(schema) {
|
|
1280
1112
|
var _schema$uiComponent2, _schema$uiComponent2$, _schema$items2;
|
|
1281
|
-
|
|
1282
1113
|
if ((_schema$uiComponent2 = schema['ui:component']) !== null && _schema$uiComponent2 !== void 0 && (_schema$uiComponent2$ = _schema$uiComponent2.props) !== null && _schema$uiComponent2$ !== void 0 && _schema$uiComponent2$.datasource) {
|
|
1283
1114
|
return schema['ui:component'].props.datasource;
|
|
1284
1115
|
}
|
|
1285
|
-
|
|
1286
1116
|
if (Array.isArray(schema.enum)) {
|
|
1287
1117
|
var data = schema.enum;
|
|
1288
1118
|
return data.map(function (value) {
|
|
@@ -1292,10 +1122,8 @@
|
|
|
1292
1122
|
};
|
|
1293
1123
|
});
|
|
1294
1124
|
}
|
|
1295
|
-
|
|
1296
1125
|
if (Array.isArray((_schema$items2 = schema.items) === null || _schema$items2 === void 0 ? void 0 : _schema$items2.enum)) {
|
|
1297
1126
|
var _data = schema.items.enum || [];
|
|
1298
|
-
|
|
1299
1127
|
return _data.map(function (value) {
|
|
1300
1128
|
return {
|
|
1301
1129
|
value: value,
|
|
@@ -1303,7 +1131,6 @@
|
|
|
1303
1131
|
};
|
|
1304
1132
|
});
|
|
1305
1133
|
}
|
|
1306
|
-
|
|
1307
1134
|
if (_typeof(schema.type) !== 'object' && schema.oneOf && schema.oneOf.every(function (item) {
|
|
1308
1135
|
return item.const;
|
|
1309
1136
|
})) {
|
|
@@ -1313,10 +1140,8 @@
|
|
|
1313
1140
|
label: item.title || item.const
|
|
1314
1141
|
};
|
|
1315
1142
|
});
|
|
1316
|
-
|
|
1317
1143
|
return _data2;
|
|
1318
1144
|
}
|
|
1319
|
-
|
|
1320
1145
|
if (_typeof(schema.type) !== 'object' && schema.anyOf && schema.anyOf.every(function (item) {
|
|
1321
1146
|
return item.const;
|
|
1322
1147
|
})) {
|
|
@@ -1326,26 +1151,20 @@
|
|
|
1326
1151
|
label: item.title || item.const
|
|
1327
1152
|
};
|
|
1328
1153
|
});
|
|
1329
|
-
|
|
1330
1154
|
return _data3;
|
|
1331
1155
|
}
|
|
1332
1156
|
}
|
|
1333
1157
|
}]);
|
|
1334
|
-
|
|
1335
1158
|
return Schema;
|
|
1336
1159
|
}();
|
|
1337
|
-
|
|
1338
1160
|
Schema.rootSchema = void 0;
|
|
1339
1161
|
|
|
1340
1162
|
// 布局管理器
|
|
1341
1163
|
var Layout = /*#__PURE__*/function () {
|
|
1342
1164
|
function Layout() {
|
|
1343
1165
|
var layout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1344
|
-
|
|
1345
1166
|
_classCallCheck(this, Layout);
|
|
1346
|
-
|
|
1347
1167
|
this.layout = void 0;
|
|
1348
|
-
|
|
1349
1168
|
if (Array.isArray(layout)) {
|
|
1350
1169
|
this.layout = this.parseLayout({
|
|
1351
1170
|
prop: '',
|
|
@@ -1355,21 +1174,18 @@
|
|
|
1355
1174
|
this.layout = this.parseLayout(layout);
|
|
1356
1175
|
}
|
|
1357
1176
|
}
|
|
1358
|
-
|
|
1359
1177
|
_createClass(Layout, [{
|
|
1360
1178
|
key: "transformValueToPixel",
|
|
1361
1179
|
value: function transformValueToPixel(value) {
|
|
1362
1180
|
if (typeof value === 'number') {
|
|
1363
1181
|
return "".concat(value, "px");
|
|
1364
1182
|
}
|
|
1365
|
-
|
|
1366
1183
|
return value;
|
|
1367
1184
|
}
|
|
1368
1185
|
}, {
|
|
1369
1186
|
key: "parseLayout",
|
|
1370
1187
|
value: function parseLayout(config) {
|
|
1371
1188
|
var _this = this;
|
|
1372
|
-
|
|
1373
1189
|
var dim = this.getLayoutDimension(config.group);
|
|
1374
1190
|
var gridTemplate = this.parseGridTemplate(dim);
|
|
1375
1191
|
var group = (config.group || []).map(function (current) {
|
|
@@ -1377,7 +1193,6 @@
|
|
|
1377
1193
|
console.error("layout ".concat(JSON.stringify(current), " error, must be a array"));
|
|
1378
1194
|
return [];
|
|
1379
1195
|
}
|
|
1380
|
-
|
|
1381
1196
|
var parseCurrent = current.map(function (item) {
|
|
1382
1197
|
if (typeof item === 'string' || typeof item === 'number') {
|
|
1383
1198
|
return {
|
|
@@ -1388,11 +1203,9 @@
|
|
|
1388
1203
|
}
|
|
1389
1204
|
};
|
|
1390
1205
|
}
|
|
1391
|
-
|
|
1392
1206
|
if (_typeof(item) === 'object' && Reflect.has(item, 'group')) {
|
|
1393
1207
|
return _this.parseLayout(item);
|
|
1394
1208
|
}
|
|
1395
|
-
|
|
1396
1209
|
return item;
|
|
1397
1210
|
});
|
|
1398
1211
|
return parseCurrent;
|
|
@@ -1421,11 +1234,9 @@
|
|
|
1421
1234
|
if (!Array.isArray(current)) {
|
|
1422
1235
|
console.error("layout ".concat(JSON.stringify(current), " error, must be a array"));
|
|
1423
1236
|
}
|
|
1424
|
-
|
|
1425
1237
|
if (current) {
|
|
1426
1238
|
pre.columns = Math.max(pre.columns, current.length || 0);
|
|
1427
1239
|
}
|
|
1428
|
-
|
|
1429
1240
|
pre.rows += 1;
|
|
1430
1241
|
return pre;
|
|
1431
1242
|
}, {
|
|
@@ -1445,15 +1256,13 @@
|
|
|
1445
1256
|
key: "parseGridTemplateAreas",
|
|
1446
1257
|
value: function parseGridTemplateAreas(gridTemplate, group) {
|
|
1447
1258
|
var _this2 = this;
|
|
1448
|
-
|
|
1449
1259
|
return group.reduce(function (area, rows) {
|
|
1450
1260
|
var newRows = _this2.autoFillColumns(rows, gridTemplate.columns);
|
|
1451
|
-
|
|
1452
1261
|
area.push("\"".concat(newRows.join(' '), "\""));
|
|
1453
1262
|
return area;
|
|
1454
1263
|
}, []).join('\n');
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1264
|
+
}
|
|
1265
|
+
// 当前列数不够时自动填充
|
|
1457
1266
|
}, {
|
|
1458
1267
|
key: "autoFillColumns",
|
|
1459
1268
|
value: function autoFillColumns(rows, maxColumns) {
|
|
@@ -1462,21 +1271,19 @@
|
|
|
1462
1271
|
return rows.map(function (row) {
|
|
1463
1272
|
return row.prop;
|
|
1464
1273
|
});
|
|
1465
|
-
}
|
|
1466
|
-
|
|
1467
|
-
|
|
1274
|
+
}
|
|
1275
|
+
// 均分补全的列
|
|
1468
1276
|
var fillLen = Math.floor((maxColumns - rows.length) / rows.length);
|
|
1469
1277
|
var newRows = rows.reduce(function (pre, row) {
|
|
1470
1278
|
pre.push(row.prop);
|
|
1471
1279
|
var fillData = new Array(fillLen).fill(row.prop);
|
|
1472
1280
|
return pre.concat(fillData);
|
|
1473
|
-
}, []);
|
|
1474
|
-
|
|
1281
|
+
}, []);
|
|
1282
|
+
// todo: 补全不够均分的列
|
|
1475
1283
|
if (newRows.length < maxColumns) {
|
|
1476
1284
|
var remainData = new Array(maxColumns - newRows.length).fill('.');
|
|
1477
1285
|
return newRows.concat(remainData);
|
|
1478
1286
|
}
|
|
1479
|
-
|
|
1480
1287
|
return newRows;
|
|
1481
1288
|
}
|
|
1482
1289
|
}, {
|
|
@@ -1498,7 +1305,6 @@
|
|
|
1498
1305
|
return layoutConfig;
|
|
1499
1306
|
}
|
|
1500
1307
|
}]);
|
|
1501
|
-
|
|
1502
1308
|
return Layout;
|
|
1503
1309
|
}();
|
|
1504
1310
|
|
|
@@ -1508,7 +1314,6 @@
|
|
|
1508
1314
|
if (typeof target[key] === 'function') {
|
|
1509
1315
|
return target[key].apply(context);
|
|
1510
1316
|
}
|
|
1511
|
-
|
|
1512
1317
|
return Reflect.get(target, key, receiver);
|
|
1513
1318
|
}
|
|
1514
1319
|
});
|
|
@@ -1518,7 +1323,6 @@
|
|
|
1518
1323
|
function Path() {
|
|
1519
1324
|
_classCallCheck(this, Path);
|
|
1520
1325
|
}
|
|
1521
|
-
|
|
1522
1326
|
_createClass(Path, null, [{
|
|
1523
1327
|
key: "getCurPath",
|
|
1524
1328
|
value: function getCurPath(parent, current) {
|
|
@@ -1530,12 +1334,10 @@
|
|
|
1530
1334
|
var leftDeviation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1531
1335
|
if (!path) return obj;
|
|
1532
1336
|
var pathArr = path.split(this.separator);
|
|
1533
|
-
|
|
1534
1337
|
for (var i = 0; i < pathArr.length - leftDeviation; i += 1) {
|
|
1535
1338
|
if (obj === undefined) return undefined;
|
|
1536
1339
|
obj = pathArr[i] === '' ? obj : obj[pathArr[i]];
|
|
1537
1340
|
}
|
|
1538
|
-
|
|
1539
1341
|
return obj;
|
|
1540
1342
|
}
|
|
1541
1343
|
}, {
|
|
@@ -1554,25 +1356,24 @@
|
|
|
1554
1356
|
});
|
|
1555
1357
|
target[lastProp] = value;
|
|
1556
1358
|
return newValue;
|
|
1557
|
-
}
|
|
1558
|
-
|
|
1359
|
+
}
|
|
1360
|
+
// 获取当前路径的字路径(相对于父路径)
|
|
1559
1361
|
}, {
|
|
1560
1362
|
key: "getSubPath",
|
|
1561
1363
|
value: function getSubPath(parent, current) {
|
|
1562
1364
|
return current.replace("".concat(parent, "."), '');
|
|
1563
|
-
}
|
|
1564
|
-
|
|
1365
|
+
}
|
|
1366
|
+
// 获取路径最后一个属性
|
|
1565
1367
|
}, {
|
|
1566
1368
|
key: "getPathLastProp",
|
|
1567
1369
|
value: function getPathLastProp(path) {
|
|
1568
1370
|
return path.split(this.separator).pop();
|
|
1569
|
-
}
|
|
1570
|
-
|
|
1371
|
+
}
|
|
1372
|
+
// 获取父路径
|
|
1571
1373
|
}, {
|
|
1572
1374
|
key: "getParentPath",
|
|
1573
1375
|
value: function getParentPath(path) {
|
|
1574
1376
|
var arrPath = path.split(this.separator);
|
|
1575
|
-
|
|
1576
1377
|
if (arrPath.length <= 1) {
|
|
1577
1378
|
return ''; // root path
|
|
1578
1379
|
}
|
|
@@ -1580,10 +1381,8 @@
|
|
|
1580
1381
|
return arrPath.slice(0, arrPath.length - 1).join(this.separator);
|
|
1581
1382
|
}
|
|
1582
1383
|
}]);
|
|
1583
|
-
|
|
1584
1384
|
return Path;
|
|
1585
1385
|
}();
|
|
1586
|
-
|
|
1587
1386
|
Path.separator = '.';
|
|
1588
1387
|
|
|
1589
1388
|
var _excluded$5 = ["params", "responseType", "method", "headers", "responseParse"];
|
|
@@ -1598,134 +1397,110 @@
|
|
|
1598
1397
|
var request = /*#__PURE__*/(function () {
|
|
1599
1398
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
|
|
1600
1399
|
var config,
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1400
|
+
_mergeDeep,
|
|
1401
|
+
params,
|
|
1402
|
+
_mergeDeep$responseTy,
|
|
1403
|
+
responseType,
|
|
1404
|
+
_mergeDeep$method,
|
|
1405
|
+
method,
|
|
1406
|
+
_mergeDeep$headers,
|
|
1407
|
+
headers,
|
|
1408
|
+
responseParse,
|
|
1409
|
+
reset,
|
|
1410
|
+
body,
|
|
1411
|
+
requestURL,
|
|
1412
|
+
response,
|
|
1413
|
+
res,
|
|
1414
|
+
_responseParse$dataKe,
|
|
1415
|
+
dataKey,
|
|
1416
|
+
labelKey,
|
|
1417
|
+
valueKey,
|
|
1418
|
+
data,
|
|
1419
|
+
_args = arguments;
|
|
1622
1420
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1623
|
-
while (1) {
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1421
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1422
|
+
case 0:
|
|
1423
|
+
config = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
1424
|
+
_mergeDeep = mergeDeep(defaultConfig, config), params = _mergeDeep.params, _mergeDeep$responseTy = _mergeDeep.responseType, responseType = _mergeDeep$responseTy === void 0 ? 'json' : _mergeDeep$responseTy, _mergeDeep$method = _mergeDeep.method, method = _mergeDeep$method === void 0 ? 'GET' : _mergeDeep$method, _mergeDeep$headers = _mergeDeep.headers, headers = _mergeDeep$headers === void 0 ? {} : _mergeDeep$headers, responseParse = _mergeDeep.responseParse, reset = _objectWithoutProperties(_mergeDeep, _excluded$5);
|
|
1425
|
+
requestURL = url; // 处理参数
|
|
1426
|
+
if (methodsWithoutData.includes(method.toUpperCase())) {
|
|
1427
|
+
requestURL = "".concat(requestURL, "?").concat(isObj(params) ? new URLSearchParams(params) : params || '');
|
|
1428
|
+
} else {
|
|
1429
|
+
if (isObj(params)) {
|
|
1430
|
+
// 处理JSON类型的请求
|
|
1431
|
+
headers['Content-Type'] = 'application/json;charset=utf-8';
|
|
1432
|
+
body = JSON.stringify(params);
|
|
1632
1433
|
} else {
|
|
1633
|
-
|
|
1634
|
-
// 处理JSON类型的请求
|
|
1635
|
-
headers['Content-Type'] = 'application/json;charset=utf-8';
|
|
1636
|
-
body = JSON.stringify(params);
|
|
1637
|
-
} else {
|
|
1638
|
-
body = params;
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
|
-
_context.prev = 4;
|
|
1643
|
-
_context.next = 7;
|
|
1644
|
-
return fetch(requestURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
1645
|
-
method: method.toLocaleUpperCase(),
|
|
1646
|
-
headers: headers,
|
|
1647
|
-
body: body
|
|
1648
|
-
}));
|
|
1649
|
-
|
|
1650
|
-
case 7:
|
|
1651
|
-
response = _context.sent;
|
|
1652
|
-
|
|
1653
|
-
if (!response.ok) {
|
|
1654
|
-
_context.next = 21;
|
|
1655
|
-
break;
|
|
1434
|
+
body = params;
|
|
1656
1435
|
}
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
if (!(typeof responseParse === 'function')) {
|
|
1670
|
-
_context.next = 15;
|
|
1671
|
-
break;
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
return _context.abrupt("return", Promise.resolve(responseParse(res)));
|
|
1675
|
-
|
|
1676
|
-
case 15:
|
|
1677
|
-
if (!isObj(responseParse)) {
|
|
1678
|
-
_context.next = 19;
|
|
1679
|
-
break;
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
_responseParse$dataKe = responseParse.dataKey, dataKey = _responseParse$dataKe === void 0 ? 'data' : _responseParse$dataKe, labelKey = responseParse.labelKey, valueKey = responseParse.valueKey;
|
|
1683
|
-
data = ((res === null || res === void 0 ? void 0 : res[dataKey]) || []).map(function (item) {
|
|
1684
|
-
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
1685
|
-
label: item === null || item === void 0 ? void 0 : item[labelKey],
|
|
1686
|
-
value: item === null || item === void 0 ? void 0 : item[valueKey]
|
|
1687
|
-
});
|
|
1688
|
-
});
|
|
1689
|
-
return _context.abrupt("return", Promise.resolve(data));
|
|
1690
|
-
|
|
1691
|
-
case 19:
|
|
1692
|
-
return _context.abrupt("return", Promise.resolve(res));
|
|
1693
|
-
|
|
1694
|
-
case 20:
|
|
1695
|
-
return _context.abrupt("return", Promise.resolve(res));
|
|
1696
|
-
|
|
1697
|
-
case 21:
|
|
1698
|
-
_context.t0 = response.status;
|
|
1699
|
-
_context.next = _context.t0 === 400 ? 24 : _context.t0 === 401 ? 25 : _context.t0 === 403 ? 26 : _context.t0 === 500 ? 26 : 27;
|
|
1436
|
+
}
|
|
1437
|
+
_context.prev = 4;
|
|
1438
|
+
_context.next = 7;
|
|
1439
|
+
return fetch(requestURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
1440
|
+
method: method.toLocaleUpperCase(),
|
|
1441
|
+
headers: headers,
|
|
1442
|
+
body: body
|
|
1443
|
+
}));
|
|
1444
|
+
case 7:
|
|
1445
|
+
response = _context.sent;
|
|
1446
|
+
if (!response.ok) {
|
|
1447
|
+
_context.next = 21;
|
|
1700
1448
|
break;
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
case 26:
|
|
1709
|
-
return _context.abrupt("break", 27);
|
|
1710
|
-
|
|
1711
|
-
case 27:
|
|
1712
|
-
_context.next = 33;
|
|
1449
|
+
}
|
|
1450
|
+
_context.next = 11;
|
|
1451
|
+
return response[responseType]();
|
|
1452
|
+
case 11:
|
|
1453
|
+
res = _context.sent;
|
|
1454
|
+
if (!responseParse) {
|
|
1455
|
+
_context.next = 20;
|
|
1713
1456
|
break;
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
_context.
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1457
|
+
}
|
|
1458
|
+
if (!(typeof responseParse === 'function')) {
|
|
1459
|
+
_context.next = 15;
|
|
1460
|
+
break;
|
|
1461
|
+
}
|
|
1462
|
+
return _context.abrupt("return", Promise.resolve(responseParse(res)));
|
|
1463
|
+
case 15:
|
|
1464
|
+
if (!isObj(responseParse)) {
|
|
1465
|
+
_context.next = 19;
|
|
1466
|
+
break;
|
|
1467
|
+
}
|
|
1468
|
+
_responseParse$dataKe = responseParse.dataKey, dataKey = _responseParse$dataKe === void 0 ? 'data' : _responseParse$dataKe, labelKey = responseParse.labelKey, valueKey = responseParse.valueKey;
|
|
1469
|
+
data = ((res === null || res === void 0 ? void 0 : res[dataKey]) || []).map(function (item) {
|
|
1470
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
1471
|
+
label: item === null || item === void 0 ? void 0 : item[labelKey],
|
|
1472
|
+
value: item === null || item === void 0 ? void 0 : item[valueKey]
|
|
1473
|
+
});
|
|
1474
|
+
});
|
|
1475
|
+
return _context.abrupt("return", Promise.resolve(data));
|
|
1476
|
+
case 19:
|
|
1477
|
+
return _context.abrupt("return", Promise.resolve(res));
|
|
1478
|
+
case 20:
|
|
1479
|
+
return _context.abrupt("return", Promise.resolve(res));
|
|
1480
|
+
case 21:
|
|
1481
|
+
_context.t0 = response.status;
|
|
1482
|
+
_context.next = _context.t0 === 400 ? 24 : _context.t0 === 401 ? 25 : _context.t0 === 403 ? 26 : _context.t0 === 500 ? 26 : 27;
|
|
1483
|
+
break;
|
|
1484
|
+
case 24:
|
|
1485
|
+
return _context.abrupt("break", 27);
|
|
1486
|
+
case 25:
|
|
1487
|
+
return _context.abrupt("break", 27);
|
|
1488
|
+
case 26:
|
|
1489
|
+
return _context.abrupt("break", 27);
|
|
1490
|
+
case 27:
|
|
1491
|
+
_context.next = 33;
|
|
1492
|
+
break;
|
|
1493
|
+
case 29:
|
|
1494
|
+
_context.prev = 29;
|
|
1495
|
+
_context.t1 = _context["catch"](4);
|
|
1496
|
+
console.error('Request Failed', _context.t1);
|
|
1497
|
+
Promise.reject(_context.t1);
|
|
1498
|
+
case 33:
|
|
1499
|
+
case "end":
|
|
1500
|
+
return _context.stop();
|
|
1725
1501
|
}
|
|
1726
1502
|
}, _callee, null, [[4, 29]]);
|
|
1727
1503
|
}));
|
|
1728
|
-
|
|
1729
1504
|
return function (_x) {
|
|
1730
1505
|
return _ref.apply(this, arguments);
|
|
1731
1506
|
};
|
|
@@ -1788,10 +1563,10 @@
|
|
|
1788
1563
|
// valueKey: 'value',
|
|
1789
1564
|
// labelKey: 'label',
|
|
1790
1565
|
// }, // 也可以是对像形式
|
|
1791
|
-
|
|
1792
1566
|
};
|
|
1793
1567
|
}
|
|
1794
1568
|
},
|
|
1569
|
+
|
|
1795
1570
|
readonly: {
|
|
1796
1571
|
type: Boolean,
|
|
1797
1572
|
default: false
|
|
@@ -1871,10 +1646,10 @@
|
|
|
1871
1646
|
// valueKey: 'value',
|
|
1872
1647
|
// labelKey: 'label',
|
|
1873
1648
|
// }, // 也可以是对像形式
|
|
1874
|
-
|
|
1875
1649
|
};
|
|
1876
1650
|
}
|
|
1877
1651
|
},
|
|
1652
|
+
|
|
1878
1653
|
visible: {
|
|
1879
1654
|
type: Boolean,
|
|
1880
1655
|
default: true
|
|
@@ -1906,16 +1681,14 @@
|
|
|
1906
1681
|
props: props,
|
|
1907
1682
|
render: function render(h, ctx) {
|
|
1908
1683
|
var _ctx$props = ctx.props,
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1684
|
+
schema = _ctx$props.schema,
|
|
1685
|
+
rootData = _ctx$props.rootData,
|
|
1686
|
+
path = _ctx$props.path;
|
|
1912
1687
|
var resolveSchema = Schema.resolveSchema(schema);
|
|
1913
1688
|
if (!Object.keys(schema).length) return h();
|
|
1914
|
-
|
|
1915
1689
|
var _Schema$getSchemaFiel = Schema.getSchemaField(resolveSchema),
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1690
|
+
name = _Schema$getSchemaFiel.name,
|
|
1691
|
+
fieldProps = _Schema$getSchemaFiel.props;
|
|
1919
1692
|
return name ? h(name, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
|
|
1920
1693
|
props: _objectSpread2(_objectSpread2(_objectSpread2({}, fieldProps), ctx.props), {}, {
|
|
1921
1694
|
value: Path.getPathVal(rootData, path),
|
|
@@ -1926,14 +1699,14 @@
|
|
|
1926
1699
|
});
|
|
1927
1700
|
|
|
1928
1701
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1929
|
-
|
|
1702
|
+
// 组件对外暴露的上下文
|
|
1930
1703
|
var getContext = function getContext(instance) {
|
|
1931
1704
|
var context = instance.context,
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1705
|
+
loadDataSource = instance.loadDataSource,
|
|
1706
|
+
validate = instance.validate,
|
|
1707
|
+
schema = instance.schema,
|
|
1708
|
+
rootData = instance.rootData,
|
|
1709
|
+
widgetNode = instance.widgetNode;
|
|
1937
1710
|
return {
|
|
1938
1711
|
$self: instance,
|
|
1939
1712
|
$context: context,
|
|
@@ -1947,17 +1720,15 @@
|
|
|
1947
1720
|
};
|
|
1948
1721
|
var executeExpression = function executeExpression(expression, instance) {
|
|
1949
1722
|
var $dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1950
|
-
|
|
1951
1723
|
var _getContext = getContext(instance),
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1724
|
+
$self = _getContext.$self,
|
|
1725
|
+
$context = _getContext.$context,
|
|
1726
|
+
$schema = _getContext.$schema,
|
|
1727
|
+
$rules = _getContext.$rules,
|
|
1728
|
+
$loadDataSource = _getContext.$loadDataSource,
|
|
1729
|
+
$validate = _getContext.$validate,
|
|
1730
|
+
$rootData = _getContext.$rootData,
|
|
1731
|
+
$widgetNode = _getContext.$widgetNode;
|
|
1961
1732
|
var context = {
|
|
1962
1733
|
$self: $self,
|
|
1963
1734
|
$context: $context,
|
|
@@ -1969,23 +1740,20 @@
|
|
|
1969
1740
|
$widgetNode: $widgetNode,
|
|
1970
1741
|
$dep: $dep
|
|
1971
1742
|
};
|
|
1972
|
-
|
|
1973
1743
|
if (typeof expression === 'string') {
|
|
1974
1744
|
if (!/^{{.+}}$/.test(expression.trim())) return expression;
|
|
1975
1745
|
var expStr = expression.trim().replace(/(^{{)|(}}$)/g, '').trim();
|
|
1976
1746
|
var innerFuncs = ['$loadDataSource', '$validate'];
|
|
1977
|
-
|
|
1978
1747
|
var func = function func(_ref) {
|
|
1979
1748
|
_ref.$self;
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1749
|
+
_ref.$context;
|
|
1750
|
+
_ref.$schema;
|
|
1751
|
+
_ref.$rules;
|
|
1752
|
+
_ref.$loadDataSource;
|
|
1753
|
+
_ref.$validate;
|
|
1754
|
+
_ref.$rootData;
|
|
1755
|
+
_ref.$widgetNode;
|
|
1756
|
+
_ref.$dep;
|
|
1989
1757
|
try {
|
|
1990
1758
|
// eslint-disable-next-line no-eval
|
|
1991
1759
|
return innerFuncs.includes(expStr) ? eval("".concat(expStr, "()")) : eval(expStr);
|
|
@@ -1993,65 +1761,58 @@
|
|
|
1993
1761
|
console.error("execute ".concat(expStr, " error, please check. \n"), err);
|
|
1994
1762
|
}
|
|
1995
1763
|
};
|
|
1996
|
-
|
|
1997
1764
|
return func(context);
|
|
1998
1765
|
}
|
|
1999
|
-
|
|
2000
1766
|
if (isObj(expression)) {
|
|
2001
1767
|
Object.keys(expression).forEach(function (key) {
|
|
2002
1768
|
expression[key] = executeExpression(expression[key], instance);
|
|
2003
1769
|
});
|
|
2004
1770
|
return expression;
|
|
2005
1771
|
}
|
|
2006
|
-
};
|
|
1772
|
+
};
|
|
2007
1773
|
var isExpression = function isExpression(expression) {
|
|
2008
1774
|
return typeof expression === 'string' && /{{.*}}/.test(expression);
|
|
2009
1775
|
};
|
|
2010
1776
|
|
|
2011
1777
|
var WidgetNode = /*#__PURE__*/function () {
|
|
2012
|
-
// todo
|
|
2013
1778
|
function WidgetNode(config) {
|
|
2014
1779
|
_classCallCheck(this, WidgetNode);
|
|
2015
|
-
|
|
2016
1780
|
this.id = void 0;
|
|
2017
1781
|
this.instance = void 0;
|
|
2018
1782
|
this.parent = void 0;
|
|
2019
1783
|
this.type = void 0;
|
|
2020
1784
|
this.index = void 0;
|
|
1785
|
+
// todo
|
|
2021
1786
|
this.children = void 0;
|
|
2022
1787
|
var id = config.id,
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
1788
|
+
instance = config.instance,
|
|
1789
|
+
parent = config.parent,
|
|
1790
|
+
index = config.index,
|
|
1791
|
+
type = config.type,
|
|
1792
|
+
_config$children = config.children,
|
|
1793
|
+
children = _config$children === void 0 ? [] : _config$children;
|
|
2029
1794
|
this.id = id;
|
|
2030
1795
|
this.type = type;
|
|
2031
1796
|
this.index = index;
|
|
2032
1797
|
this.instance = instance;
|
|
2033
1798
|
this.parent = parent;
|
|
2034
1799
|
this.children = children;
|
|
2035
|
-
}
|
|
2036
|
-
|
|
2037
|
-
|
|
1800
|
+
}
|
|
1801
|
+
// 当前node的值
|
|
2038
1802
|
_createClass(WidgetNode, [{
|
|
2039
1803
|
key: "value",
|
|
2040
1804
|
get: function get() {
|
|
2041
1805
|
var _this$instance;
|
|
2042
|
-
|
|
2043
1806
|
return (_this$instance = this.instance) === null || _this$instance === void 0 ? void 0 : _this$instance.value;
|
|
2044
|
-
}
|
|
2045
|
-
|
|
1807
|
+
}
|
|
1808
|
+
// 是否含有可见子节点
|
|
2046
1809
|
}, {
|
|
2047
1810
|
key: "isChildrenVisible",
|
|
2048
1811
|
get: function get() {
|
|
2049
1812
|
if (this.type === 'node') {
|
|
2050
1813
|
var _this$instance2;
|
|
2051
|
-
|
|
2052
1814
|
return (_this$instance2 = this.instance) === null || _this$instance2 === void 0 ? void 0 : _this$instance2.state.visible;
|
|
2053
1815
|
}
|
|
2054
|
-
|
|
2055
1816
|
return this.children.some(function (child) {
|
|
2056
1817
|
return child.isChildrenVisible;
|
|
2057
1818
|
});
|
|
@@ -2059,47 +1820,43 @@
|
|
|
2059
1820
|
/**
|
|
2060
1821
|
* 获取 parents
|
|
2061
1822
|
*/
|
|
2062
|
-
|
|
2063
1823
|
}, {
|
|
2064
1824
|
key: "parents",
|
|
2065
1825
|
get: function get() {
|
|
2066
1826
|
if (!this.parent) {
|
|
2067
1827
|
return [];
|
|
2068
1828
|
}
|
|
2069
|
-
|
|
2070
1829
|
return [].concat(_toConsumableArray(this.parent.parents), [this.parent]);
|
|
2071
|
-
}
|
|
2072
|
-
|
|
1830
|
+
}
|
|
1831
|
+
// 第一个子节点
|
|
2073
1832
|
}, {
|
|
2074
1833
|
key: "firstChild",
|
|
2075
1834
|
get: function get() {
|
|
2076
1835
|
return this.children[0] || null;
|
|
2077
|
-
}
|
|
2078
|
-
|
|
1836
|
+
}
|
|
1837
|
+
// 最后一个子节点
|
|
2079
1838
|
}, {
|
|
2080
1839
|
key: "lastChild",
|
|
2081
1840
|
get: function get() {
|
|
2082
1841
|
return this.children[this.children.length - 1] || null;
|
|
2083
|
-
}
|
|
2084
|
-
|
|
1842
|
+
}
|
|
1843
|
+
// 指定属性下的同胞节点
|
|
2085
1844
|
}, {
|
|
2086
1845
|
key: "getSibling",
|
|
2087
1846
|
value: function getSibling(lastProp) {
|
|
2088
1847
|
var _this$parent;
|
|
2089
|
-
|
|
2090
1848
|
var reg = new RegExp("".concat(Path.getPathLastProp(this.id) || '', "$"));
|
|
2091
1849
|
var id = this.id.replace(reg, lastProp);
|
|
2092
1850
|
return (_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.children.find(function (node) {
|
|
2093
1851
|
return node.id === id;
|
|
2094
1852
|
});
|
|
2095
|
-
}
|
|
2096
|
-
|
|
1853
|
+
}
|
|
1854
|
+
// 获取所以同胞节点(不含自己)
|
|
2097
1855
|
}, {
|
|
2098
1856
|
key: "getSiblings",
|
|
2099
1857
|
value: function getSiblings() {
|
|
2100
1858
|
var _this$parent2,
|
|
2101
|
-
|
|
2102
|
-
|
|
1859
|
+
_this = this;
|
|
2103
1860
|
return ((_this$parent2 = this.parent) === null || _this$parent2 === void 0 ? void 0 : _this$parent2.children.filter(function (node) {
|
|
2104
1861
|
return node.instance !== _this.instance;
|
|
2105
1862
|
})) || [];
|
|
@@ -2107,7 +1864,6 @@
|
|
|
2107
1864
|
/**
|
|
2108
1865
|
* 是否是叶子节点
|
|
2109
1866
|
*/
|
|
2110
|
-
|
|
2111
1867
|
}, {
|
|
2112
1868
|
key: "isLeaf",
|
|
2113
1869
|
get: function get() {
|
|
@@ -2117,12 +1873,9 @@
|
|
|
2117
1873
|
key: "appendChild",
|
|
2118
1874
|
value: function appendChild(node) {
|
|
2119
1875
|
var _this$children;
|
|
2120
|
-
|
|
2121
1876
|
var nodes = Array.isArray(node) ? node : [node];
|
|
2122
1877
|
var offset = node.index !== undefined ? node.index : this.children.length;
|
|
2123
|
-
|
|
2124
1878
|
(_this$children = this.children).splice.apply(_this$children, [offset, 0].concat(_toConsumableArray(nodes)));
|
|
2125
|
-
|
|
2126
1879
|
this.children.slice(offset).forEach(function (node, index) {
|
|
2127
1880
|
node.index = offset + index;
|
|
2128
1881
|
});
|
|
@@ -2132,13 +1885,11 @@
|
|
|
2132
1885
|
key: "removeChild",
|
|
2133
1886
|
value: function removeChild(node) {
|
|
2134
1887
|
var _this2 = this;
|
|
2135
|
-
|
|
2136
1888
|
var nodes = Array.isArray(node) ? node : [node];
|
|
2137
1889
|
var removedChildIndex = [];
|
|
2138
1890
|
nodes.forEach(function (node) {
|
|
2139
1891
|
var index = node.index;
|
|
2140
1892
|
removedChildIndex.push(index);
|
|
2141
|
-
|
|
2142
1893
|
_this2.children.splice(index, 1);
|
|
2143
1894
|
});
|
|
2144
1895
|
var minIndex = Math.min.apply(Math, removedChildIndex);
|
|
@@ -2148,16 +1899,13 @@
|
|
|
2148
1899
|
return nodes;
|
|
2149
1900
|
}
|
|
2150
1901
|
}]);
|
|
2151
|
-
|
|
2152
1902
|
return WidgetNode;
|
|
2153
1903
|
}();
|
|
2154
1904
|
var WidgetTree = /*#__PURE__*/function () {
|
|
2155
1905
|
function WidgetTree() {
|
|
2156
1906
|
_classCallCheck(this, WidgetTree);
|
|
2157
|
-
|
|
2158
1907
|
this.widgetMap = {};
|
|
2159
1908
|
}
|
|
2160
|
-
|
|
2161
1909
|
_createClass(WidgetTree, [{
|
|
2162
1910
|
key: "addWidgetNode",
|
|
2163
1911
|
value: function addWidgetNode(path, instance, type, index) {
|
|
@@ -2176,12 +1924,10 @@
|
|
|
2176
1924
|
// 普通节点
|
|
2177
1925
|
var parentId = Path.getParentPath(path);
|
|
2178
1926
|
var parentNode = this.widgetMap[parentId];
|
|
2179
|
-
|
|
2180
1927
|
if (!parentNode) {
|
|
2181
1928
|
console.warn('Unexpected parent id, add widget failed');
|
|
2182
1929
|
return;
|
|
2183
1930
|
}
|
|
2184
|
-
|
|
2185
1931
|
var _node = new WidgetNode({
|
|
2186
1932
|
id: path,
|
|
2187
1933
|
type: type,
|
|
@@ -2190,7 +1936,6 @@
|
|
|
2190
1936
|
instance: instance,
|
|
2191
1937
|
children: []
|
|
2192
1938
|
});
|
|
2193
|
-
|
|
2194
1939
|
parentNode.appendChild(_node);
|
|
2195
1940
|
this.widgetMap[path] = _node;
|
|
2196
1941
|
}
|
|
@@ -2199,14 +1944,12 @@
|
|
|
2199
1944
|
key: "removeWidgetNode",
|
|
2200
1945
|
value: function removeWidgetNode(path, instance) {
|
|
2201
1946
|
var node = this.widgetMap[path];
|
|
2202
|
-
|
|
2203
1947
|
if (node) {
|
|
2204
1948
|
if (node.parent) {
|
|
2205
1949
|
var children = node.parent.children;
|
|
2206
1950
|
var index = children.findIndex(function (item) {
|
|
2207
1951
|
return item.instance === instance;
|
|
2208
1952
|
});
|
|
2209
|
-
|
|
2210
1953
|
if (index > -1) {
|
|
2211
1954
|
children.splice(index, 1);
|
|
2212
1955
|
children.slice(index).forEach(function (node, i) {
|
|
@@ -2214,20 +1957,17 @@
|
|
|
2214
1957
|
});
|
|
2215
1958
|
}
|
|
2216
1959
|
}
|
|
2217
|
-
|
|
2218
1960
|
if (node.instance === instance) {
|
|
2219
1961
|
delete this.widgetMap[path];
|
|
2220
1962
|
}
|
|
2221
1963
|
}
|
|
2222
1964
|
}
|
|
2223
1965
|
}]);
|
|
2224
|
-
|
|
2225
1966
|
return WidgetTree;
|
|
2226
1967
|
}();
|
|
2227
1968
|
var widgetTree = new WidgetTree();
|
|
2228
1969
|
|
|
2229
1970
|
var reactionsMap = {};
|
|
2230
|
-
|
|
2231
1971
|
var subscribe = function subscribe(path, typeName, fn) {
|
|
2232
1972
|
if (!reactionsMap[path]) {
|
|
2233
1973
|
reactionsMap[path] = {
|
|
@@ -2236,15 +1976,13 @@
|
|
|
2236
1976
|
fns: []
|
|
2237
1977
|
};
|
|
2238
1978
|
}
|
|
2239
|
-
|
|
2240
1979
|
if (typeName === 'valChange') {
|
|
2241
1980
|
reactionsMap[path].fns.push(fn);
|
|
2242
1981
|
} else {
|
|
2243
1982
|
var _typeName$split = typeName.split('/'),
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
1983
|
+
_typeName$split2 = _slicedToArray(_typeName$split, 2),
|
|
1984
|
+
type = _typeName$split2[0],
|
|
1985
|
+
name = _typeName$split2[1];
|
|
2248
1986
|
if (!reactionsMap[path][type][name]) {
|
|
2249
1987
|
reactionsMap[path][type][name] = [fn];
|
|
2250
1988
|
} else {
|
|
@@ -2260,21 +1998,14 @@
|
|
|
2260
1998
|
* @param reaction 传入的reacion配置
|
|
2261
1999
|
* @returns viod
|
|
2262
2000
|
*/
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
2001
|
var resolveReaction = function resolveReaction(crtInsPath, targetPath, reaction) {
|
|
2266
2002
|
return function () {
|
|
2267
2003
|
var _ref = widgetTree.widgetMap[crtInsPath] || {},
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2004
|
+
crtInstance = _ref.instance; // 当前组件实例,用来条件表达式判断
|
|
2271
2005
|
var _ref2 = widgetTree.widgetMap[targetPath] || {},
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2006
|
+
operateInstance = _ref2.instance; // 需要执行操作的组件实例,可能为其他组件也可能为当前组件
|
|
2275
2007
|
var fullfill = true;
|
|
2276
2008
|
var deps = [];
|
|
2277
|
-
|
|
2278
2009
|
if (reaction.source) {
|
|
2279
2010
|
var sources = Array.isArray(reaction.source) ? reaction.source : [reaction.source];
|
|
2280
2011
|
sources.forEach(function (item) {
|
|
@@ -2282,30 +2013,24 @@
|
|
|
2282
2013
|
deps.push(instance);
|
|
2283
2014
|
});
|
|
2284
2015
|
}
|
|
2285
|
-
|
|
2286
2016
|
if (typeof reaction.if === 'string') {
|
|
2287
2017
|
fullfill = executeExpression(reaction.if, crtInstance, deps);
|
|
2288
2018
|
}
|
|
2289
|
-
|
|
2290
2019
|
var operations = fullfill ? reaction.then : reaction.else;
|
|
2291
2020
|
executeOperations(operations, operateInstance, deps);
|
|
2292
2021
|
};
|
|
2293
2022
|
};
|
|
2294
|
-
|
|
2295
2023
|
var executeOperations = function executeOperations(operations, instance, deps) {
|
|
2296
2024
|
if (operations) {
|
|
2297
2025
|
if (operations.state) {
|
|
2298
2026
|
Object.keys(operations.state).forEach(function (key) {
|
|
2299
2027
|
var val = operations.state[key];
|
|
2300
|
-
|
|
2301
2028
|
if (typeof val === 'string' && /^{{.+}}$/.test(val.trim())) {
|
|
2302
2029
|
val = executeExpression(val, instance, deps);
|
|
2303
2030
|
}
|
|
2304
|
-
|
|
2305
2031
|
instance.setState(key, val);
|
|
2306
2032
|
});
|
|
2307
2033
|
}
|
|
2308
|
-
|
|
2309
2034
|
if (Array.isArray(operations.actions)) {
|
|
2310
2035
|
operations.actions.forEach(function (item) {
|
|
2311
2036
|
executeExpression(item, instance, deps);
|
|
@@ -2313,17 +2038,13 @@
|
|
|
2313
2038
|
}
|
|
2314
2039
|
}
|
|
2315
2040
|
};
|
|
2316
|
-
|
|
2317
2041
|
var parsePath = function parsePath(path, instance) {
|
|
2318
2042
|
return isExpression(path) ? executeExpression(path, instance) : path;
|
|
2319
2043
|
};
|
|
2320
|
-
|
|
2321
2044
|
var reactionRegister = function reactionRegister(path) {
|
|
2322
2045
|
var reactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
2323
|
-
|
|
2324
2046
|
var _ref3 = widgetTree.widgetMap[path] || {},
|
|
2325
|
-
|
|
2326
|
-
|
|
2047
|
+
instance = _ref3.instance;
|
|
2327
2048
|
if (reactions && Array.isArray(reactions)) {
|
|
2328
2049
|
reactions.forEach(function (reaction) {
|
|
2329
2050
|
// source 和 target 互斥,如果schema中同时定义,则取source,如果都没有定义则默认source为当前表单
|
|
@@ -2332,45 +2053,38 @@
|
|
|
2332
2053
|
var targePath = parsePath(typeof reaction.target === 'string' ? reaction.target : path, instance);
|
|
2333
2054
|
subscribePaths.forEach(function (p) {
|
|
2334
2055
|
var sourcePathItem = parsePath(p, instance);
|
|
2335
|
-
|
|
2336
2056
|
if (typeof reaction.lifetime === 'string') {
|
|
2337
2057
|
subscribe(sourcePathItem, "lifetime/".concat(reaction.lifetime), resolveReaction(path, targePath, reaction));
|
|
2338
2058
|
}
|
|
2339
|
-
|
|
2340
2059
|
if (typeof reaction.effect === 'string') {
|
|
2341
2060
|
subscribe(sourcePathItem, "effect/".concat(reaction.effect), resolveReaction(path, targePath, reaction));
|
|
2342
2061
|
}
|
|
2343
|
-
|
|
2344
2062
|
if (!reaction.lifetime && !reaction.effect) {
|
|
2345
2063
|
subscribe(sourcePathItem, 'valChange', resolveReaction(path, targePath, reaction));
|
|
2346
2064
|
}
|
|
2347
2065
|
});
|
|
2348
2066
|
});
|
|
2349
2067
|
}
|
|
2350
|
-
};
|
|
2351
|
-
|
|
2068
|
+
};
|
|
2069
|
+
// 销毁widget对应的reaction
|
|
2352
2070
|
var reactionUnRegister = function reactionUnRegister(path) {
|
|
2353
2071
|
delete reactionsMap[path];
|
|
2354
2072
|
};
|
|
2355
2073
|
var reactionDispatch = function reactionDispatch(path, typeName) {
|
|
2356
2074
|
var _typeName$split3 = typeName.split('/'),
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2075
|
+
_typeName$split4 = _slicedToArray(_typeName$split3, 2),
|
|
2076
|
+
_typeName$split4$ = _typeName$split4[0],
|
|
2077
|
+
type = _typeName$split4$ === void 0 ? '' : _typeName$split4$,
|
|
2078
|
+
_typeName$split4$2 = _typeName$split4[1],
|
|
2079
|
+
name = _typeName$split4$2 === void 0 ? '' : _typeName$split4$2;
|
|
2363
2080
|
var fns = [];
|
|
2364
|
-
|
|
2365
2081
|
if (reactionsMap[path]) {
|
|
2366
2082
|
var _reactionsMap$path, _reactionsMap$path$ty;
|
|
2367
|
-
|
|
2368
2083
|
if (type === 'valChange') {
|
|
2369
2084
|
fns = reactionsMap[path].fns;
|
|
2370
2085
|
} else if ((_reactionsMap$path = reactionsMap[path]) !== null && _reactionsMap$path !== void 0 && (_reactionsMap$path$ty = _reactionsMap$path[type]) !== null && _reactionsMap$path$ty !== void 0 && _reactionsMap$path$ty[name]) {
|
|
2371
2086
|
fns = reactionsMap[path][type][name];
|
|
2372
2087
|
}
|
|
2373
|
-
|
|
2374
2088
|
fns.forEach(function (fn) {
|
|
2375
2089
|
fn();
|
|
2376
2090
|
});
|
|
@@ -4953,7 +4667,7 @@
|
|
|
4953
4667
|
strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
|
|
4954
4668
|
}
|
|
4955
4669
|
});
|
|
4956
|
-
it
|
|
4670
|
+
narrowSchemaTypes(it, types);
|
|
4957
4671
|
}
|
|
4958
4672
|
function checkMultipleTypes(it, ts) {
|
|
4959
4673
|
if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
|
|
@@ -4978,6 +4692,16 @@
|
|
|
4978
4692
|
function includesType(ts, t) {
|
|
4979
4693
|
return ts.includes(t) || (t === "integer" && ts.includes("number"));
|
|
4980
4694
|
}
|
|
4695
|
+
function narrowSchemaTypes(it, withTypes) {
|
|
4696
|
+
const ts = [];
|
|
4697
|
+
for (const t of it.dataTypes) {
|
|
4698
|
+
if (includesType(withTypes, t))
|
|
4699
|
+
ts.push(t);
|
|
4700
|
+
else if (withTypes.includes("integer") && t === "number")
|
|
4701
|
+
ts.push("integer");
|
|
4702
|
+
}
|
|
4703
|
+
it.dataTypes = ts;
|
|
4704
|
+
}
|
|
4981
4705
|
function strictTypesError(it, msg) {
|
|
4982
4706
|
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
|
4983
4707
|
msg += ` at "${schemaPath}" (strictTypes)`;
|
|
@@ -9507,7 +9231,7 @@
|
|
|
9507
9231
|
|
|
9508
9232
|
(function (module, exports) {
|
|
9509
9233
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9510
|
-
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
|
9234
|
+
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
|
9511
9235
|
const core_1 = core$2;
|
|
9512
9236
|
const draft7_1 = draft7;
|
|
9513
9237
|
const discriminator_1 = discriminator;
|
|
@@ -9548,6 +9272,10 @@
|
|
|
9548
9272
|
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
|
9549
9273
|
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
|
9550
9274
|
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
|
9275
|
+
var validation_error_1 = validation_error;
|
|
9276
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
|
|
9277
|
+
var ref_error_1 = ref_error;
|
|
9278
|
+
Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
|
|
9551
9279
|
|
|
9552
9280
|
}(ajv$1, ajv$1.exports));
|
|
9553
9281
|
|
|
@@ -10003,29 +9731,26 @@
|
|
|
10003
9731
|
var ajv = new Ajv({
|
|
10004
9732
|
strict: false
|
|
10005
9733
|
});
|
|
10006
|
-
addFormats(ajv);
|
|
10007
|
-
|
|
9734
|
+
addFormats(ajv);
|
|
9735
|
+
// 校验器 key
|
|
10008
9736
|
var VALIDATOR = 'validator';
|
|
10009
9737
|
var OWN_RULE_PROPERTY = 'ui:rules';
|
|
10010
|
-
var DEBUG_PREFIX = '[bk-schema-form-validator]';
|
|
10011
|
-
|
|
9738
|
+
var DEBUG_PREFIX = '[bk-schema-form-validator]';
|
|
9739
|
+
// 默认规则
|
|
10012
9740
|
var DEFAULT_RULES = {
|
|
10013
9741
|
required: {
|
|
10014
9742
|
message: '必填项',
|
|
10015
9743
|
validator: '{{ $self.value !== \'\' }}'
|
|
10016
9744
|
}
|
|
10017
9745
|
};
|
|
10018
|
-
|
|
10019
9746
|
var throwErr = function throwErr(err) {
|
|
10020
9747
|
throw new Error("".concat(DEBUG_PREFIX, " ").concat(err));
|
|
10021
9748
|
};
|
|
10022
|
-
|
|
10023
9749
|
var globalRules = new Map();
|
|
10024
9750
|
/**
|
|
10025
9751
|
* 注册全局校验规则
|
|
10026
9752
|
* @param rules
|
|
10027
9753
|
*/
|
|
10028
|
-
|
|
10029
9754
|
var registryGlobalRules = function registryGlobalRules(rules) {
|
|
10030
9755
|
try {
|
|
10031
9756
|
if (!rules) return;
|
|
@@ -10044,57 +9769,49 @@
|
|
|
10044
9769
|
/**
|
|
10045
9770
|
* 校验规则
|
|
10046
9771
|
*/
|
|
10047
|
-
|
|
10048
9772
|
var validate = function validate(rule, instance) {
|
|
10049
9773
|
var theRule = rule;
|
|
10050
|
-
|
|
10051
9774
|
if (typeof rule === 'string') {
|
|
10052
9775
|
theRule = globalRules.get(rule);
|
|
10053
9776
|
if (!theRule) throwErr("'".concat(rule, " is not a valid global rule, you can registry it to global rules node or use form item own custom rules"));
|
|
10054
9777
|
}
|
|
10055
|
-
|
|
10056
9778
|
var _theRule = theRule,
|
|
10057
|
-
|
|
10058
|
-
|
|
9779
|
+
validator = _theRule.validator,
|
|
9780
|
+
message = _theRule.message;
|
|
10059
9781
|
var valid = true;
|
|
10060
|
-
|
|
10061
9782
|
if (isExpression(validator)) {
|
|
10062
9783
|
valid = executeExpression(validator, instance);
|
|
10063
9784
|
} else if (typeof validator === 'function') {
|
|
10064
|
-
valid = validator(instance);
|
|
9785
|
+
valid = validator(instance);
|
|
9786
|
+
// eslint-disable-next-line no-eval
|
|
10065
9787
|
} else if (eval(validator) instanceof RegExp) {
|
|
10066
9788
|
// eslint-disable-next-line no-eval
|
|
10067
9789
|
valid = new RegExp(eval(validator)).test(instance.value);
|
|
10068
9790
|
}
|
|
10069
|
-
|
|
10070
9791
|
return {
|
|
10071
9792
|
valid: valid,
|
|
10072
9793
|
message: message
|
|
10073
9794
|
};
|
|
10074
|
-
};
|
|
10075
|
-
|
|
10076
|
-
|
|
9795
|
+
};
|
|
9796
|
+
// 设置表单项校验状态
|
|
10077
9797
|
var setWidgetErrorTips = function setWidgetErrorTips(path, isError, errorMsg) {
|
|
10078
9798
|
var formItem = widgetTree.widgetMap[path];
|
|
10079
9799
|
var instance = formItem.instance;
|
|
10080
|
-
|
|
10081
9800
|
if (formItem.type === 'node') {
|
|
10082
9801
|
instance === null || instance === void 0 ? void 0 : instance.setState('error', true);
|
|
10083
9802
|
instance === null || instance === void 0 ? void 0 : instance.setErrorTips(errorMsg);
|
|
10084
|
-
}
|
|
9803
|
+
}
|
|
9804
|
+
// 如果实例属于某个组,则沿着 path 向上查找,如果找到组且组的 verifiable 设置为 true,则通过实例的校验状态改变组的校验状态
|
|
10085
9805
|
// TODO submit 时校验,change 时去掉错误
|
|
10086
|
-
|
|
10087
|
-
|
|
10088
9806
|
var widgetPaths = path.split('.');
|
|
10089
9807
|
var fieldTitleBreadcrumb = [];
|
|
10090
9808
|
widgetPaths.forEach(function (thePath, thePathIndex) {
|
|
10091
9809
|
var currentPaths = widgetPaths.slice(0, widgetPaths.length - thePathIndex);
|
|
10092
9810
|
var widgetPath = currentPaths.join('.');
|
|
10093
|
-
var theWidget = widgetTree.widgetMap[widgetPath];
|
|
10094
|
-
|
|
9811
|
+
var theWidget = widgetTree.widgetMap[widgetPath];
|
|
9812
|
+
// todo(判断path是否是数组索引)
|
|
10095
9813
|
var isIndex = theWidget.instance.schema.type === 'array' || !theWidget.instance.schema.title;
|
|
10096
9814
|
fieldTitleBreadcrumb.push(isIndex ? currentPaths.pop() : theWidget.instance.schema.title);
|
|
10097
|
-
|
|
10098
9815
|
if (theWidget.instance.verifiable && theWidget.type === 'group') {
|
|
10099
9816
|
if (isError) {
|
|
10100
9817
|
var groupErrors = "".concat(fieldTitleBreadcrumb.reverse().join('-'), ": ").concat(errorMsg);
|
|
@@ -10109,10 +9826,8 @@
|
|
|
10109
9826
|
* 校验单个表单项
|
|
10110
9827
|
* @param path 字段路径
|
|
10111
9828
|
*/
|
|
10112
|
-
|
|
10113
9829
|
var validateFormItem = function validateFormItem(path) {
|
|
10114
9830
|
var _instance$schema;
|
|
10115
|
-
|
|
10116
9831
|
// TODO 校验逻辑梳理
|
|
10117
9832
|
var formItem = widgetTree.widgetMap[path];
|
|
10118
9833
|
if (!formItem) return {
|
|
@@ -10120,26 +9835,24 @@
|
|
|
10120
9835
|
message: '',
|
|
10121
9836
|
path: ''
|
|
10122
9837
|
};
|
|
10123
|
-
var instance = formItem.instance;
|
|
10124
|
-
|
|
9838
|
+
var instance = formItem.instance;
|
|
9839
|
+
// 清空上一次状态
|
|
10125
9840
|
if (formItem.type === 'group') {
|
|
10126
9841
|
instance === null || instance === void 0 ? void 0 : instance.clearGroupErrorTips();
|
|
10127
9842
|
} else {
|
|
10128
9843
|
instance === null || instance === void 0 ? void 0 : instance.setState('error', false);
|
|
10129
|
-
instance === null || instance === void 0 ? void 0 : instance.setErrorTips('');
|
|
10130
|
-
|
|
9844
|
+
instance === null || instance === void 0 ? void 0 : instance.setErrorTips('');
|
|
9845
|
+
// 清空所在组错误信息
|
|
10131
9846
|
var widgetPaths = path.split('.');
|
|
10132
9847
|
widgetPaths.forEach(function (thePath, thePathIndex) {
|
|
10133
9848
|
var currentPaths = widgetPaths.slice(0, widgetPaths.length - thePathIndex).join('.');
|
|
10134
9849
|
var theWidget = widgetTree.widgetMap[currentPaths];
|
|
10135
|
-
|
|
10136
9850
|
if (theWidget.instance.verifiable && theWidget.type === 'group') {
|
|
10137
9851
|
theWidget.instance.removeGroupErrorTips(path);
|
|
10138
9852
|
}
|
|
10139
9853
|
});
|
|
10140
|
-
}
|
|
10141
|
-
|
|
10142
|
-
|
|
9854
|
+
}
|
|
9855
|
+
// json schema 规则校验
|
|
10143
9856
|
var ownSchema = instance.schema;
|
|
10144
9857
|
var schemaValidate = ajv.compile(ownSchema);
|
|
10145
9858
|
var value = instance.value === undefined ? initializationValue(ownSchema.type, {
|
|
@@ -10147,7 +9860,6 @@
|
|
|
10147
9860
|
number: 0
|
|
10148
9861
|
}) : instance.value;
|
|
10149
9862
|
var schemaValid = schemaValidate(value);
|
|
10150
|
-
|
|
10151
9863
|
if (!schemaValid) {
|
|
10152
9864
|
zh(schemaValidate.errors);
|
|
10153
9865
|
var errorsText = ajv.errorsText(schemaValidate.errors, {
|
|
@@ -10159,21 +9871,17 @@
|
|
|
10159
9871
|
message: errorsText,
|
|
10160
9872
|
path: path
|
|
10161
9873
|
};
|
|
10162
|
-
}
|
|
10163
|
-
|
|
10164
|
-
|
|
9874
|
+
}
|
|
9875
|
+
// 自定义规则校验
|
|
10165
9876
|
var customRules = ((_instance$schema = instance.schema) === null || _instance$schema === void 0 ? void 0 : _instance$schema[OWN_RULE_PROPERTY]) || [];
|
|
10166
9877
|
var isError = false;
|
|
10167
9878
|
var errorMsg = '';
|
|
10168
|
-
|
|
10169
9879
|
var _iterator = _createForOfIteratorHelper(customRules),
|
|
10170
|
-
|
|
10171
|
-
|
|
9880
|
+
_step;
|
|
10172
9881
|
try {
|
|
10173
9882
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
10174
9883
|
var rule = _step.value;
|
|
10175
9884
|
var result = validate(rule, instance);
|
|
10176
|
-
|
|
10177
9885
|
if (!result.valid) {
|
|
10178
9886
|
isError = true;
|
|
10179
9887
|
errorMsg = result.message;
|
|
@@ -10185,7 +9893,6 @@
|
|
|
10185
9893
|
} finally {
|
|
10186
9894
|
_iterator.f();
|
|
10187
9895
|
}
|
|
10188
|
-
|
|
10189
9896
|
if (isError) {
|
|
10190
9897
|
setWidgetErrorTips(path, true, errorMsg);
|
|
10191
9898
|
return {
|
|
@@ -10194,7 +9901,6 @@
|
|
|
10194
9901
|
path: path
|
|
10195
9902
|
};
|
|
10196
9903
|
}
|
|
10197
|
-
|
|
10198
9904
|
return {
|
|
10199
9905
|
result: true,
|
|
10200
9906
|
message: errorMsg,
|
|
@@ -10204,12 +9910,10 @@
|
|
|
10204
9910
|
/**
|
|
10205
9911
|
* 校验整个表单
|
|
10206
9912
|
*/
|
|
10207
|
-
|
|
10208
9913
|
var validateForm = function validateForm() {
|
|
10209
9914
|
var isValid = true;
|
|
10210
9915
|
Object.keys(widgetTree.widgetMap).forEach(function (path) {
|
|
10211
9916
|
var _validateFormItem;
|
|
10212
|
-
|
|
10213
9917
|
if (!((_validateFormItem = validateFormItem(path)) !== null && _validateFormItem !== void 0 && _validateFormItem.result)) isValid = false;
|
|
10214
9918
|
});
|
|
10215
9919
|
return isValid;
|
|
@@ -10217,58 +9921,47 @@
|
|
|
10217
9921
|
/**
|
|
10218
9922
|
* 校验表单(抛出具体错误信息)
|
|
10219
9923
|
*/
|
|
10220
|
-
|
|
10221
9924
|
var validateFormWithResult = function validateFormWithResult() {
|
|
10222
9925
|
return new Promise(function (resolve, reject) {
|
|
10223
9926
|
var result = Object.keys(widgetTree.widgetMap).filter(function (path) {
|
|
10224
9927
|
var _widgetTree$widgetMap;
|
|
10225
|
-
|
|
10226
9928
|
return ((_widgetTree$widgetMap = widgetTree.widgetMap[path]) === null || _widgetTree$widgetMap === void 0 ? void 0 : _widgetTree$widgetMap.type) === 'node';
|
|
10227
9929
|
}).reduce(function (pre, path) {
|
|
10228
9930
|
var validateResult = validateFormItem(path);
|
|
10229
|
-
|
|
10230
9931
|
if (!(validateResult !== null && validateResult !== void 0 && validateResult.result)) {
|
|
10231
9932
|
pre.push(validateResult);
|
|
10232
9933
|
}
|
|
10233
|
-
|
|
10234
9934
|
return pre;
|
|
10235
9935
|
}, []);
|
|
10236
|
-
|
|
10237
9936
|
if (result.length) {
|
|
10238
9937
|
reject(result);
|
|
10239
9938
|
} else {
|
|
10240
9939
|
resolve([]);
|
|
10241
9940
|
}
|
|
10242
9941
|
});
|
|
10243
|
-
};
|
|
10244
|
-
|
|
9942
|
+
};
|
|
9943
|
+
// 校验schema是否正常
|
|
10245
9944
|
var validateSchema = /*#__PURE__*/function () {
|
|
10246
9945
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
|
|
10247
9946
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10248
|
-
while (1) {
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
|
|
10257
|
-
|
|
10258
|
-
|
|
10259
|
-
|
|
10260
|
-
|
|
10261
|
-
|
|
10262
|
-
|
|
10263
|
-
|
|
10264
|
-
case 10:
|
|
10265
|
-
case "end":
|
|
10266
|
-
return _context.stop();
|
|
10267
|
-
}
|
|
9947
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9948
|
+
case 0:
|
|
9949
|
+
_context.prev = 0;
|
|
9950
|
+
_context.next = 3;
|
|
9951
|
+
return ajv.validateSchema(schema, true);
|
|
9952
|
+
case 3:
|
|
9953
|
+
return _context.abrupt("return", _context.sent);
|
|
9954
|
+
case 6:
|
|
9955
|
+
_context.prev = 6;
|
|
9956
|
+
_context.t0 = _context["catch"](0);
|
|
9957
|
+
console.error('Schema不符合规范, 请检查', _context.t0);
|
|
9958
|
+
return _context.abrupt("return", false);
|
|
9959
|
+
case 10:
|
|
9960
|
+
case "end":
|
|
9961
|
+
return _context.stop();
|
|
10268
9962
|
}
|
|
10269
9963
|
}, _callee, null, [[0, 6]]);
|
|
10270
9964
|
}));
|
|
10271
|
-
|
|
10272
9965
|
return function validateSchema(_x) {
|
|
10273
9966
|
return _ref.apply(this, arguments);
|
|
10274
9967
|
};
|
|
@@ -10277,7 +9970,6 @@
|
|
|
10277
9970
|
* 触发校验
|
|
10278
9971
|
* @param path 字段路径
|
|
10279
9972
|
*/
|
|
10280
|
-
|
|
10281
9973
|
var dispatchValidate = function dispatchValidate(path) {
|
|
10282
9974
|
return validateFormItem(path);
|
|
10283
9975
|
};
|
|
@@ -10286,22 +9978,18 @@
|
|
|
10286
9978
|
var FormEvent = /*#__PURE__*/function () {
|
|
10287
9979
|
function FormEvent() {
|
|
10288
9980
|
_classCallCheck(this, FormEvent);
|
|
10289
|
-
|
|
10290
9981
|
this.callbacks = void 0;
|
|
10291
9982
|
this.callbacks = Object.create(null);
|
|
10292
9983
|
}
|
|
10293
|
-
|
|
10294
9984
|
_createClass(FormEvent, [{
|
|
10295
9985
|
key: "on",
|
|
10296
9986
|
value: function on(path, type, cb) {
|
|
10297
9987
|
if (!(path in this.callbacks)) {
|
|
10298
9988
|
this.callbacks[path] = {};
|
|
10299
9989
|
}
|
|
10300
|
-
|
|
10301
9990
|
if (!(type in this.callbacks[path])) {
|
|
10302
9991
|
this.callbacks[path][type] = [];
|
|
10303
9992
|
}
|
|
10304
|
-
|
|
10305
9993
|
this.callbacks[path][type].push(cb);
|
|
10306
9994
|
return this;
|
|
10307
9995
|
}
|
|
@@ -10319,28 +10007,24 @@
|
|
|
10319
10007
|
delete this.callbacks[path][type];
|
|
10320
10008
|
} else {
|
|
10321
10009
|
// 清空对应事件
|
|
10322
|
-
var events = this.callbacks[path][type];
|
|
10323
|
-
|
|
10010
|
+
var events = this.callbacks[path][type];
|
|
10011
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
10324
10012
|
for (var index in events) {
|
|
10325
10013
|
if (cb === events[index]) {
|
|
10326
10014
|
events.splice(Number(index), 1);
|
|
10327
10015
|
}
|
|
10328
10016
|
}
|
|
10329
10017
|
}
|
|
10330
|
-
|
|
10331
10018
|
return this;
|
|
10332
10019
|
}
|
|
10333
10020
|
}, {
|
|
10334
10021
|
key: "once",
|
|
10335
10022
|
value: function once(path, type, cb) {
|
|
10336
10023
|
var _this = this;
|
|
10337
|
-
|
|
10338
10024
|
function innerOnce() {
|
|
10339
10025
|
cb.apply(void 0, arguments);
|
|
10340
|
-
|
|
10341
10026
|
_this.off(path, type, innerOnce);
|
|
10342
10027
|
}
|
|
10343
|
-
|
|
10344
10028
|
innerOnce.fn = cb;
|
|
10345
10029
|
this.on(path, type, innerOnce);
|
|
10346
10030
|
return this;
|
|
@@ -10349,17 +10033,13 @@
|
|
|
10349
10033
|
key: "emit",
|
|
10350
10034
|
value: function emit(path, type) {
|
|
10351
10035
|
if (!this.callbacks[path]) return;
|
|
10352
|
-
|
|
10353
10036
|
if (type in this.callbacks[path]) {
|
|
10354
10037
|
var runs = _toConsumableArray(this.callbacks[path][type]);
|
|
10355
|
-
|
|
10356
10038
|
for (var _len = arguments.length, arg = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
10357
10039
|
arg[_key - 2] = arguments[_key];
|
|
10358
10040
|
}
|
|
10359
|
-
|
|
10360
10041
|
var _iterator = _createForOfIteratorHelper(runs),
|
|
10361
|
-
|
|
10362
|
-
|
|
10042
|
+
_step;
|
|
10363
10043
|
try {
|
|
10364
10044
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
10365
10045
|
var cb = _step.value;
|
|
@@ -10373,13 +10053,12 @@
|
|
|
10373
10053
|
}
|
|
10374
10054
|
}
|
|
10375
10055
|
}]);
|
|
10376
|
-
|
|
10377
10056
|
return FormEvent;
|
|
10378
10057
|
}();
|
|
10379
10058
|
var events = new FormEvent();
|
|
10380
10059
|
|
|
10381
10060
|
var _excluded$4 = ["url", "params"],
|
|
10382
|
-
|
|
10061
|
+
_excluded2 = ["name"];
|
|
10383
10062
|
var Widget = Vue__default["default"].extend({
|
|
10384
10063
|
name: 'Widget',
|
|
10385
10064
|
props: props,
|
|
@@ -10403,7 +10082,6 @@
|
|
|
10403
10082
|
},
|
|
10404
10083
|
parent: function parent() {
|
|
10405
10084
|
var _this$widgetNode;
|
|
10406
|
-
|
|
10407
10085
|
return (_this$widgetNode = this.widgetNode) === null || _this$widgetNode === void 0 ? void 0 : _this$widgetNode.parent;
|
|
10408
10086
|
}
|
|
10409
10087
|
},
|
|
@@ -10411,7 +10089,6 @@
|
|
|
10411
10089
|
value: {
|
|
10412
10090
|
handler: function handler(newValue, oldValue) {
|
|
10413
10091
|
var _this = this;
|
|
10414
|
-
|
|
10415
10092
|
if (!deepEquals(newValue, oldValue)) {
|
|
10416
10093
|
setTimeout(function () {
|
|
10417
10094
|
reactionDispatch(_this.path, 'valChange');
|
|
@@ -10423,29 +10100,28 @@
|
|
|
10423
10100
|
},
|
|
10424
10101
|
created: function created() {
|
|
10425
10102
|
var _this2 = this;
|
|
10426
|
-
|
|
10427
10103
|
// 表单项配置
|
|
10428
10104
|
var uiOptions = Schema.getUiOptions(this.schema);
|
|
10429
10105
|
this.formItemProps = _objectSpread2(_objectSpread2({}, uiOptions), {}, {
|
|
10430
10106
|
// schema配置不存在title时默认用属性名作为title
|
|
10431
10107
|
label: uiOptions.showTitle ? uiOptions.label || Path.getPathLastProp(this.path) : '',
|
|
10432
10108
|
required: this.required
|
|
10433
|
-
});
|
|
10434
|
-
|
|
10109
|
+
});
|
|
10110
|
+
// 设置widget初始化状态 ui:component优先级 > ui:props优先级
|
|
10435
10111
|
var vNodeData = Schema.getUiComponent(this.schema);
|
|
10436
10112
|
var defaultProps = Object.assign({}, this.formItemProps, vNodeData.props || {});
|
|
10437
10113
|
Object.keys(defaultProps).forEach(function (key) {
|
|
10438
10114
|
if (Reflect.has(_this2.state, key)) {
|
|
10439
10115
|
_this2.setState(key, defaultProps[key]);
|
|
10440
10116
|
}
|
|
10441
|
-
});
|
|
10442
|
-
|
|
10117
|
+
});
|
|
10118
|
+
// 注册widget TreeNode
|
|
10443
10119
|
widgetTree.addWidgetNode(this.path, this, 'node');
|
|
10444
10120
|
},
|
|
10445
10121
|
mounted: function mounted() {
|
|
10446
10122
|
// 注册联动
|
|
10447
|
-
reactionRegister(this.path, this.schema['ui:reactions']);
|
|
10448
|
-
|
|
10123
|
+
reactionRegister(this.path, this.schema['ui:reactions']);
|
|
10124
|
+
// 首次联动
|
|
10449
10125
|
reactionDispatch(this.path, 'valChange');
|
|
10450
10126
|
reactionDispatch(this.path, 'lifetime/init');
|
|
10451
10127
|
},
|
|
@@ -10469,51 +10145,41 @@
|
|
|
10469
10145
|
},
|
|
10470
10146
|
loadDataSource: function loadDataSource() {
|
|
10471
10147
|
var _this3 = this;
|
|
10472
|
-
|
|
10473
10148
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
10474
10149
|
var _this3$schema, _this3$schema$uiComp, _this3$schema$uiComp$;
|
|
10475
|
-
|
|
10476
10150
|
var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
|
|
10477
|
-
|
|
10478
10151
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10479
|
-
while (1) {
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
if (!xhrConfig) {
|
|
10485
|
-
_context.next = 18;
|
|
10486
|
-
break;
|
|
10487
|
-
}
|
|
10488
|
-
|
|
10489
|
-
url = xhrConfig.url, params = xhrConfig.params, reset = _objectWithoutProperties(xhrConfig, _excluded$4);
|
|
10490
|
-
_this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
|
|
10491
|
-
_context.prev = 4;
|
|
10492
|
-
_this3.loading = true;
|
|
10493
|
-
remoteURL = executeExpression(url, _this3);
|
|
10494
|
-
requestParams = isObj(params) ? executeExpression(params, _this3) : params;
|
|
10495
|
-
_context.next = 10;
|
|
10496
|
-
return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
10497
|
-
params: requestParams,
|
|
10498
|
-
responseParse: responseParse
|
|
10499
|
-
}));
|
|
10500
|
-
|
|
10501
|
-
case 10:
|
|
10502
|
-
_this3.datasource = _context.sent;
|
|
10503
|
-
_this3.loading = false;
|
|
10152
|
+
while (1) switch (_context.prev = _context.next) {
|
|
10153
|
+
case 0:
|
|
10154
|
+
xhrConfig = (_this3$schema = _this3.schema) === null || _this3$schema === void 0 ? void 0 : (_this3$schema$uiComp = _this3$schema['ui:component']) === null || _this3$schema$uiComp === void 0 ? void 0 : (_this3$schema$uiComp$ = _this3$schema$uiComp.props) === null || _this3$schema$uiComp$ === void 0 ? void 0 : _this3$schema$uiComp$.remoteConfig;
|
|
10155
|
+
if (!xhrConfig) {
|
|
10504
10156
|
_context.next = 18;
|
|
10505
10157
|
break;
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10509
|
-
|
|
10510
|
-
|
|
10511
|
-
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10158
|
+
}
|
|
10159
|
+
url = xhrConfig.url, params = xhrConfig.params, reset = _objectWithoutProperties(xhrConfig, _excluded$4);
|
|
10160
|
+
_this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
|
|
10161
|
+
_context.prev = 4;
|
|
10162
|
+
_this3.loading = true;
|
|
10163
|
+
remoteURL = executeExpression(url, _this3);
|
|
10164
|
+
requestParams = isObj(params) ? executeExpression(params, _this3) : params;
|
|
10165
|
+
_context.next = 10;
|
|
10166
|
+
return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
10167
|
+
params: requestParams,
|
|
10168
|
+
responseParse: responseParse
|
|
10169
|
+
}));
|
|
10170
|
+
case 10:
|
|
10171
|
+
_this3.datasource = _context.sent;
|
|
10172
|
+
_this3.loading = false;
|
|
10173
|
+
_context.next = 18;
|
|
10174
|
+
break;
|
|
10175
|
+
case 14:
|
|
10176
|
+
_context.prev = 14;
|
|
10177
|
+
_context.t0 = _context["catch"](4);
|
|
10178
|
+
_this3.loading = false;
|
|
10179
|
+
console.error(_context.t0);
|
|
10180
|
+
case 18:
|
|
10181
|
+
case "end":
|
|
10182
|
+
return _context.stop();
|
|
10517
10183
|
}
|
|
10518
10184
|
}, _callee, null, [[4, 14]]);
|
|
10519
10185
|
}))();
|
|
@@ -10527,29 +10193,26 @@
|
|
|
10527
10193
|
},
|
|
10528
10194
|
render: function render(h) {
|
|
10529
10195
|
var _events$callbacks,
|
|
10530
|
-
|
|
10531
|
-
|
|
10532
|
-
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
|
|
10536
|
-
|
|
10537
|
-
|
|
10538
|
-
|
|
10196
|
+
_this$$scopedSlots$de,
|
|
10197
|
+
_this$$scopedSlots$de2,
|
|
10198
|
+
_this$$scopedSlots,
|
|
10199
|
+
_this$datasource,
|
|
10200
|
+
_this$datasource$find,
|
|
10201
|
+
_this4 = this,
|
|
10202
|
+
_this$$scopedSlots$su,
|
|
10203
|
+
_this$$scopedSlots2;
|
|
10539
10204
|
var _Schema$getUiComponen = Schema.getUiComponent(this.schema),
|
|
10540
|
-
|
|
10541
|
-
|
|
10542
|
-
|
|
10543
|
-
|
|
10205
|
+
name = _Schema$getUiComponen.name,
|
|
10206
|
+
uiVnodeData = _objectWithoutProperties(_Schema$getUiComponen, _excluded2);
|
|
10207
|
+
// 注意顺序!!!
|
|
10544
10208
|
var widgetProps = _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
10545
10209
|
loading: this.loading,
|
|
10546
10210
|
value: this.value
|
|
10547
10211
|
});
|
|
10548
|
-
|
|
10549
10212
|
var self = this;
|
|
10550
10213
|
var widgetName = registry.getComponent(name) || name || Schema.getDefaultWidget(this.schema);
|
|
10551
|
-
var widgetEvents = ((_events$callbacks = events.callbacks) === null || _events$callbacks === void 0 ? void 0 : _events$callbacks[this.path]) || {};
|
|
10552
|
-
|
|
10214
|
+
var widgetEvents = ((_events$callbacks = events.callbacks) === null || _events$callbacks === void 0 ? void 0 : _events$callbacks[this.path]) || {};
|
|
10215
|
+
// 当前state属性优先级最高
|
|
10553
10216
|
var renderWidget = (_this$$scopedSlots$de = (_this$$scopedSlots$de2 = (_this$$scopedSlots = this.$scopedSlots).default) === null || _this$$scopedSlots$de2 === void 0 ? void 0 : _this$$scopedSlots$de2.call(_this$$scopedSlots, {
|
|
10554
10217
|
path: this.path
|
|
10555
10218
|
})) !== null && _this$$scopedSlots$de !== void 0 ? _this$$scopedSlots$de : h(widgetName, mergeDeep({
|
|
@@ -10570,7 +10233,7 @@
|
|
|
10570
10233
|
reactionDispatch(self.path, 'effect/click');
|
|
10571
10234
|
}
|
|
10572
10235
|
})
|
|
10573
|
-
}, mergeDeep(uiVnodeData, {
|
|
10236
|
+
}, mergeDeep({}, uiVnodeData, {
|
|
10574
10237
|
props: _objectSpread2(_objectSpread2({}, this.state), {}, {
|
|
10575
10238
|
datasource: this.datasource,
|
|
10576
10239
|
readonly: this.readonly,
|
|
@@ -10580,10 +10243,10 @@
|
|
|
10580
10243
|
})));
|
|
10581
10244
|
var readonlyValue = ((_this$datasource = this.datasource) === null || _this$datasource === void 0 ? void 0 : (_this$datasource$find = _this$datasource.find(function (item) {
|
|
10582
10245
|
return item.value === _this4.value;
|
|
10583
|
-
})) === null || _this$datasource$find === void 0 ? void 0 : _this$datasource$find.label) || this.value;
|
|
10584
|
-
|
|
10585
|
-
var renderReadonlyWidget = h('div', [readonlyValue === '' ? '--' : String(readonlyValue)]);
|
|
10586
|
-
|
|
10246
|
+
})) === null || _this$datasource$find === void 0 ? void 0 : _this$datasource$find.label) || this.value;
|
|
10247
|
+
// 渲染默认readonly模式
|
|
10248
|
+
var renderReadonlyWidget = h('div', [readonlyValue === '' ? '--' : String(readonlyValue)]);
|
|
10249
|
+
// 渲染删除按钮(用于数组类型widget删除)
|
|
10587
10250
|
var renderDelete = function renderDelete() {
|
|
10588
10251
|
return h('span', {
|
|
10589
10252
|
class: ['bk-schema-form-group-delete'],
|
|
@@ -10600,7 +10263,6 @@
|
|
|
10600
10263
|
class: ['bk-icon icon-close3-shape']
|
|
10601
10264
|
})]);
|
|
10602
10265
|
};
|
|
10603
|
-
|
|
10604
10266
|
return h(registry.getBaseWidget('form-item'), {
|
|
10605
10267
|
props: this.formItemProps,
|
|
10606
10268
|
style: _objectSpread2(_objectSpread2(_objectSpread2({}, this.layout.item || {}), this.layout.container || {}), {}, {
|
|
@@ -10633,13 +10295,12 @@
|
|
|
10633
10295
|
props: props,
|
|
10634
10296
|
render: function render(h, ctx) {
|
|
10635
10297
|
var _ctx$props = ctx.props,
|
|
10636
|
-
|
|
10637
|
-
|
|
10638
|
-
|
|
10639
|
-
|
|
10298
|
+
schema = _ctx$props.schema,
|
|
10299
|
+
path = _ctx$props.path,
|
|
10300
|
+
layout = _ctx$props.layout,
|
|
10301
|
+
rootData = _ctx$props.rootData;
|
|
10640
10302
|
var properties = orderProperties(Object.keys(schema.properties || {}), schema['ui:order']);
|
|
10641
10303
|
var vNodeList = [];
|
|
10642
|
-
|
|
10643
10304
|
if (properties.length) {
|
|
10644
10305
|
vNodeList = properties.map(function (name) {
|
|
10645
10306
|
var curPath = Path.getCurPath(path, name);
|
|
@@ -10653,7 +10314,6 @@
|
|
|
10653
10314
|
path: curPath,
|
|
10654
10315
|
layout: layoutConfig,
|
|
10655
10316
|
removeable: false // todo: 不往下传递可删除属性
|
|
10656
|
-
|
|
10657
10317
|
})
|
|
10658
10318
|
}));
|
|
10659
10319
|
});
|
|
@@ -10661,12 +10321,10 @@
|
|
|
10661
10321
|
// 如果object属性没有配置 Properties,但是有ui:component属性,那个直接渲染对应的组件
|
|
10662
10322
|
vNodeList = [h(Widget, _objectSpread2({}, ctx.data))];
|
|
10663
10323
|
}
|
|
10664
|
-
|
|
10665
10324
|
var _Schema$getGroupWrap = Schema.getGroupWrap(schema),
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10325
|
+
name = _Schema$getGroupWrap.name,
|
|
10326
|
+
vnodeData = _objectWithoutProperties(_Schema$getGroupWrap, _excluded$3);
|
|
10327
|
+
// todo: wrap组件不要透传ctx.data,不然会引起组件无限递归问题
|
|
10670
10328
|
return h(name, mergeDeep({
|
|
10671
10329
|
props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
|
|
10672
10330
|
value: Path.getPathVal(rootData, path),
|
|
@@ -10693,7 +10351,6 @@
|
|
|
10693
10351
|
props: props,
|
|
10694
10352
|
render: function render(h, ctx) {
|
|
10695
10353
|
var _ctx$props$schema;
|
|
10696
|
-
|
|
10697
10354
|
return h(StringField, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
|
|
10698
10355
|
props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
|
|
10699
10356
|
schema: mergeDeep({
|
|
@@ -10711,7 +10368,7 @@
|
|
|
10711
10368
|
});
|
|
10712
10369
|
|
|
10713
10370
|
var _excluded$2 = ["name"];
|
|
10714
|
-
|
|
10371
|
+
// 默认数组控件
|
|
10715
10372
|
var ArrayWidget = Vue__default["default"].extend({
|
|
10716
10373
|
name: 'ArrayWidget',
|
|
10717
10374
|
props: props,
|
|
@@ -10722,9 +10379,8 @@
|
|
|
10722
10379
|
// 补全minItems项
|
|
10723
10380
|
handleFillItem: function handleFillItem() {
|
|
10724
10381
|
var _this$schema$minItems = this.schema.minItems,
|
|
10725
|
-
|
|
10382
|
+
minItems = _this$schema$minItems === void 0 ? 0 : _this$schema$minItems;
|
|
10726
10383
|
var valueLen = this.value ? this.value.length : 0;
|
|
10727
|
-
|
|
10728
10384
|
if (valueLen < minItems) {
|
|
10729
10385
|
var data = Schema.getSchemaDefaultValue(this.schema.items);
|
|
10730
10386
|
var remainData = new Array(minItems - valueLen).fill(data);
|
|
@@ -10757,7 +10413,6 @@
|
|
|
10757
10413
|
},
|
|
10758
10414
|
render: function render(h) {
|
|
10759
10415
|
var _this = this;
|
|
10760
|
-
|
|
10761
10416
|
var self = this;
|
|
10762
10417
|
var arrVnodeList = (Array.isArray(this.value) ? this.value : []).map(function (_, index) {
|
|
10763
10418
|
var curPath = Path.getCurPath(_this.path, index);
|
|
@@ -10768,8 +10423,8 @@
|
|
|
10768
10423
|
path: curPath,
|
|
10769
10424
|
layout: _objectSpread2(_objectSpread2({}, _this.layout), {}, {
|
|
10770
10425
|
item: {} // todo: 暂时不支持数组项之间的布局
|
|
10771
|
-
|
|
10772
10426
|
}),
|
|
10427
|
+
|
|
10773
10428
|
removeable: true
|
|
10774
10429
|
}),
|
|
10775
10430
|
on: _objectSpread2(_objectSpread2({}, _this.$listeners), {}, {
|
|
@@ -10779,17 +10434,15 @@
|
|
|
10779
10434
|
})
|
|
10780
10435
|
});
|
|
10781
10436
|
});
|
|
10782
|
-
|
|
10783
10437
|
var _Schema$getGroupWrap = Schema.getGroupWrap(this.schema),
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10438
|
+
name = _Schema$getGroupWrap.name,
|
|
10439
|
+
vnode = _objectWithoutProperties(_Schema$getGroupWrap, _excluded$2);
|
|
10787
10440
|
return h(name, mergeDeep({
|
|
10788
10441
|
props: _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
10789
10442
|
layout: {},
|
|
10790
10443
|
showTitle: true // 数组类型默认展示分组title
|
|
10791
|
-
|
|
10792
10444
|
}),
|
|
10445
|
+
|
|
10793
10446
|
style: _objectSpread2({}, this.layout.item || {})
|
|
10794
10447
|
}, vnode), [].concat(_toConsumableArray(arrVnodeList), [h(registry.getBaseWidget('form-item'), {
|
|
10795
10448
|
class: {
|
|
@@ -10815,9 +10468,8 @@
|
|
|
10815
10468
|
props: props,
|
|
10816
10469
|
render: function render(h, ctx) {
|
|
10817
10470
|
var _ctx$props = ctx.props,
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10471
|
+
schema = _ctx$props.schema,
|
|
10472
|
+
path = _ctx$props.path;
|
|
10821
10473
|
if (Schema.isMultiSelect(schema) || Schema.isCustomArrayWidget(schema)) {
|
|
10822
10474
|
// 多选类型 或 自定义数组类型(伪数组类型(只有一个FormItem,但是值为数组,值一般由自定义Widget控件决定))
|
|
10823
10475
|
return h(Widget, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
|
|
@@ -10832,14 +10484,12 @@
|
|
|
10832
10484
|
}, ctx.props.schema)
|
|
10833
10485
|
})
|
|
10834
10486
|
}));
|
|
10835
|
-
}
|
|
10836
|
-
|
|
10837
|
-
|
|
10487
|
+
}
|
|
10488
|
+
// 元组类型
|
|
10838
10489
|
if (Schema.isTupleArray(schema)) {
|
|
10839
10490
|
var _Schema$getGroupWrap = Schema.getGroupWrap(schema),
|
|
10840
|
-
|
|
10841
|
-
|
|
10842
|
-
|
|
10491
|
+
name = _Schema$getGroupWrap.name,
|
|
10492
|
+
vnode = _objectWithoutProperties(_Schema$getGroupWrap, _excluded$1);
|
|
10843
10493
|
var tupleVnodeList = schema.items.map(function (item, index) {
|
|
10844
10494
|
return h(SchemaField, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
|
|
10845
10495
|
key: Path.getCurPath(path, index),
|
|
@@ -10855,9 +10505,8 @@
|
|
|
10855
10505
|
showTitle: true
|
|
10856
10506
|
})
|
|
10857
10507
|
}, vnode), _toConsumableArray(tupleVnodeList));
|
|
10858
|
-
}
|
|
10859
|
-
|
|
10860
|
-
|
|
10508
|
+
}
|
|
10509
|
+
// 一般数组类型
|
|
10861
10510
|
return h(ArrayWidget, _objectSpread2({}, ctx.data));
|
|
10862
10511
|
}
|
|
10863
10512
|
});
|
|
@@ -10868,10 +10517,8 @@
|
|
|
10868
10517
|
props: props,
|
|
10869
10518
|
render: function render(h, ctx) {
|
|
10870
10519
|
var _ref = ctx.props.schema['ui:component'] || {},
|
|
10871
|
-
|
|
10872
|
-
|
|
10520
|
+
name = _ref.name;
|
|
10873
10521
|
var widgetProps = {};
|
|
10874
|
-
|
|
10875
10522
|
if (['radio', 'select'].includes(name)) {
|
|
10876
10523
|
// radioGroup、select类型需要默认数据源
|
|
10877
10524
|
widgetProps = {
|
|
@@ -10885,13 +10532,11 @@
|
|
|
10885
10532
|
};
|
|
10886
10533
|
} else if (name === 'checkbox') {
|
|
10887
10534
|
var _ctx$props$schema;
|
|
10888
|
-
|
|
10889
10535
|
// boolean 类型checkbox
|
|
10890
10536
|
widgetProps = {
|
|
10891
10537
|
label: (_ctx$props$schema = ctx.props.schema) === null || _ctx$props$schema === void 0 ? void 0 : _ctx$props$schema.title
|
|
10892
10538
|
};
|
|
10893
10539
|
}
|
|
10894
|
-
|
|
10895
10540
|
return h(Widget, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
|
|
10896
10541
|
props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
|
|
10897
10542
|
schema: mergeDeep({
|
|
@@ -10923,10 +10568,9 @@
|
|
|
10923
10568
|
},
|
|
10924
10569
|
created: function created() {
|
|
10925
10570
|
var _this = this;
|
|
10926
|
-
|
|
10927
10571
|
// 初始化默认 composition 选项
|
|
10928
|
-
var compositionList = this.schema[this.composition] || [];
|
|
10929
|
-
|
|
10572
|
+
var compositionList = this.schema[this.composition] || [];
|
|
10573
|
+
// todo 没有required选项时回显不成功
|
|
10930
10574
|
var index = compositionList.findIndex(function (item) {
|
|
10931
10575
|
return ajv.validate(item, _this.value);
|
|
10932
10576
|
});
|
|
@@ -10934,24 +10578,20 @@
|
|
|
10934
10578
|
},
|
|
10935
10579
|
render: function render(h) {
|
|
10936
10580
|
var _this2 = this,
|
|
10937
|
-
|
|
10938
|
-
|
|
10581
|
+
_vnodeData$props;
|
|
10939
10582
|
var compositionList = this.schema[this.composition] || [];
|
|
10940
10583
|
var schemaList = compositionList.map(function (item) {
|
|
10941
10584
|
var data = mergeDeep({}, _this2.schema, item);
|
|
10942
10585
|
delete data[_this2.composition];
|
|
10943
10586
|
return data;
|
|
10944
10587
|
});
|
|
10945
|
-
|
|
10946
10588
|
var _Schema$getUiProps = Schema.getUiProps("ui:".concat(this.composition), this.schema),
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10589
|
+
_Schema$getUiProps$na = _Schema$getUiProps.name,
|
|
10590
|
+
com = _Schema$getUiProps$na === void 0 ? 'radio' : _Schema$getUiProps$na,
|
|
10591
|
+
vnodeData = _objectWithoutProperties(_Schema$getUiProps, _excluded);
|
|
10951
10592
|
var isConst = _typeof(this.schema.type) !== 'object' && schemaList.every(function (item) {
|
|
10952
10593
|
return item.const;
|
|
10953
10594
|
});
|
|
10954
|
-
|
|
10955
10595
|
if (isConst) {
|
|
10956
10596
|
// 全是常量
|
|
10957
10597
|
return h(Widget, {
|
|
@@ -10960,10 +10600,8 @@
|
|
|
10960
10600
|
on: _objectSpread2({}, this.$listeners)
|
|
10961
10601
|
});
|
|
10962
10602
|
}
|
|
10963
|
-
|
|
10964
10603
|
var _Schema$getUiProps2 = Schema.getUiProps('ui:composition', this.schema),
|
|
10965
|
-
|
|
10966
|
-
|
|
10604
|
+
compositionVnodeData = _extends$1({}, (_objectDestructuringEmpty(_Schema$getUiProps2), _Schema$getUiProps2));
|
|
10967
10605
|
return h(registry.getComponent('group'), mergeDeep({
|
|
10968
10606
|
props: _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
10969
10607
|
rootData: this.rootData,
|
|
@@ -10976,7 +10614,8 @@
|
|
|
10976
10614
|
_this2.$emit('remove', _this2.path);
|
|
10977
10615
|
}
|
|
10978
10616
|
}
|
|
10979
|
-
}, compositionVnodeData), [
|
|
10617
|
+
}, compositionVnodeData), [
|
|
10618
|
+
// anyOf component
|
|
10980
10619
|
h(registry.getBaseWidget('form-item'), {
|
|
10981
10620
|
props: {
|
|
10982
10621
|
label: (_vnodeData$props = vnodeData.props) === null || _vnodeData$props === void 0 ? void 0 : _vnodeData$props.title
|
|
@@ -10996,24 +10635,21 @@
|
|
|
10996
10635
|
},
|
|
10997
10636
|
on: {
|
|
10998
10637
|
input: function input(index) {
|
|
10999
|
-
_this2.activeIndex = index;
|
|
11000
|
-
|
|
10638
|
+
_this2.activeIndex = index;
|
|
10639
|
+
// todo 删除其他 composition 字段
|
|
11001
10640
|
if (isObj(_this2.value)) {
|
|
11002
10641
|
var newValue = JSON.parse(JSON.stringify(_this2.value));
|
|
11003
|
-
|
|
11004
10642
|
var _props = compositionList.filter(function (_, index) {
|
|
11005
10643
|
return index !== _this2.activeIndex;
|
|
11006
10644
|
}).reduce(function (pre, item) {
|
|
11007
10645
|
var _item$properties = item.properties,
|
|
11008
|
-
|
|
10646
|
+
properties = _item$properties === void 0 ? {} : _item$properties;
|
|
11009
10647
|
pre.push.apply(pre, _toConsumableArray(Object.keys(properties)));
|
|
11010
10648
|
return pre;
|
|
11011
10649
|
}, []);
|
|
11012
|
-
|
|
11013
10650
|
_props.forEach(function (prop) {
|
|
11014
10651
|
delete newValue[prop];
|
|
11015
10652
|
});
|
|
11016
|
-
|
|
11017
10653
|
_this2.$emit('input', {
|
|
11018
10654
|
path: _this2.path,
|
|
11019
10655
|
value: newValue
|
|
@@ -11021,7 +10657,8 @@
|
|
|
11021
10657
|
}
|
|
11022
10658
|
}
|
|
11023
10659
|
}
|
|
11024
|
-
}, vnodeData || {}))]),
|
|
10660
|
+
}, vnodeData || {}))]),
|
|
10661
|
+
// schema
|
|
11025
10662
|
h(SchemaField, {
|
|
11026
10663
|
key: this.activeIndex,
|
|
11027
10664
|
props: _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
@@ -11062,7 +10699,6 @@
|
|
|
11062
10699
|
},
|
|
11063
10700
|
render: function render(h) {
|
|
11064
10701
|
var _this = this;
|
|
11065
|
-
|
|
11066
10702
|
return Array.isArray(this.value) ? h(registry.getBaseWidget('checkbox-group'), {
|
|
11067
10703
|
on: {
|
|
11068
10704
|
change: this.handleChange
|
|
@@ -11168,7 +10804,6 @@
|
|
|
11168
10804
|
},
|
|
11169
10805
|
render: function render(h) {
|
|
11170
10806
|
var _this = this;
|
|
11171
|
-
|
|
11172
10807
|
return h(registry.getBaseWidget('radio-group'), {
|
|
11173
10808
|
props: _objectSpread2({
|
|
11174
10809
|
value: this.value
|
|
@@ -11219,8 +10854,8 @@
|
|
|
11219
10854
|
}
|
|
11220
10855
|
});
|
|
11221
10856
|
|
|
10857
|
+
// @todo widgetTree添加单行node,内置导入、导出功能
|
|
11222
10858
|
// 获取表格单行默认值
|
|
11223
|
-
|
|
11224
10859
|
var getRowDefaultData = function getRowDefaultData() {
|
|
11225
10860
|
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11226
10861
|
var keys = Object.keys(properties);
|
|
@@ -11230,7 +10865,6 @@
|
|
|
11230
10865
|
});
|
|
11231
10866
|
return [data];
|
|
11232
10867
|
};
|
|
11233
|
-
|
|
11234
10868
|
var TableWidget = Vue__default["default"].extend({
|
|
11235
10869
|
name: 'TableWidget',
|
|
11236
10870
|
props: props,
|
|
@@ -11238,7 +10872,7 @@
|
|
|
11238
10872
|
// 单元格表单编辑
|
|
11239
10873
|
handleCellValChange: function handleCellValChange(_ref) {
|
|
11240
10874
|
var path = _ref.path,
|
|
11241
|
-
|
|
10875
|
+
value = _ref.value;
|
|
11242
10876
|
var subPath = Path.getSubPath(this.path, path);
|
|
11243
10877
|
var newValue = Path.setPathValue(this.value, subPath, value);
|
|
11244
10878
|
this.$emit('input', newValue);
|
|
@@ -11246,7 +10880,6 @@
|
|
|
11246
10880
|
// 新增
|
|
11247
10881
|
handleAddRow: function handleAddRow(index) {
|
|
11248
10882
|
var _this$$props$schema$i;
|
|
11249
|
-
|
|
11250
10883
|
var newValue = this.value.slice(0);
|
|
11251
10884
|
newValue.splice.apply(newValue, [index + 1, 0].concat(_toConsumableArray(getRowDefaultData((_this$$props$schema$i = this.$props.schema.items) === null || _this$$props$schema$i === void 0 ? void 0 : _this$$props$schema$i.properties))));
|
|
11252
10885
|
this.$emit('input', newValue);
|
|
@@ -11260,19 +10893,17 @@
|
|
|
11260
10893
|
},
|
|
11261
10894
|
render: function render(h) {
|
|
11262
10895
|
var _schema$items,
|
|
11263
|
-
|
|
11264
|
-
|
|
10896
|
+
_this = this;
|
|
11265
10897
|
var self = this;
|
|
11266
10898
|
var _this$$props = this.$props,
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
10899
|
+
schema = _this$$props.schema,
|
|
10900
|
+
readonly = _this$$props.readonly,
|
|
10901
|
+
readonlyMode = _this$$props.readonlyMode,
|
|
10902
|
+
path = _this$$props.path,
|
|
10903
|
+
context = _this$$props.context,
|
|
10904
|
+
rootData = _this$$props.rootData,
|
|
10905
|
+
value = _this$$props.value;
|
|
11274
10906
|
var columnsKey = Object.keys(((_schema$items = schema.items) === null || _schema$items === void 0 ? void 0 : _schema$items.properties) || []);
|
|
11275
|
-
|
|
11276
10907
|
var getTableColumn = function getTableColumn() {
|
|
11277
10908
|
var VNodeList = columnsKey.map(function (key) {
|
|
11278
10909
|
var colField = schema.items.properties[key];
|
|
@@ -11309,7 +10940,6 @@
|
|
|
11309
10940
|
}
|
|
11310
10941
|
});
|
|
11311
10942
|
});
|
|
11312
|
-
|
|
11313
10943
|
if (!_this.readonly) {
|
|
11314
10944
|
VNodeList.push(h(registry.getBaseWidget('table-column'), {
|
|
11315
10945
|
props: {
|
|
@@ -11339,10 +10969,8 @@
|
|
|
11339
10969
|
}
|
|
11340
10970
|
}));
|
|
11341
10971
|
}
|
|
11342
|
-
|
|
11343
10972
|
return VNodeList;
|
|
11344
10973
|
};
|
|
11345
|
-
|
|
11346
10974
|
return h(registry.getBaseWidget('table'), {
|
|
11347
10975
|
props: _objectSpread2(_objectSpread2({}, schema['ui:component'].props || {}), {}, {
|
|
11348
10976
|
data: value
|
|
@@ -11350,7 +10978,7 @@
|
|
|
11350
10978
|
on: {
|
|
11351
10979
|
input: function input(_ref2) {
|
|
11352
10980
|
var path = _ref2.path,
|
|
11353
|
-
|
|
10981
|
+
value = _ref2.value;
|
|
11354
10982
|
self.$emit('input', {
|
|
11355
10983
|
path: path,
|
|
11356
10984
|
value: value
|
|
@@ -11361,8 +10989,8 @@
|
|
|
11361
10989
|
empty: function empty() {
|
|
11362
10990
|
return _this.readonly ? null : h('div', {
|
|
11363
10991
|
style: {
|
|
11364
|
-
|
|
11365
|
-
|
|
10992
|
+
color: '#3a84ff',
|
|
10993
|
+
cursor: 'pointer'
|
|
11366
10994
|
},
|
|
11367
10995
|
on: {
|
|
11368
10996
|
click: function click() {
|
|
@@ -11446,25 +11074,21 @@
|
|
|
11446
11074
|
},
|
|
11447
11075
|
render: function render(h) {
|
|
11448
11076
|
var _this$layout,
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11077
|
+
_this$layout2,
|
|
11078
|
+
_this$schema,
|
|
11079
|
+
_this$layout3,
|
|
11080
|
+
_this = this;
|
|
11454
11081
|
var schemaFormStyle = _objectSpread2({
|
|
11455
11082
|
position: 'relative',
|
|
11456
11083
|
border: this.border ? '1px solid #dcdee5' : 'none',
|
|
11457
11084
|
display: !this.state.visible ? 'none' : ''
|
|
11458
11085
|
}, ((_this$layout = this.layout) === null || _this$layout === void 0 ? void 0 : _this$layout.item) || {});
|
|
11459
|
-
|
|
11460
11086
|
var groupContentStyle = _objectSpread2({}, ((_this$layout2 = this.layout) === null || _this$layout2 === void 0 ? void 0 : _this$layout2.container) || {
|
|
11461
11087
|
display: 'grid',
|
|
11462
11088
|
gridGap: '20px' // 未设置layout的布局组的默认样式
|
|
11463
|
-
|
|
11464
11089
|
});
|
|
11465
11090
|
|
|
11466
11091
|
var self = this;
|
|
11467
|
-
|
|
11468
11092
|
var renderDelete = function renderDelete() {
|
|
11469
11093
|
return h('span', {
|
|
11470
11094
|
class: ['bk-schema-form-group-delete'],
|
|
@@ -11481,7 +11105,6 @@
|
|
|
11481
11105
|
class: ['bk-icon icon-close3-shape']
|
|
11482
11106
|
})]);
|
|
11483
11107
|
};
|
|
11484
|
-
|
|
11485
11108
|
var title = ((_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : _this$schema.title) || ((_this$layout3 = this.layout) === null || _this$layout3 === void 0 ? void 0 : _this$layout3.prop);
|
|
11486
11109
|
var groupErrorTipsContent = Object.keys(this.groupErrorTips).map(function (widgetPath) {
|
|
11487
11110
|
return h("p", [_this.groupErrorTips[widgetPath]]);
|
|
@@ -11507,17 +11130,17 @@
|
|
|
11507
11130
|
}
|
|
11508
11131
|
});
|
|
11509
11132
|
|
|
11510
|
-
function _extends(){return _extends=Object.assign
|
|
11133
|
+
function _extends(){return _extends=Object.assign?Object.assign.bind():function(a){for(var b,c=1;c<arguments.length;c++)for(var d in b=arguments[c],b)Object.prototype.hasOwnProperty.call(b,d)&&(a[d]=b[d]);return a},_extends.apply(this,arguments)}var normalMerge=["attrs","props","domProps"],toArrayMerge=["class","style","directives"],functionalMerge=["on","nativeOn"],mergeJsxProps=function(a){return a.reduce(function(c,a){for(var b in a)if(!c[b])c[b]=a[b];else if(-1!==normalMerge.indexOf(b))c[b]=_extends({},c[b],a[b]);else if(-1!==toArrayMerge.indexOf(b)){var d=c[b]instanceof Array?c[b]:[c[b]],e=a[b]instanceof Array?a[b]:[a[b]];c[b]=[].concat(d,e);}else if(-1!==functionalMerge.indexOf(b)){for(var f in a[b])if(c[b][f]){var g=c[b][f]instanceof Array?c[b][f]:[c[b][f]],h=a[b][f]instanceof Array?a[b][f]:[a[b][f]];c[b][f]=[].concat(g,h);}else c[b][f]=a[b][f];}else if("hook"===b)for(var i in a[b])c[b][i]=c[b][i]?mergeFn(c[b][i],a[b][i]):a[b][i];else c[b]=a[b];return c},{})},mergeFn=function(a,b){return function(){a&&a.apply(this,arguments),b&&b.apply(this,arguments);}};var helper=mergeJsxProps;
|
|
11511
11134
|
|
|
11135
|
+
// 伪数组类型
|
|
11512
11136
|
var KeyValueArrayWidget = Vue__default["default"].extend({
|
|
11513
11137
|
name: 'KeyValueArrayWidget',
|
|
11514
11138
|
props: _objectSpread2({}, props),
|
|
11515
11139
|
mounted: function mounted() {
|
|
11516
11140
|
var _this$value;
|
|
11517
|
-
|
|
11518
11141
|
var _this$schema$minItems = this.schema.minItems,
|
|
11519
|
-
|
|
11520
|
-
|
|
11142
|
+
minItems = _this$schema$minItems === void 0 ? 0 : _this$schema$minItems;
|
|
11143
|
+
// 补全minItems项
|
|
11521
11144
|
if (((_this$value = this.value) === null || _this$value === void 0 ? void 0 : _this$value.length) < minItems) {
|
|
11522
11145
|
var data = Schema.getSchemaDefaultValue(this.schema.items);
|
|
11523
11146
|
var remainData = new Array(minItems - this.value.length).fill(data);
|
|
@@ -11538,7 +11161,7 @@
|
|
|
11538
11161
|
},
|
|
11539
11162
|
handleInput: function handleInput(_ref) {
|
|
11540
11163
|
var path = _ref.path,
|
|
11541
|
-
|
|
11164
|
+
value = _ref.value;
|
|
11542
11165
|
// 捕获widget input事件,包装继续传给上一层处理
|
|
11543
11166
|
var subPath = Path.getSubPath(this.path, path);
|
|
11544
11167
|
var newValue = Path.setPathValue(this.value, subPath, value);
|
|
@@ -11547,12 +11170,11 @@
|
|
|
11547
11170
|
},
|
|
11548
11171
|
render: function render(h) {
|
|
11549
11172
|
var _this$schema,
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
|
|
11173
|
+
_this$schema$items,
|
|
11174
|
+
_this$schema2,
|
|
11175
|
+
_this$schema2$items,
|
|
11176
|
+
_this = this,
|
|
11177
|
+
_this$value2;
|
|
11556
11178
|
var labelBtnStyle = {
|
|
11557
11179
|
'font-size': '16px',
|
|
11558
11180
|
color: '#979ba5',
|
|
@@ -11560,22 +11182,20 @@
|
|
|
11560
11182
|
display: 'inline-block'
|
|
11561
11183
|
};
|
|
11562
11184
|
var properties = (_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : (_this$schema$items = _this$schema.items) === null || _this$schema$items === void 0 ? void 0 : _this$schema$items.properties;
|
|
11563
|
-
var props = orderProperties(Object.keys(properties || {}), (_this$schema2 = this.schema) === null || _this$schema2 === void 0 ? void 0 : (_this$schema2$items = _this$schema2.items) === null || _this$schema2$items === void 0 ? void 0 : _this$schema2$items['ui:order']);
|
|
11564
|
-
|
|
11185
|
+
var props = orderProperties(Object.keys(properties || {}), (_this$schema2 = this.schema) === null || _this$schema2 === void 0 ? void 0 : (_this$schema2$items = _this$schema2.items) === null || _this$schema2$items === void 0 ? void 0 : _this$schema2$items['ui:order']);
|
|
11186
|
+
// props为空时,表示只有一个项
|
|
11565
11187
|
var keysLen = Object.keys(properties || {}).length;
|
|
11566
11188
|
var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
|
|
11567
|
-
|
|
11568
11189
|
var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
|
|
11569
11190
|
display: 'grid',
|
|
11570
11191
|
gridGap: '20px',
|
|
11571
11192
|
'grid-template-columns': defaultCols // 默认配置
|
|
11572
|
-
|
|
11573
11193
|
});
|
|
11574
11194
|
|
|
11575
11195
|
var self = this;
|
|
11576
|
-
|
|
11577
11196
|
var dealSchema = function dealSchema(schema) {
|
|
11578
|
-
return (
|
|
11197
|
+
return (
|
|
11198
|
+
// 处理当前控件默认Schema配置逻辑
|
|
11579
11199
|
mergeDeep({
|
|
11580
11200
|
'ui:component': {
|
|
11581
11201
|
props: {
|
|
@@ -11591,12 +11211,11 @@
|
|
|
11591
11211
|
}, schema)
|
|
11592
11212
|
);
|
|
11593
11213
|
};
|
|
11594
|
-
|
|
11595
11214
|
var renderSchemaField = function renderSchemaField(data) {
|
|
11596
11215
|
var path = data.path,
|
|
11597
|
-
|
|
11598
|
-
|
|
11599
|
-
|
|
11216
|
+
schema = data.schema,
|
|
11217
|
+
required = data.required,
|
|
11218
|
+
layout = data.layout;
|
|
11600
11219
|
return h(SchemaField, {
|
|
11601
11220
|
key: path,
|
|
11602
11221
|
props: _objectSpread2(_objectSpread2({}, _this.$props), {}, {
|
|
@@ -11615,10 +11234,8 @@
|
|
|
11615
11234
|
}
|
|
11616
11235
|
});
|
|
11617
11236
|
};
|
|
11618
|
-
|
|
11619
11237
|
return h("div", [(_this$value2 = this.value) === null || _this$value2 === void 0 ? void 0 : _this$value2.map(function (_, index) {
|
|
11620
11238
|
var _this$schema4;
|
|
11621
|
-
|
|
11622
11239
|
var groupPath = Path.getCurPath(_this.path, "".concat(index));
|
|
11623
11240
|
return h(FieldGroupWrap, helper([{}, {
|
|
11624
11241
|
"props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
|
|
@@ -11631,7 +11248,6 @@
|
|
|
11631
11248
|
})
|
|
11632
11249
|
}]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
|
|
11633
11250
|
var _this$schema3, _this$schema3$items;
|
|
11634
|
-
|
|
11635
11251
|
var schemaItem = (_this$schema3 = _this.schema) === null || _this$schema3 === void 0 ? void 0 : (_this$schema3$items = _this$schema3.items) === null || _this$schema3$items === void 0 ? void 0 : _this$schema3$items.properties[prop];
|
|
11636
11252
|
var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
|
|
11637
11253
|
var lastProp = curPath.split('.').pop();
|
|
@@ -11693,16 +11309,14 @@
|
|
|
11693
11309
|
}),
|
|
11694
11310
|
render: function render(h) {
|
|
11695
11311
|
var _this$schema,
|
|
11696
|
-
|
|
11697
|
-
|
|
11312
|
+
_this = this;
|
|
11698
11313
|
var groupWrapProps = _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
11699
11314
|
layout: _objectSpread2(_objectSpread2({}, this.layout), {}, {
|
|
11700
11315
|
container: {} // Tab组的容器layout由panel内容控制
|
|
11701
|
-
|
|
11702
11316
|
}),
|
|
11317
|
+
|
|
11703
11318
|
title: this.schema.title
|
|
11704
11319
|
});
|
|
11705
|
-
|
|
11706
11320
|
var self = this;
|
|
11707
11321
|
var properties = orderProperties(Object.keys(((_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : _this$schema.properties) || {}), this.schema['ui:order']);
|
|
11708
11322
|
return h(FieldGroupWrap, {
|
|
@@ -11714,7 +11328,6 @@
|
|
|
11714
11328
|
}
|
|
11715
11329
|
}, [h(registry.getBaseWidget('tab'), {}, properties.map(function (key) {
|
|
11716
11330
|
var _this$schema2, _this$schema2$propert;
|
|
11717
|
-
|
|
11718
11331
|
var schemaItem = (_this$schema2 = _this.schema) === null || _this$schema2 === void 0 ? void 0 : (_this$schema2$propert = _this$schema2.properties) === null || _this$schema2$propert === void 0 ? void 0 : _this$schema2$propert[key];
|
|
11719
11332
|
var curPath = Path.getCurPath(_this.path, key);
|
|
11720
11333
|
var lastProp = curPath.split('.').pop();
|
|
@@ -11733,8 +11346,8 @@
|
|
|
11733
11346
|
path: curPath,
|
|
11734
11347
|
layout: layoutConfig,
|
|
11735
11348
|
removeable: false // todo: 不往下传递可删除属性
|
|
11736
|
-
|
|
11737
11349
|
}),
|
|
11350
|
+
|
|
11738
11351
|
on: _objectSpread2({}, _this.$listeners)
|
|
11739
11352
|
})]);
|
|
11740
11353
|
}))]);
|
|
@@ -11777,8 +11390,7 @@
|
|
|
11777
11390
|
},
|
|
11778
11391
|
render: function render(h) {
|
|
11779
11392
|
var _this$schema,
|
|
11780
|
-
|
|
11781
|
-
|
|
11393
|
+
_this = this;
|
|
11782
11394
|
var collapseStyle = {};
|
|
11783
11395
|
var collapseTitleStyle = {
|
|
11784
11396
|
background: '#f5f7fa',
|
|
@@ -11793,19 +11405,16 @@
|
|
|
11793
11405
|
display: 'inline-block',
|
|
11794
11406
|
transition: 'all 0.5s ease'
|
|
11795
11407
|
};
|
|
11796
|
-
|
|
11797
11408
|
var groupWrapProps = _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
11798
11409
|
layout: _objectSpread2(_objectSpread2({}, this.layout), {}, {
|
|
11799
11410
|
container: {} // Tab组的容器layout由panel内容控制
|
|
11800
|
-
|
|
11801
11411
|
}),
|
|
11412
|
+
|
|
11802
11413
|
title: this.schema.title
|
|
11803
11414
|
});
|
|
11804
|
-
|
|
11805
11415
|
var properties = orderProperties(Object.keys(((_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : _this$schema.properties) || {}), this.schema['ui:order']);
|
|
11806
11416
|
var collapseItems = properties.map(function (key) {
|
|
11807
11417
|
var _this$schema2, _this$schema2$propert;
|
|
11808
|
-
|
|
11809
11418
|
var schemaItem = (_this$schema2 = _this.schema) === null || _this$schema2 === void 0 ? void 0 : (_this$schema2$propert = _this$schema2.properties) === null || _this$schema2$propert === void 0 ? void 0 : _this$schema2$propert[key];
|
|
11810
11419
|
var curPath = Path.getCurPath(_this.path, key);
|
|
11811
11420
|
var lastProp = curPath.split('.').pop();
|
|
@@ -11834,8 +11443,8 @@
|
|
|
11834
11443
|
path: curPath,
|
|
11835
11444
|
layout: layoutConfig,
|
|
11836
11445
|
removeable: false // todo: 不往下传递可删除属性
|
|
11837
|
-
|
|
11838
11446
|
}),
|
|
11447
|
+
|
|
11839
11448
|
on: _objectSpread2({}, _this.$listeners)
|
|
11840
11449
|
})])]);
|
|
11841
11450
|
});
|
|
@@ -12015,10 +11624,10 @@
|
|
|
12015
11624
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12016
11625
|
var options = mergeDeep(defaultOptions, opts);
|
|
12017
11626
|
var namespace = options.namespace,
|
|
12018
|
-
|
|
12019
|
-
|
|
12020
|
-
|
|
12021
|
-
|
|
11627
|
+
components = options.components,
|
|
11628
|
+
fields = options.fields,
|
|
11629
|
+
_options$baseWidgets = options.baseWidgets,
|
|
11630
|
+
baseWidgets = _options$baseWidgets === void 0 ? {} : _options$baseWidgets;
|
|
12022
11631
|
Registry.namespace = namespace;
|
|
12023
11632
|
registry.addComponentsMap(components);
|
|
12024
11633
|
registry.addFieldsMap(fields);
|
|
@@ -12042,7 +11651,6 @@
|
|
|
12042
11651
|
context: {
|
|
12043
11652
|
handler: function handler(ctx) {
|
|
12044
11653
|
Registry.context = ctx;
|
|
12045
|
-
|
|
12046
11654
|
if (hasOwnProperty(ctx, 'rules')) {
|
|
12047
11655
|
registryGlobalRules(ctx.rules);
|
|
12048
11656
|
}
|
|
@@ -12110,9 +11718,8 @@
|
|
|
12110
11718
|
on: {
|
|
12111
11719
|
input: function input(_ref) {
|
|
12112
11720
|
var _ref$path = _ref.path,
|
|
12113
|
-
|
|
12114
|
-
|
|
12115
|
-
|
|
11721
|
+
path = _ref$path === void 0 ? '' : _ref$path,
|
|
11722
|
+
value = _ref.value;
|
|
12116
11723
|
if (!path) {
|
|
12117
11724
|
// console.warn('set rootData');
|
|
12118
11725
|
self.emitFormValueChange(value, self.value);
|