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

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 +57 -125
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1,53 +1,29 @@
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 = {
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 = {
30
6
  block: "区块",
31
7
  page: "页面"
32
- }, u = {
8
+ }, g = {
33
9
  [t.Release]: {
34
- message: (e) => `${m[e]}解锁成功!`,
10
+ message: (e) => `${d[e]}解锁成功!`,
35
11
  currentOptName: "解锁",
36
12
  nextOptName: "锁定"
37
13
  },
38
14
  [t.Lock]: {
39
- message: (e) => `${m[e]}解锁成功!`,
15
+ message: (e) => `${d[e]}解锁成功!`,
40
16
  currentOptName: "解锁",
41
17
  nextOptName: "解锁"
42
18
  },
43
19
  [t.Occupy]: {
44
- message: (e) => `${m[e]}锁定成功`,
20
+ message: (e) => `${d[e]}锁定成功`,
45
21
  currentOptName: "锁定",
46
22
  nextOptName: "解锁"
47
23
  }
48
- }, D = {
24
+ }, L = {
49
25
  components: {
50
- ToolbarBase: b
26
+ ToolbarBase: h
51
27
  },
52
28
  props: {
53
29
  options: {
@@ -56,18 +32,12 @@ const T = {
56
32
  }
57
33
  },
58
34
  setup(e) {
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),
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),
68
38
  type: "",
69
39
  disabled: !1
70
- }), k = _(() => {
40
+ }), y = m(() => {
71
41
  switch (s.status) {
72
42
  case t.Occupy:
73
43
  return e.options.icon.locked;
@@ -76,115 +46,77 @@ const T = {
76
46
  default:
77
47
  return e.options.icon.unlocked;
78
48
  }
79
- }), l = $((d, B, g) => {
80
- y(`id=${d}&state=${g}&type=${B}`).then((n) => {
81
- var C;
49
+ }), p = (l, O, i) => {
50
+ v(`id=${l}&state=${i}&type=${O}`).then((n) => {
51
+ var f;
82
52
  if ((n == null ? void 0 : n.operate) === "success")
83
- p({
53
+ k({
84
54
  type: "success",
85
- message: u[g].message(B)
86
- }), o.pageStatus.state = g;
55
+ message: g[i].message(O)
56
+ }), o.pageStatus.state = i;
87
57
  else {
88
- const i = (C = o.pageStatus) == null ? void 0 : C.data;
89
- p({
58
+ const r = (f = o.pageStatus) == null ? void 0 : f.data;
59
+ k({
90
60
  type: "warning",
91
- message: `当前页面被 ${(i == null ? void 0 : i.username) || ""} ${(i == null ? void 0 : i.resetPasswordToken) || ""} 锁定,请联系解锁`
61
+ message: `当前页面被 ${(r == null ? void 0 : r.username) || ""} ${(r == null ? void 0 : r.resetPasswordToken) || ""} 锁定,请联系解锁`
92
62
  });
93
63
  }
94
64
  }).catch((n) => {
95
- p({
65
+ k({
96
66
  type: "error",
97
- title: `页面${u[g].currentOptName}失败`,
67
+ title: `页面${g[i].currentOptName}失败`,
98
68
  message: JSON.stringify((n == null ? void 0 : n.message) || n)
99
69
  });
100
70
  }).finally(() => {
101
71
  s.disabled = !1;
102
72
  });
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
- });
73
+ };
159
74
  return {
160
75
  state: s,
161
- lockOrUnlock: r,
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
+ },
162
82
  PAGE_STATUS: t,
163
- statusMessageMap: u,
164
- iconName: k
83
+ statusMessageMap: g,
84
+ iconName: y
165
85
  };
166
86
  }
167
- }, G = (e, a) => {
87
+ }, P = (e, a) => {
168
88
  const o = e.__vccOpts || e;
169
89
  for (const [c, s] of a)
170
90
  o[c] = s;
171
91
  return o;
172
92
  };
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, {
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, {
177
97
  key: 0,
178
98
  icon: c.iconName,
179
- content: (r = c.statusMessageMap[c.state.status]) == null ? void 0 : r.nextOptName,
99
+ content: (u = c.statusMessageMap[c.state.status]) == null ? void 0 : u.nextOptName,
180
100
  options: o.options,
181
101
  onClickApi: c.lockOrUnlock
182
102
  }, null, 8, ["icon", "content", "options", "onClickApi"]));
183
103
  }
184
- const R = /* @__PURE__ */ G(D, [["render", U]]), J = {
185
- ...T,
186
- entry: R
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
187
119
  };
188
120
  export {
189
- J as default
121
+ H as default
190
122
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-lock",
3
- "version": "2.5.0-alpha.1",
3
+ "version": "2.5.0-alpha.2",
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.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"
28
+ "@opentiny/tiny-engine-common": "2.5.0-alpha.2",
29
+ "@opentiny/tiny-engine-meta-register": "2.5.0-alpha.2",
30
+ "@opentiny/tiny-engine-utils": "2.5.0-alpha.2"
31
31
  },
32
32
  "devDependencies": {
33
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.1",
33
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.2",
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": "018ca6054f72ee559f0d3ca4dfcbeef4fb411e01"
42
+ "gitHead": "f5707c379397bffc9a63c50c695f3ee3340ad0c6"
43
43
  }