2021-01-15 15:31:43 +01:00
function _defineProperty ( obj , key , value ) { if ( key in obj ) { Object . defineProperty ( obj , key , { value : value , enumerable : true , configurable : true , writable : true } ) ; } else { obj [ key ] = value ; } return obj ; }
function asyncGeneratorStep ( gen , resolve , reject , _next , _throw , key , arg ) { try { var info = gen [ key ] ( arg ) ; var value = info . value ; } catch ( error ) { reject ( error ) ; return ; } if ( info . done ) { resolve ( value ) ; } else { Promise . resolve ( value ) . then ( _next , _throw ) ; } }
function _asyncToGenerator ( fn ) { return function ( ) { var self = this , args = arguments ; return new Promise ( function ( resolve , reject ) { var gen = fn . apply ( self , args ) ; function _next ( value ) { asyncGeneratorStep ( gen , resolve , reject , _next , _throw , "next" , value ) ; } function _throw ( err ) { asyncGeneratorStep ( gen , resolve , reject , _next , _throw , "throw" , err ) ; } _next ( undefined ) ; } ) ; } ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } }
function _createClass ( Constructor , protoProps , staticProps ) { if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) _defineProperties ( Constructor , staticProps ) ; return Constructor ; }
( window [ "webpackJsonp" ] = window [ "webpackJsonp" ] || [ ] ) . push ( [ [ 25 ] , {
/***/
"./node_modules/@ionic/core/dist/esm/ion-range.entry.js" :
/*!**************************************************************!*\
!*** ./node_modules/@ionic/core/dist/esm/ion-range.entry.js ***!
\**************************************************************/
/*! exports provided: ion_range */
/***/
function node _modulesIonicCoreDistEsmIonRangeEntryJs ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
/* harmony export (binding) */
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ion_range" , function ( ) {
return Range ;
} ) ;
/* harmony import */
2021-02-24 10:42:01 +01:00
var _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ = _ _webpack _require _ _ (
/*! ./index-e806d1f6.js */
"./node_modules/@ionic/core/dist/esm/index-e806d1f6.js" ) ;
2021-01-15 15:31:43 +01:00
/* harmony import */
2021-02-24 10:42:01 +01:00
var _ionic _global _9d5c8ee3 _js _ _WEBPACK _IMPORTED _MODULE _1 _ _ = _ _webpack _require _ _ (
/*! ./ionic-global-9d5c8ee3.js */
"./node_modules/@ionic/core/dist/esm/ionic-global-9d5c8ee3.js" ) ;
2021-01-15 15:31:43 +01:00
/* harmony import */
2021-02-24 10:42:01 +01:00
var _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ = _ _webpack _require _ _ (
/*! ./helpers-90f46169.js */
"./node_modules/@ionic/core/dist/esm/helpers-90f46169.js" ) ;
2021-01-15 15:31:43 +01:00
/* harmony import */
2021-02-24 10:42:01 +01:00
var _theme _ff3fc52f _js _ _WEBPACK _IMPORTED _MODULE _3 _ _ = _ _webpack _require _ _ (
/*! ./theme-ff3fc52f.js */
"./node_modules/@ionic/core/dist/esm/theme-ff3fc52f.js" ) ;
2021-01-15 15:31:43 +01:00
var rangeIosCss = ":host{--knob-handle-size:calc(var(--knob-size) * 2);display:-ms-flexbox;display:flex;position:relative;-ms-flex:3;flex:3;-ms-flex-align:center;align-items:center;font-family:var(--ion-font-family, inherit);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.range-disabled){pointer-events:none}::slotted(ion-label){-ms-flex:initial;flex:initial}::slotted(ion-icon[slot]){font-size:24px}.range-slider{position:relative;-ms-flex:1;flex:1;width:100%;height:var(--height);contain:size layout style;cursor:-webkit-grab;cursor:grab;-ms-touch-action:pan-y;touch-action:pan-y}:host(.range-pressed) .range-slider{cursor:-webkit-grabbing;cursor:grabbing}.range-pin{position:absolute;background:var(--ion-color-base);color:var(--ion-color-contrast);text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box}.range-knob-handle{left:0;top:calc((var(--height) - var(--knob-handle-size)) / 2);margin-left:calc(0px - var(--knob-handle-size) / 2);position:absolute;width:var(--knob-handle-size);height:var(--knob-handle-size);text-align:center}[dir=rtl] .range-knob-handle,:host-context([dir=rtl]) .range-knob-handle{left:unset;right:unset;right:0}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){.range-knob-handle{margin-left:unset;-webkit-margin-start:calc(0px - var(--knob-handle-size) / 2);margin-inline-start:calc(0px - var(--knob-handle-size) / 2)}}[dir=rtl] .range-knob-handle,:host-context([dir=rtl]) .range-knob-handle{left:unset}.range-knob-handle:active,.range-knob-handle:focus{outline:none}.range-bar{border-radius:var(--bar-border-radius);left:0;top:calc((var(--height) - var(--bar-height)) / 2);position:absolute;width:100%;height:var(--bar-height);background:var(--bar-background);pointer-events:none}[dir=rtl] .range-bar,:host-context([dir=rtl]) .range-bar{left:unset;right:unset;right:0}[dir=rtl] .range-bar,:host-context([dir=rtl]) .range-bar{left:unset}.range-knob{border-radius:var(--knob-border-radius);left:calc(50% - var(--knob-size) / 2);top:calc(50% - var(--knob-size) / 2);position:absolute;width:var(--knob-size);height:var(--knob-size);background:var(--knob-background);-webkit-box-shadow:var(--knob-box-shadow);box-shadow:var(--knob-box-shadow);z-index:2;pointer-events:none}[dir=rtl] .range-knob,:host-context([dir=rtl]) .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}[dir=rtl] .range-knob,:host-context([dir=rtl]) .range-knob{left:unset}:host(.range-pressed) .range-bar-active{will-change:left, right}:host(.in-item){width:100%}:host(.in-item) ::slotted(ion-label){-ms-flex-item-align:center;align-self:center}:host{--knob-border-radius:50%;--knob-background:#ffffff;--knob-box-shadow:0 3px 1px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.13), 0 0 0 1px rgba(0, 0, 0, 0.02);--knob-size:28px;--bar-height:2px;--bar-background:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.1);--bar-background-active:var(--ion-color-primary, #3880ff);--bar-border-radius:0;--height:42px;padding-left:16px;padding-right:16px;padding-top:8px;padding-bottom:8px}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){:host{padding-left:unset;padding-right:unset;-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px}}:host(.ion-color) .range-bar-active,:host(.ion-color) .range-tick-active{background:var(--ion-color-base)}::slotted([slot=start]){margin-left:0;margin-right:16px;margin-top:0;margin-bottom:0}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){::slotted([slot=start]){margin-left:unset;margin-right:unset;-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}}::slotted([slot=end]){margin-left:16px;margin-right:0;margin-top:0;margin-bottom:0}@supports ((-webkit-margin-start: 0) or (margin-inline-start: 0)) or (-webkit-margin-start: 0){::slotted([slot=end]){margin-left:unset;margin-right:unset;-webkit-margin-start:16px;margin-inline-start:16px;-webkit-mar
var rangeMdCss = " : host { -- knob - handle - size : calc ( var ( -- knob - size ) * 2 ) ; display : - ms - flexbox ; display : flex ; position : relative ; - ms - flex : 3 ; flex : 3 ; - ms - flex - align : center ; align - items : center ; font - family : var ( -- ion - font - family , inherit ) ; - webkit - user - select : none ; - moz - user - select : none ; - ms - user - select : none ; user - select : none ; z - index : 2 } : host ( . range - disabled ) { pointer - events : none } : : slotted ( ion - label ) { - ms - flex : initial ; flex : initial } : : slotted ( ion - icon [ slot ] ) { font - size : 24 px } . range - slider { position : relative ; - ms - flex : 1 ; flex : 1 ; width : 100 % ; height : var ( -- height ) ; contain : size layout style ; cursor : - webkit - grab ; cursor : grab ; - ms - touch - action : pan - y ; touch - action : pan - y } : host ( . range - pressed ) . range - slider { cursor : - webkit - grabbing ; cursor : grabbing } . range - pin { position : absolute ; background : var ( -- ion - color - base ) ; color : var ( -- ion - color - contrast ) ; text - align : center ; - webkit - box - sizing : border - box ; box - sizing : border - box } . range - knob - handle { left : 0 ; top : calc ( ( var ( -- height ) - var ( -- knob - handle - size ) ) / 2 ) ; margin - left : calc ( 0 px - var ( -- knob - handle - size ) / 2 ) ; position : absolute ; width : var ( -- knob - handle - size ) ; height : var ( -- knob - handle - size ) ; text - align : center } [ dir = rtl ] . range - knob - handle , : host - context ( [ dir = rtl ] ) . range - knob - handle { left : unset ; right : unset ; right : 0 } @ supports ( ( - webkit - margin - start : 0 ) or ( margin - inline - start : 0 ) ) or ( - webkit - margin - start : 0 ) { . range - knob - handle { margin - left : unset ; - webkit - margin - start : calc ( 0 px - var ( -- knob - handle - size ) / 2 ) ; margin - inline - start : calc ( 0 px - var ( -- knob - handle - size ) / 2 ) } } [ dir = rtl ] . range - knob - handle , : host - context ( [ dir = rtl ] ) . range - knob - handle { left : unset } . range - knob - handle : active , . range - knob - handle : focus { outline : none } . range - bar { border - radius : var ( -- bar - border - radius ) ; left : 0 ; top : calc ( ( var ( -- height ) - var ( -- bar - height ) ) / 2 ) ; position : absolute ; width : 100 % ; height : var ( -- bar - height ) ; background : var ( -- bar - background ) ; pointer - events : none } [ dir = rtl ] . range - bar , : host - context ( [ dir = rtl ] ) . range - bar { left : unset ; right : unset ; right : 0 } [ dir = rtl ] . range - bar , : host - context ( [ dir = rtl ] ) . range - bar { left : unset } . range - knob { border - radius : var ( -- knob - border - radius ) ; left : calc ( 50 % - var ( -- knob - size ) / 2 ) ; top : calc ( 50 % - var ( -- knob - size ) / 2 ) ; position : absolute ; width : var ( -- knob - size ) ; height : var ( -- knob - size ) ; background : var ( -- knob - background ) ; - webkit - box - shadow : var ( -- knob - box - shadow ) ; box - shadow : var ( -- knob - box - shadow ) ; z - index : 2 ; pointer - events : none } [ dir = rtl ] . range - knob , : host - context ( [ dir = rtl ] ) . range - knob { left : unset ; right : unset ; right : calc ( 50 % - var ( -- knob - size ) / 2 ) } [ dir = rtl ] . range - knob , : host - context ( [ dir = rtl ] ) . range - knob { left : unset } : host ( . range - pressed ) . range - bar - active { will - change : left , right } : host ( . in - item ) { width : 100 % } : host ( . in - item ) : : slotted ( ion - label ) { - ms - flex - item - align : center ; align - self : center } : host { -- knob - border - radius : 50 % ; -- knob - background : var ( -- bar - background - active ) ; -- knob - box - shadow : none ; -- knob - size : 18 px ; -- bar - height : 2 px ; -- bar - background : rgba ( var ( -- ion - color - primary - rgb , 56 , 128 , 255 ) , 0.26 ) ; -- bar - background - active : var ( -- ion - color - primary , # 3880 ff ) ; -- bar - border - radius : 0 ; -- height : 42 px ; -- pin - background : var ( -- ion - color - primary , # 3880 ff ) ; -- pin - color : var ( -- ion - color - primary - contrast , # fff ) ; padding - left : 14 px ; padding - right : 14 px ; padding - top : 8 px ; padding - bottom : 8 px ; font - size : 12 px } @ supports ( ( - webkit - margin - start : 0 ) or ( margin - inline - start : 0 ) ) or ( - webkit - margin - start : 0 ) { : host { padding - left : unset ; padding - right : unset ; - webkit - padding - start : 14 px ; padding - inline - start : 14 px ; - webkit - padding - end : 14 px ; padding - inline - end : 14 px } } : host ( . ion - color ) . range - bar { background : rgba ( var ( -- ion - color - base - rgb ) , 0.26 ) } : host ( . ion - color ) . range - bar - active , : host ( . ion - color ) . range - knob , : host ( . ion - color ) . range - pin , : host ( . ion - color ) . range - pin : : before , : host ( . ion - color ) . range - tick { background : var ( -- ion - color - base ) ; color : var ( -- ion - color - contrast ) } : : slotted ( [ slot = start ] ) { margin - left : 0 ; margin - right : 14 px ; margin - top : 0 ; margin - bottom : 0 } @ supports ( ( - webkit - margin - start : 0 ) or ( margin - inline - start : 0 ) ) or ( - webkit - margin - start : 0 ) { : : slotted ( [ slot = start ] ) { margin - left : unset ; margin - right : unset ; - webkit - margin - start : 0 ; margin - inline - start : 0 ; - webkit - margin - end : 14 px ; margin - inline - end : 14 px } } : : slotted ( [ slot = end ] ) { margin - left : 14 px ;
var Range = /*#__PURE__*/ function ( ) {
function Range ( hostRef ) {
var _this = this ;
_classCallCheck ( this , Range ) ;
2021-02-24 10:42:01 +01:00
Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "r" ] ) ( this , hostRef ) ;
this . ionChange = Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "e" ] ) ( this , "ionChange" , 7 ) ;
this . ionStyle = Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "e" ] ) ( this , "ionStyle" , 7 ) ;
this . ionFocus = Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "e" ] ) ( this , "ionFocus" , 7 ) ;
this . ionBlur = Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "e" ] ) ( this , "ionBlur" , 7 ) ;
this . didLoad = false ;
2021-01-15 15:31:43 +01:00
this . noUpdate = false ;
this . hasFocus = false ;
this . ratioA = 0 ;
this . ratioB = 0 ;
/**
* How long, in milliseconds, to wait to trigger the
* `ionChange` event after each change in the range value.
2021-02-24 10:42:01 +01:00
* This also impacts form bindings such as `ngModel` or `v-model`.
2021-01-15 15:31:43 +01:00
*/
this . debounce = 0 ;
/**
* The name of the control, which is submitted with the form data.
*/
this . name = '' ;
/**
* Show two knobs.
*/
this . dualKnobs = false ;
/**
* Minimum integer value of the range.
*/
this . min = 0 ;
/**
* Maximum integer value of the range.
*/
this . max = 100 ;
/**
* If `true`, a pin with integer value is shown when the knob
* is pressed.
*/
this . pin = false ;
/**
* If `true`, the knob snaps to tick marks evenly spaced based
* on the step property value.
*/
this . snaps = false ;
/**
* Specifies the value granularity.
*/
this . step = 1 ;
/**
* If `true`, tick marks are displayed based on the step value.
* Only applies when `snaps` is `true`.
*/
this . ticks = true ;
/**
* If `true`, the user cannot interact with the range.
*/
this . disabled = false ;
/**
* the value of the range.
*/
this . value = 0 ;
this . clampBounds = function ( value ) {
2021-02-24 10:42:01 +01:00
return Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "h" ] ) ( _this . min , value , _this . max ) ;
2021-01-15 15:31:43 +01:00
} ;
this . ensureValueInBounds = function ( value ) {
if ( _this . dualKnobs ) {
return {
lower : _this . clampBounds ( value . lower ) ,
upper : _this . clampBounds ( value . upper )
} ;
} else {
return _this . clampBounds ( value ) ;
}
} ;
2021-02-24 10:42:01 +01:00
this . setupGesture = /*#__PURE__*/ _asyncToGenerator ( /*#__PURE__*/ regeneratorRuntime . mark ( function _callee ( ) {
var rangeSlider ;
return regeneratorRuntime . wrap ( function _callee$ ( _context ) {
while ( 1 ) {
switch ( _context . prev = _context . next ) {
case 0 :
rangeSlider = _this . rangeSlider ;
if ( ! rangeSlider ) {
_context . next = 6 ;
break ;
}
_context . next = 4 ;
return Promise . resolve ( ) . then ( _ _webpack _require _ _ . bind ( null ,
/*! ./index-f49d994d.js */
"./node_modules/@ionic/core/dist/esm/index-f49d994d.js" ) ) ;
case 4 :
_this . gesture = _context . sent . createGesture ( {
el : rangeSlider ,
gestureName : 'range' ,
gesturePriority : 100 ,
threshold : 0 ,
onStart : function onStart ( ev ) {
return _this . onStart ( ev ) ;
} ,
onMove : function onMove ( ev ) {
return _this . onMove ( ev ) ;
} ,
onEnd : function onEnd ( ev ) {
return _this . onEnd ( ev ) ;
}
} ) ;
_this . gesture . enable ( ! _this . disabled ) ;
case 6 :
case "end" :
return _context . stop ( ) ;
}
}
} , _callee ) ;
} ) ) ;
2021-01-15 15:31:43 +01:00
this . handleKeyboard = function ( knob , isIncrease ) {
var step = _this . step ;
step = step > 0 ? step : 1 ;
step = step / ( _this . max - _this . min ) ;
if ( ! isIncrease ) {
step *= - 1 ;
}
if ( knob === 'A' ) {
2021-02-24 10:42:01 +01:00
_this . ratioA = Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "h" ] ) ( 0 , _this . ratioA + step , 1 ) ;
2021-01-15 15:31:43 +01:00
} else {
2021-02-24 10:42:01 +01:00
_this . ratioB = Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "h" ] ) ( 0 , _this . ratioB + step , 1 ) ;
2021-01-15 15:31:43 +01:00
}
_this . updateValue ( ) ;
} ;
this . onBlur = function ( ) {
if ( _this . hasFocus ) {
_this . hasFocus = false ;
_this . ionBlur . emit ( ) ;
_this . emitStyle ( ) ;
}
} ;
this . onFocus = function ( ) {
if ( ! _this . hasFocus ) {
_this . hasFocus = true ;
_this . ionFocus . emit ( ) ;
_this . emitStyle ( ) ;
}
} ;
}
_createClass ( Range , [ {
key : "debounceChanged" ,
value : function debounceChanged ( ) {
2021-02-24 10:42:01 +01:00
this . ionChange = Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "e" ] ) ( this . ionChange , this . debounce ) ;
2021-01-15 15:31:43 +01:00
}
} , {
key : "minChanged" ,
value : function minChanged ( ) {
if ( ! this . noUpdate ) {
this . updateRatio ( ) ;
}
}
} , {
key : "maxChanged" ,
value : function maxChanged ( ) {
if ( ! this . noUpdate ) {
this . updateRatio ( ) ;
}
}
} , {
key : "disabledChanged" ,
value : function disabledChanged ( ) {
if ( this . gesture ) {
this . gesture . enable ( ! this . disabled ) ;
}
this . emitStyle ( ) ;
}
} , {
key : "valueChanged" ,
value : function valueChanged ( value ) {
if ( ! this . noUpdate ) {
this . updateRatio ( ) ;
}
value = this . ensureValueInBounds ( value ) ;
this . ionChange . emit ( {
value : value
} ) ;
}
2021-02-24 10:42:01 +01:00
} , {
key : "componentDidLoad" ,
value : function componentDidLoad ( ) {
this . setupGesture ( ) ;
this . didLoad = true ;
}
2021-01-15 15:31:43 +01:00
} , {
key : "connectedCallback" ,
value : function connectedCallback ( ) {
this . updateRatio ( ) ;
this . debounceChanged ( ) ;
this . disabledChanged ( ) ;
2021-02-24 10:42:01 +01:00
/**
* If we have not yet rendered
* ion-range, then rangeSlider is not defined.
* But if we are moving ion-range via appendChild,
* then rangeSlider will be defined.
*/
if ( this . didLoad ) {
this . setupGesture ( ) ;
}
2021-01-15 15:31:43 +01:00
}
} , {
key : "disconnectedCallback" ,
value : function disconnectedCallback ( ) {
if ( this . gesture ) {
this . gesture . destroy ( ) ;
this . gesture = undefined ;
}
}
} , {
key : "getValue" ,
value : function getValue ( ) {
var value = this . value || 0 ;
if ( this . dualKnobs ) {
if ( typeof value === 'object' ) {
return value ;
}
return {
lower : 0 ,
upper : value
} ;
} else {
if ( typeof value === 'object' ) {
return value . upper ;
}
return value ;
}
}
} , {
key : "emitStyle" ,
value : function emitStyle ( ) {
this . ionStyle . emit ( {
'interactive' : true ,
'interactive-disabled' : this . disabled
} ) ;
}
} , {
key : "onStart" ,
value : function onStart ( detail ) {
var rect = this . rect = this . rangeSlider . getBoundingClientRect ( ) ;
var currentX = detail . currentX ; // figure out which knob they started closer to
2021-02-24 10:42:01 +01:00
var ratio = Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "h" ] ) ( 0 , ( currentX - rect . left ) / rect . width , 1 ) ;
2021-01-15 15:31:43 +01:00
if ( document . dir === 'rtl' ) {
ratio = 1 - ratio ;
}
this . pressedKnob = ! this . dualKnobs || Math . abs ( this . ratioA - ratio ) < Math . abs ( this . ratioB - ratio ) ? 'A' : 'B' ;
this . setFocus ( this . pressedKnob ) ; // update the active knob's position
this . update ( currentX ) ;
}
} , {
key : "onMove" ,
value : function onMove ( detail ) {
this . update ( detail . currentX ) ;
}
} , {
key : "onEnd" ,
value : function onEnd ( detail ) {
this . update ( detail . currentX ) ;
this . pressedKnob = undefined ;
}
} , {
key : "update" ,
value : function update ( currentX ) {
// figure out where the pointer is currently at
// update the knob being interacted with
var rect = this . rect ;
2021-02-24 10:42:01 +01:00
var ratio = Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "h" ] ) ( 0 , ( currentX - rect . left ) / rect . width , 1 ) ;
2021-01-15 15:31:43 +01:00
if ( document . dir === 'rtl' ) {
ratio = 1 - ratio ;
}
if ( this . snaps ) {
// snaps the ratio to the current value
ratio = valueToRatio ( ratioToValue ( ratio , this . min , this . max , this . step ) , this . min , this . max ) ;
} // update which knob is pressed
if ( this . pressedKnob === 'A' ) {
this . ratioA = ratio ;
} else {
this . ratioB = ratio ;
} // Update input value
this . updateValue ( ) ;
}
2021-02-24 10:42:01 +01:00
} , {
key : "valA" ,
get : function get ( ) {
return ratioToValue ( this . ratioA , this . min , this . max , this . step ) ;
}
} , {
key : "valB" ,
get : function get ( ) {
return ratioToValue ( this . ratioB , this . min , this . max , this . step ) ;
}
} , {
key : "ratioLower" ,
get : function get ( ) {
if ( this . dualKnobs ) {
return Math . min ( this . ratioA , this . ratioB ) ;
}
return 0 ;
}
} , {
key : "ratioUpper" ,
get : function get ( ) {
if ( this . dualKnobs ) {
return Math . max ( this . ratioA , this . ratioB ) ;
}
return this . ratioA ;
}
2021-01-15 15:31:43 +01:00
} , {
key : "updateRatio" ,
value : function updateRatio ( ) {
var value = this . getValue ( ) ;
var min = this . min ,
max = this . max ;
if ( this . dualKnobs ) {
this . ratioA = valueToRatio ( value . lower , min , max ) ;
this . ratioB = valueToRatio ( value . upper , min , max ) ;
} else {
this . ratioA = valueToRatio ( value , min , max ) ;
}
}
} , {
key : "updateValue" ,
value : function updateValue ( ) {
this . noUpdate = true ;
var valA = this . valA ,
valB = this . valB ;
this . value = ! this . dualKnobs ? valA : {
lower : Math . min ( valA , valB ) ,
upper : Math . max ( valA , valB )
} ;
this . noUpdate = false ;
}
} , {
key : "setFocus" ,
value : function setFocus ( knob ) {
if ( this . el . shadowRoot ) {
var knobEl = this . el . shadowRoot . querySelector ( knob === 'A' ? '.range-knob-a' : '.range-knob-b' ) ;
if ( knobEl ) {
knobEl . focus ( ) ;
}
}
}
} , {
key : "render" ,
value : function render ( ) {
var _barStyle ,
2021-02-24 10:42:01 +01:00
_Object ,
_this2 = this ;
2021-01-15 15:31:43 +01:00
var min = this . min ,
max = this . max ,
step = this . step ,
el = this . el ,
handleKeyboard = this . handleKeyboard ,
pressedKnob = this . pressedKnob ,
disabled = this . disabled ,
pin = this . pin ,
ratioLower = this . ratioLower ,
ratioUpper = this . ratioUpper ;
2021-02-24 10:42:01 +01:00
var mode = Object ( _ionic _global _9d5c8ee3 _js _ _WEBPACK _IMPORTED _MODULE _1 _ _ [ "b" ] ) ( this ) ;
2021-01-15 15:31:43 +01:00
var barStart = "" . concat ( ratioLower * 100 , "%" ) ;
var barEnd = "" . concat ( 100 - ratioUpper * 100 , "%" ) ;
var doc = document ;
var isRTL = doc . dir === 'rtl' ;
var start = isRTL ? 'right' : 'left' ;
var end = isRTL ? 'left' : 'right' ;
var tickStyle = function tickStyle ( tick ) {
return _defineProperty ( { } , start , tick [ start ] ) ;
} ;
var barStyle = ( _barStyle = { } , _defineProperty ( _barStyle , start , barStart ) , _defineProperty ( _barStyle , end , barEnd ) , _barStyle ) ;
var ticks = [ ] ;
if ( this . snaps && this . ticks ) {
for ( var value = min ; value <= max ; value += step ) {
var ratio = valueToRatio ( value , min , max ) ;
var tick = {
ratio : ratio ,
active : ratio >= ratioLower && ratio <= ratioUpper
} ;
tick [ start ] = "" . concat ( ratio * 100 , "%" ) ;
ticks . push ( tick ) ;
}
}
2021-02-24 10:42:01 +01:00
Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "d" ] ) ( true , el , this . name , JSON . stringify ( this . getValue ( ) ) , disabled ) ;
return Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "H" ] , {
2021-01-15 15:31:43 +01:00
onFocusin : this . onFocus ,
onFocusout : this . onBlur ,
2021-02-24 10:42:01 +01:00
"class" : Object ( _theme _ff3fc52f _js _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "c" ] ) ( this . color , ( _Object = { } , _defineProperty ( _Object , mode , true ) , _defineProperty ( _Object , 'in-item' , Object ( _theme _ff3fc52f _js _ _WEBPACK _IMPORTED _MODULE _3 _ _ [ "h" ] ) ( 'ion-item' , el ) ) , _defineProperty ( _Object , 'range-disabled' , disabled ) , _defineProperty ( _Object , 'range-pressed' , pressedKnob !== undefined ) , _defineProperty ( _Object , 'range-has-pin' , pin ) , _Object ) )
} , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "slot" , {
2021-01-15 15:31:43 +01:00
name : "start"
2021-02-24 10:42:01 +01:00
} ) , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "div" , {
2021-01-15 15:31:43 +01:00
"class" : "range-slider" ,
ref : function ref ( rangeEl ) {
2021-02-24 10:42:01 +01:00
return _this2 . rangeSlider = rangeEl ;
2021-01-15 15:31:43 +01:00
}
} , ticks . map ( function ( tick ) {
2021-02-24 10:42:01 +01:00
return Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "div" , {
2021-01-15 15:31:43 +01:00
style : tickStyle ( tick ) ,
role : "presentation" ,
"class" : {
'range-tick' : true ,
'range-tick-active' : tick . active
} ,
part : tick . active ? 'tick-active' : 'tick'
} ) ;
2021-02-24 10:42:01 +01:00
} ) , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "div" , {
2021-01-15 15:31:43 +01:00
"class" : "range-bar" ,
role : "presentation" ,
part : "bar"
2021-02-24 10:42:01 +01:00
} ) , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "div" , {
2021-01-15 15:31:43 +01:00
"class" : "range-bar range-bar-active" ,
role : "presentation" ,
style : barStyle ,
part : "bar-active"
} ) , renderKnob ( isRTL , {
knob : 'A' ,
pressed : pressedKnob === 'A' ,
value : this . valA ,
ratio : this . ratioA ,
pin : pin ,
disabled : disabled ,
handleKeyboard : handleKeyboard ,
min : min ,
max : max
} ) , this . dualKnobs && renderKnob ( isRTL , {
knob : 'B' ,
pressed : pressedKnob === 'B' ,
value : this . valB ,
ratio : this . ratioB ,
pin : pin ,
disabled : disabled ,
handleKeyboard : handleKeyboard ,
min : min ,
max : max
2021-02-24 10:42:01 +01:00
} ) ) , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "slot" , {
2021-01-15 15:31:43 +01:00
name : "end"
} ) ) ;
}
} , {
key : "el" ,
get : function get ( ) {
2021-02-24 10:42:01 +01:00
return Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "i" ] ) ( this ) ;
2021-01-15 15:31:43 +01:00
}
} ] , [ {
key : "watchers" ,
get : function get ( ) {
return {
"debounce" : [ "debounceChanged" ] ,
"min" : [ "minChanged" ] ,
"max" : [ "maxChanged" ] ,
"disabled" : [ "disabledChanged" ] ,
"value" : [ "valueChanged" ]
} ;
}
} ] ) ;
return Range ;
} ( ) ;
2021-02-24 10:42:01 +01:00
var renderKnob = function renderKnob ( isRTL , _ref3 ) {
var knob = _ref3 . knob ,
value = _ref3 . value ,
ratio = _ref3 . ratio ,
min = _ref3 . min ,
max = _ref3 . max ,
disabled = _ref3 . disabled ,
pressed = _ref3 . pressed ,
pin = _ref3 . pin ,
handleKeyboard = _ref3 . handleKeyboard ;
2021-01-15 15:31:43 +01:00
var start = isRTL ? 'right' : 'left' ;
var knobStyle = function knobStyle ( ) {
var style = { } ;
style [ start ] = "" . concat ( ratio * 100 , "%" ) ;
return style ;
} ;
2021-02-24 10:42:01 +01:00
return Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "div" , {
2021-01-15 15:31:43 +01:00
onKeyDown : function onKeyDown ( ev ) {
var key = ev . key ;
if ( key === 'ArrowLeft' || key === 'ArrowDown' ) {
handleKeyboard ( knob , false ) ;
ev . preventDefault ( ) ;
ev . stopPropagation ( ) ;
} else if ( key === 'ArrowRight' || key === 'ArrowUp' ) {
handleKeyboard ( knob , true ) ;
ev . preventDefault ( ) ;
ev . stopPropagation ( ) ;
}
} ,
"class" : {
'range-knob-handle' : true ,
'range-knob-a' : knob === 'A' ,
'range-knob-b' : knob === 'B' ,
'range-knob-pressed' : pressed ,
'range-knob-min' : value === min ,
'range-knob-max' : value === max
} ,
style : knobStyle ( ) ,
role : "slider" ,
tabindex : disabled ? - 1 : 0 ,
"aria-valuemin" : min ,
"aria-valuemax" : max ,
"aria-disabled" : disabled ? 'true' : null ,
"aria-valuenow" : value
2021-02-24 10:42:01 +01:00
} , pin && Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "div" , {
2021-01-15 15:31:43 +01:00
"class" : "range-pin" ,
role : "presentation" ,
part : "pin"
2021-02-24 10:42:01 +01:00
} , Math . round ( value ) ) , Object ( _index _e806d1f6 _js _ _WEBPACK _IMPORTED _MODULE _0 _ _ [ "h" ] ) ( "div" , {
2021-01-15 15:31:43 +01:00
"class" : "range-knob" ,
role : "presentation" ,
part : "knob"
} ) ) ;
} ;
var ratioToValue = function ratioToValue ( ratio , min , max , step ) {
var value = ( max - min ) * ratio ;
if ( step > 0 ) {
value = Math . round ( value / step ) * step + min ;
}
2021-02-24 10:42:01 +01:00
return Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "h" ] ) ( min , value , max ) ;
2021-01-15 15:31:43 +01:00
} ;
var valueToRatio = function valueToRatio ( value , min , max ) {
2021-02-24 10:42:01 +01:00
return Object ( _helpers _90f46169 _js _ _WEBPACK _IMPORTED _MODULE _2 _ _ [ "h" ] ) ( 0 , ( value - min ) / ( max - min ) , 1 ) ;
2021-01-15 15:31:43 +01:00
} ;
Range . style = {
ios : rangeIosCss ,
md : rangeMdCss
} ;
/***/
}
} ] ) ;
//# sourceMappingURL=25-es5.js.map