litos-ui 0.15.7 → 0.16.0
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/button/index.d.ts +4 -0
- package/lib/button/index.js +24 -16
- package/lib/check/check.js +6 -7
- package/lib/check/checkbox.js +1 -1
- package/lib/check/index.d.ts +2 -1
- package/lib/check/index.js +25 -12
- package/lib/check/radio.js +10 -6
- package/lib/check-C7YSuH60.js +4 -0
- package/lib/color_picker/index.js +1 -1
- package/lib/description_panel/index.js +4 -9
- package/lib/dialog/dialog_container.js +4 -6
- package/lib/form/form_inner.d.ts +3 -0
- package/lib/form/form_inner.js +28 -23
- package/lib/image/image_preview.js +3 -3
- package/lib/index-DvcllHRh.js +4 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +163 -164
- package/lib/input/index.d.ts +2 -1
- package/lib/input/index.js +37 -26
- package/lib/mask/index.js +1 -6
- package/lib/message/index.d.ts +11 -12
- package/lib/message/index.js +39 -40
- package/lib/modal/index.js +1 -1
- package/lib/select/index.js +1 -6
- package/lib/select_ori/index.js +1 -1
- package/lib/space/index.d.ts +8 -0
- package/lib/space/index.js +35 -0
- package/lib/tabbar/index.d.ts +3 -1
- package/lib/tabbar/index.js +13 -7
- package/lib/table/index.d.ts +27 -10
- package/lib/table/index.js +165 -96
- package/lib/table/types.d.ts +9 -1
- package/lib/tag/index.js +4 -1
- package/lib/utils/index.d.ts +0 -25
- package/lib/utils/index.js +40 -87
- package/lib/utils/popover.js +24 -17
- package/package.json +41 -40
- package/styles/container.css +1 -0
- package/styles/dark.css +13 -0
- package/styles/reset.css +3 -5
- package/styles/vars.css +10 -12
- package/lib/check-A86JxUfd.js +0 -4
- package/lib/index-D4II9KsF.js +0 -4
- package/lib/menu/base.js +0 -1
package/lib/index.js
CHANGED
|
@@ -1,166 +1,165 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { set as
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as
|
|
5
|
-
import { default as
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as
|
|
10
|
-
import { default as
|
|
11
|
-
import { default as
|
|
12
|
-
import { default as
|
|
13
|
-
import { default as
|
|
14
|
-
import { default as
|
|
15
|
-
import { default as
|
|
16
|
-
import { default as
|
|
17
|
-
import { default as
|
|
18
|
-
import { default as
|
|
19
|
-
import { default as
|
|
20
|
-
import { default as
|
|
21
|
-
import { default as
|
|
22
|
-
import { default as
|
|
23
|
-
import { default as
|
|
24
|
-
import { default as
|
|
25
|
-
import { default as
|
|
26
|
-
import { default as
|
|
27
|
-
import { default as
|
|
28
|
-
import { default as
|
|
29
|
-
import { default as
|
|
30
|
-
import { default as
|
|
31
|
-
import { default as
|
|
32
|
-
import { default as
|
|
33
|
-
import { default as
|
|
34
|
-
import { default as
|
|
35
|
-
import { default as
|
|
36
|
-
import { default as
|
|
37
|
-
import { default as
|
|
38
|
-
import { default as
|
|
39
|
-
import { default as
|
|
40
|
-
import { default as
|
|
41
|
-
import { default as
|
|
42
|
-
import { default as
|
|
43
|
-
import { default as
|
|
44
|
-
import { default as
|
|
45
|
-
import { default as
|
|
46
|
-
import { default as
|
|
47
|
-
import { default as
|
|
48
|
-
import { default as
|
|
49
|
-
import { default as
|
|
50
|
-
import { default as
|
|
51
|
-
import { default as
|
|
52
|
-
import { default as
|
|
53
|
-
import { default as
|
|
54
|
-
import { default as
|
|
55
|
-
import { default as
|
|
56
|
-
import { default as
|
|
57
|
-
import { default as
|
|
58
|
-
import { default as
|
|
59
|
-
import { default as
|
|
60
|
-
import { default as
|
|
61
|
-
import { default as
|
|
62
|
-
import { default as
|
|
63
|
-
import { default as
|
|
64
|
-
import { default as
|
|
65
|
-
import { default as
|
|
66
|
-
import { default as
|
|
67
|
-
import { default as
|
|
68
|
-
import { default as
|
|
69
|
-
import { default as
|
|
70
|
-
import { default as
|
|
71
|
-
import { default as
|
|
72
|
-
import { default as
|
|
73
|
-
import { Popover as
|
|
74
|
-
import { default as
|
|
1
|
+
import { initAttr as r, kebabToCamel as t, parseAttrValue as a, regist as f, setAttrs as s, tagAttr as l, tagAttrs as m, useId as p } from "./utils/index.js";
|
|
2
|
+
import { set as d, remove as x } from "./utils/clickoutside.js";
|
|
3
|
+
import { default as c } from "./base.js";
|
|
4
|
+
import { default as i } from "./message/index.js";
|
|
5
|
+
import { default as C } from "./dialog/index.js";
|
|
6
|
+
import { default as h } from "./dialog/dialog_container.js";
|
|
7
|
+
import { default as P } from "./loading/index.js";
|
|
8
|
+
import { default as S } from "./tabs/index.js";
|
|
9
|
+
import { default as M } from "./modal/index.js";
|
|
10
|
+
import { default as D } from "./icon/base.js";
|
|
11
|
+
import { default as v } from "./icon/arrow_down.js";
|
|
12
|
+
import { default as O } from "./icon/arrow_left.js";
|
|
13
|
+
import { default as F } from "./icon/arrow_right.js";
|
|
14
|
+
import { default as U } from "./icon/arrow_up.js";
|
|
15
|
+
import { default as y } from "./icon/caret_top.js";
|
|
16
|
+
import { default as Q } from "./icon/caret_bottom.js";
|
|
17
|
+
import { default as W } from "./icon/font_icon.js";
|
|
18
|
+
import { default as q } from "./icon/loading.js";
|
|
19
|
+
import { default as E } from "./icon/search.js";
|
|
20
|
+
import { default as K } from "./icon/sun.js";
|
|
21
|
+
import { default as X } from "./icon/moon.js";
|
|
22
|
+
import { default as _ } from "./icon/reduction.js";
|
|
23
|
+
import { default as oo } from "./icon/refresh_left.js";
|
|
24
|
+
import { default as ro } from "./icon/refresh_right.js";
|
|
25
|
+
import { default as ao } from "./icon/sort.js";
|
|
26
|
+
import { default as so } from "./icon/theme_default.js";
|
|
27
|
+
import { default as mo } from "./icon/close.js";
|
|
28
|
+
import { default as uo } from "./icon/info.js";
|
|
29
|
+
import { default as no } from "./icon/success.js";
|
|
30
|
+
import { default as Io } from "./icon/warn.js";
|
|
31
|
+
import { default as go } from "./icon/close_filled.js";
|
|
32
|
+
import { default as bo } from "./icon/more.js";
|
|
33
|
+
import { default as Ao } from "./icon/d_arrow_left.js";
|
|
34
|
+
import { default as wo } from "./icon/d_arrow_right.js";
|
|
35
|
+
import { default as To } from "./icon/zoom_in.js";
|
|
36
|
+
import { default as ko } from "./icon/zoom_out.js";
|
|
37
|
+
import { default as Ro } from "./icon/select.js";
|
|
38
|
+
import { default as Lo } from "./form/index.js";
|
|
39
|
+
import { default as Bo } from "./form/form_item.js";
|
|
40
|
+
import { default as Go } from "./check/radio_group.js";
|
|
41
|
+
import { default as Zo } from "./check/radio.js";
|
|
42
|
+
import { default as Ho } from "./check/checkbox.js";
|
|
43
|
+
import { default as Vo } from "./check/checkbox_group.js";
|
|
44
|
+
import { default as jo } from "./button/index.js";
|
|
45
|
+
import { default as zo } from "./input/index.js";
|
|
46
|
+
import { default as Jo } from "./select_ori/index.js";
|
|
47
|
+
import { default as No } from "./switch/index.js";
|
|
48
|
+
import { default as Yo } from "./md_input/index.js";
|
|
49
|
+
import { default as $o } from "./select/index.js";
|
|
50
|
+
import { default as ee } from "./list/index.js";
|
|
51
|
+
import { default as te } from "./polygon/index.js";
|
|
52
|
+
import { default as fe } from "./color_picker/index.js";
|
|
53
|
+
import { default as le } from "./tabbar/index.js";
|
|
54
|
+
import { default as pe } from "./tabbar/item.js";
|
|
55
|
+
import { default as de } from "./theme/index.js";
|
|
56
|
+
import { default as ne } from "./theme/theme_color.js";
|
|
57
|
+
import { default as Ie } from "./date_picker/index.js";
|
|
58
|
+
import { default as ge } from "./menu/index.js";
|
|
59
|
+
import { default as be } from "./menu/menu_item.js";
|
|
60
|
+
import { default as Ae } from "./menu/sub_menu.js";
|
|
61
|
+
import { default as we } from "./carousel/index.js";
|
|
62
|
+
import { default as Te } from "./carousel/item.js";
|
|
63
|
+
import { default as ke } from "./qrcode/index.js";
|
|
64
|
+
import { default as Re } from "./description_panel/index.js";
|
|
65
|
+
import { default as Le } from "./pagination/index.js";
|
|
66
|
+
import { default as Be } from "./mask/index.js";
|
|
67
|
+
import { default as Ge } from "./page_header/index.js";
|
|
68
|
+
import { default as Ze } from "./tag/index.js";
|
|
69
|
+
import { default as He } from "./collapse/index.js";
|
|
70
|
+
import { default as Ve } from "./collapse/item.js";
|
|
71
|
+
import { default as je } from "./image/index.js";
|
|
72
|
+
import { default as ze } from "./image/image_preview.js";
|
|
73
|
+
import { Popover as Je, autoUpdate as Ke, createPopoverObserver as Ne, getOverflowAncestors as Xe, popconfirmProps as Ye, updatePosition as _e } from "./utils/popover.js";
|
|
74
|
+
import { default as or } from "./table/index.js";
|
|
75
|
+
import { default as rr } from "./space/index.js";
|
|
75
76
|
export {
|
|
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
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
r as
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
et as updatePosition,
|
|
165
|
-
x as useId
|
|
77
|
+
v as ArrowDownIcon,
|
|
78
|
+
O as ArrowLeftIcon,
|
|
79
|
+
F as ArrowRightIcon,
|
|
80
|
+
U as ArrowUpIcon,
|
|
81
|
+
c as BaseComponent,
|
|
82
|
+
D as BaseIcon,
|
|
83
|
+
jo as Button,
|
|
84
|
+
Q as CaretBottomIcon,
|
|
85
|
+
y as CaretTopIcon,
|
|
86
|
+
we as Carousel,
|
|
87
|
+
Te as CarouselItem,
|
|
88
|
+
Ho as Checkbox,
|
|
89
|
+
Vo as CheckboxGroup,
|
|
90
|
+
go as CloseFilledIcon,
|
|
91
|
+
mo as CloseIcon,
|
|
92
|
+
He as Collapse,
|
|
93
|
+
Ve as CollapseItem,
|
|
94
|
+
fe as ColorPicker,
|
|
95
|
+
Ao as DArrowLeftIcon,
|
|
96
|
+
wo as DArrowRightIcon,
|
|
97
|
+
Ie as DatePicker,
|
|
98
|
+
Re as DescriptionPanel,
|
|
99
|
+
C as Dialog,
|
|
100
|
+
h as DialogContainer,
|
|
101
|
+
W as FontIcon,
|
|
102
|
+
Lo as Form,
|
|
103
|
+
Bo as FormItem,
|
|
104
|
+
je as Image,
|
|
105
|
+
ze as ImagePreview,
|
|
106
|
+
uo as InfoIcon,
|
|
107
|
+
zo as Input,
|
|
108
|
+
ee as List,
|
|
109
|
+
P as Loading,
|
|
110
|
+
q as LoadingIcon,
|
|
111
|
+
Be as Mask,
|
|
112
|
+
Yo as MdInput,
|
|
113
|
+
ge as Menu,
|
|
114
|
+
be as MenuItem,
|
|
115
|
+
i as Message,
|
|
116
|
+
M as Modal,
|
|
117
|
+
X as MoonIcon,
|
|
118
|
+
bo as MoreIcon,
|
|
119
|
+
Ge as PageHeader,
|
|
120
|
+
Le as Pagination,
|
|
121
|
+
te as Polygon,
|
|
122
|
+
Je as Popover,
|
|
123
|
+
ke as Qrcode,
|
|
124
|
+
Zo as Radio,
|
|
125
|
+
Go as RadioGroup,
|
|
126
|
+
_ as ReductionIcon,
|
|
127
|
+
oo as RefreshLeftIcon,
|
|
128
|
+
ro as RefreshRightIcon,
|
|
129
|
+
E as SearchIcon,
|
|
130
|
+
$o as Select,
|
|
131
|
+
Ro as SelectIcon,
|
|
132
|
+
Jo as SelectOri,
|
|
133
|
+
ao as SortIcon,
|
|
134
|
+
rr as Space,
|
|
135
|
+
Ae as SubMenu,
|
|
136
|
+
no as SuccessIcon,
|
|
137
|
+
K as SunIcon,
|
|
138
|
+
No as Switch,
|
|
139
|
+
le as Tabbar,
|
|
140
|
+
pe as TabbarItem,
|
|
141
|
+
or as Table,
|
|
142
|
+
S as Tabs,
|
|
143
|
+
Ze as Tag,
|
|
144
|
+
de as Theme,
|
|
145
|
+
ne as ThemeColor,
|
|
146
|
+
so as ThemeDefaultIcon,
|
|
147
|
+
Io as WarnIcon,
|
|
148
|
+
To as ZoomInIcon,
|
|
149
|
+
ko as ZoomOutIcon,
|
|
150
|
+
d as addClickOutside,
|
|
151
|
+
Ke as autoUpdate,
|
|
152
|
+
Ne as createPopoverObserver,
|
|
153
|
+
Xe as getOverflowAncestors,
|
|
154
|
+
r as initAttr,
|
|
155
|
+
t as kebabToCamel,
|
|
156
|
+
a as parseAttrValue,
|
|
157
|
+
Ye as popconfirmProps,
|
|
158
|
+
f as regist,
|
|
159
|
+
x as removeClickOutside,
|
|
160
|
+
s as setAttrs,
|
|
161
|
+
l as tagAttr,
|
|
162
|
+
m as tagAttrs,
|
|
163
|
+
_e as updatePosition,
|
|
164
|
+
p as useId
|
|
166
165
|
};
|
package/lib/input/index.d.ts
CHANGED
package/lib/input/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { addClass as h, removeClass as u, $one as d, on as o, formatStyle as
|
|
2
|
-
import { initAttr as g, parseAttrValue as
|
|
3
|
-
import
|
|
4
|
-
import { add as
|
|
5
|
-
import { i as v } from "../index-
|
|
6
|
-
class
|
|
1
|
+
import { addClass as h, removeClass as u, $one as d, on as o, formatStyle as c, off as p, $ as f, $$ as n } from "ph-utils/dom";
|
|
2
|
+
import { initAttr as g, parseAttrValue as a } from "../utils/index.js";
|
|
3
|
+
import m from "../form/form_inner.js";
|
|
4
|
+
import { add as b, remove as x } from "../utils/event.js";
|
|
5
|
+
import { i as v } from "../index-DvcllHRh.js";
|
|
6
|
+
class I extends m {
|
|
7
7
|
static baseName = "input";
|
|
8
8
|
/** 原生 input 的 type */
|
|
9
9
|
type = "text";
|
|
@@ -19,6 +19,7 @@ class y extends b {
|
|
|
19
19
|
block = !1;
|
|
20
20
|
error = !1;
|
|
21
21
|
maxlength;
|
|
22
|
+
minlength;
|
|
22
23
|
inputmode = "text";
|
|
23
24
|
$inner;
|
|
24
25
|
#t = !1;
|
|
@@ -35,56 +36,63 @@ class y extends b {
|
|
|
35
36
|
this.#t = t, t ? h(this, "l-input--clearable") : u(this, "l-input--clearable");
|
|
36
37
|
}
|
|
37
38
|
static get observedAttributes() {
|
|
38
|
-
return [
|
|
39
|
+
return [
|
|
40
|
+
"disabled",
|
|
41
|
+
"value",
|
|
42
|
+
"name",
|
|
43
|
+
"error",
|
|
44
|
+
"clearable",
|
|
45
|
+
"maxlength",
|
|
46
|
+
"inputmode"
|
|
47
|
+
];
|
|
39
48
|
}
|
|
40
49
|
connectedCallback() {
|
|
41
|
-
g(this), this.loadStyleText([v]), super.connectedCallback(), this.$inner = d(".l-input__inner", this.root), o(this.$inner, "input", this._input), o(this.$inner, "change", this.#s), this.style.cssText =
|
|
50
|
+
g(this), this.loadStyleText([v]), super.connectedCallback(), this.$inner = d(".l-input__inner", this.root), o(this.$inner, "input", this._input), o(this.$inner, "change", this.#s), this.style.cssText = c(this._getStyleObj()) + this.getAttr("style", ""), this.error && h(this, "is-error"), this.getName() && this.formAttrs.id && b(this.formAttrs.id, "validateChange", this._validateChange);
|
|
42
51
|
}
|
|
43
52
|
disconnectedCallback() {
|
|
44
53
|
super.disconnectedCallback(), this.formAttrs.id && x(this.formAttrs.id, "validateChange", this._validateChange), p(this.$inner, "input", this._input);
|
|
45
54
|
}
|
|
46
55
|
attributeChange(t, s, e) {
|
|
47
|
-
const r =
|
|
56
|
+
const r = a(
|
|
48
57
|
e,
|
|
49
58
|
this[t],
|
|
50
59
|
t
|
|
51
60
|
);
|
|
52
61
|
if (r !== this[t] && (this[t] = r), t === "error") {
|
|
53
|
-
const i =
|
|
62
|
+
const i = a(e, !1, t);
|
|
54
63
|
i !== this.error && (this.error = i, this._updateError());
|
|
55
64
|
} else if (t === "clearable") {
|
|
56
|
-
const i =
|
|
65
|
+
const i = a(e, !1, t);
|
|
57
66
|
i !== this.clearable && (this.clearable = i);
|
|
58
67
|
} else if (t === "maxlength") {
|
|
59
|
-
const i =
|
|
68
|
+
const i = a(e, this.maxlength);
|
|
60
69
|
i !== this.maxlength && (this.maxlength = i);
|
|
61
70
|
}
|
|
62
71
|
}
|
|
63
72
|
render() {
|
|
64
73
|
const t = document.createDocumentFragment();
|
|
65
|
-
if (
|
|
66
|
-
const i =
|
|
74
|
+
if (f('[slot="prefix"]', this).length > 0) {
|
|
75
|
+
const i = n("slot", {
|
|
67
76
|
name: "prefix"
|
|
68
|
-
}), l =
|
|
77
|
+
}), l = n("span", {
|
|
69
78
|
class: "l-input__prefix",
|
|
70
79
|
part: "prefix"
|
|
71
80
|
});
|
|
72
81
|
l.appendChild(i), t.appendChild(l);
|
|
73
82
|
}
|
|
74
|
-
const e =
|
|
83
|
+
const e = n("input", {
|
|
75
84
|
class: "l-input__inner",
|
|
76
85
|
value: this.value,
|
|
77
|
-
name: this.getName(),
|
|
78
|
-
placeholder: this.placeholder,
|
|
79
|
-
disabled: this.isDisabled(),
|
|
86
|
+
name: this.getName() || "",
|
|
87
|
+
placeholder: this.placeholder || "",
|
|
80
88
|
part: "default",
|
|
81
89
|
type: this.type,
|
|
82
90
|
inputmode: this.inputmode
|
|
83
91
|
});
|
|
84
|
-
if (this.
|
|
85
|
-
const i =
|
|
92
|
+
if (this.isDisabled() && (e.disabled = !0), this.maxlength && e.setAttribute("maxlength", this.maxlength), this.minlength && e.setAttribute("minlength", this.minlength), t.appendChild(e), f('[slot="suffix"]', this).length > 0) {
|
|
93
|
+
const i = n("slot", {
|
|
86
94
|
name: "suffix"
|
|
87
|
-
}), l =
|
|
95
|
+
}), l = n("span", {
|
|
88
96
|
class: "l-input__suffix",
|
|
89
97
|
part: "suffix"
|
|
90
98
|
});
|
|
@@ -117,10 +125,10 @@ class y extends b {
|
|
|
117
125
|
let t = d(".l-clearable", this.root);
|
|
118
126
|
if (this.value.length > 0) {
|
|
119
127
|
if (t == null) {
|
|
120
|
-
t =
|
|
128
|
+
t = n("span", {
|
|
121
129
|
class: "l-input__suffix l-clearable"
|
|
122
130
|
});
|
|
123
|
-
const s =
|
|
131
|
+
const s = n("l-close-filled-icon");
|
|
124
132
|
t.appendChild(s), this.root.appendChild(t), o(t, "click", this.#i);
|
|
125
133
|
}
|
|
126
134
|
} else
|
|
@@ -129,7 +137,10 @@ class y extends b {
|
|
|
129
137
|
}
|
|
130
138
|
#i = () => {
|
|
131
139
|
this.value = "", this.dispatchEvent(
|
|
132
|
-
new CustomEvent("input", {
|
|
140
|
+
new CustomEvent("input", {
|
|
141
|
+
bubbles: !0,
|
|
142
|
+
detail: { value: this.value }
|
|
143
|
+
})
|
|
133
144
|
), this.#e();
|
|
134
145
|
};
|
|
135
146
|
disabledChange() {
|
|
@@ -177,5 +188,5 @@ class y extends b {
|
|
|
177
188
|
};
|
|
178
189
|
}
|
|
179
190
|
export {
|
|
180
|
-
|
|
191
|
+
I as default
|
|
181
192
|
};
|
package/lib/mask/index.js
CHANGED
|
@@ -37,12 +37,7 @@ class x extends a {
|
|
|
37
37
|
this[t],
|
|
38
38
|
t
|
|
39
39
|
);
|
|
40
|
-
|
|
41
|
-
switch (this[t] = o, t) {
|
|
42
|
-
case "zIndex":
|
|
43
|
-
o === 100 ? this.style.removeProperty("--l-mask-zindex") : this.style.setProperty("--l-mask-zindex", o);
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
40
|
+
o !== this[t] && (this[t] = o, t === "zIndex" && (o === 100 ? this.style.removeProperty("--l-mask-zindex") : this.style.setProperty("--l-mask-zindex", o)));
|
|
46
41
|
}
|
|
47
42
|
render() {
|
|
48
43
|
const t = document.createDocumentFragment(), e = n("div", {
|
package/lib/message/index.d.ts
CHANGED
|
@@ -11,15 +11,14 @@ interface MessageOption {
|
|
|
11
11
|
/** 自定义类名 */
|
|
12
12
|
customClass?: string;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
success: (
|
|
19
|
-
error: (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default Message;
|
|
14
|
+
/** 关闭消息 */
|
|
15
|
+
declare function close(id: string): void;
|
|
16
|
+
declare const _default: {
|
|
17
|
+
info: (options: string | MessageOption) => string;
|
|
18
|
+
success: (options: string | MessageOption) => string;
|
|
19
|
+
error: (options: string | MessageOption) => string;
|
|
20
|
+
warn: (options: string | MessageOption) => string;
|
|
21
|
+
show: (options: string | MessageOption) => string;
|
|
22
|
+
close: typeof close;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
package/lib/message/index.js
CHANGED
|
@@ -1,67 +1,66 @@
|
|
|
1
|
-
import { regist as
|
|
2
|
-
import { transition as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
const
|
|
1
|
+
import { regist as g, useId as y } from "../utils/index.js";
|
|
2
|
+
import { transition as m } from "ph-utils/dom";
|
|
3
|
+
import p from "../icon/close_filled.js";
|
|
4
|
+
import h from "../icon/success.js";
|
|
5
|
+
import $ from "../icon/warn.js";
|
|
6
|
+
import x from "../icon/info.js";
|
|
7
|
+
const r = [], d = [
|
|
8
8
|
["opacity", "0", "0.3s"],
|
|
9
9
|
["transform", "translate3d(-50%, -100%, 0)", "0.3s"]
|
|
10
10
|
];
|
|
11
|
-
let
|
|
12
|
-
function
|
|
13
|
-
const t =
|
|
11
|
+
let l = !0;
|
|
12
|
+
function u(e) {
|
|
13
|
+
const t = r.findIndex((o) => o.id === e);
|
|
14
14
|
if (t === -1) return;
|
|
15
|
-
const s =
|
|
15
|
+
const s = r.splice(t, 1)[0];
|
|
16
16
|
if (s == null) return;
|
|
17
|
-
|
|
17
|
+
m(s, d, "leave", () => {
|
|
18
18
|
s.remove();
|
|
19
19
|
});
|
|
20
|
-
const
|
|
20
|
+
const i = 15 + s.offsetHeight, n = r.length;
|
|
21
21
|
if (n !== 0)
|
|
22
22
|
for (let o = t; o < n; o++) {
|
|
23
|
-
const
|
|
24
|
-
|
|
23
|
+
const a = r[o], f = parseInt(a.style.top, 10) - i;
|
|
24
|
+
a.style.setProperty("top", `${f}px`);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function v(e) {
|
|
28
28
|
const t = document.createElement("div");
|
|
29
29
|
t.id = e.id;
|
|
30
30
|
const s = e.type || "info";
|
|
31
|
-
let
|
|
32
|
-
e.customClass && (
|
|
31
|
+
let i = `l-message l-message-${s}`;
|
|
32
|
+
e.customClass && (i += " " + e.customClass), t.className = i, t.style.setProperty("top", `${e.offset}px`), t.style.setProperty("z-index", `${e.zindex || 1e3}`), e.width && t.style.setProperty("width", e.width);
|
|
33
33
|
let n = s;
|
|
34
|
-
return n === "error" && (n = "
|
|
34
|
+
return n === "error" && (n = "close-filled"), t.innerHTML = [
|
|
35
35
|
'<div class="l-message-container">',
|
|
36
36
|
`<l-${n}-icon class="l-message-icon"></l-${n}-icon>`,
|
|
37
37
|
`<span class="l-message-content">${e.message}</span>`,
|
|
38
38
|
"</div>"
|
|
39
39
|
].join(""), t;
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
const t =
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
),
|
|
47
|
-
|
|
48
|
-
const n = x(r);
|
|
49
|
-
c.push(n), document.body.appendChild(n), d(n, u, "enter");
|
|
50
|
-
let o = r.duration;
|
|
41
|
+
const w = ((e) => {
|
|
42
|
+
l && (g([p, h, $, x]), l = !1);
|
|
43
|
+
const t = r.reduce((a, f) => a + f.offsetHeight + 15, 15), s = y(), i = typeof e == "string" ? { message: e } : e;
|
|
44
|
+
i.id = s, i.offset = t;
|
|
45
|
+
const n = v(i);
|
|
46
|
+
r.push(n), document.body.appendChild(n), m(n, d, "enter");
|
|
47
|
+
let o = i.duration;
|
|
51
48
|
return o == null && (o = 3e3), o !== 0 && setTimeout(() => {
|
|
52
|
-
|
|
49
|
+
u(s);
|
|
53
50
|
}, o), s;
|
|
54
|
-
};
|
|
55
|
-
function
|
|
51
|
+
});
|
|
52
|
+
function c(e, t = "info") {
|
|
56
53
|
const s = typeof e == "string" ? { message: e } : e;
|
|
57
|
-
return s.type || (s.type = t),
|
|
54
|
+
return s.type || (s.type = t), w(s);
|
|
58
55
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
56
|
+
const F = {
|
|
57
|
+
info: (e) => c(e, "info"),
|
|
58
|
+
success: (e) => c(e, "success"),
|
|
59
|
+
error: (e) => c(e, "error"),
|
|
60
|
+
warn: (e) => c(e, "warn"),
|
|
61
|
+
show: (e) => c(e),
|
|
62
|
+
close: u
|
|
63
|
+
};
|
|
65
64
|
export {
|
|
66
|
-
|
|
65
|
+
F as default
|
|
67
66
|
};
|