Pre Merge pull request !4 from 严家纯/main
This commit is contained in:
commit
4a9e3b5c70
|
|
@ -3,4 +3,4 @@ ports:
|
||||||
onOpen: open-preview
|
onOpen: open-preview
|
||||||
tasks:
|
tasks:
|
||||||
- init: pnpm install
|
- init: pnpm install
|
||||||
command: pnpm dev
|
command: pnpm run dev
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
module.exports = {
|
|
||||||
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
|
|
||||||
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': ['prettier --write--parser json'],
|
|
||||||
'package.json': ['prettier --write'],
|
|
||||||
'*.vue': ['eslint --fix', 'prettier --write', 'stylelint --fix'],
|
|
||||||
'*.{scss,less,styl,html}': ['stylelint --fix', 'prettier --write'],
|
|
||||||
'*.md': ['prettier --write'],
|
|
||||||
};
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": [
|
||||||
"octref.vetur",
|
"johnsoncodehk.volar",
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
"stylelint.vscode-stylelint",
|
"stylelint.vscode-stylelint",
|
||||||
"esbenp.prettier-vscode",
|
"esbenp.prettier-vscode",
|
||||||
|
|
|
||||||
21
index.html
21
index.html
|
|
@ -8,7 +8,6 @@
|
||||||
name="viewport"
|
name="viewport"
|
||||||
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
|
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<title><%= title %></title>
|
<title><%= title %></title>
|
||||||
<link rel="icon" href="/favicon.ico" />
|
<link rel="icon" href="/favicon.ico" />
|
||||||
</head>
|
</head>
|
||||||
|
|
@ -30,7 +29,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
html[data-theme='dark'] .app-loading .app-loading-title {
|
html[data-theme='dark'] .app-loading .app-loading-title {
|
||||||
color: rgba(255, 255, 255, 0.85);
|
color: rgb(255 255 255 / 85%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-loading {
|
.app-loading {
|
||||||
|
|
@ -48,7 +47,6 @@
|
||||||
top: 50%;
|
top: 50%;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
display: flex;
|
display: flex;
|
||||||
-webkit-transform: translate3d(-50%, -50%, 0);
|
|
||||||
transform: translate3d(-50%, -50%, 0);
|
transform: translate3d(-50%, -50%, 0);
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
@ -66,7 +64,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
margin-top: 30px;
|
margin-top: 30px;
|
||||||
font-size: 30px;
|
font-size: 30px;
|
||||||
color: rgba(0, 0, 0, 0.85);
|
color: rgb(0 0 0 / 85%);
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
@ -97,7 +95,7 @@
|
||||||
height: 20px;
|
height: 20px;
|
||||||
background-color: #0065cc;
|
background-color: #0065cc;
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
opacity: 0.3;
|
opacity: 30%;
|
||||||
transform: scale(0.75);
|
transform: scale(0.75);
|
||||||
animation: antSpinMove 1s infinite linear alternate;
|
animation: antSpinMove 1s infinite linear alternate;
|
||||||
transform-origin: 50% 50%;
|
transform-origin: 50% 50%;
|
||||||
|
|
@ -111,43 +109,38 @@
|
||||||
.dot i:nth-child(2) {
|
.dot i:nth-child(2) {
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
-webkit-animation-delay: 0.4s;
|
|
||||||
animation-delay: 0.4s;
|
animation-delay: 0.4s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dot i:nth-child(3) {
|
.dot i:nth-child(3) {
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
-webkit-animation-delay: 0.8s;
|
|
||||||
animation-delay: 0.8s;
|
animation-delay: 0.8s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dot i:nth-child(4) {
|
.dot i:nth-child(4) {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
-webkit-animation-delay: 1.2s;
|
|
||||||
animation-delay: 1.2s;
|
animation-delay: 1.2s;
|
||||||
}
|
}
|
||||||
@keyframes antRotate {
|
@keyframes antRotate {
|
||||||
to {
|
to {
|
||||||
-webkit-transform: rotate(405deg);
|
|
||||||
transform: rotate(405deg);
|
transform: rotate(405deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@-webkit-keyframes antRotate {
|
@keyframes antRotate {
|
||||||
to {
|
to {
|
||||||
-webkit-transform: rotate(405deg);
|
|
||||||
transform: rotate(405deg);
|
transform: rotate(405deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@keyframes antSpinMove {
|
@keyframes antSpinMove {
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@-webkit-keyframes antSpinMove {
|
@keyframes antSpinMove {
|
||||||
to {
|
to {
|
||||||
opacity: 1;
|
opacity: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
26
package.json
26
package.json
|
|
@ -23,7 +23,7 @@
|
||||||
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix",
|
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix",
|
||||||
"lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
|
"lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
|
||||||
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
|
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
|
||||||
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
|
"lint:lint-staged": "lint-staged",
|
||||||
"test:unit": "jest",
|
"test:unit": "jest",
|
||||||
"test:unit-coverage": "jest --coverage",
|
"test:unit-coverage": "jest --coverage",
|
||||||
"test:gzip": "npx http-server dist --cors --gzip -c-1",
|
"test:gzip": "npx http-server dist --cors --gzip -c-1",
|
||||||
|
|
@ -159,5 +159,29 @@
|
||||||
"homepage": "https://github.com/anncwb/vue-vben-admin",
|
"homepage": "https://github.com/anncwb/vue-vben-admin",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "^12 || >=14"
|
"node": "^12 || >=14"
|
||||||
|
},
|
||||||
|
"lint-staged": {
|
||||||
|
"*.{js,jsx,ts,tsx}": [
|
||||||
|
"eslint --fix",
|
||||||
|
"prettier --write"
|
||||||
|
],
|
||||||
|
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": [
|
||||||
|
"prettier --write--parser json"
|
||||||
|
],
|
||||||
|
"package.json": [
|
||||||
|
"prettier --write"
|
||||||
|
],
|
||||||
|
"*.vue": [
|
||||||
|
"eslint --fix",
|
||||||
|
"prettier --write",
|
||||||
|
"stylelint --fix"
|
||||||
|
],
|
||||||
|
"*.{scss,less,styl,html}": [
|
||||||
|
"stylelint --fix",
|
||||||
|
"prettier --write"
|
||||||
|
],
|
||||||
|
"*.md": [
|
||||||
|
"prettier --write"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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: !columnKeys.includes(item.dataIndex! || (item.key as string)),
|
||||||
defaultHidden: false,
|
});
|
||||||
});
|
|
||||||
} 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,
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,8 @@
|
||||||
if (!meta) {
|
if (!meta) {
|
||||||
return !!name;
|
return !!name;
|
||||||
}
|
}
|
||||||
const { title, hideBreadcrumb } = meta;
|
const { title, hideBreadcrumb, hideMenu } = meta;
|
||||||
if (!title || hideBreadcrumb) {
|
if (!title || hideBreadcrumb || hideMenu) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
||||||
const DATE_FORMAT = 'YYYY-MM-DD ';
|
const DATE_FORMAT = 'YYYY-MM-DD';
|
||||||
|
|
||||||
export function formatToDateTime(
|
export function formatToDateTime(
|
||||||
date: dayjs.Dayjs | undefined = undefined,
|
date: dayjs.Dayjs | undefined = undefined,
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ export function dataURLtoBlob(base64Buf: string): Blob {
|
||||||
const arr = base64Buf.split(',');
|
const arr = base64Buf.split(',');
|
||||||
const typeItem = arr[0];
|
const typeItem = arr[0];
|
||||||
const mime = typeItem.match(/:(.*?);/)![1];
|
const mime = typeItem.match(/:(.*?);/)![1];
|
||||||
const bstr = atob(arr[1]);
|
const bstr = window.atob(arr[1]);
|
||||||
let n = bstr.length;
|
let n = bstr.length;
|
||||||
const u8arr = new Uint8Array(n);
|
const u8arr = new Uint8Array(n);
|
||||||
while (n--) {
|
while (n--) {
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,10 @@ module.exports = {
|
||||||
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
|
ignoreFiles: ['**/*.js', '**/*.jsx', '**/*.tsx', '**/*.ts'],
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: ['*.vue', '**/*.vue'],
|
files: ['*.vue', '**/*.vue', '*.html', '**/*.html'],
|
||||||
extends: ['stylelint-config-recommended', 'stylelint-config-html'],
|
extends: ['stylelint-config-recommended', 'stylelint-config-html'],
|
||||||
rules: {
|
rules: {
|
||||||
|
'keyframes-name-pattern': null,
|
||||||
'selector-pseudo-class-no-unknown': [
|
'selector-pseudo-class-no-unknown': [
|
||||||
true,
|
true,
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ export default defineConfig({
|
||||||
* Used for animation when the element is displayed
|
* Used for animation when the element is displayed
|
||||||
* @param maxOutput The larger the maxOutput output, the larger the generated css volume
|
* @param maxOutput The larger the maxOutput output, the larger the generated css volume
|
||||||
*/
|
*/
|
||||||
function createEnterPlugin(maxOutput = 7) {
|
function createEnterPlugin(maxOutput = 6) {
|
||||||
const createCss = (index: number, d = 'x') => {
|
const createCss = (index: number, d = 'x') => {
|
||||||
const upd = d.toUpperCase();
|
const upd = d.toUpperCase();
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue