Git Product home page Git Product logo

ember-cli-nouislider's Introduction

ember-cli-nouislider

Build Status npm version Code Climate Ember Observer Score Open Source Helpers

This ember-cli addon provides you with a range-slider component, based on noUiSlider. It includes everything you need, and adds no extra dependencies other than noUiSlider itself (which has no external dependencies).

To get started simply install the addon:

$ ember install ember-cli-nouislider

This will install nouislider via Bower, and will include it into your application's mergetree, so you don't need to worry about anything there.

Compatibility

  • Ember.js v3.12 or above
  • Ember CLI v2.13 or above
  • Node.js v10 or above

Demo & documentation

Have a look around then demo and documentation to get a feel for how to use it.

Component

You have the opportunity to customize if needed.

To do this, generate your own component and re-export the one provided:

$ ember g component range-slider
// app/components/range-slider.js
import RangeSlider from 'ember-cli-nouislider/components/range-slider';

export default RangeSlider;

Include the slider into your views like this:

{{range-slider start=someValue on-change=(action "changedAction")}}

And setup an action handler in your route:

// app/routes/my-route.js
import Controller from '@ember/controller';
import { debug } from '@ember/debug';

export default Controller.extend({
  // ...
  actions: {
    // ...
    changedAction: function(value) {
      debug( `New slider value: ${value}`);
    }
  }
});

See the documentation for more actions.

Configuration

The component has a lot of configurable options, most of them mapping directly to the original options. To see how the slider is initialized internally, please have a look at app/components/range-slider.js in this project, or browse through the documentation.

License

This project is licensed under the MIT License.

ember-cli-nouislider's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ember-cli-nouislider's Issues

Update the value as dragging changes

Hey!
Nice plugin, however, it lacks of handler for "update" event. I want to show the sliding results instantly, like it is in original one:

// When the slider value changes, update the input and span
range.noUiSlider.on('update', function( values, handle ) {
    if ( handle ) {
        valueInput.value = values[handle];
    } else {
        valueSpan.innerHTML = values[handle];
    }
});

source : http://refreshless.com/nouislider/

How to set style / class on slider?

Is there a way or option to add classes to the slider element? ie bg-success etc?

I have a slider where the color of the bar needs to change based on the value of the slider, which I was able to do via jquery, but not sure how to pass it into the component in Ember?

Thanks 👍

setValue is triggered during slide-action

The setValue function is triggered during slide-action. Is that as supposed?

Looks to me that shouldn't be the case because it is bad for performance to call slider.set(value) while sliding. Imho it should only be called when the value is set from outside.

Build Bower package

Hi, have you considered making rangeslider.js independent of Ember CLI? Not all of us use it because of the half-working transpiler and opinionated asset pipeline. I was wondering if you could provide a version of the file in as a standard RequireJS module that only uses AMD when it's detected:

if ( typeof define === "function" && define.amd ) {
    define("ember-cli-nouislider", [], function() {
        return rangeSlider;
    });
} else {
    window.rangeSlider = rangeSlider;
}

#44 breaks implementations based on nouislider ^9.0

#44 was not implemented properly as npm forces the ~8 version of uislider for the lib and does not allow the lib user to override it inside their package.json ( as was the case with bower ). Please change "nouislider": "~8.5.1" to "nouislider": ">=8.5.1"

sendAction() not working on 1.12

At least on Ember 1.12.1 the line:

      _this.sendAction( changeAction, _this.slider.val() );

works only if you change it to:

      _this.sendAction( 'change', _this.slider.val() );

It is, sendAction() must receive the name of the property that holds the action’s name as a value and not the name itself!

Ember.Logger deprecation

