@opentiny/tiny-engine-toolbar-save 1.0.2 → 1.0.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 CHANGED
@@ -1,37 +1,37 @@
1
1
  import "./style.css";
2
- import { reactive as C, ref as B, onBeforeMount as E, resolveComponent as l, openBlock as y, createElementBlock as L, Fragment as w, createVNode as r, withCtx as d, createElementVNode as b, normalizeClass as M, withDirectives as O, vShow as G, createTextVNode as k, createBlock as V, createCommentVNode as D } from "vue";
3
- import { VueMonaco as R } from "@opentiny/tiny-engine-common";
4
- import { Button as U, Popover as z, DialogBox as J } from "@opentiny/vue";
5
- import { useCanvas as P, useLayout as S, useBlock as j, usePage as F, useNotify as I } from "@opentiny/tiny-engine-controller";
6
- import { theme as q } from "@opentiny/tiny-engine-controller/adapter";
7
- import { setSchema as H, selectNode as K, getSchema as Q } from "@opentiny/tiny-engine-canvas";
8
- import { constants as W } from "@opentiny/tiny-engine-utils";
9
- import { handlePageUpdate as X } from "@opentiny/tiny-engine-common/js/http";
10
- const { pageState: h, isSaved: Y, isBlock: Z } = P(), { PLUGIN_NAME: $, getPluginApi: ee } = S(), { getCurrentBlock: oe } = j(), { PAGE_STATUS: a } = W, { pageSettingState: u, isTemporaryPage: _ } = F(), m = C({
2
+ import { reactive as C, ref as B, onBeforeMount as E, resolveComponent as r, openBlock as y, createElementBlock as L, Fragment as w, createVNode as l, withCtx as d, createElementVNode as b, withDirectives as M, vShow as O, createTextVNode as k, createBlock as G, createCommentVNode as V } from "vue";
3
+ import { VueMonaco as D } from "@opentiny/tiny-engine-common";
4
+ import { Button as R, Popover as U, DialogBox as J } from "@opentiny/vue";
5
+ import { useCanvas as P, useLayout as S, useBlock as j, usePage as z, useNotify as F } from "@opentiny/tiny-engine-controller";
6
+ import { theme as I } from "@opentiny/tiny-engine-controller/adapter";
7
+ import { setSchema as q, selectNode as H, getSchema as K } from "@opentiny/tiny-engine-canvas";
8
+ import { constants as Q } from "@opentiny/tiny-engine-utils";
9
+ import { handlePageUpdate as W } from "@opentiny/tiny-engine-common/js/http";
10
+ const { pageState: h, isSaved: X, isBlock: Y } = P(), { PLUGIN_NAME: Z, getPluginApi: $ } = S(), { getCurrentBlock: ee } = j(), { PAGE_STATUS: a } = Q, { pageSettingState: u, isTemporaryPage: _ } = z(), m = C({
11
11
  visible: !1,
12
12
  code: "",
13
13
  originalCode: "",
14
14
  disabled: !1
15
- }), i = B(!1), te = async (n) => {
15
+ }), i = B(!1), oe = async (n) => {
16
16
  var t;
17
- const e = ee($.BlockManage), o = oe();
17
+ const e = $(Z.BlockManage), o = ee();
18
18
  o.label = n.fileName, o.content = n, i.value = !0, o.screenshot = await e.getBlockBase64(), await ((t = e.saveBlock) == null ? void 0 : t.call(e, o)), i.value = !1;
19
- }, ne = async (n) => {
19
+ }, te = async (n) => {
20
20
  const { currentPage: e } = h, o = {
21
21
  page_content: n
22
22
  };
23
- i.value = !0, await X(e.id, { ...e, ...o }), i.value = !1;
23
+ i.value = !0, await W(e.id, { ...e, ...o }), i.value = !1;
24
24
  }, f = (n) => {
25
25
  const e = JSON.parse(n);
26
- if (h.pageSchema = e, H(e), u != null && u.isAIPage) {
26
+ if (h.pageSchema = e, q(e), u != null && u.isAIPage) {
27
27
  _.saved && (_.saved = !1), _.saved = !0;
28
28
  const o = "page_content";
29
29
  return u.currentPageData[o] = e, Promise.resolve();
30
30
  }
31
- return K(null), Z() ? te(e) : ne(e);
31
+ return H(null), Y() ? oe(e) : te(e);
32
32
  }, x = async () => {
33
33
  var c;
34
- if (Y() || m.disabled)
34
+ if (X() || m.disabled)
35
35
  return;
36
36
  const n = (c = S().layoutState) == null ? void 0 : c.pageStatus, e = n == null ? void 0 : n.state, o = n == null ? void 0 : n.data, t = {
37
37
  [a.Release]: "当前页面未锁定,请先锁定再保存",
@@ -40,7 +40,7 @@ const { pageState: h, isSaved: Y, isBlock: Z } = P(), { PLUGIN_NAME: $, getPlugi
40
40
  [a.Lock]: `当前页面被 ${o == null ? void 0 : o.username} ${o == null ? void 0 : o.resetPasswordToken} 锁定,如需编辑请先联系他解锁文件,然后再锁定该页面后编辑!`
41
41
  };
42
42
  if ([a.Release, a.Empty, a.Guest, a.Lock].includes(e)) {
43
- I({
43
+ F({
44
44
  type: "error",
45
45
  title: "保存失败",
46
46
  message: t[e]
@@ -48,24 +48,24 @@ const { pageState: h, isSaved: Y, isBlock: Z } = P(), { PLUGIN_NAME: $, getPlugi
48
48
  return;
49
49
  }
50
50
  m.disabled = !0;
51
- const s = Q();
51
+ const s = K();
52
52
  m.code = JSON.stringify(s || {}, null, 2), f(m.code).finally(() => {
53
53
  m.disabled = !1;
54
54
  });
55
55
  };
56
- const ae = (n, e) => {
56
+ const ne = (n, e) => {
57
57
  const o = n.__vccOpts || n;
58
58
  for (const [t, s] of e)
59
59
  o[t] = s;
60
60
  return o;
61
- }, se = {
61
+ }, ae = {
62
62
  saveCommon: f,
63
63
  openCommon: x
64
- }, ie = {
64
+ }, se = {
65
65
  components: {
66
- VueMonaco: R,
67
- TinyButton: U,
68
- TinyPopover: z,
66
+ VueMonaco: D,
67
+ TinyButton: R,
68
+ TinyPopover: U,
69
69
  TinyDialogBox: J
70
70
  },
71
71
  props: {
@@ -88,7 +88,7 @@ const ae = (n, e) => {
88
88
  }, c = () => {
89
89
  f();
90
90
  }, p = {
91
- theme: q(),
91
+ theme: I(),
92
92
  tabSize: 2,
93
93
  language: "json",
94
94
  autoIndent: !0,
@@ -113,11 +113,11 @@ const ae = (n, e) => {
113
113
  saveApi: c
114
114
  };
115
115
  }
116
- }, ce = { class: "dots" };
117
- function le(n, e, o, t, s, c) {
118
- const p = l("svg-icon"), N = l("tiny-popover"), A = l("vue-monaco"), g = l("tiny-button"), T = l("tiny-dialog-box");
116
+ }, ie = ["id"], ce = { class: "dots" };
117
+ function re(n, e, o, t, s, c) {
118
+ const p = r("svg-icon"), N = r("tiny-popover"), A = r("vue-monaco"), g = r("tiny-button"), T = r("tiny-dialog-box");
119
119
  return y(), L(w, null, [
120
- r(N, {
120
+ l(N, {
121
121
  trigger: "hover",
122
122
  "open-delay": 1e3,
123
123
  "popper-class": "toolbar-right-popover",
@@ -126,18 +126,19 @@ function le(n, e, o, t, s, c) {
126
126
  }, {
127
127
  reference: d(() => [
128
128
  b("span", {
129
- class: M([t.isLoading ? "saving" : "icon"]),
129
+ id: `${t.isLoading ? "saving" : ""}`,
130
+ class: "icon",
130
131
  onClick: e[0] || (e[0] = (...v) => t.openApi && t.openApi(...v))
131
132
  }, [
132
- O(b("span", ce, null, 512), [
133
- [G, !t.isSaved()]
133
+ M(b("span", ce, null, 512), [
134
+ [O, !t.isSaved()]
134
135
  ]),
135
- r(p, { name: o.icon }, null, 8, ["name"])
136
- ], 2)
136
+ l(p, { name: o.icon }, null, 8, ["name"])
137
+ ], 8, ie)
137
138
  ]),
138
139
  _: 1
139
140
  }, 8, ["content"]),
140
- r(T, {
141
+ l(T, {
141
142
  class: "dialog-box",
142
143
  modal: !1,
143
144
  fullscreen: !0,
@@ -147,13 +148,13 @@ function le(n, e, o, t, s, c) {
147
148
  "onUpdate:visible": e[1] || (e[1] = (v) => t.state.visible = v)
148
149
  }, {
149
150
  footer: d(() => [
150
- r(g, { onClick: t.close }, {
151
+ l(g, { onClick: t.close }, {
151
152
  default: d(() => [
152
153
  k("取 消")
153
154
  ]),
154
155
  _: 1
155
156
  }, 8, ["onClick"]),
156
- r(g, {
157
+ l(g, {
157
158
  type: "primary",
158
159
  onClick: t.saveApi
159
160
  }, {
@@ -164,7 +165,7 @@ function le(n, e, o, t, s, c) {
164
165
  }, 8, ["onClick"])
165
166
  ]),
166
167
  default: d(() => [
167
- t.state.visible ? (y(), V(A, {
168
+ t.state.visible ? (y(), G(A, {
168
169
  key: 0,
169
170
  ref: "editor",
170
171
  class: "monaco-editor",
@@ -172,19 +173,19 @@ function le(n, e, o, t, s, c) {
172
173
  options: t.editorOptions,
173
174
  value: t.state.code,
174
175
  original: t.state.originalCode
175
- }, null, 8, ["options", "value", "original"])) : D("", !0)
176
+ }, null, 8, ["options", "value", "original"])) : V("", !0)
176
177
  ]),
177
178
  _: 1
178
179
  }, 8, ["visible"])
179
180
  ], 64);
180
181
  }
181
- const re = /* @__PURE__ */ ae(ie, [["render", le], ["__scopeId", "data-v-6d9e48c8"]]), be = {
182
+ const le = /* @__PURE__ */ ne(se, [["render", re], ["__scopeId", "data-v-a55d2356"]]), be = {
182
183
  id: "save",
183
184
  title: "save",
184
185
  icon: "",
185
186
  align: "right",
186
- component: re,
187
- api: se
187
+ component: le,
188
+ api: ae
188
189
  };
189
190
  export {
190
191
  be as default
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .dots[data-v-6d9e48c8]{width:6px;height:6px;background:var(--ti-lowcode-toolbar-dot-color);border-radius:50%;display:inline-block;position:absolute;top:4px;right:3px;z-index:100}.saving[data-v-6d9e48c8]{width:32px;height:32px;display:inline-block;cursor:not-allowed;color:var(--ti-lowcode-disabled-color);font-size:20px;margin-bottom:-2px}.dialog-box[data-v-6d9e48c8] .tiny-dialog-box{display:flex;flex-direction:column}.dialog-box[data-v-6d9e48c8] .tiny-dialog-box .tiny-dialog-box__body{flex:1}.dialog-box .monaco-editor[data-v-6d9e48c8]{width:100%;height:100%}.changeRole a{color:var(--ti-lowcode-canvas-handle-hover-bg);padding:0 5px}
1
+ .dots[data-v-a55d2356]{width:6px;height:6px;background:var(--ti-lowcode-toolbar-dot-color);border-radius:50%;display:inline-block;position:absolute;top:4px;right:3px;z-index:100}#saving[data-v-a55d2356]{cursor:not-allowed;color:var(--ti-lowcode-disabled-color)}#saving[data-v-a55d2356] svg{color:var(--ti-lowcode-disabled-color)}.dialog-box[data-v-a55d2356] .tiny-dialog-box{display:flex;flex-direction:column}.dialog-box[data-v-a55d2356] .tiny-dialog-box .tiny-dialog-box__body{flex:1}.dialog-box .monaco-editor[data-v-a55d2356]{width:100%;height:100%}.changeRole a{color:var(--ti-lowcode-canvas-handle-hover-bg);padding:0 5px}
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-save",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
+ "scripts": {
8
+ "build": "vite build"
9
+ },
7
10
  "main": "dist/index.js",
8
11
  "module": "dist/index.js",
9
12
  "files": [
@@ -21,19 +24,19 @@
21
24
  "license": "MIT",
22
25
  "homepage": "https://opentiny.design/tiny-engine",
23
26
  "dependencies": {
24
- "@opentiny/vue": "~3.10.0",
25
- "vue": "3.2.45",
26
- "@opentiny/tiny-engine-canvas": "1.0.2",
27
- "@opentiny/tiny-engine-common": "1.0.1",
28
- "@opentiny/tiny-engine-controller": "1.0.2",
29
- "@opentiny/tiny-engine-utils": "1.0.3"
27
+ "@opentiny/tiny-engine-canvas": "1.0.3",
28
+ "@opentiny/tiny-engine-common": "1.0.2",
29
+ "@opentiny/tiny-engine-controller": "1.0.3",
30
+ "@opentiny/tiny-engine-utils": "1.0.4",
31
+ "@opentiny/vue": "~3.10.0"
30
32
  },
31
33
  "devDependencies": {
32
34
  "@vitejs/plugin-vue": "^4.2.3",
33
35
  "@vitejs/plugin-vue-jsx": "^1.3.10",
34
36
  "vite": "^4.3.7"
35
37
  },
36
- "scripts": {
37
- "build": "vite build"
38
- }
39
- }
38
+ "peerDependencies": {
39
+ "vue": "^3.4.15"
40
+ },
41
+ "gitHead": "9a6cce3988accb39c97a9a21169c022c65a8e27f"
42
+ }