@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 18.9 kB
JavaScript
module.exports=function(t){function e(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var i={};return e.m=t,e.c=i,e.p="",e(0)}({0:function(t,e,i){t.exports=i(879)},3:function(t,e){t.exports=function(){throw Error("define cannot be used indirect")}},879:function(t,e,i){var n,o,s;!function(r,define){o=[i(880),i(881),i(882),i(883),i(884),i(885)],n=r,s="function"==typeof n?n.apply(e,o):n,!(void 0!==s&&(t.exports=s))}(function(){return function(t,e){function i(t){a.fn[t]=function(){var e=this._instance;if(e)return e[t].apply(e,arguments)}}function n(t,i){var n,o,s,r=[],a=t.groupNameTemplate,l=i.length;if(0===l)return s=A({},t),s.visibleInLegend=!1,[s];for(O(a)?(g.logToConsole("'groupNameTemplate' is obsolete and will be removed in future versions. Specify the group name template as 'series.name'"),a&&(n=B(a))):(n=B(t.name||""),0===n._slotCount&&(n=B(O(t.name)?"#= group.value #: #= series.name #":"#= group.value #"))),o=0;o<l;o++)s=A({},t),g.isFunction(s.color)||(s.color=e),s._groupIx=o,s._groupValue=i[o].value,r.push(s),n&&(s.name=n({series:s,group:i[o]}));return r}function o(t){for(var i in t)t[i]===e&&(t[i]="");return t}function s(t){for(var e=0;e<t.length;e++)t[e].notifyRender()}var r,a,l,h,c,u,p,d,_,f,m=".kendoChart",g=window.kendo,v=g.Class,y=g._outerWidth,x=g._outerHeight,b=g.dataviz,T=b.constants,S=b.Chart,E=b.SeriesBinder,w=g.ui.Widget,C=g.data.DataSource,A=g.deepExtend,O=b.defined,I=b.getField,k=b.InstanceObserver,D=b.inArray,L=b.services,R=t.proxy,H=t.isArray,V=t.extend,B=g.template,N="mouseleave"+m,M=T.AXIS_LABEL_CLICK,F=T.LEGEND_ITEM_CLICK,P=T.LEGEND_ITEM_HOVER,z=T.LEGEND_ITEM_LEAVE,G=T.SERIES_CLICK,q=T.SERIES_HOVER,K=T.SERIES_OVER,Z=T.SERIES_LEAVE,U=T.PANE_RENDER,W=T.PLOT_AREA_CLICK,X=T.PLOT_AREA_HOVER,j=T.PLOT_AREA_LEAVE,Q=T.DRAG,Y=T.DRAG_END,J=T.DRAG_START,$=T.ZOOM_START,tt=T.ZOOM,et=T.ZOOM_END,it=T.SELECT_START,nt=T.SELECT,ot=T.SELECT_END,st=T.RENDER,rt=T.NOTE_CLICK,at=T.NOTE_HOVER,lt=T.NOTE_LEAVE,ht=t(document.documentElement),ct="change",ut="dataBound",pt="leave",dt="down",_t=T.VALUE,ft=T.PIE,mt=T.DONUT,gt=T.FUNNEL,vt=g.Observable,yt=150,xt=100,bt="k-chart-tooltip-inverse",Tt="k-chart-shared-tooltip",St="rtl";for(L.DomEventsBuilder.register({create:function(t,e){return new g.UserEvents(t,A({global:!0,multiTouch:!0,fastTap:!0},e))}}),r=k.extend({handlerMap:{showTooltip:"_showTooltip",hideTooltip:"_hideTooltip",legendItemClick:"_onLegendItemClick",render:"_onRender",init:"_onInit"}}),a=w.extend({init:function(t,e){var i;g.destroy(t),w.fn.init.call(this,t),e&&(i=e.dataSource,delete e.dataSource),this.options=A({},this.options,e),this.wrapper=this.element,this._attachEvents(),e&&(e.dataSource=i),this._seriesVisibility=new c,this.bind(this.events,this.options),this._initDataSource(e),g.notify(this,b.ui)},events:[ut,G,q,K,Z,M,F,P,z,U,W,X,j,J,Q,Y,$,tt,et,it,nt,ot,rt,at,lt,st],options:{name:"Chart",renderAs:"",theme:"default",axisDefaults:{},chartArea:{},legend:{},categoryAxis:{},autoBind:!0,seriesDefaults:{},series:[],seriesColors:null,tooltip:{},transitions:!0,valueAxis:{},plotArea:{},title:{},xAxis:{},yAxis:{},panes:[{}],pannable:!1,zoomable:!1},items:function(){return t()},refresh:function(){var t=this,e=t._instance;e.applyDefaults(t.options),e.applySeriesColors(),t._bindSeries(),t._bindCategories(),t.trigger(ut),t._redraw()},getSize:function(){return g.dimensions(this.element)},redraw:function(t){this._size=null,this._instance.redraw(t)},setOptions:function(t){var e=this,i=t.dataSource;delete t.dataSource,w.fn._setEvents.call(e,t),this._instance.applyOptions(t,this._getThemeOptions(t)),this.options=this._instance.options,this._tooltip.setOptions(this.options.tooltip),this._seriesVisibility.setOptions(this.options),this._sourceSeries=null,i&&e.setDataSource(i),e._hasDataSource?e._onDataChanged():(e._bindCategories(),e.redraw()),e._instance.updateMouseMoveHandler()},setDataSource:function(t){var e=this;e.dataSource.unbind(ct,e._dataChangeHandler),e.dataSource=t=C.create(t),e._hasDataSource=!0,e._hasData=!1,t.bind(ct,e._dataChangeHandler),e.options.autoBind&&t.fetch()},destroy:function(){var t=this,e=t.dataSource;t.element.off(m),e&&e.unbind(ct,t._dataChangeHandler),t._instance&&(t._instance.destroy(),delete this._instance),this._tooltip&&(this._tooltip.destroy(),delete this._tooltip),this._destroyCrosshairTooltips(),w.fn.destroy.call(t)},findPaneByName:function(t){var e,i=this._plotArea.panes;for(e=0;e<i.length;e++)if(i[e].options.name===t)return new _(this,i[e])},findPaneByIndex:function(t){var e=this._plotArea.panes;if(e[t])return new _(this,e[t])},findSeries:function(t){var e,i=this._plotArea,n=i.srcSeries||i.series;for(e=0;e<n.length;e++)if(t(n[e]))return new f(this,n[e])},findSeriesByName:function(t){return this._createSeries({name:t})},findSeriesByIndex:function(t){return this._createSeries({index:t})},exportVisual:function(t){var e,i,n,o,r=this._instance;if(r)return t&&(t.width||t.height)?(i=r.options.chartArea,n=r._originalOptions.chartArea,A(i,t),o=r._getModel(),i.width=n.width,i.height=n.height,o.renderVisual(),s(o._plotArea.panes),e=o.visual):e=r.exportVisual(),e},_createSeries:function(t){var e=this._seriesOptions(t);if(e)return new f(this,e)},_seriesOptions:function(t){var e,i,n=this._plotArea,o=n.srcSeries||n.series;if(O(t.index))e=o[t.index];else if(O(t.name))for(i=0;i<o.length;i++)if(o[i].name===t.name){e=o[i];break}return e},_attachEvents:function(){this.element.on(N,R(this._mouseleave,this))},_mouseleave:function(e){var i=this._instance,n=this._tooltip,o=e.relatedTarget;o&&t(o).closest(n.element).length||!i||i.handlingTap||i.hideElements({keepTooltipOpen:!n.options.autoHide})},_getThemeOptions:function(t){var i,n,o=(t||{}).theme;return o&&b.SASS_THEMES.indexOf(o.toLowerCase())!==-1?b.autoTheme().chart:O(o)?(i=b.ui.themes||{},n=i[o]||i[o.toLowerCase()]||{},n.chart||{}):e},_initChart:function(){this._createChart(this.options,this._getThemeOptions(this.options)),this.options=this._instance.options,this._seriesVisibility.setOptions(this.options)},_createChart:function(t,e){this._instance=new S(this.element[0],t,e,{observer:new r(this),sender:this,rtl:this._isRtl()})},_onInit:function(t){this._instance=t.sender},_initDataSource:function(t){var e=this,i=(t||{}).dataSource;e._dataChangeHandler=R(e._onDataChanged,e),e.dataSource=C.create(i).bind("change",e._dataChangeHandler),e._bindCategories(),i&&(e._hasDataSource=!0),this._initChart(),this._initTooltip(),i&&e.options.autoBind&&e.dataSource.fetch()},_destroyCrosshairTooltips:function(){var t,e=this._crosshairTooltips;if(e)for(t in e)e[t].destroy();this._crosshairTooltips={}},_getCrosshairTooltip:function(t,e){var i=this._crosshairTooltips=this._crosshairTooltips||{},n=t+e,o=i[n];return o||(o=i[n]=new d(this.element)),o},_showTooltip:function(t){if(t.crosshair){var e=this._getCrosshairTooltip(t.axisName,t.axisIndex);e.show(t)}else this._tooltip&&this._tooltip.show(t)},_hideTooltip:function(t){if(t.crosshair){var e=this._getCrosshairTooltip(t.axisName,t.axisIndex);e.hide()}else this._tooltip&&this._tooltip.hide(t)},_onRender:function(t){this._destroyCrosshairTooltips(),this._copyMembers(t.sender),this._hasDataSource&&!this._hasData&&this.options.autoBind||this.trigger(st)},_copyMembers:function(t){this.options=t.options,this._originalOptions=t._originalOptions,this.surface=t.surface,this._plotArea=t._plotArea,this._model=t._model,this._highlight=t._highlight,this._selections=t._selections,this._pannable=t._pannable,this._zoomSelection=t._zoomSelection,this._mousewheelZoom=t._mousewheelZoom},requiresHandlers:function(t){var e,i=this._events;for(e=0;e<t.length;e++)if(O(i[t[e]]))return!0},_initTooltip:function(){this._tooltip=this._createTooltip(),this._tooltip.bind(pt,R(this._tooltipleave,this))},_onLegendItemClick:function(t){this.trigger(F,t)||this._legendItemClick(t.seriesIndex,t.pointIndex)},_legendItemClick:function(e,i){var n,o,s,r=this._instance,a=r._plotArea,l=(a.srcSeries||a.series)[e];r._hasInactiveOpacity()&&r._activеChartInstance&&(r._updateSeriesOpacity(null,!0),r._applySeriesOpacity(r._activеChartInstance.children,null,!0),r._activеChartInstance=null),t.inArray(l.type,[ft,mt,gt])>=0?(n=l.data[i],n&&O(n.visible)?n.visible=!n.visible:(o=l.pointVisibility=l.pointVisibility||{},s=o[i],o[i]=!!O(s)&&!s)):(l.visible=!l.visible,this._seriesVisibility.save(l)),r._noTransitionsRedraw()},_createTooltip:function(){return new p(this.element,V({},this.options.tooltip,{rtl:this._isRtl()}))},_tooltipleave:function(){this._instance&&this._instance.hideElements()},_bindData:function(t){var e,i,o,s=this,r=s.options,a=s._sourceSeries||r.series,l=a.length,h=s.dataSource.view(),c=(s.dataSource.group()||[]).length>0,u=[],p=this._seriesVisibility;for(p.read(),e=0;e<l;e++)i=a[e],s._isBindable(i)&&c?(o=n(i,h),u=u.concat(o),p.applyByGroup(o,t)):(i=V({},i),u.push(i),p.applyByIndex(i,t));s._sourceSeries=a,r.series=u,this._instance.applySeriesColors(),s._bindSeries(),s._bindCategories(),this._hasData=!0},_onDataChanged:function(t){this._bindData(t),this.trigger(ut),this._instance&&this._instance.fontLoaded&&this._redraw()},_bindSeries:function(){var t,e,i,n,o=this,s=o.dataSource.view(),r=o.options.series,a=r.length;for(t=0;t<a;t++)e=r[t],o._isBindable(e)&&(i=e._groupIx,n=O(i)?(s[i]||{}).items:s,e.autoBind!==!1&&(e.data=n))},_bindCategories:function(){var t,e,i=this,n=i.dataSource.view()||[],o=(i.dataSource.group()||[]).length>0,s=n,r=i.options,a=[].concat(r.categoryAxis);for(o&&n.length&&(s=n[0].items),t=0;t<a.length;t++)e=a[t],e.autoBind!==!1&&i._bindCategoryAxis(e,s,t)},_bindCategoryAxis:function(t,e,i){var n,o,s,r=(e||[]).length;if(t.field)for(t.categories=[],n=0;n<r;n++)s=e[n],o=I(t.field,s),0===n?(t.categories=[o],t.dataItems=[s]):(t.categories.push(o),t.dataItems.push(s));else this._instance&&this._instance.bindCategoryAxisFromSeries(t,i)},_isBindable:function(t){var e,i,n=E.current.valueFields(t),o=!0;for(i=0;i<n.length;i++)if(e=n[i],e===_t?e="field":e+="Field",!O(t[e])){o=!1;break}return o},_isRtl:function(){return g.support.isRtl(this.element)&&this.element.css("direction")===St}}),l=["getAxis","findAxisByName","plotArea","toggleHighlight","showTooltip","hideTooltip","_resize","_redraw","_noTransitionsRedraw","_legendItemHover","_eventCoordinates"],h=0;h<l.length;h++)i(l[h]);b.ExportMixin.extend(a.fn),g.PDFMixin&&g.PDFMixin.extend(a.fn),b.ui.plugin(a),c=v.extend({init:function(){this.groups={},this.index={},this.options={}},applyByGroup:function(t,e){if(e&&e.action||this.options.persistSeriesVisibility)for(var i=0;i<t.length;i++)this.groups[t[i]._groupValue]===!1&&(t[i].visible=!1);else this.groups={}},applyByIndex:function(t,e){e&&e.action||this.options.persistSeriesVisibility?this.index[t.index]===!1&&(t.visible=!1):this.index={}},save:function(t){t&&(this.options.persistSeriesVisibility?this.options.series[t.index].visible=t.visible:this.saveState(t))},setOptions:function(t){this.options=t,this.groups={},this.index={}},read:function(){var t,e,i=this.options;if(i.persistSeriesVisibility)for(t=i.series,e=0;e<t.length;e++)this.saveState(t[e])},saveState:function(t){O(t._groupValue)?this.groups[t._groupValue]=t.visible:this.index[t.index]=t.visible}}),u=g.geometry,p=vt.extend({init:function(e,i){var n,o=this;vt.fn.init.call(o),this.setOptions(i),o.chartElement=e,o.template=p.template,o.template||(o.template=p.template=g.template('<div class=\'k-tooltip #if (!d.autoHide) {# k-tooltip-closable#}# k-chart-tooltip#= d.rtl ? " k-rtl" : ""#\' style=\'display:none; position: absolute; font: #= d.font #;#if (d.border) {# border: #= d.border.width #px solid; #}#opacity: #= d.opacity #; filter: alpha(opacity=#= d.opacity * 100 #);\'><div class="k-tooltip-content"></div>#if (!d.autoHide) {# <div class="k-tooltip-button"><a href="\\#" class="k-icon k-i-close" title="Close"></a></div> #}#</div>',{useWithBlock:!1,paramName:"d"})),o.element=t(o.template(o.options)),o.move=R(o.move,o),o._mouseleave=R(o._mouseleave,o),n=g.format("[{0}='content'],[{0}='scroller']",g.attr("role")),o._mobileScroller=e.closest(n).data("kendoMobileScroller"),o.downEvent=g.applyEventMap(dt,g.guid()),o._closeTooltipHandler=R(o._closeTooltip,o)},destroy:function(){var t=this;this._clearShowTimeout(),ht.off(t.downEvent,t._closeTooltipHandler),this.element&&(this.element.off(N).remove(),this.element=null)},setOptions:function(t){this.options=A({},this.options,t)},options:{opacity:1,animation:{duration:yt},sharedTemplate:"<table><th colspan='#= colspan #'>#= categoryText #</th># for(var i = 0; i < points.length; i++) { ## var point = points[i]; #<tr># if(colorMarker) { # <td><span class='k-chart-shared-tooltip-marker' style='background-color:#:point.series.color#'></span></td># } ## if(nameColumn) { # <td> #if (point.series.name) {# #: point.series.name #: #} else {# #}#</td># } #<td>#= content(point) #</td></tr># } #</table>",categoryFormat:"{0:d}",autoHide:!0},move:function(){var t,e=this,i=e.options,n=e.element;e.anchor&&e.element&&(t=e._offset(),e.visible||n.css({top:t.top,left:t.left}),e.visible=!0,e._ensureElement(document.body),n.stop(!0,!0).show().animate({left:t.left,top:t.top},i.animation.duration))},_clearShowTimeout:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null)},getAnchor:function(t){var e=this.anchor,i=e.point,n=e.align,o=i.left,s=i.top;return"center"===n.horizontal?o-=t.width/2:"right"===n.horizontal&&(o-=t.width),"center"===n.vertical?s-=t.height/2:"bottom"===n.vertical&&(s-=t.height),{x:o,y:s}},_offset:function(){var e,i,n=this,o=n._measure(),s=n.getAnchor(o),r=s.y,a=s.x,l=g.support.zoomLevel(),h=t(window),c=window.pageYOffset||document.documentElement.scrollTop||0,p=window.pageXOffset||document.documentElement.scrollLeft||0,d=(this._mobileScroller||{}).movable;return d&&1!==d.scale?(e=u.transform().scale(d.scale,d.scale,[d.x,d.y]),i=new u.Point(a,r).transform(e),a=i.x,r=i.y):(r+=n._fit(r-c,o.height,x(h)/l),a+=n._fit(a-p,o.width,y(h)/l)),{top:r,left:a}},show:function(t){var e,i=this;this.anchor=t.anchor,this.element.css(o(t.style)),this.element.toggleClass(bt,!!t.className),this.element.toggleClass(Tt,!!t.shared),e=t.shared?this._sharedContent(t):this._pointContent(t.point),this.element.find(".k-tooltip-content").html(e),i.options.autoHide||(i.element.off("click"+m).on("click"+m,".k-tooltip-button",i._closeTooltipHandler),ht.off(i.downEvent,i._closeTooltipHandler).on(i.downEvent,i._closeTooltipHandler)),this._clearShowTimeout(),this.showTimeout=setTimeout(this.move,xt)},hide:function(){var t=this;clearTimeout(t.showTimeout),t._hideElement(),t.visible&&(t.point=null,t.visible=!1,t.index=null,ht.off(t.downEvent,t._closeTooltipHandler))},_closeTooltip:function(e){var i=t(e.target);i.is(".k-chart-tooltip, .k-tooltip-content")||(e.preventDefault(),this.chartElement.data("kendoChart")._instance.hideElements(),this.hide())},_sharedContent:function(t){var e,i,n=t.points,o=b.grep(n,function(t){return O(t.series.name)}).length,s=t.series.length>1,r=1;return o&&r++,s&&r++,e=g.template(this.options.sharedTemplate),i=e({points:n,category:t.category,categoryText:t.categoryText,content:this._pointContent,colorMarker:s,nameColumn:o,colspan:r})},_measure:function(){this._ensureElement();var t={width:y(this.element),height:x(this.element)};return t},_ensureElement:function(){this.element&&this.element.appendTo(document.body).on(N,this._mouseleave)},_mouseleave:function(e){var i=e.relatedTarget,n=this.chartElement[0];i&&i!==n&&!t.contains(n,i)&&this.trigger(pt)},_hideElement:function(){var t=this,e=this.element;e&&e.fadeOut({always:function(){t.visible||e.off(N).remove()}})},_pointContent:function(t){var e,i,n=this,o=A({},n.options,t.options.tooltip);return O(t.value)&&(e=""+t.value),o.template?(i=B(o.template),e=i({value:t.value,category:t.category,series:t.series,dataItem:t.dataItem,percentage:t.percentage,runningTotal:t.runningTotal,total:t.total,low:t.low,high:t.high,xLow:t.xLow,xHigh:t.xHigh,yLow:t.yLow,yHigh:t.yHigh})):o.format&&(e=t.formatValue(o.format)),e},_fit:function(t,e,i){var n=0;return t+e>i&&(n=i-(t+e)),t<0&&(n=-t),n}}),d=p.extend({init:function(t,e){p.fn.init.call(this,t,e),this.element.addClass("k-chart-crosshair-tooltip")},show:function(t){var e=this.element;e&&(this.anchor=t.anchor,this.element.css(t.style),this.element.html(this.content(t)),this.move())},move:function(){var t=this,e=t.element,i=t._offset();t._ensureElement(),e.css({top:i.top,left:i.left}).show()},content:function(t){var e=t.value,i=t.crosshair.options.tooltip;return i.template&&(e=B(i.template)({value:e})),e},hide:function(){this.element.hide()}}),_=v.extend({init:function(t,e){this._chart=t,this._pane=e,this.visual=e.visual,this.chartsVisual=e.chartContainer.visual,this.name=e.options.name},series:function(){var t,e=this._chart,i=e._plotArea.groupSeriesByPane(),n=i[this.name||"default"],o=[];if(n)for(t=0;t<n.length;t++)o.push(new f(e,n[t]));return o}}),f=v.extend({init:function(t,e){this._chart=t,this._options=e},points:function(t){var e,i,n=this._points;return n||(e=this._seriesOptions(),i=this._chart._plotArea,this._points=n=i.pointsBySeriesIndex(e.index)),g.isFunction(t)&&(n=this._filterPoints(n,t)),n},data:function(t){var e,i,n,o,s=this._seriesOptions();return t&&(e=this._chart,i=e._plotArea,s.data=t,s.categoryField&&(n=i.seriesCategoryAxis(s),o=[].concat(e.options.categoryAxis),e._instance.bindCategoryAxisFromSeries(o[n.axisIndex],n.axisIndex)),e._noTransitionsRedraw(),this._clearFields()),s.data},findPoint:function(t){var e,i=this.points();for(e=0;e<i.length;e++)if(t(i[e]))return i[e]},toggleHighlight:function(t,e){e=e?g.isFunction(e)?this.points(e):H(e)?e:[e]:this.points(),this._chart._instance.togglePointsHighlight(t,e)},toggleVisibility:function(t,e){var i,n,o=this._chart,s=this._seriesOptions(),r=g.isFunction(e);if(r)if(D(s.type,[ft,mt,gt]))for(i=this._filterData(e),n=0;n<i.length;n++)i[n].visible=t;else s.visible=function(i){return!e(i.dataItem)||t};else s.visible=t,o._seriesVisibility.save(s);o._noTransitionsRedraw(),this._clearFields()},_filterData:function(t){var e,i=this._seriesOptions().data,n=i.length,o=[];for(e=0;e<n;e++)t(i[e])&&o.push(i[e]);return o},_filterPoints:function(t,e){var i,n=[],o=t.length;for(i=0;i<o;i++)e(t[i])&&n.push(t[i]);return n},_seriesOptions:function(){var t=this._series;return t||(t=this._series=this._chart._seriesOptions(this._options)),t},_clearFields:function(){delete this._points,delete this._series}}),b.Tooltip=p,b.CrosshairTooltip=d,b.ChartInstanceObserver=r,b.ChartPane=_,b.ChartSeries=f}(window.kendo.jQuery),window.kendo},i(3))},880:function(t,e){t.exports=require("./kendo-chart")},881:function(t,e){t.exports=require("../../kendo.data")},882:function(t,e){t.exports=require("../../kendo.dataviz.core")},883:function(t,e){t.exports=require("../../kendo.dataviz.themes")},884:function(t,e){t.exports=require("../../kendo.drawing")},885:function(t,e){t.exports=require("../../kendo.userevents")}});