Skip to content

Commit ef52853

Browse files
authored
chore: format code style (#3808)
* first commit * style: format code style * style: format code style
1 parent ba5b8f8 commit ef52853

21 files changed

+54
-90
lines changed

src/components/Form/src/hooks/useFormEvents.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import type { NamePath } from 'ant-design-vue/lib/form/interface';
44
import { unref, toRaw, nextTick } from 'vue';
55
import { isArray, isFunction, isObject, isString, isDef, isNil } from '@/utils/is';
66
import { deepMerge } from '@/utils';
7-
import {
8-
dateItemType,
9-
defaultValueComponents,
10-
isIncludeSimpleComponents,
11-
} from '../helper';
7+
import { dateItemType, defaultValueComponents, isIncludeSimpleComponents } from '../helper';
128
import { dateUtil } from '@/utils/dateUtil';
139
import { cloneDeep, has, uniqBy, get } from 'lodash-es';
1410
import { error } from '@/utils/log';
@@ -76,7 +72,7 @@ export function useFormEvents({
7672
const validKeys: string[] = [];
7773
fields.forEach((key) => {
7874
const schema = unref(getSchema).find((item) => item.field === key);
79-
let value = get(values, key);
75+
const value = get(values, key);
8076
const hasKey = has(values, key);
8177
const { componentProps } = schema || {};
8278
let _props = componentProps as any;

src/components/Table/src/BasicTable.vue

-4
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,9 @@
3232
<HeaderCell :column="column" />
3333
</slot>
3434
</template>
35-
<!-- 增加对antdv3.x兼容 -->
3635
<template #bodyCell="data">
3736
<slot name="bodyCell" v-bind="data || {}"></slot>
3837
</template>
39-
<!-- <template #[`header-${column.dataIndex}`] v-for="(column, index) in columns" :key="index">-->
40-
<!-- <HeaderCell :column="column" />-->
41-
<!-- </template>-->
4238
</Table>
4339
</div>
4440
</template>

src/components/Table/src/components/editable/EditableCell.vue

+1-3
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,9 @@
369369
if (!props.record.editValueRefs) props.record.editValueRefs = {};
370370
props.record.editValueRefs[props.column.dataIndex as any] = currentValueRef;
371371
}
372-
/* eslint-disable */
373372
props.record.onCancelEdit = () => {
374373
isArray(props.record?.cancelCbs) && props.record?.cancelCbs.forEach((fn) => fn());
375374
};
376-
/* eslint-disable */
377375
props.record.onSubmitEdit = async () => {
378376
if (isArray(props.record?.submitCbs)) {
379377
if (!props.record?.onValid?.()) return;
@@ -508,7 +506,7 @@
508506
}
509507
.@{prefix-cls} {
510508
position: relative;
511-
min-height: 24px; //设置高度让其始终可被hover
509+
min-height: 24px; // 设置高度让其始终可被hover
512510
513511
&__wrapper {
514512
display: flex;

src/components/Upload/src/components/ImageUpload.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@
193193
const list = (fileList.value || [])
194194
.filter((item) => item?.status === UploadResultStatus.DONE)
195195
.map((item: any) => {
196-
if(item?.response && props?.resultField){
197-
return item?.response
196+
if (item?.response && props?.resultField) {
197+
return item?.response;
198198
}
199199
return item?.url || item?.response?.url;
200200
});

src/components/Upload/src/components/UploadPreviewModal.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import { downloadByUrl } from '@/utils/file/download';
2020
import { createPreviewColumns, createPreviewActionColumn } from './data';
2121
import { useI18n } from '@/hooks/web/useI18n';
22-
import { isArray } from '@/utils/is';
22+
import { isArray, isFunction } from '@/utils/is';
2323
import { BasicColumn } from '@/components/Table';
24-
import { isFunction } from '@/utils/is';
2524
import { useMessage } from '@/hooks/web/useMessage';
25+
2626
const { createMessage } = useMessage();
2727
2828
const props = defineProps(previewProps);

src/components/Upload/src/props.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ type SortableOptions = Merge<
1515
}
1616
>;
1717
type previewColumnsFnType = {
18-
handleRemove:(record:Record<string,any>,key:string)=>any,
19-
handleAdd:(record:Record<string,any>,key:string)=>any,
20-
}
18+
handleRemove: (record: Record<string, any>, key: string) => any;
19+
handleAdd: (record: Record<string, any>, key: string) => any;
20+
};
2121
export const previewType = {
2222
previewColumns: {
23-
type: [Array,Function] as PropType<BasicColumn[] | ((arg:previewColumnsFnType) => BasicColumn[])>,
23+
type: [Array, Function] as PropType<
24+
BasicColumn[] | ((arg: previewColumnsFnType) => BasicColumn[])
25+
>,
2426
required: false,
2527
},
2628
beforePreviewData: {
+12-17
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,23 @@
11
<template>
2-
3-
<Alert message="基础示例" />
4-
<BasicUpload
5-
:maxSize="20"
6-
:maxNumber="10"
7-
@change="handleChange"
8-
:api="uploadApi"
9-
class="my-5"
10-
:accept="['image/*']"
11-
/>
12-
2+
<Alert message="基础示例" />
3+
<BasicUpload
4+
:maxSize="20"
5+
:maxNumber="10"
6+
@change="handleChange"
7+
:api="uploadApi"
8+
class="my-5"
9+
:accept="['image/*']"
10+
/>
1311
</template>
1412

1513
<script setup lang="ts">
14+
import { Alert } from 'ant-design-vue';
1615
import { BasicUpload } from '@/components/Upload';
17-
import { uploadApi } from '@/api/sys/upload';
1816
import { useMessage } from '@/hooks/web/useMessage';
17+
import { uploadApi } from '@/api/sys/upload';
18+
1919
const { createMessage } = useMessage();
20-
import { Alert } from 'ant-design-vue';
2120
function handleChange(list: string[]) {
2221
createMessage.success(`已上传文件${JSON.stringify(list)}`);
2322
}
2423
</script>
25-
26-
<style scoped>
27-
28-
</style>

src/views/demo/comp/upload/Upload2.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
</template>
55

66
<script setup lang="ts">
7-
import { uploadApi } from '@/api/sys/upload';
7+
import { Alert } from 'ant-design-vue';
8+
import { BasicForm, FormSchema, useForm } from '@/components/Form';
89
import { useMessage } from '@/hooks/web/useMessage';
10+
import { uploadApi } from '@/api/sys/upload';
11+
912
const { createMessage } = useMessage();
10-
import { BasicForm, FormSchema, useForm } from '@/components/Form';
11-
import { Alert } from 'ant-design-vue';
13+
1214
const schemasValiate: FormSchema[] = [
1315
{
1416
field: 'field1',
@@ -52,5 +54,3 @@
5254
},
5355
});
5456
</script>
55-
56-
<style scoped></style>

src/views/demo/comp/upload/Upload3.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<template>
22
<Alert message="嵌入表单,加入resultFiled自定义返回值" />
3-
<BasicForm @register="registerCustom" class="my-5" />
3+
<BasicForm @register="registerCustom" class="my-5" />
44
</template>
55

66
<script setup lang="ts">
7-
import { uploadApi } from '@/api/sys/upload';
7+
import { Alert } from 'ant-design-vue';
8+
import { BasicForm, FormSchema, useForm } from '@/components/Form';
89
import { useMessage } from '@/hooks/web/useMessage';
10+
import { uploadApi } from '@/api/sys/upload';
11+
912
const { createMessage } = useMessage();
10-
import { BasicForm, FormSchema, useForm } from '@/components/Form';
11-
import { Alert } from 'ant-design-vue';
13+
1214
const schemasCustom: FormSchema[] = [
1315
{
1416
field: 'field3',
@@ -69,5 +71,3 @@
6971
},
7072
});
7173
</script>
72-
73-
<style scoped></style>

src/views/demo/comp/upload/Upload4.vue

+11-13
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
</template>
55

66
<script setup lang="ts">
7-
import { uploadApi } from '@/api/sys/upload';
7+
import { createVNode } from 'vue';
8+
import { Alert, Button } from 'ant-design-vue';
9+
import { BasicForm, FormSchema, useForm } from '@/components/Form';
810
import { useMessage } from '@/hooks/web/useMessage';
11+
import { uploadApi } from '@/api/sys/upload';
12+
913
const { createMessage } = useMessage();
10-
import { BasicForm, FormSchema, useForm } from '@/components/Form';
11-
import { Alert, Button } from 'ant-design-vue';
12-
import { createVNode } from 'vue';
14+
1315
const schemasPreview: FormSchema[] = [
1416
{
1517
field: 'field5',
@@ -82,8 +84,8 @@
8284
component: 'Upload',
8385
label: '字段6',
8486
componentProps: {
85-
maxNumber:2,
86-
previewColumns: ({ handleRemove, handleAdd}) => {
87+
maxNumber: 2,
88+
previewColumns: ({ handleRemove, handleAdd }) => {
8789
return [
8890
{
8991
title: 'url6',
@@ -101,8 +103,8 @@
101103
createVNode(
102104
Button,
103105
{
104-
type:"primary",
105-
style:"margin:4px",
106+
type: 'primary',
107+
style: 'margin:4px',
106108
onclick: () => {
107109
handleAdd(
108110
{ url6: 'https://vebn.oss-cn-beijing.aliyuncs.com/vben/logo.png' },
@@ -115,7 +117,7 @@
115117
createVNode(
116118
Button,
117119
{
118-
danger:true,
120+
danger: true,
119121
onclick: () => {
120122
handleRemove({ url6: record.url6 }, 'url6');
121123
},
@@ -125,7 +127,6 @@
125127
]);
126128
},
127129
},
128-
129130
];
130131
},
131132
beforePreviewData: (arg) => {
@@ -158,7 +159,6 @@
158159
});
159160
},
160161
},
161-
162162
},
163163
];
164164
const [registerPreview, { getFieldsValue: getFieldsValuePreview }] = useForm({
@@ -176,5 +176,3 @@
176176
},
177177
});
178178
</script>
179-
180-
<style scoped></style>

src/views/demo/comp/upload/index.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<template>
22
<PageWrapper title="上传组件示例">
3-
<Upload1></Upload1>
4-
<Upload2></Upload2>
5-
<Upload3></Upload3>
6-
<Upload4></Upload4>
3+
<Upload1 />
4+
<Upload2 />
5+
<Upload3 />
6+
<Upload4 />
77
</PageWrapper>
88
</template>
99
<script lang="ts" setup>

src/views/demo/form/AppendForm.vue

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
},
4646
{
4747
field: '0',
48-
// component: 'Input',
4948
label: ' ',
5049
slot: 'add',
5150
},

src/views/demo/form/CustomerForm.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@
8080
},
8181
{
8282
field: 'field3',
83-
// component: 'Input',
8483
label: '自定义Slot',
8584
slot: 'f3',
8685
colProps: {
@@ -233,6 +232,7 @@
233232
createMessage.success('click search,values:' + JSON.stringify(values));
234233
}
235234
</script>
235+
236236
<style lang="less" scoped>
237237
:deep(.local_form) .local_typeValue {
238238
width: calc(100% - 120px);

src/views/demo/form/RuleForm.vue

+1-4
Original file line numberDiff line numberDiff line change
@@ -119,14 +119,11 @@
119119
rules: [
120120
{
121121
required: true,
122-
// @ts-ignore
123-
validator: async (rule, value) => {
122+
validator: async (_, value) => {
124123
if (!value) {
125-
/* eslint-disable-next-line */
126124
return Promise.reject('值不能为空');
127125
}
128126
if (value === '1') {
129-
/* eslint-disable-next-line */
130127
return Promise.reject('值不能为1');
131128
}
132129
return Promise.resolve();

src/views/demo/form/index.vue

-5
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@
160160
colProps: {
161161
span: 8,
162162
},
163-
// componentProps:{},
164163
// can func
165164
componentProps: ({ schema, formModel }) => {
166165
console.log('form:', schema);
@@ -460,7 +459,6 @@
460459
},
461460
{
462461
field: 'field31',
463-
// component: 'Input',
464462
label: '下拉本地搜索',
465463
helpMessage: ['ApiSelect组件', '远程数据源本地搜索', '只发起一次请求获取所有选项'],
466464
required: true,
@@ -475,7 +473,6 @@
475473
},
476474
{
477475
field: 'field32',
478-
// component: 'Input',
479476
label: '下拉远程搜索',
480477
helpMessage: ['ApiSelect组件', '将关键词发送到接口进行远程搜索'],
481478
required: true,
@@ -690,7 +687,6 @@
690687
},
691688
{
692689
field: 'selectA',
693-
// component: 'Select',
694690
label: '互斥SelectA',
695691
slot: 'selectA',
696692
defaultValue: [],
@@ -700,7 +696,6 @@
700696
},
701697
{
702698
field: 'selectB',
703-
// component: 'Select',
704699
label: '互斥SelectB',
705700
slot: 'selectB',
706701
defaultValue: [],

src/views/demo/table/AuthColumn.vue

-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@
135135
width: 250,
136136
title: 'Action',
137137
dataIndex: 'action',
138-
// slots: { customRender: 'action' },
139138
},
140139
showSelectionBar: true, // 显示多选状态栏
141140
});

0 commit comments

Comments
 (0)