@hybridcore/ui 1.5.78 → 1.5.80

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.
@@ -1,811 +1,27 @@
1
- import { jsxs as we, jsx as W } from "react/jsx-runtime";
2
- import { S as oe, L as $, T as F, C as te, m as P, R as ie, k as se, X as ue, G as S, e as N, i as ne, l as Te, j as he, n as Pe, a as le, b as Fe, A as Le, c as De, d as Ae, D as Ce, f as Oe, V as Xe, h as $e, o as Ye, g as Se, p as re } from "../../../AxisRendererY-CFo972D5.js";
3
- import { useRef as ae, useLayoutEffect as Me } from "react";
4
- class V extends oe {
5
- constructor() {
6
- super(...arguments), Object.defineProperty(this, "itemContainers", {
7
- enumerable: !0,
8
- configurable: !0,
9
- writable: !0,
10
- value: this.addDisposer(new $(F.new({}), () => te._new(this._root, {
11
- themeTags: P(this.itemContainers.template.get("themeTags", []), ["legend", "item"]),
12
- themeTagsSelf: P(this.itemContainers.template.get("themeTagsSelf", []), ["itemcontainer"]),
13
- background: ie.new(this._root, {
14
- themeTags: P(this.itemContainers.template.get("themeTags", []), ["legend", "item", "background"]),
15
- themeTagsSelf: P(this.itemContainers.template.get("themeTagsSelf", []), ["itemcontainer"])
16
- })
17
- }, [this.itemContainers.template])))
18
- }), Object.defineProperty(this, "markers", {
19
- enumerable: !0,
20
- configurable: !0,
21
- writable: !0,
22
- value: this.addDisposer(new $(F.new({}), () => te._new(this._root, {
23
- themeTags: P(this.markers.template.get("themeTags", []), ["legend", "marker"])
24
- }, [this.markers.template])))
25
- }), Object.defineProperty(this, "labels", {
26
- enumerable: !0,
27
- configurable: !0,
28
- writable: !0,
29
- value: this.addDisposer(new $(F.new({}), () => se._new(this._root, {
30
- themeTags: P(this.labels.template.get("themeTags", []), ["legend", "label"])
31
- }, [this.labels.template])))
32
- }), Object.defineProperty(this, "valueLabels", {
33
- enumerable: !0,
34
- configurable: !0,
35
- writable: !0,
36
- value: this.addDisposer(new $(F.new({}), () => se._new(this._root, {
37
- themeTags: P(this.valueLabels.template.get("themeTags", []), ["legend", "label", "value"])
38
- }, [this.valueLabels.template])))
39
- }), Object.defineProperty(this, "markerRectangles", {
40
- enumerable: !0,
41
- configurable: !0,
42
- writable: !0,
43
- value: this.addDisposer(new $(F.new({}), () => ie._new(this._root, {
44
- themeTags: P(this.markerRectangles.template.get("themeTags", []), ["legend", "marker", "rectangle"])
45
- }, [this.markerRectangles.template])))
46
- });
47
- }
48
- _afterNew() {
49
- this._settings.themeTags = P(this._settings.themeTags, ["legend"]), this.fields.push("name", "stroke", "fill"), super._afterNew();
50
- }
51
- /**
52
- * @ignore
53
- */
54
- makeItemContainer(e) {
55
- const t = this.children.push(this.itemContainers.make());
56
- return t._setDataItem(e), this.itemContainers.push(t), t.states.create("disabled", {}), t;
57
- }
58
- /**
59
- * @ignore
60
- */
61
- makeMarker() {
62
- const e = this.markers.make();
63
- return this.markers.push(e), e.states.create("disabled", {}), e;
64
- }
65
- /**
66
- * @ignore
67
- */
68
- makeLabel() {
69
- const e = this.labels.make();
70
- return e.states.create("disabled", {}), e;
71
- }
72
- /**
73
- * @ignore
74
- */
75
- makeValueLabel() {
76
- const e = this.valueLabels.make();
77
- return e.states.create("disabled", {}), e;
78
- }
79
- /**
80
- * @ignore
81
- */
82
- makeMarkerRectangle() {
83
- const e = this.markerRectangles.make();
84
- return e.states.create("disabled", {}), e;
85
- }
86
- processDataItem(e) {
87
- super.processDataItem(e);
88
- const t = this.makeItemContainer(e), i = this.get("nameField"), r = this.get("fillField"), h = this.get("strokeField");
89
- if (t) {
90
- const d = this.get("clickTarget", "itemContainer"), l = e.dataContext;
91
- l && l.set && l.set("legendDataItem", e), t._setDataItem(e), e.set("itemContainer", t);
92
- const c = this.makeMarker();
93
- if (c) {
94
- t.children.push(c), c._setDataItem(e), e.set("marker", c);
95
- const s = this.get("useDefaultMarker"), o = c.children.push(this.makeMarkerRectangle());
96
- let f = e.get("fill"), p = e.get("stroke");
97
- e.set("markerRectangle", o), l && l.get && (f = l.get(r, f), p = l.get(h, p)), p || (p = f), s ? l.on && (l.on(r, () => {
98
- o.set("fill", l.get(r));
99
- }), l.on(h, () => {
100
- o.set("stroke", l.get(h));
101
- })) : l && l.createLegendMarker && l.createLegendMarker(), o.setAll({ fill: f, stroke: p });
102
- const m = l.component;
103
- m && m.updateLegendMarker && m.updateLegendMarker(l);
104
- }
105
- const n = this.makeLabel();
106
- if (n) {
107
- t.children.push(n), n._setDataItem(e), e.set("label", n), n.text.on("text", () => {
108
- t.setRaw("ariaLabel", n.text._getText() + (this.get("clickTarget") !== "none" ? "; " + this._t("Press ENTER to toggle") : "")), t.markDirtyAccessibility();
109
- }), l && l.get && e.set("name", l.get(i));
110
- let s = e.get("name");
111
- s && n.set("text", s);
112
- }
113
- const a = this.makeValueLabel();
114
- if (a && (t.children.push(a), a._setDataItem(e), e.set("valueLabel", a)), l && l.show && (l.on("visible", (s) => {
115
- t.set("disabled", !s);
116
- }), l.get("visible") || t.set("disabled", !0), d != "none")) {
117
- let s = t;
118
- d == "marker" && (s = c), this._addClickEvents(s, l, e);
119
- }
120
- this.children.values.sort((s, o) => {
121
- const f = s.dataItem.dataContext, p = o.dataItem.dataContext;
122
- if (f && p) {
123
- const m = this.data.indexOf(f), b = this.data.indexOf(p);
124
- if (m > b)
125
- return 1;
126
- if (m < b)
127
- return -1;
128
- }
129
- return 0;
130
- }), l && l.updateLegendValue && l.updateLegendValue();
131
- }
132
- }
133
- _addClickEvents(e, t, i) {
134
- e.set("cursorOverStyle", "pointer"), e.events.on("pointerover", () => {
135
- const r = t.component;
136
- r && r.hoverDataItem && r.hoverDataItem(t);
137
- }), e.events.on("pointerout", () => {
138
- const r = t.component;
139
- r && r.hoverDataItem && r.unhoverDataItem(t);
140
- }), e.events.on("click", () => {
141
- const r = i.get("label").text._getText();
142
- t.show && t.isHidden && (t.isHidden() || t.get("visible") === !1) ? (t.show(), e.set("disabled", !1), this._root.readerAlert(this._t("%1 shown", this._root.locale, r))) : t.hide && (t.hide(), e.set("disabled", !0), this._root.readerAlert(this._t("%1 hidden", this._root.locale, r)));
143
- });
144
- }
145
- /**
146
- * @ignore
147
- */
148
- disposeDataItem(e) {
149
- super.disposeDataItem(e);
150
- const t = e.dataContext;
151
- t && t.get && t.get("legendDataItem") == e && t.set("legendDataItem", void 0);
152
- let i = e.get("itemContainer");
153
- i && (this.itemContainers.removeValue(i), i.dispose());
154
- let r = e.get("marker");
155
- r && (this.markers.removeValue(r), r.dispose());
156
- let h = e.get("markerRectangle");
157
- h && (this.markerRectangles.removeValue(h), h.dispose());
158
- let d = e.get("label");
159
- d && (this.labels.removeValue(d), d.dispose());
160
- let l = e.get("valueLabel");
161
- l && (this.valueLabels.removeValue(l), l.dispose());
162
- }
163
- }
164
- Object.defineProperty(V, "className", {
165
- enumerable: !0,
166
- configurable: !0,
167
- writable: !0,
168
- value: "Legend"
169
- });
170
- Object.defineProperty(V, "classNames", {
171
- enumerable: !0,
172
- configurable: !0,
173
- writable: !0,
174
- value: oe.classNames.concat([V.className])
175
- });
176
- function v(u) {
177
- return function() {
178
- return u;
179
- };
180
- }
181
- const q = Math.PI, Z = 2 * q, M = 1e-6, je = Z - M;
182
- function ce(u) {
183
- this._ += u[0];
184
- for (let e = 1, t = u.length; e < t; ++e)
185
- this._ += arguments[e] + u[e];
186
- }
187
- function Re(u) {
188
- let e = Math.floor(u);
189
- if (!(e >= 0)) throw new Error(`invalid digits: ${u}`);
190
- if (e > 15) return ce;
191
- const t = 10 ** e;
192
- return function(i) {
193
- this._ += i[0];
194
- for (let r = 1, h = i.length; r < h; ++r)
195
- this._ += Math.round(arguments[r] * t) / t + i[r];
196
- };
197
- }
198
- class Ee {
199
- constructor(e) {
200
- this._x0 = this._y0 = // start of current subpath
201
- this._x1 = this._y1 = null, this._ = "", this._append = e == null ? ce : Re(e);
202
- }
203
- moveTo(e, t) {
204
- this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}`;
205
- }
206
- closePath() {
207
- this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
208
- }
209
- lineTo(e, t) {
210
- this._append`L${this._x1 = +e},${this._y1 = +t}`;
211
- }
212
- quadraticCurveTo(e, t, i, r) {
213
- this._append`Q${+e},${+t},${this._x1 = +i},${this._y1 = +r}`;
214
- }
215
- bezierCurveTo(e, t, i, r, h, d) {
216
- this._append`C${+e},${+t},${+i},${+r},${this._x1 = +h},${this._y1 = +d}`;
217
- }
218
- arcTo(e, t, i, r, h) {
219
- if (e = +e, t = +t, i = +i, r = +r, h = +h, h < 0) throw new Error(`negative radius: ${h}`);
220
- let d = this._x1, l = this._y1, c = i - e, n = r - t, a = d - e, s = l - t, o = a * a + s * s;
221
- if (this._x1 === null)
222
- this._append`M${this._x1 = e},${this._y1 = t}`;
223
- else if (o > M) if (!(Math.abs(s * c - n * a) > M) || !h)
224
- this._append`L${this._x1 = e},${this._y1 = t}`;
225
- else {
226
- let f = i - d, p = r - l, m = c * c + n * n, b = f * f + p * p, k = Math.sqrt(m), x = Math.sqrt(o), y = h * Math.tan((q - Math.acos((m + o - b) / (2 * k * x))) / 2), _ = y / x, w = y / k;
227
- Math.abs(_ - 1) > M && this._append`L${e + _ * a},${t + _ * s}`, this._append`A${h},${h},0,0,${+(s * f > a * p)},${this._x1 = e + w * c},${this._y1 = t + w * n}`;
228
- }
229
- }
230
- arc(e, t, i, r, h, d) {
231
- if (e = +e, t = +t, i = +i, d = !!d, i < 0) throw new Error(`negative radius: ${i}`);
232
- let l = i * Math.cos(r), c = i * Math.sin(r), n = e + l, a = t + c, s = 1 ^ d, o = d ? r - h : h - r;
233
- this._x1 === null ? this._append`M${n},${a}` : (Math.abs(this._x1 - n) > M || Math.abs(this._y1 - a) > M) && this._append`L${n},${a}`, i && (o < 0 && (o = o % Z + Z), o > je ? this._append`A${i},${i},0,1,${s},${e - l},${t - c}A${i},${i},0,1,${s},${this._x1 = n},${this._y1 = a}` : o > M && this._append`A${i},${i},0,${+(o >= q)},${s},${this._x1 = e + i * Math.cos(h)},${this._y1 = t + i * Math.sin(h)}`);
234
- }
235
- rect(e, t, i, r) {
236
- this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}h${i = +i}v${+r}h${-i}Z`;
237
- }
238
- toString() {
239
- return this._;
240
- }
241
- }
242
- function fe(u) {
243
- let e = 3;
244
- return u.digits = function(t) {
245
- if (!arguments.length) return e;
246
- if (t == null)
247
- e = null;
248
- else {
249
- const i = Math.floor(t);
250
- if (!(i >= 0)) throw new RangeError(`invalid digits: ${t}`);
251
- e = i;
252
- }
253
- return u;
254
- }, () => new Ee(e);
255
- }
256
- function de(u) {
257
- return typeof u == "object" && "length" in u ? u : Array.from(u);
258
- }
259
- function pe(u) {
260
- this._context = u;
261
- }
262
- pe.prototype = {
263
- areaStart: function() {
264
- this._line = 0;
265
- },
266
- areaEnd: function() {
267
- this._line = NaN;
268
- },
269
- lineStart: function() {
270
- this._point = 0;
271
- },
272
- lineEnd: function() {
273
- (this._line || this._line !== 0 && this._point === 1) && this._context.closePath(), this._line = 1 - this._line;
274
- },
275
- point: function(u, e) {
276
- switch (u = +u, e = +e, this._point) {
277
- case 0:
278
- this._point = 1, this._line ? this._context.lineTo(u, e) : this._context.moveTo(u, e);
279
- break;
280
- case 1:
281
- this._point = 2;
282
- default:
283
- this._context.lineTo(u, e);
284
- break;
285
- }
286
- }
287
- };
288
- function me(u) {
289
- return new pe(u);
290
- }
291
- function ge(u) {
292
- return u[0];
293
- }
294
- function be(u) {
295
- return u[1];
296
- }
297
- function ke(u, e) {
298
- var t = v(!0), i = null, r = me, h = null, d = fe(l);
299
- u = typeof u == "function" ? u : u === void 0 ? ge : v(u), e = typeof e == "function" ? e : e === void 0 ? be : v(e);
300
- function l(c) {
301
- var n, a = (c = de(c)).length, s, o = !1, f;
302
- for (i == null && (h = r(f = d())), n = 0; n <= a; ++n)
303
- !(n < a && t(s = c[n], n, c)) === o && ((o = !o) ? h.lineStart() : h.lineEnd()), o && h.point(+u(s, n, c), +e(s, n, c));
304
- if (f) return h = null, f + "" || null;
305
- }
306
- return l.x = function(c) {
307
- return arguments.length ? (u = typeof c == "function" ? c : v(+c), l) : u;
308
- }, l.y = function(c) {
309
- return arguments.length ? (e = typeof c == "function" ? c : v(+c), l) : e;
310
- }, l.defined = function(c) {
311
- return arguments.length ? (t = typeof c == "function" ? c : v(!!c), l) : t;
312
- }, l.curve = function(c) {
313
- return arguments.length ? (r = c, i != null && (h = r(i)), l) : r;
314
- }, l.context = function(c) {
315
- return arguments.length ? (c == null ? i = h = null : h = r(i = c), l) : i;
316
- }, l;
317
- }
318
- function Ge(u, e, t) {
319
- var i = null, r = v(!0), h = null, d = me, l = null, c = fe(n);
320
- u = typeof u == "function" ? u : u === void 0 ? ge : v(+u), e = typeof e == "function" ? e : v(e === void 0 ? 0 : +e), t = typeof t == "function" ? t : t === void 0 ? be : v(+t);
321
- function n(s) {
322
- var o, f, p, m = (s = de(s)).length, b, k = !1, x, y = new Array(m), _ = new Array(m);
323
- for (h == null && (l = d(x = c())), o = 0; o <= m; ++o) {
324
- if (!(o < m && r(b = s[o], o, s)) === k)
325
- if (k = !k)
326
- f = o, l.areaStart(), l.lineStart();
327
- else {
328
- for (l.lineEnd(), l.lineStart(), p = o - 1; p >= f; --p)
329
- l.point(y[p], _[p]);
330
- l.lineEnd(), l.areaEnd();
331
- }
332
- k && (y[o] = +u(b, o, s), _[o] = +e(b, o, s), l.point(i ? +i(b, o, s) : y[o], t ? +t(b, o, s) : _[o]));
333
- }
334
- if (x) return l = null, x + "" || null;
335
- }
336
- function a() {
337
- return ke().defined(r).curve(d).context(h);
338
- }
339
- return n.x = function(s) {
340
- return arguments.length ? (u = typeof s == "function" ? s : v(+s), i = null, n) : u;
341
- }, n.x0 = function(s) {
342
- return arguments.length ? (u = typeof s == "function" ? s : v(+s), n) : u;
343
- }, n.x1 = function(s) {
344
- return arguments.length ? (i = s == null ? null : typeof s == "function" ? s : v(+s), n) : i;
345
- }, n.y = function(s) {
346
- return arguments.length ? (e = typeof s == "function" ? s : v(+s), t = null, n) : e;
347
- }, n.y0 = function(s) {
348
- return arguments.length ? (e = typeof s == "function" ? s : v(+s), n) : e;
349
- }, n.y1 = function(s) {
350
- return arguments.length ? (t = s == null ? null : typeof s == "function" ? s : v(+s), n) : t;
351
- }, n.lineX0 = n.lineY0 = function() {
352
- return a().x(u).y(e);
353
- }, n.lineY1 = function() {
354
- return a().x(u).y(t);
355
- }, n.lineX1 = function() {
356
- return a().x(i).y(e);
357
- }, n.defined = function(s) {
358
- return arguments.length ? (r = typeof s == "function" ? s : v(!!s), n) : r;
359
- }, n.curve = function(s) {
360
- return arguments.length ? (d = s, h != null && (l = d(h)), n) : d;
361
- }, n.context = function(s) {
362
- return arguments.length ? (s == null ? h = l = null : l = d(h = s), n) : h;
363
- }, n;
364
- }
365
- class I extends ue {
366
- constructor() {
367
- super(...arguments), Object.defineProperty(this, "_endIndex", {
368
- enumerable: !0,
369
- configurable: !0,
370
- writable: !0,
371
- value: void 0
372
- }), Object.defineProperty(this, "_strokeGenerator", {
373
- enumerable: !0,
374
- configurable: !0,
375
- writable: !0,
376
- value: ke()
377
- }), Object.defineProperty(this, "_fillGenerator", {
378
- enumerable: !0,
379
- configurable: !0,
380
- writable: !0,
381
- value: Ge()
382
- }), Object.defineProperty(this, "_legendStroke", {
383
- enumerable: !0,
384
- configurable: !0,
385
- writable: !0,
386
- value: void 0
387
- }), Object.defineProperty(this, "_legendFill", {
388
- enumerable: !0,
389
- configurable: !0,
390
- writable: !0,
391
- value: void 0
392
- }), Object.defineProperty(this, "strokes", {
393
- enumerable: !0,
394
- configurable: !0,
395
- writable: !0,
396
- value: this.addDisposer(new $(F.new({}), () => S._new(this._root, {
397
- themeTags: P(this.strokes.template.get("themeTags", []), ["line", "series", "stroke"])
398
- }, [this.strokes.template])))
399
- }), Object.defineProperty(this, "fills", {
400
- enumerable: !0,
401
- configurable: !0,
402
- writable: !0,
403
- value: this.addDisposer(new $(F.new({}), () => S._new(this._root, {
404
- themeTags: P(this.strokes.template.get("themeTags", []), ["line", "series", "fill"])
405
- }, [this.fills.template])))
406
- }), Object.defineProperty(this, "_fillTemplate", {
407
- enumerable: !0,
408
- configurable: !0,
409
- writable: !0,
410
- value: void 0
411
- }), Object.defineProperty(this, "_strokeTemplate", {
412
- enumerable: !0,
413
- configurable: !0,
414
- writable: !0,
415
- value: void 0
416
- }), Object.defineProperty(this, "_previousPoint", {
417
- enumerable: !0,
418
- configurable: !0,
419
- writable: !0,
420
- value: [0, 0, 0, 0]
421
- }), Object.defineProperty(this, "_dindex", {
422
- enumerable: !0,
423
- configurable: !0,
424
- writable: !0,
425
- value: 0
426
- }), Object.defineProperty(this, "_sindex", {
427
- enumerable: !0,
428
- configurable: !0,
429
- writable: !0,
430
- value: 0
431
- });
432
- }
433
- _afterNew() {
434
- this._fillGenerator.y0(function(e) {
435
- return e[3];
436
- }), this._fillGenerator.x0(function(e) {
437
- return e[2];
438
- }), this._fillGenerator.y1(function(e) {
439
- return e[1];
440
- }), this._fillGenerator.x1(function(e) {
441
- return e[0];
442
- }), super._afterNew();
443
- }
444
- /**
445
- * @ignore
446
- */
447
- makeStroke(e) {
448
- const t = this.mainContainer.children.push(e.make());
449
- return e.push(t), t;
450
- }
451
- /**
452
- * @ignore
453
- */
454
- makeFill(e) {
455
- const t = this.mainContainer.children.push(e.make());
456
- return e.push(t), t;
457
- }
458
- _updateChildren() {
459
- this._strokeTemplate = void 0, this._fillTemplate = void 0;
460
- let e = this.get("xAxis"), t = this.get("yAxis");
461
- if (this.isDirty("stroke")) {
462
- const i = this.get("stroke");
463
- this.strokes.template.set("stroke", i);
464
- const r = this._legendStroke;
465
- r && r.states.lookup("default").set("stroke", i);
466
- }
467
- if (this.isDirty("fill")) {
468
- const i = this.get("fill");
469
- this.fills.template.set("fill", i);
470
- const r = this._legendFill;
471
- r && r.states.lookup("default").set("fill", i);
472
- }
473
- if (this.isDirty("fillPattern")) {
474
- const i = this.get("fillPattern");
475
- this.fills.template.set("fillPattern", i);
476
- const r = this._legendFill;
477
- r && r.states.lookup("default").set("fillPattern", i);
478
- }
479
- if (this.isDirty("curveFactory")) {
480
- const i = this.get("curveFactory");
481
- i && (this._strokeGenerator.curve(i), this._fillGenerator.curve(i));
482
- }
483
- if (e.inited && t.inited) {
484
- if (this._axesDirty || this._valuesDirty || this._stackDirty || this.isDirty("vcx") || this.isDirty("vcy") || this._sizeDirty || this.isDirty("connect") || this.isDirty("curveFactory")) {
485
- this.fills.each((a) => {
486
- a.setPrivate("visible", !1);
487
- }), this.strokes.each((a) => {
488
- a.setPrivate("visible", !1);
489
- }), this.axisRanges.each((a) => {
490
- let s = a.fills;
491
- s && s.each((f) => {
492
- f.setPrivate("visible", !1);
493
- });
494
- let o = a.strokes;
495
- o && o.each((f) => {
496
- f.setPrivate("visible", !1);
497
- });
498
- });
499
- let i = this.startIndex(), r = this.strokes.template.get("templateField"), h = this.fills.template.get("templateField"), d = !0, l = !0;
500
- r && (d = !1), h && (l = !1);
501
- for (let a = i - 1; a >= 0; a--) {
502
- let s = this.dataItems[a], o = !0, f = s.dataContext;
503
- if (r && f[r] && (d = !0), h && f[h] && (l = !0), N(this._valueFields, (p) => {
504
- le(s.get(p)) || (o = !1);
505
- }), o && d && l) {
506
- i = a;
507
- break;
508
- }
509
- }
510
- let c = this.dataItems.length, n = this.endIndex();
511
- if (n < c) {
512
- n++;
513
- for (let a = n; a < c; a++) {
514
- let s = this.dataItems[a], o = !0;
515
- if (N(this._valueFields, (f) => {
516
- le(s.get(f)) || (o = !1);
517
- }), o) {
518
- n = a + 1;
519
- break;
520
- }
521
- }
522
- }
523
- if (i > 0 && i--, this._endIndex = n, this._clearGraphics(), this._sindex = 0, this._dindex = i, this.dataItems.length == 1)
524
- this._startSegment(0);
525
- else
526
- for (; this._dindex < n - 1; )
527
- this._startSegment(this._dindex), this._sindex++;
528
- }
529
- } else
530
- this._skipped = !0;
531
- super._updateChildren();
532
- }
533
- _clearGraphics() {
534
- this.strokes.clear(), this.fills.clear(), this.axisRanges.each((e) => {
535
- e.fills.clear(), e.strokes.clear();
536
- });
537
- }
538
- _startSegment(e) {
539
- let t = this._endIndex, i = t;
540
- const r = this.get("autoGapCount"), h = this.get("connect"), d = this.makeFill(this.fills), l = this._fillTemplate, c = this.fills.template;
541
- l && l != c && (d.template = l), d.setPrivate("visible", !0);
542
- const n = this.makeStroke(this.strokes), a = this._strokeTemplate;
543
- a && a != this.strokes.template && (n.template = a), n.setPrivate("visible", !0);
544
- let s = this.get("xAxis"), o = this.get("yAxis"), f = this.get("baseAxis"), p = this.get("vcx", 1), m = this.get("vcy", 1), b = this._xField, k = this._yField, x = this._xOpenField, y = this._yOpenField;
545
- const _ = this.get("openValueXField"), w = this.get("openValueYField");
546
- _ || (x = this._xField), w || (y = this._yField);
547
- const Y = this.get("stacked"), D = s.basePosition(), L = o.basePosition();
548
- let A;
549
- f === o ? A = this._yField : A = this._xField;
550
- const O = [];
551
- let X = [];
552
- O.push(X);
553
- const B = this.strokes.template.get("templateField"), Q = this.fills.template.get("templateField");
554
- let U = this.get("locationX", 0.5), J = this.get("locationY", 0.5), _e = this.get("openLocationX", U), ve = this.get("openLocationY", J);
555
- const xe = this.get("minDistance", 0);
556
- let T, K = this.fills.template.get("visible");
557
- this.axisRanges.length > 0 && (K = !0);
558
- let ee = !1;
559
- (Y || _ || w) && (ee = !0);
560
- const z = {
561
- points: X,
562
- segments: O,
563
- stacked: Y,
564
- getOpen: ee,
565
- basePosX: D,
566
- basePosY: L,
567
- fillVisible: K,
568
- xField: b,
569
- yField: k,
570
- xOpenField: x,
571
- yOpenField: y,
572
- vcx: p,
573
- vcy: m,
574
- baseAxis: f,
575
- xAxis: s,
576
- yAxis: o,
577
- locationX: U,
578
- locationY: J,
579
- openLocationX: _e,
580
- openLocationY: ve,
581
- minDistance: xe
582
- };
583
- let E = this._strokeTemplate, G = this._fillTemplate;
584
- for (T = e; T < i; T++) {
585
- this._dindex = T;
586
- const C = this._dataItems[T];
587
- let j = C.get(b), H = C.get(k);
588
- if (j == null || H == null ? h || (X = [], O.push(X), z.points = X) : this._getPoints(C, z), B) {
589
- let g = C.dataContext[B];
590
- if (g)
591
- if (g instanceof F || (g = F.new(g)), this._strokeTemplate = g, T > e) {
592
- i = T;
593
- break;
594
- } else
595
- E = g, n.template = g;
596
- }
597
- if (Q) {
598
- let g = C.dataContext[Q];
599
- if (g)
600
- if (g instanceof F || (g = F.new(g)), this._fillTemplate = g, T > e) {
601
- i = T;
602
- break;
603
- } else
604
- G = g, d.template = g;
605
- }
606
- if (!h) {
607
- let g = this.dataItems[T + 1];
608
- g && f.shouldGap(C, g, r, A) && (X = [], O.push(X), z.points = X);
609
- }
610
- }
611
- d.setRaw("userData", [e, T]), n.setRaw("userData", [e, T]), T === t && this._endLine(X, O[0][0]), n && this._drawStroke(n, O), d && this._drawFill(d, O), this.axisRanges.each((C) => {
612
- const j = C.container, H = C.fills, g = this.makeFill(H);
613
- j && j.children.push(g), g.setPrivate("visible", !0), this._drawFill(g, O);
614
- const ye = C.strokes, R = this.makeStroke(ye);
615
- j && j.children.push(R), E && E != this.strokes.template && (R.template = E), G && G != this.fills.template && (g.template = G), R.setPrivate("visible", !0), this._drawStroke(R, O), g.setRaw("userData", [e, T]), R.setRaw("userData", [e, T]);
616
- });
617
- }
618
- _getPoints(e, t) {
619
- let i = t.points, r = e.get("locationX", t.locationX), h = e.get("locationY", t.locationY);
620
- const d = this.get("exactLocationX", !1), l = this.get("exactLocationY", !1);
621
- let c = t.xAxis.getDataItemPositionX(e, t.xField, r, t.vcx, d), n = t.yAxis.getDataItemPositionY(e, t.yField, h, t.vcy, l);
622
- if (this._shouldInclude(c)) {
623
- const a = this.getPoint(c, n), s = [a.x, a.y];
624
- if (a.x += this._x, a.y += this._y, e.set("point", a), t.fillVisible) {
625
- let o = c, f = n;
626
- if (t.baseAxis === t.xAxis ? f = t.basePosY : t.baseAxis === t.yAxis && (o = t.basePosX), t.getOpen) {
627
- let m = e.get(t.xOpenField), b = e.get(t.yOpenField);
628
- if (m != null && b != null) {
629
- let k = e.get("openLocationX", t.openLocationX), x = e.get("openLocationY", t.openLocationY);
630
- if (t.stacked) {
631
- let y = e.get("stackToItemX"), _ = e.get("stackToItemY");
632
- y ? (o = t.xAxis.getDataItemPositionX(y, t.xField, k, y.component.get("vcx"), d), ne(o) && (o = t.basePosX)) : t.yAxis === t.baseAxis ? o = t.basePosX : o = t.xAxis.getDataItemPositionX(e, t.xOpenField, k, t.vcx, d), _ ? (f = t.yAxis.getDataItemPositionY(_, t.yField, x, _.component.get("vcy"), l), ne(f) && (f = t.basePosY)) : t.xAxis === t.baseAxis ? f = t.basePosY : f = t.yAxis.getDataItemPositionY(e, t.yOpenField, x, t.vcy, l);
633
- } else
634
- o = t.xAxis.getDataItemPositionX(e, t.xOpenField, k, t.vcx, d), f = t.yAxis.getDataItemPositionY(e, t.yOpenField, x, t.vcy, l);
635
- }
636
- }
637
- let p = this.getPoint(o, f);
638
- s[2] = p.x, s[3] = p.y;
639
- }
640
- if (t.minDistance > 0) {
641
- const o = s[0], f = s[1], p = s[2], m = s[3], b = this._previousPoint, k = b[0], x = b[1], y = b[2], _ = b[3];
642
- (Math.hypot(o - k, f - x) > t.minDistance || p && m && Math.hypot(p - y, m - _) > t.minDistance) && (i.push(s), this._previousPoint = s);
643
- } else
644
- i.push(s);
645
- }
646
- }
647
- _endLine(e, t) {
648
- }
649
- _drawStroke(e, t) {
650
- e.get("visible") && !e.get("forceHidden") && e.set("draw", (i) => {
651
- N(t, (r) => {
652
- this._strokeGenerator.context(i), this._strokeGenerator(r);
653
- });
654
- });
655
- }
656
- _drawFill(e, t) {
657
- e.get("visible") && !e.get("forceHidden") && e.set("draw", (i) => {
658
- N(t, (r) => {
659
- this._fillGenerator.context(i), this._fillGenerator(r);
660
- });
661
- });
662
- }
663
- _processAxisRange(e) {
664
- super._processAxisRange(e), e.fills = new $(F.new({}), () => S._new(this._root, {
665
- themeTags: P(e.fills.template.get("themeTags", []), ["line", "series", "fill"])
666
- }, [this.fills.template, e.fills.template])), e.strokes = new $(F.new({}), () => S._new(this._root, {
667
- themeTags: P(e.strokes.template.get("themeTags", []), ["line", "series", "stroke"])
668
- }, [this.strokes.template, e.strokes.template]));
669
- }
670
- /**
671
- * @ignore
672
- */
673
- createLegendMarker(e) {
674
- const t = this.get("legendDataItem");
675
- if (t) {
676
- const i = t.get("marker"), r = t.get("markerRectangle");
677
- r && r.setPrivate("visible", !1), i.set("background", Te.new(i._root, { fillOpacity: 0, fill: he(0) }));
678
- const h = i.children.push(S._new(i._root, {
679
- themeTags: ["line", "series", "legend", "marker", "stroke"],
680
- interactive: !1
681
- }, [this.strokes.template]));
682
- this._legendStroke = h;
683
- const d = i.children.push(S._new(i._root, {
684
- themeTags: ["line", "series", "legend", "marker", "fill"]
685
- }, [this.fills.template]));
686
- this._legendFill = d;
687
- const l = this._root.interfaceColors.get("disabled");
688
- if (h.states.create("disabled", { fill: l, stroke: l }), d.states.create("disabled", { fill: l, stroke: l }), this.bullets.length > 0) {
689
- const c = this.bullets.getIndex(0);
690
- if (c) {
691
- const n = c(i._root, this, new Pe(this, { legend: !0 }, {}));
692
- if (n) {
693
- const a = n.get("sprite");
694
- a instanceof S && a.states.create("disabled", { fill: l, stroke: l }), a && (a.setAll({
695
- tooltipText: void 0,
696
- tooltipHTML: void 0,
697
- focusable: void 0,
698
- focusableGroup: void 0,
699
- ariaLabel: void 0
700
- }), i.children.push(a), a.setAll({ x: i.width() / 2, y: i.height() / 2 }), i.events.on("boundschanged", () => {
701
- a.setAll({ x: i.width() / 2, y: i.height() / 2 });
702
- }));
703
- }
704
- }
1
+ import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
+ import { useHighlightLineChartLogic as g } from "./logic.js";
3
+ import { HighlightLineChartRoot as c } from "./styled.js";
4
+ function u(i) {
5
+ const {
6
+ chartDivRef: n,
7
+ seriesData: o,
8
+ chartId: r,
9
+ loading: t,
10
+ emptyMessage: s,
11
+ sx: l,
12
+ other: a,
13
+ ownerState: h
14
+ } = g(i);
15
+ return /* @__PURE__ */ d(c, { ownerState: h, sx: l, ...a, children: [
16
+ /* @__PURE__ */ e(
17
+ "div",
18
+ {
19
+ ref: n,
20
+ id: r,
21
+ style: { width: "100%", height: "100%" }
705
22
  }
706
- }
707
- }
708
- }
709
- Object.defineProperty(I, "className", {
710
- enumerable: !0,
711
- configurable: !0,
712
- writable: !0,
713
- value: "LineSeries"
714
- });
715
- Object.defineProperty(I, "classNames", {
716
- enumerable: !0,
717
- configurable: !0,
718
- writable: !0,
719
- value: ue.classNames.concat([I.className])
720
- });
721
- function ze({
722
- seriesData: u,
723
- height: e = "500px",
724
- width: t = "100%",
725
- chartId: i = "highlight-line-chart",
726
- showLegend: r = !0,
727
- loading: h = !1,
728
- emptyMessage: d = "No data available"
729
- }) {
730
- const l = ae(null), c = ae(null);
731
- return Me(() => {
732
- const n = Fe.new(i);
733
- c.current = n, n.setThemes([Le.new(n)]);
734
- const a = n.container.children.push(
735
- De.new(n, {
736
- panX: !0,
737
- panY: !0,
738
- wheelX: "panX",
739
- wheelY: "zoomX",
740
- pinchZoomX: !0
741
- })
742
- );
743
- l.current = a, a.set(
744
- "cursor",
745
- Ae.new(n, {
746
- behavior: "zoomX"
747
- })
748
- ).lineY.set("visible", !1);
749
- const s = a.xAxes.push(
750
- Ce.new(n, {
751
- maxDeviation: 0.3,
752
- baseInterval: { timeUnit: "day", count: 1 },
753
- renderer: Oe.new(n, {
754
- minorGridEnabled: !0
755
- })
756
- })
757
- ), o = a.yAxes.push(
758
- Xe.new(n, {
759
- renderer: $e.new(n, {})
760
- })
761
- ), f = [], p = Ye.new(n, {});
762
- u.forEach((w, Y) => {
763
- const D = w.color ? he(w.color) : p.getIndex(Y), L = a.series.push(
764
- I.new(n, {
765
- name: w.name,
766
- xAxis: s,
767
- yAxis: o,
768
- valueYField: "value",
769
- valueXField: "date",
770
- stroke: D,
771
- fill: D,
772
- tooltip: Se.new(n, {
773
- labelText: "{name}: {valueY}"
774
- })
775
- })
776
- );
777
- L.strokes.template.setAll({
778
- strokeWidth: 2
779
- }), L.data.setAll(w.data), f.push(L);
780
- });
781
- let m = null;
782
- r && (m = a.children.push(
783
- V.new(n, {
784
- centerX: re(50),
785
- x: re(50),
786
- layout: n.horizontalLayout
787
- })
788
- ), m.data.setAll(a.series.values));
789
- const b = 1, k = 0.2, x = 4, y = (w) => {
790
- var L;
791
- const D = (L = w.target.dataItem) == null ? void 0 : L.dataContext;
792
- D && (D.strokes.template.set("strokeOpacity", 1), D.strokes.template.set("strokeWidth", x), f.forEach((A) => {
793
- A !== D && (A.strokes.template.set("strokeOpacity", k), A.strokes.template.set("strokeWidth", 1));
794
- }));
795
- }, _ = (w) => {
796
- var L;
797
- ((L = w.target.dataItem) == null ? void 0 : L.dataContext) && f.forEach((A) => {
798
- A.strokes.template.set("strokeOpacity", b), A.strokes.template.set("strokeWidth", 2);
799
- });
800
- };
801
- return m && (m.markers.template.events.on("pointerover", y), m.markers.template.events.on("pointerout", _)), a.appear(1e3, 100), f.forEach((w, Y) => {
802
- w.appear(1e3, 100 * (Y + 1));
803
- }), () => {
804
- n.dispose();
805
- };
806
- }, [i, u, r]), /* @__PURE__ */ we("div", { style: { position: "relative", width: t, height: e }, children: [
807
- /* @__PURE__ */ W("div", { id: i, style: { width: "100%", height: "100%" } }),
808
- h && /* @__PURE__ */ W(
23
+ ),
24
+ t && /* @__PURE__ */ e(
809
25
  "div",
810
26
  {
811
27
  style: {
@@ -816,12 +32,13 @@ function ze({
816
32
  alignItems: "center",
817
33
  justifyContent: "center",
818
34
  fontSize: "1.2rem",
819
- color: "#555"
35
+ color: "#555",
36
+ zIndex: 10
820
37
  },
821
- children: "Yükleniyor..."
38
+ children: "Loading..."
822
39
  }
823
40
  ),
824
- !h && u.length === 0 && /* @__PURE__ */ W(
41
+ !t && o.length === 0 && /* @__PURE__ */ e(
825
42
  "div",
826
43
  {
827
44
  style: {
@@ -831,13 +48,14 @@ function ze({
831
48
  alignItems: "center",
832
49
  justifyContent: "center",
833
50
  color: "#999",
834
- fontSize: "1.1rem"
51
+ fontSize: "1.1rem",
52
+ zIndex: 10
835
53
  },
836
- children: d
54
+ children: s
837
55
  }
838
56
  )
839
57
  ] });
840
58
  }
841
59
  export {
842
- ze as HighlightLineChart
60
+ u as HighlightLineChart
843
61
  };