├── .bowerrc ├── app ├── images │ ├── down.png │ └── logo.png ├── app-routes.es6 ├── app-module.es6 ├── builder │ ├── decorators │ │ ├── select-box │ │ │ ├── bootstrap-select-box-decorator.tpl.html │ │ │ └── bootstrap-select-box-decorator.es6 │ │ ├── typehead │ │ │ ├── bootstrap-typehead-decorator.tpl.html │ │ │ └── bootstrap-typehead-decorator.es6 │ │ ├── ace │ │ │ ├── ui-ace.html │ │ │ └── bootstrap-ui-ace.es6 │ │ ├── number │ │ │ ├── bootstrap-decorator.es6 │ │ │ └── bootstrap-number-decorator.tpl.html │ │ ├── simple-array │ │ │ ├── bootstrap-simple-array-decorator.es6 │ │ │ └── bootstrap-simple-array-decorator.tpl.html │ │ ├── datepicker │ │ │ ├── bootstrap-datepicker.es6 │ │ │ └── datepicker.html │ │ └── accordion-array │ │ │ ├── bootstrap-accordion-array-decorator.es6 │ │ │ └── bootstrap-accordion-array-decorator.tpl.html │ ├── builder-routes.es6 │ ├── controllers │ │ ├── builder-controller_test.es6 │ │ └── builder-controller.es6 │ ├── factories │ │ ├── converter-factory_test.es6 │ │ └── converter-factory.es6 │ ├── views │ │ ├── open.tpl.html │ │ └── builder.tpl.html │ └── builder-module.es6 ├── index.html └── scss │ └── builder.scss ├── .eslintrc ├── .editorconfig ├── .yo-rc.json ├── .gitignore ├── README.md ├── .jshintrc ├── protractor.config.js ├── gulp ├── watch.js ├── analyze.js ├── test.js └── build.js ├── bower.json ├── karma.config.js ├── LICENSE ├── Gulpfile.js ├── package.json └── .jscsrc /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "analytics": false, 3 | "directory": "vendor" 4 | } -------------------------------------------------------------------------------- /app/images/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/json-schema-form/json-schema-builder/master/app/images/down.png -------------------------------------------------------------------------------- /app/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/json-schema-form/json-schema-builder/master/app/images/logo.png -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "extends": [ 3 | "angular", 4 | "dustinspecker/esnext" 5 | ], 6 | "rules": { 7 | "angular/ng_controller_name": [2, "/[A-Z].*Ctrl$/"], 8 | "consistent-this": 0 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /app/app-routes.es6: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | angular 5 | .module('schemaFormBuilder') 6 | .config(config); 7 | 8 | function config($urlRouterProvider) { 9 | $urlRouterProvider.otherwise('/builder'); 10 | } 11 | }()); 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /app/app-module.es6: -------------------------------------------------------------------------------- 1 | (function () { 2 | 'use strict'; 3 | 4 | /* @ngdoc object 5 | * @name schemaFormBuilder 6 | * @description 7 | * 8 | */ 9 | angular 10 | .module('schemaFormBuilder', [ 11 | 'builder', 12 | 'ui.bootstrap' 13 | ]); 14 | }()); 15 | -------------------------------------------------------------------------------- /app/builder/decorators/select-box/bootstrap-select-box-decorator.tpl.html: -------------------------------------------------------------------------------- 1 |
| {{ form.name}} | 5 |6 | 7 | 8 | | 9 |
7 | 8 | 21 | 22 | 24 | 25 |
26 | {{ (hasError() && errorMessage(schemaError())) || form.description}} 27 |
6 | Schema Form Builder / {{ builder.model.name || 'Untitled Form'}}
7 | New Form
8 | My previous Forms
9 | In your angular project do the following
33 |Using bower:
35 |bower install angular-schema-form36 |
Using npm:
37 |npm install angular-schema-form38 |
Then add it as a dependency to your module
39 |angular.module('myModule', ['schemaForm'])
40 |
41 | In your controller, add the following schema and form an pass it to your views
43 | {{ builder.output.schema | json }}
47 | {{ builder.output.form | json }}
51 | 56 | <form name="myForm" ng-submit="submit()">62 |
57 | <div sf-schema="schema" sf-form="form" sf-model="model"></div>
58 | <input type="submit" value="Submit">
59 | <button type="button" ng-click="goBack()">Cancel</button>
60 | </form> 61 |
{{ builder.output | json }}
66 | modelValue and form are both available. For a function, they will be passed as parameters in that order',
136 | type: 'string'
137 | },
138 | feedback: {
139 | title: 'Feedback Icon',
140 | description: 'Inline feedback icons. To turn off just set feedback to false. If set to a string that string is evaluated by a ngClass in the decorators scope. If not set att all the default value is { "glyphicon": true, "glyphicon-ok": hasSuccess(), "glyphicon-remove": hasError() }',
141 | type: 'string'
142 | },
143 | disableSuccessState: {
144 | type: 'boolean',
145 | title: 'Disable Success State',
146 | default: false
147 | },
148 | disableErrorState: {
149 | type: 'boolean',
150 | title: 'Disable Error State',
151 | default: false
152 | },
153 | placeholder: {
154 | title: 'Placeholder',
155 | description: 'Placeholder on inputs and textarea',
156 | type: 'string'
157 | },
158 | ngModelOptions: {
159 | title: 'ng-Model Options',
160 | description: 'Passed along to ng-model-options',
161 | type: 'string'
162 | },
163 | readonly: {
164 | type: 'boolean',
165 | title: 'Readonly',
166 | default: false
167 | },
168 | htmlClass: {
169 | title: 'Class',
170 | description: 'CSS Class(es) to be added to the container div e.g. : \'street foobar\'',
171 | type: 'string'
172 | },
173 | destroyStrategy: {
174 | title: 'Destroy Strategy',
175 | description: 'One of null, empty , remove, or retain. Changes model on $destroy event. default is remove.',
176 | type: 'string'
177 | },
178 | copyValueTo: {
179 | title: 'Copy Value To',
180 | description: 'Copy values to these schema keys e.g [\'address.street\']. The receiving fields can be shown, but the intent for them is to be hidden.',
181 | type: 'string'
182 | },
183 | fieldHtmlClass: {
184 | title: 'Field Class',
185 | description: 'CSS Class(es) to be added to field input (or similar)',
186 | type: 'string'
187 | },
188 | labelHtmlClass: {
189 | title: 'Label Class',
190 | description: 'CSS Class(es) to be added to the label of the field (or similar)',
191 | type: 'string'
192 | },
193 | condition: {
194 | title: 'Condition',
195 | description: 'Show or hide field depending on an angular expression e.g \'model.age < 18\'. The expression has access to model, modelValue, arrayIndex. The condition need not reference a model value it could be anything on scope.',
196 | type: 'string'
197 | },
198 | fieldAddonLeft: {
199 | title: 'Field Addon - Left',
200 | description: 'Add html code to left of input field. For reference check bootstrap input groups.',
201 | type: 'string'
202 | },
203 | fieldAddonRight: {
204 | title: 'Field Addon - Right',
205 | description: 'Add html code to right of input field. For reference check bootstrap input groups.',
206 | type: 'string'
207 | },
208 | onClick: {
209 | title: 'onClick',
210 | description: 'Function to call when a button/submit is clicked',
211 | type: 'string'
212 | },
213 | showAdvanced: {
214 | title: 'Show advance options',
215 | type: 'boolean'
216 | }
217 | },
218 | required: [
219 | 'key'
220 | ]
221 | }
222 | }
223 | },
224 | required: ['name']
225 | };
226 | vm.model = {};
227 | vm.form = [
228 | {
229 | type: 'section',
230 | htmlClass: 'row main-info',
231 | items: [
232 | {
233 | key: 'name',
234 | htmlClass: 'col-sm-6',
235 | placeholder: 'name of the form',
236 | notitle: true,
237 | fieldHtmlClass: 'field-name',
238 | labelHtmlClass: 'field-name-label'
239 | }
240 | ]
241 | },
242 | {
243 | type: 'section',
244 | htmlClass: 'my-field row',
245 | items: [
246 | {
247 | type: 'section',
248 | htmlClass: 'col-sm-6',
249 | items: [
250 | {
251 | type: 'help',
252 | helpvalue: '