@opentiny/tiny-engine-toolbar-save 2.5.0-alpha.4 → 2.5.0-alpha.6
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 +29 -29
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -21,9 +21,9 @@ const V = {
|
|
|
21
21
|
originalCode: "",
|
|
22
22
|
disabled: !1
|
|
23
23
|
}), b = h(!1), te = async (a) => {
|
|
24
|
-
var
|
|
24
|
+
var i;
|
|
25
25
|
const e = W(X.BlockManage), { getCurrentBlock: o } = Z(), t = o();
|
|
26
|
-
t.label = a.fileName, t.content = a, b.value = !0, t.screenshot = await e.getBlockBase64(), await ((
|
|
26
|
+
t.label = a.fileName, t.content = a, b.value = !0, t.screenshot = await e.getBlockBase64(), await ((i = e.saveBlock) == null ? void 0 : i.call(e, t)), b.value = !1;
|
|
27
27
|
}, oe = async (a) => {
|
|
28
28
|
const { currentPage: e } = B().pageState, o = {
|
|
29
29
|
page_content: a
|
|
@@ -35,19 +35,19 @@ const V = {
|
|
|
35
35
|
};
|
|
36
36
|
await ee(t), b.value = !1;
|
|
37
37
|
}, T = (a) => {
|
|
38
|
-
const { pageSettingState: e, isTemporaryPage: o } = Q(), { isBlock: t, canvasApi:
|
|
39
|
-
if (t() ? r({ ...
|
|
38
|
+
const { pageSettingState: e, isTemporaryPage: o } = Q(), { isBlock: t, canvasApi: i, pageState: c, resetBlockCanvasState: r, resetPageCanvasState: l } = B(), n = JSON.parse(a), { clearSelect: s } = i.value;
|
|
39
|
+
if (t() ? r({ ...c, pageSchema: n }) : l({ ...c, pageSchema: n }), e != null && e.isAIPage) {
|
|
40
40
|
o.saved && (o.saved = !1), o.saved = !0;
|
|
41
41
|
const p = "page_content";
|
|
42
42
|
return e.currentPageData[p] = n, Promise.resolve();
|
|
43
43
|
}
|
|
44
|
-
return
|
|
44
|
+
return s == null || s(), t() ? te(n) : oe(n);
|
|
45
45
|
}, F = async () => {
|
|
46
46
|
var p;
|
|
47
47
|
const { isSaved: a, getSchema: e } = B();
|
|
48
48
|
if (a() || _.disabled)
|
|
49
49
|
return;
|
|
50
|
-
const { beforeSave: o, saveMethod: t, saved:
|
|
50
|
+
const { beforeSave: o, saveMethod: t, saved: i } = H(V.id);
|
|
51
51
|
try {
|
|
52
52
|
if (typeof o == "function" && await o(), typeof t == "function" && await t())
|
|
53
53
|
return;
|
|
@@ -57,11 +57,11 @@ const V = {
|
|
|
57
57
|
message: `Error in saving: ${d}`
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const c = (p = K().layoutState) == null ? void 0 : p.pageStatus, r = c == null ? void 0 : c.state, l = c == null ? void 0 : c.data, n = {
|
|
61
61
|
[g.Release]: "当前页面未锁定,请先锁定再保存",
|
|
62
62
|
[g.Empty]: "当前应用无页面,请先新建页面再保存",
|
|
63
63
|
[g.Guest]: "官网演示应用不能保存页面,如需体验请切换应用",
|
|
64
|
-
[g.Lock]: `当前页面被 ${
|
|
64
|
+
[g.Lock]: `当前页面被 ${l == null ? void 0 : l.username} ${l == null ? void 0 : l.resetPasswordToken} 锁定,如需编辑请先联系他解锁文件,然后再锁定该页面后编辑!`
|
|
65
65
|
};
|
|
66
66
|
if ([g.Release, g.Empty, g.Guest, g.Lock].includes(r)) {
|
|
67
67
|
D({
|
|
@@ -72,11 +72,11 @@ const V = {
|
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
_.disabled = !0;
|
|
75
|
-
const
|
|
76
|
-
_.code = JSON.stringify(
|
|
77
|
-
if (_.disabled = !1, typeof
|
|
75
|
+
const s = e();
|
|
76
|
+
_.code = JSON.stringify(s || {}, null, 2), T(_.code).finally(() => {
|
|
77
|
+
if (_.disabled = !1, typeof i == "function")
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
i();
|
|
80
80
|
} catch (d) {
|
|
81
81
|
D({
|
|
82
82
|
type: "error",
|
|
@@ -132,35 +132,35 @@ const V = {
|
|
|
132
132
|
checked: !1,
|
|
133
133
|
timeValue: 5,
|
|
134
134
|
preservationTime: null
|
|
135
|
-
}), o = h(null), { isSaved: t, setSaved:
|
|
135
|
+
}), o = h(null), { isSaved: t, setSaved: i, getSchema: c } = B(), { subscribe: r, unsubscribe: l } = $(), n = "toolbar-save", s = h(null);
|
|
136
136
|
A(() => {
|
|
137
137
|
r({
|
|
138
138
|
topic: "pageOrBlockInit",
|
|
139
139
|
subscriber: n,
|
|
140
140
|
callback: (y) => {
|
|
141
|
-
|
|
141
|
+
s.value = JSON.stringify(y), i(!0);
|
|
142
142
|
}
|
|
143
143
|
}), r({
|
|
144
144
|
topic: "schemaChange",
|
|
145
145
|
subscriber: n,
|
|
146
146
|
callback: () => {
|
|
147
|
-
if (
|
|
148
|
-
const y = JSON.stringify(
|
|
149
|
-
|
|
147
|
+
if (s.value) {
|
|
148
|
+
const y = JSON.stringify(c()) === s.value;
|
|
149
|
+
i(y);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}), r({
|
|
153
153
|
topic: "schemaImport",
|
|
154
154
|
subscriber: n,
|
|
155
155
|
callback: () => {
|
|
156
|
-
if (
|
|
157
|
-
const y = JSON.stringify(
|
|
158
|
-
|
|
156
|
+
if (s.value) {
|
|
157
|
+
const y = JSON.stringify(c()) === s.value;
|
|
158
|
+
i(y);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
162
|
}), O(() => {
|
|
163
|
-
|
|
163
|
+
l({ topic: "pageOrBlockInit", subscriber: n }), l({ topic: "schemaChange", subscriber: n }), l({ topic: "schemaImport", subscriber: n });
|
|
164
164
|
});
|
|
165
165
|
const p = () => {
|
|
166
166
|
e.visible = !1, e.originalCode = "";
|
|
@@ -201,12 +201,12 @@ const V = {
|
|
|
201
201
|
}
|
|
202
202
|
}, ce = (a, e) => {
|
|
203
203
|
const o = a.__vccOpts || a;
|
|
204
|
-
for (const [t,
|
|
205
|
-
o[t] =
|
|
204
|
+
for (const [t, i] of e)
|
|
205
|
+
o[t] = i;
|
|
206
206
|
return o;
|
|
207
207
|
}, re = { class: "toolbar-save" }, ue = { class: "save-style" }, de = { class: "save-time" }, me = { class: "save-button-group" };
|
|
208
|
-
function ve(a, e, o, t,
|
|
209
|
-
const r = f("svg-icon"),
|
|
208
|
+
function ve(a, e, o, t, i, c) {
|
|
209
|
+
const r = f("svg-icon"), l = f("tiny-checkbox"), n = f("tiny-select"), s = f("tiny-button"), p = f("tiny-popover"), d = f("vue-monaco"), C = f("tiny-dialog-box"), E = f("toolbar-base");
|
|
210
210
|
return P(), J("div", re, [
|
|
211
211
|
v(E, {
|
|
212
212
|
content: t.isLoading ? "保存中" : "保存",
|
|
@@ -227,7 +227,7 @@ function ve(a, e, o, t, s, l) {
|
|
|
227
227
|
default: u(() => [
|
|
228
228
|
k("div", ue, [
|
|
229
229
|
e[6] || (e[6] = k("div", { class: "save-setting" }, "保存设置", -1)),
|
|
230
|
-
v(
|
|
230
|
+
v(l, {
|
|
231
231
|
modelValue: t.state.checked,
|
|
232
232
|
"onUpdate:modelValue": e[0] || (e[0] = (m) => t.state.checked = m),
|
|
233
233
|
name: "tiny-checkbox"
|
|
@@ -248,7 +248,7 @@ function ve(a, e, o, t, s, l) {
|
|
|
248
248
|
}, null, 8, ["modelValue", "options", "disabled"])
|
|
249
249
|
]),
|
|
250
250
|
k("div", me, [
|
|
251
|
-
v(
|
|
251
|
+
v(s, {
|
|
252
252
|
type: "primary",
|
|
253
253
|
onClick: t.saveConfig
|
|
254
254
|
}, {
|
|
@@ -274,13 +274,13 @@ function ve(a, e, o, t, s, l) {
|
|
|
274
274
|
"onUpdate:visible": e[2] || (e[2] = (m) => t.state.visible = m)
|
|
275
275
|
}, {
|
|
276
276
|
footer: u(() => [
|
|
277
|
-
v(
|
|
277
|
+
v(s, { onClick: t.close }, {
|
|
278
278
|
default: u(() => e[7] || (e[7] = [
|
|
279
279
|
S("取 消")
|
|
280
280
|
])),
|
|
281
281
|
_: 1
|
|
282
282
|
}, 8, ["onClick"]),
|
|
283
|
-
v(
|
|
283
|
+
v(s, {
|
|
284
284
|
type: "primary",
|
|
285
285
|
onClick: t.saveApi
|
|
286
286
|
}, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-engine-toolbar-save",
|
|
3
|
-
"version": "2.5.0-alpha.
|
|
3
|
+
"version": "2.5.0-alpha.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"homepage": "https://opentiny.design/tiny-engine",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@opentiny/tiny-engine-common": "2.5.0-alpha.
|
|
29
|
-
"@opentiny/tiny-engine-meta-register": "2.5.0-alpha.
|
|
30
|
-
"@opentiny/tiny-engine-utils": "2.5.0-alpha.
|
|
28
|
+
"@opentiny/tiny-engine-common": "2.5.0-alpha.6",
|
|
29
|
+
"@opentiny/tiny-engine-meta-register": "2.5.0-alpha.6",
|
|
30
|
+
"@opentiny/tiny-engine-utils": "2.5.0-alpha.6"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.
|
|
33
|
+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.6",
|
|
34
34
|
"@vitejs/plugin-vue": "^5.1.2",
|
|
35
35
|
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
|
36
36
|
"vite": "^5.4.2"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"@opentiny/vue": "^3.20.0",
|
|
40
40
|
"vue": "^3.4.15"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "c9f5d8bfe427807cd0ef141a56b2e9c5183b0a20"
|
|
43
43
|
}
|