初始化项目, 添加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,3 @@
export * from './props';
export * from './type';
export * from './sticky';

View File

@@ -0,0 +1 @@
export*from"./props";export*from"./type";export*from"./sticky";

View File

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

View File

@@ -0,0 +1 @@
const props={container:{type:null},disabled:{type:Boolean,value:!1},offsetTop:{type:null,value:0},zIndex:{type:Number,value:99}};export default props;

View File

@@ -0,0 +1,30 @@
import { SuperComponent } from '../common/src/index';
import type { TdStickyProps } from './type';
export interface StickyProps extends TdStickyProps {
}
export default class Sticky extends SuperComponent {
externalClasses: string[];
properties: TdStickyProps;
behaviors: string[];
observers: {
'offsetTop, disabled, container'(): void;
};
data: {
prefix: string;
classPrefix: string;
containerStyle: string;
contentStyle: string;
};
ready(): void;
methods: {
onScroll(event?: {
scrollTop: number;
}): void;
setDataAfterDiff(data: {
isFixed: boolean;
height?: number;
transform?: number;
}): void;
getContainerRect(): Promise<WechatMiniprogram.BoundingClientRectCallbackResult>;
};
}

View File

@@ -0,0 +1 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import props from"./props";import config from"../common/config";import pageScrollMixin from"../mixins/page-scroll";import{getRect}from"../common/utils";const{prefix:prefix}=config,name=`${prefix}-sticky`,ContainerClass=`.${name}`;let Sticky=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-content`],this.properties=props,this.behaviors=[pageScrollMixin()],this.observers={"offsetTop, disabled, container"(){this.onScroll()}},this.data={prefix:prefix,classPrefix:name,containerStyle:"",contentStyle:""},this.methods={onScroll(t){const{scrollTop:e}=t||{},{container:i,offsetTop:o,disabled:s}=this.properties;s?this.setDataAfterDiff({isFixed:!1,transform:0}):(this.scrollTop=e||this.scrollTop,"function"!=typeof i?getRect(this,ContainerClass).then(t=>{t&&(o>=t.top?(this.setDataAfterDiff({isFixed:!0,height:t.height}),this.transform=0):this.setDataAfterDiff({isFixed:!1}))}):Promise.all([getRect(this,ContainerClass),this.getContainerRect()]).then(([t,e])=>{t&&e&&(o+t.height>e.height+e.top?this.setDataAfterDiff({isFixed:!1,transform:e.height-t.height}):o>=t.top?this.setDataAfterDiff({isFixed:!0,height:t.height,transform:0}):this.setDataAfterDiff({isFixed:!1,transform:0}))}))},setDataAfterDiff(t){const{offsetTop:e}=this.properties,{containerStyle:i,contentStyle:o}=this.data,{isFixed:s,height:r,transform:n}=t;wx.nextTick(()=>{let t="",a="";if(s&&(t+=`height:${r}px;`,a+=`position:fixed;top:${e}px;left:0;right:0;`),n){const t=`translate3d(0, ${n}px, 0)`;a+=`-webkit-transform:${t};transform:${t};`}i===t&&o===a||this.setData({containerStyle:t,contentStyle:a}),this.triggerEvent("scroll",{scrollTop:this.scrollTop,isFixed:s})})},getContainerRect(){const t=this.properties.container();return new Promise(e=>t.boundingClientRect(e).exec())}}}ready(){this.onScroll()}};Sticky=__decorate([wxComponent()],Sticky);export default Sticky;

View File

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

View File

@@ -0,0 +1 @@
<wxs src="../common/utils.wxs" module="_"/><view class="{{classPrefix}} class {{prefix}}-class" style="{{_._style(['z-index:' + zIndex, containerStyle, style, customStyle])}}"><view class="{{classPrefix}}__content {{prefix}}-class-content" style="{{_._style(['z-index:' + zIndex, contentStyle]) }}"><slot/></view></view>

View File

@@ -0,0 +1 @@
@import '../common/style/index.wxss';.t-sticky{position:relative;}

View File

@@ -0,0 +1,18 @@
export interface TdStickyProps {
container?: {
type: undefined;
value?: null;
};
disabled?: {
type: BooleanConstructor;
value?: boolean;
};
offsetTop?: {
type: null;
value?: string | number;
};
zIndex?: {
type: NumberConstructor;
value?: number;
};
}

View File

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