bkui-vue 1.0.3-beta.60.scrollbar.5 → 1.0.3-beta.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +50 -52
- package/dist/index.esm.js +13977 -14662
- package/dist/index.umd.js +50 -52
- package/dist/style.css +1 -1
- package/dist/style.variable.css +1 -1
- package/lib/components.d.ts +1 -0
- package/lib/components.js +2 -1
- package/lib/date-picker/index.js +1 -1
- package/lib/dialog/dialog.css +7 -9
- package/lib/dialog/dialog.variable.css +7 -9
- package/lib/info-box/index.js +1 -0
- package/lib/modal/hooks.d.ts +1 -1
- package/lib/modal/index.d.ts +3 -0
- package/lib/modal/index.js +21 -22
- package/lib/modal/modal.css +7 -9
- package/lib/modal/modal.d.ts +1 -0
- package/lib/modal/modal.less +11 -18
- package/lib/modal/modal.variable.css +7 -9
- package/lib/search-select/index.d.ts +327 -12
- package/lib/search-select/index.js +620 -340
- package/lib/search-select/input.d.ts +6 -1
- package/lib/search-select/search-select.css +20 -6
- package/lib/search-select/search-select.d.ts +109 -4
- package/lib/search-select/search-select.less +16 -12
- package/lib/search-select/search-select.variable.css +20 -6
- package/lib/search-select/selected.d.ts +107 -5
- package/lib/search-select/utils.d.ts +13 -1
- package/lib/select/index.d.ts +56 -0
- package/lib/select/index.js +8 -3
- package/lib/select/select.css +19 -5
- package/lib/select/select.d.ts +22 -0
- package/lib/select/select.less +26 -6
- package/lib/select/select.variable.css +19 -5
- package/lib/select/selectTagInput.d.ts +7 -0
- package/lib/sideslider/sideslider.css +0 -5
- package/lib/sideslider/sideslider.less +8 -14
- package/lib/sideslider/sideslider.variable.css +0 -5
- package/lib/table/const.d.ts +1 -1
- package/lib/table/index.js +18 -18
- package/lib/table/plugins/use-fixed-column.d.ts +1 -1
- package/lib/table/table.css +42 -96
- package/lib/table/table.less +56 -41
- package/lib/table/table.variable.css +42 -96
- package/lib/table/use-render.d.ts +1 -1
- package/lib/table-column/index.js +1 -1
- package/lib/timeline/index.js +1 -0
- package/lib/tree/tree.css +2 -75
- package/lib/tree/tree.variable.css +2 -75
- package/lib/upload/index.d.ts +12 -0
- package/lib/upload/index.js +21 -30
- package/lib/upload/props.d.ts +3 -0
- package/lib/upload/upload-trigger.d.ts +6 -0
- package/lib/upload/upload.d.ts +6 -0
- package/lib/virtual-render/index.d.ts +0 -4
- package/lib/virtual-render/index.js +232 -2346
- package/lib/virtual-render/props.d.ts +0 -7
- package/lib/virtual-render/use-fix-top.d.ts +7 -2
- package/lib/virtual-render/v-virtual-render.d.ts +1 -2
- package/lib/virtual-render/virtual-render.css +2 -75
- package/lib/virtual-render/virtual-render.d.ts +0 -2
- package/lib/virtual-render/virtual-render.less +2 -2
- package/lib/virtual-render/virtual-render.variable.css +2 -75
- package/package.json +1 -2
- package/lib/virtual-render/bk-scrollbar.css +0 -74
- package/lib/virtual-render/bk-scrollbar.d.ts +0 -10
- package/lib/virtual-render/bk-scrollbar.less +0 -93
- package/lib/virtual-render/bk-scrollbar.variable.css +0 -203
- package/lib/virtual-render/scrollbar-core/can-use-dom.d.ts +0 -2
- package/lib/virtual-render/scrollbar-core/helpers.d.ts +0 -5
- package/lib/virtual-render/scrollbar-core/index.d.ts +0 -213
- package/lib/virtual-render/scrollbar-core/mouse-wheel.d.ts +0 -5
- package/lib/virtual-render/scrollbar-core/scrollbar-width.d.ts +0 -1
- package/lib/virtual-render/use-scrollbar.d.ts +0 -23
@@ -3,7 +3,6 @@ import "./virtual-render.less";
|
|
3
3
|
import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_shared_edbdfb03__ from "../shared";
|
4
4
|
import * as __WEBPACK_EXTERNAL_MODULE_vue__ from "vue";
|
5
5
|
import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__ from "../config-provider";
|
6
|
-
import * as __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__ from "vue-types";
|
7
6
|
import * as __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a__ from "lodash/throttle";
|
8
7
|
/******/ // The require scope
|
9
8
|
/******/ var __webpack_require__ = {};
|
@@ -26,17 +25,6 @@ import * as __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a__ from "lodash/th
|
|
26
25
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
27
26
|
/******/ })();
|
28
27
|
/******/
|
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
28
|
/************************************************************************/
|
41
29
|
var __webpack_exports__ = {};
|
42
30
|
|
@@ -45,17 +33,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
45
33
|
"default": () => (/* binding */ src)
|
46
34
|
});
|
47
35
|
|
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
36
|
;// CONCATENATED MODULE: external "../shared"
|
60
37
|
var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
61
38
|
var y = x => () => x
|
@@ -107,2166 +84,53 @@ function _typeof(o) {
|
|
107
84
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
108
85
|
}, _typeof(o);
|
109
86
|
}
|
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);
|
2167
|
-
|
2168
|
-
;// CONCATENATED MODULE: ../../packages/virtual-render/src/bk-scrollbar.ts
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
87
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
2172
88
|
|
89
|
+
function toPrimitive(t, r) {
|
90
|
+
if ("object" != _typeof(t) || !t) return t;
|
91
|
+
var e = t[Symbol.toPrimitive];
|
92
|
+
if (void 0 !== e) {
|
93
|
+
var i = e.call(t, r || "default");
|
94
|
+
if ("object" != _typeof(i)) return i;
|
95
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
96
|
+
}
|
97
|
+
return ("string" === r ? String : Number)(t);
|
98
|
+
}
|
99
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
2173
100
|
|
2174
101
|
|
2175
|
-
function
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
*
|
2181
|
-
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
2182
|
-
*
|
2183
|
-
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
|
2184
|
-
*
|
2185
|
-
* License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
|
2186
|
-
*
|
2187
|
-
* ---------------------------------------------------
|
2188
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
2189
|
-
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
2190
|
-
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
2191
|
-
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
2192
|
-
*
|
2193
|
-
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
2194
|
-
* the Software.
|
2195
|
-
*
|
2196
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
2197
|
-
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
2198
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
2199
|
-
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
2200
|
-
* IN THE SOFTWARE.
|
2201
|
-
*/
|
102
|
+
function toPropertyKey(t) {
|
103
|
+
var i = toPrimitive(t, "string");
|
104
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
105
|
+
}
|
106
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
2202
107
|
|
2203
|
-
|
2204
|
-
|
2205
|
-
|
2206
|
-
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
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;
|
108
|
+
function _defineProperty(obj, key, value) {
|
109
|
+
key = toPropertyKey(key);
|
110
|
+
if (key in obj) {
|
111
|
+
Object.defineProperty(obj, key, {
|
112
|
+
value: value,
|
113
|
+
enumerable: true,
|
114
|
+
configurable: true,
|
115
|
+
writable: true
|
116
|
+
});
|
117
|
+
} else {
|
118
|
+
obj[key] = value;
|
2217
119
|
}
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
|
2222
|
-
|
2223
|
-
|
2224
|
-
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2228
|
-
|
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);
|
2241
|
-
}
|
2242
|
-
}, {
|
2243
|
-
key: "unMount",
|
2244
|
-
value: function unMount() {
|
2245
|
-
SimpleBarCore.prototype.unMount.call(this);
|
2246
|
-
BkSimpleBar.instances["delete"](this.el);
|
2247
|
-
}
|
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();
|
2258
|
-
}
|
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();
|
2264
|
-
}
|
2265
|
-
}]);
|
2266
|
-
}(SimpleBarCore);
|
2267
|
-
_defineProperty(BkSimpleBar, "instances", new WeakMap());
|
120
|
+
return obj;
|
121
|
+
}
|
122
|
+
;// CONCATENATED MODULE: external "vue"
|
123
|
+
var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
124
|
+
var external_vue_y = x => () => x
|
125
|
+
const external_vue_namespaceObject = external_vue_x({ ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["h"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.h, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["onUnmounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["watch"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watch });
|
126
|
+
;// CONCATENATED MODULE: external "../config-provider"
|
127
|
+
var config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
128
|
+
var config_provider_y = x => () => x
|
129
|
+
const config_provider_namespaceObject = config_provider_x({ ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__.usePrefix });
|
130
|
+
;// CONCATENATED MODULE: ../../packages/virtual-render/src/props.ts
|
2268
131
|
|
2269
|
-
|
132
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
133
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
2270
134
|
/*
|
2271
135
|
* Tencent is pleased to support the open source community by making
|
2272
136
|
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
@@ -2293,60 +157,174 @@ _defineProperty(BkSimpleBar, "instances", new WeakMap());
|
|
2293
157
|
* IN THE SOFTWARE.
|
2294
158
|
*/
|
2295
159
|
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2325
|
-
|
160
|
+
var EventProps = {
|
161
|
+
onContentScroll: Function
|
162
|
+
};
|
163
|
+
var virtualRenderProps = _objectSpread({
|
164
|
+
/** 传入原始数据源 */
|
165
|
+
list: shared_namespaceObject.PropTypes.array.def([]),
|
166
|
+
/**
|
167
|
+
* 是否启用此功能
|
168
|
+
* 如果设置为false,则此组件只会渲染两层指定的 容器,默认渲染两层 div
|
169
|
+
* 设置为true才会启用所有的虚拟渲染 & 滚动相关计算
|
170
|
+
* 此属性设置为了兼容需要按需开启\关闭虚拟渲染场景,避免外层设计两套样式架构
|
171
|
+
* Note: 目前此属性不支持动态修改
|
172
|
+
*/
|
173
|
+
enabled: shared_namespaceObject.PropTypes.bool.def(true),
|
174
|
+
/**
|
175
|
+
* 是否启用内置的Scroll Listener
|
176
|
+
* 当启用虚拟滚动时(enabled = true),滚动监听为内置生效
|
177
|
+
* 只有当(enabled = false)时此配置项才生效
|
178
|
+
*/
|
179
|
+
scrollEvent: shared_namespaceObject.PropTypes.bool.def(false),
|
180
|
+
/**
|
181
|
+
* 每行数据高度
|
182
|
+
* 默认为数值类型,默认高度 30px
|
183
|
+
* 如果每行高度不一致,可为回调函数:(index: number, row: any[]): number => {}
|
184
|
+
* 函数参数为当前行index & 当前行数据 row,row为数组,当不分组时,为当前行item
|
185
|
+
* 如果有分组展示, index 为当前分组 index, row为数组,当前行分组所有 item 数据
|
186
|
+
*/
|
187
|
+
lineHeight: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.number, shared_namespaceObject.PropTypes.func]).def(30),
|
188
|
+
/** 整体最小高度 */
|
189
|
+
minHeight: shared_namespaceObject.PropTypes.number.def(30),
|
190
|
+
/** 整体最大高度 */
|
191
|
+
maxHeight: shared_namespaceObject.PropTypes.number,
|
192
|
+
/**
|
193
|
+
* 整体高度
|
194
|
+
* 可设置具体值,如果设置为 100%,则组件会自动计算外层DOM元素offsetHeight,用于计算可渲染行数
|
195
|
+
*/
|
196
|
+
height: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string.def('100%'), shared_namespaceObject.PropTypes.number]).def('100%'),
|
197
|
+
/**
|
198
|
+
* 渲染区域宽度
|
199
|
+
* 如果设置 100% 则自适应外层元素宽度
|
200
|
+
*/
|
201
|
+
width: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string.def('100%'), shared_namespaceObject.PropTypes.number]).def('100%'),
|
202
|
+
/** 最外层元素ClassName */
|
203
|
+
className: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.string), shared_namespaceObject.PropTypes.object, shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.object), shared_namespaceObject.PropTypes.string]).def(''),
|
204
|
+
/** 内层层元素ClassName */
|
205
|
+
contentClassName: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.string), shared_namespaceObject.PropTypes.object, shared_namespaceObject.PropTypes.arrayOf(shared_namespaceObject.PropTypes.object), shared_namespaceObject.PropTypes.string]).def(''),
|
206
|
+
/** 内层元素样式 */
|
207
|
+
contentStyle: shared_namespaceObject.PropTypes.object.def({}),
|
208
|
+
/** 用于自定义X轴滚动条样式 */
|
209
|
+
scrollXName: shared_namespaceObject.PropTypes.string.def((0,shared_namespaceObject.resolveClassName)('F-scroll-x')),
|
210
|
+
/** 用于自定义Y轴滚动条样式 */
|
211
|
+
scrollYName: shared_namespaceObject.PropTypes.string.def((0,shared_namespaceObject.resolveClassName)('F-scroll-y')),
|
212
|
+
/** 分组展示,一行数据可能有多条数据 */
|
213
|
+
groupItemCount: shared_namespaceObject.PropTypes.number.def(1),
|
214
|
+
/** 预加载行数,避免空白渲染 */
|
215
|
+
preloadItemCount: shared_namespaceObject.PropTypes.number.def(1),
|
216
|
+
/** 外层Dom元素需要渲染成的目标元素 */
|
217
|
+
renderAs: shared_namespaceObject.PropTypes.string.def('div'),
|
218
|
+
/** 内容层渲染成目标元素 */
|
219
|
+
contentAs: shared_namespaceObject.PropTypes.string.def('div'),
|
220
|
+
/** top 滚动填充 */
|
221
|
+
scrollOffsetTop: shared_namespaceObject.PropTypes.number.def(0),
|
222
|
+
/**
|
223
|
+
* 内置滚动位置
|
224
|
+
* 可选:container (最外层容器),content(内容层容器)
|
225
|
+
* Note: container 慎选,需要自己处理样式 & 位置
|
226
|
+
*/
|
227
|
+
scrollPosition: shared_namespaceObject.PropTypes.string.def('content'),
|
228
|
+
/**
|
229
|
+
* 绝对高度 | 实际高估
|
230
|
+
* 可选值: auto(根据行高和行数计算, LineHeight * List.length) number(外层给定高度,若为0,则不显示)
|
231
|
+
*/
|
232
|
+
abosuteHeight: shared_namespaceObject.PropTypes.oneOfType([shared_namespaceObject.PropTypes.string.def('auto'), shared_namespaceObject.PropTypes.number]).def('auto'),
|
233
|
+
/**
|
234
|
+
* 滚动刷新计算间隔时间
|
235
|
+
* 默认60 ms
|
236
|
+
*/
|
237
|
+
throttleDelay: shared_namespaceObject.PropTypes.number.def(60),
|
238
|
+
rowKey: shared_namespaceObject.PropTypes.string.def(undefined),
|
239
|
+
/**
|
240
|
+
* 数据改变时是否保持之前的状态
|
241
|
+
* 保持滚动条位置、当前渲染区间
|
242
|
+
*/
|
243
|
+
keepAlive: shared_namespaceObject.PropTypes.bool.def(false),
|
244
|
+
/**
|
245
|
+
* 数据监听改变时,是否自动重置位置到[0, 0]
|
246
|
+
*/
|
247
|
+
autoReset: shared_namespaceObject.PropTypes.bool.def(true),
|
248
|
+
wrapperStyle: shared_namespaceObject.PropTypes.any.def({})
|
249
|
+
}, EventProps);
|
250
|
+
;// CONCATENATED MODULE: ../../packages/virtual-render/src/use-fix-top.tsx
|
251
|
+
/* harmony default export */ const use_fix_top = (function (props, refRoot) {
|
252
|
+
var scrollTo = function scrollTo() {
|
253
|
+
var option = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
254
|
+
left: 0,
|
255
|
+
top: 0
|
256
|
+
};
|
257
|
+
var left = option.left,
|
258
|
+
top = option.top;
|
259
|
+
refRoot.value.scrollTo(left, top);
|
2326
260
|
};
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
261
|
+
/**
|
262
|
+
* 指定元素滚动到顶部
|
263
|
+
* @param param0
|
264
|
+
*/
|
265
|
+
var fixToTop = function fixToTop(params) {
|
266
|
+
var id = params.id,
|
267
|
+
index = params.index,
|
268
|
+
item = params.item;
|
269
|
+
var targetIndex = typeof index === 'number' ? index - 1 : 0;
|
270
|
+
if (id !== undefined) {
|
271
|
+
var _props$list$findIndex;
|
272
|
+
targetIndex = (_props$list$findIndex = props.list.findIndex(function (row) {
|
273
|
+
return row[props.rowKey] === id;
|
274
|
+
})) !== null && _props$list$findIndex !== void 0 ? _props$list$findIndex : targetIndex;
|
275
|
+
}
|
276
|
+
if (item !== undefined) {
|
277
|
+
var _props$list$findIndex2;
|
278
|
+
targetIndex = (_props$list$findIndex2 = props.list.findIndex(function (row) {
|
279
|
+
return item[props.rowKey] === row[props.rowKey];
|
280
|
+
})) !== null && _props$list$findIndex2 !== void 0 ? _props$list$findIndex2 : targetIndex;
|
281
|
+
}
|
282
|
+
if (typeof targetIndex === 'number') {
|
283
|
+
var resolvedIndex = targetIndex >= 0 ? targetIndex : 0;
|
284
|
+
var offsetY = resolvedIndex * props.lineHeight;
|
285
|
+
scrollTo({
|
286
|
+
left: 0,
|
287
|
+
top: offsetY
|
288
|
+
});
|
2332
289
|
}
|
2333
|
-
target.value.scrollTo(x, y);
|
2334
290
|
};
|
2335
291
|
return {
|
2336
|
-
|
2337
|
-
|
2338
|
-
scrollTo: scrollTo,
|
2339
|
-
classNames: classNames
|
292
|
+
fixToTop: fixToTop,
|
293
|
+
scrollTo: scrollTo
|
2340
294
|
};
|
2341
295
|
});
|
296
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
297
|
+
function _classCallCheck(instance, Constructor) {
|
298
|
+
if (!(instance instanceof Constructor)) {
|
299
|
+
throw new TypeError("Cannot call a class as a function");
|
300
|
+
}
|
301
|
+
}
|
302
|
+
;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/createClass.js
|
303
|
+
|
304
|
+
function _defineProperties(target, props) {
|
305
|
+
for (var i = 0; i < props.length; i++) {
|
306
|
+
var descriptor = props[i];
|
307
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
308
|
+
descriptor.configurable = true;
|
309
|
+
if ("value" in descriptor) descriptor.writable = true;
|
310
|
+
Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);
|
311
|
+
}
|
312
|
+
}
|
313
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
314
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
315
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
316
|
+
Object.defineProperty(Constructor, "prototype", {
|
317
|
+
writable: false
|
318
|
+
});
|
319
|
+
return Constructor;
|
320
|
+
}
|
2342
321
|
;// CONCATENATED MODULE: external "lodash/throttle"
|
2343
322
|
var throttle_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
2344
323
|
var throttle_y = x => () => x
|
2345
|
-
const
|
324
|
+
const throttle_namespaceObject = throttle_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a__["default"] });
|
2346
325
|
;// CONCATENATED MODULE: ../../packages/virtual-render/src/v-virtual-render.ts
|
2347
326
|
|
2348
327
|
|
2349
|
-
|
2350
328
|
/*
|
2351
329
|
* Tencent is pleased to support the open source community by making
|
2352
330
|
* 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
|
@@ -2397,14 +375,14 @@ function getMatchedIndex(maxCount, maxHeight, groupItemCount, callback) {
|
|
2397
375
|
diffHeight: diffHeight
|
2398
376
|
};
|
2399
377
|
}
|
2400
|
-
function computedVirtualIndex(lineHeight, callback, pagination,
|
2401
|
-
if (!
|
378
|
+
function computedVirtualIndex(lineHeight, callback, pagination, _el, event) {
|
379
|
+
if (!event.target) {
|
2402
380
|
return;
|
2403
381
|
}
|
2404
|
-
var elScrollTop = event.
|
2405
|
-
var elScrollLeft = event.
|
2406
|
-
var elScrollHeight =
|
2407
|
-
var elOffsetHeight =
|
382
|
+
var elScrollTop = event.target.scrollTop;
|
383
|
+
var elScrollLeft = event.target.scrollLeft;
|
384
|
+
var elScrollHeight = event.target.scrollHeight;
|
385
|
+
var elOffsetHeight = event.target.offsetHeight;
|
2408
386
|
var count = pagination.count,
|
2409
387
|
groupItemCount = pagination.groupItemCount;
|
2410
388
|
var targetStartIndex = 0;
|
@@ -2424,8 +402,7 @@ function computedVirtualIndex(lineHeight, callback, pagination, wrapper, event)
|
|
2424
402
|
}
|
2425
403
|
var bottom = elScrollHeight - elOffsetHeight - elScrollTop;
|
2426
404
|
typeof callback === 'function' && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, {
|
2427
|
-
bottom: bottom >= 0 ? bottom : 0
|
2428
|
-
scrollbar: event
|
405
|
+
bottom: bottom >= 0 ? bottom : 0
|
2429
406
|
});
|
2430
407
|
return {
|
2431
408
|
targetStartIndex: targetStartIndex,
|
@@ -2437,33 +414,7 @@ function computedVirtualIndex(lineHeight, callback, pagination, wrapper, event)
|
|
2437
414
|
}
|
2438
415
|
var VisibleRender = /*#__PURE__*/function () {
|
2439
416
|
function VisibleRender(binding, el) {
|
2440
|
-
var _this = this;
|
2441
417
|
_classCallCheck(this, VisibleRender);
|
2442
|
-
_defineProperty(this, "getEvent", function (event) {
|
2443
|
-
var _this$binding$value$s = _this.binding.value.scrollbar,
|
2444
|
-
scrollbar = _this$binding$value$s === void 0 ? {
|
2445
|
-
enabled: false
|
2446
|
-
} : _this$binding$value$s;
|
2447
|
-
if (scrollbar.enabled) {
|
2448
|
-
var _event$offset;
|
2449
|
-
return {
|
2450
|
-
offset: (_event$offset = event.offset) !== null && _event$offset !== void 0 ? _event$offset : event
|
2451
|
-
};
|
2452
|
-
}
|
2453
|
-
if (event !== null && event !== void 0 && event.offset) {
|
2454
|
-
return {
|
2455
|
-
offset: event === null || event === void 0 ? void 0 : event.offset
|
2456
|
-
};
|
2457
|
-
}
|
2458
|
-
var elScrollTop = event.target.scrollTop;
|
2459
|
-
var elScrollLeft = event.target.scrollLeft;
|
2460
|
-
return {
|
2461
|
-
offset: {
|
2462
|
-
x: elScrollLeft,
|
2463
|
-
y: elScrollTop
|
2464
|
-
}
|
2465
|
-
};
|
2466
|
-
});
|
2467
418
|
this.binding = binding;
|
2468
419
|
this.wrapper = el;
|
2469
420
|
var throttleDelay = binding.value.throttleDelay;
|
@@ -2480,13 +431,11 @@ var VisibleRender = /*#__PURE__*/function () {
|
|
2480
431
|
pagination = _this$binding$value$p === void 0 ? {} : _this$binding$value$p,
|
2481
432
|
onlyScroll = _this$binding$value.onlyScroll;
|
2482
433
|
if (onlyScroll) {
|
2483
|
-
var
|
2484
|
-
var
|
2485
|
-
var
|
2486
|
-
var bottom = this.wrapper.scrollHeight - this.wrapper.offsetHeight - elScrollTop;
|
434
|
+
var elScrollTop = this.wrapper.scrollTop;
|
435
|
+
var elScrollLeft = this.wrapper.scrollLeft;
|
436
|
+
var bottom = this.wrapper.scrollHeight - this.wrapper.offsetHeight - this.wrapper.scrollTop;
|
2487
437
|
handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, {
|
2488
|
-
bottom: bottom >= 0 ? bottom : 0
|
2489
|
-
scrollbar: e
|
438
|
+
bottom: bottom >= 0 ? bottom : 0
|
2490
439
|
});
|
2491
440
|
return;
|
2492
441
|
}
|
@@ -2508,7 +457,7 @@ var VisibleRender = /*#__PURE__*/function () {
|
|
2508
457
|
}, {
|
2509
458
|
key: "executeThrottledRender",
|
2510
459
|
value: function executeThrottledRender(e) {
|
2511
|
-
(0,
|
460
|
+
(0,throttle_namespaceObject["default"])(this.render.bind(this), this.delay)(e);
|
2512
461
|
}
|
2513
462
|
}, {
|
2514
463
|
key: "install",
|
@@ -2582,46 +531,28 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
2582
531
|
|
2583
532
|
|
2584
533
|
|
2585
|
-
|
2586
534
|
/* harmony default export */ const use_tag_render = (function (props, ctx) {
|
2587
535
|
var renderAs = props.renderAs,
|
2588
536
|
contentAs = props.contentAs;
|
2589
|
-
var refRoot = (0,external_vue_namespaceObject.ref)(null);
|
2590
|
-
var _useScrollbar = use_scrollbar(refRoot, props),
|
2591
|
-
init = _useScrollbar.init,
|
2592
|
-
scrollTo = _useScrollbar.scrollTo,
|
2593
|
-
classNames = _useScrollbar.classNames;
|
2594
|
-
var contentStyle = (0,external_vue_namespaceObject.reactive)({
|
2595
|
-
x: 0,
|
2596
|
-
y: 0
|
2597
|
-
});
|
2598
|
-
var computedStyle = (0,external_vue_namespaceObject.computed)(function () {
|
2599
|
-
return use_tag_render_objectSpread({}, props.contentStyle);
|
2600
|
-
});
|
2601
537
|
/** 指令触发Scroll事件,计算当前startIndex & endIndex & scrollTop & translateY */
|
2602
538
|
var handleScrollCallback = function handleScrollCallback(event, _startIndex, _endIndex, _scrollTop, translateY, scrollLeft, pos) {
|
2603
|
-
var scrollbar = pos.scrollbar;
|
2604
|
-
if (scrollbar !== null && scrollbar !== void 0 && scrollbar.offset) {
|
2605
|
-
var _scrollbar$offset;
|
2606
|
-
Object.assign(contentStyle, (_scrollbar$offset = scrollbar === null || scrollbar === void 0 ? void 0 : scrollbar.offset) !== null && _scrollbar$offset !== void 0 ? _scrollbar$offset : {});
|
2607
|
-
}
|
2608
539
|
ctx.emit('content-scroll', [event, {
|
2609
540
|
translateY: translateY,
|
2610
541
|
translateX: scrollLeft,
|
2611
542
|
pos: pos
|
2612
543
|
}]);
|
2613
544
|
};
|
2614
|
-
var
|
545
|
+
var instance = null;
|
2615
546
|
var binding = (0,external_vue_namespaceObject.computed)(function () {
|
2616
547
|
return {
|
2617
548
|
lineHeight: props.lineHeight,
|
2618
|
-
scrollbar: props.scrollbar,
|
2619
549
|
handleScrollCallback: handleScrollCallback,
|
2620
550
|
pagination: {},
|
2621
551
|
throttleDelay: props.throttleDelay,
|
2622
552
|
onlyScroll: props.scrollEvent
|
2623
553
|
};
|
2624
554
|
});
|
555
|
+
var refRoot = (0,external_vue_namespaceObject.ref)(null);
|
2625
556
|
/** 虚拟渲染外层容器样式 */
|
2626
557
|
var wrapperStyle = (0,external_vue_namespaceObject.computed)(function () {
|
2627
558
|
var _props$maxHeight;
|
@@ -2633,36 +564,20 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
2633
564
|
maxHeight: (_props$maxHeight = props.maxHeight) !== null && _props$maxHeight !== void 0 ? _props$maxHeight : height
|
2634
565
|
}, props.wrapperStyle);
|
2635
566
|
});
|
2636
|
-
var _useFixTop = use_fix_top(props,
|
567
|
+
var _useFixTop = use_fix_top(props, refRoot),
|
568
|
+
scrollTo = _useFixTop.scrollTo,
|
2637
569
|
fixToTop = _useFixTop.fixToTop;
|
2638
570
|
ctx.expose({
|
2639
571
|
scrollTo: scrollTo,
|
2640
572
|
fixToTop: fixToTop
|
2641
573
|
});
|
2642
574
|
(0,external_vue_namespaceObject.onMounted)(function () {
|
2643
|
-
|
2644
|
-
|
2645
|
-
if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
|
2646
|
-
init(renderInstance.executeThrottledRender.bind(renderInstance));
|
2647
|
-
return;
|
2648
|
-
}
|
2649
|
-
renderInstance.install();
|
575
|
+
instance = new VisibleRender(binding, refRoot.value);
|
576
|
+
instance.install();
|
2650
577
|
});
|
2651
578
|
(0,external_vue_namespaceObject.onUnmounted)(function () {
|
2652
|
-
var
|
2653
|
-
(
|
2654
|
-
});
|
2655
|
-
var wrapperClassNames = (0,external_vue_namespaceObject.computed)(function () {
|
2656
|
-
if (props.scrollbar.enabled) {
|
2657
|
-
return [props.className, classNames.wrapper];
|
2658
|
-
}
|
2659
|
-
return [props.className];
|
2660
|
-
});
|
2661
|
-
var contentClassNames = (0,external_vue_namespaceObject.computed)(function () {
|
2662
|
-
if (props.scrollbar.enabled) {
|
2663
|
-
return [props.contentClassName, classNames.contentEl];
|
2664
|
-
}
|
2665
|
-
return [props.contentClassName];
|
579
|
+
var _instance;
|
580
|
+
(_instance = instance) === null || _instance === void 0 || _instance.uninstall();
|
2666
581
|
});
|
2667
582
|
return {
|
2668
583
|
rendAsTag: function rendAsTag() {
|
@@ -2670,12 +585,12 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
2670
585
|
return (0,external_vue_namespaceObject.h)(
|
2671
586
|
// @ts-ignore:next-line
|
2672
587
|
renderAs, {
|
2673
|
-
"class":
|
588
|
+
"class": props.className,
|
2674
589
|
style: wrapperStyle.value,
|
2675
590
|
ref: refRoot
|
2676
591
|
}, [(_ctx$slots$beforeCont = (_ctx$slots$beforeCont2 = (_ctx$slots = ctx.slots).beforeContent) === null || _ctx$slots$beforeCont2 === void 0 ? void 0 : _ctx$slots$beforeCont2.call(_ctx$slots)) !== null && _ctx$slots$beforeCont !== void 0 ? _ctx$slots$beforeCont : '', (0,external_vue_namespaceObject.h)(contentAs, {
|
2677
|
-
"class":
|
2678
|
-
style:
|
592
|
+
"class": props.contentClassName,
|
593
|
+
style: props.contentStyle
|
2679
594
|
}, [(_ctx$slots$default = (_ctx$slots$default2 = (_ctx$slots2 = ctx.slots)["default"]) === null || _ctx$slots$default2 === void 0 ? void 0 : _ctx$slots$default2.call(_ctx$slots2, {
|
2680
595
|
data: props.list
|
2681
596
|
})) !== null && _ctx$slots$default !== void 0 ? _ctx$slots$default : '']), (_ctx$slots$afterConte = (_ctx$slots$afterConte2 = (_ctx$slots3 = ctx.slots).afterContent) === null || _ctx$slots$afterConte2 === void 0 ? void 0 : _ctx$slots$afterConte2.call(_ctx$slots3)) !== null && _ctx$slots$afterConte !== void 0 ? _ctx$slots$afterConte : '', (_ctx$slots$afterSecti = (_ctx$slots$afterSecti2 = (_ctx$slots4 = ctx.slots).afterSection) === null || _ctx$slots$afterSecti2 === void 0 ? void 0 : _ctx$slots$afterSecti2.call(_ctx$slots4)) !== null && _ctx$slots$afterSecti !== void 0 ? _ctx$slots$afterSecti : '']);
|
@@ -2724,7 +639,6 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
2724
639
|
|
2725
640
|
|
2726
641
|
|
2727
|
-
|
2728
642
|
/* harmony default export */ const virtual_render = ((0,external_vue_namespaceObject.defineComponent)({
|
2729
643
|
name: 'VirtualRender',
|
2730
644
|
directives: {
|
@@ -2756,16 +670,10 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
2756
670
|
lineHeight: props.lineHeight,
|
2757
671
|
handleScrollCallback: handleScrollCallback,
|
2758
672
|
pagination: pagination,
|
2759
|
-
throttleDelay: props.throttleDelay
|
2760
|
-
scrollbar: props.scrollbar
|
673
|
+
throttleDelay: props.throttleDelay
|
2761
674
|
};
|
2762
675
|
});
|
2763
676
|
var refRoot = (0,external_vue_namespaceObject.ref)(null);
|
2764
|
-
var _useScrollbar = use_scrollbar(refRoot, props),
|
2765
|
-
init = _useScrollbar.init,
|
2766
|
-
scrollTo = _useScrollbar.scrollTo,
|
2767
|
-
classNames = _useScrollbar.classNames;
|
2768
|
-
var refVirtualSection = (0,external_vue_namespaceObject.ref)(null);
|
2769
677
|
var instance = null;
|
2770
678
|
var pagination = (0,external_vue_namespaceObject.reactive)({
|
2771
679
|
startIndex: 0,
|
@@ -2808,18 +716,7 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
2808
716
|
}
|
2809
717
|
};
|
2810
718
|
(0,external_vue_namespaceObject.onMounted)(function () {
|
2811
|
-
var _props$scrollbar;
|
2812
719
|
instance = new VisibleRender(binding, refRoot.value);
|
2813
|
-
if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
|
2814
|
-
init(instance.executeThrottledRender.bind(instance), null, refVirtualSection.value);
|
2815
|
-
instance.executeThrottledRender.call(instance, {
|
2816
|
-
offset: {
|
2817
|
-
x: 0,
|
2818
|
-
y: 0
|
2819
|
-
}
|
2820
|
-
});
|
2821
|
-
return;
|
2822
|
-
}
|
2823
720
|
instance.install();
|
2824
721
|
});
|
2825
722
|
(0,external_vue_namespaceObject.onUnmounted)(function () {
|
@@ -2883,7 +780,10 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
2883
780
|
});
|
2884
781
|
/** 展示列表内容区域样式 */
|
2885
782
|
var innerContentStyle = (0,external_vue_namespaceObject.computed)(function () {
|
2886
|
-
return props.scrollPosition === 'content' ? {
|
783
|
+
return props.scrollPosition === 'content' ? {
|
784
|
+
top: "".concat(pagination.scrollTop + props.scrollOffsetTop, "px"),
|
785
|
+
transform: "translateY(-".concat(pagination.translateY, "px)")
|
786
|
+
} : {};
|
2887
787
|
});
|
2888
788
|
/** 虚拟渲染外层容器样式 */
|
2889
789
|
var wrapperStyle = (0,external_vue_namespaceObject.computed)(function () {
|
@@ -2908,7 +808,7 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
2908
808
|
resolveClassName = _usePrefix.resolveClassName;
|
2909
809
|
/** 外层样式列表 */
|
2910
810
|
var wrapperClass = (0,external_vue_namespaceObject.computed)(function () {
|
2911
|
-
return [resolveClassName('virtual-render')].concat(_toConsumableArray(resolvePropClassName(props.className)), [props.scrollPosition === 'container' ? resolveClassName('virtual-content') : '']);
|
811
|
+
return [resolveClassName('virtual-render'), props.scrollXName, props.scrollYName].concat(_toConsumableArray(resolvePropClassName(props.className)), [props.scrollPosition === 'container' ? resolveClassName('virtual-content') : '']);
|
2912
812
|
});
|
2913
813
|
/** 内容区域样式列表 */
|
2914
814
|
var innerClass = (0,external_vue_namespaceObject.computed)(function () {
|
@@ -2919,33 +819,20 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
2919
819
|
* @param keepLastPostion
|
2920
820
|
*/
|
2921
821
|
var reset = function reset() {
|
2922
|
-
var _instance2;
|
2923
822
|
handleChangeListConfig();
|
2924
823
|
afterListDataReset();
|
2925
|
-
(_instance2 = instance) === null || _instance2 === void 0 || _instance2.executeThrottledRender.call(instance, {
|
2926
|
-
offset: {
|
2927
|
-
x: 0,
|
2928
|
-
y: 0
|
2929
|
-
}
|
2930
|
-
});
|
2931
824
|
};
|
2932
|
-
var _useFixTop = use_fix_top(props,
|
825
|
+
var _useFixTop = use_fix_top(props, refRoot),
|
826
|
+
scrollTo = _useFixTop.scrollTo,
|
2933
827
|
fixToTop = _useFixTop.fixToTop;
|
2934
828
|
(0,external_vue_namespaceObject.watch)(function () {
|
2935
829
|
return [props.lineHeight, props.height, props.list, props.maxHeight];
|
2936
830
|
}, function () {
|
2937
|
-
var
|
2938
|
-
(
|
831
|
+
var _instance2;
|
832
|
+
(_instance2 = instance) === null || _instance2 === void 0 || _instance2.setBinding(binding);
|
2939
833
|
handleChangeListConfig();
|
2940
834
|
(0,external_vue_namespaceObject.nextTick)(function () {
|
2941
|
-
var _instance4;
|
2942
835
|
afterListDataReset();
|
2943
|
-
(_instance4 = instance) === null || _instance4 === void 0 || _instance4.executeThrottledRender.call(instance, {
|
2944
|
-
offset: {
|
2945
|
-
x: 0,
|
2946
|
-
y: 0
|
2947
|
-
}
|
2948
|
-
});
|
2949
836
|
});
|
2950
837
|
}, {
|
2951
838
|
deep: true,
|
@@ -2962,15 +849,14 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
|
|
2962
849
|
// @ts-ignore:next-line
|
2963
850
|
renderAs || 'div', {
|
2964
851
|
ref: refRoot,
|
2965
|
-
"class":
|
852
|
+
"class": wrapperClass.value,
|
2966
853
|
style: wrapperStyle.value
|
2967
854
|
}, [(_ctx$slots$beforeCont = (_ctx$slots$beforeCont2 = (_ctx$slots = ctx.slots).beforeContent) === null || _ctx$slots$beforeCont2 === void 0 ? void 0 : _ctx$slots$beforeCont2.call(_ctx$slots)) !== null && _ctx$slots$beforeCont !== void 0 ? _ctx$slots$beforeCont : '', (0,external_vue_namespaceObject.h)(contentAs || 'div', {
|
2968
|
-
"class":
|
855
|
+
"class": innerClass.value,
|
2969
856
|
style: virtual_render_objectSpread(virtual_render_objectSpread({}, innerContentStyle.value), props.contentStyle)
|
2970
857
|
}, [(_ctx$slots$default = (_ctx$slots$default2 = (_ctx$slots2 = ctx.slots)["default"]) === null || _ctx$slots$default2 === void 0 ? void 0 : _ctx$slots$default2.call(_ctx$slots2, {
|
2971
858
|
data: calcList.value
|
2972
859
|
})) !== null && _ctx$slots$default !== void 0 ? _ctx$slots$default : '']), (_ctx$slots$afterConte = (_ctx$slots$afterConte2 = (_ctx$slots3 = ctx.slots).afterContent) === null || _ctx$slots$afterConte2 === void 0 ? void 0 : _ctx$slots$afterConte2.call(_ctx$slots3)) !== null && _ctx$slots$afterConte !== void 0 ? _ctx$slots$afterConte : '', (0,external_vue_namespaceObject.h)('div', {
|
2973
|
-
ref: refVirtualSection,
|
2974
860
|
"class": [resolveClassName('virtual-section')],
|
2975
861
|
style: innerStyle.value
|
2976
862
|
}), (_ctx$slots$afterSecti = (_ctx$slots$afterSecti2 = (_ctx$slots4 = ctx.slots).afterSection) === null || _ctx$slots$afterSecti2 === void 0 ? void 0 : _ctx$slots$afterSecti2.call(_ctx$slots4)) !== null && _ctx$slots$afterSecti !== void 0 ? _ctx$slots$afterSecti : '']);
|