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
package/components/tabs/tab.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { Ripple } from '../ripple/index.js';
|
|
|
4
4
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
5
5
|
declare const Tab_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;
|
|
6
6
|
/**
|
|
7
|
-
* @summary
|
|
7
|
+
* @summary 选项卡导航项组件。需配合 `<mdui-tabs>` 和 `<mdui-tab-panel>` 组件使用
|
|
8
8
|
*
|
|
9
9
|
* ```html
|
|
10
10
|
* <mdui-tabs value="tab-1">
|
|
@@ -21,19 +21,19 @@ declare const Tab_base: import("@open-wc/dedupe-mixin").Constructor<import("../r
|
|
|
21
21
|
* @event focus - 获得焦点时触发
|
|
22
22
|
* @event blur - 失去焦点时触发
|
|
23
23
|
*
|
|
24
|
-
* @slot -
|
|
24
|
+
* @slot - 选项卡导航项的文本内容
|
|
25
25
|
* @slot icon - 选项卡导航项中的图标
|
|
26
26
|
* @slot badge - 徽标
|
|
27
27
|
* @slot custom - 自定义整个选项卡导航项中的内容
|
|
28
28
|
*
|
|
29
|
-
* @csspart container -
|
|
30
|
-
* @csspart icon -
|
|
31
|
-
* @csspart label -
|
|
29
|
+
* @csspart container - 选项卡导航项容器
|
|
30
|
+
* @csspart icon - 选项卡导航项中的图标
|
|
31
|
+
* @csspart label - 选项卡导航项的文本
|
|
32
32
|
*/
|
|
33
33
|
export declare class Tab extends Tab_base<TabEventMap> {
|
|
34
34
|
static styles: CSSResultGroup;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* 选项卡导航项的值
|
|
37
37
|
*/
|
|
38
38
|
value?: string;
|
|
39
39
|
/**
|
package/components/tabs/tab.js
CHANGED
|
@@ -15,7 +15,7 @@ import '../icon.js';
|
|
|
15
15
|
import { RippleMixin } from '../ripple/ripple-mixin.js';
|
|
16
16
|
import { tabStyle } from './tab-style.js';
|
|
17
17
|
/**
|
|
18
|
-
* @summary
|
|
18
|
+
* @summary 选项卡导航项组件。需配合 `<mdui-tabs>` 和 `<mdui-tab-panel>` 组件使用
|
|
19
19
|
*
|
|
20
20
|
* ```html
|
|
21
21
|
* <mdui-tabs value="tab-1">
|
|
@@ -32,14 +32,14 @@ import { tabStyle } from './tab-style.js';
|
|
|
32
32
|
* @event focus - 获得焦点时触发
|
|
33
33
|
* @event blur - 失去焦点时触发
|
|
34
34
|
*
|
|
35
|
-
* @slot -
|
|
35
|
+
* @slot - 选项卡导航项的文本内容
|
|
36
36
|
* @slot icon - 选项卡导航项中的图标
|
|
37
37
|
* @slot badge - 徽标
|
|
38
38
|
* @slot custom - 自定义整个选项卡导航项中的内容
|
|
39
39
|
*
|
|
40
|
-
* @csspart container -
|
|
41
|
-
* @csspart icon -
|
|
42
|
-
* @csspart label -
|
|
40
|
+
* @csspart container - 选项卡导航项容器
|
|
41
|
+
* @csspart icon - 选项卡导航项中的图标
|
|
42
|
+
* @csspart label - 选项卡导航项的文本
|
|
43
43
|
*/
|
|
44
44
|
let Tab = class Tab extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
45
45
|
constructor() {
|
|
@@ -77,13 +77,33 @@ let Tab = class Tab extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
|
77
77
|
const hasIcon = this.icon || this.hasSlotController.test('icon');
|
|
78
78
|
const hasCustomSlot = this.hasSlotController.test('custom');
|
|
79
79
|
const renderBadge = () => html `<slot name="badge"></slot>`;
|
|
80
|
-
return html `<mdui-ripple
|
|
80
|
+
return html `<mdui-ripple
|
|
81
|
+
${ref(this.rippleRef)}
|
|
82
|
+
.noRipple=${this.noRipple}
|
|
83
|
+
></mdui-ripple>
|
|
84
|
+
<div
|
|
85
|
+
part="container"
|
|
86
|
+
class=${classMap({
|
|
81
87
|
container: true,
|
|
82
88
|
preset: !hasCustomSlot,
|
|
83
89
|
'variant-secondary': this.variant === 'secondary',
|
|
84
|
-
})}
|
|
85
|
-
|
|
86
|
-
|
|
90
|
+
})}
|
|
91
|
+
>
|
|
92
|
+
<slot name="custom">
|
|
93
|
+
<div class="icon-container">
|
|
94
|
+
${when(hasIcon || this.icon, renderBadge)}
|
|
95
|
+
<slot name="icon" part="icon" class="icon">
|
|
96
|
+
${this.icon
|
|
97
|
+
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
98
|
+
: nothingTemplate}
|
|
99
|
+
</slot>
|
|
100
|
+
</div>
|
|
101
|
+
<div class="label-container">
|
|
102
|
+
${when(!hasIcon, renderBadge)}
|
|
103
|
+
<slot part="label" class="label"></slot>
|
|
104
|
+
</div>
|
|
105
|
+
</slot>
|
|
106
|
+
</div>`;
|
|
87
107
|
}
|
|
88
108
|
};
|
|
89
109
|
Tab.styles = [componentStyle, tabStyle];
|
|
@@ -1,2 +1,139 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const tabsStyle = css
|
|
2
|
+
export const tabsStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
:host([placement^='top']) {
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
}
|
|
10
|
+
:host([placement^='bottom']) {
|
|
11
|
+
flex-direction: column-reverse;
|
|
12
|
+
}
|
|
13
|
+
:host([placement^='left']) {
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
}
|
|
16
|
+
:host([placement^='right']) {
|
|
17
|
+
flex-direction: row-reverse;
|
|
18
|
+
}
|
|
19
|
+
.container {
|
|
20
|
+
position: relative;
|
|
21
|
+
display: flex;
|
|
22
|
+
flex: 0 0 auto;
|
|
23
|
+
overflow-x: auto;
|
|
24
|
+
background-color: rgb(var(--mdui-color-surface));
|
|
25
|
+
}
|
|
26
|
+
:host([placement^='top']) .container,
|
|
27
|
+
:host([placement^='bottom']) .container {
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
}
|
|
30
|
+
:host([placement^='left']) .container,
|
|
31
|
+
:host([placement^='right']) .container {
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
}
|
|
34
|
+
:host([placement$='-start']) .container {
|
|
35
|
+
justify-content: flex-start;
|
|
36
|
+
}
|
|
37
|
+
:host([placement='top']) .container,
|
|
38
|
+
:host([placement='bottom']) .container,
|
|
39
|
+
:host([placement='left']) .container,
|
|
40
|
+
:host([placement='right']) .container {
|
|
41
|
+
justify-content: center;
|
|
42
|
+
}
|
|
43
|
+
:host([placement$='-end']) .container {
|
|
44
|
+
justify-content: flex-end;
|
|
45
|
+
}
|
|
46
|
+
.container::after {
|
|
47
|
+
content: ' ';
|
|
48
|
+
position: absolute;
|
|
49
|
+
background-color: rgb(var(--mdui-color-surface-variant));
|
|
50
|
+
}
|
|
51
|
+
:host([placement^='top']) .container::after,
|
|
52
|
+
:host([placement^='bottom']) .container::after {
|
|
53
|
+
left: 0;
|
|
54
|
+
width: 100%;
|
|
55
|
+
height: 0.0625rem;
|
|
56
|
+
}
|
|
57
|
+
:host([placement^='top']) .container::after {
|
|
58
|
+
bottom: 0;
|
|
59
|
+
}
|
|
60
|
+
:host([placement^='bottom']) .container::after {
|
|
61
|
+
top: 0;
|
|
62
|
+
}
|
|
63
|
+
:host([placement^='left']) .container::after,
|
|
64
|
+
:host([placement^='right']) .container::after {
|
|
65
|
+
top: 0;
|
|
66
|
+
height: 100%;
|
|
67
|
+
width: 0.0625rem;
|
|
68
|
+
}
|
|
69
|
+
:host([placement^='left']) .container::after {
|
|
70
|
+
right: 0;
|
|
71
|
+
}
|
|
72
|
+
:host([placement^='right']) .container::after {
|
|
73
|
+
left: 0;
|
|
74
|
+
}
|
|
75
|
+
.indicator {
|
|
76
|
+
position: absolute;
|
|
77
|
+
z-index: 1;
|
|
78
|
+
background-color: rgb(var(--mdui-color-primary));
|
|
79
|
+
}
|
|
80
|
+
.container:not(.initial) .indicator {
|
|
81
|
+
transition-duration: var(--mdui-motion-duration-medium2);
|
|
82
|
+
transition-timing-function: var(--mdui-motion-easing-standard-decelerate);
|
|
83
|
+
}
|
|
84
|
+
:host([placement^='top']) .indicator,
|
|
85
|
+
:host([placement^='bottom']) .indicator {
|
|
86
|
+
transition-property: transform, left, width;
|
|
87
|
+
}
|
|
88
|
+
:host([placement^='left']) .indicator,
|
|
89
|
+
:host([placement^='right']) .indicator {
|
|
90
|
+
transition-property: transform, top, height;
|
|
91
|
+
}
|
|
92
|
+
:host([placement^='top']) .indicator {
|
|
93
|
+
bottom: 0;
|
|
94
|
+
}
|
|
95
|
+
:host([placement^='bottom']) .indicator {
|
|
96
|
+
top: 0;
|
|
97
|
+
}
|
|
98
|
+
:host([placement^='left']) .indicator {
|
|
99
|
+
right: 0;
|
|
100
|
+
}
|
|
101
|
+
:host([placement^='right']) .indicator {
|
|
102
|
+
left: 0;
|
|
103
|
+
}
|
|
104
|
+
:host([placement^='top'][variant='primary']) .indicator,
|
|
105
|
+
:host([placement^='bottom'][variant='primary']) .indicator {
|
|
106
|
+
height: 0.1875rem;
|
|
107
|
+
}
|
|
108
|
+
:host([placement^='top'][variant='secondary']) .indicator,
|
|
109
|
+
:host([placement^='bottom'][variant='secondary']) .indicator {
|
|
110
|
+
height: 0.125rem;
|
|
111
|
+
}
|
|
112
|
+
:host([placement^='left'][variant='primary']) .indicator,
|
|
113
|
+
:host([placement^='right'][variant='primary']) .indicator {
|
|
114
|
+
width: 0.1875rem;
|
|
115
|
+
}
|
|
116
|
+
:host([placement^='left'][variant='secondary']) .indicator,
|
|
117
|
+
:host([placement^='right'][variant='secondary']) .indicator {
|
|
118
|
+
width: 0.125rem;
|
|
119
|
+
}
|
|
120
|
+
:host([placement^='top'][variant='primary']) .indicator {
|
|
121
|
+
border-top-left-radius: 0.1875rem;
|
|
122
|
+
border-top-right-radius: 0.1875rem;
|
|
123
|
+
}
|
|
124
|
+
:host([placement^='bottom'][variant='primary']) .indicator {
|
|
125
|
+
border-bottom-right-radius: 0.1875rem;
|
|
126
|
+
border-bottom-left-radius: 0.1875rem;
|
|
127
|
+
}
|
|
128
|
+
:host([placement^='left'][variant='primary']) .indicator {
|
|
129
|
+
border-top-left-radius: 0.1875rem;
|
|
130
|
+
border-bottom-left-radius: 0.1875rem;
|
|
131
|
+
}
|
|
132
|
+
:host([placement^='right'][variant='primary']) .indicator {
|
|
133
|
+
border-top-right-radius: 0.1875rem;
|
|
134
|
+
border-bottom-right-radius: 0.1875rem;
|
|
135
|
+
}
|
|
136
|
+
:host([full-width]) ::slotted(mdui-tab) {
|
|
137
|
+
flex: 1;
|
|
138
|
+
}
|
|
139
|
+
`;
|
|
@@ -5,7 +5,7 @@ import '@mdui/jq/methods/get.js';
|
|
|
5
5
|
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
6
6
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
7
7
|
/**
|
|
8
|
-
* @summary
|
|
8
|
+
* @summary 选项卡组件。需配合 `<mdui-tab>` 和 `<mdui-tab-panel>` 组件使用
|
|
9
9
|
*
|
|
10
10
|
* ```html
|
|
11
11
|
* <mdui-tabs value="tab-1">
|
|
@@ -30,33 +30,33 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
30
30
|
export declare class Tabs extends MduiElement<TabsEventMap> {
|
|
31
31
|
static styles: CSSResultGroup;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* 选项卡形状。可选值包括:
|
|
34
34
|
*
|
|
35
|
-
* * `primary
|
|
36
|
-
* * `secondary
|
|
35
|
+
* * `primary`:适用于位于 `<mdui-top-app-bar>` 下方,用于切换应用的主页面的场景
|
|
36
|
+
* * `secondary`:适用于位于页面中,用于切换一组相关内容的场景
|
|
37
37
|
*/
|
|
38
|
-
variant:
|
|
38
|
+
variant: /*适用于位于 `<mdui-top-app-bar>` 下方,用于切换应用的主页面的场景*/ 'primary' | /*适用于位于页面中,用于切换一组相关内容的场景*/ 'secondary';
|
|
39
39
|
/**
|
|
40
40
|
* 当前激活的 `<mdui-tab>` 的值
|
|
41
41
|
*/
|
|
42
42
|
value?: string;
|
|
43
43
|
/**
|
|
44
|
-
* 选项卡位置。默认为 `top-start
|
|
44
|
+
* 选项卡位置。默认为 `top-start`。可选值包括:
|
|
45
45
|
*
|
|
46
|
-
* * `top-start
|
|
47
|
-
* * `top
|
|
48
|
-
* * `top-end
|
|
49
|
-
* * `bottom-start
|
|
50
|
-
* * `bottom
|
|
51
|
-
* * `bottom-end
|
|
52
|
-
* * `left-start
|
|
53
|
-
* * `left
|
|
54
|
-
* * `left-end
|
|
55
|
-
* * `right-start
|
|
56
|
-
* * `right
|
|
57
|
-
* * `right-end
|
|
46
|
+
* * `top-start`:位于上方,左对齐
|
|
47
|
+
* * `top`:位于上方,居中对齐
|
|
48
|
+
* * `top-end`:位于上方,右对齐
|
|
49
|
+
* * `bottom-start`:位于下方,左对齐
|
|
50
|
+
* * `bottom`:位于下方,居中对齐
|
|
51
|
+
* * `bottom-end`:位于下方,右对齐
|
|
52
|
+
* * `left-start`:位于左侧,顶部对齐
|
|
53
|
+
* * `left`:位于左侧,居中对齐
|
|
54
|
+
* * `left-end`:位于左侧,底部对齐
|
|
55
|
+
* * `right-start`:位于右侧,顶部对齐
|
|
56
|
+
* * `right`:位于右侧,居中对齐
|
|
57
|
+
* * `right-end`:位于右侧,底部对齐
|
|
58
58
|
*/
|
|
59
|
-
placement:
|
|
59
|
+
placement: /*位于上方,左对齐*/ 'top-start' | /*位于上方,居中对齐*/ 'top' | /*位于上方,右对齐*/ 'top-end' | /*位于下方,左对齐*/ 'bottom-start' | /*位于下方,居中对齐*/ 'bottom' | /*位于下方,右对齐*/ 'bottom-end' | /*位于左侧,顶部对齐*/ 'left-start' | /*位于左侧,居中对齐*/ 'left' | /*位于左侧,底部对齐*/ 'left-end' | /*位于右侧,顶部对齐*/ 'right-start' | /*位于右侧,居中对齐*/ 'right' | /*位于右侧,底部对齐*/ 'right-end';
|
|
60
60
|
/**
|
|
61
61
|
* 是否填满父元素宽度
|
|
62
62
|
*/
|
package/components/tabs/tabs.js
CHANGED
|
@@ -16,7 +16,7 @@ import { observeResize } from '@mdui/shared/helpers/observeResize.js';
|
|
|
16
16
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
17
17
|
import { tabsStyle } from './tabs-style.js';
|
|
18
18
|
/**
|
|
19
|
-
* @summary
|
|
19
|
+
* @summary 选项卡组件。需配合 `<mdui-tab>` 和 `<mdui-tab-panel>` 组件使用
|
|
20
20
|
*
|
|
21
21
|
* ```html
|
|
22
22
|
* <mdui-tabs value="tab-1">
|
|
@@ -42,27 +42,27 @@ let Tabs = class Tabs extends MduiElement {
|
|
|
42
42
|
constructor() {
|
|
43
43
|
super(...arguments);
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* 选项卡形状。可选值包括:
|
|
46
46
|
*
|
|
47
|
-
* * `primary
|
|
48
|
-
* * `secondary
|
|
47
|
+
* * `primary`:适用于位于 `<mdui-top-app-bar>` 下方,用于切换应用的主页面的场景
|
|
48
|
+
* * `secondary`:适用于位于页面中,用于切换一组相关内容的场景
|
|
49
49
|
*/
|
|
50
50
|
this.variant = 'primary';
|
|
51
51
|
/**
|
|
52
|
-
* 选项卡位置。默认为 `top-start
|
|
52
|
+
* 选项卡位置。默认为 `top-start`。可选值包括:
|
|
53
53
|
*
|
|
54
|
-
* * `top-start
|
|
55
|
-
* * `top
|
|
56
|
-
* * `top-end
|
|
57
|
-
* * `bottom-start
|
|
58
|
-
* * `bottom
|
|
59
|
-
* * `bottom-end
|
|
60
|
-
* * `left-start
|
|
61
|
-
* * `left
|
|
62
|
-
* * `left-end
|
|
63
|
-
* * `right-start
|
|
64
|
-
* * `right
|
|
65
|
-
* * `right-end
|
|
54
|
+
* * `top-start`:位于上方,左对齐
|
|
55
|
+
* * `top`:位于上方,居中对齐
|
|
56
|
+
* * `top-end`:位于上方,右对齐
|
|
57
|
+
* * `bottom-start`:位于下方,左对齐
|
|
58
|
+
* * `bottom`:位于下方,居中对齐
|
|
59
|
+
* * `bottom-end`:位于下方,右对齐
|
|
60
|
+
* * `left-start`:位于左侧,顶部对齐
|
|
61
|
+
* * `left`:位于左侧,居中对齐
|
|
62
|
+
* * `left-end`:位于左侧,底部对齐
|
|
63
|
+
* * `right-start`:位于右侧,顶部对齐
|
|
64
|
+
* * `right`:位于右侧,居中对齐
|
|
65
|
+
* * `right-end`:位于右侧,底部对齐
|
|
66
66
|
*/
|
|
67
67
|
this.placement = 'top-start';
|
|
68
68
|
/**
|
|
@@ -107,7 +107,15 @@ let Tabs = class Tabs extends MduiElement {
|
|
|
107
107
|
this.observeResize = observeResize(this.containerRef.value, () => this.updateIndicator());
|
|
108
108
|
}
|
|
109
109
|
render() {
|
|
110
|
-
return html `<div
|
|
110
|
+
return html `<div
|
|
111
|
+
${ref(this.containerRef)}
|
|
112
|
+
part="container"
|
|
113
|
+
class="container ${classMap({ initial: this.isInitial })}"
|
|
114
|
+
>
|
|
115
|
+
<slot @slotchange=${this.onSlotChange} @click=${this.onClick}></slot>
|
|
116
|
+
<div ${ref(this.indicatorRef)} part="indicator" class="indicator"></div>
|
|
117
|
+
</div>
|
|
118
|
+
<slot name="panel" @slotchange=${this.onSlotChange}></slot>`;
|
|
111
119
|
}
|
|
112
120
|
async onSlotChange() {
|
|
113
121
|
await this.definedController.whenDefined();
|
|
@@ -30,9 +30,9 @@ declare const TextField_base: import("@open-wc/dedupe-mixin").Constructor<import
|
|
|
30
30
|
* @slot suffix - 右侧文本
|
|
31
31
|
* @slot clear-button - 清空按钮
|
|
32
32
|
* @slot clear-icon - 清空按钮中的图标
|
|
33
|
-
* @slot toggle-password-button -
|
|
34
|
-
* @slot show-password-icon -
|
|
35
|
-
* @slot hide-password-icon -
|
|
33
|
+
* @slot toggle-password-button - 密码显示状态切换按钮
|
|
34
|
+
* @slot show-password-icon - 显示密码状态下,密码显示状态切换按钮中的图标
|
|
35
|
+
* @slot hide-password-icon - 隐藏密码状态下,密码显示状态切换按钮中的图标
|
|
36
36
|
* @slot helper - 底部的帮助文本
|
|
37
37
|
*
|
|
38
38
|
* @csspart container - 文本框容器
|
|
@@ -45,9 +45,9 @@ declare const TextField_base: import("@open-wc/dedupe-mixin").Constructor<import
|
|
|
45
45
|
* @csspart input - 内部的 `<input>` 或 `<textarea>` 元素
|
|
46
46
|
* @csspart clear-button - 清空按钮
|
|
47
47
|
* @csspart clear-icon - 清空按钮中的图标
|
|
48
|
-
* @csspart toggle-password-button -
|
|
49
|
-
* @csspart show-password-icon -
|
|
50
|
-
* @csspart hide-password-icon -
|
|
48
|
+
* @csspart toggle-password-button - 密码显示状态切换按钮
|
|
49
|
+
* @csspart show-password-icon - 显示密码状态下,密码显示状态切换按钮中的图标
|
|
50
|
+
* @csspart hide-password-icon - 隐藏密码状态下,密码显示状态切换按钮中的图标
|
|
51
51
|
* @csspart supporting - 底部辅助信息容器,包括 helper、error、counter
|
|
52
52
|
* @csspart helper - 底部的帮助文本
|
|
53
53
|
* @csspart error - 底部的错误描述文本
|
|
@@ -56,14 +56,14 @@ declare const TextField_base: import("@open-wc/dedupe-mixin").Constructor<import
|
|
|
56
56
|
export declare class TextField extends TextField_base<TextFieldEventMap> implements FormControl {
|
|
57
57
|
static styles: CSSResultGroup;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* 文本框的形状。默认为 `filled`。可选值包括:
|
|
60
60
|
*
|
|
61
61
|
* * `filled`:带背景色的文本框,视觉效果较强
|
|
62
62
|
* * `outlined`:带边框的文本框,视觉效果较弱
|
|
63
63
|
*/
|
|
64
64
|
variant: /*带背景色的文本框,视觉效果较强*/ 'filled' | /*带边框的文本框,视觉效果较弱*/ 'outlined';
|
|
65
65
|
/**
|
|
66
|
-
* 文本框输入类型。默认为 `text
|
|
66
|
+
* 文本框输入类型。默认为 `text`。可选值包括:
|
|
67
67
|
*
|
|
68
68
|
* * `text`:默认值。文本字段
|
|
69
69
|
* * `number`:只能输入数字。拥有动态键盘的设备上会显示数字键盘
|
|
@@ -97,7 +97,7 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
97
97
|
*/
|
|
98
98
|
label?: string;
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
100
|
+
* 占位符文本
|
|
101
101
|
*/
|
|
102
102
|
placeholder?: string;
|
|
103
103
|
/**
|
|
@@ -105,11 +105,11 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
105
105
|
*/
|
|
106
106
|
helper?: string;
|
|
107
107
|
/**
|
|
108
|
-
*
|
|
108
|
+
* 是否仅在获得焦点时,显示底部的帮助文本
|
|
109
109
|
*/
|
|
110
110
|
helperOnFocus: boolean;
|
|
111
111
|
/**
|
|
112
|
-
*
|
|
112
|
+
* 是否可清空文本框内容
|
|
113
113
|
*/
|
|
114
114
|
clearable: boolean;
|
|
115
115
|
/**
|
|
@@ -117,15 +117,15 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
117
117
|
*/
|
|
118
118
|
clearIcon?: string;
|
|
119
119
|
/**
|
|
120
|
-
*
|
|
120
|
+
* 是否将文本右对齐
|
|
121
121
|
*/
|
|
122
122
|
endAligned: boolean;
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
124
|
+
* 文本框的前缀文本。只在文本框聚焦或有值时显示。也可以通过 `slot="prefix"` 设置
|
|
125
125
|
*/
|
|
126
126
|
prefix: string;
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
128
|
+
* 文本框的后缀文本。只在文本框聚焦或有值时显示。也可以通过 `slot="suffix"` 设置
|
|
129
129
|
*/
|
|
130
130
|
suffix?: string;
|
|
131
131
|
/**
|
|
@@ -141,17 +141,17 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
141
141
|
*/
|
|
142
142
|
errorIcon?: string;
|
|
143
143
|
/**
|
|
144
|
-
* 关联的
|
|
144
|
+
* 关联的 `<form>` 元素。此属性值应为同一页面中的一个 `<form>` 元素的 `id`。
|
|
145
145
|
*
|
|
146
|
-
*
|
|
146
|
+
* 如果未指定此属性,则该元素必须是 `<form>` 元素的子元素。通过此属性,你可以将元素放置在页面的任何位置,而不仅仅是 `<form>` 元素的子元素。
|
|
147
147
|
*/
|
|
148
148
|
form?: string;
|
|
149
149
|
/**
|
|
150
|
-
*
|
|
150
|
+
* 是否为只读模式
|
|
151
151
|
*/
|
|
152
152
|
readonly: boolean;
|
|
153
153
|
/**
|
|
154
|
-
*
|
|
154
|
+
* 是否禁用输入框
|
|
155
155
|
*/
|
|
156
156
|
disabled: boolean;
|
|
157
157
|
/**
|
|
@@ -159,19 +159,19 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
159
159
|
*/
|
|
160
160
|
required: boolean;
|
|
161
161
|
/**
|
|
162
|
-
*
|
|
162
|
+
* 文本框的固定显示行数
|
|
163
163
|
*/
|
|
164
164
|
rows?: number;
|
|
165
165
|
/**
|
|
166
|
-
*
|
|
166
|
+
* 是否根据输入内容自动调整文本框高度
|
|
167
167
|
*/
|
|
168
168
|
autosize: boolean;
|
|
169
169
|
/**
|
|
170
|
-
* `autosize` 为 `true`
|
|
170
|
+
* `autosize` 为 `true` 时,文本框的最小行数
|
|
171
171
|
*/
|
|
172
172
|
minRows?: number;
|
|
173
173
|
/**
|
|
174
|
-
* `autosize` 为 `true`
|
|
174
|
+
* `autosize` 为 `true` 时,文本框的最大行数
|
|
175
175
|
*/
|
|
176
176
|
maxRows?: number;
|
|
177
177
|
/**
|
|
@@ -183,7 +183,7 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
183
183
|
*/
|
|
184
184
|
maxlength?: number;
|
|
185
185
|
/**
|
|
186
|
-
*
|
|
186
|
+
* 是否显示字数统计,只在 `maxlength` 被指定时有效
|
|
187
187
|
*/
|
|
188
188
|
counter: boolean;
|
|
189
189
|
/**
|
|
@@ -195,7 +195,7 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
195
195
|
*/
|
|
196
196
|
max?: number;
|
|
197
197
|
/**
|
|
198
|
-
* `type` 为 `number`
|
|
198
|
+
* `type` 为 `number` 时,数值增减的步长
|
|
199
199
|
*/
|
|
200
200
|
step?: number;
|
|
201
201
|
/**
|
|
@@ -203,55 +203,55 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
203
203
|
*/
|
|
204
204
|
pattern?: string;
|
|
205
205
|
/**
|
|
206
|
-
* `type` 为 `password`
|
|
206
|
+
* `type` 为 `password` 时,设置此属性会添加一个切换按钮,用于在明文和密文之间切换
|
|
207
207
|
*/
|
|
208
208
|
togglePassword: boolean;
|
|
209
209
|
/**
|
|
210
|
-
*
|
|
210
|
+
* 密码切换按钮的 Material Icons 图标,当密码为明文时显示。也可以通过 `slot="show-password-icon"` 设置
|
|
211
211
|
*/
|
|
212
212
|
showPasswordIcon?: string;
|
|
213
213
|
/**
|
|
214
|
-
*
|
|
214
|
+
* 密码切换按钮的 Material Icons 图标,当密码为密文时显示。也可以通过 `slot="hide-password-icon"` 设置
|
|
215
215
|
*/
|
|
216
216
|
hidePasswordIcon?: string;
|
|
217
217
|
/**
|
|
218
|
-
* iOS
|
|
218
|
+
* iOS 的非标准属性,用于控制文本首字母是否自动大写。在 iOS5 及以后的版本上有效。可选值包括:
|
|
219
219
|
*
|
|
220
220
|
* * `none`:禁用首字母大写
|
|
221
|
-
* * `sentences
|
|
222
|
-
* * `words
|
|
223
|
-
* * `characters
|
|
221
|
+
* * `sentences`:句子首字母大写
|
|
222
|
+
* * `words`:单词首字母大写
|
|
223
|
+
* * `characters`:所有字母大写
|
|
224
224
|
*/
|
|
225
|
-
autocapitalize: /*禁用首字母大写*/ 'none' |
|
|
225
|
+
autocapitalize: /*禁用首字母大写*/ 'none' | /*句子首字母大写*/ 'sentences' | /*单词首字母大写*/ 'words' | /*所有字母大写*/ 'characters';
|
|
226
226
|
/**
|
|
227
227
|
* `input` 元素的 `autocorrect` 属性
|
|
228
228
|
*/
|
|
229
229
|
autocorrect?: string;
|
|
230
230
|
/**
|
|
231
|
-
*
|
|
231
|
+
* 是否使用浏览器的自动填充功能。可选值包括:
|
|
232
232
|
*
|
|
233
|
-
* * `off
|
|
233
|
+
* * `off`:禁用浏览器的自动填充,使用者必须输入他们想要输入的所有内容。或者网页提供了自己的自动填充方法
|
|
234
234
|
* * `on`:浏览器根据用户之前输入的内容或者习惯,在用户输入的时候给出相应输入提示
|
|
235
235
|
*/
|
|
236
|
-
autocomplete?:
|
|
236
|
+
autocomplete?: /*禁用浏览器的自动填充,使用者必须输入他们想要输入的所有内容。或者网页提供了自己的自动填充方法*/ 'off' | /*浏览器根据用户之前输入的内容或者习惯,在用户输入的时候给出相应输入提示*/ 'on';
|
|
237
237
|
/**
|
|
238
|
-
* `input` 元素的 `enterkeyhint`
|
|
238
|
+
* `input` 元素的 `enterkeyhint` 属性,用于定制虚拟键盘上的 Enter 键的显示文本或图标。具体显示效果取决于用户使用的设备和语言。可选值包括:
|
|
239
239
|
*
|
|
240
|
-
* * `enter
|
|
241
|
-
* * `done
|
|
242
|
-
* * `go
|
|
240
|
+
* * `enter`:插入新行
|
|
241
|
+
* * `done`:完成输入,关闭虚拟键盘
|
|
242
|
+
* * `go`:导航到输入文本的目标
|
|
243
243
|
* * `next`:移动到下一个输入项
|
|
244
244
|
* * `previous`:移动到上一个输入项
|
|
245
|
-
* * `search
|
|
245
|
+
* * `search`:导航到搜索结果
|
|
246
246
|
* * `send`:发送文本信息
|
|
247
247
|
*/
|
|
248
|
-
enterkeyhint?:
|
|
248
|
+
enterkeyhint?: /*插入新行*/ 'enter' | /*完成输入,关闭虚拟键盘*/ 'done' | /*导航到输入文本的目标*/ 'go' | /*移动到下一个输入项*/ 'next' | /*移动到上一个输入项*/ 'previous' | /*导航到搜索结果*/ 'search' | /*发送文本信息*/ 'send';
|
|
249
249
|
/**
|
|
250
|
-
*
|
|
250
|
+
* 是否启用拼写检查
|
|
251
251
|
*/
|
|
252
252
|
spellcheck: boolean;
|
|
253
253
|
/**
|
|
254
|
-
* `input` 元素的 `inputmode`
|
|
254
|
+
* `input` 元素的 `inputmode` 属性,用于定制虚拟键盘的类型。可选值包括:
|
|
255
255
|
*
|
|
256
256
|
* * `none`:无虚拟键盘。在需要实现自己的键盘输入控件时很有用
|
|
257
257
|
* * `text`:标准文本输入键盘
|
|
@@ -296,11 +296,11 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
296
296
|
*/
|
|
297
297
|
private readonlyButClearable;
|
|
298
298
|
/**
|
|
299
|
-
*
|
|
299
|
+
* 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)
|
|
300
300
|
*/
|
|
301
301
|
get validity(): ValidityState;
|
|
302
302
|
/**
|
|
303
|
-
*
|
|
303
|
+
* 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串
|
|
304
304
|
*/
|
|
305
305
|
get validationMessage(): string;
|
|
306
306
|
/**
|
|
@@ -338,7 +338,7 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
338
338
|
*/
|
|
339
339
|
setSelectionRange(start: number, end: number, direction?: 'forward' | 'backward' | 'none'): void;
|
|
340
340
|
/**
|
|
341
|
-
*
|
|
341
|
+
* 将文本框中特定范围的文本替换为新的文本
|
|
342
342
|
* @param replacement 要插入的字符串
|
|
343
343
|
* @param start 要替换的字符的起止位置的索引。默认为当前用户选中的字符的起始位置的索引
|
|
344
344
|
* @param end 要替换的字符的结束位置的索引。默认为当前用户选中的字符的结束位置的索引
|
|
@@ -350,19 +350,19 @@ export declare class TextField extends TextField_base<TextFieldEventMap> impleme
|
|
|
350
350
|
*/
|
|
351
351
|
setRangeText(replacement: string, start: number, end: number, selectMode?: 'select' | 'start' | 'end' | 'preserve'): void;
|
|
352
352
|
/**
|
|
353
|
-
*
|
|
353
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`
|
|
354
354
|
*/
|
|
355
355
|
checkValidity(): boolean;
|
|
356
356
|
/**
|
|
357
|
-
*
|
|
357
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。
|
|
358
358
|
*
|
|
359
|
-
*
|
|
359
|
+
* 如果验证未通过,还会在组件上显示验证失败的提示。
|
|
360
360
|
*/
|
|
361
361
|
reportValidity(): boolean;
|
|
362
362
|
/**
|
|
363
|
-
*
|
|
363
|
+
* 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证
|
|
364
364
|
*
|
|
365
|
-
* @param message
|
|
365
|
+
* @param message 自定义的错误提示文本
|
|
366
366
|
*/
|
|
367
367
|
setCustomValidity(message: string): void;
|
|
368
368
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|