-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(form): add published version of fields
- Adds published version of some fields - Uses the default version with disabled=true for the rest - FormuleForm now shows the preview version by default - FormuleForm can show the editable version with isEditable=true - Updates the README with related information and adds new badges - Reorganizes the current fields and widgets in base/published folders - Adds a toggle to switch between editable and published in the demo - Now shows form data in the schema json viewer modal
- Loading branch information
Showing
44 changed files
with
307 additions
and
167 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { useContext } from "react"; | ||
import Form from "../../forms/Form"; | ||
import { shoudDisplayGuideLinePopUp } from "../utils"; | ||
import { Row, Empty, Space, Typography } from "antd"; | ||
import { useSelector } from "react-redux"; | ||
import CustomizationContext from "../../contexts/CustomizationContext"; | ||
|
||
const EditablePreview = ({ hideTitle, liveValidate }) => { | ||
const schema = useSelector((state) => state.schemaWizard.current.schema); | ||
const uiSchema = useSelector((state) => state.schemaWizard.current.uiSchema); | ||
const formData = useSelector((state) => state.schemaWizard.formData); | ||
|
||
const customizationContext = useContext(CustomizationContext); | ||
|
||
return ( | ||
<> | ||
{!hideTitle && ( | ||
<Typography.Title | ||
level={4} | ||
style={{ textAlign: "center", margin: "15px 0" }} | ||
> | ||
Editable Preview | ||
</Typography.Title> | ||
)} | ||
{shoudDisplayGuideLinePopUp(schema) ? ( | ||
<Row | ||
justify="center" | ||
align="middle" | ||
style={{ height: "100%", flex: 1 }} | ||
> | ||
<Empty | ||
image={Empty.PRESENTED_IMAGE_SIMPLE} | ||
description={ | ||
<Space direction="vertical"> | ||
<Typography.Title level={5}> | ||
Your form is empty | ||
</Typography.Title> | ||
<Typography.Text type="secondary"> | ||
Add fields to the drop area to initialize your form | ||
</Typography.Text> | ||
</Space> | ||
} | ||
/> | ||
</Row> | ||
) : ( | ||
<Form | ||
schema={customizationContext.transformSchema(schema)} | ||
uiSchema={uiSchema} | ||
formData={formData || {}} | ||
onChange={() => {}} | ||
liveValidate={liveValidate} | ||
/> | ||
)} | ||
</> | ||
); | ||
}; | ||
|
||
export default EditablePreview; |
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 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.
Oops, something went wrong.