litos-ui 0.12.2 → 0.14.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/base.d.ts +23 -2
- package/lib/base.js +37 -8
- package/lib/button/index.d.ts +3 -1
- package/lib/button/index.js +18 -19
- package/lib/carousel/index.d.ts +20 -0
- package/lib/carousel/index.js +280 -0
- package/lib/carousel/item.d.ts +6 -0
- package/lib/carousel/item.js +15 -0
- package/lib/carousel/timer.d.ts +5 -0
- package/lib/carousel/timer.js +19 -0
- package/lib/check/check.d.ts +22 -0
- package/lib/check/check.js +81 -0
- package/lib/check/checkbox.d.ts +7 -0
- package/lib/check/checkbox.js +25 -0
- package/lib/check/checkbox_group.d.ts +9 -0
- package/lib/check/checkbox_group.js +33 -0
- package/lib/check/index.d.ts +12 -0
- package/lib/check/index.js +35 -0
- package/lib/check/radio.d.ts +6 -0
- package/lib/check/radio.js +19 -0
- package/lib/check/radio_group.d.ts +6 -0
- package/lib/check/radio_group.js +24 -0
- package/lib/check-BlDsQQo0.js +4 -0
- package/lib/color_picker/index.d.ts +1 -1
- package/lib/color_picker/index.js +6 -6
- package/lib/date_picker/index.d.ts +22 -0
- package/lib/date_picker/index.js +99 -0
- package/lib/dialog/dialog_container.d.ts +28 -0
- package/lib/dialog/dialog_container.js +100 -0
- package/lib/dialog/index.d.ts +30 -0
- package/lib/dialog/index.js +86 -0
- package/lib/form/form_inner.d.ts +3 -5
- package/lib/form/form_inner.js +29 -31
- package/lib/form/form_item.d.ts +1 -3
- package/lib/form/form_item.js +30 -41
- package/lib/form/index.d.ts +0 -2
- package/lib/form/index.js +23 -25
- package/lib/icon/base.d.ts +0 -1
- package/lib/icon/base.js +15 -17
- package/lib/icon/close.d.ts +5 -0
- package/lib/icon/close.js +10 -0
- package/lib/icon/{mask_close.d.ts → close_filled.d.ts} +1 -1
- package/lib/icon/{mask_close.js → close_filled.js} +1 -1
- package/lib/index-dwS1N2uN.js +4 -0
- package/lib/index.d.ts +40 -6
- package/lib/index.js +120 -87
- package/lib/input/index.d.ts +6 -5
- package/lib/input/index.js +105 -57
- package/lib/list/index.d.ts +2 -3
- package/lib/list/index.js +17 -17
- package/lib/litos-ui.css +1 -1
- package/lib/loading/index.d.ts +45 -0
- package/lib/loading/index.js +141 -0
- package/lib/md_input/index.js +9 -9
- package/lib/menu/base.js +1 -0
- package/lib/menu/index.d.ts +31 -0
- package/lib/menu/index.js +95 -0
- package/lib/menu/menu_item.d.ts +6 -0
- package/lib/menu/menu_item.js +21 -0
- package/lib/menu/sub_menu.d.ts +15 -0
- package/lib/menu/sub_menu.js +82 -0
- package/lib/message/index.js +1 -1
- package/lib/modal/index.d.ts +40 -0
- package/lib/modal/index.js +153 -0
- package/lib/modal/modal_box.js +95 -0
- package/lib/popover/index.d.ts +1 -4
- package/lib/popover/index.js +6 -12
- package/lib/select_ori/index.d.ts +1 -3
- package/lib/select_ori/index.js +12 -16
- package/lib/switch/index.d.ts +0 -1
- package/lib/switch/index.js +8 -13
- package/lib/tabbar/index.d.ts +0 -1
- package/lib/tabbar/index.js +55 -63
- package/lib/theme/index.d.ts +1 -2
- package/lib/theme/index.js +9 -12
- package/lib/utils/index.d.ts +1 -6
- package/lib/utils/index.js +47 -54
- package/lib/utils/transition.js +4 -2
- package/package.json +8 -8
- package/styles/vars.css +1 -1
- package/lib/checkbox/index.d.ts +0 -17
- package/lib/checkbox/index.js +0 -135
- package/lib/index-391POYEJ.js +0 -4
- package/lib/litos-ui.min.js +0 -1
- package/lib/radio/index.d.ts +0 -28
- package/lib/radio/index.js +0 -122
package/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ export { default as BaseComponent } from "./base";
|
|
|
4
4
|
export { default as Message } from "./message";
|
|
5
5
|
export { default as Popover } from "./popover";
|
|
6
6
|
export { default as Popconfirm } from "./popconfirm";
|
|
7
|
+
export { default as Dialog } from "./dialog";
|
|
8
|
+
export { default as DialogContainer } from "./dialog/dialog_container";
|
|
9
|
+
export { default as Loading } from "./loading";
|
|
10
|
+
export { default as Modal } from "./modal";
|
|
7
11
|
export { default as BaseIcon } from "./icon/base";
|
|
8
12
|
export { default as ArrowDownIcon } from "./icon/arrow_down";
|
|
9
13
|
export { default as ArrowLeftIcon } from "./icon/arrow_left";
|
|
@@ -21,27 +25,44 @@ export { default as RefreshLeftIcon } from "./icon/refresh_left";
|
|
|
21
25
|
export { default as RefreshRightIcon } from "./icon/refresh_right";
|
|
22
26
|
export { default as SortIcon } from "./icon/sort";
|
|
23
27
|
export { default as ThemeDefaultIcon } from "./icon/theme_default";
|
|
28
|
+
export { default as CloseIcon } from "./icon/close";
|
|
29
|
+
export { default as InfoIcon } from "./icon/info";
|
|
30
|
+
export { default as SuccessIcon } from "./icon/success";
|
|
31
|
+
export { default as WarnIcon } from "./icon/warn";
|
|
32
|
+
export { default as CloseFilledIcon } from "./icon/close_filled";
|
|
24
33
|
export { default as Form } from "./form";
|
|
25
34
|
export { default as FormItem } from "./form/form_item";
|
|
26
|
-
export { default as
|
|
27
|
-
export { default as
|
|
35
|
+
export { default as RadioGroup } from "./check/radio_group";
|
|
36
|
+
export { default as Radio } from "./check/radio";
|
|
37
|
+
export { default as Checkbox } from "./check/checkbox";
|
|
38
|
+
export { default as CheckboxGroup } from "./check/checkbox_group";
|
|
28
39
|
export { default as Button } from "./button";
|
|
29
40
|
export { default as Input } from "./input";
|
|
30
41
|
export { default as SelectOri } from "./select_ori";
|
|
31
42
|
export { default as Switch } from "./switch";
|
|
43
|
+
export { default as MdInput } from "./md_input";
|
|
32
44
|
export { default as List } from "./list";
|
|
33
45
|
export { default as Polygon } from "./polygon";
|
|
34
46
|
export { default as ColorPicker } from "./color_picker";
|
|
35
47
|
export { default as Tabbar } from "./tabbar";
|
|
36
48
|
export { default as Theme } from "./theme";
|
|
37
49
|
export { default as ThemeColor } from "./theme/theme_color";
|
|
38
|
-
export { default as
|
|
50
|
+
export { default as DatePicker } from "./date_picker";
|
|
51
|
+
export { default as Menu } from "./menu";
|
|
52
|
+
export { default as MenuItem } from "./menu/menu_item";
|
|
53
|
+
export { default as SubMenu } from "./menu/sub_menu";
|
|
54
|
+
export { default as Carousel } from "./carousel";
|
|
55
|
+
export { default as CarouselItem } from "./carousel/item";
|
|
39
56
|
|
|
40
57
|
declare global {
|
|
41
58
|
interface HTMLElementTagNameMap {
|
|
42
59
|
"l-base-component": import("./base").default
|
|
43
60
|
"l-popover": import("./popover").default
|
|
44
61
|
"l-popconfirm": import("./popconfirm").default
|
|
62
|
+
"l-dialog": import("./dialog").default
|
|
63
|
+
"l-dialog-container": import("./dialog/dialog_container").default
|
|
64
|
+
"l-loading": import("./loading").default
|
|
65
|
+
"l-modal": import("./modal").default
|
|
45
66
|
"l-base-icon": import("./icon/base").default
|
|
46
67
|
"l-arrow-down-icon": import("./icon/arrow_down").default
|
|
47
68
|
"l-arrow-left-icon": import("./icon/arrow_left").default
|
|
@@ -59,20 +80,33 @@ declare global {
|
|
|
59
80
|
"l-refresh-right-icon": import("./icon/refresh_right").default
|
|
60
81
|
"l-sort-icon": import("./icon/sort").default
|
|
61
82
|
"l-theme-default-icon": import("./icon/theme_default").default
|
|
83
|
+
"l-close-icon": import("./icon/close").default
|
|
84
|
+
"l-info-icon": import("./icon/info").default
|
|
85
|
+
"l-success-icon": import("./icon/success").default
|
|
86
|
+
"l-warn-icon": import("./icon/warn").default
|
|
87
|
+
"l-close-filled-icon": import("./icon/close_filled").default
|
|
62
88
|
"l-form": import("./form").default
|
|
63
89
|
"l-form-item": import("./form/form_item").default
|
|
64
|
-
"l-radio": import("./
|
|
65
|
-
"l-
|
|
90
|
+
"l-radio-group": import("./check/radio_group").default
|
|
91
|
+
"l-radio": import("./check/radio").default
|
|
92
|
+
"l-checkbox": import("./check/checkbox").default
|
|
93
|
+
"l-checkbox-group": import("./check/checkbox_group").default
|
|
66
94
|
"l-button": import("./button").default
|
|
67
95
|
"l-input": import("./input").default
|
|
68
96
|
"l-select-ori": import("./select_ori").default
|
|
69
97
|
"l-switch": import("./switch").default
|
|
98
|
+
"l-md-input": import("./md_input").default
|
|
70
99
|
"l-list": import("./list").default
|
|
71
100
|
"l-polygon": import("./polygon").default
|
|
72
101
|
"l-color-picker": import("./color_picker").default
|
|
73
102
|
"l-tabbar": import("./tabbar").default
|
|
74
103
|
"l-theme": import("./theme").default
|
|
75
104
|
"l-theme-color": import("./theme/theme_color").default
|
|
76
|
-
"l-
|
|
105
|
+
"l-date-picker": import("./date_picker").default
|
|
106
|
+
"l-menu": import("./menu").default
|
|
107
|
+
"l-menu-item": import("./menu/menu_item").default
|
|
108
|
+
"l-sub-menu": import("./menu/sub_menu").default
|
|
109
|
+
"l-carousel": import("./carousel").default
|
|
110
|
+
"l-carousel-item": import("./carousel/item").default
|
|
77
111
|
}
|
|
78
112
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,90 +1,123 @@
|
|
|
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
|
|
1
|
+
import { createTransition as t, getPopoverOffsetX as r, getPopoverOffsetY as a, impactDetect as f, initAttr as s, parseAttrValue as u, regist as l, setAttrs as m, tagAttr as p, tagAttrs as d, useId as x } from "./utils/index.js";
|
|
2
|
+
import { set as c, remove as I } from "./utils/clickoutside.js";
|
|
3
|
+
import { default as C } from "./base.js";
|
|
4
|
+
import { default as h } from "./message/index.js";
|
|
5
|
+
import { default as M } from "./popover/index.js";
|
|
6
|
+
import { default as R } from "./popconfirm/index.js";
|
|
7
|
+
import { default as k } from "./dialog/index.js";
|
|
8
|
+
import { default as D } from "./dialog/dialog_container.js";
|
|
9
|
+
import { default as b } from "./loading/index.js";
|
|
10
|
+
import { default as L } from "./modal/index.js";
|
|
11
|
+
import { default as B } from "./icon/base.js";
|
|
12
|
+
import { default as G } from "./icon/arrow_down.js";
|
|
13
|
+
import { default as U } from "./icon/arrow_left.js";
|
|
14
|
+
import { default as W } from "./icon/arrow_right.js";
|
|
15
|
+
import { default as Y } from "./icon/arrow_up.js";
|
|
16
|
+
import { default as q } from "./icon/caret_top.js";
|
|
17
|
+
import { default as E } from "./icon/caret_bottom.js";
|
|
18
|
+
import { default as J } from "./icon/font_icon.js";
|
|
19
|
+
import { default as N } from "./icon/loading.js";
|
|
20
|
+
import { default as Z } from "./icon/search.js";
|
|
21
|
+
import { default as $ } from "./icon/sun.js";
|
|
22
|
+
import { default as eo } from "./icon/moon.js";
|
|
23
|
+
import { default as ro } from "./icon/reduction.js";
|
|
24
|
+
import { default as fo } from "./icon/refresh_left.js";
|
|
25
|
+
import { default as uo } from "./icon/refresh_right.js";
|
|
26
|
+
import { default as mo } from "./icon/sort.js";
|
|
27
|
+
import { default as xo } from "./icon/theme_default.js";
|
|
28
|
+
import { default as co } from "./icon/close.js";
|
|
29
|
+
import { default as io } from "./icon/info.js";
|
|
30
|
+
import { default as go } from "./icon/success.js";
|
|
31
|
+
import { default as Ao } from "./icon/warn.js";
|
|
32
|
+
import { default as Po } from "./icon/close_filled.js";
|
|
33
|
+
import { default as So } from "./form/index.js";
|
|
34
|
+
import { default as wo } from "./form/form_item.js";
|
|
35
|
+
import { default as To } from "./check/radio_group.js";
|
|
36
|
+
import { default as vo } from "./check/radio.js";
|
|
37
|
+
import { default as Oo } from "./check/checkbox.js";
|
|
38
|
+
import { default as Fo } from "./check/checkbox_group.js";
|
|
39
|
+
import { default as yo } from "./button/index.js";
|
|
40
|
+
import { default as Vo } from "./input/index.js";
|
|
41
|
+
import { default as Xo } from "./select_ori/index.js";
|
|
42
|
+
import { default as jo } from "./switch/index.js";
|
|
43
|
+
import { default as zo } from "./md_input/index.js";
|
|
44
|
+
import { default as Ho } from "./list/index.js";
|
|
45
|
+
import { default as Ko } from "./polygon/index.js";
|
|
46
|
+
import { default as Qo } from "./color_picker/index.js";
|
|
47
|
+
import { default as _o } from "./tabbar/index.js";
|
|
48
|
+
import { default as oe } from "./theme/index.js";
|
|
49
|
+
import { default as te } from "./theme/theme_color.js";
|
|
50
|
+
import { default as ae } from "./date_picker/index.js";
|
|
51
|
+
import { default as se } from "./menu/index.js";
|
|
52
|
+
import { default as le } from "./menu/menu_item.js";
|
|
53
|
+
import { default as pe } from "./menu/sub_menu.js";
|
|
54
|
+
import { default as xe } from "./carousel/index.js";
|
|
55
|
+
import { default as ce } from "./carousel/item.js";
|
|
39
56
|
export {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
57
|
+
G as ArrowDownIcon,
|
|
58
|
+
U as ArrowLeftIcon,
|
|
59
|
+
W as ArrowRightIcon,
|
|
60
|
+
Y as ArrowUpIcon,
|
|
61
|
+
C as BaseComponent,
|
|
62
|
+
B as BaseIcon,
|
|
63
|
+
yo as Button,
|
|
64
|
+
E as CaretBottomIcon,
|
|
65
|
+
q as CaretTopIcon,
|
|
66
|
+
xe as Carousel,
|
|
67
|
+
ce as CarouselItem,
|
|
68
|
+
Oo as Checkbox,
|
|
69
|
+
Fo as CheckboxGroup,
|
|
70
|
+
Po as CloseFilledIcon,
|
|
71
|
+
co as CloseIcon,
|
|
72
|
+
Qo as ColorPicker,
|
|
73
|
+
ae as DatePicker,
|
|
74
|
+
k as Dialog,
|
|
75
|
+
D as DialogContainer,
|
|
76
|
+
J as FontIcon,
|
|
77
|
+
So as Form,
|
|
78
|
+
wo as FormItem,
|
|
79
|
+
io as InfoIcon,
|
|
80
|
+
Vo as Input,
|
|
81
|
+
Ho as List,
|
|
82
|
+
b as Loading,
|
|
83
|
+
N as LoadingIcon,
|
|
84
|
+
zo as MdInput,
|
|
85
|
+
se as Menu,
|
|
86
|
+
le as MenuItem,
|
|
87
|
+
h as Message,
|
|
88
|
+
L as Modal,
|
|
89
|
+
eo as MoonIcon,
|
|
90
|
+
Ko as Polygon,
|
|
91
|
+
R as Popconfirm,
|
|
92
|
+
M as Popover,
|
|
93
|
+
vo as Radio,
|
|
94
|
+
To as RadioGroup,
|
|
95
|
+
ro as ReductionIcon,
|
|
96
|
+
fo as RefreshLeftIcon,
|
|
97
|
+
uo as RefreshRightIcon,
|
|
98
|
+
Z as SearchIcon,
|
|
99
|
+
Xo as SelectOri,
|
|
100
|
+
mo as SortIcon,
|
|
101
|
+
pe as SubMenu,
|
|
102
|
+
go as SuccessIcon,
|
|
103
|
+
$ as SunIcon,
|
|
104
|
+
jo as Switch,
|
|
105
|
+
_o as Tabbar,
|
|
106
|
+
oe as Theme,
|
|
107
|
+
te as ThemeColor,
|
|
108
|
+
xo as ThemeDefaultIcon,
|
|
109
|
+
Ao as WarnIcon,
|
|
110
|
+
c as addClickOutside,
|
|
111
|
+
t as createTransition,
|
|
112
|
+
r as getPopoverOffsetX,
|
|
113
|
+
a as getPopoverOffsetY,
|
|
114
|
+
f as impactDetect,
|
|
115
|
+
s as initAttr,
|
|
116
|
+
u as parseAttrValue,
|
|
117
|
+
l as regist,
|
|
85
118
|
I as removeClickOutside,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
119
|
+
m as setAttrs,
|
|
120
|
+
p as tagAttr,
|
|
121
|
+
d as tagAttrs,
|
|
122
|
+
x as useId
|
|
90
123
|
};
|
package/lib/input/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import FormInner from "../form/form_inner";
|
|
|
13
13
|
* @method focus - 输入框获取焦点
|
|
14
14
|
*/
|
|
15
15
|
export default class Input extends FormInner {
|
|
16
|
+
#private;
|
|
16
17
|
static baseName: string;
|
|
17
18
|
/** 原生 input 的 type */
|
|
18
19
|
type: string;
|
|
@@ -27,23 +28,23 @@ export default class Input extends FormInner {
|
|
|
27
28
|
/** 宽度铺满 */
|
|
28
29
|
block: boolean;
|
|
29
30
|
error: boolean;
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
/** clearable */
|
|
32
|
+
clearable: boolean;
|
|
33
|
+
$inner?: HTMLInputElement;
|
|
32
34
|
set value(value: any);
|
|
33
35
|
get value(): any;
|
|
34
36
|
static get observedAttributes(): string[];
|
|
35
37
|
connectedCallback(): void;
|
|
36
38
|
disconnectedCallback(): void;
|
|
37
39
|
protected attributeChange(name: string, oldValue: string, newValue: string): void;
|
|
38
|
-
render():
|
|
40
|
+
render(): DocumentFragment;
|
|
39
41
|
/**
|
|
40
42
|
* 设置自定义的输入解析器
|
|
41
43
|
* @param cb
|
|
42
44
|
*/
|
|
43
45
|
setParser(cb: (value: string) => string): void;
|
|
44
|
-
focus(): void;
|
|
45
46
|
_input: (e: Event) => void;
|
|
46
|
-
|
|
47
|
+
disabledChange(): void;
|
|
47
48
|
private _numberInputParse;
|
|
48
49
|
private _getStyleObj;
|
|
49
50
|
private _isBlock;
|
package/lib/input/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { initAttr as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { i as
|
|
6
|
-
class
|
|
1
|
+
import { $one as h, on as a, formatStyle as p, addClass as o, off as u, $ as d, $$ as n, removeClass as f } from "ph-utils/dom";
|
|
2
|
+
import { initAttr as c, parseAttrValue as m } from "../utils/index.js";
|
|
3
|
+
import b from "../form/form_inner.js";
|
|
4
|
+
import { add as g, remove as v } from "../utils/event.js";
|
|
5
|
+
import { i as C } from "../index-dwS1N2uN.js";
|
|
6
|
+
class y extends b {
|
|
7
7
|
static baseName = "input";
|
|
8
8
|
/** 原生 input 的 type */
|
|
9
9
|
type = "text";
|
|
@@ -18,12 +18,11 @@ class S extends v {
|
|
|
18
18
|
/** 宽度铺满 */
|
|
19
19
|
block = !1;
|
|
20
20
|
error = !1;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this.setValue(e), this.$input != null && (this.$input.value = this.value);
|
|
21
|
+
/** clearable */
|
|
22
|
+
clearable = !1;
|
|
23
|
+
$inner;
|
|
24
|
+
set value(t) {
|
|
25
|
+
this.setValue(t), this.$inner && (this.$inner.value = t);
|
|
27
26
|
}
|
|
28
27
|
get value() {
|
|
29
28
|
return this.getValue();
|
|
@@ -32,83 +31,132 @@ class S extends v {
|
|
|
32
31
|
return ["disabled", "error"];
|
|
33
32
|
}
|
|
34
33
|
connectedCallback() {
|
|
35
|
-
|
|
34
|
+
c(this), this.loadStyleText([C]), super.connectedCallback(), this.$inner = h(".l-input__inner", this.root), a(this.$inner, "input", this._input), a(this.$inner, "change", this.#i), this.style.cssText = p(this._getStyleObj()) + this.getAttr("style", ""), this.error && o(this, "is-error"), this.getName() && this.formAttrs.id && g(this.formAttrs.id, "validateChange", this._validateChange);
|
|
36
35
|
}
|
|
37
36
|
disconnectedCallback() {
|
|
38
|
-
super.disconnectedCallback(), this.formAttrs.id &&
|
|
37
|
+
super.disconnectedCallback(), this.formAttrs.id && v(this.formAttrs.id, "validateChange", this._validateChange), u(this.$inner, "input", this._input);
|
|
39
38
|
}
|
|
40
|
-
attributeChange(
|
|
41
|
-
if (
|
|
42
|
-
const
|
|
43
|
-
|
|
39
|
+
attributeChange(t, i, e) {
|
|
40
|
+
if (t === "error") {
|
|
41
|
+
const s = m(e, !1, t);
|
|
42
|
+
s !== this.error && (this.error = s, this._updateError());
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
render() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
const t = document.createDocumentFragment();
|
|
47
|
+
if (d('[slot="prefix"]', this).length > 0) {
|
|
48
|
+
const r = n("slot", {
|
|
49
|
+
name: "prefix"
|
|
50
|
+
}), l = n("span", {
|
|
51
|
+
class: "l-input__prefix",
|
|
52
|
+
part: "prefix"
|
|
53
|
+
});
|
|
54
|
+
l.appendChild(r), t.appendChild(l);
|
|
55
|
+
}
|
|
56
|
+
const e = n("input", {
|
|
57
|
+
class: "l-input__inner",
|
|
58
|
+
value: this.value,
|
|
59
|
+
name: this.getName(),
|
|
60
|
+
placeholder: this.placeholder,
|
|
61
|
+
disabled: this.isDisabled(),
|
|
62
|
+
part: "default",
|
|
63
|
+
type: this.type
|
|
64
|
+
});
|
|
65
|
+
if (t.appendChild(e), d('[slot="suffix"]', this).length > 0) {
|
|
66
|
+
const r = n("slot", {
|
|
67
|
+
name: "suffix"
|
|
68
|
+
}), l = n("span", {
|
|
69
|
+
class: "l-input__suffix",
|
|
70
|
+
part: "suffix"
|
|
71
|
+
});
|
|
72
|
+
l.appendChild(r), t.appendChild(l);
|
|
73
|
+
}
|
|
74
|
+
return t;
|
|
54
75
|
}
|
|
55
76
|
/**
|
|
56
77
|
* 设置自定义的输入解析器
|
|
57
78
|
* @param cb
|
|
58
79
|
*/
|
|
59
|
-
setParser(
|
|
60
|
-
this.parser =
|
|
80
|
+
setParser(t) {
|
|
81
|
+
this.parser = t;
|
|
61
82
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
_input = (e) => {
|
|
66
|
-
const s = e.target;
|
|
67
|
-
let t = s.value;
|
|
83
|
+
_input = (t) => {
|
|
84
|
+
const i = t.target;
|
|
85
|
+
let e = i.value;
|
|
68
86
|
if (this.allowInput != null) {
|
|
69
|
-
let
|
|
70
|
-
|
|
87
|
+
let s = this.allowInput.indexOf("."), r = s === -1 ? s : parseInt(this.allowInput.substring(s + 1));
|
|
88
|
+
e = this._numberInputParse(e, {
|
|
71
89
|
integer: this.allowInput.includes("integer"),
|
|
72
90
|
negative: this.allowInput.startsWith("-"),
|
|
73
91
|
precition: r
|
|
74
|
-
}),
|
|
92
|
+
}), e = String(e), i.value = e;
|
|
75
93
|
}
|
|
76
|
-
this.parser != null && (
|
|
94
|
+
this.parser != null && (e = this.parser(e), i.value = e), this.setValue(e), this.#t();
|
|
77
95
|
};
|
|
78
|
-
|
|
79
|
-
|
|
96
|
+
#t() {
|
|
97
|
+
if (this.clearable) {
|
|
98
|
+
let t = h(".l-clearable", this.root);
|
|
99
|
+
if (this.value.length > 0) {
|
|
100
|
+
if (t == null) {
|
|
101
|
+
t = n("span", {
|
|
102
|
+
class: "l-input__suffix l-clearable"
|
|
103
|
+
});
|
|
104
|
+
const i = n("l-close-filled-icon");
|
|
105
|
+
t.appendChild(i), this.root.appendChild(t), a(t, "click", this.#e);
|
|
106
|
+
}
|
|
107
|
+
} else
|
|
108
|
+
t && (u(t, "click", this.#e), t.remove());
|
|
109
|
+
}
|
|
80
110
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
111
|
+
#e = () => {
|
|
112
|
+
this.value = "", this.dispatchEvent(
|
|
113
|
+
new CustomEvent("input", { bubbles: !0, detail: { value: this.value } })
|
|
114
|
+
), this.#t();
|
|
115
|
+
};
|
|
116
|
+
disabledChange() {
|
|
117
|
+
this.isDisabled() ? this.classList.add("is-disabled") : this.classList.remove("is-disabled"), this.$inner && (this.$inner.disabled = this.isDisabled());
|
|
118
|
+
}
|
|
119
|
+
_numberInputParse(t, i) {
|
|
120
|
+
let e = t, s = i.negative ? "-?" : "";
|
|
121
|
+
if (i.integer) {
|
|
122
|
+
const l = e.match(new RegExp(`^(${s}\\d*)`));
|
|
123
|
+
return l != null ? l[1] : e.substring(0, e.length - 1);
|
|
86
124
|
}
|
|
87
|
-
const r =
|
|
125
|
+
const r = e.match(
|
|
88
126
|
new RegExp(
|
|
89
|
-
`(${
|
|
127
|
+
`(${s}\\d+\\.\\d{0,${i.precition}})|(${s}\\d*)`
|
|
90
128
|
)
|
|
91
129
|
);
|
|
92
|
-
return r != null ?
|
|
130
|
+
return r != null ? e = r[1] || r[2] : e = "", r != null ? r[1] || r[2] : "";
|
|
93
131
|
}
|
|
94
132
|
_getStyleObj() {
|
|
95
|
-
const
|
|
96
|
-
return this._isBlock() && (
|
|
133
|
+
const t = {};
|
|
134
|
+
return this._isBlock() && (t["--l-input-width"] = "100%"), this.width && (t["--l-input-width"] = this.width), t;
|
|
97
135
|
}
|
|
98
136
|
_isBlock() {
|
|
99
|
-
|
|
137
|
+
return this.block === !0 || this.formItemAttrs.innerBlock === !0 || this.formAttrs.innerBlock === !0;
|
|
100
138
|
}
|
|
101
139
|
_updateError() {
|
|
102
|
-
this
|
|
140
|
+
this.error ? o(this, "is-error") : f(this, "is-error");
|
|
103
141
|
}
|
|
104
|
-
_validateChange = (
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
(
|
|
142
|
+
_validateChange = (t, i) => {
|
|
143
|
+
const e = this.getName();
|
|
144
|
+
if (e) {
|
|
145
|
+
const s = t === !0 ? !1 : t[e] != null;
|
|
146
|
+
(i == null || i === e && this.error != s) && (this.error = s, this._updateError()), Object.keys(t)[0] === e && this.focus();
|
|
109
147
|
}
|
|
110
148
|
};
|
|
149
|
+
#i = (t) => {
|
|
150
|
+
const i = t.target;
|
|
151
|
+
this.dispatchEvent(
|
|
152
|
+
new CustomEvent("change", {
|
|
153
|
+
bubbles: !0,
|
|
154
|
+
composed: !0,
|
|
155
|
+
detail: { value: i.value }
|
|
156
|
+
})
|
|
157
|
+
);
|
|
158
|
+
};
|
|
111
159
|
}
|
|
112
160
|
export {
|
|
113
|
-
|
|
161
|
+
y as default
|
|
114
162
|
};
|
package/lib/list/index.d.ts
CHANGED
|
@@ -6,14 +6,13 @@ export default class List extends BaseComponent {
|
|
|
6
6
|
/** 是否显示无限加载模式 */
|
|
7
7
|
infinite: boolean;
|
|
8
8
|
private observer?;
|
|
9
|
-
private loadMoreEmit;
|
|
10
9
|
private $more?;
|
|
11
|
-
|
|
10
|
+
private _page;
|
|
12
11
|
static get observedAttributes(): string[] | null | undefined;
|
|
13
12
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
14
13
|
connectedCallback(): void;
|
|
15
14
|
disconnectedCallback(): void;
|
|
16
15
|
render(): string;
|
|
17
|
-
_loadingText(): "
|
|
16
|
+
_loadingText(): "加载中……" | "已经到底啦!";
|
|
18
17
|
_finishChange(): void;
|
|
19
18
|
}
|
package/lib/list/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import r from "../base.js";
|
|
2
|
-
import {
|
|
3
|
-
import { $one as
|
|
4
|
-
import { a } from "../animation-DttknHkX.js";
|
|
5
|
-
const
|
|
2
|
+
import { parseAttrValue as n } from "../utils/index.js";
|
|
3
|
+
import { $one as s } from "ph-utils/dom";
|
|
4
|
+
import { a as l } from "../animation-DttknHkX.js";
|
|
5
|
+
const a = ":host{display:block;overflow:auto;-webkit-overflow-scrolling:touch;height:100%;position:relative}.l-list-loadmore{padding:10px;display:flex;align-items:center;justify-content:center;color:#999}.l-list-icon{font-size:24px;margin-right:10px;transform:rotate3d(0,0,1,80deg)}";
|
|
6
6
|
class b extends r {
|
|
7
7
|
static baseName = "list";
|
|
8
8
|
/** 是否已经全部加载完成 */
|
|
@@ -10,27 +10,27 @@ class b extends r {
|
|
|
10
10
|
/** 是否显示无限加载模式 */
|
|
11
11
|
infinite = !0;
|
|
12
12
|
observer;
|
|
13
|
-
loadMoreEmit;
|
|
14
13
|
$more;
|
|
15
|
-
|
|
16
|
-
super(), n(this), this.loadMoreEmit = new CustomEvent("load-more");
|
|
17
|
-
}
|
|
14
|
+
_page = 0;
|
|
18
15
|
static get observedAttributes() {
|
|
19
|
-
return ["finish"];
|
|
16
|
+
return ["finish", "infinite"];
|
|
20
17
|
}
|
|
21
18
|
attributeChangedCallback(i, t, o) {
|
|
22
19
|
if (i === "finish") {
|
|
23
|
-
const
|
|
24
|
-
this.finish !==
|
|
20
|
+
const e = n(o, !1, i);
|
|
21
|
+
this.finish !== e && (this.finish = e, this._finishChange());
|
|
22
|
+
} else if (i === "infinite") {
|
|
23
|
+
const e = n(o, !0, i);
|
|
24
|
+
this.infinite !== e && (this.infinite = e);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
connectedCallback() {
|
|
28
|
-
this.loadStyleText([
|
|
29
|
-
i[0].isIntersecting && !this.finish && this.
|
|
30
|
-
}), this.$more =
|
|
28
|
+
this.loadStyleText([a, l]), super.connectedCallback(), this.infinite && (this.observer = new IntersectionObserver((i) => {
|
|
29
|
+
i[0].isIntersecting && !this.finish && (this._page++, this.setAttribute("loading", ""), this.emit("load", { detail: { page: this._page } }));
|
|
30
|
+
}), this.$more = s(".l-list-loadmore", this.root), !this.finish && this.$more && this.observer.observe(this.$more));
|
|
31
31
|
}
|
|
32
32
|
disconnectedCallback() {
|
|
33
|
-
super.disconnectedCallback(), this.observer && (this.$more && (this.observer.unobserve(this.$more), this.$more = void 0), this.observer.disconnect(), this.observer = void 0)
|
|
33
|
+
super.disconnectedCallback(), this.observer && (this.$more && (this.observer.unobserve(this.$more), this.$more = void 0), this.observer.disconnect(), this.observer = void 0);
|
|
34
34
|
}
|
|
35
35
|
render() {
|
|
36
36
|
const i = ["<slot></slot>"];
|
|
@@ -46,9 +46,9 @@ class b extends r {
|
|
|
46
46
|
_finishChange() {
|
|
47
47
|
if (this.$more) {
|
|
48
48
|
this.observer && (this.finish ? this.observer.unobserve(this.$more) : this.observer.observe(this.$more));
|
|
49
|
-
const i =
|
|
49
|
+
const i = s(".l-list-loadmore-text", this.$more);
|
|
50
50
|
i && (i.textContent = this._loadingText());
|
|
51
|
-
let t =
|
|
51
|
+
let t = s(".l-list-icon", this.$more);
|
|
52
52
|
this.finish ? t && t.remove() : t == null && (t = document.createElement("l-loading-icon"), t.className = "l-list-icon l-rotate-anim", this.$more.prepend(t));
|
|
53
53
|
}
|
|
54
54
|
}
|