mdui 2.0.5 → 2.0.6
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 +7 -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.js +6 -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.js +32 -160
- 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 +1105 -1105
- package/mdui.esm.js +22 -0
- package/mdui.global.js +22 -0
- package/package.json +1 -1
- package/web-types.en.json +1 -1
- package/web-types.zh-cn.json +1 -1
|
@@ -204,75 +204,16 @@ let Select = class Select extends FocusableMixin(MduiElement) {
|
|
|
204
204
|
render() {
|
|
205
205
|
const hasSelection = this.multiple ? !!this.value.length : !!this.value;
|
|
206
206
|
return html `${this.multiple
|
|
207
|
-
? html `<select
|
|
208
|
-
${ref(this.hiddenInputRef)}
|
|
209
|
-
class="hidden-input"
|
|
210
|
-
name=${ifDefined(this.name)}
|
|
211
|
-
value=${ifDefined(this.value)}
|
|
212
|
-
.required=${this.required}
|
|
213
|
-
.disabled=${this.disabled}
|
|
214
|
-
multiple
|
|
215
|
-
tabindex="-1"
|
|
216
|
-
>
|
|
217
|
-
${map(this.value, (value) => html `<option selected value=${value}></option>`)}
|
|
218
|
-
</select>`
|
|
219
|
-
: html `<input
|
|
220
|
-
${ref(this.hiddenInputRef)}
|
|
221
|
-
type="radio"
|
|
222
|
-
class="hidden-input"
|
|
223
|
-
name=${ifDefined(this.name)}
|
|
224
|
-
value=${ifDefined(this.value)}
|
|
225
|
-
.required=${this.required}
|
|
226
|
-
.disabled=${this.disabled}
|
|
227
|
-
.checked=${hasSelection}
|
|
228
|
-
tabindex="-1"
|
|
229
|
-
/>`}
|
|
230
|
-
<mdui-dropdown
|
|
231
|
-
.stayOpenOnClick=${this.multiple}
|
|
232
|
-
.disabled=${this.readonly || this.disabled}
|
|
233
|
-
.placement=${this.placement === 'top'
|
|
207
|
+
? html `<select ${ref(this.hiddenInputRef)} class="hidden-input" name="${ifDefined(this.name)}" value="${ifDefined(this.value)}" .required="${this.required}" .disabled="${this.disabled}" multiple="multiple" tabindex="-1">${map(this.value, (value) => html `<option selected="selected" value="${value}"></option>`)}</select>`
|
|
208
|
+
: html `<input ${ref(this.hiddenInputRef)} type="radio" class="hidden-input" name="${ifDefined(this.name)}" value="${ifDefined(this.value)}" .required="${this.required}" .disabled="${this.disabled}" .checked="${hasSelection}" tabindex="-1">`}<mdui-dropdown .stayOpenOnClick="${this.multiple}" .disabled="${this.readonly || this.disabled}" .placement="${this.placement === 'top'
|
|
234
209
|
? 'top-start'
|
|
235
210
|
: this.placement === 'bottom'
|
|
236
211
|
? 'bottom-start'
|
|
237
|
-
: 'auto'}
|
|
238
|
-
@open=${this.onDropdownOpen}
|
|
239
|
-
@close=${this.onDropdownClose}
|
|
240
|
-
>
|
|
241
|
-
<mdui-text-field
|
|
242
|
-
${ref(this.textFieldRef)}
|
|
243
|
-
slot="trigger"
|
|
244
|
-
part="text-field"
|
|
245
|
-
class="text-field"
|
|
246
|
-
readonly
|
|
247
|
-
.readonlyButClearable=${true}
|
|
248
|
-
.variant=${this.variant}
|
|
249
|
-
.name=${this.name}
|
|
250
|
-
.value=${this.multiple
|
|
212
|
+
: 'auto'}" @open="${this.onDropdownOpen}" @close="${this.onDropdownClose}"><mdui-text-field ${ref(this.textFieldRef)} slot="trigger" part="text-field" class="text-field" readonly="readonly" .readonlyButClearable="${true}" .variant="${this.variant}" .name="${this.name}" .value="${this.multiple
|
|
251
213
|
? this.value.length
|
|
252
214
|
? ' '
|
|
253
215
|
: ''
|
|
254
|
-
: this.getMenuItemLabelByValue(this.value)}
|
|
255
|
-
.label=${this.label}
|
|
256
|
-
.placeholder=${this.placeholder}
|
|
257
|
-
.helper=${this.helper}
|
|
258
|
-
.error=${this.hiddenInputRef.value?.validationMessage}
|
|
259
|
-
.clearable=${this.clearable}
|
|
260
|
-
.clearIcon=${this.clearIcon}
|
|
261
|
-
.endAligned=${this.endAligned}
|
|
262
|
-
.prefix=${this.prefix}
|
|
263
|
-
.suffix=${this.suffix}
|
|
264
|
-
.icon=${this.icon}
|
|
265
|
-
.endIcon=${this.endIcon}
|
|
266
|
-
.errorIcon=${this.errorIcon}
|
|
267
|
-
.form=${this.form}
|
|
268
|
-
.disabled=${this.disabled}
|
|
269
|
-
.required=${this.required}
|
|
270
|
-
.invalidStyle=${this.invalid}
|
|
271
|
-
@clear=${this.onClear}
|
|
272
|
-
@change=${(e) => e.stopPropagation()}
|
|
273
|
-
@keydown=${this.onTextFieldKeyDown}
|
|
274
|
-
>
|
|
275
|
-
${map([
|
|
216
|
+
: this.getMenuItemLabelByValue(this.value)}" .label="${this.label}" .placeholder="${this.placeholder}" .helper="${this.helper}" .error="${this.hiddenInputRef.value?.validationMessage}" .clearable="${this.clearable}" .clearIcon="${this.clearIcon}" .endAligned="${this.endAligned}" .prefix="${this.prefix}" .suffix="${this.suffix}" .icon="${this.icon}" .endIcon="${this.endIcon}" .errorIcon="${this.errorIcon}" .form="${this.form}" .disabled="${this.disabled}" .required="${this.required}" .invalidStyle="${this.invalid}" @clear="${this.onClear}" @change="${(e) => e.stopPropagation()}" @keydown="${this.onTextFieldKeyDown}">${map([
|
|
276
217
|
'icon',
|
|
277
218
|
'end-icon',
|
|
278
219
|
'error-icon',
|
|
@@ -282,30 +223,8 @@ let Select = class Select extends FocusableMixin(MduiElement) {
|
|
|
282
223
|
'clear-icon',
|
|
283
224
|
'helper',
|
|
284
225
|
], (slotName) => this.hasSlotController.test(slotName)
|
|
285
|
-
? html `<slot name
|
|
286
|
-
: nothing)}
|
|
287
|
-
${when(this.multiple && this.value.length, () => html `<div slot="input" class="chips">
|
|
288
|
-
${map(this.value, (valueItem) => html `<mdui-chip
|
|
289
|
-
class="chip"
|
|
290
|
-
variant="input"
|
|
291
|
-
deletable
|
|
292
|
-
tabindex="-1"
|
|
293
|
-
@delete=${() => this.onDeleteOneValue(valueItem)}
|
|
294
|
-
>
|
|
295
|
-
${this.getMenuItemLabelByValue(valueItem)}
|
|
296
|
-
</mdui-chip>`)}
|
|
297
|
-
</div>`)}
|
|
298
|
-
</mdui-text-field>
|
|
299
|
-
<mdui-menu
|
|
300
|
-
${ref(this.menuRef)}
|
|
301
|
-
part="menu"
|
|
302
|
-
.selects=${this.multiple ? 'multiple' : 'single'}
|
|
303
|
-
.value=${this.value}
|
|
304
|
-
@change=${this.onValueChange}
|
|
305
|
-
>
|
|
306
|
-
<slot></slot>
|
|
307
|
-
</mdui-menu>
|
|
308
|
-
</mdui-dropdown>`;
|
|
226
|
+
? html `<slot name="${slotName}" slot="${slotName}"></slot>`
|
|
227
|
+
: nothing)} ${when(this.multiple && this.value.length, () => html `<div slot="input" class="chips">${map(this.value, (valueItem) => html `<mdui-chip class="chip" variant="input" deletable tabindex="-1" @delete="${() => this.onDeleteOneValue(valueItem)}">${this.getMenuItemLabelByValue(valueItem)}</mdui-chip>`)}</div>`)}</mdui-text-field><mdui-menu ${ref(this.menuRef)} part="menu" .selects="${this.multiple ? 'multiple' : 'single'}" .value="${this.value}" @change="${this.onValueChange}"><slot></slot></mdui-menu></mdui-dropdown>`;
|
|
309
228
|
}
|
|
310
229
|
getMenuItemLabelByValue(valueItem) {
|
|
311
230
|
if (!this.menuItems.length) {
|
|
@@ -1,28 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
3
|
-
:host {
|
|
4
|
-
display: inline-block;
|
|
5
|
-
width: 100%;
|
|
6
|
-
}
|
|
7
|
-
.hidden-input {
|
|
8
|
-
display: none;
|
|
9
|
-
}
|
|
10
|
-
.text-field {
|
|
11
|
-
cursor: pointer;
|
|
12
|
-
}
|
|
13
|
-
.chips {
|
|
14
|
-
display: flex;
|
|
15
|
-
flex-wrap: wrap;
|
|
16
|
-
margin: -0.5rem -0.25rem;
|
|
17
|
-
min-height: 2.5rem;
|
|
18
|
-
}
|
|
19
|
-
:host([variant='filled'][label]) .chips {
|
|
20
|
-
margin: 0rem -0.25rem -1rem -0.25rem;
|
|
21
|
-
}
|
|
22
|
-
.chip {
|
|
23
|
-
margin: 0.25rem;
|
|
24
|
-
}
|
|
25
|
-
mdui-menu {
|
|
26
|
-
max-width: none;
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
2
|
+
export const style = css `:host{display:inline-block;width:100%}.hidden-input{display:none}.text-field{cursor:pointer}.chips{display:flex;flex-wrap:wrap;margin:-.5rem -.25rem;min-height:2.5rem}:host([variant=filled][label]) .chips{margin:0 -.25rem -1rem -.25rem}.chip{margin:.25rem}mdui-menu{max-width:none}`;
|
|
@@ -90,41 +90,10 @@ let Slider = class Slider extends SliderBase {
|
|
|
90
90
|
* <input class="invalid" /> 用于提供 html5 自带的表单错误提示
|
|
91
91
|
*/
|
|
92
92
|
render() {
|
|
93
|
-
return html `<label class
|
|
94
|
-
<input
|
|
95
|
-
${ref(this.inputRef)}
|
|
96
|
-
type="range"
|
|
97
|
-
step=${this.step}
|
|
98
|
-
min=${this.min}
|
|
99
|
-
max=${this.max}
|
|
100
|
-
?disabled=${this.disabled}
|
|
101
|
-
.value=${live(this.value.toString())}
|
|
102
|
-
@input=${this.onInput}
|
|
103
|
-
@change=${this.onChange}
|
|
104
|
-
/>
|
|
105
|
-
<div part="track-inactive" class="track-inactive"></div>
|
|
106
|
-
<div
|
|
107
|
-
${ref(this.trackActiveRef)}
|
|
108
|
-
part="track-active"
|
|
109
|
-
class="track-active"
|
|
110
|
-
></div>
|
|
111
|
-
<div ${ref(this.handleRef)} part="handle" class="handle">
|
|
112
|
-
<div class="elevation"></div>
|
|
113
|
-
<mdui-ripple
|
|
114
|
-
${ref(this.rippleRef)}
|
|
115
|
-
.noRipple=${this.noRipple}
|
|
116
|
-
></mdui-ripple>
|
|
117
|
-
${this.renderLabel(this.value)}
|
|
118
|
-
</div>
|
|
119
|
-
${when(this.tickmarks, () => map(this.getCandidateValues(), (value) => html `<div
|
|
120
|
-
part="tickmark"
|
|
121
|
-
class="tickmark ${classMap({ active: value < this.value })}"
|
|
122
|
-
style="${styleMap({
|
|
93
|
+
return html `<label class="${classMap({ invalid: this.invalid })}"><input ${ref(this.inputRef)} type="range" step="${this.step}" min="${this.min}" max="${this.max}" ?disabled="${this.disabled}" .value="${live(this.value.toString())}" @input="${this.onInput}" @change="${this.onChange}"><div part="track-inactive" class="track-inactive"></div><div ${ref(this.trackActiveRef)} part="track-active" class="track-active"></div><div ${ref(this.handleRef)} part="handle" class="handle"><div class="elevation"></div><mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.renderLabel(this.value)}</div>${when(this.tickmarks, () => map(this.getCandidateValues(), (value) => html `<div part="tickmark" class="tickmark ${classMap({ active: value < this.value })}" style="${styleMap({
|
|
123
94
|
left: `${((value - this.min) / this.max) * 100}%`,
|
|
124
95
|
display: value === this.value ? 'none' : 'block',
|
|
125
|
-
})}"
|
|
126
|
-
></div>`))}
|
|
127
|
-
</label>`;
|
|
96
|
+
})}"></div>`))}</label>`;
|
|
128
97
|
}
|
|
129
98
|
updateStyle() {
|
|
130
99
|
const percent = ((this.value - this.min) / (this.max - this.min)) * 100;
|
|
@@ -1,174 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const sliderBaseStyle = css
|
|
3
|
-
:host {
|
|
4
|
-
position: relative;
|
|
5
|
-
display: block;
|
|
6
|
-
width: 100%;
|
|
7
|
-
-webkit-tap-highlight-color: transparent;
|
|
8
|
-
height: 2.5rem;
|
|
9
|
-
padding: 0rem 1.25rem;
|
|
10
|
-
}
|
|
11
|
-
label {
|
|
12
|
-
position: relative;
|
|
13
|
-
display: block;
|
|
14
|
-
width: 100%;
|
|
15
|
-
height: 100%;
|
|
16
|
-
}
|
|
17
|
-
input[type='range'] {
|
|
18
|
-
position: absolute;
|
|
19
|
-
inset: 0;
|
|
20
|
-
z-index: 4;
|
|
21
|
-
height: 100%;
|
|
22
|
-
cursor: pointer;
|
|
23
|
-
opacity: 0;
|
|
24
|
-
-webkit-appearance: none;
|
|
25
|
-
appearance: none;
|
|
26
|
-
width: calc(100% + 20rem * 2 / 16);
|
|
27
|
-
margin: 0rem -1.25rem;
|
|
28
|
-
padding: 0rem 0.75rem;
|
|
29
|
-
}
|
|
30
|
-
:host([disabled]) input[type='range'] {
|
|
31
|
-
cursor: not-allowed;
|
|
32
|
-
}
|
|
33
|
-
.track-inactive,
|
|
34
|
-
.track-active {
|
|
35
|
-
position: absolute;
|
|
36
|
-
top: 50%;
|
|
37
|
-
height: 0.25rem;
|
|
38
|
-
margin-top: -0.125rem;
|
|
39
|
-
}
|
|
40
|
-
.track-inactive {
|
|
41
|
-
left: -0.125rem;
|
|
42
|
-
right: -0.125rem;
|
|
43
|
-
border-radius: var(--mdui-shape-corner-full);
|
|
44
|
-
background-color: rgb(var(--mdui-color-surface-container-highest));
|
|
45
|
-
}
|
|
46
|
-
.invalid .track-inactive {
|
|
47
|
-
background-color: rgba(var(--mdui-color-error), 0.12);
|
|
48
|
-
}
|
|
49
|
-
:host([disabled]) .track-inactive {
|
|
50
|
-
background-color: rgba(var(--mdui-color-on-surface), 0.12);
|
|
51
|
-
}
|
|
52
|
-
.track-active {
|
|
53
|
-
background-color: rgb(var(--mdui-color-primary));
|
|
54
|
-
}
|
|
55
|
-
.invalid .track-active {
|
|
56
|
-
background-color: rgb(var(--mdui-color-error));
|
|
57
|
-
}
|
|
58
|
-
:host([disabled]) .track-active {
|
|
59
|
-
background-color: rgba(var(--mdui-color-on-surface), 0.38);
|
|
60
|
-
}
|
|
61
|
-
.handle {
|
|
62
|
-
position: absolute;
|
|
63
|
-
top: 50%;
|
|
64
|
-
transform: translate(-50%);
|
|
65
|
-
cursor: pointer;
|
|
66
|
-
z-index: 2;
|
|
67
|
-
width: 2.5rem;
|
|
68
|
-
height: 2.5rem;
|
|
69
|
-
margin-top: -1.25rem;
|
|
70
|
-
--mdui-comp-ripple-state-layer-color: var(--mdui-color-primary);
|
|
71
|
-
}
|
|
72
|
-
.invalid .handle {
|
|
73
|
-
--mdui-comp-ripple-state-layer-color: var(--mdui-color-error);
|
|
74
|
-
}
|
|
75
|
-
.handle::before,
|
|
76
|
-
.handle .elevation {
|
|
77
|
-
position: absolute;
|
|
78
|
-
display: block;
|
|
79
|
-
content: ' ';
|
|
80
|
-
left: 0.625rem;
|
|
81
|
-
top: 0.625rem;
|
|
82
|
-
width: 1.25rem;
|
|
83
|
-
height: 1.25rem;
|
|
84
|
-
border-radius: var(--mdui-shape-corner-full);
|
|
85
|
-
}
|
|
86
|
-
.handle .elevation {
|
|
87
|
-
background-color: rgb(var(--mdui-color-primary));
|
|
88
|
-
box-shadow: var(--mdui-elevation-level1);
|
|
89
|
-
}
|
|
90
|
-
.invalid .handle .elevation {
|
|
91
|
-
background-color: rgb(var(--mdui-color-error));
|
|
92
|
-
}
|
|
93
|
-
:host([disabled]) .handle .elevation {
|
|
94
|
-
background-color: rgba(var(--mdui-color-on-surface), 0.38);
|
|
95
|
-
box-shadow: var(--mdui-elevation-level0);
|
|
96
|
-
}
|
|
97
|
-
.handle::before {
|
|
98
|
-
background-color: rgb(var(--mdui-color-background));
|
|
99
|
-
}
|
|
100
|
-
.handle mdui-ripple {
|
|
101
|
-
border-radius: var(--mdui-shape-corner-full);
|
|
102
|
-
}
|
|
103
|
-
.label {
|
|
104
|
-
position: absolute;
|
|
105
|
-
left: 50%;
|
|
106
|
-
transform: translateX(-50%) scale(0);
|
|
107
|
-
transform-origin: center bottom;
|
|
108
|
-
display: flex;
|
|
109
|
-
align-items: center;
|
|
110
|
-
justify-content: center;
|
|
111
|
-
cursor: default;
|
|
112
|
-
white-space: nowrap;
|
|
113
|
-
-webkit-user-select: none;
|
|
114
|
-
user-select: none;
|
|
115
|
-
pointer-events: none;
|
|
116
|
-
transition: transform var(--mdui-motion-duration-short2)
|
|
117
|
-
var(--mdui-motion-easing-standard);
|
|
118
|
-
bottom: 2.5rem;
|
|
119
|
-
min-width: 1.75rem;
|
|
120
|
-
height: 1.75rem;
|
|
121
|
-
padding: 0.375rem 0.5rem;
|
|
122
|
-
border-radius: var(--mdui-shape-corner-full);
|
|
123
|
-
color: rgb(var(--mdui-color-on-primary));
|
|
124
|
-
font-size: var(--mdui-typescale-label-medium-size);
|
|
125
|
-
font-weight: var(--mdui-typescale-label-medium-weight);
|
|
126
|
-
letter-spacing: var(--mdui-typescale-label-medium-tracking);
|
|
127
|
-
line-height: var(--mdui-typescale-label-medium-line-height);
|
|
128
|
-
background-color: rgb(var(--mdui-color-primary));
|
|
129
|
-
}
|
|
130
|
-
.invalid .label {
|
|
131
|
-
color: rgb(var(--mdui-color-on-error));
|
|
132
|
-
background-color: rgb(var(--mdui-color-error));
|
|
133
|
-
}
|
|
134
|
-
.label::after {
|
|
135
|
-
content: ' ';
|
|
136
|
-
position: absolute;
|
|
137
|
-
z-index: -1;
|
|
138
|
-
transform: rotate(45deg);
|
|
139
|
-
width: 0.875rem;
|
|
140
|
-
height: 0.875rem;
|
|
141
|
-
bottom: -0.125rem;
|
|
142
|
-
background-color: rgb(var(--mdui-color-primary));
|
|
143
|
-
}
|
|
144
|
-
.invalid .label::after {
|
|
145
|
-
background-color: rgb(var(--mdui-color-error));
|
|
146
|
-
}
|
|
147
|
-
.label-visible {
|
|
148
|
-
transform: translateX(-50%) scale(1);
|
|
149
|
-
transition: transform var(--mdui-motion-duration-short4)
|
|
150
|
-
var(--mdui-motion-easing-standard);
|
|
151
|
-
}
|
|
152
|
-
.tickmark {
|
|
153
|
-
position: absolute;
|
|
154
|
-
top: 50%;
|
|
155
|
-
transform: translate(-50%);
|
|
156
|
-
width: 0.125rem;
|
|
157
|
-
height: 0.125rem;
|
|
158
|
-
margin-top: -0.0625rem;
|
|
159
|
-
border-radius: var(--mdui-shape-corner-full);
|
|
160
|
-
background-color: rgba(var(--mdui-color-on-surface-variant), 0.38);
|
|
161
|
-
}
|
|
162
|
-
.invalid .tickmark {
|
|
163
|
-
background-color: rgba(var(--mdui-color-error), 0.38);
|
|
164
|
-
}
|
|
165
|
-
.tickmark.active {
|
|
166
|
-
background-color: rgba(var(--mdui-color-on-primary), 0.38);
|
|
167
|
-
}
|
|
168
|
-
.invalid .tickmark.active {
|
|
169
|
-
background-color: rgba(var(--mdui-color-on-error), 0.38);
|
|
170
|
-
}
|
|
171
|
-
:host([disabled]) .tickmark {
|
|
172
|
-
background-color: rgba(var(--mdui-color-on-surface), 0.38);
|
|
173
|
-
}
|
|
174
|
-
`;
|
|
2
|
+
export const sliderBaseStyle = css `:host{position:relative;display:block;width:100%;-webkit-tap-highlight-color:transparent;height:2.5rem;padding:0 1.25rem}label{position:relative;display:block;width:100%;height:100%}input[type=range]{position:absolute;inset:0;z-index:4;height:100%;cursor:pointer;opacity:0;-webkit-appearance:none;appearance:none;width:calc(100% + 20rem * 2 / 16);margin:0 -1.25rem;padding:0 .75rem}:host([disabled]) input[type=range]{cursor:not-allowed}.track-active,.track-inactive{position:absolute;top:50%;height:.25rem;margin-top:-.125rem}.track-inactive{left:-.125rem;right:-.125rem;border-radius:var(--mdui-shape-corner-full);background-color:rgb(var(--mdui-color-surface-container-highest))}.invalid .track-inactive{background-color:rgba(var(--mdui-color-error),.12)}:host([disabled]) .track-inactive{background-color:rgba(var(--mdui-color-on-surface),.12)}.track-active{background-color:rgb(var(--mdui-color-primary))}.invalid .track-active{background-color:rgb(var(--mdui-color-error))}:host([disabled]) .track-active{background-color:rgba(var(--mdui-color-on-surface),.38)}.handle{position:absolute;top:50%;transform:translate(-50%);cursor:pointer;z-index:2;width:2.5rem;height:2.5rem;margin-top:-1.25rem;--mdui-comp-ripple-state-layer-color:var(--mdui-color-primary)}.invalid .handle{--mdui-comp-ripple-state-layer-color:var(--mdui-color-error)}.handle .elevation,.handle::before{position:absolute;display:block;content:' ';left:.625rem;top:.625rem;width:1.25rem;height:1.25rem;border-radius:var(--mdui-shape-corner-full)}.handle .elevation{background-color:rgb(var(--mdui-color-primary));box-shadow:var(--mdui-elevation-level1)}.invalid .handle .elevation{background-color:rgb(var(--mdui-color-error))}:host([disabled]) .handle .elevation{background-color:rgba(var(--mdui-color-on-surface),.38);box-shadow:var(--mdui-elevation-level0)}.handle::before{background-color:rgb(var(--mdui-color-background))}.handle mdui-ripple{border-radius:var(--mdui-shape-corner-full)}.label{position:absolute;left:50%;transform:translateX(-50%) scale(0);transform-origin:center bottom;display:flex;align-items:center;justify-content:center;cursor:default;white-space:nowrap;-webkit-user-select:none;user-select:none;pointer-events:none;transition:transform var(--mdui-motion-duration-short2) var(--mdui-motion-easing-standard);bottom:2.5rem;min-width:1.75rem;height:1.75rem;padding:.375rem .5rem;border-radius:var(--mdui-shape-corner-full);color:rgb(var(--mdui-color-on-primary));font-size:var(--mdui-typescale-label-medium-size);font-weight:var(--mdui-typescale-label-medium-weight);letter-spacing:var(--mdui-typescale-label-medium-tracking);line-height:var(--mdui-typescale-label-medium-line-height);background-color:rgb(var(--mdui-color-primary))}.invalid .label{color:rgb(var(--mdui-color-on-error));background-color:rgb(var(--mdui-color-error))}.label::after{content:' ';position:absolute;z-index:-1;transform:rotate(45deg);width:.875rem;height:.875rem;bottom:-.125rem;background-color:rgb(var(--mdui-color-primary))}.invalid .label::after{background-color:rgb(var(--mdui-color-error))}.label-visible{transform:translateX(-50%) scale(1);transition:transform var(--mdui-motion-duration-short4) var(--mdui-motion-easing-standard)}.tickmark{position:absolute;top:50%;transform:translate(-50%);width:.125rem;height:.125rem;margin-top:-.0625rem;border-radius:var(--mdui-shape-corner-full);background-color:rgba(var(--mdui-color-on-surface-variant),.38)}.invalid .tickmark{background-color:rgba(var(--mdui-color-error),.38)}.tickmark.active{background-color:rgba(var(--mdui-color-on-primary),.38)}.invalid .tickmark.active{background-color:rgba(var(--mdui-color-on-error),.38)}:host([disabled]) .tickmark{background-color:rgba(var(--mdui-color-on-surface),.38)}`;
|
|
@@ -153,12 +153,7 @@ export class SliderBase extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
|
153
153
|
* 渲染浮动标签
|
|
154
154
|
*/
|
|
155
155
|
renderLabel(value) {
|
|
156
|
-
return when(!this.nolabel, () => html `<div
|
|
157
|
-
part="label"
|
|
158
|
-
class="label ${classMap({ 'label-visible': this.labelVisible })}"
|
|
159
|
-
>
|
|
160
|
-
${this.labelFormatter(value)}
|
|
161
|
-
</div>`);
|
|
156
|
+
return when(!this.nolabel, () => html `<div part="label" class="label ${classMap({ 'label-visible': this.labelVisible })}">${this.labelFormatter(value)}</div>`);
|
|
162
157
|
}
|
|
163
158
|
onChange() {
|
|
164
159
|
// @ts-ignore
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
3
|
-
.track-active {
|
|
4
|
-
left: -0.125rem;
|
|
5
|
-
border-radius: var(--mdui-shape-corner-full) 0 0
|
|
6
|
-
var(--mdui-shape-corner-full);
|
|
7
|
-
}
|
|
8
|
-
`;
|
|
2
|
+
export const style = css `.track-active{left:-.125rem;border-radius:var(--mdui-shape-corner-full) 0 0 var(--mdui-shape-corner-full)}`;
|
|
@@ -204,38 +204,11 @@ let Snackbar = class Snackbar extends MduiElement {
|
|
|
204
204
|
document.removeEventListener('pointerdown', this.onDocumentClick);
|
|
205
205
|
}
|
|
206
206
|
render() {
|
|
207
|
-
return html `<slot part="message" class="message"></slot
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
class="action"
|
|
213
|
-
@click=${this.onActionClick}
|
|
214
|
-
>
|
|
215
|
-
${this.action
|
|
216
|
-
? html `<mdui-button variant="text" loading=${this.actionLoading}>
|
|
217
|
-
${this.action}
|
|
218
|
-
</mdui-button>`
|
|
219
|
-
: nothingTemplate}
|
|
220
|
-
</slot>
|
|
221
|
-
${when(this.closeable, () => html `<slot
|
|
222
|
-
name="close-button"
|
|
223
|
-
part="close-button"
|
|
224
|
-
class="close-button"
|
|
225
|
-
@click=${this.onCloseClick}
|
|
226
|
-
>
|
|
227
|
-
<mdui-button-icon>
|
|
228
|
-
<slot name="close-icon" part="close-icon">
|
|
229
|
-
${this.closeIcon
|
|
230
|
-
? html `<mdui-icon
|
|
231
|
-
name=${this.closeIcon}
|
|
232
|
-
class="i"
|
|
233
|
-
></mdui-icon>`
|
|
234
|
-
: html `<mdui-icon-clear class="i"></mdui-icon-clear>`}
|
|
235
|
-
</slot>
|
|
236
|
-
</mdui-button-icon>
|
|
237
|
-
</slot>`)}
|
|
238
|
-
</div>`;
|
|
207
|
+
return html `<slot part="message" class="message"></slot><div class="action-group"><slot name="action" part="action" class="action" @click="${this.onActionClick}">${this.action
|
|
208
|
+
? html `<mdui-button variant="text" loading="${this.actionLoading}">${this.action}</mdui-button>`
|
|
209
|
+
: nothingTemplate}</slot>${when(this.closeable, () => html `<slot name="close-button" part="close-button" class="close-button" @click="${this.onCloseClick}"><mdui-button-icon><slot name="close-icon" part="close-icon">${this.closeIcon
|
|
210
|
+
? html `<mdui-icon name="${this.closeIcon}" class="i"></mdui-icon>`
|
|
211
|
+
: html `<mdui-icon-clear class="i"></mdui-icon-clear>`}</slot></mdui-button-icon></slot>`)}</div>`;
|
|
239
212
|
}
|
|
240
213
|
/**
|
|
241
214
|
* 在 document 上点击时,根据条件判断是否要关闭 snackbar
|
|
@@ -1,101 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const style = css
|
|
3
|
-
:host {
|
|
4
|
-
--shape-corner: var(--mdui-shape-corner-extra-small);
|
|
5
|
-
--z-index: 2400;
|
|
6
|
-
position: fixed;
|
|
7
|
-
z-index: var(--z-index);
|
|
8
|
-
display: none;
|
|
9
|
-
align-items: center;
|
|
10
|
-
flex-wrap: wrap;
|
|
11
|
-
border-radius: var(--shape-corner);
|
|
12
|
-
min-width: 20rem;
|
|
13
|
-
max-width: 36rem;
|
|
14
|
-
padding: 0.25rem 0rem;
|
|
15
|
-
box-shadow: var(--mdui-elevation-level3);
|
|
16
|
-
background-color: rgb(var(--mdui-color-inverse-surface));
|
|
17
|
-
color: rgb(var(--mdui-color-inverse-on-surface));
|
|
18
|
-
font-size: var(--mdui-typescale-body-medium-size);
|
|
19
|
-
font-weight: var(--mdui-typescale-body-medium-weight);
|
|
20
|
-
letter-spacing: var(--mdui-typescale-body-medium-tracking);
|
|
21
|
-
line-height: var(--mdui-typescale-body-medium-line-height);
|
|
22
|
-
}
|
|
23
|
-
:host([placement^='top']) {
|
|
24
|
-
transform-origin: top;
|
|
25
|
-
top: 1rem;
|
|
26
|
-
}
|
|
27
|
-
:host([placement^='bottom']) {
|
|
28
|
-
transform-origin: bottom;
|
|
29
|
-
bottom: 1rem;
|
|
30
|
-
}
|
|
31
|
-
:host([placement='top-start']),
|
|
32
|
-
:host([placement='bottom-start']) {
|
|
33
|
-
left: 1rem;
|
|
34
|
-
}
|
|
35
|
-
:host([placement='top-end']),
|
|
36
|
-
:host([placement='bottom-end']) {
|
|
37
|
-
right: 1rem;
|
|
38
|
-
}
|
|
39
|
-
.message {
|
|
40
|
-
display: block;
|
|
41
|
-
margin: 0.625rem 1rem;
|
|
42
|
-
}
|
|
43
|
-
:host([message-line='1']) .message {
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
white-space: nowrap;
|
|
46
|
-
text-overflow: ellipsis;
|
|
47
|
-
}
|
|
48
|
-
:host([message-line='2']) .message {
|
|
49
|
-
display: -webkit-box;
|
|
50
|
-
overflow: hidden;
|
|
51
|
-
text-overflow: ellipsis;
|
|
52
|
-
-webkit-box-orient: vertical;
|
|
53
|
-
-webkit-line-clamp: 2;
|
|
54
|
-
}
|
|
55
|
-
.action-group {
|
|
56
|
-
display: flex;
|
|
57
|
-
align-items: center;
|
|
58
|
-
margin-left: auto;
|
|
59
|
-
padding-right: 0.5rem;
|
|
60
|
-
}
|
|
61
|
-
.action,
|
|
62
|
-
.close-button {
|
|
63
|
-
display: inline-flex;
|
|
64
|
-
align-items: center;
|
|
65
|
-
justify-content: center;
|
|
66
|
-
}
|
|
67
|
-
.action {
|
|
68
|
-
color: rgb(var(--mdui-color-inverse-primary));
|
|
69
|
-
font-size: var(--mdui-typescale-label-large-size);
|
|
70
|
-
font-weight: var(--mdui-typescale-label-large-weight);
|
|
71
|
-
letter-spacing: var(--mdui-typescale-label-large-tracking);
|
|
72
|
-
}
|
|
73
|
-
.action mdui-button,
|
|
74
|
-
::slotted(mdui-button[slot='action'][variant='text']),
|
|
75
|
-
::slotted(mdui-button[slot='action'][variant='outlined']) {
|
|
76
|
-
color: inherit;
|
|
77
|
-
font-size: inherit;
|
|
78
|
-
font-weight: inherit;
|
|
79
|
-
letter-spacing: inherit;
|
|
80
|
-
--mdui-comp-ripple-state-layer-color: var(--mdui-color-inverse-primary);
|
|
81
|
-
}
|
|
82
|
-
.action mdui-button::part(button) {
|
|
83
|
-
padding: 0rem 0.5rem;
|
|
84
|
-
}
|
|
85
|
-
.close-button {
|
|
86
|
-
margin: 0rem -0.25rem 0rem 0.25rem;
|
|
87
|
-
font-size: 1.5rem;
|
|
88
|
-
color: rgb(var(--mdui-color-inverse-on-surface));
|
|
89
|
-
}
|
|
90
|
-
.close-button mdui-button-icon,
|
|
91
|
-
::slotted(mdui-button-icon[slot='close-button'][variant='standard']),
|
|
92
|
-
::slotted(mdui-button-icon[slot='close-button'][variant='outlined']) {
|
|
93
|
-
font-size: inherit;
|
|
94
|
-
color: inherit;
|
|
95
|
-
--mdui-comp-ripple-state-layer-color: var(--mdui-color-inverse-on-surface);
|
|
96
|
-
}
|
|
97
|
-
.close-button .i,
|
|
98
|
-
::slotted([slot='close-icon']) {
|
|
99
|
-
font-size: inherit;
|
|
100
|
-
}
|
|
101
|
-
`;
|
|
2
|
+
export const style = css `:host{--shape-corner:var(--mdui-shape-corner-extra-small);--z-index:2400;position:fixed;z-index:var(--z-index);display:none;align-items:center;flex-wrap:wrap;border-radius:var(--shape-corner);min-width:20rem;max-width:36rem;padding:.25rem 0;box-shadow:var(--mdui-elevation-level3);background-color:rgb(var(--mdui-color-inverse-surface));color:rgb(var(--mdui-color-inverse-on-surface));font-size:var(--mdui-typescale-body-medium-size);font-weight:var(--mdui-typescale-body-medium-weight);letter-spacing:var(--mdui-typescale-body-medium-tracking);line-height:var(--mdui-typescale-body-medium-line-height)}:host([placement^=top]){transform-origin:top;top:1rem}:host([placement^=bottom]){transform-origin:bottom;bottom:1rem}:host([placement=bottom-start]),:host([placement=top-start]){left:1rem}:host([placement=bottom-end]),:host([placement=top-end]){right:1rem}.message{display:block;margin:.625rem 1rem}:host([message-line='1']) .message{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([message-line='2']) .message{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical;-webkit-line-clamp:2}.action-group{display:flex;align-items:center;margin-left:auto;padding-right:.5rem}.action,.close-button{display:inline-flex;align-items:center;justify-content:center}.action{color:rgb(var(--mdui-color-inverse-primary));font-size:var(--mdui-typescale-label-large-size);font-weight:var(--mdui-typescale-label-large-weight);letter-spacing:var(--mdui-typescale-label-large-tracking)}.action mdui-button,::slotted(mdui-button[slot=action][variant=outlined]),::slotted(mdui-button[slot=action][variant=text]){color:inherit;font-size:inherit;font-weight:inherit;letter-spacing:inherit;--mdui-comp-ripple-state-layer-color:var(--mdui-color-inverse-primary)}.action mdui-button::part(button){padding:0 .5rem}.close-button{margin:0 -.25rem 0 .25rem;font-size:1.5rem;color:rgb(var(--mdui-color-inverse-on-surface))}.close-button mdui-button-icon,::slotted(mdui-button-icon[slot=close-button][variant=outlined]),::slotted(mdui-button-icon[slot=close-button][variant=standard]){font-size:inherit;color:inherit;--mdui-comp-ripple-state-layer-color:var(--mdui-color-inverse-on-surface)}.close-button .i,::slotted([slot=close-icon]){font-size:inherit}`;
|
|
@@ -167,50 +167,16 @@ let Switch = class Switch extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
|
167
167
|
this.invalid = !this.inputRef.value.checkValidity();
|
|
168
168
|
}
|
|
169
169
|
render() {
|
|
170
|
-
return html `<label
|
|
171
|
-
class=${classMap({
|
|
170
|
+
return html `<label class="${classMap({
|
|
172
171
|
invalid: this.invalid,
|
|
173
172
|
'has-unchecked-icon': this.uncheckedIcon || this.hasSlotController.test('unchecked-icon'),
|
|
174
|
-
})}
|
|
175
|
-
|
|
176
|
-
<input
|
|
177
|
-
${ref(this.inputRef)}
|
|
178
|
-
type="checkbox"
|
|
179
|
-
name=${ifDefined(this.name)}
|
|
180
|
-
value=${ifDefined(this.value)}
|
|
181
|
-
.disabled=${this.disabled}
|
|
182
|
-
.checked=${live(this.checked)}
|
|
183
|
-
.required=${this.required}
|
|
184
|
-
@change=${this.onChange}
|
|
185
|
-
/>
|
|
186
|
-
<div part="track" class="track">
|
|
187
|
-
<div part="thumb" class="thumb">
|
|
188
|
-
<mdui-ripple
|
|
189
|
-
${ref(this.rippleRef)}
|
|
190
|
-
.noRipple=${this.noRipple}
|
|
191
|
-
></mdui-ripple>
|
|
192
|
-
<slot name="checked-icon" part="checked-icon" class="checked-icon">
|
|
193
|
-
${this.checkedIcon
|
|
194
|
-
? html `<mdui-icon name=${this.checkedIcon} class="i"></mdui-icon>`
|
|
173
|
+
})}"><input ${ref(this.inputRef)} type="checkbox" name="${ifDefined(this.name)}" value="${ifDefined(this.value)}" .disabled="${this.disabled}" .checked="${live(this.checked)}" .required="${this.required}" @change="${this.onChange}"><div part="track" class="track"><div part="thumb" class="thumb"><mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple><slot name="checked-icon" part="checked-icon" class="checked-icon">${this.checkedIcon
|
|
174
|
+
? html `<mdui-icon name="${this.checkedIcon}" class="i"></mdui-icon>`
|
|
195
175
|
: this.checkedIcon === ''
|
|
196
176
|
? nothingTemplate
|
|
197
|
-
: html `<mdui-icon-check class="i"></mdui-icon-check>`}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
name="unchecked-icon"
|
|
201
|
-
part="unchecked-icon"
|
|
202
|
-
class="unchecked-icon"
|
|
203
|
-
>
|
|
204
|
-
${this.uncheckedIcon
|
|
205
|
-
? html `<mdui-icon
|
|
206
|
-
name=${this.uncheckedIcon}
|
|
207
|
-
class="i"
|
|
208
|
-
></mdui-icon>`
|
|
209
|
-
: nothingTemplate}
|
|
210
|
-
</slot>
|
|
211
|
-
</div>
|
|
212
|
-
</div>
|
|
213
|
-
</label>`;
|
|
177
|
+
: html `<mdui-icon-check class="i"></mdui-icon-check>`}</slot><slot name="unchecked-icon" part="unchecked-icon" class="unchecked-icon">${this.uncheckedIcon
|
|
178
|
+
? html `<mdui-icon name="${this.uncheckedIcon}" class="i"></mdui-icon>`
|
|
179
|
+
: nothingTemplate}</slot></div></div></label>`;
|
|
214
180
|
}
|
|
215
181
|
/**
|
|
216
182
|
* input[type="checkbox"] 的 change 事件无法冒泡越过 shadow dom
|