This commit is contained in:
lik
2026-05-28 17:06:18 +08:00
parent a93a75b3c6
commit db0f47d994
582 changed files with 8060 additions and 1781 deletions

View File

@@ -4,9 +4,22 @@ export default class PickerItem extends SuperComponent {
relations: RelationsOptions;
options: ComponentsOptionsType;
externalClasses: string[];
properties: import("./type").TdPickerItemProps;
properties: {
useSlots: {
type: BooleanConstructor;
value: boolean;
};
format?: {
type: undefined;
value?: (option: PickerItemOption, columnIndex: number) => PickerItemOption;
};
options?: {
type: ArrayConstructor;
value?: PickerItemOption[];
};
};
observers: {
'options, pickerKeys'(): void;
'options, keys'(): void;
};
data: {
prefix: string;
@@ -16,14 +29,20 @@ export default class PickerItem extends SuperComponent {
value: string;
curIndex: number;
columnIndex: number;
pickerKeys: {
value: string;
label: string;
};
keys: {};
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;
@@ -33,6 +52,16 @@ export default class PickerItem extends SuperComponent {
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

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

View File

@@ -1 +1 @@
<wxs src="../common/utils.wxs" module="_"/><view style="{{_._style([style, customStyle])}}" 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)"><view class="{{_.cls(classPrefix + '__item', [['active', curIndex == index]])}}" style="height: {{pickItemHeight}}px" wx:for="{{formatOptions}}" wx:key="index" wx:for-item="option" data-index="{{ index }}" bind:tap="onClickItem"><text class="{{classPrefix}}__item-label">{{option[pickerKeys.label]}}</text><slot name="label-suffix--{{index}}"></slot></view></view></view>
<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[keys.icon]}}" class="{{classPrefix}}__item-icon" name="{{option[keys.icon]}}"/><text class="{{classPrefix}}__item-label">{{option[keys.label]}}</text><slot wx:if="{{useSlots}}" 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[keys.icon]}}" class="{{classPrefix}}__item-icon" name="{{option[keys.icon]}}"/><text class="{{classPrefix}}__item-label">{{option[keys.label]}}</text><slot wx:if="{{useSlots}}" name="label-suffix--{{index}}"></slot></view></block></view></view>

View File

@@ -1 +1,7 @@
@import '../common/style/index.wxss';:host{display:flex}.t-picker-item__group{height:var(--td-picker-group-height,400rpx);overflow:hidden;flex:1;z-index:1}.t-picker-item__wrapper{padding:144rpx 0}.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))}.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}
@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

@@ -11,4 +11,5 @@ export interface TdPickerItemProps {
export interface PickerItemOption {
label: string;
value: string | number;
icon?: string;
}