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

@@ -1,46 +1 @@
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length; var r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc; var d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
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 } = config;
const name = `${prefix}-popup`;
let Popup = class Popup extends SuperComponent {
constructor() {
super(...arguments);
this.externalClasses = [`${prefix}-class`, `${prefix}-class-content`];
this.behaviors = [transition(), useCustomNavbar];
this.options = {
multipleSlots: true,
};
this.properties = props;
this.data = {
prefix,
classPrefix: name,
};
this.methods = {
handleOverlayClick() {
const { closeOnOverlayClick } = this.properties;
if (closeOnOverlayClick) {
this.triggerEvent('visible-change', { visible: false, trigger: 'overlay' });
}
},
handleClose() {
this.triggerEvent('visible-change', { visible: false, trigger: 'close-btn' });
},
};
}
};
Popup = __decorate([
wxComponent()
], Popup);
export default Popup;
//# sourceMappingURL=popup.js.map
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

@@ -1 +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 || ''}}"/>
<wxs src="./popup.wxs" module="popup"/><wxs src="../common/utils.wxs" module="_"/><view wx:if="{{realVisible}}" style="{{_._style([popup.getPopupStyles(zIndex, distanceTop, placement, duration), 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 || 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

@@ -1,8 +1,11 @@
function getPopupStyles(zIndex, distanceTop, placement) {
function getPopupStyles(zIndex, distanceTop, placement, duration) {
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;';
}
if (duration) {
zIndexStyle = zIndexStyle + '--td-popup-transition:all ' + duration + 'ms ease;';
}
return zIndexStyle;
}

View File

@@ -1 +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:all .3s 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-extra-large,24rpx));border-bottom-right-radius:var(--td-popup-border-radius,var(--td-radius-extra-large,24rpx))}.t-popup--bottom{bottom:0;left:0;width:100%;border-top-left-radius:var(--td-popup-border-radius,var(--td-radius-extra-large,24rpx));border-top-right-radius:var(--td-popup-border-radius,var(--td-radius-extra-large,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-extra-large,24rpx))}.t-popup.t-fade-enter.t-popup--top,.t-popup.t-fade-leave-to.t-popup--top{transform:translateY(-100%)}.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}
@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

@@ -1 +1 @@
const props={closeBtn:{type:Boolean},closeOnOverlayClick:{type:Boolean,value:!0},content:{type:String},duration:{type:Number,value:240},externalClasses:{type:Array},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;
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

@@ -16,10 +16,6 @@ export interface TdPopupProps {
type: NumberConstructor;
value?: number;
};
externalClasses?: {
type: ArrayConstructor;
value?: ['t-class', 't-class-overlay', 't-class-content'];
};
overlayProps?: {
type: ObjectConstructor;
value?: OverlayProps;