@opentiny/tiny-engine-toolbar-redoundo 2.0.0-alpha.2 → 2.0.0-alpha.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 +98 -86
- package/dist/style.css +1 -1
- package/package.json +9 -7
package/dist/index.js
CHANGED
|
@@ -1,76 +1,88 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
import { Popover as
|
|
3
|
-
import { useHistory as
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { Popover as S } from "@opentiny/vue";
|
|
3
|
+
import { useHistory as w, useCanvas as s, HOOK_NAME as _ } from "@opentiny/tiny-engine-meta-register";
|
|
4
|
+
import { ToolbarBase as k } from "@opentiny/tiny-engine-common";
|
|
5
|
+
import { resolveComponent as c, openBlock as x, createBlock as H, withCtx as p, createElementVNode as d, createVNode as a, normalizeClass as b, reactive as O, watch as C, isProxy as N, toRaw as A } from "vue";
|
|
6
|
+
const B = (e, o) => {
|
|
6
7
|
const r = e.__vccOpts || e;
|
|
7
|
-
for (const [
|
|
8
|
-
r[
|
|
8
|
+
for (const [f, u] of o)
|
|
9
|
+
r[f] = u;
|
|
9
10
|
return r;
|
|
10
|
-
},
|
|
11
|
+
}, P = {
|
|
11
12
|
components: {
|
|
12
|
-
TinyPopover:
|
|
13
|
+
TinyPopover: S,
|
|
14
|
+
ToolbarBase: k
|
|
13
15
|
},
|
|
14
16
|
props: {
|
|
15
|
-
|
|
16
|
-
type:
|
|
17
|
-
default:
|
|
18
|
-
},
|
|
19
|
-
redoIcon: {
|
|
20
|
-
type: String,
|
|
21
|
-
default: "redo"
|
|
17
|
+
options: {
|
|
18
|
+
type: Object,
|
|
19
|
+
default: () => ({})
|
|
22
20
|
}
|
|
23
21
|
},
|
|
24
22
|
setup() {
|
|
25
|
-
return
|
|
23
|
+
return w();
|
|
26
24
|
}
|
|
27
|
-
},
|
|
28
|
-
function
|
|
29
|
-
const
|
|
30
|
-
return
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
25
|
+
}, T = { class: "redo-undo-wrap" };
|
|
26
|
+
function j(e, o, r, f, u, R) {
|
|
27
|
+
const y = c("svg-icon"), m = c("tiny-popover"), h = c("toolbar-base");
|
|
28
|
+
return x(), H(h, { options: r.options }, {
|
|
29
|
+
default: p(() => [
|
|
30
|
+
d("span", T, [
|
|
31
|
+
a(m, {
|
|
32
|
+
trigger: "hover",
|
|
33
|
+
"open-delay": 1e3,
|
|
34
|
+
"popper-class": "toolbar-right-popover",
|
|
35
|
+
"append-to-body": "",
|
|
36
|
+
content: e.historyState.back ? "撤销" : "没有要撤销的"
|
|
37
|
+
}, {
|
|
38
|
+
reference: p(() => [
|
|
39
|
+
d("span", {
|
|
40
|
+
class: b(["icon-wrap", "undo", { disabled: !e.historyState.back }]),
|
|
41
|
+
onClick: o[0] || (o[0] = (...i) => e.back && e.back(...i))
|
|
42
|
+
}, [
|
|
43
|
+
a(y, {
|
|
44
|
+
name: r.options.icon.undo
|
|
45
|
+
}, null, 8, ["name"])
|
|
46
|
+
], 2)
|
|
47
|
+
]),
|
|
48
|
+
_: 1
|
|
49
|
+
}, 8, ["content"]),
|
|
50
|
+
a(m, {
|
|
51
|
+
trigger: "hover",
|
|
52
|
+
"open-delay": 1e3,
|
|
53
|
+
"popper-class": "toolbar-right-popover",
|
|
54
|
+
"append-to-body": "",
|
|
55
|
+
content: e.historyState.forward ? "恢复" : "没有要恢复的"
|
|
56
|
+
}, {
|
|
57
|
+
reference: p(() => [
|
|
58
|
+
d("span", {
|
|
59
|
+
class: b(["icon-wrap", "redo", e.historyState.forward ? "" : "disabled"]),
|
|
60
|
+
onClick: o[1] || (o[1] = (...i) => e.forward && e.forward(...i))
|
|
61
|
+
}, [
|
|
62
|
+
a(y, {
|
|
63
|
+
name: r.options.icon.redo
|
|
64
|
+
}, null, 8, ["name"])
|
|
65
|
+
], 2)
|
|
66
|
+
]),
|
|
67
|
+
_: 1
|
|
68
|
+
}, 8, ["content"])
|
|
69
|
+
])
|
|
70
|
+
]),
|
|
71
|
+
_: 1
|
|
72
|
+
}, 8, ["options"]);
|
|
66
73
|
}
|
|
67
|
-
const
|
|
74
|
+
const E = /* @__PURE__ */ B(P, [["render", j], ["__scopeId", "data-v-dc6af9aa"]]), J = {
|
|
68
75
|
id: "engine.toolbars.redoundo",
|
|
69
76
|
type: "toolbars",
|
|
70
77
|
title: "redoundo",
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
options: {
|
|
79
|
+
icon: {
|
|
80
|
+
undo: "undo",
|
|
81
|
+
redo: "redo"
|
|
82
|
+
},
|
|
83
|
+
renderType: "slot"
|
|
84
|
+
}
|
|
85
|
+
}, M = (e) => (N(e) && (e = A(e)), JSON.stringify(e)), V = (e) => {
|
|
74
86
|
let o;
|
|
75
87
|
try {
|
|
76
88
|
o = JSON.parse(e);
|
|
@@ -78,55 +90,55 @@ const M = /* @__PURE__ */ I(N, [["render", E], ["__scopeId", "data-v-f52aff49"]]
|
|
|
78
90
|
o = {};
|
|
79
91
|
}
|
|
80
92
|
return o;
|
|
81
|
-
}, n = [],
|
|
93
|
+
}, n = [], v = 5, t = O({
|
|
82
94
|
index: 0,
|
|
83
95
|
back: !1,
|
|
84
96
|
forward: !1
|
|
85
|
-
}),
|
|
97
|
+
}), g = (e) => {
|
|
86
98
|
let o = n.length;
|
|
87
|
-
t.index < o - 1 && (n.splice(t.index + 1), o = n.length), o >=
|
|
88
|
-
},
|
|
99
|
+
t.index < o - 1 && (n.splice(t.index + 1), o = n.length), o >= v && n.splice(0, o - v + 1), n.push(M(e)), t.index = n.length - 1;
|
|
100
|
+
}, l = (e, o) => {
|
|
89
101
|
var r;
|
|
90
|
-
t.index = t.index + e, (r = s().canvasApi.value) == null || r.setSchema(
|
|
91
|
-
},
|
|
92
|
-
t.back && (
|
|
93
|
-
},
|
|
94
|
-
t.forward && (
|
|
95
|
-
},
|
|
102
|
+
t.index = t.index + e, (r = s().canvasApi.value) == null || r.setSchema(V(n[t.index])), typeof o == "boolean" && n.splice(1, 1);
|
|
103
|
+
}, $ = () => {
|
|
104
|
+
t.back && (l(-1), s().setSaved(!1));
|
|
105
|
+
}, z = () => {
|
|
106
|
+
t.forward && (l(1), s().setSaved(t.index === n.length - 1));
|
|
107
|
+
}, D = () => {
|
|
96
108
|
n.splice(0), Object.assign(t, {
|
|
97
109
|
index: 0,
|
|
98
110
|
back: !1,
|
|
99
111
|
forward: !1
|
|
100
112
|
});
|
|
101
|
-
},
|
|
113
|
+
}, I = (e) => {
|
|
102
114
|
var o;
|
|
103
|
-
e ? (
|
|
115
|
+
e ? (D(), g(e)) : (s().setSaved(!1), g((o = s().canvasApi.value) == null ? void 0 : o.getSchema()));
|
|
104
116
|
};
|
|
105
|
-
|
|
117
|
+
C(
|
|
106
118
|
() => t.index,
|
|
107
119
|
(e) => {
|
|
108
120
|
t.back = e > 0, t.forward = e < n.length - 1;
|
|
109
121
|
}
|
|
110
122
|
);
|
|
111
|
-
const
|
|
123
|
+
const K = () => ({
|
|
112
124
|
historyState: t,
|
|
113
|
-
back:
|
|
114
|
-
forward:
|
|
115
|
-
go:
|
|
116
|
-
addHistory:
|
|
117
|
-
}),
|
|
125
|
+
back: $,
|
|
126
|
+
forward: z,
|
|
127
|
+
go: l,
|
|
128
|
+
addHistory: I
|
|
129
|
+
}), L = {
|
|
118
130
|
id: "engine.service.history",
|
|
119
131
|
type: "MetaService",
|
|
120
|
-
apis:
|
|
132
|
+
apis: K(),
|
|
121
133
|
composable: {
|
|
122
|
-
name:
|
|
134
|
+
name: _.useHistory
|
|
123
135
|
}
|
|
124
|
-
},
|
|
125
|
-
...
|
|
126
|
-
entry:
|
|
127
|
-
metas: [
|
|
136
|
+
}, W = {
|
|
137
|
+
...J,
|
|
138
|
+
entry: E,
|
|
139
|
+
metas: [L]
|
|
128
140
|
};
|
|
129
141
|
export {
|
|
130
|
-
|
|
131
|
-
|
|
142
|
+
L as HistoryService,
|
|
143
|
+
W as default
|
|
132
144
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.redo-undo-wrap[data-v-
|
|
1
|
+
.redo-undo-wrap[data-v-dc6af9aa]{display:flex}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap{display:inline-flex;align-items:center;justify-content:center;height:32px;width:32px;border-radius:6px}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap svg{color:var(--ti-lowcode-toolbar-title-color);font-size:20px}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap.disabled{cursor:not-allowed}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap.disabled svg{color:var(--ti-lowcode-disabled-color)}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap:not(.disabled):hover{background:var(--ti-lowcode-toolbar-view-active-bg)}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap:not(.disabled):hover svg{color:var(--ti-lowcode-toolbar-active-color)}.redo-undo-wrap[data-v-dc6af9aa] .icon-wrap.redo{margin-left:-5px}
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-engine-toolbar-redoundo",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "vite build"
|
|
9
9
|
},
|
|
10
|
+
"type": "module",
|
|
10
11
|
"main": "dist/index.js",
|
|
11
12
|
"module": "dist/index.js",
|
|
12
13
|
"files": [
|
|
@@ -24,17 +25,18 @@
|
|
|
24
25
|
"license": "MIT",
|
|
25
26
|
"homepage": "https://opentiny.design/tiny-engine",
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@opentiny/tiny-engine-
|
|
28
|
+
"@opentiny/tiny-engine-common": "2.0.0-alpha.3",
|
|
29
|
+
"@opentiny/tiny-engine-meta-register": "2.0.0-alpha.3"
|
|
28
30
|
},
|
|
29
31
|
"devDependencies": {
|
|
30
|
-
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-alpha.
|
|
31
|
-
"@vitejs/plugin-vue": "^
|
|
32
|
-
"@vitejs/plugin-vue-jsx": "^
|
|
33
|
-
"vite": "^4.
|
|
32
|
+
"@opentiny/tiny-engine-vite-plugin-meta-comments": "2.0.0-alpha.3",
|
|
33
|
+
"@vitejs/plugin-vue": "^5.1.2",
|
|
34
|
+
"@vitejs/plugin-vue-jsx": "^4.0.1",
|
|
35
|
+
"vite": "^5.4.2"
|
|
34
36
|
},
|
|
35
37
|
"peerDependencies": {
|
|
36
38
|
"@opentiny/vue": "^3.14.0",
|
|
37
39
|
"vue": "^3.4.15"
|
|
38
40
|
},
|
|
39
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "20aba1ffa81a1633feec954e3146586193c18f22"
|
|
40
42
|
}
|