bkui-vue 1.0.3-beta.60.scrollbar.5 → 1.0.3-beta.61.dialog.1

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