@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,59 +1,59 @@
1
- import { defineComponent as X, ref as A, computed as z, onMounted as D, watch as O, createElementBlock as a, openBlock as t, createCommentVNode as k, Fragment as E, renderList as S, toDisplayString as y, createVNode as h, unref as l, nextTick as q, createElementVNode as p, createBlock as d, withCtx as f, createTextVNode as j, resolveDynamicComponent as C } from "vue";
2
- import { f as T, A as N, c as H, a as J, b as K, v as Q } from "../tiny-robot-svgs.js";
3
- import { B as R } from "../index3.js";
4
- import $, { ActionGroupItem as V } from "../action-group/index.js";
5
- import U from "../icon-button/index.js";
6
- import { _ as P } from "../_plugin-vue_export-helper.js";
7
- const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__ */ X({
1
+ import { defineComponent as V, ref as g, computed as P, onMounted as z, watch as O, createElementBlock as r, openBlock as t, createCommentVNode as k, Fragment as A, renderList as w, toDisplayString as y, createVNode as b, unref as l, nextTick as q, createElementVNode as d, createBlock as _, withCtx as f, createTextVNode as U, resolveDynamicComponent as x } from "vue";
2
+ import { IconArrowUp as T, IconArrowDown as N, IconDislike as j, IconLike as H, IconRefresh as J, IconCopy as K } from "@opentiny/tiny-robot-svgs";
3
+ import { TinyButton as G } from "@opentiny/vue";
4
+ import $, { ActionGroupItem as D } from "../action-group/index.js";
5
+ import Q from "../icon-button/index.js";
6
+ import { _ as X } from "../_plugin-vue_export-helper.js";
7
+ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__ */ V({
8
8
  __name: "SourceList",
9
9
  props: {
10
10
  sources: {},
11
11
  linesLimit: { default: Number.MAX_SAFE_INTEGER }
12
12
  },
13
- setup(b) {
14
- const m = b, e = A(!1), g = A([]), c = A(null), L = () => {
13
+ setup(h) {
14
+ const m = h, e = g(!1), I = g([]), c = g(null), L = () => {
15
15
  q(() => {
16
- const u = g.value.slice(0, m.sources.length).map((o) => (o == null ? void 0 : o.offsetTop) || 0), n = Array.from(new Set(u));
16
+ const u = I.value.slice(0, m.sources.length).map((s) => (s == null ? void 0 : s.offsetTop) || 0), n = Array.from(new Set(u));
17
17
  if (n.length > m.linesLimit) {
18
- const o = n[m.linesLimit - 1], s = u.lastIndexOf(o);
19
- c.value = s;
18
+ const s = n[m.linesLimit - 1], o = u.lastIndexOf(s);
19
+ c.value = o;
20
20
  } else
21
21
  c.value = null;
22
22
  });
23
- }, x = z(() => m.sources.length - (c.value || 0));
24
- D(L), O(() => m.sources, L);
25
- const _ = (u, n) => {
26
- u && (g.value[n] = u);
23
+ }, E = P(() => m.sources.length - (c.value || 0));
24
+ z(L), O(() => m.sources, L);
25
+ const p = (u, n) => {
26
+ u && (I.value[n] = u);
27
27
  };
28
- return (u, n) => (t(), a("div", W, [
29
- (t(!0), a(E, null, S(m.sources, (o, s) => (t(), a(E, { key: s }, [
30
- !c.value || e.value || s < c.value ? (t(), a("a", {
28
+ return (u, n) => (t(), r("div", W, [
29
+ (t(!0), r(A, null, w(m.sources, (s, o) => (t(), r(A, { key: o }, [
30
+ !c.value || e.value || o < c.value ? (t(), r("a", {
31
31
  key: 0,
32
32
  class: "pill",
33
- href: o.link,
33
+ href: s.link,
34
34
  target: "_blank",
35
35
  ref_for: !0,
36
- ref: (r) => _(r, s)
37
- }, y(o.label), 9, Y)) : k("", !0),
38
- c.value && !e.value && s === c.value ? (t(), a("span", {
36
+ ref: (a) => p(a, o)
37
+ }, y(s.label), 9, Y)) : k("", !0),
38
+ c.value && !e.value && o === c.value ? (t(), r("span", {
39
39
  key: 1,
40
40
  class: "pill",
41
- onClick: n[0] || (n[0] = (r) => e.value = !0)
42
- }, y(x.value) + "+ ", 1)) : k("", !0)
41
+ onClick: n[0] || (n[0] = (a) => e.value = !0)
42
+ }, y(E.value) + "+ ", 1)) : k("", !0)
43
43
  ], 64))), 128)),
44
- e.value ? (t(), a("span", {
44
+ e.value ? (t(), r("span", {
45
45
  key: 0,
46
46
  class: "pill collapse-pill",
47
- onClick: n[1] || (n[1] = (o) => e.value = !1)
47
+ onClick: n[1] || (n[1] = (s) => e.value = !1)
48
48
  }, [
49
- h(l(T))
49
+ b(l(T))
50
50
  ])) : k("", !0)
51
51
  ]));
52
52
  }
53
- }), ee = /* @__PURE__ */ P(Z, [["__scopeId", "data-v-c5fbb560"]]), 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__ */ X(Z, [["__scopeId", "data-v-c5fbb560"]]), te = { class: "tr-feedback" }, oe = { class: "tr-feedback__operations" }, se = { class: "tr-feedback__operations-left" }, ne = { key: 1 }, le = { class: "tr-feedback__operations-right" }, re = {
54
54
  key: 0,
55
55
  class: "tr-feedback__footer"
56
- }, re = { key: 0 }, ie = /* @__PURE__ */ X({
56
+ }, ae = { key: 0 }, ie = /* @__PURE__ */ V({
57
57
  __name: "index",
58
58
  props: {
59
59
  operations: {},
@@ -64,27 +64,27 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
64
64
  sourcesLinesLimit: { default: Number.MAX_SAFE_INTEGER }
65
65
  },
66
66
  emits: ["operation", "action"],
67
- setup(b, { emit: m }) {
68
- const e = b, g = {
69
- copy: Q,
70
- refresh: K,
71
- like: J,
72
- dislike: H
67
+ setup(h, { emit: m }) {
68
+ const e = h, I = {
69
+ copy: K,
70
+ refresh: J,
71
+ like: H,
72
+ dislike: j
73
73
  }, c = m, L = (n) => {
74
- var o, s, r;
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);
76
- }, x = (n) => {
77
- var o, s, r;
78
- (r = (s = (o = e.actions) == null ? void 0 : o.find((v) => v.name === n)) == null ? void 0 : s.onClick) == null || r.call(s), c("action", n);
79
- }, _ = A(!1), u = () => {
80
- _.value = !_.value;
74
+ var s, o, a;
75
+ (a = (o = (s = e.operations) == null ? void 0 : s.find((v) => v.name === n)) == null ? void 0 : o.onClick) == null || a.call(o), c("operation", n);
76
+ }, E = (n) => {
77
+ var s, o, a;
78
+ (a = (o = (s = e.actions) == null ? void 0 : s.find((v) => v.name === n)) == null ? void 0 : o.onClick) == null || a.call(o), c("action", n);
79
+ }, p = g(!1), u = () => {
80
+ p.value = !p.value;
81
81
  };
82
- return (n, o) => {
83
- var s, r, v, w, B, F, M, G;
84
- return t(), a("div", te, [
85
- p("div", se, [
86
- p("div", oe, [
87
- (s = e.operations) != null && s.length ? (t(), d(l($), {
82
+ return (n, s) => {
83
+ var o, a, v, S, F, M, R, B;
84
+ return t(), r("div", te, [
85
+ d("div", oe, [
86
+ d("div", se, [
87
+ (o = e.operations) != null && o.length ? (t(), _(l($), {
88
88
  key: 0,
89
89
  "max-num": e.operationsLimit,
90
90
  "drop-down-show-label-only": !0,
@@ -92,34 +92,33 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
92
92
  class: "tr-feedback__operations-left-action-group"
93
93
  }, {
94
94
  moreBtn: f(() => [
95
- h(l(R), {
95
+ b(l(G), {
96
96
  round: "",
97
97
  size: "mini",
98
98
  "reset-time": 0,
99
99
  class: "tr-feedback__operations-more-btn"
100
100
  }, {
101
101
  default: f(() => [
102
- o[0] || (o[0] = p("span", null, "更多", -1)),
103
- h(l(N))
102
+ s[0] || (s[0] = d("span", null, "更多", -1)),
103
+ b(l(N))
104
104
  ]),
105
- _: 1,
106
- __: [0]
105
+ _: 1
107
106
  })
108
107
  ]),
109
108
  default: f(() => [
110
- (t(!0), a(E, null, S(e.operations, (i) => (t(), d(l(V), {
109
+ (t(!0), r(A, null, w(e.operations, (i) => (t(), _(l(D), {
111
110
  key: i.name,
112
111
  name: i.name,
113
112
  label: i.label
114
113
  }, {
115
114
  default: f(() => [
116
- h(l(R), {
115
+ b(l(G), {
117
116
  round: "",
118
117
  "reset-time": 0,
119
118
  size: "mini"
120
119
  }, {
121
120
  default: f(() => [
122
- j(y(i.label), 1)
121
+ U(y(i.label), 1)
123
122
  ]),
124
123
  _: 2
125
124
  }, 1024)
@@ -128,33 +127,33 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
128
127
  }, 1032, ["name", "label"]))), 128))
129
128
  ]),
130
129
  _: 1
131
- }, 8, ["max-num"])) : (r = e.sources) != null && r.length ? (t(), a("div", ne, [
132
- p("span", {
130
+ }, 8, ["max-num"])) : (a = e.sources) != null && a.length ? (t(), r("div", ne, [
131
+ d("span", {
133
132
  class: "tr-feedback__source",
134
133
  onClick: u
135
134
  }, [
136
- p("span", null, y((v = e.sources) == null ? void 0 : v.length) + "条来源", 1),
137
- (t(), d(C(_.value ? l(T) : l(N))))
135
+ d("span", null, y((v = e.sources) == null ? void 0 : v.length) + "条来源", 1),
136
+ (t(), _(x(p.value ? l(T) : l(N))))
138
137
  ])
139
138
  ])) : k("", !0)
140
139
  ]),
141
- p("div", le, [
142
- h(l($), {
140
+ d("div", le, [
141
+ b(l($), {
143
142
  "max-num": e.actionsLimit,
144
143
  "show-tooltip": !0,
145
- onItemClick: x
144
+ onItemClick: E
146
145
  }, {
147
146
  default: f(() => [
148
- (t(!0), a(E, null, S(e.actions, (i) => (t(), d(l(V), {
147
+ (t(!0), r(A, null, w(e.actions, (i) => (t(), _(l(D), {
149
148
  key: i.name,
150
149
  name: i.name,
151
150
  label: i.label
152
151
  }, {
153
152
  default: f(() => [
154
- typeof i.icon == "string" ? (t(), d(l(U), {
153
+ typeof i.icon == "string" ? (t(), _(l(Q), {
155
154
  key: 0,
156
- icon: g[i.icon]
157
- }, null, 8, ["icon"])) : (t(), d(C(i.icon), { key: 1 }))
155
+ icon: I[i.icon]
156
+ }, null, 8, ["icon"])) : (t(), _(x(i.icon), { key: 1 }))
158
157
  ]),
159
158
  _: 2
160
159
  }, 1032, ["name", "label"]))), 128))
@@ -163,17 +162,17 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
163
162
  }, 8, ["max-num"])
164
163
  ])
165
164
  ]),
166
- (w = e.operations) != null && w.length && ((B = e.sources) != null && B.length) || _.value && e.sources ? (t(), a("div", ae, [
167
- (F = e.operations) != null && F.length && ((M = e.sources) != null && M.length) ? (t(), a("div", re, [
168
- p("span", {
165
+ (S = e.operations) != null && S.length && ((F = e.sources) != null && F.length) || p.value && e.sources ? (t(), r("div", re, [
166
+ (M = e.operations) != null && M.length && ((R = e.sources) != null && R.length) ? (t(), r("div", ae, [
167
+ d("span", {
169
168
  class: "tr-feedback__source",
170
169
  onClick: u
171
170
  }, [
172
- p("span", null, y((G = e.sources) == null ? void 0 : G.length) + "条来源", 1),
173
- (t(), d(C(_.value ? l(T) : l(N))))
171
+ d("span", null, y((B = e.sources) == null ? void 0 : B.length) + "条来源", 1),
172
+ (t(), _(x(p.value ? l(T) : l(N))))
174
173
  ])
175
174
  ])) : k("", !0),
176
- _.value && e.sources ? (t(), d(l(ee), {
175
+ p.value && e.sources ? (t(), _(l(ee), {
177
176
  key: 1,
178
177
  sources: e.sources,
179
178
  "lines-limit": e.sourcesLinesLimit
@@ -182,12 +181,12 @@ const W = { class: "tr-feedback__source-list" }, Y = ["href"], Z = /* @__PURE__
182
181
  ]);
183
182
  };
184
183
  }
185
- }), I = /* @__PURE__ */ P(ie, [["__scopeId", "data-v-cc6ef316"]]);
186
- I.name = "TrFeedback";
187
- const ce = function(b) {
188
- b.component(I.name, I);
184
+ }), C = /* @__PURE__ */ X(ie, [["__scopeId", "data-v-affa572f"]]);
185
+ C.name = "TrFeedback";
186
+ const ce = function(h) {
187
+ h.component(C.name, C);
189
188
  };
190
- I.install = ce;
189
+ C.install = ce;
191
190
  export {
192
- I as default
191
+ C as default
193
192
  };
@@ -1,6 +1,6 @@
1
- import { defineComponent as q, mergeModels as E, useModel as G, watch as g, ref as i, computed as $, createElementBlock as a, openBlock as l, createElementVNode as C, Fragment as I, renderList as A, createCommentVNode as _, normalizeClass as b, createBlock as x, resolveDynamicComponent as B, toDisplayString as S, nextTick as H } from "vue";
2
- import { A as X } from "../tiny-robot-svgs.js";
3
- import { b as j, o as J } from "../index2.js";
1
+ import { defineComponent as q, mergeModels as E, useModel as G, watch as g, ref as i, computed as $, createElementBlock as a, openBlock as l, createElementVNode as I, Fragment as C, renderList as D, createCommentVNode as _, normalizeClass as x, createBlock as B, resolveDynamicComponent as b, toDisplayString as S, nextTick as H } from "vue";
2
+ import { IconArrowDown as X } from "@opentiny/tiny-robot-svgs";
3
+ import { e as j, o as J } from "../index2.js";
4
4
  import { _ as K } from "../_plugin-vue_export-helper.js";
5
5
  const P = ["onClick"], Q = {
6
6
  key: 0,
@@ -18,7 +18,7 @@ const P = ["onClick"], Q = {
18
18
  selectedModifiers: {}
19
19
  }),
20
20
  emits: /* @__PURE__ */ E(["item-click"], ["update:selected"]),
21
- setup(d, { emit: D }) {
21
+ setup(d, { emit: A }) {
22
22
  const n = d, u = G(d, "selected");
23
23
  g(
24
24
  () => n.items,
@@ -27,11 +27,11 @@ const P = ["onClick"], Q = {
27
27
  },
28
28
  { immediate: !0 }
29
29
  );
30
- const F = D, y = i(null), w = i(null), k = i(null), M = i([]), s = i(null), m = i(!1), c = i(!1), N = (t, o) => {
30
+ const F = A, w = i(null), y = i(null), k = i(null), M = i([]), s = i(null), m = i(!1), c = i(!1), N = (t, o) => {
31
31
  t && (M.value[o] = t);
32
32
  }, L = () => {
33
33
  s.value = null, m.value = !1, H(() => {
34
- const t = y.value, o = w.value;
34
+ const t = w.value, o = y.value;
35
35
  if (!t || !o)
36
36
  return;
37
37
  const e = M.value.slice(0, n.items.length).filter((r) => !!r).map((r) => r.offsetTop), f = Array.from(new Set(e));
@@ -43,7 +43,7 @@ const P = ["onClick"], Q = {
43
43
  });
44
44
  };
45
45
  g(() => n.items, L);
46
- const { width: W } = j(y);
46
+ const { width: W } = j(w);
47
47
  g(W, (t) => {
48
48
  t > 0 && L();
49
49
  });
@@ -54,41 +54,44 @@ const P = ["onClick"], Q = {
54
54
  }, v = (t) => {
55
55
  n.showMoreTrigger === "hover" && (c.value = t);
56
56
  };
57
- return J(k, (t) => {
58
- var o, e;
59
- (o = k.value) != null && o.contains(t.target) || (e = w.value) != null && e.contains(t.target) || (c.value = !1);
60
- }), (t, o) => (l(), a("div", {
57
+ return J(
58
+ k,
59
+ () => {
60
+ c.value = !1;
61
+ },
62
+ { ignore: [k, y] }
63
+ ), (t, o) => (l(), a("div", {
61
64
  class: "tr-flow-layout",
62
65
  ref_key: "containerRef",
63
- ref: y
66
+ ref: w
64
67
  }, [
65
- (l(!0), a(I, null, A(n.items, (e, f) => (l(), a(I, {
68
+ (l(!0), a(C, null, D(n.items, (e, f) => (l(), a(C, {
66
69
  key: e.id
67
70
  }, [
68
71
  s.value === null || f < s.value ? (l(), a("button", {
69
72
  key: 0,
70
- class: b(["tr-flow-layout__item", { "icon-only": !e.label }, { selected: e.id === u.value }]),
73
+ class: x(["tr-flow-layout__item", { "icon-only": !e.label }, { selected: e.id === u.value }]),
71
74
  ref_for: !0,
72
75
  ref: (r) => N(r, f),
73
76
  onClick: (r) => R(e.id)
74
77
  }, [
75
- (l(), x(B(e.icon), { class: "tr-flow-layout__item-icon" })),
78
+ (l(), B(b(e.icon), { class: "tr-flow-layout__item-icon" })),
76
79
  e.label ? (l(), a("span", Q, S(e.label), 1)) : _("", !0)
77
80
  ], 10, P)) : _("", !0)
78
81
  ], 64))), 128)),
79
- C("div", U, [
82
+ I("div", U, [
80
83
  m.value ? _("", !0) : (l(), a("button", {
81
84
  key: 0,
82
- class: b(["tr-flow-layout__item", "icon-only", { selected: O.value }]),
85
+ class: x(["tr-flow-layout__item", "icon-only", { selected: O.value }]),
83
86
  ref_key: "moreButtonRef",
84
- ref: w,
87
+ ref: y,
85
88
  onClick: V,
86
89
  onMouseenter: o[0] || (o[0] = (e) => v(!0)),
87
90
  onMouseleave: o[1] || (o[1] = (e) => v(!1))
88
91
  }, [
89
- (l(), x(B(n.moreIcon), { class: "tr-flow-layout__item-icon" }))
92
+ (l(), B(b(n.moreIcon), { class: "tr-flow-layout__item-icon" }))
90
93
  ], 34)),
91
- C("div", {
94
+ I("div", {
92
95
  class: "tr-flow-layout__dropdown-container",
93
96
  onMouseenter: o[2] || (o[2] = (e) => v(!0)),
94
97
  onMouseleave: o[3] || (o[3] = (e) => v(!1))
@@ -99,20 +102,20 @@ const P = ["onClick"], Q = {
99
102
  ref_key: "dropDownRef",
100
103
  ref: k
101
104
  }, [
102
- (l(!0), a(I, null, A(z.value, (e) => (l(), a("button", {
103
- class: b(["tr-flow-layout__dropdown_item", { selected: e.id === u.value }]),
105
+ (l(!0), a(C, null, D(z.value, (e) => (l(), a("button", {
106
+ class: x(["tr-flow-layout__dropdown_item", { selected: e.id === u.value }]),
104
107
  key: e.id,
105
108
  onClick: (f) => R(e.id)
106
109
  }, [
107
- (l(), x(B(e.icon), { class: "tr-flow-layout__item-icon" })),
108
- C("span", Z, S(e.label), 1)
110
+ (l(), B(b(e.icon), { class: "tr-flow-layout__item-icon" })),
111
+ I("span", Z, S(e.label), 1)
109
112
  ], 10, Y))), 128))
110
113
  ], 512)) : _("", !0)
111
114
  ], 32)
112
115
  ])
113
116
  ], 512));
114
117
  }
115
- }), p = /* @__PURE__ */ K(ee, [["__scopeId", "data-v-8d510691"]]);
118
+ }), p = /* @__PURE__ */ K(ee, [["__scopeId", "data-v-f82cf3dc"]]);
116
119
  p.name = "TrFlowLayout";
117
120
  const te = function(d) {
118
121
  d.component(p.name, p);