初始化项目, 添加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 @@
<import src="../common/template/button.wxml"/><template name="content"><slot wx:if="{{!title && !body}}" name="content-{{current}}"/><block wx:else><view class="{{prefix}}-class-tooltip"><view wx:if="{{title}}" class="{{prefix}}-class-title {{classPrefix}}__title--{{modeType}}">{{title}}</view><slot wx:else name="title-{{current}}"/><view wx:if="{{body}}" class="{{prefix}}-class-body {{classPrefix}}__body--{{modeType}}">{{body}}</view><slot wx:else name="body-{{current}}"/></view><view wx:if="{{current !== -1}}" class="{{prefix}}-class-footer {{classPrefix}}__footer {{classPrefix}}__footer--{{modeType}}"><template is="button" wx:if="{{current < steps.length - 1 && !hideSkip}}" data="{{...skipButton}}"/><template is="button" wx:elif="{{current === steps.length - 1 && !hideBack}}" data="{{...backButton}}"/><template is="button" wx:if="{{current < steps.length - 1}}" data="{{...nextButton}}"/><template is="button" wx:else data="{{...finishButton}}"/></view></block></template>

View File

@@ -0,0 +1,103 @@
/// <reference types="miniprogram-api-typings" />
import { SuperComponent } from '../common/src/index';
import { TdGuideProps, GuideStep } from './type';
export interface GuideProps extends TdGuideProps {
}
export { GuideStep };
export default class Guide extends SuperComponent {
externalClasses: string[];
properties: TdGuideProps;
options: WechatMiniprogram.Component.ComponentOptions;
data: {
prefix: string;
classPrefix: string;
visible: boolean;
_current: number;
_steps: any[];
buttonProps: {};
referenceStyle: string;
popoverStyle: string;
title: string;
body: string;
nonOverlay: boolean;
modeType: string;
};
controlledProps: {
key: string;
event: string;
}[];
observers: {
'steps, current, showOverlay'(): Promise<void>;
};
lifetimes: {
created(): void;
attached(): void;
};
methods: {
init(): Promise<any>;
placementOffset({ placement, offset }: GuideStep, place: CSSStyleDeclaration): Promise<string>;
buttonProps(step: any, mode: any): {
skipButton: any;
nextButton: any;
backButton: any;
finishButton: any;
};
renderCounter(): any;
buttonContent(button: any): string;
onTplButtonTap(e: any): void;
getPlacement(): {
center: (rect: any, place: any, offset: any) => {
top: string;
left: string;
};
bottom: (rect: any, place: any, offset: any) => {
top: string;
left: string;
};
'bottom-left': (rect: any, place: any, offset: any) => {
top: string;
left: string;
};
'bottom-right': (rect: any, place: any, offset: any) => {
top: string;
right: string;
};
left: (rect: any, place: any, offset: any) => {
top: string;
right: string;
};
'left-top': (rect: any, place: any, offset: any) => {
top: string;
right: string;
};
'left-bottom': (rect: any, place: any, offset: any) => {
top: string;
right: string;
};
right: (rect: any, place: any, offset: any) => {
top: string;
left: string;
};
'right-top': (rect: any, place: any, offset: any) => {
top: string;
left: string;
};
'right-bottom': (rect: any, place: any, offset: any) => {
top: string;
left: string;
};
top: (rect: any, place: any, offset: any) => {
top: string;
left: string;
};
'top-left': (rect: any, place: any, offset: any) => {
top: string;
left: string;
};
'top-right': (rect: any, place: any, offset: any) => {
top: string;
right: string;
};
};
};
}

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -0,0 +1 @@
<import src="./content.wxml"/><t-overlay wx:if="{{modeType === 'popover'}}" visible="{{visible}}" using-custom-navbar="{{usingCustomNavbar}}" background-color="transparent" z-index="{{zIndex}}"><view class="class {{prefix}}-class {{classPrefix}}"><view class="{{prefix}}-class-reference {{classPrefix}}__reference {{nonOverlay ? classPrefix + '__reference--nonoverlay' : ''}}" style="{{referenceStyle}}"/><view class="{{prefix}}-class-popover {{classPrefix}}__container {{title || body ? classPrefix + '__container--' + modeType : ''}}" style="{{popoverStyle}}"><template is="content" data="{{ prefix, classPrefix, title, body, steps, current, modeType, hideSkip, hideBack, ...buttonProps }}"/></view></view></t-overlay><t-popup wx:elif="{{modeType === 'dialog'}}" visible="{{visible}}" show-overlay="{{!nonOverlay}}" using-custom-navbar="{{usingCustomNavbar}}" z-index="{{zIndex}}" placement="center"><view class="class {{prefix}}-class {{classPrefix}}"><view class="{{prefix}}-class-popover {{classPrefix}}__container {{title || body ? classPrefix + '__container--' + modeType : ''}}"><template is="content" data="{{ prefix, classPrefix, title, body, steps, current, modeType, hideSkip, ...buttonProps }}"/></view></view></t-popup>

