@xpell/xdashboard 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +148 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +2844 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/xbadge.d.ts +53 -0
- package/dist/types/xbadge.d.ts.map +1 -0
- package/dist/types/xcard.d.ts +72 -0
- package/dist/types/xcard.d.ts.map +1 -0
- package/dist/types/xcomp.d.ts +48 -0
- package/dist/types/xcomp.d.ts.map +1 -0
- package/dist/types/xdivider.d.ts +40 -0
- package/dist/types/xdivider.d.ts.map +1 -0
- package/dist/types/xdrawer.d.ts +69 -0
- package/dist/types/xdrawer.d.ts.map +1 -0
- package/dist/types/xempty.d.ts +51 -0
- package/dist/types/xempty.d.ts.map +1 -0
- package/dist/types/xfield.d.ts +68 -0
- package/dist/types/xfield.d.ts.map +1 -0
- package/dist/types/xgrid.d.ts +65 -0
- package/dist/types/xgrid.d.ts.map +1 -0
- package/dist/types/xigroup.d.ts +40 -0
- package/dist/types/xigroup.d.ts.map +1 -0
- package/dist/types/xkpicard.d.ts +52 -0
- package/dist/types/xkpicard.d.ts.map +1 -0
- package/dist/types/xmodal.d.ts +55 -0
- package/dist/types/xmodal.d.ts.map +1 -0
- package/dist/types/xnavlist.d.ts +52 -0
- package/dist/types/xnavlist.d.ts.map +1 -0
- package/dist/types/xscroll.d.ts +39 -0
- package/dist/types/xscroll.d.ts.map +1 -0
- package/dist/types/xsearch.d.ts +47 -0
- package/dist/types/xsearch.d.ts.map +1 -0
- package/dist/types/xsection.d.ts +40 -0
- package/dist/types/xsection.d.ts.map +1 -0
- package/dist/types/xselect.d.ts +44 -0
- package/dist/types/xselect.d.ts.map +1 -0
- package/dist/types/xsidebar.d.ts +81 -0
- package/dist/types/xsidebar.d.ts.map +1 -0
- package/dist/types/xsimp.d.ts +11 -0
- package/dist/types/xsimp.d.ts.map +1 -0
- package/dist/types/xspacer.d.ts +25 -0
- package/dist/types/xspacer.d.ts.map +1 -0
- package/dist/types/xstack.d.ts +51 -0
- package/dist/types/xstack.d.ts.map +1 -0
- package/dist/types/xtable.d.ts +75 -0
- package/dist/types/xtable.d.ts.map +1 -0
- package/dist/types/xtest.d.ts +16 -0
- package/dist/types/xtest.d.ts.map +1 -0
- package/dist/types/xtoast.d.ts +66 -0
- package/dist/types/xtoast.d.ts.map +1 -0
- package/dist/types/xtoolbar.d.ts +52 -0
- package/dist/types/xtoolbar.d.ts.map +1 -0
- package/dist/xdashboard.css +1 -0
- package/dist/xlogo.png +0 -0
- package/package.json +45 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2844 @@
|
|
|
1
|
+
import { XUIObject as a, XUI as n, _xd as T, XObjectPack as R } from "@xpell/ui";
|
|
2
|
+
class o extends a {
|
|
3
|
+
static _xtype = "stack";
|
|
4
|
+
__direction = "vertical";
|
|
5
|
+
__gap;
|
|
6
|
+
__align = "stretch";
|
|
7
|
+
__justify = "start";
|
|
8
|
+
__wrap = !1;
|
|
9
|
+
__grow = !1;
|
|
10
|
+
static managedStyles = /* @__PURE__ */ new Set([
|
|
11
|
+
"--xstack-gap",
|
|
12
|
+
"align-items",
|
|
13
|
+
"justify-content",
|
|
14
|
+
"flex-wrap",
|
|
15
|
+
"flex"
|
|
16
|
+
]);
|
|
17
|
+
constructor(t) {
|
|
18
|
+
const i = {
|
|
19
|
+
_type: o._xtype,
|
|
20
|
+
class: "xstack",
|
|
21
|
+
_html_tag: "div"
|
|
22
|
+
};
|
|
23
|
+
super(t, i, !0), this.parse(t), this.applyLayout();
|
|
24
|
+
}
|
|
25
|
+
normalizeDirection(t) {
|
|
26
|
+
return t === "horizontal" ? "horizontal" : "vertical";
|
|
27
|
+
}
|
|
28
|
+
normalizeAlign(t) {
|
|
29
|
+
return t === "start" || t === "center" || t === "end" || t === "stretch" ? t : "stretch";
|
|
30
|
+
}
|
|
31
|
+
normalizeJustify(t) {
|
|
32
|
+
return t === "start" || t === "center" || t === "end" || t === "space-between" || t === "space-around" || t === "space-evenly" ? t : "start";
|
|
33
|
+
}
|
|
34
|
+
normalizeGap(t) {
|
|
35
|
+
if (typeof t == "number" && Number.isFinite(t)) return t;
|
|
36
|
+
}
|
|
37
|
+
normalizeBoolean(t) {
|
|
38
|
+
return t === !0 || t === "true";
|
|
39
|
+
}
|
|
40
|
+
mapAlign(t) {
|
|
41
|
+
return t === "start" ? "flex-start" : t === "end" ? "flex-end" : t === "center" ? "center" : "stretch";
|
|
42
|
+
}
|
|
43
|
+
mapJustify(t) {
|
|
44
|
+
return t === "start" ? "flex-start" : t === "end" ? "flex-end" : t === "center" ? "center" : t;
|
|
45
|
+
}
|
|
46
|
+
splitClasses(t) {
|
|
47
|
+
return t.split(/\s+/).map((i) => i.trim()).filter(Boolean);
|
|
48
|
+
}
|
|
49
|
+
stripManagedStyles(t) {
|
|
50
|
+
if (!t) return "";
|
|
51
|
+
const i = t.split(";").map((s) => s.trim()).filter(Boolean), e = [];
|
|
52
|
+
for (const s of i) {
|
|
53
|
+
const _ = s.indexOf(":");
|
|
54
|
+
if (_ === -1) continue;
|
|
55
|
+
const r = s.slice(0, _).trim().toLowerCase(), l = s.slice(_ + 1).trim();
|
|
56
|
+
!r || !l || o.managedStyles.has(r) || e.push(`${r}:${l}`);
|
|
57
|
+
}
|
|
58
|
+
return e.join("; ");
|
|
59
|
+
}
|
|
60
|
+
buildClassName(t) {
|
|
61
|
+
const i = String(this.class || ""), e = String(this._class || ""), s = this.splitClasses(i).filter((r) => r !== "xstack" && r !== "xstack--v" && r !== "xstack--h"), _ = [
|
|
62
|
+
"xstack",
|
|
63
|
+
t === "horizontal" ? "xstack--h" : "xstack--v",
|
|
64
|
+
...s,
|
|
65
|
+
...this.splitClasses(e)
|
|
66
|
+
];
|
|
67
|
+
return Array.from(new Set(_.filter(Boolean))).join(" ");
|
|
68
|
+
}
|
|
69
|
+
applyLayout() {
|
|
70
|
+
const t = this.__direction || "vertical", i = this.__align || "stretch", e = this.__justify || "start", s = this.buildClassName(t);
|
|
71
|
+
this.class = s;
|
|
72
|
+
const _ = this.stripManagedStyles(String(this.style || "")), r = [];
|
|
73
|
+
_ && r.push(_), typeof this.__gap == "number" && r.push(`--xstack-gap:${this.__gap}px`), r.push(`align-items:${this.mapAlign(i)}`), r.push(`justify-content:${this.mapJustify(e)}`), this.__wrap && r.push("flex-wrap:wrap"), this.__grow && r.push("flex:1 1 auto");
|
|
74
|
+
const l = r.join("; ");
|
|
75
|
+
this.style = l;
|
|
76
|
+
}
|
|
77
|
+
set _direction(t) {
|
|
78
|
+
this.__direction = this.normalizeDirection(t), this.applyLayout();
|
|
79
|
+
}
|
|
80
|
+
get _direction() {
|
|
81
|
+
return this.__direction;
|
|
82
|
+
}
|
|
83
|
+
set _gap(t) {
|
|
84
|
+
this.__gap = this.normalizeGap(t), this.applyLayout();
|
|
85
|
+
}
|
|
86
|
+
get _gap() {
|
|
87
|
+
return this.__gap;
|
|
88
|
+
}
|
|
89
|
+
set _align(t) {
|
|
90
|
+
this.__align = this.normalizeAlign(t), this.applyLayout();
|
|
91
|
+
}
|
|
92
|
+
get _align() {
|
|
93
|
+
return this.__align;
|
|
94
|
+
}
|
|
95
|
+
set _justify(t) {
|
|
96
|
+
this.__justify = this.normalizeJustify(t), this.applyLayout();
|
|
97
|
+
}
|
|
98
|
+
get _justify() {
|
|
99
|
+
return this.__justify;
|
|
100
|
+
}
|
|
101
|
+
set _wrap(t) {
|
|
102
|
+
this.__wrap = this.normalizeBoolean(t), this.applyLayout();
|
|
103
|
+
}
|
|
104
|
+
get _wrap() {
|
|
105
|
+
return this.__wrap;
|
|
106
|
+
}
|
|
107
|
+
set _grow(t) {
|
|
108
|
+
this.__grow = this.normalizeBoolean(t), this.applyLayout();
|
|
109
|
+
}
|
|
110
|
+
get _grow() {
|
|
111
|
+
return this.__grow;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
class d extends a {
|
|
115
|
+
static _xtype = "scroll";
|
|
116
|
+
__direction = "vertical";
|
|
117
|
+
__grow = !1;
|
|
118
|
+
__hide_scrollbar = !1;
|
|
119
|
+
__max_height;
|
|
120
|
+
__max_width;
|
|
121
|
+
static managedStyles = /* @__PURE__ */ new Set([
|
|
122
|
+
"overflow",
|
|
123
|
+
"overflow-x",
|
|
124
|
+
"overflow-y",
|
|
125
|
+
"min-height",
|
|
126
|
+
"min-width",
|
|
127
|
+
"flex",
|
|
128
|
+
"max-height",
|
|
129
|
+
"max-width"
|
|
130
|
+
]);
|
|
131
|
+
constructor(t) {
|
|
132
|
+
const i = {
|
|
133
|
+
_type: d._xtype,
|
|
134
|
+
class: "xscroll",
|
|
135
|
+
_html_tag: "div"
|
|
136
|
+
};
|
|
137
|
+
super(t, i, !0), this.parse(t), this.applyLayout();
|
|
138
|
+
}
|
|
139
|
+
normalizeDirection(t) {
|
|
140
|
+
return t === "horizontal" || t === "both" ? t : "vertical";
|
|
141
|
+
}
|
|
142
|
+
normalizeBoolean(t) {
|
|
143
|
+
return t === !0 || t === "true";
|
|
144
|
+
}
|
|
145
|
+
splitClasses(t) {
|
|
146
|
+
return t.split(/\s+/).map((i) => i.trim()).filter(Boolean);
|
|
147
|
+
}
|
|
148
|
+
stripManagedStyles(t) {
|
|
149
|
+
if (!t) return "";
|
|
150
|
+
const i = t.split(";").map((s) => s.trim()).filter(Boolean), e = [];
|
|
151
|
+
for (const s of i) {
|
|
152
|
+
const _ = s.indexOf(":");
|
|
153
|
+
if (_ === -1) continue;
|
|
154
|
+
const r = s.slice(0, _).trim().toLowerCase(), l = s.slice(_ + 1).trim();
|
|
155
|
+
!r || !l || d.managedStyles.has(r) || e.push(`${r}:${l}`);
|
|
156
|
+
}
|
|
157
|
+
return e.join("; ");
|
|
158
|
+
}
|
|
159
|
+
buildClassName(t, i) {
|
|
160
|
+
const e = String(this.class || ""), _ = ["xscroll", ...this.splitClasses(e).filter(
|
|
161
|
+
(r) => r !== "xscroll" && r !== "xscroll--hide" && r !== "xscroll--v" && r !== "xscroll--h" && r !== "xscroll--both"
|
|
162
|
+
)];
|
|
163
|
+
return t === "horizontal" ? _.push("xscroll--h") : t === "both" ? _.push("xscroll--both") : _.push("xscroll--v"), i && _.push("xscroll--hide"), Array.from(new Set(_.filter(Boolean))).join(" ");
|
|
164
|
+
}
|
|
165
|
+
applyLayout() {
|
|
166
|
+
const t = this.__direction || "vertical", i = this.buildClassName(t, this.__hide_scrollbar);
|
|
167
|
+
this.class = i;
|
|
168
|
+
const e = this.stripManagedStyles(String(this.style || "")), s = [];
|
|
169
|
+
e && s.push(e), s.push("min-height:0"), s.push("min-width:0"), t === "horizontal" ? (s.push("overflow-x:auto"), s.push("overflow-y:hidden")) : t === "both" ? s.push("overflow:auto") : (s.push("overflow-y:auto"), s.push("overflow-x:hidden")), this.__grow && s.push("flex:1 1 auto"), this.__max_height && s.push(`max-height:${this.__max_height}`), this.__max_width && s.push(`max-width:${this.__max_width}`);
|
|
170
|
+
const _ = s.join("; ");
|
|
171
|
+
this.style = _;
|
|
172
|
+
}
|
|
173
|
+
set _direction(t) {
|
|
174
|
+
this.__direction = this.normalizeDirection(t), this.applyLayout();
|
|
175
|
+
}
|
|
176
|
+
get _direction() {
|
|
177
|
+
return this.__direction;
|
|
178
|
+
}
|
|
179
|
+
set _grow(t) {
|
|
180
|
+
this.__grow = this.normalizeBoolean(t), this.applyLayout();
|
|
181
|
+
}
|
|
182
|
+
get _grow() {
|
|
183
|
+
return this.__grow;
|
|
184
|
+
}
|
|
185
|
+
set _hide_scrollbar(t) {
|
|
186
|
+
this.__hide_scrollbar = this.normalizeBoolean(t), this.applyLayout();
|
|
187
|
+
}
|
|
188
|
+
get _hide_scrollbar() {
|
|
189
|
+
return this.__hide_scrollbar;
|
|
190
|
+
}
|
|
191
|
+
set _max_height(t) {
|
|
192
|
+
this.__max_height = t, this.applyLayout();
|
|
193
|
+
}
|
|
194
|
+
get _max_height() {
|
|
195
|
+
return this.__max_height;
|
|
196
|
+
}
|
|
197
|
+
set _max_width(t) {
|
|
198
|
+
this.__max_width = t, this.applyLayout();
|
|
199
|
+
}
|
|
200
|
+
get _max_width() {
|
|
201
|
+
return this.__max_width;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
class c extends a {
|
|
205
|
+
static _xtype = "spacer";
|
|
206
|
+
__size = 16;
|
|
207
|
+
__direction = "vertical";
|
|
208
|
+
static managedStyles = /* @__PURE__ */ new Set(["width", "height", "min-width", "min-height"]);
|
|
209
|
+
constructor(t) {
|
|
210
|
+
const i = {
|
|
211
|
+
_type: c._xtype,
|
|
212
|
+
class: "xspacer",
|
|
213
|
+
_html_tag: "div"
|
|
214
|
+
};
|
|
215
|
+
super(t, i, !0), this.parse(t), this.applyLayout();
|
|
216
|
+
}
|
|
217
|
+
normalizeDirection(t) {
|
|
218
|
+
return t === "horizontal" ? "horizontal" : "vertical";
|
|
219
|
+
}
|
|
220
|
+
normalizeSize(t) {
|
|
221
|
+
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : 16;
|
|
222
|
+
}
|
|
223
|
+
stripManagedStyles(t) {
|
|
224
|
+
if (!t) return "";
|
|
225
|
+
const i = t.split(";").map((s) => s.trim()).filter(Boolean), e = [];
|
|
226
|
+
for (const s of i) {
|
|
227
|
+
const _ = s.indexOf(":");
|
|
228
|
+
if (_ === -1) continue;
|
|
229
|
+
const r = s.slice(0, _).trim().toLowerCase(), l = s.slice(_ + 1).trim();
|
|
230
|
+
!r || !l || c.managedStyles.has(r) || e.push(`${r}:${l}`);
|
|
231
|
+
}
|
|
232
|
+
return e.join("; ");
|
|
233
|
+
}
|
|
234
|
+
applyLayout() {
|
|
235
|
+
const t = this.__size, i = this.__direction, e = this.stripManagedStyles(String(this.style || "")), s = [];
|
|
236
|
+
e && s.push(e), i === "horizontal" ? (s.push(`width:${t}px`), s.push(`min-width:${t}px`)) : (s.push(`height:${t}px`), s.push(`min-height:${t}px`));
|
|
237
|
+
const _ = s.join("; ");
|
|
238
|
+
this.style = _, this._dom_object && this._dom_object.setAttribute("style", _);
|
|
239
|
+
}
|
|
240
|
+
set _size(t) {
|
|
241
|
+
this.__size = this.normalizeSize(t), this.applyLayout();
|
|
242
|
+
}
|
|
243
|
+
get _size() {
|
|
244
|
+
return this.__size;
|
|
245
|
+
}
|
|
246
|
+
set _direction(t) {
|
|
247
|
+
this.__direction = this.normalizeDirection(t), this.applyLayout();
|
|
248
|
+
}
|
|
249
|
+
get _direction() {
|
|
250
|
+
return this.__direction;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
class p extends a {
|
|
254
|
+
static _xtype = "divider";
|
|
255
|
+
__orientation = "horizontal";
|
|
256
|
+
__thickness = 1;
|
|
257
|
+
__length;
|
|
258
|
+
__inset;
|
|
259
|
+
__muted = !1;
|
|
260
|
+
static managedStyles = /* @__PURE__ */ new Set([
|
|
261
|
+
"--xdivider-thickness",
|
|
262
|
+
"--xdivider-length",
|
|
263
|
+
"--xdivider-inset"
|
|
264
|
+
]);
|
|
265
|
+
constructor(t) {
|
|
266
|
+
const i = {
|
|
267
|
+
_type: p._xtype,
|
|
268
|
+
class: "xdivider",
|
|
269
|
+
_html_tag: "div"
|
|
270
|
+
};
|
|
271
|
+
super(t, i, !0), this.parse(t), this.applyLayout();
|
|
272
|
+
}
|
|
273
|
+
normalizeOrientation(t) {
|
|
274
|
+
return t === "vertical" ? "vertical" : "horizontal";
|
|
275
|
+
}
|
|
276
|
+
normalizeThickness(t) {
|
|
277
|
+
return typeof t == "number" && Number.isFinite(t) && t > 0 ? t : 1;
|
|
278
|
+
}
|
|
279
|
+
normalizeBoolean(t) {
|
|
280
|
+
return t === !0 || t === "true";
|
|
281
|
+
}
|
|
282
|
+
splitClasses(t) {
|
|
283
|
+
return t.split(/\s+/).map((i) => i.trim()).filter(Boolean);
|
|
284
|
+
}
|
|
285
|
+
stripManagedStyles(t) {
|
|
286
|
+
if (!t) return "";
|
|
287
|
+
const i = t.split(";").map((s) => s.trim()).filter(Boolean), e = [];
|
|
288
|
+
for (const s of i) {
|
|
289
|
+
const _ = s.indexOf(":");
|
|
290
|
+
if (_ === -1) continue;
|
|
291
|
+
const r = s.slice(0, _).trim().toLowerCase(), l = s.slice(_ + 1).trim();
|
|
292
|
+
!r || !l || p.managedStyles.has(r) || e.push(`${r}:${l}`);
|
|
293
|
+
}
|
|
294
|
+
return e.join("; ");
|
|
295
|
+
}
|
|
296
|
+
buildClassName(t, i) {
|
|
297
|
+
const e = String(this.class || ""), s = this.splitClasses(e).filter(
|
|
298
|
+
(r) => r !== "xdivider" && r !== "xdivider--h" && r !== "xdivider--v" && r !== "xdivider--muted"
|
|
299
|
+
), _ = [
|
|
300
|
+
"xdivider",
|
|
301
|
+
t === "vertical" ? "xdivider--v" : "xdivider--h",
|
|
302
|
+
...s
|
|
303
|
+
];
|
|
304
|
+
return i && _.push("xdivider--muted"), Array.from(new Set(_.filter(Boolean))).join(" ");
|
|
305
|
+
}
|
|
306
|
+
applyLayout() {
|
|
307
|
+
const t = this.__orientation, i = this.buildClassName(t, this.__muted);
|
|
308
|
+
this.class = i;
|
|
309
|
+
const e = this.stripManagedStyles(String(this.style || "")), s = [];
|
|
310
|
+
e && s.push(e), s.push(`--xdivider-thickness:${this.__thickness}px`), this.__length && s.push(`--xdivider-length:${this.__length}`), typeof this.__inset == "number" && s.push(`--xdivider-inset:${this.__inset}px`);
|
|
311
|
+
const _ = s.join("; ");
|
|
312
|
+
this.style = _;
|
|
313
|
+
}
|
|
314
|
+
set _orientation(t) {
|
|
315
|
+
this.__orientation = this.normalizeOrientation(t), this.applyLayout();
|
|
316
|
+
}
|
|
317
|
+
get _orientation() {
|
|
318
|
+
return this.__orientation;
|
|
319
|
+
}
|
|
320
|
+
set _thickness(t) {
|
|
321
|
+
this.__thickness = this.normalizeThickness(t), this.applyLayout();
|
|
322
|
+
}
|
|
323
|
+
get _thickness() {
|
|
324
|
+
return this.__thickness;
|
|
325
|
+
}
|
|
326
|
+
set _length(t) {
|
|
327
|
+
this.__length = t, this.applyLayout();
|
|
328
|
+
}
|
|
329
|
+
get _length() {
|
|
330
|
+
return this.__length;
|
|
331
|
+
}
|
|
332
|
+
set _inset(t) {
|
|
333
|
+
this.__inset = t, this.applyLayout();
|
|
334
|
+
}
|
|
335
|
+
get _inset() {
|
|
336
|
+
return this.__inset;
|
|
337
|
+
}
|
|
338
|
+
set _muted(t) {
|
|
339
|
+
this.__muted = this.normalizeBoolean(t), this.applyLayout();
|
|
340
|
+
}
|
|
341
|
+
get _muted() {
|
|
342
|
+
return this.__muted;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
class u extends a {
|
|
346
|
+
static _xtype = "toolbar";
|
|
347
|
+
__gap = 8;
|
|
348
|
+
__align = "center";
|
|
349
|
+
__justify = "start";
|
|
350
|
+
__wrap = !1;
|
|
351
|
+
__sticky = !1;
|
|
352
|
+
__top = 0;
|
|
353
|
+
__elevated = !1;
|
|
354
|
+
static managedStyles = /* @__PURE__ */ new Set([
|
|
355
|
+
"--xtoolbar-gap",
|
|
356
|
+
"align-items",
|
|
357
|
+
"justify-content",
|
|
358
|
+
"flex-wrap",
|
|
359
|
+
"position",
|
|
360
|
+
"top",
|
|
361
|
+
"z-index"
|
|
362
|
+
]);
|
|
363
|
+
constructor(t) {
|
|
364
|
+
const i = {
|
|
365
|
+
_type: u._xtype,
|
|
366
|
+
class: "xtoolbar",
|
|
367
|
+
_html_tag: "div"
|
|
368
|
+
};
|
|
369
|
+
super(t, i, !0), this.parse(t), this.applyLayout();
|
|
370
|
+
}
|
|
371
|
+
normalizeAlign(t) {
|
|
372
|
+
return t === "start" || t === "center" || t === "end" || t === "stretch" ? t : "center";
|
|
373
|
+
}
|
|
374
|
+
normalizeJustify(t) {
|
|
375
|
+
return t === "start" || t === "center" || t === "end" || t === "space-between" ? t : "start";
|
|
376
|
+
}
|
|
377
|
+
normalizeGap(t) {
|
|
378
|
+
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : 8;
|
|
379
|
+
}
|
|
380
|
+
normalizeBoolean(t) {
|
|
381
|
+
return t === !0 || t === "true";
|
|
382
|
+
}
|
|
383
|
+
mapAlign(t) {
|
|
384
|
+
return t === "start" ? "flex-start" : t === "end" ? "flex-end" : t === "center" ? "center" : "stretch";
|
|
385
|
+
}
|
|
386
|
+
mapJustify(t) {
|
|
387
|
+
return t === "start" ? "flex-start" : t === "end" ? "flex-end" : t === "center" ? "center" : t;
|
|
388
|
+
}
|
|
389
|
+
splitClasses(t) {
|
|
390
|
+
return t.split(/\s+/).map((i) => i.trim()).filter(Boolean);
|
|
391
|
+
}
|
|
392
|
+
stripManagedStyles(t) {
|
|
393
|
+
if (!t) return "";
|
|
394
|
+
const i = t.split(";").map((s) => s.trim()).filter(Boolean), e = [];
|
|
395
|
+
for (const s of i) {
|
|
396
|
+
const _ = s.indexOf(":");
|
|
397
|
+
if (_ === -1) continue;
|
|
398
|
+
const r = s.slice(0, _).trim().toLowerCase(), l = s.slice(_ + 1).trim();
|
|
399
|
+
!r || !l || u.managedStyles.has(r) || e.push(`${r}:${l}`);
|
|
400
|
+
}
|
|
401
|
+
return e.join("; ");
|
|
402
|
+
}
|
|
403
|
+
buildClassName(t) {
|
|
404
|
+
const i = String(this.class || ""), s = ["xtoolbar", ...this.splitClasses(i).filter((_) => _ !== "xtoolbar" && _ !== "xtoolbar--elevated")];
|
|
405
|
+
return t && s.push("xtoolbar--elevated"), Array.from(new Set(s.filter(Boolean))).join(" ");
|
|
406
|
+
}
|
|
407
|
+
applyLayout() {
|
|
408
|
+
const t = this.buildClassName(this.__elevated);
|
|
409
|
+
this.class = t;
|
|
410
|
+
const i = this.stripManagedStyles(String(this.style || "")), e = [];
|
|
411
|
+
i && e.push(i), e.push(`--xtoolbar-gap:${this.__gap}px`), e.push(`align-items:${this.mapAlign(this.__align)}`), e.push(`justify-content:${this.mapJustify(this.__justify)}`), this.__wrap && e.push("flex-wrap:wrap"), this.__sticky && (e.push("position:sticky"), e.push(`top:${this.__top}px`), e.push("z-index:10"));
|
|
412
|
+
const s = e.join("; ");
|
|
413
|
+
this.style = s;
|
|
414
|
+
}
|
|
415
|
+
set _gap(t) {
|
|
416
|
+
this.__gap = this.normalizeGap(t), this.applyLayout();
|
|
417
|
+
}
|
|
418
|
+
get _gap() {
|
|
419
|
+
return this.__gap;
|
|
420
|
+
}
|
|
421
|
+
set _align(t) {
|
|
422
|
+
this.__align = this.normalizeAlign(t), this.applyLayout();
|
|
423
|
+
}
|
|
424
|
+
get _align() {
|
|
425
|
+
return this.__align;
|
|
426
|
+
}
|
|
427
|
+
set _justify(t) {
|
|
428
|
+
this.__justify = this.normalizeJustify(t), this.applyLayout();
|
|
429
|
+
}
|
|
430
|
+
get _justify() {
|
|
431
|
+
return this.__justify;
|
|
432
|
+
}
|
|
433
|
+
set _wrap(t) {
|
|
434
|
+
this.__wrap = this.normalizeBoolean(t), this.applyLayout();
|
|
435
|
+
}
|
|
436
|
+
get _wrap() {
|
|
437
|
+
return this.__wrap;
|
|
438
|
+
}
|
|
439
|
+
set _sticky(t) {
|
|
440
|
+
this.__sticky = this.normalizeBoolean(t), this.applyLayout();
|
|
441
|
+
}
|
|
442
|
+
get _sticky() {
|
|
443
|
+
return this.__sticky;
|
|
444
|
+
}
|
|
445
|
+
set _top(t) {
|
|
446
|
+
this.__top = typeof t == "number" && Number.isFinite(t) ? t : 0, this.applyLayout();
|
|
447
|
+
}
|
|
448
|
+
get _top() {
|
|
449
|
+
return this.__top;
|
|
450
|
+
}
|
|
451
|
+
set _elevated(t) {
|
|
452
|
+
this.__elevated = this.normalizeBoolean(t), this.applyLayout();
|
|
453
|
+
}
|
|
454
|
+
get _elevated() {
|
|
455
|
+
return this.__elevated;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
class x extends a {
|
|
459
|
+
static _xtype = "table";
|
|
460
|
+
__columns = [];
|
|
461
|
+
__rows;
|
|
462
|
+
__row_key;
|
|
463
|
+
__dense = !1;
|
|
464
|
+
__striped = !1;
|
|
465
|
+
__hover = !0;
|
|
466
|
+
__bordered = !0;
|
|
467
|
+
__empty_text = "No data";
|
|
468
|
+
__ready = !1;
|
|
469
|
+
__data_inflight = !1;
|
|
470
|
+
constructor(t) {
|
|
471
|
+
const i = {
|
|
472
|
+
_type: x._xtype,
|
|
473
|
+
class: "xtable",
|
|
474
|
+
_html_tag: "div"
|
|
475
|
+
};
|
|
476
|
+
super(t, i, !0), this.parse(t), this.applyPropsFromData(), this.applyLayout(), this.buildSkeleton(), this.__ready = !0, this.renderBody();
|
|
477
|
+
}
|
|
478
|
+
get tableId() {
|
|
479
|
+
return this._id + "_table";
|
|
480
|
+
}
|
|
481
|
+
get theadId() {
|
|
482
|
+
return this._id + "_thead";
|
|
483
|
+
}
|
|
484
|
+
get tbodyId() {
|
|
485
|
+
return this._id + "_tbody";
|
|
486
|
+
}
|
|
487
|
+
normalizeAlign(t) {
|
|
488
|
+
if (t === "start" || t === "center" || t === "end") return t;
|
|
489
|
+
}
|
|
490
|
+
normalizeBoolean(t) {
|
|
491
|
+
return t === !0 || t === "true";
|
|
492
|
+
}
|
|
493
|
+
applyPropsFromData() {
|
|
494
|
+
const t = this._columns;
|
|
495
|
+
this.__columns = Array.isArray(t) ? t : [], this.__rows = this._rows, this.__row_key = this._row_key != null ? String(this._row_key) : void 0, this.__dense = this.normalizeBoolean(this._dense), this.__striped = this.normalizeBoolean(this._striped);
|
|
496
|
+
const i = this._hover;
|
|
497
|
+
i === !1 || i === "false" ? this.__hover = !1 : (i === !0 || i === "true") && (this.__hover = !0);
|
|
498
|
+
const e = this._bordered;
|
|
499
|
+
e === !1 || e === "false" ? this.__bordered = !1 : (e === !0 || e === "true") && (this.__bordered = !0), this.__empty_text = this._empty_text ? String(this._empty_text) : "No data";
|
|
500
|
+
}
|
|
501
|
+
mapAlign(t) {
|
|
502
|
+
if (t)
|
|
503
|
+
return t === "start" ? "left" : t === "end" ? "right" : "center";
|
|
504
|
+
}
|
|
505
|
+
applyLayout() {
|
|
506
|
+
this.addClass("xtable");
|
|
507
|
+
const t = [
|
|
508
|
+
"xtable--dense",
|
|
509
|
+
"xtable--striped",
|
|
510
|
+
"xtable--hover",
|
|
511
|
+
"xtable--bordered"
|
|
512
|
+
], i = [];
|
|
513
|
+
this.__dense && i.push("xtable--dense"), this.__striped && i.push("xtable--striped"), this.__hover && i.push("xtable--hover"), this.__bordered && i.push("xtable--bordered"), this.replaceClass(t.join(" "), i.join(" "));
|
|
514
|
+
}
|
|
515
|
+
buildSkeleton() {
|
|
516
|
+
const t = {
|
|
517
|
+
_type: "xhtml",
|
|
518
|
+
_id: this.tableId,
|
|
519
|
+
class: "xtable__table",
|
|
520
|
+
_html_tag: "table",
|
|
521
|
+
_children: [
|
|
522
|
+
{
|
|
523
|
+
_type: "xhtml",
|
|
524
|
+
_id: this.theadId,
|
|
525
|
+
class: "xtable__head",
|
|
526
|
+
_html_tag: "thead"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
_type: "xhtml",
|
|
530
|
+
_id: this.tbodyId,
|
|
531
|
+
class: "xtable__body",
|
|
532
|
+
_html_tag: "tbody"
|
|
533
|
+
}
|
|
534
|
+
]
|
|
535
|
+
};
|
|
536
|
+
this.append(t), this.buildHeader();
|
|
537
|
+
}
|
|
538
|
+
clearChildren(t) {
|
|
539
|
+
if (!t) return;
|
|
540
|
+
(Array.isArray(t._children) ? [...t._children] : []).forEach((e) => {
|
|
541
|
+
e && t.removeChild(e, !0);
|
|
542
|
+
}), t.dom instanceof HTMLElement && t.dom.replaceChildren();
|
|
543
|
+
}
|
|
544
|
+
getHead() {
|
|
545
|
+
return n.getObject(this.theadId);
|
|
546
|
+
}
|
|
547
|
+
getBody() {
|
|
548
|
+
return n.getObject(this.tbodyId);
|
|
549
|
+
}
|
|
550
|
+
buildHeader() {
|
|
551
|
+
const t = this.getHead();
|
|
552
|
+
if (!t) return;
|
|
553
|
+
this.clearChildren(t);
|
|
554
|
+
const i = n.create({
|
|
555
|
+
_type: "xhtml",
|
|
556
|
+
class: "xtable__row",
|
|
557
|
+
_html_tag: "tr"
|
|
558
|
+
});
|
|
559
|
+
this.__columns.forEach((e) => {
|
|
560
|
+
const s = this.mapAlign(this.normalizeAlign(e.align)), _ = [];
|
|
561
|
+
e.width && _.push(`width:${e.width}`), s && _.push(`text-align:${s}`);
|
|
562
|
+
const r = _.join("; "), l = n.create({
|
|
563
|
+
_type: "xhtml",
|
|
564
|
+
_html_tag: "th",
|
|
565
|
+
class: `xtable__th${e.class ? " " + e.class : ""}`,
|
|
566
|
+
_text: e.label || e.key,
|
|
567
|
+
...r ? { style: r } : {}
|
|
568
|
+
});
|
|
569
|
+
i.append(l);
|
|
570
|
+
}), t.append(i);
|
|
571
|
+
}
|
|
572
|
+
resolveRows() {
|
|
573
|
+
if (Array.isArray(this.__rows)) return this.__rows;
|
|
574
|
+
if (typeof this.__rows == "string" && T && T._o) {
|
|
575
|
+
const t = T._o[this.__rows];
|
|
576
|
+
return Array.isArray(t) ? t : t && Array.isArray(t.rows) ? t.rows : [];
|
|
577
|
+
}
|
|
578
|
+
return [];
|
|
579
|
+
}
|
|
580
|
+
isXObjectData(t) {
|
|
581
|
+
return t && typeof t == "object" && typeof t._type == "string";
|
|
582
|
+
}
|
|
583
|
+
setCellText(t, i) {
|
|
584
|
+
if (typeof t.setText == "function") {
|
|
585
|
+
t.setText(i);
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
t._text = i, t.dom instanceof HTMLElement && (t.dom.textContent = i);
|
|
589
|
+
}
|
|
590
|
+
appendCellContent(t, i) {
|
|
591
|
+
if (i instanceof a) {
|
|
592
|
+
t.append(i);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if (this.isXObjectData(i)) {
|
|
596
|
+
const e = n.create(i);
|
|
597
|
+
t.append(e);
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
this.setCellText(t, String(i ?? ""));
|
|
601
|
+
}
|
|
602
|
+
renderBody() {
|
|
603
|
+
const t = this.getBody();
|
|
604
|
+
if (!t) return;
|
|
605
|
+
this.clearChildren(t);
|
|
606
|
+
const i = this.resolveRows(), e = this.__columns || [], s = Math.max(1, e.length);
|
|
607
|
+
if (!i.length) {
|
|
608
|
+
const _ = n.create({
|
|
609
|
+
_type: "xhtml",
|
|
610
|
+
_html_tag: "tr",
|
|
611
|
+
class: "xtable__row xtable__row--empty"
|
|
612
|
+
}), r = n.create({
|
|
613
|
+
_type: "xhtml",
|
|
614
|
+
_html_tag: "td",
|
|
615
|
+
class: "xtable__td xtable__empty",
|
|
616
|
+
colspan: String(s)
|
|
617
|
+
});
|
|
618
|
+
this.setCellText(r, this.__empty_text), _.append(r), t.append(_);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
i.forEach((_, r) => {
|
|
622
|
+
const l = n.create({
|
|
623
|
+
_type: "xhtml",
|
|
624
|
+
_html_tag: "tr",
|
|
625
|
+
class: "xtable__row"
|
|
626
|
+
});
|
|
627
|
+
this.__row_key && _ && _[this.__row_key] != null && (l["data-key"] = String(_[this.__row_key])), e.forEach((h) => {
|
|
628
|
+
const I = this.mapAlign(this.normalizeAlign(h.align)), O = [];
|
|
629
|
+
h.width && O.push(`width:${h.width}`), I && O.push(`text-align:${I}`);
|
|
630
|
+
const H = O.join("; "), $ = n.create({
|
|
631
|
+
_type: "xhtml",
|
|
632
|
+
_html_tag: "td",
|
|
633
|
+
class: `xtable__td${h.class ? " " + h.class : ""}`,
|
|
634
|
+
...H ? { style: H } : {}
|
|
635
|
+
}), P = _ ? _[h.key] : void 0;
|
|
636
|
+
if (h.render) {
|
|
637
|
+
const N = h.render(P, _, r);
|
|
638
|
+
this.appendCellContent($, N);
|
|
639
|
+
} else
|
|
640
|
+
this.setCellText($, String(P ?? ""));
|
|
641
|
+
l.append($);
|
|
642
|
+
}), t.append(l);
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
refresh() {
|
|
646
|
+
this.renderBody();
|
|
647
|
+
}
|
|
648
|
+
rebuildHeaderAndBody() {
|
|
649
|
+
this.__ready && (this.buildHeader(), this.renderBody());
|
|
650
|
+
}
|
|
651
|
+
set _columns(t) {
|
|
652
|
+
this.__columns = Array.isArray(t) ? t : [], this.rebuildHeaderAndBody();
|
|
653
|
+
}
|
|
654
|
+
get _columns() {
|
|
655
|
+
return this.__columns;
|
|
656
|
+
}
|
|
657
|
+
set _rows(t) {
|
|
658
|
+
this.__rows = t, this.__ready && this.renderBody();
|
|
659
|
+
}
|
|
660
|
+
get _rows() {
|
|
661
|
+
return this.__rows;
|
|
662
|
+
}
|
|
663
|
+
set _row_key(t) {
|
|
664
|
+
this.__row_key = t;
|
|
665
|
+
}
|
|
666
|
+
get _row_key() {
|
|
667
|
+
return this.__row_key;
|
|
668
|
+
}
|
|
669
|
+
set _dense(t) {
|
|
670
|
+
this.__dense = this.normalizeBoolean(t), this.applyLayout();
|
|
671
|
+
}
|
|
672
|
+
get _dense() {
|
|
673
|
+
return this.__dense;
|
|
674
|
+
}
|
|
675
|
+
set _striped(t) {
|
|
676
|
+
this.__striped = this.normalizeBoolean(t), this.applyLayout();
|
|
677
|
+
}
|
|
678
|
+
get _striped() {
|
|
679
|
+
return this.__striped;
|
|
680
|
+
}
|
|
681
|
+
set _hover(t) {
|
|
682
|
+
this.__hover = t === !1 ? !1 : this.normalizeBoolean(t), this.applyLayout();
|
|
683
|
+
}
|
|
684
|
+
get _hover() {
|
|
685
|
+
return this.__hover;
|
|
686
|
+
}
|
|
687
|
+
set _bordered(t) {
|
|
688
|
+
this.__bordered = t === !1 ? !1 : this.normalizeBoolean(t), this.applyLayout();
|
|
689
|
+
}
|
|
690
|
+
get _bordered() {
|
|
691
|
+
return this.__bordered;
|
|
692
|
+
}
|
|
693
|
+
set _empty_text(t) {
|
|
694
|
+
this.__empty_text = t || "No data", this.__ready && this.renderBody();
|
|
695
|
+
}
|
|
696
|
+
get _empty_text() {
|
|
697
|
+
return this.__empty_text;
|
|
698
|
+
}
|
|
699
|
+
async onData(t) {
|
|
700
|
+
if (this.__data_inflight) return;
|
|
701
|
+
this.__data_inflight = !0;
|
|
702
|
+
const i = this.emptyDataSource || this.emptyDataSorce;
|
|
703
|
+
typeof i == "function" && i.call(this);
|
|
704
|
+
const e = this.__rows;
|
|
705
|
+
if (await super.onData(t), this._on_data != null)
|
|
706
|
+
this.__rows !== e && this.refresh();
|
|
707
|
+
else {
|
|
708
|
+
let _ = [];
|
|
709
|
+
Array.isArray(t) ? _ = t : t && Array.isArray(t.rows) && (_ = t.rows);
|
|
710
|
+
const r = this.__rows !== _;
|
|
711
|
+
this.__rows = _, r && this.refresh();
|
|
712
|
+
}
|
|
713
|
+
this.__data_inflight = !1;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
class b extends a {
|
|
717
|
+
static _xtype = "badge";
|
|
718
|
+
__text = "";
|
|
719
|
+
__variant = "default";
|
|
720
|
+
__size = "md";
|
|
721
|
+
__pill = !0;
|
|
722
|
+
__dot = !1;
|
|
723
|
+
__title;
|
|
724
|
+
__dot_id;
|
|
725
|
+
__text_id;
|
|
726
|
+
constructor(t) {
|
|
727
|
+
const i = {
|
|
728
|
+
_type: b._xtype,
|
|
729
|
+
class: "xbadge",
|
|
730
|
+
_html_tag: "span"
|
|
731
|
+
};
|
|
732
|
+
super(t, i, !0), this.__dot_id = this._id + "_dot", this.__text_id = this._id + "_text", this.parse(t), this.applyProps(), this.buildSkeleton(), this.applyLayout(), this.applyText();
|
|
733
|
+
}
|
|
734
|
+
normalizeVariant(t) {
|
|
735
|
+
return t === "success" || t === "warn" || t === "error" || t === "info" ? t : "default";
|
|
736
|
+
}
|
|
737
|
+
normalizeSize(t) {
|
|
738
|
+
return t === "sm" ? "sm" : "md";
|
|
739
|
+
}
|
|
740
|
+
normalizeBoolean(t) {
|
|
741
|
+
return t === !0 || t === "true";
|
|
742
|
+
}
|
|
743
|
+
applyProps() {
|
|
744
|
+
this.__text = this._text ? String(this._text) : "", this.__variant = this.normalizeVariant(this._variant), this.__size = this.normalizeSize(this._size), this._pill === void 0 ? this.__pill = !0 : this.__pill = this.normalizeBoolean(this._pill), this.__dot = this.normalizeBoolean(this._dot), this.__title = this._title ? String(this._title) : void 0;
|
|
745
|
+
}
|
|
746
|
+
splitClasses(t) {
|
|
747
|
+
return t.split(/\s+/).map((i) => i.trim()).filter(Boolean);
|
|
748
|
+
}
|
|
749
|
+
buildClassName() {
|
|
750
|
+
const t = String(this.class || ""), i = /* @__PURE__ */ new Set([
|
|
751
|
+
"xbadge",
|
|
752
|
+
"xbadge--default",
|
|
753
|
+
"xbadge--success",
|
|
754
|
+
"xbadge--warn",
|
|
755
|
+
"xbadge--error",
|
|
756
|
+
"xbadge--info",
|
|
757
|
+
"xbadge--sm",
|
|
758
|
+
"xbadge--md",
|
|
759
|
+
"xbadge--pill",
|
|
760
|
+
"xbadge--dot"
|
|
761
|
+
]), e = this.splitClasses(t).filter((_) => !i.has(_)), s = [
|
|
762
|
+
"xbadge",
|
|
763
|
+
`xbadge--${this.__variant}`,
|
|
764
|
+
`xbadge--${this.__size}`,
|
|
765
|
+
...e
|
|
766
|
+
];
|
|
767
|
+
return this.__pill && s.push("xbadge--pill"), this.__dot && s.push("xbadge--dot"), Array.from(new Set(s.filter(Boolean))).join(" ");
|
|
768
|
+
}
|
|
769
|
+
buildSkeleton() {
|
|
770
|
+
const t = {
|
|
771
|
+
_type: "label",
|
|
772
|
+
_id: this.__dot_id,
|
|
773
|
+
class: "xbadge__dot"
|
|
774
|
+
}, i = {
|
|
775
|
+
_type: "label",
|
|
776
|
+
_id: this.__text_id,
|
|
777
|
+
class: "xbadge__text"
|
|
778
|
+
};
|
|
779
|
+
this.append(t), this.append(i);
|
|
780
|
+
}
|
|
781
|
+
applyText() {
|
|
782
|
+
const t = n.getObject(this.__text_id);
|
|
783
|
+
t && (t._text = this.__text);
|
|
784
|
+
}
|
|
785
|
+
applyLayout() {
|
|
786
|
+
const t = this.buildClassName();
|
|
787
|
+
this.class = t, this._dom_object && (this._dom_object.className = t), this.__title ? this._dom_object && this._dom_object.setAttribute("title", this.__title) : this._dom_object && this._dom_object.removeAttribute("title");
|
|
788
|
+
}
|
|
789
|
+
set _text(t) {
|
|
790
|
+
this.setText(String(t ?? ""));
|
|
791
|
+
}
|
|
792
|
+
get _text() {
|
|
793
|
+
return this.__text;
|
|
794
|
+
}
|
|
795
|
+
setText(t) {
|
|
796
|
+
this.__text = t, this.applyText();
|
|
797
|
+
}
|
|
798
|
+
setVariant(t) {
|
|
799
|
+
this.__variant = this.normalizeVariant(t), this.applyLayout();
|
|
800
|
+
}
|
|
801
|
+
setDot(t) {
|
|
802
|
+
this.__dot = this.normalizeBoolean(t), this.applyLayout();
|
|
803
|
+
}
|
|
804
|
+
setPill(t) {
|
|
805
|
+
this.__pill = this.normalizeBoolean(t), this.applyLayout();
|
|
806
|
+
}
|
|
807
|
+
set _variant(t) {
|
|
808
|
+
this.__variant = this.normalizeVariant(t), this.applyLayout();
|
|
809
|
+
}
|
|
810
|
+
get _variant() {
|
|
811
|
+
return this.__variant;
|
|
812
|
+
}
|
|
813
|
+
set _size(t) {
|
|
814
|
+
this.__size = this.normalizeSize(t), this.applyLayout();
|
|
815
|
+
}
|
|
816
|
+
get _size() {
|
|
817
|
+
return this.__size;
|
|
818
|
+
}
|
|
819
|
+
set _pill(t) {
|
|
820
|
+
this.__pill = this.normalizeBoolean(t), this.applyLayout();
|
|
821
|
+
}
|
|
822
|
+
get _pill() {
|
|
823
|
+
return this.__pill;
|
|
824
|
+
}
|
|
825
|
+
set _dot(t) {
|
|
826
|
+
this.__dot = this.normalizeBoolean(t), this.applyLayout();
|
|
827
|
+
}
|
|
828
|
+
get _dot() {
|
|
829
|
+
return this.__dot;
|
|
830
|
+
}
|
|
831
|
+
set _title(t) {
|
|
832
|
+
this.__title = t, this.applyLayout();
|
|
833
|
+
}
|
|
834
|
+
get _title() {
|
|
835
|
+
return this.__title;
|
|
836
|
+
}
|
|
837
|
+
}
|
|
838
|
+
class v extends a {
|
|
839
|
+
static _xtype = "empty";
|
|
840
|
+
__size = "md";
|
|
841
|
+
__align = "center";
|
|
842
|
+
__title = "";
|
|
843
|
+
__description = "";
|
|
844
|
+
__icon;
|
|
845
|
+
__action;
|
|
846
|
+
__stack_id;
|
|
847
|
+
__title_id;
|
|
848
|
+
__desc_id;
|
|
849
|
+
constructor(t) {
|
|
850
|
+
const i = {
|
|
851
|
+
_type: v._xtype,
|
|
852
|
+
class: "xempty",
|
|
853
|
+
_html_tag: "div"
|
|
854
|
+
};
|
|
855
|
+
super(t, i, !0), this.__stack_id = this._id + "_stack", this.__title_id = this._id + "_title", this.__desc_id = this._id + "_desc", this.parse(t), this.applyProps(), this.buildSkeleton(), this.applyLayout();
|
|
856
|
+
}
|
|
857
|
+
normalizeSize(t) {
|
|
858
|
+
return t === "sm" || t === "lg" ? t : "md";
|
|
859
|
+
}
|
|
860
|
+
normalizeAlign(t) {
|
|
861
|
+
return t === "start" ? "start" : "center";
|
|
862
|
+
}
|
|
863
|
+
applyProps() {
|
|
864
|
+
this.__size = this.normalizeSize(this._size), this.__align = this.normalizeAlign(this._align), this.__title = this._title ? String(this._title) : "", this.__description = this._description ? String(this._description) : "", this.__icon = this._icon, this.__action = this._action;
|
|
865
|
+
}
|
|
866
|
+
hasTitle() {
|
|
867
|
+
return this.__title.trim().length > 0;
|
|
868
|
+
}
|
|
869
|
+
hasDescription() {
|
|
870
|
+
return this.__description.trim().length > 0;
|
|
871
|
+
}
|
|
872
|
+
buildSkeleton() {
|
|
873
|
+
const t = [];
|
|
874
|
+
this.__icon && t.push(this.__icon), this.hasTitle() && t.push({
|
|
875
|
+
_type: "label",
|
|
876
|
+
_id: this.__title_id,
|
|
877
|
+
class: "xempty__title",
|
|
878
|
+
_text: this.__title.trim()
|
|
879
|
+
}), this.hasDescription() && t.push({
|
|
880
|
+
_type: "label",
|
|
881
|
+
_id: this.__desc_id,
|
|
882
|
+
class: "xempty__desc",
|
|
883
|
+
_text: this.__description.trim()
|
|
884
|
+
}), this.__action && t.push(this.__action), this.append({
|
|
885
|
+
_type: "stack",
|
|
886
|
+
_id: this.__stack_id,
|
|
887
|
+
class: "xempty__stack",
|
|
888
|
+
_direction: "vertical",
|
|
889
|
+
_children: t
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
rebuild() {
|
|
893
|
+
const t = n.getObject(this.__stack_id);
|
|
894
|
+
t && typeof this.removeChild == "function" && this.removeChild(t, !0), this.buildSkeleton(), this.applyLayout();
|
|
895
|
+
}
|
|
896
|
+
updateTitle() {
|
|
897
|
+
const t = n.getObject(this.__title_id);
|
|
898
|
+
this.hasTitle() ? t ? t._text = this.__title.trim() : this.rebuild() : t && this.rebuild();
|
|
899
|
+
}
|
|
900
|
+
updateDescription() {
|
|
901
|
+
const t = n.getObject(this.__desc_id);
|
|
902
|
+
this.hasDescription() ? t ? t._text = this.__description.trim() : this.rebuild() : t && this.rebuild();
|
|
903
|
+
}
|
|
904
|
+
applyLayout() {
|
|
905
|
+
this.addClass("xempty");
|
|
906
|
+
const t = ["xempty--sm", "xempty--md", "xempty--lg", "xempty--start", "xempty--center"], i = [];
|
|
907
|
+
i.push(`xempty--${this.__size}`), i.push(`xempty--${this.__align}`), this.replaceClass(t.join(" "), i.join(" "));
|
|
908
|
+
}
|
|
909
|
+
set _title(t) {
|
|
910
|
+
this.__title = t ? String(t) : "", this.updateTitle();
|
|
911
|
+
}
|
|
912
|
+
get _title() {
|
|
913
|
+
return this.__title;
|
|
914
|
+
}
|
|
915
|
+
set _description(t) {
|
|
916
|
+
this.__description = t ? String(t) : "", this.updateDescription();
|
|
917
|
+
}
|
|
918
|
+
get _description() {
|
|
919
|
+
return this.__description;
|
|
920
|
+
}
|
|
921
|
+
set _size(t) {
|
|
922
|
+
this.__size = this.normalizeSize(t), this.applyLayout();
|
|
923
|
+
}
|
|
924
|
+
get _size() {
|
|
925
|
+
return this.__size;
|
|
926
|
+
}
|
|
927
|
+
set _align(t) {
|
|
928
|
+
this.__align = this.normalizeAlign(t), this.applyLayout();
|
|
929
|
+
}
|
|
930
|
+
get _align() {
|
|
931
|
+
return this.__align;
|
|
932
|
+
}
|
|
933
|
+
set _icon(t) {
|
|
934
|
+
this.__icon = t, this.rebuild();
|
|
935
|
+
}
|
|
936
|
+
get _icon() {
|
|
937
|
+
return this.__icon;
|
|
938
|
+
}
|
|
939
|
+
set _action(t) {
|
|
940
|
+
this.__action = t, this.rebuild();
|
|
941
|
+
}
|
|
942
|
+
get _action() {
|
|
943
|
+
return this.__action;
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
class w extends a {
|
|
947
|
+
static _xtype = "search";
|
|
948
|
+
__value = "";
|
|
949
|
+
__placeholder = "Search...";
|
|
950
|
+
__size = "md";
|
|
951
|
+
__disabled = !1;
|
|
952
|
+
__clearable = !0;
|
|
953
|
+
__icon = !0;
|
|
954
|
+
__autofocus = !1;
|
|
955
|
+
__input_id;
|
|
956
|
+
__icon_id;
|
|
957
|
+
__input_id_internal;
|
|
958
|
+
__clear_id;
|
|
959
|
+
constructor(t) {
|
|
960
|
+
const i = {
|
|
961
|
+
_type: w._xtype,
|
|
962
|
+
class: "xsearch",
|
|
963
|
+
_html_tag: "div"
|
|
964
|
+
};
|
|
965
|
+
super(t, i, !0), this.__icon_id = this._id + "_icon", this.__input_id_internal = this._id + "_input", this.__clear_id = this._id + "_clear", this.parse(t), this.buildSkeleton(), this.applyProps();
|
|
966
|
+
}
|
|
967
|
+
normalizeSize(t) {
|
|
968
|
+
return t === "sm" ? "sm" : "md";
|
|
969
|
+
}
|
|
970
|
+
normalizeBoolean(t, i = !1) {
|
|
971
|
+
return t === !0 || t === "true" ? !0 : t === !1 || t === "false" ? !1 : i;
|
|
972
|
+
}
|
|
973
|
+
getIcon() {
|
|
974
|
+
return n.getObject(this.__icon_id);
|
|
975
|
+
}
|
|
976
|
+
getInput() {
|
|
977
|
+
return n.getObject(this.__input_id_internal);
|
|
978
|
+
}
|
|
979
|
+
getClear() {
|
|
980
|
+
return n.getObject(this.__clear_id);
|
|
981
|
+
}
|
|
982
|
+
buildSkeleton() {
|
|
983
|
+
[
|
|
984
|
+
{
|
|
985
|
+
_type: "label",
|
|
986
|
+
_id: this.__icon_id,
|
|
987
|
+
class: "xsearch__icon",
|
|
988
|
+
_text: "🔍"
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
_type: "input",
|
|
992
|
+
_id: this.__input_id_internal,
|
|
993
|
+
class: "xsearch__input",
|
|
994
|
+
_input_type: "search",
|
|
995
|
+
_on: {
|
|
996
|
+
input: (i, e) => this.handleInput(i, e),
|
|
997
|
+
change: (i, e) => this.handleChange(i, e)
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
_type: "button",
|
|
1002
|
+
_id: this.__clear_id,
|
|
1003
|
+
class: "xsearch__clear",
|
|
1004
|
+
_text: "×",
|
|
1005
|
+
"aria-label": "Clear",
|
|
1006
|
+
_on_click: () => this.clear()
|
|
1007
|
+
}
|
|
1008
|
+
].forEach((i) => this.append(i));
|
|
1009
|
+
}
|
|
1010
|
+
applyProps() {
|
|
1011
|
+
this.__value = typeof this._value == "string" ? this._value : "", this.__placeholder = this._placeholder ? String(this._placeholder) : "Search...", this.__size = this.normalizeSize(this._size), this.__disabled = this.normalizeBoolean(this._disabled, !1), this.__clearable = this.normalizeBoolean(this._clearable, !0), this.__icon = this.normalizeBoolean(this._icon, !0), this.__autofocus = this.normalizeBoolean(this._autofocus, !1), this.__input_id = this._input_id ? String(this._input_id) : void 0, this.addClass("xsearch"), this.replaceClass("xsearch--sm xsearch--md", `xsearch--${this.__size}`), this.__disabled ? this.addClass("xsearch--disabled") : this.removeClass("xsearch--disabled");
|
|
1012
|
+
const t = this.getInput();
|
|
1013
|
+
t && (t._placeholder = this.__placeholder, t._value = this.__value, t._disabled = this.__disabled, t._autofocus = this.__autofocus, this.__input_id && (t.id = this.__input_id));
|
|
1014
|
+
const i = this.getIcon();
|
|
1015
|
+
i && (i._visible = this.__icon), this.toggleClear();
|
|
1016
|
+
}
|
|
1017
|
+
toggleClear() {
|
|
1018
|
+
const t = this.getClear();
|
|
1019
|
+
if (!t) return;
|
|
1020
|
+
const i = this.__clearable && this.__value.length > 0 && !this.__disabled;
|
|
1021
|
+
t._visible = i;
|
|
1022
|
+
}
|
|
1023
|
+
handleInput(t, i) {
|
|
1024
|
+
const e = String(i?.target?.value ?? t?._value ?? t?._text ?? "");
|
|
1025
|
+
this.__value = e, this.toggleClear();
|
|
1026
|
+
const s = this._on_input;
|
|
1027
|
+
s && this.checkAndRunInternalFunction(s, e, i);
|
|
1028
|
+
}
|
|
1029
|
+
handleChange(t, i) {
|
|
1030
|
+
const e = String(i?.target?.value ?? t?._value ?? t?._text ?? "");
|
|
1031
|
+
this.__value = e;
|
|
1032
|
+
const s = this._on_change;
|
|
1033
|
+
s && this.checkAndRunInternalFunction(s, e, i);
|
|
1034
|
+
}
|
|
1035
|
+
getValue() {
|
|
1036
|
+
return this.__value;
|
|
1037
|
+
}
|
|
1038
|
+
setValue(t, i = !1) {
|
|
1039
|
+
this.__value = String(t ?? "");
|
|
1040
|
+
const e = this.getInput();
|
|
1041
|
+
if (e && (e._value = this.__value), this.toggleClear(), !i) {
|
|
1042
|
+
const s = this._on_input;
|
|
1043
|
+
s && this.checkAndRunInternalFunction(s, this.__value, void 0);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
clear() {
|
|
1047
|
+
this.setValue("", !0);
|
|
1048
|
+
const t = this._on_clear;
|
|
1049
|
+
t && this.checkAndRunInternalFunction(t);
|
|
1050
|
+
const i = this._on_input;
|
|
1051
|
+
i && this.checkAndRunInternalFunction(i, this.__value, void 0), this.focus();
|
|
1052
|
+
}
|
|
1053
|
+
focus() {
|
|
1054
|
+
const t = this.getInput();
|
|
1055
|
+
t && typeof t.focus == "function" && t.focus();
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
class f extends a {
|
|
1059
|
+
static _xtype = "igroup";
|
|
1060
|
+
__gap = 8;
|
|
1061
|
+
__align = "center";
|
|
1062
|
+
__wrap = !1;
|
|
1063
|
+
__dense = !1;
|
|
1064
|
+
__merged = !1;
|
|
1065
|
+
static managedStyles = /* @__PURE__ */ new Set([
|
|
1066
|
+
"--xigroup-gap",
|
|
1067
|
+
"align-items",
|
|
1068
|
+
"flex-wrap",
|
|
1069
|
+
"display",
|
|
1070
|
+
"gap"
|
|
1071
|
+
]);
|
|
1072
|
+
constructor(t) {
|
|
1073
|
+
const i = {
|
|
1074
|
+
_type: f._xtype,
|
|
1075
|
+
class: "xigroup",
|
|
1076
|
+
_html_tag: "div"
|
|
1077
|
+
};
|
|
1078
|
+
super(t, i, !0), this.parse(t), this.applyLayout();
|
|
1079
|
+
}
|
|
1080
|
+
normalizeAlign(t) {
|
|
1081
|
+
return t === "start" || t === "center" || t === "end" || t === "stretch" ? t : "center";
|
|
1082
|
+
}
|
|
1083
|
+
normalizeGap(t) {
|
|
1084
|
+
return typeof t == "number" && Number.isFinite(t) && t >= 0 ? t : 8;
|
|
1085
|
+
}
|
|
1086
|
+
normalizeBoolean(t) {
|
|
1087
|
+
return t === !0 || t === "true";
|
|
1088
|
+
}
|
|
1089
|
+
mapAlign(t) {
|
|
1090
|
+
return t === "start" ? "flex-start" : t === "end" ? "flex-end" : t === "center" ? "center" : "stretch";
|
|
1091
|
+
}
|
|
1092
|
+
stripManagedStyles(t) {
|
|
1093
|
+
if (!t) return "";
|
|
1094
|
+
const i = t.split(";").map((s) => s.trim()).filter(Boolean), e = [];
|
|
1095
|
+
for (const s of i) {
|
|
1096
|
+
const _ = s.indexOf(":");
|
|
1097
|
+
if (_ === -1) continue;
|
|
1098
|
+
const r = s.slice(0, _).trim().toLowerCase(), l = s.slice(_ + 1).trim();
|
|
1099
|
+
!r || !l || f.managedStyles.has(r) || e.push(`${r}:${l}`);
|
|
1100
|
+
}
|
|
1101
|
+
return e.join("; ");
|
|
1102
|
+
}
|
|
1103
|
+
applyLayout() {
|
|
1104
|
+
this.addClass("xigroup");
|
|
1105
|
+
const t = ["xigroup--dense", "xigroup--merged"], i = [];
|
|
1106
|
+
this.__dense && i.push("xigroup--dense"), this.__merged && i.push("xigroup--merged"), this.replaceClass(t.join(" "), i.join(" "));
|
|
1107
|
+
const e = this.stripManagedStyles(String(this.style || "")), s = [];
|
|
1108
|
+
e && s.push(e), s.push("display:flex"), s.push(`gap:${this.__gap}px`), s.push(`--xigroup-gap:${this.__gap}px`), s.push(`align-items:${this.mapAlign(this.__align)}`), this.__wrap && s.push("flex-wrap:wrap");
|
|
1109
|
+
const _ = s.join("; ");
|
|
1110
|
+
this.style = _;
|
|
1111
|
+
}
|
|
1112
|
+
set _gap(t) {
|
|
1113
|
+
this.__gap = this.normalizeGap(t), this.applyLayout();
|
|
1114
|
+
}
|
|
1115
|
+
get _gap() {
|
|
1116
|
+
return this.__gap;
|
|
1117
|
+
}
|
|
1118
|
+
set _align(t) {
|
|
1119
|
+
this.__align = this.normalizeAlign(t), this.applyLayout();
|
|
1120
|
+
}
|
|
1121
|
+
get _align() {
|
|
1122
|
+
return this.__align;
|
|
1123
|
+
}
|
|
1124
|
+
set _wrap(t) {
|
|
1125
|
+
this.__wrap = this.normalizeBoolean(t), this.applyLayout();
|
|
1126
|
+
}
|
|
1127
|
+
get _wrap() {
|
|
1128
|
+
return this.__wrap;
|
|
1129
|
+
}
|
|
1130
|
+
set _dense(t) {
|
|
1131
|
+
this.__dense = this.normalizeBoolean(t), this.applyLayout();
|
|
1132
|
+
}
|
|
1133
|
+
get _dense() {
|
|
1134
|
+
return this.__dense;
|
|
1135
|
+
}
|
|
1136
|
+
set _merged(t) {
|
|
1137
|
+
this.__merged = this.normalizeBoolean(t), this.applyLayout();
|
|
1138
|
+
}
|
|
1139
|
+
get _merged() {
|
|
1140
|
+
return this.__merged;
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
class z extends a {
|
|
1144
|
+
static _xtype = "select";
|
|
1145
|
+
__value = "";
|
|
1146
|
+
__placeholder;
|
|
1147
|
+
__options = [];
|
|
1148
|
+
__size = "md";
|
|
1149
|
+
__disabled = !1;
|
|
1150
|
+
__name;
|
|
1151
|
+
__select_id;
|
|
1152
|
+
__control_id;
|
|
1153
|
+
constructor(t) {
|
|
1154
|
+
const i = {
|
|
1155
|
+
_type: z._xtype,
|
|
1156
|
+
class: "xselect",
|
|
1157
|
+
_html_tag: "div"
|
|
1158
|
+
};
|
|
1159
|
+
super(t, i, !0), this.__control_id = this._id + "_control", this.parse(t), this.buildSkeleton(), this.applyProps();
|
|
1160
|
+
}
|
|
1161
|
+
normalizeSize(t) {
|
|
1162
|
+
return t === "sm" ? "sm" : "md";
|
|
1163
|
+
}
|
|
1164
|
+
normalizeBoolean(t, i = !1) {
|
|
1165
|
+
return t === !0 || t === "true" ? !0 : t === !1 || t === "false" ? !1 : i;
|
|
1166
|
+
}
|
|
1167
|
+
getControl() {
|
|
1168
|
+
return n.getObject(this.__control_id);
|
|
1169
|
+
}
|
|
1170
|
+
buildSkeleton() {
|
|
1171
|
+
const t = {
|
|
1172
|
+
_type: "xhtml",
|
|
1173
|
+
_id: this.__control_id,
|
|
1174
|
+
class: "xselect__control",
|
|
1175
|
+
_html_tag: "select",
|
|
1176
|
+
_on: {
|
|
1177
|
+
change: (i, e) => this.handleChange(i, e)
|
|
1178
|
+
}
|
|
1179
|
+
};
|
|
1180
|
+
this.append(t);
|
|
1181
|
+
}
|
|
1182
|
+
applyProps() {
|
|
1183
|
+
this.__value = typeof this._value == "string" ? this._value : "", this.__placeholder = this._placeholder ? String(this._placeholder) : void 0, this.__options = Array.isArray(this._options) ? this._options : [], this.__size = this.normalizeSize(this._size), this.__disabled = this.normalizeBoolean(this._disabled, !1), this.__name = this._name ? String(this._name) : void 0, this.__select_id = this._select_id ? String(this._select_id) : void 0, this.addClass("xselect"), this.replaceClass("xselect--sm xselect--md", `xselect--${this.__size}`), this.__disabled ? this.addClass("xselect--disabled") : this.removeClass("xselect--disabled");
|
|
1184
|
+
const t = this.getControl();
|
|
1185
|
+
t && (this.__name && (t.name = this.__name), this.__select_id && (t.id = this.__select_id), t.disabled = this.__disabled, this.setOptions(this.__options, !0), this.setValue(this.__value, !0));
|
|
1186
|
+
}
|
|
1187
|
+
clearOptions(t) {
|
|
1188
|
+
(Array.isArray(t._children) ? [...t._children] : []).forEach((e) => {
|
|
1189
|
+
e && t.removeChild(e, !0);
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
buildOption(t, i) {
|
|
1193
|
+
const e = {
|
|
1194
|
+
_type: "xhtml",
|
|
1195
|
+
_html_tag: "option",
|
|
1196
|
+
_text: t.label,
|
|
1197
|
+
value: t.value
|
|
1198
|
+
};
|
|
1199
|
+
return t.disabled && (e.disabled = !0), i && (e.selected = !0), e;
|
|
1200
|
+
}
|
|
1201
|
+
setOptions(t, i = !1) {
|
|
1202
|
+
this.__options = Array.isArray(t) ? t : [];
|
|
1203
|
+
const e = this.getControl();
|
|
1204
|
+
if (!e) return;
|
|
1205
|
+
this.clearOptions(e);
|
|
1206
|
+
const s = typeof this.__value == "string" && this.__value.length > 0;
|
|
1207
|
+
if (this.__placeholder) {
|
|
1208
|
+
const _ = {
|
|
1209
|
+
_type: "xhtml",
|
|
1210
|
+
_html_tag: "option",
|
|
1211
|
+
_text: this.__placeholder,
|
|
1212
|
+
value: "",
|
|
1213
|
+
disabled: !0,
|
|
1214
|
+
hidden: !0,
|
|
1215
|
+
selected: !s
|
|
1216
|
+
};
|
|
1217
|
+
e.append(_);
|
|
1218
|
+
}
|
|
1219
|
+
this.__options.forEach((_) => {
|
|
1220
|
+
const r = _.value === this.__value;
|
|
1221
|
+
e.append(this.buildOption(_, r));
|
|
1222
|
+
}), i || this.setValue(this.__value, !0);
|
|
1223
|
+
}
|
|
1224
|
+
handleChange(t, i) {
|
|
1225
|
+
const e = String(i?.target?.value ?? t?.value ?? t?._value ?? "");
|
|
1226
|
+
this.__value = e;
|
|
1227
|
+
const s = this._on_change;
|
|
1228
|
+
s && this.checkAndRunInternalFunction(s, e, i);
|
|
1229
|
+
}
|
|
1230
|
+
getValue() {
|
|
1231
|
+
return this.__value;
|
|
1232
|
+
}
|
|
1233
|
+
setValue(t, i = !1) {
|
|
1234
|
+
this.__value = String(t ?? "");
|
|
1235
|
+
const e = this.getControl();
|
|
1236
|
+
if (e && (e.value = this.__value), !i) {
|
|
1237
|
+
const s = this._on_change;
|
|
1238
|
+
s && this.checkAndRunInternalFunction(s, this.__value, void 0);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
focus() {
|
|
1242
|
+
const t = globalThis?._xlog ?? this._xlog;
|
|
1243
|
+
t?.log && t.log("XSelect.focus requires engine input focus support.");
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
class S extends a {
|
|
1247
|
+
static _xtype = "field";
|
|
1248
|
+
__size = "md";
|
|
1249
|
+
__align = "stack";
|
|
1250
|
+
__has_error = !1;
|
|
1251
|
+
__label = "";
|
|
1252
|
+
__hint = "";
|
|
1253
|
+
__error = "";
|
|
1254
|
+
__required = !1;
|
|
1255
|
+
__inline = !1;
|
|
1256
|
+
__control;
|
|
1257
|
+
__initializing = !0;
|
|
1258
|
+
__root_id;
|
|
1259
|
+
__label_id;
|
|
1260
|
+
__required_id;
|
|
1261
|
+
__hint_id;
|
|
1262
|
+
__error_id;
|
|
1263
|
+
__control_wrap_id;
|
|
1264
|
+
__inline_row_id;
|
|
1265
|
+
constructor(t) {
|
|
1266
|
+
const i = {
|
|
1267
|
+
_type: S._xtype,
|
|
1268
|
+
class: "xfield",
|
|
1269
|
+
_html_tag: "div"
|
|
1270
|
+
};
|
|
1271
|
+
super(t, i, !0), this.__root_id = this._id + "_root", this.__label_id = this._id + "_label", this.__required_id = this._id + "_required", this.__hint_id = this._id + "_hint", this.__error_id = this._id + "_error", this.__control_wrap_id = this._id + "_control_wrap", this.__inline_row_id = this._id + "_inline_row", this.parse(t), this.applyProps(), this.buildSkeleton(), this.applyLayout(), this.__initializing = !1;
|
|
1272
|
+
}
|
|
1273
|
+
normalizeSize(t) {
|
|
1274
|
+
return t === "sm" ? "sm" : "md";
|
|
1275
|
+
}
|
|
1276
|
+
normalizeBoolean(t) {
|
|
1277
|
+
return t === !0 || t === "true";
|
|
1278
|
+
}
|
|
1279
|
+
applyProps() {
|
|
1280
|
+
this.__label = this._label ? String(this._label) : "", this.__hint = this._hint ? String(this._hint) : "", this.__error = this._error ? String(this._error) : "", this.__required = this.normalizeBoolean(this._required), this.__inline = this.normalizeBoolean(this._inline), this.__control = this._control, this.__align = this.__inline ? "inline" : "stack", this.__size = this.normalizeSize(this._size), this.__has_error = this.hasError();
|
|
1281
|
+
}
|
|
1282
|
+
hasLabel() {
|
|
1283
|
+
return this.__label.trim().length > 0;
|
|
1284
|
+
}
|
|
1285
|
+
hasHint() {
|
|
1286
|
+
return this.__hint.trim().length > 0;
|
|
1287
|
+
}
|
|
1288
|
+
hasError() {
|
|
1289
|
+
return this.__error.trim().length > 0;
|
|
1290
|
+
}
|
|
1291
|
+
buildLabelRow() {
|
|
1292
|
+
const t = [];
|
|
1293
|
+
return this.hasLabel() && t.push({
|
|
1294
|
+
_type: "label",
|
|
1295
|
+
_id: this.__label_id,
|
|
1296
|
+
class: "xfield__label",
|
|
1297
|
+
_text: this.__label.trim()
|
|
1298
|
+
}), this.__required && t.push({
|
|
1299
|
+
_type: "label",
|
|
1300
|
+
_id: this.__required_id,
|
|
1301
|
+
class: "xfield__required",
|
|
1302
|
+
_text: "*"
|
|
1303
|
+
}), t.length ? {
|
|
1304
|
+
_type: "stack",
|
|
1305
|
+
class: "xfield__label-row",
|
|
1306
|
+
_direction: "horizontal",
|
|
1307
|
+
_gap: 6,
|
|
1308
|
+
_children: t
|
|
1309
|
+
} : null;
|
|
1310
|
+
}
|
|
1311
|
+
buildControlRow() {
|
|
1312
|
+
return this.__control ? {
|
|
1313
|
+
_type: "view",
|
|
1314
|
+
_id: this.__control_wrap_id,
|
|
1315
|
+
class: "xfield__control",
|
|
1316
|
+
_children: [this.__control]
|
|
1317
|
+
} : null;
|
|
1318
|
+
}
|
|
1319
|
+
buildMessageRow() {
|
|
1320
|
+
return this.hasError() ? {
|
|
1321
|
+
_type: "label",
|
|
1322
|
+
_id: this.__error_id,
|
|
1323
|
+
class: "xfield__error",
|
|
1324
|
+
_text: this.__error.trim()
|
|
1325
|
+
} : this.hasHint() ? {
|
|
1326
|
+
_type: "label",
|
|
1327
|
+
_id: this.__hint_id,
|
|
1328
|
+
class: "xfield__hint",
|
|
1329
|
+
_text: this.__hint.trim()
|
|
1330
|
+
} : null;
|
|
1331
|
+
}
|
|
1332
|
+
buildSkeleton() {
|
|
1333
|
+
const t = [], i = this.buildLabelRow(), e = this.buildControlRow(), s = this.buildMessageRow();
|
|
1334
|
+
if (this.__inline) {
|
|
1335
|
+
const _ = [];
|
|
1336
|
+
i && _.push(i), e && _.push(e), _.length && t.push({
|
|
1337
|
+
_type: "stack",
|
|
1338
|
+
_id: this.__inline_row_id,
|
|
1339
|
+
class: "xfield__row xfield__row--inline",
|
|
1340
|
+
_direction: "horizontal",
|
|
1341
|
+
_gap: 12,
|
|
1342
|
+
_children: _
|
|
1343
|
+
}), s && t.push(s);
|
|
1344
|
+
} else
|
|
1345
|
+
i && t.push(i), e && t.push(e), s && t.push(s);
|
|
1346
|
+
this.append({
|
|
1347
|
+
_type: "stack",
|
|
1348
|
+
_id: this.__root_id,
|
|
1349
|
+
class: "xfield__stack",
|
|
1350
|
+
_direction: "vertical",
|
|
1351
|
+
_gap: 8,
|
|
1352
|
+
_children: t
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
getRoot() {
|
|
1356
|
+
return n.getObject(this.__root_id);
|
|
1357
|
+
}
|
|
1358
|
+
rebuild() {
|
|
1359
|
+
const t = this.getRoot();
|
|
1360
|
+
t && typeof this.removeChild == "function" && this.removeChild(t, !0), this.buildSkeleton(), this.applyLayout();
|
|
1361
|
+
}
|
|
1362
|
+
updateLabelNode() {
|
|
1363
|
+
const t = n.getObject(this.__label_id);
|
|
1364
|
+
this.hasLabel() ? t ? t._text = this.__label.trim() : this.rebuild() : t && this.rebuild();
|
|
1365
|
+
}
|
|
1366
|
+
updateRequiredNode() {
|
|
1367
|
+
const t = n.getObject(this.__required_id);
|
|
1368
|
+
this.__required ? t || this.rebuild() : t && this.rebuild();
|
|
1369
|
+
}
|
|
1370
|
+
updateHintNode() {
|
|
1371
|
+
if (this.__has_error) return;
|
|
1372
|
+
const t = n.getObject(this.__hint_id);
|
|
1373
|
+
this.hasHint() ? t ? t._text = this.__hint.trim() : this.rebuild() : t && this.rebuild();
|
|
1374
|
+
}
|
|
1375
|
+
updateErrorNode() {
|
|
1376
|
+
const t = this.hasError(), i = n.getObject(this.__error_id), e = n.getObject(this.__hint_id);
|
|
1377
|
+
if (this.__has_error = t, t) {
|
|
1378
|
+
if (!i || e) {
|
|
1379
|
+
this.rebuild();
|
|
1380
|
+
return;
|
|
1381
|
+
}
|
|
1382
|
+
i._text = this.__error.trim();
|
|
1383
|
+
} else {
|
|
1384
|
+
if (i) {
|
|
1385
|
+
this.rebuild();
|
|
1386
|
+
return;
|
|
1387
|
+
}
|
|
1388
|
+
if (this.hasHint() && !e) {
|
|
1389
|
+
this.rebuild();
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
this.updateHintNode();
|
|
1393
|
+
}
|
|
1394
|
+
this.applyLayout();
|
|
1395
|
+
}
|
|
1396
|
+
applyLayout() {
|
|
1397
|
+
this.addClass("xfield"), this.replaceClass("xfield--sm xfield--md", `xfield--${this.__size}`), this.replaceClass(
|
|
1398
|
+
"xfield--inline xfield--stack",
|
|
1399
|
+
this.__align === "inline" ? "xfield--inline" : "xfield--stack"
|
|
1400
|
+
), this.__has_error ? this.addClass("xfield--error") : this.removeClass("xfield--error");
|
|
1401
|
+
}
|
|
1402
|
+
set _label(t) {
|
|
1403
|
+
this.__label = t ? String(t) : "", !this.__initializing && this.updateLabelNode();
|
|
1404
|
+
}
|
|
1405
|
+
set _hint(t) {
|
|
1406
|
+
this.__hint = t ? String(t) : "", !this.__initializing && this.updateHintNode();
|
|
1407
|
+
}
|
|
1408
|
+
set _error(t) {
|
|
1409
|
+
this.__error = t ? String(t) : "", !this.__initializing && this.updateErrorNode();
|
|
1410
|
+
}
|
|
1411
|
+
set _required(t) {
|
|
1412
|
+
this.__required = this.normalizeBoolean(t), !this.__initializing && this.updateRequiredNode();
|
|
1413
|
+
}
|
|
1414
|
+
set _inline(t) {
|
|
1415
|
+
this.__inline = this.normalizeBoolean(t), this.__align = this.__inline ? "inline" : "stack", !this.__initializing && this.rebuild();
|
|
1416
|
+
}
|
|
1417
|
+
set _size(t) {
|
|
1418
|
+
this.__size = this.normalizeSize(t), !this.__initializing && this.applyLayout();
|
|
1419
|
+
}
|
|
1420
|
+
set _control(t) {
|
|
1421
|
+
this.__control = t, !this.__initializing && this.rebuild();
|
|
1422
|
+
}
|
|
1423
|
+
get _label() {
|
|
1424
|
+
return this.__label;
|
|
1425
|
+
}
|
|
1426
|
+
get _hint() {
|
|
1427
|
+
return this.__hint;
|
|
1428
|
+
}
|
|
1429
|
+
get _error() {
|
|
1430
|
+
return this.__error;
|
|
1431
|
+
}
|
|
1432
|
+
get _required() {
|
|
1433
|
+
return this.__required;
|
|
1434
|
+
}
|
|
1435
|
+
get _inline() {
|
|
1436
|
+
return this.__inline;
|
|
1437
|
+
}
|
|
1438
|
+
get _size() {
|
|
1439
|
+
return this.__size;
|
|
1440
|
+
}
|
|
1441
|
+
get _control() {
|
|
1442
|
+
return this.__control;
|
|
1443
|
+
}
|
|
1444
|
+
}
|
|
1445
|
+
class y extends a {
|
|
1446
|
+
static _xtype = "drawer";
|
|
1447
|
+
__open = !1;
|
|
1448
|
+
__side = "right";
|
|
1449
|
+
__width = "360px";
|
|
1450
|
+
__title;
|
|
1451
|
+
__closable = !0;
|
|
1452
|
+
__scroll = !0;
|
|
1453
|
+
__elevated = !0;
|
|
1454
|
+
__overlay = !1;
|
|
1455
|
+
__body_children = [];
|
|
1456
|
+
__panel_id;
|
|
1457
|
+
__header_id;
|
|
1458
|
+
__body_id;
|
|
1459
|
+
__scroll_id;
|
|
1460
|
+
__close_id;
|
|
1461
|
+
__title_id;
|
|
1462
|
+
static managedStyles = /* @__PURE__ */ new Set(["--xdrawer-width"]);
|
|
1463
|
+
constructor(t) {
|
|
1464
|
+
const i = {
|
|
1465
|
+
_type: y._xtype,
|
|
1466
|
+
class: "xdrawer",
|
|
1467
|
+
_html_tag: "div"
|
|
1468
|
+
};
|
|
1469
|
+
super(t, i, !0), this.__panel_id = this._id + "_panel", this.__header_id = this._id + "_header", this.__body_id = this._id + "_body", this.__scroll_id = this._id + "_scroll", this.__close_id = this._id + "_close", this.__title_id = this._id + "_title", this.parse(t), this.applyProps(), this.__body_children = Array.isArray(this._children) ? [...this._children] : [], this._children = [], this.buildSkeleton(this.__body_children), this.applyLayout();
|
|
1470
|
+
}
|
|
1471
|
+
normalizeSide(t) {
|
|
1472
|
+
return t === "left" ? "left" : "right";
|
|
1473
|
+
}
|
|
1474
|
+
normalizeBoolean(t, i = !1) {
|
|
1475
|
+
return t === !0 || t === "true" ? !0 : t === !1 || t === "false" ? !1 : i;
|
|
1476
|
+
}
|
|
1477
|
+
applyProps() {
|
|
1478
|
+
this.__open = this.normalizeBoolean(this._open, !1), this.__side = this.normalizeSide(this._side), this.__width = this._width ? String(this._width) : "360px", this.__title = this._title ? String(this._title) : void 0, this.__closable = this.normalizeBoolean(this._closable, !0), this.__scroll = this.normalizeBoolean(this._scroll, !0), this.__elevated = this.normalizeBoolean(this._elevated, !0), this.__overlay = this.normalizeBoolean(this._overlay, !1);
|
|
1479
|
+
}
|
|
1480
|
+
hasTitle() {
|
|
1481
|
+
return this.__title !== void 0 && this.__title.trim().length > 0;
|
|
1482
|
+
}
|
|
1483
|
+
buildHeader() {
|
|
1484
|
+
if (!this.hasTitle() && !this.__closable) return null;
|
|
1485
|
+
const t = [];
|
|
1486
|
+
return this.hasTitle() && t.push({
|
|
1487
|
+
_type: "label",
|
|
1488
|
+
_id: this.__title_id,
|
|
1489
|
+
class: "xdrawer__title",
|
|
1490
|
+
_text: this.__title?.trim()
|
|
1491
|
+
}), this.__closable && t.push({
|
|
1492
|
+
_type: "button",
|
|
1493
|
+
_id: this.__close_id,
|
|
1494
|
+
class: "xdrawer__close",
|
|
1495
|
+
_text: "×",
|
|
1496
|
+
_on_click: () => this.setOpen(!1)
|
|
1497
|
+
}), {
|
|
1498
|
+
_type: "view",
|
|
1499
|
+
_id: this.__header_id,
|
|
1500
|
+
class: "xdrawer__header",
|
|
1501
|
+
_children: t
|
|
1502
|
+
};
|
|
1503
|
+
}
|
|
1504
|
+
buildBody(t) {
|
|
1505
|
+
const i = this.__scroll ? [
|
|
1506
|
+
{
|
|
1507
|
+
_type: "scroll",
|
|
1508
|
+
_id: this.__scroll_id,
|
|
1509
|
+
class: "xdrawer__scroll",
|
|
1510
|
+
_children: t
|
|
1511
|
+
}
|
|
1512
|
+
] : t;
|
|
1513
|
+
return {
|
|
1514
|
+
_type: "view",
|
|
1515
|
+
_id: this.__body_id,
|
|
1516
|
+
class: "xdrawer__body",
|
|
1517
|
+
_children: i
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
buildSkeleton(t) {
|
|
1521
|
+
const i = [], e = this.buildHeader();
|
|
1522
|
+
e && i.push(e), i.push(this.buildBody(t)), this.append({
|
|
1523
|
+
_type: "view",
|
|
1524
|
+
_id: this.__panel_id,
|
|
1525
|
+
class: "xdrawer__panel",
|
|
1526
|
+
_children: i
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
rebuild() {
|
|
1530
|
+
const t = n.getObject(this.__panel_id);
|
|
1531
|
+
t && typeof this.removeChild == "function" && this.removeChild(t, !0), this.buildSkeleton(this.__body_children), this.applyLayout();
|
|
1532
|
+
}
|
|
1533
|
+
stripManagedStyles(t) {
|
|
1534
|
+
if (!t) return "";
|
|
1535
|
+
const i = t.split(";").map((s) => s.trim()).filter(Boolean), e = [];
|
|
1536
|
+
for (const s of i) {
|
|
1537
|
+
const _ = s.indexOf(":");
|
|
1538
|
+
if (_ === -1) continue;
|
|
1539
|
+
const r = s.slice(0, _).trim().toLowerCase(), l = s.slice(_ + 1).trim();
|
|
1540
|
+
!r || !l || y.managedStyles.has(r) || e.push(`${r}:${l}`);
|
|
1541
|
+
}
|
|
1542
|
+
return e.join("; ");
|
|
1543
|
+
}
|
|
1544
|
+
updateTitle() {
|
|
1545
|
+
const t = n.getObject(this.__title_id);
|
|
1546
|
+
if (!t) return;
|
|
1547
|
+
const i = this.__title ? String(this.__title) : "";
|
|
1548
|
+
t._text = i;
|
|
1549
|
+
}
|
|
1550
|
+
applyLayout() {
|
|
1551
|
+
this.addClass("xdrawer");
|
|
1552
|
+
const t = [
|
|
1553
|
+
"xdrawer--open",
|
|
1554
|
+
"xdrawer--left",
|
|
1555
|
+
"xdrawer--right",
|
|
1556
|
+
"xdrawer--elevated",
|
|
1557
|
+
"xdrawer--overlay"
|
|
1558
|
+
], i = [];
|
|
1559
|
+
this.__open && i.push("xdrawer--open"), i.push(`xdrawer--${this.__side}`), this.__elevated && i.push("xdrawer--elevated"), this.__overlay && i.push("xdrawer--overlay"), this.replaceClass(t.join(" "), i.join(" "));
|
|
1560
|
+
const e = this.stripManagedStyles(String(this.style || "")), s = [];
|
|
1561
|
+
e && s.push(e), this.__width && s.push(`--xdrawer-width:${this.__width}`);
|
|
1562
|
+
const _ = s.join("; ");
|
|
1563
|
+
this.style = _, this.updateTitle();
|
|
1564
|
+
}
|
|
1565
|
+
isOpen() {
|
|
1566
|
+
return this.__open;
|
|
1567
|
+
}
|
|
1568
|
+
setOpen(t, i = !1) {
|
|
1569
|
+
const e = this.normalizeBoolean(t, !1), s = e !== this.__open;
|
|
1570
|
+
this.__open = e, this.applyLayout(), !(!s || i) && (this.__open && this._on_open && this.checkAndRunInternalFunction(this._on_open), !this.__open && this._on_close && this.checkAndRunInternalFunction(this._on_close));
|
|
1571
|
+
}
|
|
1572
|
+
toggle() {
|
|
1573
|
+
this.setOpen(!this.__open);
|
|
1574
|
+
}
|
|
1575
|
+
set _open(t) {
|
|
1576
|
+
this.__open = this.normalizeBoolean(t, !1), this.applyLayout();
|
|
1577
|
+
}
|
|
1578
|
+
get _open() {
|
|
1579
|
+
return this.__open;
|
|
1580
|
+
}
|
|
1581
|
+
set _side(t) {
|
|
1582
|
+
this.__side = this.normalizeSide(t), this.applyLayout();
|
|
1583
|
+
}
|
|
1584
|
+
get _side() {
|
|
1585
|
+
return this.__side;
|
|
1586
|
+
}
|
|
1587
|
+
set _width(t) {
|
|
1588
|
+
this.__width = t ? String(t) : "360px", this.applyLayout();
|
|
1589
|
+
}
|
|
1590
|
+
get _width() {
|
|
1591
|
+
return this.__width;
|
|
1592
|
+
}
|
|
1593
|
+
set _title(t) {
|
|
1594
|
+
const i = this.hasTitle();
|
|
1595
|
+
this.__title = t ? String(t) : void 0;
|
|
1596
|
+
const e = this.hasTitle();
|
|
1597
|
+
i !== e ? this.rebuild() : (this.updateTitle(), this.applyLayout());
|
|
1598
|
+
}
|
|
1599
|
+
get _title() {
|
|
1600
|
+
return this.__title;
|
|
1601
|
+
}
|
|
1602
|
+
set _closable(t) {
|
|
1603
|
+
this.__closable = this.normalizeBoolean(t, !0), this.rebuild();
|
|
1604
|
+
}
|
|
1605
|
+
get _closable() {
|
|
1606
|
+
return this.__closable;
|
|
1607
|
+
}
|
|
1608
|
+
set _scroll(t) {
|
|
1609
|
+
this.__scroll = this.normalizeBoolean(t, !0), this.rebuild();
|
|
1610
|
+
}
|
|
1611
|
+
get _scroll() {
|
|
1612
|
+
return this.__scroll;
|
|
1613
|
+
}
|
|
1614
|
+
set _elevated(t) {
|
|
1615
|
+
this.__elevated = this.normalizeBoolean(t, !0), this.applyLayout();
|
|
1616
|
+
}
|
|
1617
|
+
get _elevated() {
|
|
1618
|
+
return this.__elevated;
|
|
1619
|
+
}
|
|
1620
|
+
set _overlay(t) {
|
|
1621
|
+
this.__overlay = this.normalizeBoolean(t, !1), this.applyLayout();
|
|
1622
|
+
}
|
|
1623
|
+
get _overlay() {
|
|
1624
|
+
return this.__overlay;
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
class k extends a {
|
|
1628
|
+
static _xtype = "navlist";
|
|
1629
|
+
__items = [];
|
|
1630
|
+
__active = "";
|
|
1631
|
+
__dense = !1;
|
|
1632
|
+
__dividers = !1;
|
|
1633
|
+
__list_id;
|
|
1634
|
+
constructor(t) {
|
|
1635
|
+
const i = {
|
|
1636
|
+
_type: k._xtype,
|
|
1637
|
+
class: "xnavlist",
|
|
1638
|
+
_html_tag: "div"
|
|
1639
|
+
};
|
|
1640
|
+
super(t, i, !0), this.__list_id = this._id + "_list", this.parse(t), this.applyProps(), this.applyLayout(), this.buildSkeleton(), this.renderItems();
|
|
1641
|
+
}
|
|
1642
|
+
normalizeBoolean(t) {
|
|
1643
|
+
return t === !0 || t === "true";
|
|
1644
|
+
}
|
|
1645
|
+
normalizeItems(t) {
|
|
1646
|
+
return Array.isArray(t) ? t : [];
|
|
1647
|
+
}
|
|
1648
|
+
applyProps() {
|
|
1649
|
+
this.__items = this.normalizeItems(this._items), this.__active = this._active ? String(this._active) : "", this.__dense = this.normalizeBoolean(this._dense), this.__dividers = this.normalizeBoolean(this._dividers);
|
|
1650
|
+
}
|
|
1651
|
+
buildSkeleton() {
|
|
1652
|
+
this.append({
|
|
1653
|
+
_type: "stack",
|
|
1654
|
+
_id: this.__list_id,
|
|
1655
|
+
class: "xnavlist__list",
|
|
1656
|
+
_direction: "vertical",
|
|
1657
|
+
_gap: 4,
|
|
1658
|
+
_children: []
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
getList() {
|
|
1662
|
+
return n.getObject(this.__list_id);
|
|
1663
|
+
}
|
|
1664
|
+
clearList(t) {
|
|
1665
|
+
if (!t) return;
|
|
1666
|
+
(Array.isArray(t._children) ? [...t._children] : []).forEach((e) => {
|
|
1667
|
+
typeof t.removeChild == "function" && t.removeChild(e, !0);
|
|
1668
|
+
}), t._children = [], t.dom instanceof HTMLElement && t.dom.replaceChildren();
|
|
1669
|
+
}
|
|
1670
|
+
getItemValue(t) {
|
|
1671
|
+
return t._value ? String(t._value) : t._id ? String(t._id) : String(t._label);
|
|
1672
|
+
}
|
|
1673
|
+
isActive(t) {
|
|
1674
|
+
return t._active === !0 ? !0 : this.getItemValue(t) === this.__active;
|
|
1675
|
+
}
|
|
1676
|
+
buildItem(t) {
|
|
1677
|
+
const i = t._disabled === !0, e = this.isActive(t), s = ["xnavlist__item"];
|
|
1678
|
+
e && s.push("xnavlist__item--active"), i && s.push("xnavlist__item--disabled");
|
|
1679
|
+
const _ = [];
|
|
1680
|
+
return t._icon && _.push(t._icon), _.push({
|
|
1681
|
+
_type: "label",
|
|
1682
|
+
class: "xnavlist__label",
|
|
1683
|
+
_text: String(t._label ?? "")
|
|
1684
|
+
}), t._badge && _.push({
|
|
1685
|
+
_type: "view",
|
|
1686
|
+
class: "xnavlist__badge",
|
|
1687
|
+
_children: [t._badge]
|
|
1688
|
+
}), {
|
|
1689
|
+
_type: "view",
|
|
1690
|
+
class: s.join(" "),
|
|
1691
|
+
_on_click: () => {
|
|
1692
|
+
if (i) return;
|
|
1693
|
+
const r = this.getItemValue(t);
|
|
1694
|
+
this.setActive(r, !0), this._on_select && this.checkAndRunInternalFunction(this._on_select, r, t);
|
|
1695
|
+
},
|
|
1696
|
+
_children: _
|
|
1697
|
+
};
|
|
1698
|
+
}
|
|
1699
|
+
renderItems() {
|
|
1700
|
+
const t = this.getList();
|
|
1701
|
+
t && (this.clearList(t), this.__items.forEach((i) => {
|
|
1702
|
+
t.append(this.buildItem(i));
|
|
1703
|
+
}));
|
|
1704
|
+
}
|
|
1705
|
+
applyLayout() {
|
|
1706
|
+
this.addClass("xnavlist");
|
|
1707
|
+
const t = ["xnavlist--dense", "xnavlist--dividers"], i = [];
|
|
1708
|
+
this.__dense && i.push("xnavlist--dense"), this.__dividers && i.push("xnavlist--dividers"), this.replaceClass(t.join(" "), i.join(" "));
|
|
1709
|
+
}
|
|
1710
|
+
setActive(t, i = !1) {
|
|
1711
|
+
if (this.__active = String(t ?? ""), this.renderItems(), !i && this._on_select) {
|
|
1712
|
+
const e = this.__items.find((s) => this.getItemValue(s) === this.__active);
|
|
1713
|
+
e && this.checkAndRunInternalFunction(this._on_select, this.__active, e);
|
|
1714
|
+
}
|
|
1715
|
+
}
|
|
1716
|
+
getActive() {
|
|
1717
|
+
return this.__active;
|
|
1718
|
+
}
|
|
1719
|
+
setItems(t) {
|
|
1720
|
+
this.__items = this.normalizeItems(t), this.renderItems();
|
|
1721
|
+
}
|
|
1722
|
+
set _items(t) {
|
|
1723
|
+
this.__items = this.normalizeItems(t), this.renderItems();
|
|
1724
|
+
}
|
|
1725
|
+
get _items() {
|
|
1726
|
+
return this.__items;
|
|
1727
|
+
}
|
|
1728
|
+
set _active(t) {
|
|
1729
|
+
this.__active = t ? String(t) : "", this.renderItems();
|
|
1730
|
+
}
|
|
1731
|
+
get _active() {
|
|
1732
|
+
return this.__active;
|
|
1733
|
+
}
|
|
1734
|
+
set _dense(t) {
|
|
1735
|
+
this.__dense = this.normalizeBoolean(t), this.applyLayout();
|
|
1736
|
+
}
|
|
1737
|
+
get _dense() {
|
|
1738
|
+
return this.__dense;
|
|
1739
|
+
}
|
|
1740
|
+
set _dividers(t) {
|
|
1741
|
+
this.__dividers = this.normalizeBoolean(t), this.applyLayout();
|
|
1742
|
+
}
|
|
1743
|
+
get _dividers() {
|
|
1744
|
+
return this.__dividers;
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
class g extends a {
|
|
1748
|
+
static _xtype = "sidebar";
|
|
1749
|
+
__side = "left";
|
|
1750
|
+
__width = "280px";
|
|
1751
|
+
__title;
|
|
1752
|
+
__subtitle;
|
|
1753
|
+
__logo;
|
|
1754
|
+
__actions;
|
|
1755
|
+
__nav;
|
|
1756
|
+
__scroll = !0;
|
|
1757
|
+
__dividers = !0;
|
|
1758
|
+
__footer;
|
|
1759
|
+
__collapsed = !1;
|
|
1760
|
+
__body_children = [];
|
|
1761
|
+
__panel_id;
|
|
1762
|
+
__title_id;
|
|
1763
|
+
__subtitle_id;
|
|
1764
|
+
static managedStyles = /* @__PURE__ */ new Set(["--xsidebar-width"]);
|
|
1765
|
+
constructor(t) {
|
|
1766
|
+
const i = {
|
|
1767
|
+
_type: g._xtype,
|
|
1768
|
+
class: "xsidebar",
|
|
1769
|
+
_html_tag: "div"
|
|
1770
|
+
};
|
|
1771
|
+
super(t, i, !0), this.__panel_id = this._id + "_panel", this.__title_id = this._id + "_title", this.__subtitle_id = this._id + "_subtitle", this.__body_children = Array.isArray(t._children) ? [...t._children] : [], Array.isArray(t._children) && (t._children = []), this.parse(t), this.applyProps(), this.rebuild();
|
|
1772
|
+
}
|
|
1773
|
+
normalizeSide(t) {
|
|
1774
|
+
return t === "right" ? "right" : "left";
|
|
1775
|
+
}
|
|
1776
|
+
normalizeBoolean(t, i = !1) {
|
|
1777
|
+
return t === !0 || t === "true" ? !0 : t === !1 || t === "false" ? !1 : i;
|
|
1778
|
+
}
|
|
1779
|
+
applyProps() {
|
|
1780
|
+
this.__side = this.normalizeSide(this._side), this.__width = this._width ? String(this._width) : "280px", this.__title = this._title ? String(this._title) : void 0, this.__subtitle = this._subtitle ? String(this._subtitle) : void 0, this.__logo = this._logo, this.__actions = Array.isArray(this._actions) ? this._actions : void 0, this.__nav = this._nav, this.__scroll = this.normalizeBoolean(this._scroll, !0), this.__dividers = this.normalizeBoolean(this._dividers, !0), this.__footer = this._footer, this.__collapsed = this.normalizeBoolean(this._collapsed, !1);
|
|
1781
|
+
}
|
|
1782
|
+
hasHeader() {
|
|
1783
|
+
return !!(this.__title && this.__title.trim().length || this.__subtitle && this.__subtitle.trim().length || this.__logo || this.__actions && this.__actions.length);
|
|
1784
|
+
}
|
|
1785
|
+
buildHeader() {
|
|
1786
|
+
if (!this.hasHeader()) return [];
|
|
1787
|
+
const t = [];
|
|
1788
|
+
this.__title && this.__title.trim().length && t.push({
|
|
1789
|
+
_type: "label",
|
|
1790
|
+
_id: this.__title_id,
|
|
1791
|
+
class: "xsidebar__title",
|
|
1792
|
+
_text: this.__title
|
|
1793
|
+
}), this.__subtitle && this.__subtitle.trim().length && t.push({
|
|
1794
|
+
_type: "label",
|
|
1795
|
+
_id: this.__subtitle_id,
|
|
1796
|
+
class: "xsidebar__subtitle",
|
|
1797
|
+
_text: this.__subtitle
|
|
1798
|
+
});
|
|
1799
|
+
const i = [];
|
|
1800
|
+
this.__logo && i.push(this.__logo), t.length && i.push({
|
|
1801
|
+
_type: "stack",
|
|
1802
|
+
class: "xsidebar__titles",
|
|
1803
|
+
_direction: "vertical",
|
|
1804
|
+
_gap: 2,
|
|
1805
|
+
_children: t
|
|
1806
|
+
});
|
|
1807
|
+
const e = {
|
|
1808
|
+
_type: "stack",
|
|
1809
|
+
class: "xsidebar__header-row",
|
|
1810
|
+
_direction: "horizontal",
|
|
1811
|
+
_gap: 8,
|
|
1812
|
+
_align: "center",
|
|
1813
|
+
_justify: "space-between",
|
|
1814
|
+
_children: [
|
|
1815
|
+
{
|
|
1816
|
+
_type: "stack",
|
|
1817
|
+
class: "xsidebar__head-left",
|
|
1818
|
+
_direction: "horizontal",
|
|
1819
|
+
_gap: 8,
|
|
1820
|
+
_align: "center",
|
|
1821
|
+
_children: i
|
|
1822
|
+
}
|
|
1823
|
+
]
|
|
1824
|
+
};
|
|
1825
|
+
return this.__actions && this.__actions.length && e._children.push({
|
|
1826
|
+
_type: "stack",
|
|
1827
|
+
class: "xsidebar__actions",
|
|
1828
|
+
_direction: "horizontal",
|
|
1829
|
+
_gap: 6,
|
|
1830
|
+
_align: "center",
|
|
1831
|
+
_children: this.__actions
|
|
1832
|
+
}), [
|
|
1833
|
+
{
|
|
1834
|
+
_type: "view",
|
|
1835
|
+
class: "xsidebar__header",
|
|
1836
|
+
_children: [e]
|
|
1837
|
+
}
|
|
1838
|
+
];
|
|
1839
|
+
}
|
|
1840
|
+
buildBody(t) {
|
|
1841
|
+
const i = this.__nav ? [this.__nav] : t;
|
|
1842
|
+
return {
|
|
1843
|
+
_type: "view",
|
|
1844
|
+
class: "xsidebar__body",
|
|
1845
|
+
_children: this.__scroll ? [
|
|
1846
|
+
{
|
|
1847
|
+
_type: "scroll",
|
|
1848
|
+
class: "xsidebar__scroll",
|
|
1849
|
+
_children: i
|
|
1850
|
+
}
|
|
1851
|
+
] : i
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
buildFooter() {
|
|
1855
|
+
return this.__footer ? [
|
|
1856
|
+
{
|
|
1857
|
+
_type: "view",
|
|
1858
|
+
class: "xsidebar__footer",
|
|
1859
|
+
_children: [this.__footer]
|
|
1860
|
+
}
|
|
1861
|
+
] : [];
|
|
1862
|
+
}
|
|
1863
|
+
buildSkeleton(t) {
|
|
1864
|
+
const i = [], e = this.buildHeader();
|
|
1865
|
+
e.length && (i.push(...e), this.__dividers && i.push({ _type: "divider", _muted: !0 })), i.push(this.buildBody(t));
|
|
1866
|
+
const s = this.buildFooter();
|
|
1867
|
+
s.length && (this.__dividers && i.push({ _type: "divider", _muted: !0 }), i.push(...s)), this.append({
|
|
1868
|
+
_type: "view",
|
|
1869
|
+
_id: this.__panel_id,
|
|
1870
|
+
class: "xsidebar__panel",
|
|
1871
|
+
_children: i
|
|
1872
|
+
});
|
|
1873
|
+
}
|
|
1874
|
+
splitClasses(t) {
|
|
1875
|
+
return t.split(/\s+/).map((i) => i.trim()).filter(Boolean);
|
|
1876
|
+
}
|
|
1877
|
+
extractBodyChildren() {
|
|
1878
|
+
return this.__nav ? [this.__nav] : this.__body_children;
|
|
1879
|
+
}
|
|
1880
|
+
rebuild() {
|
|
1881
|
+
const t = this.extractBodyChildren(), i = n.getObject(this.__panel_id);
|
|
1882
|
+
i && typeof this.removeChild == "function" && this.removeChild(i, !0), this.buildSkeleton(t), this.applyLayout();
|
|
1883
|
+
}
|
|
1884
|
+
stripManagedStyles(t) {
|
|
1885
|
+
if (!t) return "";
|
|
1886
|
+
const i = t.split(";").map((s) => s.trim()).filter(Boolean), e = [];
|
|
1887
|
+
for (const s of i) {
|
|
1888
|
+
const _ = s.indexOf(":");
|
|
1889
|
+
if (_ === -1) continue;
|
|
1890
|
+
const r = s.slice(0, _).trim().toLowerCase(), l = s.slice(_ + 1).trim();
|
|
1891
|
+
!r || !l || g.managedStyles.has(r) || e.push(`${r}:${l}`);
|
|
1892
|
+
}
|
|
1893
|
+
return e.join("; ");
|
|
1894
|
+
}
|
|
1895
|
+
updateTitles() {
|
|
1896
|
+
const t = n.getObject(this.__title_id);
|
|
1897
|
+
t && (t._text = this.__title || "");
|
|
1898
|
+
const i = n.getObject(this.__subtitle_id);
|
|
1899
|
+
i && (i._text = this.__subtitle || "");
|
|
1900
|
+
}
|
|
1901
|
+
buildClassName() {
|
|
1902
|
+
const t = String(this.class || ""), e = ["xsidebar", ...this.splitClasses(t).filter(
|
|
1903
|
+
(s) => s !== "xsidebar" && s !== "xsidebar--left" && s !== "xsidebar--right" && s !== "xsidebar--collapsed" && s !== "xsidebar--dividers"
|
|
1904
|
+
)];
|
|
1905
|
+
return e.push(`xsidebar--${this.__side}`), this.__collapsed && e.push("xsidebar--collapsed"), this.__dividers && e.push("xsidebar--dividers"), Array.from(new Set(e.filter(Boolean))).join(" ");
|
|
1906
|
+
}
|
|
1907
|
+
applyLayout() {
|
|
1908
|
+
const t = this.buildClassName();
|
|
1909
|
+
this.class = t;
|
|
1910
|
+
const i = this.stripManagedStyles(String(this.style || "")), e = [];
|
|
1911
|
+
i && e.push(i), this.__width && e.push(`--xsidebar-width:${this.__width}`);
|
|
1912
|
+
const s = e.join("; ");
|
|
1913
|
+
this.style = s, this.updateTitles();
|
|
1914
|
+
}
|
|
1915
|
+
isCollapsed() {
|
|
1916
|
+
return this.__collapsed;
|
|
1917
|
+
}
|
|
1918
|
+
setCollapsed(t, i = !1) {
|
|
1919
|
+
const e = this.normalizeBoolean(t, !1), s = e !== this.__collapsed;
|
|
1920
|
+
if (this.__collapsed = e, this.applyLayout(), !s || i) return;
|
|
1921
|
+
const _ = this._on_toggle;
|
|
1922
|
+
typeof _ == "function" && _(this, this.__collapsed);
|
|
1923
|
+
}
|
|
1924
|
+
toggleCollapsed() {
|
|
1925
|
+
this.setCollapsed(!this.__collapsed);
|
|
1926
|
+
}
|
|
1927
|
+
set _collapsed(t) {
|
|
1928
|
+
this.__collapsed = this.normalizeBoolean(t, !1), this.applyLayout();
|
|
1929
|
+
}
|
|
1930
|
+
get _collapsed() {
|
|
1931
|
+
return this.__collapsed;
|
|
1932
|
+
}
|
|
1933
|
+
set _side(t) {
|
|
1934
|
+
this.__side = this.normalizeSide(t), this.applyLayout();
|
|
1935
|
+
}
|
|
1936
|
+
get _side() {
|
|
1937
|
+
return this.__side;
|
|
1938
|
+
}
|
|
1939
|
+
set _width(t) {
|
|
1940
|
+
this.__width = t ? String(t) : "280px", this.applyLayout();
|
|
1941
|
+
}
|
|
1942
|
+
get _width() {
|
|
1943
|
+
return this.__width;
|
|
1944
|
+
}
|
|
1945
|
+
set _title(t) {
|
|
1946
|
+
const i = this.hasHeader();
|
|
1947
|
+
this.__title = t ? String(t) : void 0;
|
|
1948
|
+
const e = this.hasHeader();
|
|
1949
|
+
i !== e ? this.rebuild() : (this.updateTitles(), this.applyLayout());
|
|
1950
|
+
}
|
|
1951
|
+
get _title() {
|
|
1952
|
+
return this.__title;
|
|
1953
|
+
}
|
|
1954
|
+
set _subtitle(t) {
|
|
1955
|
+
const i = this.hasHeader();
|
|
1956
|
+
this.__subtitle = t ? String(t) : void 0;
|
|
1957
|
+
const e = this.hasHeader();
|
|
1958
|
+
i !== e ? this.rebuild() : (this.updateTitles(), this.applyLayout());
|
|
1959
|
+
}
|
|
1960
|
+
get _subtitle() {
|
|
1961
|
+
return this.__subtitle;
|
|
1962
|
+
}
|
|
1963
|
+
set _logo(t) {
|
|
1964
|
+
this.__logo = t, this.rebuild();
|
|
1965
|
+
}
|
|
1966
|
+
get _logo() {
|
|
1967
|
+
return this.__logo;
|
|
1968
|
+
}
|
|
1969
|
+
set _actions(t) {
|
|
1970
|
+
this.__actions = Array.isArray(t) ? t : void 0, this.rebuild();
|
|
1971
|
+
}
|
|
1972
|
+
get _actions() {
|
|
1973
|
+
return this.__actions;
|
|
1974
|
+
}
|
|
1975
|
+
set _nav(t) {
|
|
1976
|
+
this.__nav = t, this.rebuild();
|
|
1977
|
+
}
|
|
1978
|
+
get _nav() {
|
|
1979
|
+
return this.__nav;
|
|
1980
|
+
}
|
|
1981
|
+
set _scroll(t) {
|
|
1982
|
+
this.__scroll = this.normalizeBoolean(t, !0), this.rebuild();
|
|
1983
|
+
}
|
|
1984
|
+
get _scroll() {
|
|
1985
|
+
return this.__scroll;
|
|
1986
|
+
}
|
|
1987
|
+
set _dividers(t) {
|
|
1988
|
+
this.__dividers = this.normalizeBoolean(t, !0), this.rebuild();
|
|
1989
|
+
}
|
|
1990
|
+
get _dividers() {
|
|
1991
|
+
return this.__dividers;
|
|
1992
|
+
}
|
|
1993
|
+
set _footer(t) {
|
|
1994
|
+
this.__footer = t, this.rebuild();
|
|
1995
|
+
}
|
|
1996
|
+
get _footer() {
|
|
1997
|
+
return this.__footer;
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
class m extends a {
|
|
2001
|
+
static _xtype = "modal";
|
|
2002
|
+
__open = !1;
|
|
2003
|
+
__title;
|
|
2004
|
+
__subtitle;
|
|
2005
|
+
__size = "md";
|
|
2006
|
+
__width;
|
|
2007
|
+
__closable = !0;
|
|
2008
|
+
__close_on_backdrop = !0;
|
|
2009
|
+
__scroll = !0;
|
|
2010
|
+
__actions;
|
|
2011
|
+
__content;
|
|
2012
|
+
__body_children = [];
|
|
2013
|
+
__ready = !1;
|
|
2014
|
+
__backdrop_id;
|
|
2015
|
+
__panel_id;
|
|
2016
|
+
__body_id;
|
|
2017
|
+
static managedStyles = /* @__PURE__ */ new Set(["--xmodal-width"]);
|
|
2018
|
+
constructor(t) {
|
|
2019
|
+
const i = {
|
|
2020
|
+
_type: m._xtype,
|
|
2021
|
+
class: "xmodal",
|
|
2022
|
+
_html_tag: "div"
|
|
2023
|
+
};
|
|
2024
|
+
super(t, i, !0), this.__backdrop_id = this._id + "_backdrop", this.__panel_id = this._id + "_panel", this.__body_id = this._id + "_body", this.parse(t), this.applyProps(), this.__content || (this.__body_children = this.captureBodyChildren(t._children)), this._children = [], this.rebuild(), this.__ready = !0;
|
|
2025
|
+
}
|
|
2026
|
+
normalizeBoolean(t, i = !1) {
|
|
2027
|
+
return t === !0 || t === "true" ? !0 : t === !1 || t === "false" ? !1 : i;
|
|
2028
|
+
}
|
|
2029
|
+
normalizeSize(t) {
|
|
2030
|
+
return t === "sm" || t === "lg" ? t : "md";
|
|
2031
|
+
}
|
|
2032
|
+
applyProps() {
|
|
2033
|
+
this.__open = this.normalizeBoolean(this._open, !1), this.__title = this._title ? String(this._title) : void 0, this.__subtitle = this._subtitle ? String(this._subtitle) : void 0, this.__size = this.normalizeSize(this._size), this.__width = this._width ? String(this._width) : void 0, this.__closable = this.normalizeBoolean(this._closable, !0), this.__close_on_backdrop = this.normalizeBoolean(this._close_on_backdrop, !0), this.__scroll = this.normalizeBoolean(this._scroll, !0), this.__actions = Array.isArray(this._actions) ? this._actions : void 0, this.__content = Array.isArray(this._content) ? this._content : void 0;
|
|
2034
|
+
}
|
|
2035
|
+
buildHeader() {
|
|
2036
|
+
if (!(this.__title || this.__subtitle || this.__closable)) return [];
|
|
2037
|
+
const i = [];
|
|
2038
|
+
this.__title && i.push({
|
|
2039
|
+
_type: "label",
|
|
2040
|
+
class: "xmodal__title",
|
|
2041
|
+
_text: this.__title
|
|
2042
|
+
}), this.__subtitle && i.push({
|
|
2043
|
+
_type: "label",
|
|
2044
|
+
class: "xmodal__subtitle",
|
|
2045
|
+
_text: this.__subtitle
|
|
2046
|
+
});
|
|
2047
|
+
const e = [];
|
|
2048
|
+
return i.length && e.push({
|
|
2049
|
+
_type: "stack",
|
|
2050
|
+
class: "xmodal__titles",
|
|
2051
|
+
_direction: "vertical",
|
|
2052
|
+
_gap: 2,
|
|
2053
|
+
_children: i
|
|
2054
|
+
}), this.__closable && e.push({
|
|
2055
|
+
_type: "button",
|
|
2056
|
+
class: "xmodal__close",
|
|
2057
|
+
_text: "×",
|
|
2058
|
+
_on_click: () => this.close()
|
|
2059
|
+
}), [
|
|
2060
|
+
{
|
|
2061
|
+
_type: "toolbar",
|
|
2062
|
+
class: "xmodal__header",
|
|
2063
|
+
_gap: 8,
|
|
2064
|
+
_justify: "space-between",
|
|
2065
|
+
_children: e
|
|
2066
|
+
},
|
|
2067
|
+
{ _type: "divider", _muted: !0 }
|
|
2068
|
+
];
|
|
2069
|
+
}
|
|
2070
|
+
buildBody(t) {
|
|
2071
|
+
const i = this.__content ? this.__content : t, e = this.__scroll ? [
|
|
2072
|
+
{
|
|
2073
|
+
_type: "scroll",
|
|
2074
|
+
class: "xmodal__scroll",
|
|
2075
|
+
_children: i
|
|
2076
|
+
}
|
|
2077
|
+
] : i;
|
|
2078
|
+
return {
|
|
2079
|
+
_type: "view",
|
|
2080
|
+
_id: this.__body_id,
|
|
2081
|
+
class: "xmodal__body",
|
|
2082
|
+
_children: e
|
|
2083
|
+
};
|
|
2084
|
+
}
|
|
2085
|
+
buildFooter() {
|
|
2086
|
+
return !this.__actions || !this.__actions.length ? [] : [
|
|
2087
|
+
{ _type: "divider", _muted: !0 },
|
|
2088
|
+
{
|
|
2089
|
+
_type: "toolbar",
|
|
2090
|
+
class: "xmodal__footer",
|
|
2091
|
+
_justify: "end",
|
|
2092
|
+
_children: [
|
|
2093
|
+
{
|
|
2094
|
+
_type: "stack",
|
|
2095
|
+
_direction: "horizontal",
|
|
2096
|
+
_gap: 8,
|
|
2097
|
+
_align: "center",
|
|
2098
|
+
_children: this.__actions
|
|
2099
|
+
}
|
|
2100
|
+
]
|
|
2101
|
+
}
|
|
2102
|
+
];
|
|
2103
|
+
}
|
|
2104
|
+
buildSkeleton(t) {
|
|
2105
|
+
const i = {
|
|
2106
|
+
_type: "view",
|
|
2107
|
+
_id: this.__backdrop_id,
|
|
2108
|
+
class: "xmodal__backdrop"
|
|
2109
|
+
};
|
|
2110
|
+
this.__close_on_backdrop && (i._on_click = () => this.close());
|
|
2111
|
+
const e = [];
|
|
2112
|
+
e.push(...this.buildHeader()), e.push(this.buildBody(t)), e.push(...this.buildFooter());
|
|
2113
|
+
const s = {
|
|
2114
|
+
_type: "view",
|
|
2115
|
+
_id: this.__panel_id,
|
|
2116
|
+
class: "xmodal__panel",
|
|
2117
|
+
_children: [
|
|
2118
|
+
{
|
|
2119
|
+
_type: "view",
|
|
2120
|
+
class: "xmodal__card",
|
|
2121
|
+
_children: e
|
|
2122
|
+
}
|
|
2123
|
+
]
|
|
2124
|
+
};
|
|
2125
|
+
this.append(i), this.append(s);
|
|
2126
|
+
}
|
|
2127
|
+
captureBodyChildren(t) {
|
|
2128
|
+
return (Array.isArray(t) ? t : []).filter(
|
|
2129
|
+
(e) => e && e._id !== this.__panel_id && e._id !== this.__backdrop_id
|
|
2130
|
+
);
|
|
2131
|
+
}
|
|
2132
|
+
rebuild() {
|
|
2133
|
+
const t = n.getObject(this.__panel_id);
|
|
2134
|
+
t && typeof this.removeChild == "function" && this.removeChild(t, !0);
|
|
2135
|
+
const i = n.getObject(this.__backdrop_id);
|
|
2136
|
+
i && typeof this.removeChild == "function" && this.removeChild(i, !0), this.buildSkeleton(this.__body_children), this.applyLayout();
|
|
2137
|
+
}
|
|
2138
|
+
stripManagedStyles(t) {
|
|
2139
|
+
if (!t) return "";
|
|
2140
|
+
const i = t.split(";").map((s) => s.trim()).filter(Boolean), e = [];
|
|
2141
|
+
for (const s of i) {
|
|
2142
|
+
const _ = s.indexOf(":");
|
|
2143
|
+
if (_ === -1) continue;
|
|
2144
|
+
const r = s.slice(0, _).trim().toLowerCase(), l = s.slice(_ + 1).trim();
|
|
2145
|
+
!r || !l || m.managedStyles.has(r) || e.push(`${r}:${l}`);
|
|
2146
|
+
}
|
|
2147
|
+
return e.join("; ");
|
|
2148
|
+
}
|
|
2149
|
+
applyLayout() {
|
|
2150
|
+
this.addClass("xmodal"), this.replaceClass("xmodal--sm xmodal--md xmodal--lg", `xmodal--${this.__size}`), this.replaceClass("xmodal--open", this.__open ? "xmodal--open" : "");
|
|
2151
|
+
const t = this.stripManagedStyles(String(this.style || "")), i = [];
|
|
2152
|
+
t && i.push(t), this.__width && i.push(`--xmodal-width:${this.__width}`);
|
|
2153
|
+
const e = i.join("; ");
|
|
2154
|
+
this.style = e, this.__width && this.setStyleAttribute("--xmodal-width", this.__width);
|
|
2155
|
+
}
|
|
2156
|
+
async onCreate() {
|
|
2157
|
+
(Array.isArray(this._children) ? [...this._children] : []).forEach((i) => {
|
|
2158
|
+
const e = i?._id;
|
|
2159
|
+
e === this.__panel_id || e === this.__backdrop_id || typeof this.removeChild == "function" && this.removeChild(i, !0);
|
|
2160
|
+
}), !this.__content && this.__body_children.length && !this.__ready && (this.rebuild(), this.__ready = !0), await super.onCreate();
|
|
2161
|
+
}
|
|
2162
|
+
isOpen() {
|
|
2163
|
+
return this.__open;
|
|
2164
|
+
}
|
|
2165
|
+
setOpen(t, i = !1) {
|
|
2166
|
+
const e = this.normalizeBoolean(t, !1), s = e !== this.__open;
|
|
2167
|
+
this.__open = e, this.applyLayout(), !(!s || i) && (this.__open && this._on_open && this.checkAndRunInternalFunction(this._on_open), !this.__open && this._on_close && this.checkAndRunInternalFunction(this._on_close));
|
|
2168
|
+
}
|
|
2169
|
+
open() {
|
|
2170
|
+
this.setOpen(!0);
|
|
2171
|
+
}
|
|
2172
|
+
close() {
|
|
2173
|
+
this.setOpen(!1);
|
|
2174
|
+
}
|
|
2175
|
+
}
|
|
2176
|
+
class C extends a {
|
|
2177
|
+
static _xtype = "toast";
|
|
2178
|
+
__open = !1;
|
|
2179
|
+
__text = "";
|
|
2180
|
+
__variant = "default";
|
|
2181
|
+
__icon;
|
|
2182
|
+
__actions;
|
|
2183
|
+
__closable = !0;
|
|
2184
|
+
__auto_close_ms;
|
|
2185
|
+
__position = "bottom-right";
|
|
2186
|
+
__elapsed = 0;
|
|
2187
|
+
__last_tick;
|
|
2188
|
+
__ready = !1;
|
|
2189
|
+
__container_id;
|
|
2190
|
+
__text_id;
|
|
2191
|
+
constructor(t) {
|
|
2192
|
+
const i = {
|
|
2193
|
+
_type: C._xtype,
|
|
2194
|
+
class: "xtoast",
|
|
2195
|
+
_html_tag: "div"
|
|
2196
|
+
};
|
|
2197
|
+
super(t, i, !0), this.__container_id = this._id + "_container", this.__text_id = this._id + "_text", this.parse(t), this.applyProps(), this.buildSkeleton(), this.applyLayout(), this.__ready = !0;
|
|
2198
|
+
}
|
|
2199
|
+
normalizeBoolean(t, i = !1) {
|
|
2200
|
+
return t === !0 || t === "true" ? !0 : t === !1 || t === "false" ? !1 : i;
|
|
2201
|
+
}
|
|
2202
|
+
normalizeVariant(t) {
|
|
2203
|
+
return t === "success" || t === "error" || t === "warn" || t === "info" ? t : "default";
|
|
2204
|
+
}
|
|
2205
|
+
normalizePosition(t) {
|
|
2206
|
+
return t === "top-right" || t === "top-left" || t === "bottom-left" ? t : "bottom-right";
|
|
2207
|
+
}
|
|
2208
|
+
applyProps() {
|
|
2209
|
+
this.__open = this.normalizeBoolean(this._open, !1), this.__text = this._text ? String(this._text) : "", this.__variant = this.normalizeVariant(this._variant), this.__icon = this._icon, this.__actions = Array.isArray(this._actions) ? this._actions : void 0, this.__closable = this.normalizeBoolean(this._closable, !0), this.__auto_close_ms = typeof this._auto_close_ms == "number" ? this._auto_close_ms : void 0, this.__position = this.normalizePosition(this._position);
|
|
2210
|
+
}
|
|
2211
|
+
buildSkeleton() {
|
|
2212
|
+
const t = [];
|
|
2213
|
+
this.__icon && t.push({
|
|
2214
|
+
_type: "view",
|
|
2215
|
+
class: "xtoast__icon",
|
|
2216
|
+
_children: [this.__icon]
|
|
2217
|
+
}), t.push({
|
|
2218
|
+
_type: "label",
|
|
2219
|
+
_id: this.__text_id,
|
|
2220
|
+
class: "xtoast__text",
|
|
2221
|
+
_text: this.__text
|
|
2222
|
+
}), this.__actions && this.__actions.length && t.push({
|
|
2223
|
+
_type: "view",
|
|
2224
|
+
class: "xtoast__actions",
|
|
2225
|
+
_children: this.__actions
|
|
2226
|
+
}), this.__closable && t.push({
|
|
2227
|
+
_type: "button",
|
|
2228
|
+
class: "xtoast__close",
|
|
2229
|
+
_text: "×",
|
|
2230
|
+
_on_click: () => this.close()
|
|
2231
|
+
}), this.append({
|
|
2232
|
+
_type: "view",
|
|
2233
|
+
_id: this.__container_id,
|
|
2234
|
+
class: "xtoast__container",
|
|
2235
|
+
_children: t
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
rebuild() {
|
|
2239
|
+
const t = n.getObject(this.__container_id);
|
|
2240
|
+
t && typeof this.removeChild == "function" && this.removeChild(t, !0), this.buildSkeleton(), this.applyLayout();
|
|
2241
|
+
}
|
|
2242
|
+
applyLayout() {
|
|
2243
|
+
this.addClass("xtoast"), this.replaceClass("xtoast--open", this.__open ? "xtoast--open" : ""), this.replaceClass(
|
|
2244
|
+
"xtoast--default xtoast--success xtoast--error xtoast--warn xtoast--info",
|
|
2245
|
+
`xtoast--${this.__variant}`
|
|
2246
|
+
), this.replaceClass(
|
|
2247
|
+
"xtoast--top-right xtoast--top-left xtoast--bottom-right xtoast--bottom-left",
|
|
2248
|
+
`xtoast--${this.__position}`
|
|
2249
|
+
);
|
|
2250
|
+
}
|
|
2251
|
+
resetTimer() {
|
|
2252
|
+
this.__elapsed = 0, this.__last_tick = void 0;
|
|
2253
|
+
}
|
|
2254
|
+
async onFrame(t) {
|
|
2255
|
+
if (!this.__open || !this.__auto_close_ms || this.__auto_close_ms <= 0) return;
|
|
2256
|
+
await super.onFrame(t);
|
|
2257
|
+
const i = globalThis.performance?.now ? globalThis.performance.now() : Date.now();
|
|
2258
|
+
if (!this.__last_tick) {
|
|
2259
|
+
this.__last_tick = i;
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2262
|
+
this.__elapsed += i - this.__last_tick, this.__last_tick = i, this.__elapsed >= this.__auto_close_ms && (this.close(), this.__last_tick = void 0);
|
|
2263
|
+
}
|
|
2264
|
+
isOpen() {
|
|
2265
|
+
return this.__open;
|
|
2266
|
+
}
|
|
2267
|
+
setOpen(t, i = !1) {
|
|
2268
|
+
const e = this.normalizeBoolean(t, !1), s = e !== this.__open;
|
|
2269
|
+
this.__open = e, this.__open && this.resetTimer(), this.applyLayout(), !(!s || i) && (this.__open && this._on_open && this.checkAndRunInternalFunction(this._on_open), !this.__open && this._on_close && this.checkAndRunInternalFunction(this._on_close));
|
|
2270
|
+
}
|
|
2271
|
+
open() {
|
|
2272
|
+
this.setOpen(!0);
|
|
2273
|
+
}
|
|
2274
|
+
close() {
|
|
2275
|
+
this.setOpen(!1);
|
|
2276
|
+
}
|
|
2277
|
+
set _open(t) {
|
|
2278
|
+
this.__open = this.normalizeBoolean(t, !1), this.__open && this.resetTimer(), this.applyLayout();
|
|
2279
|
+
}
|
|
2280
|
+
get _open() {
|
|
2281
|
+
return this.__open;
|
|
2282
|
+
}
|
|
2283
|
+
set _text(t) {
|
|
2284
|
+
this.__text = t ? String(t) : "";
|
|
2285
|
+
const i = n.getObject(this.__text_id);
|
|
2286
|
+
i && (i._text = this.__text);
|
|
2287
|
+
}
|
|
2288
|
+
get _text() {
|
|
2289
|
+
return this.__text;
|
|
2290
|
+
}
|
|
2291
|
+
set _variant(t) {
|
|
2292
|
+
this.__variant = this.normalizeVariant(t), this.applyLayout();
|
|
2293
|
+
}
|
|
2294
|
+
get _variant() {
|
|
2295
|
+
return this.__variant;
|
|
2296
|
+
}
|
|
2297
|
+
set _position(t) {
|
|
2298
|
+
this.__position = this.normalizePosition(t), this.applyLayout();
|
|
2299
|
+
}
|
|
2300
|
+
get _position() {
|
|
2301
|
+
return this.__position;
|
|
2302
|
+
}
|
|
2303
|
+
set _icon(t) {
|
|
2304
|
+
this.__icon = t, this.__ready && this.rebuild();
|
|
2305
|
+
}
|
|
2306
|
+
get _icon() {
|
|
2307
|
+
return this.__icon;
|
|
2308
|
+
}
|
|
2309
|
+
set _actions(t) {
|
|
2310
|
+
this.__actions = Array.isArray(t) ? t : void 0, this.__ready && this.rebuild();
|
|
2311
|
+
}
|
|
2312
|
+
get _actions() {
|
|
2313
|
+
return this.__actions;
|
|
2314
|
+
}
|
|
2315
|
+
set _closable(t) {
|
|
2316
|
+
this.__closable = this.normalizeBoolean(t, !0), this.__ready && this.rebuild();
|
|
2317
|
+
}
|
|
2318
|
+
get _closable() {
|
|
2319
|
+
return this.__closable;
|
|
2320
|
+
}
|
|
2321
|
+
set _auto_close_ms(t) {
|
|
2322
|
+
this.__auto_close_ms = typeof t == "number" ? t : void 0, this.__open && this.resetTimer();
|
|
2323
|
+
}
|
|
2324
|
+
get _auto_close_ms() {
|
|
2325
|
+
return this.__auto_close_ms;
|
|
2326
|
+
}
|
|
2327
|
+
}
|
|
2328
|
+
class L extends a {
|
|
2329
|
+
static _xtype = "card";
|
|
2330
|
+
__image;
|
|
2331
|
+
__title;
|
|
2332
|
+
__text = "";
|
|
2333
|
+
__href;
|
|
2334
|
+
__link_text;
|
|
2335
|
+
__actions;
|
|
2336
|
+
__image_alt;
|
|
2337
|
+
__hide_image = !1;
|
|
2338
|
+
__image_id;
|
|
2339
|
+
__title_id;
|
|
2340
|
+
__text_id;
|
|
2341
|
+
__link_id;
|
|
2342
|
+
__actions_id;
|
|
2343
|
+
__image_placeholder = "https://via.placeholder.com/600x200?text=Card";
|
|
2344
|
+
__title_placeholder = "Card title";
|
|
2345
|
+
__text_placeholder = "Card text...";
|
|
2346
|
+
__href_placeholder = "#";
|
|
2347
|
+
__link_text_placeholder = "Learn more";
|
|
2348
|
+
__image_alt_placeholder = "Card image";
|
|
2349
|
+
constructor(t) {
|
|
2350
|
+
const i = {
|
|
2351
|
+
_type: L._xtype,
|
|
2352
|
+
class: "xcard",
|
|
2353
|
+
_html_tag: "div"
|
|
2354
|
+
};
|
|
2355
|
+
super(t, i, !0), this.__image_id = this._id + "_image", this.__title_id = this._id + "_title", this.__text_id = this._id + "_text", this.__link_id = this._id + "_link", this.__actions_id = this._id + "_actions", this.parse(t), this.applyProps(), this.buildSkeleton(), this.applyLayout(), this.applyText();
|
|
2356
|
+
}
|
|
2357
|
+
normalizeBoolean(t, i = !1) {
|
|
2358
|
+
return t === !0 || t === "true" ? !0 : t === !1 || t === "false" ? !1 : i;
|
|
2359
|
+
}
|
|
2360
|
+
applyProps() {
|
|
2361
|
+
this.__image = this._image ? String(this._image) : void 0, this.__title = this._title ? String(this._title) : void 0, this.__text = this._text ? String(this._text) : "", this.__href = this._href ? String(this._href) : void 0, this.__link_text = this._link_text ? String(this._link_text) : void 0, this.__actions = Array.isArray(this._actions) ? this._actions : void 0, this.__image_alt = this._image_alt ? String(this._image_alt) : void 0, this.__hide_image = this.normalizeBoolean(this._hide_image, !1);
|
|
2362
|
+
}
|
|
2363
|
+
resolveImage() {
|
|
2364
|
+
const t = this.__image ? this.__image.trim() : "";
|
|
2365
|
+
return t || this.__image_placeholder;
|
|
2366
|
+
}
|
|
2367
|
+
resolveImageAlt() {
|
|
2368
|
+
const t = this.__image_alt ? this.__image_alt.trim() : "";
|
|
2369
|
+
return t || this.__image_alt_placeholder;
|
|
2370
|
+
}
|
|
2371
|
+
resolveTitle() {
|
|
2372
|
+
const t = this.__title ? this.__title.trim() : "";
|
|
2373
|
+
return t || this.__title_placeholder;
|
|
2374
|
+
}
|
|
2375
|
+
resolveText() {
|
|
2376
|
+
const t = this.__text.trim();
|
|
2377
|
+
return t || this.__text_placeholder;
|
|
2378
|
+
}
|
|
2379
|
+
resolveHref() {
|
|
2380
|
+
const t = this.__href ? this.__href.trim() : "";
|
|
2381
|
+
return t || this.__href_placeholder;
|
|
2382
|
+
}
|
|
2383
|
+
resolveLinkText() {
|
|
2384
|
+
const t = this.__link_text ? this.__link_text.trim() : "";
|
|
2385
|
+
return t || this.__link_text_placeholder;
|
|
2386
|
+
}
|
|
2387
|
+
splitClasses(t) {
|
|
2388
|
+
return t.split(/\s+/).map((i) => i.trim()).filter(Boolean);
|
|
2389
|
+
}
|
|
2390
|
+
buildClassName() {
|
|
2391
|
+
const t = String(this.class || ""), e = ["xcard", ...this.splitClasses(t).filter((s) => s !== "xcard" && s !== "xcard--no-image")];
|
|
2392
|
+
return this.__hide_image && e.push("xcard--no-image"), Array.from(new Set(e.filter(Boolean))).join(" ");
|
|
2393
|
+
}
|
|
2394
|
+
buildSkeleton() {
|
|
2395
|
+
const t = {
|
|
2396
|
+
_type: "view",
|
|
2397
|
+
class: "xcard__inner",
|
|
2398
|
+
_children: [
|
|
2399
|
+
{
|
|
2400
|
+
_type: "image",
|
|
2401
|
+
_id: this.__image_id,
|
|
2402
|
+
class: "xcard__image",
|
|
2403
|
+
_src: this.resolveImage(),
|
|
2404
|
+
_alt: this.resolveImageAlt()
|
|
2405
|
+
},
|
|
2406
|
+
{
|
|
2407
|
+
_type: "view",
|
|
2408
|
+
class: "xcard__body",
|
|
2409
|
+
_children: [
|
|
2410
|
+
{
|
|
2411
|
+
_type: "label",
|
|
2412
|
+
_id: this.__title_id,
|
|
2413
|
+
class: "xcard__title",
|
|
2414
|
+
_text: ""
|
|
2415
|
+
},
|
|
2416
|
+
{
|
|
2417
|
+
_type: "label",
|
|
2418
|
+
_id: this.__text_id,
|
|
2419
|
+
class: "xcard__text",
|
|
2420
|
+
_text: ""
|
|
2421
|
+
},
|
|
2422
|
+
{
|
|
2423
|
+
_type: "link",
|
|
2424
|
+
_id: this.__link_id,
|
|
2425
|
+
class: "xcard__link dash-btn",
|
|
2426
|
+
_text: "",
|
|
2427
|
+
_href: ""
|
|
2428
|
+
},
|
|
2429
|
+
{
|
|
2430
|
+
_type: "view",
|
|
2431
|
+
_id: this.__actions_id,
|
|
2432
|
+
class: "xcard__actions",
|
|
2433
|
+
_children: this.__actions ? [...this.__actions] : []
|
|
2434
|
+
}
|
|
2435
|
+
]
|
|
2436
|
+
}
|
|
2437
|
+
]
|
|
2438
|
+
};
|
|
2439
|
+
this.append(t);
|
|
2440
|
+
}
|
|
2441
|
+
applyLayout() {
|
|
2442
|
+
const t = this.buildClassName();
|
|
2443
|
+
this.class = t;
|
|
2444
|
+
}
|
|
2445
|
+
applyText() {
|
|
2446
|
+
this.updateImage(), this.updateTitle(), this.updateText(), this.updateLink(), this.updateActions();
|
|
2447
|
+
}
|
|
2448
|
+
updateImage() {
|
|
2449
|
+
const t = n.getObject(this.__image_id);
|
|
2450
|
+
t && (t._src = this.resolveImage(), t._alt = this.resolveImageAlt());
|
|
2451
|
+
}
|
|
2452
|
+
updateTitle() {
|
|
2453
|
+
const t = n.getObject(this.__title_id);
|
|
2454
|
+
t && (t._text = this.resolveTitle());
|
|
2455
|
+
}
|
|
2456
|
+
updateText() {
|
|
2457
|
+
const t = n.getObject(this.__text_id);
|
|
2458
|
+
t && (t._text = this.resolveText());
|
|
2459
|
+
}
|
|
2460
|
+
updateLink() {
|
|
2461
|
+
const t = n.getObject(this.__link_id);
|
|
2462
|
+
t && (t._text = this.resolveLinkText(), t._href = this.resolveHref());
|
|
2463
|
+
}
|
|
2464
|
+
updateActions() {
|
|
2465
|
+
const t = n.getObject(this.__actions_id);
|
|
2466
|
+
if (!t) return;
|
|
2467
|
+
(Array.isArray(t._children) ? [...t._children] : []).forEach((e) => {
|
|
2468
|
+
e && t.removeChild(e, !0);
|
|
2469
|
+
}), this.__actions && this.__actions.length && this.__actions.forEach((e) => t.append(e));
|
|
2470
|
+
}
|
|
2471
|
+
set _image(t) {
|
|
2472
|
+
this.__image = t ? String(t) : void 0, this.updateImage();
|
|
2473
|
+
}
|
|
2474
|
+
get _image() {
|
|
2475
|
+
return this.__image;
|
|
2476
|
+
}
|
|
2477
|
+
set _image_alt(t) {
|
|
2478
|
+
this.__image_alt = t ? String(t) : void 0, this.updateImage();
|
|
2479
|
+
}
|
|
2480
|
+
get _image_alt() {
|
|
2481
|
+
return this.__image_alt;
|
|
2482
|
+
}
|
|
2483
|
+
set _title(t) {
|
|
2484
|
+
this.__title = t ? String(t) : void 0, this.updateTitle();
|
|
2485
|
+
}
|
|
2486
|
+
get _title() {
|
|
2487
|
+
return this.__title;
|
|
2488
|
+
}
|
|
2489
|
+
set _text(t) {
|
|
2490
|
+
this.__text = t ? String(t) : "", this.updateText();
|
|
2491
|
+
}
|
|
2492
|
+
get _text() {
|
|
2493
|
+
return this.__text;
|
|
2494
|
+
}
|
|
2495
|
+
set _href(t) {
|
|
2496
|
+
this.__href = t ? String(t) : void 0, this.updateLink();
|
|
2497
|
+
}
|
|
2498
|
+
get _href() {
|
|
2499
|
+
return this.__href;
|
|
2500
|
+
}
|
|
2501
|
+
set _link_text(t) {
|
|
2502
|
+
this.__link_text = t ? String(t) : void 0, this.updateLink();
|
|
2503
|
+
}
|
|
2504
|
+
get _link_text() {
|
|
2505
|
+
return this.__link_text;
|
|
2506
|
+
}
|
|
2507
|
+
set _actions(t) {
|
|
2508
|
+
this.__actions = Array.isArray(t) ? t : void 0, this.updateActions();
|
|
2509
|
+
}
|
|
2510
|
+
get _actions() {
|
|
2511
|
+
return this.__actions;
|
|
2512
|
+
}
|
|
2513
|
+
set _hide_image(t) {
|
|
2514
|
+
this.__hide_image = this.normalizeBoolean(t, !1), this.applyLayout();
|
|
2515
|
+
}
|
|
2516
|
+
get _hide_image() {
|
|
2517
|
+
return this.__hide_image;
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
class A extends a {
|
|
2521
|
+
static _xtype = "kpi-card";
|
|
2522
|
+
__label = "";
|
|
2523
|
+
__value = "";
|
|
2524
|
+
__delta = "";
|
|
2525
|
+
__delta_state = "flat";
|
|
2526
|
+
__icon = "";
|
|
2527
|
+
__label_placeholder = "KPI";
|
|
2528
|
+
__value_placeholder = "—";
|
|
2529
|
+
__delta_placeholder = "";
|
|
2530
|
+
__icon_placeholder = "";
|
|
2531
|
+
__icon_id;
|
|
2532
|
+
__label_id;
|
|
2533
|
+
__value_id;
|
|
2534
|
+
__delta_id;
|
|
2535
|
+
constructor(t) {
|
|
2536
|
+
const i = {
|
|
2537
|
+
_type: A._xtype,
|
|
2538
|
+
class: "xkpi-card",
|
|
2539
|
+
_html_tag: "div"
|
|
2540
|
+
};
|
|
2541
|
+
super(t, i, !0), this.__icon_id = this._id + "_icon", this.__label_id = this._id + "_label", this.__value_id = this._id + "_value", this.__delta_id = this._id + "_delta", this.parse(t), this.applyProps(), this.buildSkeleton(), this.applyLayout(), this.applyText();
|
|
2542
|
+
}
|
|
2543
|
+
normalizeState(t) {
|
|
2544
|
+
return t === "up" || t === "down" || t === "flat" ? t : "flat";
|
|
2545
|
+
}
|
|
2546
|
+
applyProps() {
|
|
2547
|
+
this.__label = this._label ? String(this._label) : "", this.__value = this._value ? String(this._value) : "", this.__delta = this._delta ? String(this._delta) : "", this.__delta_state = this.normalizeState(this._delta_state), this.__icon = this._icon ? String(this._icon) : "";
|
|
2548
|
+
}
|
|
2549
|
+
resolveLabel() {
|
|
2550
|
+
const t = this.__label.trim();
|
|
2551
|
+
return t || this.__label_placeholder;
|
|
2552
|
+
}
|
|
2553
|
+
resolveValue() {
|
|
2554
|
+
const t = this.__value.trim();
|
|
2555
|
+
return t || this.__value_placeholder;
|
|
2556
|
+
}
|
|
2557
|
+
resolveDelta() {
|
|
2558
|
+
const t = this.__delta.trim();
|
|
2559
|
+
return t || this.__delta_placeholder;
|
|
2560
|
+
}
|
|
2561
|
+
resolveIcon() {
|
|
2562
|
+
const t = this.__icon.trim();
|
|
2563
|
+
return t || this.__icon_placeholder;
|
|
2564
|
+
}
|
|
2565
|
+
splitClasses(t) {
|
|
2566
|
+
return t.split(/\s+/).map((i) => i.trim()).filter(Boolean);
|
|
2567
|
+
}
|
|
2568
|
+
buildClassName() {
|
|
2569
|
+
const t = String(this.class || ""), i = this.splitClasses(t).filter(
|
|
2570
|
+
(s) => s !== "xkpi-card" && s !== "xkpi-card--up" && s !== "xkpi-card--down" && s !== "xkpi-card--flat"
|
|
2571
|
+
), e = ["xkpi-card", `xkpi-card--${this.__delta_state}`, ...i];
|
|
2572
|
+
return Array.from(new Set(e.filter(Boolean))).join(" ");
|
|
2573
|
+
}
|
|
2574
|
+
buildSkeleton() {
|
|
2575
|
+
const t = {
|
|
2576
|
+
_type: "view",
|
|
2577
|
+
class: "kpi-body",
|
|
2578
|
+
_children: [
|
|
2579
|
+
{
|
|
2580
|
+
_type: "view",
|
|
2581
|
+
class: "kpi-top",
|
|
2582
|
+
_children: [
|
|
2583
|
+
{ _type: "label", _id: this.__icon_id, class: "kpi-icon", _text: "" },
|
|
2584
|
+
{ _type: "label", _id: this.__label_id, class: "kpi-label", _text: "" }
|
|
2585
|
+
]
|
|
2586
|
+
},
|
|
2587
|
+
{ _type: "label", _id: this.__value_id, class: "kpi-value", _text: "" },
|
|
2588
|
+
{
|
|
2589
|
+
_type: "label",
|
|
2590
|
+
_id: this.__delta_id,
|
|
2591
|
+
class: "kpi-delta kpi-delta--flat",
|
|
2592
|
+
_text: ""
|
|
2593
|
+
}
|
|
2594
|
+
]
|
|
2595
|
+
};
|
|
2596
|
+
this.append(t);
|
|
2597
|
+
}
|
|
2598
|
+
applyLayout() {
|
|
2599
|
+
const t = this.buildClassName();
|
|
2600
|
+
this.class = t;
|
|
2601
|
+
const i = n.getObject(this.__delta_id);
|
|
2602
|
+
i && typeof i.replaceClass == "function" ? i.replaceClass(
|
|
2603
|
+
"kpi-delta--up kpi-delta--down kpi-delta--flat",
|
|
2604
|
+
`kpi-delta--${this.__delta_state}`
|
|
2605
|
+
) : i && (i.class = `kpi-delta kpi-delta--${this.__delta_state}`);
|
|
2606
|
+
}
|
|
2607
|
+
applyText() {
|
|
2608
|
+
const t = n.getObject(this.__icon_id);
|
|
2609
|
+
t && (t._text = this.resolveIcon());
|
|
2610
|
+
const i = n.getObject(this.__label_id);
|
|
2611
|
+
i && (i._text = this.resolveLabel());
|
|
2612
|
+
const e = n.getObject(this.__value_id);
|
|
2613
|
+
e && (e._text = this.resolveValue());
|
|
2614
|
+
const s = n.getObject(this.__delta_id);
|
|
2615
|
+
s && (s._text = this.resolveDelta());
|
|
2616
|
+
}
|
|
2617
|
+
set _label(t) {
|
|
2618
|
+
this.__label = t ? String(t) : "", this.applyText();
|
|
2619
|
+
}
|
|
2620
|
+
get _label() {
|
|
2621
|
+
return this.__label;
|
|
2622
|
+
}
|
|
2623
|
+
set _value(t) {
|
|
2624
|
+
this.__value = t ? String(t) : "", this.applyText();
|
|
2625
|
+
}
|
|
2626
|
+
get _value() {
|
|
2627
|
+
return this.__value;
|
|
2628
|
+
}
|
|
2629
|
+
set _delta(t) {
|
|
2630
|
+
this.__delta = t ? String(t) : "", this.applyText();
|
|
2631
|
+
}
|
|
2632
|
+
get _delta() {
|
|
2633
|
+
return this.__delta;
|
|
2634
|
+
}
|
|
2635
|
+
set _delta_state(t) {
|
|
2636
|
+
this.__delta_state = this.normalizeState(t), this.applyLayout();
|
|
2637
|
+
}
|
|
2638
|
+
get _delta_state() {
|
|
2639
|
+
return this.__delta_state;
|
|
2640
|
+
}
|
|
2641
|
+
set _icon(t) {
|
|
2642
|
+
this.__icon = t ? String(t) : "", this.applyText();
|
|
2643
|
+
}
|
|
2644
|
+
get _icon() {
|
|
2645
|
+
return this.__icon;
|
|
2646
|
+
}
|
|
2647
|
+
}
|
|
2648
|
+
class B extends a {
|
|
2649
|
+
static _xtype = "grid";
|
|
2650
|
+
_cols;
|
|
2651
|
+
_gap;
|
|
2652
|
+
_min_col_width;
|
|
2653
|
+
constructor(t) {
|
|
2654
|
+
const i = {
|
|
2655
|
+
_type: B._xtype,
|
|
2656
|
+
class: "xgrid",
|
|
2657
|
+
_html_tag: "div"
|
|
2658
|
+
};
|
|
2659
|
+
super(t, i, !0), this.parse(t), this._cols && (this.style = `${this.style || ""}; --x-grid-cols:${this._cols}`), this._gap && (this.style = `${this.style || ""}; --x-grid-gap:${this._gap}px`), this._min_col_width && (this.style = `${this.style || ""}; --x-grid-min-col:${this._min_col_width}px`);
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
class j extends a {
|
|
2663
|
+
static _xtype = "section";
|
|
2664
|
+
__title = "";
|
|
2665
|
+
__subtitle = "";
|
|
2666
|
+
__actions = [];
|
|
2667
|
+
__body_children = [];
|
|
2668
|
+
__initializing = !0;
|
|
2669
|
+
__container_id;
|
|
2670
|
+
__header_id;
|
|
2671
|
+
__title_id;
|
|
2672
|
+
__subtitle_id;
|
|
2673
|
+
__actions_id;
|
|
2674
|
+
__body_id;
|
|
2675
|
+
constructor(t) {
|
|
2676
|
+
const i = {
|
|
2677
|
+
_type: j._xtype,
|
|
2678
|
+
class: "xsection",
|
|
2679
|
+
_html_tag: "section"
|
|
2680
|
+
}, e = Array.isArray(t._children) ? [...t._children] : [];
|
|
2681
|
+
Array.isArray(t._children) && (t._children = []), super(t, i, !0), this.__container_id = this._id + "_container", this.__header_id = this._id + "_header", this.__title_id = this._id + "_title", this.__subtitle_id = this._id + "_subtitle", this.__actions_id = this._id + "_actions", this.__body_id = this._id + "_body", this.parse(t), this.applyProps(), this.__body_children = e, this.buildSkeleton(), this.__initializing = !1;
|
|
2682
|
+
}
|
|
2683
|
+
normalizeActions(t) {
|
|
2684
|
+
return Array.isArray(t) ? t : [];
|
|
2685
|
+
}
|
|
2686
|
+
applyProps() {
|
|
2687
|
+
this.__title = this._title ? String(this._title) : "", this.__subtitle = this._subtitle ? String(this._subtitle) : "", this.__actions = this.normalizeActions(this._actions);
|
|
2688
|
+
}
|
|
2689
|
+
hasTitle() {
|
|
2690
|
+
return this.__title.trim().length > 0;
|
|
2691
|
+
}
|
|
2692
|
+
hasSubtitle() {
|
|
2693
|
+
return this.__subtitle.trim().length > 0;
|
|
2694
|
+
}
|
|
2695
|
+
hasActions() {
|
|
2696
|
+
return this.__actions.length > 0;
|
|
2697
|
+
}
|
|
2698
|
+
hasHeader() {
|
|
2699
|
+
return this.hasTitle() || this.hasSubtitle() || this.hasActions();
|
|
2700
|
+
}
|
|
2701
|
+
currentHeaderState() {
|
|
2702
|
+
return {
|
|
2703
|
+
title: this.__title.trim(),
|
|
2704
|
+
subtitle: this.__subtitle.trim(),
|
|
2705
|
+
actions: this.__actions
|
|
2706
|
+
};
|
|
2707
|
+
}
|
|
2708
|
+
buildHeader() {
|
|
2709
|
+
if (!this.hasHeader()) return null;
|
|
2710
|
+
const t = [];
|
|
2711
|
+
if (this.hasTitle() || this.hasSubtitle()) {
|
|
2712
|
+
const i = [];
|
|
2713
|
+
this.hasTitle() && i.push({
|
|
2714
|
+
_type: "label",
|
|
2715
|
+
_id: this.__title_id,
|
|
2716
|
+
_html_tag: "h2",
|
|
2717
|
+
class: "xsection__title",
|
|
2718
|
+
_text: this.__title.trim()
|
|
2719
|
+
}), this.hasSubtitle() && i.push({
|
|
2720
|
+
_type: "label",
|
|
2721
|
+
_id: this.__subtitle_id,
|
|
2722
|
+
_html_tag: "p",
|
|
2723
|
+
class: "xsection__subtitle",
|
|
2724
|
+
_text: this.__subtitle.trim()
|
|
2725
|
+
}), t.push({
|
|
2726
|
+
_type: "view",
|
|
2727
|
+
class: "xsection__headings",
|
|
2728
|
+
_children: i
|
|
2729
|
+
});
|
|
2730
|
+
}
|
|
2731
|
+
return this.hasActions() && t.push({
|
|
2732
|
+
_type: "view",
|
|
2733
|
+
_id: this.__actions_id,
|
|
2734
|
+
class: "xsection__actions",
|
|
2735
|
+
_children: this.__actions
|
|
2736
|
+
}), {
|
|
2737
|
+
_type: "view",
|
|
2738
|
+
_id: this.__header_id,
|
|
2739
|
+
class: "xsection__header",
|
|
2740
|
+
_children: t
|
|
2741
|
+
};
|
|
2742
|
+
}
|
|
2743
|
+
buildSkeleton() {
|
|
2744
|
+
const t = [], i = this.buildHeader();
|
|
2745
|
+
i && t.push(i), t.push({
|
|
2746
|
+
_type: "view",
|
|
2747
|
+
_id: this.__body_id,
|
|
2748
|
+
class: "xsection__body",
|
|
2749
|
+
_children: this.__body_children
|
|
2750
|
+
}), this.append({
|
|
2751
|
+
_type: "view",
|
|
2752
|
+
_id: this.__container_id,
|
|
2753
|
+
class: "xsection__container",
|
|
2754
|
+
_children: t
|
|
2755
|
+
});
|
|
2756
|
+
}
|
|
2757
|
+
rebuild() {
|
|
2758
|
+
const t = n.getObject(this.__container_id);
|
|
2759
|
+
t && typeof this.removeChild == "function" && this.removeChild(t, !0), this.buildSkeleton();
|
|
2760
|
+
}
|
|
2761
|
+
set _title(t) {
|
|
2762
|
+
const i = this.currentHeaderState();
|
|
2763
|
+
if (this.__title = t ? String(t) : "", this.__initializing) return;
|
|
2764
|
+
const e = this.hasHeader();
|
|
2765
|
+
if ((i.title.length > 0 || i.subtitle.length > 0 || i.actions.length > 0) !== e) {
|
|
2766
|
+
this.rebuild();
|
|
2767
|
+
return;
|
|
2768
|
+
}
|
|
2769
|
+
const _ = n.getObject(this.__title_id);
|
|
2770
|
+
_ ? _._text = this.__title.trim() : this.hasTitle() && this.rebuild();
|
|
2771
|
+
}
|
|
2772
|
+
get _title() {
|
|
2773
|
+
return this.__title;
|
|
2774
|
+
}
|
|
2775
|
+
set _subtitle(t) {
|
|
2776
|
+
const i = this.currentHeaderState();
|
|
2777
|
+
if (this.__subtitle = t ? String(t) : "", this.__initializing) return;
|
|
2778
|
+
const e = this.hasHeader();
|
|
2779
|
+
if ((i.title.length > 0 || i.subtitle.length > 0 || i.actions.length > 0) !== e) {
|
|
2780
|
+
this.rebuild();
|
|
2781
|
+
return;
|
|
2782
|
+
}
|
|
2783
|
+
const _ = n.getObject(this.__subtitle_id);
|
|
2784
|
+
_ ? _._text = this.__subtitle.trim() : this.hasSubtitle() && this.rebuild();
|
|
2785
|
+
}
|
|
2786
|
+
get _subtitle() {
|
|
2787
|
+
return this.__subtitle;
|
|
2788
|
+
}
|
|
2789
|
+
set _actions(t) {
|
|
2790
|
+
if (this.__initializing) {
|
|
2791
|
+
this.__actions = this.normalizeActions(t);
|
|
2792
|
+
return;
|
|
2793
|
+
}
|
|
2794
|
+
const i = this.hasHeader(), e = this.normalizeActions(t);
|
|
2795
|
+
this.__actions = e;
|
|
2796
|
+
const s = this.hasHeader();
|
|
2797
|
+
if (i !== s) {
|
|
2798
|
+
this.rebuild();
|
|
2799
|
+
return;
|
|
2800
|
+
}
|
|
2801
|
+
const _ = n.getObject(this.__actions_id);
|
|
2802
|
+
if (!_) {
|
|
2803
|
+
this.hasActions() && this.rebuild();
|
|
2804
|
+
return;
|
|
2805
|
+
}
|
|
2806
|
+
(Array.isArray(_._children) ? [..._._children] : []).forEach((l) => {
|
|
2807
|
+
l && _.removeChild(l, !0);
|
|
2808
|
+
}), this.__actions.forEach((l) => _.append(l));
|
|
2809
|
+
}
|
|
2810
|
+
get _actions() {
|
|
2811
|
+
return this.__actions;
|
|
2812
|
+
}
|
|
2813
|
+
}
|
|
2814
|
+
class D extends R {
|
|
2815
|
+
static getObjects() {
|
|
2816
|
+
return {
|
|
2817
|
+
[L._xtype]: L,
|
|
2818
|
+
[B._xtype]: B,
|
|
2819
|
+
[k._xtype]: k,
|
|
2820
|
+
[b._xtype]: b,
|
|
2821
|
+
[x._xtype]: x,
|
|
2822
|
+
[m._xtype]: m,
|
|
2823
|
+
[C._xtype]: C,
|
|
2824
|
+
[p._xtype]: p,
|
|
2825
|
+
[o._xtype]: o,
|
|
2826
|
+
[A._xtype]: A,
|
|
2827
|
+
[d._xtype]: d,
|
|
2828
|
+
[c._xtype]: c,
|
|
2829
|
+
[u._xtype]: u,
|
|
2830
|
+
[v._xtype]: v,
|
|
2831
|
+
[f._xtype]: f,
|
|
2832
|
+
[w._xtype]: w,
|
|
2833
|
+
[z._xtype]: z,
|
|
2834
|
+
[S._xtype]: S,
|
|
2835
|
+
[y._xtype]: y,
|
|
2836
|
+
[g._xtype]: g,
|
|
2837
|
+
[j._xtype]: j
|
|
2838
|
+
};
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
export {
|
|
2842
|
+
D as XDashPack,
|
|
2843
|
+
D as XDashboardPack
|
|
2844
|
+
};
|