bkui-vue 1.0.3-beta.65 → 1.0.3-beta.65.dialog.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/index.cjs.js +69 -69
  2. package/dist/index.esm.js +20113 -19289
  3. package/dist/index.umd.js +69 -69
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/checkbox/index.js +4 -4
  7. package/lib/components.d.ts +1 -0
  8. package/lib/components.js +1 -0
  9. package/lib/dialog/dialog.css +139 -77
  10. package/lib/dialog/dialog.d.ts +41 -121
  11. package/lib/dialog/dialog.less +10 -65
  12. package/lib/dialog/dialog.variable.css +139 -77
  13. package/lib/dialog/index.d.ts +105 -272
  14. package/lib/dialog/index.js +91 -100
  15. package/lib/dialog/props.d.ts +8 -48
  16. package/lib/form/index.js +1 -3
  17. package/lib/info-box/index.d.ts +2 -2
  18. package/lib/info-box/index.js +312 -173
  19. package/lib/info-box/info-box.css +63 -7
  20. package/lib/info-box/info-box.d.ts +17 -16
  21. package/lib/info-box/info-box.less +76 -14
  22. package/lib/info-box/info-box.variable.css +63 -7
  23. package/lib/info-box/render-component.d.ts +4 -0
  24. package/lib/modal/index.d.ts +45 -325
  25. package/lib/modal/index.js +187 -666
  26. package/lib/modal/mask.d.ts +6 -0
  27. package/lib/modal/modal.css +131 -31
  28. package/lib/modal/modal.d.ts +16 -126
  29. package/lib/modal/modal.less +84 -28
  30. package/lib/modal/modal.variable.css +131 -31
  31. package/lib/modal/props.mixin.d.ts +2 -53
  32. package/lib/radio/index.js +5 -5
  33. package/lib/scrollbar/index.d.ts +14 -0
  34. package/lib/scrollbar/index.js +18740 -0
  35. package/lib/scrollbar/scrollbar-core/can-use-dom.d.ts +2 -0
  36. package/lib/scrollbar/scrollbar-core/helpers.d.ts +5 -0
  37. package/lib/scrollbar/scrollbar-core/index.d.ts +236 -0
  38. package/lib/scrollbar/scrollbar-core/mouse-wheel.d.ts +5 -0
  39. package/lib/scrollbar/scrollbar-core/scrollbar-width.d.ts +1 -0
  40. package/lib/scrollbar/scrollbar.css +74 -0
  41. package/lib/scrollbar/scrollbar.less +93 -0
  42. package/lib/scrollbar/scrollbar.variable.css +203 -0
  43. package/lib/select/index.d.ts +0 -33
  44. package/lib/select/index.js +2 -5
  45. package/lib/select/select.css +5 -19
  46. package/lib/select/select.d.ts +0 -11
  47. package/lib/select/select.less +6 -26
  48. package/lib/select/select.variable.css +5 -19
  49. package/lib/select/selectTagInput.d.ts +0 -7
  50. package/lib/shared/index.d.ts +0 -1
  51. package/lib/shared/index.js +1 -48
  52. package/lib/sideslider/index.d.ts +31 -222
  53. package/lib/sideslider/index.js +49 -36
  54. package/lib/sideslider/sideslider.css +4 -42
  55. package/lib/sideslider/sideslider.d.ts +14 -105
  56. package/lib/sideslider/sideslider.less +13 -58
  57. package/lib/sideslider/sideslider.variable.css +4 -42
  58. package/lib/table/const.d.ts +1 -1
  59. package/lib/table/index.d.ts +23 -0
  60. package/lib/table/index.js +184 -47
  61. package/lib/table/plugins/use-fixed-column.d.ts +1 -1
  62. package/lib/table/plugins/use-pagination.d.ts +3 -1
  63. package/lib/table/plugins/use-shift-key.d.ts +11 -0
  64. package/lib/table/props.d.ts +8 -0
  65. package/lib/table/table.css +97 -42
  66. package/lib/table/table.d.ts +11 -0
  67. package/lib/table/table.less +43 -58
  68. package/lib/table/table.variable.css +97 -42
  69. package/lib/table/use-attributes.d.ts +1 -0
  70. package/lib/table/use-render.d.ts +1 -1
  71. package/lib/table-column/index.js +6 -2
  72. package/lib/tree/index.d.ts +23 -0
  73. package/lib/tree/index.js +9 -3
  74. package/lib/tree/props.d.ts +8 -0
  75. package/lib/tree/tree.css +75 -2
  76. package/lib/tree/tree.d.ts +11 -0
  77. package/lib/tree/tree.variable.css +75 -2
  78. package/lib/virtual-render/index.d.ts +27 -0
  79. package/lib/virtual-render/index.js +264 -63
  80. package/lib/virtual-render/props.d.ts +16 -0
  81. package/lib/virtual-render/use-fix-top.d.ts +2 -7
  82. package/lib/virtual-render/use-scrollbar.d.ts +23 -0
  83. package/lib/virtual-render/v-virtual-render.d.ts +2 -1
  84. package/lib/virtual-render/virtual-render.css +75 -2
  85. package/lib/virtual-render/virtual-render.d.ts +13 -0
  86. package/lib/virtual-render/virtual-render.less +3 -3
  87. package/lib/virtual-render/virtual-render.variable.css +75 -2
  88. package/package.json +1 -1
  89. package/lib/shared/mask.d.ts +0 -11
