File tree Expand file tree Collapse file tree 5 files changed +17
-1
lines changed
packages/chrome-devtools/src Expand file tree Collapse file tree 5 files changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @module-federation/devtools ' : patch
3
+ ---
4
+
5
+ feat(chrome-devtools): add option customValueValidate for form component
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ const App = (props: RootComponentProps) => {
17
17
getVersion,
18
18
handleSnapshot,
19
19
handleProxyAddress,
20
+ customValueValidate,
20
21
} = props ;
21
22
const [ module , setModule ] = useState ( window . __FEDERATION__ ?. moduleInfo || { } ) ;
22
23
@@ -37,6 +38,7 @@ const App = (props: RootComponentProps) => {
37
38
getVersion = { getVersion }
38
39
handleSnapshot = { handleSnapshot }
39
40
handleProxyAddress = { handleProxyAddress }
41
+ customValueValidate = { customValueValidate }
40
42
/>
41
43
) : (
42
44
< Empty description = { 'No ModuleInfo Detected' } />
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ const FormComponent = (props: FormProps & RootComponentProps) => {
58
58
versionList,
59
59
setVersionList,
60
60
getVersion,
61
+ customValueValidate,
61
62
} = props ;
62
63
const { moduleInfo } = window . __FEDERATION__ ;
63
64
let { producer } = separateType ( moduleInfo ) ;
@@ -145,7 +146,12 @@ const FormComponent = (props: FormProps & RootComponentProps) => {
145
146
} ;
146
147
}
147
148
148
- if ( validateCustom ( value ) || validateSemver ( value ) || validatePort ( value ) ) {
149
+ if (
150
+ validateCustom ( value ) ||
151
+ validateSemver ( value ) ||
152
+ validatePort ( value ) ||
153
+ customValueValidate ?.( value )
154
+ ) {
149
155
statusSet [ index ] . valueStatus = true ;
150
156
flushSync ( ( ) => setFormStatus ( statusSet ) ) ;
151
157
return callback ( ) ;
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ const Layout = (
50
50
setVersionList,
51
51
getVersion,
52
52
handleProxyAddress,
53
+ customValueValidate,
53
54
} = props ;
54
55
const { producer } = separateType ( moduleInfo ) ;
55
56
const [ condition , setCondition ] = useState ( statusInfo . processing ) ;
@@ -209,6 +210,7 @@ const Layout = (
209
210
versionList = { versionList }
210
211
setVersionList = { setVersionList }
211
212
getVersion = { getVersion }
213
+ customValueValidate = { customValueValidate }
212
214
/>
213
215
</ Form >
214
216
Original file line number Diff line number Diff line change @@ -13,4 +13,5 @@ export interface RootComponentProps {
13
13
setVersionList ?: React . Dispatch < React . SetStateAction < Array < Array < string > > > > ;
14
14
getVersion ?: ( moduleName : string ) => Promise < Array < string > > ;
15
15
handleProxyAddress ?: ( address : string ) => string ;
16
+ customValueValidate ?: ( schema : string ) => boolean ;
16
17
}
You can’t perform that action at this time.
0 commit comments