Hello,
range-slider.js is making use of Ember.Logger but this class is now deprecated. (https://rfcs.emberjs.com/id/0297-deprecate-ember-logger/)
As per the deprecation doc console.warn() can be used instead of the logger warn method.
Would you accept a contribution so that I could keep using this addon with out upgraded Ember project? We just upgraded to ember 4.10 and this seems to be the only issue I find which prevents the addon from continuing to be useful.

Thanks,
Ralica

Missing template processor

When installing last version (0.3.0), when running "ember server", I get the following:

Missing template processor
Error: Missing template processor
    at module.exports.preprocessTemplates (/Users/patrikjira/www/goferrata/goferrata/node_modules/ember-cli/lib/preprocessors.js:149:11)
    at Class.Addon.compileTemplates (/Users/patrikjira/www/goferrata/goferrata/node_modules/ember-cli/lib/models/addon.js:434:12)
    at Class.Addon.compileAddon (/Users/patrikjira/www/goferrata/goferrata/node_modules/ember-cli/lib/models/addon.js:456:28)
    at Class.Addon.treeForAddon (/Users/patrikjira/www/goferrata/goferrata/node_modules/ember-cli/lib/models/addon.js:382:24)
    at Class._treeFor (/Users/patrikjira/www/goferrata/goferrata/node_modules/ember-cli/lib/models/addon.js:282:31)
    at Class.treeFor (/Users/patrikjira/www/goferrata/goferrata/node_modules/ember-cli/lib/models/addon.js:253:19)
    at EmberApp.<anonymous> (/Users/patrikjira/www/goferrata/goferrata/node_modules/ember-cli/lib/broccoli/ember-app.js:307:20)
    at Array.map (native)
    at EmberApp.addonTreesFor (/Users/patrikjira/www/goferrata/goferrata/node_modules/ember-cli/lib/broccoli/ember-app.js:305:30)
    at EmberApp._addonTree (/Users/patrikjira/www/goferrata/goferrata/node_modules/ember-cli/lib/broccoli/ember-app.js:597:38)

Any ideas?

Observer is causing performance issues

Hi, I've noticed that using observer in the range-slider causes performance issues.

The problematic part is observer on start attribute. I think it's not necessary, because on didUpdateAttrs method calls update which updates start property as well.

I've tried to remove completely that observer and it solved the performance issue for me.

here is an working example https://ember-twiddle.com/d1cb52c73d07c0c016261c36000f5971?openFiles=templates.application.hbs%2C

Would you accept PR?

Can't set handlebar values through input form

this feature works on noUiSlider, but not on the events page for ember slider. tried setting the value in my code with a function but the handle lags and doesn't move if I input more than 100+the current value

Better Documentation

For example, how can I bind the slider value to a property on my controller that when the controllers property changes, updates the slider. And, how can I use the connect property of the slider?

Ember 3.x compatibility?

What steps do we need to take to get this to work with Ember 3.x? I'm seeing weird behavior (Cannot read property 'on' of undefined), and I'm not sure what the source is.

See log:

range-slider.js:76 Uncaught TypeError: Cannot read property 'on' of undefined
at range-slider.js:76
at Array.forEach ()
at range-slider.js:74
at invoke (backburner.js:205)
at Queue.flush (backburner.js:125)
at DeferredActionQueues.flush (backburner.js:278)
at Backburner.end (backburner.js:410)
at Backburner._boundAutorunEnd (backburner.js:372)
(anonymous) @ range-slider.js:76
(anonymous) @ range-slider.js:74
invoke @ backburner.js:205
flush @ backburner.js:125
flush @ backburner.js:278
end @ backburner.js:410
Backburner._boundAutorunEnd @ backburner.js:372
setTimeout (async)
Backburner.platform.next @ backburner.js:360
_ensureInstance @ backburner.js:884
schedule @ backburner.js:499
(anonymous) @ rsvp.js:13
fulfill @ rsvp.js:330
handleMaybeThenable @ rsvp.js:295
resolve @ rsvp.js:303
(anonymous) @ rsvp.js:244
Promise.then (async)
tryThen @ rsvp.js:229
(anonymous) @ rsvp.js:238
(anonymous) @ rsvp.js:14
invoke @ backburner.js:205
flush @ backburner.js:125
flush @ backburner.js:278
end @ backburner.js:410
_run @ backburner.js:760
_join @ backburner.js:736
join @ backburner.js:477
run.join @ ember-metal.js:4366
(anonymous) @ ember-metal.js:4441
mightThrow @ jquery.js:3534
process @ jquery.js:3602
setTimeout (async)
(anonymous) @ jquery.js:3640
fire @ jquery.js:3268
fireWith @ jquery.js:3398
fire @ jquery.js:3406
fire @ jquery.js:3268
fireWith @ jquery.js:3398
ready @ jquery.js:3878
completed @ jquery.js:3888

Can many RangeSliders share the same action?

I am currently trying to use a generic action to handle many range sliders. The on-change option specifies the action, but I have no way of knowing which range slider triggered the action. Is there any way to pass another argument to the action to identify which slider the user is interacting with?

Cannot update `max` value after initial render

Version: 1.1.0

When updating the max value I would expect the slider to respond to this new value, but unfortunately it does not.

The only way I have found to update this value in realtime is to force rerender the component.

{{#if sliderReady}}
  {{range-slider 
    start=start
    min=1
    max=calculatedTotal  <-- When updating `calculateTotal` the slider does update to reflect the new value
    connect=connect
    tooltips=true
    step=1
    on-change="sliderChanged"
  }}
{{/if}}

Basically, I observe the calculatedTotal change and then toggle the sliderReady value from true to false, and then back to true. This will rerender the range-slider with the udpated max value.

Deprecation warning - Scheduling into the 'sync' run loop queue

I've upgraded to Ember 3.0.0 and it seems this addon now causes a deprecation warning (although I jumped from 2.16 -> 3.0.0, so it could have been any version in between)

capture

Seems to happen when a slider is rendered on the page (don't even need to interact with it). The deprecation points to this section of code (makes sense):
https://github.com/kennethkalmer/ember-cli-nouislider/blob/master/addon/components/range-slider.js#L77-L89

I did a quick google search and couldn't actually find information on this deprecation anywhere...

Tooltips don't appear

Using Ember 2.9

              {{range-slider start=(array valueMin valueMax)
                             range=(hash min=0 max=10000000)
                             tooltips=true
                             connect=true
                             step=1
                             on-change="updateRanges"
              }}

Tooltips don't seem to appear

screen shot 2017-01-16 at 4 16 09 pm

Think this is an issue with Ember 2.9?

New Ember Version 3.25 to 3.28 throws error on build of ember-cli-nouislider template

ERROR Summary:

  • broccoliBuilderErrorStack: TypeError: Cannot read property 'start' of undefined
    at Source.spanFor (/home/skaria/dev/abc/node_modules/ember-source/dist/ember-template-compiler.js:9155:26)
    at BlockContext.loc (/home/skaria/dev/abc/node_modules/ember-source/dist/ember-template-compiler.js:14278:26)
    at ElementNormalizer.attr (/home/skaria/dev/abc/node_modules/ember-source/dist/ember-template-compiler.js:14803:30)

Default formatting functions break negative ranges

The addon provides two default format functions that by default just return the value they are passed.

This unfortunately breaks when a range has a negative component (e.g, min: -5, max: 5).

This is because nouislider's setValues function casts the value to set the handle to into a string before calling formatFrom. However the expect the value returned from the format.from function to be a Number.

But, the result with this addon's default format functions is to return the string.

In my app overriding the formatFrom function to be something like the following fixed the issue.

formatFrom(value) {
  return +value;
}

I'm not sure if this issue is a bug per-se, as it is more of an unexpected behavior. If it doesn't require code changes, then at least adding a note to the documentation would be helpful.

1.13/2.0 Support

Mainly it's the new computed property syntax. But maybe we should wait for Ember 2.0 to see what else gets removed/changed.

Would require a major version bump.

[ember-cli-nouislider]: Error: noUiSlider (11.1.0): 'range' is not an object.

I'm getting this warning when I try to include the range slider, and the slider is not being displayed:
{{range-slider start=1 range=100}}

ember-console.js:24 [ember-cli-nouislider]: Error: noUiSlider (11.1.0): 'range' is not an object.

I'm using : DEBUG: Ember : 3.0.0 ember-console.js:43 DEBUG: Ember Data : 3.0.2 ember-console.js:43 DEBUG: jQuery : 3.3.1

I'm not sure what the issue is, because I don't see anything in the documentation about using an object for the range value.

Can you please let me know if I'm doing something wrong?
Thanks.

`slider` is undefined in integration test, leading to failure with "Cannot read property 'on'/'off' of undefined"

I just added this component to an ember 3.12 app and now the integration test for the component using the range-slider fails:

  1. TypeError: Cannot read property 'on' of undefined
    at range-slider.js:75
    at Array.forEach ()
    at Class.setup (range-slider.js:71)
    at Class.didInsertElement (range-slider.js:50)
    at Class.trigger (core_view.js:69)
    at Class.superWrapper [as trigger] (utils.js:365)
    at CurlyComponentManager.didCreate (glimmer.js:5664)
    at Transaction.commit (runtime.js:3203)
    at Environment$1.commit (runtime.js:3298)
    at Environment$1.commit (glimmer.js:4712)

  2. (the actually present assertion in the near-dummy test passes)

  3. TypeError: Cannot read property 'off' of undefined
    at Class.teardown (http://localhost:4200/assets/vendor.js:280722:14)
    at Class.willDestroyElement (http://localhost:4200/assets/vendor.js:280717:12)
    at Class.trigger (http://localhost:4200/assets/vendor.js:60822:23)
    at Class.superWrapper [as trigger] (http://localhost:4200/assets/vendor.js:58181:22)
    at ComponentStateBucket.destroy (http://localhost:4200/assets/vendor.js:33130:19)
    [...]

Deprecation msg on the use of sendAction thrown in Ember 3.4.x

Hi.

Thank you for this very useful addon.

I get the following message in the console with ember-cli-nouislider v1.0.0:

You called <insurance-online-ui@component:range-slider::ember574>.sendAction("on-update") but Component#sendAction is deprecated. Please use closure actions instead. [deprecation id: ember-component.send-action] See https://emberjs.com/deprecations/v3.x#toc_ember-component-send-action for more details.

Thanks.

Fastboot issues

I'm still running into fastboot issues- The app is not crashing, but throws a dank js error and will not fully render the page.

Error: Could not find module "noUiSlider" imported from "ember-cli-nouislider/components/range-slider"

[Question] Slider won't show up

Hi,

I'm new to ember and just came across nouislider (really neat plugin btw ).
So, I did install ember-cli-nouislider via ember install ember-cli-nouislider
Then I included it in my .hbs like this: {{range-slider start=13 range=100 start=0 connect="lower" behavior="drag" change="changedAction"}}

Should it show up automatically or do I need to change something else? I followed every step but it seems it's buggy for some reason.
Nothing is showing up right now except for a div with an ember id.

Versions: I have everything up to date (bower, ember, etc.).

Can you give me some help?
Thank you.

Error: Cannot read property 'on' of undefined

Getting a warning [ember-cli-nouislider]: Error: noUiSlider (14.1.1): 'range' is not an object.
and error TypeError: Cannot read property 'on' of undefined

Uncaught (in promise) TypeError: Cannot read property 'on' of undefined
at range-slider.js:84
at Array.forEach ()
at Class.setup (range-slider.js:80)
at Class.didInsertElement (range-slider.js:58)
at Class.trigger (core_view.js:70)
at Class.superWrapper [as trigger] (index.js:367)
at CurlyComponentManager.didCreate (index.js:4795)
at Transaction.commit (runtime.js:3019)
at Environment$1.commit (runtime.js:3122)
at Environment$1.commit (index.js:3924)
(anonymous) @ range-slider.js:84
setup @ range-slider.js:80
didInsertElement @ range-slider.js:58
trigger @ core_view.js:70
superWrapper @ index.js:367
didCreate @ index.js:4795
commit @ runtime.js:3019
commit @ runtime.js:3122
commit @ index.js:3924
_renderRoots @ index.js:5415
_renderRootsTransaction @ index.js:5445
_revalidate @ index.js:5491
invoke @ backburner.js:338
flush @ backburner.js:229
flush @ backburner.js:426
_end @ backburner.js:960
Backburner._boundAutorunEnd @ backburner.js:629
Promise.then (async)
iterations @ backburner.js:28
flush @ index.js:53
_scheduleAutorun @ backburner.js:1179
_end @ backburner.js:970
Backburner._boundAutorunEnd @ backburner.js:629
Promise.then (async)
iterations @ backburner.js:28
flush @ index.js:53
_scheduleAutorun @ backburner.js:1179
_end @ backburner.js:970
Backburner._boundAutorunEnd @ backburner.js:629
Promise.then (async)
iterations @ backburner.js:28
flush @ index.js:53
_scheduleAutorun @ backburner.js:1179
_ensureInstance @ backburner.js:1167
schedule @ backburner.js:776
(anonymous) @ rsvp.js:19
fulfill @ rsvp.js:428
resolve$1 @ rsvp.js:403
resolved @ rsvp.js:526
reader.onload @ ember-fetch.js:325
load (async)
(anonymous) @ ember-fetch.js:324
initializePromise @ rsvp.js:520
Promise @ rsvp.js:1021
fileReaderReady @ ember-fetch.js:323
readBlobAsText @ ember-fetch.js:342
Body.text @ ember-fetch.js:437
determineBodyPromise @ -private.js:52
(anonymous) @ rest.js:892
invokeCallback @ rsvp.js:493
publish @ rsvp.js:476
(anonymous) @ rsvp.js:19
invoke @ backburner.js:338
flush @ backburner.js:229
flush @ backburner.js:426
_end @ backburner.js:960
Backburner._boundAutorunEnd @ backburner.js:629
Promise.then (async)
iterations @ backburner.js:28
flush @ index.js:53
_scheduleAutorun @ backburner.js:1179
_ensureInstance @ backburner.js:1167
schedule @ backburner.js:776
(anonymous) @ rsvp.js:19
fulfill @ rsvp.js:428
handleMaybeThenable @ rsvp.js:384
resolve$1 @ rsvp.js:401
resolved @ rsvp.js:526
xhr.onload @ ember-fetch.js:619
load (async)
(anonymous) @ ember-fetch.js:611
initializePromise @ rsvp.js:520
Promise @ rsvp.js:1021
fetch @ ember-fetch.js:598
self.default @ ember-fetch.js:700
_fetchRequest @ rest.js:947
ajax @ rest.js:889
findRecord @ rest.js:445
(anonymous) @ -private.js:8914
invokeCallback @ rsvp.js:493
(anonymous) @ rsvp.js:558
(anonymous) @ rsvp.js:19
invoke @ backburner.js:338
flush @ backburner.js:229
flush @ backburner.js:426
_end @ backburner.js:960
Backburner._boundAutorunEnd @ backburner.js:629
Promise.then (async)
iterations @ backburner.js:28
flush @ index.js:53
_scheduleAutorun @ backburner.js:1179
_ensureInstance @ backburner.js:1167
schedule @ backburner.js:776
(anonymous) @ rsvp.js:19
fulfill @ rsvp.js:428
resolve$1 @ rsvp.js:403
resolved @ rsvp.js:526
reader.onload @ ember-fetch.js:325
load (async)
(anonymous) @ ember-fetch.js:324
initializePromise @ rsvp.js:520
Promise @ rsvp.js:1021
fileReaderReady @ ember-fetch.js:323
readBlobAsText @ ember-fetch.js:342
Body.text @ ember-fetch.js:437
determineBodyPromise @ -private.js:52
(anonymous) @ rest.js:892
invokeCallback @ rsvp.js:493
publish @ rsvp.js:476
(anonymous) @ rsvp.js:19
invoke @ backburner.js:338
flush @ backburner.js:229
flush @ backburner.js:426
_end @ backburner.js:960
Backburner._boundAutorunEnd @ backburner.js:629
Promise.then (async)
iterations @ backburner.js:28
flush @ index.js:53
_scheduleAutorun @ backburner.js:1179
_ensureInstance @ backburner.js:1167
schedule @ backburner.js:776
(anonymous) @ rsvp.js:19
fulfill @ rsvp.js:428
handleMaybeThenable @ rsvp.js:384
resolve$1 @ rsvp.js:401
resolved @ rsvp.js:526
xhr.onload @ ember-fetch.js:619
load (async)
(anonymous) @ ember-fetch.js:611
initializePromise @ rsvp.js:520
Promise @ rsvp.js:1021
fetch @ ember-fetch.js:598
self.default @ ember-fetch.js:700
_fetchRequest @ rest.js:947
ajax @ rest.js:889
queryRecord @ rest.js:523
(anonymous) @ -private.js:9230
invokeCallback @ rsvp.js:493
(anonymous) @ rsvp.js:558
(anonymous) @ rsvp.js:19
invoke @ backburner.js:338
flush @ backburner.js:229
flush @ backburner.js:426
_end @ backburner.js:960
Backburner._boundAutorunEnd @ backburner.js:629
Promise.then (async)
iterations @ backburner.js:28
flush @ index.js:53
_scheduleAutorun @ backburner.js:1179
_ensureInstance @ backburner.js:1167
schedule @ backburner.js:776
schedule @ index.js:372
waitForDOMReady @ application.js:435
init @ application.js:347
superWrapper @ index.js:367
initialize @ core_object.js:92
create @ core_object.js:695
(anonymous) @ app-boot.js:3

ember-cli version 3.13

Multiple sliders updating simultaneously on mobile devices

I'm currently using the plugin (last version) to render three sliders on the page in this fashion:

{{range-slider score=score start=value range=range step=step on-change="change" on-update="update"}}

Using a mouse I can slide them all independently and it works perfectly fine.
However, on eg. a tablet, if I move the slider on one of the three and then proceed to move the slider on another, both sliders will move at the same time. If I then move the third slider, all three sliders will synchronise and move at the same time. I can even kind of slide my finger somewhere else on the page (not on any of the three sliders) and all three sliders will update.

Here's a video demonstrating the issue: https://streamable.com/bm2qt

The issue is fixed by removing the on-update action handler (handles the 'update' events), but then the values next to the slider are not updated.

I've done some digging and it seems as if the 'touchend' event (browser) is not being fired 90% of the time when lifting my finger of the screen (happens on both iOS and Android devices). As a result the 'change' and 'end' events of nouislider are not being fired either and I suppose this is where the problem lies?

Any help would be greatly appreciated!

How to set slider value programatically?

I've tried setting start the ember way, but it only works once. like in you animate example under Options http://kennethkalmer.github.io/ember-cli-nouislider/#/options

Eg sliding the slider somewhere and then clicking "set sliders" will change the slider to the new position, but if I slide the slider again and then click set sliders again nothing happens.

Is there a way to get the noUISlider object and call .set()?

At least I can't figure out how or is this a bug?

Unexpected range values when setting step

I'm trying to set up a range slider using this addon, and noticed that, when setting the step option, that it sets the range steps to unexpected values. For my particular case, I'm trying to set up a slider with a min=0 and max=18. If I set step=1, then I'd expect whole numbers (1, 2, 3, etc.) for the entire range, but instead, some values are displaying as floats.

To reproduce:

  • Started a brand new Ember project
  • Installed ember-cli-nouislider
  • Added the following to the main template:
{{range-slider
  step=1
  start=2
  min=0
  max=18
  connect=true
  tooltips=true
}}

{{range-slider
  step=1
  start=2
  min=1
  max=18
  connect=true
  tooltips=true
}}

{{range-slider
  step=1
  start=2
  min=2
  max=18
  connect=true
  tooltips=true
}}

The last range slider shows whole numbers for the entire range, but the first two start to show non-whole numbers at various steps. I've also included sliders created with nouislider.js directly to see if the issue was with the base slider or the Ember addon:
screen shot 2018-05-17 at 4 07 08 pm

noUi-background element nonexistent?

Hi, in the original noUiSlider there's an element classed 'noUi-background' that can be used to color the slider's background (to make it contrast with the base). It's used on the Ember noUiSlider docs but the element can't be found when I actually use it. Am I just missing it somehow? Thanks

Component cannot find import

Hi,

I'm trying to follow the README for extending the range-slider component, unfortunately I am getting an error:

Could not find moduleember-cli-nouislider/components/range-slider`

I'm using Ember 1.11.1 and ember-cli 2.3.

Any ideas how to solve this issue?

(Btw. I can perfectly use the range-slider component from the addon in my application, I just cannot import it for extending...)

With incorrect properties slider is not rendered. With no error messages.

When call to noUiSlider.create() method failing inside a component setup() function,
component itself not being rendered. Bad thing, that it's failing silently, without any errors in console.

  setup: on('didInsertElement', function() {
    let $this = this.$().get(0);
    let properties = this.getProperties(
      'start', 'step', 'margin',
      'limit', 'range', 'connect',
      'orientation', 'direction',
      'behaviour', 'animate', 'snap',
      'pips', 'format'
    );
    let sliderEvents = Ember.A(['change', 'set', 'slide', 'update', 'start', 'end']);

    noUiSlider.create($this, properties);

    console.log('Hello world'); // <--- not executed!

Wrapping

    try {
      noUiSlider.create($this, properties);
    } catch(e) {
      console.error(e);
    }

looks like a good quickfix.

2016-09-30 10 47 59

Add docs for changing slider values

Reading source code I figured out that it's possible to change slider values through mutating start option.
Can you add an example of changing slider values?

setting a computed range causes "Missing 'min' or 'max' in 'range'"

I tried to use the range-slider component with computed range property but that seems to cause noUiSlider to complain (eagerly) that it's "Missing 'min' or 'max' in 'range'." I tried to await the range value but it seems that it's immediately evaluating the resultant promise and failing to render with the error above.

I wonder how this is done or whether CP range is supported.

thanks

Deprecation warnings

I am getting these deprecation warnings:

DEPRECATION: A property of <project@view:-outlet::ember817> was modified inside the didInsertElement hook. You should never change properties on components, services or models during didInsertElement because it causes significant performance degradation. [deprecation id: ember-views.dispatching-modify-property]

My environment:

ember-cli: 2.5.1
node: 4.1.1
os: darwin x64

Deprecation warnings:

Currently we are using ember version 3.10 and we get these deprecation warnings:

  • The component:range-slider::ember6391#range computed property was just overriden. This removes the computed property and replaces it with a plain value, and has been deprecated. If you want this behavior, consider defining a setter which does it manually.

  • The component:range-slider::ember6391#format computed property was just overriden. This removes the computed property and replaces it with a plain value, and has been deprecated. If you want this behavior, consider defining a setter which does it manually.

Further information about these deprecations can be found here

Overriding Range as described in online docs is deprecated in Ember 3.9+

Some of the documentation's example show passing in a new range property.
eg: http://kennethkalmer.github.io/ember-cli-nouislider/#/options

{{range-slider start=40
               connect="lower"
               range=model.defaultRange}}

Since range is a computed property, starting in Ember 3.9 you will see a deprecation warning that this behavior will be going away (though not until 4.0)
https://deprecations.emberjs.com/v3.x/#toc_component-manager-string-lookup

Support for "set" and "slide" events

Hi Kenneth, thanks a lot for packaging this. I think its worth adding in support for the set and slide events from noUiSlider. It should be as simple as adding these two lines in range-slider.js exactly as you're capturing the change event.

this.$().on("slide", function() {
  _this.sendAction("slide", _this.slider.val());
});
this.$().on("set", function() {
   _this.sendAction("set", _this.slider.val());
});

You'll then be able to do something like this:

{{range-slider start=model.defaultStart range=model.defaultRange change="changeFired" slide="slideFired" set="setFired"}}

I tried forking to do a pull request but my clone doesn't like your use of "modelFor" in the example documentation so stopped.

I've verified this functionality works in a local extension of your component.

No getValues method available

I couldn't find an easy way to get the current value(s) rather than using callback methods and locally save the last set value.
It will be great to expose a property to just get the currently selected value(s).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.