@visactor/vrender-components 0.18.5 → 0.18.6

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 (53) hide show
  1. package/cjs/axis/animate/group-transition.d.ts +0 -1
  2. package/cjs/axis/animate/group-transition.js +2 -10
  3. package/cjs/axis/animate/group-transition.js.map +1 -1
  4. package/cjs/axis/base.d.ts +8 -3
  5. package/cjs/axis/base.js +6 -2
  6. package/cjs/axis/base.js.map +1 -1
  7. package/cjs/axis/grid/base.d.ts +8 -3
  8. package/cjs/axis/grid/base.js +6 -2
  9. package/cjs/axis/grid/base.js.map +1 -1
  10. package/cjs/axis/line.js +18 -3
  11. package/cjs/axis/line.js.map +1 -1
  12. package/cjs/axis/overlap/auto-limit.d.ts +1 -0
  13. package/cjs/axis/overlap/auto-limit.js +30 -6
  14. package/cjs/axis/overlap/auto-limit.js.map +1 -1
  15. package/cjs/axis/overlap/util.d.ts +12 -0
  16. package/cjs/axis/overlap/util.js +40 -2
  17. package/cjs/axis/overlap/util.js.map +1 -1
  18. package/cjs/axis/util.d.ts +3 -1
  19. package/cjs/axis/util.js +11 -3
  20. package/cjs/axis/util.js.map +1 -1
  21. package/cjs/index.d.ts +1 -1
  22. package/cjs/index.js +1 -1
  23. package/cjs/index.js.map +1 -1
  24. package/cjs/legend/discrete/discrete.d.ts +5 -0
  25. package/cjs/legend/discrete/discrete.js +120 -85
  26. package/cjs/legend/discrete/discrete.js.map +1 -1
  27. package/es/axis/animate/group-transition.d.ts +0 -1
  28. package/es/axis/animate/group-transition.js +2 -10
  29. package/es/axis/animate/group-transition.js.map +1 -1
  30. package/es/axis/base.d.ts +8 -3
  31. package/es/axis/base.js +7 -1
  32. package/es/axis/base.js.map +1 -1
  33. package/es/axis/grid/base.d.ts +8 -3
  34. package/es/axis/grid/base.js +7 -1
  35. package/es/axis/grid/base.js.map +1 -1
  36. package/es/axis/line.js +18 -3
  37. package/es/axis/line.js.map +1 -1
  38. package/es/axis/overlap/auto-limit.d.ts +1 -0
  39. package/es/axis/overlap/auto-limit.js +30 -5
  40. package/es/axis/overlap/auto-limit.js.map +1 -1
  41. package/es/axis/overlap/util.d.ts +12 -0
  42. package/es/axis/overlap/util.js +37 -0
  43. package/es/axis/overlap/util.js.map +1 -1
  44. package/es/axis/util.d.ts +3 -1
  45. package/es/axis/util.js +9 -0
  46. package/es/axis/util.js.map +1 -1
  47. package/es/index.d.ts +1 -1
  48. package/es/index.js +1 -1
  49. package/es/index.js.map +1 -1
  50. package/es/legend/discrete/discrete.d.ts +5 -0
  51. package/es/legend/discrete/discrete.js +122 -86
  52. package/es/legend/discrete/discrete.js.map +1 -1
  53. package/package.json +3 -3
@@ -87,33 +87,30 @@ class DiscreteLegend extends base_1.LegendBase {
87
87
  }));
88
88
  }