View File

@@ -0,0 +1,13 @@
@import '../common/style/index.wxss';.t-guide__reference{position:absolute;box-shadow:0 0 0 0 var(--td-guide-reference-mask-color,var(--td-font-gray-2,rgba(0,0,0,.6))),var(--td-guide-reference-mask-color,var(--td-font-gray-2,rgba(0,0,0,.6))) 0 0 0 5000px;border-radius:var(--td-guide-reference-border-radius,var(--td-radius-default,12rpx));transition:all var(--td-anim-duration-base,.2s) var(--td-anim-time-fn-ease-out,cubic-bezier(0,0,.15,1));}
.t-guide__reference--nonoverlay{box-shadow:none;border:var(--td-guide-reference-border,4rpx solid var(--td-brand-color,var(--td-primary-color-7,#0052d9)));}
.t-guide__container{display:inline-block;}
.t-guide__container--popover{background-color:var(--td-guide-popover-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));border:var(--td-guide-popover-border,2rpx solid var(--td-component-border,var(--td-gray-color-4,#dcdcdc)));border-radius:var(--td-guide-popover-border-radius,var(--td-radius-large,18rpx));box-shadow:var(--td-guide-popover-shadow,var(--td-shadow-3,0 6px 30px 5px rgba(0,0,0,.05),0 16px 24px 2px rgba(0,0,0,.04),0 8px 10px -5px rgba(0,0,0,.08)));padding:var(--td-guide-popover-padding,var(--td-spacer-2,32rpx));min-width:var(--td-guide-popover-min-width,480rpx);max-width:var(--td-guide-popover-max-width,540rpx);}
.t-guide__container--dialog{background-color:var(--td-guide-popover-bg-color,var(--td-bg-color-container,var(--td-font-white-1,#fff)));border-radius:var(--td-guide-dialog-border-radius,var(--td-radius-extraLarge,24rpx));padding:var(--td-guide-dialog-padding,var(--td-spacer-3,48rpx) 0);width:var(--td-guide-dialog-width,622rpx);}
.t-guide__title--popover{text-align:var(--td-guide-popover-title-text-align,left);color:var(--td-guide-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));font-size:var(--td-guide-popover-title-font-size,var(--td-font-size-m,32rpx));font-weight:var(--td-guide-title-font-weight,600);line-height:var(--td-guide-popover-title-line-height,48rpx);}
.t-guide__title--dialog{text-align:var(--td-guide-dialog-title-text-align,center);color:var(--td-guide-title-color,var(--td-text-color-primary,var(--td-font-gray-1,rgba(0,0,0,.9))));font-size:var(--td-guide-dialog-title-font-size,36rpx);font-weight:var(--td-guide-title-font-weight,600);line-height:var(--td-guide-dialog-title-line-height,52rpx);}
.t-guide__body--popover{margin-top:var(--td-guide-popover-body-margin-top,8rpx);text-align:var(--td-guide-popover-body-text-align,left);color:var(--td-guide-body-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));font-size:var(--td-guide-popover-body-font-size,var(--td-font-size-base,28rpx));font-weight:var(--td-guide-body-font-weight,400);line-height:var(--td-guide-popover-body-line-height,44rpx);}
.t-guide__body--dialog{margin-top:var(--td-guide-dialog-body-margin-top,16rpx);text-align:var(--td-guide-dialog-body-text-align,center);color:var(--td-guide-body-color,var(--td-text-color-secondary,var(--td-font-gray-2,rgba(0,0,0,.6))));font-size:var(--td-guide-dialog-body-font-size,var(--td-font-size-m,32rpx));font-weight:var(--td-guide-body-font-weight,400);line-height:var(--td-guide-dialog-body-line-height,48rpx);}
.t-guide__footer{text-align:var(--td-guide-footer-text-align,right);margin-top:var(--td-guide-footer-margin-top,var(--td-spacer-3,48rpx));}
.t-guide__footer .t-guide__button+.t-guide__button{margin-left:var(--td-guide-footer-button-space,var(--td-spacer-1,24rpx));}
.t-guide__footer--dialog{display:flex;padding:var(--td-guide-dialog-footer-button-padding,0 var(--td-spacer-3,48rpx));}
.t-guide__footer--dialog .t-guide__button:last-child{flex-grow:1;}

View File

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

View File

@@ -0,0 +1 @@
const props={backButtonProps:{type:Object},counter:{type:null},current:{type:Number,value:null},defaultCurrent:{type:Number},finishButtonProps:{type:Object},hideBack:{type:Boolean,value:!1},hideCounter:{type:Boolean,value:!1},hideSkip:{type:Boolean,value:!1},highlightPadding:{type:Number,value:16},mode:{type:String,value:"popover"},nextButtonProps:{type:Object},showOverlay:{type:Boolean,value:!0},skipButtonProps:{type:Object},steps:{type:Array},usingCustomNavbar:{type:Boolean,value:!1},zIndex:{type:Number,value:999999}};export default props;

View File

@@ -0,0 +1,87 @@
/// <reference types="miniprogram-api-typings" />
import { ButtonProps } from '../button/index';
export interface TdGuideProps {
backButtonProps?: {
type: ObjectConstructor;
value?: ButtonProps;
};
counter?: {
type: StringConstructor;
value?: string | ((params: {
total: number;
current: number;
}) => string);
};
current?: {
type: NumberConstructor;
value?: number;
};
defaultCurrent?: {
type: NumberConstructor;
value?: number;
};
finishButtonProps?: {
type: ObjectConstructor;
value?: ButtonProps;
};
hideBack?: {
type: BooleanConstructor;
value?: boolean;
};
hideCounter?: {
type: BooleanConstructor;
value?: boolean;
};
hideSkip?: {
type: BooleanConstructor;
value?: boolean;
};
highlightPadding?: {
type: NumberConstructor;
value?: number;
};
mode?: {
type: StringConstructor;
value?: 'popover' | 'dialog';
};
nextButtonProps?: {
type: ObjectConstructor;
value?: ButtonProps;
};
showOverlay?: {
type: BooleanConstructor;
value?: boolean;
};
skipButtonProps?: {
type: ObjectConstructor;
value?: ButtonProps;
};
steps?: {
type: ArrayConstructor;
value?: Array<GuideStep>;
};
usingCustomNavbar?: {
type: BooleanConstructor;
value?: boolean;
};
zIndex?: {
type: NumberConstructor;
value?: number;
};
}
export interface GuideStep {
backButtonProps?: ButtonProps;
body?: string;
element: StepElement;
finishButtonProps?: ButtonProps;
highlightPadding?: number;
mode?: 'popover' | 'dialog';
nextButtonProps?: ButtonProps;
offset?: Array<string | number>;
placement?: StepPopoverPlacement;
showOverlay?: boolean;
skipButtonProps?: ButtonProps;
title?: string;
}
export declare type StepElement = () => Promise<WechatMiniprogram.BoundingClientRectCallbackResult>;
export declare type StepPopoverPlacement = 'top' | 'left' | 'right' | 'bottom' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'left-top' | 'left-bottom' | 'right-top' | 'right-bottom' | 'center';

View File

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