mdui 2.0.2 → 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/components/avatar/index.d.ts +4 -2
- package/components/avatar/index.js +3 -2
- package/components/badge/index.d.ts +4 -2
- package/components/badge/index.js +3 -2
- package/components/bottom-app-bar/index.d.ts +7 -1
- package/components/bottom-app-bar/index.js +5 -6
- package/components/button/button-base.d.ts +3 -3
- package/components/button/button-base.js +7 -5
- package/components/button/index.d.ts +6 -1
- package/components/button-icon/index.d.ts +7 -1
- package/components/button-icon/index.js +1 -2
- package/components/card/index.d.ts +7 -3
- package/components/card/index.js +3 -2
- package/components/checkbox/index.d.ts +10 -3
- package/components/checkbox/index.js +7 -7
- package/components/chip/index.d.ts +8 -1
- package/components/chip/index.js +3 -4
- package/components/circular-progress/index.d.ts +4 -2
- package/components/circular-progress/index.js +3 -2
- package/components/collapse/collapse-item.d.ts +13 -2
- package/components/collapse/collapse-item.js +5 -5
- package/components/collapse/collapse.d.ts +10 -2
- package/components/collapse/collapse.js +6 -6
- package/components/dialog/index.d.ts +9 -2
- package/components/dialog/index.js +10 -14
- package/components/divider/index.d.ts +4 -2
- package/components/divider/index.js +3 -2
- package/components/dropdown/index.d.ts +9 -2
- package/components/dropdown/index.js +17 -15
- package/components/fab/index.d.ts +6 -1
- package/components/icon/index.d.ts +4 -2
- package/components/icon/index.js +3 -2
- package/components/layout/layout-item-base.d.ts +3 -2
- package/components/layout/layout-item-base.js +2 -2
- package/components/layout/layout-item.d.ts +4 -3
- package/components/layout/layout-main.d.ts +4 -2
- package/components/layout/layout-main.js +3 -2
- package/components/layout/layout.d.ts +4 -2
- package/components/layout/layout.js +3 -2
- package/components/linear-progress/index.d.ts +4 -2
- package/components/linear-progress/index.js +3 -2
- package/components/list/list-item-style.js +1 -1
- package/components/list/list-item.d.ts +7 -3
- package/components/list/list-item.js +3 -2
- package/components/list/list-subheader.d.ts +4 -2
- package/components/list/list-subheader.js +3 -2
- package/components/list/list.d.ts +4 -2
- package/components/list/list.js +3 -2
- package/components/menu/menu-item.d.ts +11 -3
- package/components/menu/menu-item.js +9 -13
- package/components/menu/menu.d.ts +5 -2
- package/components/menu/menu.js +5 -5
- package/components/navigation-bar/navigation-bar-item.d.ts +7 -3
- package/components/navigation-bar/navigation-bar-item.js +3 -2
- package/components/navigation-bar/navigation-bar.d.ts +8 -1
- package/components/navigation-bar/navigation-bar.js +9 -7
- package/components/navigation-drawer/index.d.ts +8 -1
- package/components/navigation-drawer/index.js +7 -8
- package/components/navigation-drawer/style.js +1 -1
- package/components/navigation-rail/navigation-rail-item.d.ts +7 -3
- package/components/navigation-rail/navigation-rail-item.js +3 -2
- package/components/navigation-rail/navigation-rail.d.ts +4 -1
- package/components/navigation-rail/navigation-rail.js +4 -2
- package/components/radio/radio-group.d.ts +7 -2
- package/components/radio/radio-group.js +10 -13
- package/components/radio/radio.d.ts +8 -3
- package/components/radio/radio.js +4 -4
- package/components/range-slider/index.d.ts +9 -3
- package/components/range-slider/index.js +6 -2
- package/components/ripple/index.d.ts +4 -2
- package/components/ripple/index.js +3 -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 +6 -2
- package/components/segmented-button/segmented-button-group.js +9 -9
- package/components/segmented-button/segmented-button.d.ts +6 -1
- package/components/select/index.d.ts +11 -3
- package/components/select/index.js +5 -5
- package/components/slider/index.d.ts +8 -1
- package/components/slider/index.js +4 -9
- package/components/slider/slider-base.d.ts +7 -3
- package/components/slider/slider-base.js +27 -8
- package/components/snackbar/index.d.ts +9 -2
- package/components/snackbar/index.js +10 -10
- package/components/switch/index.d.ts +10 -3
- package/components/switch/index.js +7 -7
- package/components/tabs/tab-panel.d.ts +4 -2
- package/components/tabs/tab-panel.js +3 -2
- package/components/tabs/tab.d.ts +7 -3
- package/components/tabs/tab.js +3 -2
- package/components/tabs/tabs.d.ts +5 -2
- package/components/tabs/tabs.js +7 -4
- package/components/text-field/index.d.ts +11 -3
- package/components/text-field/index.js +12 -12
- package/components/tooltip/index.d.ts +9 -2
- package/components/tooltip/index.js +17 -15
- package/components/top-app-bar/top-app-bar-title.d.ts +4 -2
- package/components/top-app-bar/top-app-bar-title.js +3 -2
- package/components/top-app-bar/top-app-bar.d.ts +7 -1
- package/components/top-app-bar/top-app-bar.js +5 -6
- package/custom-elements.json +2954 -2891
- package/html-data.zh-cn.json +439 -439
- package/mdui.esm.js +8 -8
- package/mdui.global.js +8 -8
- package/package.json +3 -2
- package/web-types.zh-cn.json +765 -765
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import '@mdui/shared/icons/clear.js';
|
|
3
3
|
import '../button-icon.js';
|
|
4
4
|
import '../button.js';
|
|
@@ -30,7 +30,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
30
30
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
31
31
|
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
32
32
|
*/
|
|
33
|
-
export declare class Snackbar extends
|
|
33
|
+
export declare class Snackbar extends MduiElement<SnackbarEventMap> {
|
|
34
34
|
static styles: CSSResultGroup;
|
|
35
35
|
/**
|
|
36
36
|
* 是否显示 Snackbar
|
|
@@ -91,6 +91,13 @@ export declare class Snackbar extends LitElement {
|
|
|
91
91
|
private onActionClick;
|
|
92
92
|
private onCloseClick;
|
|
93
93
|
}
|
|
94
|
+
export interface SnackbarEventMap {
|
|
95
|
+
open: CustomEvent<void>;
|
|
96
|
+
opened: CustomEvent<void>;
|
|
97
|
+
close: CustomEvent<void>;
|
|
98
|
+
closed: CustomEvent<void>;
|
|
99
|
+
'action-click': CustomEvent<void>;
|
|
100
|
+
}
|
|
94
101
|
declare global {
|
|
95
102
|
interface HTMLElementTagNameMap {
|
|
96
103
|
'mdui-snackbar': Snackbar;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import { when } from 'lit/directives/when.js';
|
|
5
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
5
6
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
6
7
|
import { animateTo, stopAnimations } from '@mdui/shared/helpers/animate.js';
|
|
7
8
|
import { breakpoint } from '@mdui/shared/helpers/breakpoint.js';
|
|
8
9
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
9
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
10
10
|
import { getDuration, getEasing } from '@mdui/shared/helpers/motion.js';
|
|
11
11
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
12
12
|
import '@mdui/shared/icons/clear.js';
|
|
@@ -41,7 +41,7 @@ import { style } from './style.js';
|
|
|
41
41
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
42
42
|
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
43
43
|
*/
|
|
44
|
-
let Snackbar = class Snackbar extends
|
|
44
|
+
let Snackbar = class Snackbar extends MduiElement {
|
|
45
45
|
constructor() {
|
|
46
46
|
super();
|
|
47
47
|
/**
|
|
@@ -97,8 +97,8 @@ let Snackbar = class Snackbar extends LitElement {
|
|
|
97
97
|
await this.updateComplete;
|
|
98
98
|
}
|
|
99
99
|
if (hasUpdated) {
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
100
|
+
const eventProceeded = this.emit('open', { cancelable: true });
|
|
101
|
+
if (!eventProceeded) {
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
}
|
|
@@ -155,14 +155,14 @@ let Snackbar = class Snackbar extends LitElement {
|
|
|
155
155
|
})),
|
|
156
156
|
]);
|
|
157
157
|
if (hasUpdated) {
|
|
158
|
-
emit(
|
|
158
|
+
this.emit('opened');
|
|
159
159
|
}
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
162
|
// 关闭
|
|
163
163
|
if (!this.open && this.hasUpdated) {
|
|
164
|
-
const
|
|
165
|
-
if (
|
|
164
|
+
const eventProceeded = this.emit('close', { cancelable: true });
|
|
165
|
+
if (!eventProceeded) {
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
window.clearTimeout(this.closeTimeout);
|
|
@@ -191,7 +191,7 @@ let Snackbar = class Snackbar extends LitElement {
|
|
|
191
191
|
...children.map((child) => animateTo(child, [{ opacity: 1 }, { opacity: 0, offset: 0.75 }, { opacity: 0 }], { duration, easing: easingLinear })),
|
|
192
192
|
]);
|
|
193
193
|
this.style.display = 'none';
|
|
194
|
-
emit(
|
|
194
|
+
this.emit('closed');
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
@@ -224,7 +224,7 @@ let Snackbar = class Snackbar extends LitElement {
|
|
|
224
224
|
}
|
|
225
225
|
onActionClick(event) {
|
|
226
226
|
event.stopPropagation();
|
|
227
|
-
emit(
|
|
227
|
+
this.emit('action-click');
|
|
228
228
|
}
|
|
229
229
|
onCloseClick() {
|
|
230
230
|
this.open = false;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import '@mdui/shared/icons/check.js';
|
|
3
3
|
import '../icon.js';
|
|
4
4
|
import type { Ripple } from '../ripple/index.js';
|
|
5
5
|
import type { FormControl } from '@mdui/jq/shared/form.js';
|
|
6
6
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
7
|
-
declare const Switch_base: import("@open-wc/dedupe-mixin").Constructor<import("../ripple/ripple-mixin.js").RippleMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/focusable.js").FocusableMixinInterface> & typeof
|
|
7
|
+
declare const Switch_base: import("@open-wc/dedupe-mixin").Constructor<import("../ripple/ripple-mixin.js").RippleMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/focusable.js").FocusableMixinInterface> & typeof MduiElement;
|
|
8
8
|
/**
|
|
9
9
|
* @summary 开关切换组件
|
|
10
10
|
*
|
|
@@ -29,7 +29,7 @@ declare const Switch_base: import("@open-wc/dedupe-mixin").Constructor<import(".
|
|
|
29
29
|
* @cssprop --shape-corner - 组件的轨道的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
30
30
|
* @cssprop --shape-corner-thumb - 组件的图标容器的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
31
31
|
*/
|
|
32
|
-
export declare class Switch extends Switch_base implements FormControl {
|
|
32
|
+
export declare class Switch extends Switch_base<SwitchEventMap> implements FormControl {
|
|
33
33
|
static styles: CSSResultGroup;
|
|
34
34
|
/**
|
|
35
35
|
* 是否为禁用状态
|
|
@@ -115,6 +115,13 @@ export declare class Switch extends Switch_base implements FormControl {
|
|
|
115
115
|
*/
|
|
116
116
|
private onChange;
|
|
117
117
|
}
|
|
118
|
+
export interface SwitchEventMap {
|
|
119
|
+
focus: FocusEvent;
|
|
120
|
+
blur: FocusEvent;
|
|
121
|
+
change: CustomEvent<void>;
|
|
122
|
+
input: Event;
|
|
123
|
+
invalid: CustomEvent<void>;
|
|
124
|
+
}
|
|
118
125
|
declare global {
|
|
119
126
|
interface HTMLElementTagNameMap {
|
|
120
127
|
'mdui-switch': Switch;
|
|
@@ -1,16 +1,16 @@
|
|
|
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
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
6
|
import { live } from 'lit/directives/live.js';
|
|
7
7
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
8
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
8
9
|
import { FormController, formResets } from '@mdui/shared/controllers/form.js';
|
|
9
10
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
10
11
|
import { defaultValue } from '@mdui/shared/decorators/default-value.js';
|
|
11
12
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
12
13
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
13
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
14
14
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
15
15
|
import '@mdui/shared/icons/check.js';
|
|
16
16
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
@@ -42,7 +42,7 @@ import { style } from './style.js';
|
|
|
42
42
|
* @cssprop --shape-corner - 组件的轨道的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
43
43
|
* @cssprop --shape-corner-thumb - 组件的图标容器的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
44
44
|
*/
|
|
45
|
-
let Switch = class Switch extends RippleMixin(FocusableMixin(
|
|
45
|
+
let Switch = class Switch extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
46
46
|
constructor() {
|
|
47
47
|
super(...arguments);
|
|
48
48
|
/**
|
|
@@ -128,7 +128,7 @@ let Switch = class Switch extends RippleMixin(FocusableMixin(LitElement)) {
|
|
|
128
128
|
checkValidity() {
|
|
129
129
|
const valid = this.inputRef.value.checkValidity();
|
|
130
130
|
if (!valid) {
|
|
131
|
-
emit(
|
|
131
|
+
this.emit('invalid', {
|
|
132
132
|
bubbles: false,
|
|
133
133
|
cancelable: true,
|
|
134
134
|
composed: false,
|
|
@@ -144,13 +144,13 @@ let Switch = class Switch extends RippleMixin(FocusableMixin(LitElement)) {
|
|
|
144
144
|
reportValidity() {
|
|
145
145
|
this.invalid = !this.inputRef.value.reportValidity();
|
|
146
146
|
if (this.invalid) {
|
|
147
|
-
const
|
|
147
|
+
const eventProceeded = this.emit('invalid', {
|
|
148
148
|
bubbles: false,
|
|
149
149
|
cancelable: true,
|
|
150
150
|
composed: false,
|
|
151
151
|
});
|
|
152
152
|
// 调用了 preventDefault() 时,隐藏默认的表单错误提示
|
|
153
|
-
if (
|
|
153
|
+
if (!eventProceeded) {
|
|
154
154
|
this.blur();
|
|
155
155
|
this.focus();
|
|
156
156
|
}
|
|
@@ -183,7 +183,7 @@ let Switch = class Switch extends RippleMixin(FocusableMixin(LitElement)) {
|
|
|
183
183
|
*/
|
|
184
184
|
onChange() {
|
|
185
185
|
this.checked = this.inputRef.value.checked;
|
|
186
|
-
emit(
|
|
186
|
+
this.emit('change');
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
Switch.styles = [componentStyle, style];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary 选项卡面板项组件。需与 `<mdui-tabs>` 和 `<mdui-tab>` 组件配合使用
|
|
@@ -17,7 +17,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
17
17
|
*
|
|
18
18
|
* @slot - 选项卡面板内容
|
|
19
19
|
*/
|
|
20
|
-
export declare class TabPanel extends
|
|
20
|
+
export declare class TabPanel extends MduiElement<TabPanelEventMap> {
|
|
21
21
|
static styles: CSSResultGroup;
|
|
22
22
|
/**
|
|
23
23
|
* 该选项卡面板的值
|
|
@@ -29,6 +29,8 @@ export declare class TabPanel extends LitElement {
|
|
|
29
29
|
protected active: boolean;
|
|
30
30
|
protected render(): TemplateResult;
|
|
31
31
|
}
|
|
32
|
+
export interface TabPanelEventMap {
|
|
33
|
+
}
|
|
32
34
|
declare global {
|
|
33
35
|
interface HTMLElementTagNameMap {
|
|
34
36
|
'mdui-tab-panel': TabPanel;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
4
5
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
5
6
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
6
7
|
import { tabPanelStyle } from './tab-panel-style.js';
|
|
@@ -21,7 +22,7 @@ import { tabPanelStyle } from './tab-panel-style.js';
|
|
|
21
22
|
*
|
|
22
23
|
* @slot - 选项卡面板内容
|
|
23
24
|
*/
|
|
24
|
-
let TabPanel = class TabPanel extends
|
|
25
|
+
let TabPanel = class TabPanel extends MduiElement {
|
|
25
26
|
constructor() {
|
|
26
27
|
super(...arguments);
|
|
27
28
|
/**
|
package/components/tabs/tab.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import '../icon.js';
|
|
3
3
|
import type { Ripple } from '../ripple/index.js';
|
|
4
4
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
5
|
-
declare const Tab_base: import("@open-wc/dedupe-mixin").Constructor<import("../ripple/ripple-mixin.js").RippleMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/focusable.js").FocusableMixinInterface> & typeof
|
|
5
|
+
declare const Tab_base: import("@open-wc/dedupe-mixin").Constructor<import("../ripple/ripple-mixin.js").RippleMixinInterface> & import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/focusable.js").FocusableMixinInterface> & typeof MduiElement;
|
|
6
6
|
/**
|
|
7
7
|
* @summary 选项卡项组件。需与 `<mdui-tabs>` 和 `<mdui-tab-panel>` 组件配合使用
|
|
8
8
|
*
|
|
@@ -30,7 +30,7 @@ declare const Tab_base: import("@open-wc/dedupe-mixin").Constructor<import("../r
|
|
|
30
30
|
* @csspart icon - 导航项中的图标
|
|
31
31
|
* @csspart label - 导航项的文本
|
|
32
32
|
*/
|
|
33
|
-
export declare class Tab extends Tab_base {
|
|
33
|
+
export declare class Tab extends Tab_base<TabEventMap> {
|
|
34
34
|
static styles: CSSResultGroup;
|
|
35
35
|
/**
|
|
36
36
|
* 该选项卡导航项的值
|
|
@@ -61,6 +61,10 @@ export declare class Tab extends Tab_base {
|
|
|
61
61
|
protected get focusDisabled(): boolean;
|
|
62
62
|
protected render(): TemplateResult;
|
|
63
63
|
}
|
|
64
|
+
export interface TabEventMap {
|
|
65
|
+
focus: FocusEvent;
|
|
66
|
+
blur: FocusEvent;
|
|
67
|
+
}
|
|
64
68
|
declare global {
|
|
65
69
|
interface HTMLElementTagNameMap {
|
|
66
70
|
'mdui-tab': Tab;
|
package/components/tabs/tab.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
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
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
6
6
|
import { when } from 'lit/directives/when.js';
|
|
7
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
7
8
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
8
9
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
9
10
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
@@ -40,7 +41,7 @@ import { tabStyle } from './tab-style.js';
|
|
|
40
41
|
* @csspart icon - 导航项中的图标
|
|
41
42
|
* @csspart label - 导航项的文本
|
|
42
43
|
*/
|
|
43
|
-
let Tab = class Tab extends RippleMixin(FocusableMixin(
|
|
44
|
+
let Tab = class Tab extends RippleMixin(FocusableMixin(MduiElement)) {
|
|
44
45
|
constructor() {
|
|
45
46
|
super(...arguments);
|
|
46
47
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import '@mdui/jq/methods/children.js';
|
|
3
2
|
import '@mdui/jq/methods/css.js';
|
|
4
3
|
import '@mdui/jq/methods/find.js';
|
|
5
4
|
import '@mdui/jq/methods/get.js';
|
|
5
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
6
6
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
7
7
|
/**
|
|
8
8
|
* @summary 选项卡组件。需与 `<mdui-tab>` 和 `<mdui-tab-panel>` 组件配合使用
|
|
@@ -27,7 +27,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
27
27
|
* @csspart container - `<mdui-tab>` 元素的容器
|
|
28
28
|
* @csspart indicator - 激活状态指示器
|
|
29
29
|
*/
|
|
30
|
-
export declare class Tabs extends
|
|
30
|
+
export declare class Tabs extends MduiElement<TabsEventMap> {
|
|
31
31
|
static styles: CSSResultGroup;
|
|
32
32
|
/**
|
|
33
33
|
* 选项卡形状。可选值为:
|
|
@@ -81,6 +81,9 @@ export declare class Tabs extends LitElement {
|
|
|
81
81
|
private updateActive;
|
|
82
82
|
private updateIndicator;
|
|
83
83
|
}
|
|
84
|
+
export interface TabsEventMap {
|
|
85
|
+
change: CustomEvent<void>;
|
|
86
|
+
}
|
|
84
87
|
declare global {
|
|
85
88
|
interface HTMLElementTagNameMap {
|
|
86
89
|
'mdui-tabs': Tabs;
|
package/components/tabs/tabs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property, queryAssignedElements, 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';
|
|
@@ -8,10 +8,10 @@ import '@mdui/jq/methods/children.js';
|
|
|
8
8
|
import '@mdui/jq/methods/css.js';
|
|
9
9
|
import '@mdui/jq/methods/find.js';
|
|
10
10
|
import '@mdui/jq/methods/get.js';
|
|
11
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
11
12
|
import { DefinedController } from '@mdui/shared/controllers/defined.js';
|
|
12
13
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
13
14
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
14
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
15
15
|
import { observeResize } from '@mdui/shared/helpers/observeResize.js';
|
|
16
16
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
17
17
|
import { tabsStyle } from './tabs-style.js';
|
|
@@ -38,7 +38,7 @@ import { tabsStyle } from './tabs-style.js';
|
|
|
38
38
|
* @csspart container - `<mdui-tab>` 元素的容器
|
|
39
39
|
* @csspart indicator - 激活状态指示器
|
|
40
40
|
*/
|
|
41
|
-
let Tabs = class Tabs extends
|
|
41
|
+
let Tabs = class Tabs extends MduiElement {
|
|
42
42
|
constructor() {
|
|
43
43
|
super(...arguments);
|
|
44
44
|
/**
|
|
@@ -85,7 +85,7 @@ let Tabs = class Tabs extends LitElement {
|
|
|
85
85
|
this.value = this.tabs.find((tab) => tab.key === this.activeKey)?.value;
|
|
86
86
|
this.updateActive();
|
|
87
87
|
if (!this.isInitial) {
|
|
88
|
-
emit(
|
|
88
|
+
this.emit('change');
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
async onValueChange() {
|
|
@@ -121,6 +121,9 @@ let Tabs = class Tabs extends LitElement {
|
|
|
121
121
|
await this.definedController.whenDefined();
|
|
122
122
|
const target = event.target;
|
|
123
123
|
const tab = target.closest('mdui-tab');
|
|
124
|
+
if (!tab) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
124
127
|
this.activeKey = tab.key;
|
|
125
128
|
this.isInitial = false;
|
|
126
129
|
this.updateActive();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import '@mdui/jq/methods/css.js';
|
|
2
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
3
3
|
import '@mdui/shared/icons/cancel--outlined.js';
|
|
4
4
|
import '@mdui/shared/icons/error.js';
|
|
5
5
|
import '@mdui/shared/icons/visibility-off.js';
|
|
@@ -8,7 +8,7 @@ import '../button-icon.js';
|
|
|
8
8
|
import '../icon.js';
|
|
9
9
|
import type { FormControl } from '@mdui/jq/shared/form.js';
|
|
10
10
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
11
|
-
declare const TextField_base: import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/focusable.js").FocusableMixinInterface> & typeof
|
|
11
|
+
declare const TextField_base: import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/focusable.js").FocusableMixinInterface> & typeof MduiElement;
|
|
12
12
|
/**
|
|
13
13
|
* @summary 文本框组件
|
|
14
14
|
*
|
|
@@ -53,7 +53,7 @@ declare const TextField_base: import("@open-wc/dedupe-mixin").Constructor<import
|
|
|
53
53
|
* @csspart error - 底部的错误描述文本
|
|
54
54
|
* @csspart counter - 底部右侧的字数统计
|
|
55
55
|
*/
|
|
56
|
-
export declare class TextField extends TextField_base implements FormControl {
|
|
56
|
+
export declare class TextField extends TextField_base<TextFieldEventMap> implements FormControl {
|
|
57
57
|
static styles: CSSResultGroup;
|
|
58
58
|
/**
|
|
59
59
|
* 文本框形状。默认为 `filled`。可选值为:
|
|
@@ -392,6 +392,14 @@ export declare class TextField extends TextField_base implements FormControl {
|
|
|
392
392
|
private renderHelper;
|
|
393
393
|
private renderCounter;
|
|
394
394
|
}
|
|
395
|
+
export interface TextFieldEventMap {
|
|
396
|
+
focus: FocusEvent;
|
|
397
|
+
blur: FocusEvent;
|
|
398
|
+
change: CustomEvent<void>;
|
|
399
|
+
input: CustomEvent<void>;
|
|
400
|
+
invalid: CustomEvent<void>;
|
|
401
|
+
clear: CustomEvent<void>;
|
|
402
|
+
}
|
|
395
403
|
declare global {
|
|
396
404
|
interface HTMLElementTagNameMap {
|
|
397
405
|
'mdui-text-field': TextField;
|
|
@@ -1,5 +1,5 @@
|
|
|
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
4
|
import { classMap } from 'lit/directives/class-map.js';
|
|
5
5
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
@@ -9,12 +9,12 @@ import { when } from 'lit/directives/when.js';
|
|
|
9
9
|
import { animate } from '@lit-labs/motion';
|
|
10
10
|
import { $ } from '@mdui/jq/$.js';
|
|
11
11
|
import '@mdui/jq/methods/css.js';
|
|
12
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
12
13
|
import { FormController, formResets } from '@mdui/shared/controllers/form.js';
|
|
13
14
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
14
15
|
import { defaultValue } from '@mdui/shared/decorators/default-value.js';
|
|
15
16
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
16
17
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
17
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
18
18
|
import { getDuration, getEasing } from '@mdui/shared/helpers/motion.js';
|
|
19
19
|
import { observeResize } from '@mdui/shared/helpers/observeResize.js';
|
|
20
20
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
@@ -71,7 +71,7 @@ import { style } from './style.js';
|
|
|
71
71
|
* @csspart error - 底部的错误描述文本
|
|
72
72
|
* @csspart counter - 底部右侧的字数统计
|
|
73
73
|
*/
|
|
74
|
-
let TextField = class TextField extends FocusableMixin(
|
|
74
|
+
let TextField = class TextField extends FocusableMixin(MduiElement) {
|
|
75
75
|
constructor() {
|
|
76
76
|
super(...arguments);
|
|
77
77
|
/**
|
|
@@ -313,8 +313,8 @@ let TextField = class TextField extends FocusableMixin(LitElement) {
|
|
|
313
313
|
if (this.value !== this.inputRef.value.value) {
|
|
314
314
|
this.value = this.inputRef.value.value;
|
|
315
315
|
this.setTextareaHeight();
|
|
316
|
-
emit(
|
|
317
|
-
emit(
|
|
316
|
+
this.emit('input');
|
|
317
|
+
this.emit('change');
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
/**
|
|
@@ -323,7 +323,7 @@ let TextField = class TextField extends FocusableMixin(LitElement) {
|
|
|
323
323
|
checkValidity() {
|
|
324
324
|
const valid = this.inputRef.value.checkValidity();
|
|
325
325
|
if (!valid) {
|
|
326
|
-
emit(
|
|
326
|
+
this.emit('invalid', {
|
|
327
327
|
bubbles: false,
|
|
328
328
|
cancelable: true,
|
|
329
329
|
composed: false,
|
|
@@ -339,7 +339,7 @@ let TextField = class TextField extends FocusableMixin(LitElement) {
|
|
|
339
339
|
reportValidity() {
|
|
340
340
|
this.invalid = !this.inputRef.value.reportValidity();
|
|
341
341
|
if (this.invalid) {
|
|
342
|
-
emit(
|
|
342
|
+
this.emit('invalid', {
|
|
343
343
|
bubbles: false,
|
|
344
344
|
cancelable: true,
|
|
345
345
|
composed: false,
|
|
@@ -393,13 +393,13 @@ let TextField = class TextField extends FocusableMixin(LitElement) {
|
|
|
393
393
|
if (this.isTextarea) {
|
|
394
394
|
this.setTextareaHeight();
|
|
395
395
|
}
|
|
396
|
-
emit(
|
|
396
|
+
this.emit('change');
|
|
397
397
|
}
|
|
398
398
|
onClear(event) {
|
|
399
399
|
this.value = '';
|
|
400
|
-
emit(
|
|
401
|
-
emit(
|
|
402
|
-
emit(
|
|
400
|
+
this.emit('clear');
|
|
401
|
+
this.emit('input');
|
|
402
|
+
this.emit('change');
|
|
403
403
|
this.focus();
|
|
404
404
|
event.stopPropagation();
|
|
405
405
|
}
|
|
@@ -408,7 +408,7 @@ let TextField = class TextField extends FocusableMixin(LitElement) {
|
|
|
408
408
|
if (this.isTextarea) {
|
|
409
409
|
this.setTextareaHeight();
|
|
410
410
|
}
|
|
411
|
-
emit(
|
|
411
|
+
this.emit('input');
|
|
412
412
|
}
|
|
413
413
|
onInvalid(event) {
|
|
414
414
|
event.preventDefault();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import '@mdui/jq/methods/css.js';
|
|
3
2
|
import '@mdui/jq/methods/filter.js';
|
|
4
3
|
import '@mdui/jq/methods/height.js';
|
|
5
4
|
import '@mdui/jq/methods/prop.js';
|
|
6
5
|
import '@mdui/jq/methods/width.js';
|
|
6
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
7
7
|
import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
|
|
8
8
|
/**
|
|
9
9
|
* @summary 工具提示组件
|
|
@@ -33,7 +33,7 @@ import type { CSSResultGroup, TemplateResult, PropertyValues } from 'lit';
|
|
|
33
33
|
* @cssprop --shape-corner-rich - variant="rich" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
34
34
|
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
35
35
|
*/
|
|
36
|
-
export declare class Tooltip extends
|
|
36
|
+
export declare class Tooltip extends MduiElement<TooltipEventMap> {
|
|
37
37
|
static styles: CSSResultGroup;
|
|
38
38
|
/**
|
|
39
39
|
* tooltip 的形状。默认为 `plain`。可选值为:
|
|
@@ -98,6 +98,7 @@ export declare class Tooltip extends LitElement {
|
|
|
98
98
|
*/
|
|
99
99
|
open: boolean;
|
|
100
100
|
private observeResize?;
|
|
101
|
+
private overflowAncestors?;
|
|
101
102
|
private hoverTimeout;
|
|
102
103
|
private readonly popupRef;
|
|
103
104
|
private readonly hasSlotController;
|
|
@@ -133,6 +134,12 @@ export declare class Tooltip extends LitElement {
|
|
|
133
134
|
private onWindowScroll;
|
|
134
135
|
private updatePositioner;
|
|
135
136
|
}
|
|
137
|
+
export interface TooltipEventMap {
|
|
138
|
+
open: CustomEvent<void>;
|
|
139
|
+
opened: CustomEvent<void>;
|
|
140
|
+
close: CustomEvent<void>;
|
|
141
|
+
closed: CustomEvent<void>;
|
|
142
|
+
}
|
|
136
143
|
declare global {
|
|
137
144
|
interface HTMLElementTagNameMap {
|
|
138
145
|
'mdui-tooltip': Tooltip;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
5
5
|
import { when } from 'lit/directives/when.js';
|
|
6
|
+
import { getOverflowAncestors } from '@floating-ui/utils/dom';
|
|
6
7
|
import { $ } from '@mdui/jq/$.js';
|
|
7
8
|
import '@mdui/jq/methods/css.js';
|
|
8
9
|
import '@mdui/jq/methods/filter.js';
|
|
9
10
|
import '@mdui/jq/methods/height.js';
|
|
10
11
|
import '@mdui/jq/methods/prop.js';
|
|
11
12
|
import '@mdui/jq/methods/width.js';
|
|
13
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
12
14
|
import { DefinedController } from '@mdui/shared/controllers/defined.js';
|
|
13
15
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
14
16
|
import { HoverController } from '@mdui/shared/controllers/hover.js';
|
|
15
17
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
16
18
|
import { animateTo, stopAnimations } from '@mdui/shared/helpers/animate.js';
|
|
17
19
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
18
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
19
20
|
import { getDuration, getEasing } from '@mdui/shared/helpers/motion.js';
|
|
20
21
|
import { observeResize } from '@mdui/shared/helpers/observeResize.js';
|
|
21
22
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
@@ -48,7 +49,7 @@ import { style } from './style.js';
|
|
|
48
49
|
* @cssprop --shape-corner-rich - variant="rich" 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
49
50
|
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
50
51
|
*/
|
|
51
|
-
let Tooltip = class Tooltip extends
|
|
52
|
+
let Tooltip = class Tooltip extends MduiElement {
|
|
52
53
|
constructor() {
|
|
53
54
|
super();
|
|
54
55
|
/**
|
|
@@ -149,10 +150,8 @@ let Tooltip = class Tooltip extends LitElement {
|
|
|
149
150
|
await this.updateComplete;
|
|
150
151
|
}
|
|
151
152
|
if (hasUpdated) {
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
});
|
|
155
|
-
if (requestOpen.defaultPrevented) {
|
|
153
|
+
const eventProceeded = this.emit('open', { cancelable: true });
|
|
154
|
+
if (!eventProceeded) {
|
|
156
155
|
return;
|
|
157
156
|
}
|
|
158
157
|
}
|
|
@@ -164,33 +163,36 @@ let Tooltip = class Tooltip extends LitElement {
|
|
|
164
163
|
easing,
|
|
165
164
|
});
|
|
166
165
|
if (hasUpdated) {
|
|
167
|
-
emit(
|
|
166
|
+
this.emit('opened');
|
|
168
167
|
}
|
|
169
168
|
return;
|
|
170
169
|
}
|
|
171
170
|
// 关闭
|
|
172
171
|
if (!this.open && hasUpdated) {
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
});
|
|
176
|
-
if (requestClose.defaultPrevented) {
|
|
172
|
+
const eventProceeded = this.emit('close', { cancelable: true });
|
|
173
|
+
if (!eventProceeded) {
|
|
177
174
|
return;
|
|
178
175
|
}
|
|
179
176
|
await stopAnimations(this.popupRef.value);
|
|
180
177
|
await animateTo(this.popupRef.value, [{ transform: 'scale(1)' }, { transform: 'scale(0)' }], { duration, easing });
|
|
181
178
|
this.popupRef.value.hidden = true;
|
|
182
|
-
emit(
|
|
179
|
+
this.emit('closed');
|
|
183
180
|
}
|
|
184
181
|
}
|
|
185
182
|
connectedCallback() {
|
|
186
183
|
super.connectedCallback();
|
|
187
184
|
document.addEventListener('pointerdown', this.onDocumentClick);
|
|
188
|
-
|
|
185
|
+
this.overflowAncestors = getOverflowAncestors(this.target);
|
|
186
|
+
this.overflowAncestors.forEach((ancestor) => {
|
|
187
|
+
ancestor.addEventListener('scroll', this.onWindowScroll);
|
|
188
|
+
});
|
|
189
189
|
}
|
|
190
190
|
disconnectedCallback() {
|
|
191
191
|
super.disconnectedCallback();
|
|
192
192
|
document.removeEventListener('pointerdown', this.onDocumentClick);
|
|
193
|
-
|
|
193
|
+
this.overflowAncestors?.forEach((ancestor) => {
|
|
194
|
+
ancestor.removeEventListener('scroll', this.onWindowScroll);
|
|
195
|
+
});
|
|
194
196
|
this.observeResize?.unobserve();
|
|
195
197
|
}
|
|
196
198
|
firstUpdated(changedProperties) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary 顶部应用栏标题组件。需与 `<mdui-top-app-bar>` 组件配合使用
|
|
@@ -18,7 +18,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
18
18
|
* @csspart label 文本内容
|
|
19
19
|
* @csspart label-large 展开状态的文本内容
|
|
20
20
|
*/
|
|
21
|
-
export declare class TopAppBarTitle extends
|
|
21
|
+
export declare class TopAppBarTitle extends MduiElement<TopAppBarTitleEventMap> {
|
|
22
22
|
static styles: CSSResultGroup;
|
|
23
23
|
/**
|
|
24
24
|
* 顶部应用栏形状。由 mdui-top-app-bar 组件控制该参数
|
|
@@ -39,6 +39,8 @@ export declare class TopAppBarTitle extends LitElement {
|
|
|
39
39
|
*/
|
|
40
40
|
private onSlotChange;
|
|
41
41
|
}
|
|
42
|
+
export interface TopAppBarTitleEventMap {
|
|
43
|
+
}
|
|
42
44
|
declare global {
|
|
43
45
|
interface HTMLElementTagNameMap {
|
|
44
46
|
'mdui-top-app-bar-title': TopAppBarTitle;
|