bkui-vue 1.0.3-beta.67 → 1.0.3-beta.67.dialog.2

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 +70 -70
  2. package/dist/index.esm.js +19848 -19033
  3. package/dist/index.umd.js +70 -70
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/components.d.ts +1 -0
  7. package/lib/components.js +1 -0
  8. package/lib/dialog/dialog.css +135 -84
  9. package/lib/dialog/dialog.d.ts +32 -133
  10. package/lib/dialog/dialog.less +9 -76
  11. package/lib/dialog/dialog.variable.css +135 -84
  12. package/lib/dialog/index.d.ts +84 -314
  13. package/lib/dialog/index.js +206 -221
  14. package/lib/dialog/props.d.ts +8 -48
  15. package/lib/info-box/index.d.ts +2 -2
  16. package/lib/info-box/index.js +318 -173
  17. package/lib/info-box/info-box.css +63 -7
  18. package/lib/info-box/info-box.d.ts +17 -16
  19. package/lib/info-box/info-box.less +76 -14
  20. package/lib/info-box/info-box.variable.css +63 -7
  21. package/lib/info-box/render-component.d.ts +4 -0
  22. package/lib/input/index.js +2 -1
  23. package/lib/modal/hooks.d.ts +1 -1
  24. package/lib/modal/index.d.ts +16 -350
  25. package/lib/modal/index.js +183 -675
  26. package/lib/modal/mask.d.ts +6 -0
  27. package/lib/modal/modal.css +131 -32
  28. package/lib/modal/modal.d.ts +6 -134
  29. package/lib/modal/modal.less +84 -29
  30. package/lib/modal/modal.variable.css +131 -32
  31. package/lib/modal/props.mixin.d.ts +2 -53
  32. package/lib/overflow-title/index.js +46 -52
  33. package/lib/scrollbar/index.d.ts +15 -0
  34. package/lib/scrollbar/index.js +18756 -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 +240 -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 +75 -0
  41. package/lib/scrollbar/scrollbar.less +94 -0
  42. package/lib/scrollbar/scrollbar.variable.css +204 -0
  43. package/lib/shared/index.d.ts +0 -1
  44. package/lib/shared/index.js +1 -48
  45. package/lib/sideslider/index.d.ts +31 -222
  46. package/lib/sideslider/index.js +64 -40
  47. package/lib/sideslider/sideslider.css +17 -86
  48. package/lib/sideslider/sideslider.d.ts +14 -105
  49. package/lib/sideslider/sideslider.less +27 -107
  50. package/lib/sideslider/sideslider.variable.css +17 -86
  51. package/lib/table/components/table-cell.d.ts +3 -2
  52. package/lib/table/components/table-column.d.ts +2 -2
  53. package/lib/table/const.d.ts +1 -1
  54. package/lib/table/index.d.ts +25 -2
  55. package/lib/table/index.js +237 -85
  56. package/lib/table/plugins/head-filter.css +8 -4
  57. package/lib/table/plugins/head-filter.less +6 -3
  58. package/lib/table/plugins/head-filter.variable.css +8 -4
  59. package/lib/table/plugins/use-fixed-column.d.ts +1 -1
  60. package/lib/table/plugins/use-pagination.d.ts +3 -1
  61. package/lib/table/plugins/use-shift-key.d.ts +11 -0
  62. package/lib/table/props.d.ts +11 -3
  63. package/lib/table/table.css +106 -46
  64. package/lib/table/table.d.ts +11 -0
  65. package/lib/table/table.less +43 -58
  66. package/lib/table/table.variable.css +106 -46
  67. package/lib/table/use-attributes.d.ts +2 -1
  68. package/lib/table/use-column.d.ts +6 -6
  69. package/lib/table/use-render.d.ts +1 -1
  70. package/lib/table-column/index.d.ts +6 -6
  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 +76 -2
  76. package/lib/tree/tree.d.ts +11 -0
  77. package/lib/tree/tree.variable.css +76 -2
  78. package/lib/virtual-render/index.d.ts +27 -0
  79. package/lib/virtual-render/index.js +285 -76
  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 +24 -0
  83. package/lib/virtual-render/v-virtual-render.d.ts +2 -1
  84. package/lib/virtual-render/virtual-render.css +76 -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 +76 -2
  88. package/package.json +1 -1
  89. package/lib/shared/mask.d.ts +0 -11
