This commit is contained in:
Ling53666
2025-08-18 09:11:51 +08:00
commit 02554225da
2516 changed files with 133155 additions and 0 deletions

View File

@ -0,0 +1,10 @@
<import-sjs
from="./index.sjs"
name="utils"
></import-sjs>
<view
a:if="{{loading}}"
style="{{style}}"
class="ant-skeleton-avatar ant-skeleton-avatar-{{shape}} {{animate ? 'ant-skeleton-avatar-animate' : ''}} {{utils.getClass(size)}} {{className || ''}}"
></view>
<slot a:else></slot>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,3 @@
import { Component } from '../../_util/simply';
import { SkeletonAvatarDefaultProps } from './props';
Component(SkeletonAvatarDefaultProps);

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,33 @@
@import (reference) '../variable.less';
@import (reference) '../../Avatar/variable.less';
.@{skeletonPrefix}-avatar {
&-animate {
.skeleton-animation();
}
width: @avatar-size;
height: @avatar-size;
border-radius: @default-radius;
background: @skeleton-fill;
display: inline-block;
&-circle {
border-radius: 50%;
}
&-x-small {
width: @avatar-size-x-small;
height: @avatar-size-x-small;
}
&-small {
width: @avatar-size-small;
height: @avatar-size-small;
}
&-medium {
width: @avatar-size-medium;
height: @avatar-size-medium;
}
&-large {
width: @avatar-size-large;
height: @avatar-size-large;
}
}

View File

@ -0,0 +1,10 @@
function getClass(size) {
var list = ['x-small', 'small', 'medium', 'large'];
if (list.indexOf(size) >= 0) {
return "ant-skeleton-avatar-".concat(size);
}
return 'ant-skeleton-avatar-medium';
}
export default {
getClass: getClass
};

View File

@ -0,0 +1,6 @@
import { ISkeletonBaseProps } from '../props';
export interface SkeletonAvatarProps extends ISkeletonBaseProps {
shape: 'circle' | 'square';
size: 'x-small' | 'small' | 'medium' | 'large';
}
export declare const SkeletonAvatarDefaultProps: Partial<SkeletonAvatarProps>;

View File

@ -0,0 +1,3 @@
import { __assign } from "tslib";
import { SkeletonDefaultBaseProps } from '../props';
export var SkeletonAvatarDefaultProps = __assign(__assign({}, SkeletonDefaultBaseProps), { shape: 'square', size: 'medium' });

View File

@ -0,0 +1,10 @@
<import-sjs
from="./index.sjs"
name="utils"
></import-sjs>
<view
a:if="{{loading}}"
class="ant-skeleton-button {{animate ? 'ant-skeleton-button-animate' : ''}} {{utils.getClass(size)}} {{className || ''}}"
style="{{style}}"
></view>
<slot a:else></slot>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,3 @@
import { Component } from '../../_util/simply';
import { SkeletonButtonDefaultProps } from './props';
Component(SkeletonButtonDefaultProps);

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,28 @@
@import (reference) '../variable.less';
.@{skeletonPrefix}-button {
&-animate {
.skeleton-animation();
}
&-large {
font-size: 36 * @rpx;
padding: 24 * @rpx 24 * @rpx 24 * @rpx 24 * @rpx;
}
&-medium {
font-size: 34 * @rpx;
padding: 16 * @rpx 24 * @rpx 16 * @rpx 24 * @rpx;
}
&-small {
font-size: 30 * @rpx;
padding: 8 * @rpx 24 * @rpx 8 * @rpx 24 * @rpx;
}
width: @button-width;
height: @button-height;
border-radius: @default-radius;
background: @skeleton-fill;
display: inline-block;
}

View File

@ -0,0 +1,10 @@
function getClass(size) {
var list = ['small', 'medium', 'large'];
if (list.indexOf(size) >= 0) {
return "ant-skeleton-button-".concat(size);
}
return 'ant-skeleton-button-medium';
}
export default {
getClass: getClass
};

View File

@ -0,0 +1,5 @@
import { ISkeletonBaseProps } from '../props';
export interface SkeletonButtonProps extends ISkeletonBaseProps {
size?: 'small' | 'medium' | 'large';
}
export declare const SkeletonButtonDefaultProps: Partial<SkeletonButtonProps>;

