Skip to content

Commit cfe956d

Browse files
committed
Updated it to have default builders
Not all types are tested, but the "simple" example works
1 parent c1cd75a commit cfe956d

13 files changed

+64
-48
lines changed

bower.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
"tests"
2020
],
2121
"dependencies": {
22-
"angular-schema-form": "development",
22+
"angular-schema-form": ">=0.8.6",
2323
"angular": "1.4.0-beta.6",
2424
"angular-material": "master",
2525
"angular-animate": "1.4",
2626
"angular-sanitize": "1.4"
2727
},
28-
"resolutions": {
29-
"angular": ">1.4.0-beta.0"
30-
},
3128
"devDependencies": {
3229
"angular-ui-ace": "~0.2.3"
30+
},
31+
"resolutions": {
32+
"angular": "1.4.4"
3333
}
3434
}

material-decorator.js

Lines changed: 31 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

material-decorator.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/checkbox.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<div class="checkbox schema-form-checkbox {{form.htmlClass}}"
22
ng-class="{'has-error': hasError(), 'has-success': hasSuccess()}">
3-
<md-checkbox ng-model="$$value$$"
4-
ng-model-options="form.ngModelOptions"
3+
<md-checkbox sf-field-model
54
sf-changed="form"
65
ng-disabled="form.readonly"
76
schema-validate="form"

src/checkboxes.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div sf-array="form" ng-model="$$value$$"
1+
<div sf-array="form" sf-field-model
22
class="form-group schema-form-checkboxes {{form.htmlClass}}"
33
ng-class="{'has-error': hasError(), 'has-success': hasSuccess()}">
44
<label class="control-label" ng-show="showTitle()">{{form.title}}</label>

src/chips.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="form-group schema-form-chips {{form.htmlClass}}"
22
ng-class="{'has-error': hasError(), 'has-success': hasSuccess(), 'has-feedback': form.feedback !== false}">
3-
<md-chips ng-model="$$value$$" readonly="form.readonly" flex
3+
<md-chips sf-field-model readonly="form.readonly" flex
44
placeholder="{{form.title || form.key.slice(-1)[0]}}">
55
<md-chip-template>
66
<!-- should include an optional template from form.template -->

src/default.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
aria-describedby="{{form.key.slice(-1)[0] + 'Status'}}">
2020
-->
2121

22-
<input ng-model="$$value$$"
22+
<input sf-field-model
2323
ng-show="form.key"
2424
type="{{form.type}}"
2525
step="any"

src/fieldset.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<fieldset ng-disabled="form.readonly" class="standard {{form.htmlClass}}" flex>
22
<legend ng-show="form.title">{{ form.title }}</legend>
3-
<sf-decorator ng-repeat="item in form.items" form="item"></sf-decorator>
43
</fieldset>

src/material-decorator.js

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
angular.module('schemaForm')
2-
.config([ 'schemaFormDecoratorsProvider', function(decoratorsProvider) {
2+
.config([ 'schemaFormDecoratorsProvider', 'sfBuilderProvider',
3+
function(decoratorsProvider, sfBuilderProvider) {
34
var base = 'decorators/material/';
45

6+
var simpleTransclusion = sfBuilderProvider.builders.simpleTransclusion;
7+
var ngModelOptions = sfBuilderProvider.builders.ngModelOptions;
8+
var ngModel = sfBuilderProvider.builders.ngModel;
9+
var sfField = sfBuilderProvider.builders.sfField;
10+
11+
var defaults = [ sfField, ngModel, ngModelOptions ];
12+
513
decoratorsProvider.defineDecorator('materialDecorator', {
6-
textarea: { template: base + 'textarea.html' },
7-
fieldset: { template: base + 'fieldset.html' },
8-
'default': { template: base + 'default.html' },
9-
select: { template: base + 'select.html' },
10-
checkbox: { template: base + 'checkbox.html' },
11-
checkboxes: { template: base + 'checkboxes.html' },
12-
radios: { template: base + 'radios.html' },
13-
'radios-inline': { template: base + 'radios-inline.html' },
14-
radiobuttons: { template: base + 'radio-buttons.html' },
15-
submit: { template: base + 'submit.html' }
14+
textarea: { template: base + 'textarea.html', builder: defaults },
15+
fieldset: { template: base + 'fieldset.html', builder: [ sfField, simpleTransclusion ] },
16+
'default': { template: base + 'default.html', builder: defaults },
17+
select: { template: base + 'select.html', builder: defaults },
18+
checkbox: { template: base + 'checkbox.html', builder: defaults },
19+
checkboxes: { template: base + 'checkboxes.html', builder: defaults },
20+
radios: { template: base + 'radios.html', builder: defaults },
21+
'radios-inline': { template: base + 'radios-inline.html', builder: defaults },
22+
radiobuttons: { template: base + 'radio-buttons.html', builder: defaults },
23+
submit: { template: base + 'submit.html', builder: defaults }
1624
});
1725

1826
/* decoratorsProvider.createDecorator('materialDecorator', {

src/radios-inline.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
ng-class="{'has-error': hasError(), 'has-success': hasSuccess()}">
33
<label class="control-label" ng-show="showTitle()">{{form.title}}</label>
44
<md-radio-group layout="row"
5+
sf-field-model="replaceAll"
56
ng-model="$$value$$"
6-
ng-model-options="form.ngModelOptions"
77
class="{{form.fieldHtmlClass}}"
88
ng-class="{ active: item.value === $$value$$ }"
99
sf-changed="form"

0 commit comments

Comments
 (0)