litos-ui 0.17.4 → 0.18.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/README.md +49 -49
- package/lib/animation-CTt9qgA7.js +4 -0
- package/lib/base-Dm0WS1pK.js +62 -0
- package/lib/base.js +111 -147
- package/lib/button/index.d.ts +8 -3
- package/lib/button/index.js +2 -137
- package/lib/button-CC5PmAb1.js +146 -0
- package/lib/calendar/index.d.ts +15 -4
- package/lib/calendar/index.js +2 -95
- package/lib/calendar-DeP6yZB0.js +149 -0
- package/lib/carousel/index.js +2 -280
- package/lib/carousel/item.js +2 -15
- package/lib/carousel-D4Fe3LEx.js +272 -0
- package/lib/check/checkbox.js +2 -18
- package/lib/check/checkbox_group.js +6 -6
- package/lib/check/radio.js +2 -15
- package/lib/check/radio_group.js +9 -9
- package/lib/check-B0XraJvb.js +73 -0
- package/lib/check-CvGaONEx.js +117 -0
- package/lib/checkbox-DbWsmAaL.js +16 -0
- package/lib/collapse/index.d.ts +18 -11
- package/lib/collapse/index.js +2 -88
- package/lib/collapse/item.d.ts +28 -9
- package/lib/collapse/item.js +2 -115
- package/lib/collapse/types.d.ts +7 -0
- package/lib/collapse-CeKRZ-43.js +104 -0
- package/lib/color_picker/index.js +2 -42
- package/lib/color_picker-D0brKFm-.js +41 -0
- package/lib/date_picker/index.d.ts +23 -0
- package/lib/date_picker/index.js +3 -0
- package/lib/date_picker-DQGoiN8v.js +103 -0
- package/lib/date_picker_ori/index.js +2 -129
- package/lib/date_picker_ori-aRuSSi9D.js +122 -0
- package/lib/description_panel/index.js +2 -66
- package/lib/description_panel-Df_8rVbX.js +57 -0
- package/lib/dialog/dialog_container.js +2 -131
- package/lib/dialog/index.js +67 -85
- package/lib/dialog_container-DcN87wj0.js +126 -0
- package/lib/esm-sVEoAVPu.js +244 -0
- package/lib/form/form_item.d.ts +1 -0
- package/lib/form/form_item.js +2 -136
- package/lib/form/index.js +2 -147
- package/lib/form-DdU0yK0k.js +154 -0
- package/lib/form_inner-DR9tyB_r.js +117 -0
- package/lib/form_item-Bv-YafZK.js +137 -0
- package/lib/icon/arrow_down.js +12 -12
- package/lib/icon/arrow_left.js +9 -9
- package/lib/icon/arrow_right.js +9 -9
- package/lib/icon/arrow_up.js +12 -12
- package/lib/icon/base.d.ts +16 -2
- package/lib/icon/base.js +2 -38
- package/lib/icon/calendar.d.ts +5 -0
- package/lib/icon/calendar.js +10 -0
- package/lib/icon/caret_bottom.js +9 -9
- package/lib/icon/caret_top.js +9 -9
- package/lib/icon/close.js +9 -9
- package/lib/icon/close_filled.js +12 -12
- package/lib/icon/d_arrow_left.js +12 -12
- package/lib/icon/d_arrow_right.js +12 -12
- package/lib/icon/font_icon.d.ts +2 -3
- package/lib/icon/font_icon.js +35 -39
- package/lib/icon/info.js +12 -12
- package/lib/icon/loading.js +9 -9
- package/lib/icon/moon.js +12 -12
- package/lib/icon/more.js +12 -12
- package/lib/icon/reduction.js +12 -12
- package/lib/icon/refresh.d.ts +5 -0
- package/lib/icon/refresh.js +10 -0
- package/lib/icon/refresh_left.js +12 -12
- package/lib/icon/refresh_right.js +9 -9
- package/lib/icon/search.js +9 -9
- package/lib/icon/select.js +12 -12
- package/lib/icon/sort.js +9 -9
- package/lib/icon/success.js +12 -12
- package/lib/icon/sun.js +12 -12
- package/lib/icon/theme_default.js +12 -12
- package/lib/icon/warn.js +12 -12
- package/lib/icon/zoom_in.js +12 -12
- package/lib/icon/zoom_out.js +12 -12
- package/lib/image/image_preview.js +2 -104
- package/lib/image/index.js +2 -176
- package/lib/image-CeQVfS-v.js +162 -0
- package/lib/image_preview-PzZzwo6m.js +92 -0
- package/lib/index.d.ts +10 -4
- package/lib/index.js +80 -169
- package/lib/input/index.d.ts +6 -2
- package/lib/input/index.js +188 -203
- package/lib/input-DjKxcxry.js +4 -0
- package/lib/input_inner-BKJg9n9A.js +4 -0
- package/lib/item-Cuw_ZPyn.js +14 -0
- package/lib/item-DV842Aux.js +57 -0
- package/lib/item-ZXLWFzSm.js +119 -0
- package/lib/list/index.js +2 -58
- package/lib/list-CU7vHS6s.js +51 -0
- package/lib/loading/index.d.ts +4 -2
- package/lib/loading/index.js +109 -123
- package/lib/mask/index.js +2 -105
- package/lib/mask-BlV5QfTj.js +112 -0
- package/lib/md_input/index.js +2 -60
- package/lib/md_input-DSQx5TMW.js +58 -0
- package/lib/menu/index.js +2 -105
- package/lib/menu/menu_item.js +2 -21
- package/lib/menu/sub_menu.js +2 -83
- package/lib/menu-DAtplYAH.js +91 -0
- package/lib/menu_item-BW1Tu11Q.js +20 -0
- package/lib/message/index.js +67 -60
- package/lib/modal/index.js +2 -196
- package/lib/modal/modal_box.js +87 -86
- package/lib/modal-DWyWrN-D.js +192 -0
- package/lib/page_header/index.js +2 -109
- package/lib/page_header-DdeRDN4U.js +101 -0
- package/lib/pagination/index.js +2 -248
- package/lib/pagination-BoPzSPjT.js +210 -0
- package/lib/polygon/index.js +2 -27
- package/lib/polygon-C4Ow2lxi.js +20 -0
- package/lib/qrcode/index.d.ts +13 -4
- package/lib/qrcode/index.js +2 -57
- package/lib/qrcode-BFxsD_OP.js +64 -0
- package/lib/radio-2mNSYujz.js +13 -0
- package/lib/select/index.js +3 -401
- package/lib/select-CAgggYh7.js +326 -0
- package/lib/select_ori/index.js +47 -50
- package/lib/space/index.js +2 -35
- package/lib/space-CpTmBfHP.js +38 -0
- package/lib/sub_menu-D1s8ABNu.js +75 -0
- package/lib/switch/index.js +2 -50
- package/lib/switch-BaVBi5Ip.js +48 -0
- package/lib/tabbar/index.js +2 -109
- package/lib/tabbar/item.js +2 -58
- package/lib/tabbar-4_d2Fj1n.js +91 -0
- package/lib/table/index.js +2 -269
- package/lib/table-Hifj8jAX.js +234 -0
- package/lib/tabs/index.js +38 -42
- package/lib/tag/index.js +2 -72
- package/lib/tag-DPENZf_V.js +76 -0
- package/lib/theme/index.js +2 -89
- package/lib/theme/theme_color.js +22 -26
- package/lib/theme-BRTI2-Yk.js +83 -0
- package/lib/utils/clickoutside.js +18 -18
- package/lib/utils/context_provide.js +21 -21
- package/lib/utils/event.js +13 -18
- package/lib/utils/index.js +55 -58
- package/lib/utils/popover.d.ts +4 -1
- package/lib/utils/popover.js +276 -352
- package/lib/utils/transition.js +33 -31
- package/package.json +10 -11
- package/styles/container.css +4 -0
- package/styles/datepicker.css +55 -0
- package/styles/popover.css +14 -1
- package/lib/animation-DttknHkX.js +0 -4
- package/lib/calendar/langs.js +0 -8
- package/lib/carousel/timer.js +0 -19
- package/lib/check/check.js +0 -118
- package/lib/check/index.js +0 -68
- package/lib/check-CksURvTv.js +0 -4
- package/lib/form/form_inner.js +0 -125
- package/lib/form/types.js +0 -1
- package/lib/index-CrMiSe0x.js +0 -249
- package/lib/index-DY6m9Wbe.js +0 -4
- package/lib/litos-ui.css +0 -1
- package/lib/table/types.js +0 -1
package/lib/utils/transition.js
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { $ as e, iterate as t, transition as n } from "ph-utils/dom";
|
|
2
|
+
//#region src/components/utils/transition.ts
|
|
3
|
+
function r() {
|
|
4
|
+
let r, i = {
|
|
5
|
+
attributes: !0,
|
|
6
|
+
attributeFilter: ["l-transition-emit"]
|
|
7
|
+
}, a = (e) => {
|
|
8
|
+
for (let t of e) if (t.type === "attributes" && t.attributeName) {
|
|
9
|
+
let e = t.target, r = e.getAttribute(t.attributeName) || "show", i = e.getAttribute("l-transition") || "l", a = e.getAttribute("l-transition-method") || "hide";
|
|
10
|
+
i && (r === "show" ? (e.style.removeProperty("display"), n(e, i, "enter")) : n(e, i, "leave", () => {
|
|
11
|
+
a === "remove" ? e.remove() : e.style.display = "none";
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
function o(e) {
|
|
16
|
+
e && e.length > 0 && (r ??= new MutationObserver(a), t(e, (e) => {
|
|
17
|
+
let t = e.getAttribute("l-transition");
|
|
18
|
+
t && (n(e, t, "enter"), r.observe(e, i));
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
function s(t) {
|
|
22
|
+
t ?? (t = e("[l-transition]"), o(t));
|
|
23
|
+
}
|
|
24
|
+
function c() {
|
|
25
|
+
r &&= (r.disconnect(), void 0);
|
|
26
|
+
}
|
|
27
|
+
return {
|
|
28
|
+
destroy: c,
|
|
29
|
+
add: o,
|
|
30
|
+
init: s
|
|
31
|
+
};
|
|
29
32
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { r as createTransition };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "litos-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "基于 Web Component 的 UI 组件库",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"component library",
|
|
@@ -49,19 +49,18 @@
|
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"alien-signals": "^3.1.2",
|
|
51
51
|
"iconify-icon": "^3.0.2",
|
|
52
|
-
"ph-utils": "^0.
|
|
52
|
+
"ph-utils": "^0.18.0",
|
|
53
53
|
"qrcode-generator-es": "^2.1.2",
|
|
54
|
-
"shiki": "^
|
|
54
|
+
"shiki": "^4.0.2"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@types/node": "^25.
|
|
58
|
-
"less": "^4.
|
|
59
|
-
"lightningcss": "^1.
|
|
60
|
-
"oxfmt": "^0.
|
|
61
|
-
"oxlint": "^1.
|
|
62
|
-
"typescript": "^
|
|
63
|
-
"vite": "^
|
|
64
|
-
"vite-plugin-dts": "^4.5.4",
|
|
57
|
+
"@types/node": "^25.6.0",
|
|
58
|
+
"less": "^4.6.4",
|
|
59
|
+
"lightningcss": "^1.32.0",
|
|
60
|
+
"oxfmt": "^0.45.0",
|
|
61
|
+
"oxlint": "^1.60.0",
|
|
62
|
+
"typescript": "^6.0.2",
|
|
63
|
+
"vite": "^8.0.8",
|
|
65
64
|
"vitepress": "^1.6.4"
|
|
66
65
|
}
|
|
67
66
|
}
|
package/styles/container.css
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
box-sizing: border-box;
|
|
24
24
|
width: var(--l-aside-width);
|
|
25
25
|
flex-shrink: 0;
|
|
26
|
+
min-width: 0;
|
|
26
27
|
border-right: 1px solid #dedede;
|
|
27
28
|
padding: 10px;
|
|
28
29
|
}
|
|
@@ -35,12 +36,14 @@
|
|
|
35
36
|
flex-shrink: 0;
|
|
36
37
|
justify-content: space-between;
|
|
37
38
|
height: var(--l-header-height);
|
|
39
|
+
min-height: 0;
|
|
38
40
|
}
|
|
39
41
|
.l-footer {
|
|
40
42
|
padding: 10px;
|
|
41
43
|
box-sizing: border-box;
|
|
42
44
|
border-top: 1px solid #dedede;
|
|
43
45
|
height: var(--l-footer-height);
|
|
46
|
+
min-height: 0;
|
|
44
47
|
}
|
|
45
48
|
.l-main {
|
|
46
49
|
width: 100%;
|
|
@@ -49,4 +52,5 @@
|
|
|
49
52
|
padding: 10px;
|
|
50
53
|
flex-grow: 1;
|
|
51
54
|
--webkit-overflow-scrolling: touch;
|
|
55
|
+
min-width: 0;
|
|
52
56
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.l-date-picker-panel {
|
|
2
|
+
border-radius: 5px;
|
|
3
|
+
width: 270px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.l-date-picker--header {
|
|
7
|
+
display: flex;
|
|
8
|
+
padding: 0 8px;
|
|
9
|
+
color: rgba(0, 0, 0, 0.88);
|
|
10
|
+
border-bottom: 1px solid rgba(5, 5, 5, 0.06);
|
|
11
|
+
height: var(--l-date-picker-header-height, 40px);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.l-date-picker--footer {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
justify-content: flex-end;
|
|
18
|
+
padding: 8px;
|
|
19
|
+
border-top: 1px solid rgba(5, 5, 5, 0.06);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.l-date-picker-header-btn {
|
|
23
|
+
outline: none;
|
|
24
|
+
padding: 0;
|
|
25
|
+
width: 22px;
|
|
26
|
+
height: 100%;
|
|
27
|
+
display: inline-flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
color: var(--l-date-picker-button-color, inherit);
|
|
31
|
+
transition: color 0.3s;
|
|
32
|
+
flex-shrink: 0;
|
|
33
|
+
min-width: 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.l-date-picker-header-btn:hover {
|
|
37
|
+
--l-date-picker-button-color: var(--l-primary-color-light1, #3399ff);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.l-date-picker-header-btn:active {
|
|
41
|
+
--l-date-picker-button-color: var(--l-primary-color, #007bff);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.l-date-picker-year-month {
|
|
45
|
+
flex-grow: 1;
|
|
46
|
+
width: auto;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.l-date-picker--body {
|
|
50
|
+
padding: 4px 10px 8px 10px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.l-date-picker--calendar {
|
|
54
|
+
height: 240px;
|
|
55
|
+
}
|
package/styles/popover.css
CHANGED
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
display: none;
|
|
18
18
|
z-index: 300;
|
|
19
19
|
line-height: 1;
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
}
|
|
22
|
+
|
|
22
23
|
.l-popover-arrow {
|
|
23
24
|
position: absolute;
|
|
24
25
|
background: var(--l-popover-background);
|
|
@@ -27,6 +28,7 @@
|
|
|
27
28
|
transform: rotate(45deg);
|
|
28
29
|
box-sizing: border-box;
|
|
29
30
|
}
|
|
31
|
+
|
|
30
32
|
/* tooltip */
|
|
31
33
|
.l-popover.l-popover--tooltip {
|
|
32
34
|
--l-popover-color: #fff;
|
|
@@ -41,15 +43,18 @@
|
|
|
41
43
|
.l-popover--popconfirm {
|
|
42
44
|
min-width: 150px;
|
|
43
45
|
}
|
|
46
|
+
|
|
44
47
|
.l-popover--popconfirm .l-popconfirm-container {
|
|
45
48
|
display: flex;
|
|
46
49
|
align-items: center;
|
|
47
50
|
}
|
|
51
|
+
|
|
48
52
|
.l-popover--popconfirm .l-popconfirm-icon-wrapper {
|
|
49
53
|
margin-right: 10px;
|
|
50
54
|
display: inline-flex;
|
|
51
55
|
color: var(--l-warn-color, #f90);
|
|
52
56
|
}
|
|
57
|
+
|
|
53
58
|
.l-popover--popconfirm .l-popconfirm-footer {
|
|
54
59
|
display: flex;
|
|
55
60
|
align-items: center;
|
|
@@ -57,10 +62,18 @@
|
|
|
57
62
|
margin-top: 7px;
|
|
58
63
|
gap: 7px;
|
|
59
64
|
}
|
|
65
|
+
|
|
60
66
|
.l-popover--popconfirm .l-popconfirm-btn {
|
|
61
67
|
height: 24px;
|
|
62
68
|
}
|
|
69
|
+
|
|
63
70
|
.l-popover--popconfirm .l-popconfirm-btn::part(default) {
|
|
64
71
|
padding: 0 6px;
|
|
65
72
|
font-size: 13px;
|
|
66
73
|
}
|
|
74
|
+
|
|
75
|
+
.l-popover--tooltip,
|
|
76
|
+
.l-popover--popconfirm,
|
|
77
|
+
.l-popover--default {
|
|
78
|
+
padding: 10px;
|
|
79
|
+
}
|
package/lib/calendar/langs.js
DELETED
package/lib/carousel/timer.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
function o(a, l = 3e3) {
|
|
2
|
-
let n = 0, t = !1, e = null;
|
|
3
|
-
function u() {
|
|
4
|
-
t || (t = !0, n = 0, e = requestAnimationFrame(r));
|
|
5
|
-
}
|
|
6
|
-
function f() {
|
|
7
|
-
t = !1, e && (cancelAnimationFrame(e), e = null);
|
|
8
|
-
}
|
|
9
|
-
function r(i) {
|
|
10
|
-
t && (n || (n = i), i - n >= l && (a(), n = i), e = requestAnimationFrame(r));
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
start: u,
|
|
14
|
-
stop: f
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
o as default
|
|
19
|
-
};
|
package/lib/check/check.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { e as l } from "../index-CrMiSe0x.js";
|
|
2
|
-
import d from "../form/form_inner.js";
|
|
3
|
-
import { stopSignal as o, parseAttrValue as c } from "../utils/index.js";
|
|
4
|
-
import { addClass as n, on as u, off as p, $$ as i, removeClass as r, toggleClass as k } from "ph-utils/dom";
|
|
5
|
-
class f extends d {
|
|
6
|
-
/** 是否选中 */
|
|
7
|
-
_checked;
|
|
8
|
-
_inputType;
|
|
9
|
-
// input类型
|
|
10
|
-
$input;
|
|
11
|
-
_groupCtx;
|
|
12
|
-
_groupCtxStop;
|
|
13
|
-
setChecked(e) {
|
|
14
|
-
this._checked = e, this.checkedChange();
|
|
15
|
-
}
|
|
16
|
-
getChecked() {
|
|
17
|
-
return this._checked;
|
|
18
|
-
}
|
|
19
|
-
constructor() {
|
|
20
|
-
super(), this._checked = !1, this._inputType = "radio", Object.defineProperty(this, "checked", {
|
|
21
|
-
configurable: !0,
|
|
22
|
-
enumerable: !0,
|
|
23
|
-
get: this.getChecked,
|
|
24
|
-
set: this.setChecked
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
static get observedAttributes() {
|
|
28
|
-
return ["checked", "label", "button", "indeterminate", ...d.observedAttributes];
|
|
29
|
-
}
|
|
30
|
-
connectedCallback() {
|
|
31
|
-
super.connectedCallback(), this.getChecked() && this.setChecked(!0), this.isDisabled() && n(this, "is-disabled"), this._updateIndeterminate(), this.emitInject("check-context-request", (e) => {
|
|
32
|
-
this._groupCtx = e;
|
|
33
|
-
}), this._groupCtxStop = l(() => {
|
|
34
|
-
if (this.value == null) return;
|
|
35
|
-
const e = this._groupCtx ? this._groupCtx() : [];
|
|
36
|
-
this.setChecked(e.includes(this.value));
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
afterInit() {
|
|
40
|
-
u(this, "click", this.#e);
|
|
41
|
-
}
|
|
42
|
-
beforeDestroy() {
|
|
43
|
-
p(this, "click", this.#e), this._groupCtxStop = o(this._groupCtxStop);
|
|
44
|
-
}
|
|
45
|
-
render() {
|
|
46
|
-
const e = document.createDocumentFragment(), s = i("input", {
|
|
47
|
-
type: this._inputType,
|
|
48
|
-
class: "l-check__input",
|
|
49
|
-
name: this.getName(),
|
|
50
|
-
value: this.value,
|
|
51
|
-
checked: this.getChecked(),
|
|
52
|
-
disabled: this.isDisabled() ? "disabled" : void 0
|
|
53
|
-
});
|
|
54
|
-
if (this.$input = s, e.appendChild(s), !this._state.button) {
|
|
55
|
-
const a = i("span", { class: "l-check__inner" });
|
|
56
|
-
e.appendChild(a);
|
|
57
|
-
}
|
|
58
|
-
const t = i("label", {
|
|
59
|
-
class: "l-check__label",
|
|
60
|
-
part: "label"
|
|
61
|
-
}), h = i("slot", {
|
|
62
|
-
textContent: this._state.label
|
|
63
|
-
});
|
|
64
|
-
return t.appendChild(h), e.appendChild(t), e;
|
|
65
|
-
}
|
|
66
|
-
attributeChange(e, s, t) {
|
|
67
|
-
switch (e) {
|
|
68
|
-
case "checked":
|
|
69
|
-
const h = c(t, !1, "checked");
|
|
70
|
-
this.setChecked(h);
|
|
71
|
-
break;
|
|
72
|
-
case "button":
|
|
73
|
-
this._state[e] = c(t, !1, e);
|
|
74
|
-
break;
|
|
75
|
-
case "indeterminate":
|
|
76
|
-
const a = c(t, !1, e);
|
|
77
|
-
this._state.indeterminate = a, this._updateIndeterminate();
|
|
78
|
-
break;
|
|
79
|
-
case "label":
|
|
80
|
-
this._state.label = t;
|
|
81
|
-
break;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
checkedChange() {
|
|
85
|
-
this.getChecked() ? n(this, "is-checked") : r(this, "is-checked"), this.$input && (this.$input.checked = this.getChecked());
|
|
86
|
-
}
|
|
87
|
-
disabledChange() {
|
|
88
|
-
k(this, "is-disabled"), this.$input && (this.$input.disabled = this.isDisabled());
|
|
89
|
-
}
|
|
90
|
-
_updateIndeterminate() {
|
|
91
|
-
this._state.indeterminate ? n(this, "is-indeterminate") : r(this, "is-indeterminate");
|
|
92
|
-
}
|
|
93
|
-
#e = () => {
|
|
94
|
-
if (!this.isDisabled())
|
|
95
|
-
if (this.value && this._groupCtx)
|
|
96
|
-
this.emitChange();
|
|
97
|
-
else {
|
|
98
|
-
const e = this._inputType === "radio" ? !0 : !this.getChecked();
|
|
99
|
-
this.setChecked(e), this.emitChange();
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
emitChange() {
|
|
103
|
-
this.emit("change", {
|
|
104
|
-
detail: {
|
|
105
|
-
value: this.value,
|
|
106
|
-
name: this.getName(),
|
|
107
|
-
checked: this.getChecked()
|
|
108
|
-
},
|
|
109
|
-
composed: !0,
|
|
110
|
-
bubbles: !0
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
_doChangeAction() {
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
export {
|
|
117
|
-
f as default
|
|
118
|
-
};
|
package/lib/check/index.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import h from "../form/form_inner.js";
|
|
2
|
-
import { on as a, off as l, $$ as r } from "ph-utils/dom";
|
|
3
|
-
import { unitNumberStr as u } from "../utils/index.js";
|
|
4
|
-
import { s as c } from "../index-CrMiSe0x.js";
|
|
5
|
-
const o = ":host{display:flex;align-items:center;gap:var(--l-check-gap, 0px)}";
|
|
6
|
-
class f extends h {
|
|
7
|
-
values;
|
|
8
|
-
multiple;
|
|
9
|
-
_state;
|
|
10
|
-
setValue(e) {
|
|
11
|
-
super.setValue(e), this.rendered && this.updateChecked();
|
|
12
|
-
}
|
|
13
|
-
constructor() {
|
|
14
|
-
super(!1), this.multiple = !0, this.values = c([]), this._state = {};
|
|
15
|
-
}
|
|
16
|
-
static get observedAttributes() {
|
|
17
|
-
return ["disabled", "value", "name", "inner-block", "gap"];
|
|
18
|
-
}
|
|
19
|
-
attributeChange(e, s, t) {
|
|
20
|
-
e === "gap" && (this._state.gap = u(t));
|
|
21
|
-
}
|
|
22
|
-
updateDOM(e) {
|
|
23
|
-
e.has("gap") && this._updateGap();
|
|
24
|
-
}
|
|
25
|
-
connectedCallback() {
|
|
26
|
-
this.loadStyleText([o]), this.updateChecked(), super.connectedCallback(), this._updateGap();
|
|
27
|
-
}
|
|
28
|
-
afterInit() {
|
|
29
|
-
a(this.root, "change", this.#e), a(this, "check-context-request", this._privide);
|
|
30
|
-
}
|
|
31
|
-
beforeDestroy() {
|
|
32
|
-
l(this.root, "change", this.#e), l(this, "check-context-request", this._privide), this.values([]);
|
|
33
|
-
}
|
|
34
|
-
render() {
|
|
35
|
-
return r("slot");
|
|
36
|
-
}
|
|
37
|
-
_privide = (e) => {
|
|
38
|
-
const { context: s, callback: t } = e.detail;
|
|
39
|
-
s === "check-context-request" && t(this.values);
|
|
40
|
-
};
|
|
41
|
-
_updateGap = () => {
|
|
42
|
-
this._state.gap ? this.style.setProperty("--l-check-gap", this._state.gap) : this.style.removeProperty("--l-check-gap");
|
|
43
|
-
};
|
|
44
|
-
#e = (e) => {
|
|
45
|
-
e.stopPropagation();
|
|
46
|
-
const s = e.detail.value, t = this.values();
|
|
47
|
-
let i = t.indexOf(s);
|
|
48
|
-
this.multiple ? (i !== -1 ? t.splice(i, 1) : t.push(s), this.setAttribute("value", t.join("&"))) : i === -1 && this.setAttribute("value", s), this.emit("change", {
|
|
49
|
-
detail: { value: this.multiple ? t : s },
|
|
50
|
-
composed: !0
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
updateChecked() {
|
|
54
|
-
let e = [];
|
|
55
|
-
if (this.value)
|
|
56
|
-
if (this.multiple) {
|
|
57
|
-
const s = this.value.split("&");
|
|
58
|
-
e.push(...s.map((t) => decodeURIComponent(t)));
|
|
59
|
-
} else
|
|
60
|
-
e = [this.value];
|
|
61
|
-
else
|
|
62
|
-
e = [];
|
|
63
|
-
this.values(e);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export {
|
|
67
|
-
f as default
|
|
68
|
-
};
|
package/lib/check-CksURvTv.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const r = ":host{--l-check-size: 14px;display:inline-flex;align-items:center;position:relative;cursor:pointer;width:auto;outline:none;transition:color .3s,border-color .3s,background-color .3s}.l-check__input{margin:0;position:absolute;z-index:-1;width:0;height:0;opacity:0}.l-check__inner{width:var(--l-check-size, 14px);height:var(--l-check-size, 14px);display:flex;justify-content:center;align-items:center;border-radius:3px;border:1px solid #dcddd9;box-sizing:border-box;transition:border-color .3s ease-in-out;position:relative;margin-right:5px;flex-shrink:0}.l-check__label{transition:color .3s;cursor:inherit;line-height:1}:host(.is-checked){color:var(--l-primary-color, #722ed1)}:host(.is-checked) .l-check__inner{border-color:var(--l-primary-color, #722ed1)}:host(.is-disabled){cursor:not-allowed}:host(.is-disabled) .l-check__label{color:var(--l-disabled-color, #e6e6e6)}:host([button]){height:var(--l-form-control-height, 32px);justify-content:center;padding:0 15px;border:1px solid #c0c4cc;border-left-width:0;margin-left:0;border-radius:inherit}:host([button]:first-child){border-left-width:1px;border-top-left-radius:3px;border-bottom-left-radius:3px}:host([button]:last-child){border-top-right-radius:3px;border-bottom-right-radius:3px}:host([button].is-checked){background-color:var(--l-primary-color, #722ed1);color:#fff;border-color:var(--l-primary-color, #722ed1);border-right-color:#fff}:host([button].is-checked:last-child){border-right-color:var(--l-primary-color, #722ed1)}";
|
|
2
|
-
export {
|
|
3
|
-
r as c
|
|
4
|
-
};
|
package/lib/form/form_inner.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import o from "../base.js";
|
|
2
|
-
import { parseAttrValue as a, stopSignal as i } from "../utils/index.js";
|
|
3
|
-
import { getAttr as l } from "ph-utils/dom";
|
|
4
|
-
import { e as n } from "../index-CrMiSe0x.js";
|
|
5
|
-
class _ extends o {
|
|
6
|
-
disabled = !1;
|
|
7
|
-
_value = void 0;
|
|
8
|
-
_resetValue;
|
|
9
|
-
// 重置值(即初始化值)
|
|
10
|
-
_firstPushValue = !0;
|
|
11
|
-
// 初始化时是否推送数据到 Form
|
|
12
|
-
_isReset = !1;
|
|
13
|
-
// 是否是重置, 重置时不触发数据校验
|
|
14
|
-
_name;
|
|
15
|
-
formContext;
|
|
16
|
-
formItemContext;
|
|
17
|
-
formErrors;
|
|
18
|
-
// 表单验证错误
|
|
19
|
-
resetCtx;
|
|
20
|
-
_signalStop;
|
|
21
|
-
_errorSignalStop;
|
|
22
|
-
_resetSignalStop;
|
|
23
|
-
/**
|
|
24
|
-
*
|
|
25
|
-
* @param firstPushValue 是否第一次赋值 value 时, 推送数据到 Form, 默认: true
|
|
26
|
-
* @param delegatesFocus 是否委托焦点, 默认: true
|
|
27
|
-
*/
|
|
28
|
-
constructor(e = !0, t = !0) {
|
|
29
|
-
super(!0, { delegatesFocus: t }), this._firstPushValue = e;
|
|
30
|
-
}
|
|
31
|
-
get name() {
|
|
32
|
-
return this._name;
|
|
33
|
-
}
|
|
34
|
-
set name(e) {
|
|
35
|
-
this._name = e;
|
|
36
|
-
}
|
|
37
|
-
get value() {
|
|
38
|
-
return this._value;
|
|
39
|
-
}
|
|
40
|
-
set value(e) {
|
|
41
|
-
this.setValue(e);
|
|
42
|
-
}
|
|
43
|
-
setValue(e) {
|
|
44
|
-
this._value = e, this._resetValue == null && (this._resetValue = e), this.pushValueChange();
|
|
45
|
-
}
|
|
46
|
-
getValue() {
|
|
47
|
-
return this._value;
|
|
48
|
-
}
|
|
49
|
-
static get observedAttributes() {
|
|
50
|
-
return ["disabled", "value", "name", "inner-block"];
|
|
51
|
-
}
|
|
52
|
-
attributeChanged(e, t, s) {
|
|
53
|
-
switch (e) {
|
|
54
|
-
case "value":
|
|
55
|
-
case "name":
|
|
56
|
-
this[e] = s;
|
|
57
|
-
break;
|
|
58
|
-
case "disabled":
|
|
59
|
-
this.disabled = a(s, !1, e);
|
|
60
|
-
break;
|
|
61
|
-
case "inner-block":
|
|
62
|
-
const r = a(s, !1, e);
|
|
63
|
-
this.innerBlockChange(r);
|
|
64
|
-
break;
|
|
65
|
-
default:
|
|
66
|
-
this.attributeChange(e, t, s);
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
attributeChange(e, t, s) {
|
|
71
|
-
}
|
|
72
|
-
connectedCallback() {
|
|
73
|
-
this.emitInject("form-context-request", this.formInject), this.emitInject("form-item-context-request", this.formItemInject), super.connectedCallback(), this._signalStop = n(() => {
|
|
74
|
-
const e = this.formItemContext ? this.formItemContext() : null, t = this.formContext ? this.formContext() : null;
|
|
75
|
-
if (!this.name && e && e.prop && this.setAttribute("name", e.prop), !l(this, "inner-block")) {
|
|
76
|
-
const r = e?.innerBlock || t?.innerBlock;
|
|
77
|
-
r != null && this.innerBlockChange(r);
|
|
78
|
-
}
|
|
79
|
-
}), this._value == null && (this._resetValue = "", this._firstPushValue && this.pushValueChange()), this._errorSignalStop = n(() => {
|
|
80
|
-
if (!this.name) return;
|
|
81
|
-
const t = (this.formErrors ? this.formErrors() : {})[this.name];
|
|
82
|
-
this.validResult(t);
|
|
83
|
-
}), this._resetSignalStop = n(() => {
|
|
84
|
-
(this.resetCtx ? this.resetCtx() : 0) > 0 && this.reset();
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
disconnectedCallback() {
|
|
88
|
-
super.disconnectedCallback(), this._signalStop = i(this._signalStop), this._errorSignalStop = i(this._errorSignalStop), this._resetSignalStop = i(this._resetSignalStop);
|
|
89
|
-
}
|
|
90
|
-
isDisabled() {
|
|
91
|
-
return this.disabled;
|
|
92
|
-
}
|
|
93
|
-
getName() {
|
|
94
|
-
return this.name;
|
|
95
|
-
}
|
|
96
|
-
disabledChange() {
|
|
97
|
-
}
|
|
98
|
-
innerBlockChange(e) {
|
|
99
|
-
}
|
|
100
|
-
validResult(e) {
|
|
101
|
-
}
|
|
102
|
-
formInject = (e, t, s) => {
|
|
103
|
-
this.formContext = e, this.formErrors = t, this.resetCtx = s;
|
|
104
|
-
};
|
|
105
|
-
formItemInject = (e) => {
|
|
106
|
-
this.formItemContext = e;
|
|
107
|
-
};
|
|
108
|
-
pushValueChange() {
|
|
109
|
-
this.name && this.emit("form-value-change", {
|
|
110
|
-
bubbles: !0,
|
|
111
|
-
composed: !0,
|
|
112
|
-
detail: {
|
|
113
|
-
name: this.name,
|
|
114
|
-
value: this._value,
|
|
115
|
-
valid: !this._isReset
|
|
116
|
-
}
|
|
117
|
-
}), this._isReset = !1;
|
|
118
|
-
}
|
|
119
|
-
reset() {
|
|
120
|
-
this._isReset = !0, this.value = this._resetValue || "";
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
export {
|
|
124
|
-
_ as default
|
|
125
|
-
};
|
package/lib/form/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|