Skip to content

Commit 05d8167

Browse files
committed
Improve flexbox and Angular flex-layout support.
1 parent bdea1fa commit 05d8167

22 files changed

+416
-494
lines changed

.angular-cli.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
{
88
"root": "src/demo",
99
"outDir": "dist/demo",
10-
"assets": [
11-
"assets"
12-
],
10+
"assets": [ "assets", "favicon.ico" ],
1311
"index": "index.html",
1412
"main": "main.ts",
1513
"polyfills": "polyfills.ts",

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular2-json-schema-form",
3-
"version": "0.4.0-alpha.14",
3+
"version": "0.4.0-alpha.15",
44
"author": {
55
"name": "David Schnell-Davis",
66
"email": "[email protected]"
@@ -48,8 +48,10 @@
4848
"postbuild": "rimraf out-ngc",
4949
"prepublish": "npm run build",
5050
"publish": "cd dist && npm publish",
51-
"deploy:app": "ng build && firebase deploy",
51+
"preng-build": "rimraf dist/*",
5252
"ng-build": "ng build",
53+
"predeploy": "npm run ng-build",
54+
"deploy": "firebase deploy",
5355
"old-build-demo": "tsc -p src/demo/",
5456
"old-build-demo:watch": "tsc -p src/demo/ -w",
5557
"old-prestart": "npm run build-demo",

src/demo/app/ace-editor.directive.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ declare var ace: any;
1212
selector: '[ace-editor]'
1313
})
1414
export class AceEditorDirective {
15-
_options: any = {
16-
basePath: '/node_modules/brace',
17-
};
15+
_options: any = {};
1816
_highlightActiveLine: boolean = false;
1917
_showGutter: boolean = false;
2018
_readOnly: boolean = false;

src/demo/app/bootstrap-demo.component.html

Lines changed: 0 additions & 220 deletions
This file was deleted.

src/demo/app/demo.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
Angular JSON Schema Form — Demonstration Playground
44
</md-toolbar>
55
<div class="header-content">
6-
An Angular <a href="http://json-schema.org/">JSON Schema</a> Form builder,
7-
similar to, and mostly API compatible with,
6+
An Angular <a href="http://json-schema.org/">JSON Schema</a> Form builder
7+
for Angular 2 and above, similar to, and mostly API compatible with,
88
<span class="avoidwrap">
99
<!-- JSON Schema Form's Angular Schema Form -->
1010
<!-- https://github.com/json-schema-form -->
@@ -19,7 +19,7 @@
1919
<!-- http://github.com/joshfire/jsonform/wiki -->
2020
<a href="http://ulion.github.io/jsonform/playground/">JSON Form</a>.
2121
</span><br>
22-
Choose an example, or create your own, and check out the generated form.<br><br>
22+
Choose an example, or create your own, and check out the generated form.<br>
2323

2424
<span class="menu-label">Current example:</span>
2525
<button md-raised-button

src/demo/assets/example-schemas/ng2jsf-flex-layout.json

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,40 +30,38 @@
3030
}
3131
}
3232
},
33-
"layout": [ {
34-
"type": "flex",
35-
"flex-direction": "column",
36-
"items": [
37-
{ "type": "flex",
38-
"flex-flow": "row wrap",
39-
"items": [ "first_name", "last_name" ]
40-
},
41-
{ "key": "address.street_1", "title": "Address", "placeholder": "Street" },
42-
{ "key": "address.street_2", "notitle": true },
43-
{ "type": "flex",
33+
"layout": [
34+
{ "type": "flex",
35+
"flex-flow": "row wrap",
36+
"items": [ "first_name", "last_name" ]
37+
},
38+
{ "key": "address.street_1", "title": "Address", "placeholder": "Street" },
39+
{ "key": "address.street_2", "notitle": true },
40+
{ "type": "div",
41+
"display": "flex",
42+
"flex-direction": "row",
43+
"items": [
44+
{ "key": "address.city", "flex": "3 3 150px",
45+
"notitle": true, "placeholder": "City" },
46+
{ "key": "address.state", "flex": "1 1 50px",
47+
"notitle": true, "placeholder": "State" },
48+
{ "key": "address.zip_code", "flex": "2 2 100px",
49+
"notitle": true, "placeholder": "Zip Code" }
50+
]
51+
},
52+
{ "key": "phone_numbers",
53+
"type": "array",
54+
"items": [ {
55+
"type": "div",
56+
"displayFlex": true,
4457
"flex-direction": "row",
4558
"items": [
46-
{ "key": "address.city", "flex": "3 3 150px",
47-
"notitle": true, "placeholder": "City" },
48-
{ "key": "address.state", "flex": "1 1 50px",
49-
"notitle": true, "placeholder": "State" },
50-
{ "key": "address.zip_code", "flex": "2 2 100px",
51-
"notitle": true, "placeholder": "Zip Code" }
59+
{ "key": "phone_numbers[].type", "flex": "1 1 50px", "notitle": true, "required": true },
60+
{ "key": "phone_numbers[].number", "flex": "4 4 200px", "notitle": true }
5261
]
53-
},
54-
{ "key": "phone_numbers",
55-
"type": "array",
56-
"items": [ {
57-
"type": "flex",
58-
"flex-direction": "row",
59-
"items": [
60-
{ "key": "phone_numbers[].type", "flex": "1 1 50px", "notitle": true, "required": true },
61-
{ "key": "phone_numbers[].number", "flex": "4 4 200px", "notitle": true }
62-
]
63-
} ]
64-
}
65-
]
66-
} ],
62+
} ]
63+
}
64+
],
6765
"data": {
6866
"first_name": "Jane",
6967
"last_name": "Doe",

src/lib/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ import { AddReferenceComponent } from './src/widget-library/add-refer
3030
import { ButtonComponent } from './src/widget-library/button.component';
3131
import { CheckboxComponent } from './src/widget-library/checkbox.component';
3232
import { CheckboxesComponent } from './src/widget-library/checkboxes.component';
33-
import { FieldsetComponent } from './src/widget-library/fieldset.component';
3433
import { FileComponent } from './src/widget-library/file.component';
35-
import { FlexComponent } from './src/widget-library/flex.component';
3634
import { HiddenComponent } from './src/widget-library/hidden.component';
3735
import { InputComponent } from './src/widget-library/input.component';
3836
import { MessageComponent } from './src/widget-library/message.component';
@@ -53,6 +51,8 @@ import { OrderableDirective } from './src/widget-library/orderable
5351
import { WidgetLibraryModule } from './src/widget-library/widget-library.module';
5452
import { WidgetLibraryService } from './src/widget-library/widget-library.service';
5553

54+
import { FlexLayoutRootComponent } from './src/framework-library/material-design-framework/flex-layout-root.component';
55+
import { FlexLayoutSectionComponent } from './src/framework-library/material-design-framework/flex-layout-section.component';
5656
import { MaterialAddReferenceComponent } from './src/framework-library/material-design-framework/material-add-reference.component';
5757
import { MaterialButtonComponent } from './src/framework-library/material-design-framework/material-button.component';
5858
import { MaterialButtonGroupComponent } from './src/framework-library/material-design-framework/material-button-group.component';

src/lib/src/framework-library/framework-library.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { NoFrameworkComponent } from './no-framework.component';
77

88
// Material Design Framework
99
// https://github.com/angular/material2
10+
import { FlexLayoutRootComponent } from './material-design-framework/flex-layout-root.component';
11+
import { FlexLayoutSectionComponent } from './material-design-framework/flex-layout-section.component';
1012
import { MaterialAddReferenceComponent } from './material-design-framework/material-add-reference.component';
1113
import { MaterialButtonComponent } from './material-design-framework/material-button.component';
1214
import { MaterialButtonGroupComponent } from './material-design-framework/material-button-group.component';
@@ -62,6 +64,8 @@ export class FrameworkLibraryService {
6264
framework: MaterialDesignFrameworkComponent,
6365
widgets: {
6466
'$ref': MaterialAddReferenceComponent,
67+
'root': FlexLayoutRootComponent,
68+
'section': FlexLayoutSectionComponent,
6569
'number': MaterialNumberComponent,
6670
'slider': MaterialSliderComponent,
6771
'text': MaterialInputComponent,

0 commit comments

Comments
 (0)