@opentiny/tiny-robot 0.2.0-alpha.3 → 0.2.0-alpha.5

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,10 +1,10 @@
1
- import { defineComponent as L, useSlots as H, computed as i, useTemplateRef as T, ref as R, watch as N, nextTick as W, createElementBlock as m, openBlock as n, createBlock as d, createCommentVNode as G, Fragment as I, renderList as x, unref as f, withCtx as C, createElementVNode as _, resolveDynamicComponent as E, renderSlot as F, createVNode as M, Transition as j, withDirectives as J, normalizeClass as K, withModifiers as Q, toDisplayString as U, vShow as Y } from "vue";
2
- import { q as Z } from "../tiny-robot-svgs.js";
1
+ import { defineComponent as L, useSlots as W, computed as i, useTemplateRef as T, ref as R, watch as N, nextTick as j, createElementBlock as m, openBlock as n, createBlock as d, createCommentVNode as G, Fragment as I, renderList as x, unref as f, withCtx as C, createElementVNode as _, resolveDynamicComponent as E, renderSlot as F, createVNode as M, Transition as q, withDirectives as J, normalizeClass as K, withModifiers as Q, toDisplayString as U, vShow as Y } from "vue";
2
+ import { o as Z } from "../tiny-robot-svgs.js";
3
3
  import { T as $ } from "../index4.js";
4
- import { o as ee, a as te } from "../index2.js";
4
+ import { o as ee, b as te } from "../index3.js";
5
5
  import oe from "../icon-button/index.js";
6
6
  import { _ as ne } from "../_plugin-vue_export-helper.js";
