mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 10:33:50 +08:00
parent
c82040425d
commit
1214b7c32c
@ -1,14 +1,14 @@
|
|||||||
import type { BasicColumn, BasicTableProps, CellFormat, GetColumnsParams } from '../types/table';
|
import type { BasicColumn, BasicTableProps, CellFormat, GetColumnsParams } from '../types/table';
|
||||||
import type { PaginationProps } from '../types/pagination';
|
import type { PaginationProps } from '../types/pagination';
|
||||||
import type { ComputedRef } from 'vue';
|
import type { ComputedRef } from 'vue';
|
||||||
import { unref, Ref, computed, watch, ref, toRaw } from 'vue';
|
import { computed, Ref, ref, toRaw, unref, watch } from 'vue';
|
||||||
import { renderEditCell } from '../components/editable';
|
import { renderEditCell } from '../components/editable';
|
||||||
import { usePermission } from '/@/hooks/web/usePermission';
|
import { usePermission } from '/@/hooks/web/usePermission';
|
||||||
import { useI18n } from '/@/hooks/web/useI18n';
|
import { useI18n } from '/@/hooks/web/useI18n';
|
||||||
import { isBoolean, isArray, isString, isObject, isFunction } from '/@/utils/is';
|
import { isArray, isBoolean, isFunction, isMap, isString } from '/@/utils/is';
|
||||||
import { isEqual, cloneDeep } from 'lodash-es';
|
import { cloneDeep, isEqual } from 'lodash-es';
|
||||||
import { formatToDate } from '/@/utils/dateUtil';
|
import { formatToDate } from '/@/utils/dateUtil';
|
||||||
import { DEFAULT_ALIGN, PAGE_SIZE, INDEX_COLUMN_FLAG, ACTION_COLUMN_FLAG } from '../const';
|
import { ACTION_COLUMN_FLAG, DEFAULT_ALIGN, INDEX_COLUMN_FLAG, PAGE_SIZE } from '../const';
|
||||||
|
|
||||||
function handleItem(item: BasicColumn, ellipsis: boolean) {
|
function handleItem(item: BasicColumn, ellipsis: boolean) {
|
||||||
const { key, dataIndex, children } = item;
|
const { key, dataIndex, children } = item;
|
||||||
@ -287,11 +287,9 @@ function sortFixedColumn(columns: BasicColumn[]) {
|
|||||||
}
|
}
|
||||||
defColumns.push(column);
|
defColumns.push(column);
|
||||||
}
|
}
|
||||||
const resultColumns = [...fixedLeftColumns, ...defColumns, ...fixedRightColumns].filter(
|
return [...fixedLeftColumns, ...defColumns, ...fixedRightColumns].filter(
|
||||||
(item) => !item.defaultHidden
|
(item) => !item.defaultHidden
|
||||||
);
|
);
|
||||||
|
|
||||||
return resultColumns;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// format cell
|
// format cell
|
||||||
@ -317,8 +315,8 @@ export function formatCell(text: string, format: CellFormat, record: Recordable,
|
|||||||
return formatToDate(text, dateFormat);
|
return formatToDate(text, dateFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// enum
|
// Map
|
||||||
if (isObject(format) && Reflect.has(format, 'size')) {
|
if (isMap(format)) {
|
||||||
return format.get(text);
|
return format.get(text);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -84,6 +84,10 @@ export function isElement(val: unknown): val is Element {
|
|||||||
return isObject(val) && !!val.tagName;
|
return isObject(val) && !!val.tagName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function isMap(val: unknown): val is Map {
|
||||||
|
return is(val, 'Map');
|
||||||
|
}
|
||||||
|
|
||||||
export const isServer = typeof window === 'undefined';
|
export const isServer = typeof window === 'undefined';
|
||||||
|
|
||||||
export const isClient = !isServer;
|
export const isClient = !isServer;
|
||||||
|
Loading…
Reference in New Issue
Block a user