mdui 2.0.5 → 2.1.0
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 +2 -7
- package/components/avatar/style.js +1 -31
- package/components/badge/style.js +1 -25
- package/components/bottom-app-bar/style.js +1 -92
- package/components/button/button-base-style.js +1 -28
- package/components/button/button-base.js +1 -8
- package/components/button/index.js +8 -18
- package/components/button/style.js +2 -111
- package/components/button-icon/index.js +5 -22
- package/components/button-icon/style.js +2 -103
- package/components/card/index.js +1 -5
- package/components/card/style.js +1 -72
- package/components/checkbox/index.js +7 -50
- package/components/checkbox/style.js +1 -131
- package/components/chip/index.js +9 -33
- package/components/chip/style.js +2 -205
- package/components/circular-progress/index.js +5 -39
- package/components/circular-progress/style.js +1 -136
- package/components/collapse/collapse-item-style.js +1 -21
- package/components/collapse/collapse-item.js +2 -10
- package/components/collapse/collapse-style.js +1 -5
- package/components/collapse/collapse.js +1 -4
- package/components/dialog/index.js +10 -35
- package/components/dialog/style.js +1 -116
- package/components/divider/style.js +1 -18
- package/components/dropdown/index.js +1 -8
- package/components/dropdown/style.js +1 -11
- package/components/fab/index.js +5 -13
- package/components/fab/style.js +4 -153
- package/components/icon/index.js +1 -5
- package/components/icon/style.js +1 -29
- package/components/layout/layout-item-style.js +1 -6
- package/components/layout/layout-main-style.js +1 -7
- package/components/layout/layout-style.js +1 -11
- package/components/linear-progress/index.js +2 -6
- package/components/linear-progress/style.js +1 -73
- package/components/list/list-item-style.js +2 -153
- package/components/list/list-item.js +8 -27
- package/components/list/list-style.js +1 -10
- package/components/list/list-subheader-style.js +1 -19
- package/components/menu/menu-item-style.js +1 -125
- package/components/menu/menu-item.js +13 -55
- package/components/menu/menu-style.js +1 -19
- package/components/menu/menu.js +1 -5
- package/components/navigation-bar/navigation-bar-item-style.js +1 -132
- package/components/navigation-bar/navigation-bar-item.js +7 -23
- package/components/navigation-bar/navigation-bar-style.js +1 -28
- package/components/navigation-bar/navigation-bar.js +1 -4
- package/components/navigation-drawer/index.js +1 -12
- package/components/navigation-drawer/style.js +1 -66
- package/components/navigation-rail/navigation-rail-item-style.js +1 -122
- package/components/navigation-rail/navigation-rail-item.js +7 -26
- package/components/navigation-rail/navigation-rail-style.js +1 -79
- package/components/navigation-rail/navigation-rail.js +1 -10
- package/components/radio/radio-group-style.js +1 -20
- package/components/radio/radio-group.js +1 -19
- package/components/radio/radio-style.js +1 -107
- package/components/radio/radio.js +5 -23
- package/components/range-slider/index.d.ts +1 -1
- package/components/range-slider/index.js +5 -53
- package/components/ripple/index.js +2 -5
- package/components/ripple/style.js +1 -96
- package/components/segmented-button/segmented-button-group-style.js +1 -28
- package/components/segmented-button/segmented-button-group.js +1 -21
- package/components/segmented-button/segmented-button-style.js +2 -81
- package/components/segmented-button/segmented-button.js +11 -27
- package/components/select/index.d.ts +18 -0
- package/components/select/index.js +42 -87
- package/components/select/style.js +1 -27
- package/components/slider/index.js +2 -33
- package/components/slider/slider-base-style.js +1 -173
- package/components/slider/slider-base.js +1 -6
- package/components/slider/style.js +1 -7
- package/components/snackbar/index.js +5 -32
- package/components/snackbar/style.js +1 -100
- package/components/switch/index.js +6 -40
- package/components/switch/style.js +1 -202
- package/components/tabs/tab-panel-style.js +1 -10
- package/components/tabs/tab-style.js +1 -85
- package/components/tabs/tab.js +4 -24
- package/components/tabs/tabs-style.js +1 -138
- package/components/tabs/tabs.js +1 -9
- package/components/text-field/index.d.ts +2 -0
- package/components/text-field/index.js +58 -163
- package/components/text-field/style.js +1 -362
- package/components/tooltip/index.js +1 -10
- package/components/tooltip/style.js +1 -57
- package/components/top-app-bar/top-app-bar-style.js +1 -78
- package/components/top-app-bar/top-app-bar-title-style.js +1 -81
- package/components/top-app-bar/top-app-bar-title.js +3 -17
- package/custom-elements.json +1194 -1099
- package/functions/alert.d.ts +2 -0
- package/functions/alert.js +19 -4
- package/functions/confirm.d.ts +4 -0
- package/functions/confirm.js +33 -6
- package/functions/getLocale.d.ts +6 -0
- package/functions/getLocale.js +11 -0
- package/functions/getTheme.d.ts +1 -1
- package/functions/loadLocale.d.ts +6 -0
- package/functions/loadLocale.js +8 -0
- package/functions/prompt.d.ts +4 -0
- package/functions/prompt.js +35 -8
- package/functions/removeColorScheme.js +1 -1
- package/functions/setColorScheme.d.ts +1 -1
- package/functions/setColorScheme.js +1 -1
- package/functions/setLocale.d.ts +6 -0
- package/functions/setLocale.js +11 -0
- package/functions/setTheme.d.ts +1 -1
- package/internal/localeCodes.d.ts +13 -0
- package/internal/localeCodes.js +144 -0
- package/internal/localize.d.ts +32 -0
- package/internal/localize.js +55 -0
- package/locales/ar-eg.d.ts +8 -0
- package/locales/ar-eg.js +12 -0
- package/locales/az-az.d.ts +8 -0
- package/locales/az-az.js +12 -0
- package/locales/be-by.d.ts +8 -0
- package/locales/be-by.js +12 -0
- package/locales/bg-bg.d.ts +8 -0
- package/locales/bg-bg.js +12 -0
- package/locales/bn-bd.d.ts +8 -0
- package/locales/bn-bd.js +12 -0
- package/locales/ca-es.d.ts +8 -0
- package/locales/ca-es.js +12 -0
- package/locales/cs-cz.d.ts +8 -0
- package/locales/cs-cz.js +12 -0
- package/locales/da-dk.d.ts +8 -0
- package/locales/da-dk.js +12 -0
- package/locales/de-de.d.ts +8 -0
- package/locales/de-de.js +12 -0
- package/locales/el-gr.d.ts +8 -0
- package/locales/el-gr.js +12 -0
- package/locales/en-gb.d.ts +8 -0
- package/locales/en-gb.js +12 -0
- package/locales/es-es.d.ts +8 -0
- package/locales/es-es.js +12 -0
- package/locales/et-ee.d.ts +8 -0
- package/locales/et-ee.js +12 -0
- package/locales/fa-ir.d.ts +8 -0
- package/locales/fa-ir.js +12 -0
- package/locales/fi-fi.d.ts +8 -0
- package/locales/fi-fi.js +12 -0
- package/locales/fr-be.d.ts +8 -0
- package/locales/fr-be.js +12 -0
- package/locales/fr-ca.d.ts +8 -0
- package/locales/fr-ca.js +12 -0
- package/locales/fr-fr.d.ts +8 -0
- package/locales/fr-fr.js +12 -0
- package/locales/ga-ie.d.ts +8 -0
- package/locales/ga-ie.js +12 -0
- package/locales/gl-es.d.ts +8 -0
- package/locales/gl-es.js +12 -0
- package/locales/he-il.d.ts +8 -0
- package/locales/he-il.js +12 -0
- package/locales/hi-in.d.ts +8 -0
- package/locales/hi-in.js +12 -0
- package/locales/hr-hr.d.ts +8 -0
- package/locales/hr-hr.js +12 -0
- package/locales/hu-hu.d.ts +8 -0
- package/locales/hu-hu.js +12 -0
- package/locales/hy-am.d.ts +8 -0
- package/locales/hy-am.js +12 -0
- package/locales/id-id.d.ts +8 -0
- package/locales/id-id.js +12 -0
- package/locales/is-is.d.ts +8 -0
- package/locales/is-is.js +12 -0
- package/locales/it-it.d.ts +8 -0
- package/locales/it-it.js +12 -0
- package/locales/ja-jp.d.ts +8 -0
- package/locales/ja-jp.js +12 -0
- package/locales/ka-ge.d.ts +8 -0
- package/locales/ka-ge.js +12 -0
- package/locales/kk-kz.d.ts +8 -0
- package/locales/kk-kz.js +12 -0
- package/locales/km-kh.d.ts +8 -0
- package/locales/km-kh.js +12 -0
- package/locales/kmr-iq.d.ts +8 -0
- package/locales/kmr-iq.js +12 -0
- package/locales/kn-in.d.ts +8 -0
- package/locales/kn-in.js +12 -0
- package/locales/ko-kr.d.ts +8 -0
- package/locales/ko-kr.js +12 -0
- package/locales/lt-lt.d.ts +8 -0
- package/locales/lt-lt.js +12 -0
- package/locales/lv-lv.d.ts +8 -0
- package/locales/lv-lv.js +12 -0
- package/locales/mk-mk.d.ts +8 -0
- package/locales/mk-mk.js +12 -0
- package/locales/ml-in.d.ts +8 -0
- package/locales/ml-in.js +12 -0
- package/locales/mn-mn.d.ts +8 -0
- package/locales/mn-mn.js +12 -0
- package/locales/ms-my.d.ts +8 -0
- package/locales/ms-my.js +12 -0
- package/locales/nb-no.d.ts +8 -0
- package/locales/nb-no.js +12 -0
- package/locales/ne-np.d.ts +8 -0
- package/locales/ne-np.js +12 -0
- package/locales/nl-be.d.ts +8 -0
- package/locales/nl-be.js +12 -0
- package/locales/nl-nl.d.ts +8 -0
- package/locales/nl-nl.js +12 -0
- package/locales/pl-pl.d.ts +8 -0
- package/locales/pl-pl.js +12 -0
- package/locales/pt-br.d.ts +8 -0
- package/locales/pt-br.js +12 -0
- package/locales/pt-pt.d.ts +8 -0
- package/locales/pt-pt.js +12 -0
- package/locales/ro-ro.d.ts +8 -0
- package/locales/ro-ro.js +12 -0
- package/locales/ru-ru.d.ts +8 -0
- package/locales/ru-ru.js +12 -0
- package/locales/sk-sk.d.ts +8 -0
- package/locales/sk-sk.js +12 -0
- package/locales/sl-si.d.ts +8 -0
- package/locales/sl-si.js +12 -0
- package/locales/sr-rs.d.ts +8 -0
- package/locales/sr-rs.js +12 -0
- package/locales/sv-se.d.ts +8 -0
- package/locales/sv-se.js +12 -0
- package/locales/ta-in.d.ts +8 -0
- package/locales/ta-in.js +12 -0
- package/locales/th-th.d.ts +8 -0
- package/locales/th-th.js +12 -0
- package/locales/tr-tr.d.ts +8 -0
- package/locales/tr-tr.js +12 -0
- package/locales/uk-ua.d.ts +8 -0
- package/locales/uk-ua.js +12 -0
- package/locales/ur-pk.d.ts +8 -0
- package/locales/ur-pk.js +12 -0
- package/locales/vi-vn.d.ts +8 -0
- package/locales/vi-vn.js +12 -0
- package/locales/zh-cn.d.ts +8 -0
- package/locales/zh-cn.js +12 -0
- package/locales/zh-hk.d.ts +8 -0
- package/locales/zh-hk.js +12 -0
- package/locales/zh-tw.d.ts +8 -0
- package/locales/zh-tw.js +12 -0
- package/mdui.d.ts +5 -0
- package/mdui.esm.js +22 -0
- package/mdui.global.js +22 -0
- package/mdui.js +3 -0
- package/package.json +9 -6
- package/web-types.en.json +91 -1
- package/web-types.zh-cn.json +91 -1
- /package/{functions/utils → internal}/colorScheme.d.ts +0 -0
- /package/{functions/utils → internal}/colorScheme.js +0 -0
- /package/{functions/utils → internal}/theme.d.ts +0 -0
- /package/{functions/utils → internal}/theme.js +0 -0
|
@@ -170,56 +170,13 @@ 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
|
-
|
|
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>`;
|
|
173
|
+
return html `<label class="${classMap({ invalid: this.invalid })}"><input ${ref(this.inputRef)} type="checkbox" name="${ifDefined(this.name)}" value="${ifDefined(this.value)}" .indeterminate="${live(this.indeterminate)}" .disabled="${this.disabled}" .checked="${live(this.checked)}" .required="${this.required}" @change="${this.onChange}"> <i part="control"><mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple><slot name="unchecked-icon" part="unchecked-icon" class="icon unchecked-icon">${this.uncheckedIcon
|
|
174
|
+
? html `<mdui-icon name="${this.uncheckedIcon}" class="i"></mdui-icon>`
|
|
175
|
+
: html `<mdui-icon-check-box-outline-blank class="i"></mdui-icon-check-box-outline-blank>`}</slot><slot name="checked-icon" part="checked-icon" class="icon checked-icon">${this.checkedIcon
|
|
176
|
+
? html `<mdui-icon name="${this.checkedIcon}" class="i"></mdui-icon>`
|
|
177
|
+
: html `<mdui-icon-check-box class="i"></mdui-icon-check-box>`}</slot><slot name="indeterminate-icon" part="indeterminate-icon" class="icon indeterminate-icon">${this.indeterminateIcon
|
|
178
|
+
? html `<mdui-icon name="${this.indeterminateIcon}" class="i"></mdui-icon>`
|
|
179
|
+
: html `<mdui-icon-indeterminate-check-box class="i"></mdui-icon-indeterminate-check-box>`}</slot></i><slot part="label" class="label"></slot></label>`;
|
|
223
180
|
}
|
|
224
181
|
/**
|
|
225
182
|
* input[type="checkbox"] 的 change 事件无法冒泡越过 shadow dom
|
|
@@ -1,132 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
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
|
-
`;
|
|
2
|
+
export const style = css `:host{position:relative;display:inline-flex;cursor:pointer;-webkit-tap-highlight-color:transparent;border-radius:.125rem;font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height)}label{display:inline-flex;align-items:center;width:100%;cursor:inherit;-webkit-user-select:none;user-select:none;touch-action:manipulation;zoom:1;-webkit-user-drag:none}input{position:absolute;padding:0;opacity:0;pointer-events:none;width:1.125rem;height:1.125rem;margin:0 0 0 .6875rem}.icon{display:flex;position:absolute;opacity:1;transform:scale(1);color:rgb(var(--mdui-color-on-surface));font-size:1.5rem;transition:color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}.checked-icon,.indeterminate-icon{opacity:0;transform:scale(.5);transition-property:color,opacity,transform;transition-duration:var(--mdui-motion-duration-short4);transition-timing-function:var(--mdui-motion-easing-standard)}.icon .i,::slotted([slot=checked-icon]),::slotted([slot=indeterminate-icon]),::slotted([slot=unchecked-icon]){color:inherit;font-size:inherit}i{position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden;border-radius:50%;width:2.5rem;min-width:2.5rem;height:2.5rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}.label{display:flex;width:100%;padding-top:.625rem;padding-bottom:.625rem;color:rgb(var(--mdui-color-on-surface));transition:color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}:host([checked]) i{--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([checked]) .icon{color:rgb(var(--mdui-color-primary))}:host([checked]) .indeterminate-icon{opacity:0;transform:scale(.5)}:host([checked]) .checked-icon{opacity:1;transform:scale(1)}:host([indeterminate]) i{--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}:host([indeterminate]) .icon{color:rgb(var(--mdui-color-primary))}:host([indeterminate]) .checked-icon{opacity:0;transform:scale(.5)}:host([indeterminate]) .indeterminate-icon{opacity:1;transform:scale(1)}.invalid i{--mdui-comp-ripple-state-layer-color:var(--mdui-color-error)}.invalid .icon{color:rgb(var(--mdui-color-error))}.invalid .label{color:rgb(var(--mdui-color-error))}:host([disabled]){cursor:default;pointer-events:none}:host([disabled]) .icon{color:rgba(var(--mdui-color-on-surface),38%)}:host([disabled]) .label{color:rgba(var(--mdui-color-on-surface),38%)}:host([disabled][checked]) .unchecked-icon,:host([disabled][indeterminate]) .unchecked-icon{opacity:0}`;
|
package/components/chip/index.js
CHANGED
|
@@ -99,20 +99,14 @@ let Chip = class Chip extends ButtonBase {
|
|
|
99
99
|
(this.selected && hasSelectedIcon),
|
|
100
100
|
'has-end-icon': hasEndIcon,
|
|
101
101
|
});
|
|
102
|
-
return html `<mdui-ripple
|
|
103
|
-
${ref(this.rippleRef)}
|
|
104
|
-
.noRipple=${this.noRipple}
|
|
105
|
-
></mdui-ripple>
|
|
106
|
-
${this.isButton()
|
|
102
|
+
return html `<mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.isButton()
|
|
107
103
|
? this.renderButton({
|
|
108
104
|
className,
|
|
109
105
|
part: 'button',
|
|
110
106
|
content: this.renderInner(),
|
|
111
107
|
})
|
|
112
108
|
: this.disabled || this.loading
|
|
113
|
-
? html `<span part="button" class="${className} _a"
|
|
114
|
-
${this.renderInner()}
|
|
115
|
-
</span>`
|
|
109
|
+
? html `<span part="button" class="${className} _a">${this.renderInner()}</span>`
|
|
116
110
|
: this.renderAnchor({
|
|
117
111
|
className,
|
|
118
112
|
part: 'button',
|
|
@@ -155,15 +149,12 @@ let Chip = class Chip extends ButtonBase {
|
|
|
155
149
|
}
|
|
156
150
|
const icon = () => {
|
|
157
151
|
return this.icon
|
|
158
|
-
? html `<mdui-icon name
|
|
152
|
+
? html `<mdui-icon name="${this.icon}" class="i"></mdui-icon>`
|
|
159
153
|
: nothingTemplate;
|
|
160
154
|
};
|
|
161
155
|
const selectedIcon = () => {
|
|
162
156
|
if (this.selectedIcon) {
|
|
163
|
-
return html `<mdui-icon
|
|
164
|
-
name="${this.selectedIcon}"
|
|
165
|
-
class="i"
|
|
166
|
-
></mdui-icon>`;
|
|
157
|
+
return html `<mdui-icon name="${this.selectedIcon}" class="i"></mdui-icon>`;
|
|
167
158
|
}
|
|
168
159
|
if (this.variant === 'assist' || this.variant === 'filter') {
|
|
169
160
|
return html `<mdui-icon-check class="i"></mdui-icon-check>`;
|
|
@@ -172,38 +163,23 @@ let Chip = class Chip extends ButtonBase {
|
|
|
172
163
|
};
|
|
173
164
|
return !this.selected
|
|
174
165
|
? html `<slot name="icon" part="icon" class="icon">${icon()}</slot>`
|
|
175
|
-
: html `<slot
|
|
176
|
-
name="selected-icon"
|
|
177
|
-
part="selected-icon"
|
|
178
|
-
class="selected-icon"
|
|
179
|
-
>
|
|
180
|
-
${selectedIcon()}
|
|
181
|
-
</slot>`;
|
|
166
|
+
: html `<slot name="selected-icon" part="selected-icon" class="selected-icon">${selectedIcon()}</slot>`;
|
|
182
167
|
}
|
|
183
168
|
renderLabel() {
|
|
184
169
|
return html `<slot part="label" class="label"></slot>`;
|
|
185
170
|
}
|
|
186
171
|
renderEndIcon() {
|
|
187
|
-
return html `<slot name="end-icon" part="end-icon" class="end-icon"
|
|
188
|
-
${this.endIcon
|
|
172
|
+
return html `<slot name="end-icon" part="end-icon" class="end-icon">${this.endIcon
|
|
189
173
|
? html `<mdui-icon name="${this.endIcon}" class="i"></mdui-icon>`
|
|
190
|
-
: nothingTemplate}
|
|
191
|
-
</slot>`;
|
|
174
|
+
: nothingTemplate}</slot>`;
|
|
192
175
|
}
|
|
193
176
|
renderDeleteIcon() {
|
|
194
177
|
if (!this.deletable) {
|
|
195
178
|
return nothingTemplate;
|
|
196
179
|
}
|
|
197
|
-
return html `<slot
|
|
198
|
-
name="delete-icon"
|
|
199
|
-
part="delete-icon"
|
|
200
|
-
class="delete-icon"
|
|
201
|
-
@click=${this.onDelete}
|
|
202
|
-
>
|
|
203
|
-
${this.deleteIcon
|
|
180
|
+
return html `<slot name="delete-icon" part="delete-icon" class="delete-icon" @click="${this.onDelete}">${this.deleteIcon
|
|
204
181
|
? html `<mdui-icon name="${this.deleteIcon}" class="i"></mdui-icon>`
|
|
205
|
-
: html `<mdui-icon-clear class="i"></mdui-icon-clear>`}
|
|
206
|
-
</slot>`;
|
|
182
|
+
: html `<mdui-icon-clear class="i"></mdui-icon-clear>`}</slot>`;
|
|
207
183
|
}
|
|
208
184
|
renderInner() {
|
|
209
185
|
return [
|
package/components/chip/style.js
CHANGED
|
@@ -1,207 +1,4 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
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(
|
|
2
|
+
export const style = css `:host{--shape-corner:var(--mdui-shape-corner-small);position:relative;display:inline-block;overflow:hidden;border-radius:var(--shape-corner);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);height:2rem;background-color:rgb(var(--mdui-color-surface));border:.0625rem solid rgb(var(--mdui-color-outline));color:rgb(var(--mdui-color-on-surface-variant));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking);line-height:var(--mdui-typescale-label-large-line-height);--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface-variant)}.button{padding-right:.4375rem;padding-left:.4375rem}:host([variant=input]) .button{padding-right:.1875rem;padding-left:.1875rem}:host([selected]) .button{padding-right:.5rem;padding-left:.5rem}:host([selected][variant=input]) .button{padding-right:.25rem;padding-left:.25rem}:host([elevated]) .button{padding-right:.5rem;padding-left:.5rem}:host([variant=assist]){color:rgb(var(--mdui-color-on-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([elevated]){border-width:0;background-color:rgb(var(--mdui-color-surface-container-low));box-shadow:var(--mdui-elevation-level1)}:host([selected]){color:rgb(var(--mdui-color-on-secondary-container));background-color:rgb(var(--mdui-color-secondary-container));border-width:0;--mdui-comp-ripple-state-layer-color:var(
|
|
60
3
|
--mdui-color-on-secondary-container
|
|
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
|
-
`;
|
|
4
|
+
)}:host([disabled]),:host([loading]){cursor:default;pointer-events:none}:host([disabled]){border-color:rgba(var(--mdui-color-on-surface),12%);color:rgba(var(--mdui-color-on-surface),38%);box-shadow:var(--mdui-elevation-level0)}:host([disabled][elevated]),:host([disabled][selected]){background-color:rgba(var(--mdui-color-on-surface),12%)}:host([selected][hover]){box-shadow:var(--mdui-elevation-level1)}:host([elevated][hover]){color:rgb(var(--mdui-color-on-secondary-container));box-shadow:var(--mdui-elevation-level2)}:host([variant=filter][hover]),:host([variant=input][hover]),:host([variant=suggestion][hover]){color:rgb(var(--mdui-color-on-surface-variant))}:host([variant=filter][focus-visible]),:host([variant=input][focus-visible]),:host([variant=suggestion][focus-visible]){border-color:rgb(var(--mdui-color-on-surface-variant))}:host([dragged]),:host([dragged][hover]){box-shadow:var(--mdui-elevation-level4)}.button{overflow:visible}.label{display:inline-flex;padding-right:.5rem;padding-left:.5rem}.end-icon,.icon,.selected-icon{display:inline-flex;font-size:1.28571429em;color:rgb(var(--mdui-color-on-surface-variant))}:host([variant=assist]) .end-icon,:host([variant=assist]) .icon,:host([variant=assist]) .selected-icon{color:rgb(var(--mdui-color-primary))}:host([selected]) .end-icon,:host([selected]) .icon,:host([selected]) .selected-icon{color:rgb(var(--mdui-color-on-secondary-container))}:host([disabled]) .end-icon,:host([disabled]) .icon,:host([disabled]) .selected-icon{opacity:.38;color:rgb(var(--mdui-color-on-surface))}.end-icon .i,.icon .i,.selected-icon .i,::slotted([slot=end-icon]),::slotted([slot=icon]),::slotted([slot=selected-icon]){font-size:inherit}:host([variant=input]) .has-icon .icon,:host([variant=input]) .has-icon .selected-icon,:host([variant=input]) .has-icon mdui-circular-progress{margin-left:.25rem}:host([variant=input]) .has-end-icon .end-icon{margin-right:.25rem}mdui-circular-progress{display:inline-flex;width:1.125rem;height:1.125rem}:host([disabled]) mdui-circular-progress{stroke:rgba(var(--mdui-color-on-surface),38%)}::slotted(mdui-avatar[slot=end-icon]),::slotted(mdui-avatar[slot=icon]),::slotted(mdui-avatar[slot=selected-icon]){width:1.5rem;height:1.5rem}:host([disabled]) ::slotted(mdui-avatar[slot=end-icon]),:host([disabled]) ::slotted(mdui-avatar[slot=icon]),:host([disabled]) ::slotted(mdui-avatar[slot=selected-icon]){opacity:.38}::slotted(mdui-avatar[slot=icon]),::slotted(mdui-avatar[slot=selected-icon]){margin-left:-.25rem;margin-right:-.125rem}::slotted(mdui-avatar[slot=end-icon]){margin-right:-.25rem;margin-left:-.125rem}.delete-icon{display:inline-flex;font-size:1.28571429em;transition:background-color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);border-radius:var(--mdui-shape-corner-full);margin-right:-.25rem;margin-left:-.25rem;padding:.25rem;color:rgb(var(--mdui-color-on-surface-variant))}.delete-icon:hover{background-color:rgba(var(--mdui-color-on-surface-variant),12%)}.has-end-icon .delete-icon{margin-left:.25rem}:host([variant=assiat]) .delete-icon{color:rgb(var(--mdui-color-primary))}:host([variant=input]) .delete-icon{margin-right:.0625rem}:host([disabled]) .delete-icon{color:rgba(var(--mdui-color-on-surface),38%)}.delete-icon .i,::slotted([slot=delete-icon]){font-size:inherit}::slotted(mdui-avatar[slot=delete-icon]){width:1.125rem;height:1.125rem}`;
|
|
@@ -23,14 +23,10 @@ let CircularProgress = class CircularProgress extends MduiElement {
|
|
|
23
23
|
}
|
|
24
24
|
render() {
|
|
25
25
|
const isDeterminate = !isUndefined(this.value);
|
|
26
|
-
return html `<div
|
|
27
|
-
class="progress ${classMap({
|
|
26
|
+
return html `<div class="progress ${classMap({
|
|
28
27
|
determinate: isDeterminate,
|
|
29
28
|
indeterminate: !isDeterminate,
|
|
30
|
-
})}"
|
|
31
|
-
>
|
|
32
|
-
${isDeterminate ? this.renderDeterminate() : this.renderInDeterminate()}
|
|
33
|
-
</div>`;
|
|
29
|
+
})}">${isDeterminate ? this.renderDeterminate() : this.renderInDeterminate()}</div>`;
|
|
34
30
|
}
|
|
35
31
|
renderDeterminate() {
|
|
36
32
|
const value = this.value;
|
|
@@ -40,24 +36,7 @@ let CircularProgress = class CircularProgress extends MduiElement {
|
|
|
40
36
|
const center = circleRadius + strokeWidth / 2;
|
|
41
37
|
const circumference = 2 * π * circleRadius;
|
|
42
38
|
const determinateStrokeDashOffset = (1 - value / Math.max(this.max ?? value, value)) * circumference;
|
|
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>`;
|
|
39
|
+
return html `<svg viewBox="0 0 ${center * 2} ${center * 2}"><circle class="track" cx="${center}" cy="${center}" r="${circleRadius}" stroke-width="${strokeWidth}"></circle><circle class="circle" cx="${center}" cy="${center}" r="${circleRadius}" stroke-dasharray="${2 * π * circleRadius}" stroke-dashoffset="${determinateStrokeDashOffset}" stroke-width="${strokeWidth}"></circle></svg>`;
|
|
61
40
|
}
|
|
62
41
|
renderInDeterminate() {
|
|
63
42
|
const strokeWidth = 4; // 圆环宽度
|
|
@@ -66,21 +45,8 @@ let CircularProgress = class CircularProgress extends MduiElement {
|
|
|
66
45
|
const center = circleRadius + strokeWidth / 2;
|
|
67
46
|
const circumference = 2 * π * circleRadius;
|
|
68
47
|
const halfCircumference = 0.5 * circumference;
|
|
69
|
-
const circle = (thisStrokeWidth) => html `<svg class="circle" viewBox="0 0 ${center * 2} ${center * 2}"
|
|
70
|
-
|
|
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>`;
|
|
48
|
+
const circle = (thisStrokeWidth) => html `<svg class="circle" viewBox="0 0 ${center * 2} ${center * 2}"><circle cx="${center}" cy="${center}" r="${circleRadius}" stroke-dasharray="${circumference}" stroke-dashoffset="${halfCircumference}" stroke-width="${thisStrokeWidth}"></circle></svg>`;
|
|
49
|
+
return html `<div class="layer"><div class="clipper left">${circle(strokeWidth)}</div><div class="gap-patch">${circle(strokeWidth * 0.8)}</div><div class="clipper right">${circle(strokeWidth)}</div></div>`;
|
|
84
50
|
}
|
|
85
51
|
};
|
|
86
52
|
CircularProgress.styles = [componentStyle, style];
|