Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate react json schema plugins; migrate mui
FormGroup
;
- Loading branch information
1 parent
f59a465
commit 05328af
Showing
15 changed files
with
252 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react' | ||
|
||
export const useToggle = () => { | ||
const [toggles, setToggle] = React.useState<{ [k: string]: boolean }>({}) | ||
|
||
const toggleDummy = React.useCallback((id: string) => { | ||
setToggle((toggles) => ({ | ||
...toggles, | ||
[id]: !toggles[id], | ||
})) | ||
}, []) | ||
const isSet = (id: string) => { | ||
return Boolean(toggles[id]) | ||
} | ||
|
||
return [toggleDummy, isSet] as [typeof toggleDummy, typeof isSet] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
packages/ds-material/src/WidgetsDefault/plugins/plugins.ts
This file was deleted.
Oops, something went wrong.
12 changes: 6 additions & 6 deletions
12
packages/uis-react-json-schema/src/CombiningHandler/CombiningHandler.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import React from 'react' | ||
import { getNextPlugin, WidgetPluginProps } from '@ui-schema/react/WidgetEngine' | ||
import { useSchemaCombine } from '@ui-schema/react-json-schema/CombiningHandler' | ||
import { WithValue } from '@ui-schema/react/UIStore' | ||
import { WidgetProps } from '@ui-schema/react/Widgets' | ||
import { DecoratorPropsNext } from '@tactic-ui/react/Deco' | ||
|
||
export const CombiningHandler: React.FC<WidgetPluginProps & Partial<WithValue>> = (props) => { | ||
const {schema: baseSchema, value, currentPluginIndex} = props | ||
export const CombiningHandler = <P extends WidgetProps & DecoratorPropsNext & WithValue>(props: P): React.ReactElement<P> => { | ||
const {schema: baseSchema, value} = props | ||
const schema = useSchemaCombine(baseSchema, value) | ||
const next = currentPluginIndex + 1 | ||
const Plugin = getNextPlugin(next, props.widgets) | ||
return <Plugin {...props} currentPluginIndex={next} schema={schema}/> | ||
const Next = props.next(props.decoIndex + 1) | ||
return <Next {...props} decoIndex={props.decoIndex + 1} schema={schema}/> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.