初始化项目, 添加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,21 @@
import { SuperComponent } from '../../common/src/index';
import type { TdDraggableProps } from './type';
export interface DraggableProps extends TdDraggableProps {
}
export default class Draggable extends SuperComponent {
properties: TdDraggableProps;
externalClasses: string[];
data: {
prefix: string;
classPrefix: string;
};
lifetimes: {
ready(): void;
};
methods: {
onTouchStart(e: any): void;
onTouchMove(e: any): void;
onTouchEnd(e: any): Promise<void>;
computedRect(): Promise<void>;
};
}

View File

@@ -0,0 +1 @@
import{__awaiter,__decorate}from"tslib";import{SuperComponent,wxComponent}from"../../common/src/index";import config from"../../common/config";import props from"./props";import{getRect,systemInfo}from"../../common/utils";const{prefix:prefix}=config,name=`${prefix}-draggable`;let Draggable=class extends SuperComponent{constructor(){super(...arguments),this.properties=props,this.externalClasses=[`${prefix}-class`],this.data={prefix:prefix,classPrefix:name},this.lifetimes={ready(){this.computedRect()}},this.methods={onTouchStart(t){"none"!==this.properties.direction&&(this.startX=t.touches[0].clientX+systemInfo.windowWidth-this.rect.right,this.startY=t.touches[0].clientY+systemInfo.windowHeight-this.rect.bottom,this.triggerEvent("start",{startX:this.startX,startY:this.startY,rect:this.rect,e:t}))},onTouchMove(t){if("none"===this.properties.direction)return;let e=this.startX-t.touches[0].clientX,i=this.startY-t.touches[0].clientY;"vertical"===this.properties.direction&&(e=systemInfo.windowWidth-this.rect.right),"horizontal"===this.properties.direction&&(i=systemInfo.windowHeight-this.rect.bottom),this.triggerEvent("move",{x:e,y:i,rect:this.rect,e:t})},onTouchEnd(t){return __awaiter(this,void 0,void 0,function*(){"none"!==this.properties.direction&&(yield this.computedRect(),this.triggerEvent("end",{rect:this.rect,e:t}))})},computedRect(){return __awaiter(this,void 0,void 0,function*(){this.rect={right:0,bottom:0,width:0,height:0};try{this.rect=yield getRect(this,`.${this.data.classPrefix}`)}catch(t){}})}}}};Draggable=__decorate([wxComponent()],Draggable);export default Draggable;

View File

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

View File

@@ -0,0 +1 @@
<wxs src="../../common/utils.wxs" module="_"/><view class="{{classPrefix}} class {{prefix}}-class" style="{{_._style([style, customStyle])}}" bind:touchstart="onTouchStart" catch:touchmove="onTouchMove" bind:touchend="onTouchEnd"><slot></slot></view>

View File

@@ -0,0 +1,3 @@
@import '../../common/style/index.wxss';.hotspot-expanded.relative{position:relative;}
.hotspot-expanded::after{content:'';display:block;position:absolute;left:0;top:0;right:0;bottom:0;transform:scale(1.5);}
.t-draggable{position:fixed;}

View File

@@ -0,0 +1,3 @@
export * from './props';
export * from './type';
export * from './draggable';

View File

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

View File

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

View File

@@ -0,0 +1 @@
const props={direction:{type:String,value:"all"}};export default props;

View File

@@ -0,0 +1,6 @@
export interface TdDraggableProps {
direction?: {
type: StringConstructor;
value?: 'all' | 'vertical' | 'horizontal' | 'none';
};
}

View File

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