@opentiny/tiny-engine-toolbar-save 2.5.0-alpha.0 → 2.5.0-alpha.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.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import "./style.css";
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 = {
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 = {
9
9
  id: "engine.toolbars.save",
10
10
  type: "toolbars",
11
11
  title: "save",
@@ -15,298 +15,100 @@ const r = {
15
15
  },
16
16
  renderType: "button"
17
17
  }
18
- }, {
19
- PAGE_STATUS: P,
20
- AUTO_SAVED: M
21
- } = _, O = ee({
18
+ }, { PAGE_STATUS: g, AUTO_SAVED: w } = N, _ = x({
22
19
  visible: !1,
23
20
  code: "",
24
21
  originalCode: "",
25
22
  disabled: !1
26
- }), d = W(!1), Y = m(async (a) => {
23
+ }), b = h(!1), te = async (a) => {
27
24
  var s;
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 = {
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 = {
63
29
  page_content: a
64
30
  };
65
- d.value = !0;
31
+ b.value = !0;
66
32
  const t = {
67
33
  id: e.id,
68
- params: {
69
- ...e,
70
- ...o
71
- }
34
+ params: { ...e, ...o }
72
35
  };
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) {
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) {
121
40
  o.saved && (o.saved = !1), o.saved = !0;
122
- const b = "page_content";
123
- return e.currentPageData[b] = n, Promise.resolve();
41
+ const p = "page_content";
42
+ return e.currentPageData[p] = n, Promise.resolve();
124
43
  }
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)
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)
160
49
  return;
161
- const {
162
- beforeSave: o,
163
- saveMethod: t,
164
- saved: s
165
- } = I(r.id);
50
+ const { beforeSave: o, saveMethod: t, saved: s } = H(V.id);
166
51
  try {
167
52
  if (typeof o == "function" && await o(), typeof t == "function" && await t())
168
53
  return;
169
- } catch (p) {
170
- w({
54
+ } catch (d) {
55
+ D({
171
56
  type: "error",
172
- message: `Error in saving: ${p}`
57
+ message: `Error in saving: ${d}`
173
58
  });
174
59
  }
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} 锁定,如需编辑请先联系他解锁文件,然后再锁定该页面后编辑!`
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} 锁定,如需编辑请先联系他解锁文件,然后再锁定该页面后编辑!`
180
65
  };
