@opentiny/tiny-engine-toolbar-setting 1.0.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 +115 -0
  2. package/package.json +24 -0
package/dist/index.js ADDED
@@ -0,0 +1,115 @@
1
+ import { Popover as v } from "@opentiny/vue";
2
+ import { useCanvas as S, useBlock as k, usePage as y, useLayout as B, useModal as h } from "@opentiny/tiny-engine-controller";
3
+ import { constants as C } from "@opentiny/tiny-engine-utils";
4
+ import { resolveComponent as u, openBlock as x, createElementBlock as A, createVNode as d, withCtx as E, createElementVNode as M } from "vue";
5
+ const {
6
+ PAGE_STATUS: N
7
+ } = C, b = {
8
+ components: {
9
+ TinyPopover: v
10
+ },
11
+ props: {
12
+ icon: {
13
+ type: String,
14
+ default: "setting"
15
+ }
16
+ },
17
+ setup() {
18
+ const {
19
+ pageState: a,
20
+ isBlock: t
21
+ } = S(), {
22
+ getCurrentBlock: o
23
+ } = k(), {
24
+ initCurrentPageData: e,
25
+ isChangePageData: c
26
+ } = y(), {
27
+ PLUGIN_NAME: p,
28
+ activePlugin: r,
29
+ layoutState: g
30
+ } = B(), {
31
+ confirm: l,
32
+ message: _
33
+ } = h(), f = () => {
34
+ r(p.BlockManage).then((n) => {
35
+ n.openSettingPanel({
36
+ item: o()
37
+ });
38
+ });
39
+ }, m = async (n) => {
40
+ const {
41
+ currentPage: i
42
+ } = a;
43
+ n.openPageSettingPanel();
44
+ const s = await n.getPageById(i.id);
45
+ e(s);
46
+ }, P = () => {
47
+ var i;
48
+ const {
49
+ pageStatus: n
50
+ } = g;
51
+ if (n.state === N.Lock) {
52
+ const s = ((i = n.data) == null ? void 0 : i.username) || "";
53
+ _({
54
+ message: `您点击的页面被${s}锁定,暂时无法编辑,请联系解锁`,
55
+ status: "info"
56
+ });
57
+ return;
58
+ }
59
+ r(p.AppManage).then((s) => {
60
+ if (c()) {
61
+ l({
62
+ title: "提示",
63
+ message: "当前页面尚未保存,是否要继续切换?",
64
+ exec: () => {
65
+ m(s);
66
+ }
67
+ });
68
+ return;
69
+ }
70
+ m(s);
71
+ });
72
+ };
73
+ return {
74
+ openSetting: () => t() ? f() : P(),
75
+ isBlock: t
76
+ };
77
+ }
78
+ }, I = (a, t) => {
79
+ const o = a.__vccOpts || a;
80
+ for (const [e, c] of t)
81
+ o[e] = c;
82
+ return o;
83
+ }, L = { class: "toolbar-itm-clean" };
84
+ function T(a, t, o, e, c, p) {
85
+ const r = u("svg-icon"), g = u("tiny-popover");
86
+ return x(), A("div", L, [
87
+ d(g, {
88
+ trigger: "hover",
89
+ "open-delay": 1e3,
90
+ "popper-class": "toolbar-right-popover",
91
+ "append-to-body": "",
92
+ content: e.isBlock() ? "区块设置" : "页面设置"
93
+ }, {
94
+ reference: E(() => [
95
+ M("span", {
96
+ class: "icon",
97
+ onClick: t[0] || (t[0] = (...l) => e.openSetting && e.openSetting(...l))
98
+ }, [
99
+ d(r, { name: o.icon }, null, 8, ["name"])
100
+ ])
101
+ ]),
102
+ _: 1
103
+ }, 8, ["content"])
104
+ ]);
105
+ }
106
+ const w = /* @__PURE__ */ I(b, [["render", T]]), $ = {
107
+ id: "setting",
108
+ title: "setting",
109
+ icon: "",
110
+ align: "right",
111
+ component: w
112
+ };
113
+ export {
114
+ $ as default
115
+ };
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@opentiny/tiny-engine-toolbar-setting",
3
+ "version": "1.0.1",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "scripts": {
8
+ "build": "vite build"
9
+ },
10
+ "main": "dist/index.js",
11
+ "module": "dist/index.js",
12
+ "files": [
13
+ "dist"
14
+ ],
15
+ "dependencies": {
16
+ "@opentiny/vue": "^3.8.0",
17
+ "vue": "3.2.45"
18
+ },
19
+ "devDependencies": {
20
+ "@vitejs/plugin-vue": "^4.2.3",
21
+ "@vitejs/plugin-vue-jsx": "^1.3.10",
22
+ "vite": "^4.3.7"
23
+ }
24
+ }