@opentiny/tiny-engine-toolbar-lock 2.4.0 → 2.5.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +125 -57
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,29 +1,53 @@
1
- import { reactive as N, computed as m, resolveComponent as _, createBlock as b, createCommentVNode as S, openBlock as T } from "vue";
2
- import { getMetaApi as x, META_SERVICE as C, useCanvas as M, useLayout as $, useBlock as A, useNotify as k } from "@opentiny/tiny-engine-meta-register";
3
- import { constants as B } from "@opentiny/tiny-engine-utils";
4
- import { ToolbarBase as h } from "@opentiny/tiny-engine-common";
5
- const v = (e) => x(C.Http).get(`app-center/api/apps/canvas/lock?${e}`), { COMPONENT_NAME: E, PAGE_STATUS: t } = B, d = {
1
+ import { callEntry as $, getMetaApi as M, META_SERVICE as P, useCanvas as O, useLayout as f, useBlock as N, useNotify as p } from "@opentiny/tiny-engine-meta-register";
2
+ import { reactive as A, computed as _, resolveComponent as E, createBlock as h, createCommentVNode as v, openBlock as L } from "vue";
3
+ import { constants as S } from "@opentiny/tiny-engine-utils";
4
+ import { ToolbarBase as b } from "@opentiny/tiny-engine-common";
5
+ const T = {
6
+ id: "engine.toolbars.lock",
7
+ title: "lock",
8
+ type: "toolbars",
9
+ options: {
10
+ icon: {
11
+ locked: "locked",
12
+ userLocked: "user-locked",
13
+ unlocked: "unlocked"
14
+ },
15
+ renderType: "icon"
16
+ }
17
+ }, y = $((e) => M(P.Http).get(`app-center/api/apps/canvas/lock?${e}`), {
18
+ metaData: {
19
+ id: "engine.toolbars.lock.requestBlockPage"
20
+ },
21
+ ctx: () => ({
22
+ getMetaApi: M,
23
+ META_SERVICE: P,
24
+ requestBlockPage: y
25
+ })
26
+ }), {
27
+ COMPONENT_NAME: x,
28
+ PAGE_STATUS: t
29
+ } = S, m = {
6
30
  block: "区块",
7
31
  page: "页面"
8
- }, g = {
32
+ }, u = {
9
33
  [t.Release]: {
10
- message: (e) => `${d[e]}解锁成功!`,
34
+ message: (e) => `${m[e]}解锁成功!`,
11
35
  currentOptName: "解锁",
12
36
  nextOptName: "锁定"
13
37
  },
14
38
  [t.Lock]: {
15
- message: (e) => `${d[e]}解锁成功!`,
39
+ message: (e) => `${m[e]}解锁成功!`,
16
40
  currentOptName: "解锁",
17
41
  nextOptName: "解锁"
18
42
  },
19
43
  [t.Occupy]: {
20
- message: (e) => `${d[e]}锁定成功`,
44
+ message: (e) => `${m[e]}锁定成功`,
21
45
  currentOptName: "锁定",
22
46
  nextOptName: "解锁"
23
47
  }
24
- }, L = {
48
+ }, D = {
25
49
  components: {
26
- ToolbarBase: h
50
+ ToolbarBase: b
27
51
  },
28
52
  props: {
29
53
  options: {
@@ -32,12 +56,18 @@ const v = (e) => x(C.Http).get(`app-center/api/apps/canvas/lock?${e}`), { COMPON
32
56
  }
33
57
  },
34
58
  setup(e) {
35
- const { pageState: a } = M(), { layoutState: o } = $(), { getCurrentBlock: c } = A(), s = N({
36
- status: m(() => o.pageStatus.state),
37
- isGuest: m(() => o.pageStatus.state === t.Guest),
59
+ const {
60
+ pageState: a
61
+ } = O(), {
62
+ layoutState: o
63
+ } = f(), {
64
+ getCurrentBlock: c
65
+ } = N(), s = A({
66
+ status: _(() => o.pageStatus.state),
67
+ isGuest: _(() => o.pageStatus.state === t.Guest),
38
68
  type: "",
39
69
  disabled: !1
40
- }), y = m(() => {
70
+ }), k = _(() => {
41
71
  switch (s.status) {
42
72
  case t.Occupy:
43
73
  return e.options.icon.locked;
@@ -46,77 +76,115 @@ const v = (e) => x(C.Http).get(`app-center/api/apps/canvas/lock?${e}`), { COMPON
46
76
  default:
47
77
  return e.options.icon.unlocked;
48
78
  }
49
- }), p = (l, O, i) => {
50
- v(`id=${l}&state=${i}&type=${O}`).then((n) => {
51
- var f;
79
+ }), l = $((d, B, g) => {
80
+ y(`id=${d}&state=${g}&type=${B}`).then((n) => {
81
+ var C;
52
82
  if ((n == null ? void 0 : n.operate) === "success")
53
- k({
83
+ p({
54
84
  type: "success",
55
- message: g[i].message(O)
56
- }), o.pageStatus.state = i;
85
+ message: u[g].message(B)
86
+ }), o.pageStatus.state = g;
57
87
  else {
58
- const r = (f = o.pageStatus) == null ? void 0 : f.data;
59
- k({
88
+ const i = (C = o.pageStatus) == null ? void 0 : C.data;
89
+ p({
60
90
  type: "warning",
61
- message: `当前页面被 ${(r == null ? void 0 : r.username) || ""} ${(r == null ? void 0 : r.resetPasswordToken) || ""} 锁定,请联系解锁`
91
+ message: `当前页面被 ${(i == null ? void 0 : i.username) || ""} ${(i == null ? void 0 : i.resetPasswordToken) || ""} 锁定,请联系解锁`
62
92
  });
63
93
  }
64
94
  }).catch((n) => {
65
- k({
95
+ p({
66
96
  type: "error",
67
- title: `页面${g[i].currentOptName}失败`,
97
+ title: `页面${u[g].currentOptName}失败`,
68
98
  message: JSON.stringify((n == null ? void 0 : n.message) || n)
69
99
  });
70
100
  }).finally(() => {
71
101
  s.disabled = !1;
72
102
  });
73
- };
103
+ }, {
104
+ metaData: {
105
+ id: `${T.id}.lockPage`
106
+ },
107
+ ctx: () => ({
108
+ props: e,
109
+ pageState: a,
110
+ layoutState: o,
111
+ getCurrentBlock: c,
112
+ state: s,
113
+ iconName: k,
114
+ lockPage: l,
115
+ lockOrUnlock: r,
116
+ useCanvas: O,
117
+ useLayout: f,
118
+ useBlock: N,
119
+ useNotify: p,
120
+ constants: S,
121
+ ToolbarBase: b,
122
+ requestBlockPage: y,
123
+ COMPONENT_NAME: x,
124
+ PAGE_STATUS: t,
125
+ componentType: m,
126
+ statusMessageMap: u
127
+ })
128
+ }), r = $(() => {
129
+ if (s.disabled)
130
+ return;
131
+ const d = s.status === t.Occupy || s.status === t.Lock ? t.Release : t.Occupy;
132
+ a.currentSchema = {}, a.properties = null, s.disabled = !0, a.pageSchema.componentName !== x.Block ? l(a.currentPage.id, "page", d) : l(c().id, "block", d);
133
+ }, {
134
+ metaData: {
135
+ id: `${T.id}.lockOrUnlock`
136
+ },
137
+ ctx: () => ({
138
+ props: e,
139
+ pageState: a,
140
+ layoutState: o,
141
+ getCurrentBlock: c,
142
+ state: s,
143
+ iconName: k,
144
+ lockPage: l,
145
+ lockOrUnlock: r,
146
+ useCanvas: O,
147
+ useLayout: f,
148
+ useBlock: N,
149
+ useNotify: p,
150
+ constants: S,
151
+ ToolbarBase: b,
152
+ requestBlockPage: y,
153
+ COMPONENT_NAME: x,
154
+ PAGE_STATUS: t,
155
+ componentType: m,
156
+ statusMessageMap: u
157
+ })
158
+ });
74
159
  return {
75
160
  state: s,
76
- lockOrUnlock: () => {
77
- if (s.disabled)
78
- return;
79
- const l = s.status === t.Occupy || s.status === t.Lock ? t.Release : t.Occupy;
80
- a.currentSchema = {}, a.properties = null, s.disabled = !0, a.pageSchema.componentName !== E.Block ? p(a.currentPage.id, "page", l) : p(c().id, "block", l);
81
- },
161
+ lockOrUnlock: r,
82
162
  PAGE_STATUS: t,
83
- statusMessageMap: g,
84
- iconName: y
163
+ statusMessageMap: u,
164
+ iconName: k
85
165
  };
86
166
  }
87
- }, P = (e, a) => {
167
+ }, G = (e, a) => {
88
168
  const o = e.__vccOpts || e;
89
169
  for (const [c, s] of a)
90
170
  o[c] = s;
91
171
  return o;
92
172
  };
93
- function G(e, a, o, c, s, y) {
94
- var u;
95
- const p = _("toolbar-base");
96
- return c.state.isGuest ? S("", !0) : (T(), b(p, {
173
+ function U(e, a, o, c, s, k) {
174
+ var r;
175
+ const l = E("toolbar-base");
176
+ return c.state.isGuest ? v("", !0) : (L(), h(l, {
97
177
  key: 0,
98
178
  icon: c.iconName,
99
- content: (u = c.statusMessageMap[c.state.status]) == null ? void 0 : u.nextOptName,
179
+ content: (r = c.statusMessageMap[c.state.status]) == null ? void 0 : r.nextOptName,
100
180
  options: o.options,
101
181
  onClickApi: c.lockOrUnlock
102
182
  }, null, 8, ["icon", "content", "options", "onClickApi"]));
103
183
  }
104
- const U = /* @__PURE__ */ P(L, [["render", G]]), R = {
105
- id: "engine.toolbars.lock",
106
- title: "lock",
107
- type: "toolbars",
108
- options: {
109
- icon: {
110
- locked: "locked",
111
- userLocked: "user-locked",
112
- unlocked: "unlocked"
113
- },
114
- renderType: "icon"
115
- }
116
- }, H = {
117
- ...R,
118
- entry: U
184
+ const R = /* @__PURE__ */ G(D, [["render", U]]), J = {
185
+ ...T,
186
+ entry: R
119
187
  };
120
188
  export {
121
- H as default
189
+ J as default
122
190
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-lock",
3
- "version": "2.4.0",
3
+ "version": "2.5.0-alpha.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -25,12 +25,12 @@
25
25
  "license": "MIT",
26
26
  "homepage": "https://opentiny.design/tiny-engine",
27
27
  "dependencies": {
28
- "@opentiny/tiny-engine-common": "2.4.0",
29
- "@opentiny/tiny-engine-meta-register": "2.4.0",
30
- "@opentiny/tiny-engine-utils": "2.4.0"
28
+ "@opentiny/tiny-engine-common": "2.5.0-alpha.1",
29
+ "@opentiny/tiny-engine-meta-register": "2.5.0-alpha.1",
30
+ "@opentiny/tiny-engine-utils": "2.5.0-alpha.1"
31
31
  },
32
32
  "devDependencies": {
33
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.4.0",
33
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.1",
34
34
  "@vitejs/plugin-vue": "^5.1.2",
35
35
  "@vitejs/plugin-vue-jsx": "^4.0.1",
36
36
  "vite": "^5.4.2"
@@ -39,5 +39,5 @@
39
39
  "@opentiny/vue": "^3.20.0",
40
40
  "vue": "^3.4.15"
41
41
  },
42
- "gitHead": "477aa411da11a4f95712e3e5c251d97cae23f4ad"
42
+ "gitHead": "018ca6054f72ee559f0d3ca4dfcbeef4fb411e01"
43
43
  }