@opentiny/tiny-engine-toolbar-setting 1.0.1 → 1.0.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 (3) hide show
  1. package/LICENSE +22 -0
  2. package/dist/index.js +47 -33
  3. package/package.json +37 -24
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 - present TinyEngine Authors.
4
+ Copyright (c) 2023 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
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";
1
+ import { Popover as y } from "@opentiny/vue";
2
+ import { useCanvas as S, useBlock as k, usePage as B, useLayout as h, useModal as C, useNotify as x } from "@opentiny/tiny-engine-controller";
3
+ 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 M, createElementVNode as b } from "vue";
5
5
  const {
6
- PAGE_STATUS: N
7
- } = C, b = {
6
+ PAGE_STATUS: w
7
+ } = A, I = {
8
8
  components: {
9
- TinyPopover: v
9
+ TinyPopover: y
10
10
  },
11
11
  props: {
12
12
  icon: {
@@ -17,20 +17,21 @@ const {
17
17
  setup() {
18
18
  const {
19
19
  pageState: a,
20
- isBlock: t
20
+ isBlock: e
21
21
  } = S(), {
22
22
  getCurrentBlock: o
23
23
  } = k(), {
24
- initCurrentPageData: e,
24
+ initCurrentPageData: t,
25
25
  isChangePageData: c
26
- } = y(), {
26
+ } = B(), {
27
27
  PLUGIN_NAME: p,
28
28
  activePlugin: r,
29
- layoutState: g
30
- } = B(), {
31
- confirm: l,
29
+ layoutState: g,
30
+ isEmptyPage: l
31
+ } = h(), {
32
+ confirm: f,
32
33
  message: _
33
- } = h(), f = () => {
34
+ } = C(), P = () => {
34
35
  r(p.BlockManage).then((n) => {
35
36
  n.openSettingPanel({
36
37
  item: o()
@@ -42,13 +43,13 @@ const {
42
43
  } = a;
43
44
  n.openPageSettingPanel();
44
45
  const s = await n.getPageById(i.id);
45
- e(s);
46
- }, P = () => {
46
+ t(s);
47
+ }, v = () => {
47
48
  var i;
48
49
  const {
49
50
  pageStatus: n
50
51
  } = g;
51
- if (n.state === N.Lock) {
52
+ if (n.state === w.Lock) {
52
53
  const s = ((i = n.data) == null ? void 0 : i.username) || "";
53
54
  _({
54
55
  message: `您点击的页面被${s}锁定,暂时无法编辑,请联系解锁`,
@@ -58,7 +59,7 @@ const {
58
59
  }
59
60
  r(p.AppManage).then((s) => {
60
61
  if (c()) {
61
- l({
62
+ f({
62
63
  title: "提示",
63
64
  message: "当前页面尚未保存,是否要继续切换?",
64
65
  exec: () => {
@@ -71,30 +72,43 @@ const {
71
72
  });
72
73
  };
73
74
  return {
74
- openSetting: () => t() ? f() : P(),
75
- isBlock: t
75
+ openSetting: () => {
76
+ if (l()) {
77
+ x({
78
+ type: "warning",
79
+ message: "请先创建页面"
80
+ });
81
+ return;
82
+ }
83
+ if (e()) {
84
+ P();
85
+ return;
86
+ }
87
+ v();
88
+ },
89
+ isBlock: e
76
90
  };
77
91
  }
78
- }, I = (a, t) => {
92
+ }, L = (a, e) => {
79
93
  const o = a.__vccOpts || a;
80
- for (const [e, c] of t)
81
- o[e] = c;
94
+ for (const [t, c] of e)
95
+ o[t] = c;
82
96
  return o;
83
- }, L = { class: "toolbar-itm-clean" };
84
- function T(a, t, o, e, c, p) {
97
+ }, T = { class: "toolbar-itm-clean" };
98
+ function D(a, e, o, t, c, p) {
85
99
  const r = u("svg-icon"), g = u("tiny-popover");
86
- return x(), A("div", L, [
100
+ return E(), N("div", T, [
87
101
  d(g, {
88
102
  trigger: "hover",
89
103
  "open-delay": 1e3,
90
104
  "popper-class": "toolbar-right-popover",
91
105
  "append-to-body": "",
92
- content: e.isBlock() ? "区块设置" : "页面设置"
106
+ content: t.isBlock() ? "区块设置" : "页面设置"
93
107
  }, {
94
- reference: E(() => [
95
- M("span", {
108
+ reference: M(() => [
109
+ b("span", {
96
110
  class: "icon",
97
- onClick: t[0] || (t[0] = (...l) => e.openSetting && e.openSetting(...l))
111
+ onClick: e[0] || (e[0] = (...l) => t.openSetting && t.openSetting(...l))
98
112
  }, [
99
113
  d(r, { name: o.icon }, null, 8, ["name"])
100
114
  ])
@@ -103,13 +117,13 @@ function T(a, t, o, e, c, p) {
103
117
  }, 8, ["content"])
104
118
  ]);
105
119
  }
106
- const w = /* @__PURE__ */ I(b, [["render", T]]), $ = {
120
+ const G = /* @__PURE__ */ L(I, [["render", D]]), q = {
107
121
  id: "setting",
108
122
  title: "setting",
109
123
  icon: "",
110
124
  align: "right",
111
- component: w
125
+ component: G
112
126
  };
113
127
  export {
114
- $ as default
128
+ q as default
115
129
  };
package/package.json CHANGED
@@ -1,24 +1,37 @@
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
- }
1
+ {
2
+ "name": "@opentiny/tiny-engine-toolbar-setting",
3
+ "version": "1.0.2",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/opentiny/tiny-engine",
15
+ "directory": "packages/toolbars/setting"
16
+ },
17
+ "bugs": {
18
+ "url": "https://github.com/opentiny/tiny-engine/issues"
19
+ },
20
+ "author": "OpenTiny Team",
21
+ "license": "MIT",
22
+ "homepage": "https://opentiny.design/tiny-engine",
23
+ "dependencies": {
24
+ "@opentiny/vue": "~3.10.0",
25
+ "vue": "3.2.45",
26
+ "@opentiny/tiny-engine-controller": "1.0.2",
27
+ "@opentiny/tiny-engine-utils": "1.0.3"
28
+ },
29
+ "devDependencies": {
30
+ "@vitejs/plugin-vue": "^4.2.3",
31
+ "@vitejs/plugin-vue-jsx": "^1.3.10",
32
+ "vite": "^4.3.7"
33
+ },
34
+ "scripts": {
35
+ "build": "vite build"
36
+ }
37
+ }