bkui-vue 1.0.3-beta.60.scrollbar.4 → 1.0.3-beta.61

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 (210) hide show
  1. package/dist/index.cjs.js +50 -52
  2. package/dist/index.esm.js +13994 -14680
  3. package/dist/index.umd.js +50 -52
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/affix/index.js +1 -1
  7. package/lib/alert/index.js +1 -1
  8. package/lib/animate-number/index.js +7 -8
  9. package/lib/badge/index.js +1 -1
  10. package/lib/breadcrumb/index.js +1 -1
  11. package/lib/button/index.js +1 -1
  12. package/lib/card/index.js +1 -1
  13. package/lib/cascader/index.js +38 -42
  14. package/lib/checkbox/index.js +6 -7
  15. package/lib/collapse/index.js +11 -12
  16. package/lib/collapse-transition/index.js +3 -4
  17. package/lib/color-picker/index.js +10 -13
  18. package/lib/components.d.ts +1 -0
  19. package/lib/components.js +2 -1
  20. package/lib/config-provider/index.js +1 -1
  21. package/lib/container/index.js +10 -12
  22. package/lib/date-picker/index.js +2 -2
  23. package/lib/dialog/dialog.css +7 -9
  24. package/lib/dialog/dialog.variable.css +7 -9
  25. package/lib/dialog/index.js +4 -4
  26. package/lib/directives/index.js +1 -1
  27. package/lib/divider/index.js +2 -3
  28. package/lib/dropdown/index.js +6 -8
  29. package/lib/exception/index.js +1 -1
  30. package/lib/fixed-navbar/index.js +2 -3
  31. package/lib/form/index.js +1 -1
  32. package/lib/icon/angle-double-down-line.js +1 -1
  33. package/lib/icon/angle-double-left-line.js +1 -1
  34. package/lib/icon/angle-double-left.js +1 -1
  35. package/lib/icon/angle-double-right-line.js +1 -1
  36. package/lib/icon/angle-double-right.js +1 -1
  37. package/lib/icon/angle-double-up-line.js +1 -1
  38. package/lib/icon/angle-down-fill.js +1 -1
  39. package/lib/icon/angle-down-line.js +1 -1
  40. package/lib/icon/angle-down.js +1 -1
  41. package/lib/icon/angle-left.js +1 -1
  42. package/lib/icon/angle-right.js +1 -1
  43. package/lib/icon/angle-up-fill.js +1 -1
  44. package/lib/icon/angle-up.js +1 -1
  45. package/lib/icon/archive-fill.js +1 -1
  46. package/lib/icon/arrows-left.js +1 -1
  47. package/lib/icon/arrows-right.js +1 -1
  48. package/lib/icon/assistant.js +1 -1
  49. package/lib/icon/audio-fill.js +1 -1
  50. package/lib/icon/bk.js +1 -1
  51. package/lib/icon/circle.js +1 -1
  52. package/lib/icon/close-line.js +1 -1
  53. package/lib/icon/close.js +1 -1
  54. package/lib/icon/code.js +1 -1
  55. package/lib/icon/cog-shape.js +1 -1
  56. package/lib/icon/collapse-left.js +1 -1
  57. package/lib/icon/copy-shape.js +1 -1
  58. package/lib/icon/copy.js +1 -1
  59. package/lib/icon/data-shape.js +1 -1
  60. package/lib/icon/del.js +1 -1
  61. package/lib/icon/doc-fill.js +1 -1
  62. package/lib/icon/done.js +1 -1
  63. package/lib/icon/down-shape.js +1 -1
  64. package/lib/icon/down-small.js +1 -1
  65. package/lib/icon/edit-line.js +1 -1
  66. package/lib/icon/ellipsis.js +1 -1
  67. package/lib/icon/enlarge-line.js +1 -1
  68. package/lib/icon/error.js +1 -1
  69. package/lib/icon/excel-fill.js +1 -1
  70. package/lib/icon/exclamation-circle-shape.js +1 -1
  71. package/lib/icon/eye.js +1 -1
  72. package/lib/icon/filliscreen-line.js +1 -1
  73. package/lib/icon/fix-line.js +1 -1
  74. package/lib/icon/fix-shape.js +1 -1
  75. package/lib/icon/folder-open.js +1 -1
  76. package/lib/icon/folder-shape-open.js +1 -1
  77. package/lib/icon/folder-shape.js +1 -1
  78. package/lib/icon/folder.js +1 -1
  79. package/lib/icon/funnel.js +1 -1
  80. package/lib/icon/grag-fill.js +1 -1
  81. package/lib/icon/help-document-fill.js +1 -1
  82. package/lib/icon/help-fill.js +1 -1
  83. package/lib/icon/help.js +1 -1
  84. package/lib/icon/image-fill.js +1 -1
  85. package/lib/icon/img-error.js +1 -1
  86. package/lib/icon/img-placehoulder.js +1 -1
  87. package/lib/icon/info-line.js +1 -1
  88. package/lib/icon/info.js +1 -1
  89. package/lib/icon/left-shape.js +1 -1
  90. package/lib/icon/left-turn-line.js +1 -1
  91. package/lib/icon/loading.js +1 -1
  92. package/lib/icon/narrow-line.js +1 -1
  93. package/lib/icon/original.js +1 -1
  94. package/lib/icon/pdf-fill.js +1 -1
  95. package/lib/icon/play-shape.js +1 -1
  96. package/lib/icon/plus.js +1 -1
  97. package/lib/icon/ppt-fill.js +1 -1
  98. package/lib/icon/qq.js +1 -1
  99. package/lib/icon/right-shape.js +1 -1
  100. package/lib/icon/right-turn-line.js +1 -1
  101. package/lib/icon/search.js +1 -1
  102. package/lib/icon/share.js +1 -1
  103. package/lib/icon/spinner.js +1 -1
  104. package/lib/icon/success.js +1 -1
  105. package/lib/icon/switcher-loading.js +1 -1
  106. package/lib/icon/text-all.js +1 -1
  107. package/lib/icon/text-file.js +1 -1
  108. package/lib/icon/text-fill.js +1 -1
  109. package/lib/icon/transfer.js +1 -1
  110. package/lib/icon/tree-application-shape.js +1 -1
  111. package/lib/icon/unfull-screen.js +1 -1
  112. package/lib/icon/unvisible.js +1 -1
  113. package/lib/icon/up-shape.js +1 -1
  114. package/lib/icon/upload.js +1 -1
  115. package/lib/icon/video-fill.js +1 -1
  116. package/lib/icon/warn.js +1 -1
  117. package/lib/icon/weixin-pro.js +1 -1
  118. package/lib/icon/weixin.js +1 -1
  119. package/lib/image/index.js +10 -11
  120. package/lib/info-box/index.js +5 -4
  121. package/lib/input/index.js +4 -4
  122. package/lib/link/index.js +2 -2
  123. package/lib/loading/index.js +11 -12
  124. package/lib/menu/index.js +2 -3
  125. package/lib/message/index.js +1 -1
  126. package/lib/modal/hooks.d.ts +1 -1
  127. package/lib/modal/index.d.ts +3 -0
  128. package/lib/modal/index.js +25 -26
  129. package/lib/modal/modal.css +7 -9
  130. package/lib/modal/modal.d.ts +1 -0
  131. package/lib/modal/modal.less +11 -18
  132. package/lib/modal/modal.variable.css +7 -9
  133. package/lib/navigation/index.js +7 -9
  134. package/lib/notify/index.js +1 -1
  135. package/lib/overflow-title/index.js +9 -10
  136. package/lib/pagination/index.js +1 -1
  137. package/lib/plugin-popover/index.js +26 -30
  138. package/lib/pop-confirm/index.js +4 -5
  139. package/lib/popover/index.js +26 -30
  140. package/lib/popover2/index.js +2 -2
  141. package/lib/process/index.js +4 -4
  142. package/lib/progress/index.js +5 -6
  143. package/lib/radio/index.js +6 -7
  144. package/lib/rate/index.js +1 -1
  145. package/lib/resize-layout/index.js +1 -1
  146. package/lib/search-select/index.d.ts +327 -12
  147. package/lib/search-select/index.js +630 -353
  148. package/lib/search-select/input.d.ts +6 -1
  149. package/lib/search-select/search-select.css +20 -6
  150. package/lib/search-select/search-select.d.ts +109 -4
  151. package/lib/search-select/search-select.less +16 -12
  152. package/lib/search-select/search-select.variable.css +20 -6
  153. package/lib/search-select/selected.d.ts +107 -5
  154. package/lib/search-select/utils.d.ts +13 -1
  155. package/lib/select/index.d.ts +56 -0
  156. package/lib/select/index.js +12 -7
  157. package/lib/select/select.css +19 -5
  158. package/lib/select/select.d.ts +22 -0
  159. package/lib/select/select.less +26 -6
  160. package/lib/select/select.variable.css +19 -5
  161. package/lib/select/selectTagInput.d.ts +7 -0
  162. package/lib/shared/index.js +5 -8
  163. package/lib/sideslider/index.js +4 -4
  164. package/lib/sideslider/sideslider.css +0 -5
  165. package/lib/sideslider/sideslider.less +8 -14
  166. package/lib/sideslider/sideslider.variable.css +0 -5
  167. package/lib/slider/index.js +19 -20
  168. package/lib/steps/index.js +4 -4
  169. package/lib/swiper/index.js +1 -1
  170. package/lib/switcher/index.js +1 -1
  171. package/lib/tab/index.js +3 -4
  172. package/lib/table/const.d.ts +1 -1
  173. package/lib/table/index.js +24 -26
  174. package/lib/table/plugins/use-fixed-column.d.ts +1 -1
  175. package/lib/table/table.css +42 -96
  176. package/lib/table/table.less +56 -41
  177. package/lib/table/table.variable.css +42 -96
  178. package/lib/table/use-render.d.ts +1 -1
  179. package/lib/table-column/index.js +2 -2
  180. package/lib/tag/index.js +1 -1
  181. package/lib/tag-input/index.js +3 -4
  182. package/lib/timeline/index.js +1 -0
  183. package/lib/tree/index.js +10 -12
  184. package/lib/tree/tree.css +2 -75
  185. package/lib/tree/tree.variable.css +2 -75
  186. package/lib/upload/index.d.ts +12 -0
  187. package/lib/upload/index.js +25 -34
  188. package/lib/upload/props.d.ts +3 -0
  189. package/lib/upload/upload-trigger.d.ts +6 -0
  190. package/lib/upload/upload.d.ts +6 -0
  191. package/lib/virtual-render/index.d.ts +0 -4
  192. package/lib/virtual-render/index.js +235 -2436
  193. package/lib/virtual-render/props.d.ts +0 -7
  194. package/lib/virtual-render/use-fix-top.d.ts +7 -2
  195. package/lib/virtual-render/v-virtual-render.d.ts +1 -2
  196. package/lib/virtual-render/virtual-render.css +2 -75
  197. package/lib/virtual-render/virtual-render.d.ts +0 -2
  198. package/lib/virtual-render/virtual-render.less +2 -2
  199. package/lib/virtual-render/virtual-render.variable.css +2 -75
  200. package/package.json +1 -5
  201. package/lib/virtual-render/bk-scrollbar.css +0 -74
  202. package/lib/virtual-render/bk-scrollbar.d.ts +0 -10
  203. package/lib/virtual-render/bk-scrollbar.less +0 -93
  204. package/lib/virtual-render/bk-scrollbar.variable.css +0 -203
  205. package/lib/virtual-render/scrollbar-core/can-use-dom.d.ts +0 -2
  206. package/lib/virtual-render/scrollbar-core/helpers.d.ts +0 -5
  207. package/lib/virtual-render/scrollbar-core/index.d.ts +0 -213
  208. package/lib/virtual-render/scrollbar-core/mouse-wheel.d.ts +0 -5
  209. package/lib/virtual-render/scrollbar-core/scrollbar-width.d.ts +0 -1
  210. package/lib/virtual-render/use-scrollbar.d.ts +0 -23
@@ -3,62 +3,11 @@ import "./virtual-render.less";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__ from "../shared";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__ from "../config-provider";
6
- import * as __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__ from "vue-types";
7
6
  import * as __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a__ from "lodash/throttle";
8
- /******/ var __webpack_modules__ = ({
9
-
10
- /***/ 9131:
11
- /***/ ((module) => {
12
-
13
- var canUseDOM = !!(
14
- typeof window !== 'undefined' &&
15
- window.document &&
16
- window.document.createElement
17
- );
18
-
19
- module.exports = canUseDOM;
20
-
21
- /***/ })
22
-
23
- /******/ });
24
- /************************************************************************/
25
- /******/ // The module cache
26
- /******/ var __webpack_module_cache__ = {};
27
- /******/
28
- /******/ // The require function
29
- /******/ function __webpack_require__(moduleId) {
30
- /******/ // Check if module is in cache
31
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
32
- /******/ if (cachedModule !== undefined) {
33
- /******/ return cachedModule.exports;
34
- /******/ }
35
- /******/ // Create a new module (and put it into the cache)
36
- /******/ var module = __webpack_module_cache__[moduleId] = {
37
- /******/ // no module.id needed
38
- /******/ // no module.loaded needed
39
- /******/ exports: {}
40
- /******/ };
41
- /******/
42
- /******/ // Execute the module function
43
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
44
- /******/
45
- /******/ // Return the exports of the module
46
- /******/ return module.exports;
47
- /******/ }
7
+ /******/ // The require scope
8
+ /******/ var __webpack_require__ = {};
48
9
  /******/
49
10
  /************************************************************************/
50
- /******/ /* webpack/runtime/compat get default export */
51
- /******/ (() => {
52
- /******/ // getDefaultExport function for compatibility with non-harmony modules
53
- /******/ __webpack_require__.n = (module) => {
54
- /******/ var getter = module && module.__esModule ?
55
- /******/ () => (module['default']) :
56
- /******/ () => (module);
57
- /******/ __webpack_require__.d(getter, { a: getter });
58
- /******/ return getter;
59
- /******/ };
60
- /******/ })();
61
- /******/
62
11
  /******/ /* webpack/runtime/define property getters */
63
12
  /******/ (() => {
64
13
  /******/ // define getter functions for harmony exports
@@ -76,38 +25,14 @@ module.exports = canUseDOM;
76
25
  /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
77
26
  /******/ })();
78
27
  /******/
79
- /******/ /* webpack/runtime/make namespace object */
80
- /******/ (() => {
81
- /******/ // define __esModule on exports
82
- /******/ __webpack_require__.r = (exports) => {
83
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
84
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
85
- /******/ }
86
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
87
- /******/ };
88
- /******/ })();
89
- /******/
90
28
  /************************************************************************/
91
29
  var __webpack_exports__ = {};
