This commit is contained in:
Ling53666
2025-08-18 09:11:51 +08:00
commit 02554225da
2516 changed files with 133155 additions and 0 deletions

View File

@ -0,0 +1 @@
.ant-actionsheet{padding-left:12px;padding-right:12px;padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom)}.ant-actionsheet-title-wrap{text-align:center;position:relative;margin:0 -12px}.ant-actionsheet-title-content{display:inline-block;text-align:left;padding:18px 15px;font-size:15px;color:#999}.ant-actionsheet-title-content::after{content:'';position:absolute;background-color:#eee;display:block;top:auto;right:0;bottom:0;left:0;height:1px;transform:scaleY(.5)}.ant-actionsheet-list{margin:0 -12px}.ant-actionsheet-list-item{color:#333;padding:16px 15px;text-align:center;position:relative;font-size:18px}.ant-actionsheet-list-item::after{content:'';position:absolute;background-color:#eee;display:block;top:auto;right:0;bottom:0;left:0;height:1px;transform:scaleY(.5)}.ant-actionsheet-list-item-title-danger{color:#ff3141;font-weight:700}.ant-actionsheet-list-item-description{color:#999;font-size:14px;line-height:20px;margin-top:4px}.ant-actionsheet-list-item-active{background-color:#eee}.ant-actionsheet-list-item:last-child.ant-actionsheet-list-item:last-child:after{display:none}.ant-actionsheet-list-item-disabled .ant-actionsheet-list-item-content,.ant-actionsheet-list-item-disabled .ant-actionsheet-list-item-icon{opacity:.4}.ant-actionsheet-cancel-gap{height:8px;background:#f5f5f5;margin:0 -12px}.ant-actionsheet-cancel{color:#333;padding:16px 15px;font-size:18px;text-align:center;margin:0 -12px}.ant-actionsheet-cancel:active{background-color:#eee}.ant-actionsheet-icon .ant-actionsheet-title-wrap{text-align:left}.ant-actionsheet-icon .ant-actionsheet-list-item{display:flex;align-items:center}.ant-actionsheet-icon .ant-actionsheet-list-item-icon{height:24px;flex:0 0 24px;margin-right:12px;background-size:contain;background-position:center center;background-repeat:no-repeat}.ant-actionsheet-icon .ant-actionsheet-list-item-content{text-align:left}

View File

@ -0,0 +1,67 @@
<import-sjs
from="./index.sjs"
name="helper"
></import-sjs>
<ant-popup
className="ant-actionsheet-popup"
visible="{{visible}}"
position="bottom"
zIndex="{{zIndex}}"
onClose="onClose"
>
<view
style="{{style}}"
class="ant-actionsheet {{className ? className : ''}} {{helper.isIconMode(actions) ? 'ant-actionsheet-icon' : ''}}"
>
<slot name="title">
<view
a:if="{{title}}"
class="ant-actionsheet-title-wrap"
>
<view class="ant-actionsheet-title-content">{{title}}</view>
</view>
</slot>
<view class="ant-actionsheet-list">
<block
a:for="{{actions}}"
a:for-index="index"
a:for-item="item"
key="{{index}}"
>
<view
class="ant-actionsheet-list-item {{item.disabled ? 'ant-actionsheet-list-item-disabled' : ''}}"
hoverClass="{{item.disabled ? '' : 'ant-actionsheet-list-item-active'}}"
onTap="onAction"
data-index="{{index}}"
data-item="{{item}}"
>
<view
a:if="{{helper.isIconMode(actions)}}"
class="ant-actionsheet-list-item-icon"
style="background-image: url('{{item.icon}}')"
></view>
<view class="ant-actionsheet-list-item-content">
<view class="ant-actionsheet-list-item-title {{item.danger ? 'ant-actionsheet-list-item-title-danger' : ''}}">
{{item.text}}
</view>
<view
a:if="{{item.description}}"
class="ant-actionsheet-list-item-description"
>
{{item.description}}
</view>
</view>
</view>
</block>
</view>
<view class="ant-actionsheet-cancel-gap"></view>
<slot name="cancelText">
<view
class="ant-actionsheet-cancel"
onTap="onClose"
>
{{cancelText}}
</view>
</slot>
</view>
</ant-popup>

View File

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

View File

@ -0,0 +1,14 @@
import { Component, triggerEventOnly, triggerEventValues } from '../_util/simply';
import { ActionSheetDefaultProps } from './props';
Component(ActionSheetDefaultProps, {
onAction: function (e) {
var _a = e.currentTarget.dataset, item = _a.item, index = _a.index;
if (item === null || item === void 0 ? void 0 : item.disabled)
return;
triggerEventOnly(this, 'close', e);
triggerEventValues(this, 'action', [item, index], e);
},
onClose: function (e) {
triggerEventOnly(this, 'close', e);
}
});

View File

@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"ant-popup": "../Popup/index"
}
}

View File

@ -0,0 +1,8 @@
function isIconMode(actions) {
return actions.some(function (action) {
return !!action.icon;
});
}
export default {
isIconMode: isIconMode
};

View File

@ -0,0 +1,43 @@
import { IBaseProps } from '../_util/base';
export interface IActionItem {
text: string;
icon: string;
description?: string;
danger?: boolean;
disabled?: boolean;
}
/**
* @description 头像,可展示头像以及用户名等简要信息。
*/
export interface IActionSheetProps extends IBaseProps {
/**
* @description 标题
* @default ""
*/
title: string;
/**
* @description 面板选项列表
* @default []
*/
actions: IActionItem[];
/**
* @description 取消按钮文字
* @default []
*/
cancelText: string;
/**
* @description 是否显示
* @default false
*/
visible: boolean;
zIndex: number;
/**
* @description 点击选项时触发,禁用或加载状态下不会触发
*/
onAction: (aciton: IActionItem, index: number, e: any) => void;
/**
* @description 关闭时触发
*/
onClose: (e: any) => void;
}
export declare const ActionSheetDefaultProps: Partial<IActionSheetProps>;

View File

@ -0,0 +1,8 @@
export var ActionSheetDefaultProps = {
title: '',
actions: [],
cancelText: '取消',
visible: false,
// 弹窗层级
zIndex: 998,
};