1
0
mirror of synced 2025-12-09 07:08:22 +08:00
This commit is contained in:
xuliangzhan
2023-06-06 08:20:10 +08:00
parent 2359d43cb2
commit af99cd5251
4 changed files with 38 additions and 11 deletions

View File

@@ -24,6 +24,8 @@ const isWebkit = browse['-webkit'] && !browse.edge
const resizableStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_WIDTH'
const visibleStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_VISIBLE'
const fixedStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_FIXED'
const orderStorageKey = 'VXE_TABLE_CUSTOM_COLUMN_ORDER'
export default defineComponent({
name: 'VxeTable',
@@ -837,9 +839,11 @@ export default defineComponent({
const { collectColumn } = internalData
const customOpts = computeCustomOpts.value
const { storage } = customOpts
const isResizable = storage === true || (storage && storage.resizable)
const isVisible = storage === true || (storage && storage.visible)
if (customConfig && (isResizable || isVisible)) {
const isCustomResizable = storage === true || (storage && storage.resizable)
const isCustomVisible = storage === true || (storage && storage.visible)
const isCustomFixed = storage === true || (storage && storage.fixed)
const isCustomOrder = storage === true || (storage && storage.order)
if (customConfig && (isCustomResizable || isCustomVisible || isCustomFixed || isCustomOrder)) {
const customMap: {
[key: string]: {
field?: VxeColumnPropTypes.Field
@@ -851,7 +855,8 @@ export default defineComponent({
errLog('vxe.error.reqProp', ['id'])
return
}
if (isResizable) {
// 自定义列宽
if (isCustomResizable) {
const columnWidthStorage = getCustomStorageMap(resizableStorageKey)[id]
if (columnWidthStorage) {
XEUtils.each(columnWidthStorage, (resizeWidth: number, field) => {
@@ -859,7 +864,22 @@ export default defineComponent({
})
}
}
if (isVisible) {
// 自定义固定列
if (isCustomFixed) {
const columnFixedStorage = getCustomStorageMap(fixedStorageKey)[id]
if (columnFixedStorage) {
// 开发中...
}
}
// 自定义顺序
if (isCustomOrder) {
const columnOrderStorage = getCustomStorageMap(orderStorageKey)[id]
if (columnOrderStorage) {
// 开发中...
}
}
// 自定义隐藏列
if (isCustomVisible) {
const columnVisibleStorage = getCustomStorageMap(visibleStorageKey)[id]
if (columnVisibleStorage) {
const colVisibles = columnVisibleStorage.split('|')

View File

@@ -1232,8 +1232,8 @@
position: relative;
&:before {
content: "";
top: -$vxe-table-cell-dirty-width;
left: -$vxe-table-cell-dirty-width;
top: --vxe-table-cell-dirty-width;
left: --vxe-table-cell-dirty-width;
position: absolute;
border-width: var(--vxe-table-cell-dirty-width);
border-style: solid;
@@ -1248,8 +1248,8 @@
position: relative;
&:before {
content: "";
top: -$vxe-table-cell-dirty-width;
left: -$vxe-table-cell-dirty-width;
top: --vxe-table-cell-dirty-width;
left: --vxe-table-cell-dirty-width;
position: absolute;
border-width: var(--vxe-table-cell-dirty-width);
border-style: solid;

View File

@@ -199,7 +199,7 @@ export interface FormItemRenderOptions extends VxeGlobalRendererHandles.RenderOp
* 渲染组件的内容(需要渲染器支持)
*/
content?: string
autofocus?: boolean
autofocus?: string
defaultValue?: ((params: { item: VxeFormItemProps }) => any) | null | undefined | string | number | RegExp | object | any[] | Date
}

9
types/table.d.ts vendored
View File

@@ -333,7 +333,12 @@ export interface TablePublicMethods<DT = VxeTableDataRow> {
* 如果已关联工具栏,则会同步更新
* @param options 可选参数
*/
resetColumn(options?: boolean | { visible?: boolean, resizable?: boolean }): Promise<void>
resetColumn(options?: boolean | {
visible?: boolean
resizable?: boolean
fixed?: boolean
order?: boolean
}): Promise<void>
/**
* 刷新列配置
* 对于动态修改属性、显示/隐藏列等场景下可能会用到
@@ -1311,6 +1316,8 @@ export namespace VxeTablePropTypes {
storage?: boolean | {
visible?: boolean
resizable?: boolean
fixed?: boolean
order?: boolean
}
checkMethod?(params: {
column: VxeTableDefines.ColumnInfo<D>