bkui-vue 0.0.1-beta.161 → 0.0.1-beta.164

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/index.esm.js CHANGED
@@ -9932,7 +9932,7 @@ const collapseMotion$1 = (emit) => ({
9932
9932
  emit("after-leave");
9933
9933
  }
9934
9934
  });
9935
- function _isSlot$8(s2) {
9935
+ function _isSlot$7(s2) {
9936
9936
  return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
9937
9937
  }
9938
9938
  var CollapsePanel = defineComponent({
@@ -10027,7 +10027,7 @@ var CollapsePanel = defineComponent({
10027
10027
  "class": `bk-collapse-item ${props2.disabled ? "is-disabled" : ""} ${isActive.value ? "bk-collapse-item-active" : ""}`
10028
10028
  }, [createVNode("div", {
10029
10029
  "onClick": () => clickItem(props2)
10030
- }, [renderHeader()]), createVNode(Transition, transition.value, _isSlot$8(_slot = renderPanel()) ? _slot : {
10030
+ }, [renderHeader()]), createVNode(Transition, transition.value, _isSlot$7(_slot = renderPanel()) ? _slot : {
10031
10031
  default: () => [_slot]
10032
10032
  })]);
10033
10033
  };
@@ -10271,7 +10271,7 @@ const props = __spreadProps(__spreadValues({}, propsMixin$1), {
10271
10271
  dialogType: PropTypes.commonType(["show", "operation", "confirm", "process"], "dialogType").def("operation"),
10272
10272
  isLoading: PropTypes.bool.def(false)
10273
10273
  });
10274
- function _isSlot$7(s2) {
10274
+ function _isSlot$6(s2) {
10275
10275
  return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
10276
10276
  }
10277
10277
  var Dialog = defineComponent({
@@ -10478,7 +10478,7 @@ var Dialog = defineComponent({
10478
10478
  "class": className,
10479
10479
  "style": this.data.moveStyle,
10480
10480
  "onQuickClose": this.handleQuickClose
10481
- }), _isSlot$7(dialogSlot) ? dialogSlot : {
10481
+ }), _isSlot$6(dialogSlot) ? dialogSlot : {
10482
10482
  default: () => [dialogSlot]
10483
10483
  });
10484
10484
  }
@@ -13291,7 +13291,7 @@ const Line = (_2, {
13291
13291
  "style": titleStyle
13292
13292
  }, [showDefault()])])]), showDefault(false)]);
13293
13293
  };