92
- // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
93
- (() => {
94
30
 
95
31
  // EXPORTS
96
32
  __webpack_require__.d(__webpack_exports__, {
97
33
  "default": () => (/* binding */ src)
98
34
  });
99
35
 
100
- // NAMESPACE OBJECT: ../../packages/virtual-render/src/scrollbar-core/helpers.ts
101
- var helpers_namespaceObject = {};
102
- __webpack_require__.r(helpers_namespaceObject);
103
- __webpack_require__.d(helpers_namespaceObject, {
104
- addClasses: () => (addClasses),
105
- classNamesToQuery: () => (classNamesToQuery),
106
- getElementDocument: () => (getElementDocument),
107
- getElementWindow: () => (getElementWindow),
108
- removeClasses: () => (removeClasses)
109
- });
110
-
111
36
  ;// CONCATENATED MODULE: external "../shared"
112
37
  var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
113
38
  var y = x => () => x
@@ -159,2198 +84,53 @@ function _typeof(o) {
159
84
  return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
160
85
  }, _typeof(o);
161
86
  }
162
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
163
-
164
- function toPrimitive(t, r) {
165
- if ("object" != _typeof(t) || !t) return t;
166
- var e = t[Symbol.toPrimitive];
167
- if (void 0 !== e) {
168
- var i = e.call(t, r || "default");
169
- if ("object" != _typeof(i)) return i;
170
- throw new TypeError("@@toPrimitive must return a primitive value.");
171
- }
172
- return ("string" === r ? String : Number)(t);
173
- }
174
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
175
-
176
-
177
- function toPropertyKey(t) {
178
- var i = toPrimitive(t, "string");
179
- return "symbol" == _typeof(i) ? i : String(i);
180
- }
181
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
182
-
183
- function _defineProperty(obj, key, value) {
184
- key = toPropertyKey(key);
185
- if (key in obj) {
186
- Object.defineProperty(obj, key, {
187
- value: value,
188
- enumerable: true,
189
- configurable: true,
190
- writable: true
191
- });
192
- } else {
193
- obj[key] = value;
194
- }
195
- return obj;
196
- }
197
- ;// CONCATENATED MODULE: external "vue"
198
- var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
199
- var external_vue_y = x => () => x
200
- const external_vue_namespaceObject = external_vue_x({ ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["h"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.h, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["onUnmounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch });
201
- ;// CONCATENATED MODULE: external "../config-provider"
202
- var config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
203
- var config_provider_y = x => () => x
204
- const config_provider_namespaceObject = config_provider_x({ ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__.usePrefix });
205
- ;// CONCATENATED MODULE: external "vue-types"
206
- var external_vue_types_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
207
- var external_vue_types_y = x => () => x
208
- const external_vue_types_namespaceObject = external_vue_types_x({ ["toType"]: () => __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__.toType });
209
- ;// CONCATENATED MODULE: ../../packages/virtual-render/src/props.ts
210
-
211
- 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; }
212
- 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; }
213
- /*
214
- * Tencent is pleased to support the open source community by making
215
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
216
- *
217
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
218
- *
219
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
220
- *
221
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
222
- *
223
- * ---------------------------------------------------
224
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
225
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
226
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
227
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
228
- *
229
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
230
- * the Software.
231
- *
232
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
233
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
234
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
235
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
236
- * IN THE SOFTWARE.
237
- */
238
-
239
-
240
- var EventProps = {
241
- onContentScroll: Function
242
- };
243
- var virtualRenderProps = _objectSpread({
244
- /** 传入原始数据源 */
245
- list: shared_namespaceObject.PropTypes.array.def([]),
246
- /**
247
- * 是否启用此功能
248
- * 如果设置为false,则此组件只会渲染两层指定的 容器,默认渲染两层 div
249
- * 设置为true才会启用所有的虚拟渲染 & 滚动相关计算
250
- * 此属性设置为了兼容需要按需开启\关闭虚拟渲染场景,避免外层设计两套样式架构
251
- * Note: 目前此属性不支持动态修改
252
- */
253
- enabled: shared_namespaceObject.PropTypes.bool.def(true),
254
- /**
255
- * 是否启用内置的Scroll Listener
256
- * 当启用虚拟滚动时(enabled = true),滚动监听为内置生效
257
- * 只有当(enabled = false)时此配置项才生效
258
- */
259
- scrollEvent: shared_namespaceObject.PropTypes.bool.def(false),
260
- /**
261
- * 每行数据高度
262
- * 默认为数值类型,默认高度 30px
263
- * 如果每行高度不一致,可为回调函数:(index: number, row: any[]): number => {}
264
- * 函数参数为当前行index & 当前行数据 row,row为数组,当不分组时,为当前行item
265
- * 如果有分组展示, index 为当前分组 index, row为数组,当前行分组所有 item 数据
266
- */
267
- lineHeight: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.number, shared_namespaceObject.PropTypes.func]).def(30),
268
- /** 整体最小高度 */
269
- minHeight: shared_namespaceObject.PropTypes.number.def(30),
270
- /** 整体最大高度 */
271
- maxHeight: shared_namespaceObject.PropTypes.number,
272
- /**
273
- * 整体高度
274
- * 可设置具体值,如果设置为 100%,则组件会自动计算外层DOM元素offsetHeight,用于计算可渲染行数
275
- */
276
- height: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string.def('100%'), shared_namespaceObject.PropTypes.number]).def('100%'),
277
- /**
278
- * 渲染区域宽度
279
- * 如果设置 100% 则自适应外层元素宽度
280
- */
281
- width: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string.def('100%'), shared_namespaceObject.PropTypes.number]).def('100%'),
282
- /** 最外层元素ClassName */
283
- className: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.string), shared_namespaceObject.PropTypes.object, shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.object), shared_namespaceObject.PropTypes.string]).def(''),
284
- /** 内层层元素ClassName */
285
- contentClassName: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.string), shared_namespaceObject.PropTypes.object, shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.object), shared_namespaceObject.PropTypes.string]).def(''),
286
- /** 内层元素样式 */
287
- contentStyle: shared_namespaceObject.PropTypes.object.def({}),
288
- /** 用于自定义X轴滚动条样式 */
289
- scrollXName: shared_namespaceObject.PropTypes.string.def((0,shared_namespaceObject.resolveClassName)('F-scroll-x')),
290
- /** 用于自定义Y轴滚动条样式 */
291
- scrollYName: shared_namespaceObject.PropTypes.string.def((0,shared_namespaceObject.resolveClassName)('F-scroll-y')),
292
- /** 分组展示,一行数据可能有多条数据 */
293
- groupItemCount: shared_namespaceObject.PropTypes.number.def(1),
294
- /** 预加载行数,避免空白渲染 */
295
- preloadItemCount: shared_namespaceObject.PropTypes.number.def(1),
296
- /** 外层Dom元素需要渲染成的目标元素 */
297
- renderAs: shared_namespaceObject.PropTypes.string.def('div'),
298
- /** 内容层渲染成目标元素 */
299
- contentAs: shared_namespaceObject.PropTypes.string.def('div'),
300
- /** top 滚动填充 */
301
- scrollOffsetTop: shared_namespaceObject.PropTypes.number.def(0),
302
- /**
303
- * 内置滚动位置
304
- * 可选:container (最外层容器),content(内容层容器)
305
- * Note: container 慎选,需要自己处理样式 & 位置
306
- */
307
- scrollPosition: shared_namespaceObject.PropTypes.string.def('content'),
308
- /**
309
- * 绝对高度 | 实际高估
310
- * 可选值: auto(根据行高和行数计算, LineHeight * List.length) number(外层给定高度,若为0,则不显示)
311
- */
312
- abosuteHeight: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string.def('auto'), shared_namespaceObject.PropTypes.number]).def('auto'),
313
- /**
314
- * 滚动刷新计算间隔时间
315
- * 默认60 ms
316
- */
317
- throttleDelay: shared_namespaceObject.PropTypes.number.def(60),
318
- rowKey: shared_namespaceObject.PropTypes.string.def(undefined),
319
- /**
320
- * 数据改变时是否保持之前的状态
321
- * 保持滚动条位置、当前渲染区间
322
- */
323
- keepAlive: shared_namespaceObject.PropTypes.bool.def(false),
324
- /**
325
- * 是否允许滚动条改变原有DOM结构
326
- */
327
- scrollbar: (0,external_vue_types_namespaceObject.toType)('IScrollbarOption', {
328
- "default": {
329
- enabled: false
330
- }
331
- }),
332
- /**
333
- * 数据监听改变时,是否自动重置位置到[0, 0]
334
- */
335
- autoReset: shared_namespaceObject.PropTypes.bool.def(true),
336
- wrapperStyle: shared_namespaceObject.PropTypes.any.def({})
337
- }, EventProps);
338
- ;// CONCATENATED MODULE: ../../packages/virtual-render/src/use-fix-top.tsx
339
- /*
340
- * Tencent is pleased to support the open source community by making
341
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
342
- *
343
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
344
- *
345
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
346
- *
347
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
348
- *
349
- * ---------------------------------------------------
350
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
351
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
352
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
353
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
354
- *
355
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
356
- * the Software.
357
- *
358
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
359
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
360
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
361
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
362
- * IN THE SOFTWARE.
363
- */
364
- /* harmony default export */ const use_fix_top = (function (props, scrollTo) {
365
- /**
366
- * 指定元素滚动到顶部
367
- * @param param0
368
- */
369
- var fixToTop = function fixToTop(params) {
370
- var id = params.id,
371
- index = params.index,
372
- item = params.item;
373
- var targetIndex = typeof index === 'number' ? index - 1 : 0;
374
- if (id !== undefined) {
375
- var _props$list$findIndex;
376
- targetIndex = (_props$list$findIndex = props.list.findIndex(function (row) {
377
- return row[props.rowKey] === id;
378
- })) !== null && _props$list$findIndex !== void 0 ? _props$list$findIndex : targetIndex;
379
- }
380
- if (item !== undefined) {
381
- var _props$list$findIndex2;
382
- targetIndex = (_props$list$findIndex2 = props.list.findIndex(function (row) {
383
- return item[props.rowKey] === row[props.rowKey];
384
- })) !== null && _props$list$findIndex2 !== void 0 ? _props$list$findIndex2 : targetIndex;
385
- }
386
- if (typeof targetIndex === 'number') {
387
- var resolvedIndex = targetIndex >= 0 ? targetIndex : 0;
388
- var offsetY = resolvedIndex * props.lineHeight;
389
- scrollTo(0, offsetY);
390
- }
391
- return null;
392
- };
393
- return {
394
- fixToTop: fixToTop
395
- };
396
- });
397
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
398
- function _classCallCheck(instance, Constructor) {
399
- if (!(instance instanceof Constructor)) {
400
- throw new TypeError("Cannot call a class as a function");
401
- }
402
- }
403
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/createClass.js
404
-
405
- function _defineProperties(target, props) {
406
- for (var i = 0; i < props.length; i++) {
407
- var descriptor = props[i];
408
- descriptor.enumerable = descriptor.enumerable || false;
409
- descriptor.configurable = true;
410
- if ("value" in descriptor) descriptor.writable = true;
411
- Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
412
- }
413
- }
414
- function _createClass(Constructor, protoProps, staticProps) {
415
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
416
- if (staticProps) _defineProperties(Constructor, staticProps);
417
- Object.defineProperty(Constructor, "prototype", {
418
- writable: false
419
- });
420
- return Constructor;
421
- }
422
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
423
- function _assertThisInitialized(self) {
424
- if (self === void 0) {
425
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
426
- }
427
- return self;
428
- }
429
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/possibleConstructorReturn.js
430
-
431
-
432
- function _possibleConstructorReturn(self, call) {
433
- if (call && (_typeof(call) === "object" || typeof call === "function")) {
434
- return call;
435
- } else if (call !== void 0) {
436
- throw new TypeError("Derived constructors may only return object or undefined");
437
- }
438
- return _assertThisInitialized(self);
439
- }
440
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
441
- function _getPrototypeOf(o) {
442
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
443
- return o.__proto__ || Object.getPrototypeOf(o);
444
- };
445
- return _getPrototypeOf(o);
446
- }
447
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
448
- function _setPrototypeOf(o, p) {
449
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
450
- o.__proto__ = p;
451
- return o;
452
- };
453
- return _setPrototypeOf(o, p);
454
- }
455
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/inherits.js
456
-
457
- function _inherits(subClass, superClass) {
458
- if (typeof superClass !== "function" && superClass !== null) {
459
- throw new TypeError("Super expression must either be null or a function");
460
- }
461
- subClass.prototype = Object.create(superClass && superClass.prototype, {
462
- constructor: {
463
- value: subClass,
464
- writable: true,
465
- configurable: true
466
- }
467
- });
468
- Object.defineProperty(subClass, "prototype", {
469
- writable: false
470
- });
471
- if (superClass) _setPrototypeOf(subClass, superClass);
472
- }
473
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/arrayWithHoles.js
474
- function _arrayWithHoles(arr) {
475
- if (Array.isArray(arr)) return arr;
476
- }
477
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/iterableToArrayLimit.js
478
- function _iterableToArrayLimit(r, l) {
479
- var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
480
- if (null != t) {
481
- var e,
482
- n,
483
- i,
484
- u,
485
- a = [],
486
- f = !0,
487
- o = !1;
488
- try {
489
- if (i = (t = t.call(r)).next, 0 === l) {
490
- if (Object(t) !== t) return;
491
- f = !1;
492
- } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
493
- } catch (r) {
494
- o = !0, n = r;
495
- } finally {
496
- try {
497
- if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return;
498
- } finally {
499
- if (o) throw n;
500
- }
501
- }
502
- return a;
503
- }
504
- }
505
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
506
- function _nonIterableRest() {
507
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
508
- }
509
- ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js
510
-
511
-
512
-
513
-
514
- function _slicedToArray(arr, i) {
515
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
516
- }
517
- // EXTERNAL MODULE: ../../node_modules/can-use-dom/index.js
518
- var can_use_dom = __webpack_require__(9131);
519
- var can_use_dom_default = /*#__PURE__*/__webpack_require__.n(can_use_dom);
520
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/isObject.js
521
- /**
522
- * Checks if `value` is the
523
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
524
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
525
- *
526
- * @static
527
- * @memberOf _
528
- * @since 0.1.0
529
- * @category Lang
530
- * @param {*} value The value to check.
531
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
532
- * @example
533
- *
534
- * _.isObject({});
535
- * // => true
536
- *
537
- * _.isObject([1, 2, 3]);
538
- * // => true
539
- *
540
- * _.isObject(_.noop);
541
- * // => true
542
- *
543
- * _.isObject(null);
544
- * // => false
545
- */
546
- function isObject(value) {
547
- var type = typeof value;
548
- return value != null && (type == 'object' || type == 'function');
549
- }
550
-
551
- /* harmony default export */ const lodash_es_isObject = (isObject);
552
-
553
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/_freeGlobal.js
554
- /** Detect free variable `global` from Node.js. */
555
- var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
556
-
557
- /* harmony default export */ const _freeGlobal = (freeGlobal);
558
-
559
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/_root.js
560
-
561
-
562
- /** Detect free variable `self`. */
563
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
564
-
565
- /** Used as a reference to the global object. */
566
- var root = _freeGlobal || freeSelf || Function('return this')();
567
-
568
- /* harmony default export */ const _root = (root);
569
-
570
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/now.js
571
-
572
-
573
- /**
574
- * Gets the timestamp of the number of milliseconds that have elapsed since
575
- * the Unix epoch (1 January 1970 00:00:00 UTC).
576
- *
577
- * @static
578
- * @memberOf _
579
- * @since 2.4.0
580
- * @category Date
581
- * @returns {number} Returns the timestamp.
582
- * @example
583
- *
584
- * _.defer(function(stamp) {
585
- * console.log(_.now() - stamp);
586
- * }, _.now());
587
- * // => Logs the number of milliseconds it took for the deferred invocation.
588
- */
589
- var now = function() {
590
- return _root.Date.now();
591
- };
592
-
593
- /* harmony default export */ const lodash_es_now = (now);
594
-
595
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/_trimmedEndIndex.js
596
- /** Used to match a single whitespace character. */
597
- var reWhitespace = /\s/;
598
-
599
- /**
600
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
601
- * character of `string`.
602
- *
603
- * @private
604
- * @param {string} string The string to inspect.
605
- * @returns {number} Returns the index of the last non-whitespace character.
606
- */
607
- function trimmedEndIndex(string) {
608
- var index = string.length;
609
-
610
- while (index-- && reWhitespace.test(string.charAt(index))) {}
611
- return index;
612
- }
613
-
614
- /* harmony default export */ const _trimmedEndIndex = (trimmedEndIndex);
615
-
616
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/_baseTrim.js
617
-
618
-
619
- /** Used to match leading whitespace. */
620
- var reTrimStart = /^\s+/;
621
-
622
- /**
623
- * The base implementation of `_.trim`.
624
- *
625
- * @private
626
- * @param {string} string The string to trim.
627
- * @returns {string} Returns the trimmed string.
628
- */
629
- function baseTrim(string) {
630
- return string
631
- ? string.slice(0, _trimmedEndIndex(string) + 1).replace(reTrimStart, '')
632
- : string;
633
- }
634
-
635
- /* harmony default export */ const _baseTrim = (baseTrim);
636
-
637
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/_Symbol.js
638
-
639
-
640
- /** Built-in value references. */
641
- var _Symbol_Symbol = _root.Symbol;
642
-
643
- /* harmony default export */ const _Symbol = (_Symbol_Symbol);
644
-
645
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/_getRawTag.js
646
-
647
-
648
- /** Used for built-in method references. */
649
- var objectProto = Object.prototype;
650
-
651
- /** Used to check objects for own properties. */
652
- var _getRawTag_hasOwnProperty = objectProto.hasOwnProperty;
653
-
654
- /**
655
- * Used to resolve the
656
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
657
- * of values.
658
- */
659
- var nativeObjectToString = objectProto.toString;
660
-
661
- /** Built-in value references. */
662
- var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
663
-
664
- /**
665
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
666
- *
667
- * @private
668
- * @param {*} value The value to query.
669
- * @returns {string} Returns the raw `toStringTag`.
670
- */
671
- function getRawTag(value) {
672
- var isOwn = _getRawTag_hasOwnProperty.call(value, symToStringTag),
673
- tag = value[symToStringTag];
674
-
675
- try {
676
- value[symToStringTag] = undefined;
677
- var unmasked = true;
678
- } catch (e) {}
679
-
680
- var result = nativeObjectToString.call(value);
681
- if (unmasked) {
682
- if (isOwn) {
683
- value[symToStringTag] = tag;
684
- } else {
685
- delete value[symToStringTag];
686
- }
687
- }
688
- return result;
689
- }
690
-
691
- /* harmony default export */ const _getRawTag = (getRawTag);
692
-
693
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/_objectToString.js
694
- /** Used for built-in method references. */
695
- var _objectToString_objectProto = Object.prototype;
696
-
697
- /**
698
- * Used to resolve the
699
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
700
- * of values.
701
- */
702
- var _objectToString_nativeObjectToString = _objectToString_objectProto.toString;
703
-
704
- /**
705
- * Converts `value` to a string using `Object.prototype.toString`.
706
- *
707
- * @private
708
- * @param {*} value The value to convert.
709
- * @returns {string} Returns the converted string.
710
- */
711
- function objectToString(value) {
712
- return _objectToString_nativeObjectToString.call(value);
713
- }
714
-
715
- /* harmony default export */ const _objectToString = (objectToString);
716
-
717
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/_baseGetTag.js
718
-
719
-
720
-
721
-
722
- /** `Object#toString` result references. */
723
- var nullTag = '[object Null]',
724
- undefinedTag = '[object Undefined]';
725
-
726
- /** Built-in value references. */
727
- var _baseGetTag_symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
728
-
729
- /**
730
- * The base implementation of `getTag` without fallbacks for buggy environments.
731
- *
732
- * @private
733
- * @param {*} value The value to query.
734
- * @returns {string} Returns the `toStringTag`.
735
- */
736
- function baseGetTag(value) {
737
- if (value == null) {
738
- return value === undefined ? undefinedTag : nullTag;
739
- }
740
- return (_baseGetTag_symToStringTag && _baseGetTag_symToStringTag in Object(value))
741
- ? _getRawTag(value)
742
- : _objectToString(value);
743
- }
744
-
745
- /* harmony default export */ const _baseGetTag = (baseGetTag);
746
-
747
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/isObjectLike.js
748
- /**
749
- * Checks if `value` is object-like. A value is object-like if it's not `null`
750
- * and has a `typeof` result of "object".
751
- *
752
- * @static
753
- * @memberOf _
754
- * @since 4.0.0
755
- * @category Lang
756
- * @param {*} value The value to check.
757
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
758
- * @example
759
- *
760
- * _.isObjectLike({});
761
- * // => true
762
- *
763
- * _.isObjectLike([1, 2, 3]);
764
- * // => true
765
- *
766
- * _.isObjectLike(_.noop);
767
- * // => false
768
- *
769
- * _.isObjectLike(null);
770
- * // => false
771
- */
772
- function isObjectLike(value) {
773
- return value != null && typeof value == 'object';
774
- }
775
-
776
- /* harmony default export */ const lodash_es_isObjectLike = (isObjectLike);
777
-
778
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/isSymbol.js
779
-
780
-
781
-
782
- /** `Object#toString` result references. */
783
- var symbolTag = '[object Symbol]';
784
-
785
- /**
786
- * Checks if `value` is classified as a `Symbol` primitive or object.
787
- *
788
- * @static
789
- * @memberOf _
790
- * @since 4.0.0
791
- * @category Lang
792
- * @param {*} value The value to check.
793
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
794
- * @example
795
- *
796
- * _.isSymbol(Symbol.iterator);
797
- * // => true
798
- *
799
- * _.isSymbol('abc');
800
- * // => false
801
- */
802
- function isSymbol(value) {
803
- return typeof value == 'symbol' ||
804
- (lodash_es_isObjectLike(value) && _baseGetTag(value) == symbolTag);
805
- }
806
-
807
- /* harmony default export */ const lodash_es_isSymbol = (isSymbol);
808
-
809
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/toNumber.js
810
-
811
-
812
-
813
-
814
- /** Used as references for various `Number` constants. */
815
- var NAN = 0 / 0;
816
-
817
- /** Used to detect bad signed hexadecimal string values. */
818
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
819
-
820
- /** Used to detect binary string values. */
821
- var reIsBinary = /^0b[01]+$/i;
822
-
823
- /** Used to detect octal string values. */
824
- var reIsOctal = /^0o[0-7]+$/i;
825
-
826
- /** Built-in method references without a dependency on `root`. */
827
- var freeParseInt = parseInt;
828
-
829
- /**
830
- * Converts `value` to a number.
831
- *
832
- * @static
833
- * @memberOf _
834
- * @since 4.0.0
835
- * @category Lang
836
- * @param {*} value The value to process.
837
- * @returns {number} Returns the number.
838
- * @example
839
- *
840
- * _.toNumber(3.2);
841
- * // => 3.2
842
- *
843
- * _.toNumber(Number.MIN_VALUE);
844
- * // => 5e-324
845
- *
846
- * _.toNumber(Infinity);
847
- * // => Infinity
848
- *
849
- * _.toNumber('3.2');
850
- * // => 3.2
851
- */
852
- function toNumber(value) {
853
- if (typeof value == 'number') {
854
- return value;
855
- }
856
- if (lodash_es_isSymbol(value)) {
857
- return NAN;
858
- }
859
- if (lodash_es_isObject(value)) {
860
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
861
- value = lodash_es_isObject(other) ? (other + '') : other;
862
- }
863
- if (typeof value != 'string') {
864
- return value === 0 ? value : +value;
865
- }
866
- value = _baseTrim(value);
867
- var isBinary = reIsBinary.test(value);
868
- return (isBinary || reIsOctal.test(value))
869
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
870
- : (reIsBadHex.test(value) ? NAN : +value);
871
- }
872
-
873
- /* harmony default export */ const lodash_es_toNumber = (toNumber);
874
-
875
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/debounce.js
876
-
877
-
878
-
879
-
880
- /** Error message constants. */
881
- var FUNC_ERROR_TEXT = 'Expected a function';
882
-
883
- /* Built-in method references for those with the same name as other `lodash` methods. */
884
- var nativeMax = Math.max,
885
- nativeMin = Math.min;
886
-
887
- /**
888
- * Creates a debounced function that delays invoking `func` until after `wait`
889
- * milliseconds have elapsed since the last time the debounced function was
890
- * invoked. The debounced function comes with a `cancel` method to cancel
891
- * delayed `func` invocations and a `flush` method to immediately invoke them.
892
- * Provide `options` to indicate whether `func` should be invoked on the
893
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
894
- * with the last arguments provided to the debounced function. Subsequent
895
- * calls to the debounced function return the result of the last `func`
896
- * invocation.
897
- *
898
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
899
- * invoked on the trailing edge of the timeout only if the debounced function
900
- * is invoked more than once during the `wait` timeout.
901
- *
902
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
903
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
904
- *
905
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
906
- * for details over the differences between `_.debounce` and `_.throttle`.
907
- *
908
- * @static
909
- * @memberOf _
910
- * @since 0.1.0
911
- * @category Function
912
- * @param {Function} func The function to debounce.
913
- * @param {number} [wait=0] The number of milliseconds to delay.
914
- * @param {Object} [options={}] The options object.
915
- * @param {boolean} [options.leading=false]
916
- * Specify invoking on the leading edge of the timeout.
917
- * @param {number} [options.maxWait]
918
- * The maximum time `func` is allowed to be delayed before it's invoked.
919
- * @param {boolean} [options.trailing=true]
920
- * Specify invoking on the trailing edge of the timeout.
921
- * @returns {Function} Returns the new debounced function.
922
- * @example
923
- *
924
- * // Avoid costly calculations while the window size is in flux.
925
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
926
- *
927
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
928
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
929
- * 'leading': true,
930
- * 'trailing': false
931
- * }));
932
- *
933
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
934
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
935
- * var source = new EventSource('/stream');
936
- * jQuery(source).on('message', debounced);
937
- *
938
- * // Cancel the trailing debounced invocation.
939
- * jQuery(window).on('popstate', debounced.cancel);
940
- */
941
- function debounce(func, wait, options) {
942
- var lastArgs,
943
- lastThis,
944
- maxWait,
945
- result,
946
- timerId,
947
- lastCallTime,
948
- lastInvokeTime = 0,
949
- leading = false,
950
- maxing = false,
951
- trailing = true;
952
-
953
- if (typeof func != 'function') {
954
- throw new TypeError(FUNC_ERROR_TEXT);
955
- }
956
- wait = lodash_es_toNumber(wait) || 0;
957
- if (lodash_es_isObject(options)) {
958
- leading = !!options.leading;
959
- maxing = 'maxWait' in options;
960
- maxWait = maxing ? nativeMax(lodash_es_toNumber(options.maxWait) || 0, wait) : maxWait;
961
- trailing = 'trailing' in options ? !!options.trailing : trailing;
962
- }
963
-
964
- function invokeFunc(time) {
965
- var args = lastArgs,
966
- thisArg = lastThis;
967
-
968
- lastArgs = lastThis = undefined;
969
- lastInvokeTime = time;
970
- result = func.apply(thisArg, args);
971
- return result;
972
- }
973
-
974
- function leadingEdge(time) {
975
- // Reset any `maxWait` timer.
976
- lastInvokeTime = time;
977
- // Start the timer for the trailing edge.
978
- timerId = setTimeout(timerExpired, wait);
979
- // Invoke the leading edge.
980
- return leading ? invokeFunc(time) : result;
981
- }
982
-
983
- function remainingWait(time) {
984
- var timeSinceLastCall = time - lastCallTime,
985
- timeSinceLastInvoke = time - lastInvokeTime,
986
- timeWaiting = wait - timeSinceLastCall;
987
-
988
- return maxing
989
- ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
990
- : timeWaiting;
991
- }
992
-
993
- function shouldInvoke(time) {
994
- var timeSinceLastCall = time - lastCallTime,
995
- timeSinceLastInvoke = time - lastInvokeTime;
996
-
997
- // Either this is the first call, activity has stopped and we're at the
998
- // trailing edge, the system time has gone backwards and we're treating
999
- // it as the trailing edge, or we've hit the `maxWait` limit.
1000
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
1001
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
1002
- }
1003
-
1004
- function timerExpired() {
1005
- var time = lodash_es_now();
1006
- if (shouldInvoke(time)) {
1007
- return trailingEdge(time);
1008
- }
1009
- // Restart the timer.
1010
- timerId = setTimeout(timerExpired, remainingWait(time));
1011
- }
1012
-
1013
- function trailingEdge(time) {
1014
- timerId = undefined;
1015
-
1016
- // Only invoke if we have `lastArgs` which means `func` has been
1017
- // debounced at least once.
1018
- if (trailing && lastArgs) {
1019
- return invokeFunc(time);
1020
- }
1021
- lastArgs = lastThis = undefined;
1022
- return result;
1023
- }
1024
-
1025
- function cancel() {
1026
- if (timerId !== undefined) {
1027
- clearTimeout(timerId);
1028
- }
1029
- lastInvokeTime = 0;
1030
- lastArgs = lastCallTime = lastThis = timerId = undefined;
1031
- }
1032
-
1033
- function flush() {
1034
- return timerId === undefined ? result : trailingEdge(lodash_es_now());
1035
- }
1036
-
1037
- function debounced() {
1038
- var time = lodash_es_now(),
1039
- isInvoking = shouldInvoke(time);
1040
-
1041
- lastArgs = arguments;
1042
- lastThis = this;
1043
- lastCallTime = time;
1044
-
1045
- if (isInvoking) {
1046
- if (timerId === undefined) {
1047
- return leadingEdge(lastCallTime);
1048
- }
1049
- if (maxing) {
1050
- // Handle invocations in a tight loop.
1051
- clearTimeout(timerId);
1052
- timerId = setTimeout(timerExpired, wait);
1053
- return invokeFunc(lastCallTime);
1054
- }
1055
- }
1056
- if (timerId === undefined) {
1057
- timerId = setTimeout(timerExpired, wait);
1058
- }
1059
- return result;
1060
- }
1061
- debounced.cancel = cancel;
1062
- debounced.flush = flush;
1063
- return debounced;
1064
- }
1065
-
1066
- /* harmony default export */ const lodash_es_debounce = (debounce);
1067
-
1068
- ;// CONCATENATED MODULE: ../../node_modules/lodash-es/throttle.js
1069
-
1070
-
1071
-
1072
- /** Error message constants. */
1073
- var throttle_FUNC_ERROR_TEXT = 'Expected a function';
1074
-
1075
- /**
1076
- * Creates a throttled function that only invokes `func` at most once per
1077
- * every `wait` milliseconds. The throttled function comes with a `cancel`
1078
- * method to cancel delayed `func` invocations and a `flush` method to
1079
- * immediately invoke them. Provide `options` to indicate whether `func`
1080
- * should be invoked on the leading and/or trailing edge of the `wait`
1081
- * timeout. The `func` is invoked with the last arguments provided to the
1082
- * throttled function. Subsequent calls to the throttled function return the
1083
- * result of the last `func` invocation.
1084
- *
1085
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
1086
- * invoked on the trailing edge of the timeout only if the throttled function
1087
- * is invoked more than once during the `wait` timeout.
1088
- *
1089
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
1090
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
1091
- *
1092
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
1093
- * for details over the differences between `_.throttle` and `_.debounce`.
1094
- *
1095
- * @static
1096
- * @memberOf _
1097
- * @since 0.1.0
1098
- * @category Function
1099
- * @param {Function} func The function to throttle.
1100
- * @param {number} [wait=0] The number of milliseconds to throttle invocations to.
1101
- * @param {Object} [options={}] The options object.
1102
- * @param {boolean} [options.leading=true]
1103
- * Specify invoking on the leading edge of the timeout.
1104
- * @param {boolean} [options.trailing=true]
1105
- * Specify invoking on the trailing edge of the timeout.
1106
- * @returns {Function} Returns the new throttled function.
1107
- * @example
1108
- *
1109
- * // Avoid excessively updating the position while scrolling.
1110
- * jQuery(window).on('scroll', _.throttle(updatePosition, 100));
1111
- *
1112
- * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
1113
- * var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
1114
- * jQuery(element).on('click', throttled);
1115
- *
1116
- * // Cancel the trailing throttled invocation.
1117
- * jQuery(window).on('popstate', throttled.cancel);
1118
- */
1119
- function throttle(func, wait, options) {
1120
- var leading = true,
1121
- trailing = true;
1122
-
1123
- if (typeof func != 'function') {
1124
- throw new TypeError(throttle_FUNC_ERROR_TEXT);
1125
- }
1126
- if (lodash_es_isObject(options)) {
1127
- leading = 'leading' in options ? !!options.leading : leading;
1128
- trailing = 'trailing' in options ? !!options.trailing : trailing;
1129
- }
1130
- return lodash_es_debounce(func, wait, {
1131
- 'leading': leading,
1132
- 'maxWait': wait,
1133
- 'trailing': trailing
1134
- });
1135
- }
1136
-
1137
- /* harmony default export */ const lodash_es_throttle = (throttle);
1138
-
1139
- ;// CONCATENATED MODULE: ../../packages/virtual-render/src/scrollbar-core/helpers.ts
1140
-
1141
- /*
1142
- * Tencent is pleased to support the open source community by making
1143
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1144
- *
1145
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1146
- *
1147
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1148
- *
1149
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1150
- *
1151
- * ---------------------------------------------------
1152
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1153
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1154
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1155
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1156
- *
1157
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1158
- * the Software.
1159
- *
1160
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1161
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1162
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1163
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1164
- * IN THE SOFTWARE.
1165
- */
1166
- function getElementWindow(element) {
1167
- var _element$ownerDocumen, _element$ownerDocumen2;
1168
- return (_element$ownerDocumen = element === null || element === void 0 || (_element$ownerDocumen2 = element.ownerDocument) === null || _element$ownerDocumen2 === void 0 ? void 0 : _element$ownerDocumen2.defaultView) !== null && _element$ownerDocumen !== void 0 ? _element$ownerDocumen : window;
1169
- }
1170
- function getElementDocument(element) {
1171
- var _element$ownerDocumen3;
1172
- return (_element$ownerDocumen3 = element === null || element === void 0 ? void 0 : element.ownerDocument) !== null && _element$ownerDocumen3 !== void 0 ? _element$ownerDocumen3 : document;
1173
- }
1174
- function addClasses(el, classes) {
1175
- var _el$classList;
1176
- if (!el) return;
1177
- (_el$classList = el.classList).add.apply(_el$classList, _toConsumableArray(classes.split(' ')));
1178
- }
1179
- function removeClasses(el, classes) {
1180
- if (!el) return;
1181
- classes.split(' ').forEach(function (className) {
1182
- el.classList.remove(className);
1183
- });
1184
- }
1185
- function classNamesToQuery(classNames) {
1186
- return ".".concat(classNames.split(' ').join('.'));
1187
- }
1188
- ;// CONCATENATED MODULE: ../../packages/virtual-render/src/scrollbar-core/mouse-wheel.ts
1189
- /*
1190
- * Tencent is pleased to support the open source community by making
1191
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1192
- *
1193
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1194
- *
1195
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1196
- *
1197
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1198
- *
1199
- * ---------------------------------------------------
1200
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1201
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1202
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1203
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1204
- *
1205
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1206
- * the Software.
1207
- *
1208
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1209
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1210
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1211
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1212
- * IN THE SOFTWARE.
1213
- */
1214
- /* harmony default export */ const mouse_wheel = (function (fn) {
1215
- var DELTA_SCALE = {
1216
- STANDARD: 1,
1217
- OTHERS: -3
1218
- };
1219
- var DELTA_MODE = [1.0, 28.0, 500.0];
1220
- var getDeltaMode = function getDeltaMode(mode) {
1221
- return DELTA_MODE[mode] || DELTA_MODE[0];
1222
- };
1223
- var normalizeDelta = function normalizeDelta(evt) {
1224
- if ('deltaX' in evt) {
1225
- var mode = getDeltaMode(evt.deltaMode);
1226
- return {
1227
- x: evt.deltaX / DELTA_SCALE.STANDARD * mode,
1228
- y: evt.deltaY / DELTA_SCALE.STANDARD * mode,
1229
- evt: evt
1230
- };
1231
- }
1232
- if ('wheelDeltaX' in evt) {
1233
- return {
1234
- x: evt.wheelDeltaX / DELTA_SCALE.OTHERS,
1235
- y: evt.wheelDeltaY / DELTA_SCALE.OTHERS,
1236
- evt: evt
1237
- };
1238
- }
1239
- // ie with touchpad
1240
- return {
1241
- x: 0,
1242
- y: evt.wheelDelta / DELTA_SCALE.OTHERS,
1243
- evt: evt
1244
- };
1245
- };
1246
- var eventName = 'onwheel' in window || document.implementation.hasFeature('Events.wheel', '3.0') ? 'wheel' : 'mousewheel';
1247
- var resolveEventResponse = function resolveEventResponse(e) {
1248
- fn(normalizeDelta(e));
1249
- };
1250
- var addWheelEvent = function addWheelEvent(target) {
1251
- target.addEventListener(eventName, resolveEventResponse);
1252
- };
1253
- var removeWheelEvent = function removeWheelEvent(target) {
1254
- target.removeEventListener(eventName, resolveEventResponse);
1255
- };
1256
- return {
1257
- addWheelEvent: addWheelEvent,
1258
- removeWheelEvent: removeWheelEvent
1259
- };
1260
- });
1261
- ;// CONCATENATED MODULE: ../../packages/virtual-render/src/scrollbar-core/can-use-dom.ts
1262
- /*
1263
- * Tencent is pleased to support the open source community by making
1264
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1265
- *
1266
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1267
- *
1268
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1269
- *
1270
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1271
- *
1272
- * ---------------------------------------------------
1273
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1274
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1275
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1276
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1277
- *
1278
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1279
- * the Software.
1280
- *
1281
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1282
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1283
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1284
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1285
- * IN THE SOFTWARE.
1286
- */
1287
- /* harmony default export */ const scrollbar_core_can_use_dom = (function () {
1288
- return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
1289
- });
1290
- ;// CONCATENATED MODULE: ../../packages/virtual-render/src/scrollbar-core/scrollbar-width.ts
1291
- /*
1292
- * Tencent is pleased to support the open source community by making
1293
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1294
- *
1295
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1296
- *
1297
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1298
- *
1299
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1300
- *
1301
- * ---------------------------------------------------
1302
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1303
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1304
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1305
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1306
- *
1307
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1308
- * the Software.
1309
- *
1310
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1311
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1312
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1313
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1314
- * IN THE SOFTWARE.
1315
- */
1316
-
1317
- var cachedScrollbarWidth = null;
1318
- var cachedDevicePixelRatio = null;
1319
- if (scrollbar_core_can_use_dom()) {
1320
- window.addEventListener('resize', function () {
1321
- if (cachedDevicePixelRatio !== window.devicePixelRatio) {
1322
- cachedDevicePixelRatio = window.devicePixelRatio;
1323
- cachedScrollbarWidth = null;
1324
- }
1325
- });
1326
- }
1327
- function scrollbarWidth() {
1328
- if (cachedScrollbarWidth === null) {
1329
- if (typeof document === 'undefined') {
1330
- cachedScrollbarWidth = 0;
1331
- return cachedScrollbarWidth;
1332
- }
1333
- var _document = document,
1334
- body = _document.body;
1335
- var box = document.createElement('div');
1336
- box.classList.add('simplebar-hide-scrollbar');
1337
- body.appendChild(box);
1338
- var width = box.getBoundingClientRect().right;
1339
- body.removeChild(box);
1340
- cachedScrollbarWidth = width;
1341
- }
1342
- return cachedScrollbarWidth;
1343
- }
1344
- ;// CONCATENATED MODULE: ../../packages/virtual-render/src/scrollbar-core/index.ts
1345
-
1346
-
1347
-
1348
-
1349
-
1350
- function scrollbar_core_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; }
1351
- function scrollbar_core_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? scrollbar_core_ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : scrollbar_core_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1352
- /* eslint-disable @typescript-eslint/consistent-type-assertions */
1353
- /*
1354
- * Tencent is pleased to support the open source community by making
1355
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
1356
- *
1357
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
1358
- *
1359
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
1360
- *
1361
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
1362
- *
1363
- * ---------------------------------------------------
1364
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
1365
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
1366
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
1367
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
1368
- *
1369
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
1370
- * the Software.
1371
- *
1372
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
1373
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1374
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
1375
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
1376
- * IN THE SOFTWARE.
1377
- */
1378
-
1379
-
1380
-
1381
-
1382
-
1383
- var scrollbar_core_getElementWindow = getElementWindow,
1384
- scrollbar_core_getElementDocument = getElementDocument,
1385
- scrollbar_core_addClasses = addClasses,
1386
- scrollbar_core_removeClasses = removeClasses,
1387
- scrollbar_core_classNamesToQuery = classNamesToQuery;
1388
- var SimpleBarCore = /*#__PURE__*/function () {
1389
- // eslint-disable-next-line @typescript-eslint/member-ordering
1390
- function SimpleBarCore(element) {
1391
- var _this = this;
1392
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1393
- _classCallCheck(this, SimpleBarCore);
1394
- _defineProperty(this, "removePreventClickId", null);
1395
- _defineProperty(this, "minScrollbarWidth", 20);
1396
- _defineProperty(this, "stopScrollDelay", 175);
1397
- _defineProperty(this, "isScrolling", false);
1398
- _defineProperty(this, "isMouseEntering", false);
1399
- _defineProperty(this, "isDragging", false);
1400
- _defineProperty(this, "scrollXTicking", false);
1401
- _defineProperty(this, "scrollYTicking", false);
1402
- _defineProperty(this, "wrapperEl", null);
1403
- _defineProperty(this, "contentEl", null);
1404
- _defineProperty(this, "delegateXContent", null);
1405
- _defineProperty(this, "delegateYContent", null);
1406
- _defineProperty(this, "rtlHelpers", null);
1407
- _defineProperty(this, "scrollbarWidth", 0);
1408
- _defineProperty(this, "resizeObserver", null);
1409
- _defineProperty(this, "mutationObserver", null);
1410
- _defineProperty(this, "elStyles", null);
1411
- _defineProperty(this, "isRtl", null);
1412
- _defineProperty(this, "mouseX", 0);
1413
- _defineProperty(this, "mouseY", 0);
1414
- _defineProperty(this, "mouseWheelInstance", null);
1415
- _defineProperty(this, "wheelOffset", 0);
1416
- /**
1417
- * 最外层滚动容器滚动实际位置缓存器
1418
- */
1419
- _defineProperty(this, "wrapperScrollValue", {
1420
- scrollTop: 0,
1421
- scrollLeft: 0
1422
- });
1423
- /**
1424
- * 模拟滚动条内部缩略滚动器滚动位置缓存器
1425
- */
1426
- _defineProperty(this, "wrapperScrollMap", {});
1427
- _defineProperty(this, "onMouseMove", function () {});
1428
- _defineProperty(this, "onWindowResize", function () {});
1429
- _defineProperty(this, "onStopScrolling", function () {});
1430
- _defineProperty(this, "onMouseEntered", function () {});
1431
- _defineProperty(this, "onMouseWheel", function () {});
1432
- /**
1433
- * On scroll event handling
1434
- */
1435
- _defineProperty(this, "onScroll", function () {
1436
- var elWindow = scrollbar_core_getElementWindow(_this.el);
1437
- if (!_this.scrollXTicking) {
1438
- elWindow.requestAnimationFrame(_this.scrollX);
1439
- _this.scrollXTicking = true;
1440
- }
1441
- if (!_this.scrollYTicking) {
1442
- elWindow.requestAnimationFrame(_this.scrollY);
1443
- _this.scrollYTicking = true;
1444
- }
1445
- if (!_this.isScrolling) {
1446
- _this.isScrolling = true;
1447
- scrollbar_core_addClasses(_this.el, _this.classNames.scrolling);
1448
- }
1449
- _this.showScrollbar('x');
1450
- _this.showScrollbar('y');
1451
- _this.onStopScrolling();
1452
- });
1453
- _defineProperty(this, "scrollX", function () {
1454
- if (_this.axis.x.isOverflowing) {
1455
- _this.positionScrollbar('x');
1456
- }
1457
- _this.scrollXTicking = false;
1458
- });
1459
- _defineProperty(this, "scrollY", function () {
1460
- if (_this.axis.y.isOverflowing) {
1461
- _this.positionScrollbar('y');
1462
- }
1463
- _this.scrollYTicking = false;
1464
- });
1465
- _defineProperty(this, "_onMouseWheel", function (args) {
1466
- var nextPostiion = _this.wheelOffset + args.y;
1467
- if (_this.scrollToAxisPosition(nextPostiion, 'y')) {
1468
- args.evt.stopPropagation();
1469
- args.evt.preventDefault();
1470
- args.evt.stopImmediatePropagation();
1471
- _this.showScrollbar('y');
1472
- if (_this.mouseWeelTimer) {
1473
- clearTimeout(_this.mouseWeelTimer);
1474
- _this.mouseWeelTimer = null;
1475
- }
1476
- _this.mouseWeelTimer = setTimeout(function () {
1477
- _this.hideScrollbar('y');
1478
- }, 200);
1479
- }
1480
- });
1481
- _defineProperty(this, "_onStopScrolling", function () {
1482
- scrollbar_core_removeClasses(_this.el, _this.classNames.scrolling);
1483
- if (_this.options.autoHide) {
1484
- _this.hideScrollbar('x');
1485
- _this.hideScrollbar('y');
1486
- }
1487
- _this.isScrolling = false;
1488
- });
1489
- _defineProperty(this, "onMouseEnter", function () {
1490
- _this.mouseWeelTimer && clearTimeout(_this.mouseWeelTimer);
1491
- if (!_this.isMouseEntering) {
1492
- scrollbar_core_addClasses(_this.el, _this.classNames.mouseEntered);
1493
- _this.showScrollbar('x');
1494
- _this.showScrollbar('y');
1495
- _this.isMouseEntering = true;
1496
- }
1497
- _this.onMouseEntered();
1498
- });
1499
- _defineProperty(this, "_onMouseEntered", function () {
1500
- scrollbar_core_removeClasses(_this.el, _this.classNames.mouseEntered);
1501
- if (_this.options.autoHide) {
1502
- _this.hideScrollbar('x');
1503
- _this.hideScrollbar('y');
1504
- }
1505
- _this.isMouseEntering = false;
1506
- });
1507
- _defineProperty(this, "_onMouseMove", function (e) {
1508
- _this.mouseX = e.clientX;
1509
- _this.mouseY = e.clientY;
1510
- if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) {
1511
- _this.onMouseMoveForAxis('x');
1512
- }
1513
- if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) {
1514
- _this.onMouseMoveForAxis('y');
1515
- }
1516
- });
1517
- _defineProperty(this, "onMouseLeave", function () {
1518
- _this.onMouseMove.cancel();
1519
- if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) {
1520
- _this.onMouseLeaveForAxis('x');
1521
- }
1522
- if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) {
1523
- _this.onMouseLeaveForAxis('y');
1524
- }
1525
- _this.mouseX = -1;
1526
- _this.mouseY = -1;
1527
- });
1528
- _defineProperty(this, "_onWindowResize", function () {
1529
- // Recalculate scrollbarWidth in case it's a zoom
1530
- _this.scrollbarWidth = _this.getScrollbarWidth();
1531
- });
1532
- _defineProperty(this, "onPointerEvent", function (e) {
1533
- if (!_this.axis.x.track.el || !_this.axis.y.track.el || !_this.axis.x.scrollbar.el || !_this.axis.y.scrollbar.el) return;
1534
- var isWithinTrackXBounds;
1535
- var isWithinTrackYBounds;
1536
- _this.axis.x.track.rect = _this.axis.x.track.el.getBoundingClientRect();
1537
- _this.axis.y.track.rect = _this.axis.y.track.el.getBoundingClientRect();
1538
- if (_this.axis.x.isOverflowing || _this.axis.x.forceVisible) {
1539
- isWithinTrackXBounds = _this.isWithinBounds(_this.axis.x.track.rect);
1540
- }
1541
- if (_this.axis.y.isOverflowing || _this.axis.y.forceVisible) {
1542
- isWithinTrackYBounds = _this.isWithinBounds(_this.axis.y.track.rect);
1543
- }
1544
- // If any pointer event is called on the scrollbar
1545
- if (isWithinTrackXBounds || isWithinTrackYBounds) {
1546
- // Prevent event leaking
1547
- e.stopPropagation();
1548
- if (e.type === 'pointerdown' && e.pointerType !== 'touch') {
1549
- if (isWithinTrackXBounds) {
1550
- _this.axis.x.scrollbar.rect = _this.axis.x.scrollbar.el.getBoundingClientRect();
1551
- if (_this.isWithinBounds(_this.axis.x.scrollbar.rect)) {
1552
- _this.onDragStart(e, 'x');
1553
- } else {
1554
- _this.onTrackClick(e, 'x');
1555
- }
1556
- }
1557
- if (isWithinTrackYBounds) {
1558
- _this.axis.y.scrollbar.rect = _this.axis.y.scrollbar.el.getBoundingClientRect();
1559
- if (_this.isWithinBounds(_this.axis.y.scrollbar.rect)) {
1560
- _this.onDragStart(e, 'y');
1561
- } else {
1562
- _this.onTrackClick(e, 'y');
1563
- }
1564
- }
1565
- }
1566
- }
1567
- });
1568
- /**
1569
- * Drag scrollbar handle
1570
- */
1571
- _defineProperty(this, "drag", function (e) {
1572
- var _track$rect$_this$axi, _track$rect, _track$rect$_this$axi2, _track$rect2;
1573
- if (!_this.draggedAxis || !_this.wrapperEl) return;
1574
- var eventOffset;
1575
- var track = _this.axis[_this.draggedAxis].track;
1576
- var scrollbar = _this.axis[_this.draggedAxis].scrollbar;
1577
- e.preventDefault();
1578
- e.stopPropagation();
1579
- if (_this.draggedAxis === 'y') {
1580
- eventOffset = e.pageY;
1581
- } else {
1582
- eventOffset = e.pageX;
1583
- }
1584
- // Calculate how far the user's mouse is from the top/left of the scrollbar (minus the dragOffset).
1585
- var dragPos = eventOffset - ((_track$rect$_this$axi = (_track$rect = track.rect) === null || _track$rect === void 0 ? void 0 : _track$rect[_this.axis[_this.draggedAxis].offsetAttr]) !== null && _track$rect$_this$axi !== void 0 ? _track$rect$_this$axi : 0) - _this.axis[_this.draggedAxis].dragOffset;
1586
- dragPos = _this.draggedAxis === 'x' && _this.isRtl ? ((_track$rect$_this$axi2 = (_track$rect2 = track.rect) === null || _track$rect2 === void 0 ? void 0 : _track$rect2[_this.axis[_this.draggedAxis].sizeAttr]) !== null && _track$rect$_this$axi2 !== void 0 ? _track$rect$_this$axi2 : 0) - scrollbar.size - dragPos : dragPos;
1587
- var scrollPos = _this.getPointerPosition(dragPos, _this.draggedAxis);
1588
- _this.scrollToAxisPosition(scrollPos, _this.draggedAxis);
1589
- });
1590
- _defineProperty(this, "getPointerPosition", function (dragPos, axis) {
1591
- var _track$rect$_this$axi3, _track$rect3, _this$wrapperEl$_this, _this$wrapperEl, _this$elStyles$_this$, _this$elStyles;
1592
- var track = _this.axis[axis].track;
1593
- var trackSize = (_track$rect$_this$axi3 = (_track$rect3 = track.rect) === null || _track$rect3 === void 0 ? void 0 : _track$rect3[_this.axis[axis].sizeAttr]) !== null && _track$rect$_this$axi3 !== void 0 ? _track$rect$_this$axi3 : 0;
1594
- var scrollbar = _this.axis[axis].scrollbar;
1595
- var contentSize = (_this$wrapperEl$_this = (_this$wrapperEl = _this.wrapperEl) === null || _this$wrapperEl === void 0 ? void 0 : _this$wrapperEl[_this.axis[axis].scrollSizeAttr]) !== null && _this$wrapperEl$_this !== void 0 ? _this$wrapperEl$_this : 0;
1596
- var hostSize = parseInt((_this$elStyles$_this$ = (_this$elStyles = _this.elStyles) === null || _this$elStyles === void 0 ? void 0 : _this$elStyles[_this.axis[axis].sizeAttr]) !== null && _this$elStyles$_this$ !== void 0 ? _this$elStyles$_this$ : '0px', 10);
1597
- // Convert the mouse position into a percentage of the scrollbar height/width.
1598
- var dragPerc = dragPos / (trackSize - scrollbar.size);
1599
- // Scroll the content by the same percentage.
1600
- var scrollPos = dragPerc * (contentSize - hostSize);
1601
- // Fix browsers inconsistency on RTL
1602
- if (axis === 'x' && _this.isRtl) {
1603
- var _SimpleBarCore$getRtl;
1604
- scrollPos = (_SimpleBarCore$getRtl = SimpleBarCore.getRtlHelpers()) !== null && _SimpleBarCore$getRtl !== void 0 && _SimpleBarCore$getRtl.isScrollingToNegative ? -scrollPos : scrollPos;
1605
- }
1606
- return scrollPos;
1607
- });
1608
- _defineProperty(this, "scrollToAxisPosition", function (scrollPos, axisValue) {
1609
- var _this$wrapperScrollVa;
1610
- var getFormatPosition = function getFormatPosition() {
1611
- if (scrollPos < 0) {
1612
- return 0;
1613
- }
1614
- if (axisValue === 'y') {
1615
- var diffHeight = _this.wrapperEl.scrollHeight - _this.wrapperEl.offsetHeight;
1616
- return scrollPos >= diffHeight ? diffHeight : scrollPos;
1617
- }
1618
- var diffWidth = _this.wrapperEl.scrollWidth - _this.wrapperEl.offsetWidth;
1619
- return scrollPos >= diffWidth ? diffWidth : scrollPos;
1620
- };
1621
- var scrollAttr = _this.axis[axisValue].scrollOffsetAttr;
1622
- var resolvedValue = getFormatPosition();
1623
- var scrollValue = (_this$wrapperScrollVa = _this.wrapperScrollValue[scrollAttr]) !== null && _this$wrapperScrollVa !== void 0 ? _this$wrapperScrollVa : 0;
1624
- if (scrollValue !== resolvedValue) {
1625
- _this.fixedScrollTo(axisValue, resolvedValue);
1626
- return true;
1627
- }
1628
- return false;
1629
- });
1630
- _defineProperty(this, "fixedScrollTo", function (axisValue, resolvedValue) {
1631
- var _this$options, _this$options$onScrol;
1632
- var getStyleValue = function getStyleValue(key) {
1633
- var xValue = _this.axis[key].track.el.style.getPropertyValue('--scroll-offset-x');
1634
- var yValye = _this.axis[key].track.el.style.getPropertyValue('--scroll-offset-y');
1635
- return [xValue ? xValue : '0px', yValye ? yValye : '0px'];
1636
- };
1637
- var scrollAttr = _this.axis[axisValue].scrollOffsetAttr;
1638
- Object.assign(_this.wrapperScrollValue, _defineProperty({}, scrollAttr, resolvedValue));
1639
- if (_this.options.useSystemScrollXBehavior && axisValue === 'x' || _this.options.useSystemScrollYBehavior && axisValue === 'y') {
1640
- _this.wrapperEl[scrollAttr] = resolvedValue;
1641
- var _getStyleValue = getStyleValue('y'),
1642
- _getStyleValue2 = _slicedToArray(_getStyleValue, 2),
1643
- verticalX = _getStyleValue2[0],
1644
- verticalY = _getStyleValue2[1];
1645
- var _getStyleValue3 = getStyleValue('x'),
1646
- _getStyleValue4 = _slicedToArray(_getStyleValue3, 2),
1647
- horiX = _getStyleValue4[0],
1648
- horiY = _getStyleValue4[1];
1649
- var old = {
1650
- x: {
1651
- x: horiX,
1652
- y: horiY
1653
- },
1654
- y: {
1655
- x: verticalX,
1656
- y: verticalY
1657
- }
1658
- };
1659
- ['x', 'y'].forEach(function (key) {
1660
- old[key][axisValue] = "".concat(resolvedValue, "px");
1661
- _this.axis[key].track.el.style.setProperty('--scroll-offset-x', old[key].x);
1662
- _this.axis[key].track.el.style.setProperty('--scroll-offset-y', old[key].y);
1663
- });
1664
- }
1665
- if (axisValue === 'y') {
1666
- _this.wheelOffset = resolvedValue;
1667
- }
1668
- (_this$options = _this.options) === null || _this$options === void 0 || (_this$options$onScrol = _this$options.onScrollCallback) === null || _this$options$onScrol === void 0 || _this$options$onScrol.call(_this$options, {
1669
- x: _this.wrapperScrollValue.scrollLeft,
1670
- y: _this.wrapperScrollValue.scrollTop
1671
- });
1672
- _this.positionScrollbar(axisValue);
1673
- });
1674
- /**
1675
- * End scroll handle drag
1676
- */
1677
- _defineProperty(this, "onEndDrag", function (e) {
1678
- _this.isDragging = false;
1679
- var elDocument = scrollbar_core_getElementDocument(_this.el);
1680
- var elWindow = scrollbar_core_getElementWindow(_this.el);
1681
- e.preventDefault();
1682
- e.stopPropagation();
1683
- scrollbar_core_removeClasses(_this.el, _this.classNames.dragging);
1684
- _this.onStopScrolling();
1685
- elDocument.removeEventListener('mousemove', _this.drag, true);
1686
- elDocument.removeEventListener('mouseup', _this.onEndDrag, true);
1687
- _this.removePreventClickId = elWindow.setTimeout(function () {
1688
- // Remove these asynchronously so we still suppress click events
1689
- // generated simultaneously with mouseup.
1690
- elDocument.removeEventListener('click', _this.preventClick, true);
1691
- elDocument.removeEventListener('dblclick', _this.preventClick, true);
1692
- _this.removePreventClickId = null;
1693
- scrollbar_core_removeClasses(_this.axis[_this.draggedAxis].track.el, _this.classNames.hover);
1694
- });
1695
- });
1696
- /**
1697
- * Handler to ignore click events during drag
1698
- */
1699
- _defineProperty(this, "preventClick", function (e) {
1700
- e.preventDefault();
1701
- e.stopPropagation();
1702
- });
1703
- this.el = element;
1704
- this.options = scrollbar_core_objectSpread(scrollbar_core_objectSpread({}, SimpleBarCore.defaultOptions), options);
1705
- this.classNames = scrollbar_core_objectSpread(scrollbar_core_objectSpread({}, SimpleBarCore.defaultOptions.classNames), options.classNames);
1706
- this.axis = {
1707
- x: {
1708
- scrollOffsetAttr: 'scrollLeft',
1709
- sizeAttr: 'width',
1710
- scrollSizeAttr: 'scrollWidth',
1711
- offsetSizeAttr: 'offsetWidth',
1712
- offsetAttr: 'left',
1713
- overflowAttr: 'overflowX',
1714
- dragOffset: 0,
1715
- isOverflowing: true,
1716
- forceVisible: false,
1717
- track: {
1718
- size: null,
1719
- el: null,
1720
- rect: null,
1721
- isVisible: false
1722
- },
1723
- scrollbar: {
1724
- size: null,
1725
- el: null,
1726
- rect: null,
1727
- isVisible: false
1728
- }
1729
- },
1730
- y: {
1731
- scrollOffsetAttr: 'scrollTop',
1732
- sizeAttr: 'height',
1733
- scrollSizeAttr: 'scrollHeight',
1734
- offsetSizeAttr: 'offsetHeight',
1735
- offsetAttr: 'top',
1736
- overflowAttr: 'overflowY',
1737
- dragOffset: 0,
1738
- isOverflowing: true,
1739
- forceVisible: false,
1740
- track: {
1741
- size: null,
1742
- el: null,
1743
- rect: null,
1744
- isVisible: false
1745
- },
1746
- scrollbar: {
1747
- size: null,
1748
- el: null,
1749
- rect: null,
1750
- isVisible: false
1751
- }
1752
- }
1753
- };
1754
- if (_typeof(this.el) !== 'object' || !this.el.nodeName) {
1755
- throw new Error("Argument passed to SimpleBar must be an HTML element instead of ".concat(this.el));
1756
- }
1757
- this.onMouseMove = lodash_es_throttle(this._onMouseMove, 64);
1758
- this.onWindowResize = lodash_es_debounce(this._onWindowResize, 64, {
1759
- leading: true
1760
- });
1761
- this.onStopScrolling = lodash_es_debounce(this._onStopScrolling, this.stopScrollDelay);
1762
- this.onMouseEntered = lodash_es_debounce(this._onMouseEntered, this.stopScrollDelay);
1763
- this.mouseWheelInstance = mouse_wheel(this._onMouseWheel);
1764
- this.init();
1765
- }
1766
- _createClass(SimpleBarCore, [{
1767
- key: "getScrollbarWidth",
1768
- value: function getScrollbarWidth() {
1769
- // Try/catch for FF 56 throwing on undefined computedStyles
1770
- try {
1771
- // Detect browsers supporting CSS scrollbar styling and do not calculate
1772
- if (this.wrapperEl && getComputedStyle(this.wrapperEl, '::-webkit-scrollbar').display === 'none' || 'scrollbarWidth' in document.documentElement.style || '-ms-overflow-style' in document.documentElement.style) {
1773
- return 0;
1774
- }
1775
- return scrollbarWidth();
1776
- } catch (e) {
1777
- return scrollbarWidth();
1778
- }
1779
- }
1780
- }, {
1781
- key: "init",
1782
- value: function init() {
1783
- // We stop here on server-side
1784
- if ((can_use_dom_default())) {
1785
- this.initDOM();
1786
- this.rtlHelpers = SimpleBarCore.getRtlHelpers();
1787
- this.scrollbarWidth = this.getScrollbarWidth();
1788
- this.recalculate();
1789
- this.initListeners();
1790
- }
1791
- }
1792
- }, {
1793
- key: "initDOM",
1794
- value: function initDOM() {
1795
- var _this$options$wrapper, _this$options$content, _this$axis$x$track$el, _this$axis$y$track$el;
1796
- // assume that element has his DOM already initiated
1797
- this.wrapperEl = (_this$options$wrapper = this.options.wrapperNode) !== null && _this$options$wrapper !== void 0 ? _this$options$wrapper : this.el.querySelector(scrollbar_core_classNamesToQuery(this.classNames.wrapper));
1798
- this.contentEl = (_this$options$content = this.options.contentNode) !== null && _this$options$content !== void 0 ? _this$options$content : this.el.querySelector(scrollbar_core_classNamesToQuery(this.classNames.contentEl));
1799
- this.axis.x.track.el = this.findChild(this.el, "".concat(scrollbar_core_classNamesToQuery(this.classNames.track)).concat(scrollbar_core_classNamesToQuery(this.classNames.horizontal)));
1800
- this.axis.y.track.el = this.findChild(this.el, "".concat(scrollbar_core_classNamesToQuery(this.classNames.track)).concat(scrollbar_core_classNamesToQuery(this.classNames.vertical)));
1801
- this.axis.x.scrollbar.el = ((_this$axis$x$track$el = this.axis.x.track.el) === null || _this$axis$x$track$el === void 0 ? void 0 : _this$axis$x$track$el.querySelector(scrollbar_core_classNamesToQuery(this.classNames.scrollbar))) || null;
1802
- this.axis.y.scrollbar.el = ((_this$axis$y$track$el = this.axis.y.track.el) === null || _this$axis$y$track$el === void 0 ? void 0 : _this$axis$y$track$el.querySelector(scrollbar_core_classNamesToQuery(this.classNames.scrollbar))) || null;
1803
- if (!this.options.autoHide) {
1804
- scrollbar_core_addClasses(this.axis.x.scrollbar.el, this.classNames.visible);
1805
- scrollbar_core_addClasses(this.axis.y.scrollbar.el, this.classNames.visible);
1806
- }
1807
- }
1808
- }, {
1809
- key: "initListeners",
1810
- value: function initListeners() {
1811
- var _this$mouseWheelInsta,
1812
- _this2 = this;
1813
- var elWindow = scrollbar_core_getElementWindow(this.el);
1814
- // Event listeners
1815
- (_this$mouseWheelInsta = this.mouseWheelInstance) === null || _this$mouseWheelInsta === void 0 || _this$mouseWheelInsta.addWheelEvent(this.el);
1816
- this.el.addEventListener('mouseenter', this.onMouseEnter);
1817
- this.el.addEventListener('pointerdown', this.onPointerEvent, true);
1818
- this.el.addEventListener('mousemove', this.onMouseMove);
1819
- this.el.addEventListener('mouseleave', this.onMouseLeave);
1820
- // Browser zoom triggers a window resize
1821
- elWindow.addEventListener('resize', this.onWindowResize);
1822
- if (!this.contentEl) return;
1823
- if (window.ResizeObserver) {
1824
- // Hack for https://github.com/WICG/ResizeObserver/issues/38
1825
- var resizeObserverStarted = false;
1826
- var resizeObserver = elWindow.ResizeObserver || ResizeObserver;
1827
- // eslint-disable-next-line new-cap
1828
- this.resizeObserver = new resizeObserver(function () {
1829
- if (!resizeObserverStarted) return;
1830
- elWindow.requestAnimationFrame(function () {
1831
- _this2.recalculate();
1832
- });
1833
- });
1834
- this.resizeObserver.observe(this.el);
1835
- this.resizeObserver.observe(this.contentEl);
1836
- if (this.delegateXContent) {
1837
- this.resizeObserver.observe(this.delegateXContent);
1838
- }
1839
- if (this.delegateYContent) {
1840
- this.resizeObserver.observe(this.delegateYContent);
1841
- }
1842
- elWindow.requestAnimationFrame(function () {
1843
- resizeObserverStarted = true;
1844
- });
1845
- }
1846
- // This is required to detect horizontal scroll. Vertical scroll only needs the resizeObserver.
1847
- this.mutationObserver = new elWindow.MutationObserver(function () {
1848
- elWindow.requestAnimationFrame(function () {
1849
- _this2.recalculate();
1850
- });
1851
- });
1852
- this.mutationObserver.observe(this.contentEl, {
1853
- childList: true,
1854
- subtree: true,
1855
- characterData: true
1856
- });
1857
- }
1858
- }, {
1859
- key: "recalculate",
1860
- value: function recalculate() {
1861
- if (!this.contentEl || !this.wrapperEl) return;
1862
- var elWindow = scrollbar_core_getElementWindow(this.el);
1863
- this.elStyles = elWindow.getComputedStyle(this.el);
1864
- this.isRtl = this.elStyles.direction === 'rtl';
1865
- var wrapperOffsetWidth = this.wrapperEl.offsetWidth;
1866
- var wrapperOffsetHeight = this.wrapperEl.offsetHeight;
1867
- var wrapperScrollHeight = this.wrapperEl.scrollHeight;
1868
- var wrapperScrollWidth = this.wrapperEl.scrollWidth;
1869
- this.axis.x.isOverflowing = wrapperOffsetWidth !== 0 && wrapperScrollWidth > wrapperOffsetWidth;
1870
- this.axis.y.isOverflowing = wrapperScrollHeight > wrapperOffsetHeight;
1871
- this.axis.x.forceVisible = this.options.forceVisible === 'x' || this.options.forceVisible === true;
1872
- this.axis.y.forceVisible = this.options.forceVisible === 'y' || this.options.forceVisible === true;
1873
- // Set isOverflowing to false if scrollbar is not necessary (content is shorter than offset)
1874
- var offsetForXScrollbar = this.axis.x.isOverflowing ? this.scrollbarWidth : 0;
1875
- var offsetForYScrollbar = this.axis.y.isOverflowing ? this.scrollbarWidth : 0;
1876
- this.axis.x.isOverflowing = this.axis.x.isOverflowing && wrapperScrollWidth > wrapperOffsetWidth - offsetForYScrollbar;
1877
- this.axis.y.isOverflowing = this.axis.y.isOverflowing && wrapperScrollHeight > wrapperOffsetHeight - offsetForXScrollbar;
1878
- this.axis.x.scrollbar.size = this.getScrollbarSize('x');
1879
- this.axis.y.scrollbar.size = this.getScrollbarSize('y');
1880
- if (this.axis.x.scrollbar.el) this.axis.x.scrollbar.el.style.width = "".concat(this.axis.x.scrollbar.size, "px");
1881
- if (this.axis.y.scrollbar.el) this.axis.y.scrollbar.el.style.height = "".concat(this.axis.y.scrollbar.size, "px");
1882
- this.positionScrollbar('x');
1883
- this.positionScrollbar('y');
1884
- this.toggleTrackVisibility('x');
1885
- this.toggleTrackVisibility('y');
1886
- }
1887
- /**
1888
- * Calculate scrollbar size
1889
- */
1890
- }, {
1891
- key: "getScrollbarSize",
1892
- value: function getScrollbarSize() {
1893
- var _this3 = this,
1894
- _this$axis$axis$track,
1895
- _this$axis$axis$track2;
1896
- var axis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'y';
1897
- if (!this.axis[axis].isOverflowing || !this.contentEl) {
1898
- return 0;
1899
- }
1900
- var getContentTarget = function getContentTarget() {
1901
- var _this3$options$delega2;
1902
- if (axis === 'x') {
1903
- var _this3$options$delega;
1904
- return (_this3$options$delega = _this3.options.delegateXContent) !== null && _this3$options$delega !== void 0 ? _this3$options$delega : _this3.contentEl;
1905
- }
1906
- return (_this3$options$delega2 = _this3.options.delegateYContent) !== null && _this3$options$delega2 !== void 0 ? _this3$options$delega2 : _this3.contentEl;
1907
- };
1908
- var contentSize = getContentTarget()[this.axis[axis].scrollSizeAttr];
1909
- var trackSize = (_this$axis$axis$track = (_this$axis$axis$track2 = this.axis[axis].track.el) === null || _this$axis$axis$track2 === void 0 ? void 0 : _this$axis$axis$track2[this.axis[axis].offsetSizeAttr]) !== null && _this$axis$axis$track !== void 0 ? _this$axis$axis$track : 0;
1910
- var scrollbarRatio = trackSize / contentSize;
1911
- var scrollbarSize;
1912
- // Calculate new height/position of drag handle.
1913
- scrollbarSize = Math.max(~~(scrollbarRatio * trackSize), this.options.scrollbarMinSize);
1914
- if (this.options.scrollbarMaxSize) {
1915
- scrollbarSize = Math.min(scrollbarSize, this.options.scrollbarMaxSize);
1916
- }
1917
- return scrollbarSize;
1918
- }
1919
- }, {
1920
- key: "positionScrollbar",
1921
- value: function positionScrollbar() {
1922
- var _this$axis$axis$track3, _SimpleBarCore$getRtl2;
1923
- var axis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'y';
1924
- var scrollbar = this.axis[axis].scrollbar;
1925
- if (!this.axis[axis].isOverflowing || !this.wrapperEl || !scrollbar.el || !this.elStyles) {
1926
- return;
1927
- }
1928
- var contentSize = this.wrapperEl[this.axis[axis].scrollSizeAttr];
1929
- var trackSize = ((_this$axis$axis$track3 = this.axis[axis].track.el) === null || _this$axis$axis$track3 === void 0 ? void 0 : _this$axis$axis$track3[this.axis[axis].offsetSizeAttr]) || 0;
1930
- var hostSize = parseInt(this.elStyles[this.axis[axis].sizeAttr], 10);
1931
- var scrollOffset = this.wrapperScrollValue[this.axis[axis].scrollOffsetAttr];
1932
- scrollOffset = axis === 'x' && this.isRtl && (_SimpleBarCore$getRtl2 = SimpleBarCore.getRtlHelpers()) !== null && _SimpleBarCore$getRtl2 !== void 0 && _SimpleBarCore$getRtl2.isScrollOriginAtZero ? -scrollOffset : scrollOffset;
1933
- if (axis === 'x' && this.isRtl) {
1934
- var _SimpleBarCore$getRtl3;
1935
- scrollOffset = (_SimpleBarCore$getRtl3 = SimpleBarCore.getRtlHelpers()) !== null && _SimpleBarCore$getRtl3 !== void 0 && _SimpleBarCore$getRtl3.isScrollingToNegative ? scrollOffset : -scrollOffset;
1936
- }
1937
- var scrollPourcent = scrollOffset / (contentSize - hostSize);
1938
- var handleOffset = ~~((trackSize - scrollbar.size) * scrollPourcent);
1939
- handleOffset = axis === 'x' && this.isRtl ? -handleOffset + (trackSize - scrollbar.size) : handleOffset;
1940
- var scrollAttr = this.axis[axis].scrollOffsetAttr;
1941
- Object.assign(this.wrapperScrollMap, _defineProperty({}, scrollAttr, handleOffset));
1942
- scrollbar.el.style.transform = axis === 'x' ? "translate3d(".concat(handleOffset, "px, 0, 0)") : "translate3d(0, ".concat(handleOffset, "px, 0)");
1943
- }
1944
- }, {
1945
- key: "toggleTrackVisibility",
1946
- value: function toggleTrackVisibility() {
1947
- var axis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'y';
1948
- var track = this.axis[axis].track.el;
1949
- var scrollbar = this.axis[axis].scrollbar.el;
1950
- if (!track || !scrollbar || !this.wrapperEl) return;
1951
- if (this.axis[axis].isOverflowing || this.axis[axis].forceVisible) {
1952
- track.style.visibility = 'visible';
1953
- // this.wrapperEl.style[this.axis[axis].overflowAttr] = 'scroll';
1954
- this.el.classList.add("".concat(this.classNames.scrollable, "-").concat(axis));
1955
- } else {
1956
- track.style.visibility = 'hidden';
1957
- // this.wrapperEl.style[this.axis[axis].overflowAttr] = 'hidden';
1958
- this.el.classList.remove("".concat(this.classNames.scrollable, "-").concat(axis));
1959
- }
1960
- // Even if forceVisible is enabled, scrollbar itself should be hidden
1961
- if (this.axis[axis].isOverflowing) {
1962
- scrollbar.style.display = 'block';
1963
- } else {
1964
- scrollbar.style.display = 'none';
1965
- }
1966
- }
1967
- }, {
1968
- key: "showScrollbar",
1969
- value: function showScrollbar() {
1970
- var axis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'y';
1971
- if (this.axis[axis].isOverflowing && !this.axis[axis].scrollbar.isVisible) {
1972
- scrollbar_core_addClasses(this.axis[axis].scrollbar.el, this.classNames.visible);
1973
- this.axis[axis].scrollbar.isVisible = true;
1974
- }
1975
- }
1976
- }, {
1977
- key: "hideScrollbar",
1978
- value: function hideScrollbar() {
1979
- var axis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'y';
1980
- if (this.isDragging) return;
1981
- if (this.axis[axis].isOverflowing && this.axis[axis].scrollbar.isVisible) {
1982
- scrollbar_core_removeClasses(this.axis[axis].scrollbar.el, this.classNames.visible);
1983
- this.axis[axis].scrollbar.isVisible = false;
1984
- }
1985
- }
1986
- }, {
1987
- key: "onMouseMoveForAxis",
1988
- value: function onMouseMoveForAxis() {
1989
- var axis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'y';
1990
- var currentAxis = this.axis[axis];
1991
- if (!currentAxis.track.el || !currentAxis.scrollbar.el) return;
1992
- currentAxis.track.rect = currentAxis.track.el.getBoundingClientRect();
1993
- currentAxis.scrollbar.rect = currentAxis.scrollbar.el.getBoundingClientRect();
1994
- if (this.isWithinBounds(currentAxis.track.rect)) {
1995
- this.showScrollbar(axis);
1996
- scrollbar_core_addClasses(currentAxis.track.el, this.classNames.hover);
1997
- if (this.isWithinBounds(currentAxis.scrollbar.rect)) {
1998
- scrollbar_core_addClasses(currentAxis.scrollbar.el, this.classNames.hover);
1999
- } else {
2000
- if (!this.isDragging) {
2001
- scrollbar_core_removeClasses(currentAxis.scrollbar.el, this.classNames.hover);
2002
- }
2003
- }
2004
- } else {
2005
- if (!this.isDragging) {
2006
- scrollbar_core_removeClasses(currentAxis.track.el, this.classNames.hover);
2007
- }
2008
- if (this.options.autoHide) {
2009
- this.hideScrollbar(axis);
2010
- }
2011
- }
2012
- }
2013
- }, {
2014
- key: "onMouseLeaveForAxis",
2015
- value: function onMouseLeaveForAxis() {
2016
- var axis = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'y';
2017
- if (this.isDragging) {
2018
- return;
2019
- }
2020
- scrollbar_core_removeClasses(this.axis[axis].track.el, this.classNames.hover);
2021
- scrollbar_core_removeClasses(this.axis[axis].scrollbar.el, this.classNames.hover);
2022
- if (this.options.autoHide) {
2023
- this.hideScrollbar(axis);
2024
- }
2025
- }
2026
- }, {
2027
- key: "onDragStart",
2028
- value:
2029
- /**
2030
- * on scrollbar handle drag movement starts
2031
- */
2032
- function onDragStart(e) {
2033
- var _scrollbar$rect;
2034
- var axis = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'y';
2035
- this.isDragging = true;
2036
- var elDocument = scrollbar_core_getElementDocument(this.el);
2037
- var elWindow = scrollbar_core_getElementWindow(this.el);
2038
- var scrollbar = this.axis[axis].scrollbar;
2039
- // Measure how far the user's mouse is from the top of the scrollbar drag handle.
2040
- var eventOffset = axis === 'y' ? e.pageY : e.pageX;
2041
- this.axis[axis].dragOffset = eventOffset - (((_scrollbar$rect = scrollbar.rect) === null || _scrollbar$rect === void 0 ? void 0 : _scrollbar$rect[this.axis[axis].offsetAttr]) || 0);
2042
- this.draggedAxis = axis;
2043
- scrollbar_core_addClasses(this.el, this.classNames.dragging);
2044
- elDocument.addEventListener('mousemove', this.drag, true);
2045
- elDocument.addEventListener('mouseup', this.onEndDrag, true);
2046
- if (this.removePreventClickId === null) {
2047
- elDocument.addEventListener('click', this.preventClick, true);
2048
- elDocument.addEventListener('dblclick', this.preventClick, true);
2049
- } else {
2050
- elWindow.clearTimeout(this.removePreventClickId);
2051
- this.removePreventClickId = null;
2052
- }
2053
- }
2054
- }, {
2055
- key: "onTrackClick",
2056
- value: function onTrackClick(e) {
2057
- var _scrollbar$rect$this$,
2058
- _scrollbar$rect2,
2059
- _this$wrapperScrollMa,
2060
- _this4 = this;
2061
- var axis = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'y';
2062
- var currentAxis = this.axis[axis];
2063
- if (!this.options.clickOnTrack || !currentAxis.scrollbar.el || !this.wrapperEl) return;
2064
- // Preventing the event's default to trigger click underneath
2065
- e.preventDefault();
2066
- var elWindow = scrollbar_core_getElementWindow(this.el);
2067
- this.axis[axis].scrollbar.rect = currentAxis.scrollbar.el.getBoundingClientRect();
2068
- var scrollbar = this.axis[axis].scrollbar;
2069
- var scrollbarOffset = (_scrollbar$rect$this$ = (_scrollbar$rect2 = scrollbar.rect) === null || _scrollbar$rect2 === void 0 ? void 0 : _scrollbar$rect2[this.axis[axis].offsetAttr]) !== null && _scrollbar$rect$this$ !== void 0 ? _scrollbar$rect$this$ : 0;
2070
- var rect = this.wrapperEl.getBoundingClientRect();
2071
- // 获取鼠标相对于视口的位置
2072
- var x = e.clientX;
2073
- var y = e.clientY;
2074
- // 计算鼠标相对于目标元素的相对位置
2075
- var relativeX = x - rect.left;
2076
- var relativeY = y - rect.top;
2077
- var hostSize = axis === 'y' ? relativeY : relativeX;
2078
- var scrolled = (_this$wrapperScrollMa = this.wrapperScrollMap[this.axis[axis].scrollOffsetAttr]) !== null && _this$wrapperScrollMa !== void 0 ? _this$wrapperScrollMa : 0;
2079
- var t = axis === 'y' ? this.mouseY - scrollbarOffset : this.mouseX - scrollbarOffset;
2080
- var dir = t < 0 ? -1 : 1;
2081
- var scrollSize = dir === -1 ? scrolled - hostSize : hostSize - scrolled;
2082
- var speed = scrollSize > 40 ? 40 : scrollSize;
2083
- var scrollTo = function scrollTo() {
2084
- if (!_this4.wrapperEl) return;
2085
- if (scrollSize > 0) {
2086
- scrolled = scrolled + dir * speed;
2087
- scrollSize -= speed;
2088
- var resolvedValue = _this4.getPointerPosition(scrolled, axis);
2089
- _this4.scrollToAxisPosition(resolvedValue, axis);
2090
- elWindow.requestAnimationFrame(scrollTo);
2091
- }
2092
- };
2093
- scrollTo();
2094
- }
2095
- /**
2096
- * Getter for content element
2097
- */
2098
- }, {
2099
- key: "getContentElement",
2100
- value: function getContentElement() {
2101
- return this.contentEl;
2102
- }
2103
- /**
2104
- * Getter for original scrolling element
2105
- */
2106
- }, {
2107
- key: "getScrollElement",
2108
- value: function getScrollElement() {
2109
- return this.wrapperEl;
2110
- }
2111
- }, {
2112
- key: "removeListeners",
2113
- value: function removeListeners() {
2114
- var _this$mouseWheelInsta2;
2115
- var elWindow = scrollbar_core_getElementWindow(this.el);
2116
- (_this$mouseWheelInsta2 = this.mouseWheelInstance) === null || _this$mouseWheelInsta2 === void 0 || _this$mouseWheelInsta2.removeWheelEvent(this.el);
2117
- // Event listeners
2118
- this.el.removeEventListener('mouseenter', this.onMouseEnter);
2119
- this.el.removeEventListener('pointerdown', this.onPointerEvent, true);
2120
- this.el.removeEventListener('mousemove', this.onMouseMove);
2121
- this.el.removeEventListener('mouseleave', this.onMouseLeave);
2122
- if (this.wrapperEl) {
2123
- this.wrapperEl.removeEventListener('scroll', this.onScroll);
2124
- }
2125
- elWindow.removeEventListener('resize', this.onWindowResize);
2126
- if (this.mutationObserver) {
2127
- this.mutationObserver.disconnect();
2128
- }
2129
- if (this.resizeObserver) {
2130
- this.resizeObserver.disconnect();
2131
- }
2132
- // Cancel all debounced functions
2133
- this.onMouseMove.cancel();
2134
- this.onWindowResize.cancel();
2135
- this.onStopScrolling.cancel();
2136
- this.onMouseEntered.cancel();
2137
- }
2138
- /**
2139
- * Remove all listeners from DOM nodes
2140
- */
2141
- }, {
2142
- key: "unMount",
2143
- value: function unMount() {
2144
- this.removeListeners();
2145
- }
2146
- /**
2147
- * Check if mouse is within bounds
2148
- */
2149
- }, {
2150
- key: "isWithinBounds",
2151
- value: function isWithinBounds(bbox) {
2152
- return this.mouseX >= bbox.left && this.mouseX <= bbox.left + bbox.width && this.mouseY >= bbox.top && this.mouseY <= bbox.top + bbox.height;
2153
- }
2154
- /**
2155
- * Find element children matches query
2156
- */
2157
- }, {
2158
- key: "findChild",
2159
- value: function findChild(el, query) {
2160
- var matches = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;
2161
- return Array.prototype.filter.call(el.children, function (child) {
2162
- return matches.call(child, query);
2163
- })[0];
2164
- }
2165
- }], [{
2166
- key: "getRtlHelpers",
2167
- value:
2168
- /**
2169
- * Helper to fix browsers inconsistency on RTL:
2170
- * - Firefox inverts the scrollbar initial position
2171
- * - IE11 inverts both scrollbar position and scrolling offset
2172
- */
2173
- function getRtlHelpers() {
2174
- if (SimpleBarCore.rtlHelpers) {
2175
- return SimpleBarCore.rtlHelpers;
2176
- }
2177
- var dummyDiv = document.createElement('div');
2178
- dummyDiv.innerHTML = '<div class="simplebar-dummy-scrollbar-size"><div></div></div>';
2179
- var scrollbarDummyEl = dummyDiv.firstElementChild;
2180
- var dummyChild = scrollbarDummyEl === null || scrollbarDummyEl === void 0 ? void 0 : scrollbarDummyEl.firstElementChild;
2181
- if (!dummyChild) return null;
2182
- document.body.appendChild(scrollbarDummyEl);
2183
- scrollbarDummyEl.scrollLeft = 0;
2184
- var dummyContainerOffset = SimpleBarCore.getOffset(scrollbarDummyEl);
2185
- var dummyChildOffset = SimpleBarCore.getOffset(dummyChild);
2186
- scrollbarDummyEl.scrollLeft = -999;
2187
- var dummyChildOffsetAfterScroll = SimpleBarCore.getOffset(dummyChild);
2188
- document.body.removeChild(scrollbarDummyEl);
2189
- SimpleBarCore.rtlHelpers = {
2190
- // determines if the scrolling is responding with negative values
2191
- isScrollOriginAtZero: dummyContainerOffset.left !== dummyChildOffset.left,
2192
- // determines if the origin scrollbar position is inverted or not (positioned on left or right)
2193
- isScrollingToNegative: dummyChildOffset.left !== dummyChildOffsetAfterScroll.left
2194
- };
2195
- return SimpleBarCore.rtlHelpers;
2196
- }
2197
- }, {
2198
- key: "getOffset",
2199
- value: function getOffset(el) {
2200
- var rect = el.getBoundingClientRect();
2201
- var elDocument = scrollbar_core_getElementDocument(el);
2202
- var elWindow = scrollbar_core_getElementWindow(el);
2203
- return {
2204
- top: rect.top + (elWindow.pageYOffset || elDocument.documentElement.scrollTop),
2205
- left: rect.left + (elWindow.pageXOffset || elDocument.documentElement.scrollLeft)
2206
- };
2207
- }
2208
- }]);
2209
- return SimpleBarCore;
2210
- }();
2211
- _defineProperty(SimpleBarCore, "rtlHelpers", null);
2212
- _defineProperty(SimpleBarCore, "defaultOptions", {
2213
- forceVisible: false,
2214
- clickOnTrack: true,
2215
- scrollbarMinSize: 25,
2216
- scrollbarMaxSize: 0,
2217
- ariaLabel: 'scrollable content',
2218
- classNames: {
2219
- contentEl: 'simplebar-content',
2220
- wrapper: 'simplebar-wrapper',
2221
- scrollbar: 'simplebar-scrollbar',
2222
- track: 'simplebar-track',
2223
- visible: 'simplebar-visible',
2224
- horizontal: 'simplebar-horizontal',
2225
- vertical: 'simplebar-vertical',
2226
- hover: 'simplebar-hover',
2227
- dragging: 'simplebar-dragging',
2228
- scrolling: 'simplebar-scrolling',
2229
- scrollable: 'simplebar-scrollable',
2230
- mouseEntered: 'simplebar-mouse-entered'
2231
- },
2232
- scrollableNode: null,
2233
- contentNode: null,
2234
- wrapperNode: null,
2235
- /**
2236
- * 如果是自定义虚拟滚动,content可能是position absolute,此时需要一个实际支撑的元素
2237
- */
2238
- delegateXContent: null,
2239
- delegateYContent: null,
2240
- autoHide: true,
2241
- useSystemScrollXBehavior: true,
2242
- useSystemScrollYBehavior: true,
2243
- onScrollCallback: null
2244
- });
2245
- /**
2246
- * Static functions
2247
- */
2248
- _defineProperty(SimpleBarCore, "helpers", helpers_namespaceObject);
2249
-
2250
- ;// CONCATENATED MODULE: ../../packages/virtual-render/src/bk-scrollbar.ts
2251
-
2252
-
2253
-
2254
-
87
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
2255
88
 
