forked from alibaba/x-render
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(generator): v2.7.8 (alibaba#726)
* fix(generator): 属性配置表单 * chore(generator): v2.7.6 * feat(generator): 获取配置表单实例 * chore(generator): v2.7.7 * docs(generator): 调整文档布局 * fix: alibaba#703 文本域指定高度 * feat(generator): 支持复杂类型默认值配置 close alibaba#682 * chore(generator): v2.7.8
- Loading branch information
Showing
10 changed files
with
131 additions
and
47 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,29 @@ | ||
--- | ||
order: 3 | ||
title: 案例演示 | ||
toc: menu | ||
--- | ||
|
||
### 浮窗接入 | ||
|
||
用于 schema 的可视化修改 | ||
|
||
<code src='./demo/modal.jsx' /> | ||
|
||
### 侧栏配置 | ||
|
||
使用 settings/commonSettings 自由配置左右侧栏内容,并使用 widgets 注入和使用自定义组件 | ||
|
||
“计数器”是自定义组件。 | ||
|
||
<code src='./demo/settings.jsx' /> | ||
|
||
### 自定义布局 | ||
|
||
<code src='./demo/layout.jsx' /> | ||
|
||
### Schema 互转 | ||
|
||
使用 `transformer` 这个 props,进行 schema 的互转 | ||
|
||
<code src='./demo/transformer.jsx' /> |
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,9 @@ | ||
--- | ||
order: 4 | ||
title: 常见问题 | ||
toc: content | ||
--- | ||
|
||
**1、如何控制编辑器高度** | ||
|
||
给组件外层要包裹的 div 设置高度即可,否则为默认值 min-height: 30vh |
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
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,11 @@ | ||
import idInput from './idInput'; | ||
import htmlInput from './htmlInput'; | ||
import jsonInput from './jsonInput'; | ||
import percentSlider from './percentSlider'; | ||
|
||
export { | ||
idInput, | ||
htmlInput, | ||
jsonInput, | ||
percentSlider, | ||
} |
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,29 @@ | ||
import React from 'react'; | ||
import { Input } from 'antd'; | ||
|
||
export default function jsonInput({ | ||
onChange, | ||
value, | ||
disabled, | ||
readonly, | ||
options, | ||
}) { | ||
const handleChange = e => { | ||
try { | ||
onChange(JSON.parse(e.target.value)); | ||
} catch { | ||
onChange(e.target.value); | ||
} | ||
}; | ||
|
||
const inputValue = typeof value === 'string' ? value : JSON.stringify(value) | ||
|
||
return ( | ||
<Input | ||
disabled={disabled || readonly} | ||
{...options} | ||
onChange={handleChange} | ||
value={inputValue} | ||
/> | ||
); | ||
} |