89
89
  _renderItems() {
90
- const {item: itemAttrs = {}, maxCol: maxCol = 1, maxRow: maxRow = 2, maxWidth: maxWidth, maxHeight: maxHeight, defaultSelected: defaultSelected = [], lazyload: lazyload} = this.attribute, {spaceCol: spaceCol = constant_1.DEFAULT_ITEM_SPACE_COL, spaceRow: spaceRow = constant_1.DEFAULT_ITEM_SPACE_ROW} = itemAttrs, itemsContainer = this._itemsContainer, {items: legendItems, isHorizontal: isHorizontal, startIndex: startIndex} = this._itemContext, maxPages = isHorizontal ? maxRow : maxCol;
90
+ const {item: itemAttrs = {}, maxCol: maxCol = 1, maxRow: maxRow = 2, maxWidth: maxWidth, maxHeight: maxHeight, defaultSelected: defaultSelected = [], lazyload: lazyload, autoPage: autoPage} = this.attribute, {spaceCol: spaceCol = constant_1.DEFAULT_ITEM_SPACE_COL, spaceRow: spaceRow = constant_1.DEFAULT_ITEM_SPACE_ROW} = itemAttrs, itemsContainer = this._itemsContainer, {items: legendItems, isHorizontal: isHorizontal, startIndex: startIndex, isScrollbar: isScrollbar} = this._itemContext, maxPages = isScrollbar ? 1 : isHorizontal ? maxRow : maxCol;
91
91
  let item, {doWrap: doWrap, maxWidthInCol: maxWidthInCol, startX: startX, startY: startY, pages: pages} = this._itemContext;
92
- for (let index = startIndex, len = legendItems.length; index < len; index++) {
93
- if (lazyload && pages > this._itemContext.currentPage * maxPages) {
94
- this._itemContext.startIndex = index;
95
- break;
96
- }
97
- item = legendItems[index], item.id || (item.id = item.label), item.index = index;
92
+ for (let index = startIndex, len = legendItems.length; index < len && !(lazyload && pages > this._itemContext.currentPage * maxPages); index++) {
93
+ lazyload && (this._itemContext.startIndex = index + 1), item = legendItems[index],
94
+ item.id || (item.id = item.label), item.index = index;
98
95
  const itemGroup = this._renderEachItem(item, !!(0, vutils_1.isEmpty)(defaultSelected) || (null == defaultSelected ? void 0 : defaultSelected.includes(item.label)), index, legendItems), itemWidth = itemGroup.attribute.width, itemHeight = itemGroup.attribute.height;
99
96
  this._itemHeight = Math.max(this._itemHeight, itemHeight), maxWidthInCol = Math.max(itemWidth, maxWidthInCol),
100
97
  this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth), isHorizontal ? ((0,
101
- vutils_1.isValid)(maxWidth) && (itemWidth >= maxWidth ? (doWrap = !0, index > 0 && (startX = 0,
102
- startY += itemHeight + spaceRow, pages += 1)) : maxWidth < startX + itemWidth && (doWrap = !0,
103
- startX = 0, startY += itemHeight + spaceRow, pages += 1)), index > 0 && itemGroup.setAttributes({
98
+ vutils_1.isValid)(maxWidth) && (isScrollbar && autoPage ? (pages = Math.ceil((startX + itemWidth) / maxWidth),
99
+ doWrap = pages > 1) : startX + itemWidth > maxWidth && (doWrap = !0, startX > 0 && (pages += 1,
100
+ startX = 0, startY += itemHeight + spaceRow))), 0 === startX && 0 === startY || itemGroup.setAttributes({
104
101
  x: startX,
105
102
  y: startY
106
- }), startX += spaceCol + itemWidth) : ((0, vutils_1.isValid)(maxHeight) && maxHeight < startY + itemHeight && (doWrap = !0,
107
- startY = 0, startX += maxWidthInCol + spaceCol, maxWidthInCol = 0, pages += 1),
108
- index > 0 && itemGroup.setAttributes({
103
+ }), startX += spaceCol + itemWidth) : ((0, vutils_1.isValid)(maxHeight) && (isScrollbar && autoPage ? (pages = Math.ceil((startY + itemHeight) / maxHeight),
104
+ doWrap = pages > 1) : maxHeight < startY + itemHeight && (pages += 1, doWrap = !0,
105
+ startY = 0, startX += maxWidthInCol + spaceCol, maxWidthInCol = 0)), 0 === startX && 0 === startY || itemGroup.setAttributes({
109
106
  x: startX,
110
107
  y: startY
111
108
  }), startY += spaceRow + itemHeight), itemsContainer.add(itemGroup);
112
109
  }
113
110
  return this._itemContext.doWrap = doWrap, this._itemContext.startX = startX, this._itemContext.startY = startY,
114
111
  this._itemContext.maxWidthInCol = maxWidthInCol, this._itemContext.pages = pages,
115
- this._itemContext.maxPages = maxPages, lazyload || (this._itemContext.startIndex = legendItems.length),
116
- this._itemContext;
112
+ this._itemContext.maxPages = maxPages, isScrollbar && (this._itemContext.totalPage = pages),
113
+ lazyload || (this._itemContext.startIndex = legendItems.length), this._itemContext;
117
114
  }
118
115
  _renderContent() {
119
116
  const {item: item = {}, items: items, reversed: reversed, maxWidth: maxWidth} = this.attribute;
@@ -128,9 +125,10 @@ class DiscreteLegend extends base_1.LegendBase {
128
125
  const {layout: layout, autoPage: autoPage} = this.attribute, isHorizontal = "horizontal" === layout, {maxWidth: maxItemWidth, width: itemWidth, height: itemHeight} = item, widthsOptions = [];
129
126
  (0, vutils_1.isValid)(maxItemWidth) && widthsOptions.push(maxItemWidth), (0, vutils_1.isValid)(itemWidth) && widthsOptions.push(itemWidth),
130
127
  widthsOptions.length && ((0, vutils_1.isValid)(maxWidth) && widthsOptions.push(maxWidth),
131
- this._itemWidthByUser = (0, vutils_1.minInArray)(widthsOptions)), (0, vutils_1.isValid)(itemHeight) && (this._itemHeightByUser = itemHeight),
128
+ this._itemWidthByUser = (0, vutils_1.minInArray)(widthsOptions)), (0, vutils_1.isValid)(itemHeight) && (this._itemHeightByUser = itemHeight);
129
+ const pager = this.attribute.pager;
132
130
  this._itemContext = {
133
- currentPage: this.attribute.pager && this.attribute.pager.defaultCurrent || 1,
131
+ currentPage: pager && pager.defaultCurrent || 1,
134
132
  doWrap: !1,
135
133
  maxWidthInCol: 0,
136
134
  maxPages: 1,
@@ -140,10 +138,11 @@ class DiscreteLegend extends base_1.LegendBase {
140
138
  startIndex: 0,
141
139
  items: legendItems,
142
140
  isHorizontal: isHorizontal,
143
- totalPage: 1 / 0
141
+ totalPage: 1 / 0,
142
+ isScrollbar: pager && "scrollbar" === pager.type
144
143
  }, this._itemContext = this._renderItems();
145
144
  let pagerRendered = !1;
146
- this._itemContext.doWrap && autoPage && this._itemContext.pages > this._itemContext.maxPages && (pagerRendered = this._renderPagerComponent(isHorizontal)),
145
+ this._itemContext.doWrap && autoPage && this._itemContext.pages > this._itemContext.maxPages && (pagerRendered = this._renderPagerComponent()),
147
146
  pagerRendered || (itemsContainer.setAttribute("y", this._title ? this._title.AABBBounds.height() + (0,
148
147
  vutils_1.get)(this.attribute, "title.space", 8) : 0), this._innerView.add(itemsContainer));
149
148
  }
@@ -271,24 +270,10 @@ class DiscreteLegend extends base_1.LegendBase {
271
270
  focusShape && focusShape.setAttribute("visible", !1), innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]),
272
271
  itemGroup;
273
272
  }
