@opentiny/tiny-engine-toolbar-save 2.4.0 → 2.5.0-alpha.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.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import "./style.css";
2
- import { reactive as x, ref as h, onMounted as A, onUnmounted as O, resolveComponent as f, createElementBlock as J, openBlock as P, createVNode as v, withCtx as u, createBlock as L, createCommentVNode as U, createTextVNode as S, createElementVNode as k } from "vue";
3
- import { ToolbarBase as I, VueMonaco as G } from "@opentiny/tiny-engine-common";
4
- import { Select as R, Checkbox as j, DialogBox as Y, Popover as q, Button as z } from "@opentiny/vue";
5
- import { useCanvas as B, getOptions as H, useNotify as D, useLayout as K, usePage as Q, getMetaApi as W, META_APP as X, useBlock as Z, useMessage as $ } from "@opentiny/tiny-engine-meta-register";
6
- import { constants as N } from "@opentiny/tiny-engine-utils";
7
- import { handlePageUpdate as ee } from "@opentiny/tiny-engine-common/js/http";
8
- const V = {
2
+ import { callEntry as m, getMetaApi as U, META_APP as J, useBlock as L, getOptions as I, usePage as G, useNotify as w, useLayout as R, useCanvas as v, useMessage as E, useCompile as K } from "@opentiny/tiny-engine-meta-register";
3
+ import { reactive as ee, ref as W, onMounted as X, onUnmounted as Z, resolveComponent as F, createElementBlock as te, openBlock as $, createVNode as V, withCtx as N, createBlock as oe, createCommentVNode as ae, createTextVNode as Q, createElementVNode as H } from "vue";
4
+ import { ToolbarBase as B, VueMonaco as A } from "@opentiny/tiny-engine-common";
5
+ import { Select as ne, Checkbox as se, DialogBox as ie, Popover as le, Button as ce } from "@opentiny/vue";
6
+ import { constants as _ } from "@opentiny/tiny-engine-utils";
7
+ import { handlePageUpdate as j } from "@opentiny/tiny-engine-common/js/http";
8
+ const r = {
9
9
  id: "engine.toolbars.save",
10
10
  type: "toolbars",
11
11
  title: "save",
@@ -15,100 +15,298 @@ const V = {
15
15
  },
16
16
  renderType: "button"
17
17
  }
18
- }, { PAGE_STATUS: g, AUTO_SAVED: w } = N, _ = x({
18
+ }, {
19
+ PAGE_STATUS: P,
20
+ AUTO_SAVED: M
21
+ } = _, O = ee({
19
22
  visible: !1,
20
23
  code: "",
21
24
  originalCode: "",
22
25
  disabled: !1
23
- }), b = h(!1), te = async (a) => {
26
+ }), d = W(!1), Y = m(async (a) => {
24
27
  var s;
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 ((s = e.saveBlock) == null ? void 0 : s.call(e, t)), b.value = !1;
27
- }, oe = async (a) => {
28
- const { currentPage: e } = B().pageState, o = {
28
+ const e = U(J.BlockManage), {
29
+ getCurrentBlock: o
30
+ } = L(), t = o();
31
+ t.label = a.fileName, t.content = a, d.value = !0, t.screenshot = await e.getBlockBase64(), await ((s = e.saveBlock) == null ? void 0 : s.call(e, t)), d.value = !1;
32
+ }, {
33
+ metaData: {
34
+ id: "engine.toolbars.save.saveBlock"
35
+ },
36
+ ctx: () => ({
37
+ useBlock: L,
38
+ useCanvas: v,
39
+ useLayout: R,
40
+ useNotify: w,
41
+ usePage: G,
42
+ getOptions: I,
43
+ getMetaApi: U,
44
+ META_APP: J,
45
+ constants: _,
46
+ handlePageUpdate: j,
47
+ meta: r,
48
+ PAGE_STATUS: P,
49
+ AUTO_SAVED: M,
50
+ state: O,
51
+ isLoading: d,
52
+ saveBlock: Y,
53
+ savePage: q,
54
+ saveCommon: g,
55
+ openCommon: y,
56
+ getAutoSaveStatus: D,
57
+ setAutoSaveStatus: k
58
+ })
59
+ }), q = m(async (a) => {
60
+ const {
61
+ currentPage: e
62
+ } = v().pageState, o = {
29
63
  page_content: a
30
64
  };
31
- b.value = !0;
65
+ d.value = !0;
32
66
  const t = {
33
67
  id: e.id,
34
- params: { ...e, ...o }
68
+ params: {
69
+ ...e,
70
+ ...o
71
+ }
35
72
  };
36
- await ee(t), b.value = !1;
37
- }, T = (a) => {
38
- const { pageSettingState: e, isTemporaryPage: o } = Q(), { isBlock: t, canvasApi: s, pageState: l, resetBlockCanvasState: r, resetPageCanvasState: i } = B(), n = JSON.parse(a), { selectNode: c } = s.value;
39
- if (t() ? r({ ...l, pageSchema: n }) : i({ ...l, pageSchema: n }), e != null && e.isAIPage) {
73
+ await j(t), d.value = !1;
74
+ }, {
75
+ metaData: {
76
+ id: "engine.toolbars.save.savePage"
77
+ },
78
+ ctx: () => ({
79
+ useBlock: L,
80
+ useCanvas: v,
81
+ useLayout: R,
82
+ useNotify: w,
83
+ usePage: G,
84
+ getOptions: I,
85
+ getMetaApi: U,
86
+ META_APP: J,
87
+ constants: _,
88
+ handlePageUpdate: j,
89
+ meta: r,
90
+ PAGE_STATUS: P,
91
+ AUTO_SAVED: M,
92
+ state: O,
93
+ isLoading: d,
94
+ saveBlock: Y,
95
+ savePage: q,
96
+ saveCommon: g,
97
+ openCommon: y,
98
+ getAutoSaveStatus: D,
99
+ setAutoSaveStatus: k
100
+ })
101
+ }), g = m((a) => {
102
+ const {
103
+ pageSettingState: e,
104
+ isTemporaryPage: o
105
+ } = G(), {
106
+ isBlock: t,
107
+ canvasApi: s,
108
+ pageState: l,
109
+ resetBlockCanvasState: u,
110
+ resetPageCanvasState: i
111
+ } = v(), n = JSON.parse(a), {
112
+ selectNode: c
113
+ } = s.value;
114
+ if (t() ? u({
115
+ ...l,
116
+ pageSchema: n
117
+ }) : i({
118
+ ...l,
119
+ pageSchema: n
120
+ }), e != null && e.isAIPage) {
40
121
  o.saved && (o.saved = !1), o.saved = !0;
41
- const p = "page_content";
42
- return e.currentPageData[p] = n, Promise.resolve();
122
+ const b = "page_content";
123
+ return e.currentPageData[b] = n, Promise.resolve();
43
124
  }
44
- return c(null), t() ? te(n) : oe(n);
45
- }, F = async () => {
46
- var p;
47
- const { isSaved: a, getSchema: e } = B();
48
- if (a() || _.disabled)
125
+ return c(null), t() ? Y(n) : q(n);
126
+ }, {
127
+ metaData: {
128
+ id: "engine.toolbars.save.saveCommon"
129
+ },
130
+ ctx: () => ({
131
+ useBlock: L,
132
+ useCanvas: v,
133
+ useLayout: R,
134
+ useNotify: w,
135
+ usePage: G,
136
+ getOptions: I,
137
+ getMetaApi: U,
138
+ META_APP: J,
139
+ constants: _,
140
+ handlePageUpdate: j,
141
+ meta: r,
142
+ PAGE_STATUS: P,
143
+ AUTO_SAVED: M,
144
+ state: O,
145
+ isLoading: d,
146
+ saveBlock: Y,
147
+ savePage: q,
148
+ saveCommon: g,
149
+ openCommon: y,
150
+ getAutoSaveStatus: D,
151
+ setAutoSaveStatus: k
152
+ })
153
+ }), y = m(async () => {
154
+ var b;
155
+ const {
156
+ isSaved: a,
157
+ getSchema: e
158
+ } = v();
159
+ if (a() || O.disabled)
49
160
  return;
50
- const { beforeSave: o, saveMethod: t, saved: s } = H(V.id);
161
+ const {
162
+ beforeSave: o,
163
+ saveMethod: t,
164
+ saved: s
165
+ } = I(r.id);
51
166
  try {
52
167
  if (typeof o == "function" && await o(), typeof t == "function" && await t())
53
168
  return;
54
- } catch (d) {
55
- D({
169
+ } catch (p) {
170
+ w({
56
171
  type: "error",
57
- message: `Error in saving: ${d}`
172
+ message: `Error in saving: ${p}`
58
173
  });
59
174
  }
60
- const l = (p = K().layoutState) == null ? void 0 : p.pageStatus, r = l == null ? void 0 : l.state, i = l == null ? void 0 : l.data, n = {
61
- [g.Release]: "当前页面未锁定,请先锁定再保存",
62
- [g.Empty]: "当前应用无页面,请先新建页面再保存",
63
- [g.Guest]: "官网演示应用不能保存页面,如需体验请切换应用",
64
- [g.Lock]: `当前页面被 ${i == null ? void 0 : i.username} ${i == null ? void 0 : i.resetPasswordToken} 锁定,如需编辑请先联系他解锁文件,然后再锁定该页面后编辑!`
175
+ const l = (b = R().layoutState) == null ? void 0 : b.pageStatus, u = l == null ? void 0 : l.state, i = l == null ? void 0 : l.data, n = {
176
+ [P.Release]: "当前页面未锁定,请先锁定再保存",
177
+ [P.Empty]: "当前应用无页面,请先新建页面再保存",
178
+ [P.Guest]: "官网演示应用不能保存页面,如需体验请切换应用",
179
+ [P.Lock]: `当前页面被 ${i == null ? void 0 : i.username} ${i == null ? void 0 : i.resetPasswordToken} 锁定,如需编辑请先联系他解锁文件,然后再锁定该页面后编辑!`
65
180
  };
66
- if ([g.Release, g.Empty, g.Guest, g.Lock].includes(r)) {
67
- D({
181
+ if ([P.Release, P.Empty, P.Guest, P.Lock].includes(u)) {
182
+ w({
68
183
  type: "error",
69
184
  title: "保存失败",
70
- message: n[r]
185
+ message: n[u]
71
186
  });
72
187
  return;
73
188
  }
74
- _.disabled = !0;
189
+ O.disabled = !0;
75
190
  const c = e();
76
- _.code = JSON.stringify(c || {}, null, 2), T(_.code).finally(() => {
77
- if (_.disabled = !1, typeof s == "function")
191
+ O.code = JSON.stringify(c || {}, null, 2), g(O.code).finally(() => {
192
+ if (O.disabled = !1, typeof s == "function")
78
193
  try {
79
194
  s();
80
- } catch (d) {
81
- D({
195
+ } catch (p) {
196
+ w({
82
197
  type: "error",
83
- message: `Error in saved: ${d}`
198
+ message: `Error in saved: ${p}`
84
199
  });
85
200
  }
86
201
  });
87
- }, ae = () => {
202
+ }, {
203
+ metaData: {
204
+ id: "engine.toolbars.save.openCommon"
205
+ },
206
+ ctx: () => ({
207
+ useBlock: L,
208
+ useCanvas: v,
209
+ useLayout: R,
210
+ useNotify: w,
211
+ usePage: G,
212
+ getOptions: I,
213
+ getMetaApi: U,
214
+ META_APP: J,
215
+ constants: _,
216
+ handlePageUpdate: j,
217
+ meta: r,
218
+ PAGE_STATUS: P,
219
+ AUTO_SAVED: M,
220
+ state: O,
221
+ isLoading: d,
222
+ saveBlock: Y,
223
+ savePage: q,
224
+ saveCommon: g,
225
+ openCommon: y,
226
+ getAutoSaveStatus: D,
227
+ setAutoSaveStatus: k
228
+ })
229
+ }), D = m(() => {
88
230
  try {
89
- const a = localStorage.getItem(w) ?? "";
231
+ const a = localStorage.getItem(M) ?? "";
90
232
  return JSON.parse(a) ?? !1;
91
233
  } catch {
92
234
  return !1;
93
235
  }
94
- }, ne = (a) => {
236
+ }, {
237
+ metaData: {
238
+ id: "engine.toolbars.save.getAutoSaveStatus"
239
+ },
240
+ ctx: () => ({
241
+ useBlock: L,
242
+ useCanvas: v,
243
+ useLayout: R,
244
+ useNotify: w,
245
+ usePage: G,
246
+ getOptions: I,
247
+ getMetaApi: U,
248
+ META_APP: J,
249
+ constants: _,
250
+ handlePageUpdate: j,
251
+ meta: r,
252
+ PAGE_STATUS: P,
253
+ AUTO_SAVED: M,
254
+ state: O,
255
+ isLoading: d,
256
+ saveBlock: Y,
257
+ savePage: q,
258
+ saveCommon: g,
259
+ openCommon: y,
260
+ getAutoSaveStatus: D,
261
+ setAutoSaveStatus: k
262
+ })
263
+ }), k = m((a) => {
95
264
  try {
96
- return localStorage.setItem(w, JSON.stringify(a)), !0;
265
+ return localStorage.setItem(M, JSON.stringify(a)), !0;
97
266
  } catch {
98
267
  return !1;
99
268
  }
100
- }, { OPEN_DELAY: se } = N, ie = {
101
- saveCommon: T,
102
- openCommon: F
103
- }, le = {
269
+ }, {
270
+ metaData: {
271
+ id: "engine.toolbars.save.setAutoSaveStatus"
272
+ },
273
+ ctx: () => ({
274
+ useBlock: L,
275
+ useCanvas: v,
276
+ useLayout: R,
277
+ useNotify: w,
278
+ usePage: G,
279
+ getOptions: I,
280
+ getMetaApi: U,
281
+ META_APP: J,
282
+ constants: _,
283
+ handlePageUpdate: j,
284
+ meta: r,
285
+ PAGE_STATUS: P,
286
+ AUTO_SAVED: M,
287
+ state: O,
288
+ isLoading: d,
289
+ saveBlock: Y,
290
+ savePage: q,
291
+ saveCommon: g,
292
+ openCommon: y,
293
+ getAutoSaveStatus: D,
294
+ setAutoSaveStatus: k
295
+ })
296
+ }), {
297
+ OPEN_DELAY: h
298
+ } = _, T = {
299
+ saveCommon: g,
300
+ openCommon: y
301
+ }, re = {
104
302
  components: {
105
- VueMonaco: G,
106
- TinyButton: z,
107
- TinyPopover: q,
108
- TinyDialogBox: Y,
109
- TinyCheckbox: j,
110
- TinySelect: R,
111
- ToolbarBase: I
303
+ VueMonaco: A,
304
+ TinyButton: ce,
305
+ TinyPopover: le,
306
+ TinyDialogBox: ie,
307
+ TinyCheckbox: se,
308
+ TinySelect: ne,
309
+ ToolbarBase: B
112
310
  },
113
311
  props: {
114
312
  iconExpand: {
@@ -121,139 +319,614 @@ const V = {
121
319
  }
122
320
  },
123
321
  setup() {
124
- const a = [
125
- { value: 5, label: "5分钟" },
126
- { value: 10, label: "10分钟" },
127
- { value: 15, label: "15分钟" }
128
- ], e = x({
322
+ const a = [{
323
+ value: 5,
324
+ label: "5分钟"
325
+ }, {
326
+ value: 10,
327
+ label: "10分钟"
328
+ }, {
329
+ value: 15,
330
+ label: "15分钟"
331
+ }], e = ee({
129
332
  visible: !1,
130
333
  code: "",
131
334
  originalCode: "",
132
335
  checked: !1,
133
336
  timeValue: 5,
134
337
  preservationTime: null
135
- }), o = h(null), { isSaved: t, setSaved: s, getSchema: l } = B(), { subscribe: r, unsubscribe: i } = $(), n = "toolbar-save", c = h(null);
136
- A(() => {
137
- r({
338
+ }), o = W(null), {
339
+ isSaved: t,
340
+ setSaved: s,
341
+ getSchema: l
342
+ } = v(), {
343
+ subscribe: u,
344
+ unsubscribe: i
345
+ } = E(), n = "toolbar-save", c = W(null);
346
+ X(m(m(() => {
347
+ u({
138
348
  topic: "pageOrBlockInit",
139
349
  subscriber: n,
140
- callback: (y) => {
141
- c.value = JSON.stringify(y), s(!0);
350
+ callback: (z) => {
351
+ c.value = JSON.stringify(z), s(!0);
142
352
  }
143
- }), r({
353
+ }), u({
144
354
  topic: "schemaChange",
145
355
  subscriber: n,
146
356
  callback: () => {
147
357
  if (c.value) {
148
- const y = JSON.stringify(l()) === c.value;
149
- s(y);
358
+ const z = JSON.stringify(l()) === c.value;
359
+ s(z);
150
360
  }
151
361
  }
152
- }), r({
362
+ }), u({
153
363
  topic: "schemaImport",
154
364
  subscriber: n,
155
365
  callback: () => {
156
366
  if (c.value) {
157
- const y = JSON.stringify(l()) === c.value;
158
- s(y);
367
+ const z = JSON.stringify(l()) === c.value;
368
+ s(z);
159
369
  }
160
370
  }
161
371
  });
162
- }), O(() => {
163
- i({ topic: "pageOrBlockInit", subscriber: n }), i({ topic: "schemaChange", subscriber: n }), i({ topic: "schemaImport", subscriber: n });
164
- });
165
- const p = () => {
372
+ }, {
373
+ metaData: {
374
+ id: `${r.id}.onMounted[0]`
375
+ },
376
+ ctx: () => ({
377
+ delayOptions: a,
378
+ state: e,
379
+ editor: o,
380
+ isSaved: t,
381
+ setSaved: s,
382
+ getSchema: l,
383
+ subscribe: u,
384
+ unsubscribe: i,
385
+ subscriber: n,
386
+ originSchema: c,
387
+ close: b,
388
+ openApi: p,
389
+ saveApi: C,
390
+ editorOptions: S,
391
+ saveSetTimeout: f,
392
+ saveConfig: x,
393
+ VueMonaco: A,
394
+ useCanvas: v,
395
+ useMessage: E,
396
+ ToolbarBase: B,
397
+ openCommon: y,
398
+ saveCommon: g,
399
+ isLoading: d,
400
+ setAutoSaveStatus: k,
401
+ getAutoSaveStatus: D,
402
+ constants: _,
403
+ OPEN_DELAY: h,
404
+ api: T
405
+ })
406
+ }), {
407
+ metaData: {
408
+ id: `${r.id}.onMounted[0]`
409
+ },
410
+ ctx: () => ({
411
+ delayOptions: a,
412
+ state: e,
413
+ editor: o,
414
+ isSaved: t,
415
+ setSaved: s,
416
+ getSchema: l,
417
+ subscribe: u,
418
+ unsubscribe: i,
419
+ subscriber: n,
420
+ originSchema: c,
421
+ close: b,
422
+ openApi: p,
423
+ saveApi: C,
424
+ editorOptions: S,
425
+ saveSetTimeout: f,
426
+ saveConfig: x,
427
+ _callEntry: m,
428
+ _useCompile: K,
429
+ _metaData: r,
430
+ VueMonaco: A,
431
+ useCanvas: v,
432
+ useMessage: E,
433
+ ToolbarBase: B,
434
+ openCommon: y,
435
+ saveCommon: g,
436
+ isLoading: d,
437
+ setAutoSaveStatus: k,
438
+ getAutoSaveStatus: D,
439
+ constants: _,
440
+ OPEN_DELAY: h,
441
+ api: T
442
+ })
443
+ })), Z(m(m(() => {
444
+ i({
445
+ topic: "pageOrBlockInit",
446
+ subscriber: n
447
+ }), i({
448
+ topic: "schemaChange",
449
+ subscriber: n
450
+ }), i({
451
+ topic: "schemaImport",
452
+ subscriber: n
453
+ });
454
+ }, {
455
+ metaData: {
456
+ id: `${r.id}.onUnmounted[0]`
457
+ },
458
+ ctx: () => ({
459
+ delayOptions: a,
460
+ state: e,
461
+ editor: o,
462
+ isSaved: t,
463
+ setSaved: s,
464
+ getSchema: l,
465
+ subscribe: u,
466
+ unsubscribe: i,
467
+ subscriber: n,
468
+ originSchema: c,
469
+ close: b,
470
+ openApi: p,
471
+ saveApi: C,
472
+ editorOptions: S,
473
+ saveSetTimeout: f,
474
+ saveConfig: x,
475
+ VueMonaco: A,
476
+ useCanvas: v,
477
+ useMessage: E,
478
+ ToolbarBase: B,
479
+ openCommon: y,
480
+ saveCommon: g,
481
+ isLoading: d,
482
+ setAutoSaveStatus: k,
483
+ getAutoSaveStatus: D,
484
+ constants: _,
485
+ OPEN_DELAY: h,
486
+ api: T
487
+ })
488
+ }), {
489
+ metaData: {
490
+ id: `${r.id}.onUnmounted[0]`
491
+ },
492
+ ctx: () => ({
493
+ delayOptions: a,
494
+ state: e,
495
+ editor: o,
496
+ isSaved: t,
497
+ setSaved: s,
498
+ getSchema: l,
499
+ subscribe: u,
500
+ unsubscribe: i,
501
+ subscriber: n,
502
+ originSchema: c,
503
+ close: b,
504
+ openApi: p,
505
+ saveApi: C,
506
+ editorOptions: S,
507
+ saveSetTimeout: f,
508
+ saveConfig: x,
509
+ _callEntry: m,
510
+ _useCompile: K,
511
+ _metaData: r,
512
+ VueMonaco: A,
513
+ useCanvas: v,
514
+ useMessage: E,
515
+ ToolbarBase: B,
516
+ openCommon: y,
517
+ saveCommon: g,
518
+ isLoading: d,
519
+ setAutoSaveStatus: k,
520
+ getAutoSaveStatus: D,
521
+ constants: _,
522
+ OPEN_DELAY: h,
523
+ api: T
524
+ })
525
+ }));
526
+ const b = m(() => {
166
527
  e.visible = !1, e.originalCode = "";
167
- }, d = () => {
168
- b.value || F();
169
- }, C = () => {
170
- T();
171
- }, E = {
528
+ }, {
529
+ metaData: {
530
+ id: `${r.id}.close`
531
+ },
532
+ ctx: () => ({
533
+ delayOptions: a,
534
+ state: e,
535
+ editor: o,
536
+ isSaved: t,
537
+ setSaved: s,
538
+ getSchema: l,
539
+ subscribe: u,
540
+ unsubscribe: i,
541
+ subscriber: n,
542
+ originSchema: c,
543
+ close: b,
544
+ openApi: p,
545
+ saveApi: C,
546
+ editorOptions: S,
547
+ saveSetTimeout: f,
548
+ saveConfig: x,
549
+ VueMonaco: A,
550
+ useCanvas: v,
551
+ useMessage: E,
552
+ ToolbarBase: B,
553
+ openCommon: y,
554
+ saveCommon: g,
555
+ isLoading: d,
556
+ setAutoSaveStatus: k,
557
+ getAutoSaveStatus: D,
558
+ constants: _,
559
+ OPEN_DELAY: h,
560
+ api: T
561
+ })
562
+ }), p = m(() => {
563
+ d.value || y();
564
+ }, {
565
+ metaData: {
566
+ id: `${r.id}.openApi`
567
+ },
568
+ ctx: () => ({
569
+ delayOptions: a,
570
+ state: e,
571
+ editor: o,
572
+ isSaved: t,
573
+ setSaved: s,
574
+ getSchema: l,
575
+ subscribe: u,
576
+ unsubscribe: i,
577
+ subscriber: n,
578
+ originSchema: c,
579
+ close: b,
580
+ openApi: p,
581
+ saveApi: C,
582
+ editorOptions: S,
583
+ saveSetTimeout: f,
584
+ saveConfig: x,
585
+ VueMonaco: A,
586
+ useCanvas: v,
587
+ useMessage: E,
588
+ ToolbarBase: B,
589
+ openCommon: y,
590
+ saveCommon: g,
591
+ isLoading: d,
592
+ setAutoSaveStatus: k,
593
+ getAutoSaveStatus: D,
594
+ constants: _,
595
+ OPEN_DELAY: h,
596
+ api: T
597
+ })
598
+ }), C = m(() => {
599
+ g();
600
+ }, {
601
+ metaData: {
602
+ id: `${r.id}.saveApi`
603
+ },
604
+ ctx: () => ({
605
+ delayOptions: a,
606
+ state: e,
607
+ editor: o,
608
+ isSaved: t,
609
+ setSaved: s,
610
+ getSchema: l,
611
+ subscribe: u,
612
+ unsubscribe: i,
613
+ subscriber: n,
614
+ originSchema: c,
615
+ close: b,
616
+ openApi: p,
617
+ saveApi: C,
618
+ editorOptions: S,
619
+ saveSetTimeout: f,
620
+ saveConfig: x,
621
+ VueMonaco: A,
622
+ useCanvas: v,
623
+ useMessage: E,
624
+ ToolbarBase: B,
625
+ openCommon: y,
626
+ saveCommon: g,
627
+ isLoading: d,
628
+ setAutoSaveStatus: k,
629
+ getAutoSaveStatus: D,
630
+ constants: _,
631
+ OPEN_DELAY: h,
632
+ api: T
633
+ })
634
+ }), S = {
172
635
  language: "json",
173
636
  lineNumbers: !0,
174
637
  minimap: {
175
638
  enabled: !1
176
639
  }
177
- }, m = () => {
640
+ }, f = m(() => {
178
641
  clearTimeout(e.preservationTime), e.preservationTime = setTimeout(() => {
179
- d(), m();
642
+ p(), f();
180
643
  }, e.timeValue * 60 * 1e3);
181
- }, M = () => {
182
- ne(e.checked), e.checked ? m() : clearTimeout(e.preservationTime);
183
- };
184
- return A(() => {
185
- e.checked = ae(), e.checked && m();
186
- }), O(() => {
644
+ }, {
645
+ metaData: {
646
+ id: `${r.id}.saveSetTimeout`
647
+ },
648
+ ctx: () => ({
649
+ delayOptions: a,
650
+ state: e,
651
+ editor: o,
652
+ isSaved: t,
653
+ setSaved: s,
654
+ getSchema: l,
655
+ subscribe: u,
656
+ unsubscribe: i,
657
+ subscriber: n,
658
+ originSchema: c,
659
+ close: b,
660
+ openApi: p,
661
+ saveApi: C,
662
+ editorOptions: S,
663
+ saveSetTimeout: f,
664
+ saveConfig: x,
665
+ VueMonaco: A,
666
+ useCanvas: v,
667
+ useMessage: E,
668
+ ToolbarBase: B,
669
+ openCommon: y,
670
+ saveCommon: g,
671
+ isLoading: d,
672
+ setAutoSaveStatus: k,
673
+ getAutoSaveStatus: D,
674
+ constants: _,
675
+ OPEN_DELAY: h,
676
+ api: T
677
+ })
678
+ }), x = m(() => {
679
+ k(e.checked), e.checked ? f() : clearTimeout(e.preservationTime);
680
+ }, {
681
+ metaData: {
682
+ id: `${r.id}.saveConfig`
683
+ },
684
+ ctx: () => ({
685
+ delayOptions: a,
686
+ state: e,
687
+ editor: o,
688
+ isSaved: t,
689
+ setSaved: s,
690
+ getSchema: l,
691
+ subscribe: u,
692
+ unsubscribe: i,
693
+ subscriber: n,
694
+ originSchema: c,
695
+ close: b,
696
+ openApi: p,
697
+ saveApi: C,
698
+ editorOptions: S,
699
+ saveSetTimeout: f,
700
+ saveConfig: x,
701
+ VueMonaco: A,
702
+ useCanvas: v,
703
+ useMessage: E,
704
+ ToolbarBase: B,
705
+ openCommon: y,
706
+ saveCommon: g,
707
+ isLoading: d,
708
+ setAutoSaveStatus: k,
709
+ getAutoSaveStatus: D,
710
+ constants: _,
711
+ OPEN_DELAY: h,
712
+ api: T
713
+ })
714
+ });
715
+ return X(m(m(() => {
716
+ e.checked = D(), e.checked && f();
717
+ }, {
718
+ metaData: {
719
+ id: `${r.id}.onMounted[1]`
720
+ },
721
+ ctx: () => ({
722
+ delayOptions: a,
723
+ state: e,
724
+ editor: o,
725
+ isSaved: t,
726
+ setSaved: s,
727
+ getSchema: l,
728
+ subscribe: u,
729
+ unsubscribe: i,
730
+ subscriber: n,
731
+ originSchema: c,
732
+ close: b,
733
+ openApi: p,
734
+ saveApi: C,
735
+ editorOptions: S,
736
+ saveSetTimeout: f,
737
+ saveConfig: x,
738
+ VueMonaco: A,
739
+ useCanvas: v,
740
+ useMessage: E,
741
+ ToolbarBase: B,
742
+ openCommon: y,
743
+ saveCommon: g,
744
+ isLoading: d,
745
+ setAutoSaveStatus: k,
746
+ getAutoSaveStatus: D,
747
+ constants: _,
748
+ OPEN_DELAY: h,
749
+ api: T
750
+ })
751
+ }), {
752
+ metaData: {
753
+ id: `${r.id}.onMounted[1]`
754
+ },
755
+ ctx: () => ({
756
+ delayOptions: a,
757
+ state: e,
758
+ editor: o,
759
+ isSaved: t,
760
+ setSaved: s,
761
+ getSchema: l,
762
+ subscribe: u,
763
+ unsubscribe: i,
764
+ subscriber: n,
765
+ originSchema: c,
766
+ close: b,
767
+ openApi: p,
768
+ saveApi: C,
769
+ editorOptions: S,
770
+ saveSetTimeout: f,
771
+ saveConfig: x,
772
+ _callEntry: m,
773
+ _useCompile: K,
774
+ _metaData: r,
775
+ VueMonaco: A,
776
+ useCanvas: v,
777
+ useMessage: E,
778
+ ToolbarBase: B,
779
+ openCommon: y,
780
+ saveCommon: g,
781
+ isLoading: d,
782
+ setAutoSaveStatus: k,
783
+ getAutoSaveStatus: D,
784
+ constants: _,
785
+ OPEN_DELAY: h,
786
+ api: T
787
+ })
788
+ })), Z(m(m(() => {
187
789
  clearTimeout(e.preservationTime);
790
+ }, {
791
+ metaData: {
792
+ id: `${r.id}.onUnmounted[1]`
793
+ },
794
+ ctx: () => ({
795
+ delayOptions: a,
796
+ state: e,
797
+ editor: o,
798
+ isSaved: t,
799
+ setSaved: s,
800
+ getSchema: l,
801
+ subscribe: u,
802
+ unsubscribe: i,
803
+ subscriber: n,
804
+ originSchema: c,
805
+ close: b,
806
+ openApi: p,
807
+ saveApi: C,
808
+ editorOptions: S,
809
+ saveSetTimeout: f,
810
+ saveConfig: x,
811
+ VueMonaco: A,
812
+ useCanvas: v,
813
+ useMessage: E,
814
+ ToolbarBase: B,
815
+ openCommon: y,
816
+ saveCommon: g,
817
+ isLoading: d,
818
+ setAutoSaveStatus: k,
819
+ getAutoSaveStatus: D,
820
+ constants: _,
821
+ OPEN_DELAY: h,
822
+ api: T
823
+ })
188
824
  }), {
825
+ metaData: {
826
+ id: `${r.id}.onUnmounted[1]`
827
+ },
828
+ ctx: () => ({
829
+ delayOptions: a,
830
+ state: e,
831
+ editor: o,
832
+ isSaved: t,
833
+ setSaved: s,
834
+ getSchema: l,
835
+ subscribe: u,
836
+ unsubscribe: i,
837
+ subscriber: n,
838
+ originSchema: c,
839
+ close: b,
840
+ openApi: p,
841
+ saveApi: C,
842
+ editorOptions: S,
843
+ saveSetTimeout: f,
844
+ saveConfig: x,
845
+ _callEntry: m,
846
+ _useCompile: K,
847
+ _metaData: r,
848
+ VueMonaco: A,
849
+ useCanvas: v,
850
+ useMessage: E,
851
+ ToolbarBase: B,
852
+ openCommon: y,
853
+ saveCommon: g,
854
+ isLoading: d,
855
+ setAutoSaveStatus: k,
856
+ getAutoSaveStatus: D,
857
+ constants: _,
858
+ OPEN_DELAY: h,
859
+ api: T
860
+ })
861
+ })), {
189
862
  state: e,
190
863
  editor: o,
191
- editorOptions: E,
192
- isLoading: b,
864
+ editorOptions: S,
865
+ isLoading: d,
193
866
  isSaved: t,
194
- close: p,
195
- openApi: d,
867
+ close: b,
868
+ openApi: p,
196
869
  saveApi: C,
197
870
  delayOptions: a,
198
- saveConfig: M,
199
- OPEN_DELAY: se
871
+ saveConfig: x,
872
+ OPEN_DELAY: h
200
873
  };
201
874
  }
202
- }, ce = (a, e) => {
875
+ }, de = (a, e) => {
203
876
  const o = a.__vccOpts || a;
204
877
  for (const [t, s] of e)
205
878
  o[t] = s;
206
879
  return o;
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, s, l) {
209
- const r = f("svg-icon"), i = f("tiny-checkbox"), n = f("tiny-select"), c = f("tiny-button"), p = f("tiny-popover"), d = f("vue-monaco"), C = f("tiny-dialog-box"), E = f("toolbar-base");
210
- return P(), J("div", re, [
211
- v(E, {
880
+ }, ue = { class: "toolbar-save" }, me = { class: "save-style" }, ve = { class: "save-time" }, pe = { class: "save-button-group" };
881
+ function fe(a, e, o, t, s, l) {
882
+ const u = F("svg-icon"), i = F("tiny-checkbox"), n = F("tiny-select"), c = F("tiny-button"), b = F("tiny-popover"), p = F("vue-monaco"), C = F("tiny-dialog-box"), S = F("toolbar-base");
883
+ return $(), te("div", ue, [
884
+ V(S, {
212
885
  content: t.isLoading ? "保存中" : "保存",
213
886
  icon: o.options.icon.default || o.options.icon,
214
887
  options: { ...o.options, showDots: !t.isSaved() },
215
888
  onClickApi: t.openApi
216
889
  }, {
217
- button: u(() => [
218
- v(p, {
890
+ button: N(() => [
891
+ V(b, {
219
892
  "visible-arrow": !1,
220
893
  width: "203",
221
894
  trigger: "click",
222
895
  "open-delay": t.OPEN_DELAY.Default
223
896
  }, {
224
- reference: u(() => [
225
- v(r, { name: o.iconExpand }, null, 8, ["name"])
897
+ reference: N(() => [
898
+ V(u, { name: o.iconExpand }, null, 8, ["name"])
226
899
  ]),
227
- default: u(() => [
228
- k("div", ue, [
229
- e[6] || (e[6] = k("div", { class: "save-setting" }, "保存设置", -1)),
230
- v(i, {
900
+ default: N(() => [
901
+ H("div", me, [
902
+ e[6] || (e[6] = H("div", { class: "save-setting" }, "保存设置", -1)),
903
+ V(i, {
231
904
  modelValue: t.state.checked,
232
- "onUpdate:modelValue": e[0] || (e[0] = (m) => t.state.checked = m),
905
+ "onUpdate:modelValue": e[0] || (e[0] = (f) => t.state.checked = f),
233
906
  name: "tiny-checkbox"
234
907
  }, {
235
- default: u(() => e[3] || (e[3] = [
236
- S("自动保存")
908
+ default: N(() => e[3] || (e[3] = [
909
+ Q("自动保存")
237
910
  ])),
238
911
  _: 1
239
912
  }, 8, ["modelValue"]),
240
- k("div", de, [
241
- e[4] || (e[4] = k("div", { class: "save-time-label" }, "保存间隔", -1)),
242
- v(n, {
913
+ H("div", ve, [
914
+ e[4] || (e[4] = H("div", { class: "save-time-label" }, "保存间隔", -1)),
915
+ V(n, {
243
916
  modelValue: t.state.timeValue,
244
- "onUpdate:modelValue": e[1] || (e[1] = (m) => t.state.timeValue = m),
917
+ "onUpdate:modelValue": e[1] || (e[1] = (f) => t.state.timeValue = f),
245
918
  options: t.delayOptions,
246
919
  disabled: !t.state.checked,
247
920
  autocomplete: ""
248
921
  }, null, 8, ["modelValue", "options", "disabled"])
249
922
  ]),
250
- k("div", me, [
251
- v(c, {
923
+ H("div", pe, [
924
+ V(c, {
252
925
  type: "primary",
253
926
  onClick: t.saveConfig
254
927
  }, {
255
- default: u(() => e[5] || (e[5] = [
256
- S("设置并保存")
928
+ default: N(() => e[5] || (e[5] = [
929
+ Q("设置并保存")
257
930
  ])),
258
931
  _: 1
259
932
  }, 8, ["onClick"])
@@ -263,35 +936,35 @@ function ve(a, e, o, t, s, l) {
263
936
  _: 1
264
937
  }, 8, ["open-delay"])
265
938
  ]),
266
- default: u(() => [
267
- v(C, {
939
+ default: N(() => [
940
+ V(C, {
268
941
  class: "dialog-box",
269
942
  modal: !1,
270
943
  fullscreen: !0,
271
944
  "append-to-body": !0,
272
945
  visible: t.state.visible,
273
946
  title: "Schema 本地与线上差异",
274
- "onUpdate:visible": e[2] || (e[2] = (m) => t.state.visible = m)
947
+ "onUpdate:visible": e[2] || (e[2] = (f) => t.state.visible = f)
275
948
  }, {
276
- footer: u(() => [
277
- v(c, { onClick: t.close }, {
278
- default: u(() => e[7] || (e[7] = [
279
- S("取 消")
949
+ footer: N(() => [
950
+ V(c, { onClick: t.close }, {
951
+ default: N(() => e[7] || (e[7] = [
952
+ Q("取 消")
280
953
  ])),
281
954
  _: 1
282
955
  }, 8, ["onClick"]),
283
- v(c, {
956
+ V(c, {
284
957
  type: "primary",
285
958
  onClick: t.saveApi
286
959
  }, {
287
- default: u(() => e[8] || (e[8] = [
288
- S("保 存")
960
+ default: N(() => e[8] || (e[8] = [
961
+ Q("保 存")
289
962
  ])),
290
963
  _: 1
291
964
  }, 8, ["onClick"])
292
965
  ]),
293
- default: u(() => [
294
- t.state.visible ? (P(), L(d, {
966
+ default: N(() => [
967
+ t.state.visible ? ($(), oe(p, {
295
968
  key: 0,
296
969
  ref: "editor",
297
970
  class: "monaco-editor",
@@ -299,7 +972,7 @@ function ve(a, e, o, t, s, l) {
299
972
  options: t.editorOptions,
300
973
  value: t.state.code,
301
974
  original: t.state.originalCode
302
- }, null, 8, ["options", "value", "original"])) : U("", !0)
975
+ }, null, 8, ["options", "value", "original"])) : ae("", !0)
303
976
  ]),
304
977
  _: 1
305
978
  }, 8, ["visible"])
@@ -308,11 +981,11 @@ function ve(a, e, o, t, s, l) {
308
981
  }, 8, ["content", "icon", "options", "onClickApi"])
309
982
  ]);
310
983
  }
311
- const pe = /* @__PURE__ */ ce(le, [["render", ve], ["__scopeId", "data-v-047f42c8"]]), Be = {
312
- ...V,
313
- entry: pe,
314
- apis: ie
984
+ const ge = /* @__PURE__ */ de(re, [["render", fe], ["__scopeId", "data-v-1f2072bd"]]), xe = {
985
+ ...r,
986
+ entry: ge,
987
+ apis: T
315
988
  };
316
989
  export {
317
- Be as default
990
+ xe as default
318
991
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- .dots[data-v-047f42c8]{width:6px;height:6px;background:var(--te-toolbars-save-dot-color);border-radius:50%;display:inline-block;position:absolute;top:4px;right:3px;z-index:100}.toolbar-save .icon-down-arrow.icon-down-arrow[data-v-047f42c8]{margin-left:var(--te-base-space-2x);margin-right:var(--te-base-space-0)}.toolbar-save .save-button[data-v-047f42c8]{background-color:var(--te-toolbars-save-button-bg-color);border:none;min-width:70px;height:26px;display:flex;align-items:center;padding:0 8px;border-radius:4px}.toolbar-save .save-button[data-v-047f42c8]:not(.disabled):hover{background-color:var(--te-toolbars-save-button-bg-color)}.toolbar-save[data-v-047f42c8] .icon-down-arrow:focus{outline:none}.save-style[data-v-047f42c8]{padding:8px 4px;font-size:12px}.save-style .save-setting[data-v-047f42c8]{font-size:14px;font-weight:600;line-height:20px;height:20px;margin-bottom:16px}.save-style .save-time[data-v-047f42c8]{line-height:24px;font-size:12px;margin:12px 0 16px;display:flex}.save-style .save-time .save-time-label[data-v-047f42c8]{width:60px;color:var(--te-toolbars-save-text-color)}.save-style .save-time .tiny-select[data-v-047f42c8]{width:103px;margin-left:12px}.save-style .save-time .tiny-select[data-v-047f42c8] .tiny-input__suffix{width:12px}.save-style .save-time[data-v-047f42c8] .tiny-select.is-disabled .tiny-input__suffix{display:flex}.save-style .save-button-group[data-v-047f42c8]{text-align:right}#saving[data-v-047f42c8]{cursor:not-allowed;color:var(--te-toolbars-save-text-color-disabled)}#saving[data-v-047f42c8] svg{color:var(--te-toolbars-save-text-color-disabled)}.dialog-box[data-v-047f42c8] .tiny-dialog-box{display:flex;flex-direction:column}.dialog-box[data-v-047f42c8] .tiny-dialog-box .tiny-dialog-box__body{flex:1}.dialog-box .monaco-editor[data-v-047f42c8]{width:100%;height:100%}.changeRole a{color:var(--te-toolbars-save-text-color-link);padding:0 5px}.save-style .save-time .tiny-input__inner{height:24px!important}:root{--te-toolbars-save-text-color: var(--te-common-text-secondary);--te-toolbars-save-text-color-disabled: var(--te-common-text-disabled);--te-toolbars-save-dot-color: var(--te-common-color-error);--te-toolbars-save-button-bg-color: var(--te-common-bg-prompt);--te-toolbars-save-text-color-link: var(--te-common-text-link)}
1
+ .dots[data-v-1f2072bd]{width:6px;height:6px;background:var(--te-toolbars-save-dot-color);border-radius:50%;display:inline-block;position:absolute;top:4px;right:3px;z-index:100}.toolbar-save .icon-down-arrow.icon-down-arrow[data-v-1f2072bd]{margin-left:var(--te-base-space-2x);margin-right:var(--te-base-space-0)}.toolbar-save .save-button[data-v-1f2072bd]{background-color:var(--te-toolbars-save-button-bg-color);border:none;min-width:70px;height:26px;display:flex;align-items:center;padding:0 8px;border-radius:4px}.toolbar-save .save-button[data-v-1f2072bd]:not(.disabled):hover{background-color:var(--te-toolbars-save-button-bg-color)}.toolbar-save[data-v-1f2072bd] .icon-down-arrow:focus{outline:none}.save-style[data-v-1f2072bd]{padding:8px 4px;font-size:12px}.save-style .save-setting[data-v-1f2072bd]{font-size:14px;font-weight:600;line-height:20px;height:20px;margin-bottom:16px}.save-style .save-time[data-v-1f2072bd]{line-height:24px;font-size:12px;margin:12px 0 16px;display:flex}.save-style .save-time .save-time-label[data-v-1f2072bd]{width:60px;color:var(--te-toolbars-save-text-color)}.save-style .save-time .tiny-select[data-v-1f2072bd]{width:103px;margin-left:12px}.save-style .save-time .tiny-select[data-v-1f2072bd] .tiny-input__suffix{width:12px}.save-style .save-time[data-v-1f2072bd] .tiny-select.is-disabled .tiny-input__suffix{display:flex}.save-style .save-button-group[data-v-1f2072bd]{text-align:right}#saving[data-v-1f2072bd]{cursor:not-allowed;color:var(--te-toolbars-save-text-color-disabled)}#saving[data-v-1f2072bd] svg{color:var(--te-toolbars-save-text-color-disabled)}.dialog-box[data-v-1f2072bd] .tiny-dialog-box{display:flex;flex-direction:column}.dialog-box[data-v-1f2072bd] .tiny-dialog-box .tiny-dialog-box__body{flex:1}.dialog-box .monaco-editor[data-v-1f2072bd]{width:100%;height:100%}.changeRole a{color:var(--te-toolbars-save-text-color-link);padding:0 5px}.save-style .save-time .tiny-input__inner{height:24px!important}:root{--te-toolbars-save-text-color: var(--te-common-text-secondary);--te-toolbars-save-text-color-disabled: var(--te-common-text-disabled);--te-toolbars-save-dot-color: var(--te-common-color-error);--te-toolbars-save-button-bg-color: var(--te-common-bg-prompt);--te-toolbars-save-text-color-link: var(--te-common-text-link)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-save",
3
- "version": "2.4.0",
3
+ "version": "2.5.0-alpha.1",
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.4.0",
29
- "@opentiny/tiny-engine-meta-register": "2.4.0",
30
- "@opentiny/tiny-engine-utils": "2.4.0"
28
+ "@opentiny/tiny-engine-common": "2.5.0-alpha.1",
29
+ "@opentiny/tiny-engine-meta-register": "2.5.0-alpha.1",
30
+ "@opentiny/tiny-engine-utils": "2.5.0-alpha.1"
31
31
  },
32
32
  "devDependencies": {
33
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.4.0",
33
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.1",
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": "477aa411da11a4f95712e3e5c251d97cae23f4ad"
42
+ "gitHead": "018ca6054f72ee559f0d3ca4dfcbeef4fb411e01"
43
43
  }