@@ -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,106 @@ 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
+ scrollDelegate: {
384
+ scrollHeight: null,
385
+ scrollWidth: null
386
+ },
387
+ useSystemScrollYBehavior: !props.enabled,
388
+ useSystemScrollXBehavior: true,
389
+ delegateXContent: delegateXContent,
390
+ delegateYContent: delegateYContent,
391
+ onScrollCallback: scrollFn
392
+ });
393
+ };
394
+ var scrollTo = function scrollTo(x, y) {
395
+ var _props$scrollbar;
396
+ if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
397
+ instance.scrollTo({
398
+ left: x,
399
+ top: y
288
400
  });
401
+ return;
289
402
  }
403
+ target.value.scrollTo(x, y);
404
+ };
405
+ var updateScrollHeight = function updateScrollHeight(height) {
406
+ var _instance, _instance2;
407
+ (_instance = instance) === null || _instance === void 0 || _instance.setOptions({
408
+ scrollDelegate: {
409
+ scrollHeight: height,
410
+ scrollWidth: null
411
+ }
412
+ });
413
+ (_instance2 = instance) === null || _instance2 === void 0 || _instance2.recalculate();
290
414
  };
291
415
  return {
292
- fixToTop: fixToTop,
293
- scrollTo: scrollTo
416
+ init: init,
417
+ instance: instance,
418
+ scrollTo: scrollTo,
419
+ classNames: classNames,
420
+ updateScrollHeight: updateScrollHeight
294
421
  };
295
422
  });
296
423
  ;// CONCATENATED MODULE: ../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js
