@visactor/vrender-components 0.18.4 → 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.
- package/cjs/axis/animate/group-transition.d.ts +0 -1
- package/cjs/axis/animate/group-transition.js +2 -10
- package/cjs/axis/animate/group-transition.js.map +1 -1
- package/cjs/axis/base.d.ts +8 -3
- package/cjs/axis/base.js +6 -2
- package/cjs/axis/base.js.map +1 -1
- package/cjs/axis/grid/base.d.ts +8 -3
- package/cjs/axis/grid/base.js +6 -2
- package/cjs/axis/grid/base.js.map +1 -1
- package/cjs/axis/line.js +18 -3
- package/cjs/axis/line.js.map +1 -1
- package/cjs/axis/overlap/auto-limit.d.ts +1 -0
- package/cjs/axis/overlap/auto-limit.js +30 -6
- package/cjs/axis/overlap/auto-limit.js.map +1 -1
- package/cjs/axis/overlap/util.d.ts +12 -0
- package/cjs/axis/overlap/util.js +40 -2
- package/cjs/axis/overlap/util.js.map +1 -1
- package/cjs/axis/util.d.ts +3 -1
- package/cjs/axis/util.js +11 -3
- package/cjs/axis/util.js.map +1 -1
- package/cjs/brush/brush.d.ts +1 -0
- package/cjs/brush/brush.js +5 -4
- package/cjs/brush/brush.js.map +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/legend/discrete/discrete.d.ts +5 -0
- package/cjs/legend/discrete/discrete.js +120 -85
- package/cjs/legend/discrete/discrete.js.map +1 -1
- package/cjs/scrollbar/scrollbar.d.ts +1 -0
- package/cjs/scrollbar/scrollbar.js +7 -6
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/es/axis/animate/group-transition.d.ts +0 -1
- package/es/axis/animate/group-transition.js +2 -10
- package/es/axis/animate/group-transition.js.map +1 -1
- package/es/axis/base.d.ts +8 -3
- package/es/axis/base.js +7 -1
- package/es/axis/base.js.map +1 -1
- package/es/axis/grid/base.d.ts +8 -3
- package/es/axis/grid/base.js +7 -1
- package/es/axis/grid/base.js.map +1 -1
- package/es/axis/line.js +18 -3
- package/es/axis/line.js.map +1 -1
- package/es/axis/overlap/auto-limit.d.ts +1 -0
- package/es/axis/overlap/auto-limit.js +30 -5
- package/es/axis/overlap/auto-limit.js.map +1 -1
- package/es/axis/overlap/util.d.ts +12 -0
- package/es/axis/overlap/util.js +37 -0
- package/es/axis/overlap/util.js.map +1 -1
- package/es/axis/util.d.ts +3 -1
- package/es/axis/util.js +9 -0
- package/es/axis/util.js.map +1 -1
- package/es/brush/brush.d.ts +1 -0
- package/es/brush/brush.js +5 -4
- package/es/brush/brush.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/legend/discrete/discrete.d.ts +5 -0
- package/es/legend/discrete/discrete.js +122 -86
- package/es/legend/discrete/discrete.js.map +1 -1
- package/es/scrollbar/scrollbar.d.ts +1 -0
- package/es/scrollbar/scrollbar.js +7 -6
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/package.json +3 -3
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.18.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAEhC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.18.6\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './util';\n"]}
|
|
@@ -26,14 +26,19 @@ export declare class DiscreteLegend extends LegendBase<DiscreteLegendAttrs> {
|
|
|
26
26
|
isHorizontal: boolean;
|
|
27
27
|
currentPage: number;
|
|
28
28
|
totalPage: number;
|
|
29
|
+
isScrollbar: boolean;
|
|
29
30
|
};
|
|
30
31
|
protected _renderContent(): void;
|
|
31
32
|
protected _bindEvents(): void;
|
|
32
33
|
private _autoEllipsis;
|
|
33
34
|
private _renderEachItem;
|
|
34
35
|
private _createPager;
|
|
36
|
+
private _createScrollbar;
|
|
35
37
|
private _updatePositionOfPager;
|
|
38
|
+
private _updatePositionOfScrollbar;
|
|
36
39
|
private _bindEventsOfPager;
|
|
40
|
+
private _renderPager;
|
|
41
|
+
private _renderScrollbar;
|
|
37
42
|
private _renderPagerComponent;
|
|
38
43
|
private _onHover;
|
|
39
44
|
private _onUnHover;
|
|
@@ -95,32 +95,29 @@ export class DiscreteLegend extends LegendBase {
|
|
|
95
95
|
}));
|
|
96
96
|
}
|
|
97
97
|
_renderItems() {
|
|
98
|
-
const {item: itemAttrs = {}, maxCol: maxCol = 1, maxRow: maxRow = 2, maxWidth: maxWidth, maxHeight: maxHeight, defaultSelected: defaultSelected = [], lazyload: lazyload} = this.attribute, {spaceCol: spaceCol = DEFAULT_ITEM_SPACE_COL, spaceRow: spaceRow = DEFAULT_ITEM_SPACE_ROW} = itemAttrs, itemsContainer = this._itemsContainer, {items: legendItems, isHorizontal: isHorizontal, startIndex: startIndex} = this._itemContext, maxPages = isHorizontal ? maxRow : maxCol;
|
|
98
|
+
const {item: itemAttrs = {}, maxCol: maxCol = 1, maxRow: maxRow = 2, maxWidth: maxWidth, maxHeight: maxHeight, defaultSelected: defaultSelected = [], lazyload: lazyload, autoPage: autoPage} = this.attribute, {spaceCol: spaceCol = DEFAULT_ITEM_SPACE_COL, spaceRow: spaceRow = DEFAULT_ITEM_SPACE_ROW} = itemAttrs, itemsContainer = this._itemsContainer, {items: legendItems, isHorizontal: isHorizontal, startIndex: startIndex, isScrollbar: isScrollbar} = this._itemContext, maxPages = isScrollbar ? 1 : isHorizontal ? maxRow : maxCol;
|
|
99
99
|
let item, {doWrap: doWrap, maxWidthInCol: maxWidthInCol, startX: startX, startY: startY, pages: pages} = this._itemContext;
|
|
100
|
-
for (let index = startIndex, len = legendItems.length; index < len; index++) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
item = legendItems[index], item.id || (item.id = item.label), item.index = index;
|
|
100
|
+
for (let index = startIndex, len = legendItems.length; index < len && !(lazyload && pages > this._itemContext.currentPage * maxPages); index++) {
|
|
101
|
+
lazyload && (this._itemContext.startIndex = index + 1), item = legendItems[index],
|
|
102
|
+
item.id || (item.id = item.label), item.index = index;
|
|
106
103
|
const itemGroup = this._renderEachItem(item, !!isEmpty(defaultSelected) || (null == defaultSelected ? void 0 : defaultSelected.includes(item.label)), index, legendItems), itemWidth = itemGroup.attribute.width, itemHeight = itemGroup.attribute.height;
|
|
107
104
|
this._itemHeight = Math.max(this._itemHeight, itemHeight), maxWidthInCol = Math.max(itemWidth, maxWidthInCol),
|
|
108
|
-
this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth), isHorizontal ? (isValid(maxWidth) && (
|
|
109
|
-
|
|
110
|
-
startX = 0, startY += itemHeight + spaceRow
|
|
105
|
+
this._itemMaxWidth = Math.max(itemWidth, this._itemMaxWidth), isHorizontal ? (isValid(maxWidth) && (isScrollbar && autoPage ? (pages = Math.ceil((startX + itemWidth) / maxWidth),
|
|
106
|
+
doWrap = pages > 1) : startX + itemWidth > maxWidth && (doWrap = !0, startX > 0 && (pages += 1,
|
|
107
|
+
startX = 0, startY += itemHeight + spaceRow))), 0 === startX && 0 === startY || itemGroup.setAttributes({
|
|
111
108
|
x: startX,
|
|
112
109
|
y: startY
|
|
113
|
-
}), startX += spaceCol + itemWidth) : (isValid(maxHeight) &&
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
}), startX += spaceCol + itemWidth) : (isValid(maxHeight) && (isScrollbar && autoPage ? (pages = Math.ceil((startY + itemHeight) / maxHeight),
|
|
111
|
+
doWrap = pages > 1) : maxHeight < startY + itemHeight && (pages += 1, doWrap = !0,
|
|
112
|
+
startY = 0, startX += maxWidthInCol + spaceCol, maxWidthInCol = 0)), 0 === startX && 0 === startY || itemGroup.setAttributes({
|
|
116
113
|
x: startX,
|
|
117
114
|
y: startY
|
|
118
115
|
}), startY += spaceRow + itemHeight), itemsContainer.add(itemGroup);
|
|
119
116
|
}
|
|
120
117
|
return this._itemContext.doWrap = doWrap, this._itemContext.startX = startX, this._itemContext.startY = startY,
|
|
121
118
|
this._itemContext.maxWidthInCol = maxWidthInCol, this._itemContext.pages = pages,
|
|
122
|
-
this._itemContext.maxPages = maxPages,
|
|
123
|
-
this._itemContext;
|
|
119
|
+
this._itemContext.maxPages = maxPages, isScrollbar && (this._itemContext.totalPage = pages),
|
|
120
|
+
lazyload || (this._itemContext.startIndex = legendItems.length), this._itemContext;
|
|
124
121
|
}
|
|
125
122
|
_renderContent() {
|
|
126
123
|
const {item: item = {}, items: items, reversed: reversed, maxWidth: maxWidth} = this.attribute;
|
|
@@ -135,8 +132,10 @@ export class DiscreteLegend extends LegendBase {
|
|
|
135
132
|
const {layout: layout, autoPage: autoPage} = this.attribute, isHorizontal = "horizontal" === layout, {maxWidth: maxItemWidth, width: itemWidth, height: itemHeight} = item, widthsOptions = [];
|
|
136
133
|
isValid(maxItemWidth) && widthsOptions.push(maxItemWidth), isValid(itemWidth) && widthsOptions.push(itemWidth),
|
|
137
134
|
widthsOptions.length && (isValid(maxWidth) && widthsOptions.push(maxWidth), this._itemWidthByUser = minInArray(widthsOptions)),
|
|
138
|
-
isValid(itemHeight) && (this._itemHeightByUser = itemHeight)
|
|
139
|
-
|
|
135
|
+
isValid(itemHeight) && (this._itemHeightByUser = itemHeight);
|
|
136
|
+
const pager = this.attribute.pager;
|
|
137
|
+
this._itemContext = {
|
|
138
|
+
currentPage: pager && pager.defaultCurrent || 1,
|
|
140
139
|
doWrap: !1,
|
|
141
140
|
maxWidthInCol: 0,
|
|
142
141
|
maxPages: 1,
|
|
@@ -146,10 +145,11 @@ export class DiscreteLegend extends LegendBase {
|
|
|
146
145
|
startIndex: 0,
|
|
147
146
|
items: legendItems,
|
|
148
147
|
isHorizontal: isHorizontal,
|
|
149
|
-
totalPage: 1 / 0
|
|
148
|
+
totalPage: 1 / 0,
|
|
149
|
+
isScrollbar: pager && "scrollbar" === pager.type
|
|
150
150
|
}, this._itemContext = this._renderItems();
|
|
151
151
|
let pagerRendered = !1;
|
|
152
|
-
this._itemContext.doWrap && autoPage && this._itemContext.pages > this._itemContext.maxPages && (pagerRendered = this._renderPagerComponent(
|
|
152
|
+
this._itemContext.doWrap && autoPage && this._itemContext.pages > this._itemContext.maxPages && (pagerRendered = this._renderPagerComponent()),
|
|
153
153
|
pagerRendered || (itemsContainer.setAttribute("y", this._title ? this._title.AABBBounds.height() + get(this.attribute, "title.space", 8) : 0),
|
|
154
154
|
this._innerView.add(itemsContainer));
|
|
155
155
|
}
|
|
@@ -274,24 +274,10 @@ export class DiscreteLegend extends LegendBase {
|
|
|
274
274
|
focusShape && focusShape.setAttribute("visible", !1), innerGroup.translateTo(-innerGroupBounds.x1 + parsedPadding[3], -innerGroupBounds.y1 + parsedPadding[0]),
|
|
275
275
|
itemGroup;
|
|
276
276
|
}
|
|
277
|
-
_createPager(
|
|
277
|
+
_createPager(compStyle) {
|
|
278
278
|
var _a, _b;
|
|
279
279
|
const {disableTriggerEvent: disableTriggerEvent, maxRow: maxRow} = this.attribute;
|
|
280
|
-
return
|
|
281
|
-
direction: "vertical",
|
|
282
|
-
width: 12,
|
|
283
|
-
range: [ 0, .5 ]
|
|
284
|
-
}, compStyle), {
|
|
285
|
-
height: compSize,
|
|
286
|
-
disableTriggerEvent: disableTriggerEvent
|
|
287
|
-
}) : Object.assign(Object.assign({
|
|
288
|
-
direction: "horizontal",
|
|
289
|
-
disableTriggerEvent: disableTriggerEvent,
|
|
290
|
-
range: [ 0, .5 ],
|
|
291
|
-
height: 12
|
|
292
|
-
}, compStyle), {
|
|
293
|
-
width: compSize
|
|
294
|
-
})) : new Pager(isHorizontal ? Object.assign(Object.assign({
|
|
280
|
+
return this._itemContext.isHorizontal ? new Pager(Object.assign(Object.assign({
|
|
295
281
|
layout: 1 === maxRow ? "horizontal" : "vertical",
|
|
296
282
|
total: 99
|
|
297
283
|
}, merge({
|
|
@@ -302,43 +288,62 @@ export class DiscreteLegend extends LegendBase {
|
|
|
302
288
|
}, compStyle)), {
|
|
303
289
|
defaultCurrent: null === (_a = this.attribute.pager) || void 0 === _a ? void 0 : _a.defaultCurrent,
|
|
304
290
|
disableTriggerEvent: disableTriggerEvent
|
|
305
|
-
}) : Object.assign({
|
|
291
|
+
})) : new Pager(Object.assign({
|
|
306
292
|
layout: "horizontal",
|
|
307
293
|
total: 99,
|
|
308
294
|
disableTriggerEvent: disableTriggerEvent,
|
|
309
295
|
defaultCurrent: null === (_b = this.attribute.pager) || void 0 === _b ? void 0 : _b.defaultCurrent
|
|
310
296
|
}, compStyle));
|
|
311
297
|
}
|
|
312
|
-
|
|
313
|
-
const {
|
|
314
|
-
|
|
298
|
+
_createScrollbar(compStyle, compSize) {
|
|
299
|
+
const {disableTriggerEvent: disableTriggerEvent} = this.attribute;
|
|
300
|
+
return this._itemContext.isHorizontal ? new ScrollBar(Object.assign(Object.assign({
|
|
301
|
+
direction: "horizontal",
|
|
302
|
+
disableTriggerEvent: disableTriggerEvent,
|
|
303
|
+
range: [ 0, .5 ],
|
|
304
|
+
height: 12
|
|
305
|
+
}, compStyle), {
|
|
306
|
+
width: compSize
|
|
307
|
+
})) : new ScrollBar(Object.assign(Object.assign({
|
|
308
|
+
direction: "vertical",
|
|
309
|
+
width: 12,
|
|
310
|
+
range: [ 0, .5 ]
|
|
311
|
+
}, compStyle), {
|
|
312
|
+
height: compSize,
|
|
313
|
+
disableTriggerEvent: disableTriggerEvent
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
_updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight) {
|
|
317
|
+
const {maxHeight: maxHeight, pager: pager} = this.attribute, {totalPage: totalPage, isHorizontal: isHorizontal} = this._itemContext, position = pager && pager.position || "middle";
|
|
318
|
+
if (this._pagerComponent.setTotal(totalPage), isHorizontal) {
|
|
319
|
+
let y;
|
|
320
|
+
y = "start" === position ? renderStartY : "end" === position ? renderStartY + compHeight - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compHeight / 2 - this._pagerComponent.AABBBounds.height() / 2,
|
|
321
|
+
this._pagerComponent.setAttributes({
|
|
322
|
+
x: contentWidth,
|
|
323
|
+
y: y
|
|
324
|
+
});
|
|
325
|
+
} else {
|
|
326
|
+
let x;
|
|
327
|
+
x = "start" === position ? 0 : "end" === position ? compWidth - this._pagerComponent.AABBBounds.width() : (compWidth - this._pagerComponent.AABBBounds.width()) / 2,
|
|
328
|
+
this._pagerComponent.setAttributes({
|
|
329
|
+
x: x,
|
|
330
|
+
y: maxHeight - this._pagerComponent.AABBBounds.height()
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
_updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY) {
|
|
335
|
+
const {currentPage: currentPage, totalPage: totalPage, isHorizontal: isHorizontal} = this._itemContext;
|
|
336
|
+
this._pagerComponent.setScrollRange([ (currentPage - 1) / totalPage, currentPage / totalPage ]),
|
|
315
337
|
isHorizontal ? this._pagerComponent.setAttributes({
|
|
316
|
-
x: contentSize,
|
|
317
|
-
y: renderStartY
|
|
318
|
-
}) : this._pagerComponent.setAttributes({
|
|
319
338
|
x: 0,
|
|
320
|
-
y:
|
|
321
|
-
})
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
y = "start" === position ? renderStartY : "end" === position ? renderStartY + compSize - this._pagerComponent.AABBBounds.height() / 2 : renderStartY + compSize / 2 - this._pagerComponent.AABBBounds.height() / 2,
|
|
326
|
-
this._pagerComponent.setAttributes({
|
|
327
|
-
x: contentSize,
|
|
328
|
-
y: y
|
|
329
|
-
});
|
|
330
|
-
} else {
|
|
331
|
-
let x;
|
|
332
|
-
x = "start" === position ? 0 : "end" === position ? compSize - this._pagerComponent.AABBBounds.width() : (compSize - this._pagerComponent.AABBBounds.width()) / 2,
|
|
333
|
-
this._pagerComponent.setAttributes({
|
|
334
|
-
x: x,
|
|
335
|
-
y: maxHeight - this._pagerComponent.AABBBounds.height()
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
+
y: renderStartY + contentHeight
|
|
340
|
+
}) : this._pagerComponent.setAttributes({
|
|
341
|
+
x: contentWidth,
|
|
342
|
+
y: renderStartY
|
|
343
|
+
});
|
|
339
344
|
}
|
|
340
|
-
_bindEventsOfPager(
|
|
341
|
-
const pager = this.attribute.pager || {}, {animation: animation = !0, animationDuration: animationDuration = 450, animationEasing: animationEasing = "quadIn"} = pager, pageParser = isScrollbar ? e => {
|
|
345
|
+
_bindEventsOfPager(pageSize, channel) {
|
|
346
|
+
const pager = this.attribute.pager || {}, {animation: animation = !0, animationDuration: animationDuration = 450, animationEasing: animationEasing = "quadIn"} = pager, pageParser = this._itemContext.isScrollbar ? e => {
|
|
342
347
|
const {value: value} = e.detail;
|
|
343
348
|
let newPage = value[0] * this._itemContext.totalPage;
|
|
344
349
|
return pager.scrollByPosition ? newPage += 1 : newPage = Math.floor(newPage) + 1,
|
|
@@ -351,58 +356,89 @@ export class DiscreteLegend extends LegendBase {
|
|
|
351
356
|
const newTotalPage = Math.ceil(this._itemContext.pages / this._itemContext.maxPages);
|
|
352
357
|
this._itemContext.totalPage = newTotalPage, this._pagerComponent.setScrollRange([ (newPage - 1) / newTotalPage, newPage / newTotalPage ]);
|
|
353
358
|
}
|
|
354
|
-
animation ? this._itemsContainer.animate().to(
|
|
355
|
-
|
|
356
|
-
} :
|
|
357
|
-
x: -(newPage - 1) * (compSize + spaceSize)
|
|
358
|
-
}, animationDuration, animationEasing) : isHorizontal ? this._itemsContainer.setAttribute("y", -(newPage - 1) * (compSize + spaceSize)) : this._itemsContainer.setAttribute("x", -(newPage - 1) * (compSize + spaceSize));
|
|
359
|
+
animation ? this._itemsContainer.animate().to({
|
|
360
|
+
[channel]: -(newPage - 1) * pageSize
|
|
361
|
+
}, animationDuration, animationEasing) : this._itemsContainer.setAttribute(channel, -(newPage - 1) * pageSize);
|
|
359
362
|
}
|
|
360
363
|
};
|
|
361
|
-
isScrollbar ? (this._pagerComponent.addEventListener("scrollDrag", onPaging),
|
|
364
|
+
this._itemContext.isScrollbar ? (this._pagerComponent.addEventListener("scrollDrag", onPaging),
|
|
365
|
+
this._pagerComponent.addEventListener("scrollUp", onPaging)) : (this._pagerComponent.addEventListener("toPrev", onPaging),
|
|
362
366
|
this._pagerComponent.addEventListener("toNext", onPaging));
|
|
363
367
|
}
|
|
364
|
-
|
|
365
|
-
const renderStartY = this._title ? this._title.AABBBounds.height() + 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 = DEFAULT_ITEM_SPACE_COL, spaceRow: spaceRow = DEFAULT_ITEM_SPACE_ROW} = item, itemsContainer = this._itemsContainer, {space: pagerSpace = DEFAULT_PAGER_SPACE, defaultCurrent: defaultCurrent = 1} = pager, compStyle = __rest(pager, [ "space", "defaultCurrent" ]),
|
|
366
|
-
let comp,
|
|
368
|
+
_renderPager() {
|
|
369
|
+
const renderStartY = this._title ? this._title.AABBBounds.height() + 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 = DEFAULT_ITEM_SPACE_COL, spaceRow: spaceRow = DEFAULT_ITEM_SPACE_ROW} = item, itemsContainer = this._itemsContainer, {space: pagerSpace = DEFAULT_PAGER_SPACE, defaultCurrent: defaultCurrent = 1} = pager, compStyle = __rest(pager, [ "space", "defaultCurrent" ]), {isHorizontal: isHorizontal} = this._itemContext;
|
|
370
|
+
let comp, compWidth = 0, compHeight = 0, contentWidth = 0, contentHeight = 0, startX = 0, startY = 0, pages = 1;
|
|
367
371
|
if (isHorizontal) {
|
|
368
|
-
if (
|
|
369
|
-
this._pagerComponent = comp, this._innerView.add(comp),
|
|
370
|
-
|
|
372
|
+
if (compHeight = (maxRow - 1) * spaceRow + this._itemHeight * maxRow, compWidth = maxWidth,
|
|
373
|
+
comp = this._createPager(compStyle), this._pagerComponent = comp, this._innerView.add(comp),
|
|
374
|
+
contentWidth = maxWidth - comp.AABBBounds.width() - pagerSpace, contentWidth <= 0) return this._innerView.removeChild(comp),
|
|
375
|
+
!1;
|
|
371
376
|
itemsContainer.getChildren().forEach(((item, index) => {
|
|
372
377
|
const {width: width, height: height} = item.attribute;
|
|
373
|
-
|
|
378
|
+
contentWidth < startX + width && (startX = 0, startY += height + spaceRow, pages += 1),
|
|
374
379
|
index > 0 && item.setAttributes({
|
|
375
380
|
x: startX,
|
|
376
381
|
y: startY
|
|
377
382
|
}), startX += spaceCol + width;
|
|
378
383
|
})), this._itemContext.startX = startX, this._itemContext.startY = startY, this._itemContext.pages = pages;
|
|
379
384
|
const total = Math.ceil(pages / maxRow);
|
|
380
|
-
this._itemContext.totalPage = total, this._updatePositionOfPager(
|
|
385
|
+
this._itemContext.totalPage = total, this._updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight);
|
|
381
386
|
} else {
|
|
382
|
-
if (
|
|
383
|
-
|
|
384
|
-
|
|
387
|
+
if (compWidth = this._itemMaxWidth * maxCol + (maxCol - 1) * spaceCol, compHeight = maxHeight,
|
|
388
|
+
contentWidth = compWidth, comp = this._createPager(compStyle), this._pagerComponent = comp,
|
|
389
|
+
this._innerView.add(comp), contentHeight = maxHeight - comp.AABBBounds.height() - pagerSpace - renderStartY,
|
|
390
|
+
contentHeight <= 0) return this._innerView.removeChild(comp), !1;
|
|
385
391
|
itemsContainer.getChildren().forEach(((item, index) => {
|
|
386
392
|
const {height: height} = item.attribute;
|
|
387
|
-
|
|
393
|
+
contentHeight < startY + height && (startY = 0, startX += this._itemMaxWidth + spaceCol,
|
|
388
394
|
pages += 1), index > 0 && item.setAttributes({
|
|
389
395
|
x: startX,
|
|
390
396
|
y: startY
|
|
391
397
|
}), startY += spaceRow + height;
|
|
392
398
|
}));
|
|
393
399
|
const total = Math.ceil(pages / maxCol);
|
|
394
|
-
this._itemContext.totalPage = total, this._updatePositionOfPager(
|
|
400
|
+
this._itemContext.totalPage = total, this._updatePositionOfPager(contentWidth, contentHeight, renderStartY, compWidth, compHeight);
|
|
395
401
|
}
|
|
396
|
-
defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (
|
|
402
|
+
defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (compHeight + spaceRow)) : itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (compWidth + spaceCol)));
|
|
397
403
|
const clipGroup = graphicCreator.group({
|
|
398
404
|
x: 0,
|
|
399
405
|
y: renderStartY,
|
|
400
|
-
width: isHorizontal ?
|
|
401
|
-
height: isHorizontal ?
|
|
406
|
+
width: isHorizontal ? contentWidth : compWidth,
|
|
407
|
+
height: isHorizontal ? compHeight : contentHeight,
|
|
402
408
|
clip: !0,
|
|
403
409
|
pickable: !1
|
|
404
410
|
});
|
|
405
|
-
return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(
|
|
411
|
+
return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isHorizontal ? compHeight + spaceRow : compWidth + spaceCol, isHorizontal ? "y" : "x"),
|
|
412
|
+
!0;
|
|
413
|
+
}
|
|
414
|
+
_renderScrollbar() {
|
|
415
|
+
const renderStartY = this._title ? this._title.AABBBounds.height() + get(this.attribute, "title.space", 8) : 0, {maxWidth: maxWidth, maxHeight: maxHeight, item: item = {}, pager: pager = {}} = this.attribute, {spaceCol: spaceCol = DEFAULT_ITEM_SPACE_COL, spaceRow: spaceRow = DEFAULT_ITEM_SPACE_ROW} = item, itemsContainer = this._itemsContainer, {space: pagerSpace = DEFAULT_PAGER_SPACE, defaultCurrent: defaultCurrent = 1} = pager, compStyle = __rest(pager, [ "space", "defaultCurrent" ]), {isHorizontal: isHorizontal} = this._itemContext;
|
|
416
|
+
let comp, compSize = 0, contentWidth = 0, contentHeight = 0, startY = 0, pages = 1;
|
|
417
|
+
if (isHorizontal) compSize = maxWidth, contentWidth = maxWidth, contentHeight = this._itemHeight,
|
|
418
|
+
comp = this._createScrollbar(compStyle, compSize), this._pagerComponent = comp,
|
|
419
|
+
this._innerView.add(comp), this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY); else {
|
|
420
|
+
if (compSize = maxHeight, comp = this._createScrollbar(compStyle, compSize), this._pagerComponent = comp,
|
|
421
|
+
this._innerView.add(comp), contentHeight = maxHeight - renderStartY, contentWidth = this._itemMaxWidth,
|
|
422
|
+
contentHeight <= 0) return this._innerView.removeChild(comp), !1;
|
|
423
|
+
itemsContainer.getChildren().forEach(((item, index) => {
|
|
424
|
+
const {height: height} = item.attribute;
|
|
425
|
+
pages = Math.floor((startY + height) / contentHeight) + 1, startY += spaceRow + height;
|
|
426
|
+
})), this._itemContext.totalPage = pages, this._itemContext.pages = pages, this._updatePositionOfScrollbar(contentWidth, contentHeight, renderStartY);
|
|
427
|
+
}
|
|
428
|
+
defaultCurrent > 1 && (isHorizontal ? itemsContainer.setAttribute("x", -(defaultCurrent - 1) * (contentWidth + spaceCol)) : itemsContainer.setAttribute("y", -(defaultCurrent - 1) * (contentHeight + spaceRow)));
|
|
429
|
+
const clipGroup = graphicCreator.group({
|
|
430
|
+
x: 0,
|
|
431
|
+
y: renderStartY,
|
|
432
|
+
width: contentWidth,
|
|
433
|
+
height: contentHeight,
|
|
434
|
+
clip: !0,
|
|
435
|
+
pickable: !1
|
|
436
|
+
});
|
|
437
|
+
return clipGroup.add(itemsContainer), this._innerView.add(clipGroup), this._bindEventsOfPager(isHorizontal ? contentWidth : contentHeight, isHorizontal ? "x" : "y"),
|
|
438
|
+
!0;
|
|
439
|
+
}
|
|
440
|
+
_renderPagerComponent() {
|
|
441
|
+
return this._itemContext.isScrollbar ? this._renderScrollbar() : this._renderPager(),
|
|
406
442
|
!0;
|
|
407
443
|
}
|
|
408
444
|
_hover(legendItem, e) {
|