View File

@ -0,0 +1,3 @@
import { __assign } from "tslib";
import { SkeletonDefaultBaseProps } from '../props';
export var SkeletonButtonDefaultProps = __assign(__assign({}, SkeletonDefaultBaseProps), { size: 'medium' });

View File

@ -0,0 +1,6 @@
<view
a:if="{{loading}}"
class="ant-skeleton-input {{animate ? 'ant-skeleton-input-animate' : ''}} {{className || ''}}"
style="{{style}}"
></view>
<slot a:else></slot>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,3 @@
import { Component } from '../../_util/simply';
import { SkeletonInputDefaultProps } from './props';
Component(SkeletonInputDefaultProps);

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,12 @@
@import (reference) '../variable.less';
.@{skeletonPrefix}-input {
&-animate {
.skeleton-animation();
}
width: @input-width;
height: @input-height;
border-radius: @default-radius;
background: @skeleton-fill;
display: inline-block;
}

View File

@ -0,0 +1,4 @@
import { ISkeletonBaseProps } from '../props';
export interface SkeletonInputProps extends ISkeletonBaseProps {
}
export declare const SkeletonInputDefaultProps: Partial<SkeletonInputProps>;

View File

@ -0,0 +1,3 @@
import { __assign } from "tslib";
import { SkeletonDefaultBaseProps } from '../props';
export var SkeletonInputDefaultProps = __assign({}, SkeletonDefaultBaseProps);

View File

@ -0,0 +1,14 @@
<view
a:if="{{loading && rows > 0}}"
class="ant-skeleton-paragraph {{animate ? 'ant-skeleton-paragraph-animate' : ''}} {{className || ''}}"
style="{{style}}"
>
<block
a:for="{{rows}}"
a:for-index="index"
a:for-item="item"
>
<view class="ant-skeleton-paragraph-row"></view>
</block>
</view>
<slot a:else></slot>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,3 @@
import { Component } from '../../_util/simply';
import { SkeletonParagraphDefaultProps } from './props';
Component(SkeletonParagraphDefaultProps);

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,22 @@
@import '../variable.less';
.@{skeletonPrefix}-paragraph {
&-animate {
.@{skeletonPrefix}-paragraph-row {
.skeleton-animation();
}
}
&-row {
width: 100%;
height: 30 * @rpx;
margin-bottom: 24 * @rpx;
border-radius: @default-radius;
background: @skeleton-fill;
&:nth-last-of-type(1) {
margin-bottom: 0;
&:not(:nth-of-type(1)) {
width: 60%;
}
}
}
}

View File

@ -0,0 +1,5 @@
import { ISkeletonBaseProps } from '../props';
export interface SkeletonParagraphProps extends ISkeletonBaseProps {
rows: number;
}
export declare const SkeletonParagraphDefaultProps: Partial<SkeletonParagraphProps>;

View File

@ -0,0 +1,3 @@
import { __assign } from "tslib";
import { SkeletonDefaultBaseProps } from '../props';
export var SkeletonParagraphDefaultProps = __assign(__assign({}, SkeletonDefaultBaseProps), { rows: 3 });

View File

@ -0,0 +1,6 @@
<view
a:if="{{loading}}"
class="ant-skeleton-title {{animate ? 'ant-skeleton-title-animate' : ''}} {{className || ''}}"
style="{{style}}"
></view>
<slot a:else></slot>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,3 @@
import { Component } from '../../_util/simply';
import { SkeletonTitleDefaultProps } from './props';
Component(SkeletonTitleDefaultProps);

View File

@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@ -0,0 +1,12 @@
@import '../variable.less';
.@{skeletonPrefix}-title {
&-animate {
.skeleton-animation();
}
height: 40 * @rpx;
width: 45%;
margin-bottom: 40 * @rpx;
border-radius: @default-radius;
background: @skeleton-fill;
}

View File

@ -0,0 +1,4 @@
import { ISkeletonBaseProps } from '../props';
export interface SkeletonTitleProps extends ISkeletonBaseProps {
}
export declare const SkeletonTitleDefaultProps: Partial<SkeletonTitleProps>;

