mdui 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/avatar/index.d.ts +13 -13
- package/components/avatar/index.js +11 -6
- package/components/avatar/style.js +31 -1
- package/components/badge/index.d.ts +7 -6
- package/components/badge/index.js +6 -5
- package/components/badge/style.js +25 -1
- package/components/bottom-app-bar/index.d.ts +4 -3
- package/components/bottom-app-bar/index.js +3 -3
- package/components/bottom-app-bar/style.js +92 -1
- package/components/button/button-base-style.js +28 -1
- package/components/button/button-base.d.ts +43 -44
- package/components/button/button-base.js +28 -21
- package/components/button/index.d.ts +13 -13
- package/components/button/index.js +30 -20
- package/components/button/style.js +111 -2
- package/components/button-icon/index.d.ts +8 -8
- package/components/button-icon/index.js +29 -12
- package/components/button-icon/style.js +103 -2
- package/components/card/index.d.ts +8 -8
- package/components/card/index.js +12 -8
- package/components/card/style.js +72 -1
- package/components/checkbox/index.d.ts +20 -20
- package/components/checkbox/index.js +68 -25
- package/components/checkbox/style.js +131 -1
- package/components/chip/index.d.ts +19 -19
- package/components/chip/index.js +49 -25
- package/components/chip/style.js +205 -2
- package/components/circular-progress/index.d.ts +2 -2
- package/components/circular-progress/index.js +40 -6
- package/components/circular-progress/style.js +136 -1
- package/components/collapse/collapse-item-style.js +21 -1
- package/components/collapse/collapse-item.d.ts +4 -4
- package/components/collapse/collapse-item.js +12 -4
- package/components/collapse/collapse-style.js +5 -1
- package/components/collapse/collapse.d.ts +6 -9
- package/components/collapse/collapse.js +8 -5
- package/components/dialog/index.d.ts +13 -13
- package/components/dialog/index.js +48 -20
- package/components/dialog/style.js +116 -1
- package/components/divider/index.d.ts +3 -3
- package/components/divider/index.js +3 -3
- package/components/divider/style.js +18 -1
- package/components/dropdown/index.d.ts +35 -35
- package/components/dropdown/index.js +41 -34
- package/components/dropdown/style.js +11 -1
- package/components/fab/index.d.ts +6 -6
- package/components/fab/index.js +19 -11
- package/components/fab/style.js +153 -4
- package/components/icon/index.js +5 -1
- package/components/icon/style.js +29 -1
- package/components/layout/layout-item-style.js +6 -1
- package/components/layout/layout-item.d.ts +7 -7
- package/components/layout/layout-item.js +6 -6
- package/components/layout/layout-main-style.js +7 -1
- package/components/layout/layout-main.d.ts +2 -2
- package/components/layout/layout-main.js +2 -2
- package/components/layout/layout-style.js +11 -1
- package/components/layout/layout.d.ts +2 -2
- package/components/layout/layout.js +2 -2
- package/components/linear-progress/index.d.ts +4 -4
- package/components/linear-progress/index.js +9 -5
- package/components/linear-progress/style.js +73 -1
- package/components/list/list-item-style.js +153 -2
- package/components/list/list-item.d.ts +17 -17
- package/components/list/list-item.js +34 -15
- package/components/list/list-style.js +10 -1
- package/components/list/list-subheader-style.js +19 -1
- package/components/list/list-subheader.d.ts +2 -2
- package/components/list/list-subheader.js +2 -2
- package/components/list/list.d.ts +1 -1
- package/components/list/list.js +1 -1
- package/components/menu/menu-item-style.js +125 -1
- package/components/menu/menu-item.d.ts +4 -4
- package/components/menu/menu-item.js +57 -15
- package/components/menu/menu-style.js +19 -1
- package/components/menu/menu.d.ts +15 -18
- package/components/menu/menu.js +13 -9
- package/components/navigation-bar/navigation-bar-item-style.js +132 -1
- package/components/navigation-bar/navigation-bar-item.d.ts +5 -5
- package/components/navigation-bar/navigation-bar-item.js +27 -11
- package/components/navigation-bar/navigation-bar-style.js +28 -1
- package/components/navigation-bar/navigation-bar.d.ts +9 -8
- package/components/navigation-bar/navigation-bar.js +10 -7
- package/components/navigation-drawer/index.d.ts +19 -20
- package/components/navigation-drawer/index.js +56 -31
- package/components/navigation-drawer/style.js +66 -1
- package/components/navigation-rail/navigation-rail-item-style.js +122 -1
- package/components/navigation-rail/navigation-rail-item.d.ts +6 -6
- package/components/navigation-rail/navigation-rail-item.js +30 -11
- package/components/navigation-rail/navigation-rail-style.js +79 -1
- package/components/navigation-rail/navigation-rail.d.ts +10 -11
- package/components/navigation-rail/navigation-rail.js +19 -11
- package/components/radio/radio-group-style.js +20 -1
- package/components/radio/radio-group.d.ts +13 -13
- package/components/radio/radio-group.js +30 -12
- package/components/radio/radio-style.js +107 -1
- package/components/radio/radio.d.ts +3 -3
- package/components/radio/radio.js +26 -8
- package/components/range-slider/index.d.ts +5 -6
- package/components/range-slider/index.js +57 -10
- package/components/ripple/index.js +5 -2
- package/components/ripple/style.js +96 -1
- package/components/segmented-button/segmented-button-group-style.js +28 -1
- package/components/segmented-button/segmented-button-group.d.ts +17 -20
- package/components/segmented-button/segmented-button-group.js +32 -15
- package/components/segmented-button/segmented-button-style.js +81 -2
- package/components/segmented-button/segmented-button.d.ts +3 -3
- package/components/segmented-button/segmented-button.js +30 -14
- package/components/select/index.d.ts +31 -32
- package/components/select/index.js +106 -26
- package/components/select/style.js +27 -1
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +34 -3
- package/components/slider/slider-base-style.js +173 -1
- package/components/slider/slider-base.d.ts +15 -15
- package/components/slider/slider-base.js +19 -14
- package/components/slider/style.js +7 -1
- package/components/snackbar/index.d.ts +21 -21
- package/components/snackbar/index.js +47 -20
- package/components/snackbar/style.js +100 -1
- package/components/switch/index.d.ts +14 -14
- package/components/switch/index.js +51 -17
- package/components/switch/style.js +202 -1
- package/components/tabs/tab-panel-style.js +10 -1
- package/components/tabs/tab-panel.d.ts +3 -3
- package/components/tabs/tab-panel.js +2 -2
- package/components/tabs/tab-style.js +85 -1
- package/components/tabs/tab.d.ts +6 -6
- package/components/tabs/tab.js +29 -9
- package/components/tabs/tabs-style.js +138 -1
- package/components/tabs/tabs.d.ts +19 -19
- package/components/tabs/tabs.js +26 -18
- package/components/text-field/index.d.ts +51 -51
- package/components/text-field/index.js +185 -57
- package/components/text-field/style.js +362 -1
- package/components/tooltip/index.d.ts +31 -31
- package/components/tooltip/index.js +38 -29
- package/components/tooltip/style.js +57 -1
- package/components/top-app-bar/top-app-bar-style.js +78 -1
- package/components/top-app-bar/top-app-bar-title-style.js +81 -1
- package/components/top-app-bar/top-app-bar-title.d.ts +4 -4
- package/components/top-app-bar/top-app-bar-title.js +21 -7
- package/components/top-app-bar/top-app-bar.d.ts +5 -5
- package/components/top-app-bar/top-app-bar.js +4 -4
- package/css-data.en.json +2826 -0
- package/css-data.zh-cn.json +374 -367
- package/custom-elements.json +2049 -2049
- package/html-data.en.json +6560 -0
- package/html-data.zh-cn.json +1427 -1433
- package/jsx.en.d.ts +3303 -0
- package/jsx.zh-cn.d.ts +3351 -0
- package/package.json +6 -5
- package/web-types.en.json +11734 -0
- package/web-types.zh-cn.json +3227 -3221
- package/mdui.esm.js +0 -22
- package/mdui.global.js +0 -22
|
@@ -12,7 +12,7 @@ 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>
|
|
@@ -36,7 +36,7 @@ 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
|
/**
|
|
@@ -68,10 +68,18 @@ let CollapseItem = class CollapseItem extends MduiElement {
|
|
|
68
68
|
this.updateBodyHeight();
|
|
69
69
|
}
|
|
70
70
|
render() {
|
|
71
|
-
return html `<slot name="header" part="header" class="header"
|
|
71
|
+
return html `<slot name="header" part="header" class="header">
|
|
72
|
+
${this.header}
|
|
73
|
+
</slot>
|
|
74
|
+
<slot
|
|
75
|
+
part="body"
|
|
76
|
+
class="body ${classMap({
|
|
72
77
|
opened: this.state === 'opened',
|
|
73
78
|
active: this.active,
|
|
74
|
-
})}"
|
|
79
|
+
})}"
|
|
80
|
+
${ref(this.bodyRef)}
|
|
81
|
+
@transitionend=${this.onTransitionEnd}
|
|
82
|
+
></slot>`;
|
|
75
83
|
}
|
|
76
84
|
onTransitionEnd(event) {
|
|
77
85
|
if (event.target === this.bodyRef.value) {
|
|
@@ -2,7 +2,7 @@ import '@mdui/jq/methods/is.js';
|
|
|
2
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
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;
|
|
@@ -12,7 +12,7 @@ import { booleanConverter } from '@mdui/shared/helpers/decorator.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,7 +21,7 @@ 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
|
*/
|
|
@@ -29,11 +29,11 @@ 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
|
|
@@ -85,7 +85,10 @@ let Collapse = class Collapse extends MduiElement {
|
|
|
85
85
|
this.updateItems();
|
|
86
86
|
}
|
|
87
87
|
render() {
|
|
88
|
-
return html `<slot
|
|
88
|
+
return html `<slot
|
|
89
|
+
@slotchange=${this.onSlotChange}
|
|
90
|
+
@click=${this.onClick}
|
|
91
|
+
></slot>`;
|
|
89
92
|
}
|
|
90
93
|
setActiveKeys(activeKeys) {
|
|
91
94
|
if (!arraysEqualIgnoreOrder(this.activeKeys, activeKeys)) {
|
|
@@ -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,15 +23,15 @@ 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
36
|
export declare class Dialog extends MduiElement<DialogEventMap> {
|
|
37
37
|
static styles: CSSResultGroup;
|
|
@@ -52,15 +52,15 @@ export declare class Dialog extends MduiElement<DialogEventMap> {
|
|
|
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
|
/**
|
|
@@ -24,10 +24,10 @@ import { style } from './style.js';
|
|
|
24
24
|
* <mdui-dialog>content</mdui-dialog>
|
|
25
25
|
* ```
|
|
26
26
|
*
|
|
27
|
-
* @event open -
|
|
28
|
-
* @event opened -
|
|
29
|
-
* @event close -
|
|
30
|
-
* @event closed -
|
|
27
|
+
* @event open - 对话框开始打开时触发。可以通过调用 `event.preventDefault()` 阻止对话框打开
|
|
28
|
+
* @event opened - 对话框打开动画完成后触发
|
|
29
|
+
* @event close - 对话框开始关闭时触发。可以通过调用 `event.preventDefault()` 阻止对话框关闭
|
|
30
|
+
* @event closed - 对话框关闭动画完成后触发
|
|
31
31
|
* @event overlay-click - 点击遮罩层时触发
|
|
32
32
|
*
|
|
33
33
|
* @slot header - 顶部元素,默认包含 `icon` slot 和 `headline` slot
|
|
@@ -39,15 +39,15 @@ import { style } from './style.js';
|
|
|
39
39
|
*
|
|
40
40
|
* @csspart overlay - 遮罩层
|
|
41
41
|
* @csspart panel - 对话框容器
|
|
42
|
-
* @csspart header - 对话框 header
|
|
43
|
-
* @csspart icon -
|
|
44
|
-
* @csspart headline -
|
|
45
|
-
* @csspart body -
|
|
42
|
+
* @csspart header - 对话框 header 部分,包含 icon 和 headline
|
|
43
|
+
* @csspart icon - 顶部图标,位于 header 中
|
|
44
|
+
* @csspart headline - 顶部标题,位于 header 中
|
|
45
|
+
* @csspart body - 对话框 body 部分
|
|
46
46
|
* @csspart description - 副文本部分,位于 body 中
|
|
47
47
|
* @csspart action - 底部操作按钮
|
|
48
48
|
*
|
|
49
|
-
* @cssprop --shape-corner -
|
|
50
|
-
* @cssprop --z-index - 组件的 CSS
|
|
49
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
50
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
51
51
|
*/
|
|
52
52
|
let Dialog = class Dialog extends MduiElement {
|
|
53
53
|
constructor() {
|
|
@@ -57,15 +57,15 @@ let Dialog = class Dialog extends MduiElement {
|
|
|
57
57
|
*/
|
|
58
58
|
this.open = false;
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
60
|
+
* 是否全屏显示对话框
|
|
61
61
|
*/
|
|
62
62
|
this.fullscreen = false;
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
64
|
+
* 是否允许按下 ESC 键关闭对话框
|
|
65
65
|
*/
|
|
66
66
|
this.closeOnEsc = false;
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* 是否允许点击遮罩层关闭对话框
|
|
69
69
|
*/
|
|
70
70
|
this.closeOnOverlayClick = false;
|
|
71
71
|
/**
|
|
@@ -218,11 +218,33 @@ let Dialog = class Dialog extends MduiElement {
|
|
|
218
218
|
const hasDescription = !!this.description || this.hasSlotController.test('description');
|
|
219
219
|
const hasHeader = hasIcon || hasHeadline || this.hasSlotController.test('header');
|
|
220
220
|
const hasBody = hasDescription || hasDefaultSlot;
|
|
221
|
-
return html `<div
|
|
221
|
+
return html `<div
|
|
222
|
+
${ref(this.overlayRef)}
|
|
223
|
+
part="overlay"
|
|
224
|
+
class="overlay"
|
|
225
|
+
@click=${this.onOverlayClick}
|
|
226
|
+
tabindex="-1"
|
|
227
|
+
></div>
|
|
228
|
+
<div
|
|
229
|
+
${ref(this.panelRef)}
|
|
230
|
+
part="panel"
|
|
231
|
+
class="panel ${classMap({
|
|
222
232
|
'has-icon': hasIcon,
|
|
223
233
|
'has-description': hasDescription,
|
|
224
234
|
'has-default': hasDefaultSlot,
|
|
225
|
-
})}"
|
|
235
|
+
})}"
|
|
236
|
+
tabindex="0"
|
|
237
|
+
>
|
|
238
|
+
${when(hasHeader, () => html `<slot name="header" part="header" class="header">
|
|
239
|
+
${when(hasIcon, () => this.renderIcon())}
|
|
240
|
+
${when(hasHeadline, () => this.renderHeadline())}
|
|
241
|
+
</slot>`)}
|
|
242
|
+
${when(hasBody, () => html `<div ${ref(this.bodyRef)} part="body" class="body">
|
|
243
|
+
${when(hasDescription, () => this.renderDescription())}
|
|
244
|
+
<slot></slot>
|
|
245
|
+
</div>`)}
|
|
246
|
+
${when(hasActionSlot, () => html `<slot name="action" part="action" class="action"></slot>`)}
|
|
247
|
+
</div>`;
|
|
226
248
|
}
|
|
227
249
|
onOverlayClick() {
|
|
228
250
|
this.emit('overlay-click');
|
|
@@ -232,15 +254,21 @@ let Dialog = class Dialog extends MduiElement {
|
|
|
232
254
|
this.open = false;
|
|
233
255
|
}
|
|
234
256
|
renderIcon() {
|
|
235
|
-
return html `<slot name="icon" part="icon" class="icon"
|
|
236
|
-
|
|
237
|
-
|
|
257
|
+
return html `<slot name="icon" part="icon" class="icon">
|
|
258
|
+
${this.icon
|
|
259
|
+
? html `<mdui-icon name=${this.icon}></mdui-icon>`
|
|
260
|
+
: nothingTemplate}
|
|
261
|
+
</slot>`;
|
|
238
262
|
}
|
|
239
263
|
renderHeadline() {
|
|
240
|
-
return html `<slot name="headline" part="headline" class="headline"
|
|
264
|
+
return html `<slot name="headline" part="headline" class="headline">
|
|
265
|
+
${this.headline}
|
|
266
|
+
</slot>`;
|
|
241
267
|
}
|
|
242
268
|
renderDescription() {
|
|
243
|
-
return html `<slot name="description" part="description" class="description"
|
|
269
|
+
return html `<slot name="description" part="description" class="description">
|
|
270
|
+
${this.description}
|
|
271
|
+
</slot>`;
|
|
244
272
|
}
|
|
245
273
|
};
|
|
246
274
|
Dialog.styles = [componentStyle, style];
|
|
@@ -1,2 +1,117 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
--shape-corner: var(--mdui-shape-corner-extra-large);
|
|
5
|
+
--z-index: 2300;
|
|
6
|
+
position: fixed;
|
|
7
|
+
z-index: var(--z-index);
|
|
8
|
+
display: none;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
inset: 0;
|
|
12
|
+
padding: 3rem;
|
|
13
|
+
}
|
|
14
|
+
::slotted(mdui-top-app-bar[slot='header']) {
|
|
15
|
+
position: absolute;
|
|
16
|
+
border-top-left-radius: var(--mdui-shape-corner-extra-large);
|
|
17
|
+
border-top-right-radius: var(--mdui-shape-corner-extra-large);
|
|
18
|
+
background-color: rgb(var(--mdui-color-surface-container-high));
|
|
19
|
+
}
|
|
20
|
+
:host([fullscreen]) {
|
|
21
|
+
--shape-corner: var(--mdui-shape-corner-none);
|
|
22
|
+
padding: 0;
|
|
23
|
+
}
|
|
24
|
+
:host([fullscreen]) ::slotted(mdui-top-app-bar[slot='header']) {
|
|
25
|
+
border-top-left-radius: var(--mdui-shape-corner-none);
|
|
26
|
+
border-top-right-radius: var(--mdui-shape-corner-none);
|
|
27
|
+
}
|
|
28
|
+
.overlay {
|
|
29
|
+
position: fixed;
|
|
30
|
+
inset: 0;
|
|
31
|
+
background-color: rgba(var(--mdui-color-scrim), 0.4);
|
|
32
|
+
}
|
|
33
|
+
.panel {
|
|
34
|
+
position: relative;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
max-height: 100%;
|
|
38
|
+
border-radius: var(--shape-corner);
|
|
39
|
+
outline: none;
|
|
40
|
+
transform-origin: top;
|
|
41
|
+
min-width: 17.5rem;
|
|
42
|
+
max-width: 35rem;
|
|
43
|
+
padding: 1.5rem;
|
|
44
|
+
background-color: rgb(var(--mdui-color-surface-container-high));
|
|
45
|
+
box-shadow: var(--mdui-elevation-level3);
|
|
46
|
+
}
|
|
47
|
+
:host([fullscreen]) .panel {
|
|
48
|
+
width: 100%;
|
|
49
|
+
max-width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
max-height: 100%;
|
|
52
|
+
box-shadow: var(--mdui-elevation-level0);
|
|
53
|
+
}
|
|
54
|
+
.header {
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
}
|
|
58
|
+
.has-icon .header {
|
|
59
|
+
align-items: center;
|
|
60
|
+
}
|
|
61
|
+
.icon {
|
|
62
|
+
display: flex;
|
|
63
|
+
color: rgb(var(--mdui-color-secondary));
|
|
64
|
+
font-size: 1.5rem;
|
|
65
|
+
}
|
|
66
|
+
.icon mdui-icon,
|
|
67
|
+
::slotted([slot='icon']) {
|
|
68
|
+
font-size: inherit;
|
|
69
|
+
}
|
|
70
|
+
.headline {
|
|
71
|
+
display: flex;
|
|
72
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
73
|
+
font-size: var(--mdui-typescale-headline-small-size);
|
|
74
|
+
font-weight: var(--mdui-typescale-headline-small-weight);
|
|
75
|
+
letter-spacing: var(--mdui-typescale-headline-small-tracking);
|
|
76
|
+
line-height: var(--mdui-typescale-headline-small-line-height);
|
|
77
|
+
}
|
|
78
|
+
.icon + .headline {
|
|
79
|
+
padding-top: 1rem;
|
|
80
|
+
}
|
|
81
|
+
.body {
|
|
82
|
+
overflow: auto;
|
|
83
|
+
}
|
|
84
|
+
.header + .body {
|
|
85
|
+
margin-top: 1rem;
|
|
86
|
+
}
|
|
87
|
+
.description {
|
|
88
|
+
display: flex;
|
|
89
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
90
|
+
font-size: var(--mdui-typescale-body-medium-size);
|
|
91
|
+
font-weight: var(--mdui-typescale-body-medium-weight);
|
|
92
|
+
letter-spacing: var(--mdui-typescale-body-medium-tracking);
|
|
93
|
+
line-height: var(--mdui-typescale-body-medium-line-height);
|
|
94
|
+
}
|
|
95
|
+
:host([fullscreen]) .description {
|
|
96
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
97
|
+
}
|
|
98
|
+
.has-description.has-default .description {
|
|
99
|
+
margin-bottom: 1rem;
|
|
100
|
+
}
|
|
101
|
+
.action {
|
|
102
|
+
display: flex;
|
|
103
|
+
justify-content: flex-end;
|
|
104
|
+
padding-top: 1.5rem;
|
|
105
|
+
}
|
|
106
|
+
.action::slotted(:not(:first-child)) {
|
|
107
|
+
margin-left: 0.5rem;
|
|
108
|
+
}
|
|
109
|
+
:host([stacked-actions]) .action {
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
align-items: end;
|
|
112
|
+
}
|
|
113
|
+
:host([stacked-actions]) .action::slotted(:not(:first-child)) {
|
|
114
|
+
margin-left: 0rem;
|
|
115
|
+
margin-top: 0.5rem;
|
|
116
|
+
}
|
|
117
|
+
`;
|
|
@@ -10,15 +10,15 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
10
10
|
export declare class Divider extends MduiElement<DividerEventMap> {
|
|
11
11
|
static styles: CSSResultGroup;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 是否为垂直分割线
|
|
14
14
|
*/
|
|
15
15
|
vertical: boolean;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
17
|
+
* 是否进行左侧缩进
|
|
18
18
|
*/
|
|
19
19
|
inset: boolean;
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* 是否进行左右两侧缩进
|
|
22
22
|
*/
|
|
23
23
|
middle: boolean;
|
|
24
24
|
protected render(): TemplateResult;
|
|
@@ -16,15 +16,15 @@ let Divider = class Divider extends MduiElement {
|
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments);
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* 是否为垂直分割线
|
|
20
20
|
*/
|
|
21
21
|
this.vertical = false;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* 是否进行左侧缩进
|
|
24
24
|
*/
|
|
25
25
|
this.inset = false;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
27
|
+
* 是否进行左右两侧缩进
|
|
28
28
|
*/
|
|
29
29
|
this.middle = false;
|
|
30
30
|
}
|
|
@@ -1,2 +1,19 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
height: 0.0625rem;
|
|
6
|
+
background-color: rgb(var(--mdui-color-surface-variant));
|
|
7
|
+
}
|
|
8
|
+
:host([inset]) {
|
|
9
|
+
margin-left: 1rem;
|
|
10
|
+
}
|
|
11
|
+
:host([middle]) {
|
|
12
|
+
margin-left: 1rem;
|
|
13
|
+
margin-right: 1rem;
|
|
14
|
+
}
|
|
15
|
+
:host([vertical]) {
|
|
16
|
+
height: 100%;
|
|
17
|
+
width: 0.0625rem;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
@@ -16,71 +16,71 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
16
16
|
* </mdui-dropdown>
|
|
17
17
|
* ```
|
|
18
18
|
*
|
|
19
|
-
* @event open -
|
|
20
|
-
* @event opened -
|
|
21
|
-
* @event close -
|
|
22
|
-
* @event closed -
|
|
19
|
+
* @event open - 下拉组件开始打开时,事件被触发。可以通过调用 `event.preventDefault()` 阻止下拉组件打开
|
|
20
|
+
* @event opened - 下拉组件打开动画完成时,事件被触发
|
|
21
|
+
* @event close - 下拉组件开始关闭时,事件被触发。可以通过调用 `event.preventDefault()` 阻止下拉组件关闭
|
|
22
|
+
* @event closed - 下拉组件关闭动画完成时,事件被触发
|
|
23
23
|
*
|
|
24
|
-
* @slot -
|
|
25
|
-
* @slot trigger -
|
|
24
|
+
* @slot - 下拉组件的内容
|
|
25
|
+
* @slot trigger - 触发下拉组件的元素,例如 [`<mdui-button>`](/docs/2/components/button) 元素
|
|
26
26
|
*
|
|
27
|
-
* @csspart trigger -
|
|
28
|
-
* @csspart panel -
|
|
27
|
+
* @csspart trigger - 触发下拉组件的元素的容器,即 `trigger` slot 的容器
|
|
28
|
+
* @csspart panel - 下拉组件内容的容器
|
|
29
29
|
*
|
|
30
|
-
* @cssprop --z-index - 组件的 CSS
|
|
30
|
+
* @cssprop --z-index - 组件的 CSS `z-index` 值
|
|
31
31
|
*/
|
|
32
32
|
export declare class Dropdown extends MduiElement<DropdownEventMap> {
|
|
33
33
|
static styles: CSSResultGroup;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* 是否打开下拉组件
|
|
36
36
|
*/
|
|
37
37
|
open: boolean;
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
39
|
+
* 是否禁用下拉组件
|
|
40
40
|
*/
|
|
41
41
|
disabled: boolean;
|
|
42
42
|
/**
|
|
43
|
-
*
|
|
43
|
+
* 下拉组件的触发方式,支持多个值,用空格分隔。可选值包括:
|
|
44
44
|
*
|
|
45
|
-
* * `click
|
|
45
|
+
* * `click`:点击触发
|
|
46
46
|
* * `hover`:鼠标悬浮触发
|
|
47
|
-
* * `focus
|
|
48
|
-
* * `contextmenu
|
|
49
|
-
* * `manual
|
|
47
|
+
* * `focus`:聚焦触发
|
|
48
|
+
* * `contextmenu`:鼠标右键点击、或触摸长按触发
|
|
49
|
+
* * `manual`:仅能通过编程方式打开和关闭下拉组件,不能再指定其他触发方式
|
|
50
50
|
*/
|
|
51
|
-
trigger:
|
|
51
|
+
trigger: /*点击触发*/ 'click' | /*鼠标悬浮触发*/ 'hover' | /*聚焦触发*/ 'focus' | /*鼠标右键点击、或触摸长按触发*/ 'contextmenu' | /*仅能通过编程方式打开和关闭下拉组件,不能再指定其他触发方式*/ 'manual' | string;
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
53
|
+
* 下拉组件内容的位置。可选值包括:
|
|
54
54
|
*
|
|
55
55
|
* * `auto`:自动判断位置
|
|
56
|
-
* * `top-start
|
|
57
|
-
* * `top
|
|
58
|
-
* * `top-end
|
|
59
|
-
* * `bottom-start
|
|
60
|
-
* * `bottom
|
|
61
|
-
* * `bottom-end
|
|
62
|
-
* * `left-start
|
|
63
|
-
* * `left
|
|
64
|
-
* * `left-end
|
|
65
|
-
* * `right-start
|
|
66
|
-
* * `right
|
|
67
|
-
* * `right-end
|
|
56
|
+
* * `top-start`:上方左对齐
|
|
57
|
+
* * `top`:上方居中
|
|
58
|
+
* * `top-end`:上方右对齐
|
|
59
|
+
* * `bottom-start`:下方左对齐
|
|
60
|
+
* * `bottom`:下方居中
|
|
61
|
+
* * `bottom-end`:下方右对齐
|
|
62
|
+
* * `left-start`:左侧顶部对齐
|
|
63
|
+
* * `left`:左侧居中
|
|
64
|
+
* * `left-end`:左侧底部对齐
|
|
65
|
+
* * `right-start`:右侧顶部对齐
|
|
66
|
+
* * `right`:右侧居中
|
|
67
|
+
* * `right-end`:右侧底部对齐
|
|
68
68
|
*/
|
|
69
|
-
placement: /*自动判断位置*/ 'auto' |
|
|
69
|
+
placement: /*自动判断位置*/ 'auto' | /*上方左对齐*/ 'top-start' | /*上方居中*/ 'top' | /*上方右对齐*/ 'top-end' | /*下方左对齐*/ 'bottom-start' | /*下方居中*/ 'bottom' | /*下方右对齐*/ 'bottom-end' | /*左侧顶部对齐*/ 'left-start' | /*左侧居中*/ 'left' | /*左侧底部对齐*/ 'left-end' | /*右侧顶部对齐*/ 'right-start' | /*右侧居中*/ 'right' | /*右侧底部对齐*/ 'right-end';
|
|
70
70
|
/**
|
|
71
|
-
*
|
|
71
|
+
* 点击 [`<mdui-menu-item>`](/docs/2/components/menu#menu-item-api) 后,下拉组件是否保持打开状态
|
|
72
72
|
*/
|
|
73
73
|
stayOpenOnClick: boolean;
|
|
74
74
|
/**
|
|
75
|
-
*
|
|
75
|
+
* 鼠标悬浮触发下拉组件打开的延时,单位为毫秒
|
|
76
76
|
*/
|
|
77
77
|
openDelay: number;
|
|
78
78
|
/**
|
|
79
|
-
*
|
|
79
|
+
* 鼠标悬浮触发下拉组件关闭的延时,单位为毫秒
|
|
80
80
|
*/
|
|
81
81
|
closeDelay: number;
|
|
82
82
|
/**
|
|
83
|
-
*
|
|
83
|
+
* 是否在触发下拉组件的光标位置打开下拉组件,常用于打开鼠标右键菜单
|
|
84
84
|
*/
|
|
85
85
|
openOnPointer: boolean;
|
|
86
86
|
private readonly triggerElements;
|