@liuman/react-workspace 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Workspace-CeydoZ5v.js +1284 -0
- package/dist/Workspace-D3n7ORY0.cjs +1 -0
- package/dist/components/WindowTabs.d.ts.map +1 -1
- package/dist/react-workspace-antd.cjs +1 -1
- package/dist/react-workspace-antd.js +2 -2
- package/dist/react-workspace.cjs +1 -1
- package/dist/react-workspace.css +1 -1
- package/dist/react-workspace.js +1 -1
- package/package.json +1 -1
- package/dist/Workspace-8le04kVh.js +0 -1262
- package/dist/Workspace-BeGkKkRB.cjs +0 -1
|
@@ -1,1262 +0,0 @@
|
|
|
1
|
-
import { jsxs as q, jsx as s } from "react/jsx-runtime";
|
|
2
|
-
import { useRef as U, useState as ee, useCallback as R, useEffect as ne, createContext as Ne, useContext as we, useMemo as oe, createElement as Me, forwardRef as Pe, useImperativeHandle as Te } from "react";
|
|
3
|
-
import { createPortal as De } from "react-dom";
|
|
4
|
-
const Ee = ({
|
|
5
|
-
tip: e = "加载中...",
|
|
6
|
-
spinning: t = !1,
|
|
7
|
-
children: o
|
|
8
|
-
}) => /* @__PURE__ */ q("div", { className: "rw-spinner-wrap", children: [
|
|
9
|
-
o,
|
|
10
|
-
t && /* @__PURE__ */ q("div", { className: "rw-spinner-overlay", children: [
|
|
11
|
-
/* @__PURE__ */ s("div", { className: "rw-spinner" }),
|
|
12
|
-
e && /* @__PURE__ */ s("span", { className: "rw-spinner-tip", children: e })
|
|
13
|
-
] })
|
|
14
|
-
] }), ge = 100;
|
|
15
|
-
function ie(e, t) {
|
|
16
|
-
const o = globalThis.window.innerWidth, r = globalThis.window.innerHeight, m = Math.min(t?.minWidth ?? ge, o), h = Math.min(t?.minHeight ?? ge, r);
|
|
17
|
-
let { x: p, y: c, width: d, height: w } = e;
|
|
18
|
-
return d = Math.min(d, o), w = Math.min(w, r), d = Math.max(d, m), w = Math.max(w, h), p + d > o && (p = Math.max(0, o - d)), c + w > r && (c = Math.max(0, r - w)), p < 0 && (p = 0), c < 0 && (c = 0), { x: p, y: c, width: d, height: w };
|
|
19
|
-
}
|
|
20
|
-
function ae(e, t) {
|
|
21
|
-
return `${e}${t}`;
|
|
22
|
-
}
|
|
23
|
-
function se(e, t) {
|
|
24
|
-
if (!t) return {};
|
|
25
|
-
try {
|
|
26
|
-
const o = ae(e, t), r = localStorage.getItem(o);
|
|
27
|
-
if (r) {
|
|
28
|
-
const m = JSON.parse(r);
|
|
29
|
-
if (m && typeof m == "object") {
|
|
30
|
-
const h = {};
|
|
31
|
-
return Object.entries(m).forEach(([p, c]) => {
|
|
32
|
-
if (c && typeof c == "object") {
|
|
33
|
-
const d = c, w = {};
|
|
34
|
-
d.position && typeof d.position.x == "number" && typeof d.position.y == "number" && typeof d.position.width == "number" && typeof d.position.height == "number" && (w.position = ie(d.position)), typeof d.minimized == "boolean" && (w.minimized = d.minimized), typeof d.floating == "boolean" && (w.floating = d.floating), typeof d.floatingZIndex == "number" && (w.floatingZIndex = d.floatingZIndex), h[p] = w;
|
|
35
|
-
}
|
|
36
|
-
}), h;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
} catch (o) {
|
|
40
|
-
console.warn("[react-workspace] 从 localStorage 读取窗口状态失败:", o);
|
|
41
|
-
}
|
|
42
|
-
return {};
|
|
43
|
-
}
|
|
44
|
-
function le(e, t, o, r) {
|
|
45
|
-
if (t)
|
|
46
|
-
try {
|
|
47
|
-
const m = se(e, t);
|
|
48
|
-
m[o] = { ...m[o], ...r }, localStorage.setItem(ae(e, t), JSON.stringify(m));
|
|
49
|
-
} catch (m) {
|
|
50
|
-
console.warn("[react-workspace] 保存窗口状态到 localStorage 失败:", m);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function de(e, t, o) {
|
|
54
|
-
if (t)
|
|
55
|
-
try {
|
|
56
|
-
const r = ae(e, t), m = localStorage.getItem(r);
|
|
57
|
-
let h = m ? JSON.parse(m) : {};
|
|
58
|
-
const p = Object.values(h).map((D) => D?.floatingZIndex || 0).filter((D) => D >= 1e3), c = p.length > 0 ? Math.max(...p) : 999, d = h[o] || {}, w = d.floatingZIndex || 0, _ = Math.max(1e3, c + 1);
|
|
59
|
-
w >= 1e3 ? (h[o] = { ...d, floatingZIndex: _ }, Object.keys(h).forEach((D) => {
|
|
60
|
-
if (D !== o && h[D]) {
|
|
61
|
-
const H = h[D];
|
|
62
|
-
H.floatingZIndex !== void 0 && H.floatingZIndex >= 1e3 && (h[D] = {
|
|
63
|
-
...H,
|
|
64
|
-
floatingZIndex: Math.max(1e3, H.floatingZIndex - 1)
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
})) : h[o] = { ...d, floatingZIndex: _ }, localStorage.setItem(r, JSON.stringify(h));
|
|
68
|
-
} catch (r) {
|
|
69
|
-
console.error("[react-workspace] 保存标签点击顺序失败:", r);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
function me(e, t, o) {
|
|
73
|
-
if (e.length === 0) return null;
|
|
74
|
-
try {
|
|
75
|
-
const r = localStorage.getItem(ae(t, o));
|
|
76
|
-
if (r) {
|
|
77
|
-
const m = JSON.parse(r);
|
|
78
|
-
return [...e].sort((p, c) => {
|
|
79
|
-
const d = m[p.type]?.floatingZIndex || 0, w = m[c.type]?.floatingZIndex || 0;
|
|
80
|
-
return d >= 1e3 && w >= 1e3 ? w - d : d >= 1e3 ? -1 : w >= 1e3 ? 1 : 0;
|
|
81
|
-
})[0]?.id ?? e[e.length - 1].id;
|
|
82
|
-
}
|
|
83
|
-
} catch {
|
|
84
|
-
}
|
|
85
|
-
return e[e.length - 1].id;
|
|
86
|
-
}
|
|
87
|
-
const Re = "react_workspace_windows_", $e = {
|
|
88
|
-
x: 100,
|
|
89
|
-
y: 100,
|
|
90
|
-
width: 800,
|
|
91
|
-
height: 600,
|
|
92
|
-
minWidth: 400,
|
|
93
|
-
minHeight: 300
|
|
94
|
-
};
|
|
95
|
-
function he(e) {
|
|
96
|
-
return { ...$e, ...e };
|
|
97
|
-
}
|
|
98
|
-
function pe() {
|
|
99
|
-
return `window-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`;
|
|
100
|
-
}
|
|
101
|
-
function Ze(e) {
|
|
102
|
-
const {
|
|
103
|
-
workspaceId: t,
|
|
104
|
-
defaultWindow: o,
|
|
105
|
-
syncToUrl: r = !1,
|
|
106
|
-
preserveUrlParams: m = !0,
|
|
107
|
-
searchParams: h,
|
|
108
|
-
setSearchParams: p,
|
|
109
|
-
storageKeyPrefix: c = Re,
|
|
110
|
-
floatingDefaults: d,
|
|
111
|
-
onWindowsChange: w
|
|
112
|
-
} = e, _ = U(
|
|
113
|
-
o ?? { type: "home", title: "首页", minimized: !1 }
|
|
114
|
-
);
|
|
115
|
-
_.current = o ?? _.current;
|
|
116
|
-
const D = U(he(d));
|
|
117
|
-
D.current = he(d);
|
|
118
|
-
const H = U(w);
|
|
119
|
-
H.current = w;
|
|
120
|
-
const [v, Z] = ee([]), [k, X] = ee(null), A = U({}), $ = R((n, i) => {
|
|
121
|
-
H.current?.(n, i);
|
|
122
|
-
}, []), g = R(
|
|
123
|
-
(n) => se(c, t)[n] || null,
|
|
124
|
-
[c, t]
|
|
125
|
-
), b = R(
|
|
126
|
-
(n) => g(n)?.position || null,
|
|
127
|
-
[g]
|
|
128
|
-
), L = R(
|
|
129
|
-
(n, i) => {
|
|
130
|
-
if (!r || !p) return;
|
|
131
|
-
const l = m && h ? new URLSearchParams(h) : new URLSearchParams();
|
|
132
|
-
n.length > 0 ? l.set("windows", encodeURIComponent(JSON.stringify(
|
|
133
|
-
n.map((a) => ({ id: a.id, type: a.type, title: a.title }))
|
|
134
|
-
))) : l.delete("windows"), i ? l.set("active", i) : l.delete("active"), p(l, { replace: !0 });
|
|
135
|
-
},
|
|
136
|
-
[r, p, m, h]
|
|
137
|
-
), S = R(
|
|
138
|
-
(n, i) => {
|
|
139
|
-
Z(n), X(i), L(n, i), $(n, i);
|
|
140
|
-
},
|
|
141
|
-
[L, $]
|
|
142
|
-
), T = R(
|
|
143
|
-
(n) => {
|
|
144
|
-
const i = g(n.type), l = {
|
|
145
|
-
...n,
|
|
146
|
-
minimized: i?.minimized ?? n.minimized ?? !1,
|
|
147
|
-
floating: i?.floating ?? n.floating ?? !1
|
|
148
|
-
};
|
|
149
|
-
if (l.floating) {
|
|
150
|
-
let a = n.floatingPosition || i?.position;
|
|
151
|
-
a || (a = b(n.type) ?? void 0), a && (l.floatingPosition = ie(a)), l.floatingZIndex = i?.floatingZIndex ?? n.floatingZIndex ?? 1e3;
|
|
152
|
-
}
|
|
153
|
-
return l;
|
|
154
|
-
},
|
|
155
|
-
[g, b]
|
|
156
|
-
), x = R(() => {
|
|
157
|
-
const n = _.current, i = {
|
|
158
|
-
id: pe(),
|
|
159
|
-
type: n.type,
|
|
160
|
-
title: n.title,
|
|
161
|
-
minimized: n.minimized ?? !1
|
|
162
|
-
};
|
|
163
|
-
S([i], i.id);
|
|
164
|
-
}, [S]), V = R(() => {
|
|
165
|
-
if (t)
|
|
166
|
-
try {
|
|
167
|
-
localStorage.removeItem(`${c}${t}`);
|
|
168
|
-
} catch {
|
|
169
|
-
}
|
|
170
|
-
delete A.current[t], x();
|
|
171
|
-
}, [t, c, x]);
|
|
172
|
-
ne(() => {
|
|
173
|
-
if (!t || A.current[t]) return;
|
|
174
|
-
A.current[t] = !0;
|
|
175
|
-
const n = r ? h?.get("windows") : null, i = r ? h?.get("active") : null;
|
|
176
|
-
if (n)
|
|
177
|
-
try {
|
|
178
|
-
const a = JSON.parse(decodeURIComponent(n)).map(T), u = i && a.some((P) => P.id === i) ? i : a[0]?.id ?? null;
|
|
179
|
-
Z(a), X(u), $(a, u);
|
|
180
|
-
} catch (l) {
|
|
181
|
-
console.error("[react-workspace] 解析窗口配置失败:", l), x();
|
|
182
|
-
}
|
|
183
|
-
else
|
|
184
|
-
x();
|
|
185
|
-
}, [t, h, r, T, x, $]);
|
|
186
|
-
const N = R(
|
|
187
|
-
(n, i) => {
|
|
188
|
-
const l = i !== void 0 ? { ...n.props, ...i } : n.props, a = { ...n, props: l }, u = v.find((P) => P.type === a.type);
|
|
189
|
-
if (u) {
|
|
190
|
-
const P = i && Object.keys(i).length === 0 ? void 0 : l, F = T({ ...u, ...a, props: P }), Y = v.map((K) => K.id === u.id ? F : K);
|
|
191
|
-
S(Y, u.id);
|
|
192
|
-
} else {
|
|
193
|
-
const P = T({
|
|
194
|
-
...a,
|
|
195
|
-
id: pe(),
|
|
196
|
-
minimized: a.minimized ?? !1
|
|
197
|
-
});
|
|
198
|
-
S([...v, P], P.id);
|
|
199
|
-
}
|
|
200
|
-
},
|
|
201
|
-
[v, S, T]
|
|
202
|
-
), f = R(
|
|
203
|
-
(n) => {
|
|
204
|
-
const i = v.find((l) => l.id === n);
|
|
205
|
-
if (i) {
|
|
206
|
-
if (de(c, t, i.type), i.floating) {
|
|
207
|
-
const l = se(c, t)[i.type];
|
|
208
|
-
if (l?.floatingZIndex) {
|
|
209
|
-
const a = v.map(
|
|
210
|
-
(u) => u.id === n ? { ...u, minimized: !1, floatingZIndex: l.floatingZIndex } : u
|
|
211
|
-
);
|
|
212
|
-
S(a, n);
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
S(
|
|
217
|
-
v.map((l) => l.id === n ? { ...l, minimized: !1 } : l),
|
|
218
|
-
n
|
|
219
|
-
);
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
[v, S, c, t]
|
|
223
|
-
), M = R(
|
|
224
|
-
(n) => {
|
|
225
|
-
const i = v.filter((a) => a.id !== n), l = k === n ? me(i, c, t) : k;
|
|
226
|
-
S(i, l);
|
|
227
|
-
},
|
|
228
|
-
[v, k, S, c, t]
|
|
229
|
-
), y = R(
|
|
230
|
-
(n) => {
|
|
231
|
-
const i = v.map((a) => {
|
|
232
|
-
if (a.id === n) {
|
|
233
|
-
const u = { ...a, minimized: !a.minimized };
|
|
234
|
-
return le(c, t, a.type, {
|
|
235
|
-
minimized: u.minimized,
|
|
236
|
-
floating: u.floating
|
|
237
|
-
}), u;
|
|
238
|
-
}
|
|
239
|
-
return a;
|
|
240
|
-
}), l = i.find((a) => a.id === n);
|
|
241
|
-
if (l?.minimized && k === n && !l.floating) {
|
|
242
|
-
const a = i.find((u) => !u.minimized && !u.floating);
|
|
243
|
-
S(i, a?.id ?? null);
|
|
244
|
-
} else l && !l.minimized && !l.floating ? S(i, n) : S(i, k);
|
|
245
|
-
},
|
|
246
|
-
[v, k, t, c, S]
|
|
247
|
-
), C = R(
|
|
248
|
-
(n, i) => {
|
|
249
|
-
const l = v.find((O) => O.id === n);
|
|
250
|
-
if (!l || !t || l.floating) return;
|
|
251
|
-
const a = v.filter((O) => !O.floating && !O.minimized);
|
|
252
|
-
if (a.length === 1 && a[0].id === n) return;
|
|
253
|
-
const u = D.current, P = { minWidth: u.minWidth, minHeight: u.minHeight };
|
|
254
|
-
let F = ie(
|
|
255
|
-
{ x: u.x, y: u.y, width: u.width, height: u.height },
|
|
256
|
-
P
|
|
257
|
-
);
|
|
258
|
-
if (i)
|
|
259
|
-
F = ie({
|
|
260
|
-
x: i.x,
|
|
261
|
-
y: i.y,
|
|
262
|
-
width: u.width,
|
|
263
|
-
height: u.height
|
|
264
|
-
}, P);
|
|
265
|
-
else if (l.floatingPosition)
|
|
266
|
-
F = ie(l.floatingPosition, P);
|
|
267
|
-
else {
|
|
268
|
-
const O = b(l.type);
|
|
269
|
-
O && (F = ie(O, P));
|
|
270
|
-
}
|
|
271
|
-
de(c, t, l.type);
|
|
272
|
-
const Y = se(c, t)[l.type]?.floatingZIndex ?? 1e3, K = v.map((O) => O.id === n ? (le(c, t, O.type, {
|
|
273
|
-
floating: !0,
|
|
274
|
-
minimized: !1,
|
|
275
|
-
position: F,
|
|
276
|
-
floatingZIndex: Y
|
|
277
|
-
}), {
|
|
278
|
-
...O,
|
|
279
|
-
floating: !0,
|
|
280
|
-
minimized: !1,
|
|
281
|
-
floatingPosition: F,
|
|
282
|
-
floatingZIndex: Y,
|
|
283
|
-
pendingDragStart: i
|
|
284
|
-
}) : O);
|
|
285
|
-
if (k === n) {
|
|
286
|
-
const O = K.filter((J) => !J.floating && !J.minimized);
|
|
287
|
-
S(K, O.length > 0 ? me(O, c, t) : null);
|
|
288
|
-
} else
|
|
289
|
-
S(K, k);
|
|
290
|
-
},
|
|
291
|
-
[v, k, t, c, S, b]
|
|
292
|
-
), W = R(
|
|
293
|
-
(n, i) => {
|
|
294
|
-
const l = v.find((J) => J.id === n);
|
|
295
|
-
if (!l?.floating) return;
|
|
296
|
-
const { floating: a, floatingPosition: u, floatingZIndex: P, pendingDragStart: F, ...Y } = l;
|
|
297
|
-
le(c, t, l.type, {
|
|
298
|
-
floating: !1,
|
|
299
|
-
minimized: Y.minimized
|
|
300
|
-
});
|
|
301
|
-
const K = v.filter((J) => !J.floating);
|
|
302
|
-
let O;
|
|
303
|
-
i !== void 0 && i >= 0 && i <= K.length ? O = [...K.slice(0, i), Y, ...K.slice(i)] : O = [...K, Y], O = [...O, ...v.filter((J) => J.floating && J.id !== n)], S(O, n), setTimeout(() => {
|
|
304
|
-
document.querySelector(".rw-window-tabs")?.dispatchEvent(new CustomEvent("clearFloatingWindowPreview"));
|
|
305
|
-
}, 0);
|
|
306
|
-
},
|
|
307
|
-
[v, S, c, t]
|
|
308
|
-
), z = R(
|
|
309
|
-
(n, i) => {
|
|
310
|
-
const l = v.find((u) => u.id === n);
|
|
311
|
-
if (!l) return;
|
|
312
|
-
const a = v.map((u) => {
|
|
313
|
-
if (u.id === n) {
|
|
314
|
-
const { pendingDragStart: P, ...F } = u;
|
|
315
|
-
return { ...F, floatingPosition: i };
|
|
316
|
-
}
|
|
317
|
-
return u;
|
|
318
|
-
});
|
|
319
|
-
Z(a), l.floating && le(c, t, l.type, {
|
|
320
|
-
position: i,
|
|
321
|
-
floating: !0,
|
|
322
|
-
minimized: l.minimized,
|
|
323
|
-
floatingZIndex: l.floatingZIndex
|
|
324
|
-
});
|
|
325
|
-
},
|
|
326
|
-
[v, t, c]
|
|
327
|
-
), I = R(
|
|
328
|
-
(n) => {
|
|
329
|
-
const i = v.find((a) => a.id === n);
|
|
330
|
-
if (!i?.floating || !t) return;
|
|
331
|
-
de(c, t, i.type);
|
|
332
|
-
const l = se(c, t)[i.type];
|
|
333
|
-
l?.floatingZIndex && Z(
|
|
334
|
-
(a) => a.map(
|
|
335
|
-
(u) => u.id === n && u.floating ? { ...u, floatingZIndex: l.floatingZIndex } : u
|
|
336
|
-
)
|
|
337
|
-
);
|
|
338
|
-
},
|
|
339
|
-
[v, t, c]
|
|
340
|
-
), E = R(
|
|
341
|
-
(n, i) => {
|
|
342
|
-
Z((l) => {
|
|
343
|
-
const a = l.map(
|
|
344
|
-
(u) => u.id === n ? { ...u, props: { ...u.props, ...i } } : u
|
|
345
|
-
);
|
|
346
|
-
return $(a, k), a;
|
|
347
|
-
});
|
|
348
|
-
},
|
|
349
|
-
[k, $]
|
|
350
|
-
), B = R(
|
|
351
|
-
(n, i) => {
|
|
352
|
-
Z((l) => {
|
|
353
|
-
const a = l.map((u) => u.id === n ? { ...u, title: i } : u);
|
|
354
|
-
return L(a, k), $(a, k), a;
|
|
355
|
-
});
|
|
356
|
-
},
|
|
357
|
-
[k, L, $]
|
|
358
|
-
), j = R(
|
|
359
|
-
(n) => {
|
|
360
|
-
Z(
|
|
361
|
-
(i) => i.map((l) => {
|
|
362
|
-
if (l.id !== n) return l;
|
|
363
|
-
const { pendingAction: a, ...u } = l;
|
|
364
|
-
return u;
|
|
365
|
-
})
|
|
366
|
-
);
|
|
367
|
-
},
|
|
368
|
-
[]
|
|
369
|
-
), G = R(
|
|
370
|
-
(n) => {
|
|
371
|
-
if (n === "reset-windows") {
|
|
372
|
-
V();
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
if (!k && !["close-all", "minimize-all", "restore-all"].includes(n)) return;
|
|
376
|
-
const i = v.filter((P) => !P.floating), l = v.filter((P) => P.floating);
|
|
377
|
-
let a = [], u = k;
|
|
378
|
-
switch (n) {
|
|
379
|
-
case "close-left": {
|
|
380
|
-
const P = i.findIndex((F) => F.id === k);
|
|
381
|
-
a = i.slice(P);
|
|
382
|
-
break;
|
|
383
|
-
}
|
|
384
|
-
case "close-right": {
|
|
385
|
-
const P = i.findIndex((F) => F.id === k);
|
|
386
|
-
a = i.slice(0, P + 1);
|
|
387
|
-
break;
|
|
388
|
-
}
|
|
389
|
-
case "close-others":
|
|
390
|
-
a = i.filter((P) => P.id === k);
|
|
391
|
-
break;
|
|
392
|
-
case "close-all":
|
|
393
|
-
a = [], u = null;
|
|
394
|
-
break;
|
|
395
|
-
case "minimize-all":
|
|
396
|
-
a = i.map((P) => ({ ...P, minimized: !0 })), u = null;
|
|
397
|
-
break;
|
|
398
|
-
case "restore-all":
|
|
399
|
-
a = i.map((P) => ({ ...P, minimized: !1 })), u = k ?? a[0]?.id ?? null;
|
|
400
|
-
break;
|
|
401
|
-
default:
|
|
402
|
-
a = i;
|
|
403
|
-
}
|
|
404
|
-
S([...a, ...l], u);
|
|
405
|
-
},
|
|
406
|
-
[v, k, S, V]
|
|
407
|
-
), Q = R(
|
|
408
|
-
(n, i) => {
|
|
409
|
-
const l = v.filter((Y) => !Y.minimized && !Y.floating);
|
|
410
|
-
if (n < 0 || n >= l.length || i < 0 || i >= l.length || n === i) return;
|
|
411
|
-
const a = [...l], [u] = a.splice(n, 1);
|
|
412
|
-
a.splice(i, 0, u);
|
|
413
|
-
let P = 0;
|
|
414
|
-
const F = v.map((Y) => Y.minimized || Y.floating ? Y : a[P++]);
|
|
415
|
-
S(F, k);
|
|
416
|
-
},
|
|
417
|
-
[v, k, S]
|
|
418
|
-
);
|
|
419
|
-
return {
|
|
420
|
-
windows: v,
|
|
421
|
-
activeWindowId: k,
|
|
422
|
-
openWindow: N,
|
|
423
|
-
switchWindow: f,
|
|
424
|
-
closeWindow: M,
|
|
425
|
-
toggleMinimize: y,
|
|
426
|
-
floatWindow: C,
|
|
427
|
-
restoreWindow: W,
|
|
428
|
-
updateFloatingPosition: z,
|
|
429
|
-
focusWindow: I,
|
|
430
|
-
batchManage: G,
|
|
431
|
-
updateWindowProps: E,
|
|
432
|
-
updateWindowTitle: B,
|
|
433
|
-
clearPendingAction: j,
|
|
434
|
-
setWindows: Z,
|
|
435
|
-
setActiveWindowId: X,
|
|
436
|
-
resetWorkspace: V,
|
|
437
|
-
reorderWindows: Q
|
|
438
|
-
};
|
|
439
|
-
}
|
|
440
|
-
const fe = Ne(null), Be = fe.Provider;
|
|
441
|
-
function gt() {
|
|
442
|
-
const e = we(fe);
|
|
443
|
-
if (!e)
|
|
444
|
-
throw new Error("[react-workspace] useWorkspaceContext 必须在 Workspace 或 WorkspaceProvider 内使用");
|
|
445
|
-
return e;
|
|
446
|
-
}
|
|
447
|
-
function mt() {
|
|
448
|
-
return we(fe);
|
|
449
|
-
}
|
|
450
|
-
const re = (e) => ({ width: e, height: e, viewBox: "0 0 24 24", fill: "currentColor" }), ye = ({ size: e = 14, className: t }) => /* @__PURE__ */ s("svg", { ...re(e), className: t, children: /* @__PURE__ */ s("path", { d: "M6 6l12 12M18 6L6 18", stroke: "currentColor", strokeWidth: "2", fill: "none" }) }), Oe = ({ size: e = 14, className: t }) => /* @__PURE__ */ s("svg", { ...re(e), className: t, children: /* @__PURE__ */ s("path", { d: "M5 12h14", stroke: "currentColor", strokeWidth: "2", fill: "none" }) }), He = ({ size: e = 14, className: t }) => /* @__PURE__ */ s("svg", { ...re(e), className: t, children: /* @__PURE__ */ s("rect", { x: "5", y: "5", width: "14", height: "14", rx: "1", stroke: "currentColor", strokeWidth: "2", fill: "none" }) }), Xe = ({ size: e = 16, className: t }) => /* @__PURE__ */ q("svg", { ...re(e), className: t, children: [
|
|
451
|
-
/* @__PURE__ */ s("circle", { cx: "6", cy: "12", r: "1.5" }),
|
|
452
|
-
/* @__PURE__ */ s("circle", { cx: "12", cy: "12", r: "1.5" }),
|
|
453
|
-
/* @__PURE__ */ s("circle", { cx: "18", cy: "12", r: "1.5" })
|
|
454
|
-
] }), Le = ({ size: e = 12, className: t }) => /* @__PURE__ */ s("svg", { ...re(e), className: t, children: /* @__PURE__ */ s("path", { d: "M9 6l6 6-6 6", stroke: "currentColor", strokeWidth: "2", fill: "none" }) }), Ae = ({ size: e = 12, className: t }) => /* @__PURE__ */ s("svg", { ...re(e), className: t, children: /* @__PURE__ */ s("path", { d: "M15 6l-6 6 6 6", stroke: "currentColor", strokeWidth: "2", fill: "none" }) }), Fe = ({ size: e = 64, className: t }) => /* @__PURE__ */ s("svg", { ...re(e), className: t, fill: "none", stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ s("path", { d: "M3 7a2 2 0 012-2h5l2 2h9a2 2 0 012 2v8a2 2 0 01-2 2H5a2 2 0 01-2-2V7z" }) }), Ye = ({ size: e = 12, className: t }) => /* @__PURE__ */ s("svg", { ...re(e), className: t, children: /* @__PURE__ */ s("path", { d: "M6 9l6 6 6-6", stroke: "currentColor", strokeWidth: "2", fill: "none" }) });
|
|
455
|
-
function _e(e, t) {
|
|
456
|
-
for (const o of e) {
|
|
457
|
-
if ("type" in o && o.type === "divider") continue;
|
|
458
|
-
const r = o;
|
|
459
|
-
if (r.key === t) return r;
|
|
460
|
-
if (r.children) {
|
|
461
|
-
const m = _e(r.children, t);
|
|
462
|
-
if (m) return m;
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
return null;
|
|
466
|
-
}
|
|
467
|
-
function Ue(e, t, o) {
|
|
468
|
-
const r = (m) => {
|
|
469
|
-
for (const h of m) {
|
|
470
|
-
if ("type" in h && h.type === "divider") continue;
|
|
471
|
-
const p = h;
|
|
472
|
-
if (p.windowType === t)
|
|
473
|
-
return typeof p.label == "string" ? p.label : p.key;
|
|
474
|
-
if (p.children) {
|
|
475
|
-
const c = r(p.children);
|
|
476
|
-
if (c) return c;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
return null;
|
|
480
|
-
};
|
|
481
|
-
return r(e) ?? o ?? t;
|
|
482
|
-
}
|
|
483
|
-
function ve(e, t) {
|
|
484
|
-
for (const o of e) {
|
|
485
|
-
if ("type" in o && o.type === "divider") continue;
|
|
486
|
-
const r = o;
|
|
487
|
-
if (r.windowType === t) return r.key;
|
|
488
|
-
if (r.children) {
|
|
489
|
-
const m = ve(r.children, t);
|
|
490
|
-
if (m) return m;
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
return null;
|
|
494
|
-
}
|
|
495
|
-
function qe(e) {
|
|
496
|
-
const t = [];
|
|
497
|
-
for (const o of e) {
|
|
498
|
-
if ("type" in o && o.type === "divider") continue;
|
|
499
|
-
const r = o;
|
|
500
|
-
r.children?.length && t.push(r.key);
|
|
501
|
-
}
|
|
502
|
-
return t;
|
|
503
|
-
}
|
|
504
|
-
function be(e) {
|
|
505
|
-
return typeof e == "string" || typeof e == "number" ? String(e) : "";
|
|
506
|
-
}
|
|
507
|
-
function je(e) {
|
|
508
|
-
return "type" in e && e.type === "divider";
|
|
509
|
-
}
|
|
510
|
-
const Ke = ({
|
|
511
|
-
menuItems: e,
|
|
512
|
-
onMenuClick: t,
|
|
513
|
-
onAction: o,
|
|
514
|
-
activeWindowType: r,
|
|
515
|
-
header: m,
|
|
516
|
-
footer: h,
|
|
517
|
-
defaultOpenKeys: p = [],
|
|
518
|
-
siderWidth: c = 240,
|
|
519
|
-
onCollapsedChange: d
|
|
520
|
-
}) => {
|
|
521
|
-
const [w, _] = ee(!1), [D, H] = ee(new Set(p)), v = oe(() => r ? ve(e, r) : null, [r, e]), Z = () => {
|
|
522
|
-
_((g) => (d?.(!g), !g));
|
|
523
|
-
}, k = (g, b) => {
|
|
524
|
-
b?.stopPropagation(), H((L) => {
|
|
525
|
-
const S = new Set(L);
|
|
526
|
-
return S.has(g) ? S.delete(g) : S.add(g), S;
|
|
527
|
-
});
|
|
528
|
-
}, X = (g) => {
|
|
529
|
-
if (!g.disabled) {
|
|
530
|
-
if (g.windowType) {
|
|
531
|
-
t(g.windowType, g.props);
|
|
532
|
-
return;
|
|
533
|
-
}
|
|
534
|
-
if (g.action && o) {
|
|
535
|
-
o(g.action);
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
g.children?.length && k(g.key);
|
|
539
|
-
}
|
|
540
|
-
}, A = (g, b = 0) => g.map((L, S) => {
|
|
541
|
-
if (je(L))
|
|
542
|
-
return /* @__PURE__ */ s("div", { className: "rw-menu-divider" }, L.key ?? `div-${S}`);
|
|
543
|
-
const T = L, x = !!T.children?.length, V = D.has(T.key), N = T.key === v;
|
|
544
|
-
return /* @__PURE__ */ q("div", { className: "rw-menu-group", children: [
|
|
545
|
-
/* @__PURE__ */ q(
|
|
546
|
-
"button",
|
|
547
|
-
{
|
|
548
|
-
type: "button",
|
|
549
|
-
className: `rw-menu-item ${N ? "selected" : ""} ${T.disabled ? "disabled" : ""}`,
|
|
550
|
-
style: { paddingLeft: w ? 12 : 12 + b * 16 },
|
|
551
|
-
onClick: () => X(T),
|
|
552
|
-
disabled: T.disabled,
|
|
553
|
-
title: w ? be(T.label) : void 0,
|
|
554
|
-
children: [
|
|
555
|
-
T.icon && /* @__PURE__ */ s("span", { className: "rw-menu-icon", children: T.icon }),
|
|
556
|
-
!w && /* @__PURE__ */ s("span", { className: "rw-menu-label", children: T.label }),
|
|
557
|
-
!w && x && /* @__PURE__ */ s(
|
|
558
|
-
"span",
|
|
559
|
-
{
|
|
560
|
-
className: `rw-menu-arrow ${V ? "open" : ""}`,
|
|
561
|
-
onClick: (f) => k(T.key, f),
|
|
562
|
-
role: "presentation",
|
|
563
|
-
children: /* @__PURE__ */ s(Ye, { size: 10 })
|
|
564
|
-
}
|
|
565
|
-
)
|
|
566
|
-
]
|
|
567
|
-
}
|
|
568
|
-
),
|
|
569
|
-
!w && x && V && /* @__PURE__ */ s("div", { className: "rw-menu-children", children: A(T.children, b + 1) })
|
|
570
|
-
] }, T.key);
|
|
571
|
-
}), $ = w ? 64 : c;
|
|
572
|
-
return /* @__PURE__ */ q("div", { className: "rw-workspace-sidebar-wrapper", children: [
|
|
573
|
-
/* @__PURE__ */ q("aside", { className: "rw-workspace-sider", style: { width: $ }, children: [
|
|
574
|
-
m && /* @__PURE__ */ s("div", { className: `rw-workspace-sidebar-header ${w ? "collapsed" : ""}`, children: m }),
|
|
575
|
-
/* @__PURE__ */ s("nav", { className: "rw-workspace-sidebar-menu", children: A(e) }),
|
|
576
|
-
h && /* @__PURE__ */ s("div", { className: `rw-workspace-sidebar-footer ${w ? "collapsed" : ""}`, children: h })
|
|
577
|
-
] }),
|
|
578
|
-
/* @__PURE__ */ s(
|
|
579
|
-
"button",
|
|
580
|
-
{
|
|
581
|
-
type: "button",
|
|
582
|
-
className: "rw-workspace-collapse-button",
|
|
583
|
-
style: { left: $ },
|
|
584
|
-
onClick: Z,
|
|
585
|
-
title: w ? "展开导航" : "折叠导航",
|
|
586
|
-
children: w ? /* @__PURE__ */ s(Ae, {}) : /* @__PURE__ */ s(Le, {})
|
|
587
|
-
}
|
|
588
|
-
)
|
|
589
|
-
] });
|
|
590
|
-
}, Je = ({
|
|
591
|
-
description: e = "暂无内容",
|
|
592
|
-
icon: t
|
|
593
|
-
}) => /* @__PURE__ */ q("div", { className: "rw-empty", children: [
|
|
594
|
-
/* @__PURE__ */ s("div", { className: "rw-empty-icon", children: t ?? /* @__PURE__ */ s(Fe, { size: 64 }) }),
|
|
595
|
-
/* @__PURE__ */ s("div", { className: "rw-empty-desc", children: e })
|
|
596
|
-
] }), Ve = ({ window: e, active: t, children: o }) => /* @__PURE__ */ s(
|
|
597
|
-
"div",
|
|
598
|
-
{
|
|
599
|
-
className: `rw-window-container ${t ? "active" : ""}`,
|
|
600
|
-
style: { display: t ? "flex" : "none", height: "100%", overflow: "auto", flexDirection: "column" },
|
|
601
|
-
"data-window-type": e.type,
|
|
602
|
-
children: o
|
|
603
|
-
}
|
|
604
|
-
), Ge = ({ items: e, trigger: t, className: o }) => {
|
|
605
|
-
const [r, m] = ee(!1), h = U(null);
|
|
606
|
-
return ne(() => {
|
|
607
|
-
if (!r) return;
|
|
608
|
-
const p = (c) => {
|
|
609
|
-
h.current?.contains(c.target) || m(!1);
|
|
610
|
-
};
|
|
611
|
-
return document.addEventListener("mousedown", p), () => document.removeEventListener("mousedown", p);
|
|
612
|
-
}, [r]), /* @__PURE__ */ q("div", { className: `rw-dropdown ${o || ""}`, ref: h, children: [
|
|
613
|
-
/* @__PURE__ */ s("div", { className: "rw-dropdown-trigger", onClick: () => m((p) => !p), role: "button", tabIndex: 0, children: t }),
|
|
614
|
-
r && /* @__PURE__ */ s("div", { className: "rw-dropdown-menu", children: e.map(
|
|
615
|
-
(p) => p.divider ? /* @__PURE__ */ s("div", { className: "rw-dropdown-divider" }, p.key) : /* @__PURE__ */ s(
|
|
616
|
-
"button",
|
|
617
|
-
{
|
|
618
|
-
type: "button",
|
|
619
|
-
className: "rw-dropdown-item",
|
|
620
|
-
disabled: p.disabled,
|
|
621
|
-
onClick: () => {
|
|
622
|
-
p.onClick?.(), m(!1);
|
|
623
|
-
},
|
|
624
|
-
children: p.label
|
|
625
|
-
},
|
|
626
|
-
p.key
|
|
627
|
-
)
|
|
628
|
-
) })
|
|
629
|
-
] });
|
|
630
|
-
}, Qe = ({
|
|
631
|
-
windows: e,
|
|
632
|
-
activeWindowId: t,
|
|
633
|
-
onSwitchWindow: o,
|
|
634
|
-
onCloseWindow: r,
|
|
635
|
-
onToggleMinimize: m,
|
|
636
|
-
onBatchManage: h,
|
|
637
|
-
onFloatWindow: p,
|
|
638
|
-
onRestoreWindow: c,
|
|
639
|
-
onReorderWindows: d,
|
|
640
|
-
embedded: w = !1,
|
|
641
|
-
themeClassName: _,
|
|
642
|
-
allWindows: D = e
|
|
643
|
-
}) => {
|
|
644
|
-
const H = e.findIndex((N) => N.id === t), v = U(null), Z = U(null), [k, X] = ee(null), [A, $] = ee(null), g = U({ windowId: "", startX: 0, startY: 0, fromIndex: -1, mode: "none", floated: !1 }), b = R((N) => {
|
|
645
|
-
const f = Z.current;
|
|
646
|
-
if (!f) return e.length;
|
|
647
|
-
const M = f.getBoundingClientRect(), y = N - M.left, C = f.querySelectorAll(".rw-tab-item");
|
|
648
|
-
if (y < 8) return 0;
|
|
649
|
-
for (let W = 0; W < C.length; W++) {
|
|
650
|
-
const z = C[W].getBoundingClientRect(), I = z.left - M.left + z.width / 2;
|
|
651
|
-
if (y < I) return W;
|
|
652
|
-
}
|
|
653
|
-
return C.length;
|
|
654
|
-
}, [e.length]), L = R(
|
|
655
|
-
(N, f, M) => {
|
|
656
|
-
if (N.target.closest(".rw-window-tab-close-btn") || N.button !== 0) return;
|
|
657
|
-
g.current = { windowId: f, startX: N.clientX, startY: N.clientY, fromIndex: M, mode: "none", floated: !1 };
|
|
658
|
-
const y = (z) => {
|
|
659
|
-
const I = z.clientX - g.current.startX, E = z.clientY - g.current.startY, B = Math.sqrt(I * I + E * E);
|
|
660
|
-
B < 8 || (g.current.mode === "none" && (Math.abs(E) > 40 && B > 50 ? g.current.mode = "float" : Math.abs(I) > 12 && Math.abs(I) > Math.abs(E) ? g.current.mode = "reorder" : B > 50 && (g.current.mode = "float")), g.current.mode === "float" && g.current.windowId === f ? g.current.floated || (g.current.floated = !0, p?.(f, { x: z.clientX, y: z.clientY })) : g.current.mode === "reorder" && X(b(z.clientX)));
|
|
661
|
-
}, C = (z) => {
|
|
662
|
-
if (g.current.mode === "reorder" && g.current.windowId === f) {
|
|
663
|
-
let E = b(z.clientX);
|
|
664
|
-
E > g.current.fromIndex && (E -= 1), E !== g.current.fromIndex && d && d(g.current.fromIndex, E);
|
|
665
|
-
}
|
|
666
|
-
X(null), W();
|
|
667
|
-
}, W = () => {
|
|
668
|
-
document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", C), g.current = { windowId: "", startX: 0, startY: 0, fromIndex: -1, mode: "none", floated: !1 };
|
|
669
|
-
};
|
|
670
|
-
document.addEventListener("mousemove", y), document.addEventListener("mouseup", C);
|
|
671
|
-
},
|
|
672
|
-
[p, d, b]
|
|
673
|
-
);
|
|
674
|
-
ne(() => {
|
|
675
|
-
let N = null;
|
|
676
|
-
const f = (C) => {
|
|
677
|
-
const { windowTitle: W, clientX: z } = C.detail, I = b(z);
|
|
678
|
-
N && cancelAnimationFrame(N), N = requestAnimationFrame(() => {
|
|
679
|
-
$({ title: W, index: I }), X(I);
|
|
680
|
-
});
|
|
681
|
-
}, M = () => {
|
|
682
|
-
$(null), X(null);
|
|
683
|
-
}, y = v.current;
|
|
684
|
-
return y?.addEventListener("floatingWindowDragOver", f), y?.addEventListener("clearFloatingWindowPreview", M), () => {
|
|
685
|
-
y?.removeEventListener("floatingWindowDragOver", f), y?.removeEventListener("clearFloatingWindowPreview", M), N && cancelAnimationFrame(N);
|
|
686
|
-
};
|
|
687
|
-
}, [b]);
|
|
688
|
-
const S = () => {
|
|
689
|
-
const N = e.map((f, M) => /* @__PURE__ */ q(
|
|
690
|
-
"div",
|
|
691
|
-
{
|
|
692
|
-
className: `rw-tab-item ${f.id === t ? "active" : ""}`,
|
|
693
|
-
onClick: () => o(f.id),
|
|
694
|
-
onMouseDown: (y) => L(y, f.id, M),
|
|
695
|
-
children: [
|
|
696
|
-
/* @__PURE__ */ s("span", { className: "rw-tab-title", children: f.title }),
|
|
697
|
-
/* @__PURE__ */ s(
|
|
698
|
-
"button",
|
|
699
|
-
{
|
|
700
|
-
type: "button",
|
|
701
|
-
title: "关闭",
|
|
702
|
-
className: "rw-icon-btn rw-window-tab-close-btn",
|
|
703
|
-
onClick: (y) => {
|
|
704
|
-
y.stopPropagation(), r(f.id);
|
|
705
|
-
},
|
|
706
|
-
children: /* @__PURE__ */ s(ye, { size: 12 })
|
|
707
|
-
}
|
|
708
|
-
)
|
|
709
|
-
]
|
|
710
|
-
},
|
|
711
|
-
f.id
|
|
712
|
-
));
|
|
713
|
-
if (A && k !== null) {
|
|
714
|
-
const f = Math.max(0, Math.min(k, N.length));
|
|
715
|
-
N.splice(f, 0, /* @__PURE__ */ s("div", { className: "rw-tab-preview", children: A.title }, "rw-preview"));
|
|
716
|
-
}
|
|
717
|
-
return N;
|
|
718
|
-
}, T = (N) => {
|
|
719
|
-
N.preventDefault();
|
|
720
|
-
try {
|
|
721
|
-
const f = sessionStorage.getItem("draggingWindowTitle");
|
|
722
|
-
f && $({ title: f, index: b(N.clientX) });
|
|
723
|
-
} catch {
|
|
724
|
-
}
|
|
725
|
-
X(b(N.clientX));
|
|
726
|
-
}, x = (N) => {
|
|
727
|
-
N.preventDefault();
|
|
728
|
-
let f = N.dataTransfer.getData("windowId") || "";
|
|
729
|
-
if (!f)
|
|
730
|
-
try {
|
|
731
|
-
f = sessionStorage.getItem("draggingWindowId") || "";
|
|
732
|
-
} catch {
|
|
733
|
-
}
|
|
734
|
-
f && c && c(f, k ?? void 0), $(null), X(null);
|
|
735
|
-
}, V = [
|
|
736
|
-
{ key: "close-others", label: "关闭其他", disabled: e.length <= 1, onClick: () => h("close-others") },
|
|
737
|
-
{ key: "close-left", label: "关闭左侧", disabled: H <= 0, onClick: () => h("close-left") },
|
|
738
|
-
{ key: "close-right", label: "关闭右侧", disabled: H < 0 || H >= e.length - 1, onClick: () => h("close-right") },
|
|
739
|
-
{ key: "d1", label: "", divider: !0 },
|
|
740
|
-
{ key: "close-all", label: "关闭全部", disabled: !e.length, onClick: () => h("close-all") },
|
|
741
|
-
{ key: "d2", label: "", divider: !0 },
|
|
742
|
-
{ key: "minimize-all", label: "最小化全部", disabled: !e.length, onClick: () => h("minimize-all") },
|
|
743
|
-
{ key: "restore-all", label: "还原全部", disabled: !D.some((N) => N.minimized), onClick: () => h("restore-all") },
|
|
744
|
-
{ key: "d3", label: "", divider: !0 },
|
|
745
|
-
{ key: "reset", label: "重置窗口", onClick: () => h("reset-windows") }
|
|
746
|
-
];
|
|
747
|
-
return /* @__PURE__ */ s(
|
|
748
|
-
"div",
|
|
749
|
-
{
|
|
750
|
-
className: `rw-window-tabs ${w ? "rw-tabs-embedded" : ""} ${_ || ""}`,
|
|
751
|
-
ref: v,
|
|
752
|
-
onDragOver: T,
|
|
753
|
-
onDragLeave: () => {
|
|
754
|
-
$(null), X(null);
|
|
755
|
-
},
|
|
756
|
-
onDrop: x,
|
|
757
|
-
children: /* @__PURE__ */ q("div", { className: "rw-window-tabs-container", children: [
|
|
758
|
-
/* @__PURE__ */ s("div", { className: "rw-tab-list", ref: Z, children: S() }),
|
|
759
|
-
k !== null && !A && /* @__PURE__ */ s(et, { listRef: Z, index: k }),
|
|
760
|
-
e.length > 0 && /* @__PURE__ */ s(
|
|
761
|
-
Ge,
|
|
762
|
-
{
|
|
763
|
-
items: V,
|
|
764
|
-
trigger: /* @__PURE__ */ s("button", { type: "button", className: "rw-icon-btn rw-window-tabs-batch-btn", title: "批量管理", children: /* @__PURE__ */ s(Xe, {}) })
|
|
765
|
-
}
|
|
766
|
-
)
|
|
767
|
-
] })
|
|
768
|
-
}
|
|
769
|
-
);
|
|
770
|
-
}, et = ({ listRef: e, index: t }) => {
|
|
771
|
-
const [o, r] = ee(0);
|
|
772
|
-
return ne(() => {
|
|
773
|
-
const m = () => {
|
|
774
|
-
const h = e.current;
|
|
775
|
-
if (!h) return;
|
|
776
|
-
h.getBoundingClientRect();
|
|
777
|
-
const p = h.querySelectorAll(".rw-tab-item:not(.rw-tab-preview)");
|
|
778
|
-
if (t === 0) {
|
|
779
|
-
r(8);
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
if (t >= p.length) {
|
|
783
|
-
const d = p[p.length - 1];
|
|
784
|
-
r(d.offsetLeft + d.offsetWidth + 2);
|
|
785
|
-
return;
|
|
786
|
-
}
|
|
787
|
-
const c = p[t];
|
|
788
|
-
r(c.offsetLeft - 1);
|
|
789
|
-
};
|
|
790
|
-
return m(), window.addEventListener("resize", m), () => window.removeEventListener("resize", m);
|
|
791
|
-
}, [e, t]), /* @__PURE__ */ s("div", { className: "rw-window-tab-insert-indicator", style: { left: `${o}px` } });
|
|
792
|
-
}, tt = {
|
|
793
|
-
x: 100,
|
|
794
|
-
y: 100,
|
|
795
|
-
width: 800,
|
|
796
|
-
height: 600,
|
|
797
|
-
minWidth: 400,
|
|
798
|
-
minHeight: 300
|
|
799
|
-
}, nt = ({
|
|
800
|
-
window: e,
|
|
801
|
-
children: t,
|
|
802
|
-
floatingDefaults: o,
|
|
803
|
-
onUpdateFloatingPosition: r,
|
|
804
|
-
onRestoreWindow: m,
|
|
805
|
-
onCloseWindow: h,
|
|
806
|
-
onToggleMinimize: p,
|
|
807
|
-
onFocusWindow: c
|
|
808
|
-
}) => {
|
|
809
|
-
const d = { ...tt, ...o }, w = U(null), _ = U(null), [D, H] = ee(!1), [v, Z] = ee(!1), [k, X] = ee(!1), A = U(!1), $ = U(""), g = U({ x: 0, y: 0, startX: 0, startY: 0, startWidth: 0, startHeight: 0 }), b = U({ x: 0, y: 0, width: 0, height: 0, startX: 0, startY: 0 }), L = U(null), S = U(null), T = U(null), x = e.floatingPosition || { x: d.x, y: d.y, width: d.width, height: d.height };
|
|
810
|
-
ne(() => {
|
|
811
|
-
if (!e.pendingDragStart || D || v) return;
|
|
812
|
-
let f = x.x, M = x.y;
|
|
813
|
-
if (w.current) {
|
|
814
|
-
const y = w.current.getBoundingClientRect();
|
|
815
|
-
f = y.left, M = y.top;
|
|
816
|
-
}
|
|
817
|
-
c?.(e.id), T.current = { windowId: e.id, windowTitle: e.title };
|
|
818
|
-
try {
|
|
819
|
-
sessionStorage.setItem("draggingWindowId", e.id), sessionStorage.setItem("draggingWindowTitle", e.title);
|
|
820
|
-
} catch {
|
|
821
|
-
}
|
|
822
|
-
H(!0), g.current = {
|
|
823
|
-
x: e.pendingDragStart.x - f,
|
|
824
|
-
y: e.pendingDragStart.y - M,
|
|
825
|
-
startX: f,
|
|
826
|
-
startY: M,
|
|
827
|
-
startWidth: x.width,
|
|
828
|
-
startHeight: x.height
|
|
829
|
-
};
|
|
830
|
-
}, [e.pendingDragStart, e.id, e.title, D, v, x, c]), ne(() => {
|
|
831
|
-
if (D || v || e.pendingDragStart) return;
|
|
832
|
-
const f = { minWidth: d.minWidth, minHeight: d.minHeight }, M = ie(x, f);
|
|
833
|
-
(M.x !== x.x || M.y !== x.y || M.width !== x.width || M.height !== x.height) && r(e.id, M);
|
|
834
|
-
}, [e.id, e.pendingDragStart]), ne(() => {
|
|
835
|
-
if (!w.current || D || v) return;
|
|
836
|
-
const f = w.current;
|
|
837
|
-
f.style.transform = `translate(${x.x}px, ${x.y}px)`, f.style.width = `${x.width}px`, f.style.height = `${x.height}px`;
|
|
838
|
-
}, [x.x, x.y, x.width, x.height, D, v]);
|
|
839
|
-
const V = R((f) => {
|
|
840
|
-
const M = f.target;
|
|
841
|
-
if (M.closest(".rw-floating-window-action-btn") || M.closest(".rw-floating-window-resize-handle") || !_.current?.contains(M)) return;
|
|
842
|
-
c?.(e.id);
|
|
843
|
-
let y = x.x, C = x.y;
|
|
844
|
-
if (w.current) {
|
|
845
|
-
const W = w.current.getBoundingClientRect();
|
|
846
|
-
y = W.left, C = W.top;
|
|
847
|
-
}
|
|
848
|
-
T.current = { windowId: e.id, windowTitle: e.title };
|
|
849
|
-
try {
|
|
850
|
-
sessionStorage.setItem("draggingWindowId", e.id), sessionStorage.setItem("draggingWindowTitle", e.title);
|
|
851
|
-
} catch {
|
|
852
|
-
}
|
|
853
|
-
H(!0), g.current = { x: f.clientX - y, y: f.clientY - C, startX: y, startY: C, startWidth: x.width, startHeight: x.height };
|
|
854
|
-
}, [x, e.id, e.title, c]), N = R((f, M) => {
|
|
855
|
-
f.stopPropagation(), f.preventDefault(), c?.(e.id);
|
|
856
|
-
let y = x.x, C = x.y, W = x.width, z = x.height;
|
|
857
|
-
if (w.current) {
|
|
858
|
-
const I = w.current.getBoundingClientRect();
|
|
859
|
-
y = I.left, C = I.top, W = I.width, z = I.height;
|
|
860
|
-
}
|
|
861
|
-
Z(!0), $.current = M, b.current = { x: f.clientX, y: f.clientY, width: W, height: z, startX: y, startY: C };
|
|
862
|
-
}, [x, e.id, c]);
|
|
863
|
-
return ne(() => {
|
|
864
|
-
const f = (y) => {
|
|
865
|
-
if (D) {
|
|
866
|
-
y.preventDefault();
|
|
867
|
-
const C = document.querySelector(".rw-window-tabs");
|
|
868
|
-
if (C && T.current) {
|
|
869
|
-
const B = C.getBoundingClientRect(), j = y.clientY >= B.top && y.clientY <= B.bottom && y.clientX >= B.left && y.clientX <= B.right, G = A.current;
|
|
870
|
-
X(j), A.current = j, j ? C.dispatchEvent(new CustomEvent("floatingWindowDragOver", { detail: { ...T.current, clientX: y.clientX, clientY: y.clientY } })) : G && C.dispatchEvent(new CustomEvent("clearFloatingWindowPreview"));
|
|
871
|
-
}
|
|
872
|
-
const W = g.current.startWidth, z = g.current.startHeight, I = Math.max(0, Math.min(y.clientX - g.current.x, globalThis.window.innerWidth - W)), E = Math.max(0, Math.min(y.clientY - g.current.y, globalThis.window.innerHeight - z));
|
|
873
|
-
w.current.style.transform = `translate(${I}px, ${E}px)`, S.current = { x: I, y: E, width: g.current.startWidth, height: g.current.startHeight };
|
|
874
|
-
} else if (v) {
|
|
875
|
-
y.preventDefault();
|
|
876
|
-
const C = $.current, W = b.current;
|
|
877
|
-
let z = W.startX, I = W.startY, E = W.width, B = W.height;
|
|
878
|
-
const j = y.clientX - W.x, G = y.clientY - W.y;
|
|
879
|
-
C.includes("e") && (E = Math.max(d.minWidth, W.width + j)), C.includes("w") && (E = Math.max(d.minWidth, W.width - j), z = W.startX + W.width - E), C.includes("s") && (B = Math.max(d.minHeight, W.height + G)), C.includes("n") && (B = Math.max(d.minHeight, W.height - G), I = W.startY + W.height - B);
|
|
880
|
-
const Q = w.current;
|
|
881
|
-
Q.style.transform = `translate(${z}px, ${I}px)`, Q.style.width = `${E}px`, Q.style.height = `${B}px`, S.current = { x: z, y: I, width: E, height: B };
|
|
882
|
-
}
|
|
883
|
-
}, M = (y) => {
|
|
884
|
-
if (y && T.current) {
|
|
885
|
-
const W = document.querySelector(".rw-window-tabs");
|
|
886
|
-
if (W) {
|
|
887
|
-
const z = W.getBoundingClientRect();
|
|
888
|
-
if (y.clientY >= z.top && y.clientY <= z.bottom && y.clientX >= z.left && y.clientX <= z.right) {
|
|
889
|
-
const I = W.querySelector(".rw-tab-list");
|
|
890
|
-
if (I) {
|
|
891
|
-
let E = I.querySelectorAll(".rw-tab-item").length;
|
|
892
|
-
const B = I.getBoundingClientRect(), j = y.clientX - B.left;
|
|
893
|
-
I.querySelectorAll(".rw-tab-item").forEach((G, Q) => {
|
|
894
|
-
const n = G.getBoundingClientRect();
|
|
895
|
-
j < n.left - B.left + n.width / 2 && (E = Math.min(E, Q));
|
|
896
|
-
}), m(T.current.windowId, E), T.current = null, H(!1), Z(!1), X(!1);
|
|
897
|
-
return;
|
|
898
|
-
}
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
}
|
|
902
|
-
let C = S.current;
|
|
903
|
-
C && (C = ie(C, { minWidth: d.minWidth, minHeight: d.minHeight })), C && r(e.id, C), S.current = null, T.current = null;
|
|
904
|
-
try {
|
|
905
|
-
sessionStorage.removeItem("draggingWindowId"), sessionStorage.removeItem("draggingWindowTitle");
|
|
906
|
-
} catch {
|
|
907
|
-
}
|
|
908
|
-
H(!1), Z(!1), X(!1), A.current = !1;
|
|
909
|
-
};
|
|
910
|
-
if (D || v) {
|
|
911
|
-
const y = (C) => {
|
|
912
|
-
L.current && cancelAnimationFrame(L.current), L.current = requestAnimationFrame(() => f(C));
|
|
913
|
-
};
|
|
914
|
-
return document.addEventListener("mousemove", y, { passive: !1 }), document.addEventListener("mouseup", M), document.body.style.userSelect = "none", () => {
|
|
915
|
-
document.removeEventListener("mousemove", y), document.removeEventListener("mouseup", M), document.body.style.userSelect = "";
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
}, [D, v, e.id, d.minWidth, d.minHeight, r, m]), /* @__PURE__ */ q(
|
|
919
|
-
"div",
|
|
920
|
-
{
|
|
921
|
-
ref: w,
|
|
922
|
-
className: "rw-floating-window",
|
|
923
|
-
style: {
|
|
924
|
-
transform: `translate(${x.x}px, ${x.y}px)`,
|
|
925
|
-
width: x.width,
|
|
926
|
-
height: x.height,
|
|
927
|
-
zIndex: e.floatingZIndex || 1e3,
|
|
928
|
-
opacity: k ? 0.5 : 1,
|
|
929
|
-
minWidth: d.minWidth,
|
|
930
|
-
minHeight: d.minHeight
|
|
931
|
-
},
|
|
932
|
-
onClick: (f) => {
|
|
933
|
-
f.target.closest("button, a, input, select, textarea") || c?.(e.id);
|
|
934
|
-
},
|
|
935
|
-
children: [
|
|
936
|
-
/* @__PURE__ */ q("div", { ref: _, className: "rw-floating-window-header", onMouseDown: V, onDoubleClick: () => m(e.id), children: [
|
|
937
|
-
/* @__PURE__ */ s("div", { className: "rw-floating-window-title", children: e.title }),
|
|
938
|
-
/* @__PURE__ */ q("div", { className: "rw-floating-window-actions", children: [
|
|
939
|
-
/* @__PURE__ */ s("button", { type: "button", title: "放回", className: "rw-icon-btn rw-floating-window-action-btn", onClick: () => m(e.id), children: /* @__PURE__ */ s(He, { size: 12 }) }),
|
|
940
|
-
/* @__PURE__ */ s("button", { type: "button", title: "最小化", className: "rw-icon-btn rw-floating-window-action-btn", onClick: () => p(e.id), children: /* @__PURE__ */ s(Oe, { size: 12 }) }),
|
|
941
|
-
/* @__PURE__ */ s("button", { type: "button", title: "关闭", className: "rw-icon-btn rw-floating-window-action-btn", onClick: () => h(e.id), children: /* @__PURE__ */ s(ye, { size: 12 }) })
|
|
942
|
-
] })
|
|
943
|
-
] }),
|
|
944
|
-
/* @__PURE__ */ s("div", { className: "rw-floating-window-content", children: t }),
|
|
945
|
-
["nw", "ne", "sw", "se", "n", "s", "w", "e"].map((f) => /* @__PURE__ */ s("div", { className: `rw-floating-window-resize-handle rw-floating-window-resize-${f}`, onMouseDown: (M) => N(M, f) }, f))
|
|
946
|
-
]
|
|
947
|
-
}
|
|
948
|
-
);
|
|
949
|
-
}, it = ({
|
|
950
|
-
windows: e,
|
|
951
|
-
activeWindowId: t,
|
|
952
|
-
renderWindow: o,
|
|
953
|
-
onSwitchWindow: r,
|
|
954
|
-
onCloseWindow: m,
|
|
955
|
-
onToggleMinimize: h,
|
|
956
|
-
onBatchManage: p,
|
|
957
|
-
onFloatWindow: c,
|
|
958
|
-
onRestoreWindow: d,
|
|
959
|
-
onUpdateFloatingPosition: w,
|
|
960
|
-
onFocusWindow: _,
|
|
961
|
-
onReorderWindows: D,
|
|
962
|
-
emptyDescription: H = "从左侧菜单选择功能开始工作",
|
|
963
|
-
floatingDefaults: v,
|
|
964
|
-
tabsContainer: Z,
|
|
965
|
-
themeClassName: k
|
|
966
|
-
}) => {
|
|
967
|
-
if (e.length === 0)
|
|
968
|
-
return /* @__PURE__ */ s("div", { className: "rw-window-manager-empty", children: /* @__PURE__ */ s(Je, { description: H }) });
|
|
969
|
-
const X = e.filter((b) => b.minimized), A = e.filter((b) => b.floating && !b.minimized), $ = e.filter((b) => !b.minimized && !b.floating), g = /* @__PURE__ */ s(
|
|
970
|
-
Qe,
|
|
971
|
-
{
|
|
972
|
-
windows: $,
|
|
973
|
-
activeWindowId: t,
|
|
974
|
-
onSwitchWindow: r,
|
|
975
|
-
onCloseWindow: m,
|
|
976
|
-
onToggleMinimize: h,
|
|
977
|
-
onBatchManage: p,
|
|
978
|
-
onFloatWindow: c,
|
|
979
|
-
onRestoreWindow: d,
|
|
980
|
-
onReorderWindows: D,
|
|
981
|
-
allWindows: e,
|
|
982
|
-
embedded: !!Z,
|
|
983
|
-
themeClassName: k
|
|
984
|
-
}
|
|
985
|
-
);
|
|
986
|
-
return /* @__PURE__ */ q("div", { className: "rw-window-manager", children: [
|
|
987
|
-
Z ? De(g, Z) : g,
|
|
988
|
-
/* @__PURE__ */ s("div", { className: "rw-window-content-area", children: $.map((b) => /* @__PURE__ */ s(Ve, { window: b, active: b.id === t, children: o(b, {}) }, b.id)) }),
|
|
989
|
-
X.length > 0 && /* @__PURE__ */ s("div", { className: "rw-minimized-windows-bar", children: X.map((b) => /* @__PURE__ */ q(
|
|
990
|
-
"div",
|
|
991
|
-
{
|
|
992
|
-
className: "rw-minimized-window-item",
|
|
993
|
-
onClick: () => h(b.id),
|
|
994
|
-
title: b.floating ? `${b.title} (浮动窗口)` : b.title,
|
|
995
|
-
role: "button",
|
|
996
|
-
tabIndex: 0,
|
|
997
|
-
onKeyDown: (L) => L.key === "Enter" && h(b.id),
|
|
998
|
-
children: [
|
|
999
|
-
/* @__PURE__ */ s("span", { children: b.title }),
|
|
1000
|
-
b.floating && /* @__PURE__ */ s("span", { className: "rw-minimized-floating-badge", children: "🔲" })
|
|
1001
|
-
]
|
|
1002
|
-
},
|
|
1003
|
-
b.id
|
|
1004
|
-
)) }),
|
|
1005
|
-
A.map((b) => /* @__PURE__ */ s(
|
|
1006
|
-
nt,
|
|
1007
|
-
{
|
|
1008
|
-
window: b,
|
|
1009
|
-
floatingDefaults: v,
|
|
1010
|
-
onUpdateFloatingPosition: w || (() => {
|
|
1011
|
-
}),
|
|
1012
|
-
onRestoreWindow: d || (() => {
|
|
1013
|
-
}),
|
|
1014
|
-
onCloseWindow: m,
|
|
1015
|
-
onToggleMinimize: h,
|
|
1016
|
-
onFocusWindow: _,
|
|
1017
|
-
children: o(b, {})
|
|
1018
|
-
},
|
|
1019
|
-
b.id
|
|
1020
|
-
))
|
|
1021
|
-
] });
|
|
1022
|
-
};
|
|
1023
|
-
function rt(e) {
|
|
1024
|
-
return "type" in e && e.type === "divider";
|
|
1025
|
-
}
|
|
1026
|
-
function xe(e) {
|
|
1027
|
-
for (const t of e) {
|
|
1028
|
-
if (rt(t)) continue;
|
|
1029
|
-
const o = t;
|
|
1030
|
-
if (o.windowType) return o;
|
|
1031
|
-
if (o.children) {
|
|
1032
|
-
const r = xe(o.children);
|
|
1033
|
-
if (r) return r;
|
|
1034
|
-
}
|
|
1035
|
-
}
|
|
1036
|
-
return null;
|
|
1037
|
-
}
|
|
1038
|
-
function ot(e, t) {
|
|
1039
|
-
if (t) return { minimized: !1, ...t };
|
|
1040
|
-
const o = xe(e);
|
|
1041
|
-
if (!o?.windowType)
|
|
1042
|
-
return { type: "home", title: "首页", minimized: !1 };
|
|
1043
|
-
const r = be(o.label) || o.key;
|
|
1044
|
-
return { type: o.windowType, title: r, minimized: !1 };
|
|
1045
|
-
}
|
|
1046
|
-
function st(e, t) {
|
|
1047
|
-
const { fallback: o } = t ?? {};
|
|
1048
|
-
return (r, m) => {
|
|
1049
|
-
const h = e[r.type] ?? o;
|
|
1050
|
-
return h ? Me(h, { window: r, ctx: m }) : null;
|
|
1051
|
-
};
|
|
1052
|
-
}
|
|
1053
|
-
const lt = {
|
|
1054
|
-
colorPrimary: "--rw-color-primary",
|
|
1055
|
-
colorPrimaryHover: "--rw-color-primary-hover",
|
|
1056
|
-
colorPrimaryBg: "--rw-color-primary-bg",
|
|
1057
|
-
colorBg: "--rw-color-bg",
|
|
1058
|
-
colorBgSecondary: "--rw-color-bg-secondary",
|
|
1059
|
-
colorBgTertiary: "--rw-color-bg-tertiary",
|
|
1060
|
-
colorBgHover: "--rw-color-bg-hover",
|
|
1061
|
-
colorBgActive: "--rw-color-bg-active",
|
|
1062
|
-
colorBorder: "--rw-color-border",
|
|
1063
|
-
colorBorderStrong: "--rw-color-border-strong",
|
|
1064
|
-
colorText: "--rw-color-text",
|
|
1065
|
-
colorTextSecondary: "--rw-color-text-secondary",
|
|
1066
|
-
colorTextMuted: "--rw-color-text-muted",
|
|
1067
|
-
sidebarWidth: "--rw-sidebar-width",
|
|
1068
|
-
tabHeight: "--rw-tab-height",
|
|
1069
|
-
radius: "--rw-radius",
|
|
1070
|
-
fontSize: "--rw-font-size"
|
|
1071
|
-
};
|
|
1072
|
-
function We(e) {
|
|
1073
|
-
const t = {};
|
|
1074
|
-
return Object.keys(e).forEach((o) => {
|
|
1075
|
-
const r = e[o];
|
|
1076
|
-
if (r !== void 0) {
|
|
1077
|
-
const m = lt[o];
|
|
1078
|
-
t[m] = typeof r == "number" ? `${r}px` : r;
|
|
1079
|
-
}
|
|
1080
|
-
}), t;
|
|
1081
|
-
}
|
|
1082
|
-
function at(e) {
|
|
1083
|
-
return {
|
|
1084
|
-
colorPrimary: e.colorPrimary,
|
|
1085
|
-
colorPrimaryHover: e.colorPrimaryHover,
|
|
1086
|
-
colorPrimaryBg: e.colorPrimaryBg,
|
|
1087
|
-
colorBg: e.colorBgContainer,
|
|
1088
|
-
colorBgSecondary: e.colorFillAlter ?? e.colorBgContainer,
|
|
1089
|
-
colorBgTertiary: e.colorBgLayout,
|
|
1090
|
-
colorBgHover: e.colorBgTextHover,
|
|
1091
|
-
colorBgActive: e.colorPrimaryBg,
|
|
1092
|
-
colorBorder: e.colorBorder,
|
|
1093
|
-
colorBorderStrong: e.colorBorderSecondary ?? e.colorBorder,
|
|
1094
|
-
colorText: e.colorText,
|
|
1095
|
-
colorTextSecondary: e.colorTextSecondary,
|
|
1096
|
-
colorTextMuted: e.colorTextTertiary,
|
|
1097
|
-
radius: e.borderRadius,
|
|
1098
|
-
fontSize: e.fontSize
|
|
1099
|
-
};
|
|
1100
|
-
}
|
|
1101
|
-
function ht(e) {
|
|
1102
|
-
return We(at(e));
|
|
1103
|
-
}
|
|
1104
|
-
const pt = Pe(function({
|
|
1105
|
-
workspaceId: t = "default",
|
|
1106
|
-
menuItems: o,
|
|
1107
|
-
renderWindow: r,
|
|
1108
|
-
windows: m,
|
|
1109
|
-
sidebarHeader: h,
|
|
1110
|
-
sidebarFooter: p,
|
|
1111
|
-
defaultWindow: c,
|
|
1112
|
-
loading: d = !1,
|
|
1113
|
-
loadingTip: w = "加载中...",
|
|
1114
|
-
onAction: _,
|
|
1115
|
-
activeWindowType: D,
|
|
1116
|
-
emptyDescription: H,
|
|
1117
|
-
syncToUrl: v = !1,
|
|
1118
|
-
preserveUrlParams: Z = !0,
|
|
1119
|
-
searchParams: k,
|
|
1120
|
-
setSearchParams: X,
|
|
1121
|
-
floatingDefaults: A,
|
|
1122
|
-
onWindowsChange: $,
|
|
1123
|
-
onReady: g,
|
|
1124
|
-
siderWidth: b = 240,
|
|
1125
|
-
contentBackground: L,
|
|
1126
|
-
themeClassName: S,
|
|
1127
|
-
theme: T,
|
|
1128
|
-
renderSidebar: x,
|
|
1129
|
-
tabsContainer: V,
|
|
1130
|
-
className: N,
|
|
1131
|
-
style: f
|
|
1132
|
-
}, M) {
|
|
1133
|
-
const y = oe(
|
|
1134
|
-
() => ot(o, c),
|
|
1135
|
-
[o, c]
|
|
1136
|
-
), C = oe(() => {
|
|
1137
|
-
if (r) return r;
|
|
1138
|
-
if (m) return st(m);
|
|
1139
|
-
throw new Error("[react-workspace] 请提供 renderWindow 或 windows");
|
|
1140
|
-
}, [r, m]), W = Ze({
|
|
1141
|
-
workspaceId: t,
|
|
1142
|
-
defaultWindow: y,
|
|
1143
|
-
syncToUrl: v,
|
|
1144
|
-
preserveUrlParams: Z,
|
|
1145
|
-
searchParams: k,
|
|
1146
|
-
setSearchParams: X,
|
|
1147
|
-
floatingDefaults: A,
|
|
1148
|
-
onWindowsChange: $
|
|
1149
|
-
}), {
|
|
1150
|
-
windows: z,
|
|
1151
|
-
activeWindowId: I,
|
|
1152
|
-
openWindow: E,
|
|
1153
|
-
switchWindow: B,
|
|
1154
|
-
closeWindow: j,
|
|
1155
|
-
toggleMinimize: G,
|
|
1156
|
-
floatWindow: Q,
|
|
1157
|
-
restoreWindow: n,
|
|
1158
|
-
updateFloatingPosition: i,
|
|
1159
|
-
focusWindow: l,
|
|
1160
|
-
batchManage: a,
|
|
1161
|
-
updateWindowProps: u,
|
|
1162
|
-
clearPendingAction: P,
|
|
1163
|
-
reorderWindows: F
|
|
1164
|
-
} = W, Y = { workspaceId: t, ...W };
|
|
1165
|
-
Te(M, () => Y, [t, z, I]), ne(() => {
|
|
1166
|
-
g && z.length > 0 && g({ workspaceId: t, ...W });
|
|
1167
|
-
}, [g, t, z.length]);
|
|
1168
|
-
const K = oe(() => D !== void 0 ? D : z.find((te) => te.id === I)?.type, [D, z, I]), O = R(
|
|
1169
|
-
(te, ce) => {
|
|
1170
|
-
E({ type: te, title: Ue(o, te), minimized: !1 }, ce);
|
|
1171
|
-
},
|
|
1172
|
-
[E, o]
|
|
1173
|
-
), J = R(
|
|
1174
|
-
(te, ce) => ({
|
|
1175
|
-
workspaceId: t,
|
|
1176
|
-
active: ce,
|
|
1177
|
-
activeWindowId: I,
|
|
1178
|
-
windows: z,
|
|
1179
|
-
openWindow: E,
|
|
1180
|
-
switchWindow: B,
|
|
1181
|
-
closeWindow: j,
|
|
1182
|
-
toggleMinimize: G,
|
|
1183
|
-
floatWindow: Q,
|
|
1184
|
-
updateWindowProps: (Ie, Ce) => u(Ie, Ce),
|
|
1185
|
-
clearPendingAction: P
|
|
1186
|
-
}),
|
|
1187
|
-
[t, I, z, E, B, j, G, Q, u, P]
|
|
1188
|
-
), Se = oe(
|
|
1189
|
-
() => ({ ...Y, buildRenderContext: J }),
|
|
1190
|
-
[t, z, I, J]
|
|
1191
|
-
), ke = L ?? "var(--rw-color-bg-tertiary)", ze = { minHeight: "100vh", height: "100vh", display: "flex", ...T ? We(T) : void 0, ...f }, ue = {
|
|
1192
|
-
menuItems: o,
|
|
1193
|
-
onMenuClick: O,
|
|
1194
|
-
onAction: _,
|
|
1195
|
-
activeWindowType: K,
|
|
1196
|
-
header: h,
|
|
1197
|
-
footer: p,
|
|
1198
|
-
defaultOpenKeys: qe(o),
|
|
1199
|
-
siderWidth: b
|
|
1200
|
-
};
|
|
1201
|
-
return /* @__PURE__ */ s(Be, { value: Se, children: /* @__PURE__ */ q(
|
|
1202
|
-
"div",
|
|
1203
|
-
{
|
|
1204
|
-
className: `rw-workspace ${S || ""} ${N || ""}`.trim(),
|
|
1205
|
-
style: ze,
|
|
1206
|
-
children: [
|
|
1207
|
-
x ? x(ue) : /* @__PURE__ */ s(Ke, { ...ue }),
|
|
1208
|
-
/* @__PURE__ */ s("main", { className: "rw-workspace-main", style: { background: ke }, children: /* @__PURE__ */ s(Ee, { spinning: d, tip: w, children: /* @__PURE__ */ s(
|
|
1209
|
-
it,
|
|
1210
|
-
{
|
|
1211
|
-
workspaceId: t,
|
|
1212
|
-
windows: z,
|
|
1213
|
-
activeWindowId: I,
|
|
1214
|
-
renderWindow: (te) => C(te, J(te, te.id === I && !te.floating)),
|
|
1215
|
-
onSwitchWindow: B,
|
|
1216
|
-
onCloseWindow: j,
|
|
1217
|
-
onToggleMinimize: G,
|
|
1218
|
-
onBatchManage: a,
|
|
1219
|
-
onOpenWindow: E,
|
|
1220
|
-
onFloatWindow: Q,
|
|
1221
|
-
onRestoreWindow: n,
|
|
1222
|
-
onUpdateFloatingPosition: i,
|
|
1223
|
-
onFocusWindow: l,
|
|
1224
|
-
onReorderWindows: F,
|
|
1225
|
-
emptyDescription: H,
|
|
1226
|
-
tabsContainer: V,
|
|
1227
|
-
themeClassName: S,
|
|
1228
|
-
floatingDefaults: A
|
|
1229
|
-
}
|
|
1230
|
-
) }) })
|
|
1231
|
-
]
|
|
1232
|
-
}
|
|
1233
|
-
) });
|
|
1234
|
-
});
|
|
1235
|
-
export {
|
|
1236
|
-
nt as F,
|
|
1237
|
-
Ve as W,
|
|
1238
|
-
it as a,
|
|
1239
|
-
Qe as b,
|
|
1240
|
-
pt as c,
|
|
1241
|
-
Be as d,
|
|
1242
|
-
Ke as e,
|
|
1243
|
-
qe as f,
|
|
1244
|
-
st as g,
|
|
1245
|
-
xe as h,
|
|
1246
|
-
_e as i,
|
|
1247
|
-
ve as j,
|
|
1248
|
-
ie as k,
|
|
1249
|
-
se as l,
|
|
1250
|
-
be as m,
|
|
1251
|
-
ht as n,
|
|
1252
|
-
at as o,
|
|
1253
|
-
me as p,
|
|
1254
|
-
Ue as q,
|
|
1255
|
-
ot as r,
|
|
1256
|
-
le as s,
|
|
1257
|
-
We as t,
|
|
1258
|
-
de as u,
|
|
1259
|
-
Ze as v,
|
|
1260
|
-
gt as w,
|
|
1261
|
-
mt as x
|
|
1262
|
-
};
|