@opentiny/tiny-robot 0.3.0-alpha.2 → 0.3.0-alpha.21

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.
@@ -1,60 +1,64 @@
1
- import { defineComponent as m, useCssVars as v, useModel as d, computed as _, createElementBlock as w, openBlock as g, createElementVNode as n, renderSlot as r, createVNode as c, unref as a } from "vue";
2
- import { l as h, w as $, s as C } from "../tiny-robot-svgs.js";
3
- import u from "../icon-button/index.js";
1
+ import { defineComponent as g, mergeModels as c, useModel as u, computed as w, withDirectives as C, createElementBlock as B, openBlock as S, normalizeClass as y, createElementVNode as e, renderSlot as l, toDisplayString as I, createVNode as d, unref as i, vShow as z } from "vue";
2
+ import { IconCancelFullScreen as $, IconFullScreen as k, IconClose as M } from "@opentiny/tiny-robot-svgs";
3
+ import f from "../icon-button/index.js";
4
4
  import { _ as b } from "../_plugin-vue_export-helper.js";
5
- const z = { class: "tr-container" }, B = { class: "tr-container__header" }, k = { class: "tr-container__header-operations" }, y = { class: "tr-container__footer" }, E = /* @__PURE__ */ m({
5
+ const E = { class: "tr-container__header" }, F = { class: "tr-container__title" }, N = { class: "tr-container__header-operations" }, T = { class: "tr-container__footer" }, D = /* @__PURE__ */ g({
6
6
  __name: "index",
7
- props: {
7
+ props: /* @__PURE__ */ c({
8
+ show: { type: Boolean },
9
+ fullscreen: { type: Boolean },
10
+ title: { default: "OpenTiny NEXT" }
11
+ }, {
8
12
  show: { type: Boolean, required: !0 },
9
13
  showModifiers: {},
10
14
  fullscreen: { type: Boolean },
11
15
  fullscreenModifiers: {}
12
- },
13
- emits: ["update:show", "update:fullscreen"],
14
- setup(o) {
15
- v((t) => ({
16
- "1daf37f2": s.value ? "0" : "unset",
17
- "0679141a": s.value ? "unset" : "var(--tr-container-width)",
18
- "234493b2": l.value ? "var(--tr-z-index-fixed)" : "-1",
19
- "0c2ba509": l.value ? "1" : "0"
20
- }));
21
- const l = d(o, "show"), s = d(o, "fullscreen"), f = _(() => s.value ? h : $);
22
- return (t, e) => (g(), w("div", z, [
23
- e[3] || (e[3] = n("div", { class: "tr-container__dragging-bar-wrapper" }, [
24
- n("div", { class: "tr-container__dragging-bar" })
16
+ }),
17
+ emits: /* @__PURE__ */ c(["close"], ["update:show", "update:fullscreen"]),
18
+ setup(o, { emit: p }) {
19
+ const m = o, a = u(o, "show"), t = u(o, "fullscreen"), v = w(() => t.value ? $ : k), _ = p, h = () => {
20
+ a.value = !1, _("close");
21
+ };
22
+ return (n, s) => C((S(), B("div", {
23
+ class: y(["tr-container", { fullscreen: t.value }])
24
+ }, [
25
+ s[1] || (s[1] = e("div", { class: "tr-container__dragging-bar-wrapper" }, [
26
+ e("div", { class: "tr-container__dragging-bar" })
25
27
  ], -1)),
26
- n("div", B, [
27
- r(t.$slots, "title", {}, () => [
28
- e[2] || (e[2] = n("h3", { class: "tr-container__title" }, "OpenTiny NEXT", -1))
29
- ]),
30
- n("div", k, [
31
- r(t.$slots, "operations"),
32
- c(a(u), {
28
+ e("div", E, [
29
+ l(n.$slots, "title", {}, () => [
30
+ e("h3", F, I(m.title), 1)
31
+ ], !0),
32
+ e("div", N, [
33
+ l(n.$slots, "operations", {}, void 0, !0),
34
+ d(i(f), {
33
35
  size: "28",
34
36
  "svg-size": "20",
35
- icon: f.value,
36
- onClick: e[0] || (e[0] = (p) => t.$emit("update:fullscreen", !s.value))
37
+ icon: v.value,
38
+ onClick: s[0] || (s[0] = (q) => t.value = !t.value)
37
39
  }, null, 8, ["icon"]),
38
- c(a(u), {
40
+ d(i(f), {
39
41
  size: "28",
40
42
  "svg-size": "20",
41
- icon: a(C),
42
- onClick: e[1] || (e[1] = (p) => t.$emit("update:show", !1))
43
+ icon: i(M),
44
+ onClick: h
43
45
  }, null, 8, ["icon"])
44
46
  ])
45
47
  ]),
46
- r(t.$slots, "default"),
47
- n("div", y, [
48
- r(t.$slots, "footer")
48
+ l(n.$slots, "default", {}, void 0, !0),
49
+ e("div", T, [
50
+ l(n.$slots, "footer", {}, void 0, !0)
49
51
  ])
50
- ]));
52
+ ], 2)), [
53
+ [z, a.value]
54
+ ]);
51
55
  }
52
- }), i = /* @__PURE__ */ b(E, [["__scopeId", "data-v-6a9b9126"]]);
53
- i.name = "TrContainer";
54
- const I = function(o) {
55
- o.component(i.name, i);
56
+ }), r = /* @__PURE__ */ b(D, [["__scopeId", "data-v-1ebfc5e5"]]);
57
+ r.name = "TrContainer";
58
+ const V = function(o) {
59
+ o.component(r.name, r);
56
60
  };
57
- i.install = I;
61
+ r.install = V;
58
62
  export {
59
- i as default
63
+ r as default
60
64
  };
@@ -0,0 +1,57 @@
1
+ import { defineComponent as v, computed as y, createBlock as u, openBlock as t, Transition as F, withCtx as m, createElementBlock as o, createCommentVNode as h, normalizeStyle as _, normalizeClass as w, renderSlot as x, createElementVNode as l, toDisplayString as s, Fragment as D, renderList as B } from "vue";
2
+ import { a as M } from "../index2.js";
3
+ import { _ as Z } from "../_plugin-vue_export-helper.js";
4
+ const k = "data:image/svg+xml,%3csvg%20width='80.000000'%20height='80.000000'%20viewBox='0%200%2080%2080'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdefs/%3e%3crect%20width='80.000000'%20height='80.000000'%20fill='%23FFFFFF'%20fill-opacity='0'/%3e%3cpath%20d='M10%2014L70%2014C72.2%2014%2074%2015.79%2074%2018L74%2063C74%2065.2%2072.2%2067%2070%2067L10%2067C7.79%2067%206%2065.2%206%2063L6%2018C6%2015.79%207.79%2014%2010%2014Z'%20fill='%23FFFFFF'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3cpath%20d='M10%2014L70%2014C72.2%2014%2074%2015.79%2074%2018L74%2063C74%2065.2%2072.2%2067%2070%2067L10%2067C7.79%2067%206%2065.2%206%2063L6%2018C6%2015.79%207.79%2014%2010%2014ZM10%2015L70%2015C71%2015%2071.75%2015.25%2072.25%2015.75C72.75%2016.25%2073%2017%2073%2018L73%2063C73%2064%2072.75%2064.75%2072.25%2065.25C71.75%2065.75%2071%2066%2070%2066L10%2066C9%2066%208.25%2065.75%207.75%2065.25C7.25%2064.75%207%2064%207%2063L7%2018C7%2017%207.25%2016.25%207.75%2015.75C8.25%2015.25%209%2015%2010%2015Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3cpath%20d='M6%2047.27L24.56%2029.06C25.73%2027.91%2027.6%2027.91%2028.77%2029.06L44.52%2044.51C45.69%2045.66%2047.56%2045.66%2048.72%2044.51L56.64%2036.75C57.8%2035.6%2059.67%2035.6%2060.84%2036.75L74%2049.67L74%2062C74%2064.76%2071.76%2067%2069%2067L11%2067C8.23%2067%206%2064.76%206%2062L6%2047.27Z'%20fill='%23F0F0F0'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3cpath%20d=''%20fill='%23808080'%20fill-opacity='0'%20fill-rule='evenodd'/%3e%3cellipse%20cx='40.000000'%20cy='40.000000'%20rx='8.000001'%20ry='8.000002'%20fill='%231476FF'%20fill-opacity='1.000000'/%3e%3cpath%20d='M40%2035.5C40.27%2035.5%2040.5%2035.72%2040.5%2036L40.5%2039.49L44%2039.5C44.27%2039.5%2044.5%2039.72%2044.5%2040C44.5%2040.27%2044.27%2040.5%2044%2040.5L40.5%2040.5L40.5%2044C40.5%2044.27%2040.27%2044.5%2040%2044.5C39.72%2044.5%2039.5%2044.27%2039.5%2044L39.5%2040.5L36%2040.5C35.72%2040.5%2035.5%2040.27%2035.5%2040C35.5%2039.72%2035.72%2039.5%2036%2039.5L39.5%2039.5L39.5%2036C39.5%2035.72%2039.72%2035.5%2040%2035.5Z'%20fill='%23FFFFFF'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3cpath%20d='M10%2014L70%2014C72.2%2014%2074%2015.79%2074%2018L74%2063C74%2065.2%2072.2%2067%2070%2067L10%2067C7.79%2067%206%2065.2%206%2063L6%2018C6%2015.79%207.79%2014%2010%2014Z'%20fill='%23FFFFFF'%20fill-opacity='0'%20fill-rule='evenodd'/%3e%3cpath%20d='M10%2014L70%2014C72.2%2014%2074%2015.79%2074%2018L74%2063C74%2065.2%2072.2%2067%2070%2067L10%2067C7.79%2067%206%2065.2%206%2063L6%2018C6%2015.79%207.79%2014%2010%2014ZM10%2015L70%2015C71%2015%2071.75%2015.25%2072.25%2015.75C72.75%2016.25%2073%2017%2073%2018L73%2063C73%2064%2072.75%2064.75%2072.25%2065.25C71.75%2065.75%2071%2066%2070%2066L10%2066C9%2066%208.25%2065.75%207.75%2065.25C7.25%2064.75%207%2064%207%2063L7%2018C7%2017%207.25%2016.25%207.75%2015.75C8.25%2015.25%209%2015%2010%2015Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='evenodd'/%3e%3ccircle%20cx='58.000000'%20cy='27.000000'%20r='5.000000'%20fill='%23DBDBDB'%20fill-opacity='1.000000'/%3e%3c/svg%3e", T = { class: "tr-drag-overlay__content" }, $ = { class: "tr-drag-overlay__text" }, S = { class: "tr-drag-overlay__title" }, E = { class: "tr-drag-overlay__description" }, z = /* @__PURE__ */ v({
5
+ __name: "index",
6
+ props: {
7
+ overlayTitle: {},
8
+ overlayDescription: {},
9
+ isDragging: { type: Boolean },
10
+ dragTarget: {},
11
+ fullscreen: { type: Boolean }
12
+ },
13
+ setup(r) {
14
+ const a = r, { top: c, left: d, width: p, height: C } = M(() => a.dragTarget), f = y(() => !a.isDragging || !a.dragTarget ? { display: "none" } : {
15
+ position: "fixed",
16
+ top: `${c.value}px`,
17
+ left: `${d.value}px`,
18
+ width: `${p.value}px`,
19
+ height: `${C.value}px`
20
+ });
21
+ return (e, n) => (t(), u(F, { name: "tr-fade" }, {
22
+ default: m(() => [
23
+ e.isDragging ? (t(), o("div", {
24
+ key: 0,
25
+ class: w(["tr-drag-overlay", { fullscreen: e.fullscreen }]),
26
+ style: _(f.value)
27
+ }, [
28
+ x(e.$slots, "overlay", { isDragging: e.isDragging }, () => [
29
+ l("div", T, [
30
+ n[0] || (n[0] = l("div", { class: "tr-drag-overlay__icon" }, [
31
+ l("img", {
32
+ src: k,
33
+ alt: "上传文件"
34
+ })
35
+ ], -1)),
36
+ l("div", $, [
37
+ l("div", S, s(e.overlayTitle), 1),
38
+ l("div", E, [
39
+ (t(!0), o(D, null, B(e.overlayDescription, (g, L) => (t(), o("span", { key: L }, s(g), 1))), 128))
40
+ ])
41
+ ])
42
+ ])
43
+ ], !0)
44
+ ], 6)) : h("", !0)
45
+ ]),
46
+ _: 3
47
+ }));
48
+ }
49
+ }), i = /* @__PURE__ */ Z(z, [["__scopeId", "data-v-93553cc8"]]);
50
+ i.name = "TrDragOverlay";
51
+ const N = function(r) {
52
+ r.component(i.name, i);
53
+ };
54
+ i.install = N;
55
+ export {
56
+ i as default
57
+ };
@@ -1,72 +1,159 @@
1
- import { defineComponent as B, useCssVars as E, unref as f, useAttrs as N, computed as _, ref as m, watch as O, createElementBlock as o, openBlock as s, Fragment as w, createElementVNode as h, createVNode as W, normalizeStyle as v, normalizeClass as z, renderSlot as I, Transition as A, withCtx as F, createCommentVNode as H, renderList as L, toDisplayString as P } from "vue";
2
- import { c as g, o as U } from "../index2.js";
3
- import { t as n } from "../utils.js";
4
- import { _ as b } from "../_plugin-vue_export-helper.js";
5
- const j = { class: "tr-dropdown-menu__list" }, q = ["onClick"], G = /* @__PURE__ */ B({
1
+ import { ref as k, onUnmounted as T, watch as C, defineComponent as E, mergeModels as y, useModel as H, computed as p, createBlock as I, openBlock as w, unref as X, withCtx as _, createElementVNode as j, createElementBlock as b, Fragment as D, renderList as L, toDisplayString as Y, renderSlot as O } from "vue";
2
+ import { w as S, b as M, o as $ } from "../index2.js";
3
+ import { B as A } from "../index3.js";
4
+ import { u as F } from "../utils.js";
5
+ import { _ as G } from "../_plugin-vue_export-helper.js";
6
+ const P = (o, t) => o.x >= t.left && o.x <= t.right && o.y >= t.top && o.y <= t.bottom, N = (o, t, g = !1) => {
7
+ if (t.length < 3) return !1;
8
+ const l = o.x, d = o.y;
9
+ let f = !1;
10
+ const r = (s, c, a, n, i, e) => {
11
+ const m = (i - a) * (c - n) - (e - n) * (s - a);
12
+ if (Math.abs(m) > 1e-10) return !1;
13
+ const u = Math.min(a, i), h = Math.max(a, i), x = Math.min(n, e), B = Math.max(n, e);
14
+ return s >= u && s <= h && c >= x && c <= B;
15
+ };
16
+ for (let s = 0, c = t.length - 1; s < t.length; c = s++) {
17
+ const a = t[s].x, n = t[s].y, i = t[c].x, e = t[c].y;
18
+ if (g && r(l, d, a, n, i, e))
19
+ return !0;
20
+ if (n > d && e <= d || e > d && n <= d) {
21
+ const u = (i - a) * (d - n) / (e - n) + a;
22
+ l < u && (f = !f);
23
+ }
24
+ }
25
+ return f;
26
+ }, U = (o, t) => t.bottom < o.top ? [
27
+ { x: o.left, y: o.top },
28
+ { x: o.right, y: o.top },
29
+ { x: t.right, y: t.bottom },
30
+ { x: t.left, y: t.bottom }
31
+ ] : t.top > o.bottom ? [
32
+ { x: o.left, y: o.bottom },
33
+ { x: o.right, y: o.bottom },
34
+ { x: t.right, y: t.top },
35
+ { x: t.left, y: t.top }
36
+ ] : [], { x: V, y: q } = F(), z = (o, t, g) => {
37
+ const { delayEnter: l = 0, delayLeave: d = 0 } = g || {}, f = k(!1), r = k("outside");
38
+ let s = null;
39
+ const c = () => {
40
+ s && (clearTimeout(s), s = null);
41
+ };
42
+ T(() => {
43
+ c();
44
+ });
45
+ const a = (n) => {
46
+ const i = n ? l : d;
47
+ c(), i ? s = setTimeout(() => f.value = n, i) : f.value = n;
48
+ };
49
+ return C(
50
+ r,
51
+ (n) => {
52
+ ["trigger", "popper", "polygon"].includes(n) ? a(!0) : a(!1);
53
+ },
54
+ { immediate: !0 }
55
+ ), S(
56
+ [V, q],
57
+ ([n, i]) => {
58
+ const e = M(o), m = M(t), u = e == null ? void 0 : e.getBoundingClientRect(), h = m == null ? void 0 : m.getBoundingClientRect();
59
+ if (u && P({ x: n, y: i }, u)) {
60
+ r.value = "trigger";
61
+ return;
62
+ }
63
+ if (h && P({ x: n, y: i }, h)) {
64
+ r.value = "popper";
65
+ return;
66
+ }
67
+ if (!u || !h || u.width === 0 || u.height === 0 || h.width === 0 || h.height === 0) {
68
+ r.value = "outside";
69
+ return;
70
+ }
71
+ N({ x: n, y: i }, U(u, h), !0) ? r.value = "polygon" : r.value = "outside";
72
+ },
73
+ { throttle: 10 }
74
+ ), f;
75
+ }, J = { class: "tr-dropdown-menu__list" }, K = ["onClick"], Q = /* @__PURE__ */ E({
6
76
  __name: "index",
7
- props: {
77
+ props: /* @__PURE__ */ y({
78
+ appendTo: {},
8
79
  items: {},
9
- minWidth: { default: 160 },
10
- topOffset: { default: 0 }
11
- },
12
- emits: ["item-click"],
13
- setup(l, { emit: k }) {
14
- E((e) => ({
15
- d82a8430: f(n)(a.minWidth)
16
- }));
17
- const a = l, p = N(), y = _(() => p.style), t = m(!1), C = k, i = m(null), d = m(null), { x, y: $, update: S } = g(i), { width: D, height: T } = g(d), M = _(() => ({
18
- left: `min(${n(x.value)}, 100% - ${n(D.value)})`,
19
- top: `max(${n($.value)} - ${n(T.value)} + ${n(a.topOffset)} - 8px, 0px)`
20
- }));
21
- U(d, (e) => {
22
- var u;
23
- (u = i.value) != null && u.contains(e.target) && e.stopPropagation(), t.value = !1;
24
- }), O(t, (e) => {
25
- e && S();
80
+ show: { type: Boolean },
81
+ trigger: { default: "click" }
82
+ }, {
83
+ show: { type: Boolean, default: !1 },
84
+ showModifiers: {}
85
+ }),
86
+ emits: /* @__PURE__ */ y(["item-click", "click-outside"], ["update:show"]),
87
+ setup(o, { expose: t, emit: g }) {
88
+ const l = o, d = g, f = H(o, "show"), r = p({
89
+ get: () => l.trigger === "manual" ? l.show : f.value,
90
+ set: (e) => {
91
+ l.trigger !== "manual" && (f.value = e);
92
+ }
93
+ }), s = k(null), c = p(() => {
94
+ var e;
95
+ return (e = s.value) == null ? void 0 : e.triggerRef;
96
+ }), a = p(() => {
97
+ var e;
98
+ return (e = s.value) == null ? void 0 : e.popperRef;
26
99
  });
27
- const R = () => {
28
- t.value = !t.value;
29
- }, V = (e) => {
30
- t.value = !1, C("item-click", e);
100
+ if (l.trigger === "click" || l.trigger === "manual")
101
+ $(
102
+ a,
103
+ (e) => {
104
+ d("click-outside", e), r.value = !1;
105
+ },
106
+ { ignore: [c] }
107
+ );
108
+ else if (l.trigger === "hover") {
109
+ const e = z(c, a, { delayEnter: 100, delayLeave: 100 });
110
+ C(e, (m) => {
111
+ r.value = m;
112
+ });
113
+ }
114
+ const n = () => {
115
+ l.trigger === "click" && (r.value = !r.value);
116
+ }, i = (e) => {
117
+ r.value = !1, d("item-click", e);
31
118
  };
32
- return (e, u) => (s(), o(w, null, [
33
- h("div", {
34
- class: z(["tr-dropdown-menu__wrapper", f(p).class]),
35
- style: v(y.value),
36
- ref_key: "dropDownTriggerRef",
37
- ref: i,
38
- onClick: R
39
- }, [
40
- I(e.$slots, "default", {}, void 0, !0)
41
- ], 6),
42
- W(A, { name: "tr-dropdown-menu" }, {
43
- default: F(() => [
44
- t.value ? (s(), o("div", {
45
- key: 0,
46
- class: "tr-dropdown-menu",
47
- style: v(M.value),
48
- ref_key: "dropdownMenuRef",
49
- ref: d
50
- }, [
51
- h("ul", j, [
52
- (s(!0), o(w, null, L(a.items, (c) => (s(), o("li", {
53
- class: "tr-dropdown-menu__list-item",
54
- key: c.id,
55
- onClick: (K) => V(c)
56
- }, P(c.text), 9, q))), 128))
57
- ])
58
- ], 4)) : H("", !0)
59
- ]),
60
- _: 1
61
- })
62
- ], 64));
119
+ return t({
120
+ update: () => {
121
+ var e;
122
+ (e = s.value) == null || e.update();
123
+ }
124
+ }), (e, m) => (w(), I(X(A), {
125
+ show: r.value,
126
+ class: "tr-dropdown-menu",
127
+ ref_key: "basePopperRef",
128
+ ref: s,
129
+ placement: "top-left",
130
+ "append-to": l.appendTo,
131
+ offset: 8,
132
+ "transition-props": { name: "tr-dropdown-menu" },
133
+ "prevent-overflow": !0,
134
+ "trigger-events": { onClick: n }
135
+ }, {
136
+ trigger: _(() => [
137
+ O(e.$slots, "trigger", {}, void 0, !0)
138
+ ]),
139
+ content: _(() => [
140
+ j("ul", J, [
141
+ (w(!0), b(D, null, L(l.items, (u) => (w(), b("li", {
142
+ class: "tr-dropdown-menu__list-item",
143
+ key: u.id,
144
+ onClick: (h) => i(u)
145
+ }, Y(u.text), 9, K))), 128))
146
+ ])
147
+ ]),
148
+ _: 3
149
+ }, 8, ["show", "append-to", "trigger-events"]));
63
150
  }
64
- }), r = /* @__PURE__ */ b(G, [["__scopeId", "data-v-620f91f9"]]);
65
- r.name = "TrDropdownMenu";
66
- const J = function(l) {
67
- l.component(r.name, r);
151
+ }), v = /* @__PURE__ */ G(Q, [["__scopeId", "data-v-8d480727"]]);
152
+ v.name = "TrDropdownMenu";
153
+ const W = function(o) {
154
+ o.component(v.name, v);
68
155
  };
69
- r.install = J;
156
+ v.install = W;
70
157
  export {
71
- r as default
158
+ v as default
72
159
  };