初始化项目, 添加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 './popup';

View File

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

View File

@@ -0,0 +1,19 @@
import { TdPopupProps } from './type';
import { SuperComponent } from '../common/src/index';
export declare type PopupProps = TdPopupProps;
export default class Popup extends SuperComponent {
externalClasses: string[];
behaviors: string[];
options: {
multipleSlots: boolean;
};
properties: TdPopupProps;
data: {
prefix: string;
classPrefix: string;
};
methods: {
handleOverlayClick(): void;
handleClose(): 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 transition from"../mixins/transition";import useCustomNavbar from"../mixins/using-custom-navbar";delete props.visible;const{prefix:prefix}=config,name=`${prefix}-popup`;let Popup=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-content`],this.behaviors=[transition(),useCustomNavbar],this.options={multipleSlots:!0},this.properties=props,this.data={prefix:prefix,classPrefix:name},this.methods={handleOverlayClick(){const{closeOnOverlayClick:e}=this.properties;e&&this.triggerEvent("visible-change",{visible:!1,trigger:"overlay"})},handleClose(){this.triggerEvent("visible-change",{visible:!1,trigger:"close-btn"})}}}};Popup=__decorate([wxComponent()],Popup);export default Popup;

View File

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

View File

@@ -0,0 +1 @@
<wxs src="./popup.wxs" module="popup"/><wxs src="../common/utils.wxs" module="_"/><view wx:if="{{realVisible}}" style="{{_._style([popup.getPopupStyles(zIndex, distanceTop, placement), style, customStyle])}}" class="{{_.cls(classPrefix, [placement])}} {{transitionClass}} class {{prefix}}-class" bind:transitionend="onTransitionEnd"><view data-prevention="{{preventScrollThrough || (overlayProps ? !!overlayProps.preventScrollThrough : false)}}" bind:touchmove="{{popup.onContentTouchMove}}" class="{{classPrefix}}__content {{prefix}}-class-content"><slot name="content"/><slot/><view class="{{classPrefix}}__close" bind:tap="handleClose"><t-icon name="close" wx:if="{{closeBtn}}" size="64rpx"/><slot name="close-btn" class="{{classPrefix}}-slot"/></view></view></view><t-overlay id="popup-overlay" wx:if="{{showOverlay}}" visible="{{visible}}" usingCustomNavbar="{{usingCustomNavbar}}" z-index="{{overlayProps && overlayProps.zIndex || 11000}}" duration="{{overlayProps && overlayProps.duration || 300}}" background-color="{{overlayProps && overlayProps.backgroundColor || ''}}" prevent-scroll-through="{{preventScrollThrough || (overlayProps ? !!overlayProps.preventScrollThrough : false)}}" bind:tap="handleOverlayClick" custom-style="{{overlayProps && overlayProps.style || ''}}"/>

View File

@@ -0,0 +1,18 @@
function getPopupStyles(zIndex, distanceTop, placement) {
var zIndexStyle = zIndex ? 'z-index:' + zIndex + ';' : '';
if ((placement === 'top' || placement === 'left' || placement === 'right') && distanceTop) {
zIndexStyle = zIndexStyle + 'top:' + distanceTop + 'px;' + '--td-popup-distance-top:' + distanceTop + 'px;';
}
return zIndexStyle;
}
function onContentTouchMove(e) {
if (e.target && e.target.dataset.prevention) {
return false;
}
}
module.exports = {
getPopupStyles: getPopupStyles,
onContentTouchMove: onContentTouchMove,
};

View File

@@ -0,0 +1,14 @@
@import '../common/style/index.wxss';.t-popup{position:fixed;z-index:11500;max-height:calc(100vh - var(--td-popup-distance-top,0));transition:var(--td-popup-transition,all 300ms ease);background-color:var(--td-popup-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));}
.t-popup__content{position:relative;height:100%;z-index:1;}
.t-popup__close{position:absolute;top:0;right:0;padding:20rpx;line-height:1;color:var(--td-popup-close-btn-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
.t-popup--top{top:0;left:0;width:100%;border-bottom-left-radius:var(--td-popup-border-radius,var(--td-radius-extraLarge,24rpx));border-bottom-right-radius:var(--td-popup-border-radius,var(--td-radius-extraLarge,24rpx));}
.t-popup--bottom{bottom:0;left:0;width:100%;border-top-left-radius:var(--td-popup-border-radius,var(--td-radius-extraLarge,24rpx));border-top-right-radius:var(--td-popup-border-radius,var(--td-radius-extraLarge,24rpx));padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom);}
.t-popup--left{top:0;left:0;height:100%;}
.t-popup--right{top:0;right:0;height:100%;}
.t-popup--center{top:50%;left:50%;transform:scale(1) translate3d(-50%,-50%,0);transform-origin:0 0;border-radius:var(--td-popup-border-radius,var(--td-radius-extraLarge,24rpx));}
.t-popup.t-fade-enter.t-popup--top,.t-popup.t-fade-leave-to.t-popup--top{transform:translateY(-100%);transform-origin:0 0;}
.t-popup.t-fade-enter.t-popup--bottom,.t-popup.t-fade-leave-to.t-popup--bottom{transform:translateY(100%);}
.t-popup.t-fade-enter.t-popup--left,.t-popup.t-fade-leave-to.t-popup--left{transform:translateX(-100%);}
.t-popup.t-fade-enter.t-popup--right,.t-popup.t-fade-leave-to.t-popup--right{transform:translateX(100%);}
.t-popup.t-fade-enter.t-popup--center,.t-popup.t-fade-leave-to.t-popup--center{transform:scale(.6) translate3d(-50%,-50%,0);opacity:0;}
.t-popup.t-dialog-enter.t-popup--center,.t-popup.t-dialog-leave-to.t-popup--center{transform:scale(.6) translate3d(-50%,-50%,0);opacity:0;}

View File

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

View File

@@ -0,0 +1 @@
const props={closeBtn:{type:Boolean},closeOnOverlayClick:{type:Boolean,value:!0},content:{type:String},duration:{type:Number,value:240},overlayProps:{type:Object,value:{}},placement:{type:String,value:"top"},preventScrollThrough:{type:Boolean,value:!0},showOverlay:{type:Boolean,value:!0},usingCustomNavbar:{type:Boolean,value:!1},visible:{type:Boolean,value:null},defaultVisible:{type:Boolean},zIndex:{type:Number,value:11500}};export default props;

View File

@@ -0,0 +1,51 @@
import { OverlayProps } from '../overlay/index';
export interface TdPopupProps {
closeBtn?: {
type: BooleanConstructor;
value?: boolean;
};
closeOnOverlayClick?: {
type: BooleanConstructor;
value?: boolean;
};
content?: {
type: StringConstructor;
value?: string;
};
duration?: {
type: NumberConstructor;
value?: number;
};
overlayProps?: {
type: ObjectConstructor;
value?: OverlayProps;
};
placement?: {
type: StringConstructor;
value?: 'top' | 'left' | 'right' | 'bottom' | 'center';
};
preventScrollThrough?: {
type: BooleanConstructor;
value?: boolean;
};
showOverlay?: {
type: BooleanConstructor;
value?: boolean;
};
usingCustomNavbar?: {
type: BooleanConstructor;
value?: boolean;
};
visible?: {
type: BooleanConstructor;
value?: boolean;
};
defaultVisible?: {
type: BooleanConstructor;
value?: boolean;
};
zIndex?: {
type: NumberConstructor;
value?: number;
};
}

View File

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