初始化项目, 添加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,58 @@
import { SuperComponent, RelationsOptions, ComponentsOptionsType } from '../common/src/index';
import { PickerItemOption } from './type';
export default class PickerItem extends SuperComponent {
relations: RelationsOptions;
options: ComponentsOptionsType;
externalClasses: string[];
properties: import("./type").TdPickerItemProps;
observers: {
'options, pickerKeys'(): void;
};
data: {
prefix: string;
classPrefix: string;
offset: number;
duration: number;
value: string;
curIndex: number;
columnIndex: number;
pickerKeys: {
value: string;
label: string;
icon: string;
};
formatOptions: PickerItemOption[];
enableVirtualScroll: boolean;
visibleOptions: any[];
virtualStartIndex: number;
virtualOffsetY: number;
totalHeight: number;
itemHeight: number;
visibleItemCount: number;
wrapperPaddingY: number;
};
lifetimes: {
created(): void;
detached(): void;
};
methods: {
onClickItem(event: WechatMiniprogram.TouchEvent): void;
onTouchStart(event: any): void;
onTouchMove(event: any): void;
onTouchEnd(event: any): void;
formatOption(options: PickerItemOption[], columnIndex: number, format: any): any[];
updateSelected(index: number, trigger: boolean): void;
update(): void;
computeVirtualRange(offset: number, totalCount: number, itemHeight: number, isFastScroll?: boolean): {
startIndex: number;
endIndex: number;
};
updateVisibleOptions(offset?: number, isFastScroll?: boolean): void;
getCount(): any;
getCurrentSelected(): {
index: number;
value: any;
label: any;
};
};
}

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -0,0 +1 @@
<wxs src="../common/utils.wxs" module="_"/><view style="{{_._style([style, customStyle, 'height:' + itemHeight * visibleItemCount + 'px'])}}" class="{{_.cls(classPrefix + '__group', [])}} class {{prefix}}-class" bind:touchstart="onTouchStart" catch:touchmove="onTouchMove" bind:touchend="onTouchEnd" bind:touchcancel="onTouchEnd"><view class="{{classPrefix}}__wrapper" style="transition: transform {{ duration }}ms cubic-bezier(0.215, 0.61, 0.355, 1); transform: translate3d(0, {{ offset }}px, 0); padding: {{ wrapperPaddingY }}px 0"><view wx:if="{{enableVirtualScroll}}" style="height: {{totalHeight}}px; position: relative;"><view style="position: absolute; top: {{virtualOffsetY}}px; left: 0; right: 0;"><view class="{{_.cls(classPrefix + '__item', [['active', curIndex == (virtualStartIndex + index)]])}}" style="height: {{itemHeight}}px" wx:for="{{visibleOptions}}" wx:key="value" wx:for-item="option" data-index="{{ virtualStartIndex + index }}" bind:tap="onClickItem"><t-icon wx:if="{{option[pickerKeys.icon]}}" class="{{classPrefix}}__item-icon" name="{{option[pickerKeys.icon]}}"/><text class="{{classPrefix}}__item-label">{{option[pickerKeys.label]}}</text><slot name="label-suffix--{{virtualStartIndex + index}}"></slot></view></view></view><block wx:else><view class="{{_.cls(classPrefix + '__item', [['active', curIndex == index]])}}" style="height: {{itemHeight}}px" wx:for="{{visibleOptions}}" wx:key="value" wx:for-item="option" data-index="{{ index }}" bind:tap="onClickItem"><t-icon wx:if="{{option[pickerKeys.icon]}}" class="{{classPrefix}}__item-icon" name="{{option[pickerKeys.icon]}}"/><text class="{{classPrefix}}__item-label">{{option[pickerKeys.label]}}</text><slot name="label-suffix--{{index}}"></slot></view></block></view></view>

View File

@@ -0,0 +1,7 @@
@import '../common/style/index.wxss';:host{display:flex;}
.t-picker-item__group{overflow:hidden;flex:1;z-index:1;}
.t-picker-item__wrapper{will-change:transform;}
.t-picker-item__item{display:flex;justify-content:center;align-items:center;color:var(--td-picker-item-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));font-size:var(--td-picker-item-font-size,var(--td-font-size-m,32rpx));contain:layout style paint;}
.t-picker-item__item-icon{font-size:36rpx;margin-right:var(--td-spacer,16rpx);}
.t-picker-item__item-label{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;}
.t-picker-item__item--active{color:var(--td-picker-item-active-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));font-weight:600;}

View File

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

View File

@@ -0,0 +1 @@
const props={format:{type:null},options:{type:Array,value:[]}};export default props;

View File

@@ -0,0 +1,15 @@
export interface TdPickerItemProps {
format?: {
type: undefined;
value?: (option: PickerItemOption, columnIndex: number) => PickerItemOption;
};
options?: {
type: ArrayConstructor;
value?: PickerItemOption[];
};
}
export interface PickerItemOption {
label: string;
value: string | number;
icon?: string;
}

View File

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