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
|
@@ -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;
|
|
@@ -48,9 +48,9 @@ import { style } from './style.js';
|
|
|
48
48
|
* @slot suffix - 右侧文本
|
|
49
49
|
* @slot clear-button - 清空按钮
|
|
50
50
|
* @slot clear-icon - 清空按钮中的图标
|
|
51
|
-
* @slot toggle-password-button -
|
|
52
|
-
* @slot show-password-icon -
|
|
53
|
-
* @slot hide-password-icon -
|
|
51
|
+
* @slot toggle-password-button - 密码显示状态切换按钮
|
|
52
|
+
* @slot show-password-icon - 显示密码状态下,密码显示状态切换按钮中的图标
|
|
53
|
+
* @slot hide-password-icon - 隐藏密码状态下,密码显示状态切换按钮中的图标
|
|
54
54
|
* @slot helper - 底部的帮助文本
|
|
55
55
|
*
|
|
56
56
|
* @csspart container - 文本框容器
|
|
@@ -63,9 +63,9 @@ import { style } from './style.js';
|
|
|
63
63
|
* @csspart input - 内部的 `<input>` 或 `<textarea>` 元素
|
|
64
64
|
* @csspart clear-button - 清空按钮
|
|
65
65
|
* @csspart clear-icon - 清空按钮中的图标
|
|
66
|
-
* @csspart toggle-password-button -
|
|
67
|
-
* @csspart show-password-icon -
|
|
68
|
-
* @csspart hide-password-icon -
|
|
66
|
+
* @csspart toggle-password-button - 密码显示状态切换按钮
|
|
67
|
+
* @csspart show-password-icon - 显示密码状态下,密码显示状态切换按钮中的图标
|
|
68
|
+
* @csspart hide-password-icon - 隐藏密码状态下,密码显示状态切换按钮中的图标
|
|
69
69
|
* @csspart supporting - 底部辅助信息容器,包括 helper、error、counter
|
|
70
70
|
* @csspart helper - 底部的帮助文本
|
|
71
71
|
* @csspart error - 底部的错误描述文本
|
|
@@ -75,14 +75,14 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
|
|
|
75
75
|
constructor() {
|
|
76
76
|
super(...arguments);
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* 文本框的形状。默认为 `filled`。可选值包括:
|
|
79
79
|
*
|
|
80
80
|
* * `filled`:带背景色的文本框,视觉效果较强
|
|
81
81
|
* * `outlined`:带边框的文本框,视觉效果较弱
|
|
82
82
|
*/
|
|
83
83
|
this.variant = 'filled';
|
|
84
84
|
/**
|
|
85
|
-
* 文本框输入类型。默认为 `text
|
|
85
|
+
* 文本框输入类型。默认为 `text`。可选值包括:
|
|
86
86
|
*
|
|
87
87
|
* * `text`:默认值。文本字段
|
|
88
88
|
* * `number`:只能输入数字。拥有动态键盘的设备上会显示数字键盘
|
|
@@ -112,23 +112,23 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
|
|
|
112
112
|
*/
|
|
113
113
|
this.defaultValue = '';
|
|
114
114
|
/**
|
|
115
|
-
*
|
|
115
|
+
* 是否仅在获得焦点时,显示底部的帮助文本
|
|
116
116
|
*/
|
|
117
117
|
this.helperOnFocus = false;
|
|
118
118
|
/**
|
|
119
|
-
*
|
|
119
|
+
* 是否可清空文本框内容
|
|
120
120
|
*/
|
|
121
121
|
this.clearable = false;
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
123
|
+
* 是否将文本右对齐
|
|
124
124
|
*/
|
|
125
125
|
this.endAligned = false;
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
127
|
+
* 是否为只读模式
|
|
128
128
|
*/
|
|
129
129
|
this.readonly = false;
|
|
130
130
|
/**
|
|
131
|
-
*
|
|
131
|
+
* 是否禁用输入框
|
|
132
132
|
*/
|
|
133
133
|
this.disabled = false;
|
|
134
134
|
/**
|
|
@@ -136,19 +136,19 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
|
|
|
136
136
|
*/
|
|
137
137
|
this.required = false;
|
|
138
138
|
/**
|
|
139
|
-
*
|
|
139
|
+
* 是否根据输入内容自动调整文本框高度
|
|
140
140
|
*/
|
|
141
141
|
this.autosize = false;
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
143
|
+
* 是否显示字数统计,只在 `maxlength` 被指定时有效
|
|
144
144
|
*/
|
|
145
145
|
this.counter = false;
|
|
146
146
|
/**
|
|
147
|
-
* `type` 为 `password`
|
|
147
|
+
* `type` 为 `password` 时,设置此属性会添加一个切换按钮,用于在明文和密文之间切换
|
|
148
148
|
*/
|
|
149
149
|
this.togglePassword = false;
|
|
150
150
|
/**
|
|
151
|
-
*
|
|
151
|
+
* 是否启用拼写检查
|
|
152
152
|
*/
|
|
153
153
|
this.spellcheck = false;
|
|
154
154
|
/**
|
|
@@ -184,13 +184,13 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
|
|
|
184
184
|
this.readonlyButClearable = false;
|
|
185
185
|
}
|
|
186
186
|
/**
|
|
187
|
-
*
|
|
187
|
+
* 表单验证状态对象,具体参见 [`ValidityState`](https://developer.mozilla.org/zh-CN/docs/Web/API/ValidityState)
|
|
188
188
|
*/
|
|
189
189
|
get validity() {
|
|
190
190
|
return this.inputRef.value.validity;
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
|
-
*
|
|
193
|
+
* 如果表单验证未通过,此属性将包含提示信息。如果验证通过,此属性将为空字符串
|
|
194
194
|
*/
|
|
195
195
|
get validationMessage() {
|
|
196
196
|
return this.inputRef.value.validationMessage;
|
|
@@ -298,7 +298,7 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
|
|
|
298
298
|
this.inputRef.value.setSelectionRange(start, end, direction);
|
|
299
299
|
}
|
|
300
300
|
/**
|
|
301
|
-
*
|
|
301
|
+
* 将文本框中特定范围的文本替换为新的文本
|
|
302
302
|
* @param replacement 要插入的字符串
|
|
303
303
|
* @param start 要替换的字符的起止位置的索引。默认为当前用户选中的字符的起始位置的索引
|
|
304
304
|
* @param end 要替换的字符的结束位置的索引。默认为当前用户选中的字符的结束位置的索引
|
|
@@ -318,7 +318,7 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
/**
|
|
321
|
-
*
|
|
321
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`
|
|
322
322
|
*/
|
|
323
323
|
checkValidity() {
|
|
324
324
|
const valid = this.inputRef.value.checkValidity();
|
|
@@ -332,9 +332,9 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
|
|
|
332
332
|
return valid;
|
|
333
333
|
}
|
|
334
334
|
/**
|
|
335
|
-
*
|
|
335
|
+
* 检查表单字段是否通过验证。如果未通过,返回 `false` 并触发 `invalid` 事件;如果通过,返回 `true`。
|
|
336
336
|
*
|
|
337
|
-
*
|
|
337
|
+
* 如果验证未通过,还会在组件上显示验证失败的提示。
|
|
338
338
|
*/
|
|
339
339
|
reportValidity() {
|
|
340
340
|
this.invalid = !this.inputRef.value.reportValidity();
|
|
@@ -349,9 +349,9 @@ let TextField = class TextField extends FocusableMixin(MduiElement) {
|
|
|
349
349
|
return !this.invalid;
|
|
350
350
|
}
|
|
351
351
|
/**
|
|
352
|
-
*
|
|
352
|
+
* 设置自定义的错误提示文本。只要这个文本不为空,就表示字段未通过验证
|
|
353
353
|
*
|
|
354
|
-
* @param message
|
|
354
|
+
* @param message 自定义的错误提示文本
|
|
355
355
|
*/
|
|
356
356
|
setCustomValidity(message) {
|
|
357
357
|
this.inputRef.value.setCustomValidity(message);
|
|
@@ -19,57 +19,57 @@ import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
|
|
|
19
19
|
* @event close - tooltip 开始隐藏时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 tooltip 关闭
|
|
20
20
|
* @event closed - tooltip 隐藏动画完成时,事件被触发
|
|
21
21
|
*
|
|
22
|
-
* @slot - tooltip
|
|
23
|
-
* @slot headline - tooltip
|
|
22
|
+
* @slot - tooltip 触发的目标元素,只有 `default` slot 中的第一个元素会作为目标元素
|
|
23
|
+
* @slot headline - tooltip 的标题,只有当 `variant="rich"` 时,此 slot 才有效
|
|
24
24
|
* @slot content - tooltip 的内容,可以包含 HTML。若只包含纯文本,可以使用 `content` 属性代替
|
|
25
|
-
* @slot action - tooltip
|
|
25
|
+
* @slot action - tooltip 底部的按钮,只有当 `variant="rich"` 时,此 slot 才有效
|
|
26
26
|
*
|
|
27
|
-
* @csspart popup -
|
|
27
|
+
* @csspart popup - tooltip 的容器
|
|
28
28
|
* @csspart headline - 标题
|
|
29
29
|
* @csspart content - 正文
|
|
30
30
|
* @csspart action - 操作按钮
|
|
31
31
|
*
|
|
32
|
-
* @cssprop --shape-corner-plain - variant="plain"
|
|
33
|
-
* @cssprop --shape-corner-rich - variant="rich"
|
|
34
|
-
* @cssprop --z-index - 组件的 CSS
|
|
32
|
+
* @cssprop --shape-corner-plain - 当 variant="plain" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
33
|
+
* @cssprop --shape-corner-rich - 当 variant="rich" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
34
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
35
35
|
*/
|
|
36
36
|
export declare class Tooltip extends MduiElement<TooltipEventMap> {
|
|
37
37
|
static styles: CSSResultGroup;
|
|
38
38
|
/**
|
|
39
|
-
* tooltip 的形状。默认为 `plain
|
|
39
|
+
* tooltip 的形状。默认为 `plain`。可选值包括:
|
|
40
40
|
*
|
|
41
|
-
* * `plain
|
|
42
|
-
* * `rich
|
|
41
|
+
* * `plain`:纯文本,适用于简单的单行文本
|
|
42
|
+
* * `rich`:富文本,可以包含标题、正文和操作按钮
|
|
43
43
|
*/
|
|
44
|
-
variant:
|
|
44
|
+
variant: /*纯文本,适用于简单的单行文本*/ 'plain' | /*富文本,可以包含标题、正文和操作按钮*/ 'rich';
|
|
45
45
|
/**
|
|
46
|
-
* tooltip 的位置。默认为 `auto
|
|
46
|
+
* tooltip 的位置。默认为 `auto`。可选值包括:
|
|
47
47
|
*
|
|
48
48
|
* * `auto`:自动判断位置。`variant="plan"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
|
|
49
49
|
* * `top-left`:位于左上方
|
|
50
|
-
* * `top-start
|
|
51
|
-
* * `top
|
|
52
|
-
* * `top-end
|
|
50
|
+
* * `top-start`:位于上方,左对齐
|
|
51
|
+
* * `top`:位于上方,居中对齐
|
|
52
|
+
* * `top-end`:位于上方,右对齐
|
|
53
53
|
* * `top-right`:位于右上方
|
|
54
54
|
* * `bottom-left`:位于左下方
|
|
55
|
-
* * `bottom-start
|
|
56
|
-
* * `bottom
|
|
57
|
-
* * `bottom-end
|
|
55
|
+
* * `bottom-start`:位于下方,左对齐
|
|
56
|
+
* * `bottom`:位于下方,居中对齐
|
|
57
|
+
* * `bottom-end`:位于下方,右对齐
|
|
58
58
|
* * `bottom-right`:位于右下方
|
|
59
|
-
* * `left-start
|
|
60
|
-
* * `left
|
|
61
|
-
* * `left-end
|
|
62
|
-
* * `right-start
|
|
63
|
-
* * `right
|
|
64
|
-
* * `right-end
|
|
59
|
+
* * `left-start`:位于左侧,顶部对齐
|
|
60
|
+
* * `left`:位于左侧,居中对齐
|
|
61
|
+
* * `left-end`:位于左侧,底部对齐
|
|
62
|
+
* * `right-start`:位于右侧,顶部对齐
|
|
63
|
+
* * `right`:位于右侧,居中对齐
|
|
64
|
+
* * `right-end`:位于右侧,底部对齐
|
|
65
65
|
*/
|
|
66
|
-
placement: /*自动判断位置*/ 'auto' | /*位于左上方*/ 'top-left' |
|
|
66
|
+
placement: /*自动判断位置*/ 'auto' | /*位于左上方*/ 'top-left' | /*位于上方,左对齐*/ 'top-start' | /*位于上方,居中对齐*/ 'top' | /*位于上方,右对齐*/ 'top-end' | /*位于右上方*/ 'top-right' | /*位于左下方*/ 'bottom-left' | /*位于下方,左对齐*/ 'bottom-start' | /*位于下方,居中对齐*/ 'bottom' | /*位于下方,右对齐*/ 'bottom-end' | /*位于右下方*/ 'bottom-right' | /*位于左侧,顶部对齐*/ 'left-start' | /*位于左侧,居中对齐*/ 'left' | /*位于左侧,底部对齐*/ 'left-end' | /*位于右侧,顶部对齐*/ 'right-start' | /*位于右侧,居中对齐*/ 'right' | /*位于右侧,底部对齐*/ 'right-end';
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* 鼠标悬浮触发显示的延时,单位为毫秒
|
|
69
69
|
*/
|
|
70
70
|
openDelay: number;
|
|
71
71
|
/**
|
|
72
|
-
*
|
|
72
|
+
* 鼠标悬浮触发隐藏的延时,单位为毫秒
|
|
73
73
|
*/
|
|
74
74
|
closeDelay: number;
|
|
75
75
|
/**
|
|
@@ -81,14 +81,14 @@ export declare class Tooltip extends MduiElement<TooltipEventMap> {
|
|
|
81
81
|
*/
|
|
82
82
|
content?: string;
|
|
83
83
|
/**
|
|
84
|
-
*
|
|
84
|
+
* 触发方式,支持多个值,用空格分隔。可选值包括:
|
|
85
85
|
*
|
|
86
86
|
* * `click`:点击时触发
|
|
87
|
-
* * `hover
|
|
87
|
+
* * `hover`:鼠标悬浮时触发
|
|
88
88
|
* * `focus`:聚焦时触发
|
|
89
|
-
* * `manual
|
|
89
|
+
* * `manual`:只能通过编程方式打开和关闭 tooltip,不能再指定其他触发方式
|
|
90
90
|
*/
|
|
91
|
-
trigger: /*点击时触发*/ 'click' |
|
|
91
|
+
trigger: /*点击时触发*/ 'click' | /*鼠标悬浮时触发*/ 'hover' | /*聚焦时触发*/ 'focus' | /*只能通过编程方式打开和关闭 tooltip,不能再指定其他触发方式*/ 'manual' | string;
|
|
92
92
|
/**
|
|
93
93
|
* 是否禁用 tooltip
|
|
94
94
|
*/
|
|
@@ -35,67 +35,67 @@ import { style } from './style.js';
|
|
|
35
35
|
* @event close - tooltip 开始隐藏时,事件被触发。可以通过调用 `event.preventDefault()` 阻止 tooltip 关闭
|
|
36
36
|
* @event closed - tooltip 隐藏动画完成时,事件被触发
|
|
37
37
|
*
|
|
38
|
-
* @slot - tooltip
|
|
39
|
-
* @slot headline - tooltip
|
|
38
|
+
* @slot - tooltip 触发的目标元素,只有 `default` slot 中的第一个元素会作为目标元素
|
|
39
|
+
* @slot headline - tooltip 的标题,只有当 `variant="rich"` 时,此 slot 才有效
|
|
40
40
|
* @slot content - tooltip 的内容,可以包含 HTML。若只包含纯文本,可以使用 `content` 属性代替
|
|
41
|
-
* @slot action - tooltip
|
|
41
|
+
* @slot action - tooltip 底部的按钮,只有当 `variant="rich"` 时,此 slot 才有效
|
|
42
42
|
*
|
|
43
|
-
* @csspart popup -
|
|
43
|
+
* @csspart popup - tooltip 的容器
|
|
44
44
|
* @csspart headline - 标题
|
|
45
45
|
* @csspart content - 正文
|
|
46
46
|
* @csspart action - 操作按钮
|
|
47
47
|
*
|
|
48
|
-
* @cssprop --shape-corner-plain - variant="plain"
|
|
49
|
-
* @cssprop --shape-corner-rich - variant="rich"
|
|
50
|
-
* @cssprop --z-index - 组件的 CSS
|
|
48
|
+
* @cssprop --shape-corner-plain - 当 variant="plain" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
49
|
+
* @cssprop --shape-corner-rich - 当 variant="rich" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
50
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
51
51
|
*/
|
|
52
52
|
let Tooltip = class Tooltip extends MduiElement {
|
|
53
53
|
constructor() {
|
|
54
54
|
super();
|
|
55
55
|
/**
|
|
56
|
-
* tooltip 的形状。默认为 `plain
|
|
56
|
+
* tooltip 的形状。默认为 `plain`。可选值包括:
|
|
57
57
|
*
|
|
58
|
-
* * `plain
|
|
59
|
-
* * `rich
|
|
58
|
+
* * `plain`:纯文本,适用于简单的单行文本
|
|
59
|
+
* * `rich`:富文本,可以包含标题、正文和操作按钮
|
|
60
60
|
*/
|
|
61
61
|
this.variant = 'plain';
|
|
62
62
|
/**
|
|
63
|
-
* tooltip 的位置。默认为 `auto
|
|
63
|
+
* tooltip 的位置。默认为 `auto`。可选值包括:
|
|
64
64
|
*
|
|
65
65
|
* * `auto`:自动判断位置。`variant="plan"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
|
|
66
66
|
* * `top-left`:位于左上方
|
|
67
|
-
* * `top-start
|
|
68
|
-
* * `top
|
|
69
|
-
* * `top-end
|
|
67
|
+
* * `top-start`:位于上方,左对齐
|
|
68
|
+
* * `top`:位于上方,居中对齐
|
|
69
|
+
* * `top-end`:位于上方,右对齐
|
|
70
70
|
* * `top-right`:位于右上方
|
|
71
71
|
* * `bottom-left`:位于左下方
|
|
72
|
-
* * `bottom-start
|
|
73
|
-
* * `bottom
|
|
74
|
-
* * `bottom-end
|
|
72
|
+
* * `bottom-start`:位于下方,左对齐
|
|
73
|
+
* * `bottom`:位于下方,居中对齐
|
|
74
|
+
* * `bottom-end`:位于下方,右对齐
|
|
75
75
|
* * `bottom-right`:位于右下方
|
|
76
|
-
* * `left-start
|
|
77
|
-
* * `left
|
|
78
|
-
* * `left-end
|
|
79
|
-
* * `right-start
|
|
80
|
-
* * `right
|
|
81
|
-
* * `right-end
|
|
76
|
+
* * `left-start`:位于左侧,顶部对齐
|
|
77
|
+
* * `left`:位于左侧,居中对齐
|
|
78
|
+
* * `left-end`:位于左侧,底部对齐
|
|
79
|
+
* * `right-start`:位于右侧,顶部对齐
|
|
80
|
+
* * `right`:位于右侧,居中对齐
|
|
81
|
+
* * `right-end`:位于右侧,底部对齐
|
|
82
82
|
*/
|
|
83
83
|
this.placement = 'auto';
|
|
84
84
|
/**
|
|
85
|
-
*
|
|
85
|
+
* 鼠标悬浮触发显示的延时,单位为毫秒
|
|
86
86
|
*/
|
|
87
87
|
this.openDelay = 150;
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* 鼠标悬浮触发隐藏的延时,单位为毫秒
|
|
90
90
|
*/
|
|
91
91
|
this.closeDelay = 150;
|
|
92
92
|
/**
|
|
93
|
-
*
|
|
93
|
+
* 触发方式,支持多个值,用空格分隔。可选值包括:
|
|
94
94
|
*
|
|
95
95
|
* * `click`:点击时触发
|
|
96
|
-
* * `hover
|
|
96
|
+
* * `hover`:鼠标悬浮时触发
|
|
97
97
|
* * `focus`:聚焦时触发
|
|
98
|
-
* * `manual
|
|
98
|
+
* * `manual`:只能通过编程方式打开和关闭 tooltip,不能再指定其他触发方式
|
|
99
99
|
*/
|
|
100
100
|
this.trigger = 'hover focus';
|
|
101
101
|
/**
|