|
|
@@ -3,7 +3,7 @@ import { LoadingOutlined, WarningOutlined } from "@ant-design/icons";
|
|
|
|
|
|
import WbwFactors from "./WbwFactors";
|
|
|
import { IWbw, TWbwDisplayMode } from "./WbwWord";
|
|
|
-import { IPreferenceResponse } from "../../dict/DictPreferenceEditor";
|
|
|
+import { IPreferenceResponse } from "../../api/Dict";
|
|
|
|
|
|
interface IWidget {
|
|
|
initValue: IWbw;
|
|
|
@@ -11,19 +11,18 @@ interface IWidget {
|
|
|
onChange?: (key: string) => Promise<IPreferenceResponse>;
|
|
|
}
|
|
|
const WbwFactorsEditor = ({ initValue, display, onChange }: IWidget) => {
|
|
|
- const [value, setValue] = useState(initValue);
|
|
|
const [loading, setLoading] = useState(false);
|
|
|
const [error, setError] = useState(false);
|
|
|
+
|
|
|
return (
|
|
|
<>
|
|
|
{loading ? <LoadingOutlined /> : error ? <WarningOutlined /> : <></>}
|
|
|
<WbwFactors
|
|
|
key="factors"
|
|
|
- data={value}
|
|
|
+ data={initValue}
|
|
|
display={display}
|
|
|
onChange={async (e: string) => {
|
|
|
console.log("factor change", e);
|
|
|
- setValue({ ...value, factors: { value: e, status: 5 } });
|
|
|
if (onChange) {
|
|
|
setLoading(true);
|
|
|
setError(false);
|