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
|
@@ -8,35 +8,35 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
8
8
|
* <mdui-avatar src="https://avatars.githubusercontent.com/u/3030330?s=40&v=4"></mdui-avatar>
|
|
9
9
|
* ```
|
|
10
10
|
*
|
|
11
|
-
* @slot -
|
|
11
|
+
* @slot - 自定义头像内容,可以为字母、汉字、`<img>` 元素、图标等
|
|
12
12
|
*
|
|
13
|
-
* @csspart image -
|
|
14
|
-
* @csspart icon -
|
|
13
|
+
* @csspart image - 使用图片作为头像时,组件内部的 `<img>` 元素
|
|
14
|
+
* @csspart icon - 使用图标作为头像时,组件内部的 `<mdui-icon>` 元素
|
|
15
15
|
*
|
|
16
|
-
* @cssprop --shape-corner -
|
|
16
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
17
17
|
*/
|
|
18
18
|
export declare class Avatar extends MduiElement<AvatarEventMap> {
|
|
19
19
|
static styles: CSSResultGroup;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 头像图片的 URL 地址
|
|
22
22
|
*/
|
|
23
23
|
src?: string;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 图片如何适应容器框,与原生的 [`object-fit`](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit) 属性相同。可选值包括:
|
|
26
26
|
*
|
|
27
|
-
* * `contain
|
|
28
|
-
* * `cover
|
|
29
|
-
* * `fill
|
|
30
|
-
* * `none
|
|
31
|
-
* * `scale-down
|
|
27
|
+
* * `contain`:保持图片原有尺寸比例,内容会被等比例缩放
|
|
28
|
+
* * `cover`:保持图片原有尺寸比例,但部分内容可能被剪切
|
|
29
|
+
* * `fill`:默认值,不保持图片原有尺寸比例,内容会被拉伸以填充整个容器
|
|
30
|
+
* * `none`:保留图片原有尺寸,内容不会被缩放或拉伸
|
|
31
|
+
* * `scale-down`:保持图片原有尺寸比例,内容尺寸与 `none` 或 `contain` 中较小的一个相同
|
|
32
32
|
*/
|
|
33
|
-
fit?:
|
|
33
|
+
fit?: /*保持图片原有尺寸比例,内容会被等比例缩放*/ 'contain' | /*保持图片原有尺寸比例,但部分内容可能被剪切*/ 'cover' | /*默认值,不保持图片原有尺寸比例,内容会被拉伸以填充整个容器*/ 'fill' | /*保留图片原有尺寸,内容不会被缩放或拉伸*/ 'none' | /*保持图片原有尺寸比例,内容尺寸与 `none` 或 `contain` 中较小的一个相同*/ 'scale-down';
|
|
34
34
|
/**
|
|
35
35
|
* 头像的 Material Icons 图标名
|
|
36
36
|
*/
|
|
37
37
|
icon?: string;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* 头像的替代文本描述
|
|
40
40
|
*/
|
|
41
41
|
label?: string;
|
|
42
42
|
private readonly hasSlotController;
|
|
@@ -16,12 +16,12 @@ import { style } from './style.js';
|
|
|
16
16
|
* <mdui-avatar src="https://avatars.githubusercontent.com/u/3030330?s=40&v=4"></mdui-avatar>
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
|
-
* @slot -
|
|
19
|
+
* @slot - 自定义头像内容,可以为字母、汉字、`<img>` 元素、图标等
|
|
20
20
|
*
|
|
21
|
-
* @csspart image -
|
|
22
|
-
* @csspart icon -
|
|
21
|
+
* @csspart image - 使用图片作为头像时,组件内部的 `<img>` 元素
|
|
22
|
+
* @csspart icon - 使用图标作为头像时,组件内部的 `<mdui-icon>` 元素
|
|
23
23
|
*
|
|
24
|
-
* @cssprop --shape-corner -
|
|
24
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
25
25
|
*/
|
|
26
26
|
let Avatar = class Avatar extends MduiElement {
|
|
27
27
|
constructor() {
|
|
@@ -7,18 +7,19 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
7
7
|
* <mdui-badge>12</mdui-badge>
|
|
8
8
|
* ```
|
|
9
9
|
*
|
|
10
|
-
* @slot -
|
|
10
|
+
* @slot - 徽标中显示的文本
|
|
11
11
|
*
|
|
12
|
-
* @cssprop --shape-corner -
|
|
12
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
13
13
|
*/
|
|
14
14
|
export declare class Badge extends MduiElement<BadgeEventMap> {
|
|
15
15
|
static styles: CSSResultGroup;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* * `
|
|
17
|
+
* 徽标的形状。可选值包括:
|
|
18
|
+
*
|
|
19
|
+
* * `small`:小型徽标,不显示文本
|
|
20
|
+
* * `large`:大型徽标,会显示文本
|
|
20
21
|
*/
|
|
21
|
-
variant:
|
|
22
|
+
variant: /*小型徽标,不显示文本*/ 'small' | /*大型徽标,会显示文本*/ 'large';
|
|
22
23
|
protected render(): TemplateResult;
|
|
23
24
|
}
|
|
24
25
|
export interface BadgeEventMap {
|
|
@@ -12,17 +12,18 @@ import { style } from './style.js';
|
|
|
12
12
|
* <mdui-badge>12</mdui-badge>
|
|
13
13
|
* ```
|
|
14
14
|
*
|
|
15
|
-
* @slot -
|
|
15
|
+
* @slot - 徽标中显示的文本
|
|
16
16
|
*
|
|
17
|
-
* @cssprop --shape-corner -
|
|
17
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
18
18
|
*/
|
|
19
19
|
let Badge = class Badge extends MduiElement {
|
|
20
20
|
constructor() {
|
|
21
21
|
super(...arguments);
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* * `
|
|
23
|
+
* 徽标的形状。可选值包括:
|
|
24
|
+
*
|
|
25
|
+
* * `small`:小型徽标,不显示文本
|
|
26
|
+
* * `large`:大型徽标,会显示文本
|
|
26
27
|
*/
|
|
27
28
|
this.variant = 'large';
|
|
28
29
|
}
|
|
@@ -24,8 +24,8 @@ declare const BottomAppBar_base: import("@open-wc/dedupe-mixin").Constructor<imp
|
|
|
24
24
|
*
|
|
25
25
|
* @slot - 底部应用栏内部的元素
|
|
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 BottomAppBar extends BottomAppBar_base<BottomAppBarEventMap> {
|
|
31
31
|
static styles: CSSResultGroup;
|
|
@@ -34,11 +34,12 @@ export declare class BottomAppBar extends BottomAppBar_base<BottomAppBarEventMap
|
|
|
34
34
|
*/
|
|
35
35
|
hide: boolean;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 是否让底部应用栏中的 [`<mdui-fab>`](/docs/2/components/fab) 组件脱离应用栏。如果为 `true`,则当应用栏隐藏后,[`<mdui-fab>`](/docs/2/components/fab) 仍会停留在页面上
|
|
38
38
|
*/
|
|
39
39
|
fabDetach: boolean;
|
|
40
40
|
/**
|
|
41
41
|
* 滚动行为。可选值为:
|
|
42
|
+
*
|
|
42
43
|
* * `hide`:滚动时隐藏
|
|
43
44
|
*/
|
|
44
45
|
scrollBehavior?: 'hide';
|
|
@@ -27,8 +27,8 @@ import { style } from './style.js';
|
|
|
27
27
|
*
|
|
28
28
|
* @slot - 底部应用栏内部的元素
|
|
29
29
|
*
|
|
30
|
-
* @cssprop --shape-corner -
|
|
31
|
-
* @cssprop --z-index - 组件的 CSS
|
|
30
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
31
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
32
32
|
*/
|
|
33
33
|
let BottomAppBar = class BottomAppBar extends ScrollBehaviorMixin(LayoutItemBase) {
|
|
34
34
|
constructor() {
|
|
@@ -38,7 +38,7 @@ let BottomAppBar = class BottomAppBar extends ScrollBehaviorMixin(LayoutItemBase
|
|
|
38
38
|
*/
|
|
39
39
|
this.hide = false;
|
|
40
40
|
/**
|
|
41
|
-
*
|
|
41
|
+
* 是否让底部应用栏中的 [`<mdui-fab>`](/docs/2/components/fab) 组件脱离应用栏。如果为 `true`,则当应用栏隐藏后,[`<mdui-fab>`](/docs/2/components/fab) 仍会停留在页面上
|
|
42
42
|
*/
|
|
43
43
|
this.fabDetach = false;
|
|
44
44
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const buttonBaseStyle = css `.button{position:relative;display:inline-flex;align-items:center;justify-content:center;height:100%;padding:0;overflow:hidden;color:inherit;font-size:inherit;font-family:inherit;letter-spacing:inherit;white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background:0 0;border:none;outline:0;cursor:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none}`;
|
|
2
|
+
export const buttonBaseStyle = css `.button{position:relative;display:inline-flex;align-items:center;justify-content:center;height:100%;padding:0;overflow:hidden;color:inherit;font-size:inherit;font-family:inherit;font-weight:inherit;letter-spacing:inherit;white-space:nowrap;text-align:center;text-decoration:none;vertical-align:middle;background:0 0;border:none;outline:0;cursor:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none}`;
|
|
@@ -16,118 +16,117 @@ export declare class ButtonBase<E> extends ButtonBase_base<E> {
|
|
|
16
16
|
*/
|
|
17
17
|
disabled: boolean;
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* 是否处于加载中状态
|
|
20
20
|
*/
|
|
21
21
|
loading: boolean;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* 按钮的名称,将与表单数据一起提交。
|
|
24
24
|
*
|
|
25
|
-
* **Note
|
|
25
|
+
* **Note**:仅在未设置 `href` 属性时,此属性才有效。
|
|
26
26
|
*/
|
|
27
27
|
name: string;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* 按钮的初始值,将与表单数据一起提交。
|
|
30
30
|
*
|
|
31
|
-
* **Note
|
|
31
|
+
* **Note**:仅在未设置 `href` 属性时,此属性才有效。
|
|
32
32
|
*/
|
|
33
33
|
value: string;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* 按钮的类型。默认类型为 `button`。可选类型包括:
|
|
36
36
|
*
|
|
37
|
-
* * `submit
|
|
38
|
-
* * `reset
|
|
39
|
-
* * `button
|
|
37
|
+
* * `submit`:点击按钮会提交表单数据到服务器
|
|
38
|
+
* * `reset`:点击按钮会将表单中的所有字段重置为初始值
|
|
39
|
+
* * `button`:此类型的按钮没有默认行为
|
|
40
40
|
*
|
|
41
|
-
* **Note**:仅在未指定 `href`
|
|
41
|
+
* **Note**:仅在未指定 `href` 属性时,此属性才有效。
|
|
42
42
|
*/
|
|
43
43
|
type: /*此按钮将表单数据提交给服务器*/ 'submit' | /*此按钮重置所有组件为初始值*/ 'reset' | /*此按钮没有默认行为*/ 'button';
|
|
44
44
|
/**
|
|
45
|
-
* 关联的
|
|
45
|
+
* 关联的 `<form>` 元素。此属性值应为同一页面中的一个 `<form>` 元素的 `id`。
|
|
46
46
|
*
|
|
47
|
-
*
|
|
47
|
+
* 如果未指定此属性,则该元素必须是 `<form>` 元素的子元素。通过此属性,你可以将元素放置在页面的任何位置,而不仅仅是 `<form>` 元素的子元素。
|
|
48
48
|
*
|
|
49
|
-
* **Note**:仅在未指定 `href`
|
|
49
|
+
* **Note**:仅在未指定 `href` 属性时,此属性才有效。
|
|
50
50
|
*/
|
|
51
51
|
form?: string;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
54
53
|
* 指定提交表单的 URL。
|
|
55
54
|
*
|
|
56
|
-
*
|
|
55
|
+
* 如果指定了此属性,将覆盖 `<form>` 元素的 `action` 属性。
|
|
57
56
|
*
|
|
58
|
-
* **Note**:仅在未指定 `href`
|
|
57
|
+
* **Note**:仅在未指定 `href` 属性且 `type="submit"` 时,此属性才有效。
|
|
59
58
|
*/
|
|
60
59
|
formAction?: string;
|
|
61
60
|
/**
|
|
62
|
-
*
|
|
61
|
+
* 指定提交表单到服务器的内容类型。可选值包括:
|
|
63
62
|
*
|
|
64
|
-
* * `application/x-www-form-urlencoded
|
|
65
|
-
* * `multipart/form-data`:当表单包含 `<input type="file">`
|
|
66
|
-
* * `text/plain
|
|
63
|
+
* * `application/x-www-form-urlencoded`:未指定该属性时的默认值
|
|
64
|
+
* * `multipart/form-data`:当表单包含 `<input type="file">` 元素时使用
|
|
65
|
+
* * `text/plain`:HTML5 新增,用于调试
|
|
67
66
|
*
|
|
68
|
-
*
|
|
67
|
+
* 如果指定了此属性,将覆盖 `<form>` 元素的 `enctype` 属性。
|
|
69
68
|
*
|
|
70
|
-
* **Note**:仅在未指定 `href`
|
|
69
|
+
* **Note**:仅在未指定 `href` 属性且 `type="submit"` 时,此属性才有效。
|
|
71
70
|
*/
|
|
72
|
-
formEnctype?:
|
|
71
|
+
formEnctype?: /*未指定该属性时的默认值*/ 'application/x-www-form-urlencoded' | /*当表单包含 `<input type="file">` 元素时使用*/ 'multipart/form-data' | /*HTML5 新增,用于调试*/ 'text/plain';
|
|
73
72
|
/**
|
|
74
|
-
*
|
|
73
|
+
* 指定提交表单时使用的 HTTP 方法。可选值包括:
|
|
75
74
|
*
|
|
76
|
-
* * `post
|
|
77
|
-
* * `get
|
|
75
|
+
* * `post`:表单数据包含在表单内容中,发送到服务器
|
|
76
|
+
* * `get`:表单数据以 `?` 作为分隔符附加到表单的 URI 属性中,生成的 URI 发送到服务器。当表单没有副作用,并且仅包含 ASCII 字符时,使用此方法
|
|
78
77
|
*
|
|
79
|
-
*
|
|
78
|
+
* 如果设置了此属性,将覆盖 `<form>` 元素的 `method` 属性。
|
|
80
79
|
*
|
|
81
|
-
* **Note
|
|
80
|
+
* **Note**:仅在未设置 `href` 属性且 `type="submit"` 时,此属性才有效。
|
|
82
81
|
*/
|
|
83
|
-
formMethod?:
|
|
82
|
+
formMethod?: /*表单数据包含在表单内容中,发送到服务器*/ 'post' | /*表单数据以 `?` 作为分隔符附加到表单的 URI 属性中,生成的 URI 发送到服务器。当表单没有副作用,并且仅包含 ASCII 字符时,使用此方法*/ 'get';
|
|
84
83
|
/**
|
|
85
|
-
*
|
|
84
|
+
* 如果设置了此属性,表单提交时将不执行表单验证。
|
|
86
85
|
*
|
|
87
|
-
*
|
|
86
|
+
* 如果设置了此属性,将覆盖 `<form>` 元素的 `novalidate` 属性。
|
|
88
87
|
*
|
|
89
|
-
* **Note
|
|
88
|
+
* **Note**:仅在未设置 `href` 属性且 `type="submit"` 时,此属性才有效。
|
|
90
89
|
*/
|
|
91
90
|
formNoValidate: boolean;
|
|
92
91
|
/**
|
|
93
|
-
*
|
|
92
|
+
* 提交表单后接收到的响应应显示在何处。可选值包括:
|
|
94
93
|
*
|
|
95
|
-
* * `_self
|
|
94
|
+
* * `_self`:默认选项,在当前框架中打开
|
|
96
95
|
* * `_blank`:在新窗口中打开
|
|
97
96
|
* * `_parent`:在父框架中打开
|
|
98
97
|
* * `_top`:在整个窗口中打开
|
|
99
98
|
*
|
|
100
|
-
*
|
|
99
|
+
* 如果设置了此属性,将覆盖 `<form>` 元素的 `target` 属性。
|
|
101
100
|
*
|
|
102
|
-
* **Note
|
|
101
|
+
* **Note**:仅在未设置 `href` 属性且 `type="submit"` 时,此属性才有效。
|
|
103
102
|
*/
|
|
104
|
-
formTarget?:
|
|
103
|
+
formTarget?: /*默认选项,在当前框架中打开*/ '_self' | /*在新窗口中打开*/ '_blank' | /*在父框架中打开*/ '_parent' | /*在整个窗口中打开*/ '_top';
|
|
105
104
|
private readonly formController;
|
|
106
105
|
/**
|
|
107
|
-
*
|
|
106
|
+
* 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)
|
|
108
107
|
*/
|
|
109
108
|
get validity(): ValidityState | undefined;
|
|
110
109
|
/**
|
|
111
|
-
*
|
|
110
|
+
* 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串
|
|
112
111
|
*/
|
|
113
112
|
get validationMessage(): string | undefined;
|
|
114
113
|
protected get rippleDisabled(): boolean;
|
|
115
114
|
protected get focusElement(): HTMLElement | null;
|
|
116
115
|
protected get focusDisabled(): boolean;
|
|
117
116
|
/**
|
|
118
|
-
*
|
|
117
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`
|
|
119
118
|
*/
|
|
120
119
|
checkValidity(): boolean;
|
|
121
120
|
/**
|
|
122
|
-
*
|
|
121
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。
|
|
123
122
|
*
|
|
124
|
-
*
|
|
123
|
+
* 如果验证未通过,还会在组件上显示验证失败的提示。
|
|
125
124
|
*/
|
|
126
125
|
reportValidity(): boolean;
|
|
127
126
|
/**
|
|
128
|
-
*
|
|
127
|
+
* 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证
|
|
129
128
|
*
|
|
130
|
-
* @param message
|
|
129
|
+
* @param message 自定义的错误提示文本
|
|
131
130
|
*/
|
|
132
131
|
setCustomValidity(message: string): void;
|
|
133
132
|
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
@@ -21,43 +21,43 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
|
|
|
21
21
|
*/
|
|
22
22
|
this.disabled = false;
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* 是否处于加载中状态
|
|
25
25
|
*/
|
|
26
26
|
this.loading = false;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* 按钮的名称,将与表单数据一起提交。
|
|
29
29
|
*
|
|
30
|
-
* **Note
|
|
30
|
+
* **Note**:仅在未设置 `href` 属性时,此属性才有效。
|
|
31
31
|
*/
|
|
32
32
|
this.name = '';
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* 按钮的初始值,将与表单数据一起提交。
|
|
35
35
|
*
|
|
36
|
-
* **Note
|
|
36
|
+
* **Note**:仅在未设置 `href` 属性时,此属性才有效。
|
|
37
37
|
*/
|
|
38
38
|
this.value = '';
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* 按钮的类型。默认类型为 `button`。可选类型包括:
|
|
41
41
|
*
|
|
42
|
-
* * `submit
|
|
43
|
-
* * `reset
|
|
44
|
-
* * `button
|
|
42
|
+
* * `submit`:点击按钮会提交表单数据到服务器
|
|
43
|
+
* * `reset`:点击按钮会将表单中的所有字段重置为初始值
|
|
44
|
+
* * `button`:此类型的按钮没有默认行为
|
|
45
45
|
*
|
|
46
|
-
* **Note**:仅在未指定 `href`
|
|
46
|
+
* **Note**:仅在未指定 `href` 属性时,此属性才有效。
|
|
47
47
|
*/
|
|
48
48
|
this.type = 'button';
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
50
|
+
* 如果设置了此属性,表单提交时将不执行表单验证。
|
|
51
51
|
*
|
|
52
|
-
*
|
|
52
|
+
* 如果设置了此属性,将覆盖 `<form>` 元素的 `novalidate` 属性。
|
|
53
53
|
*
|
|
54
|
-
* **Note
|
|
54
|
+
* **Note**:仅在未设置 `href` 属性且 `type="submit"` 时,此属性才有效。
|
|
55
55
|
*/
|
|
56
56
|
this.formNoValidate = false;
|
|
57
57
|
this.formController = new FormController(this);
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)
|
|
61
61
|
*/
|
|
62
62
|
get validity() {
|
|
63
63
|
if (this.isButton()) {
|
|
@@ -65,7 +65,7 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串
|
|
69
69
|
*/
|
|
70
70
|
get validationMessage() {
|
|
71
71
|
if (this.isButton()) {
|
|
@@ -86,7 +86,7 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
|
|
|
86
86
|
return this.disabled || this.loading;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`
|
|
90
90
|
*/
|
|
91
91
|
checkValidity() {
|
|
92
92
|
if (this.isButton()) {
|
|
@@ -104,9 +104,9 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
|
|
|
104
104
|
return true;
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
*
|
|
107
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。
|
|
108
108
|
*
|
|
109
|
-
*
|
|
109
|
+
* 如果验证未通过,还会在组件上显示验证失败的提示。
|
|
110
110
|
*/
|
|
111
111
|
reportValidity() {
|
|
112
112
|
if (this.isButton()) {
|
|
@@ -125,9 +125,9 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiEleme
|
|
|
125
125
|
return true;
|
|
126
126
|
}
|
|
127
127
|
/**
|
|
128
|
-
*
|
|
128
|
+
* 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证
|
|
129
129
|
*
|
|
130
|
-
* @param message
|
|
130
|
+
* @param message 自定义的错误提示文本
|
|
131
131
|
*/
|
|
132
132
|
setCustomValidity(message) {
|
|
133
133
|
if (this.isButton()) {
|
|
@@ -14,29 +14,29 @@ import type { TemplateResult, CSSResultGroup } from 'lit';
|
|
|
14
14
|
* @event invalid - 表单字段验证未通过时触发
|
|
15
15
|
*
|
|
16
16
|
* @slot - 按钮的文本
|
|
17
|
-
* @slot icon -
|
|
18
|
-
* @slot end-icon -
|
|
17
|
+
* @slot icon - 按钮左侧的元素
|
|
18
|
+
* @slot end-icon - 按钮右侧的元素
|
|
19
19
|
*
|
|
20
20
|
* @csspart button - 内部的 `<button>` 或 `<a>` 元素
|
|
21
|
-
* @csspart label -
|
|
22
|
-
* @csspart icon -
|
|
23
|
-
* @csspart end-icon -
|
|
21
|
+
* @csspart label - 按钮的文本
|
|
22
|
+
* @csspart icon - 按钮左侧的图标
|
|
23
|
+
* @csspart end-icon - 按钮右侧的图标
|
|
24
24
|
* @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
|
|
25
25
|
*
|
|
26
|
-
* @cssprop --shape-corner -
|
|
26
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
27
27
|
*/
|
|
28
28
|
export declare class Button extends ButtonBase<ButtonEventMap> {
|
|
29
29
|
static styles: CSSResultGroup;
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* 按钮的形状。可选值包括:
|
|
32
32
|
*
|
|
33
|
-
* * `elevated
|
|
34
|
-
* * `filled
|
|
35
|
-
* * `tonal`:视觉效果介于 `filled` 和 `outlined`
|
|
36
|
-
* * `outlined
|
|
37
|
-
* * `text
|
|
33
|
+
* * `elevated`:带阴影的按钮,适用于需要将按钮与背景视觉分离的场景
|
|
34
|
+
* * `filled`:视觉效果强烈,适用于重要流程的最终操作,如“保存”、“确认”等
|
|
35
|
+
* * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作,如流程中的“下一步”
|
|
36
|
+
* * `outlined`:带边框的按钮,适用于中等优先级,且次要的操作,如“返回”
|
|
37
|
+
* * `text`:文本按钮,适用于最低优先级的操作
|
|
38
38
|
*/
|
|
39
|
-
variant:
|
|
39
|
+
variant: /*带阴影的按钮,适用于需要将按钮与背景视觉分离的场景*/ 'elevated' | /*视觉效果强烈,适用于重要流程的最终操作,如“保存”、“确认”等*/ 'filled' | /*视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作,如流程中的“下一步”*/ 'tonal' | /*带边框的按钮,适用于中等优先级,且次要的操作,如“返回”*/ 'outlined' | /*文本按钮,适用于最低优先级的操作*/ 'text';
|
|
40
40
|
/**
|
|
41
41
|
* 是否填满父元素宽度
|
|
42
42
|
*/
|
|
@@ -19,28 +19,28 @@ import { style } from './style.js';
|
|
|
19
19
|
* @event invalid - 表单字段验证未通过时触发
|
|
20
20
|
*
|
|
21
21
|
* @slot - 按钮的文本
|
|
22
|
-
* @slot icon -
|
|
23
|
-
* @slot end-icon -
|
|
22
|
+
* @slot icon - 按钮左侧的元素
|
|
23
|
+
* @slot end-icon - 按钮右侧的元素
|
|
24
24
|
*
|
|
25
25
|
* @csspart button - 内部的 `<button>` 或 `<a>` 元素
|
|
26
|
-
* @csspart label -
|
|
27
|
-
* @csspart icon -
|
|
28
|
-
* @csspart end-icon -
|
|
26
|
+
* @csspart label - 按钮的文本
|
|
27
|
+
* @csspart icon - 按钮左侧的图标
|
|
28
|
+
* @csspart end-icon - 按钮右侧的图标
|
|
29
29
|
* @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
|
|
30
30
|
*
|
|
31
|
-
* @cssprop --shape-corner -
|
|
31
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
32
32
|
*/
|
|
33
33
|
let Button = class Button extends ButtonBase {
|
|
34
34
|
constructor() {
|
|
35
35
|
super(...arguments);
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 按钮的形状。可选值包括:
|
|
38
38
|
*
|
|
39
|
-
* * `elevated
|
|
40
|
-
* * `filled
|
|
41
|
-
* * `tonal`:视觉效果介于 `filled` 和 `outlined`
|
|
42
|
-
* * `outlined
|
|
43
|
-
* * `text
|
|
39
|
+
* * `elevated`:带阴影的按钮,适用于需要将按钮与背景视觉分离的场景
|
|
40
|
+
* * `filled`:视觉效果强烈,适用于重要流程的最终操作,如“保存”、“确认”等
|
|
41
|
+
* * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作,如流程中的“下一步”
|
|
42
|
+
* * `outlined`:带边框的按钮,适用于中等优先级,且次要的操作,如“返回”
|
|
43
|
+
* * `text`:文本按钮,适用于最低优先级的操作
|
|
44
44
|
*/
|
|
45
45
|
this.variant = 'filled';
|
|
46
46
|
/**
|
|
@@ -22,19 +22,19 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
22
22
|
* @csspart selected-icon 选中状态的图标
|
|
23
23
|
* @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
|
|
24
24
|
*
|
|
25
|
-
* @cssprop --shape-corner -
|
|
25
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
26
26
|
*/
|
|
27
27
|
export declare class ButtonIcon extends ButtonBase<ButtonIconEventMap> {
|
|
28
28
|
static styles: CSSResultGroup;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* 图标按钮的形状。可选值包括:
|
|
31
31
|
*
|
|
32
|
-
* * `standard
|
|
33
|
-
* * `filled
|
|
34
|
-
* * `tonal`:视觉效果介于 `filled` 和 `outlined`
|
|
35
|
-
* * `outlined
|
|
32
|
+
* * `standard`:适用于最低优先级的操作
|
|
33
|
+
* * `filled`:视觉效果强烈,适用于高优先级的操作
|
|
34
|
+
* * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作
|
|
35
|
+
* * `outlined`:适用于中等优先级的操作
|
|
36
36
|
*/
|
|
37
|
-
variant:
|
|
37
|
+
variant: /*适用于最低优先级的操作*/ 'standard' | /*视觉效果强烈,适用于高优先级的操作*/ 'filled' | /*视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作*/ 'tonal' | /*适用于中等优先级的操作*/ 'outlined';
|
|
38
38
|
/**
|
|
39
39
|
* Material Icons 图标名。也可以通过 default slot 设置
|
|
40
40
|
*/
|
|
@@ -48,7 +48,7 @@ export declare class ButtonIcon extends ButtonBase<ButtonIconEventMap> {
|
|
|
48
48
|
*/
|
|
49
49
|
selectable: boolean;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* 是否已被选中
|
|
52
52
|
*/
|
|
53
53
|
selected: boolean;
|
|
54
54
|
private readonly rippleRef;
|
|
@@ -29,18 +29,18 @@ import { style } from './style.js';
|
|
|
29
29
|
* @csspart selected-icon 选中状态的图标
|
|
30
30
|
* @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
|
|
31
31
|
*
|
|
32
|
-
* @cssprop --shape-corner -
|
|
32
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
33
33
|
*/
|
|
34
34
|
let ButtonIcon = class ButtonIcon extends ButtonBase {
|
|
35
35
|
constructor() {
|
|
36
36
|
super(...arguments);
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
38
|
+
* 图标按钮的形状。可选值包括:
|
|
39
39
|
*
|
|
40
|
-
* * `standard
|
|
41
|
-
* * `filled
|
|
42
|
-
* * `tonal`:视觉效果介于 `filled` 和 `outlined`
|
|
43
|
-
* * `outlined
|
|
40
|
+
* * `standard`:适用于最低优先级的操作
|
|
41
|
+
* * `filled`:视觉效果强烈,适用于高优先级的操作
|
|
42
|
+
* * `tonal`:视觉效果介于 `filled` 和 `outlined` 之间,适用于中高优先级的操作
|
|
43
|
+
* * `outlined`:适用于中等优先级的操作
|
|
44
44
|
*/
|
|
45
45
|
this.variant = 'standard';
|
|
46
46
|
/**
|
|
@@ -48,7 +48,7 @@ let ButtonIcon = class ButtonIcon extends ButtonBase {
|
|
|
48
48
|
*/
|
|
49
49
|
this.selectable = false;
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* 是否已被选中
|
|
52
52
|
*/
|
|
53
53
|
this.selected = false;
|
|
54
54
|
this.rippleRef = createRef();
|