89
+ function toPrimitive(t, r) {
90
+ if ("object" != _typeof(t) || !t) return t;
91
+ var e = t[Symbol.toPrimitive];
92
+ if (void 0 !== e) {
93
+ var i = e.call(t, r || "default");
94
+ if ("object" != _typeof(i)) return i;
95
+ throw new TypeError("@@toPrimitive must return a primitive value.");
96
+ }
97
+ return ("string" === r ? String : Number)(t);
98
+ }
99
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
2256
100
 
2257
101
 
2258
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
2259
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
2260
- /*
2261
- * Tencent is pleased to support the open source community by making
2262
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
2263
- *
2264
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
2265
- *
2266
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
2267
- *
2268
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
2269
- *
2270
- * ---------------------------------------------------
2271
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
2272
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
2273
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
2274
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
2275
- *
2276
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
2277
- * the Software.
2278
- *
2279
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
2280
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
2281
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
2282
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
2283
- * IN THE SOFTWARE.
2284
- */
102
+ function toPropertyKey(t) {
103
+ var i = toPrimitive(t, "string");
104
+ return "symbol" == _typeof(i) ? i : i + "";
105
+ }
106
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
2285
107
 
2286
- var _SimpleBarCore$helper = SimpleBarCore.helpers,
2287
- bk_scrollbar_addClasses = _SimpleBarCore$helper.addClasses,
2288
- bk_scrollbar_classNamesToQuery = _SimpleBarCore$helper.classNamesToQuery;
2289
- var BkSimpleBar = /*#__PURE__*/function (_SimpleBarCore) {
2290
- _inherits(BkSimpleBar, _SimpleBarCore);
2291
- function BkSimpleBar() {
2292
- var _this;
2293
- _classCallCheck(this, BkSimpleBar);
2294
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2295
- args[_key] = arguments[_key];
2296
- }
2297
- _this = _callSuper(this, BkSimpleBar, [].concat(args));
2298
- // // Save a reference to the instance, so we know this DOM node has already been instancied
2299
- BkSimpleBar.instances.set(args[0], _assertThisInitialized(_this));
2300
- return _this;
108
+ function _defineProperty(obj, key, value) {
109
+ key = toPropertyKey(key);
110
+ if (key in obj) {
111
+ Object.defineProperty(obj, key, {
112
+ value: value,
113
+ enumerable: true,
114
+ configurable: true,
115
+ writable: true
116
+ });
117
+ } else {
118
+ obj[key] = value;
2301
119
  }
2302
- _createClass(BkSimpleBar, [{
2303
- key: "initDOM",
2304
- value: function initDOM() {
2305
- var _this$options$wrapper, _this$options$content;
2306
- this.wrapperEl = (_this$options$wrapper = this.options.wrapperNode) !== null && _this$options$wrapper !== void 0 ? _this$options$wrapper : this.createScrollElement(this.classNames.wrapper);
2307
- this.contentEl = (_this$options$content = this.options.contentNode) !== null && _this$options$content !== void 0 ? _this$options$content : this.createScrollElement(this.classNames.contentEl);
2308
- this.delegateXContent = this.options.delegateXContent;
2309
- this.delegateYContent = this.options.delegateYContent;
2310
- if (!this.axis.x.track.el || !this.axis.y.track.el) {
2311
- var track = document.createElement('div');
2312
- var scrollbar = document.createElement('div');
2313
- bk_scrollbar_addClasses(track, this.classNames.track);
2314
- bk_scrollbar_addClasses(scrollbar, this.classNames.scrollbar);
2315
- track.appendChild(scrollbar);
2316
- this.axis.x.track.el = track.cloneNode(true);
2317
- bk_scrollbar_addClasses(this.axis.x.track.el, this.classNames.horizontal);
2318
- this.axis.y.track.el = track.cloneNode(true);
2319
- bk_scrollbar_addClasses(this.axis.y.track.el, this.classNames.vertical);
2320
- this.el.appendChild(this.axis.x.track.el);
2321
- this.el.appendChild(this.axis.y.track.el);
2322
- }
2323
- SimpleBarCore.prototype.initDOM.call(this);
2324
- }
2325
- }, {
2326
- key: "unMount",
2327
- value: function unMount() {
2328
- SimpleBarCore.prototype.unMount.call(this);
2329
- BkSimpleBar.instances["delete"](this.el);
2330
- }
2331
- }, {
2332
- key: "createScrollElement",
2333
- value: function createScrollElement(className) {
2334
- var createEl = function createEl() {
2335
- var el = document.createElement('div');
2336
- bk_scrollbar_addClasses(el, className);
2337
- return el;
2338
- };
2339
- var origin = this.el.querySelector(bk_scrollbar_classNamesToQuery(className));
2340
- return origin !== null && origin !== void 0 ? origin : createEl();
2341
- }
2342
- }], [{
2343
- key: "removeObserver",
2344
- value: function removeObserver() {
2345
- var _BkSimpleBar$globalOb;
2346
- (_BkSimpleBar$globalOb = BkSimpleBar.globalObserver) === null || _BkSimpleBar$globalOb === void 0 || _BkSimpleBar$globalOb.disconnect();
2347
- }
2348
- }]);
2349
- return BkSimpleBar;
2350
- }(SimpleBarCore);
2351
- _defineProperty(BkSimpleBar, "instances", new WeakMap());
120
+ return obj;
121
+ }
122
+ ;// CONCATENATED MODULE: external "vue"
123
+ var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
124
+ var external_vue_y = x => () => x
125
+ const external_vue_namespaceObject = external_vue_x({ ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["h"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.h, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["onUnmounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch });
126
+ ;// CONCATENATED MODULE: external "../config-provider"
127
+ var config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
128
+ var config_provider_y = x => () => x
129
+ const config_provider_namespaceObject = config_provider_x({ ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__.usePrefix });
130
+ ;// CONCATENATED MODULE: ../../packages/virtual-render/src/props.ts
2352
131
 
2353
- ;// CONCATENATED MODULE: ../../packages/virtual-render/src/use-scrollbar.tsx
132
+ 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; }
133
+ 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; }
2354
134
  /*
2355
135
  * Tencent is pleased to support the open source community by making
2356
136
  * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
@@ -2377,60 +157,174 @@ _defineProperty(BkSimpleBar, "instances", new WeakMap());
2377
157
  * IN THE SOFTWARE.
2378
158
  */
2379
159
 
2380
-
2381
- /* harmony default export */ const use_scrollbar = (function (target, props) {
2382
- var instance = null;
2383
- var _usePrefix = (0,config_provider_namespaceObject.usePrefix)(),
2384
- resolveClassName = _usePrefix.resolveClassName;
2385
- var classNames = {
2386
- contentEl: resolveClassName('scrollbar-content-el'),
2387
- wrapper: resolveClassName('scrollbar-wrapper'),
2388
- scrollbar: resolveClassName('scrollbar'),
2389
- track: resolveClassName('scrollbar-track'),
2390
- visible: resolveClassName('scrollbar-visible'),
2391
- horizontal: resolveClassName('scrollbar-horizontal'),
2392
- vertical: resolveClassName('scrollbar-vertical'),
2393
- hover: resolveClassName('scrollbar-hover'),
2394
- dragging: resolveClassName('scrollbar-dragging'),
2395
- scrolling: resolveClassName('scrollbar-scrolling'),
2396
- scrollable: resolveClassName('scrollbar-scrollable'),
2397
- mouseEntered: resolveClassName('scrollbar-mouse-entered')
2398
- };
2399
- var init = function init(scrollFn, delegateXContent, delegateYContent) {
2400
- instance = new BkSimpleBar(target.value, {
2401
- classNames: classNames,
2402
- wrapperNode: target.value,
2403
- useSystemScrollYBehavior: !props.enabled,
2404
- useSystemScrollXBehavior: true,
2405
- delegateXContent: delegateXContent,
2406
- delegateYContent: delegateYContent,
2407
- onScrollCallback: scrollFn
2408
- });
2409
- // instance.getScrollElement().addEventListener('scroll', scrollFn);
160
+ var EventProps = {
161
+ onContentScroll: Function
162
+ };
163
+ var virtualRenderProps = _objectSpread({
164
+ /** 传入原始数据源 */
165
+ list: shared_namespaceObject.PropTypes.array.def([]),
166
+ /**
167
+ * 是否启用此功能
168
+ * 如果设置为false,则此组件只会渲染两层指定的 容器,默认渲染两层 div
169
+ * 设置为true才会启用所有的虚拟渲染 & 滚动相关计算
170
+ * 此属性设置为了兼容需要按需开启\关闭虚拟渲染场景,避免外层设计两套样式架构
171
+ * Note: 目前此属性不支持动态修改
172
+ */
173
+ enabled: shared_namespaceObject.PropTypes.bool.def(true),
174
+ /**
175
+ * 是否启用内置的Scroll Listener
176
+ * 当启用虚拟滚动时(enabled = true),滚动监听为内置生效
177
+ * 只有当(enabled = false)时此配置项才生效
178
+ */
179
+ scrollEvent: shared_namespaceObject.PropTypes.bool.def(false),
180
+ /**
181
+ * 每行数据高度
182
+ * 默认为数值类型,默认高度 30px
183
+ * 如果每行高度不一致,可为回调函数:(index: number, row: any[]): number => {}
184
+ * 函数参数为当前行index & 当前行数据 row,row为数组,当不分组时,为当前行item
185
+ * 如果有分组展示, index 为当前分组 index, row为数组,当前行分组所有 item 数据
186
+ */
187
+ lineHeight: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.number, shared_namespaceObject.PropTypes.func]).def(30),
188
+ /** 整体最小高度 */
189
+ minHeight: shared_namespaceObject.PropTypes.number.def(30),
190
+ /** 整体最大高度 */
191
+ maxHeight: shared_namespaceObject.PropTypes.number,
192
+ /**
193
+ * 整体高度
194
+ * 可设置具体值,如果设置为 100%,则组件会自动计算外层DOM元素offsetHeight,用于计算可渲染行数
195
+ */
196
+ height: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string.def('100%'), shared_namespaceObject.PropTypes.number]).def('100%'),
197
+ /**
198
+ * 渲染区域宽度
199
+ * 如果设置 100% 则自适应外层元素宽度
200
+ */
201
+ width: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string.def('100%'), shared_namespaceObject.PropTypes.number]).def('100%'),
202
+ /** 最外层元素ClassName */
203
+ className: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.string), shared_namespaceObject.PropTypes.object, shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.object), shared_namespaceObject.PropTypes.string]).def(''),
204
+ /** 内层层元素ClassName */
205
+ contentClassName: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.string), shared_namespaceObject.PropTypes.object, shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.object), shared_namespaceObject.PropTypes.string]).def(''),
206
+ /** 内层元素样式 */
207
+ contentStyle: shared_namespaceObject.PropTypes.object.def({}),
208
+ /** 用于自定义X轴滚动条样式 */
209
+ scrollXName: shared_namespaceObject.PropTypes.string.def((0,shared_namespaceObject.resolveClassName)('F-scroll-x')),
210
+ /** 用于自定义Y轴滚动条样式 */
211
+ scrollYName: shared_namespaceObject.PropTypes.string.def((0,shared_namespaceObject.resolveClassName)('F-scroll-y')),
212
+ /** 分组展示,一行数据可能有多条数据 */
213
+ groupItemCount: shared_namespaceObject.PropTypes.number.def(1),
214
+ /** 预加载行数,避免空白渲染 */
215
+ preloadItemCount: shared_namespaceObject.PropTypes.number.def(1),
216
+ /** 外层Dom元素需要渲染成的目标元素 */
217
+ renderAs: shared_namespaceObject.PropTypes.string.def('div'),
218
+ /** 内容层渲染成目标元素 */
219
+ contentAs: shared_namespaceObject.PropTypes.string.def('div'),
220
+ /** top 滚动填充 */
221
+ scrollOffsetTop: shared_namespaceObject.PropTypes.number.def(0),
222
+ /**
223
+ * 内置滚动位置
224
+ * 可选:container (最外层容器),content(内容层容器)
225
+ * Note: container 慎选,需要自己处理样式 & 位置
226
+ */
227
+ scrollPosition: shared_namespaceObject.PropTypes.string.def('content'),
228
+ /**
229
+ * 绝对高度 | 实际高估
230
+ * 可选值: auto(根据行高和行数计算, LineHeight * List.length) number(外层给定高度,若为0,则不显示)
231
+ */
232
+ abosuteHeight: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string.def('auto'), shared_namespaceObject.PropTypes.number]).def('auto'),
233
+ /**
234
+ * 滚动刷新计算间隔时间
235
+ * 默认60 ms
236
+ */
237
+ throttleDelay: shared_namespaceObject.PropTypes.number.def(60),
238
+ rowKey: shared_namespaceObject.PropTypes.string.def(undefined),
239
+ /**
240
+ * 数据改变时是否保持之前的状态
241
+ * 保持滚动条位置、当前渲染区间
242
+ */
243
+ keepAlive: shared_namespaceObject.PropTypes.bool.def(false),
244
+ /**
245
+ * 数据监听改变时,是否自动重置位置到[0, 0]
246
+ */
247
+ autoReset: shared_namespaceObject.PropTypes.bool.def(true),
248
+ wrapperStyle: shared_namespaceObject.PropTypes.any.def({})
249
+ }, EventProps);
250
+ ;// CONCATENATED MODULE: ../../packages/virtual-render/src/use-fix-top.tsx
251
+ /* harmony default export */ const use_fix_top = (function (props, refRoot) {
252
+ var scrollTo = function scrollTo() {
253
+ var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
254
+ left: 0,
255
+ top: 0
256
+ };
257
+ var left = option.left,
258
+ top = option.top;
259
+ refRoot.value.scrollTo(left, top);
2410
260
  };
2411
- var scrollTo = function scrollTo(x, y) {
2412
- var _props$scrollbar;
2413
- if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
2414
- // instance.s.scrollTo(x, y, 100, { keepStruct: props.scrollbar?.keepStruct ?? false });
2415
- return;
261
+ /**
262
+ * 指定元素滚动到顶部
263
+ * @param param0
264
+ */
265
+ var fixToTop = function fixToTop(params) {
266
+ var id = params.id,
267
+ index = params.index,
268
+ item = params.item;
269
+ var targetIndex = typeof index === 'number' ? index - 1 : 0;
270
+ if (id !== undefined) {
271
+ var _props$list$findIndex;
272
+ targetIndex = (_props$list$findIndex = props.list.findIndex(function (row) {
273
+ return row[props.rowKey] === id;
274
+ })) !== null && _props$list$findIndex !== void 0 ? _props$list$findIndex : targetIndex;
275
+ }
276
+ if (item !== undefined) {
277
+ var _props$list$findIndex2;
278
+ targetIndex = (_props$list$findIndex2 = props.list.findIndex(function (row) {
279
+ return item[props.rowKey] === row[props.rowKey];
280
+ })) !== null && _props$list$findIndex2 !== void 0 ? _props$list$findIndex2 : targetIndex;
281
+ }
282
+ if (typeof targetIndex === 'number') {
283
+ var resolvedIndex = targetIndex >= 0 ? targetIndex : 0;
284
+ var offsetY = resolvedIndex * props.lineHeight;
285
+ scrollTo({
286
+ left: 0,
287
+ top: offsetY
288
+ });
2416
289
  }
2417
- target.value.scrollTo(x, y);
2418
290
  };
2419
291
  return {
2420
- init: init,
2421
- instance: instance,
2422
- scrollTo: scrollTo,
2423
- classNames: classNames
292
+ fixToTop: fixToTop,
293
+ scrollTo: scrollTo
2424
294
  };
2425
295
  });
