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
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2016-present zdhxiong@gmail.com
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016-present zdhxiong@gmail.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -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, TemplateResult } from 'lit';
|
|
4
4
|
/**
|
|
@@ -15,7 +15,7 @@ import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
|
15
15
|
*
|
|
16
16
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
17
17
|
*/
|
|
18
|
-
export declare class Avatar extends
|
|
18
|
+
export declare class Avatar extends MduiElement<AvatarEventMap> {
|
|
19
19
|
static styles: CSSResultGroup;
|
|
20
20
|
/**
|
|
21
21
|
* 头像的图片地址
|
|
@@ -42,6 +42,8 @@ export declare class Avatar extends LitElement {
|
|
|
42
42
|
private readonly hasSlotController;
|
|
43
43
|
protected render(): TemplateResult;
|
|
44
44
|
}
|
|
45
|
+
export interface AvatarEventMap {
|
|
46
|
+
}
|
|
45
47
|
declare global {
|
|
46
48
|
interface HTMLElementTagNameMap {
|
|
47
49
|
'mdui-avatar': Avatar;
|
|
@@ -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 { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
5
|
import { styleMap } from 'lit/directives/style-map.js';
|
|
6
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
6
7
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
7
8
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
8
9
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
@@ -22,7 +23,7 @@ import { style } from './style.js';
|
|
|
22
23
|
*
|
|
23
24
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
+
let Avatar = class Avatar extends MduiElement {
|
|
26
27
|
constructor() {
|
|
27
28
|
super(...arguments);
|
|
28
29
|
this.hasSlotController = new HasSlotController(this, '[default]');
|
|
@@ -53,3 +54,4 @@ __decorate([
|
|
|
53
54
|
Avatar = __decorate([
|
|
54
55
|
customElement('mdui-avatar')
|
|
55
56
|
], Avatar);
|
|
57
|
+
export { Avatar };
|
|
@@ -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 Badge extends
|
|
14
|
+
export declare class Badge extends MduiElement<BadgeEventMap> {
|
|
15
15
|
static styles: CSSResultGroup;
|
|
16
16
|
/**
|
|
17
17
|
* 徽标形状。可选值为:
|
|
@@ -21,6 +21,8 @@ export declare class Badge extends LitElement {
|
|
|
21
21
|
variant: /*小型徽标,不显示文字*/ 'small' | /*大型徽标,会显示文字*/ 'large';
|
|
22
22
|
protected render(): TemplateResult;
|
|
23
23
|
}
|
|
24
|
+
export interface BadgeEventMap {
|
|
25
|
+
}
|
|
24
26
|
declare global {
|
|
25
27
|
interface HTMLElementTagNameMap {
|
|
26
28
|
'mdui-badge': Badge;
|
|
@@ -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 { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
5
6
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
6
7
|
import { style } from './style.js';
|
|
@@ -15,7 +16,7 @@ import { style } from './style.js';
|
|
|
15
16
|
*
|
|
16
17
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
let Badge = class Badge extends MduiElement {
|
|
19
20
|
constructor() {
|
|
20
21
|
super(...arguments);
|
|
21
22
|
/**
|
|
@@ -39,3 +40,4 @@ __decorate([
|
|
|
39
40
|
Badge = __decorate([
|
|
40
41
|
customElement('mdui-badge')
|
|
41
42
|
], Badge);
|
|
43
|
+
export { Badge };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LayoutItemBase } from '../layout/layout-item-base.js';
|
|
2
2
|
import type { LayoutPlacement } from '../layout/helper.js';
|
|
3
3
|
import type { ScrollPaddingPosition } from '@mdui/shared/mixins/scrollBehavior.js';
|
|
4
|
-
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
4
|
+
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
5
5
|
declare const BottomAppBar_base: import("@open-wc/dedupe-mixin").Constructor<import("@mdui/shared/mixins/scrollBehavior.js").ScrollBehaviorMixinInterface> & typeof LayoutItemBase;
|
|
6
6
|
/**
|
|
7
7
|
* @summary 底部应用栏组件
|
|
@@ -27,7 +27,7 @@ declare const BottomAppBar_base: import("@open-wc/dedupe-mixin").Constructor<imp
|
|
|
27
27
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
28
28
|
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
29
29
|
*/
|
|
30
|
-
export declare class BottomAppBar extends BottomAppBar_base {
|
|
30
|
+
export declare class BottomAppBar extends BottomAppBar_base<BottomAppBarEventMap> {
|
|
31
31
|
static styles: CSSResultGroup;
|
|
32
32
|
/**
|
|
33
33
|
* 是否隐藏
|
|
@@ -44,7 +44,7 @@ export declare class BottomAppBar extends BottomAppBar_base {
|
|
|
44
44
|
scrollBehavior?: 'hide';
|
|
45
45
|
protected get scrollPaddingPosition(): ScrollPaddingPosition;
|
|
46
46
|
protected get layoutPlacement(): LayoutPlacement;
|
|
47
|
-
|
|
47
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
48
48
|
protected render(): TemplateResult;
|
|
49
49
|
/**
|
|
50
50
|
* 滚动行为
|
|
@@ -52,6 +52,12 @@ export declare class BottomAppBar extends BottomAppBar_base {
|
|
|
52
52
|
*/
|
|
53
53
|
protected runScrollThreshold(isScrollingUp: boolean): void;
|
|
54
54
|
}
|
|
55
|
+
export interface BottomAppBarEventMap {
|
|
56
|
+
show: CustomEvent<void>;
|
|
57
|
+
shown: CustomEvent<void>;
|
|
58
|
+
hide: CustomEvent<void>;
|
|
59
|
+
hidden: CustomEvent<void>;
|
|
60
|
+
}
|
|
55
61
|
declare global {
|
|
56
62
|
interface HTMLElementTagNameMap {
|
|
57
63
|
'mdui-bottom-app-bar': BottomAppBar;
|
|
@@ -2,7 +2,6 @@ import { __decorate } from "tslib";
|
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
4
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
5
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
6
5
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
7
6
|
import { ScrollBehaviorMixin } from '@mdui/shared/mixins/scrollBehavior.js';
|
|
8
7
|
import { LayoutItemBase } from '../layout/layout-item-base.js';
|
|
@@ -31,7 +30,7 @@ import { style } from './style.js';
|
|
|
31
30
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
32
31
|
* @cssprop --z-index - 组件的 CSS 的 `z-index` 值
|
|
33
32
|
*/
|
|
34
|
-
|
|
33
|
+
let BottomAppBar = class BottomAppBar extends ScrollBehaviorMixin(LayoutItemBase) {
|
|
35
34
|
constructor() {
|
|
36
35
|
super(...arguments);
|
|
37
36
|
/**
|
|
@@ -49,11 +48,11 @@ export let BottomAppBar = class BottomAppBar extends ScrollBehaviorMixin(LayoutI
|
|
|
49
48
|
get layoutPlacement() {
|
|
50
49
|
return 'bottom';
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
super.
|
|
51
|
+
firstUpdated(_changedProperties) {
|
|
52
|
+
super.firstUpdated(_changedProperties);
|
|
54
53
|
this.addEventListener('transitionend', (event) => {
|
|
55
54
|
if (event.target === this) {
|
|
56
|
-
emit(this
|
|
55
|
+
this.emit(this.hide ? 'hidden' : 'shown');
|
|
57
56
|
}
|
|
58
57
|
});
|
|
59
58
|
}
|
|
@@ -67,15 +66,15 @@ export let BottomAppBar = class BottomAppBar extends ScrollBehaviorMixin(LayoutI
|
|
|
67
66
|
runScrollThreshold(isScrollingUp) {
|
|
68
67
|
// 向下滚动
|
|
69
68
|
if (!isScrollingUp && !this.hide) {
|
|
70
|
-
const
|
|
71
|
-
if (
|
|
69
|
+
const eventProceeded = this.emit('hide', { cancelable: true });
|
|
70
|
+
if (eventProceeded) {
|
|
72
71
|
this.hide = true;
|
|
73
72
|
}
|
|
74
73
|
}
|
|
75
74
|
// 向上滚动
|
|
76
75
|
if (isScrollingUp && this.hide) {
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
76
|
+
const eventProceeded = this.emit('show', { cancelable: true });
|
|
77
|
+
if (eventProceeded) {
|
|
79
78
|
this.hide = false;
|
|
80
79
|
}
|
|
81
80
|
}
|
|
@@ -103,3 +102,4 @@ __decorate([
|
|
|
103
102
|
BottomAppBar = __decorate([
|
|
104
103
|
customElement('mdui-bottom-app-bar')
|
|
105
104
|
], BottomAppBar);
|
|
105
|
+
export { BottomAppBar };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import '../circular-progress.js';
|
|
3
|
-
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
3
|
+
import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
4
4
|
type RenderButtonOptions = {
|
|
5
5
|
id?: string;
|
|
6
6
|
className?: string;
|
|
@@ -8,8 +8,8 @@ type RenderButtonOptions = {
|
|
|
8
8
|
content?: TemplateResult | TemplateResult[];
|
|
9
9
|
tabindex?: number;
|
|
10
10
|
};
|
|
11
|
-
declare const ButtonBase_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
|
|
12
|
-
export declare class ButtonBase extends ButtonBase_base {
|
|
11
|
+
declare const ButtonBase_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;
|
|
12
|
+
export declare class ButtonBase<E> extends ButtonBase_base<E> {
|
|
13
13
|
static styles: CSSResultGroup;
|
|
14
14
|
/**
|
|
15
15
|
* 是否禁用
|
|
@@ -114,7 +114,6 @@ export declare class ButtonBase extends ButtonBase_base {
|
|
|
114
114
|
protected get rippleDisabled(): boolean;
|
|
115
115
|
protected get focusElement(): HTMLElement | null;
|
|
116
116
|
protected get focusDisabled(): boolean;
|
|
117
|
-
connectedCallback(): void;
|
|
118
117
|
/**
|
|
119
118
|
* 检查表单字段是否验证通过。若未通过则返回 `false`,并触发 `invalid` 事件;若验证通过,则返回 `true`
|
|
120
119
|
*/
|
|
@@ -131,6 +130,7 @@ export declare class ButtonBase extends ButtonBase_base {
|
|
|
131
130
|
* @param message 自定义的提示文本
|
|
132
131
|
*/
|
|
133
132
|
setCustomValidity(message: string): void;
|
|
133
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
134
134
|
protected renderLoading(): TemplateResult;
|
|
135
135
|
protected renderButton({ id, className, part, content, }: RenderButtonOptions): TemplateResult;
|
|
136
136
|
protected isButton(): boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
2
|
+
import { html } from 'lit';
|
|
3
3
|
import { property } from 'lit/decorators.js';
|
|
4
4
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
5
|
import cc from 'classcat';
|
|
6
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
6
7
|
import { FormController } from '@mdui/shared/controllers/form.js';
|
|
7
8
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
8
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
9
9
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
10
10
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
11
11
|
import { AnchorMixin } from '@mdui/shared/mixins/anchor.js';
|
|
@@ -13,7 +13,7 @@ import { FocusableMixin } from '@mdui/shared/mixins/focusable.js';
|
|
|
13
13
|
import '../circular-progress.js';
|
|
14
14
|
import { RippleMixin } from '../ripple/ripple-mixin.js';
|
|
15
15
|
import { buttonBaseStyle } from './button-base-style.js';
|
|
16
|
-
export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(
|
|
16
|
+
export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement))) {
|
|
17
17
|
constructor() {
|
|
18
18
|
super(...arguments);
|
|
19
19
|
/**
|
|
@@ -76,25 +76,15 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(LitElemen
|
|
|
76
76
|
return this.disabled || this.loading;
|
|
77
77
|
}
|
|
78
78
|
get focusElement() {
|
|
79
|
-
var _a, _b;
|
|
80
79
|
return this.isButton()
|
|
81
|
-
?
|
|
82
|
-
:
|
|
80
|
+
? this.renderRoot?.querySelector('._button')
|
|
81
|
+
: !this.focusDisabled
|
|
82
|
+
? this.renderRoot?.querySelector('._a')
|
|
83
|
+
: this;
|
|
83
84
|
}
|
|
84
85
|
get focusDisabled() {
|
|
85
86
|
return this.disabled || this.loading;
|
|
86
87
|
}
|
|
87
|
-
connectedCallback() {
|
|
88
|
-
super.connectedCallback();
|
|
89
|
-
this.addEventListener('click', () => {
|
|
90
|
-
if (this.type === 'submit') {
|
|
91
|
-
this.formController.submit(this);
|
|
92
|
-
}
|
|
93
|
-
if (this.type === 'reset') {
|
|
94
|
-
this.formController.reset(this);
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
88
|
/**
|
|
99
89
|
* 检查表单字段是否验证通过。若未通过则返回 `false`,并触发 `invalid` 事件;若验证通过,则返回 `true`
|
|
100
90
|
*/
|
|
@@ -102,7 +92,8 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(LitElemen
|
|
|
102
92
|
if (this.isButton()) {
|
|
103
93
|
const valid = this.focusElement.checkValidity();
|
|
104
94
|
if (!valid) {
|
|
105
|
-
|
|
95
|
+
// @ts-ignore
|
|
96
|
+
this.emit('invalid', {
|
|
106
97
|
bubbles: false,
|
|
107
98
|
cancelable: true,
|
|
108
99
|
composed: false,
|
|
@@ -121,7 +112,8 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(LitElemen
|
|
|
121
112
|
if (this.isButton()) {
|
|
122
113
|
const invalid = !this.focusElement.reportValidity();
|
|
123
114
|
if (invalid) {
|
|
124
|
-
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
this.emit('invalid', {
|
|
125
117
|
bubbles: false,
|
|
126
118
|
cancelable: true,
|
|
127
119
|
composed: false,
|
|
@@ -142,6 +134,17 @@ export class ButtonBase extends AnchorMixin(RippleMixin(FocusableMixin(LitElemen
|
|
|
142
134
|
this.focusElement.setCustomValidity(message);
|
|
143
135
|
}
|
|
144
136
|
}
|
|
137
|
+
firstUpdated(_changedProperties) {
|
|
138
|
+
super.firstUpdated(_changedProperties);
|
|
139
|
+
this.addEventListener('click', () => {
|
|
140
|
+
if (this.type === 'submit') {
|
|
141
|
+
this.formController.submit(this);
|
|
142
|
+
}
|
|
143
|
+
if (this.type === 'reset') {
|
|
144
|
+
this.formController.reset(this);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
145
148
|
renderLoading() {
|
|
146
149
|
return this.loading
|
|
147
150
|
? html `<mdui-circular-progress part="loading"></mdui-circular-progress>`
|
|
@@ -25,7 +25,7 @@ import type { TemplateResult, CSSResultGroup } from 'lit';
|
|
|
25
25
|
*
|
|
26
26
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
27
27
|
*/
|
|
28
|
-
export declare class Button extends ButtonBase {
|
|
28
|
+
export declare class Button extends ButtonBase<ButtonEventMap> {
|
|
29
29
|
static styles: CSSResultGroup;
|
|
30
30
|
/**
|
|
31
31
|
* 按钮形状。可选值为:
|
|
@@ -57,6 +57,11 @@ export declare class Button extends ButtonBase {
|
|
|
57
57
|
private renderEndIcon;
|
|
58
58
|
private renderInner;
|
|
59
59
|
}
|
|
60
|
+
export interface ButtonEventMap {
|
|
61
|
+
focus: FocusEvent;
|
|
62
|
+
blur: FocusEvent;
|
|
63
|
+
invalid: CustomEvent<void>;
|
|
64
|
+
}
|
|
60
65
|
declare global {
|
|
61
66
|
interface HTMLElementTagNameMap {
|
|
62
67
|
'mdui-button': Button;
|
|
@@ -30,7 +30,7 @@ import { style } from './style.js';
|
|
|
30
30
|
*
|
|
31
31
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
let Button = class Button extends ButtonBase {
|
|
34
34
|
constructor() {
|
|
35
35
|
super(...arguments);
|
|
36
36
|
/**
|
|
@@ -108,3 +108,4 @@ __decorate([
|
|
|
108
108
|
Button = __decorate([
|
|
109
109
|
customElement('mdui-button')
|
|
110
110
|
], Button);
|
|
111
|
+
export { Button };
|
|
@@ -24,7 +24,7 @@ import type { CSSResultGroup, PropertyValues, TemplateResult } from 'lit';
|
|
|
24
24
|
*
|
|
25
25
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
26
26
|
*/
|
|
27
|
-
export declare class ButtonIcon extends ButtonBase {
|
|
27
|
+
export declare class ButtonIcon extends ButtonBase<ButtonIconEventMap> {
|
|
28
28
|
static styles: CSSResultGroup;
|
|
29
29
|
/**
|
|
30
30
|
* 图标按钮的形状。可选值为:
|
|
@@ -59,6 +59,12 @@ export declare class ButtonIcon extends ButtonBase {
|
|
|
59
59
|
protected render(): TemplateResult;
|
|
60
60
|
private renderIcon;
|
|
61
61
|
}
|
|
62
|
+
export interface ButtonIconEventMap {
|
|
63
|
+
focus: FocusEvent;
|
|
64
|
+
blur: FocusEvent;
|
|
65
|
+
change: CustomEvent<void>;
|
|
66
|
+
invalid: CustomEvent<void>;
|
|
67
|
+
}
|
|
62
68
|
declare global {
|
|
63
69
|
interface HTMLElementTagNameMap {
|
|
64
70
|
'mdui-button-icon': ButtonIcon;
|
|
@@ -5,7 +5,6 @@ import { createRef, ref } from 'lit/directives/ref.js';
|
|
|
5
5
|
import { HasSlotController } from '@mdui/shared/controllers/has-slot.js';
|
|
6
6
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
7
7
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
8
|
-
import { emit } from '@mdui/shared/helpers/event.js';
|
|
9
8
|
import { nothingTemplate } from '@mdui/shared/helpers/template.js';
|
|
10
9
|
import { ButtonBase } from '../button/button-base.js';
|
|
11
10
|
import '../icon.js';
|
|
@@ -32,7 +31,7 @@ import { style } from './style.js';
|
|
|
32
31
|
*
|
|
33
32
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
34
33
|
*/
|
|
35
|
-
|
|
34
|
+
let ButtonIcon = class ButtonIcon extends ButtonBase {
|
|
36
35
|
constructor() {
|
|
37
36
|
super(...arguments);
|
|
38
37
|
/**
|
|
@@ -59,7 +58,7 @@ export let ButtonIcon = class ButtonIcon extends ButtonBase {
|
|
|
59
58
|
return this.rippleRef.value;
|
|
60
59
|
}
|
|
61
60
|
onSelectedChange() {
|
|
62
|
-
emit(
|
|
61
|
+
this.emit('change');
|
|
63
62
|
}
|
|
64
63
|
firstUpdated(changedProperties) {
|
|
65
64
|
super.firstUpdated(changedProperties);
|
|
@@ -127,3 +126,4 @@ __decorate([
|
|
|
127
126
|
ButtonIcon = __decorate([
|
|
128
127
|
customElement('mdui-button-icon')
|
|
129
128
|
], ButtonIcon);
|
|
129
|
+
export { ButtonIcon };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import type { Ripple } from '../ripple/index.js';
|
|
3
3
|
import type { TemplateResult, CSSResultGroup } from 'lit';
|
|
4
|
-
declare const Card_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
|
|
4
|
+
declare const Card_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;
|
|
5
5
|
/**
|
|
6
6
|
* @summary 卡片组件
|
|
7
7
|
*
|
|
@@ -16,7 +16,7 @@ declare const Card_base: import("@open-wc/dedupe-mixin").Constructor<import("@md
|
|
|
16
16
|
*
|
|
17
17
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
18
18
|
*/
|
|
19
|
-
export declare class Card extends Card_base {
|
|
19
|
+
export declare class Card extends Card_base<CardEventMap> {
|
|
20
20
|
static styles: CSSResultGroup;
|
|
21
21
|
/**
|
|
22
22
|
* 卡片形状。可选值为:
|
|
@@ -37,10 +37,14 @@ export declare class Card extends Card_base {
|
|
|
37
37
|
private readonly rippleRef;
|
|
38
38
|
protected get rippleElement(): Ripple;
|
|
39
39
|
protected get rippleDisabled(): boolean;
|
|
40
|
-
protected get focusElement(): HTMLElement;
|
|
40
|
+
protected get focusElement(): HTMLElement | null;
|
|
41
41
|
protected get focusDisabled(): boolean;
|
|
42
42
|
protected render(): TemplateResult;
|
|
43
43
|
}
|
|
44
|
+
export interface CardEventMap {
|
|
45
|
+
focus: FocusEvent;
|
|
46
|
+
blur: FocusEvent;
|
|
47
|
+
}
|
|
44
48
|
declare global {
|
|
45
49
|
interface HTMLElementTagNameMap {
|
|
46
50
|
'mdui-card': Card;
|
package/components/card/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import {
|
|
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
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
5
6
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
6
7
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
7
8
|
import { AnchorMixin } from '@mdui/shared/mixins/anchor.js';
|
|
@@ -22,7 +23,7 @@ import { style } from './style.js';
|
|
|
22
23
|
*
|
|
23
24
|
* @cssprop --shape-corner - 组件的圆角大小。可以指定一个具体的像素值;但更推荐[引用设计令牌](/docs/2/styles/design-tokens#shape-corner)
|
|
24
25
|
*/
|
|
25
|
-
|
|
26
|
+
let Card = class Card extends AnchorMixin(RippleMixin(FocusableMixin(MduiElement))) {
|
|
26
27
|
constructor() {
|
|
27
28
|
super(...arguments);
|
|
28
29
|
/**
|
|
@@ -50,7 +51,9 @@ export let Card = class Card extends AnchorMixin(RippleMixin(FocusableMixin(LitE
|
|
|
50
51
|
return this.disabled || (!this.href && !this.clickable);
|
|
51
52
|
}
|
|
52
53
|
get focusElement() {
|
|
53
|
-
return this
|
|
54
|
+
return this.href && !this.disabled
|
|
55
|
+
? this.renderRoot.querySelector('._a')
|
|
56
|
+
: this;
|
|
54
57
|
}
|
|
55
58
|
get focusDisabled() {
|
|
56
59
|
return this.rippleDisabled;
|
|
@@ -85,3 +88,4 @@ __decorate([
|
|
|
85
88
|
Card = __decorate([
|
|
86
89
|
customElement('mdui-card')
|
|
87
90
|
], Card);
|
|
91
|
+
export { Card };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MduiElement } from '@mdui/shared/base/mdui-element.js';
|
|
2
2
|
import '@mdui/shared/icons/check-box-outline-blank.js';
|
|
3
3
|
import '@mdui/shared/icons/check-box.js';
|
|
4
4
|
import '@mdui/shared/icons/indeterminate-check-box.js';
|
|
@@ -6,7 +6,7 @@ import '../icon.js';
|
|
|
6
6
|
import type { Ripple } from '../ripple/index.js';
|
|
7
7
|
import type { FormControl } from '@mdui/jq/shared/form.js';
|
|
8
8
|
import type { TemplateResult, CSSResultGroup } from 'lit';
|
|
9
|
-
declare const Checkbox_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
|
|
9
|
+
declare const Checkbox_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;
|
|
10
10
|
/**
|
|
11
11
|
* @summary 复选框组件
|
|
12
12
|
*
|
|
@@ -31,7 +31,7 @@ declare const Checkbox_base: import("@open-wc/dedupe-mixin").Constructor<import(
|
|
|
31
31
|
* @csspart indeterminate-icon - 不确定状态图标
|
|
32
32
|
* @csspart label - 文本
|
|
33
33
|
*/
|
|
34
|
-
export declare class Checkbox extends Checkbox_base implements FormControl {
|
|
34
|
+
export declare class Checkbox extends Checkbox_base<CheckboxEventMap> implements FormControl {
|
|
35
35
|
static styles: CSSResultGroup;
|
|
36
36
|
/**
|
|
37
37
|
* 是否为禁用状态
|
|
@@ -122,6 +122,13 @@ export declare class Checkbox extends Checkbox_base implements FormControl {
|
|
|
122
122
|
*/
|
|
123
123
|
private onChange;
|
|
124
124
|
}
|
|
125
|
+
export interface CheckboxEventMap {
|
|
126
|
+
focus: FocusEvent;
|
|
127
|
+
blur: FocusEvent;
|
|
128
|
+
change: CustomEvent<void>;
|
|
129
|
+
input: Event;
|
|
130
|
+
invalid: CustomEvent<void>;
|
|
131
|
+
}
|
|
125
132
|
declare global {
|
|
126
133
|
interface HTMLElementTagNameMap {
|
|
127
134
|
'mdui-checkbox': Checkbox;
|