{"version":3,"sources":["webpack:///../../../../../src/.internal/plugins/rangeSelector/RangeSelectorCSS.ts","webpack:///../../../../../src/.internal/plugins/rangeSelector/RangeSelector.ts","webpack:///../../../../../src/.internal/plugins/rangeSelector/DateAxisRangeSelector.ts","webpack:///./plugins/rangeSelector.js"],"names":["rules","RangeSelector_RangeSelector","_super","RangeSelector","_this","call","this","_language","Disposer","_classPrefix","_defaultStyles","_elements","_position","_tabindex","className","_disposers","push","invalidate","applyTheme","Object","tslib_es6","prototype","validate","draw","defaultStyles","loadDefaultCSS","wrapper","document","createElement","classPrefix","position","container","appendChild","dispose","_disposed","_element","parentNode","removeChild","defineProperty","_container","value","prevPosition","dispatchImmediately","type","element","prefix","newPrefix","insertKeyIfEmpty","disposer","DOM","padding","margin-bottom","box-sizing","width","font-size","float","margin","max-width","display","removeKey","increment","RangeSelectorCSS","style","language","get","Language","_axis","set","events","on","ev","prepAxis","Validatable","Registry","registeredClasses","DateAxisRangeSelector_DateAxisRangeSelector","DateAxisRangeSelector","periodButtons","_inputDateFormat","zoomDelay","axis","updateRangeInputs","tabindex","rangeWrapper","fromTitle","innerHTML","translateAny","undefined","fromInput","setAttribute","toString","addEventListener","updateZoom","toTitle","toInput","periods","length","periodWrapper","periodTitle","utils_Array","period","button","name","setPeriodInterval","interval","formatter","dateFormatter","minZoomed","Time","mainBaseInterval","timeUnit","count","format","inputDateFormat","Date","maxZoomed","_zoomTimeout","clearTimeout","setTimeout","start","end","startDate","parse","endDate","zoomToDates","date","group","getGroupInterval","groupMin","min","groupMax","max","Type","groupingChanged","zoomFinished","once","baseInterval","keepSelection","zoom","getTime","_periods","_dateFormatter","DateFormatter","dateFormat","window","am4plugins_rangeSelector","rangeSelector_namespaceObject"],"mappings":";;;;;;;;;;;;;;;;;;;2SAKMA,EAAQ,cAAI,GCsDlBC,EAAA,SAAAC,GA4DC,SAAAC,IAAA,IAAAC,EACCF,EAAAG,KAAAC,OAAOA,YAnDEF,EAAAG,UAAY,IAAIC,EAAA,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,KAAKuI,eAAiBrG,EACtBlC,KAAKW,8CA8BNE,OAAAmB,eAAWsC,EAAAvD,UAAA,uBAUX,WACC,OAAIf,KAAKwE,iBACDxE,KAAKwE,iBAEJxE,KAAKoG,eAAiB0B,EAAA,SAAe9H,KAAKoG,cAAcqC,YACzDzI,KAAKoG,cAAcqC,WAGnB,kBAlBT,SAA2BvG,GACtBlC,KAAKwE,kBAAoBtC,IAC5BlC,KAAKwE,iBAAmBtC,EACxBlC,KAAKW,+CAmBR2D,EAnZA,CAA2C3E,GA2Z3CwE,EAAA,EAASC,kBAAyC,sBAAIC,ECvetDqE,OAAAC,yBAAkCC","file":"./plugins/rangeSelector.js","sourcesContent":["import { StyleRule } from \"../../core/utils/DOM\";\r\n//import { InterfaceColorSet } from \"../../core/utils/InterfaceColorSet\";\r\nimport { Dictionary } from \"../../core/utils/Dictionary\";\r\nimport { MultiDisposer, IDisposer, CounterDisposer } from \"../../core/utils/Disposer\";\r\n\r\nconst rules = new Dictionary();\r\n\r\n/**\r\n * A dynamically-loadable CSS module for Export menu.\r\n *\r\n * @ignore Exclude from docs\r\n * @param prefix Prefix to addtach to class names\r\n * @return A MultiDisposer with style rules\r\n */\r\nexport default function (element: ShadowRoot | null, prefix?: string): IDisposer {\r\n\tconst newPrefix = (prefix ? prefix : \"amstock-dataset-selector\");\r\n\r\n\t//let colorSet = new InterfaceColorSet();\r\n\r\n\tconst counter = rules.insertKeyIfEmpty(newPrefix, () => {\r\n\t\tconst disposer = new MultiDisposer([\r\n\r\n\t\t\t// === Common ===========================================================\r\n\r\n\t\t\tnew StyleRule(element, `.${newPrefix}-wrapper`, {\r\n\t\t\t\t\"padding\": \"0.2em 1em 0 0.4em\",\r\n\t\t\t\t\"margin-bottom\": \"1em\"\r\n\t\t\t}),\r\n\r\n\t\t\tnew StyleRule(element, `.${newPrefix}-wrapper *`, {\r\n\t\t\t\t\"box-sizing\": \"border-box\"\r\n\t\t\t}),\r\n\r\n\t\t\tnew StyleRule(element, `.${newPrefix}-wrapper input`, {\r\n\t\t\t\t\"width\": \"100%\",\r\n\t\t\t\t//\"padding\": \"0.1em 0.2em\",\r\n\t\t\t\t\"font-size\": \"inherit\"\r\n\t\t\t}),\r\n\r\n\t\t\t// === Horizontal positions =============================================\r\n\r\n\t\t\tnew StyleRule(element, `.${newPrefix}-top .${newPrefix}-range-wrapper, .${newPrefix}-bottom .${newPrefix}-range-wrapper`, {\r\n\t\t\t\t\"float\": \"left\"\r\n\t\t\t}),\r\n\r\n\t\t\tnew StyleRule(element, `.${newPrefix}-top .${newPrefix}-period-wrapper, .${newPrefix}-bottom .${newPrefix}-period-wrapper`, {\r\n\t\t\t\t\"float\": \"right\"\r\n\t\t\t}),\r\n\r\n\t\t\tnew StyleRule(element, `.${newPrefix}-top input, .${newPrefix}-bottom input`, {\r\n\t\t\t\t\"margin\": \"0 1em 0 0.3em\",\r\n\t\t\t\t\"max-width\": \"100px\"\r\n\t\t\t}),\r\n\r\n\t\t\tnew StyleRule(element, `.${newPrefix}-top button, .${newPrefix}-bottom button`, {\r\n\t\t\t\t\"margin\": \"0 0 0 0.4em\"\r\n\t\t\t}),\r\n\r\n\t\t\t// === Vertical positions ===============================================\r\n\r\n\t\t\tnew StyleRule(element, `.${newPrefix}-left .${newPrefix}-title, .${newPrefix}-right .${newPrefix}-title`, {\r\n\t\t\t\t\"display\": \"block\"\r\n\t\t\t}),\r\n\r\n\t\t\tnew StyleRule(element, `.${newPrefix}-left input, .${newPrefix}-right input`, {\r\n\t\t\t\t\"width\": \"100%\",\r\n\t\t\t\t\"margin\": \"0.2em 0 0.6em 0\"\r\n\t\t\t}),\r\n\r\n\t\t\tnew StyleRule(element, `.${newPrefix}-left button, .${newPrefix}-right button`, {\r\n\t\t\t\t\"width\": \"25%\",\r\n\t\t\t\t\"margin\": \"0.2em 0.2em 0.2em 0\"\r\n\t\t\t}),\r\n\r\n\t\t]);\r\n\r\n\t\treturn new CounterDisposer(() => {\r\n\t\t\trules.removeKey(newPrefix);\r\n\t\t\tdisposer.dispose();\r\n\t\t});\r\n\t});\r\n\r\n\treturn counter.increment();\r\n}\r\n\n\n\n// WEBPACK FOOTER //\n// ../../../../../src/.internal/plugins/rangeSelector/RangeSelectorCSS.ts","/**\r\n * Base class for axis range selector classes.\r\n */\r\n\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { Axis } from \"../../charts/axes/Axis\";\r\nimport { AxisRenderer } from \"../../charts/axes/AxisRenderer\";\r\nimport { Validatable, IValidatableEvents } from \"../../core/utils/Validatable\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { MutableValueDisposer } from \"../../core/utils/Disposer\";\r\nimport { Language } from \"../../core/utils/Language\";\r\nimport selectorCSS from \"./RangeSelectorCSS\";\r\nimport * as $dom from \"../../core/utils/DOM\";\r\nimport * as $type from \"../../core/utils/Type\";\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Defines events for [[RangeSelector]].\r\n */\r\nexport interface IRangeSelectorEvents extends IValidatableEvents {\r\n\r\n\t/**\r\n\t * Invoked when position of the control changes.\r\n\t */\r\n\tpositionset: {\r\n\t\tprevPosition: \"top\" | \"bottom\" | \"left\" | \"right\";\r\n\t\tposition: \"top\" | \"bottom\" | \"left\" | \"right\";\r\n\t}\r\n\r\n\t/**\r\n\t * Invoked when control is drawn.\r\n\t */\r\n\tdrawn: {}\r\n\r\n}\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * A base class for axis-specific range selectors.\r\n */\r\nexport class RangeSelector extends Validatable {\r\n\r\n\t/**\r\n\t * Defines available events.\r\n\t */\r\n\tpublic _events!: IRangeSelectorEvents;\r\n\r\n\t/**\r\n\t * An instance of [[Language]].\r\n\t */\r\n\tprotected _language = new MutableValueDisposer();\r\n\r\n\t/**\r\n\t * Reference to DOM element that holds the control element.\r\n\t */\r\n\tprotected _container: $type.Optional;\r\n\r\n\t/**\r\n\t * Control element.\r\n\t */\r\n\tprotected _element: $type.Optional;\r\n\r\n\t/**\r\n\t * Prefix for class names applied to control elements.\r\n\t */\r\n\tprotected _classPrefix: string = \"amcharts-range-selector\";\r\n\r\n\t/**\r\n\t * If set to `true` [[RangeSelector]] will load it's own external CSS when\r\n\t * instantiated.\r\n\t */\r\n\tprotected _defaultStyles: boolean = true;\r\n\r\n\t/**\r\n\t * Holds references to various HTML elements control consists of.\r\n\t */\r\n\tprotected _elements: {\r\n\t\twrapper?: HTMLElement;\r\n\t} = {};\r\n\r\n\t/**\r\n\t * Position of the selector.\r\n\t */\r\n\tprotected _position: \"top\" | \"bottom\" | \"left\" | \"right\" = \"bottom\";\r\n\r\n\t/**\r\n\t * A tabindex to apply to control.\r\n\t */\r\n\tprotected _tabindex: number = 0;\r\n\r\n\t/**\r\n\t * Reference to target axis.\r\n\t * \r\n\t * @ignore\r\n\t */\r\n\tpublic _axis: Axis;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.className = \"RangeSelector\";\r\n\t\tthis._disposers.push(this._language);\r\n\t\tthis.invalidate();\r\n\t\tthis.applyTheme();\r\n\t}\r\n\r\n\t/**\r\n\t * (Re)draws the control.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t */\r\n\tpublic validate(): void {\r\n\t\tthis.draw();\r\n\t\tsuper.validate();\r\n\t}\r\n\r\n\t/**\r\n\t * Draws the control.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic draw(): void {\r\n\r\n\t\tif (this.defaultStyles) {\r\n\t\t\tthis.loadDefaultCSS();\r\n\t\t}\r\n\r\n\t\t// Selector wrapper\r\n\t\tif (!this._elements.wrapper) {\r\n\t\t\tthis._elements.wrapper = document.createElement(\"div\");\r\n\t\t\tthis._elements.wrapper.className = this.classPrefix + \"-wrapper \" + this.classPrefix + \"-\" + this.position;\r\n\t\t\tthis.container.appendChild(this._elements.wrapper);\r\n\t\t}\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Destroys the control and all its elements.\r\n\t */\r\n\tpublic dispose(): void {\r\n\t\tif (!this._disposed) {\r\n\t\t\tsuper.dispose();\r\n\r\n\t\t\tif (this._element && this._element.parentNode) {\r\n\t\t\t\tthis._element.parentNode.removeChild(this._element);\r\n\t\t\t}\r\n\r\n\t\t\tif (this._elements.wrapper && this._elements.wrapper.parentNode) {\r\n\t\t\t\tthis._elements.wrapper.parentNode.removeChild(this._elements.wrapper);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Getters and setters\r\n\t */\r\n\r\n\t/**\r\n\t * An HTML container to place the control in.\r\n\t *\r\n\t * A container must be an HTML element, because the control itself is HTML, and\r\n\t * cannot be placed into SVG.\r\n\t *\r\n\t * @param container Reference to container element\r\n\t */\r\n\tpublic set container(container: $type.Optional) {\r\n\t\tthis._container = container;\r\n\t\tthis.invalidate();\r\n\t}\r\n\r\n\t/**\r\n\t * @return Container\r\n\t */\r\n\tpublic get container(): $type.Optional {\r\n\t\treturn this._container;\r\n\t}\r\n\r\n\t/**\r\n\t * Position of the selector.\r\n\t *\r\n\t * Available options: `\"top\"`, `\"bottom\"`, `\"left\"` (default), and `\"right\"`.\r\n\t *\r\n\t * NOTE: since the control is always placed in the external container, this\r\n\t * setting does actually affect where the control is placed but rather\r\n\t * default CSS that affects how specific elements are arranged.\r\n\t *\r\n\t * For example, when setting position to `\"top\"` or `\"bottom\"`, the control\r\n\t * will be arranged in a horizontal fashion.\r\n\t *\r\n\t * Similarly, for `\"left\"` and `\"right\"` the control will arrange itself\r\n\t * vertically, which is more suitable for narrow containers.\r\n\t *\r\n\t * @default \"left\"\r\n\t * @param value Position\r\n\t */\r\n\tpublic set position(value: \"top\" | \"bottom\" | \"left\" | \"right\") {\r\n\t\tif (this._position != value) {\r\n\t\t\tconst prevPosition = this._position;\r\n\t\t\tthis._position = value;\r\n\t\t\tthis.dispatchImmediately(\"positionset\", {\r\n\t\t\t\ttype: \"positionset\",\r\n\t\t\t\tposition: value,\r\n\t\t\t\tprevPosition: prevPosition\r\n\t\t\t});\r\n\t\t\tthis.invalidate();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Position\r\n\t */\r\n\tpublic get position(): \"top\" | \"bottom\" | \"left\" | \"right\" {\r\n\t\treturn this._position;\r\n\t}\r\n\r\n\t/**\r\n\t * Indicates whether [[RangeSelector]] should load external CSS to style\r\n\t * itself.\r\n\t *\r\n\t * If set to `false`, the elements will not be styled, and will rely on some\r\n\t * external CSS.\r\n\t *\r\n\t * @default true\r\n\t * @param Should RangeSelector load its own CSS?\r\n\t */\r\n\tpublic set defaultStyles(value: boolean) {\r\n\t\tif (this._defaultStyles != value) {\r\n\t\t\tthis._defaultStyles = value;\r\n\t\t\tif (value) {\r\n\t\t\t\tthis.loadDefaultCSS();\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.invalidate();\r\n\t}\r\n\r\n\t/**\r\n\t * @return Should RangeSelector load its own CSS?\r\n\t */\r\n\tpublic get defaultStyles(): boolean {\r\n\t\treturn this._defaultStyles\r\n\t}\r\n\r\n\t/**\r\n\t * Loads the default CSS.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t */\r\n\tpublic loadDefaultCSS(): void {\r\n\t\tthis._disposers.push(selectorCSS($dom.getShadowRoot(this.container), this.classPrefix));\r\n\r\n\t\tif (this._element) {\r\n\t\t\tthis._element.style.display = \"\";\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * A tab index for the menu.\r\n\t *\r\n\t * Tab index will influence the order in which elements on the chart and\r\n\t * the whole page are selected when pressing TAB key.\r\n\t *\r\n\t * @param value Tab index\r\n\t */\r\n\tpublic set tabindex(value: number) {\r\n\t\tthis._tabindex = value;\r\n\t\tthis.invalidate();\r\n\t}\r\n\r\n\t/**\r\n\t * @return Tab index\r\n\t */\r\n\tpublic get tabindex(): number {\r\n\t\treturn this._tabindex;\r\n\t}\r\n\r\n\t/**\r\n\t * A [[Language]] instance.\r\n\t *\r\n\t * @param value An instance of [[Language]]\r\n\t */\r\n\tpublic set language(value: Language) {\r\n\t\tthis._language.set(value, value.events.on(\"localechanged\", (ev) => {\r\n\t\t\tthis.invalidate();\r\n\t\t}));\r\n\t\tthis.invalidate();\r\n\t}\r\n\r\n\t/**\r\n\t * @return A [[Language]] instance to be used\r\n\t */\r\n\tpublic get language(): Language {\r\n\t\tlet language = this._language.get();\r\n\r\n\t\tif (language == null) {\r\n\t\t\tlanguage = new Language();\r\n\r\n\t\t\t// Maybe use one from axis?\r\n\t\t\tif (this._axis) {\r\n\t\t\t\treturn this._axis.language;\r\n\t\t\t}\r\n\r\n\t\t\t// TODO code duplication with `set language()`\r\n\t\t\tthis._language.set(language, language.events.on(\"localechanged\", (ev) => {\r\n\t\t\t\tthis.invalidate();\r\n\t\t\t}));\r\n\t\t}\r\n\r\n\t\treturn language;\r\n\t}\r\n\r\n\t/**\r\n\t * Class name prefix.\r\n\t *\r\n\t * @default \"amexport\"\r\n\t * @param value Class name prefix\r\n\t */\r\n\tpublic set classPrefix(value: string) {\r\n\t\tthis._classPrefix = value;\r\n\t\tthis.invalidate();\r\n\t}\r\n\r\n\t/**\r\n\t * @return Class name prefix\r\n\t */\r\n\tpublic get classPrefix(): string {\r\n\t\treturn this._classPrefix;\r\n\t}\r\n\r\n\t/**\r\n\t * A target axis to use range selector for.\r\n\t * \r\n\t * @param value Axis\r\n\t */\r\n\tpublic set axis(value: this[\"_axis\"]) {\r\n\t\tif (this._axis != value) {\r\n\t\t\tthis._axis = value;\r\n\t\t\tthis.prepAxis();\r\n\t\t\tthis.language = value.language;\r\n\t\t\tthis.invalidate();\r\n\t\t}\r\n\t}\r\n\r\n\tprotected prepAxis(): void {\r\n\t\tif (this._axis) {\r\n\t\t\tthis._disposers.push(this._axis.events.on(\"beforedisposed\", (ev) => {\r\n\t\t\t\tthis.dispose();\r\n\t\t\t}));\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Axis\r\n\t */\r\n\tpublic get axis(): this[\"_axis\"] {\r\n\t\treturn this._axis;\r\n\t}\r\n\r\n\r\n}\r\n\r\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\r\nregistry.registeredClasses[\"RangeSelector\"] = RangeSelector;\n\n\n// WEBPACK FOOTER //\n// ../../../../../src/.internal/plugins/rangeSelector/RangeSelector.ts","/**\r\n * Range selector for [[DateAxis]].\r\n */\r\n\r\n/**\r\n * ============================================================================\r\n * IMPORTS\r\n * ============================================================================\r\n * @hidden\r\n */\r\nimport { RangeSelector, IRangeSelectorEvents } from \"./RangeSelector\";\r\nimport { registry } from \"../../core/Registry\";\r\nimport { DateAxis } from \"../../charts/axes/DateAxis\";\r\nimport { AxisRenderer } from \"../../charts/axes/AxisRenderer\";\r\nimport { ITimeInterval } from \"../../core/defs/ITimeInterval\";\r\nimport { DateFormatter } from \"../../core/formatters/DateFormatter\";\r\nimport * as $time from \"../../core/utils/Time\";\r\nimport * as $type from \"../../core/utils/Type\";\r\nimport * as $array from \"../../core/utils/Array\";\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * REQUISITES\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\nexport interface IDateAxisRangeSelectorPeriod {\r\n\tname: string;\r\n\tinterval: ITimeInterval | \"ytd\" | \"max\";\r\n}\r\n\r\n/**\r\n * Defines events for [[RangeSelector]].\r\n */\r\nexport interface IDateAxisRangeSelectorEvents extends IRangeSelectorEvents {\r\n\r\n\t/**\r\n\t * Invoked when pre-defined period is selected (button clicked).\r\n\t * \r\n\t * @since 4.10.3\r\n\t */\r\n\tperiodselected: {\r\n\t\tinterval: ITimeInterval;\r\n\t\tstartDate: Date;\r\n\t}\r\n\r\n}\r\n\r\n\r\n/**\r\n * ============================================================================\r\n * MAIN CLASS\r\n * ============================================================================\r\n * @hidden\r\n */\r\n\r\n/**\r\n * Creates a control used to select date range and preset periods for\r\n * a [[DateAxis]].\r\n *\r\n * ```TypeScript\r\n * let selector = new am4plugins_rangeSelector.DateAxisRangeSelector()\r\n * selector.container = document.getElementById(\"selectordiv\");\r\n * selector.axis = chart.xAxes.getIndex(0);\r\n * ```\r\n * ```JavaScript\r\n * var selector = new am4plugins_rangeSelector.DateAxisRangeSelector()\r\n * selector.container = document.getElementById(\"selectordiv\");\r\n * selector.axis = chart.xAxes.getIndex(0);\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/tutorials/plugin-range-selector/} for more information on how to use this plugin\r\n * @important\r\n * @todo JSON example\r\n */\r\nexport class DateAxisRangeSelector extends RangeSelector {\r\n\r\n\t/**\r\n\t * Defines available events.\r\n\t */\r\n\tpublic _events!: IDateAxisRangeSelectorEvents;\r\n\r\n\t/**\r\n\t * Reference to target axis.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic _axis: DateAxis;\r\n\r\n\t/**\r\n\t * Holds references to various HTML elements control consists of.\r\n\t */\r\n\tprotected _elements: {\r\n\t\twrapper?: HTMLElement;\r\n\t\trangeWrapper?: HTMLElement;\r\n\t\tfromTitle?: HTMLElement;\r\n\t\tfromInput?: HTMLInputElement;\r\n\t\ttoTitle?: HTMLElement;\r\n\t\ttoInput?: HTMLInputElement;\r\n\t\tperiodWrapper?: HTMLElement;\r\n\t\tperiodTitle?: HTMLElement;\r\n\t\tperiodButtons?: HTMLElement[];\r\n\t} = {\r\n\t\t\tperiodButtons: []\r\n\t\t};\r\n\r\n\t/**\r\n\t * List of pre-defined period buttons.\r\n\t */\r\n\tprotected _periods: IDateAxisRangeSelectorPeriod[];\r\n\r\n\t/**\r\n\t * Date format to use for input fields.\r\n\t */\r\n\tprotected _inputDateFormat = \"yyyy-MM-dd\";\r\n\r\n\t/**\r\n\t * Date formatter.\r\n\t */\r\n\tprotected _dateFormatter: DateFormatter;\r\n\r\n\t/**\r\n\t * Timeout to use to delay zooming of axis (so it does not happen on\r\n\t * every keystroke in input fields).\r\n\t */\r\n\tprivate _zoomTimeout: any;\r\n\r\n\t/**\r\n\t * Number of milliseconds to wait after last keystroke in date input field\r\n\t * before zooming the axis.\r\n\t *\r\n\t * @default 500\r\n\t */\r\n\tpublic zoomDelay: number = 500;\r\n\r\n\t/**\r\n\t * Constructor\r\n\t */\r\n\tconstructor() {\r\n\t\tsuper();\r\n\t\tthis.className = \"DateAxisRangeSelector\";\r\n\t\tthis._disposers.push(this._language);\r\n\t\tthis.invalidate();\r\n\t\tthis.applyTheme();\r\n\t}\r\n\r\n\t/**\r\n\t * (Re)draws the control.\r\n\t *\r\n\t * @ignore Exclude from docs\r\n\t */\r\n\tpublic validate(): void {\r\n\t\tthis.draw();\r\n\t\tsuper.validate();\r\n\t}\r\n\r\n\t/**\r\n\t * Adds events to the axis.\r\n\t */\r\n\tprotected prepAxis(): void {\r\n\t\tsuper.prepAxis();\r\n\t\tthis._disposers.push(this.axis.events.on(\"selectionextremeschanged\", (ev) => {\r\n\t\t\tthis.updateRangeInputs();\r\n\t\t}));\r\n\t\tthis._disposers.push(this.axis.events.on(\"extremeschanged\", (ev) => {\r\n\t\t\tthis.updateRangeInputs();\r\n\t\t}));\r\n\t}\r\n\r\n\t/**\r\n\t * Draws the control.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic draw(): void {\r\n\r\n\t\tsuper.draw();\r\n\r\n\t\tconst tabindex = this.tabindex;\r\n\r\n\t\t// Range wrapper\r\n\t\tif (!this._elements.rangeWrapper) {\r\n\t\t\tthis._elements.rangeWrapper = document.createElement(\"div\");\r\n\t\t\tthis._elements.rangeWrapper.className = this.classPrefix + \"-range-wrapper\";\r\n\t\t\tthis._elements.wrapper.appendChild(this._elements.rangeWrapper);\r\n\t\t}\r\n\r\n\t\t// From title\r\n\t\tif (!this._elements.fromTitle) {\r\n\t\t\tthis._elements.fromTitle = document.createElement(\"span\");\r\n\t\t\tthis._elements.fromTitle.className = this.classPrefix + \"-title \" + this.classPrefix + \"-from-title\";\r\n\t\t\tthis._elements.fromTitle.innerHTML = this.language.translateAny(\"From %1\", undefined, \"\");\r\n\t\t\tthis._elements.rangeWrapper.appendChild(this._elements.fromTitle);\r\n\t\t}\r\n\r\n\t\t// From input\r\n\t\tif (!this._elements.fromInput) {\r\n\t\t\tthis._elements.fromInput = document.createElement(\"input\");\r\n\t\t\tthis._elements.fromInput.type = \"text\";\r\n\t\t\tthis._elements.fromInput.className = this.classPrefix + \"-from-input\";\r\n\r\n\t\t\tif (tabindex) {\r\n\t\t\t\tthis._elements.fromInput.setAttribute(\"tabindex\", tabindex.toString());\r\n\t\t\t}\r\n\r\n\t\t\tthis._elements.rangeWrapper.appendChild(this._elements.fromInput);\r\n\r\n\t\t\tthis._elements.fromInput.addEventListener(\"keyup\", () => {\r\n\t\t\t\tthis.updateZoom()\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// To title\r\n\t\tif (!this._elements.toTitle) {\r\n\t\t\tthis._elements.toTitle = document.createElement(\"span\");\r\n\t\t\tthis._elements.toTitle.className = this.classPrefix + \"-title \" + this.classPrefix + \"-to-title\";\r\n\t\t\tthis._elements.toTitle.innerHTML = this.language.translateAny(\"To %1\", undefined, \"\");\r\n\t\t\tthis._elements.rangeWrapper.appendChild(this._elements.toTitle);\r\n\t\t}\r\n\r\n\t\t// To input\r\n\t\tif (!this._elements.toInput) {\r\n\t\t\tthis._elements.toInput = document.createElement(\"input\");\r\n\t\t\tthis._elements.toInput.type = \"text\";\r\n\t\t\tthis._elements.toInput.className = this.classPrefix + \"-to-input\";\r\n\t\t\tif (tabindex) {\r\n\t\t\t\tthis._elements.toInput.setAttribute(\"tabindex\", tabindex.toString());\r\n\t\t\t}\r\n\t\t\tthis._elements.rangeWrapper.appendChild(this._elements.toInput);\r\n\r\n\t\t\tthis._elements.toInput.addEventListener(\"keyup\", () => {\r\n\t\t\t\tthis.updateZoom()\r\n\t\t\t});\r\n\t\t}\r\n\r\n\t\t// Period buttons\r\n\t\tif (this.periods.length) {\r\n\r\n\t\t\t// period wrapper\r\n\t\t\tif (!this._elements.periodWrapper) {\r\n\t\t\t\tthis._elements.periodWrapper = document.createElement(\"div\");\r\n\t\t\t\tthis._elements.periodWrapper.className = this.classPrefix + \"-period-wrapper\";\r\n\t\t\t\tthis._elements.wrapper.appendChild(this._elements.periodWrapper);\r\n\r\n\r\n\t\t\t\t// Period title\r\n\t\t\t\tif (!this._elements.periodTitle) {\r\n\t\t\t\t\tthis._elements.periodTitle = document.createElement(\"span\");\r\n\t\t\t\t\tthis._elements.periodTitle.className = this.classPrefix + \"-title \" + this.classPrefix + \"-period-title\";\r\n\t\t\t\t\tthis._elements.periodTitle.innerHTML = this.language.translateAny(\"Zoom\");\r\n\t\t\t\t\tthis._elements.periodWrapper.appendChild(this._elements.periodTitle);\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// Period buttons\r\n\t\t\t\t$array.each(this.periods, (period) => {\r\n\t\t\t\t\tconst button = document.createElement(\"button\");\r\n\t\t\t\t\tbutton.className = this.classPrefix + \"-period-button\";\r\n\t\t\t\t\tbutton.innerHTML = period.name;\r\n\t\t\t\t\tif (tabindex) {\r\n\t\t\t\t\t\tbutton.setAttribute(\"tabindex\", tabindex.toString());\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis._elements.periodButtons.push(button);\r\n\t\t\t\t\tthis._elements.periodWrapper.appendChild(button);\r\n\r\n\t\t\t\t\tbutton.addEventListener(\"click\", () => {\r\n\t\t\t\t\t\tthis.setPeriodInterval(period.interval);\r\n\t\t\t\t\t});\r\n\r\n\t\t\t\t});\r\n\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tthis.dispatchImmediately(\"drawn\", {\r\n\t\t\ttype: \"drawn\"\r\n\t\t});\r\n\r\n\r\n\t\tthis.updateRangeInputs();\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * Updates input values based on the current zoom selection of the axis.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic updateRangeInputs(): void {\r\n\t\tif (this._elements.fromInput && this._elements.toInput && this.axis) {\r\n\t\t\tconst axis = this.axis;\r\n\t\t\tconst formatter = this.dateFormatter;\r\n\t\t\tconst minZoomed = axis.minZoomed + $time.getDuration(axis.mainBaseInterval.timeUnit, axis.mainBaseInterval.count) * 0.5;\r\n\t\t\tthis._elements.fromInput.value = formatter.format(minZoomed, this.inputDateFormat);\r\n\t\t\tthis._elements.toInput.value = formatter.format(new Date(axis.maxZoomed), this.inputDateFormat);\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * Zooms axis according to input fields.\r\n\t *\r\n\t * @ignore\r\n\t */\r\n\tpublic updateZoom(): void {\r\n\t\tif (this._zoomTimeout) {\r\n\t\t\tclearTimeout(this._zoomTimeout);\r\n\t\t}\r\n\t\tthis._zoomTimeout = setTimeout(() => {\r\n\t\t\tlet start = this._elements.fromInput.value;\r\n\t\t\tlet end = this._elements.toInput.value;\r\n\t\t\tif ((start.length < this.inputDateFormat.length) || (end.length < this.inputDateFormat.length)) {\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tlet startDate = this.dateFormatter.parse(start, this.inputDateFormat);\r\n\t\t\tlet endDate = this.dateFormatter.parse(end, this.inputDateFormat);\r\n\r\n\t\t\tif (startDate && endDate) {\r\n\t\t\t\tthis.axis.zoomToDates(startDate, endDate);\r\n\t\t\t}\r\n\t\t}, this.zoomDelay);\r\n\t}\r\n\r\n\t/**\r\n\t * Zooms the axis to a preset time interal or `\"ytd\"` or `\"max\"`.\r\n\t * \r\n\t * @param interval Interval\r\n\t */\r\n\tpublic setPeriodInterval(interval: ITimeInterval | \"ytd\" | \"max\"): void {\r\n\t\tlet date;\r\n\t\tconst group = this.getGroupInterval(this.axis.mainBaseInterval);\r\n\t\tif (interval == \"max\") {\r\n\t\t\tdate = new Date(this.axis.groupMin[group] || this.axis.min);\r\n\t\t}\r\n\t\telse if (interval == \"ytd\") {\r\n\t\t\tdate = new Date(this.axis.groupMax[group] || this.axis.max);\r\n\t\t\t$time.round(date, \"year\", 1);\r\n\t\t}\r\n\t\telse if ($type.isObject(interval)) {\r\n\t\t\tdate = new Date(this.axis.groupMax[group] || this.axis.max);\r\n\t\t\t$time.add(date, interval.timeUnit, -1 * interval.count);\r\n\t\t}\r\n\r\n\t\tif (date) {\r\n\t\t\tthis.zoomToDates(date);\r\n\t\t}\r\n\r\n\t\tlet groupingChanged = false;\r\n\t\tlet zoomFinished = false;\r\n\r\n\t\tthis.axis.events.once(\"groupperiodchanged\", (ev) => {\r\n\t\t\tgroupingChanged = true;\r\n\t\t\tif (zoomFinished) {\r\n\t\t\t\tthis.setPeriodInterval(interval);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tthis.axis.events.once(\"rangechangeended\", (ev) => {\r\n\t\t\tzoomFinished = true;\r\n\t\t\tif (groupingChanged) {\r\n\t\t\t\tthis.setPeriodInterval(interval);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tthis.dispatchImmediately(\"periodselected\", {\r\n\t\t\tinterval: interval,\r\n\t\t\tstartDate: date\r\n\t\t});\r\n\t}\r\n\r\n\tprivate getGroupInterval(interval: ITimeInterval): string {\r\n\t\treturn interval.timeUnit + interval.count;\r\n\t}\r\n\r\n\t/**\r\n\t * Zooms the axis using start date.\r\n\t * \r\n\t * @param date Start date\r\n\t */\r\n\tpublic zoomToDates(date: Date): void {\r\n\t\tconst axis = this.axis;\r\n\t\tconst group = this.getGroupInterval(axis.baseInterval);\r\n\t\tconst min = axis.groupMin[group] || axis.min;\r\n\t\tconst max = axis.groupMax[group] || axis.max;\r\n\t\taxis.keepSelection = true;\r\n\t\taxis.zoom({ start: (date.getTime() - min) / (max - min), end: 1 });\r\n\t}\r\n\r\n\t/**\r\n\t * Getters and setters\r\n\t */\r\n\r\n\t/**\r\n\t * A list of pre-defined periods to show buttons for.\r\n\t * \r\n\t * @param value Periods\r\n\t */\r\n\tpublic set periods(value: IDateAxisRangeSelectorPeriod[]) {\r\n\t\tthis._periods = value;\r\n\t\tthis.invalidate();\r\n\t}\r\n\r\n\t/**\r\n\t * @return Periods\r\n\t */\r\n\tpublic get periods(): IDateAxisRangeSelectorPeriod[] {\r\n\t\tif (!this._periods) {\r\n\t\t\tthis._periods = [\r\n\t\t\t\t{ name: this.language.translateAny(\"%1M\", undefined, \"1\"), interval: { timeUnit: \"month\", count: 1 } },\r\n\t\t\t\t{ name: this.language.translateAny(\"%1M\", undefined, \"3\"), interval: { timeUnit: \"month\", count: 3 } },\r\n\t\t\t\t{ name: this.language.translateAny(\"%1M\", undefined, \"6\"), interval: { timeUnit: \"month\", count: 6 } },\r\n\t\t\t\t{ name: this.language.translateAny(\"%1Y\", undefined, \"1\"), interval: { timeUnit: \"year\", count: 1 } },\r\n\t\t\t\t{ name: this.language.translateAny(\"YTD\"), interval: \"ytd\" },\r\n\t\t\t\t{ name: this.language.translateAny(\"MAX\"), interval: \"max\" },\r\n\t\t\t]\r\n\t\t}\r\n\t\treturn this._periods;\r\n\t}\r\n\r\n\t/**\r\n\t * A [[DateFormatter]] instance to use.\r\n\t *\r\n\t * If not set, control will inherit one from the target axis.\r\n\t *\r\n\t * @param value Formatter\r\n\t */\r\n\tpublic set dateFormatter(value: DateFormatter) {\r\n\t\tthis._dateFormatter = value;\r\n\t\tthis.invalidate();\r\n\t}\r\n\r\n\t/**\r\n\t * @return Formatter\r\n\t */\r\n\tpublic get dateFormatter(): DateFormatter {\r\n\t\tif (!this._dateFormatter) {\r\n\r\n\t\t\t// Maybe use one from axis?\r\n\t\t\tif (this._axis) {\r\n\t\t\t\tthis._dateFormatter = this._axis.dateFormatter;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tthis._dateFormatter = new DateFormatter();\r\n\t\t\t\tthis._disposers.push(this._dateFormatter);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn this._dateFormatter;\r\n\t}\r\n\r\n\t/**\r\n\t * An format to use for the date input fields.\r\n\t *\r\n\t * If not set, it will use `dateFormat` from the [[DateFormatter]] object.\r\n\t *\r\n\t * @default \"yyyy-MM-dd\"\r\n\t * @param value Date format\r\n\t */\r\n\tpublic set inputDateFormat(value: string) {\r\n\t\tif (this._inputDateFormat != value) {\r\n\t\t\tthis._inputDateFormat = value;\r\n\t\t\tthis.invalidate();\r\n\t\t}\r\n\t}\r\n\r\n\t/**\r\n\t * @return Date format\r\n\t */\r\n\tpublic get inputDateFormat(): string {\r\n\t\tif (this._inputDateFormat) {\r\n\t\t\treturn this._inputDateFormat;\r\n\t\t}\r\n\t\telse if (this.dateFormatter && $type.isString(this.dateFormatter.dateFormat)) {\r\n\t\t\treturn this.dateFormatter.dateFormat;\r\n\t\t}\r\n\t\telse {\r\n\t\t\treturn \"yyyy-MM-dd\";\r\n\t\t}\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\r\nregistry.registeredClasses[\"DateAxisRangeSelector\"] = DateAxisRangeSelector;\n\n\n// WEBPACK FOOTER //\n// ../../../../../src/.internal/plugins/rangeSelector/DateAxisRangeSelector.ts","import * as m from \"../../es2015/plugins/rangeSelector\";\nwindow.am4plugins_rangeSelector = m;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./plugins/rangeSelector.js\n// module id = null\n// module chunks = "],"sourceRoot":""}