296
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
297
+ function _classCallCheck(instance, Constructor) {
298
+ if (!(instance instanceof Constructor)) {
299
+ throw new TypeError("Cannot call a class as a function");
300
+ }
301
+ }
302
+ ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/createClass.js
303
+
304
+ function _defineProperties(target, props) {
305
+ for (var i = 0; i < props.length; i++) {
306
+ var descriptor = props[i];
307
+ descriptor.enumerable = descriptor.enumerable || false;
308
+ descriptor.configurable = true;
309
+ if ("value" in descriptor) descriptor.writable = true;
310
+ Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
311
+ }
312
+ }
313
+ function _createClass(Constructor, protoProps, staticProps) {
314
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
315
+ if (staticProps) _defineProperties(Constructor, staticProps);
316
+ Object.defineProperty(Constructor, "prototype", {
317
+ writable: false
318
+ });
319
+ return Constructor;
320
+ }
2426
321
  ;// CONCATENATED MODULE: external "lodash/throttle"
2427
322
  var throttle_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
2428
323
  var throttle_y = x => () => x
2429
- const external_lodash_throttle_namespaceObject = throttle_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a__["default"] });
324
+ const throttle_namespaceObject = throttle_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a__["default"] });
2430
325
  ;// CONCATENATED MODULE: ../../packages/virtual-render/src/v-virtual-render.ts
