{"version":3,"sources":["HicomSlider.ts"],"names":["HicomSlider","SLIDER_TYPE","Standard","Range","ORIENTATION","Horizontal","Vertical","DEFAULT_SLIDER_WIDTH","DEFAULT_SLIDER_HEIGHT","_slider","_sliderType","_orientation","_isReadOnly","_isDisabled","_id","constructor","slider","this","element","getAttribute","hasClass","_init","let","form","parents","hicomForm","HicomForm","attr","value","SetReadOnly","SetDisabled","bind","$element","$","e","sender","data","val","SetDirty","HicomDirtyForms","setDirtyStatus","resize","unit","orientation","wrapper","css"],"mappings":";MAGMA,YAKKC,mBAA8B,CACjCC,SAAU,WACVC,MAAO,O,EAOJC,mBAA8B,CACjCC,WAAY,aACZC,SAAU,U,EAONC,4BAAuC,GAMvCC,6BAAwC,IAKxCC,QAKAC,YAKAC,aAKAC,YAKAC,YAKAC,IAcRC,YAAYC,GACRC,KAAKR,QAAUO,EACfC,KAAKH,IAAME,EAAOE,QAAQ,GAAGC,aAAa,IAAI,EAC9CF,KAAKP,YAAcM,EAAOE,QAAQ,GAAGC,aAAa,kBAAkB,EACpEF,KAAKN,aAAeK,EAAOE,QAAQ,GAAGC,aAAa,kBAAkB,EACrEF,KAAKL,YAAcK,KAAKR,QAAQS,QAAQE,SAAS,gBAAgB,EACjEH,KAAKJ,YAAcI,KAAKR,QAAQS,QAAQE,SAAS,gBAAgB,EACjEH,KAAKI,MAAK,CACd,CAKQA,QAGJC,IAAIC,EAAON,KAAKR,QAAQS,QAAQM,QAAQ,MAAM,EAC9CF,IAAIG,EAAY,IAAIC,UAAUH,EAAKI,KAAK,IAAI,CAAC,EAGzCV,KAAKP,cAAgBV,YAAYC,YAAYE,OAC7Cc,KAAKR,QAAQS,QAAQS,KAAK,eAAgBV,KAAKR,QAAQmB,MAAK,CAAE,EAI9DX,KAAKL,aACLa,EAAUI,YAAY,CAACZ,KAAKH,IAAI,EAIhCG,KAAKJ,aACLY,EAAUK,YAAY,CAACb,KAAKH,IAAI,EAIpCG,KAAKR,QAAQsB,KAAK,SAAU,IACxBT,IAAIU,EAAWC,EAAEC,EAAEC,OAAOjB,OAAO,EAC7BU,EAAQI,EAASI,KAAK,aAAa,IAAMpC,YAAYC,YAAYC,SAAW8B,EAASK,IAAG,EAAQH,EAAEN,MAAM,GAAX,IAAiBM,EAAEN,MAAM,GAC1HH,EAAUa,SAAQ,EAClBC,gBAAgBC,eAAeR,EAAUJ,CAAK,CAClD,CAAC,CACL,CAQOa,OAAOb,EAAec,EAAe,IAAKC,EAAsB3C,YAAYI,YAAYC,YAC3F,OAAQsC,GACJ,KAAK3C,YAAYI,YAAYC,WACzBY,KAAKR,QAAQmC,QAAQC,IAAI,QAAS,GAAGjB,EAAQc,CAAM,EACnDzB,KAAKR,QAAQgC,OAAM,EACnB,MACJ,KAAKzC,YAAYI,YAAYE,SACzBW,KAAKR,QAAQmC,QAAQC,IAAI,SAAU,GAAGjB,EAAQc,CAAM,EACpDzB,KAAKR,QAAQgC,OAAM,CAI3B,CACJ","file":"HicomSlider.js","sourcesContent":["/**\r\n * Concrete implementation of Hicom slider\r\n */\r\nclass HicomSlider implements IHicomSlider {\r\n\r\n /**\r\n * The type of slider. This can be either a standard slider or a range slider\r\n */\r\n public static readonly SLIDER_TYPE = {\r\n Standard: 'standard',\r\n Range: 'range'\r\n }\r\n\r\n /**\r\n * Represents the orientation of the HicomSlider.\r\n * This can be used to determine the layout direction of the slider.\r\n */\r\n public static readonly ORIENTATION = {\r\n Horizontal: 'horizontal',\r\n Vertical: 'vertical'\r\n }\r\n\r\n /**\r\n * The default width of the slider in percentage. \r\n * This is used to resize the slider.\r\n */\r\n private static readonly DEFAULT_SLIDER_WIDTH = 40;\r\n\r\n /**\r\n * The default height of the slider in pixels. \r\n * This is used to resize the slider.\r\n */\r\n private static readonly DEFAULT_SLIDER_HEIGHT = 400;\r\n\r\n /**\r\n * Kendo slider instance. This can be either a standard slider or a range slider\r\n */\r\n private _slider: kendo.ui.Slider | kendo.ui.RangeSlider;\r\n\r\n /**\r\n * The type of slider. This can be either a standard slider or a range slider\r\n */\r\n private _sliderType: string;\r\n\r\n /**\r\n * The orientation of the slider\r\n */\r\n private _orientation: string;\r\n\r\n /**\r\n * The slider is read only\r\n */\r\n private _isReadOnly: Boolean;\r\n\r\n /**\r\n * The slider is disabled\r\n */\r\n private _isDisabled: Boolean;\r\n\r\n /**\r\n * The id of the slider\r\n */\r\n private _id: string;\r\n\r\n /**\r\n * Overloaded signatures for the constructor\r\n * @param standardSlider - Kendo standard slider\r\n * @param rangeSlider - Kendo range slider\r\n */\r\n constructor(standardSlider: kendo.ui.Slider);\r\n constructor(rangeSlider: kendo.ui.RangeSlider);\r\n\r\n /**\r\n * The constructor for the HicomSlider. This can be either a standard slider or a range slider\r\n * @param slider\r\n */\r\n constructor(slider: kendo.ui.Slider | kendo.ui.RangeSlider) {\r\n this._slider = slider;\r\n this._id = slider.element[0].getAttribute(\"id\");\r\n this._sliderType = slider.element[0].getAttribute(\"data-slider-type\");\r\n this._orientation = slider.element[0].getAttribute(\"data-orientation\");\r\n this._isReadOnly = this._slider.element.hasClass('hicom-readonly');\r\n this._isDisabled = this._slider.element.hasClass('hicom-disabled')\r\n this._init();\r\n }\r\n\r\n /**\r\n * Initialise the slider\r\n */\r\n private _init() {\r\n\r\n // Get the parent form element of the slider and create a new HicomForm instance with the form's id\r\n let form = this._slider.element.parents('form');\r\n let hicomForm = new HicomForm(form.attr('id'));\r\n\r\n // Set the original value of the range slider\r\n if (this._sliderType === HicomSlider.SLIDER_TYPE.Range) {\r\n this._slider.element.attr('data-df-orig', this._slider.value());\r\n }\r\n\r\n // Set slider to readonly\r\n if (this._isReadOnly) {\r\n hicomForm.SetReadOnly([this._id]);\r\n }\r\n\r\n // Set slider to disabled\r\n if (this._isDisabled) {\r\n hicomForm.SetDisabled([this._id]);\r\n }\r\n\r\n // Bind the change event to set the dirty status of the slider\r\n this._slider.bind(\"change\", (e) => {\r\n let $element = $(e.sender.element);\r\n let value = $element.data('slider-type') === HicomSlider.SLIDER_TYPE.Standard ? $element.val() : `${e.value[0]},${e.value[1]}`;\r\n hicomForm.SetDirty();\r\n HicomDirtyForms.setDirtyStatus($element, value);\r\n });\r\n }\r\n\r\n /**\r\n * Resize the slider\r\n * @param value - The value to resize the slider to.\r\n * @param unit - The unit of the value. Defaults to '%'. Other units can be used such as 'px'\r\n * @param orientation - The orientation of the slider. Defaults to 'Horizontal'.\r\n */\r\n public resize(value: Number, unit: string = '%', orientation: string = HicomSlider.ORIENTATION.Horizontal) {\r\n switch (orientation) {\r\n case HicomSlider.ORIENTATION.Horizontal:\r\n this._slider.wrapper.css(\"width\", `${value}${unit}`);\r\n this._slider.resize();\r\n break;\r\n case HicomSlider.ORIENTATION.Vertical:\r\n this._slider.wrapper.css(\"height\", `${value}${unit}`);\r\n this._slider.resize();\r\n break;\r\n default:\r\n break;\r\n }\r\n }\r\n}"]}