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
package/components/chip/index.js
CHANGED
|
@@ -25,36 +25,36 @@ import { style } from './style.js';
|
|
|
25
25
|
* @event change - 选中状态变更时触发
|
|
26
26
|
* @event delete - 点击删除图标时触发
|
|
27
27
|
*
|
|
28
|
-
* @slot -
|
|
28
|
+
* @slot - 纸片文本
|
|
29
29
|
* @slot icon - 左侧元素
|
|
30
30
|
* @slot end-icon - 右侧元素
|
|
31
|
-
* @slot selected-icon -
|
|
32
|
-
* @slot delete-icon -
|
|
31
|
+
* @slot selected-icon - 选中状态下的左侧元素
|
|
32
|
+
* @slot delete-icon - 可删除时的右侧删除元素
|
|
33
33
|
*
|
|
34
|
-
* @csspart button - 内部的
|
|
35
|
-
* @csspart label -
|
|
34
|
+
* @csspart button - 内部的 `<button>` 或 `<a>` 元素
|
|
35
|
+
* @csspart label - 纸片文本
|
|
36
36
|
* @csspart icon - 左侧图标
|
|
37
37
|
* @csspart end-icon - 右侧图标
|
|
38
|
-
* @csspart selected-icon -
|
|
39
|
-
* @csspart delete-icon -
|
|
38
|
+
* @csspart selected-icon - 选中状态下的左侧图标
|
|
39
|
+
* @csspart delete-icon - 可删除时的右侧删除图标
|
|
40
40
|
* @csspart loading - 加载中状态的 `<mdui-circular-progress>` 元素
|
|
41
41
|
*
|
|
42
|
-
* @cssprop --shape-corner -
|
|
42
|
+
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐引用[设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
43
43
|
*/
|
|
44
44
|
let Chip = class Chip extends ButtonBase {
|
|
45
45
|
constructor() {
|
|
46
46
|
super();
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* 纸片的形状。可选值包括:
|
|
49
49
|
*
|
|
50
|
-
* * `assist
|
|
51
|
-
* * `filter
|
|
52
|
-
* * `input
|
|
53
|
-
* * `suggestion
|
|
50
|
+
* * `assist`:用于显示与当前上下文相关的辅助操作,如在点餐页面提供分享、收藏等功能
|
|
51
|
+
* * `filter`:用于对内容进行筛选,如在搜索结果页过滤搜索结果
|
|
52
|
+
* * `input`:用于表示用户输入的信息片段,如在 Gmail 的“收件人”字段中的联系人
|
|
53
|
+
* * `suggestion`:用于提供动态生成的推荐信息,以简化用户操作,如在聊天应用中预测用户可能想发送的信息
|
|
54
54
|
*/
|
|
55
55
|
this.variant = 'assist';
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* 是否显示阴影
|
|
58
58
|
*/
|
|
59
59
|
this.elevated = false;
|
|
60
60
|
/**
|
|
@@ -62,11 +62,11 @@ let Chip = class Chip extends ButtonBase {
|
|
|
62
62
|
*/
|
|
63
63
|
this.selectable = false;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* 是否已选中
|
|
66
66
|
*/
|
|
67
67
|
this.selected = false;
|
|
68
68
|
/**
|
|
69
|
-
* 是否可删除。为 `true`
|
|
69
|
+
* 是否可删除。为 `true` 时,纸片右侧会显示删除图标
|
|
70
70
|
*/
|
|
71
71
|
this.deletable = false;
|
|
72
72
|
this.rippleRef = createRef();
|
|
@@ -99,14 +99,20 @@ let Chip = class Chip extends ButtonBase {
|
|
|
99
99
|
(this.selected && hasSelectedIcon),
|
|
100
100
|
'has-end-icon': hasEndIcon,
|
|
101
101
|
});
|
|
102
|
-
return html `<mdui-ripple
|
|
102
|
+
return html `<mdui-ripple
|
|
103
|
+
${ref(this.rippleRef)}
|
|
104
|
+
.noRipple=${this.noRipple}
|
|
105
|
+
></mdui-ripple>
|
|
106
|
+
${this.isButton()
|
|
103
107
|
? this.renderButton({
|
|
104
108
|
className,
|
|
105
109
|
part: 'button',
|
|
106
110
|
content: this.renderInner(),
|
|
107
111
|
})
|
|
108
112
|
: this.disabled || this.loading
|
|
109
|
-
? html `<span part="button" class="${className} _a"
|
|
113
|
+
? html `<span part="button" class="${className} _a">
|
|
114
|
+
${this.renderInner()}
|
|
115
|
+
</span>`
|
|
110
116
|
: this.renderAnchor({
|
|
111
117
|
className,
|
|
112
118
|
part: 'button',
|
|
@@ -149,12 +155,15 @@ let Chip = class Chip extends ButtonBase {
|
|
|
149
155
|
}
|
|
150
156
|
const icon = () => {
|
|
151
157
|
return this.icon
|
|
152
|
-
? html `<mdui-icon name
|
|
158
|
+
? html `<mdui-icon name=${this.icon} class="i"></mdui-icon>`
|
|
153
159
|
: nothingTemplate;
|
|
154
160
|
};
|
|
155
161
|
const selectedIcon = () => {
|
|
156
162
|
if (this.selectedIcon) {
|
|
157
|
-
return html `<mdui-icon
|
|
163
|
+
return html `<mdui-icon
|
|
164
|
+
name="${this.selectedIcon}"
|
|
165
|
+
class="i"
|
|
166
|
+
></mdui-icon>`;
|
|
158
167
|
}
|
|
159
168
|
if (this.variant === 'assist' || this.variant === 'filter') {
|
|
160
169
|
return html `<mdui-icon-check class="i"></mdui-icon-check>`;
|
|
@@ -163,23 +172,38 @@ let Chip = class Chip extends ButtonBase {
|
|
|
163
172
|
};
|
|
164
173
|
return !this.selected
|
|
165
174
|
? html `<slot name="icon" part="icon" class="icon">${icon()}</slot>`
|
|
166
|
-
: html `<slot
|
|
175
|
+
: html `<slot
|
|
176
|
+
name="selected-icon"
|
|
177
|
+
part="selected-icon"
|
|
178
|
+
class="selected-icon"
|
|
179
|
+
>
|
|
180
|
+
${selectedIcon()}
|
|
181
|
+
</slot>`;
|
|
167
182
|
}
|
|
168
183
|
renderLabel() {
|
|
169
184
|
return html `<slot part="label" class="label"></slot>`;
|
|
170
185
|
}
|
|
171
186
|
renderEndIcon() {
|
|
172
|
-
return html `<slot name="end-icon" part="end-icon" class="end-icon"
|
|
187
|
+
return html `<slot name="end-icon" part="end-icon" class="end-icon">
|
|
188
|
+
${this.endIcon
|
|
173
189
|
? html `<mdui-icon name="${this.endIcon}" class="i"></mdui-icon>`
|
|
174
|
-
: nothingTemplate}
|
|
190
|
+
: nothingTemplate}
|
|
191
|
+
</slot>`;
|
|
175
192
|
}
|
|
176
193
|
renderDeleteIcon() {
|
|
177
194
|
if (!this.deletable) {
|
|
178
195
|
return nothingTemplate;
|
|
179
196
|
}
|
|
180
|
-
return html `<slot
|
|
197
|
+
return html `<slot
|
|
198
|
+
name="delete-icon"
|
|
199
|
+
part="delete-icon"
|
|
200
|
+
class="delete-icon"
|
|
201
|
+
@click=${this.onDelete}
|
|
202
|
+
>
|
|
203
|
+
${this.deleteIcon
|
|
181
204
|
? html `<mdui-icon name="${this.deleteIcon}" class="i"></mdui-icon>`
|
|
182
|
-
: html `<mdui-icon-clear class="i"></mdui-icon-clear>`}
|
|
205
|
+
: html `<mdui-icon-clear class="i"></mdui-icon-clear>`}
|
|
206
|
+
</slot>`;
|
|
183
207
|
}
|
|
184
208
|
renderInner() {
|
|
185
209
|
return [
|
package/components/chip/style.js
CHANGED
|
@@ -1,4 +1,207 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
/**
|
|
4
|
+
* mdui-chip 组件。默认为 variant="assist"
|
|
5
|
+
*/
|
|
6
|
+
:host {
|
|
7
|
+
--shape-corner: var(--mdui-shape-corner-small);
|
|
8
|
+
position: relative;
|
|
9
|
+
display: inline-block;
|
|
10
|
+
overflow: hidden;
|
|
11
|
+
border-radius: var(--shape-corner);
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
-webkit-tap-highlight-color: transparent;
|
|
14
|
+
transition: box-shadow var(--mdui-motion-duration-short4)
|
|
15
|
+
var(--mdui-motion-easing-linear);
|
|
16
|
+
height: 2rem;
|
|
17
|
+
background-color: rgb(var(--mdui-color-surface));
|
|
18
|
+
border: 0.0625rem solid rgb(var(--mdui-color-outline));
|
|
19
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
20
|
+
font-size: var(--mdui-typescale-label-large-size);
|
|
21
|
+
font-weight: var(--mdui-typescale-label-large-weight);
|
|
22
|
+
letter-spacing: var(--mdui-typescale-label-large-tracking);
|
|
23
|
+
line-height: var(--mdui-typescale-label-large-line-height);
|
|
24
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface-variant);
|
|
25
|
+
}
|
|
26
|
+
.button {
|
|
27
|
+
padding-right: 0.4375rem;
|
|
28
|
+
padding-left: 0.4375rem;
|
|
29
|
+
}
|
|
30
|
+
:host([variant='input']) .button {
|
|
31
|
+
padding-right: 0.1875rem;
|
|
32
|
+
padding-left: 0.1875rem;
|
|
33
|
+
}
|
|
34
|
+
:host([selected]) .button {
|
|
35
|
+
padding-right: 0.5rem;
|
|
36
|
+
padding-left: 0.5rem;
|
|
37
|
+
}
|
|
38
|
+
:host([selected][variant='input']) .button {
|
|
39
|
+
padding-right: 0.25rem;
|
|
40
|
+
padding-left: 0.25rem;
|
|
41
|
+
}
|
|
42
|
+
:host([elevated]) .button {
|
|
43
|
+
padding-right: 0.5rem;
|
|
44
|
+
padding-left: 0.5rem;
|
|
45
|
+
}
|
|
46
|
+
:host([variant='assist']) {
|
|
47
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
48
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
49
|
+
}
|
|
50
|
+
:host([elevated]) {
|
|
51
|
+
border-width: 0;
|
|
52
|
+
background-color: rgb(var(--mdui-color-surface-container-low));
|
|
53
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
54
|
+
}
|
|
55
|
+
:host([selected]) {
|
|
56
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
57
|
+
background-color: rgb(var(--mdui-color-secondary-container));
|
|
58
|
+
border-width: 0rem;
|
|
59
|
+
--mdui-comp-ripple-state-layer-color: var(
|
|
3
60
|
--mdui-color-on-secondary-container
|
|
4
|
-
)
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
:host([disabled]),
|
|
64
|
+
:host([loading]) {
|
|
65
|
+
cursor: default;
|
|
66
|
+
pointer-events: none;
|
|
67
|
+
}
|
|
68
|
+
:host([disabled]) {
|
|
69
|
+
border-color: rgba(var(--mdui-color-on-surface), 12%);
|
|
70
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
71
|
+
box-shadow: var(--mdui-elevation-level0);
|
|
72
|
+
}
|
|
73
|
+
:host([disabled][elevated]),
|
|
74
|
+
:host([disabled][selected]) {
|
|
75
|
+
background-color: rgba(var(--mdui-color-on-surface), 12%);
|
|
76
|
+
}
|
|
77
|
+
:host([selected][hover]) {
|
|
78
|
+
box-shadow: var(--mdui-elevation-level1);
|
|
79
|
+
}
|
|
80
|
+
:host([elevated][hover]) {
|
|
81
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
82
|
+
box-shadow: var(--mdui-elevation-level2);
|
|
83
|
+
}
|
|
84
|
+
:host([variant='filter'][hover]),
|
|
85
|
+
:host([variant='input'][hover]),
|
|
86
|
+
:host([variant='suggestion'][hover]) {
|
|
87
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
88
|
+
}
|
|
89
|
+
:host([variant='filter'][focus-visible]),
|
|
90
|
+
:host([variant='input'][focus-visible]),
|
|
91
|
+
:host([variant='suggestion'][focus-visible]) {
|
|
92
|
+
border-color: rgb(var(--mdui-color-on-surface-variant));
|
|
93
|
+
}
|
|
94
|
+
:host([dragged]),
|
|
95
|
+
:host([dragged][hover]) {
|
|
96
|
+
box-shadow: var(--mdui-elevation-level4);
|
|
97
|
+
}
|
|
98
|
+
.button {
|
|
99
|
+
overflow: visible;
|
|
100
|
+
}
|
|
101
|
+
.label {
|
|
102
|
+
display: inline-flex;
|
|
103
|
+
padding-right: 0.5rem;
|
|
104
|
+
padding-left: 0.5rem;
|
|
105
|
+
}
|
|
106
|
+
.icon,
|
|
107
|
+
.selected-icon,
|
|
108
|
+
.end-icon {
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
font-size: 1.28571429em;
|
|
111
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
112
|
+
}
|
|
113
|
+
:host([variant='assist']) .icon,
|
|
114
|
+
:host([variant='assist']) .selected-icon,
|
|
115
|
+
:host([variant='assist']) .end-icon {
|
|
116
|
+
color: rgb(var(--mdui-color-primary));
|
|
117
|
+
}
|
|
118
|
+
:host([selected]) .icon,
|
|
119
|
+
:host([selected]) .selected-icon,
|
|
120
|
+
:host([selected]) .end-icon {
|
|
121
|
+
color: rgb(var(--mdui-color-on-secondary-container));
|
|
122
|
+
}
|
|
123
|
+
:host([disabled]) .icon,
|
|
124
|
+
:host([disabled]) .selected-icon,
|
|
125
|
+
:host([disabled]) .end-icon {
|
|
126
|
+
opacity: 0.38;
|
|
127
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
128
|
+
}
|
|
129
|
+
.icon .i,
|
|
130
|
+
.selected-icon .i,
|
|
131
|
+
.end-icon .i,
|
|
132
|
+
::slotted([slot='icon']),
|
|
133
|
+
::slotted([slot='selected-icon']),
|
|
134
|
+
::slotted([slot='end-icon']) {
|
|
135
|
+
font-size: inherit;
|
|
136
|
+
}
|
|
137
|
+
:host([variant='input']) .has-icon .icon,
|
|
138
|
+
:host([variant='input']) .has-icon .selected-icon,
|
|
139
|
+
:host([variant='input']) .has-icon mdui-circular-progress {
|
|
140
|
+
margin-left: 0.25rem;
|
|
141
|
+
}
|
|
142
|
+
:host([variant='input']) .has-end-icon .end-icon {
|
|
143
|
+
margin-right: 0.25rem;
|
|
144
|
+
}
|
|
145
|
+
mdui-circular-progress {
|
|
146
|
+
display: inline-flex;
|
|
147
|
+
width: 1.125rem;
|
|
148
|
+
height: 1.125rem;
|
|
149
|
+
}
|
|
150
|
+
:host([disabled]) mdui-circular-progress {
|
|
151
|
+
stroke: rgba(var(--mdui-color-on-surface), 38%);
|
|
152
|
+
}
|
|
153
|
+
::slotted(mdui-avatar[slot='icon']),
|
|
154
|
+
::slotted(mdui-avatar[slot='end-icon']),
|
|
155
|
+
::slotted(mdui-avatar[slot='selected-icon']) {
|
|
156
|
+
width: 1.5rem;
|
|
157
|
+
height: 1.5rem;
|
|
158
|
+
}
|
|
159
|
+
:host([disabled]) ::slotted(mdui-avatar[slot='icon']),
|
|
160
|
+
:host([disabled]) ::slotted(mdui-avatar[slot='end-icon']),
|
|
161
|
+
:host([disabled]) ::slotted(mdui-avatar[slot='selected-icon']) {
|
|
162
|
+
opacity: 0.38;
|
|
163
|
+
}
|
|
164
|
+
::slotted(mdui-avatar[slot='icon']),
|
|
165
|
+
::slotted(mdui-avatar[slot='selected-icon']) {
|
|
166
|
+
margin-left: -0.25rem;
|
|
167
|
+
margin-right: -0.125rem;
|
|
168
|
+
}
|
|
169
|
+
::slotted(mdui-avatar[slot='end-icon']) {
|
|
170
|
+
margin-right: -0.25rem;
|
|
171
|
+
margin-left: -0.125rem;
|
|
172
|
+
}
|
|
173
|
+
.delete-icon {
|
|
174
|
+
display: inline-flex;
|
|
175
|
+
font-size: 1.28571429em;
|
|
176
|
+
transition: background-color var(--mdui-motion-duration-short4)
|
|
177
|
+
var(--mdui-motion-easing-linear);
|
|
178
|
+
border-radius: var(--mdui-shape-corner-full);
|
|
179
|
+
margin-right: -0.25rem;
|
|
180
|
+
margin-left: -0.25rem;
|
|
181
|
+
padding: 0.25rem;
|
|
182
|
+
color: rgb(var(--mdui-color-on-surface-variant));
|
|
183
|
+
}
|
|
184
|
+
.delete-icon:hover {
|
|
185
|
+
background-color: rgba(var(--mdui-color-on-surface-variant), 12%);
|
|
186
|
+
}
|
|
187
|
+
.has-end-icon .delete-icon {
|
|
188
|
+
margin-left: 0.25rem;
|
|
189
|
+
}
|
|
190
|
+
:host([variant='assiat']) .delete-icon {
|
|
191
|
+
color: rgb(var(--mdui-color-primary));
|
|
192
|
+
}
|
|
193
|
+
:host([variant='input']) .delete-icon {
|
|
194
|
+
margin-right: 0.0625rem;
|
|
195
|
+
}
|
|
196
|
+
:host([disabled]) .delete-icon {
|
|
197
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
198
|
+
}
|
|
199
|
+
.delete-icon .i,
|
|
200
|
+
::slotted([slot='delete-icon']) {
|
|
201
|
+
font-size: inherit;
|
|
202
|
+
}
|
|
203
|
+
::slotted(mdui-avatar[slot='delete-icon']) {
|
|
204
|
+
width: 1.125rem;
|
|
205
|
+
height: 1.125rem;
|
|
206
|
+
}
|
|
207
|
+
`;
|
|
@@ -10,11 +10,11 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
10
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;
|
|
@@ -17,16 +17,20 @@ let CircularProgress = class CircularProgress extends MduiElement {
|
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* 进度指示器的最大值。默认为 `1`
|
|
21
21
|
*/
|
|
22
22
|
this.max = 1;
|
|
23
23
|
}
|
|
24
24
|
render() {
|
|
25
25
|
const isDeterminate = !isUndefined(this.value);
|
|
26
|
-
return html `<div
|
|
26
|
+
return html `<div
|
|
27
|
+
class="progress ${classMap({
|
|
27
28
|
determinate: isDeterminate,
|
|
28
29
|
indeterminate: !isDeterminate,
|
|
29
|
-
})}"
|
|
30
|
+
})}"
|
|
31
|
+
>
|
|
32
|
+
${isDeterminate ? this.renderDeterminate() : this.renderInDeterminate()}
|
|
33
|
+
</div>`;
|
|
30
34
|
}
|
|
31
35
|
renderDeterminate() {
|
|
32
36
|
const value = this.value;
|
|
@@ -36,7 +40,24 @@ let CircularProgress = class CircularProgress extends MduiElement {
|
|
|
36
40
|
const center = circleRadius + strokeWidth / 2;
|
|
37
41
|
const circumference = 2 * π * circleRadius;
|
|
38
42
|
const determinateStrokeDashOffset = (1 - value / Math.max(this.max ?? value, value)) * circumference;
|
|
39
|
-
return html `<svg viewBox="0 0 ${center * 2} ${center * 2}"
|
|
43
|
+
return html `<svg viewBox="0 0 ${center * 2} ${center * 2}">
|
|
44
|
+
<circle
|
|
45
|
+
class="track"
|
|
46
|
+
cx="${center}"
|
|
47
|
+
cy="${center}"
|
|
48
|
+
r="${circleRadius}"
|
|
49
|
+
stroke-width="${strokeWidth}"
|
|
50
|
+
></circle>
|
|
51
|
+
<circle
|
|
52
|
+
class="circle"
|
|
53
|
+
cx="${center}"
|
|
54
|
+
cy="${center}"
|
|
55
|
+
r="${circleRadius}"
|
|
56
|
+
stroke-dasharray="${2 * π * circleRadius}"
|
|
57
|
+
stroke-dashoffset="${determinateStrokeDashOffset}"
|
|
58
|
+
stroke-width="${strokeWidth}"
|
|
59
|
+
></circle>
|
|
60
|
+
</svg>`;
|
|
40
61
|
}
|
|
41
62
|
renderInDeterminate() {
|
|
42
63
|
const strokeWidth = 4; // 圆环宽度
|
|
@@ -45,8 +66,21 @@ let CircularProgress = class CircularProgress extends MduiElement {
|
|
|
45
66
|
const center = circleRadius + strokeWidth / 2;
|
|
46
67
|
const circumference = 2 * π * circleRadius;
|
|
47
68
|
const halfCircumference = 0.5 * circumference;
|
|
48
|
-
const circle = (thisStrokeWidth) => html `<svg class="circle" viewBox="0 0 ${center * 2} ${center * 2}"
|
|
49
|
-
|
|
69
|
+
const circle = (thisStrokeWidth) => html `<svg class="circle" viewBox="0 0 ${center * 2} ${center * 2}">
|
|
70
|
+
<circle
|
|
71
|
+
cx="${center}"
|
|
72
|
+
cy="${center}"
|
|
73
|
+
r="${circleRadius}"
|
|
74
|
+
stroke-dasharray="${circumference}"
|
|
75
|
+
stroke-dashoffset="${halfCircumference}"
|
|
76
|
+
stroke-width="${thisStrokeWidth}"
|
|
77
|
+
></circle>
|
|
78
|
+
</svg>`;
|
|
79
|
+
return html `<div class="layer">
|
|
80
|
+
<div class="clipper left">${circle(strokeWidth)}</div>
|
|
81
|
+
<div class="gap-patch">${circle(strokeWidth * 0.8)}</div>
|
|
82
|
+
<div class="clipper right">${circle(strokeWidth)}</div>
|
|
83
|
+
</div>`;
|
|
50
84
|
}
|
|
51
85
|
};
|
|
52
86
|
CircularProgress.styles = [componentStyle, style];
|
|
@@ -1,2 +1,137 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
width: 2.5rem;
|
|
7
|
+
height: 2.5rem;
|
|
8
|
+
stroke: rgb(var(--mdui-color-primary));
|
|
9
|
+
}
|
|
10
|
+
.progress {
|
|
11
|
+
position: relative;
|
|
12
|
+
display: inline-block;
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
text-align: left;
|
|
16
|
+
transition: opacity var(--mdui-motion-duration-medium1)
|
|
17
|
+
var(--mdui-motion-easing-linear);
|
|
18
|
+
}
|
|
19
|
+
.determinate svg {
|
|
20
|
+
transform: rotate(-90deg);
|
|
21
|
+
fill: transparent;
|
|
22
|
+
}
|
|
23
|
+
.determinate .track {
|
|
24
|
+
stroke: transparent;
|
|
25
|
+
}
|
|
26
|
+
.determinate .circle {
|
|
27
|
+
stroke: inherit;
|
|
28
|
+
transition: stroke-dashoffset var(--mdui-motion-duration-long2)
|
|
29
|
+
var(--mdui-motion-easing-standard);
|
|
30
|
+
}
|
|
31
|
+
.indeterminate {
|
|
32
|
+
font-size: 0;
|
|
33
|
+
letter-spacing: 0;
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
animation: mdui-comp-circular-progress-rotate 1568ms
|
|
36
|
+
var(--mdui-motion-easing-linear) infinite;
|
|
37
|
+
}
|
|
38
|
+
.indeterminate .layer,
|
|
39
|
+
.indeterminate .circle {
|
|
40
|
+
position: absolute;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 100%;
|
|
43
|
+
}
|
|
44
|
+
.indeterminate .layer {
|
|
45
|
+
animation: mdui-comp-circular-progress-layer-rotate 5332ms
|
|
46
|
+
var(--mdui-motion-easing-standard) infinite both;
|
|
47
|
+
}
|
|
48
|
+
.indeterminate .circle {
|
|
49
|
+
fill: transparent;
|
|
50
|
+
stroke: inherit;
|
|
51
|
+
}
|
|
52
|
+
.indeterminate .gap-patch {
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: 0;
|
|
55
|
+
left: 47.5%;
|
|
56
|
+
width: 5%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
overflow: hidden;
|
|
59
|
+
}
|
|
60
|
+
.indeterminate .gap-patch .circle {
|
|
61
|
+
left: -900%;
|
|
62
|
+
width: 2000%;
|
|
63
|
+
transform: rotate(180deg);
|
|
64
|
+
}
|
|
65
|
+
.indeterminate .clipper {
|
|
66
|
+
position: relative;
|
|
67
|
+
display: inline-block;
|
|
68
|
+
width: 50%;
|
|
69
|
+
height: 100%;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
}
|
|
72
|
+
.indeterminate .clipper .circle {
|
|
73
|
+
width: 200%;
|
|
74
|
+
}
|
|
75
|
+
.indeterminate .clipper.left .circle {
|
|
76
|
+
animation: mdui-comp-circular-progress-left-spin 1333ms
|
|
77
|
+
var(--mdui-motion-easing-standard) infinite both;
|
|
78
|
+
}
|
|
79
|
+
.indeterminate .clipper.right .circle {
|
|
80
|
+
left: -100%;
|
|
81
|
+
animation: mdui-comp-circular-progress-right-spin 1333ms
|
|
82
|
+
var(--mdui-motion-easing-standard) infinite both;
|
|
83
|
+
}
|
|
84
|
+
@keyframes mdui-comp-circular-progress-rotate {
|
|
85
|
+
to {
|
|
86
|
+
transform: rotate(360deg);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
@keyframes mdui-comp-circular-progress-layer-rotate {
|
|
90
|
+
12.5% {
|
|
91
|
+
transform: rotate(135deg);
|
|
92
|
+
}
|
|
93
|
+
25% {
|
|
94
|
+
transform: rotate(270deg);
|
|
95
|
+
}
|
|
96
|
+
37.5% {
|
|
97
|
+
transform: rotate(405deg);
|
|
98
|
+
}
|
|
99
|
+
50% {
|
|
100
|
+
transform: rotate(540deg);
|
|
101
|
+
}
|
|
102
|
+
62.5% {
|
|
103
|
+
transform: rotate(675deg);
|
|
104
|
+
}
|
|
105
|
+
75% {
|
|
106
|
+
transform: rotate(810deg);
|
|
107
|
+
}
|
|
108
|
+
87.5% {
|
|
109
|
+
transform: rotate(945deg);
|
|
110
|
+
}
|
|
111
|
+
100% {
|
|
112
|
+
transform: rotate(1080deg);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
@keyframes mdui-comp-circular-progress-left-spin {
|
|
116
|
+
0% {
|
|
117
|
+
transform: rotate(265deg);
|
|
118
|
+
}
|
|
119
|
+
50% {
|
|
120
|
+
transform: rotate(130deg);
|
|
121
|
+
}
|
|
122
|
+
100% {
|
|
123
|
+
transform: rotate(265deg);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
@keyframes mdui-comp-circular-progress-right-spin {
|
|
127
|
+
0% {
|
|
128
|
+
transform: rotate(-265deg);
|
|
129
|
+
}
|
|
130
|
+
50% {
|
|
131
|
+
transform: rotate(-130deg);
|
|
132
|
+
}
|
|
133
|
+
100% {
|
|
134
|
+
transform: rotate(-265deg);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
@@ -1,2 +1,22 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const collapseItemStyle = css
|
|
2
|
+
export const collapseItemStyle = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
}
|
|
7
|
+
.header {
|
|
8
|
+
display: block;
|
|
9
|
+
}
|
|
10
|
+
.body {
|
|
11
|
+
display: block;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
transition: height var(--mdui-motion-duration-short4)
|
|
14
|
+
var(--mdui-motion-easing-emphasized);
|
|
15
|
+
}
|
|
16
|
+
.body.opened {
|
|
17
|
+
overflow: visible;
|
|
18
|
+
}
|
|
19
|
+
.body.active {
|
|
20
|
+
transition-duration: var(--mdui-motion-duration-medium4);
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
@@ -3,7 +3,7 @@ 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>
|
|
@@ -26,15 +26,15 @@ import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
|
|
|
26
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
|
/**
|