@@ -325,6 +452,7 @@ const throttle_namespaceObject = throttle_x({ ["default"]: () => __WEBPACK_EXTER
325
452
  ;// CONCATENATED MODULE: ../../packages/virtual-render/src/v-virtual-render.ts
326
453
 
327
454
 
455
+
328
456
  /*
329
457
  * Tencent is pleased to support the open source community by making
330
458
  * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
@@ -375,14 +503,14 @@ function getMatchedIndex(maxCount, maxHeight, groupItemCount, callback) {
375
503
  diffHeight: diffHeight
376
504
  };
377
505
  }
378
- function computedVirtualIndex(lineHeight, callback, pagination, _el, event) {
379
- if (!event.target) {
506
+ function computedVirtualIndex(lineHeight, callback, pagination, wrapper, event) {
507
+ if (!wrapper || !event.offset) {
380
508
  return;
381
509
  }
382
- var elScrollTop = event.target.scrollTop;
383
- var elScrollLeft = event.target.scrollLeft;
384
- var elScrollHeight = event.target.scrollHeight;
385
- var elOffsetHeight = event.target.offsetHeight;
510
+ var elScrollTop = event.offset.y;
511
+ var elScrollLeft = event.offset.x;
512
+ var elScrollHeight = wrapper.scrollHeight;
513
+ var elOffsetHeight = wrapper.offsetHeight;
386
514
  var count = pagination.count,
387
515
  groupItemCount = pagination.groupItemCount;
388
516
  var targetStartIndex = 0;
@@ -402,7 +530,8 @@ function computedVirtualIndex(lineHeight, callback, pagination, _el, event) {
402
530
  }
403
531
  var bottom = elScrollHeight - elOffsetHeight - elScrollTop;
404
532
  typeof callback === 'function' && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, {
405
- bottom: bottom >= 0 ? bottom : 0
533
+ bottom: bottom >= 0 ? bottom : 0,
534
+ scrollbar: event
406
535
  });
407
536
  return {
408
537
  targetStartIndex: targetStartIndex,
@@ -414,7 +543,33 @@ function computedVirtualIndex(lineHeight, callback, pagination, _el, event) {
414
543
  }
415
544
  var VisibleRender = /*#__PURE__*/function () {
416
545
  function VisibleRender(binding, el) {
546
+ var _this = this;
417
547
  _classCallCheck(this, VisibleRender);
548
+ _defineProperty(this, "getEvent", function (event) {
549
+ var _this$binding$value$s = _this.binding.value.scrollbar,
550
+ scrollbar = _this$binding$value$s === void 0 ? {
551
+ enabled: false
552
+ } : _this$binding$value$s;
553
+ if (scrollbar.enabled) {
554
+ var _event$offset;
555
+ return {
556
+ offset: (_event$offset = event.offset) !== null && _event$offset !== void 0 ? _event$offset : event
557
+ };
558
+ }
559
+ if (event !== null && event !== void 0 && event.offset) {
560
+ return {
561
+ offset: event === null || event === void 0 ? void 0 : event.offset
562
+ };
563
+ }
564
+ var elScrollTop = event.target.scrollTop;
565
+ var elScrollLeft = event.target.scrollLeft;
566
+ return {
567
+ offset: {
568
+ x: elScrollLeft,
569
+ y: elScrollTop
570
+ }
571
+ };
572
+ });
418
573
  this.binding = binding;
419
574
  this.wrapper = el;
420
575
  var throttleDelay = binding.value.throttleDelay;
@@ -431,11 +586,13 @@ var VisibleRender = /*#__PURE__*/function () {
431
586
  pagination = _this$binding$value$p === void 0 ? {} : _this$binding$value$p,
432
587
  onlyScroll = _this$binding$value.onlyScroll;
433
588
  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;
589
+ var _e$offset, _e$offset$x, _e$offset2;
590
+ var elScrollTop = (_e$offset = e.offset) === null || _e$offset === void 0 ? void 0 : _e$offset.y;
591
+ 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;
592
+ var bottom = this.wrapper.scrollHeight - this.wrapper.offsetHeight - elScrollTop;
437
593
  handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, {
438
- bottom: bottom >= 0 ? bottom : 0
594
+ bottom: bottom >= 0 ? bottom : 0,
595
+ scrollbar: e
439
596
  });
440
597
  return;
441
598
  }
@@ -457,7 +614,7 @@ var VisibleRender = /*#__PURE__*/function () {
457
614
  }, {
458
615
  key: "executeThrottledRender",
459
616
  value: function executeThrottledRender(e) {
460
- (0,throttle_namespaceObject["default"])(this.render.bind(this), this.delay)(e);
617
+ (0,throttle_namespaceObject["default"])(this.render.bind(this), this.delay)(this.getEvent(e));
461
618
  }
462
619
  }, {
463
620
  key: "install",
@@ -532,28 +689,46 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
532
689
 
533
690
 
534
691
 
692
+
535
693
  /* harmony default export */ const use_tag_render = (function (props, ctx) {
536
694
  var renderAs = props.renderAs,
537
695
  contentAs = props.contentAs;
696
+ var refRoot = (0,external_vue_namespaceObject.ref)(null);
697
+ var _useScrollbar = use_scrollbar(refRoot, props),
698
+ init = _useScrollbar.init,
699
+ scrollTo = _useScrollbar.scrollTo,
700
+ classNames = _useScrollbar.classNames;
701
+ var contentStyle = (0,external_vue_namespaceObject.reactive)({
702
+ x: 0,
703
+ y: 0
704
+ });
705
+ var computedStyle = (0,external_vue_namespaceObject.computed)(function () {
706
+ return use_tag_render_objectSpread({}, props.contentStyle);
707
+ });
538
708
  /** 指令触发Scroll事件,计算当前startIndex & endIndex & scrollTop & translateY */
539
709
  var handleScrollCallback = function handleScrollCallback(event, _startIndex, _endIndex, _scrollTop, translateY, scrollLeft, pos) {
710
+ var scrollbar = pos.scrollbar;
711
+ if (scrollbar !== null && scrollbar !== void 0 && scrollbar.offset) {
712
+ var _scrollbar$offset;
713
+ Object.assign(contentStyle, (_scrollbar$offset = scrollbar === null || scrollbar === void 0 ? void 0 : scrollbar.offset) !== null && _scrollbar$offset !== void 0 ? _scrollbar$offset : {});
714
+ }
540
715
  ctx.emit('content-scroll', [event, {
541
716
  translateY: translateY,
542
717
  translateX: scrollLeft,
543
718
  pos: pos
544
719
  }]);
545
720
  };
546
- var instance = null;
721
+ var renderInstance = null;
547
722
  var binding = (0,external_vue_namespaceObject.computed)(function () {
548
723
  return {
549
724
  lineHeight: props.lineHeight,
725
+ scrollbar: props.scrollbar,
550
726
  handleScrollCallback: handleScrollCallback,
551
727
  pagination: {},
552
728
  throttleDelay: props.throttleDelay,
553
729
  onlyScroll: props.scrollEvent
554
730
  };
555
731
  });
556
- var refRoot = (0,external_vue_namespaceObject.ref)(null);
557
732
  /** 虚拟渲染外层容器样式 */
558
733
  var wrapperStyle = (0,external_vue_namespaceObject.computed)(function () {
559
734
  var _props$maxHeight;
@@ -565,20 +740,36 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
565
740
  maxHeight: (_props$maxHeight = props.maxHeight) !== null && _props$maxHeight !== void 0 ? _props$maxHeight : height
566
741
  }, props.wrapperStyle);
567
742
  });
568
- var _useFixTop = use_fix_top(props, refRoot),
569
- scrollTo = _useFixTop.scrollTo,
743
+ var _useFixTop = use_fix_top(props, scrollTo),
570
744
  fixToTop = _useFixTop.fixToTop;
571
745
  ctx.expose({
572
746
  scrollTo: scrollTo,
573
747
  fixToTop: fixToTop
574
748
  });
575
749
  (0,external_vue_namespaceObject.onMounted)(function () {
576
- instance = new VisibleRender(binding, refRoot.value);
577
- instance.install();
750
+ var _props$scrollbar;
751
+ renderInstance = new VisibleRender(binding, refRoot.value);
752
+ if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
753
+ init(renderInstance.executeThrottledRender.bind(renderInstance));
754
+ return;
755
+ }
756
+ renderInstance.install();
578
757
  });
579
758
  (0,external_vue_namespaceObject.onUnmounted)(function () {
580
- var _instance;
581
- (_instance = instance) === null || _instance === void 0 || _instance.uninstall();
759
+ var _renderInstance;
760
+ (_renderInstance = renderInstance) === null || _renderInstance === void 0 || _renderInstance.uninstall();
761
+ });
762
+ var wrapperClassNames = (0,external_vue_namespaceObject.computed)(function () {
763
+ if (props.scrollbar.enabled) {
764
+ return [props.className, classNames.wrapper];
765
+ }
766
+ return [props.className];
767
+ });
768
+ var contentClassNames = (0,external_vue_namespaceObject.computed)(function () {
769
+ if (props.scrollbar.enabled) {
770
+ return [props.contentClassName, classNames.contentEl];
771
+ }
772
+ return [props.contentClassName];
582
773
  });
583
774
  return {
584
775
  rendAsTag: function rendAsTag() {
@@ -586,12 +777,12 @@ function use_tag_render_objectSpread(e) { for (var r = 1; r < arguments.length;
586
777
  return (0,external_vue_namespaceObject.h)(
587
778
  // @ts-ignore:next-line
588
779
  renderAs, {
589
- "class": props.className,
780
+ "class": wrapperClassNames.value,
590
781
  style: wrapperStyle.value,
591
782
  ref: refRoot
592
783
  }, [(_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
784
+ "class": contentClassNames.value,
785
+ style: computedStyle.value
595
786
  }, [(_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
787
  data: props.list
597
788
  })) !== 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 +831,7 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
640
831
 
641
832
 
642
833
 
834
+
643
835
  /* harmony default export */ const virtual_render = ((0,external_vue_namespaceObject.defineComponent)({
644
836
  name: 'VirtualRender',
645
837
  directives: {
@@ -671,10 +863,17 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
671
863
  lineHeight: props.lineHeight,
672
864
  handleScrollCallback: handleScrollCallback,
673
865
  pagination: pagination,
674
- throttleDelay: props.throttleDelay
866
+ throttleDelay: props.throttleDelay,
867
+ scrollbar: props.scrollbar
675
868
  };
676
869
  });
677
870
  var refRoot = (0,external_vue_namespaceObject.ref)(null);
871
+ var refContent = (0,external_vue_namespaceObject.ref)(null);
872
+ var _useScrollbar = use_scrollbar(refRoot, props),
873
+ init = _useScrollbar.init,
874
+ scrollTo = _useScrollbar.scrollTo,
875
+ classNames = _useScrollbar.classNames,
876
+ updateScrollHeight = _useScrollbar.updateScrollHeight;
678
877
  var instance = null;
679
878
  var pagination = (0,external_vue_namespaceObject.reactive)({
680
879
  startIndex: 0,
@@ -704,20 +903,31 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
704
903
  var end = (pagination.endIndex + props.preloadItemCount) * props.groupItemCount;
705
904
  var total = localList.value.length;
706
905
  if (total < end) {
707
- var contentLength = end - start;
708
906
  calcList.value = localList.value.slice(start, total);
709
- end = total + 1;
710
- start = end - contentLength;
907
+ end = total;
908
+ start = end - Math.floor(refContent.value.offsetHeight / props.lineHeight);
711
909
  start = start < 0 ? 0 : start;
712
910
  }
713
- var value = localList.value.slice(start, end + 10);
911
+ var value = localList.value.slice(start, end);
714
912
  calcList.value = value;
715
913
  if (event) {
716
914
  ctx.emit('content-scroll', [event, pagination]);
717
915
  }
718
916
  };
719
917
  (0,external_vue_namespaceObject.onMounted)(function () {
918
+ var _props$scrollbar;
720
919
  instance = new VisibleRender(binding, refRoot.value);
920
+ if ((_props$scrollbar = props.scrollbar) !== null && _props$scrollbar !== void 0 && _props$scrollbar.enabled) {
921
+ init(instance.executeThrottledRender.bind(instance));
922
+ updateScrollHeight(contentHeight.value);
923
+ instance.executeThrottledRender.call(instance, {
924
+ offset: {
925
+ x: 0,
926
+ y: 0
927
+ }
928
+ });
929
+ return;
930
+ }
721
931
  instance.install();
722
932
  });
723
933
  (0,external_vue_namespaceObject.onUnmounted)(function () {
@@ -770,7 +980,7 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
770
980
  };
771
981
  /** 映射传入的数组为新的数组,增加 $index属性,用来处理唯一Index */
772
982
  var localList = (0,external_vue_namespaceObject.computed)(function () {
773
- if (props.rowKey !== undefined) {
983
+ if (props.rowKey !== undefined || !props.autoIndex) {
774
984
  return props.list;
775
985
  }
776
986
  return (props.list || []).map(function (item, index) {
@@ -781,35 +991,27 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
781
991
  });
782
992
  /** 展示列表内容区域样式 */
783
993
  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
- } : {};
994
+ return props.scrollPosition === 'content' ? {} : {};
788
995
  });
789
996
  /** 虚拟渲染外层容器样式 */
790
997
  var wrapperStyle = (0,external_vue_namespaceObject.computed)(function () {
791
- var _props$maxHeight;
792
998
  var height = typeof props.height === 'number' ? "".concat(props.height, "px") : props.height;
793
999
  return virtual_render_objectSpread(virtual_render_objectSpread({
794
1000
  height: height,
795
1001
  width: typeof props.width === 'number' ? "".concat(props.width, "px") : props.width,
796
1002
  display: 'inline-block',
797
- maxHeight: (_props$maxHeight = props.maxHeight) !== null && _props$maxHeight !== void 0 ? _props$maxHeight : height
1003
+ maxHeight: props.maxHeight ? "".concat(props.maxHeight, "px") : false,
1004
+ minHeight: props.minHeight ? "".concat(props.minHeight, "px") : false
798
1005
  }, props.scrollPosition === 'container' ? innerContentStyle.value : {}), props.wrapperStyle);
799
1006
  });
800
- /** 虚拟渲染区域内置占位区域样式,用来撑起总高度,出现滚动条 */
801
- var innerStyle = (0,external_vue_namespaceObject.computed)(function () {
802
- var isHidden = typeof props.abosuteHeight === 'number' && props.abosuteHeight === 0;
803
- return {
804
- height: "".concat(innerHeight.value < props.minHeight ? props.minHeight : innerHeight.value, "px"),
805
- display: isHidden ? 'none' : 'block'
806
- };
1007
+ var contentHeight = (0,external_vue_namespaceObject.computed)(function () {
1008
+ return innerHeight.value < props.minHeight ? props.minHeight : innerHeight.value;
807
1009
  });
808
1010
  var _usePrefix = (0,config_provider_namespaceObject.usePrefix)(),
809
1011
  resolveClassName = _usePrefix.resolveClassName;
810
1012
  /** 外层样式列表 */
811
1013
  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') : '']);
1014
+ return [resolveClassName('virtual-render')].concat(_toConsumableArray(resolvePropClassName(props.className)), [props.scrollPosition === 'container' ? resolveClassName('virtual-content') : '']);
813
1015
  });
814
1016
  /** 内容区域样式列表 */
815
1017
  var innerClass = (0,external_vue_namespaceObject.computed)(function () {
@@ -820,24 +1022,33 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
820
1022
  * @param keepLastPostion
821
1023
  */
822
1024
  var reset = function reset() {
1025
+ var _instance2;
823
1026
  handleChangeListConfig();
824
1027
  afterListDataReset();
1028
+ (_instance2 = instance) === null || _instance2 === void 0 || _instance2.executeThrottledRender.call(instance, {
1029
+ offset: {
1030
+ x: 0,
1031
+ y: 0
1032
+ }
1033
+ });
825
1034
  };
826
- var _useFixTop = use_fix_top(props, refRoot),
827
- scrollTo = _useFixTop.scrollTo,
1035
+ var _useFixTop = use_fix_top(props, scrollTo),
828
1036
  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);
1037
+ (0,external_vue_namespaceObject.watchEffect)(function () {
1038
+ var _instance3;
1039
+ (_instance3 = instance) === null || _instance3 === void 0 || _instance3.setBinding(binding);
834
1040
  handleChangeListConfig();
1041
+ updateScrollHeight(contentHeight.value);
835
1042
  (0,external_vue_namespaceObject.nextTick)(function () {
1043
+ var _instance4;
836
1044
  afterListDataReset();
1045
+ (_instance4 = instance) === null || _instance4 === void 0 || _instance4.executeThrottledRender.call(instance, {
1046
+ offset: {
1047
+ x: pagination.scrollLeft,
1048
+ y: pagination.scrollTop
1049
+ }
1050
+ });
837
1051
  });
838
- }, {
839
- deep: true,
840
- immediate: true
841
1052
  });
842
1053
  ctx.expose({
843
1054
  reset: reset,
@@ -850,17 +1061,15 @@ function virtual_render_objectSpread(e) { for (var r = 1; r < arguments.length;
850
1061
  // @ts-ignore:next-line
851
1062
  renderAs || 'div', {
852
1063
  ref: refRoot,
853
- "class": wrapperClass.value,
1064
+ "class": [].concat(_toConsumableArray(wrapperClass.value), [classNames.wrapper]),
854
1065
  style: wrapperStyle.value
855
1066
  }, [(_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,
1067
+ ref: refContent,
1068
+ "class": [].concat(_toConsumableArray(innerClass.value), [classNames.contentEl]),
857
1069
  style: virtual_render_objectSpread(virtual_render_objectSpread({}, innerContentStyle.value), props.contentStyle)
858
1070
  }, [(_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
1071
  data: calcList.value
860
- })) !== 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', {
861
- "class": [resolveClassName('virtual-section')],
862
- style: innerStyle.value
863
- }), (_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 : '']);
1072
+ })) !== 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 : '']);
864
1073
  };
865
1074
  }
866
1075
  }));
@@ -1,4 +1,7 @@
1
1
  import { ExtractPropTypes } from 'vue';
2
+ export type IScrollbarOption = {
3
+ enabled: boolean;
4
+ };
2
5
  export declare const virtualRenderProps: {
3
6
  onContentScroll: FunctionConstructor;
4
7
  /** 传入原始数据源 */
@@ -181,6 +184,10 @@ export declare const virtualRenderProps: {
181
184
  } & {
182
185
  default: boolean;
183
186
  };
187
+ /**
188
+ * 是否允许滚动条改变原有DOM结构
189
+ */
190
+ scrollbar: import("vue-types").VueTypeDef<IScrollbarOption>;
184
191
  /**
185
192
  * 数据监听改变时,是否自动重置位置到[0, 0]
186
193
  */
@@ -192,5 +199,14 @@ export declare const virtualRenderProps: {
192
199
  wrapperStyle: import("vue-types").VueTypeValidableDef<any> & {
193
200
  default: any;
194
201
  };
202
+ /**
203
+ * 传入数据如果没有设置rowKey,是否自动生成$index作为唯一ID
204
+ * $index的值默认为index
205
+ */
206
+ autoIndex: import("vue-types").VueTypeValidableDef<boolean> & {
207
+ default: boolean;
208
+ } & {
209
+ default: boolean;
210
+ };
195
211
  };
196
212
  export type VirtualRenderProps = Readonly<ExtractPropTypes<typeof virtualRenderProps>>;
@@ -1,4 +1,3 @@
1
- import { Ref } from 'vue';
2
1
  import { VirtualRenderProps } from './props';
3
2
  type IFixToTopParams = {
4
3
  index?: number;
@@ -8,11 +7,7 @@ type IFixToTopParams = {
8
7
  };
9
8
  position: number[];
10
9
  };
11
- declare const _default: (props: VirtualRenderProps, refRoot: Ref<HTMLElement>) => {
12
- fixToTop: (params: IFixToTopParams) => void;
13
- scrollTo: (option?: {
14
- left: number;
15
- top: number;
16
- }) => void;
10
+ declare const _default: (props: VirtualRenderProps, scrollTo: (x: any, y: any) => void) => {
11
+ fixToTop: (params: IFixToTopParams) => any;
17
12
  };
18
13
  export default _default;