bkui-vue 0.0.1-beta.100 → 0.0.1-beta.101

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
@@ -33,7 +33,7 @@ var __publicField = (obj, key, value) => {
33
33
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
34
  return value;
35
35
  };
36
- import { inject, createVNode, h as h$1, mergeProps, defineComponent, reactive, ref, computed, watch, onMounted, onBeforeUnmount, getCurrentInstance, nextTick, Transition, provide, createTextVNode, withDirectives, vShow, isVNode, Fragment, toRefs, toRef, onUnmounted, Teleport, customRef, onBeforeMount, vModelText, resolveDirective, watchEffect, onUpdated, render, toRaw, withModifiers } from "vue";
36
+ import { inject, createVNode, h as h$1, mergeProps, defineComponent, reactive, ref, computed, watch, onMounted, onBeforeUnmount, getCurrentInstance, nextTick, Transition, provide, createTextVNode, withDirectives, vShow, isVNode, Fragment, toRefs, onUnmounted, Teleport, resolveDirective, customRef, onBeforeMount, toRef, vModelText, watchEffect, onUpdated, render, toRaw, withModifiers } from "vue";
37
37
  var reset = "";
38
38
  var alert = "";
39
39
  var affix = "";
@@ -8923,7 +8923,10 @@ const loadingTypes = {
8923
8923
  theme: PropTypes.theme(["white", "primary", "warning", "success", "danger"]),
8924
8924
  title: PropTypes.string.def(""),
8925
8925
  size: PropTypes.commonType(Object.values(BkLoadingSize)).def(BkLoadingSize.Normal),
8926
- mode: PropTypes.commonType(Object.values(BkLoadingMode)).def("default")
8926
+ mode: PropTypes.commonType(Object.values(BkLoadingMode)).def("default"),
8927
+ opacity: PropTypes.number.def(0.9),
8928
+ color: PropTypes.string.def("white"),
8929
+ zIndex: PropTypes.number.def(1)
8927
8930
  };
