mdui 2.0.3 → 2.0.5
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/components/avatar/index.d.ts +13 -13
- package/components/avatar/index.js +11 -6
- package/components/avatar/style.js +31 -1
- package/components/badge/index.d.ts +7 -6
- package/components/badge/index.js +6 -5
- package/components/badge/style.js +25 -1
- package/components/bottom-app-bar/index.d.ts +4 -3
- package/components/bottom-app-bar/index.js +3 -3
- package/components/bottom-app-bar/style.js +92 -1
- package/components/button/button-base-style.js +28 -1
- package/components/button/button-base.d.ts +43 -44
- package/components/button/button-base.js +28 -21
- package/components/button/index.d.ts +13 -13
- package/components/button/index.js +30 -20
- package/components/button/style.js +111 -2
- package/components/button-icon/index.d.ts +8 -8
- package/components/button-icon/index.js +29 -12
- package/components/button-icon/style.js +103 -2
- package/components/card/index.d.ts +8 -8
- package/components/card/index.js +12 -8
- package/components/card/style.js +72 -1
- package/components/checkbox/index.d.ts +20 -20
- package/components/checkbox/index.js +68 -25
- package/components/checkbox/style.js +131 -1
- package/components/chip/index.d.ts +19 -19
- package/components/chip/index.js +49 -25
- package/components/chip/style.js +205 -2
- package/components/circular-progress/index.d.ts +2 -2
- package/components/circular-progress/index.js +40 -6
- package/components/circular-progress/style.js +136 -1
- package/components/collapse/collapse-item-style.js +21 -1
- package/components/collapse/collapse-item.d.ts +4 -4
- package/components/collapse/collapse-item.js +12 -4
- package/components/collapse/collapse-style.js +5 -1
- package/components/collapse/collapse.d.ts +6 -9
- package/components/collapse/collapse.js +8 -5
- package/components/dialog/index.d.ts +13 -13
- package/components/dialog/index.js +48 -20
- package/components/dialog/style.js +116 -1
- package/components/divider/index.d.ts +3 -3
- package/components/divider/index.js +3 -3
- package/components/divider/style.js +18 -1
- package/components/dropdown/index.d.ts +35 -35
- package/components/dropdown/index.js +41 -34
- package/components/dropdown/style.js +11 -1
- package/components/fab/index.d.ts +6 -6
- package/components/fab/index.js +19 -11
- package/components/fab/style.js +153 -4
- package/components/icon/index.js +5 -1
- package/components/icon/style.js +29 -1
- package/components/layout/layout-item-style.js +6 -1
- package/components/layout/layout-item.d.ts +7 -7
- package/components/layout/layout-item.js +6 -6
- package/components/layout/layout-main-style.js +7 -1
- package/components/layout/layout-main.d.ts +2 -2
- package/components/layout/layout-main.js +2 -2
- package/components/layout/layout-style.js +11 -1
- package/components/layout/layout.d.ts +2 -2
- package/components/layout/layout.js +2 -2
- package/components/linear-progress/index.d.ts +4 -4
- package/components/linear-progress/index.js +9 -5
- package/components/linear-progress/style.js +73 -1
- package/components/list/list-item-style.js +153 -2
- package/components/list/list-item.d.ts +17 -17
- package/components/list/list-item.js +34 -15
- package/components/list/list-style.js +10 -1
- package/components/list/list-subheader-style.js +19 -1
- package/components/list/list-subheader.d.ts +2 -2
- package/components/list/list-subheader.js +2 -2
- package/components/list/list.d.ts +1 -1
- package/components/list/list.js +1 -1
- package/components/menu/menu-item-style.js +125 -1
- package/components/menu/menu-item.d.ts +4 -4
- package/components/menu/menu-item.js +57 -15
- package/components/menu/menu-style.js +19 -1
- package/components/menu/menu.d.ts +15 -18
- package/components/menu/menu.js +13 -9
- package/components/navigation-bar/navigation-bar-item-style.js +132 -1
- package/components/navigation-bar/navigation-bar-item.d.ts +5 -5
- package/components/navigation-bar/navigation-bar-item.js +27 -11
- package/components/navigation-bar/navigation-bar-style.js +28 -1
- package/components/navigation-bar/navigation-bar.d.ts +9 -8
- package/components/navigation-bar/navigation-bar.js +10 -7
- package/components/navigation-drawer/index.d.ts +19 -20
- package/components/navigation-drawer/index.js +56 -31
- package/components/navigation-drawer/style.js +66 -1
- package/components/navigation-rail/navigation-rail-item-style.js +122 -1
- package/components/navigation-rail/navigation-rail-item.d.ts +6 -6
- package/components/navigation-rail/navigation-rail-item.js +30 -11
- package/components/navigation-rail/navigation-rail-style.js +79 -1
- package/components/navigation-rail/navigation-rail.d.ts +10 -11
- package/components/navigation-rail/navigation-rail.js +19 -11
- package/components/radio/radio-group-style.js +20 -1
- package/components/radio/radio-group.d.ts +13 -13
- package/components/radio/radio-group.js +30 -12
- package/components/radio/radio-style.js +107 -1
- package/components/radio/radio.d.ts +3 -3
- package/components/radio/radio.js +26 -8
- package/components/range-slider/index.d.ts +5 -6
- package/components/range-slider/index.js +57 -10
- package/components/ripple/index.js +5 -2
- package/components/ripple/style.js +96 -1
- package/components/segmented-button/segmented-button-group-style.js +28 -1
- package/components/segmented-button/segmented-button-group.d.ts +17 -20
- package/components/segmented-button/segmented-button-group.js +32 -15
- package/components/segmented-button/segmented-button-style.js +81 -2
- package/components/segmented-button/segmented-button.d.ts +3 -3
- package/components/segmented-button/segmented-button.js +30 -14
- package/components/select/index.d.ts +31 -32
- package/components/select/index.js +106 -26
- package/components/select/style.js +27 -1
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +34 -3
- package/components/slider/slider-base-style.js +173 -1
- package/components/slider/slider-base.d.ts +15 -15
- package/components/slider/slider-base.js +19 -14
- package/components/slider/style.js +7 -1
- package/components/snackbar/index.d.ts +21 -21
- package/components/snackbar/index.js +47 -20
- package/components/snackbar/style.js +100 -1
- package/components/switch/index.d.ts +14 -14
- package/components/switch/index.js +51 -17
- package/components/switch/style.js +202 -1
- package/components/tabs/tab-panel-style.js +10 -1
- package/components/tabs/tab-panel.d.ts +3 -3
- package/components/tabs/tab-panel.js +2 -2
- package/components/tabs/tab-style.js +85 -1
- package/components/tabs/tab.d.ts +6 -6
- package/components/tabs/tab.js +29 -9
- package/components/tabs/tabs-style.js +138 -1
- package/components/tabs/tabs.d.ts +19 -19
- package/components/tabs/tabs.js +26 -18
- package/components/text-field/index.d.ts +51 -51
- package/components/text-field/index.js +185 -57
- package/components/text-field/style.js +362 -1
- package/components/tooltip/index.d.ts +31 -31
- package/components/tooltip/index.js +38 -29
- package/components/tooltip/style.js +57 -1
- package/components/top-app-bar/top-app-bar-style.js +78 -1
- package/components/top-app-bar/top-app-bar-title-style.js +81 -1
- package/components/top-app-bar/top-app-bar-title.d.ts +4 -4
- package/components/top-app-bar/top-app-bar-title.js +21 -7
- package/components/top-app-bar/top-app-bar.d.ts +5 -5
- package/components/top-app-bar/top-app-bar.js +4 -4
- package/css-data.en.json +2826 -0
- package/css-data.zh-cn.json +374 -367
- package/custom-elements.json +2049 -2049
- package/html-data.en.json +6560 -0
- package/html-data.zh-cn.json +1427 -1433
- package/jsx.en.d.ts +3303 -0
- package/jsx.zh-cn.d.ts +3351 -0
- package/package.json +6 -5
- package/web-types.en.json +11734 -0
- package/web-types.zh-cn.json +3227 -3221
- package/mdui.esm.js +0 -22
- package/mdui.global.js +0 -22
|
@@ -13,15 +13,15 @@ import { style } from './style.js';
|
|
|
13
13
|
* <mdui-linear-progress></mdui-linear-progress>
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
|
-
* @csspart indicator -
|
|
16
|
+
* @csspart indicator - 指示器部分
|
|
17
17
|
*
|
|
18
|
-
* @cssprop --shape-corner -
|
|
18
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
19
19
|
*/
|
|
20
20
|
let LinearProgress = class LinearProgress extends MduiElement {
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments);
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* 进度指示器的最大值。默认为 `1`
|
|
25
25
|
*/
|
|
26
26
|
this.max = 1;
|
|
27
27
|
}
|
|
@@ -29,9 +29,13 @@ let LinearProgress = class LinearProgress extends MduiElement {
|
|
|
29
29
|
const isDeterminate = !isUndefined(this.value);
|
|
30
30
|
if (isDeterminate) {
|
|
31
31
|
const value = this.value;
|
|
32
|
-
return html `<div
|
|
32
|
+
return html `<div
|
|
33
|
+
part="indicator"
|
|
34
|
+
class="determinate"
|
|
35
|
+
style="${styleMap({
|
|
33
36
|
width: `${(value / Math.max(this.max ?? value, value)) * 100}%`,
|
|
34
|
-
})}"
|
|
37
|
+
})}"
|
|
38
|
+
></div>`;
|
|
35
39
|
}
|
|
36
40
|
return html `<div part="indicator" class="indeterminate"></div>`;
|
|
37
41
|
}
|
|
@@ -1,2 +1,74 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
--shape-corner: var(--mdui-shape-corner-none);
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-block;
|
|
7
|
+
width: 100%;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
border-radius: var(--shape-corner);
|
|
10
|
+
background-color: rgb(var(--mdui-color-surface-container-highest));
|
|
11
|
+
height: 0.25rem;
|
|
12
|
+
}
|
|
13
|
+
.determinate,
|
|
14
|
+
.indeterminate {
|
|
15
|
+
background-color: rgb(var(--mdui-color-primary));
|
|
16
|
+
}
|
|
17
|
+
.determinate {
|
|
18
|
+
height: 100%;
|
|
19
|
+
transition: width var(--mdui-motion-duration-long2)
|
|
20
|
+
var(--mdui-motion-easing-standard);
|
|
21
|
+
}
|
|
22
|
+
.indeterminate::before {
|
|
23
|
+
position: absolute;
|
|
24
|
+
top: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
background-color: inherit;
|
|
28
|
+
animation: mdui-comp-progress-indeterminate 2s
|
|
29
|
+
var(--mdui-motion-easing-linear) infinite;
|
|
30
|
+
content: ' ';
|
|
31
|
+
}
|
|
32
|
+
.indeterminate::after {
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 0;
|
|
35
|
+
bottom: 0;
|
|
36
|
+
left: 0;
|
|
37
|
+
background-color: inherit;
|
|
38
|
+
animation: mdui-comp-progress-indeterminate-short 2s
|
|
39
|
+
var(--mdui-motion-easing-linear) infinite;
|
|
40
|
+
content: ' ';
|
|
41
|
+
}
|
|
42
|
+
@keyframes mdui-comp-progress-indeterminate {
|
|
43
|
+
0% {
|
|
44
|
+
left: 0;
|
|
45
|
+
width: 0;
|
|
46
|
+
}
|
|
47
|
+
50% {
|
|
48
|
+
left: 30%;
|
|
49
|
+
width: 70%;
|
|
50
|
+
}
|
|
51
|
+
75% {
|
|
52
|
+
left: 100%;
|
|
53
|
+
width: 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
@keyframes mdui-comp-progress-indeterminate-short {
|
|
57
|
+
0% {
|
|
58
|
+
left: 0;
|
|
59
|
+
width: 0;
|
|
60
|
+
}
|
|
61
|
+
50% {
|
|
62
|
+
left: 0;
|
|
63
|
+
width: 0;
|
|
64
|
+
}
|
|
65
|
+
75% {
|
|
66
|
+
left: 0;
|
|
67
|
+
width: 25%;
|
|
68
|
+
}
|
|
69
|
+
100% {
|
|
70
|
+
left: 100%;
|
|
71
|
+
width: 0;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
`;
|
|
@@ -1,4 +1,155 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const listItemStyle = css
|
|
2
|
+
export const listItemStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
--shape-corner: var(--mdui-shape-corner-none);
|
|
5
|
+
--shape-corner-rounded: var(--mdui-shape-corner-extra-large);
|
|
6
|
+
position: relative;
|
|
7
|
+
display: block;
|
|
8
|
+
border-radius: var(--shape-corner);
|
|
9
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
10
|
+
}
|
|
11
|
+
:host([rounded]),
|
|
12
|
+
:host([rounded]) mdui-ripple {
|
|
13
|
+
border-radius: var(--shape-corner-rounded);
|
|
14
|
+
}
|
|
15
|
+
:host([active]) {
|
|
16
|
+
background-color: rgb(var(--mdui-color-secondary-container));
|
|
17
|
+
--mdui-comp-ripple-state-layer-color: var(
|
|
3
18
|
--mdui-color-on-secondary-container
|
|
4
|
-
)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
:host([disabled]) {
|
|
22
|
+
pointer-events: none;
|
|
23
|
+
}
|
|
24
|
+
.container {
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
-webkit-user-select: none;
|
|
27
|
+
user-select: none;
|
|
28
|
+
text-decoration: none;
|
|
29
|
+
color: inherit;
|
|
30
|
+
-webkit-tap-highlight-color: transparent;
|
|
31
|
+
}
|
|
32
|
+
:host([disabled]) .container {
|
|
33
|
+
cursor: default;
|
|
34
|
+
opacity: 0.38;
|
|
35
|
+
}
|
|
36
|
+
:host([nonclickable]:not([href])) .container {
|
|
37
|
+
cursor: auto;
|
|
38
|
+
-webkit-user-select: auto;
|
|
39
|
+
user-select: auto;
|
|
40
|
+
}
|
|
41
|
+
.preset {
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
padding: 0.5rem 1.5rem 0.5rem 1rem;
|
|
45
|
+
min-height: 3.5rem;
|
|
46
|
+
}
|
|
47
|
+
:host([alignment='start']) .preset {
|
|
48
|
+
align-items: flex-start;
|
|
49
|
+
}
|
|
50
|
+
:host([alignment='end']) .preset {
|
|
51
|
+
align-items: flex-end;
|
|
52
|
+
}
|
|
53
|
+
.body {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex: 1 1 100%;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
justify-content: center;
|
|
58
|
+
min-width: 0;
|
|
59
|
+
}
|
|
60
|
+
.headline {
|
|
61
|
+
display: block;
|
|
62
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
63
|
+
font-size: var(--mdui-typescale-body-large-size);
|
|
64
|
+
font-weight: var(--mdui-typescale-body-large-weight);
|
|
65
|
+
letter-spacing: var(--mdui-typescale-body-large-tracking);
|
|
66
|
+
line-height: var(--mdui-typescale-body-large-line-height);
|
|
67
|
+
}
|
|
68
|
+
:host([active]) .headline {
|
|
69
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
70
|
+
}
|
|
71
|
+
.description {
|
|
72
|
+
display: none;
|
|
73
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
74
|
+
font-size: var(--mdui-typescale-body-medium-size);
|
|
75
|
+
font-weight: var(--mdui-typescale-body-medium-weight);
|
|
76
|
+
letter-spacing: var(--mdui-typescale-body-medium-tracking);
|
|
77
|
+
line-height: var(--mdui-typescale-body-medium-line-height);
|
|
78
|
+
}
|
|
79
|
+
:host([disabled]) .description,
|
|
80
|
+
:host([hover]) .description,
|
|
81
|
+
:host([focused]) .description,
|
|
82
|
+
:host([pressed]) .description {
|
|
83
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
84
|
+
}
|
|
85
|
+
.has-description .description {
|
|
86
|
+
display: block;
|
|
87
|
+
}
|
|
88
|
+
:host([headline-line='1']) .headline,
|
|
89
|
+
:host([description-line='1']) .description {
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
text-overflow: ellipsis;
|
|
93
|
+
}
|
|
94
|
+
:host([headline-line='2']) .headline,
|
|
95
|
+
:host([description-line='2']) .description,
|
|
96
|
+
:host([headline-line='3']) .headline,
|
|
97
|
+
:host([description-line='3']) .description {
|
|
98
|
+
display: -webkit-box;
|
|
99
|
+
overflow: hidden;
|
|
100
|
+
text-overflow: ellipsis;
|
|
101
|
+
-webkit-box-orient: vertical;
|
|
102
|
+
}
|
|
103
|
+
:host([headline-line='2']) .headline,
|
|
104
|
+
:host([description-line='2']) .description {
|
|
105
|
+
-webkit-line-clamp: 2;
|
|
106
|
+
}
|
|
107
|
+
:host([headline-line='3']) .headline,
|
|
108
|
+
:host([description-line='3']) .description {
|
|
109
|
+
-webkit-line-clamp: 3;
|
|
110
|
+
}
|
|
111
|
+
.icon,
|
|
112
|
+
.end-icon {
|
|
113
|
+
display: flex;
|
|
114
|
+
flex: 0 0 auto;
|
|
115
|
+
font-size: var(--mdui-typescale-label-small-size);
|
|
116
|
+
font-weight: var(--mdui-typescale-label-small-weight);
|
|
117
|
+
letter-spacing: var(--mdui-typescale-label-small-tracking);
|
|
118
|
+
line-height: var(--mdui-typescale-label-small-line-height);
|
|
119
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
120
|
+
}
|
|
121
|
+
:host([disabled]) .icon,
|
|
122
|
+
:host([disabled]) .end-icon,
|
|
123
|
+
:host([hover]) .icon,
|
|
124
|
+
:host([hover]) .end-icon,
|
|
125
|
+
:host([focused]) .icon,
|
|
126
|
+
:host([focused]) .end-icon,
|
|
127
|
+
:host([pressed]) .icon,
|
|
128
|
+
:host([pressed]) .end-icon {
|
|
129
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
130
|
+
}
|
|
131
|
+
:host([active]) .icon,
|
|
132
|
+
:host([active]) .end-icon {
|
|
133
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
134
|
+
}
|
|
135
|
+
.icon mdui-icon,
|
|
136
|
+
.end-icon mdui-icon,
|
|
137
|
+
.is-icon ::slotted([slot='icon']),
|
|
138
|
+
.is-end-icon ::slotted([slot='end-icon']) {
|
|
139
|
+
font-size: 1.5rem;
|
|
140
|
+
}
|
|
141
|
+
.has-icon .icon {
|
|
142
|
+
margin-right: 1rem;
|
|
143
|
+
}
|
|
144
|
+
.has-icon ::slotted(mdui-checkbox[slot='icon']),
|
|
145
|
+
.has-icon ::slotted(mdui-radio[slot='icon']) {
|
|
146
|
+
margin-left: -0.5rem;
|
|
147
|
+
}
|
|
148
|
+
.has-end-icon .end-icon {
|
|
149
|
+
margin-left: 1rem;
|
|
150
|
+
}
|
|
151
|
+
.has-end-icon ::slotted(mdui-checkbox[slot='end-icon']),
|
|
152
|
+
.has-end-icon ::slotted(mdui-radio[slot='end-icon']) {
|
|
153
|
+
margin-right: -0.5rem;
|
|
154
|
+
}
|
|
155
|
+
`;
|
|
@@ -4,7 +4,7 @@ import type { Ripple } from '../ripple/index.js';
|
|
|
4
4
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
5
5
|
declare const ListItem_base: import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/anchor.js").AnchorMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("../ripple/ripple-mixin.js").RippleMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/focusable.js").FocusableMixinInterface> & typeof MduiElement;
|
|
6
6
|
/**
|
|
7
|
-
* @summary
|
|
7
|
+
* @summary 列表项组件。需配合 `<mdui-list>` 组件使用
|
|
8
8
|
*
|
|
9
9
|
* ```html
|
|
10
10
|
* <mdui-list>
|
|
@@ -30,8 +30,8 @@ declare const ListItem_base: import("@open-wc/dedupe-mixin").Constructor<import(
|
|
|
30
30
|
* @csspart headline - 主标题
|
|
31
31
|
* @csspart description - 副标题
|
|
32
32
|
*
|
|
33
|
-
* @cssprop --shape-corner -
|
|
34
|
-
* @cssprop --shape-corner-rounded - 指定了 `rounded`
|
|
33
|
+
* @cssprop --shape-corner - 列表项的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
34
|
+
* @cssprop --shape-corner-rounded - 指定了 `rounded` 属性时,列表项的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
35
35
|
*/
|
|
36
36
|
export declare class ListItem extends ListItem_base<ListItemEventMap> {
|
|
37
37
|
static styles: CSSResultGroup;
|
|
@@ -40,25 +40,25 @@ export declare class ListItem extends ListItem_base<ListItemEventMap> {
|
|
|
40
40
|
*/
|
|
41
41
|
headline?: string;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* 主文本行数,超过限制后将截断显示。默认无行数限制。可选值包括:
|
|
44
44
|
*
|
|
45
|
-
* * `1
|
|
46
|
-
* * `2
|
|
47
|
-
* * `3
|
|
45
|
+
* * `1`:显示单行,超出后截断
|
|
46
|
+
* * `2`:显示两行,超出后截断
|
|
47
|
+
* * `3`:显示三行,超出后截断
|
|
48
48
|
*/
|
|
49
|
-
headlineLine?:
|
|
49
|
+
headlineLine?: /*显示单行,超出后截断*/ 1 | /*显示两行,超出后截断*/ 2 | /*显示三行,超出后截断*/ 3;
|
|
50
50
|
/**
|
|
51
51
|
* 副文本。也可以通过 `slot="description"` 设置
|
|
52
52
|
*/
|
|
53
53
|
description?: string;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* 副文本行数,超过限制后将截断显示。默认无行数限制。可选值包括:
|
|
56
56
|
*
|
|
57
|
-
* * `1
|
|
58
|
-
* * `2
|
|
59
|
-
* * `3
|
|
57
|
+
* * `1`:显示单行,超出后截断
|
|
58
|
+
* * `2`:显示两行,超出后截断
|
|
59
|
+
* * `3`:显示三行,超出后截断
|
|
60
60
|
*/
|
|
61
|
-
descriptionLine?: 1 | 2 | 3;
|
|
61
|
+
descriptionLine?: /*显示单行,超出后截断*/ 1 | /*显示两行,超出后截断*/ 2 | /*显示三行,超出后截断*/ 3;
|
|
62
62
|
/**
|
|
63
63
|
* 左侧的 Material Icons 图标名。也可以通过 `slot="icon"` 设置
|
|
64
64
|
*/
|
|
@@ -68,7 +68,7 @@ export declare class ListItem extends ListItem_base<ListItemEventMap> {
|
|
|
68
68
|
*/
|
|
69
69
|
endIcon?: string;
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* 是否禁用该列表项,禁用后,列表项将变为灰色,且其中的 [`<mdui-checkbox>`](/docs/2/components/checkbox)、[`<mdui-radio>`](/docs/2/components/radio)、[`<mdui-switch>`](/docs/2/components/switch) 等也将禁用
|
|
72
72
|
*/
|
|
73
73
|
disabled: boolean;
|
|
74
74
|
/**
|
|
@@ -76,15 +76,15 @@ export declare class ListItem extends ListItem_base<ListItemEventMap> {
|
|
|
76
76
|
*/
|
|
77
77
|
active: boolean;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* 是否使列表项不可点击。设置后,列表项中的 [`<mdui-checkbox>`](/docs/2/components/checkbox)、[`<mdui-radio>`](/docs/2/components/radio)、[`<mdui-switch>`](/docs/2/components/switch) 等仍可交互
|
|
80
80
|
*/
|
|
81
81
|
nonclickable: boolean;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* 是否使用圆角形状的列表项
|
|
84
84
|
*/
|
|
85
85
|
rounded: boolean;
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
87
|
+
* 列表项的垂直对齐方式。可选值包括:
|
|
88
88
|
*
|
|
89
89
|
* * `start`:顶部对齐
|
|
90
90
|
* * `center`:居中对齐
|
|
@@ -15,7 +15,7 @@ import '../icon.js';
|
|
|
15
15
|
import { RippleMixin } from '../ripple/ripple-mixin.js';
|
|
16
16
|
import { listItemStyle } from './list-item-style.js';
|
|
17
17
|
/**
|
|
18
|
-
* @summary
|
|
18
|
+
* @summary 列表项组件。需配合 `<mdui-list>` 组件使用
|
|
19
19
|
*
|
|
20
20
|
* ```html
|
|
21
21
|
* <mdui-list>
|
|
@@ -41,14 +41,14 @@ import { listItemStyle } from './list-item-style.js';
|
|
|
41
41
|
* @csspart headline - 主标题
|
|
42
42
|
* @csspart description - 副标题
|
|
43
43
|
*
|
|
44
|
-
* @cssprop --shape-corner -
|
|
45
|
-
* @cssprop --shape-corner-rounded - 指定了 `rounded`
|
|
44
|
+
* @cssprop --shape-corner - 列表项的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
45
|
+
* @cssprop --shape-corner-rounded - 指定了 `rounded` 属性时,列表项的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
46
46
|
*/
|
|
47
47
|
let ListItem = class ListItem extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement))) {
|
|
48
48
|
constructor() {
|
|
49
49
|
super(...arguments);
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* 是否禁用该列表项,禁用后,列表项将变为灰色,且其中的 [`<mdui-checkbox>`](/docs/2/components/checkbox)、[`<mdui-radio>`](/docs/2/components/radio)、[`<mdui-switch>`](/docs/2/components/switch) 等也将禁用
|
|
52
52
|
*/
|
|
53
53
|
this.disabled = false;
|
|
54
54
|
/**
|
|
@@ -56,15 +56,15 @@ let ListItem = class ListItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
|
|
|
56
56
|
*/
|
|
57
57
|
this.active = false;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* 是否使列表项不可点击。设置后,列表项中的 [`<mdui-checkbox>`](/docs/2/components/checkbox)、[`<mdui-radio>`](/docs/2/components/radio)、[`<mdui-switch>`](/docs/2/components/switch) 等仍可交互
|
|
60
60
|
*/
|
|
61
61
|
this.nonclickable = false;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* 是否使用圆角形状的列表项
|
|
64
64
|
*/
|
|
65
65
|
this.rounded = false;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* 列表项的垂直对齐方式。可选值包括:
|
|
68
68
|
*
|
|
69
69
|
* * `start`:顶部对齐
|
|
70
70
|
* * `center`:居中对齐
|
|
@@ -103,24 +103,43 @@ let ListItem = class ListItem extends AnchorMixin(RippleMixin(FocusableMixin(Mdu
|
|
|
103
103
|
// end-icon slot 中的元素是否为 mdui-icon 或 mdui-icon-* 组件
|
|
104
104
|
'is-end-icon': getNodeName(this.endIconElements[0]).startsWith('mdui-icon-'),
|
|
105
105
|
});
|
|
106
|
-
return html `<mdui-ripple
|
|
106
|
+
return html `<mdui-ripple
|
|
107
|
+
${ref(this.rippleRef)}
|
|
108
|
+
.noRipple=${this.noRipple}
|
|
109
|
+
></mdui-ripple>
|
|
110
|
+
${this.href && !this.disabled
|
|
107
111
|
? this.renderAnchor({
|
|
108
112
|
className,
|
|
109
113
|
content: this.renderInner(),
|
|
110
114
|
part: 'container',
|
|
111
115
|
refDirective: ref(this.itemRef),
|
|
112
116
|
})
|
|
113
|
-
: html `<div part="container" class="${className}" ${ref(this.itemRef)}
|
|
117
|
+
: html `<div part="container" class="${className}" ${ref(this.itemRef)}>
|
|
118
|
+
${this.renderInner()}
|
|
119
|
+
</div>`}`;
|
|
114
120
|
}
|
|
115
121
|
renderInner() {
|
|
116
122
|
const hasDefaultSlot = this.hasSlotController.test('[default]');
|
|
117
|
-
return html `<slot name="custom"
|
|
118
|
-
|
|
119
|
-
|
|
123
|
+
return html `<slot name="custom">
|
|
124
|
+
<slot name="icon" part="icon" class="icon">
|
|
125
|
+
${this.icon
|
|
126
|
+
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
127
|
+
: nothingTemplate}
|
|
128
|
+
</slot>
|
|
129
|
+
<div part="body" class="body">
|
|
130
|
+
${hasDefaultSlot
|
|
120
131
|
? html `<slot part="headline" class="headline"></slot>`
|
|
121
|
-
: html `<div part="headline" class="headline">${this.headline}</div>`}
|
|
122
|
-
|
|
123
|
-
|
|
132
|
+
: html `<div part="headline" class="headline">${this.headline}</div>`}
|
|
133
|
+
<slot name="description" part="description" class="description">
|
|
134
|
+
${this.description}
|
|
135
|
+
</slot>
|
|
136
|
+
</div>
|
|
137
|
+
<slot name="end-icon" part="end-icon" class="end-icon">
|
|
138
|
+
${this.endIcon
|
|
139
|
+
? html `<mdui-icon name=${this.endIcon}></mdui-icon>`
|
|
140
|
+
: nothingTemplate}
|
|
141
|
+
</slot>
|
|
142
|
+
</slot>`;
|
|
124
143
|
}
|
|
125
144
|
};
|
|
126
145
|
ListItem.styles = [
|
|
@@ -1,2 +1,11 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const listStyle = css
|
|
2
|
+
export const listStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
padding: 0.5rem 0rem;
|
|
6
|
+
}
|
|
7
|
+
::slotted(mdui-divider[middle]) {
|
|
8
|
+
margin-left: 1rem;
|
|
9
|
+
margin-right: 1.5rem;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const listSubheaderStyle = css
|
|
2
|
+
export const listSubheaderStyle = css `
|
|
3
|
+
/* 规范中没有该描述 */
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
white-space: nowrap;
|
|
8
|
+
text-overflow: ellipsis;
|
|
9
|
+
cursor: default;
|
|
10
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
11
|
+
font-size: var(--mdui-typescale-label-small-size);
|
|
12
|
+
font-weight: var(--mdui-typescale-label-small-weight);
|
|
13
|
+
letter-spacing: var(--mdui-typescale-label-small-tracking);
|
|
14
|
+
line-height: var(--mdui-typescale-label-small-line-height);
|
|
15
|
+
padding-left: 1rem;
|
|
16
|
+
padding-right: 1.5rem;
|
|
17
|
+
height: 3.5rem;
|
|
18
|
+
line-height: 3.5rem;
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
|
-
* @summary
|
|
4
|
+
* @summary 列表标题组件。需配合 `<mdui-list>` 组件使用
|
|
5
5
|
*
|
|
6
6
|
* ```html
|
|
7
7
|
* <mdui-list>
|
|
@@ -11,7 +11,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
11
11
|
* </mdui-list>
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
|
-
* @slot -
|
|
14
|
+
* @slot - 列表标题文本
|
|
15
15
|
*/
|
|
16
16
|
export declare class ListSubheader extends MduiElement<ListSubheaderEventMap> {
|
|
17
17
|
static styles: CSSResultGroup;
|
|
@@ -5,7 +5,7 @@ import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
|
5
5
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
6
6
|
import { listSubheaderStyle } from './list-subheader-style.js';
|
|
7
7
|
/**
|
|
8
|
-
* @summary
|
|
8
|
+
* @summary 列表标题组件。需配合 `<mdui-list>` 组件使用
|
|
9
9
|
*
|
|
10
10
|
* ```html
|
|
11
11
|
* <mdui-list>
|
|
@@ -15,7 +15,7 @@ import { listSubheaderStyle } from './list-subheader-style.js';
|
|
|
15
15
|
* </mdui-list>
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
|
-
* @slot -
|
|
18
|
+
* @slot - 列表标题文本
|
|
19
19
|
*/
|
|
20
20
|
let ListSubheader = class ListSubheader extends MduiElement {
|
|
21
21
|
render() {
|
package/components/list/list.js
CHANGED
|
@@ -5,7 +5,7 @@ import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
|
5
5
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
6
6
|
import { listStyle } from './list-style.js';
|
|
7
7
|
/**
|
|
8
|
-
* @summary
|
|
8
|
+
* @summary 列表组件。需配合 `<mdui-list-item>` 组件使用
|
|
9
9
|
*
|
|
10
10
|
* ```html
|
|
11
11
|
* <mdui-list>
|