angularjs-slider icon indicating copy to clipboard operation
angularjs-slider copied to clipboard

Disabled items in range

Open ivan-zakharchuk opened this issue 9 years ago • 11 comments

Hi, thank for awesome angular component.

I want to ask about possibility to make some disabled elements in range, e.g. when user move through points in range some of them can be disabled and the slider should omit them in his path or if several items one by one are disabled e.g. by left side prevent possibility to move slider left. So basically I understand that I can achieve this by using some decorators or events handling, but maybe this is easy reachable out of the box and you can point me to easier solution.

Thanks for your answer.

ivan-zakharchuk avatar Dec 18 '15 14:12 ivan-zakharchuk

As i see this is very close to stepsArray param, but i would be nice to expose some API(custom handler) that manage this array, or add some boolean options to supports arrays like: [{'value': 100, disabled: true}, {'value': 300, disabled: true}, {'value': 450, disabled: false}, ... ]

ivan-zakharchuk avatar Dec 18 '15 15:12 ivan-zakharchuk

Indeed this would be a good feature. However, for now, it's not possible and needs quite a lot of work. If you feel motivated to work on a PR, I can guide you but I don' think I'll do it in a near future.

ValentinH avatar Dec 18 '15 17:12 ValentinH

Actually this feature is required in project, so I'm motivated to add this feature asap and I'll work on this PR.

I've looked on the source code and think that maybe it would be good to enable this feature by adding some stepsArrayValue param to options which will contain string with path in case if stepsArray contain object values

e.g. for [{'value': 100, disabled: true}, {'value': 300, disabled: true}, {'value': 450, disabled: false}, ... ] stepsArrayValue will be just 'value' and also in this case we can handle disabled param at the root of array value object. Based on those params I may modify rest depended methods.

Please let me know what do you think about this way of solution and give me hint if you feel that it can be done somehow differently.

ivan-zakharchuk avatar Dec 18 '15 18:12 ivan-zakharchuk

This is a good news, it's always nice to get some help! :)

I don't have much preference about the implementation, since you are the one who needs it, you know what will be the best for a use point of view.

My only requirement is to avoid as much as possible any breaking change. Thus, I'd rather prefer to keep the current stepsArray as is and create a new option for this feature. Something like stepsObjectsArray or even better: keep only one option and check internally whether stepsArray contains string or objects...

ValentinH avatar Dec 18 '15 18:12 ValentinH

Ok, cool. Thank you for advice.

Maybe I'll ask you here again when I'll have some questions during implementation.

ivan-zakharchuk avatar Dec 18 '15 19:12 ivan-zakharchuk

Yes sure or you can create the PR as soon as you get a first commit so we can discuss as long as you go. ;) I'm planning to merge the quite big keyboardSupport PR this weekend so you might wait for it to avoid conflicts...

ValentinH avatar Dec 18 '15 19:12 ValentinH

Hi ivanzvakoms , I would like to know if this feature will be available anytime soon. Thank you!

corina10 avatar Feb 16 '16 10:02 corina10

Please check out my fork. I was trying to implement this thing for one of my projects. It may be not finished, could have missed somehting, when migrated to this project git. But the main idea is implemented and pretty simple. https://github.com/maximtitovich/angularjs-slider

maximtitovich avatar Jun 14 '17 15:06 maximtitovich

Indeed, your implementation looks simple, that's cool!

Could you submit a PR with a demo for this? You will need to generate the dist files so the demo works (check the Contributing guide).

I have started to set a demo up but the dist files are missing : http://jsfiddle.net/nd80d23z/

ValentinH avatar Jun 14 '17 15:06 ValentinH

I've compiled the sources and uploaded to my repo. But seems like, my solution only works for vertical slider. Needs an improvements for any version, but now i don't have time to imlement all this for all versions. Simple example http://jsfiddle.net/wmemf1r1/15/

maximtitovich avatar Jun 15 '17 10:06 maximtitovich

OK, up to you.

ValentinH avatar Jun 15 '17 11:06 ValentinH