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
|
@@ -4,7 +4,7 @@ import type { Ripple } from '../ripple/index.js';
|
|
|
4
4
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
5
5
|
declare const NavigationRailItem_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-navigation-rail>` 组件使用
|
|
8
8
|
*
|
|
9
9
|
* ```html
|
|
10
10
|
* <mdui-navigation-rail>
|
|
@@ -14,7 +14,7 @@ declare const NavigationRailItem_base: import("@open-wc/dedupe-mixin").Construct
|
|
|
14
14
|
* </mdui-navigation-rail>
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
|
-
* @slot -
|
|
17
|
+
* @slot - 文本内容
|
|
18
18
|
* @slot icon - 图标
|
|
19
19
|
* @slot active-icon - 激活状态的图标
|
|
20
20
|
* @slot badge - 徽标
|
|
@@ -27,18 +27,18 @@ declare const NavigationRailItem_base: import("@open-wc/dedupe-mixin").Construct
|
|
|
27
27
|
* @csspart badge - 徽标
|
|
28
28
|
* @csspart icon - 图标
|
|
29
29
|
* @csspart active-icon - 激活状态的图标
|
|
30
|
-
* @csspart label -
|
|
30
|
+
* @csspart label - 文本内容
|
|
31
31
|
*
|
|
32
|
-
* @cssprop --shape-corner-indicator -
|
|
32
|
+
* @cssprop --shape-corner-indicator - 指示器的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
33
33
|
*/
|
|
34
34
|
export declare class NavigationRailItem extends NavigationRailItem_base<NavigationRailItemEventMap> {
|
|
35
35
|
static styles: CSSResultGroup;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 未激活状态下的 Material Icons 图标名。也可以通过 `slot="icon"` 设置
|
|
38
38
|
*/
|
|
39
39
|
icon?: string;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* 激活状态下的 Material Icons 图标名。也可以通过 `slot="active-icon"` 设置
|
|
42
42
|
*/
|
|
43
43
|
activeIcon?: string;
|
|
44
44
|
/**
|
|
@@ -16,7 +16,7 @@ import '../icon.js';
|
|
|
16
16
|
import { RippleMixin } from '../ripple/ripple-mixin.js';
|
|
17
17
|
import { navigationRailItemStyle } from './navigation-rail-item-style.js';
|
|
18
18
|
/**
|
|
19
|
-
* @summary
|
|
19
|
+
* @summary 侧边导航项组件。需配合 `<mdui-navigation-rail>` 组件使用
|
|
20
20
|
*
|
|
21
21
|
* ```html
|
|
22
22
|
* <mdui-navigation-rail>
|
|
@@ -26,7 +26,7 @@ import { navigationRailItemStyle } from './navigation-rail-item-style.js';
|
|
|
26
26
|
* </mdui-navigation-rail>
|
|
27
27
|
* ```
|
|
28
28
|
*
|
|
29
|
-
* @slot -
|
|
29
|
+
* @slot - 文本内容
|
|
30
30
|
* @slot icon - 图标
|
|
31
31
|
* @slot active-icon - 激活状态的图标
|
|
32
32
|
* @slot badge - 徽标
|
|
@@ -39,9 +39,9 @@ import { navigationRailItemStyle } from './navigation-rail-item-style.js';
|
|
|
39
39
|
* @csspart badge - 徽标
|
|
40
40
|
* @csspart icon - 图标
|
|
41
41
|
* @csspart active-icon - 激活状态的图标
|
|
42
|
-
* @csspart label -
|
|
42
|
+
* @csspart label - 文本内容
|
|
43
43
|
*
|
|
44
|
-
* @cssprop --shape-corner-indicator -
|
|
44
|
+
* @cssprop --shape-corner-indicator - 指示器的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
45
45
|
*/
|
|
46
46
|
let NavigationRailItem = class NavigationRailItem extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement))) {
|
|
47
47
|
constructor() {
|
|
@@ -91,17 +91,36 @@ let NavigationRailItem = class NavigationRailItem extends AnchorMixin(RippleMixi
|
|
|
91
91
|
className,
|
|
92
92
|
content: this.renderInner(hasDefaultSlot),
|
|
93
93
|
})
|
|
94
|
-
: html `<div part="container" class
|
|
94
|
+
: html `<div part="container" class=${className}>
|
|
95
|
+
${this.renderInner(hasDefaultSlot)}
|
|
96
|
+
</div>`}
|
|
97
|
+
<mdui-ripple
|
|
98
|
+
.noRipple=${!this.active || this.noRipple}
|
|
99
|
+
${ref(this.rippleRef)}
|
|
100
|
+
></mdui-ripple>`;
|
|
95
101
|
}
|
|
96
102
|
renderInner(hasDefaultSlot) {
|
|
97
|
-
return html `<div part="indicator" class="indicator"
|
|
103
|
+
return html `<div part="indicator" class="indicator">
|
|
104
|
+
<slot
|
|
105
|
+
name="badge"
|
|
106
|
+
part="badge"
|
|
107
|
+
class=${classMap({
|
|
98
108
|
badge: true,
|
|
99
109
|
'placement-right': this.placement === 'right',
|
|
100
|
-
})}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
110
|
+
})}
|
|
111
|
+
></slot>
|
|
112
|
+
<slot name="active-icon" part="active-icon" class="active-icon">
|
|
113
|
+
${this.activeIcon
|
|
114
|
+
? html `<mdui-icon name=${this.activeIcon}></mdui-icon>`
|
|
115
|
+
: nothingTemplate}
|
|
116
|
+
</slot>
|
|
117
|
+
<slot name="icon" part="icon" class="icon">
|
|
118
|
+
${this.icon
|
|
119
|
+
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
120
|
+
: nothingTemplate}
|
|
121
|
+
</slot>
|
|
122
|
+
</div>
|
|
123
|
+
${hasDefaultSlot
|
|
105
124
|
? html `<slot part="label" class="label"></slot>`
|
|
106
125
|
: nothing}`;
|
|
107
126
|
}
|
|
@@ -1,2 +1,80 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const navigationRailStyle = css
|
|
2
|
+
export const navigationRailStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
--shape-corner: var(--mdui-shape-corner-none);
|
|
5
|
+
--z-index: 2000;
|
|
6
|
+
position: fixed;
|
|
7
|
+
top: 0;
|
|
8
|
+
bottom: 0;
|
|
9
|
+
left: 0;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
align-items: center;
|
|
13
|
+
border-radius: 0 var(--shape-corner) var(--shape-corner) 0;
|
|
14
|
+
z-index: var(--z-index);
|
|
15
|
+
width: 5rem;
|
|
16
|
+
background-color: rgb(var(--mdui-color-surface));
|
|
17
|
+
padding: 0.375rem 0.75rem;
|
|
18
|
+
}
|
|
19
|
+
:host([contained]) {
|
|
20
|
+
position: absolute;
|
|
21
|
+
}
|
|
22
|
+
:host([divider]) {
|
|
23
|
+
border-right: 0.0625rem solid rgb(var(--mdui-color-surface-variant));
|
|
24
|
+
width: 5.0625rem;
|
|
25
|
+
}
|
|
26
|
+
:host([placement='right']) {
|
|
27
|
+
left: initial;
|
|
28
|
+
right: 0;
|
|
29
|
+
border-radius: var(--shape-corner) 0 0 var(--shape-corner);
|
|
30
|
+
}
|
|
31
|
+
:host([placement='right'][divider]) {
|
|
32
|
+
border-right: none;
|
|
33
|
+
border-left: 0.0625rem solid rgb(var(--mdui-color-surface-variant));
|
|
34
|
+
}
|
|
35
|
+
.top,
|
|
36
|
+
.items,
|
|
37
|
+
.bottom {
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
align-items: center;
|
|
41
|
+
width: 100%;
|
|
42
|
+
}
|
|
43
|
+
.top {
|
|
44
|
+
margin-bottom: 1.75rem;
|
|
45
|
+
}
|
|
46
|
+
.bottom {
|
|
47
|
+
margin-top: 1.75rem;
|
|
48
|
+
}
|
|
49
|
+
::slotted(mdui-navigation-rail-item),
|
|
50
|
+
::slotted([slot='top']),
|
|
51
|
+
::slotted([slot='bottom']) {
|
|
52
|
+
margin-top: 0.375rem;
|
|
53
|
+
margin-bottom: 0.375rem;
|
|
54
|
+
}
|
|
55
|
+
:host([alignment='start']) .top-spacer {
|
|
56
|
+
flex-grow: 0;
|
|
57
|
+
}
|
|
58
|
+
:host([alignment='start']) .bottom-spacer {
|
|
59
|
+
flex-grow: 1;
|
|
60
|
+
}
|
|
61
|
+
:host([alignment='end']) .top-spacer {
|
|
62
|
+
flex-grow: 1;
|
|
63
|
+
}
|
|
64
|
+
:host([alignment='end']) .bottom-spacer {
|
|
65
|
+
flex-grow: 0;
|
|
66
|
+
}
|
|
67
|
+
:host([alignment='center']) {
|
|
68
|
+
justify-content: center;
|
|
69
|
+
}
|
|
70
|
+
:host([alignment='center']) .top,
|
|
71
|
+
:host([alignment='center']) .bottom {
|
|
72
|
+
position: absolute;
|
|
73
|
+
}
|
|
74
|
+
:host([alignment='center']) .top {
|
|
75
|
+
top: 0.375rem;
|
|
76
|
+
}
|
|
77
|
+
:host([alignment='center']) .bottom {
|
|
78
|
+
bottom: 0.375rem;
|
|
79
|
+
}
|
|
80
|
+
`;
|
|
@@ -4,7 +4,7 @@ import { LayoutItemBase } from '../layout/layout-item-base.js';
|
|
|
4
4
|
import type { LayoutPlacement } from '../layout/helper.js';
|
|
5
5
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
6
6
|
/**
|
|
7
|
-
* @summary
|
|
7
|
+
* @summary 侧边导航栏组件。需配合 `<mdui-navigation-rail-item>` 组件使用
|
|
8
8
|
*
|
|
9
9
|
* ```html
|
|
10
10
|
* <mdui-navigation-rail>
|
|
@@ -24,8 +24,8 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
24
24
|
* @csspart bottom - 底部元素的容器
|
|
25
25
|
* @csspart items - `<mdui-navigation-rail-item>` 组件的容器
|
|
26
26
|
*
|
|
27
|
-
* @cssprop --shape-corner -
|
|
28
|
-
* @cssprop --z-index - 组件的 CSS
|
|
27
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
28
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
29
29
|
*/
|
|
30
30
|
export declare class NavigationRail extends LayoutItemBase<NavigationRailEventMap> {
|
|
31
31
|
static styles: CSSResultGroup;
|
|
@@ -34,14 +34,14 @@ export declare class NavigationRail extends LayoutItemBase<NavigationRailEventMa
|
|
|
34
34
|
*/
|
|
35
35
|
value?: string;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 导航栏的位置。可选值包括:
|
|
38
38
|
*
|
|
39
|
-
* * `left
|
|
40
|
-
* * `right
|
|
39
|
+
* * `left`:左侧
|
|
40
|
+
* * `right`:右侧
|
|
41
41
|
*/
|
|
42
|
-
placement:
|
|
42
|
+
placement: /*左侧*/ 'left' | /*右侧*/ 'right';
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* `<mdui-navigation-rail-item>` 元素的对齐方式。可选值包括:
|
|
45
45
|
*
|
|
46
46
|
* * `start`:顶部对齐
|
|
47
47
|
* * `center`:居中对齐
|
|
@@ -49,10 +49,9 @@ export declare class NavigationRail extends LayoutItemBase<NavigationRailEventMa
|
|
|
49
49
|
*/
|
|
50
50
|
alignment: /*顶部对齐*/ 'start' | /*居中对齐*/ 'center' | /*底部对齐*/ 'end';
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* 默认情况下,导航栏相对于 `body` 元素显示。当该参数设置为 `true` 时,导航栏将相对于其父元素显示。
|
|
53
53
|
*
|
|
54
|
-
* Note:
|
|
55
|
-
* 设置了该属性时,必须手动在父元素上设置样式 `position: relative;`
|
|
54
|
+
* **Note**:设置该属性时,必须在父元素上手动设置样式 `position: relative;`。
|
|
56
55
|
*/
|
|
57
56
|
contained: boolean;
|
|
58
57
|
/**
|
|
@@ -13,7 +13,7 @@ import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
|
13
13
|
import { LayoutItemBase } from '../layout/layout-item-base.js';
|
|
14
14
|
import { navigationRailStyle } from './navigation-rail-style.js';
|
|
15
15
|
/**
|
|
16
|
-
* @summary
|
|
16
|
+
* @summary 侧边导航栏组件。需配合 `<mdui-navigation-rail-item>` 组件使用
|
|
17
17
|
*
|
|
18
18
|
* ```html
|
|
19
19
|
* <mdui-navigation-rail>
|
|
@@ -33,21 +33,21 @@ import { navigationRailStyle } from './navigation-rail-style.js';
|
|
|
33
33
|
* @csspart bottom - 底部元素的容器
|
|
34
34
|
* @csspart items - `<mdui-navigation-rail-item>` 组件的容器
|
|
35
35
|
*
|
|
36
|
-
* @cssprop --shape-corner -
|
|
37
|
-
* @cssprop --z-index - 组件的 CSS
|
|
36
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
37
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
38
38
|
*/
|
|
39
39
|
let NavigationRail = class NavigationRail extends LayoutItemBase {
|
|
40
40
|
constructor() {
|
|
41
41
|
super(...arguments);
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* 导航栏的位置。可选值包括:
|
|
44
44
|
*
|
|
45
|
-
* * `left
|
|
46
|
-
* * `right
|
|
45
|
+
* * `left`:左侧
|
|
46
|
+
* * `right`:右侧
|
|
47
47
|
*/
|
|
48
48
|
this.placement = 'left';
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* `<mdui-navigation-rail-item>` 元素的对齐方式。可选值包括:
|
|
51
51
|
*
|
|
52
52
|
* * `start`:顶部对齐
|
|
53
53
|
* * `center`:居中对齐
|
|
@@ -55,10 +55,9 @@ let NavigationRail = class NavigationRail extends LayoutItemBase {
|
|
|
55
55
|
*/
|
|
56
56
|
this.alignment = 'start';
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* 默认情况下,导航栏相对于 `body` 元素显示。当该参数设置为 `true` 时,导航栏将相对于其父元素显示。
|
|
59
59
|
*
|
|
60
|
-
* Note:
|
|
61
|
-
* 设置了该属性时,必须手动在父元素上设置样式 `position: relative;`
|
|
60
|
+
* **Note**:设置该属性时,必须在父元素上手动设置样式 `position: relative;`。
|
|
62
61
|
*/
|
|
63
62
|
this.contained = false;
|
|
64
63
|
/**
|
|
@@ -156,7 +155,16 @@ let NavigationRail = class NavigationRail extends LayoutItemBase {
|
|
|
156
155
|
render() {
|
|
157
156
|
const hasTopSlot = this.hasSlotController.test('top');
|
|
158
157
|
const hasBottomSlot = this.hasSlotController.test('bottom');
|
|
159
|
-
return html `${when(hasTopSlot, () => html `<slot name="top" part="top" class="top"></slot>`)}
|
|
158
|
+
return html `${when(hasTopSlot, () => html `<slot name="top" part="top" class="top"></slot>`)}
|
|
159
|
+
<span class="top-spacer"></span>
|
|
160
|
+
<slot
|
|
161
|
+
part="items"
|
|
162
|
+
class="items"
|
|
163
|
+
@slotchange=${this.onSlotChange}
|
|
164
|
+
@click=${this.onClick}
|
|
165
|
+
></slot>
|
|
166
|
+
<span class="bottom-spacer"></span>
|
|
167
|
+
${when(hasBottomSlot, () => html `<slot name="bottom" part="bottom" class="bottom"></slot>`)}`;
|
|
160
168
|
}
|
|
161
169
|
onClick(event) {
|
|
162
170
|
// event.button 为 0 时,为鼠标左键点击。忽略鼠标中键和右键
|
|
@@ -1,2 +1,21 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const radioGroupStyle = css
|
|
2
|
+
export const radioGroupStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-block;
|
|
5
|
+
}
|
|
6
|
+
fieldset {
|
|
7
|
+
border: none;
|
|
8
|
+
padding: 0;
|
|
9
|
+
margin: 0;
|
|
10
|
+
min-width: 0;
|
|
11
|
+
}
|
|
12
|
+
input {
|
|
13
|
+
position: absolute;
|
|
14
|
+
padding: 0;
|
|
15
|
+
opacity: 0;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
width: 1.25rem;
|
|
18
|
+
height: 1.25rem;
|
|
19
|
+
margin: 0rem 0rem 0rem 0.625rem;
|
|
20
|
+
}
|
|
21
|
+
`;
|
|
@@ -5,7 +5,7 @@ import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
|
5
5
|
import type { FormControl } from '@mdui/jq/shared/form.js';
|
|
6
6
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
7
7
|
/**
|
|
8
|
-
* @summary
|
|
8
|
+
* @summary 单选框组组件。需配合 `<mdui-radio>` 组件使用
|
|
9
9
|
*
|
|
10
10
|
* ```html
|
|
11
11
|
* <mdui-radio-group value="chinese">
|
|
@@ -23,21 +23,21 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
23
23
|
export declare class RadioGroup extends MduiElement<RadioGroupEventMap> implements FormControl {
|
|
24
24
|
static styles: CSSResultGroup;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
26
|
+
* 是否禁用此组件
|
|
27
27
|
*/
|
|
28
28
|
disabled: boolean;
|
|
29
29
|
/**
|
|
30
|
-
* 关联的
|
|
30
|
+
* 关联的 `<form>` 元素。此属性值应为同一页面中的一个 `<form>` 元素的 `id`。
|
|
31
31
|
*
|
|
32
|
-
*
|
|
32
|
+
* 如果未指定此属性,则该元素必须是 `<form>` 元素的子元素。通过此属性,你可以将元素放置在页面的任何位置,而不仅仅是 `<form>` 元素的子元素。
|
|
33
33
|
*/
|
|
34
34
|
form?: string;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* 单选框组的名称,将与表单数据一起提交
|
|
37
37
|
*/
|
|
38
38
|
name: string;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* 单选框组的名称,将于表单数据一起提交
|
|
41
41
|
*/
|
|
42
42
|
value: string;
|
|
43
43
|
/**
|
|
@@ -57,11 +57,11 @@ export declare class RadioGroup extends MduiElement<RadioGroupEventMap> implemen
|
|
|
57
57
|
private readonly formController;
|
|
58
58
|
private readonly definedController;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)
|
|
61
61
|
*/
|
|
62
62
|
get validity(): ValidityState;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串
|
|
65
65
|
*/
|
|
66
66
|
get validationMessage(): string;
|
|
67
67
|
private get items();
|
|
@@ -69,19 +69,19 @@ export declare class RadioGroup extends MduiElement<RadioGroupEventMap> implemen
|
|
|
69
69
|
private onValueChange;
|
|
70
70
|
private onInvalidChange;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`
|
|
73
73
|
*/
|
|
74
74
|
checkValidity(): boolean;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。
|
|
77
77
|
*
|
|
78
|
-
*
|
|
78
|
+
* 如果验证未通过,还会在组件上显示验证失败的提示。
|
|
79
79
|
*/
|
|
80
80
|
reportValidity(): boolean;
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
82
|
+
* 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证
|
|
83
83
|
*
|
|
84
|
-
* @param message
|
|
84
|
+
* @param message 自定义的错误提示文本
|
|
85
85
|
*/
|
|
86
86
|
setCustomValidity(message: string): void;
|
|
87
87
|
protected render(): TemplateResult;
|
|
@@ -16,7 +16,7 @@ import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
|
16
16
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
17
17
|
import { radioGroupStyle } from './radio-group-style.js';
|
|
18
18
|
/**
|
|
19
|
-
* @summary
|
|
19
|
+
* @summary 单选框组组件。需配合 `<mdui-radio>` 组件使用
|
|
20
20
|
*
|
|
21
21
|
* ```html
|
|
22
22
|
* <mdui-radio-group value="chinese">
|
|
@@ -35,15 +35,15 @@ let RadioGroup = class RadioGroup extends MduiElement {
|
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* 是否禁用此组件
|
|
39
39
|
*/
|
|
40
40
|
this.disabled = false;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
42
|
+
* 单选框组的名称,将与表单数据一起提交
|
|
43
43
|
*/
|
|
44
44
|
this.name = '';
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
46
|
+
* 单选框组的名称,将于表单数据一起提交
|
|
47
47
|
*/
|
|
48
48
|
this.value = '';
|
|
49
49
|
/**
|
|
@@ -67,13 +67,13 @@ let RadioGroup = class RadioGroup extends MduiElement {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
70
|
+
* 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)
|
|
71
71
|
*/
|
|
72
72
|
get validity() {
|
|
73
73
|
return this.inputRef.value.validity;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串
|
|
77
77
|
*/
|
|
78
78
|
get validationMessage() {
|
|
79
79
|
return this.inputRef.value.validationMessage;
|
|
@@ -110,7 +110,7 @@ let RadioGroup = class RadioGroup extends MduiElement {
|
|
|
110
110
|
this.updateItems();
|
|
111
111
|
}
|
|
112
112
|
/**
|
|
113
|
-
*
|
|
113
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`
|
|
114
114
|
*/
|
|
115
115
|
checkValidity() {
|
|
116
116
|
const valid = this.inputRef.value.checkValidity();
|
|
@@ -124,9 +124,9 @@ let RadioGroup = class RadioGroup extends MduiElement {
|
|
|
124
124
|
return valid;
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
127
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。
|
|
128
128
|
*
|
|
129
|
-
*
|
|
129
|
+
* 如果验证未通过,还会在组件上显示验证失败的提示。
|
|
130
130
|
*/
|
|
131
131
|
reportValidity() {
|
|
132
132
|
this.invalid = !this.inputRef.value.reportValidity();
|
|
@@ -145,16 +145,34 @@ let RadioGroup = class RadioGroup extends MduiElement {
|
|
|
145
145
|
return !this.invalid;
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
|
-
*
|
|
148
|
+
* 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证
|
|
149
149
|
*
|
|
150
|
-
* @param message
|
|
150
|
+
* @param message 自定义的错误提示文本
|
|
151
151
|
*/
|
|
152
152
|
setCustomValidity(message) {
|
|
153
153
|
this.inputRef.value.setCustomValidity(message);
|
|
154
154
|
this.invalid = !this.inputRef.value.checkValidity();
|
|
155
155
|
}
|
|
156
156
|
render() {
|
|
157
|
-
return html `<fieldset
|
|
157
|
+
return html `<fieldset>
|
|
158
|
+
<input
|
|
159
|
+
${ref(this.inputRef)}
|
|
160
|
+
type="radio"
|
|
161
|
+
class="input"
|
|
162
|
+
name=${ifDefined(this.name)}
|
|
163
|
+
value=${ifDefined(this.value)}
|
|
164
|
+
.checked=${!!this.value}
|
|
165
|
+
.required=${this.required}
|
|
166
|
+
tabindex="-1"
|
|
167
|
+
@keydown=${this.onKeyDown}
|
|
168
|
+
/>
|
|
169
|
+
<slot
|
|
170
|
+
@click=${this.onClick}
|
|
171
|
+
@keydown=${this.onKeyDown}
|
|
172
|
+
@slotchange=${this.onSlotChange}
|
|
173
|
+
@change=${this.onCheckedChange}
|
|
174
|
+
></slot>
|
|
175
|
+
</fieldset>`;
|
|
158
176
|
}
|
|
159
177
|
// 更新 mdui-radio 的 checked 后,需要更新可聚焦状态
|
|
160
178
|
// 同一个 mdui-radio-group 中的多个 mdui-radio,仅有一个可聚焦
|
|
@@ -1,2 +1,108 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const radioStyle = css
|
|
2
|
+
export const radioStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
align-items: center;
|
|
7
|
+
cursor: pointer;
|
|
8
|
+
-webkit-tap-highlight-color: transparent;
|
|
9
|
+
-webkit-user-select: none;
|
|
10
|
+
user-select: none;
|
|
11
|
+
touch-action: manipulation;
|
|
12
|
+
zoom: 1;
|
|
13
|
+
-webkit-user-drag: none;
|
|
14
|
+
border-radius: 0.125rem;
|
|
15
|
+
font-size: var(--mdui-typescale-label-large-size);
|
|
16
|
+
font-weight: var(--mdui-typescale-label-large-weight);
|
|
17
|
+
letter-spacing: var(--mdui-typescale-label-large-tracking);
|
|
18
|
+
line-height: var(--mdui-typescale-label-large-line-height);
|
|
19
|
+
}
|
|
20
|
+
.icon {
|
|
21
|
+
display: flex;
|
|
22
|
+
position: absolute;
|
|
23
|
+
font-size: 1.5rem;
|
|
24
|
+
}
|
|
25
|
+
:not(.initial) .icon {
|
|
26
|
+
transition-duration: var(--mdui-motion-duration-short4);
|
|
27
|
+
transition-timing-function: var(--mdui-motion-easing-standard);
|
|
28
|
+
}
|
|
29
|
+
.unchecked-icon {
|
|
30
|
+
transition-property: color;
|
|
31
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
32
|
+
}
|
|
33
|
+
:host([hover]) .unchecked-icon,
|
|
34
|
+
:host([focused]) .unchecked-icon,
|
|
35
|
+
:host([pressed]) .unchecked-icon {
|
|
36
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
37
|
+
}
|
|
38
|
+
.checked-icon {
|
|
39
|
+
opacity: 0;
|
|
40
|
+
transform: scale(0.2);
|
|
41
|
+
transition-property: color, opacity, transform;
|
|
42
|
+
color: rgb(var(--mdui-color-primary));
|
|
43
|
+
}
|
|
44
|
+
.icon .i,
|
|
45
|
+
::slotted([slot='unchecked-icon']),
|
|
46
|
+
::slotted([slot='checked-icon']) {
|
|
47
|
+
color: inherit;
|
|
48
|
+
font-size: inherit;
|
|
49
|
+
}
|
|
50
|
+
i {
|
|
51
|
+
position: relative;
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
width: 2.5rem;
|
|
58
|
+
min-width: 2.5rem;
|
|
59
|
+
height: 2.5rem;
|
|
60
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
61
|
+
}
|
|
62
|
+
.label {
|
|
63
|
+
display: flex;
|
|
64
|
+
width: 100%;
|
|
65
|
+
padding-top: 0.625rem;
|
|
66
|
+
padding-bottom: 0.625rem;
|
|
67
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
68
|
+
}
|
|
69
|
+
.label:not(.initial) {
|
|
70
|
+
transition: color var(--mdui-motion-duration-short4)
|
|
71
|
+
var(--mdui-motion-easing-standard);
|
|
72
|
+
}
|
|
73
|
+
/* 选中状态的图标 */
|
|
74
|
+
:host([checked]) i {
|
|
75
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
76
|
+
}
|
|
77
|
+
:host([checked]) .icon {
|
|
78
|
+
color: rgb(var(--mdui-color-primary));
|
|
79
|
+
}
|
|
80
|
+
:host([checked]) .checked-icon {
|
|
81
|
+
opacity: 1;
|
|
82
|
+
transform: scale(0.5);
|
|
83
|
+
}
|
|
84
|
+
/* 验证不通过状态 */
|
|
85
|
+
i.invalid {
|
|
86
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-error);
|
|
87
|
+
}
|
|
88
|
+
i.invalid .icon {
|
|
89
|
+
color: rgb(var(--mdui-color-error));
|
|
90
|
+
}
|
|
91
|
+
.label.invalid {
|
|
92
|
+
color: rgb(var(--mdui-color-error));
|
|
93
|
+
}
|
|
94
|
+
/* 禁用状态的图标 */
|
|
95
|
+
:host([disabled]),
|
|
96
|
+
:host([group-disabled]) {
|
|
97
|
+
cursor: default;
|
|
98
|
+
pointer-events: none;
|
|
99
|
+
}
|
|
100
|
+
:host([disabled]) .icon,
|
|
101
|
+
:host([group-disabled]) .icon {
|
|
102
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
103
|
+
}
|
|
104
|
+
:host([disabled]) .label,
|
|
105
|
+
:host([group-disabled]) .label {
|
|
106
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
@@ -6,7 +6,7 @@ import type { Ripple } from '../ripple/index.js';
|
|
|
6
6
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
7
7
|
declare const Radio_base: 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;
|
|
8
8
|
/**
|
|
9
|
-
* @summary
|
|
9
|
+
* @summary 单选框组件。需配合 `<mdui-radio-group>` 组件使用
|
|
10
10
|
*
|
|
11
11
|
* ```html
|
|
12
12
|
* <mdui-radio-group value="chinese">
|
|
@@ -19,14 +19,14 @@ declare const Radio_base: import("@open-wc/dedupe-mixin").Constructor<import("..
|
|
|
19
19
|
* @event blur - 失去焦点时触发
|
|
20
20
|
* @event change - 选中该单选项时触发
|
|
21
21
|
*
|
|
22
|
-
* @slot -
|
|
22
|
+
* @slot - 文本内容
|
|
23
23
|
* @slot unchecked-icon - 未选中状态的图标
|
|
24
24
|
* @slot checked-icon - 选中状态的图标
|
|
25
25
|
*
|
|
26
26
|
* @csspart control - 左侧图标容器
|
|
27
27
|
* @csspart unchecked-icon 未选中状态的图标
|
|
28
28
|
* @csspart checked-icon 选中状态的图标
|
|
29
|
-
* @csspart label -
|
|
29
|
+
* @csspart label - 文本内容
|
|
30
30
|
*/
|
|
31
31
|
export declare class Radio extends Radio_base<RadioEventMap> {
|
|
32
32
|
static styles: CSSResultGroup;
|