Skip to content

Commit 20983f2

Browse files
committed
Add in test GRID template
1 parent ce4ba1c commit 20983f2

File tree

3 files changed

+87
-26
lines changed

3 files changed

+87
-26
lines changed

examples/data/grid.json

Lines changed: 74 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,33 @@
33
"type": "object",
44
"title": "Comment",
55
"properties": {
6-
"name": {
6+
"firstname": {
77
"title": "Name",
88
"type": "string"
99
},
10+
"lastname": {
11+
"title": "Surname",
12+
"type": "string"
13+
},
14+
"address_line_1": {
15+
"title": "Address",
16+
"type": "string"
17+
},
18+
"address_line_2": {
19+
"type": "string"
20+
},
21+
"city": {
22+
"type": "string"
23+
},
24+
"state": {
25+
"type": "string",
26+
"enum": ["VIC","NSW","QLD","WA","SA","TAS","ACT","NT"]
27+
},
28+
"postcode": {
29+
"type": "integer",
30+
"minimum":1000,
31+
"maximum":9999
32+
},
1033
"email": {
1134
"title": "Email",
1235
"type": "string",
@@ -25,20 +48,64 @@
2548
"form": [
2649
{
2750
"type": "help",
28-
"helpvalue": "<div class=\"alert alert-info\">Grid it up with bootstrap</div>"
51+
"helpvalue": "<div class=\"alert alert-info\">Grid it up with FLEX</div>"
2952
},
3053
{
3154
"type": "section",
32-
"htmlClass": "row",
55+
"grid": {
56+
"layout": "column"
57+
},
3358
"items": [
3459
{
3560
"type": "section",
36-
"htmlClass": "col-xs-6",
37-
"items": ["name"]
61+
"grid": {
62+
"layout": "row"
63+
},
64+
"items": [
65+
{
66+
"key": "firstname",
67+
"grid": { "flex": 50, "layout": "column" }
68+
},
69+
{
70+
"key": "lastname",
71+
"grid": { "flex": 50, "layout": "column" }
72+
}
73+
]
74+
},
75+
{
76+
"key": "address_line_1",
77+
"grid": { "flex": 100, "layout": "row" }
78+
},
79+
{
80+
"key": "address_line_2",
81+
"grid": { "flex": 100, "layout": "row" }
82+
},
83+
{
84+
"type": "section",
85+
"grid": {
86+
"layout": "row"
87+
},
88+
"items": [
89+
{
90+
"key": "city",
91+
"grid": { "flex": 50, "layout": "column" }
92+
},
93+
{
94+
"key": "state",
95+
"type":"select",
96+
"grid": { "state": 25, "layout": "column" }
97+
},
98+
{
99+
"key": "postcode",
100+
"grid": { "postcode": 25, "layout": "column" }
101+
}
102+
]
38103
},
39104
{
40105
"type": "section",
41-
"htmlClass": "col-xs-6",
106+
"grid": {
107+
"layout": "row"
108+
},
42109
"items": ["email"]
43110
}
44111
]
@@ -50,7 +117,7 @@
50117
},
51118
{
52119
"type": "submit",
53-
"style": "btn-info",
120+
"style": "btn-info",
54121
"title": "OK"
55122
}
56123
]

examples/material-example.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,12 @@ <h3>Schema</h3>
188188
app.controller('TestCtrl', function($scope, $http, $location, $timeout, $q) {
189189

190190
$scope.tests = [
191-
{ name: "TitleMap Examples", data: 'data/titlemaps.json' },
192191
{ name: "Material Flex Grid", data: 'data/grid.json' },
193192
{ name: "Simple", data: 'data/simple.json' },
194193
{ name: "Basic JSON Schema Type", data: 'data/types.json' },
195194
{ name: "Autocomplete", data: 'data/autocomplete.json' },
196195
{ name: "Switch", data: 'data/switch.json'},
196+
{ name: "TitleMap Examples", data: 'data/titlemaps.json' },
197197
/*{ name: "Complex Key Support", data: 'data/complex-keys.json' },*/
198198
/*{ name: "Array", data: 'data/array.json' },*/
199199
/*{ name: "Tab Array", data: 'data/tabarray.json' },*/

src/material-decorator.js

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,6 @@
131131
// TODO enable filter to allow processing results
132132
// args.form.optionSource = link.href.replace(related, '$1$1 model.$2 | _externalOptionUri $3$3');
133133
args.form.optionSource = link.href.replace(related, '$1$1 model.$2 $3$3');
134-
// args.form.watchList = [];
135-
// matched = args.form.optionSource.match(source);
136-
// while ((matched = source.exec(args.form.optionSource)) !== null) {
137-
// args.form.watchList.push(matched);
138-
// };
139134
};
140135
};
141136

@@ -144,19 +139,6 @@
144139
else {
145140
args.form.selectOptions = sfOptionsProcessor(args.form);
146141
};
147-
148-
// TODO implement $watch for remote data loading after the page loads
149-
function getOptionsHandler(form, evalExpr) {
150-
if (form.optionData) {
151-
return evalExpr(form.optionData);
152-
};
153-
154-
if (form.selectOptions) {
155-
return form.selectOptions;
156-
};
157-
158-
return [];
159-
};
160142
};
161143

162144
function mdDatepickerBuilder(args) {
@@ -207,6 +189,18 @@
207189
};
208190
};
209191

192+
function getOptionsHandler(form, evalExpr) {
193+
if (form.optionData) {
194+
return evalExpr(form.optionData);
195+
};
196+
197+
if (form.selectOptions) {
198+
return form.selectOptions;
199+
};
200+
201+
return [];
202+
};
203+
210204
function sfOptionsProcessor(data) {
211205
var enumTitleMap = [];
212206

0 commit comments

Comments
 (0)