181
- if ([P.Release, P.Empty, P.Guest, P.Lock].includes(u)) {
182
- w({
66
+ if ([g.Release, g.Empty, g.Guest, g.Lock].includes(r)) {
67
+ D({
183
68
  type: "error",
184
69
  title: "保存失败",
185
- message: n[u]
70
+ message: n[r]
186
71
  });
187
72
  return;
188
73
  }
189
- O.disabled = !0;
74
+ _.disabled = !0;
190
75
  const c = e();
191
- O.code = JSON.stringify(c || {}, null, 2), g(O.code).finally(() => {
192
- if (O.disabled = !1, typeof s == "function")
76
+ _.code = JSON.stringify(c || {}, null, 2), T(_.code).finally(() => {
77
+ if (_.disabled = !1, typeof s == "function")
193
78
  try {
194
79
  s();
195
- } catch (p) {
196
- w({
80
+ } catch (d) {
81
+ D({
197
82
  type: "error",
198
- message: `Error in saved: ${p}`
83
+ message: `Error in saved: ${d}`
199
84
  });
200
85
  }
201
86
  });
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(() => {
87
+ }, ae = () => {
230
88
  try {
231
- const a = localStorage.getItem(M) ?? "";
89
+ const a = localStorage.getItem(w) ?? "";
232
90
  return JSON.parse(a) ?? !1;
233
91
  } catch {
234
92
  return !1;
235
93
  }
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) => {
94
+ }, ne = (a) => {
264
95
  try {
265
- return localStorage.setItem(M, JSON.stringify(a)), !0;
96
+ return localStorage.setItem(w, JSON.stringify(a)), !0;
266
97
  } catch {
267
98
  return !1;
268
99
  }
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 = {
100
+ }, { OPEN_DELAY: se } = N, ie = {
101
+ saveCommon: T,
102
+ openCommon: F
103
+ }, le = {
302
104
  components: {
303
- VueMonaco: A,
304
- TinyButton: ce,
305
- TinyPopover: le,
306
- TinyDialogBox: ie,
307
- TinyCheckbox: se,
308
- TinySelect: ne,
309
- ToolbarBase: B
105
+ VueMonaco: G,
106
+ TinyButton: z,
107
+ TinyPopover: q,
108
+ TinyDialogBox: Y,
109
+ TinyCheckbox: j,
110
+ TinySelect: R,
111
+ ToolbarBase: I
310
112
  },
311
113
  props: {
312
114
  iconExpand: {
@@ -319,614 +121,139 @@ const r = {
319
121
  }
320
122
  },
321
123
  setup() {
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({
124
+ const a = [
125
+ { value: 5, label: "5分钟" },
126
+ { value: 10, label: "10分钟" },
127
+ { value: 15, label: "15分钟" }
128
+ ], e = x({
332
129
  visible: !1,
333
130
  code: "",
334
131
  originalCode: "",
335
132
  checked: !1,
336
133
  timeValue: 5,
337
134
  preservationTime: null
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({
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({
348
138
  topic: "pageOrBlockInit",
349
139
  subscriber: n,
350
- callback: (z) => {
351
- c.value = JSON.stringify(z), s(!0);
140
+ callback: (y) => {
141
+ c.value = JSON.stringify(y), s(!0);
352
142
  }
353
- }), u({
143
+ }), r({
354
144
  topic: "schemaChange",
355
145
  subscriber: n,
356
146
  callback: () => {
357
147
  if (c.value) {
358
- const z = JSON.stringify(l()) === c.value;
359
- s(z);
148
+ const y = JSON.stringify(l()) === c.value;
149
+ s(y);
360
150
  }
361
151
  }
362
- }), u({
152
+ }), r({
363
153
  topic: "schemaImport",
364
154
  subscriber: n,
365
155
  callback: () => {
366
156
  if (c.value) {
367
- const z = JSON.stringify(l()) === c.value;
368
- s(z);
157
+ const y = JSON.stringify(l()) === c.value;
158
+ s(y);
369
159
  }
370
160
  }
371
161
  });
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(() => {
162
+ }), O(() => {
163
+ i({ topic: "pageOrBlockInit", subscriber: n }), i({ topic: "schemaChange", subscriber: n }), i({ topic: "schemaImport", subscriber: n });
164
+ });
165
+ const p = () => {
527
166
  e.visible = !1, e.originalCode = "";
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 = {
167
+ }, d = () => {
168
+ b.value || F();
169
+ }, C = () => {
170
+ T();
171
+ }, E = {
635
172
  language: "json",
636
173
  lineNumbers: !0,
637
174
  minimap: {
638
175
  enabled: !1
639
176
  }
640
- }, f = m(() => {
177
+ }, m = () => {
641
178
  clearTimeout(e.preservationTime), e.preservationTime = setTimeout(() => {
642
- p(), f();
179
+ d(), m();
643
180
  }, e.timeValue * 60 * 1e3);
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(() => {
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(() => {
789
187
  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
- })
824
188
  }), {
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
- })), {
862
189
  state: e,
863
190
  editor: o,
864
- editorOptions: S,
865
- isLoading: d,
191
+ editorOptions: E,
192
+ isLoading: b,
866
193
  isSaved: t,
867
- close: b,
868
- openApi: p,
194
+ close: p,
195
+ openApi: d,
869
196
  saveApi: C,
870
197
  delayOptions: a,
871
- saveConfig: x,
872
- OPEN_DELAY: h
198
+ saveConfig: M,
199
+ OPEN_DELAY: se
873
200
  };
874
201
  }
875
- }, de = (a, e) => {
202
+ }, ce = (a, e) => {
876
203
  const o = a.__vccOpts || a;
877
204
  for (const [t, s] of e)
878
205
  o[t] = s;
879
206
  return o;
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, {
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, {
885
212
  content: t.isLoading ? "保存中" : "保存",
886
213
  icon: o.options.icon.default || o.options.icon,
887
214
  options: { ...o.options, showDots: !t.isSaved() },
888
215
  onClickApi: t.openApi
889
216
  }, {
890
- button: N(() => [
891
- V(b, {
217
+ button: u(() => [
218
+ v(p, {
892
219
  "visible-arrow": !1,
893
220
  width: "203",
894
221
  trigger: "click",
895
222
  "open-delay": t.OPEN_DELAY.Default
896
223
  }, {
897
- reference: N(() => [
898
- V(u, { name: o.iconExpand }, null, 8, ["name"])
224
+ reference: u(() => [
225
+ v(r, { name: o.iconExpand }, null, 8, ["name"])
899
226
  ]),
900
- default: N(() => [
901
- H("div", me, [
902
- e[6] || (e[6] = H("div", { class: "save-setting" }, "保存设置", -1)),
903
- V(i, {
227
+ default: u(() => [
228
+ k("div", ue, [
229
+ e[6] || (e[6] = k("div", { class: "save-setting" }, "保存设置", -1)),
230
+ v(i, {
904
231
  modelValue: t.state.checked,
905
- "onUpdate:modelValue": e[0] || (e[0] = (f) => t.state.checked = f),
232
+ "onUpdate:modelValue": e[0] || (e[0] = (m) => t.state.checked = m),
906
233
  name: "tiny-checkbox"
907
234
  }, {
908
- default: N(() => e[3] || (e[3] = [
909
- Q("自动保存")
235
+ default: u(() => e[3] || (e[3] = [
236
+ S("自动保存")
910
237
  ])),
911
238
  _: 1
912
239
  }, 8, ["modelValue"]),
913
- H("div", ve, [
914
- e[4] || (e[4] = H("div", { class: "save-time-label" }, "保存间隔", -1)),
915
- V(n, {
240
+ k("div", de, [
241
+ e[4] || (e[4] = k("div", { class: "save-time-label" }, "保存间隔", -1)),
242
+ v(n, {
916
243
  modelValue: t.state.timeValue,
917
- "onUpdate:modelValue": e[1] || (e[1] = (f) => t.state.timeValue = f),
244
+ "onUpdate:modelValue": e[1] || (e[1] = (m) => t.state.timeValue = m),
918
245
  options: t.delayOptions,
919
246
  disabled: !t.state.checked,
920
247
  autocomplete: ""
921
248
  }, null, 8, ["modelValue", "options", "disabled"])
922
249
  ]),
923
- H("div", pe, [
924
- V(c, {
250
+ k("div", me, [
251
+ v(c, {
925
252
  type: "primary",
926
253
  onClick: t.saveConfig
927
254
  }, {
928
- default: N(() => e[5] || (e[5] = [
929
- Q("设置并保存")
255
+ default: u(() => e[5] || (e[5] = [
256
+ S("设置并保存")
930
257
  ])),
931
258
  _: 1
932
259
  }, 8, ["onClick"])
@@ -936,35 +263,35 @@ function fe(a, e, o, t, s, l) {
936
263
  _: 1
937
264
  }, 8, ["open-delay"])
938
265
  ]),
939
- default: N(() => [
940
- V(C, {
266
+ default: u(() => [
267
+ v(C, {
941
268
  class: "dialog-box",
942
269
  modal: !1,
943
270
  fullscreen: !0,
944
271
  "append-to-body": !0,
945
272
  visible: t.state.visible,
946
273
  title: "Schema 本地与线上差异",
947
- "onUpdate:visible": e[2] || (e[2] = (f) => t.state.visible = f)
274
+ "onUpdate:visible": e[2] || (e[2] = (m) => t.state.visible = m)
948
275
  }, {
949
- footer: N(() => [
950
- V(c, { onClick: t.close }, {
951
- default: N(() => e[7] || (e[7] = [
952
- Q("取 消")
276
+ footer: u(() => [
277
+ v(c, { onClick: t.close }, {
278
+ default: u(() => e[7] || (e[7] = [
279
+ S("取 消")
953
280
  ])),
954
281
  _: 1
955
282
  }, 8, ["onClick"]),
956
- V(c, {
283
+ v(c, {
957
284
  type: "primary",
958
285
  onClick: t.saveApi
959
286
  }, {
960
- default: N(() => e[8] || (e[8] = [
961
- Q("保 存")
287
+ default: u(() => e[8] || (e[8] = [
288
+ S("保 存")
962
289
  ])),
963
290
  _: 1
964
291
  }, 8, ["onClick"])
965
292
  ]),
966
- default: N(() => [
967
- t.state.visible ? ($(), oe(p, {
293
+ default: u(() => [
294
+ t.state.visible ? (P(), L(d, {
968
295
  key: 0,
969
296
  ref: "editor",
970
297
  class: "monaco-editor",
@@ -972,7 +299,7 @@ function fe(a, e, o, t, s, l) {
972
299
  options: t.editorOptions,
973
300
  value: t.state.code,
974
301
  original: t.state.originalCode
975
- }, null, 8, ["options", "value", "original"])) : ae("", !0)
302
+ }, null, 8, ["options", "value", "original"])) : U("", !0)
976
303
  ]),
977
304
  _: 1
978
305
  }, 8, ["visible"])
@@ -981,11 +308,11 @@ function fe(a, e, o, t, s, l) {
981
308
  }, 8, ["content", "icon", "options", "onClickApi"])
982
309
  ]);
983
310
  }
984
- const ge = /* @__PURE__ */ de(re, [["render", fe], ["__scopeId", "data-v-1f2072bd"]]), xe = {
985
- ...r,
986
- entry: ge,
987
- apis: T
311
+ const pe = /* @__PURE__ */ ce(le, [["render", ve], ["__scopeId", "data-v-047f42c8"]]), Be = {
312
+ ...V,
313
+ entry: pe,
314
+ apis: ie
988
315
  };
989
316
  export {
990
- xe as default
317
+ Be as default
991
318
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
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)}
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)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-engine-toolbar-save",
3
- "version": "2.5.0-alpha.0",
3
+ "version": "2.5.0-alpha.2",
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.0",
29
- "@opentiny/tiny-engine-meta-register": "2.5.0-alpha.0",
30
- "@opentiny/tiny-engine-utils": "2.5.0-alpha.0"
28
+ "@opentiny/tiny-engine-common": "2.5.0-alpha.2",
29
+ "@opentiny/tiny-engine-meta-register": "2.5.0-alpha.2",
30
+ "@opentiny/tiny-engine-utils": "2.5.0-alpha.2"
31
31
  },
32
32
  "devDependencies": {
33
- "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.0",
33
+ "@opentiny/tiny-engine-vite-plugin-meta-comments": "2.5.0-alpha.2",
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": "ae59c82734d79f650c9221cb9702714814b099c8"
42
+ "gitHead": "f5707c379397bffc9a63c50c695f3ee3340ad0c6"
43
43
  }