@opentiny/tiny-robot 0.2.8 → 0.2.9
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 +20 -3
- 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, {
|
|
@@ -692,18 +697,18 @@ toggleExpand: () => void;
|
|
|
692
697
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {} & {
|
|
693
698
|
close: () => any;
|
|
694
699
|
select: (value: string, context?: TriggerContext | undefined) => any;
|
|
700
|
+
trigger: (handler: TriggerHandler) => any;
|
|
695
701
|
"suggestion-select": (item: SuggestionItem) => any;
|
|
696
702
|
"update:open": (value: boolean) => any;
|
|
697
|
-
trigger: (handler: TriggerHandler) => any;
|
|
698
703
|
"category-select": (category: Category) => any;
|
|
699
704
|
"update:expanded": (expanded: boolean) => any;
|
|
700
705
|
"fill-template": (template: string) => any;
|
|
701
706
|
}, string, PublicProps, Readonly<SuggestionProps> & Readonly<{
|
|
702
707
|
onClose?: (() => any) | undefined;
|
|
703
708
|
onSelect?: ((value: string, context?: TriggerContext | undefined) => any) | undefined;
|
|
709
|
+
onTrigger?: ((handler: TriggerHandler) => any) | undefined;
|
|
704
710
|
"onSuggestion-select"?: ((item: SuggestionItem) => any) | undefined;
|
|
705
711
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
706
|
-
onTrigger?: ((handler: TriggerHandler) => any) | undefined;
|
|
707
712
|
"onCategory-select"?: ((category: Category) => any) | undefined;
|
|
708
713
|
"onUpdate:expanded"?: ((expanded: boolean) => any) | undefined;
|
|
709
714
|
"onFill-template"?: ((template: string) => any) | undefined;
|
|
@@ -2031,10 +2036,12 @@ export { _default_9 as Welcome }
|
|
|
2031
2036
|
|
|
2032
2037
|
export declare interface DropdownMenuEmits {
|
|
2033
2038
|
(e: 'item-click', item: DropdownMenuItem): void;
|
|
2039
|
+
(e: 'click-outside', event: MouseEvent): void;
|
|
2034
2040
|
}
|
|
2035
2041
|
|
|
2036
2042
|
export declare interface DropdownMenuEvents {
|
|
2037
2043
|
itemClick?: (item: DropdownMenuItem) => void;
|
|
2044
|
+
clickOutside?: (event: MouseEvent) => void;
|
|
2038
2045
|
}
|
|
2039
2046
|
|
|
2040
2047
|
export declare interface DropdownMenuItem {
|
|
@@ -2044,6 +2051,14 @@ export declare interface DropdownMenuItem {
|
|
|
2044
2051
|
|
|
2045
2052
|
export declare interface DropdownMenuProps {
|
|
2046
2053
|
items: DropdownMenuItem[];
|
|
2054
|
+
/**
|
|
2055
|
+
* 是否显示菜单,仅在 trigger 为 'manual' 时有效
|
|
2056
|
+
*/
|
|
2057
|
+
show?: boolean;
|
|
2058
|
+
/**
|
|
2059
|
+
* 触发方式。默认值为 'click'
|
|
2060
|
+
*/
|
|
2061
|
+
trigger?: 'click' | 'manual';
|
|
2047
2062
|
minWidth?: string | number;
|
|
2048
2063
|
topOffset?: string | number;
|
|
2049
2064
|
}
|
|
@@ -2491,7 +2506,9 @@ export declare interface SuggestionPillsSlots {
|
|
|
2491
2506
|
declare interface SuggestionPopoverEvents {
|
|
2492
2507
|
itemClick?: (item: SuggestionItem_2) => void;
|
|
2493
2508
|
groupClick?: (group: SuggestionGroup) => void;
|
|
2509
|
+
open?: () => void;
|
|
2494
2510
|
close?: () => void;
|
|
2511
|
+
clickOutside?: (event: MouseEvent) => void;
|
|
2495
2512
|
}
|
|
2496
2513
|
|
|
2497
2514
|
declare interface SuggestionPopoverProps<T = Record<string, unknown>> {
|