Skip to content

Commit

Permalink
Merge pull request #18 from muqube/release-0.5.0-preparation
Browse files Browse the repository at this point in the history
Docs and versions files updated
  • Loading branch information
raiyankamal authored Feb 10, 2020
2 parents 33b3efa + 2bf57b8 commit 8332056
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 30 deletions.
1 change: 0 additions & 1 deletion .versions
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,5 @@ templating@1.1.12
templating-tools@1.1.1
tracker@1.2.0
ui@1.0.11
underscore@1.0.10
webapp@1.7.0
webapp-hashing@1.0.9
21 changes: 21 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# History
This meteor package is a fork of [elevatedevdesign:autoform-nouislider](https://github.com/ElevateDev/meteor-autoform-nouislider). I forked it to make it compatible with meteor 1.3 and fix some bugs.


## Release Notes

### 0.3
- Bug fixed: start and range options set in schema definition was overwritten
- Removed dependency on wrapper package `rcy:nouislider`

### 0.4
- Bug fixed: "Slider was already initialized" error fixed

### 0.4.1
- Update AutoForm to 6.0.0, other dependencies also updated to recent version
- Code is now [Javascript standard style](https://standardjs.com/)
- Some ES5 syntax updated to ES6

### 0.5
- Update nouislider to 14.0.2
- Removed underscore dependency
24 changes: 4 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Adds the `noUiSlider` type to [autoform](https://github.com/aldeed/meteor-autofo
min: 30,
autoform: {
type: "noUiSlider",
step: 10,
step: 10,
noUiSlider_pipsOptions: {
mode: 'steps',
density: 5
Expand Down Expand Up @@ -53,7 +53,7 @@ Adds the `noUiSlider` type to [autoform](https://github.com/aldeed/meteor-autofo
type: "noUiSlider",
noUiSliderOptions: {
step: 10
},
},
noUiSlider_pipsOptions: {
mode: 'steps',
density: 5
Expand All @@ -67,7 +67,7 @@ Adds the `noUiSlider` type to [autoform](https://github.com/aldeed/meteor-autofo
To get a vertical slider, do `noUiSliderOptions: {orientation: 'vertical'}` and specify an exact `height` in the CSS for the `nouislider` class.

### Overridding start and range
You can override start and range by passing the options in.
You can override start and range by passing the options in.

Be sure that the values passed in match the format below.

Expand All @@ -81,20 +81,4 @@ Show a label left and/or right of the slider
```

## History
This meteor package is a fork of [elevatedevdesign:autoform-nouislider](https://github.com/ElevateDev/meteor-autoform-nouislider). I forked it to make it compatible with meteor 1.3 and fix some bugs.


## Release Notes

### 0.3
- Bug fixed: start and range options set in schema definition was overwritten
- Removed dependency on wrapper package `rcy:nouislider`

### 0.4
- Bug fixed: "Slider was already initialized" error fixed

### 0.4.1
- Update AutoForm to 6.0.0, other dependencies also updated to recent version
- Code is now [Javascript standard style](https://standardjs.com/)
- Some ES5 syntax updated to ES6

Refer to [HISTORY.md](HISTORY.md)
21 changes: 18 additions & 3 deletions autoform-nouislider.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import noUiSlider from 'nouislider'
import 'nouislider/distribute/nouislider.css'
import './autoform-nouislider.html'

AutoForm.addInputType('noUiSlider', {
template: 'afNoUiSlider',
Expand Down Expand Up @@ -40,10 +41,25 @@ const pick = (object, ...keys) => {
return tmp
}

const exists = x => typeof x !== 'undefined' && x !== null

const merge = (...objects) => {
const tmp = {}
objects.forEach(object => {
Object.keys(object).forEach(key => {
const value = object[key]
if (exists(value)) {
tmp[key] = value
}
})
})
return tmp
}

Template.afNoUiSlider.helpers({
atts: function () {
const data = Template.currentData() // get data reactively
const atts = data.atts
const atts = Object.assign({}, data.atts)
atts[ 'data-type' ] = data.schemaType.name || 'Object' // fallback if type is a Schema and name becomes undefined
if (atts[ 'class' ]) {
atts[ 'class' ] += ' at-nouislider'
Expand All @@ -62,8 +78,7 @@ const calculateOptions = function (data) {
const schemaMinMax = pick(data, 'max', 'min')
const autoformOptions = pick(data.atts || {}, 'max', 'min', 'step', 'start', 'range')
const noUiSliderOptions = (data.atts || {}).noUiSliderOptions

const options = Object.assign({}, schemaMinMax, autoformOptions, noUiSliderOptions)
const options = merge(schemaMinMax, autoformOptions, noUiSliderOptions)

// Adjust data initialization based on schema type
if (options.start === undefined) {
Expand Down
4 changes: 2 additions & 2 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Package.describe({
name: 'muqube:autoform-nouislider',
summary: 'Dual value slider for autoform.',
version: '0.4.1',
git: 'https://github.com/ElevateDevelopmentAndDesign/meteor-autoform-nouislider'
version: '0.5.0',
git: 'https://github.com/muqube/meteor-autoform-nouislider'
})

Npm.depends({
Expand Down
4 changes: 0 additions & 4 deletions versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,6 @@
[
"ui",
"1.0.4"
],
[
"underscore",
"1.0.1"
]
],
"pluginDependencies": [],
Expand Down

0 comments on commit 8332056

Please sign in to comment.