@opentiny/tiny-robot 0.2.8 → 0.2.10
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.
- package/dist/dropdown-menu/index.js +48 -41
- package/dist/index.d.ts +23 -3
- package/dist/sender/index.js +386 -380
- package/dist/style.css +1 -1
- package/dist/suggestion-pills/index.js +20 -20
- package/dist/suggestion-popover/index.js +51 -51
- package/package.json +3 -3
|
@@ -1,59 +1,66 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { c as
|
|
1
|
+
import { defineComponent as E, useCssVars as N, unref as w, useAttrs as O, computed as m, ref as p, watch as W, createElementBlock as r, openBlock as s, Fragment as h, createElementVNode as v, createVNode as z, normalizeStyle as k, normalizeClass as I, renderSlot as P, Transition as A, withCtx as F, createCommentVNode as H, renderList as L, toDisplayString as U } from "vue";
|
|
2
|
+
import { c as y, o as b } from "../index2.js";
|
|
3
3
|
import { t as n } from "../utils.js";
|
|
4
|
-
import { _ as
|
|
5
|
-
const
|
|
4
|
+
import { _ as j } from "../_plugin-vue_export-helper.js";
|
|
5
|
+
const q = { class: "tr-dropdown-menu__list" }, G = ["onClick"], J = /* @__PURE__ */ E({
|
|
6
6
|
__name: "index",
|
|
7
7
|
props: {
|
|
8
8
|
items: {},
|
|
9
|
+
show: { type: Boolean },
|
|
10
|
+
trigger: { default: "click" },
|
|
9
11
|
minWidth: { default: 160 },
|
|
10
12
|
topOffset: { default: 0 }
|
|
11
13
|
},
|
|
12
|
-
emits: ["item-click"],
|
|
13
|
-
setup(
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
emits: ["item-click", "click-outside"],
|
|
15
|
+
setup(a, { emit: x }) {
|
|
16
|
+
N((e) => ({
|
|
17
|
+
"1cd1e3f9": w(n)(t.minWidth)
|
|
16
18
|
}));
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const t = a, f = O(), C = m(() => f.style), _ = p(!1), o = m({
|
|
20
|
+
get: () => t.trigger === "manual" ? t.show : _.value,
|
|
21
|
+
set: (e) => {
|
|
22
|
+
t.trigger !== "manual" && (_.value = e);
|
|
23
|
+
}
|
|
24
|
+
}), g = x, i = p(null), u = p(null), { x: $, y: S, update: D } = y(i), { width: R, height: T } = y(u), B = m(() => ({
|
|
25
|
+
left: `min(${n($.value)}, 100% - ${n(R.value)})`,
|
|
26
|
+
top: `max(${n(S.value)} - ${n(T.value)} + ${n(t.topOffset)} - 8px, 0px)`
|
|
20
27
|
}));
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
(
|
|
24
|
-
}),
|
|
25
|
-
e &&
|
|
28
|
+
b(u, (e) => {
|
|
29
|
+
var c;
|
|
30
|
+
g("click-outside", e), t.trigger === "click" && ((c = i.value) != null && c.contains(e.target) && e.stopPropagation(), o.value = !1);
|
|
31
|
+
}), W(o, (e) => {
|
|
32
|
+
e && D();
|
|
26
33
|
});
|
|
27
|
-
const
|
|
28
|
-
|
|
34
|
+
const M = () => {
|
|
35
|
+
o.value = !o.value;
|
|
29
36
|
}, V = (e) => {
|
|
30
|
-
|
|
37
|
+
o.value = !1, g("item-click", e);
|
|
31
38
|
};
|
|
32
|
-
return (e,
|
|
33
|
-
|
|
34
|
-
class:
|
|
35
|
-
style:
|
|
39
|
+
return (e, c) => (s(), r(h, null, [
|
|
40
|
+
v("div", {
|
|
41
|
+
class: I(["tr-dropdown-menu__wrapper", w(f).class]),
|
|
42
|
+
style: k(C.value),
|
|
36
43
|
ref_key: "dropDownTriggerRef",
|
|
37
44
|
ref: i,
|
|
38
|
-
|
|
45
|
+
onPointerup: M
|
|
39
46
|
}, [
|
|
40
|
-
|
|
41
|
-
],
|
|
42
|
-
|
|
47
|
+
P(e.$slots, "default", {}, void 0, !0)
|
|
48
|
+
], 38),
|
|
49
|
+
z(A, { name: "tr-dropdown-menu" }, {
|
|
43
50
|
default: F(() => [
|
|
44
|
-
|
|
51
|
+
o.value ? (s(), r("div", {
|
|
45
52
|
key: 0,
|
|
46
53
|
class: "tr-dropdown-menu",
|
|
47
|
-
style:
|
|
54
|
+
style: k(B.value),
|
|
48
55
|
ref_key: "dropdownMenuRef",
|
|
49
|
-
ref:
|
|
56
|
+
ref: u
|
|
50
57
|
}, [
|
|
51
|
-
|
|
52
|
-
(s(!0),
|
|
58
|
+
v("ul", q, [
|
|
59
|
+
(s(!0), r(h, null, L(t.items, (d) => (s(), r("li", {
|
|
53
60
|
class: "tr-dropdown-menu__list-item",
|
|
54
|
-
key:
|
|
55
|
-
onClick: (
|
|
56
|
-
},
|
|
61
|
+
key: d.id,
|
|
62
|
+
onClick: (Q) => V(d)
|
|
63
|
+
}, U(d.text), 9, G))), 128))
|
|
57
64
|
])
|
|
58
65
|
], 4)) : H("", !0)
|
|
59
66
|
]),
|
|
@@ -61,12 +68,12 @@ const j = { class: "tr-dropdown-menu__list" }, q = ["onClick"], G = /* @__PURE__
|
|
|
61
68
|
})
|
|
62
69
|
], 64));
|
|
63
70
|
}
|
|
64
|
-
}),
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
|
|
71
|
+
}), l = /* @__PURE__ */ j(J, [["__scopeId", "data-v-8add3dc5"]]);
|
|
72
|
+
l.name = "TrDropdownMenu";
|
|
73
|
+
const K = function(a) {
|
|
74
|
+
a.component(l.name, l);
|
|
68
75
|
};
|
|
69
|
-
|
|
76
|
+
l.install = K;
|
|
70
77
|
export {
|
|
71
|
-
|
|
78
|
+
l as default
|
|
72
79
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -73,17 +73,19 @@ declare const __VLS_component_11: DefineComponent<__VLS_PublicProps_3, {}, {}, {
|
|
|
73
73
|
close: () => any;
|
|
74
74
|
open: () => any;
|
|
75
75
|
"item-click": (item: SuggestionItem_2<Record<string, unknown>>) => any;
|
|
76
|
+
"click-outside": (event: MouseEvent) => any;
|
|
76
77
|
"group-click": (group: SuggestionGroup<Record<string, unknown>>) => any;
|
|
77
78
|
}, string, PublicProps, Readonly<__VLS_PublicProps_3> & Readonly<{
|
|
78
79
|
onClose?: (() => any) | undefined;
|
|
79
80
|
onOpen?: (() => any) | undefined;
|
|
80
81
|
"onItem-click"?: ((item: SuggestionItem_2<Record<string, unknown>>) => any) | undefined;
|
|
82
|
+
"onClick-outside"?: ((event: MouseEvent) => any) | undefined;
|
|
81
83
|
"onGroup-click"?: ((group: SuggestionGroup<Record<string, unknown>>) => any) | undefined;
|
|
82
84
|
"onUpdate:selectedGroup"?: ((value: string) => any) | undefined;
|
|
83
85
|
}>, {
|
|
84
86
|
title: string;
|
|
85
|
-
topOffset: string | number;
|
|
86
87
|
trigger: "click" | "manual";
|
|
88
|
+
topOffset: string | number;
|
|
87
89
|
groupShowMoreTrigger: "click" | "hover";
|
|
88
90
|
popoverWidth: string | number;
|
|
89
91
|
popoverHeight: string | number;
|
|
@@ -121,9 +123,12 @@ declare const __VLS_component_2: DefineComponent<__VLS_PublicProps, {}, {}, {},
|
|
|
121
123
|
|
|
122
124
|
declare const __VLS_component_3: DefineComponent<DropdownMenuProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
123
125
|
"item-click": (item: DropdownMenuItem) => any;
|
|
126
|
+
"click-outside": (event: MouseEvent) => any;
|
|
124
127
|
}, string, PublicProps, Readonly<DropdownMenuProps> & Readonly<{
|
|
125
128
|
"onItem-click"?: ((item: DropdownMenuItem) => any) | undefined;
|
|
129
|
+
"onClick-outside"?: ((event: MouseEvent) => any) | undefined;
|
|
126
130
|
}>, {
|
|
131
|
+
trigger: "click" | "manual";
|
|
127
132
|
minWidth: string | number;
|
|
128
133
|
topOffset: string | number;
|
|
129
134
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {
|
|
@@ -167,6 +172,7 @@ hasContent: boolean;
|
|
|
167
172
|
allowSpeech: boolean;
|
|
168
173
|
allowFiles: boolean;
|
|
169
174
|
submitType: SubmitTrigger_2;
|
|
175
|
+
stopText: string;
|
|
170
176
|
autoSize: AutoSize_2;
|
|
171
177
|
maxLength: number;
|
|
172
178
|
suggestions: string[];
|
|
@@ -692,18 +698,18 @@ toggleExpand: () => void;
|
|
|
692
698
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
693
699
|
close: () => any;
|
|
694
700
|
select: (value: string, context?: TriggerContext | undefined) => any;
|
|
701
|
+
trigger: (handler: TriggerHandler) => any;
|
|
695
702
|
"suggestion-select": (item: SuggestionItem) => any;
|
|
696
703
|
"update:open": (value: boolean) => any;
|
|
697
|
-
trigger: (handler: TriggerHandler) => any;
|
|
698
704
|
"category-select": (category: Category) => any;
|
|
699
705
|
"update:expanded": (expanded: boolean) => any;
|
|
700
706
|
"fill-template": (template: string) => any;
|
|
701
707
|
}, string, PublicProps, Readonly<SuggestionProps> & Readonly<{
|
|
702
708
|
onClose?: (() => any) | undefined;
|
|
703
709
|
onSelect?: ((value: string, context?: TriggerContext | undefined) => any) | undefined;
|
|
710
|
+
onTrigger?: ((handler: TriggerHandler) => any) | undefined;
|
|
704
711
|
"onSuggestion-select"?: ((item: SuggestionItem) => any) | undefined;
|
|
705
712
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
706
|
-
onTrigger?: ((handler: TriggerHandler) => any) | undefined;
|
|
707
713
|
"onCategory-select"?: ((category: Category) => any) | undefined;
|
|
708
714
|
"onUpdate:expanded"?: ((expanded: boolean) => any) | undefined;
|
|
709
715
|
"onFill-template"?: ((template: string) => any) | undefined;
|
|
@@ -1779,6 +1785,7 @@ export declare interface ActionButtonsProps {
|
|
|
1779
1785
|
submitType?: SubmitTrigger;
|
|
1780
1786
|
showShortcuts?: boolean;
|
|
1781
1787
|
isOverLimit?: boolean;
|
|
1788
|
+
stopText?: string;
|
|
1782
1789
|
}
|
|
1783
1790
|
|
|
1784
1791
|
export declare type AutoSize = boolean | {
|
|
@@ -2031,10 +2038,12 @@ export { _default_9 as Welcome }
|
|
|
2031
2038
|
|
|
2032
2039
|
export declare interface DropdownMenuEmits {
|
|
2033
2040
|
(e: 'item-click', item: DropdownMenuItem): void;
|
|
2041
|
+
(e: 'click-outside', event: MouseEvent): void;
|
|
2034
2042
|
}
|
|
2035
2043
|
|
|
2036
2044
|
export declare interface DropdownMenuEvents {
|
|
2037
2045
|
itemClick?: (item: DropdownMenuItem) => void;
|
|
2046
|
+
clickOutside?: (event: MouseEvent) => void;
|
|
2038
2047
|
}
|
|
2039
2048
|
|
|
2040
2049
|
export declare interface DropdownMenuItem {
|
|
@@ -2044,6 +2053,14 @@ export declare interface DropdownMenuItem {
|
|
|
2044
2053
|
|
|
2045
2054
|
export declare interface DropdownMenuProps {
|
|
2046
2055
|
items: DropdownMenuItem[];
|
|
2056
|
+
/**
|
|
2057
|
+
* 是否显示菜单,仅在 trigger 为 'manual' 时有效
|
|
2058
|
+
*/
|
|
2059
|
+
show?: boolean;
|
|
2060
|
+
/**
|
|
2061
|
+
* 触发方式。默认值为 'click'
|
|
2062
|
+
*/
|
|
2063
|
+
trigger?: 'click' | 'manual';
|
|
2047
2064
|
minWidth?: string | number;
|
|
2048
2065
|
topOffset?: string | number;
|
|
2049
2066
|
}
|
|
@@ -2318,6 +2335,7 @@ export declare interface SenderProps {
|
|
|
2318
2335
|
template?: string;
|
|
2319
2336
|
hasContent?: boolean;
|
|
2320
2337
|
templateInitialValues?: Record<string, string>;
|
|
2338
|
+
stopText?: string;
|
|
2321
2339
|
}
|
|
2322
2340
|
|
|
2323
2341
|
/**
|
|
@@ -2491,7 +2509,9 @@ export declare interface SuggestionPillsSlots {
|
|
|
2491
2509
|
declare interface SuggestionPopoverEvents {
|
|
2492
2510
|
itemClick?: (item: SuggestionItem_2) => void;
|
|
2493
2511
|
groupClick?: (group: SuggestionGroup) => void;
|
|
2512
|
+
open?: () => void;
|
|
2494
2513
|
close?: () => void;
|
|
2514
|
+
clickOutside?: (event: MouseEvent) => void;
|
|
2495
2515
|
}
|
|
2496
2516
|
|
|
2497
2517
|
declare interface SuggestionPopoverProps<T = Record<string, unknown>> {
|