bkui-vue 2.0.1-beta.110 → 2.0.1-beta.112

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.
Files changed (257) hide show
  1. package/dist/index.cjs.js +54 -54
  2. package/dist/index.esm.js +23106 -23099
  3. package/dist/index.umd.js +54 -54
  4. package/dist/style.css +1 -1
  5. package/lib/affix/index.d.ts +57 -111
  6. package/lib/affix/index.js +17 -17
  7. package/lib/alert/index.d.ts +73 -126
  8. package/lib/alert/index.js +20 -20
  9. package/lib/animate-number/index.d.ts +33 -96
  10. package/lib/animate-number/index.js +8 -7
  11. package/lib/backtop/index.d.ts +69 -117
  12. package/lib/backtop/index.js +11 -10
  13. package/lib/badge/index.d.ts +119 -152
  14. package/lib/badge/index.js +19 -19
  15. package/lib/breadcrumb/index.d.ts +67 -119
  16. package/lib/breadcrumb/index.js +17 -17
  17. package/lib/button/button.d.ts +2 -2
  18. package/lib/button/index.d.ts +121 -156
  19. package/lib/button/index.js +19 -20
  20. package/lib/card/index.d.ts +128 -157
  21. package/lib/card/index.js +20 -22
  22. package/lib/cascader/cascader.d.ts +5 -5
  23. package/lib/cascader/index.d.ts +395 -356
  24. package/lib/cascader/index.js +74 -805
  25. package/lib/checkbox/checkbox.d.ts +1 -1
  26. package/lib/checkbox/index.d.ts +143 -175
  27. package/lib/checkbox/index.js +45 -45
  28. package/lib/code-diff/index.d.ts +65 -82
  29. package/lib/code-diff/index.js +381 -438
  30. package/lib/collapse/index.d.ts +156 -175
  31. package/lib/collapse/index.js +28 -27
  32. package/lib/collapse-transition/index.d.ts +19 -94
  33. package/lib/collapse-transition/index.js +4 -3
  34. package/lib/color-picker/color-picker.d.ts +1 -1
  35. package/lib/color-picker/index.d.ts +144 -165
  36. package/lib/color-picker/index.js +50 -294
  37. package/lib/config-provider/index.d.ts +160 -227
  38. package/lib/config-provider/index.js +17 -17
  39. package/lib/container/container.d.ts +1 -1
  40. package/lib/container/index.d.ts +74 -85
  41. package/lib/container/index.js +28 -26
  42. package/lib/date-picker/base/picker-dropdown.d.ts +1 -1
  43. package/lib/date-picker/base/time-spinner.d.ts +3 -3
  44. package/lib/date-picker/date-picker.d.ts +4 -4
  45. package/lib/date-picker/index.d.ts +382 -352
  46. package/lib/date-picker/index.js +154 -150
  47. package/lib/date-picker/panel/date-range.d.ts +1 -1
  48. package/lib/date-picker/panel/date.d.ts +1 -1
  49. package/lib/date-picker/panel/time-range.d.ts +2 -2
  50. package/lib/date-picker/panel/time.d.ts +2 -2
  51. package/lib/date-picker/time-picker.d.ts +4 -4
  52. package/lib/dialog/index.d.ts +299 -269
  53. package/lib/dialog/index.js +227 -228
  54. package/lib/directives/index.d.ts +1 -0
  55. package/lib/directives/index.js +29 -29
  56. package/lib/divider/index.d.ts +57 -111
  57. package/lib/divider/index.js +3 -2
  58. package/lib/dropdown/dropdown.d.ts +1 -1
  59. package/lib/dropdown/index.d.ts +94 -136
  60. package/lib/dropdown/index.js +24 -22
  61. package/lib/exception/index.d.ts +41 -102
  62. package/lib/exception/index.js +21 -21
  63. package/lib/fixed-navbar/index.d.ts +59 -113
  64. package/lib/fixed-navbar/index.js +3 -2
  65. package/lib/form/form.d.ts +1 -1
  66. package/lib/form/index.d.ts +80 -132
  67. package/lib/form/index.js +21 -22
  68. package/lib/icon/angle-double-down-line.js +17 -17
  69. package/lib/icon/angle-double-left-line.js +17 -17
  70. package/lib/icon/angle-double-left.js +17 -17
  71. package/lib/icon/angle-double-right-line.js +17 -17
  72. package/lib/icon/angle-double-right.js +17 -17
  73. package/lib/icon/angle-double-up-line.js +17 -17
  74. package/lib/icon/angle-down-fill.js +17 -17
  75. package/lib/icon/angle-down-line.js +17 -17
  76. package/lib/icon/angle-down.js +17 -17
  77. package/lib/icon/angle-left.js +17 -17
  78. package/lib/icon/angle-right.js +17 -17
  79. package/lib/icon/angle-up-fill.js +17 -17
  80. package/lib/icon/angle-up.js +17 -17
  81. package/lib/icon/archive-fill.js +17 -17
  82. package/lib/icon/arrows-left.js +17 -17
  83. package/lib/icon/arrows-right.js +17 -17
  84. package/lib/icon/assistant.js +17 -17
  85. package/lib/icon/audio-fill.js +17 -17
  86. package/lib/icon/bk.js +17 -17
  87. package/lib/icon/circle.js +17 -17
  88. package/lib/icon/close-line.js +17 -17
  89. package/lib/icon/close.js +17 -17
  90. package/lib/icon/code.js +17 -17
  91. package/lib/icon/cog-shape.js +17 -17
  92. package/lib/icon/collapse-left.js +17 -17
  93. package/lib/icon/copy-shape.js +17 -17
  94. package/lib/icon/copy.js +17 -17
  95. package/lib/icon/data-shape.js +17 -17
  96. package/lib/icon/del.js +17 -17
  97. package/lib/icon/doc-fill.js +17 -17
  98. package/lib/icon/done.js +17 -17
  99. package/lib/icon/down-shape.js +17 -17
  100. package/lib/icon/down-small.js +17 -17
  101. package/lib/icon/edit-line.js +17 -17
  102. package/lib/icon/ellipsis.js +17 -17
  103. package/lib/icon/enlarge-line.js +17 -17
  104. package/lib/icon/error.js +17 -17
  105. package/lib/icon/excel-fill.js +17 -17
  106. package/lib/icon/exclamation-circle-shape.js +17 -17
  107. package/lib/icon/eye.js +17 -17
  108. package/lib/icon/filliscreen-line.js +17 -17
  109. package/lib/icon/fix-line.js +17 -17
  110. package/lib/icon/fix-shape.js +17 -17
  111. package/lib/icon/folder-open.js +17 -17
  112. package/lib/icon/folder-shape-open.js +17 -17
  113. package/lib/icon/folder-shape.js +17 -17
  114. package/lib/icon/folder.js +17 -17
  115. package/lib/icon/funnel.js +17 -17
  116. package/lib/icon/grag-fill.js +17 -17
  117. package/lib/icon/help-document-fill.js +17 -17
  118. package/lib/icon/help-fill.js +17 -17
  119. package/lib/icon/help.js +17 -17
  120. package/lib/icon/image-fill.js +17 -17
  121. package/lib/icon/img-error.js +17 -17
  122. package/lib/icon/img-placehoulder.js +17 -17
  123. package/lib/icon/info-line.js +17 -17
  124. package/lib/icon/info.js +17 -17
  125. package/lib/icon/left-shape.js +17 -17
  126. package/lib/icon/left-turn-line.js +17 -17
  127. package/lib/icon/loading.js +17 -17
  128. package/lib/icon/narrow-line.js +17 -17
  129. package/lib/icon/original.js +17 -17
  130. package/lib/icon/pdf-fill.js +17 -17
  131. package/lib/icon/play-shape.js +17 -17
  132. package/lib/icon/plus.js +17 -17
  133. package/lib/icon/ppt-fill.js +17 -17
  134. package/lib/icon/qq.js +17 -17
  135. package/lib/icon/right-shape.js +17 -17
  136. package/lib/icon/right-turn-line.js +17 -17
  137. package/lib/icon/search.js +17 -17
  138. package/lib/icon/share.js +17 -17
  139. package/lib/icon/spinner.js +17 -17
  140. package/lib/icon/success.js +17 -17
  141. package/lib/icon/switcher-loading.js +17 -17
  142. package/lib/icon/text-all.js +17 -17
  143. package/lib/icon/text-file.js +17 -17
  144. package/lib/icon/text-fill.js +17 -17
  145. package/lib/icon/transfer.js +17 -17
  146. package/lib/icon/tree-application-shape.js +17 -17
  147. package/lib/icon/unfull-screen.js +17 -17
  148. package/lib/icon/unvisible.js +17 -17
  149. package/lib/icon/up-shape.js +17 -17
  150. package/lib/icon/upload.js +17 -17
  151. package/lib/icon/video-fill.js +17 -17
  152. package/lib/icon/warn.js +17 -17
  153. package/lib/icon/weixin-pro.js +17 -17
  154. package/lib/icon/weixin.js +17 -17
  155. package/lib/image/index.d.ts +113 -149
  156. package/lib/image/index.js +27 -26
  157. package/lib/index.js +1 -1
  158. package/lib/info-box/index.js +232 -233
  159. package/lib/input/index.d.ts +326 -293
  160. package/lib/input/index.js +46 -48
  161. package/lib/link/index.d.ts +73 -122
  162. package/lib/link/index.js +2 -2
  163. package/lib/loading/index.d.ts +130 -156
  164. package/lib/loading/index.js +32 -33
  165. package/lib/loading/loading.d.ts +1 -1
  166. package/lib/menu/index.d.ts +55 -116
  167. package/lib/menu/index.js +26 -25
  168. package/lib/message/index.js +24 -25
  169. package/lib/message/messageConstructor.d.ts +5 -5
  170. package/lib/modal/index.d.ts +171 -185
  171. package/lib/modal/index.js +19 -19
  172. package/lib/navigation/index.d.ts +152 -188
  173. package/lib/navigation/index.js +9 -7
  174. package/lib/notify/index.js +20 -21
  175. package/lib/overflow-title/index.d.ts +343 -256
  176. package/lib/overflow-title/index.js +11 -10
  177. package/lib/pagination/index.d.ts +185 -199
  178. package/lib/pagination/index.js +49 -56
  179. package/lib/pagination/pagination.d.ts +1 -1
  180. package/lib/plugin-popover/index.d.ts +1 -1
  181. package/lib/plugin-popover/index.js +4 -3898
  182. package/lib/pop-confirm/index.d.ts +119 -157
  183. package/lib/pop-confirm/index.js +5 -4
  184. package/lib/pop-confirm/pop-confirm.d.ts +5 -5
  185. package/lib/pop-confirm/props.d.ts +1 -1
  186. package/lib/popover/content.d.ts +1 -1
  187. package/lib/popover/index.d.ts +421 -359
  188. package/lib/popover/index.js +241 -264
  189. package/lib/popover2/index.d.ts +8 -83
  190. package/lib/popover2/index.js +2 -2
  191. package/lib/process/index.d.ts +93 -137
  192. package/lib/process/index.js +226 -226
  193. package/lib/progress/index.d.ts +178 -187
  194. package/lib/progress/index.js +22 -21
  195. package/lib/progress/progress.d.ts +2 -2
  196. package/lib/radio/index.d.ts +91 -140
  197. package/lib/radio/index.js +46 -48
  198. package/lib/rate/index.d.ts +55 -112
  199. package/lib/rate/index.js +19 -20
  200. package/lib/resize-layout/index.d.ts +168 -192
  201. package/lib/resize-layout/index.js +20 -21
  202. package/lib/resize-layout/resize-layout.d.ts +2 -2
  203. package/lib/scrollbar/index.js +38 -38
  204. package/lib/search-select/index.d.ts +678 -895
  205. package/lib/search-select/index.js +274 -274
  206. package/lib/search-select/input.d.ts +2 -2
  207. package/lib/search-select/search-select.d.ts +133 -188
  208. package/lib/search-select/selected.d.ts +133 -188
  209. package/lib/select/index.d.ts +1380 -1221
  210. package/lib/select/index.js +336 -334
  211. package/lib/select/select.d.ts +134 -171
  212. package/lib/select/selectTagInput.d.ts +2 -2
  213. package/lib/shared/index.js +54 -56
  214. package/lib/sideslider/index.d.ts +197 -201
  215. package/lib/sideslider/index.js +227 -228
  216. package/lib/slider/index.d.ts +214 -210
  217. package/lib/slider/index.js +226 -225
  218. package/lib/steps/index.d.ts +110 -149
  219. package/lib/steps/index.js +230 -231
  220. package/lib/swiper/index.d.ts +81 -127
  221. package/lib/swiper/index.js +18 -18
  222. package/lib/switcher/index.d.ts +152 -174
  223. package/lib/switcher/index.js +20 -22
  224. package/lib/tab/index.d.ts +151 -183
  225. package/lib/tab/index.js +20 -19
  226. package/lib/table/components/table-column.d.ts +1 -1
  227. package/lib/table/hooks/use-columns.d.ts +1 -1
  228. package/lib/table/hooks/use-layout.d.ts +2 -2
  229. package/lib/table/hooks/use-rows.d.ts +1 -1
  230. package/lib/table/index.d.ts +459 -364
  231. package/lib/table/index.js +336 -348
  232. package/lib/table/table.d.ts +3 -3
  233. package/lib/table-column/index.d.ts +104 -150
  234. package/lib/table-column/index.js +7 -731
  235. package/lib/tag/index.d.ts +95 -142
  236. package/lib/tag/index.js +19 -19
  237. package/lib/tag-input/index.d.ts +750 -533
  238. package/lib/tag-input/index.js +151 -151
  239. package/lib/tag-input/tag-input.d.ts +9 -9
  240. package/lib/tag-input/tag-props.d.ts +1 -1
  241. package/lib/tag-input/tag-render.d.ts +2 -2
  242. package/lib/time-picker/index.d.ts +439 -386
  243. package/lib/timeline/index.d.ts +64 -131
  244. package/lib/timeline/index.js +6 -6
  245. package/lib/transfer/index.d.ts +192 -207
  246. package/lib/transfer/transfer.d.ts +1 -1
  247. package/lib/tree/index.d.ts +350 -308
  248. package/lib/tree/index.js +71 -74
  249. package/lib/tree/tree.d.ts +1 -1
  250. package/lib/tree/use-tree-init.d.ts +1 -1
  251. package/lib/upload/index.d.ts +311 -273
  252. package/lib/upload/index.js +261 -264
  253. package/lib/upload/upload.d.ts +2 -2
  254. package/lib/virtual-render/index.d.ts +333 -241
  255. package/lib/virtual-render/index.js +29 -29
  256. package/lib/virtual-render/virtual-render.d.ts +1 -1
  257. package/package.json +1 -1
@@ -1,10 +1,5 @@
1
1
  import "../styles/reset.css";
2
- import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
3
- import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__ from "../shared";
4
- import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__ from "../config-provider";
5
- import * as __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__ from "vue-types";
6
- import * as __WEBPACK_EXTERNAL_MODULE_lodash_isElement_e6b2a6ce__ from "lodash/isElement";
7
- import * as __WEBPACK_EXTERNAL_MODULE_lodash_random_1771bfd1__ from "lodash/random";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_popover_9b03f19d__ from "../popover";
8
3
  /******/ // The require scope
9
4
  /******/ var __webpack_require__ = {};
10
5
  /******/
@@ -34,3899 +29,10 @@ __webpack_require__.d(__webpack_exports__, {
34
29
  "default": () => (/* binding */ src)
35
30
  });
36
31
 
37
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/typeof.js
38
- function _typeof(obj) {
39
- "@babel/helpers - typeof";
40
-
41
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
42
- return typeof obj;
43
- } : function (obj) {
44
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
45
- }, _typeof(obj);
46
- }
47
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
48
-
49
- function _toPrimitive(input, hint) {
50
- if (_typeof(input) !== "object" || input === null) return input;
51
- var prim = input[Symbol.toPrimitive];
52
- if (prim !== undefined) {
53
- var res = prim.call(input, hint || "default");
54
- if (_typeof(res) !== "object") return res;
55
- throw new TypeError("@@toPrimitive must return a primitive value.");
56
- }
57
- return (hint === "string" ? String : Number)(input);
58
- }
59
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
60
-
61
-
62
- function _toPropertyKey(arg) {
63
- var key = _toPrimitive(arg, "string");
64
- return _typeof(key) === "symbol" ? key : String(key);
65
- }
66
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
67
-
68
- function _defineProperty(obj, key, value) {
69
- key = _toPropertyKey(key);
70
- if (key in obj) {
71
- Object.defineProperty(obj, key, {
72
- value: value,
73
- enumerable: true,
74
- configurable: true,
75
- writable: true
76
- });
77
- } else {
78
- obj[key] = value;
79
- }
80
- return obj;
81
- }
82
- ;// CONCATENATED MODULE: external "vue"
32
+ ;// CONCATENATED MODULE: external "../popover"
83
33
  var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
84
34
  var y = x => () => x