View File

@ -0,0 +1,3 @@
import { __assign } from "tslib";
import { SkeletonDefaultBaseProps } from '../props';
export var SkeletonTitleDefaultProps = __assign({}, SkeletonDefaultBaseProps);

View File

@ -0,0 +1,29 @@
<view
a:if="{{loading}}"
class="ant-skeleton {{className || ''}}"
>
<view
a:if="{{avatar}}"
class="ant-skeleton-avatar-wrapper"
>
<avatar
animate="{{animate}}"
loading
size="{{avatar === true ? 'medium' : avatar.size}}"
></avatar>
</view>
<view class="ant-skeleton-content-wrapper">
<title
a:if="{{title}}"
animate="{{animate}}"
loading
></title>
<paragraph
a:if="{{paragraph}}"
animate="{{animate}}"
rows="{{paragraph === true ? 3 : paragraph.rows}}"
loading
></paragraph>
</view>
</view>
<slot a:else></slot>

View File

@ -0,0 +1 @@
export {};

View File

@ -0,0 +1,3 @@
import { Component } from '../_util/simply';
import { SkeletonDefaultProps } from './props';
Component(SkeletonDefaultProps);

View File

@ -0,0 +1,8 @@
{
"component": true,
"usingComponents": {
"avatar": "./Avatar/index",
"paragraph": "./Paragraph/index",
"title": "./Title/index"
}
}

View File

@ -0,0 +1,20 @@
@import (reference) './variable.less';
.@{skeletonPrefix} {
display: flex;
align-items: flex-start;
width: 100%;
flex: 1;
flex-wrap: nowrap;
&-avatar-wrapper {
flex-shrink: 0;
padding-right: 32 * @rpx;
& + .@{skeletonPrefix}-content-wrapper {
padding-top: 24 * @rpx;
}
}
&-content-wrapper {
flex: 1;
width: 100%;
}
}

View File

@ -0,0 +1,40 @@
import { IBaseProps } from '../_util/base';
export interface ISkeletonBaseProps extends IBaseProps {
/**
* @description 为 true 时,显示占位图。反之则直接展示子组件
* @default true
*/
loading?: boolean;
/**
* @description 是否展示动画效果
* @default false
*/
animate?: boolean;
}
/**
* @description 骨架屏
*/
export interface ISkeletonProps extends ISkeletonBaseProps {
/**
* @description 是否显示头像占位图
* @default false
*/
avatar?: boolean | {
shape?: 'circle' | 'square';
size?: 'x-small' | 'small' | 'medium' | 'large';
};
/**
* @description 是否显示标题占位图
* @default true
*/
title?: boolean;
/**
* @description 段落
* @default true
*/
paragraph?: boolean | {
rows?: number;
};
}
export declare const SkeletonDefaultBaseProps: ISkeletonBaseProps;
export declare const SkeletonDefaultProps: Partial<ISkeletonProps>;

View File

@ -0,0 +1,11 @@
export var SkeletonDefaultBaseProps = {
loading: true,
animate: false,
};
export var SkeletonDefaultProps = {
loading: true,
animate: false,
avatar: false,
title: true,
paragraph: true,
};

View File

@ -0,0 +1,35 @@
@import (reference) '../style/themes/index.less';
@skeletonPrefix: ant-skeleton;
@skeleton-fill: @COLOR_BORDER;
@avatar-size: 88 * @rpx;
@default-radius: 8 * @rpx;
@button-width: 120 * @rpx;
@button-height: 48 * @rpx;
@input-width: 400 * @rpx;
@input-height: 40 * @rpx;
.skeleton-animation() {
background: linear-gradient(
90deg,
@COLOR_BORDER 25%,
fade(@COLOR_TEXT_WEAK, 60) 37%,
@COLOR_BORDER 63%
);
background-size: 400% 100%;
animation: ant-skeleton-loading 1.4s ease infinite;
}
@keyframes ant-skeleton-loading {
0% {
background-position: 100% 50%;
}
100% {
background-position: 0 50%;
}
}