@hybridcore/ui 1.6.7 → 1.6.9
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/AnimatedTheme-BOKdw2Oy.js +7708 -0
- package/dist/{AxisRenderer-DTyLLA6c.js → AxisRenderer-lUbezuh7.js} +51 -49
- package/dist/{AxisRendererY-C_ItLPNV.js → AxisRendererY-DbSiyb45.js} +3 -3
- package/dist/{Bullet-DVczI2TD.js → Bullet-PgoNb3Jv.js} +1 -1
- package/dist/{Button-CcsPEIDh.js → Button-XBf4Mwz-.js} +3 -3
- package/dist/{CategoryAxis-CwnfaGc8.js → CategoryAxis-B8KQp1pE.js} +3 -3
- package/dist/{Circle-Cy5s-pVc.js → Circle-BWRdiMpG.js} +1 -1
- package/dist/ColorSet-DDmFoKtZ.js +77 -0
- package/dist/{ColumnSeries-CjgdJ2QL.js → ColumnSeries-rgnGm-Bg.js} +4 -4
- package/dist/{DataProcessor-CHDO51q4.js → DataProcessor-CvIe9BVn.js} +1 -1
- package/dist/{DateAxis-YX3QNIB-.js → DateAxis-zNtbSVjW.js} +8 -7
- package/dist/{ColorSet-C7vpNXhM.js → Entity-CCUIdRAr.js} +638 -712
- package/dist/{Hierarchy-Bihj0S61.js → Hierarchy-CCvGsF1A.js} +25 -23
- package/dist/{Legend-Dp_MKfS4.js → Legend-kbCFjJAW.js} +11 -10
- package/dist/{LineSeries-Uiv5o56b.js → LineSeries-BLFvwrLT.js} +13 -12
- package/dist/{LinearGradient-DiRq5YcI.js → LinearGradient-C7rnipF7.js} +11 -11
- package/dist/{PieSeries-B2fW3z0s.js → PieSeries-3iLRbqFv.js} +34 -32
- package/dist/{RoundedRectangle-CWLi2PXn.js → RoundedRectangle-CqMMmPM0.js} +4 -4
- package/dist/{Scrollbar-D86MJyr2.js → Scrollbar-BzSBcIUt.js} +4 -4
- package/dist/{Slice-B19rbYDZ.js → Slice-CS23iLiS.js} +2 -2
- package/dist/{Tick-2bcLyHpF.js → Tick-BADQ8QeT.js} +15 -15
- package/dist/Tooltip-A_HlttXp.js +3606 -0
- package/dist/{XYCursor-C8WktvKM.js → XYCursor-gHAo40xC.js} +3 -3
- package/dist/{ZoomableContainer-DYyqwaMb.js → ZoomableContainer-Brs1wHM1.js} +9 -9
- package/dist/components/charts/_common/tooltip.js +73 -0
- package/dist/components/charts/_common/utils.js +10 -9
- package/dist/components/charts/candlestick/logic.js +181 -156
- package/dist/components/charts/column-line-mix/logic.js +80 -77
- package/dist/components/charts/donut-chart/logic.js +36 -34
- package/dist/components/charts/drill-down-treemap/logic.js +49 -48
- package/dist/components/charts/drill-down-voronoi-treemap/logic.js +102 -101
- package/dist/components/charts/heatmap/logic.js +33 -32
- package/dist/components/charts/highlighting-line-data/logic.js +26 -24
- package/dist/components/charts/line/logic.js +123 -174
- package/dist/components/charts/logaritmic-scale/logic.js +69 -60
- package/dist/components/charts/multiple-value-axes/logic.js +93 -88
- package/dist/components/charts/nested-pie/logic.js +3 -3
- package/dist/components/charts/packed-circles/logic.js +28 -27
- package/dist/components/charts/pie-chart/logic.js +43 -41
- package/dist/components/charts/stacked-area-radar/logic.js +124 -121
- package/dist/components/charts/stacked-column-chart/logic.js +107 -95
- package/dist/components/charts/xy-chart/logic.js +103 -91
- package/dist/components/metric-card/MetricChart.js +29 -28
- package/dist/components/metric-card/index.js +1 -1
- package/dist/components/metric-card/logic.js +74 -67
- package/dist/components/metric-card/styled.js +55 -46
- package/package.json +1 -1
- package/dist/AnimatedTheme-jnasw6rT.js +0 -11305
|
@@ -0,0 +1,3606 @@
|
|
|
1
|
+
import { e as w, ai as mt, a7 as St, au as rt, av as yt, aw as Ot, f as m, r as H, a6 as Q, D as B, M as C, z as Ct, u as bt, k as lt, E as F, P as D, ac as vt, w as L, d as q, i as Dt, ax as at, _ as nt, ay as Lt, a9 as It, az as wt, Q as xt, C as ht, ad as Mt, t as Pt, aA as Bt, aB as kt, h as Wt, v as Nt, aC as Rt, b as Ft, a as At, m as Gt } from "./Entity-CCUIdRAr.js";
|
|
2
|
+
function z(n, t) {
|
|
3
|
+
if (!(n >= 0 && n < t))
|
|
4
|
+
throw new Error("Index out of bounds: " + n);
|
|
5
|
+
}
|
|
6
|
+
class Ht {
|
|
7
|
+
/**
|
|
8
|
+
* Constructor
|
|
9
|
+
*
|
|
10
|
+
* @param initial Inital list of values to add to list
|
|
11
|
+
*/
|
|
12
|
+
constructor(t = []) {
|
|
13
|
+
Object.defineProperty(this, "_values", {
|
|
14
|
+
enumerable: !0,
|
|
15
|
+
configurable: !0,
|
|
16
|
+
writable: !0,
|
|
17
|
+
value: void 0
|
|
18
|
+
}), Object.defineProperty(this, "events", {
|
|
19
|
+
enumerable: !0,
|
|
20
|
+
configurable: !0,
|
|
21
|
+
writable: !0,
|
|
22
|
+
value: new mt()
|
|
23
|
+
}), this._values = t;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* An array of values in the list.
|
|
27
|
+
*
|
|
28
|
+
* Do not use this property to add values. Rather use dedicated methods, like
|
|
29
|
+
* `push()`, `removeIndex()`, etc.
|
|
30
|
+
*
|
|
31
|
+
* @readonly
|
|
32
|
+
* @return List values
|
|
33
|
+
*/
|
|
34
|
+
get values() {
|
|
35
|
+
return this._values;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Checks if list contains specific item reference.
|
|
39
|
+
*
|
|
40
|
+
* @param item Item to search for
|
|
41
|
+
* @return `true` if found, `false` if not found
|
|
42
|
+
*/
|
|
43
|
+
contains(t) {
|
|
44
|
+
return this._values.indexOf(t) !== -1;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Removes specific item from the list.
|
|
48
|
+
*
|
|
49
|
+
* @param item An item to remove
|
|
50
|
+
*/
|
|
51
|
+
removeValue(t) {
|
|
52
|
+
let e = 0, i = this._values.length;
|
|
53
|
+
for (; e < i; )
|
|
54
|
+
this._values[e] === t ? (this.removeIndex(e), --i) : ++e;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Searches the list for specific item and returns its index.
|
|
58
|
+
*
|
|
59
|
+
* @param item An item to search for
|
|
60
|
+
* @return Index or -1 if not found
|
|
61
|
+
*/
|
|
62
|
+
indexOf(t) {
|
|
63
|
+
return St(this._values, t);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Number of items in list.
|
|
67
|
+
*
|
|
68
|
+
* @readonly
|
|
69
|
+
* @return Number of items
|
|
70
|
+
*/
|
|
71
|
+
get length() {
|
|
72
|
+
return this._values.length;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Checks if there's a value at specific index.
|
|
76
|
+
*
|
|
77
|
+
* @param index Index
|
|
78
|
+
* @return Value exists?
|
|
79
|
+
*/
|
|
80
|
+
hasIndex(t) {
|
|
81
|
+
return t >= 0 && t < this._values.length;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Returns an item at specified index.
|
|
85
|
+
*
|
|
86
|
+
* @param index Index
|
|
87
|
+
* @return List item
|
|
88
|
+
*/
|
|
89
|
+
getIndex(t) {
|
|
90
|
+
return this._values[t];
|
|
91
|
+
}
|
|
92
|
+
_onPush(t) {
|
|
93
|
+
this.events.isEnabled("push") && this.events.dispatch("push", {
|
|
94
|
+
type: "push",
|
|
95
|
+
target: this,
|
|
96
|
+
newValue: t
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
_onInsertIndex(t, e) {
|
|
100
|
+
this.events.isEnabled("insertIndex") && this.events.dispatch("insertIndex", {
|
|
101
|
+
type: "insertIndex",
|
|
102
|
+
target: this,
|
|
103
|
+
index: t,
|
|
104
|
+
newValue: e
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
_onSetIndex(t, e, i) {
|
|
108
|
+
this.events.isEnabled("setIndex") && this.events.dispatch("setIndex", {
|
|
109
|
+
type: "setIndex",
|
|
110
|
+
target: this,
|
|
111
|
+
index: t,
|
|
112
|
+
oldValue: e,
|
|
113
|
+
newValue: i
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
_onSwap(t, e) {
|
|
117
|
+
this.events.isEnabled("swap") && this.events.dispatch("swap", {
|
|
118
|
+
type: "swap",
|
|
119
|
+
target: this,
|
|
120
|
+
a: t,
|
|
121
|
+
b: e
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
_onRemoveIndex(t, e) {
|
|
125
|
+
this.events.isEnabled("removeIndex") && this.events.dispatch("removeIndex", {
|
|
126
|
+
type: "removeIndex",
|
|
127
|
+
target: this,
|
|
128
|
+
index: t,
|
|
129
|
+
oldValue: e
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
_onMoveIndex(t, e, i) {
|
|
133
|
+
this.events.isEnabled("moveIndex") && this.events.dispatch("moveIndex", {
|
|
134
|
+
type: "moveIndex",
|
|
135
|
+
target: this,
|
|
136
|
+
oldIndex: t,
|
|
137
|
+
newIndex: e,
|
|
138
|
+
value: i
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
_onClear(t) {
|
|
142
|
+
this.events.isEnabled("clear") && this.events.dispatch("clear", {
|
|
143
|
+
type: "clear",
|
|
144
|
+
target: this,
|
|
145
|
+
oldValues: t
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Sets value at specific index.
|
|
150
|
+
*
|
|
151
|
+
* If there's already a value at the index, it is overwritten.
|
|
152
|
+
*
|
|
153
|
+
* @param index Index
|
|
154
|
+
* @param value New value
|
|
155
|
+
* @return New value
|
|
156
|
+
*/
|
|
157
|
+
setIndex(t, e) {
|
|
158
|
+
z(t, this._values.length);
|
|
159
|
+
const i = this._values[t];
|
|
160
|
+
return i !== e && (this._values[t] = e, this._onSetIndex(t, i, e)), i;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Adds an item to the list at a specific index, which pushes all the other
|
|
164
|
+
* items further down the list.
|
|
165
|
+
*
|
|
166
|
+
* @param index Index
|
|
167
|
+
* @param item An item to add
|
|
168
|
+
*/
|
|
169
|
+
insertIndex(t, e) {
|
|
170
|
+
return z(t, this._values.length + 1), rt(this._values, t, e), this._onInsertIndex(t, e), e;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Swaps indexes of two items in the list.
|
|
174
|
+
*
|
|
175
|
+
* @param a Item 1
|
|
176
|
+
* @param b Item 2
|
|
177
|
+
*/
|
|
178
|
+
swap(t, e) {
|
|
179
|
+
const i = this._values.length;
|
|
180
|
+
if (z(t, i), z(e, i), t !== e) {
|
|
181
|
+
const s = this._values[t], r = this._values[e];
|
|
182
|
+
this._values[t] = r, this._values[e] = s, this._onSwap(s, r);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Removes a value at specific index.
|
|
187
|
+
*
|
|
188
|
+
* @param index Index of value to remove
|
|
189
|
+
* @return Removed value
|
|
190
|
+
*/
|
|
191
|
+
removeIndex(t) {
|
|
192
|
+
z(t, this._values.length);
|
|
193
|
+
const e = this._values[t];
|
|
194
|
+
return yt(this._values, t), this._onRemoveIndex(t, e), e;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Moves an item to a specific index within the list.
|
|
198
|
+
*
|
|
199
|
+
* If the index is not specified it will move the item to the end of the
|
|
200
|
+
* list.
|
|
201
|
+
*
|
|
202
|
+
* @param value Item to move
|
|
203
|
+
* @param index Index to place item at
|
|
204
|
+
*/
|
|
205
|
+
moveValue(t, e) {
|
|
206
|
+
let i = this.indexOf(t);
|
|
207
|
+
if (i !== -1)
|
|
208
|
+
if (yt(this._values, i), e == null) {
|
|
209
|
+
const s = this._values.length;
|
|
210
|
+
this._values.push(t), this._onMoveIndex(i, s, t);
|
|
211
|
+
} else
|
|
212
|
+
rt(this._values, e, t), this._onMoveIndex(i, e, t);
|
|
213
|
+
else e == null ? (this._values.push(t), this._onPush(t)) : (rt(this._values, e, t), this._onInsertIndex(e, t));
|
|
214
|
+
return t;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Adds an item to the end of the list.
|
|
218
|
+
*
|
|
219
|
+
* @param item An item to add
|
|
220
|
+
*/
|
|
221
|
+
push(t) {
|
|
222
|
+
return this._values.push(t), this._onPush(t), t;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Adds an item as a first item in the list.
|
|
226
|
+
*
|
|
227
|
+
* @param item An item to add
|
|
228
|
+
*/
|
|
229
|
+
unshift(t) {
|
|
230
|
+
return this.insertIndex(0, t), t;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Adds multiple items to the list.
|
|
234
|
+
*
|
|
235
|
+
* @param items An Array of items to add
|
|
236
|
+
*/
|
|
237
|
+
pushAll(t) {
|
|
238
|
+
w(t, (e) => {
|
|
239
|
+
this.push(e);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Copies and adds items from abother list.
|
|
244
|
+
*
|
|
245
|
+
* @param source A list top copy items from
|
|
246
|
+
*/
|
|
247
|
+
copyFrom(t) {
|
|
248
|
+
this.pushAll(t._values);
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Returns the last item from the list, and removes it.
|
|
252
|
+
*
|
|
253
|
+
* @return Item
|
|
254
|
+
*/
|
|
255
|
+
pop() {
|
|
256
|
+
return this._values.length - 1 < 0 ? void 0 : this.removeIndex(this._values.length - 1);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Returns the first item from the list, and removes it.
|
|
260
|
+
*
|
|
261
|
+
* @return Item
|
|
262
|
+
*/
|
|
263
|
+
shift() {
|
|
264
|
+
return this._values.length ? this.removeIndex(0) : void 0;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Sets multiple items to the list.
|
|
268
|
+
*
|
|
269
|
+
* All current items are removed.
|
|
270
|
+
*
|
|
271
|
+
* @param newArray New items
|
|
272
|
+
*/
|
|
273
|
+
setAll(t) {
|
|
274
|
+
const e = this._values;
|
|
275
|
+
this._values = [], this._onClear(e), w(t, (i) => {
|
|
276
|
+
this._values.push(i), this._onPush(i);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Removes all items from the list.
|
|
281
|
+
*/
|
|
282
|
+
clear() {
|
|
283
|
+
this.setAll([]);
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Returns an ES6 iterator for the list.
|
|
287
|
+
*/
|
|
288
|
+
*[Symbol.iterator]() {
|
|
289
|
+
const t = this._values.length;
|
|
290
|
+
for (let e = 0; e < t; ++e)
|
|
291
|
+
yield this._values[e];
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Calls `f` for each element in the list.
|
|
295
|
+
*
|
|
296
|
+
* `f` should have at least one parameter defined which will get a current
|
|
297
|
+
* item, with optional second argument - index.
|
|
298
|
+
*/
|
|
299
|
+
each(t) {
|
|
300
|
+
w(this._values, t);
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Calls `f` for each element in the list, from right to left.
|
|
304
|
+
*
|
|
305
|
+
* `f` should have at least one parameter defined which will get a current
|
|
306
|
+
* item, with optional second argument - index.
|
|
307
|
+
*/
|
|
308
|
+
eachReverse(t) {
|
|
309
|
+
Ot(this._values, t);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
class Vt extends Ht {
|
|
313
|
+
constructor() {
|
|
314
|
+
super(...arguments), Object.defineProperty(this, "autoDispose", {
|
|
315
|
+
enumerable: !0,
|
|
316
|
+
configurable: !0,
|
|
317
|
+
writable: !0,
|
|
318
|
+
value: !0
|
|
319
|
+
}), Object.defineProperty(this, "_disposed", {
|
|
320
|
+
enumerable: !0,
|
|
321
|
+
configurable: !0,
|
|
322
|
+
writable: !0,
|
|
323
|
+
value: !1
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Swaps indexes of two items in the list.
|
|
328
|
+
*
|
|
329
|
+
* @param a Item 1
|
|
330
|
+
* @param b Item 2
|
|
331
|
+
*/
|
|
332
|
+
swap(t, e) {
|
|
333
|
+
const i = this.autoDispose;
|
|
334
|
+
this.autoDispose = !1, super.swap(t, e), this.autoDispose = i;
|
|
335
|
+
}
|
|
336
|
+
_onSetIndex(t, e, i) {
|
|
337
|
+
this.autoDispose && e.dispose(), super._onSetIndex(t, e, i);
|
|
338
|
+
}
|
|
339
|
+
_onRemoveIndex(t, e) {
|
|
340
|
+
this.autoDispose && e.dispose(), super._onRemoveIndex(t, e);
|
|
341
|
+
}
|
|
342
|
+
_onClear(t) {
|
|
343
|
+
this.autoDispose && w(t, (e) => {
|
|
344
|
+
e.dispose();
|
|
345
|
+
}), super._onClear(t);
|
|
346
|
+
}
|
|
347
|
+
_dispose() {
|
|
348
|
+
this.autoDispose && w(this._values, (t) => {
|
|
349
|
+
t.dispose();
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
isDisposed() {
|
|
353
|
+
return this._disposed;
|
|
354
|
+
}
|
|
355
|
+
dispose() {
|
|
356
|
+
this._disposed || (this._disposed = !0, this._dispose());
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
class qt extends Vt {
|
|
360
|
+
constructor(t, e) {
|
|
361
|
+
super(), Object.defineProperty(this, "template", {
|
|
362
|
+
enumerable: !0,
|
|
363
|
+
configurable: !0,
|
|
364
|
+
writable: !0,
|
|
365
|
+
value: void 0
|
|
366
|
+
}), Object.defineProperty(this, "make", {
|
|
367
|
+
enumerable: !0,
|
|
368
|
+
configurable: !0,
|
|
369
|
+
writable: !0,
|
|
370
|
+
value: void 0
|
|
371
|
+
}), this.template = t, this.make = e;
|
|
372
|
+
}
|
|
373
|
+
_dispose() {
|
|
374
|
+
super._dispose(), this.autoDispose && this.template.dispose();
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
class zt extends Ht {
|
|
378
|
+
constructor(t) {
|
|
379
|
+
super(), Object.defineProperty(this, "_disposed", {
|
|
380
|
+
enumerable: !0,
|
|
381
|
+
configurable: !0,
|
|
382
|
+
writable: !0,
|
|
383
|
+
value: !1
|
|
384
|
+
}), Object.defineProperty(this, "_container", {
|
|
385
|
+
enumerable: !0,
|
|
386
|
+
configurable: !0,
|
|
387
|
+
writable: !0,
|
|
388
|
+
value: void 0
|
|
389
|
+
}), Object.defineProperty(this, "_events", {
|
|
390
|
+
enumerable: !0,
|
|
391
|
+
configurable: !0,
|
|
392
|
+
writable: !0,
|
|
393
|
+
value: void 0
|
|
394
|
+
}), this._container = t, this._events = this.events.onAll((e) => {
|
|
395
|
+
if (e.type === "clear")
|
|
396
|
+
w(e.oldValues, (i) => {
|
|
397
|
+
this._onRemoved(i);
|
|
398
|
+
});
|
|
399
|
+
else if (e.type === "push")
|
|
400
|
+
this._onInserted(e.newValue);
|
|
401
|
+
else if (e.type === "setIndex")
|
|
402
|
+
this._onRemoved(e.oldValue), this._onInserted(e.newValue, e.index);
|
|
403
|
+
else if (e.type === "insertIndex")
|
|
404
|
+
this._onInserted(e.newValue, e.index);
|
|
405
|
+
else if (e.type === "removeIndex")
|
|
406
|
+
this._onRemoved(e.oldValue);
|
|
407
|
+
else if (e.type === "moveIndex")
|
|
408
|
+
this._onRemoved(e.value), this._onInserted(e.value, e.newIndex);
|
|
409
|
+
else
|
|
410
|
+
throw new Error("Unknown IListEvent type");
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
_onInserted(t, e) {
|
|
414
|
+
t._setParent(this._container, !0);
|
|
415
|
+
const i = this._container._childrenDisplay;
|
|
416
|
+
e === void 0 ? i.addChild(t._display) : i.addChildAt(t._display, e);
|
|
417
|
+
}
|
|
418
|
+
_onRemoved(t) {
|
|
419
|
+
this._container._childrenDisplay.removeChild(t._display), this._container.markDirtyBounds(), this._container.markDirty();
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Returns `true` if obejct is disposed.
|
|
423
|
+
*/
|
|
424
|
+
isDisposed() {
|
|
425
|
+
return this._disposed;
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Permanently dispose this object.
|
|
429
|
+
*/
|
|
430
|
+
dispose() {
|
|
431
|
+
this._disposed || (this._disposed = !0, this._events.dispose(), w(this.values, (t) => {
|
|
432
|
+
t.dispose();
|
|
433
|
+
}));
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
const jt = Math.PI, Et = jt / 180, Qt = 180 / jt;
|
|
437
|
+
function Zt(n, t, e) {
|
|
438
|
+
if (!m(t) || t <= 0)
|
|
439
|
+
return Math.round(n);
|
|
440
|
+
{
|
|
441
|
+
let i = Math.pow(10, t);
|
|
442
|
+
return Math.round(n * i) / i;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
function te(n, t) {
|
|
446
|
+
if (!m(t) || t <= 0)
|
|
447
|
+
return Math.ceil(n);
|
|
448
|
+
{
|
|
449
|
+
let e = Math.pow(10, t);
|
|
450
|
+
return Math.ceil(n * e) / e;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
function T(n, t, e) {
|
|
454
|
+
return Math.min(Math.max(n, t), e);
|
|
455
|
+
}
|
|
456
|
+
function ut(n) {
|
|
457
|
+
return Math.sin(Et * n);
|
|
458
|
+
}
|
|
459
|
+
function dt(n) {
|
|
460
|
+
return Math.cos(Et * n);
|
|
461
|
+
}
|
|
462
|
+
function Tt(n) {
|
|
463
|
+
return n = n % 360, n < 0 && (n += 360), n;
|
|
464
|
+
}
|
|
465
|
+
function ee(n, t, e, i, s) {
|
|
466
|
+
let r = Number.MAX_VALUE, a = Number.MAX_VALUE, o = -Number.MAX_VALUE, l = -Number.MAX_VALUE, h = [];
|
|
467
|
+
h.push(ot(s, e)), h.push(ot(s, i));
|
|
468
|
+
let u = Math.min(Math.floor(e / 90) * 90, Math.floor(i / 90) * 90), f = Math.max(Math.ceil(e / 90) * 90, Math.ceil(i / 90) * 90);
|
|
469
|
+
for (let d = u; d <= f; d += 90)
|
|
470
|
+
d >= e && d <= i && h.push(ot(s, d));
|
|
471
|
+
for (let d = 0; d < h.length; d++) {
|
|
472
|
+
let p = h[d];
|
|
473
|
+
p.x < r && (r = p.x), p.y < a && (a = p.y), p.x > o && (o = p.x), p.y > l && (l = p.y);
|
|
474
|
+
}
|
|
475
|
+
return { left: n + r, top: t + a, right: n + o, bottom: t + l };
|
|
476
|
+
}
|
|
477
|
+
function ot(n, t) {
|
|
478
|
+
return { x: n * dt(t), y: n * ut(t) };
|
|
479
|
+
}
|
|
480
|
+
function ie(n) {
|
|
481
|
+
const t = n.length;
|
|
482
|
+
if (t > 0) {
|
|
483
|
+
let e = n[0], i = e.left, s = e.top, r = e.right, a = e.bottom;
|
|
484
|
+
if (t > 1)
|
|
485
|
+
for (let o = 1; o < t; o++)
|
|
486
|
+
e = n[o], i = Math.min(e.left, i), r = Math.max(e.right, r), s = Math.min(e.top, s), a = Math.max(e.bottom, a);
|
|
487
|
+
return { left: i, right: r, top: s, bottom: a };
|
|
488
|
+
}
|
|
489
|
+
return { left: 0, right: 0, top: 0, bottom: 0 };
|
|
490
|
+
}
|
|
491
|
+
function se(n, t, e) {
|
|
492
|
+
if (t > e) {
|
|
493
|
+
let a = t;
|
|
494
|
+
t = e, e = a;
|
|
495
|
+
}
|
|
496
|
+
n = Tt(n);
|
|
497
|
+
let i = (t - Tt(t)) / 360;
|
|
498
|
+
n < t && (n += 360 * (i + 1));
|
|
499
|
+
let s = t + (e - t) / 2 + 180, r = t + (e - t) / 2 - 180;
|
|
500
|
+
return n > e && (n - 360 > t ? n -= 360 : n < s ? n = e : n = t), n < t && (n > r ? n = t : n = e), n;
|
|
501
|
+
}
|
|
502
|
+
function Xt(n, t) {
|
|
503
|
+
return n.x >= t.left && n.y >= t.top && n.x <= t.right && n.y <= t.bottom;
|
|
504
|
+
}
|
|
505
|
+
function pt(n) {
|
|
506
|
+
H(n, (t, e) => {
|
|
507
|
+
bt(e) && typeof e.dispose == "function" && (e.enableDispose = !0, e.dispose());
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
class Yt {
|
|
511
|
+
constructor(t, e, i) {
|
|
512
|
+
Object.defineProperty(this, "_settings", {
|
|
513
|
+
enumerable: !0,
|
|
514
|
+
configurable: !0,
|
|
515
|
+
writable: !0,
|
|
516
|
+
value: void 0
|
|
517
|
+
}), Object.defineProperty(this, "_name", {
|
|
518
|
+
enumerable: !0,
|
|
519
|
+
configurable: !0,
|
|
520
|
+
writable: !0,
|
|
521
|
+
value: void 0
|
|
522
|
+
}), Object.defineProperty(this, "_template", {
|
|
523
|
+
enumerable: !0,
|
|
524
|
+
configurable: !0,
|
|
525
|
+
writable: !0,
|
|
526
|
+
value: void 0
|
|
527
|
+
}), this._name = t, this._template = e, this._settings = i;
|
|
528
|
+
}
|
|
529
|
+
_dispose() {
|
|
530
|
+
pt(this._settings);
|
|
531
|
+
}
|
|
532
|
+
get(t, e) {
|
|
533
|
+
const i = this._settings[t];
|
|
534
|
+
return i !== void 0 ? i : e;
|
|
535
|
+
}
|
|
536
|
+
set(t, e) {
|
|
537
|
+
this._settings[t] = e, this._template._stateChanged(this._name);
|
|
538
|
+
}
|
|
539
|
+
remove(t) {
|
|
540
|
+
delete this._settings[t], this._template._stateChanged(this._name);
|
|
541
|
+
}
|
|
542
|
+
setAll(t) {
|
|
543
|
+
lt(t).forEach((e) => {
|
|
544
|
+
this._settings[e] = t[e];
|
|
545
|
+
}), this._template._stateChanged(this._name);
|
|
546
|
+
}
|
|
547
|
+
_apply(t, e) {
|
|
548
|
+
H(this._settings, (i, s) => {
|
|
549
|
+
!e[i] && !t._userSettings[i] && (e[i] = !0, t.setRaw(i, s));
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
class Ut {
|
|
554
|
+
constructor(t) {
|
|
555
|
+
Object.defineProperty(this, "_template", {
|
|
556
|
+
enumerable: !0,
|
|
557
|
+
configurable: !0,
|
|
558
|
+
writable: !0,
|
|
559
|
+
value: void 0
|
|
560
|
+
}), Object.defineProperty(this, "_states", {
|
|
561
|
+
enumerable: !0,
|
|
562
|
+
configurable: !0,
|
|
563
|
+
writable: !0,
|
|
564
|
+
value: {}
|
|
565
|
+
}), this._template = t;
|
|
566
|
+
}
|
|
567
|
+
_dispose() {
|
|
568
|
+
H(this._states, (t, e) => {
|
|
569
|
+
e._dispose();
|
|
570
|
+
});
|
|
571
|
+
}
|
|
572
|
+
lookup(t) {
|
|
573
|
+
return this._states[t];
|
|
574
|
+
}
|
|
575
|
+
create(t, e) {
|
|
576
|
+
const i = this._states[t];
|
|
577
|
+
if (i)
|
|
578
|
+
return i.setAll(e), i;
|
|
579
|
+
{
|
|
580
|
+
const s = new Yt(t, this._template, e);
|
|
581
|
+
return this._states[t] = s, this._template._stateChanged(t), s;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
remove(t) {
|
|
585
|
+
delete this._states[t], this._template._stateChanged(t);
|
|
586
|
+
}
|
|
587
|
+
_apply(t, e) {
|
|
588
|
+
H(this._states, (i, s) => {
|
|
589
|
+
let r = e.states[i];
|
|
590
|
+
r == null && (r = e.states[i] = {});
|
|
591
|
+
const a = t.states.create(i, {});
|
|
592
|
+
s._apply(a, r);
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
class Kt {
|
|
597
|
+
constructor() {
|
|
598
|
+
Object.defineProperty(this, "_callbacks", {
|
|
599
|
+
enumerable: !0,
|
|
600
|
+
configurable: !0,
|
|
601
|
+
writable: !0,
|
|
602
|
+
value: {}
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
add(t, e) {
|
|
606
|
+
let i = this._callbacks[t];
|
|
607
|
+
return i === void 0 && (i = this._callbacks[t] = []), i.push(e), new Q(() => {
|
|
608
|
+
B(i, e), i.length === 0 && delete this._callbacks[t];
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
remove(t) {
|
|
612
|
+
this._callbacks[t] !== void 0 && delete this._callbacks[t];
|
|
613
|
+
}
|
|
614
|
+
_apply(t) {
|
|
615
|
+
const e = [];
|
|
616
|
+
return H(this._callbacks, (i, s) => {
|
|
617
|
+
w(s, (r) => {
|
|
618
|
+
e.push(t.adapters.add(i, r));
|
|
619
|
+
});
|
|
620
|
+
}), new C(e);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
class Z {
|
|
624
|
+
constructor(t, e) {
|
|
625
|
+
if (Object.defineProperty(this, "_disposed", {
|
|
626
|
+
enumerable: !0,
|
|
627
|
+
configurable: !0,
|
|
628
|
+
writable: !0,
|
|
629
|
+
value: !1
|
|
630
|
+
}), Object.defineProperty(this, "_settings", {
|
|
631
|
+
enumerable: !0,
|
|
632
|
+
configurable: !0,
|
|
633
|
+
writable: !0,
|
|
634
|
+
value: void 0
|
|
635
|
+
}), Object.defineProperty(this, "_privateSettings", {
|
|
636
|
+
enumerable: !0,
|
|
637
|
+
configurable: !0,
|
|
638
|
+
writable: !0,
|
|
639
|
+
value: {}
|
|
640
|
+
}), Object.defineProperty(this, "_settingEvents", {
|
|
641
|
+
enumerable: !0,
|
|
642
|
+
configurable: !0,
|
|
643
|
+
writable: !0,
|
|
644
|
+
value: {}
|
|
645
|
+
}), Object.defineProperty(this, "_privateSettingEvents", {
|
|
646
|
+
enumerable: !0,
|
|
647
|
+
configurable: !0,
|
|
648
|
+
writable: !0,
|
|
649
|
+
value: {}
|
|
650
|
+
}), Object.defineProperty(this, "_entities", {
|
|
651
|
+
enumerable: !0,
|
|
652
|
+
configurable: !0,
|
|
653
|
+
writable: !0,
|
|
654
|
+
value: []
|
|
655
|
+
}), Object.defineProperty(this, "states", {
|
|
656
|
+
enumerable: !0,
|
|
657
|
+
configurable: !0,
|
|
658
|
+
writable: !0,
|
|
659
|
+
value: new Ut(this)
|
|
660
|
+
}), Object.defineProperty(this, "adapters", {
|
|
661
|
+
enumerable: !0,
|
|
662
|
+
configurable: !0,
|
|
663
|
+
writable: !0,
|
|
664
|
+
value: new Kt()
|
|
665
|
+
}), Object.defineProperty(this, "events", {
|
|
666
|
+
enumerable: !0,
|
|
667
|
+
configurable: !0,
|
|
668
|
+
writable: !0,
|
|
669
|
+
value: new mt()
|
|
670
|
+
}), Object.defineProperty(this, "setup", {
|
|
671
|
+
enumerable: !0,
|
|
672
|
+
configurable: !0,
|
|
673
|
+
writable: !0,
|
|
674
|
+
value: void 0
|
|
675
|
+
}), !e)
|
|
676
|
+
throw new Error("You cannot use `new Class()`, instead use `Class.new()`");
|
|
677
|
+
this._settings = t;
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Use this method to create an instance of this class.
|
|
681
|
+
*
|
|
682
|
+
* @see {@link https://www.amcharts.com/docs/v5/getting-started/#New_element_syntax} for more info
|
|
683
|
+
* @param root Root element
|
|
684
|
+
* @param settings Settings
|
|
685
|
+
* @param template Template
|
|
686
|
+
* @return Instantiated object
|
|
687
|
+
*/
|
|
688
|
+
static new(t) {
|
|
689
|
+
return new Z(t, !0);
|
|
690
|
+
}
|
|
691
|
+
_dispose() {
|
|
692
|
+
pt(this._settings), pt(this._privateSettings);
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Returns `true` if this element is disposed.
|
|
696
|
+
*
|
|
697
|
+
* @return Disposed
|
|
698
|
+
*/
|
|
699
|
+
isDisposed() {
|
|
700
|
+
return this._disposed;
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Disposes this object.
|
|
704
|
+
*/
|
|
705
|
+
dispose() {
|
|
706
|
+
this._disposed || (this._disposed = !0, this._dispose());
|
|
707
|
+
}
|
|
708
|
+
_checkDisposed() {
|
|
709
|
+
if (this._disposed)
|
|
710
|
+
throw new Error("Template is disposed");
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Array of all entities using this template.
|
|
714
|
+
*/
|
|
715
|
+
get entities() {
|
|
716
|
+
return this._entities;
|
|
717
|
+
}
|
|
718
|
+
get(t, e) {
|
|
719
|
+
this._checkDisposed();
|
|
720
|
+
const i = this._settings[t];
|
|
721
|
+
return i !== void 0 ? i : e;
|
|
722
|
+
}
|
|
723
|
+
setRaw(t, e) {
|
|
724
|
+
this._checkDisposed(), this._settings[t] = e;
|
|
725
|
+
}
|
|
726
|
+
set(t, e) {
|
|
727
|
+
this._checkDisposed(), this._settings[t] !== e && (this.setRaw(t, e), this._entities.forEach((i) => {
|
|
728
|
+
i._setTemplateProperty(this, t, e);
|
|
729
|
+
}));
|
|
730
|
+
}
|
|
731
|
+
remove(t) {
|
|
732
|
+
this._checkDisposed(), t in this._settings && (delete this._settings[t], this._entities.forEach((e) => {
|
|
733
|
+
e._removeTemplateProperty(t);
|
|
734
|
+
}));
|
|
735
|
+
}
|
|
736
|
+
removeAll() {
|
|
737
|
+
this._checkDisposed(), H(this._settings, (t, e) => {
|
|
738
|
+
this.remove(t);
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
getPrivate(t, e) {
|
|
742
|
+
this._checkDisposed();
|
|
743
|
+
const i = this._privateSettings[t];
|
|
744
|
+
return i !== void 0 ? i : e;
|
|
745
|
+
}
|
|
746
|
+
setPrivateRaw(t, e) {
|
|
747
|
+
return this._checkDisposed(), this._privateSettings[t] = e, e;
|
|
748
|
+
}
|
|
749
|
+
setPrivate(t, e) {
|
|
750
|
+
return this._checkDisposed(), this._privateSettings[t] !== e && (this.setPrivateRaw(t, e), this._entities.forEach((i) => {
|
|
751
|
+
i._setTemplatePrivateProperty(this, t, e);
|
|
752
|
+
})), e;
|
|
753
|
+
}
|
|
754
|
+
removePrivate(t) {
|
|
755
|
+
this._checkDisposed(), t in this._privateSettings && (delete this._privateSettings[t], this._entities.forEach((e) => {
|
|
756
|
+
e._removeTemplatePrivateProperty(t);
|
|
757
|
+
}));
|
|
758
|
+
}
|
|
759
|
+
setAll(t) {
|
|
760
|
+
this._checkDisposed(), H(t, (e, i) => {
|
|
761
|
+
this.set(e, i);
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
// TODO code duplication with Properties
|
|
765
|
+
on(t, e) {
|
|
766
|
+
this._checkDisposed();
|
|
767
|
+
let i = this._settingEvents[t];
|
|
768
|
+
return i === void 0 && (i = this._settingEvents[t] = []), i.push(e), new Q(() => {
|
|
769
|
+
B(i, e), i.length === 0 && delete this._settingEvents[t];
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
// TODO code duplication with Properties
|
|
773
|
+
onPrivate(t, e) {
|
|
774
|
+
this._checkDisposed();
|
|
775
|
+
let i = this._privateSettingEvents[t];
|
|
776
|
+
return i === void 0 && (i = this._privateSettingEvents[t] = []), i.push(e), new Q(() => {
|
|
777
|
+
B(i, e), i.length === 0 && delete this._privateSettingEvents[t];
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
_apply(t, e) {
|
|
781
|
+
this._checkDisposed();
|
|
782
|
+
const i = [];
|
|
783
|
+
return H(this._settingEvents, (s, r) => {
|
|
784
|
+
w(r, (a) => {
|
|
785
|
+
i.push(t.on(s, a));
|
|
786
|
+
});
|
|
787
|
+
}), H(this._privateSettingEvents, (s, r) => {
|
|
788
|
+
w(r, (a) => {
|
|
789
|
+
i.push(t.onPrivate(s, a));
|
|
790
|
+
});
|
|
791
|
+
}), this.states._apply(t, e), i.push(this.adapters._apply(t)), i.push(t.events.copyFrom(this.events)), new C(i);
|
|
792
|
+
}
|
|
793
|
+
_setObjectTemplate(t) {
|
|
794
|
+
this._checkDisposed(), this._entities.push(t);
|
|
795
|
+
}
|
|
796
|
+
_removeObjectTemplate(t) {
|
|
797
|
+
Ct(this._entities, t);
|
|
798
|
+
}
|
|
799
|
+
_stateChanged(t) {
|
|
800
|
+
this._checkDisposed(), this._entities.forEach((e) => {
|
|
801
|
+
e._applyStateByKey(t);
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
class st extends mt {
|
|
806
|
+
constructor(t) {
|
|
807
|
+
super(), Object.defineProperty(this, "_sprite", {
|
|
808
|
+
enumerable: !0,
|
|
809
|
+
configurable: !0,
|
|
810
|
+
writable: !0,
|
|
811
|
+
value: void 0
|
|
812
|
+
}), Object.defineProperty(this, "_rendererDisposers", {
|
|
813
|
+
enumerable: !0,
|
|
814
|
+
configurable: !0,
|
|
815
|
+
writable: !0,
|
|
816
|
+
value: {}
|
|
817
|
+
}), Object.defineProperty(this, "_dispatchParents", {
|
|
818
|
+
enumerable: !0,
|
|
819
|
+
configurable: !0,
|
|
820
|
+
writable: !0,
|
|
821
|
+
value: !0
|
|
822
|
+
}), this._sprite = t;
|
|
823
|
+
}
|
|
824
|
+
_makePointerEvent(t, e) {
|
|
825
|
+
return {
|
|
826
|
+
type: t,
|
|
827
|
+
originalEvent: e.event,
|
|
828
|
+
point: e.point,
|
|
829
|
+
simulated: e.simulated,
|
|
830
|
+
native: e.native,
|
|
831
|
+
target: this._sprite
|
|
832
|
+
};
|
|
833
|
+
}
|
|
834
|
+
_onRenderer(t, e) {
|
|
835
|
+
this._sprite.set("interactive", !0), this._sprite._display.interactive = !0;
|
|
836
|
+
let i = this._rendererDisposers[t];
|
|
837
|
+
if (i === void 0) {
|
|
838
|
+
const s = this._sprite._display.on(t, (r) => {
|
|
839
|
+
e.call(this, r);
|
|
840
|
+
});
|
|
841
|
+
i = this._rendererDisposers[t] = new It(() => {
|
|
842
|
+
delete this._rendererDisposers[t], s.dispose();
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
return i.increment();
|
|
846
|
+
}
|
|
847
|
+
_on(t, e, i, s, r, a, o) {
|
|
848
|
+
const l = super._on(t, e, i, s, r, a, o), h = st.RENDERER_EVENTS[e];
|
|
849
|
+
return h !== void 0 && (l.disposer = new C([
|
|
850
|
+
l.disposer,
|
|
851
|
+
this._onRenderer(e, h)
|
|
852
|
+
])), l;
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* Will stop any bubbling up of the event to element's parents.
|
|
856
|
+
*
|
|
857
|
+
* Should be called in an event handler, e.g.:
|
|
858
|
+
*
|
|
859
|
+
* ```TypeScript
|
|
860
|
+
* element.events.on("pointerdown", function(ev) {
|
|
861
|
+
* // Do something here and prevent from "pointerdown" bubbling up
|
|
862
|
+
* // ...
|
|
863
|
+
* ev.target.events.stopParentDispatch();
|
|
864
|
+
* });
|
|
865
|
+
* ```
|
|
866
|
+
* ```JavaScript
|
|
867
|
+
* element.events.on("pointerdown", function(ev) {
|
|
868
|
+
* // Do something here and prevent from "pointerdown" bubbling up
|
|
869
|
+
* // ...
|
|
870
|
+
* ev.target.events.stopParentDispatch();
|
|
871
|
+
* });
|
|
872
|
+
* ```
|
|
873
|
+
*/
|
|
874
|
+
stopParentDispatch() {
|
|
875
|
+
this._dispatchParents = !1;
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* @ignore
|
|
879
|
+
*/
|
|
880
|
+
dispatchParents(t, e) {
|
|
881
|
+
const i = this._dispatchParents;
|
|
882
|
+
this._dispatchParents = !0;
|
|
883
|
+
try {
|
|
884
|
+
this.dispatch(t, e), this._dispatchParents && this._sprite.parent && this._sprite.parent.events.dispatchParents(t, e);
|
|
885
|
+
} finally {
|
|
886
|
+
this._dispatchParents = i;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
Object.defineProperty(st, "RENDERER_EVENTS", {
|
|
891
|
+
enumerable: !0,
|
|
892
|
+
configurable: !0,
|
|
893
|
+
writable: !0,
|
|
894
|
+
value: {
|
|
895
|
+
click: function(n) {
|
|
896
|
+
this.isEnabled("click") && !this._sprite.isDragging() && this._sprite._hasDown() && !this._sprite._hasMoved(this._makePointerEvent("click", n)) && this.dispatch("click", this._makePointerEvent("click", n));
|
|
897
|
+
},
|
|
898
|
+
rightclick: function(n) {
|
|
899
|
+
this.isEnabled("rightclick") && this.dispatch("rightclick", this._makePointerEvent("rightclick", n));
|
|
900
|
+
},
|
|
901
|
+
middleclick: function(n) {
|
|
902
|
+
this.isEnabled("middleclick") && this.dispatch("middleclick", this._makePointerEvent("middleclick", n));
|
|
903
|
+
},
|
|
904
|
+
dblclick: function(n) {
|
|
905
|
+
this.dispatchParents("dblclick", this._makePointerEvent("dblclick", n));
|
|
906
|
+
},
|
|
907
|
+
pointerover: function(n) {
|
|
908
|
+
const t = this._sprite;
|
|
909
|
+
let e = !0;
|
|
910
|
+
if (t.getPrivate("trustBounds")) {
|
|
911
|
+
t._getBounds();
|
|
912
|
+
const i = t.globalBounds();
|
|
913
|
+
if (t.isType("Graphics")) {
|
|
914
|
+
const s = t.get("strokeWidth", 1) / 2;
|
|
915
|
+
s >= 1 && (i.left -= s, i.right += s, i.top -= s, i.bottom += s);
|
|
916
|
+
}
|
|
917
|
+
Xt(n.point, i) || (e = !1, t._root._renderer.removeHovering(t._display));
|
|
918
|
+
}
|
|
919
|
+
e && this.isEnabled("pointerover") && this.dispatch("pointerover", this._makePointerEvent("pointerover", n));
|
|
920
|
+
},
|
|
921
|
+
pointerout: function(n) {
|
|
922
|
+
this.isEnabled("pointerout") && this.dispatch("pointerout", this._makePointerEvent("pointerout", n));
|
|
923
|
+
},
|
|
924
|
+
pointerdown: function(n) {
|
|
925
|
+
this.dispatchParents("pointerdown", this._makePointerEvent("pointerdown", n));
|
|
926
|
+
},
|
|
927
|
+
pointerup: function(n) {
|
|
928
|
+
this.isEnabled("pointerup") && this.dispatch("pointerup", this._makePointerEvent("pointerup", n));
|
|
929
|
+
},
|
|
930
|
+
globalpointerup: function(n) {
|
|
931
|
+
this.isEnabled("globalpointerup") && this.dispatch("globalpointerup", this._makePointerEvent("globalpointerup", n));
|
|
932
|
+
},
|
|
933
|
+
globalpointermove: function(n) {
|
|
934
|
+
this.isEnabled("globalpointermove") && this.dispatch("globalpointermove", this._makePointerEvent("globalpointermove", n));
|
|
935
|
+
},
|
|
936
|
+
wheel: function(n) {
|
|
937
|
+
this.dispatchParents("wheel", {
|
|
938
|
+
type: "wheel",
|
|
939
|
+
target: this._sprite,
|
|
940
|
+
originalEvent: n.event,
|
|
941
|
+
point: n.point
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
class O extends F {
|
|
947
|
+
constructor() {
|
|
948
|
+
super(...arguments), Object.defineProperty(this, "_adjustedLocalBounds", {
|
|
949
|
+
enumerable: !0,
|
|
950
|
+
configurable: !0,
|
|
951
|
+
writable: !0,
|
|
952
|
+
value: { left: 0, right: 0, top: 0, bottom: 0 }
|
|
953
|
+
}), Object.defineProperty(this, "_localBounds", {
|
|
954
|
+
enumerable: !0,
|
|
955
|
+
configurable: !0,
|
|
956
|
+
writable: !0,
|
|
957
|
+
value: { left: 0, right: 0, top: 0, bottom: 0 }
|
|
958
|
+
}), Object.defineProperty(this, "_parent", {
|
|
959
|
+
enumerable: !0,
|
|
960
|
+
configurable: !0,
|
|
961
|
+
writable: !0,
|
|
962
|
+
value: void 0
|
|
963
|
+
}), Object.defineProperty(this, "_dataItem", {
|
|
964
|
+
enumerable: !0,
|
|
965
|
+
configurable: !0,
|
|
966
|
+
writable: !0,
|
|
967
|
+
value: void 0
|
|
968
|
+
}), Object.defineProperty(this, "_templateField", {
|
|
969
|
+
enumerable: !0,
|
|
970
|
+
configurable: !0,
|
|
971
|
+
writable: !0,
|
|
972
|
+
value: void 0
|
|
973
|
+
}), Object.defineProperty(this, "_sizeDirty", {
|
|
974
|
+
enumerable: !0,
|
|
975
|
+
configurable: !0,
|
|
976
|
+
writable: !0,
|
|
977
|
+
value: !1
|
|
978
|
+
}), Object.defineProperty(this, "_isDragging", {
|
|
979
|
+
enumerable: !0,
|
|
980
|
+
configurable: !0,
|
|
981
|
+
writable: !0,
|
|
982
|
+
value: !1
|
|
983
|
+
}), Object.defineProperty(this, "_dragEvent", {
|
|
984
|
+
enumerable: !0,
|
|
985
|
+
configurable: !0,
|
|
986
|
+
writable: !0,
|
|
987
|
+
value: void 0
|
|
988
|
+
}), Object.defineProperty(this, "_dragPoint", {
|
|
989
|
+
enumerable: !0,
|
|
990
|
+
configurable: !0,
|
|
991
|
+
writable: !0,
|
|
992
|
+
value: void 0
|
|
993
|
+
}), Object.defineProperty(this, "_isHidden", {
|
|
994
|
+
enumerable: !0,
|
|
995
|
+
configurable: !0,
|
|
996
|
+
writable: !0,
|
|
997
|
+
value: !1
|
|
998
|
+
}), Object.defineProperty(this, "_isShowing", {
|
|
999
|
+
enumerable: !0,
|
|
1000
|
+
configurable: !0,
|
|
1001
|
+
writable: !0,
|
|
1002
|
+
value: !1
|
|
1003
|
+
}), Object.defineProperty(this, "_isHiding", {
|
|
1004
|
+
enumerable: !0,
|
|
1005
|
+
configurable: !0,
|
|
1006
|
+
writable: !0,
|
|
1007
|
+
value: !1
|
|
1008
|
+
}), Object.defineProperty(this, "_isDown", {
|
|
1009
|
+
enumerable: !0,
|
|
1010
|
+
configurable: !0,
|
|
1011
|
+
writable: !0,
|
|
1012
|
+
value: !1
|
|
1013
|
+
}), Object.defineProperty(this, "_downPoint", {
|
|
1014
|
+
enumerable: !0,
|
|
1015
|
+
configurable: !0,
|
|
1016
|
+
writable: !0,
|
|
1017
|
+
value: void 0
|
|
1018
|
+
}), Object.defineProperty(this, "_downPoints", {
|
|
1019
|
+
enumerable: !0,
|
|
1020
|
+
configurable: !0,
|
|
1021
|
+
writable: !0,
|
|
1022
|
+
value: {}
|
|
1023
|
+
}), Object.defineProperty(this, "_toggleDp", {
|
|
1024
|
+
enumerable: !0,
|
|
1025
|
+
configurable: !0,
|
|
1026
|
+
writable: !0,
|
|
1027
|
+
value: void 0
|
|
1028
|
+
}), Object.defineProperty(this, "_dragDp", {
|
|
1029
|
+
enumerable: !0,
|
|
1030
|
+
configurable: !0,
|
|
1031
|
+
writable: !0,
|
|
1032
|
+
value: void 0
|
|
1033
|
+
}), Object.defineProperty(this, "_tooltipDp", {
|
|
1034
|
+
enumerable: !0,
|
|
1035
|
+
configurable: !0,
|
|
1036
|
+
writable: !0,
|
|
1037
|
+
value: void 0
|
|
1038
|
+
}), Object.defineProperty(this, "_hoverDp", {
|
|
1039
|
+
enumerable: !0,
|
|
1040
|
+
configurable: !0,
|
|
1041
|
+
writable: !0,
|
|
1042
|
+
value: void 0
|
|
1043
|
+
}), Object.defineProperty(this, "_focusDp", {
|
|
1044
|
+
enumerable: !0,
|
|
1045
|
+
configurable: !0,
|
|
1046
|
+
writable: !0,
|
|
1047
|
+
value: void 0
|
|
1048
|
+
}), Object.defineProperty(this, "_tooltipMoveDp", {
|
|
1049
|
+
enumerable: !0,
|
|
1050
|
+
configurable: !0,
|
|
1051
|
+
writable: !0,
|
|
1052
|
+
value: void 0
|
|
1053
|
+
}), Object.defineProperty(this, "_tooltipPointerDp", {
|
|
1054
|
+
enumerable: !0,
|
|
1055
|
+
configurable: !0,
|
|
1056
|
+
writable: !0,
|
|
1057
|
+
value: void 0
|
|
1058
|
+
}), Object.defineProperty(this, "_virtualParent", {
|
|
1059
|
+
enumerable: !0,
|
|
1060
|
+
configurable: !0,
|
|
1061
|
+
writable: !0,
|
|
1062
|
+
value: void 0
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
_afterNew() {
|
|
1066
|
+
this.setPrivateRaw("visible", !0), super._afterNew();
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Marks some setting as dirty. Could be used to trigger adapter.
|
|
1070
|
+
* @param key
|
|
1071
|
+
*/
|
|
1072
|
+
markDirtyKey(t) {
|
|
1073
|
+
this._markDirtyKey(t);
|
|
1074
|
+
}
|
|
1075
|
+
_markDirtyKey(t) {
|
|
1076
|
+
super._markDirtyKey(t), (t == "x" || t == "y" || t == "dx" || t == "dy") && (this.markDirtyBounds(), this._addPercentagePositionChildren(), this.markDirtyPosition());
|
|
1077
|
+
}
|
|
1078
|
+
_markDirtyPrivateKey(t) {
|
|
1079
|
+
super._markDirtyPrivateKey(t), (t == "x" || t == "y") && this.markDirtyPosition();
|
|
1080
|
+
}
|
|
1081
|
+
_removeTemplateField() {
|
|
1082
|
+
this._templateField && this._templateField._removeObjectTemplate(this);
|
|
1083
|
+
}
|
|
1084
|
+
_createEvents() {
|
|
1085
|
+
return new st(this);
|
|
1086
|
+
}
|
|
1087
|
+
_processTemplateField() {
|
|
1088
|
+
let t;
|
|
1089
|
+
const e = this.get("templateField");
|
|
1090
|
+
if (e) {
|
|
1091
|
+
const i = this.dataItem;
|
|
1092
|
+
if (i) {
|
|
1093
|
+
const s = i.dataContext;
|
|
1094
|
+
s && (t = s[e], !(t instanceof Z) && t && (t = Z.new(t)));
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
this._templateField !== t && (this._removeTemplateField(), this._templateField = t, t && t._setObjectTemplate(this), this._applyTemplates());
|
|
1098
|
+
}
|
|
1099
|
+
// TODO change this to run before the element is added to the parent, so that way
|
|
1100
|
+
// it doesn't need to apply the themes twice
|
|
1101
|
+
_setDataItem(t) {
|
|
1102
|
+
const e = this._dataItem;
|
|
1103
|
+
this._dataItem = t, this._processTemplateField();
|
|
1104
|
+
const i = "dataitemchanged";
|
|
1105
|
+
t != e && this.events.isEnabled(i) && this.events.dispatch(i, {
|
|
1106
|
+
type: i,
|
|
1107
|
+
target: this,
|
|
1108
|
+
oldDataItem: e,
|
|
1109
|
+
newDataItem: t
|
|
1110
|
+
});
|
|
1111
|
+
}
|
|
1112
|
+
/**
|
|
1113
|
+
* A [[DataItem]] used for this element.
|
|
1114
|
+
*
|
|
1115
|
+
* NOTE: data item is being assigned automatically in most cases where it
|
|
1116
|
+
* matters. Use this accessor to set data item only if you know what you're
|
|
1117
|
+
* doing.
|
|
1118
|
+
*
|
|
1119
|
+
* @param value Data item
|
|
1120
|
+
*/
|
|
1121
|
+
set dataItem(t) {
|
|
1122
|
+
this._setDataItem(t);
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* @return DataItem
|
|
1126
|
+
*/
|
|
1127
|
+
get dataItem() {
|
|
1128
|
+
if (this._dataItem)
|
|
1129
|
+
return this._dataItem;
|
|
1130
|
+
{
|
|
1131
|
+
let t = this._parent;
|
|
1132
|
+
for (; t; ) {
|
|
1133
|
+
if (t._dataItem)
|
|
1134
|
+
return t._dataItem;
|
|
1135
|
+
t = t._parent;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
_addPercentageSizeChildren() {
|
|
1140
|
+
let t = this.parent;
|
|
1141
|
+
t && (this.get("width") instanceof D || this.get("height") instanceof D ? vt(t._percentageSizeChildren, this) : B(t._percentageSizeChildren, this));
|
|
1142
|
+
}
|
|
1143
|
+
_addPercentagePositionChildren() {
|
|
1144
|
+
let t = this.parent;
|
|
1145
|
+
t && (this.get("x") instanceof D || this.get("y") instanceof D ? vt(t._percentagePositionChildren, this) : B(t._percentagePositionChildren, this));
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* @ignore
|
|
1149
|
+
*/
|
|
1150
|
+
markDirtyPosition() {
|
|
1151
|
+
this._root._addDirtyPosition(this);
|
|
1152
|
+
}
|
|
1153
|
+
updatePivotPoint() {
|
|
1154
|
+
const t = this._localBounds;
|
|
1155
|
+
if (t) {
|
|
1156
|
+
const e = this.get("centerX");
|
|
1157
|
+
e != null && (this._display.pivot.x = t.left + L(e, t.right - t.left));
|
|
1158
|
+
const i = this.get("centerY");
|
|
1159
|
+
i != null && (this._display.pivot.y = t.top + L(i, t.bottom - t.top));
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
_beforeChanged() {
|
|
1163
|
+
if (super._beforeChanged(), this._handleStates(), this.isDirty("tooltip")) {
|
|
1164
|
+
const t = this._prevSettings.tooltip;
|
|
1165
|
+
t && t.dispose();
|
|
1166
|
+
}
|
|
1167
|
+
if ((this.isDirty("layer") || this.isDirty("layerMargin")) && (this._display.setLayer(this.get("layer"), this.get("layerMargin")), this.markDirtyLayer()), this.isDirty("tooltipPosition")) {
|
|
1168
|
+
const t = this._tooltipMoveDp;
|
|
1169
|
+
t && (t.dispose(), this._tooltipMoveDp = void 0);
|
|
1170
|
+
const e = this._tooltipPointerDp;
|
|
1171
|
+
e && (e.dispose(), this._tooltipPointerDp = void 0), this.get("tooltipPosition") == "pointer" && (this.isHover() && (this._tooltipMoveDp = this.events.on("globalpointermove", (i) => {
|
|
1172
|
+
this.showTooltip(i.point);
|
|
1173
|
+
})), this._tooltipPointerDp = new C([
|
|
1174
|
+
this.events.on("pointerover", () => {
|
|
1175
|
+
this._tooltipMoveDp = this.events.on("globalpointermove", (i) => {
|
|
1176
|
+
this.showTooltip(i.point);
|
|
1177
|
+
});
|
|
1178
|
+
}),
|
|
1179
|
+
this.events.on("pointerout", () => {
|
|
1180
|
+
const i = this._tooltipMoveDp;
|
|
1181
|
+
i && (i.dispose(), this._tooltipMoveDp = void 0);
|
|
1182
|
+
})
|
|
1183
|
+
]));
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
_handleStates() {
|
|
1187
|
+
this.isDirty("active") && (this.get("active") ? (this.states.applyAnimate("active"), this.set("ariaChecked", !0)) : (this.isHidden() || this.states.applyAnimate("default"), this.set("ariaChecked", !1)), this.markDirtyAccessibility()), this.isDirty("disabled") && (this.get("disabled") ? (this.states.applyAnimate("disabled"), this.set("ariaChecked", !1)) : (this.isHidden() || this.states.applyAnimate("default"), this.set("ariaChecked", !0)), this.markDirtyAccessibility());
|
|
1188
|
+
}
|
|
1189
|
+
_changed() {
|
|
1190
|
+
super._changed();
|
|
1191
|
+
const t = this._display, e = this.events;
|
|
1192
|
+
if (this.isDirty("draggable")) {
|
|
1193
|
+
const s = this.get("draggable");
|
|
1194
|
+
s ? (this.set("interactive", !0), this._dragDp = new C([
|
|
1195
|
+
e.on("pointerdown", (r) => {
|
|
1196
|
+
this.dragStart(r);
|
|
1197
|
+
}),
|
|
1198
|
+
e.on("globalpointermove", (r) => {
|
|
1199
|
+
this.dragMove(r);
|
|
1200
|
+
}),
|
|
1201
|
+
e.on("globalpointerup", (r) => {
|
|
1202
|
+
this.dragStop(r);
|
|
1203
|
+
})
|
|
1204
|
+
])) : this._dragDp && (this._dragDp.dispose(), this._dragDp = void 0), t.cancelTouch = !!s;
|
|
1205
|
+
}
|
|
1206
|
+
if (this.isDirty("tooltipText") || this.isDirty("tooltipHTML") || this.isDirty("showTooltipOn")) {
|
|
1207
|
+
const s = this.get("tooltipText"), r = this.get("tooltipHTML"), a = this.get("showTooltipOn", "hover");
|
|
1208
|
+
this._tooltipDp && (this._tooltipDp.dispose(), this._tooltipDp = void 0), (s || r) && (a == "click" ? (this._tooltipDp = new C([
|
|
1209
|
+
e.on("click", () => {
|
|
1210
|
+
this.setTimeout(() => {
|
|
1211
|
+
const o = this.getTooltip();
|
|
1212
|
+
o && !o.isHidden() && o.get("tooltipTarget") === this ? this.hideTooltip() : this.showTooltip();
|
|
1213
|
+
}, 10);
|
|
1214
|
+
}),
|
|
1215
|
+
q(document, "click", (o) => {
|
|
1216
|
+
this.hideTooltip();
|
|
1217
|
+
})
|
|
1218
|
+
]), this._disposers.push(this._tooltipDp)) : a == "always" || (this._tooltipDp = new C([
|
|
1219
|
+
e.on("pointerover", () => {
|
|
1220
|
+
this.showTooltip();
|
|
1221
|
+
}),
|
|
1222
|
+
e.on("pointerout", () => {
|
|
1223
|
+
this.hideTooltip();
|
|
1224
|
+
})
|
|
1225
|
+
]), this._disposers.push(this._tooltipDp)));
|
|
1226
|
+
}
|
|
1227
|
+
if (this.isDirty("toggleKey")) {
|
|
1228
|
+
let s = this.get("toggleKey");
|
|
1229
|
+
s && s != "none" ? this._toggleDp = e.on("click", () => {
|
|
1230
|
+
this._isDragging || this.set(s, !this.get(s));
|
|
1231
|
+
}) : this._toggleDp && (this._toggleDp.dispose(), this._toggleDp = void 0);
|
|
1232
|
+
}
|
|
1233
|
+
if (this.isDirty("opacity") && (t.alpha = Math.max(0, this.get("opacity", 1)), this.get("focusable") && this.markDirtyAccessibility()), this.isDirty("rotation") && (this.markDirtyBounds(), t.angle = this.get("rotation", 0)), this.isDirty("scale") && (this.markDirtyBounds(), t.scale = this.get("scale", 0)), (this.isDirty("centerX") || this.isDirty("centerY")) && (this.markDirtyBounds(), this.updatePivotPoint()), (this.isDirty("visible") || this.isPrivateDirty("visible") || this.isDirty("forceHidden")) && (!this.get("visible") || !this.getPrivate("visible") || this.get("forceHidden") ? (t.visible = !1, this.hideTooltip()) : t.visible = !0, this.markDirtyBounds(), this.get("focusable") && this.markDirtyAccessibility()), this.isDirty("width") || this.isDirty("height")) {
|
|
1234
|
+
this.markDirtyBounds(), this._addPercentageSizeChildren();
|
|
1235
|
+
const s = this.parent;
|
|
1236
|
+
s && (this.isDirty("width") && this.get("width") instanceof D || this.isDirty("height") && this.get("height") instanceof D) && (s.markDirty(), s._prevWidth = 0), this._sizeDirty = !0;
|
|
1237
|
+
}
|
|
1238
|
+
if ((this.isDirty("maxWidth") || this.isDirty("maxHeight") || this.isPrivateDirty("width") || this.isPrivateDirty("height") || this.isDirty("minWidth") || this.isDirty("minHeight") || this.isPrivateDirty("maxWidth") || this.isPrivateDirty("maxHeight") || this.isPrivateDirty("minWidth") || this.isPrivateDirty("minHeight") || this.isDirty("marginLeft") || this.isDirty("marginTop") || this.isDirty("marginRight") || this.isDirty("marginBottom")) && (this.markDirtyBounds(), this._sizeDirty = !0), this._sizeDirty && this._updateSize(), this.isDirty("wheelable")) {
|
|
1239
|
+
const s = this.get("wheelable");
|
|
1240
|
+
s && this.set("interactive", !0), t.wheelable = !!s;
|
|
1241
|
+
}
|
|
1242
|
+
(this.isDirty("tabindexOrder") || this.isDirty("focusableGroup")) && (this.get("focusable") ? this._root._registerTabindexOrder(this) : this._root._unregisterTabindexOrder(this)), this.isDirty("filter") && (t.filter = this.get("filter"));
|
|
1243
|
+
let i = this.get("filter", "");
|
|
1244
|
+
if (this.isDirty("blur")) {
|
|
1245
|
+
const s = this.get("blur", 0);
|
|
1246
|
+
s != 0 && (i += " blur(" + s + "px)");
|
|
1247
|
+
}
|
|
1248
|
+
if (this.isDirty("saturate")) {
|
|
1249
|
+
const s = this.get("saturate", 1);
|
|
1250
|
+
s != 1 && (i += " saturate(" + s + ")");
|
|
1251
|
+
}
|
|
1252
|
+
if (this.isDirty("brightness")) {
|
|
1253
|
+
const s = this.get("brightness", 1);
|
|
1254
|
+
s != 1 && (i += " brightness(" + s + ")");
|
|
1255
|
+
}
|
|
1256
|
+
if (this.isDirty("contrast")) {
|
|
1257
|
+
const s = this.get("contrast", 1);
|
|
1258
|
+
s != 1 && (i += " contrast(" + s + ")");
|
|
1259
|
+
}
|
|
1260
|
+
if (this.isDirty("sepia")) {
|
|
1261
|
+
const s = this.get("sepia", 0);
|
|
1262
|
+
s != 0 && (i += " sepia(" + s + ")");
|
|
1263
|
+
}
|
|
1264
|
+
if (this.isDirty("hue")) {
|
|
1265
|
+
const s = this.get("hue", 0);
|
|
1266
|
+
s != 0 && (i += " hue-rotate(" + s + "deg)");
|
|
1267
|
+
}
|
|
1268
|
+
if (this.isDirty("invert")) {
|
|
1269
|
+
const s = this.get("invert", 0);
|
|
1270
|
+
s != 0 && (i += " invert(" + s + ")");
|
|
1271
|
+
}
|
|
1272
|
+
if (i && (t.filter = i), this.isDirty("cursorOverStyle") && (t.cursorOverStyle = this.get("cursorOverStyle")), this.isDirty("hoverOnFocus") && (this.get("hoverOnFocus") ? this._focusDp = new C([
|
|
1273
|
+
e.on("focus", () => {
|
|
1274
|
+
this.showTooltip();
|
|
1275
|
+
}),
|
|
1276
|
+
e.on("blur", () => {
|
|
1277
|
+
this.hideTooltip();
|
|
1278
|
+
})
|
|
1279
|
+
]) : this._focusDp && (this._focusDp.dispose(), this._focusDp = void 0)), this.isDirty("focusable") && (this.get("focusable") ? this._root._registerTabindexOrder(this) : this._root._unregisterTabindexOrder(this), this.markDirtyAccessibility(), this._disposers.push(e.on("blur", () => {
|
|
1280
|
+
this.setPrivateRaw("touchHovering", !1);
|
|
1281
|
+
})), this._disposers.push(e.once("boundschanged", () => {
|
|
1282
|
+
this.markDirtyAccessibility();
|
|
1283
|
+
}))), this.isPrivateDirty("focusable") && this.markDirtyAccessibility(), (this.isDirty("role") || this.isDirty("ariaLive") || this.isDirty("ariaChecked") || this.isDirty("ariaHidden") || this.isDirty("ariaOrientation") || this.isDirty("ariaValueNow") || this.isDirty("ariaValueMin") || this.isDirty("ariaValueMax") || this.isDirty("ariaValueText") || this.isDirty("ariaLabel") || this.isDirty("ariaControls")) && this.markDirtyAccessibility(), this.isDirty("exportable") && (t.exportable = this.get("exportable")), this.isDirty("interactive")) {
|
|
1284
|
+
const s = this.events;
|
|
1285
|
+
this.get("interactive") && !s.isDisposed() ? this._hoverDp = new C([
|
|
1286
|
+
s.on("click", (r) => {
|
|
1287
|
+
Dt(r.originalEvent) && (this.getPrivate("touchHovering") || this.setTimeout(() => {
|
|
1288
|
+
this._handleOver(), (this.get("tooltipText") || this.get("tooltipHTML")) && this.showTooltip(), this.setPrivateRaw("touchHovering", !0), this.events.dispatch("pointerover", {
|
|
1289
|
+
type: "pointerover",
|
|
1290
|
+
target: r.target,
|
|
1291
|
+
originalEvent: r.originalEvent,
|
|
1292
|
+
point: r.point,
|
|
1293
|
+
simulated: r.simulated
|
|
1294
|
+
});
|
|
1295
|
+
}, 10));
|
|
1296
|
+
}),
|
|
1297
|
+
s.on("globalpointerup", (r) => {
|
|
1298
|
+
Dt(r.originalEvent) && this.getPrivate("touchHovering") && (this._handleOut(), (this.get("tooltipText") || this.get("tooltipHTML")) && this.hideTooltip(), this.setPrivateRaw("touchHovering", !1), this.events.dispatch("pointerout", {
|
|
1299
|
+
type: "pointerout",
|
|
1300
|
+
target: r.target,
|
|
1301
|
+
originalEvent: r.originalEvent,
|
|
1302
|
+
point: r.point,
|
|
1303
|
+
simulated: r.simulated
|
|
1304
|
+
})), this._isDown && this._handleUp(r);
|
|
1305
|
+
}),
|
|
1306
|
+
s.on("pointerover", () => {
|
|
1307
|
+
this._handleOver();
|
|
1308
|
+
}),
|
|
1309
|
+
s.on("pointerout", () => {
|
|
1310
|
+
this._handleOut();
|
|
1311
|
+
}),
|
|
1312
|
+
s.on("pointerdown", (r) => {
|
|
1313
|
+
this._handleDown(r);
|
|
1314
|
+
})
|
|
1315
|
+
]) : (this._display.interactive = !1, this._hoverDp && (this._hoverDp.dispose(), this._hoverDp = void 0));
|
|
1316
|
+
}
|
|
1317
|
+
this.isDirty("forceInactive") && (this._display.inactive = this.get("forceInactive", null)), this.get("showTooltipOn") == "always" && this._display.visible && this.showTooltip();
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* @ignore
|
|
1321
|
+
* @todo should this be user-accessible?
|
|
1322
|
+
*/
|
|
1323
|
+
dragStart(t) {
|
|
1324
|
+
this._dragEvent = t, this.events.stopParentDispatch();
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* @ignore
|
|
1328
|
+
* @todo should this be user-accessible?
|
|
1329
|
+
*/
|
|
1330
|
+
dragStop(t) {
|
|
1331
|
+
if (this._dragEvent = void 0, this._dragPoint = void 0, this.events.stopParentDispatch(), this._isDragging) {
|
|
1332
|
+
this._isDragging = !1;
|
|
1333
|
+
const e = "dragstop";
|
|
1334
|
+
this.events.isEnabled(e) && this.events.dispatch(e, {
|
|
1335
|
+
type: e,
|
|
1336
|
+
target: this,
|
|
1337
|
+
originalEvent: t.originalEvent,
|
|
1338
|
+
point: t.point,
|
|
1339
|
+
simulated: t.simulated
|
|
1340
|
+
});
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
_handleOver() {
|
|
1344
|
+
this.isHidden() || (this.get("active") && this.states.lookup("hoverActive") ? this.states.applyAnimate("hoverActive") : this.get("disabled") && this.states.lookup("hoverDisabled") ? this.states.applyAnimate("hoverDisabled") : this.states.applyAnimate("hover"), this.get("draggable") && this._isDown && this.states.lookup("down") && this.states.applyAnimate("down"));
|
|
1345
|
+
}
|
|
1346
|
+
_handleOut() {
|
|
1347
|
+
this.isHidden() || (this.get("active") && this.states.lookup("active") ? this.states.applyAnimate("active") : this.get("disabled") && this.states.lookup("disabled") ? this.states.applyAnimate("disabled") : (this.states.lookup("hover") || this.states.lookup("hoverActive")) && this.states.applyAnimate("default"), this.get("draggable") && this._isDown && this.states.lookup("down") && this.states.applyAnimate("down"));
|
|
1348
|
+
}
|
|
1349
|
+
_handleUp(t) {
|
|
1350
|
+
if (!this.isHidden()) {
|
|
1351
|
+
this.get("active") && this.states.lookup("active") ? this.states.applyAnimate("active") : this.get("disabled") && this.states.lookup("disabled") ? this.states.applyAnimate("disabled") : this.states.lookup("down") && (this.isHover() ? this.states.applyAnimate("hover") : this.states.applyAnimate("default")), this._downPoint = void 0;
|
|
1352
|
+
const e = at(t.originalEvent);
|
|
1353
|
+
delete this._downPoints[e], lt(this._downPoints).length == 0 && (this._isDown = !1);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
_hasMoved(t) {
|
|
1357
|
+
const e = at(t.originalEvent), i = this._downPoints[e];
|
|
1358
|
+
if (i) {
|
|
1359
|
+
const s = Math.abs(i.x - t.point.x), r = Math.abs(i.y - t.point.y);
|
|
1360
|
+
return s > 5 || r > 5;
|
|
1361
|
+
}
|
|
1362
|
+
return !1;
|
|
1363
|
+
}
|
|
1364
|
+
_hasDown() {
|
|
1365
|
+
return lt(this._downPoints).length > 0;
|
|
1366
|
+
}
|
|
1367
|
+
_handleDown(t) {
|
|
1368
|
+
const e = this.parent;
|
|
1369
|
+
if (e && !this.get("draggable") && e._handleDown(t), this.get("interactive") && !this.isHidden()) {
|
|
1370
|
+
this.states.lookup("down") && this.states.applyAnimate("down"), this._downPoint = {
|
|
1371
|
+
x: t.point.x,
|
|
1372
|
+
y: t.point.y
|
|
1373
|
+
}, this._isDown = !0;
|
|
1374
|
+
const i = at(t.originalEvent);
|
|
1375
|
+
this._downPoints[i] = {
|
|
1376
|
+
x: t.point.x,
|
|
1377
|
+
y: t.point.y
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
/**
|
|
1382
|
+
* @ignore
|
|
1383
|
+
* @todo should this be user-accessible?
|
|
1384
|
+
*/
|
|
1385
|
+
dragMove(t) {
|
|
1386
|
+
let e = this._dragEvent;
|
|
1387
|
+
if (e) {
|
|
1388
|
+
if (e.simulated && !t.simulated)
|
|
1389
|
+
return !0;
|
|
1390
|
+
let i = 0, s = this.parent, r = 1;
|
|
1391
|
+
for (; s != null; )
|
|
1392
|
+
i += s.get("rotation", 0), s = s.parent, s && (r *= s.get("scale", 1));
|
|
1393
|
+
let a = (t.point.x - e.point.x) / r, o = (t.point.y - e.point.y) / r;
|
|
1394
|
+
const l = this.events;
|
|
1395
|
+
if (e.simulated && !this._isDragging) {
|
|
1396
|
+
this._isDragging = !0, this._dragEvent = t, this._dragPoint = {
|
|
1397
|
+
x: this.x(),
|
|
1398
|
+
y: this.y()
|
|
1399
|
+
};
|
|
1400
|
+
const h = "dragstart";
|
|
1401
|
+
l.isEnabled(h) && l.dispatch(h, {
|
|
1402
|
+
type: h,
|
|
1403
|
+
target: this,
|
|
1404
|
+
originalEvent: t.originalEvent,
|
|
1405
|
+
point: t.point,
|
|
1406
|
+
simulated: t.simulated
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
if (this._isDragging) {
|
|
1410
|
+
let h = this._dragPoint;
|
|
1411
|
+
this.set("x", h.x + a * dt(i) + o * ut(i)), this.set("y", h.y + o * dt(i) - a * ut(i));
|
|
1412
|
+
const u = "dragged";
|
|
1413
|
+
l.isEnabled(u) && l.dispatch(u, {
|
|
1414
|
+
type: u,
|
|
1415
|
+
target: this,
|
|
1416
|
+
originalEvent: t.originalEvent,
|
|
1417
|
+
point: t.point,
|
|
1418
|
+
simulated: t.simulated
|
|
1419
|
+
});
|
|
1420
|
+
} else if (Math.hypot(a, o) > 5) {
|
|
1421
|
+
this._isDragging = !0, this._dragEvent = t, this._dragPoint = {
|
|
1422
|
+
x: this.x(),
|
|
1423
|
+
y: this.y()
|
|
1424
|
+
};
|
|
1425
|
+
const h = "dragstart";
|
|
1426
|
+
l.isEnabled(h) && l.dispatch(h, {
|
|
1427
|
+
type: h,
|
|
1428
|
+
target: this,
|
|
1429
|
+
originalEvent: t.originalEvent,
|
|
1430
|
+
point: t.point,
|
|
1431
|
+
simulated: t.simulated
|
|
1432
|
+
});
|
|
1433
|
+
}
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
_updateSize() {
|
|
1437
|
+
}
|
|
1438
|
+
_getBounds() {
|
|
1439
|
+
this._localBounds = this._display.getLocalBounds();
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Returns depth (how deep in the hierachy of the content tree) of this
|
|
1443
|
+
* element.
|
|
1444
|
+
*
|
|
1445
|
+
* @return Depth
|
|
1446
|
+
*/
|
|
1447
|
+
depth() {
|
|
1448
|
+
let t = this.parent, e = 0;
|
|
1449
|
+
for (; ; )
|
|
1450
|
+
if (t)
|
|
1451
|
+
++e, t = t.parent;
|
|
1452
|
+
else
|
|
1453
|
+
return e;
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* @ignore
|
|
1457
|
+
*/
|
|
1458
|
+
markDirtySize() {
|
|
1459
|
+
this._sizeDirty = !0, this.markDirty();
|
|
1460
|
+
}
|
|
1461
|
+
/**
|
|
1462
|
+
* @ignore
|
|
1463
|
+
*/
|
|
1464
|
+
markDirtyBounds() {
|
|
1465
|
+
const t = this._display;
|
|
1466
|
+
if (this.get("isMeasured")) {
|
|
1467
|
+
this._root._addDirtyBounds(this), t.isMeasured = !0, t.invalidateBounds();
|
|
1468
|
+
const e = this.parent;
|
|
1469
|
+
e && this.get("position") != "absolute" && (e.get("width") == null || e.get("height") == null || e.get("layout")) && e.markDirtyBounds(), this.get("focusable") && this.markDirtyAccessibility();
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* @ignore
|
|
1474
|
+
*/
|
|
1475
|
+
markDirtyAccessibility() {
|
|
1476
|
+
this._root._invalidateAccessibility(this);
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* @ignore
|
|
1480
|
+
*/
|
|
1481
|
+
markDirtyLayer() {
|
|
1482
|
+
this._display.markDirtyLayer(!0);
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* @ignore
|
|
1486
|
+
*/
|
|
1487
|
+
markDirty() {
|
|
1488
|
+
super.markDirty(), this.markDirtyLayer();
|
|
1489
|
+
}
|
|
1490
|
+
_updateBounds() {
|
|
1491
|
+
const t = this._adjustedLocalBounds;
|
|
1492
|
+
let e;
|
|
1493
|
+
if (!this.get("visible") || !this.getPrivate("visible") || this.get("forceHidden") ? (e = {
|
|
1494
|
+
left: 0,
|
|
1495
|
+
right: 0,
|
|
1496
|
+
top: 0,
|
|
1497
|
+
bottom: 0
|
|
1498
|
+
}, this._localBounds = e, this._adjustedLocalBounds = e) : (this._getBounds(), this._fixMinBounds(this._localBounds), this.updatePivotPoint(), this._adjustedLocalBounds = this._display.getAdjustedBounds(this._localBounds), e = this._adjustedLocalBounds), !t || t.left !== e.left || t.top !== e.top || t.right !== e.right || t.bottom !== e.bottom) {
|
|
1499
|
+
const i = "boundschanged";
|
|
1500
|
+
this.events.isEnabled(i) && this.events.dispatch(i, { type: i, target: this }), this.parent && (this.parent.markDirty(), this.parent.markDirtyBounds()), this.getPrivate("showingTooltip") && this.showTooltip();
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
_fixMinBounds(t) {
|
|
1504
|
+
let e = this.get("minWidth", this.getPrivate("minWidth")), i = this.get("minHeight", this.getPrivate("minHeight"));
|
|
1505
|
+
m(e) && t.right - t.left < e && (t.right = t.left + e), m(i) && t.bottom - t.top < i && (t.bottom = t.top + i);
|
|
1506
|
+
let s = this.getPrivate("width"), r = this.getPrivate("height");
|
|
1507
|
+
m(s) && (s > 0 ? t.right = t.left + s : t.left = t.right + s), m(r) && (r > 0 ? t.bottom = t.top + r : t.top = t.bottom + r);
|
|
1508
|
+
}
|
|
1509
|
+
_removeParent(t) {
|
|
1510
|
+
t && (t.children.removeValue(this), B(t._percentageSizeChildren, this), B(t._percentagePositionChildren, this));
|
|
1511
|
+
}
|
|
1512
|
+
_clearDirty() {
|
|
1513
|
+
super._clearDirty(), this._sizeDirty = !1;
|
|
1514
|
+
}
|
|
1515
|
+
/**
|
|
1516
|
+
* Simulate hover over element.
|
|
1517
|
+
*/
|
|
1518
|
+
hover() {
|
|
1519
|
+
this.isDisposed() || (this.showTooltip(), this._handleOver());
|
|
1520
|
+
}
|
|
1521
|
+
/**
|
|
1522
|
+
* Simulate unhover over element.
|
|
1523
|
+
*/
|
|
1524
|
+
unhover() {
|
|
1525
|
+
this.isDisposed() || (this.hideTooltip(), this._handleOut());
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* Shows element's [[Tooltip]].
|
|
1529
|
+
*/
|
|
1530
|
+
showTooltip(t) {
|
|
1531
|
+
if (!this.isDisposed()) {
|
|
1532
|
+
const e = this.getTooltip(), i = this.get("tooltipText"), s = this.get("tooltipHTML");
|
|
1533
|
+
if ((i || s) && e) {
|
|
1534
|
+
const r = this.get("tooltipPosition"), a = this.getPrivate("tooltipTarget", this);
|
|
1535
|
+
if ((r == "fixed" || !t) && (this._display._setMatrix(), t = this.toGlobal(a._getTooltipPoint())), r == "pointer") {
|
|
1536
|
+
const h = this.getPrivate("lastTooltipCoords");
|
|
1537
|
+
if (h && h.x == t.x && h.y == t.y)
|
|
1538
|
+
return;
|
|
1539
|
+
this.setPrivate("lastTooltipCoords", t);
|
|
1540
|
+
}
|
|
1541
|
+
e.set("pointTo", t), e.set("tooltipTarget", a), e.get("x") || e.set("x", t.x), e.get("y") || e.set("y", t.y), i && e.label.set("text", i), s && e.label.set("html", s);
|
|
1542
|
+
const o = this.dataItem;
|
|
1543
|
+
if (o && e.label._setDataItem(o), this.get("showTooltipOn") == "always" && (t.x < 0 || t.x > this._root.width() || t.y < 0 || t.y > this._root.height())) {
|
|
1544
|
+
this.hideTooltip();
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1547
|
+
e.label.text.markDirtyText();
|
|
1548
|
+
const l = e.show();
|
|
1549
|
+
return this.setPrivateRaw("showingTooltip", !0), l;
|
|
1550
|
+
}
|
|
1551
|
+
}
|
|
1552
|
+
}
|
|
1553
|
+
/**
|
|
1554
|
+
* Hides element's [[Tooltip]].
|
|
1555
|
+
*/
|
|
1556
|
+
hideTooltip() {
|
|
1557
|
+
const t = this.getTooltip();
|
|
1558
|
+
if (t && (this.removePrivate("lastTooltipCoords"), t.get("tooltipTarget") == this.getPrivate("tooltipTarget", this) || this.get("tooltip") == t)) {
|
|
1559
|
+
let e = t.get("keepTargetHover") && t.get("stateAnimationDuration", 0) == 0 ? 400 : void 0;
|
|
1560
|
+
const i = t.hide(e);
|
|
1561
|
+
return this.setPrivateRaw("showingTooltip", !1), i;
|
|
1562
|
+
}
|
|
1563
|
+
}
|
|
1564
|
+
_getTooltipPoint() {
|
|
1565
|
+
const t = this._localBounds;
|
|
1566
|
+
if (t) {
|
|
1567
|
+
let e = 0, i = 0;
|
|
1568
|
+
return this.get("isMeasured") ? (e = t.left + L(this.get("tooltipX", 0), t.right - t.left), i = t.top + L(this.get("tooltipY", 0), t.bottom - t.top)) : (e = L(this.get("tooltipX", 0), this.width()), i = L(this.get("tooltipY", 0), this.height())), { x: e, y: i };
|
|
1569
|
+
}
|
|
1570
|
+
return { x: 0, y: 0 };
|
|
1571
|
+
}
|
|
1572
|
+
/**
|
|
1573
|
+
* Returns [[Tooltip]] used for this element.
|
|
1574
|
+
*
|
|
1575
|
+
* @return Tooltip
|
|
1576
|
+
*/
|
|
1577
|
+
getTooltip() {
|
|
1578
|
+
let t = this.get("tooltip");
|
|
1579
|
+
if (t)
|
|
1580
|
+
return t;
|
|
1581
|
+
{
|
|
1582
|
+
let e = this.parent;
|
|
1583
|
+
if (e)
|
|
1584
|
+
return e.getTooltip();
|
|
1585
|
+
}
|
|
1586
|
+
}
|
|
1587
|
+
_updatePosition() {
|
|
1588
|
+
const t = this.parent;
|
|
1589
|
+
let e = this.get("dx", 0), i = this.get("dy", 0), s = this.get("x"), r = this.getPrivate("x"), a = 0, o = 0;
|
|
1590
|
+
const l = this.get("position");
|
|
1591
|
+
s instanceof D && (t ? s = t.innerWidth() * s.value + t.get("paddingLeft", 0) : s = 0), m(s) ? a = s + e : r != null ? a = r : t && l == "relative" && (a = t.get("paddingLeft", 0) + e);
|
|
1592
|
+
let h = this.get("y"), u = this.getPrivate("y");
|
|
1593
|
+
h instanceof D && (t ? h = t.innerHeight() * h.value + t.get("paddingTop", 0) : h = 0), m(h) ? o = h + i : u != null ? o = u : t && l == "relative" && (o = t.get("paddingTop", 0) + i);
|
|
1594
|
+
const f = this._display;
|
|
1595
|
+
if (f.x != a || f.y != o) {
|
|
1596
|
+
f.invalidateBounds(), f.x = a, f.y = o;
|
|
1597
|
+
const d = "positionchanged";
|
|
1598
|
+
this.events.isEnabled(d) && this.events.dispatch(d, { type: d, target: this });
|
|
1599
|
+
}
|
|
1600
|
+
this.getPrivate("showingTooltip") && this.showTooltip();
|
|
1601
|
+
}
|
|
1602
|
+
/**
|
|
1603
|
+
* Returns element's actual X position in pixels.
|
|
1604
|
+
*
|
|
1605
|
+
* @return X (px)
|
|
1606
|
+
*/
|
|
1607
|
+
x() {
|
|
1608
|
+
let t = this.get("x"), e = this.getPrivate("x");
|
|
1609
|
+
const i = this.parent;
|
|
1610
|
+
return i ? t instanceof D ? L(t, i.innerWidth()) + i.get("paddingLeft", 0) : m(t) ? t : e ?? i.get("paddingLeft", this._display.x) : this._display.x;
|
|
1611
|
+
}
|
|
1612
|
+
/**
|
|
1613
|
+
* Returns element's actual Y position in pixels.
|
|
1614
|
+
*
|
|
1615
|
+
* @return Y (px)
|
|
1616
|
+
*/
|
|
1617
|
+
y() {
|
|
1618
|
+
let t = this.getPrivate("y");
|
|
1619
|
+
if (t != null)
|
|
1620
|
+
return t;
|
|
1621
|
+
let e = this.get("y");
|
|
1622
|
+
const i = this.parent;
|
|
1623
|
+
return i ? e instanceof D ? L(e, i.innerHeight()) + i.get("paddingTop", 0) : m(e) ? e : t ?? i.get("paddingTop", this._display.y) : this._display.y;
|
|
1624
|
+
}
|
|
1625
|
+
_dispose() {
|
|
1626
|
+
super._dispose(), this._display.dispose(), this._removeTemplateField(), this._removeParent(this.parent), this._root._removeFocusElement(this);
|
|
1627
|
+
const t = this.get("tooltip");
|
|
1628
|
+
t && t.dispose(), this.markDirty();
|
|
1629
|
+
}
|
|
1630
|
+
/**
|
|
1631
|
+
* @ignore
|
|
1632
|
+
*/
|
|
1633
|
+
adjustedLocalBounds() {
|
|
1634
|
+
return this._fixMinBounds(this._adjustedLocalBounds), this._adjustedLocalBounds;
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Returns local coordinates of the element's bounds.
|
|
1638
|
+
*
|
|
1639
|
+
* @ignore
|
|
1640
|
+
* @return Global bounds
|
|
1641
|
+
*/
|
|
1642
|
+
localBounds() {
|
|
1643
|
+
return this._localBounds;
|
|
1644
|
+
}
|
|
1645
|
+
/**
|
|
1646
|
+
* Returns adjusted local coordinates of the element's bounds.
|
|
1647
|
+
*
|
|
1648
|
+
* @ignore
|
|
1649
|
+
* @return Global bounds
|
|
1650
|
+
*/
|
|
1651
|
+
bounds() {
|
|
1652
|
+
const t = this._adjustedLocalBounds, e = this.x(), i = this.y();
|
|
1653
|
+
return { left: t.left + e, right: t.right + e, top: t.top + i, bottom: t.bottom + i };
|
|
1654
|
+
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Returns global coordinates of the element's bounds.
|
|
1657
|
+
*
|
|
1658
|
+
* @ignore
|
|
1659
|
+
* @return Global bounds
|
|
1660
|
+
*/
|
|
1661
|
+
globalBounds() {
|
|
1662
|
+
const t = this.localBounds(), e = this.toGlobal({ x: t.left, y: t.top }), i = this.toGlobal({ x: t.right, y: t.top }), s = this.toGlobal({ x: t.right, y: t.bottom }), r = this.toGlobal({ x: t.left, y: t.bottom });
|
|
1663
|
+
return {
|
|
1664
|
+
left: Math.min(e.x, i.x, s.x, r.x),
|
|
1665
|
+
top: Math.min(e.y, i.y, s.y, r.y),
|
|
1666
|
+
right: Math.max(e.x, i.x, s.x, r.x),
|
|
1667
|
+
bottom: Math.max(e.y, i.y, s.y, r.y)
|
|
1668
|
+
};
|
|
1669
|
+
}
|
|
1670
|
+
_onShow(t) {
|
|
1671
|
+
}
|
|
1672
|
+
_onHide(t) {
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* Plays initial reveal animation regardless if element is currently hidden
|
|
1676
|
+
* or visible.
|
|
1677
|
+
*
|
|
1678
|
+
* @param duration Duration of the animation in milliseconds
|
|
1679
|
+
* @param delay Delay showing of the element by X milliseconds
|
|
1680
|
+
* @return Promise
|
|
1681
|
+
*/
|
|
1682
|
+
appear(t, e) {
|
|
1683
|
+
return nt(this, void 0, void 0, function* () {
|
|
1684
|
+
return yield this.hide(0), e ? new Promise((i, s) => {
|
|
1685
|
+
this.setTimeout(() => {
|
|
1686
|
+
i(this.show(t));
|
|
1687
|
+
}, e);
|
|
1688
|
+
}) : this.show(t);
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Shows currently hidden element and returns a `Promise` which completes
|
|
1693
|
+
* when all showing animations are finished.
|
|
1694
|
+
*
|
|
1695
|
+
* ```TypeScript
|
|
1696
|
+
* series.show().then(function(ev) {
|
|
1697
|
+
* console.log("Series is now fully visible");
|
|
1698
|
+
* })
|
|
1699
|
+
* ```
|
|
1700
|
+
* ```JavaScript
|
|
1701
|
+
* series.show().then(function(ev) {
|
|
1702
|
+
* console.log("Series is now fully visible");
|
|
1703
|
+
* })
|
|
1704
|
+
* ```
|
|
1705
|
+
*
|
|
1706
|
+
* @return Promise
|
|
1707
|
+
*/
|
|
1708
|
+
show(t) {
|
|
1709
|
+
return nt(this, void 0, void 0, function* () {
|
|
1710
|
+
if (!this._isShowing) {
|
|
1711
|
+
this._isHidden = !1, this._isShowing = !0, this._isHiding = !1, this.states.lookup("default").get("visible") && this.set("visible", !0), this._onShow(t);
|
|
1712
|
+
const e = this.states.applyAnimate("default", t);
|
|
1713
|
+
yield wt(e), this._isShowing = !1;
|
|
1714
|
+
}
|
|
1715
|
+
});
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* Hides the element and returns a `Promise` which completes when all hiding
|
|
1719
|
+
* animations are finished.
|
|
1720
|
+
*
|
|
1721
|
+
* ```TypeScript
|
|
1722
|
+
* series.hide().then(function(ev) {
|
|
1723
|
+
* console.log("Series finished hiding");
|
|
1724
|
+
* })
|
|
1725
|
+
* ```
|
|
1726
|
+
* ```JavaScript
|
|
1727
|
+
* series.hide().then(function(ev) {
|
|
1728
|
+
* console.log("Series finished hiding");
|
|
1729
|
+
* })
|
|
1730
|
+
* ```
|
|
1731
|
+
*
|
|
1732
|
+
* @return Promise
|
|
1733
|
+
*/
|
|
1734
|
+
hide(t) {
|
|
1735
|
+
return nt(this, void 0, void 0, function* () {
|
|
1736
|
+
if (!this._isHiding && !this._isHidden) {
|
|
1737
|
+
this._isHiding = !0, this._isShowing = !1;
|
|
1738
|
+
let e = this.states.lookup("hidden");
|
|
1739
|
+
e || (e = this.states.create("hidden", {
|
|
1740
|
+
opacity: 0,
|
|
1741
|
+
visible: !1
|
|
1742
|
+
})), this._isHidden = !0, this._onHide(t);
|
|
1743
|
+
const i = this.states.applyAnimate("hidden", t);
|
|
1744
|
+
yield wt(i), this._isHiding = !1;
|
|
1745
|
+
}
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
/**
|
|
1749
|
+
* Returns `true` if this element is currently hidden.
|
|
1750
|
+
*
|
|
1751
|
+
* @return Is hidden?
|
|
1752
|
+
*/
|
|
1753
|
+
isHidden() {
|
|
1754
|
+
return this._isHidden;
|
|
1755
|
+
}
|
|
1756
|
+
/**
|
|
1757
|
+
* Returns `true` if this element is currently animating to a default state.
|
|
1758
|
+
*
|
|
1759
|
+
* @return Is showing?
|
|
1760
|
+
*/
|
|
1761
|
+
isShowing() {
|
|
1762
|
+
return this._isShowing;
|
|
1763
|
+
}
|
|
1764
|
+
/**
|
|
1765
|
+
* Returns `true` if this element is currently animating to a hidden state.
|
|
1766
|
+
*
|
|
1767
|
+
* @return Is hiding?
|
|
1768
|
+
*/
|
|
1769
|
+
isHiding() {
|
|
1770
|
+
return this._isHiding;
|
|
1771
|
+
}
|
|
1772
|
+
/**
|
|
1773
|
+
* Returns `true` if this element is currently hovered by a pointer.
|
|
1774
|
+
*
|
|
1775
|
+
* @return Is hovered?
|
|
1776
|
+
*/
|
|
1777
|
+
isHover() {
|
|
1778
|
+
return this._display.hovering();
|
|
1779
|
+
}
|
|
1780
|
+
/**
|
|
1781
|
+
* Returns `true` if this element does currently have focus.
|
|
1782
|
+
*
|
|
1783
|
+
* @return Is focused?
|
|
1784
|
+
*/
|
|
1785
|
+
isFocus() {
|
|
1786
|
+
return this._root.focused(this);
|
|
1787
|
+
}
|
|
1788
|
+
/**
|
|
1789
|
+
* Returns `true` if this element is currently being dragged.
|
|
1790
|
+
*
|
|
1791
|
+
* @return Is dragged?
|
|
1792
|
+
*/
|
|
1793
|
+
isDragging() {
|
|
1794
|
+
return this._isDragging;
|
|
1795
|
+
}
|
|
1796
|
+
/**
|
|
1797
|
+
* Returns `false` if if either public or private setting `visible` is set
|
|
1798
|
+
* to `false`, or `forceHidden` is set to `true`.
|
|
1799
|
+
*
|
|
1800
|
+
* @return Visible?
|
|
1801
|
+
*/
|
|
1802
|
+
isVisible() {
|
|
1803
|
+
return !!(this.get("visible") && this.getPrivate("visible") && !this.get("forceHidden"));
|
|
1804
|
+
}
|
|
1805
|
+
/**
|
|
1806
|
+
* Same as `isVisible()`, except it checks all ascendants, too.
|
|
1807
|
+
*
|
|
1808
|
+
* @since 5.2.7
|
|
1809
|
+
* @return Visible?
|
|
1810
|
+
*/
|
|
1811
|
+
isVisibleDeep() {
|
|
1812
|
+
return this._parent ? this._parent.isVisibleDeep() && this.isVisible() : this.isVisible();
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* Returns an actual opacity of the element, taking into account all parents.
|
|
1816
|
+
*
|
|
1817
|
+
* @return Opacity
|
|
1818
|
+
* @since 5.2.11
|
|
1819
|
+
*/
|
|
1820
|
+
compositeOpacity() {
|
|
1821
|
+
const t = this.get("opacity", 1);
|
|
1822
|
+
return this._parent ? this._parent.compositeOpacity() * t : t;
|
|
1823
|
+
}
|
|
1824
|
+
/**
|
|
1825
|
+
* Returns an actual scale of the element, taking into account all parents.
|
|
1826
|
+
*
|
|
1827
|
+
* @return Opacity
|
|
1828
|
+
* @since 5.9.2
|
|
1829
|
+
*/
|
|
1830
|
+
compositeScale() {
|
|
1831
|
+
const t = this.get("scale", 1);
|
|
1832
|
+
return this._parent ? this._parent.compositeScale() * t : t;
|
|
1833
|
+
}
|
|
1834
|
+
/**
|
|
1835
|
+
* Returns an actual roation of the element, taking into account all parents.
|
|
1836
|
+
*
|
|
1837
|
+
* @return Opacity
|
|
1838
|
+
* @since 5.9.2
|
|
1839
|
+
*/
|
|
1840
|
+
compositeRotation() {
|
|
1841
|
+
const t = this.get("rotation", 0);
|
|
1842
|
+
return this._parent ? this._parent.compositeRotation() + t : t;
|
|
1843
|
+
}
|
|
1844
|
+
/**
|
|
1845
|
+
* Returns width of this element in pixels.
|
|
1846
|
+
*
|
|
1847
|
+
* @return Width (px)
|
|
1848
|
+
*/
|
|
1849
|
+
width() {
|
|
1850
|
+
let t = this.get("width"), e = this.get("maxWidth", this.getPrivate("maxWidth")), i = this.get("minWidth", this.getPrivate("minWidth")), s = this.getPrivate("width"), r = 0;
|
|
1851
|
+
if (m(s))
|
|
1852
|
+
r = s;
|
|
1853
|
+
else if (t == null)
|
|
1854
|
+
this._adjustedLocalBounds && (r = this._adjustedLocalBounds.right - this._adjustedLocalBounds.left);
|
|
1855
|
+
else if (t instanceof D) {
|
|
1856
|
+
const a = this.parent;
|
|
1857
|
+
a ? r = a.innerWidth() * t.value : r = this._root.width() * t.value;
|
|
1858
|
+
} else m(t) && (r = t);
|
|
1859
|
+
return m(i) && (r = Math.max(i, r)), m(e) && (r = Math.min(e, r)), r;
|
|
1860
|
+
}
|
|
1861
|
+
/**
|
|
1862
|
+
* Returns maximum allowed width of this element in pixels.
|
|
1863
|
+
*
|
|
1864
|
+
* @return Maximum width (px)
|
|
1865
|
+
*/
|
|
1866
|
+
maxWidth() {
|
|
1867
|
+
let t = this.get("maxWidth", this.getPrivate("maxWidth"));
|
|
1868
|
+
if (m(t))
|
|
1869
|
+
return t;
|
|
1870
|
+
{
|
|
1871
|
+
let i = this.get("width");
|
|
1872
|
+
if (m(i))
|
|
1873
|
+
return i;
|
|
1874
|
+
}
|
|
1875
|
+
const e = this.parent;
|
|
1876
|
+
return e ? e.innerWidth() : this._root.width();
|
|
1877
|
+
}
|
|
1878
|
+
/**
|
|
1879
|
+
* Returns maximum allowed height of this element in pixels.
|
|
1880
|
+
*
|
|
1881
|
+
* @return Maximum height (px)
|
|
1882
|
+
*/
|
|
1883
|
+
maxHeight() {
|
|
1884
|
+
let t = this.get("maxHeight", this.getPrivate("maxHeight"));
|
|
1885
|
+
if (m(t))
|
|
1886
|
+
return t;
|
|
1887
|
+
{
|
|
1888
|
+
let i = this.get("height");
|
|
1889
|
+
if (m(i))
|
|
1890
|
+
return i;
|
|
1891
|
+
}
|
|
1892
|
+
const e = this.parent;
|
|
1893
|
+
return e ? e.innerHeight() : this._root.height();
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1896
|
+
* Returns height of this element in pixels.
|
|
1897
|
+
*
|
|
1898
|
+
* @return Height (px)
|
|
1899
|
+
*/
|
|
1900
|
+
height() {
|
|
1901
|
+
let t = this.get("height"), e = this.get("maxHeight", this.getPrivate("maxHeight")), i = this.get("minHeight", this.getPrivate("minHeight")), s = this.getPrivate("height"), r = 0;
|
|
1902
|
+
if (m(s))
|
|
1903
|
+
r = s;
|
|
1904
|
+
else if (t == null)
|
|
1905
|
+
this._adjustedLocalBounds && (r = this._adjustedLocalBounds.bottom - this._adjustedLocalBounds.top);
|
|
1906
|
+
else if (t instanceof D) {
|
|
1907
|
+
const a = this.parent;
|
|
1908
|
+
a ? r = a.innerHeight() * t.value : r = this._root.height() * t.value;
|
|
1909
|
+
} else m(t) && (r = t);
|
|
1910
|
+
return m(i) && (r = Math.max(i, r)), m(e) && (r = Math.min(e, r)), r;
|
|
1911
|
+
}
|
|
1912
|
+
_findStaticTemplate(t) {
|
|
1913
|
+
return this._templateField && t(this._templateField) ? this._templateField : super._findStaticTemplate(t);
|
|
1914
|
+
}
|
|
1915
|
+
_walkParents(t) {
|
|
1916
|
+
(this._parent || this._virtualParent) && this._walkParent(t);
|
|
1917
|
+
}
|
|
1918
|
+
_walkParent(t) {
|
|
1919
|
+
this._parent ? this._parent._walkParent(t) : this._virtualParent && this._virtualParent._walkParent(t), t(this);
|
|
1920
|
+
}
|
|
1921
|
+
set virtualParent(t) {
|
|
1922
|
+
this._virtualParent = t, this._applyThemes();
|
|
1923
|
+
}
|
|
1924
|
+
/**
|
|
1925
|
+
* Parent [[Container]] of this element.
|
|
1926
|
+
*
|
|
1927
|
+
* @return Parent container
|
|
1928
|
+
*/
|
|
1929
|
+
get parent() {
|
|
1930
|
+
return this._parent;
|
|
1931
|
+
}
|
|
1932
|
+
_setParent(t, e = !1) {
|
|
1933
|
+
const i = this._parent;
|
|
1934
|
+
t !== i && (this.markDirtyBounds(), t.markDirty(), this._parent = t, e && (this._removeParent(i), t && (this._addPercentageSizeChildren(), this._addPercentagePositionChildren())), this.markDirtyPosition(), this._applyThemes());
|
|
1935
|
+
}
|
|
1936
|
+
/**
|
|
1937
|
+
* Returns an instance of [[NumberFormatter]] used in this element.
|
|
1938
|
+
*
|
|
1939
|
+
* If this element does not have it set, global one form [[Root]] is used.
|
|
1940
|
+
*
|
|
1941
|
+
* @see {@link https://www.amcharts.com/docs/v5/concepts/using-formatters/} for more info
|
|
1942
|
+
* @return NumberFormatter instace
|
|
1943
|
+
*/
|
|
1944
|
+
getNumberFormatter() {
|
|
1945
|
+
return this.get("numberFormatter", this._root.numberFormatter);
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Returns an instance of [[DateFormatter]] used in this element.
|
|
1949
|
+
*
|
|
1950
|
+
* If this element does not have it set, global one form [[Root]] is used.
|
|
1951
|
+
*
|
|
1952
|
+
* @see {@link https://www.amcharts.com/docs/v5/concepts/using-formatters/} for more info
|
|
1953
|
+
* @return DateFormatter instace
|
|
1954
|
+
*/
|
|
1955
|
+
getDateFormatter() {
|
|
1956
|
+
return this.get("dateFormatter", this._root.dateFormatter);
|
|
1957
|
+
}
|
|
1958
|
+
/**
|
|
1959
|
+
* Returns an instance of [[DurationFormatter]] used in this element.
|
|
1960
|
+
*
|
|
1961
|
+
* If this element does not have it set, global one form [[Root]] is used.
|
|
1962
|
+
*
|
|
1963
|
+
* @see {@link https://www.amcharts.com/docs/v5/concepts/using-formatters/} for more info
|
|
1964
|
+
* @return DurationFormatter instace
|
|
1965
|
+
*/
|
|
1966
|
+
getDurationFormatter() {
|
|
1967
|
+
return this.get("durationFormatter", this._root.durationFormatter);
|
|
1968
|
+
}
|
|
1969
|
+
/**
|
|
1970
|
+
* Converts X/Y coordinate within this element to a global coordinate.
|
|
1971
|
+
*
|
|
1972
|
+
* @param point Local coordinate
|
|
1973
|
+
* @return Global coordinate
|
|
1974
|
+
*/
|
|
1975
|
+
toGlobal(t) {
|
|
1976
|
+
return this._display.toGlobal(t);
|
|
1977
|
+
}
|
|
1978
|
+
/**
|
|
1979
|
+
* Converts global X/Y coordinate to a coordinate within this element.
|
|
1980
|
+
*
|
|
1981
|
+
* @param point Global coordinate
|
|
1982
|
+
* @return Local coordinate
|
|
1983
|
+
*/
|
|
1984
|
+
toLocal(t) {
|
|
1985
|
+
return this._display.toLocal(t);
|
|
1986
|
+
}
|
|
1987
|
+
_getDownPoint() {
|
|
1988
|
+
const t = this._getDownPointId();
|
|
1989
|
+
if (t)
|
|
1990
|
+
return this._downPoints[t];
|
|
1991
|
+
}
|
|
1992
|
+
_getDownPointId() {
|
|
1993
|
+
if (this._downPoints)
|
|
1994
|
+
return Lt(this._downPoints, (t, e) => t > e ? 1 : t < e ? -1 : 0)[0];
|
|
1995
|
+
}
|
|
1996
|
+
/**
|
|
1997
|
+
* Moves sprite to the end of the parent's children array.
|
|
1998
|
+
*
|
|
1999
|
+
* Depending on `layout` setting of the parten container, it may effect the
|
|
2000
|
+
* positioning or overlapping order of the elements.
|
|
2001
|
+
*/
|
|
2002
|
+
toFront() {
|
|
2003
|
+
const t = this.parent;
|
|
2004
|
+
t && t.children.moveValue(this, t.children.length - 1);
|
|
2005
|
+
}
|
|
2006
|
+
/**
|
|
2007
|
+
* Moves sprite to the beginning of the parent's children array.
|
|
2008
|
+
*
|
|
2009
|
+
* Depending on `layout` setting of the parten container, it may effect the
|
|
2010
|
+
* positioning or overlapping order of the elements.
|
|
2011
|
+
*/
|
|
2012
|
+
toBack() {
|
|
2013
|
+
const t = this.parent;
|
|
2014
|
+
t && t.children.moveValue(this, 0);
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
Object.defineProperty(O, "className", {
|
|
2018
|
+
enumerable: !0,
|
|
2019
|
+
configurable: !0,
|
|
2020
|
+
writable: !0,
|
|
2021
|
+
value: "Sprite"
|
|
2022
|
+
});
|
|
2023
|
+
Object.defineProperty(O, "classNames", {
|
|
2024
|
+
enumerable: !0,
|
|
2025
|
+
configurable: !0,
|
|
2026
|
+
writable: !0,
|
|
2027
|
+
value: F.classNames.concat([O.className])
|
|
2028
|
+
});
|
|
2029
|
+
class X extends F {
|
|
2030
|
+
constructor() {
|
|
2031
|
+
super(...arguments), Object.defineProperty(this, "_display", {
|
|
2032
|
+
enumerable: !0,
|
|
2033
|
+
configurable: !0,
|
|
2034
|
+
writable: !0,
|
|
2035
|
+
value: this._root._renderer.makeGraphics()
|
|
2036
|
+
}), Object.defineProperty(this, "_backgroundDisplay", {
|
|
2037
|
+
enumerable: !0,
|
|
2038
|
+
configurable: !0,
|
|
2039
|
+
writable: !0,
|
|
2040
|
+
value: this._root._renderer.makeGraphics()
|
|
2041
|
+
}), Object.defineProperty(this, "_clear", {
|
|
2042
|
+
enumerable: !0,
|
|
2043
|
+
configurable: !0,
|
|
2044
|
+
writable: !0,
|
|
2045
|
+
value: !1
|
|
2046
|
+
}), Object.defineProperty(this, "_pattern", {
|
|
2047
|
+
enumerable: !0,
|
|
2048
|
+
configurable: !0,
|
|
2049
|
+
writable: !0,
|
|
2050
|
+
value: void 0
|
|
2051
|
+
});
|
|
2052
|
+
}
|
|
2053
|
+
_afterNew() {
|
|
2054
|
+
super._afterNewApplyThemes();
|
|
2055
|
+
}
|
|
2056
|
+
get pattern() {
|
|
2057
|
+
return this._pattern;
|
|
2058
|
+
}
|
|
2059
|
+
_draw() {
|
|
2060
|
+
}
|
|
2061
|
+
_beforeChanged() {
|
|
2062
|
+
super._beforeChanged(), (this.isDirty("repetition") || this.isDirty("width") || this.isDirty("height") || this.isDirty("rotation") || this.isDirty("strokeWidth") || this.isDirty("strokeDasharray") || this.isDirty("strokeDashoffset") || this.isDirty("colorOpacity") || this.isDirty("fillOpacity")) && (this._clear = !0), this._checkDirtyFill();
|
|
2063
|
+
}
|
|
2064
|
+
_checkDirtyFill() {
|
|
2065
|
+
(this.isDirty("color") || this.isDirty("fill")) && (this._clear = !0);
|
|
2066
|
+
}
|
|
2067
|
+
_changed() {
|
|
2068
|
+
if (super._changed(), this._clear) {
|
|
2069
|
+
const t = this.get("repetition", ""), e = this.get("width", 100), i = this.get("height", 100), s = this.get("fill"), r = this.get("fillOpacity", 1), a = this._backgroundDisplay, o = this._display;
|
|
2070
|
+
o.clear(), a.clear(), s && r > 0 && (a.beginFill(s, r), a.drawRect(0, 0, e, i), a.endFill()), o.angle = this.get("rotation", 0), this._draw(), this._pattern = this._root._renderer.createPattern(o, a, t, e, i);
|
|
2071
|
+
}
|
|
2072
|
+
this._clear = !1;
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2075
|
+
Object.defineProperty(X, "className", {
|
|
2076
|
+
enumerable: !0,
|
|
2077
|
+
configurable: !0,
|
|
2078
|
+
writable: !0,
|
|
2079
|
+
value: "Pattern"
|
|
2080
|
+
});
|
|
2081
|
+
Object.defineProperty(X, "classNames", {
|
|
2082
|
+
enumerable: !0,
|
|
2083
|
+
configurable: !0,
|
|
2084
|
+
writable: !0,
|
|
2085
|
+
value: F.classNames.concat([X.className])
|
|
2086
|
+
});
|
|
2087
|
+
class Y extends X {
|
|
2088
|
+
constructor() {
|
|
2089
|
+
super(...arguments), Object.defineProperty(this, "_image", {
|
|
2090
|
+
enumerable: !0,
|
|
2091
|
+
configurable: !0,
|
|
2092
|
+
writable: !0,
|
|
2093
|
+
value: void 0
|
|
2094
|
+
});
|
|
2095
|
+
}
|
|
2096
|
+
_beforeChanged() {
|
|
2097
|
+
super._beforeChanged(), this._clear = !0, this.isDirty("src") && this._load();
|
|
2098
|
+
const t = this.get("canvas");
|
|
2099
|
+
t && (this.set("width", t.width), this.set("height", t.height));
|
|
2100
|
+
}
|
|
2101
|
+
_draw() {
|
|
2102
|
+
super._draw();
|
|
2103
|
+
const t = this.get("colorOpacity");
|
|
2104
|
+
t !== void 0 && (this._display.alpha = Math.max(0, t));
|
|
2105
|
+
const e = this._image;
|
|
2106
|
+
if (e) {
|
|
2107
|
+
const s = this.get("width", 100), r = this.get("height", 100), a = this.get("fit", "image");
|
|
2108
|
+
let o = 0, l = 0;
|
|
2109
|
+
a == "pattern" ? (o = s, l = r, this.markDirty()) : (o = e.width, l = e.height, a == "image" && (this.set("width", o), this.set("height", l)));
|
|
2110
|
+
const h = this.get("centered", !0);
|
|
2111
|
+
let u = 0, f = 0;
|
|
2112
|
+
h && (u = s / 2 - o / 2, f = r / 2 - l / 2), this._display.image(e, o, l, u, f);
|
|
2113
|
+
}
|
|
2114
|
+
const i = this.get("canvas");
|
|
2115
|
+
i && this._display.image(i, i.width, i.height, 0, 0);
|
|
2116
|
+
}
|
|
2117
|
+
_load() {
|
|
2118
|
+
const t = this.get("src");
|
|
2119
|
+
if (t) {
|
|
2120
|
+
const e = new Image();
|
|
2121
|
+
e.src = t, e.decode().then(() => {
|
|
2122
|
+
this._image = e, this._draw(), this.events.isEnabled("loaded") && this.events.dispatch("loaded", { type: "loaded", target: this });
|
|
2123
|
+
}).catch((i) => {
|
|
2124
|
+
});
|
|
2125
|
+
}
|
|
2126
|
+
}
|
|
2127
|
+
}
|
|
2128
|
+
Object.defineProperty(Y, "className", {
|
|
2129
|
+
enumerable: !0,
|
|
2130
|
+
configurable: !0,
|
|
2131
|
+
writable: !0,
|
|
2132
|
+
value: "PicturePattern"
|
|
2133
|
+
});
|
|
2134
|
+
Object.defineProperty(Y, "classNames", {
|
|
2135
|
+
enumerable: !0,
|
|
2136
|
+
configurable: !0,
|
|
2137
|
+
writable: !0,
|
|
2138
|
+
value: X.classNames.concat([Y.className])
|
|
2139
|
+
});
|
|
2140
|
+
var ft;
|
|
2141
|
+
(function(n) {
|
|
2142
|
+
n.ADD = "lighter", n.COLOR = "color", n.COLOR_BURN = "color-burn", n.COLOR_DODGE = "color-dodge", n.DARKEN = "darken", n.DIFFERENCE = "difference", n.DST_OVER = "destination-over", n.EXCLUSION = "exclusion", n.HARD_LIGHT = "hard-light", n.HUE = "hue", n.LIGHTEN = "lighten", n.LUMINOSITY = "luminosity", n.MULTIPLY = "multiply", n.NORMAL = "source-over", n.OVERLAY = "overlay", n.SATURATION = "saturation", n.SCREEN = "screen", n.SOFT_LIGHT = "soft-light", n.SRC_ATOP = "source-atop", n.XOR = "xor";
|
|
2143
|
+
})(ft || (ft = {}));
|
|
2144
|
+
const re = ["fill", "fillOpacity", "stroke", "strokeWidth", "strokeOpacity", "fillPattern", "strokePattern", "fillGradient", "strokeGradient", "strokeDasharray", "strokeDashoffset", "shadowBlur", "shadowColor", "shadowOpacity", "shadowOffsetX", "shadowOffsetY", "blur", "sepia", "invert", "brightness", "hue", "contrast", "saturate"];
|
|
2145
|
+
class W extends O {
|
|
2146
|
+
constructor() {
|
|
2147
|
+
super(...arguments), Object.defineProperty(this, "_display", {
|
|
2148
|
+
enumerable: !0,
|
|
2149
|
+
configurable: !0,
|
|
2150
|
+
writable: !0,
|
|
2151
|
+
value: this._root._renderer.makeGraphics()
|
|
2152
|
+
}), Object.defineProperty(this, "_clear", {
|
|
2153
|
+
enumerable: !0,
|
|
2154
|
+
configurable: !0,
|
|
2155
|
+
writable: !0,
|
|
2156
|
+
value: !1
|
|
2157
|
+
});
|
|
2158
|
+
}
|
|
2159
|
+
_beforeChanged() {
|
|
2160
|
+
if (super._beforeChanged(), (this.isDirty("draw") || this.isDirty("svgPath")) && this.markDirtyBounds(), (this.isDirty("fill") || this.isDirty("stroke") || this.isDirty("visible") || this.isDirty("forceHidden") || this.isDirty("scale") || this.isDirty("fillGradient") || this.isDirty("strokeGradient") || this.isDirty("fillPattern") || this.isDirty("strokePattern") || this.isDirty("fillOpacity") || this.isDirty("strokeOpacity") || this.isDirty("strokeWidth") || this.isDirty("draw") || this.isDirty("blendMode") || this.isDirty("strokeDasharray") || this.isDirty("strokeDashoffset") || this.isDirty("svgPath") || this.isDirty("lineJoin") || this.isDirty("lineCap") || this.isDirty("shadowColor") || this.isDirty("shadowBlur") || this.isDirty("shadowOffsetX") || this.isDirty("shadowOffsetY")) && (this._clear = !0), this._display.crisp = this.get("crisp", !1), this.isDirty("fillGradient")) {
|
|
2161
|
+
const t = this.get("fillGradient");
|
|
2162
|
+
if (t) {
|
|
2163
|
+
this._display.isMeasured = !0;
|
|
2164
|
+
const e = t.get("target");
|
|
2165
|
+
e && (this._disposers.push(e.events.on("boundschanged", () => {
|
|
2166
|
+
this._markDirtyKey("fill");
|
|
2167
|
+
})), this._disposers.push(e.events.on("positionchanged", () => {
|
|
2168
|
+
this._markDirtyKey("fill");
|
|
2169
|
+
})));
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
if (this.isDirty("strokeGradient")) {
|
|
2173
|
+
const t = this.get("strokeGradient");
|
|
2174
|
+
if (t) {
|
|
2175
|
+
this._display.isMeasured = !0;
|
|
2176
|
+
const e = t.get("target");
|
|
2177
|
+
e && (this._disposers.push(e.events.on("boundschanged", () => {
|
|
2178
|
+
this._markDirtyKey("stroke");
|
|
2179
|
+
})), this._disposers.push(e.events.on("positionchanged", () => {
|
|
2180
|
+
this._markDirtyKey("stroke");
|
|
2181
|
+
})));
|
|
2182
|
+
}
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
_changed() {
|
|
2186
|
+
if (super._changed(), this._clear) {
|
|
2187
|
+
this.markDirtyBounds(), this.markDirtyLayer(), this._display.clear();
|
|
2188
|
+
let t = this.get("strokeDasharray");
|
|
2189
|
+
m(t) && (t < 0.5 ? t = [0] : t = [t]), this._display.setLineDash(t);
|
|
2190
|
+
const e = this.get("strokeDashoffset");
|
|
2191
|
+
e && this._display.setLineDashOffset(e);
|
|
2192
|
+
const i = this.get("blendMode", ft.NORMAL);
|
|
2193
|
+
this._display.blendMode = i;
|
|
2194
|
+
const s = this.get("draw");
|
|
2195
|
+
s && typeof s == "function" && s(this._display, this);
|
|
2196
|
+
const r = this.get("svgPath");
|
|
2197
|
+
r != null && this._display.svgPath(r);
|
|
2198
|
+
}
|
|
2199
|
+
}
|
|
2200
|
+
_afterChanged() {
|
|
2201
|
+
if (super._afterChanged(), this._clear) {
|
|
2202
|
+
const t = this.get("fill"), e = this.get("fillGradient"), i = this.get("fillPattern"), s = this.get("fillOpacity"), r = this.get("stroke"), a = this.get("strokeGradient"), o = this.get("strokePattern"), l = this.get("shadowColor"), h = this.get("shadowBlur"), u = this.get("shadowOffsetX"), f = this.get("shadowOffsetY"), d = this.get("shadowOpacity");
|
|
2203
|
+
if (l && (h || u || f) && this._display.shadow(l, h, u, f, d), t && !e && (this._display.beginFill(t, s), this._display.endFill()), e) {
|
|
2204
|
+
if (t) {
|
|
2205
|
+
const g = e.get("stops", []);
|
|
2206
|
+
g.length && w(g, (_) => {
|
|
2207
|
+
(!_.color || _.colorInherited) && t && (_.color = t, _.colorInherited = !0), (_.opacity == null || _.opacityInherited) && (_.opacity = s, _.opacityInherited = !0);
|
|
2208
|
+
});
|
|
2209
|
+
}
|
|
2210
|
+
const p = e.getFill(this);
|
|
2211
|
+
p && (this._display.beginFill(p, s), this._display.endFill());
|
|
2212
|
+
}
|
|
2213
|
+
if (i) {
|
|
2214
|
+
const p = i.pattern;
|
|
2215
|
+
p && (this._display.beginFill(p, s), this._display.endFill(), i instanceof Y && i.events.once("loaded", () => {
|
|
2216
|
+
this._clear = !0, this.markDirty();
|
|
2217
|
+
}));
|
|
2218
|
+
}
|
|
2219
|
+
if (r || a || o) {
|
|
2220
|
+
const p = this.get("strokeOpacity");
|
|
2221
|
+
let g = this.get("strokeWidth", 1);
|
|
2222
|
+
this.get("nonScalingStroke") && (g = g / this.get("scale", 1)), this.get("crisp") && (g /= this._root._renderer.resolution);
|
|
2223
|
+
const _ = this.get("lineJoin"), v = this.get("lineCap");
|
|
2224
|
+
if (r && !a && (this._display.lineStyle(g, r, p, _, v), this._display.endStroke()), a) {
|
|
2225
|
+
const c = a.get("stops", []);
|
|
2226
|
+
c.length && w(c, (y) => {
|
|
2227
|
+
(!y.color || y.colorInherited) && r && (y.color = r, y.colorInherited = !0), (y.opacity == null || y.opacityInherited) && (y.opacity = p, y.opacityInherited = !0);
|
|
2228
|
+
});
|
|
2229
|
+
const b = a.getFill(this);
|
|
2230
|
+
b && (this._display.lineStyle(g, b, p, _, v), this._display.endStroke());
|
|
2231
|
+
}
|
|
2232
|
+
if (o) {
|
|
2233
|
+
let c = o.pattern;
|
|
2234
|
+
c && (this._display.lineStyle(g, c, p, _, v), this._display.endStroke(), o instanceof Y && o.events.once("loaded", () => {
|
|
2235
|
+
this._clear = !0, this.markDirty();
|
|
2236
|
+
}));
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
this.getPrivate("showingTooltip") && this.showTooltip();
|
|
2240
|
+
}
|
|
2241
|
+
this._clear = !1;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
Object.defineProperty(W, "className", {
|
|
2245
|
+
enumerable: !0,
|
|
2246
|
+
configurable: !0,
|
|
2247
|
+
writable: !0,
|
|
2248
|
+
value: "Graphics"
|
|
2249
|
+
});
|
|
2250
|
+
Object.defineProperty(W, "classNames", {
|
|
2251
|
+
enumerable: !0,
|
|
2252
|
+
configurable: !0,
|
|
2253
|
+
writable: !0,
|
|
2254
|
+
value: O.classNames.concat([W.className])
|
|
2255
|
+
});
|
|
2256
|
+
class U extends W {
|
|
2257
|
+
_afterNew() {
|
|
2258
|
+
super._afterNew(), this._display.isMeasured = !0, this.setPrivateRaw("trustBounds", !0);
|
|
2259
|
+
}
|
|
2260
|
+
_beforeChanged() {
|
|
2261
|
+
super._beforeChanged(), (this.isDirty("width") || this.isDirty("height") || this.isPrivateDirty("width") || this.isPrivateDirty("height")) && (this._clear = !0);
|
|
2262
|
+
}
|
|
2263
|
+
_changed() {
|
|
2264
|
+
super._changed(), this._clear && !this.get("draw") && this._draw();
|
|
2265
|
+
}
|
|
2266
|
+
_draw() {
|
|
2267
|
+
let t = this.width(), e = this.height(), i = 0, s = 0, r = t / Math.abs(t), a = e / Math.abs(e);
|
|
2268
|
+
if (this.get("containStroke", !1)) {
|
|
2269
|
+
const o = this.get("strokeWidth", 0);
|
|
2270
|
+
t -= o * r, e -= o * a, i += o / 2 * r, s += o / 2 * a;
|
|
2271
|
+
}
|
|
2272
|
+
this._display.drawRect(i, s, t, e);
|
|
2273
|
+
}
|
|
2274
|
+
_updateSize() {
|
|
2275
|
+
this.markDirty(), this._clear = !0;
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
Object.defineProperty(U, "className", {
|
|
2279
|
+
enumerable: !0,
|
|
2280
|
+
configurable: !0,
|
|
2281
|
+
writable: !0,
|
|
2282
|
+
value: "Rectangle"
|
|
2283
|
+
});
|
|
2284
|
+
Object.defineProperty(U, "classNames", {
|
|
2285
|
+
enumerable: !0,
|
|
2286
|
+
configurable: !0,
|
|
2287
|
+
writable: !0,
|
|
2288
|
+
value: W.classNames.concat([U.className])
|
|
2289
|
+
});
|
|
2290
|
+
function j(n, t) {
|
|
2291
|
+
n.get("reverseChildren", !1) ? n.children.eachReverse(t) : n.children.each(t);
|
|
2292
|
+
}
|
|
2293
|
+
class E extends F {
|
|
2294
|
+
}
|
|
2295
|
+
Object.defineProperty(E, "className", {
|
|
2296
|
+
enumerable: !0,
|
|
2297
|
+
configurable: !0,
|
|
2298
|
+
writable: !0,
|
|
2299
|
+
value: "Layout"
|
|
2300
|
+
});
|
|
2301
|
+
Object.defineProperty(E, "classNames", {
|
|
2302
|
+
enumerable: !0,
|
|
2303
|
+
configurable: !0,
|
|
2304
|
+
writable: !0,
|
|
2305
|
+
value: F.classNames.concat([E.className])
|
|
2306
|
+
});
|
|
2307
|
+
class K extends E {
|
|
2308
|
+
/**
|
|
2309
|
+
* @ignore
|
|
2310
|
+
*/
|
|
2311
|
+
updateContainer(t) {
|
|
2312
|
+
let e = t.get("paddingLeft", 0), i = t.innerWidth(), s = 0;
|
|
2313
|
+
j(t, (a) => {
|
|
2314
|
+
if (a.isVisible() && a.get("position") == "relative") {
|
|
2315
|
+
let o = a.get("width");
|
|
2316
|
+
if (o instanceof D) {
|
|
2317
|
+
s += o.value;
|
|
2318
|
+
let l = i * o.value, h = a.get("minWidth", a.getPrivate("minWidth", -1 / 0));
|
|
2319
|
+
h > l && (i -= h, s -= o.value);
|
|
2320
|
+
let u = a.get("maxWidth", a.getPrivate("maxWidth", 1 / 0));
|
|
2321
|
+
l > u && (i -= u, s -= o.value);
|
|
2322
|
+
} else
|
|
2323
|
+
m(o) || (o = a.width()), i -= o + a.get("marginLeft", 0) + a.get("marginRight", 0);
|
|
2324
|
+
}
|
|
2325
|
+
}), (i <= 0 || i == 1 / 0) && (i = 0.1), j(t, (a) => {
|
|
2326
|
+
if (a.isVisible() && a.get("position") == "relative") {
|
|
2327
|
+
let o = a.get("width");
|
|
2328
|
+
if (o instanceof D) {
|
|
2329
|
+
let l = i * o.value / s - a.get("marginLeft", 0) - a.get("marginRight", 0), h = a.get("minWidth", a.getPrivate("minWidth", -1 / 0)), u = a.get("maxWidth", a.getPrivate("maxWidth", 1 / 0));
|
|
2330
|
+
l = Math.min(Math.max(h, l), u), a.setPrivate("width", l);
|
|
2331
|
+
} else
|
|
2332
|
+
a._prevSettings.width instanceof D && a.setPrivate("width", void 0);
|
|
2333
|
+
}
|
|
2334
|
+
});
|
|
2335
|
+
let r = e;
|
|
2336
|
+
j(t, (a) => {
|
|
2337
|
+
if (a.get("position") == "relative")
|
|
2338
|
+
if (a.isVisible()) {
|
|
2339
|
+
let o = a.adjustedLocalBounds(), l = a.get("marginLeft", 0), h = a.get("marginRight", 0), u = a.get("maxWidth"), f = o.left, d = o.right;
|
|
2340
|
+
u && d - f > u && (d = f + u);
|
|
2341
|
+
let p = r + l - f;
|
|
2342
|
+
a.setPrivate("x", p), r = p + d + h;
|
|
2343
|
+
} else
|
|
2344
|
+
a.setPrivate("x", void 0);
|
|
2345
|
+
});
|
|
2346
|
+
}
|
|
2347
|
+
}
|
|
2348
|
+
Object.defineProperty(K, "className", {
|
|
2349
|
+
enumerable: !0,
|
|
2350
|
+
configurable: !0,
|
|
2351
|
+
writable: !0,
|
|
2352
|
+
value: "HorizontalLayout"
|
|
2353
|
+
});
|
|
2354
|
+
Object.defineProperty(K, "classNames", {
|
|
2355
|
+
enumerable: !0,
|
|
2356
|
+
configurable: !0,
|
|
2357
|
+
writable: !0,
|
|
2358
|
+
value: E.classNames.concat([K.className])
|
|
2359
|
+
});
|
|
2360
|
+
class $ extends E {
|
|
2361
|
+
/**
|
|
2362
|
+
* @ignore
|
|
2363
|
+
*/
|
|
2364
|
+
updateContainer(t) {
|
|
2365
|
+
let e = t.get("paddingTop", 0), i = t.innerHeight(), s = 0;
|
|
2366
|
+
j(t, (a) => {
|
|
2367
|
+
if (a.isVisible() && a.get("position") == "relative") {
|
|
2368
|
+
let o = a.get("height");
|
|
2369
|
+
if (o instanceof D) {
|
|
2370
|
+
s += o.value;
|
|
2371
|
+
let l = i * o.value, h = a.get("minHeight", a.getPrivate("minHeight", -1 / 0));
|
|
2372
|
+
h > l && (i -= h, s -= o.value);
|
|
2373
|
+
let u = a.get("maxHeight", a.getPrivate("maxHeight", 1 / 0));
|
|
2374
|
+
l > u && (i -= u, s -= o.value);
|
|
2375
|
+
} else
|
|
2376
|
+
m(o) || (o = a.height()), i -= o + a.get("marginTop", 0) + a.get("marginBottom", 0);
|
|
2377
|
+
}
|
|
2378
|
+
}), (i <= 0 || i == 1 / 0) && (i = 0.1), j(t, (a) => {
|
|
2379
|
+
if (a.isVisible() && a.get("position") == "relative") {
|
|
2380
|
+
let o = a.get("height");
|
|
2381
|
+
if (o instanceof D) {
|
|
2382
|
+
let l = i * o.value / s - a.get("marginTop", 0) - a.get("marginBottom", 0), h = a.get("minHeight", a.getPrivate("minHeight", -1 / 0)), u = a.get("maxHeight", a.getPrivate("maxHeight", 1 / 0));
|
|
2383
|
+
l = Math.min(Math.max(h, l), u), a.setPrivate("height", l);
|
|
2384
|
+
} else
|
|
2385
|
+
a._prevSettings.height instanceof D && a.setPrivate("height", void 0);
|
|
2386
|
+
}
|
|
2387
|
+
});
|
|
2388
|
+
let r = e;
|
|
2389
|
+
j(t, (a) => {
|
|
2390
|
+
if (a.get("position") == "relative")
|
|
2391
|
+
if (a.isVisible()) {
|
|
2392
|
+
let o = a.adjustedLocalBounds(), l = a.get("marginTop", 0), h = o.top, u = o.bottom, f = a.get("maxHeight");
|
|
2393
|
+
f && u - h > f && (u = h + f);
|
|
2394
|
+
let d = a.get("marginBottom", 0), p = r + l - h;
|
|
2395
|
+
a.setPrivate("y", p), r = p + u + d;
|
|
2396
|
+
} else
|
|
2397
|
+
a.setPrivate("y", void 0);
|
|
2398
|
+
});
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
Object.defineProperty($, "className", {
|
|
2402
|
+
enumerable: !0,
|
|
2403
|
+
configurable: !0,
|
|
2404
|
+
writable: !0,
|
|
2405
|
+
value: "VerticalLayout"
|
|
2406
|
+
});
|
|
2407
|
+
Object.defineProperty($, "classNames", {
|
|
2408
|
+
enumerable: !0,
|
|
2409
|
+
configurable: !0,
|
|
2410
|
+
writable: !0,
|
|
2411
|
+
value: E.classNames.concat([$.className])
|
|
2412
|
+
});
|
|
2413
|
+
class J extends E {
|
|
2414
|
+
_afterNew() {
|
|
2415
|
+
this._setRawDefault("maxColumns", Number.MAX_VALUE), super._afterNew();
|
|
2416
|
+
}
|
|
2417
|
+
/**
|
|
2418
|
+
* @ignore
|
|
2419
|
+
*/
|
|
2420
|
+
updateContainer(t) {
|
|
2421
|
+
let e = t.get("paddingLeft", 0), i = t.get("paddingRight", 0), s = t.get("paddingTop", 0), r = t.maxWidth() - e - i, a = r, o = 1;
|
|
2422
|
+
j(t, (g) => {
|
|
2423
|
+
if (g.get("visible") && g.getPrivate("visible") && !g.get("forceHidden") && g.get("position") != "absolute") {
|
|
2424
|
+
let _ = g.width();
|
|
2425
|
+
_ < a && (a = _), _ > o && (o = _);
|
|
2426
|
+
}
|
|
2427
|
+
}), a = T(a, 1, r), o = T(o, 1, r);
|
|
2428
|
+
let l = 1;
|
|
2429
|
+
this.get("fixedWidthGrid") ? l = r / o : l = r / a, l = Math.max(1, Math.floor(l)), l = Math.min(this.get("maxColumns", Number.MAX_VALUE), l);
|
|
2430
|
+
let h = this.getColumnWidths(t, l, o, r), u = s, f = 0, d = 0;
|
|
2431
|
+
l = h.length;
|
|
2432
|
+
let p = e;
|
|
2433
|
+
j(t, (g) => {
|
|
2434
|
+
if (g.get("position") == "relative" && g.isVisible()) {
|
|
2435
|
+
const _ = g.get("marginTop", 0), v = g.get("marginBottom", 0);
|
|
2436
|
+
let c = g.adjustedLocalBounds(), b = g.get("marginLeft", 0), y = g.get("marginRight", 0), x = p + b - c.left, k = u + _ - c.top;
|
|
2437
|
+
g.setPrivate("x", x), g.setPrivate("y", k), p += h[f] + y, d = Math.max(d, g.height() + _ + v), f++, f >= l && (f = 0, p = e, u += d, d = 0);
|
|
2438
|
+
}
|
|
2439
|
+
});
|
|
2440
|
+
}
|
|
2441
|
+
/**
|
|
2442
|
+
* @ignore
|
|
2443
|
+
*/
|
|
2444
|
+
getColumnWidths(t, e, i, s) {
|
|
2445
|
+
let r = 0, a = [], o = 0;
|
|
2446
|
+
return j(t, (l) => {
|
|
2447
|
+
let h = l.adjustedLocalBounds();
|
|
2448
|
+
l.get("position") != "absolute" && l.isVisible() && (this.get("fixedWidthGrid") ? a[o] = i : a[o] = Math.max(a[o] | 0, h.right - h.left + l.get("marginLeft", 0) + l.get("marginRight", 0)), o < t.children.length - 1 && (o++, o == e && (o = 0)));
|
|
2449
|
+
}), w(a, (l) => {
|
|
2450
|
+
r += l;
|
|
2451
|
+
}), r > s ? e > 2 ? (e -= 1, this.getColumnWidths(t, e, i, s)) : [s] : a;
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
Object.defineProperty(J, "className", {
|
|
2455
|
+
enumerable: !0,
|
|
2456
|
+
configurable: !0,
|
|
2457
|
+
writable: !0,
|
|
2458
|
+
value: "GridLayout"
|
|
2459
|
+
});
|
|
2460
|
+
Object.defineProperty(J, "classNames", {
|
|
2461
|
+
enumerable: !0,
|
|
2462
|
+
configurable: !0,
|
|
2463
|
+
writable: !0,
|
|
2464
|
+
value: E.classNames.concat([J.className])
|
|
2465
|
+
});
|
|
2466
|
+
class ct {
|
|
2467
|
+
/**
|
|
2468
|
+
* Replaces brackets with temporary placeholders.
|
|
2469
|
+
*
|
|
2470
|
+
* @ignore Exclude from docs
|
|
2471
|
+
* @param text Input text
|
|
2472
|
+
* @return Escaped text
|
|
2473
|
+
*/
|
|
2474
|
+
static escape(t) {
|
|
2475
|
+
return t.replace(/\[\[/g, this.prefix + "1").replace(/([^\/\]]{1})\]\]/g, "$1" + this.prefix + "2").replace(/\]\]/g, this.prefix + "2").replace(/\{\{/g, this.prefix + "3").replace(/\}\}/g, this.prefix + "4").replace(/\'\'/g, this.prefix + "5");
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* Replaces placeholders back to brackets.
|
|
2479
|
+
*
|
|
2480
|
+
* @ignore Exclude from docs
|
|
2481
|
+
* @param text Escaped text
|
|
2482
|
+
* @return Unescaped text
|
|
2483
|
+
*/
|
|
2484
|
+
static unescape(t) {
|
|
2485
|
+
return t.replace(new RegExp(this.prefix + "1", "g"), "[[").replace(new RegExp(this.prefix + "2", "g"), "]]").replace(new RegExp(this.prefix + "3", "g"), "{{").replace(new RegExp(this.prefix + "4", "g"), "}}").replace(new RegExp(this.prefix + "5", "g"), "''");
|
|
2486
|
+
}
|
|
2487
|
+
/**
|
|
2488
|
+
* Cleans up the text text for leftover double square brackets.
|
|
2489
|
+
*
|
|
2490
|
+
* @ignore Exclude from docs
|
|
2491
|
+
* @param text Input text
|
|
2492
|
+
* @return Cleaned up text
|
|
2493
|
+
*/
|
|
2494
|
+
static cleanUp(t) {
|
|
2495
|
+
return t.replace(/\[\[/g, "[").replace(/\]\]/g, "]").replace(/\{\{/g, "{").replace(/\}\}/g, "}").replace(/\'\'/g, "'");
|
|
2496
|
+
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Splits string into chunks. (style blocks, quoted blocks, regular blocks)
|
|
2499
|
+
*
|
|
2500
|
+
* If the second parameter `quotedBlocks` is set to `true` this method will
|
|
2501
|
+
* also single out text blocks enclosed within single quotes that no
|
|
2502
|
+
* formatting should be applied to, and they should be displayed as is.
|
|
2503
|
+
*
|
|
2504
|
+
* Default for the above is `false`, so that you can use single quote in text
|
|
2505
|
+
* without escaping it.
|
|
2506
|
+
*
|
|
2507
|
+
* If enabled, single quotes can be escaped by doubling it - adding two
|
|
2508
|
+
* single quotes, which will be replaced by a one single quote in the final
|
|
2509
|
+
* output.
|
|
2510
|
+
*
|
|
2511
|
+
* @ignore Exclude from docs
|
|
2512
|
+
* @param text Text to chunk
|
|
2513
|
+
* @param quotedBlocks Use quoted blocks
|
|
2514
|
+
* @param noFormatting Formatting blocks will be treated as regular text
|
|
2515
|
+
* @return Array of string chunks
|
|
2516
|
+
*/
|
|
2517
|
+
static chunk(t, e = !1, i = !1) {
|
|
2518
|
+
let s = [];
|
|
2519
|
+
t = this.escape(t);
|
|
2520
|
+
let r = e ? t.split("'") : [t];
|
|
2521
|
+
for (let a = 0; a < r.length; a++) {
|
|
2522
|
+
let o = r[a];
|
|
2523
|
+
if (o !== "")
|
|
2524
|
+
if (a % 2 === 0) {
|
|
2525
|
+
o = o.replace(/\]\[/g, "]" + xt + "["), o = o.replace(/\[\]/g, "[ ]");
|
|
2526
|
+
let l = o.split(/[\[\]]+/);
|
|
2527
|
+
for (let h = 0; h < l.length; h++) {
|
|
2528
|
+
let u = this.cleanUp(this.unescape(l[h]));
|
|
2529
|
+
u !== xt && u !== "" && (h % 2 === 0 ? s.push({
|
|
2530
|
+
type: "value",
|
|
2531
|
+
text: u
|
|
2532
|
+
}) : s.push({
|
|
2533
|
+
type: i ? "value" : "format",
|
|
2534
|
+
text: "[" + u + "]"
|
|
2535
|
+
}));
|
|
2536
|
+
}
|
|
2537
|
+
} else {
|
|
2538
|
+
let l = o.split(/[\[\]]+/);
|
|
2539
|
+
for (let h = 0; h < l.length; h++) {
|
|
2540
|
+
let u = this.cleanUp(this.unescape(l[h]));
|
|
2541
|
+
u !== "" && (h % 2 === 0 ? s.push({
|
|
2542
|
+
type: "text",
|
|
2543
|
+
text: u
|
|
2544
|
+
}) : this.isImage(u) ? s.push({
|
|
2545
|
+
type: "image",
|
|
2546
|
+
text: "[" + u + "]"
|
|
2547
|
+
}) : s.push({
|
|
2548
|
+
type: "format",
|
|
2549
|
+
text: "[" + u + "]"
|
|
2550
|
+
}));
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
return s;
|
|
2555
|
+
}
|
|
2556
|
+
/**
|
|
2557
|
+
* Checks if supplied format contains image information and should be
|
|
2558
|
+
* formatted as such.
|
|
2559
|
+
* I.e.: `[img: myImage.png]`
|
|
2560
|
+
*
|
|
2561
|
+
* @ignore
|
|
2562
|
+
* @param text Format
|
|
2563
|
+
* @return true if it is an image
|
|
2564
|
+
*/
|
|
2565
|
+
static isImage(t) {
|
|
2566
|
+
return !!t.match(/img[ ]?:/);
|
|
2567
|
+
}
|
|
2568
|
+
static getTextStyle(t) {
|
|
2569
|
+
let e = {};
|
|
2570
|
+
if (t == "" || t == "[ ]")
|
|
2571
|
+
return {};
|
|
2572
|
+
const i = t.match(/('[^']*')|("[^"]*")/gi);
|
|
2573
|
+
if (i)
|
|
2574
|
+
for (let r = 0; r < i.length; r++)
|
|
2575
|
+
t = t.replace(i[r], i[r].replace(/['"]*/g, "").replace(/[ ]+/g, "+"));
|
|
2576
|
+
let s = t.match(/([\w\-]*:[\s]?[^;\s\]]*)|(\#[\w]{1,6})|([\w\-]+)|(\/)/gi);
|
|
2577
|
+
if (!s)
|
|
2578
|
+
return {};
|
|
2579
|
+
for (let r = 0; r < s.length; r++)
|
|
2580
|
+
if (s[r].match(/^(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)$/i))
|
|
2581
|
+
e.fontWeight = s[r];
|
|
2582
|
+
else if (s[r].match(/^(underline|line-through)$/i))
|
|
2583
|
+
e.textDecoration = s[r];
|
|
2584
|
+
else if (s[r] != "/") if (!s[r].match(/:/))
|
|
2585
|
+
e.fill = ht.fromString(s[r]);
|
|
2586
|
+
else {
|
|
2587
|
+
const a = s[r].replace("+", " ").split(/:[ ]*/);
|
|
2588
|
+
e[a[0]] = a[1];
|
|
2589
|
+
}
|
|
2590
|
+
return e;
|
|
2591
|
+
}
|
|
2592
|
+
}
|
|
2593
|
+
Object.defineProperty(ct, "prefix", {
|
|
2594
|
+
enumerable: !0,
|
|
2595
|
+
configurable: !0,
|
|
2596
|
+
writable: !0,
|
|
2597
|
+
value: "__amcharts__"
|
|
2598
|
+
});
|
|
2599
|
+
function tt(n, t) {
|
|
2600
|
+
if (t != null) {
|
|
2601
|
+
t = "" + t, t = ct.escape(t);
|
|
2602
|
+
let e = t.match(/\{([^}]+)\}/g), i;
|
|
2603
|
+
if (e)
|
|
2604
|
+
for (i = 0; i < e.length; i++) {
|
|
2605
|
+
let s = e[i].replace(/\{([^}]+)\}/, "$1"), r = gt(n, s);
|
|
2606
|
+
r == null && (r = ""), t = t.split(e[i]).join(r);
|
|
2607
|
+
}
|
|
2608
|
+
t = ct.unescape(t);
|
|
2609
|
+
} else
|
|
2610
|
+
t = "";
|
|
2611
|
+
return t;
|
|
2612
|
+
}
|
|
2613
|
+
function gt(n, t, e) {
|
|
2614
|
+
let i;
|
|
2615
|
+
const s = n.dataItem;
|
|
2616
|
+
let r = [], a = /(format[a-zA-Z]*)\((.*)\)|([^.]+)/g, o;
|
|
2617
|
+
for (; o = a.exec(t), o !== null; )
|
|
2618
|
+
if (o[3]) {
|
|
2619
|
+
r.push({
|
|
2620
|
+
prop: o[3]
|
|
2621
|
+
});
|
|
2622
|
+
const l = n.getDateFormatter().get("dateFields", []), h = n.getNumberFormatter().get("numericFields", []), u = n.getDurationFormatter().get("durationFields", []);
|
|
2623
|
+
l.indexOf(o[3]) !== -1 ? r.push({
|
|
2624
|
+
method: "formatDate",
|
|
2625
|
+
params: []
|
|
2626
|
+
}) : h.indexOf(o[3]) !== -1 ? r.push({
|
|
2627
|
+
method: "formatNumber",
|
|
2628
|
+
params: []
|
|
2629
|
+
}) : u.indexOf(o[3]) !== -1 && r.push({
|
|
2630
|
+
method: "formatDuration",
|
|
2631
|
+
params: []
|
|
2632
|
+
});
|
|
2633
|
+
} else {
|
|
2634
|
+
let l = [];
|
|
2635
|
+
if (Mt(o[2]) != "") {
|
|
2636
|
+
let h = /'([^']*)'|"([^"]*)"|([0-9\-]+)/g, u;
|
|
2637
|
+
for (; u = h.exec(o[2]), u !== null; )
|
|
2638
|
+
l.push(u[1] || u[2] || u[3]);
|
|
2639
|
+
}
|
|
2640
|
+
r.push({
|
|
2641
|
+
method: o[1],
|
|
2642
|
+
params: l
|
|
2643
|
+
});
|
|
2644
|
+
}
|
|
2645
|
+
if (s) {
|
|
2646
|
+
i = M(n, r, s._settings), (i == null || bt(i)) && (i = M(n, r, s));
|
|
2647
|
+
let l = s.dataContext;
|
|
2648
|
+
i == null && l && (i = M(n, r, l), i == null && (i = M(n, [{
|
|
2649
|
+
prop: t
|
|
2650
|
+
}], l)), i == null && l.dataContext && (i = M(n, r, l.dataContext))), i == null && s.component && s.component.dataItem !== s && (i = gt(s.component, t));
|
|
2651
|
+
}
|
|
2652
|
+
return i == null && (i = M(n, r, n)), i == null && n.parent && (i = gt(n.parent, t)), i;
|
|
2653
|
+
}
|
|
2654
|
+
function $t(n, t) {
|
|
2655
|
+
const e = n.getPrivate("customData");
|
|
2656
|
+
if (bt(e))
|
|
2657
|
+
return e[t];
|
|
2658
|
+
}
|
|
2659
|
+
function M(n, t, e, i) {
|
|
2660
|
+
let s = e, r = !1;
|
|
2661
|
+
for (let a = 0, o = t.length; a < o; a++) {
|
|
2662
|
+
let l = t[a];
|
|
2663
|
+
if (l.prop) {
|
|
2664
|
+
if (s instanceof O) {
|
|
2665
|
+
let h = s.get(l.prop);
|
|
2666
|
+
h == null && (h = s.getPrivate(l.prop)), h == null && (h = $t(s, l.prop)), h == null && (h = s[l.prop]), s = h;
|
|
2667
|
+
} else if (s.get) {
|
|
2668
|
+
let h = s.get(l.prop);
|
|
2669
|
+
h == null && (h = s[l.prop]), s = h;
|
|
2670
|
+
} else
|
|
2671
|
+
s = s[l.prop];
|
|
2672
|
+
if (s == null)
|
|
2673
|
+
return;
|
|
2674
|
+
} else
|
|
2675
|
+
switch (l.method) {
|
|
2676
|
+
case "formatNumber":
|
|
2677
|
+
let h = Pt(s);
|
|
2678
|
+
h != null && (s = n.getNumberFormatter().format(h, l.params[0] || void 0), r = !0);
|
|
2679
|
+
break;
|
|
2680
|
+
case "formatDate":
|
|
2681
|
+
let u = Bt(s);
|
|
2682
|
+
if (!kt(u) || Wt(u.getTime()))
|
|
2683
|
+
return;
|
|
2684
|
+
u != null && (s = n.getDateFormatter().format(u, l.params[0] || void 0), r = !0);
|
|
2685
|
+
break;
|
|
2686
|
+
case "formatDuration":
|
|
2687
|
+
let f = Pt(s);
|
|
2688
|
+
f != null && (s = n.getDurationFormatter().format(f, l.params[0] || void 0, l.params[1] || void 0), r = !0);
|
|
2689
|
+
break;
|
|
2690
|
+
case "urlEncode":
|
|
2691
|
+
case "encodeURIComponent":
|
|
2692
|
+
s = encodeURIComponent(s);
|
|
2693
|
+
break;
|
|
2694
|
+
default:
|
|
2695
|
+
s[l.method] && s[l.method].apply(e, l.params);
|
|
2696
|
+
break;
|
|
2697
|
+
}
|
|
2698
|
+
}
|
|
2699
|
+
if (!r) {
|
|
2700
|
+
let a = [{
|
|
2701
|
+
method: "",
|
|
2702
|
+
params: i
|
|
2703
|
+
}];
|
|
2704
|
+
m(s) ? (a[0].method = "formatNumber", a[0].params = "") : kt(s) && (a[0].method = "formatDate", a[0].params = ""), a[0].method && (s = M(n, a, s));
|
|
2705
|
+
}
|
|
2706
|
+
return s;
|
|
2707
|
+
}
|
|
2708
|
+
class S extends O {
|
|
2709
|
+
constructor() {
|
|
2710
|
+
super(...arguments), Object.defineProperty(this, "_display", {
|
|
2711
|
+
enumerable: !0,
|
|
2712
|
+
configurable: !0,
|
|
2713
|
+
writable: !0,
|
|
2714
|
+
value: this._root._renderer.makeContainer()
|
|
2715
|
+
}), Object.defineProperty(this, "_childrenDisplay", {
|
|
2716
|
+
enumerable: !0,
|
|
2717
|
+
configurable: !0,
|
|
2718
|
+
writable: !0,
|
|
2719
|
+
value: this._root._renderer.makeContainer()
|
|
2720
|
+
}), Object.defineProperty(this, "children", {
|
|
2721
|
+
enumerable: !0,
|
|
2722
|
+
configurable: !0,
|
|
2723
|
+
writable: !0,
|
|
2724
|
+
value: new zt(this)
|
|
2725
|
+
}), Object.defineProperty(this, "_percentageSizeChildren", {
|
|
2726
|
+
enumerable: !0,
|
|
2727
|
+
configurable: !0,
|
|
2728
|
+
writable: !0,
|
|
2729
|
+
value: []
|
|
2730
|
+
}), Object.defineProperty(this, "_percentagePositionChildren", {
|
|
2731
|
+
enumerable: !0,
|
|
2732
|
+
configurable: !0,
|
|
2733
|
+
writable: !0,
|
|
2734
|
+
value: []
|
|
2735
|
+
}), Object.defineProperty(this, "_prevWidth", {
|
|
2736
|
+
enumerable: !0,
|
|
2737
|
+
configurable: !0,
|
|
2738
|
+
writable: !0,
|
|
2739
|
+
value: 0
|
|
2740
|
+
}), Object.defineProperty(this, "_prevHeight", {
|
|
2741
|
+
enumerable: !0,
|
|
2742
|
+
configurable: !0,
|
|
2743
|
+
writable: !0,
|
|
2744
|
+
value: 0
|
|
2745
|
+
}), Object.defineProperty(this, "_contentWidth", {
|
|
2746
|
+
enumerable: !0,
|
|
2747
|
+
configurable: !0,
|
|
2748
|
+
writable: !0,
|
|
2749
|
+
value: 0
|
|
2750
|
+
}), Object.defineProperty(this, "_contentHeight", {
|
|
2751
|
+
enumerable: !0,
|
|
2752
|
+
configurable: !0,
|
|
2753
|
+
writable: !0,
|
|
2754
|
+
value: 0
|
|
2755
|
+
}), Object.defineProperty(this, "_contentMask", {
|
|
2756
|
+
enumerable: !0,
|
|
2757
|
+
configurable: !0,
|
|
2758
|
+
writable: !0,
|
|
2759
|
+
value: void 0
|
|
2760
|
+
}), Object.defineProperty(this, "_vsbd0", {
|
|
2761
|
+
enumerable: !0,
|
|
2762
|
+
configurable: !0,
|
|
2763
|
+
writable: !0,
|
|
2764
|
+
value: void 0
|
|
2765
|
+
}), Object.defineProperty(this, "_vsbd1", {
|
|
2766
|
+
enumerable: !0,
|
|
2767
|
+
configurable: !0,
|
|
2768
|
+
writable: !0,
|
|
2769
|
+
value: void 0
|
|
2770
|
+
}), Object.defineProperty(this, "_hsbd0", {
|
|
2771
|
+
enumerable: !0,
|
|
2772
|
+
configurable: !0,
|
|
2773
|
+
writable: !0,
|
|
2774
|
+
value: void 0
|
|
2775
|
+
}), Object.defineProperty(this, "_hsbd1", {
|
|
2776
|
+
enumerable: !0,
|
|
2777
|
+
configurable: !0,
|
|
2778
|
+
writable: !0,
|
|
2779
|
+
value: void 0
|
|
2780
|
+
}), Object.defineProperty(this, "_childrenPrep", {
|
|
2781
|
+
enumerable: !0,
|
|
2782
|
+
configurable: !0,
|
|
2783
|
+
writable: !0,
|
|
2784
|
+
value: !1
|
|
2785
|
+
}), Object.defineProperty(this, "_childrenUpdt", {
|
|
2786
|
+
enumerable: !0,
|
|
2787
|
+
configurable: !0,
|
|
2788
|
+
writable: !0,
|
|
2789
|
+
value: !1
|
|
2790
|
+
});
|
|
2791
|
+
}
|
|
2792
|
+
_afterNew() {
|
|
2793
|
+
super._afterNew(), this._display.addChild(this._childrenDisplay);
|
|
2794
|
+
}
|
|
2795
|
+
_afterChanged() {
|
|
2796
|
+
super._afterChanged(), this._childrenPrep = !1, this._childrenUpdt = !1;
|
|
2797
|
+
}
|
|
2798
|
+
_dispose() {
|
|
2799
|
+
Ot(this.allChildren(), (t) => {
|
|
2800
|
+
t.dispose();
|
|
2801
|
+
}), this.getPrivate("htmlElement") && this._root._removeHTMLContent(this), super._dispose();
|
|
2802
|
+
}
|
|
2803
|
+
_beforeChanged() {
|
|
2804
|
+
this._childrenPrep || this._prepareChildren(), this._childrenUpdt || this._updateChildren(), super._beforeChanged();
|
|
2805
|
+
}
|
|
2806
|
+
_changed() {
|
|
2807
|
+
if (super._changed(), this.isDirty("interactiveChildren") && (this._display.interactiveChildren = this.get("interactiveChildren", !1)), this.isDirty("layout") && (this._prevWidth = 0, this._prevHeight = 0, this.markDirtyBounds(), this._prevSettings.layout && this.children.each((t) => {
|
|
2808
|
+
t.removePrivate("x"), t.removePrivate("y");
|
|
2809
|
+
})), (this.isDirty("paddingTop") || this.isDirty("paddingBottom") || this.isDirty("paddingLeft") || this.isDirty("paddingRight")) && this.children.each((t) => {
|
|
2810
|
+
t.markDirtyPosition();
|
|
2811
|
+
}), this.isDirty("maskContent")) {
|
|
2812
|
+
const t = this._childrenDisplay;
|
|
2813
|
+
let e = this._contentMask;
|
|
2814
|
+
this.get("maskContent") ? e || (e = U.new(this._root, {
|
|
2815
|
+
x: -0.5,
|
|
2816
|
+
y: -0.5,
|
|
2817
|
+
width: this.width() + 1,
|
|
2818
|
+
height: this.height() + 1
|
|
2819
|
+
}), this._contentMask = e, t.addChildAt(e._display, 0), t.mask = e._display) : e && (t.removeChild(e._display), t.mask = null, e.dispose(), this._contentMask = void 0);
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
_updateSize() {
|
|
2823
|
+
super._updateSize(), w(this._percentageSizeChildren, (t) => {
|
|
2824
|
+
t._updateSize();
|
|
2825
|
+
}), w(this._percentagePositionChildren, (t) => {
|
|
2826
|
+
t.markDirtyPosition(), t._updateSize();
|
|
2827
|
+
}), this.updateBackground();
|
|
2828
|
+
}
|
|
2829
|
+
updateBackground() {
|
|
2830
|
+
const t = this.get("background");
|
|
2831
|
+
let e = this._localBounds;
|
|
2832
|
+
if (e && !this.isHidden()) {
|
|
2833
|
+
let i = e.left, s = e.top, r = e.right - i, a = e.bottom - s, o = this.get("maxWidth"), l = this.get("maxHeight");
|
|
2834
|
+
l && a > l && (a = l), o && r > o && (r = o);
|
|
2835
|
+
let h = this.width(), u = this.height();
|
|
2836
|
+
t && (t.setAll({ width: r, height: a, x: i, y: s }), this._display.interactive && (t._display.interactive = !0));
|
|
2837
|
+
const f = this._contentMask;
|
|
2838
|
+
f && f.setAll({ width: h + 1, height: u + 1 });
|
|
2839
|
+
const d = this.get("verticalScrollbar");
|
|
2840
|
+
if (d) {
|
|
2841
|
+
d.set("height", u), d.set("x", h - d.width() - d.get("marginRight", 0)), d.set("end", d.get("start", 0) + u / this._contentHeight);
|
|
2842
|
+
const p = d.get("background");
|
|
2843
|
+
p && p.setAll({ width: d.width(), height: u });
|
|
2844
|
+
let g = !0;
|
|
2845
|
+
this._contentHeight <= u && (g = !1), d.setPrivate("visible", g);
|
|
2846
|
+
}
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
_applyThemes(t = !1) {
|
|
2850
|
+
return super._applyThemes(t) ? (this.eachChildren((e) => {
|
|
2851
|
+
e._applyThemes(t);
|
|
2852
|
+
}), !0) : !1;
|
|
2853
|
+
}
|
|
2854
|
+
_applyState(t) {
|
|
2855
|
+
super._applyState(t), this.get("setStateOnChildren") && this.eachChildren((e) => {
|
|
2856
|
+
e.states.apply(t);
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
_applyStateAnimated(t, e) {
|
|
2860
|
+
super._applyStateAnimated(t, e), this.get("setStateOnChildren") && this.eachChildren((i) => {
|
|
2861
|
+
i.states.applyAnimate(t, e);
|
|
2862
|
+
});
|
|
2863
|
+
}
|
|
2864
|
+
/**
|
|
2865
|
+
* Returns container's inner width (width without padding) in pixels.
|
|
2866
|
+
*
|
|
2867
|
+
* @return Inner width (px)
|
|
2868
|
+
*/
|
|
2869
|
+
innerWidth() {
|
|
2870
|
+
return this.width() - this.get("paddingRight", 0) - this.get("paddingLeft", 0);
|
|
2871
|
+
}
|
|
2872
|
+
/**
|
|
2873
|
+
* Returns container's inner height (height without padding) in pixels.
|
|
2874
|
+
*
|
|
2875
|
+
* @return Inner height (px)
|
|
2876
|
+
*/
|
|
2877
|
+
innerHeight() {
|
|
2878
|
+
return this.height() - this.get("paddingTop", 0) - this.get("paddingBottom", 0);
|
|
2879
|
+
}
|
|
2880
|
+
_getBounds() {
|
|
2881
|
+
if (this.get("html")) {
|
|
2882
|
+
let t = this._localBounds;
|
|
2883
|
+
t && (this._contentWidth = t.right - t.left, this._contentHeight = t.bottom - t.top);
|
|
2884
|
+
} else {
|
|
2885
|
+
let t = this.get("width"), e = this.get("height"), i = this.getPrivate("width"), s = this.getPrivate("height"), r = {
|
|
2886
|
+
left: 0,
|
|
2887
|
+
top: 0,
|
|
2888
|
+
right: this.width(),
|
|
2889
|
+
bottom: this.height()
|
|
2890
|
+
}, a = this.get("layout"), o = !1, l = !1;
|
|
2891
|
+
if ((a instanceof K || a instanceof J) && (o = !0), a instanceof $ && (l = !0), !((t != null || i != null) && (e != null || s != null) && !this.get("verticalScrollbar"))) {
|
|
2892
|
+
let h = Number.MAX_VALUE, u = h, f = -h, d = h, p = -h;
|
|
2893
|
+
const g = this.get("paddingLeft", 0), _ = this.get("paddingTop", 0), v = this.get("paddingRight", 0), c = this.get("paddingBottom", 0);
|
|
2894
|
+
this.children.each((x) => {
|
|
2895
|
+
if (x.get("position") != "absolute" && x.get("isMeasured")) {
|
|
2896
|
+
let k = x.adjustedLocalBounds(), A = x.x(), G = x.y(), N = A + k.left, V = A + k.right, I = G + k.top, P = G + k.bottom;
|
|
2897
|
+
o && (N -= x.get("marginLeft", 0), V += x.get("marginRight", 0)), l && (I -= x.get("marginTop", 0), P += x.get("marginBottom", 0)), N < u && (u = N), V > f && (f = V), I < d && (d = I), P > p && (p = P);
|
|
2898
|
+
}
|
|
2899
|
+
}), u == h && (u = 0), f == -h && (f = 0), d == h && (d = 0), p == -h && (p = 0), r.left = u - g, r.top = d - _, r.right = f + v, r.bottom = p + c;
|
|
2900
|
+
const b = this.get("minWidth");
|
|
2901
|
+
m(b) && b > 0 && r.right - r.left < b && (r.right >= b ? r.left = r.right - b : r.right = r.left + b);
|
|
2902
|
+
const y = this.get("minHeight");
|
|
2903
|
+
m(y) && y > 0 && r.bottom - r.top < y && (r.bottom >= y ? r.top = r.bottom - y : r.bottom = r.top + y);
|
|
2904
|
+
}
|
|
2905
|
+
this._contentWidth = r.right - r.left, this._contentHeight = r.bottom - r.top, m(t) && (r.left = 0, r.right = t), m(i) && (r.left = 0, r.right = i), m(e) && (r.top = 0, r.bottom = e), m(s) && (r.top = 0, r.bottom = s), this._localBounds = r;
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
_updateBounds() {
|
|
2909
|
+
const t = this.get("layout");
|
|
2910
|
+
t && t.updateContainer(this), super._updateBounds(), this.updateBackground();
|
|
2911
|
+
}
|
|
2912
|
+
/**
|
|
2913
|
+
* @ignore
|
|
2914
|
+
*/
|
|
2915
|
+
markDirty() {
|
|
2916
|
+
super.markDirty(), this._root._addDirtyParent(this);
|
|
2917
|
+
}
|
|
2918
|
+
_prepareChildren() {
|
|
2919
|
+
this._childrenPrep = !0;
|
|
2920
|
+
const t = this.innerWidth(), e = this.innerHeight();
|
|
2921
|
+
if (t != this._prevWidth || e != this._prevHeight) {
|
|
2922
|
+
let i = this.get("layout"), s = !1, r = !1;
|
|
2923
|
+
i && ((i instanceof K || i instanceof J) && (s = !0), i instanceof $ && (r = !0)), w(this._percentageSizeChildren, (a) => {
|
|
2924
|
+
if (!s) {
|
|
2925
|
+
let o = a.get("width");
|
|
2926
|
+
o instanceof D && a.setPrivate("width", o.value * t);
|
|
2927
|
+
}
|
|
2928
|
+
if (!r) {
|
|
2929
|
+
let o = a.get("height");
|
|
2930
|
+
o instanceof D && a.setPrivate("height", o.value * e);
|
|
2931
|
+
}
|
|
2932
|
+
}), w(this._percentagePositionChildren, (a) => {
|
|
2933
|
+
a.markDirtyPosition(), a.markDirtyBounds();
|
|
2934
|
+
}), this._prevWidth = t, this._prevHeight = e, this._sizeDirty = !0, this.updateBackground();
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
_updateHTMLContent() {
|
|
2938
|
+
const t = this.get("html", "");
|
|
2939
|
+
t && t !== "" ? this._root._setHTMLContent(this, tt(this, t)) : this._root._removeHTMLContent(this), this._root._positionHTMLElement(this);
|
|
2940
|
+
}
|
|
2941
|
+
/**
|
|
2942
|
+
* If scrolling is enabled on the Container (by adding `verticalScrollbar`)
|
|
2943
|
+
* the Container will scroll in such way so that target element becomes
|
|
2944
|
+
* visible if its currently outside of view.
|
|
2945
|
+
*
|
|
2946
|
+
* @param child Target child
|
|
2947
|
+
* @since 5.10.5
|
|
2948
|
+
*/
|
|
2949
|
+
scrollToChild(t) {
|
|
2950
|
+
const e = this.get("verticalScrollbar");
|
|
2951
|
+
if (e) {
|
|
2952
|
+
let i = t.y(), s = this.innerHeight(), r = t.height(), a = this._contentHeight, o = 1 - (s - r / 2) / a;
|
|
2953
|
+
if (i + r * 0.7 + this._childrenDisplay.y > s || i - r * 0.3 + this._childrenDisplay.y < 0) {
|
|
2954
|
+
let l = Math.max(0, Math.min(o, (i - r / 2) / a));
|
|
2955
|
+
e.animate({ key: "start", to: l, duration: e.get("animationDuration", 0), easing: e.get("animationEasing") });
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
_updateChildren() {
|
|
2960
|
+
if (this._childrenUpdt = !0, this.isDirty("html") && this._updateHTMLContent(), this.isDirty("verticalScrollbar")) {
|
|
2961
|
+
const t = this.get("verticalScrollbar");
|
|
2962
|
+
if (t) {
|
|
2963
|
+
t._setParent(this), t.startGrip.setPrivate("visible", !1), t.endGrip.setPrivate("visible", !1), this.set("maskContent", !0), this.set("paddingRight", t.width() + t.get("marginRight", 0) + t.get("marginLeft", 0));
|
|
2964
|
+
let e = this.get("background");
|
|
2965
|
+
e || (e = this.set("background", U.new(this._root, {
|
|
2966
|
+
themeTags: ["background"],
|
|
2967
|
+
fillOpacity: 0,
|
|
2968
|
+
fill: this._root.interfaceColors.get("alternativeBackground")
|
|
2969
|
+
}))), this._vsbd0 = this.events.on("wheel", (i) => {
|
|
2970
|
+
const s = i.originalEvent;
|
|
2971
|
+
if (Nt(s, this))
|
|
2972
|
+
s.preventDefault();
|
|
2973
|
+
else
|
|
2974
|
+
return;
|
|
2975
|
+
let r = s.deltaY / 5e3;
|
|
2976
|
+
const a = t.get("start", 0), o = t.get("end", 1);
|
|
2977
|
+
a + r <= 0 && (r = -a), o + r >= 1 && (r = 1 - o), a + r >= 0 && o + r <= 1 && (t.set("start", a + r), t.set("end", o + r));
|
|
2978
|
+
}), this._disposers.push(this._vsbd0), this._vsbd1 = t.events.on("rangechanged", () => {
|
|
2979
|
+
let i = this._contentHeight;
|
|
2980
|
+
const s = this._childrenDisplay, r = this._contentMask;
|
|
2981
|
+
s.y = -t.get("start", 0) * i, s.markDirtyLayer(), r && (r._display.y = -s.y, s.mask = r._display);
|
|
2982
|
+
}), this._disposers.push(this._vsbd1), this._display.addChild(t._display);
|
|
2983
|
+
} else {
|
|
2984
|
+
const e = this._prevSettings.verticalScrollbar;
|
|
2985
|
+
if (e) {
|
|
2986
|
+
this._display.removeChild(e._display), this._vsbd0 && this._vsbd0.dispose(), this._vsbd1 && this._vsbd1.dispose();
|
|
2987
|
+
const i = this._childrenDisplay;
|
|
2988
|
+
i.y = 0, this.setPrivate("height", void 0), this.set("maskContent", !1), this.set("paddingRight", void 0);
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
if (this.isDirty("background")) {
|
|
2993
|
+
const t = this._prevSettings.background;
|
|
2994
|
+
t && this._display.removeChild(t._display);
|
|
2995
|
+
const e = this.get("background");
|
|
2996
|
+
e instanceof O && (e.set("isMeasured", !1), e._setParent(this), this._display.addChildAt(e._display, 0));
|
|
2997
|
+
}
|
|
2998
|
+
if (this.isDirty("mask")) {
|
|
2999
|
+
const t = this.get("mask"), e = this._prevSettings.mask;
|
|
3000
|
+
if (e && (this._display.removeChild(e._display), e != t && e.dispose()), t) {
|
|
3001
|
+
const i = t.parent;
|
|
3002
|
+
i && i.children.removeValue(t), t._setParent(this), this._display.addChildAt(t._display, 0), this._childrenDisplay.mask = t._display;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
_processTemplateField() {
|
|
3007
|
+
super._processTemplateField(), this.children.each((t) => {
|
|
3008
|
+
t._processTemplateField();
|
|
3009
|
+
});
|
|
3010
|
+
}
|
|
3011
|
+
/**
|
|
3012
|
+
* @ignore
|
|
3013
|
+
*/
|
|
3014
|
+
walkChildren(t) {
|
|
3015
|
+
this.children.each((e) => {
|
|
3016
|
+
e instanceof S && e.walkChildren(t), t(e);
|
|
3017
|
+
});
|
|
3018
|
+
}
|
|
3019
|
+
eachChildren(t) {
|
|
3020
|
+
const e = this.get("background");
|
|
3021
|
+
e && t(e);
|
|
3022
|
+
const i = this.get("verticalScrollbar");
|
|
3023
|
+
i && t(i);
|
|
3024
|
+
const s = this.get("mask");
|
|
3025
|
+
s && t(s), this.children.values.forEach((r) => {
|
|
3026
|
+
t(r);
|
|
3027
|
+
});
|
|
3028
|
+
}
|
|
3029
|
+
allChildren() {
|
|
3030
|
+
const t = [];
|
|
3031
|
+
return this.eachChildren((e) => {
|
|
3032
|
+
t.push(e);
|
|
3033
|
+
}), t;
|
|
3034
|
+
}
|
|
3035
|
+
_setDataItem(t) {
|
|
3036
|
+
const e = t !== this._dataItem;
|
|
3037
|
+
super._setDataItem(t);
|
|
3038
|
+
const i = this.get("html", "");
|
|
3039
|
+
i && i !== "" && e && this._root._setHTMLContent(this, tt(this, i));
|
|
3040
|
+
}
|
|
3041
|
+
contentWidth() {
|
|
3042
|
+
return this._contentWidth;
|
|
3043
|
+
}
|
|
3044
|
+
contentHeight() {
|
|
3045
|
+
return this._contentHeight;
|
|
3046
|
+
}
|
|
3047
|
+
}
|
|
3048
|
+
Object.defineProperty(S, "className", {
|
|
3049
|
+
enumerable: !0,
|
|
3050
|
+
configurable: !0,
|
|
3051
|
+
writable: !0,
|
|
3052
|
+
value: "Container"
|
|
3053
|
+
});
|
|
3054
|
+
Object.defineProperty(S, "classNames", {
|
|
3055
|
+
enumerable: !0,
|
|
3056
|
+
configurable: !0,
|
|
3057
|
+
writable: !0,
|
|
3058
|
+
value: O.classNames.concat([S.className])
|
|
3059
|
+
});
|
|
3060
|
+
class et extends O {
|
|
3061
|
+
constructor() {
|
|
3062
|
+
super(...arguments), Object.defineProperty(this, "textStyle", {
|
|
3063
|
+
enumerable: !0,
|
|
3064
|
+
configurable: !0,
|
|
3065
|
+
writable: !0,
|
|
3066
|
+
value: this._root._renderer.makeTextStyle()
|
|
3067
|
+
}), Object.defineProperty(this, "_display", {
|
|
3068
|
+
enumerable: !0,
|
|
3069
|
+
configurable: !0,
|
|
3070
|
+
writable: !0,
|
|
3071
|
+
value: this._root._renderer.makeText("", this.textStyle)
|
|
3072
|
+
}), Object.defineProperty(this, "_textStyles", {
|
|
3073
|
+
enumerable: !0,
|
|
3074
|
+
configurable: !0,
|
|
3075
|
+
writable: !0,
|
|
3076
|
+
value: [
|
|
3077
|
+
"textAlign",
|
|
3078
|
+
"fontFamily",
|
|
3079
|
+
"fontSize",
|
|
3080
|
+
"fontStyle",
|
|
3081
|
+
"fontWeight",
|
|
3082
|
+
"fontStyle",
|
|
3083
|
+
"fontVariant",
|
|
3084
|
+
"textDecoration",
|
|
3085
|
+
"shadowColor",
|
|
3086
|
+
"shadowBlur",
|
|
3087
|
+
"shadowOffsetX",
|
|
3088
|
+
"shadowOffsetY",
|
|
3089
|
+
"shadowOpacity",
|
|
3090
|
+
// "leading",
|
|
3091
|
+
// "letterSpacing",
|
|
3092
|
+
"lineHeight",
|
|
3093
|
+
"baselineRatio",
|
|
3094
|
+
//"padding",
|
|
3095
|
+
// "stroke",
|
|
3096
|
+
// "strokeThickness",
|
|
3097
|
+
// "trim",
|
|
3098
|
+
// "wordWrap",
|
|
3099
|
+
"direction",
|
|
3100
|
+
"textBaseline",
|
|
3101
|
+
"oversizedBehavior",
|
|
3102
|
+
"breakWords",
|
|
3103
|
+
"ellipsis",
|
|
3104
|
+
"minScale",
|
|
3105
|
+
"maxChars"
|
|
3106
|
+
]
|
|
3107
|
+
}), Object.defineProperty(this, "_originalScale", {
|
|
3108
|
+
enumerable: !0,
|
|
3109
|
+
configurable: !0,
|
|
3110
|
+
writable: !0,
|
|
3111
|
+
value: void 0
|
|
3112
|
+
});
|
|
3113
|
+
}
|
|
3114
|
+
_updateBounds() {
|
|
3115
|
+
if (this.get("text")) {
|
|
3116
|
+
super._updateBounds();
|
|
3117
|
+
let t = this.get("fillGradient");
|
|
3118
|
+
t && (this._display.style.fill = t.getFill(this));
|
|
3119
|
+
} else {
|
|
3120
|
+
let t = {
|
|
3121
|
+
left: 0,
|
|
3122
|
+
right: 0,
|
|
3123
|
+
top: 0,
|
|
3124
|
+
bottom: 0
|
|
3125
|
+
};
|
|
3126
|
+
this._adjustedLocalBounds = t;
|
|
3127
|
+
}
|
|
3128
|
+
}
|
|
3129
|
+
_changed() {
|
|
3130
|
+
super._changed(), this._display.clear();
|
|
3131
|
+
let t = this.textStyle;
|
|
3132
|
+
if (this.isDirty("opacity")) {
|
|
3133
|
+
let e = this.get("opacity", 1);
|
|
3134
|
+
this._display.alpha = e;
|
|
3135
|
+
}
|
|
3136
|
+
if ((this.isDirty("text") || this.isDirty("populateText")) && (this._display.text = this._getText(), this.markDirtyBounds(), this.get("role") == "tooltip" && this._root.updateTooltip(this)), this.isPrivateDirty("tooltipElement") && this.getPrivate("tooltipElement") && this._disposers.push(new Q(() => {
|
|
3137
|
+
this._root._removeTooltipElement(this);
|
|
3138
|
+
})), this.isDirty("width") && (t.wordWrapWidth = this.width(), this.markDirtyBounds()), this.isDirty("oversizedBehavior") && (t.oversizedBehavior = this.get("oversizedBehavior", "none"), this._display.invalidateVisibility(), this.markDirtyBounds()), this.isDirty("breakWords") && (t.breakWords = this.get("breakWords", !1), this.markDirtyBounds()), this.isDirty("ellipsis") && (t.ellipsis = this.get("ellipsis"), this.markDirtyBounds()), this.isDirty("ignoreFormatting") && (t.ignoreFormatting = this.get("ignoreFormatting", !1), this.markDirtyBounds()), this.isDirty("minScale") && (t.minScale = this.get("minScale", 0), this.markDirtyBounds()), this.isDirty("fill") || this.isDirty("fillGradient")) {
|
|
3139
|
+
const e = this.get("fill"), i = this.get("fillGradient"), s = this.get("fillOpacity");
|
|
3140
|
+
if (i) {
|
|
3141
|
+
if (e) {
|
|
3142
|
+
const r = i.get("stops", []);
|
|
3143
|
+
r.length && w(r, (a) => {
|
|
3144
|
+
(!a.color || a.colorInherited) && e && (a.color = e, a.colorInherited = !0), (a.opacity == null || a.opacityInherited) && (a.opacity = s, a.opacityInherited = !0);
|
|
3145
|
+
});
|
|
3146
|
+
}
|
|
3147
|
+
t.fill = i.getFill(this);
|
|
3148
|
+
} else e && (t.fill = e);
|
|
3149
|
+
}
|
|
3150
|
+
if (this.isDirty("fillOpacity")) {
|
|
3151
|
+
let e = this.get("fillOpacity", 1);
|
|
3152
|
+
e && (t.fillOpacity = e);
|
|
3153
|
+
}
|
|
3154
|
+
(this.isDirty("maxWidth") || this.isPrivateDirty("maxWidth")) && (t.maxWidth = this.get("maxWidth", this.getPrivate("maxWidth")), this.markDirtyBounds()), (this.isDirty("maxHeight") || this.isPrivateDirty("maxHeight")) && (t.maxHeight = this.get("maxHeight", this.getPrivate("maxHeight")), this.markDirtyBounds()), w(this._textStyles, (e) => {
|
|
3155
|
+
this._dirty[e] && (t[e] = this.get(e), this.markDirtyBounds());
|
|
3156
|
+
}), t.fontSize = this.get("fontSize"), t.fontFamily = this.get("fontFamily"), this._display.style = t, this.isDirty("role") && this.get("role") == "tooltip" && this._root.updateTooltip(this);
|
|
3157
|
+
}
|
|
3158
|
+
_getText() {
|
|
3159
|
+
let t = this.get("text", "");
|
|
3160
|
+
return this.get("maxChars") && (t = Rt(t, this.get("maxChars", 1e8), this.get("breakWords"), this.get("ellipsis"))), this.get("populateText") ? tt(this, t) : t;
|
|
3161
|
+
}
|
|
3162
|
+
_getAccessibleText() {
|
|
3163
|
+
const t = this.get("ariaLabel");
|
|
3164
|
+
return t !== void 0 ? this.get("populateText") ? tt(this, t) : t : this._getText();
|
|
3165
|
+
}
|
|
3166
|
+
/**
|
|
3167
|
+
* Forces the text to be re-evaluated and re-populated.
|
|
3168
|
+
*/
|
|
3169
|
+
markDirtyText() {
|
|
3170
|
+
this._display.text = this._getText(), this.get("role") == "tooltip" && this._root.updateTooltip(this), this.markDirtyBounds(), this.markDirty();
|
|
3171
|
+
}
|
|
3172
|
+
_setDataItem(t) {
|
|
3173
|
+
super._setDataItem(t), this.get("populateText") && this.markDirtyText();
|
|
3174
|
+
}
|
|
3175
|
+
getNumberFormatter() {
|
|
3176
|
+
return this.parent ? this.parent.getNumberFormatter() : super.getNumberFormatter();
|
|
3177
|
+
}
|
|
3178
|
+
getDateFormatter() {
|
|
3179
|
+
return this.parent ? this.parent.getDateFormatter() : super.getDateFormatter();
|
|
3180
|
+
}
|
|
3181
|
+
getDurationFormatter() {
|
|
3182
|
+
return this.parent ? this.parent.getDurationFormatter() : super.getDurationFormatter();
|
|
3183
|
+
}
|
|
3184
|
+
}
|
|
3185
|
+
Object.defineProperty(et, "className", {
|
|
3186
|
+
enumerable: !0,
|
|
3187
|
+
configurable: !0,
|
|
3188
|
+
writable: !0,
|
|
3189
|
+
value: "Text"
|
|
3190
|
+
});
|
|
3191
|
+
Object.defineProperty(et, "classNames", {
|
|
3192
|
+
enumerable: !0,
|
|
3193
|
+
configurable: !0,
|
|
3194
|
+
writable: !0,
|
|
3195
|
+
value: O.classNames.concat([et.className])
|
|
3196
|
+
});
|
|
3197
|
+
class it extends S {
|
|
3198
|
+
constructor() {
|
|
3199
|
+
super(...arguments), Object.defineProperty(this, "_text", {
|
|
3200
|
+
enumerable: !0,
|
|
3201
|
+
configurable: !0,
|
|
3202
|
+
writable: !0,
|
|
3203
|
+
value: void 0
|
|
3204
|
+
}), Object.defineProperty(this, "_textKeys", {
|
|
3205
|
+
enumerable: !0,
|
|
3206
|
+
configurable: !0,
|
|
3207
|
+
writable: !0,
|
|
3208
|
+
value: [
|
|
3209
|
+
"text",
|
|
3210
|
+
"fill",
|
|
3211
|
+
"fillGradient",
|
|
3212
|
+
"fillOpacity",
|
|
3213
|
+
"textAlign",
|
|
3214
|
+
"fontFamily",
|
|
3215
|
+
"fontSize",
|
|
3216
|
+
"fontStyle",
|
|
3217
|
+
"fontWeight",
|
|
3218
|
+
"fontStyle",
|
|
3219
|
+
"fontVariant",
|
|
3220
|
+
"textDecoration",
|
|
3221
|
+
"shadowColor",
|
|
3222
|
+
"shadowBlur",
|
|
3223
|
+
"shadowOffsetX",
|
|
3224
|
+
"shadowOffsetY",
|
|
3225
|
+
"shadowOpacity",
|
|
3226
|
+
// "leading",
|
|
3227
|
+
// "letterSpacing",
|
|
3228
|
+
"lineHeight",
|
|
3229
|
+
"baselineRatio",
|
|
3230
|
+
//"padding",
|
|
3231
|
+
// "stroke",
|
|
3232
|
+
// "strokeThickness",
|
|
3233
|
+
// "trim",
|
|
3234
|
+
// "wordWrap",
|
|
3235
|
+
"direction",
|
|
3236
|
+
"textBaseline",
|
|
3237
|
+
"oversizedBehavior",
|
|
3238
|
+
"breakWords",
|
|
3239
|
+
"ellipsis",
|
|
3240
|
+
"minScale",
|
|
3241
|
+
"populateText",
|
|
3242
|
+
"role",
|
|
3243
|
+
"ignoreFormatting",
|
|
3244
|
+
"maxChars",
|
|
3245
|
+
"ariaLabel"
|
|
3246
|
+
]
|
|
3247
|
+
});
|
|
3248
|
+
}
|
|
3249
|
+
/**
|
|
3250
|
+
* @ignore Text is not to be used directly
|
|
3251
|
+
*/
|
|
3252
|
+
get text() {
|
|
3253
|
+
return this._text;
|
|
3254
|
+
}
|
|
3255
|
+
_afterNew() {
|
|
3256
|
+
super._afterNew(), this._makeText(), w(this._textKeys, (t) => {
|
|
3257
|
+
const e = this.get(t);
|
|
3258
|
+
e != null && this._text.set(t, e);
|
|
3259
|
+
}), this.get("html", "") !== "" && this._text.set("text", ""), this.onPrivate("maxWidth", () => {
|
|
3260
|
+
this._setMaxDimentions();
|
|
3261
|
+
}), this.onPrivate("maxHeight", () => {
|
|
3262
|
+
this._setMaxDimentions();
|
|
3263
|
+
});
|
|
3264
|
+
}
|
|
3265
|
+
_makeText() {
|
|
3266
|
+
this._text = this.children.push(et.new(this._root, {}));
|
|
3267
|
+
}
|
|
3268
|
+
_updateChildren() {
|
|
3269
|
+
super._updateChildren();
|
|
3270
|
+
const t = this._text;
|
|
3271
|
+
if (w(this._textKeys, (i) => {
|
|
3272
|
+
this._text.set(i, this.get(i));
|
|
3273
|
+
}), (this.isDirty("maxWidth") || this.isDirty("maxHeight") || this.isDirty("rotation")) && this._setMaxDimentions(), this.get("html", "") !== "" ? t.set("text", "") : (t.set("text", this.get("text")), this._maybeUpdateHTMLColor()), (this.isDirty("fill") || this.isDirty("fillGradient")) && this._maybeUpdateHTMLColor(), this.isDirty("textAlign") || this.isDirty("width")) {
|
|
3274
|
+
const i = this.get("textAlign");
|
|
3275
|
+
let s;
|
|
3276
|
+
this.get("width") != null ? i == "right" ? s = Ft : i == "center" ? s = At : s = 0 : i == "left" || i == "start" ? s = this.get("paddingLeft", 0) : (i == "right" || i == "end") && (s = -this.get("paddingRight", 0)), t.set("x", s);
|
|
3277
|
+
}
|
|
3278
|
+
const e = this.get("background");
|
|
3279
|
+
e && e.setPrivate("visible", t._display.textVisible);
|
|
3280
|
+
}
|
|
3281
|
+
_maybeUpdateHTMLColor() {
|
|
3282
|
+
const t = this.getPrivate("htmlElement");
|
|
3283
|
+
t && this.get("fill") && (t.style.color = this.get("fill").toCSSHex());
|
|
3284
|
+
}
|
|
3285
|
+
_setMaxDimentions() {
|
|
3286
|
+
const t = this.get("rotation"), e = t == 90 || t == 270 || t == -90, i = this._text, s = this.get("maxWidth", this.getPrivate("maxWidth", 1 / 0));
|
|
3287
|
+
m(s) ? i.set(e ? "maxHeight" : "maxWidth", s - this.get("paddingTop", 0) - this.get("paddingBottom", 0)) : i.set(e ? "maxHeight" : "maxWidth", void 0);
|
|
3288
|
+
const r = this.get("maxHeight", this.getPrivate("maxHeight", 1 / 0));
|
|
3289
|
+
m(r) ? i.set(e ? "maxWidth" : "maxHeight", r - this.get("paddingLeft", 0) - this.get("paddingRight", 0)) : i.set(e ? "maxWidth" : "maxHeight", void 0), this.root.events.once("frameended", () => {
|
|
3290
|
+
i.markDirtyBounds();
|
|
3291
|
+
});
|
|
3292
|
+
}
|
|
3293
|
+
_setDataItem(t) {
|
|
3294
|
+
super._setDataItem(t), this._markDirtyKey("text"), this._markDirtyKey("html");
|
|
3295
|
+
const e = this._text;
|
|
3296
|
+
e.get("populateText") && e.markDirtyText();
|
|
3297
|
+
const i = this.get("html");
|
|
3298
|
+
i && i !== "" && this._updateHTMLContent();
|
|
3299
|
+
}
|
|
3300
|
+
/**
|
|
3301
|
+
* Returns text with populated placeholders and formatting if `populateText` is
|
|
3302
|
+
* set to `true`.
|
|
3303
|
+
*
|
|
3304
|
+
* @return Populated text
|
|
3305
|
+
*/
|
|
3306
|
+
getText() {
|
|
3307
|
+
return this._text._getText();
|
|
3308
|
+
}
|
|
3309
|
+
/**
|
|
3310
|
+
* Returns "aria-label" text with populated placeholders and formatting
|
|
3311
|
+
* if `populateText` is set to `true`.
|
|
3312
|
+
*
|
|
3313
|
+
* @return Populated text
|
|
3314
|
+
*/
|
|
3315
|
+
getAccessibleText() {
|
|
3316
|
+
return this._text._getAccessibleText();
|
|
3317
|
+
}
|
|
3318
|
+
}
|
|
3319
|
+
Object.defineProperty(it, "className", {
|
|
3320
|
+
enumerable: !0,
|
|
3321
|
+
configurable: !0,
|
|
3322
|
+
writable: !0,
|
|
3323
|
+
value: "Label"
|
|
3324
|
+
});
|
|
3325
|
+
Object.defineProperty(it, "classNames", {
|
|
3326
|
+
enumerable: !0,
|
|
3327
|
+
configurable: !0,
|
|
3328
|
+
writable: !0,
|
|
3329
|
+
value: S.classNames.concat([it.className])
|
|
3330
|
+
});
|
|
3331
|
+
class R extends W {
|
|
3332
|
+
_beforeChanged() {
|
|
3333
|
+
super._beforeChanged(), (this.isDirty("pointerBaseWidth") || this.isDirty("cornerRadius") || this.isDirty("pointerLength") || this.isDirty("pointerX") || this.isDirty("pointerY") || this.isDirty("width") || this.isDirty("height")) && (this._clear = !0);
|
|
3334
|
+
}
|
|
3335
|
+
_changed() {
|
|
3336
|
+
if (super._changed(), this._clear) {
|
|
3337
|
+
this.markDirtyBounds();
|
|
3338
|
+
let t = this.width(), e = this.height();
|
|
3339
|
+
if (t > 0 && e > 0) {
|
|
3340
|
+
let i = this.get("cornerRadius", 8);
|
|
3341
|
+
i = T(i, 0, Math.min(t / 2, e / 2));
|
|
3342
|
+
let s = this.get("pointerX", 0), r = this.get("pointerY", 0), a = this.get("pointerBaseWidth", 15) / 2, o = 0, l = 0, h = t, u = 0, f = t, d = e, p = 0, g = e, _ = (s - o) * (d - l) - (r - l) * (f - o), v = (s - p) * (u - g) - (r - g) * (h - p);
|
|
3343
|
+
const c = this._display;
|
|
3344
|
+
if (c.moveTo(i, 0), _ > 0 && v > 0) {
|
|
3345
|
+
let b = Math.round(T(s, i + a, t - a - i));
|
|
3346
|
+
r = T(r, -1 / 0, 0), c.lineTo(b - a, 0), c.lineTo(s, r), c.lineTo(b + a, 0);
|
|
3347
|
+
}
|
|
3348
|
+
if (c.lineTo(t - i, 0), c.arcTo(t, 0, t, i, i), _ > 0 && v < 0) {
|
|
3349
|
+
let b = Math.round(T(r, i + a, e - a - i));
|
|
3350
|
+
s = T(s, t, 1 / 0), c.lineTo(t, i), c.lineTo(t, Math.max(b - a, i)), c.lineTo(s, r), c.lineTo(t, b + a);
|
|
3351
|
+
}
|
|
3352
|
+
if (c.lineTo(t, e - i), c.arcTo(t, e, t - i, e, i), _ < 0 && v < 0) {
|
|
3353
|
+
let b = Math.round(T(s, i + a, t - a - i));
|
|
3354
|
+
r = T(r, e, 1 / 0), c.lineTo(t - i, e), c.lineTo(b + a, e), c.lineTo(s, r), c.lineTo(b - a, e);
|
|
3355
|
+
}
|
|
3356
|
+
if (c.lineTo(i, e), c.arcTo(0, e, 0, e - i, i), _ < 0 && v > 0) {
|
|
3357
|
+
let b = Math.round(T(r, i + a, e - i - a));
|
|
3358
|
+
s = T(s, -1 / 0, 0), c.lineTo(0, e - i), c.lineTo(0, b + a), c.lineTo(s, r), c.lineTo(0, Math.max(b - a, i));
|
|
3359
|
+
}
|
|
3360
|
+
c.lineTo(0, i), c.arcTo(0, 0, i, 0, i), c.closePath();
|
|
3361
|
+
}
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
}
|
|
3365
|
+
Object.defineProperty(R, "className", {
|
|
3366
|
+
enumerable: !0,
|
|
3367
|
+
configurable: !0,
|
|
3368
|
+
writable: !0,
|
|
3369
|
+
value: "PointedRectangle"
|
|
3370
|
+
});
|
|
3371
|
+
Object.defineProperty(R, "classNames", {
|
|
3372
|
+
enumerable: !0,
|
|
3373
|
+
configurable: !0,
|
|
3374
|
+
writable: !0,
|
|
3375
|
+
value: W.classNames.concat([R.className])
|
|
3376
|
+
});
|
|
3377
|
+
class _t extends S {
|
|
3378
|
+
constructor(t, e, i, s = []) {
|
|
3379
|
+
super(t, e, i, s), Object.defineProperty(this, "_fx", {
|
|
3380
|
+
enumerable: !0,
|
|
3381
|
+
configurable: !0,
|
|
3382
|
+
writable: !0,
|
|
3383
|
+
value: 0
|
|
3384
|
+
}), Object.defineProperty(this, "_fy", {
|
|
3385
|
+
enumerable: !0,
|
|
3386
|
+
configurable: !0,
|
|
3387
|
+
writable: !0,
|
|
3388
|
+
value: 0
|
|
3389
|
+
}), Object.defineProperty(this, "_label", {
|
|
3390
|
+
enumerable: !0,
|
|
3391
|
+
configurable: !0,
|
|
3392
|
+
writable: !0,
|
|
3393
|
+
value: void 0
|
|
3394
|
+
}), Object.defineProperty(this, "_fillDp", {
|
|
3395
|
+
enumerable: !0,
|
|
3396
|
+
configurable: !0,
|
|
3397
|
+
writable: !0,
|
|
3398
|
+
value: void 0
|
|
3399
|
+
}), Object.defineProperty(this, "_fillGrDp", {
|
|
3400
|
+
enumerable: !0,
|
|
3401
|
+
configurable: !0,
|
|
3402
|
+
writable: !0,
|
|
3403
|
+
value: void 0
|
|
3404
|
+
}), Object.defineProperty(this, "_strokeDp", {
|
|
3405
|
+
enumerable: !0,
|
|
3406
|
+
configurable: !0,
|
|
3407
|
+
writable: !0,
|
|
3408
|
+
value: void 0
|
|
3409
|
+
}), Object.defineProperty(this, "_labelDp", {
|
|
3410
|
+
enumerable: !0,
|
|
3411
|
+
configurable: !0,
|
|
3412
|
+
writable: !0,
|
|
3413
|
+
value: void 0
|
|
3414
|
+
}), Object.defineProperty(this, "_w", {
|
|
3415
|
+
enumerable: !0,
|
|
3416
|
+
configurable: !0,
|
|
3417
|
+
writable: !0,
|
|
3418
|
+
value: 0
|
|
3419
|
+
}), Object.defineProperty(this, "_h", {
|
|
3420
|
+
enumerable: !0,
|
|
3421
|
+
configurable: !0,
|
|
3422
|
+
writable: !0,
|
|
3423
|
+
value: 0
|
|
3424
|
+
}), Object.defineProperty(this, "_keepHoverDp", {
|
|
3425
|
+
enumerable: !0,
|
|
3426
|
+
configurable: !0,
|
|
3427
|
+
writable: !0,
|
|
3428
|
+
value: void 0
|
|
3429
|
+
}), Object.defineProperty(this, "_htmlContentHovered", {
|
|
3430
|
+
enumerable: !0,
|
|
3431
|
+
configurable: !0,
|
|
3432
|
+
writable: !0,
|
|
3433
|
+
value: !1
|
|
3434
|
+
});
|
|
3435
|
+
}
|
|
3436
|
+
_afterNew() {
|
|
3437
|
+
this._settings.themeTags = Gt(this._settings.themeTags, ["tooltip"]), super._afterNew(), this._setDefaultFn("background", () => R.new(this._root, {})).set("themeTags", ["tooltip", "background"]), this._label = this.children.push(it.new(this._root, {})), this._disposers.push(this._label.events.on("boundschanged", () => {
|
|
3438
|
+
this._updateBackground();
|
|
3439
|
+
})), this._disposers.push(this.on("bounds", () => {
|
|
3440
|
+
this._updateBackground();
|
|
3441
|
+
})), this._updateTextColor(), this._root.tooltipContainer.children.push(this), this.hide(0), this._disposers.push(this.label.onPrivate("htmlElement", (e) => {
|
|
3442
|
+
e && (this._disposers.push(q(e, "pointerover", (i) => {
|
|
3443
|
+
this._htmlContentHovered = !0;
|
|
3444
|
+
})), this._disposers.push(q(e, "pointerout", (i) => {
|
|
3445
|
+
this._htmlContentHovered = !1;
|
|
3446
|
+
})));
|
|
3447
|
+
})), this.on("visible", (e) => {
|
|
3448
|
+
this._handleReaderAnnouncement();
|
|
3449
|
+
}), this.label.events.on("dataitemchanged", (e) => {
|
|
3450
|
+
this._handleReaderAnnouncement();
|
|
3451
|
+
}), this._root._tooltips.push(this);
|
|
3452
|
+
}
|
|
3453
|
+
_handleReaderAnnouncement() {
|
|
3454
|
+
this.get("readerAnnounce") && this.isVisibleDeep() && this._root.readerAlert(this.label.getAccessibleText());
|
|
3455
|
+
}
|
|
3456
|
+
/**
|
|
3457
|
+
* A [[Label]] element for the tooltip.
|
|
3458
|
+
*
|
|
3459
|
+
* @readonly
|
|
3460
|
+
* @return Label
|
|
3461
|
+
*/
|
|
3462
|
+
get label() {
|
|
3463
|
+
return this._label;
|
|
3464
|
+
}
|
|
3465
|
+
/**
|
|
3466
|
+
* Permanently disposes the tooltip.
|
|
3467
|
+
*/
|
|
3468
|
+
_dispose() {
|
|
3469
|
+
super._dispose(), Ct(this._root._tooltips, this);
|
|
3470
|
+
}
|
|
3471
|
+
_updateChildren() {
|
|
3472
|
+
super._updateChildren(), (this.isDirty("pointerOrientation") || this.isPrivateDirty("minWidth") || this.isPrivateDirty("minHeight")) && this.get("background")._markDirtyKey("width"), this.get("labelText") != null && this.label.set("text", this.get("labelText")), this.get("labelHTML") != null && this.label.set("html", this.get("labelHTML")), this.get("labelAriaLabel") != null && this.label.set("ariaLabel", this.get("labelAriaLabel"));
|
|
3473
|
+
}
|
|
3474
|
+
_changed() {
|
|
3475
|
+
if (super._changed(), (this.isDirty("pointTo") || this.isDirty("pointerOrientation")) && this._updateBackground(), this.isDirty("tooltipTarget") && this.updateBackgroundColor(), this.isDirty("keepTargetHover"))
|
|
3476
|
+
if (this.get("keepTargetHover")) {
|
|
3477
|
+
const e = this.get("background");
|
|
3478
|
+
this._keepHoverDp = new C([
|
|
3479
|
+
e.events.on("pointerover", (i) => {
|
|
3480
|
+
let s = this.get("tooltipTarget");
|
|
3481
|
+
s && (s.parent && s.parent.getPrivate("tooltipTarget") == s && (s = s.parent), s.hover());
|
|
3482
|
+
}),
|
|
3483
|
+
e.events.on("pointerout", (i) => {
|
|
3484
|
+
let s = this.get("tooltipTarget");
|
|
3485
|
+
s && (s.parent && s.parent.getPrivate("tooltipTarget") == s && (s = s.parent), this._htmlContentHovered || s.unhover());
|
|
3486
|
+
})
|
|
3487
|
+
]), this.label.onPrivate("htmlElement", (i) => {
|
|
3488
|
+
this._keepHoverDp && i && this._keepHoverDp.disposers.push(q(i, "pointerleave", (s) => {
|
|
3489
|
+
const r = this.root._renderer.getEvent(s);
|
|
3490
|
+
e.events.dispatch("pointerout", {
|
|
3491
|
+
type: "pointerout",
|
|
3492
|
+
originalEvent: r.event,
|
|
3493
|
+
point: r.point,
|
|
3494
|
+
simulated: !1,
|
|
3495
|
+
target: e
|
|
3496
|
+
});
|
|
3497
|
+
}));
|
|
3498
|
+
});
|
|
3499
|
+
} else
|
|
3500
|
+
this._keepHoverDp && (this._keepHoverDp.dispose(), this._keepHoverDp = void 0);
|
|
3501
|
+
}
|
|
3502
|
+
_onShow() {
|
|
3503
|
+
super._onShow(), this.updateBackgroundColor();
|
|
3504
|
+
}
|
|
3505
|
+
updateBackgroundColor() {
|
|
3506
|
+
let t = this.get("tooltipTarget");
|
|
3507
|
+
const e = this.get("background");
|
|
3508
|
+
let i, s;
|
|
3509
|
+
if (t && e) {
|
|
3510
|
+
if (i = t.get("fill"), s = t.get("stroke"), i == null && (i = s), this.get("getFillFromSprite") && (this._fillDp && this._fillDp.dispose(), i != null && e.set("fill", i), this._fillDp = t.on("fill", (r) => {
|
|
3511
|
+
r != null && (e.set("fill", r), this._updateTextColor(r));
|
|
3512
|
+
}), this._disposers.push(this._fillDp)), this.get("getFillGradientFromSprite")) {
|
|
3513
|
+
this._fillGrDp && this._fillGrDp.dispose();
|
|
3514
|
+
let r = t.get("fillGradient");
|
|
3515
|
+
r != null && e.set("fillGradient", r), this._fillGrDp = t.on("fillGradient", (a) => {
|
|
3516
|
+
a != null && e.set("fillGradient", a);
|
|
3517
|
+
}), this._disposers.push(this._fillGrDp);
|
|
3518
|
+
}
|
|
3519
|
+
this.get("getStrokeFromSprite") && (this._strokeDp && this._strokeDp.dispose(), i != null && e.set("stroke", i), this._strokeDp = t.on("fill", (r) => {
|
|
3520
|
+
r != null && e.set("stroke", r);
|
|
3521
|
+
}), this._disposers.push(this._strokeDp)), this.get("getLabelFillFromSprite") && (this._labelDp && this._labelDp.dispose(), i != null && this.label.set("fill", i), this._labelDp = t.on("fill", (r) => {
|
|
3522
|
+
r != null && this.label.set("fill", r);
|
|
3523
|
+
}), this._disposers.push(this._labelDp));
|
|
3524
|
+
}
|
|
3525
|
+
this._updateTextColor(i);
|
|
3526
|
+
}
|
|
3527
|
+
_updateTextColor(t) {
|
|
3528
|
+
this.get("autoTextColor") && (t == null && (t = this.get("background").get("fill")), t == null && (t = this._root.interfaceColors.get("background")), t instanceof ht && this.label.set("fill", ht.alternative(t, this._root.interfaceColors.get("alternativeText"), this._root.interfaceColors.get("text"))));
|
|
3529
|
+
}
|
|
3530
|
+
_setDataItem(t) {
|
|
3531
|
+
super._setDataItem(t), this.label._setDataItem(t);
|
|
3532
|
+
}
|
|
3533
|
+
_updateBackground() {
|
|
3534
|
+
super.updateBackground();
|
|
3535
|
+
const t = this._root.container;
|
|
3536
|
+
if (t) {
|
|
3537
|
+
let e = 0.5, i = 0.5, s = this.get("centerX");
|
|
3538
|
+
s instanceof D && (e = s.value);
|
|
3539
|
+
let r = this.get("centerY");
|
|
3540
|
+
r instanceof D && (i = r.value);
|
|
3541
|
+
let a = t.width(), o = t.height(), l = this.parent, h = 0, u = 0;
|
|
3542
|
+
if (l) {
|
|
3543
|
+
h = l.x(), u = l.y();
|
|
3544
|
+
const P = l.get("layerMargin");
|
|
3545
|
+
P && (h += P.left || 0, u += P.top || 0, a += (P.left || 0) + (P.right || 0), o += (P.top || 0) + (P.bottom || 0));
|
|
3546
|
+
}
|
|
3547
|
+
const f = this.get("bounds", { left: -h, top: -u, right: a - h, bottom: o - u });
|
|
3548
|
+
this._updateBounds();
|
|
3549
|
+
let d = this.width(), p = this.height();
|
|
3550
|
+
d === 0 && (d = this._w), p === 0 && (p = this._h);
|
|
3551
|
+
let g = this.get("pointTo", { x: a / 2, y: o / 2 }), _ = g.x, v = g.y, c = this.get("pointerOrientation"), b = this.get("background"), y = 0, x = 0, k = 0;
|
|
3552
|
+
b instanceof R && (y = b.get("pointerLength", 0), x = b.get("strokeWidth", 0) / 2, k = x, b.set("width", d), b.set("height", p));
|
|
3553
|
+
let A = 0, G = 0, N = f.right - f.left, V = f.bottom - f.top;
|
|
3554
|
+
c == "horizontal" || c == "left" || c == "right" ? (x = 0, c == "horizontal" ? _ > f.left + N / 2 ? (_ -= d * (1 - e) + y, k *= -1) : _ += d * e + y : c == "left" ? _ += d * (1 - e) + y : (_ -= d * e + y, k *= -1)) : (k = 0, c == "vertical" ? v > f.top + p / 2 + y ? v -= p * (1 - i) + y : (v += p * i + y, x *= -1) : c == "down" ? v -= p * (1 - i) + y : (v += p * i + y, x *= -1)), _ = T(_, f.left + d * e, f.left + N - d * (1 - e)) + k, v = T(v, f.top + p * i, f.top + V - p * (1 - i)) - x, A = g.x - _ + d * e + k, G = g.y - v + p * i - x, this._fx = _, this._fy = v;
|
|
3555
|
+
const I = this.get("animationDuration", 0);
|
|
3556
|
+
if (I > 0 && this.get("visible") && this.get("opacity") > 0.1) {
|
|
3557
|
+
const P = this.get("animationEasing");
|
|
3558
|
+
this.animate({ key: "x", to: _, duration: I, easing: P }), this.animate({ key: "y", to: v, duration: I, easing: P });
|
|
3559
|
+
} else
|
|
3560
|
+
this.set("x", _), this.set("y", v);
|
|
3561
|
+
b instanceof R && (b.set("pointerX", A), b.set("pointerY", G)), d > 0 && (this._w = d), p > 0 && (this._h = p);
|
|
3562
|
+
}
|
|
3563
|
+
}
|
|
3564
|
+
}
|
|
3565
|
+
Object.defineProperty(_t, "className", {
|
|
3566
|
+
enumerable: !0,
|
|
3567
|
+
configurable: !0,
|
|
3568
|
+
writable: !0,
|
|
3569
|
+
value: "Tooltip"
|
|
3570
|
+
});
|
|
3571
|
+
Object.defineProperty(_t, "classNames", {
|
|
3572
|
+
enumerable: !0,
|
|
3573
|
+
configurable: !0,
|
|
3574
|
+
writable: !0,
|
|
3575
|
+
value: S.classNames.concat([_t.className])
|
|
3576
|
+
});
|
|
3577
|
+
export {
|
|
3578
|
+
ft as B,
|
|
3579
|
+
S as C,
|
|
3580
|
+
Qt as D,
|
|
3581
|
+
W as G,
|
|
3582
|
+
K as H,
|
|
3583
|
+
it as L,
|
|
3584
|
+
U as R,
|
|
3585
|
+
_t as T,
|
|
3586
|
+
$ as V,
|
|
3587
|
+
qt as a,
|
|
3588
|
+
Z as b,
|
|
3589
|
+
dt as c,
|
|
3590
|
+
Vt as d,
|
|
3591
|
+
et as e,
|
|
3592
|
+
T as f,
|
|
3593
|
+
ee as g,
|
|
3594
|
+
Et as h,
|
|
3595
|
+
se as i,
|
|
3596
|
+
Ht as j,
|
|
3597
|
+
te as k,
|
|
3598
|
+
ct as l,
|
|
3599
|
+
ie as m,
|
|
3600
|
+
Tt as n,
|
|
3601
|
+
J as o,
|
|
3602
|
+
tt as p,
|
|
3603
|
+
Zt as r,
|
|
3604
|
+
ut as s,
|
|
3605
|
+
re as v
|
|
3606
|
+
};
|