diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..507d3c6 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: [ValentinH] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..6028c0c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,26 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +Demo: https://jsfiddle.net/wm3ce8jb/ (fork this example and update the link) + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. diff --git a/.gitignore b/.gitignore index eefbe2b..b2fa3c1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ bower_components/ temp/ tests/coverage/ yarn.lock -cypress/videos \ No newline at end of file +cypress/videos +npm-debug.log +.history/ \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..5660f81 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +registry=https://registry.npmjs.org/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3279a0b..ed21eeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,224 +1,375 @@ +# 7.0.1 (2021-09-06) + +## Bug fix + +- chore(styles): add parentheses around division-like expr's (#679) + +# 7.0.0 (2019-02-23) + +## Feature + +- feat(transition): slider moves are now animated. (this can be disabled via the `disableAnimation` option) + +## Bug fix + +- fix(vertical): Support switching between horizontal and vertical + +## Breaking change + +The module name was renamed from `rzModule` to `rzSlider`. + +# 6.7.0 (2019-02-23) + +## Feature + +- feat(ticks): add the option to use ticksArray as array of objects (#662, thanks @vdiez) + +# 6.6.0 (2018-06-29) + +## Feature + +- feat(range): adds the `restrictedRange` option (#638, thanks @DanielReid) + +## ⚠️ Unwanted breaking change ⚠️ + +Sorry for this, but this version is breaking if you are using the `rz-slider-tpl-url` attribute. You need to update your template to have the correct number of elements. + +# 6.5.1 (2018-03-30) + +## Bug fix + +- revert: onStart: Remove stop propagation call so events will bubble up (#612) + +# 6.5.0 (2018-02-06) + +## Feature + +- feat(\$compile): adds labelOverlapSeparator as an option (#616) + +# 6.4.4 (2018-01-24) + +## Bug fix + +- onStart: Remove stop propagation call so events will bubble up (#612) + # 6.4.3 (2017-12-01) + ## Bug fix + - Remove the semicolon at the end of the `dist/rzslider.css` file. It was introduced by previous release. # 6.4.2 (2017-11-30) + ## Bug fix + - Add a semicolon at the end of the `dist/rzslider.js` file. It avoids errors when people concat this file with other libs without using the minified version. # 6.4.1 (2017-11-17) + ## Bug fix + - Options: react to changes of options of Function type (#590) # 6.4.0 (2017-08-12) + ## Feature + - Add the `showOuterSelectionBars` option (#553). # 6.3.0 (2017-08-07) + ## Feature + - Handle different values for `showTicks` and `showTicksValues` (#550). # 6.2.3 (2017-07-08) + ## Tooling + - Add Typescript definition file. # 6.2.2 (2017-05-16) + ## Fixes + - Fix (again) onEnd event de-registration. # 6.2.1 (2017-05-15) + ## Fixes + - Fix onEnd event being sent several times on non-mobiles devices (#536) # 6.2.0 (2017-05-25) + ## New Feature + - Handle multi touch events on separate sliders (#535). Thanks @daniela-mateescu :) # 6.1.2 (2017-05-15) + ## Fixes + - Fix ticks and values at intermediate positions on IE (#531) # 6.1.1 (2017-03-29) + ## Fixes + - Add vendor prefixes for transform property in JS code (#518) # 6.1.0 (2017-03-06) + ## Features + - Add labelling options for a11y (#505) # 6.0.2 (2017-03-02) + ## Fixes + - Update the combined labels on separation (#502) # 6.0.1 (2017-02-14) + ## Fixes + - Ensure model value is current when custom translate function runs for tick values # 6.0.0 (2017-01-02) + ## Refactoring + - Refactor/simplify the css rules to ease the customisation. **You might want to check that all your custom styles are still correctly applied...** # 5.9.0 (2016-12-12) + ## Features + - Add selectionBarGradient option to customize the selection bar (#473) # 5.8.9 (2016-12-11) + ## Improvement + - Add autoprefixer for CSS builds (#472) # 5.8.8 (2016-12-11) + ## Fix + - Prevent angular being loaded twice when using with browserify (#474) # 5.8.7 (2016-11-09) + ## Fix + - Add Math.round for positions and dimensions - thanks to @DmitryKrekota (#454) # 5.8.6 (2016-11-08) + ## Fix + - Apply the pushRange with maxRange - thanks to @GuilloOme (#456) # 5.8.5 (2016-11-05) + ## Fix + - Fix overlapping max and ceil labels in some cases (#396) # 5.8.4 (2016-11-05) + ## Improvement + - Refactor autoHiding algorithm for labels (fix #446) # 5.8.3 (2016-11-03) + ## Improvement + - Generate a SCSS file (simple copy of the css file) in the dist folder so it can be imported (#449) # 5.8.2 (2016-11-03) + ## Fix + - Fix ceil label positioning (#448) # 5.8.1 (2016-10-27) + ## Fix + - Enable using with Browserify (#436) # 5.8.0 (2016-10-22) + ## Features + - Handle Date object in stepsArray (#424 ) ## Fixes + - Fix style for disabled range slider and ticks (#394) - Fix slider goes back when moved and scaled (#346) # 5.7.0 (2016-10-16) + ## Features + - Add a `logScale` option to display the slider using a logarithmic scale (#280). - Add `customValueToPosition` and `customPositionToValue` options to display the slider using a custom scale (#280). # 5.6.0 (2016-10-16) + ## Features + - Add a `ticksArray` option to display ticks at specific positions (#426). To enable this new feature, the way the ticks are rendered has been changed. Now each tick is positioned absolutely using a `transform: translate()` instruction. # 5.5.1 (2016-09-22) + ## Fix + - Prevent losing focus when slider is rerendered (#415). # 5.5.0 (2016-09-06) + ## Features + - Add an `autoHideLimitLabels` to disable the auto-hiding of limit labels (#405). # 5.4.3 (2016-08-07) + ## Fix + - Fix minLimit/maxLimit bugged for draggableRange (#384). # 5.4.2 (2016-08-02) + ## Fix + - Fix minimum value goes below floor when using maxRange (#377). # 5.4.1 (2016-07-17) + ## Fix + - Fix showing limit labels when pointer labels are always hidden (#373). # 5.4.0 (2016-07-13) + ## Features + - Add function to customize color of ticks (#372). # 5.3.0 (2016-07-11) + ## Features + - Expose labels on scope in template (#358). # 5.2.0 (2016-07-07) + ## Features + - Add a `customTemplateScope` option (#354). # 5.1.1 (2016-07-06) + ## Fix + - Fix the way to check when event properties are undefined (#365). # 5.1.0 (2016-07-02) + ## Features + - Add a `pushRange` option (#341). # 5.0.1 (2016-07-01) + ## Fix + - Switch from using opacity to visibility to show/hide elements (#362). # 5.0.0 (2016-06-30) + ## Fix + - AMD/CommonJS exported module: export module name instead of module (#360). ## Breaking change + Code that relies on the module object to be exported (accessing the name via .name for example) will break, since the name is now directly returned. # 4.1.0 (2016-06-30) + ## Improvement + - Add a `bindIndexForStepsArray` option that enable to use `stepsArray` with the same behavior as before 4.0 (#345). ## Fix + - Hide floor/ceil label when overlapped on combo label (#357). - Fix switching from steps array to regular steps (#361). # 4.0.2 (2016-06-07) + ## Improvement + - Add a `mergeRangeLabelsIfSame` option (#245). # 4.0.1 (2016-06-04) + ## Improvement + - Add a pointerType arg for the callbacks (onStart, onChange and onEnd) to identify which handle is used (#339). # 4.0.0 (2016-06-04) + ## Improvement + - `stepsArray`: Bind rzSliderModel and rzSliderHigh to the actual value (#335). ## Breaking changes + - From now on, when using the `stepsArray` feature, you should directly provide the actual value to rzSliderModel and rzSliderHigh instead of passing the index of this value. -Thus, you need to update your config like in the following example: + Thus, you need to update your config like in the following example: + ```js /* before 4.0 version */ vm.slider = { - value: 4, // index of the 'E' value in the array - options: { - stepsArray: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('') - } + value: 4, // index of the 'E' value in the array + options: { + stepsArray: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''), + }, } /* from 4.0 version */ vm.slider = { - value: 'E', - options: { - stepsArray: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('') - } + value: 'E', + options: { + stepsArray: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''), + }, } ``` # 3.0.0 (2016-06-02) + ## Features + - Add IE8 support (#314). - Consolidate onStart, onChange and onEnd for keyboard (#319). - Added `rz-floor` and `rz-ceil` classes to floor and ceil label to allow styling (#337). ## Breaking changes + - From now on, to allow the IE8 support, the directive is configured with `replace: true`. Thus, you need to update your custom CSS rules like in the following example: + ```css /* before 3.0 version */ rzslider { @@ -232,125 +383,174 @@ rzslider { ``` # 2.14.0 (2016-05-22) + ## Features + - Add `minLimit` and `maxLimit` options (#332). - Add a `maxRange` option (#333). - Add `boundPointerLabels` option (#323). # 2.13.0 (2016-04-24) + ## Features -- Add a `getLegend` option (#318). + +- Add a `getLegend` option (#318). - Handle objects in `stepsArray` that can contain `value` and `legend` properties. # 2.12.0 (2016-04-22) + ## Features + - Accept numbers for showTicks/showTicksValues to display ticks at intermediate positions (#264). # 2.11.0 (2016-04-01) + ## Features + - Add a hidePointerLabels option (#273). ## Fix + - Position long labels on vertical sliders correctly (#306). # 2.10.4 (2016-03-16) + ## Fix + - Fix the floor limit when floor is different than 0 (#293). # 2.10.3 (2016-03-14) + ## Fix + - Prefix all CSS classes with rz- to prevent conflicts (#292). # 2.10.2 (2016-03-01) + ## Bug fixes + - Remove the dist folder from gitignore. # 2.10.1 (2016-03-01) + ## Bug fixes + - Republish the npm module since dist files were missing. # 2.10.0 (2016-02-29) + ## Features + - Added `rightToLeft` option for RTL support (#270). Thanks @Liam-Ryan :). # 2.9.0 (2016-02-18) + ## Features + - Change `rzSliderOptions` to use expression binding (#266). # 2.8.0 (2016-02-08) + ## Features + - Add a `getPointerColor` option to dynamically change the pointers color (#253). # 2.7.1 (2016-02-06) + ## Fix + - Fix high label positioning when size is different than the ceil one. # 2.7.0 (2016-02-06) + ## Features + - Add an `enforceStep` option (defaults to true) (#246). - Add a `showSelectionBarFromValue` options (#250). - Use jqLite html() method to display label values so the translate function can return formated content (#251). - Pass a label string as third arg to the `translate` function to differentiate the labels (#252). ## Fix + - Improve combined label position and show only one value if min==max (#245). # 2.6.0 (2016-01-31) + ## Features + - Add a `noSwitching` option to prevent the user from switching the min and max handles (#233). ## Bug fixes + - Refactor the internal `roundStep` function that was too strict (5d130f09d). # 2.5.0 (2016-01-24) + ## Features + - Add a `minRange` option to set a minimal range (#231). - Pass the slider values to the `onStart`, `onChange` and `onEnd` callbacks. - Rollback and improve the callback changes brought with 2.4.1 that were no applying the last update to the scope anymore. # 2.4.1 (2016-01-15) + ## Performance improvements -- Remove the $timeout call in the init method (#223). -- Remove the $timeout call in the onStart callback. -- Remove the $timeout call in the onChange callback (#229). + +- Remove the \$timeout call in the init method (#223). +- Remove the \$timeout call in the onStart callback. +- Remove the \$timeout call in the onChange callback (#229). # 2.4.0 (2015-12-30) + ## Features + - Add an `enforceRange` options to round the `rzSliderModel` and `rzSliderHigh` to the slider range even when modified from outside the slider.(#208). - Add a `ticksTooltip` option used to display a tooltip when a tick is hovered (#209). - Add an `onlyBindHandles` option to only bind events on slider handles (#212). - Add a `showSelectionBarEnd` option to display the selection bar after the value (#214). ## Bug fixes + - Fix reset of maxH element (#204). - Change the watchers order to prevent unwanted model modifications (#207). # 2.3.0 (2015-12-22) + ## Features + - Add keyboard support (activated by default with `keyboardSupport` set to true) (#191). - Add a `draggableRangeOnly` options (#203). # 2.2.0 (2015-12-17) + ## Features + - Add a `getSelectionBarColor` option to dynamically change the selection bar color (#197). ## Bug fixes + - Fix negative float values rendering (#190). # 2.1.0 (2015-11-29) + ## Features + - Add a `vertical` options to display vertical sliders (#185). - Pass the options.id to the onStart, onChange and onEnd callbacks (#182). - Force labels to stay contained within element containing slider (#175). ## Bug fixes + - add vendor-prefix to `display: flex` used by ticks (#160). # 2.0.0 (2015-11-12) + ## Breaking changes + - All attributes except `rzSliderModel` and `rzSliderHigh` are moved to `rzSliderOptions`. (See the new documentation in ReadMe) ## Features + - Add a `rzSliderOptions` attribute to pass options to the slider. - Add a `RzSliderOptions.options()` method to set global options. - Add a `scale` option to fix sliders displayed in an element that uses `transform: scale(0.5)`. @@ -359,41 +559,42 @@ rzslider { - Add a `ticksValuesTooltip` option that is used to display a tooltip on the ticks values (requires angular-ui bootstrap). # 1.1.0 (2015-11-07) + ## Features + - Configurable update interval (#153) ## Bug fixes + - Update floor label so that it hides correctly when using single slider. (#155) - Fix ticks values when step is a float. - Remove the delta checking in updateLowHandle because it leads to hard-to-debug bugs. # 1.0.0 (2015-10-13) + - Rename the NPM package from jusas-angularjs-slider to angularjs-slider because jusas was added by mistake during a PR.- Start to use semantic versioning. # 0.1.36 (2015-10-12) ## Features -* Separate the LESS variables from the main file to ease versioning of local customisations. - +- Separate the LESS variables from the main file to ease versioning of local customisations. # 0.1.35 (2015-10-08) ## Features -* Add enabled/disabled option for slider: `rz-slider-disabled="boolean"` - +- Add enabled/disabled option for slider: `rz-slider-disabled="boolean"` # 0.1.34 (2015-10-03) ## Features -* Support ticks for range sliders and slider with always visible bars. - +- Support ticks for range sliders and slider with always visible bars. # 0.1.33 (2015-10-02) ## Features -* Add a `rzSliderShowTicks` to show a tick on each step. -* Add a `rzSliderShowTicksValue ` to show a tick and its value on each step. +- Add a `rzSliderShowTicks` to show a tick on each step. +- Add a `rzSliderShowTicksValue` to show a tick and its value on each step. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7b08f56..73b2fc3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,26 +1,28 @@ ## Reporting issues + Make sure the report is accompanied by a reproducible demo. The ideal demo is created by forking [our standard jsFiddle](http://jsfiddle.net/cwhgLcjv/), adding your own code and stripping it down to an absolute minimum needed to demonstrate the bug. ## Prettier + This project use [Prettier](https://github.com/prettier/prettier) for its code formatting. The goal is to be sure that all code pushed to this repository has the same style. A git hook is set up to format all the edited files on commit. ## Submittting a Pull Request To contribute to the project, please follow these steps: -1. Get approval for the idea by filing an issue and talking with me about the changes -2. Fork the repo -3. Make a branch for your change -4. Run `npm install` -5. Run `npm run test` -6. Make your changes -7. Test your changes (if you need a new test file, please copy the `test-template.js` file in the tests/specs folder.) -8. Run `npm run build` to generate the dist files -9. Run `git add -A` to add your changes -10. Run `npm run commit` (**Do not** use `git commit`) - follow the prompts to create your git message +1. Get approval for the idea by filing an issue and talking with me about the changes +2. Fork the repo +3. Make a branch for your change +4. Run `yarn` +5. Run `yarn test` +6. Make your changes +7. Test your changes (if you need a new test file, please copy the `test-template.js` file in the tests/specs folder.) +8. Run `yarn build` to generate the dist files +9. Run `git add -A` to add your changes +10. Run `yarn commit` (**Do not** use `git commit`) - follow the prompts to create your git message 11. Push your changes with `git push` 12. Create the Pull Request (a demo showing what the PR does is always good so you can fork [this fiddle](http://jsfiddle.net/cwhgLcjv/)) 13. If there are several commits, please [rebase](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request) and [squash](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request#squash-your-changes) everything to only get one commit. 14. Get merged and celebrate -**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github) +**Working on your first Pull Request?** You can learn how from this _free_ series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github) diff --git a/Gruntfile.js b/Gruntfile.js index 1724ba9..8d403f2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -59,7 +59,7 @@ module.exports = function(grunt) { removeScriptTypeAttributes: true, removeStyleLinkTypeAttributes: true, }, - module: 'rzModule', + module: 'rzSlider', url: function(url) { return url.replace('src/', '') }, diff --git a/README.md b/README.md index 397cf5e..d75b95d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ ## AngularJS 1.X slider directive with no external dependencies +Looking for an Angular version (> 1.X)? We got you covered: https://github.com/angular-slider/ngx-slider (Thanks [@piotrdz](https://github.com/piotrdz) :heart: )! + +
+ Status: ![Maintenance](https://img.shields.io/maintenance/support-only/2017.svg?style=flat-square) [![npm version](https://img.shields.io/npm/v/angularjs-slider.svg?style=flat-square)](https://www.npmjs.com/package/angularjs-slider) @@ -12,11 +16,7 @@ Links: [![Join the chat at https://gitter.im/rzajac/angularjs-slider](https://img.shields.io/badge/GITTER-join%20chat-1dce73.svg?style=flat-square)](https://gitter.im/rzajac/angularjs-slider?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) - - Sponsor - - -> I'm looking for a maintainer for this project. I have lost my [Open Source Stamina](https://medium.com/@kentcdodds/open-source-stamina-dafd063f9932#.sfay5wlzp) for this project and I will probably not push any code to this project anymore (unless, I find some motivation later). I will try to merge pull requests if some are submitted, but only if they are really clean. +> I'm looking for a maintainer for this project. I have lost my [Open Source Stamina](https://kentcdodds.com/blog/open-source-stamina) for this project and I will probably not push any code to this project anymore (unless, I find some motivation later). I will try to merge pull requests if some are submitted, but only if they are really clean. Slider directive implementation for AngularJS 1.X, without any dependencies: [http://angular-slider.github.io/angularjs-slider](http://angular-slider.github.io/angularjs-slider/index.html). @@ -42,80 +42,104 @@ Slider directive implementation for AngularJS 1.X, without any dependencies: [ht ## Examples +- **Simple example for single slider:** [http://jsfiddle.net/ValentinH/qjvxn4fc/](http://jsfiddle.net/ValentinH/qjvxn4fc/) +- **Simple example for double slider:** [http://jsfiddle.net/ValentinH/hnyL2axs/](http://jsfiddle.net/ValentinH/hnyL2axs/) - **Various examples:** [http://angular-slider.github.io/angularjs-slider](http://angular-slider.github.io/angularjs-slider/index.html) - **Same examples with live code:** https://jsfiddle.net/ValentinH/954eve2L/ ## Reporting issues -Make sure the report is accompanied by a reproducible demo. The ideal demo is created by forking [our standard jsFiddle](http://jsfiddle.net/cwhgLcjv/), adding your own code and stripping it down to an absolute minimum needed to demonstrate the bug. + +Make sure the report is accompanied by a reproducible demo. The ideal demo is created by forking [our standard jsFiddle](http://jsfiddle.net/ValentinH/qjvxn4fc/), adding your own code and stripping it down to an absolute minimum needed to demonstrate the bug. ## Common issues + ### My slider is not rendered correctly on load + If the slider's parent element is not visible during slider initialization, the slider can't know when its parent becomes visible. For instance, when displaying a slider inside an element which visibility is toggled using ng-show, you need to send an event to force it to redraw when you set your ng-show to true. Here's an example of `refreshSlider` method that you should call whenever the slider becomes visible. + ```js -vm.refreshSlider = function () { - $timeout(function () { - $scope.$broadcast('rzSliderForceRender'); - }); -}; +vm.refreshSlider = function() { + $timeout(function() { + $scope.$broadcast('rzSliderForceRender') + }) +} ``` + if you get some flickering issues, you can try to replace to `$timeout` call by `$scope.$$postDigest` as suggested by @maknapp in [this issue](https://github.com/angular-slider/angularjs-slider/issues/79#issuecomment-219213647). -**ng-show-example**: http://jsfiddle.net/3jjye1cL/ +**ng-show-example**: http://jsfiddle.net/ValentinH/nzL6ax43/ -**UI-Boostrap tabs example**: http://jsfiddle.net/0f7sd7dw/ +**UI-Boostrap tabs example**: http://jsfiddle.net/ValentinH/bo23er5w/ ### Decimal value can't be typed in an input field linked to the slider + By default, the slider value is always rounded to the nearest step. A side effect is that when a input field is linked to the slider in order to enable a user to directly type a value, the value is rounded when it doesn't match the step. Even worse, when using decimal values, when a user will type "0.", the `.` will directly be truncated since the value is rounded. **Solution**: To avoid the value to be rounded, you need to use the `enforceStep: false` option. Thus, the value can be modified externally without taking care of the step. See [#298](https://github.com/angular-slider/angularjs-slider/issues/298). - ## Installation ### NPM + ``` npm i angularjs-slider ``` + +or + +``` +yarn add angularjs-slider +``` + #### Typescript Support + Typescript definition files are provided with this project. To use them, be sure you have the angular type definition peer dependency installed. + ``` npm i @types/angular ``` + or + ### Bower + ``` $ bower install --save angularjs-slider ``` or + ### CDNJS + Directly use (replace `X.X.X` by the version you want to use): + - `https://cdnjs.cloudflare.com/ajax/libs/angularjs-slider/X.X.X/rzslider.min.js` - `https://cdnjs.cloudflare.com/ajax/libs/angularjs-slider/X.X.X/rzslider.min.css` - ## Project integration ### Imports + ```html - + - + ``` ### Module + ```javascript -angular.module('yourApp', ['rzModule']); +angular.module('yourApp', ['rzSlider']) ``` ### Single slider ```javascript // In your controller -$scope.priceSlider = 150; +$scope.priceSlider = 150 ``` ```html @@ -133,17 +157,19 @@ Above example would render a slider from 0 to 150. If you need floor and ceiling rz-slider-options="slider.options"> ``` + ```js $scope.slider = { value: 150, options: { floor: 0, - ceil: 450 - } -}; + ceil: 450, + }, +} ``` If you don't want to bother with an object set in your javascript file, you can pass an anonymous object literal to the slider options: + ```html
``` + ```js -$scope.value = 150; +$scope.value = 150 ``` ### Range slider @@ -164,9 +191,9 @@ $scope.slider = { max: 180, options: { floor: 0, - ceil: 450 - } -}; + ceil: 450, + }, +} ``` ```html @@ -191,6 +218,7 @@ $scope.slider = { > If you need to use a custom template, you can do so by providing a template URL to the `rz-slider-tpl-url` attribute. The default template is [this one](https://github.com/angular-slider/angularjs-slider/blob/master/src/rzSliderTpl.html). The following variables are available in the template as scope variables. + - `floorLabel`: The value set to `floor` in `rz-slider-options` - `ceilLabel`: The value set to `ceil` in `rz-slider-options` - `modelLabel`: The value set to `rz-slider-model` @@ -206,6 +234,7 @@ See the [Custom template to use angular directive for label](./demo/directiveInC > An object with all the other options of the slider. Each option can be updated at runtime and the slider will automatically be re-rendered. The default options are: + ```js { floor: 0, @@ -214,6 +243,8 @@ The default options are: precision: 0, minLimit: null, maxLimit: null, + restrictedRange: null, + skipRestrictedRangesWithArrowKeys: null, minRange: null, maxRange: null, pushRange: false, @@ -256,6 +287,7 @@ The default options are: reversedControls: false, boundPointerLabels: true, mergeRangeLabelsIfSame: false, + labelOverlapSeparator: ' - ', customTemplateScope: null, logScale: false, customValueToPosition: null, @@ -264,9 +296,10 @@ The default options are: ariaLabel: null, ariaLabelledBy: null, ariaLabelHigh: null, - ariaLabelledByHigh: null + ariaLabelledByHigh: null, + disableAnimation: false } -```` +``` **floor** - _Number (defaults to 0)_: Minimum value for a slider. @@ -274,27 +307,33 @@ The default options are: **step** - _Number (defaults to 1)_: Step between each value. -**precision** - _Number (defaults to 0)_: The precision to display values with. The `toFixed()` is used internally for this. +**precision** - _Number (defaults to 0)_: The precision to display values with (number of decimals to be displayed). The `toFixed()` is used internally for this. **minLimit** - _Number (defaults to null)_: The minimum value authorized on the slider. **maxLimit** - _Number (defaults to null)_: The maximum value authorized on the slider. -**minRange** - _Number (defaults to null)_: The minimum range authorized on the slider. *Applies to range slider only.* +**restrictedRange** - _Object (defaults to null)_: Has two _Number_ properties, _from_ and _to_ that determine the bounds of an area that is not authorized for values. Can also use an array. _Applies to range slider only._ + +**skipRestrictedRangesWithArrowKeys** - _Boolean (defaults to null)_: Set to true to skip restricted ranges with arrow keys. + +**minRange** - _Number (defaults to null)_: The minimum range authorized on the slider. _Applies to range slider only._ -**maxRange** - _Number (defaults to null)_: The maximum range authorized on the slider. *Applies to range slider only.* +**maxRange** - _Number (defaults to null)_: The maximum range authorized on the slider. _Applies to range slider only._ -**pushRange** - _Boolean (defaults to false)_: Set to true to have a push behavior. When the min handle goes above the max, the max is moved as well (and vice-versa). The range between min and max is defined by the `step` option (defaults to 1) and can also be override by the `minRange` option. *Applies to range slider only.* +**pushRange** - _Boolean (defaults to false)_: Set to true to have a push behavior. When the min handle goes above the max, the max is moved as well (and vice-versa). The range between min and max is defined by the `step` option (defaults to 1) and can also be override by the `minRange` option. _Applies to range slider only._ **translate** - _Function(value, sliderId, label)_: Custom translate function. Use this if you want to translate values displayed on the slider. `sliderId` can be used to determine the slider for which we are translating the value. `label` is a string that can take the following values: - - *'model'*: the model label - - *'high'*: the high label - - *'floor'*: the floor label - - *'ceil'*: the ceil label - - *'tick-value'*: the ticks labels + +- _'model'_: the model label +- _'high'_: the high label +- _'floor'_: the floor label +- _'ceil'_: the ceil label +- _'tick-value'_: the ticks labels For example if you want to display dollar amounts instead of just numbers: + ```html
``` + ```js $scope.slider = { value: 0, @@ -309,13 +349,14 @@ $scope.slider = { floor: 0, ceil: 100, translate: function(value) { - return '$' + value; - } - } -}; + return '$' + value + }, + }, +} ``` **getLegend** - _Function(value, sliderId)_: Use to display legend under ticks (thus, it needs to be used along with `showTicks` or `showTicksValues`). The function will be called with each tick value and returned content will be displayed under the tick as a legend. If the returned value is null, then no legend is displayed under the corresponding tick.You can also directly provide the legend values in the `stepsArray` option. + > In order to get enough space to display legends under the slider, you need to add the `with-legend` class to the slider component. The default margin-bottom is then 40px which is enough for legends that are displayed on 2 lines. If you need more, simply override the style for the class. **id** - _Any (defaults to null)_: If you want to use the same `translate` function for several sliders, just set the `id` to anything you want, and it will be passed to the `translate(value, sliderId)` function as a second argument. @@ -326,19 +367,19 @@ Just pass an array with each slider value and that's it; the floor, ceil and ste `stepsArray` can also be an array of objects or Dates like: ```js -[ - {value: 'A'}, // the display value will be *A* - {value: 10, legend: 'Legend for 10'}, // the display value will be 10 and a legend will be displayed under the corresponding tick. +;[ + { value: 'A' }, // the display value will be *A* + { value: 10, legend: 'Legend for 10' }, // the display value will be 10 and a legend will be displayed under the corresponding tick. new Date(2016, 7, 12), // the display value will be the default format of Date. To customize it, use the `translate` option - {value: new Date(2016, 7, 12), legend: 'Legend for 10'} // same as above but with a legend + { value: new Date(2016, 7, 12), legend: 'Legend for 10' }, // same as above but with a legend ] -```` +``` **bindIndexForStepsArray** - _Boolean (defaults to false)_: Set to true to bind the index of the selected item to `rz-slider-model` and `rz-slider-high`. (This was the default behavior prior to 4.0). -**draggableRange** - _Boolean (defaults to false)_: When set to true and using a range slider, the range can be dragged by the selection bar. *Applies to range slider only.* +**draggableRange** - _Boolean (defaults to false)_: When set to true and using a range slider, the range can be dragged by the selection bar. _Applies to range slider only._ -**draggableRangeOnly** - _Boolean (defaults to false)_: Same as draggableRange but the slider range can't be changed. *Applies to range slider only.* +**draggableRangeOnly** - _Boolean (defaults to false)_: Same as draggableRange but the slider range can't be changed. _Applies to range slider only._ **showSelectionBar** - _Boolean (defaults to false)_: Set to true to always show the selection bar before the slider handle. @@ -348,11 +389,11 @@ Just pass an array with each slider value and that's it; the floor, ceil and ste **showSelectionBarFromValue** - _Number (defaults to null)_: Set a number to draw the selection bar between this value and the slider handle. -**getSelectionBarColor** - _Function(value) or Function(minVal, maxVal) (defaults to null)_: Function that returns the current color of the selection bar. *If your color won't changed, don't use this option but set it through CSS.* If the returned color depends on a model value (either `rzScopeModel`or `'rzSliderHigh`), you should use the argument passed to the function. Indeed, when the function is called, there is no certainty that the model has already been updated. +**getSelectionBarColor** - _Function(value) or Function(minVal, maxVal) (defaults to null)_: Function that returns the current color of the selection bar. _If your color won't changed, don't use this option but set it through CSS._ If the returned color depends on a model value (either `rzScopeModel`or `'rzSliderHigh`), you should use the argument passed to the function. Indeed, when the function is called, there is no certainty that the model has already been updated. **getTickColor** - _Function(value) (defaults to null)_: Function that returns the color of a tick. showTicks must be enabled. -**getPointerColor** - _Function(value, pointerType) (defaults to null)_: Function that returns the current color of a pointer. *If your color won't changed, don't use this option but set it through CSS.* If the returned color depends on a model value (either `rzScopeModel`or `'rzSliderHigh`), you should use the argument passed to the function. Indeed, when the function is called, there is no certainty that the model has already been updated. To handle range slider pointers independently, you should evaluate pointerType within the given function where "min" stands for `rzScopeModel` and "max" for `rzScopeHigh` values. +**getPointerColor** - _Function(value, pointerType) (defaults to null)_: Function that returns the current color of a pointer. _If your color won't changed, don't use this option but set it through CSS._ If the returned color depends on a model value (either `rzScopeModel`or `'rzSliderHigh`), you should use the argument passed to the function. Indeed, when the function is called, there is no certainty that the model has already been updated. To handle range slider pointers independently, you should evaluate pointerType within the given function where "min" stands for `rzScopeModel` and "max" for `rzScopeHigh` values. **hidePointerLabels** - _Boolean (defaults to false)_: Set to true to hide pointer labels @@ -370,7 +411,7 @@ Just pass an array with each slider value and that's it; the floor, ceil and ste **showTicksValues** - _Boolean or Number (defaults to false)_: Set to true to display a tick and the step value for each step of the slider. Set a number to display ticks and the step value at intermediate positions. This number corresponds to the step between each tick. -**ticksArray** - _Array (defaults to null)_: Use to display ticks at specific positions. The array contains the index of the ticks that should be displayed. For example, [0, 1, 5] will display a tick for the first, second and sixth values. +**ticksArray** - _Array (defaults to null)_: Use to display ticks at specific positions. The array contains the index of the ticks that should be displayed. For example, [0, 1, 5] will display a tick for the first, second and sixth values. It also supports the `{ value: 0, legend: 'Bad' }` format to display a legend for each tick. **ticksTooltip** - _Function(value) (defaults to null)_: (requires angular-ui bootstrap) Used to display a tooltip when a tick is hovered. Set to a function that returns the tooltip content for a given value. @@ -382,7 +423,7 @@ Just pass an array with each slider value and that's it; the floor, ceil and ste **enforceRange** - _Boolean (defaults to false)_: Set to true to round the `rzSliderModel` and `rzSliderHigh` to the slider range even when modified from outside the slider. When set to false, if the model values are modified from outside the slider, they are not rounded but they are still rendered properly on the slider. -**noSwitching** - _Boolean (defaults to false)_: Set to true to prevent to user from switching the min and max handles. *Applies to range slider only.* +**noSwitching** - _Boolean (defaults to false)_: Set to true to prevent to user from switching the min and max handles. _Applies to range slider only._ **onlyBindHandles** - _Boolean (defaults to false)_: Set to true to only bind events on slider handles. @@ -390,6 +431,8 @@ Just pass an array with each slider value and that's it; the floor, ceil and ste **mergeRangeLabelsIfSame** - _Boolean (defaults to false)_: Set to true to merge the range labels if they are the same. For instance, if min and max are 50, the label will be "50 - 50" if `mergeRangeLabelsIfSame: false`, else "50". +**labelOverlapSeparator** - _String (defaults to ' - ')_: Separator to use when the labels overlap. For instance, if min and max are -1 and 1, the label will be "-1 .. 1" if `labelOverlapSeparator: ' .. '`. + **onStart** - _Function(sliderId, modelValue, highValue, pointerType)_: Function to be called when a slider update is started. If an id was set in the options, then it's passed to this callback. This callback is called before any update on the model. `pointerType` is either 'min' or 'max' depending on which handle is used. **onChange** - _Function(sliderId, modelValue, highValue, pointerType)_: Function to be called when rz-slider-model or rz-slider-high change. If an id was set in the options, then it's passed to this callback. `pointerType` is either 'min' or 'max' depending on which handle is used. @@ -402,21 +445,23 @@ Just pass an array with each slider value and that's it; the floor, ceil and ste _Changing this value at runtime is not currently supported._ **keyboardSupport** - _Boolean (defaults to true)_: Handles are focusable (on click or with tab) and can be modified using the following keyboard controls: - - Left/bottom arrows: -1 - - Right/top arrows: +1 - - Page-down: -10% - - Page-up: +10% - - Home: minimum value - - End: maximum value + +- Left/bottom arrows: -1 +- Right/top arrows: +1 +- Page-down: -10% +- Page-up: +10% +- Home: minimum value +- End: maximum value **reversedControls** - _Boolean (defaults to false)_: Set to true to reverse keyboard navigation: - - Right/top arrows: -1 - - Left/bottom arrows: +1 - - Page-up: -10% - - Page-down: +10% - - End: minimum value - - Home: maximum value - + +- Right/top arrows: -1 +- Left/bottom arrows: +1 +- Page-up: -10% +- Page-down: +10% +- End: minimum value +- Home: maximum value + **customTemplateScope** - _Object (default to null)_: The properties defined in this object will be exposed in the slider template under `custom.X`. **logScale** - _Boolean (defaults to false)_: Set to true to use a logarithmic scale to display the slider. @@ -433,14 +478,17 @@ For custom scales: **ariaLabelledBy and ariaLabelledByHigh** - _String (default to null)_: Use instead of ariaLabel and ariaLabelHigh to reference the id of an element which will be used to label the slider(s). Adds the `aria-labelledby` attribute. +**disableAnimation** - _Boolean (defaults to false)_: Set to true to disable slider animation. + ## Change default options + If you want the change the default options for all the sliders displayed in your application, you can set them using the `RzSliderOptions.options()` method: + ```js -angular.module('App', ['rzModule']) - .run(function( RzSliderOptions ) { - // show ticks for all sliders - RzSliderOptions.options( { showTicks: true } ); - }); +angular.module('App', ['rzSlider']).run(function(RzSliderOptions) { + // show ticks for all sliders + RzSliderOptions.options({ showTicks: true }) +}) ``` ## Slider events @@ -452,9 +500,9 @@ You can also force redraw with **rzSliderForceRender** event. At the end of each "slide" slider emits `slideEnded` event. ```javascript -$scope.$on("slideEnded", function() { - // user finished sliding a handle -}); +$scope.$on('slideEnded', function() { + // user finished sliding a handle +}) ``` ## Browser support diff --git a/bower.json b/bower.json index 8b62cbb..e1e88c1 100644 --- a/bower.json +++ b/bower.json @@ -1,13 +1,14 @@ { "name": "angularjs-slider", - "version": "6.4.3", + "version": "7.0.1", "homepage": "https://github.com/angular-slider/angularjs-slider", "authors": [ "Rafal Zajac ", "Valentin Hervieu ", "Jussi Saarivirta " ], - "description": "AngularJS slider directive with no external dependencies. Mobile friendly!", + "description": + "AngularJS slider directive with no external dependencies. Mobile friendly!", "main": ["dist/rzslider.js", "dist/rzslider.css"], "keywords": ["angularjs", "slider"], "license": "MIT", diff --git a/demo/demo.js b/demo/demo.js index 5704846..0911e87 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -1,9 +1,9 @@ -var app = angular.module('rzSliderDemo', ['rzModule', 'ui.bootstrap']) +var app = angular.module('rzSliderDemo', ['rzSlider', 'ui.bootstrap']) app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { //Minimal slider config $scope.minSlider = { - value: 10 + value: 10, } $scope.debugSlider = { value: 50, @@ -13,8 +13,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, ceil: 100, step: 5, - showSelectionBar: true - } + showSelectionBar: true, + }, } //Range slider config @@ -24,8 +24,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { options: { floor: 0, ceil: 100, - step: 1 - } + step: 1, + }, } $scope.customSlider = { @@ -35,8 +35,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, ceil: 100, step: 10, - showTicks: true - } + showTicks: true, + }, } //Range slider with minLimit and maxLimit config @@ -47,8 +47,39 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { ceil: 100, step: 1, minLimit: 10, - maxLimit: 90 - } + maxLimit: 90, + }, + } + + $scope.restrictedRangeSlider = { + minValue: 10, + maxValue: 90, + options: { + restrictedRange: { + from: 30, + to: 70, + }, + floor: 0, + ceil: 100, + step: 1, + }, + } + + // Restricted range with multiple array and the feature skipRestrictedRangesWithArrowKeys + $scope.multipleRestrictedRangeSlider = { + minValue: 10, + maxValue: 90, + options: { + restrictedRange: [ + { from: 20, to: 30 }, + { from: 50, to: 60 }, + { from: 75, to: 85 }, + ], + skipRestrictedRangesWithArrowKeys: true, + floor: 0, + ceil: 100, + step: 1, + }, } //Range slider with minRange and maxRange config @@ -60,8 +91,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { ceil: 100, step: 1, minRange: 10, - maxRange: 50 - } + maxRange: 50, + }, } //Range slider with noSwitching config @@ -72,8 +103,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, ceil: 100, step: 1, - noSwitching: true - } + noSwitching: true, + }, } //Range slider with minRange and pushRange config @@ -84,8 +115,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, ceil: 100, minRange: 10, - pushRange: true - } + pushRange: true, + }, } $scope.outerBarsRangeSlider = { @@ -95,16 +126,16 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, ceil: 100, step: 1, - showOuterSelectionBars: true - } + showOuterSelectionBars: true, + }, } //Slider with selection bar $scope.slider_visible_bar = { value: 10, options: { - showSelectionBar: true - } + showSelectionBar: true, + }, } //Slider with selection bar end @@ -112,8 +143,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { value: 10, options: { ceil: 100, - showSelectionBarEnd: true - } + showSelectionBarEnd: true, + }, } //Slider with selection bar from value @@ -123,8 +154,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: -100, ceil: 100, step: 10, - showSelectionBarFromValue: 0 - } + showSelectionBarFromValue: 0, + }, } //Slider with selection bar gradient @@ -136,9 +167,9 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { showSelectionBar: true, selectionBarGradient: { from: 'white', - to: '#0db9f0' - } - } + to: '#0db9f0', + }, + }, } //Slider with selection bar color @@ -151,8 +182,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { if (value <= 6) return 'orange' if (value <= 9) return 'yellow' return '#2AE02A' - } - } + }, + }, } //Slider with pointer color @@ -164,8 +195,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { if (value <= 6) return 'orange' if (value <= 9) return 'yellow' return '#2AE02A' - } - } + }, + }, } //Slider config with floor, ceil and step @@ -174,8 +205,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { options: { floor: 10, ceil: 100, - step: 5 - } + step: 5, + }, } //Slider config with logarithmic scale @@ -185,8 +216,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 1, ceil: 100, logScale: true, - showTicks: true - } + showTicks: true, + }, } //Slider config with custom scale @@ -209,8 +240,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { maxVal = Math.sqrt(maxVal) var value = percent * (maxVal - minVal) + minVal return Math.pow(value, 2) - } - } + }, + }, } //Right to left slider with floor, ceil and step @@ -220,8 +251,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 10, ceil: 100, step: 5, - rightToLeft: true - } + rightToLeft: true, + }, } //Slider config with callbacks @@ -239,14 +270,14 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { onEnd: function(id, newValue, highValue, pointerType) { console.info('end', id, newValue, pointerType) $scope.otherData.end = newValue * 10 - } - } + }, + }, } $scope.otherData = { start: 0, change: 0, - end: 0 + end: 0, } //Slider config with custom display function @@ -260,8 +291,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { translate: function(value, id, which) { console.info(value, id, which) return '$' + value - } - } + }, + }, } //Slider config with custom display function using html formatting @@ -280,16 +311,16 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { default: return '$' + value } - } - } + }, + }, } //Slider config with steps array of letters $scope.slider_alphabet = { value: 'E', options: { - stepsArray: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('') - } + stepsArray: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.split(''), + }, } //Slider with ticks @@ -298,8 +329,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { options: { ceil: 10, floor: 0, - showTicks: true - } + showTicks: true, + }, } //Slider with ticks at specific positions @@ -308,8 +339,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { options: { ceil: 10, floor: 0, - ticksArray: [0, 1, 3, 8, 10] - } + ticksArray: [0, 1, 3, 8, 10], + }, } //Slider with ticks and tooltip @@ -321,8 +352,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { showTicks: true, ticksTooltip: function(v) { return 'Tooltip for ' + v - } - } + }, + }, } //Slider with ticks and values @@ -334,8 +365,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { showTicksValues: true, ticksValuesTooltip: function(v) { return 'Tooltip for ' + v - } - } + }, + }, } //Range slider with ticks and values @@ -345,8 +376,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { options: { ceil: 10, floor: 0, - showTicksValues: true - } + showTicksValues: true, + }, } //Slider with ticks at intermediate positions @@ -355,8 +386,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { options: { ceil: 1000, floor: 0, - showTicks: 100 - } + showTicks: 100, + }, } //Slider with ticks and values at intermediate positions @@ -365,8 +396,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { options: { ceil: 1000, floor: 0, - showTicksValues: 100 - } + showTicksValues: 100, + }, } //Slider with ticks values and legend @@ -383,9 +414,9 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { { value: 6 }, { value: 7, legend: 'Good' }, { value: 8 }, - { value: 9, legend: 'Excellent' } - ] - } + { value: 9, legend: 'Excellent' }, + ], + }, } //Slider with custom tick formatting @@ -402,8 +433,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { if (value < 600) return 'orange' if (value < 900) return 'yellow' return '#2AE02A' - } - } + }, + }, } var dates = [] @@ -417,8 +448,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { translate: function(date) { if (date != null) return date.toDateString() return '' - } - } + }, + }, } //Slider with draggable range @@ -428,8 +459,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { options: { ceil: 10, floor: 0, - draggableRange: true - } + draggableRange: true, + }, } //Slider with draggable range only @@ -439,8 +470,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { options: { ceil: 10, floor: 0, - draggableRangeOnly: true - } + draggableRangeOnly: true, + }, } //Vertical sliders @@ -450,12 +481,7 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, ceil: 10, vertical: true, - showSelectionBarEnd: true, - selectionBarGradient: { - from: 'white', - to: '#0db9f0' - } - } + }, } $scope.verticalSlider2 = { minValue: 20, @@ -464,11 +490,7 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, ceil: 100, vertical: true, - selectionBarGradient: { - from: 'white', - to: '#0db9f0' - } - } + }, } $scope.verticalSlider3 = { value: 5, @@ -477,8 +499,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { ceil: 10, vertical: true, ticksArray: [0, 1, 5, 10], - showTicksValues: true - } + showTicksValues: true, + }, } $scope.verticalSlider4 = { minValue: 1, @@ -487,8 +509,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, ceil: 6, vertical: true, - showTicksValues: true - } + showTicksValues: true, + }, } $scope.verticalSlider5 = { value: 50, @@ -496,8 +518,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, ceil: 100, vertical: true, - showSelectionBar: true - } + showSelectionBar: true, + }, } $scope.verticalSlider6 = { value: 6, @@ -509,8 +531,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { showTicksValues: true, ticksValuesTooltip: function(v) { return 'Tooltip for ' + v - } - } + }, + }, } //Read-only slider @@ -519,8 +541,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { options: { ceil: 100, floor: 0, - readOnly: true - } + readOnly: true, + }, } //Disabled slider @@ -532,8 +554,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, showTicks: 10, disabled: true, - draggableRange: true - } + draggableRange: true, + }, } // Slider inside ng-show @@ -542,8 +564,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { value: 5, options: { ceil: 10, - floor: 0 - } + floor: 0, + }, } $scope.toggle = function() { $scope.visible = !$scope.visible @@ -555,12 +577,12 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { //Slider inside modal $scope.percentages = { normal: { - low: 15 + low: 15, }, range: { low: 10, - high: 50 - } + high: 50, + }, } $scope.openModal = function() { var modalInstance = $uibModal.open({ @@ -576,12 +598,12 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { floor: 0, ceil: 100, translate: formatToPercentage, - showSelectionBar: true + showSelectionBar: true, } $scope.percentages.range.options = { floor: 0, ceil: 100, - translate: formatToPercentage + translate: formatToPercentage, } $scope.ok = function() { $uibModalInstance.close($scope.percentages) @@ -593,8 +615,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { resolve: { values: function() { return $scope.percentages - } - } + }, + }, }) modalInstance.result.then(function(percentages) { $scope.percentages = percentages @@ -607,11 +629,11 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { //Slider inside tabs $scope.tabSliders = { slider1: { - value: 100 + value: 100, }, slider2: { - value: 200 - } + value: 200, + }, } $scope.refreshSlider = function() { $timeout(function() { @@ -625,8 +647,8 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { maxValue: 80, options: { floor: 0, - ceil: 100 - } + ceil: 100, + }, } //Slider with draggable range @@ -643,8 +665,9 @@ app.controller('MainCtrl', function($scope, $rootScope, $timeout, $uibModal) { readOnly: false, disabled: false, showTicks: false, - showTicksValues: false - } + showTicksValues: false, + vertical: false, + }, } $scope.toggleHighValue = function() { if ($scope.slider_all_options.maxValue != null) { @@ -666,6 +689,6 @@ app.directive('clickableLabel', function() { scope.onclick = function(label) { alert("I'm " + label) } - } + }, } }) diff --git a/demo/directiveInCustomTemplate.html b/demo/directiveInCustomTemplate.html index a2d001a..6009f92 100644 --- a/demo/directiveInCustomTemplate.html +++ b/demo/directiveInCustomTemplate.html @@ -1,8 +1,17 @@
+ + + + + + - - - + + + + + + {{floorLabel}} diff --git a/demo/index.html b/demo/index.html index b65f575..59c8798 100644 --- a/demo/index.html +++ b/demo/index.html @@ -54,6 +54,27 @@

Range slider with min limit set to 10 and max limit set to 90

> +
+

Range slider with restricted area from 30 to 70

+ +
+ +
+

Range slider with multiple restricted area from 20 to 30, 50 to 60 and 75 to 85 +
+ and the feature that skip restricted ranges with arrow keys +

+ +
+

Range slider with minimum range of 10 and maximum of 50

Slider with all options demo


- +
+
, Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - +/*! angularjs-slider - v7.1.0 - + (c) Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - https://github.com/angular-slider/angularjs-slider - - 2017-12-01 */ + 2022-05-26 */ .rzslider { position: relative; display: inline-block; @@ -15,6 +15,10 @@ user-select: none; } +.rzslider.noanimate * { + transition: none !important; +} + .rzslider.with-legend { margin-bottom: 40px; } @@ -64,6 +68,7 @@ padding-top: 16px; margin-top: -16px; box-sizing: border-box; + transition: all linear 0.3s; } .rzslider .rz-draggable { @@ -95,6 +100,13 @@ z-index: 2; background: #0db9f0; border-radius: 2px; + transition: background-color linear 0.3s; +} + +.rzslider .rz-restricted { + z-index: 3; + background: #ff0000; + border-radius: 2px; } .rzslider .rz-pointer { @@ -105,6 +117,7 @@ cursor: pointer; background-color: #0db9f0; border-radius: 16px; + transition: all linear 0.3s; } .rzslider .rz-pointer:after { @@ -135,10 +148,12 @@ padding: 1px 3px; color: #55637d; cursor: default; + transition: all linear 0.3s; } .rzslider .rz-bubble.rz-limit { color: #55637d; + transition: none; } .rzslider .rz-ticks { @@ -169,6 +184,7 @@ cursor: pointer; background: #d8e0f3; border-radius: 50%; + transition: background-color linear 0.3s; } .rzslider .rz-tick.rz-selected { @@ -178,8 +194,7 @@ .rzslider .rz-tick-value { position: absolute; top: -30px; - -webkit-transform: translate(-50%, 0); - transform: translate(-50%, 0); + transform: translate(-50%, 0); } .rzslider .rz-tick-legend { @@ -187,8 +202,7 @@ top: 24px; max-width: 50px; white-space: normal; - -webkit-transform: translate(-50%, 0); - transform: translate(-50%, 0); + transform: translate(-50%, 0); } .rzslider.rz-vertical { @@ -251,8 +265,7 @@ .rzslider.rz-vertical .rz-tick-value { top: auto; left: 24px; - -webkit-transform: translate(0, -28%); - transform: translate(0, -28%); + transform: translate(0, -28%); } .rzslider.rz-vertical .rz-tick-legend { @@ -260,8 +273,7 @@ right: 24px; max-width: none; white-space: nowrap; - -webkit-transform: translate(0, -28%); - transform: translate(0, -28%); + transform: translate(0, -28%); } .rzslider.rz-vertical .rz-ticks-values-under .rz-tick-value { @@ -269,4 +281,4 @@ bottom: auto; left: auto; } -/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ6c2xpZGVyLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O2NBR2M7QUFDZDtFQUNFLG1CQUFtQjtFQUNuQixzQkFBc0I7RUFDdEIsWUFBWTtFQUNaLFlBQVk7RUFDWixzQkFBc0I7RUFDdEIsdUJBQXVCO0VBQ3ZCLDBCQUFrQjtLQUFsQix1QkFBa0I7TUFBbEIsc0JBQWtCO1VBQWxCLGtCQUFrQjtDQUNuQjs7QUFFRDtFQUNFLG9CQUFvQjtDQUNyQjs7QUFFRDtFQUNFLG9CQUFvQjtDQUNyQjs7QUFFRDtFQUNFLG9CQUFvQjtFQUNwQiwwQkFBMEI7Q0FDM0I7O0FBRUQ7RUFDRSxvQkFBb0I7Q0FDckI7O0FBRUQ7RUFDRSxvQkFBb0I7Q0FDckI7O0FBRUQ7RUFDRSxvQkFBb0I7Q0FDckI7O0FBRUQ7RUFDRSxvQkFB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ec697 100644 --- a/dist/rzslider.d.ts +++ b/dist/rzslider.d.ts @@ -25,7 +25,14 @@ declare module "angular" { minLimit?: number; /** Number (defaults to null): The maximum value authorized on the slider. */ maxLimit?: number; - /** Number (defaults to null): The minimum range authorized on the slider. Applies to range slider only. */ + /** + * Object(defaults to null): Has two _Number_ properties, _from_ and _to_ that determine + * the bounds of an area that is not authorized for values. _Applies to range slider only._ + */ + restrictedRange?: { from: number, to: number } | Array<{from: number, to: number}>; + /** Number (defaults to null): The minimum range authorized on the slider. Applies to range slider only. Can also use an array.*/ + skipRestrictedRangesWithArrowKeys?: boolean + /** Set to true to skip restricted ranges with arrow keys. */ minRange?: number; /** Number (defaults to null): The maximum range authorized on the slider. Applies to range slider only. */ maxRange?: number; @@ -70,7 +77,7 @@ declare module "angular" { * {value: 10, legend: 'Legend for 10'} // the display value will be 10 and a legend will be displayed under the corresponding tick. * ] */ - stepsArray?: any[]; + stepsArray?: number[] | Array<{value: number; legend?: string}>; /** * Boolean (defaults to false): Set to true to bind the index of the selected item to rz-slider-model and rz-slider-high. * (This was the default behavior prior to 4.0). @@ -126,8 +133,8 @@ declare module "angular" { showTicks?: boolean | number; /** Boolean or Number (defaults to false): Set to true to display a tick and the step value for each step of the slider. Set an integer to display ticks and the step value at intermediate positions. */ showTicksValues?: boolean | number; - /** Array (defaults to null): Use to display ticks at specific positions. The array contains the index of the ticks that should be displayed. For example, [0, 1, 5] will display a tick for the first, second and sixth values. */ - ticksArray?: number[]; + /** Array (defaults to null): Use to display ticks at specific positions. The array contains the index of the ticks that should be displayed. For example, [0, 1, 5] will display a tick for the first, second and sixth values. It also supports the { value: 0, legend: 'Bad' } format to display a legend for each tick. */ + ticksArray?: number[] | Array<{value: number; legend?: string}>; /** Function(value) (defaults to null): (requires angular-ui bootstrap) Used to display a tooltip when a tick is hovered. Set to a function that returns the tooltip content for a given value. */ ticksTooltip?: (value: number) => string; /** Function(value) (defaults to null): Same as ticksTooltip but for ticks values. */ @@ -146,6 +153,8 @@ declare module "angular" { boundPointerLabels?: boolean; /** Boolean (defaults to false): Set to true to merge the range labels if they are the same. For instance, if min and max are 50, the label will be "50 - 50" if mergeRangeLabelsIfSame: false, else "50". */ mergeRangeLabelsIfSame?: boolean; + /** String (defaults to ' - '): Separator to use when the labels overlap. For instance, if min and max are -1 and 1, the label will be "-1 .. 1" if `labelOverlapSeparator: ' .. '`. */ + labelOverlapSeparator?: string; /** Function(sliderId, modelValue, highValue, pointerType): Function to be called when a slider update is started. If an id was set in the options, then it's passed to this callback. This callback is called before any update on the model. pointerType is either 'min' or 'max' depending on which handle is used. */ onStart?: RzCallback; /** @@ -201,6 +210,8 @@ declare module "angular" { ariaLabelledBy?: string; /** String(default to null): Use instead of ariaLabel and ariaLabelHigh to reference the id of an element which will be used to label the slider(s). Adds the aria-labelledby attribute. */ ariaLabelledByHigh?: string; + /** Boolean (defaults to false): Set to true to disable slider animation. */ + disableAnimation?: boolean; } } } diff --git a/dist/rzslider.js b/dist/rzslider.js index 6c66cdf..c8fdfd5 100644 --- a/dist/rzslider.js +++ b/dist/rzslider.js @@ -1,7 +1,7 @@ -/*! angularjs-slider - v6.4.2 - - (c) Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - +/*! angularjs-slider - v7.1.0 - + (c) Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - https://github.com/angular-slider/angularjs-slider - - 2017-12-01 */ + 2022-05-26 */ /*jslint unparam: true */ /*global angular: false, console: false, define, module */ ;(function(root, factory) { @@ -27,7 +27,7 @@ })(this, function(angular) { 'use strict' var module = angular - .module('rzModule', []) + .module('rzSlider', []) .factory('RzSliderOptions', function() { var defaultOptions = { floor: 0, @@ -36,6 +36,8 @@ precision: 0, minRange: null, maxRange: null, + restrictedRange: null, + skipRestrictedRangesWithArrowKeys: null, pushRange: false, minLimit: null, maxLimit: null, @@ -71,6 +73,7 @@ enforceRange: false, noSwitching: false, onlyBindHandles: false, + disableAnimation: false, onStart: null, onChange: null, onEnd: null, @@ -78,6 +81,7 @@ reversedControls: false, boundPointerLabels: true, mergeRangeLabelsIfSame: false, + labelOverlapSeparator: ' - ', customTemplateScope: null, logScale: false, customValueToPosition: null, @@ -86,20 +90,20 @@ ariaLabel: null, ariaLabelledBy: null, ariaLabelHigh: null, - ariaLabelledByHigh: null + ariaLabelledByHigh: null, } var globalOptions = {} var factory = {} /** - * `options({})` allows global configuration of all sliders in the - * application. - * - * var app = angular.module( 'App', ['rzModule'], function( RzSliderOptions ) { - * // show ticks for all sliders - * RzSliderOptions.options( { showTicks: true } ); - * }); - */ + * `options({})` allows global configuration of all sliders in the + * application. + * + * var app = angular.module( 'App', ['rzSlider'], function( RzSliderOptions ) { + * // show ticks for all sliders + * RzSliderOptions.options( { showTicks: true } ); + * }); + */ factory.options = function(value) { angular.extend(globalOptions, value) } @@ -112,15 +116,15 @@ }) .factory('rzThrottle', ['$timeout', function($timeout) { /** - * rzThrottle - * - * Taken from underscore project - * - * @param {Function} func - * @param {number} wait - * @param {ThrottleOptions} options - * @returns {Function} - */ + * rzThrottle + * + * Taken from underscore project + * + * @param {Function} func + * @param {number} wait + * @param {ThrottleOptions} options + * @returns {Function} + */ return function(func, wait, options) { 'use strict' /* istanbul ignore next */ @@ -168,168 +172,173 @@ 'use strict' /** - * Slider - * - * @param {ngScope} scope The AngularJS scope - * @param {Element} sliderElem The slider directive element wrapped in jqLite - * @constructor - */ - var Slider = function(scope, sliderElem) { - /** - * The slider's scope + * Slider * - * @type {ngScope} + * @param {ngScope} scope The AngularJS scope + * @param {Element} sliderElem The slider directive element wrapped in jqLite + * @constructor */ + var Slider = function(scope, sliderElem) { + /** + * The slider's scope + * + * @type {ngScope} + */ this.scope = scope /** - * The slider inner low value (linked to rzSliderModel) - * @type {number} - */ + * The slider inner low value (linked to rzSliderModel) + * @type {number} + */ this.lowValue = 0 /** - * The slider inner high value (linked to rzSliderHigh) - * @type {number} - */ + * The slider inner high value (linked to rzSliderHigh) + * @type {number} + */ this.highValue = 0 /** - * Slider element wrapped in jqLite - * - * @type {jqLite} - */ + * Slider element wrapped in jqLite + * + * @type {jqLite} + */ this.sliderElem = sliderElem /** - * Slider type - * - * @type {boolean} Set to true for range slider - */ + * Slider type + * + * @type {boolean} Set to true for range slider + */ this.range = this.scope.rzSliderModel !== undefined && this.scope.rzSliderHigh !== undefined /** - * Values recorded when first dragging the bar - * - * @type {Object} - */ + * Values recorded when first dragging the bar + * + * @type {Object} + */ this.dragging = { active: false, value: 0, difference: 0, position: 0, lowLimit: 0, - highLimit: 0 + highLimit: 0, } /** - * property that handle position (defaults to left for horizontal) - * @type {string} - */ + * property that handle position (defaults to left for horizontal) + * @type {string} + */ this.positionProperty = 'left' /** - * property that handle dimension (defaults to width for horizontal) - * @type {string} - */ + * property that handle dimension (defaults to width for horizontal) + * @type {string} + */ this.dimensionProperty = 'width' /** - * Half of the width or height of the slider handles - * - * @type {number} - */ + * Half of the width or height of the slider handles + * + * @type {number} + */ this.handleHalfDim = 0 /** - * Maximum position the slider handle can have - * - * @type {number} - */ + * Maximum position the slider handle can have + * + * @type {number} + */ this.maxPos = 0 /** - * Precision - * - * @type {number} - */ + * Precision + * + * @type {number} + */ this.precision = 0 /** - * Step - * - * @type {number} - */ + * Step + * + * @type {number} + */ this.step = 1 /** - * The name of the handle we are currently tracking - * - * @type {string} - */ + * The name of the handle we are currently tracking + * + * @type {string} + */ this.tracking = '' /** - * Minimum value (floor) of the model - * - * @type {number} - */ + * Minimum value (floor) of the model + * + * @type {number} + */ this.minValue = 0 /** - * Maximum value (ceiling) of the model - * - * @type {number} - */ + * Maximum value (ceiling) of the model + * + * @type {number} + */ this.maxValue = 0 /** - * The delta between min and max value - * - * @type {number} - */ + * The delta between min and max value + * + * @type {number} + */ this.valueRange = 0 /** - * If showTicks/showTicksValues options are number. - * In this case, ticks values should be displayed below the slider. - * @type {boolean} - */ + * If showTicks/showTicksValues options are number. + * In this case, ticks values should be displayed below the slider. + * @type {boolean} + */ this.intermediateTicks = false /** - * Set to true if init method already executed - * - * @type {boolean} - */ + * Set to true if init method already executed + * + * @type {boolean} + */ this.initHasRun = false /** - * Used to call onStart on the first keydown event - * - * @type {boolean} - */ + * Used to call onStart on the first keydown event + * + * @type {boolean} + */ this.firstKeyDown = false /** - * Internal flag to prevent watchers to be called when the sliders value are modified internally. - * @type {boolean} - */ + * Internal flag to prevent watchers to be called when the sliders value are modified internally. + * @type {boolean} + */ this.internalChange = false /** - * Internal flag to keep track of the visibility of combo label - * @type {boolean} - */ + * Internal flag to keep track of the visibility of combo label + * @type {boolean} + */ this.cmbLabelShown = false /** - * Internal variable to keep track of the focus element - */ + * Internal variable to keep track of the focus element + */ this.currentFocusElement = null + /** + * Internal variable to know if we are already moving + */ + this.moving = false + // Slider DOM elements wrapped in jqLite this.fullBar = null // The whole slider bar this.selBar = null // Highlight between two handles @@ -349,10 +358,10 @@ // Add instance methods Slider.prototype = { /** - * Initialize slider - * - * @returns {undefined} - */ + * Initialize slider + * + * @returns {undefined} + */ init: function() { var thrLow, thrHigh, @@ -370,6 +379,7 @@ this.setDisabledState() this.calcViewDimensions() this.setMinAndMax() + this.updateRestrictionBar() this.addAccessibility() this.updateCeilLab() this.updateFloorLab() @@ -384,6 +394,10 @@ this.initHasRun = true + if (this.options.disableAnimation) { + this.sliderElem.addClass('noanimate') + } + // Watch for changes to the model thrLow = rzThrottle(function() { self.onLowHandleChange() @@ -507,8 +521,8 @@ }, /* - * Reflow the slider when the low handle changes (called with throttle) - */ + * Reflow the slider when the low handle changes (called with throttle) + */ onLowHandleChange: function() { this.syncLowValue() if (this.range) this.syncHighValue() @@ -523,8 +537,8 @@ }, /* - * Reflow the slider when the high handle changes (called with throttle) - */ + * Reflow the slider when the high handle changes (called with throttle) + */ onHighHandleChange: function() { this.syncLowValue() this.syncHighValue() @@ -537,8 +551,8 @@ }, /** - * Read the user options and apply them to the slider model - */ + * Read the user options and apply them to the slider model + */ applyOptions: function() { var sliderOptions if (this.scope.rzSliderOptions) @@ -591,6 +605,9 @@ if (this.options.vertical) { this.positionProperty = 'bottom' this.dimensionProperty = 'height' + } else { + this.positionProperty = 'left' + this.dimensionProperty = 'width' } if (this.options.customTemplateScope) @@ -620,11 +637,12 @@ }, /** - * Resets slider - * - * @returns {undefined} - */ + * Resets slider + * + * @returns {undefined} + */ resetSlider: function() { + this.resetLabelsValue() this.manageElementsStyle() this.addAccessibility() this.setMinAndMax() @@ -634,6 +652,7 @@ this.manageEventsBindings() this.setDisabledState() this.calcViewDimensions() + this.updateRestrictionBar() this.refocusPointerIfNeeded() }, @@ -648,12 +667,46 @@ }, /** - * Set the slider children to variables for easy access - * - * Run only once during initialization - * - * @returns {undefined} - */ + * Check if the restrictedRange option using multiple or not + * + * Run only once during initialization and only in case 4 + * + * @returns {undefined} + */ + + ensureRestrictedBarIsArray: function(elem) { + var jElem = angular.element(elem) + this.restrictedBar = [] + if (this.options.restrictedRange) { + // this.options.restrictedRange converting to an array even if it's not entered as array. + this.options.restrictedRange = !Array.isArray( + this.options.restrictedRange + ) + ? [this.options.restrictedRange] + : this.options.restrictedRange + this.restrictedBar[0] = jElem + var mainDiv = elem.parentElement + for (var i = 1; i < this.options.restrictedRange.length; i++) { + var sp = document.createElement('span') + sp.setAttribute('class', 'rz-bar-wrapper') + sp.innerHTML = + '' + mainDiv.appendChild(sp) + this.restrictedBar[i] = angular.element(sp) + } + } else { + elem.style.visibility = 'hidden' + this.restrictedBar = null + } + }, + + /** + * Set the slider children to variables for easy access + * + * Run only once during initialization + * + * @returns {undefined} + */ initElemHandles: function() { // Assign all slider elements to object properties for easy access angular.forEach( @@ -675,27 +728,30 @@ this.selBar = jElem break case 4: - this.minH = jElem + this.ensureRestrictedBarIsArray(elem) break case 5: - this.maxH = jElem + this.minH = jElem break case 6: - this.flrLab = jElem + this.maxH = jElem break case 7: - this.ceilLab = jElem + this.flrLab = jElem break case 8: - this.minLab = jElem + this.ceilLab = jElem break case 9: - this.maxLab = jElem + this.minLab = jElem break case 10: - this.cmbLab = jElem + this.maxLab = jElem break case 11: + this.cmbLab = jElem + break + case 12: this.ticks = jElem break } @@ -715,8 +771,8 @@ }, /** - * Update each elements style based on options - */ + * Update each elements style based on options + */ manageElementsStyle: function() { if (!this.range) this.maxH.css('display', 'none') else this.maxH.css('display', '') @@ -752,6 +808,16 @@ this.leftOutSelBar, !this.range || !this.options.showOuterSelectionBars ) + + // this.restrictedBar is everytime an array + for (var r in this.restrictedBar) { + if (this.restrictedBar[r]) + this.alwaysHide( + this.restrictedBar[r], + !this.options.restrictedRange[r] + ) + } + this.alwaysHide( this.rightOutSelBar, !this.range || !this.options.showOuterSelectionBars @@ -761,7 +827,11 @@ this.fullBar.addClass('rz-transparent') } - if (this.options.vertical) this.sliderElem.addClass('rz-vertical') + if (this.options.vertical) { + this.sliderElem.addClass('rz-vertical') + } else { + this.sliderElem.removeClass('rz-vertical') + } if (this.options.draggableRange) this.selBar.addClass('rz-draggable') else this.selBar.removeClass('rz-draggable') @@ -777,10 +847,10 @@ }, /** - * Manage the events bindings based on readOnly and disabled options - * - * @returns {undefined} - */ + * Manage the events bindings based on readOnly and disabled options + * + * @returns {undefined} + */ manageEventsBindings: function() { if (this.options.disabled || this.options.readOnly) this.unbindEvents() @@ -788,10 +858,10 @@ }, /** - * Set the disabled state based on rzSliderDisabled - * - * @returns {undefined} - */ + * Set the disabled state based on rzSliderDisabled + * + * @returns {undefined} + */ setDisabledState: function() { if (this.options.disabled) { this.sliderElem.attr('disabled', 'disabled') @@ -801,22 +871,30 @@ }, /** - * Reset label values - * - * @return {undefined} - */ + * Reset label values + * + * @return {undefined} + */ resetLabelsValue: function() { this.minLab.rzsv = undefined this.maxLab.rzsv = undefined - }, - - /** - * Initialize slider handles positions and labels - * - * Run only once during initialization and every time view port changes size - * - * @returns {undefined} - */ + this.flrLab.rzsv = undefined + this.ceilLab.rzsv = undefined + this.cmbLab.rzsv = undefined + this.resetPosition(this.flrLab) + this.resetPosition(this.ceilLab) + this.resetPosition(this.cmbLab) + this.resetPosition(this.minLab) + this.resetPosition(this.maxLab) + }, + + /** + * Initialize slider handles positions and labels + * + * Run only once during initialization and every time view port changes size + * + * @returns {undefined} + */ initHandles: function() { this.updateLowHandle(this.valueToPosition(this.lowValue)) @@ -833,14 +911,14 @@ }, /** - * Translate value to human readable format - * - * @param {number|string} value - * @param {jqLite} label - * @param {String} which - * @param {boolean} [useCustomTr] - * @returns {undefined} - */ + * Translate value to human readable format + * + * @param {number|string} value + * @param {jqLite} label + * @param {String} which + * @param {boolean} [useCustomTr] + * @returns {undefined} + */ translateFn: function(value, label, which, useCustomTr) { useCustomTr = useCustomTr === undefined ? true : useCustomTr @@ -877,10 +955,10 @@ }, /** - * Set maximum and minimum values for the slider and ensure the model and high - * value match these limits - * @returns {undefined} - */ + * Set maximum and minimum values for the slider and ensure the model and high + * value match these limits + * @returns {undefined} + */ setMinAndMax: function() { this.step = +this.options.step this.precision = +this.options.precision @@ -912,12 +990,12 @@ }, /** - * Adds accessibility attributes - * - * Run only once during initialization - * - * @returns {undefined} - */ + * Adds accessibility attributes + * + * Run only once during initialization + * + * @returns {undefined} + */ addAccessibility: function() { this.minH.attr('role', 'slider') this.updateAriaAttributes() @@ -927,8 +1005,11 @@ ) this.minH.attr('tabindex', '0') else this.minH.attr('tabindex', '') - if (this.options.vertical) + if (this.options.vertical) { this.minH.attr('aria-orientation', 'vertical') + } else { + this.minH.attr('aria-orientation', 'horizontal') + } if (this.options.ariaLabel) this.minH.attr('aria-label', this.options.ariaLabel) else if (this.options.ariaLabelledBy) @@ -944,6 +1025,7 @@ else this.maxH.attr('tabindex', '') if (this.options.vertical) this.maxH.attr('aria-orientation', 'vertical') + else this.maxH.attr('aria-orientation', 'horizontal') if (this.options.ariaLabelHigh) this.maxH.attr('aria-label', this.options.ariaLabelHigh) else if (this.options.ariaLabelledByHigh) @@ -952,8 +1034,8 @@ }, /** - * Updates aria attributes according to current values - */ + * Updates aria attributes according to current values + */ updateAriaAttributes: function() { this.minH.attr({ 'aria-valuenow': this.scope.rzSliderModel, @@ -963,7 +1045,7 @@ 'model' ), 'aria-valuemin': this.minValue, - 'aria-valuemax': this.maxValue + 'aria-valuemax': this.maxValue, }) if (this.range) { this.maxH.attr({ @@ -974,18 +1056,18 @@ 'high' ), 'aria-valuemin': this.minValue, - 'aria-valuemax': this.maxValue + 'aria-valuemax': this.maxValue, }) } }, /** - * Calculate dimensions that are dependent on view port size - * - * Run once during initialization and every time view port changes size. - * - * @returns {undefined} - */ + * Calculate dimensions that are dependent on view port size + * + * Run once during initialization and every time view port changes size. + * + * @returns {undefined} + */ calcViewDimensions: function() { var handleWidth = this.getDimension(this.minH) @@ -1011,10 +1093,10 @@ }, /** - * Update the ticks position - * - * @returns {undefined} - */ + * Update the ticks position + * + * @returns {undefined} + */ updateTicksScale: function() { if (!this.options.showTicks) return @@ -1025,20 +1107,27 @@ if (this.options.rightToLeft) ticksArray.reverse() this.scope.ticks = ticksArray.map(function(value) { + var legend = null + if (angular.isObject(value)) { + legend = value.legend + value = value.value + } + var position = self.valueToPosition(value) if (self.options.vertical) position = self.maxPos - position var translation = translate + '(' + Math.round(position) + 'px)' var tick = { + legend: legend, selected: self.isTickSelected(value), style: { '-webkit-transform': translation, '-moz-transform': translation, '-o-transform': translation, '-ms-transform': translation, - transform: translation - } + transform: translation, + }, } if (tick.selected && self.options.getSelectionBarColor) { tick.style['background-color'] = self.getSelectionBarColor() @@ -1063,7 +1152,7 @@ } } if (self.getLegend) { - var legend = self.getLegend(value, self.options.id) + legend = self.getLegend(value, self.options.id) if (legend) tick.legend = legend } return tick @@ -1111,10 +1200,10 @@ }, /** - * Update position of the floor label - * - * @returns {undefined} - */ + * Update position of the floor label + * + * @returns {undefined} + */ updateFloorLab: function() { this.translateFn(this.minValue, this.flrLab, 'floor') this.getDimension(this.flrLab) @@ -1125,10 +1214,10 @@ }, /** - * Update position of the ceiling label - * - * @returns {undefined} - */ + * Update position of the ceiling label + * + * @returns {undefined} + */ updateCeilLab: function() { this.translateFn(this.maxValue, this.ceilLab, 'ceil') this.getDimension(this.ceilLab) @@ -1139,11 +1228,11 @@ }, /** - * Update slider handles and label positions - * - * @param {string} which - * @param {number} newPos - */ + * Update slider handles and label positions + * + * @param {string} which + * @param {number} newPos + */ updateHandles: function(which, newPos) { if (which === 'lowValue') this.updateLowHandle(newPos) else this.updateHighHandle(newPos) @@ -1154,13 +1243,13 @@ }, /** - * Helper function to work out the position for handle labels depending on RTL or not - * - * @param {string} labelName maxLab or minLab - * @param newPos - * - * @returns {number} - */ + * Helper function to work out the position for handle labels depending on RTL or not + * + * @param {string} labelName maxLab or minLab + * @param newPos + * + * @returns {number} + */ getHandleLabelPos: function(labelName, newPos) { var labelRzsd = this[labelName].rzsd, nearHandlePos = newPos - labelRzsd / 2 + this.handleHalfDim, @@ -1179,11 +1268,11 @@ }, /** - * Update low slider handle position and label - * - * @param {number} newPos - * @returns {undefined} - */ + * Update low slider handle position and label + * + * @param {number} newPos + * @returns {undefined} + */ updateLowHandle: function(newPos) { this.setPosition(this.minH, newPos) this.translateFn(this.lowValue, this.minLab, 'model') @@ -1195,7 +1284,7 @@ if (this.options.getPointerColor) { var pointercolor = this.getPointerColor('min') this.scope.minPointerStyle = { - backgroundColor: pointercolor + backgroundColor: pointercolor, } } @@ -1205,11 +1294,11 @@ }, /** - * Update high slider handle position and label - * - * @param {number} newPos - * @returns {undefined} - */ + * Update high slider handle position and label + * + * @param {number} newPos + * @returns {undefined} + */ updateHighHandle: function(newPos) { this.setPosition(this.maxH, newPos) this.translateFn(this.highValue, this.maxLab, 'high') @@ -1221,7 +1310,7 @@ if (this.options.getPointerColor) { var pointercolor = this.getPointerColor('max') this.scope.maxPointerStyle = { - backgroundColor: pointercolor + backgroundColor: pointercolor, } } if (this.options.autoHideLimitLabels) { @@ -1230,10 +1319,10 @@ }, /** - * Show/hide floor/ceiling label - * - * @returns {undefined} - */ + * Show/hide floor/ceiling label + * + * @returns {undefined} + */ shFloorCeil: function() { // Show based only on hideLimitLabels if pointer labels are hidden if (this.options.hidePointerLabels) { @@ -1305,10 +1394,39 @@ }, /** - * Update slider selection bar, combined label and range label - * - * @returns {undefined} - */ + * Update restricted area bar + * + * @returns {undefined} + */ + updateRestrictionBar: function() { + var position = 0, + dimension = 0 + if (this.options.restrictedRange) { + this.options.restrictedRange = !Array.isArray( + this.options.restrictedRange + ) + ? [this.options.restrictedRange] + : this.options.restrictedRange + for (var i in this.options.restrictedRange) { + var from = this.valueToPosition( + this.options.restrictedRange[i].from + ), + to = this.valueToPosition(this.options.restrictedRange[i].to) + dimension = Math.abs(to - from) + position = this.options.rightToLeft + ? to + this.handleHalfDim + : from + this.handleHalfDim + this.setDimension(this.restrictedBar[i], dimension) + this.setPosition(this.restrictedBar[i], position) + } + } + }, + + /** + * Update slider selection bar, combined label and range label + * + * @returns {undefined} + */ updateSelectionBar: function() { var position = 0, dimension = 0, @@ -1369,7 +1487,7 @@ if (this.options.getSelectionBarColor) { var color = this.getSelectionBarColor() this.scope.barStyle = { - backgroundColor: color + backgroundColor: color, } } else if (this.options.selectionBarGradient) { var offset = @@ -1378,8 +1496,12 @@ : 0, reversed = (offset - position > 0) ^ isSelectionBarFromRight, direction = this.options.vertical - ? reversed ? 'bottom' : 'top' - : reversed ? 'left' : 'right' + ? reversed + ? 'bottom' + : 'top' + : reversed + ? 'left' + : 'right' this.scope.barStyle = { backgroundImage: 'linear-gradient(to ' + @@ -1388,7 +1510,7 @@ this.options.selectionBarGradient.from + ' 0%,' + this.options.selectionBarGradient.to + - ' 100%)' + ' 100%)', } if (this.options.vertical) { this.scope.barStyle.backgroundPosition = @@ -1413,9 +1535,9 @@ }, /** - * Wrapper around the getSelectionBarColor of the user to pass to - * correct parameters - */ + * Wrapper around the getSelectionBarColor of the user to pass to + * correct parameters + */ getSelectionBarColor: function() { if (this.range) return this.options.getSelectionBarColor( @@ -1426,9 +1548,9 @@ }, /** - * Wrapper around the getPointerColor of the user to pass to - * correct parameters - */ + * Wrapper around the getPointerColor of the user to pass to + * correct parameters + */ getPointerColor: function(pointerType) { if (pointerType === 'max') { return this.options.getPointerColor( @@ -1443,18 +1565,18 @@ }, /** - * Wrapper around the getTickColor of the user to pass to - * correct parameters - */ + * Wrapper around the getTickColor of the user to pass to + * correct parameters + */ getTickColor: function(value) { return this.options.getTickColor(value) }, /** - * Update combined label position and value - * - * @returns {undefined} - */ + * Update combined label position and value + * + * @returns {undefined} + */ updateCmbLabel: function() { var isLabelOverlap = null if (this.options.rightToLeft) { @@ -1473,8 +1595,8 @@ labelVal = lowTr } else { labelVal = this.options.rightToLeft - ? highTr + ' - ' + lowTr - : lowTr + ' - ' + highTr + ? highTr + this.options.labelOverlapSeparator + lowTr + : lowTr + this.options.labelOverlapSeparator + highTr } this.translateFn(labelVal, this.cmbLab, 'cmb', false) @@ -1509,11 +1631,11 @@ }, /** - * Return the translated value if a translate function is provided else the original value - * @param value - * @param which if it's min or max handle - * @returns {*} - */ + * Return the translated value if a translate function is provided else the original value + * @param value + * @param which if it's min or max handle + * @returns {*} + */ getDisplayValue: function(value, which) { if (this.options.stepsArray && !this.options.bindIndexForStepsArray) { value = this.getStepValue(value) @@ -1522,12 +1644,12 @@ }, /** - * Round value to step and precision based on minValue - * - * @param {number} value - * @param {number} customStep a custom step to override the defined step - * @returns {number} - */ + * Round value to step and precision based on minValue + * + * @param {number} value + * @param {number} customStep a custom step to override the defined step + * @returns {number} + */ roundStep: function(value, customStep) { var step = customStep ? customStep : this.step, steppedDifference = parseFloat( @@ -1541,40 +1663,40 @@ }, /** - * Hide element - * - * @param element - * @returns {jqLite} The jqLite wrapped DOM element - */ + * Hide element + * + * @param element + * @returns {jqLite} The jqLite wrapped DOM element + */ hideEl: function(element) { return element.css({ - visibility: 'hidden' + visibility: 'hidden', }) }, /** - * Show element - * - * @param element The jqLite wrapped DOM element - * @returns {jqLite} The jqLite - */ + * Show element + * + * @param element The jqLite wrapped DOM element + * @returns {jqLite} The jqLite + */ showEl: function(element) { if (!!element.rzAlwaysHide) { return element } return element.css({ - visibility: 'visible' + visibility: 'visible', }) }, /** - * Set element left/top position depending on whether slider is horizontal or vertical - * - * @param {jqLite} elem The jqLite wrapped DOM element - * @param {number} pos - * @returns {number} - */ + * Set element left/top position depending on whether slider is horizontal or vertical + * + * @param {jqLite} elem The jqLite wrapped DOM element + * @param {number} pos + * @returns {number} + */ setPosition: function(elem, pos) { elem.rzsp = pos var css = {} @@ -1583,12 +1705,19 @@ return pos }, + resetPosition: function(elem) { + elem.css({ + left: null, + bottom: null, + }) + }, + /** - * Get element width/height depending on whether slider is horizontal or vertical - * - * @param {jqLite} elem The jqLite wrapped DOM element - * @returns {number} - */ + * Get element width/height depending on whether slider is horizontal or vertical + * + * @param {jqLite} elem The jqLite wrapped DOM element + * @returns {number} + */ getDimension: function(elem) { var val = elem[0].getBoundingClientRect() if (this.options.vertical) @@ -1598,12 +1727,12 @@ }, /** - * Set element width/height depending on whether slider is horizontal or vertical - * - * @param {jqLite} elem The jqLite wrapped DOM element - * @param {number} dim - * @returns {number} - */ + * Set element width/height depending on whether slider is horizontal or vertical + * + * @param {jqLite} elem The jqLite wrapped DOM element + * @param {number} dim + * @returns {number} + */ setDimension: function(elem, dim) { elem.rzsd = dim var css = {} @@ -1613,21 +1742,21 @@ }, /** - * Returns a value that is within slider range - * - * @param {number} val - * @returns {number} - */ + * Returns a value that is within slider range + * + * @param {number} val + * @returns {number} + */ sanitizeValue: function(val) { return Math.min(Math.max(val, this.minValue), this.maxValue) }, /** - * Translate value to pixel position - * - * @param {number} val - * @returns {number} - */ + * Translate value to pixel position + * + * @param {number} val + * @returns {number} + */ valueToPosition: function(val) { var fn = this.linearValueToPosition if (this.options.customValueToPosition) @@ -1654,11 +1783,11 @@ }, /** - * Translate position to model value - * - * @param {number} position - * @returns {number} - */ + * Translate position to model value + * + * @param {number} position + * @returns {number} + */ positionToValue: function(position) { var percent = position / this.maxPos if (this.options.rightToLeft) percent = 1 - percent @@ -1688,12 +1817,12 @@ // Events /** - * Get the X-coordinate or Y-coordinate of an event - * - * @param {Object} event The event - * @param targetTouchId The identifier of the touch with the X/Y coordinates - * @returns {number} - */ + * Get the X-coordinate or Y-coordinate of an event + * + * @param {Object} event The event + * @param targetTouchId The identifier of the touch with the X/Y coordinates + * @returns {number} + */ getEventXY: function(event, targetTouchId) { /* http://stackoverflow.com/a/12336075/282882 */ //noinspection JSLint @@ -1718,11 +1847,11 @@ }, /** - * Compute the event position depending on whether the slider is horizontal or vertical - * @param event - * @param targetTouchId If targetTouchId is provided it will be considered the position of that - * @returns {number} - */ + * Compute the event position depending on whether the slider is horizontal or vertical + * @param event + * @param targetTouchId If targetTouchId is provided it will be considered the position of that + * @returns {number} + */ getEventPosition: function(event, targetTouchId) { var sliderPos = this.sliderElem.rzsp, eventPos = 0 @@ -1733,16 +1862,16 @@ }, /** - * Get event names for move and event end - * - * @param {Event} event The event - * - * @return {{moveEvent: string, endEvent: string}} - */ + * Get event names for move and event end + * + * @param {Event} event The event + * + * @return {{moveEvent: string, endEvent: string}} + */ getEventNames: function(event) { var eventNames = { moveEvent: '', - endEvent: '' + endEvent: '', } if (this.getEventAttr(event, 'touches')) { @@ -1757,11 +1886,11 @@ }, /** - * Get the handle closest to an event. - * - * @param event {Event} The event - * @returns {jqLite} The handle closest to the event. - */ + * Get the handle closest to an event. + * + * @param event {Event} The event + * @returns {jqLite} The handle closest to the event. + */ getNearestHandle: function(event) { if (!this.range) { return this.minH @@ -1774,26 +1903,25 @@ else if (!this.options.rightToLeft) //if event is at the same distance from min/max then if it's at left of minH, we return minH else maxH return position < this.minH.rzsp ? this.minH : this.maxH - else - //reverse in rtl - return position > this.minH.rzsp ? this.minH : this.maxH + //reverse in rtl + else return position > this.minH.rzsp ? this.minH : this.maxH }, /** - * Wrapper function to focus an angular element - * - * @param el {AngularElement} the element to focus - */ + * Wrapper function to focus an angular element + * + * @param el {AngularElement} the element to focus + */ focusElement: function(el) { var DOM_ELEMENT = 0 el[DOM_ELEMENT].focus() }, /** - * Bind mouse and touch events to slider handles - * - * @returns {undefined} - */ + * Bind mouse and touch events to slider handles + * + * @returns {undefined} + */ bindEvents: function() { var barTracking, barStart, barMove @@ -1923,10 +2051,10 @@ }, /** - * Unbind mouse and touch events to slider handles - * - * @returns {undefined} - */ + * Unbind mouse and touch events to slider handles + * + * @returns {undefined} + */ unbindEvents: function() { this.minH.off() this.maxH.off() @@ -1936,13 +2064,13 @@ }, /** - * onStart event handler - * - * @param {?Object} pointer The jqLite wrapped DOM element; if null, the closest handle is used - * @param {?string} ref The name of the handle being changed; if null, the closest handle's value is modified - * @param {Event} event The event - * @returns {undefined} - */ + * onStart event handler + * + * @param {?Object} pointer The jqLite wrapped DOM element; if null, the closest handle is used + * @param {?string} ref The name of the handle being changed; if null, the closest handle's value is modified + * @param {Event} event The event + * @returns {undefined} + */ onStart: function(pointer, ref, event) { var ehMove, ehEnd, @@ -1990,14 +2118,20 @@ }, /** - * onMove event handler - * - * @param {jqLite} pointer - * @param {Event} event The event - * @param {boolean} fromTick if the event occured on a tick or not - * @returns {undefined} - */ + * onMove event handler + * + * @param {jqLite} pointer + * @param {Event} event The event + * @param {boolean} fromTick if the event occured on a tick or not + * @returns {undefined} + */ onMove: function(pointer, event, fromTick) { + if (!this.options.disableAnimation) { + if (this.moving) { + this.sliderElem.addClass('noanimate') + } + } + this.moving = true var changedTouches = this.getEventAttr(event, 'changedTouches') var touchForThisSlider if (changedTouches) { @@ -2037,13 +2171,17 @@ }, /** - * onEnd event handler - * - * @param {Event} event The event - * @param {Function} ehMove The bound move event handler - * @returns {undefined} - */ + * onEnd event handler + * + * @param {Event} event The event + * @param {Function} ehMove The bound move event handler + * @returns {undefined} + */ onEnd: function(ehMove, event) { + this.moving = false + if (!this.options.disableAnimation) { + this.sliderElem.removeClass('noanimate') + } var changedTouches = this.getEventAttr(event, 'changedTouches') if (changedTouches && changedTouches[0].identifier !== this.touchId) { return @@ -2079,7 +2217,7 @@ this.currentFocusElement = { pointer: pointer, - ref: ref + ref: ref, } }, @@ -2099,12 +2237,61 @@ }, /** - * Key actions helper function - * - * @param {number} currentValue value of the slider - * - * @returns {?Object} action value mappings - */ + * Skip restricted range function when arrow keys use + * + * @param {number} currentValue value of the slider + * @param {number} key arrow key used + * + * @returns {number} currentValue value of the slider + */ + + skipRestrictedRanges: function(key, currentValue) { + if ( + this.options.restrictedRange && + Array.isArray(this.options.restrictedRange) + ) { + for (var i in this.options.restrictedRange) { + var range = this.options.restrictedRange[i] + // if it first or last value + if ( + (range.from === 0 && + currentValue === 0 && + [37, 40].includes(key)) || // LEFT or DOWN + (range.to >= + this.options.restrictedRange[ + this.options.restrictedRange.length - 1 + ].to && + currentValue >= + this.options.restrictedRange[ + this.options.restrictedRange.length - 1 + ].to && + [38, 39].includes(key)) // UP or RIGHT + ) { + return currentValue + } + if (range.to > currentValue && currentValue > range.from) { + if ( + Math.abs(range.to - currentValue) > + Math.abs(range.from - currentValue) + ) { + currentValue = range.to + } else { + currentValue = range.from + } + } + } + } + + return currentValue + }, + + /** + * Key actions helper function + * + * @param {number} currentValue value of the slider + * + * @returns {?Object} action value mappings + */ getKeyActions: function(currentValue) { var increaseStep = currentValue + this.step, decreaseStep = currentValue - this.step, @@ -2127,7 +2314,7 @@ PAGEUP: increasePage, PAGEDOWN: decreasePage, HOME: this.options.reversedControls ? this.maxValue : this.minValue, - END: this.options.reversedControls ? this.minValue : this.maxValue + END: this.options.reversedControls ? this.minValue : this.maxValue, } //right to left means swapping right and left arrows if (this.options.rightToLeft) { @@ -2143,9 +2330,9 @@ }, onKeyboardEvent: function(event) { - var currentValue = this[this.tracking], - keyCode = event.keyCode || event.which, - keys = { + var keyCode = event.keyCode || event.which + var currentValue = this[this.tracking] + var keys = { 38: 'UP', 40: 'DOWN', 37: 'LEFT', @@ -2153,7 +2340,7 @@ 33: 'PAGEUP', 34: 'PAGEDOWN', 36: 'HOME', - 35: 'END' + 35: 'END', }, actions = this.getKeyActions(currentValue), key = keys[keyCode], @@ -2169,6 +2356,9 @@ var self = this $timeout(function() { var newValue = self.roundStep(self.sanitizeValue(action)) + newValue = self.options.skipRestrictedRangesWithArrowKeys + ? self.skipRestrictedRanges(keyCode, newValue) + : newValue if (!self.options.draggableRangeOnly) { self.positionTrackingHandle(newValue) } else { @@ -2196,15 +2386,15 @@ }, /** - * onDragStart event handler - * - * Handles dragging of the middle bar. - * - * @param {Object} pointer The jqLite wrapped DOM element - * @param {string} ref One of the refLow, refHigh values - * @param {Event} event The event - * @returns {undefined} - */ + * onDragStart event handler + * + * Handles dragging of the middle bar. + * + * @param {Object} pointer The jqLite wrapped DOM element + * @param {string} ref One of the refLow, refHigh values + * @param {Event} event The event + * @returns {undefined} + */ onDragStart: function(pointer, ref, event) { var position = this.getEventPosition(event) this.dragging = { @@ -2216,24 +2406,24 @@ : position - this.minH.rzsp, highLimit: this.options.rightToLeft ? position - this.maxH.rzsp - : this.maxH.rzsp - position + : this.maxH.rzsp - position, } this.onStart(pointer, ref, event) }, /** - * getValue helper function - * - * gets max or min value depending on whether the newPos is outOfBounds above or below the bar and rightToLeft - * - * @param {string} type 'max' || 'min' The value we are calculating - * @param {number} newPos The new position - * @param {boolean} outOfBounds Is the new position above or below the max/min? - * @param {boolean} isAbove Is the new position above the bar if out of bounds? - * - * @returns {number} - */ + * getValue helper function + * + * gets max or min value depending on whether the newPos is outOfBounds above or below the bar and rightToLeft + * + * @param {string} type 'max' || 'min' The value we are calculating + * @param {number} newPos The new position + * @param {boolean} outOfBounds Is the new position above or below the max/min? + * @param {boolean} isAbove Is the new position above the bar if out of bounds? + * + * @returns {number} + */ getValue: function(type, newPos, outOfBounds, isAbove) { var isRTL = this.options.rightToLeft, value = null @@ -2281,15 +2471,21 @@ }, /** - * onDragMove event handler - * - * Handles dragging of the middle bar. - * - * @param {jqLite} pointer - * @param {Event} event The event - * @returns {undefined} - */ + * onDragMove event handler + * + * Handles dragging of the middle bar. + * + * @param {jqLite} pointer + * @param {Event} event The event + * @returns {undefined} + */ onDragMove: function(pointer, event) { + if (!this.options.disableAnimation) { + if (this.moving) { + this.sliderElem.addClass('noanimate') + } + } + this.moving = true var newPos = this.getEventPosition(event), newMinValue, newMaxValue, @@ -2330,11 +2526,11 @@ }, /** - * Set the new value and position for the entire bar - * - * @param {number} newMinValue the new minimum value - * @param {number} newMaxValue the new maximum value - */ + * Set the new value and position for the entire bar + * + * @param {number} newMinValue the new minimum value + * @param {number} newMaxValue the new maximum value + */ positionTrackingBar: function(newMinValue, newMaxValue) { if ( this.options.minLimit != null && @@ -2361,13 +2557,14 @@ }, /** - * Set the new value and position to the current tracking handle - * - * @param {number} newValue new model value - */ + * Set the new value and position to the current tracking handle + * + * @param {number} newValue new model value + */ positionTrackingHandle: function(newValue) { var valueChanged = false newValue = this.applyMinMaxLimit(newValue) + newValue = this.applyRestrictedRange(newValue) if (this.range) { if (this.options.pushRange) { newValue = this.applyPushRange(newValue) @@ -2455,6 +2652,34 @@ return newValue }, + applyRestrictedRange: function(newValue) { + for (var i in this.options.restrictedRange) { + if ( + this.options.restrictedRange[i] != null && + newValue > this.options.restrictedRange[i].from && + newValue < this.options.restrictedRange[i].to + ) { + var halfWidth = + (this.options.restrictedRange[i].to - + this.options.restrictedRange[i].from) / + 2 + if (this.tracking === 'lowValue') { + return newValue > + this.options.restrictedRange[i].from + halfWidth + ? this.options.restrictedRange[i].to + : this.options.restrictedRange[i].from + } + if (this.tracking === 'highValue') { + return newValue < this.options.restrictedRange[i].to - halfWidth + ? this.options.restrictedRange[i].from + : this.options.restrictedRange[i].to + } + } + } + + return newValue + }, + applyPushRange: function(newValue) { var difference = this.tracking === 'lowValue' @@ -2508,9 +2733,9 @@ }, /** - * Apply the model values using scope.$apply. - * We wrap it with the internalChange flag to avoid the watchers to be called - */ + * Apply the model values using scope.$apply. + * We wrap it with the internalChange flag to avoid the watchers to be called + */ applyModel: function(callOnChange) { this.internalChange = true this.scope.$apply() @@ -2519,11 +2744,11 @@ }, /** - * Call the onStart callback if defined - * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. - * - * @returns {undefined} - */ + * Call the onStart callback if defined + * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. + * + * @returns {undefined} + */ callOnStart: function() { if (this.options.onStart) { var self = this, @@ -2540,11 +2765,11 @@ }, /** - * Call the onChange callback if defined - * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. - * - * @returns {undefined} - */ + * Call the onChange callback if defined + * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. + * + * @returns {undefined} + */ callOnChange: function() { if (this.options.onChange) { var self = this, @@ -2561,11 +2786,11 @@ }, /** - * Call the onEnd callback if defined - * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. - * - * @returns {undefined} - */ + * Call the onEnd callback if defined + * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. + * + * @returns {undefined} + */ callOnEnd: function() { if (this.options.onEnd) { var self = this, @@ -2580,7 +2805,7 @@ }) } this.scope.$emit('slideEnded') - } + }, } return Slider @@ -2595,16 +2820,16 @@ rzSliderModel: '=?', rzSliderHigh: '=?', rzSliderOptions: '&?', - rzSliderTplUrl: '@' + rzSliderTplUrl: '@', }, /** - * Return template URL - * - * @param {jqLite} elem - * @param {Object} attrs - * @return {string} - */ + * Return template URL + * + * @param {jqLite} elem + * @param {Object} attrs + * @return {string} + */ templateUrl: function(elem, attrs) { //noinspection JSUnresolvedVariable return attrs.rzSliderTplUrl || 'rzSliderTpl.html' @@ -2612,7 +2837,7 @@ link: function(scope, elem) { scope.slider = new RzSlider(scope, elem) //attach on scope so we can test it - } + }, } }]) @@ -2653,7 +2878,7 @@ 'use strict'; $templateCache.put('rzSliderTpl.html', - "
  • {{ t.value }} {{ t.legend }}
" + "
  • {{ t.value }} {{ t.legend }}
" ); }]); diff --git a/dist/rzslider.min.css b/dist/rzslider.min.css index 4d915c4..ab1f8c9 100644 --- a/dist/rzslider.min.css +++ b/dist/rzslider.min.css @@ -1,2 +1,2 @@ -/*! angularjs-slider - v6.4.2 - (c) Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - https://github.com/angular-slider/angularjs-slider - 2017-12-01 */ -.rzslider{position:relative;display:inline-block;width:100%;height:4px;margin:35px 0 15px 0;vertical-align:middle;user-select:none}.rzslider.with-legend{margin-bottom:40px}.rzslider[disabled]{cursor:not-allowed}.rzslider[disabled] .rz-pointer{cursor:not-allowed;background-color:#d8e0f3}.rzslider[disabled] .rz-draggable{cursor:not-allowed}.rzslider[disabled] .rz-selection{background:#8b91a2}.rzslider[disabled] .rz-tick{cursor:not-allowed}.rzslider[disabled] .rz-tick.rz-selected{background:#8b91a2}.rzslider span{position:absolute;display:inline-block;white-space:nowrap}.rzslider .rz-base{width:100%;height:100%;padding:0}.rzslider .rz-bar-wrapper{left:0;z-index:1;width:100%;height:32px;padding-top:16px;margin-top:-16px;box-sizing:border-box}.rzslider .rz-draggable{cursor:move}.rzslider .rz-bar{left:0;z-index:1;width:100%;height:4px;background:#d8e0f3;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.rzslider .rz-bar-wrapper.rz-transparent .rz-bar{background:transparent}.rzslider .rz-bar-wrapper.rz-left-out-selection .rz-bar{background:#df002d}.rzslider .rz-bar-wrapper.rz-right-out-selection .rz-bar{background:#03a688}.rzslider .rz-selection{z-index:2;background:#0db9f0;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.rzslider .rz-pointer{top:-14px;z-index:3;width:32px;height:32px;cursor:pointer;background-color:#0db9f0;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px}.rzslider .rz-pointer:after{position:absolute;top:12px;left:12px;width:8px;height:8px;background:#fff;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;content:''}.rzslider .rz-pointer:hover:after{background-color:#fff}.rzslider .rz-pointer.rz-active{z-index:4}.rzslider .rz-pointer.rz-active:after{background-color:#451aff}.rzslider .rz-bubble{bottom:16px;padding:1px 3px;color:#55637d;cursor:default}.rzslider .rz-bubble.rz-limit{color:#55637d}.rzslider .rz-ticks{position:absolute;top:-3px;left:0;z-index:1;width:100%;height:0;margin:0;list-style:none;box-sizing:border-box}.rzslider .rz-ticks-values-under .rz-tick-value{top:auto;bottom:-32px}.rzslider .rz-tick{position:absolute;top:0;left:0;width:10px;height:10px;margin-left:11px;text-align:center;cursor:pointer;background:#d8e0f3;border-radius:50%}.rzslider .rz-tick.rz-selected{background:#0db9f0}.rzslider .rz-tick-value{position:absolute;top:-30px;transform:translate(-50%,0)}.rzslider .rz-tick-legend{position:absolute;top:24px;max-width:50px;white-space:normal;transform:translate(-50%,0)}.rzslider.rz-vertical{position:relative;width:4px;height:100%;padding:0;margin:0 20px;vertical-align:baseline}.rzslider.rz-vertical .rz-base{width:100%;height:100%;padding:0}.rzslider.rz-vertical .rz-bar-wrapper{top:auto;left:0;width:32px;height:100%;padding:0 0 0 16px;margin:0 0 0 -16px}.rzslider.rz-vertical .rz-bar{bottom:0;left:auto;width:4px;height:100%}.rzslider.rz-vertical .rz-pointer{top:auto;bottom:0;left:-14px!important}.rzslider.rz-vertical .rz-bubble{bottom:0;left:16px!important;margin-left:3px}.rzslider.rz-vertical .rz-ticks{top:0;left:-3px;z-index:1;width:0;height:100%}.rzslider.rz-vertical .rz-tick{margin-top:11px;margin-left:auto;vertical-align:middle}.rzslider.rz-vertical .rz-tick-value{top:auto;left:24px;transform:translate(0,-28%)}.rzslider.rz-vertical .rz-tick-legend{top:auto;right:24px;max-width:none;white-space:nowrap;transform:translate(0,-28%)}.rzslider.rz-vertical .rz-ticks-values-under .rz-tick-value{right:24px;bottom:auto;left:auto} \ No newline at end of file +/*! angularjs-slider - v7.1.0 - (c) Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - https://github.com/angular-slider/angularjs-slider - 2022-05-26 */ +.rzslider{position:relative;display:inline-block;width:100%;height:4px;margin:35px 0 15px 0;vertical-align:middle;user-select:none}.rzslider.noanimate *{transition:none!important}.rzslider.with-legend{margin-bottom:40px}.rzslider[disabled]{cursor:not-allowed}.rzslider[disabled] .rz-pointer{cursor:not-allowed;background-color:#d8e0f3}.rzslider[disabled] .rz-draggable{cursor:not-allowed}.rzslider[disabled] .rz-selection{background:#8b91a2}.rzslider[disabled] .rz-tick{cursor:not-allowed}.rzslider[disabled] .rz-tick.rz-selected{background:#8b91a2}.rzslider span{position:absolute;display:inline-block;white-space:nowrap}.rzslider .rz-base{width:100%;height:100%;padding:0}.rzslider .rz-bar-wrapper{left:0;z-index:1;width:100%;height:32px;padding-top:16px;margin-top:-16px;box-sizing:border-box;transition:all linear .3s}.rzslider .rz-draggable{cursor:move}.rzslider .rz-bar{left:0;z-index:1;width:100%;height:4px;background:#d8e0f3;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.rzslider .rz-bar-wrapper.rz-transparent .rz-bar{background:transparent}.rzslider .rz-bar-wrapper.rz-left-out-selection .rz-bar{background:#df002d}.rzslider .rz-bar-wrapper.rz-right-out-selection .rz-bar{background:#03a688}.rzslider .rz-selection{z-index:2;background:#0db9f0;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px;transition:background-color linear .3s}.rzslider .rz-restricted{z-index:3;background:#f00;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.rzslider .rz-pointer{top:-14px;z-index:3;width:32px;height:32px;cursor:pointer;background-color:#0db9f0;-webkit-border-radius:16px;-moz-border-radius:16px;border-radius:16px;transition:all linear .3s}.rzslider .rz-pointer:after{position:absolute;top:12px;left:12px;width:8px;height:8px;background:#fff;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;content:''}.rzslider .rz-pointer:hover:after{background-color:#fff}.rzslider .rz-pointer.rz-active{z-index:4}.rzslider .rz-pointer.rz-active:after{background-color:#451aff}.rzslider .rz-bubble{bottom:16px;padding:1px 3px;color:#55637d;cursor:default;transition:all linear .3s}.rzslider .rz-bubble.rz-limit{color:#55637d;transition:none}.rzslider .rz-ticks{position:absolute;top:-3px;left:0;z-index:1;width:100%;height:0;margin:0;list-style:none;box-sizing:border-box}.rzslider .rz-ticks-values-under .rz-tick-value{top:auto;bottom:-32px}.rzslider .rz-tick{position:absolute;top:0;left:0;width:10px;height:10px;margin-left:11px;text-align:center;cursor:pointer;background:#d8e0f3;border-radius:50%;transition:background-color linear .3s}.rzslider .rz-tick.rz-selected{background:#0db9f0}.rzslider .rz-tick-value{position:absolute;top:-30px;transform:translate(-50%,0)}.rzslider .rz-tick-legend{position:absolute;top:24px;max-width:50px;white-space:normal;transform:translate(-50%,0)}.rzslider.rz-vertical{position:relative;width:4px;height:100%;padding:0;margin:0 20px;vertical-align:baseline}.rzslider.rz-vertical .rz-base{width:100%;height:100%;padding:0}.rzslider.rz-vertical .rz-bar-wrapper{top:auto;left:0;width:32px;height:100%;padding:0 0 0 16px;margin:0 0 0 -16px}.rzslider.rz-vertical .rz-bar{bottom:0;left:auto;width:4px;height:100%}.rzslider.rz-vertical .rz-pointer{top:auto;bottom:0;left:-14px!important}.rzslider.rz-vertical .rz-bubble{bottom:0;left:16px!important;margin-left:3px}.rzslider.rz-vertical .rz-ticks{top:0;left:-3px;z-index:1;width:0;height:100%}.rzslider.rz-vertical .rz-tick{margin-top:11px;margin-left:auto;vertical-align:middle}.rzslider.rz-vertical .rz-tick-value{top:auto;left:24px;transform:translate(0,-28%)}.rzslider.rz-vertical .rz-tick-legend{top:auto;right:24px;max-width:none;white-space:nowrap;transform:translate(0,-28%)}.rzslider.rz-vertical .rz-ticks-values-under .rz-tick-value{right:24px;bottom:auto;left:auto} \ No newline at end of file diff --git a/dist/rzslider.min.js b/dist/rzslider.min.js index 6b0b722..e0e5927 100644 --- a/dist/rzslider.min.js +++ b/dist/rzslider.min.js @@ -1,3 +1,3 @@ -/*! angularjs-slider - v6.4.2 - (c) Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - https://github.com/angular-slider/angularjs-slider - 2017-12-01 */ -!function(a,b){"use strict";if("function"==typeof define&&define.amd)define(["angular"],b);else if("object"==typeof module&&module.exports){var c=angular||require("angular");c&&c.module||"undefined"==typeof angular||(c=angular),module.exports=b(c)}else b(a.angular)}(this,function(a){"use strict";var b=a.module("rzModule",[]).factory("RzSliderOptions",function(){var b={floor:0,ceil:null,step:1,precision:0,minRange:null,maxRange:null,pushRange:!1,minLimit:null,maxLimit:null,id:null,translate:null,getLegend:null,stepsArray:null,bindIndexForStepsArray:!1,draggableRange:!1,draggableRangeOnly:!1,showSelectionBar:!1,showSelectionBarEnd:!1,showSelectionBarFromValue:null,showOuterSelectionBars:!1,hidePointerLabels:!1,hideLimitLabels:!1,autoHideLimitLabels:!0,readOnly:!1,disabled:!1,interval:350,showTicks:!1,showTicksValues:!1,ticksArray:null,ticksTooltip:null,ticksValuesTooltip:null,vertical:!1,getSelectionBarColor:null,getTickColor:null,getPointerColor:null,keyboardSupport:!0,scale:1,enforceStep:!0,enforceRange:!1,noSwitching:!1,onlyBindHandles:!1,onStart:null,onChange:null,onEnd:null,rightToLeft:!1,reversedControls:!1,boundPointerLabels:!0,mergeRangeLabelsIfSame:!1,customTemplateScope:null,logScale:!1,customValueToPosition:null,customPositionToValue:null,selectionBarGradient:null,ariaLabel:null,ariaLabelledBy:null,ariaLabelHigh:null,ariaLabelledByHigh:null},c={},d={};return d.options=function(b){a.extend(c,b)},d.getOptions=function(d){return a.extend({},b,c,d)},d}).factory("rzThrottle",["$timeout",function(a){return function(b,c,d){var e,f,g,h=Date.now||function(){return(new Date).getTime()},i=null,j=0;d=d||{};var k=function(){j=h(),i=null,g=b.apply(e,f),e=f=null};return function(){var l=h(),m=c-(l-j);return e=this,f=arguments,0>=m?(a.cancel(i),i=null,j=l,g=b.apply(e,f),e=f=null):i||d.trailing===!1||(i=a(k,m)),g}}}]).factory("RzSlider",["$timeout","$document","$window","$compile","RzSliderOptions","rzThrottle",function(b,c,d,e,f,g){var h=function(a,b){this.scope=a,this.lowValue=0,this.highValue=0,this.sliderElem=b,this.range=void 0!==this.scope.rzSliderModel&&void 0!==this.scope.rzSliderHigh,this.dragging={active:!1,value:0,difference:0,position:0,lowLimit:0,highLimit:0},this.positionProperty="left",this.dimensionProperty="width",this.handleHalfDim=0,this.maxPos=0,this.precision=0,this.step=1,this.tracking="",this.minValue=0,this.maxValue=0,this.valueRange=0,this.intermediateTicks=!1,this.initHasRun=!1,this.firstKeyDown=!1,this.internalChange=!1,this.cmbLabelShown=!1,this.currentFocusElement=null,this.fullBar=null,this.selBar=null,this.minH=null,this.maxH=null,this.flrLab=null,this.ceilLab=null,this.minLab=null,this.maxLab=null,this.cmbLab=null,this.ticks=null,this.init()};return h.prototype={init:function(){var b,c,e=this,f=function(){e.calcViewDimensions()};this.applyOptions(),this.syncLowValue(),this.range&&this.syncHighValue(),this.initElemHandles(),this.manageElementsStyle(),this.setDisabledState(),this.calcViewDimensions(),this.setMinAndMax(),this.addAccessibility(),this.updateCeilLab(),this.updateFloorLab(),this.initHandles(),this.manageEventsBindings(),this.scope.$on("reCalcViewDimensions",f),a.element(d).on("resize",f),this.initHasRun=!0,b=g(function(){e.onLowHandleChange()},e.options.interval),c=g(function(){e.onHighHandleChange()},e.options.interval),this.scope.$on("rzSliderForceRender",function(){e.resetLabelsValue(),b(),e.range&&c(),e.resetSlider()}),this.scope.$watchCollection("rzSliderOptions()",function(a,b){a!==b&&(e.applyOptions(),e.syncLowValue(),e.range&&e.syncHighValue(),e.resetSlider())}),this.scope.$watch("rzSliderModel",function(a,c){e.internalChange||a!==c&&b()}),this.scope.$watch("rzSliderHigh",function(a,b){e.internalChange||a!==b&&(null!=a&&c(),(e.range&&null==a||!e.range&&null!=a)&&(e.applyOptions(),e.resetSlider()))}),this.scope.$on("$destroy",function(){e.unbindEvents(),a.element(d).off("resize",f),e.currentFocusElement=null})},findStepIndex:function(b){for(var c=0,d=0;d0&&0===b.rzsd)&&(f=!0,b.rzsv=e),g||b.html(e),this.scope[c+"Label"]=e,f&&this.getDimension(b)},setMinAndMax:function(){if(this.step=+this.options.step,this.precision=+this.options.precision,this.minValue=this.options.floor,this.options.logScale&&0===this.minValue)throw Error("Can't use floor=0 with logarithmic scale");this.options.enforceStep&&(this.lowValue=this.roundStep(this.lowValue),this.range&&(this.highValue=this.roundStep(this.highValue))),null!=this.options.ceil?this.maxValue=this.options.ceil:this.maxValue=this.options.ceil=this.range?this.highValue:this.lowValue,this.options.enforceRange&&(this.lowValue=this.sanitizeValue(this.lowValue),this.range&&(this.highValue=this.sanitizeValue(this.highValue))),this.applyLowValue(),this.range&&this.applyHighValue(),this.valueRange=this.maxValue-this.minValue},addAccessibility:function(){this.minH.attr("role","slider"),this.updateAriaAttributes(),!this.options.keyboardSupport||this.options.readOnly||this.options.disabled?this.minH.attr("tabindex",""):this.minH.attr("tabindex","0"),this.options.vertical&&this.minH.attr("aria-orientation","vertical"),this.options.ariaLabel?this.minH.attr("aria-label",this.options.ariaLabel):this.options.ariaLabelledBy&&this.minH.attr("aria-labelledby",this.options.ariaLabelledBy),this.range&&(this.maxH.attr("role","slider"),!this.options.keyboardSupport||this.options.readOnly||this.options.disabled?this.maxH.attr("tabindex",""):this.maxH.attr("tabindex","0"),this.options.vertical&&this.maxH.attr("aria-orientation","vertical"),this.options.ariaLabelHigh?this.maxH.attr("aria-label",this.options.ariaLabelHigh):this.options.ariaLabelledByHigh&&this.maxH.attr("aria-labelledby",this.options.ariaLabelledByHigh))},updateAriaAttributes:function(){this.minH.attr({"aria-valuenow":this.scope.rzSliderModel,"aria-valuetext":this.customTrFn(this.scope.rzSliderModel,this.options.id,"model"),"aria-valuemin":this.minValue,"aria-valuemax":this.maxValue}),this.range&&this.maxH.attr({"aria-valuenow":this.scope.rzSliderHigh,"aria-valuetext":this.customTrFn(this.scope.rzSliderHigh,this.options.id,"high"),"aria-valuemin":this.minValue,"aria-valuemax":this.maxValue})},calcViewDimensions:function(){var a=this.getDimension(this.minH);if(this.handleHalfDim=a/2,this.barDimension=this.getDimension(this.fullBar),this.maxPos=this.barDimension-a,this.getDimension(this.sliderElem),this.sliderElem.rzsp=this.sliderElem[0].getBoundingClientRect()[this.positionProperty],this.initHasRun){this.updateFloorLab(),this.updateCeilLab(),this.initHandles();var c=this;b(function(){c.updateTicksScale()})}},updateTicksScale:function(){if(this.options.showTicks){var a=this.options.ticksArray||this.getTicksArray(),b=this.options.vertical?"translateY":"translateX",c=this;this.options.rightToLeft&&a.reverse(),this.scope.ticks=a.map(function(a){var d=c.valueToPosition(a);c.options.vertical&&(d=c.maxPos-d);var e=b+"("+Math.round(d)+"px)",f={selected:c.isTickSelected(a),style:{"-webkit-transform":e,"-moz-transform":e,"-o-transform":e,"-ms-transform":e,transform:e}};if(f.selected&&c.options.getSelectionBarColor&&(f.style["background-color"]=c.getSelectionBarColor()),!f.selected&&c.options.getTickColor&&(f.style["background-color"]=c.getTickColor(a)),c.options.ticksTooltip&&(f.tooltip=c.options.ticksTooltip(a),f.tooltipPlacement=c.options.vertical?"right":"top"),(c.options.showTicksValues===!0||a%c.options.showTicksValues===0)&&(f.value=c.getDisplayValue(a,"tick-value"),c.options.ticksValuesTooltip&&(f.valueTooltip=c.options.ticksValuesTooltip(a),f.valueTooltipPlacement=c.options.vertical?"right":"top")),c.getLegend){var g=c.getLegend(a,c.options.id);g&&(f.legend=g)}return f})}},getTicksArray:function(){var a=this.step,b=[];this.intermediateTicks&&(a=this.options.showTicks);for(var c=this.minValue;c<=this.maxValue;c+=a)b.push(c);return b},isTickSelected:function(a){if(!this.range)if(null!==this.options.showSelectionBarFromValue){var b=this.options.showSelectionBarFromValue;if(this.lowValue>b&&a>=b&&a<=this.lowValue)return!0;if(this.lowValue=a&&a>=this.lowValue)return!0}else if(this.options.showSelectionBarEnd){if(a>=this.lowValue)return!0}else if(this.options.showSelectionBar&&a<=this.lowValue)return!0;return this.range&&a>=this.lowValue&&a<=this.highValue?!0:!1},updateFloorLab:function(){this.translateFn(this.minValue,this.flrLab,"floor"),this.getDimension(this.flrLab);var a=this.options.rightToLeft?this.barDimension-this.flrLab.rzsd:0;this.setPosition(this.flrLab,a)},updateCeilLab:function(){this.translateFn(this.maxValue,this.ceilLab,"ceil"),this.getDimension(this.ceilLab);var a=this.options.rightToLeft?0:this.barDimension-this.ceilLab.rzsd;this.setPosition(this.ceilLab,a)},updateHandles:function(a,b){"lowValue"===a?this.updateLowHandle(b):this.updateHighHandle(b),this.updateSelectionBar(),this.updateTicksScale(),this.range&&this.updateCmbLabel()},getHandleLabelPos:function(a,b){var c=this[a].rzsd,d=b-c/2+this.handleHalfDim,e=this.barDimension-c;return this.options.boundPointerLabels?this.options.rightToLeft&&"minLab"===a||!this.options.rightToLeft&&"maxLab"===a?Math.min(d,e):Math.min(Math.max(d,0),e):d},updateLowHandle:function(a){if(this.setPosition(this.minH,a),this.translateFn(this.lowValue,this.minLab,"model"),this.setPosition(this.minLab,this.getHandleLabelPos("minLab",a)),this.options.getPointerColor){var b=this.getPointerColor("min");this.scope.minPointerStyle={backgroundColor:b}}this.options.autoHideLimitLabels&&this.shFloorCeil()},updateHighHandle:function(a){if(this.setPosition(this.maxH,a),this.translateFn(this.highValue,this.maxLab,"high"),this.setPosition(this.maxLab,this.getHandleLabelPos("maxLab",a)),this.options.getPointerColor){var b=this.getPointerColor("max");this.scope.maxPointerStyle={backgroundColor:b}}this.options.autoHideLimitLabels&&this.shFloorCeil()},shFloorCeil:function(){if(!this.options.hidePointerLabels){var a=!1,b=!1,c=this.isLabelBelowFloorLab(this.minLab),d=this.isLabelAboveCeilLab(this.minLab),e=this.isLabelAboveCeilLab(this.maxLab),f=this.isLabelBelowFloorLab(this.cmbLab),g=this.isLabelAboveCeilLab(this.cmbLab);if(c?(a=!0,this.hideEl(this.flrLab)):(a=!1,this.showEl(this.flrLab)),d?(b=!0,this.hideEl(this.ceilLab)):(b=!1,this.showEl(this.ceilLab)),this.range){var h=this.cmbLabelShown?g:e,i=this.cmbLabelShown?f:c;h?this.hideEl(this.ceilLab):b||this.showEl(this.ceilLab),i?this.hideEl(this.flrLab):a||this.showEl(this.flrLab)}}},isLabelBelowFloorLab:function(a){var b=this.options.rightToLeft,c=a.rzsp,d=a.rzsd,e=this.flrLab.rzsp,f=this.flrLab.rzsd;return b?c+d>=e-2:e+f+2>=c},isLabelAboveCeilLab:function(a){var b=this.options.rightToLeft,c=a.rzsp,d=a.rzsd,e=this.ceilLab.rzsp,f=this.ceilLab.rzsd;return b?e+f+2>=c:c+d>=e-2},updateSelectionBar:function(){var a=0,b=0,c=this.options.rightToLeft?!this.options.showSelectionBarEnd:this.options.showSelectionBarEnd,d=this.options.rightToLeft?this.maxH.rzsp+this.handleHalfDim:this.minH.rzsp+this.handleHalfDim;if(this.range)b=Math.abs(this.maxH.rzsp-this.minH.rzsp),a=d;else if(null!==this.options.showSelectionBarFromValue){var e=this.options.showSelectionBarFromValue,f=this.valueToPosition(e),g=this.options.rightToLeft?this.lowValue<=e:this.lowValue>e;g?(b=this.minH.rzsp-f,a=f+this.handleHalfDim):(b=f-this.minH.rzsp,a=this.minH.rzsp+this.handleHalfDim)}else c?(b=Math.abs(this.maxPos-this.minH.rzsp)+this.handleHalfDim,a=this.minH.rzsp+this.handleHalfDim):(b=this.minH.rzsp+this.handleHalfDim,a=0);if(this.setDimension(this.selBar,b),this.setPosition(this.selBar,a),this.range&&this.options.showOuterSelectionBars&&(this.options.rightToLeft?(this.setDimension(this.rightOutSelBar,a),this.setPosition(this.rightOutSelBar,0),this.setDimension(this.leftOutSelBar,this.getDimension(this.fullBar)-(a+b)),this.setPosition(this.leftOutSelBar,a+b)):(this.setDimension(this.leftOutSelBar,a),this.setPosition(this.leftOutSelBar,0),this.setDimension(this.rightOutSelBar,this.getDimension(this.fullBar)-(a+b)),this.setPosition(this.rightOutSelBar,a+b))),this.options.getSelectionBarColor){var h=this.getSelectionBarColor();this.scope.barStyle={backgroundColor:h}}else if(this.options.selectionBarGradient){var i=null!==this.options.showSelectionBarFromValue?this.valueToPosition(this.options.showSelectionBarFromValue):0,j=i-a>0^c,k=this.options.vertical?j?"bottom":"top":j?"left":"right";this.scope.barStyle={backgroundImage:"linear-gradient(to "+k+", "+this.options.selectionBarGradient.from+" 0%,"+this.options.selectionBarGradient.to+" 100%)"},this.options.vertical?(this.scope.barStyle.backgroundPosition="center "+(i+b+a+(j?-this.handleHalfDim:0))+"px",this.scope.barStyle.backgroundSize="100% "+(this.barDimension-this.handleHalfDim)+"px"):(this.scope.barStyle.backgroundPosition=i-a+(j?this.handleHalfDim:0)+"px center",this.scope.barStyle.backgroundSize=this.barDimension-this.handleHalfDim+"px 100%")}},getSelectionBarColor:function(){return this.range?this.options.getSelectionBarColor(this.scope.rzSliderModel,this.scope.rzSliderHigh):this.options.getSelectionBarColor(this.scope.rzSliderModel)},getPointerColor:function(a){return"max"===a?this.options.getPointerColor(this.scope.rzSliderHigh,a):this.options.getPointerColor(this.scope.rzSliderModel,a)},getTickColor:function(a){return this.options.getTickColor(a)},updateCmbLabel:function(){var a=null;if(a=this.options.rightToLeft?this.minLab.rzsp-this.minLab.rzsd-10<=this.maxLab.rzsp:this.minLab.rzsp+this.minLab.rzsd+10>=this.maxLab.rzsp){var b=this.getDisplayValue(this.lowValue,"model"),c=this.getDisplayValue(this.highValue,"high"),d="";d=this.options.mergeRangeLabelsIfSame&&b===c?b:this.options.rightToLeft?c+" - "+b:b+" - "+c,this.translateFn(d,this.cmbLab,"cmb",!1);var e=this.options.boundPointerLabels?Math.min(Math.max(this.selBar.rzsp+this.selBar.rzsd/2-this.cmbLab.rzsd/2,0),this.barDimension-this.cmbLab.rzsd):this.selBar.rzsp+this.selBar.rzsd/2-this.cmbLab.rzsd/2;this.setPosition(this.cmbLab,e),this.cmbLabelShown=!0,this.hideEl(this.minLab),this.hideEl(this.maxLab),this.showEl(this.cmbLab)}else this.cmbLabelShown=!1,this.updateHighHandle(this.valueToPosition(this.highValue)),this.updateLowHandle(this.valueToPosition(this.lowValue)),this.showEl(this.maxLab),this.showEl(this.minLab),this.hideEl(this.cmbLab);this.options.autoHideLimitLabels&&this.shFloorCeil()},getDisplayValue:function(a,b){return this.options.stepsArray&&!this.options.bindIndexForStepsArray&&(a=this.getStepValue(a)),this.customTrFn(a,this.options.id,b)},roundStep:function(a,b){var c=b?b:this.step,d=parseFloat((a-this.minValue)/c).toPrecision(12);d=Math.round(+d)*c;var e=(this.minValue+d).toFixed(this.precision);return+e},hideEl:function(a){return a.css({visibility:"hidden"})},showEl:function(a){return a.rzAlwaysHide?a:a.css({visibility:"visible"})},setPosition:function(a,b){a.rzsp=b;var c={};return c[this.positionProperty]=Math.round(b)+"px",a.css(c),b},getDimension:function(a){var b=a[0].getBoundingClientRect();return this.options.vertical?a.rzsd=(b.bottom-b.top)*this.options.scale:a.rzsd=(b.right-b.left)*this.options.scale,a.rzsd},setDimension:function(a,b){a.rzsd=b;var c={};return c[this.dimensionProperty]=Math.round(b)+"px",a.css(c),b},sanitizeValue:function(a){return Math.min(Math.max(a,this.minValue),this.maxValue)},valueToPosition:function(a){var b=this.linearValueToPosition;this.options.customValueToPosition?b=this.options.customValueToPosition:this.options.logScale&&(b=this.logValueToPosition),a=this.sanitizeValue(a);var c=b(a,this.minValue,this.maxValue)||0;return this.options.rightToLeft&&(c=1-c),c*this.maxPos},linearValueToPosition:function(a,b,c){var d=c-b;return(a-b)/d},logValueToPosition:function(a,b,c){a=Math.log(a),b=Math.log(b),c=Math.log(c);var d=c-b;return(a-b)/d},positionToValue:function(a){var b=a/this.maxPos;this.options.rightToLeft&&(b=1-b);var c=this.linearPositionToValue;return this.options.customPositionToValue?c=this.options.customPositionToValue:this.options.logScale&&(c=this.logPositionToValue),c(b,this.minValue,this.maxValue)||0},linearPositionToValue:function(a,b,c){return a*(c-b)+b},logPositionToValue:function(a,b,c){b=Math.log(b),c=Math.log(c);var d=a*(c-b)+b;return Math.exp(d)},getEventAttr:function(a,b){return void 0===a.originalEvent?a[b]:a.originalEvent[b]},getEventXY:function(a,b){var c=this.options.vertical?"clientY":"clientX";if(void 0!==a[c])return a[c];var d=this.getEventAttr(a,"touches");if(void 0!==b)for(var e=0;ec?this.minH:c>d?this.maxH:this.options.rightToLeft?b>this.minH.rzsp?this.minH:this.maxH:b=i?h=k:i>=this.maxPos?h=j:(h=this.positionToValue(i),h=d&&a.isNumber(this.options.showTicks)?this.roundStep(h,this.options.showTicks):this.roundStep(h)),this.positionTrackingHandle(h)}},onEnd:function(a,b){var d=this.getEventAttr(b,"changedTouches");if(!d||d[0].identifier===this.touchId){this.isDragging=!1,this.touchId=null,this.options.keyboardSupport||(this.minH.removeClass("rz-active"),this.maxH.removeClass("rz-active"),this.tracking=""),this.dragging.active=!1;var e=this.getEventNames(b);c.off(e.moveEvent,a),c.off(e.endEvent,this.endHandlerToBeRemovedOnEnd),this.endHandlerToBeRemovedOnEnd=null,this.callOnEnd()}},onTickClick:function(a,b){this.onMove(a,b,!0)},onPointerFocus:function(b,c){this.tracking=c,b.one("blur",a.bind(this,this.onPointerBlur,b)),b.on("keydown",a.bind(this,this.onKeyboardEvent)),b.on("keyup",a.bind(this,this.onKeyUp)),this.firstKeyDown=!0,b.addClass("rz-active"),this.currentFocusElement={pointer:b,ref:c}},onKeyUp:function(){this.firstKeyDown=!0,this.callOnEnd()},onPointerBlur:function(a){a.off("keydown"),a.off("keyup"),a.removeClass("rz-active"),this.isDragging||(this.tracking="",this.currentFocusElement=null)},getKeyActions:function(a){var b=a+this.step,c=a-this.step,d=a+this.valueRange/10,e=a-this.valueRange/10;this.options.reversedControls&&(b=a-this.step,c=a+this.step,d=a-this.valueRange/10,e=a+this.valueRange/10);var f={UP:b,DOWN:c,LEFT:c,RIGHT:b,PAGEUP:d,PAGEDOWN:e,HOME:this.options.reversedControls?this.maxValue:this.minValue,END:this.options.reversedControls?this.minValue:this.maxValue};return this.options.rightToLeft&&(f.LEFT=b,f.RIGHT=c,this.options.vertical&&(f.UP=c,f.DOWN=b)),f},onKeyboardEvent:function(a){var c=this[this.tracking],d=a.keyCode||a.which,e={38:"UP",40:"DOWN",37:"LEFT",39:"RIGHT",33:"PAGEUP",34:"PAGEDOWN",36:"HOME",35:"END"},f=this.getKeyActions(c),g=e[d],h=f[g];if(null!=h&&""!==this.tracking){a.preventDefault(),this.firstKeyDown&&(this.firstKeyDown=!1,this.callOnStart());var i=this;b(function(){var a=i.roundStep(i.sanitizeValue(h));if(i.options.draggableRangeOnly){var b,c,d=i.highValue-i.lowValue;"lowValue"===i.tracking?(b=a,c=a+d,c>i.maxValue&&(c=i.maxValue,b=c-d)):(c=a,b=a-d,b=k,h=k>=this.maxPos-e,g){if(0===i.rzsp)return;c=this.getValue("min",k,!0,!1),d=this.getValue("max",k,!0,!1)}else if(h){if(j.rzsp===this.maxPos)return;d=this.getValue("max",k,!0,!0),c=this.getValue("min",k,!0,!0)}else c=this.getValue("min",k,!1),d=this.getValue("max",k,!1);this.positionTrackingBar(c,d)},positionTrackingBar:function(a,b){null!=this.options.minLimit&&athis.options.maxLimit&&(b=this.options.maxLimit,a=b-this.dragging.difference),this.lowValue=a,this.highValue=b,this.applyLowValue(),this.range&&this.applyHighValue(),this.applyModel(!0),this.updateHandles("lowValue",this.valueToPosition(a)),this.updateHandles("highValue",this.valueToPosition(b))},positionTrackingHandle:function(a){var b=!1;a=this.applyMinMaxLimit(a),this.range&&(this.options.pushRange?(a=this.applyPushRange(a),b=!0):(this.options.noSwitching&&("lowValue"===this.tracking&&a>this.highValue?a=this.applyMinMaxRange(this.highValue):"highValue"===this.tracking&&athis.highValue?(this.lowValue=this.highValue,this.applyLowValue(),this.applyModel(),this.updateHandles(this.tracking,this.maxH.rzsp),this.updateAriaAttributes(),this.tracking="highValue",this.minH.removeClass("rz-active"),this.maxH.addClass("rz-active"),this.options.keyboardSupport&&this.focusElement(this.maxH),b=!0):"highValue"===this.tracking&&athis.options.maxLimit?this.options.maxLimit:a},applyMinMaxRange:function(a){var b="lowValue"===this.tracking?this.highValue:this.lowValue,c=Math.abs(a-b);return null!=this.options.minRange&&cthis.options.maxRange?"lowValue"===this.tracking?this.highValue-this.options.maxRange:this.lowValue+this.options.maxRange:a},applyPushRange:function(a){var b="lowValue"===this.tracking?this.highValue-a:a-this.lowValue,c=null!==this.options.minRange?this.options.minRange:this.options.step,d=this.options.maxRange;return c>b?("lowValue"===this.tracking?(this.highValue=Math.min(a+c,this.maxValue),a=this.highValue-c,this.applyHighValue(),this.updateHandles("highValue",this.valueToPosition(this.highValue))):(this.lowValue=Math.max(a-c,this.minValue),a=this.lowValue+c,this.applyLowValue(),this.updateHandles("lowValue",this.valueToPosition(this.lowValue))),this.updateAriaAttributes()):null!==d&&b>d&&("lowValue"===this.tracking?(this.highValue=a+d,this.applyHighValue(),this.updateHandles("highValue",this.valueToPosition(this.highValue))):(this.lowValue=a-d,this.applyLowValue(),this.updateHandles("lowValue",this.valueToPosition(this.lowValue))),this.updateAriaAttributes()),a},applyModel:function(a){this.internalChange=!0,this.scope.$apply(),a&&this.callOnChange(),this.internalChange=!1},callOnStart:function(){if(this.options.onStart){var a=this,b="lowValue"===this.tracking?"min":"max";this.scope.$evalAsync(function(){a.options.onStart(a.options.id,a.scope.rzSliderModel,a.scope.rzSliderHigh,b)})}},callOnChange:function(){if(this.options.onChange){var a=this,b="lowValue"===this.tracking?"min":"max";this.scope.$evalAsync(function(){a.options.onChange(a.options.id,a.scope.rzSliderModel,a.scope.rzSliderHigh,b)})}},callOnEnd:function(){if(this.options.onEnd){var a=this,b="lowValue"===this.tracking?"min":"max";this.scope.$evalAsync(function(){a.options.onEnd(a.options.id,a.scope.rzSliderModel,a.scope.rzSliderHigh,b)})}this.scope.$emit("slideEnded")}},h}]).directive("rzslider",["RzSlider",function(a){return{restrict:"AE",replace:!0,scope:{rzSliderModel:"=?",rzSliderHigh:"=?",rzSliderOptions:"&?",rzSliderTplUrl:"@"},templateUrl:function(a,b){return b.rzSliderTplUrl||"rzSliderTpl.html"},link:function(b,c){b.slider=new a(b,c)}}}]);return b.run(["$templateCache",function(a){a.put("rzSliderTpl.html",'
  • {{ t.value }} {{ t.legend }}
')}]),b.name}); \ No newline at end of file +/*! angularjs-slider - v7.1.0 - (c) Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - https://github.com/angular-slider/angularjs-slider - 2022-05-26 */ +!function(a,b){"use strict";if("function"==typeof define&&define.amd)define(["angular"],b);else if("object"==typeof module&&module.exports){var c=angular||require("angular");c&&c.module||"undefined"==typeof angular||(c=angular),module.exports=b(c)}else b(a.angular)}(this,function(a){"use strict";var b=a.module("rzSlider",[]).factory("RzSliderOptions",function(){var b={floor:0,ceil:null,step:1,precision:0,minRange:null,maxRange:null,restrictedRange:null,skipRestrictedRangesWithArrowKeys:null,pushRange:!1,minLimit:null,maxLimit:null,id:null,translate:null,getLegend:null,stepsArray:null,bindIndexForStepsArray:!1,draggableRange:!1,draggableRangeOnly:!1,showSelectionBar:!1,showSelectionBarEnd:!1,showSelectionBarFromValue:null,showOuterSelectionBars:!1,hidePointerLabels:!1,hideLimitLabels:!1,autoHideLimitLabels:!0,readOnly:!1,disabled:!1,interval:350,showTicks:!1,showTicksValues:!1,ticksArray:null,ticksTooltip:null,ticksValuesTooltip:null,vertical:!1,getSelectionBarColor:null,getTickColor:null,getPointerColor:null,keyboardSupport:!0,scale:1,enforceStep:!0,enforceRange:!1,noSwitching:!1,onlyBindHandles:!1,disableAnimation:!1,onStart:null,onChange:null,onEnd:null,rightToLeft:!1,reversedControls:!1,boundPointerLabels:!0,mergeRangeLabelsIfSame:!1,labelOverlapSeparator:" - ",customTemplateScope:null,logScale:!1,customValueToPosition:null,customPositionToValue:null,selectionBarGradient:null,ariaLabel:null,ariaLabelledBy:null,ariaLabelHigh:null,ariaLabelledByHigh:null},c={},d={};return d.options=function(b){a.extend(c,b)},d.getOptions=function(d){return a.extend({},b,c,d)},d}).factory("rzThrottle",["$timeout",function(a){return function(b,c,d){var e,f,g,h=Date.now||function(){return(new Date).getTime()},i=null,j=0;d=d||{};var k=function(){j=h(),i=null,g=b.apply(e,f),e=f=null};return function(){var l=h(),m=c-(l-j);return e=this,f=arguments,0>=m?(a.cancel(i),i=null,j=l,g=b.apply(e,f),e=f=null):i||d.trailing===!1||(i=a(k,m)),g}}}]).factory("RzSlider",["$timeout","$document","$window","$compile","RzSliderOptions","rzThrottle",function(b,c,d,e,f,g){var h=function(a,b){this.scope=a,this.lowValue=0,this.highValue=0,this.sliderElem=b,this.range=void 0!==this.scope.rzSliderModel&&void 0!==this.scope.rzSliderHigh,this.dragging={active:!1,value:0,difference:0,position:0,lowLimit:0,highLimit:0},this.positionProperty="left",this.dimensionProperty="width",this.handleHalfDim=0,this.maxPos=0,this.precision=0,this.step=1,this.tracking="",this.minValue=0,this.maxValue=0,this.valueRange=0,this.intermediateTicks=!1,this.initHasRun=!1,this.firstKeyDown=!1,this.internalChange=!1,this.cmbLabelShown=!1,this.currentFocusElement=null,this.moving=!1,this.fullBar=null,this.selBar=null,this.minH=null,this.maxH=null,this.flrLab=null,this.ceilLab=null,this.minLab=null,this.maxLab=null,this.cmbLab=null,this.ticks=null,this.init()};return h.prototype={init:function(){var b,c,e=this,f=function(){e.calcViewDimensions()};this.applyOptions(),this.syncLowValue(),this.range&&this.syncHighValue(),this.initElemHandles(),this.manageElementsStyle(),this.setDisabledState(),this.calcViewDimensions(),this.setMinAndMax(),this.updateRestrictionBar(),this.addAccessibility(),this.updateCeilLab(),this.updateFloorLab(),this.initHandles(),this.manageEventsBindings(),this.scope.$on("reCalcViewDimensions",f),a.element(d).on("resize",f),this.initHasRun=!0,this.options.disableAnimation&&this.sliderElem.addClass("noanimate"),b=g(function(){e.onLowHandleChange()},e.options.interval),c=g(function(){e.onHighHandleChange()},e.options.interval),this.scope.$on("rzSliderForceRender",function(){e.resetLabelsValue(),b(),e.range&&c(),e.resetSlider()}),this.scope.$watchCollection("rzSliderOptions()",function(a,b){a!==b&&(e.applyOptions(),e.syncLowValue(),e.range&&e.syncHighValue(),e.resetSlider())}),this.scope.$watch("rzSliderModel",function(a,c){e.internalChange||a!==c&&b()}),this.scope.$watch("rzSliderHigh",function(a,b){e.internalChange||a!==b&&(null!=a&&c(),(e.range&&null==a||!e.range&&null!=a)&&(e.applyOptions(),e.resetSlider()))}),this.scope.$on("$destroy",function(){e.unbindEvents(),a.element(d).off("resize",f),e.currentFocusElement=null})},findStepIndex:function(b){for(var c=0,d=0;d',d.appendChild(f),this.restrictedBar[e]=a.element(f)}}else b.style.visibility="hidden",this.restrictedBar=null},initElemHandles:function(){a.forEach(this.sliderElem.children(),function(b,c){var d=a.element(b);switch(c){case 0:this.leftOutSelBar=d;break;case 1:this.rightOutSelBar=d;break;case 2:this.fullBar=d;break;case 3:this.selBar=d;break;case 4:this.ensureRestrictedBarIsArray(b);break;case 5:this.minH=d;break;case 6:this.maxH=d;break;case 7:this.flrLab=d;break;case 8:this.ceilLab=d;break;case 9:this.minLab=d;break;case 10:this.maxLab=d;break;case 11:this.cmbLab=d;break;case 12:this.ticks=d}},this),this.selBar.rzsp=0,this.minH.rzsp=0,this.maxH.rzsp=0,this.flrLab.rzsp=0,this.ceilLab.rzsp=0,this.minLab.rzsp=0,this.maxLab.rzsp=0,this.cmbLab.rzsp=0},manageElementsStyle:function(){this.range?this.maxH.css("display",""):this.maxH.css("display","none"),this.alwaysHide(this.flrLab,this.options.showTicksValues||this.options.hideLimitLabels),this.alwaysHide(this.ceilLab,this.options.showTicksValues||this.options.hideLimitLabels);var a=this.options.showTicksValues&&!this.intermediateTicks;this.alwaysHide(this.minLab,a||this.options.hidePointerLabels),this.alwaysHide(this.maxLab,a||!this.range||this.options.hidePointerLabels),this.alwaysHide(this.cmbLab,a||!this.range||this.options.hidePointerLabels),this.alwaysHide(this.selBar,!this.range&&!this.options.showSelectionBar),this.alwaysHide(this.leftOutSelBar,!this.range||!this.options.showOuterSelectionBars);for(var b in this.restrictedBar)this.restrictedBar[b]&&this.alwaysHide(this.restrictedBar[b],!this.options.restrictedRange[b]);this.alwaysHide(this.rightOutSelBar,!this.range||!this.options.showOuterSelectionBars),this.range&&this.options.showOuterSelectionBars&&this.fullBar.addClass("rz-transparent"),this.options.vertical?this.sliderElem.addClass("rz-vertical"):this.sliderElem.removeClass("rz-vertical"),this.options.draggableRange?this.selBar.addClass("rz-draggable"):this.selBar.removeClass("rz-draggable"),this.intermediateTicks&&this.options.showTicksValues&&this.ticks.addClass("rz-ticks-values-under")},alwaysHide:function(a,b){a.rzAlwaysHide=b,b?this.hideEl(a):this.showEl(a)},manageEventsBindings:function(){this.options.disabled||this.options.readOnly?this.unbindEvents():this.bindEvents()},setDisabledState:function(){this.options.disabled?this.sliderElem.attr("disabled","disabled"):this.sliderElem.attr("disabled",null)},resetLabelsValue:function(){this.minLab.rzsv=void 0,this.maxLab.rzsv=void 0,this.flrLab.rzsv=void 0,this.ceilLab.rzsv=void 0,this.cmbLab.rzsv=void 0,this.resetPosition(this.flrLab),this.resetPosition(this.ceilLab),this.resetPosition(this.cmbLab),this.resetPosition(this.minLab),this.resetPosition(this.maxLab)},initHandles:function(){this.updateLowHandle(this.valueToPosition(this.lowValue)),this.range&&this.updateHighHandle(this.valueToPosition(this.highValue)),this.updateSelectionBar(),this.range&&this.updateCmbLabel(),this.updateTicksScale()},translateFn:function(a,b,c,d){d=void 0===d?!0:d;var e="",f=!1,g=b.hasClass("no-label-injection");d?(this.options.stepsArray&&!this.options.bindIndexForStepsArray&&(a=this.getStepValue(a)),e=String(this.customTrFn(a,this.options.id,c))):e=String(a),(void 0===b.rzsv||b.rzsv.length!==e.length||b.rzsv.length>0&&0===b.rzsd)&&(f=!0,b.rzsv=e),g||b.html(e),this.scope[c+"Label"]=e,f&&this.getDimension(b)},setMinAndMax:function(){if(this.step=+this.options.step,this.precision=+this.options.precision,this.minValue=this.options.floor,this.options.logScale&&0===this.minValue)throw Error("Can't use floor=0 with logarithmic scale");this.options.enforceStep&&(this.lowValue=this.roundStep(this.lowValue),this.range&&(this.highValue=this.roundStep(this.highValue))),null!=this.options.ceil?this.maxValue=this.options.ceil:this.maxValue=this.options.ceil=this.range?this.highValue:this.lowValue,this.options.enforceRange&&(this.lowValue=this.sanitizeValue(this.lowValue),this.range&&(this.highValue=this.sanitizeValue(this.highValue))),this.applyLowValue(),this.range&&this.applyHighValue(),this.valueRange=this.maxValue-this.minValue},addAccessibility:function(){this.minH.attr("role","slider"),this.updateAriaAttributes(),!this.options.keyboardSupport||this.options.readOnly||this.options.disabled?this.minH.attr("tabindex",""):this.minH.attr("tabindex","0"),this.options.vertical?this.minH.attr("aria-orientation","vertical"):this.minH.attr("aria-orientation","horizontal"),this.options.ariaLabel?this.minH.attr("aria-label",this.options.ariaLabel):this.options.ariaLabelledBy&&this.minH.attr("aria-labelledby",this.options.ariaLabelledBy),this.range&&(this.maxH.attr("role","slider"),!this.options.keyboardSupport||this.options.readOnly||this.options.disabled?this.maxH.attr("tabindex",""):this.maxH.attr("tabindex","0"),this.options.vertical?this.maxH.attr("aria-orientation","vertical"):this.maxH.attr("aria-orientation","horizontal"),this.options.ariaLabelHigh?this.maxH.attr("aria-label",this.options.ariaLabelHigh):this.options.ariaLabelledByHigh&&this.maxH.attr("aria-labelledby",this.options.ariaLabelledByHigh))},updateAriaAttributes:function(){this.minH.attr({"aria-valuenow":this.scope.rzSliderModel,"aria-valuetext":this.customTrFn(this.scope.rzSliderModel,this.options.id,"model"),"aria-valuemin":this.minValue,"aria-valuemax":this.maxValue}),this.range&&this.maxH.attr({"aria-valuenow":this.scope.rzSliderHigh,"aria-valuetext":this.customTrFn(this.scope.rzSliderHigh,this.options.id,"high"),"aria-valuemin":this.minValue,"aria-valuemax":this.maxValue})},calcViewDimensions:function(){var a=this.getDimension(this.minH);if(this.handleHalfDim=a/2,this.barDimension=this.getDimension(this.fullBar),this.maxPos=this.barDimension-a,this.getDimension(this.sliderElem),this.sliderElem.rzsp=this.sliderElem[0].getBoundingClientRect()[this.positionProperty],this.initHasRun){this.updateFloorLab(),this.updateCeilLab(),this.initHandles();var c=this;b(function(){c.updateTicksScale()})}},updateTicksScale:function(){if(this.options.showTicks){var b=this.options.ticksArray||this.getTicksArray(),c=this.options.vertical?"translateY":"translateX",d=this;this.options.rightToLeft&&b.reverse(),this.scope.ticks=b.map(function(b){var e=null;a.isObject(b)&&(e=b.legend,b=b.value);var f=d.valueToPosition(b);d.options.vertical&&(f=d.maxPos-f);var g=c+"("+Math.round(f)+"px)",h={legend:e,selected:d.isTickSelected(b),style:{"-webkit-transform":g,"-moz-transform":g,"-o-transform":g,"-ms-transform":g,transform:g}};return h.selected&&d.options.getSelectionBarColor&&(h.style["background-color"]=d.getSelectionBarColor()),!h.selected&&d.options.getTickColor&&(h.style["background-color"]=d.getTickColor(b)),d.options.ticksTooltip&&(h.tooltip=d.options.ticksTooltip(b),h.tooltipPlacement=d.options.vertical?"right":"top"),(d.options.showTicksValues===!0||b%d.options.showTicksValues===0)&&(h.value=d.getDisplayValue(b,"tick-value"),d.options.ticksValuesTooltip&&(h.valueTooltip=d.options.ticksValuesTooltip(b),h.valueTooltipPlacement=d.options.vertical?"right":"top")),d.getLegend&&(e=d.getLegend(b,d.options.id),e&&(h.legend=e)),h})}},getTicksArray:function(){var a=this.step,b=[];this.intermediateTicks&&(a=this.options.showTicks);for(var c=this.minValue;c<=this.maxValue;c+=a)b.push(c);return b},isTickSelected:function(a){if(!this.range)if(null!==this.options.showSelectionBarFromValue){var b=this.options.showSelectionBarFromValue;if(this.lowValue>b&&a>=b&&a<=this.lowValue)return!0;if(this.lowValue=a&&a>=this.lowValue)return!0}else if(this.options.showSelectionBarEnd){if(a>=this.lowValue)return!0}else if(this.options.showSelectionBar&&a<=this.lowValue)return!0;return this.range&&a>=this.lowValue&&a<=this.highValue?!0:!1},updateFloorLab:function(){this.translateFn(this.minValue,this.flrLab,"floor"),this.getDimension(this.flrLab);var a=this.options.rightToLeft?this.barDimension-this.flrLab.rzsd:0;this.setPosition(this.flrLab,a)},updateCeilLab:function(){this.translateFn(this.maxValue,this.ceilLab,"ceil"),this.getDimension(this.ceilLab);var a=this.options.rightToLeft?0:this.barDimension-this.ceilLab.rzsd;this.setPosition(this.ceilLab,a)},updateHandles:function(a,b){"lowValue"===a?this.updateLowHandle(b):this.updateHighHandle(b),this.updateSelectionBar(),this.updateTicksScale(),this.range&&this.updateCmbLabel()},getHandleLabelPos:function(a,b){var c=this[a].rzsd,d=b-c/2+this.handleHalfDim,e=this.barDimension-c;return this.options.boundPointerLabels?this.options.rightToLeft&&"minLab"===a||!this.options.rightToLeft&&"maxLab"===a?Math.min(d,e):Math.min(Math.max(d,0),e):d},updateLowHandle:function(a){if(this.setPosition(this.minH,a),this.translateFn(this.lowValue,this.minLab,"model"),this.setPosition(this.minLab,this.getHandleLabelPos("minLab",a)),this.options.getPointerColor){var b=this.getPointerColor("min");this.scope.minPointerStyle={backgroundColor:b}}this.options.autoHideLimitLabels&&this.shFloorCeil()},updateHighHandle:function(a){if(this.setPosition(this.maxH,a),this.translateFn(this.highValue,this.maxLab,"high"),this.setPosition(this.maxLab,this.getHandleLabelPos("maxLab",a)),this.options.getPointerColor){var b=this.getPointerColor("max");this.scope.maxPointerStyle={backgroundColor:b}}this.options.autoHideLimitLabels&&this.shFloorCeil()},shFloorCeil:function(){if(!this.options.hidePointerLabels){var a=!1,b=!1,c=this.isLabelBelowFloorLab(this.minLab),d=this.isLabelAboveCeilLab(this.minLab),e=this.isLabelAboveCeilLab(this.maxLab),f=this.isLabelBelowFloorLab(this.cmbLab),g=this.isLabelAboveCeilLab(this.cmbLab);if(c?(a=!0,this.hideEl(this.flrLab)):(a=!1,this.showEl(this.flrLab)),d?(b=!0,this.hideEl(this.ceilLab)):(b=!1,this.showEl(this.ceilLab)),this.range){var h=this.cmbLabelShown?g:e,i=this.cmbLabelShown?f:c;h?this.hideEl(this.ceilLab):b||this.showEl(this.ceilLab),i?this.hideEl(this.flrLab):a||this.showEl(this.flrLab)}}},isLabelBelowFloorLab:function(a){var b=this.options.rightToLeft,c=a.rzsp,d=a.rzsd,e=this.flrLab.rzsp,f=this.flrLab.rzsd;return b?c+d>=e-2:e+f+2>=c},isLabelAboveCeilLab:function(a){var b=this.options.rightToLeft,c=a.rzsp,d=a.rzsd,e=this.ceilLab.rzsp,f=this.ceilLab.rzsd;return b?e+f+2>=c:c+d>=e-2},updateRestrictionBar:function(){var a=0,b=0;if(this.options.restrictedRange){this.options.restrictedRange=Array.isArray(this.options.restrictedRange)?this.options.restrictedRange:[this.options.restrictedRange];for(var c in this.options.restrictedRange){var d=this.valueToPosition(this.options.restrictedRange[c].from),e=this.valueToPosition(this.options.restrictedRange[c].to);b=Math.abs(e-d),a=this.options.rightToLeft?e+this.handleHalfDim:d+this.handleHalfDim,this.setDimension(this.restrictedBar[c],b),this.setPosition(this.restrictedBar[c],a)}}},updateSelectionBar:function(){var a=0,b=0,c=this.options.rightToLeft?!this.options.showSelectionBarEnd:this.options.showSelectionBarEnd,d=this.options.rightToLeft?this.maxH.rzsp+this.handleHalfDim:this.minH.rzsp+this.handleHalfDim;if(this.range)b=Math.abs(this.maxH.rzsp-this.minH.rzsp),a=d;else if(null!==this.options.showSelectionBarFromValue){var e=this.options.showSelectionBarFromValue,f=this.valueToPosition(e),g=this.options.rightToLeft?this.lowValue<=e:this.lowValue>e;g?(b=this.minH.rzsp-f,a=f+this.handleHalfDim):(b=f-this.minH.rzsp,a=this.minH.rzsp+this.handleHalfDim)}else c?(b=Math.abs(this.maxPos-this.minH.rzsp)+this.handleHalfDim,a=this.minH.rzsp+this.handleHalfDim):(b=this.minH.rzsp+this.handleHalfDim,a=0);if(this.setDimension(this.selBar,b),this.setPosition(this.selBar,a),this.range&&this.options.showOuterSelectionBars&&(this.options.rightToLeft?(this.setDimension(this.rightOutSelBar,a),this.setPosition(this.rightOutSelBar,0),this.setDimension(this.leftOutSelBar,this.getDimension(this.fullBar)-(a+b)),this.setPosition(this.leftOutSelBar,a+b)):(this.setDimension(this.leftOutSelBar,a),this.setPosition(this.leftOutSelBar,0),this.setDimension(this.rightOutSelBar,this.getDimension(this.fullBar)-(a+b)),this.setPosition(this.rightOutSelBar,a+b))),this.options.getSelectionBarColor){var h=this.getSelectionBarColor();this.scope.barStyle={backgroundColor:h}}else if(this.options.selectionBarGradient){var i=null!==this.options.showSelectionBarFromValue?this.valueToPosition(this.options.showSelectionBarFromValue):0,j=i-a>0^c,k=this.options.vertical?j?"bottom":"top":j?"left":"right";this.scope.barStyle={backgroundImage:"linear-gradient(to "+k+", "+this.options.selectionBarGradient.from+" 0%,"+this.options.selectionBarGradient.to+" 100%)"},this.options.vertical?(this.scope.barStyle.backgroundPosition="center "+(i+b+a+(j?-this.handleHalfDim:0))+"px",this.scope.barStyle.backgroundSize="100% "+(this.barDimension-this.handleHalfDim)+"px"):(this.scope.barStyle.backgroundPosition=i-a+(j?this.handleHalfDim:0)+"px center",this.scope.barStyle.backgroundSize=this.barDimension-this.handleHalfDim+"px 100%")}},getSelectionBarColor:function(){return this.range?this.options.getSelectionBarColor(this.scope.rzSliderModel,this.scope.rzSliderHigh):this.options.getSelectionBarColor(this.scope.rzSliderModel)},getPointerColor:function(a){return"max"===a?this.options.getPointerColor(this.scope.rzSliderHigh,a):this.options.getPointerColor(this.scope.rzSliderModel,a)},getTickColor:function(a){return this.options.getTickColor(a)},updateCmbLabel:function(){var a=null;if(a=this.options.rightToLeft?this.minLab.rzsp-this.minLab.rzsd-10<=this.maxLab.rzsp:this.minLab.rzsp+this.minLab.rzsd+10>=this.maxLab.rzsp){var b=this.getDisplayValue(this.lowValue,"model"),c=this.getDisplayValue(this.highValue,"high"),d="";d=this.options.mergeRangeLabelsIfSame&&b===c?b:this.options.rightToLeft?c+this.options.labelOverlapSeparator+b:b+this.options.labelOverlapSeparator+c,this.translateFn(d,this.cmbLab,"cmb",!1);var e=this.options.boundPointerLabels?Math.min(Math.max(this.selBar.rzsp+this.selBar.rzsd/2-this.cmbLab.rzsd/2,0),this.barDimension-this.cmbLab.rzsd):this.selBar.rzsp+this.selBar.rzsd/2-this.cmbLab.rzsd/2;this.setPosition(this.cmbLab,e),this.cmbLabelShown=!0,this.hideEl(this.minLab),this.hideEl(this.maxLab),this.showEl(this.cmbLab)}else this.cmbLabelShown=!1,this.updateHighHandle(this.valueToPosition(this.highValue)),this.updateLowHandle(this.valueToPosition(this.lowValue)),this.showEl(this.maxLab),this.showEl(this.minLab),this.hideEl(this.cmbLab);this.options.autoHideLimitLabels&&this.shFloorCeil()},getDisplayValue:function(a,b){return this.options.stepsArray&&!this.options.bindIndexForStepsArray&&(a=this.getStepValue(a)),this.customTrFn(a,this.options.id,b)},roundStep:function(a,b){var c=b?b:this.step,d=parseFloat((a-this.minValue)/c).toPrecision(12);d=Math.round(+d)*c;var e=(this.minValue+d).toFixed(this.precision);return+e},hideEl:function(a){return a.css({visibility:"hidden"})},showEl:function(a){return a.rzAlwaysHide?a:a.css({visibility:"visible"})},setPosition:function(a,b){a.rzsp=b;var c={};return c[this.positionProperty]=Math.round(b)+"px",a.css(c),b},resetPosition:function(a){a.css({left:null,bottom:null})},getDimension:function(a){var b=a[0].getBoundingClientRect();return this.options.vertical?a.rzsd=(b.bottom-b.top)*this.options.scale:a.rzsd=(b.right-b.left)*this.options.scale,a.rzsd},setDimension:function(a,b){a.rzsd=b;var c={};return c[this.dimensionProperty]=Math.round(b)+"px",a.css(c),b},sanitizeValue:function(a){return Math.min(Math.max(a,this.minValue),this.maxValue)},valueToPosition:function(a){var b=this.linearValueToPosition;this.options.customValueToPosition?b=this.options.customValueToPosition:this.options.logScale&&(b=this.logValueToPosition),a=this.sanitizeValue(a);var c=b(a,this.minValue,this.maxValue)||0;return this.options.rightToLeft&&(c=1-c),c*this.maxPos},linearValueToPosition:function(a,b,c){var d=c-b;return(a-b)/d},logValueToPosition:function(a,b,c){a=Math.log(a),b=Math.log(b),c=Math.log(c);var d=c-b;return(a-b)/d},positionToValue:function(a){var b=a/this.maxPos;this.options.rightToLeft&&(b=1-b);var c=this.linearPositionToValue;return this.options.customPositionToValue?c=this.options.customPositionToValue:this.options.logScale&&(c=this.logPositionToValue),c(b,this.minValue,this.maxValue)||0},linearPositionToValue:function(a,b,c){return a*(c-b)+b},logPositionToValue:function(a,b,c){b=Math.log(b),c=Math.log(c);var d=a*(c-b)+b;return Math.exp(d)},getEventAttr:function(a,b){return void 0===a.originalEvent?a[b]:a.originalEvent[b]},getEventXY:function(a,b){var c=this.options.vertical?"clientY":"clientX";if(void 0!==a[c])return a[c];var d=this.getEventAttr(a,"touches");if(void 0!==b)for(var e=0;ec?this.minH:c>d?this.maxH:this.options.rightToLeft?b>this.minH.rzsp?this.minH:this.maxH:b=i?h=k:i>=this.maxPos?h=j:(h=this.positionToValue(i),h=d&&a.isNumber(this.options.showTicks)?this.roundStep(h,this.options.showTicks):this.roundStep(h)),this.positionTrackingHandle(h)}},onEnd:function(a,b){this.moving=!1,this.options.disableAnimation||this.sliderElem.removeClass("noanimate");var d=this.getEventAttr(b,"changedTouches");if(!d||d[0].identifier===this.touchId){this.isDragging=!1,this.touchId=null,this.options.keyboardSupport||(this.minH.removeClass("rz-active"),this.maxH.removeClass("rz-active"),this.tracking=""),this.dragging.active=!1;var e=this.getEventNames(b);c.off(e.moveEvent,a),c.off(e.endEvent,this.endHandlerToBeRemovedOnEnd),this.endHandlerToBeRemovedOnEnd=null,this.callOnEnd()}},onTickClick:function(a,b){this.onMove(a,b,!0)},onPointerFocus:function(b,c){this.tracking=c,b.one("blur",a.bind(this,this.onPointerBlur,b)),b.on("keydown",a.bind(this,this.onKeyboardEvent)),b.on("keyup",a.bind(this,this.onKeyUp)),this.firstKeyDown=!0,b.addClass("rz-active"),this.currentFocusElement={pointer:b,ref:c}},onKeyUp:function(){this.firstKeyDown=!0,this.callOnEnd()},onPointerBlur:function(a){a.off("keydown"),a.off("keyup"),a.removeClass("rz-active"),this.isDragging||(this.tracking="",this.currentFocusElement=null)},skipRestrictedRanges:function(a,b){if(this.options.restrictedRange&&Array.isArray(this.options.restrictedRange))for(var c in this.options.restrictedRange){var d=this.options.restrictedRange[c];if(0===d.from&&0===b&&[37,40].includes(a)||d.to>=this.options.restrictedRange[this.options.restrictedRange.length-1].to&&b>=this.options.restrictedRange[this.options.restrictedRange.length-1].to&&[38,39].includes(a))return b;d.to>b&&b>d.from&&(b=Math.abs(d.to-b)>Math.abs(d.from-b)?d.to:d.from)}return b},getKeyActions:function(a){var b=a+this.step,c=a-this.step,d=a+this.valueRange/10,e=a-this.valueRange/10;this.options.reversedControls&&(b=a-this.step,c=a+this.step,d=a-this.valueRange/10,e=a+this.valueRange/10);var f={UP:b,DOWN:c,LEFT:c,RIGHT:b,PAGEUP:d,PAGEDOWN:e,HOME:this.options.reversedControls?this.maxValue:this.minValue,END:this.options.reversedControls?this.minValue:this.maxValue};return this.options.rightToLeft&&(f.LEFT=b,f.RIGHT=c,this.options.vertical&&(f.UP=c,f.DOWN=b)),f},onKeyboardEvent:function(a){var c=a.keyCode||a.which,d=this[this.tracking],e={38:"UP",40:"DOWN",37:"LEFT",39:"RIGHT",33:"PAGEUP",34:"PAGEDOWN",36:"HOME",35:"END"},f=this.getKeyActions(d),g=e[c],h=f[g];if(null!=h&&""!==this.tracking){a.preventDefault(),this.firstKeyDown&&(this.firstKeyDown=!1,this.callOnStart());var i=this;b(function(){var a=i.roundStep(i.sanitizeValue(h));if(a=i.options.skipRestrictedRangesWithArrowKeys?i.skipRestrictedRanges(c,a):a,i.options.draggableRangeOnly){var b,d,e=i.highValue-i.lowValue;"lowValue"===i.tracking?(b=a,d=a+e,d>i.maxValue&&(d=i.maxValue,b=d-e)):(d=a,b=a-e,b=k,h=k>=this.maxPos-e,g){if(0===i.rzsp)return;c=this.getValue("min",k,!0,!1),d=this.getValue("max",k,!0,!1)}else if(h){if(j.rzsp===this.maxPos)return;d=this.getValue("max",k,!0,!0),c=this.getValue("min",k,!0,!0)}else c=this.getValue("min",k,!1),d=this.getValue("max",k,!1);this.positionTrackingBar(c,d)},positionTrackingBar:function(a,b){null!=this.options.minLimit&&athis.options.maxLimit&&(b=this.options.maxLimit,a=b-this.dragging.difference),this.lowValue=a,this.highValue=b,this.applyLowValue(),this.range&&this.applyHighValue(),this.applyModel(!0),this.updateHandles("lowValue",this.valueToPosition(a)),this.updateHandles("highValue",this.valueToPosition(b))},positionTrackingHandle:function(a){var b=!1;a=this.applyMinMaxLimit(a),a=this.applyRestrictedRange(a),this.range&&(this.options.pushRange?(a=this.applyPushRange(a),b=!0):(this.options.noSwitching&&("lowValue"===this.tracking&&a>this.highValue?a=this.applyMinMaxRange(this.highValue):"highValue"===this.tracking&&athis.highValue?(this.lowValue=this.highValue,this.applyLowValue(),this.applyModel(),this.updateHandles(this.tracking,this.maxH.rzsp),this.updateAriaAttributes(),this.tracking="highValue",this.minH.removeClass("rz-active"),this.maxH.addClass("rz-active"),this.options.keyboardSupport&&this.focusElement(this.maxH),b=!0):"highValue"===this.tracking&&athis.options.maxLimit?this.options.maxLimit:a},applyMinMaxRange:function(a){var b="lowValue"===this.tracking?this.highValue:this.lowValue,c=Math.abs(a-b);return null!=this.options.minRange&&cthis.options.maxRange?"lowValue"===this.tracking?this.highValue-this.options.maxRange:this.lowValue+this.options.maxRange:a},applyRestrictedRange:function(a){for(var b in this.options.restrictedRange)if(null!=this.options.restrictedRange[b]&&a>this.options.restrictedRange[b].from&&athis.options.restrictedRange[b].from+c?this.options.restrictedRange[b].to:this.options.restrictedRange[b].from;if("highValue"===this.tracking)return ab?("lowValue"===this.tracking?(this.highValue=Math.min(a+c,this.maxValue),a=this.highValue-c,this.applyHighValue(),this.updateHandles("highValue",this.valueToPosition(this.highValue))):(this.lowValue=Math.max(a-c,this.minValue),a=this.lowValue+c,this.applyLowValue(),this.updateHandles("lowValue",this.valueToPosition(this.lowValue))),this.updateAriaAttributes()):null!==d&&b>d&&("lowValue"===this.tracking?(this.highValue=a+d,this.applyHighValue(),this.updateHandles("highValue",this.valueToPosition(this.highValue))):(this.lowValue=a-d,this.applyLowValue(),this.updateHandles("lowValue",this.valueToPosition(this.lowValue))),this.updateAriaAttributes()),a},applyModel:function(a){this.internalChange=!0,this.scope.$apply(),a&&this.callOnChange(),this.internalChange=!1},callOnStart:function(){if(this.options.onStart){var a=this,b="lowValue"===this.tracking?"min":"max";this.scope.$evalAsync(function(){a.options.onStart(a.options.id,a.scope.rzSliderModel,a.scope.rzSliderHigh,b)})}},callOnChange:function(){if(this.options.onChange){var a=this,b="lowValue"===this.tracking?"min":"max";this.scope.$evalAsync(function(){a.options.onChange(a.options.id,a.scope.rzSliderModel,a.scope.rzSliderHigh,b)})}},callOnEnd:function(){if(this.options.onEnd){var a=this,b="lowValue"===this.tracking?"min":"max";this.scope.$evalAsync(function(){a.options.onEnd(a.options.id,a.scope.rzSliderModel,a.scope.rzSliderHigh,b)})}this.scope.$emit("slideEnded")}},h}]).directive("rzslider",["RzSlider",function(a){return{restrict:"AE",replace:!0,scope:{rzSliderModel:"=?",rzSliderHigh:"=?",rzSliderOptions:"&?",rzSliderTplUrl:"@"},templateUrl:function(a,b){return b.rzSliderTplUrl||"rzSliderTpl.html"},link:function(b,c){b.slider=new a(b,c)}}}]);return b.run(["$templateCache",function(a){a.put("rzSliderTpl.html",'
  • {{ t.value }} {{ t.legend }}
')}]),b.name}); \ No newline at end of file diff --git a/dist/rzslider.scss b/dist/rzslider.scss index 3afa6db..5f60607 100644 --- a/dist/rzslider.scss +++ b/dist/rzslider.scss @@ -1,7 +1,7 @@ -/*! angularjs-slider - v6.4.2 - - (c) Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - +/*! angularjs-slider - v7.1.0 - + (c) Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu - https://github.com/angular-slider/angularjs-slider - - 2017-12-01 */ + 2022-05-26 */ .rzslider { position: relative; display: inline-block; @@ -15,6 +15,10 @@ user-select: none; } +.rzslider.noanimate * { + transition: none !important; +} + .rzslider.with-legend { margin-bottom: 40px; } @@ -64,6 +68,7 @@ padding-top: 16px; margin-top: -16px; box-sizing: border-box; + transition: all linear 0.3s; } .rzslider .rz-draggable { @@ -95,6 +100,13 @@ z-index: 2; background: #0db9f0; border-radius: 2px; + transition: background-color linear 0.3s; +} + +.rzslider .rz-restricted { + z-index: 3; + background: #ff0000; + border-radius: 2px; } .rzslider .rz-pointer { @@ -105,6 +117,7 @@ cursor: pointer; background-color: #0db9f0; border-radius: 16px; + transition: all linear 0.3s; } .rzslider .rz-pointer:after { @@ -135,10 +148,12 @@ padding: 1px 3px; color: #55637d; cursor: default; + transition: all linear 0.3s; } .rzslider .rz-bubble.rz-limit { color: #55637d; + transition: none; } .rzslider .rz-ticks { @@ -169,6 +184,7 @@ cursor: pointer; background: #d8e0f3; border-radius: 50%; + transition: background-color linear 0.3s; } .rzslider .rz-tick.rz-selected { @@ -178,8 +194,7 @@ .rzslider .rz-tick-value { position: absolute; top: -30px; - -webkit-transform: translate(-50%, 0); - transform: translate(-50%, 0); + transform: translate(-50%, 0); } .rzslider .rz-tick-legend { @@ -187,8 +202,7 @@ top: 24px; max-width: 50px; white-space: normal; - -webkit-transform: translate(-50%, 0); - transform: translate(-50%, 0); + transform: translate(-50%, 0); } .rzslider.rz-vertical { @@ -251,8 +265,7 @@ .rzslider.rz-vertical .rz-tick-value { top: auto; left: 24px; - -webkit-transform: translate(0, -28%); - transform: translate(0, -28%); + transform: translate(0, -28%); } .rzslider.rz-vertical .rz-tick-legend { @@ -260,8 +273,7 @@ right: 24px; max-width: none; white-space: nowrap; - -webkit-transform: translate(0, -28%); - transform: translate(0, -28%); + transform: translate(0, -28%); } .rzslider.rz-vertical .rz-ticks-values-under .rz-tick-value { @@ -269,4 +281,4 @@ bottom: auto; left: auto; } -/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJ6c2xpZGVyLmNzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7O2NBR2M7QUFDZDtFQUNFLG1CQUFtQjtFQUNuQixzQkFBc0I7RUFDdEIsWUFBWTtFQUNaLFlBQVk7RUFDWixzQkFBc0I7RUFDdEIsdUJBQXVCO0VBQ3ZCLDBCQUFrQjtLQUFsQix1QkFBa0I7TUFBbEIsc0JBQWtCO1VBQWxCLGtCQUFrQjtDQUNuQjs7QUFFRDtFQUNFLG9CQUF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LTI4JSk7XG59XG5cbi5yenNsaWRlci5yei12ZXJ0aWNhbCAucnotdGlja3MtdmFsdWVzLXVuZGVyIC5yei10aWNrLXZhbHVlIHtcbiAgcmlnaHQ6IDI0cHg7XG4gIGJvdHRvbTogYXV0bztcbiAgbGVmdDogYXV0bztcbn0iXX0= */ \ No newline at end of file diff --git a/issue_template.md b/issue_template.md deleted file mode 100644 index b99c3b9..0000000 --- a/issue_template.md +++ /dev/null @@ -1,12 +0,0 @@ -### Steps to reproduce -1. -2. -3. - -Demo: http://jsfiddle.net/cwhgLcjv/ (fork this example and update the link) - -### Expected behaviour -Tell us what should happen - -### Actual behaviour -Tell us what happens instead diff --git a/package.json b/package.json index d45df94..104e3ba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angularjs-slider", - "version": "6.4.3", + "version": "7.1.0", "description": "AngularJS slider directive with no external dependencies. Mobile friendly!.", "main": "dist/rzslider.js", "types": "dist/rzslider.d.ts", @@ -8,21 +8,27 @@ "type": "git", "url": "https://github.com/angular-slider/angularjs-slider" }, - "keywords": ["angular", "slider"], + "keywords": [ + "angular", + "slider" + ], + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, "scripts": { "start": "http-server ./ -c-1", "commit": "git-cz", "build": "grunt", "test": "grunt test", "report-coverage": "cat ./tests/coverage/lcov.info | codecov", - "format": "prettier --single-quote --no-semi --write \"{src,tests,demo}/{,!(lib)/**}/*.{js,less,css}\"", - "precommit": "lint-staged", + "format": "prettier --write \"{src,tests,demo}/{,!(lib)/**}/*.{js,less,css}\"", + "precommit": "npm run build && git add dist && lint-staged", "e2e": "npm start & cypress run", "cypress:open": "cypress open" }, "lint-staged": { "{src,tests,demo}/{,!(lib)/**}/*.{js,less,css}": [ - "prettier --single-quote --no-semi --write", + "prettier --write", "git add" ] }, @@ -40,6 +46,7 @@ "cz-conventional-changelog": "^1.1.5", "grunt": "~0.4.2", "grunt-angular-templates": "^0.5.7", + "grunt-cli": "^1.2.0", "grunt-contrib-concat": "^0.5.1", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-mincss": "~0.3.2", @@ -65,14 +72,16 @@ "lint-staged": "^4.0.3", "mocha": "^3.1.2", "phantomjs": "^1.9.19", - "prettier": "^1.5.3", + "prettier": "^1.13.7", "recess": "~1.1.9", "sinon": "^1.17.2" }, - "author": "Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu ", + "author": "Rafal Zajac , Valentin Hervieu , Jussi Saarivirta , Angelin Sirbu ", "license": "MIT", "readmeFilename": "README.md", - "czConfig": { - "path": "node_modules/cz-conventional-changelog" + "config": { + "commitizen": { + "path": "node_modules/cz-conventional-changelog" + } } } diff --git a/rzslider.d.ts b/rzslider.d.ts index 9fc6185..e9ec697 100644 --- a/rzslider.d.ts +++ b/rzslider.d.ts @@ -25,7 +25,14 @@ declare module "angular" { minLimit?: number; /** Number (defaults to null): The maximum value authorized on the slider. */ maxLimit?: number; - /** Number (defaults to null): The minimum range authorized on the slider. Applies to range slider only. */ + /** + * Object(defaults to null): Has two _Number_ properties, _from_ and _to_ that determine + * the bounds of an area that is not authorized for values. _Applies to range slider only._ + */ + restrictedRange?: { from: number, to: number } | Array<{from: number, to: number}>; + /** Number (defaults to null): The minimum range authorized on the slider. Applies to range slider only. Can also use an array.*/ + skipRestrictedRangesWithArrowKeys?: boolean + /** Set to true to skip restricted ranges with arrow keys. */ minRange?: number; /** Number (defaults to null): The maximum range authorized on the slider. Applies to range slider only. */ maxRange?: number; @@ -70,7 +77,7 @@ declare module "angular" { * {value: 10, legend: 'Legend for 10'} // the display value will be 10 and a legend will be displayed under the corresponding tick. * ] */ - stepsArray?: any[]; + stepsArray?: number[] | Array<{value: number; legend?: string}>; /** * Boolean (defaults to false): Set to true to bind the index of the selected item to rz-slider-model and rz-slider-high. * (This was the default behavior prior to 4.0). @@ -126,8 +133,8 @@ declare module "angular" { showTicks?: boolean | number; /** Boolean or Number (defaults to false): Set to true to display a tick and the step value for each step of the slider. Set an integer to display ticks and the step value at intermediate positions. */ showTicksValues?: boolean | number; - /** Array (defaults to null): Use to display ticks at specific positions. The array contains the index of the ticks that should be displayed. For example, [0, 1, 5] will display a tick for the first, second and sixth values. */ - ticksArray?: number[]; + /** Array (defaults to null): Use to display ticks at specific positions. The array contains the index of the ticks that should be displayed. For example, [0, 1, 5] will display a tick for the first, second and sixth values. It also supports the { value: 0, legend: 'Bad' } format to display a legend for each tick. */ + ticksArray?: number[] | Array<{value: number; legend?: string}>; /** Function(value) (defaults to null): (requires angular-ui bootstrap) Used to display a tooltip when a tick is hovered. Set to a function that returns the tooltip content for a given value. */ ticksTooltip?: (value: number) => string; /** Function(value) (defaults to null): Same as ticksTooltip but for ticks values. */ @@ -146,6 +153,8 @@ declare module "angular" { boundPointerLabels?: boolean; /** Boolean (defaults to false): Set to true to merge the range labels if they are the same. For instance, if min and max are 50, the label will be "50 - 50" if mergeRangeLabelsIfSame: false, else "50". */ mergeRangeLabelsIfSame?: boolean; + /** String (defaults to ' - '): Separator to use when the labels overlap. For instance, if min and max are -1 and 1, the label will be "-1 .. 1" if `labelOverlapSeparator: ' .. '`. */ + labelOverlapSeparator?: string; /** Function(sliderId, modelValue, highValue, pointerType): Function to be called when a slider update is started. If an id was set in the options, then it's passed to this callback. This callback is called before any update on the model. pointerType is either 'min' or 'max' depending on which handle is used. */ onStart?: RzCallback; /** @@ -201,6 +210,8 @@ declare module "angular" { ariaLabelledBy?: string; /** String(default to null): Use instead of ariaLabel and ariaLabelHigh to reference the id of an element which will be used to label the slider(s). Adds the aria-labelledby attribute. */ ariaLabelledByHigh?: string; + /** Boolean (defaults to false): Set to true to disable slider animation. */ + disableAnimation?: boolean; } } } diff --git a/src/rzSliderTpl.html b/src/rzSliderTpl.html index 5b7bba1..2431f3e 100644 --- a/src/rzSliderTpl.html +++ b/src/rzSliderTpl.html @@ -15,21 +15,25 @@ - + + + + + - + - + - + - + - + - + - +
  • @@ -37,4 +41,4 @@ {{ t.legend }}
- \ No newline at end of file + diff --git a/src/rzslider.js b/src/rzslider.js index c517422..8b10560 100644 --- a/src/rzslider.js +++ b/src/rzslider.js @@ -31,7 +31,7 @@ })(this, function(angular) { 'use strict' var module = angular - .module('rzModule', []) + .module('rzSlider', []) .factory('RzSliderOptions', function() { var defaultOptions = { floor: 0, @@ -40,6 +40,8 @@ precision: 0, minRange: null, maxRange: null, + restrictedRange: null, + skipRestrictedRangesWithArrowKeys: null, pushRange: false, minLimit: null, maxLimit: null, @@ -75,6 +77,7 @@ enforceRange: false, noSwitching: false, onlyBindHandles: false, + disableAnimation: false, onStart: null, onChange: null, onEnd: null, @@ -82,6 +85,7 @@ reversedControls: false, boundPointerLabels: true, mergeRangeLabelsIfSame: false, + labelOverlapSeparator: ' - ', customTemplateScope: null, logScale: false, customValueToPosition: null, @@ -90,20 +94,20 @@ ariaLabel: null, ariaLabelledBy: null, ariaLabelHigh: null, - ariaLabelledByHigh: null + ariaLabelledByHigh: null, } var globalOptions = {} var factory = {} /** - * `options({})` allows global configuration of all sliders in the - * application. - * - * var app = angular.module( 'App', ['rzModule'], function( RzSliderOptions ) { - * // show ticks for all sliders - * RzSliderOptions.options( { showTicks: true } ); - * }); - */ + * `options({})` allows global configuration of all sliders in the + * application. + * + * var app = angular.module( 'App', ['rzSlider'], function( RzSliderOptions ) { + * // show ticks for all sliders + * RzSliderOptions.options( { showTicks: true } ); + * }); + */ factory.options = function(value) { angular.extend(globalOptions, value) } @@ -116,15 +120,15 @@ }) .factory('rzThrottle', function($timeout) { /** - * rzThrottle - * - * Taken from underscore project - * - * @param {Function} func - * @param {number} wait - * @param {ThrottleOptions} options - * @returns {Function} - */ + * rzThrottle + * + * Taken from underscore project + * + * @param {Function} func + * @param {number} wait + * @param {ThrottleOptions} options + * @returns {Function} + */ return function(func, wait, options) { 'use strict' /* istanbul ignore next */ @@ -172,168 +176,173 @@ 'use strict' /** - * Slider - * - * @param {ngScope} scope The AngularJS scope - * @param {Element} sliderElem The slider directive element wrapped in jqLite - * @constructor - */ - var Slider = function(scope, sliderElem) { - /** - * The slider's scope + * Slider * - * @type {ngScope} + * @param {ngScope} scope The AngularJS scope + * @param {Element} sliderElem The slider directive element wrapped in jqLite + * @constructor */ + var Slider = function(scope, sliderElem) { + /** + * The slider's scope + * + * @type {ngScope} + */ this.scope = scope /** - * The slider inner low value (linked to rzSliderModel) - * @type {number} - */ + * The slider inner low value (linked to rzSliderModel) + * @type {number} + */ this.lowValue = 0 /** - * The slider inner high value (linked to rzSliderHigh) - * @type {number} - */ + * The slider inner high value (linked to rzSliderHigh) + * @type {number} + */ this.highValue = 0 /** - * Slider element wrapped in jqLite - * - * @type {jqLite} - */ + * Slider element wrapped in jqLite + * + * @type {jqLite} + */ this.sliderElem = sliderElem /** - * Slider type - * - * @type {boolean} Set to true for range slider - */ + * Slider type + * + * @type {boolean} Set to true for range slider + */ this.range = this.scope.rzSliderModel !== undefined && this.scope.rzSliderHigh !== undefined /** - * Values recorded when first dragging the bar - * - * @type {Object} - */ + * Values recorded when first dragging the bar + * + * @type {Object} + */ this.dragging = { active: false, value: 0, difference: 0, position: 0, lowLimit: 0, - highLimit: 0 + highLimit: 0, } /** - * property that handle position (defaults to left for horizontal) - * @type {string} - */ + * property that handle position (defaults to left for horizontal) + * @type {string} + */ this.positionProperty = 'left' /** - * property that handle dimension (defaults to width for horizontal) - * @type {string} - */ + * property that handle dimension (defaults to width for horizontal) + * @type {string} + */ this.dimensionProperty = 'width' /** - * Half of the width or height of the slider handles - * - * @type {number} - */ + * Half of the width or height of the slider handles + * + * @type {number} + */ this.handleHalfDim = 0 /** - * Maximum position the slider handle can have - * - * @type {number} - */ + * Maximum position the slider handle can have + * + * @type {number} + */ this.maxPos = 0 /** - * Precision - * - * @type {number} - */ + * Precision + * + * @type {number} + */ this.precision = 0 /** - * Step - * - * @type {number} - */ + * Step + * + * @type {number} + */ this.step = 1 /** - * The name of the handle we are currently tracking - * - * @type {string} - */ + * The name of the handle we are currently tracking + * + * @type {string} + */ this.tracking = '' /** - * Minimum value (floor) of the model - * - * @type {number} - */ + * Minimum value (floor) of the model + * + * @type {number} + */ this.minValue = 0 /** - * Maximum value (ceiling) of the model - * - * @type {number} - */ + * Maximum value (ceiling) of the model + * + * @type {number} + */ this.maxValue = 0 /** - * The delta between min and max value - * - * @type {number} - */ + * The delta between min and max value + * + * @type {number} + */ this.valueRange = 0 /** - * If showTicks/showTicksValues options are number. - * In this case, ticks values should be displayed below the slider. - * @type {boolean} - */ + * If showTicks/showTicksValues options are number. + * In this case, ticks values should be displayed below the slider. + * @type {boolean} + */ this.intermediateTicks = false /** - * Set to true if init method already executed - * - * @type {boolean} - */ + * Set to true if init method already executed + * + * @type {boolean} + */ this.initHasRun = false /** - * Used to call onStart on the first keydown event - * - * @type {boolean} - */ + * Used to call onStart on the first keydown event + * + * @type {boolean} + */ this.firstKeyDown = false /** - * Internal flag to prevent watchers to be called when the sliders value are modified internally. - * @type {boolean} - */ + * Internal flag to prevent watchers to be called when the sliders value are modified internally. + * @type {boolean} + */ this.internalChange = false /** - * Internal flag to keep track of the visibility of combo label - * @type {boolean} - */ + * Internal flag to keep track of the visibility of combo label + * @type {boolean} + */ this.cmbLabelShown = false /** - * Internal variable to keep track of the focus element - */ + * Internal variable to keep track of the focus element + */ this.currentFocusElement = null + /** + * Internal variable to know if we are already moving + */ + this.moving = false + // Slider DOM elements wrapped in jqLite this.fullBar = null // The whole slider bar this.selBar = null // Highlight between two handles @@ -353,10 +362,10 @@ // Add instance methods Slider.prototype = { /** - * Initialize slider - * - * @returns {undefined} - */ + * Initialize slider + * + * @returns {undefined} + */ init: function() { var thrLow, thrHigh, @@ -374,6 +383,7 @@ this.setDisabledState() this.calcViewDimensions() this.setMinAndMax() + this.updateRestrictionBar() this.addAccessibility() this.updateCeilLab() this.updateFloorLab() @@ -388,6 +398,10 @@ this.initHasRun = true + if (this.options.disableAnimation) { + this.sliderElem.addClass('noanimate') + } + // Watch for changes to the model thrLow = rzThrottle(function() { self.onLowHandleChange() @@ -511,8 +525,8 @@ }, /* - * Reflow the slider when the low handle changes (called with throttle) - */ + * Reflow the slider when the low handle changes (called with throttle) + */ onLowHandleChange: function() { this.syncLowValue() if (this.range) this.syncHighValue() @@ -527,8 +541,8 @@ }, /* - * Reflow the slider when the high handle changes (called with throttle) - */ + * Reflow the slider when the high handle changes (called with throttle) + */ onHighHandleChange: function() { this.syncLowValue() this.syncHighValue() @@ -541,8 +555,8 @@ }, /** - * Read the user options and apply them to the slider model - */ + * Read the user options and apply them to the slider model + */ applyOptions: function() { var sliderOptions if (this.scope.rzSliderOptions) @@ -595,6 +609,9 @@ if (this.options.vertical) { this.positionProperty = 'bottom' this.dimensionProperty = 'height' + } else { + this.positionProperty = 'left' + this.dimensionProperty = 'width' } if (this.options.customTemplateScope) @@ -624,11 +641,12 @@ }, /** - * Resets slider - * - * @returns {undefined} - */ + * Resets slider + * + * @returns {undefined} + */ resetSlider: function() { + this.resetLabelsValue() this.manageElementsStyle() this.addAccessibility() this.setMinAndMax() @@ -638,6 +656,7 @@ this.manageEventsBindings() this.setDisabledState() this.calcViewDimensions() + this.updateRestrictionBar() this.refocusPointerIfNeeded() }, @@ -652,12 +671,46 @@ }, /** - * Set the slider children to variables for easy access - * - * Run only once during initialization - * - * @returns {undefined} - */ + * Check if the restrictedRange option using multiple or not + * + * Run only once during initialization and only in case 4 + * + * @returns {undefined} + */ + + ensureRestrictedBarIsArray: function(elem) { + var jElem = angular.element(elem) + this.restrictedBar = [] + if (this.options.restrictedRange) { + // this.options.restrictedRange converting to an array even if it's not entered as array. + this.options.restrictedRange = !Array.isArray( + this.options.restrictedRange + ) + ? [this.options.restrictedRange] + : this.options.restrictedRange + this.restrictedBar[0] = jElem + var mainDiv = elem.parentElement + for (var i = 1; i < this.options.restrictedRange.length; i++) { + var sp = document.createElement('span') + sp.setAttribute('class', 'rz-bar-wrapper') + sp.innerHTML = + '' + mainDiv.appendChild(sp) + this.restrictedBar[i] = angular.element(sp) + } + } else { + elem.style.visibility = 'hidden' + this.restrictedBar = null + } + }, + + /** + * Set the slider children to variables for easy access + * + * Run only once during initialization + * + * @returns {undefined} + */ initElemHandles: function() { // Assign all slider elements to object properties for easy access angular.forEach( @@ -679,27 +732,30 @@ this.selBar = jElem break case 4: - this.minH = jElem + this.ensureRestrictedBarIsArray(elem) break case 5: - this.maxH = jElem + this.minH = jElem break case 6: - this.flrLab = jElem + this.maxH = jElem break case 7: - this.ceilLab = jElem + this.flrLab = jElem break case 8: - this.minLab = jElem + this.ceilLab = jElem break case 9: - this.maxLab = jElem + this.minLab = jElem break case 10: - this.cmbLab = jElem + this.maxLab = jElem break case 11: + this.cmbLab = jElem + break + case 12: this.ticks = jElem break } @@ -719,8 +775,8 @@ }, /** - * Update each elements style based on options - */ + * Update each elements style based on options + */ manageElementsStyle: function() { if (!this.range) this.maxH.css('display', 'none') else this.maxH.css('display', '') @@ -756,6 +812,16 @@ this.leftOutSelBar, !this.range || !this.options.showOuterSelectionBars ) + + // this.restrictedBar is everytime an array + for (var r in this.restrictedBar) { + if (this.restrictedBar[r]) + this.alwaysHide( + this.restrictedBar[r], + !this.options.restrictedRange[r] + ) + } + this.alwaysHide( this.rightOutSelBar, !this.range || !this.options.showOuterSelectionBars @@ -765,7 +831,11 @@ this.fullBar.addClass('rz-transparent') } - if (this.options.vertical) this.sliderElem.addClass('rz-vertical') + if (this.options.vertical) { + this.sliderElem.addClass('rz-vertical') + } else { + this.sliderElem.removeClass('rz-vertical') + } if (this.options.draggableRange) this.selBar.addClass('rz-draggable') else this.selBar.removeClass('rz-draggable') @@ -781,10 +851,10 @@ }, /** - * Manage the events bindings based on readOnly and disabled options - * - * @returns {undefined} - */ + * Manage the events bindings based on readOnly and disabled options + * + * @returns {undefined} + */ manageEventsBindings: function() { if (this.options.disabled || this.options.readOnly) this.unbindEvents() @@ -792,10 +862,10 @@ }, /** - * Set the disabled state based on rzSliderDisabled - * - * @returns {undefined} - */ + * Set the disabled state based on rzSliderDisabled + * + * @returns {undefined} + */ setDisabledState: function() { if (this.options.disabled) { this.sliderElem.attr('disabled', 'disabled') @@ -805,22 +875,30 @@ }, /** - * Reset label values - * - * @return {undefined} - */ + * Reset label values + * + * @return {undefined} + */ resetLabelsValue: function() { this.minLab.rzsv = undefined this.maxLab.rzsv = undefined - }, - - /** - * Initialize slider handles positions and labels - * - * Run only once during initialization and every time view port changes size - * - * @returns {undefined} - */ + this.flrLab.rzsv = undefined + this.ceilLab.rzsv = undefined + this.cmbLab.rzsv = undefined + this.resetPosition(this.flrLab) + this.resetPosition(this.ceilLab) + this.resetPosition(this.cmbLab) + this.resetPosition(this.minLab) + this.resetPosition(this.maxLab) + }, + + /** + * Initialize slider handles positions and labels + * + * Run only once during initialization and every time view port changes size + * + * @returns {undefined} + */ initHandles: function() { this.updateLowHandle(this.valueToPosition(this.lowValue)) @@ -837,14 +915,14 @@ }, /** - * Translate value to human readable format - * - * @param {number|string} value - * @param {jqLite} label - * @param {String} which - * @param {boolean} [useCustomTr] - * @returns {undefined} - */ + * Translate value to human readable format + * + * @param {number|string} value + * @param {jqLite} label + * @param {String} which + * @param {boolean} [useCustomTr] + * @returns {undefined} + */ translateFn: function(value, label, which, useCustomTr) { useCustomTr = useCustomTr === undefined ? true : useCustomTr @@ -881,10 +959,10 @@ }, /** - * Set maximum and minimum values for the slider and ensure the model and high - * value match these limits - * @returns {undefined} - */ + * Set maximum and minimum values for the slider and ensure the model and high + * value match these limits + * @returns {undefined} + */ setMinAndMax: function() { this.step = +this.options.step this.precision = +this.options.precision @@ -916,12 +994,12 @@ }, /** - * Adds accessibility attributes - * - * Run only once during initialization - * - * @returns {undefined} - */ + * Adds accessibility attributes + * + * Run only once during initialization + * + * @returns {undefined} + */ addAccessibility: function() { this.minH.attr('role', 'slider') this.updateAriaAttributes() @@ -931,8 +1009,11 @@ ) this.minH.attr('tabindex', '0') else this.minH.attr('tabindex', '') - if (this.options.vertical) + if (this.options.vertical) { this.minH.attr('aria-orientation', 'vertical') + } else { + this.minH.attr('aria-orientation', 'horizontal') + } if (this.options.ariaLabel) this.minH.attr('aria-label', this.options.ariaLabel) else if (this.options.ariaLabelledBy) @@ -948,6 +1029,7 @@ else this.maxH.attr('tabindex', '') if (this.options.vertical) this.maxH.attr('aria-orientation', 'vertical') + else this.maxH.attr('aria-orientation', 'horizontal') if (this.options.ariaLabelHigh) this.maxH.attr('aria-label', this.options.ariaLabelHigh) else if (this.options.ariaLabelledByHigh) @@ -956,8 +1038,8 @@ }, /** - * Updates aria attributes according to current values - */ + * Updates aria attributes according to current values + */ updateAriaAttributes: function() { this.minH.attr({ 'aria-valuenow': this.scope.rzSliderModel, @@ -967,7 +1049,7 @@ 'model' ), 'aria-valuemin': this.minValue, - 'aria-valuemax': this.maxValue + 'aria-valuemax': this.maxValue, }) if (this.range) { this.maxH.attr({ @@ -978,18 +1060,18 @@ 'high' ), 'aria-valuemin': this.minValue, - 'aria-valuemax': this.maxValue + 'aria-valuemax': this.maxValue, }) } }, /** - * Calculate dimensions that are dependent on view port size - * - * Run once during initialization and every time view port changes size. - * - * @returns {undefined} - */ + * Calculate dimensions that are dependent on view port size + * + * Run once during initialization and every time view port changes size. + * + * @returns {undefined} + */ calcViewDimensions: function() { var handleWidth = this.getDimension(this.minH) @@ -1015,10 +1097,10 @@ }, /** - * Update the ticks position - * - * @returns {undefined} - */ + * Update the ticks position + * + * @returns {undefined} + */ updateTicksScale: function() { if (!this.options.showTicks) return @@ -1029,20 +1111,27 @@ if (this.options.rightToLeft) ticksArray.reverse() this.scope.ticks = ticksArray.map(function(value) { + var legend = null + if (angular.isObject(value)) { + legend = value.legend + value = value.value + } + var position = self.valueToPosition(value) if (self.options.vertical) position = self.maxPos - position var translation = translate + '(' + Math.round(position) + 'px)' var tick = { + legend: legend, selected: self.isTickSelected(value), style: { '-webkit-transform': translation, '-moz-transform': translation, '-o-transform': translation, '-ms-transform': translation, - transform: translation - } + transform: translation, + }, } if (tick.selected && self.options.getSelectionBarColor) { tick.style['background-color'] = self.getSelectionBarColor() @@ -1067,7 +1156,7 @@ } } if (self.getLegend) { - var legend = self.getLegend(value, self.options.id) + legend = self.getLegend(value, self.options.id) if (legend) tick.legend = legend } return tick @@ -1115,10 +1204,10 @@ }, /** - * Update position of the floor label - * - * @returns {undefined} - */ + * Update position of the floor label + * + * @returns {undefined} + */ updateFloorLab: function() { this.translateFn(this.minValue, this.flrLab, 'floor') this.getDimension(this.flrLab) @@ -1129,10 +1218,10 @@ }, /** - * Update position of the ceiling label - * - * @returns {undefined} - */ + * Update position of the ceiling label + * + * @returns {undefined} + */ updateCeilLab: function() { this.translateFn(this.maxValue, this.ceilLab, 'ceil') this.getDimension(this.ceilLab) @@ -1143,11 +1232,11 @@ }, /** - * Update slider handles and label positions - * - * @param {string} which - * @param {number} newPos - */ + * Update slider handles and label positions + * + * @param {string} which + * @param {number} newPos + */ updateHandles: function(which, newPos) { if (which === 'lowValue') this.updateLowHandle(newPos) else this.updateHighHandle(newPos) @@ -1158,13 +1247,13 @@ }, /** - * Helper function to work out the position for handle labels depending on RTL or not - * - * @param {string} labelName maxLab or minLab - * @param newPos - * - * @returns {number} - */ + * Helper function to work out the position for handle labels depending on RTL or not + * + * @param {string} labelName maxLab or minLab + * @param newPos + * + * @returns {number} + */ getHandleLabelPos: function(labelName, newPos) { var labelRzsd = this[labelName].rzsd, nearHandlePos = newPos - labelRzsd / 2 + this.handleHalfDim, @@ -1183,11 +1272,11 @@ }, /** - * Update low slider handle position and label - * - * @param {number} newPos - * @returns {undefined} - */ + * Update low slider handle position and label + * + * @param {number} newPos + * @returns {undefined} + */ updateLowHandle: function(newPos) { this.setPosition(this.minH, newPos) this.translateFn(this.lowValue, this.minLab, 'model') @@ -1199,7 +1288,7 @@ if (this.options.getPointerColor) { var pointercolor = this.getPointerColor('min') this.scope.minPointerStyle = { - backgroundColor: pointercolor + backgroundColor: pointercolor, } } @@ -1209,11 +1298,11 @@ }, /** - * Update high slider handle position and label - * - * @param {number} newPos - * @returns {undefined} - */ + * Update high slider handle position and label + * + * @param {number} newPos + * @returns {undefined} + */ updateHighHandle: function(newPos) { this.setPosition(this.maxH, newPos) this.translateFn(this.highValue, this.maxLab, 'high') @@ -1225,7 +1314,7 @@ if (this.options.getPointerColor) { var pointercolor = this.getPointerColor('max') this.scope.maxPointerStyle = { - backgroundColor: pointercolor + backgroundColor: pointercolor, } } if (this.options.autoHideLimitLabels) { @@ -1234,10 +1323,10 @@ }, /** - * Show/hide floor/ceiling label - * - * @returns {undefined} - */ + * Show/hide floor/ceiling label + * + * @returns {undefined} + */ shFloorCeil: function() { // Show based only on hideLimitLabels if pointer labels are hidden if (this.options.hidePointerLabels) { @@ -1309,10 +1398,39 @@ }, /** - * Update slider selection bar, combined label and range label - * - * @returns {undefined} - */ + * Update restricted area bar + * + * @returns {undefined} + */ + updateRestrictionBar: function() { + var position = 0, + dimension = 0 + if (this.options.restrictedRange) { + this.options.restrictedRange = !Array.isArray( + this.options.restrictedRange + ) + ? [this.options.restrictedRange] + : this.options.restrictedRange + for (var i in this.options.restrictedRange) { + var from = this.valueToPosition( + this.options.restrictedRange[i].from + ), + to = this.valueToPosition(this.options.restrictedRange[i].to) + dimension = Math.abs(to - from) + position = this.options.rightToLeft + ? to + this.handleHalfDim + : from + this.handleHalfDim + this.setDimension(this.restrictedBar[i], dimension) + this.setPosition(this.restrictedBar[i], position) + } + } + }, + + /** + * Update slider selection bar, combined label and range label + * + * @returns {undefined} + */ updateSelectionBar: function() { var position = 0, dimension = 0, @@ -1373,7 +1491,7 @@ if (this.options.getSelectionBarColor) { var color = this.getSelectionBarColor() this.scope.barStyle = { - backgroundColor: color + backgroundColor: color, } } else if (this.options.selectionBarGradient) { var offset = @@ -1382,8 +1500,12 @@ : 0, reversed = (offset - position > 0) ^ isSelectionBarFromRight, direction = this.options.vertical - ? reversed ? 'bottom' : 'top' - : reversed ? 'left' : 'right' + ? reversed + ? 'bottom' + : 'top' + : reversed + ? 'left' + : 'right' this.scope.barStyle = { backgroundImage: 'linear-gradient(to ' + @@ -1392,7 +1514,7 @@ this.options.selectionBarGradient.from + ' 0%,' + this.options.selectionBarGradient.to + - ' 100%)' + ' 100%)', } if (this.options.vertical) { this.scope.barStyle.backgroundPosition = @@ -1417,9 +1539,9 @@ }, /** - * Wrapper around the getSelectionBarColor of the user to pass to - * correct parameters - */ + * Wrapper around the getSelectionBarColor of the user to pass to + * correct parameters + */ getSelectionBarColor: function() { if (this.range) return this.options.getSelectionBarColor( @@ -1430,9 +1552,9 @@ }, /** - * Wrapper around the getPointerColor of the user to pass to - * correct parameters - */ + * Wrapper around the getPointerColor of the user to pass to + * correct parameters + */ getPointerColor: function(pointerType) { if (pointerType === 'max') { return this.options.getPointerColor( @@ -1447,18 +1569,18 @@ }, /** - * Wrapper around the getTickColor of the user to pass to - * correct parameters - */ + * Wrapper around the getTickColor of the user to pass to + * correct parameters + */ getTickColor: function(value) { return this.options.getTickColor(value) }, /** - * Update combined label position and value - * - * @returns {undefined} - */ + * Update combined label position and value + * + * @returns {undefined} + */ updateCmbLabel: function() { var isLabelOverlap = null if (this.options.rightToLeft) { @@ -1477,8 +1599,8 @@ labelVal = lowTr } else { labelVal = this.options.rightToLeft - ? highTr + ' - ' + lowTr - : lowTr + ' - ' + highTr + ? highTr + this.options.labelOverlapSeparator + lowTr + : lowTr + this.options.labelOverlapSeparator + highTr } this.translateFn(labelVal, this.cmbLab, 'cmb', false) @@ -1513,11 +1635,11 @@ }, /** - * Return the translated value if a translate function is provided else the original value - * @param value - * @param which if it's min or max handle - * @returns {*} - */ + * Return the translated value if a translate function is provided else the original value + * @param value + * @param which if it's min or max handle + * @returns {*} + */ getDisplayValue: function(value, which) { if (this.options.stepsArray && !this.options.bindIndexForStepsArray) { value = this.getStepValue(value) @@ -1526,12 +1648,12 @@ }, /** - * Round value to step and precision based on minValue - * - * @param {number} value - * @param {number} customStep a custom step to override the defined step - * @returns {number} - */ + * Round value to step and precision based on minValue + * + * @param {number} value + * @param {number} customStep a custom step to override the defined step + * @returns {number} + */ roundStep: function(value, customStep) { var step = customStep ? customStep : this.step, steppedDifference = parseFloat( @@ -1545,40 +1667,40 @@ }, /** - * Hide element - * - * @param element - * @returns {jqLite} The jqLite wrapped DOM element - */ + * Hide element + * + * @param element + * @returns {jqLite} The jqLite wrapped DOM element + */ hideEl: function(element) { return element.css({ - visibility: 'hidden' + visibility: 'hidden', }) }, /** - * Show element - * - * @param element The jqLite wrapped DOM element - * @returns {jqLite} The jqLite - */ + * Show element + * + * @param element The jqLite wrapped DOM element + * @returns {jqLite} The jqLite + */ showEl: function(element) { if (!!element.rzAlwaysHide) { return element } return element.css({ - visibility: 'visible' + visibility: 'visible', }) }, /** - * Set element left/top position depending on whether slider is horizontal or vertical - * - * @param {jqLite} elem The jqLite wrapped DOM element - * @param {number} pos - * @returns {number} - */ + * Set element left/top position depending on whether slider is horizontal or vertical + * + * @param {jqLite} elem The jqLite wrapped DOM element + * @param {number} pos + * @returns {number} + */ setPosition: function(elem, pos) { elem.rzsp = pos var css = {} @@ -1587,12 +1709,19 @@ return pos }, + resetPosition: function(elem) { + elem.css({ + left: null, + bottom: null, + }) + }, + /** - * Get element width/height depending on whether slider is horizontal or vertical - * - * @param {jqLite} elem The jqLite wrapped DOM element - * @returns {number} - */ + * Get element width/height depending on whether slider is horizontal or vertical + * + * @param {jqLite} elem The jqLite wrapped DOM element + * @returns {number} + */ getDimension: function(elem) { var val = elem[0].getBoundingClientRect() if (this.options.vertical) @@ -1602,12 +1731,12 @@ }, /** - * Set element width/height depending on whether slider is horizontal or vertical - * - * @param {jqLite} elem The jqLite wrapped DOM element - * @param {number} dim - * @returns {number} - */ + * Set element width/height depending on whether slider is horizontal or vertical + * + * @param {jqLite} elem The jqLite wrapped DOM element + * @param {number} dim + * @returns {number} + */ setDimension: function(elem, dim) { elem.rzsd = dim var css = {} @@ -1617,21 +1746,21 @@ }, /** - * Returns a value that is within slider range - * - * @param {number} val - * @returns {number} - */ + * Returns a value that is within slider range + * + * @param {number} val + * @returns {number} + */ sanitizeValue: function(val) { return Math.min(Math.max(val, this.minValue), this.maxValue) }, /** - * Translate value to pixel position - * - * @param {number} val - * @returns {number} - */ + * Translate value to pixel position + * + * @param {number} val + * @returns {number} + */ valueToPosition: function(val) { var fn = this.linearValueToPosition if (this.options.customValueToPosition) @@ -1658,11 +1787,11 @@ }, /** - * Translate position to model value - * - * @param {number} position - * @returns {number} - */ + * Translate position to model value + * + * @param {number} position + * @returns {number} + */ positionToValue: function(position) { var percent = position / this.maxPos if (this.options.rightToLeft) percent = 1 - percent @@ -1692,12 +1821,12 @@ // Events /** - * Get the X-coordinate or Y-coordinate of an event - * - * @param {Object} event The event - * @param targetTouchId The identifier of the touch with the X/Y coordinates - * @returns {number} - */ + * Get the X-coordinate or Y-coordinate of an event + * + * @param {Object} event The event + * @param targetTouchId The identifier of the touch with the X/Y coordinates + * @returns {number} + */ getEventXY: function(event, targetTouchId) { /* http://stackoverflow.com/a/12336075/282882 */ //noinspection JSLint @@ -1722,11 +1851,11 @@ }, /** - * Compute the event position depending on whether the slider is horizontal or vertical - * @param event - * @param targetTouchId If targetTouchId is provided it will be considered the position of that - * @returns {number} - */ + * Compute the event position depending on whether the slider is horizontal or vertical + * @param event + * @param targetTouchId If targetTouchId is provided it will be considered the position of that + * @returns {number} + */ getEventPosition: function(event, targetTouchId) { var sliderPos = this.sliderElem.rzsp, eventPos = 0 @@ -1737,16 +1866,16 @@ }, /** - * Get event names for move and event end - * - * @param {Event} event The event - * - * @return {{moveEvent: string, endEvent: string}} - */ + * Get event names for move and event end + * + * @param {Event} event The event + * + * @return {{moveEvent: string, endEvent: string}} + */ getEventNames: function(event) { var eventNames = { moveEvent: '', - endEvent: '' + endEvent: '', } if (this.getEventAttr(event, 'touches')) { @@ -1761,11 +1890,11 @@ }, /** - * Get the handle closest to an event. - * - * @param event {Event} The event - * @returns {jqLite} The handle closest to the event. - */ + * Get the handle closest to an event. + * + * @param event {Event} The event + * @returns {jqLite} The handle closest to the event. + */ getNearestHandle: function(event) { if (!this.range) { return this.minH @@ -1778,26 +1907,25 @@ else if (!this.options.rightToLeft) //if event is at the same distance from min/max then if it's at left of minH, we return minH else maxH return position < this.minH.rzsp ? this.minH : this.maxH - else - //reverse in rtl - return position > this.minH.rzsp ? this.minH : this.maxH + //reverse in rtl + else return position > this.minH.rzsp ? this.minH : this.maxH }, /** - * Wrapper function to focus an angular element - * - * @param el {AngularElement} the element to focus - */ + * Wrapper function to focus an angular element + * + * @param el {AngularElement} the element to focus + */ focusElement: function(el) { var DOM_ELEMENT = 0 el[DOM_ELEMENT].focus() }, /** - * Bind mouse and touch events to slider handles - * - * @returns {undefined} - */ + * Bind mouse and touch events to slider handles + * + * @returns {undefined} + */ bindEvents: function() { var barTracking, barStart, barMove @@ -1927,10 +2055,10 @@ }, /** - * Unbind mouse and touch events to slider handles - * - * @returns {undefined} - */ + * Unbind mouse and touch events to slider handles + * + * @returns {undefined} + */ unbindEvents: function() { this.minH.off() this.maxH.off() @@ -1940,13 +2068,13 @@ }, /** - * onStart event handler - * - * @param {?Object} pointer The jqLite wrapped DOM element; if null, the closest handle is used - * @param {?string} ref The name of the handle being changed; if null, the closest handle's value is modified - * @param {Event} event The event - * @returns {undefined} - */ + * onStart event handler + * + * @param {?Object} pointer The jqLite wrapped DOM element; if null, the closest handle is used + * @param {?string} ref The name of the handle being changed; if null, the closest handle's value is modified + * @param {Event} event The event + * @returns {undefined} + */ onStart: function(pointer, ref, event) { var ehMove, ehEnd, @@ -1994,14 +2122,20 @@ }, /** - * onMove event handler - * - * @param {jqLite} pointer - * @param {Event} event The event - * @param {boolean} fromTick if the event occured on a tick or not - * @returns {undefined} - */ + * onMove event handler + * + * @param {jqLite} pointer + * @param {Event} event The event + * @param {boolean} fromTick if the event occured on a tick or not + * @returns {undefined} + */ onMove: function(pointer, event, fromTick) { + if (!this.options.disableAnimation) { + if (this.moving) { + this.sliderElem.addClass('noanimate') + } + } + this.moving = true var changedTouches = this.getEventAttr(event, 'changedTouches') var touchForThisSlider if (changedTouches) { @@ -2041,13 +2175,17 @@ }, /** - * onEnd event handler - * - * @param {Event} event The event - * @param {Function} ehMove The bound move event handler - * @returns {undefined} - */ + * onEnd event handler + * + * @param {Event} event The event + * @param {Function} ehMove The bound move event handler + * @returns {undefined} + */ onEnd: function(ehMove, event) { + this.moving = false + if (!this.options.disableAnimation) { + this.sliderElem.removeClass('noanimate') + } var changedTouches = this.getEventAttr(event, 'changedTouches') if (changedTouches && changedTouches[0].identifier !== this.touchId) { return @@ -2083,7 +2221,7 @@ this.currentFocusElement = { pointer: pointer, - ref: ref + ref: ref, } }, @@ -2103,12 +2241,61 @@ }, /** - * Key actions helper function - * - * @param {number} currentValue value of the slider - * - * @returns {?Object} action value mappings - */ + * Skip restricted range function when arrow keys use + * + * @param {number} currentValue value of the slider + * @param {number} key arrow key used + * + * @returns {number} currentValue value of the slider + */ + + skipRestrictedRanges: function(key, currentValue) { + if ( + this.options.restrictedRange && + Array.isArray(this.options.restrictedRange) + ) { + for (var i in this.options.restrictedRange) { + var range = this.options.restrictedRange[i] + // if it first or last value + if ( + (range.from === 0 && + currentValue === 0 && + [37, 40].includes(key)) || // LEFT or DOWN + (range.to >= + this.options.restrictedRange[ + this.options.restrictedRange.length - 1 + ].to && + currentValue >= + this.options.restrictedRange[ + this.options.restrictedRange.length - 1 + ].to && + [38, 39].includes(key)) // UP or RIGHT + ) { + return currentValue + } + if (range.to > currentValue && currentValue > range.from) { + if ( + Math.abs(range.to - currentValue) > + Math.abs(range.from - currentValue) + ) { + currentValue = range.to + } else { + currentValue = range.from + } + } + } + } + + return currentValue + }, + + /** + * Key actions helper function + * + * @param {number} currentValue value of the slider + * + * @returns {?Object} action value mappings + */ getKeyActions: function(currentValue) { var increaseStep = currentValue + this.step, decreaseStep = currentValue - this.step, @@ -2131,7 +2318,7 @@ PAGEUP: increasePage, PAGEDOWN: decreasePage, HOME: this.options.reversedControls ? this.maxValue : this.minValue, - END: this.options.reversedControls ? this.minValue : this.maxValue + END: this.options.reversedControls ? this.minValue : this.maxValue, } //right to left means swapping right and left arrows if (this.options.rightToLeft) { @@ -2147,9 +2334,9 @@ }, onKeyboardEvent: function(event) { - var currentValue = this[this.tracking], - keyCode = event.keyCode || event.which, - keys = { + var keyCode = event.keyCode || event.which + var currentValue = this[this.tracking] + var keys = { 38: 'UP', 40: 'DOWN', 37: 'LEFT', @@ -2157,7 +2344,7 @@ 33: 'PAGEUP', 34: 'PAGEDOWN', 36: 'HOME', - 35: 'END' + 35: 'END', }, actions = this.getKeyActions(currentValue), key = keys[keyCode], @@ -2173,6 +2360,9 @@ var self = this $timeout(function() { var newValue = self.roundStep(self.sanitizeValue(action)) + newValue = self.options.skipRestrictedRangesWithArrowKeys + ? self.skipRestrictedRanges(keyCode, newValue) + : newValue if (!self.options.draggableRangeOnly) { self.positionTrackingHandle(newValue) } else { @@ -2200,15 +2390,15 @@ }, /** - * onDragStart event handler - * - * Handles dragging of the middle bar. - * - * @param {Object} pointer The jqLite wrapped DOM element - * @param {string} ref One of the refLow, refHigh values - * @param {Event} event The event - * @returns {undefined} - */ + * onDragStart event handler + * + * Handles dragging of the middle bar. + * + * @param {Object} pointer The jqLite wrapped DOM element + * @param {string} ref One of the refLow, refHigh values + * @param {Event} event The event + * @returns {undefined} + */ onDragStart: function(pointer, ref, event) { var position = this.getEventPosition(event) this.dragging = { @@ -2220,24 +2410,24 @@ : position - this.minH.rzsp, highLimit: this.options.rightToLeft ? position - this.maxH.rzsp - : this.maxH.rzsp - position + : this.maxH.rzsp - position, } this.onStart(pointer, ref, event) }, /** - * getValue helper function - * - * gets max or min value depending on whether the newPos is outOfBounds above or below the bar and rightToLeft - * - * @param {string} type 'max' || 'min' The value we are calculating - * @param {number} newPos The new position - * @param {boolean} outOfBounds Is the new position above or below the max/min? - * @param {boolean} isAbove Is the new position above the bar if out of bounds? - * - * @returns {number} - */ + * getValue helper function + * + * gets max or min value depending on whether the newPos is outOfBounds above or below the bar and rightToLeft + * + * @param {string} type 'max' || 'min' The value we are calculating + * @param {number} newPos The new position + * @param {boolean} outOfBounds Is the new position above or below the max/min? + * @param {boolean} isAbove Is the new position above the bar if out of bounds? + * + * @returns {number} + */ getValue: function(type, newPos, outOfBounds, isAbove) { var isRTL = this.options.rightToLeft, value = null @@ -2285,15 +2475,21 @@ }, /** - * onDragMove event handler - * - * Handles dragging of the middle bar. - * - * @param {jqLite} pointer - * @param {Event} event The event - * @returns {undefined} - */ + * onDragMove event handler + * + * Handles dragging of the middle bar. + * + * @param {jqLite} pointer + * @param {Event} event The event + * @returns {undefined} + */ onDragMove: function(pointer, event) { + if (!this.options.disableAnimation) { + if (this.moving) { + this.sliderElem.addClass('noanimate') + } + } + this.moving = true var newPos = this.getEventPosition(event), newMinValue, newMaxValue, @@ -2334,11 +2530,11 @@ }, /** - * Set the new value and position for the entire bar - * - * @param {number} newMinValue the new minimum value - * @param {number} newMaxValue the new maximum value - */ + * Set the new value and position for the entire bar + * + * @param {number} newMinValue the new minimum value + * @param {number} newMaxValue the new maximum value + */ positionTrackingBar: function(newMinValue, newMaxValue) { if ( this.options.minLimit != null && @@ -2365,13 +2561,14 @@ }, /** - * Set the new value and position to the current tracking handle - * - * @param {number} newValue new model value - */ + * Set the new value and position to the current tracking handle + * + * @param {number} newValue new model value + */ positionTrackingHandle: function(newValue) { var valueChanged = false newValue = this.applyMinMaxLimit(newValue) + newValue = this.applyRestrictedRange(newValue) if (this.range) { if (this.options.pushRange) { newValue = this.applyPushRange(newValue) @@ -2459,6 +2656,34 @@ return newValue }, + applyRestrictedRange: function(newValue) { + for (var i in this.options.restrictedRange) { + if ( + this.options.restrictedRange[i] != null && + newValue > this.options.restrictedRange[i].from && + newValue < this.options.restrictedRange[i].to + ) { + var halfWidth = + (this.options.restrictedRange[i].to - + this.options.restrictedRange[i].from) / + 2 + if (this.tracking === 'lowValue') { + return newValue > + this.options.restrictedRange[i].from + halfWidth + ? this.options.restrictedRange[i].to + : this.options.restrictedRange[i].from + } + if (this.tracking === 'highValue') { + return newValue < this.options.restrictedRange[i].to - halfWidth + ? this.options.restrictedRange[i].from + : this.options.restrictedRange[i].to + } + } + } + + return newValue + }, + applyPushRange: function(newValue) { var difference = this.tracking === 'lowValue' @@ -2512,9 +2737,9 @@ }, /** - * Apply the model values using scope.$apply. - * We wrap it with the internalChange flag to avoid the watchers to be called - */ + * Apply the model values using scope.$apply. + * We wrap it with the internalChange flag to avoid the watchers to be called + */ applyModel: function(callOnChange) { this.internalChange = true this.scope.$apply() @@ -2523,11 +2748,11 @@ }, /** - * Call the onStart callback if defined - * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. - * - * @returns {undefined} - */ + * Call the onStart callback if defined + * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. + * + * @returns {undefined} + */ callOnStart: function() { if (this.options.onStart) { var self = this, @@ -2544,11 +2769,11 @@ }, /** - * Call the onChange callback if defined - * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. - * - * @returns {undefined} - */ + * Call the onChange callback if defined + * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. + * + * @returns {undefined} + */ callOnChange: function() { if (this.options.onChange) { var self = this, @@ -2565,11 +2790,11 @@ }, /** - * Call the onEnd callback if defined - * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. - * - * @returns {undefined} - */ + * Call the onEnd callback if defined + * The callback call is wrapped in a $evalAsync to ensure that its result will be applied to the scope. + * + * @returns {undefined} + */ callOnEnd: function() { if (this.options.onEnd) { var self = this, @@ -2584,7 +2809,7 @@ }) } this.scope.$emit('slideEnded') - } + }, } return Slider @@ -2599,16 +2824,16 @@ rzSliderModel: '=?', rzSliderHigh: '=?', rzSliderOptions: '&?', - rzSliderTplUrl: '@' + rzSliderTplUrl: '@', }, /** - * Return template URL - * - * @param {jqLite} elem - * @param {Object} attrs - * @return {string} - */ + * Return template URL + * + * @param {jqLite} elem + * @param {Object} attrs + * @return {string} + */ templateUrl: function(elem, attrs) { //noinspection JSUnresolvedVariable return attrs.rzSliderTplUrl || 'rzSliderTpl.html' @@ -2616,7 +2841,7 @@ link: function(scope, elem) { scope.slider = new RzSlider(scope, elem) //attach on scope so we can test it - } + }, } }) diff --git a/src/rzslider.less b/src/rzslider.less index 2004fca..171bdfa 100644 --- a/src/rzslider.less +++ b/src/rzslider.less @@ -18,6 +18,10 @@ vertical-align: middle; user-select: none; + &.noanimate * { + transition: none !important; + } + &.with-legend { margin-bottom: @withLegendMargin; } @@ -57,11 +61,12 @@ .rz-bar-wrapper { left: 0; box-sizing: border-box; - margin-top: -@handleSize / 2; - padding-top: @handleSize / 2; + margin-top: (-@handleSize / 2); + padding-top: (@handleSize / 2); width: 100%; height: @handleSize; z-index: 1; + transition: all linear @animationDuration; } .rz-draggable { @@ -74,7 +79,7 @@ height: @barDimension; z-index: 1; background: @barNormalColor; - .rounded(@barDimension/2); + .rounded((@barDimension / 2)); } .rz-bar-wrapper.rz-transparent .rz-bar { @@ -90,30 +95,34 @@ .rz-selection { z-index: 2; background: @barFillColor; - .rounded(@barDimension/2); + .rounded((@barDimension / 2)); + transition: background-color linear @animationDuration; + } + + .rz-restricted { + z-index: 3; + background: @restrictedBarColor; + .rounded((@barDimension / 2)); } .rz-pointer { cursor: pointer; width: @handleSize; height: @handleSize; - top: -@handleSize/2 + @barDimension/2; + top: (-@handleSize / 2 + @barDimension / 2); background-color: @handleBgColor; z-index: 3; - .rounded(@handleSize/2); - // -webkit-transition:all linear 0.15s; - // -moz-transition:all linear 0.15s; - // -o-transition:all linear 0.15s; - // transition:all linear 0.15s; + .rounded((@handleSize / 2)); + transition: all linear @animationDuration; &:after { content: ''; width: @handlePointerSize; height: @handlePointerSize; position: absolute; - top: @handleSize/2 - @handlePointerSize/2; - left: @handleSize/2 - @handlePointerSize/2; - .rounded(@handlePointerSize/2); + top: (@handleSize / 2 - @handlePointerSize / 2); + left: (@handleSize / 2 - @handlePointerSize / 2); + .rounded((@handlePointerSize / 2)); background: @handleInnerColor; } &:hover:after { @@ -129,11 +138,13 @@ .rz-bubble { cursor: default; - bottom: @handleSize/2; + bottom: (@handleSize / 2); padding: @bubblePadding; color: @labelTextColor; + transition: all linear @animationDuration; &.rz-limit { color: @limitLabelTextColor; + transition: none; } } @@ -143,7 +154,7 @@ height: 0; position: absolute; left: 0; - top: -(@ticksHeight - @barDimension) / 2; + top: (-(@ticksHeight - @barDimension) / 2); margin: 0; z-index: 1; list-style: none; @@ -152,7 +163,7 @@ .rz-ticks-values-under { .rz-tick-value { top: auto; - bottom: @ticksValuePosition - 2; + bottom: (@ticksValuePosition - 2); } } @@ -166,7 +177,8 @@ position: absolute; top: 0; left: 0; - margin-left: @handleSize / 2 - @ticksWidth / 2; // for centering + margin-left: (@handleSize / 2 - @ticksWidth / 2); // for centering + transition: background-color linear @animationDuration; &.rz-selected { background: @selectedTicksColor; } @@ -203,8 +215,8 @@ .rz-bar-wrapper { top: auto; left: 0; - margin: 0 0 0 -@handleSize / 2; - padding: 0 0 0 @handleSize / 2; + margin: 0 0 0 (-@handleSize / 2); + padding: 0 0 0 (@handleSize / 2); height: 100%; width: @handleSize; } @@ -217,13 +229,13 @@ } .rz-pointer { - left: -@handleSize/2 + @barDimension/2 !important; + left: (-@handleSize / 2 + @barDimension / 2) !important; top: auto; bottom: 0; } .rz-bubble { - left: @handleSize/2 !important; + left: (@handleSize / 2) !important; margin-left: 3px; bottom: 0; } @@ -231,14 +243,14 @@ .rz-ticks { height: 100%; width: 0; - left: -(@ticksHeight - @barDimension) / 2; + left: (-(@ticksHeight - @barDimension) / 2); top: 0; z-index: 1; } .rz-tick { vertical-align: middle; margin-left: auto; - margin-top: @handleSize / 2 - @ticksWidth / 2; // for centering + margin-top: (@handleSize / 2 - @ticksWidth / 2); // for centering } .rz-tick-value { left: @ticksValuePositionOnVertical; diff --git a/src/variables.less b/src/variables.less index 8e1a839..a8422a9 100644 --- a/src/variables.less +++ b/src/variables.less @@ -14,8 +14,9 @@ @barFillColor: @handleBgColor; @barDisabledFillColor: #8b91a2; @barNormalColor: #d8e0f3; -@barLeftOutSelectionColor: #DF002D; -@barRightOutSelectionColor: #03A688; +@barLeftOutSelectionColor: #df002d; +@barRightOutSelectionColor: #03a688; +@restrictedBarColor: red; @ticksColor: @barNormalColor; @selectedTicksColor: @barFillColor; @@ -31,3 +32,5 @@ @barDimension: 4px; @withLegendMargin: 40px; + +@animationDuration: 0.3s; diff --git a/tests/specs/accessibility-test.js b/tests/specs/accessibility-test.js index 69dcb08..ee0c0e0 100644 --- a/tests/specs/accessibility-test.js +++ b/tests/specs/accessibility-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -25,8 +28,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) expect(helper.slider.minH.attr('role')).to.equal('slider') @@ -49,8 +52,8 @@ floor: 0, ceil: 100, step: 10, - vertical: true - } + vertical: true, + }, } helper.createSlider(sliderConf) expect(helper.slider.minH.attr('role')).to.equal('slider') @@ -74,8 +77,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSlider(sliderConf) expect(helper.slider.minH.attr('role')).to.equal('slider') @@ -110,8 +113,8 @@ floor: 0, ceil: 100, step: 10, - vertical: true - } + vertical: true, + }, } helper.createRangeSlider(sliderConf) expect(helper.slider.minH.attr('role')).to.equal('slider') @@ -147,8 +150,8 @@ floor: 0, ceil: 100, step: 10, - keyboardSupport: false - } + keyboardSupport: false, + }, } helper.createSlider(sliderConf) expect(helper.slider.minH.attr('role')).to.equal('slider') @@ -172,8 +175,8 @@ floor: 0, ceil: 100, step: 10, - keyboardSupport: false - } + keyboardSupport: false, + }, } helper.createRangeSlider(sliderConf) expect(helper.slider.minH.attr('role')).to.equal('slider') @@ -204,8 +207,8 @@ var sliderConf = { value: 'B', options: { - stepsArray: ['A', 'B', 'C'] - } + stepsArray: ['A', 'B', 'C'], + }, } helper.createSlider(sliderConf) expect(helper.slider.minH.attr('role')).to.equal('slider') @@ -226,8 +229,8 @@ value: 1, options: { stepsArray: ['A', 'B', 'C'], - bindIndexForStepsArray: true - } + bindIndexForStepsArray: true, + }, } helper.createSlider(sliderConf) expect(helper.slider.minH.attr('role')).to.equal('slider') @@ -250,8 +253,8 @@ floor: 0, ceil: 100, step: 10, - ariaLabel: 'test label' - } + ariaLabel: 'test label', + }, } helper.createSlider(sliderConf) expect(helper.slider.minH.attr('aria-label')).to.equal('test label') @@ -266,8 +269,8 @@ ceil: 100, step: 10, ariaLabel: 'test label', - ariaLabelHigh: 'test label high' - } + ariaLabelHigh: 'test label high', + }, } helper.createRangeSlider(sliderConf) expect(helper.slider.minH.attr('aria-label')).to.equal('test label') @@ -281,8 +284,8 @@ floor: 0, ceil: 100, step: 10, - ariaLabelledBy: 'testId' - } + ariaLabelledBy: 'testId', + }, } helper.createSlider(sliderConf) expect(helper.slider.minH.attr('aria-labelledby')).to.equal('testId') @@ -297,8 +300,8 @@ ceil: 100, step: 10, ariaLabelledBy: 'testId', - ariaLabelledByHigh: 'testIdHigh' - } + ariaLabelledByHigh: 'testIdHigh', + }, } helper.createRangeSlider(sliderConf) expect(helper.slider.minH.attr('aria-labelledby')).to.equal('testId') @@ -313,8 +316,8 @@ ceil: 100, step: 10, ariaLabel: 'test label', - ariaLabelledBy: 'testId' - } + ariaLabelledBy: 'testId', + }, } helper.createSlider(sliderConf) expect(helper.slider.minH.attr('aria-label')).to.equal('test label') @@ -332,8 +335,8 @@ ariaLabel: 'test label', ariaLabelHigh: 'test label high', ariaLabelledBy: 'testId', - ariaLabelledByHigh: 'testIdHigh' - } + ariaLabelledByHigh: 'testIdHigh', + }, } helper.createRangeSlider(sliderConf) expect(helper.slider.minH.attr('aria-label')).to.equal('test label') diff --git a/tests/specs/custom-template-test.js b/tests/specs/custom-template-test.js index d66a04e..060e655 100644 --- a/tests/specs/custom-template-test.js +++ b/tests/specs/custom-template-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -28,8 +31,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSliderWithCustomTemplate(sliderConf, url) expect(helper.slider.flrLab.text()).to.equal('test- 0') @@ -43,8 +46,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSliderWithCustomTemplate(sliderConf, url) expect(helper.slider.minLab.text()).to.equal('test- 10') @@ -58,8 +61,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSliderWithCustomTemplate(sliderConf, url) expect(helper.slider.cmbLab.text()).to.equal('test- 50 - 50') diff --git a/tests/specs/custom-tpl.html b/tests/specs/custom-tpl.html index d24132a..c9e921c 100644 --- a/tests/specs/custom-tpl.html +++ b/tests/specs/custom-tpl.html @@ -5,6 +5,9 @@ + + + test- {{floorLabel}} diff --git a/tests/specs/helper-functions-test.js b/tests/specs/helper-functions-test.js index 47f12de..307a15f 100644 --- a/tests/specs/helper-functions-test.js +++ b/tests/specs/helper-functions-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) }) @@ -256,7 +259,7 @@ it('should have a valid getEventXY for horizontal sliders on desktop browsers', function() { var event = { - clientX: 12 + clientX: 12, } expect(helper.slider.getEventXY(event)).to.equal(12) }) @@ -265,7 +268,7 @@ helper.scope.slider.options.vertical = true helper.scope.$digest() var event = { - clientY: 12 + clientY: 12, } expect(helper.slider.getEventXY(event)).to.equal(12) }) @@ -274,9 +277,9 @@ var event = { touches: [ { - clientX: 12 - } - ] + clientX: 12, + }, + ], } expect(helper.slider.getEventXY(event)).to.equal(12) }) @@ -286,10 +289,10 @@ originalEvent: { touches: [ { - clientX: 12 - } - ] - } + clientX: 12, + }, + ], + }, } expect(helper.slider.getEventXY(event)).to.equal(12) }) @@ -300,9 +303,9 @@ var event = { touches: [ { - clientY: 12 - } - ] + clientY: 12, + }, + ], } expect(helper.slider.getEventXY(event)).to.equal(12) }) @@ -314,10 +317,10 @@ originalEvent: { touches: [ { - clientY: 12 - } - ] - } + clientY: 12, + }, + ], + }, } expect(helper.slider.getEventXY(event)).to.equal(12) }) @@ -376,12 +379,12 @@ it('should have a valid getEventNames for desktop', function() { var event = { clientX: 10, - clientY: 100 + clientY: 100, } var eventNames = helper.slider.getEventNames(event) expect(eventNames).to.deep.equal({ moveEvent: 'mousemove', - endEvent: 'mouseup' + endEvent: 'mouseup', }) }) @@ -390,14 +393,14 @@ touches: [ { clientX: 10, - clientY: 100 - } - ] + clientY: 100, + }, + ], } var eventNames = helper.slider.getEventNames(event) expect(eventNames).to.deep.equal({ moveEvent: 'touchmove', - endEvent: 'touchend' + endEvent: 'touchend', }) }) @@ -407,15 +410,15 @@ touches: [ { clientX: 10, - clientY: 100 - } - ] - } + clientY: 100, + }, + ], + }, } var eventNames = helper.slider.getEventNames(event) expect(eventNames).to.deep.equal({ moveEvent: 'touchmove', - endEvent: 'touchend' + endEvent: 'touchend', }) }) @@ -430,8 +433,8 @@ it('should have a valid focusElement', function() { var el = [ { - focus: sinon.spy() - } + focus: sinon.spy(), + }, ] helper.slider.focusElement(el) el[0].focus.called.should.be.true @@ -446,8 +449,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSlider(sliderConf) sinon.stub(helper.slider, 'getEventPosition').returns(46) @@ -469,8 +472,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSlider(sliderConf) sinon.stub(helper.slider, 'getEventPosition').returns(66) @@ -491,8 +494,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) helper.slider.onStart = sinon.spy() @@ -534,8 +537,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) helper.slider.onStart = sinon.spy() @@ -573,8 +576,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSlider(sliderConf) helper.slider.onStart = sinon.spy() @@ -617,8 +620,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSlider(sliderConf) helper.slider.onStart = sinon.spy() @@ -656,8 +659,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSlider(sliderConf) helper.slider.onStart = sinon.spy() @@ -688,8 +691,8 @@ floor: 0, ceil: 100, step: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) }) diff --git a/tests/specs/helper.js b/tests/specs/helper.js index dc399b2..505d058 100644 --- a/tests/specs/helper.js +++ b/tests/specs/helper.js @@ -1,6 +1,6 @@ ;(function() { 'use strict' - var helperModule = angular.module('test-helper', ['rzModule', 'appTemplates']) + var helperModule = angular.module('test-helper', ['rzSlider', 'appTemplates']) helperModule.factory('TestHelper', function( RzSlider, @@ -14,7 +14,7 @@ var h = { element: null, scope: null, - parent: null + parent: null, } h.createSlider = function(sliderObj) { @@ -70,7 +70,10 @@ ) h.element = $compile(template)(h.scope) h.parent.append(h.element) - angular.element(document).find('body').append(h.parent) + angular + .element(document) + .find('body') + .append(h.parent) h.scope.$digest() h.slider = h.element.isolateScope().slider } @@ -87,7 +90,7 @@ var event = { type: 'mousedown', preventDefault: sinon.stub(), - stopPropagation: sinon.stub() + stopPropagation: sinon.stub(), } event[positionProp] = position @@ -98,7 +101,7 @@ h.fireMousemove = function(position, vertical) { var positionProp = vertical ? 'clientY' : 'clientX' var event = { - type: 'mousemove' + type: 'mousemove', } event[positionProp] = position @@ -107,7 +110,7 @@ h.fireMouseup = function() { var event = { - type: 'mouseup' + type: 'mouseup', } $document.triggerHandler(event) } @@ -128,7 +131,7 @@ touchIdentifier, touchesIds, sinon.stub() - ) + ), } element.triggerHandler(event) @@ -169,7 +172,7 @@ vertical, touchIdentifier, touchesIds - ) + ), } $document.triggerHandler(event) @@ -207,7 +210,7 @@ vertical, touchIdentifier, touchesIds - ) + ), } $document.triggerHandler(event) @@ -258,7 +261,7 @@ preventDefault: preventDefaultAndStopPropagation, stopPropagation: preventDefaultAndStopPropagation, changedTouches: changedTouches, - touches: touches + touches: touches, } return originalEvent } @@ -267,7 +270,7 @@ options = options || {} key = key.toUpperCase() var event = { - type: 'keydown' + type: 'keydown', } var keys = { UP: 38, @@ -278,7 +281,7 @@ PAGEDOWN: 34, HOME: 36, END: 35, - SPACE: 32 + SPACE: 32, } var keyCode = keys[key] if (options.oldAPI) event.which = keyCode diff --git a/tests/specs/keyboard-controls/draggableRangeOnly-range-slider-test.js b/tests/specs/keyboard-controls/draggableRangeOnly-range-slider-test.js index ffe6aa1..a439f06 100644 --- a/tests/specs/keyboard-controls/draggableRangeOnly-range-slider-test.js +++ b/tests/specs/keyboard-controls/draggableRangeOnly-range-slider-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ options: { floor: 0, ceil: 200, - draggableRangeOnly: true - } + draggableRangeOnly: true, + }, } helper.createRangeSlider(sliderConf) }) @@ -122,14 +125,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -143,8 +149,8 @@ floor: 0, ceil: 200, draggableRangeOnly: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/keyboard-controls/range-slider-test.js b/tests/specs/keyboard-controls/range-slider-test.js index 4dabc00..4ec4315 100644 --- a/tests/specs/keyboard-controls/range-slider-test.js +++ b/tests/specs/keyboard-controls/range-slider-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -25,8 +28,8 @@ max: 100, options: { floor: 0, - ceil: 200 - } + ceil: 200, + }, } helper.createRangeSlider(sliderConf) }) @@ -154,14 +157,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -174,8 +180,8 @@ options: { floor: 0, ceil: 200, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/keyboard-controls/single-slider-test.js b/tests/specs/keyboard-controls/single-slider-test.js index de8d1a0..e977f9d 100644 --- a/tests/specs/keyboard-controls/single-slider-test.js +++ b/tests/specs/keyboard-controls/single-slider-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -27,8 +30,8 @@ ceil: 200, onStart: sinon.spy(), onChange: sinon.spy(), - onEnd: sinon.spy() - } + onEnd: sinon.spy(), + }, } helper.createSlider(sliderConf) }) @@ -146,14 +149,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -165,8 +171,8 @@ options: { floor: 0, ceil: 200, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) }) @@ -253,14 +259,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -275,8 +284,8 @@ onStart: sinon.spy(), onChange: sinon.spy(), onEnd: sinon.spy(), - reversedControls: true - } + reversedControls: true, + }, } helper.createSlider(sliderConf) }) @@ -394,14 +403,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -414,8 +426,8 @@ floor: 0, ceil: 200, rightToLeft: true, - reversedControls: true - } + reversedControls: true, + }, } helper.createSlider(sliderConf) }) diff --git a/tests/specs/keyboard-controls/specific-test.js b/tests/specs/keyboard-controls/specific-test.js index 531ca0b..89d87dd 100644 --- a/tests/specs/keyboard-controls/specific-test.js +++ b/tests/specs/keyboard-controls/specific-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -25,8 +28,8 @@ options: { floor: 0, ceil: 1000, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) helper.slider.minH.triggerHandler('focus') @@ -40,8 +43,8 @@ options: { floor: 0, ceil: 1000, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) helper.slider.minH.triggerHandler('focus') @@ -55,8 +58,8 @@ options: { floor: 0, ceil: 100, - disabled: true - } + disabled: true, + }, } helper.createSlider(sliderConf) helper.slider.minH.triggerHandler('focus') @@ -70,8 +73,8 @@ options: { floor: 0, ceil: 100, - readOnly: true - } + readOnly: true, + }, } helper.createSlider(sliderConf) helper.slider.minH.triggerHandler('focus') @@ -87,8 +90,8 @@ floor: 0, ceil: 100, step: 1, - minRange: 10 - } + minRange: 10, + }, } helper.createRangeSlider(sliderConf) //try to move minH right @@ -110,8 +113,8 @@ floor: 0, ceil: 100, step: 1, - minRange: 10 - } + minRange: 10, + }, } helper.createRangeSlider(sliderConf) @@ -134,8 +137,8 @@ floor: 0, ceil: 100, step: 1, - maxRange: 10 - } + maxRange: 10, + }, } helper.createRangeSlider(sliderConf) //try to move minH left @@ -157,8 +160,8 @@ floor: 0, ceil: 100, step: 1, - maxRange: 10 - } + maxRange: 10, + }, } helper.createRangeSlider(sliderConf) @@ -180,8 +183,8 @@ floor: 0, ceil: 100, step: 1, - minLimit: 10 - } + minLimit: 10, + }, } helper.createSlider(sliderConf) //try to move minH right @@ -197,8 +200,8 @@ floor: 0, ceil: 100, step: 1, - minLimit: 10 - } + minLimit: 10, + }, } helper.createSlider(sliderConf) //try to move minH left @@ -214,8 +217,8 @@ floor: 0, ceil: 100, step: 1, - maxLimit: 90 - } + maxLimit: 90, + }, } helper.createSlider(sliderConf) //try to move minH left @@ -231,8 +234,8 @@ floor: 0, ceil: 100, step: 1, - maxLimit: 90 - } + maxLimit: 90, + }, } helper.createSlider(sliderConf) //try to move minH right @@ -247,8 +250,8 @@ options: { floor: 0, ceil: 100, - step: 1 - } + step: 1, + }, } helper.createSlider(sliderConf) //try to move minH right @@ -267,14 +270,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -287,8 +293,8 @@ floor: 0, ceil: 1000, step: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) helper.slider.minH.triggerHandler('focus') @@ -303,8 +309,8 @@ floor: 0, ceil: 1000, step: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) helper.slider.minH.triggerHandler('focus') @@ -319,8 +325,8 @@ floor: 0, ceil: 100, disabled: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) helper.slider.minH.triggerHandler('focus') @@ -335,8 +341,8 @@ floor: 0, ceil: 100, readOnly: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) helper.slider.minH.triggerHandler('focus') @@ -353,8 +359,8 @@ ceil: 100, step: 1, minRange: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) //try to move minH left ( increase in rtl ) @@ -377,8 +383,8 @@ ceil: 100, step: 1, minRange: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) @@ -402,8 +408,8 @@ ceil: 100, step: 1, maxRange: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) //try to move minH right ( increase in rtl ) @@ -426,8 +432,8 @@ ceil: 100, step: 1, maxRange: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) diff --git a/tests/specs/keyboard-controls/vertical-slider-test.js b/tests/specs/keyboard-controls/vertical-slider-test.js index 804a62b..0a4a0bf 100644 --- a/tests/specs/keyboard-controls/vertical-slider-test.js +++ b/tests/specs/keyboard-controls/vertical-slider-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -25,8 +28,8 @@ options: { floor: 0, ceil: 200, - vertical: true - } + vertical: true, + }, } helper.createSlider(sliderConf) }) @@ -61,14 +64,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -81,8 +87,8 @@ floor: 0, ceil: 200, vertical: true, - reversedControls: true - } + reversedControls: true, + }, } helper.createSlider(sliderConf) }) @@ -117,14 +123,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -137,8 +146,8 @@ floor: 0, ceil: 200, vertical: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) }) @@ -175,14 +184,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -196,8 +208,8 @@ ceil: 200, vertical: true, rightToLeft: true, - reversedControls: true - } + reversedControls: true, + }, } helper.createSlider(sliderConf) }) diff --git a/tests/specs/labels-test.js b/tests/specs/labels-test.js index 57fedfa..30c3dcc 100644 --- a/tests/specs/labels-test.js +++ b/tests/specs/labels-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -24,8 +27,8 @@ value: 50, options: { floor: 0, - ceil: 100 - } + ceil: 100, + }, } helper.createSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('visible') @@ -37,8 +40,8 @@ value: 0, options: { floor: 0, - ceil: 100 - } + ceil: 100, + }, } helper.createSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('hidden') @@ -50,8 +53,8 @@ value: 100, options: { floor: 0, - ceil: 100 - } + ceil: 100, + }, } helper.createSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('visible') @@ -64,8 +67,8 @@ options: { floor: 0, ceil: 100, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('visible') @@ -78,8 +81,8 @@ options: { floor: 0, ceil: 100, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('hidden') @@ -92,8 +95,8 @@ options: { floor: 0, ceil: 100, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('visible') @@ -106,8 +109,8 @@ max: 100, options: { floor: 0, - ceil: 100 - } + ceil: 100, + }, } helper.createRangeSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('hidden') @@ -121,8 +124,8 @@ options: { floor: 0, ceil: 100, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('hidden') @@ -139,8 +142,8 @@ translate: function(v, _, which) { if (which != 'model' && which != 'high') return v return "I'm whatever long text ===============================================================================================================================================================" - } - } + }, + }, } helper.createRangeSlider(sliderConf) @@ -158,9 +161,9 @@ translate: function(v, _, which) { if (which != 'model' && which != 'high') return v return "I'm whatever long text ===============================================================================================================================================================" - } + }, }, - rightToLeft: true + rightToLeft: true, } helper.createRangeSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('hidden') diff --git a/tests/specs/mouse-controls/draggable-range-slider-horizontal-test.js b/tests/specs/mouse-controls/draggable-range-slider-horizontal-test.js index 4bc1a6e..ae7630d 100644 --- a/tests/specs/mouse-controls/draggable-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/draggable-range-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ options: { floor: 0, ceil: 100, - draggableRange: true - } + draggableRange: true, + }, } helper.createRangeSlider(sliderConf) }) @@ -229,14 +232,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -250,8 +256,8 @@ floor: 0, ceil: 100, draggableRange: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/draggableOnly-range-slider-horizontal-test.js b/tests/specs/mouse-controls/draggableOnly-range-slider-horizontal-test.js index bd1daac..70d78b3 100644 --- a/tests/specs/mouse-controls/draggableOnly-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/draggableOnly-range-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ options: { floor: 0, ceil: 100, - draggableRangeOnly: true - } + draggableRangeOnly: true, + }, } helper.createRangeSlider(sliderConf) }) @@ -168,14 +171,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -189,8 +195,8 @@ floor: 0, ceil: 100, draggableRangeOnly: true, - leftToRight: true - } + leftToRight: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/minMaxLimit-range-slider-horizontal-test.js b/tests/specs/mouse-controls/minMaxLimit-range-slider-horizontal-test.js index 58eba58..6376be2 100644 --- a/tests/specs/mouse-controls/minMaxLimit-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/minMaxLimit-range-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -27,8 +30,8 @@ floor: 0, ceil: 100, minLimit: 40, - maxLimit: 60 - } + maxLimit: 60, + }, } helper.createRangeSlider(sliderConf) }) @@ -71,14 +74,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -93,8 +99,8 @@ ceil: 100, minLimit: 40, maxLimit: 60, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/minMaxLimit-single-slider-horizontal-test.js b/tests/specs/mouse-controls/minMaxLimit-single-slider-horizontal-test.js index 8b796ff..f5654a6 100644 --- a/tests/specs/mouse-controls/minMaxLimit-single-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/minMaxLimit-single-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ floor: 0, ceil: 100, minLimit: 40, - maxLimit: 60 - } + maxLimit: 60, + }, } helper.createSlider(sliderConf) }) @@ -70,14 +73,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -91,8 +97,8 @@ ceil: 100, minLimit: 40, maxLimit: 60, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/minMaxRange-noSwitching-range-slider-horizontal-test.js b/tests/specs/mouse-controls/minMaxRange-noSwitching-range-slider-horizontal-test.js index 4b114d0..5f8184b 100644 --- a/tests/specs/mouse-controls/minMaxRange-noSwitching-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/minMaxRange-noSwitching-range-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -28,8 +31,8 @@ ceil: 100, minRange: 10, maxRange: 50, - noSwitching: true - } + noSwitching: true, + }, } helper.createRangeSlider(sliderConf) }) @@ -126,14 +129,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -148,8 +154,8 @@ ceil: 100, minRange: 10, noSwitching: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/minMaxRange-range-slider-horizontal-test.js b/tests/specs/mouse-controls/minMaxRange-range-slider-horizontal-test.js index 623b599..88789ed 100644 --- a/tests/specs/mouse-controls/minMaxRange-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/minMaxRange-range-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ options: { floor: 0, ceil: 100, - minRange: 10 - } + minRange: 10, + }, } helper.createRangeSlider(sliderConf) }) @@ -86,14 +89,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -106,8 +112,8 @@ options: { floor: 0, ceil: 100, - maxRange: 10 - } + maxRange: 10, + }, } helper.createRangeSlider(sliderConf) }) @@ -150,14 +156,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -171,8 +180,8 @@ floor: 0, ceil: 100, minRange: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/noSwitching-range-slider-horizontal-test.js b/tests/specs/mouse-controls/noSwitching-range-slider-horizontal-test.js index a23e2ef..528f260 100644 --- a/tests/specs/mouse-controls/noSwitching-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/noSwitching-range-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ options: { floor: 0, ceil: 100, - noSwitching: true - } + noSwitching: true, + }, } helper.createRangeSlider(sliderConf) }) @@ -82,14 +85,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -103,8 +109,8 @@ floor: 0, ceil: 100, noSwitching: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/onlyBindHandles-single-slider-horizontal-test.js b/tests/specs/mouse-controls/onlyBindHandles-single-slider-horizontal-test.js index 26fb40e..1db382a 100644 --- a/tests/specs/mouse-controls/onlyBindHandles-single-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/onlyBindHandles-single-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ floor: 0, ceil: 100, showTicks: true, - onlyBindHandles: true - } + onlyBindHandles: true, + }, } helper.createSlider(sliderConf) }) @@ -66,14 +69,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -87,8 +93,8 @@ ceil: 100, showTicks: true, onlyBindHandles: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/pushRange-range-slider-horizontal-test.js b/tests/specs/mouse-controls/pushRange-range-slider-horizontal-test.js index dea494c..d182637 100644 --- a/tests/specs/mouse-controls/pushRange-range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/pushRange-range-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ options: { floor: 0, ceil: 100, - pushRange: true - } + pushRange: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/range-slider-horizontal-test.js b/tests/specs/mouse-controls/range-slider-horizontal-test.js index 42d25f0..bf8a05e 100644 --- a/tests/specs/mouse-controls/range-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/range-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -25,8 +28,8 @@ max: 100, options: { floor: 0, - ceil: 100 - } + ceil: 100, + }, } helper.createRangeSlider(sliderConf) }) @@ -271,14 +274,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -291,8 +297,8 @@ options: { floor: 0, ceil: 100, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/range-slider-vertical-test.js b/tests/specs/mouse-controls/range-slider-vertical-test.js index 91362ed..b22f9ed 100644 --- a/tests/specs/mouse-controls/range-slider-vertical-test.js +++ b/tests/specs/mouse-controls/range-slider-vertical-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ options: { floor: 0, ceil: 100, - vertical: true - } + vertical: true, + }, } helper.createRangeSlider(sliderConf) }) @@ -264,14 +267,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -285,8 +291,8 @@ floor: 0, ceil: 100, vertical: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) }) diff --git a/tests/specs/mouse-controls/restricted-range-slider-test.js b/tests/specs/mouse-controls/restricted-range-slider-test.js new file mode 100644 index 0000000..13e2b68 --- /dev/null +++ b/tests/specs/mouse-controls/restricted-range-slider-test.js @@ -0,0 +1,145 @@ +;(function() { + 'use strict' + + describe('Mouse controls - Restricted Range', function() { + var helper, RzSliderOptions, $rootScope, $timeout + + beforeEach(module('test-helper')) + + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) + + afterEach(function() { + helper.clean() + }) + + beforeEach(function() { + var sliderConf = { + min: 25, + max: 85, + options: { + floor: 0, + ceil: 100, + restrictedRange: { + from: 30, + to: 70, + }, + }, + } + helper.createRangeSlider(sliderConf) + }) + + afterEach(function() { + // to clean document listener + helper.fireMouseup() + }) + + it('should be able to modify minH below restrictedRange.from', function() { + helper.fireMousedown(helper.slider.minH, 0) + var attemptedValue = 25 + helper.moveMouseToValue(attemptedValue) + expect(helper.scope.slider.min).to.equal(25) + }) + + it('should not be able to modify minH above restrictedRange.from', function() { + helper.fireMousedown(helper.slider.minH, 0) + var attemptedValue = 40 + helper.moveMouseToValue(attemptedValue) + expect(helper.scope.slider.min).to.equal(30) + }) + + it('should be able to modify maxH above restrictedRange.to', function() { + helper.fireMousedown(helper.slider.maxH, 0) + var attemptedValue = 78 + helper.moveMouseToValue(attemptedValue) + expect(helper.scope.slider.max).to.equal(78) + }) + + it('should not be able to modify maxH below restrictedRange.to', function() { + helper.fireMousedown(helper.slider.maxH, 0) + var attemptedValue = 50 + helper.moveMouseToValue(attemptedValue) + expect(helper.scope.slider.max).to.equal(70) + }) + }) + + describe('Right to left Mouse controls - minLimit!=null && maxLimit!=null Range Horizontal', function() { + var helper, RzSliderOptions, $rootScope, $timeout + + beforeEach(module('test-helper')) + + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) + + afterEach(function() { + helper.clean() + }) + + beforeEach(function() { + var sliderConf = { + min: 45, + max: 55, + options: { + floor: 0, + ceil: 100, + restrictedRange: { + from: 30, + to: 70, + }, + rightToLeft: true, + }, + } + helper.createRangeSlider(sliderConf) + }) + afterEach(function() { + // to clean document listener + helper.fireMouseup() + }) + + it('should be able to modify minH below restrictedRange.from', function() { + helper.fireMousedown(helper.slider.minH, 0) + var attemptedValue = 25 + helper.moveMouseToValue(attemptedValue) + expect(helper.scope.slider.min).to.equal(25) + }) + + it('should not be able to modify minH above restrictedRange.from', function() { + helper.fireMousedown(helper.slider.minH, 0) + var attemptedValue = 40 + helper.moveMouseToValue(attemptedValue) + expect(helper.scope.slider.min).to.equal(30) + }) + + it('should be able to modify maxH above restrictedRange.to', function() { + helper.fireMousedown(helper.slider.maxH, 0) + var attemptedValue = 78 + helper.moveMouseToValue(attemptedValue) + expect(helper.scope.slider.max).to.equal(78) + }) + + it('should not be able to modify maxH below restrictedRange.to', function() { + helper.fireMousedown(helper.slider.maxH, 0) + var attemptedValue = 50 + helper.moveMouseToValue(attemptedValue) + expect(helper.scope.slider.max).to.equal(70) + }) + }) +})() diff --git a/tests/specs/mouse-controls/single-slider-horizontal-test.js b/tests/specs/mouse-controls/single-slider-horizontal-test.js index 3a1839b..501cb28 100644 --- a/tests/specs/mouse-controls/single-slider-horizontal-test.js +++ b/tests/specs/mouse-controls/single-slider-horizontal-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -24,8 +27,8 @@ value: 0, options: { floor: 0, - ceil: 100 - } + ceil: 100, + }, } helper.createSlider(sliderConf) }) @@ -209,14 +212,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -228,8 +234,8 @@ options: { floor: 0, ceil: 100, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) }) @@ -470,7 +476,7 @@ // Touch move for the slider helper.fireTouchmoveWithoutOriginalEvent(touchPositionForSlider, 0, [ 0, - 1 + 1, ]) // Simultaneous touch move but not on slider @@ -490,7 +496,7 @@ // Touch move for slider helper.fireTouchmoveWithoutOriginalEvent(touchPositionForSlider, 0, [ 0, - 1 + 1, ]) // Can still drag the slider @@ -505,7 +511,7 @@ var touchPositionForSlider = helper.getMousePosition(70) helper.fireTouchmoveWithoutOriginalEvent(touchPositionForSlider, 0, [ 0, - 1 + 1, ]) // Can not drag the slider anymore diff --git a/tests/specs/mouse-controls/single-slider-vertical-test.js b/tests/specs/mouse-controls/single-slider-vertical-test.js index b9a53d4..897711a 100644 --- a/tests/specs/mouse-controls/single-slider-vertical-test.js +++ b/tests/specs/mouse-controls/single-slider-vertical-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -25,8 +28,8 @@ options: { floor: 0, ceil: 100, - vertical: true - } + vertical: true, + }, } helper.createSlider(sliderConf) }) @@ -227,14 +230,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -247,8 +253,8 @@ floor: 0, ceil: 100, vertical: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) }) diff --git a/tests/specs/options-handling-test.js b/tests/specs/options-handling-test.js index ce772fc..e64bc4d 100644 --- a/tests/specs/options-handling-test.js +++ b/tests/specs/options-handling-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) }) @@ -142,7 +145,7 @@ { value: 'B' }, { value: 'C' }, { value: 'D' }, - { value: 'E' } + { value: 'E' }, ] helper.scope.$digest() expect(helper.slider.options.step).to.equal(1) @@ -158,7 +161,7 @@ { value: 'B' }, { value: 'C' }, { value: 'D' }, - { value: 'E' } + { value: 'E' }, ] helper.scope.slider.options.bindIndexForStepsArray = true helper.scope.$digest() @@ -175,7 +178,7 @@ { value: 'B', legend: 'Legend B' }, { value: 'C' }, { value: 'D', legend: 'Legend D' }, - { value: 'E' } + { value: 'E' }, ] helper.scope.slider.options.showTicks = true helper.scope.$digest() @@ -200,7 +203,7 @@ { value: 'B', legend: 'Legend B' }, { value: 'C' }, { value: 'D', legend: 'Legend D' }, - { value: 'E' } + { value: 'E' }, ] helper.scope.slider.options.bindIndexForStepsArray = true helper.scope.slider.options.showTicks = true @@ -267,7 +270,7 @@ helper.scope.slider.options.stepsArray = [ { value: 'A', foo: 'barA' }, { value: 'B', foo: 'barB' }, - { value: 'C', foo: 'barC' } + { value: 'C', foo: 'barC' }, ] helper.scope.slider.options.translate = function( value, @@ -289,7 +292,7 @@ helper.scope.slider.options.stepsArray = [ { foo: 'barA' }, { foo: 'barB' }, - { foo: 'barC' } + { foo: 'barC' }, ] helper.scope.slider.options.bindIndexForStepsArray = true helper.scope.slider.options.translate = function( @@ -338,8 +341,8 @@ step: 10, translate: function(v) { return 'custom value' - } - } + }, + }, } helper.createSlider(sliderConf) expect(helper.slider.customTrFn(0)).to.equal('custom value') @@ -348,7 +351,7 @@ it('should set maxValue to rzSliderModel if no ceil is set for a single slider', function() { var sliderConf = { - value: 10 + value: 10, } helper.createSlider(sliderConf) expect(helper.slider.maxValue).to.equal(10) @@ -357,7 +360,7 @@ it('should set maxValue to rzSliderHigh if no ceil is set for a range slider', function() { var sliderConf = { min: 10, - max: 100 + max: 100, } helper.createRangeSlider(sliderConf) expect(helper.slider.maxValue).to.equal(100) @@ -369,8 +372,9 @@ options: { floor: 0, ceil: 10, - showSelectionBar: true - } + showSelectionBar: true, + disableAnimation: true, + }, } helper.createSlider(sliderConf) var expectedDimension = @@ -388,8 +392,9 @@ options: { floor: 0, ceil: 10, - showSelectionBarEnd: true - } + showSelectionBarEnd: true, + disableAnimation: true, + }, } helper.createSlider(sliderConf) var expectedDimension = Math.floor( @@ -414,8 +419,9 @@ options: { floor: 0, ceil: 20, - showSelectionBarFromValue: 10 - } + showSelectionBarFromValue: 10, + disableAnimation: true, + }, } helper.createSlider(sliderConf) var expectedDimension = Math.round(helper.slider.valueToPosition(5)), @@ -436,8 +442,9 @@ options: { floor: 0, ceil: 20, - showSelectionBarFromValue: 10 - } + showSelectionBarFromValue: 10, + disableAnimation: true, + }, } helper.createSlider(sliderConf) var expectedDimension = Math.round(helper.slider.valueToPosition(7)), @@ -463,9 +470,9 @@ ceil: 20, selectionBarGradient: { from: 'white', - to: 'blue' - } - } + to: 'blue', + }, + }, } helper.createRangeSlider(sliderConf) @@ -489,9 +496,9 @@ showSelectionBar: true, selectionBarGradient: { from: 'white', - to: 'blue' - } - } + to: 'blue', + }, + }, } helper.createSlider(sliderConf) @@ -505,8 +512,8 @@ var sliderConf = { value: 10, options: { - hideLimitLabels: true - } + hideLimitLabels: true, + }, } helper.createSlider(sliderConf) expect(helper.slider.flrLab.rzAlwaysHide).to.be.true @@ -517,8 +524,8 @@ var sliderConf = { value: 10, options: { - hidePointerLabels: true - } + hidePointerLabels: true, + }, } helper.createSlider(sliderConf) expect(helper.slider.minLab.rzAlwaysHide).to.be.true @@ -529,8 +536,8 @@ min: 10, max: 100, options: { - hidePointerLabels: true - } + hidePointerLabels: true, + }, } helper.createRangeSlider(sliderConf) expect(helper.slider.minLab.rzAlwaysHide).to.be.true @@ -544,8 +551,8 @@ options: { floor: 0, ceil: 100, - hidePointerLabels: true - } + hidePointerLabels: true, + }, } helper.createSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('visible') @@ -559,8 +566,8 @@ options: { floor: 0, ceil: 100, - hidePointerLabels: true - } + hidePointerLabels: true, + }, } helper.createRangeSlider(sliderConf) expect(helper.slider.flrLab.css('visibility')).to.equal('visible') @@ -577,8 +584,8 @@ getSelectionBarColor: function(v) { if (v < 5) return 'red' return 'green' - } - } + }, + }, } helper.createSlider(sliderConf) var selBarChild = angular.element( @@ -597,8 +604,9 @@ max: 8, options: { floor: 0, - ceil: 10 - } + ceil: 10, + disableAnimation: true, + }, } helper.createRangeSlider(sliderConf) @@ -625,8 +633,8 @@ getSelectionBarColor: function(min, max) { if (max - min < 5) return 'red' return 'green' - } - } + }, + }, } helper.createRangeSlider(sliderConf) var selBarChild = angular.element( @@ -645,8 +653,8 @@ value: 10, options: { id: 'test', - onStart: sinon.spy() - } + onStart: sinon.spy(), + }, } helper.createSlider(sliderConf) @@ -662,8 +670,8 @@ value: 10, options: { id: 'test', - onStart: sinon.spy() - } + onStart: sinon.spy(), + }, } helper.createSlider(sliderConf) @@ -679,8 +687,8 @@ value: 10, options: { id: 'test', - onChange: sinon.spy() - } + onChange: sinon.spy(), + }, } helper.createSlider(sliderConf) @@ -696,8 +704,8 @@ value: 10, options: { id: 'test', - onEnd: sinon.spy() - } + onEnd: sinon.spy(), + }, } helper.createSlider(sliderConf) @@ -718,8 +726,8 @@ getPointerColor: function(v) { if (v < 5) return 'red' return 'green' - } - } + }, + }, } helper.createSlider(sliderConf) var minHChild = angular.element(helper.slider.minH[0]) @@ -740,8 +748,8 @@ getPointerColor: function(v) { if (v < 5) return 'red' return 'green' - } - } + }, + }, } helper.createRangeSlider(sliderConf) var minHChild = angular.element(helper.slider.minH[0]), @@ -773,8 +781,8 @@ if (v < 5) return 'blue' return 'orange' } - } - } + }, + }, } helper.createRangeSlider(sliderConf) var minHChild = angular.element(helper.slider.minH[0]), @@ -804,8 +812,8 @@ if (v < 5) return 'blue' return 'orange' } - } - } + }, + }, } helper.createRangeSlider(sliderConf) var minHChild = angular.element(helper.slider.minH[0]), @@ -829,8 +837,8 @@ getTickColor: function(v) { if (v < 5) return 'red' return 'green' - } - } + }, + }, } helper.createRangeSlider(sliderConf) expect(helper.element[0].querySelectorAll('.rz-tick')).to.have.length( @@ -853,8 +861,8 @@ options: { floor: 100000000, ceil: 100001000, - boundPointerLabels: false - } + boundPointerLabels: false, + }, } helper.createRangeSlider(sliderConf) @@ -887,8 +895,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSlider(sliderConf) }) @@ -975,7 +983,7 @@ { value: 'B' }, { value: 'C' }, { value: 'D' }, - { value: 'E' } + { value: 'E' }, ] helper.scope.$digest() expect(helper.slider.options.step).to.equal(1) @@ -993,7 +1001,7 @@ { value: 'B' }, { value: 'C' }, { value: 'D' }, - { value: 'E' } + { value: 'E' }, ] helper.scope.slider.options.bindIndexForStepsArray = true helper.scope.$digest() @@ -1025,7 +1033,7 @@ it('should safely handle null expressions', function() { var sliderConf = { value: 10, - optionsExpression: 'thisDoesntExist' + optionsExpression: 'thisDoesntExist', } helper.createSlider(sliderConf) @@ -1039,10 +1047,10 @@ options: function() { return { floor: 1, - ceil: 1000 + ceil: 1000, } }, - optionsExpression: 'slider.options()' + optionsExpression: 'slider.options()', } helper.createSlider(sliderConf) @@ -1058,14 +1066,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -1079,8 +1090,8 @@ floor: 0, ceil: 100, step: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) }) @@ -1202,8 +1213,8 @@ translate: function(v) { return 'custom value' }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) expect(helper.slider.customTrFn(0)).to.equal('custom value') @@ -1213,7 +1224,7 @@ it('should set maxValue to rzSliderModel if no ceil is set for a single slider', function() { var sliderConf = { value: 10, - rightToLeft: true + rightToLeft: true, } helper.createSlider(sliderConf) expect(helper.slider.maxValue).to.equal(10) @@ -1223,7 +1234,7 @@ var sliderConf = { min: 10, max: 100, - rightToLeft: true + rightToLeft: true, } helper.createRangeSlider(sliderConf) expect(helper.slider.maxValue).to.equal(100) @@ -1236,8 +1247,9 @@ floor: 0, ceil: 10, showSelectionBar: true, - rightToLeft: true - } + rightToLeft: true, + disableAnimation: true, + }, } helper.createSlider(sliderConf) var expectedDimension = Math.round( @@ -1261,8 +1273,9 @@ floor: 0, ceil: 10, showSelectionBarEnd: true, - rightToLeft: true - } + rightToLeft: true, + disableAnimation: true, + }, } helper.createSlider(sliderConf) var expectedDimension = Math.floor( @@ -1282,8 +1295,8 @@ floor: 0, ceil: 20, showSelectionBarFromValue: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var expectedDimension = Math.round(helper.slider.valueToPosition(15)), @@ -1305,8 +1318,9 @@ floor: 0, ceil: 20, showSelectionBarFromValue: 10, - rightToLeft: true - } + rightToLeft: true, + disableAnimation: true, + }, } helper.createSlider(sliderConf) var expectedDimension = Math.round(helper.slider.valueToPosition(13)), @@ -1332,8 +1346,8 @@ if (v < 5) return 'red' return 'green' }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var selBarChild = angular.element( @@ -1352,9 +1366,10 @@ max: 8, options: { floor: 0, - ceil: 10 + ceil: 10, + disableAnimation: true, }, - rightToLeft: true + rightToLeft: true, } helper.createRangeSlider(sliderConf) @@ -1382,8 +1397,8 @@ if (max - min < 5) return 'red' return 'green' }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) var selBarChild = angular.element( @@ -1403,8 +1418,8 @@ options: { id: 'test', onStart: sinon.spy(), - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) @@ -1419,8 +1434,8 @@ options: { id: 'test', onChange: sinon.spy(), - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) @@ -1435,8 +1450,8 @@ options: { id: 'test', onEnd: sinon.spy(), - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) @@ -1456,8 +1471,8 @@ if (v < 5) return 'red' return 'green' }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var minHChild = angular.element(helper.slider.minH[0]) @@ -1479,8 +1494,8 @@ if (v < 5) return 'red' return 'green' }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) var minHChild = angular.element(helper.slider.minH[0]), @@ -1513,8 +1528,8 @@ return 'orange' } }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) var minHChild = angular.element(helper.slider.minH[0]), @@ -1545,8 +1560,8 @@ return 'orange' } }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) var minHChild = angular.element(helper.slider.minH[0]), @@ -1566,9 +1581,9 @@ options: { customTemplateScope: { a: 1, - b: 'test' - } - } + b: 'test', + }, + }, } helper.createSlider(sliderConf) expect(helper.slider.scope.custom.a).to.equal(1) @@ -1585,8 +1600,8 @@ floor: 0, ceil: 100, step: 10, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createRangeSlider(sliderConf) }) @@ -1646,13 +1661,46 @@ parseInt(helper.slider.leftOutSelBar.css('left')) ) }) + + it('should use the default separator when labels overlap', function() { + helper.scope.slider.min = -1 + helper.scope.slider.max = 1 + helper.scope.slider.options.floor = -100 + helper.scope.slider.options.ceil = +100 + helper.scope.slider.options.step = 1 + helper.scope.slider.options.rightToLeft = false + helper.scope.$digest() + expect(helper.slider.cmbLab.text()).to.equal('-1 - 1') + }) + + it('should use the custom separator when labels overlap, and labelOverlapSeparator is set', function() { + helper.scope.slider.min = -1 + helper.scope.slider.max = 1 + helper.scope.slider.options.floor = -100 + helper.scope.slider.options.ceil = +100 + helper.scope.slider.options.step = 1 + helper.scope.slider.options.rightToLeft = false + helper.scope.slider.options.labelOverlapSeparator = ' .. ' + helper.scope.$digest() + expect(helper.slider.cmbLab.text()).to.equal('-1 .. 1') + }) + it('should use the custom separator when labels overlap, and labelOverlapSeparator is set, in RTL mode', function() { + helper.scope.slider.min = -1 + helper.scope.slider.max = 1 + helper.scope.slider.options.floor = -100 + helper.scope.slider.options.ceil = +100 + helper.scope.slider.options.step = 1 + helper.scope.slider.options.labelOverlapSeparator = ' .. ' + helper.scope.$digest() + expect(helper.slider.cmbLab.text()).to.equal('1 .. -1') + }) }) describe('options expression specific - ', function() { it('should safely handle null expressions', function() { var sliderConf = { value: 10, - optionsExpression: 'thisDoesntExist' + optionsExpression: 'thisDoesntExist', } helper.createSlider(sliderConf) @@ -1666,10 +1714,10 @@ options: function() { return { floor: 1, - ceil: 1000 + ceil: 1000, } }, - optionsExpression: 'slider.options()' + optionsExpression: 'slider.options()', } helper.createSlider(sliderConf) @@ -1689,8 +1737,8 @@ step: 10, translate: function(val) { return val + '%' - } - } + }, + }, } helper.createSlider(sliderConf) }) diff --git a/tests/specs/range-slider-init-test.js b/tests/specs/range-slider-init-test.js index 5083736..1d201dd 100644 --- a/tests/specs/range-slider-init-test.js +++ b/tests/specs/range-slider-init-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,14 +29,14 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createRangeSlider(sliderConf) }) it('should exist compiled and with correct config', function() { - expect(helper.element.find('span')).to.have.length(15) + expect(helper.element.find('span')).to.have.length(17) expect(helper.slider.range).to.be.true expect(helper.slider.valueRange).to.equal(100) expect(helper.slider.maxH.css('display')).to.equal('') diff --git a/tests/specs/rz-slider-options-test.js b/tests/specs/rz-slider-options-test.js index 6f95da6..03dafb4 100644 --- a/tests/specs/rz-slider-options-test.js +++ b/tests/specs/rz-slider-options-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -22,7 +25,7 @@ it('should have a correct getOptions method that apply custom options', function() { var defaultOpts = RzSliderOptions.getOptions() var customOpts = { - showTicks: true + showTicks: true, } var expectedOpts = angular.extend({}, defaultOpts, customOpts) @@ -33,7 +36,7 @@ it('should have a correct options method to update the global options', function() { var defaultOpts = RzSliderOptions.getOptions() var globalOpts = { - showTicks: true + showTicks: true, } RzSliderOptions.options(globalOpts) diff --git a/tests/specs/scale-test.js b/tests/specs/scale-test.js index 8ed55b3..e1824de 100644 --- a/tests/specs/scale-test.js +++ b/tests/specs/scale-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -26,8 +29,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) }) @@ -59,8 +62,8 @@ floor: 1, ceil: 100, step: 10, - logScale: true - } + logScale: true, + }, } helper.createSlider(sliderConf) }) @@ -120,8 +123,8 @@ maxVal = Math.sqrt(maxVal) var value = percent * (maxVal - minVal) + minVal return Math.pow(value, 2) - } - } + }, + }, } helper.createSlider(sliderConf) }) diff --git a/tests/specs/single-slider-init-test.js b/tests/specs/single-slider-init-test.js index 1f1d408..35f6147 100644 --- a/tests/specs/single-slider-init-test.js +++ b/tests/specs/single-slider-init-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -25,14 +28,14 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) }) it('should exist compiled and with correct config', function() { - expect(helper.element.find('span')).to.have.length(15) + expect(helper.element.find('span')).to.have.length(17) expect(helper.slider.range).to.be.false expect(helper.slider.valueRange).to.equal(100) expect(helper.slider.maxH.css('display')).to.equal('none') @@ -83,27 +86,25 @@ helper.slider.onLowHandleChange.called.should.be.true }) - it( - 'should call calcViewDimensions() on window resize event', - inject(function($window) { - sinon.spy(helper.slider, 'calcViewDimensions') - angular.element($window).triggerHandler('resize') - helper.slider.calcViewDimensions.called.should.be.true - }) - ) - - it( - 'should unregister all dom events on $destroy', - inject(function($window) { - sinon.spy(helper.slider, 'calcViewDimensions') - sinon.spy(helper.slider, 'unbindEvents') - - helper.scope.$broadcast('$destroy') - angular.element($window).triggerHandler('resize') - - helper.slider.calcViewDimensions.called.should.be.false - helper.slider.unbindEvents.called.should.be.true - }) - ) + it('should call calcViewDimensions() on window resize event', inject(function( + $window + ) { + sinon.spy(helper.slider, 'calcViewDimensions') + angular.element($window).triggerHandler('resize') + helper.slider.calcViewDimensions.called.should.be.true + })) + + it('should unregister all dom events on $destroy', inject(function( + $window + ) { + sinon.spy(helper.slider, 'calcViewDimensions') + sinon.spy(helper.slider, 'unbindEvents') + + helper.scope.$broadcast('$destroy') + angular.element($window).triggerHandler('resize') + + helper.slider.calcViewDimensions.called.should.be.false + helper.slider.unbindEvents.called.should.be.true + })) }) })() diff --git a/tests/specs/test-template.js b/tests/specs/test-template.js index ad26fdb..69f487b 100644 --- a/tests/specs/test-template.js +++ b/tests/specs/test-template.js @@ -11,14 +11,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -34,8 +37,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) }) diff --git a/tests/specs/ticks-test.js b/tests/specs/ticks-test.js index 6a851d2..4379fd1 100644 --- a/tests/specs/ticks-test.js +++ b/tests/specs/ticks-test.js @@ -6,14 +6,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -25,8 +28,8 @@ options: { floor: 0, ceil: 100, - step: 10 - } + step: 10, + }, } helper.createSlider(sliderConf) expect(helper.element[0].querySelectorAll('.rz-tick')).to.have.length(0) @@ -39,8 +42,8 @@ floor: 0, ceil: 100, step: 10, - showTicks: true - } + showTicks: true, + }, } helper.createSlider(sliderConf) expect(helper.element[0].querySelectorAll('.rz-tick')).to.have.length(11) @@ -53,8 +56,8 @@ floor: 0, ceil: 100, step: 10, - showTicks: 20 - } + showTicks: 20, + }, } helper.createSlider(sliderConf) expect(helper.element[0].querySelectorAll('.rz-tick')).to.have.length(6) @@ -67,8 +70,8 @@ floor: 0, ceil: 100, step: 10, - showTicksValues: true - } + showTicksValues: true, + }, } helper.createSlider(sliderConf) expect(helper.element[0].querySelectorAll('.rz-tick')).to.have.length(11) @@ -90,8 +93,8 @@ value: 'C', options: { stepsArray: ['A', 'B', 'C', 'D', 'E'], - showTicksValues: true - } + showTicksValues: true, + }, } helper.createSlider(sliderConf) expect(helper.element[0].querySelectorAll('.rz-tick')).to.have.length(5) @@ -118,8 +121,8 @@ options: { stepsArray: ['A', 'B', 'C', 'D', 'E'], bindIndexForStepsArray: true, - showTicksValues: true - } + showTicksValues: true, + }, } helper.createSlider(sliderConf) expect(helper.element[0].querySelectorAll('.rz-tick')).to.have.length(5) @@ -147,8 +150,8 @@ floor: 0, ceil: 100, step: 10, - showTicksValues: 20 - } + showTicksValues: 20, + }, } helper.createSlider(sliderConf) expect(helper.slider.ticks.hasClass('rz-ticks-values-under')).to.be.true @@ -181,8 +184,8 @@ ceil: 100, step: 10, showTicksValues: 20, - showTicks: 10 - } + showTicks: 10, + }, } helper.createSlider(sliderConf) expect(helper.slider.ticks.hasClass('rz-ticks-values-under')).to.be.true @@ -214,8 +217,8 @@ floor: 0, ceil: 100, step: 10, - ticksArray: [0, 25, 50, 100] - } + ticksArray: [0, 25, 50, 100], + }, } helper.createSlider(sliderConf) expect(helper.slider.ticks.hasClass('rz-ticks-values-under')).to.be.false @@ -233,8 +236,8 @@ ceil: 100, step: 10, ticksArray: [0, 25, 50, 100], - showTicksValues: true - } + showTicksValues: true, + }, } helper.createSlider(sliderConf) expect(helper.slider.ticks.hasClass('rz-ticks-values-under')).to.be.true @@ -260,6 +263,39 @@ expect(lastTick.text()).to.equal('100') }) + it('should create the correct number of ticks when ticksArray is used as array of objects', function() { + var sliderConf = { + value: 50, + options: { + floor: 0, + ceil: 100, + step: 10, + ticksArray: [ + { value: 0, legend: 'Bad' }, + { value: 50, legend: 'Average' }, + { value: 100, legend: 'Excellent' }, + ], + }, + } + helper.createSlider(sliderConf) + expect(helper.element[0].querySelectorAll('.rz-tick')).to.have.length(3) + expect( + helper.element[0].querySelectorAll('.rz-tick-value') + ).to.have.length(0) + + expect( + helper.element[0].querySelectorAll('.rz-tick-legend') + ).to.have.length(3) + var firstLegend = angular.element( + helper.element[0].querySelectorAll('.rz-tick-legend')[0] + ) + expect(firstLegend.text()).to.equal('Bad') + var lastLegend = angular.element( + helper.element[0].querySelectorAll('.rz-tick-legend')[2] + ) + expect(lastLegend.text()).to.equal('Excellent') + }) + it('should create the correct number of legend items when getLegend is defined', function() { var sliderConf = { value: 50, @@ -270,8 +306,8 @@ showTicks: true, getLegend: function(value) { return 'Legend for ' + value - } - } + }, + }, } helper.createSlider(sliderConf) expect( @@ -298,8 +334,8 @@ getLegend: function(value) { if (value % 20 === 0) return 'Legend for ' + value return null - } - } + }, + }, } helper.createSlider(sliderConf) expect( @@ -323,8 +359,8 @@ ceil: 100, step: 10, showTicks: true, - showSelectionBar: true - } + showSelectionBar: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -353,8 +389,8 @@ ceil: 100, step: 10, showTicks: true, - showSelectionBarEnd: true - } + showSelectionBarEnd: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -387,8 +423,8 @@ ceil: 100, step: 10, showTicks: true, - showSelectionBarFromValue: 30 - } + showSelectionBarFromValue: 30, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -428,8 +464,8 @@ ceil: 100, step: 10, showTicks: true, - showSelectionBarFromValue: 70 - } + showSelectionBarFromValue: 70, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -470,8 +506,8 @@ floor: 0, ceil: 100, step: 10, - showTicks: true - } + showTicks: true, + }, } helper.createRangeSlider(sliderConf) var firstTick = angular.element( @@ -504,8 +540,8 @@ getSelectionBarColor: function(value) { if (value <= 50) return 'red' else return 'green' - } - } + }, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -528,8 +564,8 @@ showTicks: true, ticksTooltip: function(value) { return 'tooltip for ' + value - } - } + }, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -554,8 +590,8 @@ showTicks: true, ticksTooltip: function(value) { return 'tooltip for ' + value - } - } + }, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -579,8 +615,8 @@ showTicksValues: true, ticksValuesTooltip: function(value) { return 'tooltip for ' + value - } - } + }, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -605,8 +641,8 @@ showTicksValues: true, ticksValuesTooltip: function(value) { return 'tooltip for ' + value - } - } + }, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -626,14 +662,17 @@ beforeEach(module('test-helper')) - beforeEach( - inject(function(TestHelper, _RzSliderOptions_, _$rootScope_, _$timeout_) { - helper = TestHelper - RzSliderOptions = _RzSliderOptions_ - $rootScope = _$rootScope_ - $timeout = _$timeout_ - }) - ) + beforeEach(inject(function( + TestHelper, + _RzSliderOptions_, + _$rootScope_, + _$timeout_ + ) { + helper = TestHelper + RzSliderOptions = _RzSliderOptions_ + $rootScope = _$rootScope_ + $timeout = _$timeout_ + })) afterEach(function() { helper.clean() @@ -648,8 +687,8 @@ step: 10, showTicks: true, showSelectionBar: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -679,8 +718,8 @@ step: 10, showTicks: true, showSelectionBarEnd: true, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -714,8 +753,8 @@ step: 10, showTicks: true, showSelectionBarFromValue: 30, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -756,8 +795,8 @@ step: 10, showTicks: true, showSelectionBarFromValue: 70, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -803,8 +842,8 @@ if (value <= 50) return 'red' else return 'green' }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -828,8 +867,8 @@ ticksTooltip: function(value) { return 'tooltip for ' + value }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -855,8 +894,8 @@ ticksTooltip: function(value) { return 'tooltip for ' + value }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -881,8 +920,8 @@ ticksValuesTooltip: function(value) { return 'tooltip for ' + value }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element( @@ -908,8 +947,8 @@ ticksValuesTooltip: function(value) { return 'tooltip for ' + value }, - rightToLeft: true - } + rightToLeft: true, + }, } helper.createSlider(sliderConf) var firstTick = angular.element(