-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: removed unwanted multi language code
- Loading branch information
Showing
8 changed files
with
79 additions
and
131 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { memo } from "react"; | ||
import { RJSFSchema, UiSchema } from "@rjsf/utils"; | ||
import { includes } from "lodash"; | ||
import { getBlockJSONFromSchemas, getBlockJSONFromUISchemas } from "../../functions/Controls.ts"; | ||
import RjForm from "@rjsf/core"; | ||
import { BindingWidget } from "../../../ui/widgets/rjsf/widgets/binding.tsx"; | ||
import { IconPickerField, ImagePickerField, LinkField, RTEField } from "../../../ui"; | ||
import validator from "@rjsf/validator-ajv8"; | ||
|
||
type JSONFormType = { | ||
formData: any; | ||
properties: any; | ||
createHistorySnapshot: () => void; | ||
onChange: ({ formData }: any, key?: string) => void; | ||
}; | ||
/** | ||
* | ||
* @param param0 | ||
* @returns JSONForm for Static and name fields | ||
*/ | ||
export const JSONForm = memo(({ createHistorySnapshot, properties, formData, onChange }: JSONFormType) => { | ||
const propsSchema: RJSFSchema = { type: "object", properties: {} }; | ||
const uiSchema: UiSchema = {}; | ||
|
||
Object.keys(properties).forEach((key) => { | ||
const control = properties[key]; | ||
if (includes(["slot", "styles"], control.type)) return; | ||
const propKey = key; | ||
propsSchema.properties[propKey] = getBlockJSONFromSchemas(control); | ||
uiSchema[propKey] = getBlockJSONFromUISchemas(control); | ||
}); | ||
|
||
return ( | ||
<RjForm | ||
widgets={{ | ||
binding: BindingWidget, | ||
richtext: RTEField, | ||
icon: IconPickerField, | ||
image: ImagePickerField, | ||
}} | ||
fields={{ link: LinkField }} | ||
idSeparator="." | ||
autoComplete="off" | ||
omitExtraData={false} | ||
liveOmit={false} | ||
liveValidate | ||
validator={validator} | ||
uiSchema={uiSchema} | ||
onBlur={createHistorySnapshot} | ||
schema={propsSchema} | ||
formData={formData} | ||
onChange={onChange} | ||
/> | ||
); | ||
}); |
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.