evui 3.5.0 → 3.5.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/dist/index.js +23148 -0
- package/dist/index.umd.cjs +28 -0
- package/package.json +5 -11
- package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
- package/dist/common/utils.bignumber.js +0 -23
- package/dist/common/utils.debounce.js +0 -66
- package/dist/common/utils.js +0 -64
- package/dist/common/utils.throttle.js +0 -15
- package/dist/components/button/Button.vue.js +0 -65
- package/dist/components/button/index.js +0 -7
- package/dist/components/buttonGroup/ButtonGroup.vue.js +0 -14
- package/dist/components/buttonGroup/index.js +0 -7
- package/dist/components/calendar/Calendar.vue.js +0 -299
- package/dist/components/calendar/index.js +0 -7
- package/dist/components/calendar/uses.js +0 -579
- package/dist/components/chart/Chart.vue.js +0 -261
- package/dist/components/chart/ChartToolbar.vue.js +0 -32
- package/dist/components/chart/chart.core.js +0 -738
- package/dist/components/chart/chartZoom.core.js +0 -221
- package/dist/components/chart/element/element.bar.js +0 -358
- package/dist/components/chart/element/element.bar.time.js +0 -55
- package/dist/components/chart/element/element.heatmap.js +0 -403
- package/dist/components/chart/element/element.line.js +0 -292
- package/dist/components/chart/element/element.pie.js +0 -73
- package/dist/components/chart/element/element.scatter.js +0 -209
- package/dist/components/chart/element/element.tip.js +0 -312
- package/dist/components/chart/helpers/helpers.canvas.js +0 -141
- package/dist/components/chart/helpers/helpers.constant.js +0 -253
- package/dist/components/chart/helpers/helpers.util.js +0 -265
- package/dist/components/chart/index.js +0 -7
- package/dist/components/chart/model/index.js +0 -6
- package/dist/components/chart/model/model.series.js +0 -82
- package/dist/components/chart/model/model.store.js +0 -650
- package/dist/components/chart/plugins/plugins.interaction.js +0 -823
- package/dist/components/chart/plugins/plugins.legend.gradient.js +0 -281
- package/dist/components/chart/plugins/plugins.legend.js +0 -665
- package/dist/components/chart/plugins/plugins.pie.js +0 -86
- package/dist/components/chart/plugins/plugins.scrollbar.js +0 -345
- package/dist/components/chart/plugins/plugins.title.js +0 -43
- package/dist/components/chart/plugins/plugins.tooltip.js +0 -508
- package/dist/components/chart/scale/scale.js +0 -492
- package/dist/components/chart/scale/scale.linear.js +0 -248
- package/dist/components/chart/scale/scale.logarithmic.js +0 -82
- package/dist/components/chart/scale/scale.step.js +0 -227
- package/dist/components/chart/scale/scale.time.category.js +0 -148
- package/dist/components/chart/scale/scale.time.js +0 -95
- package/dist/components/chart/uses.js +0 -479
- package/dist/components/chartBrush/ChartBrush.vue.js +0 -198
- package/dist/components/chartBrush/chartBrush.core.js +0 -265
- package/dist/components/chartBrush/index.js +0 -7
- package/dist/components/chartBrush/uses.js +0 -18
- package/dist/components/chartGroup/ChartGroup.vue.js +0 -128
- package/dist/components/chartGroup/index.js +0 -7
- package/dist/components/chartGroup/uses.js +0 -47
- package/dist/components/checkbox/Checkbox.vue.js +0 -99
- package/dist/components/checkbox/index.js +0 -7
- package/dist/components/checkboxGroup/CheckboxGroup.vue.js +0 -40
- package/dist/components/checkboxGroup/index.js +0 -7
- package/dist/components/contextMenu/ContextMenu.vue.js +0 -70
- package/dist/components/contextMenu/MenuList.vue.js +0 -105
- package/dist/components/contextMenu/index.js +0 -7
- package/dist/components/contextMenu/uses.js +0 -79
- package/dist/components/datePicker/DatePicker.vue.js +0 -310
- package/dist/components/datePicker/index.js +0 -7
- package/dist/components/datePicker/uses.js +0 -190
- package/dist/components/grid/Grid.vue.js +0 -1261
- package/dist/components/grid/GridColumnSetting.vue.js +0 -212
- package/dist/components/grid/GridFilterSetting.vue.js +0 -222
- package/dist/components/grid/GridPagination.vue.js +0 -69
- package/dist/components/grid/GridSummary.vue.js +0 -186
- package/dist/components/grid/GridToolbar.vue.js +0 -15
- package/dist/components/grid/icon/icon-option-button.vue.js +0 -39
- package/dist/components/grid/icon/icon-sort-button.vue.js +0 -56
- package/dist/components/grid/index.js +0 -7
- package/dist/components/grid/uses.js +0 -697
- package/dist/components/icon/Icon.vue.js +0 -50
- package/dist/components/icon/index.js +0 -8
- package/dist/components/inputNumber/InputNumber.vue.js +0 -112
- package/dist/components/inputNumber/index.js +0 -7
- package/dist/components/inputNumber/uses.js +0 -76
- package/dist/components/loading/Loading.vue.js +0 -78
- package/dist/components/loading/index.js +0 -7
- package/dist/components/menu/Menu.vue.js +0 -66
- package/dist/components/menu/MenuItem.vue.js +0 -125
- package/dist/components/menu/index.js +0 -7
- package/dist/components/message/Message.vue.js +0 -122
- package/dist/components/message/index.js +0 -16
- package/dist/components/messageBox/MessageBox.vue.js +0 -216
- package/dist/components/messageBox/index.js +0 -13
- package/dist/components/notification/Notification.vue.js +0 -140
- package/dist/components/notification/index.js +0 -23
- package/dist/components/pagination/Pagination.vue.js +0 -215
- package/dist/components/pagination/index.js +0 -7
- package/dist/components/pagination/pageButton.vue.js +0 -35
- package/dist/components/progress/Progress.vue.js +0 -88
- package/dist/components/progress/index.js +0 -7
- package/dist/components/radio/Radio.vue.js +0 -75
- package/dist/components/radio/index.js +0 -7
- package/dist/components/radioGroup/RadioGroup.vue.js +0 -37
- package/dist/components/radioGroup/index.js +0 -7
- package/dist/components/scheduler/Scheduler.vue.js +0 -128
- package/dist/components/scheduler/index.js +0 -7
- package/dist/components/scheduler/uses.js +0 -73
- package/dist/components/select/Select.vue.js +0 -381
- package/dist/components/select/index.js +0 -7
- package/dist/components/select/uses.js +0 -147
- package/dist/components/slider/Slider.vue.js +0 -243
- package/dist/components/slider/index.js +0 -7
- package/dist/components/slider/uses.js +0 -188
- package/dist/components/tabPanel/TabPanel.vue.js +0 -39
- package/dist/components/tabPanel/index.js +0 -7
- package/dist/components/tabs/Tabs.vue.js +0 -220
- package/dist/components/tabs/index.js +0 -7
- package/dist/components/textField/TextField.vue.js +0 -209
- package/dist/components/textField/index.js +0 -7
- package/dist/components/timePicker/TimePicker.vue.js +0 -227
- package/dist/components/timePicker/index.js +0 -7
- package/dist/components/toggle/Toggle.vue.js +0 -66
- package/dist/components/toggle/index.js +0 -7
- package/dist/components/tree/Tree.vue.js +0 -220
- package/dist/components/tree/TreeNode.vue.js +0 -146
- package/dist/components/tree/index.js +0 -7
- package/dist/components/treeGrid/TreeGrid.vue.js +0 -898
- package/dist/components/treeGrid/TreeGridNode.vue.js +0 -274
- package/dist/components/treeGrid/TreeGridToolbar.vue.js +0 -15
- package/dist/components/treeGrid/index.js +0 -7
- package/dist/components/treeGrid/uses.js +0 -497
- package/dist/components/window/Window.vue.js +0 -211
- package/dist/components/window/index.js +0 -7
- package/dist/components/window/uses.js +0 -345
- package/dist/directives/clickoutside.js +0 -47
- package/dist/main.js +0 -142
- package/dist/package.json.js +0 -4
- package/dist/resolver.js +0 -17
|
@@ -1,665 +0,0 @@
|
|
|
1
|
-
import w from "../helpers/helpers.util.js";
|
|
2
|
-
const O = {
|
|
3
|
-
/**
|
|
4
|
-
* Create legend DOM
|
|
5
|
-
*
|
|
6
|
-
* @returns {undefined}
|
|
7
|
-
*/
|
|
8
|
-
createLegendLayout() {
|
|
9
|
-
var e, o;
|
|
10
|
-
this.legendDOM = document.createElement("div"), this.legendDOM.className = "ev-chart-legend", this.legendBoxDOM = document.createElement("div"), this.legendBoxDOM.className = "ev-chart-legend-box", (o = (e = this.options) == null ? void 0 : e.legend) != null && o.allowResize && (this.resizeDOM = document.createElement("div"), this.resizeDOM.className = "ev-chart-resize-bar", this.ghostDOM = document.createElement("div"), this.ghostDOM.className = "ev-chart-resize-ghost", this.wrapperDOM.appendChild(this.resizeDOM)), this.useTable ? (this.legendTableDOM = document.createElement("table"), this.legendTableDOM.className = "ev-chart-legend--table", this.setLegendColumnHeader(), this.legendBoxDOM.appendChild(this.legendTableDOM), this.legendDOM.style.overflow = "auto") : (this.legendBoxDOM.style.overflowX = "hidden", this.legendBoxDOM.style.overflowY = "auto", this.legendBoxDOM.style.height = "100%"), this.legendDOM.appendChild(this.legendBoxDOM), this.wrapperDOM.appendChild(this.legendDOM), this.options.legend.virtualScroll && !this.useTable && (this.legendTopSpacer = document.createElement("div"), this.legendTopSpacer.className = "ev-chart-legend--top-spacer", this.legendTopSpacer.style.clear = "both", this.legendTopSpacer.style.opacity = 0, this.legendBottomSpacer = document.createElement("div"), this.legendBottomSpacer.className = "ev-chart-legend--bottom-spacer", this.legendBottomSpacer.style.clear = "both", this.legendBottomSpacer.style.opacity = 0, this.legendBoxDOM.appendChild(this.legendTopSpacer), this.legendBoxDOM.appendChild(this.legendBottomSpacer), this.updateVisibleRowCountFrameId = requestAnimationFrame(() => {
|
|
11
|
-
this.updateVisibleRowCount();
|
|
12
|
-
}));
|
|
13
|
-
},
|
|
14
|
-
/**
|
|
15
|
-
* Create and append Table Header DOM
|
|
16
|
-
* Only chartOption > legend > table > use : true
|
|
17
|
-
*
|
|
18
|
-
* @returns {undefined}
|
|
19
|
-
*/
|
|
20
|
-
setLegendColumnHeader() {
|
|
21
|
-
var n;
|
|
22
|
-
const e = (n = this.options.legend) == null ? void 0 : n.table, o = e.columns;
|
|
23
|
-
["color", ...Object.keys(o)].forEach((d) => {
|
|
24
|
-
var s, h;
|
|
25
|
-
const t = document.createElement("th");
|
|
26
|
-
if (t.className = "ev-chart-legend--table__column-name", (s = o[d]) != null && s.use || d === "color" || d === "name") {
|
|
27
|
-
const i = o[d], r = (i == null ? void 0 : i.title) ?? "";
|
|
28
|
-
t.textContent = r, t.setAttribute("title", r), t.dataset.type = r, w.setDOMStyle(t, (h = e == null ? void 0 : e.style) == null ? void 0 : h.header), this.legendTableDOM.append(t);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
/**
|
|
33
|
-
* Initialize legend
|
|
34
|
-
* If there was no initialization, create DOM and set default layout.
|
|
35
|
-
* It not, there will already be set layout, so add a legend for each series with group
|
|
36
|
-
*
|
|
37
|
-
* @returns {undefined}
|
|
38
|
-
*/
|
|
39
|
-
initLegend() {
|
|
40
|
-
var e, o;
|
|
41
|
-
this.isHeatMapType = this.options.type === "heatMap", this.useTable = !!((o = (e = this.options.legend) == null ? void 0 : e.table) != null && o.use) && this.options.type !== "heatmap" && this.options.type !== "scatter", this.legendItemHeight = 18, this.isInitLegend || this.createLegendLayout(), this.isHeatMapType ? (this.initEventForColorLegend(), this.addColorLegendList()) : (this.initEvent(), this.addLegendList()), this.initResizeEvent(), this.isInitLegend = !0, this.isLegendMove = !1;
|
|
42
|
-
},
|
|
43
|
-
/**
|
|
44
|
-
* Calculate and update the number of rows and items per row that are visible
|
|
45
|
-
* within the legend container based on its dimensions and the layout of the legend.
|
|
46
|
-
* If the legend is positioned on the right or left, only one item per row is shown.
|
|
47
|
-
* Otherwise, the number of items per row is determined by dividing the container width
|
|
48
|
-
* by the item width.
|
|
49
|
-
*
|
|
50
|
-
* @returns {undefined}
|
|
51
|
-
*/
|
|
52
|
-
updateVisibleRowCount() {
|
|
53
|
-
const e = this.options.legend.position === "right" || this.options.legend.position === "left", o = this.legendBoxDOM.clientHeight, l = this.legendBoxDOM.clientWidth, n = Math.max(this.options.legend.width - 8, 1), d = Object.values(this.seriesList).filter(
|
|
54
|
-
(t) => t.showLegend !== !1
|
|
55
|
-
).length;
|
|
56
|
-
this.itemsPerRow = e ? 1 : Math.floor(l / n), this.totalRowCount = Math.ceil(d / this.itemsPerRow), this.visibleRowCount = o > this.legendItemHeight ? Math.round(o / this.legendItemHeight) + 1 : this.totalRowCount;
|
|
57
|
-
},
|
|
58
|
-
/**
|
|
59
|
-
* Calculate and set the start and end row indexes for visible items within the
|
|
60
|
-
* scrollable legend area. Determines the row range that should be displayed based
|
|
61
|
-
* on the current scroll position and the height of each legend item.
|
|
62
|
-
*
|
|
63
|
-
* @returns {undefined}
|
|
64
|
-
*/
|
|
65
|
-
updateStartEndRowIndex() {
|
|
66
|
-
var o;
|
|
67
|
-
const e = Math.max(Math.floor(((o = this.legendBoxDOM) == null ? void 0 : o.scrollTop) / this.legendItemHeight), 0);
|
|
68
|
-
this.startRowIndex = Math.min(e, Math.max(this.totalRowCount - this.visibleRowCount, 0)), this.endRowIndex = this.startRowIndex + this.visibleRowCount + 1;
|
|
69
|
-
},
|
|
70
|
-
/**
|
|
71
|
-
* Render only the visible legend items in the legend container based on the
|
|
72
|
-
* calculated start and end row indexes. Removes existing legend items,
|
|
73
|
-
* adjusts spacer heights to enable smooth scrolling, and adds only the items
|
|
74
|
-
* within the visible range.
|
|
75
|
-
*
|
|
76
|
-
* @returns {undefined}
|
|
77
|
-
*/
|
|
78
|
-
renderVisibleLegends() {
|
|
79
|
-
this.updateStartEndRowIndex();
|
|
80
|
-
const e = this.legendBoxDOM.querySelectorAll(".ev-chart-legend-container");
|
|
81
|
-
if (e && e.length)
|
|
82
|
-
for (const i of e)
|
|
83
|
-
i.remove();
|
|
84
|
-
const o = this.totalRowCount * this.legendItemHeight, l = this.startRowIndex * this.legendItemHeight, n = Math.max(
|
|
85
|
-
o - this.visibleRowCount * this.legendItemHeight - l,
|
|
86
|
-
0
|
|
87
|
-
);
|
|
88
|
-
this.legendTopSpacer.style.height = `${l}px`, this.legendBottomSpacer.style.height = `${n}px`;
|
|
89
|
-
const d = this.startRowIndex * this.itemsPerRow, t = this.endRowIndex * this.itemsPerRow, s = this.data.groups.at(0);
|
|
90
|
-
let h = [];
|
|
91
|
-
if (s ? h = s.filter((i) => this.seriesList[i].showLegend).map((i) => [i, this.seriesList[i]]) : h = Object.entries(this.seriesList).filter(([, i]) => i.showLegend), h && h.length)
|
|
92
|
-
for (let i = d; i < t && i < h.length; i++) {
|
|
93
|
-
const [, r] = h[i];
|
|
94
|
-
this.addLegend(r);
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
/**
|
|
98
|
-
* Add legend with group information to align each series properly.
|
|
99
|
-
* Especially if a chart is stacked,
|
|
100
|
-
* legends have to align with series ordering as we can see in chart.
|
|
101
|
-
*
|
|
102
|
-
* @returns {undefined}
|
|
103
|
-
*/
|
|
104
|
-
addLegendList() {
|
|
105
|
-
const { groups: e } = this.data, { seriesList: o } = this;
|
|
106
|
-
this.options.legend.virtualScroll && !this.useTable ? this.renderVisibleLegendsFrameId = requestAnimationFrame(() => {
|
|
107
|
-
this.renderVisibleLegends();
|
|
108
|
-
}) : (this.addLegendForGroups(e, o, this.useTable), this.addStandaloneLegends(o, this.useTable));
|
|
109
|
-
},
|
|
110
|
-
/**
|
|
111
|
-
* Adds legends for each group in `groups` array, iterating through each series within the group.
|
|
112
|
-
* Only adds series with `showLegend` set to `true`.
|
|
113
|
-
*
|
|
114
|
-
* @param {Array} groups - Array of groups containing series identifiers.
|
|
115
|
-
* @param {Object} seriesList - Object containing all series, keyed by series ID.
|
|
116
|
-
* @param {boolean} useTable - Determines whether to add legends with additional values.
|
|
117
|
-
* @returns {undefined}
|
|
118
|
-
*/
|
|
119
|
-
addLegendForGroups(e, o, l) {
|
|
120
|
-
e == null || e.forEach((n) => {
|
|
121
|
-
n == null || n.forEach((d) => {
|
|
122
|
-
const t = o[d];
|
|
123
|
-
t && t.showLegend && this.addLegendBasedOnType(t, l);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
},
|
|
127
|
-
/**
|
|
128
|
-
* Adds legends for series that are not part of any group. Iterates through each series
|
|
129
|
-
* in `seriesList` and only adds those that are not assigned to any group (based on `isExistGrp`)
|
|
130
|
-
* and have `showLegend` set to `true`.
|
|
131
|
-
*
|
|
132
|
-
* @param {Object} seriesList - Object containing all series, keyed by series ID.
|
|
133
|
-
* @param {boolean} useTable - Determines whether to add legends with additional values.
|
|
134
|
-
* @returns {undefined}
|
|
135
|
-
*/
|
|
136
|
-
addStandaloneLegends(e, o) {
|
|
137
|
-
Object.values(e).forEach((l) => {
|
|
138
|
-
!l.isExistGrp && l.showLegend && this.addLegendBasedOnType(l, o);
|
|
139
|
-
});
|
|
140
|
-
},
|
|
141
|
-
/**
|
|
142
|
-
* Adds a legend item for a specific series, determining whether to include additional
|
|
143
|
-
* values based on the `useTable` parameter. Calls `addLegendWithValues` if `useTable` is true,
|
|
144
|
-
* otherwise calls `addLegend`.
|
|
145
|
-
*
|
|
146
|
-
* @param {Object} series - Series object containing data to display in the legend.
|
|
147
|
-
* @param {boolean} useTable - Determines whether to add legends with additional values.
|
|
148
|
-
* @returns {undefined}
|
|
149
|
-
*/
|
|
150
|
-
addLegendBasedOnType(e, o) {
|
|
151
|
-
o ? this.addLegendWithValues(e) : this.addLegend(e);
|
|
152
|
-
},
|
|
153
|
-
/**
|
|
154
|
-
* Add Legend with Color Information
|
|
155
|
-
* Only Heatmap chart
|
|
156
|
-
*
|
|
157
|
-
* @returns {undefined}
|
|
158
|
-
*/
|
|
159
|
-
addColorLegendList() {
|
|
160
|
-
const e = this.seriesList;
|
|
161
|
-
Object.values(e).forEach((o) => {
|
|
162
|
-
if (!o.isExistGrp && o.showLegend) {
|
|
163
|
-
const { colorState: l, valueOpt: n } = o, { min: d, max: t, interval: s, existError: h, decimalPoint: i } = n, r = l.length, a = h ? r - 2 : r - 1;
|
|
164
|
-
for (let c = 0; c < r; c++) {
|
|
165
|
-
const { id: f, color: u, label: v = "" } = l[c], g = d + s * c;
|
|
166
|
-
let y = g + s;
|
|
167
|
-
c < a ? y -= 0.1 ** i : y = t + 0.1 ** i;
|
|
168
|
-
let p = v;
|
|
169
|
-
if (!p)
|
|
170
|
-
if (p = `${g.toFixed(i)} - ${y.toFixed(i)}`, d === void 0 || t === void 0)
|
|
171
|
-
if (c === 0)
|
|
172
|
-
p = "0";
|
|
173
|
-
else
|
|
174
|
-
break;
|
|
175
|
-
else {
|
|
176
|
-
if (g > t)
|
|
177
|
-
break;
|
|
178
|
-
s <= 1 && i === 0 && (p = g);
|
|
179
|
-
}
|
|
180
|
-
this.addLegend({
|
|
181
|
-
cId: f,
|
|
182
|
-
color: u,
|
|
183
|
-
name: p,
|
|
184
|
-
show: !0
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
});
|
|
189
|
-
},
|
|
190
|
-
/**
|
|
191
|
-
* Get Container DOM by Event Object
|
|
192
|
-
* @param e Event
|
|
193
|
-
*
|
|
194
|
-
* @returns {Element}
|
|
195
|
-
*/
|
|
196
|
-
getContainerDOM(e) {
|
|
197
|
-
let o = null;
|
|
198
|
-
const l = e.target.dataset.type;
|
|
199
|
-
return l === "container" ? o = e.target : ["name", "color", "min", "max", "avg", "total", "last"].includes(l) && (o = e.target.parentElement, o != null && o.series || (o = o.parentElement)), o;
|
|
200
|
-
},
|
|
201
|
-
/**
|
|
202
|
-
* Initialize legend event
|
|
203
|
-
*
|
|
204
|
-
* @returns {undefined}
|
|
205
|
-
*/
|
|
206
|
-
initEvent() {
|
|
207
|
-
if (this.isInitLegend)
|
|
208
|
-
return;
|
|
209
|
-
const e = {
|
|
210
|
-
container: `ev-chart-legend${this.useTable ? "--table__row" : "-container"}`,
|
|
211
|
-
color: `ev-chart-legend${this.useTable ? "--table__color" : "-color"}`,
|
|
212
|
-
name: `ev-chart-legend${this.useTable ? "--table__name" : "-name"}`,
|
|
213
|
-
value: `ev-chart-legend${this.useTable ? "--table__value" : "-value"}`
|
|
214
|
-
}, o = (t, s) => {
|
|
215
|
-
const h = t == null ? void 0 : t.getElementsByClassName(e.color)[0], i = t == null ? void 0 : t.getElementsByClassName(e.name)[0], r = t == null ? void 0 : t.getElementsByClassName(e.value), a = t == null ? void 0 : t.series;
|
|
216
|
-
if (h.style.backgroundColor = s, h.style.borderColor = s, i.style.color = s, r && r.length)
|
|
217
|
-
for (const c of r)
|
|
218
|
-
c.style.color = s;
|
|
219
|
-
a.show = !1, t.dataset.inactive = !0;
|
|
220
|
-
}, l = (t, s) => {
|
|
221
|
-
var f, u;
|
|
222
|
-
let h;
|
|
223
|
-
const i = t == null ? void 0 : t.getElementsByClassName(e.color)[0], r = t == null ? void 0 : t.getElementsByClassName(e.name)[0], a = t == null ? void 0 : t.getElementsByClassName(e.value), c = t == null ? void 0 : t.series;
|
|
224
|
-
if (typeof c.color != "string" ? h = c.color[c.color.length - 1][1] : h = c.color, c.type === "line" && c.fill ? (i.style.height = "8px", i.style.backgroundColor = w.rgbaAdjustHalfOpacity(h), i.style.border = `1px solid ${h}`) : i.style.backgroundColor = h, r.style.color = s, a && a.length)
|
|
225
|
-
for (const v of a) {
|
|
226
|
-
const g = (u = (f = this.options.legend.table) == null ? void 0 : f.columns[v.dataset.type]) == null ? void 0 : u.style;
|
|
227
|
-
v.style.color = g != null && g.color ? g.color : s;
|
|
228
|
-
}
|
|
229
|
-
c.show = !0, t.dataset.inactive = !1;
|
|
230
|
-
}, n = () => {
|
|
231
|
-
(this.data.groups.at(0) ? this.data.groups.at(0).slice().reverse().filter((s) => this.seriesList[s].showLegend).map((s) => [s, this.seriesList[s]]) : Object.entries(this.seriesList).filter(([, s]) => s.showLegend)).forEach(([, s]) => {
|
|
232
|
-
s.show = !1;
|
|
233
|
-
});
|
|
234
|
-
}, d = () => {
|
|
235
|
-
(this.data.groups.at(0) ? this.data.groups.at(0).slice().reverse().filter((s) => this.seriesList[s].showLegend).map((s) => [s, this.seriesList[s]]) : Object.entries(this.seriesList).filter(([, s]) => s.showLegend)).forEach(([, s]) => {
|
|
236
|
-
s.show = !0;
|
|
237
|
-
});
|
|
238
|
-
};
|
|
239
|
-
this.onLegendBoxClick = (t) => {
|
|
240
|
-
var y;
|
|
241
|
-
const { legend: s } = this.options;
|
|
242
|
-
if (s != null && s.stopClickEvt)
|
|
243
|
-
return;
|
|
244
|
-
const { chartIdx: h } = this.data, i = this.getContainerDOM(t);
|
|
245
|
-
if (!i)
|
|
246
|
-
return;
|
|
247
|
-
const r = i == null ? void 0 : i.getElementsByClassName(e.color)[0], a = i == null ? void 0 : i.getElementsByClassName(e.name)[0], c = (i == null ? void 0 : i.dataset.inactive) === "false";
|
|
248
|
-
if (!r || !a)
|
|
249
|
-
return;
|
|
250
|
-
if (s.clickMode === "active") {
|
|
251
|
-
const p = Array.from(
|
|
252
|
-
this.legendBoxDOM.getElementsByClassName(e.container)
|
|
253
|
-
);
|
|
254
|
-
p.every((x) => x.dataset.inactive === "false") ? (p.forEach((x) => {
|
|
255
|
-
o(x, s.inactive);
|
|
256
|
-
}), n(), l(i, s.color), this.seriesInfo.count = 1) : c ? (o(i, s.inactive), this.seriesInfo.count--) : c || (l(i, s.color), this.seriesInfo.count++), p.every((x) => x.dataset.inactive === "true") && (p.forEach((x) => {
|
|
257
|
-
l(x, s.color);
|
|
258
|
-
}), d(), this.seriesInfo.count = p.length);
|
|
259
|
-
}
|
|
260
|
-
if (s.clickMode !== "active") {
|
|
261
|
-
if (c && this.seriesInfo.count === 1)
|
|
262
|
-
return;
|
|
263
|
-
c ? (o(i, s.inactive), this.seriesInfo.count--) : (l(i, s.color), this.seriesInfo.count++);
|
|
264
|
-
}
|
|
265
|
-
if (this.brushSeries) {
|
|
266
|
-
const p = [...this.brushSeries.list];
|
|
267
|
-
p[h] = this.seriesList, this.brushSeries.list = p, this.brushSeries.chartIdx = h;
|
|
268
|
-
}
|
|
269
|
-
((y = this.options.eventBehavior) == null ? void 0 : y.legendClick) !== "emitOnly" && this.update({
|
|
270
|
-
updateSeries: !1,
|
|
271
|
-
updateSelTip: { update: !0, keepDomain: !0 }
|
|
272
|
-
});
|
|
273
|
-
const u = Object.values(this.seriesList).filter((p) => p.show).map((p) => p.sId), v = u.length === Object.values(this.seriesList).length, g = {
|
|
274
|
-
e: t,
|
|
275
|
-
data: {
|
|
276
|
-
seriesIds: v ? [] : u,
|
|
277
|
-
isActiveAll: v
|
|
278
|
-
}
|
|
279
|
-
};
|
|
280
|
-
typeof this.listeners["click-legend"] == "function" && this.listeners["click-legend"](g);
|
|
281
|
-
}, this.onLegendBoxLeave = () => {
|
|
282
|
-
this.legendHover = null, this.update({
|
|
283
|
-
updateSeries: !1,
|
|
284
|
-
updateSelTip: { update: !1, keepDomain: !1 },
|
|
285
|
-
hitInfo: {
|
|
286
|
-
legend: null
|
|
287
|
-
},
|
|
288
|
-
lightUpdate: !0
|
|
289
|
-
});
|
|
290
|
-
}, this.onLegendBoxOver = (t) => {
|
|
291
|
-
var r;
|
|
292
|
-
const s = this.getContainerDOM(t);
|
|
293
|
-
if (!s) {
|
|
294
|
-
this.onLegendBoxLeave();
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
const i = { sId: (r = s == null ? void 0 : s.series) == null ? void 0 : r.sId, type: this.options.type };
|
|
298
|
-
this.legendHover = i, this.update({
|
|
299
|
-
updateSeries: !1,
|
|
300
|
-
updateSelTip: { update: !1, keepDomain: !1 },
|
|
301
|
-
hitInfo: {
|
|
302
|
-
legend: i
|
|
303
|
-
},
|
|
304
|
-
lightUpdate: !0
|
|
305
|
-
});
|
|
306
|
-
}, this.legendBoxDOM.addEventListener("click", this.onLegendBoxClick), this.legendBoxDOM.addEventListener("mouseover", this.onLegendBoxOver), this.legendBoxDOM.addEventListener("mouseleave", this.onLegendBoxLeave), this.options.legend.virtualScroll && !this.useTable && (this.legendBoxDOM.addEventListener("resize", this.updateVisibleRowCount), this.legendBoxDOM.addEventListener("scroll", this.renderVisibleLegends.bind(this))), this.initResizeEvent();
|
|
307
|
-
},
|
|
308
|
-
/**
|
|
309
|
-
* Init Event on Color Legend
|
|
310
|
-
* Only Heatmap
|
|
311
|
-
*/
|
|
312
|
-
initEventForColorLegend() {
|
|
313
|
-
if (this.isInitLegend)
|
|
314
|
-
return;
|
|
315
|
-
const e = {
|
|
316
|
-
container: `ev-chart-legend${this.useTable ? "--table__row" : "-container"}`,
|
|
317
|
-
color: `ev-chart-legend${this.useTable ? "--table__color" : "-color"}`,
|
|
318
|
-
name: `ev-chart-legend${this.useTable ? "--table__name" : "-name"}`
|
|
319
|
-
}, o = (t, s) => {
|
|
320
|
-
var f;
|
|
321
|
-
const h = t == null ? void 0 : t.getElementsByClassName(e.color)[0], i = t == null ? void 0 : t.getElementsByClassName(e.name)[0], r = Object.values(this.seriesList)[0], a = (f = t == null ? void 0 : t.series) == null ? void 0 : f.cId;
|
|
322
|
-
h.style.backgroundColor = s, h.style.borderColor = s, i.style.color = s;
|
|
323
|
-
const c = r.colorState.findIndex((u) => u.id === a);
|
|
324
|
-
c > -1 && (r.colorState[c].show = !1), t.dataset.inactive = !0;
|
|
325
|
-
}, l = (t, s) => {
|
|
326
|
-
var f, u;
|
|
327
|
-
const h = t == null ? void 0 : t.getElementsByClassName(e.color)[0], i = t == null ? void 0 : t.getElementsByClassName(e.name)[0], r = Object.values(this.seriesList)[0], a = (f = t == null ? void 0 : t.series) == null ? void 0 : f.cId;
|
|
328
|
-
h.style.backgroundColor = (u = t == null ? void 0 : t.series) == null ? void 0 : u.color, i.style.color = s;
|
|
329
|
-
const c = r.colorState.findIndex((v) => v.id === a);
|
|
330
|
-
c > -1 && (r.colorState[c].show = !0), t.dataset.inactive = !1;
|
|
331
|
-
}, n = () => {
|
|
332
|
-
Object.values(this.seriesList)[0].colorState.forEach((s) => {
|
|
333
|
-
s.show = !1;
|
|
334
|
-
});
|
|
335
|
-
}, d = () => {
|
|
336
|
-
Object.values(this.seriesList)[0].colorState.forEach((s) => {
|
|
337
|
-
s.show = !0;
|
|
338
|
-
});
|
|
339
|
-
};
|
|
340
|
-
this.onLegendBoxClick = (t) => {
|
|
341
|
-
var p;
|
|
342
|
-
const s = this.options.legend;
|
|
343
|
-
if (s != null && s.stopClickEvt)
|
|
344
|
-
return;
|
|
345
|
-
const h = Object.values(this.seriesList)[0], i = this.getContainerDOM(t);
|
|
346
|
-
if (!i)
|
|
347
|
-
return;
|
|
348
|
-
const r = i == null ? void 0 : i.getElementsByClassName(e.color)[0], a = i == null ? void 0 : i.getElementsByClassName(e.name)[0], c = (i == null ? void 0 : i.dataset.inactive) === "false", f = h.colorState.filter((m) => m.show).length;
|
|
349
|
-
if (!r || !a)
|
|
350
|
-
return;
|
|
351
|
-
if (s.clickMode === "active") {
|
|
352
|
-
const m = Array.from(
|
|
353
|
-
this.legendBoxDOM.getElementsByClassName(e.container)
|
|
354
|
-
);
|
|
355
|
-
m.every((b) => b.dataset.inactive === "false") ? (m.forEach((b) => {
|
|
356
|
-
o(b, s.inactive);
|
|
357
|
-
}), n(), l(i, s.color)) : c ? o(i, s.inactive) : c || l(i, s.color), m.every((b) => b.dataset.inactive === "true") && (m.forEach((b) => {
|
|
358
|
-
l(b, s.color);
|
|
359
|
-
}), d());
|
|
360
|
-
}
|
|
361
|
-
if (s.clickMode !== "active") {
|
|
362
|
-
if (c && f === 1)
|
|
363
|
-
return;
|
|
364
|
-
c ? o(i, s.inactive) : l(i, s.color);
|
|
365
|
-
}
|
|
366
|
-
((p = this.options.eventBehavior) == null ? void 0 : p.legendClick) !== "emitOnly" && this.update({
|
|
367
|
-
updateSeries: !1,
|
|
368
|
-
updateSelTip: { update: !0, keepDomain: !0 }
|
|
369
|
-
});
|
|
370
|
-
const u = h.colorState.filter((m) => m.show), v = u.map((m) => +m.id.split("#")[1]), g = h.colorState.length === u.length, y = {
|
|
371
|
-
e: t,
|
|
372
|
-
data: {
|
|
373
|
-
seriesIndices: g ? [] : v,
|
|
374
|
-
isActiveAll: g
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
typeof this.listeners["click-legend"] == "function" && this.listeners["click-legend"](y);
|
|
378
|
-
}, this.onLegendBoxLeave = () => {
|
|
379
|
-
this.legendHover = null, Object.values(this.seriesList)[0].colorState.forEach((s) => {
|
|
380
|
-
s.state = "normal";
|
|
381
|
-
}), this.update({
|
|
382
|
-
updateSeries: !1,
|
|
383
|
-
updateSelTip: { update: !1, keepDomain: !1 },
|
|
384
|
-
lightUpdate: !0
|
|
385
|
-
});
|
|
386
|
-
}, this.onLegendBoxOver = (t) => {
|
|
387
|
-
var a, c;
|
|
388
|
-
const s = (a = Object.values(this.seriesList)) == null ? void 0 : a[0], h = this.getContainerDOM(t);
|
|
389
|
-
if (!h) {
|
|
390
|
-
this.onLegendBoxLeave();
|
|
391
|
-
return;
|
|
392
|
-
}
|
|
393
|
-
const i = (c = h == null ? void 0 : h.series) == null ? void 0 : c.cId, r = { sId: i, type: this.options.type };
|
|
394
|
-
this.legendHover = r, s.colorState.forEach((f) => {
|
|
395
|
-
f.state = f.id === i ? "highlight" : "downplay";
|
|
396
|
-
}), this.update({
|
|
397
|
-
updateSeries: !1,
|
|
398
|
-
updateSelTip: { update: !1, keepDomain: !1 },
|
|
399
|
-
hitInfo: {
|
|
400
|
-
legend: r
|
|
401
|
-
},
|
|
402
|
-
lightUpdate: !0
|
|
403
|
-
});
|
|
404
|
-
}, this.legendBoxDOM.addEventListener("click", this.onLegendBoxClick), this.legendBoxDOM.addEventListener("mouseover", this.onLegendBoxOver), this.legendBoxDOM.addEventListener("mouseleave", this.onLegendBoxLeave), this.initResizeEvent();
|
|
405
|
-
},
|
|
406
|
-
initResizeEvent() {
|
|
407
|
-
this.onResizeMouseDown = (e) => {
|
|
408
|
-
e.stopPropagation(), e.preventDefault();
|
|
409
|
-
const o = this.options, l = o.legend.position, n = o.title.show ? o.title.height : 0, d = this.ghostDOM;
|
|
410
|
-
this.resizeDOM.style.display = "none", this.wrapperDOM.appendChild(d), l === "left" || l === "right" ? (d.style.top = `${n}px`, d.style.left = this.resizeDOM.style.left, d.style.right = this.resizeDOM.style.right, d.style.height = this.resizeDOM.style.height) : (d.classList.add("horizontal"), l === "top" ? d.style.top = this.resizeDOM.style.top : l === "bottom" && (d.style.bottom = this.resizeDOM.style.bottom)), this.wrapperDOM.addEventListener("mousemove", this.mouseMove, !1), this.wrapperDOM.addEventListener("mouseup", this.mouseUp, !1);
|
|
411
|
-
}, this.resizeDOM && (this.resizeDOM.addEventListener("mousedown", this.onResizeMouseDown), this.mouseMove = this.onMouseMove.bind(this), this.mouseUp = this.onMouseUp.bind(this));
|
|
412
|
-
},
|
|
413
|
-
/**
|
|
414
|
-
* To update legend, reset all process.
|
|
415
|
-
*
|
|
416
|
-
* @returns {undefined}
|
|
417
|
-
*/
|
|
418
|
-
updateLegend() {
|
|
419
|
-
this.resetLegend(), this.isHeatMapType ? this.addColorLegendList() : this.addLegendList();
|
|
420
|
-
},
|
|
421
|
-
/**
|
|
422
|
-
* To update value text on legend table
|
|
423
|
-
* Only chartOption > legend > table > use : true
|
|
424
|
-
*
|
|
425
|
-
* @returns {undefined}
|
|
426
|
-
*/
|
|
427
|
-
updateLegendTableValues() {
|
|
428
|
-
var n, d, t, s, h;
|
|
429
|
-
const e = (t = (d = (n = this.options) == null ? void 0 : n.legend) == null ? void 0 : d.table) == null ? void 0 : t.columns, o = this.getAggregations(), l = (s = this.legendBoxDOM) == null ? void 0 : s.getElementsByClassName("ev-chart-legend--table__row");
|
|
430
|
-
if (l && l.length)
|
|
431
|
-
for (const i of l) {
|
|
432
|
-
const r = i == null ? void 0 : i.getElementsByClassName("ev-chart-legend--table__value");
|
|
433
|
-
if (r && r.length)
|
|
434
|
-
for (const a of r) {
|
|
435
|
-
const c = a.dataset.type;
|
|
436
|
-
if (c !== "name") {
|
|
437
|
-
const f = i.series.sId, u = (h = o == null ? void 0 : o[f]) == null ? void 0 : h[c];
|
|
438
|
-
a.textContent = this.getFormattedValue(e[c], u);
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
},
|
|
443
|
-
/**
|
|
444
|
-
* Force Update Legend. Remove and Create
|
|
445
|
-
*
|
|
446
|
-
* @returns {undefined}
|
|
447
|
-
*/
|
|
448
|
-
forceUpdateLegend() {
|
|
449
|
-
this.destroyLegend(), this.initLegend();
|
|
450
|
-
},
|
|
451
|
-
/**
|
|
452
|
-
* To update legend, remove all of legendBoxDOM's children
|
|
453
|
-
* (except spacers when virtualScroll is enabled)
|
|
454
|
-
*
|
|
455
|
-
* @returns {undefined}
|
|
456
|
-
*/
|
|
457
|
-
resetLegend() {
|
|
458
|
-
var o, l;
|
|
459
|
-
const e = this.legendBoxDOM;
|
|
460
|
-
if (e) {
|
|
461
|
-
if (this.useTable) {
|
|
462
|
-
const n = this.legendTableDOM;
|
|
463
|
-
for (; n.hasChildNodes(); )
|
|
464
|
-
n.removeChild(n.firstChild);
|
|
465
|
-
this.setLegendColumnHeader();
|
|
466
|
-
} else if (this.options.legend.virtualScroll)
|
|
467
|
-
((l = (o = this.legendDOM) == null ? void 0 : o.style) == null ? void 0 : l.display) === "none" ? this.legendNeedsUpdate = !0 : (this.updateVisibleRowCount(), this.renderVisibleLegends());
|
|
468
|
-
else
|
|
469
|
-
for (; e.hasChildNodes(); )
|
|
470
|
-
e.removeChild(e.firstChild);
|
|
471
|
-
this.seriesInfo.count = 0;
|
|
472
|
-
}
|
|
473
|
-
},
|
|
474
|
-
/**
|
|
475
|
-
* To update legend, remove all of legendBoxDOM's children
|
|
476
|
-
*
|
|
477
|
-
* @returns {undefined}
|
|
478
|
-
*/
|
|
479
|
-
destroyLegend() {
|
|
480
|
-
const e = this.legendDOM;
|
|
481
|
-
this.renderVisibleLegendsFrameId != null && (cancelAnimationFrame(this.renderVisibleLegendsFrameId), this.renderVisibleLegendsFrameId = null), this.updateVisibleRowCountFrameId != null && (cancelAnimationFrame(this.updateVisibleRowCountFrameId), this.updateVisibleRowCountFrameId = null), e && (e.remove(), this.legendDOM = null, this.legendBoxDOM = null, this.resizeDOM = null, this.isInitLegend = !1, this.seriesInfo.count = 0);
|
|
482
|
-
},
|
|
483
|
-
/**
|
|
484
|
-
* Create DOM for each series
|
|
485
|
-
*
|
|
486
|
-
* @returns {undefined}
|
|
487
|
-
*/
|
|
488
|
-
/**
|
|
489
|
-
* 새로운 범례 아이템을 생성하고 범례 영역에 추가
|
|
490
|
-
* @param {Object} series - 시리즈 정보 객체
|
|
491
|
-
*/
|
|
492
|
-
addLegend(e) {
|
|
493
|
-
const o = this.options.legend, l = document.createElement("div"), n = document.createElement("span"), d = document.createElement("div");
|
|
494
|
-
l.className = "ev-chart-legend-container", l.dataset.inactive = !e.show, l.series = e, n.className = "ev-chart-legend-color", e.type === "line" && e.point && !e.fill && (n.className += " ev-chart-legend-color--point-line"), d.className = "ev-chart-legend-name";
|
|
495
|
-
let t;
|
|
496
|
-
e.show ? typeof e.color != "string" ? t = e.color[e.color.length - 1][1] : t = e.color : t = o.inactive, e.type === "line" && e.fill ? (n.style.height = "8px", n.style.backgroundColor = e.show ? w.rgbaAdjustHalfOpacity(t) : o.inactive, n.style.border = `1px solid ${t}`) : n.style.backgroundColor = t, n.dataset.type = "color", d.style.color = o.color, d.textContent = e.name, d.setAttribute("title", e.name), d.dataset.type = "name", l.appendChild(n), l.appendChild(d), o.position === "top" || o.position === "bottom" ? (l.style.width = `${o.width - 8}px`, l.style.margin = "0 4px") : l.style.width = "100%", l.style.height = `${this.legendItemHeight}px`, l.style.display = "inline-block", l.style.overflow = "hidden", l.dataset.type = "container", this.legendBoxDOM.insertBefore(l, this.legendBottomSpacer), e.show && this.seriesInfo.count++;
|
|
497
|
-
},
|
|
498
|
-
/**
|
|
499
|
-
* Add Legend Items With aggregation Values
|
|
500
|
-
* Only chartOption > legend > table > use : true
|
|
501
|
-
* @param series
|
|
502
|
-
*/
|
|
503
|
-
addLegendWithValues(e) {
|
|
504
|
-
var a, c, f, u, v;
|
|
505
|
-
const o = this.options.legend, l = (a = o == null ? void 0 : o.table) == null ? void 0 : a.columns, n = (c = this.getAggregations()) == null ? void 0 : c[e == null ? void 0 : e.sId];
|
|
506
|
-
if (!n || !l)
|
|
507
|
-
return;
|
|
508
|
-
const d = document.createElement("tr");
|
|
509
|
-
d.className = "ev-chart-legend--table__row", d.dataset.inactive = !e.show, w.setDOMStyle(d, (u = (f = o.table) == null ? void 0 : f.style) == null ? void 0 : u.row), d.series = e, d.dataset.type = "container";
|
|
510
|
-
const t = document.createElement("td");
|
|
511
|
-
t.className = "ev-chart-legend--table__color-wrapper", t.dataset.type = "color";
|
|
512
|
-
const s = document.createElement("div");
|
|
513
|
-
s.className = "ev-chart-legend--table__color", s.dataset.type = "color";
|
|
514
|
-
let h;
|
|
515
|
-
switch (e.show ? typeof e.color != "string" ? h = e.color[e.color.length - 1][1] : h = e.color : h = o.inactive, e.type) {
|
|
516
|
-
case "line": {
|
|
517
|
-
e.fill ? (s.style.backgroundColor = w.rgbaAdjustHalfOpacity(h), s.style.border = `1px solid ${h}`) : (e.point && (s.className += " ev-chart-legend--table__color--point-line"), s.className += " ev-chart-legend--table__color--line", s.style.backgroundColor = h);
|
|
518
|
-
break;
|
|
519
|
-
}
|
|
520
|
-
case "bar":
|
|
521
|
-
case "pie":
|
|
522
|
-
default: {
|
|
523
|
-
s.style.height = "10px", s.style.backgroundColor = h;
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
e.type === "line" && e.fill ? (s.style.height = "8px", s.style.backgroundColor = e.show ? w.rgbaAdjustHalfOpacity(h) : o.inactive, s.style.border = `1px solid ${h}`) : s.style.backgroundColor = h, t.appendChild(s), d.appendChild(t);
|
|
528
|
-
const i = document.createElement("td");
|
|
529
|
-
i.className = "ev-chart-legend--table__name", i.style.color = e.show ? o.color : o.inactive, i.textContent = e.name, i.setAttribute("title", e.name), i.dataset.type = "name", w.setDOMStyle(i, (v = l == null ? void 0 : l.name) == null ? void 0 : v.style), e.show || (i.style.color = o.inactive), d.appendChild(i);
|
|
530
|
-
const r = Object.keys(l);
|
|
531
|
-
r == null || r.forEach((g) => {
|
|
532
|
-
var y;
|
|
533
|
-
if (g !== "name" && l[g].use) {
|
|
534
|
-
const p = this.getFormattedValue(l[g], n[g]), m = document.createElement("td");
|
|
535
|
-
m.className = "ev-chart-legend--table__value", m.style.color = e.show ? o.color : o.inactive, m.textContent = p, m.dataset.type = g.toString(), w.setDOMStyle(m, (y = l[g]) == null ? void 0 : y.style), e.show || (m.style.color = o.inactive), d.appendChild(m);
|
|
536
|
-
}
|
|
537
|
-
}), this.legendTableDOM.appendChild(d), e.show && this.seriesInfo.count++;
|
|
538
|
-
},
|
|
539
|
-
/**
|
|
540
|
-
* Set legend components position by option
|
|
541
|
-
*
|
|
542
|
-
* @returns {undefined}
|
|
543
|
-
*/
|
|
544
|
-
setLegendPosition() {
|
|
545
|
-
var v, g, y, p, m, L, x, b, C;
|
|
546
|
-
const e = this.options, o = (v = e == null ? void 0 : e.legend) == null ? void 0 : v.position, l = (g = this.wrapperDOM) == null ? void 0 : g.style, n = (y = this.legendDOM) == null ? void 0 : y.style, d = (p = this.legendBoxDOM) == null ? void 0 : p.style, t = (m = this.resizeDOM) == null ? void 0 : m.style;
|
|
547
|
-
let s, h;
|
|
548
|
-
const i = (L = e == null ? void 0 : e.title) != null && L.show ? (x = e == null ? void 0 : e.title) == null ? void 0 : x.height : 0, r = i + ((b = e == null ? void 0 : e.legend) == null ? void 0 : b.height), { top: a = 0, bottom: c = 0, left: f = 0, right: u = 0 } = ((C = e == null ? void 0 : e.legend) == null ? void 0 : C.padding) ?? {};
|
|
549
|
-
if (!(!l || !n))
|
|
550
|
-
switch (d.padding = `${a}px ${u}px ${c}px ${f}px`, o) {
|
|
551
|
-
case "top":
|
|
552
|
-
l.padding = `${r}px 0 0 0`, s = this.chartDOM.getBoundingClientRect(), h = parseInt(n.paddingTop) + parseInt(n.paddingBottom), d.width = "100%", d.height = `${e.legend.height - h}px`, n.top = `${i}px`, n.right = "", n.bottom = "", n.left = "", n.width = `${s.width}px`, n.height = `${e.legend.height + (t ? 4 : 0)}px`, t && (t.top = `${r}px`, t.right = "", t.bottom = "", t.left = "", t.width = `${s.width}px`, t.height = "4px", t.cursor = "row-resize");
|
|
553
|
-
break;
|
|
554
|
-
case "right":
|
|
555
|
-
l.padding = `${i}px ${e.legend.width}px 0 0`, s = this.chartDOM.getBoundingClientRect(), d.width = `${e.legend.width - 10}px`, d.maxHeight = `${s.height}px`, n.paddingLeft = "10px", n.top = `${i}px`, n.right = "0px", n.bottom = "", n.left = "", n.width = `${e.legend.width}px`, n.height = `${s.height}px`, t && (t.top = `${i}px`, t.right = `${e.legend.width}px`, t.bottom = "", t.left = "", t.width = "4px", t.height = `${s.height}px`, t.cursor = "col-resize");
|
|
556
|
-
break;
|
|
557
|
-
case "bottom":
|
|
558
|
-
l.padding = `${i}px 0 ${e.legend.height}px 0`, s = this.chartDOM.getBoundingClientRect(), h = parseInt(n.paddingTop) + parseInt(n.paddingBottom), d.width = "100%", d.height = `${e.legend.height - h}px`, n.top = "", n.right = "", n.bottom = "0px", n.left = "0px", n.width = `${s.width}px`, n.height = `${e.legend.height + (t ? 4 : 0)}px`, t && (t.top = "", t.right = "", t.bottom = `${e.legend.height}px`, t.left = "", t.width = `${s.width}px`, t.height = "4px", t.cursor = "row-resize");
|
|
559
|
-
break;
|
|
560
|
-
case "left":
|
|
561
|
-
l.padding = `${i}px 0 0 ${e.legend.width}px`, s = this.chartDOM.getBoundingClientRect(), d.width = `${e.legend.width}px`, d.maxHeight = `${s.height}px`, d.display = "absolute", d.bottom = "0px", n.top = `${i}px`, n.right = "", n.bottom = "", n.left = "0px", n.width = `${e.legend.width}px`, n.height = `${s.height}px`, t && (t.top = `${i}px`, t.right = "", t.bottom = "", t.left = `${e.legend.width}px`, t.width = "4px", t.height = `${s.height}px`, t.cursor = "col-resize");
|
|
562
|
-
break;
|
|
563
|
-
}
|
|
564
|
-
},
|
|
565
|
-
/**
|
|
566
|
-
* Update legend components size
|
|
567
|
-
*
|
|
568
|
-
* @returns {undefined}
|
|
569
|
-
*/
|
|
570
|
-
updateLegendContainerSize() {
|
|
571
|
-
var l;
|
|
572
|
-
if (!this.options || !this.legendBoxDOM)
|
|
573
|
-
return;
|
|
574
|
-
const e = (l = this.options) == null ? void 0 : l.legend, o = this.legendBoxDOM.getElementsByClassName("ev-chart-legend-container");
|
|
575
|
-
if (o)
|
|
576
|
-
for (let n = 0; n < o.length; n++)
|
|
577
|
-
e.position === "top" || e.position === "bottom" ? (o[n].style.width = `${e.width - 8}px`, o[n].style.margin = "0 4px") : o[n].style.width = "100%";
|
|
578
|
-
},
|
|
579
|
-
/**
|
|
580
|
-
* When user moves resizeDOM, this function will change css
|
|
581
|
-
*
|
|
582
|
-
* @returns {undefined}
|
|
583
|
-
*/
|
|
584
|
-
onMouseMove(e) {
|
|
585
|
-
e.stopPropagation(), e.preventDefault();
|
|
586
|
-
const o = this.wrapperDOM.getBoundingClientRect(), l = this.wrapperDOM.offsetWidth, n = this.wrapperDOM.offsetHeight, d = this.options.title.show ? this.options.title.height : 0, t = this.options.legend.position, s = 150, h = 70, i = 120, r = 20;
|
|
587
|
-
let a;
|
|
588
|
-
switch (t) {
|
|
589
|
-
case "left":
|
|
590
|
-
a = e.clientX - o.left, a < i ? a = i : a > l - s && (a = l - s), this.ghostDOM.style.left = `${a}px`;
|
|
591
|
-
break;
|
|
592
|
-
case "right":
|
|
593
|
-
a = e.clientX - o.left, a < s ? a = s : a > l - i && (a = l - i), this.ghostDOM.style.left = `${a}px`;
|
|
594
|
-
break;
|
|
595
|
-
case "top":
|
|
596
|
-
a = e.clientY - o.top, a < r + d ? a = r + d : a > n - h && (a = n - h), this.ghostDOM.style.top = `${a}px`;
|
|
597
|
-
break;
|
|
598
|
-
case "bottom":
|
|
599
|
-
a = e.clientY - o.top, a < h + d ? a = h + d : a > n - r && (a = n - r), this.ghostDOM.style.bottom = `${this.wrapperDOM.offsetHeight - a}px`;
|
|
600
|
-
break;
|
|
601
|
-
}
|
|
602
|
-
this.isLegendMove = !0;
|
|
603
|
-
},
|
|
604
|
-
/**
|
|
605
|
-
* callback for mouseup on ghostDOM, this function will change legend and chart size.
|
|
606
|
-
*
|
|
607
|
-
* @returns {undefined}
|
|
608
|
-
*/
|
|
609
|
-
onMouseUp(e) {
|
|
610
|
-
e.stopPropagation(), e.preventDefault(), this.wrapperDOM.removeEventListener("mousemove", this.mouseMove, !1), this.wrapperDOM.removeEventListener("mouseup", this.mouseUp, !1);
|
|
611
|
-
const o = this.options, l = o.legend.position, n = this.resizeDOM.style, d = this.legendDOM.style, t = this.legendBoxDOM.style, s = this.ghostDOM.style, h = this.wrapperDOM.style, i = o.title.show ? o.title.height : 0, r = +this.legendDOM.style.paddingLeft.replace("px", "");
|
|
612
|
-
let a;
|
|
613
|
-
if (this.isLegendMove)
|
|
614
|
-
switch (l) {
|
|
615
|
-
case "top":
|
|
616
|
-
n.top = s.top, a = +s.top.replace("px", ""), d.height = `${a - i}px`, t.height = `${a - i - 4}px`, o.legend.height = a - i - 4, h.padding = `${a}px 0 0 0`;
|
|
617
|
-
break;
|
|
618
|
-
case "right":
|
|
619
|
-
n.left = s.left, a = +s.left.replace("px", ""), d.width = `${this.wrapperDOM.offsetWidth - a - 4}px`, t.width = `${this.wrapperDOM.offsetWidth - a - 4 - r}px`, o.legend.width = this.wrapperDOM.offsetWidth - a - 4, h.padding = `${i}px ${this.wrapperDOM.offsetWidth - a}px 0 0`;
|
|
620
|
-
break;
|
|
621
|
-
case "bottom":
|
|
622
|
-
n.bottom = s.bottom, a = this.wrapperDOM.offsetHeight - +s.bottom.replace("px", ""), d.height = `${this.wrapperDOM.offsetHeight - a}px`, t.height = `${a - i - 4}px`, o.legend.height = this.wrapperDOM.offsetHeight - a, h.padding = `${i}px 0 ${this.wrapperDOM.offsetHeight - a}px 0`;
|
|
623
|
-
break;
|
|
624
|
-
case "left":
|
|
625
|
-
n.left = s.left, a = +s.left.replace("px", ""), d.width = `${a}px`, t.width = `${a}px`, o.legend.width = a, h.padding = `${i}px 0 0 ${a - 4}px`;
|
|
626
|
-
break;
|
|
627
|
-
}
|
|
628
|
-
n.display = "block", this.ghostDOM.remove(), this.isLegendMove && (this.render(), this.isLegendMove = !1);
|
|
629
|
-
},
|
|
630
|
-
/**
|
|
631
|
-
* Show legend components by manipulating css
|
|
632
|
-
*
|
|
633
|
-
* @returns {undefined}
|
|
634
|
-
*/
|
|
635
|
-
showLegend() {
|
|
636
|
-
this.resizeDOM && (this.resizeDOM.style.display = "block"), this.legendDOM && (this.legendDOM.style.display = "block"), this.legendNeedsUpdate && this.options.legend.virtualScroll && !this.useTable && (this.legendNeedsUpdate = !1, this.updateVisibleRowCount(), this.renderVisibleLegends());
|
|
637
|
-
},
|
|
638
|
-
/**
|
|
639
|
-
* Hide legend components by manipulating css
|
|
640
|
-
*
|
|
641
|
-
* @returns {undefined}
|
|
642
|
-
*/
|
|
643
|
-
hideLegend() {
|
|
644
|
-
var t, s, h, i, r;
|
|
645
|
-
const e = this.options, o = (t = this.wrapperDOM) == null ? void 0 : t.style, l = (s = this.resizeDOM) == null ? void 0 : s.style, n = (h = this.legendDOM) == null ? void 0 : h.style, d = (i = e == null ? void 0 : e.title) != null && i.show ? (r = e == null ? void 0 : e.title) == null ? void 0 : r.height : 0;
|
|
646
|
-
!n || !o || (l && (l.display = "none"), n.display = "none", n.width = "0", n.height = "0", o.padding = `${d}px 0 0 0`);
|
|
647
|
-
},
|
|
648
|
-
/**
|
|
649
|
-
* Get formatted value by formatter function
|
|
650
|
-
* Only chartOption > legend > table > use : true
|
|
651
|
-
* @param formatter
|
|
652
|
-
* @param decimalPoint
|
|
653
|
-
* @param value
|
|
654
|
-
* @returns {string}
|
|
655
|
-
*/
|
|
656
|
-
getFormattedValue({ formatter: e, decimalPoint: o }, l) {
|
|
657
|
-
if (l == null)
|
|
658
|
-
return "Null";
|
|
659
|
-
let n;
|
|
660
|
-
return e && (n = e(+l)), (!e || typeof n != "string") && (n = w.labelSignFormat(+l, o)), n;
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
export {
|
|
664
|
-
O as default
|
|
665
|
-
};
|