mdui 2.0.4 → 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.js +7 -2
- package/components/avatar/style.js +31 -1
- package/components/badge/style.js +25 -1
- package/components/bottom-app-bar/style.js +92 -1
- package/components/button/button-base-style.js +28 -1
- package/components/button/button-base.js +8 -1
- package/components/button/index.js +18 -8
- package/components/button/style.js +111 -2
- package/components/button-icon/index.js +22 -5
- package/components/button-icon/style.js +103 -2
- package/components/card/index.js +5 -1
- package/components/card/style.js +72 -1
- package/components/checkbox/index.js +50 -7
- package/components/checkbox/style.js +131 -1
- package/components/chip/index.js +33 -9
- package/components/chip/style.js +205 -2
- package/components/circular-progress/index.js +39 -5
- package/components/circular-progress/style.js +136 -1
- package/components/collapse/collapse-item-style.js +21 -1
- package/components/collapse/collapse-item.js +10 -2
- package/components/collapse/collapse-style.js +5 -1
- package/components/collapse/collapse.js +4 -1
- package/components/dialog/index.js +35 -7
- package/components/dialog/style.js +116 -1
- package/components/divider/style.js +18 -1
- package/components/dropdown/index.js +8 -1
- package/components/dropdown/style.js +11 -1
- package/components/fab/index.js +13 -5
- 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-main-style.js +7 -1
- package/components/layout/layout-style.js +11 -1
- package/components/linear-progress/index.js +6 -2
- package/components/linear-progress/style.js +73 -1
- package/components/list/list-item-style.js +153 -2
- package/components/list/list-item.js +27 -8
- package/components/list/list-style.js +10 -1
- package/components/list/list-subheader-style.js +19 -1
- package/components/menu/menu-item-style.js +125 -1
- package/components/menu/menu-item.js +55 -13
- package/components/menu/menu-style.js +19 -1
- package/components/menu/menu.js +5 -1
- package/components/navigation-bar/navigation-bar-item-style.js +132 -1
- package/components/navigation-bar/navigation-bar-item.js +23 -7
- package/components/navigation-bar/navigation-bar-style.js +28 -1
- package/components/navigation-bar/navigation-bar.js +4 -1
- package/components/navigation-drawer/index.js +12 -1
- 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.js +26 -7
- package/components/navigation-rail/navigation-rail-style.js +79 -1
- package/components/navigation-rail/navigation-rail.js +10 -1
- package/components/radio/radio-group-style.js +20 -1
- package/components/radio/radio-group.js +19 -1
- package/components/radio/radio-style.js +107 -1
- package/components/radio/radio.js +23 -5
- package/components/range-slider/index.d.ts +1 -1
- package/components/range-slider/index.js +53 -5
- 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.js +21 -1
- package/components/segmented-button/segmented-button-style.js +81 -2
- package/components/segmented-button/segmented-button.js +27 -11
- package/components/select/index.js +87 -6
- package/components/select/style.js +27 -1
- package/components/slider/index.js +33 -2
- package/components/slider/slider-base-style.js +173 -1
- package/components/slider/slider-base.js +6 -1
- package/components/slider/style.js +7 -1
- package/components/snackbar/index.js +32 -5
- package/components/snackbar/style.js +100 -1
- package/components/switch/index.js +40 -6
- package/components/switch/style.js +202 -1
- package/components/tabs/tab-panel-style.js +10 -1
- package/components/tabs/tab-style.js +85 -1
- package/components/tabs/tab.js +24 -4
- package/components/tabs/tabs-style.js +138 -1
- package/components/tabs/tabs.js +9 -1
- package/components/text-field/index.js +160 -32
- package/components/text-field/style.js +362 -1
- package/components/tooltip/index.js +10 -1
- 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.js +17 -3
- package/custom-elements.json +1144 -1101
- package/html-data.en.json +15 -6
- package/html-data.zh-cn.json +15 -6
- package/jsx.en.d.ts +2 -2
- package/jsx.zh-cn.d.ts +2 -2
- package/package.json +2 -2
- package/web-types.en.json +20 -4
- package/web-types.zh-cn.json +20 -4
- package/mdui.esm.js +0 -22
- package/mdui.global.js +0 -22
|
@@ -170,13 +170,56 @@ let Checkbox = class Checkbox extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
|
170
170
|
this.invalid = !this.inputRef.value.checkValidity();
|
|
171
171
|
}
|
|
172
172
|
render() {
|
|
173
|
-
return html `<label class="${classMap({ invalid: this.invalid })}"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
173
|
+
return html `<label class="${classMap({ invalid: this.invalid })}">
|
|
174
|
+
<input
|
|
175
|
+
${ref(this.inputRef)}
|
|
176
|
+
type="checkbox"
|
|
177
|
+
name=${ifDefined(this.name)}
|
|
178
|
+
value=${ifDefined(this.value)}
|
|
179
|
+
.indeterminate=${live(this.indeterminate)}
|
|
180
|
+
.disabled=${this.disabled}
|
|
181
|
+
.checked=${live(this.checked)}
|
|
182
|
+
.required=${this.required}
|
|
183
|
+
@change=${this.onChange}
|
|
184
|
+
/>
|
|
185
|
+
<i part="control">
|
|
186
|
+
<mdui-ripple
|
|
187
|
+
${ref(this.rippleRef)}
|
|
188
|
+
.noRipple=${this.noRipple}
|
|
189
|
+
></mdui-ripple>
|
|
190
|
+
<slot
|
|
191
|
+
name="unchecked-icon"
|
|
192
|
+
part="unchecked-icon"
|
|
193
|
+
class="icon unchecked-icon"
|
|
194
|
+
>
|
|
195
|
+
${this.uncheckedIcon
|
|
196
|
+
? html `<mdui-icon name=${this.uncheckedIcon} class="i"></mdui-icon>`
|
|
197
|
+
: html `<mdui-icon-check-box-outline-blank
|
|
198
|
+
class="i"
|
|
199
|
+
></mdui-icon-check-box-outline-blank>`}
|
|
200
|
+
</slot>
|
|
201
|
+
<slot name="checked-icon" part="checked-icon" class="icon checked-icon">
|
|
202
|
+
${this.checkedIcon
|
|
203
|
+
? html `<mdui-icon name=${this.checkedIcon} class="i"></mdui-icon>`
|
|
204
|
+
: html `<mdui-icon-check-box class="i"></mdui-icon-check-box>`}
|
|
205
|
+
</slot>
|
|
206
|
+
<slot
|
|
207
|
+
name="indeterminate-icon"
|
|
208
|
+
part="indeterminate-icon"
|
|
209
|
+
class="icon indeterminate-icon"
|
|
210
|
+
>
|
|
211
|
+
${this.indeterminateIcon
|
|
212
|
+
? html `<mdui-icon
|
|
213
|
+
name=${this.indeterminateIcon}
|
|
214
|
+
class="i"
|
|
215
|
+
></mdui-icon>`
|
|
216
|
+
: html `<mdui-icon-indeterminate-check-box
|
|
217
|
+
class="i"
|
|
218
|
+
></mdui-icon-indeterminate-check-box>`}
|
|
219
|
+
</slot>
|
|
220
|
+
</i>
|
|
221
|
+
<slot part="label" class="label"></slot>
|
|
222
|
+
</label>`;
|
|
180
223
|
}
|
|
181
224
|
/**
|
|
182
225
|
* input[type="checkbox"] 的 change 事件无法冒泡越过 shadow dom
|
|
@@ -1,2 +1,132 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
2
|
+
export const style = css `
|
|
3
|
+
:host {
|
|
4
|
+
position: relative;
|
|
5
|
+
display: inline-flex;
|
|
6
|
+
cursor: pointer;
|
|
7
|
+
-webkit-tap-highlight-color: transparent;
|
|
8
|
+
border-radius: 0.125rem;
|
|
9
|
+
font-size: var(--mdui-typescale-label-large-size);
|
|
10
|
+
font-weight: var(--mdui-typescale-label-large-weight);
|
|
11
|
+
letter-spacing: var(--mdui-typescale-label-large-tracking);
|
|
12
|
+
line-height: var(--mdui-typescale-label-large-line-height);
|
|
13
|
+
}
|
|
14
|
+
label {
|
|
15
|
+
display: inline-flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
width: 100%;
|
|
18
|
+
cursor: inherit;
|
|
19
|
+
-webkit-user-select: none;
|
|
20
|
+
user-select: none;
|
|
21
|
+
touch-action: manipulation;
|
|
22
|
+
zoom: 1;
|
|
23
|
+
-webkit-user-drag: none;
|
|
24
|
+
}
|
|
25
|
+
/* 隐藏系统 input 标签,用自定义的图标代替 */
|
|
26
|
+
input {
|
|
27
|
+
position: absolute;
|
|
28
|
+
padding: 0;
|
|
29
|
+
opacity: 0;
|
|
30
|
+
pointer-events: none;
|
|
31
|
+
width: 1.125rem;
|
|
32
|
+
height: 1.125rem;
|
|
33
|
+
margin: 0rem 0rem 0rem 0.6875rem;
|
|
34
|
+
}
|
|
35
|
+
.icon {
|
|
36
|
+
display: flex;
|
|
37
|
+
position: absolute;
|
|
38
|
+
opacity: 1;
|
|
39
|
+
transform: scale(1);
|
|
40
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
41
|
+
font-size: 1.5rem;
|
|
42
|
+
transition: color var(--mdui-motion-duration-short4)
|
|
43
|
+
var(--mdui-motion-easing-standard);
|
|
44
|
+
}
|
|
45
|
+
.checked-icon,
|
|
46
|
+
.indeterminate-icon {
|
|
47
|
+
opacity: 0;
|
|
48
|
+
transform: scale(0.5);
|
|
49
|
+
transition-property: color, opacity, transform;
|
|
50
|
+
transition-duration: var(--mdui-motion-duration-short4);
|
|
51
|
+
transition-timing-function: var(--mdui-motion-easing-standard);
|
|
52
|
+
}
|
|
53
|
+
.icon .i,
|
|
54
|
+
::slotted([slot='unchecked-icon']),
|
|
55
|
+
::slotted([slot='checked-icon']),
|
|
56
|
+
::slotted([slot='indeterminate-icon']) {
|
|
57
|
+
color: inherit;
|
|
58
|
+
font-size: inherit;
|
|
59
|
+
}
|
|
60
|
+
i {
|
|
61
|
+
position: relative;
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
justify-content: center;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
border-radius: 50%;
|
|
67
|
+
width: 2.5rem;
|
|
68
|
+
min-width: 2.5rem;
|
|
69
|
+
height: 2.5rem;
|
|
70
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-on-surface);
|
|
71
|
+
}
|
|
72
|
+
.label {
|
|
73
|
+
display: flex;
|
|
74
|
+
width: 100%;
|
|
75
|
+
padding-top: 0.625rem;
|
|
76
|
+
padding-bottom: 0.625rem;
|
|
77
|
+
color: rgb(var(--mdui-color-on-surface));
|
|
78
|
+
transition: color var(--mdui-motion-duration-short4)
|
|
79
|
+
var(--mdui-motion-easing-standard);
|
|
80
|
+
}
|
|
81
|
+
:host([checked]) i {
|
|
82
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
83
|
+
}
|
|
84
|
+
:host([checked]) .icon {
|
|
85
|
+
color: rgb(var(--mdui-color-primary));
|
|
86
|
+
}
|
|
87
|
+
:host([checked]) .indeterminate-icon {
|
|
88
|
+
opacity: 0;
|
|
89
|
+
transform: scale(0.5);
|
|
90
|
+
}
|
|
91
|
+
:host([checked]) .checked-icon {
|
|
92
|
+
opacity: 1;
|
|
93
|
+
transform: scale(1);
|
|
94
|
+
}
|
|
95
|
+
:host([indeterminate]) i {
|
|
96
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
97
|
+
}
|
|
98
|
+
:host([indeterminate]) .icon {
|
|
99
|
+
color: rgb(var(--mdui-color-primary));
|
|
100
|
+
}
|
|
101
|
+
:host([indeterminate]) .checked-icon {
|
|
102
|
+
opacity: 0;
|
|
103
|
+
transform: scale(0.5);
|
|
104
|
+
}
|
|
105
|
+
:host([indeterminate]) .indeterminate-icon {
|
|
106
|
+
opacity: 1;
|
|
107
|
+
transform: scale(1);
|
|
108
|
+
}
|
|
109
|
+
.invalid i {
|
|
110
|
+
--mdui-comp-ripple-state-layer-color: var(--mdui-color-error);
|
|
111
|
+
}
|
|
112
|
+
.invalid .icon {
|
|
113
|
+
color: rgb(var(--mdui-color-error));
|
|
114
|
+
}
|
|
115
|
+
.invalid .label {
|
|
116
|
+
color: rgb(var(--mdui-color-error));
|
|
117
|
+
}
|
|
118
|
+
:host([disabled]) {
|
|
119
|
+
cursor: default;
|
|
120
|
+
pointer-events: none;
|
|
121
|
+
}
|
|
122
|
+
:host([disabled]) .icon {
|
|
123
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
124
|
+
}
|
|
125
|
+
:host([disabled]) .label {
|
|
126
|
+
color: rgba(var(--mdui-color-on-surface), 38%);
|
|
127
|
+
}
|
|
128
|
+
:host([disabled][checked]) .unchecked-icon,
|
|
129
|
+
:host([disabled][indeterminate]) .unchecked-icon {
|
|
130
|
+
opacity: 0;
|
|
131
|
+
}
|
|
132
|
+
`;
|
package/components/chip/index.js
CHANGED
|
@@ -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
|
+
`;
|
|
@@ -23,10 +23,14 @@ let CircularProgress = class CircularProgress extends MduiElement {
|
|
|
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];
|