@vue-ui-kit/ant 1.9.1 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -7,14 +7,11 @@
|
|
|
7
7
|
import { eachTree } from '@/utils/treeHelper';
|
|
8
8
|
import { getFormDefaults } from '@/utils/config';
|
|
9
9
|
import PFormCol from '@/components/PFormCol.vue';
|
|
10
|
-
import {
|
|
11
|
-
Form as AForm,
|
|
12
|
-
Row as ARow,
|
|
13
|
-
} from 'ant-design-vue';
|
|
10
|
+
import { Form as AForm, Row as ARow } from 'ant-design-vue';
|
|
14
11
|
|
|
15
12
|
const props = defineProps<PFormProps<F> & { data: F }>();
|
|
16
13
|
const emit = defineEmits(['apply', 'reset']);
|
|
17
|
-
|
|
14
|
+
|
|
18
15
|
// 应用默认值
|
|
19
16
|
const formDefaults = getFormDefaults();
|
|
20
17
|
const propsWithDefaults = computed(() => ({
|
|
@@ -22,7 +19,7 @@
|
|
|
22
19
|
labelCol: props.labelCol ?? formDefaults.labelCol ?? { span: 6 },
|
|
23
20
|
wrapperCol: props.wrapperCol ?? formDefaults.wrapperCol ?? { span: 16 },
|
|
24
21
|
}));
|
|
25
|
-
|
|
22
|
+
|
|
26
23
|
const { items, data: formData } = toRefs(props);
|
|
27
24
|
|
|
28
25
|
function handleSubmit() {
|
|
@@ -46,12 +43,10 @@
|
|
|
46
43
|
} else {
|
|
47
44
|
obj[item.field] = undefined;
|
|
48
45
|
}
|
|
49
|
-
}
|
|
50
|
-
else if (item.field && item.slots) {
|
|
46
|
+
} else if (item.field && item.slots) {
|
|
51
47
|
if (isGoodValue(item.slots.defaultValue)) {
|
|
52
|
-
obj[item.field] = item.slots.defaultValue
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
48
|
+
obj[item.field] = item.slots.defaultValue;
|
|
49
|
+
} else {
|
|
55
50
|
obj[item.field] = undefined;
|
|
56
51
|
}
|
|
57
52
|
}
|
|
@@ -89,7 +84,7 @@
|
|
|
89
84
|
<a-row :gutter="[6, 12]">
|
|
90
85
|
<p-form-col
|
|
91
86
|
v-for="(item, idx) in items"
|
|
92
|
-
:key="`_col_${idx}`"
|
|
87
|
+
:key="`_col_${item.field || idx}`"
|
|
93
88
|
:form-data="formData"
|
|
94
89
|
:item="item"
|
|
95
90
|
@reset="resetFormData"
|
|
@@ -11,7 +11,18 @@
|
|
|
11
11
|
toRefs,
|
|
12
12
|
onBeforeUnmount,
|
|
13
13
|
} from 'vue';
|
|
14
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
debounce,
|
|
16
|
+
get,
|
|
17
|
+
isArray,
|
|
18
|
+
isBoolean,
|
|
19
|
+
isFunction,
|
|
20
|
+
isObject,
|
|
21
|
+
isString,
|
|
22
|
+
merge,
|
|
23
|
+
omit,
|
|
24
|
+
toNumber,
|
|
25
|
+
} from 'xe-utils';
|
|
15
26
|
import { eachTree } from '@/utils/treeHelper';
|
|
16
27
|
import { message as $message } from 'ant-design-vue';
|
|
17
28
|
import RenderTitleSlots from '@/components/RenderTitleSlots';
|
|
@@ -34,7 +45,7 @@
|
|
|
34
45
|
import { DownOutlined } from '@ant-design/icons-vue';
|
|
35
46
|
|
|
36
47
|
const props = defineProps<PGridProps<D, F>>();
|
|
37
|
-
|
|
48
|
+
|
|
38
49
|
// 应用默认值
|
|
39
50
|
const gridDefaults = getGridDefaults();
|
|
40
51
|
const propsWithDefaults = computed(() => ({
|
|
@@ -45,7 +56,7 @@
|
|
|
45
56
|
lazyReset: props.lazyReset ?? gridDefaults.lazyReset ?? false,
|
|
46
57
|
fitHeight: props.fitHeight ?? gridDefaults.fitHeight ?? 170,
|
|
47
58
|
}));
|
|
48
|
-
|
|
59
|
+
|
|
49
60
|
const {
|
|
50
61
|
formConfig,
|
|
51
62
|
pageConfig,
|
|
@@ -61,12 +72,12 @@
|
|
|
61
72
|
toolbar: false,
|
|
62
73
|
form: false,
|
|
63
74
|
});
|
|
64
|
-
const setLoadings = (value: boolean|Record<string, boolean>) => {
|
|
65
|
-
if(isObject(value)) {
|
|
66
|
-
Object.keys(value).forEach(key => {
|
|
75
|
+
const setLoadings = (value: boolean | Record<string, boolean>) => {
|
|
76
|
+
if (isObject(value)) {
|
|
77
|
+
Object.keys(value).forEach((key) => {
|
|
67
78
|
loading[key] = value[key];
|
|
68
79
|
});
|
|
69
|
-
} else if(isBoolean(value)) {
|
|
80
|
+
} else if (isBoolean(value)) {
|
|
70
81
|
loading.form = value;
|
|
71
82
|
loading.table = value;
|
|
72
83
|
loading.toolbar = value;
|
|
@@ -126,7 +137,7 @@
|
|
|
126
137
|
const tableEl = ref();
|
|
127
138
|
const renderFormKey = ref(uuid_v4());
|
|
128
139
|
const renderTableKey = ref(uuid_v4());
|
|
129
|
-
|
|
140
|
+
|
|
130
141
|
const codeLoadings = reactive<Record<string, boolean>>(
|
|
131
142
|
[
|
|
132
143
|
...(props.toolbarConfig?.buttons?.map((m) => m.code) ?? []).filter((f) => f),
|
|
@@ -229,13 +240,11 @@
|
|
|
229
240
|
} else {
|
|
230
241
|
obj[item.field] = undefined;
|
|
231
242
|
}
|
|
232
|
-
}
|
|
233
|
-
else if (item.field && item.slots) {
|
|
243
|
+
} else if (item.field && item.slots) {
|
|
234
244
|
if (isGoodValue(item.slots.defaultValue)) {
|
|
235
|
-
obj[item.field] = item.slots.defaultValue
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
obj[item.field] = undefined
|
|
245
|
+
obj[item.field] = item.slots.defaultValue;
|
|
246
|
+
} else {
|
|
247
|
+
obj[item.field] = undefined;
|
|
239
248
|
}
|
|
240
249
|
}
|
|
241
250
|
});
|
|
@@ -278,8 +287,8 @@
|
|
|
278
287
|
};
|
|
279
288
|
const enoughSpacing = ref(true);
|
|
280
289
|
const reload = () => {
|
|
281
|
-
selectedCaches.value = []
|
|
282
|
-
selectedRowKeys.value = []
|
|
290
|
+
selectedCaches.value = [];
|
|
291
|
+
selectedRowKeys.value = [];
|
|
283
292
|
return resetQueryFormData();
|
|
284
293
|
};
|
|
285
294
|
const resetPage = () => {
|
|
@@ -417,10 +426,14 @@
|
|
|
417
426
|
const formHeight = formOriginHeight.includes('px')
|
|
418
427
|
? toNumber(formOriginHeight.replace('px', ''))
|
|
419
428
|
: 0;
|
|
420
|
-
const showCountHeight = selectConfig.value?.showCount ? 22 : 0
|
|
429
|
+
const showCountHeight = selectConfig.value?.showCount ? 22 : 0;
|
|
421
430
|
renderHeight.value =
|
|
422
431
|
props.renderY ??
|
|
423
|
-
toNumber(ph.replace('px', '')) -
|
|
432
|
+
toNumber(ph.replace('px', '')) -
|
|
433
|
+
propsWithDefaults.value.fitHeight -
|
|
434
|
+
(props.toolbarConfig ? 30 : 0) -
|
|
435
|
+
formHeight -
|
|
436
|
+
showCountHeight;
|
|
424
437
|
enoughSpacing.value = toNumber(ph.replace('px', '')) > 600;
|
|
425
438
|
};
|
|
426
439
|
defineExpose({
|
|
@@ -462,13 +475,17 @@
|
|
|
462
475
|
}
|
|
463
476
|
resetQueryFormData(props.manualFetch);
|
|
464
477
|
});
|
|
465
|
-
const passFields = ['align']
|
|
466
|
-
const passDefaultColumnProps = (columns: ColumnProps<D>[]) =>
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
478
|
+
const passFields = ['align'];
|
|
479
|
+
const passDefaultColumnProps = (columns: ColumnProps<D>[]) =>
|
|
480
|
+
columns.map((c) => ({
|
|
481
|
+
...passFields.reduce(
|
|
482
|
+
(prev, cur) => ({
|
|
483
|
+
[cur]: propsWithDefaults.value[cur],
|
|
484
|
+
}),
|
|
485
|
+
{} as ColumnProps<D>,
|
|
486
|
+
),
|
|
487
|
+
...c,
|
|
488
|
+
}));
|
|
472
489
|
onBeforeUnmount(() => {
|
|
473
490
|
window.removeEventListener('resize', resizeTable);
|
|
474
491
|
observer.disconnect();
|
|
@@ -494,7 +511,7 @@
|
|
|
494
511
|
<a-row :gutter="[6, 12]">
|
|
495
512
|
<p-form-col
|
|
496
513
|
v-for="(item, idx) in formConfig!.items"
|
|
497
|
-
:key="`_col_${idx}`"
|
|
514
|
+
:key="`_col_${item.field || idx}`"
|
|
498
515
|
:form-data="queryFormData"
|
|
499
516
|
:item="item as PFormItemProps<Partial<F>>"
|
|
500
517
|
@reset="resetQueryFormData(propsWithDefaults.lazyReset)"
|
|
@@ -561,7 +578,10 @@
|
|
|
561
578
|
</span>
|
|
562
579
|
</div>
|
|
563
580
|
<div :class="`p-pane flex-1 ${enoughSpacing ? 'h-0' : ''} p-${scrollMode ?? 'inner'}-scroll`">
|
|
564
|
-
<div
|
|
581
|
+
<div
|
|
582
|
+
v-if="selectConfig?.multiple && selectConfig.showCount"
|
|
583
|
+
class="w-full text-slate-5 pl-4"
|
|
584
|
+
>
|
|
565
585
|
已选:{{ selectedRowKeys.length }}
|
|
566
586
|
</div>
|
|
567
587
|
<a-table
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defineComponent } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import { CellRender, RenderTableParams } from '#/antProxy';
|
|
3
3
|
import renderStore from '@/store/renderStore';
|
|
4
4
|
|
|
5
5
|
export default defineComponent(
|
|
6
6
|
<D = Recordable,>(props: {
|
|
7
|
-
cellRender:
|
|
7
|
+
cellRender: CellRender;
|
|
8
8
|
renderTableParams: RenderTableParams<D>;
|
|
9
9
|
defaultHandler?: {
|
|
10
10
|
[key: string]: (...args: any[]) => any;
|
|
@@ -173,7 +173,9 @@ const renderBasic = (name: string) => {
|
|
|
173
173
|
};
|
|
174
174
|
|
|
175
175
|
const renderBtn = (btnOpt: BtnOptions, params: RenderTableParams) =>
|
|
176
|
-
btnOpt.dropdowns &&
|
|
176
|
+
btnOpt.dropdowns &&
|
|
177
|
+
btnOpt.dropdowns.length > 0 &&
|
|
178
|
+
btnOpt.dropdowns.filter((f) => !f.hiddenIf?.(params)).length > 0 ? (
|
|
177
179
|
<Dropdown>
|
|
178
180
|
{{
|
|
179
181
|
default: () => (
|
|
@@ -186,14 +188,16 @@ const renderBtn = (btnOpt: BtnOptions, params: RenderTableParams) =>
|
|
|
186
188
|
'clickEvt',
|
|
187
189
|
'dropdowns',
|
|
188
190
|
])}
|
|
189
|
-
icon={btnOpt.icon ? <Icon icon={btnOpt.icon} /> :
|
|
191
|
+
icon={btnOpt.icon ? <Icon icon={btnOpt.icon} /> : <Icon icon="DownOutlined" />}
|
|
190
192
|
>
|
|
191
193
|
{btnOpt.content || (btnOpt?.getContent?.(params) ?? '')}
|
|
192
194
|
</Button>
|
|
193
195
|
),
|
|
194
196
|
overlay: () => (
|
|
195
197
|
<div class={`dropdown-wrapper ${btnOpt?.dynamicClassName?.(params) ?? ''}`}>
|
|
196
|
-
{btnOpt
|
|
198
|
+
{btnOpt
|
|
199
|
+
.dropdowns!.filter((f) => !f.hiddenIf?.(params))
|
|
200
|
+
.map((b) => renderBtn(b, params))}
|
|
197
201
|
</div>
|
|
198
202
|
),
|
|
199
203
|
}}
|
|
@@ -209,6 +213,7 @@ const renderBtn = (btnOpt: BtnOptions, params: RenderTableParams) =>
|
|
|
209
213
|
'clickEvt',
|
|
210
214
|
'dropdowns',
|
|
211
215
|
])}
|
|
216
|
+
disabled={(!!btnOpt.dropdowns && btnOpt.dropdowns.length > 0) || btnOpt.disabled}
|
|
212
217
|
icon={btnOpt.icon ? <Icon icon={btnOpt.icon} /> : null}
|
|
213
218
|
onClick={() => {
|
|
214
219
|
if (btnOpt?.clickEvt) {
|