@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-es.js
CHANGED
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
import Vue from 'vue';
|
|
2
2
|
|
|
3
|
+
function _iterableToArrayLimit(arr, i) {
|
|
4
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
5
|
+
if (null != _i) {
|
|
6
|
+
var _s,
|
|
7
|
+
_e,
|
|
8
|
+
_x,
|
|
9
|
+
_r,
|
|
10
|
+
_arr = [],
|
|
11
|
+
_n = !0,
|
|
12
|
+
_d = !1;
|
|
13
|
+
try {
|
|
14
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
15
|
+
if (Object(_i) !== _i) return;
|
|
16
|
+
_n = !1;
|
|
17
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
18
|
+
} catch (err) {
|
|
19
|
+
_d = !0, _e = err;
|
|
20
|
+
} finally {
|
|
21
|
+
try {
|
|
22
|
+
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
|
|
23
|
+
} finally {
|
|
24
|
+
if (_d) throw _e;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return _arr;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
3
30
|
function ownKeys(object, enumerableOnly) {
|
|
4
31
|
var keys = Object.keys(object);
|
|
5
|
-
|
|
6
32
|
if (Object.getOwnPropertySymbols) {
|
|
7
33
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
8
34
|
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
9
35
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
10
36
|
})), keys.push.apply(keys, symbols);
|
|
11
37
|
}
|
|
12
|
-
|
|
13
38
|
return keys;
|
|
14
39
|
}
|
|
15
|
-
|
|
16
40
|
function _objectSpread2(target) {
|
|
17
41
|
for (var i = 1; i < arguments.length; i++) {
|
|
18
42
|
var source = null != arguments[i] ? arguments[i] : {};
|
|
@@ -22,25 +46,22 @@ function _objectSpread2(target) {
|
|
|
22
46
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
23
47
|
});
|
|
24
48
|
}
|
|
25
|
-
|
|
26
49
|
return target;
|
|
27
50
|
}
|
|
28
|
-
|
|
29
51
|
function _regeneratorRuntime() {
|
|
30
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
31
|
-
|
|
32
52
|
_regeneratorRuntime = function () {
|
|
33
53
|
return exports;
|
|
34
54
|
};
|
|
35
|
-
|
|
36
55
|
var exports = {},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
56
|
+
Op = Object.prototype,
|
|
57
|
+
hasOwn = Op.hasOwnProperty,
|
|
58
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
59
|
+
obj[key] = desc.value;
|
|
60
|
+
},
|
|
61
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
62
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
63
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
64
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
44
65
|
function define(obj, key, value) {
|
|
45
66
|
return Object.defineProperty(obj, key, {
|
|
46
67
|
value: value,
|
|
@@ -49,7 +70,6 @@ function _regeneratorRuntime() {
|
|
|
49
70
|
writable: !0
|
|
50
71
|
}), obj[key];
|
|
51
72
|
}
|
|
52
|
-
|
|
53
73
|
try {
|
|
54
74
|
define({}, "");
|
|
55
75
|
} catch (err) {
|
|
@@ -57,54 +77,14 @@ function _regeneratorRuntime() {
|
|
|
57
77
|
return obj[key] = value;
|
|
58
78
|
};
|
|
59
79
|
}
|
|
60
|
-
|
|
61
80
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
62
81
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return generator
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
69
|
-
|
|
70
|
-
if ("completed" === state) {
|
|
71
|
-
if ("throw" === method) throw arg;
|
|
72
|
-
return doneResult();
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
for (context.method = method, context.arg = arg;;) {
|
|
76
|
-
var delegate = context.delegate;
|
|
77
|
-
|
|
78
|
-
if (delegate) {
|
|
79
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
80
|
-
|
|
81
|
-
if (delegateResult) {
|
|
82
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
83
|
-
return delegateResult;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
88
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
89
|
-
context.dispatchException(context.arg);
|
|
90
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
91
|
-
state = "executing";
|
|
92
|
-
var record = tryCatch(innerFn, self, context);
|
|
93
|
-
|
|
94
|
-
if ("normal" === record.type) {
|
|
95
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
96
|
-
return {
|
|
97
|
-
value: record.arg,
|
|
98
|
-
done: context.done
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}(innerFn, self, context), generator;
|
|
82
|
+
generator = Object.create(protoGenerator.prototype),
|
|
83
|
+
context = new Context(tryLocsList || []);
|
|
84
|
+
return defineProperty(generator, "_invoke", {
|
|
85
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
86
|
+
}), generator;
|
|
106
87
|
}
|
|
107
|
-
|
|
108
88
|
function tryCatch(fn, obj, arg) {
|
|
109
89
|
try {
|
|
110
90
|
return {
|
|
@@ -118,25 +98,19 @@ function _regeneratorRuntime() {
|
|
|
118
98
|
};
|
|
119
99
|
}
|
|
120
100
|
}
|
|
121
|
-
|
|
122
101
|
exports.wrap = wrap;
|
|
123
102
|
var ContinueSentinel = {};
|
|
124
|
-
|
|
125
103
|
function Generator() {}
|
|
126
|
-
|
|
127
104
|
function GeneratorFunction() {}
|
|
128
|
-
|
|
129
105
|
function GeneratorFunctionPrototype() {}
|
|
130
|
-
|
|
131
106
|
var IteratorPrototype = {};
|
|
132
107
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
133
108
|
return this;
|
|
134
109
|
});
|
|
135
110
|
var getProto = Object.getPrototypeOf,
|
|
136
|
-
|
|
111
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
137
112
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
138
113
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
139
|
-
|
|
140
114
|
function defineIteratorMethods(prototype) {
|
|
141
115
|
["next", "throw", "return"].forEach(function (method) {
|
|
142
116
|
define(prototype, method, function (arg) {
|
|
@@ -144,14 +118,12 @@ function _regeneratorRuntime() {
|
|
|
144
118
|
});
|
|
145
119
|
});
|
|
146
120
|
}
|
|
147
|
-
|
|
148
121
|
function AsyncIterator(generator, PromiseImpl) {
|
|
149
122
|
function invoke(method, arg, resolve, reject) {
|
|
150
123
|
var record = tryCatch(generator[method], generator, arg);
|
|
151
|
-
|
|
152
124
|
if ("throw" !== record.type) {
|
|
153
125
|
var result = record.arg,
|
|
154
|
-
|
|
126
|
+
value = result.value;
|
|
155
127
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
156
128
|
invoke("next", value, resolve, reject);
|
|
157
129
|
}, function (err) {
|
|
@@ -162,90 +134,109 @@ function _regeneratorRuntime() {
|
|
|
162
134
|
return invoke("throw", error, resolve, reject);
|
|
163
135
|
});
|
|
164
136
|
}
|
|
165
|
-
|
|
166
137
|
reject(record.arg);
|
|
167
138
|
}
|
|
168
|
-
|
|
169
139
|
var previousPromise;
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
140
|
+
defineProperty(this, "_invoke", {
|
|
141
|
+
value: function (method, arg) {
|
|
142
|
+
function callInvokeWithMethodAndArg() {
|
|
143
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
144
|
+
invoke(method, arg, resolve, reject);
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
152
|
+
var state = "suspendedStart";
|
|
153
|
+
return function (method, arg) {
|
|
154
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
155
|
+
if ("completed" === state) {
|
|
156
|
+
if ("throw" === method) throw arg;
|
|
157
|
+
return doneResult();
|
|
158
|
+
}
|
|
159
|
+
for (context.method = method, context.arg = arg;;) {
|
|
160
|
+
var delegate = context.delegate;
|
|
161
|
+
if (delegate) {
|
|
162
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
163
|
+
if (delegateResult) {
|
|
164
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
165
|
+
return delegateResult;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
169
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
170
|
+
context.dispatchException(context.arg);
|
|
171
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
172
|
+
state = "executing";
|
|
173
|
+
var record = tryCatch(innerFn, self, context);
|
|
174
|
+
if ("normal" === record.type) {
|
|
175
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
176
|
+
return {
|
|
177
|
+
value: record.arg,
|
|
178
|
+
done: context.done
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
176
182
|
}
|
|
177
|
-
|
|
178
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
179
183
|
};
|
|
180
184
|
}
|
|
181
|
-
|
|
182
185
|
function maybeInvokeDelegate(delegate, context) {
|
|
183
|
-
var
|
|
184
|
-
|
|
185
|
-
if (undefined === method)
|
|
186
|
-
if (context.delegate = null, "throw" === context.method) {
|
|
187
|
-
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
188
|
-
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
return ContinueSentinel;
|
|
192
|
-
}
|
|
193
|
-
|
|
186
|
+
var methodName = context.method,
|
|
187
|
+
method = delegate.iterator[methodName];
|
|
188
|
+
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;
|
|
194
189
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
195
190
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
196
191
|
var info = record.arg;
|
|
197
192
|
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);
|
|
198
193
|
}
|
|
199
|
-
|
|
200
194
|
function pushTryEntry(locs) {
|
|
201
195
|
var entry = {
|
|
202
196
|
tryLoc: locs[0]
|
|
203
197
|
};
|
|
204
198
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
205
199
|
}
|
|
206
|
-
|
|
207
200
|
function resetTryEntry(entry) {
|
|
208
201
|
var record = entry.completion || {};
|
|
209
202
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
210
203
|
}
|
|
211
|
-
|
|
212
204
|
function Context(tryLocsList) {
|
|
213
205
|
this.tryEntries = [{
|
|
214
206
|
tryLoc: "root"
|
|
215
207
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
216
208
|
}
|
|
217
|
-
|
|
218
209
|
function values(iterable) {
|
|
219
210
|
if (iterable) {
|
|
220
211
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
221
212
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
222
213
|
if ("function" == typeof iterable.next) return iterable;
|
|
223
|
-
|
|
224
214
|
if (!isNaN(iterable.length)) {
|
|
225
215
|
var i = -1,
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
};
|
|
231
|
-
|
|
216
|
+
next = function next() {
|
|
217
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
218
|
+
return next.value = undefined, next.done = !0, next;
|
|
219
|
+
};
|
|
232
220
|
return next.next = next;
|
|
233
221
|
}
|
|
234
222
|
}
|
|
235
|
-
|
|
236
223
|
return {
|
|
237
224
|
next: doneResult
|
|
238
225
|
};
|
|
239
226
|
}
|
|
240
|
-
|
|
241
227
|
function doneResult() {
|
|
242
228
|
return {
|
|
243
229
|
value: undefined,
|
|
244
230
|
done: !0
|
|
245
231
|
};
|
|
246
232
|
}
|
|
247
|
-
|
|
248
|
-
|
|
233
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
234
|
+
value: GeneratorFunctionPrototype,
|
|
235
|
+
configurable: !0
|
|
236
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
237
|
+
value: GeneratorFunction,
|
|
238
|
+
configurable: !0
|
|
239
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
249
240
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
250
241
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
251
242
|
}, exports.mark = function (genFun) {
|
|
@@ -266,17 +257,15 @@ function _regeneratorRuntime() {
|
|
|
266
257
|
return this;
|
|
267
258
|
}), define(Gp, "toString", function () {
|
|
268
259
|
return "[object Generator]";
|
|
269
|
-
}), exports.keys = function (
|
|
270
|
-
var
|
|
271
|
-
|
|
260
|
+
}), exports.keys = function (val) {
|
|
261
|
+
var object = Object(val),
|
|
262
|
+
keys = [];
|
|
272
263
|
for (var key in object) keys.push(key);
|
|
273
|
-
|
|
274
264
|
return keys.reverse(), function next() {
|
|
275
265
|
for (; keys.length;) {
|
|
276
266
|
var key = keys.pop();
|
|
277
267
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
278
268
|
}
|
|
279
|
-
|
|
280
269
|
return next.done = !0, next;
|
|
281
270
|
};
|
|
282
271
|
}, exports.values = values, Context.prototype = {
|
|
@@ -293,20 +282,16 @@ function _regeneratorRuntime() {
|
|
|
293
282
|
dispatchException: function (exception) {
|
|
294
283
|
if (this.done) throw exception;
|
|
295
284
|
var context = this;
|
|
296
|
-
|
|
297
285
|
function handle(loc, caught) {
|
|
298
286
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
299
287
|
}
|
|
300
|
-
|
|
301
288
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
302
289
|
var entry = this.tryEntries[i],
|
|
303
|
-
|
|
290
|
+
record = entry.completion;
|
|
304
291
|
if ("root" === entry.tryLoc) return handle("end");
|
|
305
|
-
|
|
306
292
|
if (entry.tryLoc <= this.prev) {
|
|
307
293
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
308
|
-
|
|
309
|
-
|
|
294
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
310
295
|
if (hasCatch && hasFinally) {
|
|
311
296
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
312
297
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -322,13 +307,11 @@ function _regeneratorRuntime() {
|
|
|
322
307
|
abrupt: function (type, arg) {
|
|
323
308
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
324
309
|
var entry = this.tryEntries[i];
|
|
325
|
-
|
|
326
310
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
327
311
|
var finallyEntry = entry;
|
|
328
312
|
break;
|
|
329
313
|
}
|
|
330
314
|
}
|
|
331
|
-
|
|
332
315
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
333
316
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
334
317
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -346,19 +329,15 @@ function _regeneratorRuntime() {
|
|
|
346
329
|
catch: function (tryLoc) {
|
|
347
330
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
348
331
|
var entry = this.tryEntries[i];
|
|
349
|
-
|
|
350
332
|
if (entry.tryLoc === tryLoc) {
|
|
351
333
|
var record = entry.completion;
|
|
352
|
-
|
|
353
334
|
if ("throw" === record.type) {
|
|
354
335
|
var thrown = record.arg;
|
|
355
336
|
resetTryEntry(entry);
|
|
356
337
|
}
|
|
357
|
-
|
|
358
338
|
return thrown;
|
|
359
339
|
}
|
|
360
340
|
}
|
|
361
|
-
|
|
362
341
|
throw new Error("illegal catch attempt");
|
|
363
342
|
},
|
|
364
343
|
delegateYield: function (iterable, resultName, nextLoc) {
|
|
@@ -370,7 +349,6 @@ function _regeneratorRuntime() {
|
|
|
370
349
|
}
|
|
371
350
|
}, exports;
|
|
372
351
|
}
|
|
373
|
-
|
|
374
352
|
function _typeof(obj) {
|
|
375
353
|
"@babel/helpers - typeof";
|
|
376
354
|
|
|
@@ -380,7 +358,6 @@ function _typeof(obj) {
|
|
|
380
358
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
381
359
|
}, _typeof(obj);
|
|
382
360
|
}
|
|
383
|
-
|
|
384
361
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
385
362
|
try {
|
|
386
363
|
var info = gen[key](arg);
|
|
@@ -389,50 +366,42 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
389
366
|
reject(error);
|
|
390
367
|
return;
|
|
391
368
|
}
|
|
392
|
-
|
|
393
369
|
if (info.done) {
|
|
394
370
|
resolve(value);
|
|
395
371
|
} else {
|
|
396
372
|
Promise.resolve(value).then(_next, _throw);
|
|
397
373
|
}
|
|
398
374
|
}
|
|
399
|
-
|
|
400
375
|
function _asyncToGenerator(fn) {
|
|
401
376
|
return function () {
|
|
402
377
|
var self = this,
|
|
403
|
-
|
|
378
|
+
args = arguments;
|
|
404
379
|
return new Promise(function (resolve, reject) {
|
|
405
380
|
var gen = fn.apply(self, args);
|
|
406
|
-
|
|
407
381
|
function _next(value) {
|
|
408
382
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
409
383
|
}
|
|
410
|
-
|
|
411
384
|
function _throw(err) {
|
|
412
385
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
413
386
|
}
|
|
414
|
-
|
|
415
387
|
_next(undefined);
|
|
416
388
|
});
|
|
417
389
|
};
|
|
418
390
|
}
|
|
419
|
-
|
|
420
391
|
function _classCallCheck(instance, Constructor) {
|
|
421
392
|
if (!(instance instanceof Constructor)) {
|
|
422
393
|
throw new TypeError("Cannot call a class as a function");
|
|
423
394
|
}
|
|
424
395
|
}
|
|
425
|
-
|
|
426
396
|
function _defineProperties(target, props) {
|
|
427
397
|
for (var i = 0; i < props.length; i++) {
|
|
428
398
|
var descriptor = props[i];
|
|
429
399
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
430
400
|
descriptor.configurable = true;
|
|
431
401
|
if ("value" in descriptor) descriptor.writable = true;
|
|
432
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
402
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
433
403
|
}
|
|
434
404
|
}
|
|
435
|
-
|
|
436
405
|
function _createClass(Constructor, protoProps, staticProps) {
|
|
437
406
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
438
407
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
@@ -441,8 +410,8 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
441
410
|
});
|
|
442
411
|
return Constructor;
|
|
443
412
|
}
|
|
444
|
-
|
|
445
413
|
function _defineProperty(obj, key, value) {
|
|
414
|
+
key = _toPropertyKey(key);
|
|
446
415
|
if (key in obj) {
|
|
447
416
|
Object.defineProperty(obj, key, {
|
|
448
417
|
value: value,
|
|
@@ -453,52 +422,43 @@ function _defineProperty(obj, key, value) {
|
|
|
453
422
|
} else {
|
|
454
423
|
obj[key] = value;
|
|
455
424
|
}
|
|
456
|
-
|
|
457
425
|
return obj;
|
|
458
426
|
}
|
|
459
|
-
|
|
460
427
|
function _extends$1() {
|
|
461
428
|
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
462
429
|
for (var i = 1; i < arguments.length; i++) {
|
|
463
430
|
var source = arguments[i];
|
|
464
|
-
|
|
465
431
|
for (var key in source) {
|
|
466
432
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
467
433
|
target[key] = source[key];
|
|
468
434
|
}
|
|
469
435
|
}
|
|
470
436
|
}
|
|
471
|
-
|
|
472
437
|
return target;
|
|
473
438
|
};
|
|
474
439
|
return _extends$1.apply(this, arguments);
|
|
475
440
|
}
|
|
476
|
-
|
|
441
|
+
function _objectDestructuringEmpty(obj) {
|
|
442
|
+
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
443
|
+
}
|
|
477
444
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
478
445
|
if (source == null) return {};
|
|
479
446
|
var target = {};
|
|
480
447
|
var sourceKeys = Object.keys(source);
|
|
481
448
|
var key, i;
|
|
482
|
-
|
|
483
449
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
484
450
|
key = sourceKeys[i];
|
|
485
451
|
if (excluded.indexOf(key) >= 0) continue;
|
|
486
452
|
target[key] = source[key];
|
|
487
453
|
}
|
|
488
|
-
|
|
489
454
|
return target;
|
|
490
455
|
}
|
|
491
|
-
|
|
492
456
|
function _objectWithoutProperties(source, excluded) {
|
|
493
457
|
if (source == null) return {};
|
|
494
|
-
|
|
495
458
|
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
496
|
-
|
|
497
459
|
var key, i;
|
|
498
|
-
|
|
499
460
|
if (Object.getOwnPropertySymbols) {
|
|
500
461
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
501
|
-
|
|
502
462
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
503
463
|
key = sourceSymbolKeys[i];
|
|
504
464
|
if (excluded.indexOf(key) >= 0) continue;
|
|
@@ -506,60 +466,23 @@ function _objectWithoutProperties(source, excluded) {
|
|
|
506
466
|
target[key] = source[key];
|
|
507
467
|
}
|
|
508
468
|
}
|
|
509
|
-
|
|
510
469
|
return target;
|
|
511
470
|
}
|
|
512
|
-
|
|
513
471
|
function _slicedToArray(arr, i) {
|
|
514
472
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
515
473
|
}
|
|
516
|
-
|
|
517
474
|
function _toConsumableArray(arr) {
|
|
518
475
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
519
476
|
}
|
|
520
|
-
|
|
521
477
|
function _arrayWithoutHoles(arr) {
|
|
522
478
|
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
523
479
|
}
|
|
524
|
-
|
|
525
480
|
function _arrayWithHoles(arr) {
|
|
526
481
|
if (Array.isArray(arr)) return arr;
|
|
527
482
|
}
|
|
528
|
-
|
|
529
483
|
function _iterableToArray(iter) {
|
|
530
484
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
531
485
|
}
|
|
532
|
-
|
|
533
|
-
function _iterableToArrayLimit(arr, i) {
|
|
534
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
535
|
-
|
|
536
|
-
if (_i == null) return;
|
|
537
|
-
var _arr = [];
|
|
538
|
-
var _n = true;
|
|
539
|
-
var _d = false;
|
|
540
|
-
|
|
541
|
-
var _s, _e;
|
|
542
|
-
|
|
543
|
-
try {
|
|
544
|
-
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
545
|
-
_arr.push(_s.value);
|
|
546
|
-
|
|
547
|
-
if (i && _arr.length === i) break;
|
|
548
|
-
}
|
|
549
|
-
} catch (err) {
|
|
550
|
-
_d = true;
|
|
551
|
-
_e = err;
|
|
552
|
-
} finally {
|
|
553
|
-
try {
|
|
554
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
555
|
-
} finally {
|
|
556
|
-
if (_d) throw _e;
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
return _arr;
|
|
561
|
-
}
|
|
562
|
-
|
|
563
486
|
function _unsupportedIterableToArray(o, minLen) {
|
|
564
487
|
if (!o) return;
|
|
565
488
|
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
@@ -568,33 +491,24 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
568
491
|
if (n === "Map" || n === "Set") return Array.from(o);
|
|
569
492
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
570
493
|
}
|
|
571
|
-
|
|
572
494
|
function _arrayLikeToArray(arr, len) {
|
|
573
495
|
if (len == null || len > arr.length) len = arr.length;
|
|
574
|
-
|
|
575
496
|
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
576
|
-
|
|
577
497
|
return arr2;
|
|
578
498
|
}
|
|
579
|
-
|
|
580
499
|
function _nonIterableSpread() {
|
|
581
500
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
582
501
|
}
|
|
583
|
-
|
|
584
502
|
function _nonIterableRest() {
|
|
585
503
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
586
504
|
}
|
|
587
|
-
|
|
588
505
|
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
589
506
|
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
590
|
-
|
|
591
507
|
if (!it) {
|
|
592
508
|
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
593
509
|
if (it) o = it;
|
|
594
510
|
var i = 0;
|
|
595
|
-
|
|
596
511
|
var F = function () {};
|
|
597
|
-
|
|
598
512
|
return {
|
|
599
513
|
s: F,
|
|
600
514
|
n: function () {
|
|
@@ -612,13 +526,11 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
612
526
|
f: F
|
|
613
527
|
};
|
|
614
528
|
}
|
|
615
|
-
|
|
616
529
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
617
530
|
}
|
|
618
|
-
|
|
619
531
|
var normalCompletion = true,
|
|
620
|
-
|
|
621
|
-
|
|
532
|
+
didErr = false,
|
|
533
|
+
err;
|
|
622
534
|
return {
|
|
623
535
|
s: function () {
|
|
624
536
|
it = it.call(o);
|
|
@@ -641,11 +553,24 @@ function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
|
641
553
|
}
|
|
642
554
|
};
|
|
643
555
|
}
|
|
556
|
+
function _toPrimitive(input, hint) {
|
|
557
|
+
if (typeof input !== "object" || input === null) return input;
|
|
558
|
+
var prim = input[Symbol.toPrimitive];
|
|
559
|
+
if (prim !== undefined) {
|
|
560
|
+
var res = prim.call(input, hint || "default");
|
|
561
|
+
if (typeof res !== "object") return res;
|
|
562
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
563
|
+
}
|
|
564
|
+
return (hint === "string" ? String : Number)(input);
|
|
565
|
+
}
|
|
566
|
+
function _toPropertyKey(arg) {
|
|
567
|
+
var key = _toPrimitive(arg, "string");
|
|
568
|
+
return typeof key === "symbol" ? key : String(key);
|
|
569
|
+
}
|
|
644
570
|
|
|
645
571
|
// eslint-disable-next-line no-new-func
|
|
646
572
|
var isRegExp = function isRegExp(regExpStr) {
|
|
647
573
|
var _Function;
|
|
648
|
-
|
|
649
574
|
return ((_Function = new Function("return ".concat(regExpStr, ";"))()) === null || _Function === void 0 ? void 0 : _Function.constructor) === RegExp;
|
|
650
575
|
};
|
|
651
576
|
var isObj = function isObj(val) {
|
|
@@ -657,20 +582,17 @@ var isObj = function isObj(val) {
|
|
|
657
582
|
return self;
|
|
658
583
|
}
|
|
659
584
|
} catch (e) {}
|
|
660
|
-
|
|
661
585
|
try {
|
|
662
586
|
if (typeof window !== 'undefined') {
|
|
663
587
|
return window;
|
|
664
588
|
}
|
|
665
589
|
} catch (e) {}
|
|
666
|
-
|
|
667
590
|
try {
|
|
668
591
|
if (typeof global !== 'undefined') {
|
|
669
592
|
return global;
|
|
670
593
|
}
|
|
671
|
-
} catch (e) {}
|
|
672
|
-
|
|
673
|
-
|
|
594
|
+
} catch (e) {}
|
|
595
|
+
// eslint-disable-next-line no-new-func
|
|
674
596
|
return Function('return this')();
|
|
675
597
|
})();
|
|
676
598
|
var hasOwnProperty = function hasOwnProperty(obj, key) {
|
|
@@ -680,82 +602,64 @@ var valueType = function valueType(value) {
|
|
|
680
602
|
if (Array.isArray(value)) {
|
|
681
603
|
return 'array';
|
|
682
604
|
}
|
|
683
|
-
|
|
684
605
|
if (typeof value === 'string') {
|
|
685
606
|
return 'string';
|
|
686
607
|
}
|
|
687
|
-
|
|
688
608
|
if (typeof value === 'boolean') {
|
|
689
609
|
return 'boolean';
|
|
690
610
|
}
|
|
691
|
-
|
|
692
611
|
if (!isNaN(value)) {
|
|
693
612
|
return 'number';
|
|
694
613
|
}
|
|
695
|
-
|
|
696
614
|
if (value === null) {
|
|
697
615
|
return 'null';
|
|
698
616
|
}
|
|
699
|
-
|
|
700
617
|
if (_typeof(value) === 'object') {
|
|
701
618
|
return 'object';
|
|
702
619
|
}
|
|
703
|
-
|
|
704
620
|
return _typeof(value);
|
|
705
621
|
};
|
|
706
622
|
var merge = function merge(target, source) {
|
|
707
623
|
if (isObj(source)) {
|
|
708
624
|
return Object.keys(source).reduce(function (pre, key) {
|
|
709
625
|
var _target;
|
|
710
|
-
|
|
711
626
|
pre[key] = merge(((_target = target) === null || _target === void 0 ? void 0 : _target[key]) || {}, source[key]);
|
|
712
627
|
return pre;
|
|
713
628
|
}, JSON.parse(JSON.stringify(target)));
|
|
714
629
|
}
|
|
715
|
-
|
|
716
630
|
if (Array.isArray(source)) {
|
|
717
631
|
target = Array.isArray(target) ? target : [];
|
|
718
632
|
return source.map(function (item, index) {
|
|
719
633
|
if (target[index]) {
|
|
720
634
|
return merge(target[index], item);
|
|
721
635
|
}
|
|
722
|
-
|
|
723
636
|
return item;
|
|
724
637
|
});
|
|
725
638
|
}
|
|
726
|
-
|
|
727
639
|
return source;
|
|
728
640
|
};
|
|
729
|
-
|
|
641
|
+
// 获取type对应的初始化值
|
|
730
642
|
function initializationValue(type) {
|
|
731
643
|
var defaultInitValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
732
644
|
integer: undefined,
|
|
733
645
|
number: undefined // 默认初始化值(number类型0值会有特殊含义)
|
|
734
|
-
|
|
735
646
|
};
|
|
736
647
|
|
|
737
648
|
switch (type) {
|
|
738
649
|
case 'any':
|
|
739
650
|
return undefined;
|
|
740
|
-
|
|
741
651
|
case 'array':
|
|
742
652
|
return [];
|
|
743
|
-
|
|
744
653
|
case 'boolean':
|
|
745
654
|
return false;
|
|
746
|
-
|
|
747
655
|
case 'integer':
|
|
748
656
|
return defaultInitValue.integer;
|
|
749
|
-
|
|
750
657
|
case 'null':
|
|
751
658
|
return null;
|
|
752
|
-
|
|
753
659
|
case 'number':
|
|
754
660
|
return defaultInitValue.number;
|
|
755
|
-
|
|
756
661
|
case 'object':
|
|
757
662
|
return {};
|
|
758
|
-
|
|
759
663
|
case 'string':
|
|
760
664
|
return '';
|
|
761
665
|
}
|
|
@@ -764,10 +668,8 @@ function mergeDeep(target) {
|
|
|
764
668
|
for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
765
669
|
sources[_key - 1] = arguments[_key];
|
|
766
670
|
}
|
|
767
|
-
|
|
768
671
|
if (!sources.length) return target;
|
|
769
672
|
var source = sources.shift();
|
|
770
|
-
|
|
771
673
|
if (isObj(target) && isObj(source)) {
|
|
772
674
|
for (var key in source) {
|
|
773
675
|
if (isObj(source[key])) {
|
|
@@ -778,100 +680,81 @@ function mergeDeep(target) {
|
|
|
778
680
|
}
|
|
779
681
|
}
|
|
780
682
|
}
|
|
781
|
-
|
|
782
683
|
return mergeDeep.apply(void 0, [target].concat(sources));
|
|
783
684
|
}
|
|
784
|
-
|
|
785
685
|
function isArguments(object) {
|
|
786
686
|
return Object.prototype.toString.call(object) === '[object Arguments]';
|
|
787
687
|
}
|
|
788
|
-
|
|
789
688
|
function deepEquals(a, b) {
|
|
790
689
|
var ca = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
791
690
|
var cb = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
|
|
792
|
-
|
|
793
691
|
// Partially extracted from node-deeper and adapted to exclude comparison
|
|
794
692
|
// checks for functions.
|
|
795
693
|
// https://github.com/othiym23/node-deeper
|
|
796
694
|
if (a === b) {
|
|
797
695
|
return true;
|
|
798
696
|
}
|
|
799
|
-
|
|
800
697
|
if (typeof a === 'function' || typeof b === 'function') {
|
|
801
698
|
// Assume all functions are equivalent
|
|
802
699
|
// see https://github.com/mozilla-services/react-jsonschema-form/issues/255
|
|
803
700
|
return true;
|
|
804
701
|
}
|
|
805
|
-
|
|
806
702
|
if (_typeof(a) !== 'object' || _typeof(b) !== 'object') {
|
|
807
703
|
return false;
|
|
808
704
|
}
|
|
809
|
-
|
|
810
705
|
if (a === null || b === null) {
|
|
811
706
|
return false;
|
|
812
707
|
}
|
|
813
|
-
|
|
814
708
|
if (a instanceof Date && b instanceof Date) {
|
|
815
709
|
return a.getTime() === b.getTime();
|
|
816
710
|
}
|
|
817
|
-
|
|
818
711
|
if (a instanceof RegExp && b instanceof RegExp) {
|
|
819
712
|
return a.source === b.source && a.global === b.global && a.multiline === b.multiline && a.lastIndex === b.lastIndex && a.ignoreCase === b.ignoreCase;
|
|
820
713
|
}
|
|
821
|
-
|
|
822
714
|
if (isArguments(a) || isArguments(b)) {
|
|
823
715
|
if (!(isArguments(a) && isArguments(b))) {
|
|
824
716
|
return false;
|
|
825
717
|
}
|
|
826
|
-
|
|
827
718
|
var slice = Array.prototype.slice;
|
|
828
719
|
return deepEquals(slice.call(a), slice.call(b), ca, cb);
|
|
829
720
|
}
|
|
830
|
-
|
|
831
721
|
if (a.constructor !== b.constructor) {
|
|
832
722
|
return false;
|
|
833
723
|
}
|
|
834
|
-
|
|
835
724
|
var ka = Object.keys(a);
|
|
836
|
-
var kb = Object.keys(b);
|
|
837
|
-
|
|
725
|
+
var kb = Object.keys(b);
|
|
726
|
+
// don't bother with stack acrobatics if there's nothing there
|
|
838
727
|
if (ka.length === 0 && kb.length === 0) {
|
|
839
728
|
return true;
|
|
840
729
|
}
|
|
841
|
-
|
|
842
730
|
if (ka.length !== kb.length) {
|
|
843
731
|
return false;
|
|
844
732
|
}
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
733
|
+
var cal = ca.length;
|
|
734
|
+
// eslint-disable-next-line no-plusplus
|
|
848
735
|
while (cal--) {
|
|
849
736
|
if (ca[cal] === a) {
|
|
850
737
|
return cb[cal] === b;
|
|
851
738
|
}
|
|
852
739
|
}
|
|
853
|
-
|
|
854
740
|
ca.push(a);
|
|
855
741
|
cb.push(b);
|
|
856
742
|
ka.sort();
|
|
857
|
-
kb.sort();
|
|
858
|
-
|
|
743
|
+
kb.sort();
|
|
744
|
+
// eslint-disable-next-line no-plusplus
|
|
859
745
|
for (var j = ka.length - 1; j >= 0; j--) {
|
|
860
746
|
if (ka[j] !== kb[j]) {
|
|
861
747
|
return false;
|
|
862
748
|
}
|
|
863
749
|
}
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
750
|
+
var key;
|
|
751
|
+
// eslint-disable-next-line no-plusplus
|
|
867
752
|
for (var k = ka.length - 1; k >= 0; k--) {
|
|
868
753
|
key = ka[k];
|
|
869
|
-
|
|
870
754
|
if (!deepEquals(a[key], b[key], ca, cb)) {
|
|
871
755
|
return false;
|
|
872
756
|
}
|
|
873
757
|
}
|
|
874
|
-
|
|
875
758
|
ca.pop();
|
|
876
759
|
cb.pop();
|
|
877
760
|
return true;
|
|
@@ -880,18 +763,15 @@ function orderProperties(properties, order) {
|
|
|
880
763
|
if (!Array.isArray(order) || !order.length) {
|
|
881
764
|
return properties;
|
|
882
765
|
}
|
|
883
|
-
|
|
884
766
|
var arrayToHash = function arrayToHash(arr) {
|
|
885
767
|
return arr.reduce(function (prev, curr) {
|
|
886
768
|
prev[curr] = true;
|
|
887
769
|
return prev;
|
|
888
770
|
}, {});
|
|
889
771
|
};
|
|
890
|
-
|
|
891
772
|
var errorPropList = function errorPropList(arr) {
|
|
892
773
|
return arr.length > 1 ? "properties '".concat(arr.join('\', \''), "'") : "property '".concat(arr[0], "'");
|
|
893
774
|
};
|
|
894
|
-
|
|
895
775
|
var propertyHash = arrayToHash(properties);
|
|
896
776
|
var orderFiltered = order.filter(function (prop) {
|
|
897
777
|
return prop === '*' || propertyHash[prop];
|
|
@@ -901,21 +781,16 @@ function orderProperties(properties, order) {
|
|
|
901
781
|
return !orderHash[prop];
|
|
902
782
|
});
|
|
903
783
|
var restIndex = orderFiltered.indexOf('*');
|
|
904
|
-
|
|
905
784
|
if (restIndex === -1) {
|
|
906
785
|
if (rest.length) {
|
|
907
786
|
throw new Error("uiSchema order list does not contain ".concat(errorPropList(rest)));
|
|
908
787
|
}
|
|
909
|
-
|
|
910
788
|
return orderFiltered;
|
|
911
789
|
}
|
|
912
|
-
|
|
913
790
|
if (restIndex !== orderFiltered.lastIndexOf('*')) {
|
|
914
791
|
throw new Error('uiSchema order list contains more than one wildcard item');
|
|
915
792
|
}
|
|
916
|
-
|
|
917
793
|
var complete = _toConsumableArray(orderFiltered);
|
|
918
|
-
|
|
919
794
|
complete.splice.apply(complete, [restIndex, 1].concat(_toConsumableArray(rest)));
|
|
920
795
|
return complete;
|
|
921
796
|
}
|
|
@@ -926,12 +801,13 @@ function orderProperties(properties, order) {
|
|
|
926
801
|
var Registry = /*#__PURE__*/function () {
|
|
927
802
|
function Registry() {
|
|
928
803
|
_classCallCheck(this, Registry);
|
|
929
|
-
|
|
804
|
+
// 基础类型控件
|
|
930
805
|
this.widgets = new Map();
|
|
806
|
+
// 自定义组件
|
|
931
807
|
this.components = new Map();
|
|
808
|
+
// 每种Schema type对于的处理器
|
|
932
809
|
this.fields = new Map();
|
|
933
810
|
}
|
|
934
|
-
|
|
935
811
|
_createClass(Registry, [{
|
|
936
812
|
key: "addComponentsMap",
|
|
937
813
|
value: function addComponentsMap() {
|
|
@@ -959,58 +835,51 @@ var Registry = /*#__PURE__*/function () {
|
|
|
959
835
|
value: function addBaseWidgets() {
|
|
960
836
|
var widgets = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
961
837
|
this.addMap('widgets', widgets);
|
|
962
|
-
}
|
|
963
|
-
|
|
838
|
+
}
|
|
839
|
+
// 获取基础控件
|
|
964
840
|
}, {
|
|
965
841
|
key: "getBaseWidget",
|
|
966
842
|
value: function getBaseWidget(name) {
|
|
967
843
|
if (this.widgets.has(name)) {
|
|
968
844
|
return this.widgets.get(name);
|
|
969
845
|
}
|
|
970
|
-
|
|
971
846
|
if (name && name.indexOf(Registry.namespace) !== 0) {
|
|
972
847
|
return "".concat(Registry.namespace, "-").concat(name);
|
|
973
848
|
}
|
|
974
|
-
|
|
975
849
|
return name;
|
|
976
850
|
}
|
|
977
851
|
}, {
|
|
978
852
|
key: "addMap",
|
|
979
853
|
value: function addMap(props, map) {
|
|
980
854
|
var _this = this;
|
|
981
|
-
|
|
982
855
|
if (!props || !map) return;
|
|
983
856
|
Object.entries(map).forEach(function (_ref) {
|
|
984
857
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
858
|
+
key = _ref2[0],
|
|
859
|
+
value = _ref2[1];
|
|
988
860
|
if (_this[props].has(key)) {
|
|
989
861
|
console.warn('repeat key', key);
|
|
990
862
|
return;
|
|
991
863
|
}
|
|
992
|
-
|
|
993
864
|
_this[props].set(key, value);
|
|
994
865
|
});
|
|
995
866
|
}
|
|
996
867
|
}]);
|
|
997
|
-
|
|
998
868
|
return Registry;
|
|
999
869
|
}();
|
|
870
|
+
// 全局命名空间
|
|
1000
871
|
Registry.namespace = 'bk';
|
|
872
|
+
// 全局上下
|
|
1001
873
|
Registry.context = {};
|
|
1002
874
|
var registry = new Registry();
|
|
1003
875
|
|
|
1004
876
|
var _excluded$6 = ["name"],
|
|
1005
|
-
|
|
1006
|
-
|
|
877
|
+
_excluded2$1 = ["name"];
|
|
1007
878
|
var Schema = /*#__PURE__*/function () {
|
|
1008
879
|
function Schema(rootSchema) {
|
|
1009
880
|
_classCallCheck(this, Schema);
|
|
1010
|
-
|
|
1011
881
|
Schema.rootSchema = rootSchema;
|
|
1012
882
|
}
|
|
1013
|
-
|
|
1014
883
|
_createClass(Schema, null, [{
|
|
1015
884
|
key: "resolveRef",
|
|
1016
885
|
value: function resolveRef() {}
|
|
@@ -1024,65 +893,50 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1024
893
|
key: "resolveSchema",
|
|
1025
894
|
value: function resolveSchema(schema) {
|
|
1026
895
|
if (!isObj(schema)) return {};
|
|
1027
|
-
|
|
1028
896
|
if (hasOwnProperty(schema, 'allOf')) ;
|
|
1029
|
-
|
|
1030
897
|
if (hasOwnProperty(schema, '$ref')) ;
|
|
1031
|
-
|
|
1032
898
|
return schema;
|
|
1033
|
-
}
|
|
1034
|
-
|
|
899
|
+
}
|
|
900
|
+
// 获取Schema字段默认值
|
|
1035
901
|
}, {
|
|
1036
902
|
key: "getSchemaDefaultValue",
|
|
1037
903
|
value: function getSchemaDefaultValue(_schema) {
|
|
1038
904
|
var _this = this;
|
|
1039
|
-
|
|
1040
905
|
var schema = isObj(_schema) ? _schema : {};
|
|
1041
|
-
|
|
1042
906
|
switch (this.getSchemaType(schema)) {
|
|
1043
907
|
case 'null':
|
|
1044
908
|
return null;
|
|
1045
|
-
|
|
1046
909
|
case 'object':
|
|
1047
910
|
return Object.keys(schema.properties || {}).reduce(function (pre, key) {
|
|
1048
911
|
var _schema$properties;
|
|
1049
|
-
|
|
1050
912
|
var defaultValue = _this.getSchemaDefaultValue((_schema$properties = schema.properties) === null || _schema$properties === void 0 ? void 0 : _schema$properties[key]);
|
|
1051
|
-
|
|
1052
913
|
pre[key] = defaultValue;
|
|
1053
914
|
return pre;
|
|
1054
915
|
}, {});
|
|
1055
|
-
|
|
1056
916
|
case 'array':
|
|
1057
917
|
// todo
|
|
1058
918
|
if (schema.default && Array.isArray(schema.default)) {
|
|
1059
919
|
return schema.default;
|
|
1060
920
|
}
|
|
1061
|
-
|
|
1062
921
|
return Array.isArray(schema.items) ? schema.items.map(function (item) {
|
|
1063
922
|
return _this.getSchemaDefaultValue(item);
|
|
1064
923
|
}) : [];
|
|
1065
924
|
}
|
|
1066
|
-
|
|
1067
925
|
return schema.default !== undefined ? schema.default : initializationValue(schema.type || 'any');
|
|
1068
926
|
}
|
|
1069
927
|
}, {
|
|
1070
928
|
key: "getSchemaType",
|
|
1071
929
|
value: function getSchemaType(schema) {
|
|
1072
930
|
var type = schema.type;
|
|
1073
|
-
|
|
1074
931
|
if (!type && schema.const) {
|
|
1075
932
|
return valueType(schema.const);
|
|
1076
933
|
}
|
|
1077
|
-
|
|
1078
934
|
if (!type && schema.enum) {
|
|
1079
935
|
return 'string';
|
|
1080
936
|
}
|
|
1081
|
-
|
|
1082
937
|
if (!type && schema.items) {
|
|
1083
938
|
return 'array';
|
|
1084
939
|
}
|
|
1085
|
-
|
|
1086
940
|
return type;
|
|
1087
941
|
}
|
|
1088
942
|
}, {
|
|
@@ -1091,22 +945,18 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1091
945
|
if (!props || !props.startsWith('ui:')) {
|
|
1092
946
|
console.warn('ui props must start with ui:');
|
|
1093
947
|
}
|
|
1094
|
-
|
|
1095
948
|
return schema[props] || {};
|
|
1096
949
|
}
|
|
1097
950
|
}, {
|
|
1098
951
|
key: "getSchemaField",
|
|
1099
952
|
value: function getSchemaField(schema) {
|
|
1100
953
|
var _schema$oneOf, _schema$anyOf;
|
|
1101
|
-
|
|
1102
954
|
// 自定义Field组件
|
|
1103
955
|
var field = schema['ui:field'];
|
|
1104
|
-
|
|
1105
956
|
if (field) {
|
|
1106
957
|
return field;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
|
|
958
|
+
}
|
|
959
|
+
// oneOf field
|
|
1110
960
|
if ((_schema$oneOf = schema.oneOf) !== null && _schema$oneOf !== void 0 && _schema$oneOf.length) {
|
|
1111
961
|
return {
|
|
1112
962
|
name: registry.getField('composition'),
|
|
@@ -1114,9 +964,8 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1114
964
|
composition: 'oneOf'
|
|
1115
965
|
}
|
|
1116
966
|
};
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
|
|
967
|
+
}
|
|
968
|
+
// anyOf field
|
|
1120
969
|
if ((_schema$anyOf = schema.anyOf) !== null && _schema$anyOf !== void 0 && _schema$anyOf.length) {
|
|
1121
970
|
return {
|
|
1122
971
|
name: registry.getField('composition'),
|
|
@@ -1124,17 +973,14 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1124
973
|
composition: 'anyOf'
|
|
1125
974
|
}
|
|
1126
975
|
};
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
|
|
976
|
+
}
|
|
977
|
+
// default field
|
|
1130
978
|
var defaultField = registry.getField(this.getSchemaType(schema));
|
|
1131
|
-
|
|
1132
979
|
if (defaultField) {
|
|
1133
980
|
return {
|
|
1134
981
|
name: defaultField
|
|
1135
982
|
};
|
|
1136
983
|
}
|
|
1137
|
-
|
|
1138
984
|
return {
|
|
1139
985
|
name: null
|
|
1140
986
|
};
|
|
@@ -1145,24 +991,21 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1145
991
|
if (!schema.uniqueItems || !schema.items) {
|
|
1146
992
|
return false;
|
|
1147
993
|
}
|
|
1148
|
-
|
|
1149
994
|
return Array.isArray(schema.items.enum);
|
|
1150
995
|
}
|
|
1151
996
|
}, {
|
|
1152
997
|
key: "isTupleArray",
|
|
1153
998
|
value: function isTupleArray(schema) {
|
|
1154
999
|
var _schema$items;
|
|
1155
|
-
|
|
1156
1000
|
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) {
|
|
1157
1001
|
return isObj(item);
|
|
1158
1002
|
});
|
|
1159
|
-
}
|
|
1160
|
-
|
|
1003
|
+
}
|
|
1004
|
+
// 是否是自定义数组类型控件(如:label)
|
|
1161
1005
|
}, {
|
|
1162
1006
|
key: "isCustomArrayWidget",
|
|
1163
1007
|
value: function isCustomArrayWidget(schema) {
|
|
1164
1008
|
var _schema$uiComponent;
|
|
1165
|
-
|
|
1166
1009
|
var com = (_schema$uiComponent = schema['ui:component']) === null || _schema$uiComponent === void 0 ? void 0 : _schema$uiComponent.name;
|
|
1167
1010
|
return schema.type === 'array' && com;
|
|
1168
1011
|
}
|
|
@@ -1170,9 +1013,8 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1170
1013
|
key: "getGroupWrap",
|
|
1171
1014
|
value: function getGroupWrap(schema) {
|
|
1172
1015
|
var _ref = schema['ui:group'] || {},
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1016
|
+
name = _ref.name,
|
|
1017
|
+
groupVnode = _objectWithoutProperties(_ref, _excluded$6);
|
|
1176
1018
|
return _objectSpread2(_objectSpread2({}, groupVnode), {}, {
|
|
1177
1019
|
name: registry.getComponent(name) || name || registry.getComponent('group')
|
|
1178
1020
|
});
|
|
@@ -1181,9 +1023,8 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1181
1023
|
key: "getUiComponent",
|
|
1182
1024
|
value: function getUiComponent(schema) {
|
|
1183
1025
|
var _ref2 = schema['ui:component'] || {},
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1026
|
+
name = _ref2.name,
|
|
1027
|
+
vnodeData = _objectWithoutProperties(_ref2, _excluded2$1);
|
|
1187
1028
|
return _objectSpread2({
|
|
1188
1029
|
name: registry.getComponent(name) || name
|
|
1189
1030
|
}, vnodeData);
|
|
@@ -1192,21 +1033,17 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1192
1033
|
key: "getDefaultWidget",
|
|
1193
1034
|
value: function getDefaultWidget(schema) {
|
|
1194
1035
|
var _schema$oneOf2, _schema$oneOf3, _schema$anyOf2, _schema$anyOf3;
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1036
|
+
var type = this.getSchemaType(schema);
|
|
1037
|
+
// 默认转换策略
|
|
1198
1038
|
var defaultComponent = null;
|
|
1199
|
-
|
|
1200
1039
|
if (type === 'string' && Array.isArray(schema.enum)) {
|
|
1201
1040
|
// string类型的枚举数据默认用select组件
|
|
1202
1041
|
defaultComponent = registry.getComponent('select');
|
|
1203
1042
|
}
|
|
1204
|
-
|
|
1205
1043
|
if (type === 'array' && Schema.isMultiSelect(schema)) {
|
|
1206
1044
|
// array类型多选默认用checkbox组件
|
|
1207
1045
|
defaultComponent = registry.getComponent('checkbox');
|
|
1208
1046
|
}
|
|
1209
|
-
|
|
1210
1047
|
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) {
|
|
1211
1048
|
return item.const;
|
|
1212
1049
|
}) || (_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) {
|
|
@@ -1214,12 +1051,10 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1214
1051
|
}))) {
|
|
1215
1052
|
defaultComponent = registry.getComponent('select');
|
|
1216
1053
|
}
|
|
1217
|
-
|
|
1218
1054
|
if (defaultComponent) {
|
|
1219
1055
|
return defaultComponent;
|
|
1220
|
-
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1056
|
+
}
|
|
1057
|
+
// 找不到对应组件就使用默认type对应的widget
|
|
1223
1058
|
var typeComponentMap = {
|
|
1224
1059
|
string: 'input',
|
|
1225
1060
|
number: 'input',
|
|
@@ -1229,11 +1064,9 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1229
1064
|
};
|
|
1230
1065
|
var name = typeComponentMap[type];
|
|
1231
1066
|
var defaultWidget = registry.getComponent(name) || registry.getBaseWidget(name);
|
|
1232
|
-
|
|
1233
1067
|
if (defaultWidget) {
|
|
1234
1068
|
return defaultWidget;
|
|
1235
1069
|
}
|
|
1236
|
-
|
|
1237
1070
|
console.warn("\u672A\u6CE8\u518C\u7C7B\u578B".concat(type, "\u5BF9\u5E94\u7684\u9ED8\u8BA4\u8868\u5355\u9879"));
|
|
1238
1071
|
return null;
|
|
1239
1072
|
}
|
|
@@ -1252,13 +1085,12 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1252
1085
|
minLength: schema.minLength,
|
|
1253
1086
|
maxLength: schema.maxLength
|
|
1254
1087
|
}, schema['ui:props'] || {});
|
|
1255
|
-
|
|
1256
1088
|
return _objectSpread2(_objectSpread2({}, options), {}, {
|
|
1257
1089
|
// 0.1 兼容formItem设置 labelWidth 0 不生效问题
|
|
1258
1090
|
labelWidth: options.showTitle ? options.labelWidth : 0.1
|
|
1259
1091
|
});
|
|
1260
|
-
}
|
|
1261
|
-
|
|
1092
|
+
}
|
|
1093
|
+
// 当前属性是否被依赖
|
|
1262
1094
|
}, {
|
|
1263
1095
|
key: "getDependencies",
|
|
1264
1096
|
value: function getDependencies(schema, name) {
|
|
@@ -1270,11 +1102,9 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1270
1102
|
key: "resolveDefaultDatasource",
|
|
1271
1103
|
value: function resolveDefaultDatasource(schema) {
|
|
1272
1104
|
var _schema$uiComponent2, _schema$uiComponent2$, _schema$items2;
|
|
1273
|
-
|
|
1274
1105
|
if ((_schema$uiComponent2 = schema['ui:component']) !== null && _schema$uiComponent2 !== void 0 && (_schema$uiComponent2$ = _schema$uiComponent2.props) !== null && _schema$uiComponent2$ !== void 0 && _schema$uiComponent2$.datasource) {
|
|
1275
1106
|
return schema['ui:component'].props.datasource;
|
|
1276
1107
|
}
|
|
1277
|
-
|
|
1278
1108
|
if (Array.isArray(schema.enum)) {
|
|
1279
1109
|
var data = schema.enum;
|
|
1280
1110
|
return data.map(function (value) {
|
|
@@ -1284,10 +1114,8 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1284
1114
|
};
|
|
1285
1115
|
});
|
|
1286
1116
|
}
|
|
1287
|
-
|
|
1288
1117
|
if (Array.isArray((_schema$items2 = schema.items) === null || _schema$items2 === void 0 ? void 0 : _schema$items2.enum)) {
|
|
1289
1118
|
var _data = schema.items.enum || [];
|
|
1290
|
-
|
|
1291
1119
|
return _data.map(function (value) {
|
|
1292
1120
|
return {
|
|
1293
1121
|
value: value,
|
|
@@ -1295,7 +1123,6 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1295
1123
|
};
|
|
1296
1124
|
});
|
|
1297
1125
|
}
|
|
1298
|
-
|
|
1299
1126
|
if (_typeof(schema.type) !== 'object' && schema.oneOf && schema.oneOf.every(function (item) {
|
|
1300
1127
|
return item.const;
|
|
1301
1128
|
})) {
|
|
@@ -1305,10 +1132,8 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1305
1132
|
label: item.title || item.const
|
|
1306
1133
|
};
|
|
1307
1134
|
});
|
|
1308
|
-
|
|
1309
1135
|
return _data2;
|
|
1310
1136
|
}
|
|
1311
|
-
|
|
1312
1137
|
if (_typeof(schema.type) !== 'object' && schema.anyOf && schema.anyOf.every(function (item) {
|
|
1313
1138
|
return item.const;
|
|
1314
1139
|
})) {
|
|
@@ -1318,26 +1143,20 @@ var Schema = /*#__PURE__*/function () {
|
|
|
1318
1143
|
label: item.title || item.const
|
|
1319
1144
|
};
|
|
1320
1145
|
});
|
|
1321
|
-
|
|
1322
1146
|
return _data3;
|
|
1323
1147
|
}
|
|
1324
1148
|
}
|
|
1325
1149
|
}]);
|
|
1326
|
-
|
|
1327
1150
|
return Schema;
|
|
1328
1151
|
}();
|
|
1329
|
-
|
|
1330
1152
|
Schema.rootSchema = void 0;
|
|
1331
1153
|
|
|
1332
1154
|
// 布局管理器
|
|
1333
1155
|
var Layout = /*#__PURE__*/function () {
|
|
1334
1156
|
function Layout() {
|
|
1335
1157
|
var layout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1336
|
-
|
|
1337
1158
|
_classCallCheck(this, Layout);
|
|
1338
|
-
|
|
1339
1159
|
this.layout = void 0;
|
|
1340
|
-
|
|
1341
1160
|
if (Array.isArray(layout)) {
|
|
1342
1161
|
this.layout = this.parseLayout({
|
|
1343
1162
|
prop: '',
|
|
@@ -1347,21 +1166,18 @@ var Layout = /*#__PURE__*/function () {
|
|
|
1347
1166
|
this.layout = this.parseLayout(layout);
|
|
1348
1167
|
}
|
|
1349
1168
|
}
|
|
1350
|
-
|
|
1351
1169
|
_createClass(Layout, [{
|
|
1352
1170
|
key: "transformValueToPixel",
|
|
1353
1171
|
value: function transformValueToPixel(value) {
|
|
1354
1172
|
if (typeof value === 'number') {
|
|
1355
1173
|
return "".concat(value, "px");
|
|
1356
1174
|
}
|
|
1357
|
-
|
|
1358
1175
|
return value;
|
|
1359
1176
|
}
|
|
1360
1177
|
}, {
|
|
1361
1178
|
key: "parseLayout",
|
|
1362
1179
|
value: function parseLayout(config) {
|
|
1363
1180
|
var _this = this;
|
|
1364
|
-
|
|
1365
1181
|
var dim = this.getLayoutDimension(config.group);
|
|
1366
1182
|
var gridTemplate = this.parseGridTemplate(dim);
|
|
1367
1183
|
var group = (config.group || []).map(function (current) {
|
|
@@ -1369,7 +1185,6 @@ var Layout = /*#__PURE__*/function () {
|
|
|
1369
1185
|
console.error("layout ".concat(JSON.stringify(current), " error, must be a array"));
|
|
1370
1186
|
return [];
|
|
1371
1187
|
}
|
|
1372
|
-
|
|
1373
1188
|
var parseCurrent = current.map(function (item) {
|
|
1374
1189
|
if (typeof item === 'string' || typeof item === 'number') {
|
|
1375
1190
|
return {
|
|
@@ -1380,11 +1195,9 @@ var Layout = /*#__PURE__*/function () {
|
|
|
1380
1195
|
}
|
|
1381
1196
|
};
|
|
1382
1197
|
}
|
|
1383
|
-
|
|
1384
1198
|
if (_typeof(item) === 'object' && Reflect.has(item, 'group')) {
|
|
1385
1199
|
return _this.parseLayout(item);
|
|
1386
1200
|
}
|
|
1387
|
-
|
|
1388
1201
|
return item;
|
|
1389
1202
|
});
|
|
1390
1203
|
return parseCurrent;
|
|
@@ -1413,11 +1226,9 @@ var Layout = /*#__PURE__*/function () {
|
|
|
1413
1226
|
if (!Array.isArray(current)) {
|
|
1414
1227
|
console.error("layout ".concat(JSON.stringify(current), " error, must be a array"));
|
|
1415
1228
|
}
|
|
1416
|
-
|
|
1417
1229
|
if (current) {
|
|
1418
1230
|
pre.columns = Math.max(pre.columns, current.length || 0);
|
|
1419
1231
|
}
|
|
1420
|
-
|
|
1421
1232
|
pre.rows += 1;
|
|
1422
1233
|
return pre;
|
|
1423
1234
|
}, {
|
|
@@ -1437,15 +1248,13 @@ var Layout = /*#__PURE__*/function () {
|
|
|
1437
1248
|
key: "parseGridTemplateAreas",
|
|
1438
1249
|
value: function parseGridTemplateAreas(gridTemplate, group) {
|
|
1439
1250
|
var _this2 = this;
|
|
1440
|
-
|
|
1441
1251
|
return group.reduce(function (area, rows) {
|
|
1442
1252
|
var newRows = _this2.autoFillColumns(rows, gridTemplate.columns);
|
|
1443
|
-
|
|
1444
1253
|
area.push("\"".concat(newRows.join(' '), "\""));
|
|
1445
1254
|
return area;
|
|
1446
1255
|
}, []).join('\n');
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1256
|
+
}
|
|
1257
|
+
// 当前列数不够时自动填充
|
|
1449
1258
|
}, {
|
|
1450
1259
|
key: "autoFillColumns",
|
|
1451
1260
|
value: function autoFillColumns(rows, maxColumns) {
|
|
@@ -1454,21 +1263,19 @@ var Layout = /*#__PURE__*/function () {
|
|
|
1454
1263
|
return rows.map(function (row) {
|
|
1455
1264
|
return row.prop;
|
|
1456
1265
|
});
|
|
1457
|
-
}
|
|
1458
|
-
|
|
1459
|
-
|
|
1266
|
+
}
|
|
1267
|
+
// 均分补全的列
|
|
1460
1268
|
var fillLen = Math.floor((maxColumns - rows.length) / rows.length);
|
|
1461
1269
|
var newRows = rows.reduce(function (pre, row) {
|
|
1462
1270
|
pre.push(row.prop);
|
|
1463
1271
|
var fillData = new Array(fillLen).fill(row.prop);
|
|
1464
1272
|
return pre.concat(fillData);
|
|
1465
|
-
}, []);
|
|
1466
|
-
|
|
1273
|
+
}, []);
|
|
1274
|
+
// todo: 补全不够均分的列
|
|
1467
1275
|
if (newRows.length < maxColumns) {
|
|
1468
1276
|
var remainData = new Array(maxColumns - newRows.length).fill('.');
|
|
1469
1277
|
return newRows.concat(remainData);
|
|
1470
1278
|
}
|
|
1471
|
-
|
|
1472
1279
|
return newRows;
|
|
1473
1280
|
}
|
|
1474
1281
|
}, {
|
|
@@ -1490,7 +1297,6 @@ var Layout = /*#__PURE__*/function () {
|
|
|
1490
1297
|
return layoutConfig;
|
|
1491
1298
|
}
|
|
1492
1299
|
}]);
|
|
1493
|
-
|
|
1494
1300
|
return Layout;
|
|
1495
1301
|
}();
|
|
1496
1302
|
|
|
@@ -1500,7 +1306,6 @@ function createProxy(schema, context) {
|
|
|
1500
1306
|
if (typeof target[key] === 'function') {
|
|
1501
1307
|
return target[key].apply(context);
|
|
1502
1308
|
}
|
|
1503
|
-
|
|
1504
1309
|
return Reflect.get(target, key, receiver);
|
|
1505
1310
|
}
|
|
1506
1311
|
});
|
|
@@ -1510,7 +1315,6 @@ var Path = /*#__PURE__*/function () {
|
|
|
1510
1315
|
function Path() {
|
|
1511
1316
|
_classCallCheck(this, Path);
|
|
1512
1317
|
}
|
|
1513
|
-
|
|
1514
1318
|
_createClass(Path, null, [{
|
|
1515
1319
|
key: "getCurPath",
|
|
1516
1320
|
value: function getCurPath(parent, current) {
|
|
@@ -1522,12 +1326,10 @@ var Path = /*#__PURE__*/function () {
|
|
|
1522
1326
|
var leftDeviation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1523
1327
|
if (!path) return obj;
|
|
1524
1328
|
var pathArr = path.split(this.separator);
|
|
1525
|
-
|
|
1526
1329
|
for (var i = 0; i < pathArr.length - leftDeviation; i += 1) {
|
|
1527
1330
|
if (obj === undefined) return undefined;
|
|
1528
1331
|
obj = pathArr[i] === '' ? obj : obj[pathArr[i]];
|
|
1529
1332
|
}
|
|
1530
|
-
|
|
1531
1333
|
return obj;
|
|
1532
1334
|
}
|
|
1533
1335
|
}, {
|
|
@@ -1546,25 +1348,24 @@ var Path = /*#__PURE__*/function () {
|
|
|
1546
1348
|
});
|
|
1547
1349
|
target[lastProp] = value;
|
|
1548
1350
|
return newValue;
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1351
|
+
}
|
|
1352
|
+
// 获取当前路径的字路径(相对于父路径)
|
|
1551
1353
|
}, {
|
|
1552
1354
|
key: "getSubPath",
|
|
1553
1355
|
value: function getSubPath(parent, current) {
|
|
1554
1356
|
return current.replace("".concat(parent, "."), '');
|
|
1555
|
-
}
|
|
1556
|
-
|
|
1357
|
+
}
|
|
1358
|
+
// 获取路径最后一个属性
|
|
1557
1359
|
}, {
|
|
1558
1360
|
key: "getPathLastProp",
|
|
1559
1361
|
value: function getPathLastProp(path) {
|
|
1560
1362
|
return path.split(this.separator).pop();
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1363
|
+
}
|
|
1364
|
+
// 获取父路径
|
|
1563
1365
|
}, {
|
|
1564
1366
|
key: "getParentPath",
|
|
1565
1367
|
value: function getParentPath(path) {
|
|
1566
1368
|
var arrPath = path.split(this.separator);
|
|
1567
|
-
|
|
1568
1369
|
if (arrPath.length <= 1) {
|
|
1569
1370
|
return ''; // root path
|
|
1570
1371
|
}
|
|
@@ -1572,10 +1373,8 @@ var Path = /*#__PURE__*/function () {
|
|
|
1572
1373
|
return arrPath.slice(0, arrPath.length - 1).join(this.separator);
|
|
1573
1374
|
}
|
|
1574
1375
|
}]);
|
|
1575
|
-
|
|
1576
1376
|
return Path;
|
|
1577
1377
|
}();
|
|
1578
|
-
|
|
1579
1378
|
Path.separator = '.';
|
|
1580
1379
|
|
|
1581
1380
|
var _excluded$5 = ["params", "responseType", "method", "headers", "responseParse"];
|
|
@@ -1590,134 +1389,110 @@ var defaultConfig = {
|
|
|
1590
1389
|
var request = /*#__PURE__*/(function () {
|
|
1591
1390
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
|
|
1592
1391
|
var config,
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1392
|
+
_mergeDeep,
|
|
1393
|
+
params,
|
|
1394
|
+
_mergeDeep$responseTy,
|
|
1395
|
+
responseType,
|
|
1396
|
+
_mergeDeep$method,
|
|
1397
|
+
method,
|
|
1398
|
+
_mergeDeep$headers,
|
|
1399
|
+
headers,
|
|
1400
|
+
responseParse,
|
|
1401
|
+
reset,
|
|
1402
|
+
body,
|
|
1403
|
+
requestURL,
|
|
1404
|
+
response,
|
|
1405
|
+
res,
|
|
1406
|
+
_responseParse$dataKe,
|
|
1407
|
+
dataKey,
|
|
1408
|
+
labelKey,
|
|
1409
|
+
valueKey,
|
|
1410
|
+
data,
|
|
1411
|
+
_args = arguments;
|
|
1614
1412
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1615
|
-
while (1) {
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1413
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1414
|
+
case 0:
|
|
1415
|
+
config = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
1416
|
+
_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);
|
|
1417
|
+
requestURL = url; // 处理参数
|
|
1418
|
+
if (methodsWithoutData.includes(method.toUpperCase())) {
|
|
1419
|
+
requestURL = "".concat(requestURL, "?").concat(isObj(params) ? new URLSearchParams(params) : params || '');
|
|
1420
|
+
} else {
|
|
1421
|
+
if (isObj(params)) {
|
|
1422
|
+
// 处理JSON类型的请求
|
|
1423
|
+
headers['Content-Type'] = 'application/json;charset=utf-8';
|
|
1424
|
+
body = JSON.stringify(params);
|
|
1624
1425
|
} else {
|
|
1625
|
-
|
|
1626
|
-
// 处理JSON类型的请求
|
|
1627
|
-
headers['Content-Type'] = 'application/json;charset=utf-8';
|
|
1628
|
-
body = JSON.stringify(params);
|
|
1629
|
-
} else {
|
|
1630
|
-
body = params;
|
|
1631
|
-
}
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
_context.prev = 4;
|
|
1635
|
-
_context.next = 7;
|
|
1636
|
-
return fetch(requestURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
1637
|
-
method: method.toLocaleUpperCase(),
|
|
1638
|
-
headers: headers,
|
|
1639
|
-
body: body
|
|
1640
|
-
}));
|
|
1641
|
-
|
|
1642
|
-
case 7:
|
|
1643
|
-
response = _context.sent;
|
|
1644
|
-
|
|
1645
|
-
if (!response.ok) {
|
|
1646
|
-
_context.next = 21;
|
|
1647
|
-
break;
|
|
1426
|
+
body = params;
|
|
1648
1427
|
}
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
if (!(typeof responseParse === 'function')) {
|
|
1662
|
-
_context.next = 15;
|
|
1663
|
-
break;
|
|
1664
|
-
}
|
|
1665
|
-
|
|
1666
|
-
return _context.abrupt("return", Promise.resolve(responseParse(res)));
|
|
1667
|
-
|
|
1668
|
-
case 15:
|
|
1669
|
-
if (!isObj(responseParse)) {
|
|
1670
|
-
_context.next = 19;
|
|
1671
|
-
break;
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
_responseParse$dataKe = responseParse.dataKey, dataKey = _responseParse$dataKe === void 0 ? 'data' : _responseParse$dataKe, labelKey = responseParse.labelKey, valueKey = responseParse.valueKey;
|
|
1675
|
-
data = ((res === null || res === void 0 ? void 0 : res[dataKey]) || []).map(function (item) {
|
|
1676
|
-
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
1677
|
-
label: item === null || item === void 0 ? void 0 : item[labelKey],
|
|
1678
|
-
value: item === null || item === void 0 ? void 0 : item[valueKey]
|
|
1679
|
-
});
|
|
1680
|
-
});
|
|
1681
|
-
return _context.abrupt("return", Promise.resolve(data));
|
|
1682
|
-
|
|
1683
|
-
case 19:
|
|
1684
|
-
return _context.abrupt("return", Promise.resolve(res));
|
|
1685
|
-
|
|
1686
|
-
case 20:
|
|
1687
|
-
return _context.abrupt("return", Promise.resolve(res));
|
|
1688
|
-
|
|
1689
|
-
case 21:
|
|
1690
|
-
_context.t0 = response.status;
|
|
1691
|
-
_context.next = _context.t0 === 400 ? 24 : _context.t0 === 401 ? 25 : _context.t0 === 403 ? 26 : _context.t0 === 500 ? 26 : 27;
|
|
1428
|
+
}
|
|
1429
|
+
_context.prev = 4;
|
|
1430
|
+
_context.next = 7;
|
|
1431
|
+
return fetch(requestURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
1432
|
+
method: method.toLocaleUpperCase(),
|
|
1433
|
+
headers: headers,
|
|
1434
|
+
body: body
|
|
1435
|
+
}));
|
|
1436
|
+
case 7:
|
|
1437
|
+
response = _context.sent;
|
|
1438
|
+
if (!response.ok) {
|
|
1439
|
+
_context.next = 21;
|
|
1692
1440
|
break;
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
case 26:
|
|
1701
|
-
return _context.abrupt("break", 27);
|
|
1702
|
-
|
|
1703
|
-
case 27:
|
|
1704
|
-
_context.next = 33;
|
|
1441
|
+
}
|
|
1442
|
+
_context.next = 11;
|
|
1443
|
+
return response[responseType]();
|
|
1444
|
+
case 11:
|
|
1445
|
+
res = _context.sent;
|
|
1446
|
+
if (!responseParse) {
|
|
1447
|
+
_context.next = 20;
|
|
1705
1448
|
break;
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
_context.
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1449
|
+
}
|
|
1450
|
+
if (!(typeof responseParse === 'function')) {
|
|
1451
|
+
_context.next = 15;
|
|
1452
|
+
break;
|
|
1453
|
+
}
|
|
1454
|
+
return _context.abrupt("return", Promise.resolve(responseParse(res)));
|
|
1455
|
+
case 15:
|
|
1456
|
+
if (!isObj(responseParse)) {
|
|
1457
|
+
_context.next = 19;
|
|
1458
|
+
break;
|
|
1459
|
+
}
|
|
1460
|
+
_responseParse$dataKe = responseParse.dataKey, dataKey = _responseParse$dataKe === void 0 ? 'data' : _responseParse$dataKe, labelKey = responseParse.labelKey, valueKey = responseParse.valueKey;
|
|
1461
|
+
data = ((res === null || res === void 0 ? void 0 : res[dataKey]) || []).map(function (item) {
|
|
1462
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
1463
|
+
label: item === null || item === void 0 ? void 0 : item[labelKey],
|
|
1464
|
+
value: item === null || item === void 0 ? void 0 : item[valueKey]
|
|
1465
|
+
});
|
|
1466
|
+
});
|
|
1467
|
+
return _context.abrupt("return", Promise.resolve(data));
|
|
1468
|
+
case 19:
|
|
1469
|
+
return _context.abrupt("return", Promise.resolve(res));
|
|
1470
|
+
case 20:
|
|
1471
|
+
return _context.abrupt("return", Promise.resolve(res));
|
|
1472
|
+
case 21:
|
|
1473
|
+
_context.t0 = response.status;
|
|
1474
|
+
_context.next = _context.t0 === 400 ? 24 : _context.t0 === 401 ? 25 : _context.t0 === 403 ? 26 : _context.t0 === 500 ? 26 : 27;
|
|
1475
|
+
break;
|
|
1476
|
+
case 24:
|
|
1477
|
+
return _context.abrupt("break", 27);
|
|
1478
|
+
case 25:
|
|
1479
|
+
return _context.abrupt("break", 27);
|
|
1480
|
+
case 26:
|
|
1481
|
+
return _context.abrupt("break", 27);
|
|
1482
|
+
case 27:
|
|
1483
|
+
_context.next = 33;
|
|
1484
|
+
break;
|
|
1485
|
+
case 29:
|
|
1486
|
+
_context.prev = 29;
|
|
1487
|
+
_context.t1 = _context["catch"](4);
|
|
1488
|
+
console.error('Request Failed', _context.t1);
|
|
1489
|
+
Promise.reject(_context.t1);
|
|
1490
|
+
case 33:
|
|
1491
|
+
case "end":
|
|
1492
|
+
return _context.stop();
|
|
1717
1493
|
}
|
|
1718
1494
|
}, _callee, null, [[4, 29]]);
|
|
1719
1495
|
}));
|
|
1720
|
-
|
|
1721
1496
|
return function (_x) {
|
|
1722
1497
|
return _ref.apply(this, arguments);
|
|
1723
1498
|
};
|
|
@@ -1780,10 +1555,10 @@ var props$1 = {
|
|
|
1780
1555
|
// valueKey: 'value',
|
|
1781
1556
|
// labelKey: 'label',
|
|
1782
1557
|
// }, // 也可以是对像形式
|
|
1783
|
-
|
|
1784
1558
|
};
|
|
1785
1559
|
}
|
|
1786
1560
|
},
|
|
1561
|
+
|
|
1787
1562
|
readonly: {
|
|
1788
1563
|
type: Boolean,
|
|
1789
1564
|
default: false
|
|
@@ -1863,10 +1638,10 @@ var props = {
|
|
|
1863
1638
|
// valueKey: 'value',
|
|
1864
1639
|
// labelKey: 'label',
|
|
1865
1640
|
// }, // 也可以是对像形式
|
|
1866
|
-
|
|
1867
1641
|
};
|
|
1868
1642
|
}
|
|
1869
1643
|
},
|
|
1644
|
+
|
|
1870
1645
|
visible: {
|
|
1871
1646
|
type: Boolean,
|
|
1872
1647
|
default: true
|
|
@@ -1898,16 +1673,14 @@ var SchemaField = Vue.extend({
|
|
|
1898
1673
|
props: props,
|
|
1899
1674
|
render: function render(h, ctx) {
|
|
1900
1675
|
var _ctx$props = ctx.props,
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1676
|
+
schema = _ctx$props.schema,
|
|
1677
|
+
rootData = _ctx$props.rootData,
|
|
1678
|
+
path = _ctx$props.path;
|
|
1904
1679
|
var resolveSchema = Schema.resolveSchema(schema);
|
|
1905
1680
|
if (!Object.keys(schema).length) return h();
|
|
1906
|
-
|
|
1907
1681
|
var _Schema$getSchemaFiel = Schema.getSchemaField(resolveSchema),
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1682
|
+
name = _Schema$getSchemaFiel.name,
|
|
1683
|
+
fieldProps = _Schema$getSchemaFiel.props;
|
|
1911
1684
|
return name ? h(name, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
|
|
1912
1685
|
props: _objectSpread2(_objectSpread2(_objectSpread2({}, fieldProps), ctx.props), {}, {
|
|
1913
1686
|
value: Path.getPathVal(rootData, path),
|
|
@@ -1918,14 +1691,14 @@ var SchemaField = Vue.extend({
|
|
|
1918
1691
|
});
|
|
1919
1692
|
|
|
1920
1693
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
1921
|
-
|
|
1694
|
+
// 组件对外暴露的上下文
|
|
1922
1695
|
var getContext = function getContext(instance) {
|
|
1923
1696
|
var context = instance.context,
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1697
|
+
loadDataSource = instance.loadDataSource,
|
|
1698
|
+
validate = instance.validate,
|
|
1699
|
+
schema = instance.schema,
|
|
1700
|
+
rootData = instance.rootData,
|
|
1701
|
+
widgetNode = instance.widgetNode;
|
|
1929
1702
|
return {
|
|
1930
1703
|
$self: instance,
|
|
1931
1704
|
$context: context,
|
|
@@ -1939,17 +1712,15 @@ var getContext = function getContext(instance) {
|
|
|
1939
1712
|
};
|
|
1940
1713
|
var executeExpression = function executeExpression(expression, instance) {
|
|
1941
1714
|
var $dep = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1942
|
-
|
|
1943
1715
|
var _getContext = getContext(instance),
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1716
|
+
$self = _getContext.$self,
|
|
1717
|
+
$context = _getContext.$context,
|
|
1718
|
+
$schema = _getContext.$schema,
|
|
1719
|
+
$rules = _getContext.$rules,
|
|
1720
|
+
$loadDataSource = _getContext.$loadDataSource,
|
|
1721
|
+
$validate = _getContext.$validate,
|
|
1722
|
+
$rootData = _getContext.$rootData,
|
|
1723
|
+
$widgetNode = _getContext.$widgetNode;
|
|
1953
1724
|
var context = {
|
|
1954
1725
|
$self: $self,
|
|
1955
1726
|
$context: $context,
|
|
@@ -1961,23 +1732,20 @@ var executeExpression = function executeExpression(expression, instance) {
|
|
|
1961
1732
|
$widgetNode: $widgetNode,
|
|
1962
1733
|
$dep: $dep
|
|
1963
1734
|
};
|
|
1964
|
-
|
|
1965
1735
|
if (typeof expression === 'string') {
|
|
1966
1736
|
if (!/^{{.+}}$/.test(expression.trim())) return expression;
|
|
1967
1737
|
var expStr = expression.trim().replace(/(^{{)|(}}$)/g, '').trim();
|
|
1968
1738
|
var innerFuncs = ['$loadDataSource', '$validate'];
|
|
1969
|
-
|
|
1970
1739
|
var func = function func(_ref) {
|
|
1971
1740
|
_ref.$self;
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1741
|
+
_ref.$context;
|
|
1742
|
+
_ref.$schema;
|
|
1743
|
+
_ref.$rules;
|
|
1744
|
+
_ref.$loadDataSource;
|
|
1745
|
+
_ref.$validate;
|
|
1746
|
+
_ref.$rootData;
|
|
1747
|
+
_ref.$widgetNode;
|
|
1748
|
+
_ref.$dep;
|
|
1981
1749
|
try {
|
|
1982
1750
|
// eslint-disable-next-line no-eval
|
|
1983
1751
|
return innerFuncs.includes(expStr) ? eval("".concat(expStr, "()")) : eval(expStr);
|
|
@@ -1985,65 +1753,58 @@ var executeExpression = function executeExpression(expression, instance) {
|
|
|
1985
1753
|
console.error("execute ".concat(expStr, " error, please check. \n"), err);
|
|
1986
1754
|
}
|
|
1987
1755
|
};
|
|
1988
|
-
|
|
1989
1756
|
return func(context);
|
|
1990
1757
|
}
|
|
1991
|
-
|
|
1992
1758
|
if (isObj(expression)) {
|
|
1993
1759
|
Object.keys(expression).forEach(function (key) {
|
|
1994
1760
|
expression[key] = executeExpression(expression[key], instance);
|
|
1995
1761
|
});
|
|
1996
1762
|
return expression;
|
|
1997
1763
|
}
|
|
1998
|
-
};
|
|
1764
|
+
};
|
|
1999
1765
|
var isExpression = function isExpression(expression) {
|
|
2000
1766
|
return typeof expression === 'string' && /{{.*}}/.test(expression);
|
|
2001
1767
|
};
|
|
2002
1768
|
|
|
2003
1769
|
var WidgetNode = /*#__PURE__*/function () {
|
|
2004
|
-
// todo
|
|
2005
1770
|
function WidgetNode(config) {
|
|
2006
1771
|
_classCallCheck(this, WidgetNode);
|
|
2007
|
-
|
|
2008
1772
|
this.id = void 0;
|
|
2009
1773
|
this.instance = void 0;
|
|
2010
1774
|
this.parent = void 0;
|
|
2011
1775
|
this.type = void 0;
|
|
2012
1776
|
this.index = void 0;
|
|
1777
|
+
// todo
|
|
2013
1778
|
this.children = void 0;
|
|
2014
1779
|
var id = config.id,
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
1780
|
+
instance = config.instance,
|
|
1781
|
+
parent = config.parent,
|
|
1782
|
+
index = config.index,
|
|
1783
|
+
type = config.type,
|
|
1784
|
+
_config$children = config.children,
|
|
1785
|
+
children = _config$children === void 0 ? [] : _config$children;
|
|
2021
1786
|
this.id = id;
|
|
2022
1787
|
this.type = type;
|
|
2023
1788
|
this.index = index;
|
|
2024
1789
|
this.instance = instance;
|
|
2025
1790
|
this.parent = parent;
|
|
2026
1791
|
this.children = children;
|
|
2027
|
-
}
|
|
2028
|
-
|
|
2029
|
-
|
|
1792
|
+
}
|
|
1793
|
+
// 当前node的值
|
|
2030
1794
|
_createClass(WidgetNode, [{
|
|
2031
1795
|
key: "value",
|
|
2032
1796
|
get: function get() {
|
|
2033
1797
|
var _this$instance;
|
|
2034
|
-
|
|
2035
1798
|
return (_this$instance = this.instance) === null || _this$instance === void 0 ? void 0 : _this$instance.value;
|
|
2036
|
-
}
|
|
2037
|
-
|
|
1799
|
+
}
|
|
1800
|
+
// 是否含有可见子节点
|
|
2038
1801
|
}, {
|
|
2039
1802
|
key: "isChildrenVisible",
|
|
2040
1803
|
get: function get() {
|
|
2041
1804
|
if (this.type === 'node') {
|
|
2042
1805
|
var _this$instance2;
|
|
2043
|
-
|
|
2044
1806
|
return (_this$instance2 = this.instance) === null || _this$instance2 === void 0 ? void 0 : _this$instance2.state.visible;
|
|
2045
1807
|
}
|
|
2046
|
-
|
|
2047
1808
|
return this.children.some(function (child) {
|
|
2048
1809
|
return child.isChildrenVisible;
|
|
2049
1810
|
});
|
|
@@ -2051,47 +1812,43 @@ var WidgetNode = /*#__PURE__*/function () {
|
|
|
2051
1812
|
/**
|
|
2052
1813
|
* 获取 parents
|
|
2053
1814
|
*/
|
|
2054
|
-
|
|
2055
1815
|
}, {
|
|
2056
1816
|
key: "parents",
|
|
2057
1817
|
get: function get() {
|
|
2058
1818
|
if (!this.parent) {
|
|
2059
1819
|
return [];
|
|
2060
1820
|
}
|
|
2061
|
-
|
|
2062
1821
|
return [].concat(_toConsumableArray(this.parent.parents), [this.parent]);
|
|
2063
|
-
}
|
|
2064
|
-
|
|
1822
|
+
}
|
|
1823
|
+
// 第一个子节点
|
|
2065
1824
|
}, {
|
|
2066
1825
|
key: "firstChild",
|
|
2067
1826
|
get: function get() {
|
|
2068
1827
|
return this.children[0] || null;
|
|
2069
|
-
}
|
|
2070
|
-
|
|
1828
|
+
}
|
|
1829
|
+
// 最后一个子节点
|
|
2071
1830
|
}, {
|
|
2072
1831
|
key: "lastChild",
|
|
2073
1832
|
get: function get() {
|
|
2074
1833
|
return this.children[this.children.length - 1] || null;
|
|
2075
|
-
}
|
|
2076
|
-
|
|
1834
|
+
}
|
|
1835
|
+
// 指定属性下的同胞节点
|
|
2077
1836
|
}, {
|
|
2078
1837
|
key: "getSibling",
|
|
2079
1838
|
value: function getSibling(lastProp) {
|
|
2080
1839
|
var _this$parent;
|
|
2081
|
-
|
|
2082
1840
|
var reg = new RegExp("".concat(Path.getPathLastProp(this.id) || '', "$"));
|
|
2083
1841
|
var id = this.id.replace(reg, lastProp);
|
|
2084
1842
|
return (_this$parent = this.parent) === null || _this$parent === void 0 ? void 0 : _this$parent.children.find(function (node) {
|
|
2085
1843
|
return node.id === id;
|
|
2086
1844
|
});
|
|
2087
|
-
}
|
|
2088
|
-
|
|
1845
|
+
}
|
|
1846
|
+
// 获取所以同胞节点(不含自己)
|
|
2089
1847
|
}, {
|
|
2090
1848
|
key: "getSiblings",
|
|
2091
1849
|
value: function getSiblings() {
|
|
2092
1850
|
var _this$parent2,
|
|
2093
|
-
|
|
2094
|
-
|
|
1851
|
+
_this = this;
|
|
2095
1852
|
return ((_this$parent2 = this.parent) === null || _this$parent2 === void 0 ? void 0 : _this$parent2.children.filter(function (node) {
|
|
2096
1853
|
return node.instance !== _this.instance;
|
|
2097
1854
|
})) || [];
|
|
@@ -2099,7 +1856,6 @@ var WidgetNode = /*#__PURE__*/function () {
|
|
|
2099
1856
|
/**
|
|
2100
1857
|
* 是否是叶子节点
|
|
2101
1858
|
*/
|
|
2102
|
-
|
|
2103
1859
|
}, {
|
|
2104
1860
|
key: "isLeaf",
|
|
2105
1861
|
get: function get() {
|
|
@@ -2109,12 +1865,9 @@ var WidgetNode = /*#__PURE__*/function () {
|
|
|
2109
1865
|
key: "appendChild",
|
|
2110
1866
|
value: function appendChild(node) {
|
|
2111
1867
|
var _this$children;
|
|
2112
|
-
|
|
2113
1868
|
var nodes = Array.isArray(node) ? node : [node];
|
|
2114
1869
|
var offset = node.index !== undefined ? node.index : this.children.length;
|
|
2115
|
-
|
|
2116
1870
|
(_this$children = this.children).splice.apply(_this$children, [offset, 0].concat(_toConsumableArray(nodes)));
|
|
2117
|
-
|
|
2118
1871
|
this.children.slice(offset).forEach(function (node, index) {
|
|
2119
1872
|
node.index = offset + index;
|
|
2120
1873
|
});
|
|
@@ -2124,13 +1877,11 @@ var WidgetNode = /*#__PURE__*/function () {
|
|
|
2124
1877
|
key: "removeChild",
|
|
2125
1878
|
value: function removeChild(node) {
|
|
2126
1879
|
var _this2 = this;
|
|
2127
|
-
|
|
2128
1880
|
var nodes = Array.isArray(node) ? node : [node];
|
|
2129
1881
|
var removedChildIndex = [];
|
|
2130
1882
|
nodes.forEach(function (node) {
|
|
2131
1883
|
var index = node.index;
|
|
2132
1884
|
removedChildIndex.push(index);
|
|
2133
|
-
|
|
2134
1885
|
_this2.children.splice(index, 1);
|
|
2135
1886
|
});
|
|
2136
1887
|
var minIndex = Math.min.apply(Math, removedChildIndex);
|
|
@@ -2140,16 +1891,13 @@ var WidgetNode = /*#__PURE__*/function () {
|
|
|
2140
1891
|
return nodes;
|
|
2141
1892
|
}
|
|
2142
1893
|
}]);
|
|
2143
|
-
|
|
2144
1894
|
return WidgetNode;
|
|
2145
1895
|
}();
|
|
2146
1896
|
var WidgetTree = /*#__PURE__*/function () {
|
|
2147
1897
|
function WidgetTree() {
|
|
2148
1898
|
_classCallCheck(this, WidgetTree);
|
|
2149
|
-
|
|
2150
1899
|
this.widgetMap = {};
|
|
2151
1900
|
}
|
|
2152
|
-
|
|
2153
1901
|
_createClass(WidgetTree, [{
|
|
2154
1902
|
key: "addWidgetNode",
|
|
2155
1903
|
value: function addWidgetNode(path, instance, type, index) {
|
|
@@ -2168,12 +1916,10 @@ var WidgetTree = /*#__PURE__*/function () {
|
|
|
2168
1916
|
// 普通节点
|
|
2169
1917
|
var parentId = Path.getParentPath(path);
|
|
2170
1918
|
var parentNode = this.widgetMap[parentId];
|
|
2171
|
-
|
|
2172
1919
|
if (!parentNode) {
|
|
2173
1920
|
console.warn('Unexpected parent id, add widget failed');
|
|
2174
1921
|
return;
|
|
2175
1922
|
}
|
|
2176
|
-
|
|
2177
1923
|
var _node = new WidgetNode({
|
|
2178
1924
|
id: path,
|
|
2179
1925
|
type: type,
|
|
@@ -2182,7 +1928,6 @@ var WidgetTree = /*#__PURE__*/function () {
|
|
|
2182
1928
|
instance: instance,
|
|
2183
1929
|
children: []
|
|
2184
1930
|
});
|
|
2185
|
-
|
|
2186
1931
|
parentNode.appendChild(_node);
|
|
2187
1932
|
this.widgetMap[path] = _node;
|
|
2188
1933
|
}
|
|
@@ -2191,14 +1936,12 @@ var WidgetTree = /*#__PURE__*/function () {
|
|
|
2191
1936
|
key: "removeWidgetNode",
|
|
2192
1937
|
value: function removeWidgetNode(path, instance) {
|
|
2193
1938
|
var node = this.widgetMap[path];
|
|
2194
|
-
|
|
2195
1939
|
if (node) {
|
|
2196
1940
|
if (node.parent) {
|
|
2197
1941
|
var children = node.parent.children;
|
|
2198
1942
|
var index = children.findIndex(function (item) {
|
|
2199
1943
|
return item.instance === instance;
|
|
2200
1944
|
});
|
|
2201
|
-
|
|
2202
1945
|
if (index > -1) {
|
|
2203
1946
|
children.splice(index, 1);
|
|
2204
1947
|
children.slice(index).forEach(function (node, i) {
|
|
@@ -2206,20 +1949,17 @@ var WidgetTree = /*#__PURE__*/function () {
|
|
|
2206
1949
|
});
|
|
2207
1950
|
}
|
|
2208
1951
|
}
|
|
2209
|
-
|
|
2210
1952
|
if (node.instance === instance) {
|
|
2211
1953
|
delete this.widgetMap[path];
|
|
2212
1954
|
}
|
|
2213
1955
|
}
|
|
2214
1956
|
}
|
|
2215
1957
|
}]);
|
|
2216
|
-
|
|
2217
1958
|
return WidgetTree;
|
|
2218
1959
|
}();
|
|
2219
1960
|
var widgetTree = new WidgetTree();
|
|
2220
1961
|
|
|
2221
1962
|
var reactionsMap = {};
|
|
2222
|
-
|
|
2223
1963
|
var subscribe = function subscribe(path, typeName, fn) {
|
|
2224
1964
|
if (!reactionsMap[path]) {
|
|
2225
1965
|
reactionsMap[path] = {
|
|
@@ -2228,15 +1968,13 @@ var subscribe = function subscribe(path, typeName, fn) {
|
|
|
2228
1968
|
fns: []
|
|
2229
1969
|
};
|
|
2230
1970
|
}
|
|
2231
|
-
|
|
2232
1971
|
if (typeName === 'valChange') {
|
|
2233
1972
|
reactionsMap[path].fns.push(fn);
|
|
2234
1973
|
} else {
|
|
2235
1974
|
var _typeName$split = typeName.split('/'),
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
1975
|
+
_typeName$split2 = _slicedToArray(_typeName$split, 2),
|
|
1976
|
+
type = _typeName$split2[0],
|
|
1977
|
+
name = _typeName$split2[1];
|
|
2240
1978
|
if (!reactionsMap[path][type][name]) {
|
|
2241
1979
|
reactionsMap[path][type][name] = [fn];
|
|
2242
1980
|
} else {
|
|
@@ -2252,21 +1990,14 @@ var subscribe = function subscribe(path, typeName, fn) {
|
|
|
2252
1990
|
* @param reaction 传入的reacion配置
|
|
2253
1991
|
* @returns viod
|
|
2254
1992
|
*/
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
1993
|
var resolveReaction = function resolveReaction(crtInsPath, targetPath, reaction) {
|
|
2258
1994
|
return function () {
|
|
2259
1995
|
var _ref = widgetTree.widgetMap[crtInsPath] || {},
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
1996
|
+
crtInstance = _ref.instance; // 当前组件实例,用来条件表达式判断
|
|
2263
1997
|
var _ref2 = widgetTree.widgetMap[targetPath] || {},
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
1998
|
+
operateInstance = _ref2.instance; // 需要执行操作的组件实例,可能为其他组件也可能为当前组件
|
|
2267
1999
|
var fullfill = true;
|
|
2268
2000
|
var deps = [];
|
|
2269
|
-
|
|
2270
2001
|
if (reaction.source) {
|
|
2271
2002
|
var sources = Array.isArray(reaction.source) ? reaction.source : [reaction.source];
|
|
2272
2003
|
sources.forEach(function (item) {
|
|
@@ -2274,30 +2005,24 @@ var resolveReaction = function resolveReaction(crtInsPath, targetPath, reaction)
|
|
|
2274
2005
|
deps.push(instance);
|
|
2275
2006
|
});
|
|
2276
2007
|
}
|
|
2277
|
-
|
|
2278
2008
|
if (typeof reaction.if === 'string') {
|
|
2279
2009
|
fullfill = executeExpression(reaction.if, crtInstance, deps);
|
|
2280
2010
|
}
|
|
2281
|
-
|
|
2282
2011
|
var operations = fullfill ? reaction.then : reaction.else;
|
|
2283
2012
|
executeOperations(operations, operateInstance, deps);
|
|
2284
2013
|
};
|
|
2285
2014
|
};
|
|
2286
|
-
|
|
2287
2015
|
var executeOperations = function executeOperations(operations, instance, deps) {
|
|
2288
2016
|
if (operations) {
|
|
2289
2017
|
if (operations.state) {
|
|
2290
2018
|
Object.keys(operations.state).forEach(function (key) {
|
|
2291
2019
|
var val = operations.state[key];
|
|
2292
|
-
|
|
2293
2020
|
if (typeof val === 'string' && /^{{.+}}$/.test(val.trim())) {
|
|
2294
2021
|
val = executeExpression(val, instance, deps);
|
|
2295
2022
|
}
|
|
2296
|
-
|
|
2297
2023
|
instance.setState(key, val);
|
|
2298
2024
|
});
|
|
2299
2025
|
}
|
|
2300
|
-
|
|
2301
2026
|
if (Array.isArray(operations.actions)) {
|
|
2302
2027
|
operations.actions.forEach(function (item) {
|
|
2303
2028
|
executeExpression(item, instance, deps);
|
|
@@ -2305,17 +2030,13 @@ var executeOperations = function executeOperations(operations, instance, deps) {
|
|
|
2305
2030
|
}
|
|
2306
2031
|
}
|
|
2307
2032
|
};
|
|
2308
|
-
|
|
2309
2033
|
var parsePath = function parsePath(path, instance) {
|
|
2310
2034
|
return isExpression(path) ? executeExpression(path, instance) : path;
|
|
2311
2035
|
};
|
|
2312
|
-
|
|
2313
2036
|
var reactionRegister = function reactionRegister(path) {
|
|
2314
2037
|
var reactions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
2315
|
-
|
|
2316
2038
|
var _ref3 = widgetTree.widgetMap[path] || {},
|
|
2317
|
-
|
|
2318
|
-
|
|
2039
|
+
instance = _ref3.instance;
|
|
2319
2040
|
if (reactions && Array.isArray(reactions)) {
|
|
2320
2041
|
reactions.forEach(function (reaction) {
|
|
2321
2042
|
// source 和 target 互斥,如果schema中同时定义,则取source,如果都没有定义则默认source为当前表单
|
|
@@ -2324,45 +2045,38 @@ var reactionRegister = function reactionRegister(path) {
|
|
|
2324
2045
|
var targePath = parsePath(typeof reaction.target === 'string' ? reaction.target : path, instance);
|
|
2325
2046
|
subscribePaths.forEach(function (p) {
|
|
2326
2047
|
var sourcePathItem = parsePath(p, instance);
|
|
2327
|
-
|
|
2328
2048
|
if (typeof reaction.lifetime === 'string') {
|
|
2329
2049
|
subscribe(sourcePathItem, "lifetime/".concat(reaction.lifetime), resolveReaction(path, targePath, reaction));
|
|
2330
2050
|
}
|
|
2331
|
-
|
|
2332
2051
|
if (typeof reaction.effect === 'string') {
|
|
2333
2052
|
subscribe(sourcePathItem, "effect/".concat(reaction.effect), resolveReaction(path, targePath, reaction));
|
|
2334
2053
|
}
|
|
2335
|
-
|
|
2336
2054
|
if (!reaction.lifetime && !reaction.effect) {
|
|
2337
2055
|
subscribe(sourcePathItem, 'valChange', resolveReaction(path, targePath, reaction));
|
|
2338
2056
|
}
|
|
2339
2057
|
});
|
|
2340
2058
|
});
|
|
2341
2059
|
}
|
|
2342
|
-
};
|
|
2343
|
-
|
|
2060
|
+
};
|
|
2061
|
+
// 销毁widget对应的reaction
|
|
2344
2062
|
var reactionUnRegister = function reactionUnRegister(path) {
|
|
2345
2063
|
delete reactionsMap[path];
|
|
2346
2064
|
};
|
|
2347
2065
|
var reactionDispatch = function reactionDispatch(path, typeName) {
|
|
2348
2066
|
var _typeName$split3 = typeName.split('/'),
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2067
|
+
_typeName$split4 = _slicedToArray(_typeName$split3, 2),
|
|
2068
|
+
_typeName$split4$ = _typeName$split4[0],
|
|
2069
|
+
type = _typeName$split4$ === void 0 ? '' : _typeName$split4$,
|
|
2070
|
+
_typeName$split4$2 = _typeName$split4[1],
|
|
2071
|
+
name = _typeName$split4$2 === void 0 ? '' : _typeName$split4$2;
|
|
2355
2072
|
var fns = [];
|
|
2356
|
-
|
|
2357
2073
|
if (reactionsMap[path]) {
|
|
2358
2074
|
var _reactionsMap$path, _reactionsMap$path$ty;
|
|
2359
|
-
|
|
2360
2075
|
if (type === 'valChange') {
|
|
2361
2076
|
fns = reactionsMap[path].fns;
|
|
2362
2077
|
} 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]) {
|
|
2363
2078
|
fns = reactionsMap[path][type][name];
|
|
2364
2079
|
}
|
|
2365
|
-
|
|
2366
2080
|
fns.forEach(function (fn) {
|
|
2367
2081
|
fn();
|
|
2368
2082
|
});
|
|
@@ -4945,7 +4659,7 @@ function checkContextTypes(it, types) {
|
|
|
4945
4659
|
strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`);
|
|
4946
4660
|
}
|
|
4947
4661
|
});
|
|
4948
|
-
it
|
|
4662
|
+
narrowSchemaTypes(it, types);
|
|
4949
4663
|
}
|
|
4950
4664
|
function checkMultipleTypes(it, ts) {
|
|
4951
4665
|
if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) {
|
|
@@ -4970,6 +4684,16 @@ function hasApplicableType(schTs, kwdT) {
|
|
|
4970
4684
|
function includesType(ts, t) {
|
|
4971
4685
|
return ts.includes(t) || (t === "integer" && ts.includes("number"));
|
|
4972
4686
|
}
|
|
4687
|
+
function narrowSchemaTypes(it, withTypes) {
|
|
4688
|
+
const ts = [];
|
|
4689
|
+
for (const t of it.dataTypes) {
|
|
4690
|
+
if (includesType(withTypes, t))
|
|
4691
|
+
ts.push(t);
|
|
4692
|
+
else if (withTypes.includes("integer") && t === "number")
|
|
4693
|
+
ts.push("integer");
|
|
4694
|
+
}
|
|
4695
|
+
it.dataTypes = ts;
|
|
4696
|
+
}
|
|
4973
4697
|
function strictTypesError(it, msg) {
|
|
4974
4698
|
const schemaPath = it.schemaEnv.baseId + it.errSchemaPath;
|
|
4975
4699
|
msg += ` at "${schemaPath}" (strictTypes)`;
|
|
@@ -9499,7 +9223,7 @@ var require$$3 = {
|
|
|
9499
9223
|
|
|
9500
9224
|
(function (module, exports) {
|
|
9501
9225
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9502
|
-
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
|
9226
|
+
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
|
|
9503
9227
|
const core_1 = core$2;
|
|
9504
9228
|
const draft7_1 = draft7;
|
|
9505
9229
|
const discriminator_1 = discriminator;
|
|
@@ -9540,6 +9264,10 @@ Object.defineProperty(exports, "stringify", { enumerable: true, get: function ()
|
|
|
9540
9264
|
Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } });
|
|
9541
9265
|
Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } });
|
|
9542
9266
|
Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } });
|
|
9267
|
+
var validation_error_1 = validation_error;
|
|
9268
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return validation_error_1.default; } });
|
|
9269
|
+
var ref_error_1 = ref_error;
|
|
9270
|
+
Object.defineProperty(exports, "MissingRefError", { enumerable: true, get: function () { return ref_error_1.default; } });
|
|
9543
9271
|
|
|
9544
9272
|
}(ajv$1, ajv$1.exports));
|
|
9545
9273
|
|
|
@@ -9995,29 +9723,26 @@ var zh = function localize_zh(errors) {
|
|
|
9995
9723
|
var ajv = new Ajv({
|
|
9996
9724
|
strict: false
|
|
9997
9725
|
});
|
|
9998
|
-
addFormats(ajv);
|
|
9999
|
-
|
|
9726
|
+
addFormats(ajv);
|
|
9727
|
+
// 校验器 key
|
|
10000
9728
|
var VALIDATOR = 'validator';
|
|
10001
9729
|
var OWN_RULE_PROPERTY = 'ui:rules';
|
|
10002
|
-
var DEBUG_PREFIX = '[bk-schema-form-validator]';
|
|
10003
|
-
|
|
9730
|
+
var DEBUG_PREFIX = '[bk-schema-form-validator]';
|
|
9731
|
+
// 默认规则
|
|
10004
9732
|
var DEFAULT_RULES = {
|
|
10005
9733
|
required: {
|
|
10006
9734
|
message: '必填项',
|
|
10007
9735
|
validator: '{{ $self.value !== \'\' }}'
|
|
10008
9736
|
}
|
|
10009
9737
|
};
|
|
10010
|
-
|
|
10011
9738
|
var throwErr = function throwErr(err) {
|
|
10012
9739
|
throw new Error("".concat(DEBUG_PREFIX, " ").concat(err));
|
|
10013
9740
|
};
|
|
10014
|
-
|
|
10015
9741
|
var globalRules = new Map();
|
|
10016
9742
|
/**
|
|
10017
9743
|
* 注册全局校验规则
|
|
10018
9744
|
* @param rules
|
|
10019
9745
|
*/
|
|
10020
|
-
|
|
10021
9746
|
var registryGlobalRules = function registryGlobalRules(rules) {
|
|
10022
9747
|
try {
|
|
10023
9748
|
if (!rules) return;
|
|
@@ -10036,57 +9761,49 @@ var registryGlobalRules = function registryGlobalRules(rules) {
|
|
|
10036
9761
|
/**
|
|
10037
9762
|
* 校验规则
|
|
10038
9763
|
*/
|
|
10039
|
-
|
|
10040
9764
|
var validate = function validate(rule, instance) {
|
|
10041
9765
|
var theRule = rule;
|
|
10042
|
-
|
|
10043
9766
|
if (typeof rule === 'string') {
|
|
10044
9767
|
theRule = globalRules.get(rule);
|
|
10045
9768
|
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"));
|
|
10046
9769
|
}
|
|
10047
|
-
|
|
10048
9770
|
var _theRule = theRule,
|
|
10049
|
-
|
|
10050
|
-
|
|
9771
|
+
validator = _theRule.validator,
|
|
9772
|
+
message = _theRule.message;
|
|
10051
9773
|
var valid = true;
|
|
10052
|
-
|
|
10053
9774
|
if (isExpression(validator)) {
|
|
10054
9775
|
valid = executeExpression(validator, instance);
|
|
10055
9776
|
} else if (typeof validator === 'function') {
|
|
10056
|
-
valid = validator(instance);
|
|
9777
|
+
valid = validator(instance);
|
|
9778
|
+
// eslint-disable-next-line no-eval
|
|
10057
9779
|
} else if (eval(validator) instanceof RegExp) {
|
|
10058
9780
|
// eslint-disable-next-line no-eval
|
|
10059
9781
|
valid = new RegExp(eval(validator)).test(instance.value);
|
|
10060
9782
|
}
|
|
10061
|
-
|
|
10062
9783
|
return {
|
|
10063
9784
|
valid: valid,
|
|
10064
9785
|
message: message
|
|
10065
9786
|
};
|
|
10066
|
-
};
|
|
10067
|
-
|
|
10068
|
-
|
|
9787
|
+
};
|
|
9788
|
+
// 设置表单项校验状态
|
|
10069
9789
|
var setWidgetErrorTips = function setWidgetErrorTips(path, isError, errorMsg) {
|
|
10070
9790
|
var formItem = widgetTree.widgetMap[path];
|
|
10071
9791
|
var instance = formItem.instance;
|
|
10072
|
-
|
|
10073
9792
|
if (formItem.type === 'node') {
|
|
10074
9793
|
instance === null || instance === void 0 ? void 0 : instance.setState('error', true);
|
|
10075
9794
|
instance === null || instance === void 0 ? void 0 : instance.setErrorTips(errorMsg);
|
|
10076
|
-
}
|
|
9795
|
+
}
|
|
9796
|
+
// 如果实例属于某个组,则沿着 path 向上查找,如果找到组且组的 verifiable 设置为 true,则通过实例的校验状态改变组的校验状态
|
|
10077
9797
|
// TODO submit 时校验,change 时去掉错误
|
|
10078
|
-
|
|
10079
|
-
|
|
10080
9798
|
var widgetPaths = path.split('.');
|
|
10081
9799
|
var fieldTitleBreadcrumb = [];
|
|
10082
9800
|
widgetPaths.forEach(function (thePath, thePathIndex) {
|
|
10083
9801
|
var currentPaths = widgetPaths.slice(0, widgetPaths.length - thePathIndex);
|
|
10084
9802
|
var widgetPath = currentPaths.join('.');
|
|
10085
|
-
var theWidget = widgetTree.widgetMap[widgetPath];
|
|
10086
|
-
|
|
9803
|
+
var theWidget = widgetTree.widgetMap[widgetPath];
|
|
9804
|
+
// todo(判断path是否是数组索引)
|
|
10087
9805
|
var isIndex = theWidget.instance.schema.type === 'array' || !theWidget.instance.schema.title;
|
|
10088
9806
|
fieldTitleBreadcrumb.push(isIndex ? currentPaths.pop() : theWidget.instance.schema.title);
|
|
10089
|
-
|
|
10090
9807
|
if (theWidget.instance.verifiable && theWidget.type === 'group') {
|
|
10091
9808
|
if (isError) {
|
|
10092
9809
|
var groupErrors = "".concat(fieldTitleBreadcrumb.reverse().join('-'), ": ").concat(errorMsg);
|
|
@@ -10101,10 +9818,8 @@ var setWidgetErrorTips = function setWidgetErrorTips(path, isError, errorMsg) {
|
|
|
10101
9818
|
* 校验单个表单项
|
|
10102
9819
|
* @param path 字段路径
|
|
10103
9820
|
*/
|
|
10104
|
-
|
|
10105
9821
|
var validateFormItem = function validateFormItem(path) {
|
|
10106
9822
|
var _instance$schema;
|
|
10107
|
-
|
|
10108
9823
|
// TODO 校验逻辑梳理
|
|
10109
9824
|
var formItem = widgetTree.widgetMap[path];
|
|
10110
9825
|
if (!formItem) return {
|
|
@@ -10112,26 +9827,24 @@ var validateFormItem = function validateFormItem(path) {
|
|
|
10112
9827
|
message: '',
|
|
10113
9828
|
path: ''
|
|
10114
9829
|
};
|
|
10115
|
-
var instance = formItem.instance;
|
|
10116
|
-
|
|
9830
|
+
var instance = formItem.instance;
|
|
9831
|
+
// 清空上一次状态
|
|
10117
9832
|
if (formItem.type === 'group') {
|
|
10118
9833
|
instance === null || instance === void 0 ? void 0 : instance.clearGroupErrorTips();
|
|
10119
9834
|
} else {
|
|
10120
9835
|
instance === null || instance === void 0 ? void 0 : instance.setState('error', false);
|
|
10121
|
-
instance === null || instance === void 0 ? void 0 : instance.setErrorTips('');
|
|
10122
|
-
|
|
9836
|
+
instance === null || instance === void 0 ? void 0 : instance.setErrorTips('');
|
|
9837
|
+
// 清空所在组错误信息
|
|
10123
9838
|
var widgetPaths = path.split('.');
|
|
10124
9839
|
widgetPaths.forEach(function (thePath, thePathIndex) {
|
|
10125
9840
|
var currentPaths = widgetPaths.slice(0, widgetPaths.length - thePathIndex).join('.');
|
|
10126
9841
|
var theWidget = widgetTree.widgetMap[currentPaths];
|
|
10127
|
-
|
|
10128
9842
|
if (theWidget.instance.verifiable && theWidget.type === 'group') {
|
|
10129
9843
|
theWidget.instance.removeGroupErrorTips(path);
|
|
10130
9844
|
}
|
|
10131
9845
|
});
|
|
10132
|
-
}
|
|
10133
|
-
|
|
10134
|
-
|
|
9846
|
+
}
|
|
9847
|
+
// json schema 规则校验
|
|
10135
9848
|
var ownSchema = instance.schema;
|
|
10136
9849
|
var schemaValidate = ajv.compile(ownSchema);
|
|
10137
9850
|
var value = instance.value === undefined ? initializationValue(ownSchema.type, {
|
|
@@ -10139,7 +9852,6 @@ var validateFormItem = function validateFormItem(path) {
|
|
|
10139
9852
|
number: 0
|
|
10140
9853
|
}) : instance.value;
|
|
10141
9854
|
var schemaValid = schemaValidate(value);
|
|
10142
|
-
|
|
10143
9855
|
if (!schemaValid) {
|
|
10144
9856
|
zh(schemaValidate.errors);
|
|
10145
9857
|
var errorsText = ajv.errorsText(schemaValidate.errors, {
|
|
@@ -10151,21 +9863,17 @@ var validateFormItem = function validateFormItem(path) {
|
|
|
10151
9863
|
message: errorsText,
|
|
10152
9864
|
path: path
|
|
10153
9865
|
};
|
|
10154
|
-
}
|
|
10155
|
-
|
|
10156
|
-
|
|
9866
|
+
}
|
|
9867
|
+
// 自定义规则校验
|
|
10157
9868
|
var customRules = ((_instance$schema = instance.schema) === null || _instance$schema === void 0 ? void 0 : _instance$schema[OWN_RULE_PROPERTY]) || [];
|
|
10158
9869
|
var isError = false;
|
|
10159
9870
|
var errorMsg = '';
|
|
10160
|
-
|
|
10161
9871
|
var _iterator = _createForOfIteratorHelper(customRules),
|
|
10162
|
-
|
|
10163
|
-
|
|
9872
|
+
_step;
|
|
10164
9873
|
try {
|
|
10165
9874
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
10166
9875
|
var rule = _step.value;
|
|
10167
9876
|
var result = validate(rule, instance);
|
|
10168
|
-
|
|
10169
9877
|
if (!result.valid) {
|
|
10170
9878
|
isError = true;
|
|
10171
9879
|
errorMsg = result.message;
|
|
@@ -10177,7 +9885,6 @@ var validateFormItem = function validateFormItem(path) {
|
|
|
10177
9885
|
} finally {
|
|
10178
9886
|
_iterator.f();
|
|
10179
9887
|
}
|
|
10180
|
-
|
|
10181
9888
|
if (isError) {
|
|
10182
9889
|
setWidgetErrorTips(path, true, errorMsg);
|
|
10183
9890
|
return {
|
|
@@ -10186,7 +9893,6 @@ var validateFormItem = function validateFormItem(path) {
|
|
|
10186
9893
|
path: path
|
|
10187
9894
|
};
|
|
10188
9895
|
}
|
|
10189
|
-
|
|
10190
9896
|
return {
|
|
10191
9897
|
result: true,
|
|
10192
9898
|
message: errorMsg,
|
|
@@ -10196,12 +9902,10 @@ var validateFormItem = function validateFormItem(path) {
|
|
|
10196
9902
|
/**
|
|
10197
9903
|
* 校验整个表单
|
|
10198
9904
|
*/
|
|
10199
|
-
|
|
10200
9905
|
var validateForm = function validateForm() {
|
|
10201
9906
|
var isValid = true;
|
|
10202
9907
|
Object.keys(widgetTree.widgetMap).forEach(function (path) {
|
|
10203
9908
|
var _validateFormItem;
|
|
10204
|
-
|
|
10205
9909
|
if (!((_validateFormItem = validateFormItem(path)) !== null && _validateFormItem !== void 0 && _validateFormItem.result)) isValid = false;
|
|
10206
9910
|
});
|
|
10207
9911
|
return isValid;
|
|
@@ -10209,58 +9913,47 @@ var validateForm = function validateForm() {
|
|
|
10209
9913
|
/**
|
|
10210
9914
|
* 校验表单(抛出具体错误信息)
|
|
10211
9915
|
*/
|
|
10212
|
-
|
|
10213
9916
|
var validateFormWithResult = function validateFormWithResult() {
|
|
10214
9917
|
return new Promise(function (resolve, reject) {
|
|
10215
9918
|
var result = Object.keys(widgetTree.widgetMap).filter(function (path) {
|
|
10216
9919
|
var _widgetTree$widgetMap;
|
|
10217
|
-
|
|
10218
9920
|
return ((_widgetTree$widgetMap = widgetTree.widgetMap[path]) === null || _widgetTree$widgetMap === void 0 ? void 0 : _widgetTree$widgetMap.type) === 'node';
|
|
10219
9921
|
}).reduce(function (pre, path) {
|
|
10220
9922
|
var validateResult = validateFormItem(path);
|
|
10221
|
-
|
|
10222
9923
|
if (!(validateResult !== null && validateResult !== void 0 && validateResult.result)) {
|
|
10223
9924
|
pre.push(validateResult);
|
|
10224
9925
|
}
|
|
10225
|
-
|
|
10226
9926
|
return pre;
|
|
10227
9927
|
}, []);
|
|
10228
|
-
|
|
10229
9928
|
if (result.length) {
|
|
10230
9929
|
reject(result);
|
|
10231
9930
|
} else {
|
|
10232
9931
|
resolve([]);
|
|
10233
9932
|
}
|
|
10234
9933
|
});
|
|
10235
|
-
};
|
|
10236
|
-
|
|
9934
|
+
};
|
|
9935
|
+
// 校验schema是否正常
|
|
10237
9936
|
var validateSchema = /*#__PURE__*/function () {
|
|
10238
9937
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(schema) {
|
|
10239
9938
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10240
|
-
while (1) {
|
|
10241
|
-
|
|
10242
|
-
|
|
10243
|
-
|
|
10244
|
-
|
|
10245
|
-
|
|
10246
|
-
|
|
10247
|
-
|
|
10248
|
-
|
|
10249
|
-
|
|
10250
|
-
|
|
10251
|
-
|
|
10252
|
-
|
|
10253
|
-
|
|
10254
|
-
|
|
10255
|
-
|
|
10256
|
-
case 10:
|
|
10257
|
-
case "end":
|
|
10258
|
-
return _context.stop();
|
|
10259
|
-
}
|
|
9939
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9940
|
+
case 0:
|
|
9941
|
+
_context.prev = 0;
|
|
9942
|
+
_context.next = 3;
|
|
9943
|
+
return ajv.validateSchema(schema, true);
|
|
9944
|
+
case 3:
|
|
9945
|
+
return _context.abrupt("return", _context.sent);
|
|
9946
|
+
case 6:
|
|
9947
|
+
_context.prev = 6;
|
|
9948
|
+
_context.t0 = _context["catch"](0);
|
|
9949
|
+
console.error('Schema不符合规范, 请检查', _context.t0);
|
|
9950
|
+
return _context.abrupt("return", false);
|
|
9951
|
+
case 10:
|
|
9952
|
+
case "end":
|
|
9953
|
+
return _context.stop();
|
|
10260
9954
|
}
|
|
10261
9955
|
}, _callee, null, [[0, 6]]);
|
|
10262
9956
|
}));
|
|
10263
|
-
|
|
10264
9957
|
return function validateSchema(_x) {
|
|
10265
9958
|
return _ref.apply(this, arguments);
|
|
10266
9959
|
};
|
|
@@ -10269,7 +9962,6 @@ var validateSchema = /*#__PURE__*/function () {
|
|
|
10269
9962
|
* 触发校验
|
|
10270
9963
|
* @param path 字段路径
|
|
10271
9964
|
*/
|
|
10272
|
-
|
|
10273
9965
|
var dispatchValidate = function dispatchValidate(path) {
|
|
10274
9966
|
return validateFormItem(path);
|
|
10275
9967
|
};
|
|
@@ -10278,22 +9970,18 @@ var dispatchValidate = function dispatchValidate(path) {
|
|
|
10278
9970
|
var FormEvent = /*#__PURE__*/function () {
|
|
10279
9971
|
function FormEvent() {
|
|
10280
9972
|
_classCallCheck(this, FormEvent);
|
|
10281
|
-
|
|
10282
9973
|
this.callbacks = void 0;
|
|
10283
9974
|
this.callbacks = Object.create(null);
|
|
10284
9975
|
}
|
|
10285
|
-
|
|
10286
9976
|
_createClass(FormEvent, [{
|
|
10287
9977
|
key: "on",
|
|
10288
9978
|
value: function on(path, type, cb) {
|
|
10289
9979
|
if (!(path in this.callbacks)) {
|
|
10290
9980
|
this.callbacks[path] = {};
|
|
10291
9981
|
}
|
|
10292
|
-
|
|
10293
9982
|
if (!(type in this.callbacks[path])) {
|
|
10294
9983
|
this.callbacks[path][type] = [];
|
|
10295
9984
|
}
|
|
10296
|
-
|
|
10297
9985
|
this.callbacks[path][type].push(cb);
|
|
10298
9986
|
return this;
|
|
10299
9987
|
}
|
|
@@ -10311,28 +9999,24 @@ var FormEvent = /*#__PURE__*/function () {
|
|
|
10311
9999
|
delete this.callbacks[path][type];
|
|
10312
10000
|
} else {
|
|
10313
10001
|
// 清空对应事件
|
|
10314
|
-
var events = this.callbacks[path][type];
|
|
10315
|
-
|
|
10002
|
+
var events = this.callbacks[path][type];
|
|
10003
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
10316
10004
|
for (var index in events) {
|
|
10317
10005
|
if (cb === events[index]) {
|
|
10318
10006
|
events.splice(Number(index), 1);
|
|
10319
10007
|
}
|
|
10320
10008
|
}
|
|
10321
10009
|
}
|
|
10322
|
-
|
|
10323
10010
|
return this;
|
|
10324
10011
|
}
|
|
10325
10012
|
}, {
|
|
10326
10013
|
key: "once",
|
|
10327
10014
|
value: function once(path, type, cb) {
|
|
10328
10015
|
var _this = this;
|
|
10329
|
-
|
|
10330
10016
|
function innerOnce() {
|
|
10331
10017
|
cb.apply(void 0, arguments);
|
|
10332
|
-
|
|
10333
10018
|
_this.off(path, type, innerOnce);
|
|
10334
10019
|
}
|
|
10335
|
-
|
|
10336
10020
|
innerOnce.fn = cb;
|
|
10337
10021
|
this.on(path, type, innerOnce);
|
|
10338
10022
|
return this;
|
|
@@ -10341,17 +10025,13 @@ var FormEvent = /*#__PURE__*/function () {
|
|
|
10341
10025
|
key: "emit",
|
|
10342
10026
|
value: function emit(path, type) {
|
|
10343
10027
|
if (!this.callbacks[path]) return;
|
|
10344
|
-
|
|
10345
10028
|
if (type in this.callbacks[path]) {
|
|
10346
10029
|
var runs = _toConsumableArray(this.callbacks[path][type]);
|
|
10347
|
-
|
|
10348
10030
|
for (var _len = arguments.length, arg = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
10349
10031
|
arg[_key - 2] = arguments[_key];
|
|
10350
10032
|
}
|
|
10351
|
-
|
|
10352
10033
|
var _iterator = _createForOfIteratorHelper(runs),
|
|
10353
|
-
|
|
10354
|
-
|
|
10034
|
+
_step;
|
|
10355
10035
|
try {
|
|
10356
10036
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
10357
10037
|
var cb = _step.value;
|
|
@@ -10365,13 +10045,12 @@ var FormEvent = /*#__PURE__*/function () {
|
|
|
10365
10045
|
}
|
|
10366
10046
|
}
|
|
10367
10047
|
}]);
|
|
10368
|
-
|
|
10369
10048
|
return FormEvent;
|
|
10370
10049
|
}();
|
|
10371
10050
|
var events = new FormEvent();
|
|
10372
10051
|
|
|
10373
10052
|
var _excluded$4 = ["url", "params"],
|
|
10374
|
-
|
|
10053
|
+
_excluded2 = ["name"];
|
|
10375
10054
|
var Widget = Vue.extend({
|
|
10376
10055
|
name: 'Widget',
|
|
10377
10056
|
props: props,
|
|
@@ -10395,7 +10074,6 @@ var Widget = Vue.extend({
|
|
|
10395
10074
|
},
|
|
10396
10075
|
parent: function parent() {
|
|
10397
10076
|
var _this$widgetNode;
|
|
10398
|
-
|
|
10399
10077
|
return (_this$widgetNode = this.widgetNode) === null || _this$widgetNode === void 0 ? void 0 : _this$widgetNode.parent;
|
|
10400
10078
|
}
|
|
10401
10079
|
},
|
|
@@ -10403,7 +10081,6 @@ var Widget = Vue.extend({
|
|
|
10403
10081
|
value: {
|
|
10404
10082
|
handler: function handler(newValue, oldValue) {
|
|
10405
10083
|
var _this = this;
|
|
10406
|
-
|
|
10407
10084
|
if (!deepEquals(newValue, oldValue)) {
|
|
10408
10085
|
setTimeout(function () {
|
|
10409
10086
|
reactionDispatch(_this.path, 'valChange');
|
|
@@ -10415,29 +10092,28 @@ var Widget = Vue.extend({
|
|
|
10415
10092
|
},
|
|
10416
10093
|
created: function created() {
|
|
10417
10094
|
var _this2 = this;
|
|
10418
|
-
|
|
10419
10095
|
// 表单项配置
|
|
10420
10096
|
var uiOptions = Schema.getUiOptions(this.schema);
|
|
10421
10097
|
this.formItemProps = _objectSpread2(_objectSpread2({}, uiOptions), {}, {
|
|
10422
10098
|
// schema配置不存在title时默认用属性名作为title
|
|
10423
10099
|
label: uiOptions.showTitle ? uiOptions.label || Path.getPathLastProp(this.path) : '',
|
|
10424
10100
|
required: this.required
|
|
10425
|
-
});
|
|
10426
|
-
|
|
10101
|
+
});
|
|
10102
|
+
// 设置widget初始化状态 ui:component优先级 > ui:props优先级
|
|
10427
10103
|
var vNodeData = Schema.getUiComponent(this.schema);
|
|
10428
10104
|
var defaultProps = Object.assign({}, this.formItemProps, vNodeData.props || {});
|
|
10429
10105
|
Object.keys(defaultProps).forEach(function (key) {
|
|
10430
10106
|
if (Reflect.has(_this2.state, key)) {
|
|
10431
10107
|
_this2.setState(key, defaultProps[key]);
|
|
10432
10108
|
}
|
|
10433
|
-
});
|
|
10434
|
-
|
|
10109
|
+
});
|
|
10110
|
+
// 注册widget TreeNode
|
|
10435
10111
|
widgetTree.addWidgetNode(this.path, this, 'node');
|
|
10436
10112
|
},
|
|
10437
10113
|
mounted: function mounted() {
|
|
10438
10114
|
// 注册联动
|
|
10439
|
-
reactionRegister(this.path, this.schema['ui:reactions']);
|
|
10440
|
-
|
|
10115
|
+
reactionRegister(this.path, this.schema['ui:reactions']);
|
|
10116
|
+
// 首次联动
|
|
10441
10117
|
reactionDispatch(this.path, 'valChange');
|
|
10442
10118
|
reactionDispatch(this.path, 'lifetime/init');
|
|
10443
10119
|
},
|
|
@@ -10461,51 +10137,41 @@ var Widget = Vue.extend({
|
|
|
10461
10137
|
},
|
|
10462
10138
|
loadDataSource: function loadDataSource() {
|
|
10463
10139
|
var _this3 = this;
|
|
10464
|
-
|
|
10465
10140
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
10466
10141
|
var _this3$schema, _this3$schema$uiComp, _this3$schema$uiComp$;
|
|
10467
|
-
|
|
10468
10142
|
var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
|
|
10469
|
-
|
|
10470
10143
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10471
|
-
while (1) {
|
|
10472
|
-
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10476
|
-
if (!xhrConfig) {
|
|
10477
|
-
_context.next = 18;
|
|
10478
|
-
break;
|
|
10479
|
-
}
|
|
10480
|
-
|
|
10481
|
-
url = xhrConfig.url, params = xhrConfig.params, reset = _objectWithoutProperties(xhrConfig, _excluded$4);
|
|
10482
|
-
_this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
|
|
10483
|
-
_context.prev = 4;
|
|
10484
|
-
_this3.loading = true;
|
|
10485
|
-
remoteURL = executeExpression(url, _this3);
|
|
10486
|
-
requestParams = isObj(params) ? executeExpression(params, _this3) : params;
|
|
10487
|
-
_context.next = 10;
|
|
10488
|
-
return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
10489
|
-
params: requestParams,
|
|
10490
|
-
responseParse: responseParse
|
|
10491
|
-
}));
|
|
10492
|
-
|
|
10493
|
-
case 10:
|
|
10494
|
-
_this3.datasource = _context.sent;
|
|
10495
|
-
_this3.loading = false;
|
|
10144
|
+
while (1) switch (_context.prev = _context.next) {
|
|
10145
|
+
case 0:
|
|
10146
|
+
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;
|
|
10147
|
+
if (!xhrConfig) {
|
|
10496
10148
|
_context.next = 18;
|
|
10497
10149
|
break;
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
|
|
10501
|
-
|
|
10502
|
-
|
|
10503
|
-
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
|
-
|
|
10507
|
-
|
|
10508
|
-
|
|
10150
|
+
}
|
|
10151
|
+
url = xhrConfig.url, params = xhrConfig.params, reset = _objectWithoutProperties(xhrConfig, _excluded$4);
|
|
10152
|
+
_this3$httpAdapter = _this3.httpAdapter, _this3$httpAdapter$re = _this3$httpAdapter.request, http = _this3$httpAdapter$re === void 0 ? request : _this3$httpAdapter$re, responseParse = _this3$httpAdapter.responseParse;
|
|
10153
|
+
_context.prev = 4;
|
|
10154
|
+
_this3.loading = true;
|
|
10155
|
+
remoteURL = executeExpression(url, _this3);
|
|
10156
|
+
requestParams = isObj(params) ? executeExpression(params, _this3) : params;
|
|
10157
|
+
_context.next = 10;
|
|
10158
|
+
return http(remoteURL, _objectSpread2(_objectSpread2({}, reset), {}, {
|
|
10159
|
+
params: requestParams,
|
|
10160
|
+
responseParse: responseParse
|
|
10161
|
+
}));
|
|
10162
|
+
case 10:
|
|
10163
|
+
_this3.datasource = _context.sent;
|
|
10164
|
+
_this3.loading = false;
|
|
10165
|
+
_context.next = 18;
|
|
10166
|
+
break;
|
|
10167
|
+
case 14:
|
|
10168
|
+
_context.prev = 14;
|
|
10169
|
+
_context.t0 = _context["catch"](4);
|
|
10170
|
+
_this3.loading = false;
|
|
10171
|
+
console.error(_context.t0);
|
|
10172
|
+
case 18:
|
|
10173
|
+
case "end":
|
|
10174
|
+
return _context.stop();
|
|
10509
10175
|
}
|
|
10510
10176
|
}, _callee, null, [[4, 14]]);
|
|
10511
10177
|
}))();
|
|
@@ -10519,29 +10185,26 @@ var Widget = Vue.extend({
|
|
|
10519
10185
|
},
|
|
10520
10186
|
render: function render(h) {
|
|
10521
10187
|
var _events$callbacks,
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10188
|
+
_this$$scopedSlots$de,
|
|
10189
|
+
_this$$scopedSlots$de2,
|
|
10190
|
+
_this$$scopedSlots,
|
|
10191
|
+
_this$datasource,
|
|
10192
|
+
_this$datasource$find,
|
|
10193
|
+
_this4 = this,
|
|
10194
|
+
_this$$scopedSlots$su,
|
|
10195
|
+
_this$$scopedSlots2;
|
|
10531
10196
|
var _Schema$getUiComponen = Schema.getUiComponent(this.schema),
|
|
10532
|
-
|
|
10533
|
-
|
|
10534
|
-
|
|
10535
|
-
|
|
10197
|
+
name = _Schema$getUiComponen.name,
|
|
10198
|
+
uiVnodeData = _objectWithoutProperties(_Schema$getUiComponen, _excluded2);
|
|
10199
|
+
// 注意顺序!!!
|
|
10536
10200
|
var widgetProps = _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
10537
10201
|
loading: this.loading,
|
|
10538
10202
|
value: this.value
|
|
10539
10203
|
});
|
|
10540
|
-
|
|
10541
10204
|
var self = this;
|
|
10542
10205
|
var widgetName = registry.getComponent(name) || name || Schema.getDefaultWidget(this.schema);
|
|
10543
|
-
var widgetEvents = ((_events$callbacks = events.callbacks) === null || _events$callbacks === void 0 ? void 0 : _events$callbacks[this.path]) || {};
|
|
10544
|
-
|
|
10206
|
+
var widgetEvents = ((_events$callbacks = events.callbacks) === null || _events$callbacks === void 0 ? void 0 : _events$callbacks[this.path]) || {};
|
|
10207
|
+
// 当前state属性优先级最高
|
|
10545
10208
|
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, {
|
|
10546
10209
|
path: this.path
|
|
10547
10210
|
})) !== null && _this$$scopedSlots$de !== void 0 ? _this$$scopedSlots$de : h(widgetName, mergeDeep({
|
|
@@ -10562,7 +10225,7 @@ var Widget = Vue.extend({
|
|
|
10562
10225
|
reactionDispatch(self.path, 'effect/click');
|
|
10563
10226
|
}
|
|
10564
10227
|
})
|
|
10565
|
-
}, mergeDeep(uiVnodeData, {
|
|
10228
|
+
}, mergeDeep({}, uiVnodeData, {
|
|
10566
10229
|
props: _objectSpread2(_objectSpread2({}, this.state), {}, {
|
|
10567
10230
|
datasource: this.datasource,
|
|
10568
10231
|
readonly: this.readonly,
|
|
@@ -10572,10 +10235,10 @@ var Widget = Vue.extend({
|
|
|
10572
10235
|
})));
|
|
10573
10236
|
var readonlyValue = ((_this$datasource = this.datasource) === null || _this$datasource === void 0 ? void 0 : (_this$datasource$find = _this$datasource.find(function (item) {
|
|
10574
10237
|
return item.value === _this4.value;
|
|
10575
|
-
})) === null || _this$datasource$find === void 0 ? void 0 : _this$datasource$find.label) || this.value;
|
|
10576
|
-
|
|
10577
|
-
var renderReadonlyWidget = h('div', [readonlyValue === '' ? '--' : String(readonlyValue)]);
|
|
10578
|
-
|
|
10238
|
+
})) === null || _this$datasource$find === void 0 ? void 0 : _this$datasource$find.label) || this.value;
|
|
10239
|
+
// 渲染默认readonly模式
|
|
10240
|
+
var renderReadonlyWidget = h('div', [readonlyValue === '' ? '--' : String(readonlyValue)]);
|
|
10241
|
+
// 渲染删除按钮(用于数组类型widget删除)
|
|
10579
10242
|
var renderDelete = function renderDelete() {
|
|
10580
10243
|
return h('span', {
|
|
10581
10244
|
class: ['bk-schema-form-group-delete'],
|
|
@@ -10592,7 +10255,6 @@ var Widget = Vue.extend({
|
|
|
10592
10255
|
class: ['bk-icon icon-close3-shape']
|
|
10593
10256
|
})]);
|
|
10594
10257
|
};
|
|
10595
|
-
|
|
10596
10258
|
return h(registry.getBaseWidget('form-item'), {
|
|
10597
10259
|
props: this.formItemProps,
|
|
10598
10260
|
style: _objectSpread2(_objectSpread2(_objectSpread2({}, this.layout.item || {}), this.layout.container || {}), {}, {
|
|
@@ -10625,13 +10287,12 @@ var ObjectField = Vue.extend({
|
|
|
10625
10287
|
props: props,
|
|
10626
10288
|
render: function render(h, ctx) {
|
|
10627
10289
|
var _ctx$props = ctx.props,
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10290
|
+
schema = _ctx$props.schema,
|
|
10291
|
+
path = _ctx$props.path,
|
|
10292
|
+
layout = _ctx$props.layout,
|
|
10293
|
+
rootData = _ctx$props.rootData;
|
|
10632
10294
|
var properties = orderProperties(Object.keys(schema.properties || {}), schema['ui:order']);
|
|
10633
10295
|
var vNodeList = [];
|
|
10634
|
-
|
|
10635
10296
|
if (properties.length) {
|
|
10636
10297
|
vNodeList = properties.map(function (name) {
|
|
10637
10298
|
var curPath = Path.getCurPath(path, name);
|
|
@@ -10645,7 +10306,6 @@ var ObjectField = Vue.extend({
|
|
|
10645
10306
|
path: curPath,
|
|
10646
10307
|
layout: layoutConfig,
|
|
10647
10308
|
removeable: false // todo: 不往下传递可删除属性
|
|
10648
|
-
|
|
10649
10309
|
})
|
|
10650
10310
|
}));
|
|
10651
10311
|
});
|
|
@@ -10653,12 +10313,10 @@ var ObjectField = Vue.extend({
|
|
|
10653
10313
|
// 如果object属性没有配置 Properties,但是有ui:component属性,那个直接渲染对应的组件
|
|
10654
10314
|
vNodeList = [h(Widget, _objectSpread2({}, ctx.data))];
|
|
10655
10315
|
}
|
|
10656
|
-
|
|
10657
10316
|
var _Schema$getGroupWrap = Schema.getGroupWrap(schema),
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10317
|
+
name = _Schema$getGroupWrap.name,
|
|
10318
|
+
vnodeData = _objectWithoutProperties(_Schema$getGroupWrap, _excluded$3);
|
|
10319
|
+
// todo: wrap组件不要透传ctx.data,不然会引起组件无限递归问题
|
|
10662
10320
|
return h(name, mergeDeep({
|
|
10663
10321
|
props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
|
|
10664
10322
|
value: Path.getPathVal(rootData, path),
|
|
@@ -10685,7 +10343,6 @@ var NumberField = Vue.extend({
|
|
|
10685
10343
|
props: props,
|
|
10686
10344
|
render: function render(h, ctx) {
|
|
10687
10345
|
var _ctx$props$schema;
|
|
10688
|
-
|
|
10689
10346
|
return h(StringField, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
|
|
10690
10347
|
props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
|
|
10691
10348
|
schema: mergeDeep({
|
|
@@ -10703,7 +10360,7 @@ var NumberField = Vue.extend({
|
|
|
10703
10360
|
});
|
|
10704
10361
|
|
|
10705
10362
|
var _excluded$2 = ["name"];
|
|
10706
|
-
|
|
10363
|
+
// 默认数组控件
|
|
10707
10364
|
var ArrayWidget = Vue.extend({
|
|
10708
10365
|
name: 'ArrayWidget',
|
|
10709
10366
|
props: props,
|
|
@@ -10714,9 +10371,8 @@ var ArrayWidget = Vue.extend({
|
|
|
10714
10371
|
// 补全minItems项
|
|
10715
10372
|
handleFillItem: function handleFillItem() {
|
|
10716
10373
|
var _this$schema$minItems = this.schema.minItems,
|
|
10717
|
-
|
|
10374
|
+
minItems = _this$schema$minItems === void 0 ? 0 : _this$schema$minItems;
|
|
10718
10375
|
var valueLen = this.value ? this.value.length : 0;
|
|
10719
|
-
|
|
10720
10376
|
if (valueLen < minItems) {
|
|
10721
10377
|
var data = Schema.getSchemaDefaultValue(this.schema.items);
|
|
10722
10378
|
var remainData = new Array(minItems - valueLen).fill(data);
|
|
@@ -10749,7 +10405,6 @@ var ArrayWidget = Vue.extend({
|
|
|
10749
10405
|
},
|
|
10750
10406
|
render: function render(h) {
|
|
10751
10407
|
var _this = this;
|
|
10752
|
-
|
|
10753
10408
|
var self = this;
|
|
10754
10409
|
var arrVnodeList = (Array.isArray(this.value) ? this.value : []).map(function (_, index) {
|
|
10755
10410
|
var curPath = Path.getCurPath(_this.path, index);
|
|
@@ -10760,8 +10415,8 @@ var ArrayWidget = Vue.extend({
|
|
|
10760
10415
|
path: curPath,
|
|
10761
10416
|
layout: _objectSpread2(_objectSpread2({}, _this.layout), {}, {
|
|
10762
10417
|
item: {} // todo: 暂时不支持数组项之间的布局
|
|
10763
|
-
|
|
10764
10418
|
}),
|
|
10419
|
+
|
|
10765
10420
|
removeable: true
|
|
10766
10421
|
}),
|
|
10767
10422
|
on: _objectSpread2(_objectSpread2({}, _this.$listeners), {}, {
|
|
@@ -10771,17 +10426,15 @@ var ArrayWidget = Vue.extend({
|
|
|
10771
10426
|
})
|
|
10772
10427
|
});
|
|
10773
10428
|
});
|
|
10774
|
-
|
|
10775
10429
|
var _Schema$getGroupWrap = Schema.getGroupWrap(this.schema),
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10430
|
+
name = _Schema$getGroupWrap.name,
|
|
10431
|
+
vnode = _objectWithoutProperties(_Schema$getGroupWrap, _excluded$2);
|
|
10779
10432
|
return h(name, mergeDeep({
|
|
10780
10433
|
props: _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
10781
10434
|
layout: {},
|
|
10782
10435
|
showTitle: true // 数组类型默认展示分组title
|
|
10783
|
-
|
|
10784
10436
|
}),
|
|
10437
|
+
|
|
10785
10438
|
style: _objectSpread2({}, this.layout.item || {})
|
|
10786
10439
|
}, vnode), [].concat(_toConsumableArray(arrVnodeList), [h(registry.getBaseWidget('form-item'), {
|
|
10787
10440
|
class: {
|
|
@@ -10807,9 +10460,8 @@ var ArrayField = Vue.extend({
|
|
|
10807
10460
|
props: props,
|
|
10808
10461
|
render: function render(h, ctx) {
|
|
10809
10462
|
var _ctx$props = ctx.props,
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10463
|
+
schema = _ctx$props.schema,
|
|
10464
|
+
path = _ctx$props.path;
|
|
10813
10465
|
if (Schema.isMultiSelect(schema) || Schema.isCustomArrayWidget(schema)) {
|
|
10814
10466
|
// 多选类型 或 自定义数组类型(伪数组类型(只有一个FormItem,但是值为数组,值一般由自定义Widget控件决定))
|
|
10815
10467
|
return h(Widget, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
|
|
@@ -10824,14 +10476,12 @@ var ArrayField = Vue.extend({
|
|
|
10824
10476
|
}, ctx.props.schema)
|
|
10825
10477
|
})
|
|
10826
10478
|
}));
|
|
10827
|
-
}
|
|
10828
|
-
|
|
10829
|
-
|
|
10479
|
+
}
|
|
10480
|
+
// 元组类型
|
|
10830
10481
|
if (Schema.isTupleArray(schema)) {
|
|
10831
10482
|
var _Schema$getGroupWrap = Schema.getGroupWrap(schema),
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10483
|
+
name = _Schema$getGroupWrap.name,
|
|
10484
|
+
vnode = _objectWithoutProperties(_Schema$getGroupWrap, _excluded$1);
|
|
10835
10485
|
var tupleVnodeList = schema.items.map(function (item, index) {
|
|
10836
10486
|
return h(SchemaField, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
|
|
10837
10487
|
key: Path.getCurPath(path, index),
|
|
@@ -10847,9 +10497,8 @@ var ArrayField = Vue.extend({
|
|
|
10847
10497
|
showTitle: true
|
|
10848
10498
|
})
|
|
10849
10499
|
}, vnode), _toConsumableArray(tupleVnodeList));
|
|
10850
|
-
}
|
|
10851
|
-
|
|
10852
|
-
|
|
10500
|
+
}
|
|
10501
|
+
// 一般数组类型
|
|
10853
10502
|
return h(ArrayWidget, _objectSpread2({}, ctx.data));
|
|
10854
10503
|
}
|
|
10855
10504
|
});
|
|
@@ -10860,10 +10509,8 @@ var BooleanField = Vue.extend({
|
|
|
10860
10509
|
props: props,
|
|
10861
10510
|
render: function render(h, ctx) {
|
|
10862
10511
|
var _ref = ctx.props.schema['ui:component'] || {},
|
|
10863
|
-
|
|
10864
|
-
|
|
10512
|
+
name = _ref.name;
|
|
10865
10513
|
var widgetProps = {};
|
|
10866
|
-
|
|
10867
10514
|
if (['radio', 'select'].includes(name)) {
|
|
10868
10515
|
// radioGroup、select类型需要默认数据源
|
|
10869
10516
|
widgetProps = {
|
|
@@ -10877,13 +10524,11 @@ var BooleanField = Vue.extend({
|
|
|
10877
10524
|
};
|
|
10878
10525
|
} else if (name === 'checkbox') {
|
|
10879
10526
|
var _ctx$props$schema;
|
|
10880
|
-
|
|
10881
10527
|
// boolean 类型checkbox
|
|
10882
10528
|
widgetProps = {
|
|
10883
10529
|
label: (_ctx$props$schema = ctx.props.schema) === null || _ctx$props$schema === void 0 ? void 0 : _ctx$props$schema.title
|
|
10884
10530
|
};
|
|
10885
10531
|
}
|
|
10886
|
-
|
|
10887
10532
|
return h(Widget, _objectSpread2(_objectSpread2({}, ctx.data), {}, {
|
|
10888
10533
|
props: _objectSpread2(_objectSpread2({}, ctx.props), {}, {
|
|
10889
10534
|
schema: mergeDeep({
|
|
@@ -10915,10 +10560,9 @@ var CompositionField = Vue.extend({
|
|
|
10915
10560
|
},
|
|
10916
10561
|
created: function created() {
|
|
10917
10562
|
var _this = this;
|
|
10918
|
-
|
|
10919
10563
|
// 初始化默认 composition 选项
|
|
10920
|
-
var compositionList = this.schema[this.composition] || [];
|
|
10921
|
-
|
|
10564
|
+
var compositionList = this.schema[this.composition] || [];
|
|
10565
|
+
// todo 没有required选项时回显不成功
|
|
10922
10566
|
var index = compositionList.findIndex(function (item) {
|
|
10923
10567
|
return ajv.validate(item, _this.value);
|
|
10924
10568
|
});
|
|
@@ -10926,24 +10570,20 @@ var CompositionField = Vue.extend({
|
|
|
10926
10570
|
},
|
|
10927
10571
|
render: function render(h) {
|
|
10928
10572
|
var _this2 = this,
|
|
10929
|
-
|
|
10930
|
-
|
|
10573
|
+
_vnodeData$props;
|
|
10931
10574
|
var compositionList = this.schema[this.composition] || [];
|
|
10932
10575
|
var schemaList = compositionList.map(function (item) {
|
|
10933
10576
|
var data = mergeDeep({}, _this2.schema, item);
|
|
10934
10577
|
delete data[_this2.composition];
|
|
10935
10578
|
return data;
|
|
10936
10579
|
});
|
|
10937
|
-
|
|
10938
10580
|
var _Schema$getUiProps = Schema.getUiProps("ui:".concat(this.composition), this.schema),
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10942
|
-
|
|
10581
|
+
_Schema$getUiProps$na = _Schema$getUiProps.name,
|
|
10582
|
+
com = _Schema$getUiProps$na === void 0 ? 'radio' : _Schema$getUiProps$na,
|
|
10583
|
+
vnodeData = _objectWithoutProperties(_Schema$getUiProps, _excluded);
|
|
10943
10584
|
var isConst = _typeof(this.schema.type) !== 'object' && schemaList.every(function (item) {
|
|
10944
10585
|
return item.const;
|
|
10945
10586
|
});
|
|
10946
|
-
|
|
10947
10587
|
if (isConst) {
|
|
10948
10588
|
// 全是常量
|
|
10949
10589
|
return h(Widget, {
|
|
@@ -10952,10 +10592,8 @@ var CompositionField = Vue.extend({
|
|
|
10952
10592
|
on: _objectSpread2({}, this.$listeners)
|
|
10953
10593
|
});
|
|
10954
10594
|
}
|
|
10955
|
-
|
|
10956
10595
|
var _Schema$getUiProps2 = Schema.getUiProps('ui:composition', this.schema),
|
|
10957
|
-
|
|
10958
|
-
|
|
10596
|
+
compositionVnodeData = _extends$1({}, (_objectDestructuringEmpty(_Schema$getUiProps2), _Schema$getUiProps2));
|
|
10959
10597
|
return h(registry.getComponent('group'), mergeDeep({
|
|
10960
10598
|
props: _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
10961
10599
|
rootData: this.rootData,
|
|
@@ -10968,7 +10606,8 @@ var CompositionField = Vue.extend({
|
|
|
10968
10606
|
_this2.$emit('remove', _this2.path);
|
|
10969
10607
|
}
|
|
10970
10608
|
}
|
|
10971
|
-
}, compositionVnodeData), [
|
|
10609
|
+
}, compositionVnodeData), [
|
|
10610
|
+
// anyOf component
|
|
10972
10611
|
h(registry.getBaseWidget('form-item'), {
|
|
10973
10612
|
props: {
|
|
10974
10613
|
label: (_vnodeData$props = vnodeData.props) === null || _vnodeData$props === void 0 ? void 0 : _vnodeData$props.title
|
|
@@ -10988,24 +10627,21 @@ var CompositionField = Vue.extend({
|
|
|
10988
10627
|
},
|
|
10989
10628
|
on: {
|
|
10990
10629
|
input: function input(index) {
|
|
10991
|
-
_this2.activeIndex = index;
|
|
10992
|
-
|
|
10630
|
+
_this2.activeIndex = index;
|
|
10631
|
+
// todo 删除其他 composition 字段
|
|
10993
10632
|
if (isObj(_this2.value)) {
|
|
10994
10633
|
var newValue = JSON.parse(JSON.stringify(_this2.value));
|
|
10995
|
-
|
|
10996
10634
|
var _props = compositionList.filter(function (_, index) {
|
|
10997
10635
|
return index !== _this2.activeIndex;
|
|
10998
10636
|
}).reduce(function (pre, item) {
|
|
10999
10637
|
var _item$properties = item.properties,
|
|
11000
|
-
|
|
10638
|
+
properties = _item$properties === void 0 ? {} : _item$properties;
|
|
11001
10639
|
pre.push.apply(pre, _toConsumableArray(Object.keys(properties)));
|
|
11002
10640
|
return pre;
|
|
11003
10641
|
}, []);
|
|
11004
|
-
|
|
11005
10642
|
_props.forEach(function (prop) {
|
|
11006
10643
|
delete newValue[prop];
|
|
11007
10644
|
});
|
|
11008
|
-
|
|
11009
10645
|
_this2.$emit('input', {
|
|
11010
10646
|
path: _this2.path,
|
|
11011
10647
|
value: newValue
|
|
@@ -11013,7 +10649,8 @@ var CompositionField = Vue.extend({
|
|
|
11013
10649
|
}
|
|
11014
10650
|
}
|
|
11015
10651
|
}
|
|
11016
|
-
}, vnodeData || {}))]),
|
|
10652
|
+
}, vnodeData || {}))]),
|
|
10653
|
+
// schema
|
|
11017
10654
|
h(SchemaField, {
|
|
11018
10655
|
key: this.activeIndex,
|
|
11019
10656
|
props: _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
@@ -11054,7 +10691,6 @@ var CheckboxWidget = Vue.extend({
|
|
|
11054
10691
|
},
|
|
11055
10692
|
render: function render(h) {
|
|
11056
10693
|
var _this = this;
|
|
11057
|
-
|
|
11058
10694
|
return Array.isArray(this.value) ? h(registry.getBaseWidget('checkbox-group'), {
|
|
11059
10695
|
on: {
|
|
11060
10696
|
change: this.handleChange
|
|
@@ -11160,7 +10796,6 @@ var RadioWidget = Vue.extend({
|
|
|
11160
10796
|
},
|
|
11161
10797
|
render: function render(h) {
|
|
11162
10798
|
var _this = this;
|
|
11163
|
-
|
|
11164
10799
|
return h(registry.getBaseWidget('radio-group'), {
|
|
11165
10800
|
props: _objectSpread2({
|
|
11166
10801
|
value: this.value
|
|
@@ -11211,8 +10846,8 @@ var ButtonWidget = Vue.extend({
|
|
|
11211
10846
|
}
|
|
11212
10847
|
});
|
|
11213
10848
|
|
|
10849
|
+
// @todo widgetTree添加单行node,内置导入、导出功能
|
|
11214
10850
|
// 获取表格单行默认值
|
|
11215
|
-
|
|
11216
10851
|
var getRowDefaultData = function getRowDefaultData() {
|
|
11217
10852
|
var properties = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11218
10853
|
var keys = Object.keys(properties);
|
|
@@ -11222,7 +10857,6 @@ var getRowDefaultData = function getRowDefaultData() {
|
|
|
11222
10857
|
});
|
|
11223
10858
|
return [data];
|
|
11224
10859
|
};
|
|
11225
|
-
|
|
11226
10860
|
var TableWidget = Vue.extend({
|
|
11227
10861
|
name: 'TableWidget',
|
|
11228
10862
|
props: props,
|
|
@@ -11230,7 +10864,7 @@ var TableWidget = Vue.extend({
|
|
|
11230
10864
|
// 单元格表单编辑
|
|
11231
10865
|
handleCellValChange: function handleCellValChange(_ref) {
|
|
11232
10866
|
var path = _ref.path,
|
|
11233
|
-
|
|
10867
|
+
value = _ref.value;
|
|
11234
10868
|
var subPath = Path.getSubPath(this.path, path);
|
|
11235
10869
|
var newValue = Path.setPathValue(this.value, subPath, value);
|
|
11236
10870
|
this.$emit('input', newValue);
|
|
@@ -11238,7 +10872,6 @@ var TableWidget = Vue.extend({
|
|
|
11238
10872
|
// 新增
|
|
11239
10873
|
handleAddRow: function handleAddRow(index) {
|
|
11240
10874
|
var _this$$props$schema$i;
|
|
11241
|
-
|
|
11242
10875
|
var newValue = this.value.slice(0);
|
|
11243
10876
|
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))));
|
|
11244
10877
|
this.$emit('input', newValue);
|
|
@@ -11252,19 +10885,17 @@ var TableWidget = Vue.extend({
|
|
|
11252
10885
|
},
|
|
11253
10886
|
render: function render(h) {
|
|
11254
10887
|
var _schema$items,
|
|
11255
|
-
|
|
11256
|
-
|
|
10888
|
+
_this = this;
|
|
11257
10889
|
var self = this;
|
|
11258
10890
|
var _this$$props = this.$props,
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
|
|
10891
|
+
schema = _this$$props.schema,
|
|
10892
|
+
readonly = _this$$props.readonly,
|
|
10893
|
+
readonlyMode = _this$$props.readonlyMode,
|
|
10894
|
+
path = _this$$props.path,
|
|
10895
|
+
context = _this$$props.context,
|
|
10896
|
+
rootData = _this$$props.rootData,
|
|
10897
|
+
value = _this$$props.value;
|
|
11266
10898
|
var columnsKey = Object.keys(((_schema$items = schema.items) === null || _schema$items === void 0 ? void 0 : _schema$items.properties) || []);
|
|
11267
|
-
|
|
11268
10899
|
var getTableColumn = function getTableColumn() {
|
|
11269
10900
|
var VNodeList = columnsKey.map(function (key) {
|
|
11270
10901
|
var colField = schema.items.properties[key];
|
|
@@ -11301,7 +10932,6 @@ var TableWidget = Vue.extend({
|
|
|
11301
10932
|
}
|
|
11302
10933
|
});
|
|
11303
10934
|
});
|
|
11304
|
-
|
|
11305
10935
|
if (!_this.readonly) {
|
|
11306
10936
|
VNodeList.push(h(registry.getBaseWidget('table-column'), {
|
|
11307
10937
|
props: {
|
|
@@ -11331,10 +10961,8 @@ var TableWidget = Vue.extend({
|
|
|
11331
10961
|
}
|
|
11332
10962
|
}));
|
|
11333
10963
|
}
|
|
11334
|
-
|
|
11335
10964
|
return VNodeList;
|
|
11336
10965
|
};
|
|
11337
|
-
|
|
11338
10966
|
return h(registry.getBaseWidget('table'), {
|
|
11339
10967
|
props: _objectSpread2(_objectSpread2({}, schema['ui:component'].props || {}), {}, {
|
|
11340
10968
|
data: value
|
|
@@ -11342,7 +10970,7 @@ var TableWidget = Vue.extend({
|
|
|
11342
10970
|
on: {
|
|
11343
10971
|
input: function input(_ref2) {
|
|
11344
10972
|
var path = _ref2.path,
|
|
11345
|
-
|
|
10973
|
+
value = _ref2.value;
|
|
11346
10974
|
self.$emit('input', {
|
|
11347
10975
|
path: path,
|
|
11348
10976
|
value: value
|
|
@@ -11353,8 +10981,8 @@ var TableWidget = Vue.extend({
|
|
|
11353
10981
|
empty: function empty() {
|
|
11354
10982
|
return _this.readonly ? null : h('div', {
|
|
11355
10983
|
style: {
|
|
11356
|
-
|
|
11357
|
-
|
|
10984
|
+
color: '#3a84ff',
|
|
10985
|
+
cursor: 'pointer'
|
|
11358
10986
|
},
|
|
11359
10987
|
on: {
|
|
11360
10988
|
click: function click() {
|
|
@@ -11438,25 +11066,21 @@ var FieldGroupWrap = Vue.extend({
|
|
|
11438
11066
|
},
|
|
11439
11067
|
render: function render(h) {
|
|
11440
11068
|
var _this$layout,
|
|
11441
|
-
|
|
11442
|
-
|
|
11443
|
-
|
|
11444
|
-
|
|
11445
|
-
|
|
11069
|
+
_this$layout2,
|
|
11070
|
+
_this$schema,
|
|
11071
|
+
_this$layout3,
|
|
11072
|
+
_this = this;
|
|
11446
11073
|
var schemaFormStyle = _objectSpread2({
|
|
11447
11074
|
position: 'relative',
|
|
11448
11075
|
border: this.border ? '1px solid #dcdee5' : 'none',
|
|
11449
11076
|
display: !this.state.visible ? 'none' : ''
|
|
11450
11077
|
}, ((_this$layout = this.layout) === null || _this$layout === void 0 ? void 0 : _this$layout.item) || {});
|
|
11451
|
-
|
|
11452
11078
|
var groupContentStyle = _objectSpread2({}, ((_this$layout2 = this.layout) === null || _this$layout2 === void 0 ? void 0 : _this$layout2.container) || {
|
|
11453
11079
|
display: 'grid',
|
|
11454
11080
|
gridGap: '20px' // 未设置layout的布局组的默认样式
|
|
11455
|
-
|
|
11456
11081
|
});
|
|
11457
11082
|
|
|
11458
11083
|
var self = this;
|
|
11459
|
-
|
|
11460
11084
|
var renderDelete = function renderDelete() {
|
|
11461
11085
|
return h('span', {
|
|
11462
11086
|
class: ['bk-schema-form-group-delete'],
|
|
@@ -11473,7 +11097,6 @@ var FieldGroupWrap = Vue.extend({
|
|
|
11473
11097
|
class: ['bk-icon icon-close3-shape']
|
|
11474
11098
|
})]);
|
|
11475
11099
|
};
|
|
11476
|
-
|
|
11477
11100
|
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);
|
|
11478
11101
|
var groupErrorTipsContent = Object.keys(this.groupErrorTips).map(function (widgetPath) {
|
|
11479
11102
|
return h("p", [_this.groupErrorTips[widgetPath]]);
|
|
@@ -11499,17 +11122,17 @@ var FieldGroupWrap = Vue.extend({
|
|
|
11499
11122
|
}
|
|
11500
11123
|
});
|
|
11501
11124
|
|
|
11502
|
-
function _extends(){return _extends=Object.assign
|
|
11125
|
+
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;
|
|
11503
11126
|
|
|
11127
|
+
// 伪数组类型
|
|
11504
11128
|
var KeyValueArrayWidget = Vue.extend({
|
|
11505
11129
|
name: 'KeyValueArrayWidget',
|
|
11506
11130
|
props: _objectSpread2({}, props),
|
|
11507
11131
|
mounted: function mounted() {
|
|
11508
11132
|
var _this$value;
|
|
11509
|
-
|
|
11510
11133
|
var _this$schema$minItems = this.schema.minItems,
|
|
11511
|
-
|
|
11512
|
-
|
|
11134
|
+
minItems = _this$schema$minItems === void 0 ? 0 : _this$schema$minItems;
|
|
11135
|
+
// 补全minItems项
|
|
11513
11136
|
if (((_this$value = this.value) === null || _this$value === void 0 ? void 0 : _this$value.length) < minItems) {
|
|
11514
11137
|
var data = Schema.getSchemaDefaultValue(this.schema.items);
|
|
11515
11138
|
var remainData = new Array(minItems - this.value.length).fill(data);
|
|
@@ -11530,7 +11153,7 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11530
11153
|
},
|
|
11531
11154
|
handleInput: function handleInput(_ref) {
|
|
11532
11155
|
var path = _ref.path,
|
|
11533
|
-
|
|
11156
|
+
value = _ref.value;
|
|
11534
11157
|
// 捕获widget input事件,包装继续传给上一层处理
|
|
11535
11158
|
var subPath = Path.getSubPath(this.path, path);
|
|
11536
11159
|
var newValue = Path.setPathValue(this.value, subPath, value);
|
|
@@ -11539,12 +11162,11 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11539
11162
|
},
|
|
11540
11163
|
render: function render(h) {
|
|
11541
11164
|
var _this$schema,
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11165
|
+
_this$schema$items,
|
|
11166
|
+
_this$schema2,
|
|
11167
|
+
_this$schema2$items,
|
|
11168
|
+
_this = this,
|
|
11169
|
+
_this$value2;
|
|
11548
11170
|
var labelBtnStyle = {
|
|
11549
11171
|
'font-size': '16px',
|
|
11550
11172
|
color: '#979ba5',
|
|
@@ -11552,22 +11174,20 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11552
11174
|
display: 'inline-block'
|
|
11553
11175
|
};
|
|
11554
11176
|
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;
|
|
11555
|
-
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']);
|
|
11556
|
-
|
|
11177
|
+
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']);
|
|
11178
|
+
// props为空时,表示只有一个项
|
|
11557
11179
|
var keysLen = Object.keys(properties || {}).length;
|
|
11558
11180
|
var defaultCols = properties ? new Array(keysLen).fill('1fr').concat('20px').join(' ') : '1fr 20px';
|
|
11559
|
-
|
|
11560
11181
|
var defaultContainerLayout = _objectSpread2({}, this.layout.container || {
|
|
11561
11182
|
display: 'grid',
|
|
11562
11183
|
gridGap: '20px',
|
|
11563
11184
|
'grid-template-columns': defaultCols // 默认配置
|
|
11564
|
-
|
|
11565
11185
|
});
|
|
11566
11186
|
|
|
11567
11187
|
var self = this;
|
|
11568
|
-
|
|
11569
11188
|
var dealSchema = function dealSchema(schema) {
|
|
11570
|
-
return (
|
|
11189
|
+
return (
|
|
11190
|
+
// 处理当前控件默认Schema配置逻辑
|
|
11571
11191
|
mergeDeep({
|
|
11572
11192
|
'ui:component': {
|
|
11573
11193
|
props: {
|
|
@@ -11583,12 +11203,11 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11583
11203
|
}, schema)
|
|
11584
11204
|
);
|
|
11585
11205
|
};
|
|
11586
|
-
|
|
11587
11206
|
var renderSchemaField = function renderSchemaField(data) {
|
|
11588
11207
|
var path = data.path,
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
|
|
11208
|
+
schema = data.schema,
|
|
11209
|
+
required = data.required,
|
|
11210
|
+
layout = data.layout;
|
|
11592
11211
|
return h(SchemaField, {
|
|
11593
11212
|
key: path,
|
|
11594
11213
|
props: _objectSpread2(_objectSpread2({}, _this.$props), {}, {
|
|
@@ -11607,10 +11226,8 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11607
11226
|
}
|
|
11608
11227
|
});
|
|
11609
11228
|
};
|
|
11610
|
-
|
|
11611
11229
|
return h("div", [(_this$value2 = this.value) === null || _this$value2 === void 0 ? void 0 : _this$value2.map(function (_, index) {
|
|
11612
11230
|
var _this$schema4;
|
|
11613
|
-
|
|
11614
11231
|
var groupPath = Path.getCurPath(_this.path, "".concat(index));
|
|
11615
11232
|
return h(FieldGroupWrap, helper([{}, {
|
|
11616
11233
|
"props": _objectSpread2(_objectSpread2({}, _this.$props), {}, {
|
|
@@ -11623,7 +11240,6 @@ var KeyValueArrayWidget = Vue.extend({
|
|
|
11623
11240
|
})
|
|
11624
11241
|
}]), [props !== null && props !== void 0 && props.length ? props.map(function (prop) {
|
|
11625
11242
|
var _this$schema3, _this$schema3$items;
|
|
11626
|
-
|
|
11627
11243
|
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];
|
|
11628
11244
|
var curPath = Path.getCurPath(_this.path, "".concat(index, ".").concat(prop));
|
|
11629
11245
|
var lastProp = curPath.split('.').pop();
|
|
@@ -11685,16 +11301,14 @@ var TabGroupWidget = Vue.extend({
|
|
|
11685
11301
|
}),
|
|
11686
11302
|
render: function render(h) {
|
|
11687
11303
|
var _this$schema,
|
|
11688
|
-
|
|
11689
|
-
|
|
11304
|
+
_this = this;
|
|
11690
11305
|
var groupWrapProps = _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
11691
11306
|
layout: _objectSpread2(_objectSpread2({}, this.layout), {}, {
|
|
11692
11307
|
container: {} // Tab组的容器layout由panel内容控制
|
|
11693
|
-
|
|
11694
11308
|
}),
|
|
11309
|
+
|
|
11695
11310
|
title: this.schema.title
|
|
11696
11311
|
});
|
|
11697
|
-
|
|
11698
11312
|
var self = this;
|
|
11699
11313
|
var properties = orderProperties(Object.keys(((_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : _this$schema.properties) || {}), this.schema['ui:order']);
|
|
11700
11314
|
return h(FieldGroupWrap, {
|
|
@@ -11706,7 +11320,6 @@ var TabGroupWidget = Vue.extend({
|
|
|
11706
11320
|
}
|
|
11707
11321
|
}, [h(registry.getBaseWidget('tab'), {}, properties.map(function (key) {
|
|
11708
11322
|
var _this$schema2, _this$schema2$propert;
|
|
11709
|
-
|
|
11710
11323
|
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];
|
|
11711
11324
|
var curPath = Path.getCurPath(_this.path, key);
|
|
11712
11325
|
var lastProp = curPath.split('.').pop();
|
|
@@ -11725,8 +11338,8 @@ var TabGroupWidget = Vue.extend({
|
|
|
11725
11338
|
path: curPath,
|
|
11726
11339
|
layout: layoutConfig,
|
|
11727
11340
|
removeable: false // todo: 不往下传递可删除属性
|
|
11728
|
-
|
|
11729
11341
|
}),
|
|
11342
|
+
|
|
11730
11343
|
on: _objectSpread2({}, _this.$listeners)
|
|
11731
11344
|
})]);
|
|
11732
11345
|
}))]);
|
|
@@ -11769,8 +11382,7 @@ var CollapseGroupWidget = Vue.extend({
|
|
|
11769
11382
|
},
|
|
11770
11383
|
render: function render(h) {
|
|
11771
11384
|
var _this$schema,
|
|
11772
|
-
|
|
11773
|
-
|
|
11385
|
+
_this = this;
|
|
11774
11386
|
var collapseStyle = {};
|
|
11775
11387
|
var collapseTitleStyle = {
|
|
11776
11388
|
background: '#f5f7fa',
|
|
@@ -11785,19 +11397,16 @@ var CollapseGroupWidget = Vue.extend({
|
|
|
11785
11397
|
display: 'inline-block',
|
|
11786
11398
|
transition: 'all 0.5s ease'
|
|
11787
11399
|
};
|
|
11788
|
-
|
|
11789
11400
|
var groupWrapProps = _objectSpread2(_objectSpread2({}, this.$props), {}, {
|
|
11790
11401
|
layout: _objectSpread2(_objectSpread2({}, this.layout), {}, {
|
|
11791
11402
|
container: {} // Tab组的容器layout由panel内容控制
|
|
11792
|
-
|
|
11793
11403
|
}),
|
|
11404
|
+
|
|
11794
11405
|
title: this.schema.title
|
|
11795
11406
|
});
|
|
11796
|
-
|
|
11797
11407
|
var properties = orderProperties(Object.keys(((_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : _this$schema.properties) || {}), this.schema['ui:order']);
|
|
11798
11408
|
var collapseItems = properties.map(function (key) {
|
|
11799
11409
|
var _this$schema2, _this$schema2$propert;
|
|
11800
|
-
|
|
11801
11410
|
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];
|
|
11802
11411
|
var curPath = Path.getCurPath(_this.path, key);
|
|
11803
11412
|
var lastProp = curPath.split('.').pop();
|
|
@@ -11826,8 +11435,8 @@ var CollapseGroupWidget = Vue.extend({
|
|
|
11826
11435
|
path: curPath,
|
|
11827
11436
|
layout: layoutConfig,
|
|
11828
11437
|
removeable: false // todo: 不往下传递可删除属性
|
|
11829
|
-
|
|
11830
11438
|
}),
|
|
11439
|
+
|
|
11831
11440
|
on: _objectSpread2({}, _this.$listeners)
|
|
11832
11441
|
})])]);
|
|
11833
11442
|
});
|
|
@@ -12007,10 +11616,10 @@ function createForm() {
|
|
|
12007
11616
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
12008
11617
|
var options = mergeDeep(defaultOptions, opts);
|
|
12009
11618
|
var namespace = options.namespace,
|
|
12010
|
-
|
|
12011
|
-
|
|
12012
|
-
|
|
12013
|
-
|
|
11619
|
+
components = options.components,
|
|
11620
|
+
fields = options.fields,
|
|
11621
|
+
_options$baseWidgets = options.baseWidgets,
|
|
11622
|
+
baseWidgets = _options$baseWidgets === void 0 ? {} : _options$baseWidgets;
|
|
12014
11623
|
Registry.namespace = namespace;
|
|
12015
11624
|
registry.addComponentsMap(components);
|
|
12016
11625
|
registry.addFieldsMap(fields);
|
|
@@ -12034,7 +11643,6 @@ function createForm() {
|
|
|
12034
11643
|
context: {
|
|
12035
11644
|
handler: function handler(ctx) {
|
|
12036
11645
|
Registry.context = ctx;
|
|
12037
|
-
|
|
12038
11646
|
if (hasOwnProperty(ctx, 'rules')) {
|
|
12039
11647
|
registryGlobalRules(ctx.rules);
|
|
12040
11648
|
}
|
|
@@ -12102,9 +11710,8 @@ function createForm() {
|
|
|
12102
11710
|
on: {
|
|
12103
11711
|
input: function input(_ref) {
|
|
12104
11712
|
var _ref$path = _ref.path,
|
|
12105
|
-
|
|
12106
|
-
|
|
12107
|
-
|
|
11713
|
+
path = _ref$path === void 0 ? '' : _ref$path,
|
|
11714
|
+
value = _ref.value;
|
|
12108
11715
|
if (!path) {
|
|
12109
11716
|
// console.warn('set rootData');
|
|
12110
11717
|
self.emitFormValueChange(value, self.value);
|