litos-ui 0.17.5 → 0.18.1
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/lib/animation-CTt9qgA7.js +4 -0
- package/lib/base-Dm0WS1pK.js +62 -0
- package/lib/base.js +111 -147
- package/lib/button/index.d.ts +8 -3
- package/lib/button/index.js +2 -137
- package/lib/button-CC5PmAb1.js +146 -0
- package/lib/calendar/index.d.ts +10 -5
- package/lib/calendar/index.js +2 -123
- package/lib/calendar-GpYHNmXG.js +149 -0
- package/lib/carousel/index.js +2 -280
- package/lib/carousel/item.js +2 -15
- package/lib/carousel-dT3FJPQo.js +272 -0
- package/lib/check/checkbox.js +2 -18
- package/lib/check/checkbox_group.js +6 -6
- package/lib/check/radio.js +2 -15
- package/lib/check/radio_group.js +9 -9
- package/lib/check-B0XraJvb.js +73 -0
- package/lib/check-CvGaONEx.js +117 -0
- package/lib/checkbox-DbWsmAaL.js +16 -0
- package/lib/collapse/index.d.ts +18 -11
- package/lib/collapse/index.js +2 -88
- package/lib/collapse/item.d.ts +28 -9
- package/lib/collapse/item.js +2 -115
- package/lib/collapse/types.d.ts +7 -0
- package/lib/collapse-C3IRHLeg.js +104 -0
- package/lib/color_picker/index.js +2 -42
- package/lib/color_picker-D0brKFm-.js +41 -0
- package/lib/date_picker/index.d.ts +23 -0
- package/lib/date_picker/index.js +3 -0
- package/lib/date_picker-DQGoiN8v.js +103 -0
- package/lib/date_picker_ori/index.js +2 -129
- package/lib/date_picker_ori-aRuSSi9D.js +122 -0
- package/lib/description_panel/index.js +2 -66
- package/lib/description_panel-BY2yljeC.js +57 -0
- package/lib/dialog/dialog_container.js +2 -131
- package/lib/dialog/index.js +67 -85
- package/lib/dialog_container-DcN87wj0.js +126 -0
- package/lib/esm-sVEoAVPu.js +244 -0
- package/lib/form/form_item.d.ts +1 -0
- package/lib/form/form_item.js +2 -136
- package/lib/form/index.js +2 -147
- package/lib/form-DdU0yK0k.js +154 -0
- package/lib/form_inner-DR9tyB_r.js +117 -0
- package/lib/form_item-Bv-YafZK.js +137 -0
- package/lib/icon/arrow_down.js +12 -12
- package/lib/icon/arrow_left.js +9 -9
- package/lib/icon/arrow_right.js +9 -9
- package/lib/icon/arrow_up.js +12 -12
- package/lib/icon/base.d.ts +16 -2
- package/lib/icon/base.js +2 -38
- package/lib/icon/calendar.d.ts +5 -0
- package/lib/icon/calendar.js +10 -0
- package/lib/icon/caret_bottom.js +9 -9
- package/lib/icon/caret_top.js +9 -9
- package/lib/icon/close.js +9 -9
- package/lib/icon/close_filled.js +12 -12
- package/lib/icon/d_arrow_left.js +12 -12
- package/lib/icon/d_arrow_right.js +12 -12
- package/lib/icon/font_icon.d.ts +2 -3
- package/lib/icon/font_icon.js +35 -39
- package/lib/icon/info.js +12 -12
- package/lib/icon/loading.js +9 -9
- package/lib/icon/moon.js +12 -12
- package/lib/icon/more.js +12 -12
- package/lib/icon/reduction.js +12 -12
- package/lib/icon/refresh.d.ts +5 -0
- package/lib/icon/refresh.js +10 -0
- package/lib/icon/refresh_left.js +12 -12
- package/lib/icon/refresh_right.js +9 -9
- package/lib/icon/search.js +9 -9
- package/lib/icon/select.js +12 -12
- package/lib/icon/sort.js +9 -9
- package/lib/icon/success.js +12 -12
- package/lib/icon/sun.js +12 -12
- package/lib/icon/theme_default.js +12 -12
- package/lib/icon/warn.js +12 -12
- package/lib/icon/zoom_in.js +12 -12
- package/lib/icon/zoom_out.js +12 -12
- package/lib/image/image_preview.js +2 -104
- package/lib/image/index.js +2 -176
- package/lib/image-COPKk8Jm.js +162 -0
- package/lib/image_preview-CYEup07F.js +92 -0
- package/lib/index.d.ts +5 -81
- package/lib/index.js +78 -169
- package/lib/input/index.d.ts +6 -2
- package/lib/input/index.js +188 -203
- package/lib/input-DjKxcxry.js +4 -0
- package/lib/input_inner-BKJg9n9A.js +4 -0
- package/lib/item-B7Elh5xE.js +14 -0
- package/lib/item-CvoJt3wp.js +60 -0
- package/lib/item-DRsOV_Tc.js +119 -0
- package/lib/list/index.js +2 -58
- package/lib/list-CU7vHS6s.js +51 -0
- package/lib/loading/index.d.ts +3 -2
- package/lib/loading/index.js +109 -127
- package/lib/mask/index.js +2 -105
- package/lib/mask-CEznzwji.js +112 -0
- package/lib/md_input/index.js +2 -60
- package/lib/md_input-DSQx5TMW.js +58 -0
- package/lib/menu/index.d.ts +30 -13
- package/lib/menu/index.js +2 -105
- package/lib/menu/types.d.ts +6 -0
- package/lib/menu/types.js +0 -0
- package/lib/menu-CzV6lOlw.js +224 -0
- package/lib/message/index.js +67 -60
- package/lib/modal/index.js +2 -196
- package/lib/modal/modal_box.js +87 -86
- package/lib/modal-DWyWrN-D.js +192 -0
- package/lib/page_header/index.js +2 -109
- package/lib/page_header-BJkEstRw.js +101 -0
- package/lib/pagination/index.js +2 -248
- package/lib/pagination-5t7AOeFV.js +210 -0
- package/lib/polygon/index.js +2 -27
- package/lib/polygon-C4Ow2lxi.js +20 -0
- package/lib/qrcode/index.d.ts +13 -4
- package/lib/qrcode/index.js +2 -57
- package/lib/qrcode-BKG2MibP.js +64 -0
- package/lib/radio-2mNSYujz.js +13 -0
- package/lib/select/index.js +3 -401
- package/lib/select-CAgggYh7.js +326 -0
- package/lib/select_ori/index.js +47 -50
- package/lib/space/index.js +2 -35
- package/lib/space-Bv-p0DL8.js +38 -0
- package/lib/switch/index.js +2 -50
- package/lib/switch-BaVBi5Ip.js +48 -0
- package/lib/tabbar/index.js +2 -109
- package/lib/tabbar/item.js +2 -58
- package/lib/tabbar-CI1xSj1G.js +96 -0
- package/lib/table/index.js +2 -269
- package/lib/table-DfL2hFqA.js +234 -0
- package/lib/tabs/index.js +38 -42
- package/lib/tag/index.js +2 -72
- package/lib/tag-72DwCkvq.js +76 -0
- package/lib/theme/index.js +2 -89
- package/lib/theme/theme_color.js +22 -26
- package/lib/theme-BRTI2-Yk.js +83 -0
- package/lib/utils/clickoutside.js +18 -18
- package/lib/utils/context_provide.js +21 -21
- package/lib/utils/event.js +13 -18
- package/lib/utils/index.js +55 -58
- package/lib/utils/popover.d.ts +4 -1
- package/lib/utils/popover.js +276 -352
- package/lib/utils/transition.js +33 -31
- package/package.json +14 -14
- package/styles/container.css +4 -0
- package/styles/datepicker.css +55 -0
- package/styles/popover.css +14 -1
- package/lib/animation-DttknHkX.js +0 -4
- package/lib/calendar/langs.js +0 -8
- package/lib/carousel/timer.js +0 -19
- package/lib/check/check.js +0 -118
- package/lib/check/index.js +0 -68
- package/lib/check-CksURvTv.js +0 -4
- package/lib/form/form_inner.js +0 -125
- package/lib/form/types.js +0 -1
- package/lib/index-CrMiSe0x.js +0 -249
- package/lib/index-DY6m9Wbe.js +0 -4
- package/lib/litos-ui.css +0 -1
- package/lib/menu/menu_item.d.ts +0 -6
- package/lib/menu/menu_item.js +0 -21
- package/lib/menu/sub_menu.d.ts +0 -15
- package/lib/menu/sub_menu.js +0 -83
- package/lib/table/types.js +0 -1
package/lib/utils/popover.js
CHANGED
|
@@ -1,361 +1,285 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { $ as e, $$ as t, $one as n, iterate as r, off as i, on as a, shouldEventNext as o } from "ph-utils/dom";
|
|
2
|
+
//#region src/components/utils/popover.ts
|
|
3
|
+
function s(e, t, n, r, i = 10, a = "x") {
|
|
4
|
+
let o = a === "x" ? "width" : "height", s = [
|
|
5
|
+
"left",
|
|
6
|
+
"right",
|
|
7
|
+
"top",
|
|
8
|
+
"bottom"
|
|
9
|
+
];
|
|
10
|
+
a === "y" && (s = [
|
|
11
|
+
"top",
|
|
12
|
+
"bottom",
|
|
13
|
+
"left",
|
|
14
|
+
"right"
|
|
15
|
+
]);
|
|
16
|
+
let c = 0;
|
|
17
|
+
return n === s[0] ? c = t[o] + i : n === s[1] ? c = -(e[o] + i) : (n === s[2] || n === s[3]) && (r === "" ? c = t[o] / 2 - e[o] / 2 : r === "end" && (c = t[o] - e[o])), c;
|
|
8
18
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return t;
|
|
19
|
+
function c(e) {
|
|
20
|
+
let t = [], n = e;
|
|
21
|
+
for (; n && n !== document.body && n !== document.documentElement;) {
|
|
22
|
+
let e = window.getComputedStyle(n), r = e.overflow + e.overflowX + e.overflowY;
|
|
23
|
+
/(scroll|auto)/i.test(r) && t.push(n), n = n.parentElement;
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
17
26
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
s,
|
|
32
|
-
t,
|
|
33
|
-
e,
|
|
34
|
-
o,
|
|
35
|
-
n,
|
|
36
|
-
"x"
|
|
37
|
-
), m = s.left + i - u;
|
|
38
|
-
m + t.width > l && (e === "top" || e === "bottom" ? o = "end" : e = "left"), m < i && (e === "top" || e === "bottom" ? o = "start" : e = "right"), c = E(
|
|
39
|
-
s,
|
|
40
|
-
t,
|
|
41
|
-
e,
|
|
42
|
-
o,
|
|
43
|
-
n,
|
|
44
|
-
"y"
|
|
45
|
-
), u = E(
|
|
46
|
-
s,
|
|
47
|
-
t,
|
|
48
|
-
e,
|
|
49
|
-
o,
|
|
50
|
-
n,
|
|
51
|
-
"x"
|
|
52
|
-
), m = s.left + i - u, f = s.top + p - c;
|
|
53
|
-
const g = `${e}${o === "" ? "" : "-" + o}`;
|
|
54
|
-
return {
|
|
55
|
-
x: m,
|
|
56
|
-
y: f,
|
|
57
|
-
mainAlign: e,
|
|
58
|
-
crossAlign: o,
|
|
59
|
-
placement: g
|
|
60
|
-
};
|
|
27
|
+
function l(e, t, n, r, i = 10) {
|
|
28
|
+
let a = document.documentElement, o = a.scrollLeft, c = a.scrollTop, l = window.innerHeight + c - 10, u = window.innerWidth + o - 10, d = s(e, t, n, r, i, "y"), f = e.top + c - d;
|
|
29
|
+
f + t.height > l && (n === "left" || n === "right" ? r = "end" : n = "top"), f < c && (n === "left" || n === "right" ? r = "start" : n = "bottom");
|
|
30
|
+
let p = s(e, t, n, r, i, "x"), m = e.left + o - p;
|
|
31
|
+
m + t.width > u && (n === "top" || n === "bottom" ? r = "end" : n = "left"), m < o && (n === "top" || n === "bottom" ? r = "start" : n = "right"), d = s(e, t, n, r, i, "y"), p = s(e, t, n, r, i, "x"), m = e.left + o - p, f = e.top + c - d;
|
|
32
|
+
let h = `${n}${r === "" ? "" : "-" + r}`;
|
|
33
|
+
return {
|
|
34
|
+
x: m,
|
|
35
|
+
y: f,
|
|
36
|
+
mainAlign: n,
|
|
37
|
+
crossAlign: r,
|
|
38
|
+
placement: h
|
|
39
|
+
};
|
|
61
40
|
}
|
|
62
|
-
function
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
y: i === "height" ? h : void 0
|
|
71
|
-
};
|
|
41
|
+
function u(e, t, n, r) {
|
|
42
|
+
let i = e.getBoundingClientRect(), a = t.getBoundingClientRect(), o = "height";
|
|
43
|
+
(n === "top" || n === "bottom") && (o = "width");
|
|
44
|
+
let s = Math.min(i[o], a[o]), c = 0;
|
|
45
|
+
return c = r === "start" ? s / 2 - 4 : r === "end" ? a[o] - s / 2 - 4 : a[o] / 2 - 4, {
|
|
46
|
+
x: o === "width" ? c : void 0,
|
|
47
|
+
y: o === "height" ? c : void 0
|
|
48
|
+
};
|
|
72
49
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
bottom: "top",
|
|
102
|
-
left: "right"
|
|
103
|
-
}[l.mainAlign], m = {
|
|
104
|
-
top: "right",
|
|
105
|
-
bottom: "left",
|
|
106
|
-
left: "top",
|
|
107
|
-
right: "bottom"
|
|
108
|
-
}[l.mainAlign], _ = Math.ceil((e.arrowSize || 8) / 2);
|
|
109
|
-
v += `${u}: -${_}px;border-${u}: 1px solid var(--l-popover-border-color);border-${m}:1px solid var(--l-popover-border-color);`, c.style.cssText = v;
|
|
110
|
-
}
|
|
50
|
+
function d(e, t, r = {
|
|
51
|
+
placement: "top",
|
|
52
|
+
offset: 10,
|
|
53
|
+
arrowSize: 8
|
|
54
|
+
}) {
|
|
55
|
+
let i = "bottom", a = "", o = (r.placement || "top").split("-");
|
|
56
|
+
o != null && (i = o[0], a = o[1] || "");
|
|
57
|
+
let s, c = t.getBoundingClientRect(), d = e.getBoundingClientRect();
|
|
58
|
+
r.popoverWidth && (s = r.popoverWidth === "trigger" ? d.width : r.popoverWidth), s != null && (c.width = s, t.style.width = `${s}px`);
|
|
59
|
+
let f = l(d, c, i, a, r.offset || 10);
|
|
60
|
+
t.style.setProperty("left", `${f.x}px`), t.style.setProperty("top", `${f.y}px`);
|
|
61
|
+
let p = n(".l-popover-arrow", t);
|
|
62
|
+
if (p) {
|
|
63
|
+
let n = u(e, t, f.mainAlign, f.crossAlign), i = "";
|
|
64
|
+
r.arrowSize !== 8 && (i += `--l-popover-arrow-size: ${r.arrowSize}px;`), n.x && (i += `left: ${n.x}px;`), n.y && (i += `top: ${n.y}px;`);
|
|
65
|
+
let a = {
|
|
66
|
+
top: "bottom",
|
|
67
|
+
right: "left",
|
|
68
|
+
bottom: "top",
|
|
69
|
+
left: "right"
|
|
70
|
+
}[f.mainAlign], o = {
|
|
71
|
+
top: "right",
|
|
72
|
+
bottom: "left",
|
|
73
|
+
left: "top",
|
|
74
|
+
right: "bottom"
|
|
75
|
+
}[f.mainAlign], s = Math.ceil((r.arrowSize || 8) / 2);
|
|
76
|
+
i += `${a}: -${s}px;border-${a}: 1px solid var(--l-popover-border-color);border-${o}:1px solid var(--l-popover-border-color);`, p.style.cssText = i;
|
|
77
|
+
}
|
|
111
78
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
79
|
+
function f(e, t, n) {
|
|
80
|
+
let r = e, o = t, s = n;
|
|
81
|
+
d(r, o, s);
|
|
82
|
+
function l() {
|
|
83
|
+
d(r, o, s);
|
|
84
|
+
}
|
|
85
|
+
let u = c(r);
|
|
86
|
+
u.forEach((e) => {
|
|
87
|
+
a(e, "scroll", l);
|
|
88
|
+
});
|
|
89
|
+
function f() {
|
|
90
|
+
d(r, o, s);
|
|
91
|
+
}
|
|
92
|
+
let p = new ResizeObserver(f);
|
|
93
|
+
p.observe(r), p.observe(window.document.body);
|
|
94
|
+
function m() {
|
|
95
|
+
u.forEach((e) => {
|
|
96
|
+
i(e, "scroll", l);
|
|
97
|
+
}), u = void 0, r = void 0, o = void 0, s = void 0, p.disconnect(), p = void 0;
|
|
98
|
+
}
|
|
99
|
+
return { destroy: m };
|
|
133
100
|
}
|
|
134
|
-
class
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
const r = n();
|
|
293
|
-
typeof r == "string" ? o.innerHTML = r : o.appendChild(r);
|
|
294
|
-
} else {
|
|
295
|
-
const r = w("div", { class: "l-popover-content" });
|
|
296
|
-
o.appendChild(r);
|
|
297
|
-
}
|
|
298
|
-
this.options.arrow && o.appendChild(w("div", { class: "l-popover-arrow" })), document.body.appendChild(o), this.popoverElement = o;
|
|
299
|
-
}
|
|
300
|
-
_destroyUpdater() {
|
|
301
|
-
this.updater && (this.updater.destroy(), this.updater = void 0);
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* 销毁组件
|
|
305
|
-
*
|
|
306
|
-
* 销毁组件并移除相关事件监听器和 DOM 元素。
|
|
307
|
-
*/
|
|
308
|
-
destroy() {
|
|
309
|
-
this.hide(), this.$refs && $(this.$refs, (t) => {
|
|
310
|
-
this._removeReferenceEvents(t);
|
|
311
|
-
}), a(document, "click", this._onOuterTap, { capture: !0 }), this.options = void 0, this.$refs = void 0, this._clearHideTimer(), this.popoverElement && (a(this.popoverElement, "mouseenter", this._onPopoverEnter), a(this.popoverElement, "mouseleave", this._onMouseLeave), this.popoverElement.remove()), this.popoverElement = void 0;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
const S = {
|
|
315
|
-
theme: "popconfirm",
|
|
316
|
-
trigger: "click",
|
|
317
|
-
contentRender: () => {
|
|
318
|
-
const s = [];
|
|
319
|
-
return s.push('<div class="l-popconfirm-container">'), s.push('<div class="l-popconfirm-icon-wrapper">'), s.push("<l-warn-icon></l-warn-icon>"), s.push('</div><div class="l-popconfirm-content"></div></div>'), s.push('<div class="l-popconfirm-footer">'), s.push(
|
|
320
|
-
'<l-button class="l-popconfirm-btn" data-action="popconfirm-cancel">取消</l-button>'
|
|
321
|
-
), s.push(
|
|
322
|
-
'<l-button class="l-popconfirm-btn" type="primary" data-action="popconfirm-ok">确定</l-button>'
|
|
323
|
-
), s.push("</div>"), s.join("");
|
|
324
|
-
},
|
|
325
|
-
updateContent: (s, t) => {
|
|
326
|
-
const e = s.querySelector(".l-popconfirm-content");
|
|
327
|
-
e && t && (e.innerHTML = t.content || "");
|
|
328
|
-
}
|
|
101
|
+
var p = class {
|
|
102
|
+
options;
|
|
103
|
+
$refs = [];
|
|
104
|
+
$reference;
|
|
105
|
+
popoverElement;
|
|
106
|
+
updater;
|
|
107
|
+
_hideTimer;
|
|
108
|
+
constructor(t) {
|
|
109
|
+
this.options = {
|
|
110
|
+
trigger: "hover",
|
|
111
|
+
arrow: !0,
|
|
112
|
+
offset: 10,
|
|
113
|
+
arrowSize: 8,
|
|
114
|
+
disabled: !1,
|
|
115
|
+
updateContent: (e, t) => {
|
|
116
|
+
if (t && t.title) {
|
|
117
|
+
let r = n(".l-popover-content", e);
|
|
118
|
+
r && (r.textContent = t.title);
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
...t
|
|
122
|
+
};
|
|
123
|
+
let r = [];
|
|
124
|
+
this.options.reference ? typeof this.options.reference == "string" ? r = [...e(this.options.reference)] : Array.isArray(this.options.reference) ? r.push(...this.options.reference) : r.push(this.options.reference) : r = [...e(".l-popover-reference")], this.$refs = r, this.popoverElement = this.options.popover, this._bindPopoverEvents(), this._init();
|
|
125
|
+
}
|
|
126
|
+
addReference(e) {
|
|
127
|
+
this.$refs && (this._bindReferenceEvents(e), this.$refs.push(e));
|
|
128
|
+
}
|
|
129
|
+
removeReference(e) {
|
|
130
|
+
if (this.$refs) {
|
|
131
|
+
let t = this.$refs.indexOf(e);
|
|
132
|
+
t !== -1 && (e == this.$reference && this.hide(), this._removeReferenceEvents(e), this.$refs.splice(t, 1));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
_init() {
|
|
136
|
+
this.options.trigger && this.$refs && r(this.$refs, (e) => {
|
|
137
|
+
this._bindReferenceEvents(e);
|
|
138
|
+
}), a(document, "click", this._onOuterTap, { capture: !0 });
|
|
139
|
+
}
|
|
140
|
+
_bindReferenceEvents(e) {
|
|
141
|
+
let t = this.options.trigger;
|
|
142
|
+
["click", "focus"].includes(t) ? a(e, "click", this._onRefTap) : t === "hover" && (a(e, "mouseenter", this._onMouseEnter), a(e, "mouseleave", this._onMouseLeave));
|
|
143
|
+
}
|
|
144
|
+
_removeReferenceEvents(e) {
|
|
145
|
+
i(e, "click", this._onRefTap), i(e, "mouseenter", this._onMouseEnter), i(e, "mouseleave", this._onMouseLeave);
|
|
146
|
+
}
|
|
147
|
+
_bindPopoverEvents() {
|
|
148
|
+
this.popoverElement && this.options.trigger === "hover" && (a(this.popoverElement, "mouseenter", this._onPopoverEnter), a(this.popoverElement, "mouseleave", this._onMouseLeave));
|
|
149
|
+
}
|
|
150
|
+
_onPopoverEnter = () => {
|
|
151
|
+
this._clearHideTimer();
|
|
152
|
+
};
|
|
153
|
+
_clearHideTimer() {
|
|
154
|
+
this._hideTimer &&= (clearTimeout(this._hideTimer), void 0);
|
|
155
|
+
}
|
|
156
|
+
_onMouseEnter = (e) => {
|
|
157
|
+
let t = e.target;
|
|
158
|
+
this._clearHideTimer(), this.$reference != t && this.show(t);
|
|
159
|
+
};
|
|
160
|
+
_onMouseLeave = () => {
|
|
161
|
+
this._clearHideTimer(), this.options.trigger === "hover" && (this._hideTimer = setTimeout(() => {
|
|
162
|
+
this.hide();
|
|
163
|
+
}, 50));
|
|
164
|
+
};
|
|
165
|
+
_onRefTap = (e) => {
|
|
166
|
+
this._destroyUpdater();
|
|
167
|
+
let t = e.target;
|
|
168
|
+
if (this.$reference) {
|
|
169
|
+
if (this.options.trigger === "focus") return;
|
|
170
|
+
this.hide();
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
this.show(t);
|
|
174
|
+
};
|
|
175
|
+
show(e) {
|
|
176
|
+
let t = e.dataset, n = t.disabled;
|
|
177
|
+
if (n ??= this.options.disabled, !n) {
|
|
178
|
+
if (this.$reference) {
|
|
179
|
+
if (this.$reference === e) return;
|
|
180
|
+
this.hide();
|
|
181
|
+
}
|
|
182
|
+
if (this.$reference = e, this.popoverElement || (this._renderPopover(), this._bindPopoverEvents()), this.popoverElement) {
|
|
183
|
+
this.options.updateContent && this.options.updateContent(this.popoverElement, t), this._destroyUpdater();
|
|
184
|
+
let e = t.placement || this.options.placement || "top", n = Number(t.offset || this.options.offset || 10), r = t.popoverWidth || this.options.popoverWidth;
|
|
185
|
+
this.popoverElement.style.display = "block";
|
|
186
|
+
let i;
|
|
187
|
+
r && (i = r === "trigger" ? r : Number(r)), this.updater = f(this.$reference, this.popoverElement, {
|
|
188
|
+
placement: e,
|
|
189
|
+
popoverWidth: i,
|
|
190
|
+
offset: n,
|
|
191
|
+
arrowSize: this.options.arrowSize
|
|
192
|
+
}), this.options.onOpenChange && this.options.onOpenChange(!0);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
isShow() {
|
|
197
|
+
return this.$reference != null;
|
|
198
|
+
}
|
|
199
|
+
hide() {
|
|
200
|
+
this._destroyUpdater(), this.popoverElement && (this.popoverElement.style.display = "none"), this.$reference = void 0, this.options.onOpenChange && this.options.onOpenChange(!1, this.popoverElement);
|
|
201
|
+
}
|
|
202
|
+
setOption(e, t) {
|
|
203
|
+
this.options[e] = t;
|
|
204
|
+
}
|
|
205
|
+
updatePopoverContent() {
|
|
206
|
+
this.popoverElement && this.options.updateContent && this.options.updateContent(this.popoverElement, {});
|
|
207
|
+
}
|
|
208
|
+
_onOuterTap = (e) => {
|
|
209
|
+
let t = e.target, n = !!(this.$reference && !this.$reference.contains(t) && this.$reference != t), r = !!(this.popoverElement && (this.popoverElement.contains(t) || this.popoverElement == t));
|
|
210
|
+
if (this.options.trigger !== "manual" && !n) {
|
|
211
|
+
if (this.options.trigger === "focus") {
|
|
212
|
+
this.hide();
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (r) {
|
|
216
|
+
let [t, n, r] = o(e, "data-action", this.popoverElement);
|
|
217
|
+
if (t) {
|
|
218
|
+
let e = "";
|
|
219
|
+
n === "popconfirm-cancel" ? e = "cancel" : n === "popconfirm-ok" && (e = "ok"), e && this.hide(), this.options.onPopoverAction && this.options.onPopoverAction(e || n, r);
|
|
220
|
+
}
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
this.hide();
|
|
224
|
+
}
|
|
225
|
+
this.options.onOutsideTap && this.options.onOutsideTap(e, !n, r);
|
|
226
|
+
};
|
|
227
|
+
_renderPopover() {
|
|
228
|
+
let e = `l-popover l-popover--${this.options.theme || "default"}`;
|
|
229
|
+
this.options.popoverClass && (e += ` ${this.options.popoverClass}`);
|
|
230
|
+
let n = t("div", { class: e }), r = this.options.contentRender;
|
|
231
|
+
if (r) {
|
|
232
|
+
let e = r();
|
|
233
|
+
typeof e == "string" ? n.innerHTML = e : n.appendChild(e);
|
|
234
|
+
} else {
|
|
235
|
+
let e = t("div", { class: "l-popover-content" });
|
|
236
|
+
n.appendChild(e);
|
|
237
|
+
}
|
|
238
|
+
this.options.arrow && n.appendChild(t("div", { class: "l-popover-arrow" })), document.body.appendChild(n), this.popoverElement = n;
|
|
239
|
+
}
|
|
240
|
+
_destroyUpdater() {
|
|
241
|
+
this.updater &&= (this.updater.destroy(), void 0);
|
|
242
|
+
}
|
|
243
|
+
destroy() {
|
|
244
|
+
this.hide(), this.$refs && r(this.$refs, (e) => {
|
|
245
|
+
this._removeReferenceEvents(e);
|
|
246
|
+
}), i(document, "click", this._onOuterTap, { capture: !0 }), this.options = void 0, this.$refs = void 0, this._clearHideTimer(), this.popoverElement && (i(this.popoverElement, "mouseenter", this._onPopoverEnter), i(this.popoverElement, "mouseleave", this._onMouseLeave), this.popoverElement.remove()), this.popoverElement = void 0;
|
|
247
|
+
}
|
|
248
|
+
}, m = {
|
|
249
|
+
theme: "popconfirm",
|
|
250
|
+
trigger: "click",
|
|
251
|
+
contentRender: () => {
|
|
252
|
+
let e = [];
|
|
253
|
+
return e.push("<div class=\"l-popconfirm-container\">"), e.push("<div class=\"l-popconfirm-icon-wrapper\">"), e.push("<l-warn-icon></l-warn-icon>"), e.push("</div><div class=\"l-popconfirm-content\"></div></div>"), e.push("<div class=\"l-popconfirm-footer\">"), e.push("<l-button class=\"l-popconfirm-btn\" data-action=\"popconfirm-cancel\">取消</l-button>"), e.push("<l-button class=\"l-popconfirm-btn\" type=\"primary\" data-action=\"popconfirm-ok\">确定</l-button>"), e.push("</div>"), e.join("");
|
|
254
|
+
},
|
|
255
|
+
updateContent: (e, t) => {
|
|
256
|
+
let n = e.querySelector(".l-popconfirm-content");
|
|
257
|
+
n && t && (n.innerHTML = t.content || "");
|
|
258
|
+
}
|
|
329
259
|
};
|
|
330
|
-
function
|
|
331
|
-
|
|
260
|
+
function h(t, n) {
|
|
261
|
+
return t.classList.contains(n) ? t : e(`.${n}`, t);
|
|
332
262
|
}
|
|
333
|
-
function
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
263
|
+
function g(e, t, n) {
|
|
264
|
+
let i = new MutationObserver((e) => {
|
|
265
|
+
e.forEach((e) => {
|
|
266
|
+
e.type === "childList" && (r(e.addedNodes, (e) => {
|
|
267
|
+
let i = h(e, t);
|
|
268
|
+
i && (i instanceof HTMLElement ? n.addReference(i) : r(i, (e) => {
|
|
269
|
+
n.addReference(e);
|
|
270
|
+
}));
|
|
271
|
+
}), r(e.removedNodes, (e) => {
|
|
272
|
+
let i = h(e, t);
|
|
273
|
+
i && (i instanceof HTMLElement ? n.removeReference(i) : r(i, (e) => {
|
|
274
|
+
n.removeReference(e);
|
|
275
|
+
}));
|
|
276
|
+
}));
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
return i.observe(e, {
|
|
280
|
+
childList: !0,
|
|
281
|
+
subtree: !0
|
|
282
|
+
}), i;
|
|
353
283
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
L as autoUpdate,
|
|
357
|
-
H as createPopoverObserver,
|
|
358
|
-
C as getOverflowAncestors,
|
|
359
|
-
S as popconfirmProps,
|
|
360
|
-
b as updatePosition
|
|
361
|
-
};
|
|
284
|
+
//#endregion
|
|
285
|
+
export { p as Popover, f as autoUpdate, g as createPopoverObserver, c as getOverflowAncestors, m as popconfirmProps, d as updatePosition };
|