TP_JO2024/home/dist/component/range/range.module.min.js

4 lines
10 KiB
JavaScript
Raw Normal View History

2024-03-27 17:19:37 +01:00
/*! DSFR v1.11.2 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */
const t=window.dsfr,e={RANGE:t.internals.ns.selector("range"),RANGE_SM:t.internals.ns.selector("range--sm"),RANGE_STEP:t.internals.ns.selector("range--step"),RANGE_DOUBLE:t.internals.ns.selector("range--double"),RANGE_DOUBLE_STEP:t.internals.ns.selector("range--double")+t.internals.ns.selector("range--step"),RANGE_INPUT:t.internals.ns.selector("range input[type=range]:nth-of-type(1)"),RANGE_INPUT2:`${t.internals.ns.selector("range--double")} input[type=range]:nth-of-type(2)`,RANGE_OUTPUT:t.internals.ns.selector("range__output"),RANGE_MIN:t.internals.ns.selector("range__min"),RANGE_MAX:t.internals.ns.selector("range__max"),RANGE_PREFIX:t.internals.ns.attr("prefix"),RANGE_SUFFIX:t.internals.ns.attr("suffix")},s={VALUE:t.internals.ns.emission("range","value"),VALUE2:t.internals.ns.emission("range","value2"),OUTPUT:t.internals.ns.emission("range","output"),CONSTRAINTS:t.internals.ns.emission("range","constraints"),MIN:t.internals.ns.emission("range","min"),MAX:t.internals.ns.emission("range","max"),STEP:t.internals.ns.emission("range","step"),PREFIX:t.internals.ns.emission("range","prefix"),SUFFIX:t.internals.ns.emission("range","suffix"),DISABLED:t.internals.ns.emission("range","disabled"),ENABLE_POINTER:t.internals.ns.emission("range","enable_pointer")};class i{constructor(){this._width=0,this._min=0,this._max=0,this._value=0,this._thumbSize=24,this._innerWidth=0,this._prefix="",this._suffix="",this._background={}}configure(t){t&&(this._prefix=t._prefix,this._suffix=t._suffix,this._width=t.width,this.setConstraints(t._constraints),this.value=t.value,this.update())}setPrefix(t){this._prefix=null!==t?t:""}setSuffix(t){this._suffix=null!==t?t:""}_decorate(t){return`${this._prefix}${t}${this._suffix}`}get width(){return this._width}set width(t){this._width=t}get isSm(){return this._isSm}set isSm(t){this._isSm!==t&&(this._isSm=t,this.setThumbSize(t?16:24),this.update())}setThumbSize(t,e=1){this._thumbSize=t,this._innerPadding=t*e}get textValue(){return this._decorate(this._value)}get value(){return this._value}set value(t){this._value=t}get outputX(){return this._outputX}setConstraints(t){this._constraints=t,this._min=t.min,this._max=t.max,this._step=t.step,this._rangeWidth=t.rangeWidth}get min(){return this._min}get textMin(){return this._decorate(this._min)}get max(){return this._max}get textMax(){return this._decorate(this._max)}get step(){return this._step}get output(){return{text:this.textValue,transform:`translateX(${this._translateX}px) translateX(-${this._centerPercent}%)`}}_getRatio(t){return(t-this._min)/this._rangeWidth}get progress(){return this._progress}update(){this._update()}_update(){this._innerWidth=this._width-this._innerPadding;const t=this._getRatio(this._value);this._translateX=t*this._width,this._centerPercent=100*t,this._progress={right:`${(this._innerWidth*t+.5*this._innerPadding).toFixed(2)}px`}}}class n extends i{get stepWidth(){return`${this._stepWidth.toFixed(3)}px`}_update(){super._update();const t=this._rangeWidth/this._step;for(this._stepWidth=this._innerWidth/t;this._stepWidth<4;)this._stepWidth*=2}}class h extends i{get value2(){return this._value}set value2(t){this._value2!==t&&(this._value2=t,this.update())}get textValue(){return`${this._decorate(this._value)} - ${this._decorate(this._value2)}`}setThumbSize(t){super.setThumbSize(t,2)}_update(){super._update();const t=this._getRatio(.5*(this._value+this._value2));this._translateX=t*this._width,this._centerPercent=100*t;const e=this._getRatio(this._value),s=this._getRatio(this._value2);this._progress={left:`${(this._innerWidth*e+.25*this._innerPadding).toFixed(2)}px`,right:`${(this._innerWidth*s+.75*this._innerPadding).toFixed(2)}px`}}}class r extends h{get stepWidth(){return`${this._stepWidth.toFixed(3)}px`}_update(){super._update();const t=this._rangeWidth/this._step;this._stepWidth=this._innerWidth/t,this._stepWidth<4&&(this._stepWidth*=Math.ceil(4/this._stepWidth))}}const a="step",d="double",_="double-step",o="default";class l extends t.core.Instance{static get instanceClassName(){return"Range"}init(){this._retrieveType(),this._retrieveSiz
//# sourceMappingURL=range.module.min.js.map