-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support chagne the ui form to yaml editor #172
Conversation
1c7a300
to
9d34088
Compare
const slug = slugify(cssText); | ||
|
||
const cssFilename = path | ||
.normalize(`${id.replace(/\.[jt]sx?$/, '')}_${slug}.${extension}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改 linaria vite 插件以支持使用 scss 变量
}, [schema, editorOptions?.isGenerateAnnotations, initialValues, schemas, useResourceResult.resource?.name, editorErrors, action, fold]); | ||
}, [schema, editorOptions?.isGenerateAnnotations, initialValues, schemas, useResourceResult.resource?.name, editorErrors, action, finalErrors, fold]); | ||
|
||
React.useEffect(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段逻辑或许可以放在onMutationError里?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
const action = useMemo( | ||
() => actionFromProps || useResourceResult.action, | ||
[actionFromProps, useResourceResult.action] | ||
); | ||
const initialValues = useMemo(() => { | ||
const initialValues = | ||
(queryResult?.data?.data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的逻辑是不是应该改成通过action判断?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已加上 action 的判断
9d34088
to
054d418
Compare
支持表单模式转换为 YAML 编辑模式。
表单 -> YAML
将表单当前值作为初始值赋给 YAML 编辑器,并在提交时进行 YAML 格式、Schema 和自定义逻辑校验。
YAML -> 表单
会提示转换为表单后 YAML 编辑器所填内容会丢失,转换后会回到之前表单所填写的值。
主要代码在 useYamlForm。