@opentiny/tiny-robot 0.3.0-alpha.14 → 0.3.0-alpha.16

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,68 +1,66 @@
1
- import { defineComponent as z, createElementBlock as m, createCommentVNode as W, openBlock as n, createBlock as L, createElementVNode as v, resolveDynamicComponent as u0, createVNode as $, unref as h, toDisplayString as S, renderSlot as g, mergeModels as E, useModel as j, ref as i, computed as p, watch as N, Transition as c0, withCtx as x, normalizeStyle as A, normalizeClass as V, Fragment as p0, renderList as d0, createTextVNode as f0 } from "vue";
2
- import { d as v0, x as g0 } from "../tiny-robot-svgs.js";
3
- import { a as m0, h as _0, u as h0, w as C0, e as y0, o as L0 } from "../index3.js";
4
- import { u as w0, c as k0, B as M0 } from "../index4.js";
5
- import F0 from "../flow-layout-buttons/index.js";
6
- import T0 from "../icon-button/index.js";
7
- import { _ as w } from "../_plugin-vue_export-helper.js";
8
- import { _ as $0 } from "../loading.js";
9
- import { t as R } from "../utils.js";
10
- const x0 = {
11
- key: 0,
12
- class: "tr-question-popover__backdrop"
13
- }, q0 = /* @__PURE__ */ z({
14
- __name: "Backdrop",
15
- props: {
16
- show: { type: Boolean }
17
- },
18
- setup(s) {
19
- return (t, C) => t.show ? (n(), m("div", x0)) : W("", !0);
20
- }
21
- }), B0 = /* @__PURE__ */ w(q0, [["__scopeId", "data-v-50205eaf"]]), I0 = { class: "tr-question__header" }, R0 = {
1
+ import { defineComponent as V, createElementBlock as p, openBlock as s, createBlock as F, createElementVNode as g, createVNode as $, resolveDynamicComponent as p0, unref as a, toDisplayString as Z, renderSlot as T, mergeModels as W, useModel as Q, ref as c, computed as m, watch as B, Transition as j, withCtx as R, createCommentVNode as z, normalizeStyle as H, normalizeClass as N, useCssVars as f0, useAttrs as v0, Fragment as P, renderList as g0, createTextVNode as m0 } from "vue";
2
+ import { c as J, d as _0, u as h0, b as C0, o as y0 } from "../index2.js";
3
+ import L0 from "../flow-layout-buttons/index.js";
4
+ import { t as d } from "../utils.js";
5
+ import { P as w0, f as k0 } from "../tiny-robot-svgs.js";
6
+ import M0 from "../icon-button/index.js";
7
+ import { _ as q } from "../_plugin-vue_export-helper.js";
8
+ import { _ as x0 } from "../loading.js";
9
+ const F0 = { class: "tr-question__header" }, $0 = {
22
10
  key: 1,
23
11
  class: "tr-question__header-icon"
24
- }, S0 = { class: "tr-question__header-title" }, b0 = /* @__PURE__ */ z({
12
+ }, T0 = { class: "tr-question__header-title" }, q0 = /* @__PURE__ */ V({
25
13
  __name: "Header",
26
14
  props: {
27
15
  icon: {},
28
16
  title: {}
29
17
  },
30
- setup(s) {
31
- const t = s;
32
- return (C, o) => (n(), m("div", I0, [
33
- t.icon ? (n(), L(u0(t.icon), { key: 0 })) : (n(), m("span", R0, [
34
- $(h(v0), { style: { color: "#1476ff" } })
18
+ emits: ["close"],
19
+ setup(n, { emit: o }) {
20
+ const t = n, f = o, L = () => {
21
+ f("close");
22
+ };
23
+ return (w, r) => (s(), p("div", F0, [
24
+ t.icon ? (s(), F(p0(t.icon), { key: 0 })) : (s(), p("span", $0, [
25
+ $(a(w0), { style: { color: "#1476ff" } })
35
26
  ])),
36
- v("h3", S0, S(t.title), 1)
27
+ g("h3", T0, Z(t.title), 1),
28
+ $(a(M0), {
29
+ class: "tr-question-popover__close",
30
+ icon: a(k0),
31
+ size: "24",
32
+ "svg-size": "20",
33
+ onClick: L
34
+ }, null, 8, ["icon"])
37
35
  ]));
38
36
  }
39
- }), z0 = /* @__PURE__ */ w(b0, [["__scopeId", "data-v-76bef623"]]), Z0 = {}, G0 = { class: "tr-question__loading-wrapper" };
40
- function O0(s, t) {
41
- return n(), m("div", G0, [
42
- g(s.$slots, "default", {}, () => [
43
- t[0] || (t[0] = v("img", {
37
+ }), b0 = /* @__PURE__ */ q(q0, [["__scopeId", "data-v-bc7ae445"]]), I0 = {}, S0 = { class: "tr-question__loading-wrapper" };
38
+ function R0(n, o) {
39
+ return s(), p("div", S0, [
40
+ T(n.$slots, "default", {}, () => [
41
+ o[0] || (o[0] = g("img", {
44
42
  class: "tr-question__loading",
45
- src: $0
43
+ src: x0
46
44
  }, null, -1)),
47
- t[1] || (t[1] = v("span", { class: "tr-question__loading-text" }, "正在加载", -1))
45
+ o[1] || (o[1] = g("span", { class: "tr-question__loading-text" }, "正在加载", -1))
48
46
  ], !0)
49
47
  ]);
50
48
  }
51
- const P0 = /* @__PURE__ */ w(Z0, [["render", O0], ["__scopeId", "data-v-5cdf0688"]]), E0 = "data:image/svg+xml,%3csvg%20width='120.000000'%20height='120.000000'%20viewBox='0%200%20120%20120'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdesc%3e%20Created%20with%20Pixso.%20%3c/desc%3e%3cdefs%20/%3e%3crect%20width='120.000000'%20height='120.000000'%20fill='%23FFFFFF'%20fill-opacity='0'%20/%3e%3cpath%20d='M18.75%2037.31L104.52%2037.31C107.68%2037.31%20110.25%2039.87%20110.25%2043.04L110.25%20105.15C110.25%20108.28%20107.71%20110.81%20104.59%20110.81L24.4%20110.81C21.28%20110.81%2018.75%20108.28%2018.75%20105.15L18.75%2037.31Z'%20fill='%23F0F0F0'%20fill-opacity='1.000000'%20fill-rule='evenodd'%20/%3e%3cpath%20d='M13.22%2038.06L84.75%2038.06L84.75%20105.15C84.75%20108.28%2082.21%20110.81%2079.09%20110.81L16.9%20110.81C13.78%20110.81%2011.25%20108.12%2011.25%20105L11.25%2059.25L0.75%2059.25C0.75%2058.15%2012.13%2038.06%2013.22%2038.06Z'%20fill='%23FFFFFF'%20fill-opacity='1.000000'%20fill-rule='evenodd'%20/%3e%3cpath%20d='M84.44%2038.06L105.13%2038.06C106.16%2038.06%20107.41%2037.86%20107.91%2038.76L118.07%2056.96C118.45%2057.64%20119.18%2058.68%20118.5%2059.06C118.28%2059.17%20117.08%2059.06%20116.84%2059.06L99.33%2059.06C97.21%2059.06%2095.27%2057.87%2094.3%2055.98L84.44%2038.06Z'%20fill='%23FFFFFF'%20fill-opacity='1.000000'%20fill-rule='evenodd'%20/%3e%3cpath%20d='M110.42%2059.08L110.42%20105.09C110.42%20108.35%20107.78%20111%20104.51%20111L78.89%20111L78.89%20109.68L104.51%20109.68C107.05%20109.68%20109.11%20107.63%20109.11%20105.09L109.11%2059.08L110.42%2059.08Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M85.38%2037.5L85.38%20105.09C85.38%20108.35%2082.73%20111%2079.46%20111L16.42%20111C13.15%20111%2010.51%20108.35%2010.51%20105.09L10.51%2059.08L11.82%2059.08L11.82%20105.09C11.82%20107.63%2013.88%20109.68%2016.42%20109.68L79.46%20109.68C82%20109.68%2084.06%20107.63%2084.06%20105.09L84.06%2038.81L16%2038.81L16%2037.5L85.38%2037.5Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M14.14%2037.5C13.25%2037.5%2012.42%2037.96%2011.95%2038.74L0.19%2057.97C-0.19%2058.59%200%2059.41%200.6%2059.79C0.81%2059.92%201.05%2060%201.29%2060L68.53%2060C70.28%2060%2071.92%2059.08%2072.87%2057.58L85.56%2037.5L14.14%2037.5ZM14.47%2039L82.76%2039L71.48%2056.71C70.78%2057.82%2069.56%2058.5%2068.26%2058.5L1.76%2058.5L13.39%2039.61C13.62%2039.23%2014.03%2039%2014.47%2039Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M106.12%2037.5C106.97%2037.5%20107.75%2037.95%20108.21%2038.7L119.8%2057.79C120.17%2058.4%20120%2059.21%20119.43%2059.6C119.22%2059.74%20118.99%2059.81%20118.75%2059.81L99.22%2059.81C97.46%2059.81%2095.83%2058.82%2094.94%2057.22L83.97%2037.5L106.12%2037.5ZM106.09%2039L86.69%2039L96.27%2056.57C96.92%2057.76%2098.11%2058.5%2099.39%2058.5L118.35%2058.5L107.1%2039.59C106.88%2039.22%20106.5%2039%20106.09%2039Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3crect%20x='20.250000'%20y='84.000000'%20rx='1.886225'%20width='20.999998'%20height='6.000000'%20fill='%231476FF'%20fill-opacity='1.000000'%20/%3e%3cpath%20d='M35.34%2094.5C35.7%2094.5%2036%2094.83%2036%2095.25C36%2095.66%2035.7%2096%2035.34%2096L20.9%2096C20.54%2096%2020.25%2095.66%2020.25%2095.25C20.25%2094.83%2020.54%2094.5%2020.9%2094.5L35.34%2094.5Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3crect%20x='20.250000'%20y='99.000000'%20rx='0.750000'%20width='7.500000'%20height='1.500000'%20fill='%23808080'%20fill-opacity='1.000000'%20/%3e%3cpath%20d='M60%209C60.41%209%2060.75%209.29%2060.75%209.66L60.75%2018.91C60.75%2019.27%2060.41%2019.57%2060%2019.57C59.58%2019.57%2059.24%2019.27%2059.24%2018.91L59.24%209.66C59.24%209.29%2059.58%209%2060%209Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M84.83%2012.96C85.19%2013.17%2085.33%2013.59%2085.15%2013.91L80.52%2021.92C80.34%2022.24%2079.9%2022.33%2079.54%2022.12C79.18%2021.91%2079.03%2021.48%2079.21%2021.17L83.84%2013.16C84.02%2012.84%2084.46%2012.75%2084.83%2012.96Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M35.17%2012.96C35.53%2012.75%2035.97%2012.84%2036.15%2013.16L40.78%2021.17C40.96%2021.48%2040.81%2021.91%2040.45%2022.12C40.09%2022.33%2039.65%2022.24%2039.47%2021.92L34.84%2013.91C34.66%2013.59%2034.81%2013.17%2035.17%2012.96Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3c/svg%3e", N0 = {}, V0 = { class: "tr-question__no-data-wrapper" };
52
- function W0(s, t) {
53
- return n(), m("div", V0, [
54
- g(s.$slots, "default", {}, () => [
55
- t[0] || (t[0] = v("img", {
49
+ const z0 = /* @__PURE__ */ q(I0, [["render", R0], ["__scopeId", "data-v-4847dfc6"]]), Z0 = "data:image/svg+xml,%3csvg%20width='120.000000'%20height='120.000000'%20viewBox='0%200%20120%20120'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3cdesc%3e%20Created%20with%20Pixso.%20%3c/desc%3e%3cdefs%20/%3e%3crect%20width='120.000000'%20height='120.000000'%20fill='%23FFFFFF'%20fill-opacity='0'%20/%3e%3cpath%20d='M18.75%2037.31L104.52%2037.31C107.68%2037.31%20110.25%2039.87%20110.25%2043.04L110.25%20105.15C110.25%20108.28%20107.71%20110.81%20104.59%20110.81L24.4%20110.81C21.28%20110.81%2018.75%20108.28%2018.75%20105.15L18.75%2037.31Z'%20fill='%23F0F0F0'%20fill-opacity='1.000000'%20fill-rule='evenodd'%20/%3e%3cpath%20d='M13.22%2038.06L84.75%2038.06L84.75%20105.15C84.75%20108.28%2082.21%20110.81%2079.09%20110.81L16.9%20110.81C13.78%20110.81%2011.25%20108.12%2011.25%20105L11.25%2059.25L0.75%2059.25C0.75%2058.15%2012.13%2038.06%2013.22%2038.06Z'%20fill='%23FFFFFF'%20fill-opacity='1.000000'%20fill-rule='evenodd'%20/%3e%3cpath%20d='M84.44%2038.06L105.13%2038.06C106.16%2038.06%20107.41%2037.86%20107.91%2038.76L118.07%2056.96C118.45%2057.64%20119.18%2058.68%20118.5%2059.06C118.28%2059.17%20117.08%2059.06%20116.84%2059.06L99.33%2059.06C97.21%2059.06%2095.27%2057.87%2094.3%2055.98L84.44%2038.06Z'%20fill='%23FFFFFF'%20fill-opacity='1.000000'%20fill-rule='evenodd'%20/%3e%3cpath%20d='M110.42%2059.08L110.42%20105.09C110.42%20108.35%20107.78%20111%20104.51%20111L78.89%20111L78.89%20109.68L104.51%20109.68C107.05%20109.68%20109.11%20107.63%20109.11%20105.09L109.11%2059.08L110.42%2059.08Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M85.38%2037.5L85.38%20105.09C85.38%20108.35%2082.73%20111%2079.46%20111L16.42%20111C13.15%20111%2010.51%20108.35%2010.51%20105.09L10.51%2059.08L11.82%2059.08L11.82%20105.09C11.82%20107.63%2013.88%20109.68%2016.42%20109.68L79.46%20109.68C82%20109.68%2084.06%20107.63%2084.06%20105.09L84.06%2038.81L16%2038.81L16%2037.5L85.38%2037.5Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M14.14%2037.5C13.25%2037.5%2012.42%2037.96%2011.95%2038.74L0.19%2057.97C-0.19%2058.59%200%2059.41%200.6%2059.79C0.81%2059.92%201.05%2060%201.29%2060L68.53%2060C70.28%2060%2071.92%2059.08%2072.87%2057.58L85.56%2037.5L14.14%2037.5ZM14.47%2039L82.76%2039L71.48%2056.71C70.78%2057.82%2069.56%2058.5%2068.26%2058.5L1.76%2058.5L13.39%2039.61C13.62%2039.23%2014.03%2039%2014.47%2039Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M106.12%2037.5C106.97%2037.5%20107.75%2037.95%20108.21%2038.7L119.8%2057.79C120.17%2058.4%20120%2059.21%20119.43%2059.6C119.22%2059.74%20118.99%2059.81%20118.75%2059.81L99.22%2059.81C97.46%2059.81%2095.83%2058.82%2094.94%2057.22L83.97%2037.5L106.12%2037.5ZM106.09%2039L86.69%2039L96.27%2056.57C96.92%2057.76%2098.11%2058.5%2099.39%2058.5L118.35%2058.5L107.1%2039.59C106.88%2039.22%20106.5%2039%20106.09%2039Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3crect%20x='20.250000'%20y='84.000000'%20rx='1.886225'%20width='20.999998'%20height='6.000000'%20fill='%231476FF'%20fill-opacity='1.000000'%20/%3e%3cpath%20d='M35.34%2094.5C35.7%2094.5%2036%2094.83%2036%2095.25C36%2095.66%2035.7%2096%2035.34%2096L20.9%2096C20.54%2096%2020.25%2095.66%2020.25%2095.25C20.25%2094.83%2020.54%2094.5%2020.9%2094.5L35.34%2094.5Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3crect%20x='20.250000'%20y='99.000000'%20rx='0.750000'%20width='7.500000'%20height='1.500000'%20fill='%23808080'%20fill-opacity='1.000000'%20/%3e%3cpath%20d='M60%209C60.41%209%2060.75%209.29%2060.75%209.66L60.75%2018.91C60.75%2019.27%2060.41%2019.57%2060%2019.57C59.58%2019.57%2059.24%2019.27%2059.24%2018.91L59.24%209.66C59.24%209.29%2059.58%209%2060%209Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M84.83%2012.96C85.19%2013.17%2085.33%2013.59%2085.15%2013.91L80.52%2021.92C80.34%2022.24%2079.9%2022.33%2079.54%2022.12C79.18%2021.91%2079.03%2021.48%2079.21%2021.17L83.84%2013.16C84.02%2012.84%2084.46%2012.75%2084.83%2012.96Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3cpath%20d='M35.17%2012.96C35.53%2012.75%2035.97%2012.84%2036.15%2013.16L40.78%2021.17C40.96%2021.48%2040.81%2021.91%2040.45%2022.12C40.09%2022.33%2039.65%2022.24%2039.47%2021.92L34.84%2013.91C34.66%2013.59%2034.81%2013.17%2035.17%2012.96Z'%20fill='%23808080'%20fill-opacity='1.000000'%20fill-rule='nonzero'%20/%3e%3c/svg%3e", B0 = {}, G0 = { class: "tr-question__no-data-wrapper" };
50
+ function O0(n, o) {
51
+ return s(), p("div", G0, [
52
+ T(n.$slots, "default", {}, () => [
53
+ o[0] || (o[0] = g("img", {
56
54
  class: "tr-question__no-data",
57
- src: E0
55
+ src: Z0
58
56
  }, null, -1)),
59
- t[1] || (t[1] = v("span", { class: "tr-question__no-data-text" }, "暂时没有内容", -1))
57
+ o[1] || (o[1] = g("span", { class: "tr-question__no-data-text" }, "暂时没有内容", -1))
60
58
  ], !0)
61
59
  ]);
62
60
  }
63
- const D0 = /* @__PURE__ */ w(N0, [["render", W0], ["__scopeId", "data-v-a33638dd"]]), U0 = { class: "tr-tooltip-content" }, H0 = /* @__PURE__ */ z({
61
+ const P0 = /* @__PURE__ */ q(B0, [["render", O0], ["__scopeId", "data-v-b7a7a181"]]), W0 = { class: "tr-tooltip-content" }, H0 = /* @__PURE__ */ V({
64
62
  __name: "Tooltip",
65
- props: /* @__PURE__ */ E({
63
+ props: /* @__PURE__ */ W({
66
64
  show: { type: Boolean },
67
65
  content: {},
68
66
  trigger: {},
@@ -75,248 +73,219 @@ const D0 = /* @__PURE__ */ w(N0, [["render", W0], ["__scopeId", "data-v-a33638dd
75
73
  showModifiers: {}
76
74
  }),
77
75
  emits: ["update:show"],
78
- setup(s) {
79
- const t = s, C = j(s, "show"), o = i(t.show), k = p(() => t.trigger), { x: u, y: d, width: _, height: M } = m0(k), Z = p(() => t.trigger ? {
80
- left: R(u.value),
81
- top: t.placement === "top" ? R(d.value) : R(d.value + M.value),
82
- width: R(_.value)
76
+ setup(n) {
77
+ const o = n, t = Q(n, "show"), f = c(o.show), L = m(() => o.trigger), { x: w, y: r, width: _, height: C } = J(L), k = m(() => o.trigger ? {
78
+ left: d(w.value),
79
+ top: o.placement === "top" ? d(r.value) : d(r.value + C.value),
80
+ width: d(_.value)
83
81
  } : {});
84
- let f;
85
- N(
86
- () => C.value,
87
- (r) => {
88
- const c = r ? t.delayOpen : t.delayClose;
89
- f && (clearTimeout(f), f = void 0, r || (o.value = !1)), c ? f = setTimeout(() => o.value = r || !1, c) : o.value = r || !1;
82
+ let h;
83
+ B(
84
+ () => t.value,
85
+ (i) => {
86
+ const u = i ? o.delayOpen : o.delayClose;
87
+ h && (clearTimeout(h), h = void 0, i || (f.value = !1)), u ? h = setTimeout(() => f.value = i || !1, u) : f.value = i || !1;
90
88
  }
91
- ), N(
92
- () => t.disabled,
93
- (r) => {
94
- r && (f && clearTimeout(f), o.value = !1);
89
+ ), B(
90
+ () => o.disabled,
91
+ (i) => {
92
+ i && (h && clearTimeout(h), f.value = !1);
95
93
  }
96
94
  );
97
- const y = (r) => {
98
- var c;
99
- (c = k.value) != null && c.contains(r.relatedTarget) || (C.value = !1);
95
+ const b = (i) => {
96
+ var u;
97
+ (u = L.value) != null && u.contains(i.relatedTarget) || (t.value = !1);
100
98
  };
101
- return (r, c) => (n(), L(c0, { name: "tr-tooltip" }, {
102
- default: x(() => [
103
- o.value ? (n(), m("div", {
99
+ return (i, u) => (s(), F(j, { name: "tr-tooltip" }, {
100
+ default: R(() => [
101
+ f.value ? (s(), p("div", {
104
102
  key: 0,
105
- class: V(["tr-tooltip", `placement-${t.placement}`]),
103
+ class: N(["tr-tooltip", `placement-${o.placement}`]),
106
104
  role: "tooltip",
107
- style: A(Z.value),
108
- onMouseleave: y
105
+ style: H(k.value),
106
+ onMouseleave: b
109
107
  }, [
110
- c[0] || (c[0] = v("div", { class: "tr-tooltip-arrow" }, null, -1)),
111
- v("span", U0, S(t.content), 1)
112
- ], 38)) : W("", !0)
108
+ u[0] || (u[0] = g("div", { class: "tr-tooltip-arrow" }, null, -1)),
109
+ g("span", W0, Z(o.content), 1)
110
+ ], 38)) : z("", !0)
113
111
  ]),
114
112
  _: 1
115
113
  }));
116
114
  }
117
- }), Q0 = /* @__PURE__ */ w(H0, [["__scopeId", "data-v-72e44084"]]), j0 = ["onClick", "onMouseenter", "onMouseleave"], A0 = /* @__PURE__ */ z({
115
+ }), N0 = /* @__PURE__ */ q(H0, [["__scopeId", "data-v-2d58fbb9"]]), V0 = {
116
+ key: 0,
117
+ class: "tr-question-popover__backdrop"
118
+ }, E0 = ["onClick", "onMouseenter", "onMouseleave"], D0 = /* @__PURE__ */ V({
118
119
  __name: "index",
119
- props: /* @__PURE__ */ E({
120
- appendTo: {},
120
+ props: /* @__PURE__ */ W({
121
121
  data: {},
122
- title: {
123
- default: "热门问题"
124
- },
122
+ title: { default: "热门问题" },
125
123
  icon: {},
126
- show: {
127
- type: Boolean
128
- },
129
- trigger: {
130
- default: "click"
131
- },
124
+ show: { type: Boolean },
125
+ trigger: { default: "click" },
132
126
  selectedGroup: {},
133
- groupShowMoreTrigger: {
134
- default: "hover"
135
- },
136
- loading: {
137
- type: Boolean
138
- },
139
- topOffset: {
140
- default: 8
141
- }
127
+ groupShowMoreTrigger: { default: "hover" },
128
+ loading: { type: Boolean },
129
+ popoverWidth: { default: 540 },
130
+ popoverHeight: { default: 464 },
131
+ topOffset: { default: 0 }
142
132
  }, {
143
133
  selectedGroup: {},
144
134
  selectedGroupModifiers: {}
145
135
  }),
146
- emits: /* @__PURE__ */ E(["item-click", "group-click", "open", "close", "click-outside"], ["update:selectedGroup"]),
147
- setup(s, {
148
- expose: t,
149
- emit: C
150
- }) {
151
- const o = s, k = i(!1), u = p({
152
- get: () => o.trigger === "manual" ? o.show : k.value,
136
+ emits: /* @__PURE__ */ W(["item-click", "group-click", "open", "close"], ["update:selectedGroup"]),
137
+ setup(n, { emit: o }) {
138
+ f0((e) => ({
139
+ "193dab18": a(d)(t.popoverHeight),
140
+ 67584702: a(y) ? "0" : "24px",
141
+ "3f4a7a6b": a(y) ? "unset" : "0",
142
+ "9f472bc2": a(y) ? "translateY(100%)" : "unset",
143
+ "3f4a7a8a": a(y) ? "unset" : "1",
144
+ "1f51979f": a(y) ? "translateY(0)" : "unset"
145
+ }));
146
+ const t = n, f = v0(), L = m(() => f.style), w = c(!1), r = m({
147
+ get: () => t.trigger === "manual" ? t.show : w.value,
153
148
  set: (e) => {
154
- o.trigger !== "manual" && (k.value = e);
149
+ t.trigger !== "manual" && (w.value = e);
155
150
  }
156
- }), d = C, _ = j(s, "selectedGroup"), M = p(() => {
151
+ }), _ = o, C = Q(n, "selectedGroup"), k = m(() => {
157
152
  var e;
158
- return typeof ((e = o.data.at(0)) == null ? void 0 : e.group) == "string";
153
+ return typeof ((e = t.data.at(0)) == null ? void 0 : e.group) == "string";
159
154
  });
160
- !_.value && M.value && o.data.length && (_.value = o.data[0].group);
161
- const Z = p(() => {
155
+ !C.value && k.value && t.data.length && (C.value = t.data[0].group);
156
+ const h = m(() => {
162
157
  var e;
163
- return M.value ? ((e = o.data.find((l) => l.group === _.value)) == null ? void 0 : e.items) || [] : o.data;
164
- }), f = p(() => M.value ? o.data.map((e) => ({
158
+ return k.value ? ((e = t.data.find((l) => l.group === C.value)) == null ? void 0 : e.items) || [] : t.data;
159
+ }), b = m(() => k.value ? t.data.map((e) => ({
165
160
  ...e,
166
161
  id: e.group
167
- })) : []), y = i(null), r = p(() => {
168
- var e;
169
- return (e = y.value) == null ? void 0 : e.triggerRef;
170
- }), c = p(() => {
171
- var e;
172
- return (e = y.value) == null ? void 0 : e.popperRef;
173
- }), q = _0("(max-width: 767px)"), D = i(null), G = i(!1), {
174
- isScrolling: J
175
- } = h0(D);
176
- C0(J, (e) => {
177
- G.value = e;
178
- }, {
179
- throttle: 100,
180
- leading: !0,
181
- trailing: !0
182
- });
183
- const B = i([]), K = p(() => B.value.at(0)), X = (e, l) => {
184
- B.value[l] = e;
185
- }, O = i([]), Y = () => {
186
- O.value = B.value.map((e) => e ? e.scrollWidth > e.clientWidth : !1);
187
- }, U = i(null), H = i(null), I = i(!1), Q = i(""), {
188
- width: e0
189
- } = y0(K);
190
- N(e0, () => {
191
- Y();
162
+ })) : []), i = c(null), u = c(null), { x: K, y: X, update: e0 } = J(i), y = _0("(max-width: 767px)"), E = c(null), { isScrolling: D } = h0(E, { throttle: 100 }), I = c([]), t0 = m(() => I.value.at(0)), o0 = (e, l) => {
163
+ I.value[l] = e;
164
+ }, O = c([]), l0 = () => {
165
+ O.value = I.value.map((e) => e ? e.scrollWidth > e.clientWidth : !1);
166
+ }, U = c(null), Y = c(null), S = c(!1), A = c(""), { width: s0 } = C0(t0);
167
+ B(s0, () => {
168
+ l0();
192
169
  });
193
- const t0 = p(() => q.value ? {
170
+ const a0 = m(() => y.value ? {
194
171
  left: 0,
195
172
  right: 0,
196
- bottom: 0,
197
- top: "unset",
198
- minWidth: "100%"
199
- } : {}), o0 = w0(r, o.appendTo);
200
- k0(() => ({
201
- to: o0.value
202
- }), () => $(B0, {
203
- show: u.value && q.value
204
- }, null));
205
- const P = () => {
206
- o.trigger === "click" && (u.value ? d("open") : d("close"));
207
- };
208
- L0(c, (e) => {
209
- d("click-outside", e), u.value = !1, P();
210
- }, {
211
- ignore: [r]
173
+ bottom: 0
174
+ } : {
175
+ left: `min(${d(K.value)}, 100% - ${d(t.popoverWidth)})`,
176
+ top: `max(${d(X.value)} - ${d(t.popoverHeight)} + ${d(t.topOffset)} - 8px, 0px)`,
177
+ width: d(t.popoverWidth)
178
+ });
179
+ t.trigger === "click" && y0(u, (e) => {
180
+ var l;
181
+ (l = i.value) != null && l.contains(e.target) && e.stopPropagation(), r.value = !1, _("close");
182
+ }), B(r, (e) => {
183
+ e && e0();
212
184
  });
213
- const l0 = () => {
214
- u.value = !u.value, P();
215
- }, s0 = () => {
216
- u.value = !1, d("close");
217
- }, n0 = (e) => {
218
- d("item-click", e), u.value = !1, P();
219
- }, r0 = (e) => {
220
- const l = o.data.find((a) => a.group === e);
221
- l && d("group-click", l);
222
- }, a0 = (e, l) => {
223
- H.value = B.value[l], I.value = !0, Q.value = e.text;
185
+ const n0 = () => {
186
+ r.value = !r.value, r.value && _("open");
187
+ }, r0 = () => {
188
+ r.value = !1, _("close");
224
189
  }, i0 = (e) => {
190
+ _("item-click", e), r.value = !1, t.trigger === "click" && _("close");
191
+ }, u0 = (e) => {
192
+ const l = t.data.find((v) => v.group === e);
193
+ l && _("group-click", l);
194
+ }, c0 = (e, l) => {
195
+ Y.value = I.value[l], S.value = !0, A.value = e.text;
196
+ }, d0 = (e) => {
225
197
  var l;
226
- ((l = U.value) == null ? void 0 : l.$el).contains(e.relatedTarget) || (I.value = !1);
198
+ ((l = U.value) == null ? void 0 : l.$el).contains(e.relatedTarget) || (S.value = !1);
227
199
  };
228
- return t({
229
- update: () => {
230
- var e;
231
- (e = y.value) == null || e.update();
232
- }
233
- }), (e, l) => (n(), L(h(M0), {
234
- show: u.value,
235
- class: V(["tr-question-popover", {
236
- mobile: h(q)
237
- }]),
238
- style: A(t0.value),
239
- ref_key: "basePopperRef",
240
- ref: y,
241
- placement: "top-left",
242
- "append-to": o.appendTo,
243
- offset: o.topOffset,
244
- "transition-props": {
245
- name: h(q) ? "tr-question-popover-mobile" : "tr-question-popover"
246
- },
247
- "prevent-overflow": !0,
248
- "trigger-events": {
249
- onClick: l0
250
- }
251
- }, {
252
- trigger: x(() => [g(e.$slots, "trigger", {}, void 0, !0)]),
253
- content: x(() => [g(e.$slots, "header", {}, () => [$(z0, {
254
- icon: o.icon,
255
- title: o.title
256
- }, null, 8, ["icon", "title"])], !0), o.loading ? (n(), L(P0, {
257
- key: 0
258
- }, {
259
- default: x(() => [g(e.$slots, "loading", {}, void 0, !0)]),
260
- _: 3
261
- })) : o.data.length === 0 ? (n(), L(D0, {
262
- key: 1
263
- }, {
264
- default: x(() => [g(e.$slots, "empty", {}, void 0, !0)]),
200
+ return (e, l) => (s(), p(P, null, [
201
+ g("div", {
202
+ class: N(["tr-question-popover__wrapper", a(f).class]),
203
+ style: H(L.value),
204
+ ref_key: "popoverTriggerRef",
205
+ ref: i,
206
+ onClick: n0
207
+ }, [
208
+ T(e.$slots, "default", {}, void 0, !0)
209
+ ], 6),
210
+ r.value && a(y) ? (s(), p("div", V0)) : z("", !0),
211
+ $(j, { name: "tr-question-popover" }, {
212
+ default: R(() => [
213
+ r.value ? (s(), p("div", {
214
+ key: 0,
215
+ class: "tr-question-popover",
216
+ style: H(a0.value),
217
+ ref_key: "popoverRef",
218
+ ref: u
219
+ }, [
220
+ $(b0, {
221
+ icon: t.icon,
222
+ title: t.title,
223
+ onClose: r0
224
+ }, null, 8, ["icon", "title"]),
225
+ t.loading ? (s(), F(z0, { key: 0 }, {
226
+ default: R(() => [
227
+ T(e.$slots, "loading", {}, void 0, !0)
228
+ ]),
229
+ _: 3
230
+ })) : t.data.length === 0 ? (s(), F(P0, { key: 1 }, {
231
+ default: R(() => [
232
+ T(e.$slots, "empty", {}, void 0, !0)
233
+ ]),
234
+ _: 3
235
+ })) : (s(), p(P, { key: 2 }, [
236
+ b.value.length > 0 ? (s(), F(a(L0), {
237
+ key: 0,
238
+ class: "tr-question__group",
239
+ items: b.value,
240
+ selected: C.value,
241
+ "onUpdate:selected": l[0] || (l[0] = (v) => C.value = v),
242
+ "lines-limit": 2,
243
+ "show-more-trigger": t.groupShowMoreTrigger,
244
+ onItemClick: u0
245
+ }, null, 8, ["items", "selected", "show-more-trigger"])) : z("", !0),
246
+ g("ul", {
247
+ class: N(["tr-question__list", { scrolling: a(D) }]),
248
+ ref_key: "listRef",
249
+ ref: E
250
+ }, [
251
+ (s(!0), p(P, null, g0(h.value, (v, M) => (s(), p("li", {
252
+ class: "tr-question__list-item",
253
+ key: v.id,
254
+ ref_for: !0,
255
+ ref: (x) => o0(x, M),
256
+ onClick: (x) => i0(v),
257
+ onMouseenter: (x) => O.value[M] && c0(v, M),
258
+ onMouseleave: (x) => O.value[M] && d0(x)
259
+ }, [
260
+ g("span", null, Z(M + 1) + ". ", 1),
261
+ m0(Z(v.text), 1)
262
+ ], 40, E0))), 128))
263
+ ], 2)
264
+ ], 64)),
265
+ $(N0, {
266
+ ref_key: "tooltipRef",
267
+ ref: U,
268
+ show: S.value,
269
+ "onUpdate:show": l[1] || (l[1] = (v) => S.value = v),
270
+ content: A.value,
271
+ trigger: Y.value,
272
+ disabled: a(D),
273
+ placement: "top",
274
+ "delay-open": 300,
275
+ "delay-close": 300
276
+ }, null, 8, ["show", "content", "trigger", "disabled"])
277
+ ], 4)) : z("", !0)
278
+ ]),
265
279
  _: 3
266
- })) : g(e.$slots, "body", {
267
- key: 2
268
- }, () => [f.value.length > 0 ? (n(), L(h(F0), {
269
- key: 0,
270
- class: "tr-question__group",
271
- items: f.value,
272
- selected: _.value,
273
- "onUpdate:selected": l[0] || (l[0] = (a) => _.value = a),
274
- "lines-limit": 2,
275
- "show-more-trigger": o.groupShowMoreTrigger,
276
- onItemClick: r0
277
- }, null, 8, ["items", "selected", "show-more-trigger"])) : W("", !0), v("ul", {
278
- class: V(["tr-question__list", {
279
- scrolling: G.value
280
- }]),
281
- ref_key: "listRef",
282
- ref: D
283
- }, [(n(!0), m(p0, null, d0(Z.value, (a, F) => (n(), m("li", {
284
- class: "tr-question__list-item",
285
- key: a.id,
286
- ref_for: !0,
287
- ref: (T) => X(T, F),
288
- onClick: (T) => n0(a),
289
- onMouseenter: (T) => O.value[F] && a0(a, F),
290
- onMouseleave: (T) => O.value[F] && i0(T)
291
- }, [g(e.$slots, "item", {
292
- item: a
293
- }, () => [v("span", null, S(F + 1) + ". ", 1), f0(S(a.text), 1)], !0)], 40, j0))), 128))], 2)], !0), $(Q0, {
294
- ref_key: "tooltipRef",
295
- ref: U,
296
- show: I.value,
297
- "onUpdate:show": l[1] || (l[1] = (a) => I.value = a),
298
- content: Q.value,
299
- trigger: H.value,
300
- disabled: G.value,
301
- placement: "top",
302
- "delay-open": 300,
303
- "delay-close": 300
304
- }, null, 8, ["show", "content", "trigger", "disabled"]), $(h(T0), {
305
- class: "tr-question-popover__close",
306
- icon: h(g0),
307
- size: "32",
308
- "svg-size": "20",
309
- onClick: s0
310
- }, null, 8, ["icon"])]),
311
- _: 3
312
- }, 8, ["show", "class", "style", "append-to", "offset", "transition-props", "trigger-events"]));
280
+ })
281
+ ], 64));
313
282
  }
314
- }), b = /* @__PURE__ */ w(A0, [["__scopeId", "data-v-8cc35579"]]);
315
- b.name = "TrSuggestionPopover";
316
- const J0 = function(s) {
317
- s.component(b.name, b);
283
+ }), G = /* @__PURE__ */ q(D0, [["__scopeId", "data-v-9f06d657"]]);
284
+ G.name = "TrSuggestionPopover";
285
+ const U0 = function(n) {
286
+ n.component(G.name, G);
318
287
  };
319
- b.install = J0;
288
+ G.install = U0;
320
289
  export {
321
- b as default
290
+ G as default
322
291
  };