mdui 2.0.2 → 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 +17 -15
- package/components/avatar/index.js +7 -6
- package/components/badge/index.d.ts +11 -8
- package/components/badge/index.js +9 -7
- package/components/bottom-app-bar/index.d.ts +11 -4
- package/components/bottom-app-bar/index.js +8 -9
- package/components/button/button-base-style.js +1 -1
- package/components/button/button-base.d.ts +46 -47
- package/components/button/button-base.js +27 -25
- package/components/button/index.d.ts +19 -14
- package/components/button/index.js +12 -12
- package/components/button-icon/index.d.ts +15 -9
- package/components/button-icon/index.js +8 -9
- package/components/card/index.d.ts +15 -11
- package/components/card/index.js +10 -9
- package/components/checkbox/index.d.ts +30 -23
- package/components/checkbox/index.js +25 -25
- package/components/chip/index.d.ts +27 -20
- package/components/chip/index.js +19 -20
- package/components/circular-progress/index.d.ts +6 -4
- package/components/circular-progress/index.js +4 -3
- package/components/collapse/collapse-item.d.ts +17 -6
- package/components/collapse/collapse-item.js +7 -7
- package/components/collapse/collapse.d.ts +16 -11
- package/components/collapse/collapse.js +10 -10
- package/components/dialog/index.d.ts +22 -15
- package/components/dialog/index.js +23 -27
- package/components/divider/index.d.ts +7 -5
- package/components/divider/index.js +6 -5
- package/components/dropdown/index.d.ts +44 -37
- package/components/dropdown/index.js +50 -48
- package/components/fab/index.d.ts +12 -7
- package/components/fab/index.js +6 -6
- package/components/icon/index.d.ts +4 -2
- package/components/icon/index.js +3 -2
- package/components/layout/layout-item-base.d.ts +3 -2
- package/components/layout/layout-item-base.js +2 -2
- package/components/layout/layout-item.d.ts +11 -10
- package/components/layout/layout-item.js +6 -6
- package/components/layout/layout-main.d.ts +6 -4
- package/components/layout/layout-main.js +5 -4
- package/components/layout/layout.d.ts +6 -4
- package/components/layout/layout.js +5 -4
- package/components/linear-progress/index.d.ts +8 -6
- package/components/linear-progress/index.js +6 -5
- package/components/list/list-item-style.js +1 -1
- package/components/list/list-item.d.ts +24 -20
- package/components/list/list-item.js +10 -9
- package/components/list/list-subheader.d.ts +6 -4
- package/components/list/list-subheader.js +5 -4
- package/components/list/list.d.ts +5 -3
- package/components/list/list.js +4 -3
- package/components/menu/menu-item.d.ts +15 -7
- package/components/menu/menu-item.js +11 -15
- package/components/menu/menu.d.ts +20 -20
- package/components/menu/menu.js +13 -13
- package/components/navigation-bar/navigation-bar-item.d.ts +12 -8
- package/components/navigation-bar/navigation-bar-item.js +7 -6
- package/components/navigation-bar/navigation-bar.d.ts +17 -9
- package/components/navigation-bar/navigation-bar.js +15 -13
- package/components/navigation-drawer/index.d.ts +27 -21
- package/components/navigation-drawer/index.js +51 -38
- package/components/navigation-drawer/style.js +1 -1
- package/components/navigation-rail/navigation-rail-item.d.ts +13 -9
- package/components/navigation-rail/navigation-rail-item.js +7 -6
- package/components/navigation-rail/navigation-rail.d.ts +14 -12
- package/components/navigation-rail/navigation-rail.js +13 -12
- package/components/radio/radio-group.d.ts +20 -15
- package/components/radio/radio-group.js +21 -24
- package/components/radio/radio.d.ts +11 -6
- package/components/radio/radio.js +7 -7
- package/components/range-slider/index.d.ts +13 -8
- package/components/range-slider/index.js +10 -7
- package/components/ripple/index.d.ts +4 -2
- package/components/ripple/index.js +3 -2
- package/components/ripple/ripple-mixin.d.ts +1 -1
- package/components/ripple/ripple-mixin.js +0 -1
- package/components/segmented-button/segmented-button-group-style.js +1 -1
- package/components/segmented-button/segmented-button-group.d.ts +23 -22
- package/components/segmented-button/segmented-button-group.js +20 -23
- package/components/segmented-button/segmented-button.d.ts +9 -4
- package/components/segmented-button/segmented-button.js +3 -3
- package/components/select/index.d.ts +42 -35
- package/components/select/index.js +24 -25
- package/components/slider/index.d.ts +9 -2
- package/components/slider/index.js +5 -10
- package/components/slider/slider-base.d.ts +22 -18
- package/components/slider/slider-base.js +40 -21
- package/components/snackbar/index.d.ts +30 -23
- package/components/snackbar/index.js +25 -25
- package/components/switch/index.d.ts +24 -17
- package/components/switch/index.js +18 -18
- package/components/tabs/tab-panel.d.ts +7 -5
- package/components/tabs/tab-panel.js +5 -4
- package/components/tabs/tab.d.ts +13 -9
- package/components/tabs/tab.js +8 -7
- package/components/tabs/tabs.d.ts +24 -21
- package/components/tabs/tabs.js +24 -21
- package/components/text-field/index.d.ts +62 -54
- package/components/text-field/index.js +37 -37
- package/components/tooltip/index.d.ts +40 -33
- package/components/tooltip/index.js +45 -43
- package/components/top-app-bar/top-app-bar-title.d.ts +8 -6
- package/components/top-app-bar/top-app-bar-title.js +7 -6
- package/components/top-app-bar/top-app-bar.d.ts +12 -6
- package/components/top-app-bar/top-app-bar.js +9 -10
- package/css-data.en.json +2826 -0
- package/css-data.zh-cn.json +374 -367
- package/custom-elements.json +3844 -3824
- package/html-data.en.json +6551 -0
- package/html-data.zh-cn.json +1621 -1636
- 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 +9 -9
- package/package.json +7 -5
- package/web-types.en.json +11718 -0
- package/web-types.zh-cn.json +3613 -3623
|
@@ -17,35 +17,35 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
17
17
|
* @event change - 选中状态变更时触发
|
|
18
18
|
* @event delete - 点击删除图标时触发
|
|
19
19
|
*
|
|
20
|
-
* @slot -
|
|
20
|
+
* @slot - 纸片文本
|
|
21
21
|
* @slot icon - 左侧元素
|
|
22
22
|
* @slot end-icon - 右侧元素
|
|
23
|
-
* @slot selected-icon -
|
|
24
|
-
* @slot delete-icon -
|
|
23
|
+
* @slot selected-icon - 选中状态下的左侧元素
|
|
24
|
+
* @slot delete-icon - 可删除时的右侧删除元素
|
|
25
25
|
*
|
|
26
|
-
* @csspart button - 内部的
|
|
27
|
-
* @csspart label -
|
|
26
|
+
* @csspart button - 内部的 `<button>` 或 `<a>` 元素
|
|
27
|
+
* @csspart label - 纸片文本
|
|
28
28
|
* @csspart icon - 左侧图标
|
|
29
29
|
* @csspart end-icon - 右侧图标
|
|
30
|
-
* @csspart selected-icon -
|
|
31
|
-
* @csspart delete-icon -
|
|
30
|
+
* @csspart selected-icon - 选中状态下的左侧图标
|
|
31
|
+
* @csspart delete-icon - 可删除时的右侧删除图标
|
|
32
32
|
* @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
|
|
33
33
|
*
|
|
34
|
-
* @cssprop --shape-corner -
|
|
34
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
35
35
|
*/
|
|
36
|
-
export declare class Chip extends ButtonBase {
|
|
36
|
+
export declare class Chip extends ButtonBase<ChipEventMap> {
|
|
37
37
|
static styles: CSSResultGroup;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* 纸片的形状。可选值包括:
|
|
40
40
|
*
|
|
41
|
-
* * `assist
|
|
42
|
-
* * `filter
|
|
43
|
-
* * `input
|
|
44
|
-
* * `suggestion
|
|
41
|
+
* * `assist`:用于显示与当前上下文相关的辅助操作,如在点餐页面提供分享、收藏等功能
|
|
42
|
+
* * `filter`:用于对内容进行筛选,如在搜索结果页过滤搜索结果
|
|
43
|
+
* * `input`:用于表示用户输入的信息片段,如在 Gmail 的“收件人”字段中的联系人
|
|
44
|
+
* * `suggestion`:用于提供动态生成的推荐信息,以简化用户操作,如在聊天应用中预测用户可能想发送的信息
|
|
45
45
|
*/
|
|
46
|
-
variant:
|
|
46
|
+
variant: /*用于显示与当前上下文相关的辅助操作,如在点餐页面提供分享、收藏等功能*/ 'assist' | /*用于对内容进行筛选,如在搜索结果页过滤搜索结果*/ 'filter' | /*用于表示用户输入的信息片段,如在 Gmail 的“收件人”字段中的联系人*/ 'input' | /*用于提供动态生成的推荐信息,以简化用户操作,如在聊天应用中预测用户可能想发送的信息*/ 'suggestion';
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* 是否显示阴影
|
|
49
49
|
*/
|
|
50
50
|
elevated: boolean;
|
|
51
51
|
/**
|
|
@@ -53,11 +53,11 @@ export declare class Chip extends ButtonBase {
|
|
|
53
53
|
*/
|
|
54
54
|
selectable: boolean;
|
|
55
55
|
/**
|
|
56
|
-
*
|
|
56
|
+
* 是否已选中
|
|
57
57
|
*/
|
|
58
58
|
selected: boolean;
|
|
59
59
|
/**
|
|
60
|
-
* 是否可删除。为 `true`
|
|
60
|
+
* 是否可删除。为 `true` 时,纸片右侧会显示删除图标
|
|
61
61
|
*/
|
|
62
62
|
deletable: boolean;
|
|
63
63
|
/**
|
|
@@ -65,7 +65,7 @@ export declare class Chip extends ButtonBase {
|
|
|
65
65
|
*/
|
|
66
66
|
icon?: string;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* 选中状态下左侧的 Material Icons 图标名。也可以通过 `slot="selected-icon"` 设置
|
|
69
69
|
*/
|
|
70
70
|
selectedIcon?: string;
|
|
71
71
|
/**
|
|
@@ -73,7 +73,7 @@ export declare class Chip extends ButtonBase {
|
|
|
73
73
|
*/
|
|
74
74
|
endIcon?: string;
|
|
75
75
|
/**
|
|
76
|
-
*
|
|
76
|
+
* 可删除时,右侧删除图标的 Material Icons 图标名。也可以通过 `slot="delete-icon"` 设置
|
|
77
77
|
*/
|
|
78
78
|
deleteIcon?: string;
|
|
79
79
|
private readonly rippleRef;
|
|
@@ -95,6 +95,13 @@ export declare class Chip extends ButtonBase {
|
|
|
95
95
|
private renderDeleteIcon;
|
|
96
96
|
private renderInner;
|
|
97
97
|
}
|
|
98
|
+
export interface ChipEventMap {
|
|
99
|
+
focus: FocusEvent;
|
|
100
|
+
blur: FocusEvent;
|
|
101
|
+
invalid: CustomEvent<void>;
|
|
102
|
+
change: CustomEvent<void>;
|
|
103
|
+
delete: CustomEvent<void>;
|
|
104
|
+
}
|
|
98
105
|
declare global {
|
|
99
106
|
interface HTMLElementTagNameMap {
|
|
100
107
|
'mdui-chip': Chip;
|
package/components/chip/index.js
CHANGED
|
@@ -6,7 +6,6 @@ import cc from 'classcat';
|
|
|
6
6
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
7
7
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
8
8
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
9
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
10
9
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
11
10
|
import '@mdui/shared/icons/check.js';
|
|
12
11
|
import '@mdui/shared/icons/clear.js';
|
|
@@ -26,36 +25,36 @@ import { style } from './style.js';
|
|
|
26
25
|
* @event change - 选中状态变更时触发
|
|
27
26
|
* @event delete - 点击删除图标时触发
|
|
28
27
|
*
|
|
29
|
-
* @slot -
|
|
28
|
+
* @slot - 纸片文本
|
|
30
29
|
* @slot icon - 左侧元素
|
|
31
30
|
* @slot end-icon - 右侧元素
|
|
32
|
-
* @slot selected-icon -
|
|
33
|
-
* @slot delete-icon -
|
|
31
|
+
* @slot selected-icon - 选中状态下的左侧元素
|
|
32
|
+
* @slot delete-icon - 可删除时的右侧删除元素
|
|
34
33
|
*
|
|
35
|
-
* @csspart button - 内部的
|
|
36
|
-
* @csspart label -
|
|
34
|
+
* @csspart button - 内部的 `<button>` 或 `<a>` 元素
|
|
35
|
+
* @csspart label - 纸片文本
|
|
37
36
|
* @csspart icon - 左侧图标
|
|
38
37
|
* @csspart end-icon - 右侧图标
|
|
39
|
-
* @csspart selected-icon -
|
|
40
|
-
* @csspart delete-icon -
|
|
38
|
+
* @csspart selected-icon - 选中状态下的左侧图标
|
|
39
|
+
* @csspart delete-icon - 可删除时的右侧删除图标
|
|
41
40
|
* @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
|
|
42
41
|
*
|
|
43
|
-
* @cssprop --shape-corner -
|
|
42
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
44
43
|
*/
|
|
45
44
|
let Chip = class Chip extends ButtonBase {
|
|
46
45
|
constructor() {
|
|
47
46
|
super();
|
|
48
47
|
/**
|
|
49
|
-
*
|
|
48
|
+
* 纸片的形状。可选值包括:
|
|
50
49
|
*
|
|
51
|
-
* * `assist
|
|
52
|
-
* * `filter
|
|
53
|
-
* * `input
|
|
54
|
-
* * `suggestion
|
|
50
|
+
* * `assist`:用于显示与当前上下文相关的辅助操作,如在点餐页面提供分享、收藏等功能
|
|
51
|
+
* * `filter`:用于对内容进行筛选,如在搜索结果页过滤搜索结果
|
|
52
|
+
* * `input`:用于表示用户输入的信息片段,如在 Gmail 的“收件人”字段中的联系人
|
|
53
|
+
* * `suggestion`:用于提供动态生成的推荐信息,以简化用户操作,如在聊天应用中预测用户可能想发送的信息
|
|
55
54
|
*/
|
|
56
55
|
this.variant = 'assist';
|
|
57
56
|
/**
|
|
58
|
-
*
|
|
57
|
+
* 是否显示阴影
|
|
59
58
|
*/
|
|
60
59
|
this.elevated = false;
|
|
61
60
|
/**
|
|
@@ -63,11 +62,11 @@ let Chip = class Chip extends ButtonBase {
|
|
|
63
62
|
*/
|
|
64
63
|
this.selectable = false;
|
|
65
64
|
/**
|
|
66
|
-
*
|
|
65
|
+
* 是否已选中
|
|
67
66
|
*/
|
|
68
67
|
this.selected = false;
|
|
69
68
|
/**
|
|
70
|
-
* 是否可删除。为 `true`
|
|
69
|
+
* 是否可删除。为 `true` 时,纸片右侧会显示删除图标
|
|
71
70
|
*/
|
|
72
71
|
this.deletable = false;
|
|
73
72
|
this.rippleRef = createRef();
|
|
@@ -79,7 +78,7 @@ let Chip = class Chip extends ButtonBase {
|
|
|
79
78
|
return this.rippleRef.value;
|
|
80
79
|
}
|
|
81
80
|
onSelectedChange() {
|
|
82
|
-
emit(
|
|
81
|
+
this.emit('change');
|
|
83
82
|
}
|
|
84
83
|
firstUpdated(changedProperties) {
|
|
85
84
|
super.firstUpdated(changedProperties);
|
|
@@ -134,7 +133,7 @@ let Chip = class Chip extends ButtonBase {
|
|
|
134
133
|
}
|
|
135
134
|
// 按下 Delete 或 BackSpace 键时,触发 delete 事件
|
|
136
135
|
if (this.deletable && ['Delete', 'Backspace'].includes(event.key)) {
|
|
137
|
-
emit(
|
|
136
|
+
this.emit('delete');
|
|
138
137
|
}
|
|
139
138
|
}
|
|
140
139
|
/**
|
|
@@ -142,7 +141,7 @@ let Chip = class Chip extends ButtonBase {
|
|
|
142
141
|
*/
|
|
143
142
|
onDelete(event) {
|
|
144
143
|
event.stopPropagation();
|
|
145
|
-
emit(
|
|
144
|
+
this.emit('delete');
|
|
146
145
|
}
|
|
147
146
|
renderIcon() {
|
|
148
147
|
if (this.loading) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary 圆形进度指示器组件
|
|
@@ -7,20 +7,22 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
7
7
|
* <mdui-circular-progress></mdui-circular-progress>
|
|
8
8
|
* ```
|
|
9
9
|
*/
|
|
10
|
-
export declare class CircularProgress extends
|
|
10
|
+
export declare class CircularProgress extends MduiElement<CircularProgressEventMap> {
|
|
11
11
|
static styles: CSSResultGroup;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 进度指示器的最大值。默认为 `1`
|
|
14
14
|
*/
|
|
15
15
|
max: number;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* 进度指示器的当前值。如果未指定该值,则显示为不确定状态
|
|
18
18
|
*/
|
|
19
19
|
value?: number;
|
|
20
20
|
protected render(): TemplateResult;
|
|
21
21
|
private renderDeterminate;
|
|
22
22
|
private renderInDeterminate;
|
|
23
23
|
}
|
|
24
|
+
export interface CircularProgressEventMap {
|
|
25
|
+
}
|
|
24
26
|
declare global {
|
|
25
27
|
interface HTMLElementTagNameMap {
|
|
26
28
|
'mdui-circular-progress': CircularProgress;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import { isUndefined } from '@mdui/jq/shared/helper.js';
|
|
6
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
6
7
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
7
8
|
import { style } from './style.js';
|
|
8
9
|
/**
|
|
@@ -12,11 +13,11 @@ import { style } from './style.js';
|
|
|
12
13
|
* <mdui-circular-progress></mdui-circular-progress>
|
|
13
14
|
* ```
|
|
14
15
|
*/
|
|
15
|
-
let CircularProgress = class CircularProgress extends
|
|
16
|
+
let CircularProgress = class CircularProgress extends MduiElement {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
18
19
|
/**
|
|
19
|
-
*
|
|
20
|
+
* 进度指示器的最大值。默认为 `1`
|
|
20
21
|
*/
|
|
21
22
|
this.max = 1;
|
|
22
23
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import '@mdui/jq/methods/height.js';
|
|
2
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
3
3
|
import type { JQ } from '@mdui/jq/shared/core.js';
|
|
4
4
|
import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
|
|
5
5
|
/**
|
|
6
|
-
* @summary
|
|
6
|
+
* @summary 折叠面板项组件,需配合 `<mdui-collapse>` 组件使用
|
|
7
7
|
*
|
|
8
8
|
* ```html
|
|
9
9
|
* <mdui-collapse>
|
|
@@ -23,18 +23,18 @@ import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
|
|
|
23
23
|
* @csspart header - 折叠面板的头部内容
|
|
24
24
|
* @csspart body - 折叠面板的正文内容
|
|
25
25
|
*/
|
|
26
|
-
export declare class CollapseItem extends
|
|
26
|
+
export declare class CollapseItem extends MduiElement<CollapseItemEventMap> {
|
|
27
27
|
static styles: CSSResultGroup;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* 此折叠面板项的值
|
|
30
30
|
*/
|
|
31
31
|
value?: string;
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
33
|
+
* 此折叠面板项的头部文本
|
|
34
34
|
*/
|
|
35
35
|
header?: string;
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* 是否禁用此折叠面板项
|
|
38
38
|
*/
|
|
39
39
|
disabled: boolean;
|
|
40
40
|
/**
|
|
@@ -55,3 +55,14 @@ export declare class CollapseItem extends LitElement {
|
|
|
55
55
|
private onTransitionEnd;
|
|
56
56
|
private updateBodyHeight;
|
|
57
57
|
}
|
|
58
|
+
export interface CollapseItemEventMap {
|
|
59
|
+
open: CustomEvent<void>;
|
|
60
|
+
opened: CustomEvent<void>;
|
|
61
|
+
close: CustomEvent<void>;
|
|
62
|
+
closed: CustomEvent<void>;
|
|
63
|
+
}
|
|
64
|
+
declare global {
|
|
65
|
+
interface HTMLElementTagNameMap {
|
|
66
|
+
'mdui-collapse-item': CollapseItem;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
6
6
|
import { $ } from '@mdui/jq/$.js';
|
|
7
7
|
import '@mdui/jq/methods/height.js';
|
|
8
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
8
9
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
9
10
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
10
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
11
11
|
import { uniqueId } from '@mdui/shared/helpers/uniqueId.js';
|
|
12
12
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
13
13
|
import { collapseItemStyle } from './collapse-item-style.js';
|
|
14
14
|
/**
|
|
15
|
-
* @summary
|
|
15
|
+
* @summary 折叠面板项组件,需配合 `<mdui-collapse>` 组件使用
|
|
16
16
|
*
|
|
17
17
|
* ```html
|
|
18
18
|
* <mdui-collapse>
|
|
@@ -32,11 +32,11 @@ import { collapseItemStyle } from './collapse-item-style.js';
|
|
|
32
32
|
* @csspart header - 折叠面板的头部内容
|
|
33
33
|
* @csspart body - 折叠面板的正文内容
|
|
34
34
|
*/
|
|
35
|
-
let CollapseItem = class CollapseItem extends
|
|
35
|
+
let CollapseItem = class CollapseItem extends MduiElement {
|
|
36
36
|
constructor() {
|
|
37
37
|
super(...arguments);
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* 是否禁用此折叠面板项
|
|
40
40
|
*/
|
|
41
41
|
this.disabled = false;
|
|
42
42
|
/**
|
|
@@ -59,7 +59,7 @@ let CollapseItem = class CollapseItem extends LitElement {
|
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
61
61
|
this.state = this.active ? 'open' : 'close';
|
|
62
|
-
emit(this
|
|
62
|
+
this.emit(this.state);
|
|
63
63
|
this.updateBodyHeight();
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -76,7 +76,7 @@ let CollapseItem = class CollapseItem extends LitElement {
|
|
|
76
76
|
onTransitionEnd(event) {
|
|
77
77
|
if (event.target === this.bodyRef.value) {
|
|
78
78
|
this.state = this.active ? 'opened' : 'closed';
|
|
79
|
-
emit(this
|
|
79
|
+
this.emit(this.state);
|
|
80
80
|
this.updateBodyHeight();
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import '@mdui/jq/methods/is.js';
|
|
2
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
3
3
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
4
4
|
/**
|
|
5
|
-
* @summary
|
|
5
|
+
* @summary 折叠面板组件,需配合 `<mdui-collapse-item>` 组件使用
|
|
6
6
|
*
|
|
7
7
|
* ```html
|
|
8
8
|
* <mdui-collapse>
|
|
@@ -11,27 +11,24 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
11
11
|
* </mdui-collapse>
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
|
-
* @event change -
|
|
14
|
+
* @event change - 当前展开的折叠面板项变化时触发
|
|
15
15
|
*
|
|
16
16
|
* @slot - `<mdui-collapse-item>` 组件
|
|
17
17
|
*/
|
|
18
|
-
export declare class Collapse extends
|
|
18
|
+
export declare class Collapse extends MduiElement<CollapseEventMap> {
|
|
19
19
|
static styles: CSSResultGroup;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 是否启用手风琴模式
|
|
22
22
|
*/
|
|
23
23
|
accordion: boolean;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* 当前展开的 `<mdui-collapse-item>` 的值
|
|
26
26
|
*
|
|
27
|
-
* Note
|
|
28
|
-
* 该属性的 HTML 属性始终为字符串,且仅在 `accordion` 为 `true` 时可以设置初始值;
|
|
29
|
-
* 该属性的 JavaScript 属性值在 `accordion` 为 `true` 时为字符串、在 `accordion` 为 `false` 时为字符串数组。
|
|
30
|
-
* 所以,在 `accordion` 为 `false` 时,如果要修改该值,只能通过修改 JavaScript 属性值实现。
|
|
27
|
+
* **Note**:该属性的 HTML 属性始终为字符串,只有在 `accordion` 为 `true` 时,才能设置初始值;该属性的 JavaScript 属性值在 `accordion` 为 `true` 时为字符串,在 `accordion` 为 `false` 时为字符串数组。因此,当 `accordion` 为 `false` 时,只能通过修改 JavaScript 属性值来改变此值。
|
|
31
28
|
*/
|
|
32
29
|
value?: string | string[];
|
|
33
30
|
/**
|
|
34
|
-
*
|
|
31
|
+
* 是否禁用此折叠面板
|
|
35
32
|
*/
|
|
36
33
|
disabled: boolean;
|
|
37
34
|
private activeKeys;
|
|
@@ -47,3 +44,11 @@ export declare class Collapse extends LitElement {
|
|
|
47
44
|
private onSlotChange;
|
|
48
45
|
private updateItems;
|
|
49
46
|
}
|
|
47
|
+
export interface CollapseEventMap {
|
|
48
|
+
change: CustomEvent<void>;
|
|
49
|
+
}
|
|
50
|
+
declare global {
|
|
51
|
+
interface HTMLElementTagNameMap {
|
|
52
|
+
'mdui-collapse': Collapse;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property, queryAssignedElements, state, } from 'lit/decorators.js';
|
|
4
4
|
import { $ } from '@mdui/jq/$.js';
|
|
5
5
|
import '@mdui/jq/methods/is.js';
|
|
6
6
|
import { isElement, isUndefined } from '@mdui/jq/shared/helper.js';
|
|
7
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
7
8
|
import { DefinedController } from '@mdui/shared/controllers/defined.js';
|
|
8
9
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
9
10
|
import { arraysEqualIgnoreOrder } from '@mdui/shared/helpers/array.js';
|
|
10
11
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
11
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
12
12
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
13
13
|
import { collapseStyle } from './collapse-style.js';
|
|
14
14
|
/**
|
|
15
|
-
* @summary
|
|
15
|
+
* @summary 折叠面板组件,需配合 `<mdui-collapse-item>` 组件使用
|
|
16
16
|
*
|
|
17
17
|
* ```html
|
|
18
18
|
* <mdui-collapse>
|
|
@@ -21,19 +21,19 @@ import { collapseStyle } from './collapse-style.js';
|
|
|
21
21
|
* </mdui-collapse>
|
|
22
22
|
* ```
|
|
23
23
|
*
|
|
24
|
-
* @event change -
|
|
24
|
+
* @event change - 当前展开的折叠面板项变化时触发
|
|
25
25
|
*
|
|
26
26
|
* @slot - `<mdui-collapse-item>` 组件
|
|
27
27
|
*/
|
|
28
|
-
let Collapse = class Collapse extends
|
|
28
|
+
let Collapse = class Collapse extends MduiElement {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
31
|
/**
|
|
32
|
-
*
|
|
32
|
+
* 是否启用手风琴模式
|
|
33
33
|
*/
|
|
34
34
|
this.accordion = false;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* 是否禁用此折叠面板
|
|
37
37
|
*/
|
|
38
38
|
this.disabled = false;
|
|
39
39
|
// 因为 collapse-item 的 value 可能会重复,所以在每个 collapse-item 元素上都添加了一个唯一的 key,通过 activeKey 来记录激活状态的 key
|
|
@@ -54,7 +54,7 @@ let Collapse = class Collapse extends LitElement {
|
|
|
54
54
|
.map((item) => item.value);
|
|
55
55
|
this.setValue(value);
|
|
56
56
|
if (!this.isInitial) {
|
|
57
|
-
emit(
|
|
57
|
+
this.emit('change');
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
async onValueChange() {
|
|
@@ -109,10 +109,10 @@ let Collapse = class Collapse extends LitElement {
|
|
|
109
109
|
if (event.button) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
// collapse-item 被禁用,忽略
|
|
113
112
|
const target = event.target;
|
|
114
113
|
const item = target.closest('mdui-collapse-item');
|
|
115
|
-
|
|
114
|
+
// collapse-item 被禁用,忽略
|
|
115
|
+
if (!item || item.disabled) {
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
const path = event.composedPath();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import '../icon.js';
|
|
3
3
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
4
4
|
/**
|
|
@@ -8,10 +8,10 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
8
8
|
* <mdui-dialog>content</mdui-dialog>
|
|
9
9
|
* ```
|
|
10
10
|
*
|
|
11
|
-
* @event open -
|
|
12
|
-
* @event opened -
|
|
13
|
-
* @event close -
|
|
14
|
-
* @event closed -
|
|
11
|
+
* @event open - 对话框开始打开时触发。可以通过调用 `event.preventDefault()` 阻止对话框打开
|
|
12
|
+
* @event opened - 对话框打开动画完成后触发
|
|
13
|
+
* @event close - 对话框开始关闭时触发。可以通过调用 `event.preventDefault()` 阻止对话框关闭
|
|
14
|
+
* @event closed - 对话框关闭动画完成后触发
|
|
15
15
|
* @event overlay-click - 点击遮罩层时触发
|
|
16
16
|
*
|
|
17
17
|
* @slot header - 顶部元素,默认包含 `icon` slot 和 `headline` slot
|
|
@@ -23,17 +23,17 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
23
23
|
*
|
|
24
24
|
* @csspart overlay - 遮罩层
|
|
25
25
|
* @csspart panel - 对话框容器
|
|
26
|
-
* @csspart header - 对话框 header
|
|
27
|
-
* @csspart icon -
|
|
28
|
-
* @csspart headline -
|
|
29
|
-
* @csspart body -
|
|
26
|
+
* @csspart header - 对话框 header 部分,包含 icon 和 headline
|
|
27
|
+
* @csspart icon - 顶部图标,位于 header 中
|
|
28
|
+
* @csspart headline - 顶部标题,位于 header 中
|
|
29
|
+
* @csspart body - 对话框 body 部分
|
|
30
30
|
* @csspart description - 副文本部分,位于 body 中
|
|
31
31
|
* @csspart action - 底部操作按钮
|
|
32
32
|
*
|
|
33
|
-
* @cssprop --shape-corner -
|
|
34
|
-
* @cssprop --z-index - 组件的 CSS
|
|
33
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
34
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
35
35
|
*/
|
|
36
|
-
export declare class Dialog extends
|
|
36
|
+
export declare class Dialog extends MduiElement<DialogEventMap> {
|
|
37
37
|
static styles: CSSResultGroup;
|
|
38
38
|
/**
|
|
39
39
|
* 顶部的 Material Icons 图标名。也可以通过 `slot="icon"` 设置
|
|
@@ -52,15 +52,15 @@ export declare class Dialog extends LitElement {
|
|
|
52
52
|
*/
|
|
53
53
|
open: boolean;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
55
|
+
* 是否全屏显示对话框
|
|
56
56
|
*/
|
|
57
57
|
fullscreen: boolean;
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* 是否允许按下 ESC 键关闭对话框
|
|
60
60
|
*/
|
|
61
61
|
closeOnEsc: boolean;
|
|
62
62
|
/**
|
|
63
|
-
*
|
|
63
|
+
* 是否允许点击遮罩层关闭对话框
|
|
64
64
|
*/
|
|
65
65
|
closeOnOverlayClick: boolean;
|
|
66
66
|
/**
|
|
@@ -93,6 +93,13 @@ export declare class Dialog extends LitElement {
|
|
|
93
93
|
private renderHeadline;
|
|
94
94
|
private renderDescription;
|
|
95
95
|
}
|
|
96
|
+
export interface DialogEventMap {
|
|
97
|
+
open: CustomEvent<void>;
|
|
98
|
+
opened: CustomEvent<void>;
|
|
99
|
+
close: CustomEvent<void>;
|
|
100
|
+
closed: CustomEvent<void>;
|
|
101
|
+
'overlay-click': CustomEvent<void>;
|
|
102
|
+
}
|
|
96
103
|
declare global {
|
|
97
104
|
interface HTMLElementTagNameMap {
|
|
98
105
|
'mdui-dialog': Dialog;
|