初始化项目, 添加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{};

View File

@@ -0,0 +1,27 @@
import { SuperComponent } from '../common/src/index';
export default class Fab extends SuperComponent {
behaviors: string[];
properties: import("./type").TdFabProps;
externalClasses: string[];
data: {
prefix: string;
classPrefix: string;
buttonData: {
size: string;
shape: string;
theme: string;
tClass: string;
};
moveStyle: any;
};
observers: {
'buttonProps.**, icon, text, ariaLabel, yBounds'(): void;
};
methods: {
onTplButtonTap(e: any): void;
onStart(e: any): void;
onMove(e: any): void;
onEnd(e: any): void;
computedSize(): void;
};
}

View File

@@ -0,0 +1 @@
import{__decorate}from"tslib";import{SuperComponent,wxComponent}from"../common/src/index";import config from"../common/config";import props from"./props";import useCustomNavbar from"../mixins/using-custom-navbar";import{unitConvert,systemInfo}from"../common/utils";const{prefix:prefix}=config,name=`${prefix}-fab`,baseButtonProps={size:"large",shape:"circle",theme:"primary",tClass:`${prefix}-fab__button`};let Fab=class extends SuperComponent{constructor(){super(...arguments),this.behaviors=[useCustomNavbar],this.properties=props,this.externalClasses=["class",`${prefix}-class`,`${prefix}-class-button`],this.data={prefix:prefix,classPrefix:name,buttonData:baseButtonProps,moveStyle:null},this.observers={"buttonProps.**, icon, text, ariaLabel, yBounds"(){var t;this.setData({buttonData:Object.assign(Object.assign(Object.assign(Object.assign({},baseButtonProps),{shape:this.properties.text?"round":"circle"}),this.properties.buttonProps),{icon:this.properties.icon,content:this.properties.text,ariaLabel:this.properties.ariaLabel})},null===(t=this.computedSize)||void 0===t?void 0:t.bind(this))}},this.methods={onTplButtonTap(t){this.triggerEvent("click",t)},onStart(t){this.triggerEvent("dragstart",t.detail.e)},onMove(t){const{yBounds:e}=this.properties,{distanceTop:o}=this.data,{x:s,y:i,rect:r}=t.detail,a=systemInfo.windowWidth-r.width,n=systemInfo.windowHeight-Math.max(o,unitConvert(e[0]))-r.height,p=Math.max(0,Math.min(s,a)),m=Math.max(0,unitConvert(e[1]),Math.min(i,n));this.setData({moveStyle:`right: ${p}px; bottom: ${m}px;`})},onEnd(t){this.triggerEvent("dragend",t.detail.e)},computedSize(){var t,e;if(!this.properties.draggable)return;const o=this.selectComponent("#draggable");(null===(e=null===(t=this.properties)||void 0===t?void 0:t.yBounds)||void 0===e?void 0:e[1])?this.setData({moveStyle:`bottom: ${unitConvert(this.properties.yBounds[1])}px`},o.computedRect):o.computedRect()}}}};Fab=__decorate([wxComponent()],Fab);export default Fab;

View File

@@ -0,0 +1 @@
{"component":true,"styleIsolation":"apply-shared","usingComponents":{"t-button":"../button/button","t-draggable":"./draggable/draggable"}}

View File

@@ -0,0 +1 @@
<import src="./template/view.wxml"/><import src="./template/draggable.wxml"/><template is="{{draggable ? 'draggable' : 'view'}}" data="{{prefix, classPrefix, style, customStyle, moveStyle, draggable, buttonData}}"/>

View File

@@ -0,0 +1,3 @@
@import '../common/style/index.wxss';.t-fab{position:fixed;}
.t-fab__button{box-shadow:var(--td-fab-shadow,var(--td-shadow-2,0 3px 14px 2px rgba(0,0,0,.05),0 8px 10px 1px rgba(0,0,0,.06),0 5px 5px -3px rgba(0,0,0,.1)));}
.t-fab__draggable{position:fixed;}

View File

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

View File

@@ -0,0 +1 @@
const props={buttonProps:{type:Object},draggable:{type:null,value:!1},icon:{type:String,value:""},style:{type:String,value:"right: 16px; bottom: 32px;"},text:{type:String,value:""},usingCustomNavbar:{type:Boolean,value:!1},yBounds:{type:Array}};export default props;

View File

@@ -0,0 +1 @@
<import src="../../common/template/button.wxml"/><wxs src="../../common/utils.wxs" module="_"/><template name="draggable"><t-draggable id="draggable" style="right: 16px; bottom: 32px; {{_._style([style, customStyle, moveStyle])}}" direction="{{draggable === true ? 'all' : draggable}}" bind:start="onStart" bind:move="onMove" bind:end="onEnd"><slot wx:if="{{!buttonData.content && !buttonData.icon}}"/><template wx:else is="button" data="{{useDefaultSlot: true, ...buttonData}}"/></t-draggable></template>

View File

@@ -0,0 +1 @@
<import src="../../common/template/button.wxml"/><wxs src="../../common/utils.wxs" module="_"/><template name="view"><view class="{{classPrefix}} class {{prefix}}-class" style="right: 16px; bottom: 32px; {{_._style([style, customStyle])}}"><slot wx:if="{{!buttonData.content && !buttonData.icon}}"/><template wx:else is="button" data="{{useDefaultSlot: true, ...buttonData}}"/></view></template>

View File

@@ -0,0 +1,32 @@
import { ButtonProps } from '../button/index';
export interface TdFabProps {
buttonProps?: {
type: ObjectConstructor;
value?: ButtonProps;
};
draggable?: {
type: null;
value?: boolean | FabDirectionEnum;
};
icon?: {
type: StringConstructor;
value?: string;
};
style?: {
type: StringConstructor;
value?: string;
};
text?: {
type: StringConstructor;
value?: string;
};
usingCustomNavbar?: {
type: BooleanConstructor;
value?: boolean;
};
yBounds?: {
type: ArrayConstructor;
value?: Array<string | number>;
};
}
export declare type FabDirectionEnum = 'all' | 'vertical' | 'horizontal';

View File

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