1 line
6.7 KiB
Plaintext
1 line
6.7 KiB
Plaintext
|
{"version":3,"file":"wd-action-sheet.js","sources":["../../../../../../../node_modules/wot-design-uni/components/wd-action-sheet/wd-action-sheet.vue","../../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL25vZGVfbW9kdWxlcy93b3QtZGVzaWduLXVuaS9jb21wb25lbnRzL3dkLWFjdGlvbi1zaGVldC93ZC1hY3Rpb24tc2hlZXQudnVl"],"sourcesContent":["<template>\n <view>\n <wd-popup\n custom-class=\"wd-action-sheet__popup\"\n :custom-style=\"`${(actions && actions.length) || (panels && panels.length) ? 'background: transparent;' : ''}`\"\n v-model=\"showPopup\"\n :duration=\"duration\"\n position=\"bottom\"\n :close-on-click-modal=\"closeOnClickModal\"\n :safe-area-inset-bottom=\"safeAreaInsetBottom\"\n :lazy-render=\"lazyRender\"\n @enter=\"handleOpen\"\n @close=\"close\"\n @after-enter=\"handleOpened\"\n @after-leave=\"handleClosed\"\n @click-modal=\"handleClickModal\"\n :z-index=\"zIndex\"\n >\n <view\n :class=\"`wd-action-sheet ${customClass}`\"\n :style=\"`${\n (actions && actions.length) || (panels && panels.length)\n ? 'margin: 0 10px calc(var(--window-bottom) + 10px) 10px; border-radius: 16px;'\n : 'margin-bottom: var(--window-bottom);'\n } ${customStyle}`\"\n >\n <view v-if=\"title\" :class=\"`wd-action-sheet__header ${customHeaderClass}`\">\n {{ title }}\n <wd-icon custom-class=\"wd-action-sheet__close\" name=\"add\" @click=\"close\" />\n </view>\n <view class=\"wd-action-sheet__actions\" v-if=\"actions && actions.length\">\n <button\n v-for=\"(action, rowIndex) in actions\"\n :key=\"rowIndex\"\n :class=\"`wd-action-sheet__action ${action.disabled ? 'wd-action-sheet__action--disabled' : ''} ${\n action.loading ? 'wd-action-sheet__action--loading' : ''\n }`\"\n :style=\"`color: ${action.color}`\"\n @click=\"select(rowIndex, 'action')\"\n >\n <wd-loading v-if=\"action.loading\" size=\"20px\" />\n <view v-else class=\"wd-action-sheet__name\">{{ action.name }}</view>\n <view v-if=\"!action.loading && action.subname\" class=\"wd-action-sheet__subname\">{{ action.subname }}</view>\n </button>\n </view>\n <view v-if=\"formatPanels && formatPanels.length\">\n <view v-for=\"(panel, rowIndex) in formatPanels\" :key=\"rowIndex\" class=\"wd-action-sheet__panels\">\n <view class=\"wd-action-sheet__panels-content\">\n <view v-for=\"(col, colIndex) in panel\" :key=\"colIndex\" class=\"wd-action-sheet__panel\" @click=\"select(rowIndex, 'panels', colIndex)\">\n <image class=\"wd-action-sheet__panel-img\" :src=\"(col as any).iconUrl\" />\n <view class=\"wd-action-sheet__panel-title\">{{ (col as any).title }}</view>\n </view>\n </view>\n </view>\n </view>\n <slot />\n <button v-if=\"cancelText\" class=\"wd-action-sheet__cancel\" @click=\"handleCancel\">{{ cancelText }}</button>\n </view>\n </wd-popup>\n </view>\n</template>\n<script lang=\"ts\">\nexport default {\n name: 'wd-action-sheet',\n options: {\n addGlobalClass: true,\n virtualHost: true,\n styleIsolation: 'shared'\n }\n}\n</script>\n\n<script lang=\"ts\" setup>\nimport { watch, ref } from 'vue'\nimport { actionSheetProps, type Panel } from './types'\nimport { isArray } from '../common/util'\n\nconst props = defineProps(actionSheetProps)\nconst emit = defineEmits(['select', 'click-modal', 'cancel', 'closed', 'close', 'open', 'opened', 'update:modelValue'])\n\nconst formatPanels = ref<Array<Panel> | Array<Panel[]>>([])\n\nconst showPopup = ref<boolean>(false)\n\nwatch(() => props.panels, computedValue, { deep: true, immediate: true })\n\nwatch(\n () => props.modelValue,\n (newValue) => {\n showPopup.value = newValue\n },\n { deep: true, immediate: true }\n)\n\nfunction isPanelArray() {\n return props.panels.length &&
|