Skip to content

Commit f4d633a

Browse files
author
nobo
committed
v0.1
1 parent 673cb16 commit f4d633a

File tree

173 files changed

+2262
-15420
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+2262
-15420
lines changed

README.md

Lines changed: 30 additions & 2 deletions
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/components/FormField/MultipleInputField.js renamed to demo/components/FormField/MultipleInputField.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ export default class MultipleInputField extends React.Component {
8585
/>
8686
</div>
8787
<div className="multi-input-tools">
88-
<Icon type="add" onClick={this.onAddItem.bind(this, i)} />
89-
<Icon type="remove" onClick={this.onRemoveItem.bind(this, i)} />
88+
<Icon type="add" onClick={this.onAddItem.bind(this, i)}>+</Icon>
89+
<Icon type="remove" onClick={this.onRemoveItem.bind(this, i)}>-</Icon>
9090
</div>
9191
</div>
9292
);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

demo/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import ReactDOM from 'react-dom';
33

44
import FormDesigner from '../src';
55

6+
import widgets from './widgets';
7+
68
import '../src/style';
79

810
function App() {
@@ -16,7 +18,11 @@ function App() {
1618
width: 1400,
1719
minHeight: 500
1820
}}>
19-
<FormDesigner metadata={metadata} onChange={onMetadataChange} />
21+
<FormDesigner
22+
widgets={widgets}
23+
metadata={metadata}
24+
onChange={onMetadataChange}
25+
/>
2026
</div>
2127
);
2228
}
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
export function uuid() {
22
return Math.random().toString(16).slice(2, 8);
33
}
4-
5-
export function isWidget(widget) {
6-
return !!widget.$$widget;
7-
}

src/widgets2/PropertyForm.js renamed to demo/widgets/PropertyForm.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
FormItem,
55
NativeField,
66
} from 'components/Form';
7+
78
import 'components/Form/style/index.scss';
89

910
export default class PropertyPanel extends React.Component {

src/widgets/components/SelectField/PropertyPanel.js renamed to demo/widgets/SelectField/PropertyPanel.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@ import {
33
FormItem,
44
NativeField,
55
} from 'components/Form';
6-
import 'components/Form/style/index.scss';
76
import {
87
MultipleInputField,
9-
DisplayField,
10-
WidthInputField
118
} from 'components/FormField';
129

10+
import PropertyForm from '../PropertyForm';
11+
1312
import CommonPropertyPanel from '../common/CommonPropertyPanel';
1413
import ValidatePropertyPanel from '../common/ValidatePropertyPanel';
1514

16-
export default function () {
15+
export default function (props) {
1716

1817
return (
19-
<div>
18+
<PropertyForm {...props}>
2019
<CommonPropertyPanel />
2120
<FormItem
2221
className="design-property-field"
@@ -26,6 +25,6 @@ export default function () {
2625
<MultipleInputField />
2726
</FormItem>
2827
<ValidatePropertyPanel />
29-
</div>
28+
</PropertyForm>
3029
);
3130
}

demo/widgets/SelectField/index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import PropertyPanel from './PropertyPanel';
2+
3+
import data from '../common/data';
4+
import icon from './icon.png';
5+
6+
const XType = 'EX_SELECT_FIELD';
7+
const Title = '单选列表';
8+
9+
export default {
10+
xtype: XType,
11+
title: Title,
12+
icon: icon,
13+
WidgetProperty: PropertyPanel,
14+
15+
data() {
16+
return {
17+
...data(),
18+
xtype: XType,
19+
title: Title,
20+
data: [
21+
{
22+
value: '选项1',
23+
label: '选项1',
24+
},
25+
{
26+
value: '选项2',
27+
label: '选项2',
28+
},
29+
{
30+
value: '选项3',
31+
label: '选项3',
32+
}
33+
]
34+
}
35+
}
36+
};
File renamed without changes.

src/widgets2/TextareaField/PropertyPanel.js renamed to demo/widgets/TextareaField/PropertyPanel.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,16 @@ import {
33
FormItem,
44
NativeField,
55
} from 'components/Form';
6-
import 'components/Form/style/index.scss';
7-
import {
8-
MultipleInputField,
9-
DisplayField,
10-
WidthInputField
11-
} from 'components/FormField';
6+
7+
import PropertyForm from '../PropertyForm';
128

139
import CommonPropertyPanel from '../common/CommonPropertyPanel';
1410
import ValidatePropertyPanel from '../common/ValidatePropertyPanel';
1511

16-
export default function () {
12+
export default function (props) {
1713

1814
return (
19-
<div>
15+
<PropertyForm {...props}>
2016
<CommonPropertyPanel />
2117
<FormItem
2218
className="design-property-field"
@@ -28,6 +24,6 @@ export default function () {
2824
/>
2925
</FormItem>
3026
<ValidatePropertyPanel />
31-
</div>
27+
</PropertyForm>
3228
);
3329
}

demo/widgets/TextareaField/index.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import PropertyPanel from './PropertyPanel';
2+
3+
import data from '../common/data';
4+
import icon from './icon.png';
5+
6+
const XType = 'EX_TEXTAREA_FIELD';
7+
const Title = '多行文本';
8+
9+
export default {
10+
xtype: "EX_TEXTAREA_FIELD",
11+
title: "多行文本",
12+
icon: icon,
13+
WidgetProperty: PropertyPanel,
14+
15+
data() {
16+
return {
17+
...data(),
18+
xtype: XType,
19+
title: Title,
20+
height: '70'
21+
}
22+
}
23+
};
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import React from 'react';
2+
import PropertyForm from '../PropertyForm';
3+
4+
import CommonPropertyPanel from '../common/CommonPropertyPanel';
5+
import ValidatePropertyPanel from '../common/ValidatePropertyPanel';
6+
7+
export default function (props) {
8+
9+
return (
10+
<PropertyForm {...props}>
11+
<CommonPropertyPanel />
12+
<ValidatePropertyPanel />
13+
</PropertyForm>
14+
);
15+
}

demo/widgets/URLField/index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import data from '../common/data';
2+
import PropertyPanel from './PropertyPanel';
3+
import icon from './icon.png';
4+
5+
const XType = 'EX_TEXT_FIELD';
6+
const Title = '文本';
7+
8+
export default {
9+
xtype: "EX_URL_FIELD",
10+
title: "URL",
11+
icon: icon,
12+
WidgetProperty: PropertyPanel,
13+
14+
data() {
15+
return {
16+
...data(),
17+
xtype: XType,
18+
title: Title,
19+
}
20+
}
21+
};
File renamed without changes.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import TextField from './TextField';
2-
// import TextareaField from './TextareaField';
3-
// import SelectField from './SelectField';
2+
import TextareaField from './TextareaField';
3+
import SelectField from './SelectField';
44
// import MultiSelectField from './MultiSelectField';
55
// import NumberField from './NumberField';
66
// import DateField from './DateField';
7-
// import URLField from './URLField';
7+
import URLField from './URLField';
88
// import FileField from './FileField';
99

1010
export default [
1111
TextField,
12-
// TextareaField,
13-
// SelectField,
12+
TextareaField,
13+
SelectField,
1414
// MultiSelectField,
1515
// NumberField,
1616
// DateField,
17-
// URLField,
17+
URLField,
1818
// FileField,
1919
];
File renamed without changes.

0 commit comments

Comments
 (0)