@visactor/vtable 0.10.2-alpha.3 → 0.10.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.
- package/cjs/ListTable.d.ts +2 -1
- package/cjs/ListTable.js +6 -0
- package/cjs/ListTable.js.map +1 -1
- package/cjs/PivotChart.d.ts +1 -0
- package/cjs/PivotChart.js +3 -2
- package/cjs/PivotChart.js.map +1 -1
- package/cjs/PivotTable.d.ts +2 -1
- package/cjs/PivotTable.js +8 -2
- package/cjs/PivotTable.js.map +1 -1
- package/cjs/components/axis/axis.js +4 -0
- package/cjs/components/axis/axis.js.map +1 -1
- package/cjs/components/legend/continue-legend/continue-legend.d.ts +24 -0
- package/cjs/components/legend/continue-legend/continue-legend.js +93 -0
- package/cjs/components/legend/continue-legend/continue-legend.js.map +1 -0
- package/cjs/components/legend/continue-legend/get-continue-legend-attributes.d.ts +5 -0
- package/cjs/components/legend/continue-legend/get-continue-legend-attributes.js +139 -0
- package/cjs/components/legend/continue-legend/get-continue-legend-attributes.js.map +1 -0
- package/cjs/components/legend/create-legend.d.ts +5 -0
- package/cjs/components/legend/create-legend.js +14 -0
- package/cjs/components/legend/create-legend.js.map +1 -0
- package/{es/components/legend/legend.d.ts → cjs/components/legend/discrete-legend/discrete-legend.d.ts} +6 -6
- package/cjs/components/legend/{legend.js → discrete-legend/discrete-legend.js} +6 -6
- package/cjs/components/legend/discrete-legend/discrete-legend.js.map +1 -0
- package/cjs/components/legend/discrete-legend/get-discrete-legend-attributes.d.ts +5 -0
- package/cjs/components/legend/{get-legend-attributes.js → discrete-legend/get-discrete-legend-attributes.js} +2 -2
- package/cjs/components/legend/discrete-legend/get-discrete-legend-attributes.js.map +1 -0
- package/cjs/core/BaseTable.d.ts +1 -1
- package/cjs/core/BaseTable.js +4 -10
- package/cjs/core/BaseTable.js.map +1 -1
- package/cjs/core/TABLE_EVENT_TYPE.d.ts +1 -0
- package/cjs/core/TABLE_EVENT_TYPE.js +1 -0
- package/cjs/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/cjs/dataset/dataset.d.ts +11 -8
- package/cjs/dataset/dataset.js +14 -3
- package/cjs/dataset/dataset.js.map +1 -1
- package/cjs/event/listener/table-group.js +42 -49
- package/cjs/event/listener/table-group.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/ts-types/base-table.d.ts +3 -2
- package/cjs/ts-types/base-table.js.map +1 -1
- package/cjs/ts-types/component/legend.d.ts +15 -2
- package/cjs/ts-types/component/legend.js.map +1 -1
- package/cjs/ts-types/events.d.ts +6 -0
- package/cjs/ts-types/events.js.map +1 -1
- package/cjs/ts-types/table-engine.js.map +1 -1
- package/dist/vtable.js +1118 -26
- package/dist/vtable.min.js +3 -3
- package/es/ListTable.d.ts +2 -1
- package/es/ListTable.js +6 -0
- package/es/ListTable.js.map +1 -1
- package/es/PivotChart.d.ts +1 -0
- package/es/PivotChart.js +3 -2
- package/es/PivotChart.js.map +1 -1
- package/es/PivotTable.d.ts +2 -1
- package/es/PivotTable.js +8 -2
- package/es/PivotTable.js.map +1 -1
- package/es/components/axis/axis.js +4 -0
- package/es/components/axis/axis.js.map +1 -1
- package/es/components/legend/continue-legend/continue-legend.d.ts +24 -0
- package/es/components/legend/continue-legend/continue-legend.js +91 -0
- package/es/components/legend/continue-legend/continue-legend.js.map +1 -0
- package/es/components/legend/continue-legend/get-continue-legend-attributes.d.ts +5 -0
- package/es/components/legend/continue-legend/get-continue-legend-attributes.js +132 -0
- package/es/components/legend/continue-legend/get-continue-legend-attributes.js.map +1 -0
- package/es/components/legend/create-legend.d.ts +5 -0
- package/es/components/legend/create-legend.js +8 -0
- package/es/components/legend/create-legend.js.map +1 -0
- package/{cjs/components/legend/legend.d.ts → es/components/legend/discrete-legend/discrete-legend.d.ts} +6 -6
- package/es/components/legend/{legend.js → discrete-legend/discrete-legend.js} +5 -5
- package/es/components/legend/discrete-legend/discrete-legend.js.map +1 -0
- package/es/components/legend/discrete-legend/get-discrete-legend-attributes.d.ts +5 -0
- package/es/components/legend/{get-legend-attributes.js → discrete-legend/get-discrete-legend-attributes.js} +3 -3
- package/es/components/legend/discrete-legend/get-discrete-legend-attributes.js.map +1 -0
- package/es/core/BaseTable.d.ts +1 -1
- package/es/core/BaseTable.js +4 -10
- package/es/core/BaseTable.js.map +1 -1
- package/es/core/TABLE_EVENT_TYPE.d.ts +1 -0
- package/es/core/TABLE_EVENT_TYPE.js +1 -0
- package/es/core/TABLE_EVENT_TYPE.js.map +1 -1
- package/es/dataset/dataset.d.ts +11 -8
- package/es/dataset/dataset.js +13 -3
- package/es/dataset/dataset.js.map +1 -1
- package/es/event/listener/table-group.js +41 -48
- package/es/event/listener/table-group.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/ts-types/base-table.d.ts +3 -2
- package/es/ts-types/base-table.js.map +1 -1
- package/es/ts-types/component/legend.d.ts +15 -2
- package/es/ts-types/component/legend.js.map +1 -1
- package/es/ts-types/events.d.ts +6 -0
- package/es/ts-types/events.js.map +1 -1
- package/es/ts-types/table-engine.js.map +1 -1
- package/package.json +1 -1
- package/cjs/components/legend/get-legend-attributes.d.ts +0 -5
- package/cjs/components/legend/get-legend-attributes.js.map +0 -1
- package/cjs/components/legend/legend.js.map +0 -1
- package/es/components/legend/get-legend-attributes.d.ts +0 -5
- package/es/components/legend/get-legend-attributes.js.map +0 -1
- package/es/components/legend/legend.js.map +0 -1
package/dist/vtable.js
CHANGED
|
@@ -4442,6 +4442,9 @@
|
|
|
4442
4442
|
} else defaults(target, source, override);
|
|
4443
4443
|
}
|
|
4444
4444
|
|
|
4445
|
+
function array$1(arr) {
|
|
4446
|
+
return isValid(arr) ? isArray(arr) ? arr : [arr] : [];
|
|
4447
|
+
}
|
|
4445
4448
|
function last(val) {
|
|
4446
4449
|
if (isArrayLike(val)) {
|
|
4447
4450
|
return val[val.length - 1];
|
|
@@ -5897,6 +5900,7 @@
|
|
|
5897
5900
|
LEGEND_ITEM_CLICK: 'legend_item_click',
|
|
5898
5901
|
LEGEND_ITEM_HOVER: 'legend_item_hover',
|
|
5899
5902
|
LEGEND_ITEM_UNHOVER: 'legend_item_unHover',
|
|
5903
|
+
LEGEND_CHANGE: 'legend_change',
|
|
5900
5904
|
MOUSEENTER_AXIS: 'mouseenter_axis',
|
|
5901
5905
|
MOUSELEAVE_AXIS: 'mouseleave_axis'
|
|
5902
5906
|
};
|
|
@@ -34749,6 +34753,748 @@
|
|
|
34749
34753
|
}
|
|
34750
34754
|
}
|
|
34751
34755
|
|
|
34756
|
+
var SLIDER_ELEMENT_NAME;
|
|
34757
|
+
!function (SLIDER_ELEMENT_NAME) {
|
|
34758
|
+
SLIDER_ELEMENT_NAME.innerView = "innerView", SLIDER_ELEMENT_NAME.railContainer = "sliderRailContainer", SLIDER_ELEMENT_NAME.rail = "sliderRail", SLIDER_ELEMENT_NAME.startText = "sliderStartText", SLIDER_ELEMENT_NAME.endText = "sliderEndText", SLIDER_ELEMENT_NAME.startHandler = "sliderStartHandler", SLIDER_ELEMENT_NAME.startHandlerText = "startHandlerText", SLIDER_ELEMENT_NAME.endHandler = "sliderEndHandler", SLIDER_ELEMENT_NAME.endHandlerText = "sliderEndHandlerText", SLIDER_ELEMENT_NAME.track = "sliderTrack", SLIDER_ELEMENT_NAME.trackContainer = "sliderTrackContainer";
|
|
34759
|
+
}(SLIDER_ELEMENT_NAME || (SLIDER_ELEMENT_NAME = {}));
|
|
34760
|
+
|
|
34761
|
+
function convertValueToRange(value) {
|
|
34762
|
+
return isArray(value) ? value : [value, value];
|
|
34763
|
+
}
|
|
34764
|
+
function getDefaultCursor(isHorizontal) {
|
|
34765
|
+
return isHorizontal ? "ew-resize" : "ns-resize";
|
|
34766
|
+
}
|
|
34767
|
+
class Slider extends AbstractComponent {
|
|
34768
|
+
get track() {
|
|
34769
|
+
return this._track;
|
|
34770
|
+
}
|
|
34771
|
+
get currentValue() {
|
|
34772
|
+
return this._currentValue;
|
|
34773
|
+
}
|
|
34774
|
+
get startHandler() {
|
|
34775
|
+
return this._startHandler;
|
|
34776
|
+
}
|
|
34777
|
+
get endHandler() {
|
|
34778
|
+
return this._endHandler;
|
|
34779
|
+
}
|
|
34780
|
+
constructor(attributes) {
|
|
34781
|
+
super(merge$2({}, Slider.defaultAttributes, attributes)), this.name = "slider", this._isHorizontal = !0, this._startHandler = null, this._endHandler = null, this._startHandlerText = null, this._endHandlerText = null, this._currentHandler = null, this._currentValue = {}, this._onHandlerPointerdown = e => {
|
|
34782
|
+
e.stopPropagation(), this._currentHandler = e.target, this._prePos = this._isHorizontal ? e.clientX : e.clientY, "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onHandlerPointerMove), vglobal.addEventListener("pointerup", this._onHandlerPointerUp)) : (this._currentHandler.addEventListener("pointermove", this._onHandlerPointerMove), this._currentHandler.addEventListener("pointerup", this._onHandlerPointerUp), this._currentHandler.addEventListener("pointerupoutside", this._onHandlerPointerUp));
|
|
34783
|
+
}, this._onHandlerPointerMove = e => {
|
|
34784
|
+
var _a, _b;
|
|
34785
|
+
e.stopPropagation();
|
|
34786
|
+
const {
|
|
34787
|
+
railWidth: railWidth,
|
|
34788
|
+
railHeight: railHeight,
|
|
34789
|
+
min: min,
|
|
34790
|
+
max: max
|
|
34791
|
+
} = this.attribute;
|
|
34792
|
+
if (max === min) return;
|
|
34793
|
+
let currentPos,
|
|
34794
|
+
originPos,
|
|
34795
|
+
railLen,
|
|
34796
|
+
delta = 0;
|
|
34797
|
+
this._isHorizontal ? (currentPos = e.clientX, delta = currentPos - this._prePos, originPos = null === (_b = this._currentHandler) || void 0 === _b ? void 0 : _b.attribute.x, railLen = railWidth) : (currentPos = e.clientY, delta = currentPos - this._prePos, originPos = null === (_a = this._currentHandler) || void 0 === _a ? void 0 : _a.attribute.y, railLen = railHeight);
|
|
34798
|
+
const newPos = clamp$1(originPos + delta, 0, railLen),
|
|
34799
|
+
currentValue = newPos / railLen * (max - min) + min;
|
|
34800
|
+
"text" === this._currentHandler.type ? this._updateHandlerText(this._currentHandler, newPos, currentValue) : this._updateHandler(this._currentHandler, newPos, currentValue), this._updateTrack(), this._prePos = currentPos, this._dispatchChangeEvent();
|
|
34801
|
+
}, this._onHandlerPointerUp = e => {
|
|
34802
|
+
if (e.preventDefault(), this._currentHandler = null, "browser" === vglobal.env) vglobal.removeEventListener("pointermove", this._onHandlerPointerMove), vglobal.removeEventListener("pointerup", this._onHandlerPointerUp);else {
|
|
34803
|
+
const currentTarget = e.target;
|
|
34804
|
+
currentTarget.removeEventListener("pointermove", this._onHandlerPointerMove), currentTarget.removeEventListener("pointerup", this._onHandlerPointerUp), currentTarget.removeEventListener("pointerupoutside", this._onHandlerPointerUp);
|
|
34805
|
+
}
|
|
34806
|
+
}, this._onTrackPointerdown = e => {
|
|
34807
|
+
e.stopPropagation(), this._prePos = this._isHorizontal ? e.clientX : e.clientY, "browser" === vglobal.env ? (vglobal.addEventListener("pointermove", this._onTrackPointerMove), vglobal.addEventListener("pointerup", this._onTrackPointerUp)) : (this._track.addEventListener("pointermove", this._onTrackPointerMove), this._track.addEventListener("pointerup", this._onTrackPointerUp), this._track.addEventListener("pointerupoutside", this._onTrackPointerUp));
|
|
34808
|
+
}, this._onTrackPointerMove = e => {
|
|
34809
|
+
e.stopPropagation();
|
|
34810
|
+
const {
|
|
34811
|
+
railWidth: railWidth,
|
|
34812
|
+
railHeight: railHeight,
|
|
34813
|
+
min: min,
|
|
34814
|
+
max: max
|
|
34815
|
+
} = this.attribute;
|
|
34816
|
+
if (max === min) return;
|
|
34817
|
+
const {
|
|
34818
|
+
startHandler: startHandler,
|
|
34819
|
+
endHandler: endHandler
|
|
34820
|
+
} = this._getHandlers();
|
|
34821
|
+
let currentPos, trackLen, railLen;
|
|
34822
|
+
this._isHorizontal ? (currentPos = e.clientX, trackLen = this._track.attribute.width, railLen = railWidth) : (currentPos = e.clientY, trackLen = this._track.attribute.height, railLen = railHeight);
|
|
34823
|
+
const delta = currentPos - this._prePos;
|
|
34824
|
+
if (startHandler) {
|
|
34825
|
+
const originPos = this._isHorizontal ? startHandler.attribute.x : startHandler.attribute.y,
|
|
34826
|
+
newPos = clamp$1(originPos + delta, 0, railLen - trackLen),
|
|
34827
|
+
currentValue = newPos / railLen * (max - min) + min;
|
|
34828
|
+
this._updateHandler(startHandler, newPos, currentValue);
|
|
34829
|
+
}
|
|
34830
|
+
if (endHandler) {
|
|
34831
|
+
const originPos = this._isHorizontal ? endHandler.attribute.x : endHandler.attribute.y,
|
|
34832
|
+
newPos = clamp$1(originPos + delta, trackLen, railLen),
|
|
34833
|
+
currentValue = newPos / railLen * (max - min) + min;
|
|
34834
|
+
this._updateHandler(endHandler, newPos, currentValue), this._track.setAttributes(this._isHorizontal ? {
|
|
34835
|
+
x: Math.min(null == startHandler ? void 0 : startHandler.attribute.x, null == endHandler ? void 0 : endHandler.attribute.x),
|
|
34836
|
+
width: Math.abs((null == startHandler ? void 0 : startHandler.attribute.x) - (null == endHandler ? void 0 : endHandler.attribute.x))
|
|
34837
|
+
} : {
|
|
34838
|
+
y: Math.min(null == startHandler ? void 0 : startHandler.attribute.y, null == endHandler ? void 0 : endHandler.attribute.y),
|
|
34839
|
+
height: Math.abs((null == startHandler ? void 0 : startHandler.attribute.y) - (null == endHandler ? void 0 : endHandler.attribute.y))
|
|
34840
|
+
});
|
|
34841
|
+
}
|
|
34842
|
+
this._prePos = currentPos, this._dispatchChangeEvent();
|
|
34843
|
+
}, this._onTrackPointerUp = e => {
|
|
34844
|
+
e.preventDefault(), "browser" === vglobal.env ? (vglobal.removeEventListener("pointermove", this._onTrackPointerMove), vglobal.removeEventListener("pointerup", this._onTrackPointerUp)) : (this._track.removeEventListener("pointermove", this._onTrackPointerMove), this._track.removeEventListener("pointerup", this._onTrackPointerUp), this._track.removeEventListener("pointerupoutside", this._onTrackPointerUp));
|
|
34845
|
+
}, this._onRailPointerDown = e => {
|
|
34846
|
+
e.stopPropagation();
|
|
34847
|
+
const {
|
|
34848
|
+
railWidth: railWidth,
|
|
34849
|
+
railHeight: railHeight,
|
|
34850
|
+
min: min,
|
|
34851
|
+
max: max
|
|
34852
|
+
} = this.attribute;
|
|
34853
|
+
if (max === min) return;
|
|
34854
|
+
const startHandler = this._startHandler,
|
|
34855
|
+
endHandler = this._endHandler;
|
|
34856
|
+
let currentPos, startHandlerPos, endHandlerPos, railLen;
|
|
34857
|
+
this._isHorizontal ? (currentPos = e.viewX - this._rail.globalAABBBounds.x1, startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.x, endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.x, railLen = railWidth) : (currentPos = e.viewY - this._rail.globalAABBBounds.y1, startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.y, endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.y, railLen = railHeight);
|
|
34858
|
+
const currentValue = currentPos / railLen * (max - min) + min;
|
|
34859
|
+
if (isValid(endHandlerPos)) {
|
|
34860
|
+
const updateHandler = Math.abs(currentPos - startHandlerPos) > Math.abs(currentPos - endHandlerPos) ? endHandler : startHandler;
|
|
34861
|
+
this._updateHandler(updateHandler, currentPos, currentValue);
|
|
34862
|
+
} else this._updateHandler(startHandler, currentPos, currentValue);
|
|
34863
|
+
this._updateTrack(), this._dispatchChangeEvent();
|
|
34864
|
+
};
|
|
34865
|
+
}
|
|
34866
|
+
setValue(value) {
|
|
34867
|
+
const {
|
|
34868
|
+
layout: layout,
|
|
34869
|
+
railWidth: railWidth,
|
|
34870
|
+
railHeight: railHeight,
|
|
34871
|
+
min: min,
|
|
34872
|
+
max: max
|
|
34873
|
+
} = this.attribute;
|
|
34874
|
+
if (max === min) return;
|
|
34875
|
+
const [startValue, endValue] = array$1(value),
|
|
34876
|
+
{
|
|
34877
|
+
startHandler: startHandler,
|
|
34878
|
+
endHandler: endHandler
|
|
34879
|
+
} = this._getHandlers(),
|
|
34880
|
+
railLen = "vertical" === layout ? railHeight : railWidth,
|
|
34881
|
+
startPos = (startValue - min) / (max - min) * railLen;
|
|
34882
|
+
if (startHandler && this._updateHandler(startHandler, startPos, startValue), endHandler) {
|
|
34883
|
+
const endPos = (endValue - min) / (max - min) * railLen;
|
|
34884
|
+
this._updateHandler(endHandler, endPos, endValue);
|
|
34885
|
+
}
|
|
34886
|
+
this._updateTrack();
|
|
34887
|
+
}
|
|
34888
|
+
render() {
|
|
34889
|
+
var _a, _b;
|
|
34890
|
+
this.removeAllChild();
|
|
34891
|
+
const {
|
|
34892
|
+
layout = "horizontal",
|
|
34893
|
+
railWidth: railWidth,
|
|
34894
|
+
railHeight: railHeight,
|
|
34895
|
+
startText: startText,
|
|
34896
|
+
endText: endText,
|
|
34897
|
+
min: min,
|
|
34898
|
+
max: max,
|
|
34899
|
+
showHandler = !0
|
|
34900
|
+
} = this.attribute;
|
|
34901
|
+
let {
|
|
34902
|
+
value: value
|
|
34903
|
+
} = this.attribute;
|
|
34904
|
+
isNil(value) && (value = [min, max]), this._currentValue = {
|
|
34905
|
+
startValue: convertValueToRange(value)[0],
|
|
34906
|
+
endValue: convertValueToRange(value)[1]
|
|
34907
|
+
};
|
|
34908
|
+
const isHorizontal = "horizontal" === layout;
|
|
34909
|
+
this._isHorizontal = isHorizontal;
|
|
34910
|
+
const innerView = createGroup({
|
|
34911
|
+
x: 0,
|
|
34912
|
+
y: 0
|
|
34913
|
+
});
|
|
34914
|
+
innerView.name = SLIDER_ELEMENT_NAME.innerView, this.add(innerView), this._innerView = innerView;
|
|
34915
|
+
let startTextShape,
|
|
34916
|
+
startLen = 0;
|
|
34917
|
+
if (startText && startText.visible) {
|
|
34918
|
+
startTextShape = createText(Object.assign({
|
|
34919
|
+
x: isHorizontal ? 0 : railWidth / 2,
|
|
34920
|
+
y: isHorizontal ? railHeight / 2 : 0,
|
|
34921
|
+
textAlign: isHorizontal ? "start" : "center",
|
|
34922
|
+
textBaseline: isHorizontal ? "middle" : "top",
|
|
34923
|
+
text: startText.text,
|
|
34924
|
+
lineHeight: null === (_a = startText.style) || void 0 === _a ? void 0 : _a.fontSize
|
|
34925
|
+
}, startText.style)), startTextShape.name = SLIDER_ELEMENT_NAME.startText, innerView.add(startTextShape);
|
|
34926
|
+
const space = isValid(startText.space) ? startText.space : 0;
|
|
34927
|
+
startLen += (isHorizontal ? startTextShape.AABBBounds.width() : startTextShape.AABBBounds.height()) + space;
|
|
34928
|
+
}
|
|
34929
|
+
const mainContainer = createGroup({
|
|
34930
|
+
x: isHorizontal ? startLen : 0,
|
|
34931
|
+
y: isHorizontal ? 0 : startLen
|
|
34932
|
+
});
|
|
34933
|
+
innerView.add(mainContainer);
|
|
34934
|
+
const railContainer = createGroup({
|
|
34935
|
+
x: 0,
|
|
34936
|
+
y: 0
|
|
34937
|
+
});
|
|
34938
|
+
let endTextShape;
|
|
34939
|
+
if (railContainer.name = SLIDER_ELEMENT_NAME.railContainer, this._railContainer = railContainer, mainContainer.add(railContainer), this._renderRail(railContainer), startLen += isHorizontal ? railWidth : railHeight, endText && endText.visible) {
|
|
34940
|
+
const space = isValid(endText.space) ? endText.space : 0;
|
|
34941
|
+
endTextShape = createText(Object.assign({
|
|
34942
|
+
x: isHorizontal ? startLen + space : railWidth / 2,
|
|
34943
|
+
y: isHorizontal ? railHeight / 2 : startLen + space,
|
|
34944
|
+
textAlign: isHorizontal ? "start" : "center",
|
|
34945
|
+
textBaseline: isHorizontal ? "middle" : "top",
|
|
34946
|
+
text: endText.text,
|
|
34947
|
+
lineHeight: null === (_b = endText.style) || void 0 === _b ? void 0 : _b.fontSize
|
|
34948
|
+
}, endText.style)), endTextShape.name = SLIDER_ELEMENT_NAME.endText, innerView.add(endTextShape);
|
|
34949
|
+
}
|
|
34950
|
+
this._renderTrack(railContainer), showHandler && (this._renderHandlers(mainContainer), this._bindEvents());
|
|
34951
|
+
}
|
|
34952
|
+
_renderRail(container) {
|
|
34953
|
+
const {
|
|
34954
|
+
railWidth: railWidth,
|
|
34955
|
+
railHeight: railHeight,
|
|
34956
|
+
railStyle: railStyle,
|
|
34957
|
+
slidable: slidable
|
|
34958
|
+
} = this.attribute;
|
|
34959
|
+
let cursor = "default";
|
|
34960
|
+
!1 !== slidable && (cursor = "pointer");
|
|
34961
|
+
const railShape = createRect(Object.assign({
|
|
34962
|
+
x: 0,
|
|
34963
|
+
y: 0,
|
|
34964
|
+
width: railWidth,
|
|
34965
|
+
height: railHeight,
|
|
34966
|
+
cursor: cursor
|
|
34967
|
+
}, railStyle));
|
|
34968
|
+
return railShape.name = SLIDER_ELEMENT_NAME.rail, container.add(railShape), this._rail = railShape, railShape;
|
|
34969
|
+
}
|
|
34970
|
+
_renderHandlers(container) {
|
|
34971
|
+
const {
|
|
34972
|
+
range: range,
|
|
34973
|
+
min: min,
|
|
34974
|
+
max: max,
|
|
34975
|
+
handlerSize = 14,
|
|
34976
|
+
handlerStyle: handlerStyle,
|
|
34977
|
+
handlerText: handlerText,
|
|
34978
|
+
railHeight: railHeight,
|
|
34979
|
+
railWidth: railWidth,
|
|
34980
|
+
slidable: slidable
|
|
34981
|
+
} = this.attribute;
|
|
34982
|
+
let {
|
|
34983
|
+
value: value
|
|
34984
|
+
} = this.attribute;
|
|
34985
|
+
isNil(value) && (value = [min, max]);
|
|
34986
|
+
const handlerTextVisible = handlerText && handlerText.visible,
|
|
34987
|
+
isHorizontal = this._isHorizontal,
|
|
34988
|
+
railLen = isHorizontal ? railWidth : railHeight,
|
|
34989
|
+
[startValue, endValue] = convertValueToRange(value),
|
|
34990
|
+
handlerStart = max === min ? range ? 0 : railLen : (startValue - min) / (max - min) * railLen,
|
|
34991
|
+
startHandler = this._renderHandler(Object.assign({
|
|
34992
|
+
x: isHorizontal ? handlerStart : railWidth / 2,
|
|
34993
|
+
y: isHorizontal ? railHeight / 2 : handlerStart,
|
|
34994
|
+
size: handlerSize,
|
|
34995
|
+
strokeBoundsBuffer: 0,
|
|
34996
|
+
cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
|
|
34997
|
+
}, handlerStyle));
|
|
34998
|
+
if (startHandler.name = SLIDER_ELEMENT_NAME.startHandler, this._startHandler = startHandler, container.add(startHandler), this._currentValue.startPos = handlerStart, handlerTextVisible) {
|
|
34999
|
+
const startHandlerText = this._renderHandlerText(startValue, range ? "start" : "end");
|
|
35000
|
+
startHandlerText.name = SLIDER_ELEMENT_NAME.startHandlerText, container.add(startHandlerText), this._startHandlerText = startHandlerText;
|
|
35001
|
+
}
|
|
35002
|
+
if (range) {
|
|
35003
|
+
const handlerEnd = max === min ? railLen : (endValue - min) / (max - min) * railLen,
|
|
35004
|
+
endHandler = this._renderHandler(Object.assign({
|
|
35005
|
+
x: isHorizontal ? handlerEnd : railWidth / 2,
|
|
35006
|
+
y: isHorizontal ? railHeight / 2 : handlerEnd,
|
|
35007
|
+
size: handlerSize,
|
|
35008
|
+
strokeBoundsBuffer: 0,
|
|
35009
|
+
cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
|
|
35010
|
+
}, handlerStyle));
|
|
35011
|
+
if (endHandler.name = SLIDER_ELEMENT_NAME.endHandler, this._endHandler = endHandler, container.add(endHandler), this._currentValue.endPos = handlerEnd, handlerTextVisible) {
|
|
35012
|
+
const endHandlerText = this._renderHandlerText(endValue, "end");
|
|
35013
|
+
endHandlerText.name = SLIDER_ELEMENT_NAME.endHandlerText, container.add(endHandlerText), this._endHandlerText = endHandlerText;
|
|
35014
|
+
}
|
|
35015
|
+
}
|
|
35016
|
+
}
|
|
35017
|
+
_renderTrack(container) {
|
|
35018
|
+
const {
|
|
35019
|
+
range: range,
|
|
35020
|
+
min: min,
|
|
35021
|
+
max: max,
|
|
35022
|
+
railHeight: railHeight,
|
|
35023
|
+
railWidth: railWidth,
|
|
35024
|
+
trackStyle: trackStyle,
|
|
35025
|
+
railStyle: railStyle,
|
|
35026
|
+
slidable: slidable,
|
|
35027
|
+
value: value
|
|
35028
|
+
} = this.attribute;
|
|
35029
|
+
let startValue, endValue;
|
|
35030
|
+
if (isNil(value)) range ? (startValue = min, endValue = max) : startValue = endValue = min;else if (range) {
|
|
35031
|
+
const clampValue = clampRange(value, min, max);
|
|
35032
|
+
startValue = clampValue[0], endValue = clampValue[1];
|
|
35033
|
+
} else startValue = min, endValue = clamp$1(value, min, max);
|
|
35034
|
+
const isHorizontal = this._isHorizontal,
|
|
35035
|
+
railLen = isHorizontal ? railWidth : railHeight;
|
|
35036
|
+
range || (startValue = min);
|
|
35037
|
+
const trackContainer = createGroup({
|
|
35038
|
+
x: 0,
|
|
35039
|
+
y: 0,
|
|
35040
|
+
width: railWidth,
|
|
35041
|
+
height: railHeight,
|
|
35042
|
+
cornerRadius: null == railStyle ? void 0 : railStyle.cornerRadius,
|
|
35043
|
+
clip: !0,
|
|
35044
|
+
pickable: !1
|
|
35045
|
+
});
|
|
35046
|
+
trackContainer.name = SLIDER_ELEMENT_NAME.trackContainer;
|
|
35047
|
+
const draggableTrack = isObject$2(range) && !0 === range.draggableTrack;
|
|
35048
|
+
let cursor;
|
|
35049
|
+
cursor = !1 === slidable ? "default" : !1 === range || !1 === draggableTrack ? "pointer" : getDefaultCursor(isHorizontal);
|
|
35050
|
+
const trackWidth = max === min ? railLen : (endValue - startValue) / (max - min) * railLen,
|
|
35051
|
+
startPos = max === min ? 0 : (startValue - min) / (max - min) * railLen,
|
|
35052
|
+
track = createRect(Object.assign({
|
|
35053
|
+
x: isHorizontal ? startPos : 0,
|
|
35054
|
+
y: isHorizontal ? 0 : startPos,
|
|
35055
|
+
width: isHorizontal ? trackWidth : railWidth,
|
|
35056
|
+
height: isHorizontal ? railHeight : trackWidth,
|
|
35057
|
+
cursor: cursor
|
|
35058
|
+
}, trackStyle));
|
|
35059
|
+
track.name = SLIDER_ELEMENT_NAME.track, this._track = track, trackContainer.add(track), container.add(trackContainer);
|
|
35060
|
+
}
|
|
35061
|
+
_renderHandler(style) {
|
|
35062
|
+
return createSymbol(style);
|
|
35063
|
+
}
|
|
35064
|
+
_renderHandlerText(value, position) {
|
|
35065
|
+
var _a, _b, _c;
|
|
35066
|
+
const {
|
|
35067
|
+
align: align,
|
|
35068
|
+
min: min,
|
|
35069
|
+
max: max,
|
|
35070
|
+
handlerSize = 14,
|
|
35071
|
+
handlerText = {},
|
|
35072
|
+
railHeight: railHeight,
|
|
35073
|
+
railWidth: railWidth,
|
|
35074
|
+
slidable: slidable
|
|
35075
|
+
} = this.attribute,
|
|
35076
|
+
isHorizontal = this._isHorizontal,
|
|
35077
|
+
railLen = isHorizontal ? railWidth : railHeight,
|
|
35078
|
+
handlerStart = max === min ? "start" === position ? 0 : railLen : (value - min) / (max - min) * railLen,
|
|
35079
|
+
textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
|
|
35080
|
+
textStyle = Object.assign({
|
|
35081
|
+
text: (null == handlerText ? void 0 : handlerText.formatter) ? handlerText.formatter(value) : value.toFixed(null !== (_b = null == handlerText ? void 0 : handlerText.precision) && void 0 !== _b ? _b : 0),
|
|
35082
|
+
lineHeight: null === (_c = handlerText.style) || void 0 === _c ? void 0 : _c.lineHeight,
|
|
35083
|
+
cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
|
|
35084
|
+
}, handlerText.style);
|
|
35085
|
+
isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = handlerStart, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = handlerStart, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = handlerStart) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = handlerStart);
|
|
35086
|
+
return createText(textStyle);
|
|
35087
|
+
}
|
|
35088
|
+
_bindEvents() {
|
|
35089
|
+
const {
|
|
35090
|
+
slidable: slidable,
|
|
35091
|
+
range: range
|
|
35092
|
+
} = this.attribute;
|
|
35093
|
+
slidable && (this._startHandler && this._startHandler.addEventListener("pointerdown", this._onHandlerPointerdown), this._startHandlerText && this._startHandlerText.addEventListener("pointerdown", this._onHandlerPointerdown), this._endHandler && this._endHandler.addEventListener("pointerdown", this._onHandlerPointerdown), this._endHandlerText && this._endHandlerText.addEventListener("pointerdown", this._onHandlerPointerdown), isObject$2(range) && range.draggableTrack && this._track.addEventListener("pointerdown", this._onTrackPointerdown), this._railContainer.addEventListener("pointerdown", this._onRailPointerDown));
|
|
35094
|
+
}
|
|
35095
|
+
_updateTrack() {
|
|
35096
|
+
const startHandler = this._startHandler,
|
|
35097
|
+
endHandler = this._endHandler;
|
|
35098
|
+
if (this._isHorizontal) {
|
|
35099
|
+
const startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.x;
|
|
35100
|
+
if (endHandler) {
|
|
35101
|
+
const endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.x;
|
|
35102
|
+
this._track.setAttributes({
|
|
35103
|
+
x: Math.min(startHandlerPos, endHandlerPos),
|
|
35104
|
+
width: Math.abs(startHandlerPos - endHandlerPos)
|
|
35105
|
+
});
|
|
35106
|
+
} else this._track.setAttributes({
|
|
35107
|
+
width: startHandlerPos
|
|
35108
|
+
});
|
|
35109
|
+
} else {
|
|
35110
|
+
const startHandlerPos = null == startHandler ? void 0 : startHandler.attribute.y;
|
|
35111
|
+
if (endHandler) {
|
|
35112
|
+
const endHandlerPos = null == endHandler ? void 0 : endHandler.attribute.y;
|
|
35113
|
+
this._track.setAttributes({
|
|
35114
|
+
y: Math.min(startHandlerPos, endHandlerPos),
|
|
35115
|
+
height: Math.abs(startHandlerPos - endHandlerPos)
|
|
35116
|
+
});
|
|
35117
|
+
} else this._track.setAttributes({
|
|
35118
|
+
height: startHandlerPos
|
|
35119
|
+
});
|
|
35120
|
+
}
|
|
35121
|
+
}
|
|
35122
|
+
_updateHandler(handler, position, value) {
|
|
35123
|
+
var _a;
|
|
35124
|
+
const isHorizontal = this._isHorizontal;
|
|
35125
|
+
handler.setAttribute(isHorizontal ? "x" : "y", position);
|
|
35126
|
+
const updateHandlerText = handler.name === SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
|
|
35127
|
+
if (updateHandlerText) {
|
|
35128
|
+
const {
|
|
35129
|
+
handlerText: handlerText
|
|
35130
|
+
} = this.attribute;
|
|
35131
|
+
null == updateHandlerText || updateHandlerText.setAttributes({
|
|
35132
|
+
text: (null == handlerText ? void 0 : handlerText.formatter) ? handlerText.formatter(value) : value.toFixed(null !== (_a = null == handlerText ? void 0 : handlerText.precision) && void 0 !== _a ? _a : 0),
|
|
35133
|
+
[isHorizontal ? "x" : "y"]: position
|
|
35134
|
+
});
|
|
35135
|
+
}
|
|
35136
|
+
handler.name === SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
|
|
35137
|
+
}
|
|
35138
|
+
_updateHandlerText(handlerText, position, value) {
|
|
35139
|
+
var _a;
|
|
35140
|
+
const isHorizontal = this._isHorizontal,
|
|
35141
|
+
{
|
|
35142
|
+
handlerText: handlerTextAttr
|
|
35143
|
+
} = this.attribute;
|
|
35144
|
+
handlerText.setAttributes({
|
|
35145
|
+
[isHorizontal ? "x" : "y"]: position,
|
|
35146
|
+
text: (null == handlerTextAttr ? void 0 : handlerTextAttr.formatter) ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = null == handlerTextAttr ? void 0 : handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
|
|
35147
|
+
});
|
|
35148
|
+
const updateHandler = handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
|
|
35149
|
+
updateHandler && (null == updateHandler || updateHandler.setAttributes({
|
|
35150
|
+
[isHorizontal ? "x" : "y"]: position
|
|
35151
|
+
})), handlerText.name === SLIDER_ELEMENT_NAME.startHandlerText ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
|
|
35152
|
+
}
|
|
35153
|
+
_dispatchChangeEvent() {
|
|
35154
|
+
var _a;
|
|
35155
|
+
const isRange = !!this.attribute.range,
|
|
35156
|
+
currentValue = this._currentValue,
|
|
35157
|
+
changeEvent = new CustomEvent("change", {
|
|
35158
|
+
value: isRange ? [Math.min(currentValue.endValue, currentValue.startValue), Math.max(currentValue.endValue, currentValue.startValue)] : currentValue.startValue,
|
|
35159
|
+
position: isRange ? [Math.min(currentValue.endPos, currentValue.startPos), Math.max(currentValue.endPos, currentValue.startPos)] : currentValue.startPos
|
|
35160
|
+
});
|
|
35161
|
+
changeEvent.manager = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem.manager, this.dispatchEvent(changeEvent);
|
|
35162
|
+
}
|
|
35163
|
+
_getHandlers() {
|
|
35164
|
+
let temp,
|
|
35165
|
+
startHandler = this._startHandler,
|
|
35166
|
+
endHandler = this._endHandler;
|
|
35167
|
+
return this._isHorizontal ? endHandler && endHandler.attribute.x < (null == startHandler ? void 0 : startHandler.attribute.x) && (temp = startHandler, startHandler = endHandler, endHandler = temp) : endHandler && endHandler.attribute.y < (null == startHandler ? void 0 : startHandler.attribute.y) && (temp = startHandler, startHandler = endHandler, endHandler = temp), {
|
|
35168
|
+
startHandler: startHandler,
|
|
35169
|
+
endHandler: endHandler
|
|
35170
|
+
};
|
|
35171
|
+
}
|
|
35172
|
+
}
|
|
35173
|
+
Slider.defaultAttributes = {
|
|
35174
|
+
slidable: !0,
|
|
35175
|
+
layout: "horizontal",
|
|
35176
|
+
align: "bottom",
|
|
35177
|
+
height: 8,
|
|
35178
|
+
showHandler: !0,
|
|
35179
|
+
handlerSize: 14,
|
|
35180
|
+
handlerStyle: {
|
|
35181
|
+
symbolType: "circle",
|
|
35182
|
+
fill: "#fff",
|
|
35183
|
+
stroke: "#91caff",
|
|
35184
|
+
lineWidth: 2
|
|
35185
|
+
},
|
|
35186
|
+
railStyle: {
|
|
35187
|
+
fill: "rgba(0,0,0,.04)"
|
|
35188
|
+
},
|
|
35189
|
+
trackStyle: {
|
|
35190
|
+
fill: "#91caff"
|
|
35191
|
+
},
|
|
35192
|
+
showValue: !0,
|
|
35193
|
+
valueStyle: {
|
|
35194
|
+
fill: "#2C3542",
|
|
35195
|
+
fontSize: 12
|
|
35196
|
+
},
|
|
35197
|
+
startText: {
|
|
35198
|
+
style: {
|
|
35199
|
+
fill: "#2C3542",
|
|
35200
|
+
fontSize: 12
|
|
35201
|
+
}
|
|
35202
|
+
},
|
|
35203
|
+
endText: {
|
|
35204
|
+
style: {
|
|
35205
|
+
fill: "#2C3542",
|
|
35206
|
+
fontSize: 12
|
|
35207
|
+
}
|
|
35208
|
+
},
|
|
35209
|
+
handlerText: {
|
|
35210
|
+
visible: !0,
|
|
35211
|
+
space: 4,
|
|
35212
|
+
precision: 0,
|
|
35213
|
+
style: {
|
|
35214
|
+
fill: "#2C3542",
|
|
35215
|
+
fontSize: 12
|
|
35216
|
+
}
|
|
35217
|
+
}
|
|
35218
|
+
};
|
|
35219
|
+
|
|
35220
|
+
class ColorContinuousLegend extends LegendBase {
|
|
35221
|
+
constructor(attributes) {
|
|
35222
|
+
super(merge$2({}, ColorContinuousLegend.defaultAttributes, attributes)), this.name = "colorLegend", this._onSliderChange = e => {
|
|
35223
|
+
this._updateColor(), this.dispatchEvent(e);
|
|
35224
|
+
};
|
|
35225
|
+
}
|
|
35226
|
+
setSelected(value) {
|
|
35227
|
+
this._slider && (this._slider.setValue(value), this._updateColor());
|
|
35228
|
+
}
|
|
35229
|
+
_renderContent() {
|
|
35230
|
+
const {
|
|
35231
|
+
colors: colors,
|
|
35232
|
+
slidable: slidable,
|
|
35233
|
+
layout: layout,
|
|
35234
|
+
align: align,
|
|
35235
|
+
min: min,
|
|
35236
|
+
max: max,
|
|
35237
|
+
value: value,
|
|
35238
|
+
railWidth: railWidth,
|
|
35239
|
+
railHeight: railHeight,
|
|
35240
|
+
showHandler = !0,
|
|
35241
|
+
handlerSize: handlerSize,
|
|
35242
|
+
handlerStyle: handlerStyle,
|
|
35243
|
+
railStyle: railStyle,
|
|
35244
|
+
trackStyle: trackStyle,
|
|
35245
|
+
startText: startText,
|
|
35246
|
+
endText: endText,
|
|
35247
|
+
handlerText: handlerText,
|
|
35248
|
+
showTooltip: showTooltip,
|
|
35249
|
+
tooltip: tooltip
|
|
35250
|
+
} = this.attribute,
|
|
35251
|
+
domain = [],
|
|
35252
|
+
step = (max - min) / (colors.length - 1);
|
|
35253
|
+
for (let i = 0; i < colors.length; i++) domain.push(min + step * i);
|
|
35254
|
+
this._colorScale = new LinearScale().domain(domain, !0).range(colors), this._color = this._getTrackColor();
|
|
35255
|
+
const slider = new Slider({
|
|
35256
|
+
x: 0,
|
|
35257
|
+
y: 0,
|
|
35258
|
+
range: {
|
|
35259
|
+
draggableTrack: !0
|
|
35260
|
+
},
|
|
35261
|
+
slidable: slidable,
|
|
35262
|
+
layout: layout,
|
|
35263
|
+
align: align,
|
|
35264
|
+
min: min,
|
|
35265
|
+
max: max,
|
|
35266
|
+
value: value,
|
|
35267
|
+
railWidth: railWidth,
|
|
35268
|
+
railHeight: railHeight,
|
|
35269
|
+
showHandler: showHandler,
|
|
35270
|
+
handlerSize: handlerSize,
|
|
35271
|
+
handlerStyle: handlerStyle,
|
|
35272
|
+
railStyle: railStyle,
|
|
35273
|
+
trackStyle: Object.assign({
|
|
35274
|
+
fill: this._color
|
|
35275
|
+
}, trackStyle),
|
|
35276
|
+
startText: startText,
|
|
35277
|
+
endText: endText,
|
|
35278
|
+
handlerText: handlerText,
|
|
35279
|
+
showTooltip: showTooltip,
|
|
35280
|
+
tooltip: tooltip
|
|
35281
|
+
});
|
|
35282
|
+
this._innerView.add(slider), this._slider = slider, slider.translateTo(0 - slider.AABBBounds.x1, (this._title ? this._title.AABBBounds.height() + get$3(this.attribute, "title.space", DEFAULT_TITLE_SPACE) : 0) - slider.AABBBounds.y1), this._updateColor();
|
|
35283
|
+
}
|
|
35284
|
+
_bindEvents() {
|
|
35285
|
+
this._slider && this._slider.addEventListener("change", this._onSliderChange);
|
|
35286
|
+
}
|
|
35287
|
+
_getTrackColor() {
|
|
35288
|
+
const {
|
|
35289
|
+
colors: colors,
|
|
35290
|
+
layout: layout
|
|
35291
|
+
} = this.attribute;
|
|
35292
|
+
if (isEmpty(colors)) return;
|
|
35293
|
+
const count = colors.length;
|
|
35294
|
+
if (1 === count) return colors[0];
|
|
35295
|
+
const stops = [];
|
|
35296
|
+
for (let i = 0; i < count; i++) {
|
|
35297
|
+
const percent = i / (count - 1);
|
|
35298
|
+
stops.push({
|
|
35299
|
+
offset: percent,
|
|
35300
|
+
color: colors[i]
|
|
35301
|
+
});
|
|
35302
|
+
}
|
|
35303
|
+
const isHorizontal = "horizontal" === layout;
|
|
35304
|
+
return {
|
|
35305
|
+
gradient: "linear",
|
|
35306
|
+
stops: stops,
|
|
35307
|
+
x0: 0,
|
|
35308
|
+
y0: 0,
|
|
35309
|
+
x1: isHorizontal ? 1 : 0,
|
|
35310
|
+
y1: isHorizontal ? 0 : 1
|
|
35311
|
+
};
|
|
35312
|
+
}
|
|
35313
|
+
_updateColor() {
|
|
35314
|
+
const {
|
|
35315
|
+
layout = "horizontal",
|
|
35316
|
+
colors: colors,
|
|
35317
|
+
railWidth: railWidth,
|
|
35318
|
+
railHeight: railHeight
|
|
35319
|
+
} = this.attribute,
|
|
35320
|
+
{
|
|
35321
|
+
startHandler: startHandler,
|
|
35322
|
+
endHandler: endHandler,
|
|
35323
|
+
track: track
|
|
35324
|
+
} = this._slider,
|
|
35325
|
+
{
|
|
35326
|
+
startValue: startValue,
|
|
35327
|
+
endValue: endValue,
|
|
35328
|
+
startPos: startPos,
|
|
35329
|
+
endPos: endPos
|
|
35330
|
+
} = this._slider.currentValue,
|
|
35331
|
+
startHandlerColor = this._colorScale.scale(startValue),
|
|
35332
|
+
endHandlerColor = this._colorScale.scale(endValue);
|
|
35333
|
+
null == startHandler || startHandler.setAttribute("fill", startHandlerColor), null == endHandler || endHandler.setAttribute("fill", endHandlerColor);
|
|
35334
|
+
const railLen = "horizontal" === layout ? railWidth : railHeight;
|
|
35335
|
+
if (Math.abs(startPos - endPos) !== railLen && colors && colors.length > 1) {
|
|
35336
|
+
const stops = this._color.stops,
|
|
35337
|
+
start = Math.min(startPos, endPos),
|
|
35338
|
+
end = Math.max(startPos, endPos),
|
|
35339
|
+
startRatio = start / railLen,
|
|
35340
|
+
endRatio = end / railLen,
|
|
35341
|
+
range = endRatio - startRatio,
|
|
35342
|
+
betweenStops = stops.filter(stop => stop.offset > startRatio && stop.offset < endRatio),
|
|
35343
|
+
minValue = Math.min(startValue, endValue),
|
|
35344
|
+
maxValue = Math.max(startValue, endValue),
|
|
35345
|
+
startColor = this._colorScale.scale(minValue),
|
|
35346
|
+
endColor = this._colorScale.scale(maxValue),
|
|
35347
|
+
newStops = [{
|
|
35348
|
+
offset: 0,
|
|
35349
|
+
color: startColor
|
|
35350
|
+
}];
|
|
35351
|
+
betweenStops.forEach(stop => {
|
|
35352
|
+
newStops.push({
|
|
35353
|
+
offset: (stop.offset - startRatio) / range,
|
|
35354
|
+
color: stop.color
|
|
35355
|
+
});
|
|
35356
|
+
}), newStops.push({
|
|
35357
|
+
offset: 1,
|
|
35358
|
+
color: endColor
|
|
35359
|
+
}), track.setAttribute("fill", Object.assign(Object.assign({}, this._color), {
|
|
35360
|
+
stops: newStops
|
|
35361
|
+
}));
|
|
35362
|
+
}
|
|
35363
|
+
}
|
|
35364
|
+
}
|
|
35365
|
+
ColorContinuousLegend.defaultAttributes = {
|
|
35366
|
+
layout: "horizontal",
|
|
35367
|
+
title: {
|
|
35368
|
+
align: "start",
|
|
35369
|
+
space: DEFAULT_TITLE_SPACE,
|
|
35370
|
+
textStyle: {
|
|
35371
|
+
fontSize: 12,
|
|
35372
|
+
fontWeight: "bold",
|
|
35373
|
+
fill: "rgba(46, 47, 50, 1)"
|
|
35374
|
+
}
|
|
35375
|
+
},
|
|
35376
|
+
handlerSize: 10,
|
|
35377
|
+
handlerStyle: {
|
|
35378
|
+
lineWidth: 4,
|
|
35379
|
+
stroke: "#fff",
|
|
35380
|
+
outerBorder: {
|
|
35381
|
+
distance: 2,
|
|
35382
|
+
lineWidth: 1,
|
|
35383
|
+
stroke: "#ccc"
|
|
35384
|
+
}
|
|
35385
|
+
}
|
|
35386
|
+
};
|
|
35387
|
+
|
|
35388
|
+
function getSizeHandlerPath() {
|
|
35389
|
+
let align = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "bottom";
|
|
35390
|
+
let centerX = 0;
|
|
35391
|
+
return "top" === align ? `\n M${centerX},-6L${centerX - 3.5},-2.5\n v5\n h7\n v-5\n Z\n` : "left" === align ? (centerX = 1, `\n M${centerX - 6},0L${centerX - 6 + 2.5},-3.5\n h5\n v7\n h-5\n Z\n`) : "right" === align ? (centerX = -1, `\n M${centerX + 6},0L${centerX + 6 - 2.5},-3.5\n h-5\n v7\n h5\n Z\n `) : `\n M${centerX},6L${centerX - 3.5},2.5\n v-5\n h7\n v5\n Z\n`;
|
|
35392
|
+
}
|
|
35393
|
+
class SizeContinuousLegend extends LegendBase {
|
|
35394
|
+
constructor(attributes) {
|
|
35395
|
+
super(merge$2({}, SizeContinuousLegend.defaultAttributes, attributes)), this.name = "sizeLegend", this._onSliderChange = e => {
|
|
35396
|
+
this.dispatchEvent(e);
|
|
35397
|
+
};
|
|
35398
|
+
}
|
|
35399
|
+
setSelected(value) {
|
|
35400
|
+
this._slider && this._slider.setValue(value);
|
|
35401
|
+
}
|
|
35402
|
+
_renderContent() {
|
|
35403
|
+
const {
|
|
35404
|
+
slidable: slidable,
|
|
35405
|
+
layout: layout,
|
|
35406
|
+
align: align,
|
|
35407
|
+
min: min,
|
|
35408
|
+
max: max,
|
|
35409
|
+
value: value,
|
|
35410
|
+
railWidth: railWidth,
|
|
35411
|
+
railHeight: railHeight,
|
|
35412
|
+
showHandler = !0,
|
|
35413
|
+
handlerSize: handlerSize,
|
|
35414
|
+
handlerStyle: handlerStyle,
|
|
35415
|
+
railStyle: railStyle,
|
|
35416
|
+
trackStyle: trackStyle,
|
|
35417
|
+
startText: startText,
|
|
35418
|
+
endText: endText,
|
|
35419
|
+
handlerText: handlerText,
|
|
35420
|
+
showTooltip: showTooltip,
|
|
35421
|
+
tooltip: tooltip,
|
|
35422
|
+
sizeBackground: sizeBackground
|
|
35423
|
+
} = this.attribute,
|
|
35424
|
+
mainContainer = createGroup({
|
|
35425
|
+
x: 0,
|
|
35426
|
+
y: 0
|
|
35427
|
+
});
|
|
35428
|
+
this._innerView.add(mainContainer);
|
|
35429
|
+
const slider = new Slider({
|
|
35430
|
+
x: 0,
|
|
35431
|
+
y: 0,
|
|
35432
|
+
zIndex: 1,
|
|
35433
|
+
range: {
|
|
35434
|
+
draggableTrack: !0
|
|
35435
|
+
},
|
|
35436
|
+
slidable: slidable,
|
|
35437
|
+
layout: layout,
|
|
35438
|
+
align: align,
|
|
35439
|
+
min: min,
|
|
35440
|
+
max: max,
|
|
35441
|
+
value: value,
|
|
35442
|
+
railWidth: railWidth,
|
|
35443
|
+
railHeight: railHeight,
|
|
35444
|
+
showHandler: showHandler,
|
|
35445
|
+
handlerSize: handlerSize,
|
|
35446
|
+
handlerStyle: Object.assign({
|
|
35447
|
+
symbolType: getSizeHandlerPath(align)
|
|
35448
|
+
}, handlerStyle),
|
|
35449
|
+
railStyle: railStyle,
|
|
35450
|
+
trackStyle: trackStyle,
|
|
35451
|
+
startText: startText,
|
|
35452
|
+
endText: endText,
|
|
35453
|
+
handlerText: handlerText,
|
|
35454
|
+
showTooltip: showTooltip,
|
|
35455
|
+
tooltip: tooltip
|
|
35456
|
+
});
|
|
35457
|
+
mainContainer.add(slider);
|
|
35458
|
+
let path,
|
|
35459
|
+
start = 0;
|
|
35460
|
+
"horizontal" === layout ? "top" === align ? (path = `M0,0L${railWidth},0L${railWidth},12Z`, start = railHeight) : (path = `M0,12L${railWidth},12L${railWidth},0Z`, slider.setAttribute("y", 12)) : "left" === align ? path = `M${railWidth},0L${railWidth},0L${railWidth + 12},${railHeight}L${railWidth},${railHeight}Z` : (path = `M0,${railHeight}L12,${railHeight}L12,0Z`, slider.setAttribute("x", 12));
|
|
35461
|
+
const background = createPath(Object.assign(Object.assign({
|
|
35462
|
+
x: 0,
|
|
35463
|
+
y: start,
|
|
35464
|
+
path: path
|
|
35465
|
+
}, sizeBackground), {
|
|
35466
|
+
zIndex: 0
|
|
35467
|
+
}));
|
|
35468
|
+
mainContainer.add(background);
|
|
35469
|
+
const titleSpace = this._title ? this._title.AABBBounds.height() + get$3(this.attribute, "title.space", DEFAULT_TITLE_SPACE) : 0;
|
|
35470
|
+
mainContainer.translate(0 - mainContainer.AABBBounds.x1, titleSpace - mainContainer.AABBBounds.y1), this._slider = slider;
|
|
35471
|
+
}
|
|
35472
|
+
_bindEvents() {
|
|
35473
|
+
this._slider && this._slider.addEventListener("change", this._onSliderChange);
|
|
35474
|
+
}
|
|
35475
|
+
}
|
|
35476
|
+
SizeContinuousLegend.defaultAttributes = {
|
|
35477
|
+
layout: "horizontal",
|
|
35478
|
+
title: {
|
|
35479
|
+
align: "start",
|
|
35480
|
+
space: DEFAULT_TITLE_SPACE,
|
|
35481
|
+
textStyle: {
|
|
35482
|
+
fontSize: 12,
|
|
35483
|
+
fontWeight: "bold",
|
|
35484
|
+
fill: "rgba(46, 47, 50, 1)"
|
|
35485
|
+
}
|
|
35486
|
+
},
|
|
35487
|
+
handlerSize: 10,
|
|
35488
|
+
handlerStyle: {
|
|
35489
|
+
lineWidth: 1,
|
|
35490
|
+
stroke: "#ccc",
|
|
35491
|
+
fill: "#fff"
|
|
35492
|
+
},
|
|
35493
|
+
sizeBackground: {
|
|
35494
|
+
fill: "rgba(20,20,20,0.1)"
|
|
35495
|
+
}
|
|
35496
|
+
};
|
|
35497
|
+
|
|
34752
35498
|
let Title$1 = class Title extends AbstractComponent {
|
|
34753
35499
|
constructor(attributes) {
|
|
34754
35500
|
super(merge$2({}, Title.defaultAttributes, attributes)), this.name = "title";
|
|
@@ -40325,13 +41071,17 @@
|
|
|
40325
41071
|
.transform({
|
|
40326
41072
|
type: 'ticks',
|
|
40327
41073
|
options: {
|
|
41074
|
+
sampling: this.option.sampling !== false,
|
|
40328
41075
|
tickCount: tick.tickCount,
|
|
40329
41076
|
forceTickCount: tick.forceTickCount,
|
|
40330
41077
|
tickStep: tick.tickStep,
|
|
41078
|
+
tickMode: tick.tickMode,
|
|
41079
|
+
noDecimals: tick.noDecimals,
|
|
40331
41080
|
axisOrientType: this.orient,
|
|
40332
41081
|
coordinateType: 'cartesian',
|
|
40333
41082
|
labelStyle: label.style,
|
|
40334
41083
|
labelFormatter: label.formatMethod,
|
|
41084
|
+
labelGap: label.minGap,
|
|
40335
41085
|
labelLastVisible: label.lastVisible,
|
|
40336
41086
|
labelFlush: label.flush
|
|
40337
41087
|
}
|
|
@@ -52519,8 +53269,8 @@
|
|
|
52519
53269
|
else {
|
|
52520
53270
|
stateManeger.updateCursor();
|
|
52521
53271
|
}
|
|
53272
|
+
const cellGoup = e.path.find(node => node.role === 'cell');
|
|
52522
53273
|
if (table.hasListeners(TABLE_EVENT_TYPE.MOUSELEAVE_CELL)) {
|
|
52523
|
-
const cellGoup = eventArgsSet?.eventArgs?.target;
|
|
52524
53274
|
if (cellGoup?.role === 'cell' &&
|
|
52525
53275
|
table.stateManeger.hover.cellPos.col !== -1 &&
|
|
52526
53276
|
table.stateManeger.hover.cellPos.row !== -1 &&
|
|
@@ -52538,7 +53288,6 @@
|
|
|
52538
53288
|
}
|
|
52539
53289
|
}
|
|
52540
53290
|
if (table.hasListeners(TABLE_EVENT_TYPE.MOUSEENTER_CELL)) {
|
|
52541
|
-
const cellGoup = eventArgsSet?.eventArgs?.target;
|
|
52542
53291
|
if (cellGoup?.role === 'cell' &&
|
|
52543
53292
|
isValid(cellGoup.col) &&
|
|
52544
53293
|
isValid(cellGoup.row) &&
|
|
@@ -55920,7 +56669,7 @@
|
|
|
55920
56669
|
return attrs;
|
|
55921
56670
|
}
|
|
55922
56671
|
|
|
55923
|
-
class
|
|
56672
|
+
class DiscreteTableLegend {
|
|
55924
56673
|
table;
|
|
55925
56674
|
option;
|
|
55926
56675
|
orient;
|
|
@@ -56083,6 +56832,312 @@
|
|
|
56083
56832
|
}
|
|
56084
56833
|
}
|
|
56085
56834
|
|
|
56835
|
+
const defaultContinueLegendSpec = {
|
|
56836
|
+
orient: 'right',
|
|
56837
|
+
position: 'middle',
|
|
56838
|
+
padding: 30,
|
|
56839
|
+
title: {
|
|
56840
|
+
visible: false,
|
|
56841
|
+
padding: 0,
|
|
56842
|
+
textStyle: {
|
|
56843
|
+
fontSize: 14,
|
|
56844
|
+
fontWeight: 'normal',
|
|
56845
|
+
fill: { type: 'palette', key: 'titleFontColor' }
|
|
56846
|
+
},
|
|
56847
|
+
space: 12
|
|
56848
|
+
},
|
|
56849
|
+
handler: {
|
|
56850
|
+
visible: true
|
|
56851
|
+
},
|
|
56852
|
+
startText: {
|
|
56853
|
+
style: {
|
|
56854
|
+
fontSize: 14,
|
|
56855
|
+
fontWeight: 'normal',
|
|
56856
|
+
fill: { type: 'palette', key: 'labelFontColor' }
|
|
56857
|
+
}
|
|
56858
|
+
},
|
|
56859
|
+
endText: {
|
|
56860
|
+
style: {
|
|
56861
|
+
fontSize: 14,
|
|
56862
|
+
fontWeight: 'normal',
|
|
56863
|
+
fill: { type: 'palette', key: 'labelFontColor' }
|
|
56864
|
+
}
|
|
56865
|
+
},
|
|
56866
|
+
handlerText: {
|
|
56867
|
+
style: {
|
|
56868
|
+
fontSize: 14,
|
|
56869
|
+
fontWeight: 'normal',
|
|
56870
|
+
fill: { type: 'palette', key: 'labelFontColor' }
|
|
56871
|
+
}
|
|
56872
|
+
}
|
|
56873
|
+
};
|
|
56874
|
+
const defaultColorLegendSpec = {
|
|
56875
|
+
horizontal: {
|
|
56876
|
+
...defaultContinueLegendSpec,
|
|
56877
|
+
rail: {
|
|
56878
|
+
width: 200,
|
|
56879
|
+
height: 8,
|
|
56880
|
+
style: {
|
|
56881
|
+
fill: 'rgba(0,0,0,0.04)'
|
|
56882
|
+
}
|
|
56883
|
+
}
|
|
56884
|
+
},
|
|
56885
|
+
vertical: {
|
|
56886
|
+
...defaultContinueLegendSpec,
|
|
56887
|
+
rail: {
|
|
56888
|
+
width: 8,
|
|
56889
|
+
height: 200,
|
|
56890
|
+
style: {
|
|
56891
|
+
fill: 'rgba(0,0,0,0.04)'
|
|
56892
|
+
}
|
|
56893
|
+
}
|
|
56894
|
+
}
|
|
56895
|
+
};
|
|
56896
|
+
const defaultSizeLegendSpec = {
|
|
56897
|
+
horizontal: {
|
|
56898
|
+
sizeBackground: {
|
|
56899
|
+
fill: '#cdcdcd'
|
|
56900
|
+
},
|
|
56901
|
+
track: {
|
|
56902
|
+
style: {
|
|
56903
|
+
fill: 'rgba(20,20,20,0.1)'
|
|
56904
|
+
}
|
|
56905
|
+
},
|
|
56906
|
+
rail: {
|
|
56907
|
+
width: 200,
|
|
56908
|
+
height: 4,
|
|
56909
|
+
style: {
|
|
56910
|
+
fill: 'rgba(0,0,0,0.04)'
|
|
56911
|
+
}
|
|
56912
|
+
},
|
|
56913
|
+
...defaultContinueLegendSpec
|
|
56914
|
+
},
|
|
56915
|
+
vertical: {
|
|
56916
|
+
sizeBackground: {
|
|
56917
|
+
fill: '#cdcdcd'
|
|
56918
|
+
},
|
|
56919
|
+
track: {
|
|
56920
|
+
style: {
|
|
56921
|
+
fill: 'rgba(20,20,20,0.1)'
|
|
56922
|
+
}
|
|
56923
|
+
},
|
|
56924
|
+
rail: {
|
|
56925
|
+
width: 4,
|
|
56926
|
+
height: 200,
|
|
56927
|
+
style: {
|
|
56928
|
+
fill: 'rgba(0,0,0,0.04)'
|
|
56929
|
+
}
|
|
56930
|
+
},
|
|
56931
|
+
...defaultContinueLegendSpec
|
|
56932
|
+
}
|
|
56933
|
+
};
|
|
56934
|
+
function getContinuousLegendAttributes(spec, rect) {
|
|
56935
|
+
const { title = {}, handler = {}, rail = {}, track = {}, startText, endText, handlerText, sizeBackground, background = {}, type, id, visible, orient, position, data, defaultSelected, field, filter, regionId, regionIndex, seriesIndex, seriesId, padding, ...restSpec } = merge$2({}, (spec.type === 'color' ? defaultColorLegendSpec : defaultSizeLegendSpec)[spec.orient === 'bottom' || spec.orient === 'top' ? 'horizontal' : 'vertical'], spec);
|
|
56936
|
+
const attrs = restSpec;
|
|
56937
|
+
if (title.visible) {
|
|
56938
|
+
attrs.title = transformLegendTitleAttributes(title);
|
|
56939
|
+
}
|
|
56940
|
+
attrs.showHandler = handler.visible !== false;
|
|
56941
|
+
if (!isEmpty(handler.style)) {
|
|
56942
|
+
attrs.handlerStyle = transformToGraphic(handler.style);
|
|
56943
|
+
}
|
|
56944
|
+
if (isValid(rail.width)) {
|
|
56945
|
+
attrs.railWidth = rail.width;
|
|
56946
|
+
}
|
|
56947
|
+
if (isValid(rail.height)) {
|
|
56948
|
+
attrs.railHeight = rail.height;
|
|
56949
|
+
}
|
|
56950
|
+
if (!isEmpty(rail.style)) {
|
|
56951
|
+
attrs.railStyle = transformToGraphic(rail.style);
|
|
56952
|
+
}
|
|
56953
|
+
if (!isEmpty(track.style)) {
|
|
56954
|
+
attrs.trackStyle = transformToGraphic(track.style);
|
|
56955
|
+
}
|
|
56956
|
+
attrs.startText = transformComponentStyle(startText);
|
|
56957
|
+
attrs.endText = transformComponentStyle(endText);
|
|
56958
|
+
attrs.handlerText = transformComponentStyle(handlerText);
|
|
56959
|
+
if (!isEmpty(sizeBackground)) {
|
|
56960
|
+
attrs.sizeBackground = transformToGraphic(sizeBackground);
|
|
56961
|
+
}
|
|
56962
|
+
if (background.visible && !isEmpty(background.style)) {
|
|
56963
|
+
merge$2(attrs, background.style);
|
|
56964
|
+
if (isValid(background.padding)) {
|
|
56965
|
+
attrs.padding = background.padding;
|
|
56966
|
+
}
|
|
56967
|
+
}
|
|
56968
|
+
return attrs;
|
|
56969
|
+
}
|
|
56970
|
+
|
|
56971
|
+
class ContinueTableLegend {
|
|
56972
|
+
table;
|
|
56973
|
+
option;
|
|
56974
|
+
orient;
|
|
56975
|
+
visible;
|
|
56976
|
+
position;
|
|
56977
|
+
selectedData;
|
|
56978
|
+
legendComponent;
|
|
56979
|
+
constructor(option, table) {
|
|
56980
|
+
this.table = table;
|
|
56981
|
+
this.option = cloneDeep(option);
|
|
56982
|
+
this.orient = option.orient ?? 'left';
|
|
56983
|
+
this.visible = option.visible ?? true;
|
|
56984
|
+
this.position = option.position ?? 'middle';
|
|
56985
|
+
this.selectedData = option.defaultSelected ?? [];
|
|
56986
|
+
this.createComponent();
|
|
56987
|
+
this.initEvent();
|
|
56988
|
+
}
|
|
56989
|
+
createComponent() {
|
|
56990
|
+
const attrs = this.getLegendAttributes({
|
|
56991
|
+
width: this.table.tableNoFrameWidth,
|
|
56992
|
+
height: this.table.tableNoFrameHeight
|
|
56993
|
+
});
|
|
56994
|
+
let legend;
|
|
56995
|
+
if (this.option.type === 'color') {
|
|
56996
|
+
legend = new ColorContinuousLegend(merge$2({}, attrs, {
|
|
56997
|
+
slidable: true
|
|
56998
|
+
}));
|
|
56999
|
+
}
|
|
57000
|
+
else {
|
|
57001
|
+
legend = new SizeContinuousLegend(merge$2({}, attrs, {
|
|
57002
|
+
slidable: true
|
|
57003
|
+
}));
|
|
57004
|
+
}
|
|
57005
|
+
legend.name = 'legend';
|
|
57006
|
+
this.legendComponent = legend;
|
|
57007
|
+
this.table.scenegraph.stage.defaultLayer.appendChild(legend);
|
|
57008
|
+
this.adjustTableSize(attrs);
|
|
57009
|
+
}
|
|
57010
|
+
resize() {
|
|
57011
|
+
if (!this.legendComponent) {
|
|
57012
|
+
return;
|
|
57013
|
+
}
|
|
57014
|
+
this.legendComponent.setAttributes({
|
|
57015
|
+
width: this.table.tableNoFrameWidth,
|
|
57016
|
+
height: this.table.tableNoFrameHeight
|
|
57017
|
+
});
|
|
57018
|
+
this.adjustTableSize(this.legendComponent.attribute);
|
|
57019
|
+
}
|
|
57020
|
+
adjustTableSize(attrs) {
|
|
57021
|
+
let width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;
|
|
57022
|
+
let height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;
|
|
57023
|
+
const rectWidth = this.table.tableNoFrameWidth;
|
|
57024
|
+
const rectHeight = this.table.tableNoFrameHeight;
|
|
57025
|
+
const padding = getQuadProps(attrs.padding ?? this.option.padding ?? 10);
|
|
57026
|
+
let x = 0;
|
|
57027
|
+
let y = 0;
|
|
57028
|
+
if (this.orient === 'left') {
|
|
57029
|
+
x = padding[3];
|
|
57030
|
+
y = 0;
|
|
57031
|
+
width += padding[1] + padding[3];
|
|
57032
|
+
}
|
|
57033
|
+
else if (this.orient === 'top') {
|
|
57034
|
+
x = 0;
|
|
57035
|
+
y = padding[0];
|
|
57036
|
+
height += padding[0] + padding[2];
|
|
57037
|
+
}
|
|
57038
|
+
else if (this.orient === 'right') {
|
|
57039
|
+
x = rectWidth - width - padding[1];
|
|
57040
|
+
y = 0;
|
|
57041
|
+
width += padding[1] + padding[3];
|
|
57042
|
+
}
|
|
57043
|
+
else if (this.orient === 'bottom') {
|
|
57044
|
+
x = 0;
|
|
57045
|
+
y = rectHeight - height - padding[2];
|
|
57046
|
+
height += padding[0] + padding[2];
|
|
57047
|
+
}
|
|
57048
|
+
const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';
|
|
57049
|
+
const position = this.position;
|
|
57050
|
+
let offsetX = 0;
|
|
57051
|
+
let offsetY = 0;
|
|
57052
|
+
if (layout === 'horizontal') {
|
|
57053
|
+
if (position === 'middle') {
|
|
57054
|
+
offsetX = (rectWidth - width) / 2;
|
|
57055
|
+
}
|
|
57056
|
+
else if (position === 'end') {
|
|
57057
|
+
offsetX = rectWidth - width - padding[1];
|
|
57058
|
+
}
|
|
57059
|
+
else {
|
|
57060
|
+
offsetX = padding[3];
|
|
57061
|
+
}
|
|
57062
|
+
}
|
|
57063
|
+
else {
|
|
57064
|
+
if (position === 'middle') {
|
|
57065
|
+
offsetY = (rectHeight - height) / 2;
|
|
57066
|
+
}
|
|
57067
|
+
else if (position === 'end') {
|
|
57068
|
+
offsetY = rectHeight - height - padding[2];
|
|
57069
|
+
}
|
|
57070
|
+
else {
|
|
57071
|
+
offsetY = padding[0];
|
|
57072
|
+
}
|
|
57073
|
+
}
|
|
57074
|
+
this.legendComponent.setAttributes({
|
|
57075
|
+
dx: offsetX,
|
|
57076
|
+
dy: offsetY,
|
|
57077
|
+
x,
|
|
57078
|
+
y
|
|
57079
|
+
});
|
|
57080
|
+
if (this.orient === 'left') {
|
|
57081
|
+
this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);
|
|
57082
|
+
this.table.tableX += Math.ceil(width);
|
|
57083
|
+
}
|
|
57084
|
+
else if (this.orient === 'top') {
|
|
57085
|
+
this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);
|
|
57086
|
+
this.table.tableY += Math.ceil(height);
|
|
57087
|
+
}
|
|
57088
|
+
else if (this.orient === 'right') {
|
|
57089
|
+
this.table.tableNoFrameWidth = this.table.tableNoFrameWidth - Math.ceil(width);
|
|
57090
|
+
}
|
|
57091
|
+
else if (this.orient === 'bottom') {
|
|
57092
|
+
this.table.tableNoFrameHeight = this.table.tableNoFrameHeight - Math.ceil(height);
|
|
57093
|
+
}
|
|
57094
|
+
}
|
|
57095
|
+
getLegendAttributes(rect) {
|
|
57096
|
+
const layout = this.orient === 'bottom' || this.orient === 'top' ? 'horizontal' : 'vertical';
|
|
57097
|
+
const align = layout === 'horizontal' ? 'bottom' : this.orient;
|
|
57098
|
+
const attrs = {
|
|
57099
|
+
...getContinuousLegendAttributes(this.option),
|
|
57100
|
+
layout,
|
|
57101
|
+
align,
|
|
57102
|
+
min: this.option.min,
|
|
57103
|
+
max: this.option.max,
|
|
57104
|
+
value: this.option.value,
|
|
57105
|
+
[this.option.type === 'color' ? 'colors' : 'sizeRange']: this.option.type === 'color'
|
|
57106
|
+
? this.option.colors
|
|
57107
|
+
: this.option.sizeRange
|
|
57108
|
+
};
|
|
57109
|
+
return attrs;
|
|
57110
|
+
}
|
|
57111
|
+
initEvent() {
|
|
57112
|
+
if (this.legendComponent) {
|
|
57113
|
+
this.legendComponent.addEventListener('change', (e) => {
|
|
57114
|
+
const selectedData = get$3(e, 'detail.value');
|
|
57115
|
+
this.table.fireListeners(TABLE_EVENT_TYPE.LEGEND_CHANGE, { model: this, value: selectedData, event: e });
|
|
57116
|
+
this.table.scenegraph.updateNextFrame();
|
|
57117
|
+
});
|
|
57118
|
+
}
|
|
57119
|
+
}
|
|
57120
|
+
getLegendBounds() {
|
|
57121
|
+
const width = isFinite(this.legendComponent.AABBBounds.width()) ? this.legendComponent.AABBBounds.width() : 0;
|
|
57122
|
+
const height = isFinite(this.legendComponent.AABBBounds.height()) ? this.legendComponent.AABBBounds.height() : 0;
|
|
57123
|
+
return {
|
|
57124
|
+
width: width,
|
|
57125
|
+
height: height
|
|
57126
|
+
};
|
|
57127
|
+
}
|
|
57128
|
+
release() {
|
|
57129
|
+
this.legendComponent && this.table.scenegraph.stage.defaultLayer.removeChild(this.legendComponent);
|
|
57130
|
+
this.legendComponent = null;
|
|
57131
|
+
}
|
|
57132
|
+
}
|
|
57133
|
+
|
|
57134
|
+
function createLegend(option, table) {
|
|
57135
|
+
if (option.type === 'color' || option.type === 'size') {
|
|
57136
|
+
return new ContinueTableLegend(option, table);
|
|
57137
|
+
}
|
|
57138
|
+
return new DiscreteTableLegend(option, table);
|
|
57139
|
+
}
|
|
57140
|
+
|
|
56086
57141
|
class Title {
|
|
56087
57142
|
table;
|
|
56088
57143
|
_titleOption;
|
|
@@ -56245,7 +57300,7 @@
|
|
|
56245
57300
|
return TABLE_EVENT_TYPE;
|
|
56246
57301
|
}
|
|
56247
57302
|
options;
|
|
56248
|
-
version = "0.10.2
|
|
57303
|
+
version = "0.10.2";
|
|
56249
57304
|
pagination;
|
|
56250
57305
|
id = `VTable${Date.now()}`;
|
|
56251
57306
|
headerStyleCache;
|
|
@@ -56339,7 +57394,7 @@
|
|
|
56339
57394
|
this.stateManeger = new StateManeger(this);
|
|
56340
57395
|
this.eventManeger = new EventManeger(this);
|
|
56341
57396
|
if (options.legends) {
|
|
56342
|
-
internalProps.legends =
|
|
57397
|
+
internalProps.legends = createLegend(options.legends, this);
|
|
56343
57398
|
this.scenegraph.tableGroup.setAttributes({
|
|
56344
57399
|
x: this.tableX,
|
|
56345
57400
|
y: this.tableY
|
|
@@ -57241,7 +58296,7 @@
|
|
|
57241
58296
|
this.stateManeger.initState();
|
|
57242
58297
|
this._updateSize();
|
|
57243
58298
|
if (options.legends) {
|
|
57244
|
-
internalProps.legends =
|
|
58299
|
+
internalProps.legends = createLegend(options.legends, this);
|
|
57245
58300
|
this.scenegraph.tableGroup.setAttributes({
|
|
57246
58301
|
x: this.tableX,
|
|
57247
58302
|
y: this.tableY
|
|
@@ -57482,17 +58537,6 @@
|
|
|
57482
58537
|
this.stateManeger.updateSelectPos(col, row);
|
|
57483
58538
|
this.stateManeger.endSelectCells();
|
|
57484
58539
|
}
|
|
57485
|
-
updatePagination(cof) {
|
|
57486
|
-
if (this.pagination) {
|
|
57487
|
-
typeof cof.currentPage === 'number' && cof.currentPage >= 0 && (this.pagination.currentPage = cof.currentPage);
|
|
57488
|
-
cof.perPageCount && (this.pagination.perPageCount = cof.perPageCount || this.pagination.perPageCount);
|
|
57489
|
-
this.scenegraph.clearCells();
|
|
57490
|
-
this.dataSource.updatePagination(this.pagination);
|
|
57491
|
-
this.refreshRowColCount();
|
|
57492
|
-
this.scenegraph.createSceneGraph();
|
|
57493
|
-
this.render();
|
|
57494
|
-
}
|
|
57495
|
-
}
|
|
57496
58540
|
get allowFrozenColCount() {
|
|
57497
58541
|
return this.internalProps.allowFrozenColCount;
|
|
57498
58542
|
}
|
|
@@ -59366,6 +60410,20 @@
|
|
|
59366
60410
|
setTimeout(resolve, 0);
|
|
59367
60411
|
});
|
|
59368
60412
|
}
|
|
60413
|
+
updatePagination(pagination) {
|
|
60414
|
+
if (this.pagination) {
|
|
60415
|
+
typeof pagination.currentPage === 'number' &&
|
|
60416
|
+
pagination.currentPage >= 0 &&
|
|
60417
|
+
(this.pagination.currentPage = pagination.currentPage);
|
|
60418
|
+
pagination.perPageCount &&
|
|
60419
|
+
(this.pagination.perPageCount = pagination.perPageCount || this.pagination.perPageCount);
|
|
60420
|
+
this.scenegraph.clearCells();
|
|
60421
|
+
this.dataSource.updatePagination(this.pagination);
|
|
60422
|
+
this.refreshRowColCount();
|
|
60423
|
+
this.scenegraph.createSceneGraph();
|
|
60424
|
+
this.render();
|
|
60425
|
+
}
|
|
60426
|
+
}
|
|
59369
60427
|
refreshHeader() {
|
|
59370
60428
|
const table = this;
|
|
59371
60429
|
const internalProps = table.internalProps;
|
|
@@ -63084,6 +64142,7 @@
|
|
|
63084
64142
|
|
|
63085
64143
|
class Dataset {
|
|
63086
64144
|
dataConfig;
|
|
64145
|
+
pagination;
|
|
63087
64146
|
records;
|
|
63088
64147
|
tree = {};
|
|
63089
64148
|
colFlatKeys = {};
|
|
@@ -63116,7 +64175,8 @@
|
|
|
63116
64175
|
rows;
|
|
63117
64176
|
columns;
|
|
63118
64177
|
indicatorKeys;
|
|
63119
|
-
|
|
64178
|
+
rowKeysPath_FULL;
|
|
64179
|
+
constructor(dataConfig, pagination, rows, columns, indicatorKeys, records, customColTree, customRowTree) {
|
|
63120
64180
|
this.registerAggregators();
|
|
63121
64181
|
this.dataConfig = dataConfig;
|
|
63122
64182
|
this.sortRules = this.dataConfig?.sortRules;
|
|
@@ -63162,10 +64222,10 @@
|
|
|
63162
64222
|
console.log('sortKeys:', t3 - t2);
|
|
63163
64223
|
const t7 = typeof window !== 'undefined' ? window.performance.now() : 0;
|
|
63164
64224
|
if (customRowTree) {
|
|
63165
|
-
this.
|
|
64225
|
+
this.rowKeysPath_FULL = this.TreeToArr2(customRowTree);
|
|
63166
64226
|
}
|
|
63167
64227
|
else {
|
|
63168
|
-
this.
|
|
64228
|
+
this.rowKeysPath_FULL = this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, this?.totals?.row?.showGrandTotals, this.rowGrandTotalLabel, this.rowSubTotalLabel));
|
|
63169
64229
|
}
|
|
63170
64230
|
if (customColTree) {
|
|
63171
64231
|
this.colKeysPath = this.TreeToArr2(customColTree);
|
|
@@ -63180,6 +64240,7 @@
|
|
|
63180
64240
|
this.cacheDeminsionCollectedValues();
|
|
63181
64241
|
}
|
|
63182
64242
|
}
|
|
64243
|
+
this.updatePagination(pagination);
|
|
63183
64244
|
}
|
|
63184
64245
|
registerAggregator(type, aggregator) {
|
|
63185
64246
|
this.aggregators[type] = aggregator;
|
|
@@ -63384,7 +64445,7 @@
|
|
|
63384
64445
|
this.sorted = false;
|
|
63385
64446
|
this.sortRules = sortRules;
|
|
63386
64447
|
this.sortKeys();
|
|
63387
|
-
this.
|
|
64448
|
+
this.rowKeysPath_FULL = this.TreeToArr(this.ArrToTree(this.rowKeys, this.rowsIsTotal, this?.totals?.row?.showGrandTotals || this.columns.length === 0, this.rowGrandTotalLabel, this.rowSubTotalLabel));
|
|
63388
64449
|
this.colKeysPath = this.TreeToArr(this.ArrToTree(this.colKeys, this.colsIsTotal, this.totals?.column?.showGrandTotals || this.rows.length === 0, this.colGrandTotalLabel, this.colSubTotalLabel));
|
|
63389
64450
|
}
|
|
63390
64451
|
updateFilterRules(filterRules, isResetTree = false) {
|
|
@@ -63409,6 +64470,21 @@
|
|
|
63409
64470
|
this.dealWithZeroAlign();
|
|
63410
64471
|
}
|
|
63411
64472
|
}
|
|
64473
|
+
updatePagination(pagination) {
|
|
64474
|
+
this.pagination = pagination;
|
|
64475
|
+
if (isValid$1(this.pagination?.perPageCount) && isValid$1(this.pagination?.currentPage)) {
|
|
64476
|
+
this.pagination.perPageCount =
|
|
64477
|
+
Math.ceil(this.pagination.perPageCount / this.indicatorKeys.length) * this.indicatorKeys.length;
|
|
64478
|
+
const { perPageCount, currentPage } = this.pagination;
|
|
64479
|
+
const startIndex = Math.ceil((perPageCount * (currentPage || 0)) / this.indicatorKeys.length);
|
|
64480
|
+
const endIndex = startIndex + Math.ceil(perPageCount / this.indicatorKeys.length);
|
|
64481
|
+
this.rowKeysPath = this.rowKeysPath_FULL?.slice(startIndex, endIndex);
|
|
64482
|
+
}
|
|
64483
|
+
else {
|
|
64484
|
+
this.rowKeysPath = this.rowKeysPath_FULL;
|
|
64485
|
+
}
|
|
64486
|
+
this.pagination && (this.pagination.totalCount = this.rowKeysPath_FULL?.length);
|
|
64487
|
+
}
|
|
63412
64488
|
getAggregatorRule(indicatorKey) {
|
|
63413
64489
|
return this.aggregationRules?.find((value, index) => {
|
|
63414
64490
|
return indicatorKey === value.indicatorKey;
|
|
@@ -63875,7 +64951,7 @@
|
|
|
63875
64951
|
}
|
|
63876
64952
|
return keys;
|
|
63877
64953
|
}, []) ?? [];
|
|
63878
|
-
this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, options.records);
|
|
64954
|
+
this.dataset = new Dataset(this.internalProps.dataConfig, this.pagination, rowKeys, columnKeys, indicatorKeys, options.records);
|
|
63879
64955
|
}
|
|
63880
64956
|
this.refreshHeader();
|
|
63881
64957
|
this.pivotSortState = [];
|
|
@@ -63959,7 +65035,7 @@
|
|
|
63959
65035
|
}
|
|
63960
65036
|
return keys;
|
|
63961
65037
|
}, []);
|
|
63962
|
-
this.dataset = new Dataset(internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, options.records);
|
|
65038
|
+
this.dataset = new Dataset(internalProps.dataConfig, this.pagination, rowKeys, columnKeys, indicatorKeys, options.records);
|
|
63963
65039
|
}
|
|
63964
65040
|
this.refreshHeader();
|
|
63965
65041
|
if (internalProps.releaseList) {
|
|
@@ -63985,6 +65061,20 @@
|
|
|
63985
65061
|
setTimeout(resolve, 0);
|
|
63986
65062
|
});
|
|
63987
65063
|
}
|
|
65064
|
+
updatePagination(pagination) {
|
|
65065
|
+
if (this.pagination) {
|
|
65066
|
+
typeof pagination.currentPage === 'number' &&
|
|
65067
|
+
pagination.currentPage >= 0 &&
|
|
65068
|
+
(this.pagination.currentPage = pagination.currentPage);
|
|
65069
|
+
pagination.perPageCount &&
|
|
65070
|
+
(this.pagination.perPageCount = pagination.perPageCount || this.pagination.perPageCount);
|
|
65071
|
+
this.scenegraph.clearCells();
|
|
65072
|
+
this.dataset.updatePagination(this.pagination);
|
|
65073
|
+
this.refreshHeader();
|
|
65074
|
+
this.scenegraph.createSceneGraph();
|
|
65075
|
+
this.render();
|
|
65076
|
+
}
|
|
65077
|
+
}
|
|
63988
65078
|
refreshHeader() {
|
|
63989
65079
|
const internalProps = this.internalProps;
|
|
63990
65080
|
if (internalProps.headerEvents) {
|
|
@@ -64332,7 +65422,7 @@
|
|
|
64332
65422
|
this.internalProps.dataConfig.collectValuesBy = this._generateCollectValuesConfig(columnKeys, rowKeys);
|
|
64333
65423
|
this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules();
|
|
64334
65424
|
this.internalProps.dataConfig.dimensionSortArray = this._getDimensionSortArray();
|
|
64335
|
-
this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, options.records, options.columnTree, options.rowTree);
|
|
65425
|
+
this.dataset = new Dataset(this.internalProps.dataConfig, null, rowKeys, columnKeys, indicatorKeys, options.records, options.columnTree, options.rowTree);
|
|
64336
65426
|
}
|
|
64337
65427
|
this.refreshHeader();
|
|
64338
65428
|
if (options.dataSource) {
|
|
@@ -64409,7 +65499,7 @@
|
|
|
64409
65499
|
}, []);
|
|
64410
65500
|
this.internalProps.dataConfig.collectValuesBy = this._generateCollectValuesConfig(columnKeys, rowKeys);
|
|
64411
65501
|
this.internalProps.dataConfig.aggregationRules = this._generateAggregationRules();
|
|
64412
|
-
this.dataset = new Dataset(this.internalProps.dataConfig, rowKeys, columnKeys, indicatorKeys, options.records ?? this.internalProps.records, options.columnTree, options.rowTree);
|
|
65502
|
+
this.dataset = new Dataset(this.internalProps.dataConfig, null, rowKeys, columnKeys, indicatorKeys, options.records ?? this.internalProps.records, options.columnTree, options.rowTree);
|
|
64413
65503
|
}
|
|
64414
65504
|
this.refreshHeader();
|
|
64415
65505
|
if (internalProps.releaseList) {
|
|
@@ -64431,6 +65521,8 @@
|
|
|
64431
65521
|
setTimeout(resolve, 0);
|
|
64432
65522
|
});
|
|
64433
65523
|
}
|
|
65524
|
+
updatePagination() {
|
|
65525
|
+
}
|
|
64434
65526
|
refreshHeader() {
|
|
64435
65527
|
const internalProps = this.internalProps;
|
|
64436
65528
|
if (internalProps.headerEvents) {
|
|
@@ -65568,7 +66660,7 @@
|
|
|
65568
66660
|
percentCalc: percentCalc
|
|
65569
66661
|
});
|
|
65570
66662
|
|
|
65571
|
-
const version = "0.10.2
|
|
66663
|
+
const version = "0.10.2";
|
|
65572
66664
|
function getIcons() {
|
|
65573
66665
|
return get$1();
|
|
65574
66666
|
}
|