@blueking/bkui-form 0.0.41 → 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,571 +1,536 @@
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;
3
+ function _arrayLikeToArray(r, a) {
4
+ (null == a || a > r.length) && (a = r.length);
5
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
6
+ return n;
7
+ }
8
+ function _arrayWithHoles(r) {
9
+ if (Array.isArray(r)) return r;
10
+ }
11
+ function _arrayWithoutHoles(r) {
12
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
13
+ }
14
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
15
+ try {
16
+ var i = n[a](c),
17
+ u = i.value;
18
+ } catch (n) {
19
+ return void e(n);
20
+ }
21
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
22
+ }
23
+ function _asyncToGenerator(n) {
24
+ return function () {
25
+ var t = this,
26
+ e = arguments;
27
+ return new Promise(function (r, o) {
28
+ var a = n.apply(t, e);
29
+ function _next(n) {
30
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
31
+ }
32
+ function _throw(n) {
33
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
34
+ }
35
+ _next(void 0);
36
+ });
37
+ };
38
+ }
39
+ function _classCallCheck(a, n) {
40
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
41
+ }
42
+ function _defineProperties(e, r) {
43
+ for (var t = 0; t < r.length; t++) {
44
+ var o = r[t];
45
+ o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
46
+ }
47
+ }
48
+ function _createClass(e, r, t) {
49
+ return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", {
50
+ writable: !1
51
+ }), e;
52
+ }
53
+ function _createForOfIteratorHelper(r, e) {
54
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
55
+ if (!t) {
56
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
57
+ t && (r = t);
58
+ var n = 0,
59
+ F = function () {};
60
+ return {
61
+ s: F,
62
+ n: function () {
63
+ return n >= r.length ? {
64
+ done: !0
65
+ } : {
66
+ done: !1,
67
+ value: r[n++]
68
+ };
69
+ },
70
+ e: function (r) {
71
+ throw r;
72
+ },
73
+ f: F
74
+ };
75
+ }
76
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
77
+ }
78
+ var o,
79
+ a = !0,
80
+ u = !1;
81
+ return {
82
+ s: function () {
83
+ t = t.call(r);
84
+ },
85
+ n: function () {
86
+ var r = t.next();
87
+ return a = r.done, r;
88
+ },
89
+ e: function (r) {
90
+ u = !0, o = r;
91
+ },
92
+ f: function () {
93
+ try {
94
+ a || null == t.return || t.return();
95
+ } finally {
96
+ if (u) throw o;
97
+ }
98
+ }
99
+ };
100
+ }
101
+ function _defineProperty(e, r, t) {
102
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
103
+ value: t,
104
+ enumerable: !0,
105
+ configurable: !0,
106
+ writable: !0
107
+ }) : e[r] = t, e;
108
+ }
109
+ function _extends$1() {
110
+ return _extends$1 = Object.assign ? Object.assign.bind() : function (n) {
111
+ for (var e = 1; e < arguments.length; e++) {
112
+ var t = arguments[e];
113
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
114
+ }
115
+ return n;
116
+ }, _extends$1.apply(null, arguments);
117
+ }
118
+ function _iterableToArray(r) {
119
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
120
+ }
121
+ function _iterableToArrayLimit(r, l) {
122
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
123
+ if (null != t) {
124
+ var e,
125
+ n,
126
+ i,
127
+ u,
128
+ a = [],
129
+ f = !0,
130
+ o = !1;
13
131
  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;
132
+ if (i = (t = t.call(r)).next, 0 === l) {
133
+ if (Object(t) !== t) return;
134
+ f = !1;
135
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
136
+ } catch (r) {
137
+ o = !0, n = r;
20
138
  } finally {
21
139
  try {
22
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
140
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
23
141
  } finally {
24
- if (_d) throw _e;
142
+ if (o) throw n;
25
143
  }
26
144
  }
27
- return _arr;
145
+ return a;
28
146
  }
29
147
  }
30
- function ownKeys(object, enumerableOnly) {
31
- var keys = Object.keys(object);
148
+ function _nonIterableRest() {
149
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
150
+ }
151
+ function _nonIterableSpread() {
152
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
153
+ }
154
+ function _objectDestructuringEmpty(t) {
155
+ if (null == t) throw new TypeError("Cannot destructure " + t);
156
+ }
157
+ function ownKeys(e, r) {
158
+ var t = Object.keys(e);
32
159
  if (Object.getOwnPropertySymbols) {
33
- var symbols = Object.getOwnPropertySymbols(object);
34
- enumerableOnly && (symbols = symbols.filter(function (sym) {
35
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
36
- })), keys.push.apply(keys, symbols);
160
+ var o = Object.getOwnPropertySymbols(e);
161
+ r && (o = o.filter(function (r) {
162
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
163
+ })), t.push.apply(t, o);
37
164
  }
38
- return keys;
39
- }
40
- function _objectSpread2(target) {
41
- for (var i = 1; i < arguments.length; i++) {
42
- var source = null != arguments[i] ? arguments[i] : {};
43
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
44
- _defineProperty(target, key, source[key]);
45
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
46
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
165
+ return t;
166
+ }
167
+ function _objectSpread2(e) {
168
+ for (var r = 1; r < arguments.length; r++) {
169
+ var t = null != arguments[r] ? arguments[r] : {};
170
+ r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {
171
+ _defineProperty(e, r, t[r]);
172
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
173
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
47
174
  });
48
175
  }
49
- return target;
176
+ return e;
177
+ }
178
+ function _objectWithoutProperties(e, t) {
179
+ if (null == e) return {};
180
+ var o,
181
+ r,
182
+ i = _objectWithoutPropertiesLoose(e, t);
183
+ if (Object.getOwnPropertySymbols) {
184
+ var n = Object.getOwnPropertySymbols(e);
185
+ for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
186
+ }
187
+ return i;
188
+ }
189
+ function _objectWithoutPropertiesLoose(r, e) {
190
+ if (null == r) return {};
191
+ var t = {};
192
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
193
+ if (e.indexOf(n) >= 0) continue;
194
+ t[n] = r[n];
195
+ }
196
+ return t;
50
197
  }