85
- const external_vue_namespaceObject = x({ ["Fragment"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.Fragment, ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["createApp"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createApp, ["createVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.createVNode, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["isVNode"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.isVNode, ["mergeProps"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.mergeProps, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["resolveDirective"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.resolveDirective, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch, ["withDirectives"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.withDirectives });
86
- ;// CONCATENATED MODULE: external "../shared"
87
- var shared_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
88
- var shared_y = x => () => x
89
- const shared_namespaceObject = shared_x({ ["PlacementEnum"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__.PlacementEnum, ["PropTypes"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__.PropTypes, ["RenderType"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__.RenderType, ["bkZIndexManager"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__.bkZIndexManager, ["placementType"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__.placementType, ["renderDirectiveType"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__.renderDirectiveType, ["renderType"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__.renderType, ["triggerType"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__.triggerType });
90
- ;// CONCATENATED MODULE: ../../packages/directives/src/clickoutside.ts
91
- function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
92
- function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
93
- function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
94
- /*
95
- * Tencent is pleased to support the open source community by making
96
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
97
- *
98
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
99
- *
100
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
101
- *
102
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
103
- *
104
- * ---------------------------------------------------
105
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
106
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
107
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
108
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
109
- *
110
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
111
- * the Software.
112
- *
113
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
114
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
115
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
116
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
117
- * IN THE SOFTWARE.
118
- */
119
- var isElement = function isElement(e) {
120
- if (typeof Element === 'undefined') return false;
121
- return e instanceof Element;
122
- };
123
- var nodeList = new Map();
124
- var startClick;
125
- document.addEventListener('mousedown', function (e) {
126
- return startClick = e;
127
- });
128
- document.addEventListener('mouseup', function (e) {
129
- var _iterator = _createForOfIteratorHelper(nodeList.values()),
130
- _step;
131
- try {
132
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
133
- var handlers = _step.value;
134
- var _iterator2 = _createForOfIteratorHelper(handlers),
135
- _step2;
136
- try {
137
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
138
- var documentHandler = _step2.value.documentHandler;
139
- documentHandler(e, startClick);
140
- }
141
- } catch (err) {
142
- _iterator2.e(err);
143
- } finally {
144
- _iterator2.f();
145
- }
146
- }
147
- } catch (err) {
148
- _iterator.e(err);
149
- } finally {
150
- _iterator.f();
151
- }
152
- });
153
- function createDocumentHandler(el, binding) {
154
- var excludes = [];
155
- if (Array.isArray(binding.arg)) {
156
- excludes = binding.arg;
157
- } else if (isElement(binding.arg)) {
158
- excludes.push(binding.arg);
159
- }
160
- return function (mouseup, mousedown) {
161
- var popperRef = binding.instance.popperRef;
162
- var mouseUpTarget = mouseup.target;
163
- var mouseDownTarget = mousedown === null || mousedown === void 0 ? void 0 : mousedown.target;
164
- var isBound = !binding || !binding.instance;
165
- var isTargetExists = !mouseUpTarget || !mouseDownTarget;
166
- var isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
167
- var isSelf = el === mouseUpTarget;
168
- var isTargetExcluded = excludes.length && excludes.some(function (item) {
169
- return item === null || item === void 0 ? void 0 : item.contains(mouseUpTarget);
170
- }) || excludes.length && excludes.includes(mouseDownTarget);
171
- var isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
172
- if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
173
- return;
174
- }
175
- binding.value(mouseup, mousedown);
176
- };
177
- }
178
- var ClickOutside = {
179
- beforeMount: function beforeMount(el, binding) {
180
- if (!nodeList.has(el)) {
181
- nodeList.set(el, []);
182
- }
183
- nodeList.get(el).push({
184
- documentHandler: createDocumentHandler(el, binding),
185
- bindingFn: binding.value
186
- });
187
- },
188
- updated: function updated(el, binding) {
189
- if (!nodeList.has(el)) {
190
- nodeList.set(el, []);
191
- }
192
- var handlers = nodeList.get(el);
193
- var oldHandlerIndex = handlers.findIndex(function (item) {
194
- return item.bindingFn === binding.oldValue;
195
- });
196
- var newHandler = {
197
- documentHandler: createDocumentHandler(el, binding),
198
- bindingFn: binding.value
199
- };
200
- if (oldHandlerIndex >= 0) {
201
- // replace the old handler to the new handler
202
- handlers.splice(oldHandlerIndex, 1, newHandler);
203
- } else {
204
- handlers.push(newHandler);
205
- }
206
- },
207
- unmounted: function unmounted(el) {
208
- // remove all listeners when a component unmounted
209
- nodeList["delete"](el);
210
- }
211
- };
212
- ClickOutside.install = function (app) {
213
- app.directive('bkTooltips', ClickOutside);
214
- };
215
- /* harmony default export */ const clickoutside = (ClickOutside);
216
- ;// CONCATENATED MODULE: external "../config-provider"
217
- var config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
218
- var config_provider_y = x => () => x
219
- const config_provider_namespaceObject = config_provider_x({ ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__.usePrefix });
220
- ;// CONCATENATED MODULE: ../../packages/popover/src/arrow.tsx
221
-
222
- /*
223
- * Tencent is pleased to support the open source community by making
224
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
225
- *
226
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
227
- *
228
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
229
- *
230
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
231
- *
232
- * ---------------------------------------------------
233
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
234
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
235
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
236
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
237
- *
238
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
239
- * the Software.
240
- *
241
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
242
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
243
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
244
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
245
- * IN THE SOFTWARE.
246
- */
247
-
248
- /* harmony default export */ const src_arrow = (defineComponent({
249
- name: 'PopArrow',
250
- render: function render() {
251
- var _usePrefix = (0,config_provider_namespaceObject.usePrefix)(),
252
- resolveClassName = _usePrefix.resolveClassName;
253
- var arrowClassName = resolveClassName('pop2-arrow');
254
- return (0,external_vue_namespaceObject.createVNode)("div", {
255
- "class": arrowClassName
256
- }, null);
257
- }
258
- }));
259
- ;// CONCATENATED MODULE: ../../packages/popover/src/const.tsx
260
-
261
- var _EMIT_EVENT_TYPES;
262
- /* eslint-disable @typescript-eslint/naming-convention */
263
- /*
264
- * Tencent is pleased to support the open source community by making
265
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
266
- *
267
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
268
- *
269
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
270
- *
271
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
272
- *
273
- * ---------------------------------------------------
274
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
275
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
276
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
277
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
278
- *
279
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
280
- * the Software.
281
- *
282
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
283
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
284
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
285
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
286
- * IN THE SOFTWARE.
287
- */
288
- var EMIT_EVENTS;
289
- (function (EMIT_EVENTS) {
290
- EMIT_EVENTS["CLICK_OUTSIDE"] = "clickoutside";
291
- EMIT_EVENTS["CONTENT_AfterHidden"] = "afterHidden";
292
- EMIT_EVENTS["CONTENT_AfterShow"] = "afterShow";
293
- EMIT_EVENTS["CONTENT_MOUSEENTER"] = "contentMouseenter";
294
- EMIT_EVENTS["CONTENT_MOUSELEAVE"] = "contentMouseleave";
295
- })(EMIT_EVENTS || (EMIT_EVENTS = {}));
296
- var EVENT_SHOW_HIDE_FN = function EVENT_SHOW_HIDE_FN(_args) {
297
- return true;
298
- };
299
- var EVENT_COMMON_FN = function EVENT_COMMON_FN(e) {
300
- return e;
301
- };
302
- var EVENT_CLICK_OUTSIDE_FN = function EVENT_CLICK_OUTSIDE_FN(_args) {
303
- return true;
304
- };
305
- var EMIT_EVENT_TYPES = (_EMIT_EVENT_TYPES = {}, _defineProperty(_EMIT_EVENT_TYPES, EMIT_EVENTS.CLICK_OUTSIDE, EVENT_CLICK_OUTSIDE_FN), _defineProperty(_EMIT_EVENT_TYPES, EMIT_EVENTS.CONTENT_MOUSEENTER, EVENT_COMMON_FN), _defineProperty(_EMIT_EVENT_TYPES, EMIT_EVENTS.CONTENT_MOUSELEAVE, EVENT_COMMON_FN), _defineProperty(_EMIT_EVENT_TYPES, EMIT_EVENTS.CONTENT_AfterHidden, EVENT_SHOW_HIDE_FN), _defineProperty(_EMIT_EVENT_TYPES, EMIT_EVENTS.CONTENT_AfterShow, EVENT_SHOW_HIDE_FN), _EMIT_EVENT_TYPES);
306
- ;// CONCATENATED MODULE: ../../packages/popover/src/content.tsx
307
-
308
- /*
309
- * Tencent is pleased to support the open source community by making
310
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
311
- *
312
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
313
- *
314
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
315
- *
316
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
317
- *
318
- * ---------------------------------------------------
319
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
320
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
321
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
322
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
323
- *
324
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
325
- * the Software.
326
- *
327
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
328
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
329
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
330
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
331
- * IN THE SOFTWARE.
332
- */
333
-
334
-
335
- /* harmony default export */ const content = (defineComponent({
336
- name: 'PopContent',
337
- props: {
338
- width: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string, shared_namespaceObject.PropTypes.number]).def('auto'),
339
- height: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string, shared_namespaceObject.PropTypes.number]).def('auto'),
340
- maxHeight: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string, shared_namespaceObject.PropTypes.number]).def('auto'),
341
- maxWidth: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string, shared_namespaceObject.PropTypes.number]).def('auto'),
342
- extCls: shared_namespaceObject.PropTypes.string.def(''),
343
- visible: shared_namespaceObject.PropTypes.bool.def(false),
344
- eventDelay: shared_namespaceObject.PropTypes.number.def(0)
345
- },
346
- emits: ['click'],
347
- setup: function setup(props, _ref) {
348
- var emit = _ref.emit;
349
- var resolveValToPix = function resolveValToPix(val) {
350
- if (/^\d+\.?\d*$/.test("".concat(val))) {
351
- return "".concat(val, "px");
352
- }
353
- return val;
354
- };
355
- var style = computed(function () {
356
- return {
357
- width: resolveValToPix(props.width),
358
- height: resolveValToPix(props.height),
359
- maxHeight: resolveValToPix(props.maxHeight),
360
- maxWidth: resolveValToPix(props.maxWidth)
361
- };
362
- });
363
- var refContent = ref(null);
364
- var refTimer = ref(null);
365
- var handleClick = function handleClick(evt) {
366
- evt.stopPropagation();
367
- emit('click', evt);
368
- };
369
- var resetPointerEvent = function resetPointerEvent() {
370
- var _props$eventDelay;
371
- if (props.eventDelay === 0) {
372
- return;
373
- }
374
- refTimer.value && clearTimeout(refTimer.value);
375
- refTimer.value = setTimeout(function () {
376
- setContentPointerEvent('unset');
377
- }, (_props$eventDelay = props.eventDelay) !== null && _props$eventDelay !== void 0 ? _props$eventDelay : 300);
378
- };
379
- var setContentPointerEvent = function setContentPointerEvent(val) {
380
- var _refContent$value;
381
- if (props.eventDelay === 0) {
382
- return;
383
- }
384
- (_refContent$value = refContent.value) === null || _refContent$value === void 0 ? void 0 : _refContent$value.style.setProperty('pointer-events', val);
385
- };
386
- var _usePrefix = (0,config_provider_namespaceObject.usePrefix)(),
387
- resolveClassName = _usePrefix.resolveClassName;
388
- var contentClassName = computed(function () {
389
- return [resolveClassName('popover'), resolveClassName('pop2-content'), props.visible ? 'visible' : 'hidden', props.extCls];
390
- });
391
- return {
392
- style: style,
393
- refContent: refContent,
394
- contentClassName: contentClassName,
395
- handleClick: handleClick,
396
- resetPointerEvent: resetPointerEvent,
397
- setContentPointerEvent: setContentPointerEvent
398
- };
399
- },
400
- render: function render() {
401
- var _this = this,
402
- _this$$slots$default,
403
- _this$$slots,
404
- _this$$slots$arrow,
405
- _this$$slots$arrow2,
406
- _this$$slots2,
407
- _this$$slots$default2,
408
- _this$$slots$default3,
409
- _this$$slots3;
410
- var resolveContentStyle = function resolveContentStyle(slot) {
411
- var _slot$;
412
- if (Fragment === (slot === null || slot === void 0 || (_slot$ = slot[0]) === null || _slot$ === void 0 ? void 0 : _slot$.type)) {
413
- nextTick(function () {
414
- _this.setContentPointerEvent('none');
415
- _this.resetPointerEvent();
416
- });
417
- }
418
- return _this.style;
419
- };
420
- var style = resolveContentStyle((_this$$slots$default = (_this$$slots = this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots));
421
- return (0,external_vue_namespaceObject.createVNode)("div", {
422
- "ref": "refContent",
423
- "style": style,
424
- "class": this.contentClassName,
425
- "onClick": this.handleClick
426
- }, [(_this$$slots$arrow = (_this$$slots$arrow2 = (_this$$slots2 = this.$slots).arrow) === null || _this$$slots$arrow2 === void 0 ? void 0 : _this$$slots$arrow2.call(_this$$slots2)) !== null && _this$$slots$arrow !== void 0 ? _this$$slots$arrow : '', (_this$$slots$default2 = (_this$$slots$default3 = (_this$$slots3 = this.$slots)["default"]) === null || _this$$slots$default3 === void 0 ? void 0 : _this$$slots$default3.call(_this$$slots3)) !== null && _this$$slots$default2 !== void 0 ? _this$$slots$default2 : '']);
427
- }
428
- }));
429
- ;// CONCATENATED MODULE: external "vue-types"
430
- var external_vue_types_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
431
- var external_vue_types_y = x => () => x
432
- const external_vue_types_namespaceObject = external_vue_types_x({ ["toType"]: () => __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__.toType });
433
- ;// CONCATENATED MODULE: ../../packages/popover/src/props.ts
434
-
435
-
436
- var EventProps = {
437
- onAfterHidden: function onAfterHidden() {},
438
- onAfterShow: function onAfterShow() {}
439
- };
440
- var PopoverProps = {
441
- isShow: shared_namespaceObject.PropTypes.bool.def(false),
442
- always: shared_namespaceObject.PropTypes.bool.def(false),
443
- disabled: shared_namespaceObject.PropTypes.bool.def(false),
444
- clickContentAutoHide: shared_namespaceObject.PropTypes.bool.def(false),
445
- width: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string, shared_namespaceObject.PropTypes.number]).def('auto'),
446
- height: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string, shared_namespaceObject.PropTypes.number]).def('auto'),
447
- maxWidth: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string, shared_namespaceObject.PropTypes.number]).def('auto'),
448
- maxHeight: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string, shared_namespaceObject.PropTypes.number]).def('auto'),
449
- content: (0,external_vue_types_namespaceObject.toType)('IContent', {}).def(''),
450
- renderDirective: (0,shared_namespaceObject.renderDirectiveType)().def('if'),
451
- target: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string, shared_namespaceObject.PropTypes.instanceOf(HTMLElement), shared_namespaceObject.PropTypes.instanceOf(PointerEvent)]),
452
- allowHtml: shared_namespaceObject.PropTypes.bool.def(false),
453
- /**
454
- * 组件显示位置
455
- */
456
- // placement: placementType().def(PlacementEnum.TOP),
457
- placement: (0,shared_namespaceObject.placementType)().def(shared_namespaceObject.PlacementEnum.TOP_START),
458
- // 'dark', 'light'
459
- theme: shared_namespaceObject.PropTypes.string.def('dark'),
460
- /**
461
- * 触发方式
462
- * 支持 click hover manual
463
- * manual: 通过isShow控制显示、隐藏
464
- */
465
- trigger: (0,shared_namespaceObject.triggerType)(),
466
- /**
467
- * content 渲染方式
468
- */
469
- renderType: (0,shared_namespaceObject.renderType)(),
470
- // 是否显示箭头
471
- arrow: shared_namespaceObject.PropTypes.bool.def(true),
472
- padding: shared_namespaceObject.PropTypes.number.def(5),
473
- offset: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.number, shared_namespaceObject.PropTypes.shape({
474
- mainAxis: shared_namespaceObject.PropTypes.number,
475
- crossAxis: shared_namespaceObject.PropTypes.number,
476
- alignmentAxis: shared_namespaceObject.PropTypes.number
477
- })]).def(6),
478
- /**
479
- * 弹出内容绑定元素
480
- */
481
- boundary: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string.def('parent'), shared_namespaceObject.PropTypes.instanceOf(HTMLElement)]),
482
- zIndex: shared_namespaceObject.PropTypes.number.def(undefined),
483
- disableTeleport: shared_namespaceObject.PropTypes.bool.def(false),
484
- /**
485
- * chooses the placement that has the most space available automatically
486
- */
487
- autoPlacement: shared_namespaceObject.PropTypes.bool.def(false),
488
- /**
489
- * 当有滚动条,滚动出可是范围时自动隐藏pop
490
- */
491
- autoVisibility: shared_namespaceObject.PropTypes.bool.def(true),
492
- /**
493
- * 是否禁用clickoutside
494
- */
495
- disableOutsideClick: shared_namespaceObject.PropTypes.bool.def(false),
496
- /**
497
- * 是否禁用样式的transform更新位移
498
- */
499
- disableTransform: shared_namespaceObject.PropTypes.bool.def(false),
500
- /**
501
- * 自定义 reference
502
- */
503
- reference: shared_namespaceObject.PropTypes.any,
504
- /**
505
- * 兼容v1版本遗留配置
506
- * 不建议使用
507
- */
508
- modifiers: shared_namespaceObject.PropTypes.array.def([]),
509
- /**
510
- * popover显示和隐藏的延时时间
511
- */
512
- popoverDelay: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.number, shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.number)]).def(100),
513
- /**
514
- * 配置自定义样式类名,传入的类会被加在组件最外层的 DOM
515
- */
516
- extCls: shared_namespaceObject.PropTypes.string.def(''),
517
- /**
518
- * 配置自定义样式类名,传入的类会被加在 Reference 外部的 div 上
519
- */
520
- referenceCls: shared_namespaceObject.PropTypes.string.def(''),
521
- /**
522
- * 点击 Reference 占位区是否忽略收起 popover
523
- */
524
- hideIgnoreReference: shared_namespaceObject.PropTypes.bool.def(false),
525
- /**
526
- * 自定义Content组件渲染,point-event延迟渲染时间
527
- * 避免子组件point-event渲染时触发popover鼠标事件
528
- * 如果设置为0,则不启用此设置
529
- */
530
- componentEventDelay: shared_namespaceObject.PropTypes.number.def(0),
531
- /**
532
- * 或略其他判定条件,强制监听clickoutside & 执行hide
533
- */
534
- forceClickoutside: shared_namespaceObject.PropTypes.bool.def(false)
535
- };
536
- ;// CONCATENATED MODULE: ../../packages/popover/src/reference.tsx
537
- /*
538
- * Tencent is pleased to support the open source community by making
539
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
540
- *
541
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
542
- *
543
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
544
- *
545
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
546
- *
547
- * ---------------------------------------------------
548
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
549
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
550
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
551
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
552
- *
553
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
554
- * the Software.
555
- *
556
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
557
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
558
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
559
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
560
- * IN THE SOFTWARE.
561
- */
562
-
563
- /* harmony default export */ const reference = ((0,external_vue_namespaceObject.defineComponent)({
564
- name: 'PopReference',
565
- render: function render() {
566
- var _this$$slots$default, _this$$slots$default2, _this$$slots;
567
- return (_this$$slots$default = (_this$$slots$default2 = (_this$$slots = this.$slots)["default"]) === null || _this$$slots$default2 === void 0 ? void 0 : _this$$slots$default2.call(_this$$slots)) !== null && _this$$slots$default !== void 0 ? _this$$slots$default : '';
568
- }
569
- }));
570
- ;// CONCATENATED MODULE: ../../packages/popover/src/root.tsx
571
-
572
- /*
573
- * Tencent is pleased to support the open source community by making
574
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
575
- *
576
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
577
- *
578
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
579
- *
580
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
581
- *
582
- * ---------------------------------------------------
583
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
584
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
585
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
586
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
587
- *
588
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
589
- * the Software.
590
- *
591
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
592
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
593
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
594
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
595
- * IN THE SOFTWARE.
596
- */
597
-
598
- /* harmony default export */ const root = (defineComponent({
599
- props: {
600
- "class": shared_namespaceObject.PropTypes.string.def(''),
601
- mode: shared_namespaceObject.PropTypes.string.def('')
602
- },
603
- render: function render() {
604
- var _this$$slots$default, _this$$slots;
605
- return (0,external_vue_namespaceObject.createVNode)(external_vue_namespaceObject.Fragment, null, [(_this$$slots$default = (_this$$slots = this.$slots)["default"]) === null || _this$$slots$default === void 0 ? void 0 : _this$$slots$default.call(_this$$slots)]);
606
- }
607
- }));
608
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
609
- function _arrayWithHoles(arr) {
610
- if (Array.isArray(arr)) return arr;
611
- }
612
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
613
- function _iterableToArrayLimit(arr, i) {
614
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
615
- if (null != _i) {
616
- var _s,
617
- _e,
618
- _x,
619
- _r,
620
- _arr = [],
621
- _n = !0,
622
- _d = !1;
623
- try {
624
- if (_x = (_i = _i.call(arr)).next, 0 === i) {
625
- if (Object(_i) !== _i) return;
626
- _n = !1;
627
- } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
628
- } catch (err) {
629
- _d = !0, _e = err;
630
- } finally {
631
- try {
632
- if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
633
- } finally {
634
- if (_d) throw _e;
635
- }
636
- }
637
- return _arr;
638
- }
639
- }
640
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
641
- function arrayLikeToArray_arrayLikeToArray(arr, len) {
642
- if (len == null || len > arr.length) len = arr.length;
643
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
644
- return arr2;
645
- }
646
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
647
-
648
- function unsupportedIterableToArray_unsupportedIterableToArray(o, minLen) {
649
- if (!o) return;
650
- if (typeof o === "string") return arrayLikeToArray_arrayLikeToArray(o, minLen);
651
- var n = Object.prototype.toString.call(o).slice(8, -1);
652
- if (n === "Object" && o.constructor) n = o.constructor.name;
653
- if (n === "Map" || n === "Set") return Array.from(o);
654
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray_arrayLikeToArray(o, minLen);
655
- }
656
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
657
- function _nonIterableRest() {
658
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
659
- }
660
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js
661
-
662
-
663
-
664
-
665
- function _slicedToArray(arr, i) {
666
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || unsupportedIterableToArray_unsupportedIterableToArray(arr, i) || _nonIterableRest();
667
- }
668
- ;// CONCATENATED MODULE: ../../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
669
- const sides = ['top', 'right', 'bottom', 'left'];
670
- const alignments = ['start', 'end'];
671
- const placements = /*#__PURE__*/sides.reduce((acc, side) => acc.concat(side, side + "-" + alignments[0], side + "-" + alignments[1]), []);
672
- const floating_ui_utils_min = Math.min;
673
- const floating_ui_utils_max = Math.max;
674
- const round = Math.round;
675
- const floor = Math.floor;
676
- const createCoords = v => ({
677
- x: v,
678
- y: v
679
- });
680
- const oppositeSideMap = {
681
- left: 'right',
682
- right: 'left',
683
- bottom: 'top',
684
- top: 'bottom'
685
- };
686
- const oppositeAlignmentMap = {
687
- start: 'end',
688
- end: 'start'
689
- };
690
- function clamp(start, value, end) {
691
- return floating_ui_utils_max(start, floating_ui_utils_min(value, end));
692
- }
693
- function floating_ui_utils_evaluate(value, param) {
694
- return typeof value === 'function' ? value(param) : value;
695
- }
696
- function floating_ui_utils_getSide(placement) {
697
- return placement.split('-')[0];
698
- }
699
- function floating_ui_utils_getAlignment(placement) {
700
- return placement.split('-')[1];
701
- }
702
- function floating_ui_utils_getOppositeAxis(axis) {
703
- return axis === 'x' ? 'y' : 'x';
704
- }
705
- function getAxisLength(axis) {
706
- return axis === 'y' ? 'height' : 'width';
707
- }
708
- function floating_ui_utils_getSideAxis(placement) {
709
- return ['top', 'bottom'].includes(floating_ui_utils_getSide(placement)) ? 'y' : 'x';
710
- }
711
- function getAlignmentAxis(placement) {
712
- return floating_ui_utils_getOppositeAxis(floating_ui_utils_getSideAxis(placement));
713
- }
714
- function getAlignmentSides(placement, rects, rtl) {
715
- if (rtl === void 0) {
716
- rtl = false;
717
- }
718
- const alignment = floating_ui_utils_getAlignment(placement);
719
- const alignmentAxis = getAlignmentAxis(placement);
720
- const length = getAxisLength(alignmentAxis);
721
- let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
722
- if (rects.reference[length] > rects.floating[length]) {
723
- mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
724
- }
725
- return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
726
- }
727
- function getExpandedPlacements(placement) {
728
- const oppositePlacement = getOppositePlacement(placement);
729
- return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
730
- }
731
- function getOppositeAlignmentPlacement(placement) {
732
- return placement.replace(/start|end/g, alignment => oppositeAlignmentMap[alignment]);
733
- }
734
- function getSideList(side, isStart, rtl) {
735
- const lr = ['left', 'right'];
736
- const rl = ['right', 'left'];
737
- const tb = ['top', 'bottom'];
738
- const bt = ['bottom', 'top'];
739
- switch (side) {
740
- case 'top':
741
- case 'bottom':
742
- if (rtl) return isStart ? rl : lr;
743
- return isStart ? lr : rl;
744
- case 'left':
745
- case 'right':
746
- return isStart ? tb : bt;
747
- default:
748
- return [];
749
- }
750
- }
751
- function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
752
- const alignment = floating_ui_utils_getAlignment(placement);
753
- let list = getSideList(floating_ui_utils_getSide(placement), direction === 'start', rtl);
754
- if (alignment) {
755
- list = list.map(side => side + "-" + alignment);
756
- if (flipAlignment) {
757
- list = list.concat(list.map(getOppositeAlignmentPlacement));
758
- }
759
- }
760
- return list;
761
- }
762
- function getOppositePlacement(placement) {
763
- return placement.replace(/left|right|bottom|top/g, side => oppositeSideMap[side]);
764
- }
765
- function expandPaddingObject(padding) {
766
- return {
767
- top: 0,
768
- right: 0,
769
- bottom: 0,
770
- left: 0,
771
- ...padding
772
- };
773
- }
774
- function getPaddingObject(padding) {
775
- return typeof padding !== 'number' ? expandPaddingObject(padding) : {
776
- top: padding,
777
- right: padding,
778
- bottom: padding,
779
- left: padding
780
- };
781
- }
782
- function rectToClientRect(rect) {
783
- return {
784
- ...rect,
785
- top: rect.y,
786
- left: rect.x,
787
- right: rect.x + rect.width,
788
- bottom: rect.y + rect.height
789
- };
790
- }
791
-
792
-
793
-
794
- ;// CONCATENATED MODULE: ../../node_modules/@floating-ui/core/dist/floating-ui.core.mjs
795
-
796
-
797
-
798
- function computeCoordsFromPlacement(_ref, placement, rtl) {
799
- let {
800
- reference,
801
- floating
802
- } = _ref;
803
- const sideAxis = floating_ui_utils_getSideAxis(placement);
804
- const alignmentAxis = getAlignmentAxis(placement);
805
- const alignLength = getAxisLength(alignmentAxis);
806
- const side = floating_ui_utils_getSide(placement);
807
- const isVertical = sideAxis === 'y';
808
- const commonX = reference.x + reference.width / 2 - floating.width / 2;
809
- const commonY = reference.y + reference.height / 2 - floating.height / 2;
810
- const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
811
- let coords;
812
- switch (side) {
813
- case 'top':
814
- coords = {
815
- x: commonX,
816
- y: reference.y - floating.height
817
- };
818
- break;
819
- case 'bottom':
820
- coords = {
821
- x: commonX,
822
- y: reference.y + reference.height
823
- };
824
- break;
825
- case 'right':
826
- coords = {
827
- x: reference.x + reference.width,
828
- y: commonY
829
- };
830
- break;
831
- case 'left':
832
- coords = {
833
- x: reference.x - floating.width,
834
- y: commonY
835
- };
836
- break;
837
- default:
838
- coords = {
839
- x: reference.x,
840
- y: reference.y
841
- };
842
- }
843
- switch (floating_ui_utils_getAlignment(placement)) {
844
- case 'start':
845
- coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
846
- break;
847
- case 'end':
848
- coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
849
- break;
850
- }
851
- return coords;
852
- }
853
-
854
- /**
855
- * Computes the `x` and `y` coordinates that will place the floating element
856
- * next to a reference element when it is given a certain positioning strategy.
857
- *
858
- * This export does not have any `platform` interface logic. You will need to
859
- * write one for the platform you are using Floating UI with.
860
- */
861
- const computePosition = async (reference, floating, config) => {
862
- const {
863
- placement = 'bottom',
864
- strategy = 'absolute',
865
- middleware = [],
866
- platform
867
- } = config;
868
- const validMiddleware = middleware.filter(Boolean);
869
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
870
- let rects = await platform.getElementRects({
871
- reference,
872
- floating,
873
- strategy
874
- });
875
- let {
876
- x,
877
- y
878
- } = computeCoordsFromPlacement(rects, placement, rtl);
879
- let statefulPlacement = placement;
880
- let middlewareData = {};
881
- let resetCount = 0;
882
- for (let i = 0; i < validMiddleware.length; i++) {
883
- const {
884
- name,
885
- fn
886
- } = validMiddleware[i];
887
- const {
888
- x: nextX,
889
- y: nextY,
890
- data,
891
- reset
892
- } = await fn({
893
- x,
894
- y,
895
- initialPlacement: placement,
896
- placement: statefulPlacement,
897
- strategy,
898
- middlewareData,
899
- rects,
900
- platform,
901
- elements: {
902
- reference,
903
- floating
904
- }
905
- });
906
- x = nextX != null ? nextX : x;
907
- y = nextY != null ? nextY : y;
908
- middlewareData = {
909
- ...middlewareData,
910
- [name]: {
911
- ...middlewareData[name],
912
- ...data
913
- }
914
- };
915
- if (reset && resetCount <= 50) {
916
- resetCount++;
917
- if (typeof reset === 'object') {
918
- if (reset.placement) {
919
- statefulPlacement = reset.placement;
920
- }
921
- if (reset.rects) {
922
- rects = reset.rects === true ? await platform.getElementRects({
923
- reference,
924
- floating,
925
- strategy
926
- }) : reset.rects;
927
- }
928
- ({
929
- x,
930
- y
931
- } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
932
- }
933
- i = -1;
934
- continue;
935
- }
936
- }
937
- return {
938
- x,
939
- y,
940
- placement: statefulPlacement,
941
- strategy,
942
- middlewareData
943
- };
944
- };
945
-
946
- /**
947
- * Resolves with an object of overflow side offsets that determine how much the
948
- * element is overflowing a given clipping boundary on each side.
949
- * - positive = overflowing the boundary by that number of pixels
950
- * - negative = how many pixels left before it will overflow
951
- * - 0 = lies flush with the boundary
952
- * @see https://floating-ui.com/docs/detectOverflow
953
- */
954
- async function detectOverflow(state, options) {
955
- var _await$platform$isEle;
956
- if (options === void 0) {
957
- options = {};
958
- }
959
- const {
960
- x,
961
- y,
962
- platform,
963
- rects,
964
- elements,
965
- strategy
966
- } = state;
967
- const {
968
- boundary = 'clippingAncestors',
969
- rootBoundary = 'viewport',
970
- elementContext = 'floating',
971
- altBoundary = false,
972
- padding = 0
973
- } = floating_ui_utils_evaluate(options, state);
974
- const paddingObject = getPaddingObject(padding);
975
- const altContext = elementContext === 'floating' ? 'reference' : 'floating';
976
- const element = elements[altBoundary ? altContext : elementContext];
977
- const clippingClientRect = rectToClientRect(await platform.getClippingRect({
978
- element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
979
- boundary,
980
- rootBoundary,
981
- strategy
982
- }));
983
- const rect = elementContext === 'floating' ? {
984
- ...rects.floating,
985
- x,
986
- y
987
- } : rects.reference;
988
- const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
989
- const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
990
- x: 1,
991
- y: 1
992
- } : {
993
- x: 1,
994
- y: 1
995
- };
996
- const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
997
- rect,
998
- offsetParent,
999
- strategy
1000
- }) : rect);
1001
- return {
1002
- top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
1003
- bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
1004
- left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
1005
- right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
1006
- };
1007
- }
1008
-
1009
- /**
1010
- * Provides data to position an inner element of the floating element so that it
1011
- * appears centered to the reference element.
1012
- * @see https://floating-ui.com/docs/arrow
1013
- */
1014
- const arrow = options => ({
1015
- name: 'arrow',
1016
- options,
1017
- async fn(state) {
1018
- const {
1019
- x,
1020
- y,
1021
- placement,
1022
- rects,
1023
- platform,
1024
- elements
1025
- } = state;
1026
- // Since `element` is required, we don't Partial<> the type.
1027
- const {
1028
- element,
1029
- padding = 0
1030
- } = floating_ui_utils_evaluate(options, state) || {};
1031
- if (element == null) {
1032
- return {};
1033
- }
1034
- const paddingObject = getPaddingObject(padding);
1035
- const coords = {
1036
- x,
1037
- y
1038
- };
1039
- const axis = getAlignmentAxis(placement);
1040
- const length = getAxisLength(axis);
1041
- const arrowDimensions = await platform.getDimensions(element);
1042
- const isYAxis = axis === 'y';
1043
- const minProp = isYAxis ? 'top' : 'left';
1044
- const maxProp = isYAxis ? 'bottom' : 'right';
1045
- const clientProp = isYAxis ? 'clientHeight' : 'clientWidth';
1046
- const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
1047
- const startDiff = coords[axis] - rects.reference[axis];
1048
- const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
1049
- let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
1050
-
1051
- // DOM platform can return `window` as the `offsetParent`.
1052
- if (!clientSize || !(await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent)))) {
1053
- clientSize = elements.floating[clientProp] || rects.floating[length];
1054
- }
1055
- const centerToReference = endDiff / 2 - startDiff / 2;
1056
-
1057
- // If the padding is large enough that it causes the arrow to no longer be
1058
- // centered, modify the padding so that it is centered.
1059
- const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
1060
- const minPadding = floating_ui_utils_min(paddingObject[minProp], largestPossiblePadding);
1061
- const maxPadding = floating_ui_utils_min(paddingObject[maxProp], largestPossiblePadding);
1062
-
1063
- // Make sure the arrow doesn't overflow the floating element if the center
1064
- // point is outside the floating element's bounds.
1065
- const min$1 = minPadding;
1066
- const max = clientSize - arrowDimensions[length] - maxPadding;
1067
- const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
1068
- const offset = clamp(min$1, center, max);
1069
-
1070
- // If the reference is small enough that the arrow's padding causes it to
1071
- // to point to nothing for an aligned placement, adjust the offset of the
1072
- // floating element itself. This stops `shift()` from taking action, but can
1073
- // be worked around by calling it again after the `arrow()` if desired.
1074
- const shouldAddOffset = floating_ui_utils_getAlignment(placement) != null && center != offset && rects.reference[length] / 2 - (center < min$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
1075
- const alignmentOffset = shouldAddOffset ? center < min$1 ? min$1 - center : max - center : 0;
1076
- return {
1077
- [axis]: coords[axis] - alignmentOffset,
1078
- data: {
1079
- [axis]: offset,
1080
- centerOffset: center - offset + alignmentOffset
1081
- }
1082
- };
1083
- }
1084
- });
1085
-
1086
- function getPlacementList(alignment, autoAlignment, allowedPlacements) {
1087
- const allowedPlacementsSortedByAlignment = alignment ? [...allowedPlacements.filter(placement => floating_ui_utils_getAlignment(placement) === alignment), ...allowedPlacements.filter(placement => floating_ui_utils_getAlignment(placement) !== alignment)] : allowedPlacements.filter(placement => floating_ui_utils_getSide(placement) === placement);
1088
- return allowedPlacementsSortedByAlignment.filter(placement => {
1089
- if (alignment) {
1090
- return floating_ui_utils_getAlignment(placement) === alignment || (autoAlignment ? getOppositeAlignmentPlacement(placement) !== placement : false);
1091
- }
1092
- return true;
1093
- });
1094
- }
1095
- /**
1096
- * Optimizes the visibility of the floating element by choosing the placement
1097
- * that has the most space available automatically, without needing to specify a
1098
- * preferred placement. Alternative to `flip`.
1099
- * @see https://floating-ui.com/docs/autoPlacement
1100
- */
1101
- const autoPlacement = function (options) {
1102
- if (options === void 0) {
1103
- options = {};
1104
- }
1105
- return {
1106
- name: 'autoPlacement',
1107
- options,
1108
- async fn(state) {
1109
- var _middlewareData$autoP, _middlewareData$autoP2, _placementsThatFitOnE;
1110
- const {
1111
- rects,
1112
- middlewareData,
1113
- placement,
1114
- platform,
1115
- elements
1116
- } = state;
1117
- const {
1118
- crossAxis = false,
1119
- alignment,
1120
- allowedPlacements = placements,
1121
- autoAlignment = true,
1122
- ...detectOverflowOptions
1123
- } = floating_ui_utils_evaluate(options, state);
1124
- const placements$1 = alignment !== undefined || allowedPlacements === placements ? getPlacementList(alignment || null, autoAlignment, allowedPlacements) : allowedPlacements;
1125
- const overflow = await detectOverflow(state, detectOverflowOptions);
1126
- const currentIndex = ((_middlewareData$autoP = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP.index) || 0;
1127
- const currentPlacement = placements$1[currentIndex];
1128
- if (currentPlacement == null) {
1129
- return {};
1130
- }
1131
- const alignmentSides = getAlignmentSides(currentPlacement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
1132
-
1133
- // Make `computeCoords` start from the right place.
1134
- if (placement !== currentPlacement) {
1135
- return {
1136
- reset: {
1137
- placement: placements$1[0]
1138
- }
1139
- };
1140
- }
1141
- const currentOverflows = [overflow[floating_ui_utils_getSide(currentPlacement)], overflow[alignmentSides[0]], overflow[alignmentSides[1]]];
1142
- const allOverflows = [...(((_middlewareData$autoP2 = middlewareData.autoPlacement) == null ? void 0 : _middlewareData$autoP2.overflows) || []), {
1143
- placement: currentPlacement,
1144
- overflows: currentOverflows
1145
- }];
1146
- const nextPlacement = placements$1[currentIndex + 1];
1147
-
1148
- // There are more placements to check.
1149
- if (nextPlacement) {
1150
- return {
1151
- data: {
1152
- index: currentIndex + 1,
1153
- overflows: allOverflows
1154
- },
1155
- reset: {
1156
- placement: nextPlacement
1157
- }
1158
- };
1159
- }
1160
- const placementsSortedByMostSpace = allOverflows.map(d => {
1161
- const alignment = floating_ui_utils_getAlignment(d.placement);
1162
- return [d.placement, alignment && crossAxis ?
1163
- // Check along the mainAxis and main crossAxis side.
1164
- d.overflows.slice(0, 2).reduce((acc, v) => acc + v, 0) :
1165
- // Check only the mainAxis.
1166
- d.overflows[0], d.overflows];
1167
- }).sort((a, b) => a[1] - b[1]);
1168
- const placementsThatFitOnEachSide = placementsSortedByMostSpace.filter(d => d[2].slice(0,
1169
- // Aligned placements should not check their opposite crossAxis
1170
- // side.
1171
- floating_ui_utils_getAlignment(d[0]) ? 2 : 3).every(v => v <= 0));
1172
- const resetPlacement = ((_placementsThatFitOnE = placementsThatFitOnEachSide[0]) == null ? void 0 : _placementsThatFitOnE[0]) || placementsSortedByMostSpace[0][0];
1173
- if (resetPlacement !== placement) {
1174
- return {
1175
- data: {
1176
- index: currentIndex + 1,
1177
- overflows: allOverflows
1178
- },
1179
- reset: {
1180
- placement: resetPlacement
1181
- }
1182
- };
1183
- }
1184
- return {};
1185
- }
1186
- };
1187
- };
1188
-
1189
- /**
1190
- * Optimizes the visibility of the floating element by flipping the `placement`
1191
- * in order to keep it in view when the preferred placement(s) will overflow the
1192
- * clipping boundary. Alternative to `autoPlacement`.
1193
- * @see https://floating-ui.com/docs/flip
1194
- */
1195
- const flip = function (options) {
1196
- if (options === void 0) {
1197
- options = {};
1198
- }
1199
- return {
1200
- name: 'flip',
1201
- options,
1202
- async fn(state) {
1203
- var _middlewareData$flip;
1204
- const {
1205
- placement,
1206
- middlewareData,
1207
- rects,
1208
- initialPlacement,
1209
- platform,
1210
- elements
1211
- } = state;
1212
- const {
1213
- mainAxis: checkMainAxis = true,
1214
- crossAxis: checkCrossAxis = true,
1215
- fallbackPlacements: specifiedFallbackPlacements,
1216
- fallbackStrategy = 'bestFit',
1217
- fallbackAxisSideDirection = 'none',
1218
- flipAlignment = true,
1219
- ...detectOverflowOptions
1220
- } = floating_ui_utils_evaluate(options, state);
1221
- const side = floating_ui_utils_getSide(placement);
1222
- const isBasePlacement = floating_ui_utils_getSide(initialPlacement) === initialPlacement;
1223
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1224
- const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
1225
- if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== 'none') {
1226
- fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
1227
- }
1228
- const placements = [initialPlacement, ...fallbackPlacements];
1229
- const overflow = await detectOverflow(state, detectOverflowOptions);
1230
- const overflows = [];
1231
- let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
1232
- if (checkMainAxis) {
1233
- overflows.push(overflow[side]);
1234
- }
1235
- if (checkCrossAxis) {
1236
- const sides = getAlignmentSides(placement, rects, rtl);
1237
- overflows.push(overflow[sides[0]], overflow[sides[1]]);
1238
- }
1239
- overflowsData = [...overflowsData, {
1240
- placement,
1241
- overflows
1242
- }];
1243
-
1244
- // One or more sides is overflowing.
1245
- if (!overflows.every(side => side <= 0)) {
1246
- var _middlewareData$flip2, _overflowsData$filter;
1247
- const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
1248
- const nextPlacement = placements[nextIndex];
1249
- if (nextPlacement) {
1250
- // Try next placement and re-run the lifecycle.
1251
- return {
1252
- data: {
1253
- index: nextIndex,
1254
- overflows: overflowsData
1255
- },
1256
- reset: {
1257
- placement: nextPlacement
1258
- }
1259
- };
1260
- }
1261
-
1262
- // First, find the candidates that fit on the mainAxis side of overflow,
1263
- // then find the placement that fits the best on the main crossAxis side.
1264
- let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
1265
-
1266
- // Otherwise fallback.
1267
- if (!resetPlacement) {
1268
- switch (fallbackStrategy) {
1269
- case 'bestFit':
1270
- {
1271
- var _overflowsData$map$so;
1272
- const placement = (_overflowsData$map$so = overflowsData.map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$map$so[0];
1273
- if (placement) {
1274
- resetPlacement = placement;
1275
- }
1276
- break;
1277
- }
1278
- case 'initialPlacement':
1279
- resetPlacement = initialPlacement;
1280
- break;
1281
- }
1282
- }
1283
- if (placement !== resetPlacement) {
1284
- return {
1285
- reset: {
1286
- placement: resetPlacement
1287
- }
1288
- };
1289
- }
1290
- }
1291
- return {};
1292
- }
1293
- };
1294
- };
1295
-
1296
- function getSideOffsets(overflow, rect) {
1297
- return {
1298
- top: overflow.top - rect.height,
1299
- right: overflow.right - rect.width,
1300
- bottom: overflow.bottom - rect.height,
1301
- left: overflow.left - rect.width
1302
- };
1303
- }
1304
- function isAnySideFullyClipped(overflow) {
1305
- return sides.some(side => overflow[side] >= 0);
1306
- }
1307
- /**
1308
- * Provides data to hide the floating element in applicable situations, such as
1309
- * when it is not in the same clipping context as the reference element.
1310
- * @see https://floating-ui.com/docs/hide
1311
- */
1312
- const hide = function (options) {
1313
- if (options === void 0) {
1314
- options = {};
1315
- }
1316
- return {
1317
- name: 'hide',
1318
- options,
1319
- async fn(state) {
1320
- const {
1321
- rects
1322
- } = state;
1323
- const {
1324
- strategy = 'referenceHidden',
1325
- ...detectOverflowOptions
1326
- } = floating_ui_utils_evaluate(options, state);
1327
- switch (strategy) {
1328
- case 'referenceHidden':
1329
- {
1330
- const overflow = await detectOverflow(state, {
1331
- ...detectOverflowOptions,
1332
- elementContext: 'reference'
1333
- });
1334
- const offsets = getSideOffsets(overflow, rects.reference);
1335
- return {
1336
- data: {
1337
- referenceHiddenOffsets: offsets,
1338
- referenceHidden: isAnySideFullyClipped(offsets)
1339
- }
1340
- };
1341
- }
1342
- case 'escaped':
1343
- {
1344
- const overflow = await detectOverflow(state, {
1345
- ...detectOverflowOptions,
1346
- altBoundary: true
1347
- });
1348
- const offsets = getSideOffsets(overflow, rects.floating);
1349
- return {
1350
- data: {
1351
- escapedOffsets: offsets,
1352
- escaped: isAnySideFullyClipped(offsets)
1353
- }
1354
- };
1355
- }
1356
- default:
1357
- {
1358
- return {};
1359
- }
1360
- }
1361
- }
1362
- };
1363
- };
1364
-
1365
- function getBoundingRect(rects) {
1366
- const minX = floating_ui_utils_min(...rects.map(rect => rect.left));
1367
- const minY = floating_ui_utils_min(...rects.map(rect => rect.top));
1368
- const maxX = floating_ui_utils_max(...rects.map(rect => rect.right));
1369
- const maxY = floating_ui_utils_max(...rects.map(rect => rect.bottom));
1370
- return {
1371
- x: minX,
1372
- y: minY,
1373
- width: maxX - minX,
1374
- height: maxY - minY
1375
- };
1376
- }
1377
- function getRectsByLine(rects) {
1378
- const sortedRects = rects.slice().sort((a, b) => a.y - b.y);
1379
- const groups = [];
1380
- let prevRect = null;
1381
- for (let i = 0; i < sortedRects.length; i++) {
1382
- const rect = sortedRects[i];
1383
- if (!prevRect || rect.y - prevRect.y > prevRect.height / 2) {
1384
- groups.push([rect]);
1385
- } else {
1386
- groups[groups.length - 1].push(rect);
1387
- }
1388
- prevRect = rect;
1389
- }
1390
- return groups.map(rect => rectToClientRect(getBoundingRect(rect)));
1391
- }
1392
- /**
1393
- * Provides improved positioning for inline reference elements that can span
1394
- * over multiple lines, such as hyperlinks or range selections.
1395
- * @see https://floating-ui.com/docs/inline
1396
- */
1397
- const inline = function (options) {
1398
- if (options === void 0) {
1399
- options = {};
1400
- }
1401
- return {
1402
- name: 'inline',
1403
- options,
1404
- async fn(state) {
1405
- const {
1406
- placement,
1407
- elements,
1408
- rects,
1409
- platform,
1410
- strategy
1411
- } = state;
1412
- // A MouseEvent's client{X,Y} coords can be up to 2 pixels off a
1413
- // ClientRect's bounds, despite the event listener being triggered. A
1414
- // padding of 2 seems to handle this issue.
1415
- const {
1416
- padding = 2,
1417
- x,
1418
- y
1419
- } = floating_ui_utils_evaluate(options, state);
1420
- const nativeClientRects = Array.from((await (platform.getClientRects == null ? void 0 : platform.getClientRects(elements.reference))) || []);
1421
- const clientRects = getRectsByLine(nativeClientRects);
1422
- const fallback = rectToClientRect(getBoundingRect(nativeClientRects));
1423
- const paddingObject = getPaddingObject(padding);
1424
- function getBoundingClientRect() {
1425
- // There are two rects and they are disjoined.
1426
- if (clientRects.length === 2 && clientRects[0].left > clientRects[1].right && x != null && y != null) {
1427
- // Find the first rect in which the point is fully inside.
1428
- return clientRects.find(rect => x > rect.left - paddingObject.left && x < rect.right + paddingObject.right && y > rect.top - paddingObject.top && y < rect.bottom + paddingObject.bottom) || fallback;
1429
- }
1430
-
1431
- // There are 2 or more connected rects.
1432
- if (clientRects.length >= 2) {
1433
- if (floating_ui_utils_getSideAxis(placement) === 'y') {
1434
- const firstRect = clientRects[0];
1435
- const lastRect = clientRects[clientRects.length - 1];
1436
- const isTop = floating_ui_utils_getSide(placement) === 'top';
1437
- const top = firstRect.top;
1438
- const bottom = lastRect.bottom;
1439
- const left = isTop ? firstRect.left : lastRect.left;
1440
- const right = isTop ? firstRect.right : lastRect.right;
1441
- const width = right - left;
1442
- const height = bottom - top;
1443
- return {
1444
- top,
1445
- bottom,
1446
- left,
1447
- right,
1448
- width,
1449
- height,
1450
- x: left,
1451
- y: top
1452
- };
1453
- }
1454
- const isLeftSide = floating_ui_utils_getSide(placement) === 'left';
1455
- const maxRight = floating_ui_utils_max(...clientRects.map(rect => rect.right));
1456
- const minLeft = floating_ui_utils_min(...clientRects.map(rect => rect.left));
1457
- const measureRects = clientRects.filter(rect => isLeftSide ? rect.left === minLeft : rect.right === maxRight);
1458
- const top = measureRects[0].top;
1459
- const bottom = measureRects[measureRects.length - 1].bottom;
1460
- const left = minLeft;
1461
- const right = maxRight;
1462
- const width = right - left;
1463
- const height = bottom - top;
1464
- return {
1465
- top,
1466
- bottom,
1467
- left,
1468
- right,
1469
- width,
1470
- height,
1471
- x: left,
1472
- y: top
1473
- };
1474
- }
1475
- return fallback;
1476
- }
1477
- const resetRects = await platform.getElementRects({
1478
- reference: {
1479
- getBoundingClientRect
1480
- },
1481
- floating: elements.floating,
1482
- strategy
1483
- });
1484
- 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) {
1485
- return {
1486
- reset: {
1487
- rects: resetRects
1488
- }
1489
- };
1490
- }
1491
- return {};
1492
- }
1493
- };
1494
- };
1495
-
1496
- // For type backwards-compatibility, the `OffsetOptions` type was also
1497
- // Derivable.
1498
- async function convertValueToCoords(state, options) {
1499
- const {
1500
- placement,
1501
- platform,
1502
- elements
1503
- } = state;
1504
- const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
1505
- const side = floating_ui_utils_getSide(placement);
1506
- const alignment = floating_ui_utils_getAlignment(placement);
1507
- const isVertical = floating_ui_utils_getSideAxis(placement) === 'y';
1508
- const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
1509
- const crossAxisMulti = rtl && isVertical ? -1 : 1;
1510
- const rawValue = floating_ui_utils_evaluate(options, state);
1511
-
1512
- // eslint-disable-next-line prefer-const
1513
- let {
1514
- mainAxis,
1515
- crossAxis,
1516
- alignmentAxis
1517
- } = typeof rawValue === 'number' ? {
1518
- mainAxis: rawValue,
1519
- crossAxis: 0,
1520
- alignmentAxis: null
1521
- } : {
1522
- mainAxis: 0,
1523
- crossAxis: 0,
1524
- alignmentAxis: null,
1525
- ...rawValue
1526
- };
1527
- if (alignment && typeof alignmentAxis === 'number') {
1528
- crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
1529
- }
1530
- return isVertical ? {
1531
- x: crossAxis * crossAxisMulti,
1532
- y: mainAxis * mainAxisMulti
1533
- } : {
1534
- x: mainAxis * mainAxisMulti,
1535
- y: crossAxis * crossAxisMulti
1536
- };
1537
- }
1538
-
1539
- /**
1540
- * Modifies the placement by translating the floating element along the
1541
- * specified axes.
1542
- * A number (shorthand for `mainAxis` or distance), or an axes configuration
1543
- * object may be passed.
1544
- * @see https://floating-ui.com/docs/offset
1545
- */
1546
- const offset = function (options) {
1547
- if (options === void 0) {
1548
- options = 0;
1549
- }
1550
- return {
1551
- name: 'offset',
1552
- options,
1553
- async fn(state) {
1554
- const {
1555
- x,
1556
- y
1557
- } = state;
1558
- const diffCoords = await convertValueToCoords(state, options);
1559
- return {
1560
- x: x + diffCoords.x,
1561
- y: y + diffCoords.y,
1562
- data: diffCoords
1563
- };
1564
- }
1565
- };
1566
- };
1567
-
1568
- /**
1569
- * Optimizes the visibility of the floating element by shifting it in order to
1570
- * keep it in view when it will overflow the clipping boundary.
1571
- * @see https://floating-ui.com/docs/shift
1572
- */
1573
- const shift = function (options) {
1574
- if (options === void 0) {
1575
- options = {};
1576
- }
1577
- return {
1578
- name: 'shift',
1579
- options,
1580
- async fn(state) {
1581
- const {
1582
- x,
1583
- y,
1584
- placement
1585
- } = state;
1586
- const {
1587
- mainAxis: checkMainAxis = true,
1588
- crossAxis: checkCrossAxis = false,
1589
- limiter = {
1590
- fn: _ref => {
1591
- let {
1592
- x,
1593
- y
1594
- } = _ref;
1595
- return {
1596
- x,
1597
- y
1598
- };
1599
- }
1600
- },
1601
- ...detectOverflowOptions
1602
- } = floating_ui_utils_evaluate(options, state);
1603
- const coords = {
1604
- x,
1605
- y
1606
- };
1607
- const overflow = await detectOverflow(state, detectOverflowOptions);
1608
- const crossAxis = floating_ui_utils_getSideAxis(floating_ui_utils_getSide(placement));
1609
- const mainAxis = floating_ui_utils_getOppositeAxis(crossAxis);
1610
- let mainAxisCoord = coords[mainAxis];
1611
- let crossAxisCoord = coords[crossAxis];
1612
- if (checkMainAxis) {
1613
- const minSide = mainAxis === 'y' ? 'top' : 'left';
1614
- const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
1615
- const min = mainAxisCoord + overflow[minSide];
1616
- const max = mainAxisCoord - overflow[maxSide];
1617
- mainAxisCoord = clamp(min, mainAxisCoord, max);
1618
- }
1619
- if (checkCrossAxis) {
1620
- const minSide = crossAxis === 'y' ? 'top' : 'left';
1621
- const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
1622
- const min = crossAxisCoord + overflow[minSide];
1623
- const max = crossAxisCoord - overflow[maxSide];
1624
- crossAxisCoord = clamp(min, crossAxisCoord, max);
1625
- }
1626
- const limitedCoords = limiter.fn({
1627
- ...state,
1628
- [mainAxis]: mainAxisCoord,
1629
- [crossAxis]: crossAxisCoord
1630
- });
1631
- return {
1632
- ...limitedCoords,
1633
- data: {
1634
- x: limitedCoords.x - x,
1635
- y: limitedCoords.y - y
1636
- }
1637
- };
1638
- }
1639
- };
1640
- };
1641
- /**
1642
- * Built-in `limiter` that will stop `shift()` at a certain point.
1643
- */
1644
- const limitShift = function (options) {
1645
- if (options === void 0) {
1646
- options = {};
1647
- }
1648
- return {
1649
- options,
1650
- fn(state) {
1651
- const {
1652
- x,
1653
- y,
1654
- placement,
1655
- rects,
1656
- middlewareData
1657
- } = state;
1658
- const {
1659
- offset = 0,
1660
- mainAxis: checkMainAxis = true,
1661
- crossAxis: checkCrossAxis = true
1662
- } = evaluate(options, state);
1663
- const coords = {
1664
- x,
1665
- y
1666
- };
1667
- const crossAxis = getSideAxis(placement);
1668
- const mainAxis = getOppositeAxis(crossAxis);
1669
- let mainAxisCoord = coords[mainAxis];
1670
- let crossAxisCoord = coords[crossAxis];
1671
- const rawOffset = evaluate(offset, state);
1672
- const computedOffset = typeof rawOffset === 'number' ? {
1673
- mainAxis: rawOffset,
1674
- crossAxis: 0
1675
- } : {
1676
- mainAxis: 0,
1677
- crossAxis: 0,
1678
- ...rawOffset
1679
- };
1680
- if (checkMainAxis) {
1681
- const len = mainAxis === 'y' ? 'height' : 'width';
1682
- const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis;
1683
- const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis;
1684
- if (mainAxisCoord < limitMin) {
1685
- mainAxisCoord = limitMin;
1686
- } else if (mainAxisCoord > limitMax) {
1687
- mainAxisCoord = limitMax;
1688
- }
1689
- }
1690
- if (checkCrossAxis) {
1691
- var _middlewareData$offse, _middlewareData$offse2;
1692
- const len = mainAxis === 'y' ? 'width' : 'height';
1693
- const isOriginSide = ['top', 'left'].includes(getSide(placement));
1694
- const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis);
1695
- const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0);
1696
- if (crossAxisCoord < limitMin) {
1697
- crossAxisCoord = limitMin;
1698
- } else if (crossAxisCoord > limitMax) {
1699
- crossAxisCoord = limitMax;
1700
- }
1701
- }
1702
- return {
1703
- [mainAxis]: mainAxisCoord,
1704
- [crossAxis]: crossAxisCoord
1705
- };
1706
- }
1707
- };
1708
- };
1709
-
1710
- /**
1711
- * Provides data that allows you to change the size of the floating element —
1712
- * for instance, prevent it from overflowing the clipping boundary or match the
1713
- * width of the reference element.
1714
- * @see https://floating-ui.com/docs/size
1715
- */
1716
- const size = function (options) {
1717
- if (options === void 0) {
1718
- options = {};
1719
- }
1720
- return {
1721
- name: 'size',
1722
- options,
1723
- async fn(state) {
1724
- const {
1725
- placement,
1726
- rects,
1727
- platform,
1728
- elements
1729
- } = state;
1730
- const {
1731
- apply = () => {},
1732
- ...detectOverflowOptions
1733
- } = evaluate(options, state);
1734
- const overflow = await detectOverflow(state, detectOverflowOptions);
1735
- const side = getSide(placement);
1736
- const alignment = getAlignment(placement);
1737
- const isYAxis = getSideAxis(placement) === 'y';
1738
- const {
1739
- width,
1740
- height
1741
- } = rects.floating;
1742
- let heightSide;
1743
- let widthSide;
1744
- if (side === 'top' || side === 'bottom') {
1745
- heightSide = side;
1746
- widthSide = alignment === ((await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating))) ? 'start' : 'end') ? 'left' : 'right';
1747
- } else {
1748
- widthSide = side;
1749
- heightSide = alignment === 'end' ? 'top' : 'bottom';
1750
- }
1751
- const overflowAvailableHeight = height - overflow[heightSide];
1752
- const overflowAvailableWidth = width - overflow[widthSide];
1753
- const noShift = !state.middlewareData.shift;
1754
- let availableHeight = overflowAvailableHeight;
1755
- let availableWidth = overflowAvailableWidth;
1756
- if (isYAxis) {
1757
- const maximumClippingWidth = width - overflow.left - overflow.right;
1758
- availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth;
1759
- } else {
1760
- const maximumClippingHeight = height - overflow.top - overflow.bottom;
1761
- availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight;
1762
- }
1763
- if (noShift && !alignment) {
1764
- const xMin = max(overflow.left, 0);
1765
- const xMax = max(overflow.right, 0);
1766
- const yMin = max(overflow.top, 0);
1767
- const yMax = max(overflow.bottom, 0);
1768
- if (isYAxis) {
1769
- availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right));
1770
- } else {
1771
- availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom));
1772
- }
1773
- }
1774
- await apply({
1775
- ...state,
1776
- availableWidth,
1777
- availableHeight
1778
- });
1779
- const nextDimensions = await platform.getDimensions(elements.floating);
1780
- if (width !== nextDimensions.width || height !== nextDimensions.height) {
1781
- return {
1782
- reset: {
1783
- rects: true
1784
- }
1785
- };
1786
- }
1787
- return {};
1788
- }
1789
- };
1790
- };
1791
-
1792
-
1793
-
1794
- ;// CONCATENATED MODULE: ../../node_modules/@floating-ui/utils/dom/dist/floating-ui.utils.dom.mjs
1795
- function getNodeName(node) {
1796
- if (isNode(node)) {
1797
- return (node.nodeName || '').toLowerCase();
1798
- }
1799
- // Mocked nodes in testing environments may not be instances of Node. By
1800
- // returning `#document` an infinite loop won't occur.
1801
- // https://github.com/floating-ui/floating-ui/issues/2317
1802
- return '#document';
1803
- }
1804
- function getWindow(node) {
1805
- var _node$ownerDocument;
1806
- return (node == null ? void 0 : (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
1807
- }
1808
- function getDocumentElement(node) {
1809
- var _ref;
1810
- return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
1811
- }
1812
- function isNode(value) {
1813
- return value instanceof Node || value instanceof getWindow(value).Node;
1814
- }
1815
- function floating_ui_utils_dom_isElement(value) {
1816
- return value instanceof Element || value instanceof getWindow(value).Element;
1817
- }
1818
- function isHTMLElement(value) {
1819
- return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
1820
- }
1821
- function isShadowRoot(value) {
1822
- // Browsers without `ShadowRoot` support.
1823
- if (typeof ShadowRoot === 'undefined') {
1824
- return false;
1825
- }
1826
- return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
1827
- }
1828
- function isOverflowElement(element) {
1829
- const {
1830
- overflow,
1831
- overflowX,
1832
- overflowY,
1833
- display
1834
- } = getComputedStyle(element);
1835
- return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !['inline', 'contents'].includes(display);
1836
- }
1837
- function isTableElement(element) {
1838
- return ['table', 'td', 'th'].includes(getNodeName(element));
1839
- }
1840
- function isContainingBlock(element) {
1841
- const webkit = isWebKit();
1842
- const css = getComputedStyle(element);
1843
-
1844
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
1845
- return css.transform !== 'none' || css.perspective !== 'none' || (css.containerType ? css.containerType !== 'normal' : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== 'none' : false) || !webkit && (css.filter ? css.filter !== 'none' : false) || ['transform', 'perspective', 'filter'].some(value => (css.willChange || '').includes(value)) || ['paint', 'layout', 'strict', 'content'].some(value => (css.contain || '').includes(value));
1846
- }
1847
- function isWebKit() {
1848
- if (typeof CSS === 'undefined' || !CSS.supports) return false;
1849
- return CSS.supports('-webkit-backdrop-filter', 'none');
1850
- }
1851
- function isLastTraversableNode(node) {
1852
- return ['html', 'body', '#document'].includes(getNodeName(node));
1853
- }
1854
- function getComputedStyle(element) {
1855
- return getWindow(element).getComputedStyle(element);
1856
- }
1857
- function getNodeScroll(element) {
1858
- if (floating_ui_utils_dom_isElement(element)) {
1859
- return {
1860
- scrollLeft: element.scrollLeft,
1861
- scrollTop: element.scrollTop
1862
- };
1863
- }
1864
- return {
1865
- scrollLeft: element.pageXOffset,
1866
- scrollTop: element.pageYOffset
1867
- };
1868
- }
1869
- function getParentNode(node) {
1870
- if (getNodeName(node) === 'html') {
1871
- return node;
1872
- }
1873
- const result =
1874
- // Step into the shadow DOM of the parent of a slotted node.
1875
- node.assignedSlot ||
1876
- // DOM Element detected.
1877
- node.parentNode ||
1878
- // ShadowRoot detected.
1879
- isShadowRoot(node) && node.host ||
1880
- // Fallback.
1881
- getDocumentElement(node);
1882
- return isShadowRoot(result) ? result.host : result;
1883
- }
1884
- function getNearestOverflowAncestor(node) {
1885
- const parentNode = getParentNode(node);
1886
- if (isLastTraversableNode(parentNode)) {
1887
- return node.ownerDocument ? node.ownerDocument.body : node.body;
1888
- }
1889
- if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
1890
- return parentNode;
1891
- }
1892
- return getNearestOverflowAncestor(parentNode);
1893
- }
1894
- function getOverflowAncestors(node, list) {
1895
- var _node$ownerDocument2;
1896
- if (list === void 0) {
1897
- list = [];
1898
- }
1899
- const scrollableAncestor = getNearestOverflowAncestor(node);
1900
- const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
1901
- const win = getWindow(scrollableAncestor);
1902
- if (isBody) {
1903
- return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []);
1904
- }
1905
- return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor));
1906
- }
1907
-
1908
-
1909
-
1910
- ;// CONCATENATED MODULE: ../../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
1911
-
1912
-
1913
-
1914
-
1915
-
1916
-
1917
- function getCssDimensions(element) {
1918
- const css = getComputedStyle(element);
1919
- // In testing environments, the `width` and `height` properties are empty
1920
- // strings for SVG elements, returning NaN. Fallback to `0` in this case.
1921
- let width = parseFloat(css.width) || 0;
1922
- let height = parseFloat(css.height) || 0;
1923
- const hasOffset = isHTMLElement(element);
1924
- const offsetWidth = hasOffset ? element.offsetWidth : width;
1925
- const offsetHeight = hasOffset ? element.offsetHeight : height;
1926
- const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
1927
- if (shouldFallback) {
1928
- width = offsetWidth;
1929
- height = offsetHeight;
1930
- }
1931
- return {
1932
- width,
1933
- height,
1934
- $: shouldFallback
1935
- };
1936
- }
1937
-
1938
- function unwrapElement(element) {
1939
- return !floating_ui_utils_dom_isElement(element) ? element.contextElement : element;
1940
- }
1941
-
1942
- function getScale(element) {
1943
- const domElement = unwrapElement(element);
1944
- if (!isHTMLElement(domElement)) {
1945
- return createCoords(1);
1946
- }
1947
- const rect = domElement.getBoundingClientRect();
1948
- const {
1949
- width,
1950
- height,
1951
- $
1952
- } = getCssDimensions(domElement);
1953
- let x = ($ ? round(rect.width) : rect.width) / width;
1954
- let y = ($ ? round(rect.height) : rect.height) / height;
1955
-
1956
- // 0, NaN, or Infinity should always fallback to 1.
1957
-
1958
- if (!x || !Number.isFinite(x)) {
1959
- x = 1;
1960
- }
1961
- if (!y || !Number.isFinite(y)) {
1962
- y = 1;
1963
- }
1964
- return {
1965
- x,
1966
- y
1967
- };
1968
- }
1969
-
1970
- const noOffsets = /*#__PURE__*/createCoords(0);
1971
- function getVisualOffsets(element) {
1972
- const win = getWindow(element);
1973
- if (!isWebKit() || !win.visualViewport) {
1974
- return noOffsets;
1975
- }
1976
- return {
1977
- x: win.visualViewport.offsetLeft,
1978
- y: win.visualViewport.offsetTop
1979
- };
1980
- }
1981
- function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
1982
- if (isFixed === void 0) {
1983
- isFixed = false;
1984
- }
1985
- if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
1986
- return false;
1987
- }
1988
- return isFixed;
1989
- }
1990
-
1991
- function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
1992
- if (includeScale === void 0) {
1993
- includeScale = false;
1994
- }
1995
- if (isFixedStrategy === void 0) {
1996
- isFixedStrategy = false;
1997
- }
1998
- const clientRect = element.getBoundingClientRect();
1999
- const domElement = unwrapElement(element);
2000
- let scale = createCoords(1);
2001
- if (includeScale) {
2002
- if (offsetParent) {
2003
- if (floating_ui_utils_dom_isElement(offsetParent)) {
2004
- scale = getScale(offsetParent);
2005
- }
2006
- } else {
2007
- scale = getScale(element);
2008
- }
2009
- }
2010
- const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
2011
- let x = (clientRect.left + visualOffsets.x) / scale.x;
2012
- let y = (clientRect.top + visualOffsets.y) / scale.y;
2013
- let width = clientRect.width / scale.x;
2014
- let height = clientRect.height / scale.y;
2015
- if (domElement) {
2016
- const win = getWindow(domElement);
2017
- const offsetWin = offsetParent && floating_ui_utils_dom_isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
2018
- let currentIFrame = win.frameElement;
2019
- while (currentIFrame && offsetParent && offsetWin !== win) {
2020
- const iframeScale = getScale(currentIFrame);
2021
- const iframeRect = currentIFrame.getBoundingClientRect();
2022
- const css = getComputedStyle(currentIFrame);
2023
- const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
2024
- const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
2025
- x *= iframeScale.x;
2026
- y *= iframeScale.y;
2027
- width *= iframeScale.x;
2028
- height *= iframeScale.y;
2029
- x += left;
2030
- y += top;
2031
- currentIFrame = getWindow(currentIFrame).frameElement;
2032
- }
2033
- }
2034
- return rectToClientRect({
2035
- width,
2036
- height,
2037
- x,
2038
- y
2039
- });
2040
- }
2041
-
2042
- function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
2043
- let {
2044
- rect,
2045
- offsetParent,
2046
- strategy
2047
- } = _ref;
2048
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
2049
- const documentElement = getDocumentElement(offsetParent);
2050
- if (offsetParent === documentElement) {
2051
- return rect;
2052
- }
2053
- let scroll = {
2054
- scrollLeft: 0,
2055
- scrollTop: 0
2056
- };
2057
- let scale = createCoords(1);
2058
- const offsets = createCoords(0);
2059
- if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
2060
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2061
- scroll = getNodeScroll(offsetParent);
2062
- }
2063
- if (isHTMLElement(offsetParent)) {
2064
- const offsetRect = getBoundingClientRect(offsetParent);
2065
- scale = getScale(offsetParent);
2066
- offsets.x = offsetRect.x + offsetParent.clientLeft;
2067
- offsets.y = offsetRect.y + offsetParent.clientTop;
2068
- }
2069
- }
2070
- return {
2071
- width: rect.width * scale.x,
2072
- height: rect.height * scale.y,
2073
- x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x,
2074
- y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y
2075
- };
2076
- }
2077
-
2078
- function getClientRects(element) {
2079
- return Array.from(element.getClientRects());
2080
- }
2081
-
2082
- function getWindowScrollBarX(element) {
2083
- // If <html> has a CSS width greater than the viewport, then this will be
2084
- // incorrect for RTL.
2085
- return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
2086
- }
2087
-
2088
- // Gets the entire size of the scrollable document area, even extending outside
2089
- // of the `<html>` and `<body>` rect bounds if horizontally scrollable.
2090
- function getDocumentRect(element) {
2091
- const html = getDocumentElement(element);
2092
- const scroll = getNodeScroll(element);
2093
- const body = element.ownerDocument.body;
2094
- const width = floating_ui_utils_max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
2095
- const height = floating_ui_utils_max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
2096
- let x = -scroll.scrollLeft + getWindowScrollBarX(element);
2097
- const y = -scroll.scrollTop;
2098
- if (getComputedStyle(body).direction === 'rtl') {
2099
- x += floating_ui_utils_max(html.clientWidth, body.clientWidth) - width;
2100
- }
2101
- return {
2102
- width,
2103
- height,
2104
- x,
2105
- y
2106
- };
2107
- }
2108
-
2109
- function getViewportRect(element, strategy) {
2110
- const win = getWindow(element);
2111
- const html = getDocumentElement(element);
2112
- const visualViewport = win.visualViewport;
2113
- let width = html.clientWidth;
2114
- let height = html.clientHeight;
2115
- let x = 0;
2116
- let y = 0;
2117
- if (visualViewport) {
2118
- width = visualViewport.width;
2119
- height = visualViewport.height;
2120
- const visualViewportBased = isWebKit();
2121
- if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
2122
- x = visualViewport.offsetLeft;
2123
- y = visualViewport.offsetTop;
2124
- }
2125
- }
2126
- return {
2127
- width,
2128
- height,
2129
- x,
2130
- y
2131
- };
2132
- }
2133
-
2134
- // Returns the inner client rect, subtracting scrollbars if present.
2135
- function getInnerBoundingClientRect(element, strategy) {
2136
- const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
2137
- const top = clientRect.top + element.clientTop;
2138
- const left = clientRect.left + element.clientLeft;
2139
- const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
2140
- const width = element.clientWidth * scale.x;
2141
- const height = element.clientHeight * scale.y;
2142
- const x = left * scale.x;
2143
- const y = top * scale.y;
2144
- return {
2145
- width,
2146
- height,
2147
- x,
2148
- y
2149
- };
2150
- }
2151
- function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
2152
- let rect;
2153
- if (clippingAncestor === 'viewport') {
2154
- rect = getViewportRect(element, strategy);
2155
- } else if (clippingAncestor === 'document') {
2156
- rect = getDocumentRect(getDocumentElement(element));
2157
- } else if (floating_ui_utils_dom_isElement(clippingAncestor)) {
2158
- rect = getInnerBoundingClientRect(clippingAncestor, strategy);
2159
- } else {
2160
- const visualOffsets = getVisualOffsets(element);
2161
- rect = {
2162
- ...clippingAncestor,
2163
- x: clippingAncestor.x - visualOffsets.x,
2164
- y: clippingAncestor.y - visualOffsets.y
2165
- };
2166
- }
2167
- return rectToClientRect(rect);
2168
- }
2169
- function hasFixedPositionAncestor(element, stopNode) {
2170
- const parentNode = getParentNode(element);
2171
- if (parentNode === stopNode || !floating_ui_utils_dom_isElement(parentNode) || isLastTraversableNode(parentNode)) {
2172
- return false;
2173
- }
2174
- return getComputedStyle(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
2175
- }
2176
-
2177
- // A "clipping ancestor" is an `overflow` element with the characteristic of
2178
- // clipping (or hiding) child elements. This returns all clipping ancestors
2179
- // of the given element up the tree.
2180
- function getClippingElementAncestors(element, cache) {
2181
- const cachedResult = cache.get(element);
2182
- if (cachedResult) {
2183
- return cachedResult;
2184
- }
2185
- let result = getOverflowAncestors(element).filter(el => floating_ui_utils_dom_isElement(el) && getNodeName(el) !== 'body');
2186
- let currentContainingBlockComputedStyle = null;
2187
- const elementIsFixed = getComputedStyle(element).position === 'fixed';
2188
- let currentNode = elementIsFixed ? getParentNode(element) : element;
2189
-
2190
- // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
2191
- while (floating_ui_utils_dom_isElement(currentNode) && !isLastTraversableNode(currentNode)) {
2192
- const computedStyle = getComputedStyle(currentNode);
2193
- const currentNodeIsContaining = isContainingBlock(currentNode);
2194
- if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
2195
- currentContainingBlockComputedStyle = null;
2196
- }
2197
- const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && ['absolute', 'fixed'].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
2198
- if (shouldDropCurrentNode) {
2199
- // Drop non-containing blocks.
2200
- result = result.filter(ancestor => ancestor !== currentNode);
2201
- } else {
2202
- // Record last containing block for next iteration.
2203
- currentContainingBlockComputedStyle = computedStyle;
2204
- }
2205
- currentNode = getParentNode(currentNode);
2206
- }
2207
- cache.set(element, result);
2208
- return result;
2209
- }
2210
-
2211
- // Gets the maximum area that the element is visible in due to any number of
2212
- // clipping ancestors.
2213
- function getClippingRect(_ref) {
2214
- let {
2215
- element,
2216
- boundary,
2217
- rootBoundary,
2218
- strategy
2219
- } = _ref;
2220
- const elementClippingAncestors = boundary === 'clippingAncestors' ? getClippingElementAncestors(element, this._c) : [].concat(boundary);
2221
- const clippingAncestors = [...elementClippingAncestors, rootBoundary];
2222
- const firstClippingAncestor = clippingAncestors[0];
2223
- const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
2224
- const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
2225
- accRect.top = floating_ui_utils_max(rect.top, accRect.top);
2226
- accRect.right = floating_ui_utils_min(rect.right, accRect.right);
2227
- accRect.bottom = floating_ui_utils_min(rect.bottom, accRect.bottom);
2228
- accRect.left = floating_ui_utils_max(rect.left, accRect.left);
2229
- return accRect;
2230
- }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
2231
- return {
2232
- width: clippingRect.right - clippingRect.left,
2233
- height: clippingRect.bottom - clippingRect.top,
2234
- x: clippingRect.left,
2235
- y: clippingRect.top
2236
- };
2237
- }
2238
-
2239
- function getDimensions(element) {
2240
- return getCssDimensions(element);
2241
- }
2242
-
2243
- function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
2244
- const isOffsetParentAnElement = isHTMLElement(offsetParent);
2245
- const documentElement = getDocumentElement(offsetParent);
2246
- const isFixed = strategy === 'fixed';
2247
- const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
2248
- let scroll = {
2249
- scrollLeft: 0,
2250
- scrollTop: 0
2251
- };
2252
- const offsets = createCoords(0);
2253
- if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
2254
- if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
2255
- scroll = getNodeScroll(offsetParent);
2256
- }
2257
- if (isOffsetParentAnElement) {
2258
- const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
2259
- offsets.x = offsetRect.x + offsetParent.clientLeft;
2260
- offsets.y = offsetRect.y + offsetParent.clientTop;
2261
- } else if (documentElement) {
2262
- offsets.x = getWindowScrollBarX(documentElement);
2263
- }
2264
- }
2265
- return {
2266
- x: rect.left + scroll.scrollLeft - offsets.x,
2267
- y: rect.top + scroll.scrollTop - offsets.y,
2268
- width: rect.width,
2269
- height: rect.height
2270
- };
2271
- }
2272
-
2273
- function getTrueOffsetParent(element, polyfill) {
2274
- if (!isHTMLElement(element) || getComputedStyle(element).position === 'fixed') {
2275
- return null;
2276
- }
2277
- if (polyfill) {
2278
- return polyfill(element);
2279
- }
2280
- return element.offsetParent;
2281
- }
2282
- function getContainingBlock(element) {
2283
- let currentNode = getParentNode(element);
2284
- while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
2285
- if (isContainingBlock(currentNode)) {
2286
- return currentNode;
2287
- } else {
2288
- currentNode = getParentNode(currentNode);
2289
- }
2290
- }
2291
- return null;
2292
- }
2293
-
2294
- // Gets the closest ancestor positioned element. Handles some edge cases,
2295
- // such as table ancestors and cross browser bugs.
2296
- function getOffsetParent(element, polyfill) {
2297
- const window = getWindow(element);
2298
- if (!isHTMLElement(element)) {
2299
- return window;
2300
- }
2301
- let offsetParent = getTrueOffsetParent(element, polyfill);
2302
- while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {
2303
- offsetParent = getTrueOffsetParent(offsetParent, polyfill);
2304
- }
2305
- if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
2306
- return window;
2307
- }
2308
- return offsetParent || getContainingBlock(element) || window;
2309
- }
2310
-
2311
- const getElementRects = async function (_ref) {
2312
- let {
2313
- reference,
2314
- floating,
2315
- strategy
2316
- } = _ref;
2317
- const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
2318
- const getDimensionsFn = this.getDimensions;
2319
- return {
2320
- reference: getRectRelativeToOffsetParent(reference, await getOffsetParentFn(floating), strategy),
2321
- floating: {
2322
- x: 0,
2323
- y: 0,
2324
- ...(await getDimensionsFn(floating))
2325
- }
2326
- };
2327
- };
2328
-
2329
- function isRTL(element) {
2330
- return getComputedStyle(element).direction === 'rtl';
2331
- }
2332
-
2333
- const platform = {
2334
- convertOffsetParentRelativeRectToViewportRelativeRect,
2335
- getDocumentElement: getDocumentElement,
2336
- getClippingRect,
2337
- getOffsetParent,
2338
- getElementRects,
2339
- getClientRects,
2340
- getDimensions,
2341
- getScale,
2342
- isElement: floating_ui_utils_dom_isElement,
2343
- isRTL
2344
- };
2345
-
2346
- // https://samthor.au/2021/observing-dom/
2347
- function observeMove(element, onMove) {
2348
- let io = null;
2349
- let timeoutId;
2350
- const root = getDocumentElement(element);
2351
- function cleanup() {
2352
- clearTimeout(timeoutId);
2353
- io && io.disconnect();
2354
- io = null;
2355
- }
2356
- function refresh(skip, threshold) {
2357
- if (skip === void 0) {
2358
- skip = false;
2359
- }
2360
- if (threshold === void 0) {
2361
- threshold = 1;
2362
- }
2363
- cleanup();
2364
- const {
2365
- left,
2366
- top,
2367
- width,
2368
- height
2369
- } = element.getBoundingClientRect();
2370
- if (!skip) {
2371
- onMove();
2372
- }
2373
- if (!width || !height) {
2374
- return;
2375
- }
2376
- const insetTop = floor(top);
2377
- const insetRight = floor(root.clientWidth - (left + width));
2378
- const insetBottom = floor(root.clientHeight - (top + height));
2379
- const insetLeft = floor(left);
2380
- const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
2381
- const options = {
2382
- rootMargin,
2383
- threshold: floating_ui_utils_max(0, floating_ui_utils_min(1, threshold)) || 1
2384
- };
2385
- let isFirstUpdate = true;
2386
- function handleObserve(entries) {
2387
- const ratio = entries[0].intersectionRatio;
2388
- if (ratio !== threshold) {
2389
- if (!isFirstUpdate) {
2390
- return refresh();
2391
- }
2392
- if (!ratio) {
2393
- timeoutId = setTimeout(() => {
2394
- refresh(false, 1e-7);
2395
- }, 100);
2396
- } else {
2397
- refresh(false, ratio);
2398
- }
2399
- }
2400
- isFirstUpdate = false;
2401
- }
2402
-
2403
- // Older browsers don't support a `document` as the root and will throw an
2404
- // error.
2405
- try {
2406
- io = new IntersectionObserver(handleObserve, {
2407
- ...options,
2408
- // Handle <iframe>s
2409
- root: root.ownerDocument
2410
- });
2411
- } catch (e) {
2412
- io = new IntersectionObserver(handleObserve, options);
2413
- }
2414
- io.observe(element);
2415
- }
2416
- refresh(true);
2417
- return cleanup;
2418
- }
2419
-
2420
- /**
2421
- * Automatically updates the position of the floating element when necessary.
2422
- * Should only be called when the floating element is mounted on the DOM or
2423
- * visible on the screen.
2424
- * @returns cleanup function that should be invoked when the floating element is
2425
- * removed from the DOM or hidden from the screen.
2426
- * @see https://floating-ui.com/docs/autoUpdate
2427
- */
2428
- function autoUpdate(reference, floating, update, options) {
2429
- if (options === void 0) {
2430
- options = {};
2431
- }
2432
- const {
2433
- ancestorScroll = true,
2434
- ancestorResize = true,
2435
- elementResize = typeof ResizeObserver === 'function',
2436
- layoutShift = typeof IntersectionObserver === 'function',
2437
- animationFrame = false
2438
- } = options;
2439
- const referenceEl = unwrapElement(reference);
2440
- const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
2441
- ancestors.forEach(ancestor => {
2442
- ancestorScroll && ancestor.addEventListener('scroll', update, {
2443
- passive: true
2444
- });
2445
- ancestorResize && ancestor.addEventListener('resize', update);
2446
- });
2447
- const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
2448
- let reobserveFrame = -1;
2449
- let resizeObserver = null;
2450
- if (elementResize) {
2451
- resizeObserver = new ResizeObserver(_ref => {
2452
- let [firstEntry] = _ref;
2453
- if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
2454
- // Prevent update loops when using the `size` middleware.
2455
- // https://github.com/floating-ui/floating-ui/issues/1740
2456
- resizeObserver.unobserve(floating);
2457
- cancelAnimationFrame(reobserveFrame);
2458
- reobserveFrame = requestAnimationFrame(() => {
2459
- resizeObserver && resizeObserver.observe(floating);
2460
- });
2461
- }
2462
- update();
2463
- });
2464
- if (referenceEl && !animationFrame) {
2465
- resizeObserver.observe(referenceEl);
2466
- }
2467
- resizeObserver.observe(floating);
2468
- }
2469
- let frameId;
2470
- let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
2471
- if (animationFrame) {
2472
- frameLoop();
2473
- }
2474
- function frameLoop() {
2475
- const nextRefRect = getBoundingClientRect(reference);
2476
- if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
2477
- update();
2478
- }
2479
- prevRefRect = nextRefRect;
2480
- frameId = requestAnimationFrame(frameLoop);
2481
- }
2482
- update();
2483
- return () => {
2484
- ancestors.forEach(ancestor => {
2485
- ancestorScroll && ancestor.removeEventListener('scroll', update);
2486
- ancestorResize && ancestor.removeEventListener('resize', update);
2487
- });
2488
- cleanupIo && cleanupIo();
2489
- resizeObserver && resizeObserver.disconnect();
2490
- resizeObserver = null;
2491
- if (animationFrame) {
2492
- cancelAnimationFrame(frameId);
2493
- }
2494
- };
2495
- }
2496
-
2497
- /**
2498
- * Computes the `x` and `y` coordinates that will place the floating element
2499
- * next to a reference element when it is given a certain CSS positioning
2500
- * strategy.
2501
- */
2502
- const floating_ui_dom_computePosition = (reference, floating, options) => {
2503
- // This caches the expensive `getClippingElementAncestors` function so that
2504
- // multiple lifecycle resets re-use the same result. It only lives for a
2505
- // single call. If other functions become expensive, we can add them as well.
2506
- const cache = new Map();
2507
- const mergedOptions = {
2508
- platform,
2509
- ...options
2510
- };
2511
- const platformWithCache = {
2512
- ...mergedOptions.platform,
2513
- _c: cache
2514
- };
2515
- return computePosition(reference, floating, {
2516
- ...mergedOptions,
2517
- platform: platformWithCache
2518
- });
2519
- };
2520
-
2521
-
2522
-
2523
- ;// CONCATENATED MODULE: external "lodash/isElement"
2524
- var isElement_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
2525
- var isElement_y = x => () => x
2526
- const isElement_namespaceObject = isElement_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_isElement_e6b2a6ce__["default"] });
2527
- ;// CONCATENATED MODULE: external "lodash/random"
2528
- var random_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
2529
- var random_y = x => () => x
2530
- const random_namespaceObject = random_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_random_1771bfd1__["default"] });
2531
- ;// CONCATENATED MODULE: ../../node_modules/uuid/dist/esm-browser/native.js
2532
- const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
2533
- /* harmony default export */ const esm_browser_native = ({
2534
- randomUUID
2535
- });
2536
- ;// CONCATENATED MODULE: ../../node_modules/uuid/dist/esm-browser/rng.js
2537
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
2538
- // require the crypto API and do not support built-in fallback to lower quality random number
2539
- // generators (like Math.random()).
2540
- let getRandomValues;
2541
- const rnds8 = new Uint8Array(16);
2542
- function rng() {
2543
- // lazy load so that environments that need to polyfill have a chance to do so
2544
- if (!getRandomValues) {
2545
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
2546
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
2547
-
2548
- if (!getRandomValues) {
2549
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
2550
- }
2551
- }
2552
-
2553
- return getRandomValues(rnds8);
2554
- }
2555
- ;// CONCATENATED MODULE: ../../node_modules/uuid/dist/esm-browser/stringify.js
2556
-
2557
- /**
2558
- * Convert array of 16 byte values to UUID string format of the form:
2559
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
2560
- */
2561
-
2562
- const byteToHex = [];
2563
-
2564
- for (let i = 0; i < 256; ++i) {
2565
- byteToHex.push((i + 0x100).toString(16).slice(1));
2566
- }
2567
-
2568
- function unsafeStringify(arr, offset = 0) {
2569
- // Note: Be careful editing this code! It's been tuned for performance
2570
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
2571
- return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
2572
- }
2573
-
2574
- function stringify(arr, offset = 0) {
2575
- const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID. If this throws, it's likely due to one
2576
- // of the following:
2577
- // - One or more input array values don't map to a hex octet (leading to
2578
- // "undefined" in the uuid)
2579
- // - Invalid input values for the RFC `version` or `variant` fields
2580
-
2581
- if (!validate(uuid)) {
2582
- throw TypeError('Stringified UUID is invalid');
2583
- }
2584
-
2585
- return uuid;
2586
- }
2587
-
2588
- /* harmony default export */ const esm_browser_stringify = ((/* unused pure expression or super */ null && (stringify)));
2589
- ;// CONCATENATED MODULE: ../../node_modules/uuid/dist/esm-browser/v4.js
2590
-
2591
-
2592
-
2593
-
2594
- function v4(options, buf, offset) {
2595
- if (esm_browser_native.randomUUID && !buf && !options) {
2596
- return esm_browser_native.randomUUID();
2597
- }
2598
-
2599
- options = options || {};
2600
- const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
2601
-
2602
- rnds[6] = rnds[6] & 0x0f | 0x40;
2603
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
2604
-
2605
- if (buf) {
2606
- offset = offset || 0;
2607
-
2608
- for (let i = 0; i < 16; ++i) {
2609
- buf[offset + i] = rnds[i];
2610
- }
2611
-
2612
- return buf;
2613
- }
2614
-
2615
- return unsafeStringify(rnds);
2616
- }
2617
-
2618
- /* harmony default export */ const esm_browser_v4 = (v4);
2619
- ;// CONCATENATED MODULE: ../../packages/popover/src/utils.ts
2620
- /*
2621
- * Tencent is pleased to support the open source community by making
2622
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2623
- *
2624
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2625
- *
2626
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2627
- *
2628
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2629
- *
2630
- * ---------------------------------------------------
2631
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2632
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2633
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2634
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2635
- *
2636
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2637
- * the Software.
2638
- *
2639
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2640
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2641
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2642
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2643
- * IN THE SOFTWARE.
2644
- */
2645
-
2646
-
2647
- var CachedConst = {};
2648
- // 全局的占位区点击记录
2649
- var ReferenceClickSharedState = {};
2650
- var isAvailableId = function isAvailableId(query) {
2651
- var container = document.querySelector(query);
2652
- return container instanceof HTMLElement;
2653
- };
2654
- var getFullscreenUid = function getFullscreenUid() {
2655
- if (!CachedConst.fullscreenReferId) {
2656
- CachedConst.fullscreenReferId = "id_".concat(esm_browser_v4());
2657
- }
2658
- return CachedConst.fullscreenReferId;
2659
- };
2660
- var utils_isElement = function isElement(element) {
2661
- return element instanceof Element || element instanceof HTMLDocument;
2662
- };
2663
- var contentAsHTMLElement = function contentAsHTMLElement(content) {
2664
- if (utils_isElement(content)) {
2665
- return {
2666
- isElement: true,
2667
- content: content,
2668
- vNode: undefined
2669
- };
2670
- }
2671
- if (/^(#|\.)/.test(content)) {
2672
- var target = document.querySelector(content);
2673
- var isEle = utils_isElement(target);
2674
- return {
2675
- isElement: isEle,
2676
- content: isEle ? target : content,
2677
- vNode: isEle ? undefined : content
2678
- };
2679
- }
2680
- return {
2681
- isElement: false,
2682
- content: content,
2683
- vNode: content
2684
- };
2685
- };
2686
- var random = function random() {
2687
- return "".concat((0,random_namespaceObject["default"])(0, 999999), "_").concat(Date.now(), "_").concat((0,random_namespaceObject["default"])(0, 999999));
2688
- };
2689
- ;// CONCATENATED MODULE: ../../packages/popover/src/use-floating.tsx
2690
-
2691
-
2692
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2693
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
2694
- /*
2695
- * Tencent is pleased to support the open source community by making
2696
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2697
- *
2698
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2699
- *
2700
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2701
- *
2702
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2703
- *
2704
- * ---------------------------------------------------
2705
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2706
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2707
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2708
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2709
- *
2710
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2711
- * the Software.
2712
- *
2713
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2714
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2715
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2716
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2717
- * IN THE SOFTWARE.
2718
- */
2719
-
2720
-
2721
-
2722
-
2723
-
2724
- // import usePlatform from './use-platform';
2725
-
2726
- /**
2727
- * 解析popover相关配置
2728
- */
2729
- /* harmony default export */ const use_floating = (function (props, ctx, _ref) {
2730
- var refReference = _ref.refReference,
2731
- refContent = _ref.refContent,
2732
- refArrow = _ref.refArrow,
2733
- refRoot = _ref.refRoot;
2734
- var localIsShow = (0,external_vue_namespaceObject.ref)(false);
2735
- var fullScreenTarget = (0,external_vue_namespaceObject.ref)();
2736
- var isElementFullScreen = function isElementFullScreen() {
2737
- var _document$fullscreenE, _document$fullscreenE2;
2738
- var elReference = resolveReferElement();
2739
- if ((_document$fullscreenE = document.fullscreenElement) !== null && _document$fullscreenE !== void 0 && _document$fullscreenE.shadowRoot) {
2740
- return document.fullscreenElement.shadowRoot.contains(elReference);
2741
- }
2742
- return (_document$fullscreenE2 = document.fullscreenElement) === null || _document$fullscreenE2 === void 0 ? void 0 : _document$fullscreenE2.contains(elReference);
2743
- };
2744
- /**
2745
- * 当全屏模式开启,获取指定选择器下面的全屏元素
2746
- * 如果是启用了webcomponent组件,则返回shadowRoot内指定的目标元素
2747
- * @param selector
2748
- * @returns
2749
- */
2750
- var getFullscreenRoot = function getFullscreenRoot(selector) {
2751
- if (isElementFullScreen()) {
2752
- if (document.fullscreenElement.shadowRoot) {
2753
- return document.fullscreenElement.shadowRoot.querySelector(selector);
2754
- }
2755
- return document.fullscreenElement.querySelector(selector);
2756
- }
2757
- return document.body;
2758
- };
2759
- var themeList = ['dark', 'light'];
2760
- /**
2761
- * 根据props.theme计算theme
2762
- * 返回systemTheme & customTheme
2763
- * systemTheme是指包含在 ['dark', 'light'] 内置主题
2764
- * customTheme是指自定义的theme,string类型
2765
- */
2766
- var compTheme = (0,external_vue_namespaceObject.computed)(function () {
2767
- var _props$theme$split, _props$theme;
2768
- var themes = (_props$theme$split = (_props$theme = props.theme) === null || _props$theme === void 0 ? void 0 : _props$theme.split(/\s+/)) !== null && _props$theme$split !== void 0 ? _props$theme$split : [];
2769
- themes.sort(function (a, b) {
2770
- return Number(themeList.includes(b)) - Number(themeList.includes(a));
2771
- });
2772
- var systemThemes = themes;
2773
- var customThemes = themes.filter(function (item) {
2774
- return !themeList.includes(item);
2775
- });
2776
- return {
2777
- systemThemes: systemThemes,
2778
- customThemes: customThemes
2779
- };
2780
- });
2781
- var isHideMiddlewareAvailable = function isHideMiddlewareAvailable() {
2782
- return props.autoVisibility;
2783
- };
2784
- var isAutoPlacementAvailable = function isAutoPlacementAvailable() {
2785
- return props.autoPlacement;
2786
- };
2787
- /**
2788
- * 解析弹出reference元素,content元素, arrow元素
2789
- * @returns
2790
- */
2791
- var resolvePopElements = function resolvePopElements() {
2792
- var _refContent$value, _refArrow$value, _refRoot$value;
2793
- var elReference = resolveReferElement();
2794
- var elContent = resolveTargetElement((_refContent$value = refContent.value) === null || _refContent$value === void 0 ? void 0 : _refContent$value.$el);
2795
- var elArrow = props.arrow ? resolveTargetElement((_refArrow$value = refArrow.value) === null || _refArrow$value === void 0 ? void 0 : _refArrow$value.$el) : null;
2796
- var root = resolveTargetElement((_refRoot$value = refRoot.value) === null || _refRoot$value === void 0 ? void 0 : _refRoot$value.$el);
2797
- var _contentAsHTMLElement = contentAsHTMLElement(props.content),
2798
- isElement = _contentAsHTMLElement.isElement,
2799
- content = _contentAsHTMLElement.content;
2800
- if (elContent && isElement && !(elContent !== null && elContent !== void 0 && elContent.contains(content))) {
2801
- elContent.append(content);
2802
- }
2803
- return {
2804
- elReference: elReference,
2805
- elContent: elContent,
2806
- elArrow: elArrow,
2807
- root: root
2808
- };
2809
- };
2810
- var resolveReferElement = function resolveReferElement() {
2811
- var _refReference$value;
2812
- return resolveTargetElement(props.target) || resolveTargetElement((_refReference$value = refReference.value) === null || _refReference$value === void 0 ? void 0 : _refReference$value.$el);
2813
- };
2814
- var resolveModifiers = function resolveModifiers() {
2815
- var resolveResult = {};
2816
- if (Array.isArray(props.modifiers)) {
2817
- props.modifiers.forEach(function (m) {
2818
- var result;
2819
- if (m.name === 'offset') {
2820
- var _m$options, _m$options3;
2821
- if (typeof ((_m$options = m.options) === null || _m$options === void 0 ? void 0 : _m$options.offset) === 'number') {
2822
- var _m$options2;
2823
- result = (_m$options2 = m.options) === null || _m$options2 === void 0 ? void 0 : _m$options2.offset;
2824
- }
2825
- if (Array.isArray((_m$options3 = m.options) === null || _m$options3 === void 0 ? void 0 : _m$options3.offset)) {
2826
- var _m$options4;
2827
- var _m$options$offset = (_m$options4 = m.options) === null || _m$options4 === void 0 ? void 0 : _m$options4.offset,
2828
- _m$options$offset2 = _slicedToArray(_m$options$offset, 2),
2829
- mainAxis = _m$options$offset2[0],
2830
- crossAxis = _m$options$offset2[1];
2831
- result = {
2832
- mainAxis: mainAxis,
2833
- crossAxis: crossAxis
2834
- };
2835
- }
2836
- Object.assign(resolveResult, {
2837
- offset: result
2838
- });
2839
- }
2840
- });
2841
- }
2842
- return resolveResult;
2843
- };
2844
- var resolvePopOptions = function resolvePopOptions(elArrow, props) {
2845
- var modifiers = resolveModifiers();
2846
- var middleware = [offset(modifiers.offset || props.offset), shift({
2847
- padding: props.padding
2848
- })];
2849
- var options = {
2850
- placement: props.placement,
2851
- middleware: middleware
2852
- };
2853
- if (props.arrow) {
2854
- middleware.push(arrow({
2855
- element: elArrow
2856
- }));
2857
- }
2858
- if (isAutoPlacementAvailable()) {
2859
- middleware.push(autoPlacement());
2860
- }
2861
- middleware.unshift(inline());
2862
- middleware.push(flip());
2863
- if (isHideMiddlewareAvailable()) {
2864
- options.middleware.push(hide());
2865
- }
2866
- /**
2867
- * 如果是全屏元素或者指定的虚拟元素
2868
- * 则启用自定义的platform
2869
- * 在弹出的全屏元素中,元素相对位置有别于document下面元素
2870
- * 全屏模式下面,需要自定义当前元素的一个platform
2871
- */
2872
- // if (isElementFullScreen() || props.isVirtualEl) {
2873
- // const { getElementRects, getDimensions, getClippingRect } = usePlatform(fullScreenTarget.value);
2874
- // Object.assign(options, {
2875
- // platform: {
2876
- // ...(props?.platform ?? {}),
2877
- // getElementRects,
2878
- // getDimensions,
2879
- // getClippingRect,
2880
- // },
2881
- // });
2882
- // }
2883
- return options;
2884
- };
2885
- var resolveTargetElement = function resolveTargetElement(target) {
2886
- if (target instanceof HTMLElement) {
2887
- return target;
2888
- }
2889
- if (target instanceof Text) {
2890
- return resolveTargetElement(target.nextElementSibling);
2891
- }
2892
- if (typeof (target === null || target === void 0 ? void 0 : target.getBoundingClientRect) === 'function') {
2893
- return target;
2894
- }
2895
- if (typeof target === 'string') {
2896
- var targetEl = document.querySelector(target);
2897
- if ((0,isElement_namespaceObject["default"])(targetEl)) {
2898
- return targetEl;
2899
- }
2900
- return null;
2901
- }
2902
- if (target instanceof PointerEvent) {
2903
- return resolveTargetElement(target.target);
2904
- }
2905
- return null;
2906
- };
2907
- // 兼容多种样式处理规则
2908
- // class custom-theme
2909
- var customThemeCls = compTheme.value.customThemes.join(' ');
2910
- var customTheme = compTheme.value.customThemes.reduce(function (out, cur) {
2911
- return _objectSpread(_defineProperty({}, "data-".concat(cur, "-theme"), true), out);
2912
- }, {});
2913
- var contentClass = "".concat(customThemeCls);
2914
- var cleanup = null;
2915
- var getRoundPixelVal = function getRoundPixelVal(val) {
2916
- var dpr = window.devicePixelRatio || 1;
2917
- return Math.round(val * dpr) / dpr || 0;
2918
- };
2919
- var updatePopContentStyle = function updatePopContentStyle(elContent, x, y, middlewareData) {
2920
- var _middlewareData$hide;
2921
- if (props.disableTransform) {
2922
- Object.assign(elContent.style, {
2923
- left: "".concat(getRoundPixelVal(x), "px"),
2924
- top: "".concat(getRoundPixelVal(y), "px")
2925
- });
2926
- } else {
2927
- Object.assign(elContent.style, {
2928
- left: '0',
2929
- top: '0',
2930
- transform: "translate3d(".concat(getRoundPixelVal(x), "px,").concat(getRoundPixelVal(y), "px,0)")
2931
- });
2932
- }
2933
- var referenceHidden = isHideMiddlewareAvailable() ? (_middlewareData$hide = middlewareData.hide) === null || _middlewareData$hide === void 0 ? void 0 : _middlewareData$hide.referenceHidden : false;
2934
- Object.assign(elContent.style, {
2935
- visibility: referenceHidden ? 'hidden' : 'visible'
2936
- });
2937
- };
2938
- var updateArrowStyle = function updateArrowStyle(elArrow, resolvedPlacement, middlewareData) {
2939
- if (props.arrow) {
2940
- var _middlewareData$arrow;
2941
- var _ref2 = (_middlewareData$arrow = middlewareData.arrow) !== null && _middlewareData$arrow !== void 0 ? _middlewareData$arrow : {},
2942
- arrowX = _ref2.x,
2943
- arrowY = _ref2.y;
2944
- elArrow.setAttribute('data-arrow', resolvedPlacement);
2945
- var arrowConfig = {
2946
- left: '',
2947
- top: '',
2948
- bottom: '',
2949
- right: ''
2950
- };
2951
- Object.assign(elArrow.style, arrowConfig);
2952
- var arrowSide = {
2953
- top: 'bottom',
2954
- right: 'left',
2955
- bottom: 'top',
2956
- left: 'right'
2957
- }[resolvedPlacement];
2958
- Object.assign(elArrow.style, _defineProperty({
2959
- left: arrowX !== null ? "".concat(arrowX, "px") : '',
2960
- top: arrowY !== null ? "".concat(arrowY, "px") : ''
2961
- }, arrowSide, '-4px'));
2962
- }
2963
- };
2964
- var createPopInstance = function createPopInstance() {
2965
- var _resolvePopElements = resolvePopElements(),
2966
- elReference = _resolvePopElements.elReference,
2967
- elContent = _resolvePopElements.elContent;
2968
- cleanup = autoUpdate(elReference, elContent, function () {
2969
- if (localIsShow.value) {
2970
- updatePopover(null, props);
2971
- }
2972
- });
2973
- };
2974
- var updatePopover = function updatePopover() {
2975
- var virtualEl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
2976
- var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2977
- var callFn = arguments.length > 2 ? arguments[2] : undefined;
2978
- var _resolvePopElements2 = resolvePopElements(),
2979
- elReference = _resolvePopElements2.elReference,
2980
- elContent = _resolvePopElements2.elContent,
2981
- elArrow = _resolvePopElements2.elArrow;
2982
- var targetEl = virtualEl || elReference;
2983
- if (!targetEl || !elContent) return;
2984
- var options = resolvePopOptions(elArrow, props);
2985
- floating_ui_dom_computePosition(targetEl, elContent, options).then(function (_ref3) {
2986
- var x = _ref3.x,
2987
- y = _ref3.y,
2988
- placement = _ref3.placement,
2989
- middlewareData = _ref3.middlewareData;
2990
- var oldClass = elContent.className;
2991
- elContent.className = "".concat(oldClass.replace(contentClass, ''), " ").concat(contentClass).replace(/\s+/gm, ' ').replace(/^\s+|\s+$/g, '');
2992
- Object.keys(customTheme).forEach(function (key) {
2993
- elContent.setAttribute(key, customTheme[key]);
2994
- });
2995
- var placementStr = placement.split('-')[0];
2996
- var resolvedPlacement = placementStr;
2997
- if (!['left', 'right', 'top', 'bottom'].includes(placementStr)) {
2998
- resolvedPlacement = 'top';
2999
- }
3000
- updatePopContentStyle(elContent, x, y, middlewareData);
3001
- updateArrowStyle(elArrow, resolvedPlacement, middlewareData);
3002
- if (typeof callFn === 'function') {
3003
- callFn();
3004
- }
3005
- });
3006
- };
3007
- var popHideTimerId = undefined;
3008
- var popShowTimerId = undefined;
3009
- var isMouseenter = false;
3010
- var resolvePopoverDelay = function resolvePopoverDelay() {
3011
- if (Array.isArray(props.popoverDelay)) {
3012
- return [props.popoverDelay[0], props.popoverDelay.slice(-1)[0]];
3013
- }
3014
- return [props.popoverDelay, props.popoverDelay];
3015
- };
3016
- var showPopover = function showPopover() {
3017
- var delay = resolvePopoverDelay()[0];
3018
- // 设置settimeout避免hidePopover导致显示问题
3019
- popShowTimerId = setTimeout(function () {
3020
- // if (popHideTimerId) {
3021
- // clearTimeout(popHideTimerId);
3022
- // }
3023
- if (!props.disabled) {
3024
- localIsShow.value = true;
3025
- }
3026
- }, delay);
3027
- };
3028
- var hidePopover = function hidePopover() {
3029
- var delay = resolvePopoverDelay()[1];
3030
- popHideTimerId = setTimeout(function () {
3031
- popShowTimerId && clearTimeout(popShowTimerId);
3032
- isMouseenter = false;
3033
- localIsShow.value = false;
3034
- }, delay);
3035
- };
3036
- var handlePopoverShow = function handlePopoverShow() {
3037
- var _refContent$value2;
3038
- var elContent = resolveTargetElement((_refContent$value2 = refContent.value) === null || _refContent$value2 === void 0 ? void 0 : _refContent$value2.$el);
3039
- elContent.style.setProperty('display', 'block');
3040
- elContent.style.setProperty('z-index', "".concat(props.zIndex ? props.zIndex : shared_namespaceObject.bkZIndexManager.getPopperIndex()));
3041
- updatePopover();
3042
- ctx.emit(EMIT_EVENTS.CONTENT_AfterShow, {
3043
- isShow: true
3044
- });
3045
- };
3046
- var handlePopoverHide = function handlePopoverHide() {
3047
- var _refContent$value3;
3048
- var elContent = resolveTargetElement((_refContent$value3 = refContent.value) === null || _refContent$value3 === void 0 ? void 0 : _refContent$value3.$el);
3049
- elContent.style.setProperty('display', 'none');
3050
- ctx.emit(EMIT_EVENTS.CONTENT_AfterHidden, {
3051
- isShow: false
3052
- });
3053
- };
3054
- var triggerPopover = function triggerPopover() {
3055
- if (!localIsShow.value) {
3056
- showPopover();
3057
- } else {
3058
- hidePopover();
3059
- }
3060
- };
3061
- var handlePopContentMouseEnter = function handlePopContentMouseEnter(e) {
3062
- if ('hover' !== props.trigger) {
3063
- return;
3064
- }
3065
- if (!isMouseenter) {
3066
- isMouseenter = true;
3067
- }
3068
- // 设置setTimeout的延时为delay, 避免出现同时触发mouseenter mouseleave事件
3069
- var delay = resolvePopoverDelay()[1];
3070
- if (popHideTimerId) {
3071
- clearTimeout(popHideTimerId);
3072
- setTimeout(function () {
3073
- popHideTimerId = undefined;
3074
- }, delay);
3075
- }
3076
- emitPopContentMouseEnter(e);
3077
- };
3078
- var handlePopContentMouseLeave = function handlePopContentMouseLeave(e) {
3079
- // 处理底部触发mouseleave事件,popShowTimerId有值代表处于hover状态
3080
- if (popShowTimerId && !popHideTimerId) {
3081
- hidePopover();
3082
- }
3083
- emitPopContentMouseLeave(e);
3084
- };
3085
- /**
3086
- * 弹出内容鼠标移入事件
3087
- * 抛出相关事件,方便后续操作
3088
- * 例如:鼠标移入内容区域,则取消弹出内容隐藏操作
3089
- */
3090
- var emitPopContentMouseEnter = function emitPopContentMouseEnter(e) {
3091
- ctx.emit(EMIT_EVENTS.CONTENT_MOUSEENTER, e);
3092
- };
3093
- /**
3094
- * 弹出内容鼠标移出事件
3095
- */
3096
- var emitPopContentMouseLeave = function emitPopContentMouseLeave(e) {
3097
- ctx.emit(EMIT_EVENTS.CONTENT_MOUSELEAVE, e);
3098
- };
3099
- var resolveTriggerEvents = function resolveTriggerEvents() {
3100
- var _triggerEvents$props$;
3101
- var triggerEvents = {
3102
- hover: [{
3103
- content: [['mouseenter', handlePopContentMouseEnter], ['mouseleave', handlePopContentMouseLeave]],
3104
- reference: [['mouseenter', showPopover], ['mouseleave', hidePopover], ['focus', showPopover], ['blur', hidePopover]]
3105
- }],
3106
- click: [[['click', showPopover]]],
3107
- manual: [{
3108
- content: [['mouseenter', emitPopContentMouseEnter], ['mouseleave', emitPopContentMouseLeave]],
3109
- reference: [[]]
3110
- }]
3111
- };
3112
- return (_triggerEvents$props$ = triggerEvents[props.trigger]) !== null && _triggerEvents$props$ !== void 0 ? _triggerEvents$props$ : [];
3113
- };
3114
- var updateFullscreenTarget = function updateFullscreenTarget(val) {
3115
- fullScreenTarget.value = val;
3116
- };
3117
- (0,external_vue_namespaceObject.watch)(function () {
3118
- return props.isShow;
3119
- }, function (val) {
3120
- localIsShow.value = val;
3121
- });
3122
- (0,external_vue_namespaceObject.watch)(localIsShow, function (val) {
3123
- if (val) {
3124
- handlePopoverShow();
3125
- } else {
3126
- handlePopoverHide();
3127
- }
3128
- });
3129
- var stopHide = function stopHide() {
3130
- if (popHideTimerId) {
3131
- isMouseenter = true;
3132
- clearTimeout(popHideTimerId);
3133
- popHideTimerId = undefined;
3134
- }
3135
- };
3136
- return {
3137
- showPopover: showPopover,
3138
- hidePopover: hidePopover,
3139
- resolveTriggerEvents: resolveTriggerEvents,
3140
- updatePopover: updatePopover,
3141
- triggerPopover: triggerPopover,
3142
- resolvePopElements: resolvePopElements,
3143
- isElementFullScreen: isElementFullScreen,
3144
- resolveTargetElement: resolveTargetElement,
3145
- createPopInstance: createPopInstance,
3146
- updateFullscreenTarget: updateFullscreenTarget,
3147
- getFullscreenRoot: getFullscreenRoot,
3148
- stopHide: stopHide,
3149
- localIsShow: localIsShow,
3150
- cleanup: cleanup
3151
- };
3152
- });
3153
- ;// CONCATENATED MODULE: ../../packages/popover/src/use-popper-id.ts
3154
- /*
3155
- * Tencent is pleased to support the open source community by making
3156
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
3157
- *
3158
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3159
- *
3160
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
3161
- *
3162
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
3163
- *
3164
- * ---------------------------------------------------
3165
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
3166
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
3167
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
3168
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3169
- *
3170
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
3171
- * the Software.
3172
- *
3173
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
3174
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3175
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
3176
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
3177
- * IN THE SOFTWARE.
3178
- */
3179
-
3180
-
3181
- var popContainerId = null;
3182
- var parentNodeReferId = null;
3183
- /* harmony default export */ const use_popper_id = (function (props) {
3184
- var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '#';
3185
- var getPrefixId = function getPrefixId(root) {
3186
- var resolvedBoundary = null;
3187
- var resolveBoundary = function resolveBoundary(fn) {
3188
- if (resolvedBoundary === null) {
3189
- fn();
3190
- }
3191
- };
3192
- var resolveParentBoundary = function resolveParentBoundary() {
3193
- if (/^parent$/i.test(props.boundary)) {
3194
- resolvedBoundary = "".concat(prefix).concat(popContainerId);
3195
- var _ref = root || {},
3196
- parentNode = _ref.parentNode;
3197
- if (parentNode !== null && parentNode !== void 0 && parentNode.parentNode) {
3198
- parentNode.parentNode.setAttribute('data-pnode-id', parentNodeReferId);
3199
- resolvedBoundary = "[data-pnode-id=".concat(parentNodeReferId, "]");
3200
- }
3201
- }
3202
- };
3203
- var resolveCommonBoundary = function resolveCommonBoundary() {
3204
- if (!/^body$/i.test(props.boundary)) {
3205
- if (typeof props.boundary === 'string') {
3206
- if (!isAvailableId(props.boundary)) {
3207
- // console.error('props.boundary is not available selector');
3208
- resolvedBoundary = 'body';
3209
- return;
3210
- }
3211
- resolvedBoundary = props.boundary;
3212
- return;
3213
- }
3214
- if (utils_isElement(props.boundary)) {
3215
- resolvedBoundary = props.boundary;
3216
- return;
3217
- }
3218
- }
3219
- };
3220
- resolveBoundary(resolveParentBoundary);
3221
- resolveBoundary(resolveCommonBoundary);
3222
- resolveBoundary(function () {
3223
- resolvedBoundary = typeof props.boundary === 'string' ? props.boundary : "".concat(prefix).concat(popContainerId);
3224
- });
3225
- return resolvedBoundary;
3226
- };
3227
- if (popContainerId === null || !isAvailableId("#".concat(popContainerId))) {
3228
- popContainerId = "id_".concat(esm_browser_v4());
3229
- var popContainer = document.createElement('div');
3230
- popContainer.setAttribute('id', popContainerId);
3231
- popContainer.setAttribute('data-popper-id', popContainerId);
3232
- document.body.append(popContainer);
3233
- }
3234
- if (parentNodeReferId === null) {
3235
- parentNodeReferId = "id_".concat(esm_browser_v4());
3236
- }
3237
- return {
3238
- popContainerId: popContainerId,
3239
- prefixId: getPrefixId(),
3240
- getPrefixId: getPrefixId
3241
- };
3242
- });
3243
- ;// CONCATENATED MODULE: ../../packages/popover/src/use-popover-init.ts
3244
-
3245
- /*
3246
- * Tencent is pleased to support the open source community by making
3247
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
3248
- *
3249
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3250
- *
3251
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
3252
- *
3253
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
3254
- *
3255
- * ---------------------------------------------------
3256
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
3257
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
3258
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
3259
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3260
- *
3261
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
3262
- * the Software.
3263
- *
3264
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
3265
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3266
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
3267
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
3268
- * IN THE SOFTWARE.
3269
- */
3270
-
3271
-
3272
-
3273
-
3274
-
3275
- /* harmony default export */ const use_popover_init = (function (props, ctx, _ref) {
3276
- var refReference = _ref.refReference,
3277
- refContent = _ref.refContent,
3278
- refArrow = _ref.refArrow,
3279
- refRoot = _ref.refRoot;
3280
- var storeEvents = null;
3281
- var uniqKey = random();
3282
- var isFullscreen = (0,external_vue_namespaceObject.ref)(false);
3283
- var fullscreenReferId = getFullscreenUid();
3284
- var fullScreenTarget = (0,external_vue_namespaceObject.ref)();
3285
- var _useFloating = use_floating(props, ctx, {
3286
- refReference: refReference,
3287
- refContent: refContent,
3288
- refArrow: refArrow,
3289
- refRoot: refRoot
3290
- }),
3291
- localIsShow = _useFloating.localIsShow,
3292
- showPopover = _useFloating.showPopover,
3293
- hidePopover = _useFloating.hidePopover,
3294
- updatePopover = _useFloating.updatePopover,
3295
- cleanup = _useFloating.cleanup,
3296
- resolveTriggerEvents = _useFloating.resolveTriggerEvents,
3297
- resolvePopElements = _useFloating.resolvePopElements,
3298
- isElementFullScreen = _useFloating.isElementFullScreen,
3299
- updateFullscreenTarget = _useFloating.updateFullscreenTarget,
3300
- createPopInstance = _useFloating.createPopInstance,
3301
- getFullscreenRoot = _useFloating.getFullscreenRoot,
3302
- stopHide = _useFloating.stopHide;
3303
- var resetPopover = function resetPopover() {
3304
- cleanup === null || cleanup === void 0 ? void 0 : cleanup();
3305
- createPopInstance();
3306
- };
3307
- var showFn = function showFn() {
3308
- showPopover();
3309
- };
3310
- var hideFn = function hideFn() {
3311
- hidePopover();
3312
- };
3313
- var initPopInstance = function initPopInstance() {
3314
- createPopInstance();
3315
- if (props.always) {
3316
- showPopover();
3317
- } else {
3318
- addEventToPopTargetEl();
3319
- }
3320
- };
3321
- var addEventToPopTargetEl = function addEventToPopTargetEl() {
3322
- var _resolvePopElements = resolvePopElements(),
3323
- elReference = _resolvePopElements.elReference,
3324
- elContent = _resolvePopElements.elContent;
3325
- storeEvents = resolveTriggerEvents();
3326
- storeEvents.forEach(function (storeEvent) {
3327
- if (Array.isArray(storeEvent)) {
3328
- addEventToTargetEl(elReference, storeEvent);
3329
- } else {
3330
- var content = storeEvent.content,
3331
- reference = storeEvent.reference;
3332
- addEventToTargetEl(elReference, reference);
3333
- addEventToTargetEl(elContent, content);
3334
- }
3335
- });
3336
- };
3337
- var addEventToTargetEl = function addEventToTargetEl(target, evets) {
3338
- evets.forEach(function (_ref2) {
3339
- var _ref3 = _slicedToArray(_ref2, 2),
3340
- event = _ref3[0],
3341
- listener = _ref3[1];
3342
- if (event && typeof listener === 'function') {
3343
- target.addEventListener(event, listener);
3344
- }
3345
- });
3346
- };
3347
- var removeEventListener = function removeEventListener() {
3348
- var _storeEvents;
3349
- if ((_storeEvents = storeEvents) !== null && _storeEvents !== void 0 && _storeEvents.length) {
3350
- var _resolvePopElements2 = resolvePopElements(),
3351
- elReference = _resolvePopElements2.elReference,
3352
- elContent = _resolvePopElements2.elContent;
3353
- if (elReference) {
3354
- storeEvents.forEach(function (storeEvent) {
3355
- if (Array.isArray(storeEvent)) {
3356
- storeEvent.forEach(function (_ref4) {
3357
- var _ref5 = _slicedToArray(_ref4, 2),
3358
- event = _ref5[0],
3359
- listener = _ref5[1];
3360
- if (event && typeof listener === 'function') {
3361
- elReference.removeEventListener(event, listener);
3362
- }
3363
- });
3364
- } else {
3365
- var content = storeEvent.content,
3366
- reference = storeEvent.reference;
3367
- content.forEach(function (_ref6) {
3368
- var _ref7 = _slicedToArray(_ref6, 2),
3369
- event = _ref7[0],
3370
- listener = _ref7[1];
3371
- if (event && typeof listener === 'function') {
3372
- if (elContent) {
3373
- elContent.removeEventListener(event, listener);
3374
- }
3375
- }
3376
- });
3377
- reference.forEach(function (_ref8) {
3378
- var _ref9 = _slicedToArray(_ref8, 2),
3379
- event = _ref9[0],
3380
- listener = _ref9[1];
3381
- if (event && typeof listener === 'function') {
3382
- elReference.removeEventListener(event, listener);
3383
- }
3384
- });
3385
- }
3386
- });
3387
- }
3388
- storeEvents = null;
3389
- }
3390
- };
3391
- var getClosestFullscreenElement = function getClosestFullscreenElement(elment) {
3392
- var _elment$closest;
3393
- return (_elment$closest = elment === null || elment === void 0 ? void 0 : elment.closest('[data-fllsrn-id]')) !== null && _elment$closest !== void 0 ? _elment$closest : elment;
3394
- };
3395
- var updateBoundary = function updateBoundary() {
3396
- var _resolvePopElements3 = resolvePopElements(),
3397
- elReference = _resolvePopElements3.elReference,
3398
- root = _resolvePopElements3.root;
3399
- if (isFullscreen.value) {
3400
- var _fullScreenTarget$val;
3401
- var _ref10 = elReference || root || {},
3402
- parentNode = _ref10.parentNode;
3403
- boundary.value = (_fullScreenTarget$val = fullScreenTarget === null || fullScreenTarget === void 0 ? void 0 : fullScreenTarget.value) !== null && _fullScreenTarget$val !== void 0 ? _fullScreenTarget$val : getClosestFullscreenElement(parentNode);
3404
- return;
3405
- }
3406
- boundary.value = getPrefixId(root || elReference);
3407
- };
3408
- var _usePopperId = use_popper_id(props, '#'),
3409
- getPrefixId = _usePopperId.getPrefixId;
3410
- var setFullscreenTag = function setFullscreenTag() {
3411
- var _fullScreenTarget$val2;
3412
- fullScreenTarget === null || fullScreenTarget === void 0 || (_fullScreenTarget$val2 = fullScreenTarget.value) === null || _fullScreenTarget$val2 === void 0 ? void 0 : _fullScreenTarget$val2.setAttribute('data-fllsrn-id', fullscreenReferId);
3413
- };
3414
- var clearFullscreenTag = function clearFullscreenTag() {
3415
- var _fullScreenTarget$val3, _fullScreenTarget$val4;
3416
- var query = "[data-fllsrn-id=".concat(fullscreenReferId, "]");
3417
- ((_fullScreenTarget$val3 = fullScreenTarget === null || fullScreenTarget === void 0 || (_fullScreenTarget$val4 = fullScreenTarget.value) === null || _fullScreenTarget$val4 === void 0 ? void 0 : _fullScreenTarget$val4.querySelectorAll(query)) !== null && _fullScreenTarget$val3 !== void 0 ? _fullScreenTarget$val3 : []).forEach(function (element) {
3418
- element === null || element === void 0 ? void 0 : element.removeAttribute('data-fllsrn-id');
3419
- });
3420
- };
3421
- var boundary = (0,external_vue_namespaceObject.ref)();
3422
- var beforeInstanceUnmount = function beforeInstanceUnmount() {
3423
- removeEventListener();
3424
- };
3425
- var updateFullscreen = function updateFullscreen(target) {
3426
- fullScreenTarget.value = target;
3427
- updateFullscreenTarget(target);
3428
- isFullscreen.value = isElementFullScreen();
3429
- setFullscreenTag();
3430
- };
3431
- var handleFullscreenChange = function handleFullscreenChange(e) {
3432
- if (!document.fullscreenElement) {
3433
- clearFullscreenTag();
3434
- }
3435
- updateFullscreen(e.target);
3436
- updateBoundary();
3437
- updatePopover(null, props);
3438
- };
3439
- var onMountedFn = function onMountedFn() {
3440
- if (props.disabled) {
3441
- return;
3442
- }
3443
- initPopInstance();
3444
- if (isElementFullScreen()) {
3445
- var query = "[data-fllsrn-id=".concat(fullscreenReferId, "]");
3446
- var target = getFullscreenRoot(query);
3447
- updateFullscreen(target);
3448
- }
3449
- updateBoundary();
3450
- document.body.addEventListener('fullscreenchange', handleFullscreenChange);
3451
- };
3452
- var onUnmountedFn = function onUnmountedFn() {
3453
- beforeInstanceUnmount();
3454
- document.body.removeEventListener('fullscreenchange', handleFullscreenChange);
3455
- };
3456
- var handleClickOutside = function handleClickOutside(_e) {
3457
- var hideIgnoreReference = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3458
- var commonFunc = function commonFunc() {
3459
- ctx.emit(EMIT_EVENTS.CLICK_OUTSIDE, {
3460
- isShow: localIsShow.value,
3461
- event: _e
3462
- });
3463
- var needExec = props.disableOutsideClick || props.always || props.disabled || props.trigger === 'manual';
3464
- if (!props.forceClickoutside && needExec) {
3465
- return;
3466
- }
3467
- if (localIsShow.value) {
3468
- hideFn();
3469
- }
3470
- };
3471
- if (hideIgnoreReference) {
3472
- setTimeout(function () {
3473
- if (ReferenceClickSharedState[uniqKey]) {
3474
- ReferenceClickSharedState[uniqKey] = false;
3475
- return;
3476
- }
3477
- return commonFunc();
3478
- });
3479
- } else {
3480
- return commonFunc();
3481
- }
3482
- };
3483
- return {
3484
- onMountedFn: onMountedFn,
3485
- onUnmountedFn: onUnmountedFn,
3486
- handleClickOutside: handleClickOutside,
3487
- beforeInstanceUnmount: beforeInstanceUnmount,
3488
- updateBoundary: updateBoundary,
3489
- initPopInstance: initPopInstance,
3490
- updatePopover: updatePopover,
3491
- resetPopover: resetPopover,
3492
- showPopover: showPopover,
3493
- hidePopover: hidePopover,
3494
- showFn: showFn,
3495
- hideFn: hideFn,
3496
- stopHide: stopHide,
3497
- isFullscreen: isFullscreen,
3498
- boundary: boundary,
3499
- localIsShow: localIsShow,
3500
- uniqKey: uniqKey
3501
- };
3502
- });
3503
- ;// CONCATENATED MODULE: ../../packages/popover/src/popover.tsx
3504
-
3505
- /*
3506
- * Tencent is pleased to support the open source community by making
3507
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
3508
- *
3509
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3510
- *
3511
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
3512
- *
3513
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
3514
- *
3515
- * ---------------------------------------------------
3516
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
3517
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
3518
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
3519
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3520
- *
3521
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
3522
- * the Software.
3523
- *
3524
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
3525
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3526
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
3527
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
3528
- * IN THE SOFTWARE.
3529
- */
3530
-
3531
-
3532
-
3533
-
3534
-
3535
-
3536
-
3537
-
3538
-
3539
-
3540
- function _isSlot(s) {
3541
- return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !(0,external_vue_namespaceObject.isVNode)(s);
3542
- }
3543
- /* harmony default export */ const popover = (defineComponent({
3544
- name: 'Popover',
3545
- components: {
3546
- Content: content,
3547
- Arrow: src_arrow,
3548
- Root: root
3549
- },
3550
- directives: {
3551
- clickoutside: clickoutside
3552
- },
3553
- props: PopoverProps,
3554
- emits: EMIT_EVENT_TYPES,
3555
- setup: function setup(props, ctx) {
3556
- var _toRefs = toRefs(props),
3557
- reference = _toRefs.reference;
3558
- var refDefaultReference = ref();
3559
- var refContent = ref();
3560
- var refArrow = ref();
3561
- var refRoot = ref();
3562
- var refReference = computed(function () {
3563
- return reference.value || refDefaultReference.value;
3564
- });
3565
- var _usePopoverInit = use_popover_init(props, ctx, {
3566
- refReference: refReference,
3567
- refContent: refContent,
3568
- refArrow: refArrow,
3569
- refRoot: refRoot
3570
- }),
3571
- onMountedFn = _usePopoverInit.onMountedFn,
3572
- onUnmountedFn = _usePopoverInit.onUnmountedFn,
3573
- handleClickOutside = _usePopoverInit.handleClickOutside,
3574
- beforeInstanceUnmount = _usePopoverInit.beforeInstanceUnmount,
3575
- updateBoundary = _usePopoverInit.updateBoundary,
3576
- initPopInstance = _usePopoverInit.initPopInstance,
3577
- showFn = _usePopoverInit.showFn,
3578
- hideFn = _usePopoverInit.hideFn,
3579
- showPopover = _usePopoverInit.showPopover,
3580
- hidePopover = _usePopoverInit.hidePopover,
3581
- updatePopover = _usePopoverInit.updatePopover,
3582
- resetPopover = _usePopoverInit.resetPopover,
3583
- stopHide = _usePopoverInit.stopHide,
3584
- localIsShow = _usePopoverInit.localIsShow,
3585
- boundary = _usePopoverInit.boundary,
3586
- uniqKey = _usePopoverInit.uniqKey;
3587
- if (!props.always && !props.disabled) {
3588
- watch(function () {
3589
- return props.isShow;
3590
- }, function () {
3591
- props.isShow ? showPopover() : hidePopover();
3592
- }, {
3593
- immediate: true
3594
- });
3595
- }
3596
- watch(function () {
3597
- return [props.disabled];
3598
- }, function (val) {
3599
- if (val[0]) {
3600
- beforeInstanceUnmount();
3601
- } else {
3602
- initPopInstance();
3603
- }
3604
- });
3605
- updateBoundary();
3606
- onMounted(onMountedFn);
3607
- onBeforeUnmount(onUnmountedFn);
3608
- var isRenderModeShow = computed(function () {
3609
- return props.renderDirective === 'show';
3610
- });
3611
- var transBoundary = computed(function () {
3612
- return isRenderModeShow.value || localIsShow.value && !props.disableTeleport;
3613
- });
3614
- var contentIsShow = computed(function () {
3615
- if (props.renderType === shared_namespaceObject.RenderType.AUTO) {
3616
- return true;
3617
- }
3618
- return localIsShow.value;
3619
- });
3620
- var show = function show() {
3621
- showFn();
3622
- };
3623
- var hide = function hide() {
3624
- hideFn();
3625
- };
3626
- var handleClickReferenceWraper = function handleClickReferenceWraper() {
3627
- ReferenceClickSharedState[uniqKey] = true;
3628
- };
3629
- // 点击 content 收起面板
3630
- var handleClickContent = function handleClickContent() {
3631
- if (props.trigger !== 'manual' && !props.always && props.clickContentAutoHide) {
3632
- localIsShow.value = false;
3633
- }
3634
- };
3635
- var renderContent = function renderContent() {
3636
- if (props.allowHtml) {
3637
- var _contentAsHTMLElement = contentAsHTMLElement(props.content),
3638
- vNode = _contentAsHTMLElement.vNode;
3639
- return vNode;
3640
- }
3641
- return props.content;
3642
- };
3643
- return {
3644
- boundary: boundary,
3645
- arrow: props.arrow,
3646
- refDefaultReference: refDefaultReference,
3647
- refContent: refContent,
3648
- refArrow: refArrow,
3649
- content: props.content,
3650
- theme: props.theme,
3651
- isRenderModeShow: isRenderModeShow,
3652
- transBoundary: transBoundary,
3653
- handleClickContent: handleClickContent,
3654
- handleClickOutside: handleClickOutside,
3655
- updatePopover: updatePopover,
3656
- resetPopover: resetPopover,
3657
- hide: hide,
3658
- show: show,
3659
- stopHide: stopHide,
3660
- contentIsShow: contentIsShow,
3661
- renderContent: renderContent,
3662
- localIsShow: localIsShow,
3663
- handleClickReferenceWraper: handleClickReferenceWraper
3664
- };
3665
- },
3666
- render: function render() {
3667
- var _slot, _slot2;
3668
- var _this$$slots$default,
3669
- _this$$slots$default2,
3670
- _this$$slots,
3671
- _this$$slots$default3,
3672
- _this$$slots$default4,
3673
- _this$$slots2,
3674
- _this = this,
3675
- _this$$slots$content,
3676
- _this$$slots$content2,
3677
- _this$$slots4;
3678
- var renderReferSlot = function renderReferSlot(slot) {
3679
- var _slot$;
3680
- if (Text === (slot === null || slot === void 0 || (_slot$ = slot[0]) === null || _slot$ === void 0 ? void 0 : _slot$.type)) {
3681
- return (0,external_vue_namespaceObject.createVNode)("span", null, [slot]);
3682
- }
3683
- return slot;
3684
- };
3685
- return (0,external_vue_namespaceObject.createVNode)(root, {
3686
- "ref": "refRoot"
3687
- }, {
3688
- "default": function _default() {
3689
- return [_this.hideIgnoreReference ? (0,external_vue_namespaceObject.createVNode)("div", {
3690
- "class": _this.referenceCls,
3691
- "style": "display: inline-block;",
3692
- "onClick": _this.handleClickReferenceWraper
3693
- }, [(0,external_vue_namespaceObject.createVNode)(reference, {
3694
- "ref": "refDefaultReference"
3695
- }, _isSlot(_slot = renderReferSlot((_this$$slots$default = (_this$$slots$default2 = (_this$$slots = _this.$slots)["default"]) === null || _this$$slots$default2 === void 0 ? void 0 : _this$$slots$default2.call(_this$$slots)) !== null && _this$$slots$default !== void 0 ? _this$$slots$default : (0,external_vue_namespaceObject.createVNode)("span", null, null))) ? _slot : {
3696
- "default": function _default() {
3697
- return [_slot];
3698
- }
3699
- })]) : (0,external_vue_namespaceObject.createVNode)(reference, {
3700
- "ref": "refDefaultReference"
3701
- }, _isSlot(_slot2 = renderReferSlot((_this$$slots$default3 = (_this$$slots$default4 = (_this$$slots2 = _this.$slots)["default"]) === null || _this$$slots$default4 === void 0 ? void 0 : _this$$slots$default4.call(_this$$slots2)) !== null && _this$$slots$default3 !== void 0 ? _this$$slots$default3 : (0,external_vue_namespaceObject.createVNode)("span", null, null))) ? _slot2 : {
3702
- "default": function _default() {
3703
- return [_slot2];
3704
- }
3705
- }), (0,external_vue_namespaceObject.createVNode)(Teleport, {
3706
- "disabled": !_this.transBoundary,
3707
- "to": _this.boundary
3708
- }, {
3709
- "default": function _default() {
3710
- return [(0,external_vue_namespaceObject.withDirectives)((0,external_vue_namespaceObject.createVNode)(content, {
3711
- "ref": "refContent",
3712
- "width": _this.width,
3713
- "height": _this.height,
3714
- "extCls": _this.extCls,
3715
- "data-theme": _this.theme,
3716
- "eventDelay": _this.componentEventDelay,
3717
- "maxHeight": _this.maxHeight,
3718
- "maxWidth": _this.maxWidth,
3719
- "visible": _this.localIsShow,
3720
- "onClick": _this.handleClickContent
3721
- }, {
3722
- "default": function _default() {
3723
- return [_this.isRenderModeShow || _this.contentIsShow ? (_this$$slots$content = (_this$$slots$content2 = (_this$$slots4 = _this.$slots).content) === null || _this$$slots$content2 === void 0 ? void 0 : _this$$slots$content2.call(_this$$slots4)) !== null && _this$$slots$content !== void 0 ? _this$$slots$content : _this.renderContent() : ''];
3724
- },
3725
- arrow: function arrow() {
3726
- var _this$$slots$arrow, _this$$slots3;
3727
- return _this.arrow ? (0,external_vue_namespaceObject.createVNode)(src_arrow, {
3728
- "ref": "refArrow"
3729
- }, {
3730
- "default": function _default() {
3731
- return [(_this$$slots$arrow = (_this$$slots3 = _this.$slots).arrow) === null || _this$$slots$arrow === void 0 ? void 0 : _this$$slots$arrow.call(_this$$slots3)];
3732
- }
3733
- }) : '';
3734
- }
3735
- }), [[(0,external_vue_namespaceObject.resolveDirective)("clickoutside"), function (e) {
3736
- return _this.handleClickOutside(e, _this.hideIgnoreReference);
3737
- }]])];
3738
- }
3739
- })];
3740
- }
3741
- });
3742
- }
3743
- }));
3744
- ;// CONCATENATED MODULE: ../../packages/popover/src/plugin-popover.tsx
3745
-
3746
-
3747
- function plugin_popover_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3748
- function plugin_popover_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? plugin_popover_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : plugin_popover_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3749
- /*
3750
- * Tencent is pleased to support the open source community by making
3751
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
3752
- *
3753
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3754
- *
3755
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
3756
- *
3757
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
3758
- *
3759
- * ---------------------------------------------------
3760
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
3761
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
3762
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
3763
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
3764
- *
3765
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
3766
- * the Software.
3767
- *
3768
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
3769
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3770
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
3771
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
3772
- * IN THE SOFTWARE.
3773
- */
3774
-
3775
-
3776
-
3777
-
3778
- function createPopoverComponent(options) {
3779
- var _options$immediate;
3780
- var $PopoverInstance = null;
3781
- var $PopoverInstanceVm = null;
3782
- var $PopoverInstanceEl = null;
3783
- var immediate = (_options$immediate = options.immediate) !== null && _options$immediate !== void 0 ? _options$immediate : true;
3784
- var resolvedOptions = plugin_popover_objectSpread(plugin_popover_objectSpread({
3785
- boundary: 'body',
3786
- placement: 'top',
3787
- autoVisibility: true,
3788
- isShow: false,
3789
- trigger: 'manual',
3790
- onHide: function onHide() {},
3791
- onShow: function onShow() {}
3792
- }, options), {}, {
3793
- allowHtml: true
3794
- });
3795
- var popoverComponent = {
3796
- name: '$popover',
3797
- setup: function setup(_, _ref) {
3798
- var expose = _ref.expose;
3799
- var formatOptions = function formatOptions() {
3800
- return Object.keys(PopoverProps).reduce(function (result, key) {
3801
- if (Object.prototype.hasOwnProperty.call(resolvedOptions, key)) {
3802
- Object.assign(result, _defineProperty({}, key, resolvedOptions[key]));
3803
- }
3804
- return result;
3805
- }, {
3806
- target: resolvedOptions.target
3807
- });
3808
- };
3809
- var refProps = (0,external_vue_namespaceObject.reactive)(formatOptions());
3810
- var refReference = (0,external_vue_namespaceObject.ref)();
3811
- var show = function show() {
3812
- var _refReference$value, _refReference$value$s;
3813
- (_refReference$value = refReference.value) === null || _refReference$value === void 0 || (_refReference$value$s = _refReference$value.show) === null || _refReference$value$s === void 0 ? void 0 : _refReference$value$s.call(_refReference$value);
3814
- };
3815
- var hide = function hide() {
3816
- var _refReference$value2, _refReference$value2$;
3817
- (_refReference$value2 = refReference.value) === null || _refReference$value2 === void 0 || (_refReference$value2$ = _refReference$value2.hide) === null || _refReference$value2$ === void 0 ? void 0 : _refReference$value2$.call(_refReference$value2);
3818
- };
3819
- var stopHide = function stopHide() {
3820
- var _refReference$value3, _refReference$value3$;
3821
- (_refReference$value3 = refReference.value) === null || _refReference$value3 === void 0 || (_refReference$value3$ = _refReference$value3.stopHide) === null || _refReference$value3$ === void 0 ? void 0 : _refReference$value3$.call(_refReference$value3);
3822
- };
3823
- var updateTarget = function updateTarget(target) {
3824
- var _refReference$value4, _refReference$value4$;
3825
- refProps.target = target;
3826
- (_refReference$value4 = refReference.value) === null || _refReference$value4 === void 0 || (_refReference$value4$ = _refReference$value4.resetPopover) === null || _refReference$value4$ === void 0 ? void 0 : _refReference$value4$.call(_refReference$value4);
3827
- };
3828
- var handleContentMouseenter = function handleContentMouseenter() {
3829
- var _resolvedOptions$onCo;
3830
- (_resolvedOptions$onCo = resolvedOptions.onContentMouseenter) === null || _resolvedOptions$onCo === void 0 ? void 0 : _resolvedOptions$onCo.call(resolvedOptions);
3831
- };
3832
- var handleContentMouseleave = function handleContentMouseleave() {
3833
- var _resolvedOptions$onCo2;
3834
- (_resolvedOptions$onCo2 = resolvedOptions.onContentMouseleave) === null || _resolvedOptions$onCo2 === void 0 ? void 0 : _resolvedOptions$onCo2.call(resolvedOptions);
3835
- };
3836
- var handlePopoverHidden = function handlePopoverHidden() {
3837
- var _resolvedOptions$onHi;
3838
- (_resolvedOptions$onHi = resolvedOptions.onHide) === null || _resolvedOptions$onHi === void 0 ? void 0 : _resolvedOptions$onHi.call(resolvedOptions);
3839
- };
3840
- var handlePopoverShow = function handlePopoverShow() {
3841
- var _resolvedOptions$onSh;
3842
- (_resolvedOptions$onSh = resolvedOptions.onShow) === null || _resolvedOptions$onSh === void 0 ? void 0 : _resolvedOptions$onSh.call(resolvedOptions);
3843
- };
3844
- expose({
3845
- show: show,
3846
- hide: hide,
3847
- updateTarget: updateTarget,
3848
- stopHide: stopHide
3849
- });
3850
- return function () {
3851
- return (0,external_vue_namespaceObject.createVNode)(popover, (0,external_vue_namespaceObject.mergeProps)(refProps, {
3852
- "ref": refReference,
3853
- "onAfterHidden": handlePopoverHidden,
3854
- "onAfterShow": handlePopoverShow,
3855
- "onContentMouseenter": handleContentMouseenter,
3856
- "onContentMouseleave": handleContentMouseleave
3857
- }), null);
3858
- };
3859
- }
3860
- };
3861
- function getBoundaryDom(boundary) {
3862
- if (/^body$/i.test(boundary)) {
3863
- return document.body;
3864
- }
3865
- if (/^parent$/i.test(boundary)) {
3866
- if (utils_isElement(resolvedOptions.target)) {
3867
- return resolvedOptions.target.parentNode;
3868
- }
3869
- return resolvedOptions.target.target.parentNode;
3870
- }
3871
- if (typeof boundary === 'string' && isAvailableId(boundary)) {
3872
- return document.querySelector(boundary);
3873
- }
3874
- return document.body;
3875
- }
3876
- var install = function install() {
3877
- if ($PopoverInstance === null) {
3878
- $PopoverInstanceEl = document.createElement('div');
3879
- getBoundaryDom(resolvedOptions.boundary).append($PopoverInstanceEl);
3880
- $PopoverInstance = (0,external_vue_namespaceObject.createApp)(popoverComponent);
3881
- $PopoverInstanceVm = $PopoverInstance.mount($PopoverInstanceEl);
3882
- }
3883
- };
3884
- var uninstall = function uninstall() {
3885
- var _$PopoverInstanceEl;
3886
- if (utils_isElement(options.content)) {
3887
- options.content.remove();
3888
- }
3889
- $PopoverInstance.unmount();
3890
- $PopoverInstance = null;
3891
- (_$PopoverInstanceEl = $PopoverInstanceEl) === null || _$PopoverInstanceEl === void 0 ? void 0 : _$PopoverInstanceEl.remove();
3892
- };
3893
- function close() {
3894
- uninstall();
3895
- $PopoverInstanceVm = null;
3896
- }
3897
- function show(target) {
3898
- var _$PopoverInstanceVm2;
3899
- install();
3900
- if (target) {
3901
- var _$PopoverInstanceVm;
3902
- (_$PopoverInstanceVm = $PopoverInstanceVm) === null || _$PopoverInstanceVm === void 0 ? void 0 : _$PopoverInstanceVm.updateTarget(target);
3903
- }
3904
- (_$PopoverInstanceVm2 = $PopoverInstanceVm) === null || _$PopoverInstanceVm2 === void 0 ? void 0 : _$PopoverInstanceVm2.show();
3905
- }
3906
- function update(e) {
3907
- var _$PopoverInstanceVm3;
3908
- (_$PopoverInstanceVm3 = $PopoverInstanceVm) === null || _$PopoverInstanceVm3 === void 0 ? void 0 : _$PopoverInstanceVm3.updateTarget(e);
3909
- }
3910
- function hide() {
3911
- var _$PopoverInstanceVm4;
3912
- (_$PopoverInstanceVm4 = $PopoverInstanceVm) === null || _$PopoverInstanceVm4 === void 0 ? void 0 : _$PopoverInstanceVm4.hide();
3913
- }
3914
- immediate && install();
3915
- return {
3916
- install: install,
3917
- close: close,
3918
- show: show,
3919
- hide: hide,
3920
- update: update,
3921
- uninstall: uninstall,
3922
- get vm() {
3923
- return $PopoverInstanceVm;
3924
- },
3925
- get $el() {
3926
- return $PopoverInstanceVm.$el;
3927
- }
3928
- };
3929
- }
35
+ const popover_namespaceObject = x({ ["$bkPopover"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_popover_9b03f19d__.$bkPopover });
3930
36
  ;// CONCATENATED MODULE: ../../packages/plugin-popover/src/index.ts
3931
37
  /**
3932
38
  * Tencent is pleased to support the open source community by making
@@ -3954,6 +60,6 @@ function createPopoverComponent(options) {
3954
60
  * IN THE SOFTWARE.
3955
61
  */
3956
62
 
3957
- /* harmony default export */ const src = (createPopoverComponent);
63
+ /* harmony default export */ const src = (popover_namespaceObject.$bkPopover);
3958
64
  var __webpack_exports__default = __webpack_exports__["default"];
3959
65
  export { __webpack_exports__default as default };