Skip to content
This repository was archived by the owner on Jan 22, 2018. It is now read-only.

Commit 269c8e7

Browse files
author
Kamil Kisiela
committed
Merge branch 'feature/slider' into develop
2 parents 907213c + 41d1a8a commit 269c8e7

File tree

5 files changed

+78
-1
lines changed

5 files changed

+78
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
55
## [Unreleased]
66
### Added
77
- multiple support for select field
8+
- slider field with min, max, step and discrete options
89

910
## [0.4.0] - 2015-11-17
1011
### Added

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,38 @@ delete-hint attribute value
218218
}
219219
```
220220

221+
### slider
222+
223+
**min (number, optional)**
224+
225+
default 1
226+
227+
**max (number, optional)**
228+
229+
default 100
230+
231+
**step (number, optional)**
232+
233+
default 1
234+
235+
**discrete (boolean, optional)**
236+
237+
default false (md-discrete)
238+
239+
```javascript
240+
{
241+
"type": "slider",
242+
"key": "rate",
243+
"templateOptions": {
244+
"theme": "custom",
245+
"min": 1,
246+
"max": 5,
247+
"step": 0.5,
248+
"discrete": true
249+
}
250+
}
251+
```
252+
221253

222254
## Wrappers
223255

@@ -230,6 +262,7 @@ delete-hint attribute value
230262
- [x] add md-chips
231263
- [x] add md-datepicker
232264
- [ ] add md-icon wrapper
265+
- [x] add md-slider with min, max, step and discrete options
233266
- [x] add md-select
234267
- [x] multiple in md-select
235268
- [ ] add groups to md-select

lib/client/types/slider/slider.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
var {SetModule} = angular2now;
2+
3+
SetModule('formlyMaterial')
4+
.config((formlyConfigProvider, formlyMaterialProvider) => {
5+
6+
formlyConfigProvider.setType({
7+
name: 'slider',
8+
templateUrl: formlyMaterialProvider.templateUrl('lib/client/types/slider/slider.ng.html'),
9+
defaultOptions: {
10+
ngModelAttrs: {
11+
min: {
12+
bound: 'min',
13+
attribute: 'min'
14+
},
15+
max: {
16+
bound: 'max',
17+
attribute: 'max'
18+
},
19+
step: {
20+
bound: 'step',
21+
attribute: 'step'
22+
},
23+
discrete: {
24+
bound: 'md-discrete'
25+
}
26+
}
27+
},
28+
apiCheck: (check) => ({
29+
templateOptions: {
30+
min: check.number.optional,
31+
max: check.number.optional,
32+
step: check.number.optional,
33+
discrete: check.bool.optional
34+
}
35+
})
36+
});
37+
38+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<md-slider ng-model="model[options.key]"></md-slider>

package.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ Package.onUse(function (api) {
9292

9393
// chips
9494
'lib/client/types/chips/chips.js',
95-
'lib/client/types/chips/chips.ng.html'
95+
'lib/client/types/chips/chips.ng.html',
96+
97+
// slider
98+
'lib/client/types/slider/slider.js',
99+
'lib/client/types/slider/slider.ng.html'
96100

97101
], client);
98102

0 commit comments

Comments
 (0)