初始化项目, 添加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,33 @@
import { RelationsOptions, SuperComponent } from '../common/src/index';
import type { TdDropdownMenuProps } from './type';
export interface DropdownMenuProps extends TdDropdownMenuProps {
}
export default class DropdownMenu extends SuperComponent {
externalClasses: string[];
properties: TdDropdownMenuProps;
nodes: any;
data: {
prefix: string;
classPrefix: string;
menus: any;
activeIdx: number;
bottom: number;
_arrowIcon: {
name: string | object;
};
};
relations: RelationsOptions;
lifetimes: {
ready(): void;
};
observers: {
arrowIcon(v: any): void;
activeIdx(v: number): void;
};
methods: {
toggle(index: number): void;
getAllItems(): void;
handleToggle(e: WechatMiniprogram.BaseEvent): void;
noop(): 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{calcIcon}from"../common/utils";const{prefix:prefix}=config,name=`${prefix}-dropdown-menu`;let DropdownMenu=class extends SuperComponent{constructor(){super(...arguments),this.externalClasses=[`${prefix}-class`,`${prefix}-class-item`,`${prefix}-class-label`,`${prefix}-class-icon`],this.properties=props,this.nodes=null,this.data={prefix:prefix,classPrefix:name,menus:null,activeIdx:-1,bottom:0,_arrowIcon:{name:props.arrowIcon.value}},this.relations={"../dropdown-item/dropdown-item":{type:"child"}},this.lifetimes={ready(){this.getAllItems()}},this.observers={arrowIcon(e){this.setData({_arrowIcon:calcIcon(e)})},activeIdx(e){this.triggerEvent(-1===e?"close":"open")}},this.methods={toggle(e){const{activeIdx:t,duration:o}=this.data,s=this.$children[t],r=this.$children[e];(null==r?void 0:r.data.disabled)||(-1!==t&&(s.triggerEvent("close"),s.setData({show:!1},()=>{setTimeout(()=>{s.triggerEvent("closed")},o)})),null==e||t===e?this.setData({activeIdx:-1}):(r.triggerEvent("open"),this.setData({activeIdx:e}),r.setData({show:!0},()=>{setTimeout(()=>{r.triggerEvent("opened")},o)})))},getAllItems(){const e=this.$children.map(({data:e})=>({label:e.label||e.computedLabel,disabled:e.disabled}));this.setData({menus:e})},handleToggle(e){const{index:t}=e.currentTarget.dataset;this.toggle(t)},noop(){}}}};DropdownMenu=__decorate([wxComponent()],DropdownMenu);export default DropdownMenu;

View File

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

View File

@@ -0,0 +1 @@
<import src="../common/template/icon.wxml"/><wxs src="../common/utils.wxs" module="_"/><view style="{{_._style([style, customStyle])}}" class="{{ classPrefix }} class {{prefix}}-class" id="t-bar" catchtouchmove="{{activeIdx === -1?'':'noop'}}"><view wx:for="{{menus}}" wx:key="index" bindtap="handleToggle" data-index="{{index}}" class="{{_.cls(classPrefix + '__item', [['active', activeIdx == index], ['disabled', item.disabled], [index, true]])}} {{prefix}}-class-item" aria-disabled="{{item.disabled}}" aria-role="button" aria-expanded="{{activeIdx === index}}" aria-haspopup="menu"><view class="{{classPrefix}}__title {{prefix}}-class-label">{{item.label}}</view><template is="icon" data="{{..._arrowIcon, ariaHidden: true, tClass: classPrefix + '__icon ' + classPrefix + '__icon--' + (activeIdx == index ? 'active ' : ' ') + prefix + '-class-icon'}}"/></view><slot/></view>

View File

@@ -0,0 +1,11 @@
@import '../common/style/index.wxss';.t-dropdown-menu{display:flex;height:var(--td-dropdown-menu-height,96rpx);background:var(--td-dropdown-menu-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));position:relative;}
.t-dropdown-menu::after{content:'';display:block;position:absolute;top:unset;bottom:0;left:unset;right:unset;background-color:var(--td-component-border,var(--td-gray-color-4,#dcdcdc));}
.t-dropdown-menu::after{height:1px;left:0;right:0;transform:scaleY(.5);}
.t-dropdown-menu:after{height:var(--td-dropdown-menu-border-width,1px);}
.t-dropdown-menu__item{display:flex;flex:1;align-items:center;justify-content:center;padding:0 var(--td-spacer,16rpx);position:relative;overflow:hidden;color:var(--td-dropdown-menu-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));}
.t-dropdown-menu__item--active{color:var(--td-dropdown-menu-active-color,var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-dropdown-menu__item--disabled{color:var(--td-dropdown-menu-disabled-color,var(--td-text-color-disabled,var(--td-font-gray-4,rgba(0,0,0,.26))));}
.t-dropdown-menu__icon{font-size:var(--td-dropdown-menu-icon-size,40rpx);padding:4rpx;box-sizing:border-box;transition:transform 240ms ease;}
.t-dropdown-menu__icon--active{transform:rotate(180deg);}
.t-dropdown-menu__icon:not(:empty){margin-left:8rpx;}
.t-dropdown-menu__title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--td-dropdown-menu-font-size,28rpx);}

View File

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

View File

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

View File

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

View File

@@ -0,0 +1 @@
const props={arrowIcon:{type:null,value:"caret-down-small"},closeOnClickOverlay:{type:Boolean,value:!0},duration:{type:null,value:200},showOverlay:{type:Boolean,value:!0},zIndex:{type:Number,value:11600}};export default props;

View File

@@ -0,0 +1,22 @@
export interface TdDropdownMenuProps {
arrowIcon?: {
type: null;
value?: string | object;
};
closeOnClickOverlay?: {
type: BooleanConstructor;
value?: boolean;
};
duration?: {
type: null;
value?: string | number;
};
showOverlay?: {
type: BooleanConstructor;
value?: boolean;
};
zIndex?: {
type: NumberConstructor;
value?: number;
};
}

View File

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