@yuku123/z-team-component 0.2.78 → 0.2.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/{menuPermission-CO2KgDX8.js → menuPermission-D9NGpBZP.js} +1 -1
  2. package/dist/pages.js +1 -1
  3. package/dist/z-team-component.css +2 -2
  4. package/package.json +1 -1
  5. package/dist/ChangeLogView-_bRZ55Yi.js +0 -542
  6. package/dist/ComponentDoc-Aw4QY8oI.js +0 -3998
  7. package/dist/InvitationManagementPage-Bv0ys--k.js +0 -495
  8. package/dist/OnboardingPage-B7274ITW.js +0 -393
  9. package/dist/ScheduledTasks-cc8n9giN.js +0 -9406
  10. package/dist/SystemShell-CPGtmxXl.js +0 -689
  11. package/dist/_commonjsHelpers-B52_cu2H.js +0 -26
  12. package/dist/api-B2APc1an.js +0 -20
  13. package/dist/api-CIhVblfa.js +0 -2155
  14. package/dist/browser-jb_PFvU3.js +0 -1538
  15. package/dist/createWorkspaceWsHandler-BWP5S5X3.js +0 -12951
  16. package/dist/ctc-sso-DtJHC-2M.js +0 -117
  17. package/dist/echarts-B1OU1xr4.js +0 -16
  18. package/dist/history-BlrA1eaW.js +0 -41
  19. package/dist/index-51d5011I.js +0 -178
  20. package/dist/index-62K6U_D_.js +0 -574
  21. package/dist/index-ACANAhdd.js +0 -242
  22. package/dist/index-B_LJRFsK.js +0 -339
  23. package/dist/index-BgIheStI.js +0 -133
  24. package/dist/index-BohoJQPr.js +0 -7631
  25. package/dist/index-Bpi_ysgC.js +0 -914
  26. package/dist/index-BwyN94l7.js +0 -9567
  27. package/dist/index-BydWNuk5.js +0 -1229
  28. package/dist/index-C6FYNbSB.js +0 -118
  29. package/dist/index-C815hPWS.js +0 -430
  30. package/dist/index-CNcX0oSU.js +0 -112
  31. package/dist/index-CUVdeb8y.js +0 -638
  32. package/dist/index-CijskN6t.js +0 -316
  33. package/dist/index-Cvx6rrxD.js +0 -956
  34. package/dist/index-Cwr5Slv1.js +0 -480
  35. package/dist/index-CxFAICql.js +0 -42050
  36. package/dist/index-D2cy0jVs.js +0 -1143
  37. package/dist/index-DGbL_CMP.js +0 -137
  38. package/dist/index-DK70mOTz.js +0 -143
  39. package/dist/index-DT80Pwa_.js +0 -5893
  40. package/dist/index-DWsfQMp8.js +0 -208
  41. package/dist/index-DhDdFRHC.js +0 -279
  42. package/dist/index-Dm3wmB0K.js +0 -435
  43. package/dist/index-DvBDj0ul.js +0 -93
  44. package/dist/index-DzS6-D3M.js +0 -1640
  45. package/dist/index-Xn84wLNu.js +0 -2700
  46. package/dist/index-_9zO-72Q.js +0 -2908
  47. package/dist/index-cdB5K3gx.js +0 -814
  48. package/dist/index-nU-V276i.js +0 -170
  49. package/dist/index-uF04Ucsi.js +0 -8
  50. package/dist/index.js +0 -10
  51. package/dist/index.module-CAa-2T7m.js +0 -72
  52. package/dist/index.module-UI0iz8K0.js +0 -42
