@vue-ui-kit/ant 1.9.3 → 1.9.4
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/dist/cjs/index.js +1 -1
- package/dist/declarations/antProxy.d.ts +3 -0
- package/dist/es/index.js +294 -304
- package/dist/packages/components/PromisePicker.vue.d.ts +4 -37
- package/package.json +1 -1
- package/src/declarations/antProxy.ts +3 -0
- package/src/packages/components/PromisePicker.vue +18 -28
|
@@ -1,44 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PGridInstance, PGridProps } from '../../declarations/antProxy';
|
|
1
|
+
import { PGridInstance, PromisePickerProps } from '../../declarations/antProxy';
|
|
3
2
|
declare const _default: <D = Recordable<any>, F = Recordable<any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_Prettify<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
4
|
-
props: __VLS_Prettify<Pick<Partial<{
|
|
5
|
-
title: string;
|
|
6
|
-
width: string | number;
|
|
7
|
-
bodyStyle: Record<string, any>;
|
|
8
|
-
multipleAllowEmpty: boolean;
|
|
9
|
-
}> & Omit<{
|
|
10
|
-
readonly title: string;
|
|
11
|
-
readonly width: string | number;
|
|
12
|
-
readonly bodyStyle: Record<string, any>;
|
|
13
|
-
readonly gridSetting: PGridProps<D, F>;
|
|
14
|
-
readonly multipleAllowEmpty: boolean;
|
|
15
|
-
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('vue').ExtractPropTypes<{
|
|
16
|
-
gridSetting: {
|
|
17
|
-
type: PropType<PGridProps<D, F>>;
|
|
18
|
-
required: true;
|
|
19
|
-
};
|
|
20
|
-
title: {
|
|
21
|
-
type: PropType<string>;
|
|
22
|
-
default: string;
|
|
23
|
-
};
|
|
24
|
-
width: {
|
|
25
|
-
type: PropType<string | number>;
|
|
26
|
-
default: string;
|
|
27
|
-
};
|
|
28
|
-
multipleAllowEmpty: {
|
|
29
|
-
type: BooleanConstructor;
|
|
30
|
-
default: boolean;
|
|
31
|
-
};
|
|
32
|
-
bodyStyle: {
|
|
33
|
-
type: ObjectConstructor;
|
|
34
|
-
default: () => {};
|
|
35
|
-
};
|
|
36
|
-
}>> & Readonly<{}>, "title" | "width" | "bodyStyle" | "multipleAllowEmpty">, "gridSetting" | ("title" | "width" | "bodyStyle" | "multipleAllowEmpty")> & {}> & import('vue').PublicProps;
|
|
3
|
+
props: __VLS_Prettify<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<{}> & Readonly<{}>, never>, never> & PromisePickerProps<D, F>> & import('vue').PublicProps;
|
|
37
4
|
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
38
|
-
pick: () => Promise<{
|
|
5
|
+
pick: () => Promise<D[] | {
|
|
39
6
|
row: D;
|
|
40
7
|
field?: string;
|
|
41
|
-
}
|
|
8
|
+
}>;
|
|
42
9
|
pickMultiple: () => Promise<D[] | {
|
|
43
10
|
row: D;
|
|
44
11
|
field?: string;
|
package/package.json
CHANGED
|
@@ -86,6 +86,9 @@ export interface PromisePickerProps<D = Recordable, F = Recordable> {
|
|
|
86
86
|
gridSetting: PGridProps<D, F>;
|
|
87
87
|
title?: string;
|
|
88
88
|
width?: string | number;
|
|
89
|
+
multipleAllowEmpty?: boolean;
|
|
90
|
+
bodyStyle?: Recordable;
|
|
91
|
+
beforePick?: (rowOrRows: D | Array<D>) => Promise<void>;
|
|
89
92
|
}
|
|
90
93
|
|
|
91
94
|
export type GroupMenuItemHandler<F = Recordable> = ({
|
|
@@ -1,32 +1,18 @@
|
|
|
1
1
|
<script lang="ts" setup name="PromisePicker" generic="D = Recordable, F = Recordable">
|
|
2
|
-
import {
|
|
3
|
-
import { PGridInstance,
|
|
2
|
+
import { reactive, ref, computed } from 'vue';
|
|
3
|
+
import { PGridInstance, PromisePickerProps } from '#/antProxy';
|
|
4
4
|
import PGrid from '@/components/PGrid.vue';
|
|
5
5
|
import { $warning } from '@/hooks/useMessage';
|
|
6
6
|
import { Button as AButton, Modal as AModal } from 'ant-design-vue';
|
|
7
7
|
|
|
8
8
|
const gridEl = ref<PGridInstance<D>>();
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
default: '数据选择',
|
|
17
|
-
},
|
|
18
|
-
width: {
|
|
19
|
-
type: [String, Number] as PropType<string | number>,
|
|
20
|
-
default: '70%',
|
|
21
|
-
},
|
|
22
|
-
multipleAllowEmpty: {
|
|
23
|
-
type: Boolean,
|
|
24
|
-
default: false,
|
|
25
|
-
},
|
|
26
|
-
bodyStyle: {
|
|
27
|
-
type: Object,
|
|
28
|
-
default: () => ({}),
|
|
29
|
-
},
|
|
9
|
+
|
|
10
|
+
const props = withDefaults(defineProps<PromisePickerProps<D, F>>(), {
|
|
11
|
+
title: '数据选择',
|
|
12
|
+
width: '70%',
|
|
13
|
+
multipleAllowEmpty: false,
|
|
14
|
+
bodyStyle: () => ({}),
|
|
15
|
+
beforePick: () => Promise.resolve(),
|
|
30
16
|
});
|
|
31
17
|
const isMultiple = computed(() => props.gridSetting.selectConfig?.multiple);
|
|
32
18
|
let resolvePromise: (
|
|
@@ -52,8 +38,10 @@
|
|
|
52
38
|
const selectRow = ({ row, field }: { row: D; field?: string }) => {
|
|
53
39
|
// 单选才关闭结束选择
|
|
54
40
|
if (resolvePromise && !isMultiple.value) {
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
props.beforePick(row).then(() => {
|
|
42
|
+
visible.modal = false;
|
|
43
|
+
resolvePromise({ row, field });
|
|
44
|
+
});
|
|
57
45
|
}
|
|
58
46
|
};
|
|
59
47
|
const endMultiplePicker = () => {
|
|
@@ -61,8 +49,10 @@
|
|
|
61
49
|
if (records.length === 0 && !props.multipleAllowEmpty) {
|
|
62
50
|
$warning('请选择数据');
|
|
63
51
|
} else {
|
|
64
|
-
|
|
65
|
-
|
|
52
|
+
props.beforePick(records).then(() => {
|
|
53
|
+
visible.modal = false;
|
|
54
|
+
multipleResolver(records);
|
|
55
|
+
});
|
|
66
56
|
}
|
|
67
57
|
};
|
|
68
58
|
defineExpose({
|
|
@@ -81,7 +71,7 @@
|
|
|
81
71
|
grid: gridEl,
|
|
82
72
|
hide: () => {
|
|
83
73
|
visible.modal = false;
|
|
84
|
-
}
|
|
74
|
+
},
|
|
85
75
|
});
|
|
86
76
|
</script>
|
|
87
77
|
<template>
|