8928
8931
  var Component$z = defineComponent({
8929
8932
  name: "Loading",
@@ -8937,6 +8940,13 @@ var Component$z = defineComponent({
8937
8940
  }, [[1, 2, 3, 4, 5, 6, 7, 8].map((i2) => createVNode("span", {
8938
8941
  "class": `oval oval-${i2}`
8939
8942
  }, null))]);
8943
+ const zIndexStyle = computed(() => ({
8944
+ zIndex: props.zIndex
8945
+ }));
8946
+ const maskStyle = computed(() => __spreadValues({
8947
+ opacity: props.opacity,
8948
+ backgroundColor: props.color
8949
+ }, zIndexStyle.value));
8940
8950
  const loadingWrapperCls = computed(() => classes({
8941
8951
  "bk-loading-wrapper": props.loading,
8942
8952
  "bk-nested-loading": !!ctx.slots.default
@@ -8960,13 +8970,15 @@ var Component$z = defineComponent({
8960
8970
  var _a, _b;
8961
8971
  return createVNode("div", {
8962
8972
  "class": loadingWrapperCls.value
8963
- }, [props.loading && [createVNode("div", {
8964
- "class": containerCls.value
8973
+ }, [props.loading && [ctx.slots.default && createVNode("div", {
8974
+ "class": "bk-loading-mask",
8975
+ "style": maskStyle.value
8976
+ }, null), createVNode("div", {
8977
+ "class": containerCls.value,
8978
+ "style": zIndexStyle.value
8965
8979
  }, [indicator.value, hasTitle.value && createVNode("div", {
8966
8980
  "class": "bk-loading-title"
8967
- }, [props.title])]), ctx.slots.default && createVNode("div", {
8968
- "class": "bk-loading-mask"
8969
- }, null)], (_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
8981
+ }, [props.title])])], (_b = (_a = ctx.slots).default) == null ? void 0 : _b.call(_a)]);
8970
8982
  };
8971
8983
  }
8972
8984
  });
@@ -10452,845 +10464,879 @@ var Component$o = defineComponent({
10452
10464
  }
10453
10465
  });
10454
10466
  const BkPopover = withInstall(Component$o);
10455
- var Arrow = defineComponent({
10456
- name: "PopArrow",
10457
- render() {
10458
- const arrowClassName = resolveClassName("pop2-arrow");
10459
- return createVNode("div", {
10460
- "class": arrowClassName
10461
- }, null);
10467
+ var _populated = false;
10468
+ var _ie, _firefox, _opera, _webkit, _chrome;
10469
+ var _ie_real_version;
10470
+ var _osx, _windows, _linux, _android;
10471
+ var _win64;
10472
+ var _iphone, _ipad, _native;
10473
+ var _mobile;
10474
+ function _populate() {
10475
+ if (_populated) {
10476
+ return;
10462
10477
  }
10463
- });
10464
- var Content = defineComponent({
10465
- name: "PopContent",
10466
- props: {
10467
- width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def("auto"),
10468
- height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def("auto")
10478
+ _populated = true;
10479
+ var uas = navigator.userAgent;
10480
+ var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(uas);
10481
+ var os = /(Mac OS X)|(Windows)|(Linux)/.exec(uas);
10482
+ _iphone = /\b(iPhone|iP[ao]d)/.exec(uas);
10483
+ _ipad = /\b(iP[ao]d)/.exec(uas);
10484
+ _android = /Android/i.exec(uas);
10485
+ _native = /FBAN\/\w+;/i.exec(uas);
10486
+ _mobile = /Mobile/i.exec(uas);
10487
+ _win64 = !!/Win64/.exec(uas);
10488
+ if (agent) {
10489
+ _ie = agent[1] ? parseFloat(agent[1]) : agent[5] ? parseFloat(agent[5]) : NaN;
10490
+ if (_ie && document && document.documentMode) {
10491
+ _ie = document.documentMode;
10492
+ }
10493
+ var trident = /(?:Trident\/(\d+.\d+))/.exec(uas);
10494
+ _ie_real_version = trident ? parseFloat(trident[1]) + 4 : _ie;
10495
+ _firefox = agent[2] ? parseFloat(agent[2]) : NaN;
10496
+ _opera = agent[3] ? parseFloat(agent[3]) : NaN;
10497
+ _webkit = agent[4] ? parseFloat(agent[4]) : NaN;
10498
+ if (_webkit) {
10499
+ agent = /(?:Chrome\/(\d+\.\d+))/.exec(uas);
10500
+ _chrome = agent && agent[1] ? parseFloat(agent[1]) : NaN;
10501
+ } else {
10502
+ _chrome = NaN;
10503
+ }
10504
+ } else {
10505
+ _ie = _firefox = _opera = _chrome = _webkit = NaN;
10506
+ }
10507
+ if (os) {
10508
+ if (os[1]) {
10509
+ var ver = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(uas);
10510
+ _osx = ver ? parseFloat(ver[1].replace("_", ".")) : true;
10511
+ } else {
10512
+ _osx = false;
10513
+ }
10514
+ _windows = !!os[2];
10515
+ _linux = !!os[3];
10516
+ } else {
10517
+ _osx = _windows = _linux = false;
10518
+ }
10519
+ }
10520
+ var UserAgent_DEPRECATED$1 = {
10521
+ ie: function() {
10522
+ return _populate() || _ie;
10469
10523
  },
10470
- setup(props) {
10471
- const resolveValToPix = (val) => {
10472
- if (/^\d+\.?\d*$/.test(`${val}`)) {
10473
- return `${val}px`;
10474
- }
10475
- return val;
10476
- };
10477
- const style = computed(() => ({
10478
- width: resolveValToPix(props.width),
10479
- height: resolveValToPix(props.height)
10480
- }));
10481
- return {
10482
- style
10483
- };
10524
+ ieCompatibilityMode: function() {
10525
+ return _populate() || _ie_real_version > _ie;
10484
10526
  },
10485
- render() {
10486
- var _a, _b, _c, _d, _e, _f;
10487
- const className = [resolveClassName("popover2"), resolveClassName("pop2-content")];
10488
- return createVNode("div", {
10489
- "class": className,
10490
- "tabindex": "-1",
10491
- "style": this.style
10492
- }, [(_c = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) != null ? _c : "", (_f = (_e = (_d = this.$slots).arrow) == null ? void 0 : _e.call(_d)) != null ? _f : ""]);
10527
+ ie64: function() {
10528
+ return UserAgent_DEPRECATED$1.ie() && _win64;
10529
+ },
10530
+ firefox: function() {
10531
+ return _populate() || _firefox;
10532
+ },
10533
+ opera: function() {
10534
+ return _populate() || _opera;
10535
+ },
10536
+ webkit: function() {
10537
+ return _populate() || _webkit;
10538
+ },
10539
+ safari: function() {
10540
+ return UserAgent_DEPRECATED$1.webkit();
10541
+ },
10542
+ chrome: function() {
10543
+ return _populate() || _chrome;
10544
+ },
10545
+ windows: function() {
10546
+ return _populate() || _windows;
10547
+ },
10548
+ osx: function() {
10549
+ return _populate() || _osx;
10550
+ },
10551
+ linux: function() {
10552
+ return _populate() || _linux;
10553
+ },
10554
+ iphone: function() {
10555
+ return _populate() || _iphone;
10556
+ },
10557
+ mobile: function() {
10558
+ return _populate() || (_iphone || _ipad || _android || _mobile);
10559
+ },
10560
+ nativeApp: function() {
10561
+ return _populate() || _native;
10562
+ },
10563
+ android: function() {
10564
+ return _populate() || _android;
10565
+ },
10566
+ ipad: function() {
10567
+ return _populate() || _ipad;
10493
10568
  }
10494
- });
10495
- const placements = ["auto", "auto-start", "auto-end", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"];
10496
- const EventProps$1 = {
10497
- onAfterHidden: Function,
10498
- onAfterShow: Function
10499
10569
  };
10500
- const PopoverProps = __spreadValues({
10501
- isShow: PropTypes.bool.def(false),
10502
- always: PropTypes.bool.def(false),
10503
- disabled: PropTypes.bool.def(false),
10504
- width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def("auto"),
10505
- height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def("auto"),
10506
- content: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def(""),
10507
- placement: PropTypes.placement(placements).def("top"),
10508
- theme: PropTypes.string.def("dark"),
10509
- trigger: PropTypes.string.def("hover"),
10510
- arrow: PropTypes.bool.def(true),
10511
- padding: PropTypes.number.def(5),
10512
- offset: PropTypes.number.def(6),
10513
- boundary: PropTypes.string.def(void 0),
10514
- zIndex: PropTypes.number.def(void 0),
10515
- disableTeleport: PropTypes.bool.def(false),
10516
- autoPlacement: PropTypes.bool.def(false)
10517
- }, EventProps$1);
10518
- var Reference = defineComponent({
10519
- name: "PopReference",
10520
- render() {
10521
- var _a, _b, _c;
10522
- return (_c = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) != null ? _c : "";
10523
- }
10524
- });
10525
- function getSide(placement) {
10526
- return placement.split("-")[0];
10527
- }
10528
- function getAlignment(placement) {
10529
- return placement.split("-")[1];
10530
- }
10531
- function getMainAxisFromPlacement(placement) {
10532
- return ["top", "bottom"].includes(getSide(placement)) ? "x" : "y";
10533
- }
10534
- function getLengthFromAxis(axis) {
10535
- return axis === "y" ? "height" : "width";
10570
+ var UserAgent_DEPRECATED_1 = UserAgent_DEPRECATED$1;
10571
+ var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
10572
+ var ExecutionEnvironment$1 = {
10573
+ canUseDOM,
10574
+ canUseWorkers: typeof Worker !== "undefined",
10575
+ canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
10576
+ canUseViewport: canUseDOM && !!window.screen,
10577
+ isInWorker: !canUseDOM
10578
+ };
10579
+ var ExecutionEnvironment_1 = ExecutionEnvironment$1;
10580
+ var ExecutionEnvironment = ExecutionEnvironment_1;
10581
+ var useHasFeature;
10582
+ if (ExecutionEnvironment.canUseDOM) {
10583
+ useHasFeature = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true;
10536
10584
  }
10537
- function computeCoordsFromPlacement(_ref, placement, rtl) {
10538
- let {
10539
- reference: reference2,
10540
- floating
10541
- } = _ref;
10542
- const commonX = reference2.x + reference2.width / 2 - floating.width / 2;
10543
- const commonY = reference2.y + reference2.height / 2 - floating.height / 2;
10544
- const mainAxis = getMainAxisFromPlacement(placement);
10545
- const length = getLengthFromAxis(mainAxis);
10546
- const commonAlign = reference2[length] / 2 - floating[length] / 2;
10547
- const side = getSide(placement);
10548
- const isVertical = mainAxis === "x";
10549
- let coords;
10550
- switch (side) {
10551
- case "top":
10552
- coords = {
10553
- x: commonX,
10554
- y: reference2.y - floating.height
10555
- };
10556
- break;
10557
- case "bottom":
10558
- coords = {
10559
- x: commonX,
10560
- y: reference2.y + reference2.height
10561
- };
10562
- break;
10563
- case "right":
10564
- coords = {
10565
- x: reference2.x + reference2.width,
10566
- y: commonY
10567
- };
10568
- break;
10569
- case "left":
10570
- coords = {
10571
- x: reference2.x - floating.width,
10572
- y: commonY
10573
- };
10574
- break;
10575
- default:
10576
- coords = {
10577
- x: reference2.x,
10578
- y: reference2.y
10579
- };
10585
+ /**
10586
+ * Checks if an event is supported in the current execution environment.
10587
+ *
10588
+ * NOTE: This will not work correctly for non-generic events such as `change`,
10589
+ * `reset`, `load`, `error`, and `select`.
10590
+ *
10591
+ * Borrows from Modernizr.
10592
+ *
10593
+ * @param {string} eventNameSuffix Event name, e.g. "click".
10594
+ * @param {?boolean} capture Check if the capture phase is supported.
10595
+ * @return {boolean} True if the event is supported.
10596
+ * @internal
10597
+ * @license Modernizr 3.0.0pre (Custom Build) | MIT
10598
+ */
10599
+ function isEventSupported$1(eventNameSuffix, capture) {
10600
+ if (!ExecutionEnvironment.canUseDOM || capture && !("addEventListener" in document)) {
10601
+ return false;
10580
10602
  }
10581
- switch (getAlignment(placement)) {
10582
- case "start":
10583
- coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
10584
- break;
10585
- case "end":
10586
- coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
10587
- break;
10603
+ var eventName = "on" + eventNameSuffix;
10604
+ var isSupported = eventName in document;
10605
+ if (!isSupported) {
10606
+ var element = document.createElement("div");
10607
+ element.setAttribute(eventName, "return;");
10608
+ isSupported = typeof element[eventName] === "function";
10588
10609
  }
10589
- return coords;
10610
+ if (!isSupported && useHasFeature && eventNameSuffix === "wheel") {
10611
+ isSupported = document.implementation.hasFeature("Events.wheel", "3.0");
10612
+ }
10613
+ return isSupported;
10590
10614
  }
10591
- const computePosition$1 = async (reference2, floating, config) => {
10592
- const {
10593
- placement = "bottom",
10594
- strategy = "absolute",
10595
- middleware = [],
10596
- platform: platform2
10597
- } = config;
10598
- const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
10599
- let rects = await platform2.getElementRects({
10600
- reference: reference2,
10601
- floating,
10602
- strategy
10603
- });
10604
- let {
10605
- x: x2,
10606
- y: y2
10607
- } = computeCoordsFromPlacement(rects, placement, rtl);
10608
- let statefulPlacement = placement;
10609
- let middlewareData = {};
10610
- for (let i2 = 0; i2 < middleware.length; i2++) {
10611
- const {
10612
- name,
10613
- fn: fn2
10614
- } = middleware[i2];
10615
- const {
10616
- x: nextX,
10617
- y: nextY,
10618
- data: data2,
10619
- reset: reset2
10620
- } = await fn2({
10621
- x: x2,
10622
- y: y2,
10623
- initialPlacement: placement,
10624
- placement: statefulPlacement,
10625
- strategy,
10626
- middlewareData,
10627
- rects,
10628
- platform: platform2,
10629
- elements: {
10630
- reference: reference2,
10631
- floating
10632
- }
10633
- });
10634
- x2 = nextX != null ? nextX : x2;
10635
- y2 = nextY != null ? nextY : y2;
10636
- middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
10637
- [name]: __spreadValues(__spreadValues({}, middlewareData[name]), data2)
10638
- });
10639
- if (reset2) {
10640
- if (typeof reset2 === "object") {
10641
- if (reset2.placement) {
10642
- statefulPlacement = reset2.placement;
10643
- }
10644
- if (reset2.rects) {
10645
- rects = reset2.rects === true ? await platform2.getElementRects({
10646
- reference: reference2,
10647
- floating,
10648
- strategy
10649
- }) : reset2.rects;
10650
- }
10651
- ({
10652
- x: x2,
10653
- y: y2
10654
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
10655
- }
10656
- i2 = -1;
10657
- continue;
10615
+ var isEventSupported_1 = isEventSupported$1;
10616
+ var UserAgent_DEPRECATED = UserAgent_DEPRECATED_1;
10617
+ var isEventSupported = isEventSupported_1;
10618
+ var PIXEL_STEP = 10;
10619
+ var LINE_HEIGHT = 40;
10620
+ var PAGE_HEIGHT = 800;
10621
+ function normalizeWheel$1(event) {
10622
+ var sX = 0, sY = 0, pX = 0, pY = 0;
10623
+ if ("detail" in event) {
10624
+ sY = event.detail;
10625
+ }
10626
+ if ("wheelDelta" in event) {
10627
+ sY = -event.wheelDelta / 120;
10628
+ }
10629
+ if ("wheelDeltaY" in event) {
10630
+ sY = -event.wheelDeltaY / 120;
10631
+ }
10632
+ if ("wheelDeltaX" in event) {
10633
+ sX = -event.wheelDeltaX / 120;
10634
+ }
10635
+ if ("axis" in event && event.axis === event.HORIZONTAL_AXIS) {
10636
+ sX = sY;
10637
+ sY = 0;
10638
+ }
10639
+ pX = sX * PIXEL_STEP;
10640
+ pY = sY * PIXEL_STEP;
10641
+ if ("deltaY" in event) {
10642
+ pY = event.deltaY;
10643
+ }
10644
+ if ("deltaX" in event) {
10645
+ pX = event.deltaX;
10646
+ }
10647
+ if ((pX || pY) && event.deltaMode) {
10648
+ if (event.deltaMode == 1) {
10649
+ pX *= LINE_HEIGHT;
10650
+ pY *= LINE_HEIGHT;
10651
+ } else {
10652
+ pX *= PAGE_HEIGHT;
10653
+ pY *= PAGE_HEIGHT;
10658
10654
  }
10659
10655
  }
10656
+ if (pX && !sX) {
10657
+ sX = pX < 1 ? -1 : 1;
10658
+ }
10659
+ if (pY && !sY) {
10660
+ sY = pY < 1 ? -1 : 1;
10661
+ }
10660
10662
  return {
10661
- x: x2,
10662
- y: y2,
10663
- placement: statefulPlacement,
10664
- strategy,
10665
- middlewareData
10666
- };
10667
- };
10668
- function expandPaddingObject(padding) {
10669
- return __spreadValues({
10670
- top: 0,
10671
- right: 0,
10672
- bottom: 0,
10673
- left: 0
10674
- }, padding);
10675
- }
10676
- function getSideObjectFromPadding(padding) {
10677
- return typeof padding !== "number" ? expandPaddingObject(padding) : {
10678
- top: padding,
10679
- right: padding,
10680
- bottom: padding,
10681
- left: padding
10663
+ spinX: sX,
10664
+ spinY: sY,
10665
+ pixelX: pX,
10666
+ pixelY: pY
10682
10667
  };
10683
10668
  }
10684
- function rectToClientRect(rect) {
10685
- return __spreadProps(__spreadValues({}, rect), {
10686
- top: rect.y,
10687
- left: rect.x,
10688
- right: rect.x + rect.width,
10689
- bottom: rect.y + rect.height
10690
- });
10691
- }
10692
- async function detectOverflow(middlewareArguments, options) {
10693
- var _await$platform$isEle;
10694
- if (options === void 0) {
10695
- options = {};
10669
+ normalizeWheel$1.getEventType = function() {
10670
+ return UserAgent_DEPRECATED.firefox() ? "DOMMouseScroll" : isEventSupported("wheel") ? "wheel" : "mousewheel";
10671
+ };
10672
+ var normalizeWheel_1 = normalizeWheel$1;
10673
+ var normalizeWheel = normalizeWheel_1;
10674
+ const isFirefox = typeof navigator !== "undefined" && navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
10675
+ const mousewheelHandler = function(element, callback) {
10676
+ if (element == null ? void 0 : element.addEventListener) {
10677
+ element.addEventListener(isFirefox ? "DOMMouseScroll" : "mousewheel", function(e) {
10678
+ const normalized = normalizeWheel(e);
10679
+ callback == null ? void 0 : callback.apply(this, [e, normalized]);
10680
+ });
10696
10681
  }
10697
- const {
10698
- x: x2,
10699
- y: y2,
10700
- platform: platform2,
10701
- rects,
10702
- elements,
10703
- strategy
10704
- } = middlewareArguments;
10705
- const {
10706
- boundary = "clippingAncestors",
10707
- rootBoundary = "viewport",
10708
- elementContext = "floating",
10709
- altBoundary = false,
10710
- padding = 0
10711
- } = options;
10712
- const paddingObject = getSideObjectFromPadding(padding);
10713
- const altContext = elementContext === "floating" ? "reference" : "floating";
10714
- const element = elements[altBoundary ? altContext : elementContext];
10715
- const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
10716
- element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
10717
- boundary,
10718
- rootBoundary,
10719
- strategy
10720
- }));
10721
- const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
10722
- rect: elementContext === "floating" ? __spreadProps(__spreadValues({}, rects.floating), {
10723
- x: x2,
10724
- y: y2
10725
- }) : rects.reference,
10726
- offsetParent: await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)),
10727
- strategy
10728
- }) : rects[elementContext]);
10729
- return {
10730
- top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
10731
- bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
10732
- left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
10733
- right: elementClientRect.right - clippingClientRect.right + paddingObject.right
10682
+ };
10683
+ const mousewheel = {
10684
+ beforeMount(el, binding) {
10685
+ console.error(el, binding);
10686
+ mousewheelHandler(el, binding.value);
10687
+ }
10688
+ };
10689
+ const isElement$1 = (e) => {
10690
+ if (typeof Element === "undefined")
10691
+ return false;
10692
+ return e instanceof Element;
10693
+ };
10694
+ const nodeList = /* @__PURE__ */ new Map();
10695
+ let startClick;
10696
+ document.addEventListener("mousedown", (e) => startClick = e);
10697
+ document.addEventListener("mouseup", (e) => {
10698
+ for (const handlers of nodeList.values()) {
10699
+ for (const { documentHandler } of handlers) {
10700
+ documentHandler(e, startClick);
10701
+ }
10702
+ }
10703
+ });
10704
+ function createDocumentHandler(el, binding) {
10705
+ let excludes = [];
10706
+ if (Array.isArray(binding.arg)) {
10707
+ excludes = binding.arg;
10708
+ } else if (isElement$1(binding.arg)) {
10709
+ excludes.push(binding.arg);
10710
+ }
10711
+ return function(mouseup, mousedown) {
10712
+ const { popperRef } = binding.instance;
10713
+ const mouseUpTarget = mouseup.target;
10714
+ const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
10715
+ const isBound = !binding || !binding.instance;
10716
+ const isTargetExists = !mouseUpTarget || !mouseDownTarget;
10717
+ const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
10718
+ const isSelf = el === mouseUpTarget;
10719
+ const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
10720
+ const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
10721
+ if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
10722
+ return;
10723
+ }
10724
+ binding.value(mouseup, mousedown);
10734
10725
  };
10735
10726
  }
10736
- const min$1 = Math.min;
10737
- const max$1 = Math.max;
10738
- function within(min$1$1, value, max$1$1) {
10739
- return max$1(min$1$1, min$1(value, max$1$1));
10740
- }
10741
- const arrow = (options) => ({
10742
- name: "arrow",
10743
- options,
10744
- async fn(middlewareArguments) {
10745
- const {
10746
- element,
10747
- padding = 0
10748
- } = options != null ? options : {};
10749
- const {
10750
- x: x2,
10751
- y: y2,
10752
- placement,
10753
- rects,
10754
- platform: platform2
10755
- } = middlewareArguments;
10756
- if (element == null) {
10757
- return {};
10727
+ const ClickOutside = {
10728
+ beforeMount(el, binding) {
10729
+ if (!nodeList.has(el)) {
10730
+ nodeList.set(el, []);
10758
10731
  }
10759
- const paddingObject = getSideObjectFromPadding(padding);
10760
- const coords = {
10761
- x: x2,
10762
- y: y2
10763
- };
10764
- const axis = getMainAxisFromPlacement(placement);
10765
- const alignment = getAlignment(placement);
10766
- const length = getLengthFromAxis(axis);
10767
- const arrowDimensions = await platform2.getDimensions(element);
10768
- const minProp = axis === "y" ? "top" : "left";
10769
- const maxProp = axis === "y" ? "bottom" : "right";
10770
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
10771
- const startDiff = coords[axis] - rects.reference[axis];
10772
- const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
10773
- let clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
10774
- if (clientSize === 0) {
10775
- clientSize = rects.floating[length];
10732
+ nodeList.get(el).push({
10733
+ documentHandler: createDocumentHandler(el, binding),
10734
+ bindingFn: binding.value
10735
+ });
10736
+ },
10737
+ updated(el, binding) {
10738
+ if (!nodeList.has(el)) {
10739
+ nodeList.set(el, []);
10776
10740
  }
10777
- const centerToReference = endDiff / 2 - startDiff / 2;
10778
- const min2 = paddingObject[minProp];
10779
- const max2 = clientSize - arrowDimensions[length] - paddingObject[maxProp];
10780
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
10781
- const offset2 = within(min2, center, max2);
10782
- const alignmentPadding = alignment === "start" ? paddingObject[minProp] : paddingObject[maxProp];
10783
- const shouldAddOffset = alignmentPadding > 0 && center !== offset2 && rects.reference[length] <= rects.floating[length];
10784
- const alignmentOffset = shouldAddOffset ? center < min2 ? min2 - center : max2 - center : 0;
10785
- return {
10786
- [axis]: coords[axis] - alignmentOffset,
10787
- data: {
10788
- [axis]: offset2,
10789
- centerOffset: center - offset2
10790
- }
10741
+ const handlers = nodeList.get(el);
10742
+ const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
10743
+ const newHandler = {
10744
+ documentHandler: createDocumentHandler(el, binding),
10745
+ bindingFn: binding.value
10791
10746
  };
10747
+ if (oldHandlerIndex >= 0) {
10748
+ handlers.splice(oldHandlerIndex, 1, newHandler);
10749
+ } else {
10750
+ handlers.push(newHandler);
10751
+ }
10752
+ },
10753
+ unmounted(el) {
10754
+ nodeList.delete(el);
10792
10755
  }
10793
- });
10794
- const hash$1 = {
10795
- left: "right",
10796
- right: "left",
10797
- bottom: "top",
10798
- top: "bottom"
10799
10756
  };
10800
- function getOppositePlacement(placement) {
10801
- return placement.replace(/left|right|bottom|top/g, (matched) => hash$1[matched]);
10802
- }
10803
- function getAlignmentSides(placement, rects, rtl) {
10804
- if (rtl === void 0) {
10805
- rtl = false;
10806
- }
10807
- const alignment = getAlignment(placement);
10808
- const mainAxis = getMainAxisFromPlacement(placement);
10809
- const length = getLengthFromAxis(mainAxis);
10810
- let mainAlignmentSide = mainAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
10811
- if (rects.reference[length] > rects.floating[length]) {
10812
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
10757
+ var popper = "";
10758
+ const tooltips = {
10759
+ mounted(el, binding) {
10760
+ const opts = initOptions();
10761
+ if (typeof binding.value === "object") {
10762
+ Object.assign(opts, binding.value);
10763
+ } else {
10764
+ opts.content = binding.value;
10765
+ }
10766
+ const { disabled, arrow: arrow2, theme } = opts;
10767
+ if (disabled) {
10768
+ return;
10769
+ }
10770
+ const popper2 = renderContent(opts.content, arrow2, theme === "light");
10771
+ createPopperInstance(el, popper2, opts);
10813
10772
  }
10814
- return {
10815
- main: mainAlignmentSide,
10816
- cross: getOppositePlacement(mainAlignmentSide)
10817
- };
10818
- }
10819
- const hash = {
10820
- start: "end",
10821
- end: "start"
10822
10773
  };
10823
- function getOppositeAlignmentPlacement(placement) {
10824
- return placement.replace(/start|end/g, (matched) => hash[matched]);
10825
- }
10826
- const sides = ["top", "right", "bottom", "left"];
10827
- const allPlacements = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
10828
- function getPlacementList(alignment, autoAlignment, allowedPlacements) {
10829
- const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement);
10830
- return allowedPlacementsSortedByAlignment.filter((placement) => {
10831
- if (alignment) {
10832
- return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
10774
+ function initOptions() {
10775
+ const defaultOpts = {
10776
+ arrow: true,
10777
+ disabled: false,
10778
+ trigger: "hover",
10779
+ theme: "dark",
10780
+ content: "",
10781
+ showOnInit: false,
10782
+ placement: "top",
10783
+ distance: 8,
10784
+ onShow: () => {
10785
+ },
10786
+ onHide: () => {
10833
10787
  }
10834
- return true;
10835
- });
10788
+ };
10789
+ return defaultOpts;
10836
10790
  }
10837
- const autoPlacement = function(options) {
10838
- if (options === void 0) {
10839
- options = {};
10791
+ function renderContent(value, hasArrow, isLight) {
10792
+ const zIndex = bkZIndexManager.getPopperIndex();
10793
+ const content = document.createElement("div");
10794
+ content.className = `bk-popper ${isLight ? "light" : "dark"}`;
10795
+ content.innerText = value;
10796
+ content.style.zIndex = String(zIndex);
10797
+ if (hasArrow) {
10798
+ const arrow2 = renderArrow();
10799
+ content.appendChild(arrow2);
10840
10800
  }
10841
- return {
10842
- name: "autoPlacement",
10843
- options,
10844
- async fn(middlewareArguments) {
10845
- var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _placementsSortedByLe;
10846
- const {
10847
- x: x2,
10848
- y: y2,
10849
- rects,
10850
- middlewareData,
10851
- placement,
10852
- platform: platform2,
10853
- elements
10854
- } = middlewareArguments;
10855
- const _a = options, {
10856
- alignment = null,
10857
- allowedPlacements = allPlacements,
10858
- autoAlignment = true
10859
- } = _a, detectOverflowOptions = __objRest(_a, [
10860
- "alignment",
10861
- "allowedPlacements",
10862
- "autoAlignment"
10863
- ]);
10864
- const placements2 = getPlacementList(alignment, autoAlignment, allowedPlacements);
10865
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
10866
- const currentIndex = (_middlewareData$autoP = (_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.index) != null ? _middlewareData$autoP : 0;
10867
- const currentPlacement = placements2[currentIndex];
10868
- if (currentPlacement == null) {
10869
- return {};
10870
- }
10871
- const {
10872
- main: main2,
10873
- cross
10874
- } = getAlignmentSides(currentPlacement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
10875
- if (placement !== currentPlacement) {
10876
- return {
10877
- x: x2,
10878
- y: y2,
10879
- reset: {
10880
- placement: placements2[0]
10881
- }
10882
- };
10801
+ document.body.appendChild(content);
10802
+ return content;
10803
+ }
10804
+ function renderArrow() {
10805
+ const arrow2 = document.createElement("div");
10806
+ arrow2.className = "bk-popper-arrow";
10807
+ arrow2.setAttribute("data-popper-arrow", "");
10808
+ return arrow2;
10809
+ }
10810
+ function createPopperInstance(el, popper2, options) {
10811
+ const { placement, distance, trigger, showOnInit, onShow, onHide } = options;
10812
+ const popperInstance = createPopper(el, popper2, {
10813
+ placement,
10814
+ modifiers: [
10815
+ {
10816
+ name: "offset",
10817
+ options: {
10818
+ offset: [0, distance]
10819
+ }
10883
10820
  }
10884
- const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main2], overflow[cross]];
10885
- const allOverflows = [...(_middlewareData$autoP3 = (_middlewareData$autoP4 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP4.overflows) != null ? _middlewareData$autoP3 : [], {
10886
- placement: currentPlacement,
10887
- overflows: currentOverflows
10888
- }];
10889
- const nextPlacement = placements2[currentIndex + 1];
10890
- if (nextPlacement) {
10891
- return {
10892
- data: {
10893
- index: currentIndex + 1,
10894
- overflows: allOverflows
10895
- },
10896
- reset: {
10897
- placement: nextPlacement
10898
- }
10899
- };
10821
+ ]
10822
+ });
10823
+ if (trigger === "hover") {
10824
+ const showEvents = ["mouseenter", "focus"];
10825
+ const hideEvents = ["mouseleave", "blur"];
10826
+ showEvents.forEach((event) => {
10827
+ el.addEventListener(event, show);
10828
+ });
10829
+ hideEvents.forEach((event) => {
10830
+ el.addEventListener(event, hide2);
10831
+ });
10832
+ } else if (trigger === "click") {
10833
+ document.body.addEventListener("click", (event) => {
10834
+ if (el.contains(event.target) && !popper2.hasAttribute("data-show")) {
10835
+ show();
10836
+ } else if (popper2.hasAttribute("data-show")) {
10837
+ hide2();
10900
10838
  }
10901
- const placementsSortedByLeastOverflow = allOverflows.slice().sort((a2, b2) => a2.overflows[0] - b2.overflows[0]);
10902
- const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find((_ref) => {
10903
- let {
10904
- overflows
10905
- } = _ref;
10906
- return overflows.every((overflow2) => overflow2 <= 0);
10907
- })) == null ? void 0 : _placementsSortedByLe.placement;
10908
- const resetPlacement = placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement;
10909
- if (resetPlacement !== placement) {
10910
- return {
10911
- data: {
10912
- index: currentIndex + 1,
10913
- overflows: allOverflows
10914
- },
10915
- reset: {
10916
- placement: resetPlacement
10917
- }
10918
- };
10919
- }
10920
- return {};
10921
- }
10922
- };
10923
- };
10924
- function getExpandedPlacements(placement) {
10925
- const oppositePlacement = getOppositePlacement(placement);
10926
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
10839
+ });
10840
+ }
10841
+ if (showOnInit)
10842
+ show();
10843
+ function show() {
10844
+ popper2.setAttribute("data-show", "");
10845
+ onShow();
10846
+ popperInstance.setOptions((options2) => __spreadProps(__spreadValues({}, options2), {
10847
+ modifiers: [
10848
+ ...options2.modifiers,
10849
+ { name: "eventListeners", enabled: true }
10850
+ ]
10851
+ }));
10852
+ popperInstance.update();
10853
+ }
10854
+ function hide2() {
10855
+ popper2.removeAttribute("data-show");
10856
+ onHide();
10857
+ popperInstance.setOptions((options2) => __spreadProps(__spreadValues({}, options2), {
10858
+ modifiers: [
10859
+ ...options2.modifiers,
10860
+ { name: "eventListeners", enabled: false }
10861
+ ]
10862
+ }));
10863
+ }
10927
10864
  }
10928
- const flip = function(options) {
10929
- if (options === void 0) {
10930
- options = {};
10865
+ var Arrow = defineComponent({
10866
+ name: "PopArrow",
10867
+ render() {
10868
+ const arrowClassName = resolveClassName("pop2-arrow");
10869
+ return createVNode("div", {
10870
+ "class": arrowClassName
10871
+ }, null);
10931
10872
  }
10932
- return {
10933
- name: "flip",
10934
- options,
10935
- async fn(middlewareArguments) {
10936
- var _middlewareData$flip;
10937
- const {
10938
- placement,
10939
- middlewareData,
10940
- rects,
10941
- initialPlacement,
10942
- platform: platform2,
10943
- elements
10944
- } = middlewareArguments;
10945
- const _a = options, {
10946
- mainAxis: checkMainAxis = true,
10947
- crossAxis: checkCrossAxis = true,
10948
- fallbackPlacements: specifiedFallbackPlacements,
10949
- fallbackStrategy = "bestFit",
10950
- flipAlignment = true
10951
- } = _a, detectOverflowOptions = __objRest(_a, [
10952
- "mainAxis",
10953
- "crossAxis",
10954
- "fallbackPlacements",
10955
- "fallbackStrategy",
10956
- "flipAlignment"
10957
- ]);
10958
- const side = getSide(placement);
10959
- const isBasePlacement = side === initialPlacement;
10960
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
10961
- const placements2 = [initialPlacement, ...fallbackPlacements];
10962
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
10963
- const overflows = [];
10964
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
10965
- if (checkMainAxis) {
10966
- overflows.push(overflow[side]);
10967
- }
10968
- if (checkCrossAxis) {
10969
- const {
10970
- main: main2,
10971
- cross
10972
- } = getAlignmentSides(placement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
10973
- overflows.push(overflow[main2], overflow[cross]);
10974
- }
10975
- overflowsData = [...overflowsData, {
10976
- placement,
10977
- overflows
10978
- }];
10979
- if (!overflows.every((side2) => side2 <= 0)) {
10980
- var _middlewareData$flip$, _middlewareData$flip2;
10981
- const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
10982
- const nextPlacement = placements2[nextIndex];
10983
- if (nextPlacement) {
10984
- return {
10985
- data: {
10986
- index: nextIndex,
10987
- overflows: overflowsData
10988
- },
10989
- reset: {
10990
- placement: nextPlacement
10991
- }
10992
- };
10993
- }
10994
- let resetPlacement = "bottom";
10995
- switch (fallbackStrategy) {
10996
- case "bestFit": {
10997
- var _overflowsData$map$so;
10998
- const placement2 = (_overflowsData$map$so = overflowsData.map((d2) => [d2, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
10999
- if (placement2) {
11000
- resetPlacement = placement2;
11001
- }
11002
- break;
11003
- }
11004
- case "initialPlacement":
11005
- resetPlacement = initialPlacement;
11006
- break;
11007
- }
11008
- if (placement !== resetPlacement) {
11009
- return {
11010
- reset: {
11011
- placement: resetPlacement
11012
- }
11013
- };
11014
- }
10873
+ });
10874
+ const EMPTY$2 = (..._args) => true;
10875
+ let EMITEVENTS$1;
10876
+ (function(EMITEVENTS2) {
10877
+ EMITEVENTS2["SHOW"] = "show";
10878
+ EMITEVENTS2["HIDE"] = "hide";
10879
+ EMITEVENTS2["CLICK_OUTSIDE"] = "clickoutside";
10880
+ })(EMITEVENTS$1 || (EMITEVENTS$1 = {}));
10881
+ const EMIT_EVENT_TYPES$1 = {
10882
+ [EMITEVENTS$1.SHOW]: EMPTY$2,
10883
+ [EMITEVENTS$1.HIDE]: EMPTY$2,
10884
+ [EMITEVENTS$1.CLICK_OUTSIDE]: EMPTY$2
10885
+ };
10886
+ var Content = defineComponent({
10887
+ name: "PopContent",
10888
+ props: {
10889
+ width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def("auto"),
10890
+ height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def("auto")
10891
+ },
10892
+ setup(props) {
10893
+ const resolveValToPix = (val) => {
10894
+ if (/^\d+\.?\d*$/.test(`${val}`)) {
10895
+ return `${val}px`;
11015
10896
  }
11016
- return {};
11017
- }
11018
- };
10897
+ return val;
10898
+ };
10899
+ const style = computed(() => ({
10900
+ width: resolveValToPix(props.width),
10901
+ height: resolveValToPix(props.height)
10902
+ }));
10903
+ return {
10904
+ style
10905
+ };
10906
+ },
10907
+ render() {
10908
+ var _a, _b, _c, _d, _e, _f;
10909
+ const className = [resolveClassName("popover2"), resolveClassName("pop2-content")];
10910
+ return createVNode("div", {
10911
+ "class": className,
10912
+ "tabindex": "-1",
10913
+ "style": this.style
10914
+ }, [(_c = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) != null ? _c : "", (_f = (_e = (_d = this.$slots).arrow) == null ? void 0 : _e.call(_d)) != null ? _f : ""]);
10915
+ }
10916
+ });
10917
+ const placements = ["auto", "auto-start", "auto-end", "top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "right", "right-start", "right-end", "left", "left-start", "left-end"];
10918
+ const EventProps$1 = {
10919
+ onAfterHidden: Function,
10920
+ onAfterShow: Function
11019
10921
  };
11020
- function getSideOffsets(overflow, rect) {
11021
- return {
11022
- top: overflow.top - rect.height,
11023
- right: overflow.right - rect.width,
11024
- bottom: overflow.bottom - rect.height,
11025
- left: overflow.left - rect.width
11026
- };
10922
+ const PopoverProps = __spreadValues({
10923
+ isShow: PropTypes.bool.def(false),
10924
+ always: PropTypes.bool.def(false),
10925
+ disabled: PropTypes.bool.def(false),
10926
+ width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def("auto"),
10927
+ height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def("auto"),
10928
+ content: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def(""),
10929
+ placement: PropTypes.placement(placements).def("top"),
10930
+ theme: PropTypes.string.def("dark"),
10931
+ trigger: PropTypes.string.def("hover"),
10932
+ arrow: PropTypes.bool.def(true),
10933
+ padding: PropTypes.number.def(5),
10934
+ offset: PropTypes.number.def(6),
10935
+ boundary: PropTypes.string.def(void 0),
10936
+ zIndex: PropTypes.number.def(void 0),
10937
+ disableTeleport: PropTypes.bool.def(false),
10938
+ autoPlacement: PropTypes.bool.def(false),
10939
+ disableOutsideClick: PropTypes.bool.def(false)
10940
+ }, EventProps$1);
10941
+ var Reference = defineComponent({
10942
+ name: "PopReference",
10943
+ render() {
10944
+ var _a, _b, _c;
10945
+ return (_c = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) != null ? _c : "";
10946
+ }
10947
+ });
10948
+ function getSide(placement) {
10949
+ return placement.split("-")[0];
11027
10950
  }
11028
- function isAnySideFullyClipped(overflow) {
11029
- return sides.some((side) => overflow[side] >= 0);
10951
+ function getAlignment(placement) {
10952
+ return placement.split("-")[1];
11030
10953
  }
11031
- const hide = function(_temp) {
11032
- let _a = _temp === void 0 ? {} : _temp, {
11033
- strategy = "referenceHidden"
11034
- } = _a, detectOverflowOptions = __objRest(_a, [
11035
- "strategy"
11036
- ]);
11037
- return {
11038
- name: "hide",
11039
- async fn(middlewareArguments) {
11040
- const {
11041
- rects
11042
- } = middlewareArguments;
11043
- switch (strategy) {
11044
- case "referenceHidden": {
11045
- const overflow = await detectOverflow(middlewareArguments, __spreadProps(__spreadValues({}, detectOverflowOptions), {
11046
- elementContext: "reference"
11047
- }));
11048
- const offsets = getSideOffsets(overflow, rects.reference);
11049
- return {
11050
- data: {
11051
- referenceHiddenOffsets: offsets,
11052
- referenceHidden: isAnySideFullyClipped(offsets)
11053
- }
11054
- };
11055
- }
11056
- case "escaped": {
11057
- const overflow = await detectOverflow(middlewareArguments, __spreadProps(__spreadValues({}, detectOverflowOptions), {
11058
- altBoundary: true
11059
- }));
11060
- const offsets = getSideOffsets(overflow, rects.floating);
11061
- return {
11062
- data: {
11063
- escapedOffsets: offsets,
11064
- escaped: isAnySideFullyClipped(offsets)
11065
- }
11066
- };
11067
- }
11068
- default: {
11069
- return {};
11070
- }
11071
- }
11072
- }
11073
- };
11074
- };
11075
- async function convertValueToCoords(middlewareArguments, value) {
11076
- const {
11077
- placement,
11078
- platform: platform2,
11079
- elements
11080
- } = middlewareArguments;
11081
- const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
11082
- const side = getSide(placement);
11083
- const alignment = getAlignment(placement);
11084
- const isVertical = getMainAxisFromPlacement(placement) === "x";
11085
- const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
11086
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
11087
- const rawValue = typeof value === "function" ? value(middlewareArguments) : value;
10954
+ function getMainAxisFromPlacement(placement) {
10955
+ return ["top", "bottom"].includes(getSide(placement)) ? "x" : "y";
10956
+ }
10957
+ function getLengthFromAxis(axis) {
10958
+ return axis === "y" ? "height" : "width";
10959
+ }
10960
+ function computeCoordsFromPlacement(_ref, placement, rtl) {
11088
10961
  let {
11089
- mainAxis,
11090
- crossAxis,
11091
- alignmentAxis
11092
- } = typeof rawValue === "number" ? {
11093
- mainAxis: rawValue,
11094
- crossAxis: 0,
11095
- alignmentAxis: null
11096
- } : __spreadValues({
11097
- mainAxis: 0,
11098
- crossAxis: 0,
11099
- alignmentAxis: null
11100
- }, rawValue);
11101
- if (alignment && typeof alignmentAxis === "number") {
11102
- crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
10962
+ reference: reference2,
10963
+ floating
10964
+ } = _ref;
10965
+ const commonX = reference2.x + reference2.width / 2 - floating.width / 2;
10966
+ const commonY = reference2.y + reference2.height / 2 - floating.height / 2;
10967
+ const mainAxis = getMainAxisFromPlacement(placement);
10968
+ const length = getLengthFromAxis(mainAxis);
10969
+ const commonAlign = reference2[length] / 2 - floating[length] / 2;
10970
+ const side = getSide(placement);
10971
+ const isVertical = mainAxis === "x";
10972
+ let coords;
10973
+ switch (side) {
10974
+ case "top":
10975
+ coords = {
10976
+ x: commonX,
10977
+ y: reference2.y - floating.height
10978
+ };
10979
+ break;
10980
+ case "bottom":
10981
+ coords = {
10982
+ x: commonX,
10983
+ y: reference2.y + reference2.height
10984
+ };
10985
+ break;
10986
+ case "right":
10987
+ coords = {
10988
+ x: reference2.x + reference2.width,
10989
+ y: commonY
10990
+ };
10991
+ break;
10992
+ case "left":
10993
+ coords = {
10994
+ x: reference2.x - floating.width,
10995
+ y: commonY
10996
+ };
10997
+ break;
10998
+ default:
10999
+ coords = {
11000
+ x: reference2.x,
11001
+ y: reference2.y
11002
+ };
11103
11003
  }
11104
- return isVertical ? {
11105
- x: crossAxis * crossAxisMulti,
11106
- y: mainAxis * mainAxisMulti
11107
- } : {
11108
- x: mainAxis * mainAxisMulti,
11109
- y: crossAxis * crossAxisMulti
11110
- };
11004
+ switch (getAlignment(placement)) {
11005
+ case "start":
11006
+ coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
11007
+ break;
11008
+ case "end":
11009
+ coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
11010
+ break;
11011
+ }
11012
+ return coords;
11111
11013
  }
11112
- const offset = function(value) {
11113
- if (value === void 0) {
11114
- value = 0;
11014
+ const computePosition$1 = async (reference2, floating, config) => {
11015
+ const {
11016
+ placement = "bottom",
11017
+ strategy = "absolute",
11018
+ middleware = [],
11019
+ platform: platform2
11020
+ } = config;
11021
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
11022
+ let rects = await platform2.getElementRects({
11023
+ reference: reference2,
11024
+ floating,
11025
+ strategy
11026
+ });
11027
+ let {
11028
+ x: x2,
11029
+ y: y2
11030
+ } = computeCoordsFromPlacement(rects, placement, rtl);
11031
+ let statefulPlacement = placement;
11032
+ let middlewareData = {};
11033
+ for (let i2 = 0; i2 < middleware.length; i2++) {
11034
+ const {
11035
+ name,
11036
+ fn: fn2
11037
+ } = middleware[i2];
11038
+ const {
11039
+ x: nextX,
11040
+ y: nextY,
11041
+ data: data2,
11042
+ reset: reset2
11043
+ } = await fn2({
11044
+ x: x2,
11045
+ y: y2,
11046
+ initialPlacement: placement,
11047
+ placement: statefulPlacement,
11048
+ strategy,
11049
+ middlewareData,
11050
+ rects,
11051
+ platform: platform2,
11052
+ elements: {
11053
+ reference: reference2,
11054
+ floating
11055
+ }
11056
+ });
11057
+ x2 = nextX != null ? nextX : x2;
11058
+ y2 = nextY != null ? nextY : y2;
11059
+ middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
11060
+ [name]: __spreadValues(__spreadValues({}, middlewareData[name]), data2)
11061
+ });
11062
+ if (reset2) {
11063
+ if (typeof reset2 === "object") {
11064
+ if (reset2.placement) {
11065
+ statefulPlacement = reset2.placement;
11066
+ }
11067
+ if (reset2.rects) {
11068
+ rects = reset2.rects === true ? await platform2.getElementRects({
11069
+ reference: reference2,
11070
+ floating,
11071
+ strategy
11072
+ }) : reset2.rects;
11073
+ }
11074
+ ({
11075
+ x: x2,
11076
+ y: y2
11077
+ } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
11078
+ }
11079
+ i2 = -1;
11080
+ continue;
11081
+ }
11115
11082
  }
11116
11083
  return {
11117
- name: "offset",
11118
- options: value,
11119
- async fn(middlewareArguments) {
11120
- const {
11121
- x: x2,
11122
- y: y2
11123
- } = middlewareArguments;
11124
- const diffCoords = await convertValueToCoords(middlewareArguments, value);
11125
- return {
11126
- x: x2 + diffCoords.x,
11127
- y: y2 + diffCoords.y,
11128
- data: diffCoords
11129
- };
11130
- }
11084
+ x: x2,
11085
+ y: y2,
11086
+ placement: statefulPlacement,
11087
+ strategy,
11088
+ middlewareData
11131
11089
  };
11132
11090
  };
11133
- function getCrossAxis(axis) {
11134
- return axis === "x" ? "y" : "x";
11091
+ function expandPaddingObject(padding) {
11092
+ return __spreadValues({
11093
+ top: 0,
11094
+ right: 0,
11095
+ bottom: 0,
11096
+ left: 0
11097
+ }, padding);
11135
11098
  }
11136
- const shift = function(options) {
11099
+ function getSideObjectFromPadding(padding) {
11100
+ return typeof padding !== "number" ? expandPaddingObject(padding) : {
11101
+ top: padding,
11102
+ right: padding,
11103
+ bottom: padding,
11104
+ left: padding
11105
+ };
11106
+ }
11107
+ function rectToClientRect(rect) {
11108
+ return __spreadProps(__spreadValues({}, rect), {
11109
+ top: rect.y,
11110
+ left: rect.x,
11111
+ right: rect.x + rect.width,
11112
+ bottom: rect.y + rect.height
11113
+ });
11114
+ }
11115
+ async function detectOverflow(middlewareArguments, options) {
11116
+ var _await$platform$isEle;
11137
11117
  if (options === void 0) {
11138
11118
  options = {};
11139
11119
  }
11120
+ const {
11121
+ x: x2,
11122
+ y: y2,
11123
+ platform: platform2,
11124
+ rects,
11125
+ elements,
11126
+ strategy
11127
+ } = middlewareArguments;
11128
+ const {
11129
+ boundary = "clippingAncestors",
11130
+ rootBoundary = "viewport",
11131
+ elementContext = "floating",
11132
+ altBoundary = false,
11133
+ padding = 0
11134
+ } = options;
11135
+ const paddingObject = getSideObjectFromPadding(padding);
11136
+ const altContext = elementContext === "floating" ? "reference" : "floating";
11137
+ const element = elements[altBoundary ? altContext : elementContext];
11138
+ const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
11139
+ element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
11140
+ boundary,
11141
+ rootBoundary,
11142
+ strategy
11143
+ }));
11144
+ const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
11145
+ rect: elementContext === "floating" ? __spreadProps(__spreadValues({}, rects.floating), {
11146
+ x: x2,
11147
+ y: y2
11148
+ }) : rects.reference,
11149
+ offsetParent: await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)),
11150
+ strategy
11151
+ }) : rects[elementContext]);
11140
11152
  return {
11141
- name: "shift",
11142
- options,
11143
- async fn(middlewareArguments) {
11144
- const {
11145
- x: x2,
11146
- y: y2,
11147
- placement
11148
- } = middlewareArguments;
11149
- const _a = options, {
11150
- mainAxis: checkMainAxis = true,
11151
- crossAxis: checkCrossAxis = false,
11152
- limiter = {
11153
- fn: (_ref) => {
11154
- let {
11155
- x: x3,
11156
- y: y3
11157
- } = _ref;
11158
- return {
11159
- x: x3,
11160
- y: y3
11161
- };
11162
- }
11163
- }
11164
- } = _a, detectOverflowOptions = __objRest(_a, [
11165
- "mainAxis",
11166
- "crossAxis",
11167
- "limiter"
11168
- ]);
11169
- const coords = {
11170
- x: x2,
11171
- y: y2
11172
- };
11173
- const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
11174
- const mainAxis = getMainAxisFromPlacement(getSide(placement));
11175
- const crossAxis = getCrossAxis(mainAxis);
11176
- let mainAxisCoord = coords[mainAxis];
11177
- let crossAxisCoord = coords[crossAxis];
11178
- if (checkMainAxis) {
11179
- const minSide = mainAxis === "y" ? "top" : "left";
11180
- const maxSide = mainAxis === "y" ? "bottom" : "right";
11181
- const min2 = mainAxisCoord + overflow[minSide];
11182
- const max2 = mainAxisCoord - overflow[maxSide];
11183
- mainAxisCoord = within(min2, mainAxisCoord, max2);
11184
- }
11185
- if (checkCrossAxis) {
11186
- const minSide = crossAxis === "y" ? "top" : "left";
11187
- const maxSide = crossAxis === "y" ? "bottom" : "right";
11188
- const min2 = crossAxisCoord + overflow[minSide];
11189
- const max2 = crossAxisCoord - overflow[maxSide];
11190
- crossAxisCoord = within(min2, crossAxisCoord, max2);
11191
- }
11192
- const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, middlewareArguments), {
11193
- [mainAxis]: mainAxisCoord,
11194
- [crossAxis]: crossAxisCoord
11195
- }));
11196
- return __spreadProps(__spreadValues({}, limitedCoords), {
11197
- data: {
11198
- x: limitedCoords.x - x2,
11199
- y: limitedCoords.y - y2
11200
- }
11201
- });
11153
+ top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
11154
+ bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
11155
+ left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
11156
+ right: elementClientRect.right - clippingClientRect.right + paddingObject.right
11157
+ };
11158
+ }
11159
+ const min$1 = Math.min;
11160
+ const max$1 = Math.max;
11161
+ function within(min$1$1, value, max$1$1) {
11162
+ return max$1(min$1$1, min$1(value, max$1$1));
11163
+ }
11164
+ const arrow = (options) => ({
11165
+ name: "arrow",
11166
+ options,
11167
+ async fn(middlewareArguments) {
11168
+ const {
11169
+ element,
11170
+ padding = 0
11171
+ } = options != null ? options : {};
11172
+ const {
11173
+ x: x2,
11174
+ y: y2,
11175
+ placement,
11176
+ rects,
11177
+ platform: platform2
11178
+ } = middlewareArguments;
11179
+ if (element == null) {
11180
+ return {};
11181
+ }
11182
+ const paddingObject = getSideObjectFromPadding(padding);
11183
+ const coords = {
11184
+ x: x2,
11185
+ y: y2
11186
+ };
11187
+ const axis = getMainAxisFromPlacement(placement);
11188
+ const alignment = getAlignment(placement);
11189
+ const length = getLengthFromAxis(axis);
11190
+ const arrowDimensions = await platform2.getDimensions(element);
11191
+ const minProp = axis === "y" ? "top" : "left";
11192
+ const maxProp = axis === "y" ? "bottom" : "right";
11193
+ const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
11194
+ const startDiff = coords[axis] - rects.reference[axis];
11195
+ const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element));
11196
+ let clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
11197
+ if (clientSize === 0) {
11198
+ clientSize = rects.floating[length];
11202
11199
  }
11200
+ const centerToReference = endDiff / 2 - startDiff / 2;
11201
+ const min2 = paddingObject[minProp];
11202
+ const max2 = clientSize - arrowDimensions[length] - paddingObject[maxProp];
11203
+ const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
11204
+ const offset2 = within(min2, center, max2);
11205
+ const alignmentPadding = alignment === "start" ? paddingObject[minProp] : paddingObject[maxProp];
11206
+ const shouldAddOffset = alignmentPadding > 0 && center !== offset2 && rects.reference[length] <= rects.floating[length];
11207
+ const alignmentOffset = shouldAddOffset ? center < min2 ? min2 - center : max2 - center : 0;
11208
+ return {
11209
+ [axis]: coords[axis] - alignmentOffset,
11210
+ data: {
11211
+ [axis]: offset2,
11212
+ centerOffset: center - offset2
11213
+ }
11214
+ };
11215
+ }
11216
+ });
11217
+ const hash$1 = {
11218
+ left: "right",
11219
+ right: "left",
11220
+ bottom: "top",
11221
+ top: "bottom"
11222
+ };
11223
+ function getOppositePlacement(placement) {
11224
+ return placement.replace(/left|right|bottom|top/g, (matched) => hash$1[matched]);
11225
+ }
11226
+ function getAlignmentSides(placement, rects, rtl) {
11227
+ if (rtl === void 0) {
11228
+ rtl = false;
11229
+ }
11230
+ const alignment = getAlignment(placement);
11231
+ const mainAxis = getMainAxisFromPlacement(placement);
11232
+ const length = getLengthFromAxis(mainAxis);
11233
+ let mainAlignmentSide = mainAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
11234
+ if (rects.reference[length] > rects.floating[length]) {
11235
+ mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
11236
+ }
11237
+ return {
11238
+ main: mainAlignmentSide,
11239
+ cross: getOppositePlacement(mainAlignmentSide)
11203
11240
  };
11241
+ }
11242
+ const hash = {
11243
+ start: "end",
11244
+ end: "start"
11204
11245
  };
11205
- const inline = function(options) {
11246
+ function getOppositeAlignmentPlacement(placement) {
11247
+ return placement.replace(/start|end/g, (matched) => hash[matched]);
11248
+ }
11249
+ const sides = ["top", "right", "bottom", "left"];
11250
+ const allPlacements = /* @__PURE__ */ sides.reduce((acc, side) => acc.concat(side, side + "-start", side + "-end"), []);
11251
+ function getPlacementList(alignment, autoAlignment, allowedPlacements) {
11252
+ const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter((placement) => getAlignment(placement) === alignment), ...allowedPlacements.filter((placement) => getAlignment(placement) !== alignment)] : allowedPlacements.filter((placement) => getSide(placement) === placement);
11253
+ return allowedPlacementsSortedByAlignment.filter((placement) => {
11254
+ if (alignment) {
11255
+ return getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
11256
+ }
11257
+ return true;
11258
+ });
11259
+ }
11260
+ const autoPlacement = function(options) {
11206
11261
  if (options === void 0) {
11207
11262
  options = {};
11208
11263
  }
11209
11264
  return {
11210
- name: "inline",
11265
+ name: "autoPlacement",
11211
11266
  options,
11212
11267
  async fn(middlewareArguments) {
11213
- var _await$platform$getCl;
11268
+ var _middlewareData$autoP, _middlewareData$autoP2, _middlewareData$autoP3, _middlewareData$autoP4, _placementsSortedByLe;
11214
11269
  const {
11215
- placement,
11216
- elements,
11270
+ x: x2,
11271
+ y: y2,
11217
11272
  rects,
11273
+ middlewareData,
11274
+ placement,
11218
11275
  platform: platform2,
11219
- strategy
11276
+ elements
11220
11277
  } = middlewareArguments;
11221
- const {
11222
- padding = 2,
11223
- x: x2,
11224
- y: y2
11225
- } = options;
11226
- const fallback = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
11227
- rect: rects.reference,
11228
- offsetParent: await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)),
11229
- strategy
11230
- }) : rects.reference);
11231
- const clientRects = (_await$platform$getCl = await (platform2.getClientRects == null ? void 0 : platform2.getClientRects(elements.reference))) != null ? _await$platform$getCl : [];
11232
- const paddingObject = getSideObjectFromPadding(padding);
11233
- function getBoundingClientRect2() {
11234
- if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x2 != null && y2 != null) {
11235
- var _clientRects$find;
11236
- return (_clientRects$find = clientRects.find((rect) => x2 > rect.left - paddingObject.left && x2 < rect.right + paddingObject.right && y2 > rect.top - paddingObject.top && y2 < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;
11237
- }
11238
- if (clientRects.length >= 2) {
11239
- if (getMainAxisFromPlacement(placement) === "x") {
11240
- const firstRect = clientRects[0];
11241
- const lastRect = clientRects[clientRects.length - 1];
11242
- const isTop = getSide(placement) === "top";
11243
- const top3 = firstRect.top;
11244
- const bottom3 = lastRect.bottom;
11245
- const left3 = isTop ? firstRect.left : lastRect.left;
11246
- const right3 = isTop ? firstRect.right : lastRect.right;
11247
- const width2 = right3 - left3;
11248
- const height2 = bottom3 - top3;
11249
- return {
11250
- top: top3,
11251
- bottom: bottom3,
11252
- left: left3,
11253
- right: right3,
11254
- width: width2,
11255
- height: height2,
11256
- x: left3,
11257
- y: top3
11258
- };
11259
- }
11260
- const isLeftSide = getSide(placement) === "left";
11261
- const maxRight = max$1(...clientRects.map((rect) => rect.right));
11262
- const minLeft = min$1(...clientRects.map((rect) => rect.left));
11263
- const measureRects = clientRects.filter((rect) => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
11264
- const top2 = measureRects[0].top;
11265
- const bottom2 = measureRects[measureRects.length - 1].bottom;
11266
- const left2 = minLeft;
11267
- const right2 = maxRight;
11268
- const width = right2 - left2;
11269
- const height = bottom2 - top2;
11270
- return {
11271
- top: top2,
11272
- bottom: bottom2,
11273
- left: left2,
11274
- right: right2,
11275
- width,
11276
- height,
11277
- x: left2,
11278
- y: top2
11279
- };
11280
- }
11281
- return fallback;
11278
+ const _a = options, {
11279
+ alignment = null,
11280
+ allowedPlacements = allPlacements,
11281
+ autoAlignment = true
11282
+ } = _a, detectOverflowOptions = __objRest(_a, [
11283
+ "alignment",
11284
+ "allowedPlacements",
11285
+ "autoAlignment"
11286
+ ]);
11287
+ const placements2 = getPlacementList(alignment, autoAlignment, allowedPlacements);
11288
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
11289
+ const currentIndex = (_middlewareData$autoP = (_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.index) != null ? _middlewareData$autoP : 0;
11290
+ const currentPlacement = placements2[currentIndex];
11291
+ if (currentPlacement == null) {
11292
+ return {};
11282
11293
  }
11283
- const resetRects = await platform2.getElementRects({
11284
- reference: {
11285
- getBoundingClientRect: getBoundingClientRect2
11286
- },
11287
- floating: elements.floating,
11288
- strategy
11289
- });
11290
- if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
11294
+ const {
11295
+ main: main2,
11296
+ cross
11297
+ } = getAlignmentSides(currentPlacement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
11298
+ if (placement !== currentPlacement) {
11291
11299
  return {
11300
+ x: x2,
11301
+ y: y2,
11292
11302
  reset: {
11293
- rects: resetRects
11303
+ placement: placements2[0]
11304
+ }
11305
+ };
11306
+ }
11307
+ const currentOverflows = [overflow[getSide(currentPlacement)], overflow[main2], overflow[cross]];
11308
+ const allOverflows = [...(_middlewareData$autoP3 = (_middlewareData$autoP4 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP4.overflows) != null ? _middlewareData$autoP3 : [], {
11309
+ placement: currentPlacement,
11310
+ overflows: currentOverflows
11311
+ }];
11312
+ const nextPlacement = placements2[currentIndex + 1];
11313
+ if (nextPlacement) {
11314
+ return {
11315
+ data: {
11316
+ index: currentIndex + 1,
11317
+ overflows: allOverflows
11318
+ },
11319
+ reset: {
11320
+ placement: nextPlacement
11321
+ }
11322
+ };
11323
+ }
11324
+ const placementsSortedByLeastOverflow = allOverflows.slice().sort((a2, b2) => a2.overflows[0] - b2.overflows[0]);
11325
+ const placementThatFitsOnAllSides = (_placementsSortedByLe = placementsSortedByLeastOverflow.find((_ref) => {
11326
+ let {
11327
+ overflows
11328
+ } = _ref;
11329
+ return overflows.every((overflow2) => overflow2 <= 0);
11330
+ })) == null ? void 0 : _placementsSortedByLe.placement;
11331
+ const resetPlacement = placementThatFitsOnAllSides != null ? placementThatFitsOnAllSides : placementsSortedByLeastOverflow[0].placement;
11332
+ if (resetPlacement !== placement) {
11333
+ return {
11334
+ data: {
11335
+ index: currentIndex + 1,
11336
+ overflows: allOverflows
11337
+ },
11338
+ reset: {
11339
+ placement: resetPlacement
11294
11340
  }
11295
11341
  };
11296
11342
  }
@@ -11298,734 +11344,1146 @@ const inline = function(options) {
11298
11344
  }
11299
11345
  };
11300
11346
  };
11301
- function isWindow(value) {
11302
- return value && value.document && value.location && value.alert && value.setInterval;
11303
- }
11304
- function getWindow(node) {
11305
- if (node == null) {
11306
- return window;
11307
- }
11308
- if (!isWindow(node)) {
11309
- const ownerDocument = node.ownerDocument;
11310
- return ownerDocument ? ownerDocument.defaultView || window : window;
11311
- }
11312
- return node;
11313
- }
11314
- function getComputedStyle$1(element) {
11315
- return getWindow(element).getComputedStyle(element);
11316
- }
11317
- function getNodeName(node) {
11318
- return isWindow(node) ? "" : node ? (node.nodeName || "").toLowerCase() : "";
11319
- }
11320
- function getUAString() {
11321
- const uaData = navigator.userAgentData;
11322
- if (uaData != null && uaData.brands) {
11323
- return uaData.brands.map((item) => item.brand + "/" + item.version).join(" ");
11324
- }
11325
- return navigator.userAgent;
11326
- }
11327
- function isHTMLElement(value) {
11328
- return value instanceof getWindow(value).HTMLElement;
11329
- }
11330
- function isElement$1(value) {
11331
- return value instanceof getWindow(value).Element;
11332
- }
11333
- function isNode(value) {
11334
- return value instanceof getWindow(value).Node;
11335
- }
11336
- function isShadowRoot(node) {
11337
- if (typeof ShadowRoot === "undefined") {
11338
- return false;
11339
- }
11340
- const OwnElement = getWindow(node).ShadowRoot;
11341
- return node instanceof OwnElement || node instanceof ShadowRoot;
11342
- }
11343
- function isOverflowElement(element) {
11344
- const {
11345
- overflow,
11346
- overflowX,
11347
- overflowY
11348
- } = getComputedStyle$1(element);
11349
- return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
11350
- }
11351
- function isTableElement(element) {
11352
- return ["table", "td", "th"].includes(getNodeName(element));
11353
- }
11354
- function isContainingBlock(element) {
11355
- const isFirefox2 = /firefox/i.test(getUAString());
11356
- const css = getComputedStyle$1(element);
11357
- return css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].includes(css.willChange) || isFirefox2 && css.willChange === "filter" || isFirefox2 && (css.filter ? css.filter !== "none" : false);
11358
- }
11359
- function isLayoutViewport() {
11360
- return !/^((?!chrome|android).)*safari/i.test(getUAString());
11347
+ function getExpandedPlacements(placement) {
11348
+ const oppositePlacement = getOppositePlacement(placement);
11349
+ return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
11361
11350
  }
11362
- const min = Math.min;
11363
- const max = Math.max;
11364
- const round = Math.round;
11365
- function getBoundingClientRect(element, includeScale, isFixedStrategy) {
11366
- var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
11367
- if (includeScale === void 0) {
11368
- includeScale = false;
11369
- }
11370
- if (isFixedStrategy === void 0) {
11371
- isFixedStrategy = false;
11372
- }
11373
- const clientRect = element.getBoundingClientRect();
11374
- let scaleX = 1;
11375
- let scaleY = 1;
11376
- if (includeScale && isHTMLElement(element)) {
11377
- scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
11378
- scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
11351
+ const flip = function(options) {
11352
+ if (options === void 0) {
11353
+ options = {};
11379
11354
  }
11380
- const win = isElement$1(element) ? getWindow(element) : window;
11381
- const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
11382
- const x2 = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
11383
- const y2 = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
11384
- const width = clientRect.width / scaleX;
11385
- const height = clientRect.height / scaleY;
11386
11355
  return {
11387
- width,
11388
- height,
11389
- top: y2,
11390
- right: x2 + width,
11391
- bottom: y2 + height,
11392
- left: x2,
11393
- x: x2,
11394
- y: y2
11356
+ name: "flip",
11357
+ options,
11358
+ async fn(middlewareArguments) {
11359
+ var _middlewareData$flip;
11360
+ const {
11361
+ placement,
11362
+ middlewareData,
11363
+ rects,
11364
+ initialPlacement,
11365
+ platform: platform2,
11366
+ elements
11367
+ } = middlewareArguments;
11368
+ const _a = options, {
11369
+ mainAxis: checkMainAxis = true,
11370
+ crossAxis: checkCrossAxis = true,
11371
+ fallbackPlacements: specifiedFallbackPlacements,
11372
+ fallbackStrategy = "bestFit",
11373
+ flipAlignment = true
11374
+ } = _a, detectOverflowOptions = __objRest(_a, [
11375
+ "mainAxis",
11376
+ "crossAxis",
11377
+ "fallbackPlacements",
11378
+ "fallbackStrategy",
11379
+ "flipAlignment"
11380
+ ]);
11381
+ const side = getSide(placement);
11382
+ const isBasePlacement = side === initialPlacement;
11383
+ const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
11384
+ const placements2 = [initialPlacement, ...fallbackPlacements];
11385
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
11386
+ const overflows = [];
11387
+ let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
11388
+ if (checkMainAxis) {
11389
+ overflows.push(overflow[side]);
11390
+ }
11391
+ if (checkCrossAxis) {
11392
+ const {
11393
+ main: main2,
11394
+ cross
11395
+ } = getAlignmentSides(placement, rects, await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)));
11396
+ overflows.push(overflow[main2], overflow[cross]);
11397
+ }
11398
+ overflowsData = [...overflowsData, {
11399
+ placement,
11400
+ overflows
11401
+ }];
11402
+ if (!overflows.every((side2) => side2 <= 0)) {
11403
+ var _middlewareData$flip$, _middlewareData$flip2;
11404
+ const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
11405
+ const nextPlacement = placements2[nextIndex];
11406
+ if (nextPlacement) {
11407
+ return {
11408
+ data: {
11409
+ index: nextIndex,
11410
+ overflows: overflowsData
11411
+ },
11412
+ reset: {
11413
+ placement: nextPlacement
11414
+ }
11415
+ };
11416
+ }
11417
+ let resetPlacement = "bottom";
11418
+ switch (fallbackStrategy) {
11419
+ case "bestFit": {
11420
+ var _overflowsData$map$so;
11421
+ const placement2 = (_overflowsData$map$so = overflowsData.map((d2) => [d2, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$map$so[0].placement;
11422
+ if (placement2) {
11423
+ resetPlacement = placement2;
11424
+ }
11425
+ break;
11426
+ }
11427
+ case "initialPlacement":
11428
+ resetPlacement = initialPlacement;
11429
+ break;
11430
+ }
11431
+ if (placement !== resetPlacement) {
11432
+ return {
11433
+ reset: {
11434
+ placement: resetPlacement
11435
+ }
11436
+ };
11437
+ }
11438
+ }
11439
+ return {};
11440
+ }
11395
11441
  };
11396
- }
11397
- function getDocumentElement(node) {
11398
- return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
11399
- }
11400
- function getNodeScroll(element) {
11401
- if (isElement$1(element)) {
11402
- return {
11403
- scrollLeft: element.scrollLeft,
11404
- scrollTop: element.scrollTop
11405
- };
11406
- }
11442
+ };
11443
+ function getSideOffsets(overflow, rect) {
11407
11444
  return {
11408
- scrollLeft: element.pageXOffset,
11409
- scrollTop: element.pageYOffset
11445
+ top: overflow.top - rect.height,
11446
+ right: overflow.right - rect.width,
11447
+ bottom: overflow.bottom - rect.height,
11448
+ left: overflow.left - rect.width
11410
11449
  };
11411
11450
  }
11412
- function getWindowScrollBarX(element) {
11413
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
11414
- }
11415
- function isScaled(element) {
11416
- const rect = getBoundingClientRect(element);
11417
- return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
11451
+ function isAnySideFullyClipped(overflow) {
11452
+ return sides.some((side) => overflow[side] >= 0);
11418
11453
  }
11419
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
11420
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
11421
- const documentElement = getDocumentElement(offsetParent);
11422
- const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent), strategy === "fixed");
11423
- let scroll = {
11424
- scrollLeft: 0,
11425
- scrollTop: 0
11426
- };
11427
- const offsets = {
11428
- x: 0,
11429
- y: 0
11430
- };
11431
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
11432
- if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
11433
- scroll = getNodeScroll(offsetParent);
11434
- }
11435
- if (isHTMLElement(offsetParent)) {
11436
- const offsetRect = getBoundingClientRect(offsetParent, true);
11437
- offsets.x = offsetRect.x + offsetParent.clientLeft;
11438
- offsets.y = offsetRect.y + offsetParent.clientTop;
11439
- } else if (documentElement) {
11440
- offsets.x = getWindowScrollBarX(documentElement);
11441
- }
11442
- }
11454
+ const hide = function(_temp) {
11455
+ let _a = _temp === void 0 ? {} : _temp, {
11456
+ strategy = "referenceHidden"
11457
+ } = _a, detectOverflowOptions = __objRest(_a, [
11458
+ "strategy"
11459
+ ]);
11443
11460
  return {
11444
- x: rect.left + scroll.scrollLeft - offsets.x,
11445
- y: rect.top + scroll.scrollTop - offsets.y,
11446
- width: rect.width,
11447
- height: rect.height
11448
- };
11449
- }
11450
- function getParentNode(node) {
11451
- if (getNodeName(node) === "html") {
11452
- return node;
11453
- }
11454
- return node.assignedSlot || node.parentNode || (isShadowRoot(node) ? node.host : null) || getDocumentElement(node);
11455
- }
11456
- function getTrueOffsetParent(element) {
11457
- if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
11458
- return null;
11459
- }
11460
- return element.offsetParent;
11461
- }
11462
- function getContainingBlock(element) {
11463
- let currentNode = getParentNode(element);
11464
- if (isShadowRoot(currentNode)) {
11465
- currentNode = currentNode.host;
11466
- }
11467
- while (isHTMLElement(currentNode) && !["html", "body"].includes(getNodeName(currentNode))) {
11468
- if (isContainingBlock(currentNode)) {
11469
- return currentNode;
11470
- } else {
11471
- currentNode = currentNode.parentNode;
11461
+ name: "hide",
11462
+ async fn(middlewareArguments) {
11463
+ const {
11464
+ rects
11465
+ } = middlewareArguments;
11466
+ switch (strategy) {
11467
+ case "referenceHidden": {
11468
+ const overflow = await detectOverflow(middlewareArguments, __spreadProps(__spreadValues({}, detectOverflowOptions), {
11469
+ elementContext: "reference"
11470
+ }));
11471
+ const offsets = getSideOffsets(overflow, rects.reference);
11472
+ return {
11473
+ data: {
11474
+ referenceHiddenOffsets: offsets,
11475
+ referenceHidden: isAnySideFullyClipped(offsets)
11476
+ }
11477
+ };
11478
+ }
11479
+ case "escaped": {
11480
+ const overflow = await detectOverflow(middlewareArguments, __spreadProps(__spreadValues({}, detectOverflowOptions), {
11481
+ altBoundary: true
11482
+ }));
11483
+ const offsets = getSideOffsets(overflow, rects.floating);
11484
+ return {
11485
+ data: {
11486
+ escapedOffsets: offsets,
11487
+ escaped: isAnySideFullyClipped(offsets)
11488
+ }
11489
+ };
11490
+ }
11491
+ default: {
11492
+ return {};
11493
+ }
11494
+ }
11472
11495
  }
11473
- }
11474
- return null;
11475
- }
11476
- function getOffsetParent(element) {
11477
- const window2 = getWindow(element);
11478
- let offsetParent = getTrueOffsetParent(element);
11479
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
11480
- offsetParent = getTrueOffsetParent(offsetParent);
11481
- }
11482
- if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
11483
- return window2;
11484
- }
11485
- return offsetParent || getContainingBlock(element) || window2;
11486
- }
11487
- function getDimensions(element) {
11488
- if (isHTMLElement(element)) {
11489
- return {
11490
- width: element.offsetWidth,
11491
- height: element.offsetHeight
11492
- };
11493
- }
11494
- const rect = getBoundingClientRect(element);
11495
- return {
11496
- width: rect.width,
11497
- height: rect.height
11498
11496
  };
11499
- }
11500
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
11497
+ };
11498
+ async function convertValueToCoords(middlewareArguments, value) {
11499
+ const {
11500
+ placement,
11501
+ platform: platform2,
11502
+ elements
11503
+ } = middlewareArguments;
11504
+ const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating));
11505
+ const side = getSide(placement);
11506
+ const alignment = getAlignment(placement);
11507
+ const isVertical = getMainAxisFromPlacement(placement) === "x";
11508
+ const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1;
11509
+ const crossAxisMulti = rtl && isVertical ? -1 : 1;
11510
+ const rawValue = typeof value === "function" ? value(middlewareArguments) : value;
11501
11511
  let {
11502
- rect,
11503
- offsetParent,
11504
- strategy
11505
- } = _ref;
11506
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
11507
- const documentElement = getDocumentElement(offsetParent);
11508
- if (offsetParent === documentElement) {
11509
- return rect;
11512
+ mainAxis,
11513
+ crossAxis,
11514
+ alignmentAxis
11515
+ } = typeof rawValue === "number" ? {
11516
+ mainAxis: rawValue,
11517
+ crossAxis: 0,
11518
+ alignmentAxis: null
11519
+ } : __spreadValues({
11520
+ mainAxis: 0,
11521
+ crossAxis: 0,
11522
+ alignmentAxis: null
11523
+ }, rawValue);
11524
+ if (alignment && typeof alignmentAxis === "number") {
11525
+ crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
11510
11526
  }
11511
- let scroll = {
11512
- scrollLeft: 0,
11513
- scrollTop: 0
11514
- };
11515
- const offsets = {
11516
- x: 0,
11517
- y: 0
11527
+ return isVertical ? {
11528
+ x: crossAxis * crossAxisMulti,
11529
+ y: mainAxis * mainAxisMulti
11530
+ } : {
11531
+ x: mainAxis * mainAxisMulti,
11532
+ y: crossAxis * crossAxisMulti
11518
11533
  };
11519
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
11520
- if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
11521
- scroll = getNodeScroll(offsetParent);
11522
- }
11523
- if (isHTMLElement(offsetParent)) {
11524
- const offsetRect = getBoundingClientRect(offsetParent, true);
11525
- offsets.x = offsetRect.x + offsetParent.clientLeft;
11526
- offsets.y = offsetRect.y + offsetParent.clientTop;
11527
- }
11528
- }
11529
- return __spreadProps(__spreadValues({}, rect), {
11530
- x: rect.x - scroll.scrollLeft + offsets.x,
11531
- y: rect.y - scroll.scrollTop + offsets.y
11532
- });
11533
11534
  }
11534
- function getViewportRect(element, strategy) {
11535
- const win = getWindow(element);
11536
- const html = getDocumentElement(element);
11537
- const visualViewport = win.visualViewport;
11538
- let width = html.clientWidth;
11539
- let height = html.clientHeight;
11540
- let x2 = 0;
11541
- let y2 = 0;
11542
- if (visualViewport) {
11543
- width = visualViewport.width;
11544
- height = visualViewport.height;
11545
- const layoutViewport = isLayoutViewport();
11546
- if (layoutViewport || !layoutViewport && strategy === "fixed") {
11547
- x2 = visualViewport.offsetLeft;
11548
- y2 = visualViewport.offsetTop;
11549
- }
11535
+ const offset = function(value) {
11536
+ if (value === void 0) {
11537
+ value = 0;
11550
11538
  }
11551
11539
  return {
11552
- width,
11553
- height,
11554
- x: x2,
11555
- y: y2
11540
+ name: "offset",
11541
+ options: value,
11542
+ async fn(middlewareArguments) {
11543
+ const {
11544
+ x: x2,
11545
+ y: y2
11546
+ } = middlewareArguments;
11547
+ const diffCoords = await convertValueToCoords(middlewareArguments, value);
11548
+ return {
11549
+ x: x2 + diffCoords.x,
11550
+ y: y2 + diffCoords.y,
11551
+ data: diffCoords
11552
+ };
11553
+ }
11556
11554
  };
11555
+ };
11556
+ function getCrossAxis(axis) {
11557
+ return axis === "x" ? "y" : "x";
11557
11558
  }
11558
- function getDocumentRect(element) {
11559
- var _element$ownerDocumen;
11560
- const html = getDocumentElement(element);
11561
- const scroll = getNodeScroll(element);
11562
- const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
11563
- const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
11564
- const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
11565
- let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
11566
- const y2 = -scroll.scrollTop;
11567
- if (getComputedStyle$1(body || html).direction === "rtl") {
11568
- x2 += max(html.clientWidth, body ? body.clientWidth : 0) - width;
11559
+ const shift = function(options) {
11560
+ if (options === void 0) {
11561
+ options = {};
11569
11562
  }
11570
11563
  return {
11571
- width,
11572
- height,
11573
- x: x2,
11574
- y: y2
11575
- };
11576
- }
11577
- function getNearestOverflowAncestor(node) {
11578
- const parentNode = getParentNode(node);
11579
- if (["html", "body", "#document"].includes(getNodeName(parentNode))) {
11580
- return node.ownerDocument.body;
11581
- }
11582
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
11583
- return parentNode;
11584
- }
11585
- return getNearestOverflowAncestor(parentNode);
11586
- }
11587
- function getOverflowAncestors(node, list) {
11588
- var _node$ownerDocument;
11589
- if (list === void 0) {
11590
- list = [];
11591
- }
11592
- const scrollableAncestor = getNearestOverflowAncestor(node);
11593
- const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
11594
- const win = getWindow(scrollableAncestor);
11595
- const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
11596
- const updatedList = list.concat(target);
11597
- return isBody ? updatedList : updatedList.concat(getOverflowAncestors(target));
11598
- }
11599
- function contains(parent, child) {
11600
- const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
11601
- if (parent.contains(child)) {
11602
- return true;
11603
- } else if (rootNode && isShadowRoot(rootNode)) {
11604
- let next = child;
11605
- do {
11606
- if (next && parent === next) {
11607
- return true;
11564
+ name: "shift",
11565
+ options,
11566
+ async fn(middlewareArguments) {
11567
+ const {
11568
+ x: x2,
11569
+ y: y2,
11570
+ placement
11571
+ } = middlewareArguments;
11572
+ const _a = options, {
11573
+ mainAxis: checkMainAxis = true,
11574
+ crossAxis: checkCrossAxis = false,
11575
+ limiter = {
11576
+ fn: (_ref) => {
11577
+ let {
11578
+ x: x3,
11579
+ y: y3
11580
+ } = _ref;
11581
+ return {
11582
+ x: x3,
11583
+ y: y3
11584
+ };
11585
+ }
11586
+ }
11587
+ } = _a, detectOverflowOptions = __objRest(_a, [
11588
+ "mainAxis",
11589
+ "crossAxis",
11590
+ "limiter"
11591
+ ]);
11592
+ const coords = {
11593
+ x: x2,
11594
+ y: y2
11595
+ };
11596
+ const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
11597
+ const mainAxis = getMainAxisFromPlacement(getSide(placement));
11598
+ const crossAxis = getCrossAxis(mainAxis);
11599
+ let mainAxisCoord = coords[mainAxis];
11600
+ let crossAxisCoord = coords[crossAxis];
11601
+ if (checkMainAxis) {
11602
+ const minSide = mainAxis === "y" ? "top" : "left";
11603
+ const maxSide = mainAxis === "y" ? "bottom" : "right";
11604
+ const min2 = mainAxisCoord + overflow[minSide];
11605
+ const max2 = mainAxisCoord - overflow[maxSide];
11606
+ mainAxisCoord = within(min2, mainAxisCoord, max2);
11608
11607
  }
11609
- next = next.parentNode || next.host;
11610
- } while (next);
11608
+ if (checkCrossAxis) {
11609
+ const minSide = crossAxis === "y" ? "top" : "left";
11610
+ const maxSide = crossAxis === "y" ? "bottom" : "right";
11611
+ const min2 = crossAxisCoord + overflow[minSide];
11612
+ const max2 = crossAxisCoord - overflow[maxSide];
11613
+ crossAxisCoord = within(min2, crossAxisCoord, max2);
11614
+ }
11615
+ const limitedCoords = limiter.fn(__spreadProps(__spreadValues({}, middlewareArguments), {
11616
+ [mainAxis]: mainAxisCoord,
11617
+ [crossAxis]: crossAxisCoord
11618
+ }));
11619
+ return __spreadProps(__spreadValues({}, limitedCoords), {
11620
+ data: {
11621
+ x: limitedCoords.x - x2,
11622
+ y: limitedCoords.y - y2
11623
+ }
11624
+ });
11625
+ }
11626
+ };
11627
+ };
11628
+ const inline = function(options) {
11629
+ if (options === void 0) {
11630
+ options = {};
11611
11631
  }
11612
- return false;
11613
- }
11614
- function getInnerBoundingClientRect(element, strategy) {
11615
- const clientRect = getBoundingClientRect(element, false, strategy === "fixed");
11616
- const top2 = clientRect.top + element.clientTop;
11617
- const left2 = clientRect.left + element.clientLeft;
11618
11632
  return {
11619
- top: top2,
11620
- left: left2,
11621
- x: left2,
11622
- y: top2,
11623
- right: left2 + element.clientWidth,
11624
- bottom: top2 + element.clientHeight,
11625
- width: element.clientWidth,
11626
- height: element.clientHeight
11633
+ name: "inline",
11634
+ options,
11635
+ async fn(middlewareArguments) {
11636
+ var _await$platform$getCl;
11637
+ const {
11638
+ placement,
11639
+ elements,
11640
+ rects,
11641
+ platform: platform2,
11642
+ strategy
11643
+ } = middlewareArguments;
11644
+ const {
11645
+ padding = 2,
11646
+ x: x2,
11647
+ y: y2
11648
+ } = options;
11649
+ const fallback = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
11650
+ rect: rects.reference,
11651
+ offsetParent: await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)),
11652
+ strategy
11653
+ }) : rects.reference);
11654
+ const clientRects = (_await$platform$getCl = await (platform2.getClientRects == null ? void 0 : platform2.getClientRects(elements.reference))) != null ? _await$platform$getCl : [];
11655
+ const paddingObject = getSideObjectFromPadding(padding);
11656
+ function getBoundingClientRect2() {
11657
+ if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x2 != null && y2 != null) {
11658
+ var _clientRects$find;
11659
+ return (_clientRects$find = clientRects.find((rect) => x2 > rect.left - paddingObject.left && x2 < rect.right + paddingObject.right && y2 > rect.top - paddingObject.top && y2 < rect.bottom + paddingObject.bottom)) != null ? _clientRects$find : fallback;
11660
+ }
11661
+ if (clientRects.length >= 2) {
11662
+ if (getMainAxisFromPlacement(placement) === "x") {
11663
+ const firstRect = clientRects[0];
11664
+ const lastRect = clientRects[clientRects.length - 1];
11665
+ const isTop = getSide(placement) === "top";
11666
+ const top3 = firstRect.top;
11667
+ const bottom3 = lastRect.bottom;
11668
+ const left3 = isTop ? firstRect.left : lastRect.left;
11669
+ const right3 = isTop ? firstRect.right : lastRect.right;
11670
+ const width2 = right3 - left3;
11671
+ const height2 = bottom3 - top3;
11672
+ return {
11673
+ top: top3,
11674
+ bottom: bottom3,
11675
+ left: left3,
11676
+ right: right3,
11677
+ width: width2,
11678
+ height: height2,
11679
+ x: left3,
11680
+ y: top3
11681
+ };
11682
+ }
11683
+ const isLeftSide = getSide(placement) === "left";
11684
+ const maxRight = max$1(...clientRects.map((rect) => rect.right));
11685
+ const minLeft = min$1(...clientRects.map((rect) => rect.left));
11686
+ const measureRects = clientRects.filter((rect) => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
11687
+ const top2 = measureRects[0].top;
11688
+ const bottom2 = measureRects[measureRects.length - 1].bottom;
11689
+ const left2 = minLeft;
11690
+ const right2 = maxRight;
11691
+ const width = right2 - left2;
11692
+ const height = bottom2 - top2;
11693
+ return {
11694
+ top: top2,
11695
+ bottom: bottom2,
11696
+ left: left2,
11697
+ right: right2,
11698
+ width,
11699
+ height,
11700
+ x: left2,
11701
+ y: top2
11702
+ };
11703
+ }
11704
+ return fallback;
11705
+ }
11706
+ const resetRects = await platform2.getElementRects({
11707
+ reference: {
11708
+ getBoundingClientRect: getBoundingClientRect2
11709
+ },
11710
+ floating: elements.floating,
11711
+ strategy
11712
+ });
11713
+ if (rects.reference.x !== resetRects.reference.x || rects.reference.y !== resetRects.reference.y || rects.reference.width !== resetRects.reference.width || rects.reference.height !== resetRects.reference.height) {
11714
+ return {
11715
+ reset: {
11716
+ rects: resetRects
11717
+ }
11718
+ };
11719
+ }
11720
+ return {};
11721
+ }
11627
11722
  };
11723
+ };
11724
+ function isWindow(value) {
11725
+ return value && value.document && value.location && value.alert && value.setInterval;
11628
11726
  }
11629
- function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
11630
- if (clippingParent === "viewport") {
11631
- return rectToClientRect(getViewportRect(element, strategy));
11727
+ function getWindow(node) {
11728
+ if (node == null) {
11729
+ return window;
11632
11730
  }
11633
- if (isElement$1(clippingParent)) {
11634
- return getInnerBoundingClientRect(clippingParent, strategy);
11731
+ if (!isWindow(node)) {
11732
+ const ownerDocument = node.ownerDocument;
11733
+ return ownerDocument ? ownerDocument.defaultView || window : window;
11635
11734
  }
11636
- return rectToClientRect(getDocumentRect(getDocumentElement(element)));
11735
+ return node;
11637
11736
  }
11638
- function getClippingAncestors(element) {
11639
- const clippingAncestors = getOverflowAncestors(element);
11640
- const canEscapeClipping = ["absolute", "fixed"].includes(getComputedStyle$1(element).position);
11641
- const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
11642
- if (!isElement$1(clipperElement)) {
11643
- return [];
11644
- }
11645
- return clippingAncestors.filter((clippingAncestors2) => isElement$1(clippingAncestors2) && contains(clippingAncestors2, clipperElement) && getNodeName(clippingAncestors2) !== "body");
11737
+ function getComputedStyle$1(element) {
11738
+ return getWindow(element).getComputedStyle(element);
11646
11739
  }
11647
- function getClippingRect(_ref) {
11648
- let {
11649
- element,
11650
- boundary,
11651
- rootBoundary,
11652
- strategy
11653
- } = _ref;
11654
- const mainClippingAncestors = boundary === "clippingAncestors" ? getClippingAncestors(element) : [].concat(boundary);
11655
- const clippingAncestors = [...mainClippingAncestors, rootBoundary];
11656
- const firstClippingAncestor = clippingAncestors[0];
11657
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
11658
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
11659
- accRect.top = max(rect.top, accRect.top);
11660
- accRect.right = min(rect.right, accRect.right);
11661
- accRect.bottom = min(rect.bottom, accRect.bottom);
11662
- accRect.left = max(rect.left, accRect.left);
11663
- return accRect;
11664
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
11665
- return {
11666
- width: clippingRect.right - clippingRect.left,
11667
- height: clippingRect.bottom - clippingRect.top,
11668
- x: clippingRect.left,
11669
- y: clippingRect.top
11670
- };
11740
+ function getNodeName(node) {
11741
+ return isWindow(node) ? "" : node ? (node.nodeName || "").toLowerCase() : "";
11671
11742
  }
11672
- const platform = {
11673
- getClippingRect,
11674
- convertOffsetParentRelativeRectToViewportRelativeRect,
11675
- isElement: isElement$1,
11676
- getDimensions,
11677
- getOffsetParent,
11678
- getDocumentElement,
11679
- getElementRects: (_ref) => {
11680
- let {
11681
- reference: reference2,
11682
- floating,
11683
- strategy
11684
- } = _ref;
11685
- return {
11686
- reference: getRectRelativeToOffsetParent(reference2, getOffsetParent(floating), strategy),
11687
- floating: __spreadProps(__spreadValues({}, getDimensions(floating)), {
11688
- x: 0,
11689
- y: 0
11690
- })
11691
- };
11692
- },
11693
- getClientRects: (element) => Array.from(element.getClientRects()),
11694
- isRTL: (element) => getComputedStyle$1(element).direction === "rtl"
11695
- };
11696
- function autoUpdate(reference2, floating, update, options) {
11697
- if (options === void 0) {
11698
- options = {};
11743
+ function getUAString() {
11744
+ const uaData = navigator.userAgentData;
11745
+ if (uaData != null && uaData.brands) {
11746
+ return uaData.brands.map((item) => item.brand + "/" + item.version).join(" ");
11699
11747
  }
11700
- const {
11701
- ancestorScroll: _ancestorScroll = true,
11702
- ancestorResize: _ancestorResize = true,
11703
- elementResize = true,
11704
- animationFrame = false
11705
- } = options;
11706
- const ancestorScroll = _ancestorScroll && !animationFrame;
11707
- const ancestorResize = _ancestorResize && !animationFrame;
11708
- const ancestors = ancestorScroll || ancestorResize ? [...isElement$1(reference2) ? getOverflowAncestors(reference2) : [], ...getOverflowAncestors(floating)] : [];
11709
- ancestors.forEach((ancestor) => {
11710
- ancestorScroll && ancestor.addEventListener("scroll", update, {
11711
- passive: true
11712
- });
11713
- ancestorResize && ancestor.addEventListener("resize", update);
11714
- });
11715
- let observer = null;
11716
- if (elementResize) {
11717
- observer = new ResizeObserver(update);
11718
- isElement$1(reference2) && !animationFrame && observer.observe(reference2);
11719
- observer.observe(floating);
11748
+ return navigator.userAgent;
11749
+ }
11750
+ function isHTMLElement(value) {
11751
+ return value instanceof getWindow(value).HTMLElement;
11752
+ }
11753
+ function isElement(value) {
11754
+ return value instanceof getWindow(value).Element;
11755
+ }
11756
+ function isNode(value) {
11757
+ return value instanceof getWindow(value).Node;
11758
+ }
11759
+ function isShadowRoot(node) {
11760
+ if (typeof ShadowRoot === "undefined") {
11761
+ return false;
11720
11762
  }
11721
- let frameId;
11722
- let prevRefRect = animationFrame ? getBoundingClientRect(reference2) : null;
11723
- if (animationFrame) {
11724
- frameLoop();
11763
+ const OwnElement = getWindow(node).ShadowRoot;
11764
+ return node instanceof OwnElement || node instanceof ShadowRoot;
11765
+ }
11766
+ function isOverflowElement(element) {
11767
+ const {
11768
+ overflow,
11769
+ overflowX,
11770
+ overflowY
11771
+ } = getComputedStyle$1(element);
11772
+ return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
11773
+ }
11774
+ function isTableElement(element) {
11775
+ return ["table", "td", "th"].includes(getNodeName(element));
11776
+ }
11777
+ function isContainingBlock(element) {
11778
+ const isFirefox2 = /firefox/i.test(getUAString());
11779
+ const css = getComputedStyle$1(element);
11780
+ return css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].includes(css.willChange) || isFirefox2 && css.willChange === "filter" || isFirefox2 && (css.filter ? css.filter !== "none" : false);
11781
+ }
11782
+ function isLayoutViewport() {
11783
+ return !/^((?!chrome|android).)*safari/i.test(getUAString());
11784
+ }
11785
+ const min = Math.min;
11786
+ const max = Math.max;
11787
+ const round = Math.round;
11788
+ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
11789
+ var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
11790
+ if (includeScale === void 0) {
11791
+ includeScale = false;
11725
11792
  }
11726
- function frameLoop() {
11727
- const nextRefRect = getBoundingClientRect(reference2);
11728
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
11729
- update();
11730
- }
11731
- prevRefRect = nextRefRect;
11732
- frameId = requestAnimationFrame(frameLoop);
11793
+ if (isFixedStrategy === void 0) {
11794
+ isFixedStrategy = false;
11733
11795
  }
11734
- if (!elementResize) {
11735
- update();
11796
+ const clientRect = element.getBoundingClientRect();
11797
+ let scaleX = 1;
11798
+ let scaleY = 1;
11799
+ if (includeScale && isHTMLElement(element)) {
11800
+ scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
11801
+ scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
11736
11802
  }
11737
- return () => {
11738
- var _observer;
11739
- ancestors.forEach((ancestor) => {
11740
- ancestorScroll && ancestor.removeEventListener("scroll", update);
11741
- ancestorResize && ancestor.removeEventListener("resize", update);
11742
- });
11743
- (_observer = observer) == null ? void 0 : _observer.disconnect();
11744
- observer = null;
11745
- if (animationFrame) {
11746
- cancelAnimationFrame(frameId);
11747
- }
11803
+ const win = isElement(element) ? getWindow(element) : window;
11804
+ const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
11805
+ const x2 = (clientRect.left + (addVisualOffsets ? (_win$visualViewport$o = (_win$visualViewport = win.visualViewport) == null ? void 0 : _win$visualViewport.offsetLeft) != null ? _win$visualViewport$o : 0 : 0)) / scaleX;
11806
+ const y2 = (clientRect.top + (addVisualOffsets ? (_win$visualViewport$o2 = (_win$visualViewport2 = win.visualViewport) == null ? void 0 : _win$visualViewport2.offsetTop) != null ? _win$visualViewport$o2 : 0 : 0)) / scaleY;
11807
+ const width = clientRect.width / scaleX;
11808
+ const height = clientRect.height / scaleY;
11809
+ return {
11810
+ width,
11811
+ height,
11812
+ top: y2,
11813
+ right: x2 + width,
11814
+ bottom: y2 + height,
11815
+ left: x2,
11816
+ x: x2,
11817
+ y: y2
11748
11818
  };
11749
11819
  }
11750
- const computePosition = (reference2, floating, options) => computePosition$1(reference2, floating, __spreadValues({
11751
- platform
11752
- }, options));
11753
- var useFloating = (props, ctx, refReference, refContent, refArrow) => {
11754
- const localIsShow = ref(props.isShow);
11755
- const themeList = ["dark", "light"];
11756
- const compTheme = computed(() => {
11757
- const themes = props.theme.split(/\s+/);
11758
- themes.sort((a2, b2) => Number(themeList.includes(b2)) - Number(themeList.includes(a2)));
11759
- const systemThemes = themes;
11760
- const customThemes = themes.filter((item) => !themeList.includes(item));
11761
- return {
11762
- systemThemes,
11763
- customThemes
11764
- };
11765
- });
11766
- const resolvePopElements = () => {
11767
- var _a, _b, _c;
11768
- const elReference = resolveTargetElement((_a = refReference.value) == null ? void 0 : _a.$el);
11769
- const elContent = resolveTargetElement((_b = refContent.value) == null ? void 0 : _b.$el);
11770
- const elArrow = props.arrow ? resolveTargetElement((_c = refArrow.value) == null ? void 0 : _c.$el) : null;
11820
+ function getDocumentElement(node) {
11821
+ return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
11822
+ }
11823
+ function getNodeScroll(element) {
11824
+ if (isElement(element)) {
11771
11825
  return {
11772
- elReference,
11773
- elContent,
11774
- elArrow
11826
+ scrollLeft: element.scrollLeft,
11827
+ scrollTop: element.scrollTop
11775
11828
  };
11829
+ }
11830
+ return {
11831
+ scrollLeft: element.pageXOffset,
11832
+ scrollTop: element.pageYOffset
11776
11833
  };
11777
- const resolvePopOptions = (elArrow) => ({
11778
- placement: props.placement,
11779
- middleware: [inline(), offset(props.offset), props.autoPlacement ? autoPlacement() : flip(), shift({
11780
- padding: props.padding
11781
- }), arrow({
11782
- element: elArrow
11783
- }), hide()]
11784
- });
11785
- const resolveTargetElement = (target) => {
11786
- if (target instanceof HTMLElement) {
11787
- return target;
11834
+ }
11835
+ function getWindowScrollBarX(element) {
11836
+ return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
11837
+ }
11838
+ function isScaled(element) {
11839
+ const rect = getBoundingClientRect(element);
11840
+ return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
11841
+ }
11842
+ function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
11843
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
11844
+ const documentElement = getDocumentElement(offsetParent);
11845
+ const rect = getBoundingClientRect(element, isOffsetParentAnElement && isScaled(offsetParent), strategy === "fixed");
11846
+ let scroll = {
11847
+ scrollLeft: 0,
11848
+ scrollTop: 0
11849
+ };
11850
+ const offsets = {
11851
+ x: 0,
11852
+ y: 0
11853
+ };
11854
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
11855
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
11856
+ scroll = getNodeScroll(offsetParent);
11788
11857
  }
11789
- if (target instanceof Text) {
11790
- return resolveTargetElement(target.nextElementSibling);
11858
+ if (isHTMLElement(offsetParent)) {
11859
+ const offsetRect = getBoundingClientRect(offsetParent, true);
11860
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
11861
+ offsets.y = offsetRect.y + offsetParent.clientTop;
11862
+ } else if (documentElement) {
11863
+ offsets.x = getWindowScrollBarX(documentElement);
11791
11864
  }
11865
+ }
11866
+ return {
11867
+ x: rect.left + scroll.scrollLeft - offsets.x,
11868
+ y: rect.top + scroll.scrollTop - offsets.y,
11869
+ width: rect.width,
11870
+ height: rect.height
11871
+ };
11872
+ }
11873
+ function getParentNode(node) {
11874
+ if (getNodeName(node) === "html") {
11875
+ return node;
11876
+ }
11877
+ return node.assignedSlot || node.parentNode || (isShadowRoot(node) ? node.host : null) || getDocumentElement(node);
11878
+ }
11879
+ function getTrueOffsetParent(element) {
11880
+ if (!isHTMLElement(element) || getComputedStyle(element).position === "fixed") {
11792
11881
  return null;
11882
+ }
11883
+ return element.offsetParent;
11884
+ }
11885
+ function getContainingBlock(element) {
11886
+ let currentNode = getParentNode(element);
11887
+ if (isShadowRoot(currentNode)) {
11888
+ currentNode = currentNode.host;
11889
+ }
11890
+ while (isHTMLElement(currentNode) && !["html", "body"].includes(getNodeName(currentNode))) {
11891
+ if (isContainingBlock(currentNode)) {
11892
+ return currentNode;
11893
+ } else {
11894
+ currentNode = currentNode.parentNode;
11895
+ }
11896
+ }
11897
+ return null;
11898
+ }
11899
+ function getOffsetParent(element) {
11900
+ const window2 = getWindow(element);
11901
+ let offsetParent = getTrueOffsetParent(element);
11902
+ while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === "static") {
11903
+ offsetParent = getTrueOffsetParent(offsetParent);
11904
+ }
11905
+ if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle(offsetParent).position === "static" && !isContainingBlock(offsetParent))) {
11906
+ return window2;
11907
+ }
11908
+ return offsetParent || getContainingBlock(element) || window2;
11909
+ }
11910
+ function getDimensions(element) {
11911
+ if (isHTMLElement(element)) {
11912
+ return {
11913
+ width: element.offsetWidth,
11914
+ height: element.offsetHeight
11915
+ };
11916
+ }
11917
+ const rect = getBoundingClientRect(element);
11918
+ return {
11919
+ width: rect.width,
11920
+ height: rect.height
11793
11921
  };
11794
- const customThemeCls = compTheme.value.customThemes.join(" ");
11795
- const customTheme = compTheme.value.customThemes.reduce((out, cur) => __spreadValues({
11796
- [`data-${cur}-theme`]: true
11797
- }, out), {});
11798
- const contentClass = `${customThemeCls}`;
11799
- let cleanup = null;
11800
- const updatePopover = () => {
11801
- const {
11802
- elReference,
11803
- elContent,
11804
- elArrow
11805
- } = resolvePopElements();
11806
- const options = resolvePopOptions(elArrow);
11807
- cleanup = autoUpdate(elReference, elContent, () => {
11808
- computePosition(elReference, elContent, options).then(({
11809
- x: x2,
11810
- y: y2,
11811
- placement,
11812
- middlewareData
11813
- }) => {
11814
- const oldClass = elContent.className;
11815
- elContent.className = `${oldClass.replace(contentClass, "")} ${contentClass}`.replace(/\s+/mg, " ").replace(/^\s+|\s+$/g, "");
11816
- Object.keys(customTheme).forEach((key) => {
11817
- elContent.setAttribute(key, customTheme[key]);
11818
- });
11819
- const {
11820
- referenceHidden
11821
- } = middlewareData.hide;
11822
- Object.assign(elContent.style, {
11823
- left: `${x2}px`,
11824
- top: `${y2}px`,
11825
- visibility: referenceHidden ? "hidden" : "visible"
11826
- });
11827
- if (props.arrow) {
11828
- const {
11829
- x: arrowX,
11830
- y: arrowY
11831
- } = middlewareData.arrow;
11832
- const placementStr = placement.split("-")[0];
11833
- const staticSide = {
11834
- top: "bottom",
11835
- right: "left",
11836
- bottom: "top",
11837
- left: "right"
11838
- }[placementStr];
11839
- elArrow.setAttribute("data-arrow", placementStr);
11840
- Object.assign(elArrow.style, {
11841
- left: isNumber(arrowX) ? `${arrowX}px` : "",
11842
- top: isNumber(arrowY) ? `${arrowY}px` : "",
11843
- right: "",
11844
- bottom: "",
11845
- [staticSide]: "-4px"
11846
- });
11847
- }
11848
- });
11849
- });
11850
- };
11851
- const isNumber = (val) => /^-?\d+\.?\d*$/.test(`${val}`);
11852
- const showPopover = () => {
11853
- var _a;
11854
- const elContent = resolveTargetElement((_a = refContent.value) == null ? void 0 : _a.$el);
11855
- elContent.style.setProperty("display", "block");
11856
- elContent.style.setProperty("z-index", `${props.zIndex ? props.zIndex : bkZIndexManager.getModalNextIndex()}`);
11857
- updatePopover();
11858
- ctx.emit("update:isShow", true);
11859
- ctx.emit("afterShow", false);
11922
+ }
11923
+ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
11924
+ let {
11925
+ rect,
11926
+ offsetParent,
11927
+ strategy
11928
+ } = _ref;
11929
+ const isOffsetParentAnElement = isHTMLElement(offsetParent);
11930
+ const documentElement = getDocumentElement(offsetParent);
11931
+ if (offsetParent === documentElement) {
11932
+ return rect;
11933
+ }
11934
+ let scroll = {
11935
+ scrollLeft: 0,
11936
+ scrollTop: 0
11860
11937
  };
11861
- const hidePopover = () => {
11862
- var _a;
11863
- const elContent = resolveTargetElement((_a = refContent.value) == null ? void 0 : _a.$el);
11864
- elContent.style.setProperty("display", "none");
11865
- ctx.emit("update:isShow", false);
11866
- ctx.emit("afterHidden", false);
11938
+ const offsets = {
11939
+ x: 0,
11940
+ y: 0
11867
11941
  };
11868
- const triggerPopover = () => {
11869
- if (!localIsShow.value) {
11870
- showPopover();
11871
- } else {
11872
- hidePopover();
11942
+ if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== "fixed") {
11943
+ if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
11944
+ scroll = getNodeScroll(offsetParent);
11873
11945
  }
11874
- localIsShow.value = !localIsShow.value;
11875
- };
11876
- const resolveTriggerEvents = () => {
11877
- var _a;
11878
- const triggerEvents = {
11879
- hover: [["mouseenter", showPopover], ["mouseleave", hidePopover], ["focus", showPopover], ["blur", hidePopover]],
11880
- click: [["click", triggerPopover]],
11881
- manual: [[]]
11882
- };
11883
- return (_a = triggerEvents[props.trigger]) != null ? _a : [];
11946
+ if (isHTMLElement(offsetParent)) {
11947
+ const offsetRect = getBoundingClientRect(offsetParent, true);
11948
+ offsets.x = offsetRect.x + offsetParent.clientLeft;
11949
+ offsets.y = offsetRect.y + offsetParent.clientTop;
11950
+ }
11951
+ }
11952
+ return __spreadProps(__spreadValues({}, rect), {
11953
+ x: rect.x - scroll.scrollLeft + offsets.x,
11954
+ y: rect.y - scroll.scrollTop + offsets.y
11955
+ });
11956
+ }
11957
+ function getViewportRect(element, strategy) {
11958
+ const win = getWindow(element);
11959
+ const html = getDocumentElement(element);
11960
+ const visualViewport = win.visualViewport;
11961
+ let width = html.clientWidth;
11962
+ let height = html.clientHeight;
11963
+ let x2 = 0;
11964
+ let y2 = 0;
11965
+ if (visualViewport) {
11966
+ width = visualViewport.width;
11967
+ height = visualViewport.height;
11968
+ const layoutViewport = isLayoutViewport();
11969
+ if (layoutViewport || !layoutViewport && strategy === "fixed") {
11970
+ x2 = visualViewport.offsetLeft;
11971
+ y2 = visualViewport.offsetTop;
11972
+ }
11973
+ }
11974
+ return {
11975
+ width,
11976
+ height,
11977
+ x: x2,
11978
+ y: y2
11884
11979
  };
11980
+ }
11981
+ function getDocumentRect(element) {
11982
+ var _element$ownerDocumen;
11983
+ const html = getDocumentElement(element);
11984
+ const scroll = getNodeScroll(element);
11985
+ const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
11986
+ const width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
11987
+ const height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
11988
+ let x2 = -scroll.scrollLeft + getWindowScrollBarX(element);
11989
+ const y2 = -scroll.scrollTop;
11990
+ if (getComputedStyle$1(body || html).direction === "rtl") {
11991
+ x2 += max(html.clientWidth, body ? body.clientWidth : 0) - width;
11992
+ }
11885
11993
  return {
11886
- showPopover,
11887
- hidePopover,
11888
- resolveTriggerEvents,
11889
- updatePopover,
11890
- triggerPopover,
11891
- resolvePopElements,
11892
- localIsShow,
11893
- cleanup
11994
+ width,
11995
+ height,
11996
+ x: x2,
11997
+ y: y2
11894
11998
  };
11895
- };
11896
- let popContainerId = null;
11897
- var usePopperId = (prefix = "#") => {
11898
- const getPrefixId = () => `${prefix}${popContainerId}`;
11899
- const isAvaiableId = () => {
11900
- const container2 = document.querySelector(getPrefixId());
11901
- return container2 instanceof HTMLElement;
11999
+ }
12000
+ function getNearestOverflowAncestor(node) {
12001
+ const parentNode = getParentNode(node);
12002
+ if (["html", "body", "#document"].includes(getNodeName(parentNode))) {
12003
+ return node.ownerDocument.body;
12004
+ }
12005
+ if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
12006
+ return parentNode;
12007
+ }
12008
+ return getNearestOverflowAncestor(parentNode);
12009
+ }
12010
+ function getOverflowAncestors(node, list) {
12011
+ var _node$ownerDocument;
12012
+ if (list === void 0) {
12013
+ list = [];
12014
+ }
12015
+ const scrollableAncestor = getNearestOverflowAncestor(node);
12016
+ const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
12017
+ const win = getWindow(scrollableAncestor);
12018
+ const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
12019
+ const updatedList = list.concat(target);
12020
+ return isBody ? updatedList : updatedList.concat(getOverflowAncestors(target));
12021
+ }
12022
+ function contains(parent, child) {
12023
+ const rootNode = child.getRootNode == null ? void 0 : child.getRootNode();
12024
+ if (parent.contains(child)) {
12025
+ return true;
12026
+ } else if (rootNode && isShadowRoot(rootNode)) {
12027
+ let next = child;
12028
+ do {
12029
+ if (next && parent === next) {
12030
+ return true;
12031
+ }
12032
+ next = next.parentNode || next.host;
12033
+ } while (next);
12034
+ }
12035
+ return false;
12036
+ }
12037
+ function getInnerBoundingClientRect(element, strategy) {
12038
+ const clientRect = getBoundingClientRect(element, false, strategy === "fixed");
12039
+ const top2 = clientRect.top + element.clientTop;
12040
+ const left2 = clientRect.left + element.clientLeft;
12041
+ return {
12042
+ top: top2,
12043
+ left: left2,
12044
+ x: left2,
12045
+ y: top2,
12046
+ right: left2 + element.clientWidth,
12047
+ bottom: top2 + element.clientHeight,
12048
+ width: element.clientWidth,
12049
+ height: element.clientHeight
11902
12050
  };
11903
- if (popContainerId === null || !isAvaiableId()) {
11904
- popContainerId = `id_${uuid_1.v4()}`;
11905
- const popContainer = document.createElement("div");
11906
- popContainer.setAttribute("id", popContainerId);
11907
- popContainer.setAttribute("data-popper-id", popContainerId);
11908
- document.body.append(popContainer);
12051
+ }
12052
+ function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
12053
+ if (clippingParent === "viewport") {
12054
+ return rectToClientRect(getViewportRect(element, strategy));
12055
+ }
12056
+ if (isElement(clippingParent)) {
12057
+ return getInnerBoundingClientRect(clippingParent, strategy);
12058
+ }
12059
+ return rectToClientRect(getDocumentRect(getDocumentElement(element)));
12060
+ }
12061
+ function getClippingAncestors(element) {
12062
+ const clippingAncestors = getOverflowAncestors(element);
12063
+ const canEscapeClipping = ["absolute", "fixed"].includes(getComputedStyle$1(element).position);
12064
+ const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
12065
+ if (!isElement(clipperElement)) {
12066
+ return [];
11909
12067
  }
12068
+ return clippingAncestors.filter((clippingAncestors2) => isElement(clippingAncestors2) && contains(clippingAncestors2, clipperElement) && getNodeName(clippingAncestors2) !== "body");
12069
+ }
12070
+ function getClippingRect(_ref) {
12071
+ let {
12072
+ element,
12073
+ boundary,
12074
+ rootBoundary,
12075
+ strategy
12076
+ } = _ref;
12077
+ const mainClippingAncestors = boundary === "clippingAncestors" ? getClippingAncestors(element) : [].concat(boundary);
12078
+ const clippingAncestors = [...mainClippingAncestors, rootBoundary];
12079
+ const firstClippingAncestor = clippingAncestors[0];
12080
+ const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
12081
+ const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
12082
+ accRect.top = max(rect.top, accRect.top);
12083
+ accRect.right = min(rect.right, accRect.right);
12084
+ accRect.bottom = min(rect.bottom, accRect.bottom);
12085
+ accRect.left = max(rect.left, accRect.left);
12086
+ return accRect;
12087
+ }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
11910
12088
  return {
11911
- popContainerId,
11912
- prefixId: getPrefixId()
12089
+ width: clippingRect.right - clippingRect.left,
12090
+ height: clippingRect.bottom - clippingRect.top,
12091
+ x: clippingRect.left,
12092
+ y: clippingRect.top
11913
12093
  };
11914
- };
11915
- var Component$n = defineComponent({
11916
- name: "Popover2",
11917
- components: {
11918
- Content,
11919
- Arrow
11920
- },
11921
- props: PopoverProps,
11922
- setup(props, ctx) {
11923
- const {
11924
- content,
11925
- theme,
11926
- disableTeleport,
11927
- width,
11928
- height
11929
- } = props;
11930
- const refIsShow = toRef(props, "isShow");
11931
- const refReference = ref();
11932
- const refContent = ref();
11933
- const refArrow = ref();
11934
- let storeEvents = null;
11935
- const {
11936
- localIsShow,
11937
- showPopover,
11938
- triggerPopover,
11939
- resolveTriggerEvents,
11940
- updatePopover,
11941
- resolvePopElements,
11942
- cleanup
11943
- } = useFloating(props, ctx, refReference, refContent, refArrow);
11944
- const show = () => {
11945
- localIsShow.value = true;
11946
- triggerPopover();
11947
- };
11948
- const hide2 = () => {
11949
- localIsShow.value = false;
11950
- triggerPopover();
11951
- };
11952
- const createPopInstance = () => {
11953
- updatePopover();
11954
- if (props.always) {
11955
- showPopover();
11956
- } else {
11957
- addEventToReferenceEl();
11958
- }
12094
+ }
12095
+ const platform = {
12096
+ getClippingRect,
12097
+ convertOffsetParentRelativeRectToViewportRelativeRect,
12098
+ isElement,
12099
+ getDimensions,
12100
+ getOffsetParent,
12101
+ getDocumentElement,
12102
+ getElementRects: (_ref) => {
12103
+ let {
12104
+ reference: reference2,
12105
+ floating,
12106
+ strategy
12107
+ } = _ref;
12108
+ return {
12109
+ reference: getRectRelativeToOffsetParent(reference2, getOffsetParent(floating), strategy),
12110
+ floating: __spreadProps(__spreadValues({}, getDimensions(floating)), {
12111
+ x: 0,
12112
+ y: 0
12113
+ })
11959
12114
  };
11960
- if (!props.always && !props.disabled) {
11961
- watch([refIsShow], () => {
11962
- localIsShow.value = props.isShow;
11963
- triggerPopover();
11964
- });
12115
+ },
12116
+ getClientRects: (element) => Array.from(element.getClientRects()),
12117
+ isRTL: (element) => getComputedStyle$1(element).direction === "rtl"
12118
+ };
12119
+ function autoUpdate(reference2, floating, update, options) {
12120
+ if (options === void 0) {
12121
+ options = {};
12122
+ }
12123
+ const {
12124
+ ancestorScroll: _ancestorScroll = true,
12125
+ ancestorResize: _ancestorResize = true,
12126
+ elementResize = true,
12127
+ animationFrame = false
12128
+ } = options;
12129
+ const ancestorScroll = _ancestorScroll && !animationFrame;
12130
+ const ancestorResize = _ancestorResize && !animationFrame;
12131
+ const ancestors = ancestorScroll || ancestorResize ? [...isElement(reference2) ? getOverflowAncestors(reference2) : [], ...getOverflowAncestors(floating)] : [];
12132
+ ancestors.forEach((ancestor) => {
12133
+ ancestorScroll && ancestor.addEventListener("scroll", update, {
12134
+ passive: true
12135
+ });
12136
+ ancestorResize && ancestor.addEventListener("resize", update);
12137
+ });
12138
+ let observer = null;
12139
+ if (elementResize) {
12140
+ observer = new ResizeObserver(update);
12141
+ isElement(reference2) && !animationFrame && observer.observe(reference2);
12142
+ observer.observe(floating);
12143
+ }
12144
+ let frameId;
12145
+ let prevRefRect = animationFrame ? getBoundingClientRect(reference2) : null;
12146
+ if (animationFrame) {
12147
+ frameLoop();
12148
+ }
12149
+ function frameLoop() {
12150
+ const nextRefRect = getBoundingClientRect(reference2);
12151
+ if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
12152
+ update();
11965
12153
  }
11966
- watch(() => [props.disabled], (val) => {
11967
- if (val[0]) {
11968
- createPopInstance();
11969
- } else {
11970
- beforeInstanceUnmount();
11971
- }
12154
+ prevRefRect = nextRefRect;
12155
+ frameId = requestAnimationFrame(frameLoop);
12156
+ }
12157
+ if (!elementResize) {
12158
+ update();
12159
+ }
12160
+ return () => {
12161
+ var _observer;
12162
+ ancestors.forEach((ancestor) => {
12163
+ ancestorScroll && ancestor.removeEventListener("scroll", update);
12164
+ ancestorResize && ancestor.removeEventListener("resize", update);
11972
12165
  });
11973
- const addEventToReferenceEl = () => {
11974
- const {
11975
- elReference
11976
- } = resolvePopElements();
11977
- storeEvents = resolveTriggerEvents();
11978
- storeEvents.forEach(([event, listener]) => {
11979
- elReference.addEventListener(event, listener);
11980
- });
12166
+ (_observer = observer) == null ? void 0 : _observer.disconnect();
12167
+ observer = null;
12168
+ if (animationFrame) {
12169
+ cancelAnimationFrame(frameId);
12170
+ }
12171
+ };
12172
+ }
12173
+ const computePosition = (reference2, floating, options) => computePosition$1(reference2, floating, __spreadValues({
12174
+ platform
12175
+ }, options));
12176
+ var useFloating = (props, ctx, refReference, refContent, refArrow) => {
12177
+ const localIsShow = ref(false);
12178
+ const themeList = ["dark", "light"];
12179
+ const compTheme = computed(() => {
12180
+ const themes = props.theme.split(/\s+/);
12181
+ themes.sort((a2, b2) => Number(themeList.includes(b2)) - Number(themeList.includes(a2)));
12182
+ const systemThemes = themes;
12183
+ const customThemes = themes.filter((item) => !themeList.includes(item));
12184
+ return {
12185
+ systemThemes,
12186
+ customThemes
11981
12187
  };
11982
- const removeEventListener2 = () => {
11983
- if (storeEvents == null ? void 0 : storeEvents.length) {
12188
+ });
12189
+ const resolvePopElements = () => {
12190
+ var _a, _b, _c;
12191
+ const elReference = resolveTargetElement((_a = refReference.value) == null ? void 0 : _a.$el);
12192
+ const elContent = resolveTargetElement((_b = refContent.value) == null ? void 0 : _b.$el);
12193
+ const elArrow = props.arrow ? resolveTargetElement((_c = refArrow.value) == null ? void 0 : _c.$el) : null;
12194
+ return {
12195
+ elReference,
12196
+ elContent,
12197
+ elArrow
12198
+ };
12199
+ };
12200
+ const resolvePopOptions = (elArrow) => ({
12201
+ placement: props.placement,
12202
+ middleware: [inline(), offset(props.offset), props.autoPlacement ? autoPlacement() : flip(), shift({
12203
+ padding: props.padding
12204
+ }), arrow({
12205
+ element: elArrow
12206
+ }), hide()]
12207
+ });
12208
+ const resolveTargetElement = (target) => {
12209
+ if (target instanceof HTMLElement) {
12210
+ return target;
12211
+ }
12212
+ if (target instanceof Text) {
12213
+ return resolveTargetElement(target.nextElementSibling);
12214
+ }
12215
+ return null;
12216
+ };
12217
+ const customThemeCls = compTheme.value.customThemes.join(" ");
12218
+ const customTheme = compTheme.value.customThemes.reduce((out, cur) => __spreadValues({
12219
+ [`data-${cur}-theme`]: true
12220
+ }, out), {});
12221
+ const contentClass = `${customThemeCls}`;
12222
+ let cleanup = null;
12223
+ const updatePopover = () => {
12224
+ const {
12225
+ elReference,
12226
+ elContent,
12227
+ elArrow
12228
+ } = resolvePopElements();
12229
+ const options = resolvePopOptions(elArrow);
12230
+ cleanup = autoUpdate(elReference, elContent, () => {
12231
+ computePosition(elReference, elContent, options).then(({
12232
+ x: x2,
12233
+ y: y2,
12234
+ placement,
12235
+ middlewareData
12236
+ }) => {
12237
+ const oldClass = elContent.className;
12238
+ elContent.className = `${oldClass.replace(contentClass, "")} ${contentClass}`.replace(/\s+/mg, " ").replace(/^\s+|\s+$/g, "");
12239
+ Object.keys(customTheme).forEach((key) => {
12240
+ elContent.setAttribute(key, customTheme[key]);
12241
+ });
11984
12242
  const {
11985
- elReference
11986
- } = resolvePopElements();
11987
- if (elReference) {
11988
- storeEvents.forEach(([event, listener]) => {
11989
- elReference.removeEventListener(event, listener);
12243
+ referenceHidden
12244
+ } = middlewareData.hide;
12245
+ Object.assign(elContent.style, {
12246
+ left: `${x2}px`,
12247
+ top: `${y2}px`,
12248
+ visibility: referenceHidden ? "hidden" : "visible"
12249
+ });
12250
+ if (props.arrow) {
12251
+ const {
12252
+ x: arrowX,
12253
+ y: arrowY
12254
+ } = middlewareData.arrow;
12255
+ const placementStr = placement.split("-")[0];
12256
+ const staticSide = {
12257
+ top: "bottom",
12258
+ right: "left",
12259
+ bottom: "top",
12260
+ left: "right"
12261
+ }[placementStr];
12262
+ elArrow.setAttribute("data-arrow", placementStr);
12263
+ Object.assign(elArrow.style, {
12264
+ left: isNumber(arrowX) ? `${arrowX}px` : "",
12265
+ top: isNumber(arrowY) ? `${arrowY}px` : "",
12266
+ right: "",
12267
+ bottom: "",
12268
+ [staticSide]: "-4px"
11990
12269
  });
11991
12270
  }
11992
- storeEvents = null;
11993
- }
11994
- };
11995
- const beforeInstanceUnmount = () => {
11996
- if (typeof cleanup === "function") {
11997
- cleanup();
11998
- }
11999
- removeEventListener2();
12000
- };
12001
- onMounted(() => {
12002
- if (props.disabled) {
12003
- return;
12004
- }
12005
- createPopInstance();
12271
+ });
12006
12272
  });
12007
- onUnmounted(() => {
12008
- beforeInstanceUnmount();
12273
+ };
12274
+ const isNumber = (val) => /^-?\d+\.?\d*$/.test(`${val}`);
12275
+ const showPopover = () => {
12276
+ localIsShow.value = true;
12277
+ };
12278
+ const hidePopover = () => {
12279
+ localIsShow.value = false;
12280
+ };
12281
+ const hanldePopoverShow = () => {
12282
+ var _a;
12283
+ const elContent = resolveTargetElement((_a = refContent.value) == null ? void 0 : _a.$el);
12284
+ elContent.style.setProperty("display", "block");
12285
+ elContent.style.setProperty("z-index", `${props.zIndex ? props.zIndex : bkZIndexManager.getModalNextIndex()}`);
12286
+ updatePopover();
12287
+ ctx.emit("afterShow", {
12288
+ isSHow: true
12009
12289
  });
12010
- ctx.expose({
12011
- show,
12012
- hide: hide2
12290
+ };
12291
+ const handlePopoverHide = () => {
12292
+ var _a;
12293
+ const elContent = resolveTargetElement((_a = refContent.value) == null ? void 0 : _a.$el);
12294
+ elContent.style.setProperty("display", "none");
12295
+ ctx.emit("afterHidden", {
12296
+ isSHow: false
12013
12297
  });
12014
- const {
12015
- prefixId
12016
- } = usePopperId();
12017
- const boundary = typeof props.boundary === "string" ? props.boundary : prefixId;
12018
- return {
12019
- boundary,
12020
- arrow: props.arrow,
12021
- refReference,
12022
- refContent,
12023
- refArrow,
12298
+ };
12299
+ const triggerPopover = () => {
12300
+ if (!localIsShow.value) {
12301
+ showPopover();
12302
+ } else {
12303
+ hidePopover();
12304
+ }
12305
+ };
12306
+ const hanldeClickRef = (e) => {
12307
+ e.stopImmediatePropagation();
12308
+ e.stopPropagation();
12309
+ e.preventDefault();
12310
+ triggerPopover();
12311
+ };
12312
+ const resolveTriggerEvents = () => {
12313
+ var _a;
12314
+ const triggerEvents = {
12315
+ hover: [["mouseenter", showPopover], ["mouseleave", hidePopover], ["focus", showPopover], ["blur", hidePopover]],
12316
+ click: [["click", hanldeClickRef]],
12317
+ manual: [[]]
12318
+ };
12319
+ return (_a = triggerEvents[props.trigger]) != null ? _a : [];
12320
+ };
12321
+ watch(localIsShow, (val) => {
12322
+ if (val) {
12323
+ hanldePopoverShow();
12324
+ } else {
12325
+ handlePopoverHide();
12326
+ }
12327
+ });
12328
+ return {
12329
+ showPopover,
12330
+ hidePopover,
12331
+ resolveTriggerEvents,
12332
+ updatePopover,
12333
+ triggerPopover,
12334
+ resolvePopElements,
12335
+ localIsShow,
12336
+ cleanup
12337
+ };
12338
+ };
12339
+ let popContainerId = null;
12340
+ var usePopperId = (prefix = "#") => {
12341
+ const getPrefixId = () => `${prefix}${popContainerId}`;
12342
+ const isAvaiableId = () => {
12343
+ const container2 = document.querySelector(getPrefixId());
12344
+ return container2 instanceof HTMLElement;
12345
+ };
12346
+ if (popContainerId === null || !isAvaiableId()) {
12347
+ popContainerId = `id_${uuid_1.v4()}`;
12348
+ const popContainer = document.createElement("div");
12349
+ popContainer.setAttribute("id", popContainerId);
12350
+ popContainer.setAttribute("data-popper-id", popContainerId);
12351
+ document.body.append(popContainer);
12352
+ }
12353
+ return {
12354
+ popContainerId,
12355
+ prefixId: getPrefixId()
12356
+ };
12357
+ };
12358
+ var Component$n = defineComponent({
12359
+ name: "Popover2",
12360
+ components: {
12361
+ Content,
12362
+ Arrow
12363
+ },
12364
+ directives: {
12365
+ clickoutside: ClickOutside
12366
+ },
12367
+ props: PopoverProps,
12368
+ emits: EMIT_EVENT_TYPES$1,
12369
+ setup(props, ctx) {
12370
+ const {
12024
12371
  content,
12025
12372
  theme,
12026
12373
  disableTeleport,
12027
12374
  width,
12028
12375
  height
12376
+ } = props;
12377
+ const refReference = ref();
12378
+ const refContent = ref();
12379
+ const refArrow = ref();
12380
+ let storeEvents = null;
12381
+ const {
12382
+ localIsShow,
12383
+ showPopover,
12384
+ hidePopover,
12385
+ resolveTriggerEvents,
12386
+ updatePopover,
12387
+ resolvePopElements,
12388
+ cleanup
12389
+ } = useFloating(props, ctx, refReference, refContent, refArrow);
12390
+ const show = () => {
12391
+ showPopover();
12392
+ };
12393
+ const hide2 = () => {
12394
+ hidePopover();
12395
+ };
12396
+ const createPopInstance = () => {
12397
+ updatePopover();
12398
+ if (props.always) {
12399
+ showPopover();
12400
+ } else {
12401
+ addEventToReferenceEl();
12402
+ }
12403
+ };
12404
+ if (!props.always && !props.disabled) {
12405
+ watch(() => props.isShow, () => {
12406
+ props.isShow ? showPopover() : hidePopover();
12407
+ }, {
12408
+ immediate: true
12409
+ });
12410
+ }
12411
+ watch(() => [props.disabled], (val) => {
12412
+ if (val[0]) {
12413
+ createPopInstance();
12414
+ } else {
12415
+ beforeInstanceUnmount();
12416
+ }
12417
+ });
12418
+ const addEventToReferenceEl = () => {
12419
+ const {
12420
+ elReference
12421
+ } = resolvePopElements();
12422
+ storeEvents = resolveTriggerEvents();
12423
+ storeEvents.forEach(([event, listener]) => {
12424
+ elReference.addEventListener(event, listener);
12425
+ });
12426
+ };
12427
+ const removeEventListener2 = () => {
12428
+ if (storeEvents == null ? void 0 : storeEvents.length) {
12429
+ const {
12430
+ elReference
12431
+ } = resolvePopElements();
12432
+ if (elReference) {
12433
+ storeEvents.forEach(([event, listener]) => {
12434
+ elReference.removeEventListener(event, listener);
12435
+ });
12436
+ }
12437
+ storeEvents = null;
12438
+ }
12439
+ };
12440
+ const beforeInstanceUnmount = () => {
12441
+ if (typeof cleanup === "function") {
12442
+ cleanup();
12443
+ }
12444
+ removeEventListener2();
12445
+ };
12446
+ onMounted(() => {
12447
+ if (props.disabled) {
12448
+ return;
12449
+ }
12450
+ createPopInstance();
12451
+ });
12452
+ onUnmounted(() => {
12453
+ beforeInstanceUnmount();
12454
+ });
12455
+ ctx.expose({
12456
+ show,
12457
+ hide: hide2
12458
+ });
12459
+ const {
12460
+ prefixId
12461
+ } = usePopperId();
12462
+ const boundary = typeof props.boundary === "string" ? props.boundary : prefixId;
12463
+ const handleClickOutside = (_e) => {
12464
+ console.log("handleClickOutside", localIsShow.value);
12465
+ ctx.emit(EMITEVENTS$1.CLICK_OUTSIDE, {
12466
+ isShow: localIsShow.value
12467
+ });
12468
+ if (props.disableOutsideClick || props.always || props.disabled || props.trigger === "manual") {
12469
+ return;
12470
+ }
12471
+ if (localIsShow.value) {
12472
+ hide2();
12473
+ }
12474
+ };
12475
+ return {
12476
+ boundary,
12477
+ arrow: props.arrow,
12478
+ refReference,
12479
+ refContent,
12480
+ refArrow,
12481
+ content,
12482
+ theme,
12483
+ disableTeleport,
12484
+ width,
12485
+ height,
12486
+ handleClickOutside
12029
12487
  };
12030
12488
  },
12031
12489
  render() {
@@ -12040,7 +12498,7 @@ var Component$n = defineComponent({
12040
12498
  "to": this.boundary,
12041
12499
  "disabled": this.disableTeleport
12042
12500
  }, {
12043
- default: () => [createVNode(Content, {
12501
+ default: () => [withDirectives(createVNode(Content, {
12044
12502
  "ref": "refContent",
12045
12503
  "data-theme": this.theme,
12046
12504
  "width": this.width,
@@ -12058,7 +12516,7 @@ var Component$n = defineComponent({
12058
12516
  return [(_b = (_a = this.$slots).arrow) == null ? void 0 : _b.call(_a)];
12059
12517
  }
12060
12518
  }) : ""
12061
- })]
12519
+ }), [[resolveDirective("clickoutside"), this.handleClickOutside]])]
12062
12520
  })]);
12063
12521
  }
12064
12522
  });
@@ -12795,691 +13253,293 @@ var Component$j = defineComponent({
12795
13253
  return createVNode("h3", {
12796
13254
  "class": "bk-swiper-card",
12797
13255
  "style": computedSwiperRenderStyle.value
12798
- }, [(_b = (_a = slots.default) == null ? void 0 : _a.call(slots, renderData)) != null ? _b : createVNode("span", {
12799
- "class": getRenderItemClass(renderData),
12800
- "style": getRenderItemStyle(renderData),
12801
- "onClick": () => goToLink(renderData.link)
12802
- }, null)]);
12803
- })]), createVNode("ul", {
12804
- "class": "bk-swiper-index"
12805
- }, [computedRenderDataList.value.map((_2, index) => createVNode("li", {
12806
- "class": getRenderIndexStyle(index),
12807
- "onMouseover": () => changeIndex(index)
12808
- }, null))]), createVNode("span", {
12809
- "class": "bk-swiper-nav bk-nav-prev",
12810
- "onClick": () => changeIndex(swiperIndex.value - 1)
12811
- }, [createVNode("i", {
12812
- "class": "bk-swiper-nav-icon"
12813
- }, null)]), createVNode("span", {
12814
- "class": "bk-swiper-nav bk-nav-next",
12815
- "onClick": () => changeIndex(swiperIndex.value + 1)
12816
- }, [createVNode("i", {
12817
- "class": "bk-swiper-nav-icon"
12818
- }, null)])]);
12819
- }
12820
- });
12821
- const BkSwiper = withInstall(Component$j);
12822
- const selectKey = Symbol("BkSelect");
12823
- const optionGroupKey = Symbol("BkOptionGroup");
12824
- function useFocus() {
12825
- const isFocus = ref(false);
12826
- const handleFocus = () => {
12827
- isFocus.value = true;
12828
- };
12829
- const handleBlur = () => {
12830
- isFocus.value = false;
12831
- };
12832
- return {
12833
- isFocus,
12834
- handleFocus,
12835
- handleBlur
12836
- };
12837
- }
12838
- function useHover() {
12839
- const isHover = ref(false);
12840
- const setHover = () => {
12841
- isHover.value = true;
12842
- };
12843
- const cancelHover = () => {
12844
- isHover.value = false;
12845
- };
12846
- return {
12847
- isHover,
12848
- setHover,
12849
- cancelHover
12850
- };
12851
- }
12852
- function useRegistry(data2) {
12853
- const register = (item) => {
12854
- if (!item || data2.value.find((d2) => d2 === item))
12855
- return;
12856
- return data2.value.push(item);
12857
- };
12858
- const unregister = (item) => {
12859
- const index = data2.value.findIndex((d2) => d2 === item);
12860
- if (index > -1) {
12861
- data2.value.splice(index, 1);
12862
- }
12863
- };
12864
- return {
12865
- register,
12866
- unregister
12867
- };
12868
- }
12869
- function useDebouncedRef(value, delay = 200) {
12870
- let timeout;
12871
- let innerValue = value;
12872
- return customRef((track, trigger) => ({
12873
- get() {
12874
- track();
12875
- return innerValue;
12876
- },
12877
- set(newValue) {
12878
- clearTimeout(timeout);
12879
- if (newValue === void 0 || newValue === "") {
12880
- innerValue = newValue;
12881
- trigger();
12882
- } else {
12883
- timeout = setTimeout(() => {
12884
- innerValue = newValue;
12885
- trigger();
12886
- }, delay);
12887
- }
12888
- }
12889
- }));
12890
- }
12891
- function usePopover(config) {
12892
- const { popoverMinWidth } = config;
12893
- const popperWidth = ref("auto");
12894
- const isPopoverShow = ref(false);
12895
- const onPopoverFirstUpdate = (instance) => {
12896
- const { reference: reference2 } = instance.elements;
12897
- popperWidth.value = Math.max(reference2.offsetWidth, popoverMinWidth);
12898
- };
12899
- const togglePopover = () => {
12900
- isPopoverShow.value = !isPopoverShow.value;
12901
- };
12902
- const hidePopover = () => {
12903
- isPopoverShow.value = false;
12904
- };
12905
- const showPopover = () => {
12906
- isPopoverShow.value = true;
12907
- };
12908
- return {
12909
- isPopoverShow,
12910
- popperWidth,
12911
- togglePopover,
12912
- onPopoverFirstUpdate,
12913
- hidePopover,
12914
- showPopover
12915
- };
12916
- }
12917
- function useRemoteSearch(method, callBack) {
12918
- const searchKey = useDebouncedRef("");
12919
- const searchLoading = ref(false);
12920
- watch(searchKey, async () => {
12921
- try {
12922
- searchLoading.value = true;
12923
- await method(searchKey.value);
12924
- searchLoading.value = false;
12925
- } catch (err) {
12926
- console.error(err);
12927
- } finally {
12928
- callBack == null ? void 0 : callBack();
12929
- }
12930
- });
12931
- return {
12932
- searchKey,
12933
- searchLoading
12934
- };
12935
- }
12936
- function toLowerCase(value = "") {
12937
- if (!value)
12938
- return value;
12939
- return String(value).trim().toLowerCase();
12940
- }
12941
- var BkOption = defineComponent({
12942
- name: "Option",
12943
- props: {
12944
- value: PropTypes.any,
12945
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
12946
- disabled: PropTypes.bool.def(false)
12947
- },
12948
- setup(props) {
12949
- const {
12950
- proxy
12951
- } = getCurrentInstance();
12952
- const states = reactive({
12953
- visible: true
12954
- });
12955
- const {
12956
- disabled,
12957
- value
12958
- } = toRefs(props);
12959
- const select2 = inject(selectKey, null);
12960
- const group = inject(optionGroupKey, null);
12961
- const selected = computed(() => {
12962
- var _a;
12963
- return (_a = select2 == null ? void 0 : select2.selected) == null ? void 0 : _a.some((data2) => data2.value === value.value);
12964
- });
12965
- const multiple = computed(() => select2 == null ? void 0 : select2.multiple);
12966
- const isHover = computed(() => (select2 == null ? void 0 : select2.activeOptionValue) === value.value);
12967
- const handleOptionClick = () => {
12968
- if (disabled.value)
12969
- return;
12970
- select2 == null ? void 0 : select2.handleOptionSelected(proxy);
12971
- };
12972
- const handleMouseEnter = () => {
12973
- select2.activeOptionValue = value.value;
12974
- };
12975
- onBeforeMount(() => {
12976
- select2 == null ? void 0 : select2.register(proxy);
12977
- group == null ? void 0 : group.register(proxy);
12978
- });
12979
- onBeforeUnmount(() => {
12980
- select2 == null ? void 0 : select2.unregister(proxy);
12981
- group == null ? void 0 : group.unregister(proxy);
12982
- });
12983
- return __spreadProps(__spreadValues({}, toRefs(states)), {
12984
- selected,
12985
- multiple,
12986
- isHover,
12987
- handleOptionClick,
12988
- handleMouseEnter
12989
- });
12990
- },
12991
- render() {
12992
- var _a, _b, _c;
12993
- const selectItemClass = classes({
12994
- "is-selected": this.selected,
12995
- "is-disabled": this.disabled,
12996
- "is-multiple": this.multiple,
12997
- "is-hover": this.isHover,
12998
- "bk-select-option": true
12999
- });
13000
- return withDirectives(createVNode("li", {
13001
- "class": selectItemClass,
13002
- "onClick": this.handleOptionClick,
13003
- "onMouseenter": this.handleMouseEnter
13004
- }, [(_c = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode("span", null, [this.label])]), [[vShow, this.visible]]);
13005
- }
13006
- });
13007
- var OptionGroup = defineComponent({
13008
- name: "Group",
13009
- props: {
13010
- label: PropTypes.string.def(""),
13011
- disabled: PropTypes.bool.def(false),
13012
- collapsible: PropTypes.bool.def(false),
13013
- collapse: PropTypes.bool.def(false)
13014
- },
13015
- setup(props, {
13016
- emit
13017
- }) {
13018
- const {
13019
- proxy
13020
- } = getCurrentInstance();
13021
- const select2 = inject(selectKey, null);
13022
- const states = reactive({
13023
- groupCollapse: props.collapse,
13024
- visible: true
13025
- });
13026
- const options = ref([]);
13027
- const {
13028
- register,
13029
- unregister
13030
- } = useRegistry(options);
13031
- const groupLabel = computed(() => `${props.label} (${[...options.value.values()].filter((option) => option.visible).length})`);
13032
- const handleToggleCollapse = () => {
13033
- if (!props.collapsible || props.disabled)
13034
- return;
13035
- states.groupCollapse = !states.groupCollapse;
13036
- emit("update:collapse", states.groupCollapse);
13037
- };
13038
- provide(optionGroupKey, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
13039
- register,
13040
- unregister,
13041
- groupCollapse: toRef(states, "groupCollapse")
13042
- })));
13043
- onBeforeMount(() => {
13044
- select2 == null ? void 0 : select2.registerGroup(proxy);
13045
- });
13046
- onBeforeUnmount(() => {
13047
- select2 == null ? void 0 : select2.unregisterGroup(proxy);
13048
- });
13049
- return __spreadProps(__spreadValues({}, toRefs(states)), {
13050
- groupLabel,
13051
- handleToggleCollapse
13052
- });
13053
- },
13054
- render() {
13055
- var _a, _b;
13056
- const groupClass = classes({
13057
- "bk-option-group": true,
13058
- collapsible: this.collapsible,
13059
- disabled: this.disabled
13060
- });
13061
- const groupLabelClass = classes({
13062
- "bk-option-group-label": true,
13063
- collapsible: this.collapsible
13064
- });
13065
- const groupLabelIconClass = classes({
13066
- "default-group-label-icon": true,
13067
- collapse: this.groupCollapse
13068
- });
13069
- return withDirectives(createVNode("ul", {
13070
- "class": groupClass
13071
- }, [createVNode("li", {
13072
- "class": groupLabelClass,
13073
- "onClick": this.handleToggleCollapse
13074
- }, [this.$slots.label ? this.$slots.label() : createVNode("span", {
13075
- "class": "default-group-label"
13076
- }, [this.collapsible && createVNode(angleUpFill, {
13077
- "class": groupLabelIconClass
13078
- }, null), createVNode("span", {
13079
- "class": "default-group-label-title"
13080
- }, [this.groupLabel])])]), withDirectives(createVNode("ul", {
13081
- "class": "bk-option-group-content"
13082
- }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), [[vShow, !this.groupCollapse]])]), [[vShow, this.visible]]);
13083
- }
13084
- });
13085
- var _populated = false;
13086
- var _ie, _firefox, _opera, _webkit, _chrome;
13087
- var _ie_real_version;
13088
- var _osx, _windows, _linux, _android;
13089
- var _win64;
13090
- var _iphone, _ipad, _native;
13091
- var _mobile;
13092
- function _populate() {
13093
- if (_populated) {
13094
- return;
13095
- }
13096
- _populated = true;
13097
- var uas = navigator.userAgent;
13098
- var agent = /(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(uas);
13099
- var os = /(Mac OS X)|(Windows)|(Linux)/.exec(uas);
13100
- _iphone = /\b(iPhone|iP[ao]d)/.exec(uas);
13101
- _ipad = /\b(iP[ao]d)/.exec(uas);
13102
- _android = /Android/i.exec(uas);
13103
- _native = /FBAN\/\w+;/i.exec(uas);
13104
- _mobile = /Mobile/i.exec(uas);
13105
- _win64 = !!/Win64/.exec(uas);
13106
- if (agent) {
13107
- _ie = agent[1] ? parseFloat(agent[1]) : agent[5] ? parseFloat(agent[5]) : NaN;
13108
- if (_ie && document && document.documentMode) {
13109
- _ie = document.documentMode;
13110
- }
13111
- var trident = /(?:Trident\/(\d+.\d+))/.exec(uas);
13112
- _ie_real_version = trident ? parseFloat(trident[1]) + 4 : _ie;
13113
- _firefox = agent[2] ? parseFloat(agent[2]) : NaN;
13114
- _opera = agent[3] ? parseFloat(agent[3]) : NaN;
13115
- _webkit = agent[4] ? parseFloat(agent[4]) : NaN;
13116
- if (_webkit) {
13117
- agent = /(?:Chrome\/(\d+\.\d+))/.exec(uas);
13118
- _chrome = agent && agent[1] ? parseFloat(agent[1]) : NaN;
13119
- } else {
13120
- _chrome = NaN;
13121
- }
13122
- } else {
13123
- _ie = _firefox = _opera = _chrome = _webkit = NaN;
13124
- }
13125
- if (os) {
13126
- if (os[1]) {
13127
- var ver = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(uas);
13128
- _osx = ver ? parseFloat(ver[1].replace("_", ".")) : true;
13129
- } else {
13130
- _osx = false;
13131
- }
13132
- _windows = !!os[2];
13133
- _linux = !!os[3];
13134
- } else {
13135
- _osx = _windows = _linux = false;
13136
- }
13137
- }
13138
- var UserAgent_DEPRECATED$1 = {
13139
- ie: function() {
13140
- return _populate() || _ie;
13141
- },
13142
- ieCompatibilityMode: function() {
13143
- return _populate() || _ie_real_version > _ie;
13144
- },
13145
- ie64: function() {
13146
- return UserAgent_DEPRECATED$1.ie() && _win64;
13147
- },
13148
- firefox: function() {
13149
- return _populate() || _firefox;
13150
- },
13151
- opera: function() {
13152
- return _populate() || _opera;
13153
- },
13154
- webkit: function() {
13155
- return _populate() || _webkit;
13156
- },
13157
- safari: function() {
13158
- return UserAgent_DEPRECATED$1.webkit();
13159
- },
13160
- chrome: function() {
13161
- return _populate() || _chrome;
13162
- },
13163
- windows: function() {
13164
- return _populate() || _windows;
13165
- },
13166
- osx: function() {
13167
- return _populate() || _osx;
13168
- },
13169
- linux: function() {
13170
- return _populate() || _linux;
13171
- },
13172
- iphone: function() {
13173
- return _populate() || _iphone;
13174
- },
13175
- mobile: function() {
13176
- return _populate() || (_iphone || _ipad || _android || _mobile);
13177
- },
13178
- nativeApp: function() {
13179
- return _populate() || _native;
13180
- },
13181
- android: function() {
13182
- return _populate() || _android;
13183
- },
13184
- ipad: function() {
13185
- return _populate() || _ipad;
13186
- }
13187
- };
13188
- var UserAgent_DEPRECATED_1 = UserAgent_DEPRECATED$1;
13189
- var canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
13190
- var ExecutionEnvironment$1 = {
13191
- canUseDOM,
13192
- canUseWorkers: typeof Worker !== "undefined",
13193
- canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
13194
- canUseViewport: canUseDOM && !!window.screen,
13195
- isInWorker: !canUseDOM
13196
- };
13197
- var ExecutionEnvironment_1 = ExecutionEnvironment$1;
13198
- var ExecutionEnvironment = ExecutionEnvironment_1;
13199
- var useHasFeature;
13200
- if (ExecutionEnvironment.canUseDOM) {
13201
- useHasFeature = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== true;
13202
- }
13203
- /**
13204
- * Checks if an event is supported in the current execution environment.
13205
- *
13206
- * NOTE: This will not work correctly for non-generic events such as `change`,
13207
- * `reset`, `load`, `error`, and `select`.
13208
- *
13209
- * Borrows from Modernizr.
13210
- *
13211
- * @param {string} eventNameSuffix Event name, e.g. "click".
13212
- * @param {?boolean} capture Check if the capture phase is supported.
13213
- * @return {boolean} True if the event is supported.
13214
- * @internal
13215
- * @license Modernizr 3.0.0pre (Custom Build) | MIT
13216
- */
13217
- function isEventSupported$1(eventNameSuffix, capture) {
13218
- if (!ExecutionEnvironment.canUseDOM || capture && !("addEventListener" in document)) {
13219
- return false;
13220
- }
13221
- var eventName = "on" + eventNameSuffix;
13222
- var isSupported = eventName in document;
13223
- if (!isSupported) {
13224
- var element = document.createElement("div");
13225
- element.setAttribute(eventName, "return;");
13226
- isSupported = typeof element[eventName] === "function";
13227
- }
13228
- if (!isSupported && useHasFeature && eventNameSuffix === "wheel") {
13229
- isSupported = document.implementation.hasFeature("Events.wheel", "3.0");
13256
+ }, [(_b = (_a = slots.default) == null ? void 0 : _a.call(slots, renderData)) != null ? _b : createVNode("span", {
13257
+ "class": getRenderItemClass(renderData),
13258
+ "style": getRenderItemStyle(renderData),
13259
+ "onClick": () => goToLink(renderData.link)
13260
+ }, null)]);
13261
+ })]), createVNode("ul", {
13262
+ "class": "bk-swiper-index"
13263
+ }, [computedRenderDataList.value.map((_2, index) => createVNode("li", {
13264
+ "class": getRenderIndexStyle(index),
13265
+ "onMouseover": () => changeIndex(index)
13266
+ }, null))]), createVNode("span", {
13267
+ "class": "bk-swiper-nav bk-nav-prev",
13268
+ "onClick": () => changeIndex(swiperIndex.value - 1)
13269
+ }, [createVNode("i", {
13270
+ "class": "bk-swiper-nav-icon"
13271
+ }, null)]), createVNode("span", {
13272
+ "class": "bk-swiper-nav bk-nav-next",
13273
+ "onClick": () => changeIndex(swiperIndex.value + 1)
13274
+ }, [createVNode("i", {
13275
+ "class": "bk-swiper-nav-icon"
13276
+ }, null)])]);
13230
13277
  }
13231
- return isSupported;
13278
+ });
13279
+ const BkSwiper = withInstall(Component$j);
13280
+ const selectKey = Symbol("BkSelect");
13281
+ const optionGroupKey = Symbol("BkOptionGroup");
13282
+ function useFocus() {
13283
+ const isFocus = ref(false);
13284
+ const handleFocus = () => {
13285
+ isFocus.value = true;
13286
+ };
13287
+ const handleBlur = () => {
13288
+ isFocus.value = false;
13289
+ };
13290
+ return {
13291
+ isFocus,
13292
+ handleFocus,
13293
+ handleBlur
13294
+ };
13232
13295
  }
13233
- var isEventSupported_1 = isEventSupported$1;
13234
- var UserAgent_DEPRECATED = UserAgent_DEPRECATED_1;
13235
- var isEventSupported = isEventSupported_1;
13236
- var PIXEL_STEP = 10;
13237
- var LINE_HEIGHT = 40;
13238
- var PAGE_HEIGHT = 800;
13239
- function normalizeWheel$1(event) {
13240
- var sX = 0, sY = 0, pX = 0, pY = 0;
13241
- if ("detail" in event) {
13242
- sY = event.detail;
13243
- }
13244
- if ("wheelDelta" in event) {
13245
- sY = -event.wheelDelta / 120;
13246
- }
13247
- if ("wheelDeltaY" in event) {
13248
- sY = -event.wheelDeltaY / 120;
13249
- }
13250
- if ("wheelDeltaX" in event) {
13251
- sX = -event.wheelDeltaX / 120;
13252
- }
13253
- if ("axis" in event && event.axis === event.HORIZONTAL_AXIS) {
13254
- sX = sY;
13255
- sY = 0;
13256
- }
13257
- pX = sX * PIXEL_STEP;
13258
- pY = sY * PIXEL_STEP;
13259
- if ("deltaY" in event) {
13260
- pY = event.deltaY;
13261
- }
13262
- if ("deltaX" in event) {
13263
- pX = event.deltaX;
13264
- }
13265
- if ((pX || pY) && event.deltaMode) {
13266
- if (event.deltaMode == 1) {
13267
- pX *= LINE_HEIGHT;
13268
- pY *= LINE_HEIGHT;
13269
- } else {
13270
- pX *= PAGE_HEIGHT;
13271
- pY *= PAGE_HEIGHT;
13296
+ function useHover() {
13297
+ const isHover = ref(false);
13298
+ const setHover = () => {
13299
+ isHover.value = true;
13300
+ };
13301
+ const cancelHover = () => {
13302
+ isHover.value = false;
13303
+ };
13304
+ return {
13305
+ isHover,
13306
+ setHover,
13307
+ cancelHover
13308
+ };
13309
+ }
13310
+ function useRegistry(data2) {
13311
+ const register = (item) => {
13312
+ if (!item || data2.value.find((d2) => d2 === item))
13313
+ return;
13314
+ return data2.value.push(item);
13315
+ };
13316
+ const unregister = (item) => {
13317
+ const index = data2.value.findIndex((d2) => d2 === item);
13318
+ if (index > -1) {
13319
+ data2.value.splice(index, 1);
13272
13320
  }
13273
- }
13274
- if (pX && !sX) {
13275
- sX = pX < 1 ? -1 : 1;
13276
- }
13277
- if (pY && !sY) {
13278
- sY = pY < 1 ? -1 : 1;
13279
- }
13321
+ };
13280
13322
  return {
13281
- spinX: sX,
13282
- spinY: sY,
13283
- pixelX: pX,
13284
- pixelY: pY
13323
+ register,
13324
+ unregister
13285
13325
  };
13286
13326
  }
13287
- normalizeWheel$1.getEventType = function() {
13288
- return UserAgent_DEPRECATED.firefox() ? "DOMMouseScroll" : isEventSupported("wheel") ? "wheel" : "mousewheel";
13289
- };
13290
- var normalizeWheel_1 = normalizeWheel$1;
13291
- var normalizeWheel = normalizeWheel_1;
13292
- const isFirefox = typeof navigator !== "undefined" && navigator.userAgent.toLowerCase().indexOf("firefox") > -1;
13293
- const mousewheelHandler = function(element, callback) {
13294
- if (element == null ? void 0 : element.addEventListener) {
13295
- element.addEventListener(isFirefox ? "DOMMouseScroll" : "mousewheel", function(e) {
13296
- const normalized = normalizeWheel(e);
13297
- callback == null ? void 0 : callback.apply(this, [e, normalized]);
13327
+ function useDebouncedRef(value, delay = 200) {
13328
+ let timeout;
13329
+ let innerValue = value;
13330
+ return customRef((track, trigger) => ({
13331
+ get() {
13332
+ track();
13333
+ return innerValue;
13334
+ },
13335
+ set(newValue) {
13336
+ clearTimeout(timeout);
13337
+ if (newValue === void 0 || newValue === "") {
13338
+ innerValue = newValue;
13339
+ trigger();
13340
+ } else {
13341
+ timeout = setTimeout(() => {
13342
+ innerValue = newValue;
13343
+ trigger();
13344
+ }, delay);
13345
+ }
13346
+ }
13347
+ }));
13348
+ }
13349
+ function usePopover(config) {
13350
+ const { popoverMinWidth } = config;
13351
+ const popperWidth = ref("auto");
13352
+ const isPopoverShow = ref(false);
13353
+ const onPopoverFirstUpdate = (instance) => {
13354
+ const { reference: reference2 } = instance.elements;
13355
+ popperWidth.value = Math.max(reference2.offsetWidth, popoverMinWidth);
13356
+ };
13357
+ const togglePopover = () => {
13358
+ isPopoverShow.value = !isPopoverShow.value;
13359
+ };
13360
+ const hidePopover = () => {
13361
+ isPopoverShow.value = false;
13362
+ };
13363
+ const showPopover = () => {
13364
+ isPopoverShow.value = true;
13365
+ };
13366
+ return {
13367
+ isPopoverShow,
13368
+ popperWidth,
13369
+ togglePopover,
13370
+ onPopoverFirstUpdate,
13371
+ hidePopover,
13372
+ showPopover
13373
+ };
13374
+ }
13375
+ function useRemoteSearch(method, callBack) {
13376
+ const searchKey = useDebouncedRef("");
13377
+ const searchLoading = ref(false);
13378
+ watch(searchKey, async () => {
13379
+ try {
13380
+ searchLoading.value = true;
13381
+ await method(searchKey.value);
13382
+ searchLoading.value = false;
13383
+ } catch (err) {
13384
+ console.error(err);
13385
+ } finally {
13386
+ callBack == null ? void 0 : callBack();
13387
+ }
13388
+ });
13389
+ return {
13390
+ searchKey,
13391
+ searchLoading
13392
+ };
13393
+ }
13394
+ function toLowerCase(value = "") {
13395
+ if (!value)
13396
+ return value;
13397
+ return String(value).trim().toLowerCase();
13398
+ }
13399
+ var BkOption = defineComponent({
13400
+ name: "Option",
13401
+ props: {
13402
+ value: PropTypes.any,
13403
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
13404
+ disabled: PropTypes.bool.def(false)
13405
+ },
13406
+ setup(props) {
13407
+ const {
13408
+ proxy
13409
+ } = getCurrentInstance();
13410
+ const states = reactive({
13411
+ visible: true
13412
+ });
13413
+ const {
13414
+ disabled,
13415
+ value
13416
+ } = toRefs(props);
13417
+ const select2 = inject(selectKey, null);
13418
+ const group = inject(optionGroupKey, null);
13419
+ const selected = computed(() => {
13420
+ var _a;
13421
+ return (_a = select2 == null ? void 0 : select2.selected) == null ? void 0 : _a.some((data2) => data2.value === value.value);
13422
+ });
13423
+ const multiple = computed(() => select2 == null ? void 0 : select2.multiple);
13424
+ const isHover = computed(() => (select2 == null ? void 0 : select2.activeOptionValue) === value.value);
13425
+ const handleOptionClick = () => {
13426
+ if (disabled.value)
13427
+ return;
13428
+ select2 == null ? void 0 : select2.handleOptionSelected(proxy);
13429
+ };
13430
+ const handleMouseEnter = () => {
13431
+ select2.activeOptionValue = value.value;
13432
+ };
13433
+ onBeforeMount(() => {
13434
+ select2 == null ? void 0 : select2.register(proxy);
13435
+ group == null ? void 0 : group.register(proxy);
13436
+ });
13437
+ onBeforeUnmount(() => {
13438
+ select2 == null ? void 0 : select2.unregister(proxy);
13439
+ group == null ? void 0 : group.unregister(proxy);
13440
+ });
13441
+ return __spreadProps(__spreadValues({}, toRefs(states)), {
13442
+ selected,
13443
+ multiple,
13444
+ isHover,
13445
+ handleOptionClick,
13446
+ handleMouseEnter
13447
+ });
13448
+ },
13449
+ render() {
13450
+ var _a, _b, _c;
13451
+ const selectItemClass = classes({
13452
+ "is-selected": this.selected,
13453
+ "is-disabled": this.disabled,
13454
+ "is-multiple": this.multiple,
13455
+ "is-hover": this.isHover,
13456
+ "bk-select-option": true
13298
13457
  });
13299
- }
13300
- };
13301
- const mousewheel = {
13302
- beforeMount(el, binding) {
13303
- console.error(el, binding);
13304
- mousewheelHandler(el, binding.value);
13305
- }
13306
- };
13307
- const isElement = (e) => {
13308
- if (typeof Element === "undefined")
13309
- return false;
13310
- return e instanceof Element;
13311
- };
13312
- const nodeList = /* @__PURE__ */ new Map();
13313
- let startClick;
13314
- document.addEventListener("mousedown", (e) => startClick = e);
13315
- document.addEventListener("mouseup", (e) => {
13316
- for (const handlers of nodeList.values()) {
13317
- for (const { documentHandler } of handlers) {
13318
- documentHandler(e, startClick);
13319
- }
13458
+ return withDirectives(createVNode("li", {
13459
+ "class": selectItemClass,
13460
+ "onClick": this.handleOptionClick,
13461
+ "onMouseenter": this.handleMouseEnter
13462
+ }, [(_c = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode("span", null, [this.label])]), [[vShow, this.visible]]);
13320
13463
  }
13321
13464
  });
13322
- function createDocumentHandler(el, binding) {
13323
- let excludes = [];
13324
- if (Array.isArray(binding.arg)) {
13325
- excludes = binding.arg;
13326
- } else if (isElement(binding.arg)) {
13327
- excludes.push(binding.arg);
13328
- }
13329
- return function(mouseup, mousedown) {
13330
- const { popperRef } = binding.instance;
13331
- const mouseUpTarget = mouseup.target;
13332
- const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
13333
- const isBound = !binding || !binding.instance;
13334
- const isTargetExists = !mouseUpTarget || !mouseDownTarget;
13335
- const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
13336
- const isSelf = el === mouseUpTarget;
13337
- const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
13338
- const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
13339
- if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
13340
- return;
13341
- }
13342
- binding.value(mouseup, mousedown);
13343
- };
13344
- }
13345
- const ClickOutside = {
13346
- beforeMount(el, binding) {
13347
- if (!nodeList.has(el)) {
13348
- nodeList.set(el, []);
13349
- }
13350
- nodeList.get(el).push({
13351
- documentHandler: createDocumentHandler(el, binding),
13352
- bindingFn: binding.value
13353
- });
13465
+ var OptionGroup = defineComponent({
13466
+ name: "Group",
13467
+ props: {
13468
+ label: PropTypes.string.def(""),
13469
+ disabled: PropTypes.bool.def(false),
13470
+ collapsible: PropTypes.bool.def(false),
13471
+ collapse: PropTypes.bool.def(false)
13354
13472
  },
13355
- updated(el, binding) {
13356
- if (!nodeList.has(el)) {
13357
- nodeList.set(el, []);
13358
- }
13359
- const handlers = nodeList.get(el);
13360
- const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
13361
- const newHandler = {
13362
- documentHandler: createDocumentHandler(el, binding),
13363
- bindingFn: binding.value
13473
+ setup(props, {
13474
+ emit
13475
+ }) {
13476
+ const {
13477
+ proxy
13478
+ } = getCurrentInstance();
13479
+ const select2 = inject(selectKey, null);
13480
+ const states = reactive({
13481
+ groupCollapse: props.collapse,
13482
+ visible: true
13483
+ });
13484
+ const options = ref([]);
13485
+ const {
13486
+ register,
13487
+ unregister
13488
+ } = useRegistry(options);
13489
+ const groupLabel = computed(() => `${props.label} (${[...options.value.values()].filter((option) => option.visible).length})`);
13490
+ const handleToggleCollapse = () => {
13491
+ if (!props.collapsible || props.disabled)
13492
+ return;
13493
+ states.groupCollapse = !states.groupCollapse;
13494
+ emit("update:collapse", states.groupCollapse);
13364
13495
  };
13365
- if (oldHandlerIndex >= 0) {
13366
- handlers.splice(oldHandlerIndex, 1, newHandler);
13367
- } else {
13368
- handlers.push(newHandler);
13369
- }
13496
+ provide(optionGroupKey, reactive(__spreadProps(__spreadValues({}, toRefs(props)), {
13497
+ register,
13498
+ unregister,
13499
+ groupCollapse: toRef(states, "groupCollapse")
13500
+ })));
13501
+ onBeforeMount(() => {
13502
+ select2 == null ? void 0 : select2.registerGroup(proxy);
13503
+ });
13504
+ onBeforeUnmount(() => {
13505
+ select2 == null ? void 0 : select2.unregisterGroup(proxy);
13506
+ });
13507
+ return __spreadProps(__spreadValues({}, toRefs(states)), {
13508
+ groupLabel,
13509
+ handleToggleCollapse
13510
+ });
13370
13511
  },
13371
- unmounted(el) {
13372
- nodeList.delete(el);
13373
- }
13374
- };
13375
- var popper = "";
13376
- const tooltips = {
13377
- mounted(el, binding) {
13378
- const opts = initOptions();
13379
- if (typeof binding.value === "object") {
13380
- Object.assign(opts, binding.value);
13381
- } else {
13382
- opts.content = binding.value;
13383
- }
13384
- const { disabled, arrow: arrow2, theme } = opts;
13385
- if (disabled) {
13386
- return;
13387
- }
13388
- const popper2 = renderContent(opts.content, arrow2, theme === "light");
13389
- createPopperInstance(el, popper2, opts);
13390
- }
13391
- };
13392
- function initOptions() {
13393
- const defaultOpts = {
13394
- arrow: true,
13395
- disabled: false,
13396
- trigger: "hover",
13397
- theme: "dark",
13398
- content: "",
13399
- showOnInit: false,
13400
- placement: "top",
13401
- distance: 8,
13402
- onShow: () => {
13403
- },
13404
- onHide: () => {
13405
- }
13406
- };
13407
- return defaultOpts;
13408
- }
13409
- function renderContent(value, hasArrow, isLight) {
13410
- const zIndex = bkZIndexManager.getPopperIndex();
13411
- const content = document.createElement("div");
13412
- content.className = `bk-popper ${isLight ? "light" : "dark"}`;
13413
- content.innerText = value;
13414
- content.style.zIndex = String(zIndex);
13415
- if (hasArrow) {
13416
- const arrow2 = renderArrow();
13417
- content.appendChild(arrow2);
13418
- }
13419
- document.body.appendChild(content);
13420
- return content;
13421
- }
13422
- function renderArrow() {
13423
- const arrow2 = document.createElement("div");
13424
- arrow2.className = "bk-popper-arrow";
13425
- arrow2.setAttribute("data-popper-arrow", "");
13426
- return arrow2;
13427
- }
13428
- function createPopperInstance(el, popper2, options) {
13429
- const { placement, distance, trigger, showOnInit, onShow, onHide } = options;
13430
- const popperInstance = createPopper(el, popper2, {
13431
- placement,
13432
- modifiers: [
13433
- {
13434
- name: "offset",
13435
- options: {
13436
- offset: [0, distance]
13437
- }
13438
- }
13439
- ]
13440
- });
13441
- if (trigger === "hover") {
13442
- const showEvents = ["mouseenter", "focus"];
13443
- const hideEvents = ["mouseleave", "blur"];
13444
- showEvents.forEach((event) => {
13445
- el.addEventListener(event, show);
13512
+ render() {
13513
+ var _a, _b;
13514
+ const groupClass = classes({
13515
+ "bk-option-group": true,
13516
+ collapsible: this.collapsible,
13517
+ disabled: this.disabled
13446
13518
  });
13447
- hideEvents.forEach((event) => {
13448
- el.addEventListener(event, hide2);
13519
+ const groupLabelClass = classes({
13520
+ "bk-option-group-label": true,
13521
+ collapsible: this.collapsible
13449
13522
  });
13450
- } else if (trigger === "click") {
13451
- document.body.addEventListener("click", (event) => {
13452
- if (el.contains(event.target) && !popper2.hasAttribute("data-show")) {
13453
- show();
13454
- } else if (popper2.hasAttribute("data-show")) {
13455
- hide2();
13456
- }
13523
+ const groupLabelIconClass = classes({
13524
+ "default-group-label-icon": true,
13525
+ collapse: this.groupCollapse
13457
13526
  });
13527
+ return withDirectives(createVNode("ul", {
13528
+ "class": groupClass
13529
+ }, [createVNode("li", {
13530
+ "class": groupLabelClass,
13531
+ "onClick": this.handleToggleCollapse
13532
+ }, [this.$slots.label ? this.$slots.label() : createVNode("span", {
13533
+ "class": "default-group-label"
13534
+ }, [this.collapsible && createVNode(angleUpFill, {
13535
+ "class": groupLabelIconClass
13536
+ }, null), createVNode("span", {
13537
+ "class": "default-group-label-title"
13538
+ }, [this.groupLabel])])]), withDirectives(createVNode("ul", {
13539
+ "class": "bk-option-group-content"
13540
+ }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), [[vShow, !this.groupCollapse]])]), [[vShow, this.visible]]);
13458
13541
  }
13459
- if (showOnInit)
13460
- show();
13461
- function show() {
13462
- popper2.setAttribute("data-show", "");
13463
- onShow();
13464
- popperInstance.setOptions((options2) => __spreadProps(__spreadValues({}, options2), {
13465
- modifiers: [
13466
- ...options2.modifiers,
13467
- { name: "eventListeners", enabled: true }
13468
- ]
13469
- }));
13470
- popperInstance.update();
13471
- }
13472
- function hide2() {
13473
- popper2.removeAttribute("data-show");
13474
- onHide();
13475
- popperInstance.setOptions((options2) => __spreadProps(__spreadValues({}, options2), {
13476
- modifiers: [
13477
- ...options2.modifiers,
13478
- { name: "eventListeners", enabled: false }
13479
- ]
13480
- }));
13481
- }
13482
- }
13542
+ });
13483
13543
  var Component$i = defineComponent({
13484
13544
  name: "Tag",
13485
13545
  props: {
@@ -14805,7 +14865,14 @@ var Component$d = defineComponent({
14805
14865
  }
14806
14866
  });
14807
14867
  const BkVirtualRender = withInstall(Component$d);
14808
- const BORDER_OPRIONS = ["none", "row", "col", "outer"];
14868
+ var BORDER_OPTION = /* @__PURE__ */ ((BORDER_OPTION2) => {
14869
+ BORDER_OPTION2["NONE"] = "none";
14870
+ BORDER_OPTION2["ROW"] = "row";
14871
+ BORDER_OPTION2["COL"] = "col";
14872
+ BORDER_OPTION2["OUTER"] = "outer";
14873
+ return BORDER_OPTION2;
14874
+ })(BORDER_OPTION || {});
14875
+ const BORDER_OPTIONS = ["none", "row", "col", "outer"];
14809
14876
  var EVENTS$1 = /* @__PURE__ */ ((EVENTS2) => {
14810
14877
  EVENTS2["ON_SORT_BY_CLICK"] = "onSortByClick";
14811
14878
  EVENTS2["ON_FILTER_CLICK"] = "onFilterClick";
@@ -15007,7 +15074,7 @@ const tableProps = {
15007
15074
  cellFn: PropTypes.func.def(void 0)
15008
15075
  }),
15009
15076
  virtualEnabled: PropTypes.bool.def(false),
15010
- border: PropTypes.arrayOf(PropTypes.commonType(BORDER_OPRIONS, "border")).def(["row"]),
15077
+ border: PropTypes.arrayOf(PropTypes.commonType(BORDER_OPTIONS, "border")).def([BORDER_OPTION.ROW]),
15011
15078
  pagination: PropTypes.oneOfType([PropTypes.bool.def(false), PropTypes.object.def({})]).def(false),
15012
15079
  remotePagination: PropTypes.bool.def(false),
15013
15080
  emptyText: PropTypes.string.def("\u6682\u65E0\u6570\u636E"),
@@ -15524,7 +15591,7 @@ const resolvePropBorderToClassStr = (val) => {
15524
15591
  defaultVal.push(val);
15525
15592
  }
15526
15593
  if (Array.isArray(val)) {
15527
- defaultVal.push(...val.filter((str) => BORDER_OPRIONS.includes(str)));
15594
+ defaultVal.push(...val.filter((str) => BORDER_OPTIONS.includes(str)));
15528
15595
  }
15529
15596
  return [...new Set(defaultVal)].map((item) => `bordered-${item}`).join(" ");
15530
15597
  };
@@ -15532,11 +15599,11 @@ const getColumnReactWidth = (colmun, orders = ["resizeWidth", "calcWidth", "widt
15532
15599
  var _a, _b;
15533
15600
  return (_b = (_a = colmun[orders[0]]) != null ? _a : colmun[orders[1]]) != null ? _b : colmun[orders[2]];
15534
15601
  };
15535
- const resolveColumnWidth = (root, colgroups, autoWidth = 20, hasScrollY = false) => {
15602
+ const resolveColumnWidth = (root, colgroups, autoWidth = 20, offsetWidth = 0) => {
15536
15603
  const {
15537
15604
  width
15538
15605
  } = root.getBoundingClientRect() || {};
15539
- const availableWidth = width - (hasScrollY ? 4 : 0);
15606
+ const availableWidth = width - offsetWidth;
15540
15607
  let avgWidth = availableWidth;
15541
15608
  const avgColIndexList = [];
15542
15609
  const getMinWidth = (col, computedWidth) => {
@@ -16697,6 +16764,16 @@ const useClass = (props, root, reactiveProp, pageData) => {
16697
16764
  }
16698
16765
  }
16699
16766
  };
16767
+ const getColumnsWidthOffsetWidth = () => {
16768
+ let offsetWidth = 0;
16769
+ if (hasScrollY.value) {
16770
+ offsetWidth = offsetWidth + 4;
16771
+ }
16772
+ if (props.border.includes(BORDER_OPTION.OUTER) && !props.border.includes(BORDER_OPTION.NONE)) {
16773
+ offsetWidth = offsetWidth + 2;
16774
+ }
16775
+ return offsetWidth;
16776
+ };
16700
16777
  return {
16701
16778
  tableClass,
16702
16779
  headClass,
@@ -16707,6 +16784,7 @@ const useClass = (props, root, reactiveProp, pageData) => {
16707
16784
  headStyle,
16708
16785
  resetTableHeight,
16709
16786
  updateBorderClass,
16787
+ getColumnsWidthOffsetWidth,
16710
16788
  hasFooter,
16711
16789
  hasScrollY
16712
16790
  };
@@ -16821,8 +16899,8 @@ var Component$b = defineComponent({
16821
16899
  headStyle,
16822
16900
  updateBorderClass,
16823
16901
  resetTableHeight,
16824
- hasFooter,
16825
- hasScrollY
16902
+ getColumnsWidthOffsetWidth,
16903
+ hasFooter
16826
16904
  } = useClass(props, root, reactiveSchema, pageData);
16827
16905
  const tableRender = new TableRender(props, ctx, reactiveSchema, colgroups);
16828
16906
  watch(() => [props.data, props.pagination], () => {
@@ -16836,8 +16914,11 @@ var Component$b = defineComponent({
16836
16914
  immediate: true,
16837
16915
  deep: true
16838
16916
  });
16839
- watch(hasScrollY, (val) => {
16840
- resolveColumnWidth(root.value, colgroups, 20, !!val);
16917
+ watchEffect(() => {
16918
+ if ((root == null ? void 0 : root.value) instanceof HTMLElement) {
16919
+ const offset2 = getColumnsWidthOffsetWidth();
16920
+ resolveColumnWidth(root.value, colgroups, 20, offset2);
16921
+ }
16841
16922
  });
16842
16923
  tableRender.on(EVENTS$1.ON_SORT_BY_CLICK, (args) => {
16843
16924
  const {
@@ -16878,7 +16959,8 @@ var Component$b = defineComponent({
16878
16959
  size,
16879
16960
  height
16880
16961
  } = args;
16881
- checked.length && resolveColumnWidth(root.value, colgroups, 20, hasScrollY.value);
16962
+ const offset2 = getColumnsWidthOffsetWidth();
16963
+ checked.length && resolveColumnWidth(root.value, colgroups, 20, offset2);
16882
16964
  (_b = (_a = refVirtualRender.value) == null ? void 0 : _a.reset) == null ? void 0 : _b.call(_a);
16883
16965
  ctx.emit(EMITEVENTS.SETTING_CHANGE, {
16884
16966
  checked,