@opentiny/tiny-engine-plugin-page 2.0.0-alpha.4 → 2.0.0-alpha.6

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