@opentiny/tiny-engine-toolbar-lock 2.0.0-alpha.2 → 2.0.0-alpha.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 +83 -83
- package/package.json +11 -9
package/dist/index.js
CHANGED
|
@@ -1,123 +1,123 @@
|
|
|
1
|
-
import { reactive as
|
|
2
|
-
import { useCanvas as
|
|
3
|
-
import { constants as
|
|
4
|
-
import {
|
|
5
|
-
import { useHttp as
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
for (const [
|
|
9
|
-
|
|
10
|
-
return
|
|
11
|
-
}, { COMPONENT_NAME:
|
|
1
|
+
import { reactive as N, computed as m, resolveComponent as _, openBlock as b, createBlock as x, createCommentVNode as S } from "vue";
|
|
2
|
+
import { useCanvas as T, useLayout as $, useBlock as h, useNotify as k } from "@opentiny/tiny-engine-meta-register";
|
|
3
|
+
import { constants as B } from "@opentiny/tiny-engine-utils";
|
|
4
|
+
import { ToolbarBase as C } from "@opentiny/tiny-engine-common";
|
|
5
|
+
import { useHttp as v } from "@opentiny/tiny-engine-http";
|
|
6
|
+
const L = v(), M = (e) => L.get(`app-center/api/apps/canvas/lock?${e}`), P = (e, a) => {
|
|
7
|
+
const o = e.__vccOpts || e;
|
|
8
|
+
for (const [c, s] of a)
|
|
9
|
+
o[c] = s;
|
|
10
|
+
return o;
|
|
11
|
+
}, { COMPONENT_NAME: A, PAGE_STATUS: t } = B, d = {
|
|
12
12
|
block: "区块",
|
|
13
13
|
page: "页面"
|
|
14
|
-
},
|
|
15
|
-
[
|
|
16
|
-
message: (e) => `${
|
|
14
|
+
}, g = {
|
|
15
|
+
[t.Release]: {
|
|
16
|
+
message: (e) => `${d[e]}解锁成功!`,
|
|
17
17
|
currentOptName: "解锁",
|
|
18
18
|
nextOptName: "锁定"
|
|
19
19
|
},
|
|
20
|
-
[
|
|
21
|
-
message: (e) => `${
|
|
20
|
+
[t.Lock]: {
|
|
21
|
+
message: (e) => `${d[e]}解锁成功!`,
|
|
22
22
|
currentOptName: "解锁",
|
|
23
23
|
nextOptName: "解锁"
|
|
24
24
|
},
|
|
25
|
-
[
|
|
26
|
-
message: (e) => `${
|
|
25
|
+
[t.Occupy]: {
|
|
26
|
+
message: (e) => `${d[e]}锁定成功`,
|
|
27
27
|
currentOptName: "锁定",
|
|
28
28
|
nextOptName: "解锁"
|
|
29
29
|
}
|
|
30
|
-
},
|
|
30
|
+
}, G = {
|
|
31
31
|
components: {
|
|
32
|
-
|
|
32
|
+
ToolbarBase: C
|
|
33
33
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
props: {
|
|
35
|
+
options: {
|
|
36
|
+
type: Object,
|
|
37
|
+
default: () => ({})
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
setup(e) {
|
|
41
|
+
const { pageState: a } = T(), { layoutState: o } = $(), { getCurrentBlock: c } = h(), s = N({
|
|
42
|
+
status: m(() => o.pageStatus.state),
|
|
43
|
+
isGuest: m(() => o.pageStatus.state === t.Guest),
|
|
38
44
|
type: "",
|
|
39
45
|
disabled: !1
|
|
40
|
-
}),
|
|
41
|
-
switch (
|
|
42
|
-
case
|
|
43
|
-
return
|
|
44
|
-
case
|
|
45
|
-
return
|
|
46
|
+
}), y = m(() => {
|
|
47
|
+
switch (s.status) {
|
|
48
|
+
case t.Occupy:
|
|
49
|
+
return e.options.icon.locked;
|
|
50
|
+
case t.Lock:
|
|
51
|
+
return e.options.icon.userLocked;
|
|
46
52
|
default:
|
|
47
|
-
return
|
|
53
|
+
return e.options.icon.unlocked;
|
|
48
54
|
}
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
if ((
|
|
53
|
-
|
|
55
|
+
}), p = (l, O, i) => {
|
|
56
|
+
M(`id=${l}&state=${i}&type=${O}`).then((n) => {
|
|
57
|
+
var f;
|
|
58
|
+
if ((n == null ? void 0 : n.operate) === "success")
|
|
59
|
+
k({
|
|
54
60
|
type: "success",
|
|
55
|
-
message:
|
|
56
|
-
}),
|
|
61
|
+
message: g[i].message(O)
|
|
62
|
+
}), o.pageStatus.state = i;
|
|
57
63
|
else {
|
|
58
|
-
const
|
|
59
|
-
|
|
64
|
+
const r = (f = o.pageStatus) == null ? void 0 : f.data;
|
|
65
|
+
k({
|
|
60
66
|
type: "warning",
|
|
61
|
-
message: `当前页面被 ${(
|
|
67
|
+
message: `当前页面被 ${(r == null ? void 0 : r.username) || ""} ${(r == null ? void 0 : r.resetPasswordToken) || ""} 锁定,请联系解锁`
|
|
62
68
|
});
|
|
63
69
|
}
|
|
64
|
-
}).catch((
|
|
65
|
-
|
|
70
|
+
}).catch((n) => {
|
|
71
|
+
k({
|
|
66
72
|
type: "error",
|
|
67
|
-
title: `页面${
|
|
68
|
-
message: JSON.stringify((
|
|
73
|
+
title: `页面${g[i].currentOptName}失败`,
|
|
74
|
+
message: JSON.stringify((n == null ? void 0 : n.message) || n)
|
|
69
75
|
});
|
|
70
76
|
}).finally(() => {
|
|
71
|
-
|
|
77
|
+
s.disabled = !1;
|
|
72
78
|
});
|
|
73
79
|
};
|
|
74
80
|
return {
|
|
75
|
-
state:
|
|
81
|
+
state: s,
|
|
76
82
|
lockOrUnlock: () => {
|
|
77
|
-
if (
|
|
83
|
+
if (s.disabled)
|
|
78
84
|
return;
|
|
79
|
-
const
|
|
80
|
-
|
|
85
|
+
const l = s.status === t.Occupy || s.status === t.Lock ? t.Release : t.Occupy;
|
|
86
|
+
a.currentSchema = {}, a.properties = null, s.disabled = !0, a.pageSchema.componentName !== A.Block ? p(a.currentPage.id, "page", l) : p(c().id, "block", l);
|
|
81
87
|
},
|
|
82
|
-
PAGE_STATUS:
|
|
83
|
-
statusMessageMap:
|
|
84
|
-
iconName:
|
|
88
|
+
PAGE_STATUS: t,
|
|
89
|
+
statusMessageMap: g,
|
|
90
|
+
iconName: y
|
|
85
91
|
};
|
|
86
92
|
}
|
|
87
|
-
}
|
|
88
|
-
function
|
|
89
|
-
var
|
|
90
|
-
const
|
|
91
|
-
return
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}, {
|
|
99
|
-
reference: b(() => [
|
|
100
|
-
x("span", R, [
|
|
101
|
-
N(y, {
|
|
102
|
-
name: t.iconName,
|
|
103
|
-
onClick: t.lockOrUnlock
|
|
104
|
-
}, null, 8, ["name", "onClick"])
|
|
105
|
-
])
|
|
106
|
-
]),
|
|
107
|
-
_: 1
|
|
108
|
-
}, 8, ["content"])
|
|
109
|
-
]));
|
|
93
|
+
};
|
|
94
|
+
function U(e, a, o, c, s, y) {
|
|
95
|
+
var u;
|
|
96
|
+
const p = _("toolbar-base");
|
|
97
|
+
return c.state.isGuest ? S("", !0) : (b(), x(p, {
|
|
98
|
+
key: 0,
|
|
99
|
+
icon: c.iconName,
|
|
100
|
+
content: (u = c.statusMessageMap[c.state.status]) == null ? void 0 : u.nextOptName,
|
|
101
|
+
options: o.options,
|
|
102
|
+
onClickApi: c.lockOrUnlock
|
|
103
|
+
}, null, 8, ["icon", "content", "options", "onClickApi"]));
|
|
110
104
|
}
|
|
111
|
-
const
|
|
105
|
+
const E = /* @__PURE__ */ P(G, [["render", U]]), R = {
|
|
112
106
|
id: "engine.toolbars.lock",
|
|
113
107
|
title: "lock",
|
|
114
108
|
type: "toolbars",
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
options: {
|
|
110
|
+
icon: {
|
|
111
|
+
locked: "locked",
|
|
112
|
+
userLocked: "user-locked",
|
|
113
|
+
unlocked: "unlocked"
|
|
114
|
+
},
|
|
115
|
+
renderType: "icon"
|
|
116
|
+
}
|
|
117
|
+
}, V = {
|
|
118
|
+
...R,
|
|
119
|
+
entry: E
|
|
120
120
|
};
|
|
121
121
|
export {
|
|
122
|
-
|
|
122
|
+
V as default
|
|
123
123
|
};
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-engine-toolbar-lock",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "vite build"
|
|
9
9
|
},
|
|
10
|
+
"type": "module",
|
|
10
11
|
"main": "dist/index.js",
|
|
11
12
|
"module": "dist/index.js",
|
|
12
13
|
"files": [
|
|
@@ -24,19 +25,20 @@
|
|
|
24
25
|
"license": "MIT",
|
|
25
26
|
"homepage": "https://opentiny.design/tiny-engine",
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@opentiny/tiny-engine-
|
|
28
|
-
"@opentiny/tiny-engine-
|
|
29
|
-
"@opentiny/tiny-engine-
|
|
28
|
+
"@opentiny/tiny-engine-common": "2.0.0-alpha.3",
|
|
29
|
+
"@opentiny/tiny-engine-http": "2.0.0-alpha.3",
|
|
30
|
+
"@opentiny/tiny-engine-meta-register": "2.0.0-alpha.3",
|
|
31
|
+
"@opentiny/tiny-engine-utils": "2.0.0-alpha.3"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
32
|
-
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-alpha.
|
|
33
|
-
"@vitejs/plugin-vue": "^
|
|
34
|
-
"@vitejs/plugin-vue-jsx": "^
|
|
35
|
-
"vite": "^4.
|
|
34
|
+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-alpha.3",
|
|
35
|
+
"@vitejs/plugin-vue": "^5.1.2",
|
|
36
|
+
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
|
37
|
+
"vite": "^5.4.2"
|
|
36
38
|
},
|
|
37
39
|
"peerDependencies": {
|
|
38
40
|
"@opentiny/vue": "^3.14.0",
|
|
39
41
|
"vue": "^3.4.15"
|
|
40
42
|
},
|
|
41
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "20aba1ffa81a1633feec954e3146586193c18f22"
|
|
42
44
|
}
|