@@ -124,6 +124,7 @@ declare const BkVirtualRender: {
124
124
  } & {
125
125
  default: boolean;
126
126
  };
127
+ scrollbar: import("vue-types").VueTypeDef<import("./props").IScrollbarOption>;
127
128
  autoReset: import("vue-types").VueTypeValidableDef<boolean> & {
128
129
  default: boolean;
129
130
  } & {
@@ -132,6 +133,11 @@ declare const BkVirtualRender: {
132
133
  wrapperStyle: import("vue-types").VueTypeValidableDef<any> & {
133
134
  default: any;
134
135
  };
136
+ autoIndex: import("vue-types").VueTypeValidableDef<boolean> & {
137
+ default: boolean;
138
+ } & {
139
+ default: boolean;
140
+ };
135
141
  }>> & {
136
142
  [x: `on${Capitalize<string>}`]: (...args: any[]) => any;
137
143
  }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
@@ -261,6 +267,7 @@ declare const BkVirtualRender: {
261
267
  } & {
262
268
  default: boolean;
263
269
  };
270
+ scrollbar: import("vue-types").VueTypeDef<import("./props").IScrollbarOption>;
264
271
  autoReset: import("vue-types").VueTypeValidableDef<boolean> & {
265
272
  default: boolean;
266
273
  } & {
@@ -269,6 +276,11 @@ declare const BkVirtualRender: {
269
276
  wrapperStyle: import("vue-types").VueTypeValidableDef<any> & {
270
277
  default: any;
271
278
  };
279
+ autoIndex: import("vue-types").VueTypeValidableDef<boolean> & {
280
+ default: boolean;
281
+ } & {
282
+ default: boolean;
283
+ };
272
284
  }>> & {
273
285
  [x: `on${Capitalize<string>}`]: (...args: any[]) => any;
274
286
  }, {
@@ -303,6 +315,7 @@ declare const BkVirtualRender: {
303
315
  rowKey: string;
304
316
  keepAlive: boolean;
305
317
  autoReset: boolean;
318
+ autoIndex: boolean;
306
319
  }, true, {}, import("vue").SlotsType<{
307
320
  default?: any;
308
321
  beforeContent?: any;
@@ -440,6 +453,7 @@ declare const BkVirtualRender: {
440
453
  } & {
441
454
  default: boolean;
442
455
  };
456
+ scrollbar: import("vue-types").VueTypeDef<import("./props").IScrollbarOption>;
443
457
  autoReset: import("vue-types").VueTypeValidableDef<boolean> & {
444
458
  default: boolean;
445
459
  } & {
@@ -448,6 +462,11 @@ declare const BkVirtualRender: {
448
462
  wrapperStyle: import("vue-types").VueTypeValidableDef<any> & {
449
463
  default: any;
450
464
  };
465
+ autoIndex: import("vue-types").VueTypeValidableDef<boolean> & {
466
+ default: boolean;
467
+ } & {
468
+ default: boolean;
469
+ };
451
470
  }>> & {
452
471
  [x: `on${Capitalize<string>}`]: (...args: any[]) => any;
453
472
  }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
@@ -484,6 +503,7 @@ declare const BkVirtualRender: {
484
503
  rowKey: string;
485
504
  keepAlive: boolean;
486
505
  autoReset: boolean;
506
+ autoIndex: boolean;
487
507
  }>;
488
508
  __isFragment?: never;
489
509
  __isTeleport?: never;
@@ -613,6 +633,7 @@ declare const BkVirtualRender: {
613
633
  } & {
614
634
  default: boolean;
615
635
  };
636
+ scrollbar: import("vue-types").VueTypeDef<import("./props").IScrollbarOption>;
616
637
  autoReset: import("vue-types").VueTypeValidableDef<boolean> & {
617
638
  default: boolean;
618
639
  } & {
@@ -621,6 +642,11 @@ declare const BkVirtualRender: {
621
642
  wrapperStyle: import("vue-types").VueTypeValidableDef<any> & {
622
643
  default: any;
623
644
  };
645
+ autoIndex: import("vue-types").VueTypeValidableDef<boolean> & {
646
+ default: boolean;
647
+ } & {
648
+ default: boolean;
649
+ };
624
650
  }>> & {
625
651
  [x: `on${Capitalize<string>}`]: (...args: any[]) => any;
626
652
  }, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
@@ -657,6 +683,7 @@ declare const BkVirtualRender: {
657
683
  rowKey: string;
658
684
  keepAlive: boolean;
659
685
  autoReset: boolean;
686
+ autoIndex: boolean;
660
687
  }, {}, string, import("vue").SlotsType<{
661
688
  default?: any;
662
689
  beforeContent?: any;
@@ -3,6 +3,8 @@ 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
+ import * as __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_scrollbar_918447d0__ from "../scrollbar";
6
8
  import * as __WEBPACK_EXTERNAL_MODULE_lodash_throttle_a7b7506a__ from "lodash/throttle";
7
9
  /******/ // The require scope
8
10
  /******/ var __webpack_require__ = {};
@@ -122,11 +124,15 @@ function _defineProperty(obj, key, value) {
122
124
  ;// CONCATENATED MODULE: external "vue"
123
125
  var external_vue_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
124
126
  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 });
127
+ const external_vue_namespaceObject = external_vue_x({ ["computed"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.computed, ["defineComponent"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.defineComponent, ["h"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.h, ["nextTick"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.nextTick, ["onMounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onMounted, ["onUnmounted"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.onUnmounted, ["reactive"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.reactive, ["ref"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.ref, ["watchEffect"]: () => __WEBPACK_EXTERNAL_MODULE_vue__.watchEffect });
126
128
  ;// CONCATENATED MODULE: external "../config-provider"
127
129
  var config_provider_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
128
130
  var config_provider_y = x => () => x
129
131
  const config_provider_namespaceObject = config_provider_x({ ["usePrefix"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_config_provider_fe8577a3__.usePrefix });
132
+ ;// CONCATENATED MODULE: external "vue-types"
133
+ var external_vue_types_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
134
+ var external_vue_types_y = x => () => x
135
+ const external_vue_types_namespaceObject = external_vue_types_x({ ["toType"]: () => __WEBPACK_EXTERNAL_MODULE_vue_types_22de060a__.toType });
130
136
  ;// CONCATENATED MODULE: ../../packages/virtual-render/src/props.ts
131
137
 
132
138
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -157,6 +163,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
157
163
  * IN THE SOFTWARE.
158
164
  */
159
165
 
166
+
160
167
  var EventProps = {
161
168
  onContentScroll: Function
162
169
  };
@@ -241,23 +248,52 @@ var virtualRenderProps = _objectSpread({
241
248
  * 保持滚动条位置、当前渲染区间
242
249
  */
243
250
  keepAlive: shared_namespaceObject.PropTypes.bool.def(false),
251
+ /**
252
+ * 是否允许滚动条改变原有DOM结构
253
+ */
254
+ scrollbar: (0,external_vue_types_namespaceObject.toType)('IScrollbarOption', {
255
+ "default": {
256
+ enabled: true
257
+ }
258
+ }),
244
259
  /**
245
260
  * 数据监听改变时,是否自动重置位置到[0, 0]
246
261
  */
247
262
  autoReset: shared_namespaceObject.PropTypes.bool.def(true),
248
- wrapperStyle: shared_namespaceObject.PropTypes.any.def({})
263
+ wrapperStyle: shared_namespaceObject.PropTypes.any.def({}),
264
+ /**
265
+ * 传入数据如果没有设置rowKey,是否自动生成$index作为唯一ID
266
+ * $index的值默认为index
267
+ */
268
+ autoIndex: shared_namespaceObject.PropTypes.bool.def(true)
249
269
  }, EventProps);
250
270
  ;// 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);
260
- };
271
+ /*
272
+ * Tencent is pleased to support the open source community by making
273
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
274
+ *
275
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
276
+ *
277
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
278
+ *
279
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
280
+ *
281
+ * ---------------------------------------------------
282
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
283
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
284
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
285
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
286
+ *
287
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
288
+ * the Software.
289
+ *
290
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
291
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
292
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
293
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
294
+ * IN THE SOFTWARE.
295
+ */
296
+ /* harmony default export */ const use_fix_top = (function (props, scrollTo) {
261
297
  /**
262
298
  * 指定元素滚动到顶部
263
299
  * @param param0
@@ -282,15 +318,91 @@ var virtualRenderProps = _objectSpread({
282
318
  if (typeof targetIndex === 'number') {
283
319
  var resolvedIndex = targetIndex >= 0 ? targetIndex : 0;
284
320
  var offsetY = resolvedIndex * props.lineHeight;
285
- scrollTo({
286
- left: 0,
287
- top: offsetY
321
+ scrollTo(0, offsetY);
322
+ }
323
+ return null;
324
+ };
325
+ return {
326
+ fixToTop: fixToTop
327
+ };
328
+ });
329
+ ;// CONCATENATED MODULE: external "../scrollbar"
330
+ var scrollbar_x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
331
+ var scrollbar_y = x => () => x
332
+ const scrollbar_namespaceObject = scrollbar_x({ ["default"]: () => __WEBPACK_EXTERNAL_MODULE_bkui_vue_lib_scrollbar_918447d0__["default"] });
333
+ ;// CONCATENATED MODULE: ../../packages/virtual-render/src/use-scrollbar.tsx
334
+ /*
335
+ * Tencent is pleased to support the open source community by making
336
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
337
+ *
338
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
339
+ *
340
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
341
+ *
342
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
343
+ *
344
+ * ---------------------------------------------------
345
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
346
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
347
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
348
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
349
+ *
350
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
351
+ * the Software.
352
+ *
353
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
354
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
355
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
356
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
357
+ * IN THE SOFTWARE.
358
+ */
359
+
360
+
361
+ /* harmony default export */ const use_scrollbar = (function (target, props) {
362
+ var instance = null;
363
+ var _usePrefix = (0,config_provider_namespaceObject.usePrefix)(),
364
+ resolveClassName = _usePrefix.resolveClassName;
365
+ var classNames = {
366
+ contentEl: resolveClassName('scrollbar-content-el'),
367
+ wrapper: resolveClassName('scrollbar-wrapper'),
368
+ scrollbar: resolveClassName('scrollbar'),
369
+ track: resolveClassName('scrollbar-track'),
370
+ visible: resolveClassName('scrollbar-visible'),
371
+ horizontal: resolveClassName('scrollbar-horizontal'),
372
+ vertical: resolveClassName('scrollbar-vertical'),
373
+ hover: resolveClassName('scrollbar-hover'),
374
+ dragging: resolveClassName('scrollbar-dragging'),
375
+ scrolling: resolveClassName('scrollbar-scrolling'),
376
+ scrollable: resolveClassName('scrollbar-scrollable'),
377
+ mouseEntered: resolveClassName('scrollbar-mouse-entered')
378
+ };
379
+ var init = function init(scrollFn, delegateXContent, delegateYContent) {
380
+ instance = new scrollbar_namespaceObject["default"](target.value, {
381
+ classNames: classNames,
382
+ wrapperNode: target.value,
383
+ useSystemScrollYBehavior: !props.enabled,
384
+ useSystemScrollXBehavior: true,
385
+ delegateXContent: delegateXContent,
386
+ delegateYContent: delegateYContent,
387
+ onScrollCallback: scrollFn
388
+ });
389
+ };
390
+ var scrollTo = function scrollTo(x, y) {
391
+ var _props$scrollbar;
392
+ if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
393
+ instance.scrollTo({
394
+ left: x,
395
+ top: y
288
396
  });
397
+ return;
289
398
  }
399
+ target.value.scrollTo(x, y);
290
400
  };
291
401
  return {
292
- fixToTop: fixToTop,
293
- scrollTo: scrollTo
402
+ init: init,
403
+ instance: instance,
404
+ scrollTo: scrollTo,
405
+ classNames: classNames
294
406
  };
295
407
  });
296
408
  ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
@@ -325,6 +437,7 @@ const throttle_namespaceObject = throttle_x({ ["default"]: () => __WEBPACK_EXTER
325
437
  ;// CONCATENATED MODULE: ../../packages/virtual-render/src/v-virtual-render.ts
326
438
 
327
439
 
440
+
328
441
  /*
329
442
  * Tencent is pleased to support the open source community by making
330
443
  * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
@@ -375,14 +488,14 @@ function getMatchedIndex(maxCount, maxHeight, groupItemCount, callback) {
375
488
  diffHeight: diffHeight
376
489
  };
377
490
  }
378
- function computedVirtualIndex(lineHeight, callback, pagination, _el, event) {
379
- if (!event.target) {
491
+ function computedVirtualIndex(lineHeight, callback, pagination, wrapper, event) {
492
+ if (!wrapper || !event.offset) {
380
493
  return;
381
494
  }
382
- var elScrollTop = event.target.scrollTop;
383
- var elScrollLeft = event.target.scrollLeft;
384
- var elScrollHeight = event.target.scrollHeight;
385
- var elOffsetHeight = event.target.offsetHeight;
495
+ var elScrollTop = event.offset.y;
496
+ var elScrollLeft = event.offset.x;
497
+ var elScrollHeight = wrapper.scrollHeight;
498
+ var elOffsetHeight = wrapper.offsetHeight;
386
499
  var count = pagination.count,
387
500
  groupItemCount = pagination.groupItemCount;
388
501
  var targetStartIndex = 0;
@@ -402,7 +515,8 @@ function computedVirtualIndex(lineHeight, callback, pagination, _el, event) {
402
515
  }
403
516
  var bottom = elScrollHeight - elOffsetHeight - elScrollTop;
404
517
  typeof callback === 'function' && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, {
405
- bottom: bottom >= 0 ? bottom : 0
518
+ bottom: bottom >= 0 ? bottom : 0,
519
+ scrollbar: event
406
520
  });
407
521
  return {
408
522
  targetStartIndex: targetStartIndex,
@@ -414,7 +528,33 @@ function computedVirtualIndex(lineHeight, callback, pagination, _el, event) {
414
528
  }
415
529
  var VisibleRender = /*#__PURE__*/function () {
416
530
  function VisibleRender(binding, el) {
531
+ var _this = this;
417
532
  _classCallCheck(this, VisibleRender);
533
+ _defineProperty(this, "getEvent", function (event) {
534
+ var _this$binding$value$s = _this.binding.value.scrollbar,
535
+ scrollbar = _this$binding$value$s === void 0 ? {
536
+ enabled: false
537
+ } : _this$binding$value$s;
538
+ if (scrollbar.enabled) {
539
+ var _event$offset;
540
+ return {
541
+ offset: (_event$offset = event.offset) !== null && _event$offset !== void 0 ? _event$offset : event
542
+ };
543
+ }
544
+ if (event !== null && event !== void 0 && event.offset) {
545
+ return {
546
+ offset: event === null || event === void 0 ? void 0 : event.offset
547
+ };
548
+ }
549
+ var elScrollTop = event.target.scrollTop;
550
+ var elScrollLeft = event.target.scrollLeft;
551
+ return {
552
+ offset: {
553
+ x: elScrollLeft,
554
+ y: elScrollTop
555
+ }
556
+ };
557
+ });
418
558
  this.binding = binding;
419
559
  this.wrapper = el;
420
560
  var throttleDelay = binding.value.throttleDelay;
@@ -431,11 +571,13 @@ var VisibleRender = /*#__PURE__*/function () {
431
571
  pagination = _this$binding$value$p === void 0 ? {} : _this$binding$value$p,
432
572
  onlyScroll = _this$binding$value.onlyScroll;
433
573
  if (onlyScroll) {
434
- var elScrollTop = this.wrapper.scrollTop;
435
- var elScrollLeft = this.wrapper.scrollLeft;
436
- var bottom = this.wrapper.scrollHeight - this.wrapper.offsetHeight - this.wrapper.scrollTop;
574
+ var _e$offset, _e$offset$x, _e$offset2;
575
+ var elScrollTop = (_e$offset = e.offset) === null || _e$offset === void 0 ? void 0 : _e$offset.y;
576
+ var elScrollLeft = (_e$offset$x = (_e$offset2 = e.offset) === null || _e$offset2 === void 0 ? void 0 : _e$offset2.x) !== null && _e$offset$x !== void 0 ? _e$offset$x : 0;
577
+ var bottom = this.wrapper.scrollHeight - this.wrapper.offsetHeight - elScrollTop;
437
578
  handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, {
438
- bottom: bottom >= 0 ? bottom : 0
579
+ bottom: bottom >= 0 ? bottom : 0,
580
+ scrollbar: e
439
581
  });
440
582
  return;
441
583
  }
@@ -457,7 +599,7 @@ var VisibleRender = /*#__PURE__*/function () {
457
599
  }, {
458
600
  key: "executeThrottledRender",
459
601
  value: function executeThrottledRender(e) {
460
- (0,throttle_namespaceObject["default"])(this.render.bind(this), this.delay)(e);
602
+ (0,throttle_namespaceObject["default"])(this.render.bind(this), this.delay)(this.getEvent(e));
461
603
  }
462
604
  }, {
463
605
  key: "install",
@@ -532,28 +674,46 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
532
674
 
533
675
 
534
676
 
677
+
535
678
  /* harmony default export */ const use_tag_render = (function (props, ctx) {
536
679
  var renderAs = props.renderAs,
537
680
  contentAs = props.contentAs;
681
+ var refRoot = (0,external_vue_namespaceObject.ref)(null);
682
+ var _useScrollbar = use_scrollbar(refRoot, props),
683
+ init = _useScrollbar.init,
684
+ scrollTo = _useScrollbar.scrollTo,
685
+ classNames = _useScrollbar.classNames;
686
+ var contentStyle = (0,external_vue_namespaceObject.reactive)({
687
+ x: 0,
688
+ y: 0
689
+ });
690
+ var computedStyle = (0,external_vue_namespaceObject.computed)(function () {
691
+ return use_tag_render_objectSpread({}, props.contentStyle);
692
+ });
538
693
  /** 指令触发Scroll事件,计算当前startIndex & endIndex & scrollTop & translateY */
539
694
  var handleScrollCallback = function handleScrollCallback(event, _startIndex, _endIndex, _scrollTop, translateY, scrollLeft, pos) {
695
+ var scrollbar = pos.scrollbar;
696
+ if (scrollbar !== null && scrollbar !== void 0 && scrollbar.offset) {
697
+ var _scrollbar$offset;
698
+ Object.assign(contentStyle, (_scrollbar$offset = scrollbar === null || scrollbar === void 0 ? void 0 : scrollbar.offset) !== null && _scrollbar$offset !== void 0 ? _scrollbar$offset : {});
699
+ }
540
700
  ctx.emit('content-scroll', [event, {
541
701
  translateY: translateY,
542
702
  translateX: scrollLeft,
543
703
  pos: pos
544
704
  }]);
545
705
  };
546
- var instance = null;
706
+ var renderInstance = null;
547
707
  var binding = (0,external_vue_namespaceObject.computed)(function () {
548
708
  return {
549
709
  lineHeight: props.lineHeight,
710
+ scrollbar: props.scrollbar,
550
711
  handleScrollCallback: handleScrollCallback,
551
712
  pagination: {},
552
713
  throttleDelay: props.throttleDelay,
553
714
  onlyScroll: props.scrollEvent
554
715
  };
555
716
  });
556
- var refRoot = (0,external_vue_namespaceObject.ref)(null);
557
717
  /** 虚拟渲染外层容器样式 */
558
718
  var wrapperStyle = (0,external_vue_namespaceObject.computed)(function () {
559
719
  var _props$maxHeight;
@@ -565,20 +725,36 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
565
725
  maxHeight: (_props$maxHeight = props.maxHeight) !== null && _props$maxHeight !== void 0 ? _props$maxHeight : height
566
726
  }, props.wrapperStyle);
567
727
  });
568
- var _useFixTop = use_fix_top(props, refRoot),
569
- scrollTo = _useFixTop.scrollTo,
728
+ var _useFixTop = use_fix_top(props, scrollTo),
570
729
  fixToTop = _useFixTop.fixToTop;
571
730
  ctx.expose({
572
731
  scrollTo: scrollTo,
573
732
  fixToTop: fixToTop
574
733
  });
575
734
  (0,external_vue_namespaceObject.onMounted)(function () {
576
- instance = new VisibleRender(binding, refRoot.value);
577
- instance.install();
735
+ var _props$scrollbar;
736
+ renderInstance = new VisibleRender(binding, refRoot.value);
737
+ if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
738
+ init(renderInstance.executeThrottledRender.bind(renderInstance));
739
+ return;
740
+ }
741
+ renderInstance.install();
578
742
  });
579
743
  (0,external_vue_namespaceObject.onUnmounted)(function () {
580
- var _instance;
581
- (_instance = instance) === null || _instance === void 0 || _instance.uninstall();
744
+ var _renderInstance;
745
+ (_renderInstance = renderInstance) === null || _renderInstance === void 0 || _renderInstance.uninstall();
746
+ });
747
+ var wrapperClassNames = (0,external_vue_namespaceObject.computed)(function () {
748
+ if (props.scrollbar.enabled) {
749
+ return [props.className, classNames.wrapper];
750
+ }
751
+ return [props.className];
752
+ });
753
+ var contentClassNames = (0,external_vue_namespaceObject.computed)(function () {
754
+ if (props.scrollbar.enabled) {
755
+ return [props.contentClassName, classNames.contentEl];
756
+ }
757
+ return [props.contentClassName];
582
758
  });
583
759
  return {
584
760
  rendAsTag: function rendAsTag() {
@@ -586,12 +762,12 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
586
762
  return (0,external_vue_namespaceObject.h)(
587
763
  // @ts-ignore:next-line
588
764
  renderAs, {
589
- "class": props.className,
765
+ "class": wrapperClassNames.value,
590
766
  style: wrapperStyle.value,
591
767
  ref: refRoot
592
768
  }, [(_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, {
593
- "class": props.contentClassName,
594
- style: props.contentStyle
769
+ "class": contentClassNames.value,
770
+ style: computedStyle.value
595
771
  }, [(_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, {
596
772
  data: props.list
597
773
  })) !== 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 : '']);
@@ -640,6 +816,7 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
640
816
 
641
817
 
642
818
 
819
+
643
820
  /* harmony default export */ const virtual_render = ((0,external_vue_namespaceObject.defineComponent)({
644
821
  name: 'VirtualRender',
645
822
  directives: {
@@ -671,10 +848,17 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
671
848
  lineHeight: props.lineHeight,
672
849
  handleScrollCallback: handleScrollCallback,
673
850
  pagination: pagination,
674
- throttleDelay: props.throttleDelay
851
+ throttleDelay: props.throttleDelay,
852
+ scrollbar: props.scrollbar
675
853
  };
676
854
  });
677
855
  var refRoot = (0,external_vue_namespaceObject.ref)(null);
856
+ var refVirtualSection = (0,external_vue_namespaceObject.ref)(null);
857
+ var refContent = (0,external_vue_namespaceObject.ref)(null);
858
+ var _useScrollbar = use_scrollbar(refRoot, props),
859
+ init = _useScrollbar.init,
860
+ scrollTo = _useScrollbar.scrollTo,
861
+ classNames = _useScrollbar.classNames;
678
862
  var instance = null;
679
863
  var pagination = (0,external_vue_namespaceObject.reactive)({
680
864
  startIndex: 0,
@@ -704,20 +888,30 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
704
888
  var end = (pagination.endIndex + props.preloadItemCount) * props.groupItemCount;
705
889
  var total = localList.value.length;
706
890
  if (total < end) {
707
- var contentLength = end - start;
708
891
  calcList.value = localList.value.slice(start, total);
709
- end = total + 1;
710
- start = end - contentLength;
892
+ end = total;
893
+ start = end - Math.floor(refContent.value.offsetHeight / props.lineHeight);
711
894
  start = start < 0 ? 0 : start;
712
895
  }
713
- var value = localList.value.slice(start, end + 10);
896
+ var value = localList.value.slice(start, end);
714
897
  calcList.value = value;
715
898
  if (event) {
716
899
  ctx.emit('content-scroll', [event, pagination]);
717
900
  }
718
901
  };
719
902
  (0,external_vue_namespaceObject.onMounted)(function () {
903
+ var _props$scrollbar;
720
904
  instance = new VisibleRender(binding, refRoot.value);
905
+ if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
906
+ init(instance.executeThrottledRender.bind(instance), null, refVirtualSection.value);
907
+ instance.executeThrottledRender.call(instance, {
908
+ offset: {
909
+ x: 0,
910
+ y: 0
911
+ }
912
+ });
913
+ return;
914
+ }
721
915
  instance.install();
722
916
  });
723
917
  (0,external_vue_namespaceObject.onUnmounted)(function () {
@@ -770,7 +964,7 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
770
964
  };
771
965
  /** 映射传入的数组为新的数组,增加 $index属性,用来处理唯一Index */
772
966
  var localList = (0,external_vue_namespaceObject.computed)(function () {
773
- if (props.rowKey !== undefined) {
967
+ if (props.rowKey !== undefined || !props.autoIndex) {
774
968
  return props.list;
775
969
  }
776
970
  return (props.list || []).map(function (item, index) {
@@ -781,10 +975,7 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
781
975
  });
782
976
  /** 展示列表内容区域样式 */
783
977
  var innerContentStyle = (0,external_vue_namespaceObject.computed)(function () {
784
- return props.scrollPosition === 'content' ? {
785
- top: "".concat(pagination.scrollTop + props.scrollOffsetTop, "px"),
786
- transform: "translateY(-".concat(pagination.translateY, "px)")
787
- } : {};
978
+ return props.scrollPosition === 'content' ? {} : {};
788
979
  });
789
980
  /** 虚拟渲染外层容器样式 */
790
981
  var wrapperStyle = (0,external_vue_namespaceObject.computed)(function () {
@@ -809,7 +1000,7 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
809
1000
  resolveClassName = _usePrefix.resolveClassName;
810
1001
  /** 外层样式列表 */
811
1002
  var wrapperClass = (0,external_vue_namespaceObject.computed)(function () {
812
- return [resolveClassName('virtual-render'), props.scrollXName, props.scrollYName].concat(_toConsumableArray(resolvePropClassName(props.className)), [props.scrollPosition === 'container' ? resolveClassName('virtual-content') : '']);
1003
+ return [resolveClassName('virtual-render')].concat(_toConsumableArray(resolvePropClassName(props.className)), [props.scrollPosition === 'container' ? resolveClassName('virtual-content') : '']);
813
1004
  });
814
1005
  /** 内容区域样式列表 */
815
1006
  var innerClass = (0,external_vue_namespaceObject.computed)(function () {
@@ -820,24 +1011,32 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
820
1011
  * @param keepLastPostion
821
1012
  */
822
1013
  var reset = function reset() {
1014
+ var _instance2;
823
1015
  handleChangeListConfig();
824
1016
  afterListDataReset();
1017
+ (_instance2 = instance) === null || _instance2 === void 0 || _instance2.executeThrottledRender.call(instance, {
1018
+ offset: {
1019
+ x: 0,
1020
+ y: 0
1021
+ }
1022
+ });
825
1023
  };
826
- var _useFixTop = use_fix_top(props, refRoot),
827
- scrollTo = _useFixTop.scrollTo,
1024
+ var _useFixTop = use_fix_top(props, scrollTo),
828
1025
  fixToTop = _useFixTop.fixToTop;
829
- (0,external_vue_namespaceObject.watch)(function () {
830
- return [props.lineHeight, props.height, props.list, props.maxHeight];
831
- }, function () {
832
- var _instance2;
833
- (_instance2 = instance) === null || _instance2 === void 0 || _instance2.setBinding(binding);
1026
+ (0,external_vue_namespaceObject.watchEffect)(function () {
1027
+ var _instance3;
1028
+ (_instance3 = instance) === null || _instance3 === void 0 || _instance3.setBinding(binding);
834
1029
  handleChangeListConfig();
835
1030
  (0,external_vue_namespaceObject.nextTick)(function () {
1031
+ var _instance4;
836
1032
  afterListDataReset();
1033
+ (_instance4 = instance) === null || _instance4 === void 0 || _instance4.executeThrottledRender.call(instance, {
1034
+ offset: {
1035
+ x: pagination.scrollLeft,
1036
+ y: pagination.scrollTop
1037
+ }
1038
+ });
837
1039
  });
838
- }, {
839
- deep: true,
840
- immediate: true
841
1040
  });
842
1041
  ctx.expose({
843
1042
  reset: reset,
@@ -850,14 +1049,16 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
850
1049
  // @ts-ignore:next-line
851
1050
  renderAs || 'div', {
852
1051
  ref: refRoot,
853
- "class": wrapperClass.value,
1052
+ "class": [].concat(_toConsumableArray(wrapperClass.value), [classNames.wrapper]),
854
1053
  style: wrapperStyle.value
855
1054
  }, [(_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', {
856
- "class": innerClass.value,
1055
+ ref: refContent,
1056
+ "class": [].concat(_toConsumableArray(innerClass.value), [classNames.contentEl]),
857
1057
  style: virtual_render_objectSpread(virtual_render_objectSpread({}, innerContentStyle.value), props.contentStyle)
858
1058
  }, [(_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, {
859
1059
  data: calcList.value
860
1060
  })) !== 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', {
1061
+ ref: refVirtualSection,
861
1062
  "class": [resolveClassName('virtual-section')],
862
1063
  style: innerStyle.value
863
1064
  }), (_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 : '']);