Skip to content

Commit 1402fcc

Browse files
authored
Merge pull request #1409 from alibaba/feat-mobile
feat: 增加 fr-mobile form.item layout setting
2 parents b6c94b4 + 5bb0bbe commit 1402fcc

3 files changed

Lines changed: 15 additions & 8 deletions

File tree

packages/form-render-mobile/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# 更新日志
22

3-
3+
### 1.0.13
4+
- [+] 增加输入控件单独配置布局 layout = 'row' | 'column'
5+
- [+] 补齐 tooltip 字段,与 PC 端保持一致
6+
- [!] 修复 title 不存在时,校验信息不提示
47
### 1.0.5
58
- [+] 增加 form.getFieldRef API,自定义组件可以暴露实例,供 getFieldRef 使用
69
### 1.0.0

packages/form-render-mobile/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "form-render-mobile",
3-
"version": "1.0.12",
3+
"version": "1.0.13",
44
"description": "通过 JSON Schema 生成标准 Form,常用于自定义搭建配置界面生成",
55
"keywords": [
66
"Form",

packages/form-render-mobile/src/render-core/FieldItem/main.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default (props: any) => {
3636
const configCtx = useContext(ConfigContext);
3737

3838
const { form, widgets, methods, globalProps }: any = configCtx;
39-
const { hidden, properties, dependencies, inlineMode: _inlineMode, remove, removeText, visible = true, ...otherSchema } = schema;
39+
const { hidden, properties, dependencies, inlineMode: _inlineMode, remove, removeText, visible = true, layout, ...otherSchema } = schema;
4040
const getValueFromKey = getParamValue(formCtx, upperCtx, schema);
4141

4242
useEffect(() => {
@@ -105,6 +105,7 @@ export default (props: any) => {
105105

106106
const extra = getExtraView('extra', schema, widgets);
107107
const help = getExtraView('help', schema, widgets);
108+
const tooltip = getExtraView('tooltip', schema, widgets);
108109
const ruleList = getRuleList(schema, form, methods);
109110
const readOnly = getValueFromKey('readOnly');
110111
const valuePropName = schema.valuePropName || valuePropNameMap[schema.widget] || undefined;
@@ -113,10 +114,6 @@ export default (props: any) => {
113114
fieldProps.readOnly = readOnly;
114115
}
115116

116-
if (!label) {
117-
noStyle = true;
118-
}
119-
120117
if (readOnly) {
121118
Widget = getWidget(widgets, schema.readOnlyWidget, schema, true);
122119
}
@@ -128,7 +125,7 @@ export default (props: any) => {
128125
valuePropName,
129126
hidden,
130127
extra,
131-
help,
128+
help: tooltip || help,
132129
noStyle,
133130
dependencies,
134131
name: path,
@@ -137,6 +134,13 @@ export default (props: any) => {
137134
className:classnames('fr-field', {'fr-field-visibility': !visible})
138135
};
139136

137+
if (layout) {
138+
itemProps.layout = {
139+
column: 'vertical',
140+
row: 'horizontal',
141+
}[layout];
142+
}
143+
140144
if (!readOnly && needOnClick) {
141145
itemProps.onClick = () => {
142146
fieldRef.current.open();

0 commit comments

Comments
 (0)