7
- const re = { class: "tr-action-group" }, ae = ["onClick"], le = ["onClick"], ce = { class: "tr-action-group__dropdown-item-text" }, se = /* @__PURE__ */ L({
7
+ const re = { class: "tr-action-group" }, le = ["onClick"], ae = ["onClick"], ce = { class: "tr-action-group__dropdown-item-text" }, se = /* @__PURE__ */ L({
8
8
  __name: "ActionGroup",
9
9
  props: {
10
10
  maxNum: {},
@@ -12,15 +12,15 @@ const re = { class: "tr-action-group" }, ae = ["onClick"], le = ["onClick"], ce
12
12
  dropDownShowLabelOnly: { type: Boolean }
13
13
  },
14
14
  emits: ["item-click"],
15
- setup(a, { emit: h }) {
16
- const l = a, O = H(), V = h, p = i(() => {
15
+ setup(l, { emit: h }) {
16
+ const a = l, O = W(), V = h, p = i(() => {
17
17
  var o, t;
18
18
  const e = O.default();
19
19
  return Array.isArray(e) ? e.length === 1 && ((o = e[0].type) == null ? void 0 : o.toString()) === "Symbol(v-fgt)" ? e[0].children : e : ((t = e.type) == null ? void 0 : t.toString()) === "Symbol(v-fgt)" ? e.children : [e];
20
20
  }), w = i(() => {
21
- const e = l.maxNum ?? Number.MAX_SAFE_INTEGER;
21
+ const e = a.maxNum ?? Number.MAX_SAFE_INTEGER;
22
22
  return e > 0 ? e : Number.MAX_SAFE_INTEGER;
23
- }), g = i(() => p.value.length > w.value), q = i(() => g.value ? p.value.slice(0, w.value) : p.value), z = i(() => g.value ? p.value.slice(w.value) : []), b = T("moreBtnRef"), k = T("dropDownRef"), r = R(!1), P = () => {
23
+ }), g = i(() => p.value.length > w.value), z = i(() => g.value ? p.value.slice(0, w.value) : p.value), P = i(() => g.value ? p.value.slice(w.value) : []), b = T("moreBtnRef"), k = T("dropDownRef"), r = R(!1), X = () => {
24
24
  r.value = !r.value;
25
25
  };
26
26
  ee(k, (e) => {
@@ -36,13 +36,13 @@ const re = { class: "tr-action-group" }, ae = ["onClick"], le = ["onClick"], ce
36
36
  A.value = o.bottom + e.height + 16 > B.value ? "placement-top" : "placement-bottom";
37
37
  };
38
38
  return N(r, (e) => {
39
- e && W(() => {
39
+ e && j(() => {
40
40
  D();
41
41
  });
42
42
  }), N(B, () => {
43
43
  r.value && D();
44
44
  }), (e, o) => (n(), m("div", re, [
45
- (n(!0), m(I, null, x(q.value, (t, y) => {
45
+ (n(!0), m(I, null, x(z.value, (t, y) => {
46
46
  var c;
47
47
  return n(), d(f($), {
48
48
  key: y,
@@ -50,18 +50,18 @@ const re = { class: "tr-action-group" }, ae = ["onClick"], le = ["onClick"], ce
50
50
  effect: "dark",
51
51
  placement: "top",
52
52
  "open-delay": 500,
53
- disabled: !l.showTooltip
53
+ disabled: !a.showTooltip
54
54
  }, {
55
55
  default: C(() => [
56
56
  _("span", {
57
57
  class: "tr-action-group__btn-wrapper",
58
- onClick: (X) => {
58
+ onClick: (H) => {
59
59
  var s;
60
60
  return S((s = t.props) == null ? void 0 : s.name);
61
61
  }
62
62
  }, [
63
63
  (n(), d(E(t)))
64
- ], 8, ae)
64
+ ], 8, le)
65
65
  ]),
66
66
  _: 2
67
67
  }, 1032, ["content", "disabled"]);
@@ -72,36 +72,36 @@ const re = { class: "tr-action-group" }, ae = ["onClick"], le = ["onClick"], ce
72
72
  effect: "dark",
73
73
  placement: "top",
74
74
  "open-delay": 500,
75
- disabled: !l.showTooltip
75
+ disabled: !a.showTooltip
76
76
  }, {
77
77
  default: C(() => [
78
78
  _("span", {
79
79
  ref: "moreBtnRef",
80
80
  class: "tr-action-group__btn-wrapper",
81
- onClick: P
81
+ onClick: X
82
82
  }, [
83
83
  F(e.$slots, "moreBtn", {}, () => [
84
84
  M(f(oe), { icon: f(Z) }, null, 8, ["icon"])
85
85
  ], !0),
86
- M(j, { name: "tr-action-group-dropdown" }, {
86
+ M(q, { name: "tr-action-group-dropdown" }, {
87
87
  default: C(() => [
88
88
  J(_("ul", {
89
89
  ref: "dropDownRef",
90
90
  class: K(["tr-action-group__dropdown", A.value])
91
91
  }, [
92
- (n(!0), m(I, null, x(z.value, (t, y) => {
92
+ (n(!0), m(I, null, x(P.value, (t, y) => {
93
93
  var c;
94
94
  return n(), m("li", {
95
95
  class: "tr-action-group__dropdown-item",
96
96
  key: y,
97
- onClick: Q((X) => {
97
+ onClick: Q((H) => {
98
98
  var s;
99
99
  return S((s = t.props) == null ? void 0 : s.name);
100
100
  }, ["stop"])
101
101
  }, [
102
- l.dropDownShowLabelOnly ? G("", !0) : (n(), d(E(t), { key: 0 })),
102
+ a.dropDownShowLabelOnly ? G("", !0) : (n(), d(E(t), { key: 0 })),
103
103
  _("span", ce, U((c = t.props) == null ? void 0 : c.label), 1)
104
- ], 8, le);
104
+ ], 8, ae);
105
105
  }), 128))
106
106
  ], 2), [
107
107
  [Y, r.value]
@@ -121,18 +121,18 @@ const re = { class: "tr-action-group" }, ae = ["onClick"], le = ["onClick"], ce
121
121
  name: {},
122
122
  label: {}
123
123
  },
124
- setup(a) {
125
- return (h, l) => F(h.$slots, "default");
124
+ setup(l) {
125
+ return (h, a) => F(h.$slots, "default");
126
126
  }
127
127
  });
128
128
  v.name = "TrActionGroup";
129
- const ie = function(a) {
130
- a.component(v.name, v);
129
+ const ie = function(l) {
130
+ l.component(v.name, v);
131
131
  };
132
132
  v.install = ie;
133
133
  u.name = "TrActionGroupItem";
134
- const ue = function(a) {
135
- a.component(u.name, u);
134
+ const ue = function(l) {
135
+ l.component(u.name, u);
136
136
  };
137
137
  u.install = ue;
138
138
  const he = u;
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as c0, useCssVars as L0, useSlots as P0, computed as au, createElementBlock as L, openBlock as S, normalizeClass as i0, createCommentVNode as _u, createElementVNode as Z, createBlock as yu, resolveDynamicComponent as o0, renderSlot as mu, toDisplayString as O0, useTemplateRef as N0, watch as $0, Fragment as j0, renderList as Ou, mergeProps as Nu, createSlots as U0, withCtx as Z0 } from "vue";
2
2
  import { _ as a0 } from "../_plugin-vue_export-helper.js";
3
- import { u as H0 } from "../index2.js";
3
+ import { d as H0 } from "../index3.js";
4
4
  const $u = {};
5
5
  function V0(u) {
6
6
  let e = $u[u];
package/dist/close.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l as o } from "./index6.js";
1
+ import { s as o } from "./index2.js";
2
2
  import { createElementBlock as n, openBlock as r, createElementVNode as t } from "vue";
3
3
  var c = {
4
4
  viewBox: "0 0 16 16",
@@ -1,8 +1,8 @@
1
- import { defineComponent as m, useCssVars as v, useModel as c, computed as _, createElementBlock as w, openBlock as g, createElementVNode as n, renderSlot as r, createVNode as u, unref as a } from "vue";
2
- import { N as h, F as $, T as C } from "../tiny-robot-svgs.js";
1
+ import { defineComponent as m, useCssVars as v, useModel as c, computed as _, createElementBlock as $, openBlock as w, createElementVNode as n, renderSlot as r, createVNode as u, unref as a } from "vue";
2
+ import { $ as g, i as h, t as C } from "../tiny-robot-svgs.js";
3
3
  import d from "../icon-button/index.js";
4
4
  import { _ as b } from "../_plugin-vue_export-helper.js";
5
- const B = { class: "tr-container" }, N = { class: "tr-container__header" }, T = { class: "tr-container__header-operations" }, k = { class: "tr-container__footer" }, z = /* @__PURE__ */ m({
5
+ const B = { class: "tr-container" }, k = { class: "tr-container__header" }, z = { class: "tr-container__header-operations" }, y = { class: "tr-container__footer" }, E = /* @__PURE__ */ m({
6
6
  __name: "index",
7
7
  props: {
8
8
  show: { type: Boolean, required: !0 },
@@ -18,16 +18,16 @@ const B = { class: "tr-container" }, N = { class: "tr-container__header" }, T =
18
18
  "224ae4c1": l.value ? "100" : "-1",
19
19
  cb10cae2: l.value ? "1" : "0"
20
20
  }));
21
- const l = c(o, "show"), s = c(o, "fullscreen"), f = _(() => s.value ? h : $);
22
- return (t, e) => (g(), w("div", B, [
21
+ const l = c(o, "show"), s = c(o, "fullscreen"), f = _(() => s.value ? g : h);
22
+ return (t, e) => (w(), $("div", B, [
23
23
  e[3] || (e[3] = n("div", { class: "tr-container__dragging-bar-wrapper" }, [
24
24
  n("div", { class: "tr-container__dragging-bar" })
25
25
  ], -1)),
26
- n("div", N, [
26
+ n("div", k, [
27
27
  r(t.$slots, "title", {}, () => [
28
28
  e[2] || (e[2] = n("h3", { class: "tr-container__title" }, "OpenTiny NEXT", -1))
29
29
  ]),
30
- n("div", T, [
30
+ n("div", z, [
31
31
  r(t.$slots, "operations"),
32
32
  u(a(d), {
33
33
  size: "28",
@@ -44,17 +44,17 @@ const B = { class: "tr-container" }, N = { class: "tr-container__header" }, T =
44
44
  ])
45
45
  ]),
46
46
  r(t.$slots, "default"),
47
- n("div", k, [
47
+ n("div", y, [
48
48
  r(t.$slots, "footer")
49
49
  ])
50
50
  ]));
51
51
  }
52
- }), i = /* @__PURE__ */ b(z, [["__scopeId", "data-v-81c9f59e"]]);
52
+ }), i = /* @__PURE__ */ b(E, [["__scopeId", "data-v-81c9f59e"]]);
53
53
  i.name = "TrContainer";
54
- const y = function(o) {
54
+ const I = function(o) {
55
55
  o.component(i.name, i);
56
56
  };
57
- i.install = y;
57
+ i.install = I;
58
58
  export {
59
59
  i as default
60
60
  };
@@ -0,0 +1,70 @@
1
+ import { defineComponent as $, useCssVars as T, unref as S, ref as B, useTemplateRef as u, computed as D, watch as V, createElementBlock as i, openBlock as n, renderSlot as b, createVNode as E, Transition as M, withCtx as N, createBlock as O, createCommentVNode as R, Teleport as W, createElementVNode as c, normalizeStyle as I, Fragment as z, renderList as F, toDisplayString as H } from "vue";
2
+ import { u as m, o as L } from "../index3.js";
3
+ import { toCssUnit as o } from "../shared/index.js";
4
+ import { _ as P } from "../_plugin-vue_export-helper.js";
5
+ const U = { class: "tr-dropdown-menu__list" }, j = ["onClick"], q = /* @__PURE__ */ $({
6
+ __name: "index",
7
+ props: {
8
+ items: {},
9
+ minWidth: { default: 160 },
10
+ topOffset: { default: 0 }
11
+ },
12
+ emits: ["item-click"],
13
+ setup(s, { emit: p }) {
14
+ T((e) => ({
15
+ 72795133: S(o)(l.minWidth)
16
+ }));
17
+ const l = s, t = B(!1), f = p, _ = u("dropdown-menu-trigger"), a = u("dropdown-menu"), { x: w, y: h, update: v } = m(_), { width: g, height: k } = m(a), x = D(() => ({
18
+ left: `min(${o(w.value)}, 100% - ${o(g.value)})`,
19
+ top: `max(${o(h.value)} - ${o(k.value)} + ${o(l.topOffset)} - 8px, 0px)`
20
+ }));
21
+ L(a, (e) => {
22
+ e.stopPropagation(), t.value = !1;
23
+ }), V(t, (e) => {
24
+ e && v();
25
+ });
26
+ const C = () => {
27
+ t.value = !t.value;
28
+ }, y = (e) => {
29
+ t.value = !1, f("item-click", e);
30
+ };
31
+ return (e, G) => (n(), i("div", {
32
+ class: "tr-dropdown-menu__wrapper",
33
+ ref: "dropdown-menu-trigger",
34
+ onClick: C
35
+ }, [
36
+ b(e.$slots, "default", {}, void 0, !0),
37
+ E(M, { name: "tr-dropdown-menu" }, {
38
+ default: N(() => [
39
+ t.value ? (n(), O(W, {
40
+ key: 0,
41
+ to: "body"
42
+ }, [
43
+ c("div", {
44
+ class: "tr-dropdown-menu",
45
+ style: I(x.value),
46
+ ref: "dropdown-menu"
47
+ }, [
48
+ c("ul", U, [
49
+ (n(!0), i(z, null, F(l.items, (d) => (n(), i("li", {
50
+ class: "tr-dropdown-menu__list-item",
51
+ key: d.id,
52
+ onClick: (J) => y(d)
53
+ }, H(d.text), 9, j))), 128))
54
+ ])
55
+ ], 4)
56
+ ])) : R("", !0)
57
+ ]),
58
+ _: 1
59
+ })
60
+ ], 512));
61
+ }
62
+ }), r = /* @__PURE__ */ P(q, [["__scopeId", "data-v-dbe4bc04"]]);
63
+ r.name = "TrDropdownMenu";
64
+ const A = function(s) {
65
+ s.component(r.name, r);
66
+ };
67
+ r.install = A;
68
+ export {
69
+ r as default
70
+ };
@@ -1,10 +1,10 @@
1
- import { defineComponent as D, ref as E, computed as P, onMounted as z, watch as O, createElementBlock as a, openBlock as t, createCommentVNode as k, Fragment as x, renderList as S, toDisplayString as y, createVNode as b, unref as l, nextTick as Z, createElementVNode as p, createBlock as d, withCtx as f, createTextVNode as q, resolveDynamicComponent as C } from "vue";
2
- import { D as T, x as N, Z as j, E as H, V as J, h as K } from "../tiny-robot-svgs.js";
3
- import { B as R } from "../index3.js";
4
- import V, { ActionGroupItem as $ } from "../action-group/index.js";
1
+ import { defineComponent as X, ref as E, computed as z, onMounted as D, watch as K, createElementBlock as a, openBlock as t, createCommentVNode as k, Fragment as I, renderList as S, toDisplayString as y, createVNode as b, unref as l, nextTick as O, createElementVNode as p, createBlock as d, withCtx as f, createTextVNode as U, resolveDynamicComponent as C } from "vue";
2
+ import { K as T, U as N, d as q, s as j, p as H, e as J } from "../tiny-robot-svgs.js";
3
+ import { B as R } from "../index5.js";
4
+ import $, { ActionGroupItem as V } from "../action-group/index.js";
5
5
  import Q from "../icon-button/index.js";
6
- import { _ as X } from "../_plugin-vue_export-helper.js";
7
- const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__ */ D({
6
+ import { _ as P } from "../_plugin-vue_export-helper.js";
7
+ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__ */ X({
8
8
  __name: "SourceList",
9
9
  props: {
10
10
  sources: {},
@@ -12,7 +12,7 @@ const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__
12
12
  },
13
13
  setup(h) {
14
14
  const _ = h, e = E(!1), L = E([]), c = E(null), g = () => {
15
- Z(() => {
15
+ O(() => {
16
16
  const u = L.value.map((o) => (o == null ? void 0 : o.offsetTop) || 0), n = Array.from(new Set(u));
17
17
  if (n.length > _.linesLimit) {
18
18
  const o = n[_.linesLimit - 1], s = u.lastIndexOf(o);
@@ -20,13 +20,13 @@ const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__
20
20
  } else
21
21
  c.value = null;
22
22
  });
23
- }, A = P(() => _.sources.length - (c.value || 0));
24
- z(g), O(() => _.sources, g);
23
+ }, A = z(() => _.sources.length - (c.value || 0));
24
+ D(g), K(() => _.sources, g);
25
25
  const m = (u, n) => {
26
26
  u && (L.value[n] = u);
27
27
  };
28
- return (u, n) => (t(), a("div", U, [
29
- (t(!0), a(x, null, S(_.sources, (o, s) => (t(), a(x, { key: s }, [
28
+ return (u, n) => (t(), a("div", W, [
29
+ (t(!0), a(I, null, S(_.sources, (o, s) => (t(), a(I, { key: s }, [
30
30
  !c.value || e.value || s < c.value ? (t(), a("a", {
31
31
  key: 0,
32
32
  class: "pill",
@@ -34,7 +34,7 @@ const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__
34
34
  target: "_blank",
35
35
  ref_for: !0,
36
36
  ref: (r) => m(r, s)
37
- }, y(o.label), 9, W)) : k("", !0),
37
+ }, y(o.label), 9, Y)) : k("", !0),
38
38
  c.value && !e.value && s === c.value ? (t(), a("span", {
39
39
  key: 1,
40
40
  class: "pill",
@@ -50,10 +50,10 @@ const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__
50
50
  ])) : k("", !0)
51
51
  ]));
52
52
  }
53
- }), ee = /* @__PURE__ */ X(Y, [["__scopeId", "data-v-5817f518"]]), te = { class: "tr-feedback" }, se = { class: "tr-feedback__operations" }, oe = { class: "tr-feedback__operations-left" }, ne = { key: 1 }, le = { class: "tr-feedback__operations-right" }, ae = {
53
+ }), ee = /* @__PURE__ */ P(Z, [["__scopeId", "data-v-5817f518"]]), te = { class: "tr-feedback" }, se = { class: "tr-feedback__operations" }, oe = { class: "tr-feedback__operations-left" }, ne = { key: 1 }, le = { class: "tr-feedback__operations-right" }, ae = {
54
54
  key: 0,
55
55
  class: "tr-feedback__footer"
56
- }, re = { key: 0 }, ie = /* @__PURE__ */ D({
56
+ }, re = { key: 0 }, ie = /* @__PURE__ */ X({
57
57
  __name: "index",
58
58
  props: {
59
59
  operations: {},
@@ -66,10 +66,10 @@ const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__
66
66
  emits: ["operation", "action"],
67
67
  setup(h, { emit: _ }) {
68
68
  const e = h, L = {
69
- copy: K,
70
- refresh: J,
71
- like: H,
72
- dislike: j
69
+ copy: J,
70
+ refresh: H,
71
+ like: j,
72
+ dislike: q
73
73
  }, c = _, g = (n) => {
74
74
  var o, s, r;
75
75
  (r = (s = (o = e.operations) == null ? void 0 : o.find((v) => v.name === n)) == null ? void 0 : s.onClick) == null || r.call(s), c("operation", n);
@@ -84,7 +84,7 @@ const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__
84
84
  return t(), a("div", te, [
85
85
  p("div", se, [
86
86
  p("div", oe, [
87
- (s = e.operations) != null && s.length ? (t(), d(l(V), {
87
+ (s = e.operations) != null && s.length ? (t(), d(l($), {
88
88
  key: 0,
89
89
  "max-num": e.operationsLimit,
90
90
  "drop-down-show-label-only": !0,
@@ -106,7 +106,7 @@ const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__
106
106
  })
107
107
  ]),
108
108
  default: f(() => [
109
- (t(!0), a(x, null, S(e.operations, (i) => (t(), d(l($), {
109
+ (t(!0), a(I, null, S(e.operations, (i) => (t(), d(l(V), {
110
110
  key: i.name,
111
111
  name: i.name,
112
112
  label: i.label
@@ -118,7 +118,7 @@ const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__
118
118
  size: "mini"
119
119
  }, {
120
120
  default: f(() => [
121
- q(y(i.label), 1)
121
+ U(y(i.label), 1)
122
122
  ]),
123
123
  _: 2
124
124
  }, 1024)
@@ -138,13 +138,13 @@ const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__
138
138
  ])) : k("", !0)
139
139
  ]),
140
140
  p("div", le, [
141
- b(l(V), {
141
+ b(l($), {
142
142
  "max-num": e.actionsLimit,
143
143
  "show-tooltip": !0,
144
144
  onItemClick: A
145
145
  }, {
146
146
  default: f(() => [
147
- (t(!0), a(x, null, S(e.actions, (i) => (t(), d(l($), {
147
+ (t(!0), a(I, null, S(e.actions, (i) => (t(), d(l(V), {
148
148
  key: i.name,
149
149
  name: i.name,
150
150
  label: i.label
@@ -181,12 +181,12 @@ const U = { class: "tr-feedback__source-list" }, W = ["href"], Y = /* @__PURE__
181
181
  ]);
182
182
  };
183
183
  }
184
- }), I = /* @__PURE__ */ X(ie, [["__scopeId", "data-v-cc6ef316"]]);
185
- I.name = "TrFeedback";
184
+ }), x = /* @__PURE__ */ P(ie, [["__scopeId", "data-v-cc6ef316"]]);
185
+ x.name = "TrFeedback";
186
186
  const ce = function(h) {
187
- h.component(I.name, I);
187
+ h.component(x.name, x);
188
188
  };
189
- I.install = ce;
189
+ x.install = ce;
190
190
  export {
191
- I as default
191
+ x as default
192
192
  };
@@ -0,0 +1,120 @@
1
+ import { defineComponent as q, mergeModels as $, useModel as G, watch as k, useTemplateRef as h, ref as v, computed as D, createElementBlock as a, openBlock as l, createElementVNode as M, Fragment as g, renderList as S, createCommentVNode as _, normalizeClass as b, createBlock as C, resolveDynamicComponent as I, toDisplayString as F, nextTick as H } from "vue";
2
+ import { U as X } from "../tiny-robot-svgs.js";
3
+ import { a as j, o as J } from "../index3.js";
4
+ import { _ as K } from "../_plugin-vue_export-helper.js";
5
+ const P = {
6
+ class: "tr-flow-layout",
7
+ ref: "container"
8
+ }, Q = ["onClick"], Y = {
9
+ key: 0,
10
+ class: "tr-flow-layout__item-label"
11
+ }, Z = { class: "tr-flow-layout__dropdown-wrapper" }, ee = {
12
+ key: 0,
13
+ class: "tr-flow-layout__dropdown",
14
+ ref: "dropDown"
15
+ }, te = ["onClick"], oe = { class: "tr-flow-layout__item-label" }, le = /* @__PURE__ */ q({
16
+ __name: "index",
17
+ props: /* @__PURE__ */ $({
18
+ items: {},
19
+ selected: {},
20
+ linesLimit: { default: Number.MAX_SAFE_INTEGER },
21
+ moreIcon: { default: X },
22
+ showMoreTrigger: { default: "click" }
23
+ }, {
24
+ selected: {},
25
+ selectedModifiers: {}
26
+ }),
27
+ emits: /* @__PURE__ */ $(["item-click"], ["update:selected"]),
28
+ setup(d, { emit: N }) {
29
+ const n = d, i = G(d, "selected");
30
+ k(
31
+ () => n.items,
32
+ (t) => {
33
+ !t.find((o) => o.id === i.value) && t.length && (i.value = t[0].id);
34
+ },
35
+ { immediate: !0 }
36
+ );
37
+ const A = N, x = h("container"), B = h("more-button"), L = h("dropDown"), w = v([]), s = v(null), f = v(!1), u = v(!1), W = (t, o) => {
38
+ t && (w.value[o] = t);
39
+ }, T = () => {
40
+ s.value = null, f.value = !1, H(() => {
41
+ const t = x.value, o = B.value;
42
+ if (!t || !o)
43
+ return;
44
+ const e = w.value.slice(0, n.items.length).filter((r) => !!r).map((r) => r.offsetTop), c = Array.from(new Set(e));
45
+ if (c.length > n.linesLimit) {
46
+ const r = c[n.linesLimit - 1], y = e.lastIndexOf(r), E = w.value[y];
47
+ t.clientWidth - E.offsetLeft - E.offsetWidth - 8 < o.offsetWidth ? s.value = y : s.value = y + 1, f.value = !1;
48
+ } else
49
+ s.value = null, f.value = !0;
50
+ });
51
+ };
52
+ k(() => n.items, T);
53
+ const { width: z } = j(x);
54
+ k(z, (t) => {
55
+ t > 0 && T();
56
+ });
57
+ const O = D(() => s.value !== null ? n.items.slice(s.value) : []), U = D(() => s.value === null ? !1 : n.items.findIndex((o) => o.id === i.value) >= s.value), R = (t) => {
58
+ i.value = t, u.value = !1, A("item-click", t);
59
+ }, V = () => {
60
+ n.showMoreTrigger === "click" && (u.value = !u.value);
61
+ }, m = (t) => {
62
+ n.showMoreTrigger === "hover" && (u.value = t);
63
+ };
64
+ return J(L, (t) => {
65
+ var o, e;
66
+ (o = L.value) != null && o.contains(t.target) || (e = B.value) != null && e.contains(t.target) || (u.value = !1);
67
+ }), (t, o) => (l(), a("div", P, [
68
+ (l(!0), a(g, null, S(n.items, (e, c) => (l(), a(g, {
69
+ key: e.id
70
+ }, [
71
+ s.value === null || c < s.value ? (l(), a("button", {
72
+ key: 0,
73
+ class: b(["tr-flow-layout__item", { "icon-only": !e.label }, { selected: e.id === i.value }]),
74
+ ref_for: !0,
75
+ ref: (r) => W(r, c),
76
+ onClick: (r) => R(e.id)
77
+ }, [
78
+ (l(), C(I(e.icon), { class: "tr-flow-layout__item-icon" })),
79
+ e.label ? (l(), a("span", Y, F(e.label), 1)) : _("", !0)
80
+ ], 10, Q)) : _("", !0)
81
+ ], 64))), 128)),
82
+ M("div", Z, [
83
+ f.value ? _("", !0) : (l(), a("button", {
84
+ key: 0,
85
+ class: b(["tr-flow-layout__item", "icon-only", { selected: U.value }]),
86
+ ref: "more-button",
87
+ onClick: V,
88
+ onMouseenter: o[0] || (o[0] = (e) => m(!0)),
89
+ onMouseleave: o[1] || (o[1] = (e) => m(!1))
90
+ }, [
91
+ (l(), C(I(n.moreIcon), { class: "tr-flow-layout__item-icon" }))
92
+ ], 34)),
93
+ M("div", {
94
+ class: "tr-flow-layout__dropdown-container",
95
+ onMouseenter: o[2] || (o[2] = (e) => m(!0)),
96
+ onMouseleave: o[3] || (o[3] = (e) => m(!1))
97
+ }, [
98
+ u.value ? (l(), a("div", ee, [
99
+ (l(!0), a(g, null, S(O.value, (e) => (l(), a("button", {
100
+ class: b(["tr-flow-layout__dropdown_item", { selected: e.id === i.value }]),
101
+ key: e.id,
102
+ onClick: (c) => R(e.id)
103
+ }, [
104
+ (l(), C(I(e.icon), { class: "tr-flow-layout__item-icon" })),
105
+ M("span", oe, F(e.label), 1)
106
+ ], 10, te))), 128))
107
+ ], 512)) : _("", !0)
108
+ ], 32)
109
+ ])
110
+ ], 512));
111
+ }
112
+ }), p = /* @__PURE__ */ K(le, [["__scopeId", "data-v-2718a5f2"]]);
113
+ p.name = "TrFlowLayout";
114
+ const ne = function(d) {
115
+ d.component(p.name, p);
116
+ };
117
+ p.install = ne;
118
+ export {
119
+ p as default
120
+ };