@@ -1,914 +0,0 @@
1
- import { jsxs as i, jsx as e, Fragment as le } from "react/jsx-runtime";
2
- import { useState as u, useEffect as re, useCallback as O } from "react";
3
- import { a as b, f as $, B, u as D } from "./api-CIhVblfa.js";
4
- import { u as F } from "./useAppStore-BBr_Fwsz.js";
5
- import { SearchOutlined as Ce, ReloadOutlined as Se, PlusOutlined as Te, FileZipOutlined as Z, CloudDownloadOutlined as Y, EditOutlined as he, UserSwitchOutlined as Ue, ArrowLeftOutlined as fe, UserOutlined as be, CloudUploadOutlined as $e, PictureOutlined as de, EyeOutlined as Be } from "@ant-design/icons";
6
- import { message as U, Input as H, Tooltip as se, Button as g, Spin as ce, Empty as De, Popconfirm as pe, Tag as ie, Modal as Re, Select as Pe, Upload as me, Tabs as Le } from "antd";
7
- import ve from "react-markdown";
8
- import _e from "rehype-highlight";
9
- import ge from "remark-gfm";
10
- import { M as oa } from "./index-Xn84wLNu.js";
11
- function j(a) {
12
- return a ? `?token=${encodeURIComponent(a)}` : "";
13
- }
14
- function P(a) {
15
- return a && a.startsWith("http://") && a.includes(".aliyuncs.com/") ? "https://" + a.slice(7) : a;
16
- }
17
- function X(a) {
18
- return {
19
- ...a,
20
- coverUrl: P(a.coverUrl),
21
- fileUrl: P(a.fileUrl)
22
- };
23
- }
24
- async function Ie(a = {}, n = "") {
25
- const l = new URLSearchParams();
26
- n && l.set("token", n), a.category && l.set("category", a.category), a.keyword && l.set("keyword", a.keyword), a.mine && l.set("mine", "true");
27
- const r = l.toString(), c = await b(
28
- `${B}/market/resources${r ? `?${r}` : ""}`,
29
- $
30
- );
31
- return (await D(
32
- c,
33
- "获取资源列表失败"
34
- )).map(X);
35
- }
36
- async function ye(a, n = "") {
37
- const l = await b(
38
- `${B}/market/resources/${a}${j(n)}`,
39
- $
40
- ), r = await D(
41
- l,
42
- "获取资源详情失败"
43
- );
44
- return X(r);
45
- }
46
- async function Me(a, n, l = "") {
47
- const r = new URLSearchParams();
48
- r.set("publish", n ? "true" : "false"), l && r.set("token", l);
49
- const c = await b(`${B}/market/resources?${r.toString()}`, {
50
- ...$,
51
- method: "POST",
52
- headers: { "Content-Type": "application/json" },
53
- body: JSON.stringify({
54
- ...a,
55
- coverUrl: P(a.coverUrl ?? null),
56
- fileUrl: P(a.fileUrl ?? null)
57
- })
58
- }), h = await D(c, "新建资源失败");
59
- return X(h);
60
- }
61
- async function we(a, n, l, r = "") {
62
- const c = new URLSearchParams();
63
- l !== null && c.set("publish", l ? "true" : "false"), r && c.set("token", r);
64
- const h = c.toString(), d = await b(
65
- `${B}/market/resources/${a}${h ? `?${h}` : ""}`,
66
- {
67
- ...$,
68
- method: "PUT",
69
- headers: { "Content-Type": "application/json" },
70
- body: JSON.stringify({
71
- ...n,
72
- coverUrl: P(n.coverUrl ?? null),
73
- fileUrl: P(n.fileUrl ?? null)
74
- })
75
- }
76
- ), v = await D(d, "保存资源失败");
77
- return X(v);
78
- }
79
- async function Ne(a, n = "") {
80
- const l = await b(
81
- `${B}/market/resources/${a}${j(n)}`,
82
- { ...$, method: "DELETE" }
83
- );
84
- return D(l, "删除资源失败");
85
- }
86
- async function ke(a, n = "", l) {
87
- const r = new URLSearchParams();
88
- n && r.set("token", n);
89
- const c = await b(
90
- `${B}/market/resources/${a}/download?${r.toString()}`,
91
- { ...$, method: "POST" }
92
- ), h = await D(c, "下载失败");
93
- return {
94
- ...h,
95
- fileUrl: P(h.fileUrl) ?? h.fileUrl
96
- };
97
- }
98
- async function Oe(a, n = "") {
99
- const l = new FormData();
100
- l.append("file", a);
101
- const r = await b(
102
- `${B}/market/upload-package${j(n)}`,
103
- { ...$, method: "POST", body: l }
104
- ), c = await D(r, "上传资源包失败");
105
- return { ...c, url: P(c.url) ?? c.url };
106
- }
107
- async function xe(a, n = "") {
108
- const l = new FormData();
109
- l.append("file", a);
110
- const r = await b(`${B}/market/upload-cover${j(n)}`, {
111
- ...$,
112
- method: "POST",
113
- body: l
114
- }), c = await D(r, "上传封面失败");
115
- return { ...c, url: P(c.url) ?? c.url };
116
- }
117
- async function ue(a, n = "") {
118
- const l = new URLSearchParams();
119
- a && l.set("keyword", a), n && l.set("token", n);
120
- const r = l.toString(), c = await b(
121
- `${B}/market/users${r ? `?${r}` : ""}`,
122
- $
123
- );
124
- return D(c, "搜索用户失败");
125
- }
126
- async function Ee(a, n, l = "") {
127
- const r = await b(
128
- `${B}/market/resources/${a}/transfer-owner${j(l)}`,
129
- {
130
- ...$,
131
- method: "POST",
132
- headers: { "Content-Type": "application/json" },
133
- body: JSON.stringify({ targetStaffId: n })
134
- }
135
- );
136
- return D(r, "转交失败");
137
- }
138
- const Fe = "_tabBody_1ouee_3", Ae = "_comingSoon_1ouee_3", ze = "_comingSoonIcon_1ouee_22", We = "_comingSoonTitle_1ouee_26", He = "_comingSoonDesc_1ouee_32", je = "_listWrap_1ouee_37", Ge = "_toolbar_1ouee_41", Ke = "_toolbarCount_1ouee_48", Ve = "_toolbarRight_1ouee_53", qe = "_emptyWrap_1ouee_59", Je = "_cardGrid_1ouee_64", Ze = "_card_1ouee_64", Ye = "_cardCover_1ouee_87", Qe = "_cardCoverFallback_1ouee_101", Xe = "_cardDraftBadge_1ouee_111", et = "_cardBody_1ouee_122", tt = "_cardTitle_1ouee_130", at = "_cardSummary_1ouee_139", nt = "_cardMeta_1ouee_150", ot = "_cardCreator_1ouee_158", it = "_cardDownloads_1ouee_165", lt = "_cardFileName_1ouee_171", rt = "_cardActions_1ouee_175", ct = "_cardDraftTag_1ouee_184", dt = "_editorWrap_1ouee_191", st = "_detailWrap_1ouee_192", mt = "_editorTopBar_1ouee_199", ut = "_backBtn_1ouee_209", ht = "_editorTitle_1ouee_226", ft = "_editorTopActions_1ouee_235", pt = "_editorBody_1ouee_241", vt = "_detailBody_1ouee_242", _t = "_section_1ouee_252", gt = "_sectionTitle_1ouee_259", yt = "_uploaderInner_1ouee_269", wt = "_uploaderIcon_1ouee_273", Nt = "_uploaderText_1ouee_279", kt = "_uploaderFile_1ouee_284", Ct = "_coverRow_1ouee_290", St = "_coverPreview_1ouee_296", Tt = "_coverRemove_1ouee_312", Ut = "_formRow_1ouee_318", bt = "_formLabel_1ouee_329", $t = "_docEditor_1ouee_337", Bt = "_docPreview_1ouee_343", Dt = "_docPreviewEmpty_1ouee_398", Rt = "_detailHeader_1ouee_405", Pt = "_detailCover_1ouee_414", Lt = "_detailInfo_1ouee_430", It = "_detailNameRow_1ouee_438", Mt = "_detailName_1ouee_438", Ot = "_detailSummary_1ouee_452", xt = "_detailMeta_1ouee_458", Et = "_detailActions_1ouee_467", Ft = "_detailDocSection_1ouee_473", t = {
139
- tabBody: Fe,
140
- comingSoon: Ae,
141
- comingSoonIcon: ze,
142
- comingSoonTitle: We,
143
- comingSoonDesc: He,
144
- listWrap: je,
145
- toolbar: Ge,
146
- toolbarCount: Ke,
147
- toolbarRight: Ve,
148
- emptyWrap: qe,
149
- cardGrid: Je,
150
- card: Ze,
151
- cardCover: Ye,
152
- cardCoverFallback: Qe,
153
- cardDraftBadge: Xe,
154
- cardBody: et,
155
- cardTitle: tt,
156
- cardSummary: at,
157
- cardMeta: nt,
158
- cardCreator: ot,
159
- cardDownloads: it,
160
- cardFileName: lt,
161
- cardActions: rt,
162
- cardDraftTag: ct,
163
- editorWrap: dt,
164
- detailWrap: st,
165
- editorTopBar: mt,
166
- backBtn: ut,
167
- editorTitle: ht,
168
- editorTopActions: ft,
169
- editorBody: pt,
170
- detailBody: vt,
171
- section: _t,
172
- sectionTitle: gt,
173
- uploaderInner: yt,
174
- uploaderIcon: wt,
175
- uploaderText: Nt,
176
- uploaderFile: kt,
177
- coverRow: Ct,
178
- coverPreview: St,
179
- coverRemove: Tt,
180
- formRow: Ut,
181
- formLabel: bt,
182
- docEditor: $t,
183
- docPreview: Bt,
184
- docPreviewEmpty: Dt,
185
- detailHeader: Rt,
186
- detailCover: Pt,
187
- detailInfo: Lt,
188
- detailNameRow: It,
189
- detailName: Mt,
190
- detailSummary: Ot,
191
- detailMeta: xt,
192
- detailActions: Et,
193
- detailDocSection: Ft
194
- }, At = {
195
- "browser-plugin": "浏览器插件",
196
- "ztools-plugin": "zTools 插件",
197
- software: "软件资源"
198
- };
199
- function Q(a) {
200
- return !a || a <= 0 ? "-" : a < 1024 ? `${a} B` : a < 1024 * 1024 ? `${(a / 1024).toFixed(1)} KB` : a < 1024 * 1024 * 1024 ? `${(a / 1024 / 1024).toFixed(1)} MB` : `${(a / 1024 / 1024 / 1024).toFixed(2)} GB`;
201
- }
202
- function zt({
203
- resources: a,
204
- loading: n,
205
- category: l,
206
- onReload: r,
207
- onCreate: c,
208
- onOpenDetail: h,
209
- onEdit: d
210
- }) {
211
- const v = F((o) => o.token), k = F((o) => o.currentUser), w = k != null && k.id ? String(k.id) : "", [C, m] = u(""), [S, M] = u(null), [p, T] = u(null), [L, I] = u([]), [x, R] = u(!1), [f, y] = u(null), [G, A] = u(!1), [z, K] = u(a);
212
- re(() => {
213
- K(a);
214
- }, [a]);
215
- const E = C.trim() ? z.filter(
216
- (o) => o.name.toLowerCase().includes(C.trim().toLowerCase()) || (o.summary ?? "").toLowerCase().includes(C.trim().toLowerCase())
217
- ) : z, V = O(
218
- async (o) => {
219
- if (o.fileUrl) {
220
- M(o.id);
221
- try {
222
- const N = await ke(o.id, v);
223
- if (N.fileUrl) {
224
- const _ = document.createElement("a");
225
- _.href = N.fileUrl, _.download = N.fileName || o.name, _.target = "_blank", _.rel = "noopener", document.body.appendChild(_), _.click(), _.remove(), r();
226
- }
227
- } catch {
228
- } finally {
229
- M(null);
230
- }
231
- }
232
- },
233
- [v, r]
234
- ), q = O(
235
- async (o) => {
236
- try {
237
- await Ne(o, v), U.success("已删除"), r();
238
- } catch {
239
- }
240
- },
241
- [v, r]
242
- ), ee = O(
243
- (o) => {
244
- T(o), y(null), I([]), R(!0), ue("", v).then(
245
- (N) => I(
246
- N.filter((_) => String(_.id) !== o.creatorId)
247
- )
248
- ).catch(() => {
249
- }).finally(() => R(!1));
250
- },
251
- [v]
252
- ), te = O(
253
- (o) => {
254
- R(!0), ue(o, v).then(
255
- (N) => I(
256
- p ? N.filter((_) => String(_.id) !== p.creatorId) : N
257
- )
258
- ).catch(() => {
259
- }).finally(() => R(!1));
260
- },
261
- [v, p]
262
- ), ae = O(async () => {
263
- if (!(!p || f === null)) {
264
- A(!0);
265
- try {
266
- await Ee(p.id, f, v), U.success("已转交"), T(null), r();
267
- } catch {
268
- } finally {
269
- A(!1);
270
- }
271
- }
272
- }, [p, f, v, r]);
273
- return /* @__PURE__ */ i("div", { className: t.listWrap, children: [
274
- /* @__PURE__ */ i("div", { className: t.toolbar, children: [
275
- /* @__PURE__ */ e(
276
- H,
277
- {
278
- allowClear: !0,
279
- prefix: /* @__PURE__ */ e(Ce, { style: { color: "#999" } }),
280
- placeholder: "搜索资源名称/简介",
281
- value: C,
282
- onChange: (o) => m(o.target.value),
283
- style: { width: 260 }
284
- }
285
- ),
286
- /* @__PURE__ */ i("span", { className: t.toolbarCount, children: [
287
- "共 ",
288
- E.length,
289
- " 个",
290
- At[l] ?? "资源"
291
- ] }),
292
- /* @__PURE__ */ i("div", { className: t.toolbarRight, children: [
293
- /* @__PURE__ */ e(se, { title: "刷新", children: /* @__PURE__ */ e(g, { icon: /* @__PURE__ */ e(Se, {}), onClick: r }) }),
294
- /* @__PURE__ */ e(g, { type: "primary", icon: /* @__PURE__ */ e(Te, {}), onClick: c, children: "新增资源" })
295
- ] })
296
- ] }),
297
- /* @__PURE__ */ e(ce, { spinning: n, children: E.length === 0 && !n ? /* @__PURE__ */ e("div", { className: t.emptyWrap, children: /* @__PURE__ */ e(De, { description: "暂无资源,点击右上角「新增资源」上传第一个" }) }) : /* @__PURE__ */ e("div", { className: t.cardGrid, children: E.map((o) => {
298
- const N = o.creatorId === w, _ = o.status === 0;
299
- return /* @__PURE__ */ i(
300
- "div",
301
- {
302
- className: t.card,
303
- onClick: () => h(o),
304
- children: [
305
- /* @__PURE__ */ i("div", { className: t.cardCover, children: [
306
- o.coverUrl ? /* @__PURE__ */ e("img", { src: o.coverUrl, alt: o.name }) : /* @__PURE__ */ e("div", { className: t.cardCoverFallback, children: /* @__PURE__ */ e(Z, {}) }),
307
- _ && /* @__PURE__ */ e("span", { className: t.cardDraftBadge, children: "草稿" })
308
- ] }),
309
- /* @__PURE__ */ i("div", { className: t.cardBody, children: [
310
- /* @__PURE__ */ e("div", { className: t.cardTitle, title: o.name, children: o.name }),
311
- /* @__PURE__ */ e("div", { className: t.cardSummary, children: o.summary || "暂无简介" }),
312
- /* @__PURE__ */ i("div", { className: t.cardMeta, children: [
313
- /* @__PURE__ */ e("span", { className: t.cardCreator, children: o.creatorName }),
314
- /* @__PURE__ */ i(
315
- "span",
316
- {
317
- className: t.cardDownloads,
318
- title: `累计下载 ${o.downloadCount} 次`,
319
- children: [
320
- /* @__PURE__ */ e(Y, {}),
321
- " ",
322
- o.downloadCount,
323
- " ",
324
- "次下载"
325
- ]
326
- }
327
- ),
328
- o.version && /* @__PURE__ */ i(
329
- "span",
330
- {
331
- className: t.cardFileName,
332
- title: `版本 ${o.version}`,
333
- children: [
334
- "v",
335
- o.version
336
- ]
337
- }
338
- ),
339
- o.fileName && /* @__PURE__ */ e(
340
- "span",
341
- {
342
- className: t.cardFileName,
343
- title: `${o.fileName}(${Q(
344
- o.fileSize
345
- )})`,
346
- children: Q(o.fileSize)
347
- }
348
- )
349
- ] }),
350
- /* @__PURE__ */ i(
351
- "div",
352
- {
353
- className: t.cardActions,
354
- onClick: (s) => s.stopPropagation(),
355
- children: [
356
- /* @__PURE__ */ e(
357
- g,
358
- {
359
- size: "small",
360
- type: "primary",
361
- icon: /* @__PURE__ */ e(Y, {}),
362
- disabled: !o.fileUrl,
363
- loading: S === o.id,
364
- onClick: () => void V(o),
365
- children: "下载"
366
- }
367
- ),
368
- N && /* @__PURE__ */ i(le, { children: [
369
- /* @__PURE__ */ e(
370
- g,
371
- {
372
- size: "small",
373
- icon: /* @__PURE__ */ e(he, {}),
374
- onClick: () => d(o),
375
- children: "编辑"
376
- }
377
- ),
378
- /* @__PURE__ */ e(
379
- pe,
380
- {
381
- title: "确定删除该资源?",
382
- onConfirm: () => void q(o.id),
383
- children: /* @__PURE__ */ e(g, { size: "small", danger: !0, children: "删除" })
384
- }
385
- )
386
- ] }),
387
- N && /* @__PURE__ */ e(se, { title: "转交给其他用户接手维护", children: /* @__PURE__ */ e(
388
- g,
389
- {
390
- size: "small",
391
- icon: /* @__PURE__ */ e(Ue, {}),
392
- onClick: () => ee(o)
393
- }
394
- ) }),
395
- _ && /* @__PURE__ */ e(ie, { color: "orange", className: t.cardDraftTag, children: "仅自己可见" })
396
- ]
397
- }
398
- )
399
- ] })
400
- ]
401
- },
402
- o.id
403
- );
404
- }) }) }),
405
- /* @__PURE__ */ i(
406
- Re,
407
- {
408
- open: p !== null,
409
- title: `转交「${(p == null ? void 0 : p.name) ?? ""}」所有权`,
410
- okText: "转交",
411
- okButtonProps: {
412
- disabled: f === null,
413
- loading: G
414
- },
415
- onCancel: () => T(null),
416
- onOk: () => void ae(),
417
- destroyOnHidden: !0,
418
- children: [
419
- /* @__PURE__ */ i("p", { style: { color: "#666", marginBottom: 12 }, children: [
420
- "转交后「",
421
- p == null ? void 0 : p.creatorName,
422
- "」将失去该资源的编辑/删除权,由新所有者接手维护。"
423
- ] }),
424
- /* @__PURE__ */ e(
425
- Pe,
426
- {
427
- showSearch: !0,
428
- filterOption: !1,
429
- placeholder: "输入姓名/账号/工号搜索",
430
- style: { width: "100%" },
431
- loading: x,
432
- value: f,
433
- onSearch: te,
434
- onChange: (o) => y(o),
435
- options: L.map((o) => ({
436
- value: o.id,
437
- label: `${o.name}(${o.accountNo ?? o.jobNumber ?? o.id})`
438
- }))
439
- }
440
- )
441
- ]
442
- }
443
- )
444
- ] });
445
- }
446
- function Wt({
447
- resource: a,
448
- currentUserId: n,
449
- onBack: l,
450
- onEdit: r,
451
- onDeleted: c
452
- }) {
453
- var R;
454
- const h = F((f) => f.token), [d, v] = u(a), [k, w] = u(!a.docContent), [C, m] = u(!1), [S, M] = u(!1);
455
- re(() => {
456
- let f = !0;
457
- if (!(a.docContent !== null && a.docContent !== void 0))
458
- return w(!0), ye(a.id, h).then((y) => {
459
- f && v(y);
460
- }).catch(() => {
461
- }).finally(() => {
462
- f && w(!1);
463
- }), () => {
464
- f = !1;
465
- };
466
- }, [a, h]);
467
- const p = d.creatorId === n, T = d.status === 0, L = async () => {
468
- if (d.fileUrl) {
469
- m(!0);
470
- try {
471
- const f = await ke(d.id, h);
472
- if (f.fileUrl) {
473
- const y = document.createElement("a");
474
- y.href = f.fileUrl, y.download = f.fileName || d.name, y.target = "_blank", y.rel = "noopener", document.body.appendChild(y), y.click(), y.remove();
475
- }
476
- } catch {
477
- } finally {
478
- m(!1);
479
- }
480
- }
481
- }, I = async (f) => {
482
- M(!0);
483
- try {
484
- await we(d.id, {}, f, h), U.success(f ? "已发布" : "已下架为草稿"), l();
485
- } catch {
486
- } finally {
487
- M(!1);
488
- }
489
- }, x = async () => {
490
- try {
491
- await Ne(d.id, h), U.success("已删除"), c();
492
- } catch {
493
- }
494
- };
495
- return /* @__PURE__ */ i("div", { className: t.detailWrap, children: [
496
- /* @__PURE__ */ i("div", { className: t.editorTopBar, children: [
497
- /* @__PURE__ */ i("button", { type: "button", className: t.backBtn, onClick: l, children: [
498
- /* @__PURE__ */ e(fe, {}),
499
- " 返回列表"
500
- ] }),
501
- /* @__PURE__ */ e("span", { className: t.editorTitle, children: d.name }),
502
- /* @__PURE__ */ e("div", { className: t.editorTopActions, children: p && /* @__PURE__ */ i(le, { children: [
503
- !T && /* @__PURE__ */ e(
504
- g,
505
- {
506
- loading: S,
507
- onClick: () => void I(!1),
508
- children: "下架为草稿"
509
- }
510
- ),
511
- T && /* @__PURE__ */ e(
512
- g,
513
- {
514
- type: "primary",
515
- ghost: !0,
516
- loading: S,
517
- onClick: () => void I(!0),
518
- children: "发布"
519
- }
520
- ),
521
- /* @__PURE__ */ e(g, { icon: /* @__PURE__ */ e(he, {}), onClick: () => r(d), children: "编辑" }),
522
- /* @__PURE__ */ e(
523
- pe,
524
- {
525
- title: "确定删除该资源?",
526
- onConfirm: () => void x(),
527
- children: /* @__PURE__ */ e(g, { danger: !0, children: "删除" })
528
- }
529
- )
530
- ] }) })
531
- ] }),
532
- /* @__PURE__ */ i("div", { className: t.detailBody, children: [
533
- /* @__PURE__ */ i("div", { className: t.detailHeader, children: [
534
- /* @__PURE__ */ e("div", { className: t.detailCover, children: d.coverUrl ? /* @__PURE__ */ e("img", { src: d.coverUrl, alt: d.name }) : /* @__PURE__ */ e("div", { className: t.cardCoverFallback, children: /* @__PURE__ */ e(Z, {}) }) }),
535
- /* @__PURE__ */ i("div", { className: t.detailInfo, children: [
536
- /* @__PURE__ */ i("div", { className: t.detailNameRow, children: [
537
- /* @__PURE__ */ e("h1", { className: t.detailName, children: d.name }),
538
- T ? /* @__PURE__ */ e(ie, { color: "orange", children: "草稿(仅自己可见)" }) : /* @__PURE__ */ e(ie, { color: "green", children: "已发布" })
539
- ] }),
540
- /* @__PURE__ */ e("div", { className: t.detailSummary, children: d.summary || "暂无简介" }),
541
- /* @__PURE__ */ i("div", { className: t.detailMeta, children: [
542
- /* @__PURE__ */ i("span", { children: [
543
- /* @__PURE__ */ e(be, {}),
544
- " ",
545
- d.creatorName
546
- ] }),
547
- /* @__PURE__ */ i("span", { children: [
548
- /* @__PURE__ */ e(Y, {}),
549
- " ",
550
- d.downloadCount,
551
- " 次下载"
552
- ] }),
553
- d.version && /* @__PURE__ */ i("span", { title: `版本 ${d.version}`, children: [
554
- "v",
555
- d.version
556
- ] }),
557
- d.fileName && /* @__PURE__ */ i("span", { title: d.fileName, children: [
558
- /* @__PURE__ */ e(Z, {}),
559
- " ",
560
- d.fileName,
561
- "(",
562
- Q(d.fileSize),
563
- ")"
564
- ] }),
565
- /* @__PURE__ */ i("span", { children: [
566
- "更新于 ",
567
- ((R = d.updateTime) == null ? void 0 : R.slice(0, 10)) ?? "-"
568
- ] })
569
- ] }),
570
- /* @__PURE__ */ e("div", { className: t.detailActions, children: /* @__PURE__ */ e(
571
- g,
572
- {
573
- type: "primary",
574
- size: "large",
575
- icon: /* @__PURE__ */ e(Y, {}),
576
- disabled: !d.fileUrl,
577
- loading: C,
578
- onClick: () => void L(),
579
- children: "下载资源包"
580
- }
581
- ) })
582
- ] })
583
- ] }),
584
- /* @__PURE__ */ i("div", { className: t.detailDocSection, children: [
585
- /* @__PURE__ */ e("div", { className: t.sectionTitle, children: "使用说明" }),
586
- /* @__PURE__ */ e(ce, { spinning: k, children: /* @__PURE__ */ e("div", { className: t.docPreview, children: d.docContent ? /* @__PURE__ */ e(
587
- ve,
588
- {
589
- remarkPlugins: [ge],
590
- rehypePlugins: [_e],
591
- children: d.docContent
592
- }
593
- ) : /* @__PURE__ */ e("div", { className: t.docPreviewEmpty, children: "创建者暂未补充使用说明" }) }) })
594
- ] })
595
- ] })
596
- ] });
597
- }
598
- function Ht(a) {
599
- const n = (a ?? "").trim();
600
- if (!n) return "1.0.1";
601
- const l = n.match(/^(.*)\.(\d+)$/);
602
- return l ? `${l[1]}.${Number(l[2]) + 1}` : /^\d+$/.test(n) ? String(Number(n) + 1) : n;
603
- }
604
- function jt({
605
- category: a,
606
- resource: n,
607
- onSaved: l,
608
- onCancel: r
609
- }) {
610
- const c = F((s) => s.token), h = a === "ztools-plugin", [d, v] = u((n == null ? void 0 : n.name) ?? ""), [k, w] = u((n == null ? void 0 : n.summary) ?? ""), [C, m] = u((n == null ? void 0 : n.version) ?? ""), [S, M] = u((n == null ? void 0 : n.docContent) ?? ""), [p, T] = u((n == null ? void 0 : n.coverUrl) ?? ""), [L, I] = u((n == null ? void 0 : n.fileUrl) ?? ""), [x, R] = u((n == null ? void 0 : n.fileName) ?? ""), [f, y] = u((n == null ? void 0 : n.fileSize) ?? 0), [G, A] = u(!1), [z, K] = u(!1), [E, V] = u(null), [q, ee] = u("edit"), te = async (s) => {
611
- const W = L;
612
- A(!0);
613
- try {
614
- const J = await Oe(s, c);
615
- I(J.url), R(J.fileName ?? s.name), y(J.size);
616
- const ne = C.trim();
617
- if (W && ne) {
618
- const oe = Ht(ne);
619
- if (oe !== ne)
620
- return m(oe), U.success(
621
- `资源包已替换,版本号自动升级至 v${oe}(可手动修改)`
622
- ), !1;
623
- }
624
- U.success(`资源包已上传:${J.fileName ?? s.name}`);
625
- } catch {
626
- } finally {
627
- A(!1);
628
- }
629
- return !1;
630
- }, ae = async (s) => {
631
- K(!0);
632
- try {
633
- const W = await xe(s, c);
634
- T(W.url), U.success("封面已上传");
635
- } catch {
636
- } finally {
637
- K(!1);
638
- }
639
- return !1;
640
- }, o = () => ({
641
- name: d.trim(),
642
- summary: k.trim() || void 0,
643
- docContent: S || void 0,
644
- coverUrl: p || void 0,
645
- fileUrl: L || void 0,
646
- fileName: x || void 0,
647
- fileSize: f || void 0,
648
- version: C.trim() || void 0
649
- }), N = (s) => d.trim() ? s && !L ? (U.warning("发布前请先上传资源包"), !1) : !0 : (U.warning("请填写资源名称"), !1), _ = async (s) => {
650
- if (N(s)) {
651
- V(s ? "publish" : "draft");
652
- try {
653
- const W = n ? await we(n.id, o(), s, c) : await Me(
654
- { ...o(), category: a },
655
- s,
656
- c
657
- );
658
- U.success(s ? "已发布" : "已保存草稿"), l(W);
659
- } catch {
660
- } finally {
661
- V(null);
662
- }
663
- }
664
- };
665
- return /* @__PURE__ */ i("div", { className: t.editorWrap, children: [
666
- /* @__PURE__ */ i("div", { className: t.editorTopBar, children: [
667
- /* @__PURE__ */ i("button", { type: "button", className: t.backBtn, onClick: r, children: [
668
- /* @__PURE__ */ e(fe, {}),
669
- " 返回列表"
670
- ] }),
671
- /* @__PURE__ */ e("span", { className: t.editorTitle, children: n ? "编辑资源" : "新增资源" }),
672
- /* @__PURE__ */ i("div", { className: t.editorTopActions, children: [
673
- /* @__PURE__ */ e(
674
- g,
675
- {
676
- onClick: () => void _(!1),
677
- loading: E === "draft",
678
- children: "保存草稿"
679
- }
680
- ),
681
- /* @__PURE__ */ e(
682
- g,
683
- {
684
- type: "primary",
685
- onClick: () => void _(!0),
686
- loading: E === "publish",
687
- children: (n == null ? void 0 : n.status) === 1 ? "保存并保持发布" : "直接发布"
688
- }
689
- )
690
- ] })
691
- ] }),
692
- /* @__PURE__ */ i("div", { className: t.editorBody, children: [
693
- /* @__PURE__ */ i("div", { className: t.section, children: [
694
- /* @__PURE__ */ i("div", { className: t.sectionTitle, children: [
695
- /* @__PURE__ */ e(Z, {}),
696
- " 资源包(唯一,重新上传将替换)"
697
- ] }),
698
- /* @__PURE__ */ e(
699
- me.Dragger,
700
- {
701
- accept: h ? ".html,.htm,.zip" : ".zip,.crx,.xpi,.tar,.gz,.rar,.7z,.exe,.dmg,.apk",
702
- showUploadList: !1,
703
- maxCount: 1,
704
- beforeUpload: (s) => (te(s), !1),
705
- disabled: G,
706
- children: /* @__PURE__ */ e("div", { className: t.uploaderInner, children: G ? /* @__PURE__ */ e(ce, {}) : /* @__PURE__ */ i(le, { children: [
707
- /* @__PURE__ */ e("p", { className: t.uploaderIcon, children: /* @__PURE__ */ e($e, {}) }),
708
- /* @__PURE__ */ e("p", { className: t.uploaderText, children: h ? "点击或拖拽插件 HTML 文件到此处上传(z-biz-tool-box 插件入口,最大 200MB)" : "点击或拖拽资源包到此处上传(zip / crx 等,最大 200MB)" }),
709
- L && /* @__PURE__ */ i("p", { className: t.uploaderFile, children: [
710
- "当前:",
711
- x,
712
- "(",
713
- Q(f),
714
- ")"
715
- ] })
716
- ] }) })
717
- }
718
- )
719
- ] }),
720
- /* @__PURE__ */ i("div", { className: t.section, children: [
721
- /* @__PURE__ */ i("div", { className: t.sectionTitle, children: [
722
- /* @__PURE__ */ e(de, {}),
723
- " 封面图(可选)"
724
- ] }),
725
- /* @__PURE__ */ e("div", { className: t.coverRow, children: p ? /* @__PURE__ */ i("div", { className: t.coverPreview, children: [
726
- /* @__PURE__ */ e("img", { src: p, alt: "封面" }),
727
- /* @__PURE__ */ e(
728
- g,
729
- {
730
- size: "small",
731
- danger: !0,
732
- className: t.coverRemove,
733
- onClick: () => T(""),
734
- children: "移除"
735
- }
736
- )
737
- ] }) : /* @__PURE__ */ e(
738
- me,
739
- {
740
- accept: "image/png,image/jpeg,image/gif,image/bmp,image/webp",
741
- showUploadList: !1,
742
- beforeUpload: (s) => (ae(s), !1),
743
- disabled: z,
744
- children: /* @__PURE__ */ e(g, { icon: /* @__PURE__ */ e(de, {}), loading: z, children: "上传封面图" })
745
- }
746
- ) })
747
- ] }),
748
- /* @__PURE__ */ i("div", { className: t.section, children: [
749
- /* @__PURE__ */ e("div", { className: t.sectionTitle, children: "基本信息" }),
750
- /* @__PURE__ */ i("div", { className: t.formRow, children: [
751
- /* @__PURE__ */ e("div", { className: t.formLabel, children: "资源名称" }),
752
- /* @__PURE__ */ e(
753
- H,
754
- {
755
- placeholder: "如:Header Forge 请求头锻造器",
756
- value: d,
757
- maxLength: 200,
758
- onChange: (s) => v(s.target.value)
759
- }
760
- )
761
- ] }),
762
- /* @__PURE__ */ i("div", { className: t.formRow, children: [
763
- /* @__PURE__ */ e("div", { className: t.formLabel, children: "简介" }),
764
- /* @__PURE__ */ e(
765
- H.TextArea,
766
- {
767
- placeholder: "一句话介绍该资源解决什么问题",
768
- value: k,
769
- maxLength: 500,
770
- rows: 2,
771
- onChange: (s) => w(s.target.value)
772
- }
773
- )
774
- ] }),
775
- /* @__PURE__ */ i("div", { className: t.formRow, children: [
776
- /* @__PURE__ */ i("div", { className: t.formLabel, children: [
777
- "版本号(替换资源包自动升级;",
778
- h ? "zTools 插件缺省 1.0.0" : "可选",
779
- ")"
780
- ] }),
781
- /* @__PURE__ */ e(
782
- H,
783
- {
784
- placeholder: "如:1.2.0",
785
- value: C,
786
- maxLength: 50,
787
- style: { width: 220 },
788
- onChange: (s) => m(s.target.value)
789
- }
790
- )
791
- ] })
792
- ] }),
793
- /* @__PURE__ */ i("div", { className: t.section, children: [
794
- /* @__PURE__ */ e("div", { className: t.sectionTitle, children: "使用说明文档(Markdown)" }),
795
- /* @__PURE__ */ e(
796
- Le,
797
- {
798
- activeKey: q,
799
- onChange: (s) => ee(s),
800
- items: [
801
- { key: "edit", label: "编辑" },
802
- { key: "preview", label: "预览" }
803
- ]
804
- }
805
- ),
806
- q === "edit" ? /* @__PURE__ */ e(
807
- H.TextArea,
808
- {
809
- className: t.docEditor,
810
- value: S,
811
- onChange: (s) => M(s.target.value),
812
- placeholder: `# 使用说明
813
-
814
- ## 安装步骤
815
- 1. 下载资源包
816
- 2. 浏览器打开 chrome://extensions
817
- 3. ...`,
818
- autoSize: { minRows: 12, maxRows: 24 }
819
- }
820
- ) : /* @__PURE__ */ e("div", { className: t.docPreview, children: S ? /* @__PURE__ */ e(
821
- ve,
822
- {
823
- remarkPlugins: [ge],
824
- rehypePlugins: [_e],
825
- children: S
826
- }
827
- ) : /* @__PURE__ */ i("div", { className: t.docPreviewEmpty, children: [
828
- /* @__PURE__ */ e(Be, {}),
829
- " 暂无内容"
830
- ] }) })
831
- ] })
832
- ] })
833
- ] });
834
- }
835
- function Gt({ category: a }) {
836
- const n = F((m) => m.token), l = F((m) => m.currentUser), [r, c] = u({ kind: "list" }), [h, d] = u([]), [v, k] = u(!1), w = O(async () => {
837
- k(!0);
838
- try {
839
- const m = await Ie({ category: a }, n);
840
- d(Array.isArray(m) ? m : []);
841
- } catch {
842
- } finally {
843
- k(!1);
844
- }
845
- }, [a, n]);
846
- re(() => {
847
- w();
848
- }, [w]);
849
- const C = O(
850
- async (m) => {
851
- if (!m) {
852
- c({ kind: "editor", resource: null });
853
- return;
854
- }
855
- if (m.docContent !== null && m.docContent !== void 0) {
856
- c({ kind: "editor", resource: m });
857
- return;
858
- }
859
- try {
860
- const S = await ye(m.id, n);
861
- c({ kind: "editor", resource: S });
862
- } catch {
863
- c({ kind: "list" });
864
- }
865
- },
866
- [n]
867
- );
868
- return r.kind === "editor" ? /* @__PURE__ */ e(
869
- jt,
870
- {
871
- category: a,
872
- resource: r.resource,
873
- onSaved: (m) => {
874
- c({ kind: "detail", resource: m }), w();
875
- },
876
- onCancel: () => c({ kind: "list" })
877
- }
878
- ) : r.kind === "detail" ? /* @__PURE__ */ e(
879
- Wt,
880
- {
881
- resource: r.resource,
882
- currentUserId: l != null && l.id ? String(l.id) : "",
883
- onBack: () => {
884
- c({ kind: "list" }), w();
885
- },
886
- onEdit: (m) => c({ kind: "editor", resource: m }),
887
- onDeleted: () => {
888
- c({ kind: "list" }), w();
889
- }
890
- }
891
- ) : /* @__PURE__ */ e("div", { className: t.tabBody, children: /* @__PURE__ */ e(
892
- zt,
893
- {
894
- resources: h,
895
- loading: v,
896
- category: a,
897
- onReload: w,
898
- onCreate: () => c({ kind: "editor", resource: null }),
899
- onOpenDetail: (m) => c({ kind: "detail", resource: m }),
900
- onEdit: (m) => void C(m)
901
- }
902
- ) });
903
- }
904
- function ta({ tab: a }) {
905
- return a === "coming" ? /* @__PURE__ */ i("div", { className: t.comingSoon, children: [
906
- /* @__PURE__ */ e("div", { className: t.comingSoonIcon, children: "🧩" }),
907
- /* @__PURE__ */ e("div", { className: t.comingSoonTitle, children: "更多分类敬请期待" }),
908
- /* @__PURE__ */ e("div", { className: t.comingSoonDesc, children: "市场将陆续开放脚本工具等更多资源分类" })
909
- ] }) : /* @__PURE__ */ e(Gt, { category: a });
910
- }
911
- export {
912
- oa as MARKET_TABS,
913
- ta as MarketContent
914
- };