@hybridcore/ui 1.5.80 → 1.5.82

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.
@@ -0,0 +1,399 @@
1
+ import { N as J, i as D, O as V, P as M, F as E, j as X, _ as U, n as K, L as H, T as B, R as z, m as q } from "./AxisRendererY-kADUad00.js";
2
+ class Y extends J {
3
+ constructor() {
4
+ super(...arguments), Object.defineProperty(this, "_ph", {
5
+ enumerable: !0,
6
+ configurable: !0,
7
+ writable: !0,
8
+ value: 0
9
+ }), Object.defineProperty(this, "_pw", {
10
+ enumerable: !0,
11
+ configurable: !0,
12
+ writable: !0,
13
+ value: 0
14
+ }), Object.defineProperty(this, "_columnsUpdated", {
15
+ enumerable: !0,
16
+ configurable: !0,
17
+ writable: !0,
18
+ value: !1
19
+ });
20
+ }
21
+ _makeGraphics(e, t) {
22
+ return this.makeColumn(t, e);
23
+ }
24
+ _makeFieldNames() {
25
+ super._makeFieldNames();
26
+ const e = this.get("xAxis"), t = this.get("yAxis"), s = "CategoryAxis", o = "ValueAxis";
27
+ e.isType(s) && (this.get("openCategoryXField") || (this._xOpenField = this._xField)), e.isType(o) && (this.get("openValueXField") || (this._xOpenField = this._xField)), t.isType(s) && (this.get("openCategoryYField") || (this._yOpenField = this._yField)), t.isType(o) && (this.get("openValueYField") || (this._yOpenField = this._yField));
28
+ }
29
+ _prepareChildren() {
30
+ super._prepareChildren();
31
+ const e = this.get("xAxis"), t = this.get("yAxis"), s = this.dataItems.length, o = Math.max(0, this.startIndex() - 2), i = Math.min(this.endIndex() + 2, s - 1);
32
+ if (e.inited && t.inited)
33
+ for (let n = o; n <= i; n++) {
34
+ let a = this.dataItems[n];
35
+ this._createGraphics(a);
36
+ }
37
+ }
38
+ _updateChildren() {
39
+ const e = this.chart;
40
+ e && (this._ph = e.plotContainer.height(), this._pw = e.plotContainer.width());
41
+ const t = this.get("xAxis"), s = this.get("yAxis"), o = this.get("baseAxis"), i = this.columns.template;
42
+ this.isDirty("fill") && i.get("fill") == null && i.set("fill", this.get("fill")), this.isDirty("fillPattern") && i.get("fillPattern") == null && i.set("fillPattern", this.get("fillPattern")), this.isDirty("stroke") && i.get("stroke") == null && i.set("stroke", this.get("stroke"));
43
+ let n = 0, a = 0, _ = 0;
44
+ D(o.series, (P) => {
45
+ if (P instanceof Y) {
46
+ const L = P.get("stacked");
47
+ L && _ == 0 && a++, !L && P.get("clustered") && a++;
48
+ }
49
+ P === this && (n = a - 1), _++;
50
+ }), this.get("clustered") || (n = 0, a = 1), a === 0 && (a = 1, n = 0);
51
+ const f = t.get("renderer"), x = s.get("renderer"), c = "cellStartLocation", h = "cellEndLocation", g = f.get(c, 0), v = f.get(h, 1), d = x.get(c, 0), l = x.get(h, 1);
52
+ if (this._aLocationX0 = g + n / a * (v - g), this._aLocationX1 = g + (n + 1) / a * (v - g), this._aLocationY0 = d + n / a * (l - d), this._aLocationY1 = d + (n + 1) / a * (l - d), t.inited && s.inited) {
53
+ if (this._axesDirty || this._valuesDirty || this._stackDirty || this.isDirty("vcx") || this.isDirty("vcy") || this._sizeDirty) {
54
+ const P = this.dataItems.length;
55
+ let L = Math.max(0, this.startIndex() - 2), b = Math.min(this.endIndex() + 2, P - 1);
56
+ for (let r = 0; r < L; r++)
57
+ this._toggleColumn(this.dataItems[r], !1);
58
+ let y = this.dataItems[L];
59
+ for (let r = L; r <= b; r++) {
60
+ let C = this.dataItems[r];
61
+ if (C.get("valueX") != null && C.get("valueY") != null) {
62
+ if (y = C, r > 0 && L > 0)
63
+ for (let G = r - 1; G >= 0; G--) {
64
+ let u = this.dataItems[G];
65
+ if (u.get("valueX") != null && u.get("valueY") != null) {
66
+ y = u;
67
+ break;
68
+ }
69
+ }
70
+ break;
71
+ } else
72
+ this._toggleColumn(C, !1);
73
+ }
74
+ this._beforeColumnsDraw();
75
+ let A = 0;
76
+ s.isType("CategoryAxis") && t.isType("CategoryAxis") ? A = 2 : t === o ? A = 0 : s === o && (A = 1);
77
+ for (let r = L; r <= b; r++) {
78
+ let C = this.dataItems[r];
79
+ this._updateGraphics(C, y, A), C.get("valueX") != null && C.get("valueY") != null && (y = C);
80
+ }
81
+ this._afterColumnsDraw();
82
+ for (let r = b + 1; r < P; r++)
83
+ this._toggleColumn(this.dataItems[r], !1);
84
+ this._columnsUpdated = !0;
85
+ }
86
+ } else
87
+ this._skipped = !0;
88
+ this.getPrivate("doNotUpdateLegend") || this.updateLegendMarker(this.get("tooltipDataItem")), super._updateChildren();
89
+ }
90
+ _afterChanged() {
91
+ super._afterChanged(), this._columnsUpdated = !1;
92
+ }
93
+ _beforeColumnsDraw() {
94
+ }
95
+ _afterColumnsDraw() {
96
+ }
97
+ _createGraphics(e) {
98
+ let t = e.get("graphics");
99
+ if (!t) {
100
+ t = this._makeGraphics(this.columns, e), e.set("graphics", t), t._setDataItem(e);
101
+ const s = e.get("legendDataItem");
102
+ if (s) {
103
+ const i = s.get("markerRectangle");
104
+ if (i) {
105
+ const n = i.states.lookup("default");
106
+ D(V, (a) => {
107
+ const _ = t.get(a, this.get(a));
108
+ i.set(a, _), n.set(a, _);
109
+ });
110
+ }
111
+ }
112
+ let o = e.get("rangeGraphics");
113
+ o && D(o, (i) => {
114
+ i.dispose();
115
+ }), o = [], e.setRaw("rangeGraphics", o), this.axisRanges.each((i) => {
116
+ const n = i.container, a = this._makeGraphics(i.columns, e);
117
+ o && o.push(a), a.setPrivate("list", i.columns), n.children.push(a);
118
+ });
119
+ }
120
+ }
121
+ createAxisRange(e) {
122
+ return D(this.dataItems, (t) => {
123
+ const s = t.get("graphics");
124
+ s && (s.dispose(), t.set("graphics", void 0));
125
+ }), super.createAxisRange(e);
126
+ }
127
+ _updateGraphics(e, t, s) {
128
+ let o = e.get("graphics");
129
+ const i = this._xField, n = this._yField, a = e.get(i), _ = e.get(n), f = this.get("exactLocationX", !1);
130
+ if (a != null && _ != null) {
131
+ const x = this._xOpenField, c = this._yOpenField, h = this.get("locationX", e.get("locationX", 0.5)), g = this.get("locationY", e.get("locationY", 0.5)), v = this.get("openLocationX", e.get("openLocationX", h)), d = this.get("openLocationY", e.get("openLocationY", g)), l = o.get("width"), P = o.get("height"), L = this.get("stacked"), b = this.get("xAxis"), y = this.get("yAxis"), A = b.get("start"), r = b.get("end"), C = y.get("start"), G = y.get("end");
132
+ let u, O, k, F, T = this.get("vcy", 1), R = this.get("vcx", 1), S = !1, j = !1;
133
+ if (s == 0) {
134
+ let m = this._aLocationX0 + v - 0.5, w = this._aLocationX1 + h - 0.5;
135
+ if (l instanceof M) {
136
+ let p = (w - m) * (1 - l.value) / 2;
137
+ m += p, w -= p;
138
+ }
139
+ if (u = b.getDataItemPositionX(e, x, m, R, f), O = b.getDataItemPositionX(e, i, w, R, f), k = y.getDataItemPositionY(e, n, g, T), this._yOpenField !== this._yField)
140
+ F = y.getDataItemPositionY(e, c, d, T);
141
+ else if (L) {
142
+ let p = e.get("stackToItemY");
143
+ p ? F = y.getDataItemPositionY(p, n, d, p.component.get("vcy")) : F = y.basePosition();
144
+ } else
145
+ F = y.basePosition();
146
+ e.setRaw("point", { x: u + (O - u) / 2, y: k }), j = !0;
147
+ } else if (s == 1) {
148
+ let m = this._aLocationY0 + d - 0.5, w = this._aLocationY1 + g - 0.5;
149
+ if (P instanceof M) {
150
+ let p = (w - m) * (1 - P.value) / 2;
151
+ m += p, w -= p;
152
+ }
153
+ if (k = y.getDataItemPositionY(e, c, m, T), F = y.getDataItemPositionY(e, n, w, T), O = b.getDataItemPositionX(e, i, h, R, f), this._xOpenField !== this._xField)
154
+ u = b.getDataItemPositionX(e, x, v, R, f);
155
+ else if (L) {
156
+ let p = e.get("stackToItemX");
157
+ p ? u = b.getDataItemPositionX(p, i, v, p.component.get("vcx"), f) : u = b.basePosition();
158
+ } else
159
+ u = b.basePosition();
160
+ S = !0, e.setRaw("point", { x: O, y: k + (F - k) / 2 });
161
+ } else if (s == 2) {
162
+ let m = this._aLocationX0 + v - 0.5, w = this._aLocationX1 + h - 0.5;
163
+ if (l instanceof M) {
164
+ let p = (w - m) * (1 - l.value) / 2;
165
+ m += p, w -= p;
166
+ }
167
+ if (u = b.getDataItemPositionX(e, x, m, R), O = b.getDataItemPositionX(e, i, w, R), m = this._aLocationY0 + d - 0.5, w = this._aLocationY1 + g - 0.5, P instanceof M) {
168
+ let p = (w - m) * (1 - P.value) / 2;
169
+ m += p, w -= p;
170
+ }
171
+ k = y.getDataItemPositionY(e, c, m, T), F = y.getDataItemPositionY(e, n, w, T), e.setRaw("point", { x: u + (O - u) / 2, y: k + (F - k) / 2 });
172
+ }
173
+ this._applyGraphicsStates(e, t), this._updateSeriesGraphics(e, o, u, O, k, F, S, j), u < A && O < A || u > r && O > r || k < C && F <= C || k >= G && F > G || E(u) || E(k) ? this._toggleColumn(e, !1) : this._toggleColumn(e, !0);
174
+ let W = e.get("rangeGraphics");
175
+ W && D(W, (m) => {
176
+ this._updateSeriesGraphics(e, m, u, O, k, F, S, j);
177
+ });
178
+ } else
179
+ this._toggleColumn(e, !1);
180
+ }
181
+ _updateSeriesGraphics(e, t, s, o, i, n, a, _) {
182
+ const f = t.get("width"), x = t.get("height"), c = t.get("maxWidth"), h = t.get("maxHeight"), g = this.getPoint(s, i), v = this.getPoint(o, n), d = e.get("point");
183
+ if (d) {
184
+ const l = this.getPoint(d.x, d.y);
185
+ d.x = l.x + this._x, d.y = l.y + this._y;
186
+ }
187
+ if (s = g.x, o = v.x, i = g.y, n = v.y, X(f)) {
188
+ const l = (o - s - f) / 2;
189
+ s += l, o -= l;
190
+ }
191
+ if (X(c) && c < Math.abs(o - s)) {
192
+ const l = (o - s - c) / 2;
193
+ s += l, o -= l;
194
+ }
195
+ if (X(x)) {
196
+ const l = (n - i - x) / 2;
197
+ i += l, n -= l;
198
+ }
199
+ if (X(h) && h < Math.abs(n - i)) {
200
+ const l = (n - i - h) / 2;
201
+ i += l, n -= l;
202
+ }
203
+ this.get("adjustBulletPosition") && (a && (o = Math.min(Math.max(0, o), this._pw), s = Math.min(Math.max(0, s), this._pw)), _ && (i = Math.min(Math.max(0, i), this._ph), n = Math.min(Math.max(0, n), this._ph))), e.setRaw("left", s), e.setRaw("right", o), e.setRaw("top", i), e.setRaw("bottom", n), t.setPrivate("width", o - s), t.setPrivate("height", n - i), t.set("x", s), t.set("y", n - (n - i));
204
+ }
205
+ _handleDataSetChange() {
206
+ super._handleDataSetChange(), D(this._dataItems, (e) => {
207
+ this._toggleColumn(e, !1);
208
+ });
209
+ }
210
+ _applyGraphicsStates(e, t) {
211
+ const s = e.get("graphics"), o = s.states.lookup("dropFromOpen"), i = s.states.lookup("riseFromOpen"), n = s.states.lookup("dropFromPrevious"), a = s.states.lookup("riseFromPrevious");
212
+ if (o || n || i || a) {
213
+ const _ = this.get("xAxis"), f = this.get("yAxis"), x = this.get("baseAxis");
214
+ let c, h, g;
215
+ x === _ && f.isType("ValueAxis") ? (c = e.get(this._yOpenField), h = e.get(this._yField), g = t.get(this._yField)) : x === f && _.isType("ValueAxis") && (c = e.get(this._xOpenField), h = e.get(this._xField), g = t.get(this._xField)), X(c) && X(h) && (h < c ? o && o.apply() : i && i.apply(), X(g) && (h < g ? n && n.apply() : a && a.apply()));
216
+ }
217
+ }
218
+ /**
219
+ * @ignore
220
+ */
221
+ disposeDataItem(e) {
222
+ super.disposeDataItem(e);
223
+ const t = e.get("graphics");
224
+ t && (this.columns.removeValue(t), t.dispose());
225
+ const s = e.get("rangeGraphics");
226
+ s && D(s, (o) => {
227
+ const i = o.getPrivate("list");
228
+ i && i.removeValue(o), o.dispose();
229
+ });
230
+ }
231
+ /**
232
+ * Hides series's data item.
233
+ *
234
+ * @param dataItem Data item
235
+ * @param duration Animation duration in milliseconds
236
+ * @return Promise
237
+ */
238
+ hideDataItem(e, t) {
239
+ const s = Object.create(null, {
240
+ hideDataItem: { get: () => super.hideDataItem }
241
+ });
242
+ return U(this, void 0, void 0, function* () {
243
+ const o = [s.hideDataItem.call(this, e, t)], i = e.get("graphics");
244
+ i && o.push(i.hide(t));
245
+ const n = e.get("rangeGraphics");
246
+ n && D(n, (a) => {
247
+ o.push(a.hide(t));
248
+ }), yield Promise.all(o);
249
+ });
250
+ }
251
+ _toggleColumn(e, t) {
252
+ const s = e.get("graphics");
253
+ s && s.setPrivate("visible", t);
254
+ const o = e.get("rangeGraphics");
255
+ o && D(o, (n) => {
256
+ n.setPrivate("visible", t);
257
+ });
258
+ const i = e.bullets;
259
+ i && D(i, (n) => {
260
+ n.setPrivate("hidden", !t);
261
+ });
262
+ }
263
+ /**
264
+ * Shows series's data item.
265
+ *
266
+ * @param dataItem Data item
267
+ * @param duration Animation duration in milliseconds
268
+ * @return Promise
269
+ */
270
+ showDataItem(e, t) {
271
+ const s = Object.create(null, {
272
+ showDataItem: { get: () => super.showDataItem }
273
+ });
274
+ return U(this, void 0, void 0, function* () {
275
+ const o = [s.showDataItem.call(this, e, t)], i = e.get("graphics");
276
+ i && o.push(i.show(t));
277
+ const n = e.get("rangeGraphics");
278
+ n && D(n, (a) => {
279
+ o.push(a.show(t));
280
+ }), yield Promise.all(o);
281
+ });
282
+ }
283
+ /**
284
+ * @ignore
285
+ */
286
+ updateLegendMarker(e) {
287
+ let t = this.get("legendDataItem");
288
+ if (this.get("useLastColorForLegendMarker") && !e) {
289
+ const s = this.dataItems[this.endIndex() - 1];
290
+ s && (e = s);
291
+ }
292
+ if (t) {
293
+ let s = this.columns.template;
294
+ if (e) {
295
+ let i = e.get("graphics");
296
+ i && (s = i);
297
+ }
298
+ const o = t.get("markerRectangle");
299
+ if (o && !t.get("itemContainer").get("disabled")) {
300
+ const i = o.states.lookup("default");
301
+ D(V, (n) => {
302
+ const a = s.get(n, this.get(n));
303
+ o.set(n, a), i.set(n, a);
304
+ });
305
+ }
306
+ }
307
+ }
308
+ _getTooltipTarget(e) {
309
+ if (this.get("seriesTooltipTarget") == "bullet")
310
+ return super._getTooltipTarget(e);
311
+ let t = e.get("graphics");
312
+ return t || this;
313
+ }
314
+ }
315
+ Object.defineProperty(Y, "className", {
316
+ enumerable: !0,
317
+ configurable: !0,
318
+ writable: !0,
319
+ value: "BaseColumnSeries"
320
+ });
321
+ Object.defineProperty(Y, "classNames", {
322
+ enumerable: !0,
323
+ configurable: !0,
324
+ writable: !0,
325
+ value: J.classNames.concat([Y.className])
326
+ });
327
+ class N extends Y {
328
+ constructor() {
329
+ super(...arguments), Object.defineProperty(this, "allColumns", {
330
+ enumerable: !0,
331
+ configurable: !0,
332
+ writable: !0,
333
+ value: this.children.push(K.new(this._root, {}))
334
+ }), Object.defineProperty(this, "allColumnsData", {
335
+ enumerable: !0,
336
+ configurable: !0,
337
+ writable: !0,
338
+ value: []
339
+ }), Object.defineProperty(this, "columns", {
340
+ enumerable: !0,
341
+ configurable: !0,
342
+ writable: !0,
343
+ value: this.addDisposer(new H(B.new({}), () => z._new(this._root, {
344
+ position: "absolute",
345
+ themeTags: q(this.columns.template.get("themeTags", []), ["series", "column"])
346
+ }, [this.columns.template])))
347
+ });
348
+ }
349
+ /**
350
+ * @ignore
351
+ */
352
+ makeColumn(e, t) {
353
+ const s = t.make();
354
+ return this.get("turboMode") ? s.virtualParent = this.chart : this.mainContainer.children.push(s), s._setDataItem(e), t.push(s), s;
355
+ }
356
+ _processAxisRange(e) {
357
+ super._processAxisRange(e), e.columns = new H(B.new({}), () => z._new(this._root, {
358
+ position: "absolute",
359
+ themeTags: q(e.columns.template.get("themeTags", []), ["series", "column"])
360
+ }, [this.columns.template, e.columns.template]));
361
+ }
362
+ _beforeColumnsDraw() {
363
+ this.allColumnsData = [];
364
+ }
365
+ _afterColumnsDraw() {
366
+ this.get("turboMode") && this.allColumns.set("draw", (e) => {
367
+ e.clear(), D(this.allColumnsData, (t) => {
368
+ const s = t.width, o = t.height, i = t.x, n = t.y, a = t.stroke, _ = t.fill, f = t.strokeWidth, x = t.strokeOpacity, c = t.fillOpacity;
369
+ e.beginFill(_, c), e.beginPath(), e.lineStyle(f, a, x), e.drawRect(i, n, s, o), e.endStroke(), e.endFill();
370
+ });
371
+ });
372
+ }
373
+ _updateSeriesGraphics(e, t, s, o, i, n, a, _) {
374
+ if (this.get("turboMode")) {
375
+ const f = t.get("stroke"), x = t.get("fillOpacity", 1), c = t.get("strokeOpacity", 1), h = t.get("strokeWidth", 1), g = t.get("fill"), v = this.getPoint(s, i), d = this.getPoint(o, n), l = e.get("point");
376
+ if (l) {
377
+ const P = this.getPoint(l.x, l.y);
378
+ l.x = P.x + this._x, l.y = P.y + this._y;
379
+ }
380
+ s = v.x, o = d.x, i = v.y, n = d.y, e.setRaw("left", s), e.setRaw("right", o), e.setRaw("top", i), e.setRaw("bottom", n), this.allColumnsData.push({ width: o - s, height: n - i, x: s, y: i, stroke: f, fill: g, strokeWidth: h, strokeOpacity: c, fillOpacity: x });
381
+ } else
382
+ super._updateSeriesGraphics(e, t, s, o, i, n, a, _);
383
+ }
384
+ }
385
+ Object.defineProperty(N, "className", {
386
+ enumerable: !0,
387
+ configurable: !0,
388
+ writable: !0,
389
+ value: "ColumnSeries"
390
+ });
391
+ Object.defineProperty(N, "classNames", {
392
+ enumerable: !0,
393
+ configurable: !0,
394
+ writable: !0,
395
+ value: Y.classNames.concat([N.className])
396
+ });
397
+ export {
398
+ N as C
399
+ };