@opentiny/tiny-engine-toolbar-view-setting 2.6.1 → 2.7.0-alpha.0
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 +112 -84
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,66 +1,79 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { callEntry as T } from "@opentiny/tiny-engine-meta-register";
|
|
2
|
+
import { getCurrentInstance as M, onMounted as V, nextTick as x, getCurrentScope as B, onScopeDispose as N, ref as u, watch as P, computed as A, resolveComponent as Q, createBlock as k, openBlock as L } from "vue";
|
|
3
|
+
import { ToolbarBase as p } from "@opentiny/tiny-engine-common";
|
|
4
|
+
import { constants as y } from "@opentiny/tiny-engine-utils";
|
|
5
|
+
const R = {
|
|
6
|
+
id: "engine.toolbars.viewSetting",
|
|
7
|
+
type: "toolbars",
|
|
8
|
+
title: "viewSetting",
|
|
9
|
+
options: {
|
|
10
|
+
icon: {
|
|
11
|
+
default: "routerview"
|
|
12
|
+
},
|
|
13
|
+
renderType: "icon",
|
|
14
|
+
collapsed: !0
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var v;
|
|
18
|
+
const E = typeof window < "u";
|
|
19
|
+
E && ((v = window == null ? void 0 : window.navigator) != null && v.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
|
|
20
|
+
function D(e) {
|
|
8
21
|
return e;
|
|
9
22
|
}
|
|
10
|
-
function
|
|
11
|
-
return
|
|
23
|
+
function W(e) {
|
|
24
|
+
return B() ? (N(e), !0) : !1;
|
|
12
25
|
}
|
|
13
|
-
function
|
|
14
|
-
|
|
26
|
+
function h(e, n = !0) {
|
|
27
|
+
M() ? V(e) : n ? e() : x(e);
|
|
15
28
|
}
|
|
16
|
-
const
|
|
17
|
-
function
|
|
29
|
+
const j = E ? window : void 0;
|
|
30
|
+
function G(e, n = !1) {
|
|
18
31
|
const t = u(), o = () => t.value = !!e();
|
|
19
|
-
return o(),
|
|
32
|
+
return o(), h(o, n), t;
|
|
20
33
|
}
|
|
21
|
-
const
|
|
34
|
+
const f = (e) => {
|
|
22
35
|
const {
|
|
23
36
|
name: n,
|
|
24
|
-
window: t =
|
|
25
|
-
} = e, o =
|
|
26
|
-
a.value && a.value.postMessage(
|
|
27
|
-
},
|
|
37
|
+
window: t = j
|
|
38
|
+
} = e, o = G(() => t && "BroadcastChannel" in t), s = u(!1), a = u(), r = u(), l = u(null), S = (i) => {
|
|
39
|
+
a.value && a.value.postMessage(i);
|
|
40
|
+
}, d = () => {
|
|
28
41
|
a.value && a.value.close(), s.value = !0;
|
|
29
42
|
};
|
|
30
|
-
return o.value &&
|
|
31
|
-
|
|
32
|
-
r.value =
|
|
33
|
-
}, { passive: !0 }), a.value.addEventListener("messageerror", (
|
|
34
|
-
|
|
43
|
+
return o.value && h(() => {
|
|
44
|
+
l.value = null, a.value = new BroadcastChannel(n), a.value.addEventListener("message", (i) => {
|
|
45
|
+
r.value = i.data;
|
|
46
|
+
}, { passive: !0 }), a.value.addEventListener("messageerror", (i) => {
|
|
47
|
+
l.value = i;
|
|
35
48
|
}, { passive: !0 }), a.value.addEventListener("close", () => {
|
|
36
49
|
s.value = !0;
|
|
37
50
|
});
|
|
38
|
-
}),
|
|
39
|
-
|
|
51
|
+
}), W(() => {
|
|
52
|
+
d();
|
|
40
53
|
}), {
|
|
41
54
|
isSupported: o,
|
|
42
55
|
channel: a,
|
|
43
56
|
data: r,
|
|
44
|
-
post:
|
|
45
|
-
close:
|
|
46
|
-
error:
|
|
57
|
+
post: S,
|
|
58
|
+
close: d,
|
|
59
|
+
error: l,
|
|
47
60
|
isClosed: s
|
|
48
61
|
};
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
var
|
|
62
|
+
}, _ = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, O = "__vueuse_ssr_handlers__";
|
|
63
|
+
_[O] = _[O] || {};
|
|
64
|
+
var w;
|
|
52
65
|
(function(e) {
|
|
53
66
|
e.UP = "UP", e.RIGHT = "RIGHT", e.DOWN = "DOWN", e.LEFT = "LEFT", e.NONE = "NONE";
|
|
54
|
-
})(
|
|
55
|
-
var
|
|
67
|
+
})(w || (w = {}));
|
|
68
|
+
var H = Object.defineProperty, g = Object.getOwnPropertySymbols, U = Object.prototype.hasOwnProperty, F = Object.prototype.propertyIsEnumerable, m = (e, n, t) => n in e ? H(e, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[n] = t, K = (e, n) => {
|
|
56
69
|
for (var t in n || (n = {}))
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
for (var t of
|
|
60
|
-
|
|
70
|
+
U.call(n, t) && m(e, t, n[t]);
|
|
71
|
+
if (g)
|
|
72
|
+
for (var t of g(n))
|
|
73
|
+
F.call(n, t) && m(e, t, n[t]);
|
|
61
74
|
return e;
|
|
62
75
|
};
|
|
63
|
-
const
|
|
76
|
+
const Y = {
|
|
64
77
|
easeInSine: [0.12, 0, 0.39, 0],
|
|
65
78
|
easeOutSine: [0.61, 1, 0.88, 1],
|
|
66
79
|
easeInOutSine: [0.37, 0, 0.63, 1],
|
|
@@ -86,20 +99,23 @@ const G = {
|
|
|
86
99
|
easeOutBack: [0.34, 1.56, 0.64, 1],
|
|
87
100
|
easeInOutBack: [0.68, -0.6, 0.32, 1.6]
|
|
88
101
|
};
|
|
89
|
-
|
|
90
|
-
linear:
|
|
91
|
-
},
|
|
92
|
-
const {
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
K({
|
|
103
|
+
linear: D
|
|
104
|
+
}, Y);
|
|
105
|
+
const {
|
|
106
|
+
BROADCAST_CHANNEL: b,
|
|
107
|
+
CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY: c
|
|
108
|
+
} = y;
|
|
109
|
+
function I() {
|
|
110
|
+
const e = localStorage.getItem(c) || "";
|
|
95
111
|
return ["embedded", "standalone"].includes(e) ? e : "embedded";
|
|
96
112
|
}
|
|
97
|
-
function
|
|
98
|
-
localStorage.setItem(
|
|
113
|
+
function C(e) {
|
|
114
|
+
localStorage.setItem(c, e);
|
|
99
115
|
}
|
|
100
|
-
const
|
|
116
|
+
const q = {
|
|
101
117
|
components: {
|
|
102
|
-
ToolbarBase:
|
|
118
|
+
ToolbarBase: p
|
|
103
119
|
},
|
|
104
120
|
props: {
|
|
105
121
|
options: {
|
|
@@ -108,62 +124,74 @@ const K = {
|
|
|
108
124
|
}
|
|
109
125
|
},
|
|
110
126
|
setup() {
|
|
111
|
-
const e = u(
|
|
112
|
-
|
|
127
|
+
const e = u(I()), {
|
|
128
|
+
post: n,
|
|
129
|
+
data: t
|
|
130
|
+
} = f({
|
|
131
|
+
name: b.CanvasRouterViewSetting
|
|
132
|
+
});
|
|
133
|
+
P(t, () => {
|
|
113
134
|
e.value = t.value;
|
|
114
135
|
});
|
|
115
|
-
const o = [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
136
|
+
const o = [{
|
|
137
|
+
value: "embedded",
|
|
138
|
+
label: "嵌套视图"
|
|
139
|
+
}, {
|
|
140
|
+
value: "standalone",
|
|
141
|
+
label: "单页视图"
|
|
142
|
+
}], s = A(() => o.find(({
|
|
143
|
+
value: r
|
|
144
|
+
}) => r !== e.value) || o[1]), a = T(() => {
|
|
145
|
+
e.value = e.value === o[0].value ? o[1].value : o[0].value, C(e.value), n({
|
|
146
|
+
viewMode: e.value
|
|
147
|
+
});
|
|
148
|
+
}, {
|
|
149
|
+
metaData: {
|
|
150
|
+
id: "engine.toolbars.view-setting.Main.changeViewMode"
|
|
119
151
|
},
|
|
120
|
-
{
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
152
|
+
ctx: () => ({
|
|
153
|
+
viewMode: e,
|
|
154
|
+
post: n,
|
|
155
|
+
data: t,
|
|
156
|
+
viewModeOptions: o,
|
|
157
|
+
nextViewMode: s,
|
|
158
|
+
changeViewMode: a,
|
|
159
|
+
useBroadcastChannel: f,
|
|
160
|
+
ToolbarBase: p,
|
|
161
|
+
constants: y,
|
|
162
|
+
BROADCAST_CHANNEL: b,
|
|
163
|
+
CANVAS_ROUTER_VIEW_SETTING_VIEW_MODE_KEY: c,
|
|
164
|
+
getCacheValue: I,
|
|
165
|
+
setCacheValue: C
|
|
166
|
+
})
|
|
167
|
+
});
|
|
127
168
|
return {
|
|
128
169
|
viewModeOptions: o,
|
|
129
170
|
viewMode: e,
|
|
130
|
-
changeViewMode:
|
|
131
|
-
e.value = e.value === o[0].value ? o[1].value : o[0].value, F(e.value), n({ viewMode: e.value });
|
|
132
|
-
},
|
|
171
|
+
changeViewMode: a,
|
|
133
172
|
nextViewMode: s
|
|
134
173
|
};
|
|
135
174
|
}
|
|
136
|
-
},
|
|
175
|
+
}, z = (e, n) => {
|
|
137
176
|
const t = e.__vccOpts || e;
|
|
138
177
|
for (const [o, s] of n)
|
|
139
178
|
t[o] = s;
|
|
140
179
|
return t;
|
|
141
180
|
};
|
|
142
|
-
function
|
|
143
|
-
const r =
|
|
144
|
-
return
|
|
181
|
+
function J(e, n, t, o, s, a) {
|
|
182
|
+
const r = Q("toolbar-base");
|
|
183
|
+
return L(), k(r, {
|
|
145
184
|
content: `切换到${o.nextViewMode.label}`,
|
|
146
185
|
icon: t.options.icon.default || t.options.icon,
|
|
147
186
|
options: t.options,
|
|
148
187
|
onClickApi: o.changeViewMode
|
|
149
188
|
}, null, 8, ["content", "icon", "options", "onClickApi"]);
|
|
150
189
|
}
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
title: "viewSetting",
|
|
155
|
-
options: {
|
|
156
|
-
icon: {
|
|
157
|
-
default: "routerview"
|
|
158
|
-
},
|
|
159
|
-
renderType: "icon",
|
|
160
|
-
collapsed: !0
|
|
161
|
-
}
|
|
162
|
-
}, ee = {
|
|
163
|
-
...J,
|
|
164
|
-
entry: z
|
|
190
|
+
const X = /* @__PURE__ */ z(q, [["render", J]]), ne = {
|
|
191
|
+
...R,
|
|
192
|
+
entry: X
|
|
165
193
|
};
|
|
166
194
|
export {
|
|
167
|
-
|
|
195
|
+
ne as default
|
|
168
196
|
};
|
|
169
197
|
//# sourceMappingURL=index.js.map
|