13294
- function _isSlot$6(s2) {
13294
+ function _isSlot$5(s2) {
13295
13295
  return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
13296
13296
  }
13297
13297
  var Component$o = defineComponent({
@@ -13356,11 +13356,11 @@ var Component$o = defineComponent({
13356
13356
  const $props = __spreadProps(__spreadValues({}, this.$props), {
13357
13357
  percent: this.validPercent(this.percent)
13358
13358
  });
13359
- let progress2 = createVNode(Line, $props, _isSlot$6(progressInfo) ? progressInfo : {
13359
+ let progress2 = createVNode(Line, $props, _isSlot$5(progressInfo) ? progressInfo : {
13360
13360
  default: () => [progressInfo]
13361
13361
  });
13362
13362
  if (this.type === "circle" || this.type === "dashboard") {
13363
- progress2 = createVNode(Circle, $props, _isSlot$6(progressInfo) ? progressInfo : {
13363
+ progress2 = createVNode(Circle, $props, _isSlot$5(progressInfo) ? progressInfo : {
13364
13364
  default: () => [progressInfo]
13365
13365
  });
13366
13366
  }
@@ -13972,7 +13972,7 @@ function useRegistry(data2) {
13972
13972
  unregister
13973
13973
  };
13974
13974
  }
13975
- function useDebouncedRef(value, delay = 200) {
13975
+ function useDebouncedRef(value, delay = 300) {
13976
13976
  let timeout;
13977
13977
  let innerValue = value;
13978
13978
  return customRef((track, trigger) => ({
@@ -14208,153 +14208,444 @@ var OptionGroup = defineComponent({
14208
14208
  }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), [[vShow, !this.groupCollapse]])]), [[vShow, this.visible]]);
14209
14209
  }
14210
14210
  });
14211
- var Component$k = defineComponent({
14212
- name: "Tag",
14213
- props: {
14214
- theme: PropTypes.theme(["success", "info", "warning", "danger"]).def(""),
14215
- closable: PropTypes.bool.def(false),
14216
- type: PropTypes.commonType(["", "filled", "stroke"]).def(""),
14217
- checkable: PropTypes.bool.def(false),
14218
- checked: PropTypes.bool.def(false),
14219
- radius: PropTypes.string.def("2px"),
14220
- extCls: PropTypes.string.def("")
14211
+ const EventProps = {
14212
+ onContentScroll: Function
14213
+ };
14214
+ const virtualRenderProps = __spreadValues({
14215
+ list: PropTypes.array.def([]),
14216
+ enabled: PropTypes.bool.def(true),
14217
+ scrollEvent: PropTypes.bool.def(false),
14218
+ lineHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]).def(30),
14219
+ minHeight: PropTypes.number.def(30),
14220
+ height: PropTypes.oneOfType([PropTypes.string.def("100%"), PropTypes.number]).def("100%"),
14221
+ width: PropTypes.oneOfType([PropTypes.string.def("100%"), PropTypes.number]).def("100%"),
14222
+ className: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.object, PropTypes.arrayOf(PropTypes.object), PropTypes.string]).def(""),
14223
+ contentClassName: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.object, PropTypes.arrayOf(PropTypes.object), PropTypes.string]).def(""),
14224
+ contentStyle: PropTypes.object.def({}),
14225
+ scrollXName: PropTypes.string.def(resolveClassName("F-scroll-x")),
14226
+ scrollYName: PropTypes.string.def(resolveClassName("F-scroll-y")),
14227
+ groupItemCount: PropTypes.number.def(1),
14228
+ preloadItemCount: PropTypes.number.def(1),
14229
+ renderAs: PropTypes.string.def("div"),
14230
+ contentAs: PropTypes.string.def("div"),
14231
+ scrollOffsetTop: PropTypes.number.def(0),
14232
+ scrollPosition: PropTypes.string.def("content"),
14233
+ abosuteHeight: PropTypes.oneOfType([PropTypes.string.def("auto"), PropTypes.number]).def("auto"),
14234
+ throttleDelay: PropTypes.number.def(60)
14235
+ }, EventProps);
14236
+ var useTagRender = (props2, ctx) => {
14237
+ const {
14238
+ renderAs,
14239
+ contentAs
14240
+ } = props2;
14241
+ const handleScrollCallback = (event, _startIndex, _endIndex, _scrollTop, translateY, scrollLeft, pos) => {
14242
+ ctx.emit("content-scroll", [event, {
14243
+ translateY,
14244
+ translateX: scrollLeft,
14245
+ pos
14246
+ }]);
14247
+ };
14248
+ const vVirtualRender = resolveDirective("bkVirtualRender");
14249
+ const dirModifier = {
14250
+ lineHeight: props2.lineHeight,
14251
+ handleScrollCallback,
14252
+ pagination: {},
14253
+ throttleDelay: props2.throttleDelay,
14254
+ onlyScroll: props2.scrollEvent
14255
+ };
14256
+ return {
14257
+ rendAsTag: () => {
14258
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
14259
+ return h$1(renderAs, {
14260
+ class: props2.className
14261
+ }, [(_c = (_b = (_a = ctx.slots).beforeContent) == null ? void 0 : _b.call(_a)) != null ? _c : "", withDirectives(h$1(contentAs, {
14262
+ class: props2.contentClassName,
14263
+ style: props2.contentStyle
14264
+ }, [(_f = (_e = (_d = ctx.slots).default) == null ? void 0 : _e.call(_d, {
14265
+ data: props2.list
14266
+ })) != null ? _f : ""]), [[vVirtualRender, dirModifier]]), (_i = (_h = (_g = ctx.slots).afterContent) == null ? void 0 : _h.call(_g)) != null ? _i : "", (_l = (_k = (_j = ctx.slots).afterSection) == null ? void 0 : _k.call(_j)) != null ? _l : ""]);
14267
+ }
14268
+ };
14269
+ };
14270
+ function getMatchedIndex(maxCount, maxHeight, groupItemCount, callback) {
14271
+ let startIndex = 0;
14272
+ let height = 0;
14273
+ let diffHeight = 0;
14274
+ let lastHeight = 0;
14275
+ for (; startIndex < maxCount; startIndex++) {
14276
+ lastHeight = callback(startIndex, [startIndex * groupItemCount, (startIndex + 1) * groupItemCount, "virtual"]);
14277
+ if (height + lastHeight > maxHeight) {
14278
+ diffHeight = maxHeight - height;
14279
+ break;
14280
+ }
14281
+ height += lastHeight;
14282
+ }
14283
+ return { startIndex, height, diffHeight };
14284
+ }
14285
+ function computedVirtualIndex(lineHeight, callback, pagination2, el, event) {
14286
+ if (!el) {
14287
+ return;
14288
+ }
14289
+ const elScrollTop = el.scrollTop;
14290
+ const elScrollLeft = el.scrollLeft;
14291
+ const { scrollTop: scrollTop2, count, groupItemCount, startIndex, endIndex } = pagination2;
14292
+ const { offsetHeight } = el;
14293
+ let targetStartIndex = 0;
14294
+ let targetEndIndex = 0;
14295
+ let translateY = 0;
14296
+ if (typeof lineHeight === "number") {
14297
+ targetStartIndex = Math.floor(elScrollTop / lineHeight);
14298
+ targetEndIndex = Math.ceil(offsetHeight / lineHeight) + targetStartIndex;
14299
+ translateY = elScrollTop % lineHeight;
14300
+ }
14301
+ if (typeof lineHeight === "function") {
14302
+ const startValue = getMatchedIndex(count, elScrollTop, groupItemCount, lineHeight);
14303
+ targetStartIndex = startValue.startIndex > 0 ? startValue.startIndex : 0;
14304
+ translateY = startValue.diffHeight;
14305
+ const endValue = getMatchedIndex(count, offsetHeight, groupItemCount, lineHeight);
14306
+ targetEndIndex = endValue.startIndex + targetStartIndex + 1;
14307
+ }
14308
+ if (elScrollTop !== scrollTop2 || targetStartIndex !== startIndex || targetEndIndex !== endIndex) {
14309
+ const bottom2 = el.scrollHeight - el.offsetHeight - el.scrollTop;
14310
+ typeof callback === "function" && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, { bottom: bottom2 >= 0 ? bottom2 : 0 });
14311
+ }
14312
+ }
14313
+ function visibleRender(e, wrapper, binding) {
14314
+ const { lineHeight = 30, handleScrollCallback, pagination: pagination2 = {}, onlyScroll } = binding.value;
14315
+ if (onlyScroll) {
14316
+ const elScrollTop = wrapper.scrollTop;
14317
+ const elScrollLeft = wrapper.scrollLeft;
14318
+ const bottom2 = wrapper.scrollHeight - wrapper.offsetHeight - wrapper.scrollTop;
14319
+ handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, { bottom: bottom2 >= 0 ? bottom2 : 0 });
14320
+ return;
14321
+ }
14322
+ const { startIndex, endIndex, groupItemCount, count, scrollTop: scrollTop2 } = pagination2;
14323
+ computedVirtualIndex(lineHeight, handleScrollCallback, { scrollTop: scrollTop2, startIndex, endIndex, groupItemCount, count }, wrapper, e);
14324
+ }
14325
+ const throttledRender = (delay = 60) => lodash.exports.throttle((e, wrapper, binding) => visibleRender(e, wrapper, binding), delay);
14326
+ const executeThrottledRender = (e, wrapper, binding, delay = 60) => {
14327
+ Reflect.apply(throttledRender(delay), globalThis, [e, wrapper, binding]);
14328
+ };
14329
+ var virtualRender = {
14330
+ mounted(el, binding) {
14331
+ const wrapper = el.parentNode;
14332
+ const { throttleDelay } = binding.value;
14333
+ wrapper.addEventListener("scroll", (e) => {
14334
+ executeThrottledRender(e, wrapper, binding, throttleDelay);
14335
+ });
14221
14336
  },
14222
- emits: ["change", "close"],
14223
- slots: ["icon"],
14224
- setup(props2, {
14225
- emit
14226
- }) {
14227
- const wrapperCls = computed(() => classes({
14228
- "bk-tag-closable": props2.closable,
14229
- "bk-tag-checkable": props2.checkable,
14230
- "bk-tag-check": props2.checked,
14231
- [`bk-tag-${props2.type}`]: props2.type,
14232
- [`bk-tag-${props2.theme}`]: props2.theme,
14233
- [props2.extCls]: !!props2.extCls
14234
- }, "bk-tag"));
14235
- const wrapperStyle = computed(() => ({
14236
- borderRadius: props2.radius
14237
- }));
14238
- const handleClose = (e) => {
14239
- e.preventDefault();
14240
- e.stopPropagation();
14241
- emit("close", e);
14242
- };
14243
- const handleClick = (e) => {
14244
- e.preventDefault();
14245
- e.stopPropagation();
14246
- if (props2.checkable) {
14247
- emit("change", !props2.checked);
14337
+ unbind(el) {
14338
+ if (el) {
14339
+ const wrapper = el.parentNode;
14340
+ if (!wrapper) {
14341
+ return;
14248
14342
  }
14249
- };
14250
- return {
14251
- wrapperCls,
14252
- wrapperStyle,
14253
- handleClose,
14254
- handleClick
14255
- };
14256
- },
14257
- render() {
14258
- var _a, _b;
14259
- return createVNode("div", {
14260
- "class": this.wrapperCls,
14261
- "style": this.wrapperStyle,
14262
- "onClick": this.handleClick
14263
- }, [this.$slots.icon ? createVNode("span", {
14264
- "class": "bk-tag-icon"
14265
- }, [this.$slots.icon()]) : "", createVNode("span", {
14266
- "class": "bk-tag-text"
14267
- }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), this.closable ? createVNode(error, {
14268
- "class": "bk-tag-close",
14269
- "onClick": this.handleClose
14270
- }, null) : ""]);
14343
+ wrapper.removeEventListener("scroll", throttledRender);
14344
+ }
14271
14345
  }
14272
- });
14273
- const BkTag = withInstall(Component$k);
14274
- function _isSlot$5(s2) {
14275
- return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
14276
- }
14277
- var SelectTagInput = defineComponent({
14278
- name: "SelectTagInput",
14279
- props: {
14280
- selected: {
14281
- type: Array,
14282
- default: () => []
14283
- },
14284
- tagTheme: PropTypes.theme(["success", "info", "warning", "danger"]).def(""),
14285
- placeholder: PropTypes.string.def(""),
14286
- filterable: PropTypes.bool.def(false),
14287
- allowCreate: PropTypes.bool.def(false),
14288
- modelValue: PropTypes.any
14346
+ };
14347
+ var Component$k = defineComponent({
14348
+ name: "VirtualRender",
14349
+ directives: {
14350
+ bkVirtualRender: virtualRender
14289
14351
  },
14290
- emits: ["update:modelValue", "remove", "enter"],
14291
- setup(props2, {
14292
- emit
14293
- }) {
14294
- const select2 = inject(selectKey, null);
14352
+ props: virtualRenderProps,
14353
+ emits: ["content-scroll"],
14354
+ setup(props2, ctx) {
14295
14355
  const {
14296
- modelValue
14297
- } = toRefs(props2);
14298
- const value = ref(modelValue.value);
14299
- const inputRef = ref();
14300
- watch(modelValue, () => {
14301
- value.value = modelValue.value;
14302
- });
14303
- const handleRemoveTag = (val) => {
14304
- emit("remove", val);
14305
- };
14306
- const focus = () => {
14307
- var _a;
14308
- (_a = inputRef.value) == null ? void 0 : _a.focus();
14309
- };
14310
- const handleInput = (e) => {
14311
- emit("update:modelValue", e.target.value);
14312
- };
14313
- const handleKeydown = (e) => {
14314
- switch (e.code) {
14315
- case "Enter": {
14316
- emit("enter", e.target.value, e);
14317
- break;
14318
- }
14356
+ renderAs,
14357
+ contentAs
14358
+ } = props2;
14359
+ const resolvePropClassName = (prop) => {
14360
+ if (typeof prop === "string") {
14361
+ return [prop];
14319
14362
  }
14320
- };
14321
- const handleGetLabelByValue = select2 == null ? void 0 : select2.handleGetLabelByValue;
14322
- return {
14323
- value,
14363
+ if (typeof prop === "object" && !Array.isArray(prop)) {
14364
+ return [prop];
14365
+ }
14366
+ return prop;
14367
+ };
14368
+ if (!props2.enabled) {
14369
+ const {
14370
+ rendAsTag
14371
+ } = useTagRender(props2, ctx);
14372
+ return rendAsTag;
14373
+ }
14374
+ const refRoot = ref(null);
14375
+ const pagination2 = reactive({
14376
+ startIndex: 0,
14377
+ endIndex: 0,
14378
+ scrollTop: 1,
14379
+ translateY: 0,
14380
+ translateX: 0,
14381
+ count: 0,
14382
+ pos: {},
14383
+ groupItemCount: props2.groupItemCount
14384
+ });
14385
+ const handleScrollCallback = (event, startIndex, endIndex, scrollTop2, translateY, scrollLeft, pos) => {
14386
+ pagination2.startIndex = startIndex;
14387
+ pagination2.endIndex = endIndex;
14388
+ pagination2.scrollTop = scrollTop2;
14389
+ pagination2.translateY = translateY;
14390
+ pagination2.translateX = scrollLeft;
14391
+ pagination2.pos = pos;
14392
+ ctx.emit("content-scroll", [event, pagination2]);
14393
+ };
14394
+ onMounted(() => {
14395
+ nextTick(() => {
14396
+ handleListChanged(props2.list);
14397
+ afterListDataReset();
14398
+ });
14399
+ });
14400
+ watch(() => props2.list, () => {
14401
+ handleChangeListConfig();
14402
+ afterListDataReset();
14403
+ }, {
14404
+ deep: true
14405
+ });
14406
+ watch(() => props2.lineHeight, () => {
14407
+ handleChangeListConfig();
14408
+ afterListDataReset();
14409
+ });
14410
+ const handleChangeListConfig = () => {
14411
+ handleListChanged(props2.list);
14412
+ };
14413
+ const listLength = ref(0);
14414
+ const innerHeight = ref(0);
14415
+ const handleListChanged = (list) => {
14416
+ listLength.value = Math.ceil((list || []).length / props2.groupItemCount);
14417
+ pagination2.count = listLength.value;
14418
+ pagination2.startIndex = 0;
14419
+ pagination2.endIndex = 0;
14420
+ pagination2.translateY = 0;
14421
+ pagination2.scrollTop = 0;
14422
+ const isAuto = typeof props2.abosuteHeight === "string" && props2.abosuteHeight === "auto";
14423
+ if (isAuto) {
14424
+ if (typeof props2.lineHeight === "function") {
14425
+ innerHeight.value = 0;
14426
+ let fnValue = 0;
14427
+ for (let i2 = 0; i2 < listLength.value; i2++) {
14428
+ const fnVal = props2.lineHeight.call(this, i2, list.slice(i2 * props2.groupItemCount, props2.groupItemCount));
14429
+ fnValue += typeof fnVal === "number" ? fnVal : 0;
14430
+ }
14431
+ innerHeight.value = fnValue;
14432
+ } else {
14433
+ innerHeight.value = props2.lineHeight * listLength.value;
14434
+ }
14435
+ } else {
14436
+ innerHeight.value = props2.abosuteHeight;
14437
+ }
14438
+ };
14439
+ const afterListDataReset = (scrollTop2 = true) => {
14440
+ var _a;
14441
+ const el = (_a = refRoot.value) == null ? void 0 : _a.parentNode;
14442
+ computedVirtualIndex(props2.lineHeight, handleScrollCallback, pagination2, el, null);
14443
+ if (scrollTop2 && refRoot.value) {
14444
+ refRoot.value.scrollTo(0, 0);
14445
+ }
14446
+ };
14447
+ const localList = computed(() => (props2.list || []).map((item, index) => __spreadProps(__spreadValues({}, item), {
14448
+ $index: index
14449
+ })));
14450
+ const calcList = computed(() => localList.value.slice(pagination2.startIndex * props2.groupItemCount, (pagination2.endIndex + props2.preloadItemCount) * props2.groupItemCount));
14451
+ const innerContentStyle = computed(() => props2.scrollPosition === "content" ? {
14452
+ top: `${pagination2.scrollTop + props2.scrollOffsetTop}px`,
14453
+ transform: `translateY(-${pagination2.translateY}px)`
14454
+ } : {});
14455
+ const wrapperStyle = computed(() => __spreadValues({
14456
+ height: typeof props2.height === "number" ? `${props2.height}px` : props2.height,
14457
+ width: typeof props2.width === "number" ? `${props2.width}px` : props2.width,
14458
+ display: "inline-block"
14459
+ }, props2.scrollPosition === "container" ? innerContentStyle.value : {}));
14460
+ const innerStyle = computed(() => {
14461
+ const isHidden = typeof props2.abosuteHeight === "number" && props2.abosuteHeight === 0;
14462
+ return {
14463
+ height: `${innerHeight.value < props2.minHeight ? props2.minHeight : innerHeight.value}px`,
14464
+ display: isHidden ? "none" : "block"
14465
+ };
14466
+ });
14467
+ const wrapperClass = computed(() => [resolveClassName("virtual-render"), props2.scrollXName, props2.scrollYName, ...resolvePropClassName(props2.className), props2.scrollPosition === "container" ? resolveClassName("virtual-content") : ""]);
14468
+ const innerClass = computed(() => [props2.scrollPosition === "content" ? resolveClassName("virtual-content") : "", ...resolvePropClassName(props2.contentClassName)]);
14469
+ const vVirtualRender = resolveDirective("bkVirtualRender");
14470
+ const dirModifier = {
14471
+ lineHeight: props2.lineHeight,
14472
+ handleScrollCallback,
14473
+ pagination: pagination2,
14474
+ throttleDelay: props2.throttleDelay
14475
+ };
14476
+ const reset2 = () => {
14477
+ handleChangeListConfig();
14478
+ afterListDataReset();
14479
+ };
14480
+ ctx.expose({
14481
+ reset: reset2
14482
+ });
14483
+ return () => {
14484
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
14485
+ return h$1(renderAs || "div", {
14486
+ ref: refRoot,
14487
+ class: wrapperClass.value,
14488
+ style: wrapperStyle.value
14489
+ }, [(_c = (_b = (_a = ctx.slots).beforeContent) == null ? void 0 : _b.call(_a)) != null ? _c : "", withDirectives(h$1(contentAs || "div", {
14490
+ class: innerClass.value,
14491
+ style: __spreadValues(__spreadValues({}, innerContentStyle.value), props2.contentStyle)
14492
+ }, [(_f = (_e = (_d = ctx.slots).default) == null ? void 0 : _e.call(_d, {
14493
+ data: calcList.value
14494
+ })) != null ? _f : ""]), [[vVirtualRender, dirModifier]]), (_i = (_h = (_g = ctx.slots).afterContent) == null ? void 0 : _h.call(_g)) != null ? _i : "", h$1("div", {
14495
+ class: [resolveClassName("virtual-section")],
14496
+ style: innerStyle.value
14497
+ }), (_l = (_k = (_j = ctx.slots).afterSection) == null ? void 0 : _k.call(_j)) != null ? _l : ""]);
14498
+ };
14499
+ }
14500
+ });
14501
+ const BkVirtualRender = withInstall(Component$k);
14502
+ var Component$j = defineComponent({
14503
+ name: "Tag",
14504
+ props: {
14505
+ theme: PropTypes.theme(["success", "info", "warning", "danger"]).def(""),
14506
+ closable: PropTypes.bool.def(false),
14507
+ type: PropTypes.commonType(["", "filled", "stroke"]).def(""),
14508
+ checkable: PropTypes.bool.def(false),
14509
+ checked: PropTypes.bool.def(false),
14510
+ radius: PropTypes.string.def("2px"),
14511
+ extCls: PropTypes.string.def("")
14512
+ },
14513
+ emits: ["change", "close"],
14514
+ slots: ["icon"],
14515
+ setup(props2, {
14516
+ emit
14517
+ }) {
14518
+ const wrapperCls = computed(() => classes({
14519
+ "bk-tag-closable": props2.closable,
14520
+ "bk-tag-checkable": props2.checkable,
14521
+ "bk-tag-check": props2.checked,
14522
+ [`bk-tag-${props2.type}`]: props2.type,
14523
+ [`bk-tag-${props2.theme}`]: props2.theme,
14524
+ [props2.extCls]: !!props2.extCls
14525
+ }, "bk-tag"));
14526
+ const wrapperStyle = computed(() => ({
14527
+ borderRadius: props2.radius
14528
+ }));
14529
+ const handleClose = (e) => {
14530
+ e.preventDefault();
14531
+ e.stopPropagation();
14532
+ emit("close", e);
14533
+ };
14534
+ const handleClick = (e) => {
14535
+ e.preventDefault();
14536
+ e.stopPropagation();
14537
+ if (props2.checkable) {
14538
+ emit("change", !props2.checked);
14539
+ }
14540
+ };
14541
+ return {
14542
+ wrapperCls,
14543
+ wrapperStyle,
14544
+ handleClose,
14545
+ handleClick
14546
+ };
14547
+ },
14548
+ render() {
14549
+ var _a, _b;
14550
+ return createVNode("div", {
14551
+ "class": this.wrapperCls,
14552
+ "style": this.wrapperStyle,
14553
+ "onClick": this.handleClick
14554
+ }, [this.$slots.icon ? createVNode("span", {
14555
+ "class": "bk-tag-icon"
14556
+ }, [this.$slots.icon()]) : "", createVNode("span", {
14557
+ "class": "bk-tag-text"
14558
+ }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), this.closable ? createVNode(error, {
14559
+ "class": "bk-tag-close",
14560
+ "onClick": this.handleClose
14561
+ }, null) : ""]);
14562
+ }
14563
+ });
14564
+ const BkTag = withInstall(Component$j);
14565
+ var SelectTagInput = defineComponent({
14566
+ name: "SelectTagInput",
14567
+ props: {
14568
+ selected: {
14569
+ type: Array,
14570
+ default: () => []
14571
+ },
14572
+ tagTheme: PropTypes.theme(["success", "info", "warning", "danger"]).def(""),
14573
+ placeholder: PropTypes.string.def(""),
14574
+ filterable: PropTypes.bool.def(false),
14575
+ allowCreate: PropTypes.bool.def(false),
14576
+ disabled: PropTypes.bool.def(false),
14577
+ modelValue: PropTypes.any
14578
+ },
14579
+ emits: ["update:modelValue", "remove", "enter"],
14580
+ setup(props2, {
14581
+ emit
14582
+ }) {
14583
+ const {
14584
+ modelValue,
14585
+ disabled
14586
+ } = toRefs(props2);
14587
+ const value = ref(modelValue.value);
14588
+ const inputRef = ref();
14589
+ watch(modelValue, () => {
14590
+ value.value = modelValue.value;
14591
+ });
14592
+ const handleRemoveTag = (val) => {
14593
+ if (disabled.value)
14594
+ return;
14595
+ emit("remove", val);
14596
+ };
14597
+ const focus = () => {
14598
+ var _a;
14599
+ (_a = inputRef.value) == null ? void 0 : _a.focus();
14600
+ };
14601
+ const handleInput = (e) => {
14602
+ emit("update:modelValue", e.target.value);
14603
+ };
14604
+ const handleKeydown = (e) => {
14605
+ switch (e.code) {
14606
+ case "Enter": {
14607
+ emit("enter", e.target.value, e);
14608
+ break;
14609
+ }
14610
+ }
14611
+ };
14612
+ return {
14613
+ value,
14324
14614
  inputRef,
14325
14615
  handleRemoveTag,
14326
14616
  focus,
14327
14617
  handleInput,
14328
- handleKeydown,
14329
- handleGetLabelByValue
14618
+ handleKeydown
14330
14619
  };
14331
14620
  },
14332
14621
  render() {
14333
14622
  var _a, _b, _c, _d;
14623
+ const tagClass = classes({
14624
+ "bk-select-tag": true,
14625
+ "is-disabled": this.disabled
14626
+ });
14334
14627
  return createVNode("div", {
14335
- "class": "bk-select-tag"
14336
- }, [(_b = (_a = this.$slots) == null ? void 0 : _a.prefix) == null ? void 0 : _b.call(_a), this.selected.map((item) => {
14337
- let _slot;
14338
- return createVNode(BkTag, {
14339
- "closable": true,
14340
- "theme": this.tagTheme,
14341
- "onClose": () => this.handleRemoveTag(item.value)
14342
- }, _isSlot$5(_slot = this.handleGetLabelByValue(item)) ? _slot : {
14343
- default: () => [_slot]
14344
- });
14345
- }), createVNode("input", {
14628
+ "class": tagClass
14629
+ }, [(_b = (_a = this.$slots) == null ? void 0 : _a.prefix) == null ? void 0 : _b.call(_a), this.selected.map((item) => createVNode(BkTag, {
14630
+ "closable": true,
14631
+ "theme": this.tagTheme,
14632
+ "onClose": () => this.handleRemoveTag(item.value)
14633
+ }, {
14634
+ default: () => [item.label]
14635
+ })), createVNode("input", {
14346
14636
  "class": "bk-select-tag-input",
14347
14637
  "ref": "inputRef",
14348
14638
  "type": "text",
14349
14639
  "placeholder": !this.selected.length ? this.placeholder : "",
14350
14640
  "readonly": !this.filterable,
14641
+ "disabled": this.disabled,
14351
14642
  "value": !this.filterable ? "" : this.value,
14352
14643
  "onInput": this.handleInput,
14353
14644
  "onKeydown": this.handleKeydown
14354
14645
  }, null), (_d = (_c = this.$slots) == null ? void 0 : _c.suffix) == null ? void 0 : _d.call(_c)]);
14355
14646
  }
14356
14647
  });
14357
- var Component$j = defineComponent({
14648
+ var Component$i = defineComponent({
14358
14649
  name: "Select",
14359
14650
  directives: {
14360
14651
  clickoutside: ClickOutside
@@ -14368,7 +14659,7 @@ var Component$j = defineComponent({
14368
14659
  loading: PropTypes.bool.def(false),
14369
14660
  filterable: PropTypes.bool.def(false),
14370
14661
  remoteMethod: PropTypes.func,
14371
- scrollHeight: PropTypes.number.def(216),
14662
+ scrollHeight: PropTypes.number.def(200),
14372
14663
  showSelectAll: PropTypes.bool.def(false),
14373
14664
  popoverMinWidth: PropTypes.number.def(0),
14374
14665
  showOnInit: PropTypes.bool.def(false),
@@ -14391,7 +14682,8 @@ var Component$j = defineComponent({
14391
14682
  displayKey: PropTypes.string.def("label"),
14392
14683
  withValidate: PropTypes.bool.def(true),
14393
14684
  showSelectedIcon: PropTypes.bool.def(true),
14394
- inputSearch: PropTypes.bool.def(true)
14685
+ inputSearch: PropTypes.bool.def(true),
14686
+ enableVirtualRender: PropTypes.bool.def(false)
14395
14687
  },
14396
14688
  emits: ["update:modelValue", "change", "toggle", "clear", "scroll-end", "focus", "blur"],
14397
14689
  setup(props2, {
@@ -14413,7 +14705,12 @@ var Component$j = defineComponent({
14413
14705
  allowCreate,
14414
14706
  customContent,
14415
14707
  showSelectedIcon,
14416
- inputSearch
14708
+ inputSearch,
14709
+ enableVirtualRender,
14710
+ showSelectAll,
14711
+ scrollHeight,
14712
+ list,
14713
+ displayKey
14417
14714
  } = toRefs(props2);
14418
14715
  const formItem = useFormItem();
14419
14716
  const inputRef = ref();
@@ -14421,10 +14718,15 @@ var Component$j = defineComponent({
14421
14718
  const contentRef = ref();
14422
14719
  const searchRef = ref();
14423
14720
  const selectTagInputRef = ref();
14721
+ const virtualRenderRef = ref();
14424
14722
  const optionsMap = ref(/* @__PURE__ */ new Map());
14425
14723
  const options = computed(() => [...optionsMap.value.values()]);
14426
14724
  const groupsMap = ref(/* @__PURE__ */ new Map());
14427
14725
  const selected = ref([]);
14726
+ const cacheSelectedMap = computed(() => selected.value.reduce((pre, item) => {
14727
+ pre[item.value] = item.label;
14728
+ return pre;
14729
+ }, {}));
14428
14730
  const activeOptionValue = ref();
14429
14731
  watch(modelValue, () => {
14430
14732
  var _a;
@@ -14435,8 +14737,15 @@ var Component$j = defineComponent({
14435
14737
  }, {
14436
14738
  deep: true
14437
14739
  });
14740
+ const filterList = computed(() => isRemoteSearch.value ? list.value : list.value.filter((item) => {
14741
+ var _a;
14742
+ return (_a = toLowerCase(String(item[displayKey.value]))) == null ? void 0 : _a.includes(searchKey.value);
14743
+ }));
14438
14744
  const isDisabled = computed(() => disabled.value || loading2.value);
14439
- const selectedLabel = computed(() => selected.value.map((item) => handleGetLabelByValue(item)));
14745
+ const selectedLabel = computed(() => selected.value.map((item) => {
14746
+ var _a, _b;
14747
+ return ((_b = (_a = optionsMap.value) == null ? void 0 : _a.get(item.value)) == null ? void 0 : _b.label) || item.label;
14748
+ }));
14440
14749
  const isAllSelected = computed(() => {
14441
14750
  const normalSelectedValues = options.value.reduce((pre, option) => {
14442
14751
  if (!option.disabled) {
@@ -14451,6 +14760,8 @@ var Component$j = defineComponent({
14451
14760
  const isSearchEmpty = computed(() => options.value.length && options.value.every((option) => !option.visible));
14452
14761
  const isRemoteSearch = computed(() => filterable.value && typeof remoteMethod.value === "function");
14453
14762
  const isShowSelectContent = computed(() => !(searchLoading.value || isOptionsEmpty.value || isSearchEmpty.value) || customContent.value);
14763
+ const isShowSelectAll = computed(() => multiple.value && showSelectAll.value && (!searchKey.value || !filterable.value));
14764
+ const virtualHeight = computed(() => scrollHeight.value - 12 - (isShowSelectAll.value ? 32 : 0));
14454
14765
  const curContentText = computed(() => {
14455
14766
  if (searchLoading.value) {
14456
14767
  return loadingText.value;
@@ -14507,6 +14818,13 @@ var Component$j = defineComponent({
14507
14818
  initActiveOptionValue();
14508
14819
  }
14509
14820
  });
14821
+ const watchOnce = watch(isPopoverShow, () => {
14822
+ setTimeout(() => {
14823
+ var _a, _b;
14824
+ enableVirtualRender.value && ((_b = (_a = virtualRenderRef.value) == null ? void 0 : _a.reset) == null ? void 0 : _b.call(_a));
14825
+ watchOnce();
14826
+ });
14827
+ });
14510
14828
  const initActiveOptionValue = () => {
14511
14829
  var _a;
14512
14830
  const firstSelected = selected.value[0];
@@ -14639,9 +14957,9 @@ var Component$j = defineComponent({
14639
14957
  const {
14640
14958
  scrollTop: scrollTop2,
14641
14959
  clientHeight,
14642
- scrollHeight
14960
+ scrollHeight: scrollHeight2
14643
14961
  } = e.target;
14644
- if (scrollTop2 + clientHeight === scrollHeight) {
14962
+ if (scrollTop2 + clientHeight === scrollHeight2) {
14645
14963
  emit("scroll-end");
14646
14964
  }
14647
14965
  };
@@ -14652,26 +14970,26 @@ var Component$j = defineComponent({
14652
14970
  emitChange(selected.value.map((item) => item.value));
14653
14971
  }
14654
14972
  };
14655
- const handleGetLabelByValue = (item) => {
14973
+ const handleGetLabelByValue = (value) => {
14656
14974
  var _a, _b;
14657
- return ((_b = (_a = optionsMap.value) == null ? void 0 : _a.get(item.value)) == null ? void 0 : _b.label) || item.label || item.value;
14975
+ return ((_b = (_a = optionsMap.value) == null ? void 0 : _a.get(value)) == null ? void 0 : _b.label) || cacheSelectedMap.value[value] || value;
14658
14976
  };
14659
14977
  const handleSetSelectedData = () => {
14660
14978
  if (Array.isArray(modelValue.value)) {
14661
14979
  selected.value = [...modelValue.value.map((value) => ({
14662
14980
  value,
14663
- label: value
14981
+ label: handleGetLabelByValue(value)
14664
14982
  }))];
14665
- } else if (modelValue.value !== void 0) {
14983
+ } else if (modelValue.value !== void 0 && modelValue.value !== "") {
14666
14984
  selected.value = [{
14667
14985
  value: modelValue.value,
14668
- label: modelValue.value
14986
+ label: handleGetLabelByValue(modelValue.value)
14669
14987
  }];
14670
14988
  }
14671
14989
  };
14672
14990
  const handleKeydown = (e) => {
14673
- var _a, _b;
14674
- if (!triggerRef.value.contains(e.target) && !contentRef.value.contains(e.target))
14991
+ var _a, _b, _c, _d;
14992
+ if (!((_a = triggerRef.value) == null ? void 0 : _a.contains(e.target)) && !((_b = contentRef.value) == null ? void 0 : _b.contains(e.target)) && !enableVirtualRender.value && !customContent.value)
14675
14993
  return;
14676
14994
  const availableOptions = options.value.filter((option) => !option.disabled && option.visible);
14677
14995
  const index = availableOptions.findIndex((option) => option.value === activeOptionValue.value);
@@ -14681,13 +14999,13 @@ var Component$j = defineComponent({
14681
14999
  case "ArrowDown": {
14682
15000
  e.preventDefault();
14683
15001
  const nextIndex = index >= availableOptions.length - 1 ? 0 : index + 1;
14684
- activeOptionValue.value = (_a = availableOptions[nextIndex]) == null ? void 0 : _a.value;
15002
+ activeOptionValue.value = (_c = availableOptions[nextIndex]) == null ? void 0 : _c.value;
14685
15003
  break;
14686
15004
  }
14687
15005
  case "ArrowUp": {
14688
15006
  e.preventDefault();
14689
15007
  const preIndex = index === 0 ? availableOptions.length - 1 : index - 1;
14690
- activeOptionValue.value = (_b = availableOptions[preIndex]) == null ? void 0 : _b.value;
15008
+ activeOptionValue.value = (_d = availableOptions[preIndex]) == null ? void 0 : _d.value;
14691
15009
  break;
14692
15010
  }
14693
15011
  case "Backspace": {
@@ -14729,8 +15047,7 @@ var Component$j = defineComponent({
14729
15047
  unregister,
14730
15048
  registerGroup,
14731
15049
  unregisterGroup,
14732
- handleOptionSelected,
14733
- handleGetLabelByValue
15050
+ handleOptionSelected
14734
15051
  }));
14735
15052
  onMounted(() => {
14736
15053
  handleSetSelectedData();
@@ -14756,6 +15073,7 @@ var Component$j = defineComponent({
14756
15073
  contentRef,
14757
15074
  searchRef,
14758
15075
  selectTagInputRef,
15076
+ virtualRenderRef,
14759
15077
  searchLoading,
14760
15078
  isOptionsEmpty,
14761
15079
  isSearchEmpty,
@@ -14764,6 +15082,9 @@ var Component$j = defineComponent({
14764
15082
  curContentText,
14765
15083
  isGroup,
14766
15084
  searchKey,
15085
+ isShowSelectAll,
15086
+ virtualHeight,
15087
+ filterList,
14767
15088
  setHover,
14768
15089
  cancelHover,
14769
15090
  handleFocus,
@@ -14798,7 +15119,7 @@ var Component$j = defineComponent({
14798
15119
  trigger: "manual",
14799
15120
  width: this.popperWidth,
14800
15121
  arrow: false,
14801
- placement: "bottom",
15122
+ placement: "bottom-start",
14802
15123
  isShow: this.isPopoverShow
14803
15124
  };
14804
15125
  const popoverOptions = lodash.exports.merge(basePopoverOptions, this.popoverOptions);
@@ -14832,6 +15153,7 @@ var Component$j = defineComponent({
14832
15153
  "tagTheme": this.tagTheme,
14833
15154
  "placeholder": this.placeholder,
14834
15155
  "filterable": this.isInput,
15156
+ "disabled": this.isDisabled,
14835
15157
  "onRemove": this.handleDeleteTag,
14836
15158
  "onEnter": this.handleInputEnter
14837
15159
  }, {
@@ -14903,11 +15225,24 @@ var Component$j = defineComponent({
14903
15225
  "onScroll": this.handleScroll
14904
15226
  }, [withDirectives(createVNode("ul", {
14905
15227
  "class": "bk-select-options"
14906
- }, [this.multiple && this.showSelectAll && (!this.searchKey || !this.filterable) && createVNode("li", {
15228
+ }, [this.isShowSelectAll && createVNode("li", {
14907
15229
  "class": "bk-select-option",
14908
15230
  "onMouseenter": this.handleSelectedAllOptionMouseEnter,
14909
15231
  "onClick": this.handleToggleAll
14910
- }, [this.selectAllText]), this.list.map((item) => createVNode(BkOption, {
15232
+ }, [this.selectAllText]), this.enableVirtualRender ? createVNode(BkVirtualRender, {
15233
+ "list": this.filterList,
15234
+ "height": this.virtualHeight,
15235
+ "lineHeight": 32,
15236
+ "ref": "virtualRenderRef"
15237
+ }, {
15238
+ default: ({
15239
+ data: data2
15240
+ }) => data2.map((item) => createVNode(BkOption, {
15241
+ "key": item[this.idKey],
15242
+ "value": item[this.idKey],
15243
+ "label": item[this.displayKey]
15244
+ }, null))
15245
+ }) : this.list.map((item) => createVNode(BkOption, {
14911
15246
  "value": item[this.idKey],
14912
15247
  "label": item[this.displayKey]
14913
15248
  }, null)), (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a), this.scrollLoading && createVNode("li", {
@@ -14932,7 +15267,7 @@ var Component$j = defineComponent({
14932
15267
  })]);
14933
15268
  }
14934
15269
  });
14935
- const BkSelect = withInstallProps(Component$j, { Option: BkOption, Group: OptionGroup });
15270
+ const BkSelect = withInstallProps(Component$i, { Option: BkOption, Group: OptionGroup });
14936
15271
  function _isSlot$4(s2) {
14937
15272
  return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
14938
15273
  }
@@ -14942,7 +15277,7 @@ const {
14942
15277
  const sliderPops = Object.assign({}, propsMixin);
14943
15278
  sliderPops.width.default = "400";
14944
15279
  sliderPops.height.default = "100%";
14945
- var Component$i = defineComponent({
15280
+ var Component$h = defineComponent({
14946
15281
  name: "Sideslider",
14947
15282
  components: {
14948
15283
  BkModal,
@@ -15031,7 +15366,7 @@ var Component$i = defineComponent({
15031
15366
  };
15032
15367
  }
15033
15368
  });
15034
- const BkSideslider = withInstall(Component$i);
15369
+ const BkSideslider = withInstall(Component$h);
15035
15370
  const stepsProps = {
15036
15371
  theme: PropTypes.theme().def("primary"),
15037
15372
  size: PropTypes.size(),
@@ -15045,7 +15380,7 @@ const stepsProps = {
15045
15380
  steps: PropTypes.array.def([]),
15046
15381
  beforeChange: PropTypes.func
15047
15382
  };
15048
- var Component$h = defineComponent({
15383
+ var Component$g = defineComponent({
15049
15384
  name: "Steps",
15050
15385
  props: stepsProps,
15051
15386
  emits: ["update:curStep", "click"],
@@ -15199,8 +15534,8 @@ var Component$h = defineComponent({
15199
15534
  })]);
15200
15535
  }
15201
15536
  });
15202
- const BkSteps$2 = withInstall(Component$h);
15203
- var Component$g = defineComponent({
15537
+ const BkSteps$2 = withInstall(Component$g);
15538
+ var Component$f = defineComponent({
15204
15539
  name: "Switcher",
15205
15540
  props: {
15206
15541
  theme: PropTypes.theme().def(""),
@@ -15297,298 +15632,7 @@ var Component$g = defineComponent({
15297
15632
  }, [isChecked.value ? props2.onText : props2.offText]) : ""]);
15298
15633
  }
15299
15634
  });
15300
- const BkSwitcher = withInstall(Component$g);
15301
- const EventProps = {
15302
- onContentScroll: Function
15303
- };
15304
- const virtualRenderProps = __spreadValues({
15305
- list: PropTypes.array.def([]),
15306
- enabled: PropTypes.bool.def(true),
15307
- scrollEvent: PropTypes.bool.def(false),
15308
- lineHeight: PropTypes.oneOfType([PropTypes.number, PropTypes.func]).def(30),
15309
- minHeight: PropTypes.number.def(30),
15310
- height: PropTypes.oneOfType([PropTypes.string.def("100%"), PropTypes.number]).def("100%"),
15311
- width: PropTypes.oneOfType([PropTypes.string.def("100%"), PropTypes.number]).def("100%"),
15312
- className: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.object, PropTypes.arrayOf(PropTypes.object), PropTypes.string]).def(""),
15313
- contentClassName: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.object, PropTypes.arrayOf(PropTypes.object), PropTypes.string]).def(""),
15314
- contentStyle: PropTypes.object.def({}),
15315
- scrollXName: PropTypes.string.def(resolveClassName("F-scroll-x")),
15316
- scrollYName: PropTypes.string.def(resolveClassName("F-scroll-y")),
15317
- groupItemCount: PropTypes.number.def(1),
15318
- preloadItemCount: PropTypes.number.def(1),
15319
- renderAs: PropTypes.string.def("div"),
15320
- contentAs: PropTypes.string.def("div"),
15321
- scrollOffsetTop: PropTypes.number.def(0),
15322
- scrollPosition: PropTypes.string.def("content"),
15323
- abosuteHeight: PropTypes.oneOfType([PropTypes.string.def("auto"), PropTypes.number]).def("auto"),
15324
- throttleDelay: PropTypes.number.def(60)
15325
- }, EventProps);
15326
- var useTagRender = (props2, ctx) => {
15327
- const {
15328
- renderAs,
15329
- contentAs
15330
- } = props2;
15331
- const handleScrollCallback = (event, _startIndex, _endIndex, _scrollTop, translateY, scrollLeft, pos) => {
15332
- ctx.emit("content-scroll", [event, {
15333
- translateY,
15334
- translateX: scrollLeft,
15335
- pos
15336
- }]);
15337
- };
15338
- const vVirtualRender = resolveDirective("bkVirtualRender");
15339
- const dirModifier = {
15340
- lineHeight: props2.lineHeight,
15341
- handleScrollCallback,
15342
- pagination: {},
15343
- throttleDelay: props2.throttleDelay,
15344
- onlyScroll: props2.scrollEvent
15345
- };
15346
- return {
15347
- rendAsTag: () => {
15348
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
15349
- return h$1(renderAs, {
15350
- class: props2.className
15351
- }, [(_c = (_b = (_a = ctx.slots).beforeContent) == null ? void 0 : _b.call(_a)) != null ? _c : "", withDirectives(h$1(contentAs, {
15352
- class: props2.contentClassName,
15353
- style: props2.contentStyle
15354
- }, [(_f = (_e = (_d = ctx.slots).default) == null ? void 0 : _e.call(_d, {
15355
- data: props2.list
15356
- })) != null ? _f : ""]), [[vVirtualRender, dirModifier]]), (_i = (_h = (_g = ctx.slots).afterContent) == null ? void 0 : _h.call(_g)) != null ? _i : "", (_l = (_k = (_j = ctx.slots).afterSection) == null ? void 0 : _k.call(_j)) != null ? _l : ""]);
15357
- }
15358
- };
15359
- };
15360
- function getMatchedIndex(maxCount, maxHeight, groupItemCount, callback) {
15361
- let startIndex = 0;
15362
- let height = 0;
15363
- let diffHeight = 0;
15364
- let lastHeight = 0;
15365
- for (; startIndex < maxCount; startIndex++) {
15366
- lastHeight = callback(startIndex, [startIndex * groupItemCount, (startIndex + 1) * groupItemCount, "virtual"]);
15367
- if (height + lastHeight > maxHeight) {
15368
- diffHeight = maxHeight - height;
15369
- break;
15370
- }
15371
- height += lastHeight;
15372
- }
15373
- return { startIndex, height, diffHeight };
15374
- }
15375
- function computedVirtualIndex(lineHeight, callback, pagination2, el, event) {
15376
- if (!el) {
15377
- return;
15378
- }
15379
- const elScrollTop = el.scrollTop;
15380
- const elScrollLeft = el.scrollLeft;
15381
- const { scrollTop: scrollTop2, count, groupItemCount, startIndex, endIndex } = pagination2;
15382
- const { offsetHeight } = el;
15383
- let targetStartIndex = 0;
15384
- let targetEndIndex = 0;
15385
- let translateY = 0;
15386
- if (typeof lineHeight === "number") {
15387
- targetStartIndex = Math.floor(elScrollTop / lineHeight);
15388
- targetEndIndex = Math.ceil(offsetHeight / lineHeight) + targetStartIndex;
15389
- translateY = elScrollTop % lineHeight;
15390
- }
15391
- if (typeof lineHeight === "function") {
15392
- const startValue = getMatchedIndex(count, elScrollTop, groupItemCount, lineHeight);
15393
- targetStartIndex = startValue.startIndex > 0 ? startValue.startIndex : 0;
15394
- translateY = startValue.diffHeight;
15395
- const endValue = getMatchedIndex(count, offsetHeight, groupItemCount, lineHeight);
15396
- targetEndIndex = endValue.startIndex + targetStartIndex + 1;
15397
- }
15398
- if (elScrollTop !== scrollTop2 || targetStartIndex !== startIndex || targetEndIndex !== endIndex) {
15399
- const bottom2 = el.scrollHeight - el.offsetHeight - el.scrollTop;
15400
- typeof callback === "function" && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, { bottom: bottom2 >= 0 ? bottom2 : 0 });
15401
- }
15402
- }
15403
- function visibleRender(e, wrapper, binding) {
15404
- const { lineHeight = 30, handleScrollCallback, pagination: pagination2 = {}, onlyScroll } = binding.value;
15405
- if (onlyScroll) {
15406
- const elScrollTop = wrapper.scrollTop;
15407
- const elScrollLeft = wrapper.scrollLeft;
15408
- const bottom2 = wrapper.scrollHeight - wrapper.offsetHeight - wrapper.scrollTop;
15409
- handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, { bottom: bottom2 >= 0 ? bottom2 : 0 });
15410
- return;
15411
- }
15412
- const { startIndex, endIndex, groupItemCount, count, scrollTop: scrollTop2 } = pagination2;
15413
- computedVirtualIndex(lineHeight, handleScrollCallback, { scrollTop: scrollTop2, startIndex, endIndex, groupItemCount, count }, wrapper, e);
15414
- }
15415
- const throttledRender = (delay = 60) => lodash.exports.throttle((e, wrapper, binding) => visibleRender(e, wrapper, binding), delay);
15416
- const executeThrottledRender = (e, wrapper, binding, delay = 60) => {
15417
- Reflect.apply(throttledRender(delay), globalThis, [e, wrapper, binding]);
15418
- };
15419
- var virtualRender = {
15420
- mounted(el, binding) {
15421
- const wrapper = el.parentNode;
15422
- const { throttleDelay } = binding.value;
15423
- wrapper.addEventListener("scroll", (e) => {
15424
- executeThrottledRender(e, wrapper, binding, throttleDelay);
15425
- });
15426
- },
15427
- unbind(el) {
15428
- if (el) {
15429
- const wrapper = el.parentNode;
15430
- if (!wrapper) {
15431
- return;
15432
- }
15433
- wrapper.removeEventListener("scroll", throttledRender);
15434
- }
15435
- }
15436
- };
15437
- var Component$f = defineComponent({
15438
- name: "VirtualRender",
15439
- directives: {
15440
- bkVirtualRender: virtualRender
15441
- },
15442
- props: virtualRenderProps,
15443
- emits: ["content-scroll"],
15444
- setup(props2, ctx) {
15445
- const {
15446
- renderAs,
15447
- contentAs
15448
- } = props2;
15449
- const resolvePropClassName = (prop) => {
15450
- if (typeof prop === "string") {
15451
- return [prop];
15452
- }
15453
- if (typeof prop === "object" && !Array.isArray(prop)) {
15454
- return [prop];
15455
- }
15456
- return prop;
15457
- };
15458
- if (!props2.enabled) {
15459
- const {
15460
- rendAsTag
15461
- } = useTagRender(props2, ctx);
15462
- return rendAsTag;
15463
- }
15464
- const refRoot = ref(null);
15465
- const pagination2 = reactive({
15466
- startIndex: 0,
15467
- endIndex: 0,
15468
- scrollTop: 1,
15469
- translateY: 0,
15470
- translateX: 0,
15471
- count: 0,
15472
- pos: {},
15473
- groupItemCount: props2.groupItemCount
15474
- });
15475
- const handleScrollCallback = (event, startIndex, endIndex, scrollTop2, translateY, scrollLeft, pos) => {
15476
- pagination2.startIndex = startIndex;
15477
- pagination2.endIndex = endIndex;
15478
- pagination2.scrollTop = scrollTop2;
15479
- pagination2.translateY = translateY;
15480
- pagination2.translateX = scrollLeft;
15481
- pagination2.pos = pos;
15482
- ctx.emit("content-scroll", [event, pagination2]);
15483
- };
15484
- onMounted(() => {
15485
- nextTick(() => {
15486
- handleListChanged(props2.list);
15487
- afterListDataReset();
15488
- });
15489
- });
15490
- watch(() => props2.list, () => {
15491
- handleChangeListConfig();
15492
- afterListDataReset();
15493
- }, {
15494
- deep: true
15495
- });
15496
- watch(() => props2.lineHeight, () => {
15497
- handleChangeListConfig();
15498
- afterListDataReset();
15499
- });
15500
- const handleChangeListConfig = () => {
15501
- handleListChanged(props2.list);
15502
- };
15503
- const listLength = ref(0);
15504
- const innerHeight = ref(0);
15505
- const handleListChanged = (list) => {
15506
- listLength.value = Math.ceil((list || []).length / props2.groupItemCount);
15507
- pagination2.count = listLength.value;
15508
- pagination2.startIndex = 0;
15509
- pagination2.endIndex = 0;
15510
- pagination2.translateY = 0;
15511
- pagination2.scrollTop = 0;
15512
- const isAuto = typeof props2.abosuteHeight === "string" && props2.abosuteHeight === "auto";
15513
- if (isAuto) {
15514
- if (typeof props2.lineHeight === "function") {
15515
- innerHeight.value = 0;
15516
- let fnValue = 0;
15517
- for (let i2 = 0; i2 < listLength.value; i2++) {
15518
- const fnVal = props2.lineHeight.call(this, i2, list.slice(i2 * props2.groupItemCount, props2.groupItemCount));
15519
- fnValue += typeof fnVal === "number" ? fnVal : 0;
15520
- }
15521
- innerHeight.value = fnValue;
15522
- } else {
15523
- innerHeight.value = props2.lineHeight * listLength.value;
15524
- }
15525
- } else {
15526
- innerHeight.value = props2.abosuteHeight;
15527
- }
15528
- };
15529
- const afterListDataReset = (scrollTop2 = true) => {
15530
- var _a;
15531
- const el = (_a = refRoot.value) == null ? void 0 : _a.parentNode;
15532
- computedVirtualIndex(props2.lineHeight, handleScrollCallback, pagination2, el, null);
15533
- if (scrollTop2 && refRoot.value) {
15534
- refRoot.value.scrollTo(0, 0);
15535
- }
15536
- };
15537
- const localList = computed(() => (props2.list || []).map((item, index) => __spreadProps(__spreadValues({}, item), {
15538
- $index: index
15539
- })));
15540
- const calcList = computed(() => localList.value.slice(pagination2.startIndex * props2.groupItemCount, (pagination2.endIndex + props2.preloadItemCount) * props2.groupItemCount));
15541
- const innerContentStyle = computed(() => props2.scrollPosition === "content" ? {
15542
- top: `${pagination2.scrollTop + props2.scrollOffsetTop}px`,
15543
- transform: `translateY(-${pagination2.translateY}px)`
15544
- } : {});
15545
- const wrapperStyle = computed(() => __spreadValues({
15546
- height: typeof props2.height === "number" ? `${props2.height}px` : props2.height,
15547
- width: typeof props2.width === "number" ? `${props2.width}px` : props2.width,
15548
- display: "inline-block"
15549
- }, props2.scrollPosition === "container" ? innerContentStyle.value : {}));
15550
- const innerStyle = computed(() => {
15551
- const isHidden = typeof props2.abosuteHeight === "number" && props2.abosuteHeight === 0;
15552
- return {
15553
- height: `${innerHeight.value < props2.minHeight ? props2.minHeight : innerHeight.value}px`,
15554
- display: isHidden ? "none" : "block"
15555
- };
15556
- });
15557
- const wrapperClass = computed(() => [resolveClassName("virtual-render"), props2.scrollXName, props2.scrollYName, ...resolvePropClassName(props2.className), props2.scrollPosition === "container" ? resolveClassName("virtual-content") : ""]);
15558
- const innerClass = computed(() => [props2.scrollPosition === "content" ? resolveClassName("virtual-content") : "", ...resolvePropClassName(props2.contentClassName)]);
15559
- const vVirtualRender = resolveDirective("bkVirtualRender");
15560
- const dirModifier = {
15561
- lineHeight: props2.lineHeight,
15562
- handleScrollCallback,
15563
- pagination: pagination2,
15564
- throttleDelay: props2.throttleDelay
15565
- };
15566
- const reset2 = () => {
15567
- handleChangeListConfig();
15568
- afterListDataReset();
15569
- };
15570
- ctx.expose({
15571
- reset: reset2
15572
- });
15573
- return () => {
15574
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
15575
- return h$1(renderAs || "div", {
15576
- ref: refRoot,
15577
- class: wrapperClass.value,
15578
- style: wrapperStyle.value
15579
- }, [(_c = (_b = (_a = ctx.slots).beforeContent) == null ? void 0 : _b.call(_a)) != null ? _c : "", withDirectives(h$1(contentAs || "div", {
15580
- class: innerClass.value,
15581
- style: __spreadValues(__spreadValues({}, innerContentStyle.value), props2.contentStyle)
15582
- }, [(_f = (_e = (_d = ctx.slots).default) == null ? void 0 : _e.call(_d, {
15583
- data: calcList.value
15584
- })) != null ? _f : ""]), [[vVirtualRender, dirModifier]]), (_i = (_h = (_g = ctx.slots).afterContent) == null ? void 0 : _h.call(_g)) != null ? _i : "", h$1("div", {
15585
- class: [resolveClassName("virtual-section")],
15586
- style: innerStyle.value
15587
- }), (_l = (_k = (_j = ctx.slots).afterSection) == null ? void 0 : _k.call(_j)) != null ? _l : ""]);
15588
- };
15589
- }
15590
- });
15591
- const BkVirtualRender = withInstall(Component$f);
15635
+ const BkSwitcher = withInstall(Component$f);
15592
15636
  var BORDER_OPTION = /* @__PURE__ */ ((BORDER_OPTION2) => {
15593
15637
  BORDER_OPTION2["NONE"] = "none";
15594
15638
  BORDER_OPTION2["ROW"] = "row";
@@ -23985,7 +24029,7 @@ var DateRangePanel = defineComponent({
23985
24029
  if (shortcut.onClick) {
23986
24030
  shortcut.onClick(shortcut, index);
23987
24031
  }
23988
- emit("pick", typeof shortcut.value === "function" ? shortcut.value() : shortcut.value, false, props2.type, shortcut);
24032
+ emit("pick", typeof shortcut.value === "function" ? shortcut.value() : shortcut.value, false, "shortcut", shortcut);
23989
24033
  if (props2.shortcutClose) {
23990
24034
  emit("pick-success");
23991
24035
  }