mdui 2.1.2 → 2.1.4
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/bottom-app-bar/style.js +1 -1
- package/components/button/style.js +2 -2
- package/components/button-icon/style.js +2 -2
- package/components/card/style.js +1 -1
- package/components/checkbox/style.js +1 -1
- package/components/chip/style.js +2 -2
- package/components/collapse/collapse-item.js +1 -0
- package/components/dialog/style.js +1 -1
- package/components/divider/style.js +1 -1
- package/components/dropdown/index.js +9 -4
- package/components/fab/style.js +1 -1
- package/components/icon/index.js +1 -1
- package/components/layout/layout-style.js +1 -1
- package/components/list/list-item-style.js +2 -2
- package/components/list/list-item.js +5 -4
- package/components/menu/menu-item-style.js +1 -1
- package/components/navigation-bar/navigation-bar-style.js +1 -1
- package/components/navigation-drawer/index.d.ts +1 -0
- package/components/navigation-drawer/index.js +17 -11
- package/components/navigation-drawer/style.js +1 -1
- package/components/navigation-rail/navigation-rail-style.js +1 -1
- package/components/radio/radio-style.js +1 -1
- package/components/segmented-button/segmented-button-group-style.js +1 -1
- package/components/segmented-button/segmented-button-style.js +1 -1
- package/components/select/index.d.ts +0 -2
- package/components/select/index.js +4 -5
- package/components/slider/slider-base-style.js +1 -1
- package/components/snackbar/index.d.ts +12 -0
- package/components/snackbar/index.js +105 -46
- package/components/snackbar/style.js +1 -1
- package/components/switch/style.js +1 -1
- package/components/tabs/tab-style.js +1 -1
- package/components/tabs/tabs-style.js +1 -1
- package/components/tabs/tabs.d.ts +2 -2
- package/components/tabs/tabs.js +6 -4
- package/components/text-field/index.d.ts +5 -7
- package/components/text-field/index.js +32 -36
- package/components/text-field/style.js +1 -1
- package/components/tooltip/index.d.ts +1 -1
- package/components/tooltip/index.js +10 -8
- package/components/top-app-bar/top-app-bar-style.js +1 -1
- package/components/top-app-bar/top-app-bar.d.ts +1 -0
- package/components/top-app-bar/top-app-bar.js +7 -1
- package/custom-elements.json +246 -153
- package/functions/alert.js +10 -3
- package/functions/confirm.js +10 -3
- package/functions/dialog.js +8 -3
- package/functions/prompt.js +10 -3
- package/functions/snackbar.js +8 -2
- package/html-data.en.json +12 -22
- package/html-data.zh-cn.json +2 -12
- package/jsx.en.d.ts +2079 -2080
- package/jsx.zh-cn.d.ts +2062 -2063
- package/locales/ar-eg.js +0 -2
- package/locales/az-az.js +0 -2
- package/locales/be-by.js +0 -2
- package/locales/bg-bg.js +0 -2
- package/locales/bn-bd.js +0 -2
- package/locales/ca-es.js +0 -2
- package/locales/cs-cz.js +0 -2
- package/locales/da-dk.js +0 -2
- package/locales/de-de.js +0 -2
- package/locales/el-gr.js +0 -2
- package/locales/en-gb.js +0 -2
- package/locales/es-es.js +0 -2
- package/locales/et-ee.js +0 -2
- package/locales/fa-ir.js +0 -2
- package/locales/fi-fi.js +0 -2
- package/locales/fr-be.js +0 -2
- package/locales/fr-ca.js +0 -2
- package/locales/fr-fr.js +0 -2
- package/locales/ga-ie.js +0 -2
- package/locales/gl-es.js +0 -2
- package/locales/he-il.js +0 -2
- package/locales/hi-in.js +0 -2
- package/locales/hr-hr.js +0 -2
- package/locales/hu-hu.js +0 -2
- package/locales/hy-am.js +0 -2
- package/locales/id-id.js +0 -2
- package/locales/is-is.js +0 -2
- package/locales/it-it.js +0 -2
- package/locales/ja-jp.js +0 -2
- package/locales/ka-ge.js +0 -2
- package/locales/kk-kz.js +0 -2
- package/locales/km-kh.js +0 -2
- package/locales/kmr-iq.js +0 -2
- package/locales/kn-in.js +0 -2
- package/locales/ko-kr.js +0 -2
- package/locales/lt-lt.js +0 -2
- package/locales/lv-lv.js +0 -2
- package/locales/mk-mk.js +0 -2
- package/locales/ml-in.js +0 -2
- package/locales/mn-mn.js +0 -2
- package/locales/ms-my.js +0 -2
- package/locales/nb-no.js +0 -2
- package/locales/ne-np.js +0 -2
- package/locales/nl-be.js +0 -2
- package/locales/nl-nl.js +0 -2
- package/locales/pl-pl.js +0 -2
- package/locales/pt-br.js +0 -2
- package/locales/pt-pt.js +0 -2
- package/locales/ro-ro.js +0 -2
- package/locales/ru-ru.js +0 -2
- package/locales/sk-sk.js +0 -2
- package/locales/sl-si.js +0 -2
- package/locales/sr-rs.js +0 -2
- package/locales/sv-se.js +0 -2
- package/locales/ta-in.js +0 -2
- package/locales/th-th.js +0 -2
- package/locales/tr-tr.js +0 -2
- package/locales/uk-ua.js +0 -2
- package/locales/ur-pk.js +0 -2
- package/locales/vi-vn.js +0 -2
- package/locales/zh-cn.js +0 -2
- package/locales/zh-hk.js +0 -2
- package/locales/zh-tw.js +0 -2
- package/mdui.css +1 -1
- package/mdui.esm.js +9 -9
- package/mdui.global.js +9 -9
- package/package.json +9 -10
- package/web-types.en.json +17 -23
- package/web-types.zh-cn.json +7 -13
|
@@ -62,7 +62,7 @@ let Tooltip = class Tooltip extends MduiElement {
|
|
|
62
62
|
/**
|
|
63
63
|
* tooltip 的位置。默认为 `auto`。可选值包括:
|
|
64
64
|
*
|
|
65
|
-
* * `auto`:自动判断位置。`variant="
|
|
65
|
+
* * `auto`:自动判断位置。`variant="plain"` 时,优先使用 `top`;`variant="rich"` 时,优先使用 `bottom-right`
|
|
66
66
|
* * `top-left`:位于左上方
|
|
67
67
|
* * `top-start`:位于上方,左对齐
|
|
68
68
|
* * `top`:位于上方,居中对齐
|
|
@@ -182,9 +182,15 @@ let Tooltip = class Tooltip extends MduiElement {
|
|
|
182
182
|
connectedCallback() {
|
|
183
183
|
super.connectedCallback();
|
|
184
184
|
document.addEventListener('pointerdown', this.onDocumentClick);
|
|
185
|
-
this.
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
this.definedController.whenDefined().then(() => {
|
|
186
|
+
this.overflowAncestors = getOverflowAncestors(this.target);
|
|
187
|
+
this.overflowAncestors.forEach((ancestor) => {
|
|
188
|
+
ancestor.addEventListener('scroll', this.onWindowScroll);
|
|
189
|
+
});
|
|
190
|
+
// trigger 尺寸变化时,重新调整 tooltip 的位置
|
|
191
|
+
this.observeResize = observeResize(this.target, () => {
|
|
192
|
+
this.updatePositioner();
|
|
193
|
+
});
|
|
188
194
|
});
|
|
189
195
|
}
|
|
190
196
|
disconnectedCallback() {
|
|
@@ -205,10 +211,6 @@ let Tooltip = class Tooltip extends MduiElement {
|
|
|
205
211
|
target.addEventListener('keydown', this.onKeydown);
|
|
206
212
|
target.addEventListener('mouseenter', this.onMouseEnter);
|
|
207
213
|
target.addEventListener('mouseleave', this.onMouseLeave);
|
|
208
|
-
// trigger 尺寸变化时,重新调整 tooltip 的位置
|
|
209
|
-
this.observeResize = observeResize(target, () => {
|
|
210
|
-
this.updatePositioner();
|
|
211
|
-
});
|
|
212
214
|
});
|
|
213
215
|
}
|
|
214
216
|
render() {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
export const topAppBarStyle = css `:host{--shape-corner:var(--mdui-shape-corner-none);--z-index:2000;position:fixed;top:0;right:0;left:0;display:flex;flex:0 0 auto;align-items:flex-start;justify-content:flex-start;border-bottom-left-radius:var(--shape-corner);border-bottom-right-radius:var(--shape-corner);z-index:var(--z-index);transition:top var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard),height var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard),box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear),background-color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);padding:.75rem .5rem;height:4rem;background-color:rgb(var(--mdui-color-surface))}:host([scroll-target]:not([scroll-target=''])){position:absolute}:host([scroll-behavior~=shrink]){transition-duration:var(--mdui-motion-duration-short4)}:host([scrolling]){background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2)}::slotted(mdui-button-icon){color:rgb(var(--mdui-color-on-surface-variant));font-size:1.5rem}::slotted(mdui-button-icon:first-child){color:rgb(var(--mdui-color-on-surface))}::slotted(mdui-avatar){width:1.875rem;height:1.875rem;margin-top:.3125rem;margin-bottom:.3125rem}::slotted(*){flex-shrink:0}::slotted(:not(:last-child)){margin-right:.5rem}:host([variant=medium]){height:7rem}:host([variant=large]){height:9.5rem}:host([hide]){transition-duration:var(--mdui-motion-duration-short4);top:-4.625rem}:host([hide][variant=medium]){top:-7.625rem}:host([hide][variant=large]){top:-10.125rem}:host([shrink][variant=large]),:host([shrink][variant=medium]){transition-duration:var(--mdui-motion-duration-short4);height:4rem}`;
|
|
2
|
+
export const topAppBarStyle = css `:host{--shape-corner:var(--mdui-shape-corner-none);--z-index:2000;position:fixed;top:0;right:0;left:0;display:flex;flex:0 0 auto;align-items:flex-start;justify-content:flex-start;border-bottom-left-radius:var(--shape-corner);border-bottom-right-radius:var(--shape-corner);z-index:var(--z-index);transition:top var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard),height var(--mdui-motion-duration-long2) var(--mdui-motion-easing-standard),box-shadow var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear),background-color var(--mdui-motion-duration-short4) var(--mdui-motion-easing-linear);padding:.75rem .5rem;height:4rem;background-color:rgb(var(--mdui-color-surface))}:host([scroll-target]:not([scroll-target=''])){position:absolute}:host([scroll-behavior~=shrink]){transition-duration:var(--mdui-motion-duration-short4)}:host([scrolling]){background-color:rgb(var(--mdui-color-surface-container));box-shadow:var(--mdui-elevation-level2)}::slotted(mdui-button-icon){color:rgb(var(--mdui-color-on-surface-variant));font-size:1.5rem}::slotted(mdui-button-icon:first-child){color:rgb(var(--mdui-color-on-surface))}::slotted(mdui-avatar){width:1.875rem;height:1.875rem;margin-top:.3125rem;margin-bottom:.3125rem}::slotted(*){flex-shrink:0}::slotted(:not(:last-child)){margin-right:.5rem}:host([variant=medium]){height:7rem}:host([variant=large]){height:9.5rem}:host([hide]:not([hide=false i])){transition-duration:var(--mdui-motion-duration-short4);top:-4.625rem}:host([hide][variant=medium]:not([hide=false i])){top:-7.625rem}:host([hide][variant=large]:not([hide=false i])){top:-10.125rem}:host([shrink][variant=large]:not([shrink=false i])),:host([shrink][variant=medium]:not([shrink=false i])){transition-duration:var(--mdui-motion-duration-short4);height:4rem}`;
|
|
@@ -57,6 +57,7 @@ export declare class TopAppBar extends TopAppBar_base<TopAppBarEventMap> {
|
|
|
57
57
|
*/
|
|
58
58
|
private scrolling;
|
|
59
59
|
private readonly titleElements;
|
|
60
|
+
private definedController;
|
|
60
61
|
protected get scrollPaddingPosition(): ScrollPaddingPosition;
|
|
61
62
|
protected get layoutPlacement(): LayoutPlacement;
|
|
62
63
|
private onVariantChange;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement, property, queryAssignedElements, } from 'lit/decorators.js';
|
|
4
|
+
import { DefinedController } from '@mdui/shared/controllers/defined.js';
|
|
4
5
|
import { watch } from '@mdui/shared/decorators/watch.js';
|
|
5
6
|
import { booleanConverter } from '@mdui/shared/helpers/decorator.js';
|
|
6
7
|
import { componentStyle } from '@mdui/shared/lit-styles/component-style.js';
|
|
@@ -53,6 +54,9 @@ let TopAppBar = class TopAppBar extends ScrollBehaviorMixin(LayoutItemBase) {
|
|
|
53
54
|
* 滚动条是否不位于顶部
|
|
54
55
|
*/
|
|
55
56
|
this.scrolling = false;
|
|
57
|
+
this.definedController = new DefinedController(this, {
|
|
58
|
+
relatedElements: ['mdui-top-app-bar-title'],
|
|
59
|
+
});
|
|
56
60
|
}
|
|
57
61
|
get scrollPaddingPosition() {
|
|
58
62
|
return 'top';
|
|
@@ -65,12 +69,13 @@ let TopAppBar = class TopAppBar extends ScrollBehaviorMixin(LayoutItemBase) {
|
|
|
65
69
|
// variant 变更时,重新为 scrollTargetContainer 元素添加 padding-top。避免 top-app-bar 覆盖内容
|
|
66
70
|
this.addEventListener('transitionend', async () => {
|
|
67
71
|
await this.scrollBehaviorDefinedController.whenDefined();
|
|
68
|
-
this.
|
|
72
|
+
this.setContainerPadding('update', this.scrollTarget);
|
|
69
73
|
}, { once: true });
|
|
70
74
|
}
|
|
71
75
|
else {
|
|
72
76
|
await this.updateComplete;
|
|
73
77
|
}
|
|
78
|
+
await this.definedController.whenDefined();
|
|
74
79
|
this.titleElements.forEach((titleElement) => {
|
|
75
80
|
titleElement.variant = this.variant;
|
|
76
81
|
});
|
|
@@ -79,6 +84,7 @@ let TopAppBar = class TopAppBar extends ScrollBehaviorMixin(LayoutItemBase) {
|
|
|
79
84
|
if (!this.hasUpdated) {
|
|
80
85
|
await this.updateComplete;
|
|
81
86
|
}
|
|
87
|
+
await this.definedController.whenDefined();
|
|
82
88
|
this.titleElements.forEach((titleElement) => {
|
|
83
89
|
titleElement.shrink = this.shrink;
|
|
84
90
|
});
|