@opentiny/tiny-engine-plugin-page 1.0.2-beta.0 → 1.0.3

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