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

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,7 +1,6 @@
1
- import { defineComponent as V, createElementBlock as u, openBlock as n, normalizeStyle as X, normalizeClass as D, createElementVNode as p, toDisplayString as k, createVNode as h, unref as e, ref as G, watchEffect as Y, nextTick as Z, mergeModels as N, useCssVars as q, computed as m, useModel as P, createCommentVNode as E, Fragment as T, renderList as $, createBlock as R, withDirectives as ee, mergeProps as te, withCtx as H, withModifiers as S, vModelText as re } from "vue";
2
- import { u as oe, m as se, p as ae, o as ne, s as ie } from "../tiny-robot-svgs.js";
3
- import { I as le } from "../index5.js";
4
- import { T as U } from "../index4.js";
1
+ import { defineComponent as V, createElementBlock as u, openBlock as a, normalizeStyle as X, normalizeClass as D, createElementVNode as p, toDisplayString as k, createVNode as y, unref as e, ref as S, watchEffect as Y, nextTick as Z, mergeModels as A, useCssVars as q, computed as h, useModel as G, createCommentVNode as w, Fragment as T, renderList as $, createBlock as N, withDirectives as ee, mergeProps as te, withCtx as R, withModifiers as H, vModelText as re } from "vue";
2
+ import { IconEmptySearch as oe, IconSearch as se, IconEditPen as ne, IconDelete as ae, IconClose as ie } from "@opentiny/tiny-robot-svgs";
3
+ import { TinyInput as le, TinyTooltip as U } from "@opentiny/vue";
5
4
  import B from "../icon-button/index.js";
6
5
  import { o as ce } from "../index2.js";
7
6
  import { _ as M } from "../_plugin-vue_export-helper.js";
