// Utils
import { createNamespace } from '../utils';
// Components
import Icon from '../icon';
import Popup, { popupSharedProps } from '../popup';
import Loading from '../loading';
const [createComponent, bem] = createNamespace('action-sheet');
function Header({ title, closeIcon, onCancel }) {
if (title) {
return (
);
}
}
function Option({ item }) {
const { name, color, subname, loading, disabled, className } = item;
const Content = loading ? (
) : (
[
{name},
subname && {subname}
,
]
);
return (
);
}
function CancelText({ cancelText, onCancel }) {
if (cancelText) {
return [
,
,
];
}
}
export default createComponent({
props: {
...popupSharedProps,
title: String,
actions: Array,
duration: [Number, String],
teleport: [String, Object],
cancelText: String,
description: String,
closeOnPopstate: Boolean,
closeOnClickAction: Boolean,
round: {
type: Boolean,
default: true,
},
closeIcon: {
type: String,
default: 'cross',
},
safeAreaInsetBottom: {
type: Boolean,
default: true,
},
overlay: {
type: Boolean,
default: true,
},
closeOnClickOverlay: {
type: Boolean,
default: true,
},
},
emits: ['select', 'cancel', 'update:show'],
setup(props, { slots, emit }) {
function onUpdateShow(show) {
emit('update:show', show);
}
function onCancel() {
onUpdateShow(false);
emit('cancel');
}
return function () {
const {
title,
actions,
closeIcon,
cancelText,
description,
closeOnClickAction,
...restProps
} = props;
const Content = slots.default && (
{slots.default()}
);
const Description = description && (
{description}
);
const Options =
actions &&
actions.map((item, index) => (