274
- _createPager(isScrollbar, isHorizontal, compStyle, compSize) {
273
+ _createPager(compStyle) {
275
274
  var _a, _b;
276
275
  const {disableTriggerEvent: disableTriggerEvent, maxRow: maxRow} = this.attribute;
277
- return isScrollbar ? isHorizontal ? new scrollbar_1.ScrollBar(Object.assign(Object.assign({
278
- direction: "vertical",
279
- width: 12,
280
- range: [ 0, .5 ]
281
- }, compStyle), {
282
- height: compSize,
283
- disableTriggerEvent: disableTriggerEvent
284
- })) : new scrollbar_1.ScrollBar(Object.assign(Object.assign({
285
- direction: "horizontal",
286
- disableTriggerEvent: disableTriggerEvent,
287
- range: [ 0, .5 ],
288
- height: 12
289
- }, compStyle), {
290
- width: compSize
291
- })) : isHorizontal ? new pager_1.Pager(Object.assign(Object.assign({
276
+ return this._itemContext.isHorizontal ? new pager_1.Pager(Object.assign(Object.assign({
292
277
  layout: 1 === maxRow ? "horizontal" : "vertical",
293
278
  total: 99
294
279
  }, (0, vutils_1.merge)({
@@ -306,36 +291,55 @@ class DiscreteLegend extends base_1.LegendBase {
306
291
  defaultCurrent: null === (_b = this.attribute.pager) || void 0 === _b ? void 0 : _b.defaultCurrent
307
292
  }, compStyle));
308
293
  }
309
- _updatePositionOfPager(isScrollbar, isHorizontal, contentSize, renderStartY, compSize) {
310
- const {maxHeight: maxHeight, pager: pager} = this.attribute, {currentPage: currentPage, totalPage: totalPage} = this._itemContext;
311
- if (isScrollbar) this._pagerComponent.setScrollRange([ (currentPage - 1) / totalPage, currentPage / totalPage ]),
294
+ _createScrollbar(compStyle, compSize) {
295
+ const {disableTriggerEvent: disableTriggerEvent} = this.attribute;
296
+ return this._itemContext.isHorizontal ? new scrollbar_1.ScrollBar(Object.assign(Object.assign({
297
+ direction: "horizontal",
298
+ disableTriggerEvent: disableTriggerEvent,
299
+ range: [ 0, .5 ],
300
+ height: 12
301
+ }, compStyle), {
302
+ width: compSize
303
+ })) : new scrollbar_1.ScrollBar(Object.assign(Object.assign({
304
+ direction: "vertical",
305
+ width: 12,
306
+ range: [ 0, .5 ]
307
+ }, compStyle), {
308
+ height: compSize,
309
+ disableTriggerEvent: disableTriggerEvent
310
+ }));
311
+ }
312
+ _updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight) {
313
+ const {maxHeight: maxHeight, pager: pager} = this.attribute, {totalPage: totalPage, isHorizontal: isHorizontal} = this._itemContext, position = pager && pager.position || "middle";
314
+ if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
315
+ let y;
316
+ y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2,
317
+ this._pagerComponent.setAttributes({
318
+ x: contentWidth,
319
+ y: y
320
+ });
321
+ } else {
322
+ let x;
323
+ x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2,
324
+ this._pagerComponent.setAttributes({
325
+ x: x,
326
+ y: maxHeight - this._pagerComponent.AABBBounds.height()
327
+ });
328
+ }
329
+ }
330
+ _updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY) {
331
+ const {currentPage: currentPage, totalPage: totalPage, isHorizontal: isHorizontal} = this._itemContext;
332
+ this._pagerComponent.setScrollRange([ (currentPage - 1) / totalPage, currentPage / totalPage ]),
312
333
  isHorizontal ? this._pagerComponent.setAttributes({
313
- x: contentSize,
314
- y: renderStartY
315
- }) : this._pagerComponent.setAttributes({
316
334
  x: 0,
317
- y: maxHeight - this._pagerComponent.AABBBounds.height()
318
- }); else {
319
- const position = pager && pager.position || "middle";
320
- if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
321
- let y;
322
- y = "start" === position ? renderStartY : "end" === position ? renderStartY + compSize - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compSize / 2 - this._pagerComponent.AABBBounds.height() / 2,
323
- this._pagerComponent.setAttributes({
324
- x: contentSize,
325
- y: y
326
- });
327
- } else {
328
- let x;
329
- x = "start" === position ? 0 : "end" === position ? compSize - this._pagerComponent.AABBBounds.width() : (compSize - this._pagerComponent.AABBBounds.width()) / 2,
330
- this._pagerComponent.setAttributes({
331
- x: x,
332
- y: maxHeight - this._pagerComponent.AABBBounds.height()
333
- });
334
- }
335
- }
335
+ y: renderStartY + contentHeight
336
+ }) : this._pagerComponent.setAttributes({
337
+ x: contentWidth,
338
+ y: renderStartY
339
+ });
336
340
  }
337
- _bindEventsOfPager(isScrollbar, isHorizontal, compSize, spaceSize) {
338
- const pager = this.attribute.pager || {}, {animation: animation = !0, animationDuration: animationDuration = 450, animationEasing: animationEasing = "quadIn"} = pager, pageParser = isScrollbar ? e => {
341
+ _bindEventsOfPager(pageSize, channel) {
342
+ const pager = this.attribute.pager || {}, {animation: animation = !0, animationDuration: animationDuration = 450, animationEasing: animationEasing = "quadIn"} = pager, pageParser = this._itemContext.isScrollbar ? e => {
339
343
  const {value: value} = e.detail;
340
344
  let newPage = value[0] * this._itemContext.totalPage;
341
345
  return pager.scrollByPosition ? newPage += 1 : newPage = Math.floor(newPage) + 1,
@@ -348,58 +352,89 @@ class DiscreteLegend extends base_1.LegendBase {
348
352
  const newTotalPage = Math.ceil(this._itemContext.pages / this._itemContext.maxPages);
349
353
  this._itemContext.totalPage = newTotalPage, this._pagerComponent.setScrollRange([ (newPage - 1) / newTotalPage, newPage / newTotalPage ]);
350
354
  }
351
- animation ? this._itemsContainer.animate().to(isHorizontal ? {
352
- y: -(newPage - 1) * (compSize + spaceSize)
353
- } : {
354
- x: -(newPage - 1) * (compSize + spaceSize)
355
- }, animationDuration, animationEasing) : isHorizontal ? this._itemsContainer.setAttribute("y", -(newPage - 1) * (compSize + spaceSize)) : this._itemsContainer.setAttribute("x", -(newPage - 1) * (compSize + spaceSize));
355
+ animation ? this._itemsContainer.animate().to({
356
+ [channel]: -(newPage - 1) * pageSize
357
+ }, animationDuration, animationEasing) : this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
356
358
  }
357
359
  };
358
- isScrollbar ? (this._pagerComponent.addEventListener("scrollDrag", onPaging), this._pagerComponent.addEventListener("scrollUp", onPaging)) : (this._pagerComponent.addEventListener("toPrev", onPaging),
360
+ this._itemContext.isScrollbar ? (this._pagerComponent.addEventListener("scrollDrag", onPaging),
361
+ this._pagerComponent.addEventListener("scrollUp", onPaging)) : (this._pagerComponent.addEventListener("toPrev", onPaging),
359
362
  this._pagerComponent.addEventListener("toNext", onPaging));
360
363
  }
361
- _renderPagerComponent(isHorizontal) {
362
- const renderStartY = this._title ? this._title.AABBBounds.height() + (0, vutils_1.get)(this.attribute, "title.space", 8) : 0, {maxWidth: maxWidth, maxHeight: maxHeight, maxCol: maxCol = 1, maxRow: maxRow = 2, item: item = {}, pager: pager = {}} = this.attribute, {spaceCol: spaceCol = constant_1.DEFAULT_ITEM_SPACE_COL, spaceRow: spaceRow = constant_1.DEFAULT_ITEM_SPACE_ROW} = item, itemsContainer = this._itemsContainer, {space: pagerSpace = constant_1.DEFAULT_PAGER_SPACE, defaultCurrent: defaultCurrent = 1} = pager, compStyle = __rest(pager, [ "space", "defaultCurrent" ]), isScrollbar = "scrollbar" === pager.type;
363
- let comp, compSize = 0, contentSize = 0, startX = 0, startY = 0, pages = 1;
364
+ _renderPager() {
365
+ const renderStartY = this._title ? this._title.AABBBounds.height() + (0, vutils_1.get)(this.attribute, "title.space", 8) : 0, {maxWidth: maxWidth, maxHeight: maxHeight, maxCol: maxCol = 1, maxRow: maxRow = 2, item: item = {}, pager: pager = {}} = this.attribute, {spaceCol: spaceCol = constant_1.DEFAULT_ITEM_SPACE_COL, spaceRow: spaceRow = constant_1.DEFAULT_ITEM_SPACE_ROW} = item, itemsContainer = this._itemsContainer, {space: pagerSpace = constant_1.DEFAULT_PAGER_SPACE, defaultCurrent: defaultCurrent = 1} = pager, compStyle = __rest(pager, [ "space", "defaultCurrent" ]), {isHorizontal: isHorizontal} = this._itemContext;
366
+ let comp, compWidth = 0, compHeight = 0, contentWidth = 0, contentHeight = 0, startX = 0, startY = 0, pages = 1;
364
367
  if (isHorizontal) {
365
- if (compSize = (maxRow - 1) * spaceRow + this._itemHeight * maxRow, comp = this._createPager(isScrollbar, isHorizontal, compStyle, compSize),
366
- this._pagerComponent = comp, this._innerView.add(comp), contentSize = maxWidth - comp.AABBBounds.width() - pagerSpace,
367
- contentSize <= 0) return this._innerView.removeChild(comp), !1;
368
+ if (compHeight = (maxRow - 1) * spaceRow + this._itemHeight * maxRow, compWidth = maxWidth,
369
+ comp = this._createPager(compStyle), this._pagerComponent = comp, this._innerView.add(comp),
370
+ contentWidth = maxWidth - comp.AABBBounds.width() - pagerSpace, contentWidth <= 0) return this._innerView.removeChild(comp),
371
+ !1;
368
372
  itemsContainer.getChildren().forEach(((item, index) => {
369
373
  const {width: width, height: height} = item.attribute;
370
- contentSize < startX + width && (startX = 0, startY += height + spaceRow, pages += 1),
374
+ contentWidth < startX + width && (startX = 0, startY += height + spaceRow, pages += 1),
371
375
  index > 0 && item.setAttributes({
372
376
  x: startX,
373
377
  y: startY
374
378
  }), startX += spaceCol + width;
375
379
  })), this._itemContext.startX = startX, this._itemContext.startY = startY, this._itemContext.pages = pages;
376
380
  const total = Math.ceil(pages / maxRow);
377
- this._itemContext.totalPage = total, this._updatePositionOfPager(isScrollbar, isHorizontal, contentSize, renderStartY, compSize);
381
+ this._itemContext.totalPage = total, this._updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight);
378
382
  } else {
379
- if (compSize = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol, comp = this._createPager(isScrollbar, isHorizontal, compStyle, compSize),
380
- this._pagerComponent = comp, this._innerView.add(comp), contentSize = maxHeight - comp.AABBBounds.height() - pagerSpace - renderStartY,
381
- contentSize <= 0) return this._innerView.removeChild(comp), !1;
383
+ if (compWidth = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol, compHeight = maxHeight,
384
+ contentWidth = compWidth, comp = this._createPager(compStyle), this._pagerComponent = comp,
385
+ this._innerView.add(comp), contentHeight = maxHeight - comp.AABBBounds.height() - pagerSpace - renderStartY,
386
+ contentHeight <= 0) return this._innerView.removeChild(comp), !1;
382
387
  itemsContainer.getChildren().forEach(((item, index) => {
383
388
  const {height: height} = item.attribute;
384
- contentSize < startY + height && (startY = 0, startX += this._itemMaxWidth + spaceCol,
389
+ contentHeight < startY + height && (startY = 0, startX += this._itemMaxWidth + spaceCol,
385
390
  pages += 1), index > 0 && item.setAttributes({
386
391
  x: startX,
387
392
  y: startY
388
393
  }), startY += spaceRow + height;
389
394
  }));
390
395
  const total = Math.ceil(pages / maxCol);
391
- this._itemContext.totalPage = total, this._updatePositionOfPager(isScrollbar, isHorizontal, contentSize, renderStartY, compSize);
396
+ this._itemContext.totalPage = total, this._updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight);
392
397
  }
393
- defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compSize + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compSize + spaceCol)));
398
+ defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compHeight + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compWidth + spaceCol)));
394
399
  const clipGroup = vrender_core_1.graphicCreator.group({
395
400
  x: 0,
396
401
  y: renderStartY,
397
- width: isHorizontal ? contentSize : compSize,
398
- height: isHorizontal ? compSize : contentSize,
402
+ width: isHorizontal ? contentWidth : compWidth,
403
+ height: isHorizontal ? compHeight : contentHeight,
399
404
  clip: !0,
400
405
  pickable: !1
401
406
  });