51
198
  function _regeneratorRuntime() {
52
199
  _regeneratorRuntime = function () {
53
- return exports;
200
+ return e;
54
201
  };
55
- var exports = {},
56
- Op = Object.prototype,
57
- hasOwn = Op.hasOwnProperty,
58
- defineProperty = Object.defineProperty || function (obj, key, desc) {
59
- obj[key] = desc.value;
202
+ var t,
203
+ e = {},
204
+ r = Object.prototype,
205
+ n = r.hasOwnProperty,
206
+ o = Object.defineProperty || function (t, e, r) {
207
+ t[e] = r.value;
60
208
  },
61
- $Symbol = "function" == typeof Symbol ? Symbol : {},
62
- iteratorSymbol = $Symbol.iterator || "@@iterator",
63
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
64
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
65
- function define(obj, key, value) {
66
- return Object.defineProperty(obj, key, {
67
- value: value,
209
+ i = "function" == typeof Symbol ? Symbol : {},
210
+ a = i.iterator || "@@iterator",
211
+ c = i.asyncIterator || "@@asyncIterator",
212
+ u = i.toStringTag || "@@toStringTag";
213
+ function define(t, e, r) {
214
+ return Object.defineProperty(t, e, {
215
+ value: r,
68
216
  enumerable: !0,
69
217
  configurable: !0,
70
218
  writable: !0
71
- }), obj[key];
219
+ }), t[e];
72
220
  }
73
221
  try {
74
222
  define({}, "");
75
- } catch (err) {
76
- define = function (obj, key, value) {
77
- return obj[key] = value;
223
+ } catch (t) {
224
+ define = function (t, e, r) {
225
+ return t[e] = r;
78
226
  };
79
227
  }
80
- function wrap(innerFn, outerFn, self, tryLocsList) {
81
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : 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;
228
+ function wrap(t, e, r, n) {
229
+ var i = e && e.prototype instanceof Generator ? e : Generator,
230
+ a = Object.create(i.prototype),
231
+ c = new Context(n || []);
232
+ return o(a, "_invoke", {
233
+ value: makeInvokeMethod(t, r, c)
234
+ }), a;
87
235
  }
88
- function tryCatch(fn, obj, arg) {
236
+ function tryCatch(t, e, r) {
89
237
  try {
90
238
  return {
91
239
  type: "normal",
92
- arg: fn.call(obj, arg)
240
+ arg: t.call(e, r)
93
241
  };
94
- } catch (err) {
242
+ } catch (t) {
95
243
  return {
96
244
  type: "throw",
97
- arg: err
245
+ arg: t
98
246
  };
99
247
  }
100
248
  }
101
- exports.wrap = wrap;
102
- var ContinueSentinel = {};
249
+ e.wrap = wrap;
250
+ var h = "suspendedStart",
251
+ l = "suspendedYield",
252
+ f = "executing",
253
+ s = "completed",
254
+ y = {};
103
255
  function Generator() {}
104
256
  function GeneratorFunction() {}
105
257
  function GeneratorFunctionPrototype() {}
106
- var IteratorPrototype = {};
107
- define(IteratorPrototype, iteratorSymbol, function () {
258
+ var p = {};
259
+ define(p, a, function () {
108
260
  return this;
109
261
  });
110
- var getProto = Object.getPrototypeOf,
111
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
112
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
113
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
114
- function defineIteratorMethods(prototype) {
115
- ["next", "throw", "return"].forEach(function (method) {
116
- define(prototype, method, function (arg) {
117
- return this._invoke(method, arg);
262
+ var d = Object.getPrototypeOf,
263
+ v = d && d(d(values([])));
264
+ v && v !== r && n.call(v, a) && (p = v);
265
+ var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
266
+ function defineIteratorMethods(t) {
267
+ ["next", "throw", "return"].forEach(function (e) {
268
+ define(t, e, function (t) {
269
+ return this._invoke(e, t);
118
270
  });
119
271
  });
120
272
  }
121
- function AsyncIterator(generator, PromiseImpl) {
122
- function invoke(method, arg, resolve, reject) {
123
- var record = tryCatch(generator[method], generator, arg);
124
- if ("throw" !== record.type) {
125
- var result = record.arg,
126
- value = result.value;
127
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
128
- invoke("next", value, resolve, reject);
129
- }, function (err) {
130
- invoke("throw", err, resolve, reject);
131
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
132
- result.value = unwrapped, resolve(result);
133
- }, function (error) {
134
- return invoke("throw", error, resolve, reject);
273
+ function AsyncIterator(t, e) {
274
+ function invoke(r, o, i, a) {
275
+ var c = tryCatch(t[r], t, o);
276
+ if ("throw" !== c.type) {
277
+ var u = c.arg,
278
+ h = u.value;
279
+ return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
280
+ invoke("next", t, i, a);
281
+ }, function (t) {
282
+ invoke("throw", t, i, a);
283
+ }) : e.resolve(h).then(function (t) {
284
+ u.value = t, i(u);
285
+ }, function (t) {
286
+ return invoke("throw", t, i, a);
135
287
  });
136
288
  }
137
- reject(record.arg);
289
+ a(c.arg);
138
290
  }
139
- var previousPromise;
140
- defineProperty(this, "_invoke", {
141
- value: function (method, arg) {
291
+ var r;
292
+ o(this, "_invoke", {
293
+ value: function (t, n) {
142
294
  function callInvokeWithMethodAndArg() {
143
- return new PromiseImpl(function (resolve, reject) {
144
- invoke(method, arg, resolve, reject);
295
+ return new e(function (e, r) {
296
+ invoke(t, n, e, r);
145
297
  });
146
298
  }
147
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
299
+ return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
148
300
  }
149
301
  });
150
302
  }
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();
303
+ function makeInvokeMethod(e, r, n) {
304
+ var o = h;
305
+ return function (i, a) {
306
+ if (o === f) throw Error("Generator is already running");
307
+ if (o === s) {
308
+ if ("throw" === i) throw a;
309
+ return {
310
+ value: t,
311
+ done: !0
312
+ };
158
313
  }
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;
314
+ for (n.method = i, n.arg = a;;) {
315
+ var c = n.delegate;
316
+ if (c) {
317
+ var u = maybeInvokeDelegate(c, n);
318
+ if (u) {
319
+ if (u === y) continue;
320
+ return u;
166
321
  }
167
322
  }
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;
323
+ if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
324
+ if (o === h) throw o = s, n.arg;
325
+ n.dispatchException(n.arg);
326
+ } else "return" === n.method && n.abrupt("return", n.arg);
327
+ o = f;
328
+ var p = tryCatch(e, r, n);
329
+ if ("normal" === p.type) {
330
+ if (o = n.done ? s : l, p.arg === y) continue;
176
331
  return {
177
- value: record.arg,
178
- done: context.done
332
+ value: p.arg,
333
+ done: n.done
179
334
  };
180
335
  }
181
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
336
+ "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
182
337
  }
183
338
  };
184
339
  }
185
- function maybeInvokeDelegate(delegate, context) {
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;
189
- var record = tryCatch(method, delegate.iterator, context.arg);
190
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
191
- var info = record.arg;
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);
340
+ function maybeInvokeDelegate(e, r) {
341
+ var n = r.method,
342
+ o = e.iterator[n];
343
+ if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
344
+ var i = tryCatch(o, e.iterator, r.arg);
345
+ if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
346
+ var a = i.arg;
347
+ return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
193
348
  }
194
- function pushTryEntry(locs) {
195
- var entry = {
196
- tryLoc: locs[0]
349
+ function pushTryEntry(t) {
350
+ var e = {
351
+ tryLoc: t[0]
197
352
  };
198
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
353
+ 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
199
354
  }
200
- function resetTryEntry(entry) {
201
- var record = entry.completion || {};
202
- record.type = "normal", delete record.arg, entry.completion = record;
355
+ function resetTryEntry(t) {
356
+ var e = t.completion || {};
357
+ e.type = "normal", delete e.arg, t.completion = e;
203
358
  }
204
- function Context(tryLocsList) {
359
+ function Context(t) {
205
360
  this.tryEntries = [{
206
361
  tryLoc: "root"
207
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
362
+ }], t.forEach(pushTryEntry, this), this.reset(!0);
208
363
  }
209
- function values(iterable) {
210
- if (iterable) {
211
- var iteratorMethod = iterable[iteratorSymbol];
212
- if (iteratorMethod) return iteratorMethod.call(iterable);
213
- if ("function" == typeof iterable.next) return iterable;
214
- if (!isNaN(iterable.length)) {
215
- var i = -1,
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;
364
+ function values(e) {
365
+ if (e || "" === e) {
366
+ var r = e[a];
367
+ if (r) return r.call(e);
368
+ if ("function" == typeof e.next) return e;
369
+ if (!isNaN(e.length)) {
370
+ var o = -1,
371
+ i = function next() {
372
+ for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
373
+ return next.value = t, next.done = !0, next;
219
374
  };
220
- return next.next = next;
375
+ return i.next = i;
221
376
  }
222
377
  }
223
- return {
224
- next: doneResult
225
- };
378
+ throw new TypeError(typeof e + " is not iterable");
226
379
  }
227
- function doneResult() {
228
- return {
229
- value: undefined,
230
- done: !0
231
- };
232
- }
233
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
380
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
234
381
  value: GeneratorFunctionPrototype,
235
382
  configurable: !0
236
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
383
+ }), o(GeneratorFunctionPrototype, "constructor", {
237
384
  value: GeneratorFunction,
238
385
  configurable: !0
239
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
240
- var ctor = "function" == typeof genFun && genFun.constructor;
241
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
242
- }, exports.mark = function (genFun) {
243
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
244
- }, exports.awrap = function (arg) {
386
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
387
+ var e = "function" == typeof t && t.constructor;
388
+ return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
389
+ }, e.mark = function (t) {
390
+ return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
391
+ }, e.awrap = function (t) {
245
392
  return {
246
- __await: arg
393
+ __await: t
247
394
  };
248
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
395
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
249
396
  return this;
250
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
251
- void 0 === PromiseImpl && (PromiseImpl = Promise);
252
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
253
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
254
- return result.done ? result.value : iter.next();
397
+ }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
398
+ void 0 === i && (i = Promise);
399
+ var a = new AsyncIterator(wrap(t, r, n, o), i);
400
+ return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
401
+ return t.done ? t.value : a.next();
255
402
  });
256
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
403
+ }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
257
404
  return this;
258
- }), define(Gp, "toString", function () {
405
+ }), define(g, "toString", function () {
259
406
  return "[object Generator]";
260
- }), exports.keys = function (val) {
261
- var object = Object(val),
262
- keys = [];
263
- for (var key in object) keys.push(key);
264
- return keys.reverse(), function next() {
265
- for (; keys.length;) {
266
- var key = keys.pop();
267
- if (key in object) return next.value = key, next.done = !1, next;
407
+ }), e.keys = function (t) {
408
+ var e = Object(t),
409
+ r = [];
410
+ for (var n in e) r.push(n);
411
+ return r.reverse(), function next() {
412
+ for (; r.length;) {
413
+ var t = r.pop();
414
+ if (t in e) return next.value = t, next.done = !1, next;
268
415
  }
269
416
  return next.done = !0, next;
270
417
  };
271
- }, exports.values = values, Context.prototype = {
418
+ }, e.values = values, Context.prototype = {
272
419
  constructor: Context,
273
- reset: function (skipTempReset) {
274
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
420
+ reset: function (e) {
421
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
275
422
  },
276
423
  stop: function () {
277
424
  this.done = !0;
278
- var rootRecord = this.tryEntries[0].completion;
279
- if ("throw" === rootRecord.type) throw rootRecord.arg;
425
+ var t = this.tryEntries[0].completion;
426
+ if ("throw" === t.type) throw t.arg;
280
427
  return this.rval;
281
428
  },
282
- dispatchException: function (exception) {
283
- if (this.done) throw exception;
284
- var context = this;
285
- function handle(loc, caught) {
286
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
429
+ dispatchException: function (e) {
430
+ if (this.done) throw e;
431
+ var r = this;
432
+ function handle(n, o) {
433
+ return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
287
434
  }
288
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
289
- var entry = this.tryEntries[i],
290
- record = entry.completion;
291
- if ("root" === entry.tryLoc) return handle("end");
292
- if (entry.tryLoc <= this.prev) {
293
- var hasCatch = hasOwn.call(entry, "catchLoc"),
294
- hasFinally = hasOwn.call(entry, "finallyLoc");
295
- if (hasCatch && hasFinally) {
296
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
297
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
298
- } else if (hasCatch) {
299
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
435
+ for (var o = this.tryEntries.length - 1; o >= 0; --o) {
436
+ var i = this.tryEntries[o],
437
+ a = i.completion;
438
+ if ("root" === i.tryLoc) return handle("end");
439
+ if (i.tryLoc <= this.prev) {
440
+ var c = n.call(i, "catchLoc"),
441
+ u = n.call(i, "finallyLoc");
442
+ if (c && u) {
443
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
444
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
445
+ } else if (c) {
446
+ if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
300
447
  } else {
301
- if (!hasFinally) throw new Error("try statement without catch or finally");
302
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
448
+ if (!u) throw Error("try statement without catch or finally");
449
+ if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
303
450
  }
304
451
  }
305
452
  }
306
453
  },
307
- abrupt: function (type, arg) {
308
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
309
- var entry = this.tryEntries[i];
310
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
311
- var finallyEntry = entry;
454
+ abrupt: function (t, e) {
455
+ for (var r = this.tryEntries.length - 1; r >= 0; --r) {
456
+ var o = this.tryEntries[r];
457
+ if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
458
+ var i = o;
312
459
  break;
313
460
  }
314
461
  }
315
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
316
- var record = finallyEntry ? finallyEntry.completion : {};
317
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
462
+ i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
463
+ var a = i ? i.completion : {};
464
+ return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
318
465
  },
319
- complete: function (record, afterLoc) {
320
- if ("throw" === record.type) throw record.arg;
321
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
466
+ complete: function (t, e) {
467
+ if ("throw" === t.type) throw t.arg;
468
+ return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
322
469
  },
323
- finish: function (finallyLoc) {
324
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
325
- var entry = this.tryEntries[i];
326
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
470
+ finish: function (t) {
471
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
472
+ var r = this.tryEntries[e];
473
+ if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
327
474
  }
328
475
  },
329
- catch: function (tryLoc) {
330
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
331
- var entry = this.tryEntries[i];
332
- if (entry.tryLoc === tryLoc) {
333
- var record = entry.completion;
334
- if ("throw" === record.type) {
335
- var thrown = record.arg;
336
- resetTryEntry(entry);
476
+ catch: function (t) {
477
+ for (var e = this.tryEntries.length - 1; e >= 0; --e) {
478
+ var r = this.tryEntries[e];
479
+ if (r.tryLoc === t) {
480
+ var n = r.completion;
481
+ if ("throw" === n.type) {
482
+ var o = n.arg;
483
+ resetTryEntry(r);
337
484
  }
338
- return thrown;
485
+ return o;
339
486
  }
340
487
  }
341
- throw new Error("illegal catch attempt");
488
+ throw Error("illegal catch attempt");
342
489
  },
343
- delegateYield: function (iterable, resultName, nextLoc) {
490
+ delegateYield: function (e, r, n) {
344
491
  return this.delegate = {
345
- iterator: values(iterable),
346
- resultName: resultName,
347
- nextLoc: nextLoc
348
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
492
+ iterator: values(e),
493
+ resultName: r,
494
+ nextLoc: n
495
+ }, "next" === this.method && (this.arg = t), y;
349
496
  }
350
- }, exports;
497
+ }, e;
351
498
  }
352
- function _typeof(obj) {
353
- "@babel/helpers - typeof";
354
-
355
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
356
- return typeof obj;
357
- } : function (obj) {
358
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
359
- }, _typeof(obj);
499
+ function _slicedToArray(r, e) {
500
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
360
501
  }
361
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
362
- try {
363
- var info = gen[key](arg);
364
- var value = info.value;
365
- } catch (error) {
366
- reject(error);
367
- return;
368
- }
369
- if (info.done) {
370
- resolve(value);
371
- } else {
372
- Promise.resolve(value).then(_next, _throw);
373
- }
502
+ function _toConsumableArray(r) {
503
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
374
504
  }
375
- function _asyncToGenerator(fn) {
376
- return function () {
377
- var self = this,
378
- args = arguments;
379
- return new Promise(function (resolve, reject) {
380
- var gen = fn.apply(self, args);
381
- function _next(value) {
382
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
383
- }
384
- function _throw(err) {
385
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
386
- }
387
- _next(undefined);
388
- });
389
- };
390
- }
391
- function _classCallCheck(instance, Constructor) {
392
- if (!(instance instanceof Constructor)) {
393
- throw new TypeError("Cannot call a class as a function");
394
- }
395
- }
396
- function _defineProperties(target, props) {
397
- for (var i = 0; i < props.length; i++) {
398
- var descriptor = props[i];
399
- descriptor.enumerable = descriptor.enumerable || false;
400
- descriptor.configurable = true;
401
- if ("value" in descriptor) descriptor.writable = true;
402
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
403
- }
404
- }
405
- function _createClass(Constructor, protoProps, staticProps) {
406
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
407
- if (staticProps) _defineProperties(Constructor, staticProps);
408
- Object.defineProperty(Constructor, "prototype", {
409
- writable: false
410
- });
411
- return Constructor;
412
- }
413
- function _defineProperty(obj, key, value) {
414
- key = _toPropertyKey(key);
415
- if (key in obj) {
416
- Object.defineProperty(obj, key, {
417
- value: value,
418
- enumerable: true,
419
- configurable: true,
420
- writable: true
421
- });
422
- } else {
423
- obj[key] = value;
424
- }
425
- return obj;
426
- }
427
- function _extends$1() {
428
- _extends$1 = Object.assign ? Object.assign.bind() : function (target) {
429
- for (var i = 1; i < arguments.length; i++) {
430
- var source = arguments[i];
431
- for (var key in source) {
432
- if (Object.prototype.hasOwnProperty.call(source, key)) {
433
- target[key] = source[key];
434
- }
435
- }
436
- }
437
- return target;
438
- };
439
- return _extends$1.apply(this, arguments);
440
- }
441
- function _objectDestructuringEmpty(obj) {
442
- if (obj == null) throw new TypeError("Cannot destructure " + obj);
443
- }
444
- function _objectWithoutPropertiesLoose(source, excluded) {
445
- if (source == null) return {};
446
- var target = {};
447
- var sourceKeys = Object.keys(source);
448
- var key, i;
449
- for (i = 0; i < sourceKeys.length; i++) {
450
- key = sourceKeys[i];
451
- if (excluded.indexOf(key) >= 0) continue;
452
- target[key] = source[key];
453
- }
454
- return target;
455
- }
456
- function _objectWithoutProperties(source, excluded) {
457
- if (source == null) return {};
458
- var target = _objectWithoutPropertiesLoose(source, excluded);
459
- var key, i;
460
- if (Object.getOwnPropertySymbols) {
461
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
462
- for (i = 0; i < sourceSymbolKeys.length; i++) {
463
- key = sourceSymbolKeys[i];
464
- if (excluded.indexOf(key) >= 0) continue;
465
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
466
- target[key] = source[key];
467
- }
505
+ function _toPrimitive(t, r) {
506
+ if ("object" != typeof t || !t) return t;
507
+ var e = t[Symbol.toPrimitive];
508
+ if (void 0 !== e) {
509
+ var i = e.call(t, r || "default");
510
+ if ("object" != typeof i) return i;
511
+ throw new TypeError("@@toPrimitive must return a primitive value.");
468
512
  }
469
- return target;
470
- }
471
- function _slicedToArray(arr, i) {
472
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
513
+ return ("string" === r ? String : Number)(t);
473
514
  }
474
- function _toConsumableArray(arr) {
475
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
515
+ function _toPropertyKey(t) {
516
+ var i = _toPrimitive(t, "string");
517
+ return "symbol" == typeof i ? i : i + "";
476
518
  }
477
- function _arrayWithoutHoles(arr) {
478
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
479
- }
480
- function _arrayWithHoles(arr) {
481
- if (Array.isArray(arr)) return arr;
482
- }
483
- function _iterableToArray(iter) {
484
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
485
- }
486
- function _unsupportedIterableToArray(o, minLen) {
487
- if (!o) return;
488
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
489
- var n = Object.prototype.toString.call(o).slice(8, -1);
490
- if (n === "Object" && o.constructor) n = o.constructor.name;
491
- if (n === "Map" || n === "Set") return Array.from(o);
492
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
493
- }
494
- function _arrayLikeToArray(arr, len) {
495
- if (len == null || len > arr.length) len = arr.length;
496
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
497
- return arr2;
498
- }
499
- function _nonIterableSpread() {
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.");
501
- }
502
- function _nonIterableRest() {
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.");
504
- }
505
- function _createForOfIteratorHelper(o, allowArrayLike) {
506
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
507
- if (!it) {
508
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
509
- if (it) o = it;
510
- var i = 0;
511
- var F = function () {};
512
- return {
513
- s: F,
514
- n: function () {
515
- if (i >= o.length) return {
516
- done: true
517
- };
518
- return {
519
- done: false,
520
- value: o[i++]
521
- };
522
- },
523
- e: function (e) {
524
- throw e;
525
- },
526
- f: F
527
- };
528
- }
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.");
530
- }
531
- var normalCompletion = true,
532
- didErr = false,
533
- err;
534
- return {
535
- s: function () {
536
- it = it.call(o);
537
- },
538
- n: function () {
539
- var step = it.next();
540
- normalCompletion = step.done;
541
- return step;
542
- },
543
- e: function (e) {
544
- didErr = true;
545
- err = e;
546
- },
547
- f: function () {
548
- try {
549
- if (!normalCompletion && it.return != null) it.return();
550
- } finally {
551
- if (didErr) throw err;
552
- }
553
- }
554
- };
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.");
519
+ function _typeof(o) {
520
+ "@babel/helpers - typeof";
521
+
522
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
523
+ return typeof o;
524
+ } : function (o) {
525
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
526
+ }, _typeof(o);
527
+ }
528
+ function _unsupportedIterableToArray(r, a) {
529
+ if (r) {
530
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
531
+ var t = {}.toString.call(r).slice(8, -1);
532
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
563
533
  }
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
534
  }
570
535
 
571
536
  // eslint-disable-next-line no-new-func
@@ -644,7 +609,6 @@ function initializationValue(type) {
644
609
  integer: undefined,
645
610
  number: undefined // 默认初始化值(number类型0值会有特殊含义)
646
611
  };
647
-
648
612
  switch (type) {
649
613
  case 'any':
650
614
  return undefined;
@@ -822,7 +786,7 @@ var Registry = /*#__PURE__*/function () {
822
786
  // 每种Schema type对于的处理器
823
787
  this.fields = new Map();
824
788
  }
825
- _createClass(Registry, [{
789
+ return _createClass(Registry, [{
826
790
  key: "addComponentsMap",
827
791
  value: function addComponentsMap() {
828
792
  var coms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -879,7 +843,6 @@ var Registry = /*#__PURE__*/function () {
879
843
  });
880
844
  }
881
845
  }]);
882
- return Registry;
883
846
  }();
884
847
  // 全局命名空间
885
848
  Registry.namespace = 'bk';
@@ -894,7 +857,7 @@ var Schema = /*#__PURE__*/function () {
894
857
  _classCallCheck(this, Schema);
895
858
  Schema.rootSchema = rootSchema;
896
859
  }
897
- _createClass(Schema, null, [{
860
+ return _createClass(Schema, null, [{
898
861
  key: "resolveRef",
899
862
  value: function resolveRef() {}
900
863
  }, {
@@ -1161,7 +1124,6 @@ var Schema = /*#__PURE__*/function () {
1161
1124
  }
1162
1125
  }
1163
1126
  }]);
1164
- return Schema;
1165
1127
  }();
1166
1128
  Schema.rootSchema = void 0;
1167
1129
 
@@ -1180,7 +1142,7 @@ var Layout = /*#__PURE__*/function () {
1180
1142
  this.layout = this.parseLayout(layout);
1181
1143
  }
1182
1144
  }
1183
- _createClass(Layout, [{
1145
+ return _createClass(Layout, [{
1184
1146
  key: "transformValueToPixel",
1185
1147
  value: function transformValueToPixel(value) {
1186
1148
  if (typeof value === 'number') {
@@ -1311,7 +1273,6 @@ var Layout = /*#__PURE__*/function () {
1311
1273
  return layoutConfig;
1312
1274
  }
1313
1275
  }]);
1314
- return Layout;
1315
1276
  }();
1316
1277
 
1317
1278
  function createProxy(schema, context) {
@@ -1329,7 +1290,7 @@ var Path = /*#__PURE__*/function () {
1329
1290
  function Path() {
1330
1291
  _classCallCheck(this, Path);
1331
1292
  }
1332
- _createClass(Path, null, [{
1293
+ return _createClass(Path, null, [{
1333
1294
  key: "getCurPath",
1334
1295
  value: function getCurPath(parent, current) {
1335
1296
  return parent === '' ? current : [parent, current].join(this.separator);
@@ -1383,11 +1344,9 @@ var Path = /*#__PURE__*/function () {
1383
1344
  if (arrPath.length <= 1) {
1384
1345
  return ''; // root path
1385
1346
  }
1386
-
1387
1347
  return arrPath.slice(0, arrPath.length - 1).join(this.separator);
1388
1348
  }
1389
1349
  }]);
1390
- return Path;
1391
1350
  }();
1392
1351
  Path.separator = '.';
1393
1352
 
@@ -1400,7 +1359,7 @@ var defaultConfig = {
1400
1359
  headers: {},
1401
1360
  cache: 'no-cache'
1402
1361
  };
1403
- var request = /*#__PURE__*/(function () {
1362
+ var request = ( /*#__PURE__*/(function () {
1404
1363
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url) {
1405
1364
  var config,
1406
1365
  _mergeDeep,
@@ -1510,7 +1469,7 @@ var request = /*#__PURE__*/(function () {
1510
1469
  return function (_x) {
1511
1470
  return _ref.apply(this, arguments);
1512
1471
  };
1513
- })();
1472
+ })());
1514
1473
 
1515
1474
  var props$1 = {
1516
1475
  // 表单值
@@ -1572,7 +1531,6 @@ var props$1 = {
1572
1531
  };
1573
1532
  }
1574
1533
  },
1575
-
1576
1534
  readonly: {
1577
1535
  type: Boolean,
1578
1536
  default: false
@@ -1655,7 +1613,6 @@ var props = {
1655
1613
  };
1656
1614
  }
1657
1615
  },
1658
-
1659
1616
  visible: {
1660
1617
  type: Boolean,
1661
1618
  default: true
@@ -1806,7 +1763,7 @@ var WidgetNode = /*#__PURE__*/function () {
1806
1763
  this.children = children;
1807
1764
  }
1808
1765
  // 当前node的值
1809
- _createClass(WidgetNode, [{
1766
+ return _createClass(WidgetNode, [{
1810
1767
  key: "value",
1811
1768
  get: function get() {
1812
1769
  var _this$instance;
@@ -1906,14 +1863,13 @@ var WidgetNode = /*#__PURE__*/function () {
1906
1863
  return nodes;
1907
1864
  }
1908
1865
  }]);
1909
- return WidgetNode;
1910
1866
  }();
1911
1867
  var WidgetTree = /*#__PURE__*/function () {
1912
1868
  function WidgetTree() {
1913
1869
  _classCallCheck(this, WidgetTree);
1914
1870
  this.widgetMap = {};
1915
1871
  }
1916
- _createClass(WidgetTree, [{
1872
+ return _createClass(WidgetTree, [{
1917
1873
  key: "addWidgetNode",
1918
1874
  value: function addWidgetNode(path, instance, type, index) {
1919
1875
  if (path === '') {
@@ -1931,19 +1887,19 @@ var WidgetTree = /*#__PURE__*/function () {
1931
1887
  // 普通节点
1932
1888
  var parentId = Path.getParentPath(path);
1933
1889
  var parentNode = this.widgetMap[parentId];
1934
- if (!parentNode) {
1935
- console.warn('Unexpected parent id, add widget failed');
1936
- return;
1937
- }
1938
1890
  var _node = new WidgetNode({
1939
- id: instance.path,
1891
+ id: (instance === null || instance === void 0 ? void 0 : instance.path) || path,
1940
1892
  type: type,
1941
1893
  index: index,
1942
1894
  parent: parentNode,
1943
1895
  instance: instance,
1944
1896
  children: []
1945
1897
  });
1946
- parentNode.appendChild(_node);
1898
+ if (!parentNode) {
1899
+ console.warn('Unexpected parent id, please check widget node', _node);
1900
+ } else {
1901
+ parentNode.appendChild(_node);
1902
+ }
1947
1903
  this.widgetMap[path] = _node;
1948
1904
  }
1949
1905
  }
@@ -1970,7 +1926,6 @@ var WidgetTree = /*#__PURE__*/function () {
1970
1926
  }
1971
1927
  }
1972
1928
  }]);
1973
- return WidgetTree;
1974
1929
  }();
1975
1930
  var widgetTree = new WidgetTree();
1976
1931
 
@@ -2291,7 +2246,7 @@ var UsedValueState;
2291
2246
  (function (UsedValueState) {
2292
2247
  UsedValueState[UsedValueState["Started"] = 0] = "Started";
2293
2248
  UsedValueState[UsedValueState["Completed"] = 1] = "Completed";
2294
- })(UsedValueState = exports.UsedValueState || (exports.UsedValueState = {}));
2249
+ })(UsedValueState || (exports.UsedValueState = UsedValueState = {}));
2295
2250
  exports.varKinds = {
2296
2251
  const: new code_1.Name("const"),
2297
2252
  let: new code_1.Name("let"),
@@ -3123,11 +3078,10 @@ function par(x) {
3123
3078
 
3124
3079
  var util = {};
3125
3080
 
3126
- (function (exports) {
3127
- Object.defineProperty(exports, "__esModule", { value: true });
3128
- exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0;
3129
- const codegen_1 = codegen;
3130
- const code_1 = code$1;
3081
+ Object.defineProperty(util, "__esModule", { value: true });
3082
+ util.checkStrictMode = util.getErrorPath = util.Type = util.useFunc = util.setEvaluated = util.evaluatedPropsToName = util.mergeEvaluated = util.eachItem = util.unescapeJsonPointer = util.escapeJsonPointer = util.escapeFragment = util.unescapeFragment = util.schemaRefOrVal = util.schemaHasRulesButRef = util.schemaHasRules = util.checkUnknownRules = util.alwaysValidSchema = util.toHash = void 0;
3083
+ const codegen_1$v = codegen;
3084
+ const code_1$a = code$1;
3131
3085
  // TODO refactor to use Set
3132
3086
  function toHash(arr) {
3133
3087
  const hash = {};
@@ -3135,7 +3089,7 @@ function toHash(arr) {
3135
3089
  hash[item] = true;
3136
3090
  return hash;
3137
3091
  }
3138
- exports.toHash = toHash;
3092
+ util.toHash = toHash;
3139
3093
  function alwaysValidSchema(it, schema) {
3140
3094
  if (typeof schema == "boolean")
3141
3095
  return schema;
@@ -3144,7 +3098,7 @@ function alwaysValidSchema(it, schema) {
3144
3098
  checkUnknownRules(it, schema);
3145
3099
  return !schemaHasRules(schema, it.self.RULES.all);
3146
3100
  }
3147
- exports.alwaysValidSchema = alwaysValidSchema;
3101
+ util.alwaysValidSchema = alwaysValidSchema;
3148
3102
  function checkUnknownRules(it, schema = it.schema) {
3149
3103
  const { opts, self } = it;
3150
3104
  if (!opts.strictSchema)
@@ -3157,7 +3111,7 @@ function checkUnknownRules(it, schema = it.schema) {
3157
3111
  checkStrictMode(it, `unknown keyword: "${key}"`);
3158
3112
  }
3159
3113
  }
3160
- exports.checkUnknownRules = checkUnknownRules;
3114
+ util.checkUnknownRules = checkUnknownRules;
3161
3115
  function schemaHasRules(schema, rules) {
3162
3116
  if (typeof schema == "boolean")
3163
3117
  return !schema;
@@ -3166,7 +3120,7 @@ function schemaHasRules(schema, rules) {
3166
3120
  return true;
3167
3121
  return false;
3168
3122
  }
3169
- exports.schemaHasRules = schemaHasRules;
3123
+ util.schemaHasRules = schemaHasRules;
3170
3124
  function schemaHasRulesButRef(schema, RULES) {
3171
3125
  if (typeof schema == "boolean")
3172
3126
  return !schema;
@@ -3175,35 +3129,35 @@ function schemaHasRulesButRef(schema, RULES) {
3175
3129
  return true;
3176
3130
  return false;
3177
3131
  }
3178
- exports.schemaHasRulesButRef = schemaHasRulesButRef;
3132
+ util.schemaHasRulesButRef = schemaHasRulesButRef;
3179
3133
  function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) {
3180
3134
  if (!$data) {
3181
3135
  if (typeof schema == "number" || typeof schema == "boolean")
3182
3136
  return schema;
3183
3137
  if (typeof schema == "string")
3184
- return (0, codegen_1._) `${schema}`;
3138
+ return (0, codegen_1$v._) `${schema}`;
3185
3139
  }
3186
- return (0, codegen_1._) `${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`;
3140
+ return (0, codegen_1$v._) `${topSchemaRef}${schemaPath}${(0, codegen_1$v.getProperty)(keyword)}`;
3187
3141
  }
3188
- exports.schemaRefOrVal = schemaRefOrVal;
3142
+ util.schemaRefOrVal = schemaRefOrVal;
3189
3143
  function unescapeFragment(str) {
3190
3144
  return unescapeJsonPointer(decodeURIComponent(str));
3191
3145
  }
3192
- exports.unescapeFragment = unescapeFragment;
3146
+ util.unescapeFragment = unescapeFragment;
3193
3147
  function escapeFragment(str) {
3194
3148
  return encodeURIComponent(escapeJsonPointer(str));
3195
3149
  }
3196
- exports.escapeFragment = escapeFragment;
3150
+ util.escapeFragment = escapeFragment;
3197
3151
  function escapeJsonPointer(str) {
3198
3152
  if (typeof str == "number")
3199
3153
  return `${str}`;
3200
3154
  return str.replace(/~/g, "~0").replace(/\//g, "~1");
3201
3155
  }
3202
- exports.escapeJsonPointer = escapeJsonPointer;
3156
+ util.escapeJsonPointer = escapeJsonPointer;
3203
3157
  function unescapeJsonPointer(str) {
3204
3158
  return str.replace(/~1/g, "/").replace(/~0/g, "~");
3205
3159
  }
3206
- exports.unescapeJsonPointer = unescapeJsonPointer;
3160
+ util.unescapeJsonPointer = unescapeJsonPointer;
3207
3161
  function eachItem(xs, f) {
3208
3162
  if (Array.isArray(xs)) {
3209
3163
  for (const x of xs)
@@ -3213,30 +3167,30 @@ function eachItem(xs, f) {
3213
3167
  f(xs);
3214
3168
  }
3215
3169
  }
3216
- exports.eachItem = eachItem;
3170
+ util.eachItem = eachItem;
3217
3171
  function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName, }) {
3218
3172
  return (gen, from, to, toName) => {
3219
3173
  const res = to === undefined
3220
3174
  ? from
3221
- : to instanceof codegen_1.Name
3222
- ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to)
3223
- : from instanceof codegen_1.Name
3175
+ : to instanceof codegen_1$v.Name
3176
+ ? (from instanceof codegen_1$v.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to)
3177
+ : from instanceof codegen_1$v.Name
3224
3178
  ? (mergeToName(gen, to, from), from)
3225
3179
  : mergeValues(from, to);
3226
- return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res;
3180
+ return toName === codegen_1$v.Name && !(res instanceof codegen_1$v.Name) ? resultToName(gen, res) : res;
3227
3181
  };
3228
3182
  }
3229
- exports.mergeEvaluated = {
3183
+ util.mergeEvaluated = {
3230
3184
  props: makeMergeEvaluated({
3231
- mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => {
3232
- gen.if((0, codegen_1._) `${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._) `${to} || {}`).code((0, codegen_1._) `Object.assign(${to}, ${from})`));
3185
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1$v._) `${to} !== true && ${from} !== undefined`, () => {
3186
+ gen.if((0, codegen_1$v._) `${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1$v._) `${to} || {}`).code((0, codegen_1$v._) `Object.assign(${to}, ${from})`));
3233
3187
  }),
3234
- mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => {
3188
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1$v._) `${to} !== true`, () => {
3235
3189
  if (from === true) {
3236
3190
  gen.assign(to, true);
3237
3191
  }
3238
3192
  else {
3239
- gen.assign(to, (0, codegen_1._) `${to} || {}`);
3193
+ gen.assign(to, (0, codegen_1$v._) `${to} || {}`);
3240
3194
  setEvaluated(gen, to, from);
3241
3195
  }
3242
3196
  }),
@@ -3244,8 +3198,8 @@ exports.mergeEvaluated = {
3244
3198
  resultToName: evaluatedPropsToName,
3245
3199
  }),
3246
3200
  items: makeMergeEvaluated({
3247
- mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._) `${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
3248
- mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._) `${to} > ${from} ? ${to} : ${from}`)),
3201
+ mergeNames: (gen, from, to) => gen.if((0, codegen_1$v._) `${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1$v._) `${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)),
3202
+ mergeToName: (gen, from, to) => gen.if((0, codegen_1$v._) `${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1$v._) `${to} > ${from} ? ${to} : ${from}`)),
3249
3203
  mergeValues: (from, to) => (from === true ? true : Math.max(from, to)),
3250
3204
  resultToName: (gen, items) => gen.var("items", items),
3251
3205
  }),
@@ -3253,44 +3207,44 @@ exports.mergeEvaluated = {
3253
3207
  function evaluatedPropsToName(gen, ps) {
3254
3208
  if (ps === true)
3255
3209
  return gen.var("props", true);
3256
- const props = gen.var("props", (0, codegen_1._) `{}`);
3210
+ const props = gen.var("props", (0, codegen_1$v._) `{}`);
3257
3211
  if (ps !== undefined)
3258
3212
  setEvaluated(gen, props, ps);
3259
3213
  return props;
3260
3214
  }
3261
- exports.evaluatedPropsToName = evaluatedPropsToName;
3215
+ util.evaluatedPropsToName = evaluatedPropsToName;
3262
3216
  function setEvaluated(gen, props, ps) {
3263
- Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._) `${props}${(0, codegen_1.getProperty)(p)}`, true));
3217
+ Object.keys(ps).forEach((p) => gen.assign((0, codegen_1$v._) `${props}${(0, codegen_1$v.getProperty)(p)}`, true));
3264
3218
  }
3265
- exports.setEvaluated = setEvaluated;
3219
+ util.setEvaluated = setEvaluated;
3266
3220
  const snippets = {};
3267
3221
  function useFunc(gen, f) {
3268
3222
  return gen.scopeValue("func", {
3269
3223
  ref: f,
3270
- code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code)),
3224
+ code: snippets[f.code] || (snippets[f.code] = new code_1$a._Code(f.code)),
3271
3225
  });
3272
3226
  }
3273
- exports.useFunc = useFunc;
3227
+ util.useFunc = useFunc;
3274
3228
  var Type;
3275
3229
  (function (Type) {
3276
3230
  Type[Type["Num"] = 0] = "Num";
3277
3231
  Type[Type["Str"] = 1] = "Str";
3278
- })(Type = exports.Type || (exports.Type = {}));
3232
+ })(Type || (util.Type = Type = {}));
3279
3233
  function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
3280
3234
  // let path
3281
- if (dataProp instanceof codegen_1.Name) {
3235
+ if (dataProp instanceof codegen_1$v.Name) {
3282
3236
  const isNumber = dataPropType === Type.Num;
3283
3237
  return jsPropertySyntax
3284
3238
  ? isNumber
3285
- ? (0, codegen_1._) `"[" + ${dataProp} + "]"`
3286
- : (0, codegen_1._) `"['" + ${dataProp} + "']"`
3239
+ ? (0, codegen_1$v._) `"[" + ${dataProp} + "]"`
3240
+ : (0, codegen_1$v._) `"['" + ${dataProp} + "']"`
3287
3241
  : isNumber
3288
- ? (0, codegen_1._) `"/" + ${dataProp}`
3289
- : (0, codegen_1._) `"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`; // TODO maybe use global escapePointer
3242
+ ? (0, codegen_1$v._) `"/" + ${dataProp}`
3243
+ : (0, codegen_1$v._) `"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`; // TODO maybe use global escapePointer
3290
3244
  }
3291
- return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
3245
+ return jsPropertySyntax ? (0, codegen_1$v.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp);
3292
3246
  }
3293
- exports.getErrorPath = getErrorPath;
3247
+ util.getErrorPath = getErrorPath;
3294
3248
  function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
3295
3249
  if (!mode)
3296
3250
  return;
@@ -3299,36 +3253,34 @@ function checkStrictMode(it, msg, mode = it.opts.strictSchema) {
3299
3253
  throw new Error(msg);
3300
3254
  it.self.logger.warn(msg);
3301
3255
  }
3302
- exports.checkStrictMode = checkStrictMode;
3303
-
3304
- }(util));
3256
+ util.checkStrictMode = checkStrictMode;
3305
3257
 
3306
3258
  var names$1 = {};
3307
3259
 
3308
3260
  Object.defineProperty(names$1, "__esModule", { value: true });
3309
- const codegen_1$t = codegen;
3261
+ const codegen_1$u = codegen;
3310
3262
  const names = {
3311
3263
  // validation function arguments
3312
- data: new codegen_1$t.Name("data"),
3264
+ data: new codegen_1$u.Name("data"), // data passed to validation function
3313
3265
  // args passed from referencing schema
3314
- valCxt: new codegen_1$t.Name("valCxt"),
3315
- instancePath: new codegen_1$t.Name("instancePath"),
3316
- parentData: new codegen_1$t.Name("parentData"),
3317
- parentDataProperty: new codegen_1$t.Name("parentDataProperty"),
3318
- rootData: new codegen_1$t.Name("rootData"),
3319
- dynamicAnchors: new codegen_1$t.Name("dynamicAnchors"),
3266
+ valCxt: new codegen_1$u.Name("valCxt"), // validation/data context - should not be used directly, it is destructured to the names below
3267
+ instancePath: new codegen_1$u.Name("instancePath"),
3268
+ parentData: new codegen_1$u.Name("parentData"),
3269
+ parentDataProperty: new codegen_1$u.Name("parentDataProperty"),
3270
+ rootData: new codegen_1$u.Name("rootData"), // root data - same as the data passed to the first/top validation function
3271
+ dynamicAnchors: new codegen_1$u.Name("dynamicAnchors"), // used to support recursiveRef and dynamicRef
3320
3272
  // function scoped variables
3321
- vErrors: new codegen_1$t.Name("vErrors"),
3322
- errors: new codegen_1$t.Name("errors"),
3323
- this: new codegen_1$t.Name("this"),
3273
+ vErrors: new codegen_1$u.Name("vErrors"), // null or array of validation errors
3274
+ errors: new codegen_1$u.Name("errors"), // counter of validation errors
3275
+ this: new codegen_1$u.Name("this"),
3324
3276
  // "globals"
3325
- self: new codegen_1$t.Name("self"),
3326
- scope: new codegen_1$t.Name("scope"),
3277
+ self: new codegen_1$u.Name("self"),
3278
+ scope: new codegen_1$u.Name("scope"),
3327
3279
  // JTD serialize/parse name for JSON string and position
3328
- json: new codegen_1$t.Name("json"),
3329
- jsonPos: new codegen_1$t.Name("jsonPos"),
3330
- jsonLen: new codegen_1$t.Name("jsonLen"),
3331
- jsonPart: new codegen_1$t.Name("jsonPart"),
3280
+ json: new codegen_1$u.Name("json"),
3281
+ jsonPos: new codegen_1$u.Name("jsonPos"),
3282
+ jsonLen: new codegen_1$u.Name("jsonLen"),
3283
+ jsonPart: new codegen_1$u.Name("jsonPart"),
3332
3284
  };
3333
3285
  names$1.default = names;
3334
3286
 
@@ -3406,7 +3358,7 @@ function returnErrors(it, errs) {
3406
3358
  }
3407
3359
  const E = {
3408
3360
  keyword: new codegen_1.Name("keyword"),
3409
- schemaPath: new codegen_1.Name("schemaPath"),
3361
+ schemaPath: new codegen_1.Name("schemaPath"), // also used in JTD errors
3410
3362
  params: new codegen_1.Name("params"),
3411
3363
  propertyName: new codegen_1.Name("propertyName"),
3412
3364
  message: new codegen_1.Name("message"),
@@ -3459,8 +3411,8 @@ function extraErrorProps(cxt, { params, message }, keyValues) {
3459
3411
 
3460
3412
  Object.defineProperty(boolSchema, "__esModule", { value: true });
3461
3413
  boolSchema.boolOrEmptySchema = boolSchema.topBoolOrEmptySchema = void 0;
3462
- const errors_1$2 = errors;
3463
- const codegen_1$s = codegen;
3414
+ const errors_1$3 = errors;
3415
+ const codegen_1$t = codegen;
3464
3416
  const names_1$6 = names$1;
3465
3417
  const boolError = {
3466
3418
  message: "boolean schema is false",
@@ -3474,7 +3426,7 @@ function topBoolOrEmptySchema(it) {
3474
3426
  gen.return(names_1$6.default.data);
3475
3427
  }
3476
3428
  else {
3477
- gen.assign((0, codegen_1$s._) `${validateName}.errors`, null);
3429
+ gen.assign((0, codegen_1$t._) `${validateName}.errors`, null);
3478
3430
  gen.return(true);
3479
3431
  }
3480
3432
  }
@@ -3503,7 +3455,7 @@ function falseSchemaError(it, overrideAllErrors) {
3503
3455
  params: {},
3504
3456
  it,
3505
3457
  };
3506
- (0, errors_1$2.reportError)(cxt, boolError, undefined, overrideAllErrors);
3458
+ (0, errors_1$3.reportError)(cxt, boolError, undefined, overrideAllErrors);
3507
3459
  }
3508
3460
 
3509
3461
  var dataType = {};
@@ -3555,19 +3507,18 @@ function shouldUseRule(schema, rule) {
3555
3507
  }
3556
3508
  applicability.shouldUseRule = shouldUseRule;
3557
3509
 
3558
- (function (exports) {
3559
- Object.defineProperty(exports, "__esModule", { value: true });
3560
- exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0;
3510
+ Object.defineProperty(dataType, "__esModule", { value: true });
3511
+ dataType.reportTypeError = dataType.checkDataTypes = dataType.checkDataType = dataType.coerceAndCheckDataType = dataType.getJSONTypes = dataType.getSchemaTypes = dataType.DataType = void 0;
3561
3512
  const rules_1 = rules;
3562
- const applicability_1 = applicability;
3563
- const errors_1 = errors;
3564
- const codegen_1 = codegen;
3565
- const util_1 = util;
3513
+ const applicability_1$1 = applicability;
3514
+ const errors_1$2 = errors;
3515
+ const codegen_1$s = codegen;
3516
+ const util_1$q = util;
3566
3517
  var DataType;
3567
3518
  (function (DataType) {
3568
3519
  DataType[DataType["Correct"] = 0] = "Correct";
3569
3520
  DataType[DataType["Wrong"] = 1] = "Wrong";
3570
- })(DataType = exports.DataType || (exports.DataType = {}));
3521
+ })(DataType || (dataType.DataType = DataType = {}));
3571
3522
  function getSchemaTypes(schema) {
3572
3523
  const types = getJSONTypes(schema.type);
3573
3524
  const hasNull = types.includes("null");
@@ -3584,19 +3535,20 @@ function getSchemaTypes(schema) {
3584
3535
  }
3585
3536
  return types;
3586
3537
  }
3587
- exports.getSchemaTypes = getSchemaTypes;
3538
+ dataType.getSchemaTypes = getSchemaTypes;
3539
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
3588
3540
  function getJSONTypes(ts) {
3589
3541
  const types = Array.isArray(ts) ? ts : ts ? [ts] : [];
3590
3542
  if (types.every(rules_1.isJSONType))
3591
3543
  return types;
3592
3544
  throw new Error("type must be JSONType or JSONType[]: " + types.join(","));
3593
3545
  }
3594
- exports.getJSONTypes = getJSONTypes;
3546
+ dataType.getJSONTypes = getJSONTypes;
3595
3547
  function coerceAndCheckDataType(it, types) {
3596
3548
  const { gen, data, opts } = it;
3597
3549
  const coerceTo = coerceToTypes(types, opts.coerceTypes);
3598
3550
  const checkTypes = types.length > 0 &&
3599
- !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0]));
3551
+ !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1$1.schemaHasRulesForType)(it, types[0]));
3600
3552
  if (checkTypes) {
3601
3553
  const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong);
3602
3554
  gen.if(wrongType, () => {
@@ -3608,7 +3560,7 @@ function coerceAndCheckDataType(it, types) {
3608
3560
  }
3609
3561
  return checkTypes;
3610
3562
  }
3611
- exports.coerceAndCheckDataType = coerceAndCheckDataType;
3563
+ dataType.coerceAndCheckDataType = coerceAndCheckDataType;
3612
3564
  const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]);
3613
3565
  function coerceToTypes(types, coerceTypes) {
3614
3566
  return coerceTypes
@@ -3617,15 +3569,15 @@ function coerceToTypes(types, coerceTypes) {
3617
3569
  }
3618
3570
  function coerceData(it, types, coerceTo) {
3619
3571
  const { gen, data, opts } = it;
3620
- const dataType = gen.let("dataType", (0, codegen_1._) `typeof ${data}`);
3621
- const coerced = gen.let("coerced", (0, codegen_1._) `undefined`);
3572
+ const dataType = gen.let("dataType", (0, codegen_1$s._) `typeof ${data}`);
3573
+ const coerced = gen.let("coerced", (0, codegen_1$s._) `undefined`);
3622
3574
  if (opts.coerceTypes === "array") {
3623
- gen.if((0, codegen_1._) `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen
3624
- .assign(data, (0, codegen_1._) `${data}[0]`)
3625
- .assign(dataType, (0, codegen_1._) `typeof ${data}`)
3575
+ gen.if((0, codegen_1$s._) `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen
3576
+ .assign(data, (0, codegen_1$s._) `${data}[0]`)
3577
+ .assign(dataType, (0, codegen_1$s._) `typeof ${data}`)
3626
3578
  .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)));
3627
3579
  }
3628
- gen.if((0, codegen_1._) `${coerced} !== undefined`);
3580
+ gen.if((0, codegen_1$s._) `${coerced} !== undefined`);
3629
3581
  for (const t of coerceTo) {
3630
3582
  if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) {
3631
3583
  coerceSpecificType(t);
@@ -3634,7 +3586,7 @@ function coerceData(it, types, coerceTo) {
3634
3586
  gen.else();
3635
3587
  reportTypeError(it);
3636
3588
  gen.endIf();
3637
- gen.if((0, codegen_1._) `${coerced} !== undefined`, () => {
3589
+ gen.if((0, codegen_1$s._) `${coerced} !== undefined`, () => {
3638
3590
  gen.assign(data, coerced);
3639
3591
  assignParentData(it, coerced);
3640
3592
  });
@@ -3642,108 +3594,108 @@ function coerceData(it, types, coerceTo) {
3642
3594
  switch (t) {
3643
3595
  case "string":
3644
3596
  gen
3645
- .elseIf((0, codegen_1._) `${dataType} == "number" || ${dataType} == "boolean"`)
3646
- .assign(coerced, (0, codegen_1._) `"" + ${data}`)
3647
- .elseIf((0, codegen_1._) `${data} === null`)
3648
- .assign(coerced, (0, codegen_1._) `""`);
3597
+ .elseIf((0, codegen_1$s._) `${dataType} == "number" || ${dataType} == "boolean"`)
3598
+ .assign(coerced, (0, codegen_1$s._) `"" + ${data}`)
3599
+ .elseIf((0, codegen_1$s._) `${data} === null`)
3600
+ .assign(coerced, (0, codegen_1$s._) `""`);
3649
3601
  return;
3650
3602
  case "number":
3651
3603
  gen
3652
- .elseIf((0, codegen_1._) `${dataType} == "boolean" || ${data} === null
3604
+ .elseIf((0, codegen_1$s._) `${dataType} == "boolean" || ${data} === null
3653
3605
  || (${dataType} == "string" && ${data} && ${data} == +${data})`)
3654
- .assign(coerced, (0, codegen_1._) `+${data}`);
3606
+ .assign(coerced, (0, codegen_1$s._) `+${data}`);
3655
3607
  return;
3656
3608
  case "integer":
3657
3609
  gen
3658
- .elseIf((0, codegen_1._) `${dataType} === "boolean" || ${data} === null
3610
+ .elseIf((0, codegen_1$s._) `${dataType} === "boolean" || ${data} === null
3659
3611
  || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`)
3660
- .assign(coerced, (0, codegen_1._) `+${data}`);
3612
+ .assign(coerced, (0, codegen_1$s._) `+${data}`);
3661
3613
  return;
3662
3614
  case "boolean":
3663
3615
  gen
3664
- .elseIf((0, codegen_1._) `${data} === "false" || ${data} === 0 || ${data} === null`)
3616
+ .elseIf((0, codegen_1$s._) `${data} === "false" || ${data} === 0 || ${data} === null`)
3665
3617
  .assign(coerced, false)
3666
- .elseIf((0, codegen_1._) `${data} === "true" || ${data} === 1`)
3618
+ .elseIf((0, codegen_1$s._) `${data} === "true" || ${data} === 1`)
3667
3619
  .assign(coerced, true);
3668
3620
  return;
3669
3621
  case "null":
3670
- gen.elseIf((0, codegen_1._) `${data} === "" || ${data} === 0 || ${data} === false`);
3622
+ gen.elseIf((0, codegen_1$s._) `${data} === "" || ${data} === 0 || ${data} === false`);
3671
3623
  gen.assign(coerced, null);
3672
3624
  return;
3673
3625
  case "array":
3674
3626
  gen
3675
- .elseIf((0, codegen_1._) `${dataType} === "string" || ${dataType} === "number"
3627
+ .elseIf((0, codegen_1$s._) `${dataType} === "string" || ${dataType} === "number"
3676
3628
  || ${dataType} === "boolean" || ${data} === null`)
3677
- .assign(coerced, (0, codegen_1._) `[${data}]`);
3629
+ .assign(coerced, (0, codegen_1$s._) `[${data}]`);
3678
3630
  }
3679
3631
  }
3680
3632
  }
3681
3633
  function assignParentData({ gen, parentData, parentDataProperty }, expr) {
3682
3634
  // TODO use gen.property
3683
- gen.if((0, codegen_1._) `${parentData} !== undefined`, () => gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, expr));
3635
+ gen.if((0, codegen_1$s._) `${parentData} !== undefined`, () => gen.assign((0, codegen_1$s._) `${parentData}[${parentDataProperty}]`, expr));
3684
3636
  }
3685
3637
  function checkDataType(dataType, data, strictNums, correct = DataType.Correct) {
3686
- const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ;
3638
+ const EQ = correct === DataType.Correct ? codegen_1$s.operators.EQ : codegen_1$s.operators.NEQ;
3687
3639
  let cond;
3688
3640
  switch (dataType) {
3689
3641
  case "null":
3690
- return (0, codegen_1._) `${data} ${EQ} null`;
3642
+ return (0, codegen_1$s._) `${data} ${EQ} null`;
3691
3643
  case "array":
3692
- cond = (0, codegen_1._) `Array.isArray(${data})`;
3644
+ cond = (0, codegen_1$s._) `Array.isArray(${data})`;
3693
3645
  break;
3694
3646
  case "object":
3695
- cond = (0, codegen_1._) `${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
3647
+ cond = (0, codegen_1$s._) `${data} && typeof ${data} == "object" && !Array.isArray(${data})`;
3696
3648
  break;
3697
3649
  case "integer":
3698
- cond = numCond((0, codegen_1._) `!(${data} % 1) && !isNaN(${data})`);
3650
+ cond = numCond((0, codegen_1$s._) `!(${data} % 1) && !isNaN(${data})`);
3699
3651
  break;
3700
3652
  case "number":
3701
3653
  cond = numCond();
3702
3654
  break;
3703
3655
  default:
3704
- return (0, codegen_1._) `typeof ${data} ${EQ} ${dataType}`;
3656
+ return (0, codegen_1$s._) `typeof ${data} ${EQ} ${dataType}`;
3705
3657
  }
3706
- return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond);
3707
- function numCond(_cond = codegen_1.nil) {
3708
- return (0, codegen_1.and)((0, codegen_1._) `typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._) `isFinite(${data})` : codegen_1.nil);
3658
+ return correct === DataType.Correct ? cond : (0, codegen_1$s.not)(cond);
3659
+ function numCond(_cond = codegen_1$s.nil) {
3660
+ return (0, codegen_1$s.and)((0, codegen_1$s._) `typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1$s._) `isFinite(${data})` : codegen_1$s.nil);
3709
3661
  }
3710
3662
  }
3711
- exports.checkDataType = checkDataType;
3663
+ dataType.checkDataType = checkDataType;
3712
3664
  function checkDataTypes(dataTypes, data, strictNums, correct) {
3713
3665
  if (dataTypes.length === 1) {
3714
3666
  return checkDataType(dataTypes[0], data, strictNums, correct);
3715
3667
  }
3716
3668
  let cond;
3717
- const types = (0, util_1.toHash)(dataTypes);
3669
+ const types = (0, util_1$q.toHash)(dataTypes);
3718
3670
  if (types.array && types.object) {
3719
- const notObj = (0, codegen_1._) `typeof ${data} != "object"`;
3720
- cond = types.null ? notObj : (0, codegen_1._) `!${data} || ${notObj}`;
3671
+ const notObj = (0, codegen_1$s._) `typeof ${data} != "object"`;
3672
+ cond = types.null ? notObj : (0, codegen_1$s._) `!${data} || ${notObj}`;
3721
3673
  delete types.null;
3722
3674
  delete types.array;
3723
3675
  delete types.object;
3724
3676
  }
3725
3677
  else {
3726
- cond = codegen_1.nil;
3678
+ cond = codegen_1$s.nil;
3727
3679
  }
3728
3680
  if (types.number)
3729
3681
  delete types.integer;
3730
3682
  for (const t in types)
3731
- cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct));
3683
+ cond = (0, codegen_1$s.and)(cond, checkDataType(t, data, strictNums, correct));
3732
3684
  return cond;
3733
3685
  }
3734
- exports.checkDataTypes = checkDataTypes;
3686
+ dataType.checkDataTypes = checkDataTypes;
3735
3687
  const typeError = {
3736
3688
  message: ({ schema }) => `must be ${schema}`,
3737
- params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._) `{type: ${schema}}` : (0, codegen_1._) `{type: ${schemaValue}}`,
3689
+ params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1$s._) `{type: ${schema}}` : (0, codegen_1$s._) `{type: ${schemaValue}}`,
3738
3690
  };
3739
3691
  function reportTypeError(it) {
3740
3692
  const cxt = getTypeErrorContext(it);
3741
- (0, errors_1.reportError)(cxt, typeError);
3693
+ (0, errors_1$2.reportError)(cxt, typeError);
3742
3694
  }
3743
- exports.reportTypeError = reportTypeError;
3695
+ dataType.reportTypeError = reportTypeError;
3744
3696
  function getTypeErrorContext(it) {
3745
3697
  const { gen, data, schema } = it;
3746
- const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type");
3698
+ const schemaCode = (0, util_1$q.schemaRefOrVal)(it, schema, "type");
3747
3699
  return {
3748
3700
  gen,
3749
3701
  keyword: "type",
@@ -3757,8 +3709,6 @@ function getTypeErrorContext(it) {
3757
3709
  };
3758
3710
  }
3759
3711
 
3760
- }(dataType));
3761
-
3762
3712
  var defaults = {};
3763
3713
 
3764
3714
  Object.defineProperty(defaults, "__esModule", { value: true });
@@ -4380,16 +4330,16 @@ function getSchemaRefs(schema, baseId) {
4380
4330
  if (parentJsonPtr === undefined)
4381
4331
  return;
4382
4332
  const fullPath = pathPrefix + jsonPtr;
4383
- let baseId = baseIds[parentJsonPtr];
4333
+ let innerBaseId = baseIds[parentJsonPtr];
4384
4334
  if (typeof sch[schemaId] == "string")
4385
- baseId = addRef.call(this, sch[schemaId]);
4335
+ innerBaseId = addRef.call(this, sch[schemaId]);
4386
4336
  addAnchor.call(this, sch.$anchor);
4387
4337
  addAnchor.call(this, sch.$dynamicAnchor);
4388
- baseIds[jsonPtr] = baseId;
4338
+ baseIds[jsonPtr] = innerBaseId;
4389
4339
  function addRef(ref) {
4390
4340
  // eslint-disable-next-line @typescript-eslint/unbound-method
4391
4341
  const _resolve = this.opts.uriResolver.resolve;
4392
- ref = normalizeId(baseId ? _resolve(baseId, ref) : ref);
4342
+ ref = normalizeId(innerBaseId ? _resolve(innerBaseId, ref) : ref);
4393
4343
  if (schemaRefs.has(ref))
4394
4344
  throw ambiguos(ref);
4395
4345
  schemaRefs.add(ref);
@@ -5030,7 +4980,7 @@ function compileSchema(sch) {
5030
4980
  parentData: names_1$2.default.parentData,
5031
4981
  parentDataProperty: names_1$2.default.parentDataProperty,
5032
4982
  dataNames: [names_1$2.default.data],
5033
- dataPathArr: [codegen_1$m.nil],
4983
+ dataPathArr: [codegen_1$m.nil], // TODO can its length be used as dataLevel if nil is removed?
5034
4984
  dataLevel: 0,
5035
4985
  dataTypes: [],
5036
4986
  definedProperties: new Set(),
@@ -6799,6 +6749,7 @@ class Ajv {
6799
6749
  return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined);
6800
6750
  }
6801
6751
  validate(schemaKeyRef, // key, ref or schema object
6752
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
6802
6753
  data // to be validated
6803
6754
  ) {
6804
6755
  let v;
@@ -7147,9 +7098,9 @@ class Ajv {
7147
7098
  }
7148
7099
  }
7149
7100
  }
7150
- exports.default = Ajv;
7151
7101
  Ajv.ValidationError = validation_error_1.default;
7152
7102
  Ajv.MissingRefError = ref_error_1.default;
7103
+ exports.default = Ajv;
7153
7104
  function checkOptions(checkOpts, options, msg, log = "error") {
7154
7105
  for (const key in checkOpts) {
7155
7106
  const opt = key;
@@ -7297,7 +7248,7 @@ var ref = {};
7297
7248
 
7298
7249
  Object.defineProperty(ref, "__esModule", { value: true });
7299
7250
  ref.callRef = ref.getValidate = void 0;
7300
- const ref_error_1 = ref_error;
7251
+ const ref_error_1$1 = ref_error;
7301
7252
  const code_1$8 = code;
7302
7253
  const codegen_1$l = codegen;
7303
7254
  const names_1$1 = names$1;
@@ -7314,7 +7265,7 @@ const def$r = {
7314
7265
  return callRootRef();
7315
7266
  const schOrEnv = compile_1$1.resolveRef.call(self, root, baseId, $ref);
7316
7267
  if (schOrEnv === undefined)
7317
- throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref);
7268
+ throw new ref_error_1$1.default(it.opts.uriResolver, baseId, $ref);
7318
7269
  if (schOrEnv instanceof compile_1$1.SchemaEnv)
7319
7270
  return callValidate(schOrEnv);
7320
7271
  return inlineRefSchema(schOrEnv);
@@ -8875,20 +8826,19 @@ var discriminator = {};
8875
8826
 
8876
8827
  var types = {};
8877
8828
 
8878
- (function (exports) {
8879
- Object.defineProperty(exports, "__esModule", { value: true });
8880
- exports.DiscrError = void 0;
8829
+ Object.defineProperty(types, "__esModule", { value: true });
8830
+ types.DiscrError = void 0;
8831
+ var DiscrError;
8881
8832
  (function (DiscrError) {
8882
8833
  DiscrError["Tag"] = "tag";
8883
8834
  DiscrError["Mapping"] = "mapping";
8884
- })(exports.DiscrError || (exports.DiscrError = {}));
8885
-
8886
- }(types));
8835
+ })(DiscrError || (types.DiscrError = DiscrError = {}));
8887
8836
 
8888
8837
  Object.defineProperty(discriminator, "__esModule", { value: true });
8889
8838
  const codegen_1 = codegen;
8890
8839
  const types_1 = types;
8891
8840
  const compile_1 = compile;
8841
+ const ref_error_1 = ref_error;
8892
8842
  const util_1 = util;
8893
8843
  const error = {
8894
8844
  message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag
@@ -8943,9 +8893,12 @@ const def = {
8943
8893
  for (let i = 0; i < oneOf.length; i++) {
8944
8894
  let sch = oneOf[i];
8945
8895
  if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) {
8946
- sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, sch === null || sch === void 0 ? void 0 : sch.$ref);
8896
+ const ref = sch.$ref;
8897
+ sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, ref);
8947
8898
  if (sch instanceof compile_1.SchemaEnv)
8948
8899
  sch = sch.schema;
8900
+ if (sch === undefined)
8901
+ throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref);
8949
8902
  }
8950
8903
  const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName];
8951
8904
  if (typeof propSch != "object") {
@@ -9238,7 +9191,7 @@ var require$$3 = {
9238
9191
 
9239
9192
  (function (module, exports) {
9240
9193
  Object.defineProperty(exports, "__esModule", { value: true });
9241
- exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0;
9194
+ exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = void 0;
9242
9195
  const core_1 = core$2;
9243
9196
  const draft7_1 = draft7;
9244
9197
  const discriminator_1 = discriminator;
@@ -9267,7 +9220,9 @@ class Ajv extends core_1.default {
9267
9220
  super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined));
9268
9221
  }
9269
9222
  }
9223
+ exports.Ajv = Ajv;
9270
9224
  module.exports = exports = Ajv;
9225
+ module.exports.Ajv = Ajv;
9271
9226
  Object.defineProperty(exports, "__esModule", { value: true });
9272
9227
  exports.default = Ajv;
9273
9228
  var validate_1 = validate$1;
@@ -9813,13 +9768,14 @@ var setWidgetErrorTips = function setWidgetErrorTips(path, isError, errorMsg) {
9813
9768
  var widgetPaths = path.split('.');
9814
9769
  var fieldTitleBreadcrumb = [];
9815
9770
  widgetPaths.forEach(function (thePath, thePathIndex) {
9771
+ var _theWidget$instance;
9816
9772
  var currentPaths = widgetPaths.slice(0, widgetPaths.length - thePathIndex);
9817
9773
  var widgetPath = currentPaths.join('.');
9818
9774
  var theWidget = widgetTree.widgetMap[widgetPath];
9819
9775
  // todo(判断path是否是数组索引)
9820
9776
  var isIndex = theWidget.instance.schema.type === 'array' || !theWidget.instance.schema.title;
9821
9777
  fieldTitleBreadcrumb.push(isIndex ? currentPaths.pop() : theWidget.instance.schema.title);
9822
- if (theWidget.instance.verifiable && theWidget.type === 'group') {
9778
+ if ((_theWidget$instance = theWidget.instance) !== null && _theWidget$instance !== void 0 && _theWidget$instance.verifiable && theWidget.type === 'group') {
9823
9779
  if (isError) {
9824
9780
  var groupErrors = "".concat(fieldTitleBreadcrumb.reverse().join('-'), ": ").concat(errorMsg);
9825
9781
  theWidget.instance.setGroupErrorTips(path, groupErrors);
@@ -9837,7 +9793,7 @@ var validateFormItem = function validateFormItem(path) {
9837
9793
  var _instance$schema;
9838
9794
  // TODO 校验逻辑梳理
9839
9795
  var formItem = widgetTree.widgetMap[path];
9840
- if (!formItem) return {
9796
+ if (!formItem || !formItem.instance) return {
9841
9797
  result: true,
9842
9798
  message: '',
9843
9799
  path: ''
@@ -9852,9 +9808,10 @@ var validateFormItem = function validateFormItem(path) {
9852
9808
  // 清空所在组错误信息
9853
9809
  var widgetPaths = path.split('.');
9854
9810
  widgetPaths.forEach(function (thePath, thePathIndex) {
9811
+ var _theWidget$instance2;
9855
9812
  var currentPaths = widgetPaths.slice(0, widgetPaths.length - thePathIndex).join('.');
9856
9813
  var theWidget = widgetTree.widgetMap[currentPaths];
9857
- if (theWidget.instance.verifiable && theWidget.type === 'group') {
9814
+ if ((_theWidget$instance2 = theWidget.instance) !== null && _theWidget$instance2 !== void 0 && _theWidget$instance2.verifiable && theWidget.type === 'group') {
9858
9815
  theWidget.instance.removeGroupErrorTips(path);
9859
9816
  }
9860
9817
  });
@@ -9988,7 +9945,7 @@ var FormEvent = /*#__PURE__*/function () {
9988
9945
  this.callbacks = void 0;
9989
9946
  this.callbacks = Object.create(null);
9990
9947
  }
9991
- _createClass(FormEvent, [{
9948
+ return _createClass(FormEvent, [{
9992
9949
  key: "on",
9993
9950
  value: function on(path, type, cb) {
9994
9951
  if (!(path in this.callbacks)) {
@@ -10060,7 +10017,6 @@ var FormEvent = /*#__PURE__*/function () {
10060
10017
  }
10061
10018
  }
10062
10019
  }]);
10063
- return FormEvent;
10064
10020
  }();
10065
10021
  var events = new FormEvent();
10066
10022
 
@@ -10080,16 +10036,25 @@ var Widget = Vue.extend({
10080
10036
  readonly: this.readonly,
10081
10037
  error: this.error
10082
10038
  },
10083
- errorTips: ''
10039
+ errorTips: '',
10040
+ privateSchema: {},
10041
+ key: ''
10084
10042
  };
10085
10043
  },
10086
10044
  computed: {
10045
+ widgetMap: function widgetMap() {
10046
+ return widgetTree.widgetMap;
10047
+ },
10087
10048
  widgetNode: function widgetNode() {
10088
10049
  return widgetTree.widgetMap[this.path];
10089
10050
  },
10090
10051
  parent: function parent() {
10091
10052
  var _this$widgetNode;
10092
10053
  return (_this$widgetNode = this.widgetNode) === null || _this$widgetNode === void 0 ? void 0 : _this$widgetNode.parent;
10054
+ },
10055
+ // 当前widget schema数据
10056
+ widgetSchema: function widgetSchema() {
10057
+ return mergeDeep({}, this.schema, this.privateSchema);
10093
10058
  }
10094
10059
  },
10095
10060
  watch: {
@@ -10103,19 +10068,27 @@ var Widget = Vue.extend({
10103
10068
  }, 0);
10104
10069
  }
10105
10070
  }
10071
+ },
10072
+ widgetSchema: {
10073
+ deep: true,
10074
+ handler: function handler(newValue, oldValue) {
10075
+ if (deepEquals(newValue, oldValue)) return;
10076
+ this.resetDatasource();
10077
+ this.key = new Date().getTime();
10078
+ }
10106
10079
  }
10107
10080
  },
10108
10081
  created: function created() {
10109
10082
  var _this2 = this;
10110
10083
  // 表单项配置
10111
- var uiOptions = Schema.getUiOptions(this.schema);
10084
+ var uiOptions = Schema.getUiOptions(this.widgetSchema);
10112
10085
  this.formItemProps = _objectSpread2(_objectSpread2({}, uiOptions), {}, {
10113
10086
  // schema配置不存在title时默认用属性名作为title
10114
10087
  label: uiOptions.showTitle ? uiOptions.label || Path.getPathLastProp(this.path) : '',
10115
10088
  required: this.required
10116
10089
  });
10117
10090
  // 设置widget初始化状态 ui:component优先级 > ui:props优先级
10118
- var vNodeData = Schema.getUiComponent(this.schema);
10091
+ var vNodeData = Schema.getUiComponent(this.widgetSchema);
10119
10092
  var defaultProps = Object.assign({}, this.formItemProps, vNodeData.props || {});
10120
10093
  Object.keys(defaultProps).forEach(function (key) {
10121
10094
  if (Reflect.has(_this2.state, key)) {
@@ -10127,7 +10100,7 @@ var Widget = Vue.extend({
10127
10100
  },
10128
10101
  mounted: function mounted() {
10129
10102
  // 注册联动
10130
- reactionRegister(this.path, this.schema['ui:reactions']);
10103
+ reactionRegister(this.path, this.widgetSchema['ui:reactions']);
10131
10104
  // 首次联动
10132
10105
  reactionDispatch(this.path, 'valChange');
10133
10106
  reactionDispatch(this.path, 'lifetime/init');
@@ -10153,12 +10126,12 @@ var Widget = Vue.extend({
10153
10126
  loadDataSource: function loadDataSource() {
10154
10127
  var _this3 = this;
10155
10128
  return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
10156
- var _this3$schema, _this3$schema$uiComp, _this3$schema$uiComp$;
10129
+ var _this3$widgetSchema, _this3$widgetSchema$u, _this3$widgetSchema$u2;
10157
10130
  var xhrConfig, url, params, reset, _this3$httpAdapter, _this3$httpAdapter$re, http, responseParse, remoteURL, requestParams;
10158
10131
  return _regeneratorRuntime().wrap(function _callee$(_context) {
10159
10132
  while (1) switch (_context.prev = _context.next) {
10160
10133
  case 0:
10161
- 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;
10134
+ xhrConfig = (_this3$widgetSchema = _this3.widgetSchema) === null || _this3$widgetSchema === void 0 ? void 0 : (_this3$widgetSchema$u = _this3$widgetSchema['ui:component']) === null || _this3$widgetSchema$u === void 0 ? void 0 : (_this3$widgetSchema$u2 = _this3$widgetSchema$u.props) === null || _this3$widgetSchema$u2 === void 0 ? void 0 : _this3$widgetSchema$u2.remoteConfig;
10162
10135
  if (!xhrConfig) {
10163
10136
  _context.next = 18;
10164
10137
  break;
@@ -10198,11 +10171,11 @@ var Widget = Vue.extend({
10198
10171
  return Path.getPathVal(this.rootData, path);
10199
10172
  },
10200
10173
  getReadonlyValue: function getReadonlyValue() {
10201
- var _this$schema$uiCompo,
10202
- _this$schema$uiCompo$,
10174
+ var _this$widgetSchema$ui,
10175
+ _this$widgetSchema$ui2,
10203
10176
  _this4 = this;
10204
10177
  var val = this.value;
10205
- if (((_this$schema$uiCompo = this.schema['ui:component']) === null || _this$schema$uiCompo === void 0 ? void 0 : (_this$schema$uiCompo$ = _this$schema$uiCompo.props) === null || _this$schema$uiCompo$ === void 0 ? void 0 : _this$schema$uiCompo$.type) === 'password') {
10178
+ if (((_this$widgetSchema$ui = this.widgetSchema['ui:component']) === null || _this$widgetSchema$ui === void 0 ? void 0 : (_this$widgetSchema$ui2 = _this$widgetSchema$ui.props) === null || _this$widgetSchema$ui2 === void 0 ? void 0 : _this$widgetSchema$ui2.type) === 'password') {
10206
10179
  val = '******';
10207
10180
  } else if (this.datasource) {
10208
10181
  var _this$datasource;
@@ -10229,11 +10202,31 @@ var Widget = Vue.extend({
10229
10202
  value = String(value);
10230
10203
  }
10231
10204
  return value;
10205
+ },
10206
+ getSchema: function getSchema() {
10207
+ return this.widgetSchema;
10208
+ },
10209
+ setSchema: function setSchema(data) {
10210
+ try {
10211
+ this.privateSchema = JSON.parse(JSON.stringify(data));
10212
+ } catch (err) {
10213
+ console.warn(err);
10214
+ }
10215
+ return this.widgetSchema;
10216
+ },
10217
+ resetDatasource: function resetDatasource() {
10218
+ var _this$widgetSchema, _this$widgetSchema$ui3, _this$widgetSchema$ui4;
10219
+ var xhrConfig = (_this$widgetSchema = this.widgetSchema) === null || _this$widgetSchema === void 0 ? void 0 : (_this$widgetSchema$ui3 = _this$widgetSchema['ui:component']) === null || _this$widgetSchema$ui3 === void 0 ? void 0 : (_this$widgetSchema$ui4 = _this$widgetSchema$ui3.props) === null || _this$widgetSchema$ui4 === void 0 ? void 0 : _this$widgetSchema$ui4.remoteConfig;
10220
+ if (xhrConfig) {
10221
+ this.loadDataSource();
10222
+ } else {
10223
+ this.datasource = Schema.resolveDefaultDatasource(this.widgetSchema);
10224
+ }
10232
10225
  }
10233
10226
  },
10234
10227
  render: function render(h) {
10235
- var _events$callbacks, _this$$scopedSlots$de, _this$$scopedSlots$de2, _this$$scopedSlots, _this$schema$uiCompo2, _this$$scopedSlots$su, _this$$scopedSlots2;
10236
- var _Schema$getUiComponen = Schema.getUiComponent(this.schema),
10228
+ var _events$callbacks, _this$$scopedSlots$de, _this$$scopedSlots$de2, _this$$scopedSlots, _this$widgetSchema$ui5, _this$$scopedSlots$su, _this$$scopedSlots2;
10229
+ var _Schema$getUiComponen = Schema.getUiComponent(this.widgetSchema),
10237
10230
  name = _Schema$getUiComponen.name,
10238
10231
  uiVnodeData = _objectWithoutProperties(_Schema$getUiComponen, _excluded2);
10239
10232
  // 注意顺序!!!
@@ -10242,13 +10235,15 @@ var Widget = Vue.extend({
10242
10235
  value: this.value
10243
10236
  });
10244
10237
  var self = this;
10245
- var widgetName = registry.getComponent(name) || name || Schema.getDefaultWidget(this.schema);
10238
+ var widgetName = registry.getComponent(name) || name || Schema.getDefaultWidget(this.widgetSchema);
10246
10239
  var widgetEvents = ((_events$callbacks = events.callbacks) === null || _events$callbacks === void 0 ? void 0 : _events$callbacks[this.path]) || {};
10247
10240
  // 当前state属性优先级最高
10248
10241
  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, {
10249
10242
  path: this.path
10250
10243
  })) !== null && _this$$scopedSlots$de !== void 0 ? _this$$scopedSlots$de : h(widgetName, mergeDeep({
10251
- props: _objectSpread2({}, widgetProps),
10244
+ props: _objectSpread2(_objectSpread2({}, widgetProps), {}, {
10245
+ schema: this.widgetSchema
10246
+ }),
10252
10247
  attrs: _objectSpread2({}, uiVnodeData.props || {}),
10253
10248
  class: {
10254
10249
  pr20: this.removeable
@@ -10294,6 +10289,7 @@ var Widget = Vue.extend({
10294
10289
  })]);
10295
10290
  };
10296
10291
  return h(registry.getBaseWidget('form-item'), {
10292
+ key: this.key,
10297
10293
  props: this.formItemProps,
10298
10294
  style: _objectSpread2(_objectSpread2(_objectSpread2({}, this.layout.item || {}), this.layout.container || {}), {}, {
10299
10295
  // 表单项显示和隐藏状态
@@ -10302,9 +10298,9 @@ var Widget = Vue.extend({
10302
10298
  class: {
10303
10299
  'bk-schema-form-item--error': this.state.error
10304
10300
  }
10305
- }, [this.state.readonly && this.readonlyMode === 'value' && ((_this$schema$uiCompo2 = this.schema['ui:component']) === null || _this$schema$uiCompo2 === void 0 ? void 0 : _this$schema$uiCompo2.name) !== 'table' ? renderReadonlyWidget : renderWidget, (_this$$scopedSlots$su = (_this$$scopedSlots2 = this.$scopedSlots).suffix) === null || _this$$scopedSlots$su === void 0 ? void 0 : _this$$scopedSlots$su.call(_this$$scopedSlots2, {
10301
+ }, [this.state.readonly && this.readonlyMode === 'value' && ((_this$widgetSchema$ui5 = this.widgetSchema['ui:component']) === null || _this$widgetSchema$ui5 === void 0 ? void 0 : _this$widgetSchema$ui5.name) !== 'table' ? renderReadonlyWidget : renderWidget, (_this$$scopedSlots$su = (_this$$scopedSlots2 = this.$scopedSlots).suffix) === null || _this$$scopedSlots$su === void 0 ? void 0 : _this$$scopedSlots$su.call(_this$$scopedSlots2, {
10306
10302
  path: this.path,
10307
- schema: this.schema
10303
+ schema: this.widgetSchema
10308
10304
  }), this.removeable && renderDelete(), this.state.error ? h('p', {
10309
10305
  class: 'bk-schema-form-item__error-tips'
10310
10306
  }, this.errorTips) : null, this.formItemProps.tips ? h('p', {
@@ -10473,7 +10469,6 @@ var ArrayWidget = Vue.extend({
10473
10469
  layout: _objectSpread2(_objectSpread2({}, _this.layout), {}, {
10474
10470
  item: {} // todo: 暂时不支持数组项之间的布局
10475
10471
  }),
10476
-
10477
10472
  removeable: true
10478
10473
  }),
10479
10474
  on: _objectSpread2(_objectSpread2({}, _this.$listeners), {}, {
@@ -10491,7 +10486,6 @@ var ArrayWidget = Vue.extend({
10491
10486
  layout: {},
10492
10487
  showTitle: true // 数组类型默认展示分组title
10493
10488
  }),
10494
-
10495
10489
  style: _objectSpread2({}, this.layout.item || {})
10496
10490
  }, vnode), [].concat(_toConsumableArray(arrVnodeList), [h(registry.getBaseWidget('form-item'), {
10497
10491
  class: {
@@ -10917,21 +10911,21 @@ var getRowDefaultData = function getRowDefaultData() {
10917
10911
  var TableWidget = Vue.extend({
10918
10912
  name: 'TableWidget',
10919
10913
  props: props,
10920
- mounted: function mounted() {
10921
- var _this = this;
10922
- this.$nextTick(function () {
10923
- var fieldMap = _this.schema.items.properties;
10924
- _this.value.forEach(function (item, index) {
10925
- Object.keys(fieldMap).forEach(function (key) {
10926
- var config = fieldMap[key];
10927
- if (config['ui:rules']) {
10928
- var instance = _this.$refs[key + index];
10929
- // 注册widget TreeNode
10930
- widgetTree.addWidgetNode("".concat(_this.path, ".").concat(key), instance, 'node');
10931
- }
10914
+ watch: {
10915
+ value: {
10916
+ immediate: true,
10917
+ handler: function handler() {
10918
+ var _this$value,
10919
+ _this = this;
10920
+ (_this$value = this.value) === null || _this$value === void 0 ? void 0 : _this$value.forEach(function (_, index) {
10921
+ var path = "".concat(_this.path, ".").concat(index);
10922
+ // 销毁上一次的缓存
10923
+ widgetTree.removeWidgetNode(path, null);
10924
+ // 重新当前行的父节点
10925
+ widgetTree.addWidgetNode(path, null, 'group');
10932
10926
  });
10933
- });
10934
- });
10927
+ }
10928
+ }
10935
10929
  },
10936
10930
  methods: {
10937
10931
  // 单元格表单编辑
@@ -10944,39 +10938,40 @@ var TableWidget = Vue.extend({
10944
10938
  },
10945
10939
  // 新增
10946
10940
  handleAddRow: function handleAddRow(index) {
10947
- var _this$$props$schema$i;
10948
- if (this.schema['ui:props'].disabled) return;
10941
+ var _this$schema$uiProps, _this$$props$schema$i;
10942
+ if ((_this$schema$uiProps = this.schema['ui:props']) !== null && _this$schema$uiProps !== void 0 && _this$schema$uiProps.disabled) return;
10949
10943
  var newValue = this.value.slice(0);
10950
10944
  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))));
10951
10945
  this.$emit('input', newValue);
10952
10946
  },
10953
10947
  // 删除
10954
10948
  handleDelRow: function handleDelRow(index) {
10955
- if (this.schema['ui:props'].disabled) return;
10949
+ var _this$schema$uiProps2;
10950
+ if ((_this$schema$uiProps2 = this.schema['ui:props']) !== null && _this$schema$uiProps2 !== void 0 && _this$schema$uiProps2.disabled) return;
10956
10951
  var newValue = this.value.slice(0);
10957
10952
  newValue.splice(index, 1);
10958
10953
  this.$emit('input', newValue);
10959
10954
  }
10960
10955
  },
10961
10956
  render: function render(h) {
10962
- var _schema$items,
10963
- _this2 = this;
10957
+ var _this2 = this;
10964
10958
  var self = this;
10965
- var _this$$props = this.$props,
10966
- schema = _this$$props.schema,
10967
- readonly = _this$$props.readonly,
10968
- readonlyMode = _this$$props.readonlyMode,
10969
- path = _this$$props.path,
10970
- context = _this$$props.context,
10971
- rootData = _this$$props.rootData,
10972
- value = _this$$props.value,
10973
- disabled = _this$$props.disabled;
10974
- var columnsKey = Object.keys(((_schema$items = schema.items) === null || _schema$items === void 0 ? void 0 : _schema$items.properties) || []);
10959
+ var schema = this.schema,
10960
+ path = this.path,
10961
+ value = this.value;
10962
+ var schemaItems = schema.items;
10963
+ var properties = {};
10964
+ if (schemaItems !== null && schemaItems !== void 0 && schemaItems.properties) {
10965
+ properties = schemaItems === null || schemaItems === void 0 ? void 0 : schemaItems.properties;
10966
+ } else {
10967
+ // table类型目前只支持items的类型为对象的schema
10968
+ console.warn('The current schema type is not supported table component', schemaItems);
10969
+ }
10975
10970
  var uiOptions = Schema.getUiOptions(schema);
10976
10971
  var getTableColumn = function getTableColumn() {
10977
- var VNodeList = columnsKey.map(function (key) {
10972
+ var VNodeList = Object.keys(properties).map(function (key) {
10978
10973
  var _colField$uiProps, _colField$uiProps2;
10979
- var colField = schema.items.properties[key];
10974
+ var colField = properties[key];
10980
10975
  // 仅支持基础数据类型的属性配置,render-header、sort-method、formatter等Function类型的属性不属于json支持的数据类型,配置将不会生效
10981
10976
  var colProps = ((_colField$uiProps = colField['ui:props']) === null || _colField$uiProps === void 0 ? void 0 : _colField$uiProps.tableColumnProps) || {};
10982
10977
  // 内置表头部分需要显示tooltips的场景, tableHeaderTips的属性将会透传给v-bk-tooltips指令
@@ -10998,21 +10993,13 @@ var TableWidget = Vue.extend({
10998
10993
  }
10999
10994
  return h(registry.getBaseWidget('table-column'), {
11000
10995
  props: _objectSpread2({
11001
- label: colField.title,
11002
- minWidth: colField.minWidth,
11003
- width: colField.width
10996
+ label: colField.title
11004
10997
  }, colProps),
11005
10998
  scopedSlots: {
11006
10999
  default: function _default(props) {
11007
11000
  return h(SchemaField, {
11008
- ref: key + props.$index,
11009
- props: {
11010
- context: context,
11011
- rootData: rootData,
11012
- readonly: readonly,
11013
- readonlyMode: readonlyMode,
11014
- disabled: disabled,
11015
- schema: mergeDeep(colField, {
11001
+ props: _objectSpread2(_objectSpread2({}, _this2.$props), {}, {
11002
+ schema: mergeDeep({}, colField, {
11016
11003
  'ui:props': {
11017
11004
  // 默认不展示标题
11018
11005
  showTitle: false,
@@ -11022,7 +11009,7 @@ var TableWidget = Vue.extend({
11022
11009
  }),
11023
11010
  path: Path.getCurPath(path, "".concat(props.$index, ".").concat(key)),
11024
11011
  value: props.row[key]
11025
- },
11012
+ }),
11026
11013
  on: {
11027
11014
  input: function input(data) {
11028
11015
  self.handleCellValChange(data);
@@ -11042,10 +11029,11 @@ var TableWidget = Vue.extend({
11042
11029
  },
11043
11030
  scopedSlots: {
11044
11031
  default: function _default(props) {
11032
+ var _schema$uiProps;
11045
11033
  return h('div', {
11046
11034
  class: {
11047
11035
  'table-widget-actions': true,
11048
- 'is-disabled': schema['ui:props'].disabled
11036
+ 'is-disabled': (_schema$uiProps = schema['ui:props']) === null || _schema$uiProps === void 0 ? void 0 : _schema$uiProps.disabled
11049
11037
  }
11050
11038
  }, [h('i', {
11051
11039
  class: 'bk-icon icon-plus-circle action-btn',
@@ -11184,7 +11172,6 @@ var FieldGroupWrap = Vue.extend({
11184
11172
  display: 'grid',
11185
11173
  gridGap: '20px' // 未设置layout的布局组的默认样式
11186
11174
  });
11187
-
11188
11175
  var self = this;
11189
11176
  var renderDelete = function renderDelete() {
11190
11177
  return h('span', {
@@ -11288,7 +11275,6 @@ var KeyValueArrayWidget = Vue.extend({
11288
11275
  gridGap: '20px',
11289
11276
  'grid-template-columns': defaultCols // 默认配置
11290
11277
  });
11291
-
11292
11278
  var self = this;
11293
11279
  var dealSchema = function dealSchema(schema) {
11294
11280
  return (
@@ -11411,7 +11397,6 @@ var TabGroupWidget = Vue.extend({
11411
11397
  layout: _objectSpread2(_objectSpread2({}, this.layout), {}, {
11412
11398
  container: {} // Tab组的容器layout由panel内容控制
11413
11399
  }),
11414
-
11415
11400
  title: this.schema.title
11416
11401
  });
11417
11402
  var self = this;
@@ -11444,7 +11429,6 @@ var TabGroupWidget = Vue.extend({
11444
11429
  layout: layoutConfig,
11445
11430
  removeable: false // todo: 不往下传递可删除属性
11446
11431
  }),
11447
-
11448
11432
  on: _objectSpread2({}, _this.$listeners)
11449
11433
  })]);
11450
11434
  }))]);
@@ -11506,7 +11490,6 @@ var CollapseGroupWidget = Vue.extend({
11506
11490
  layout: _objectSpread2(_objectSpread2({}, this.layout), {}, {
11507
11491
  container: {} // Tab组的容器layout由panel内容控制
11508
11492
  }),
11509
-
11510
11493
  title: this.schema.title
11511
11494
  });
11512
11495
  var properties = orderProperties(Object.keys(((_this$schema = this.schema) === null || _this$schema === void 0 ? void 0 : _this$schema.properties) || {}), this.schema['ui:order']);
@@ -11541,7 +11524,6 @@ var CollapseGroupWidget = Vue.extend({
11541
11524
  layout: layoutConfig,
11542
11525
  removeable: false // todo: 不往下传递可删除属性
11543
11526
  }),
11544
-
11545
11527
  on: _objectSpread2({}, _this.$listeners)
11546
11528
  })])]);
11547
11529
  });