@vue-ui-kit/ant 1.8.6 → 1.9.0
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/README.md +480 -503
- package/dist/cjs/index.js +1 -1
- package/dist/declarations/antProxy.d.ts +3 -4
- package/dist/es/index.js +147 -147
- package/dist/index.d.ts +1 -1
- package/dist/packages/components/PFormGroup.vue.d.ts +1 -1
- package/dist/packages/components/PGroupBlock.vue.d.ts +3 -1
- package/dist/packages/store/renderStore.d.ts +4 -4
- package/package.json +1 -1
- package/src/declarations/antProxy.ts +15 -10
- package/src/index.ts +2 -17
- package/src/packages/components/PFormGroup.vue +2 -2
- package/src/packages/components/PGroupBlock.vue +8 -3
- package/src/packages/store/renderStore.tsx +126 -119
- package/src/packages/utils/treeHelper.ts +62 -72
package/dist/index.d.ts
CHANGED
|
@@ -21,4 +21,4 @@ export default _default;
|
|
|
21
21
|
export * from './declarations/antProxy';
|
|
22
22
|
export * from './packages/utils/core';
|
|
23
23
|
export { setup, setUIKitConfig, getUIKitConfig, resetUIKitConfig, type UIKitConfig };
|
|
24
|
-
export { PForm, PGrid, PFormGroup, PGroupBlock, PromisePicker, addFormatter, addRender
|
|
24
|
+
export { PForm, PGrid, PFormGroup, PGroupBlock, PromisePicker, addFormatter, addRender };
|
|
@@ -11,7 +11,7 @@ declare const _default: <F = Recordable<any>>(__VLS_props: NonNullable<Awaited<t
|
|
|
11
11
|
activeKey: import('vue').ComputedRef<number>;
|
|
12
12
|
setActiveKey: (key: number) => void;
|
|
13
13
|
validateAll: () => Promise<PromiseSettledResult<any>[]>;
|
|
14
|
-
validate: (__index: number) => Promise<void>;
|
|
14
|
+
validate: (__index: number, ignoreTabError?: boolean) => Promise<void>;
|
|
15
15
|
}>): void;
|
|
16
16
|
attrs: any;
|
|
17
17
|
slots: ReturnType<() => {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { PBlockProps } from '../../declarations/antProxy';
|
|
2
2
|
declare const _default: <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<{
|
|
3
3
|
props: __VLS_Prettify<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<{}> & Readonly<{}>, never>, never> & PBlockProps<F>> & import('vue').PublicProps;
|
|
4
|
-
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
4
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
5
|
+
$form: import('vue').ComputedRef<Recordable<any> | undefined>;
|
|
6
|
+
}>): void;
|
|
5
7
|
attrs: any;
|
|
6
8
|
slots: ReturnType<() => {}>;
|
|
7
9
|
emit: {};
|
|
@@ -6,18 +6,18 @@ export declare const addRender: (name: string, { renderItemContent, renderDefaul
|
|
|
6
6
|
declare const _default: {
|
|
7
7
|
renders: {
|
|
8
8
|
$button: {
|
|
9
|
-
renderItemContent({ props, events }: RenderOptions, { data, field
|
|
9
|
+
renderItemContent({ props, events }: RenderOptions, { data, field }: RenderFormParams, defaultHandler: {
|
|
10
10
|
[key: string]: (...args: any[]) => any;
|
|
11
11
|
}): import("vue/jsx-runtime").JSX.Element;
|
|
12
|
-
renderDefault({ props, events }: RenderOptions, { row, field
|
|
12
|
+
renderDefault({ props, events }: RenderOptions, { row, field }: RenderTableParams, defaultHandler: {
|
|
13
13
|
[key: string]: (...args: any[]) => any;
|
|
14
14
|
}): import("vue/jsx-runtime").JSX.Element;
|
|
15
15
|
};
|
|
16
16
|
$buttons: {
|
|
17
|
-
renderItemContent({ props, children }: RenderOptions, { data, field
|
|
17
|
+
renderItemContent({ props, children }: RenderOptions, { data, field }: RenderFormParams, defaultHandler: {
|
|
18
18
|
[key: string]: (...args: any[]) => any;
|
|
19
19
|
}): import("vue/jsx-runtime").JSX.Element;
|
|
20
|
-
renderDefault({ props, children }: RenderOptions, { data, row, field
|
|
20
|
+
renderDefault({ props, children }: RenderOptions, { data, row, field }: RenderTableParams, defaultHandler: {
|
|
21
21
|
[key: string]: (...args: any[]) => any;
|
|
22
22
|
}): import("vue/jsx-runtime").JSX.Element;
|
|
23
23
|
};
|
package/package.json
CHANGED
|
@@ -4,7 +4,6 @@ import { ColProps } from 'ant-design-vue/lib/grid/Col';
|
|
|
4
4
|
import { FormProps } from 'ant-design-vue/lib/form/Form';
|
|
5
5
|
import { TableColumnType, TableProps, TooltipProps } from 'ant-design-vue';
|
|
6
6
|
import { ButtonType } from 'ant-design-vue/lib/button/buttonTypes';
|
|
7
|
-
import { ComputedRef } from 'vue';
|
|
8
7
|
|
|
9
8
|
export interface CellFuncArg<D = Recordable> {
|
|
10
9
|
row: D;
|
|
@@ -54,8 +53,8 @@ export interface PFormItemProps<F = Recordable> {
|
|
|
54
53
|
title?: string;
|
|
55
54
|
span?: number;
|
|
56
55
|
colon?: boolean;
|
|
57
|
-
labelCol?: ColProps
|
|
58
|
-
wrapperCol?: ColProps
|
|
56
|
+
labelCol?: ColProps;
|
|
57
|
+
wrapperCol?: ColProps;
|
|
59
58
|
forceRequired?: boolean; // 在页面需要必填标示,但field不需要必填校验时使用
|
|
60
59
|
align?: 'left' | 'right' | 'center';
|
|
61
60
|
col?: ColProps;
|
|
@@ -67,9 +66,9 @@ export interface PFormItemProps<F = Recordable> {
|
|
|
67
66
|
default?: (
|
|
68
67
|
{ data, field }: ItemFuncArg<F>,
|
|
69
68
|
passTrigger?: (cusFields?: string | string[]) => void,
|
|
70
|
-
passDelayTrigger?: (cusFields?: string | string[], time?: number) => void
|
|
69
|
+
passDelayTrigger?: (cusFields?: string | string[], time?: number) => void,
|
|
71
70
|
) => any;
|
|
72
|
-
defaultValue?: any
|
|
71
|
+
defaultValue?: any;
|
|
73
72
|
};
|
|
74
73
|
}
|
|
75
74
|
|
|
@@ -151,7 +150,13 @@ export interface ToolbarButtonProps extends PButtonProps {
|
|
|
151
150
|
|
|
152
151
|
export interface ToolbarConfig {
|
|
153
152
|
buttons?: Array<ToolbarButtonProps>;
|
|
154
|
-
tools?: Array<{
|
|
153
|
+
tools?: Array<{
|
|
154
|
+
code: string;
|
|
155
|
+
icon: string;
|
|
156
|
+
type?: ButtonType;
|
|
157
|
+
disabled?: boolean;
|
|
158
|
+
size?: 'small' | 'large' | 'middle';
|
|
159
|
+
}>;
|
|
155
160
|
disabled?: boolean;
|
|
156
161
|
}
|
|
157
162
|
|
|
@@ -167,11 +172,11 @@ export interface ResponsePathConfig<D = Recordable> {
|
|
|
167
172
|
| ((res: Recordable) => string | { status: string; content: string; icon?: string });
|
|
168
173
|
}
|
|
169
174
|
|
|
170
|
-
|
|
175
|
+
export type HandlerMultiDel = (ids: Array<string | number>) => any;
|
|
171
176
|
|
|
172
177
|
export interface AjaxConfig<F = Recordable> {
|
|
173
178
|
query: (Q: { page?: IPage; form: Partial<F> }) => Promise<Recordable>;
|
|
174
|
-
multiDelete?:
|
|
179
|
+
multiDelete?: HandlerMultiDel;
|
|
175
180
|
}
|
|
176
181
|
|
|
177
182
|
export interface ProxyConfig<D = Recordable, F = Recordable> {
|
|
@@ -195,7 +200,7 @@ export type PGridProps<D = Recordable, F = Recordable> = {
|
|
|
195
200
|
selectConfig?: SelectConfig<D>;
|
|
196
201
|
rowKey?: string;
|
|
197
202
|
manualFetch?: boolean;
|
|
198
|
-
align?: 'left' | 'right' | 'center'
|
|
203
|
+
align?: 'left' | 'right' | 'center';
|
|
199
204
|
formConfig?: PFormProps<F>;
|
|
200
205
|
columns?: ColumnProps<D>[];
|
|
201
206
|
toolbarConfig?: ToolbarConfig;
|
|
@@ -303,7 +308,7 @@ export interface PFormBlockInstance {
|
|
|
303
308
|
$form: Recordable;
|
|
304
309
|
}
|
|
305
310
|
|
|
306
|
-
export interface PFormGroupInstance
|
|
311
|
+
export interface PFormGroupInstance {
|
|
307
312
|
activeKey: number;
|
|
308
313
|
setActiveKey: (activeKey: number) => void;
|
|
309
314
|
validateAll: () => Promise<void>;
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,6 @@ import PromisePicker from '@/components/PromisePicker.vue';
|
|
|
7
7
|
import { addFormatter } from '@/utils/AFormatters';
|
|
8
8
|
import { addRender } from '@/store/renderStore';
|
|
9
9
|
import { setUIKitConfig, getUIKitConfig, resetUIKitConfig, UIKitConfig } from '@/utils/config';
|
|
10
|
-
import * as utils from '@/utils/core';
|
|
11
10
|
|
|
12
11
|
// 创建setup方法
|
|
13
12
|
function setup(config?: Partial<UIKitConfig>) {
|
|
@@ -35,21 +34,7 @@ export * from '#/antProxy';
|
|
|
35
34
|
export * from '@/utils/core';
|
|
36
35
|
|
|
37
36
|
// 导出配置方法
|
|
38
|
-
export {
|
|
39
|
-
setup,
|
|
40
|
-
setUIKitConfig,
|
|
41
|
-
getUIKitConfig,
|
|
42
|
-
resetUIKitConfig,
|
|
43
|
-
type UIKitConfig
|
|
44
|
-
};
|
|
37
|
+
export { setup, setUIKitConfig, getUIKitConfig, resetUIKitConfig, type UIKitConfig };
|
|
45
38
|
|
|
46
39
|
// 直接导出组件,使用户可以直接导入使用
|
|
47
|
-
export {
|
|
48
|
-
PForm,
|
|
49
|
-
PGrid,
|
|
50
|
-
PFormGroup,
|
|
51
|
-
PGroupBlock,
|
|
52
|
-
PromisePicker,
|
|
53
|
-
addFormatter,
|
|
54
|
-
addRender,
|
|
55
|
-
};
|
|
40
|
+
export { PForm, PGrid, PFormGroup, PGroupBlock, PromisePicker, addFormatter, addRender };
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
return Promise.resolve(results)
|
|
162
162
|
})
|
|
163
163
|
},
|
|
164
|
-
validate: async (__index: number) => {
|
|
164
|
+
validate: async (__index: number, ignoreTabError?: boolean) => {
|
|
165
165
|
const index = model.value.findIndex(f => f.__index === __index)
|
|
166
166
|
try {
|
|
167
167
|
await (fr.value
|
|
@@ -173,7 +173,7 @@
|
|
|
173
173
|
}
|
|
174
174
|
catch (e) {
|
|
175
175
|
// 校验失败,加入error_indexes
|
|
176
|
-
if (!error_indexes.value.includes(__index)) {
|
|
176
|
+
if (!error_indexes.value.includes(__index) && !ignoreTabError) {
|
|
177
177
|
error_indexes.value = [...error_indexes.value, __index]
|
|
178
178
|
}
|
|
179
179
|
return Promise.reject(e)
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
<script lang="ts" setup name="PGroupBlock" generic="F = Recordable">
|
|
2
|
-
import { PBlockProps, PFormProps } from '#/antProxy';
|
|
3
|
-
import { computed, toRefs } from 'vue';
|
|
2
|
+
import { PBlockProps, PFormInstance, PFormProps } from '#/antProxy';
|
|
3
|
+
import { computed, ref, toRefs } from 'vue';
|
|
4
4
|
import PForm from '@/components/PForm.vue';
|
|
5
5
|
|
|
6
6
|
const props = defineProps<PBlockProps<F>>();
|
|
7
|
+
const formEl = ref<PFormInstance>()
|
|
7
8
|
const { source } = toRefs(props);
|
|
9
|
+
const $form = computed(() => formEl.value?.$form)
|
|
8
10
|
const formSetting = computed<PFormProps<Partial<F>>>(() => props.getFormSetting(source.value));
|
|
11
|
+
defineExpose({
|
|
12
|
+
$form,
|
|
13
|
+
})
|
|
9
14
|
</script>
|
|
10
15
|
<template>
|
|
11
|
-
<p-form v-bind="formSetting" :data="source!" />
|
|
16
|
+
<p-form ref="formEl" v-bind="formSetting" :data="source!" />
|
|
12
17
|
</template>
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from 'ant-design-vue';
|
|
24
24
|
import { set, isFunction, merge, omit } from 'xe-utils';
|
|
25
25
|
import { ButtonProps } from 'ant-design-vue/lib/button';
|
|
26
|
-
import { isBadValue, isGoodValue,
|
|
26
|
+
import { isBadValue, isGoodValue, valued } from '@/utils/is';
|
|
27
27
|
import TableInput from '@/renders/TableInput.vue';
|
|
28
28
|
import Icon from '@/renders/Icon';
|
|
29
29
|
import { computed } from 'vue';
|
|
@@ -223,184 +223,191 @@ const renders = {
|
|
|
223
223
|
...Object.fromEntries(Object.keys(componentsMap).map((name) => [name, renderBasic(name)])),
|
|
224
224
|
// 简单按钮
|
|
225
225
|
$button: {
|
|
226
|
-
renderItemContent(
|
|
227
|
-
|
|
228
|
-
field,
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
226
|
+
renderItemContent(
|
|
227
|
+
{ props = {}, events = {} }: RenderOptions,
|
|
228
|
+
{ data, field }: RenderFormParams,
|
|
229
|
+
defaultHandler: {
|
|
230
|
+
[key: string]: (...args: any[]) => any;
|
|
231
|
+
},
|
|
232
|
+
) {
|
|
232
233
|
return (
|
|
233
234
|
<Button
|
|
234
235
|
{...omit(props, ['content'])}
|
|
235
236
|
icon={props.icon ? <Icon icon={props.icon} /> : null}
|
|
236
237
|
onClick={() => {
|
|
237
|
-
events.click?.({ data, field })
|
|
238
|
+
events.click?.({ data, field });
|
|
238
239
|
if (props.htmlType === 'reset' && defaultHandler?.reset) {
|
|
239
240
|
if (props.beforeClick && isFunction(props.beforeClick)) {
|
|
240
241
|
props.beforeClick({ data, field }).then((res: void | Recordable) => {
|
|
241
|
-
defaultHandler.reset(res ? { data: res, field } : { data, field })
|
|
242
|
-
})
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
defaultHandler.reset({ data, field })
|
|
242
|
+
defaultHandler.reset(res ? { data: res, field } : { data, field });
|
|
243
|
+
});
|
|
244
|
+
} else {
|
|
245
|
+
defaultHandler.reset({ data, field });
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
}}
|
|
249
249
|
>
|
|
250
250
|
{props.content}
|
|
251
|
-
{
|
|
252
|
-
props.suffix?.({ data, field }) ?? null
|
|
253
|
-
}
|
|
251
|
+
{props.suffix?.({ data, field }) ?? null}
|
|
254
252
|
</Button>
|
|
255
|
-
)
|
|
253
|
+
);
|
|
256
254
|
},
|
|
257
|
-
renderDefault(
|
|
258
|
-
|
|
259
|
-
field,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
255
|
+
renderDefault(
|
|
256
|
+
{ props = {}, events = {} }: RenderOptions,
|
|
257
|
+
{ row, field }: RenderTableParams,
|
|
258
|
+
defaultHandler: {
|
|
259
|
+
[key: string]: (...args: any[]) => any;
|
|
260
|
+
},
|
|
261
|
+
) {
|
|
263
262
|
return (
|
|
264
263
|
<Button
|
|
265
264
|
{...omit(props, ['content'])}
|
|
266
265
|
icon={props.icon ? <Icon icon={props.icon} /> : null}
|
|
267
266
|
onClick={() => {
|
|
268
|
-
events.click?.({ row, field })
|
|
267
|
+
events.click?.({ row, field });
|
|
269
268
|
if (props.htmlType === 'reset' && defaultHandler?.reset) {
|
|
270
269
|
if (props.beforeClick && isFunction(props.beforeClick)) {
|
|
271
|
-
defaultHandler?.setLoadings?.(true)
|
|
272
|
-
props
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
270
|
+
defaultHandler?.setLoadings?.(true);
|
|
271
|
+
props
|
|
272
|
+
.beforeClick({ row, field })
|
|
273
|
+
.then((res: void | Recordable) => {
|
|
274
|
+
defaultHandler.reset(res ? { row: res, field } : { row, field });
|
|
275
|
+
})
|
|
276
|
+
.finally(() => {
|
|
277
|
+
defaultHandler?.setLoadings?.(false);
|
|
278
|
+
});
|
|
279
|
+
} else {
|
|
280
|
+
defaultHandler.reset({ row, field });
|
|
280
281
|
}
|
|
281
282
|
}
|
|
282
283
|
if (props.htmlType === 'pick' && defaultHandler?.pick) {
|
|
283
284
|
if (props.beforeClick && isFunction(props.beforeClick)) {
|
|
284
|
-
defaultHandler?.setLoadings?.(true)
|
|
285
|
-
props
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
285
|
+
defaultHandler?.setLoadings?.(true);
|
|
286
|
+
props
|
|
287
|
+
.beforeClick({ row, field })
|
|
288
|
+
.then((res: void | Recordable) => {
|
|
289
|
+
defaultHandler.pick(res ? { row: res, field } : { row, field });
|
|
290
|
+
})
|
|
291
|
+
.finally(() => {
|
|
292
|
+
defaultHandler?.setLoadings?.(false);
|
|
293
|
+
});
|
|
294
|
+
} else {
|
|
295
|
+
defaultHandler.pick({ row, field });
|
|
293
296
|
}
|
|
294
297
|
}
|
|
295
298
|
}}
|
|
296
299
|
>
|
|
297
300
|
{props.content}
|
|
298
301
|
</Button>
|
|
299
|
-
)
|
|
302
|
+
);
|
|
300
303
|
},
|
|
301
304
|
},
|
|
302
305
|
// 简单按钮组
|
|
303
306
|
$buttons: {
|
|
304
|
-
renderItemContent(
|
|
305
|
-
|
|
306
|
-
field,
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
307
|
+
renderItemContent(
|
|
308
|
+
{ props = {}, children = [] }: RenderOptions,
|
|
309
|
+
{ data, field }: RenderFormParams,
|
|
310
|
+
defaultHandler: {
|
|
311
|
+
[key: string]: (...args: any[]) => any;
|
|
312
|
+
},
|
|
313
|
+
) {
|
|
310
314
|
return (
|
|
311
315
|
<span class="align-gap-box w-fit">
|
|
312
|
-
{
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
if (
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
else {
|
|
327
|
-
defaultHandler.reset({ data, field })
|
|
328
|
-
}
|
|
316
|
+
{children.map((m) => {
|
|
317
|
+
return (
|
|
318
|
+
<Button
|
|
319
|
+
{...omit(Object.assign({}, props, m.props), ['content'])}
|
|
320
|
+
icon={m.props.icon ? <Icon icon={m.props.icon} /> : null}
|
|
321
|
+
onClick={() => {
|
|
322
|
+
m.events?.click?.({ data, field });
|
|
323
|
+
if (m.props.htmlType === 'reset' && defaultHandler?.reset) {
|
|
324
|
+
if (props.beforeClick && isFunction(props.beforeClick)) {
|
|
325
|
+
props.beforeClick({ data, field }).then((res: void | Recordable) => {
|
|
326
|
+
defaultHandler.reset(res ? { data: res, field } : { data, field });
|
|
327
|
+
});
|
|
328
|
+
} else {
|
|
329
|
+
defaultHandler.reset({ data, field });
|
|
329
330
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
})
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
331
|
+
}
|
|
332
|
+
if (m.props.htmlType === 'pick' && defaultHandler?.pick) {
|
|
333
|
+
if (props.beforeClick && isFunction(props.beforeClick)) {
|
|
334
|
+
props.beforeClick({ data, field }).then((res: void | Recordable) => {
|
|
335
|
+
defaultHandler.pick(res ? { data: res, field } : { data, field });
|
|
336
|
+
});
|
|
337
|
+
} else {
|
|
338
|
+
defaultHandler.pick({ data, field });
|
|
339
339
|
}
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
}
|
|
340
|
+
}
|
|
341
|
+
}}
|
|
342
|
+
>
|
|
343
|
+
{m.props.content}
|
|
344
|
+
</Button>
|
|
345
|
+
);
|
|
346
|
+
})}
|
|
347
347
|
</span>
|
|
348
|
-
)
|
|
348
|
+
);
|
|
349
349
|
},
|
|
350
|
-
renderDefault(
|
|
351
|
-
|
|
352
|
-
row,
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
350
|
+
renderDefault(
|
|
351
|
+
{ props = {}, children = [] }: RenderOptions,
|
|
352
|
+
{ data, row, field }: RenderTableParams,
|
|
353
|
+
defaultHandler: {
|
|
354
|
+
[key: string]: (...args: any[]) => any;
|
|
355
|
+
},
|
|
356
|
+
) {
|
|
357
357
|
return (
|
|
358
358
|
<span class="align-gap-box w-fit">
|
|
359
|
-
{
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
359
|
+
{children
|
|
360
|
+
.filter(
|
|
361
|
+
(f) =>
|
|
362
|
+
!f?.props?.hiddenIf?.({
|
|
363
|
+
data,
|
|
364
|
+
row,
|
|
365
|
+
field,
|
|
366
|
+
}),
|
|
367
|
+
)
|
|
368
|
+
.map((m) => (
|
|
365
369
|
<Button
|
|
366
370
|
{...omit(Object.assign({}, props, m.props), ['content', 'hiddenIf'])}
|
|
367
371
|
icon={m.props.icon ? <Icon icon={m.props.icon} /> : null}
|
|
368
372
|
onClick={() => {
|
|
369
|
-
m.events?.click?.({ data, row, field })
|
|
373
|
+
m.events?.click?.({ data, row, field });
|
|
370
374
|
if (m.props.htmlType === 'reset' && defaultHandler?.reset) {
|
|
371
375
|
if (props.beforeClick && isFunction(props.beforeClick)) {
|
|
372
|
-
defaultHandler?.setLoadings?.(true)
|
|
373
|
-
props
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
376
|
+
defaultHandler?.setLoadings?.(true);
|
|
377
|
+
props
|
|
378
|
+
.beforeClick({ row, field })
|
|
379
|
+
.then((res: void | Recordable) => {
|
|
380
|
+
defaultHandler.reset(res ? { row: res, field } : { row, field });
|
|
381
|
+
})
|
|
382
|
+
.finally(() => {
|
|
383
|
+
defaultHandler?.setLoadings?.(false);
|
|
384
|
+
});
|
|
385
|
+
} else {
|
|
386
|
+
defaultHandler.reset({ row, field });
|
|
381
387
|
}
|
|
382
388
|
}
|
|
383
389
|
if (m.props.htmlType === 'pick' && defaultHandler?.pick) {
|
|
384
390
|
if (props.beforeClick && isFunction(props.beforeClick)) {
|
|
385
|
-
defaultHandler?.setLoadings?.(true)
|
|
386
|
-
props
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
391
|
+
defaultHandler?.setLoadings?.(true);
|
|
392
|
+
props
|
|
393
|
+
.beforeClick({ row, field })
|
|
394
|
+
.then((res: void | Recordable) => {
|
|
395
|
+
defaultHandler.pick(res ? { row: res, field } : { row, field });
|
|
396
|
+
})
|
|
397
|
+
.finally(() => {
|
|
398
|
+
defaultHandler?.setLoadings?.(false);
|
|
399
|
+
});
|
|
400
|
+
} else {
|
|
401
|
+
defaultHandler.pick({ row, field });
|
|
394
402
|
}
|
|
395
403
|
}
|
|
396
404
|
}}
|
|
397
405
|
>
|
|
398
406
|
{m.props.content}
|
|
399
407
|
</Button>
|
|
400
|
-
))
|
|
401
|
-
}
|
|
408
|
+
))}
|
|
402
409
|
</span>
|
|
403
|
-
)
|
|
410
|
+
);
|
|
404
411
|
},
|
|
405
412
|
},
|
|
406
413
|
ButtonTree: {
|
|
@@ -622,7 +629,7 @@ export const addRender = (
|
|
|
622
629
|
},
|
|
623
630
|
) => {
|
|
624
631
|
if (renders.hasOwnProperty(name)) {
|
|
625
|
-
console.warn(`render ${name} already exists`);
|
|
632
|
+
console.warn(`render ${name} already exists, you are trying to override it`);
|
|
626
633
|
}
|
|
627
634
|
renders[name] = {
|
|
628
635
|
renderItemContent,
|