@cloudbase/weda-ui 0.2.10 → 0.2.11
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
|
@@ -5,7 +5,6 @@ import SelectContainer from './SelectContainer';
|
|
|
5
5
|
|
|
6
6
|
import { normalProps } from './props/defaultProps';
|
|
7
7
|
import { propTypes } from './props/propsTypes';
|
|
8
|
-
import useOptions from './hooks';
|
|
9
8
|
|
|
10
9
|
const MultipleSelect = ({
|
|
11
10
|
// 系统属性
|
|
@@ -31,14 +30,10 @@ const MultipleSelect = ({
|
|
|
31
30
|
virtual,
|
|
32
31
|
searchable,
|
|
33
32
|
size,
|
|
33
|
+
options,
|
|
34
34
|
// 业务属性
|
|
35
|
-
enumType,
|
|
36
|
-
customEnum,
|
|
37
|
-
optionId,
|
|
38
35
|
isModelApp,
|
|
39
36
|
}) => {
|
|
40
|
-
const options = useOptions({ enumType, optionId, customEnum });
|
|
41
|
-
|
|
42
37
|
const onSelectChange = (values) => {
|
|
43
38
|
// @ts-ignore
|
|
44
39
|
events.change && events.change({ value: values });
|
|
@@ -5,7 +5,6 @@ import SelectContainer from './SelectContainer';
|
|
|
5
5
|
|
|
6
6
|
import { multipleProps } from './props/defaultProps';
|
|
7
7
|
import { propTypes } from './props/propsTypes';
|
|
8
|
-
import useOptions from './hooks';
|
|
9
8
|
|
|
10
9
|
const { useState, useEffect } = React;
|
|
11
10
|
|
|
@@ -42,13 +41,10 @@ const NormalSelect = ({
|
|
|
42
41
|
virtual,
|
|
43
42
|
searchable,
|
|
44
43
|
size,
|
|
44
|
+
options,
|
|
45
45
|
// 业务属性
|
|
46
|
-
enumType,
|
|
47
|
-
customEnum,
|
|
48
|
-
optionId,
|
|
49
46
|
isModelApp,
|
|
50
47
|
}) => {
|
|
51
|
-
const options = useOptions({ enumType, optionId, customEnum });
|
|
52
48
|
const [selectedValue, setSelectedValue] = useValue(value);
|
|
53
49
|
|
|
54
50
|
const onSelectChange = (value) => {
|
package/src/web/utils/tcb.js
CHANGED
|
@@ -35,11 +35,3 @@ export async function getTempFileURL(data) {
|
|
|
35
35
|
return await window?.app?.cloud?.getTempFileURL(data);
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
export async function getDescribeGeneralOptionsDetailList(params) {
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
const callWedaApi = window?.app?.cloud?.callWedaApi;
|
|
42
|
-
if (callWedaApi) {
|
|
43
|
-
return await callWedaApi(params);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
import { getDescribeGeneralOptionsDetailList } from '../../../../utils/tcb';
|
|
3
|
-
|
|
4
|
-
const GENERAL_OPTION = 'general-option';
|
|
5
|
-
const CUSTOM = 'custom';
|
|
6
|
-
|
|
7
|
-
const handleOptionsDetailList = (response) => {
|
|
8
|
-
const config = response?.Data?.Config ?? '[]';
|
|
9
|
-
return JSON.parse(config)?.map((item) => ({
|
|
10
|
-
value: item?.key,
|
|
11
|
-
text: item?.value,
|
|
12
|
-
}));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export default function useOptions({ enumType, optionId, customEnum }) {
|
|
16
|
-
const [options, setOptions] = useState([]);
|
|
17
|
-
const isCustom = enumType === CUSTOM;
|
|
18
|
-
const isGeneralOption = enumType === GENERAL_OPTION;
|
|
19
|
-
|
|
20
|
-
const getOptionsDetailList = async (optionId) => {
|
|
21
|
-
try {
|
|
22
|
-
const response = await getDescribeGeneralOptionsDetailList({
|
|
23
|
-
methodName: 'callDesignApi',
|
|
24
|
-
params: {
|
|
25
|
-
action: 'DescribeGeneralOptionsDetail',
|
|
26
|
-
data: {
|
|
27
|
-
Id: optionId,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
const options = handleOptionsDetailList(response);
|
|
32
|
-
setOptions(options);
|
|
33
|
-
} catch (error) {
|
|
34
|
-
setOptions([]);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (optionId && isGeneralOption) {
|
|
40
|
-
getOptionsDetailList(optionId);
|
|
41
|
-
}
|
|
42
|
-
}, [optionId, isGeneralOption]);
|
|
43
|
-
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
setOptions(customEnum);
|
|
46
|
-
}, [isCustom]);
|
|
47
|
-
|
|
48
|
-
return options;
|
|
49
|
-
}
|