diygw-designer 1.4.2 → 1.5.0

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.
@@ -1 +1 @@
1
- "use strict";const r=require("vue");;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */const s=require("../../manager/src/pluginManager.cjs");require("jsep");require("@vueuse/core");require("../../hooks/src/store/index.cjs");;/* empty css */require("vue-draggable-plus");;/* empty css */require("element-plus");;/* empty css */;/* empty css */;/* empty css */const i=require("../../ui-kit/panel-ui/src/activitybars/pageManager/storage.cjs");require("../../ui-kit/panel-ui/src/activitybars/pageManager/pageDraftBootstrap.cjs");require("../../core/src/components/builder/hooks/usePageDataSources.cjs");const f=require("../../core/src/components/designer/src/designer.vue.cjs"),S=require("../../ui/elementPlus/src/index.cjs"),q=require("./setupMiniProgramDesigner.cjs"),h={key:0},P=r.defineComponent({__name:"MiniProgramDesigner",props:{multiPage:{type:Boolean,default:!0},projectId:{},pageStorageHttp:{},pageStorageNamespace:{},syncProjectKeyFromUrl:{type:Boolean,default:!0},initialPageSchema:{},title:{default:"小程序设计页面"},headerPrefix:{},onSaveSchema:{}},emits:["save"],setup(o,{emit:u}){var c;const e=o,n=r.computed(()=>e.headerPrefix===void 0?"小程序":e.headerPrefix),g=r.computed(()=>{var a;return!(e.multiPage===!1&&((a=e.projectId)!=null&&a.trim()))});e.pageStorageHttp?i.configurePageStorage({adapter:i.createHttpStorageAdapter(e.pageStorageHttp)}):e.pageStorageNamespace?i.configurePageStorage({namespace:e.pageStorageNamespace}):(c=e.projectId)!=null&&c.trim()?i.configurePageStorage({projectKey:e.projectId}):e.syncProjectKeyFromUrl&&i.syncPageStorageNamespaceFromLocation(),S.setupElementPlus(s.pluginManager);const{defaultSchema:l}=q.setupMiniProgramDesigner(s.pluginManager),p=r.computed(()=>{var t;const a=e.initialPageSchema;return(t=a==null?void 0:a.schemas)!=null&&t.length?JSON.parse(JSON.stringify(a)):{schemas:[JSON.parse(JSON.stringify(l))]}}),m=u;async function d(a){var t;await i.flushPageStorage(),await((t=e.onSaveSchema)==null?void 0:t.call(e,a)),m("save",a)}return(a,t)=>(r.openBlock(),r.createBlock(r.unref(f),{"canvas-mode":"mobile","form-mode":"","lock-default-schema-edit":"","default-schema":p.value,"enable-page-manager":o.multiPage,"page-tree-persistence":g.value,title:o.title,onSave:d},{"header-prefix":r.withCtx(()=>[r.renderSlot(a.$slots,"header-prefix",{},()=>[n.value?(r.openBlock(),r.createElementBlock("div",h,r.toDisplayString(n.value),1)):r.createCommentVNode("",!0)])]),_:3},8,["default-schema","enable-page-manager","page-tree-persistence","title"]))}});module.exports=P;
1
+ "use strict";const t=require("vue");;/* empty css */;/* empty css */;/* empty css */;/* empty css */;/* empty css */const c=require("../../manager/src/pluginManager.cjs");require("jsep");require("@vueuse/core");require("../../hooks/src/store/index.cjs");;/* empty css */require("vue-draggable-plus");;/* empty css */require("element-plus");;/* empty css */;/* empty css */;/* empty css */const i=require("../../ui-kit/panel-ui/src/activitybars/pageManager/storage.cjs");require("../../ui-kit/panel-ui/src/activitybars/pageManager/pageDraftBootstrap.cjs");require("../../core/src/components/builder/hooks/usePageDataSources.cjs");const f=require("../../core/src/components/designer/src/designer.vue.cjs"),S=require("../../ui/elementPlus/src/index.cjs"),h=require("./setupMiniProgramDesigner.cjs"),q={key:0},P=t.defineComponent({__name:"MiniProgramDesigner",props:{multiPage:{type:Boolean,default:!0},projectId:{},pageStorageHttp:{},pageStorageNamespace:{},syncProjectKeyFromUrl:{type:Boolean,default:!0},initialPageSchema:{},title:{default:"小程序设计页面"},headerPrefix:{},onSaveSchema:{}},emits:["save"],setup(o,{emit:u}){const e=o,s=u,n=t.computed(()=>e.headerPrefix===void 0?"小程序":e.headerPrefix),g=t.computed(()=>{var r;return!(e.multiPage===!1&&((r=e.projectId)!=null&&r.trim()))});function p(){var r;e.pageStorageHttp?i.configurePageStorage({adapter:i.createHttpStorageAdapter(e.pageStorageHttp),projectKey:e.projectId}):e.pageStorageNamespace?i.configurePageStorage({namespace:e.pageStorageNamespace,projectKey:e.projectId}):(r=e.projectId)!=null&&r.trim()?i.configurePageStorage({projectKey:e.projectId}):e.syncProjectKeyFromUrl&&i.syncPageStorageNamespaceFromLocation()}t.watch([()=>e.pageStorageHttp,()=>e.pageStorageNamespace,()=>e.projectId,()=>e.syncProjectKeyFromUrl],()=>{p()},{deep:!0,immediate:!0}),S.setupElementPlus(c.pluginManager);const{defaultSchema:l}=h.setupMiniProgramDesigner(c.pluginManager),m=t.computed(()=>{var a;const r=e.initialPageSchema;return(a=r==null?void 0:r.schemas)!=null&&a.length?JSON.parse(JSON.stringify(r)):{schemas:[JSON.parse(JSON.stringify(l))]}});async function d(r){var a;await i.flushPageStorage(),await((a=e.onSaveSchema)==null?void 0:a.call(e,r)),s("save",r)}return(r,a)=>(t.openBlock(),t.createBlock(t.unref(f),{"canvas-mode":"mobile","form-mode":"","lock-default-schema-edit":"","default-schema":m.value,"enable-page-manager":o.multiPage,"page-tree-persistence":g.value,title:o.title,onSave:d},{"header-prefix":t.withCtx(()=>[t.renderSlot(r.$slots,"header-prefix",{},()=>[n.value?(t.openBlock(),t.createElementBlock("div",q,t.toDisplayString(n.value),1)):t.createCommentVNode("",!0)])]),_:3},8,["default-schema","enable-page-manager","page-tree-persistence","title"]))}});module.exports=P;
@@ -1,4 +1,4 @@
1
- import { defineComponent as S, computed as o, createBlock as h, openBlock as n, unref as P, withCtx as v, renderSlot as y, createElementBlock as x, createCommentVNode as N, toDisplayString as j } from "vue";
1
+ import { defineComponent as S, computed as o, watch as h, createBlock as P, openBlock as p, unref as y, withCtx as j, renderSlot as v, createElementBlock as N, createCommentVNode as x, toDisplayString as I } from "vue";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  /* empty css */
@@ -15,13 +15,13 @@ import "element-plus";
15
15
  /* empty css */