2431
326
 
2432
327
 
2433
-
2434
328
  /*
2435
329
  * Tencent is pleased to support the open source community by making
2436
330
  * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
@@ -2481,14 +375,14 @@ function getMatchedIndex(maxCount, maxHeight, groupItemCount, callback) {
2481
375
  diffHeight: diffHeight
2482
376
  };
2483
377
  }
2484
- function computedVirtualIndex(lineHeight, callback, pagination, wrapper, event) {
2485
- if (!wrapper || !event.offset) {
378
+ function computedVirtualIndex(lineHeight, callback, pagination, _el, event) {
379
+ if (!event.target) {
2486
380
  return;
2487
381
  }
2488
- var elScrollTop = event.offset.y;
2489
- var elScrollLeft = event.offset.x;
2490
- var elScrollHeight = wrapper.scrollHeight;
2491
- var elOffsetHeight = wrapper.offsetHeight;
382
+ var elScrollTop = event.target.scrollTop;
383
+ var elScrollLeft = event.target.scrollLeft;
384
+ var elScrollHeight = event.target.scrollHeight;
385
+ var elOffsetHeight = event.target.offsetHeight;
2492
386
  var count = pagination.count,
2493
387
  groupItemCount = pagination.groupItemCount;
2494
388
  var targetStartIndex = 0;
@@ -2508,8 +402,7 @@ function computedVirtualIndex(lineHeight, callback, pagination, wrapper, event)
2508
402
  }
2509
403
  var bottom = elScrollHeight - elOffsetHeight - elScrollTop;
2510
404
  typeof callback === 'function' && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, {
2511
- bottom: bottom >= 0 ? bottom : 0,
2512
- scrollbar: event
405
+ bottom: bottom >= 0 ? bottom : 0
2513
406
  });
2514
407
  return {
2515
408
  targetStartIndex: targetStartIndex,
@@ -2521,39 +414,13 @@ function computedVirtualIndex(lineHeight, callback, pagination, wrapper, event)
2521
414
  }
2522
415
  var VisibleRender = /*#__PURE__*/function () {
2523
416
  function VisibleRender(binding, el) {
2524
- var _this = this;
2525
417
  _classCallCheck(this, VisibleRender);
2526
- _defineProperty(this, "getEvent", function (event) {
2527
- var _this$binding$value$s = _this.binding.value.scrollbar,
2528
- scrollbar = _this$binding$value$s === void 0 ? {
2529
- enabled: false
2530
- } : _this$binding$value$s;
2531
- if (scrollbar.enabled) {
2532
- var _event$offset;
2533
- return {
2534
- offset: (_event$offset = event.offset) !== null && _event$offset !== void 0 ? _event$offset : event
2535
- };
2536
- }
2537
- if (event !== null && event !== void 0 && event.offset) {
2538
- return {
2539
- offset: event === null || event === void 0 ? void 0 : event.offset
2540
- };
2541
- }
2542
- var elScrollTop = event.target.scrollTop;
2543
- var elScrollLeft = event.target.scrollLeft;
2544
- return {
2545
- offset: {
2546
- x: elScrollLeft,
2547
- y: elScrollTop
2548
- }
2549
- };
2550
- });
2551
418
  this.binding = binding;
2552
419
  this.wrapper = el;
2553
420
  var throttleDelay = binding.value.throttleDelay;
2554
421
  this.delay = throttleDelay;
2555
422
  }
2556
- _createClass(VisibleRender, [{
423
+ return _createClass(VisibleRender, [{
2557
424
  key: "render",
2558
425
  value: function render(e) {
2559
426
  var _this$binding$value = this.binding.value,
@@ -2564,13 +431,11 @@ var VisibleRender = /*#__PURE__*/function () {
2564
431
  pagination = _this$binding$value$p === void 0 ? {} : _this$binding$value$p,
2565
432
  onlyScroll = _this$binding$value.onlyScroll;
2566
433
  if (onlyScroll) {
2567
- var _e$offset, _e$offset$x, _e$offset2;
2568
- var elScrollTop = (_e$offset = e.offset) === null || _e$offset === void 0 ? void 0 : _e$offset.y;
2569
- var elScrollLeft = (_e$offset$x = (_e$offset2 = e.offset) === null || _e$offset2 === void 0 ? void 0 : _e$offset2.x) !== null && _e$offset$x !== void 0 ? _e$offset$x : 0;
2570
- var bottom = this.wrapper.scrollHeight - this.wrapper.offsetHeight - elScrollTop;
434
+ var elScrollTop = this.wrapper.scrollTop;
435
+ var elScrollLeft = this.wrapper.scrollLeft;
436
+ var bottom = this.wrapper.scrollHeight - this.wrapper.offsetHeight - this.wrapper.scrollTop;
2571
437
  handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, {
2572
- bottom: bottom >= 0 ? bottom : 0,
2573
- scrollbar: e
438
+ bottom: bottom >= 0 ? bottom : 0
2574
439
  });
2575
440
  return;
2576
441
  }
@@ -2592,7 +457,7 @@ var VisibleRender = /*#__PURE__*/function () {
2592
457
  }, {
2593
458
  key: "executeThrottledRender",
2594
459
  value: function executeThrottledRender(e) {
2595
- (0,external_lodash_throttle_namespaceObject["default"])(this.render.bind(this), this.delay)(this.getEvent(e));
460
+ (0,throttle_namespaceObject["default"])(this.render.bind(this), this.delay)(e);
2596
461
  }
2597
462
  }, {
2598
463
  key: "install",
@@ -2612,7 +477,6 @@ var VisibleRender = /*#__PURE__*/function () {
2612
477
  this.binding = binding;
2613
478
  }
2614
479
  }]);
2615
- return VisibleRender;
2616
480
  }();
2617
481
  var instance = null;
2618
482
  /* harmony default export */ const v_virtual_render = ({
@@ -2667,46 +531,28 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
2667
531
 
2668
532
 
2669
533
 
2670
-
2671
534
  /* harmony default export */ const use_tag_render = (function (props, ctx) {
2672
535
  var renderAs = props.renderAs,
2673
536
  contentAs = props.contentAs;
2674
- var refRoot = (0,external_vue_namespaceObject.ref)(null);
2675
- var _useScrollbar = use_scrollbar(refRoot, props),
2676
- init = _useScrollbar.init,
2677
- scrollTo = _useScrollbar.scrollTo,
2678
- classNames = _useScrollbar.classNames;
2679
- var contentStyle = (0,external_vue_namespaceObject.reactive)({
2680
- x: 0,
2681
- y: 0
2682
- });
2683
- var computedStyle = (0,external_vue_namespaceObject.computed)(function () {
2684
- return use_tag_render_objectSpread({}, props.contentStyle);
2685
- });
2686
537
  /** 指令触发Scroll事件,计算当前startIndex & endIndex & scrollTop & translateY */
2687
538
  var handleScrollCallback = function handleScrollCallback(event, _startIndex, _endIndex, _scrollTop, translateY, scrollLeft, pos) {
2688
- var scrollbar = pos.scrollbar;
2689
- if (scrollbar !== null && scrollbar !== void 0 && scrollbar.offset) {
2690
- var _scrollbar$offset;
2691
- Object.assign(contentStyle, (_scrollbar$offset = scrollbar === null || scrollbar === void 0 ? void 0 : scrollbar.offset) !== null && _scrollbar$offset !== void 0 ? _scrollbar$offset : {});
2692
- }
2693
539
  ctx.emit('content-scroll', [event, {
2694
540
  translateY: translateY,
2695
541
  translateX: scrollLeft,
2696
542
  pos: pos
2697
543
  }]);
2698
544
  };
2699
- var renderInstance = null;
545
+ var instance = null;
2700
546
  var binding = (0,external_vue_namespaceObject.computed)(function () {
2701
547
  return {
2702
548
  lineHeight: props.lineHeight,
2703
- scrollbar: props.scrollbar,
2704
549
  handleScrollCallback: handleScrollCallback,
2705
550
  pagination: {},
2706
551
  throttleDelay: props.throttleDelay,
2707
552
  onlyScroll: props.scrollEvent
2708
553
  };
2709
554
  });
555
+ var refRoot = (0,external_vue_namespaceObject.ref)(null);
2710
556
  /** 虚拟渲染外层容器样式 */
2711
557
  var wrapperStyle = (0,external_vue_namespaceObject.computed)(function () {
2712
558
  var _props$maxHeight;
@@ -2718,36 +564,20 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
2718
564
  maxHeight: (_props$maxHeight = props.maxHeight) !== null && _props$maxHeight !== void 0 ? _props$maxHeight : height
2719
565
  }, props.wrapperStyle);
2720
566
  });
2721
- var _useFixTop = use_fix_top(props, scrollTo),
567
+ var _useFixTop = use_fix_top(props, refRoot),
568
+ scrollTo = _useFixTop.scrollTo,
2722
569
  fixToTop = _useFixTop.fixToTop;
2723
570
  ctx.expose({
2724
571
  scrollTo: scrollTo,
2725
572
  fixToTop: fixToTop
2726
573
  });
2727
574
  (0,external_vue_namespaceObject.onMounted)(function () {
2728
- var _props$scrollbar;
2729
- renderInstance = new VisibleRender(binding, refRoot.value);
2730
- if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
2731
- init(renderInstance.executeThrottledRender.bind(renderInstance));
2732
- return;
2733
- }
2734
- renderInstance.install();
575
+ instance = new VisibleRender(binding, refRoot.value);
576
+ instance.install();
2735
577
  });
2736
578
  (0,external_vue_namespaceObject.onUnmounted)(function () {
2737
- var _renderInstance;
2738
- (_renderInstance = renderInstance) === null || _renderInstance === void 0 || _renderInstance.uninstall();
2739
- });
2740
- var wrapperClassNames = (0,external_vue_namespaceObject.computed)(function () {
2741
- if (props.scrollbar.enabled) {
2742
- return [props.className, classNames.wrapper];
2743
- }
2744
- return [props.className];
2745
- });
2746
- var contentClassNames = (0,external_vue_namespaceObject.computed)(function () {
2747
- if (props.scrollbar.enabled) {
2748
- return [props.contentClassName, classNames.contentEl];
2749
- }
2750
- return [props.contentClassName];
579
+ var _instance;
580
+ (_instance = instance) === null || _instance === void 0 || _instance.uninstall();
2751
581
  });
2752
582
  return {
2753
583
  rendAsTag: function rendAsTag() {
@@ -2755,12 +585,12 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
2755
585
  return (0,external_vue_namespaceObject.h)(
2756
586
  // @ts-ignore:next-line
2757
587
  renderAs, {
2758
- "class": wrapperClassNames.value,
588
+ "class": props.className,
2759
589
  style: wrapperStyle.value,
2760
590
  ref: refRoot
2761
591
  }, [(_ctx$slots$beforeCont = (_ctx$slots$beforeCont2 = (_ctx$slots = ctx.slots).beforeContent) === null || _ctx$slots$beforeCont2 === void 0 ? void 0 : _ctx$slots$beforeCont2.call(_ctx$slots)) !== null && _ctx$slots$beforeCont !== void 0 ? _ctx$slots$beforeCont : '', (0,external_vue_namespaceObject.h)(contentAs, {
2762
- "class": contentClassNames.value,
2763
- style: computedStyle.value
592
+ "class": props.contentClassName,
593
+ style: props.contentStyle
2764
594
  }, [(_ctx$slots$default = (_ctx$slots$default2 = (_ctx$slots2 = ctx.slots)["default"]) === null || _ctx$slots$default2 === void 0 ? void 0 : _ctx$slots$default2.call(_ctx$slots2, {
2765
595
  data: props.list
2766
596
  })) !== null && _ctx$slots$default !== void 0 ? _ctx$slots$default : '']), (_ctx$slots$afterConte = (_ctx$slots$afterConte2 = (_ctx$slots3 = ctx.slots).afterContent) === null || _ctx$slots$afterConte2 === void 0 ? void 0 : _ctx$slots$afterConte2.call(_ctx$slots3)) !== null && _ctx$slots$afterConte !== void 0 ? _ctx$slots$afterConte : '', (_ctx$slots$afterSecti = (_ctx$slots$afterSecti2 = (_ctx$slots4 = ctx.slots).afterSection) === null || _ctx$slots$afterSecti2 === void 0 ? void 0 : _ctx$slots$afterSecti2.call(_ctx$slots4)) !== null && _ctx$slots$afterSecti !== void 0 ? _ctx$slots$afterSecti : '']);
@@ -2809,7 +639,6 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
2809
639
 
2810
640
 
2811
641
 
2812
-
2813
642
  /* harmony default export */ const virtual_render = ((0,external_vue_namespaceObject.defineComponent)({
2814
643
  name: 'VirtualRender',
2815
644
  directives: {
@@ -2841,16 +670,10 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
2841
670
  lineHeight: props.lineHeight,
2842
671
  handleScrollCallback: handleScrollCallback,
2843
672
  pagination: pagination,
2844
- throttleDelay: props.throttleDelay,
2845
- scrollbar: props.scrollbar
673
+ throttleDelay: props.throttleDelay
2846
674
  };
2847
675
  });
2848
676
  var refRoot = (0,external_vue_namespaceObject.ref)(null);
2849
- var _useScrollbar = use_scrollbar(refRoot, props),
2850
- init = _useScrollbar.init,
2851
- scrollTo = _useScrollbar.scrollTo,
2852
- classNames = _useScrollbar.classNames;
2853
- var refVirtualSection = (0,external_vue_namespaceObject.ref)(null);
2854
677
  var instance = null;
2855
678
  var pagination = (0,external_vue_namespaceObject.reactive)({
2856
679
  startIndex: 0,
@@ -2893,18 +716,7 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
2893
716
  }
2894
717
  };
2895
718
  (0,external_vue_namespaceObject.onMounted)(function () {
2896
- var _props$scrollbar;
2897
719
  instance = new VisibleRender(binding, refRoot.value);
2898
- if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
2899
- init(instance.executeThrottledRender.bind(instance), null, refVirtualSection.value);
2900
- instance.executeThrottledRender.call(instance, {
2901
- offset: {
2902
- x: 0,
2903
- y: 0
2904
- }
2905
- });
2906
- return;
2907
- }
2908
720
  instance.install();
2909
721
  });
2910
722
  (0,external_vue_namespaceObject.onUnmounted)(function () {
@@ -2968,7 +780,10 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
2968
780
  });
2969
781
  /** 展示列表内容区域样式 */
2970
782
  var innerContentStyle = (0,external_vue_namespaceObject.computed)(function () {
2971
- return props.scrollPosition === 'content' ? {} : {};
783
+ return props.scrollPosition === 'content' ? {
784
+ top: "".concat(pagination.scrollTop + props.scrollOffsetTop, "px"),
785
+ transform: "translateY(-".concat(pagination.translateY, "px)")
786
+ } : {};
2972
787
  });
2973
788
  /** 虚拟渲染外层容器样式 */
2974
789
  var wrapperStyle = (0,external_vue_namespaceObject.computed)(function () {
@@ -2993,7 +808,7 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
2993
808
  resolveClassName = _usePrefix.resolveClassName;
2994
809
  /** 外层样式列表 */
2995
810
  var wrapperClass = (0,external_vue_namespaceObject.computed)(function () {
2996
- return [resolveClassName('virtual-render')].concat(_toConsumableArray(resolvePropClassName(props.className)), [props.scrollPosition === 'container' ? resolveClassName('virtual-content') : '']);
811
+ return [resolveClassName('virtual-render'), props.scrollXName, props.scrollYName].concat(_toConsumableArray(resolvePropClassName(props.className)), [props.scrollPosition === 'container' ? resolveClassName('virtual-content') : '']);
2997
812
  });
2998
813
  /** 内容区域样式列表 */
2999
814
  var innerClass = (0,external_vue_namespaceObject.computed)(function () {
@@ -3004,33 +819,20 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
3004
819
  * @param keepLastPostion
3005
820
  */
3006
821
  var reset = function reset() {
3007
- var _instance2;
3008
822
  handleChangeListConfig();
3009
823
  afterListDataReset();
3010
- (_instance2 = instance) === null || _instance2 === void 0 || _instance2.executeThrottledRender.call(instance, {
3011
- offset: {
3012
- x: 0,
3013
- y: 0
3014
- }
3015
- });
3016
824
  };
3017
- var _useFixTop = use_fix_top(props, scrollTo),
825
+ var _useFixTop = use_fix_top(props, refRoot),
826
+ scrollTo = _useFixTop.scrollTo,
3018
827
  fixToTop = _useFixTop.fixToTop;
3019
828
  (0,external_vue_namespaceObject.watch)(function () {
3020
829
  return [props.lineHeight, props.height, props.list, props.maxHeight];
3021
830
  }, function () {
3022
- var _instance3;
3023
- (_instance3 = instance) === null || _instance3 === void 0 || _instance3.setBinding(binding);
831
+ var _instance2;
832
+ (_instance2 = instance) === null || _instance2 === void 0 || _instance2.setBinding(binding);
3024
833
  handleChangeListConfig();
3025
834
  (0,external_vue_namespaceObject.nextTick)(function () {
3026
- var _instance4;
3027
835
  afterListDataReset();
3028
- (_instance4 = instance) === null || _instance4 === void 0 || _instance4.executeThrottledRender.call(instance, {
3029
- offset: {
3030
- x: 0,
3031
- y: 0
3032
- }
3033
- });
3034
836
  });
3035
837
  }, {
3036
838
  deep: true,
@@ -3047,15 +849,14 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
3047
849
  // @ts-ignore:next-line
3048
850
  renderAs || 'div', {
3049
851
  ref: refRoot,
3050
- "class": [].concat(_toConsumableArray(wrapperClass.value), [classNames.wrapper]),
852
+ "class": wrapperClass.value,
3051
853
  style: wrapperStyle.value
3052
854
  }, [(_ctx$slots$beforeCont = (_ctx$slots$beforeCont2 = (_ctx$slots = ctx.slots).beforeContent) === null || _ctx$slots$beforeCont2 === void 0 ? void 0 : _ctx$slots$beforeCont2.call(_ctx$slots)) !== null && _ctx$slots$beforeCont !== void 0 ? _ctx$slots$beforeCont : '', (0,external_vue_namespaceObject.h)(contentAs || 'div', {
3053
- "class": [].concat(_toConsumableArray(innerClass.value), [classNames.contentEl]),
855
+ "class": innerClass.value,
3054
856
  style: virtual_render_objectSpread(virtual_render_objectSpread({}, innerContentStyle.value), props.contentStyle)
3055
857
  }, [(_ctx$slots$default = (_ctx$slots$default2 = (_ctx$slots2 = ctx.slots)["default"]) === null || _ctx$slots$default2 === void 0 ? void 0 : _ctx$slots$default2.call(_ctx$slots2, {
3056
858
  data: calcList.value
3057
859
  })) !== null && _ctx$slots$default !== void 0 ? _ctx$slots$default : '']), (_ctx$slots$afterConte = (_ctx$slots$afterConte2 = (_ctx$slots3 = ctx.slots).afterContent) === null || _ctx$slots$afterConte2 === void 0 ? void 0 : _ctx$slots$afterConte2.call(_ctx$slots3)) !== null && _ctx$slots$afterConte !== void 0 ? _ctx$slots$afterConte : '', (0,external_vue_namespaceObject.h)('div', {
3058
- ref: refVirtualSection,
3059
860
  "class": [resolveClassName('virtual-section')],
3060
861
  style: innerStyle.value
3061
862
  }), (_ctx$slots$afterSecti = (_ctx$slots$afterSecti2 = (_ctx$slots4 = ctx.slots).afterSection) === null || _ctx$slots$afterSecti2 === void 0 ? void 0 : _ctx$slots$afterSecti2.call(_ctx$slots4)) !== null && _ctx$slots$afterSecti !== void 0 ? _ctx$slots$afterSecti : '']);
@@ -3097,7 +898,5 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
3097
898
 
3098
899
  var BkVirtualRender = (0,shared_namespaceObject.withInstall)(virtual_render);
3099
900
  /* harmony default export */ const src = (BkVirtualRender);
3100
- })();
3101
-
3102
901
  var __webpack_exports__default = __webpack_exports__["default"];
3103
902
  export { __webpack_exports__default as default };