@opentiny/tiny-engine-toolbar-media 1.0.3 → 1.0.4
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 +127 -127
- package/dist/style.css +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import "./style.css";
|
|
2
|
-
import { ref as
|
|
3
|
-
import { Popover as
|
|
2
|
+
import { ref as k, computed as A, reactive as Q, toRaw as Y, watch as E, watchEffect as Z, onMounted as $, onUnmounted as ee, resolveComponent as C, openBlock as x, createElementBlock as W, createElementVNode as t, Fragment as te, renderList as ne, normalizeClass as ie, createVNode as w, withCtx as p, toDisplayString as r, createTextVNode as T, createBlock as F, createCommentVNode as I } from "vue";
|
|
3
|
+
import { Popover as oe, Input as ae, Switch as le } from "@opentiny/vue";
|
|
4
4
|
import { IconWebPlus as P } from "@opentiny/vue-icon";
|
|
5
|
-
import { useLayout as
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, pe = {
|
|
5
|
+
import { useLayout as g, useCanvas as L } from "@opentiny/tiny-engine-controller";
|
|
6
|
+
const se = (b, n) => {
|
|
7
|
+
const c = b.__vccOpts || b;
|
|
8
|
+
for (const [i, u] of n)
|
|
9
|
+
c[i] = u;
|
|
10
|
+
return c;
|
|
11
|
+
}, de = {
|
|
13
12
|
components: {
|
|
14
|
-
TinyPopover:
|
|
15
|
-
TinyInput:
|
|
13
|
+
TinyPopover: oe,
|
|
14
|
+
TinyInput: ae,
|
|
16
15
|
TinySwitch: le
|
|
17
16
|
},
|
|
18
17
|
props: {
|
|
@@ -25,9 +24,9 @@ const re = (d, l) => {
|
|
|
25
24
|
default: !0
|
|
26
25
|
}
|
|
27
26
|
},
|
|
28
|
-
setup(
|
|
29
|
-
let
|
|
30
|
-
const { layoutState:
|
|
27
|
+
setup(b, { emit: n }) {
|
|
28
|
+
let c = null, i = "", u = "";
|
|
29
|
+
const { layoutState: y } = g(), m = k(!1), v = k(!1), h = k(!1), { getCanvasType: f } = L().canvasApi.value, l = k((f == null ? void 0 : f()) === "absolute"), d = A(() => g().getDimension()), _ = A(() => d.value.scale * 100), o = Q({
|
|
31
30
|
activeIndex: 0,
|
|
32
31
|
guideValue: "",
|
|
33
32
|
width: "",
|
|
@@ -145,112 +144,111 @@ const re = (d, l) => {
|
|
|
145
144
|
}
|
|
146
145
|
]
|
|
147
146
|
}), B = () => {
|
|
148
|
-
|
|
147
|
+
v.value = !1;
|
|
149
148
|
}, U = () => {
|
|
150
|
-
|
|
149
|
+
c = setTimeout(() => {
|
|
151
150
|
m.value = !0;
|
|
152
151
|
}, 1e3);
|
|
153
|
-
}, A = () => {
|
|
154
|
-
m.value = !1, clearTimeout(r);
|
|
155
152
|
}, O = () => {
|
|
156
|
-
|
|
153
|
+
m.value = !1, clearTimeout(c);
|
|
157
154
|
}, X = () => {
|
|
158
|
-
|
|
155
|
+
y.toolbars.visiblePopover = !0, h.value = !0;
|
|
156
|
+
}, q = () => {
|
|
157
|
+
y.toolbars.visiblePopover = !1, h.value = !1;
|
|
159
158
|
}, D = (e) => {
|
|
160
159
|
const a = document.querySelector(".reference-text"), s = a == null ? void 0 : a.contains(e.target);
|
|
161
|
-
a !== e.target && !s && (
|
|
162
|
-
},
|
|
163
|
-
|
|
160
|
+
a !== e.target && !s && (y.toolbars.visiblePopover = !1);
|
|
161
|
+
}, V = o.media.reduce((e, a, s) => (e[a.view] = { ...Y(a), index: s }, e), {}), N = (e) => {
|
|
162
|
+
b.isCanvas ? g().setDimension({
|
|
164
163
|
deviceType: e.view,
|
|
165
164
|
width: e.width,
|
|
166
165
|
minWidth: e.minWidth,
|
|
167
166
|
maxWidth: e.maxWidth
|
|
168
|
-
}) : (
|
|
169
|
-
},
|
|
170
|
-
const s =
|
|
171
|
-
|
|
167
|
+
}) : (o.activeIndex = e.idx, n("setViewPort", e.width));
|
|
168
|
+
}, z = (e, a) => {
|
|
169
|
+
const s = V[a];
|
|
170
|
+
g().setDimension({
|
|
172
171
|
deviceType: s.view,
|
|
173
172
|
width: e ? `${e}px` : s.width,
|
|
174
173
|
minWidth: s.minWidth,
|
|
175
174
|
maxWidth: s.maxWidth
|
|
176
175
|
});
|
|
177
|
-
},
|
|
176
|
+
}, R = [
|
|
178
177
|
{ type: "mobile", min: 240, max: 480 },
|
|
179
178
|
{ type: "lanMobile", min: 480, max: 768 },
|
|
180
179
|
{ type: "tablet", min: 768, max: 992 },
|
|
181
180
|
{ type: "desktop", min: 992, max: 1200 },
|
|
182
181
|
{ type: "mdx", min: 1200, max: 1920 }
|
|
183
|
-
],
|
|
182
|
+
], j = (e) => {
|
|
184
183
|
var S;
|
|
185
184
|
const a = /^\d+$/;
|
|
186
|
-
String(e).match(a) ? Number(e) < 240 ?
|
|
187
|
-
const s = Number(
|
|
188
|
-
|
|
189
|
-
}, j = (e) => {
|
|
190
|
-
const a = g.mdx, s = /^\d+(\.\d+)?$/;
|
|
191
|
-
String(e).match(s) ? Number(e) > 100 ? i.scaleValue = 100 : Number(e) < 20 ? i.scaleValue = 20 : i.scaleValue = e : i.scaleValue = u || parseInt(a.scale), i.scaleValue = Number(i.scaleValue).toFixed(2), y().setDimension({
|
|
192
|
-
scale: Number(i.scaleValue) / 100
|
|
193
|
-
});
|
|
185
|
+
String(e).match(a) ? Number(e) < 240 ? o.width = 240 : Number(e) > 1920 ? o.width = 1920 : o.width = e : o.width = i || parseInt(d.value.width, 10);
|
|
186
|
+
const s = Number(o.width), K = ((S = R.find((M) => M.min <= s && s <= M.max)) == null ? void 0 : S.type) || "desktop";
|
|
187
|
+
z(s, K);
|
|
194
188
|
}, G = (e) => {
|
|
195
|
-
|
|
189
|
+
const a = V.mdx, s = /^\d+(\.\d+)?$/;
|
|
190
|
+
String(e).match(s) ? Number(e) > 100 ? o.scaleValue = 100 : Number(e) < 20 ? o.scaleValue = 20 : o.scaleValue = e : o.scaleValue = u || parseInt(a.scale), o.scaleValue = Number(o.scaleValue).toFixed(2), g().setDimension({
|
|
191
|
+
scale: Number(o.scaleValue) / 100
|
|
192
|
+
});
|
|
193
|
+
}, H = (e) => {
|
|
194
|
+
const { setCanvasType: a } = L().canvasApi.value;
|
|
195
|
+
a(e ? "absolute" : "normal");
|
|
196
196
|
};
|
|
197
|
-
|
|
198
|
-
() =>
|
|
197
|
+
E(
|
|
198
|
+
() => d.value.deviceType,
|
|
199
199
|
(e) => {
|
|
200
|
-
|
|
200
|
+
o.activeIndex = V[e].index, o.readonly = e !== "mdx";
|
|
201
201
|
},
|
|
202
202
|
{ immediate: !0 }
|
|
203
|
-
),
|
|
204
|
-
|
|
205
|
-
}),
|
|
206
|
-
() =>
|
|
203
|
+
), Z(() => {
|
|
204
|
+
o.scaleValue = _.value.toFixed(2), u = _.value;
|
|
205
|
+
}), E(
|
|
206
|
+
() => d.value.width,
|
|
207
207
|
(e) => {
|
|
208
208
|
const a = parseInt(e, 10);
|
|
209
|
-
Number.isInteger(a) && (
|
|
209
|
+
Number.isInteger(a) && (o.width = a, i = a);
|
|
210
210
|
}
|
|
211
|
-
),
|
|
211
|
+
), $(() => {
|
|
212
212
|
document.addEventListener("click", D);
|
|
213
|
-
}),
|
|
213
|
+
}), ee(() => {
|
|
214
214
|
document.removeEventListener("click", D);
|
|
215
215
|
});
|
|
216
|
-
const
|
|
217
|
-
return N(
|
|
218
|
-
scale:
|
|
219
|
-
state:
|
|
220
|
-
active:
|
|
221
|
-
flag:
|
|
216
|
+
const J = d.value.deviceType || "desktop";
|
|
217
|
+
return N(V[J]), {
|
|
218
|
+
scale: _,
|
|
219
|
+
state: o,
|
|
220
|
+
active: v,
|
|
221
|
+
flag: h,
|
|
222
222
|
hide: B,
|
|
223
|
-
layoutState:
|
|
223
|
+
layoutState: y,
|
|
224
224
|
visible: m,
|
|
225
225
|
showTips: U,
|
|
226
|
-
hideTips:
|
|
227
|
-
timer:
|
|
228
|
-
dimension:
|
|
226
|
+
hideTips: O,
|
|
227
|
+
timer: c,
|
|
228
|
+
dimension: d,
|
|
229
229
|
setViewPort: N,
|
|
230
|
-
showPopover:
|
|
231
|
-
hidePopover:
|
|
232
|
-
widthChange:
|
|
233
|
-
scaleChange:
|
|
234
|
-
isAbsolute:
|
|
235
|
-
changeCanvasType:
|
|
230
|
+
showPopover: X,
|
|
231
|
+
hidePopover: q,
|
|
232
|
+
widthChange: j,
|
|
233
|
+
scaleChange: G,
|
|
234
|
+
isAbsolute: l,
|
|
235
|
+
changeCanvasType: H
|
|
236
236
|
};
|
|
237
237
|
}
|
|
238
|
-
},
|
|
238
|
+
}, re = { class: "toolbar-wrap" }, ce = { class: "toolbar-icon-wrap" }, pe = ["onClick"], ue = { class: "media-content" }, me = { class: "media-title" }, ve = {
|
|
239
239
|
key: 0,
|
|
240
240
|
class: "sub-title"
|
|
241
|
-
},
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
class: ne(["icon", { active: n.state.activeIndex === x, "is-rotate": o.view === "lanMobile" }]),
|
|
251
|
-
onClick: (i) => n.setViewPort(o)
|
|
241
|
+
}, he = { class: "content" }, xe = { class: "reference-text" }, we = { class: "content-wrap text-content" }, be = { class: "title text-title" }, ye = { class: "setting" }, fe = { for: "" }, ge = { for: "" }, _e = { class: "more-setting" };
|
|
242
|
+
function Ve(b, n, c, i, u, y) {
|
|
243
|
+
const m = C("svg-icon"), v = C("tiny-popover"), h = C("tiny-input"), f = C("tiny-switch");
|
|
244
|
+
return x(), W("div", re, [
|
|
245
|
+
t("div", ce, [
|
|
246
|
+
(x(!0), W(te, null, ne(i.state.media, (l, d) => (x(), W("span", {
|
|
247
|
+
key: d,
|
|
248
|
+
class: ie(["icon", { active: i.state.activeIndex === d, "is-rotate": l.view === "lanMobile" }]),
|
|
249
|
+
onClick: (_) => i.setViewPort(l)
|
|
252
250
|
}, [
|
|
253
|
-
|
|
251
|
+
w(v, {
|
|
254
252
|
trigger: "hover",
|
|
255
253
|
width: "225",
|
|
256
254
|
"append-to-body": "",
|
|
@@ -258,41 +256,41 @@ function Ne(d, l, r, n, u, b) {
|
|
|
258
256
|
"popper-class": "media-icon-popover"
|
|
259
257
|
}, {
|
|
260
258
|
reference: p(() => [
|
|
261
|
-
|
|
262
|
-
name:
|
|
259
|
+
w(m, {
|
|
260
|
+
name: l.liked,
|
|
263
261
|
class: "media-icon"
|
|
264
262
|
}, null, 8, ["name"])
|
|
265
263
|
]),
|
|
266
264
|
default: p(() => [
|
|
267
|
-
t("div",
|
|
268
|
-
t("div",
|
|
269
|
-
t("div", null,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
265
|
+
t("div", ue, [
|
|
266
|
+
t("div", me, [
|
|
267
|
+
t("div", null, r(l.title), 1),
|
|
268
|
+
l.subTitle ? (x(), W("div", ve, [
|
|
269
|
+
n[3] || (n[3] = T(" (")),
|
|
270
|
+
l.view === "desktop" ? (x(), F(m, {
|
|
273
271
|
key: 0,
|
|
274
272
|
name: "stars"
|
|
275
273
|
})) : I("", !0),
|
|
276
|
-
|
|
277
|
-
t("span", null,
|
|
278
|
-
|
|
274
|
+
n[4] || (n[4] = T()),
|
|
275
|
+
t("span", null, r(l.subTitle), 1),
|
|
276
|
+
n[5] || (n[5] = T(") "))
|
|
279
277
|
])) : I("", !0)
|
|
280
278
|
]),
|
|
281
|
-
t("div",
|
|
279
|
+
t("div", he, r(l.content), 1)
|
|
282
280
|
])
|
|
283
281
|
]),
|
|
284
282
|
_: 2
|
|
285
283
|
}, 1024)
|
|
286
|
-
], 10,
|
|
284
|
+
], 10, pe))), 128))
|
|
287
285
|
]),
|
|
288
|
-
|
|
286
|
+
c.isCanvas ? (x(), F(v, {
|
|
289
287
|
key: 0,
|
|
290
288
|
width: "290",
|
|
291
289
|
trigger: "click",
|
|
292
290
|
"popper-class": "toolbar-media-popper"
|
|
293
291
|
}, {
|
|
294
292
|
reference: p(() => [
|
|
295
|
-
|
|
293
|
+
w(v, {
|
|
296
294
|
trigger: "hover",
|
|
297
295
|
"open-delay": 1e3,
|
|
298
296
|
"popper-class": "toolbar-right-popover",
|
|
@@ -300,14 +298,14 @@ function Ne(d, l, r, n, u, b) {
|
|
|
300
298
|
content: "画布设置"
|
|
301
299
|
}, {
|
|
302
300
|
reference: p(() => [
|
|
303
|
-
t("span",
|
|
301
|
+
t("span", xe, [
|
|
304
302
|
t("span", null, [
|
|
305
|
-
t("span", null,
|
|
306
|
-
|
|
303
|
+
t("span", null, r(parseInt(i.state.width)), 1),
|
|
304
|
+
n[6] || (n[6] = t("span", { class: "symbol" }, "PX", -1))
|
|
307
305
|
]),
|
|
308
306
|
t("span", null, [
|
|
309
|
-
t("span", null,
|
|
310
|
-
|
|
307
|
+
t("span", null, r(i.scale.toFixed(2)), 1),
|
|
308
|
+
n[7] || (n[7] = t("span", { class: "symbol" }, "%", -1))
|
|
311
309
|
])
|
|
312
310
|
])
|
|
313
311
|
]),
|
|
@@ -315,45 +313,47 @@ function Ne(d, l, r, n, u, b) {
|
|
|
315
313
|
})
|
|
316
314
|
]),
|
|
317
315
|
default: p(() => [
|
|
318
|
-
t("div",
|
|
319
|
-
t("span",
|
|
320
|
-
t("div",
|
|
316
|
+
t("div", we, [
|
|
317
|
+
t("span", be, r(i.state.textData.title), 1),
|
|
318
|
+
t("div", ye, [
|
|
321
319
|
t("div", null, [
|
|
322
|
-
t("label",
|
|
323
|
-
|
|
324
|
-
modelValue:
|
|
325
|
-
"onUpdate:modelValue":
|
|
326
|
-
onChange:
|
|
320
|
+
t("label", fe, r(i.state.textData.width), 1),
|
|
321
|
+
w(h, {
|
|
322
|
+
modelValue: i.state.width,
|
|
323
|
+
"onUpdate:modelValue": n[0] || (n[0] = (l) => i.state.width = l),
|
|
324
|
+
onChange: i.widthChange
|
|
327
325
|
}, {
|
|
328
|
-
suffix: p(() => [
|
|
329
|
-
|
|
330
|
-
]),
|
|
326
|
+
suffix: p(() => n[8] || (n[8] = [
|
|
327
|
+
t("span", null, "PX", -1)
|
|
328
|
+
])),
|
|
331
329
|
_: 1
|
|
332
330
|
}, 8, ["modelValue", "onChange"])
|
|
333
331
|
]),
|
|
334
332
|
t("div", null, [
|
|
335
|
-
t("label",
|
|
336
|
-
|
|
337
|
-
modelValue:
|
|
338
|
-
"onUpdate:modelValue":
|
|
339
|
-
readonly:
|
|
340
|
-
onChange:
|
|
333
|
+
t("label", ge, r(i.state.textData.scale), 1),
|
|
334
|
+
w(h, {
|
|
335
|
+
modelValue: i.state.scaleValue,
|
|
336
|
+
"onUpdate:modelValue": n[1] || (n[1] = (l) => i.state.scaleValue = l),
|
|
337
|
+
readonly: i.state.readonly,
|
|
338
|
+
onChange: i.scaleChange
|
|
341
339
|
}, {
|
|
342
|
-
suffix: p(() => [
|
|
343
|
-
|
|
344
|
-
]),
|
|
340
|
+
suffix: p(() => n[9] || (n[9] = [
|
|
341
|
+
t("span", null, "%", -1)
|
|
342
|
+
])),
|
|
345
343
|
_: 1
|
|
346
344
|
}, 8, ["modelValue", "readonly", "onChange"])
|
|
347
345
|
])
|
|
348
346
|
]),
|
|
349
|
-
t("ul",
|
|
347
|
+
t("ul", _e, [
|
|
350
348
|
t("li", null, [
|
|
351
|
-
|
|
349
|
+
n[10] || (n[10] = t("div", null, [
|
|
350
|
+
t("span", null, r("自由布局"))
|
|
351
|
+
], -1)),
|
|
352
352
|
t("div", null, [
|
|
353
|
-
|
|
354
|
-
modelValue:
|
|
355
|
-
"onUpdate:modelValue":
|
|
356
|
-
onChange:
|
|
353
|
+
w(f, {
|
|
354
|
+
modelValue: i.isAbsolute,
|
|
355
|
+
"onUpdate:modelValue": n[2] || (n[2] = (l) => i.isAbsolute = l),
|
|
356
|
+
onChange: i.changeCanvasType
|
|
357
357
|
}, null, 8, ["modelValue", "onChange"])
|
|
358
358
|
])
|
|
359
359
|
])
|
|
@@ -364,13 +364,13 @@ function Ne(d, l, r, n, u, b) {
|
|
|
364
364
|
})) : I("", !0)
|
|
365
365
|
]);
|
|
366
366
|
}
|
|
367
|
-
const
|
|
367
|
+
const ke = /* @__PURE__ */ se(de, [["render", Ve], ["__scopeId", "data-v-4f3e1155"]]), De = {
|
|
368
368
|
id: "media",
|
|
369
369
|
title: "media",
|
|
370
370
|
icon: "",
|
|
371
371
|
align: "center",
|
|
372
|
-
component:
|
|
372
|
+
component: ke
|
|
373
373
|
};
|
|
374
374
|
export {
|
|
375
|
-
|
|
375
|
+
De as default
|
|
376
376
|
};
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.toolbar-wrap[data-v-
|
|
1
|
+
.toolbar-wrap[data-v-4f3e1155]{display:flex;align-items:center}.toolbar-wrap .reference-text[data-v-4f3e1155]{cursor:pointer;height:var(--base-top-panel-height);line-height:var(--base-top-panel-height);padding:0 7px;color:var(--ti-lowcode-toolbar-breadcrumb-color);display:inline-block}.toolbar-wrap .reference-text>span[data-v-4f3e1155]:last-child{margin-left:8px}.toolbar-wrap .toolbar-icon-wrap[data-v-4f3e1155]{display:flex;flex-wrap:nowrap;align-items:center;gap:6px}.toolbar-wrap .toolbar-icon-wrap .icon[data-v-4f3e1155]{width:32px;height:32px;display:inline-flex;justify-content:center;align-items:center;border-radius:6px}.toolbar-wrap .toolbar-icon-wrap .icon svg[data-v-4f3e1155]{cursor:pointer;color:var(--ti-lowcode-toolbar-title-color);outline:none;width:22px;height:22px;margin-top:-.5px}.toolbar-wrap .toolbar-icon-wrap .icon.active[data-v-4f3e1155],.toolbar-wrap .toolbar-icon-wrap .icon[data-v-4f3e1155]:hover{background:var(--ti-lowcode-toolbar-view-active-bg)}.toolbar-wrap .toolbar-icon-wrap .icon.active svg[data-v-4f3e1155]{color:var(--ti-lowcode-common-primary-color)}.toolbar-wrap .more-setting .setting-item[data-v-4f3e1155]{display:flex;justify-content:space-between;padding:12px}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentiny/tiny-engine-toolbar-media",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"homepage": "https://opentiny.design/tiny-engine",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@opentiny/tiny-engine-canvas": "1.0.
|
|
28
|
-
"@opentiny/tiny-engine-controller": "1.0.
|
|
29
|
-
"@opentiny/vue": "~3.10.0",
|
|
30
|
-
"@opentiny/vue-icon": "~3.10.0"
|
|
27
|
+
"@opentiny/tiny-engine-canvas": "1.0.4",
|
|
28
|
+
"@opentiny/tiny-engine-controller": "1.0.4"
|
|
31
29
|
},
|
|
32
30
|
"devDependencies": {
|
|
33
31
|
"@vitejs/plugin-vue": "^4.2.3",
|
|
34
|
-
"@vitejs/plugin-vue-jsx": "^1.
|
|
32
|
+
"@vitejs/plugin-vue-jsx": "^3.1.0",
|
|
35
33
|
"vite": "^4.3.7"
|
|
36
34
|
},
|
|
37
35
|
"peerDependencies": {
|
|
36
|
+
"@opentiny/vue": "^3.14.0",
|
|
37
|
+
"@opentiny/vue-icon": "^3.14.0",
|
|
38
38
|
"vue": "^3.4.15"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "aa79110d52c3e77f6e664c22983c93bd74d9406d"
|
|
41
41
|
}
|