@@ -14,41 +13,41 @@ const ue = /* @__PURE__ */ V({
14
13
  },
15
14
  setup(i) {
16
15
  const t = i;
17
- return (a, _) => (n(), u("div", {
16
+ return (n, _) => (a(), u("div", {
18
17
  class: D(["tr-history__item-tag", t.type]),
19
18
  style: X(t.style)
20
19
  }, [
21
20
  p("span", null, k(t.text), 1)
22
21
  ], 6));
23
22
  }
24
- }), de = /* @__PURE__ */ M(ue, [["__scopeId", "data-v-346767bb"]]), _e = { class: "tr-history__empty" }, pe = { class: "tr-history__empty-icon" }, me = { class: "tr-history__empty-text" }, he = /* @__PURE__ */ V({
23
+ }), de = /* @__PURE__ */ M(ue, [["__scopeId", "data-v-346767bb"]]), _e = { class: "tr-history__empty" }, pe = { class: "tr-history__empty-icon" }, he = { class: "tr-history__empty-text" }, ye = /* @__PURE__ */ V({
25
24
  __name: "search-empty",
26
25
  props: {
27
26
  text: { default: "暂无内容" }
28
27
  },
29
28
  setup(i) {
30
29
  const t = i;
31
- return (a, _) => (n(), u("div", _e, [
30
+ return (n, _) => (a(), u("div", _e, [
32
31
  p("span", pe, [
33
- h(e(oe))
32
+ y(e(oe))
34
33
  ]),
35
- p("span", me, k(t.text), 1)
34
+ p("span", he, k(t.text), 1)
36
35
  ]));
37
36
  }
38
- }), ve = /* @__PURE__ */ M(he, [["__scopeId", "data-v-b21f5bc0"]]), ye = (i) => {
39
- const t = G(), a = (l) => {
37
+ }), me = /* @__PURE__ */ M(ye, [["__scopeId", "data-v-b21f5bc0"]]), ve = (i) => {
38
+ const t = S(), n = (l) => {
40
39
  t.value = {
41
40
  id: l.id,
42
41
  title: l.title,
43
42
  rawData: l
44
43
  };
45
- }, _ = G(null), v = (l) => {
44
+ }, _ = S(null), m = (l) => {
46
45
  l && Z(() => {
47
46
  _.value = l, _.value.focus();
48
47
  });
49
48
  };
50
49
  let r;
51
- const y = () => {
50
+ const v = () => {
52
51
  if (t.value) {
53
52
  if (t.value.title !== t.value.rawData.title) {
54
53
  const { title: l, rawData: I } = t.value;
@@ -60,27 +59,27 @@ const ue = /* @__PURE__ */ V({
60
59
  }, g = () => {
61
60
  t.value = void 0, r == null || r(), r = void 0;
62
61
  }, b = (l) => {
63
- l.key === "Enter" ? y() : l.key === "Escape" && g();
62
+ l.key === "Enter" ? v() : l.key === "Escape" && g();
64
63
  };
65
64
  return Y(() => {
66
65
  _.value && (r == null || r(), r = ce(_, () => {
67
- y();
66
+ v();
68
67
  }));
69
68
  }), {
70
69
  editingItem: t,
71
- handleEdit: a,
72
- handleEditorInputRef: v,
70
+ handleEdit: n,
71
+ handleEditorInputRef: m,
73
72
  handleKeyDown: b
74
73
  };
75
74
  }, fe = { class: "tr-history" }, ke = { class: "tr-history__tabs" }, ge = ["onClick"], be = {
76
75
  key: 0,
77
76
  class: "tr-history__search"
78
- }, xe = { class: "tr-history__content" }, Ce = {
77
+ }, Ce = { class: "tr-history__content" }, xe = {
79
78
  key: 0,
80
79
  class: "tr-history__group-title"
81
- }, Te = ["onClick"], Ie = { class: "tr-history__item-title" }, we = { class: "tr-history__item-actions" }, Ee = { class: "tr-history__close" }, $e = /* @__PURE__ */ V({
80
+ }, Te = ["onClick"], Ie = { class: "tr-history__item-title" }, Ee = { class: "tr-history__item-actions" }, we = { class: "tr-history__close" }, $e = /* @__PURE__ */ V({
82
81
  __name: "index",
83
- props: /* @__PURE__ */ N({
82
+ props: /* @__PURE__ */ A({
84
83
  tabTitle: {},
85
84
  data: {},
86
85
  activeTab: {},
@@ -96,118 +95,118 @@ const ue = /* @__PURE__ */ V({
96
95
  searchQuery: {},
97
96
  searchQueryModifiers: {}
98
97
  }),
99
- emits: /* @__PURE__ */ N(["close", "item-click", "item-title-change", "item-delete"], ["update:activeTab", "update:searchQuery"]),
98
+ emits: /* @__PURE__ */ A(["close", "item-click", "item-title-change", "item-delete"], ["update:activeTab", "update:searchQuery"]),
100
99
  setup(i, { emit: t }) {
101
100
  q((c) => ({
102
- d4b77bae: b.value ? "1px solid rgb(240, 240, 240)" : "none",
103
- "659130e6": b.value ? "2px solid rgb(25, 25, 25)" : "none"
101
+ "3a9ca538": b.value ? "1px solid rgb(240, 240, 240)" : "none",
102
+ "0b9d3e32": b.value ? "2px solid rgb(25, 25, 25)" : "none"
104
103
  }));
105
- const a = i, _ = P(i, "activeTab"), v = P(i, "searchQuery"), r = t, y = m(() => Array.isArray(a.tabs) ? a.tabs : [{ title: a.tabTitle, id: "0" }]), g = m(() => _.value || y.value[0].id), b = m(() => y.value.length > 1), l = (c) => {
104
+ const n = i, _ = G(i, "activeTab"), m = G(i, "searchQuery"), r = t, v = h(() => Array.isArray(n.tabs) ? n.tabs : [{ title: n.tabTitle, id: "0" }]), g = h(() => _.value || v.value[0].id), b = h(() => v.value.length > 1), l = (c) => {
106
105
  var s;
107
106
  const o = typeof ((s = c[0]) == null ? void 0 : s.group);
108
107
  return o === "string" || o === "symbol";
109
- }, I = m(() => Array.isArray(a.data) ? a.data || [] : a.data[g.value] || []), w = Symbol("NO_GROUP"), O = m(() => {
108
+ }, I = h(() => Array.isArray(n.data) ? n.data || [] : n.data[g.value] || []), E = Symbol("NO_GROUP"), O = h(() => {
110
109
  const c = I.value;
111
- return l(c) ? c : [{ group: w, items: c }];
112
- }), x = m(() => a.searchBar ? O.value.map((o) => ({
110
+ return l(c) ? c : [{ group: E, items: c }];
111
+ }), C = h(() => n.searchBar ? O.value.map((o) => ({
113
112
  ...o,
114
- items: o.items.filter((s) => a.searchFn(v.value || "", s))
115
- })).filter((o) => o.items.length > 0) : O.value), L = m(() => x.value.length === 0 ? !1 : x.value[0].group === w ? x.value[0].items.length > 0 : !0), z = (c) => {
113
+ items: o.items.filter((s) => n.searchFn(m.value || "", s))
114
+ })).filter((o) => o.items.length > 0) : O.value), L = h(() => C.value.length === 0 ? !1 : C.value[0].group === E ? C.value[0].items.length > 0 : !0), z = (c) => {
116
115
  var o;
117
- c.id !== ((o = C.value) == null ? void 0 : o.id) && r("item-click", c);
116
+ c.id !== ((o = x.value) == null ? void 0 : o.id) && r("item-click", c);
118
117
  }, W = () => {
119
118
  r("close");
120
119
  }, F = (c) => {
121
120
  r("item-delete", c);
122
- }, { editingItem: C, handleEdit: j, handleEditorInputRef: J, handleKeyDown: Q } = ye(r);
123
- return (c, o) => (n(), u("div", fe, [
121
+ }, { editingItem: x, handleEdit: j, handleEditorInputRef: J, handleKeyDown: P } = ve(r);
122
+ return (c, o) => (a(), u("div", fe, [
124
123
  p("div", ke, [
125
- (n(!0), u(T, null, $(y.value, (s) => (n(), u("div", {
124
+ (a(!0), u(T, null, $(v.value, (s) => (a(), u("div", {
126
125
  key: s.id,
127
126
  class: D(["tr-history__tab", { active: g.value === s.id }]),
128
127
  onClick: (d) => _.value = s.id
129
128
  }, k(s.title), 11, ge))), 128))
130
129
  ]),
131
- a.searchBar ? (n(), u("div", be, [
132
- h(e(le), {
133
- modelValue: v.value,
134
- "onUpdate:modelValue": o[0] || (o[0] = (s) => v.value = s),
135
- placeholder: a.searchPlaceholder || "搜索对话名称",
130
+ n.searchBar ? (a(), u("div", be, [
131
+ y(e(le), {
132
+ modelValue: m.value,
133
+ "onUpdate:modelValue": o[0] || (o[0] = (s) => m.value = s),
134
+ placeholder: n.searchPlaceholder || "搜索对话名称",
136
135
  "prefix-icon": e(se),
137
136
  clearable: ""
138
137
  }, null, 8, ["modelValue", "placeholder", "prefix-icon"])
139
- ])) : E("", !0),
140
- p("div", xe, [
141
- L.value ? (n(!0), u(T, { key: 0 }, $(x.value, (s) => (n(), u("div", {
138
+ ])) : w("", !0),
139
+ p("div", Ce, [
140
+ L.value ? (a(!0), u(T, { key: 0 }, $(C.value, (s) => (a(), u("div", {
142
141
  key: s.group,
143
142
  class: "tr-history__group"
144
143
  }, [
145
- s.group !== e(w) ? (n(), u("div", Ce, [
144
+ s.group !== e(E) ? (a(), u("div", xe, [
146
145
  p("span", null, k(s.group), 1)
147
- ])) : E("", !0),
148
- (n(!0), u(T, null, $(s.items, (d) => {
149
- var A;
150
- return n(), u("div", {
146
+ ])) : w("", !0),
147
+ (a(!0), u(T, null, $(s.items, (d) => {
148
+ var Q;
149
+ return a(), u("div", {
151
150
  key: `${d.id}-${d.title}`,
152
- class: D(["tr-history__item", { selected: a.selected === d.id }]),
151
+ class: D(["tr-history__item", { selected: n.selected === d.id }]),
153
152
  onClick: (f) => z(d)
154
153
  }, [
155
- ((A = e(C)) == null ? void 0 : A.id) !== d.id ? (n(), u(T, { key: 0 }, [
154
+ ((Q = e(x)) == null ? void 0 : Q.id) !== d.id ? (a(), u(T, { key: 0 }, [
156
155
  p("span", Ie, k(d.title), 1),
157
- d.tag ? (n(), R(e(de), te({
156
+ d.tag ? (a(), N(e(de), te({
158
157
  key: 0,
159
158
  class: "tr-history__item-tag"
160
- }, { ref_for: !0 }, d.tag), null, 16)) : E("", !0),
161
- p("div", we, [
162
- h(e(U), {
159
+ }, { ref_for: !0 }, d.tag), null, 16)) : w("", !0),
160
+ p("div", Ee, [
161
+ y(e(U), {
163
162
  content: "编辑",
164
163
  effect: "dark",
165
164
  placement: "top",
166
165
  "open-delay": 500
167
166
  }, {
168
- default: H(() => [
169
- h(e(B), {
170
- icon: e(ae),
171
- onClick: S((f) => e(j)(d), ["stop"])
167
+ default: R(() => [
168
+ y(e(B), {
169
+ icon: e(ne),
170
+ onClick: H((f) => e(j)(d), ["stop"])
172
171
  }, null, 8, ["icon", "onClick"])
173
172
  ]),
174
173
  _: 2
175
174
  }, 1024),
176
- h(e(U), {
175
+ y(e(U), {
177
176
  content: "删除",
178
177
  effect: "dark",
179
178
  placement: "top",
180
179
  "open-delay": 500
181
180
  }, {
182
- default: H(() => [
183
- h(e(B), {
184
- icon: e(ne),
185
- onClick: S((f) => F(d), ["stop"])
181
+ default: R(() => [
182
+ y(e(B), {
183
+ icon: e(ae),
184
+ onClick: H((f) => F(d), ["stop"])
186
185
  }, null, 8, ["icon", "onClick"])
187
186
  ]),
188
187
  _: 2
189
188
  }, 1024)
190
189
  ])
191
- ], 64)) : ee((n(), u("input", {
190
+ ], 64)) : ee((a(), u("input", {
192
191
  key: 1,
193
- "onUpdate:modelValue": o[1] || (o[1] = (f) => e(C).title = f),
192
+ "onUpdate:modelValue": o[1] || (o[1] = (f) => e(x).title = f),
194
193
  class: "tr-history__item-edit",
195
194
  ref_for: !0,
196
195
  ref: e(J),
197
196
  onKeydown: o[2] || (o[2] = //@ts-ignore
198
- (...f) => e(Q) && e(Q)(...f))
197
+ (...f) => e(P) && e(P)(...f))
199
198
  }, null, 544)), [
200
- [re, e(C).title]
199
+ [re, e(x).title]
201
200
  ])
202
201
  ], 10, Te);
203
202
  }), 128))
204
- ]))), 128)) : (n(), R(e(ve), {
203
+ ]))), 128)) : (a(), N(e(me), {
205
204
  key: 1,
206
- text: v.value ? "暂无搜索结果" : "暂无内容"
205
+ text: m.value ? "暂无搜索结果" : "暂无内容"
207
206
  }, null, 8, ["text"]))
208
207
  ]),
209
- p("div", Ee, [
210
- h(e(B), {
208
+ p("div", we, [
209
+ y(e(B), {
211
210
  icon: e(ie),
212
211
  rounded: "",
213
212
  onClick: W
@@ -215,13 +214,13 @@ const ue = /* @__PURE__ */ V({
215
214
  ])
216
215
  ]));
217
216
  }
218
- }), K = /* @__PURE__ */ M($e, [["__scopeId", "data-v-8aa5fd59"]]), Be = function(i) {
217
+ }), K = /* @__PURE__ */ M($e, [["__scopeId", "data-v-87ea1242"]]), Be = function(i) {
219
218
  i.component("TrHistory", K);
220
- }, Ne = {
219
+ }, Se = {
221
220
  ...K,
222
221
  install: Be,
223
222
  name: "TrHistory"
224
223
  };
225
224
  export {
226
- Ne as default
225
+ Se as default
227
226
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as p, useCssVars as l, computed as n, createElementBlock as u, openBlock as s, normalizeClass as m, createBlock as d, resolveDynamicComponent as _ } from "vue";
2
- import { t as c } from "../utils.js";
1
+ import { defineComponent as r, computed as a, createElementBlock as u, openBlock as l, normalizeStyle as c, normalizeClass as p, createBlock as m, resolveDynamicComponent as d } from "vue";
2
+ import { t as i } from "../utils.js";
3
3
  import { _ as f } from "../_plugin-vue_export-helper.js";
4
- const v = /* @__PURE__ */ p({
4
+ const _ = /* @__PURE__ */ r({
5
5
  __name: "index",
6
6
  props: {
7
7
  icon: {},
@@ -9,24 +9,23 @@ const v = /* @__PURE__ */ p({
9
9
  svgSize: { default: "16px" },
10
10
  rounded: { type: Boolean }
11
11
  },
12
- setup(t) {
13
- l((i) => ({
14
- "72b46ad2": a.value,
15
- 66777814: r.value
16
- }));
17
- const o = t, a = n(() => c(o.size)), r = n(() => c(o.svgSize));
18
- return (i, z) => (s(), u("button", {
19
- class: m(["tr-icon-button", { rounded: o.rounded }])
12
+ setup(o) {
13
+ const e = o, s = a(() => i(e.size)), n = a(() => i(e.svgSize));
14
+ return (z, h) => (l(), u("button", {
15
+ class: p(["tr-icon-button", { rounded: e.rounded }]),
16
+ style: c({ width: s.value, height: s.value })
20
17
  }, [
21
- (s(), d(_(o.icon)))
22
- ], 2));
18
+ (l(), m(d(e.icon), {
19
+ style: c({ width: n.value, height: n.value, fontSize: n.value })
20
+ }, null, 8, ["style"]))
21
+ ], 6));
23
22
  }
24
- }), e = /* @__PURE__ */ f(v, [["__scopeId", "data-v-fe8553bc"]]);
25
- e.name = "TrIconButton";
26
- const x = function(t) {
27
- t.component(e.name, e);
23
+ }), t = /* @__PURE__ */ f(_, [["__scopeId", "data-v-30fef9fd"]]);
24
+ t.name = "TrIconButton";
25
+ const v = function(o) {
26
+ o.component(t.name, t);
28
27
  };
29
- e.install = x;
28
+ t.install = v;
30
29
  export {
31
- e as default
30
+ t as default
32
31
  };