Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: loading add fullscreen property #3427

Merged
merged 10 commits into from
Jan 8, 2025
Merged
1 change: 1 addition & 0 deletions src/action-sheet/__test__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ exports[`ActionSheet ActionSheet list demo works fine 1`] = `
<list>
<t-action-sheet
id="t-action-sheet"
showOverlay="{{false}}"
usingCustomNavbar="{{true}}"
bind:selected="handleSelected"
/>
Expand Down
2 changes: 1 addition & 1 deletion src/action-sheet/_example/list/index.wxml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<t-action-sheet id="t-action-sheet" usingCustomNavbar bind:selected="handleSelected" />
<t-action-sheet id="t-action-sheet" usingCustomNavbar bind:selected="handleSelected" show-overlay="{{false}}" />

anlyyao marked this conversation as resolved.
Show resolved Hide resolved
<t-button size="large" variant="outline" bind:tap="handleAction" block theme="primary">列表型</t-button>

Expand Down
6 changes: 3 additions & 3 deletions src/image-viewer/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ exports[`image-viewer :base 1`] = `
tClassText="t-image--loading-text"
>
<wx-view
class="class t-class t-loading t-loading--horizontal"
class="class t-class t-loading t-loading--horizontal "
style="width: 44rpx; height: 44rpx; color: inherit;"
>
<wx-view
Expand Down Expand Up @@ -90,7 +90,7 @@ exports[`image-viewer :base 2`] = `
tClassText="t-image--loading-text"
>
<wx-view
class="class t-class t-loading t-loading--horizontal"
class="class t-class t-loading t-loading--horizontal "
style="width: 44rpx; height: 44rpx; color: inherit;"
>
<wx-view
Expand Down Expand Up @@ -159,7 +159,7 @@ exports[`image-viewer :base 3`] = `
tClassText="t-image--loading-text"
>
<wx-view
class="class t-class t-loading t-loading--horizontal"
class="class t-class t-loading t-loading--horizontal "
style="width: 44rpx; height: 44rpx; color: inherit;"
>
<wx-view
Expand Down
2 changes: 1 addition & 1 deletion src/image/__test__/__snapshots__/index.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ exports[`image :base 1`] = `
tClassText="t-image--loading-text"
>
<wx-view
class="class t-class t-loading t-loading--horizontal"
class="class t-class t-loading t-loading--horizontal "
style="width: 44rpx; height: 44rpx; color: inherit;"
>
<wx-view
Expand Down
1 change: 1 addition & 0 deletions src/loading/README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ style | Object | - | CSS(Cascading Style Sheets) | N
custom-style | Object | - | CSS(Cascading Style Sheets),used to set style on virtual component | N
delay | Number | 0 | \- | N
duration | Number | 800 | \- | N
fullscreen | Boolean | true | \- | N
indicator | Boolean / Slot | true | [see more ts definition](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
inherit-color | Boolean | false | \- | N
layout | String | horizontal | options: horizontal/vertical | N
Expand Down
1 change: 1 addition & 0 deletions src/loading/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ style | Object | - | 样式 | N
custom-style | Object | - | 样式,一般用于开启虚拟化组件节点场景 | N
delay | Number | 0 | 延迟显示加载效果的时间,用于防止请求速度过快引起的加载闪烁,单位:毫秒 | N
duration | Number | 800 | 加载动画执行完成一次的时间,单位:毫秒 | N
fullscreen | Boolean | true | 是否显示为全屏加载 | N
anlyyao marked this conversation as resolved.
Show resolved Hide resolved
indicator | Boolean / Slot | true | 加载指示符,值为 true 显示默认指示符,值为 false 则不显示,也可以自定义指示符。[通用类型定义](https://github.com/Tencent/tdesign-miniprogram/blob/develop/src/common/common.ts) | N
inherit-color | Boolean | false | 是否继承父元素颜色 | N
layout | String | horizontal | 对齐方式。可选项:horizontal/vertical | N
Expand Down
15 changes: 15 additions & 0 deletions src/loading/loading.less
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@
@loading-text-color: var(--td-loading-text-color, @text-color-primary);
@loading-text-font-size: var(--td-loading-text-font-size, 24rpx);
@loading-text-line-height: var(--td-loading-text-line-height, 40rpx);
@loading-z-index: 999;

.@{loading} {
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 24rpx;

&--fullscreen {
anlyyao marked this conversation as resolved.
Show resolved Hide resolved
position: fixed;
display: flex;
align-items: center;
vertical-align: middle;
justify-content: center;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
transform: translate(-50%, -50%);
z-index: @loading-z-index;
}

&__spinner {
position: relative;
box-sizing: border-box;
Expand Down
2 changes: 1 addition & 1 deletion src/loading/loading.wxml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<wxs src="../common/utils.wxs" module="_" />
<view
style="{{_._style([style, customStyle, !text ? ('width: ' + _.addUnit(size) + '; height: ' + _.addUnit(size)) : '', show ? '' : 'display: none', inheritColor ? 'color: inherit' : ''])}}"
class="class {{prefix}}-class {{classPrefix}} {{classPrefix + '--' + layout}}"
class="class {{prefix}}-class {{classPrefix}} {{classPrefix + '--' + layout}} {{fullscreen ? classPrefix + '--fullscreen' : ''}}"
>
<view
wx:if="{{indicator}}"
Expand Down
5 changes: 5 additions & 0 deletions src/loading/props.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ const props: TdLoadingProps = {
type: Number,
value: 800,
},
/** 是否显示为全屏加载 */
fullscreen: {
type: Boolean,
value: false,
},
/** 组件类名,分别用于设置加载组件外层元素,加载组件文本,加载组件指示符,加载指示符内侧同心圆等元素类名 */
externalClasses: {
type: Array,
Expand Down
8 changes: 8 additions & 0 deletions src/loading/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ export interface TdLoadingProps {
type: NumberConstructor;
value?: number;
};
/**
* 是否显示为全屏加载
* @default false
*/
fullscreen?: {
type: BooleanConstructor;
value?: boolean;
};
/**
* 组件类名,分别用于设置加载组件外层元素,加载组件文本,加载组件指示符,加载指示符内侧同心圆等元素类名
*/
Expand Down
Loading