dhx-react-suite 1.0.0
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/README.md +143 -0
- package/dist/dhx-react-suite.js +1171 -0
- package/dist/dhx-react-suite.js.map +1 -0
- package/dist/dhx-react-suite.umd.cjs +42 -0
- package/dist/dhx-react-suite.umd.cjs.map +1 -0
- package/dist/index.d.ts +551 -0
- package/package.json +75 -0
|
@@ -0,0 +1,1171 @@
|
|
|
1
|
+
import { jsxs as f, jsx as t, Fragment as Z } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as T, useState as z, useMemo as F, useRef as B, useCallback as H, createContext as ee, useContext as te } from "react";
|
|
3
|
+
import { Tooltip as re, Legend as ne, CartesianGrid as oe, XAxis as _, YAxis as X, BarChart as ie, Bar as ae, LineChart as le, Line as se, AreaChart as de, Area as ce, PieChart as pe, Pie as ue, Cell as he, RadarChart as xe, PolarGrid as ge, PolarAngleAxis as fe, Radar as ye, ScatterChart as be, Scatter as me, ResponsiveContainer as ve } from "recharts";
|
|
4
|
+
const e = {
|
|
5
|
+
primary: "#0288d1",
|
|
6
|
+
primaryDk: "#01579b",
|
|
7
|
+
primaryLt: "#e1f5fe",
|
|
8
|
+
success: "#43a047",
|
|
9
|
+
danger: "#e53935",
|
|
10
|
+
warning: "#fb8c00",
|
|
11
|
+
bg: "#f5f7fa",
|
|
12
|
+
surface: "#ffffff",
|
|
13
|
+
border: "#dde3ea",
|
|
14
|
+
borderDk: "#b0bec5",
|
|
15
|
+
text: "#3d4a5c",
|
|
16
|
+
textSec: "#6b7a8d",
|
|
17
|
+
textMut: "#9aa5b1",
|
|
18
|
+
shadow: "0 2px 8px rgba(0,0,0,.10)",
|
|
19
|
+
shadowLg: "0 8px 28px rgba(0,0,0,.14)",
|
|
20
|
+
r: "4px",
|
|
21
|
+
rMd: "8px",
|
|
22
|
+
font: "'Segoe UI', system-ui, -apple-system, sans-serif"
|
|
23
|
+
}, V = "dhx-react-styles";
|
|
24
|
+
function W() {
|
|
25
|
+
if (typeof document > "u" || document.getElementById(V)) return;
|
|
26
|
+
const r = document.createElement("style");
|
|
27
|
+
r.id = V, r.textContent = `
|
|
28
|
+
*,*::before,*::after{box-sizing:border-box}
|
|
29
|
+
.dhx{font-family:${e.font};font-size:14px;color:${e.text}}
|
|
30
|
+
.dhx *{box-sizing:border-box}
|
|
31
|
+
.dhx-scroll::-webkit-scrollbar{width:6px;height:6px}
|
|
32
|
+
.dhx-scroll::-webkit-scrollbar-track{background:${e.bg}}
|
|
33
|
+
.dhx-scroll::-webkit-scrollbar-thumb{background:${e.borderDk};border-radius:3px}
|
|
34
|
+
.dhx-scroll::-webkit-scrollbar-thumb:hover{background:${e.textMut}}
|
|
35
|
+
@keyframes dhx-fade{from{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}
|
|
36
|
+
@keyframes dhx-spin{to{transform:rotate(360deg)}}
|
|
37
|
+
@keyframes dhx-toast{from{opacity:0;transform:translateX(110%)}to{opacity:1;transform:translateX(0)}}
|
|
38
|
+
@keyframes dhx-pulse{0%,100%{opacity:1}50%{opacity:.5}}
|
|
39
|
+
.dhx-anim-fade{animation:dhx-fade .15s ease}
|
|
40
|
+
.dhx-btn{display:inline-flex;align-items:center;gap:5px;padding:0 12px;height:32px;border-radius:${e.r};border:1px solid transparent;cursor:pointer;font-size:13px;font-family:inherit;font-weight:500;transition:all .15s ease;outline:none;white-space:nowrap;user-select:none}
|
|
41
|
+
.dhx-btn:focus-visible{box-shadow:0 0 0 3px ${e.primary}33}
|
|
42
|
+
.dhx-btn-primary{background:${e.primary};color:#fff;border-color:${e.primary}}
|
|
43
|
+
.dhx-btn-primary:hover{background:${e.primaryDk};border-color:${e.primaryDk}}
|
|
44
|
+
.dhx-btn-secondary{background:${e.surface};color:${e.text};border-color:${e.border}}
|
|
45
|
+
.dhx-btn-secondary:hover{background:${e.bg};border-color:${e.borderDk}}
|
|
46
|
+
.dhx-btn-ghost{background:transparent;color:${e.textSec};border-color:transparent}
|
|
47
|
+
.dhx-btn-ghost:hover{background:${e.bg};color:${e.text}}
|
|
48
|
+
.dhx-btn-danger{background:${e.danger};color:#fff;border-color:${e.danger}}
|
|
49
|
+
.dhx-btn-danger:hover{background:#c62828;border-color:#c62828}
|
|
50
|
+
.dhx-btn:disabled{opacity:.45;cursor:not-allowed}
|
|
51
|
+
.dhx-input{width:100%;height:32px;padding:0 10px;border:1px solid ${e.border};border-radius:${e.r};font-size:13px;font-family:inherit;color:${e.text};background:${e.surface};outline:none;transition:border-color .15s}
|
|
52
|
+
.dhx-input:focus{border-color:${e.primary};box-shadow:0 0 0 3px ${e.primary}22}
|
|
53
|
+
.dhx-input:disabled{background:${e.bg};color:${e.textMut};cursor:not-allowed}
|
|
54
|
+
.dhx-input-wrap{position:relative;width:100%}
|
|
55
|
+
.dhx-input-wrap .dhx-input-icon{position:absolute;left:9px;top:50%;transform:translateY(-50%);color:${e.textMut};pointer-events:none}
|
|
56
|
+
.dhx-input-wrap .dhx-input--with-icon{padding-left:30px}
|
|
57
|
+
.dhx-label{display:block;font-size:12px;font-weight:600;color:${e.textSec};margin-bottom:5px;letter-spacing:.02em}
|
|
58
|
+
.dhx-form-group{margin-bottom:14px}
|
|
59
|
+
.dhx-card{background:${e.surface};border:1px solid ${e.border};border-radius:${e.rMd};box-shadow:${e.shadow}}
|
|
60
|
+
.dhx-card-padded{padding:16px}
|
|
61
|
+
.dhx-divider{border:none;border-top:1px solid ${e.border};margin:0}
|
|
62
|
+
.dhx-tag{display:inline-flex;align-items:center;gap:4px;padding:2px 8px;border-radius:20px;font-size:11px;font-weight:600}
|
|
63
|
+
.dhx-tag-primary{background:${e.primaryLt};color:${e.primaryDk}}
|
|
64
|
+
.dhx-tag-success{background:#e8f5e9;color:#1b5e20}
|
|
65
|
+
.dhx-tag-danger{background:#ffebee;color:#b71c1c}
|
|
66
|
+
.dhx-tag-warning{background:#fff3e0;color:#e65100}
|
|
67
|
+
`, document.head.appendChild(r);
|
|
68
|
+
}
|
|
69
|
+
const ke = {
|
|
70
|
+
sm: { height: 24, padding: "0 8px", fontSize: 12 },
|
|
71
|
+
md: {},
|
|
72
|
+
lg: { height: 38, padding: "0 18px", fontSize: 14 }
|
|
73
|
+
};
|
|
74
|
+
function We({
|
|
75
|
+
children: r,
|
|
76
|
+
variant: a = "primary",
|
|
77
|
+
size: g = "md",
|
|
78
|
+
icon: o,
|
|
79
|
+
disabled: s,
|
|
80
|
+
onClick: l,
|
|
81
|
+
style: c,
|
|
82
|
+
className: n = ""
|
|
83
|
+
}) {
|
|
84
|
+
return T(W, []), /* @__PURE__ */ f(
|
|
85
|
+
"button",
|
|
86
|
+
{
|
|
87
|
+
className: `dhx dhx-btn dhx-btn-${a} ${n}`,
|
|
88
|
+
style: { ...ke[g], ...c },
|
|
89
|
+
disabled: s,
|
|
90
|
+
onClick: l,
|
|
91
|
+
children: [
|
|
92
|
+
o && /* @__PURE__ */ t("span", { style: { fontSize: 16 }, children: o }),
|
|
93
|
+
r
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
function Ee({ items: r = [], style: a }) {
|
|
99
|
+
T(W, []);
|
|
100
|
+
const g = (o, s) => {
|
|
101
|
+
var c;
|
|
102
|
+
if (o.type === "separator")
|
|
103
|
+
return /* @__PURE__ */ t("div", { style: { width: 1, background: e.border, margin: "6px 4px", alignSelf: "stretch" } }, s);
|
|
104
|
+
if (o.type === "spacer")
|
|
105
|
+
return /* @__PURE__ */ t("div", { style: { flex: 1 } }, s);
|
|
106
|
+
if (o.type === "input")
|
|
107
|
+
return /* @__PURE__ */ f("div", { style: { display: "flex", alignItems: "center", gap: 6 }, children: [
|
|
108
|
+
o.label && /* @__PURE__ */ t("span", { style: { fontSize: 12, color: e.textSec, fontWeight: 500 }, children: o.label }),
|
|
109
|
+
/* @__PURE__ */ t(
|
|
110
|
+
"input",
|
|
111
|
+
{
|
|
112
|
+
className: "dhx dhx-input",
|
|
113
|
+
style: { width: o.width || 140, height: 28 },
|
|
114
|
+
placeholder: o.placeholder,
|
|
115
|
+
defaultValue: o.value,
|
|
116
|
+
onChange: (n) => {
|
|
117
|
+
var p;
|
|
118
|
+
return (p = o.onChange) == null ? void 0 : p.call(o, n.target.value);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
)
|
|
122
|
+
] }, s);
|
|
123
|
+
if (o.type === "select")
|
|
124
|
+
return /* @__PURE__ */ t(
|
|
125
|
+
"select",
|
|
126
|
+
{
|
|
127
|
+
className: "dhx dhx-input",
|
|
128
|
+
style: { width: o.width || 100, height: 28, cursor: "pointer" },
|
|
129
|
+
defaultValue: o.value,
|
|
130
|
+
onChange: (n) => {
|
|
131
|
+
var p;
|
|
132
|
+
return (p = o.onChange) == null ? void 0 : p.call(o, n.target.value);
|
|
133
|
+
},
|
|
134
|
+
children: (c = o.options) == null ? void 0 : c.map((n) => /* @__PURE__ */ t("option", { value: n.value, children: n.label }, n.value))
|
|
135
|
+
},
|
|
136
|
+
s
|
|
137
|
+
);
|
|
138
|
+
const l = o.active;
|
|
139
|
+
return /* @__PURE__ */ f(
|
|
140
|
+
"button",
|
|
141
|
+
{
|
|
142
|
+
className: `dhx dhx-btn ${l ? "dhx-btn-primary" : "dhx-btn-ghost"}`,
|
|
143
|
+
style: { height: 32, gap: 4, ...o.twoState && l ? { background: e.primaryLt, color: e.primary, borderColor: `${e.primary}66` } : {} },
|
|
144
|
+
disabled: o.disabled,
|
|
145
|
+
onClick: () => {
|
|
146
|
+
var n;
|
|
147
|
+
return (n = o.onClick) == null ? void 0 : n.call(o, o);
|
|
148
|
+
},
|
|
149
|
+
children: [
|
|
150
|
+
o.icon && /* @__PURE__ */ t("span", { style: { fontSize: 16 }, children: o.icon }),
|
|
151
|
+
o.text && /* @__PURE__ */ t("span", { children: o.text })
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
s
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
return /* @__PURE__ */ t("div", { className: "dhx", style: { display: "flex", alignItems: "center", gap: 2, padding: "4px 8px", background: e.surface, borderBottom: `1px solid ${e.border}`, minHeight: 44, flexWrap: "wrap", ...a }, children: r.map(g) });
|
|
158
|
+
}
|
|
159
|
+
function Ae({ items: r = [], width: a = 240, collapsed: g, onSelect: o, header: s, footer: l, style: c }) {
|
|
160
|
+
const [n, p] = z(g ?? !1), [m, d] = z(null), [h, i] = z({});
|
|
161
|
+
T(W, []);
|
|
162
|
+
const y = n ? 56 : a, $ = (v) => {
|
|
163
|
+
d(v.id), o == null || o(v);
|
|
164
|
+
}, S = (v, N = 0) => {
|
|
165
|
+
var M;
|
|
166
|
+
if (v.type === "separator") return /* @__PURE__ */ t("div", { style: { height: 1, background: e.border, margin: "6px 8px" } }, v.id);
|
|
167
|
+
if (v.type === "customHTML") return /* @__PURE__ */ t("div", { style: { padding: "8px 12px" }, dangerouslySetInnerHTML: { __html: v.html || "" } }, v.id);
|
|
168
|
+
const k = (((M = v.items) == null ? void 0 : M.length) ?? 0) > 0, u = h[v.id], x = m === v.id;
|
|
169
|
+
return /* @__PURE__ */ f("div", { children: [
|
|
170
|
+
/* @__PURE__ */ f(
|
|
171
|
+
"div",
|
|
172
|
+
{
|
|
173
|
+
onClick: () => {
|
|
174
|
+
k && i((D) => ({ ...D, [v.id]: !D[v.id] })), $(v);
|
|
175
|
+
},
|
|
176
|
+
style: { display: "flex", alignItems: "center", gap: 10, padding: `8px ${n ? "0px" : `${12 + N * 16}px`}`, cursor: "pointer", borderRadius: e.r, margin: "1px 6px", justifyContent: n ? "center" : "flex-start", transition: "all .15s", background: x ? e.primaryLt : "transparent", color: x ? e.primary : e.text, userSelect: "none" },
|
|
177
|
+
onMouseEnter: (D) => !x && (D.currentTarget.style.background = e.bg),
|
|
178
|
+
onMouseLeave: (D) => !x && (D.currentTarget.style.background = "transparent"),
|
|
179
|
+
children: [
|
|
180
|
+
v.icon && /* @__PURE__ */ t("span", { style: { fontSize: 18, minWidth: 22, textAlign: "center" }, children: v.icon }),
|
|
181
|
+
!n && /* @__PURE__ */ t("span", { style: { flex: 1, fontSize: 13, fontWeight: x ? 600 : 400 }, children: v.value }),
|
|
182
|
+
!n && v.count !== void 0 && /* @__PURE__ */ t("span", { style: { background: e.primary, color: "#fff", borderRadius: 10, padding: "1px 6px", fontSize: 11, fontWeight: 700 }, children: v.count }),
|
|
183
|
+
!n && k && /* @__PURE__ */ t("span", { style: { fontSize: 12, color: e.textMut, transition: "transform .15s", transform: u ? "rotate(90deg)" : "rotate(0deg)" }, children: "▶" })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
),
|
|
187
|
+
k && u && !n && v.items.map((D) => S(D, N + 1))
|
|
188
|
+
] }, v.id);
|
|
189
|
+
};
|
|
190
|
+
return /* @__PURE__ */ f("div", { className: "dhx", style: { width: y, minWidth: y, background: e.surface, borderRight: `1px solid ${e.border}`, display: "flex", flexDirection: "column", transition: "width .2s ease", overflow: "hidden", ...c }, children: [
|
|
191
|
+
s && !n && /* @__PURE__ */ t("div", { style: { padding: "12px 14px", borderBottom: `1px solid ${e.border}`, fontWeight: 700, fontSize: 15 }, children: s }),
|
|
192
|
+
/* @__PURE__ */ t("button", { onClick: () => p((v) => !v), style: { margin: "8px 6px", background: "transparent", border: "none", cursor: "pointer", display: "flex", alignItems: "center", justifyContent: n ? "center" : "flex-end", padding: "4px 6px", borderRadius: e.r, color: e.textSec }, children: /* @__PURE__ */ t("span", { style: { fontSize: 18 }, children: n ? "☰" : "✕" }) }),
|
|
193
|
+
/* @__PURE__ */ t("div", { className: "dhx-scroll", style: { flex: 1, overflowY: "auto", overflowX: "hidden" }, children: r.map((v) => S(v)) }),
|
|
194
|
+
l && !n && /* @__PURE__ */ t("div", { style: { padding: "10px 14px", borderTop: `1px solid ${e.border}` }, children: l })
|
|
195
|
+
] });
|
|
196
|
+
}
|
|
197
|
+
function we({ config: r }) {
|
|
198
|
+
const [a, g] = z(!1), o = {
|
|
199
|
+
position: "relative",
|
|
200
|
+
background: e.surface,
|
|
201
|
+
border: `1px solid ${e.border}`,
|
|
202
|
+
borderRadius: e.r,
|
|
203
|
+
overflow: "hidden",
|
|
204
|
+
...r.width ? { width: r.width, minWidth: r.width } : { flex: 1 },
|
|
205
|
+
...r.height ? { height: r.height, minHeight: r.height } : { minHeight: 40 },
|
|
206
|
+
...a ? { flex: "0 0 auto" } : {}
|
|
207
|
+
};
|
|
208
|
+
return /* @__PURE__ */ f("div", { style: o, children: [
|
|
209
|
+
r.header && /* @__PURE__ */ f("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "6px 12px", background: e.bg, borderBottom: `1px solid ${e.border}`, fontSize: 12, fontWeight: 600, color: e.textSec, userSelect: "none" }, children: [
|
|
210
|
+
/* @__PURE__ */ t("span", { children: r.header }),
|
|
211
|
+
r.collapsable && /* @__PURE__ */ t("button", { onClick: () => g((s) => !s), style: { background: "none", border: "none", cursor: "pointer", color: e.textMut, fontSize: 16, lineHeight: 1 }, children: a ? "▼" : "▲" })
|
|
212
|
+
] }),
|
|
213
|
+
!a && /* @__PURE__ */ f("div", { style: { padding: r.padding || 0, height: r.header ? "calc(100% - 33px)" : "100%", overflow: "auto" }, children: [
|
|
214
|
+
r.html ? /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: r.html } }) : r.content,
|
|
215
|
+
(r.rows || r.cols) && /* @__PURE__ */ t(Se, { rows: r.rows, cols: r.cols, style: { height: "100%" } })
|
|
216
|
+
] })
|
|
217
|
+
] });
|
|
218
|
+
}
|
|
219
|
+
function Se({ rows: r, cols: a, type: g = "line", style: o, children: s }) {
|
|
220
|
+
T(W, []);
|
|
221
|
+
const l = g === "space" ? 12 : g === "wide" ? 8 : 1, c = r || a, n = !!r;
|
|
222
|
+
return c ? /* @__PURE__ */ t("div", { className: "dhx", style: { display: "flex", flexDirection: n ? "column" : "row", gap: l, width: "100%", height: "100%", ...o }, children: c.map((p, m) => /* @__PURE__ */ t(we, { config: p }, p.id || m)) }) : /* @__PURE__ */ t("div", { className: "dhx", style: { width: "100%", height: "100%", ...o }, children: s });
|
|
223
|
+
}
|
|
224
|
+
function He({ views: r = [], mode: a = "top", tabAlign: g = "left", closable: o = [], disabled: s = [], defaultActive: l, onBeforeChange: c, onChange: n, style: p }) {
|
|
225
|
+
var x;
|
|
226
|
+
const [m, d] = z(l || ((x = r[0]) == null ? void 0 : x.id)), [h, i] = z(r.map((M) => M.id));
|
|
227
|
+
T(W, []);
|
|
228
|
+
const y = (M, D) => {
|
|
229
|
+
M.stopPropagation(), i((b) => b.filter((C) => C !== D)), m === D && d(h.find((b) => b !== D) ?? "");
|
|
230
|
+
}, $ = (M) => {
|
|
231
|
+
s.includes(M) || c && c(M) === !1 || (d(M), n == null || n(M));
|
|
232
|
+
}, S = a === "left" || a === "right", v = r.filter((M) => h.includes(M.id)), N = /* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: S ? "column" : "row", justifyContent: g === "center" ? "center" : g === "right" ? "flex-end" : "flex-start", background: e.surface, borderBottom: !S && a !== "bottom" ? `2px solid ${e.border}` : "none", borderTop: a === "bottom" ? `2px solid ${e.border}` : "none", borderRight: a === "left" ? `2px solid ${e.border}` : "none", borderLeft: a === "right" ? `2px solid ${e.border}` : "none", overflowX: "auto", flexShrink: 0 }, children: v.map((M) => {
|
|
233
|
+
const D = m === M.id, b = s.includes(M.id), C = a === "bottom" ? { borderTop: `2px solid ${e.primary}`, color: e.primary, fontWeight: 600 } : S ? { color: e.primary, fontWeight: 600, background: e.primaryLt, [a === "left" ? "borderRight" : "borderLeft"]: `2px solid ${e.primary}` } : { borderBottom: `2px solid ${e.primary}`, color: e.primary, fontWeight: 600 };
|
|
234
|
+
return /* @__PURE__ */ f(
|
|
235
|
+
"div",
|
|
236
|
+
{
|
|
237
|
+
onClick: () => $(M.id),
|
|
238
|
+
style: { display: "flex", alignItems: "center", gap: 6, padding: "10px 16px", cursor: b ? "not-allowed" : "pointer", whiteSpace: "nowrap", fontSize: 13, transition: "color .15s", userSelect: "none", minWidth: S ? 120 : "auto", ...D ? C : { color: b ? e.textMut : e.textSec } },
|
|
239
|
+
children: [
|
|
240
|
+
M.icon && /* @__PURE__ */ t("span", { style: { fontSize: 16 }, children: M.icon }),
|
|
241
|
+
/* @__PURE__ */ t("span", { children: M.tab }),
|
|
242
|
+
o.includes(M.id) && /* @__PURE__ */ t("span", { onClick: (w) => y(w, M.id), style: { marginLeft: 4, opacity: 0.6, fontSize: 12, cursor: "pointer" }, children: "✕" })
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
M.id
|
|
246
|
+
);
|
|
247
|
+
}) }), k = v.find((M) => M.id === m), u = /* @__PURE__ */ f("div", { className: "dhx-scroll", style: { flex: 1, overflow: "auto" }, children: [
|
|
248
|
+
k == null ? void 0 : k.content,
|
|
249
|
+
(k == null ? void 0 : k.html) && /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: k.html }, style: { padding: 16 } })
|
|
250
|
+
] });
|
|
251
|
+
return /* @__PURE__ */ f("div", { className: "dhx", style: { display: "flex", flexDirection: a === "top" ? "column" : a === "bottom" ? "column-reverse" : a === "left" ? "row" : "row-reverse", width: "100%", height: "100%", background: e.surface, border: `1px solid ${e.border}`, borderRadius: e.r, overflow: "hidden", ...p }, children: [
|
|
252
|
+
N,
|
|
253
|
+
u
|
|
254
|
+
] });
|
|
255
|
+
}
|
|
256
|
+
function Be({ columns: r, data: a = [], height: g = 400, rowHeight: o = 40, sortable: s = !0, resizable: l = !0, selection: c, multiselect: n, onSelect: p, style: m }) {
|
|
257
|
+
const [d, h] = z(null), [i, y] = z("asc"), [$, S] = z({}), [v, N] = z(/* @__PURE__ */ new Set()), [k, u] = z(r.map((w) => w.width || w.minWidth || 140));
|
|
258
|
+
T(W, []);
|
|
259
|
+
const x = F(() => {
|
|
260
|
+
let w = a.filter(
|
|
261
|
+
(L) => Object.entries($).every(([E, I]) => !I || String(L[E] ?? "").toLowerCase().includes(I.toLowerCase()))
|
|
262
|
+
);
|
|
263
|
+
return d && (w = [...w].sort((L, E) => {
|
|
264
|
+
const I = L[d], R = E[d];
|
|
265
|
+
return I == null ? 1 : R == null ? -1 : i === "asc" ? I < R ? -1 : I > R ? 1 : 0 : I > R ? -1 : I < R ? 1 : 0;
|
|
266
|
+
})), w;
|
|
267
|
+
}, [a, d, i, $]), M = (w) => {
|
|
268
|
+
!s || w.sortable === !1 || (y((L) => d === w.id && L === "asc" ? "desc" : "asc"), h(w.id));
|
|
269
|
+
}, D = (w, L) => {
|
|
270
|
+
if (!c) return;
|
|
271
|
+
const E = w.id ?? L;
|
|
272
|
+
N((I) => {
|
|
273
|
+
const R = n ? new Set(I) : /* @__PURE__ */ new Set();
|
|
274
|
+
return R.has(E) ? R.delete(E) : R.add(E), R;
|
|
275
|
+
}), p == null || p(w);
|
|
276
|
+
}, b = (w, L) => {
|
|
277
|
+
const E = w.clientX, I = k[L], R = (U) => u((Q) => {
|
|
278
|
+
const K = [...Q];
|
|
279
|
+
return K[L] = Math.max(60, I + U.clientX - E), K;
|
|
280
|
+
}), j = () => {
|
|
281
|
+
document.removeEventListener("mousemove", R), document.removeEventListener("mouseup", j);
|
|
282
|
+
};
|
|
283
|
+
document.addEventListener("mousemove", R), document.addEventListener("mouseup", j), w.preventDefault();
|
|
284
|
+
}, C = r.some((w) => w.filterable !== !1);
|
|
285
|
+
return /* @__PURE__ */ t("div", { className: "dhx", style: { width: "100%", height: g, display: "flex", flexDirection: "column", border: `1px solid ${e.border}`, borderRadius: e.r, overflow: "hidden", ...m }, children: /* @__PURE__ */ t("div", { style: { overflowX: "auto", flex: 1, display: "flex", flexDirection: "column" }, children: /* @__PURE__ */ f("div", { style: { minWidth: k.reduce((w, L) => w + L, 0) + "px", display: "flex", flexDirection: "column", height: "100%" }, children: [
|
|
286
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", background: e.bg, borderBottom: `1px solid ${e.border}`, position: "sticky", top: 0, zIndex: 2 }, children: r.map((w, L) => {
|
|
287
|
+
var E;
|
|
288
|
+
return /* @__PURE__ */ f(
|
|
289
|
+
"div",
|
|
290
|
+
{
|
|
291
|
+
style: { width: k[L], minWidth: k[L], position: "relative", padding: "0 10px", height: 40, display: "flex", alignItems: "center", fontSize: 12, fontWeight: 600, color: e.textSec, cursor: s && w.sortable !== !1 ? "pointer" : "default", userSelect: "none", gap: 4 },
|
|
292
|
+
onClick: () => M(w),
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ t("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: Array.isArray(w.header) ? (E = w.header[0]) == null ? void 0 : E.text : w.header || w.id }),
|
|
295
|
+
s && w.sortable !== !1 && /* @__PURE__ */ t("span", { style: { opacity: d === w.id ? 1 : 0.25, fontSize: 10 }, children: d === w.id ? i === "asc" ? "▲" : "▼" : "⇅" }),
|
|
296
|
+
l && L < r.length - 1 && /* @__PURE__ */ t(
|
|
297
|
+
"div",
|
|
298
|
+
{
|
|
299
|
+
onMouseDown: (I) => b(I, L),
|
|
300
|
+
style: { position: "absolute", right: 0, top: 4, bottom: 4, width: 4, cursor: "col-resize", background: "transparent" },
|
|
301
|
+
onMouseEnter: (I) => I.currentTarget.style.background = e.border,
|
|
302
|
+
onMouseLeave: (I) => I.currentTarget.style.background = "transparent"
|
|
303
|
+
}
|
|
304
|
+
)
|
|
305
|
+
]
|
|
306
|
+
},
|
|
307
|
+
w.id
|
|
308
|
+
);
|
|
309
|
+
}) }),
|
|
310
|
+
C && /* @__PURE__ */ t("div", { style: { display: "flex", borderBottom: `1px solid ${e.border}`, background: e.surface }, children: r.map((w, L) => /* @__PURE__ */ t("div", { style: { width: k[L], minWidth: k[L], padding: "4px 6px" }, children: w.filterable !== !1 && /* @__PURE__ */ t("input", { className: "dhx dhx-input", style: { height: 24, fontSize: 12 }, placeholder: "🔍", value: $[w.id] || "", onChange: (E) => S((I) => ({ ...I, [w.id]: E.target.value })) }) }, w.id)) }),
|
|
311
|
+
/* @__PURE__ */ f("div", { className: "dhx-scroll", style: { flex: 1, overflowY: "auto" }, children: [
|
|
312
|
+
x.map((w, L) => {
|
|
313
|
+
const E = w.id ?? L, I = v.has(E);
|
|
314
|
+
return /* @__PURE__ */ t(
|
|
315
|
+
"div",
|
|
316
|
+
{
|
|
317
|
+
onClick: () => D(w, L),
|
|
318
|
+
style: { display: "flex", height: o, alignItems: "center", borderBottom: `1px solid ${e.border}`, cursor: c ? "pointer" : "default", background: I ? e.primaryLt : L % 2 === 0 ? e.surface : e.bg, transition: "background .1s" },
|
|
319
|
+
onMouseEnter: (R) => !I && (R.currentTarget.style.background = "#f0f8ff"),
|
|
320
|
+
onMouseLeave: (R) => !I && (R.currentTarget.style.background = L % 2 === 0 ? e.surface : e.bg),
|
|
321
|
+
children: r.map((R, j) => /* @__PURE__ */ t("div", { style: { width: k[j], minWidth: k[j], padding: "0 10px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", fontSize: 13, textAlign: R.align || "left" }, children: R.template ? R.template(w[R.id], w) : String(w[R.id] ?? "") }, R.id))
|
|
322
|
+
},
|
|
323
|
+
String(E)
|
|
324
|
+
);
|
|
325
|
+
}),
|
|
326
|
+
x.length === 0 && /* @__PURE__ */ t("div", { style: { textAlign: "center", padding: 40, color: e.textMut }, children: "No data" })
|
|
327
|
+
] })
|
|
328
|
+
] }) }) });
|
|
329
|
+
}
|
|
330
|
+
const A = ["#0288d1", "#43a047", "#f57c00", "#e53935", "#8e24aa", "#00838f", "#ef6c00", "#2e7d32"];
|
|
331
|
+
function je({ type: r = "bar", data: a = [], series: g = [], scales: o = {}, legend: s, height: l = 280, style: c }) {
|
|
332
|
+
var S, v, N, k, u;
|
|
333
|
+
T(W, []);
|
|
334
|
+
const n = ((S = o.bottom) == null ? void 0 : S.text) || a[0] && Object.keys(a[0])[0] || "x", p = /* @__PURE__ */ t(re, { contentStyle: { fontSize: 12, borderRadius: e.r, border: `1px solid ${e.border}` } }), m = s ? /* @__PURE__ */ t(ne, { iconSize: 10, wrapperStyle: { fontSize: 12 }, verticalAlign: s.valign, align: s.halign }) : null, d = /* @__PURE__ */ t(oe, { strokeDasharray: "3 3", stroke: e.border }), h = /* @__PURE__ */ t(_, { dataKey: n, tick: { fontSize: 11, fill: e.textSec }, axisLine: { stroke: e.border }, tickLine: !1 }), i = /* @__PURE__ */ t(X, { tick: { fontSize: 11, fill: e.textSec }, axisLine: !1, tickLine: !1, domain: [((v = o.left) == null ? void 0 : v.min) ?? "auto", ((N = o.left) == null ? void 0 : N.max) ?? "auto"] }), y = { data: a, margin: { top: 10, right: 20, left: 0, bottom: 0 } };
|
|
335
|
+
let $;
|
|
336
|
+
if (r === "bar")
|
|
337
|
+
$ = /* @__PURE__ */ f(ie, { ...y, children: [
|
|
338
|
+
d,
|
|
339
|
+
h,
|
|
340
|
+
i,
|
|
341
|
+
p,
|
|
342
|
+
m,
|
|
343
|
+
g.map((x, M) => /* @__PURE__ */ t(ae, { dataKey: x.value || x.id, name: x.label || x.id, fill: x.fill || A[M % A.length], radius: [3, 3, 0, 0] }, x.id))
|
|
344
|
+
] });
|
|
345
|
+
else if (r === "line")
|
|
346
|
+
$ = /* @__PURE__ */ f(le, { ...y, children: [
|
|
347
|
+
d,
|
|
348
|
+
h,
|
|
349
|
+
i,
|
|
350
|
+
p,
|
|
351
|
+
m,
|
|
352
|
+
g.map((x, M) => /* @__PURE__ */ t(se, { type: "monotone", dataKey: x.value || x.id, name: x.label || x.id, stroke: x.color || A[M % A.length], strokeWidth: 2, dot: { r: 3, fill: x.color || A[M % A.length] } }, x.id))
|
|
353
|
+
] });
|
|
354
|
+
else if (r === "area")
|
|
355
|
+
$ = /* @__PURE__ */ f(de, { ...y, children: [
|
|
356
|
+
d,
|
|
357
|
+
h,
|
|
358
|
+
i,
|
|
359
|
+
p,
|
|
360
|
+
m,
|
|
361
|
+
g.map((x, M) => /* @__PURE__ */ t(ce, { type: "monotone", dataKey: x.value || x.id, name: x.label || x.id, stroke: x.color || A[M % A.length], fill: (x.fill || A[M % A.length]) + "33", strokeWidth: 2 }, x.id))
|
|
362
|
+
] });
|
|
363
|
+
else if (r === "pie" || r === "donut") {
|
|
364
|
+
const x = a[0] || {}, M = Object.keys(x).find((b) => typeof x[b] == "number") || "value", D = Object.keys(x).find((b) => typeof x[b] == "string") || "x";
|
|
365
|
+
$ = /* @__PURE__ */ f(pe, { children: [
|
|
366
|
+
/* @__PURE__ */ t(
|
|
367
|
+
ue,
|
|
368
|
+
{
|
|
369
|
+
data: a,
|
|
370
|
+
cx: "50%",
|
|
371
|
+
cy: "50%",
|
|
372
|
+
outerRadius: r === "donut" ? "70%" : "80%",
|
|
373
|
+
innerRadius: r === "donut" ? "40%" : 0,
|
|
374
|
+
dataKey: M,
|
|
375
|
+
nameKey: D,
|
|
376
|
+
label: ({ name: b, percent: C }) => `${b ?? ""} ${((C ?? 0) * 100).toFixed(0)}%`,
|
|
377
|
+
labelLine: !0,
|
|
378
|
+
paddingAngle: 2,
|
|
379
|
+
children: a.map((b, C) => /* @__PURE__ */ t(he, { fill: A[C % A.length] }, C))
|
|
380
|
+
}
|
|
381
|
+
),
|
|
382
|
+
p,
|
|
383
|
+
m
|
|
384
|
+
] });
|
|
385
|
+
} else r === "radar" ? $ = /* @__PURE__ */ f(xe, { ...y, cx: "50%", cy: "50%", children: [
|
|
386
|
+
/* @__PURE__ */ t(ge, {}),
|
|
387
|
+
/* @__PURE__ */ t(fe, { dataKey: n, tick: { fontSize: 11 } }),
|
|
388
|
+
g.map((x, M) => /* @__PURE__ */ t(ye, { dataKey: x.value || x.id, name: x.label || x.id, stroke: x.color || A[M], fill: (x.fill || A[M]) + "44" }, x.id)),
|
|
389
|
+
p,
|
|
390
|
+
m
|
|
391
|
+
] }) : r === "scatter" && ($ = /* @__PURE__ */ f(be, { ...y, children: [
|
|
392
|
+
d,
|
|
393
|
+
/* @__PURE__ */ t(_, { dataKey: ((k = g[0]) == null ? void 0 : k.xValue) || "x", type: "number", tick: { fontSize: 11, fill: e.textSec } }),
|
|
394
|
+
/* @__PURE__ */ t(X, { dataKey: ((u = g[0]) == null ? void 0 : u.yValue) || "y", tick: { fontSize: 11, fill: e.textSec } }),
|
|
395
|
+
p,
|
|
396
|
+
g.map((x, M) => /* @__PURE__ */ t(me, { data: x.data || a, name: x.label || x.id, fill: x.color || A[M] }, x.id))
|
|
397
|
+
] }));
|
|
398
|
+
return /* @__PURE__ */ t("div", { className: "dhx", style: { width: "100%", height: l, padding: 12, background: e.surface, borderRadius: e.rMd, ...c }, children: /* @__PURE__ */ t(ve, { width: "100%", height: "100%", children: $ }) });
|
|
399
|
+
}
|
|
400
|
+
const Me = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], $e = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
|
|
401
|
+
function Ye({ value: r, range: a = !1, timepicker: g = !1, onChange: o, style: s }) {
|
|
402
|
+
const l = /* @__PURE__ */ new Date(), c = r ? new Date(Array.isArray(r) ? r[0] : r) : l, [n, p] = z(c), [m, d] = z(r ?? (a ? [null, null] : null)), [h, i] = z(null), [y, $] = z({ h: 0, m: 0 });
|
|
403
|
+
T(W, []);
|
|
404
|
+
const S = n.getFullYear(), v = n.getMonth(), N = new Date(S, v, 1).getDay(), k = new Date(S, v + 1, 0).getDate(), u = [];
|
|
405
|
+
for (let b = 0; b < N; b++) u.push(null);
|
|
406
|
+
for (let b = 1; b <= k; b++) u.push(new Date(S, v, b));
|
|
407
|
+
const x = (b) => b.toDateString() === l.toDateString(), M = (b) => {
|
|
408
|
+
if (!m) return !1;
|
|
409
|
+
if (a && Array.isArray(m)) {
|
|
410
|
+
const [C, w] = m;
|
|
411
|
+
if (!C) return !1;
|
|
412
|
+
const L = b.getTime();
|
|
413
|
+
return w ? L >= C.getTime() && L <= w.getTime() : b.toDateString() === C.toDateString();
|
|
414
|
+
}
|
|
415
|
+
return b.toDateString() === m.toDateString();
|
|
416
|
+
}, D = (b) => {
|
|
417
|
+
if (a) {
|
|
418
|
+
const [C, w] = Array.isArray(m) ? m : [null, null];
|
|
419
|
+
if (!C || w)
|
|
420
|
+
d([b, null]);
|
|
421
|
+
else {
|
|
422
|
+
const L = b < C ? [b, C] : [C, b];
|
|
423
|
+
d(L), o == null || o(L);
|
|
424
|
+
}
|
|
425
|
+
} else
|
|
426
|
+
d(b), o == null || o(b);
|
|
427
|
+
};
|
|
428
|
+
return /* @__PURE__ */ f("div", { className: "dhx", style: { background: e.surface, border: `1px solid ${e.border}`, borderRadius: e.rMd, padding: 16, display: "inline-block", boxShadow: e.shadow, ...s }, children: [
|
|
429
|
+
/* @__PURE__ */ f("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", marginBottom: 12 }, children: [
|
|
430
|
+
/* @__PURE__ */ t("button", { onClick: () => p((b) => new Date(b.getFullYear(), b.getMonth() - 1, 1)), className: "dhx dhx-btn dhx-btn-ghost", style: { height: 28, padding: "0 8px", fontSize: 16 }, children: "‹" }),
|
|
431
|
+
/* @__PURE__ */ f("div", { style: { fontWeight: 700, fontSize: 14 }, children: [
|
|
432
|
+
Me[v],
|
|
433
|
+
" ",
|
|
434
|
+
S
|
|
435
|
+
] }),
|
|
436
|
+
/* @__PURE__ */ t("button", { onClick: () => p((b) => new Date(b.getFullYear(), b.getMonth() + 1, 1)), className: "dhx dhx-btn dhx-btn-ghost", style: { height: 28, padding: "0 8px", fontSize: 16 }, children: "›" })
|
|
437
|
+
] }),
|
|
438
|
+
/* @__PURE__ */ f("div", { style: { display: "grid", gridTemplateColumns: "repeat(7, 32px)", gap: 2 }, children: [
|
|
439
|
+
$e.map((b) => /* @__PURE__ */ t("div", { style: { textAlign: "center", fontSize: 11, fontWeight: 600, color: e.textMut, paddingBottom: 4 }, children: b }, b)),
|
|
440
|
+
u.map((b, C) => {
|
|
441
|
+
const w = b ? M(b) : !1, L = b && h && b.toDateString() === h.toDateString();
|
|
442
|
+
return /* @__PURE__ */ t(
|
|
443
|
+
"div",
|
|
444
|
+
{
|
|
445
|
+
onClick: () => b && D(b),
|
|
446
|
+
onMouseEnter: () => b && i(b),
|
|
447
|
+
onMouseLeave: () => i(null),
|
|
448
|
+
style: { width: 32, height: 32, display: "flex", alignItems: "center", justifyContent: "center", borderRadius: e.r, cursor: b ? "pointer" : "default", fontSize: 12, fontWeight: b && x(b) ? 700 : 400, background: w ? e.primary : L ? e.bg : "transparent", color: w ? "#fff" : b && x(b) ? e.primary : b ? e.text : "transparent", border: b && x(b) && !w ? `1px solid ${e.primary}` : "1px solid transparent", transition: "all .1s" },
|
|
449
|
+
children: b == null ? void 0 : b.getDate()
|
|
450
|
+
},
|
|
451
|
+
C
|
|
452
|
+
);
|
|
453
|
+
})
|
|
454
|
+
] }),
|
|
455
|
+
g && /* @__PURE__ */ f("div", { style: { borderTop: `1px solid ${e.border}`, marginTop: 12, paddingTop: 12, display: "flex", alignItems: "center", justifyContent: "center", gap: 8 }, children: [
|
|
456
|
+
/* @__PURE__ */ t("input", { type: "number", min: 0, max: 23, value: y.h, onChange: (b) => $((C) => ({ ...C, h: +b.target.value })), className: "dhx dhx-input", style: { width: 50, textAlign: "center" } }),
|
|
457
|
+
/* @__PURE__ */ t("span", { style: { fontWeight: 700, color: e.textSec }, children: ":" }),
|
|
458
|
+
/* @__PURE__ */ t("input", { type: "number", min: 0, max: 59, value: y.m, onChange: (b) => $((C) => ({ ...C, m: +b.target.value })), className: "dhx dhx-input", style: { width: 50, textAlign: "center" } })
|
|
459
|
+
] })
|
|
460
|
+
] });
|
|
461
|
+
}
|
|
462
|
+
function Oe({ value: r, onChange: a, style: g }) {
|
|
463
|
+
const [o, s] = z((r == null ? void 0 : r.h) ?? 12), [l, c] = z((r == null ? void 0 : r.m) ?? 0), [n, p] = z((r == null ? void 0 : r.ampm) ?? "AM");
|
|
464
|
+
T(W, []);
|
|
465
|
+
const m = Array.from({ length: 12 }, (h, i) => i + 1), d = Array.from({ length: 12 }, (h, i) => i * 5);
|
|
466
|
+
return /* @__PURE__ */ f("div", { className: "dhx", style: { background: e.surface, border: `1px solid ${e.border}`, borderRadius: e.rMd, padding: 16, display: "inline-block", boxShadow: e.shadow, ...g }, children: [
|
|
467
|
+
/* @__PURE__ */ f("div", { style: { display: "flex", gap: 8, alignItems: "stretch" }, children: [
|
|
468
|
+
[{ label: "Hours", values: m, val: o, setFn: s }, { label: "Minutes", values: d, val: l, setFn: c }].map(({ label: h, values: i, val: y, setFn: $ }) => /* @__PURE__ */ f("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", gap: 4 }, children: [
|
|
469
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 11, fontWeight: 600, color: e.textMut }, children: h }),
|
|
470
|
+
/* @__PURE__ */ t("div", { className: "dhx-scroll", style: { height: 160, overflowY: "auto", width: 48, border: `1px solid ${e.border}`, borderRadius: e.r }, children: i.map((S) => /* @__PURE__ */ t(
|
|
471
|
+
"div",
|
|
472
|
+
{
|
|
473
|
+
onClick: () => {
|
|
474
|
+
$(S), a == null || a({ h: h === "Hours" ? S : o, m: h === "Minutes" ? S : l, ampm: n });
|
|
475
|
+
},
|
|
476
|
+
style: { height: 32, display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer", fontSize: 13, fontWeight: y === S ? 700 : 400, background: y === S ? e.primaryLt : "transparent", color: y === S ? e.primary : e.text },
|
|
477
|
+
onMouseEnter: (v) => y !== S && (v.currentTarget.style.background = e.bg),
|
|
478
|
+
onMouseLeave: (v) => y !== S && (v.currentTarget.style.background = "transparent"),
|
|
479
|
+
children: String(S).padStart(2, "0")
|
|
480
|
+
},
|
|
481
|
+
S
|
|
482
|
+
)) })
|
|
483
|
+
] }, h)),
|
|
484
|
+
/* @__PURE__ */ f("div", { style: { display: "flex", flexDirection: "column", gap: 4 }, children: [
|
|
485
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 11, fontWeight: 600, color: e.textMut }, children: "AM/PM" }),
|
|
486
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", flexDirection: "column", border: `1px solid ${e.border}`, borderRadius: e.r, overflow: "hidden" }, children: ["AM", "PM"].map((h) => /* @__PURE__ */ t(
|
|
487
|
+
"div",
|
|
488
|
+
{
|
|
489
|
+
onClick: () => {
|
|
490
|
+
p(h), a == null || a({ h: o, m: l, ampm: h });
|
|
491
|
+
},
|
|
492
|
+
style: { height: 40, display: "flex", alignItems: "center", justifyContent: "center", cursor: "pointer", padding: "0 12px", fontSize: 13, fontWeight: n === h ? 700 : 400, background: n === h ? e.primary : e.surface, color: n === h ? "#fff" : e.text },
|
|
493
|
+
children: h
|
|
494
|
+
},
|
|
495
|
+
h
|
|
496
|
+
)) })
|
|
497
|
+
] })
|
|
498
|
+
] }),
|
|
499
|
+
/* @__PURE__ */ f("div", { style: { textAlign: "center", marginTop: 12, fontSize: 22, fontWeight: 700, color: e.primary, letterSpacing: 2 }, children: [
|
|
500
|
+
String(o).padStart(2, "0"),
|
|
501
|
+
":",
|
|
502
|
+
String(l).padStart(2, "0"),
|
|
503
|
+
" ",
|
|
504
|
+
n
|
|
505
|
+
] })
|
|
506
|
+
] });
|
|
507
|
+
}
|
|
508
|
+
function Y(r, a) {
|
|
509
|
+
T(() => {
|
|
510
|
+
const g = (o) => {
|
|
511
|
+
r.current && !r.current.contains(o.target) && a(o);
|
|
512
|
+
};
|
|
513
|
+
return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
|
|
514
|
+
}, [r, a]);
|
|
515
|
+
}
|
|
516
|
+
function ze(r) {
|
|
517
|
+
const a = B(!1), g = B({ x: 0, y: 0, ox: 0, oy: 0 });
|
|
518
|
+
return H(
|
|
519
|
+
(o, s = 0, l = 0) => {
|
|
520
|
+
a.current = !0, g.current = { x: o.clientX, y: o.clientY, ox: s, oy: l };
|
|
521
|
+
const c = (p) => {
|
|
522
|
+
if (!a.current) return;
|
|
523
|
+
const { x: m, y: d, ox: h, oy: i } = g.current;
|
|
524
|
+
r(h + p.clientX - m, i + p.clientY - d);
|
|
525
|
+
}, n = () => {
|
|
526
|
+
a.current = !1, document.removeEventListener("mousemove", c), document.removeEventListener("mouseup", n);
|
|
527
|
+
};
|
|
528
|
+
document.addEventListener("mousemove", c), document.addEventListener("mouseup", n), o.preventDefault();
|
|
529
|
+
},
|
|
530
|
+
[r]
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
function Ne({ data: r = [], value: a, placeholder: g = "Select or type...", multiselection: o = !1, label: s, onChange: l, style: c }) {
|
|
534
|
+
var k;
|
|
535
|
+
const [n, p] = z(!1), [m, d] = z(""), [h, i] = z(o ? a ? [].concat(a) : [] : a || null), y = B(null);
|
|
536
|
+
T(W, []), Y(y, H(() => p(!1), []));
|
|
537
|
+
const $ = F(() => r.filter((u) => !m || u.value.toLowerCase().includes(m.toLowerCase())), [r, m]), S = (u) => o ? (h || []).includes(u) : h === u, v = (u) => {
|
|
538
|
+
const x = u.id || u.value;
|
|
539
|
+
if (o) {
|
|
540
|
+
const M = S(x) ? h.filter((D) => D !== x) : [...h || [], x];
|
|
541
|
+
i(M), l == null || l(M);
|
|
542
|
+
} else
|
|
543
|
+
i(x), d(""), p(!1), l == null || l(x);
|
|
544
|
+
}, N = o ? h != null && h.length ? `${h.length} selected` : "" : ((k = r.find((u) => (u.id || u.value) === h)) == null ? void 0 : k.value) || "";
|
|
545
|
+
return /* @__PURE__ */ f("div", { ref: y, className: "dhx", style: { position: "relative", ...c }, children: [
|
|
546
|
+
s && /* @__PURE__ */ t("label", { className: "dhx dhx-label", children: s }),
|
|
547
|
+
/* @__PURE__ */ f("div", { onClick: () => p((u) => !u), style: { display: "flex", alignItems: "center", border: `1px solid ${n ? e.primary : e.border}`, borderRadius: e.r, height: 32, padding: "0 10px", cursor: "pointer", background: e.surface, gap: 6, transition: "border-color .15s", boxShadow: n ? `0 0 0 3px ${e.primary}22` : "none" }, children: [
|
|
548
|
+
o && (h == null ? void 0 : h.length) > 0 && /* @__PURE__ */ f("div", { style: { display: "flex", gap: 3, flex: 1, flexWrap: "wrap", overflow: "hidden" }, children: [
|
|
549
|
+
h.slice(0, 3).map((u) => {
|
|
550
|
+
var x;
|
|
551
|
+
return /* @__PURE__ */ f("span", { className: "dhx dhx-tag dhx-tag-primary", style: { fontSize: 10, padding: "0 5px" }, children: [
|
|
552
|
+
((x = r.find((M) => (M.id || M.value) === u)) == null ? void 0 : x.value) || u,
|
|
553
|
+
/* @__PURE__ */ t("span", { onClick: (M) => {
|
|
554
|
+
M.stopPropagation(), v({ value: u });
|
|
555
|
+
}, style: { cursor: "pointer", marginLeft: 3 }, children: "×" })
|
|
556
|
+
] }, u);
|
|
557
|
+
}),
|
|
558
|
+
h.length > 3 && /* @__PURE__ */ f("span", { className: "dhx dhx-tag dhx-tag-primary", style: { fontSize: 10, padding: "0 5px" }, children: [
|
|
559
|
+
"+",
|
|
560
|
+
h.length - 3
|
|
561
|
+
] })
|
|
562
|
+
] }),
|
|
563
|
+
!o && /* @__PURE__ */ t("input", { value: n ? m : N, onChange: (u) => {
|
|
564
|
+
d(u.target.value), p(!0);
|
|
565
|
+
}, onFocus: () => p(!0), onClick: (u) => u.stopPropagation(), placeholder: g, style: { flex: 1, border: "none", outline: "none", fontSize: 13, background: "transparent", color: e.text } }),
|
|
566
|
+
o && !(h != null && h.length) && /* @__PURE__ */ t("span", { style: { flex: 1, color: e.textMut, fontSize: 13 }, children: g }),
|
|
567
|
+
/* @__PURE__ */ t("span", { style: { color: e.textMut, fontSize: 12, marginLeft: "auto" }, children: n ? "▲" : "▼" })
|
|
568
|
+
] }),
|
|
569
|
+
n && /* @__PURE__ */ f("div", { className: "dhx dhx-anim-fade", style: { position: "absolute", top: "calc(100% + 4px)", left: 0, right: 0, background: e.surface, border: `1px solid ${e.border}`, borderRadius: e.r, boxShadow: e.shadowLg, zIndex: 100, maxHeight: 220 }, children: [
|
|
570
|
+
o && /* @__PURE__ */ t("div", { style: { padding: "6px 10px", borderBottom: `1px solid ${e.border}` }, children: /* @__PURE__ */ t("input", { autoFocus: !0, className: "dhx dhx-input", style: { height: 26, fontSize: 12 }, placeholder: "Search...", value: m, onChange: (u) => d(u.target.value) }) }),
|
|
571
|
+
/* @__PURE__ */ f("div", { className: "dhx-scroll", style: { maxHeight: 180, overflowY: "auto" }, children: [
|
|
572
|
+
$.map((u) => /* @__PURE__ */ f(
|
|
573
|
+
"div",
|
|
574
|
+
{
|
|
575
|
+
onClick: () => v(u),
|
|
576
|
+
style: { padding: "8px 12px", cursor: "pointer", display: "flex", alignItems: "center", gap: 8, fontSize: 13, background: S(u.id || u.value) ? e.primaryLt : "transparent", color: S(u.id || u.value) ? e.primary : e.text },
|
|
577
|
+
onMouseEnter: (x) => !S(u.id || u.value) && (x.currentTarget.style.background = e.bg),
|
|
578
|
+
onMouseLeave: (x) => !S(u.id || u.value) && (x.currentTarget.style.background = "transparent"),
|
|
579
|
+
children: [
|
|
580
|
+
o && /* @__PURE__ */ t("span", { style: { width: 14, height: 14, border: `2px solid ${S(u.id || u.value) ? e.primary : e.borderDk}`, borderRadius: 2, display: "flex", alignItems: "center", justifyContent: "center", background: S(u.id || u.value) ? e.primary : "transparent" }, children: S(u.id || u.value) && /* @__PURE__ */ t("span", { style: { color: "#fff", fontSize: 9 }, children: "✓" }) }),
|
|
581
|
+
u.value,
|
|
582
|
+
u.count !== void 0 && /* @__PURE__ */ f("span", { style: { marginLeft: "auto", fontSize: 11, color: e.textMut }, children: [
|
|
583
|
+
"(",
|
|
584
|
+
u.count,
|
|
585
|
+
")"
|
|
586
|
+
] })
|
|
587
|
+
]
|
|
588
|
+
},
|
|
589
|
+
u.id || u.value
|
|
590
|
+
)),
|
|
591
|
+
$.length === 0 && /* @__PURE__ */ t("div", { style: { padding: 16, textAlign: "center", color: e.textMut, fontSize: 13 }, children: "No matches" })
|
|
592
|
+
] })
|
|
593
|
+
] })
|
|
594
|
+
] });
|
|
595
|
+
}
|
|
596
|
+
function Ce({ min: r = 0, max: a = 100, step: g = 1, value: o, range: s = !1, label: l, tick: c, onChange: n, style: p }) {
|
|
597
|
+
const [m, d] = z(o ?? (s ? [r, a] : r));
|
|
598
|
+
T(W, []);
|
|
599
|
+
const h = (S, v) => {
|
|
600
|
+
if (s) {
|
|
601
|
+
const N = [...m];
|
|
602
|
+
N[S] = v, d(N), n == null || n(N);
|
|
603
|
+
} else
|
|
604
|
+
d(v), n == null || n(v);
|
|
605
|
+
}, i = (S) => (S - r) / (a - r) * 100, y = s ? m : [m], $ = s ? { left: `${i(y[0])}%`, width: `${i(y[1]) - i(y[0])}%` } : { left: 0, width: `${i(y[0])}%` };
|
|
606
|
+
return /* @__PURE__ */ f("div", { className: "dhx", style: { width: "100%", ...p }, children: [
|
|
607
|
+
l && /* @__PURE__ */ t("label", { className: "dhx dhx-label", children: l }),
|
|
608
|
+
/* @__PURE__ */ t("div", { style: { position: "relative", height: 36, display: "flex", alignItems: "center" }, children: /* @__PURE__ */ f("div", { style: { position: "relative", flex: 1, height: 4, background: e.border, borderRadius: 2 }, children: [
|
|
609
|
+
/* @__PURE__ */ t("div", { style: { position: "absolute", ...$, height: "100%", background: e.primary, borderRadius: 2 } }),
|
|
610
|
+
y.map((S, v) => /* @__PURE__ */ t(
|
|
611
|
+
"input",
|
|
612
|
+
{
|
|
613
|
+
type: "range",
|
|
614
|
+
min: r,
|
|
615
|
+
max: a,
|
|
616
|
+
step: g,
|
|
617
|
+
value: S,
|
|
618
|
+
onChange: (N) => {
|
|
619
|
+
const k = +N.target.value;
|
|
620
|
+
s && v === 0 && k >= m[1] || s && v === 1 && k <= m[0] || h(v, k);
|
|
621
|
+
},
|
|
622
|
+
style: { position: "absolute", width: "100%", height: "100%", opacity: 0, cursor: "pointer", top: 0, left: 0, margin: 0 }
|
|
623
|
+
},
|
|
624
|
+
v
|
|
625
|
+
)),
|
|
626
|
+
y.map((S, v) => /* @__PURE__ */ t("div", { style: { position: "absolute", left: `${i(S)}%`, top: "50%", transform: "translate(-50%, -50%)", width: 16, height: 16, borderRadius: "50%", background: e.surface, border: `2px solid ${e.primary}`, boxShadow: "0 1px 4px rgba(0,0,0,.2)", pointerEvents: "none" }, children: /* @__PURE__ */ t("div", { style: { position: "absolute", bottom: "calc(100% + 6px)", left: "50%", transform: "translateX(-50%)", background: e.primaryDk, color: "#fff", padding: "2px 6px", borderRadius: e.r, fontSize: 11, fontWeight: 700, whiteSpace: "nowrap" }, children: S }) }, v))
|
|
627
|
+
] }) }),
|
|
628
|
+
c && /* @__PURE__ */ t("div", { style: { display: "flex", justifyContent: "space-between", marginTop: 2 }, children: [r, Math.round((a + r) / 2), a].map((S) => /* @__PURE__ */ t("span", { style: { fontSize: 10, color: e.textMut }, children: S }, S)) })
|
|
629
|
+
] });
|
|
630
|
+
}
|
|
631
|
+
const Le = ["#f44336", "#e91e63", "#9c27b0", "#673ab7", "#3f51b5", "#2196f3", "#03a9f4", "#00bcd4", "#009688", "#4caf50", "#8bc34a", "#cddc39", "#ffeb3b", "#ffc107", "#ff9800", "#ff5722", "#795548", "#607d8b", "#9e9e9e", "#000000", "#ffffff", "#0288d1", "#01579b", "#43a047", "#e53935", "#f57c00"];
|
|
632
|
+
function P(r) {
|
|
633
|
+
const a = parseInt(r.slice(1, 3), 16) / 255, g = parseInt(r.slice(3, 5), 16) / 255, o = parseInt(r.slice(5, 7), 16) / 255, s = Math.max(a, g, o), l = Math.min(a, g, o);
|
|
634
|
+
let c = 0, n = 0;
|
|
635
|
+
const p = (s + l) / 2;
|
|
636
|
+
if (s !== l) {
|
|
637
|
+
const m = s - l;
|
|
638
|
+
n = p > 0.5 ? m / (2 - s - l) : m / (s + l), c = s === a ? ((g - o) / m + (g < o ? 6 : 0)) / 6 : s === g ? ((o - a) / m + 2) / 6 : ((a - g) / m + 4) / 6;
|
|
639
|
+
}
|
|
640
|
+
return [Math.round(c * 360), Math.round(n * 100), Math.round(p * 100)];
|
|
641
|
+
}
|
|
642
|
+
function q(r, a, g) {
|
|
643
|
+
a /= 100, g /= 100;
|
|
644
|
+
const o = a * Math.min(g, 1 - g), s = (l) => {
|
|
645
|
+
const c = (l + r / 30) % 12, n = g - o * Math.max(Math.min(c - 3, 9 - c, 1), -1);
|
|
646
|
+
return Math.round(255 * n).toString(16).padStart(2, "0");
|
|
647
|
+
};
|
|
648
|
+
return "#" + s(0) + s(8) + s(4);
|
|
649
|
+
}
|
|
650
|
+
function Pe({ value: r = "#0288d1", onChange: a, style: g }) {
|
|
651
|
+
const [o, s] = z(() => P(r)), l = q(...o);
|
|
652
|
+
T(W, []);
|
|
653
|
+
const c = (n) => {
|
|
654
|
+
s(n), a == null || a(q(...n));
|
|
655
|
+
};
|
|
656
|
+
return /* @__PURE__ */ f("div", { className: "dhx", style: { background: e.surface, border: `1px solid ${e.border}`, borderRadius: e.rMd, padding: 16, display: "inline-block", boxShadow: e.shadow, ...g }, children: [
|
|
657
|
+
/* @__PURE__ */ t("div", { style: { width: 200, height: 120, borderRadius: e.r, marginBottom: 12, background: `linear-gradient(to bottom, transparent, black), linear-gradient(to right, white, hsl(${o[0]},100%,50%))`, cursor: "crosshair" } }),
|
|
658
|
+
[["Hue", 0, 360, o[0]], ["Saturation", 0, 100, o[1]], ["Lightness", 0, 100, o[2]]].map(([n, p, m, d], h) => /* @__PURE__ */ f("div", { style: { marginBottom: h < 2 ? 8 : 12 }, children: [
|
|
659
|
+
/* @__PURE__ */ f("div", { className: "dhx dhx-label", children: [
|
|
660
|
+
n,
|
|
661
|
+
h > 0 ? ` (${d}%)` : ""
|
|
662
|
+
] }),
|
|
663
|
+
/* @__PURE__ */ t("input", { type: "range", min: p, max: m, value: d, onChange: (i) => {
|
|
664
|
+
const y = [...o];
|
|
665
|
+
y[h] = +i.target.value, c(y);
|
|
666
|
+
}, style: { width: "100%", accentColor: e.primary } })
|
|
667
|
+
] }, n)),
|
|
668
|
+
/* @__PURE__ */ f("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
|
|
669
|
+
/* @__PURE__ */ t("div", { style: { width: 36, height: 36, borderRadius: e.r, background: l, border: `1px solid ${e.border}`, flexShrink: 0 } }),
|
|
670
|
+
/* @__PURE__ */ t(
|
|
671
|
+
"input",
|
|
672
|
+
{
|
|
673
|
+
className: "dhx dhx-input",
|
|
674
|
+
style: { flex: 1, fontFamily: "monospace", fontSize: 12 },
|
|
675
|
+
value: l,
|
|
676
|
+
onChange: (n) => {
|
|
677
|
+
try {
|
|
678
|
+
c(P(n.target.value)), a == null || a(n.target.value);
|
|
679
|
+
} catch {
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
)
|
|
684
|
+
] }),
|
|
685
|
+
/* @__PURE__ */ t("div", { style: { display: "grid", gridTemplateColumns: "repeat(13, 1fr)", gap: 3 }, children: Le.map((n) => /* @__PURE__ */ t(
|
|
686
|
+
"div",
|
|
687
|
+
{
|
|
688
|
+
onClick: () => {
|
|
689
|
+
s(P(n)), a == null || a(n);
|
|
690
|
+
},
|
|
691
|
+
style: { width: 14, height: 14, borderRadius: 2, background: n, cursor: "pointer", border: l === n ? `2px solid ${e.text}` : "1px solid rgba(0,0,0,.15)", transition: "transform .1s" },
|
|
692
|
+
onMouseEnter: (p) => p.currentTarget.style.transform = "scale(1.3)",
|
|
693
|
+
onMouseLeave: (p) => p.currentTarget.style.transform = "scale(1)"
|
|
694
|
+
},
|
|
695
|
+
n
|
|
696
|
+
)) })
|
|
697
|
+
] });
|
|
698
|
+
}
|
|
699
|
+
function O({ items: r, onSelect: a, style: g }) {
|
|
700
|
+
const [o, s] = z(null);
|
|
701
|
+
return /* @__PURE__ */ t("div", { className: "dhx dhx-anim-fade", style: { position: "absolute", top: "calc(100% + 4px)", left: 0, minWidth: 180, background: e.surface, border: `1px solid ${e.border}`, borderRadius: e.r, boxShadow: e.shadowLg, zIndex: 200, padding: "4px 0", ...g }, children: r.map((l, c) => {
|
|
702
|
+
var p, m;
|
|
703
|
+
if (l.type === "separator") return /* @__PURE__ */ t("div", { style: { height: 1, background: e.border, margin: "4px 0" } }, c);
|
|
704
|
+
const n = o === c;
|
|
705
|
+
return /* @__PURE__ */ f("div", { style: { position: "relative" }, onMouseEnter: () => s(c), onMouseLeave: () => s(null), children: [
|
|
706
|
+
/* @__PURE__ */ f(
|
|
707
|
+
"div",
|
|
708
|
+
{
|
|
709
|
+
onClick: () => {
|
|
710
|
+
var d;
|
|
711
|
+
return !l.disabled && !((d = l.items) != null && d.length) && a(l);
|
|
712
|
+
},
|
|
713
|
+
style: { display: "flex", alignItems: "center", gap: 8, padding: "8px 14px", cursor: l.disabled ? "not-allowed" : "pointer", fontSize: 13, color: l.disabled ? e.textMut : e.text, background: n && !l.disabled ? e.bg : "transparent", opacity: l.disabled ? 0.5 : 1 },
|
|
714
|
+
children: [
|
|
715
|
+
l.icon && /* @__PURE__ */ t("span", { style: { fontSize: 15, width: 18, textAlign: "center" }, children: l.icon }),
|
|
716
|
+
/* @__PURE__ */ t("span", { style: { flex: 1 }, children: l.value || l.id }),
|
|
717
|
+
l.hotkey && /* @__PURE__ */ t("span", { style: { fontSize: 11, color: e.textMut }, children: l.hotkey }),
|
|
718
|
+
(p = l.items) != null && p.length ? /* @__PURE__ */ t("span", { style: { fontSize: 10, color: e.textMut }, children: "▶" }) : null
|
|
719
|
+
]
|
|
720
|
+
}
|
|
721
|
+
),
|
|
722
|
+
n && ((m = l.items) != null && m.length) ? /* @__PURE__ */ t(O, { items: l.items, onSelect: a, style: { position: "absolute", left: "100%", top: -4 } }) : null
|
|
723
|
+
] }, l.id || c);
|
|
724
|
+
}) });
|
|
725
|
+
}
|
|
726
|
+
function Fe({ items: r = [], label: a = "Menu", onSelect: g, style: o }) {
|
|
727
|
+
const [s, l] = z(!1), c = B(null);
|
|
728
|
+
return T(W, []), Y(c, H(() => l(!1), [])), /* @__PURE__ */ f("div", { ref: c, className: "dhx", style: { position: "relative", display: "inline-block", ...o }, children: [
|
|
729
|
+
/* @__PURE__ */ f("button", { className: "dhx dhx-btn dhx-btn-secondary", onClick: () => l((n) => !n), children: [
|
|
730
|
+
a,
|
|
731
|
+
" ",
|
|
732
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 10 }, children: s ? "▲" : "▼" })
|
|
733
|
+
] }),
|
|
734
|
+
s && /* @__PURE__ */ t(O, { items: r, onSelect: (n) => {
|
|
735
|
+
g == null || g(n), l(!1);
|
|
736
|
+
} })
|
|
737
|
+
] });
|
|
738
|
+
}
|
|
739
|
+
function Ke({ items: r = [], onSelect: a, children: g }) {
|
|
740
|
+
const [o, s] = z(null), l = B(null);
|
|
741
|
+
return T(W, []), Y(l, H(() => s(null), [])), /* @__PURE__ */ f("div", { ref: l, onContextMenu: (n) => {
|
|
742
|
+
n.preventDefault(), s({ x: n.clientX, y: n.clientY });
|
|
743
|
+
}, style: { position: "relative", display: "contents" }, children: [
|
|
744
|
+
g,
|
|
745
|
+
o && /* @__PURE__ */ t("div", { style: { position: "fixed", left: o.x, top: o.y, zIndex: 9999 }, children: /* @__PURE__ */ t(O, { items: r, onSelect: (n) => {
|
|
746
|
+
a == null || a(n), s(null);
|
|
747
|
+
} }) })
|
|
748
|
+
] });
|
|
749
|
+
}
|
|
750
|
+
function _e({ trigger: r, children: a, placement: g = "bottom-start", style: o }) {
|
|
751
|
+
const [s, l] = z(!1), [c, n] = z({ top: "100%", left: 0 }), p = B(null), m = B(null);
|
|
752
|
+
return T(W, []), Y(p, H(() => l(!1), [])), /* @__PURE__ */ f("div", { ref: p, className: "dhx", style: { position: "relative", display: "inline-block" }, children: [
|
|
753
|
+
/* @__PURE__ */ t("div", { ref: m, onClick: () => {
|
|
754
|
+
l((h) => {
|
|
755
|
+
if (!h && m.current) {
|
|
756
|
+
const i = m.current.getBoundingClientRect(), y = {
|
|
757
|
+
"bottom-start": { top: i.height + 4, left: 0 },
|
|
758
|
+
"bottom-end": { top: i.height + 4, right: 0, left: "auto" },
|
|
759
|
+
"top-start": { bottom: i.height + 4, top: "auto", left: 0 }
|
|
760
|
+
};
|
|
761
|
+
n(y[g] || y["bottom-start"]);
|
|
762
|
+
}
|
|
763
|
+
return !h;
|
|
764
|
+
});
|
|
765
|
+
}, children: r }),
|
|
766
|
+
s && /* @__PURE__ */ t("div", { className: "dhx dhx-anim-fade", style: { position: "absolute", ...c, zIndex: 200, background: e.surface, border: `1px solid ${e.border}`, borderRadius: e.rMd, boxShadow: e.shadowLg, ...o }, children: a })
|
|
767
|
+
] });
|
|
768
|
+
}
|
|
769
|
+
function Xe({ title: r, children: a, width: g = 480, height: o, closable: s = !0, movable: l = !0, modal: c = !1, defaultOpen: n = !0, footer: p, onClose: m, style: d }) {
|
|
770
|
+
const [h, i] = z(n), [y, $] = z({ x: 0, y: 0 });
|
|
771
|
+
T(W, []);
|
|
772
|
+
const S = ze(H((N, k) => l && $({ x: N, y: k }), [l])), v = () => {
|
|
773
|
+
i(!1), m == null || m();
|
|
774
|
+
};
|
|
775
|
+
return h ? /* @__PURE__ */ f(Z, { children: [
|
|
776
|
+
c && /* @__PURE__ */ t("div", { style: { position: "fixed", inset: 0, background: "rgba(0,0,0,.45)", zIndex: 900 }, onClick: s ? v : void 0 }),
|
|
777
|
+
/* @__PURE__ */ f("div", { className: "dhx", style: { position: c ? "fixed" : "absolute", left: c ? "50%" : `calc(50% + ${y.x}px)`, top: c ? "50%" : `calc(50% + ${y.y}px)`, transform: `translate(calc(-50% + ${y.x}px), calc(-50% + ${y.y}px))`, width: g, ...o ? { height: o } : {}, background: e.surface, borderRadius: e.rMd, boxShadow: e.shadowLg, zIndex: 901, display: "flex", flexDirection: "column", overflow: "hidden", ...d }, children: [
|
|
778
|
+
/* @__PURE__ */ f("div", { onMouseDown: (N) => S(N, y.x, y.y), style: { display: "flex", alignItems: "center", padding: "12px 16px", borderBottom: `1px solid ${e.border}`, cursor: l ? "grab" : "default", background: e.bg, gap: 8, userSelect: "none" }, children: [
|
|
779
|
+
/* @__PURE__ */ t("span", { style: { flex: 1, fontWeight: 700, fontSize: 15 }, children: r }),
|
|
780
|
+
s && /* @__PURE__ */ t(
|
|
781
|
+
"button",
|
|
782
|
+
{
|
|
783
|
+
onClick: v,
|
|
784
|
+
style: { background: "none", border: "none", cursor: "pointer", width: 28, height: 28, borderRadius: e.r, display: "flex", alignItems: "center", justifyContent: "center", fontSize: 18, color: e.textSec },
|
|
785
|
+
onMouseEnter: (N) => N.currentTarget.style.background = e.border,
|
|
786
|
+
onMouseLeave: (N) => N.currentTarget.style.background = "none",
|
|
787
|
+
children: "×"
|
|
788
|
+
}
|
|
789
|
+
)
|
|
790
|
+
] }),
|
|
791
|
+
/* @__PURE__ */ t("div", { className: "dhx-scroll", style: { flex: 1, padding: 20, overflowY: "auto" }, children: a }),
|
|
792
|
+
p && /* @__PURE__ */ t("div", { style: { padding: "12px 16px", borderTop: `1px solid ${e.border}`, display: "flex", justifyContent: "flex-end", gap: 8, background: e.bg }, children: p })
|
|
793
|
+
] })
|
|
794
|
+
] }) : null;
|
|
795
|
+
}
|
|
796
|
+
const J = ee(null), De = { success: "✓", error: "✕", warning: "⚠", info: "ℹ" }, G = { success: e.success, error: e.danger, warning: e.warning, info: e.primary };
|
|
797
|
+
function Ve({ children: r }) {
|
|
798
|
+
const [a, g] = z([]);
|
|
799
|
+
T(W, []);
|
|
800
|
+
const o = H((c) => g((n) => n.filter((p) => p.id !== c)), []), s = H((c) => {
|
|
801
|
+
const n = Date.now();
|
|
802
|
+
return g((p) => [...p, { id: n, ...c }]), c.duration !== 0 && setTimeout(() => o(n), c.duration || 4e3), n;
|
|
803
|
+
}, [o]), l = {
|
|
804
|
+
message: s,
|
|
805
|
+
alert: (c, n) => s({ type: "info", title: c, ...n }),
|
|
806
|
+
confirm: (c, n, p) => s({ type: "warning", title: c, confirm: n, ...p })
|
|
807
|
+
};
|
|
808
|
+
return /* @__PURE__ */ f(J.Provider, { value: l, children: [
|
|
809
|
+
r,
|
|
810
|
+
/* @__PURE__ */ t("div", { style: { position: "fixed", top: 20, right: 20, zIndex: 9999, display: "flex", flexDirection: "column", gap: 8, pointerEvents: "none" }, children: a.map((c) => {
|
|
811
|
+
const n = c.type || "info";
|
|
812
|
+
return /* @__PURE__ */ f("div", { style: { background: e.surface, border: `1px solid ${e.border}`, borderLeft: `4px solid ${G[n]}`, borderRadius: e.r, boxShadow: e.shadowLg, padding: "12px 16px", minWidth: 280, maxWidth: 380, pointerEvents: "all", display: "flex", gap: 10, alignItems: "flex-start", animation: "dhx-toast .3s ease" }, children: [
|
|
813
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 18, color: G[n], lineHeight: 1 }, children: De[n] }),
|
|
814
|
+
/* @__PURE__ */ f("div", { style: { flex: 1 }, children: [
|
|
815
|
+
c.title && /* @__PURE__ */ t("div", { style: { fontWeight: 600, fontSize: 13, marginBottom: c.text ? 3 : 0 }, children: c.title }),
|
|
816
|
+
c.text && /* @__PURE__ */ t("div", { style: { fontSize: 12, color: e.textSec, lineHeight: 1.5 }, children: c.text }),
|
|
817
|
+
c.confirm && /* @__PURE__ */ f("div", { style: { display: "flex", gap: 6, marginTop: 8 }, children: [
|
|
818
|
+
/* @__PURE__ */ t("button", { className: "dhx dhx-btn dhx-btn-primary", style: { height: 26, fontSize: 12 }, onClick: () => {
|
|
819
|
+
c.confirm(!0), o(c.id);
|
|
820
|
+
}, children: "Confirm" }),
|
|
821
|
+
/* @__PURE__ */ t("button", { className: "dhx dhx-btn dhx-btn-secondary", style: { height: 26, fontSize: 12 }, onClick: () => {
|
|
822
|
+
c.confirm(!1), o(c.id);
|
|
823
|
+
}, children: "Cancel" })
|
|
824
|
+
] })
|
|
825
|
+
] }),
|
|
826
|
+
/* @__PURE__ */ t("button", { onClick: () => o(c.id), style: { background: "none", border: "none", cursor: "pointer", color: e.textMut, fontSize: 14, lineHeight: 1, padding: 0 }, children: "×" })
|
|
827
|
+
] }, c.id);
|
|
828
|
+
}) })
|
|
829
|
+
] });
|
|
830
|
+
}
|
|
831
|
+
function qe() {
|
|
832
|
+
const r = te(J);
|
|
833
|
+
if (!r) throw new Error("useMessage must be used inside <MessageProvider>");
|
|
834
|
+
return r;
|
|
835
|
+
}
|
|
836
|
+
function Ge({ data: r = [], template: a, keyNavigation: g = !0, multiselection: o = !1, editable: s = !1, height: l = 400, onSelect: c, onEdit: n, style: p }) {
|
|
837
|
+
const [m, d] = z(/* @__PURE__ */ new Set()), [h, i] = z(null), [y, $] = z(""), [S, v] = z(null);
|
|
838
|
+
T(W, []);
|
|
839
|
+
const N = (u, x) => {
|
|
840
|
+
const M = u.id ?? x;
|
|
841
|
+
d((D) => {
|
|
842
|
+
const b = o ? new Set(D) : /* @__PURE__ */ new Set();
|
|
843
|
+
return b.has(M) ? b.delete(M) : b.add(M), b;
|
|
844
|
+
}), v(x), c == null || c(u);
|
|
845
|
+
}, k = (u, x) => {
|
|
846
|
+
n == null || n({ ...u, value: y }, x), i(null);
|
|
847
|
+
};
|
|
848
|
+
return /* @__PURE__ */ f(
|
|
849
|
+
"div",
|
|
850
|
+
{
|
|
851
|
+
className: "dhx dhx-scroll",
|
|
852
|
+
style: { height: l, overflowY: "auto", border: `1px solid ${e.border}`, borderRadius: e.r, background: e.surface, ...p },
|
|
853
|
+
tabIndex: 0,
|
|
854
|
+
onKeyDown: (u) => {
|
|
855
|
+
g && (u.key === "ArrowDown" && v((x) => Math.min((x ?? -1) + 1, r.length - 1)), u.key === "ArrowUp" && v((x) => Math.max((x ?? 1) - 1, 0)));
|
|
856
|
+
},
|
|
857
|
+
children: [
|
|
858
|
+
r.map((u, x) => {
|
|
859
|
+
const M = u.id ?? x, D = m.has(M), b = S === x;
|
|
860
|
+
return /* @__PURE__ */ t(
|
|
861
|
+
"div",
|
|
862
|
+
{
|
|
863
|
+
onClick: () => N(u, x),
|
|
864
|
+
onDoubleClick: () => s && (i(x), $(String(u.value || ""))),
|
|
865
|
+
style: { display: "flex", alignItems: "center", padding: "0 12px", height: 40, cursor: "pointer", fontSize: 13, borderBottom: `1px solid ${e.border}`, background: D ? e.primaryLt : b ? e.bg : e.surface, color: D ? e.primary : e.text, outline: b ? `2px solid ${e.primary}44` : "none", transition: "background .1s" },
|
|
866
|
+
children: h === x ? /* @__PURE__ */ t(
|
|
867
|
+
"input",
|
|
868
|
+
{
|
|
869
|
+
autoFocus: !0,
|
|
870
|
+
className: "dhx dhx-input",
|
|
871
|
+
style: { height: 28, flex: 1 },
|
|
872
|
+
value: y,
|
|
873
|
+
onChange: (C) => $(C.target.value),
|
|
874
|
+
onBlur: () => k(u, x),
|
|
875
|
+
onKeyDown: (C) => {
|
|
876
|
+
C.key === "Enter" && k(u, x), C.key === "Escape" && i(null);
|
|
877
|
+
},
|
|
878
|
+
onClick: (C) => C.stopPropagation()
|
|
879
|
+
}
|
|
880
|
+
) : a ? /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: a(u) }, style: { flex: 1 } }) : /* @__PURE__ */ t("span", { style: { flex: 1, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: String(u.value ?? "") })
|
|
881
|
+
},
|
|
882
|
+
String(M)
|
|
883
|
+
);
|
|
884
|
+
}),
|
|
885
|
+
r.length === 0 && /* @__PURE__ */ t("div", { style: { padding: 24, textAlign: "center", color: e.textMut }, children: "No items" })
|
|
886
|
+
]
|
|
887
|
+
}
|
|
888
|
+
);
|
|
889
|
+
}
|
|
890
|
+
function Je({ data: r = [], template: a, itemsInRow: g = 3, gap: o = 12, multiselection: s = !1, onSelect: l, style: c }) {
|
|
891
|
+
const [n, p] = z(/* @__PURE__ */ new Set());
|
|
892
|
+
T(W, []);
|
|
893
|
+
const m = (d) => {
|
|
894
|
+
const h = d.id ?? String(d.title);
|
|
895
|
+
p((i) => {
|
|
896
|
+
const y = s ? new Set(i) : /* @__PURE__ */ new Set();
|
|
897
|
+
return y.has(h) ? y.delete(h) : y.add(h), y;
|
|
898
|
+
}), l == null || l(d);
|
|
899
|
+
};
|
|
900
|
+
return /* @__PURE__ */ t("div", { className: "dhx", style: { display: "grid", gridTemplateColumns: `repeat(${g}, 1fr)`, gap: o, padding: o, ...c }, children: r.map((d, h) => {
|
|
901
|
+
const i = d.id ?? h, y = n.has(i);
|
|
902
|
+
return /* @__PURE__ */ t(
|
|
903
|
+
"div",
|
|
904
|
+
{
|
|
905
|
+
onClick: () => m(d),
|
|
906
|
+
style: { background: e.surface, border: `2px solid ${y ? e.primary : e.border}`, borderRadius: e.rMd, overflow: "hidden", cursor: "pointer", transition: "all .15s", boxShadow: y ? `0 0 0 3px ${e.primary}33` : e.shadow, transform: y ? "translateY(-2px)" : "none" },
|
|
907
|
+
onMouseEnter: ($) => {
|
|
908
|
+
$.currentTarget.style.boxShadow = e.shadowLg, $.currentTarget.style.transform = "translateY(-2px)";
|
|
909
|
+
},
|
|
910
|
+
onMouseLeave: ($) => {
|
|
911
|
+
$.currentTarget.style.boxShadow = y ? `0 0 0 3px ${e.primary}33` : e.shadow, $.currentTarget.style.transform = y ? "translateY(-2px)" : "none";
|
|
912
|
+
},
|
|
913
|
+
children: a ? /* @__PURE__ */ t("div", { dangerouslySetInnerHTML: { __html: a(d) } }) : /* @__PURE__ */ f("div", { style: { padding: 16 }, children: [
|
|
914
|
+
d.img && /* @__PURE__ */ t("img", { src: d.img, alt: d.title || "", style: { width: "100%", borderRadius: e.r, marginBottom: 8, display: "block" } }),
|
|
915
|
+
/* @__PURE__ */ t("div", { style: { fontWeight: 600, fontSize: 14, marginBottom: 4 }, children: d.title || d.value }),
|
|
916
|
+
d.subtitle && /* @__PURE__ */ t("div", { style: { fontSize: 12, color: e.textSec }, children: d.subtitle })
|
|
917
|
+
] })
|
|
918
|
+
},
|
|
919
|
+
String(i)
|
|
920
|
+
);
|
|
921
|
+
}) });
|
|
922
|
+
}
|
|
923
|
+
function Ue({ data: r = [], checkbox: a = !1, editable: g = !1, onSelect: o, onCheck: s, style: l }) {
|
|
924
|
+
const [c, n] = z({}), [p, m] = z(null), [d, h] = z({}), [i, y] = z(null), [$, S] = z("");
|
|
925
|
+
T(W, []);
|
|
926
|
+
const v = (u) => n((x) => ({ ...x, [u]: !x[u] })), N = (u, x) => {
|
|
927
|
+
h((M) => ({ ...M, [u]: x })), s == null || s(u, x);
|
|
928
|
+
}, k = (u, x = 0) => {
|
|
929
|
+
var C;
|
|
930
|
+
const M = (((C = u.items) == null ? void 0 : C.length) ?? 0) > 0, D = c[u.id], b = p === u.id;
|
|
931
|
+
return /* @__PURE__ */ f("div", { children: [
|
|
932
|
+
/* @__PURE__ */ f(
|
|
933
|
+
"div",
|
|
934
|
+
{
|
|
935
|
+
onClick: () => {
|
|
936
|
+
m(u.id), o == null || o(u), M && v(u.id);
|
|
937
|
+
},
|
|
938
|
+
onDoubleClick: () => {
|
|
939
|
+
g && (y(u.id), S(u.value || ""));
|
|
940
|
+
},
|
|
941
|
+
style: { display: "flex", alignItems: "center", gap: 4, padding: `5px 8px 5px ${12 + x * 18}px`, cursor: "pointer", borderRadius: e.r, margin: "1px 4px", background: b ? e.primaryLt : "transparent", color: b ? e.primary : e.text, userSelect: "none", fontSize: 13 },
|
|
942
|
+
onMouseEnter: (w) => !b && (w.currentTarget.style.background = e.bg),
|
|
943
|
+
onMouseLeave: (w) => !b && (w.currentTarget.style.background = "transparent"),
|
|
944
|
+
children: [
|
|
945
|
+
/* @__PURE__ */ t("span", { style: { width: 16, textAlign: "center", fontSize: 11, color: e.textMut, flexShrink: 0 }, children: M ? D ? "▾" : "▸" : "" }),
|
|
946
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 15, flexShrink: 0 }, children: M ? D ? "📂" : "📁" : "📄" }),
|
|
947
|
+
a && /* @__PURE__ */ t("input", { type: "checkbox", checked: !!d[u.id], onChange: (w) => {
|
|
948
|
+
w.stopPropagation(), N(u.id, w.target.checked);
|
|
949
|
+
}, style: { cursor: "pointer", accentColor: e.primary }, onClick: (w) => w.stopPropagation() }),
|
|
950
|
+
i === u.id ? /* @__PURE__ */ t("input", { autoFocus: !0, className: "dhx dhx-input", style: { height: 24, fontSize: 12, flex: 1 }, value: $, onChange: (w) => S(w.target.value), onBlur: () => y(null), onKeyDown: (w) => w.key === "Enter" && y(null), onClick: (w) => w.stopPropagation() }) : /* @__PURE__ */ t("span", { style: { flex: 1 }, children: u.value }),
|
|
951
|
+
u.count !== void 0 && /* @__PURE__ */ f("span", { style: { fontSize: 11, color: e.textMut }, children: [
|
|
952
|
+
"(",
|
|
953
|
+
u.count,
|
|
954
|
+
")"
|
|
955
|
+
] })
|
|
956
|
+
]
|
|
957
|
+
}
|
|
958
|
+
),
|
|
959
|
+
M && D && /* @__PURE__ */ t("div", { children: u.items.map((w) => k(w, x + 1)) })
|
|
960
|
+
] }, u.id);
|
|
961
|
+
};
|
|
962
|
+
return /* @__PURE__ */ t("div", { className: "dhx dhx-scroll", style: { overflowY: "auto", ...l }, children: r.map((u) => k(u)) });
|
|
963
|
+
}
|
|
964
|
+
function Qe({ total: r, pageSize: a = 10, page: g, onChange: o, style: s }) {
|
|
965
|
+
const [l, c] = z(g || 1), n = Math.ceil(r / a);
|
|
966
|
+
T(W, []);
|
|
967
|
+
const p = (d) => {
|
|
968
|
+
const h = Math.min(Math.max(1, d), n);
|
|
969
|
+
c(h), o == null || o(h);
|
|
970
|
+
}, m = F(() => {
|
|
971
|
+
const d = [];
|
|
972
|
+
for (let i = Math.max(1, l - 2); i <= Math.min(n, l + 2); i++) d.push(i);
|
|
973
|
+
return d[0] > 1 && (d[0] > 2 && d.unshift("..."), d.unshift(1)), d[d.length - 1] < n && (d[d.length - 1] < n - 1 && d.push("..."), d.push(n)), d;
|
|
974
|
+
}, [l, n]);
|
|
975
|
+
return /* @__PURE__ */ f("div", { className: "dhx", style: { display: "flex", alignItems: "center", gap: 4, padding: "8px 12px", ...s }, children: [
|
|
976
|
+
/* @__PURE__ */ f("span", { style: { fontSize: 12, color: e.textSec, marginRight: 8 }, children: [
|
|
977
|
+
(l - 1) * a + 1,
|
|
978
|
+
"–",
|
|
979
|
+
Math.min(l * a, r),
|
|
980
|
+
" of ",
|
|
981
|
+
r
|
|
982
|
+
] }),
|
|
983
|
+
[["«", 1], ["‹", l - 1]].map(([d, h]) => /* @__PURE__ */ t("button", { className: "dhx dhx-btn dhx-btn-ghost", style: { height: 30, padding: "0 8px", fontSize: 14 }, disabled: l === 1, onClick: () => p(h), children: d }, d)),
|
|
984
|
+
m.map((d, h) => /* @__PURE__ */ t("button", { onClick: () => typeof d == "number" && p(d), className: `dhx dhx-btn ${d === l ? "dhx-btn-primary" : "dhx-btn-ghost"}`, style: { height: 30, minWidth: 30, padding: "0 8px", fontSize: 13 }, disabled: d === "...", children: d }, h)),
|
|
985
|
+
[["›", l + 1], ["»", n]].map(([d, h]) => /* @__PURE__ */ t("button", { className: "dhx dhx-btn dhx-btn-ghost", style: { height: 30, padding: "0 8px", fontSize: 14 }, disabled: l === n, onClick: () => p(h), children: d }, d))
|
|
986
|
+
] });
|
|
987
|
+
}
|
|
988
|
+
function Ze({ config: r = {}, defaultValues: a = {}, onSubmit: g, style: o }) {
|
|
989
|
+
const [s, l] = z(a), [c, n] = z({});
|
|
990
|
+
T(W, []);
|
|
991
|
+
const p = (i, y) => {
|
|
992
|
+
l(($) => ({ ...$, [i]: y })), n(($) => ({ ...$, [i]: null }));
|
|
993
|
+
}, m = () => {
|
|
994
|
+
const i = {};
|
|
995
|
+
return (r.rows || []).flat().forEach((y) => {
|
|
996
|
+
y && typeof y == "object" && "name" in y && y.required && !s[y.name] && (i[y.name] = `${y.label || y.name} is required`);
|
|
997
|
+
}), n(i), Object.keys(i).length === 0;
|
|
998
|
+
}, d = (i) => {
|
|
999
|
+
const y = s[i.name] ?? i.value ?? "", $ = c[i.name];
|
|
1000
|
+
if (i.type === "fieldset") return /* @__PURE__ */ f("fieldset", { style: { border: `1px solid ${e.border}`, borderRadius: e.r, padding: "12px 16px", marginBottom: 14 }, children: [
|
|
1001
|
+
/* @__PURE__ */ t("legend", { style: { fontSize: 12, fontWeight: 700, color: e.textSec, padding: "0 6px" }, children: i.label }),
|
|
1002
|
+
(i.rows || []).map((k) => d(k))
|
|
1003
|
+
] }, i.name);
|
|
1004
|
+
const S = { key: i.name, className: "dhx-form-group" }, v = i.label && /* @__PURE__ */ f("label", { className: "dhx dhx-label", style: { display: "flex", gap: 4 }, children: [
|
|
1005
|
+
i.label,
|
|
1006
|
+
i.required && /* @__PURE__ */ t("span", { style: { color: e.danger }, children: "*" })
|
|
1007
|
+
] }), N = $ && /* @__PURE__ */ t("div", { style: { fontSize: 11, color: e.danger, marginTop: 3 }, children: $ });
|
|
1008
|
+
return !i.type || i.type === "input" ? /* @__PURE__ */ f("div", { ...S, children: [
|
|
1009
|
+
v,
|
|
1010
|
+
/* @__PURE__ */ f("div", { className: "dhx-input-wrap", children: [
|
|
1011
|
+
i.icon && /* @__PURE__ */ t("span", { className: "dhx-input-icon", children: i.icon }),
|
|
1012
|
+
/* @__PURE__ */ t("input", { className: `dhx dhx-input${i.icon ? " dhx-input--with-icon" : ""}`, style: { borderColor: $ ? e.danger : void 0 }, type: i.inputType || "text", placeholder: i.placeholder, value: y, onChange: (k) => p(i.name, k.target.value), disabled: i.disabled })
|
|
1013
|
+
] }),
|
|
1014
|
+
i.helpMessage && /* @__PURE__ */ f("div", { style: { fontSize: 11, color: e.textMut, marginTop: 3 }, children: [
|
|
1015
|
+
"ⓘ ",
|
|
1016
|
+
i.helpMessage
|
|
1017
|
+
] }),
|
|
1018
|
+
N
|
|
1019
|
+
] }) : i.type === "textarea" ? /* @__PURE__ */ f("div", { ...S, children: [
|
|
1020
|
+
v,
|
|
1021
|
+
/* @__PURE__ */ t("textarea", { className: "dhx dhx-input", style: { height: 80, resize: "vertical", padding: "8px 10px" }, placeholder: i.placeholder, value: y, onChange: (k) => p(i.name, k.target.value) }),
|
|
1022
|
+
N
|
|
1023
|
+
] }) : i.type === "select" ? /* @__PURE__ */ f("div", { ...S, children: [
|
|
1024
|
+
v,
|
|
1025
|
+
/* @__PURE__ */ f("select", { className: "dhx dhx-input", value: y, onChange: (k) => p(i.name, k.target.value), style: { cursor: "pointer" }, children: [
|
|
1026
|
+
/* @__PURE__ */ t("option", { value: "", children: "— Select —" }),
|
|
1027
|
+
(i.options || []).map((k) => /* @__PURE__ */ t("option", { value: k.value, children: k.label || k.value }, k.value))
|
|
1028
|
+
] }),
|
|
1029
|
+
N
|
|
1030
|
+
] }) : i.type === "checkbox" ? /* @__PURE__ */ t("div", { ...S, children: /* @__PURE__ */ f("label", { style: { display: "flex", alignItems: "center", gap: 8, cursor: "pointer" }, children: [
|
|
1031
|
+
/* @__PURE__ */ t("input", { type: "checkbox", checked: !!y, onChange: (k) => p(i.name, k.target.checked), style: { width: 16, height: 16, accentColor: e.primary, cursor: "pointer" } }),
|
|
1032
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 13 }, children: i.label })
|
|
1033
|
+
] }) }) : i.type === "radio" ? /* @__PURE__ */ f("div", { ...S, children: [
|
|
1034
|
+
v,
|
|
1035
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: 16, flexWrap: "wrap" }, children: (i.options || []).map((k) => /* @__PURE__ */ f("label", { style: { display: "flex", alignItems: "center", gap: 6, cursor: "pointer", fontSize: 13 }, children: [
|
|
1036
|
+
/* @__PURE__ */ t("input", { type: "radio", name: i.name, value: k.value, checked: y === k.value, onChange: () => p(i.name, k.value), style: { accentColor: e.primary, cursor: "pointer" } }),
|
|
1037
|
+
k.label || k.value
|
|
1038
|
+
] }, k.value)) })
|
|
1039
|
+
] }) : i.type === "slider" ? /* @__PURE__ */ t("div", { ...S, children: /* @__PURE__ */ t(Ce, { label: i.label, min: i.min, max: i.max, step: i.step, value: y || i.min, range: i.range, onChange: (k) => p(i.name, k) }) }) : i.type === "combo" ? /* @__PURE__ */ f("div", { ...S, children: [
|
|
1040
|
+
/* @__PURE__ */ t(Ne, { label: i.label, data: i.data || [], multiselection: i.multiselection, placeholder: i.placeholder || "Select...", value: y || (i.multiselection ? [] : null), onChange: (k) => p(i.name, k) }),
|
|
1041
|
+
N
|
|
1042
|
+
] }) : i.type === "datepicker" ? /* @__PURE__ */ f("div", { ...S, children: [
|
|
1043
|
+
v,
|
|
1044
|
+
/* @__PURE__ */ t("input", { type: "date", className: "dhx dhx-input", value: y, onChange: (k) => p(i.name, k.target.value) }),
|
|
1045
|
+
N
|
|
1046
|
+
] }) : i.type === "timepicker" ? /* @__PURE__ */ f("div", { ...S, children: [
|
|
1047
|
+
v,
|
|
1048
|
+
/* @__PURE__ */ t("input", { type: "time", className: "dhx dhx-input", value: y, onChange: (k) => p(i.name, k.target.value) })
|
|
1049
|
+
] }) : i.type === "spacer" ? /* @__PURE__ */ t("div", { style: { height: i.height || 16 } }, i.name) : null;
|
|
1050
|
+
}, h = (i) => i.map(
|
|
1051
|
+
(y, $) => Array.isArray(y) ? /* @__PURE__ */ t("div", { style: { display: "flex", gap: 12, alignItems: "flex-start" }, children: y.map(d) }, $) : d(y)
|
|
1052
|
+
);
|
|
1053
|
+
return /* @__PURE__ */ f("div", { className: "dhx", style: { padding: r.padding || 0, width: r.width || "100%", ...o }, children: [
|
|
1054
|
+
h(r.rows || []),
|
|
1055
|
+
(r.buttons || g) && /* @__PURE__ */ f("div", { style: { display: "flex", gap: 8, justifyContent: r.buttonAlign || "flex-start", marginTop: 8 }, children: [
|
|
1056
|
+
/* @__PURE__ */ t("button", { className: "dhx dhx-btn dhx-btn-primary", onClick: () => m() && (g == null ? void 0 : g(s)), children: r.submitText || "Submit" }),
|
|
1057
|
+
r.resetButton !== !1 && /* @__PURE__ */ t("button", { className: "dhx dhx-btn dhx-btn-secondary", onClick: () => {
|
|
1058
|
+
l(a), n({});
|
|
1059
|
+
}, children: r.resetText || "Reset" })
|
|
1060
|
+
] })
|
|
1061
|
+
] });
|
|
1062
|
+
}
|
|
1063
|
+
function et({ items: r = [], onAction: a, style: g }) {
|
|
1064
|
+
T(W, []);
|
|
1065
|
+
const o = (s, l) => {
|
|
1066
|
+
var p, m;
|
|
1067
|
+
if ("type" in s && (s.type === "separator" || s.type === "sep"))
|
|
1068
|
+
return /* @__PURE__ */ t("div", { style: { width: 1, background: e.border, margin: "8px 4px", alignSelf: "stretch" } }, l);
|
|
1069
|
+
if ("type" in s && s.type === "input")
|
|
1070
|
+
return /* @__PURE__ */ f("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", padding: "4px 6px", gap: 4 }, children: [
|
|
1071
|
+
s.label && /* @__PURE__ */ t("span", { style: { fontSize: 10, color: e.textMut }, children: s.label }),
|
|
1072
|
+
/* @__PURE__ */ t("input", { className: "dhx dhx-input", style: { width: s.width || 110, height: 26, fontSize: 12 }, placeholder: s.placeholder, defaultValue: s.value, onChange: (d) => {
|
|
1073
|
+
var h;
|
|
1074
|
+
return (h = s.onChange) == null ? void 0 : h.call(s, d.target.value);
|
|
1075
|
+
} })
|
|
1076
|
+
] }, l);
|
|
1077
|
+
if ("type" in s && s.type === "block") {
|
|
1078
|
+
const d = s;
|
|
1079
|
+
return /* @__PURE__ */ f("div", { style: { display: "flex", flexDirection: d.direction === "col" ? "column" : "row", alignItems: "center", gap: 4, padding: "4px 8px", borderRight: `1px solid ${e.border}`, minHeight: 64 }, children: [
|
|
1080
|
+
/* @__PURE__ */ t("div", { style: { display: "flex", gap: 2 }, children: (p = d.items) == null ? void 0 : p.map((h, i) => o(h, i)) }),
|
|
1081
|
+
d.label && /* @__PURE__ */ t("span", { style: { fontSize: 10, color: e.textMut, marginTop: 2 }, children: d.label })
|
|
1082
|
+
] }, l);
|
|
1083
|
+
}
|
|
1084
|
+
if ("type" in s && s.type === "selectButton") {
|
|
1085
|
+
const d = s;
|
|
1086
|
+
return /* @__PURE__ */ t("select", { className: "dhx dhx-input", style: { height: 28, fontSize: 12, cursor: "pointer", margin: 2 }, defaultValue: d.value, onChange: (h) => {
|
|
1087
|
+
var i;
|
|
1088
|
+
return (i = d.onChange) == null ? void 0 : i.call(d, h.target.value);
|
|
1089
|
+
}, children: (m = d.items) == null ? void 0 : m.map((h) => /* @__PURE__ */ t("option", { value: h.value, children: h.value }, h.value)) }, l);
|
|
1090
|
+
}
|
|
1091
|
+
const c = s, n = c.active;
|
|
1092
|
+
return /* @__PURE__ */ f(
|
|
1093
|
+
"button",
|
|
1094
|
+
{
|
|
1095
|
+
title: c.tooltip,
|
|
1096
|
+
className: `dhx dhx-btn ${n ? "dhx-btn-primary" : "dhx-btn-ghost"}`,
|
|
1097
|
+
style: { flexDirection: "column", minHeight: 48, padding: "4px 8px", gap: 4, fontSize: 12 },
|
|
1098
|
+
disabled: c.disabled,
|
|
1099
|
+
onClick: () => {
|
|
1100
|
+
var d;
|
|
1101
|
+
(d = c.onClick) == null || d.call(c, c), c.id && (a == null || a(c.id, c));
|
|
1102
|
+
},
|
|
1103
|
+
children: [
|
|
1104
|
+
c.icon && /* @__PURE__ */ t("span", { style: { fontSize: c.size === "large" ? 24 : 18 }, children: c.icon }),
|
|
1105
|
+
c.text && /* @__PURE__ */ t("span", { style: { fontSize: 10, maxWidth: 60, textAlign: "center", lineHeight: 1.2, whiteSpace: "normal" }, children: c.text })
|
|
1106
|
+
]
|
|
1107
|
+
},
|
|
1108
|
+
l
|
|
1109
|
+
);
|
|
1110
|
+
};
|
|
1111
|
+
return /* @__PURE__ */ t("div", { className: "dhx", style: { display: "flex", alignItems: "stretch", background: e.bg, borderBottom: `1px solid ${e.border}`, padding: "4px 0", overflowX: "auto", gap: 0, ...g }, children: r.map(o) });
|
|
1112
|
+
}
|
|
1113
|
+
function tt({ logo: r, items: a = [], vertical: g = !1, style: o }) {
|
|
1114
|
+
const [s, l] = z(null), c = B(null);
|
|
1115
|
+
T(W, []), Y(c, H(() => l(null), []));
|
|
1116
|
+
const n = (p, m) => {
|
|
1117
|
+
var d;
|
|
1118
|
+
return p.type === "separator" ? /* @__PURE__ */ t("div", { style: { [g ? "height" : "width"]: 1, background: "rgba(255,255,255,.25)", margin: g ? "4px 8px" : "0 6px", alignSelf: "stretch" } }, m) : p.type === "spacer" ? /* @__PURE__ */ t("div", { style: { flex: 1 } }, m) : p.type === "input" ? /* @__PURE__ */ t("input", { className: "dhx dhx-input", style: { width: p.width || 200, height: 28, margin: "0 4px" }, placeholder: p.placeholder }, m) : p.type === "menuItem" && ((d = p.items) != null && d.length) ? /* @__PURE__ */ f("div", { style: { position: "relative" }, children: [
|
|
1119
|
+
/* @__PURE__ */ f("button", { className: "dhx dhx-btn dhx-btn-ghost", style: { height: 36, color: "#fff" }, onClick: () => l(s === m ? null : m), children: [
|
|
1120
|
+
p.icon && /* @__PURE__ */ t("span", { children: p.icon }),
|
|
1121
|
+
p.value,
|
|
1122
|
+
" ",
|
|
1123
|
+
/* @__PURE__ */ t("span", { style: { fontSize: 9 }, children: "▼" })
|
|
1124
|
+
] }),
|
|
1125
|
+
s === m && /* @__PURE__ */ t(O, { items: p.items, onSelect: () => l(null), style: { top: "100%" } })
|
|
1126
|
+
] }, m) : /* @__PURE__ */ f("button", { className: "dhx dhx-btn dhx-btn-ghost", style: { height: 36, gap: 6, color: "#fff" }, onClick: () => {
|
|
1127
|
+
var h;
|
|
1128
|
+
return (h = p.onClick) == null ? void 0 : h.call(p);
|
|
1129
|
+
}, children: [
|
|
1130
|
+
p.icon && /* @__PURE__ */ t("span", { style: { fontSize: 16 }, children: p.icon }),
|
|
1131
|
+
p.value && /* @__PURE__ */ t("span", { style: { fontSize: 13 }, children: p.value })
|
|
1132
|
+
] }, m);
|
|
1133
|
+
};
|
|
1134
|
+
return /* @__PURE__ */ f("nav", { ref: c, className: "dhx", style: { display: "flex", flexDirection: g ? "column" : "row", alignItems: g ? "stretch" : "center", background: e.primary, padding: g ? "12px 0" : "0 12px", minHeight: g ? void 0 : 48, gap: 2, ...o }, children: [
|
|
1135
|
+
r && /* @__PURE__ */ t("div", { style: { color: "#fff", fontWeight: 800, fontSize: 16, padding: g ? "8px 16px" : "0 12px 0 4px", borderRight: g ? "none" : "1px solid rgba(255,255,255,.25)", marginRight: g ? 0 : 8 }, children: r }),
|
|
1136
|
+
a.map(n)
|
|
1137
|
+
] });
|
|
1138
|
+
}
|
|
1139
|
+
export {
|
|
1140
|
+
We as Button,
|
|
1141
|
+
Ye as Calendar,
|
|
1142
|
+
je as Chart,
|
|
1143
|
+
Pe as Colorpicker,
|
|
1144
|
+
Ne as Combobox,
|
|
1145
|
+
Ke as ContextMenu,
|
|
1146
|
+
Je as DataView,
|
|
1147
|
+
Ze as Form,
|
|
1148
|
+
Be as Grid,
|
|
1149
|
+
Se as Layout,
|
|
1150
|
+
Ge as List,
|
|
1151
|
+
Fe as Menu,
|
|
1152
|
+
O as MenuDropdown,
|
|
1153
|
+
J as MessageContext,
|
|
1154
|
+
Ve as MessageProvider,
|
|
1155
|
+
tt as Navbar,
|
|
1156
|
+
Qe as Pagination,
|
|
1157
|
+
_e as Popup,
|
|
1158
|
+
et as Ribbon,
|
|
1159
|
+
Ae as Sidebar,
|
|
1160
|
+
Ce as Slider,
|
|
1161
|
+
He as Tabbar,
|
|
1162
|
+
Oe as Timepicker,
|
|
1163
|
+
Ee as Toolbar,
|
|
1164
|
+
Ue as Tree,
|
|
1165
|
+
Xe as Window,
|
|
1166
|
+
e as tokens,
|
|
1167
|
+
Y as useClickOutside,
|
|
1168
|
+
ze as useDrag,
|
|
1169
|
+
qe as useMessage
|
|
1170
|
+
};
|
|
1171
|
+
//# sourceMappingURL=dhx-react-suite.js.map
|