mdui 2.0.1 → 2.0.3
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/LICENSE +21 -21
- package/components/avatar/index.d.ts +4 -2
- package/components/avatar/index.js +4 -2
- package/components/badge/index.d.ts +4 -2
- package/components/badge/index.js +4 -2
- package/components/bottom-app-bar/index.d.ts +9 -3
- package/components/bottom-app-bar/index.js +9 -9
- package/components/button/button-base.d.ts +5 -5
- package/components/button/button-base.js +22 -19
- package/components/button/index.d.ts +6 -1
- package/components/button/index.js +2 -1
- package/components/button-icon/index.d.ts +7 -1
- package/components/button-icon/index.js +3 -3
- package/components/card/index.d.ts +8 -4
- package/components/card/index.js +7 -3
- package/components/checkbox/index.d.ts +10 -3
- package/components/checkbox/index.js +13 -16
- package/components/checkbox/style.js +1 -1
- package/components/chip/index.d.ts +8 -1
- package/components/chip/index.js +5 -5
- package/components/circular-progress/index.d.ts +4 -2
- package/components/circular-progress/index.js +5 -4
- package/components/collapse/collapse-item-style.js +1 -1
- package/components/collapse/collapse-item.d.ts +15 -3
- package/components/collapse/collapse-item.js +26 -23
- package/components/collapse/collapse.d.ts +16 -8
- package/components/collapse/collapse.js +61 -38
- package/components/dialog/index.d.ts +12 -4
- package/components/dialog/index.js +36 -36
- package/components/divider/index.d.ts +4 -2
- package/components/divider/index.js +4 -2
- package/components/dropdown/index.d.ts +13 -7
- package/components/dropdown/index.js +70 -63
- package/components/fab/index.d.ts +7 -1
- package/components/fab/index.js +10 -5
- package/components/icon/index.d.ts +4 -2
- package/components/icon/index.js +4 -2
- package/components/layout/helper.d.ts +5 -6
- package/components/layout/helper.js +42 -48
- package/components/layout/layout-item-base.d.ts +3 -2
- package/components/layout/layout-item-base.js +3 -4
- package/components/layout/layout-item.d.ts +4 -3
- package/components/layout/layout-item.js +3 -3
- package/components/layout/layout-main.d.ts +4 -2
- package/components/layout/layout-main.js +4 -2
- package/components/layout/layout.d.ts +4 -2
- package/components/layout/layout.js +4 -2
- package/components/linear-progress/index.d.ts +4 -2
- package/components/linear-progress/index.js +5 -4
- package/components/list/list-item-style.js +1 -1
- package/components/list/list-item.d.ts +7 -3
- package/components/list/list-item.js +5 -3
- package/components/list/list-subheader.d.ts +4 -2
- package/components/list/list-subheader.js +4 -2
- package/components/list/list.d.ts +4 -2
- package/components/list/list.js +4 -2
- package/components/menu/menu-item.d.ts +12 -3
- package/components/menu/menu-item.js +53 -40
- package/components/menu/menu.d.ts +9 -3
- package/components/menu/menu.js +85 -59
- package/components/navigation-bar/navigation-bar-item-style.js +1 -1
- package/components/navigation-bar/navigation-bar-item.d.ts +13 -5
- package/components/navigation-bar/navigation-bar-item.js +28 -11
- package/components/navigation-bar/navigation-bar.d.ts +14 -7
- package/components/navigation-bar/navigation-bar.js +58 -49
- package/components/navigation-drawer/index.d.ts +13 -2
- package/components/navigation-drawer/index.js +69 -49
- package/components/navigation-drawer/style.js +1 -1
- package/components/navigation-rail/navigation-rail-item-style.js +1 -1
- package/components/navigation-rail/navigation-rail-item.d.ts +13 -5
- package/components/navigation-rail/navigation-rail-item.js +22 -9
- package/components/navigation-rail/navigation-rail.d.ts +8 -6
- package/components/navigation-rail/navigation-rail.js +55 -46
- package/components/radio/radio-group.d.ts +13 -6
- package/components/radio/radio-group.js +69 -59
- package/components/radio/radio-style.js +1 -1
- package/components/radio/radio.d.ts +11 -5
- package/components/radio/radio.js +26 -19
- package/components/range-slider/index.d.ts +9 -3
- package/components/range-slider/index.js +13 -11
- package/components/ripple/index.d.ts +4 -2
- package/components/ripple/index.js +4 -2
- package/components/ripple/ripple-mixin.d.ts +1 -1
- package/components/ripple/ripple-mixin.js +0 -1
- package/components/segmented-button/segmented-button-group-style.js +1 -1
- package/components/segmented-button/segmented-button-group.d.ts +12 -5
- package/components/segmented-button/segmented-button-group.js +92 -77
- package/components/segmented-button/segmented-button.d.ts +8 -3
- package/components/segmented-button/segmented-button.js +5 -4
- package/components/select/index.d.ts +13 -5
- package/components/select/index.js +30 -28
- package/components/slider/index.d.ts +8 -1
- package/components/slider/index.js +11 -18
- package/components/slider/slider-base-style.js +1 -1
- package/components/slider/slider-base.d.ts +7 -3
- package/components/slider/slider-base.js +28 -13
- package/components/snackbar/index.d.ts +9 -2
- package/components/snackbar/index.js +11 -10
- package/components/switch/index.d.ts +10 -3
- package/components/switch/index.js +12 -15
- package/components/switch/style.js +1 -1
- package/components/tabs/tab-panel.d.ts +4 -2
- package/components/tabs/tab-panel.js +4 -2
- package/components/tabs/tab-style.js +1 -1
- package/components/tabs/tab.d.ts +7 -3
- package/components/tabs/tab.js +12 -6
- package/components/tabs/tabs-style.js +1 -1
- package/components/tabs/tabs.d.ts +11 -7
- package/components/tabs/tabs.js +57 -40
- package/components/text-field/index.d.ts +13 -5
- package/components/text-field/index.js +43 -65
- package/components/text-field/style.js +1 -1
- package/components/tooltip/index.d.ts +14 -7
- package/components/tooltip/index.js +45 -38
- package/components/top-app-bar/top-app-bar-title-style.js +1 -1
- package/components/top-app-bar/top-app-bar-title.d.ts +4 -2
- package/components/top-app-bar/top-app-bar-title.js +18 -13
- package/components/top-app-bar/top-app-bar.d.ts +9 -3
- package/components/top-app-bar/top-app-bar.js +11 -10
- package/custom-elements.json +904 -546
- package/functions/getTheme.js +3 -3
- package/functions/snackbar.js +1 -2
- package/functions/utils/colorScheme.js +2 -2
- package/mdui.esm.js +8 -8
- package/mdui.global.js +8 -8
- package/package.json +8 -7
- package/web-types.zh-cn.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
5
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
6
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
5
7
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
6
8
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
7
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
8
9
|
import '@mdui/shared/icons/circle.js';
|
|
9
10
|
import '@mdui/shared/icons/radio-button-unchecked.js';
|
|
10
11
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
@@ -35,7 +36,7 @@ import { radioStyle } from './radio-style.js';
|
|
|
35
36
|
* @csspart checked-icon 选中状态的图标
|
|
36
37
|
* @csspart label - 文本
|
|
37
38
|
*/
|
|
38
|
-
|
|
39
|
+
let Radio = class Radio extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
39
40
|
constructor() {
|
|
40
41
|
super(...arguments);
|
|
41
42
|
/**
|
|
@@ -50,12 +51,16 @@ export let Radio = class Radio extends RippleMixin(FocusableMixin(LitElement)) {
|
|
|
50
51
|
* 当前单选项是否已选中
|
|
51
52
|
*/
|
|
52
53
|
this.checked = false;
|
|
53
|
-
// 是否验证未通过。由 mdui-radio-group 控制该参数
|
|
54
|
+
// 是否验证未通过。由 <mdui-radio-group> 控制该参数
|
|
54
55
|
this.invalid = false;
|
|
55
|
-
// 父组件中是否设置了禁用。由 mdui-radio-group 控制该参数
|
|
56
|
+
// 父组件中是否设置了禁用。由 <mdui-radio-group> 控制该参数
|
|
56
57
|
this.groupDisabled = false;
|
|
57
|
-
//
|
|
58
|
-
|
|
58
|
+
// 是否可聚焦。
|
|
59
|
+
// 单独使用该组件时,默认可聚焦。
|
|
60
|
+
// 如果放在 <mdui-radio-group> 组件中使用,则由 <mdui-radio-group> 控制该参数
|
|
61
|
+
this.focusable = true;
|
|
62
|
+
// 是否是初始状态,不显示动画。由 <mdui-radio-group> 组件控制该参数
|
|
63
|
+
this.isInitial = true;
|
|
59
64
|
this.rippleRef = createRef();
|
|
60
65
|
}
|
|
61
66
|
get rippleElement() {
|
|
@@ -71,12 +76,10 @@ export let Radio = class Radio extends RippleMixin(FocusableMixin(LitElement)) {
|
|
|
71
76
|
return this.isDisabled() || !this.focusable;
|
|
72
77
|
}
|
|
73
78
|
onCheckedChange() {
|
|
74
|
-
|
|
75
|
-
emit(this, 'change');
|
|
76
|
-
}
|
|
79
|
+
this.emit('change');
|
|
77
80
|
}
|
|
78
|
-
|
|
79
|
-
super.
|
|
81
|
+
firstUpdated(_changedProperties) {
|
|
82
|
+
super.firstUpdated(_changedProperties);
|
|
80
83
|
this.addEventListener('click', () => {
|
|
81
84
|
if (!this.isDisabled()) {
|
|
82
85
|
this.checked = true;
|
|
@@ -84,11 +87,15 @@ export let Radio = class Radio extends RippleMixin(FocusableMixin(LitElement)) {
|
|
|
84
87
|
});
|
|
85
88
|
}
|
|
86
89
|
render() {
|
|
87
|
-
|
|
90
|
+
const className = classMap({
|
|
91
|
+
invalid: this.invalid,
|
|
92
|
+
initial: this.isInitial,
|
|
93
|
+
});
|
|
94
|
+
return html `<i part="control" class="${className}"><mdui-ripple ${ref(this.rippleRef)} .noRipple="${this.noRipple}"></mdui-ripple><slot name="unchecked-icon" part="unchecked-icon" class="icon unchecked-icon">${this.uncheckedIcon
|
|
88
95
|
? html `<mdui-icon name="${this.uncheckedIcon}" class="i"></mdui-icon>`
|
|
89
96
|
: html `<mdui-icon-radio-button-unchecked class="i"></mdui-icon-radio-button-unchecked>`}</slot><slot name="checked-icon" part="checked-icon" class="icon checked-icon">${this.checkedIcon
|
|
90
97
|
? html `<mdui-icon name="${this.checkedIcon}" class="i"></mdui-icon>`
|
|
91
|
-
: html `<mdui-icon-circle class="i"></mdui-icon-circle>`}</slot></i><slot part="label" class="label"></slot>`;
|
|
98
|
+
: html `<mdui-icon-circle class="i"></mdui-icon-circle>`}</slot></i><slot part="label" class="label ${className}"></slot>`;
|
|
92
99
|
}
|
|
93
100
|
isDisabled() {
|
|
94
101
|
return this.disabled || this.groupDisabled;
|
|
@@ -119,11 +126,7 @@ __decorate([
|
|
|
119
126
|
property({ reflect: true, attribute: 'checked-icon' })
|
|
120
127
|
], Radio.prototype, "checkedIcon", void 0);
|
|
121
128
|
__decorate([
|
|
122
|
-
|
|
123
|
-
type: Boolean,
|
|
124
|
-
reflect: true,
|
|
125
|
-
converter: booleanConverter,
|
|
126
|
-
})
|
|
129
|
+
state()
|
|
127
130
|
], Radio.prototype, "invalid", void 0);
|
|
128
131
|
__decorate([
|
|
129
132
|
property({
|
|
@@ -136,9 +139,13 @@ __decorate([
|
|
|
136
139
|
__decorate([
|
|
137
140
|
state()
|
|
138
141
|
], Radio.prototype, "focusable", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
state()
|
|
144
|
+
], Radio.prototype, "isInitial", void 0);
|
|
139
145
|
__decorate([
|
|
140
146
|
watch('checked', true)
|
|
141
147
|
], Radio.prototype, "onCheckedChange", null);
|
|
142
148
|
Radio = __decorate([
|
|
143
149
|
customElement('mdui-radio')
|
|
144
150
|
], Radio);
|
|
151
|
+
export { Radio };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { PropertyValues } from 'lit';
|
|
2
1
|
import '@mdui/jq/methods/css.js';
|
|
3
2
|
import { SliderBase } from '../slider/slider-base.js';
|
|
4
3
|
import type { Ripple } from '../ripple/index.js';
|
|
5
4
|
import type { FormControl } from '@mdui/jq/shared/form.js';
|
|
6
|
-
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
5
|
+
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
7
6
|
/**
|
|
8
7
|
* @summary 范围滑块组件
|
|
9
8
|
*
|
|
@@ -23,7 +22,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
23
22
|
* @csspart label - 提示文本
|
|
24
23
|
* @csspart tickmark - 刻度标记
|
|
25
24
|
*/
|
|
26
|
-
export declare class RangeSlider extends SliderBase implements FormControl {
|
|
25
|
+
export declare class RangeSlider extends SliderBase<RangeSliderEventMap> implements FormControl {
|
|
27
26
|
static styles: CSSResultGroup;
|
|
28
27
|
/**
|
|
29
28
|
* 默认值。在重置表单时,将重置为该默认值。该属性只能通过 JavaScript 属性设置
|
|
@@ -60,6 +59,13 @@ export declare class RangeSlider extends SliderBase implements FormControl {
|
|
|
60
59
|
private updateStyle;
|
|
61
60
|
private onInput;
|
|
62
61
|
}
|
|
62
|
+
export interface RangeSliderEventMap {
|
|
63
|
+
focus: FocusEvent;
|
|
64
|
+
blur: FocusEvent;
|
|
65
|
+
change: CustomEvent<void>;
|
|
66
|
+
input: Event;
|
|
67
|
+
invalid: CustomEvent<void>;
|
|
68
|
+
}
|
|
63
69
|
declare global {
|
|
64
70
|
interface HTMLElementTagNameMap {
|
|
65
71
|
'mdui-range-slider': RangeSlider;
|
|
@@ -10,7 +10,6 @@ import { $ } from '@mdui/jq/$.js';
|
|
|
10
10
|
import '@mdui/jq/methods/css.js';
|
|
11
11
|
import { FormController, formResets } from '@mdui/shared/controllers/form.js';
|
|
12
12
|
import { defaultValue } from '@mdui/shared/decorators/default-value.js';
|
|
13
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
14
13
|
import { SliderBase } from '../slider/slider-base.js';
|
|
15
14
|
/**
|
|
16
15
|
* @summary 范围滑块组件
|
|
@@ -31,7 +30,7 @@ import { SliderBase } from '../slider/slider-base.js';
|
|
|
31
30
|
* @csspart label - 提示文本
|
|
32
31
|
* @csspart tickmark - 刻度标记
|
|
33
32
|
*/
|
|
34
|
-
|
|
33
|
+
let RangeSlider = class RangeSlider extends SliderBase {
|
|
35
34
|
constructor() {
|
|
36
35
|
super(...arguments);
|
|
37
36
|
/**
|
|
@@ -66,14 +65,13 @@ export let RangeSlider = class RangeSlider extends SliderBase {
|
|
|
66
65
|
}
|
|
67
66
|
set value(_value) {
|
|
68
67
|
const oldValue = [...this._value];
|
|
69
|
-
this._value = _value;
|
|
68
|
+
this._value = [this.fixValue(_value[0]), this.fixValue(_value[1])];
|
|
70
69
|
this.requestUpdate('value', oldValue);
|
|
71
70
|
this.updateComplete.then(() => {
|
|
72
|
-
var _a;
|
|
73
71
|
this.updateStyle();
|
|
74
72
|
// reset 引起的值变更,不执行验证;直接修改值引起的变更,需要进行验证
|
|
75
73
|
const form = this.formController.getForm();
|
|
76
|
-
if (form &&
|
|
74
|
+
if (form && formResets.get(form)?.has(this)) {
|
|
77
75
|
this.invalid = false;
|
|
78
76
|
formResets.get(form).delete(this);
|
|
79
77
|
}
|
|
@@ -87,10 +85,17 @@ export let RangeSlider = class RangeSlider extends SliderBase {
|
|
|
87
85
|
}
|
|
88
86
|
connectedCallback() {
|
|
89
87
|
super.connectedCallback();
|
|
90
|
-
this.value
|
|
88
|
+
if (!this.value.length) {
|
|
89
|
+
this.value = [this.min, this.max];
|
|
90
|
+
}
|
|
91
|
+
this.value[0] = this.fixValue(this.value[0]);
|
|
92
|
+
this.value[1] = this.fixValue(this.value[1]);
|
|
91
93
|
if (!this.defaultValue.length) {
|
|
92
94
|
this.defaultValue = [...this.value];
|
|
93
95
|
}
|
|
96
|
+
}
|
|
97
|
+
firstUpdated(changedProperties) {
|
|
98
|
+
super.firstUpdated(changedProperties);
|
|
94
99
|
// 在轨道上点击时,计算出点击位置在 <input type="range"> 元素上的值
|
|
95
100
|
// 若该值在 this.value 的两个值中间位置的左侧,则表示操作的是左侧的值,否则操作的是右侧的值
|
|
96
101
|
const getCurrentHandle = (event) => {
|
|
@@ -132,9 +137,6 @@ export let RangeSlider = class RangeSlider extends SliderBase {
|
|
|
132
137
|
this.startHover(event);
|
|
133
138
|
}
|
|
134
139
|
});
|
|
135
|
-
}
|
|
136
|
-
firstUpdated(changedProperties) {
|
|
137
|
-
super.firstUpdated(changedProperties);
|
|
138
140
|
this.updateStyle();
|
|
139
141
|
}
|
|
140
142
|
/**
|
|
@@ -142,7 +144,7 @@ export let RangeSlider = class RangeSlider extends SliderBase {
|
|
|
142
144
|
* <input class="invalid" /> 用于提供 html5 自带的表单错误提示
|
|
143
145
|
*/
|
|
144
146
|
render() {
|
|
145
|
-
return html `<label><input ${ref(this.inputRef)} type="range" step="${this.step}" min="${this.min}" max="${this.max}" ?disabled="${this.disabled}" @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.handleStartRef)} part="handle" class="handle start" style="${styleMap({
|
|
147
|
+
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}" @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.handleStartRef)} part="handle" class="handle start" style="${styleMap({
|
|
146
148
|
'z-index': this.currentHandle === 'start' ? '2' : '1',
|
|
147
149
|
})}"><div class="elevation"></div><mdui-ripple ${ref(this.rippleStartRef)} .noRipple="${this.noRipple}"></mdui-ripple>${this.renderLabel(this.value[0])}</div><div ${ref(this.handleEndRef)} part="handle" class="handle end" style="${styleMap({
|
|
148
150
|
'z-index': this.currentHandle === 'end' ? '2' : '1',
|
|
@@ -170,7 +172,6 @@ export let RangeSlider = class RangeSlider extends SliderBase {
|
|
|
170
172
|
const startValue = this.value[0];
|
|
171
173
|
const endValue = this.value[1];
|
|
172
174
|
const doInput = () => {
|
|
173
|
-
emit(this, 'input');
|
|
174
175
|
this.updateStyle();
|
|
175
176
|
};
|
|
176
177
|
if (isStart) {
|
|
@@ -208,3 +209,4 @@ __decorate([
|
|
|
208
209
|
RangeSlider = __decorate([
|
|
209
210
|
customElement('mdui-range-slider')
|
|
210
211
|
], RangeSlider);
|
|
212
|
+
export { RangeSlider };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import '@mdui/jq/methods/addClass.js';
|
|
3
2
|
import '@mdui/jq/methods/children.js';
|
|
4
3
|
import '@mdui/jq/methods/css.js';
|
|
@@ -11,13 +10,14 @@ import '@mdui/jq/methods/offset.js';
|
|
|
11
10
|
import '@mdui/jq/methods/on.js';
|
|
12
11
|
import '@mdui/jq/methods/prependTo.js';
|
|
13
12
|
import '@mdui/jq/methods/remove.js';
|
|
13
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
14
14
|
import type { TemplateResult, CSSResultGroup } from 'lit';
|
|
15
15
|
/**
|
|
16
16
|
* 处理点击时的涟漪动画;及添加 hover、focused、dragged 的背景色
|
|
17
17
|
* 背景色通过在 .surface 元素上添加对应的 class 实现
|
|
18
18
|
* 阴影在 ripple-mixin 中处理,通过在 :host 元素上添加 attribute 供 CSS 选择器添加样式
|
|
19
19
|
*/
|
|
20
|
-
export declare class Ripple extends
|
|
20
|
+
export declare class Ripple extends MduiElement<RippleEventMap> {
|
|
21
21
|
static styles: CSSResultGroup;
|
|
22
22
|
/**
|
|
23
23
|
* 是否禁用涟漪动画
|
|
@@ -37,6 +37,8 @@ export declare class Ripple extends LitElement {
|
|
|
37
37
|
endDrag(): void;
|
|
38
38
|
protected render(): TemplateResult;
|
|
39
39
|
}
|
|
40
|
+
export interface RippleEventMap {
|
|
41
|
+
}
|
|
40
42
|
declare global {
|
|
41
43
|
interface HTMLElementTagNameMap {
|
|
42
44
|
'mdui-ripple': Ripple;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
4
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
@@ -16,6 +16,7 @@ import '@mdui/jq/methods/offset.js';
|
|
|
16
16
|
import '@mdui/jq/methods/on.js';
|
|
17
17
|
import '@mdui/jq/methods/prependTo.js';
|
|
18
18
|
import '@mdui/jq/methods/remove.js';
|
|
19
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
19
20
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
20
21
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
21
22
|
import { style } from './style.js';
|
|
@@ -24,7 +25,7 @@ import { style } from './style.js';
|
|
|
24
25
|
* 背景色通过在 .surface 元素上添加对应的 class 实现
|
|
25
26
|
* 阴影在 ripple-mixin 中处理,通过在 :host 元素上添加 attribute 供 CSS 选择器添加样式
|
|
26
27
|
*/
|
|
27
|
-
|
|
28
|
+
let Ripple = class Ripple extends MduiElement {
|
|
28
29
|
constructor() {
|
|
29
30
|
super(...arguments);
|
|
30
31
|
/**
|
|
@@ -171,3 +172,4 @@ __decorate([
|
|
|
171
172
|
Ripple = __decorate([
|
|
172
173
|
customElement('mdui-ripple')
|
|
173
174
|
], Ripple);
|
|
175
|
+
export { Ripple };
|
|
@@ -3,7 +3,7 @@ import './index.js';
|
|
|
3
3
|
import type { Ripple } from './index.js';
|
|
4
4
|
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
5
5
|
import type { LitElement } from 'lit';
|
|
6
|
-
export declare class RippleMixinInterface
|
|
6
|
+
export declare class RippleMixinInterface {
|
|
7
7
|
noRipple: boolean;
|
|
8
8
|
protected getRippleIndex: () => number | undefined;
|
|
9
9
|
protected get rippleElement(): Ripple | Ripple[] | NodeListOf<Ripple>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const segmentedButtonGroupStyle = css `:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-flex;height:2.5rem;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);color:rgb(var(--mdui-color-on-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([full-width]){display:flex;flex-wrap:nowrap}input,select{position:absolute;width:100%;height:100%;padding:0;opacity:0;pointer-events:none}`;
|
|
2
|
+
export const segmentedButtonGroupStyle = css `:host{--shape-corner:var(--mdui-shape-corner-full);position:relative;display:inline-flex;vertical-align:middle;height:2.5rem;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);color:rgb(var(--mdui-color-on-surface));--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([full-width]){display:flex;flex-wrap:nowrap}input,select{position:absolute;width:100%;height:100%;padding:0;opacity:0;pointer-events:none}`;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import '@mdui/jq/methods/find.js';
|
|
3
2
|
import '@mdui/jq/methods/get.js';
|
|
3
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
4
4
|
import type { FormControl } from '@mdui/jq/shared/form.js';
|
|
5
5
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
6
6
|
/**
|
|
@@ -21,7 +21,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
21
21
|
*
|
|
22
22
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
23
23
|
*/
|
|
24
|
-
export declare class SegmentedButtonGroup extends
|
|
24
|
+
export declare class SegmentedButtonGroup extends MduiElement<SegmentedButtonGroupEventMap> implements FormControl {
|
|
25
25
|
static styles: CSSResultGroup;
|
|
26
26
|
/**
|
|
27
27
|
* 是否填满父元素宽度
|
|
@@ -70,9 +70,10 @@ export declare class SegmentedButtonGroup extends LitElement implements FormCont
|
|
|
70
70
|
* 是否验证未通过
|
|
71
71
|
*/
|
|
72
72
|
private invalid;
|
|
73
|
-
private
|
|
73
|
+
private isInitial;
|
|
74
74
|
private readonly inputRef;
|
|
75
75
|
private readonly formController;
|
|
76
|
+
private readonly definedController;
|
|
76
77
|
/**
|
|
77
78
|
* 表单验证状态对象
|
|
78
79
|
*/
|
|
@@ -90,7 +91,6 @@ export declare class SegmentedButtonGroup extends LitElement implements FormCont
|
|
|
90
91
|
private onSelectedKeysChange;
|
|
91
92
|
private onValueChange;
|
|
92
93
|
private onInvalidChange;
|
|
93
|
-
private onDisabledChange;
|
|
94
94
|
connectedCallback(): void;
|
|
95
95
|
/**
|
|
96
96
|
* 检查表单字段是否验证通过。若未通过则返回 `false`,并触发 `invalid` 事件;若验证通过,则返回 `true`
|
|
@@ -109,14 +109,21 @@ export declare class SegmentedButtonGroup extends LitElement implements FormCont
|
|
|
109
109
|
*/
|
|
110
110
|
setCustomValidity(message: string): void;
|
|
111
111
|
protected render(): TemplateResult;
|
|
112
|
-
private updateSelected;
|
|
113
112
|
private selectOne;
|
|
114
113
|
private onClick;
|
|
115
114
|
/**
|
|
116
115
|
* 在隐藏的 `<input>` 或 `<select>` 上按下按键时,切换选中状态
|
|
116
|
+
* 通常为验证不通过时,默认聚焦到 `<input>` 或 `<select>` 上,此时按下按键,切换第一个元素的选中状态
|
|
117
117
|
*/
|
|
118
118
|
private onInputKeyDown;
|
|
119
119
|
private onSlotChange;
|
|
120
|
+
private setSelectedKeys;
|
|
121
|
+
private setValue;
|
|
122
|
+
private updateItems;
|
|
123
|
+
}
|
|
124
|
+
export interface SegmentedButtonGroupEventMap {
|
|
125
|
+
change: CustomEvent<void>;
|
|
126
|
+
invalid: CustomEvent<void>;
|
|
120
127
|
}
|
|
121
128
|
declare global {
|
|
122
129
|
interface HTMLElementTagNameMap {
|