@opentiny/tiny-engine-toolbar-setting 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.
Files changed (2) hide show
  1. package/dist/index.js +77 -88
  2. package/package.json +10 -8
package/dist/index.js CHANGED
@@ -1,135 +1,124 @@
1
- import { Popover as v } from "@opentiny/vue";
2
- import { useCanvas as k, useBlock as B, usePage as h, useLayout as C, useModal as b, useNotify as x } from "@opentiny/tiny-engine-meta-register";
1
+ import { useCanvas as P, useBlock as k, usePage as y, useLayout as S, useModal as B, useNotify as b } from "@opentiny/tiny-engine-meta-register";
3
2
  import { constants as A } from "@opentiny/tiny-engine-utils";
4
- import { resolveComponent as u, openBlock as E, createElementBlock as N, createVNode as d, withCtx as D, createElementVNode as f, toDisplayString as M } from "vue";
3
+ import { ToolbarBase as C } from "@opentiny/tiny-engine-common";
4
+ import { resolveComponent as v, openBlock as x, createBlock as h } from "vue";
5
5
  const {
6
- PAGE_STATUS: w
7
- } = A, I = {
6
+ PAGE_STATUS: M
7
+ } = A, T = {
8
8
  components: {
9
- TinyPopover: v
9
+ ToolbarBase: C
10
10
  },
11
11
  props: {
12
- icon: {
13
- type: String,
14
- default: "setting"
12
+ options: {
13
+ type: Object,
14
+ default: () => ({})
15
15
  }
16
16
  },
17
17
  setup() {
18
18
  const {
19
- pageState: a,
20
- isBlock: e
19
+ pageState: s,
20
+ isBlock: a
21
+ } = P(), {
22
+ getCurrentBlock: t
21
23
  } = k(), {
22
- getCurrentBlock: o
23
- } = B(), {
24
- initCurrentPageData: t,
25
- isChangePageData: r
26
- } = h(), {
24
+ initCurrentPageData: n,
25
+ isChangePageData: c
26
+ } = y(), {
27
27
  PLUGIN_NAME: p,
28
- activePlugin: c,
29
- layoutState: g,
30
- isEmptyPage: l
31
- } = C(), {
32
- confirm: _,
33
- message: y
34
- } = b(), P = () => {
35
- c(p.BlockManage).then((n) => {
36
- n.openSettingPanel({
37
- item: o()
28
+ activePlugin: i,
29
+ layoutState: l,
30
+ isEmptyPage: u
31
+ } = S(), {
32
+ confirm: m,
33
+ message: f
34
+ } = B(), d = () => {
35
+ i(p.BlockManage).then((e) => {
36
+ e.openSettingPanel({
37
+ item: t()
38
38
  });
39
39
  });
40
- }, m = async (n) => {
40
+ }, g = async (e) => {
41
41
  const {
42
- currentPage: i
43
- } = a;
44
- n.openPageSettingPanel();
45
- const s = await n.getPageById(i.id);
46
- t(s);
47
- }, S = () => {
48
- var i;
42
+ currentPage: r
43
+ } = s;
44
+ e.openPageSettingPanel();
45
+ const o = await e.getPageById(r.id);
46
+ n(o);
47
+ }, _ = () => {
48
+ var r;
49
49
  const {
50
- pageStatus: n
51
- } = g;
52
- if (n.state === w.Lock) {
53
- const s = ((i = n.data) == null ? void 0 : i.username) || "";
54
- y({
55
- message: `您点击的页面被${s}锁定,暂时无法编辑,请联系解锁`,
50
+ pageStatus: e
51
+ } = l;
52
+ if (e.state === M.Lock) {
53
+ const o = ((r = e.data) == null ? void 0 : r.username) || "";
54
+ f({
55
+ message: `您点击的页面被${o}锁定,暂时无法编辑,请联系解锁`,
56
56
  status: "info"
57
57
  });
58
58
  return;
59
59
  }
60
- c(p.AppManage).then((s) => {
61
- if (r()) {
62
- _({
60
+ i(p.AppManage).then((o) => {
61
+ if (c()) {
62
+ m({
63
63
  title: "提示",
64
64
  message: "当前页面尚未保存,是否要继续切换?",
65
65
  exec: () => {
66
- m(s);
66
+ g(o);
67
67
  }
68
68
  });
69
69
  return;
70
70
  }
71
- m(s);
71
+ g(o);
72
72
  });
73
73
  };
74
74
  return {
75
75
  openSetting: () => {
76
- if (l()) {
77
- x({
76
+ if (u()) {
77
+ b({
78
78
  type: "warning",
79
79
  message: "请先创建页面"
80
80
  });
81
81
  return;
82
82
  }
83
- if (e()) {
84
- P();
83
+ if (a()) {
84
+ d();
85
85
  return;
86
86
  }
87
- S();
87
+ _();
88
88
  },
89
- isBlock: e
89
+ isBlock: a
90
90
  };
91
91
  }
92
- }, L = (a, e) => {
93
- const o = a.__vccOpts || a;
94
- for (const [t, r] of e)
95
- o[t] = r;
96
- return o;
97
- }, T = { class: "toolbar-itm-clean" };
98
- function G(a, e, o, t, r, p) {
99
- const c = u("svg-icon"), g = u("tiny-popover");
100
- return E(), N("div", T, [
101
- d(g, {
102
- trigger: "hover",
103
- "open-delay": 1e3,
104
- "popper-class": "toolbar-right-popover",
105
- "append-to-body": "",
106
- content: t.isBlock() ? "区块设置" : "页面设置",
107
- disabled: !0
108
- }, {
109
- reference: D(() => [
110
- f("span", {
111
- class: "icon-hides",
112
- onClick: e[0] || (e[0] = (...l) => t.openSetting && t.openSetting(...l))
113
- }, [
114
- d(c, { name: o.icon }, null, 8, ["name"])
115
- ]),
116
- f("span", null, M(t.isBlock() ? "区块设置" : "页面设置"), 1)
117
- ]),
118
- _: 1
119
- }, 8, ["content"])
120
- ]);
92
+ }, D = (s, a) => {
93
+ const t = s.__vccOpts || s;
94
+ for (const [n, c] of a)
95
+ t[n] = c;
96
+ return t;
97
+ };
98
+ function E(s, a, t, n, c, p) {
99
+ const i = v("toolbar-base");
100
+ return x(), h(i, {
101
+ content: n.isBlock() ? "区块设置" : "页面设置",
102
+ icon: t.options.icon.default || t.options.icon,
103
+ options: t.options,
104
+ onClickApi: n.openSetting
105
+ }, null, 8, ["content", "icon", "options", "onClickApi"]);
121
106
  }
122
- const U = /* @__PURE__ */ L(I, [["render", G]]), V = {
107
+ const I = /* @__PURE__ */ D(T, [["render", E]]), L = {
123
108
  id: "engine.toolbars.setting",
124
109
  title: "setting",
125
110
  type: "toolbars",
126
- align: "right",
127
- icon: "",
128
- collapsed: !0
129
- }, H = {
130
- ...V,
131
- entry: U
111
+ options: {
112
+ icon: {
113
+ default: "setting"
114
+ },
115
+ renderType: "icon",
116
+ collapsed: !0
117
+ }
118
+ }, j = {
119
+ ...L,
120
+ entry: I
132
121
  };
133
122
  export {
134
- H as default
123
+ j as default
135
124
  };
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-setting",
3
- "version": "2.0.0-alpha.2",
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,18 +25,19 @@
24
25
  "license": "MIT",
25
26
  "homepage": "https://opentiny.design/tiny-engine",
26
27
  "dependencies": {
27
- "@opentiny/tiny-engine-meta-register": "2.0.0-alpha.2",
28
- "@opentiny/tiny-engine-utils": "2.0.0-alpha.2"
28
+ "@opentiny/tiny-engine-common": "2.0.0-alpha.3",
29
+ "@opentiny/tiny-engine-meta-register": "2.0.0-alpha.3",
30
+ "@opentiny/tiny-engine-utils": "2.0.0-alpha.3"
29
31
  },
30
32
  "devDependencies": {
31
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-alpha.2",
32
- "@vitejs/plugin-vue": "^4.2.3",
33
- "@vitejs/plugin-vue-jsx": "^3.1.0",
34
- "vite": "^4.3.7"
33
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-alpha.3",
34
+ "@vitejs/plugin-vue": "^5.1.2",
35
+ "@vitejs/plugin-vue-jsx": "^4.0.1",
36
+ "vite": "^5.4.2"
35
37
  },
36
38
  "peerDependencies": {
37
39
  "@opentiny/vue": "^3.14.0",
38
40
  "vue": "^3.4.15"
39
41
  },
40
- "gitHead": "695ecd00f21aa39965a9ddb02590ae274f92cd8e"
42
+ "gitHead": "20aba1ffa81a1633feec954e3146586193c18f22"
41
43
  }