@hw-component/form 0.0.1-beta-v3 → 0.0.1-beta-v5
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/es/ModalForm/hooks.d.ts +1 -1
- package/es/config.js +4 -4
- package/es/index.css +1 -1
- package/lib/ModalForm/hooks.d.ts +1 -1
- package/lib/config.js +4 -4
- package/lib/index.css +1 -1
- package/package.json +1 -1
- package/src/components/Form/index.less +1 -1
- package/src/components/ModalForm/hooks.ts +5 -5
- package/src/components/ModalForm/index.tsx +7 -7
- package/src/components/ModalForm/modal.ts +2 -2
- package/src/components/config.ts +4 -4
package/es/ModalForm/hooks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HModalFormInstance, ModifyPropsModal } from "@/components/ModalForm/modal";
|
|
3
|
-
export declare const useModifyProps: ({ visible, configData, initialValues, modalForm }: ModifyPropsModal) => {
|
|
3
|
+
export declare const useModifyProps: ({ visible, configData, initialValues, modalForm, }: ModifyPropsModal) => {
|
|
4
4
|
modalFormData: import("../Form/modal").HItemProps[];
|
|
5
5
|
modalVisible: boolean | undefined;
|
|
6
6
|
setModalVisible: import("react").Dispatch<import("react").SetStateAction<boolean | undefined>>;
|
package/es/config.js
CHANGED
|
@@ -10,12 +10,12 @@ var baseConfig = {
|
|
|
10
10
|
value: "value"
|
|
11
11
|
},
|
|
12
12
|
valueCheckMap: {
|
|
13
|
-
checked:
|
|
14
|
-
noChecked:
|
|
13
|
+
checked: 1,
|
|
14
|
+
noChecked: 0
|
|
15
15
|
},
|
|
16
16
|
valueSwitchMap: {
|
|
17
|
-
open:
|
|
18
|
-
close:
|
|
17
|
+
open: 1,
|
|
18
|
+
close: 0
|
|
19
19
|
},
|
|
20
20
|
valueRangePickerValueMap: {
|
|
21
21
|
start: function start(name) {
|
package/es/index.css
CHANGED
package/lib/ModalForm/hooks.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { HModalFormInstance, ModifyPropsModal } from "@/components/ModalForm/modal";
|
|
3
|
-
export declare const useModifyProps: ({ visible, configData, initialValues, modalForm }: ModifyPropsModal) => {
|
|
3
|
+
export declare const useModifyProps: ({ visible, configData, initialValues, modalForm, }: ModifyPropsModal) => {
|
|
4
4
|
modalFormData: import("../Form/modal").HItemProps[];
|
|
5
5
|
modalVisible: boolean | undefined;
|
|
6
6
|
setModalVisible: import("react").Dispatch<import("react").SetStateAction<boolean | undefined>>;
|
package/lib/config.js
CHANGED
|
@@ -11,12 +11,12 @@ var baseConfig = {
|
|
|
11
11
|
value: "value"
|
|
12
12
|
},
|
|
13
13
|
valueCheckMap: {
|
|
14
|
-
checked:
|
|
15
|
-
noChecked:
|
|
14
|
+
checked: 1,
|
|
15
|
+
noChecked: 0
|
|
16
16
|
},
|
|
17
17
|
valueSwitchMap: {
|
|
18
|
-
open:
|
|
19
|
-
close:
|
|
18
|
+
open: 1,
|
|
19
|
+
close: 0
|
|
20
20
|
},
|
|
21
21
|
valueRangePickerValueMap: {
|
|
22
22
|
start: function start(name) {
|
package/lib/index.css
CHANGED
package/package.json
CHANGED
|
@@ -2,14 +2,14 @@ import { useEffect, useMemo, useState } from "react";
|
|
|
2
2
|
import useHForm from "../Form/hooks/useHForm";
|
|
3
3
|
import type {
|
|
4
4
|
HModalFormInstance,
|
|
5
|
-
ModifyPropsModal
|
|
5
|
+
ModifyPropsModal,
|
|
6
6
|
} from "@/components/ModalForm/modal";
|
|
7
7
|
|
|
8
8
|
export const useModifyProps = ({
|
|
9
9
|
visible,
|
|
10
10
|
configData,
|
|
11
11
|
initialValues,
|
|
12
|
-
modalForm
|
|
12
|
+
modalForm,
|
|
13
13
|
}: ModifyPropsModal) => {
|
|
14
14
|
const [modalVisible, setModalVisible] = useState(visible);
|
|
15
15
|
const [modalFormData, setModalFormData] = useState(configData);
|
|
@@ -22,9 +22,9 @@ export const useModifyProps = ({
|
|
|
22
22
|
}, [configData]);
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
modalForm.show = ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
configData: changeConfigData,
|
|
26
|
+
initialValues: changeInitialValues,
|
|
27
|
+
}) => {
|
|
28
28
|
if (!!changeConfigData) {
|
|
29
29
|
setModalFormData(changeConfigData);
|
|
30
30
|
}
|
|
@@ -2,7 +2,6 @@ import { Modal } from "antd";
|
|
|
2
2
|
import type { ModalFormProps } from "@/components/ModalForm/modal";
|
|
3
3
|
import HForm from "../Form";
|
|
4
4
|
import { useCurrentForm, useModifyProps } from "./hooks";
|
|
5
|
-
import { useEffect } from "react";
|
|
6
5
|
export default ({
|
|
7
6
|
visible,
|
|
8
7
|
title,
|
|
@@ -16,12 +15,13 @@ export default ({
|
|
|
16
15
|
...props
|
|
17
16
|
}: ModalFormProps) => {
|
|
18
17
|
const currentForm = useCurrentForm(modalForm);
|
|
19
|
-
const {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
const { modalVisible, modalFormData, setModalVisible, initValue } =
|
|
19
|
+
useModifyProps({
|
|
20
|
+
configData,
|
|
21
|
+
visible,
|
|
22
|
+
initialValues,
|
|
23
|
+
modalForm: currentForm,
|
|
24
|
+
});
|
|
25
25
|
const cancel = (e) => {
|
|
26
26
|
if (onCancel) {
|
|
27
27
|
return onCancel?.(e);
|
|
@@ -8,9 +8,9 @@ export interface ModifyPropsModal {
|
|
|
8
8
|
configData: HItemProps[];
|
|
9
9
|
visible?: boolean;
|
|
10
10
|
initialValues?: Record<string, any>;
|
|
11
|
-
modalForm:HModalFormInstance
|
|
11
|
+
modalForm: HModalFormInstance;
|
|
12
12
|
}
|
|
13
|
-
export interface ShowParamsModal{
|
|
13
|
+
export interface ShowParamsModal {
|
|
14
14
|
configData?: HItemProps[];
|
|
15
15
|
visible?: boolean;
|
|
16
16
|
initialValues?: Record<string, any>;
|
package/src/components/config.ts
CHANGED
|
@@ -7,12 +7,12 @@ export const baseConfig: IFormConfigContextProps = {
|
|
|
7
7
|
value: "value",
|
|
8
8
|
},
|
|
9
9
|
valueCheckMap: {
|
|
10
|
-
checked:
|
|
11
|
-
noChecked:
|
|
10
|
+
checked: 1,
|
|
11
|
+
noChecked:0,
|
|
12
12
|
},
|
|
13
13
|
valueSwitchMap: {
|
|
14
|
-
open:
|
|
15
|
-
close:
|
|
14
|
+
open: 1,
|
|
15
|
+
close: 0,
|
|
16
16
|
},
|
|
17
17
|
valueRangePickerValueMap: {
|
|
18
18
|
start: (name) => {
|