更新 RayTable 组件部分细节

This commit is contained in:
ray_wuhao 2023-03-11 22:40:28 +08:00
parent c79fd284f0
commit 73428bbe6d
5 changed files with 49 additions and 14 deletions

View File

@ -0,0 +1,20 @@
@keyframes scaleScreenfull {
0% {
transform: scale(1);
}
50% {
transform: scale(1.3);
}
100% {
transform: scale(1);
}
}
.tay-table-icon__screenfull {
transition: transform 0.3s var(--r-bezier);
&:hover {
animation: scaleScreenfull 0.3s linear;
animation-direction: alternate;
}
}

View File

@ -9,6 +9,8 @@
* @remark
*/
import './index.scss'
import { NPopover } from 'naive-ui'
import RayIcon from '@/components/RayIcon/index'
@ -51,7 +53,7 @@ const TableScreenfull = defineComponent({
<RayIcon
name="fullscreen"
size="18"
customClassName="ray-table-icon"
customClassName="ray-table-icon tay-table-icon__screenfull"
onClick={this.handleScreenfull.bind(this)}
/>
),

View File

@ -9,11 +9,19 @@
* @remark
*/
/**
*
* table columns
*
* ()
*/
import './index.scss'
import { NCard, NPopover, NEllipsis } from 'naive-ui'
import RayIcon from '@/components/RayIcon/index'
import VueDraggable from 'vuedraggable'
import { setupSettingOptions } from './hook'
import { useSetting } from '@/store'
@ -28,17 +36,19 @@ const TableSetting = defineComponent({
name: 'TableSetting',
emits: ['columnsUpdate'],
setup(_, { emit }) {
const settingStore = useSetting()
const tableSettingProvider = inject(
'tableSettingProvider',
{} as TableSettingProvider,
)
const settingStore = useSetting()
const settingOptions = ref(
setupSettingOptions(tableSettingProvider.modelColumns.value),
) // 表格表头
const disableDraggable = ref(true) // 拖拽开关(暂时弃用)
const { themeValue } = storeToRefs(settingStore)
/** 拖拽结束后 */
const handleDraggableEnd = () => {
emit('columnsUpdate', settingOptions.value)
}
@ -99,7 +109,7 @@ const TableSetting = defineComponent({
*
* @param idx
*
* @remark
* @remark ,
*/
const handleResizeColumnClick = (idx: number) => {
const value = settingOptions.value[idx]

View File

@ -12,7 +12,7 @@
& .ray-table-header-extra__space {
display: flex;
gap: 0 1px;
gap: 0 12px;
align-items: center;
}
}

View File

@ -26,6 +26,14 @@
* `xlsx.js` `excel`
*/
/**
*
* , ...
* ,
*
* ,
*/
import './index.scss'
import { NDataTable, NCard, NDropdown, NDivider } from 'naive-ui'
@ -49,8 +57,8 @@ const RayTable = defineComponent({
props: props,
emits: ['update:columns', 'menuSelect', 'exportSuccess', 'exportError'],
setup(props, { emit }) {
const tableUUID = uuid()
const rayTableUUID = uuid()
const tableUUID = uuid() // 表格 id, 用于打印表格
const rayTableUUID = uuid() // RayTable id, 用于全屏表格
const modelRightClickMenu = computed(() => props.rightClickMenu)
const modelColumns = computed({
get: () => props.columns,
@ -73,10 +81,7 @@ const RayTable = defineComponent({
})
const tableSize = ref(props.size)
/**
*
*
*/
/** 注入相关属性 */
provide('tableSettingProvider', {
modelRightClickMenu,
modelColumns,
@ -84,6 +89,7 @@ const RayTable = defineComponent({
rayTableUUID,
})
/** 拖拽更新后的表格列 */
const handleColumnsUpdate = (arr: ActionOptions[]) => {
modelColumns.value = arr
}
@ -182,6 +188,7 @@ const RayTable = defineComponent({
print(options)
}
/** 更新后的表格尺寸 */
const handleChangeTableSize = (size: ComponentSize) => {
tableSize.value = size
}
@ -252,7 +259,6 @@ const RayTable = defineComponent({
negativeText={this.printNegativeText}
onPositive={this.handlePrintPositive.bind(this)}
/>
<NDivider vertical />
{/* 输出为Excel表格 */}
<TableAction
icon={this.exportExcelIcon}
@ -262,15 +268,12 @@ const RayTable = defineComponent({
negativeText={this.exportNegativeText}
onPositive={this.handleExportPositive.bind(this)}
/>
<NDivider vertical />
{/* 表格尺寸调整 */}
<TableSize
onChangeSize={this.handleChangeTableSize.bind(this)}
/>
<NDivider vertical />
{/* 全屏表格 */}
<TableScreenfull />
<NDivider vertical />
{/* 表格列操作 */}
<TableSetting
onColumnsUpdate={this.handleColumnsUpdate.bind(this)}