16
16
  /* empty css */
17
17
  /* empty css */
18
- import { configurePageStorage as i, createHttpStorageAdapter as B, syncPageStorageNamespaceFromLocation as _, flushPageStorage as k } from "../../ui-kit/panel-ui/src/activitybars/pageManager/storage.js";
18
+ import { configurePageStorage as i, createHttpStorageAdapter as B, syncPageStorageNamespaceFromLocation as K, flushPageStorage as _ } from "../../ui-kit/panel-ui/src/activitybars/pageManager/storage.js";
19
19
  import "../../ui-kit/panel-ui/src/activitybars/pageManager/pageDraftBootstrap.js";
20
20
  import "../../core/src/components/builder/hooks/usePageDataSources.js";
21
- import H from "../../core/src/components/designer/src/designer.vue.js";
22
- import { setupElementPlus as I } from "../../ui/elementPlus/src/index.js";
23
- import { setupMiniProgramDesigner as J } from "./setupMiniProgramDesigner.js";
24
- const O = { key: 0 }, ee = /* @__PURE__ */ S({
21
+ import k from "../../core/src/components/designer/src/designer.vue.js";
22
+ import { setupElementPlus as H } from "../../ui/elementPlus/src/index.js";
23
+ import { setupMiniProgramDesigner as w } from "./setupMiniProgramDesigner.js";
24
+ const C = { key: 0 }, te = /* @__PURE__ */ S({
25
25
  __name: "MiniProgramDesigner",
26
26
  props: {
27
27
  multiPage: { type: Boolean, default: !0 },
@@ -35,45 +35,66 @@ const O = { key: 0 }, ee = /* @__PURE__ */ S({
35
35
  onSaveSchema: {}
36
36
  },
37
37
  emits: ["save"],
38
- setup(r, { emit: s }) {
39
- var p;
40
- const e = r, m = o(
38
+ setup(r, { emit: n }) {
39
+ const e = r, s = n, m = o(
41
40
  () => e.headerPrefix === void 0 ? "小程序" : e.headerPrefix
42
- ), l = o(
41
+ ), g = o(
43
42
  () => {
44
43
  var t;
45
44
  return !(e.multiPage === !1 && ((t = e.projectId) != null && t.trim()));
46
45
  }
47
46
  );
48
- e.pageStorageHttp ? i({
49
- adapter: B(e.pageStorageHttp)
50
- }) : e.pageStorageNamespace ? i({ namespace: e.pageStorageNamespace }) : (p = e.projectId) != null && p.trim() ? i({
51
- projectKey: e.projectId
52
- }) : e.syncProjectKeyFromUrl && _(), I(c);
53
- const { defaultSchema: g } = J(c), f = o(() => {
47
+ function l() {
48
+ var t;
49
+ e.pageStorageHttp ? i({
50
+ adapter: B(e.pageStorageHttp),
51
+ projectKey: e.projectId
52
+ }) : e.pageStorageNamespace ? i({
53
+ namespace: e.pageStorageNamespace,
54
+ projectKey: e.projectId
55
+ }) : (t = e.projectId) != null && t.trim() ? i({
56
+ projectKey: e.projectId
57
+ }) : e.syncProjectKeyFromUrl && K();
58
+ }
59
+ h(
60
+ [
61
+ () => e.pageStorageHttp,
62
+ () => e.pageStorageNamespace,
63
+ () => e.projectId,
64
+ () => e.syncProjectKeyFromUrl
65
+ ],
66
+ () => {
67
+ l();
68
+ },
69
+ {
70
+ deep: !0,
71
+ immediate: !0
72
+ }
73
+ ), H(c);
74
+ const { defaultSchema: f } = w(c), d = o(() => {
54
75
  var a;
55
76
  const t = e.initialPageSchema;
56
77
  return (a = t == null ? void 0 : t.schemas) != null && a.length ? JSON.parse(JSON.stringify(t)) : {
57
- schemas: [JSON.parse(JSON.stringify(g))]
78
+ schemas: [JSON.parse(JSON.stringify(f))]
58
79
  };
59
- }), u = s;
60
- async function d(t) {
80
+ });
81
+ async function u(t) {
61
82
  var a;
62
- await k(), await ((a = e.onSaveSchema) == null ? void 0 : a.call(e, t)), u("save", t);
83
+ await _(), await ((a = e.onSaveSchema) == null ? void 0 : a.call(e, t)), s("save", t);
63
84
  }
64
- return (t, a) => (n(), h(P(H), {
85
+ return (t, a) => (p(), P(y(k), {
65
86
  "canvas-mode": "mobile",
66
87
  "form-mode": "",
67
88
  "lock-default-schema-edit": "",
68
- "default-schema": f.value,
89
+ "default-schema": d.value,
69
90
  "enable-page-manager": r.multiPage,
70
- "page-tree-persistence": l.value,
91
+ "page-tree-persistence": g.value,
71
92
  title: r.title,
72
- onSave: d
93
+ onSave: u
73
94
  }, {
74
- "header-prefix": v(() => [
75
- y(t.$slots, "header-prefix", {}, () => [
76
- m.value ? (n(), x("div", O, j(m.value), 1)) : N("", !0)
95
+ "header-prefix": j(() => [
96
+ v(t.$slots, "header-prefix", {}, () => [
97
+ m.value ? (p(), N("div", C, I(m.value), 1)) : x("", !0)
77
98
  ])
78
99
  ]),
79
100
  _: 3
@@ -81,5 +102,5 @@ const O = { key: 0 }, ee = /* @__PURE__ */ S({
81
102
  }
82
103
  });
83
104
  export {
84
- ee as default
105
+ te as default
85
106
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),C=require("element-plus");;/* empty css */;/* empty css */;/* empty css */const ge=require("../../../../../manager/src/pluginManager.cjs");;/* empty css */require("vue-draggable-plus");const c=require("../../../../../utils/src/common/data.cjs");require("jsep");require("@vueuse/core");require("../../../../../hooks/src/store/index.cjs");const pe=require("../../../../../hooks/src/designer/useDesignerContext.cjs"),z=require("../../../../../hooks/src/plugin/usePageSchema.cjs"),H=require("./pageDraftBootstrap.cjs"),V=require("./storage.cjs"),j="__DIYGW_PAGE_MANAGER_RUNTIME__";function ve(){const p=window;return p[j]||(p[j]={currentPageId:""}),p[j]}let B=null;function he(){const p=pe.useDesignerContext(),l=p.pageSchema,y=p.revoke,g=V.getPageStorageAdapter(),A=ve(),s=o.ref([]),S=o.ref(""),d=o.ref(A.currentPageId||""),h=o.ref(""),X=o.ref(),N=o.ref(!1);let w=null,D=Promise.resolve();const L=V.getPageDraftStorageKey(),_=o.ref(!1),E=o.ref(!1),q=o.ref("page"),v=o.ref(null),I=o.ref(""),Z={children:"children",label:"name"},K=o.ref(null);function b(){try{const e=localStorage.getItem(L);if(!e)return null;const t=JSON.parse(e);return!t||!Array.isArray(t.tree)?null:{currentPageId:String(t.currentPageId??""),pages:t.pages??{},scripts:t.scripts&&typeof t.scripts=="object"?t.scripts:void 0,tree:t.tree,updatedAt:Number(t.updatedAt??Date.now())}}catch{return null}}function $(e){localStorage.setItem(L,JSON.stringify(c.deepClone(e)))}function F(e,t,a){const r=b();$({currentPageId:d.value,pages:t??(r==null?void 0:r.pages)??{},scripts:a??(r==null?void 0:r.scripts)??{},tree:c.deepClone(e),updatedAt:Date.now()})}function ee(e,t){const a=b(),r={...(a==null?void 0:a.pages)??{},[e]:c.deepClone(t)},n={...(a==null?void 0:a.scripts)??{},[e]:l.script??""};$({currentPageId:d.value||e,pages:r,scripts:n,tree:c.deepClone((a==null?void 0:a.tree)??s.value),updatedAt:Date.now()})}function M(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,7)}`}function x(e,t,a=null){e.forEach((r,n)=>{var i;t(r,a,n),(i=r.children)!=null&&i.length&&x(r.children,t,r)})}function O(e){let t=null;return x(s.value,(a,r)=>{!t&&a.id===e&&(t={node:a,parent:r})}),t}function R(e){var a;if(e.type==="page")return[e.id];const t=[];return(a=e.children)==null||a.forEach(r=>{t.push(...R(r))}),t}function k(e){let t="";const a=r=>{var n;for(const i of r){if(i.type==="page"){t=i.id;return}if((n=i.children)!=null&&n.length&&(a(i.children),t))return}};return a(e),t}function J(e,t){if(!e)return!1;let a=!1;return x(t,r=>{r.type==="page"&&r.id===e&&(a=!0)}),a}function U(e){var n;const t=K.value??c.deepClone((n=ge.pluginManager.component.getConfigByType("page"))==null?void 0:n.defaultSchema),a=c.generateNewSchema(c.deepClone(t),[]),r=e.trim()||a.label||"新页面";return G(a,r),a}function G(e,t){var r;e.label=t,e.props={...e.props??{},name:t,title:t};const a=(r=e.children)==null?void 0:r[0];a!=null&&a.props&&Object.prototype.hasOwnProperty.call(a.props,"text")&&(a.props.text=t)}async function P(){await g.saveTree(c.deepClone(s.value)),await F(s.value)}async function T(){if(N.value||!d.value||!l.schemas[0])return;const e=d.value,t=c.deepClone(l.schemas[0]);D=D.then(async()=>{await g.savePage(e,t),await ee(e,t)}),await D}function Y(){w&&clearTimeout(w),w=setTimeout(()=>{w=null,T()},180)}async function Q(){w?(clearTimeout(w),w=null,await T()):await D}async function m(e,t=!1){if(d.value===e&&l.schemas[0]){S.value=e,h.value=e;return}t||(await Q(),await T()),N.value=!0;try{let a=await g.loadPage(e);a||(a=U("新页面"),await g.savePage(e,a)),d.value=e,l.schemas=[c.deepClone(a)];const r=b();l.script=r!=null&&r.scripts&&Object.prototype.hasOwnProperty.call(r.scripts,e)?r.scripts[e]:z.INITIAL_PAGE_SCRIPT,S.value=e,h.value=e,await o.nextTick(),p.setSelectedNode(l.schemas[0])}finally{N.value=!1}}async function te(){var r;await H.awaitPageDraftBootstrap(),K.value=c.deepClone(l.schemas[0]);const e=H.takeRestoredDraftPayload();if(e){const{currentPageId:n,draft:i}=e;s.value=c.deepClone(i.tree);const u=(n&&J(n,s.value)?n:k(s.value))||"";if(u){d.value=u,A.currentPageId=u;const f=i.pages[u];f?(l.schemas=[c.deepClone(f)],l.script=i.scripts&&Object.prototype.hasOwnProperty.call(i.scripts,u)?i.scripts[u]:z.INITIAL_PAGE_SCRIPT,S.value=u,h.value=u,await o.nextTick(),p.setSelectedNode(l.schemas[0])):await m(u,!0)}await F(s.value,c.deepClone(i.pages),c.deepClone(i.scripts??{}));return}const t=await g.loadTree();if(!t||!t.length){const n=c.deepClone(l.schemas[0]),i=n.id||M("page"),u=((r=n.props)==null?void 0:r.name)||n.label||"首页";s.value=[{id:i,name:u,type:"page"}],await g.savePage(i,n),await P(),await m(i,!0);return}if(s.value=t,d.value&&l.schemas[0]&&await T(),J(d.value,s.value)&&l.schemas[0]){S.value=d.value,h.value=d.value;return}const a=k(s.value);if(!a){C.ElMessage.warning("页面树中没有页面节点,请先新增页面");return}await m(a,!0)}function ae(e){h.value=e.id,e.type==="page"&&m(e.id)}function re(e){var a,r;if(!e)return s.value;const t=(a=O(e))==null?void 0:a.node;if(!t)return s.value;if(t.type==="page"){const n=(r=O(e))==null?void 0:r.parent;return(n==null?void 0:n.children)??s.value}return t.children??(t.children=[]),t.children}function ne(e){q.value=e,I.value="",_.value=!0}async function ie(){const e=I.value.trim();if(!e){C.ElMessage.warning("请输入名称");return}const t=h.value||null,a=re(t);if(q.value==="folder"){a.push({id:M("folder"),name:e,type:"folder",children:[]}),await P(),_.value=!1,y.push("新增目录",!0);return}const r=M("page");a.push({id:r,name:e,type:"page"});const n=U(e);await g.savePage(r,n),await P(),_.value=!1,await m(r),y.push("新增页面",!0)}function se(e){v.value=e,I.value=e.name,E.value=!0}async function le(){if(!v.value)return;const e=I.value.trim();if(!e){C.ElMessage.warning("请输入名称");return}if(v.value.name=e,v.value.type==="page")if(d.value===v.value.id&&l.schemas[0])G(l.schemas[0],e),await T();else{const t=await g.loadPage(v.value.id);t&&(G(t,e),await g.savePage(v.value.id,t))}await P(),E.value=!1,y.push("修改节点名称",!0)}async function ue(e){var u;const t=O(e.id);if(!t)return;const a=R(t.node),r=R({id:"root",type:"folder",children:s.value});if(a.length&&a.length===r.length){C.ElMessage.warning("至少保留一个页面");return}const n=((u=t.parent)==null?void 0:u.children)??s.value,i=n.findIndex(f=>f.id===e.id);i>=0&&n.splice(i,1);for(const f of a)await g.deletePage(f);if(await P(),a.includes(d.value)){const f=k(s.value);f&&await m(f,!0)}y.push("删除节点",!0)}function oe(e,t,a){var i,u,f,W;const r=e.data.type,n=t.data.type;if(r==="folder"){if(a==="inner")return n==="folder";if(n!=="folder")return!1;const de=((u=(i=e.parent)==null?void 0:i.data)==null?void 0:u.id)??"__root__",fe=((W=(f=t.parent)==null?void 0:f.data)==null?void 0:W.id)??"__root__";return de===fe}return a==="inner"?n==="folder":!0}async function ce(){await Q(),await P(),y.push("树结构拖动",!0)}return o.watch(()=>l.schemas,()=>{Y()},{deep:!0}),o.watch(()=>l.script,()=>{Y()}),o.watch(d,e=>{A.currentPageId=e}),te(),{activePageId:S,addType:q,allowDrop:oe,currentPageId:d,editTarget:v,handleAdd:ie,handleDelete:ue,handleEdit:le,handleNodeClick:ae,handleNodeDrop:ce,inputName:I,openAddDialog:ne,openEditDialog:se,selectedNodeId:h,showAddDialog:_,showEditDialog:E,treeData:s,treeProps:Z,treeRef:X}}function we(){return B||(B=he()),B}exports.usePageManagerSingleton=we;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("vue"),_=require("element-plus");;/* empty css */;/* empty css */;/* empty css */const pe=require("../../../../../manager/src/pluginManager.cjs");;/* empty css */require("vue-draggable-plus");const c=require("../../../../../utils/src/common/data.cjs");require("jsep");require("@vueuse/core");require("../../../../../hooks/src/store/index.cjs");const X=require("../../../../../hooks/src/designer/useDesignerContext.cjs"),Q=require("../../../../../hooks/src/plugin/usePageSchema.cjs"),z=require("./pageDraftBootstrap.cjs"),H=require("./storage.cjs"),j="__DIYGW_PAGE_MANAGER_RUNTIME__";function ve(){const g=window;return g[j]||(g[j]={currentPageId:""}),g[j]}const V=new WeakMap;function he(){const g=X.useDesignerContext(),s=g.pageSchema,v=g.revoke,p=H.getPageStorageAdapter(),A=ve(),u=l.ref([]),S=l.ref(""),d=l.ref(A.currentPageId||""),w=l.ref(""),Z=l.ref(),N=l.ref(!1);let P=null,D=Promise.resolve();const B=H.getPageDraftStorageKey(),C=l.ref(!1),E=l.ref(!1),M=l.ref("page"),h=l.ref(null),I=l.ref(""),ee={children:"children",label:"name"},L=l.ref(null);function q(){try{const e=localStorage.getItem(B);if(!e)return null;const t=JSON.parse(e);return!t||!Array.isArray(t.tree)?null:{currentPageId:String(t.currentPageId??""),pages:t.pages??{},scripts:t.scripts&&typeof t.scripts=="object"?t.scripts:void 0,tree:t.tree,updatedAt:Number(t.updatedAt??Date.now())}}catch{return null}}function K(e){localStorage.setItem(B,JSON.stringify(c.deepClone(e)))}function $(e,t,a){const n=q();K({currentPageId:d.value,pages:t??(n==null?void 0:n.pages)??{},scripts:a??(n==null?void 0:n.scripts)??{},tree:c.deepClone(e),updatedAt:Date.now()})}function te(e,t){const a=q(),n={...(a==null?void 0:a.pages)??{},[e]:c.deepClone(t)},r={...(a==null?void 0:a.scripts)??{},[e]:s.script??""};K({currentPageId:d.value||e,pages:n,scripts:r,tree:c.deepClone((a==null?void 0:a.tree)??u.value),updatedAt:Date.now()})}function b(e){return`${e}_${Date.now()}_${Math.random().toString(36).slice(2,7)}`}function x(e,t,a=null){e.forEach((n,r)=>{var i;t(n,a,r),(i=n.children)!=null&&i.length&&x(n.children,t,n)})}function O(e){let t=null;return x(u.value,(a,n)=>{!t&&a.id===e&&(t={node:a,parent:n})}),t}function R(e){var a;if(e.type==="page")return[e.id];const t=[];return(a=e.children)==null||a.forEach(n=>{t.push(...R(n))}),t}function k(e){let t="";const a=n=>{var r;for(const i of n){if(i.type==="page"){t=i.id;return}if((r=i.children)!=null&&r.length&&(a(i.children),t))return}};return a(e),t}function F(e,t){if(!e)return!1;let a=!1;return x(t,n=>{n.type==="page"&&n.id===e&&(a=!0)}),a}function J(e){var r;const t=L.value??c.deepClone((r=pe.pluginManager.component.getConfigByType("page"))==null?void 0:r.defaultSchema),a=c.generateNewSchema(c.deepClone(t),[]),n=e.trim()||a.label||"新页面";return G(a,n),a}function G(e,t){var n;e.label=t,e.props={...e.props??{},name:t,title:t};const a=(n=e.children)==null?void 0:n[0];a!=null&&a.props&&Object.prototype.hasOwnProperty.call(a.props,"text")&&(a.props.text=t)}async function m(){await p.saveTree(c.deepClone(u.value)),await $(u.value)}async function T(){if(N.value||!d.value||!s.schemas[0])return;const e=d.value,t=c.deepClone(s.schemas[0]);D=D.then(async()=>{await p.savePage(e,t),await te(e,t)}),await D}function U(){P&&clearTimeout(P),P=setTimeout(()=>{P=null,T()},180)}async function W(){P?(clearTimeout(P),P=null,await T()):await D}async function y(e,t=!1){if(d.value===e&&s.schemas[0]){S.value=e,w.value=e;return}t||(await W(),await T()),N.value=!0;try{let a=await p.loadPage(e);a||(a=J("新页面"),await p.savePage(e,a)),d.value=e,s.schemas=[c.deepClone(a)];const n=q();s.script=n!=null&&n.scripts&&Object.prototype.hasOwnProperty.call(n.scripts,e)?n.scripts[e]:Q.INITIAL_PAGE_SCRIPT,S.value=e,w.value=e,await l.nextTick(),g.setSelectedNode(s.schemas[0])}finally{N.value=!1}}async function ae(){var n;await z.awaitPageDraftBootstrap(),L.value=c.deepClone(s.schemas[0]);const e=z.takeRestoredDraftPayload();if(e){const{currentPageId:r,draft:i}=e;u.value=c.deepClone(i.tree);const o=(r&&F(r,u.value)?r:k(u.value))||"";if(o){d.value=o,A.currentPageId=o;const f=i.pages[o];f?(s.schemas=[c.deepClone(f)],s.script=i.scripts&&Object.prototype.hasOwnProperty.call(i.scripts,o)?i.scripts[o]:Q.INITIAL_PAGE_SCRIPT,S.value=o,w.value=o,await l.nextTick(),g.setSelectedNode(s.schemas[0])):await y(o,!0)}await $(u.value,c.deepClone(i.pages),c.deepClone(i.scripts??{}));return}const t=await p.loadTree();if(!t||!t.length){const r=c.deepClone(s.schemas[0]),i=r.id||b("page"),o=((n=r.props)==null?void 0:n.name)||r.label||"首页";u.value=[{id:i,name:o,type:"page"}],await p.savePage(i,r),await m(),await y(i,!0);return}if(u.value=t,d.value&&s.schemas[0]&&await T(),F(d.value,u.value)&&s.schemas[0]){S.value=d.value,w.value=d.value;return}const a=k(u.value);if(!a){_.ElMessage.warning("页面树中没有页面节点,请先新增页面");return}await y(a,!0)}function ne(e){w.value=e.id,e.type==="page"&&y(e.id)}function re(e){var a,n;if(!e)return u.value;const t=(a=O(e))==null?void 0:a.node;if(!t)return u.value;if(t.type==="page"){const r=(n=O(e))==null?void 0:n.parent;return(r==null?void 0:r.children)??u.value}return t.children??(t.children=[]),t.children}function ie(e){M.value=e,I.value="",C.value=!0}async function se(){const e=I.value.trim();if(!e){_.ElMessage.warning("请输入名称");return}const t=w.value||null,a=re(t);if(M.value==="folder"){a.push({id:b("folder"),name:e,type:"folder",children:[]}),await m(),C.value=!1,v.push("新增目录",!0);return}const n=b("page");a.push({id:n,name:e,type:"page"});const r=J(e);await p.savePage(n,r),await m(),C.value=!1,await y(n),v.push("新增页面",!0)}function ue(e){h.value=e,I.value=e.name,E.value=!0}async function oe(){if(!h.value)return;const e=I.value.trim();if(!e){_.ElMessage.warning("请输入名称");return}if(h.value.name=e,h.value.type==="page")if(d.value===h.value.id&&s.schemas[0])G(s.schemas[0],e),await T();else{const t=await p.loadPage(h.value.id);t&&(G(t,e),await p.savePage(h.value.id,t))}await m(),E.value=!1,v.push("修改节点名称",!0)}async function le(e){var o;const t=O(e.id);if(!t)return;const a=R(t.node),n=R({id:"root",type:"folder",children:u.value});if(a.length&&a.length===n.length){_.ElMessage.warning("至少保留一个页面");return}const r=((o=t.parent)==null?void 0:o.children)??u.value,i=r.findIndex(f=>f.id===e.id);i>=0&&r.splice(i,1);for(const f of a)await p.deletePage(f);if(await m(),a.includes(d.value)){const f=k(u.value);f&&await y(f,!0)}v.push("删除节点",!0)}function ce(e,t,a){var i,o,f,Y;const n=e.data.type,r=t.data.type;if(n==="folder"){if(a==="inner")return r==="folder";if(r!=="folder")return!1;const fe=((o=(i=e.parent)==null?void 0:i.data)==null?void 0:o.id)??"__root__",ge=((Y=(f=t.parent)==null?void 0:f.data)==null?void 0:Y.id)??"__root__";return fe===ge}return a==="inner"?r==="folder":!0}async function de(){await W(),await m(),v.push("树结构拖动",!0)}return l.watch(()=>s.schemas,()=>{U()},{deep:!0}),l.watch(()=>s.script,()=>{U()}),l.watch(d,e=>{A.currentPageId=e}),ae(),{activePageId:S,addType:M,allowDrop:ce,currentPageId:d,editTarget:h,handleAdd:se,handleDelete:le,handleEdit:oe,handleNodeClick:ne,handleNodeDrop:de,inputName:I,openAddDialog:ie,openEditDialog:ue,selectedNodeId:w,showAddDialog:C,showEditDialog:E,treeData:u,treeProps:ee,treeRef:Z}}function we(){const g=X.useDesignerContext(),s=V.get(g);if(s)return s;const v=he();return V.set(g,v),v}exports.usePageManagerSingleton=we;
@@ -1,37 +1,37 @@
1
- import { ref as d, watch as B, nextTick as H } from "vue";
1
+ import { ref as d, watch as B, nextTick as z } from "vue";
2
2
  import { ElMessage as A } from "element-plus";
3
3
  /* empty css */
4
4
  /* empty css */
5
5
  /* empty css */
6
- import { pluginManager as pe } from "../../../../../manager/src/pluginManager.js";
6
+ import { pluginManager as ge } from "../../../../../manager/src/pluginManager.js";
7
7
  /* empty css */
8
8
  import "vue-draggable-plus";
9
- import { deepClone as c, generateNewSchema as ge } from "../../../../../utils/src/common/data.js";
9
+ import { deepClone as l, generateNewSchema as ve } from "../../../../../utils/src/common/data.js";
10
10
  import "jsep";
11
11
  import "@vueuse/core";
12
12
  import "../../../../../hooks/src/store/index.js";
13
- import { useDesignerContext as ve } from "../../../../../hooks/src/designer/useDesignerContext.js";
14
- import { INITIAL_PAGE_SCRIPT as V } from "../../../../../hooks/src/plugin/usePageSchema.js";
13
+ import { useDesignerContext as X } from "../../../../../hooks/src/designer/useDesignerContext.js";
14
+ import { INITIAL_PAGE_SCRIPT as H } from "../../../../../hooks/src/plugin/usePageSchema.js";
15
15
  import { awaitPageDraftBootstrap as me, takeRestoredDraftPayload as he } from "./pageDraftBootstrap.js";
16
16
  import { getPageStorageAdapter as we, getPageDraftStorageKey as Pe } from "./storage.js";
17
17
  const K = "__DIYGW_PAGE_MANAGER_RUNTIME__";
18
18
  function ye() {
19
- const g = window;
20
- return g[K] || (g[K] = {
19
+ const p = window;
20
+ return p[K] || (p[K] = {
21
21
  currentPageId: ""
22
- }), g[K];
22
+ }), p[K];
23
23
  }
24
- let L = null;
24
+ const V = /* @__PURE__ */ new WeakMap();
25
25
  function Se() {
26
- const g = ve(), o = g.pageSchema, y = g.revoke, p = we(), N = ye(), s = d([]), S = d(""), u = d(N.currentPageId || ""), m = d(""), X = d(), E = d(!1);
27
- let h = null, D = Promise.resolve();
28
- const $ = Pe(), _ = d(!1), b = d(!1), x = d("page"), v = d(null), I = d(""), Z = {
26
+ const p = X(), s = p.pageSchema, v = p.revoke, g = we(), N = ye(), o = d([]), S = d(""), u = d(N.currentPageId || ""), h = d(""), Z = d(), E = d(!1);
27
+ let w = null, D = Promise.resolve();
28
+ const L = Pe(), _ = d(!1), b = d(!1), x = d("page"), m = d(null), I = d(""), ee = {
29
29
  children: "children",
30
30
  label: "name"
31
- }, F = d(null);
31
+ }, $ = d(null);
32
32
  function M() {
33
33
  try {
34
- const e = localStorage.getItem($);
34
+ const e = localStorage.getItem(L);
35
35
  if (!e) return null;
36
36
  const t = JSON.parse(e);
37
37
  return !t || !Array.isArray(t.tree) ? null : {
@@ -45,32 +45,32 @@ function Se() {
45
45
  return null;
46
46
  }
47
47
  }
48
- function J(e) {
49
- localStorage.setItem($, JSON.stringify(c(e)));
48
+ function F(e) {
49
+ localStorage.setItem(L, JSON.stringify(l(e)));
50
50
  }
51
- function U(e, t, a) {
51
+ function J(e, t, a) {
52
52
  const r = M();
53
- J({
53
+ F({
54
54
  currentPageId: u.value,
55
55
  pages: t ?? (r == null ? void 0 : r.pages) ?? {},
56
56
  scripts: a ?? (r == null ? void 0 : r.scripts) ?? {},
57
- tree: c(e),
57
+ tree: l(e),
58
58
  updatedAt: Date.now()
59
59
  });
60
60
  }
61
- function ee(e, t) {
61
+ function te(e, t) {
62
62
  const a = M(), r = {
63
63
  ...(a == null ? void 0 : a.pages) ?? {},
64
- [e]: c(t)
64
+ [e]: l(t)
65
65
  }, n = {
66
66
  ...(a == null ? void 0 : a.scripts) ?? {},
67
- [e]: o.script ?? ""
67
+ [e]: s.script ?? ""
68
68
  };
69
- J({
69
+ F({
70
70
  currentPageId: u.value || e,
71
71
  pages: r,
72
72
  scripts: n,
73
- tree: c((a == null ? void 0 : a.tree) ?? s.value),
73
+ tree: l((a == null ? void 0 : a.tree) ?? o.value),
74
74
  updatedAt: Date.now()
75
75
  });
76
76
  }
@@ -83,18 +83,18 @@ function Se() {
83
83
  t(r, a, n), (i = r.children) != null && i.length && R(r.children, t, r);
84
84
  });
85
85
  }
86
- function C(e) {
86
+ function k(e) {
87
87
  let t = null;
88
- return R(s.value, (a, r) => {
88
+ return R(o.value, (a, r) => {
89
89
  !t && a.id === e && (t = { node: a, parent: r });
90
90
  }), t;
91
91
  }
92
- function k(e) {
92
+ function C(e) {
93
93
  var a;
94
94
  if (e.type === "page") return [e.id];
95
95
  const t = [];
96
96
  return (a = e.children) == null || a.forEach((r) => {
97
- t.push(...k(r));
97
+ t.push(...C(r));
98
98
  }), t;
99
99
  }
100
100
  function G(e) {
@@ -112,18 +112,18 @@ function Se() {
112
112
  };
113
113
  return a(e), t;
114
114
  }
115
- function Y(e, t) {
115
+ function U(e, t) {
116
116
  if (!e) return !1;
117
117
  let a = !1;
118
118
  return R(t, (r) => {
119
119
  r.type === "page" && r.id === e && (a = !0);
120
120
  }), a;
121
121
  }
122
- function Q(e) {
122
+ function W(e) {
123
123
  var n;
124
- const t = F.value ?? c(
125
- (n = pe.component.getConfigByType("page")) == null ? void 0 : n.defaultSchema
126
- ), a = ge(c(t), []), r = e.trim() || a.label || "新页面";
124
+ const t = $.value ?? l(
125
+ (n = ge.component.getConfigByType("page")) == null ? void 0 : n.defaultSchema
126
+ ), a = ve(l(t), []), r = e.trim() || a.label || "新页面";
127
127
  return j(a, r), a;
128
128
  }
129
129
  function j(e, t) {
@@ -136,114 +136,114 @@ function Se() {
136
136
  const a = (r = e.children) == null ? void 0 : r[0];
137
137
  a != null && a.props && Object.prototype.hasOwnProperty.call(a.props, "text") && (a.props.text = t);
138
138
  }
139
- async function w() {
140
- await p.saveTree(c(s.value)), await U(s.value);
139
+ async function P() {
140
+ await g.saveTree(l(o.value)), await J(o.value);
141
141
  }
142
142
  async function T() {
143
- if (E.value || !u.value || !o.schemas[0])
143
+ if (E.value || !u.value || !s.schemas[0])
144
144
  return;
145
- const e = u.value, t = c(o.schemas[0]);
145
+ const e = u.value, t = l(s.schemas[0]);
146
146
  D = D.then(async () => {
147
- await p.savePage(e, t), await ee(e, t);
147
+ await g.savePage(e, t), await te(e, t);
148
148
  }), await D;
149
149
  }
150
- function W() {
151
- h && clearTimeout(h), h = setTimeout(() => {
152
- h = null, T();
150
+ function Y() {
151
+ w && clearTimeout(w), w = setTimeout(() => {
152
+ w = null, T();
153
153
  }, 180);
154
154
  }
155
- async function q() {
156
- h ? (clearTimeout(h), h = null, await T()) : await D;
155
+ async function Q() {
156
+ w ? (clearTimeout(w), w = null, await T()) : await D;
157
157
  }
158
- async function P(e, t = !1) {
159
- if (u.value === e && o.schemas[0]) {
160
- S.value = e, m.value = e;
158
+ async function y(e, t = !1) {
159
+ if (u.value === e && s.schemas[0]) {
160
+ S.value = e, h.value = e;
161
161
  return;
162
162
  }
163
- t || (await q(), await T()), E.value = !0;
163
+ t || (await Q(), await T()), E.value = !0;
164
164
  try {
165
- let a = await p.loadPage(e);
166
- a || (a = Q("新页面"), await p.savePage(e, a)), u.value = e, o.schemas = [c(a)];
165
+ let a = await g.loadPage(e);
166
+ a || (a = W("新页面"), await g.savePage(e, a)), u.value = e, s.schemas = [l(a)];
167
167
  const r = M();
168
- o.script = r != null && r.scripts && Object.prototype.hasOwnProperty.call(r.scripts, e) ? r.scripts[e] : V, S.value = e, m.value = e, await H(), g.setSelectedNode(o.schemas[0]);
168
+ s.script = r != null && r.scripts && Object.prototype.hasOwnProperty.call(r.scripts, e) ? r.scripts[e] : H, S.value = e, h.value = e, await z(), p.setSelectedNode(s.schemas[0]);
169
169
  } finally {
170
170
  E.value = !1;
171
171
  }
172
172
  }
173
- async function te() {
173
+ async function ae() {
174
174
  var r;
175
- await me(), F.value = c(o.schemas[0]);
175
+ await me(), $.value = l(s.schemas[0]);
176
176
  const e = he();
177
177
  if (e) {
178
178
  const { currentPageId: n, draft: i } = e;
179
- s.value = c(i.tree);
180
- const l = (n && Y(n, s.value) ? n : G(s.value)) || "";
181
- if (l) {
182
- u.value = l, N.currentPageId = l;
183
- const f = i.pages[l];
184
- f ? (o.schemas = [c(f)], o.script = i.scripts && Object.prototype.hasOwnProperty.call(i.scripts, l) ? i.scripts[l] : V, S.value = l, m.value = l, await H(), g.setSelectedNode(o.schemas[0])) : await P(l, !0);
179
+ o.value = l(i.tree);
180
+ const c = (n && U(n, o.value) ? n : G(o.value)) || "";
181
+ if (c) {
182
+ u.value = c, N.currentPageId = c;
183
+ const f = i.pages[c];
184
+ f ? (s.schemas = [l(f)], s.script = i.scripts && Object.prototype.hasOwnProperty.call(i.scripts, c) ? i.scripts[c] : H, S.value = c, h.value = c, await z(), p.setSelectedNode(s.schemas[0])) : await y(c, !0);
185
185
  }
186
- await U(
187
- s.value,
188
- c(i.pages),
189
- c(i.scripts ?? {})
186
+ await J(
187
+ o.value,
188
+ l(i.pages),
189
+ l(i.scripts ?? {})
190
190
  );
191
191
  return;
192
192
  }
193
- const t = await p.loadTree();
193
+ const t = await g.loadTree();
194
194
  if (!t || !t.length) {
195
- const n = c(o.schemas[0]), i = n.id || O("page"), l = ((r = n.props) == null ? void 0 : r.name) || n.label || "首页";
196
- s.value = [
195
+ const n = l(s.schemas[0]), i = n.id || O("page"), c = ((r = n.props) == null ? void 0 : r.name) || n.label || "首页";
196
+ o.value = [
197
197
  {
198
198
  id: i,
199
- name: l,
199
+ name: c,
200
200
  type: "page"
201
201
  }
202
- ], await p.savePage(i, n), await w(), await P(i, !0);
202
+ ], await g.savePage(i, n), await P(), await y(i, !0);
203
203
  return;
204
204
  }
205
- if (s.value = t, u.value && o.schemas[0] && await T(), Y(u.value, s.value) && o.schemas[0]) {
206
- S.value = u.value, m.value = u.value;
205
+ if (o.value = t, u.value && s.schemas[0] && await T(), U(u.value, o.value) && s.schemas[0]) {
206
+ S.value = u.value, h.value = u.value;
207
207
  return;
208
208
  }
209
- const a = G(s.value);
209
+ const a = G(o.value);
210
210
  if (!a) {
211
211
  A.warning("页面树中没有页面节点,请先新增页面");
212
212
  return;
213
213
  }
214
- await P(a, !0);
215
- }
216
- function ae(e) {
217
- m.value = e.id, e.type === "page" && P(e.id);
214
+ await y(a, !0);
218
215
  }
219
216
  function re(e) {
217
+ h.value = e.id, e.type === "page" && y(e.id);
218
+ }
219
+ function ne(e) {
220
220
  var a, r;
221
- if (!e) return s.value;
222
- const t = (a = C(e)) == null ? void 0 : a.node;
223
- if (!t) return s.value;
221
+ if (!e) return o.value;
222
+ const t = (a = k(e)) == null ? void 0 : a.node;
223
+ if (!t) return o.value;
224
224
  if (t.type === "page") {
225
- const n = (r = C(e)) == null ? void 0 : r.parent;
226
- return (n == null ? void 0 : n.children) ?? s.value;
225
+ const n = (r = k(e)) == null ? void 0 : r.parent;
226
+ return (n == null ? void 0 : n.children) ?? o.value;
227
227
  }
228
228
  return t.children ?? (t.children = []), t.children;
229
229
  }
230
- function ne(e) {
230
+ function ie(e) {
231
231
  x.value = e, I.value = "", _.value = !0;
232
232
  }
233
- async function ie() {
233
+ async function se() {
234
234
  const e = I.value.trim();
235
235
  if (!e) {
236
236
  A.warning("请输入名称");
237
237
  return;
238
238
  }
239
- const t = m.value || null, a = re(t);
239
+ const t = h.value || null, a = ne(t);
240
240
  if (x.value === "folder") {
241
241
  a.push({
242
242
  id: O("folder"),
243
243
  name: e,
244
244
  type: "folder",
245
245
  children: []
246
- }), await w(), _.value = !1, y.push("新增目录", !0);
246
+ }), await P(), _.value = !1, v.push("新增目录", !0);
247
247
  return;
248
248
  }
249
249
  const r = O("page");
@@ -252,104 +252,108 @@ function Se() {
252
252
  name: e,
253
253
  type: "page"
254
254
  });
255
- const n = Q(e);
256
- await p.savePage(r, n), await w(), _.value = !1, await P(r), y.push("新增页面", !0);
255
+ const n = W(e);
256
+ await g.savePage(r, n), await P(), _.value = !1, await y(r), v.push("新增页面", !0);
257
257
  }
258
- function se(e) {
259
- v.value = e, I.value = e.name, b.value = !0;
258
+ function oe(e) {
259
+ m.value = e, I.value = e.name, b.value = !0;
260
260
  }
261
- async function oe() {
262
- if (!v.value) return;
261
+ async function ce() {
262
+ if (!m.value) return;
263
263
  const e = I.value.trim();
264
264
  if (!e) {
265
265
  A.warning("请输入名称");
266
266
  return;
267
267
  }
268
- if (v.value.name = e, v.value.type === "page")
269
- if (u.value === v.value.id && o.schemas[0])
270
- j(o.schemas[0], e), await T();
268
+ if (m.value.name = e, m.value.type === "page")
269
+ if (u.value === m.value.id && s.schemas[0])
270
+ j(s.schemas[0], e), await T();
271
271
  else {
272
- const t = await p.loadPage(v.value.id);
273
- t && (j(t, e), await p.savePage(v.value.id, t));
272
+ const t = await g.loadPage(m.value.id);
273
+ t && (j(t, e), await g.savePage(m.value.id, t));
274
274
  }
275
- await w(), b.value = !1, y.push("修改节点名称", !0);
275
+ await P(), b.value = !1, v.push("修改节点名称", !0);
276
276
  }
277
- async function le(e) {
278
- var l;
279
- const t = C(e.id);
277
+ async function ue(e) {
278
+ var c;
279
+ const t = k(e.id);
280
280
  if (!t) return;
281
- const a = k(t.node), r = k({
281
+ const a = C(t.node), r = C({
282
282
  id: "root",
283
283
  type: "folder",
284
- children: s.value
284
+ children: o.value
285
285
  });
286
286
  if (a.length && a.length === r.length) {
287
287
  A.warning("至少保留一个页面");
288
288
  return;
289
289
  }
290
- const n = ((l = t.parent) == null ? void 0 : l.children) ?? s.value, i = n.findIndex((f) => f.id === e.id);
290
+ const n = ((c = t.parent) == null ? void 0 : c.children) ?? o.value, i = n.findIndex((f) => f.id === e.id);
291
291
  i >= 0 && n.splice(i, 1);
292
292
  for (const f of a)
293
- await p.deletePage(f);
294
- if (await w(), a.includes(u.value)) {
295
- const f = G(s.value);
296
- f && await P(f, !0);
293
+ await g.deletePage(f);
294
+ if (await P(), a.includes(u.value)) {
295
+ const f = G(o.value);
296
+ f && await y(f, !0);
297
297
  }
298
- y.push("删除节点", !0);
298
+ v.push("删除节点", !0);
299
299
  }
300
- function ue(e, t, a) {
301
- var i, l, f, z;
300
+ function le(e, t, a) {
301
+ var i, c, f, q;
302
302
  const r = e.data.type, n = t.data.type;
303
303
  if (r === "folder") {
304
304
  if (a === "inner")
305
305
  return n === "folder";
306
306
  if (n !== "folder")
307
307
  return !1;
308
- const fe = ((l = (i = e.parent) == null ? void 0 : i.data) == null ? void 0 : l.id) ?? "__root__", de = ((z = (f = t.parent) == null ? void 0 : f.data) == null ? void 0 : z.id) ?? "__root__";
309
- return fe === de;
308
+ const de = ((c = (i = e.parent) == null ? void 0 : i.data) == null ? void 0 : c.id) ?? "__root__", pe = ((q = (f = t.parent) == null ? void 0 : f.data) == null ? void 0 : q.id) ?? "__root__";
309
+ return de === pe;
310
310
  }
311
311
  return a === "inner" ? n === "folder" : !0;
312
312
  }
313
- async function ce() {
314
- await q(), await w(), y.push("树结构拖动", !0);
313
+ async function fe() {
314
+ await Q(), await P(), v.push("树结构拖动", !0);
315
315
  }
316
316
  return B(
317
- () => o.schemas,
317
+ () => s.schemas,
318
318
  () => {
319
- W();
319
+ Y();
320
320
  },
321
321
  { deep: !0 }
322
322
  ), B(
323
- () => o.script,
323
+ () => s.script,
324
324
  () => {
325
- W();
325
+ Y();
326
326
  }
327
327
  ), B(u, (e) => {
328
328
  N.currentPageId = e;
329
- }), te(), {
329
+ }), ae(), {
330
330
  activePageId: S,
331
331
  addType: x,
332
- allowDrop: ue,
332
+ allowDrop: le,
333
333
  currentPageId: u,
334
- editTarget: v,
335
- handleAdd: ie,
336
- handleDelete: le,
337
- handleEdit: oe,
338
- handleNodeClick: ae,
339
- handleNodeDrop: ce,
334
+ editTarget: m,
335
+ handleAdd: se,
336
+ handleDelete: ue,
337
+ handleEdit: ce,
338
+ handleNodeClick: re,
339
+ handleNodeDrop: fe,
340
340
  inputName: I,
341
- openAddDialog: ne,
342
- openEditDialog: se,
343
- selectedNodeId: m,
341
+ openAddDialog: ie,
342
+ openEditDialog: oe,
343
+ selectedNodeId: h,
344
344
  showAddDialog: _,
345
345
  showEditDialog: b,
346
- treeData: s,
347
- treeProps: Z,
348
- treeRef: X
346
+ treeData: o,
347
+ treeProps: ee,
348
+ treeRef: Z
349
349
  };
350
350
  }
351
351
  function Be() {
352
- return L || (L = Se()), L;
352
+ const p = X(), s = V.get(p);
353
+ if (s)
354
+ return s;
355
+ const v = Se();
356
+ return V.set(p, v), v;
353
357
  }
354
358
  export {
355
359
  Be as usePageManagerSingleton
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "diygw-designer",
3
- "version": "1.4.2",
3
+ "version": "1.5.0",
4
4
  "description": "基于vue3的设计器,可视化开发页面表单",
5
5
  "private": false,
6
6
  "keywords": [