bk-magic-vue 2.5.6 → 2.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bk-magic-vue.css +240 -2
- package/dist/bk-magic-vue.js +1137 -182
- package/dist/bk-magic-vue.min.css +1 -1
- package/dist/bk-magic-vue.min.css.gz +0 -0
- package/dist/bk-magic-vue.min.css.map +1 -1
- package/dist/bk-magic-vue.min.js +1 -1
- package/dist/bk-magic-vue.min.js.gz +0 -0
- package/dist/bk-magic-vue.min.js.map +1 -1
- package/dist/fonts/iconcool.eot +0 -0
- package/dist/fonts/iconcool.svg +27 -0
- package/dist/fonts/iconcool.ttf +0 -0
- package/dist/fonts/iconcool.woff +0 -0
- package/lib/cascade.js +35 -32
- package/lib/locale/lang/en-US.js +5 -1
- package/lib/locale/lang/zh-CN.js +5 -1
- package/lib/message.js +1182 -623
- package/lib/option.js +692 -63
- package/lib/pagination.js +383 -105
- package/lib/search-select.js +1604 -1288
- package/lib/select.js +321 -43
- package/lib/table.js +17 -2
- package/lib/ui/bk-magic-vue.css +240 -2
- package/lib/ui/bk-magic-vue.min.css +1 -1
- package/lib/ui/bk-magic-vue.min.css.gz +0 -0
- package/lib/ui/bk-magic-vue.min.css.map +1 -1
- package/lib/ui/common.css +36 -0
- package/lib/ui/common.min.css +1 -1
- package/lib/ui/common.min.css.map +1 -1
- package/lib/ui/fonts/iconcool.eot +0 -0
- package/lib/ui/fonts/iconcool.svg +27 -0
- package/lib/ui/fonts/iconcool.ttf +0 -0
- package/lib/ui/fonts/iconcool.woff +0 -0
- package/lib/ui/iconfont.css +36 -0
- package/lib/ui/iconfont.min.css +1 -1
- package/lib/ui/iconfont.min.css.map +1 -1
- package/lib/ui/message.css +233 -1
- package/lib/ui/message.min.css +1 -1
- package/lib/ui/message.min.css.map +1 -1
- package/lib/ui/search-select-menu.css +7 -1
- package/lib/ui/search-select-menu.min.css +1 -1
- package/lib/ui/search-select-menu.min.css.map +1 -1
- package/lib/ui/search-select.css +5 -0
- package/lib/ui/search-select.min.css +1 -1
- package/lib/ui/search-select.min.css.map +1 -1
- package/lib/ui/select.css +4 -0
- package/lib/ui/select.min.css +1 -1
- package/lib/ui/select.min.css.map +1 -1
- package/package.json +4 -2
package/lib/option.js
CHANGED
|
@@ -185,63 +185,556 @@
|
|
|
185
185
|
|
|
186
186
|
var isArray$1 = isArray;
|
|
187
187
|
|
|
188
|
+
function _regeneratorRuntime() {
|
|
189
|
+
_regeneratorRuntime = function () {
|
|
190
|
+
return exports;
|
|
191
|
+
};
|
|
192
|
+
var exports = {},
|
|
193
|
+
Op = Object.prototype,
|
|
194
|
+
hasOwn = Op.hasOwnProperty,
|
|
195
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
196
|
+
obj[key] = desc.value;
|
|
197
|
+
},
|
|
198
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
199
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
200
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
201
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
202
|
+
function define(obj, key, value) {
|
|
203
|
+
return Object.defineProperty(obj, key, {
|
|
204
|
+
value: value,
|
|
205
|
+
enumerable: !0,
|
|
206
|
+
configurable: !0,
|
|
207
|
+
writable: !0
|
|
208
|
+
}), obj[key];
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
define({}, "");
|
|
212
|
+
} catch (err) {
|
|
213
|
+
define = function (obj, key, value) {
|
|
214
|
+
return obj[key] = value;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
218
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
219
|
+
generator = Object.create(protoGenerator.prototype),
|
|
220
|
+
context = new Context(tryLocsList || []);
|
|
221
|
+
return defineProperty(generator, "_invoke", {
|
|
222
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
223
|
+
}), generator;
|
|
224
|
+
}
|
|
225
|
+
function tryCatch(fn, obj, arg) {
|
|
226
|
+
try {
|
|
227
|
+
return {
|
|
228
|
+
type: "normal",
|
|
229
|
+
arg: fn.call(obj, arg)
|
|
230
|
+
};
|
|
231
|
+
} catch (err) {
|
|
232
|
+
return {
|
|
233
|
+
type: "throw",
|
|
234
|
+
arg: err
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
exports.wrap = wrap;
|
|
239
|
+
var ContinueSentinel = {};
|
|
240
|
+
function Generator() {}
|
|
241
|
+
function GeneratorFunction() {}
|
|
242
|
+
function GeneratorFunctionPrototype() {}
|
|
243
|
+
var IteratorPrototype = {};
|
|
244
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
245
|
+
return this;
|
|
246
|
+
});
|
|
247
|
+
var getProto = Object.getPrototypeOf,
|
|
248
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
249
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
250
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
251
|
+
function defineIteratorMethods(prototype) {
|
|
252
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
253
|
+
define(prototype, method, function (arg) {
|
|
254
|
+
return this._invoke(method, arg);
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
259
|
+
function invoke(method, arg, resolve, reject) {
|
|
260
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
261
|
+
if ("throw" !== record.type) {
|
|
262
|
+
var result = record.arg,
|
|
263
|
+
value = result.value;
|
|
264
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
265
|
+
invoke("next", value, resolve, reject);
|
|
266
|
+
}, function (err) {
|
|
267
|
+
invoke("throw", err, resolve, reject);
|
|
268
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
269
|
+
result.value = unwrapped, resolve(result);
|
|
270
|
+
}, function (error) {
|
|
271
|
+
return invoke("throw", error, resolve, reject);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
reject(record.arg);
|
|
275
|
+
}
|
|
276
|
+
var previousPromise;
|
|
277
|
+
defineProperty(this, "_invoke", {
|
|
278
|
+
value: function (method, arg) {
|
|
279
|
+
function callInvokeWithMethodAndArg() {
|
|
280
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
281
|
+
invoke(method, arg, resolve, reject);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
289
|
+
var state = "suspendedStart";
|
|
290
|
+
return function (method, arg) {
|
|
291
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
292
|
+
if ("completed" === state) {
|
|
293
|
+
if ("throw" === method) throw arg;
|
|
294
|
+
return doneResult();
|
|
295
|
+
}
|
|
296
|
+
for (context.method = method, context.arg = arg;;) {
|
|
297
|
+
var delegate = context.delegate;
|
|
298
|
+
if (delegate) {
|
|
299
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
300
|
+
if (delegateResult) {
|
|
301
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
302
|
+
return delegateResult;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
306
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
307
|
+
context.dispatchException(context.arg);
|
|
308
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
309
|
+
state = "executing";
|
|
310
|
+
var record = tryCatch(innerFn, self, context);
|
|
311
|
+
if ("normal" === record.type) {
|
|
312
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
313
|
+
return {
|
|
314
|
+
value: record.arg,
|
|
315
|
+
done: context.done
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
323
|
+
var method = delegate.iterator[context.method];
|
|
324
|
+
if (undefined === method) {
|
|
325
|
+
if (context.delegate = null, "throw" === context.method) {
|
|
326
|
+
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
327
|
+
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
328
|
+
}
|
|
329
|
+
return ContinueSentinel;
|
|
330
|
+
}
|
|
331
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
332
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
333
|
+
var info = record.arg;
|
|
334
|
+
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);
|
|
335
|
+
}
|
|
336
|
+
function pushTryEntry(locs) {
|
|
337
|
+
var entry = {
|
|
338
|
+
tryLoc: locs[0]
|
|
339
|
+
};
|
|
340
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
341
|
+
}
|
|
342
|
+
function resetTryEntry(entry) {
|
|
343
|
+
var record = entry.completion || {};
|
|
344
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
345
|
+
}
|
|
346
|
+
function Context(tryLocsList) {
|
|
347
|
+
this.tryEntries = [{
|
|
348
|
+
tryLoc: "root"
|
|
349
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
350
|
+
}
|
|
351
|
+
function values(iterable) {
|
|
352
|
+
if (iterable) {
|
|
353
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
354
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
355
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
356
|
+
if (!isNaN(iterable.length)) {
|
|
357
|
+
var i = -1,
|
|
358
|
+
next = function next() {
|
|
359
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
360
|
+
return next.value = undefined, next.done = !0, next;
|
|
361
|
+
};
|
|
362
|
+
return next.next = next;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
return {
|
|
366
|
+
next: doneResult
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function doneResult() {
|
|
370
|
+
return {
|
|
371
|
+
value: undefined,
|
|
372
|
+
done: !0
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
376
|
+
value: GeneratorFunctionPrototype,
|
|
377
|
+
configurable: !0
|
|
378
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
379
|
+
value: GeneratorFunction,
|
|
380
|
+
configurable: !0
|
|
381
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
382
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
383
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
384
|
+
}, exports.mark = function (genFun) {
|
|
385
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
386
|
+
}, exports.awrap = function (arg) {
|
|
387
|
+
return {
|
|
388
|
+
__await: arg
|
|
389
|
+
};
|
|
390
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
391
|
+
return this;
|
|
392
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
393
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
394
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
395
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
396
|
+
return result.done ? result.value : iter.next();
|
|
397
|
+
});
|
|
398
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
399
|
+
return this;
|
|
400
|
+
}), define(Gp, "toString", function () {
|
|
401
|
+
return "[object Generator]";
|
|
402
|
+
}), exports.keys = function (val) {
|
|
403
|
+
var object = Object(val),
|
|
404
|
+
keys = [];
|
|
405
|
+
for (var key in object) keys.push(key);
|
|
406
|
+
return keys.reverse(), function next() {
|
|
407
|
+
for (; keys.length;) {
|
|
408
|
+
var key = keys.pop();
|
|
409
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
410
|
+
}
|
|
411
|
+
return next.done = !0, next;
|
|
412
|
+
};
|
|
413
|
+
}, exports.values = values, Context.prototype = {
|
|
414
|
+
constructor: Context,
|
|
415
|
+
reset: function (skipTempReset) {
|
|
416
|
+
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);
|
|
417
|
+
},
|
|
418
|
+
stop: function () {
|
|
419
|
+
this.done = !0;
|
|
420
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
421
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
422
|
+
return this.rval;
|
|
423
|
+
},
|
|
424
|
+
dispatchException: function (exception) {
|
|
425
|
+
if (this.done) throw exception;
|
|
426
|
+
var context = this;
|
|
427
|
+
function handle(loc, caught) {
|
|
428
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
429
|
+
}
|
|
430
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
431
|
+
var entry = this.tryEntries[i],
|
|
432
|
+
record = entry.completion;
|
|
433
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
434
|
+
if (entry.tryLoc <= this.prev) {
|
|
435
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
436
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
437
|
+
if (hasCatch && hasFinally) {
|
|
438
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
439
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
440
|
+
} else if (hasCatch) {
|
|
441
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
442
|
+
} else {
|
|
443
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
444
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
},
|
|
449
|
+
abrupt: function (type, arg) {
|
|
450
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
451
|
+
var entry = this.tryEntries[i];
|
|
452
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
453
|
+
var finallyEntry = entry;
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
458
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
459
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
460
|
+
},
|
|
461
|
+
complete: function (record, afterLoc) {
|
|
462
|
+
if ("throw" === record.type) throw record.arg;
|
|
463
|
+
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;
|
|
464
|
+
},
|
|
465
|
+
finish: function (finallyLoc) {
|
|
466
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
467
|
+
var entry = this.tryEntries[i];
|
|
468
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
catch: function (tryLoc) {
|
|
472
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
473
|
+
var entry = this.tryEntries[i];
|
|
474
|
+
if (entry.tryLoc === tryLoc) {
|
|
475
|
+
var record = entry.completion;
|
|
476
|
+
if ("throw" === record.type) {
|
|
477
|
+
var thrown = record.arg;
|
|
478
|
+
resetTryEntry(entry);
|
|
479
|
+
}
|
|
480
|
+
return thrown;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
throw new Error("illegal catch attempt");
|
|
484
|
+
},
|
|
485
|
+
delegateYield: function (iterable, resultName, nextLoc) {
|
|
486
|
+
return this.delegate = {
|
|
487
|
+
iterator: values(iterable),
|
|
488
|
+
resultName: resultName,
|
|
489
|
+
nextLoc: nextLoc
|
|
490
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
491
|
+
}
|
|
492
|
+
}, exports;
|
|
493
|
+
}
|
|
494
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
495
|
+
try {
|
|
496
|
+
var info = gen[key](arg);
|
|
497
|
+
var value = info.value;
|
|
498
|
+
} catch (error) {
|
|
499
|
+
reject(error);
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
if (info.done) {
|
|
503
|
+
resolve(value);
|
|
504
|
+
} else {
|
|
505
|
+
Promise.resolve(value).then(_next, _throw);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
function _asyncToGenerator(fn) {
|
|
509
|
+
return function () {
|
|
510
|
+
var self = this,
|
|
511
|
+
args = arguments;
|
|
512
|
+
return new Promise(function (resolve, reject) {
|
|
513
|
+
var gen = fn.apply(self, args);
|
|
514
|
+
function _next(value) {
|
|
515
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
516
|
+
}
|
|
517
|
+
function _throw(err) {
|
|
518
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
519
|
+
}
|
|
520
|
+
_next(undefined);
|
|
521
|
+
});
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
var emitter = {
|
|
526
|
+
methods: {
|
|
527
|
+
dispatch: function dispatch(componentName, eventName, params) {
|
|
528
|
+
var parent = this.$parent || this.$root;
|
|
529
|
+
var name = parent.$options.name;
|
|
530
|
+
while (parent && (!name || name !== componentName)) {
|
|
531
|
+
parent = parent.$parent;
|
|
532
|
+
if (parent) {
|
|
533
|
+
name = parent.$options.name;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (parent) {
|
|
537
|
+
parent.$emit.apply(parent, [eventName].concat(params));
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
|
|
543
|
+
var checkboxSeed = 0;
|
|
544
|
+
function getCheckboxName() {
|
|
545
|
+
return "bk-checkbox_".concat(checkboxSeed++);
|
|
546
|
+
}
|
|
547
|
+
|
|
188
548
|
var script = {
|
|
189
|
-
name: 'bk-
|
|
549
|
+
name: 'bk-checkbox',
|
|
550
|
+
mixins: [emitter],
|
|
551
|
+
inject: {
|
|
552
|
+
handleRemoveItem: {
|
|
553
|
+
default: null
|
|
554
|
+
},
|
|
555
|
+
handleAddItem: {
|
|
556
|
+
default: null
|
|
557
|
+
}
|
|
558
|
+
},
|
|
190
559
|
props: {
|
|
191
|
-
|
|
192
|
-
type: [String, Number],
|
|
193
|
-
|
|
560
|
+
value: {
|
|
561
|
+
type: [String, Number, Boolean],
|
|
562
|
+
default: undefined
|
|
563
|
+
},
|
|
564
|
+
checked: {
|
|
565
|
+
type: Boolean,
|
|
566
|
+
default: undefined
|
|
567
|
+
},
|
|
568
|
+
trueValue: {
|
|
569
|
+
type: [String, Number, Boolean],
|
|
570
|
+
default: true
|
|
571
|
+
},
|
|
572
|
+
falseValue: {
|
|
573
|
+
type: [String, Number, Boolean],
|
|
574
|
+
default: false
|
|
575
|
+
},
|
|
576
|
+
label: {
|
|
577
|
+
type: [String, Number]
|
|
194
578
|
},
|
|
195
579
|
name: {
|
|
196
|
-
type:
|
|
197
|
-
|
|
580
|
+
type: String,
|
|
581
|
+
default: function _default() {
|
|
582
|
+
return getCheckboxName();
|
|
583
|
+
}
|
|
198
584
|
},
|
|
199
|
-
disabled: Boolean
|
|
585
|
+
disabled: Boolean,
|
|
586
|
+
indeterminate: Boolean,
|
|
587
|
+
extCls: {
|
|
588
|
+
type: String,
|
|
589
|
+
default: ''
|
|
590
|
+
},
|
|
591
|
+
beforeChange: Function
|
|
200
592
|
},
|
|
201
|
-
inject: ['select', 'optionGroup'],
|
|
202
593
|
data: function data() {
|
|
203
594
|
return {
|
|
204
|
-
|
|
205
|
-
|
|
595
|
+
parent: null,
|
|
596
|
+
localValue: undefined
|
|
206
597
|
};
|
|
207
598
|
},
|
|
208
599
|
computed: {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
600
|
+
selected: function selected() {
|
|
601
|
+
return this.localValue === this.localTrueValue;
|
|
602
|
+
},
|
|
603
|
+
parentValue: function parentValue() {
|
|
604
|
+
return this.parent ? this.parent.localValue : null;
|
|
605
|
+
},
|
|
606
|
+
localTrueValue: function localTrueValue() {
|
|
607
|
+
var localValue;
|
|
608
|
+
if (this.parent) {
|
|
609
|
+
if (this.label === undefined && this.value === undefined) {
|
|
610
|
+
localValue = this.trueValue;
|
|
611
|
+
} else if (this.value !== undefined) {
|
|
612
|
+
localValue = this.value;
|
|
613
|
+
} else {
|
|
614
|
+
localValue = this.label;
|
|
615
|
+
}
|
|
616
|
+
} else {
|
|
617
|
+
if (this.label === undefined) {
|
|
618
|
+
localValue = this.trueValue;
|
|
619
|
+
} else {
|
|
620
|
+
localValue = this.label;
|
|
621
|
+
}
|
|
212
622
|
}
|
|
213
|
-
return
|
|
623
|
+
return localValue;
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
watch: {
|
|
627
|
+
value: function value(val) {
|
|
628
|
+
this.setLocalValue(val);
|
|
214
629
|
},
|
|
215
|
-
|
|
216
|
-
|
|
630
|
+
checked: function checked() {
|
|
631
|
+
this.setLocalValue();
|
|
632
|
+
},
|
|
633
|
+
parentValue: function parentValue() {
|
|
634
|
+
this.setLocalValue();
|
|
217
635
|
}
|
|
218
636
|
},
|
|
219
637
|
created: function created() {
|
|
220
|
-
this.
|
|
221
|
-
|
|
222
|
-
this.optionGroup.registerOption(this);
|
|
638
|
+
if (this.handleAddItem && typeof this.handleAddItem === 'function') {
|
|
639
|
+
this.handleAddItem(this);
|
|
223
640
|
}
|
|
641
|
+
this.init();
|
|
224
642
|
},
|
|
225
|
-
|
|
226
|
-
this.
|
|
227
|
-
|
|
228
|
-
this.optionGroup.removeOption(this);
|
|
643
|
+
destroyed: function destroyed() {
|
|
644
|
+
if (this.handleRemoveItem && typeof this.handleRemoveItem === 'function') {
|
|
645
|
+
this.handleRemoveItem(this);
|
|
229
646
|
}
|
|
230
647
|
},
|
|
231
648
|
methods: {
|
|
232
|
-
|
|
233
|
-
if (this.
|
|
234
|
-
return
|
|
649
|
+
getValue: function getValue() {
|
|
650
|
+
if (this.selected) {
|
|
651
|
+
return {
|
|
652
|
+
isChecked: true,
|
|
653
|
+
value: this.localTrueValue
|
|
654
|
+
};
|
|
655
|
+
} else {
|
|
656
|
+
return {
|
|
657
|
+
isChecked: false,
|
|
658
|
+
value: this.falseValue
|
|
659
|
+
};
|
|
235
660
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
661
|
+
},
|
|
662
|
+
init: function init() {
|
|
663
|
+
var parent = this.$parent;
|
|
664
|
+
while (parent && !parent.isCheckboxGroup && !parent.$options.name !== 'bk-checkbox-group') {
|
|
665
|
+
parent = parent.$parent;
|
|
241
666
|
}
|
|
242
|
-
|
|
243
|
-
|
|
667
|
+
this.parent = parent;
|
|
668
|
+
this.setLocalValue();
|
|
669
|
+
},
|
|
670
|
+
setLocalValue: function setLocalValue(val) {
|
|
671
|
+
if (val !== undefined) {
|
|
672
|
+
this.localValue = val;
|
|
673
|
+
return;
|
|
244
674
|
}
|
|
675
|
+
if (this.parent) {
|
|
676
|
+
var trueValue = this.localTrueValue;
|
|
677
|
+
var isSelected = this.parent.localValue.includes(trueValue);
|
|
678
|
+
this.localValue = isSelected ? trueValue : this.falseValue;
|
|
679
|
+
} else {
|
|
680
|
+
if (this.checked !== undefined) {
|
|
681
|
+
this.localValue = this.checked ? this.localTrueValue : this.falseValue;
|
|
682
|
+
} else if (this.value === undefined) {
|
|
683
|
+
this.localValue = this.falseValue;
|
|
684
|
+
} else {
|
|
685
|
+
this.localValue = this.value;
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
handleClick: function handleClick() {
|
|
690
|
+
var _this = this;
|
|
691
|
+
return _asyncToGenerator( _regeneratorRuntime().mark(function _callee() {
|
|
692
|
+
var shouldChange, oldValue, newValue, groupValue;
|
|
693
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
694
|
+
while (1) {
|
|
695
|
+
switch (_context.prev = _context.next) {
|
|
696
|
+
case 0:
|
|
697
|
+
if (!_this.disabled) {
|
|
698
|
+
_context.next = 2;
|
|
699
|
+
break;
|
|
700
|
+
}
|
|
701
|
+
return _context.abrupt("return", false);
|
|
702
|
+
case 2:
|
|
703
|
+
if (!(typeof _this.beforeChange === 'function')) {
|
|
704
|
+
_context.next = 8;
|
|
705
|
+
break;
|
|
706
|
+
}
|
|
707
|
+
_context.next = 5;
|
|
708
|
+
return _this.beforeChange();
|
|
709
|
+
case 5:
|
|
710
|
+
shouldChange = _context.sent;
|
|
711
|
+
if (!(shouldChange === false)) {
|
|
712
|
+
_context.next = 8;
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
return _context.abrupt("return");
|
|
716
|
+
case 8:
|
|
717
|
+
oldValue = _this.localValue;
|
|
718
|
+
if (_this.indeterminate) {
|
|
719
|
+
newValue = _this.localTrueValue;
|
|
720
|
+
} else {
|
|
721
|
+
newValue = oldValue === _this.localTrueValue ? _this.falseValue : _this.localTrueValue;
|
|
722
|
+
}
|
|
723
|
+
_this.localValue = newValue;
|
|
724
|
+
_this.$emit('input', newValue, _this.localTrueValue);
|
|
725
|
+
_this.$emit('change', newValue, oldValue, _this.localTrueValue);
|
|
726
|
+
_this.dispatch('bk-form-item', 'form-change');
|
|
727
|
+
if (_this.parent) {
|
|
728
|
+
groupValue = _this.localTrueValue === undefined ? newValue : _this.localTrueValue;
|
|
729
|
+
_this.parent.handleChange(_this.selected, groupValue);
|
|
730
|
+
}
|
|
731
|
+
case 15:
|
|
732
|
+
case "end":
|
|
733
|
+
return _context.stop();
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}, _callee);
|
|
737
|
+
}))();
|
|
245
738
|
}
|
|
246
739
|
}
|
|
247
740
|
};
|
|
@@ -307,43 +800,44 @@
|
|
|
307
800
|
|
|
308
801
|
/* script */
|
|
309
802
|
var __vue_script__ = script;
|
|
310
|
-
|
|
311
803
|
/* template */
|
|
312
804
|
var __vue_render__ = function __vue_render__() {
|
|
313
805
|
var _vm = this;
|
|
314
806
|
var _h = _vm.$createElement;
|
|
315
807
|
var _c = _vm._self._c || _h;
|
|
316
|
-
return _c('
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
rawName: "v-show",
|
|
320
|
-
value: !_vm.unmatched,
|
|
321
|
-
expression: "!unmatched"
|
|
322
|
-
}],
|
|
323
|
-
staticClass: "bk-option",
|
|
324
|
-
class: {
|
|
325
|
-
'is-selected': _vm.isSelected,
|
|
808
|
+
return _c('label', {
|
|
809
|
+
staticClass: "bk-form-checkbox",
|
|
810
|
+
class: [{
|
|
326
811
|
'is-disabled': _vm.disabled,
|
|
327
|
-
'is-
|
|
328
|
-
|
|
812
|
+
'is-indeterminate': _vm.indeterminate,
|
|
813
|
+
'is-checked': _vm.selected
|
|
814
|
+
}, _vm.extCls],
|
|
329
815
|
on: {
|
|
330
|
-
"click": _vm.
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
attrs: {
|
|
338
|
-
"title": _vm.name
|
|
816
|
+
"click": _vm.handleClick,
|
|
817
|
+
"keydown": function keydown($event) {
|
|
818
|
+
if (!$event.type.indexOf('key') && _vm._k($event.keyCode, "enter", 13, $event.key, "Enter")) {
|
|
819
|
+
return null;
|
|
820
|
+
}
|
|
821
|
+
$event.preventDefault();
|
|
822
|
+
return _vm.handleClick.apply(null, arguments);
|
|
339
823
|
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}
|
|
346
|
-
})
|
|
824
|
+
}
|
|
825
|
+
}, [_c('span', {
|
|
826
|
+
staticClass: "bk-checkbox",
|
|
827
|
+
attrs: {
|
|
828
|
+
"tabindex": _vm.disabled ? false : 0
|
|
829
|
+
}
|
|
830
|
+
}), _c('input', {
|
|
831
|
+
attrs: {
|
|
832
|
+
"type": "hidden",
|
|
833
|
+
"name": _vm.name
|
|
834
|
+
},
|
|
835
|
+
domProps: {
|
|
836
|
+
"value": _vm.label === undefined ? _vm.localValue : _vm.label
|
|
837
|
+
}
|
|
838
|
+
}), _vm.$slots.default ? _c('span', {
|
|
839
|
+
staticClass: "bk-checkbox-text"
|
|
840
|
+
}, [_vm._t("default")], 2) : _vm._e()]);
|
|
347
841
|
};
|
|
348
842
|
var __vue_staticRenderFns__ = [];
|
|
349
843
|
|
|
@@ -502,7 +996,142 @@
|
|
|
502
996
|
|
|
503
997
|
setInstaller(__vue_component__);
|
|
504
998
|
|
|
505
|
-
|
|
999
|
+
var script$1 = {
|
|
1000
|
+
name: 'bk-option',
|
|
1001
|
+
components: {
|
|
1002
|
+
'bk-checkbox': __vue_component__
|
|
1003
|
+
},
|
|
1004
|
+
props: {
|
|
1005
|
+
id: {
|
|
1006
|
+
type: [String, Number],
|
|
1007
|
+
required: true
|
|
1008
|
+
},
|
|
1009
|
+
name: {
|
|
1010
|
+
type: [String, Number],
|
|
1011
|
+
required: true
|
|
1012
|
+
},
|
|
1013
|
+
disabled: Boolean
|
|
1014
|
+
},
|
|
1015
|
+
inject: ['select', 'optionGroup'],
|
|
1016
|
+
data: function data() {
|
|
1017
|
+
return {
|
|
1018
|
+
unmatched: false,
|
|
1019
|
+
isHighlight: false
|
|
1020
|
+
};
|
|
1021
|
+
},
|
|
1022
|
+
computed: {
|
|
1023
|
+
isSelected: function isSelected() {
|
|
1024
|
+
if (this.select.multiple && isArray$1(this.select.selected)) {
|
|
1025
|
+
return this.select.selected.includes(this.id);
|
|
1026
|
+
}
|
|
1027
|
+
return this.select.selected === this.id;
|
|
1028
|
+
},
|
|
1029
|
+
lowerName: function lowerName() {
|
|
1030
|
+
return String(this.name).toLowerCase();
|
|
1031
|
+
},
|
|
1032
|
+
selectedStyle: function selectedStyle() {
|
|
1033
|
+
return this.select.selectedStyle;
|
|
1034
|
+
}
|
|
1035
|
+
},
|
|
1036
|
+
created: function created() {
|
|
1037
|
+
this.select.registerOption(this);
|
|
1038
|
+
if (this.optionGroup) {
|
|
1039
|
+
this.optionGroup.registerOption(this);
|
|
1040
|
+
}
|
|
1041
|
+
},
|
|
1042
|
+
beforeDestroy: function beforeDestroy() {
|
|
1043
|
+
this.select.removeOption(this);
|
|
1044
|
+
if (this.optionGroup) {
|
|
1045
|
+
this.optionGroup.removeOption(this);
|
|
1046
|
+
}
|
|
1047
|
+
},
|
|
1048
|
+
methods: {
|
|
1049
|
+
handleOptionClick: function handleOptionClick() {
|
|
1050
|
+
if (this.disabled) {
|
|
1051
|
+
return false;
|
|
1052
|
+
}
|
|
1053
|
+
var select = this.select;
|
|
1054
|
+
if (this.isSelected && select.multiple) {
|
|
1055
|
+
select.unselectOption(this);
|
|
1056
|
+
} else if (!this.isSelected) {
|
|
1057
|
+
select.selectOption(this);
|
|
1058
|
+
}
|
|
1059
|
+
if (!select.multiple) {
|
|
1060
|
+
select.close();
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
/* script */
|
|
1067
|
+
var __vue_script__$1 = script$1;
|
|
1068
|
+
|
|
1069
|
+
/* template */
|
|
1070
|
+
var __vue_render__$1 = function __vue_render__() {
|
|
1071
|
+
var _vm = this;
|
|
1072
|
+
var _h = _vm.$createElement;
|
|
1073
|
+
var _c = _vm._self._c || _h;
|
|
1074
|
+
return _c('li', {
|
|
1075
|
+
directives: [{
|
|
1076
|
+
name: "show",
|
|
1077
|
+
rawName: "v-show",
|
|
1078
|
+
value: !_vm.unmatched,
|
|
1079
|
+
expression: "!unmatched"
|
|
1080
|
+
}],
|
|
1081
|
+
staticClass: "bk-option",
|
|
1082
|
+
class: {
|
|
1083
|
+
'is-selected': _vm.isSelected,
|
|
1084
|
+
'is-disabled': _vm.disabled,
|
|
1085
|
+
'is-highlight': _vm.isHighlight
|
|
1086
|
+
},
|
|
1087
|
+
on: {
|
|
1088
|
+
"click": _vm.handleOptionClick
|
|
1089
|
+
}
|
|
1090
|
+
}, [_c('div', {
|
|
1091
|
+
staticClass: "bk-option-content"
|
|
1092
|
+
}, [_vm._t("default", function () {
|
|
1093
|
+
return [_c('div', {
|
|
1094
|
+
staticClass: "bk-option-content-default",
|
|
1095
|
+
attrs: {
|
|
1096
|
+
"title": _vm.name
|
|
1097
|
+
}
|
|
1098
|
+
}, [_vm.selectedStyle === 'checkbox' && _vm.select.multiple ? [_c('bk-checkbox', {
|
|
1099
|
+
staticClass: "bk-option-checkbox",
|
|
1100
|
+
attrs: {
|
|
1101
|
+
"value": _vm.isSelected
|
|
1102
|
+
}
|
|
1103
|
+
}, [_vm._v(_vm._s(_vm.name))])] : [_vm.select.multiple && _vm.isSelected ? _c('i', {
|
|
1104
|
+
staticClass: "bk-option-icon bk-icon icon-check-1"
|
|
1105
|
+
}) : _vm._e(), _c('span', {
|
|
1106
|
+
staticClass: "bk-option-name",
|
|
1107
|
+
class: _vm.select.fontSizeCls
|
|
1108
|
+
}, [_vm._v("\n " + _vm._s(_vm.name) + "\n ")])]], 2)];
|
|
1109
|
+
})], 2)]);
|
|
1110
|
+
};
|
|
1111
|
+
var __vue_staticRenderFns__$1 = [];
|
|
1112
|
+
|
|
1113
|
+
/* style */
|
|
1114
|
+
var __vue_inject_styles__$1 = undefined;
|
|
1115
|
+
/* scoped */
|
|
1116
|
+
var __vue_scope_id__$1 = undefined;
|
|
1117
|
+
/* module identifier */
|
|
1118
|
+
var __vue_module_identifier__$1 = undefined;
|
|
1119
|
+
/* functional template */
|
|
1120
|
+
var __vue_is_functional_template__$1 = false;
|
|
1121
|
+
/* style inject */
|
|
1122
|
+
|
|
1123
|
+
/* style inject SSR */
|
|
1124
|
+
|
|
1125
|
+
/* style inject shadow dom */
|
|
1126
|
+
|
|
1127
|
+
var __vue_component__$1 = /*#__PURE__*/normalizeComponent_1({
|
|
1128
|
+
render: __vue_render__$1,
|
|
1129
|
+
staticRenderFns: __vue_staticRenderFns__$1
|
|
1130
|
+
}, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
|
|
1131
|
+
|
|
1132
|
+
setInstaller(__vue_component__$1);
|
|
1133
|
+
|
|
1134
|
+
exports.default = __vue_component__$1;
|
|
506
1135
|
|
|
507
1136
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
508
1137
|
|