@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1 lines • 8.65 kB
JavaScript
module.exports=function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}({0:function(e,t,n){e.exports=n(1269)},3:function(e,t){e.exports=function(){throw Error("define cannot be used indirect")}},1265:function(e,t){e.exports=require("./kendo.treelist")},1269:function(e,t,n){var o,i,r;!function(d,define){i=[n(1265),n(1270)],o=d,r="function"==typeof o?o.apply(t,i):o,!(void 0!==r&&(e.exports=r))}(function(){return function(e){var t=e.extend,n=e.map,o=e.proxy,i=e.isFunction,r=kendo.ui,d=r.TreeList,l=kendo._outerHeight,a=kendo._activeElement,s=kendo.keys,c=kendo.support.mobileOS,u=kendo.attr("type"),h=kendo.attr("bind"),f=kendo.attr("format"),m="string",p=".kendoGanttList",g="dblclick",_="focusin",k="focusout",b="keydown",C="keyup",v="mousedown",E="beforeEdit",w="edit",H="save",x="cancel",y="render",I=".",T="{0:"+kendo.getCulture().calendar.patterns.d+"}",D={title:"Title",start:"Start Time",end:"End Time",percentComplete:"% Done",parentId:"Predecessor ID",id:"ID",orderId:"Order ID"},S="<table style='visibility: hidden;'><tbody><tr style='height:{0}'><td> </td></tr></tbody></table>",W={gridHeader:"k-grid-header",gridContentWrap:"k-grid-content",editCell:"k-edit-cell",iconCollapse:"k-i-collapse",iconExpand:"k-i-expand"},F=r.GanttList=d.extend({init:function(e,t){0===this.options.columns.length&&this.options.columns.push("title"),d.fn.init.call(this,e,t),this._unbindDataSource(),this._adjustHeight(),this._setWidth()},options:{name:"GanttList",autoBind:!1,sortable:!0,selectable:!0,navigatable:!1,editable:{move:!0,mode:"incell"},resizable:!1,renderAllRows:!1},destroy:function(){d.fn.destroy.call(this),kendo.destroy(this.element)},closeCell:function(e){var t,n,o=this,i=(o.editor||{}).element;i&&i[0]&&o._isIncellEditable()&&(n=o.dataItem(i),o._cancelEditor(),i.removeClass(W.editCell),t=i.parent().removeClass(W.editRow),o.lockedContent&&o._relatedRow(t).removeClass(W.editRow),e&&o._render(),o.trigger("itemChange",{item:t,data:n,ns:r}),o.lockedContent&&o._adjustRowHeight(t.css("height","")[0],o._relatedRow(t).css("height","")[0]))},insertAfter:function(e,t){var n,o;e&&t&&(n=t.orderId,o={parentId:t.parentId},o.orderId=t.parentId===e.parentId&&t.orderId>e.orderId?n:n+1,this.trigger("reorder",{task:e,updateInfo:o}))},insertBefore:function(e,t){var n,o;e&&t&&(n=t.orderId,o={parentId:t.parentId},o.orderId=t.parentId===e.parentId&&t.orderId>e.orderId?n-1:n,this.trigger("reorder",{task:e,updateInfo:o}))},_adjustHeight:function(){var e,t=this.element,n=t.find(I+W.gridContentWrap),o=t.find(I+W.gridHeader),i=kendo.support.scrollbar();this._isHeightSet(t)&&(e=t.height()-l(o),n.height(e),this._hasLockedColumns&&(i=this.table[0].offsetWidth>this.table.parent()[0].clientWidth?i:0,this.lockedContent.height(e-i)))},_adjustRowHeight:function(e,t){var n,o=e.offsetHeight,i=t.offsetHeight;o>i?n=o+"px":o<i&&(n=i+"px"),n&&(e.style.height=t.style.height=n)},_isHeightSet:function(e){var t,n;return!!e[0].style.height||(t=e.height(),e.height("auto"),n=e.height(),e.height(""),t!=n)},_attachCellEditingEventHandlers:function(){var t=this,n=t.options.editable;t._isIncellEditable()&&n.update!==!1&&(t._startEditHandler=function(n){var o=n.currentTarget?e(n.currentTarget):n,i=t._columnFromElement(o);t.editable||i&&i.editable()&&t._editCell(o,i,t._modelFromElement(o))},t.content.on(_+p,o(t._focusInEditableHandler,t)).on(k+p,o(t._focusoutCellHandler,t)).on(b+p,"tr:not(.k-grouping-row) > td",o(t._keydownHandler,t)).on(C+p,"tr:not(.k-grouping-row) > td",o(t._keyupHandler,t)),c?t.touch=t.content.kendoTouch({filter:"td",touchstart:function(e){t._mouseDownHandler(e.touch)},doubletap:function(e){e.event.target.classList.contains("k-icon")||t._openEditorHandler(e.touch)}}).data("kendoTouch"):t.content.on(v+p,"tr:not(.k-grouping-row) > td",o(t._mouseDownHandler,t)).on(g+p,"tr:not(.k-grouping-row) > td",o(t._openEditorHandler,t)))},_blurActiveElement:function(){var t=kendo._activeElement();t&&"body"!==t.nodeName.toLowerCase()&&e(t).blur()},_closeCellTimeouted:function(){var t=this,n=a(),o=t.editor||{},i=o.element;i&&i[0]&&n&&!e.contains(i[0],n)&&i[0]!==n&&!e(n).closest(".k-animation-container").length&&o.end()&&t.closeCell()},_columns:function(){var e=this,t=this.options.columns;e._hasExpandable=!1,t.forEach(function(t){t.expandable&&(e._hasExpandable=!0)}),e.columns=e.options.columns=n(t,o(e._eachColumn,e)),d.fn._columns.call(e)},_columnEditor:function(t){var n={name:t.field,required:!0};return n[h]="value:"+t.field,n[u]="date",n[f]=kendo._extractFormat(t.format),function(o,r){var d=r.model,l=d.fields[t.field]||d[t.field],a=l.validation;a&&a.dateCompare&&i(a.dateCompare)&&a.message&&(e("<span "+kendo.attr("for")+'="'+t.field+'" class="k-invalid-msg"/>').hide().appendTo(o),n[kendo.attr("dateCompare-msg")]=a.message),e('<input type="text"/>').attr(n).prependTo(o).kendoDateTimePicker({format:r.format})}},_columnFromElement:function(e){var t=e.closest("td"),n=t.parent(),o=n.children().index(t);return this.columns[o]},_eachColumn:function(e){var i=this,r=i.options.resourcesField,d=this.options.sortable,l=function(){this.field="",this.title="",this.editable=function(){return!1},this.sortable=!1},a=function(e){var t,n=e.get(r)||[],o=[];for(t=0;t<n.length;t++)o.push(kendo.format("{0} [{1}]",n[t].get("name"),n[t].get("formatedValue")));return o.join(", ")};return e.columns&&(i.hasNestedColumns=!0,e.columns=n(e.columns,o(this._eachColumn,this))),typeof e===m&&(e={field:e,title:D[e]}),e.editable=e.editable===!0?function(){return!0}:function(){return!1},"start"!==e.field&&"end"!==e.field||(e.format=kendo.getCulture().calendar.patterns[e.format]||e.format||T,e.editor||(e.format===T||e.format.toLowerCase().indexOf("h")>-1)&&(e.editor=i._columnEditor(e))),e.field===r&&(e.sortable=!1,e.template=e.template||a),i._hasExpandable||"title"!==e.field||(e.expandable=!0),d&&!e.sortable&&(e.sortable=!1),t(new l,e)},_editCell:function(e,t,n){var o,i=this,r=i.options.resourcesField,d=i.dataSource._createNewModel(n.toJSON());return t.field===r?void t.editor(e,d):i.trigger(E,{model:n,container:e})?void i.dataSource._restorePageSizeAfterAddChild():(i.closeCell(),n._edit=!0,i._cancelEditor(),i._render({editedColumn:t,editedColumnIndex:e.index()}),o=i.table.add(i.lockedTable).find(I+W.editCell).first(),i.editor=i._createIncellEditor(o,{columns:[t],model:n,change:function(t){i.trigger(H,{values:t.values,container:e,model:n})&&t.preventDefault()}}),i._current=o,void i.trigger(w,{container:e,model:n}))},_focusInEditableHandler:function(t){var n=this,o=t.target;e.contains(o,a())||(clearTimeout(n._closeCellTimeout),n._closeCellTimeout=null)},_focusoutCellHandler:function(e){var t=this;t._closeCellTimeout=setTimeout(function(){t._closeCellTimeouted(e)},1)},_keydownHandler:function(e){e.keyCode===s.ENTER&&e.preventDefault()},_keyupHandler:function(t){var n,o,i=this,r=t.keyCode;switch(r){case s.ENTER:i._blurActiveElement(),i._closeCellTimeouted(t);break;case s.ESC:i.editor&&(n=e(t.target),o=i._modelFromElement(n),i.trigger(x,{model:o,cell:n}))}},_modelFromElement:function(e){var t=e.closest("tr"),n=this.dataSource.getByUid(t.attr(kendo.attr("uid")));return n},_mouseDownHandler:function(t){var n=e(t.currentTarget);n.hasClass(W.editCell)||this._blurActiveElement()},_openEditorHandler:function(t){var n=this,o=e(t.currentTarget),i=n.lockedTable&&o.closest("table")[0]===n.lockedTable[0],r=n.selectable&&n.selectable.options.multiple;o.hasClass(W.editCell)||o.has("a.k-grid-delete").length||o.has("button.k-grid-delete").length||o.closest("tbody")[0]!==n.tbody[0]&&!i||e(t.target).is(":input")||e(t.target).hasClass(W.iconExpand)||e(t.target).hasClass(W.iconCollapse)||(n.editor?n.editor.end()&&(r&&e(a()).blur(),n.closeCell(),n.editCell(o)):n.editCell(o))},_renderTree:function(e){d.fn._render.call(this),this.hasNestedColumns&&this.element.addClass("k-gantt-treelist-nested-columns"),e&&e.length&&!e.editedColumn&&(this.options.rowHeight&&this._rowHeight(e),this.trigger(y))},_rowHeight:function(t){var n,o=this.content,i=this.options,r=typeof i.rowHeight===m?i.rowHeight:i.rowHeight+"px",d=e(kendo.format(S,r));o.append(d),n=l(d.find("tr")),d.remove(),this.element.find('[role="treegrid"]').css("height",t.length*n+"px")},_setData:function(e){this.dataSource.data(e)},_setWidth:function(){this.element.find(".k-grid-header table").css("minWidth",this.options.listWidth),this.content.find("table").css("minWidth",this.options.listWidth)}});r.plugin(F)}(window.kendo.jQuery),window.kendo},n(3))},1270:function(e,t){e.exports=require("./kendo.treeview.draganddrop")}});