litos-ui 0.9.0 → 0.11.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 +4 -0
- package/lib/base.js +13 -7
- package/lib/button/index.js +3 -3
- package/lib/checkbox/index.d.ts +17 -0
- package/lib/checkbox/index.js +135 -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.js +21 -20
- package/lib/form/form_item.js +1 -1
- package/lib/form/index.js +1 -1
- package/lib/icon/close.d.ts +5 -0
- package/lib/icon/close.js +10 -0
- package/lib/index.d.ts +18 -0
- package/lib/index.js +89 -71
- package/lib/input/index.js +2 -2
- package/lib/list/index.d.ts +1 -1
- package/lib/litos-ui.css +1 -1
- package/lib/loading/index.d.ts +40 -0
- package/lib/loading/index.js +135 -0
- package/lib/md_input/index.d.ts +15 -0
- package/lib/md_input/index.js +60 -0
- package/lib/radio/index.js +2 -2
- package/lib/switch/index.js +1 -1
- package/lib/theme/index.js +1 -1
- package/lib/{form/form_events.d.ts → utils/event.d.ts} +5 -7
- package/lib/utils/index.js +24 -24
- package/package.json +71 -72
- package/styles/dialog.css +56 -0
- package/styles/loading.css +100 -0
- package/styles/reset.css +10 -0
- package/lib/form/form_events.js +0 -22
- package/lib/litos-ui.min.js +0 -1
package/lib/index.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ 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";
|
|
7
10
|
export { default as BaseIcon } from "./icon/base";
|
|
8
11
|
export { default as ArrowDownIcon } from "./icon/arrow_down";
|
|
9
12
|
export { default as ArrowLeftIcon } from "./icon/arrow_left";
|
|
@@ -21,13 +24,19 @@ export { default as RefreshLeftIcon } from "./icon/refresh_left";
|
|
|
21
24
|
export { default as RefreshRightIcon } from "./icon/refresh_right";
|
|
22
25
|
export { default as SortIcon } from "./icon/sort";
|
|
23
26
|
export { default as ThemeDefaultIcon } from "./icon/theme_default";
|
|
27
|
+
export { default as CloseIcon } from "./icon/close";
|
|
28
|
+
export { default as InfoIcon } from "./icon/info";
|
|
29
|
+
export { default as SuccessIcon } from "./icon/success";
|
|
30
|
+
export { default as WarnIcon } from "./icon/warn";
|
|
24
31
|
export { default as Form } from "./form";
|
|
25
32
|
export { default as FormItem } from "./form/form_item";
|
|
26
33
|
export { default as Radio } from "./radio";
|
|
34
|
+
export { default as Checkbox } from "./checkbox";
|
|
27
35
|
export { default as Button } from "./button";
|
|
28
36
|
export { default as Input } from "./input";
|
|
29
37
|
export { default as SelectOri } from "./select_ori";
|
|
30
38
|
export { default as Switch } from "./switch";
|
|
39
|
+
export { default as MdInput } from "./md_input";
|
|
31
40
|
export { default as List } from "./list";
|
|
32
41
|
export { default as Polygon } from "./polygon";
|
|
33
42
|
export { default as ColorPicker } from "./color_picker";
|
|
@@ -40,6 +49,9 @@ declare global {
|
|
|
40
49
|
"l-base-component": import("./base").default
|
|
41
50
|
"l-popover": import("./popover").default
|
|
42
51
|
"l-popconfirm": import("./popconfirm").default
|
|
52
|
+
"l-dialog": import("./dialog").default
|
|
53
|
+
"l-dialog-container": import("./dialog/dialog_container").default
|
|
54
|
+
"l-loading": import("./loading").default
|
|
43
55
|
"l-base-icon": import("./icon/base").default
|
|
44
56
|
"l-arrow-down-icon": import("./icon/arrow_down").default
|
|
45
57
|
"l-arrow-left-icon": import("./icon/arrow_left").default
|
|
@@ -57,13 +69,19 @@ declare global {
|
|
|
57
69
|
"l-refresh-right-icon": import("./icon/refresh_right").default
|
|
58
70
|
"l-sort-icon": import("./icon/sort").default
|
|
59
71
|
"l-theme-default-icon": import("./icon/theme_default").default
|
|
72
|
+
"l-close-icon": import("./icon/close").default
|
|
73
|
+
"l-info-icon": import("./icon/info").default
|
|
74
|
+
"l-success-icon": import("./icon/success").default
|
|
75
|
+
"l-warn-icon": import("./icon/warn").default
|
|
60
76
|
"l-form": import("./form").default
|
|
61
77
|
"l-form-item": import("./form/form_item").default
|
|
62
78
|
"l-radio": import("./radio").default
|
|
79
|
+
"l-checkbox": import("./checkbox").default
|
|
63
80
|
"l-button": import("./button").default
|
|
64
81
|
"l-input": import("./input").default
|
|
65
82
|
"l-select-ori": import("./select_ori").default
|
|
66
83
|
"l-switch": import("./switch").default
|
|
84
|
+
"l-md-input": import("./md_input").default
|
|
67
85
|
"l-list": import("./list").default
|
|
68
86
|
"l-polygon": import("./polygon").default
|
|
69
87
|
"l-color-picker": import("./color_picker").default
|
package/lib/index.js
CHANGED
|
@@ -1,75 +1,93 @@
|
|
|
1
|
-
import { config as t, createTransition as r, getPopoverOffsetX as a, getPopoverOffsetY as f, impactDetect as s, initAttr as m, parseAttrValue as p, regist as
|
|
2
|
-
import { set as
|
|
1
|
+
import { config as t, createTransition as r, getPopoverOffsetX as a, getPopoverOffsetY as f, impactDetect as s, initAttr as m, parseAttrValue as p, regist as l, setAttrs as u, tagAttr as d, tagAttrs as x, useId as n } from "./utils/index.js";
|
|
2
|
+
import { set as I, remove as i } from "./utils/clickoutside.js";
|
|
3
3
|
import { default as h } from "./base.js";
|
|
4
|
-
import { default as
|
|
4
|
+
import { default as A } from "./message/index.js";
|
|
5
5
|
import { default as P } from "./popover/index.js";
|
|
6
|
-
import { default as
|
|
7
|
-
import { default as
|
|
8
|
-
import { default as
|
|
9
|
-
import { default as k } from "./
|
|
10
|
-
import { default as
|
|
11
|
-
import { default as M } from "./icon/
|
|
12
|
-
import { default as U } from "./icon/
|
|
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 _ } from "./icon/
|
|
21
|
-
import { default as oo } from "./icon/
|
|
22
|
-
import { default as to } from "./icon/
|
|
23
|
-
import { default as ao } from "./icon/
|
|
24
|
-
import { default as so } from "./
|
|
25
|
-
import { default as po } from "./
|
|
26
|
-
import { default as
|
|
27
|
-
import { default as no } from "./
|
|
28
|
-
import { default as
|
|
29
|
-
import { default as go } from "./
|
|
30
|
-
import { default as
|
|
31
|
-
import { default as wo } from "./
|
|
32
|
-
import { default as Ro } from "./
|
|
33
|
-
import { default as
|
|
34
|
-
import { default as
|
|
35
|
-
import { default as
|
|
36
|
-
import { default as
|
|
6
|
+
import { default as S } from "./popconfirm/index.js";
|
|
7
|
+
import { default as v } from "./dialog/index.js";
|
|
8
|
+
import { default as L } from "./dialog/dialog_container.js";
|
|
9
|
+
import { default as k } from "./loading/index.js";
|
|
10
|
+
import { default as b } from "./icon/base.js";
|
|
11
|
+
import { default as M } from "./icon/arrow_down.js";
|
|
12
|
+
import { default as U } from "./icon/arrow_left.js";
|
|
13
|
+
import { default as W } from "./icon/arrow_right.js";
|
|
14
|
+
import { default as Y } from "./icon/arrow_up.js";
|
|
15
|
+
import { default as q } from "./icon/caret_top.js";
|
|
16
|
+
import { default as E } from "./icon/caret_bottom.js";
|
|
17
|
+
import { default as H } from "./icon/font_icon.js";
|
|
18
|
+
import { default as K } from "./icon/loading.js";
|
|
19
|
+
import { default as Q } from "./icon/search.js";
|
|
20
|
+
import { default as _ } from "./icon/sun.js";
|
|
21
|
+
import { default as oo } from "./icon/moon.js";
|
|
22
|
+
import { default as to } from "./icon/reduction.js";
|
|
23
|
+
import { default as ao } from "./icon/refresh_left.js";
|
|
24
|
+
import { default as so } from "./icon/refresh_right.js";
|
|
25
|
+
import { default as po } from "./icon/sort.js";
|
|
26
|
+
import { default as uo } from "./icon/theme_default.js";
|
|
27
|
+
import { default as no } from "./icon/close.js";
|
|
28
|
+
import { default as Io } from "./icon/info.js";
|
|
29
|
+
import { default as go } from "./icon/success.js";
|
|
30
|
+
import { default as Co } from "./icon/warn.js";
|
|
31
|
+
import { default as wo } from "./form/index.js";
|
|
32
|
+
import { default as Ro } from "./form/form_item.js";
|
|
33
|
+
import { default as To } from "./radio/index.js";
|
|
34
|
+
import { default as Do } from "./checkbox/index.js";
|
|
35
|
+
import { default as Oo } from "./button/index.js";
|
|
36
|
+
import { default as Bo } from "./input/index.js";
|
|
37
|
+
import { default as Fo } from "./select_ori/index.js";
|
|
38
|
+
import { default as yo } from "./switch/index.js";
|
|
39
|
+
import { default as Vo } from "./md_input/index.js";
|
|
40
|
+
import { default as Xo } from "./list/index.js";
|
|
41
|
+
import { default as jo } from "./polygon/index.js";
|
|
42
|
+
import { default as zo } from "./color_picker/index.js";
|
|
43
|
+
import { default as Go } from "./tabbar/index.js";
|
|
44
|
+
import { default as Jo } from "./theme/index.js";
|
|
45
|
+
import { default as No } from "./theme/theme_color.js";
|
|
37
46
|
export {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
47
|
+
M as ArrowDownIcon,
|
|
48
|
+
U as ArrowLeftIcon,
|
|
49
|
+
W as ArrowRightIcon,
|
|
50
|
+
Y as ArrowUpIcon,
|
|
42
51
|
h as BaseComponent,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
b as BaseIcon,
|
|
53
|
+
Oo as Button,
|
|
54
|
+
E as CaretBottomIcon,
|
|
55
|
+
q as CaretTopIcon,
|
|
56
|
+
Do as Checkbox,
|
|
57
|
+
no as CloseIcon,
|
|
58
|
+
zo as ColorPicker,
|
|
59
|
+
v as Dialog,
|
|
60
|
+
L as DialogContainer,
|
|
61
|
+
H as FontIcon,
|
|
62
|
+
wo as Form,
|
|
63
|
+
Ro as FormItem,
|
|
64
|
+
Io as InfoIcon,
|
|
65
|
+
Bo as Input,
|
|
66
|
+
Xo as List,
|
|
67
|
+
k as Loading,
|
|
68
|
+
K as LoadingIcon,
|
|
69
|
+
Vo as MdInput,
|
|
70
|
+
A as Message,
|
|
71
|
+
oo as MoonIcon,
|
|
72
|
+
jo as Polygon,
|
|
73
|
+
S as Popconfirm,
|
|
58
74
|
P as Popover,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
To as Radio,
|
|
76
|
+
to as ReductionIcon,
|
|
77
|
+
ao as RefreshLeftIcon,
|
|
78
|
+
so as RefreshRightIcon,
|
|
79
|
+
Q as SearchIcon,
|
|
80
|
+
Fo as SelectOri,
|
|
81
|
+
po as SortIcon,
|
|
82
|
+
go as SuccessIcon,
|
|
83
|
+
_ as SunIcon,
|
|
84
|
+
yo as Switch,
|
|
85
|
+
Go as Tabbar,
|
|
86
|
+
Jo as Theme,
|
|
87
|
+
No as ThemeColor,
|
|
88
|
+
uo as ThemeDefaultIcon,
|
|
89
|
+
Co as WarnIcon,
|
|
90
|
+
I as addClickOutside,
|
|
73
91
|
t as config,
|
|
74
92
|
r as createTransition,
|
|
75
93
|
a as getPopoverOffsetX,
|
|
@@ -77,10 +95,10 @@ export {
|
|
|
77
95
|
s as impactDetect,
|
|
78
96
|
m as initAttr,
|
|
79
97
|
p as parseAttrValue,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
98
|
+
l as regist,
|
|
99
|
+
i as removeClickOutside,
|
|
100
|
+
u as setAttrs,
|
|
101
|
+
d as tagAttr,
|
|
84
102
|
x as tagAttrs,
|
|
85
103
|
n as useId
|
|
86
104
|
};
|
package/lib/input/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { off as u, formatClass as o, $one as h, on as p, formatStyle as d, addClass as c, removeClass as f } from "ph-utils/dom";
|
|
2
|
-
import { initAttr as m,
|
|
2
|
+
import { initAttr as m, parseAttrValue as g, tagAttr as n } from "../utils/index.js";
|
|
3
3
|
import v from "../form/form_inner.js";
|
|
4
|
-
import { remove as $, add as b } from "../
|
|
4
|
+
import { remove as $, add as b } from "../utils/event.js";
|
|
5
5
|
import { i as _ } from "../index-391POYEJ.js";
|
|
6
6
|
class S extends v {
|
|
7
7
|
static baseName = "input";
|
package/lib/list/index.d.ts
CHANGED
package/lib/litos-ui.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
html,body{height:100%}body{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;margin:0;font-size:14px;line-height:1.6}img{vertical-align:top}ul,ol{margin:0;padding:0;list-style:none}div{box-sizing:border-box}a{color:#4998f6;cursor:pointer;text-decoration:none;transition:color .3s}a:hover{color:#5ba2f7}a:active{color:#64a7f7}p{color:#333;margin:5px 0;font-size:16px;line-height:1.4}l-button:not([text])+l-button{margin-left:10px}.l-message{color:var(--l-primary-color,#722ed1);z-index:1000;background:#f0faff;border:1px solid #d4eeff;border-radius:5px;align-items:center;padding:10px;font-size:14px;transition:opacity .3s,transform .3s,top .3s;display:flex;position:fixed;top:20px;left:50%;transform:translate(-50%)}.l-message .l-message-icon{margin-right:5px}.l-message.l-message-success{color:var(--l-success-color,#52c41a);background:#edfff3;border-color:#bbf2cf}.l-message.l-message-error{color:var(--l-error-color,#f5222d);background:#ffefe6;border-color:#ffcfb8}.l-message.l-message-warn{color:var(--l-warn-color,#f90);background:#fff9e6;border-color:#ffe7a3}.l-message-container{align-items:center;display:flex}.l-message-fade-enter-from,.l-message-fade-leave-to{opacity:0;transform:translate(-50%,-100%)}@media screen and (max-width:768px){.l-message{width:90%}}@keyframes l-rotate-frame{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.l-rotate-anim{animation:1.5s linear infinite l-rotate-frame}:host{--l-btn-text-color:#fff;--l-btn-hover-text-color:var(--l-btn-text-color);--l-btn-active-text-color:var(--l-btn-text-color);--l-btn-border-color:var(--l-primary-color,#722ed1);--l-btn-background:var(--l-btn-border-color);--l-btn-hover-border-color:var(--l-primary-color-light1,#9254de);--l-btn-hover-background:var(--l-btn-hover-border-color);--l-btn-active-border-color:var(--l-primary-color-dark1,#531dab);--l-btn-active-background:var(--l-btn-active-border-color);--l-btn-disabled-color:#c9c9c9;--l-btn-disabled-background:#fbfbfb;--l-btn-disabled-border-color:#e6e6e6;display:inline-block}.l-btn{cursor:pointer;box-sizing:border-box;vertical-align:middle;height:var(--l-form-edit-height,32px);color:var(--l-btn-text-color);background:var(--l-btn-background);border:1px solid var(--l-btn-border-color);border-radius:3px;outline:none;justify-content:center;align-items:center;gap:5px;padding:0 15px;font-size:14px;line-height:1;transition:border-color .3s,background-color .3s,color .3s;display:inline-flex;position:relative}.l-btn:hover{border-color:var(--l-btn-hover-border-color,var(--l-btn-hover-background));color:var(--l-btn-hover-text-color);background:var(--l-btn-hover-background)}.l-btn:active{border-color:var(--l-btn-active-border-color,var(--l-btn-active-background));color:var(--l-btn-active-text-color);background:var(--l-btn-active-background)}.l-btn-normal{--l-btn-text-color:auto;--l-btn-background:transparent;--l-btn-border-color:#d9d9d9;--l-btn-hover-text-color:var(--l-primary-color-light1,#9254de);--l-btn-active-text-color:var(--l-primary-color-dark1,#531dab);--l-btn-hover-background:#fff;--l-btn-active-background:#fff;--l-btn-hover-border-color:var(--l-btn-hover-text-color);--l-btn-active-border-color:var(--l-btn-active-text-color)}.l-btn-primary{--l-btn-background:var(--l-primary-color,#722ed1);--l-btn-hover-background:var(--l-primary-color-light1,#9254de);--l-btn-active-background:var(--l-primary-color-dark1,#531dab)}.l-btn:not(.l-btn-loading):disabled{border-color:var(--l-btn-disabled-border-color);background:var(--l-btn-disabled-background);color:var(--l-btn-disabled-color);cursor:not-allowed;opacity:1}.l-btn-text{--l-btn-background:transparent;--l-btn-border-color:transparent;--l-btn-hover-border-color:transparent;--l-btn-active-border-color:transparent;--l-btn-disabled-background:transparent;--l-btn-disabled-border-color:transparent;--l-btn-hover-background:transparent;--l-btn-active-background:transparent;height:auto;padding:5px}.l-btn-primary.l-btn-text{--l-btn-text-color:var(--l-primary-color,#722ed1);--l-btn-hover-text-color:var(--l-primary-color-light1,#9254de);--l-btn-active-text-color:var(--l-primary-color-dark1,#531dab)}.l-btn-ghost{--l-btn-text-color:var(--l-btn-border-color);--l-btn-background:transparent;--l-btn-hover-background:transparent;--l-btn-active-background:transparent;--l-btn-hover-text-color:var(--l-btn-hover-border-color);--l-btn-active-text-color:var(--l-btn-active-border-color)}.l-btn-round{border-radius:calc(var(--l-form-edit-height,32px)/2)}.l-btn-circle{width:var(--l-form-edit-height,32px);border-radius:50%;padding:0}.l-btn-block{width:100%}.l-btn:not(.l-btn-text)+.l-btn{margin-left:10px}html.dark .l-btn:disabled{--l-btn-disabled-background:#ffffff14;--l-btn-disabled-color:#ffffff4d;--l-btn-disabled-border-color:#ffffff4d}.l-icon{fill:currentColor;vertical-align:middle;width:1em;height:1em;display:inline-block}:host{width:var(--l-input-width,auto);display:inline-block}.l-input{box-sizing:border-box;width:100%;max-width:100%;height:var(--l-form-edit-height,32px);border:1px solid var(--l-border-color,#dedede);text-align:inherit;vertical-align:middle;border-radius:3px;outline:none;padding:0 5px;transition:border-color .3s}.l-input.is-error{--l-border-color:var(--nt-error-color,#ed3f13)}.l-input:not(.is-error):focus{border-color:var(--l-primary-color,#722ed1)}.l-input:disabled{cursor:not-allowed;background:var(--l-disabled-color,#f5f7fa)}.l-form{grid-template-columns:var(--l-form-label-width,auto)1fr;row-gap:20px;display:grid}.l-form-inline{flex-flow:wrap;gap:20px;display:flex}.l-form.l-form-inline{--l-form-item-display:flex}.l-form.l-form--left{--l-form-label-align:left}.l-form.l-form--top{--l-form-item-display:grid;--l-form-label-align:left;--l-form-label-empty-display:none;grid-template-columns:1fr}:host{align-items:center;display:flex}.l-radio{--l-radio-size:16px;--l-radio-label-color:#333;--l-radio-disabled-color:#e6e6e6;--l-radio-disabled-label-color:var(--l-disabled-color,#c0c4cc);--l-radio-checked-color:var(--l-primary-color,#722ed1);--l-radio-item-margin:10px;cursor:pointer;align-items:center;display:inline-flex;position:relative}.l-radio__label{margin-left:5px;transition:color .3s ease-in-out}.l-radio__input{z-index:-1;opacity:0;width:0;height:0;position:absolute}.l-radio__inner{width:var(--l-radio-size);height:var(--l-radio-size);box-sizing:border-box;border:1px solid #dcddd9;border-radius:50%;justify-content:center;align-items:center;transition:border-color .3s ease-in-out;display:flex}.l-radio__inner:before{content:"";background-color:#0000;border-radius:50%;width:60%;height:60%;transition:background-color .3s ease-in-out;display:block}.l-radio.is-checked .l-radio__inner{border-color:var(--l-primary-color,#722ed1)}.l-radio.is-checked .l-radio__inner:before{background-color:var(--l-primary-color,#722ed1)}.l-radio.is-checked .l-radio__label{color:var(--l-primary-color,#722ed1)}.l-radio--disabled{cursor:not-allowed}.l-radio--disabledd .l-radio__inner{border-color:var(--l-radio-disabled-color)}.l-radio--disabled .l-radio__label{color:var(--l-radio-disabled-label-color)}.l-radio:not(:first-child){margin-left:var(--l-radio-item-margin)}.l-radio--button .l-radio__label{height:var(--l-form-edit-height,32px);border:1px solid #c0c4cc;border-left-width:0;justify-content:center;align-items:center;margin-left:0;padding:0 15px;display:inline-flex}.l-radio--button:not(:first-of-type){margin-left:0}.l-radio--button:first-of-type .l-radio__label{border-left-width:1px;border-top-left-radius:3px;border-bottom-left-radius:3px}.l-radio--button:last-of-type .l-radio__label{border-top-right-radius:3px;border-bottom-right-radius:3px}.is-checked.l-radio--button .l-radio__label{background-color:var(--l-radio-checked-color);color:#fff;border-color:var(--l-radio-checked-color)}:host{-webkit-overflow-scrolling:touch;height:100%;display:block;position:relative;overflow:auto}.l-list-loadmore{color:#999;justify-content:center;align-items:center;padding:10px;display:flex}.l-list-icon{margin-right:10px;font-size:24px;transform:rotate(80deg)}.l-polygon{--l-polygen-size:10px;--l-polygen-width:var(--l-polygen-size);--l-polygen-height:var(--l-polygen-size);--l-polygen-background:#666;width:var(--l-polygen-width);height:var(--l-polygen-height);background:var(--l-polygen-background);transition:background .3s ease-in-out;display:inline-block}.l-polygon-triangle-top{clip-path:polygon(calc(var(--l-polygen-width)/2)0,var(--l-polygen-width)var(--l-polygen-height),0 var(--l-polygen-height))}.l-polygon-triangle-top-left{clip-path:polygon(0 0,var(--l-polygen-width)0,0 var(--l-polygen-height))}.l-polygon-triangle-top-right{clip-path:polygon(0 0,var(--l-polygen-width)0,var(--l-polygen-width)var(--l-polygen-height))}.l-polygon-triangle-right{clip-path:polygon(0 0,var(--l-polygen-width)calc(var(--l-polygen-height)/2),0 var(--l-polygen-height))}.l-polygon-triangle-left{clip-path:polygon(var(--l-polygen-width)0,var(--l-polygen-width)var(--l-polygen-height),0 calc(var(--l-polygen-height)/2))}.l-polygon-triangle-bottom{clip-path:polygon(0 0,var(--l-polygen-width)0,calc(var(--l-polygen-width)/2)var(--l-polygen-height))}.l-polygon-triangle-bottom-left{clip-path:polygon(0 0,0 var(--l-polygen-height),var(--l-polygen-width)var(--l-polygen-height))}.l-polygon-triangle-bottom-right{clip-path:polygon(var(--l-polygen-width)0,var(--l-polygen-width)var(--l-polygen-height),0 var(--l-polygen-height))}:host{--l-switch-height:22px;--l-switch-width:40px;box-sizing:border-box;width:var(--l-switch-width);height:var(--l-switch-height);border-radius:calc(var(--l-switch-height)/2);cursor:pointer;vertical-align:middle;background-color:#dcdfe6;border:1px solid #c2c2c2;justify-content:flex-start;align-items:center;padding:2px;transition:all .3s ease-in-out;display:inline-flex;position:relative}:host(:hover),:host(.l-switch--checked):hover{border-color:var(--l-primary-color,#722ed1)}:host(.l-switch--checked){background-color:var(--l-primary-color,#722ed1);border-color:var(--l-primary-color,#722ed1)}.l-switch-action{width:calc(var(--l-switch-height) - 6px);box-sizing:border-box;background-color:#fff;border-radius:50%;justify-content:center;align-items:center;padding:2px;font-size:12px;transition:all .3s ease-in-out;display:flex;position:absolute;top:2px;bottom:2px;left:2px}.l-switch-text{color:#fff;padding-left:calc(var(--l-switch-width) - 20px);transition:padding-left .3s ease-in-out}:host(.l-switch--checked) .l-switch-action{left:calc(var(--l-switch-width) - var(--l-switch-height) + 3px)}:host(.l-switch--checked) .l-switch-text{padding-left:5px}:host{--l-input-width:60px;--l-tabbar-hover-color:var(--l-primary-color-light1,#9254de);--l-tabbar-active-color:var(--l-primary-color,#722ed1);--l-tabbar-item-gap:0;--l-tabbar-height:38px;height:var(--l-tabbar-height);background-color:#fff;display:block;position:relative;overflow:hidden}.l-tabbar-wrapper{align-items:stretch;gap:var(--l-tabbar-item-gap);flex-wrap:nowrap;height:100%;display:flex}.l-tabbar-item{color:#666;cursor:pointer;justify-content:center;align-items:center;transition:all .3s ease-in-out;display:inline-flex}.l-tabbar-item:hover{color:var(--l-tabbar-hover-color)}.l-tabbar-item.active{color:var(--l-tabbar-active-color)}.l-tabbar-item-icon{justify-content:center;align-items:center;margin-bottom:5px;font-size:18px;display:flex}.l-tabbar-item-icon.only{margin-bottom:0;font-size:24px}:host(.l-tabbar--nav){--l-tabbar-height:50px;width:100%}:host(.l-tabbar--nav) .l-tabbar-item{flex-direction:column;flex-grow:1;justify-content:center;align-items:center;font-size:12px;line-height:1;display:inline-flex}:host(.l-tabbar--bar){--l-tabbar-bar-vertical-padding:10px;--l-tabbar-item-gap:30px;--l-tabbar-line-color:var(--l-primary-color,#722ed1);white-space:nowrap;overflow:auto}.l-tabbar--bar-line{background-color:var(--l-tabbar-line-color);border-radius:1px;width:32px;height:2px;transition:all .3s ease-in-out;position:absolute;bottom:0;left:0}:host(.l-tabbar--card){--l-tabbar-card-border-color:#f5f7fa;--l-tabbar-line-color:#fff;--l-tabbar-item-gap:0;--l-tabbar-card-border-radius:5px}.l-tabbar-card-border{background-color:var(--l-tabbar-card-border-color);height:1px;position:absolute;bottom:0;left:0;right:0}:host(.l-tabbar--card) .l-tabbar-item{background:#f5f7fa;border:1px solid #f0f0f0;padding:0 15px}:host(.l-tabbar--card) .l-tabbar-item:first-child{border-top-left-radius:var(--l-tabbar-card-border-radius)}:host(.l-tabbar--card) .l-tabbar-item:last-child{border-top-right-radius:var(--l-tabbar-card-border-radius)}:host(.l-tabbar-gap) .l-tabbar-item{border-top-left-radius:var(--l-tabbar-card-border-radius);border-top-right-radius:var(--l-tabbar-card-border-radius)}:host(.l-tabbar--card) .l-tabbar-item.active{background:#fff}:host{display:inline-flex}.l-theme-btn::part(default){--l-btn-background:transparent;--l-btn-hover-background:transparent;--l-btn-text-color:#9ca3af;--l-btn-hover-text-color:#666;width:var(--l-form-edit-height,32px);padding:0;font-size:18px}.l-theme-switch.l-switch--checked{background-color:#65757129;border-color:#3c3f44}.l-theme-switch.l-switch--checked::part(action){color:#fff;background-color:#000}html.dark .l-theme-btn{--l-btn-hover-text-color:#fff}:host{width:max-content;position:relative}.l-popover--content{--l-popover-border-color:#e4e4e4;--l-popover-color:#666;--l-popover-box-shadow:0 4px 8px #0000001f;--l-popover-background:#fff;--l-popover-arrow-size:8px;--l-popover-offset:10px;width:max-content;box-shadow:var(--l-popover-box-shadow);background:var(--l-popover-background);border:1px solid var(--l-popover-border-color);z-index:30;color:var(--l-popover-color);box-sizing:border-box;border-radius:4px;padding:10px;position:absolute}.l-popover-tooltip{--l-popover-color:#fff;--l-popover-box-shadow:4px 4px 8px #0000004d;--l-popover-background:#383838;--l-popover-arrow-size:6px;border-radius:5px;padding:8px;font-size:12px;line-height:1}.l-popover--arrow{width:var(--l-popover-arrow-size,8px);height:var(--l-popover-arrow-size,8px);z-index:-1;position:absolute}.l-popover--arrow:before{content:"";width:var(--l-popover-arrow-size,8px);height:var(--l-popover-arrow-size,8px);background-color:var(--l-popover-background);border-style:solid;border-width:1px;position:absolute;transform:rotate(45deg)}.l-popover-top,.l-popover-top-start,.l-popover-top-end{bottom:calc(100% + var(--l-popover-offset,10px))}.l-popover-bottom,.l-popover-bottom-start,.l-popover-bottom-end{top:calc(100% + var(--l-popover-offset,10px))}.l-popover-top-start,.l-popover-bottom-start{left:0}.l-popover-top-end,.l-popover-bottom-end{right:0}.l-popover-bottom,.l-popover-top{left:50%;transform:translate(-50%)}.l-popover-left-start,.l-popover-left,.l-popover-left-end{right:calc(100% + var(--l-popover-offset,10px))}.l-popover-left-start,.l-popover-right-start{top:0}.l-popover-left-end,.l-popover-right-end{bottom:0}.l-popover-left,.l-popover-right{top:50%;transform:translateY(-50%)}.l-popover-right-start,.l-popover-right,.l-popover-right-end{left:calc(100% + var(--l-popover-offset,10px))}.l-popover-top .l-popover--arrow,.l-popover-bottom .l-popover--arrow{margin-left:-4px;left:50%}.l-popover-top .l-popover--arrow:before,.l-popover-top-start .l-popover--arrow:before,.l-popover-top-end .l-popover--arrow:before{border-color:transparent var(--l-popover-border-color)var(--l-popover-border-color)transparent}.l-popover-bottom .l-popover--arrow:before,.l-popover-bottom-start .l-popover--arrow:before,.l-popover-bottom-end .l-popover--arrow:before{border-color:var(--l-popover-border-color)transparent transparent var(--l-popover-border-color)}.l-popover-top .l-popover--arrow,.l-popover-top-start .l-popover--arrow,.l-popover-top-end .l-popover--arrow{bottom:calc((var(--l-popover-arrow-size,8px)/-2) + 1px)}.l-popover-top-start .l-popover--arrow,.l-popover-bottom-start .l-popover--arrow{left:10px}.l-popover-top-end .l-popover--arrow,.l-popover-bottom-end .l-popover--arrow{right:10px}.l-popover-bottom .l-popover--arrow,.l-popover-bottom-start .l-popover--arrow,.l-popover-bottom-end .l-popover--arrow{top:calc((var(--l-popover-arrow-size,8px)/-2) - 1px)}.l-popover-left .l-popover--arrow,.l-popover-left-start .l-popover--arrow,.l-popover-left-end .l-popover--arrow{margin-top:-4px;right:-4px}.l-popover-left-start .l-popover--arrow:before,.l-popover-left .l-popover--arrow:before,.l-popover-left-end .l-popover--arrow:before{border-color:var(--l-popover-border-color)var(--l-popover-border-color)transparent transparent}.l-popover-right .l-popover--arrow,.l-popover-right-start .l-popover--arrow,.l-popover-right-end .l-popover--arrow{margin-top:-4px;left:-4px}.l-popover-right-start .l-popover--arrow:before,.l-popover-right .l-popover--arrow:before,.l-popover-right-end .l-popover--arrow:before{border-color:transparent transparent var(--l-popover-border-color)var(--l-popover-border-color)}.l-popover-left .l-popover--arrow,.l-popover-right .l-popover--arrow{top:50%}.l-popover-left-start .l-popover--arrow,.l-popover-right-start .l-popover--arrow{top:10px}.l-popover-left-end .l-popover--arrow,.l-popover-right-end .l-popover--arrow{bottom:10px}.l-popover-popconfirm{min-width:200px}.l-popconfirm-container{align-items:center;display:flex}.l-popconfirm-icon-wrapper{color:var(--nt-warn-color,#f90);margin-right:10px;display:inline-flex}.l-popconfirm-footer{justify-content:flex-end;align-items:center;gap:5px;margin-top:7px;display:flex}.l-popconfirm-footer l-button::part(default){height:24px;padding:0 6px;font-size:13px}
|
|
1
|
+
:host{display:inline-flex}.l-icon{width:1em;height:1em;fill:currentColor;vertical-align:middle;display:inline-block}:host{display:inline-flex;width:auto}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
type LoadingInstanceParams = {
|
|
2
|
+
/** 是否全屏显示, 默认: true */
|
|
3
|
+
fullscreen?: boolean;
|
|
4
|
+
/** 全屏显示时,是否隐藏滚动条; 默认: true */
|
|
5
|
+
lock?: boolean;
|
|
6
|
+
/** 是否为条形, 默认: false */
|
|
7
|
+
bar?: boolean;
|
|
8
|
+
/** 进度条挂载容器 */
|
|
9
|
+
to?: string | HTMLElement | null;
|
|
10
|
+
/** 显示的文本; 默认: 加载中…… */
|
|
11
|
+
text?: string;
|
|
12
|
+
/** 进度背景色 */
|
|
13
|
+
background?: string;
|
|
14
|
+
};
|
|
15
|
+
declare class LoadingInstance {
|
|
16
|
+
/** 加载容器 */
|
|
17
|
+
el: HTMLElement;
|
|
18
|
+
option: Required<Omit<LoadingInstanceParams, "to">>;
|
|
19
|
+
constructor(option?: LoadingInstanceParams);
|
|
20
|
+
/** 显示进度条 */
|
|
21
|
+
show(): void;
|
|
22
|
+
/** 隐藏进度条 */
|
|
23
|
+
hide(): void;
|
|
24
|
+
}
|
|
25
|
+
declare const _default: {
|
|
26
|
+
/** 创建并显示进度条 */
|
|
27
|
+
create(option?: LoadingInstanceParams): LoadingInstance;
|
|
28
|
+
/** 根据指令参数初始化进度条 */
|
|
29
|
+
init(id?: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* 关闭加载中的元素
|
|
32
|
+
*
|
|
33
|
+
* 此函数用于关闭页面上带有特定 l-loading 属性的元素,只关闭与该 id 匹配的元素
|
|
34
|
+
* 否则,将关闭所有带有 l-loading 属性的元素
|
|
35
|
+
*
|
|
36
|
+
* @param id 可选参数,指定特定的加载元素 l-loading 对应的值,如果提供,则只关闭匹配该 id 的元素
|
|
37
|
+
*/
|
|
38
|
+
close(id?: string): void;
|
|
39
|
+
};
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { $ as d, iterate as u, hasClass as h, $one as m, addClass as r, $$ as c } from "ph-utils/dom";
|
|
2
|
+
function f(t, e) {
|
|
3
|
+
if (h(t, "l-loading")) return;
|
|
4
|
+
let l;
|
|
5
|
+
if (e.fullscreen && (l = m("#l-loading-mask"), l != null))
|
|
6
|
+
return;
|
|
7
|
+
r(t, "l-loading"), l = c("div", { class: "l-loading-mask" }), e.background && (l.style.backgroundColor = e.background);
|
|
8
|
+
const n = c("div", { class: "l-loading-spinner" });
|
|
9
|
+
if (e.bar)
|
|
10
|
+
r(l, "l-loading-bar");
|
|
11
|
+
else {
|
|
12
|
+
const s = document.createElementNS(
|
|
13
|
+
"http://www.w3.org/2000/svg",
|
|
14
|
+
"svg"
|
|
15
|
+
);
|
|
16
|
+
s.setAttribute("viewBox", "0 0 50 50"), s.classList.add("circle");
|
|
17
|
+
const a = document.createElementNS(
|
|
18
|
+
"http://www.w3.org/2000/svg",
|
|
19
|
+
"circle"
|
|
20
|
+
);
|
|
21
|
+
if (a.classList.add("path"), a.setAttribute("cx", "25"), a.setAttribute("cy", "25"), a.setAttribute("r", "23"), a.setAttribute("fill", "none"), s.appendChild(a), n.appendChild(s), e.text) {
|
|
22
|
+
const i = c("p", {
|
|
23
|
+
class: "l-loading-text",
|
|
24
|
+
textContent: e.text
|
|
25
|
+
});
|
|
26
|
+
n.appendChild(i);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (e.fullscreen) {
|
|
30
|
+
const s = ["l-loading-fullscreen"];
|
|
31
|
+
e.lock && s.push("l-loading-lock"), t.classList.add(...s), l.id = "l-loading-mask";
|
|
32
|
+
}
|
|
33
|
+
l.appendChild(n), t.appendChild(l), setTimeout(() => {
|
|
34
|
+
e.bar ? r(l, "l-loading-bar--start") : l.style.opacity = "1";
|
|
35
|
+
}, 10);
|
|
36
|
+
}
|
|
37
|
+
function b(t, e) {
|
|
38
|
+
const l = e.fullscreen ? "#" : ".", n = d(`${l}l-loading-mask`, t);
|
|
39
|
+
u(n, (s) => {
|
|
40
|
+
function a() {
|
|
41
|
+
const g = ["l-loading-bar--start", "l-loading-bar--finish"];
|
|
42
|
+
t.tagName === "BODY" && g.push(
|
|
43
|
+
"l-loading",
|
|
44
|
+
"l-loading-fullscreen",
|
|
45
|
+
"l-loading-lock"
|
|
46
|
+
), t.classList.remove(...g), s != null && t.contains(s) && (t.removeChild(s), s = void 0);
|
|
47
|
+
}
|
|
48
|
+
let i = -1;
|
|
49
|
+
s.addEventListener(
|
|
50
|
+
"transitionend",
|
|
51
|
+
() => {
|
|
52
|
+
cancelAnimationFrame(i), i = requestAnimationFrame(() => {
|
|
53
|
+
a();
|
|
54
|
+
});
|
|
55
|
+
},
|
|
56
|
+
{ once: !0 }
|
|
57
|
+
), e.bar ? t.classList.add("l-loading-bar--finish") : s.style.opacity = "0", setTimeout(() => {
|
|
58
|
+
a();
|
|
59
|
+
}, 500);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
class p {
|
|
63
|
+
/** 加载容器 */
|
|
64
|
+
el;
|
|
65
|
+
option;
|
|
66
|
+
constructor(e) {
|
|
67
|
+
this.option = {
|
|
68
|
+
fullscreen: !0,
|
|
69
|
+
lock: !0,
|
|
70
|
+
bar: !1,
|
|
71
|
+
text: "加载中……",
|
|
72
|
+
background: "",
|
|
73
|
+
...e
|
|
74
|
+
};
|
|
75
|
+
const l = (e || {}).to;
|
|
76
|
+
let n = null;
|
|
77
|
+
l != null && (typeof l == "string" ? n = document.querySelector(l) : n = l), (n == null || this.option.fullscreen) && (n = document.body), this.el = n, this.show();
|
|
78
|
+
}
|
|
79
|
+
/** 显示进度条 */
|
|
80
|
+
show() {
|
|
81
|
+
f(this.el, this.option);
|
|
82
|
+
}
|
|
83
|
+
/** 隐藏进度条 */
|
|
84
|
+
hide() {
|
|
85
|
+
b(this.el, this.option);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
function o(t) {
|
|
89
|
+
const e = t.getAttribute("l-loading-text"), l = t.getAttribute("l-loading-lock");
|
|
90
|
+
return {
|
|
91
|
+
background: t.getAttribute("l-loading-background"),
|
|
92
|
+
text: e ? e === "0" || e === "false" ? void 0 : e : "加载中……",
|
|
93
|
+
fullscreen: t.hasAttribute("l-loading-fullscreen"),
|
|
94
|
+
lock: !(l === "0" || l === "false"),
|
|
95
|
+
bar: t.hasAttribute("l-loading-bar")
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
const x = {
|
|
99
|
+
/** 创建并显示进度条 */
|
|
100
|
+
create(t) {
|
|
101
|
+
return new p(t);
|
|
102
|
+
},
|
|
103
|
+
/** 根据指令参数初始化进度条 */
|
|
104
|
+
init(t) {
|
|
105
|
+
const e = t ? `[l-loading="${t}"]` : "[l-loading]", l = d(e);
|
|
106
|
+
u(l, (n) => {
|
|
107
|
+
const s = o(n);
|
|
108
|
+
f(
|
|
109
|
+
s.fullscreen ? document.body : n,
|
|
110
|
+
o(n)
|
|
111
|
+
);
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
/**
|
|
115
|
+
* 关闭加载中的元素
|
|
116
|
+
*
|
|
117
|
+
* 此函数用于关闭页面上带有特定 l-loading 属性的元素,只关闭与该 id 匹配的元素
|
|
118
|
+
* 否则,将关闭所有带有 l-loading 属性的元素
|
|
119
|
+
*
|
|
120
|
+
* @param id 可选参数,指定特定的加载元素 l-loading 对应的值,如果提供,则只关闭匹配该 id 的元素
|
|
121
|
+
*/
|
|
122
|
+
close(t) {
|
|
123
|
+
const e = t ? `[l-loading="${t}"]` : "[l-loading]", l = d(e);
|
|
124
|
+
u(l, (n) => {
|
|
125
|
+
const s = o(n);
|
|
126
|
+
b(
|
|
127
|
+
s.fullscreen ? document.body : n,
|
|
128
|
+
o(n)
|
|
129
|
+
);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
export {
|
|
134
|
+
x as default
|
|
135
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import FormInner from "../form/form_inner";
|
|
2
|
+
export default class MdInput extends FormInner {
|
|
3
|
+
#private;
|
|
4
|
+
static baseName: string;
|
|
5
|
+
/** 是否显示四周边框 */
|
|
6
|
+
outline: boolean;
|
|
7
|
+
htmlType: "text" | "number" | "password" | "tel";
|
|
8
|
+
inputmode?: "text" | "numeric" | "decimal" | "tel";
|
|
9
|
+
label?: string;
|
|
10
|
+
static get observedAttributes(): string[];
|
|
11
|
+
connectedCallback(): void;
|
|
12
|
+
disconnectedCallback(): void;
|
|
13
|
+
render(): DocumentFragment;
|
|
14
|
+
setValue(value: any): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { addClass as i, $$ as r, $one as l, on as a, off as d, removeClass as u } from "ph-utils/dom";
|
|
2
|
+
import p from "../form/form_inner.js";
|
|
3
|
+
import { initAttr as m } from "../utils/index.js";
|
|
4
|
+
import { isBlank as s, random as h } from "ph-utils";
|
|
5
|
+
const c = ":host{--l-input-width: 180px;position:relative;width:var(--l-input-width, 180px);height:var(--l-form-edit-height, 32px);display:inline-block}.l-md-input__inner{width:100%;height:100%;border:0;background:transparent;border-style:solid;border-color:silver;border-bottom-width:1px;box-sizing:border-box;outline:none;transition:border-color .3s}.l-md-input__inner:focus{border-color:var(--l-primary-color, #722ed1)}:host(.l-has-value) .l-md-input__label,.l-md-input__inner:focus+.l-md-input__label{transform:translate3d(0,-150%,0);font-size:12px}.l-md-input__inner:focus+.l-md-input__label{color:var(--nt-primary-color, #722ed1)}.l-md-input__label{display:flex;align-items:center;position:absolute;top:50%;bottom:0;left:0;transition:color .3s,transform .3s;color:#8c8c8c;cursor:text;line-height:1;transform:translate3d(0,-50%,0);font-size:13px}:host(.l-md-input-outline){--l-input-label-background: #ffffff}:host(.l-md-input-outline) .l-md-input__inner{border-width:1px;border-radius:4px;padding:0 10px}:host(.l-md-input-outline) .l-md-input__label{left:10px}:host(.l-md-input-outline) .l-md-input__inner:focus{border-width:2px}:host(.l-md-input-outline) .l-md-input__inner:focus+.l-md-input__label,:host(.l-md-input-outline.l-has-value) .l-md-input__label{padding-left:4px;padding-right:4px;background-color:#fff}";
|
|
6
|
+
class v extends p {
|
|
7
|
+
static baseName = "md-input";
|
|
8
|
+
/** 是否显示四周边框 */
|
|
9
|
+
outline = !1;
|
|
10
|
+
htmlType = "text";
|
|
11
|
+
inputmode;
|
|
12
|
+
label;
|
|
13
|
+
static get observedAttributes() {
|
|
14
|
+
return ["disabled"];
|
|
15
|
+
}
|
|
16
|
+
connectedCallback() {
|
|
17
|
+
m(this), this.loadStyleText(c), super.connectedCallback(), this.#e();
|
|
18
|
+
}
|
|
19
|
+
disconnectedCallback() {
|
|
20
|
+
super.disconnectedCallback(), this.#n();
|
|
21
|
+
}
|
|
22
|
+
render() {
|
|
23
|
+
s(this.value) || i(this, "l-has-value"), this.outline && i(this, "l-md-input-outline");
|
|
24
|
+
const t = document.createDocumentFragment(), e = `l-md-input-${h(8)}`, n = r("input", {
|
|
25
|
+
class: "l-md-input__inner",
|
|
26
|
+
type: this.htmlType,
|
|
27
|
+
name: this.name,
|
|
28
|
+
inputmode: this.inputmode,
|
|
29
|
+
id: e
|
|
30
|
+
});
|
|
31
|
+
if (t.appendChild(n), this.label) {
|
|
32
|
+
const o = r("label", {
|
|
33
|
+
class: "l-md-input__label",
|
|
34
|
+
for: e
|
|
35
|
+
});
|
|
36
|
+
o.textContent = this.label, t.appendChild(o);
|
|
37
|
+
}
|
|
38
|
+
return t;
|
|
39
|
+
}
|
|
40
|
+
setValue(t) {
|
|
41
|
+
super.setValue(t);
|
|
42
|
+
const e = l("input", this.root);
|
|
43
|
+
e && (e.value = t);
|
|
44
|
+
}
|
|
45
|
+
#e() {
|
|
46
|
+
const t = l("input", this.root);
|
|
47
|
+
t && a(t, "input", this.#t);
|
|
48
|
+
}
|
|
49
|
+
#n() {
|
|
50
|
+
const t = l("input", this.root);
|
|
51
|
+
t && d(t, "input", this.#t);
|
|
52
|
+
}
|
|
53
|
+
#t = (t) => {
|
|
54
|
+
const n = t.target.value;
|
|
55
|
+
this.setValue(n), s(n) ? u(this, "l-has-value") : i(this, "l-has-value");
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
v as default
|
|
60
|
+
};
|
package/lib/radio/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { initAttr as $,
|
|
1
|
+
import { initAttr as $, parseAttrValue as x, tagAttr as s } from "../utils/index.js";
|
|
2
2
|
import y from "../form/form_inner.js";
|
|
3
3
|
import { $one as a, hasClass as u, addClass as n, $ as c, iterate as h, getAttr as C, removeClass as b, formatClass as A, on as E, off as I } from "ph-utils/dom";
|
|
4
4
|
import { random as p } from "ph-utils";
|
|
@@ -13,7 +13,7 @@ class T extends y {
|
|
|
13
13
|
this._removeEvents(), this.root.innerHTML = this._renderItems(e), this._initEvents();
|
|
14
14
|
}
|
|
15
15
|
constructor() {
|
|
16
|
-
super(!1),
|
|
16
|
+
super(!1), $(this);
|
|
17
17
|
}
|
|
18
18
|
connectedCallback() {
|
|
19
19
|
super.connectedCallback(), this.loadStyleText(w), this._initEvents();
|
package/lib/switch/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { on as c, off as h, addClass as o, removeClass as l, $one as i } from "ph-utils/dom";
|
|
2
2
|
import n from "../form/form_inner.js";
|
|
3
3
|
import { initAttr as a, parseAttrValue as r } from "../utils/index.js";
|
|
4
|
-
const d = ":host{display:inline-flex}:host{--l-switch-height: 22px;--l-switch-width: 40px;display:inline-flex;box-sizing:border-box;width:var(--l-switch-width);height:var(--l-switch-height);align-items:center;justify-content:flex-start;background-color:#dcdfe6;border-radius:calc(var(--l-switch-height) / 2);padding:2px;position:relative;cursor:pointer;transition:all .3s ease-in-out;vertical-align:middle;border:1px solid #c2c2c2}:host(:hover),:host(.l-switch--checked):hover{border-color:var(--l-primary-color, #722ed1)}:host(.l-switch--checked){background-color:var(--l-primary-color, #722ed1);border-color:var(--l-primary-color, #722ed1)}.l-switch-action{position:absolute;width:calc(var(--l-switch-height) - 6px);top:2px;left:2px;bottom:2px;background-color:#fff;border-radius:50%;transition:all .3s ease-in-out;display:flex;justify-content:center;align-items:center;padding:2px;font-size:12px;box-sizing:border-box}.l-switch-text{color:#fff;padding-left:calc(var(--l-switch-width) - 20px);transition:padding-left .3s ease-in-out}:host(.l-switch--checked) .l-switch-action{left:calc(var(--l-switch-width) - var(--l-switch-height) + 3px)}:host(.l-switch--checked) .l-switch-text{padding-left:5px}";
|
|
4
|
+
const d = ":host{display:inline-flex;width:auto}:host{--l-switch-height: 22px;--l-switch-width: 40px;display:inline-flex;box-sizing:border-box;width:var(--l-switch-width);height:var(--l-switch-height);align-items:center;justify-content:flex-start;background-color:#dcdfe6;border-radius:calc(var(--l-switch-height) / 2);padding:2px;position:relative;cursor:pointer;transition:all .3s ease-in-out;vertical-align:middle;border:1px solid #c2c2c2}:host(:hover),:host(.l-switch--checked):hover{border-color:var(--l-primary-color, #722ed1)}:host(.l-switch--checked){background-color:var(--l-primary-color, #722ed1);border-color:var(--l-primary-color, #722ed1)}.l-switch-action{position:absolute;width:calc(var(--l-switch-height) - 6px);top:2px;left:2px;bottom:2px;background-color:#fff;border-radius:50%;transition:all .3s ease-in-out;display:flex;justify-content:center;align-items:center;padding:2px;font-size:12px;box-sizing:border-box}.l-switch-text{color:#fff;padding-left:calc(var(--l-switch-width) - 20px);transition:padding-left .3s ease-in-out}:host(.l-switch--checked) .l-switch-action{left:calc(var(--l-switch-width) - var(--l-switch-height) + 3px)}:host(.l-switch--checked) .l-switch-text{padding-left:5px}";
|
|
5
5
|
class w extends n {
|
|
6
6
|
static baseName = "switch";
|
|
7
7
|
actionRender;
|
package/lib/theme/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import l from "../base.js";
|
|
|
2
2
|
import { initAttr as c } from "../utils/index.js";
|
|
3
3
|
import { create as i, $one as r, on as o, off as s } from "ph-utils/dom";
|
|
4
4
|
import { getTheme as h, applyTheme as a } from "ph-utils/theme";
|
|
5
|
-
const u = ":host{display:inline-flex}.l-theme-btn::part(default){--l-btn-background: transparent;--l-btn-hover-background: transparent;--l-btn-text-color: #9ca3af;--l-btn-hover-text-color: #666666;width:var(--l-form-edit-height, 32px);padding:0;font-size:18px}.l-theme-switch.l-switch--checked{background-color:#65757129;border-color:#3c3f44}.l-theme-switch.l-switch--checked::part(action){background-color:#000;color:#fff}html.dark .l-theme-btn{--l-btn-hover-text-color: #ffffff}", d = [
|
|
5
|
+
const u = ":host{display:inline-flex;width:auto}.l-theme-btn::part(default){--l-btn-background: transparent;--l-btn-hover-background: transparent;--l-btn-text-color: #9ca3af;--l-btn-hover-text-color: #666666;width:var(--l-form-edit-height, 32px);padding:0;font-size:18px}.l-theme-switch.l-switch--checked{background-color:#65757129;border-color:#3c3f44}.l-theme-switch.l-switch--checked::part(action){background-color:#000;color:#fff}html.dark .l-theme-btn{--l-btn-hover-text-color: #ffffff}", d = [
|
|
6
6
|
{ value: "auto", text: "跟随系统", icon: "l-theme-default-icon" },
|
|
7
7
|
{ value: "light", text: "浅色模式", icon: "l-sun-icon" },
|
|
8
8
|
{ value: "dark", text: "深色模式", icon: "l-moon-icon" }
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
type EventName = "attributeChanged" | "formSubmitted" | "ruleChange" | "valueChange" | "validateChange" | "reset" | "submit";
|
|
2
1
|
/**
|
|
3
2
|
* 添加表单事件监听器。
|
|
4
3
|
* @param formId - 表单的唯一标识符。
|
|
5
|
-
* @param event -
|
|
4
|
+
* @param event - 要监听的事件类型
|
|
6
5
|
* @param cb - 当事件触发时调用的回调函数,接收两个参数:属性名和属性值。
|
|
7
6
|
* 该函数用于将回调函数添加到指定表单ID的事件监听器集合中。
|
|
8
7
|
*/
|
|
9
|
-
export declare function add(
|
|
8
|
+
export declare function add(channel: string, event: string, cb: (...param: any) => void): void;
|
|
10
9
|
/**
|
|
11
10
|
* 移除指定表单的事件监听器。
|
|
12
11
|
* @param formId - 表单的唯一标识符。
|
|
@@ -15,18 +14,17 @@ export declare function add(id: string, event: EventName, cb: (...param: any) =>
|
|
|
15
14
|
* 该函数会从事件存储中移除指定的回调函数,如果某个事件类型下没有更多的回调函数,则删除该事件类型;
|
|
16
15
|
* 如果表单下没有更多的事件类型,则删除该表单;如果事件存储为空,则重置事件存储。
|
|
17
16
|
*/
|
|
18
|
-
export declare function remove(
|
|
17
|
+
export declare function remove(channel: string, event: string, cb: (...params: any) => void): void;
|
|
19
18
|
/**
|
|
20
19
|
* 清除事件存储。如果提供了ID,则删除特定ID的事件;如果没有提供ID,则清除所有事件。
|
|
21
20
|
* 当事件存储为空时,将其设置为undefined。
|
|
22
21
|
* @param id 可选参数,指定要删除的事件ID。
|
|
23
22
|
*/
|
|
24
|
-
export declare function clear(
|
|
23
|
+
export declare function clear(channel?: string): void;
|
|
25
24
|
/**
|
|
26
25
|
* 触发指定表单的事件,并执行所有注册的回调函数。
|
|
27
26
|
* @param id - 表单的唯一标识符。
|
|
28
27
|
* @param event - 要触发的事件名称。
|
|
29
28
|
* @param params - 要传递给回调函数的参数列表。
|
|
30
29
|
*/
|
|
31
|
-
export declare function emit(
|
|
32
|
-
export {};
|
|
30
|
+
export declare function emit(channel: string, event: string, ...params: any): void;
|