pro-design-vue 1.2.18 → 1.2.19
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/index.full.js +19 -49
- package/dist/index.full.min.js +7 -7
- package/dist/index.full.min.js.map +1 -1
- package/dist/index.full.min.mjs +7 -7
- package/dist/index.full.min.mjs.map +1 -1
- package/dist/index.full.mjs +19 -49
- package/es/components/form/src/fields/FieldCheckboxGroup.d.ts +27 -18
- package/es/components/form/src/fields/FieldRadioGroup.d.ts +27 -18
- package/es/components/form/src/hooks/useFieldOptions.d.ts +5 -1
- package/es/packages/components/form/src/fields/FieldCheckboxGroup.mjs +3 -1
- package/es/packages/components/form/src/fields/FieldCheckboxGroup.mjs.map +1 -1
- package/es/packages/components/form/src/fields/FieldRadioGroup.mjs +3 -1
- package/es/packages/components/form/src/fields/FieldRadioGroup.mjs.map +1 -1
- package/es/packages/components/form/src/hooks/useFieldOptions.mjs +9 -44
- package/es/packages/components/form/src/hooks/useFieldOptions.mjs.map +1 -1
- package/es/packages/components/form/src/utils/fieldPropsMap.mjs +2 -1
- package/es/packages/components/form/src/utils/fieldPropsMap.mjs.map +1 -1
- package/es/version.d.ts +1 -1
- package/es/version.mjs +1 -1
- package/es/version.mjs.map +1 -1
- package/lib/components/form/src/fields/FieldCheckboxGroup.d.ts +27 -18
- package/lib/components/form/src/fields/FieldRadioGroup.d.ts +27 -18
- package/lib/components/form/src/hooks/useFieldOptions.d.ts +5 -1
- package/lib/packages/components/form/src/fields/FieldCheckboxGroup.js +3 -1
- package/lib/packages/components/form/src/fields/FieldCheckboxGroup.js.map +1 -1
- package/lib/packages/components/form/src/fields/FieldRadioGroup.js +3 -1
- package/lib/packages/components/form/src/fields/FieldRadioGroup.js.map +1 -1
- package/lib/packages/components/form/src/hooks/useFieldOptions.js +9 -44
- package/lib/packages/components/form/src/hooks/useFieldOptions.js.map +1 -1
- package/lib/packages/components/form/src/utils/fieldPropsMap.js +2 -1
- package/lib/packages/components/form/src/utils/fieldPropsMap.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/lib/version.js.map +1 -1
- package/package.json +1 -1
package/dist/index.full.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Pro Design Vue v1.2.
|
|
1
|
+
/*! Pro Design Vue v1.2.19 */
|
|
2
2
|
|
|
3
3
|
import { Modal, theme as theme$1, ConfigProvider, App, Button as Button$1, Tooltip, Popconfirm, Dropdown, Menu, Slider, Drawer, Input, InputNumber, Form as Form$1, Space, Textarea, Select, TreeSelect, Checkbox as Checkbox$1, CheckboxGroup, RadioGroup, Radio as Radio$1, Cascader, Switch, Rate, DatePicker, RangePicker, TimePicker, TimeRangePicker, Upload, FormItemRest, Spin, message, Row as Row$1, Col, FormItem as FormItem$3, Steps, Popover, MenuItem, SubMenu, Empty, Badge, Tag, Pagination, InputSearch, Tree, Card, Tabs, TabPane } from 'ant-design-vue';
|
|
4
4
|
import { inject, ref, getCurrentInstance, nextTick, h, reactive, defineComponent, createVNode, isVNode, Fragment, cloneVNode, provide, watch, computed, renderSlot, createPropsRestProxy, createBlock, openBlock, unref, mergeProps, withCtx, normalizeProps, guardReactiveProps, shallowRef, shallowReadonly, toValue, getCurrentScope, onScopeDispose, onMounted, hasInjectionContext, isRef, toRefs as toRefs$1, customRef, toRef as toRef$1, readonly, watchEffect, toRaw, createElementBlock, createCommentVNode, resolveDynamicComponent, createElementVNode, normalizeStyle, toDisplayString, normalizeClass, createSlots, useAttrs, useTemplateRef, defineAsyncComponent, Teleport, onUnmounted, Comment as Comment$1, useSlots, useModel, withModifiers, mergeModels, renderList, camelize, isReactive, onActivated, onDeactivated, onBeforeUnmount, triggerRef, resolveDirective, withDirectives, vShow, render as render$1, resolveComponent, createTextVNode, vModelText } from 'vue';
|
|
@@ -30,7 +30,7 @@ const SCROLL_FIXED_CLASS = `_scroll__fixed_`;
|
|
|
30
30
|
const DEFAULT_NAMESPACE = "pro";
|
|
31
31
|
const DEFAULT_LOCALE = "zh-CN";
|
|
32
32
|
|
|
33
|
-
const version$1 = "1.2.
|
|
33
|
+
const version$1 = "1.2.19";
|
|
34
34
|
|
|
35
35
|
const makeInstaller = (components = []) => {
|
|
36
36
|
const install = (app) => {
|
|
@@ -14422,19 +14422,22 @@ const fieldParsingValueEnumToArray = (valueEnumParams) => {
|
|
|
14422
14422
|
});
|
|
14423
14423
|
return enumArray;
|
|
14424
14424
|
};
|
|
14425
|
-
const formatOptions = (options) => {
|
|
14425
|
+
const formatOptions = (options, fieldNames) => {
|
|
14426
14426
|
return options == null ? void 0 : options.map((opt) => {
|
|
14427
14427
|
if (!isObject$4(opt)) {
|
|
14428
14428
|
return { label: opt, value: opt };
|
|
14429
14429
|
}
|
|
14430
|
+
opt.label = opt[fieldNames.label];
|
|
14431
|
+
opt.value = opt[fieldNames.value];
|
|
14432
|
+
opt.children = opt[fieldNames.children];
|
|
14430
14433
|
if (opt == null ? void 0 : opt.text) {
|
|
14431
14434
|
opt.label = opt == null ? void 0 : opt.text;
|
|
14432
14435
|
}
|
|
14433
14436
|
if (Array.isArray(opt.options) && opt.options.length) {
|
|
14434
|
-
opt.options = formatOptions(opt.options);
|
|
14437
|
+
opt.options = formatOptions(opt.options, fieldNames);
|
|
14435
14438
|
}
|
|
14436
14439
|
if (Array.isArray(opt.children) && opt.children.length) {
|
|
14437
|
-
opt.children = formatOptions(opt.children);
|
|
14440
|
+
opt.children = formatOptions(opt.children, fieldNames);
|
|
14438
14441
|
}
|
|
14439
14442
|
return opt;
|
|
14440
14443
|
});
|
|
@@ -14455,7 +14458,7 @@ function useFieldOptions({
|
|
|
14455
14458
|
const runOptions = computed(() => runFunction(options, formData.value, rowData == null ? void 0 : rowData.value));
|
|
14456
14459
|
const mergeOptions = ref([]);
|
|
14457
14460
|
const fieldNames = computed(() => {
|
|
14458
|
-
return
|
|
14461
|
+
return { label: "label", value: "value", children: "children", ...fieldNamesConfig };
|
|
14459
14462
|
});
|
|
14460
14463
|
const [innerParams, setInnerParams] = useState(
|
|
14461
14464
|
() => {
|
|
@@ -14494,7 +14497,7 @@ function useFieldOptions({
|
|
|
14494
14497
|
() => {
|
|
14495
14498
|
var _a;
|
|
14496
14499
|
if (Array.isArray(runOptions.value) && ((_a = runOptions.value) == null ? void 0 : _a.length) > 0) {
|
|
14497
|
-
mergeOptions.value = formatOptions(runOptions.value);
|
|
14500
|
+
mergeOptions.value = formatOptions(runOptions.value, fieldNames.value);
|
|
14498
14501
|
} else {
|
|
14499
14502
|
const optionsEnum = runFunction(valueEnum, formData.value);
|
|
14500
14503
|
mergeOptions.value = fieldParsingValueEnumToArray(optionsEnum);
|
|
@@ -14506,48 +14509,10 @@ function useFieldOptions({
|
|
|
14506
14509
|
);
|
|
14507
14510
|
const fetchData = useFetchData$1({ request });
|
|
14508
14511
|
const requestOptions = debounce(async () => {
|
|
14509
|
-
var _a;
|
|
14510
14512
|
loading.value = true;
|
|
14511
14513
|
const result = await fetchData(mergeParams.value, index == null ? void 0 : index.value);
|
|
14512
14514
|
if (Array.isArray(result)) {
|
|
14513
|
-
mergeOptions.value = result.
|
|
14514
|
-
if (opt == null ? void 0 : opt.text) {
|
|
14515
|
-
opt.label = opt == null ? void 0 : opt.text;
|
|
14516
|
-
}
|
|
14517
|
-
return opt;
|
|
14518
|
-
});
|
|
14519
|
-
} else if (isObject$4(result)) {
|
|
14520
|
-
const { success, total: dataTotal, data } = result;
|
|
14521
|
-
if (success) {
|
|
14522
|
-
if (paginationConfig == null ? void 0 : paginationConfig.value) {
|
|
14523
|
-
total.value = dataTotal;
|
|
14524
|
-
if (((_a = innerParams == null ? void 0 : innerParams.value) == null ? void 0 : _a.current) === 1) {
|
|
14525
|
-
mergeOptions.value = data.map((opt) => {
|
|
14526
|
-
if (opt == null ? void 0 : opt.text) {
|
|
14527
|
-
opt.label = opt == null ? void 0 : opt.text;
|
|
14528
|
-
}
|
|
14529
|
-
return opt;
|
|
14530
|
-
});
|
|
14531
|
-
} else {
|
|
14532
|
-
mergeOptions.value = [
|
|
14533
|
-
...mergeOptions.value,
|
|
14534
|
-
...data.map((opt) => {
|
|
14535
|
-
if (opt == null ? void 0 : opt.text) {
|
|
14536
|
-
opt.label = opt == null ? void 0 : opt.text;
|
|
14537
|
-
}
|
|
14538
|
-
return opt;
|
|
14539
|
-
})
|
|
14540
|
-
];
|
|
14541
|
-
}
|
|
14542
|
-
} else {
|
|
14543
|
-
mergeOptions.value = data.map((opt) => {
|
|
14544
|
-
if (opt == null ? void 0 : opt.text) {
|
|
14545
|
-
opt.label = opt == null ? void 0 : opt.text;
|
|
14546
|
-
}
|
|
14547
|
-
return opt;
|
|
14548
|
-
});
|
|
14549
|
-
}
|
|
14550
|
-
}
|
|
14515
|
+
mergeOptions.value = formatOptions(result, fieldNames.value);
|
|
14551
14516
|
}
|
|
14552
14517
|
loading.value = false;
|
|
14553
14518
|
}, 200);
|
|
@@ -14980,7 +14945,8 @@ var FieldCheckbox = /* @__PURE__ */ defineComponent({
|
|
|
14980
14945
|
var FieldCheckboxGroup = /* @__PURE__ */ defineComponent({
|
|
14981
14946
|
name: "FieldCheckboxGroup",
|
|
14982
14947
|
props: {
|
|
14983
|
-
...commonFieldProps()
|
|
14948
|
+
...commonFieldProps(),
|
|
14949
|
+
fieldNames: Object
|
|
14984
14950
|
},
|
|
14985
14951
|
setup(props, {
|
|
14986
14952
|
attrs
|
|
@@ -14996,6 +14962,7 @@ var FieldCheckboxGroup = /* @__PURE__ */ defineComponent({
|
|
|
14996
14962
|
options: props.options,
|
|
14997
14963
|
valueEnum: props.valueEnum,
|
|
14998
14964
|
dependencies: props.dependencies,
|
|
14965
|
+
fieldNames: props.fieldNames,
|
|
14999
14966
|
params: props.params
|
|
15000
14967
|
});
|
|
15001
14968
|
const readValue = computed(() => {
|
|
@@ -15053,7 +15020,8 @@ var FieldRadioGroup = /* @__PURE__ */ defineComponent({
|
|
|
15053
15020
|
radioLabel: {
|
|
15054
15021
|
type: String,
|
|
15055
15022
|
default: ""
|
|
15056
|
-
}
|
|
15023
|
+
},
|
|
15024
|
+
fieldNames: Object
|
|
15057
15025
|
},
|
|
15058
15026
|
setup(props, {
|
|
15059
15027
|
attrs
|
|
@@ -15070,6 +15038,7 @@ var FieldRadioGroup = /* @__PURE__ */ defineComponent({
|
|
|
15070
15038
|
options: props.options,
|
|
15071
15039
|
valueEnum: props.valueEnum,
|
|
15072
15040
|
dependencies: props.dependencies,
|
|
15041
|
+
fieldNames: props.fieldNames,
|
|
15073
15042
|
params: props.params
|
|
15074
15043
|
});
|
|
15075
15044
|
const readValue = computed(() => {
|
|
@@ -38073,13 +38042,14 @@ const fieldPropsMap = {
|
|
|
38073
38042
|
"onUpdate:searchValue"
|
|
38074
38043
|
],
|
|
38075
38044
|
checkbox: ["id", "autofocus", "disabled", "indeterminate"],
|
|
38076
|
-
checkboxGroup: ["id", "disabled", "name", "options"],
|
|
38045
|
+
checkboxGroup: ["id", "disabled", "name", "options", "fieldNames"],
|
|
38077
38046
|
radioGroup: [
|
|
38078
38047
|
"id",
|
|
38079
38048
|
"class",
|
|
38080
38049
|
"disabled",
|
|
38081
38050
|
"name",
|
|
38082
38051
|
"options",
|
|
38052
|
+
"fieldNames",
|
|
38083
38053
|
"optionType",
|
|
38084
38054
|
"buttonStyle",
|
|
38085
38055
|
"radioLabel"
|
|
@@ -1,78 +1,87 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
1
2
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
fieldNames: PropType<{
|
|
4
|
+
label?: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
}>;
|
|
2
7
|
value: {
|
|
3
|
-
type:
|
|
8
|
+
type: PropType<any>;
|
|
4
9
|
};
|
|
5
10
|
readonly: {
|
|
6
11
|
type: BooleanConstructor;
|
|
7
12
|
default: undefined;
|
|
8
13
|
};
|
|
9
14
|
readonlyProps: {
|
|
10
|
-
type:
|
|
15
|
+
type: PropType<import("pro-design-vue").ProFormItemType["readonlyProps"]>;
|
|
11
16
|
default: undefined;
|
|
12
17
|
};
|
|
13
18
|
valueEnum: {
|
|
14
|
-
type:
|
|
19
|
+
type: PropType<import("pro-design-vue").ProFormItemType["valueEnum"]>;
|
|
15
20
|
default: undefined;
|
|
16
21
|
};
|
|
17
22
|
options: {
|
|
18
|
-
type:
|
|
23
|
+
type: PropType<import("pro-design-vue").ProFormItemType["options"]>;
|
|
19
24
|
default: undefined;
|
|
20
25
|
};
|
|
21
26
|
request: {
|
|
22
|
-
type:
|
|
27
|
+
type: PropType<import("pro-design-vue").ProFormItemType["request"]>;
|
|
23
28
|
default: undefined;
|
|
24
29
|
};
|
|
25
30
|
params: {
|
|
26
|
-
type:
|
|
31
|
+
type: PropType<import("pro-design-vue").ProFormItemType["params"]>;
|
|
27
32
|
default: undefined;
|
|
28
33
|
};
|
|
29
34
|
dependencies: {
|
|
30
|
-
type:
|
|
35
|
+
type: PropType<import("pro-design-vue").ProFormItemType["dependencies"]>;
|
|
31
36
|
default: undefined;
|
|
32
37
|
};
|
|
33
38
|
onChange: {
|
|
34
|
-
type:
|
|
39
|
+
type: PropType<import("pro-design-vue").ProFormItemType["onChange"]>;
|
|
35
40
|
};
|
|
36
41
|
onPressEnter: {
|
|
37
|
-
type:
|
|
42
|
+
type: PropType<import("pro-design-vue").KeyboardEventHandler>;
|
|
38
43
|
};
|
|
39
44
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
45
|
+
fieldNames: PropType<{
|
|
46
|
+
label?: string;
|
|
47
|
+
value?: string;
|
|
48
|
+
}>;
|
|
40
49
|
value: {
|
|
41
|
-
type:
|
|
50
|
+
type: PropType<any>;
|
|
42
51
|
};
|
|
43
52
|
readonly: {
|
|
44
53
|
type: BooleanConstructor;
|
|
45
54
|
default: undefined;
|
|
46
55
|
};
|
|
47
56
|
readonlyProps: {
|
|
48
|
-
type:
|
|
57
|
+
type: PropType<import("pro-design-vue").ProFormItemType["readonlyProps"]>;
|
|
49
58
|
default: undefined;
|
|
50
59
|
};
|
|
51
60
|
valueEnum: {
|
|
52
|
-
type:
|
|
61
|
+
type: PropType<import("pro-design-vue").ProFormItemType["valueEnum"]>;
|
|
53
62
|
default: undefined;
|
|
54
63
|
};
|
|
55
64
|
options: {
|
|
56
|
-
type:
|
|
65
|
+
type: PropType<import("pro-design-vue").ProFormItemType["options"]>;
|
|
57
66
|
default: undefined;
|
|
58
67
|
};
|
|
59
68
|
request: {
|
|
60
|
-
type:
|
|
69
|
+
type: PropType<import("pro-design-vue").ProFormItemType["request"]>;
|
|
61
70
|
default: undefined;
|
|
62
71
|
};
|
|
63
72
|
params: {
|
|
64
|
-
type:
|
|
73
|
+
type: PropType<import("pro-design-vue").ProFormItemType["params"]>;
|
|
65
74
|
default: undefined;
|
|
66
75
|
};
|
|
67
76
|
dependencies: {
|
|
68
|
-
type:
|
|
77
|
+
type: PropType<import("pro-design-vue").ProFormItemType["dependencies"]>;
|
|
69
78
|
default: undefined;
|
|
70
79
|
};
|
|
71
80
|
onChange: {
|
|
72
|
-
type:
|
|
81
|
+
type: PropType<import("pro-design-vue").ProFormItemType["onChange"]>;
|
|
73
82
|
};
|
|
74
83
|
onPressEnter: {
|
|
75
|
-
type:
|
|
84
|
+
type: PropType<import("pro-design-vue").KeyboardEventHandler>;
|
|
76
85
|
};
|
|
77
86
|
}>> & Readonly<{}>, {
|
|
78
87
|
readonlyProps: import("pro-design-vue").ReadonlyProps | undefined;
|
|
@@ -1,86 +1,95 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
1
2
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
3
|
radioLabel: {
|
|
3
4
|
type: StringConstructor;
|
|
4
5
|
default: string;
|
|
5
6
|
};
|
|
7
|
+
fieldNames: PropType<{
|
|
8
|
+
label?: string;
|
|
9
|
+
value?: string;
|
|
10
|
+
}>;
|
|
6
11
|
value: {
|
|
7
|
-
type:
|
|
12
|
+
type: PropType<any>;
|
|
8
13
|
};
|
|
9
14
|
readonly: {
|
|
10
15
|
type: BooleanConstructor;
|
|
11
16
|
default: undefined;
|
|
12
17
|
};
|
|
13
18
|
readonlyProps: {
|
|
14
|
-
type:
|
|
19
|
+
type: PropType<import("pro-design-vue").ProFormItemType["readonlyProps"]>;
|
|
15
20
|
default: undefined;
|
|
16
21
|
};
|
|
17
22
|
valueEnum: {
|
|
18
|
-
type:
|
|
23
|
+
type: PropType<import("pro-design-vue").ProFormItemType["valueEnum"]>;
|
|
19
24
|
default: undefined;
|
|
20
25
|
};
|
|
21
26
|
options: {
|
|
22
|
-
type:
|
|
27
|
+
type: PropType<import("pro-design-vue").ProFormItemType["options"]>;
|
|
23
28
|
default: undefined;
|
|
24
29
|
};
|
|
25
30
|
request: {
|
|
26
|
-
type:
|
|
31
|
+
type: PropType<import("pro-design-vue").ProFormItemType["request"]>;
|
|
27
32
|
default: undefined;
|
|
28
33
|
};
|
|
29
34
|
params: {
|
|
30
|
-
type:
|
|
35
|
+
type: PropType<import("pro-design-vue").ProFormItemType["params"]>;
|
|
31
36
|
default: undefined;
|
|
32
37
|
};
|
|
33
38
|
dependencies: {
|
|
34
|
-
type:
|
|
39
|
+
type: PropType<import("pro-design-vue").ProFormItemType["dependencies"]>;
|
|
35
40
|
default: undefined;
|
|
36
41
|
};
|
|
37
42
|
onChange: {
|
|
38
|
-
type:
|
|
43
|
+
type: PropType<import("pro-design-vue").ProFormItemType["onChange"]>;
|
|
39
44
|
};
|
|
40
45
|
onPressEnter: {
|
|
41
|
-
type:
|
|
46
|
+
type: PropType<import("pro-design-vue").KeyboardEventHandler>;
|
|
42
47
|
};
|
|
43
48
|
}>, () => import("vue/jsx-runtime").JSX.Element | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
44
49
|
radioLabel: {
|
|
45
50
|
type: StringConstructor;
|
|
46
51
|
default: string;
|
|
47
52
|
};
|
|
53
|
+
fieldNames: PropType<{
|
|
54
|
+
label?: string;
|
|
55
|
+
value?: string;
|
|
56
|
+
}>;
|
|
48
57
|
value: {
|
|
49
|
-
type:
|
|
58
|
+
type: PropType<any>;
|
|
50
59
|
};
|
|
51
60
|
readonly: {
|
|
52
61
|
type: BooleanConstructor;
|
|
53
62
|
default: undefined;
|
|
54
63
|
};
|
|
55
64
|
readonlyProps: {
|
|
56
|
-
type:
|
|
65
|
+
type: PropType<import("pro-design-vue").ProFormItemType["readonlyProps"]>;
|
|
57
66
|
default: undefined;
|
|
58
67
|
};
|
|
59
68
|
valueEnum: {
|
|
60
|
-
type:
|
|
69
|
+
type: PropType<import("pro-design-vue").ProFormItemType["valueEnum"]>;
|
|
61
70
|
default: undefined;
|
|
62
71
|
};
|
|
63
72
|
options: {
|
|
64
|
-
type:
|
|
73
|
+
type: PropType<import("pro-design-vue").ProFormItemType["options"]>;
|
|
65
74
|
default: undefined;
|
|
66
75
|
};
|
|
67
76
|
request: {
|
|
68
|
-
type:
|
|
77
|
+
type: PropType<import("pro-design-vue").ProFormItemType["request"]>;
|
|
69
78
|
default: undefined;
|
|
70
79
|
};
|
|
71
80
|
params: {
|
|
72
|
-
type:
|
|
81
|
+
type: PropType<import("pro-design-vue").ProFormItemType["params"]>;
|
|
73
82
|
default: undefined;
|
|
74
83
|
};
|
|
75
84
|
dependencies: {
|
|
76
|
-
type:
|
|
85
|
+
type: PropType<import("pro-design-vue").ProFormItemType["dependencies"]>;
|
|
77
86
|
default: undefined;
|
|
78
87
|
};
|
|
79
88
|
onChange: {
|
|
80
|
-
type:
|
|
89
|
+
type: PropType<import("pro-design-vue").ProFormItemType["onChange"]>;
|
|
81
90
|
};
|
|
82
91
|
onPressEnter: {
|
|
83
|
-
type:
|
|
92
|
+
type: PropType<import("pro-design-vue").KeyboardEventHandler>;
|
|
84
93
|
};
|
|
85
94
|
}>> & Readonly<{}>, {
|
|
86
95
|
readonlyProps: import("pro-design-vue").ReadonlyProps | undefined;
|
|
@@ -4,7 +4,11 @@ import type { DebouncedFunc } from 'lodash-unified';
|
|
|
4
4
|
type SelectOptionType = Partial<RequestOptionsType>[];
|
|
5
5
|
export declare const ObjToMap: (value: ProFieldValueEnumType | undefined) => ProValueEnumMap;
|
|
6
6
|
export declare const fieldParsingValueEnumToArray: (valueEnumParams: ProFieldValueEnumType) => SelectOptionType;
|
|
7
|
-
export declare const formatOptions: (options: (string | number | RequestOptionsType)[]
|
|
7
|
+
export declare const formatOptions: (options: (string | number | RequestOptionsType)[], fieldNames: {
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
children: string;
|
|
11
|
+
}) => SelectOptionType;
|
|
8
12
|
export declare function useFieldOptions({ options, request, params, valueEnum, fieldNames: fieldNamesConfig, dependencies, paginationConfig, }: {
|
|
9
13
|
options?: ProFormItemType['options'];
|
|
10
14
|
request?: ProFormItemType['request'];
|
|
@@ -9,7 +9,8 @@ import FieldReadonly from './FieldReadonly.mjs';
|
|
|
9
9
|
var FieldCheckboxGroup = /* @__PURE__ */ defineComponent({
|
|
10
10
|
name: "FieldCheckboxGroup",
|
|
11
11
|
props: {
|
|
12
|
-
...commonFieldProps()
|
|
12
|
+
...commonFieldProps(),
|
|
13
|
+
fieldNames: Object
|
|
13
14
|
},
|
|
14
15
|
setup(props, {
|
|
15
16
|
attrs
|
|
@@ -25,6 +26,7 @@ var FieldCheckboxGroup = /* @__PURE__ */ defineComponent({
|
|
|
25
26
|
options: props.options,
|
|
26
27
|
valueEnum: props.valueEnum,
|
|
27
28
|
dependencies: props.dependencies,
|
|
29
|
+
fieldNames: props.fieldNames,
|
|
28
30
|
params: props.params
|
|
29
31
|
});
|
|
30
32
|
const readValue = computed(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldCheckboxGroup.mjs","sources":["../../../../../../../../packages/components/form/src/fields/FieldCheckboxGroup.tsx"],"sourcesContent":["/*\n * @Author: shen\n * @Date: 2023-08-10 15:53:17\n * @LastEditors: shen\n * @LastEditTime: 2025-
|
|
1
|
+
{"version":3,"file":"FieldCheckboxGroup.mjs","sources":["../../../../../../../../packages/components/form/src/fields/FieldCheckboxGroup.tsx"],"sourcesContent":["/*\n * @Author: shen\n * @Date: 2023-08-10 15:53:17\n * @LastEditors: shen\n * @LastEditTime: 2025-10-24 15:40:58\n * @Description:\n */\nimport { defineComponent, computed, type PropType } from 'vue'\nimport { CheckboxGroup } from 'ant-design-vue'\nimport { LoadingOutlined } from '@ant-design/icons-vue'\nimport { useFieldOptions } from '../hooks/useFieldOptions'\nimport { commonFieldProps } from '../props'\nimport { useInjectForm } from '../context/FormContext'\nimport FieldReadonly from './FieldReadonly'\n\nexport default defineComponent({\n name: 'FieldCheckboxGroup',\n props: {\n ...commonFieldProps(),\n fieldNames: Object as PropType<{ label?: string; value?: string }>,\n },\n setup(props, { attrs }) {\n const { disabled } = useInjectForm()\n const { mergeOptions, loading } = useFieldOptions({\n request: props.request,\n options: props.options,\n valueEnum: props.valueEnum,\n dependencies: props.dependencies,\n fieldNames: props.fieldNames,\n params: props.params,\n })\n\n const readValue = computed(() => {\n if (!props.value) {\n return undefined\n }\n if (Array.isArray(props.value)) {\n if (!props.value.length) {\n return undefined\n }\n return mergeOptions.value\n .filter((op) => props.value.includes(op.value))\n .map((op) => op.label ?? op.text)\n .join(',')\n }\n const option = mergeOptions.value.find((op) => op.value === props.value)\n return option?.label ?? option?.text\n })\n\n const onChange: any = (value: any) => {\n props.onChange?.(value)\n }\n return () => {\n if (props.readonly) {\n return (\n <FieldReadonly\n text={readValue.value}\n class={attrs.class}\n style={attrs.style}\n {...props.readonlyProps}\n />\n )\n }\n return (\n <CheckboxGroup\n value={props.value}\n {...attrs}\n // 这块无法直接接收form的disabled状态,所以手动处理一下,等待修复\n disabled={(attrs as any).disabled ?? disabled?.value}\n options={mergeOptions.value as any}\n onChange={onChange}\n >\n {loading.value && <LoadingOutlined style=\"color: rgba(0, 0, 0, 0.25);\" />}\n </CheckboxGroup>\n )\n }\n },\n})\n"],"names":["name","props","commonFieldProps","fieldNames","Object","setup","attrs","disabled","useInjectForm","mergeOptions","loading","useFieldOptions","request","options","valueEnum","dependencies","params","readValue","computed","value","undefined","Array","isArray","length","filter","op","includes","map","_a","label","text","join","option","find","onChange","readonly","_createVNode","FieldReadonly","_mergeProps","class","style","readonlyProps","CheckboxGroup","default","LoadingOutlined"],"mappings":";;;;;;;;AAeA,yDAA+B;AAAA,EAC7BA,IAAAA,EAAM,oBAAA;AAAA,EACNC,KAAAA,EAAO;AAAA,IACL,GAAGC,gBAAAA,EAAiB;AAAA,IACpBC,UAAAA,EAAYC;AAAAA,GACd;AAAA,EACAC,MAAMJ,KAAAA,EAAO;AAAA,IAAEK;AAAAA,GAAM,EAAG;AACtB,IAAA,MAAM;AAAA,MAAEC;AAAAA,QAAaC,aAAAA,EAAc;AACnC,IAAA,MAAM;AAAA,MAAEC,YAAAA;AAAAA,MAAcC;AAAAA,QAAYC,eAAAA,CAAgB;AAAA,MAChDC,SAASX,KAAAA,CAAMW,OAAAA;AAAAA,MACfC,SAASZ,KAAAA,CAAMY,OAAAA;AAAAA,MACfC,WAAWb,KAAAA,CAAMa,SAAAA;AAAAA,MACjBC,cAAcd,KAAAA,CAAMc,YAAAA;AAAAA,MACpBZ,YAAYF,KAAAA,CAAME,UAAAA;AAAAA,MAClBa,QAAQf,KAAAA,CAAMe;AAAAA,KACf,CAAA;AAED,IAAA,MAAMC,SAAAA,GAAYC,SAAS,MAAM;AAhCrC,MAAA,IAAA,EAAA;AAiCM,MAAA,IAAI,CAACjB,MAAMkB,KAAAA,EAAO;AAChB,QAAA,OAAOC,MAAAA;AAAAA,MACT;AACA,MAAA,IAAIC,KAAAA,CAAMC,OAAAA,CAAQrB,KAAAA,CAAMkB,KAAK,CAAA,EAAG;AAC9B,QAAA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CAAAC,eAAAC,UAAAA,CAAA;AAAA,UAAA,QAEUrB,SAAAA,CAAUE,KAAAA;AAAAA,UAAK,SACdb,KAAAA,CAAMiC,KAAAA;AAAAA,UAAK,SACXjC,KAAAA,CAAMkC;AAAAA,SAAK,EACdvC,KAAAA,CAAMwC,aAAa,CAAA,EAAA,IAAA,CAAA;AAAA,MAG7B;AACA,MAAA,OAAAL,WAAAA,CAAAM,eAAAJ,UAAAA,CAAA;AAAA,QAAA,SAEWrC,KAAAA,CAAMkB;AAAAA,SACTb,KAAAA,EAAK;AAAA,QAAA,UAAA,EAAA,CAEEA,EAAAA,GAAAA,KAAAA,CAAcC,QAAAA,KAAdD,IAAAA,GAAAA,EAAAA,GAA0BC,QAAAA,IAAAA,IAAAA,GAAAA,MAAAA,GAAAA,QAAAA,CAAUY,KAAAA;AAAAA,QAAK,WAC3CV,YAAAA,CAAaU,KAAAA;AAAAA,QAAK,UAAA,EACjBe;AAAAA,OAAQ,CAAA,EAAA;AAAA,QAAAS,SAAAA,MAAA,CAEjBjC,OAAAA,CAAQS,KAAAA,IAAKiB,YAAAQ,eAAAA,EAAA;AAAA,UAAA,OAAA,EAAA;AAAA,SAAA,EAAA,IAAA,CAA2D;AAAA,OAAA,CAAA;AAAA,IAG/E,CAAA;AAAA,EACF;AACF,CAAC,CAAA;;;;"}
|
|
@@ -19,7 +19,8 @@ var FieldRadioGroup = /* @__PURE__ */ defineComponent({
|
|
|
19
19
|
radioLabel: {
|
|
20
20
|
type: String,
|
|
21
21
|
default: ""
|
|
22
|
-
}
|
|
22
|
+
},
|
|
23
|
+
fieldNames: Object
|
|
23
24
|
},
|
|
24
25
|
setup(props, {
|
|
25
26
|
attrs
|
|
@@ -36,6 +37,7 @@ var FieldRadioGroup = /* @__PURE__ */ defineComponent({
|
|
|
36
37
|
options: props.options,
|
|
37
38
|
valueEnum: props.valueEnum,
|
|
38
39
|
dependencies: props.dependencies,
|
|
40
|
+
fieldNames: props.fieldNames,
|
|
39
41
|
params: props.params
|
|
40
42
|
});
|
|
41
43
|
const readValue = computed(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldRadioGroup.mjs","sources":["../../../../../../../../packages/components/form/src/fields/FieldRadioGroup.tsx"],"sourcesContent":["/*\n * @Author: shen\n * @Date: 2023-08-10 15:53:17\n * @LastEditors: shen\n * @LastEditTime: 2025-
|
|
1
|
+
{"version":3,"file":"FieldRadioGroup.mjs","sources":["../../../../../../../../packages/components/form/src/fields/FieldRadioGroup.tsx"],"sourcesContent":["/*\n * @Author: shen\n * @Date: 2023-08-10 15:53:17\n * @LastEditors: shen\n * @LastEditTime: 2025-10-24 15:47:59\n * @Description:\n */\nimport { defineComponent, computed, type PropType } from 'vue'\nimport { RadioGroup, Radio } from 'ant-design-vue'\nimport { LoadingOutlined } from '@ant-design/icons-vue'\nimport { useFieldOptions } from '../hooks/useFieldOptions'\nimport { useInjectSlots } from '../context/FormSlotsContext'\nimport { commonFieldProps } from '../props'\nimport FieldReadonly from './FieldReadonly'\nimport getSlot from '../utils/getSlot'\nimport { useInjectForm } from '../context/FormContext'\nimport { RenderVNode } from '@pro-design-vue/utils'\n\nexport default defineComponent({\n name: 'FieldRadioGroup',\n props: {\n ...commonFieldProps(),\n radioLabel: {\n type: String,\n default: '',\n },\n fieldNames: Object as PropType<{ label?: string; value?: string }>,\n },\n setup(props, { attrs }) {\n const { formData } = useInjectForm()\n const formSlotsContext = useInjectSlots()\n const { mergeOptions, loading } = useFieldOptions({\n request: props.request,\n options: props.options,\n valueEnum: props.valueEnum,\n dependencies: props.dependencies,\n fieldNames: props.fieldNames,\n params: props.params,\n })\n const readValue = computed(() => {\n if (!props.value) {\n return undefined\n }\n const option = mergeOptions.value.find((op) => op.value === props.value)\n return option?.label ?? option?.text\n })\n\n const defaultSlot = computed(() => {\n return getSlot(props['radioLabel'], formSlotsContext)\n })\n\n const onChange: any = (e: any) => {\n props.onChange?.(e.target.value)\n }\n return () => {\n if (props.readonly) {\n return (\n <FieldReadonly\n text={readValue.value}\n class={attrs.class}\n style={attrs.style}\n {...props.readonlyProps}\n />\n )\n }\n if (mergeOptions.value?.length > 0) {\n return (\n <RadioGroup value={props.value} {...attrs} onChange={onChange}>\n {mergeOptions.value.map((option) => (\n <Radio value={option.value} key={option.value?.toString()} disabled={option.disabled}>\n {defaultSlot.value ? (\n <RenderVNode\n vnode={defaultSlot.value}\n props={{ option, value: props.value, formData: formData.value }}\n />\n ) : (\n option.label\n )}\n </Radio>\n ))}\n </RadioGroup>\n )\n } else {\n return loading.value ? <LoadingOutlined style=\"color: rgba(0, 0, 0, 0.25);\" /> : null\n }\n }\n },\n})\n"],"names":["_isSlot","s","Object","prototype","toString","call","_isVNode","name","props","commonFieldProps","radioLabel","type","String","default","fieldNames","setup","attrs","formData","useInjectForm","formSlotsContext","useInjectSlots","mergeOptions","loading","useFieldOptions","request","options","valueEnum","dependencies","params","readValue","computed","value","undefined","option","find","op","label","text","defaultSlot","getSlot","onChange","e","target","readonly","_createVNode","FieldReadonly","_mergeProps","class","style","readonlyProps","length","_slot","RadioGroup","map","_a","Radio","disabled","RenderVNode","LoadingOutlined"],"mappings":";;;;;;;;;;;AAgBmD,SAAAA,QAAAC,CAAAA,EAAA;AAAA,EAAA,OAAA,OAAAA,CAAAA,KAAA,UAAA,IAAAC,MAAAA,CAAAC,SAAAA,CAAAC,QAAAA,CAAAC,IAAAA,CAAAJ,CAAA,CAAA,KAAA,iBAAA,IAAA,CAAAK,OAAAA,CAAAL,CAAA,CAAA;AAAA;AAEnD,sDAA+B;AAAA,EAC7BM,IAAAA,EAAM,iBAAA;AAAA,EACNC,KAAAA,EAAO;AAAA,IACL,GAAGC,gBAAAA,EAAiB;AAAA,IACpBC,UAAAA,EAAY;AAAA,MACVC,IAAAA,EAAMC,MAAAA;AAAAA,MACNC,OAAAA,EAAS;AAAA,KACX;AAAA,IACAC,UAAAA,EAAYZ;AAAAA,GACd;AAAA,EACAa,MAAMP,KAAAA,EAAO;AAAA,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AY6B,MAAAA,CAAOuB;AAAAA,WAAQ,EAAA;AAAA,YAAA3C,SAAAA,MAAA,CACjFyB,WAAAA,CAAYP,KAAAA,GAAKa,YAAAa,WAAAA,EAAA;AAAA,cAAA,SAEPnB,WAAAA,CAAYP,KAAAA;AAAAA,cAAK,OAAA,EACjB;AAAA,gBAAEE,MAAAA;AAAAA,gBAAQF,OAAOvB,KAAAA,CAAMuB,KAAAA;AAAAA,gBAAOd,UAAUA,QAAAA,CAASc;AAAAA;AAAM,aAAC,EAAA,IAAA,CAAA,GAGjEE,MAAAA,CAAOG,KACR;AAAA,WAAA,CAAA;AAAA,QAAA,CAEJ,CAAC,IAAAe,KAAAA,GAAA;AAAA,UAAAtC,OAAAA,EAAAA,MAAA,CAAAsC,KAAA;AAAA,SAAA,CAAA;AAAA,MAGR,CAAA,MAAO;AACL,QAAA,OAAO7B,OAAAA,CAAQS,KAAAA,GAAKa,WAAAA,CAAAc,eAAAA,EAAA;AAAA,UAAA,OAAA,EAAA;AAAA,SAAA,EAAA,IAAA,CAAA,GAA6D,IAAA;AAAA,MACnF;AAAA,IACF,CAAA;AAAA,EACF;AACF,CAAC,CAAA;;;;"}
|
|
@@ -46,19 +46,22 @@ const fieldParsingValueEnumToArray = (valueEnumParams) => {
|
|
|
46
46
|
});
|
|
47
47
|
return enumArray;
|
|
48
48
|
};
|
|
49
|
-
const formatOptions = (options) => {
|
|
49
|
+
const formatOptions = (options, fieldNames) => {
|
|
50
50
|
return options == null ? void 0 : options.map((opt) => {
|
|
51
51
|
if (!isObject(opt)) {
|
|
52
52
|
return { label: opt, value: opt };
|
|
53
53
|
}
|
|
54
|
+
opt.label = opt[fieldNames.label];
|
|
55
|
+
opt.value = opt[fieldNames.value];
|
|
56
|
+
opt.children = opt[fieldNames.children];
|
|
54
57
|
if (opt == null ? void 0 : opt.text) {
|
|
55
58
|
opt.label = opt == null ? void 0 : opt.text;
|
|
56
59
|
}
|
|
57
60
|
if (Array.isArray(opt.options) && opt.options.length) {
|
|
58
|
-
opt.options = formatOptions(opt.options);
|
|
61
|
+
opt.options = formatOptions(opt.options, fieldNames);
|
|
59
62
|
}
|
|
60
63
|
if (Array.isArray(opt.children) && opt.children.length) {
|
|
61
|
-
opt.children = formatOptions(opt.children);
|
|
64
|
+
opt.children = formatOptions(opt.children, fieldNames);
|
|
62
65
|
}
|
|
63
66
|
return opt;
|
|
64
67
|
});
|
|
@@ -79,7 +82,7 @@ function useFieldOptions({
|
|
|
79
82
|
const runOptions = computed(() => runFunction(options, formData.value, rowData == null ? void 0 : rowData.value));
|
|
80
83
|
const mergeOptions = ref([]);
|
|
81
84
|
const fieldNames = computed(() => {
|
|
82
|
-
return
|
|
85
|
+
return { label: "label", value: "value", children: "children", ...fieldNamesConfig };
|
|
83
86
|
});
|
|
84
87
|
const [innerParams, setInnerParams] = useState(
|
|
85
88
|
() => {
|
|
@@ -118,7 +121,7 @@ function useFieldOptions({
|
|
|
118
121
|
() => {
|
|
119
122
|
var _a;
|
|
120
123
|
if (Array.isArray(runOptions.value) && ((_a = runOptions.value) == null ? void 0 : _a.length) > 0) {
|
|
121
|
-
mergeOptions.value = formatOptions(runOptions.value);
|
|
124
|
+
mergeOptions.value = formatOptions(runOptions.value, fieldNames.value);
|
|
122
125
|
} else {
|
|
123
126
|
const optionsEnum = runFunction(valueEnum, formData.value);
|
|
124
127
|
mergeOptions.value = fieldParsingValueEnumToArray(optionsEnum);
|
|
@@ -130,48 +133,10 @@ function useFieldOptions({
|
|
|
130
133
|
);
|
|
131
134
|
const fetchData = useFetchData({ request });
|
|
132
135
|
const requestOptions = debounce(async () => {
|
|
133
|
-
var _a;
|
|
134
136
|
loading.value = true;
|
|
135
137
|
const result = await fetchData(mergeParams.value, index == null ? void 0 : index.value);
|
|
136
138
|
if (Array.isArray(result)) {
|
|
137
|
-
mergeOptions.value = result.
|
|
138
|
-
if (opt == null ? void 0 : opt.text) {
|
|
139
|
-
opt.label = opt == null ? void 0 : opt.text;
|
|
140
|
-
}
|
|
141
|
-
return opt;
|
|
142
|
-
});
|
|
143
|
-
} else if (isObject(result)) {
|
|
144
|
-
const { success, total: dataTotal, data } = result;
|
|
145
|
-
if (success) {
|
|
146
|
-
if (paginationConfig == null ? void 0 : paginationConfig.value) {
|
|
147
|
-
total.value = dataTotal;
|
|
148
|
-
if (((_a = innerParams == null ? void 0 : innerParams.value) == null ? void 0 : _a.current) === 1) {
|
|
149
|
-
mergeOptions.value = data.map((opt) => {
|
|
150
|
-
if (opt == null ? void 0 : opt.text) {
|
|
151
|
-
opt.label = opt == null ? void 0 : opt.text;
|
|
152
|
-
}
|
|
153
|
-
return opt;
|
|
154
|
-
});
|
|
155
|
-
} else {
|
|
156
|
-
mergeOptions.value = [
|
|
157
|
-
...mergeOptions.value,
|
|
158
|
-
...data.map((opt) => {
|
|
159
|
-
if (opt == null ? void 0 : opt.text) {
|
|
160
|
-
opt.label = opt == null ? void 0 : opt.text;
|
|
161
|
-
}
|
|
162
|
-
return opt;
|
|
163
|
-
})
|
|
164
|
-
];
|
|
165
|
-
}
|
|
166
|
-
} else {
|
|
167
|
-
mergeOptions.value = data.map((opt) => {
|
|
168
|
-
if (opt == null ? void 0 : opt.text) {
|
|
169
|
-
opt.label = opt == null ? void 0 : opt.text;
|
|
170
|
-
}
|
|
171
|
-
return opt;
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
}
|
|
139
|
+
mergeOptions.value = formatOptions(result, fieldNames.value);
|
|
175
140
|
}
|
|
176
141
|
loading.value = false;
|
|
177
142
|
}, 200);
|