初始化项目, 添加TDesign等包

This commit is contained in:
zhengw
2025-11-28 16:49:36 +08:00
commit 3e53beb7bb
980 changed files with 39201 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { SuperComponent, RelationsOptions } from '../common/src/index';
export default class Grid extends SuperComponent {
externalClasses: string[];
relations: RelationsOptions;
properties: import("./type").TdGridProps;
data: {
prefix: string;
classPrefix: string;
contentStyle: string;
};
observers: {
'column,hover,align,gutter,border'(): void;
};
lifetimes: {
attached(): void;
};
methods: {
doForChild(action: (item: WechatMiniprogram.Component.TrivialInstance) => void): void;
updateContentStyle(): void;
getContentMargin(): string;
};
}

View File

@@ -0,0 +1 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import{isObject}from"../common/validator";import props from"./props";const{prefix:prefix}=config,name=`${prefix}-grid`;let Grid=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=["t-class"],this.relations={"../grid-item/grid-item":{type:"descendant"}},this.properties=props,this.data={prefix:prefix,classPrefix:name,contentStyle:""},this.observers={"column,hover,align,gutter,border"(){this.updateContentStyle(),this.doForChild(t=>t.updateStyle())}},this.lifetimes={attached(){this.updateContentStyle()}},this.methods={doForChild(t){this.$children.forEach(t)},updateContentStyle(){const t=[],e=this.getContentMargin();e&&t.push(e),this.setData({contentStyle:t.join(";")})},getContentMargin(){const{gutter:t}=this.properties;let{border:e}=this.properties;if(!e)return`margin-bottom:-${t}rpx; margin-right:-${t}rpx`;isObject(e)||(e={});const{width:r=2}=e;return`margin-bottom:-${r}rpx; margin-right:-${r}rpx`}}}};Grid=__decorate([wxComponent()],Grid);export default Grid;

View File

@@ -0,0 +1 @@
{"component":true,"styleIsolation":"apply-shared","usingComponents":{}}

View File

@@ -0,0 +1 @@
<wxs src="../common/utils.wxs" module="_"/><view style="{{_._style([style, customStyle])}}" class="{{_.cls(classPrefix, [theme])}} class {{prefix}}-class"><view wx:if="{{column > 0}}" class="{{classPrefix}}__content" style="{{ contentStyle }}"><slot/></view><scroll-view wx:else scroll-x scroll-with-animation class="{{classPrefix}}__content" style="{{ 'white-space: nowrap;' + contentStyle }}"><slot/></scroll-view></view>

View File

@@ -0,0 +1,3 @@
@import '../common/style/index.wxss';.t-grid{position:relative;overflow:hidden;background-color:var(--td-grid-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));}
.t-grid__content{width:auto;}
.t-grid--card{margin:0 32rpx;border-radius:var(--td-grid-card-radius,var(--td-radius-large,18rpx));overflow:hidden;}

View File

@@ -0,0 +1,3 @@
import { TdGridProps } from './type';
declare const props: TdGridProps;
export default props;

View File

@@ -0,0 +1 @@
const props={align:{type:String,value:"center"},border:{type:null,value:!1},column:{type:Number,value:4},gutter:{type:Number},hover:{type:Boolean,value:!1},theme:{type:String,value:"default"}};export default props;

View File

@@ -0,0 +1,30 @@
export interface TdGridProps {
align?: {
type: StringConstructor;
value?: 'left' | 'center';
};
border?: {
type: null;
value?: boolean | {
color?: string;
width?: string;
style?: 'solid' | 'dashed' | 'dotted' | 'double' | 'groove' | 'inset' | 'outset';
};
};
column?: {
type: NumberConstructor;
value?: number;
};
gutter?: {
type: NumberConstructor;
value?: number;
};
hover?: {
type: BooleanConstructor;
value?: boolean;
};
theme?: {
type: StringConstructor;
value?: 'default' | 'card';
};
}

View File

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