* fix(Loading): add theme prop, The repair background prop does not take effect * fix(AppLogo): fix title line height * fix(Table,Upload): fix #1349 #1250 #1245
This commit is contained in:
parent
b3c4002b69
commit
3b3f6c903a
|
|
@ -43,7 +43,7 @@
|
||||||
<CheckboxGroup v-model:value="checkedList" @change="onChange" ref="columnListRef">
|
<CheckboxGroup v-model:value="checkedList" @change="onChange" ref="columnListRef">
|
||||||
<template v-for="item in plainOptions" :key="item.value">
|
<template v-for="item in plainOptions" :key="item.value">
|
||||||
<div :class="`${prefixCls}__check-item`" v-if="!('ifShow' in item && !item.ifShow)">
|
<div :class="`${prefixCls}__check-item`" v-if="!('ifShow' in item && !item.ifShow)">
|
||||||
<DragOutlined class="table-coulmn-drag-icon" />
|
<DragOutlined class="table-column-drag-icon" />
|
||||||
<Checkbox :value="item.value">
|
<Checkbox :value="item.value">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
|
|
@ -120,7 +120,7 @@
|
||||||
import { useSortable } from '/@/hooks/web/useSortable';
|
import { useSortable } from '/@/hooks/web/useSortable';
|
||||||
import { isFunction, isNullAndUnDef } from '/@/utils/is';
|
import { isFunction, isNullAndUnDef } from '/@/utils/is';
|
||||||
import { getPopupContainer as getParentContainer } from '/@/utils';
|
import { getPopupContainer as getParentContainer } from '/@/utils';
|
||||||
import { omit } from 'lodash-es';
|
import { cloneDeep, omit } from 'lodash-es';
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
checkAll: boolean;
|
checkAll: boolean;
|
||||||
|
|
@ -250,16 +250,15 @@
|
||||||
|
|
||||||
const indeterminate = computed(() => {
|
const indeterminate = computed(() => {
|
||||||
const len = plainOptions.value.length;
|
const len = plainOptions.value.length;
|
||||||
let checkdedLen = state.checkedList.length;
|
let checkedLen = state.checkedList.length;
|
||||||
unref(checkIndex) && checkdedLen--;
|
unref(checkIndex) && checkedLen--;
|
||||||
return checkdedLen > 0 && checkdedLen < len;
|
return checkedLen > 0 && checkedLen < len;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Trigger when check/uncheck a column
|
// Trigger when check/uncheck a column
|
||||||
function onChange(checkedList: string[]) {
|
function onChange(checkedList: string[]) {
|
||||||
const len = plainOptions.value.length;
|
const len = plainSortOptions.value.length;
|
||||||
state.checkAll = checkedList.length === len;
|
state.checkAll = checkedList.length === len;
|
||||||
|
|
||||||
const sortList = unref(plainSortOptions).map((item) => item.value);
|
const sortList = unref(plainSortOptions).map((item) => item.value);
|
||||||
checkedList.sort((prev, next) => {
|
checkedList.sort((prev, next) => {
|
||||||
return sortList.indexOf(prev) - sortList.indexOf(next);
|
return sortList.indexOf(prev) - sortList.indexOf(next);
|
||||||
|
|
@ -286,14 +285,14 @@
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
// Drag and drop sort
|
// Drag and drop sort
|
||||||
const { initSortable } = useSortable(el, {
|
const { initSortable } = useSortable(el, {
|
||||||
handle: '.table-coulmn-drag-icon ',
|
handle: '.table-column-drag-icon',
|
||||||
onEnd: (evt) => {
|
onEnd: (evt) => {
|
||||||
const { oldIndex, newIndex } = evt;
|
const { oldIndex, newIndex } = evt;
|
||||||
if (isNullAndUnDef(oldIndex) || isNullAndUnDef(newIndex) || oldIndex === newIndex) {
|
if (isNullAndUnDef(oldIndex) || isNullAndUnDef(newIndex) || oldIndex === newIndex) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Sort column
|
// Sort column
|
||||||
const columns = getColumns();
|
const columns = cloneDeep(plainSortOptions.value);
|
||||||
|
|
||||||
if (oldIndex > newIndex) {
|
if (oldIndex > newIndex) {
|
||||||
columns.splice(newIndex, 0, columns[oldIndex]);
|
columns.splice(newIndex, 0, columns[oldIndex]);
|
||||||
|
|
@ -304,7 +303,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
plainSortOptions.value = columns;
|
plainSortOptions.value = columns;
|
||||||
plainOptions.value = columns;
|
|
||||||
setColumns(columns);
|
setColumns(columns);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -347,7 +345,7 @@
|
||||||
|
|
||||||
function setColumns(columns: BasicColumn[] | string[]) {
|
function setColumns(columns: BasicColumn[] | string[]) {
|
||||||
table.setColumns(columns);
|
table.setColumns(columns);
|
||||||
const data: ColumnChangeParam[] = unref(plainOptions).map((col) => {
|
const data: ColumnChangeParam[] = unref(plainSortOptions).map((col) => {
|
||||||
const visible =
|
const visible =
|
||||||
columns.findIndex(
|
columns.findIndex(
|
||||||
(c: BasicColumn | string) =>
|
(c: BasicColumn | string) =>
|
||||||
|
|
@ -390,7 +388,7 @@
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
@prefix-cls: ~'@{namespace}-basic-column-setting';
|
@prefix-cls: ~'@{namespace}-basic-column-setting';
|
||||||
|
|
||||||
.table-coulmn-drag-icon {
|
.table-column-drag-icon {
|
||||||
margin: 0 5px;
|
margin: 0 5px;
|
||||||
cursor: move;
|
cursor: move;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -216,25 +216,17 @@ export function useColumns(
|
||||||
const columnKeys = columns as string[];
|
const columnKeys = columns as string[];
|
||||||
const newColumns: BasicColumn[] = [];
|
const newColumns: BasicColumn[] = [];
|
||||||
cacheColumns.forEach((item) => {
|
cacheColumns.forEach((item) => {
|
||||||
if (columnKeys.includes(item.dataIndex! || (item.key as string))) {
|
|
||||||
newColumns.push({
|
newColumns.push({
|
||||||
...item,
|
...item,
|
||||||
defaultHidden: false,
|
defaultHidden: !columnKeys.includes(item.dataIndex! || (item.key as string)),
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
newColumns.push({
|
|
||||||
...item,
|
|
||||||
defaultHidden: true,
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Sort according to another array
|
// Sort according to another array
|
||||||
if (!isEqual(cacheKeys, columns)) {
|
if (!isEqual(cacheKeys, columns)) {
|
||||||
newColumns.sort((prev, next) => {
|
newColumns.sort((prev, next) => {
|
||||||
return (
|
return (
|
||||||
cacheKeys.indexOf(prev.dataIndex as string) -
|
columnKeys.indexOf(prev.dataIndex as string) -
|
||||||
cacheKeys.indexOf(next.dataIndex as string)
|
columnKeys.indexOf(next.dataIndex as string)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
import { basicProps } from './props';
|
import { basicProps } from './props';
|
||||||
import { createTableColumns, createActionColumn } from './data';
|
import { createTableColumns, createActionColumn } from './data';
|
||||||
// utils
|
// utils
|
||||||
import { checkFileType, checkImgType, getBase64WithFile } from './helper';
|
import { checkImgType, getBase64WithFile } from './helper';
|
||||||
import { buildUUID } from '/@/utils/uuid';
|
import { buildUUID } from '/@/utils/uuid';
|
||||||
import { isFunction } from '/@/utils/is';
|
import { isFunction } from '/@/utils/is';
|
||||||
import { warn } from '/@/utils/log';
|
import { warn } from '/@/utils/log';
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const [register, { closeModal }] = useModalInner();
|
const [register, { closeModal }] = useModalInner();
|
||||||
|
|
||||||
const { getAccept, getStringAccept, getHelpText } = useUploadType({
|
const { getStringAccept, getHelpText } = useUploadType({
|
||||||
acceptRef: accept,
|
acceptRef: accept,
|
||||||
helpTextRef: helpText,
|
helpTextRef: helpText,
|
||||||
maxNumberRef: maxNumber,
|
maxNumberRef: maxNumber,
|
||||||
|
|
@ -124,18 +124,12 @@
|
||||||
function beforeUpload(file: File) {
|
function beforeUpload(file: File) {
|
||||||
const { size, name } = file;
|
const { size, name } = file;
|
||||||
const { maxSize } = props;
|
const { maxSize } = props;
|
||||||
const accept = unref(getAccept);
|
|
||||||
// 设置最大值,则判断
|
// 设置最大值,则判断
|
||||||
if (maxSize && file.size / 1024 / 1024 >= maxSize) {
|
if (maxSize && file.size / 1024 / 1024 >= maxSize) {
|
||||||
createMessage.error(t('component.upload.maxSizeMultiple', [maxSize]));
|
createMessage.error(t('component.upload.maxSizeMultiple', [maxSize]));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置类型,则判断
|
|
||||||
if (accept.length > 0 && !checkFileType(file, accept)) {
|
|
||||||
createMessage.error!(t('component.upload.acceptUpload', [accept.join(',')]));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const commonItem = {
|
const commonItem = {
|
||||||
uuid: buildUUID(),
|
uuid: buildUUID(),
|
||||||
file,
|
file,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue