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,14 +1,14 @@
|
|
|
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 { $ } from '@mdui/jq/$.js';
|
|
5
5
|
import '@mdui/jq/methods/is.js';
|
|
6
6
|
import { isElement, isUndefined } from '@mdui/jq/shared/helper.js';
|
|
7
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
7
8
|
import { DefinedController } from '@mdui/shared/controllers/defined.js';
|
|
8
9
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
9
10
|
import { arraysEqualIgnoreOrder } from '@mdui/shared/helpers/array.js';
|
|
10
11
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
11
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
12
12
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
13
13
|
import { collapseStyle } from './collapse-style.js';
|
|
14
14
|
/**
|
|
@@ -25,7 +25,7 @@ import { collapseStyle } from './collapse-style.js';
|
|
|
25
25
|
*
|
|
26
26
|
* @slot - `<mdui-collapse-item>` 组件
|
|
27
27
|
*/
|
|
28
|
-
let Collapse = class Collapse extends
|
|
28
|
+
let Collapse = class Collapse extends MduiElement {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
31
|
/**
|
|
@@ -54,7 +54,7 @@ let Collapse = class Collapse extends LitElement {
|
|
|
54
54
|
.map((item) => item.value);
|
|
55
55
|
this.setValue(value);
|
|
56
56
|
if (!this.isInitial) {
|
|
57
|
-
emit(
|
|
57
|
+
this.emit('change');
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
async onValueChange() {
|
|
@@ -109,10 +109,10 @@ let Collapse = class Collapse extends LitElement {
|
|
|
109
109
|
if (event.button) {
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
// collapse-item 被禁用,忽略
|
|
113
112
|
const target = event.target;
|
|
114
113
|
const item = target.closest('mdui-collapse-item');
|
|
115
|
-
|
|
114
|
+
// collapse-item 被禁用,忽略
|
|
115
|
+
if (!item || item.disabled) {
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
const path = event.composedPath();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import '../icon.js';
|
|
3
3
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
4
4
|
/**
|
|
@@ -33,7 +33,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
33
33
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
34
34
|
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
35
35
|
*/
|
|
36
|
-
export declare class Dialog extends
|
|
36
|
+
export declare class Dialog extends MduiElement<DialogEventMap> {
|
|
37
37
|
static styles: CSSResultGroup;
|
|
38
38
|
/**
|
|
39
39
|
* 顶部的 Material Icons 图标名。也可以通过 `slot="icon"` 设置
|
|
@@ -93,6 +93,13 @@ export declare class Dialog extends LitElement {
|
|
|
93
93
|
private renderHeadline;
|
|
94
94
|
private renderDescription;
|
|
95
95
|
}
|
|
96
|
+
export interface DialogEventMap {
|
|
97
|
+
open: CustomEvent<void>;
|
|
98
|
+
opened: CustomEvent<void>;
|
|
99
|
+
close: CustomEvent<void>;
|
|
100
|
+
closed: CustomEvent<void>;
|
|
101
|
+
'overlay-click': CustomEvent<void>;
|
|
102
|
+
}
|
|
96
103
|
declare global {
|
|
97
104
|
interface HTMLElementTagNameMap {
|
|
98
105
|
'mdui-dialog': Dialog;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property, queryAssignedElements, } 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 { DefinedController } from '@mdui/shared/controllers/defined.js';
|
|
8
9
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
9
10
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
10
11
|
import { animateTo, stopAnimations } from '@mdui/shared/helpers/animate.js';
|
|
11
12
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
12
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
13
13
|
import { Modal } from '@mdui/shared/helpers/modal.js';
|
|
14
14
|
import { getDuration, getEasing } from '@mdui/shared/helpers/motion.js';
|
|
15
15
|
import { lockScreen, unlockScreen } from '@mdui/shared/helpers/scroll.js';
|
|
@@ -49,7 +49,7 @@ import { style } from './style.js';
|
|
|
49
49
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
50
50
|
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
51
51
|
*/
|
|
52
|
-
let Dialog = class Dialog extends
|
|
52
|
+
let Dialog = class Dialog extends MduiElement {
|
|
53
53
|
constructor() {
|
|
54
54
|
super(...arguments);
|
|
55
55
|
/**
|
|
@@ -104,10 +104,8 @@ let Dialog = class Dialog extends LitElement {
|
|
|
104
104
|
// 要区分是否首次渲染,首次渲染不触发事件,不执行动画;非首次渲染,触发事件,执行动画
|
|
105
105
|
if (this.open) {
|
|
106
106
|
if (hasUpdated) {
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
if (requestOpen.defaultPrevented) {
|
|
107
|
+
const eventProceeded = this.emit('open', { cancelable: true });
|
|
108
|
+
if (!eventProceeded) {
|
|
111
109
|
return;
|
|
112
110
|
}
|
|
113
111
|
}
|
|
@@ -165,14 +163,12 @@ let Dialog = class Dialog extends LitElement {
|
|
|
165
163
|
})),
|
|
166
164
|
]);
|
|
167
165
|
if (hasUpdated) {
|
|
168
|
-
emit(
|
|
166
|
+
this.emit('opened');
|
|
169
167
|
}
|
|
170
168
|
}
|
|
171
169
|
else {
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
});
|
|
175
|
-
if (requestClose.defaultPrevented) {
|
|
170
|
+
const eventProceeded = this.emit('close', { cancelable: true });
|
|
171
|
+
if (!eventProceeded) {
|
|
176
172
|
return;
|
|
177
173
|
}
|
|
178
174
|
this.modalHelper.deactivate();
|
|
@@ -197,7 +193,7 @@ let Dialog = class Dialog extends LitElement {
|
|
|
197
193
|
if (typeof trigger?.focus === 'function') {
|
|
198
194
|
setTimeout(() => trigger.focus());
|
|
199
195
|
}
|
|
200
|
-
emit(
|
|
196
|
+
this.emit('closed');
|
|
201
197
|
}
|
|
202
198
|
}
|
|
203
199
|
disconnectedCallback() {
|
|
@@ -229,7 +225,7 @@ let Dialog = class Dialog extends LitElement {
|
|
|
229
225
|
})}" tabindex="0">${when(hasHeader, () => html `<slot name="header" part="header" class="header">${when(hasIcon, () => this.renderIcon())} ${when(hasHeadline, () => this.renderHeadline())}</slot>`)} ${when(hasBody, () => html `<div ${ref(this.bodyRef)} part="body" class="body">${when(hasDescription, () => this.renderDescription())}<slot></slot></div>`)} ${when(hasActionSlot, () => html `<slot name="action" part="action" class="action"></slot>`)}</div>`;
|
|
230
226
|
}
|
|
231
227
|
onOverlayClick() {
|
|
232
|
-
emit(
|
|
228
|
+
this.emit('overlay-click');
|
|
233
229
|
if (!this.closeOnOverlayClick) {
|
|
234
230
|
return;
|
|
235
231
|
}
|
|
@@ -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 分割线组件
|
|
@@ -7,7 +7,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
7
7
|
* <mdui-divider></mdui-divider>
|
|
8
8
|
* ```
|
|
9
9
|
*/
|
|
10
|
-
export declare class Divider extends
|
|
10
|
+
export declare class Divider extends MduiElement<DividerEventMap> {
|
|
11
11
|
static styles: CSSResultGroup;
|
|
12
12
|
/**
|
|
13
13
|
* 是否显示垂直分割线
|
|
@@ -23,6 +23,8 @@ export declare class Divider extends LitElement {
|
|
|
23
23
|
middle: boolean;
|
|
24
24
|
protected render(): TemplateResult;
|
|
25
25
|
}
|
|
26
|
+
export interface DividerEventMap {
|
|
27
|
+
}
|
|
26
28
|
declare global {
|
|
27
29
|
interface HTMLElementTagNameMap {
|
|
28
30
|
'mdui-divider': Divider;
|
|
@@ -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 { style } from './style.js';
|
|
@@ -11,7 +12,7 @@ import { style } from './style.js';
|
|
|
11
12
|
* <mdui-divider></mdui-divider>
|
|
12
13
|
* ```
|
|
13
14
|
*/
|
|
14
|
-
let Divider = class Divider extends
|
|
15
|
+
let Divider = class Divider extends MduiElement {
|
|
15
16
|
constructor() {
|
|
16
17
|
super(...arguments);
|
|
17
18
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { LitElement } from 'lit';
|
|
2
1
|
import '@mdui/jq/methods/height.js';
|
|
3
2
|
import '@mdui/jq/methods/is.js';
|
|
4
3
|
import '@mdui/jq/methods/width.js';
|
|
4
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
5
5
|
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
6
6
|
/**
|
|
7
7
|
* @summary 下拉组件
|
|
@@ -29,7 +29,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
29
29
|
*
|
|
30
30
|
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
31
31
|
*/
|
|
32
|
-
export declare class Dropdown extends
|
|
32
|
+
export declare class Dropdown extends MduiElement<DropdownEventMap> {
|
|
33
33
|
static styles: CSSResultGroup;
|
|
34
34
|
/**
|
|
35
35
|
* dropdown 是否打开
|
|
@@ -91,6 +91,7 @@ export declare class Dropdown extends LitElement {
|
|
|
91
91
|
private openTimeout;
|
|
92
92
|
private closeTimeout;
|
|
93
93
|
private observeResize?;
|
|
94
|
+
private overflowAncestors?;
|
|
94
95
|
private readonly panelRef;
|
|
95
96
|
private readonly definedController;
|
|
96
97
|
constructor();
|
|
@@ -123,6 +124,12 @@ export declare class Dropdown extends LitElement {
|
|
|
123
124
|
private onMouseLeave;
|
|
124
125
|
private updatePositioner;
|
|
125
126
|
}
|
|
127
|
+
export interface DropdownEventMap {
|
|
128
|
+
open: CustomEvent<void>;
|
|
129
|
+
opened: CustomEvent<void>;
|
|
130
|
+
close: CustomEvent<void>;
|
|
131
|
+
closed: CustomEvent<void>;
|
|
132
|
+
}
|
|
126
133
|
declare global {
|
|
127
134
|
interface HTMLElementTagNameMap {
|
|
128
135
|
'mdui-dropdown': Dropdown;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement, property, queryAssignedElements, } from 'lit/decorators.js';
|
|
4
4
|
import { createRef, ref } from 'lit/directives/ref.js';
|
|
5
|
+
import { getOverflowAncestors } from '@floating-ui/utils/dom';
|
|
5
6
|
import { $ } from '@mdui/jq/$.js';
|
|
6
7
|
import '@mdui/jq/methods/height.js';
|
|
7
8
|
import '@mdui/jq/methods/is.js';
|
|
8
9
|
import '@mdui/jq/methods/width.js';
|
|
9
10
|
import { isFunction } from '@mdui/jq/shared/helper.js';
|
|
11
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
10
12
|
import { DefinedController } from '@mdui/shared/controllers/defined.js';
|
|
11
13
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
12
14
|
import { animateTo, stopAnimations } from '@mdui/shared/helpers/animate.js';
|
|
13
15
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
14
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
15
16
|
import { getDuration, getEasing } from '@mdui/shared/helpers/motion.js';
|
|
16
17
|
import { observeResize } from '@mdui/shared/helpers/observeResize.js';
|
|
17
18
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
@@ -42,7 +43,7 @@ import { style } from './style.js';
|
|
|
42
43
|
*
|
|
43
44
|
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
44
45
|
*/
|
|
45
|
-
let Dropdown = class Dropdown extends
|
|
46
|
+
let Dropdown = class Dropdown extends MduiElement {
|
|
46
47
|
constructor() {
|
|
47
48
|
super();
|
|
48
49
|
/**
|
|
@@ -139,10 +140,8 @@ let Dropdown = class Dropdown extends LitElement {
|
|
|
139
140
|
// 要区分是否首次渲染,首次渲染时不触发事件,不执行动画;非首次渲染,触发事件,执行动画
|
|
140
141
|
if (this.open) {
|
|
141
142
|
if (hasUpdated) {
|
|
142
|
-
const
|
|
143
|
-
|
|
144
|
-
});
|
|
145
|
-
if (requestOpen.defaultPrevented) {
|
|
143
|
+
const eventProceeded = this.emit('open', { cancelable: true });
|
|
144
|
+
if (!eventProceeded) {
|
|
146
145
|
return;
|
|
147
146
|
}
|
|
148
147
|
}
|
|
@@ -169,14 +168,12 @@ let Dropdown = class Dropdown extends LitElement {
|
|
|
169
168
|
}),
|
|
170
169
|
]);
|
|
171
170
|
if (hasUpdated) {
|
|
172
|
-
emit(
|
|
171
|
+
this.emit('opened');
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
174
|
else {
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
});
|
|
179
|
-
if (requestClose.defaultPrevented) {
|
|
175
|
+
const eventProceeded = this.emit('close', { cancelable: true });
|
|
176
|
+
if (!eventProceeded) {
|
|
180
177
|
return;
|
|
181
178
|
}
|
|
182
179
|
// dropdown 关闭时,如果不支持 focus 触发,且焦点在 dropdown 内,则焦点回到 trigger 上
|
|
@@ -199,7 +196,7 @@ let Dropdown = class Dropdown extends LitElement {
|
|
|
199
196
|
if (this.panelRef.value) {
|
|
200
197
|
this.panelRef.value.hidden = true;
|
|
201
198
|
}
|
|
202
|
-
emit(
|
|
199
|
+
this.emit('closed');
|
|
203
200
|
}
|
|
204
201
|
}
|
|
205
202
|
connectedCallback() {
|
|
@@ -207,14 +204,19 @@ let Dropdown = class Dropdown extends LitElement {
|
|
|
207
204
|
this.definedController.whenDefined().then(() => {
|
|
208
205
|
document.addEventListener('pointerdown', this.onDocumentClick);
|
|
209
206
|
document.addEventListener('keydown', this.onDocumentKeydown);
|
|
210
|
-
|
|
207
|
+
this.overflowAncestors = getOverflowAncestors(this.triggerElement);
|
|
208
|
+
this.overflowAncestors.forEach((ancestor) => {
|
|
209
|
+
ancestor.addEventListener('scroll', this.onWindowScroll);
|
|
210
|
+
});
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
213
|
disconnectedCallback() {
|
|
214
214
|
super.disconnectedCallback();
|
|
215
215
|
document.removeEventListener('pointerdown', this.onDocumentClick);
|
|
216
216
|
document.removeEventListener('keydown', this.onDocumentKeydown);
|
|
217
|
-
|
|
217
|
+
this.overflowAncestors?.forEach((ancestor) => {
|
|
218
|
+
ancestor.removeEventListener('scroll', this.onWindowScroll);
|
|
219
|
+
});
|
|
218
220
|
this.observeResize?.unobserve();
|
|
219
221
|
}
|
|
220
222
|
firstUpdated(changedProperties) {
|
|
@@ -25,7 +25,7 @@ import type { TemplateResult, CSSResultGroup } from 'lit';
|
|
|
25
25
|
* @cssprop --shape-corner-normal - `size="normal"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
26
26
|
* @cssprop --shape-corner-large - `size="large"` 时,组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
27
27
|
*/
|
|
28
|
-
export declare class Fab extends ButtonBase {
|
|
28
|
+
export declare class Fab extends ButtonBase<FabEventMap> {
|
|
29
29
|
static styles: CSSResultGroup;
|
|
30
30
|
/**
|
|
31
31
|
* FAB 形状,此组件的不同形状之间只有颜色不一样。可选值为:
|
|
@@ -64,6 +64,11 @@ export declare class Fab extends ButtonBase {
|
|
|
64
64
|
private renderIcon;
|
|
65
65
|
private renderInner;
|
|
66
66
|
}
|
|
67
|
+
export interface FabEventMap {
|
|
68
|
+
focus: FocusEvent;
|
|
69
|
+
blur: FocusEvent;
|
|
70
|
+
invalid: CustomEvent<void>;
|
|
71
|
+
}
|
|
67
72
|
declare global {
|
|
68
73
|
interface HTMLElementTagNameMap {
|
|
69
74
|
'mdui-fab': Fab;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import type { TemplateResult, CSSResultGroup } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary 图标组件
|
|
@@ -9,7 +9,7 @@ import type { TemplateResult, CSSResultGroup } from 'lit';
|
|
|
9
9
|
*
|
|
10
10
|
* @slot - `svg` 图标的内容
|
|
11
11
|
*/
|
|
12
|
-
export declare class Icon extends
|
|
12
|
+
export declare class Icon extends MduiElement<IconEventMap> {
|
|
13
13
|
static styles: CSSResultGroup;
|
|
14
14
|
/**
|
|
15
15
|
* Material Icons 图标名
|
|
@@ -22,6 +22,8 @@ export declare class Icon extends LitElement {
|
|
|
22
22
|
private readonly hasSlotController;
|
|
23
23
|
protected render(): TemplateResult;
|
|
24
24
|
}
|
|
25
|
+
export interface IconEventMap {
|
|
26
|
+
}
|
|
25
27
|
declare global {
|
|
26
28
|
interface HTMLElementTagNameMap {
|
|
27
29
|
'mdui-icon': Icon;
|
package/components/icon/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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 { styleMap } from 'lit/directives/style-map.js';
|
|
5
5
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
6
6
|
import { until } from 'lit/directives/until.js';
|
|
7
7
|
import { ajax } from '@mdui/jq/functions/ajax.js';
|
|
8
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
8
9
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
9
10
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
10
11
|
import { style } from './style.js';
|
|
@@ -17,7 +18,7 @@ import { style } from './style.js';
|
|
|
17
18
|
*
|
|
18
19
|
* @slot - `svg` 图标的内容
|
|
19
20
|
*/
|
|
20
|
-
let Icon = class Icon extends
|
|
21
|
+
let Icon = class Icon extends MduiElement {
|
|
21
22
|
constructor() {
|
|
22
23
|
super(...arguments);
|
|
23
24
|
this.hasSlotController = new HasSlotController(this, '[default]');
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import type { LayoutManager, LayoutPlacement } from './helper.js';
|
|
3
|
-
|
|
3
|
+
import type { PlainObject } from '@mdui/jq/shared/helper.js';
|
|
4
|
+
export declare class LayoutItemBase<E = PlainObject> extends MduiElement<E> {
|
|
4
5
|
/**
|
|
5
6
|
* 该组件在 [`<mdui-layout>`](/docs/2/components/layout) 中的布局顺序,按从小到大排序。默认为 `0`
|
|
6
7
|
*/
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { LitElement } from 'lit';
|
|
3
2
|
import { property } from 'lit/decorators.js';
|
|
4
3
|
import { isNodeName } from '@mdui/jq/shared/helper.js';
|
|
4
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
5
5
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
6
6
|
import { getLayout } from './helper.js';
|
|
7
|
-
export class LayoutItemBase extends
|
|
7
|
+
export class LayoutItemBase extends MduiElement {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
|
10
10
|
// 父元素是否是 `mdui-layout`
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { CSSResultGroup } from 'lit';
|
|
2
1
|
import { LayoutItemBase } from './layout-item-base.js';
|
|
3
2
|
import type { LayoutPlacement } from './helper.js';
|
|
4
|
-
import type { TemplateResult } from 'lit';
|
|
3
|
+
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
5
4
|
/**
|
|
6
5
|
* @summary 布局项组件
|
|
7
6
|
*
|
|
@@ -15,7 +14,7 @@ import type { TemplateResult } from 'lit';
|
|
|
15
14
|
*
|
|
16
15
|
* @slot - 可以是任意内容
|
|
17
16
|
*/
|
|
18
|
-
export declare class LayoutItem extends LayoutItemBase {
|
|
17
|
+
export declare class LayoutItem extends LayoutItemBase<LayoutItemEventMap> {
|
|
19
18
|
static styles: CSSResultGroup;
|
|
20
19
|
/**
|
|
21
20
|
* 该组件所处位置。可选值为:
|
|
@@ -30,6 +29,8 @@ export declare class LayoutItem extends LayoutItemBase {
|
|
|
30
29
|
private onPlacementChange;
|
|
31
30
|
protected render(): TemplateResult;
|
|
32
31
|
}
|
|
32
|
+
export interface LayoutItemEventMap {
|
|
33
|
+
}
|
|
33
34
|
declare global {
|
|
34
35
|
interface HTMLElementTagNameMap {
|
|
35
36
|
'mdui-layout-item': LayoutItem;
|
|
@@ -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 布局主内容组件
|
|
@@ -13,13 +13,15 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
13
13
|
*
|
|
14
14
|
* @slot - 可以是任意内容
|
|
15
15
|
*/
|
|
16
|
-
export declare class LayoutMain extends
|
|
16
|
+
export declare class LayoutMain extends MduiElement<LayoutMainEventMap> {
|
|
17
17
|
static styles: CSSResultGroup;
|
|
18
18
|
private layoutManager?;
|
|
19
19
|
connectedCallback(): void;
|
|
20
20
|
disconnectedCallback(): void;
|
|
21
21
|
protected render(): TemplateResult;
|
|
22
22
|
}
|
|
23
|
+
export interface LayoutMainEventMap {
|
|
24
|
+
}
|
|
23
25
|
declare global {
|
|
24
26
|
interface HTMLElementTagNameMap {
|
|
25
27
|
'mdui-layout-main': LayoutMain;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { html
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
4
|
import { isNodeName } from '@mdui/jq/shared/helper.js';
|
|
5
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
5
6
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
6
7
|
import { getLayout } from './helper.js';
|
|
7
8
|
import { layoutMainStyle } from './layout-main-style.js';
|
|
@@ -18,7 +19,7 @@ import { layoutMainStyle } from './layout-main-style.js';
|
|
|
18
19
|
*
|
|
19
20
|
* @slot - 可以是任意内容
|
|
20
21
|
*/
|
|
21
|
-
let LayoutMain = class LayoutMain extends
|
|
22
|
+
let LayoutMain = class LayoutMain extends MduiElement {
|
|
22
23
|
connectedCallback() {
|
|
23
24
|
super.connectedCallback();
|
|
24
25
|
const parentElement = this.parentElement;
|
|
@@ -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 布局组件
|
|
@@ -13,7 +13,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
13
13
|
*
|
|
14
14
|
* @slot - 可以是 [`<mdui-top-app-bar>`](/docs/2/components/top-app-bar)、[`<mdui-bottom-app-bar>`](/docs/2/components/bottom-app-bar)、[`<mdui-navigation-bar>`](/docs/2/components/navigation-bar)、[`<mdui-navigation-drawer>`](/docs/2/components/navigation-drawer)、[`<mdui-navigation-rail>`](/docs/2/components/navigation-rail)、`<mdui-layout-item>`、`<mdui-layout-main>` 元素
|
|
15
15
|
*/
|
|
16
|
-
export declare class Layout extends
|
|
16
|
+
export declare class Layout extends MduiElement<LayoutEventMap> {
|
|
17
17
|
static styles: CSSResultGroup;
|
|
18
18
|
/**
|
|
19
19
|
* 把当前布局的高度设为 100%
|
|
@@ -21,6 +21,8 @@ export declare class Layout extends LitElement {
|
|
|
21
21
|
fullHeight: boolean;
|
|
22
22
|
protected render(): TemplateResult;
|
|
23
23
|
}
|
|
24
|
+
export interface LayoutEventMap {
|
|
25
|
+
}
|
|
24
26
|
declare global {
|
|
25
27
|
interface HTMLElementTagNameMap {
|
|
26
28
|
'mdui-layout': Layout;
|
|
@@ -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 { layoutStyle } from './layout-style.js';
|
|
@@ -17,7 +18,7 @@ import { layoutStyle } from './layout-style.js';
|
|
|
17
18
|
*
|
|
18
19
|
* @slot - 可以是 [`<mdui-top-app-bar>`](/docs/2/components/top-app-bar)、[`<mdui-bottom-app-bar>`](/docs/2/components/bottom-app-bar)、[`<mdui-navigation-bar>`](/docs/2/components/navigation-bar)、[`<mdui-navigation-drawer>`](/docs/2/components/navigation-drawer)、[`<mdui-navigation-rail>`](/docs/2/components/navigation-rail)、`<mdui-layout-item>`、`<mdui-layout-main>` 元素
|
|
19
20
|
*/
|
|
20
|
-
let Layout = class Layout extends
|
|
21
|
+
let Layout = class Layout extends MduiElement {
|
|
21
22
|
constructor() {
|
|
22
23
|
super(...arguments);
|
|
23
24
|
/**
|
|
@@ -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 线性进度指示器组件
|
|
@@ -11,7 +11,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
11
11
|
*
|
|
12
12
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
13
13
|
*/
|
|
14
|
-
export declare class LinearProgress extends
|
|
14
|
+
export declare class LinearProgress extends MduiElement<LinearProgressEventMap> {
|
|
15
15
|
static styles: CSSResultGroup;
|
|
16
16
|
/**
|
|
17
17
|
* 进度指示器的最大值,默认为 1
|
|
@@ -23,6 +23,8 @@ export declare class LinearProgress extends LitElement {
|
|
|
23
23
|
value?: number;
|
|
24
24
|
protected render(): TemplateResult;
|
|
25
25
|
}
|
|
26
|
+
export interface LinearProgressEventMap {
|
|
27
|
+
}
|
|
26
28
|
declare global {
|
|
27
29
|
interface HTMLElementTagNameMap {
|
|
28
30
|
'mdui-linear-progress': LinearProgress;
|
|
@@ -1,8 +1,9 @@
|
|
|
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 { styleMap } from 'lit/directives/style-map.js';
|
|
5
5
|
import { isUndefined } from '@mdui/jq/shared/helper.js';
|
|
6
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
6
7
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
7
8
|
import { style } from './style.js';
|
|
8
9
|
/**
|
|
@@ -16,7 +17,7 @@ import { style } from './style.js';
|
|
|
16
17
|
*
|
|
17
18
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
18
19
|
*/
|
|
19
|
-
let LinearProgress = class LinearProgress extends
|
|
20
|
+
let LinearProgress = class LinearProgress extends MduiElement {
|
|
20
21
|
constructor() {
|
|
21
22
|
super(...arguments);
|
|
22
23
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
export const listItemStyle = css `:host{--shape-corner:var(--mdui-shape-corner-none);--shape-corner-rounded:var(--mdui-shape-corner-extra-large);position:relative;display:block;border-radius:var(--shape-corner);--mdui-comp-ripple-state-layer-color:var(--mdui-color-on-surface)}:host([rounded]),:host([rounded]) mdui-ripple{border-radius:var(--shape-corner-rounded)}:host([active]){background-color:rgb(var(--mdui-color-secondary-container));--mdui-comp-ripple-state-layer-color:var(
|
|
3
3
|
--mdui-color-on-secondary-container
|
|
4
|
-
)}:host([disabled]){pointer-events:none}.container{cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}:host([disabled]) .container{cursor:default;opacity:.38}:host([nonclickable]:not([href])) .container{cursor:auto;-webkit-user-select:auto;user-select:auto}.preset{display:flex;align-items:center;
|
|
4
|
+
)}:host([disabled]){pointer-events:none}.container{cursor:pointer;-webkit-user-select:none;user-select:none;text-decoration:none;color:inherit;-webkit-tap-highlight-color:transparent}:host([disabled]) .container{cursor:default;opacity:.38}:host([nonclickable]:not([href])) .container{cursor:auto;-webkit-user-select:auto;user-select:auto}.preset{display:flex;align-items:center;padding:.5rem 1.5rem .5rem 1rem;min-height:3.5rem}:host([alignment=start]) .preset{align-items:flex-start}:host([alignment=end]) .preset{align-items:flex-end}.body{display:flex;flex:1 1 100%;flex-direction:column;justify-content:center;min-width:0}.headline{display:block;color:rgb(var(--mdui-color-on-surface));font-size:var(--mdui-typescale-body-large-size);font-weight:var(--mdui-typescale-body-large-weight);letter-spacing:var(--mdui-typescale-body-large-tracking);line-height:var(--mdui-typescale-body-large-line-height)}:host([active]) .headline{color:rgb(var(--mdui-color-on-secondary-container))}.description{display:none;color:rgb(var(--mdui-color-on-surface-variant));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([disabled]) .description,:host([focused]) .description,:host([hover]) .description,:host([pressed]) .description{color:rgb(var(--mdui-color-on-surface))}.has-description .description{display:block}:host([description-line='1']) .description,:host([headline-line='1']) .headline{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host([description-line='2']) .description,:host([description-line='3']) .description,:host([headline-line='2']) .headline,:host([headline-line='3']) .headline{display:-webkit-box;overflow:hidden;text-overflow:ellipsis;-webkit-box-orient:vertical}:host([description-line='2']) .description,:host([headline-line='2']) .headline{-webkit-line-clamp:2}:host([description-line='3']) .description,:host([headline-line='3']) .headline{-webkit-line-clamp:3}.end-icon,.icon{display:flex;flex:0 0 auto;font-size:var(--mdui-typescale-label-small-size);font-weight:var(--mdui-typescale-label-small-weight);letter-spacing:var(--mdui-typescale-label-small-tracking);line-height:var(--mdui-typescale-label-small-line-height);color:rgb(var(--mdui-color-on-surface-variant))}:host([disabled]) .end-icon,:host([disabled]) .icon,:host([focused]) .end-icon,:host([focused]) .icon,:host([hover]) .end-icon,:host([hover]) .icon,:host([pressed]) .end-icon,:host([pressed]) .icon{color:rgb(var(--mdui-color-on-surface))}:host([active]) .end-icon,:host([active]) .icon{color:rgb(var(--mdui-color-on-secondary-container))}.end-icon mdui-icon,.icon mdui-icon,.is-end-icon ::slotted([slot=end-icon]),.is-icon ::slotted([slot=icon]){font-size:1.5rem}.has-icon .icon{margin-right:1rem}.has-icon ::slotted(mdui-checkbox[slot=icon]),.has-icon ::slotted(mdui-radio[slot=icon]){margin-left:-.5rem}.has-end-icon .end-icon{margin-left:1rem}.has-end-icon ::slotted(mdui-checkbox[slot=end-icon]),.has-end-icon ::slotted(mdui-radio[slot=end-icon]){margin-right:-.5rem}`;
|
|
@@ -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 ListItem_base: import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/anchor.js").AnchorMixinInterface> & 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 ListItem_base: import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/anchor.js").AnchorMixinInterface> & 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-list>` 组件配合使用
|
|
8
8
|
*
|
|
@@ -33,7 +33,7 @@ declare const ListItem_base: import("@open-wc/dedupe-mixin").Constructor<import(
|
|
|
33
33
|
* @cssprop --shape-corner - 列表项的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
34
34
|
* @cssprop --shape-corner-rounded - 指定了 `rounded` 时,列表项的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
35
35
|
*/
|
|
36
|
-
export declare class ListItem extends ListItem_base {
|
|
36
|
+
export declare class ListItem extends ListItem_base<ListItemEventMap> {
|
|
37
37
|
static styles: CSSResultGroup;
|
|
38
38
|
/**
|
|
39
39
|
* 主文本。也可以通过 default slot 设置
|
|
@@ -103,6 +103,10 @@ export declare class ListItem extends ListItem_base {
|
|
|
103
103
|
protected render(): TemplateResult;
|
|
104
104
|
private renderInner;
|
|
105
105
|
}
|
|
106
|
+
export interface ListItemEventMap {
|
|
107
|
+
focus: FocusEvent;
|
|
108
|
+
blur: FocusEvent;
|
|
109
|
+
}
|
|
106
110
|
declare global {
|
|
107
111
|
interface HTMLElementTagNameMap {
|
|
108
112
|
'mdui-list-item': ListItem;
|