402
- return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isScrollbar, isHorizontal, compSize, isHorizontal ? spaceRow : spaceCol),
407
+ return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isHorizontal ? compHeight + spaceRow : compWidth + spaceCol, isHorizontal ? "y" : "x"),
408
+ !0;
409
+ }
410
+ _renderScrollbar() {
411
+ const renderStartY = this._title ? this._title.AABBBounds.height() + (0, vutils_1.get)(this.attribute, "title.space", 8) : 0, {maxWidth: maxWidth, maxHeight: maxHeight, item: item = {}, pager: pager = {}} = this.attribute, {spaceCol: spaceCol = constant_1.DEFAULT_ITEM_SPACE_COL, spaceRow: spaceRow = constant_1.DEFAULT_ITEM_SPACE_ROW} = item, itemsContainer = this._itemsContainer, {space: pagerSpace = constant_1.DEFAULT_PAGER_SPACE, defaultCurrent: defaultCurrent = 1} = pager, compStyle = __rest(pager, [ "space", "defaultCurrent" ]), {isHorizontal: isHorizontal} = this._itemContext;
412
+ let comp, compSize = 0, contentWidth = 0, contentHeight = 0, startY = 0, pages = 1;
413
+ if (isHorizontal) compSize = maxWidth, contentWidth = maxWidth, contentHeight = this._itemHeight,
414
+ comp = this._createScrollbar(compStyle, compSize), this._pagerComponent = comp,
415
+ this._innerView.add(comp), this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY); else {
416
+ if (compSize = maxHeight, comp = this._createScrollbar(compStyle, compSize), this._pagerComponent = comp,
417
+ this._innerView.add(comp), contentHeight = maxHeight - renderStartY, contentWidth = this._itemMaxWidth,
418
+ contentHeight <= 0) return this._innerView.removeChild(comp), !1;
419
+ itemsContainer.getChildren().forEach(((item, index) => {
420
+ const {height: height} = item.attribute;
421
+ pages = Math.floor((startY + height) / contentHeight) + 1, startY += spaceRow + height;
422
+ })), this._itemContext.totalPage = pages, this._itemContext.pages = pages, this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY);
423
+ }
424
+ defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (contentWidth + spaceCol)) : itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (contentHeight + spaceRow)));
425
+ const clipGroup = vrender_core_1.graphicCreator.group({
426
+ x: 0,
427
+ y: renderStartY,
428
+ width: contentWidth,
429
+ height: contentHeight,
430
+ clip: !0,
431
+ pickable: !1
432
+ });
433
+ return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isHorizontal ? contentWidth : contentHeight, isHorizontal ? "x" : "y"),
434
+ !0;
435
+ }
436
+ _renderPagerComponent() {
437
+ return this._itemContext.isScrollbar ? this._renderScrollbar() : this._renderPager(),
403
438
  !0;
404
439
  }
405
440
  _hover(legendItem, e) {