mdui 2.0.3 → 2.0.4
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 +4 -4
- package/components/badge/index.d.ts +7 -6
- package/components/badge/index.js +6 -5
- package/components/bottom-app-bar/index.d.ts +4 -3
- package/components/bottom-app-bar/index.js +3 -3
- package/components/button/button-base-style.js +1 -1
- package/components/button/button-base.d.ts +43 -44
- package/components/button/button-base.js +20 -20
- package/components/button/index.d.ts +13 -13
- package/components/button/index.js +12 -12
- package/components/button-icon/index.d.ts +8 -8
- package/components/button-icon/index.js +7 -7
- package/components/card/index.d.ts +8 -8
- package/components/card/index.js +7 -7
- package/components/checkbox/index.d.ts +20 -20
- package/components/checkbox/index.js +18 -18
- package/components/chip/index.d.ts +19 -19
- package/components/chip/index.js +16 -16
- package/components/circular-progress/index.d.ts +2 -2
- package/components/circular-progress/index.js +1 -1
- package/components/collapse/collapse-item.d.ts +4 -4
- package/components/collapse/collapse-item.js +2 -2
- package/components/collapse/collapse.d.ts +6 -9
- package/components/collapse/collapse.js +4 -4
- package/components/dialog/index.d.ts +13 -13
- package/components/dialog/index.js +13 -13
- package/components/divider/index.d.ts +3 -3
- package/components/divider/index.js +3 -3
- package/components/dropdown/index.d.ts +35 -35
- package/components/dropdown/index.js +33 -33
- package/components/fab/index.d.ts +6 -6
- package/components/fab/index.js +6 -6
- package/components/layout/layout-item.d.ts +7 -7
- package/components/layout/layout-item.js +6 -6
- package/components/layout/layout-main.d.ts +2 -2
- package/components/layout/layout-main.js +2 -2
- 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 +3 -3
- package/components/list/list-item.d.ts +17 -17
- package/components/list/list-item.js +7 -7
- 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.d.ts +4 -4
- package/components/menu/menu-item.js +2 -2
- package/components/menu/menu.d.ts +15 -18
- package/components/menu/menu.js +8 -8
- package/components/navigation-bar/navigation-bar-item.d.ts +5 -5
- package/components/navigation-bar/navigation-bar-item.js +4 -4
- package/components/navigation-bar/navigation-bar.d.ts +9 -8
- package/components/navigation-bar/navigation-bar.js +6 -6
- package/components/navigation-drawer/index.d.ts +19 -20
- package/components/navigation-drawer/index.js +44 -30
- package/components/navigation-rail/navigation-rail-item.d.ts +6 -6
- package/components/navigation-rail/navigation-rail-item.js +4 -4
- package/components/navigation-rail/navigation-rail.d.ts +10 -11
- package/components/navigation-rail/navigation-rail.js +9 -10
- package/components/radio/radio-group.d.ts +13 -13
- package/components/radio/radio-group.js +11 -11
- package/components/radio/radio.d.ts +3 -3
- package/components/radio/radio.js +3 -3
- package/components/range-slider/index.d.ts +4 -5
- package/components/range-slider/index.js +4 -5
- package/components/segmented-button/segmented-button-group.d.ts +17 -20
- package/components/segmented-button/segmented-button-group.js +11 -14
- package/components/segmented-button/segmented-button.d.ts +3 -3
- package/components/segmented-button/segmented-button.js +3 -3
- package/components/select/index.d.ts +31 -32
- package/components/select/index.js +19 -20
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +1 -1
- package/components/slider/slider-base.d.ts +15 -15
- package/components/slider/slider-base.js +13 -13
- package/components/snackbar/index.d.ts +21 -21
- package/components/snackbar/index.js +15 -15
- package/components/switch/index.d.ts +14 -14
- package/components/switch/index.js +11 -11
- package/components/tabs/tab-panel.d.ts +3 -3
- package/components/tabs/tab-panel.js +2 -2
- package/components/tabs/tab.d.ts +6 -6
- package/components/tabs/tab.js +5 -5
- package/components/tabs/tabs.d.ts +19 -19
- package/components/tabs/tabs.js +17 -17
- package/components/text-field/index.d.ts +51 -51
- package/components/text-field/index.js +25 -25
- package/components/tooltip/index.d.ts +31 -31
- package/components/tooltip/index.js +28 -28
- package/components/top-app-bar/top-app-bar-title.d.ts +4 -4
- package/components/top-app-bar/top-app-bar-title.js +4 -4
- 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 +1072 -1115
- package/html-data.en.json +6551 -0
- package/html-data.zh-cn.json +1420 -1435
- package/jsx.en.d.ts +3303 -0
- package/jsx.zh-cn.d.ts +3351 -0
- package/mdui.esm.js +9 -9
- package/mdui.global.js +5 -5
- package/package.json +6 -5
- package/web-types.en.json +11718 -0
- package/web-types.zh-cn.json +3222 -3232
|
@@ -28,53 +28,52 @@ import { style } from './style.js';
|
|
|
28
28
|
* <mdui-navigation-drawer>content</mdui-navigation-drawer>
|
|
29
29
|
* ```
|
|
30
30
|
*
|
|
31
|
-
* @event open -
|
|
32
|
-
* @event opened -
|
|
33
|
-
* @event close -
|
|
34
|
-
* @event closed -
|
|
31
|
+
* @event open - 抽屉栏打开之前触发。可以通过调用 `event.preventDefault()` 阻止抽屉栏打开
|
|
32
|
+
* @event opened - 抽屉栏打开动画完成之后触发
|
|
33
|
+
* @event close - 抽屉栏关闭之前触发。可以通过调用 `event.preventDefault()` 阻止抽屉栏关闭
|
|
34
|
+
* @event closed - 抽屉栏关闭动画完成之后触发
|
|
35
35
|
* @event overlay-click - 点击遮罩层时触发
|
|
36
36
|
*
|
|
37
|
-
* @slot -
|
|
37
|
+
* @slot - 抽屉栏中的内容
|
|
38
38
|
*
|
|
39
39
|
* @csspart overlay - 遮罩层
|
|
40
|
-
* @csspart panel -
|
|
40
|
+
* @csspart panel - 抽屉栏容器
|
|
41
41
|
*
|
|
42
|
-
* @cssprop --shape-corner -
|
|
43
|
-
* @cssprop --z-index - 组件的 CSS
|
|
42
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
43
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
44
44
|
*/
|
|
45
45
|
let NavigationDrawer = class NavigationDrawer extends LayoutItemBase {
|
|
46
46
|
constructor() {
|
|
47
47
|
super(...arguments);
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* 是否打开抽屉栏
|
|
50
50
|
*/
|
|
51
51
|
this.open = false;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* 抽屉栏打开时,是否显示遮罩层
|
|
54
54
|
*
|
|
55
|
-
*
|
|
55
|
+
* 在窄屏设备上(屏幕宽度小于 [`--mdui-breakpoint-md`](/docs/2/styles/design-tokens#breakpoint)),会始终显示遮罩层,无视该参数
|
|
56
56
|
*/
|
|
57
57
|
this.modal = false;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* 在有遮罩层的情况下,按下 ESC 键是否关闭抽屉栏
|
|
60
60
|
*/
|
|
61
61
|
this.closeOnEsc = false;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* 点击遮罩层时,是否关闭抽屉栏
|
|
64
64
|
*/
|
|
65
65
|
this.closeOnOverlayClick = false;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* 抽屉栏的位置。可选值包括:
|
|
68
68
|
*
|
|
69
|
-
* * `left
|
|
70
|
-
* * `right
|
|
69
|
+
* * `left`:左侧
|
|
70
|
+
* * `right`:右侧
|
|
71
71
|
*/
|
|
72
72
|
this.placement = 'left';
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* 默认情况下,抽屉栏相对于 `body` 元素显示。当该参数设置为 `true` 时,抽屉栏将相对于其父元素显示。
|
|
75
75
|
*
|
|
76
|
-
* Note:
|
|
77
|
-
* 设置了该属性时,必须手动在父元素上设置样式 `position: relative; overflow: hidden;`
|
|
76
|
+
* **Note**:设置该属性时,必须在父元素上手动设置样式 `position: relative; overflow: hidden;`。
|
|
78
77
|
*/
|
|
79
78
|
this.contained = false;
|
|
80
79
|
// 断点为 mobile 时为 `true` 时,强制使用遮罩层
|
|
@@ -91,7 +90,7 @@ let NavigationDrawer = class NavigationDrawer extends LayoutItemBase {
|
|
|
91
90
|
get lockTarget() {
|
|
92
91
|
return this.contained || this.isParentLayout
|
|
93
92
|
? this.parentElement
|
|
94
|
-
: document.
|
|
93
|
+
: document.documentElement;
|
|
95
94
|
}
|
|
96
95
|
get isModal() {
|
|
97
96
|
return this.mobile || this.modal;
|
|
@@ -100,7 +99,7 @@ let NavigationDrawer = class NavigationDrawer extends LayoutItemBase {
|
|
|
100
99
|
async onContainedChange() {
|
|
101
100
|
await this.definedController.whenDefined();
|
|
102
101
|
this.observeResize?.unobserve();
|
|
103
|
-
this.observeResize = observeResize(this.contained ? this.parentElement : document.
|
|
102
|
+
this.observeResize = observeResize(this.contained ? this.parentElement : document.documentElement, () => {
|
|
104
103
|
const target = this.contained ? this.parentElement : undefined;
|
|
105
104
|
this.mobile = breakpoint(target).down('md');
|
|
106
105
|
// 若位于 layout 中,且为模态化,则重新布局时,占据的宽度为 0
|
|
@@ -142,14 +141,22 @@ let NavigationDrawer = class NavigationDrawer extends LayoutItemBase {
|
|
|
142
141
|
};
|
|
143
142
|
// 停止原有动画
|
|
144
143
|
const stopOldAnimations = async () => {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
144
|
+
const elements = [];
|
|
145
|
+
if (this.isModal) {
|
|
146
|
+
elements.push(overlay, panel);
|
|
147
|
+
}
|
|
148
|
+
else if (!this.isParentLayout) {
|
|
149
|
+
elements.push(this.lockTarget);
|
|
150
|
+
}
|
|
151
|
+
if (this.isParentLayout) {
|
|
152
|
+
const layoutItems = this.layoutManager.getItemsAndMain();
|
|
153
|
+
const layoutIndex = layoutItems.indexOf(this);
|
|
154
|
+
elements.push(...layoutItems.slice(layoutIndex));
|
|
155
|
+
}
|
|
156
|
+
if (!this.isModal && !elements.includes(this)) {
|
|
157
|
+
elements.push(this);
|
|
158
|
+
}
|
|
159
|
+
await Promise.all(elements.map((element) => stopAnimations(element)));
|
|
153
160
|
};
|
|
154
161
|
// 打开
|
|
155
162
|
// 要区分是否首次渲染,首次渲染时不触发事件,不执行动画;非首次渲染,触发事件,执行动画
|
|
@@ -203,6 +210,7 @@ let NavigationDrawer = class NavigationDrawer extends LayoutItemBase {
|
|
|
203
210
|
// 但首次渲染不执行动画
|
|
204
211
|
if (this.isParentLayout && hasUpdated) {
|
|
205
212
|
setLayoutTransition(duration, easingEmphasized);
|
|
213
|
+
this.layoutManager.updateLayout(this);
|
|
206
214
|
}
|
|
207
215
|
// drawer 显示动画
|
|
208
216
|
animations.push(animateTo(this.isModal ? panel : this, [
|
|
@@ -213,6 +221,9 @@ let NavigationDrawer = class NavigationDrawer extends LayoutItemBase {
|
|
|
213
221
|
easing: easingEmphasized,
|
|
214
222
|
}));
|
|
215
223
|
await Promise.all(animations);
|
|
224
|
+
if (!this.open) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
216
227
|
// 若位于 layout 中,则 drawer 动画完成后,移除 layout-main 的动画
|
|
217
228
|
if (this.isParentLayout && hasUpdated) {
|
|
218
229
|
setLayoutTransition(null);
|
|
@@ -258,6 +269,9 @@ let NavigationDrawer = class NavigationDrawer extends LayoutItemBase {
|
|
|
258
269
|
{ transform: `translateX(${isRight ? '' : '-'}100%)` },
|
|
259
270
|
], { duration, easing: easingEmphasized }));
|
|
260
271
|
await Promise.all(animations);
|
|
272
|
+
if (this.open) {
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
261
275
|
// 若位于 layout 中,则 drawer 动画结束后,移除 layout-main 的动画
|
|
262
276
|
if (this.isParentLayout) {
|
|
263
277
|
setLayoutTransition(null);
|
|
@@ -266,7 +280,7 @@ let NavigationDrawer = class NavigationDrawer extends LayoutItemBase {
|
|
|
266
280
|
if (this.isModal && !this.contained) {
|
|
267
281
|
unlockScreen(this, this.lockTarget);
|
|
268
282
|
}
|
|
269
|
-
//
|
|
283
|
+
// 抽屉栏关闭后,恢复焦点到原有的元素上
|
|
270
284
|
const trigger = this.originalTrigger;
|
|
271
285
|
if (isFunction(trigger?.focus)) {
|
|
272
286
|
setTimeout(() => trigger.focus());
|
|
@@ -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() {
|
|
@@ -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
|
/**
|
|
@@ -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,9 +145,9 @@ 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);
|
|
@@ -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;
|
|
@@ -14,7 +14,7 @@ import '../icon.js';
|
|
|
14
14
|
import { RippleMixin } from '../ripple/ripple-mixin.js';
|
|
15
15
|
import { radioStyle } from './radio-style.js';
|
|
16
16
|
/**
|
|
17
|
-
* @summary
|
|
17
|
+
* @summary 单选框组件。需配合 `<mdui-radio-group>` 组件使用
|
|
18
18
|
*
|
|
19
19
|
* ```html
|
|
20
20
|
* <mdui-radio-group value="chinese">
|
|
@@ -27,14 +27,14 @@ import { radioStyle } from './radio-style.js';
|
|
|
27
27
|
* @event blur - 失去焦点时触发
|
|
28
28
|
* @event change - 选中该单选项时触发
|
|
29
29
|
*
|
|
30
|
-
* @slot -
|
|
30
|
+
* @slot - 文本内容
|
|
31
31
|
* @slot unchecked-icon - 未选中状态的图标
|
|
32
32
|
* @slot checked-icon - 选中状态的图标
|
|
33
33
|
*
|
|
34
34
|
* @csspart control - 左侧图标容器
|
|
35
35
|
* @csspart unchecked-icon 未选中状态的图标
|
|
36
36
|
* @csspart checked-icon 选中状态的图标
|
|
37
|
-
* @csspart label -
|
|
37
|
+
* @csspart label - 文本内容
|
|
38
38
|
*/
|
|
39
39
|
let Radio = class Radio extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
40
40
|
constructor() {
|
|
@@ -12,7 +12,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
12
12
|
*
|
|
13
13
|
* @event focus - 获得焦点时触发
|
|
14
14
|
* @event blur - 失去焦点时触发
|
|
15
|
-
* @event change -
|
|
15
|
+
* @event change - 值发生变更,且失去焦点时,将触发该事件
|
|
16
16
|
* @event input - 值变更时触发
|
|
17
17
|
* @event invalid - 表单字段验证未通过时触发
|
|
18
18
|
*
|
|
@@ -25,7 +25,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
25
25
|
export declare class RangeSlider extends SliderBase<RangeSliderEventMap> implements FormControl {
|
|
26
26
|
static styles: CSSResultGroup;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* 默认值。在重置表单时,将重置为该默认值。此属性只能通过 JavaScript 属性设置
|
|
29
29
|
*/
|
|
30
30
|
defaultValue: number[];
|
|
31
31
|
/**
|
|
@@ -40,10 +40,9 @@ export declare class RangeSlider extends SliderBase<RangeSliderEventMap> impleme
|
|
|
40
40
|
private readonly formController;
|
|
41
41
|
private _value;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* 滑块的值,为数组格式,将于表单数据一起提交。
|
|
44
44
|
*
|
|
45
|
-
* NOTE
|
|
46
|
-
* 该属性无法通过 HTML 属性设置初始值,如果要修改该值,只能通过修改 JavaScript 属性值实现。
|
|
45
|
+
* **NOTE**:该属性无法通过 HTML 属性设置初始值,如果要修改该值,只能通过修改 JavaScript 属性值实现。
|
|
47
46
|
*/
|
|
48
47
|
get value(): number[];
|
|
49
48
|
set value(_value: number[]);
|
|
@@ -20,7 +20,7 @@ import { SliderBase } from '../slider/slider-base.js';
|
|
|
20
20
|
*
|
|
21
21
|
* @event focus - 获得焦点时触发
|
|
22
22
|
* @event blur - 失去焦点时触发
|
|
23
|
-
* @event change -
|
|
23
|
+
* @event change - 值发生变更,且失去焦点时,将触发该事件
|
|
24
24
|
* @event input - 值变更时触发
|
|
25
25
|
* @event invalid - 表单字段验证未通过时触发
|
|
26
26
|
*
|
|
@@ -34,7 +34,7 @@ let RangeSlider = class RangeSlider extends SliderBase {
|
|
|
34
34
|
constructor() {
|
|
35
35
|
super(...arguments);
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 默认值。在重置表单时,将重置为该默认值。此属性只能通过 JavaScript 属性设置
|
|
38
38
|
*/
|
|
39
39
|
this.defaultValue = [];
|
|
40
40
|
/**
|
|
@@ -55,10 +55,9 @@ let RangeSlider = class RangeSlider extends SliderBase {
|
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
*
|
|
58
|
+
* 滑块的值,为数组格式,将于表单数据一起提交。
|
|
59
59
|
*
|
|
60
|
-
* NOTE
|
|
61
|
-
* 该属性无法通过 HTML 属性设置初始值,如果要修改该值,只能通过修改 JavaScript 属性值实现。
|
|
60
|
+
* **NOTE**:该属性无法通过 HTML 属性设置初始值,如果要修改该值,只能通过修改 JavaScript 属性值实现。
|
|
62
61
|
*/
|
|
63
62
|
get value() {
|
|
64
63
|
return this._value;
|