@opentiny/tiny-engine-toolbar-lock 2.6.1 → 2.7.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.
- package/dist/index.js +133 -65
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1,29 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { constants as
|
|
4
|
-
import { ToolbarBase as
|
|
5
|
-
const
|
|
1
|
+
import { callEntry as M, getMetaApi as T, META_SERVICE as h, useCanvas as O, useLayout as f, useBlock as b, useNotify as r } from "@opentiny/tiny-engine-meta-register";
|
|
2
|
+
import { reactive as A, computed as N, resolveComponent as E, createBlock as P, createCommentVNode as $, openBlock as v } from "vue";
|
|
3
|
+
import { constants as S } from "@opentiny/tiny-engine-utils";
|
|
4
|
+
import { ToolbarBase as _ } from "@opentiny/tiny-engine-common";
|
|
5
|
+
const L = {
|
|
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
|
+
}, d = M((e) => T(h.Http).get(`app-center/api/apps/canvas/lock?${e}`), {
|
|
18
|
+
metaData: {
|
|
19
|
+
id: "engine.toolbars.lock.http.requestBlockPage"
|
|
20
|
+
},
|
|
21
|
+
ctx: () => ({
|
|
22
|
+
getMetaApi: T,
|
|
23
|
+
META_SERVICE: h,
|
|
24
|
+
requestBlockPage: d
|
|
25
|
+
})
|
|
26
|
+
}), {
|
|
27
|
+
COMPONENT_NAME: x,
|
|
28
|
+
PAGE_STATUS: t
|
|
29
|
+
} = S, u = {
|
|
6
30
|
block: "区块",
|
|
7
31
|
page: "页面"
|
|
8
|
-
},
|
|
32
|
+
}, p = {
|
|
9
33
|
[t.Release]: {
|
|
10
|
-
message: (e) => `${
|
|
34
|
+
message: (e) => `${u[e]}解锁成功!`,
|
|
11
35
|
currentOptName: "解锁",
|
|
12
36
|
nextOptName: "锁定"
|
|
13
37
|
},
|
|
14
38
|
[t.Lock]: {
|
|
15
|
-
message: (e) => `${
|
|
39
|
+
message: (e) => `${u[e]}解锁成功!`,
|
|
16
40
|
currentOptName: "解锁",
|
|
17
41
|
nextOptName: "解锁"
|
|
18
42
|
},
|
|
19
43
|
[t.Occupy]: {
|
|
20
|
-
message: (e) => `${
|
|
44
|
+
message: (e) => `${u[e]}锁定成功`,
|
|
21
45
|
currentOptName: "锁定",
|
|
22
46
|
nextOptName: "解锁"
|
|
23
47
|
}
|
|
24
|
-
},
|
|
48
|
+
}, D = {
|
|
25
49
|
components: {
|
|
26
|
-
ToolbarBase:
|
|
50
|
+
ToolbarBase: _
|
|
27
51
|
},
|
|
28
52
|
props: {
|
|
29
53
|
options: {
|
|
@@ -32,13 +56,19 @@ 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 {
|
|
36
|
-
|
|
37
|
-
|
|
59
|
+
const {
|
|
60
|
+
pageState: a
|
|
61
|
+
} = O(), {
|
|
62
|
+
layoutState: s
|
|
63
|
+
} = f(), {
|
|
64
|
+
getCurrentBlock: c
|
|
65
|
+
} = b(), o = A({
|
|
66
|
+
status: N(() => s.pageStatus.state),
|
|
67
|
+
isGuest: N(() => s.pageStatus.state === t.Guest),
|
|
38
68
|
type: "",
|
|
39
69
|
disabled: !1
|
|
40
|
-
}),
|
|
41
|
-
switch (
|
|
70
|
+
}), m = N(() => {
|
|
71
|
+
switch (o.status) {
|
|
42
72
|
case t.Occupy:
|
|
43
73
|
return e.options.icon.locked;
|
|
44
74
|
case t.Lock:
|
|
@@ -46,78 +76,116 @@ 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
|
-
}),
|
|
50
|
-
|
|
51
|
-
var
|
|
79
|
+
}), l = M((k, B, g) => {
|
|
80
|
+
d(`id=${k}&state=${g}&type=${B}`).then((n) => {
|
|
81
|
+
var C;
|
|
52
82
|
if ((n == null ? void 0 : n.operate) === "success")
|
|
53
|
-
|
|
83
|
+
r({
|
|
54
84
|
type: "success",
|
|
55
|
-
message: g
|
|
56
|
-
}),
|
|
85
|
+
message: p[g].message(B)
|
|
86
|
+
}), s.pageStatus.state = g;
|
|
57
87
|
else {
|
|
58
|
-
const
|
|
59
|
-
|
|
88
|
+
const y = (C = s.pageStatus) == null ? void 0 : C.data;
|
|
89
|
+
r({
|
|
60
90
|
type: "warning",
|
|
61
|
-
message: `当前页面被 ${(
|
|
91
|
+
message: `当前页面被 ${(y == null ? void 0 : y.username) || ""} 锁定,请联系解锁`
|
|
62
92
|
});
|
|
63
93
|
}
|
|
64
94
|
}).catch((n) => {
|
|
65
|
-
|
|
95
|
+
r({
|
|
66
96
|
type: "error",
|
|
67
|
-
title: `页面${g
|
|
97
|
+
title: `页面${p[g].currentOptName}失败`,
|
|
68
98
|
message: JSON.stringify((n == null ? void 0 : n.message) || n)
|
|
69
99
|
});
|
|
70
100
|
}).finally(() => {
|
|
71
|
-
|
|
101
|
+
o.disabled = !1;
|
|
72
102
|
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
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);
|
|
103
|
+
}, {
|
|
104
|
+
metaData: {
|
|
105
|
+
id: "engine.toolbars.lock.Main.lockPage"
|
|
81
106
|
},
|
|
107
|
+
ctx: () => ({
|
|
108
|
+
props: e,
|
|
109
|
+
pageState: a,
|
|
110
|
+
layoutState: s,
|
|
111
|
+
getCurrentBlock: c,
|
|
112
|
+
state: o,
|
|
113
|
+
iconName: m,
|
|
114
|
+
lockPage: l,
|
|
115
|
+
lockOrUnlock: i,
|
|
116
|
+
useCanvas: O,
|
|
117
|
+
useLayout: f,
|
|
118
|
+
useBlock: b,
|
|
119
|
+
useNotify: r,
|
|
120
|
+
constants: S,
|
|
121
|
+
ToolbarBase: _,
|
|
122
|
+
requestBlockPage: d,
|
|
123
|
+
COMPONENT_NAME: x,
|
|
124
|
+
PAGE_STATUS: t,
|
|
125
|
+
componentType: u,
|
|
126
|
+
statusMessageMap: p
|
|
127
|
+
})
|
|
128
|
+
}), i = M(() => {
|
|
129
|
+
if (o.disabled)
|
|
130
|
+
return;
|
|
131
|
+
const k = o.status === t.Occupy || o.status === t.Lock ? t.Release : t.Occupy;
|
|
132
|
+
a.currentSchema = {}, a.properties = null, o.disabled = !0, a.pageSchema.componentName !== x.Block ? l(a.currentPage.id, "page", k) : l(c().id, "block", k);
|
|
133
|
+
}, {
|
|
134
|
+
metaData: {
|
|
135
|
+
id: "engine.toolbars.lock.Main.lockOrUnlock"
|
|
136
|
+
},
|
|
137
|
+
ctx: () => ({
|
|
138
|
+
props: e,
|
|
139
|
+
pageState: a,
|
|
140
|
+
layoutState: s,
|
|
141
|
+
getCurrentBlock: c,
|
|
142
|
+
state: o,
|
|
143
|
+
iconName: m,
|
|
144
|
+
lockPage: l,
|
|
145
|
+
lockOrUnlock: i,
|
|
146
|
+
useCanvas: O,
|
|
147
|
+
useLayout: f,
|
|
148
|
+
useBlock: b,
|
|
149
|
+
useNotify: r,
|
|
150
|
+
constants: S,
|
|
151
|
+
ToolbarBase: _,
|
|
152
|
+
requestBlockPage: d,
|
|
153
|
+
COMPONENT_NAME: x,
|
|
154
|
+
PAGE_STATUS: t,
|
|
155
|
+
componentType: u,
|
|
156
|
+
statusMessageMap: p
|
|
157
|
+
})
|
|
158
|
+
});
|
|
159
|
+
return {
|
|
160
|
+
state: o,
|
|
161
|
+
lockOrUnlock: i,
|
|
82
162
|
PAGE_STATUS: t,
|
|
83
|
-
statusMessageMap:
|
|
84
|
-
iconName:
|
|
163
|
+
statusMessageMap: p,
|
|
164
|
+
iconName: m
|
|
85
165
|
};
|
|
86
166
|
}
|
|
87
|
-
},
|
|
88
|
-
const
|
|
89
|
-
for (const [c,
|
|
90
|
-
|
|
91
|
-
return
|
|
167
|
+
}, G = (e, a) => {
|
|
168
|
+
const s = e.__vccOpts || e;
|
|
169
|
+
for (const [c, o] of a)
|
|
170
|
+
s[c] = o;
|
|
171
|
+
return s;
|
|
92
172
|
};
|
|
93
|
-
function
|
|
94
|
-
var
|
|
95
|
-
const
|
|
96
|
-
return c.state.isGuest ?
|
|
173
|
+
function U(e, a, s, c, o, m) {
|
|
174
|
+
var i;
|
|
175
|
+
const l = E("toolbar-base");
|
|
176
|
+
return c.state.isGuest ? $("", !0) : (v(), P(l, {
|
|
97
177
|
key: 0,
|
|
98
178
|
icon: c.iconName,
|
|
99
|
-
content: (
|
|
100
|
-
options:
|
|
179
|
+
content: (i = c.statusMessageMap[c.state.status]) == null ? void 0 : i.nextOptName,
|
|
180
|
+
options: s.options,
|
|
101
181
|
onClickApi: c.lockOrUnlock
|
|
102
182
|
}, null, 8, ["icon", "content", "options", "onClickApi"]));
|
|
103
183
|
}
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
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
|
+
...L,
|
|
186
|
+
entry: R
|
|
119
187
|
};
|
|
120
188
|
export {
|
|
121
|
-
|
|
189
|
+
J as default
|
|
122
190
|
};
|
|
123
191
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../meta.js","../index.ts"],"sourcesContent":["export default {\n id: 'engine.toolbars.lock',\n title: 'lock',\n type: 'toolbars',\n options: {\n icon: {\n locked: 'locked',\n userLocked: 'user-locked',\n unlocked: 'unlocked'\n },\n renderType: 'icon'\n }\n}\n","/**\n * Copyright (c) 2023 - present TinyEngine Authors.\n * Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.\n *\n * Use of this source code is governed by an MIT-style license.\n *\n * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,\n * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR\n * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.\n *\n */\n\nimport entry from './src/Main.vue'\nimport metaData from './meta'\n\nexport default {\n ...metaData,\n entry\n}\n"],"names":["metaData","index","entry"],"mappings":";;;;AAAA,MAAAA,IAAe;AAAA,EACb,IAAI;AAAA,EACJ,OAAO;AAAA,EACP,MAAM;AAAA,EACN,SAAS;AAAA,IACP,MAAM;AAAA,MACJ,QAAQ;AAAA,MACR,YAAY;AAAA,MACZ,UAAU;AAAA,IAChB;AAAA,IACI,YAAY;AAAA,EAChB;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iDCGAC,IAAe;AAAA,EACb,GAAGD;AAAA,EACH,OAAAE;AACF;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-engine-toolbar-lock",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.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.
|
|
29
|
-
"@opentiny/tiny-engine-meta-register": "2.
|
|
30
|
-
"@opentiny/tiny-engine-utils": "2.
|
|
28
|
+
"@opentiny/tiny-engine-common": "2.7.0-alpha.1",
|
|
29
|
+
"@opentiny/tiny-engine-meta-register": "2.7.0-alpha.1",
|
|
30
|
+
"@opentiny/tiny-engine-utils": "2.7.0-alpha.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.
|
|
33
|
+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.7.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": "
|
|
42
|
+
"gitHead": "c01029eda7c64a2e9191ec0d861790df9eece7cf"
|
|
43
43
|
}
|