@opentiny/tiny-engine-plugin-page 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,1391 @@
1
+ import "./style.css";
2
+ import { reactive as Z, watchEffect as z, computed as te, resolveComponent as c, openBlock as C, createElementBlock as j, createElementVNode as k, createVNode as o, withCtx as _, createTextVNode as Y, toDisplayString as pe, pushScopeId as ge, popScopeId as de, ref as G, createBlock as O, createCommentVNode as U, Fragment as ce, renderList as Ae } from "vue";
3
+ import { usePage as B, useModal as W, useNotify as T, useBlock as Me, useEditorInfo as qe, getGlobalConfig as be, useApp as ne, useCanvas as ue, useLayout as ie, useBreadcrumb as je, useResource as Je } from "@opentiny/tiny-engine-controller";
4
+ import { SvgButton as oe, BlockHistoryList as Xe, MetaCodeEditor as Ke, LifeCycles as We, PluginSetting as Te, ButtonGroup as ke, PluginPanel as ze } from "@opentiny/tiny-engine-common";
5
+ import { isEqual as me, extend as ae } from "@opentiny/vue-renderless/common/object";
6
+ import { Checkbox as Qe, Form as xe, FormItem as Ve, Input as Oe, Select as Ye, Radio as Ze, Switch as $e, Alert as et, Button as Ee, Collapse as _e, CollapseItem as fe, Search as tt, Tree as at } from "@opentiny/vue";
7
+ import { constants as Re } from "@opentiny/tiny-engine-utils";
8
+ import { isVsCodeEnv as Ge } from "@opentiny/tiny-engine-common/js/environments";
9
+ import { handlePageUpdate as nt } from "@opentiny/tiny-engine-common/js/http";
10
+ import { generateRouter as ot, generatePage as st } from "@opentiny/tiny-engine-common/js/vscodeGenerateFile";
11
+ import { REGEXP_PAGE_NAME as lt, REGEXP_ROUTE as Ce, REGEXP_FOLDER_NAME as rt } from "@opentiny/tiny-engine-common/js/verification";
12
+ import { useHttp as ct } from "@opentiny/tiny-engine-http";
13
+ import { previewPage as it } from "@opentiny/tiny-engine-common/js/preview";
14
+ import { IconFolderOpened as pt, IconFolderClosed as gt } from "@opentiny/vue-icon";
15
+ import { getCanvasStatus as we } from "@opentiny/tiny-engine-common/js/index";
16
+ const A = ct(), dt = (a) => A.get(`/app-center/api/pages/list/${a}`), Pe = (a) => A.get(`/app-center/api/pages/detail/${a}`), ut = (a) => A.get(`/app-center/api/pages/delete/${a}`), mt = (a) => A.post("/app-center/api/pages/create", a), _t = (a, n) => A.post(`/app-center/api/pages/update/${a}`, n), ft = (a) => A.post("/app-center/api/pages/copy", a), He = (a) => A.get(`/app-center/api/pages/histories?page=${a}`), Pt = (a) => A.post("/app-center/api/pageHistory/restore", a), yt = (a) => A.get(`/app-center/api/pages/histories/${a}`), St = (a, n) => A.post(`/app-center/api/pages/update/${a}`, n), se = {
17
+ fetchPageList: dt,
18
+ fetchPageDetail: Pe,
19
+ requestDeletePage: ut,
20
+ requestCreatePage: mt,
21
+ requestCopyPage: ft,
22
+ fetchPageHistory: He,
23
+ fetchHistoryDetail: yt,
24
+ handleRouteHomeUpdate: _t,
25
+ requestRestorePageHistory: Pt,
26
+ requestUpdatePage: St
27
+ };
28
+ const J = (a, n) => {
29
+ const r = a.__vccOpts || a;
30
+ for (const [e, h] of n)
31
+ r[e] = h;
32
+ return r;
33
+ }, ht = {
34
+ components: {
35
+ TinyCheckbox: Qe
36
+ },
37
+ setup() {
38
+ const { pageSettingState: a } = B(), { handleRouteHomeUpdate: n } = se, { confirm: r } = W(), e = Z({
39
+ checked: !1,
40
+ selectDisable: !1
41
+ });
42
+ z(() => {
43
+ var s;
44
+ const t = !!((s = a.currentPageData) != null && s.isHome);
45
+ e.checked = t, e.selectDisable = t;
46
+ });
47
+ const h = te(() => {
48
+ let t = "暂无主页";
49
+ if (a.pages[0]) {
50
+ const l = a.pages[0].data.filter((p) => p.isHome);
51
+ l[0] && (t = l[0].name);
52
+ }
53
+ return t;
54
+ });
55
+ return {
56
+ pageSettingState: a,
57
+ settingHome: () => {
58
+ r({
59
+ title: "提示",
60
+ type: "warning ",
61
+ message: "是否确定要将此页面设置为主页?您所做的任何未保存的更改都将被丢弃。",
62
+ exec: () => {
63
+ const { id: t } = a.currentPageData, s = a.ROOT_ID, l = { ...a.currentPageData };
64
+ l.parentId = s, l.isHome = !0, n(t, l).then(() => {
65
+ a.updateTreeData(), L(), a.isNew = !1, Ge && ot({
66
+ pageId: t,
67
+ componentsTree: l
68
+ }), T({ message: "主页设置成功!", type: "success" });
69
+ }).catch(() => {
70
+ T({ message: "主页设置失败!", type: "error" });
71
+ });
72
+ },
73
+ cancel: () => {
74
+ e.checked = !1;
75
+ }
76
+ });
77
+ },
78
+ homePage: h,
79
+ state: e
80
+ };
81
+ }
82
+ }, Ue = (a) => (ge("data-v-a80e0d02"), a = a(), de(), a), Dt = { class: "home" }, vt = { style: { display: "flex" } }, It = /* @__PURE__ */ Ue(() => /* @__PURE__ */ k("div", { class: "homeTitle" }, "主页设置", -1)), bt = { class: "tip" }, Ct = /* @__PURE__ */ Ue(() => /* @__PURE__ */ k("span", null, "当前主页是", -1)), wt = { class: "home-page" };
83
+ function Ft(a, n, r, e, h, S) {
84
+ const t = c("tiny-checkbox");
85
+ return C(), j("div", Dt, [
86
+ k("div", vt, [
87
+ It,
88
+ o(t, {
89
+ class: "selectHome",
90
+ modelValue: e.state.checked,
91
+ "onUpdate:modelValue": n[0] || (n[0] = (s) => e.state.checked = s),
92
+ disabled: e.state.selectDisable,
93
+ onChange: e.settingHome
94
+ }, {
95
+ default: _(() => [
96
+ Y("设为主页")
97
+ ]),
98
+ _: 1
99
+ }, 8, ["modelValue", "disabled", "onChange"]),
100
+ k("div", bt, [
101
+ Ct,
102
+ k("span", wt, "【" + pe(e.homePage) + "】", 1)
103
+ ])
104
+ ])
105
+ ]);
106
+ }
107
+ const Nt = /* @__PURE__ */ J(ht, [["render", Ft], ["__scopeId", "data-v-a80e0d02"]]), Tt = {
108
+ components: {
109
+ SvgButton: oe,
110
+ TinyForm: xe,
111
+ TinyFormItem: Ve,
112
+ TinyInput: Oe,
113
+ TinySelect: Ye,
114
+ PageHome: Nt,
115
+ TinyRadio: Ze
116
+ },
117
+ props: {
118
+ modelValue: {
119
+ type: Object,
120
+ default: () => ({})
121
+ },
122
+ isFolder: {
123
+ type: Boolean,
124
+ default: !1
125
+ }
126
+ },
127
+ setup() {
128
+ const {
129
+ pageSettingState: a,
130
+ changeTreeData: n
131
+ } = B(), r = a.ROOT_ID, e = G(a.currentPageData.parentId);
132
+ z(() => {
133
+ e.value = a.oldParentId;
134
+ });
135
+ const h = te(() => {
136
+ let y = a.currentPageData.route || "", u = a.currentPageData.parentId;
137
+ for (; u !== r; ) {
138
+ const g = a.treeDataMapping[u];
139
+ if (!g)
140
+ break;
141
+ y = `${g.route}/${y}`, u = g.parentId;
142
+ }
143
+ return y.startsWith("/") && (y = y.slice(1)), y;
144
+ }), S = {
145
+ name: [{
146
+ required: !0,
147
+ message: "请输入页面 ID"
148
+ }, {
149
+ pattern: lt,
150
+ message: "只允许包含英文字母,且为大写开头驼峰格式, 如DemoPage"
151
+ }, {
152
+ min: 3,
153
+ max: 25,
154
+ message: "长度在 3 到 25 个字符"
155
+ }],
156
+ route: [{
157
+ required: !0,
158
+ message: "请输入页面路由"
159
+ }, {
160
+ pattern: Ce,
161
+ message: "只允许包含英文字母、数字、下横线_、中横线-、正斜杠/, 且以英文字母开头"
162
+ }]
163
+ }, t = {
164
+ name: [{
165
+ required: !0,
166
+ message: "请输入页面文件夹 ID"
167
+ }, {
168
+ pattern: rt,
169
+ message: "只允许包含英文字母、数字、下横线_、中横线-, 且以英文字母开头"
170
+ }, {
171
+ min: 3,
172
+ max: 25,
173
+ message: "长度在 3 到 25 个字符"
174
+ }],
175
+ route: [{
176
+ required: !0,
177
+ message: "请输入页面文件夹路由"
178
+ }, {
179
+ pattern: Ce,
180
+ message: "只允许包含英文字母、数字、下横线_、中横线-、正斜杠/, 且以英文字母开头"
181
+ }],
182
+ group: [{
183
+ required: !0,
184
+ message: "必须选择页面类型"
185
+ }]
186
+ }, s = (y) => {
187
+ const u = [];
188
+ return y.forEach((g) => {
189
+ !g.isPage && g.id !== a.currentPageData.id && (u.push(g), g.children || (g.children = []), g.children = s(g.children));
190
+ }), u;
191
+ }, l = te(() => {
192
+ var E;
193
+ const y = o(c("SvgIcon"), {
194
+ name: "text-page-folder-closed",
195
+ class: "folder-icon"
196
+ }, null), u = o(c("SvgIcon"), {
197
+ name: "text-page-folder",
198
+ class: "folder-icon"
199
+ }, null), g = ((E = a.pages[0]) == null ? void 0 : E.data) || [];
200
+ return {
201
+ data: [{
202
+ name: "无",
203
+ id: r
204
+ }, ...s(JSON.parse(JSON.stringify(g)))],
205
+ shrinkIcon: u,
206
+ expandIcon: y,
207
+ renderContent: (R, {
208
+ node: X,
209
+ data: Q
210
+ }) => o("span", {
211
+ style: "display:flex"
212
+ }, [X.isLeaf && Q.id !== r ? o(c("svg-icon"), {
213
+ name: "text-page-folder-closed",
214
+ style: "margin-right:14px"
215
+ }, null) : null, o("span", {
216
+ class: "label"
217
+ }, [X.label])])
218
+ };
219
+ }), p = G(null);
220
+ return {
221
+ pageRules: S,
222
+ folderRules: t,
223
+ pageSettingState: a,
224
+ generalForm: p,
225
+ validGeneralForm: () => new Promise((y, u) => {
226
+ p.value.validate((g) => {
227
+ g ? y(g) : u(g);
228
+ });
229
+ }),
230
+ treeFolderOp: l,
231
+ currentRoute: h,
232
+ changeParentForderId: (y) => {
233
+ n(y.id, e.value), e.value = y.id;
234
+ }
235
+ };
236
+ }
237
+ };
238
+ const Le = (a) => (ge("data-v-160d1d87"), a = a(), de(), a), kt = { class: "general-config" }, xt = /* @__PURE__ */ Le(() => /* @__PURE__ */ k("span", { class: "input-head" }, "website.com", -1)), Vt = { class: "tip" }, Ot = {
239
+ key: 0,
240
+ class: "text"
241
+ }, Et = {
242
+ key: 1,
243
+ class: "route-text"
244
+ }, Rt = /* @__PURE__ */ Le(() => /* @__PURE__ */ k("span", { class: "text" }, "website.com/", -1)), Gt = { class: "text-dim" };
245
+ function Ht(a, n, r, e, h, S) {
246
+ const t = c("tiny-radio"), s = c("tiny-form-item"), l = c("tiny-input"), p = c("tiny-select"), d = c("svg-button"), P = c("tiny-form"), y = c("page-home");
247
+ return C(), j("div", kt, [
248
+ o(P, {
249
+ ref: "generalForm",
250
+ model: e.pageSettingState.currentPageData,
251
+ rules: r.isFolder ? e.folderRules : e.pageRules,
252
+ "label-width": "120px",
253
+ "validate-type": "text",
254
+ "inline-message": !0,
255
+ "label-align": !0,
256
+ "label-position": "left",
257
+ class: "general-config-form"
258
+ }, {
259
+ default: _(() => [
260
+ r.isFolder ? U("", !0) : (C(), O(s, {
261
+ key: 0,
262
+ prop: "group",
263
+ label: "选择页面类型",
264
+ class: "form-item-page-type"
265
+ }, {
266
+ default: _(() => [
267
+ o(t, {
268
+ modelValue: e.pageSettingState.currentPageData.group,
269
+ "onUpdate:modelValue": n[0] || (n[0] = (u) => e.pageSettingState.currentPageData.group = u),
270
+ class: "page-type-radio",
271
+ label: "staticPages"
272
+ }, {
273
+ default: _(() => [
274
+ Y(" 静态页面 ")
275
+ ]),
276
+ _: 1
277
+ }, 8, ["modelValue"]),
278
+ o(t, {
279
+ modelValue: e.pageSettingState.currentPageData.group,
280
+ "onUpdate:modelValue": n[1] || (n[1] = (u) => e.pageSettingState.currentPageData.group = u),
281
+ class: "page-type-radio",
282
+ label: "publicPages"
283
+ }, {
284
+ default: _(() => [
285
+ Y(" 公共页面 ")
286
+ ]),
287
+ _: 1
288
+ }, 8, ["modelValue"])
289
+ ]),
290
+ _: 1
291
+ })),
292
+ o(s, {
293
+ prop: "name",
294
+ label: `${r.isFolder ? "文件夹" : "页面"}ID`
295
+ }, {
296
+ default: _(() => [
297
+ o(l, {
298
+ modelValue: e.pageSettingState.currentPageData.name,
299
+ "onUpdate:modelValue": n[2] || (n[2] = (u) => e.pageSettingState.currentPageData.name = u),
300
+ placeholder: `请设置${r.isFolder ? "文件夹" : "页面"}ID`
301
+ }, null, 8, ["modelValue", "placeholder"])
302
+ ]),
303
+ _: 1
304
+ }, 8, ["label"]),
305
+ e.pageSettingState.currentPageData.group !== "publicPages" ? (C(), O(s, {
306
+ key: 1,
307
+ label: "选择父文件夹",
308
+ prop: "parentId"
309
+ }, {
310
+ default: _(() => [
311
+ o(p, {
312
+ modelValue: e.pageSettingState.currentPageData.parentId,
313
+ "onUpdate:modelValue": n[3] || (n[3] = (u) => e.pageSettingState.currentPageData.parentId = u),
314
+ "value-field": "id",
315
+ "render-type": "tree",
316
+ "tree-op": e.treeFolderOp,
317
+ "text-field": "name",
318
+ placeholder: "请选择父文件夹",
319
+ "popper-class": "parent-fold-select-dropdown",
320
+ onChange: e.changeParentForderId
321
+ }, null, 8, ["modelValue", "tree-op", "onChange"])
322
+ ]),
323
+ _: 1
324
+ })) : U("", !0),
325
+ o(s, {
326
+ label: "路由",
327
+ prop: "route"
328
+ }, {
329
+ default: _(() => [
330
+ o(l, {
331
+ modelValue: e.pageSettingState.currentPageData.route,
332
+ "onUpdate:modelValue": n[4] || (n[4] = (u) => e.pageSettingState.currentPageData.route = u),
333
+ placeholder: "请设置路由"
334
+ }, {
335
+ prepend: _(() => [
336
+ xt
337
+ ]),
338
+ _: 1
339
+ }, 8, ["modelValue"]),
340
+ k("div", Vt, [
341
+ o(d, {
342
+ class: "icon",
343
+ name: "text-page-link"
344
+ }),
345
+ e.pageSettingState.currentPageData.route ? (C(), j("span", Et, [
346
+ Rt,
347
+ k("span", Gt, pe(e.currentRoute), 1)
348
+ ])) : (C(), j("span", Ot, "路由将以website.com开头"))
349
+ ])
350
+ ]),
351
+ _: 1
352
+ })
353
+ ]),
354
+ _: 1
355
+ }, 8, ["model", "rules"]),
356
+ !r.isFolder && !e.pageSettingState.isNew && e.pageSettingState.currentPageData.group !== "public" ? (C(), O(y, { key: 0 })) : U("", !0)
357
+ ]);
358
+ }
359
+ const Be = /* @__PURE__ */ J(Tt, [["render", Ht], ["__scopeId", "data-v-160d1d87"]]), Ut = {
360
+ components: {
361
+ BlockHistoryList: Xe
362
+ },
363
+ props: {
364
+ curPageData: {
365
+ type: Object,
366
+ default: () => ({})
367
+ }
368
+ },
369
+ emits: ["restorePage"],
370
+ setup(a, { emit: n }) {
371
+ const { pageSettingState: r } = B(), { getDateFromNow: e } = Me(), { confirm: h } = W(), S = G([]), t = (p) => {
372
+ const { id: d, version: P } = qe().useInfo(), y = P ? `&app=${d}&version=${P}` : "";
373
+ p ? He(p + y).then((u) => {
374
+ u.forEach((g) => {
375
+ g.backupTitle = g.message, g.backupTime = e(new Date(g.time));
376
+ }), S.value = u.reverse();
377
+ }) : S.value = [];
378
+ };
379
+ return z(() => {
380
+ var d;
381
+ const p = ((d = r.currentPageData) == null ? void 0 : d.id) || "";
382
+ t(p);
383
+ }), {
384
+ list: S,
385
+ previewHistory: (p) => {
386
+ var d, P;
387
+ p && it({
388
+ id: p.page,
389
+ history: p.id,
390
+ framework: (d = be()) == null ? void 0 : d.dslMode,
391
+ platform: (P = be()) == null ? void 0 : P.platformId
392
+ });
393
+ },
394
+ restoreHistory: (p) => {
395
+ h({
396
+ title: "提示",
397
+ message: "您即将还原历史页面,是否继续还原?",
398
+ exec: () => {
399
+ n("restorePage", p);
400
+ }
401
+ });
402
+ }
403
+ };
404
+ }
405
+ };
406
+ function Lt(a, n, r, e, h, S) {
407
+ const t = c("block-history-list");
408
+ return C(), O(t, {
409
+ history: e.list,
410
+ onPreview: e.previewHistory,
411
+ onRestore: e.restoreHistory
412
+ }, null, 8, ["history", "onPreview", "onRestore"]);
413
+ }
414
+ const Bt = /* @__PURE__ */ J(Ut, [["render", Lt]]);
415
+ const At = {
416
+ components: {
417
+ MetaCodeEditor: Ke,
418
+ TinyForm: xe,
419
+ TinyFormItem: Ve,
420
+ TinySwitch: $e,
421
+ TinyAlert: et
422
+ },
423
+ setup() {
424
+ const a = G(""), n = G(""), { pageSettingState: r } = B(), e = te(() => r.currentPageData);
425
+ return z(() => {
426
+ var t, s;
427
+ a.value = ((t = r.currentPageData.page_content) == null ? void 0 : t.inputs) || "", n.value = ((s = r.currentPageData.page_content) == null ? void 0 : s.outputs) || "";
428
+ }), {
429
+ inputValue: a,
430
+ outputValue: n,
431
+ saveInputValue: (t) => {
432
+ try {
433
+ const s = JSON.parse(t.content);
434
+ a.value = t.content, e.value.page_content.inputs = s;
435
+ } catch (s) {
436
+ T({
437
+ title: "输入配置保存失败(必须符合JSON格式)",
438
+ message: `${(s == null ? void 0 : s.message) || s}`,
439
+ type: "error"
440
+ });
441
+ }
442
+ },
443
+ saveOutputValue: (t) => {
444
+ try {
445
+ const s = JSON.parse(t.content);
446
+ n.value = t.content, e.value.page_content.outputs = s;
447
+ } catch (s) {
448
+ T({
449
+ title: "输出配置保存失败(必须符合JSON格式)",
450
+ message: `${(s == null ? void 0 : s.message) || s}`,
451
+ type: "error"
452
+ });
453
+ }
454
+ },
455
+ pageSettingState: r
456
+ };
457
+ }
458
+ }, Mt = (a) => (ge("data-v-0e5dd273"), a = a(), de(), a), qt = { class: "input-or-output" }, jt = /* @__PURE__ */ Mt(() => /* @__PURE__ */ k("p", { class: "page-root-tips" }, "设置根元素为Body,默认为div", -1));
459
+ function Jt(a, n, r, e, h, S) {
460
+ const t = c("tiny-alert"), s = c("meta-code-editor"), l = c("tiny-form-item"), p = c("tiny-switch"), d = c("tiny-form");
461
+ return C(), j("div", qt, [
462
+ o(t, {
463
+ type: "info",
464
+ description: "输入配置: 传递给页面的参数(类似组件的输入属性);输出配置: 页面传递出的事件(类似组件触发的输出事件)",
465
+ closable: !1,
466
+ class: "life-cycle-alert"
467
+ }),
468
+ o(d, {
469
+ "label-position": "left",
470
+ class: "input-output-form"
471
+ }, {
472
+ default: _(() => [
473
+ o(l, { label: "输入配置" }, {
474
+ default: _(() => [
475
+ o(s, {
476
+ modelValue: e.inputValue,
477
+ title: "输入配置",
478
+ "button-text": "输入配置",
479
+ language: "json",
480
+ single: "",
481
+ onSave: e.saveInputValue
482
+ }, null, 8, ["modelValue", "onSave"])
483
+ ]),
484
+ _: 1
485
+ }),
486
+ o(l, { label: "输出配置" }, {
487
+ default: _(() => [
488
+ o(s, {
489
+ modelValue: e.outputValue,
490
+ title: "输出配置",
491
+ "button-text": "输出配置",
492
+ language: "json",
493
+ single: "",
494
+ onSave: e.saveOutputValue
495
+ }, null, 8, ["modelValue", "onSave"])
496
+ ]),
497
+ _: 1
498
+ }),
499
+ o(l, {
500
+ label: "根元素设置",
501
+ class: "page-root-form-item"
502
+ }, {
503
+ default: _(() => [
504
+ o(p, {
505
+ modelValue: e.pageSettingState.currentPageData.isBody,
506
+ "onUpdate:modelValue": n[0] || (n[0] = (P) => e.pageSettingState.currentPageData.isBody = P)
507
+ }, null, 8, ["modelValue"]),
508
+ jt
509
+ ]),
510
+ _: 1
511
+ })
512
+ ]),
513
+ _: 1
514
+ })
515
+ ]);
516
+ }
517
+ const Xt = /* @__PURE__ */ J(At, [["render", Jt], ["__scopeId", "data-v-0e5dd273"]]), {
518
+ COMPONENT_NAME: Kt
519
+ } = Re, ye = G(!1), ee = () => {
520
+ ye.value = !0;
521
+ }, L = () => {
522
+ ye.value = !1;
523
+ const {
524
+ resetPageData: a
525
+ } = B();
526
+ a();
527
+ }, Fe = {
528
+ general: "general",
529
+ inputOutput: "inputOutput",
530
+ lifeCycles: "lifeCycles",
531
+ history: "history"
532
+ }, Wt = {
533
+ components: {
534
+ TinyButton: Ee,
535
+ TinyCollapse: _e,
536
+ TinyCollapseItem: fe,
537
+ PageInputOutput: Xt,
538
+ LifeCycles: We,
539
+ PageGeneral: Be,
540
+ PageHistory: Bt,
541
+ PluginSetting: Te,
542
+ SvgButton: oe,
543
+ ButtonGroup: ke
544
+ },
545
+ props: {
546
+ isFolder: {
547
+ type: Boolean,
548
+ default: !1
549
+ }
550
+ },
551
+ emits: ["openNewPage"],
552
+ setup(a, {
553
+ emit: n
554
+ }) {
555
+ const {
556
+ requestCreatePage: r,
557
+ requestDeletePage: e
558
+ } = se, {
559
+ appInfoState: h
560
+ } = ne(), {
561
+ DEFAULT_PAGE: S,
562
+ pageSettingState: t,
563
+ changeTreeData: s,
564
+ isCurrentDataSame: l,
565
+ initCurrentPageData: p,
566
+ isTemporaryPage: d
567
+ } = B(), {
568
+ pageState: P,
569
+ initData: y
570
+ } = ue(), {
571
+ confirm: u
572
+ } = W(), g = G(null), f = Z({
573
+ activeName: Object.values(Fe),
574
+ title: "页面设置",
575
+ historyMessage: ""
576
+ }), D = () => {
577
+ me(t.currentPageData, t.currentPageDataCopy) ? L() : u({
578
+ title: "提示",
579
+ message: "您即将使用未保存的更改关闭此页。是否要在关闭之前放弃这些更改?",
580
+ exec: () => {
581
+ t.isNew || (s(t.oldParentId, t.currentPageData.parentId), Object.assign(t.currentPageData, t.currentPageDataCopy)), L();
582
+ }
583
+ });
584
+ }, E = () => {
585
+ const {
586
+ page_content: v,
587
+ ...I
588
+ } = S, {
589
+ page_content: x,
590
+ ...N
591
+ } = t.currentPageData, V = {
592
+ ...I,
593
+ ...N,
594
+ page_content: {
595
+ ...v,
596
+ ...x,
597
+ fileName: t.currentPageData.name
598
+ },
599
+ app: h.selectedId,
600
+ isPage: !0
601
+ };
602
+ r(V).then((i) => {
603
+ t.updateTreeData(), t.isNew = !1, d.saved = !1, n("openNewPage", i), L(), ie().closePlugin(), T({
604
+ type: "success",
605
+ message: "新建页面成功!"
606
+ }), Ge && st(i);
607
+ }).catch((i) => {
608
+ T({
609
+ type: "error",
610
+ title: "新建页面失败",
611
+ message: JSON.stringify((i == null ? void 0 : i.message) || i)
612
+ });
613
+ });
614
+ }, R = (v, I) => {
615
+ const x = t.currentPageDataCopy.route !== t.currentPageData.route;
616
+ return nt(v, I, x);
617
+ }, X = (v) => {
618
+ v.id = v.page, ["page", "backupTime", "backupTitle", "time"].forEach((N) => delete v[N]);
619
+ const x = {
620
+ ...t.currentPageData,
621
+ ...v,
622
+ message: "还原页面"
623
+ };
624
+ R(v.id, x).then((N) => {
625
+ var V;
626
+ ((V = P == null ? void 0 : P.currentPage) == null ? void 0 : V.id) === (N == null ? void 0 : N.id) && y(N.page_content, N);
627
+ });
628
+ }, Q = async () => {
629
+ const {
630
+ id: v,
631
+ name: I,
632
+ page_content: x
633
+ } = t.currentPageData, N = {
634
+ ...t.currentPageData,
635
+ page_content: {
636
+ ...x,
637
+ fileName: I
638
+ }
639
+ }, V = await R(v, N);
640
+ p(V);
641
+ }, le = (v) => {
642
+ if (!v)
643
+ return;
644
+ const I = t.currentPageData.page_content;
645
+ I.lifeCycles = {
646
+ ...I.lifeCycles || {},
647
+ ...v
648
+ };
649
+ }, K = () => {
650
+ const v = t.currentPageData, I = ae(!0, {}, v);
651
+ t.isNew = !0, I.name = `${I.name}Copy`, I.route = `${I.route}Copy`, t.currentPageData = I, t.currentPageDataCopy = ae(!0, {}, I);
652
+ }, re = () => {
653
+ l() ? K() : u({
654
+ title: "提示",
655
+ message: "您即将复制的页面有更改未保存,是否确定跳过更改直接复制?",
656
+ exec: () => {
657
+ s(t.oldParentId, t.currentPageData.parentId), Object.assign(t.currentPageData, t.currentPageDataCopy), K();
658
+ }
659
+ });
660
+ }, $ = () => {
661
+ u({
662
+ title: "创建历史备份信息",
663
+ status: "custom",
664
+ message: {
665
+ render: () => o(Oe, {
666
+ placeholder: "历史备份信息",
667
+ modelValue: f.historyMessage,
668
+ "onUpdate:modelValue": (V) => f.historyMessage = V
669
+ }, null)
670
+ },
671
+ exec: () => {
672
+ t.currentPageData.message = f.historyMessage.trim() || "Page auto save", t.isNew ? E() : Q(), f.historyMessage = "";
673
+ }
674
+ });
675
+ };
676
+ return {
677
+ state: f,
678
+ isShow: ye,
679
+ savePageSetting: () => {
680
+ g.value.validGeneralForm().then($);
681
+ },
682
+ copyPage: re,
683
+ pageSettingState: t,
684
+ pageGeneralRef: g,
685
+ deletePage: () => {
686
+ u({
687
+ title: "提示",
688
+ message: "您是否要删除页面?",
689
+ exec: () => {
690
+ var I;
691
+ const v = ((I = t.currentPageData) == null ? void 0 : I.id) || "";
692
+ e(v).then(() => {
693
+ t.updateTreeData().then((x) => {
694
+ var V, i, m;
695
+ const N = ((i = (V = x == null ? void 0 : x[0]) == null ? void 0 : V.data) == null ? void 0 : i[0]) || {
696
+ componentName: Kt.Page
697
+ };
698
+ ((m = P == null ? void 0 : P.currentPage) == null ? void 0 : m.id) === v && n("openNewPage", N);
699
+ }), L(), T({
700
+ message: "删除页面成功!",
701
+ type: "success"
702
+ });
703
+ }).catch(() => {
704
+ T({
705
+ message: "删除页面失败!",
706
+ type: "error"
707
+ });
708
+ });
709
+ }
710
+ });
711
+ },
712
+ cancelPageSetting: D,
713
+ closePageSettingPanel: L,
714
+ updatePageLifeCycles: le,
715
+ restorePage: X,
716
+ PAGE_SETTING_SESSION: Fe
717
+ };
718
+ }
719
+ };
720
+ const zt = { class: "page-setting-content" };
721
+ function Qt(a, n, r, e, h, S) {
722
+ const t = c("tiny-button"), s = c("svg-button"), l = c("button-group"), p = c("page-general"), d = c("tiny-collapse-item"), P = c("page-input-output"), y = c("life-cycles"), u = c("page-history"), g = c("tiny-collapse"), f = c("plugin-setting");
723
+ return e.isShow ? (C(), O(f, {
724
+ key: 0,
725
+ title: e.state.title,
726
+ class: "page-plugin-setting"
727
+ }, {
728
+ header: _(() => [
729
+ o(l, null, {
730
+ default: _(() => [
731
+ o(t, {
732
+ type: "primary",
733
+ onClick: e.savePageSetting
734
+ }, {
735
+ default: _(() => [
736
+ Y("保存")
737
+ ]),
738
+ _: 1
739
+ }, 8, ["onClick"]),
740
+ e.pageSettingState.isNew ? U("", !0) : (C(), O(s, {
741
+ key: 0,
742
+ name: "delete",
743
+ tips: "删除页面",
744
+ onClick: e.deletePage
745
+ }, null, 8, ["onClick"])),
746
+ e.pageSettingState.isNew ? U("", !0) : (C(), O(s, {
747
+ key: 1,
748
+ name: "text-copy-page",
749
+ placement: "bottom",
750
+ tips: "复制页面",
751
+ onClick: e.copyPage
752
+ }, null, 8, ["onClick"]))
753
+ ]),
754
+ _: 1
755
+ }),
756
+ o(s, {
757
+ class: "close-plugin-setting-icon",
758
+ name: "close",
759
+ onClick: e.cancelPageSetting
760
+ }, null, 8, ["onClick"])
761
+ ]),
762
+ content: _(() => [
763
+ k("div", zt, [
764
+ o(g, {
765
+ modelValue: e.state.activeName,
766
+ "onUpdate:modelValue": n[0] || (n[0] = (D) => e.state.activeName = D),
767
+ class: "page-setting-collapse"
768
+ }, {
769
+ default: _(() => [
770
+ o(d, {
771
+ title: "基本设置",
772
+ name: e.PAGE_SETTING_SESSION.general
773
+ }, {
774
+ default: _(() => [
775
+ o(p, {
776
+ ref: "pageGeneralRef",
777
+ isFolder: r.isFolder
778
+ }, null, 8, ["isFolder"])
779
+ ]),
780
+ _: 1
781
+ }, 8, ["name"]),
782
+ e.pageSettingState.currentPageData.group !== "public" ? (C(), O(d, {
783
+ key: 0,
784
+ class: "base-setting",
785
+ title: "输入输出",
786
+ name: e.PAGE_SETTING_SESSION.inputOutput
787
+ }, {
788
+ default: _(() => [
789
+ o(P)
790
+ ]),
791
+ _: 1
792
+ }, 8, ["name"])) : U("", !0),
793
+ e.pageSettingState.currentPageData.group !== "public" ? (C(), O(d, {
794
+ key: 1,
795
+ class: "input-output",
796
+ title: "页面生命周期配置",
797
+ name: e.PAGE_SETTING_SESSION.lifeCycles
798
+ }, {
799
+ default: _(() => {
800
+ var D;
801
+ return [
802
+ o(y, {
803
+ bindLifeCycles: (D = e.pageSettingState.currentPageData.page_content) == null ? void 0 : D.lifeCycles,
804
+ onUpdatePageLifeCycles: e.updatePageLifeCycles
805
+ }, null, 8, ["bindLifeCycles", "onUpdatePageLifeCycles"])
806
+ ];
807
+ }),
808
+ _: 1
809
+ }, 8, ["name"])) : U("", !0),
810
+ o(d, {
811
+ class: "history-source",
812
+ title: "历史备份",
813
+ name: e.PAGE_SETTING_SESSION.history
814
+ }, {
815
+ default: _(() => [
816
+ o(u, { onRestorePage: e.restorePage }, null, 8, ["onRestorePage"])
817
+ ]),
818
+ _: 1
819
+ }, 8, ["name"])
820
+ ]),
821
+ _: 1
822
+ }, 8, ["modelValue"])
823
+ ])
824
+ ]),
825
+ _: 1
826
+ }, 8, ["title"])) : U("", !0);
827
+ }
828
+ const Yt = /* @__PURE__ */ J(Wt, [["render", Qt], ["__scopeId", "data-v-b34cdcbb"]]);
829
+ let Se = G(!1);
830
+ const Ne = () => {
831
+ Se.value = !0;
832
+ }, H = () => {
833
+ Se.value = !1;
834
+ const { resetPageData: a } = B();
835
+ a();
836
+ }, Zt = {
837
+ components: {
838
+ TinyButton: Ee,
839
+ TinyCollapse: _e,
840
+ TinyCollapseItem: fe,
841
+ PluginSetting: Te,
842
+ PageGeneral: Be,
843
+ SvgButton: oe,
844
+ ButtonGroup: ke
845
+ },
846
+ props: {
847
+ isFolder: {
848
+ type: Boolean,
849
+ default: !1
850
+ }
851
+ },
852
+ setup() {
853
+ const a = Z({
854
+ activeName: ["folderGeneralRef"],
855
+ title: "文件夹设置"
856
+ }), n = G(null), { requestCreatePage: r, requestUpdatePage: e, requestDeletePage: h } = se, { appInfoState: S } = ne(), { pageSettingState: t, changeTreeData: s } = B(), { confirm: l } = W(), p = () => {
857
+ me(t.currentPageData, t.currentPageDataCopy) ? H() : l({
858
+ title: "提示",
859
+ message: "您即将使用未保存的更改关闭此页。是否要在关闭之前放弃这些更改?",
860
+ exec: () => {
861
+ t.isNew || (s(t.oldParentId, t.currentPageData.parentId), Object.assign(t.currentPageData, t.currentPageDataCopy)), H();
862
+ }
863
+ });
864
+ }, d = () => {
865
+ const f = {
866
+ ...t.currentPageData,
867
+ app: S.selectedId,
868
+ isPage: !1
869
+ };
870
+ r(f).then(() => {
871
+ t.updateTreeData(), t.isNew = !1, H(), T({
872
+ type: "success",
873
+ message: "新建文件夹成功!"
874
+ });
875
+ }).catch((D) => {
876
+ T({
877
+ type: "error",
878
+ title: "新建文件夹失败",
879
+ message: JSON.stringify((D == null ? void 0 : D.message) || D)
880
+ });
881
+ });
882
+ }, P = () => {
883
+ const { id: g } = t.currentPageData;
884
+ e(g, { ...t.currentPageData, page_content: null }).then(() => {
885
+ t.updateTreeData(), t.isNew = !1, H(), T({
886
+ type: "success",
887
+ message: "更新文件夹成功!"
888
+ });
889
+ }).catch((f) => {
890
+ T({
891
+ type: "error",
892
+ title: "更新文件夹失败",
893
+ message: JSON.stringify((f == null ? void 0 : f.message) || f)
894
+ });
895
+ });
896
+ };
897
+ return {
898
+ saveFolderSetting: () => {
899
+ n.value.validGeneralForm().then(() => {
900
+ t.isNew ? d() : P();
901
+ });
902
+ },
903
+ deleteFolder: () => {
904
+ var g, f;
905
+ if ((f = (g = t.treeDataMapping[t.currentPageData.id]) == null ? void 0 : g.children) != null && f.length)
906
+ return T({
907
+ type: "error",
908
+ message: "此文件夹不是空文件夹,不能删除!"
909
+ }), !1;
910
+ l({
911
+ title: "提示",
912
+ message: "您是否要删除文件夹?",
913
+ exec: () => {
914
+ var E;
915
+ const D = ((E = t.currentPageData) == null ? void 0 : E.id) || "";
916
+ h(D).then(() => {
917
+ t.updateTreeData(), H(), T({
918
+ type: "success",
919
+ message: "删除文件夹成功!"
920
+ });
921
+ }).catch((R) => {
922
+ T({
923
+ type: "success",
924
+ title: "删除文件夹失败!",
925
+ message: JSON.stringify((R == null ? void 0 : R.message) || R)
926
+ });
927
+ });
928
+ }
929
+ });
930
+ },
931
+ folderGeneralRef: n,
932
+ closeFolderSettingPanel: H,
933
+ isShow: Se,
934
+ state: a,
935
+ pageSettingState: t,
936
+ closeFolderSetting: p
937
+ };
938
+ }
939
+ }, $t = { class: "page-setting-content" };
940
+ function ea(a, n, r, e, h, S) {
941
+ const t = c("tiny-button"), s = c("svg-button"), l = c("button-group"), p = c("page-general"), d = c("tiny-collapse-item"), P = c("tiny-collapse"), y = c("plugin-setting");
942
+ return e.isShow ? (C(), O(y, {
943
+ key: 0,
944
+ title: e.state.title,
945
+ class: "pageFolder-plugin-setting"
946
+ }, {
947
+ header: _(() => [
948
+ o(l, null, {
949
+ default: _(() => [
950
+ o(t, {
951
+ type: "primary",
952
+ onClick: e.saveFolderSetting
953
+ }, {
954
+ default: _(() => [
955
+ Y("保存")
956
+ ]),
957
+ _: 1
958
+ }, 8, ["onClick"]),
959
+ e.pageSettingState.isNew ? U("", !0) : (C(), O(s, {
960
+ key: 0,
961
+ name: "delete",
962
+ placement: "bottom",
963
+ tips: "删除",
964
+ onClick: e.deleteFolder
965
+ }, null, 8, ["onClick"])),
966
+ o(s, {
967
+ class: "close-plugin-setting-icon",
968
+ name: "close",
969
+ onClick: e.closeFolderSetting
970
+ }, null, 8, ["onClick"])
971
+ ]),
972
+ _: 1
973
+ })
974
+ ]),
975
+ content: _(() => [
976
+ k("div", $t, [
977
+ o(P, {
978
+ modelValue: e.state.activeName,
979
+ "onUpdate:modelValue": n[0] || (n[0] = (u) => e.state.activeName = u)
980
+ }, {
981
+ default: _(() => [
982
+ o(d, {
983
+ title: "基本设置",
984
+ name: "folderGeneralRef"
985
+ }, {
986
+ default: _(() => [
987
+ o(p, {
988
+ ref: "folderGeneralRef",
989
+ isFolder: r.isFolder
990
+ }, null, 8, ["isFolder"])
991
+ ]),
992
+ _: 1
993
+ })
994
+ ]),
995
+ _: 1
996
+ }, 8, ["modelValue"])
997
+ ])
998
+ ]),
999
+ _: 1
1000
+ }, 8, ["title"])) : U("", !0);
1001
+ }
1002
+ const ta = /* @__PURE__ */ J(Zt, [["render", ea], ["__scopeId", "data-v-7723c7ff"]]), {
1003
+ ELEMENT_TAG: aa,
1004
+ PAGE_STATUS: na
1005
+ } = Re, oa = {
1006
+ components: {
1007
+ TinySearch: tt,
1008
+ TinyTree: at,
1009
+ TinyCollapse: _e,
1010
+ TinyCollapseItem: fe
1011
+ },
1012
+ props: {
1013
+ isFolder: {
1014
+ type: Boolean,
1015
+ default: !1
1016
+ }
1017
+ },
1018
+ emits: ["openSettingPanel", "add"],
1019
+ setup(a, {
1020
+ emit: n
1021
+ }) {
1022
+ const {
1023
+ appInfoState: r
1024
+ } = ne(), {
1025
+ confirm: e
1026
+ } = W(), {
1027
+ initData: h,
1028
+ pageState: S,
1029
+ isBlock: t,
1030
+ isSaved: s
1031
+ } = ue(), {
1032
+ pageSettingState: l,
1033
+ changeTreeData: p,
1034
+ isCurrentDataSame: d
1035
+ } = B(), {
1036
+ fetchPageList: P,
1037
+ fetchPageDetail: y
1038
+ } = se, {
1039
+ setBreadcrumbPage: u
1040
+ } = je(), g = G([]), f = l.ROOT_ID, D = Z({
1041
+ pageSearchValue: "",
1042
+ collapseValue: [0, 1],
1043
+ currentNodeData: {}
1044
+ }), E = (i, m, w) => {
1045
+ const F = {
1046
+ 0: {
1047
+ id: f,
1048
+ name: "站点根目录",
1049
+ children: []
1050
+ }
1051
+ };
1052
+ return i.forEach((b) => {
1053
+ F[b[w]] = b, b.parentId === f && F[f].children.push(b);
1054
+ }), i.forEach((b) => {
1055
+ let M = F[b[m]];
1056
+ M && M.id !== f ? (M.children = M.children || [], M.children.push(b)) : M && M.id;
1057
+ }), l.treeDataMapping = F, l.treeDataMapping;
1058
+ }, R = async (i, m) => {
1059
+ const w = m || await P(i), F = {
1060
+ groupName: "静态页面",
1061
+ groupId: 0,
1062
+ data: []
1063
+ }, b = {
1064
+ groupName: "公共页面",
1065
+ groupId: 1,
1066
+ data: []
1067
+ };
1068
+ w.forEach((q) => {
1069
+ const ve = q.meta ? {
1070
+ ...q,
1071
+ ...q.meta,
1072
+ name: q.fileName,
1073
+ isPage: !0,
1074
+ isBody: q.meta.rootElement === aa.Body
1075
+ } : q.name ? q : {
1076
+ ...q,
1077
+ name: q.folderName,
1078
+ group: "staticPages"
1079
+ }, {
1080
+ children: ma,
1081
+ ...Ie
1082
+ } = ve;
1083
+ ve.group === "staticPages" ? F.data.push(Ie) : b.data.push(Ie);
1084
+ });
1085
+ const M = E([...F.data], "parentId", "id");
1086
+ return F.data = M[f].children, l.pages = [F, b], l.pages;
1087
+ };
1088
+ l.updateTreeData = async () => await R(r.selectedId);
1089
+ const X = () => {
1090
+ S.currentVm = null, S.hoverVm = null, S.properties = {}, S.pageSchema = null;
1091
+ }, Q = (i) => {
1092
+ const m = new URL(window.location);
1093
+ m.searchParams.delete("blockid"), m.searchParams.set("pageid", i), window.history.pushState({}, "", m);
1094
+ }, le = (i) => {
1095
+ y(i).then((m) => {
1096
+ Q(i), L(), H(), ie().closePlugin(), ie().layoutState.pageStatus = we(m.occupier), h(m.page_content, m);
1097
+ });
1098
+ }, K = (i) => {
1099
+ S.hoverVm = null, D.currentNodeData = i, u([(i == null ? void 0 : i.name) || "untitle"]), X(), le(i.id);
1100
+ }, re = (i, m) => {
1101
+ var b;
1102
+ i.stopPropagation();
1103
+ const {
1104
+ id: w,
1105
+ isPage: F
1106
+ } = m.data;
1107
+ !t() && w === ((b = D == null ? void 0 : D.currentNodeData) == null ? void 0 : b.id) || !F || (s() && d() ? K(m.data) : e({
1108
+ title: "提示",
1109
+ message: `${t() ? "区块" : "页面"}尚未保存,是否要继续切换?`,
1110
+ exec: () => {
1111
+ p(l.oldParentId, l.currentPageData.parentId), Object.assign(l.currentPageData, l.currentPageDataCopy), K(m.data);
1112
+ }
1113
+ }));
1114
+ }, $ = (i, m, w) => {
1115
+ var F;
1116
+ if (i.stopPropagation(), w && m.data.isPage) {
1117
+ const b = ((F = m.data.occupier) == null ? void 0 : F.username) || "";
1118
+ W().message({
1119
+ message: `您点击的页面被${b}锁定,暂时无法编辑,请联系解锁`,
1120
+ status: "info"
1121
+ });
1122
+ return;
1123
+ }
1124
+ me(l.currentPageData, l.currentPageDataCopy) ? n("openSettingPanel", m) : e({
1125
+ title: "提示",
1126
+ message: `当前页面或文件夹${l.currentPageData.name}尚未保存,是否要继续切换?`,
1127
+ exec: () => {
1128
+ p(l.oldParentId, l.currentPageData.parentId), Object.assign(l.currentPageData, l.currentPageDataCopy), n("openSettingPanel", m);
1129
+ }
1130
+ });
1131
+ }, he = (i, {
1132
+ node: m,
1133
+ data: w
1134
+ }) => {
1135
+ !w.isPage && !w.children ? w.trueFolder = !0 : w.trueFolder = !1;
1136
+ const F = we(w.occupier).state === na.Lock;
1137
+ return o("span", {
1138
+ class: "tiny-tree-node__label",
1139
+ onMousedown: (b) => re(b, m)
1140
+ }, [o("span", {
1141
+ class: "page-name-label",
1142
+ title: m.label
1143
+ }, [w.isPage ? o(c("SvgIcon"), {
1144
+ name: "text-page-common",
1145
+ class: "icon-page"
1146
+ }, null) : null, w.trueFolder ? o(c("SvgIcon"), {
1147
+ name: "text-page-folder-closed",
1148
+ class: "folder-icon"
1149
+ }, null) : null, o("span", {
1150
+ class: "label"
1151
+ }, [m.label])]), o("span", {
1152
+ class: "icons"
1153
+ }, [w.isPage && F ? o(c("SvgIcon"), {
1154
+ class: "page-edit-icon",
1155
+ name: "locked-outline",
1156
+ onMousedown: (b) => $(b, m, F)
1157
+ }, null) : null, w.isHome ? o("span", {
1158
+ class: "home"
1159
+ }, [o(c("SvgIcon"), {
1160
+ class: "page-edit-icon",
1161
+ name: "text-page-home"
1162
+ }, null)]) : null, o(c("SvgIcon"), {
1163
+ name: "setting",
1164
+ class: "setting page-edit-icon",
1165
+ onMousedown: (b) => $(b, m, F)
1166
+ }, null)])]);
1167
+ };
1168
+ z(() => {
1169
+ r.selectedId && R(r.selectedId);
1170
+ });
1171
+ const De = (i) => {
1172
+ Array.isArray(g == null ? void 0 : g.value) && g.value.forEach((m) => {
1173
+ m == null || m.filter(i);
1174
+ });
1175
+ }, v = (i, m) => {
1176
+ var w;
1177
+ return i ? ((w = m.name) == null ? void 0 : w.toLowerCase().indexOf(i == null ? void 0 : i.toLowerCase())) !== -1 : !0;
1178
+ }, I = (i) => {
1179
+ i && g.value.push(i);
1180
+ }, x = (i) => {
1181
+ i.stopPropagation(), i.preventDefault(), n("add");
1182
+ }, N = o(c("SvgIcon"), {
1183
+ name: "text-page-folder-closed",
1184
+ class: "folder-icon"
1185
+ }, null), V = o(c("SvgIcon"), {
1186
+ name: "text-page-folder",
1187
+ class: "folder-icon"
1188
+ }, null);
1189
+ return {
1190
+ createPublicPage: x,
1191
+ state: D,
1192
+ switchPage: K,
1193
+ pageSettingState: l,
1194
+ searchPageData: De,
1195
+ renderContent: he,
1196
+ refreshPageList: R,
1197
+ filterPageTreeData: v,
1198
+ getPageTreeRefs: I,
1199
+ IconFolderOpened: pt(),
1200
+ IconFolderClosed: gt(),
1201
+ shrinkIcon: V,
1202
+ expandIcon: N
1203
+ };
1204
+ }
1205
+ };
1206
+ const sa = { class: "app-manage-search" }, la = { class: "title" }, ra = { class: "app-manage-tree" };
1207
+ function ca(a, n, r, e, h, S) {
1208
+ const t = c("tiny-search"), s = c("tiny-tree"), l = c("tiny-collapse-item"), p = c("tiny-collapse");
1209
+ return C(), j(ce, null, [
1210
+ k("div", sa, [
1211
+ o(t, {
1212
+ modelValue: e.state.pageSearchValue,
1213
+ "onUpdate:modelValue": [
1214
+ n[0] || (n[0] = (d) => e.state.pageSearchValue = d),
1215
+ e.searchPageData
1216
+ ],
1217
+ clearable: "",
1218
+ placeholder: "搜索页面"
1219
+ }, null, 8, ["modelValue", "onUpdate:modelValue"])
1220
+ ]),
1221
+ o(p, {
1222
+ modelValue: e.state.collapseValue,
1223
+ "onUpdate:modelValue": n[1] || (n[1] = (d) => e.state.collapseValue = d),
1224
+ class: "page-manage-collapse lowcode-scrollbar"
1225
+ }, {
1226
+ default: _(() => [
1227
+ (C(!0), j(ce, null, Ae(e.pageSettingState.pages, (d, P) => (C(), O(l, {
1228
+ key: P,
1229
+ name: d.groupId
1230
+ }, {
1231
+ title: _(() => [
1232
+ k("span", la, pe(d.groupName), 1)
1233
+ ]),
1234
+ default: _(() => [
1235
+ k("div", ra, [
1236
+ (C(), O(s, {
1237
+ ref_for: !0,
1238
+ ref: e.getPageTreeRefs,
1239
+ key: e.pageSettingState.pageTreeKey,
1240
+ data: d.data,
1241
+ props: {
1242
+ children: "children",
1243
+ label: "name"
1244
+ },
1245
+ "default-expand-all": "",
1246
+ "filter-node-method": e.filterPageTreeData,
1247
+ "render-content": e.renderContent,
1248
+ "expand-on-click-node": !1,
1249
+ "shrink-icon": e.shrinkIcon,
1250
+ "expand-icon": e.expandIcon,
1251
+ "node-key": "id"
1252
+ }, null, 8, ["data", "filter-node-method", "render-content", "shrink-icon", "expand-icon"]))
1253
+ ])
1254
+ ]),
1255
+ _: 2
1256
+ }, 1032, ["name"]))), 128))
1257
+ ]),
1258
+ _: 1
1259
+ }, 8, ["modelValue"])
1260
+ ], 64);
1261
+ }
1262
+ const ia = /* @__PURE__ */ J(oa, [["render", ca], ["__scopeId", "data-v-c872fd38"]]), pa = {
1263
+ getPageById: async (a) => {
1264
+ if (a)
1265
+ return Pe(a);
1266
+ },
1267
+ openPageSettingPanel: ee
1268
+ }, ga = {
1269
+ components: {
1270
+ PageSetting: Yt,
1271
+ PluginPanel: ze,
1272
+ SvgButton: oe,
1273
+ PageFolderSetting: ta,
1274
+ PageTree: ia
1275
+ },
1276
+ props: {
1277
+ title: {
1278
+ type: String,
1279
+ default: "页面管理"
1280
+ }
1281
+ },
1282
+ setup() {
1283
+ const {
1284
+ appInfoState: a
1285
+ } = ne(), {
1286
+ pageState: n
1287
+ } = ue(), {
1288
+ pageSettingState: r,
1289
+ DEFAULT_PAGE: e,
1290
+ isTemporaryPage: h,
1291
+ initCurrentPageData: S
1292
+ } = B(), {
1293
+ resState: t
1294
+ } = Je(), s = G(null), l = r.ROOT_ID, p = Z({
1295
+ isFolder: !1
1296
+ }), d = (f) => {
1297
+ H(), r.isNew = !0, r.currentPageData = {
1298
+ ...e,
1299
+ parentId: l,
1300
+ route: "",
1301
+ name: "Untitled",
1302
+ page_content: {
1303
+ lifeCycles: {}
1304
+ },
1305
+ group: f
1306
+ }, r.currentPageDataCopy = ae(!0, {}, r.currentPageData), p.isFolder = !1, ee();
1307
+ }, P = () => {
1308
+ L(), r.isNew = !0, r.currentPageData = {
1309
+ parentId: l,
1310
+ route: "",
1311
+ name: "untitled"
1312
+ }, r.currentPageDataCopy = ae(!0, {}, r.currentPageData), p.isFolder = !0, Ne();
1313
+ };
1314
+ return z(() => {
1315
+ h.saved && ee();
1316
+ }), {
1317
+ state: p,
1318
+ resState: t,
1319
+ appInfoState: a,
1320
+ pageState: n,
1321
+ openNewPage: (f) => {
1322
+ s.value.switchPage(f);
1323
+ },
1324
+ pageTreeRef: s,
1325
+ pluginPanelClosed: () => {
1326
+ L(), H();
1327
+ },
1328
+ openSettingPanel: async (f) => {
1329
+ var E;
1330
+ p.isFolder = !f.data.isPage, r.isNew = !1, p.isFolder ? (L(), Ne()) : (H(), ee());
1331
+ const D = await Pe((E = f.data) == null ? void 0 : E.id);
1332
+ S(D);
1333
+ },
1334
+ createNewFolder: P,
1335
+ createNewPage: d
1336
+ };
1337
+ }
1338
+ };
1339
+ function da(a, n, r, e, h, S) {
1340
+ const t = c("svg-button"), s = c("page-tree"), l = c("plugin-panel"), p = c("page-setting"), d = c("page-folder-setting");
1341
+ return C(), j(ce, null, [
1342
+ o(l, {
1343
+ title: r.title,
1344
+ onClose: e.pluginPanelClosed
1345
+ }, {
1346
+ header: _(() => [
1347
+ o(t, {
1348
+ class: "add-folder-icon",
1349
+ name: "add-folder",
1350
+ placement: "bottom",
1351
+ tips: "新建文件夹",
1352
+ onClick: e.createNewFolder
1353
+ }, null, 8, ["onClick"]),
1354
+ o(t, {
1355
+ class: "new-page-icon",
1356
+ name: "new-page",
1357
+ placement: "bottom",
1358
+ tips: "新建页面",
1359
+ onClick: n[0] || (n[0] = (P) => e.createNewPage("staticPages"))
1360
+ })
1361
+ ]),
1362
+ content: _(() => [
1363
+ o(s, {
1364
+ ref: "pageTreeRef",
1365
+ isFolder: e.state.isFolder,
1366
+ onAdd: n[1] || (n[1] = (P) => e.createNewPage("publicPages")),
1367
+ onOpenSettingPanel: e.openSettingPanel
1368
+ }, null, 8, ["isFolder", "onOpenSettingPanel"])
1369
+ ]),
1370
+ _: 1
1371
+ }, 8, ["title", "onClose"]),
1372
+ o(p, {
1373
+ isFolder: e.state.isFolder,
1374
+ onOpenNewPage: e.openNewPage
1375
+ }, null, 8, ["isFolder", "onOpenNewPage"]),
1376
+ o(d, {
1377
+ isFolder: e.state.isFolder
1378
+ }, null, 8, ["isFolder"])
1379
+ ], 64);
1380
+ }
1381
+ const ua = /* @__PURE__ */ J(ga, [["render", da]]), ka = {
1382
+ id: "AppManage",
1383
+ title: "页面管理",
1384
+ icon: "plugin-icon-page",
1385
+ align: "top",
1386
+ api: pa,
1387
+ component: ua
1388
+ };
1389
+ export {
1390
+ ka as default
1391
+ };