0||e.scrollBox.scrollTop>0&&a<0||e.scrollBox.scrollLeft>0&&i<0)&&l.preventDefault(o),t=setTimeout(function(){t=void 0,e.scrollBox.scrollTo(i+r,a+n)},1))}},e.pasteItem=function(t,o,r,n){function l(e,t,o,r,n,l){var i=t;return Array.isArray(e)||null===e||"object"!=typeof e||(e=Object.keys(e).map(function(t){return e[t]})),/^text\/html/.test(n)&&(e=e.substring(4,e.length-5).split("")),"string"==typeof e&&(e=[e]),c[l]=[],e.forEach(function(n,a){var s=r[a+o].name;if(void 0===e[a]||null===e[a])return void(i[s]=t[s]);c[l].push(a+o),i[s]=e[a]}),i}var i,a=e.getVisibleSchema(),s=r-1,c=[];if(/^text\/html/.test(n)){if(!/^(]+>)?/.test(t.substring(0,29)))return void console.warn("Unrecognized HTML format. HTML must be a simple table, e.g.: . Data with the mime type text/html not in this format will not be imported as row data.");t=t.substring(t.indexOf("")+11,t.length-13).split(" "),t=t.filter(function(e){return!/^|^/.test(e)})}else t=t.split("\n");return i=t.length,t.forEach(function(t){s+=1;var r=e.orders.rows[s];e.data[r]=l(t,e.data[r],o,a,n,r)}),e.selections=c,i},e.getNextVisibleColumnIndex=function(t){var o,r=e.getVisibleSchema();for(o=0;o/g,">")}function r(e){return e=null===e||void 0===e?"":e,""+("string"==typeof e?o(e):e)+" | "}function n(t,r){if(!f.length||t.length<2)return"";var n=[];return r&&n.push(""),f.forEach(function(l,i){if(l=f[e.orders.columns[i]],!l.hidden&&-1!==t.indexOf(l.name)){var a=l.name||l.title||"";r?n.push(""+o(a)+" | "):n.push('"'+a.replace(/"/g,'""')+'"')}}),n.push(r?" ":"\n"),n.join(r?"":",")}function l(e,t,o,n){return null!==e&&!1!==e&&void 0!==e&&e.replace?(t.push(r(e)),void o.push('"'+e.replace(/"/g,'""')+'"')):void 0!==e?(o.push(e),void t.push(r(e))):(o.push(""),void t.push(" | "))}if(!e.dispatchEvent("copy",{NativeEvent:t})&&e.hasFocus&&t.clipboardData){var i,a,s,c=(e.data,[]),d=[],u={},h=e.getSelectedData(),f=e.getSchema();h.length>0&&(h.forEach(function(t){var o=Object.keys(t);if(t){var r=[],n=[],i=[];f.forEach(function(t,o){i.push(f[e.orders.columns[o]])}),i.forEach(function(e,i){-1!==o.indexOf(e.name)&&(u[e.name]=!0,l(t[e.name],r,n,e))}),c.push(r.join("")),d.push(n.join(","))}}),s=Object.keys(u),i=n(s)+d.join("\n"),a=""+n(s,!0)+""+c.join(" ")+" ",1===s.length&&(i=i.substring(1,i.length-1)),t.clipboardData.setData("text/html",a),t.clipboardData.setData("text/plain",i),t.clipboardData.setData("text/csv",i),t.clipboardData.setData("application/json",JSON.stringify(h)),t.preventDefault())}}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){function t(t){function o(){var t=e.scrollBox.scrollLeft,n=e.scrollBox.scrollTop;t+=i?e.attributes.selectionScrollIncrement:0,n+=s?e.attributes.selectionScrollIncrement:0,n-=c?e.attributes.selectionScrollIncrement:0,t-=a?e.attributes.selectionScrollIncrement:0,e.scrollBox.scrollTo(t,n),r=setTimeout(o,e.attributes.scrollRepeatRate)}var n,l,i,a,s,c,d,u,h;if(!e.dispatchEvent("beforetouchmove",{NativeEvent:t})){if(clearTimeout(r),t.changedTouches[0]&&(e.touchPosition=e.getTouchPos(t)),t.changedTouches[1]&&(e.touchPosition1=e.getTouchPos(t,1)),Math.abs(e.touchDelta.x)+Math.abs(e.touchDelta.y)>e.attributes.touchDeadZone&&clearTimeout(e.touchContextTimeout),2===t.touches.length&&e.touchPosition&&e.touchPosition1)return u=e.touchPosition.y,h=e.touchPosition1.y,e.zoomDeltaStart||(e.zoomDeltaStart=Math.abs(u-h),e.startScale=e.scale),e.touchLength=2,e.scaleDelta=e.zoomDeltaStart-Math.abs(u-h),e.scale=e.startScale-e.scaleDelta*e.attributes.touchZoomSensitivity,e.scale=Math.min(Math.max(e.scale,e.attributes.touchZoomMin),e.attributes.touchZoomMax),e.zoomAltered=!0,e.resize(!0),void e.resizeChildGrids();if(!e.zoomAltered)return e.touchLength=1,e.touchPosition=e.touchPosition||e.touchPosition1,n=e.getColumnHeaderCellHeight(),l=e.getRowHeaderCellWidth(),i=e.width-e.style.scrollBarWidth-e.touchPosition.xr||e.scrollAnimation.y===e.scrollBox.scrollTop&&e.scrollAnimation.x===e.scrollBox.scrollLeft||e.stopAnimation||(e.scrollBox.scrollTo(e.scrollAnimation.x,e.scrollAnimation.y),requestAnimationFrame(e.touchEndAnimation))},e.touchEditCell=function(t){e.beginEditAt(t.columnIndex,t.rowIndex)},e.touchCell=function(t){return function(){clearInterval(e.calculatePPSTimer);var o,r=e.getTouchPos(t);if(Math.abs(e.touchDelta.x)+Math.abs(e.touchDelta.y)=r.top&&t.columnIndex<=r.right?(r.bottom=t.rowIndex,r.left=t.columnIndex):"selection-handle-tl"===o&&t.rowIndex<=r.bottom&&t.columnIndex<=r.right?(r.top=t.rowIndex,r.left=t.columnIndex):"selection-handle-tr"===o&&t.rowIndex<=r.bottom&&t.columnIndex>=r.left?(r.top=t.rowIndex,r.right=t.columnIndex):"selection-handle-br"===o&&t.rowIndex>=r.top&&t.columnIndex>=r.left&&(r.bottom=t.rowIndex,r.right=t.columnIndex),"row"===e.attributes.selectionMode||-1===t.rowIndex?(r.left=0,r.right=e.getSchema().length-1):r.left=Math.max(0,r.left),e.selectArea(r),e.draw(!0)}},e.touchmove=function(e){o||requestAnimationFrame(function(){o=!0,t(e),o=!1})},e.touchEndEvents=function(t){e.zoomDeltaStart=void 0,e.touchSelecting=!1,clearInterval(e.touchScrollTimeout),clearInterval(e.touchContextTimeout),clearInterval(e.calculatePPSTimer),t.stopPropagation(),document.body.removeEventListener("touchmove",e.touchmove,{passive:!1}),document.body.removeEventListener("touchend",e.touchend,!1),document.body.removeEventListener("touchcancel",e.touchcancel,!1)},e.touchend=function(t){if(!e.dispatchEvent("touchend",{NativeEvent:t,cell:e.currentCell})){if(e.zoomDeltaStart=void 0,t.changedTouches[0]&&(e.touchPosition=void 0),t.changedTouches[1]&&(e.touchPosition1=void 0),e.zoomAltered)return void(0===t.touches.length&&(e.zoomAltered=!1));var o=Math.abs(e.touchDelta.x)+Math.abs(e.touchDelta.y)e.attributes.scrollAnimationPPSThreshold||Math.abs(e.yPPST)>e.attributes.scrollAnimationPPSThreshold)||/-scroll-/.test(e.startingCell.style)||o||(e.stopAnimation=!1,e.touchEndAnimation()),e.touchEndEvents(t)}},e.touchcancel=function(t){e.dispatchEvent("touchcancel",{NativeEvent:t,cell:e.currentCell})||e.touchEndEvents(t)}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e,t){function o(e,t){var o,r=[];for(o=e;o<=t;o+=1)r[o]=o;return r}e.scale=1,e.orders={rows:[],columns:[]},e.appliedInlineStyles={},e.cellGridAttributes={},e.treeGridAttributes={},e.visibleRowHeights=[],e.hasFocus=!1,e.activeCell={columnIndex:0,rowIndex:0},e.innerHTML="",e.storageName="canvasDataGrid",e.invalidSearchExpClass="canvas-datagrid-invalid-search-regExp",e.localStyleLibraryStorageKey="canvas-datagrid-user-style-library",e.dataType="application/x-canvas-datagrid",e.orderBy=null,e.orderDirection="asc",e.columnFilters={},e.filters={},e.frozenRow=0,e.frozenColumn=0,e.ellipsisCache={},e.scrollCache={x:[],y:[]},e.scrollBox={},e.visibleRows=[],e.sizes={rows:{},columns:{},trees:{}},e.currentFilter=function(){return!0},e.selections=[],e.hovers={},e.attributes={},e.style={},e.formatters={},e.sorters={},e.parsers={},e.schemaHashes={},e.events={},e.changes=[],e.scrollIndexTop=0,e.scrollPixelTop=0,e.scrollIndexLeft=0,e.scrollPixelLeft=0,e.childGrids={},e.openChildren={},e.scrollModes=["vertical-scroll-box","vertical-scroll-top","vertical-scroll-bottom","horizontal-scroll-box","horizontal-scroll-right","horizontal-scroll-left"],e.componentL1Events={},e.eventNames=["afterdraw","afterrendercell","attributechanged","beforebeginedit","beforecreatecellgrid","beforedraw","beforeendedit","beforerendercell","beforerendercellgrid","beginedit","cellmouseout","cellmouseover","click","collapsetree","contextmenu","copy","datachanged","dblclick","endedit","expandtree","formatcellvalue","keydown","keypress","keyup","mousedown","mousemove","mouseup","newrow","ordercolumn","rendercell","rendercellgrid","renderorderbyarrow","rendertext","rendertreearrow","reorder","reordering","resize","resizecolumn","resizerow","schemachanged","scroll","selectionchanged","stylechanged","touchcancel","touchend","touchmove","touchstart","wheel"],e.mouse={x:0,y:0},e.getSelectedData=function(t){var o=[],r=e.getSchema(),n=e.data.length;return 0===n?[]:(e.selections.forEach(function(l,i){if(l&&i!==n){if(0===l.length)return void(o[i]=null);o[i]={},l.forEach(function(n){var l;-1!==n&&r[n]&&(l=e.orders.columns[n],!t&&r[l].hidden||e.data[i]&&(o[i][r[l].name]=e.data[i][r[l].name]))})}}),o)},e.getColumnHeaderCellHeight=function(){return e.attributes.showColumnHeaders?(e.sizes.rows[-1]||e.style.columnHeaderCellHeight)*e.scale:0},e.getRowHeaderCellWidth=function(){return e.attributes.showRowHeaders?(e.sizes.columns[-1]||e.style.rowHeaderCellWidth)*e.scale:0},e.setStorageData=function(){if(e.attributes.saveAppearance&&e.attributes.name){var t={};e.getSchema().forEach(function(e){t[e.name]=!e.hidden}),localStorage.setItem(e.storageName+"-"+e.attributes.name,JSON.stringify({sizes:{rows:e.sizes.rows,columns:e.sizes.columns},orders:{rows:e.orders.rows,columns:e.orders.columns},orderBy:e.orderBy,orderDirection:e.orderDirection,visibility:t}))}},e.getSchema=function(){return e.schema||e.tempSchema||[]},e.createColumnOrders=function(){var t=e.getSchema();e.orders.columns=o(0,t.length-1)},e.createRowOrders=function(){e.orders.rows=o(0,e.data.length-1)},e.getVisibleSchema=function(){return e.getSchema().filter(function(e){return!e.hidden})},e.applyDefaultValue=function(t,o){var r=o.defaultValue||"";"function"==typeof r&&(r=r.apply(e.intf,[o])),t[o.name]=r},e.createNewRowData=function(){e.newRow={},e.getSchema().forEach(function(t){e.applyDefaultValue(e.newRow,t)})},e.getSchemaNameHash=function(t){for(var o=0;e.schemaHashes[t];)o+=1,t+=o;return t},e.filter=function(t){var o=e.filters[t];return o||void 0===t||(console.warn("Cannot find filter for type %s, falling back to substring match.",t),o=e.filters.string),o},e.getBestGuessDataType=function(e,t){var o,r,n=t.length;for(r=0;re.width-e.attributes.selectionScrollZone&&oe.height-e.attributes.selectionScrollZone&&r0)throw new Error("A column with the name "+e.name+" already exists and cannot be added again.");return!0},e.setDefaults=function(e,t,o,r){e[o]=void 0===t[o]?r:t[o]},e.setAttributes=function(){e.defaults.attributes.forEach(function(t){e.setDefaults(e.attributes,e.args,t[0],t[1])})},e.setStyle=function(){e.defaults.styles.forEach(function(t){e.setDefaults(e.style,e.args.style||{},t[0],t[1])})},e.autosize=function(t){e.getVisibleSchema().forEach(function(o,r){o.name!==t&&void 0!==t||(e.sizes.columns[r]=Math.max(e.findColumnMaxTextLength(o.name),e.style.minColumnWidth))}),e.sizes.columns[-1]=e.findColumnMaxTextLength("cornerCell")},e.dispose=function(){!e.isChildGrid&&e.canvas&&e.canvas.parentNode&&e.canvas.parentNode.removeChild(e.canvas),e.isChildGrid||document.body.removeChild(e.controlInput),e.eventParent.removeEventListener("mouseup",e.mouseup,!1),e.eventParent.removeEventListener("mousedown",e.mousedown,!1),e.eventParent.removeEventListener("dblclick",e.dblclick,!1),e.eventParent.removeEventListener("click",e.click,!1),e.eventParent.removeEventListener("mousemove",e.mousemove),e.eventParent.removeEventListener("wheel",e.scrollWheel,!1),e.canvas.removeEventListener("contextmenu",e.contextmenu,!1),e.canvas.removeEventListener("copy",e.copy),e.controlInput.removeEventListener("copy",e.copy),e.controlInput.removeEventListener("cut",e.cut),e.controlInput.removeEventListener("paste",e.paste),e.controlInput.removeEventListener("keypress",e.keypress,!1),e.controlInput.removeEventListener("keyup",e.keyup,!1),e.controlInput.removeEventListener("keydown",e.keydown,!1),window.removeEventListener("resize",e.resize),e.observer&&e.observer.disconnect&&e.observer.disconnect()},e.tryLoadStoredSettings=function(){var t;e.reloadStoredValues(),e.storedSettings&&"object"==typeof e.storedSettings.orders&&null!==e.storedSettings.orders&&(e.storedSettings.orders.rows.length>=(e.data||[]).length&&(e.orders.rows=e.storedSettings.orders.rows),t=e.getSchema(),e.storedSettings.orders.columns.length===t.length&&(e.orders.columns=e.storedSettings.orders.columns),e.orderBy=void 0===e.storedSettings.orderBy?t[0].name:e.storedSettings.orderBy,e.orderDirection=void 0===e.storedSettings.orderDirection?"asc":e.storedSettings.orderDirection,void 0!==e.storedSettings.orderBy&&e.getHeaderByName(e.orderBy)&&e.orderDirection&&e.order(e.orderBy,e.orderDirection))},e.getDomRoot=function(){return e.shadowRoot?e.shadowRoot.host:e.parentNode},e.getFontName=function(e){return e.replace(/\d+\.?\d*px/,"")},e.getFontHeight=function(e){return parseFloat(e,10)},e.parseStyleValue=function(t){if(/Font/.test(t))return e.style[t+"Height"]=e.getFontHeight(e.style[t]),void(e.style[t+"Name"]=e.getFontName(e.style[t]));"moveOverlayBorderSegments"===t&&"string"==typeof e.style[t]&&(e.style[t]=e.style[t].split(",").map(function(e){return parseInt(e,10)}))},e.initProp=function(t){e.args[t]&&Object.keys(e.args[t]).forEach(function(o){e[t][o]=e.args[t][o]})},e.getStyleProperty=function(t){return-1===e.styleKeys.indexOf(t)?e.parentNodeStyle[t]:e.style[t]},e.setStyleProperty=function(t,o,r){var n=-1!==["height","width","minHeight","minWidth","maxHeight","maxWidth"].indexOf(t);-1===e.styleKeys.indexOf(t)?e.parentNodeStyle[t]=o:(/-/.test(t)&&(t=e.dehyphenateProperty(t)),e.style[t]=o,e.parseStyleValue(t)),n&&e.resize(),r||(e.draw(!0),e.dispatchEvent("stylechanged",{name:"style",value:o}))},e.reloadStoredValues=function(){if(e.attributes.name&&e.attributes.saveAppearance){try{e.storedSettings=localStorage.getItem(e.storageName+"-"+e.attributes.name)}catch(t){console.warn("Error loading stored values. "+t.message),e.storedSettings=void 0}if(e.storedSettings)try{e.storedSettings=JSON.parse(e.storedSettings)}catch(t){console.warn("could not read settings from localStore",t),e.storedSettings=void 0}e.storedSettings&&("object"==typeof e.storedSettings.sizes&&null!==e.storedSettings.sizes&&(e.sizes.rows=e.storedSettings.sizes.rows,e.sizes.columns=e.storedSettings.sizes.columns,["trees","columns","rows"].forEach(function(t){e.sizes[t]||(e.sizes[t]={})})),"object"==typeof e.storedSettings.visibility&&e.getSchema().forEach(function(t){e.storedSettings.visibility&&void 0!==e.storedSettings.visibility[t.name]&&(t.hidden=!e.storedSettings.visibility[t.name])}))}},e.init=function(){function t(t){-1===e.styleKeys.indexOf(t)&&e.styleKeys.push(t)}if(!e.initialized){var o={};return e.setAttributes(),e.setStyle(),e.initScrollBox(),e.setDom(),e.nodeType="canvas-datagrid",e.ie=/Trident/.test(window.navigator.userAgent),e.edge=/Edge/.test(window.navigator.userAgent),e.webKit=/WebKit/.test(window.navigator.userAgent),e.moz=/Gecko/.test(window.navigator.userAgent),e.mobile=/Mobile/i.test(window.navigator.userAgent),e.cursorGrab="grab",e.cursorGrabing="grabbing",e.cursorGrab=e.webKit?"-webkit-grab":e.cursorGrab,e.cursorGrabing=e.moz?"-webkit-grabbing":e.cursorGrabbing,e.pointerLockPosition={x:0,y:0},Object.keys(e.style).forEach(e.parseStyleValue),e.intf.moveSelection=e.moveSelection,e.intf.moveTo=e.moveTo,e.intf.addEventListener=e.addEventListener,e.intf.removeEventListener=e.removeEventListener,e.intf.dispatchEvent=e.dispatchEvent,e.intf.dispose=e.dispose,e.intf.appendTo=e.appendTo,e.intf.getVisibleCellByIndex=e.getVisibleCellByIndex,e.intf.filters=e.filters,e.intf.sorters=e.sorters,e.intf.autosize=e.autosize,e.intf.beginEditAt=e.beginEditAt,e.intf.endEdit=e.endEdit,e.intf.setActiveCell=e.setActiveCell,e.intf.forEachSelectedCell=e.forEachSelectedCell,e.intf.scrollIntoView=e.scrollIntoView,e.intf.clearChangeLog=e.clearChangeLog,e.intf.gotoCell=e.gotoCell,e.intf.gotoRow=e.gotoRow,e.intf.getHeaderByName=e.getHeaderByName,e.intf.findColumnScrollLeft=e.findColumnScrollLeft,e.intf.findRowScrollTop=e.findRowScrollTop,e.intf.fitColumnToValues=e.fitColumnToValues,e.intf.findColumnMaxTextLength=e.findColumnMaxTextLength,e.intf.disposeContextMenu=e.disposeContextMenu,e.intf.getCellAt=e.getCellAt,e.intf.isCellVisible=e.isCellVisible,e.intf.isRowVisible=e.isRowVisible,e.intf.isColumnVisible=e.isColumnVisible,e.intf.order=e.order,e.intf.draw=e.draw,e.intf.isComponent=e.isComponent,e.intf.selectArea=e.selectArea,e.intf.clipElement=e.clipElement,e.intf.getSchemaFromData=e.getSchemaFromData,e.intf.setFilter=e.setFilter,e.intf.selectRow=e.selectRow,e.intf.parentGrid=e.parentGrid,e.intf.toggleTree=e.toggleTree,e.intf.expandTree=e.expandTree,e.intf.collapseTree=e.collapseTree,e.intf.canvas=e.canvas,e.intf.context=e.ctx,e.intf.insertRow=e.insertRow,e.intf.deleteRow=e.deleteRow,e.intf.addRow=e.addRow,e.intf.insertColumn=e.insertColumn,e.intf.deleteColumn=e.deleteColumn,e.intf.addColumn=e.addColumn,e.intf.getClippingRect=e.getClippingRect,e.intf.setRowHeight=e.setRowHeight,e.intf.setColumnWidth=e.setColumnWidth,e.intf.resetColumnWidths=e.resetColumnWidths,e.intf.resetRowHeights=e.resetRowHeights,e.intf.resize=e.resize,e.intf.selectColumn=e.selectColumn,e.intf.selectRow=e.selectRow,e.intf.selectAll=e.selectAll,e.intf.selectNone=e.selectNone,e.intf.drawChildGrids=e.drawChildGrids,e.intf.assertPxColor=e.assertPxColor,e.intf.clearPxColorAssertions=e.clearPxColorAssertions,e.intf.integerToAlpha=e.integerToAlpha,e.intf.copy=e.copy,e.intf.setStyleProperty=e.setStyleProperty,Object.defineProperty(e.intf,"defaults",{get:function(){return{styles:e.defaults.styles.reduce(function(e,t){return e[t[0]]=t[1],e},{}),attributes:e.defaults.attributes.reduce(function(e,t){return e[t[0]]=t[1],e},{})}}}),e.styleKeys=Object.keys(e.intf.defaults.styles),e.styleKeys.map(function(t){return e.hyphenateProperty(t,!1)}).forEach(t),e.styleKeys.map(function(t){return e.hyphenateProperty(t,!0)}).forEach(t),e.DOMStyles=window.getComputedStyle(document.body,null),e.styleKeys.concat(Object.keys(e.DOMStyles)).forEach(function(t){o[t]=void 0,Object.defineProperty(o,t,{get:function(){return e.getStyleProperty(t)},set:function(o){e.initialized&&(e.appliedInlineStyles[t]=o),e.setStyleProperty(t,o)}})}),Object.defineProperty(e.intf,"shadowRoot",{get:function(){return e.shadowRoot}}),Object.defineProperty(e.intf,"activeCell",{get:function(){return e.activeCell}}),Object.defineProperty(e.intf,"hasFocus",{get:function(){return e.hasFocus}}),Object.defineProperty(e.intf,"style",{get:function(){return o},set:function(t){Object.keys(t).forEach(function(o){e.setStyleProperty(o,t[o],!0)}),e.draw(!0),e.dispatchEvent("stylechanged",{name:"style",value:t})}}),Object.defineProperty(e.intf,"attributes",{value:{}}),Object.keys(e.attributes).forEach(function(t){Object.defineProperty(e.intf.attributes,t,{get:function(){return e.attributes[t]},set:function(o){e.attributes[t]=o,"name"===t&&e.tryLoadStoredSettings(),e.draw(!0),e.dispatchEvent("attributechanged",{name:t,value:o[t]})}})}),e.filters.string=function(t,o){t=String(t);var r,n=/\/(i|g|m)*$/,l=n.exec(o),i=l?l[0].substring(1):"",a=i.length;if(e.invalidFilterRegEx=void 0,"/"===o.substring(0,1)&&l){try{r=new RegExp(o.substring(1,o.length-(a+1)),i)}catch(t){return void(e.invalidFilterRegEx=t)}return r.test(t)}return!!t.toString&&-1!==t.toString().toLocaleUpperCase().indexOf(o.toLocaleUpperCase())},e.filters.number=function(e,t){return!t||e===t},["formatters","filters","sorters"].forEach(e.initProp),e.applyComponentStyle(!1,e.intf),e.reloadStoredValues(),e.args.data&&(e.intf.data=e.args.data),(e.intf.innerText||e.intf.textContent)&&("application/x-canvas-datagrid"===e.intf.dataType&&(e.intf.dataType="application/json+x-canvas-datagrid"),e.intf.data=e.intf.innerText||e.intf.textContent),e.args.schema&&(e.intf.schema=e.args.schema),e.isChildGrid||!e.isComponent?requestAnimationFrame(function(){e.resize(!0)}):e.resize(!0),e.initialized=!0,e}},e.intf.blur=function(t){e.hasFocus=!1},e.intf.focus=function(){e.hasFocus=!0,e.controlInput.focus()},(e.shadowRoot||e.isChildGrid)&&(Object.defineProperty(e.intf,"height",{get:function(){return e.shadowRoot?e.shadowRoot.height:e.parentNode.height},set:function(t){e.shadowRoot?e.shadowRoot.height=t:e.parentNode.height=t,e.resize(!0)}}),Object.defineProperty(e.intf,"width",{get:function(){return e.shadowRoot?e.shadowRoot.width:e.parentNode.width},set:function(t){e.shadowRoot?e.shadowRoot.width=t:e.parentNode.width=t,e.resize(!0)}}),Object.defineProperty(e.intf,"parentNode",{get:function(){return e.parentNode},set:function(t){if(!e.isChildGrid)throw new TypeError("Cannot set property parentNode which has only a getter");e.parentNode=t}})),Object.defineProperty(e.intf,"visibleRowHeights",{get:function(){return e.visibleRowHeights}}),Object.defineProperty(e.intf,"openChildren",{get:function(){return e.openChildren}}),Object.defineProperty(e.intf,"childGrids",{get:function(){return Object.keys(e.childGrids).map(function(t){return e.childGrids[t]})}}),Object.defineProperty(e.intf,"isChildGrid",{get:function(){return e.isChildGrid}}),Object.defineProperty(e,"cursor",{get:function(){return e.parentNodeStyle.cursor},set:function(t){"cell"===t&&(t="default"),e.currentCursor!==t&&(e.parentNodeStyle.cursor=t,e.currentCursor=t)}}),Object.defineProperty(e.intf,"orderDirection",{get:function(){return e.orderDirection},set:function(t){"desc"!==t&&(t="asc"),e.orderDirection=t,e.order(e.orderBy,e.orderDirection)}}),Object.defineProperty(e.intf,"orderBy",{get:function(){return e.orderBy},set:function(t){if(void 0===e.getSchema().find(function(e){return e.name===t}))throw new Error("Cannot sort by unknown column name.");e.orderBy=t,e.order(e.orderBy,e.orderDirection)}}),e.isComponent&&(Object.defineProperty(e.intf,"offsetHeight",{get:function(){return e.canvas.offsetHeight}}),Object.defineProperty(e.intf,"offsetWidth",{get:function(){return e.canvas.offsetWidth}})),Object.defineProperty(e.intf,"scrollHeight",{get:function(){return e.scrollBox.scrollHeight}}),Object.defineProperty(e.intf,"scrollWidth",{get:function(){return e.scrollBox.scrollWidth}}),Object.defineProperty(e.intf,"scrollTop",{get:function(){return e.scrollBox.scrollTop},set:function(t){e.scrollBox.scrollTop=t}}),Object.defineProperty(e.intf,"scrollLeft",{get:function(){return e.scrollBox.scrollLeft},set:function(t){e.scrollBox.scrollLeft=t}}),Object.defineProperty(e.intf,"sizes",{get:function(){return e.sizes}}),Object.defineProperty(e.intf,"parentDOMNode",{get:function(){return e.parentDOMNode}}),Object.defineProperty(e.intf,"input",{get:function(){return e.input}}),Object.defineProperty(e.intf,"controlInput",{get:function(){return e.controlInput}}),Object.defineProperty(e.intf,"currentCell",{get:function(){return e.currentCell}}),Object.defineProperty(e.intf,"visibleCells",{get:function(){return e.visibleCells}}),Object.defineProperty(e.intf,"visibleRows",{get:function(){return e.visibleRows}}),Object.defineProperty(e.intf,"selections",{get:function(){return e.selections}}),Object.defineProperty(e.intf,"dragMode",{get:function(){return e.dragMode}}),Object.defineProperty(e.intf,"changes",{get:function(){return e.changes}}),e.intf.formatters=e.formatters,Object.defineProperty(e.intf,"dataType",{get:function(){return e.dataType},set:function(t){if(!e.parsers[t])throw new Error("No parser for MIME type "+t);e.dataType=t}}),e.eventNames.forEach(function(t){Object.defineProperty(e.intf,"on"+t,{get:function(){return e.componentL1Events[t]},set:function(o){e.events[t]=[],e.componentL1Events[t]=o,o&&e.addEventListener(t,o)}})}),Object.defineProperty(e.intf,"frozenRow",{get:function(){return e.frozenRow},set:function(t){if(isNaN(t))throw new TypeError("Expected value for frozenRow to be a number.");if(e.visibleRows.length0&&void 0===e.storedSettings&&e.autosize(),e.fitColumnToValues("cornerCell",!0),e.createRowOrders(),e.tryLoadStoredSettings(),e.dispatchEvent("datachanged",{data:e.data}),e.resize(!0)})}}),e.initScrollBox=function(){function t(t,o){if(isNaN(t))throw new Error("ScrollTop value must be a number");t<0&&(t=0),t>a&&(t=a),a<0&&(t=0),l=t,o||e.scroll()}function o(t,o){if(isNaN(t))throw new Error("ScrollLeft value must be a number");t<0&&(t=0),t>s&&(t=s),s<0&&(t=0),i=t,o||e.scroll()}var r=0,n=0,l=0,i=0,a=0,s=0,c=20,d=20;e.scrollBox.toString=function(){return'{"width": '+s.toFixed(2)+', "height": '+a.toFixed(2)+', "left": '+i.toFixed(2)+', "top": '+l.toFixed(2)+', "widthRatio": '+e.scrollBox.widthBoxRatio.toFixed(5)+', "heightRatio": '+e.scrollBox.heightBoxRatio.toFixed(5)+"}"},e.scrollBox.scrollTo=function(e,r,n){o(e,!0),t(r,n)},Object.defineProperty(e.scrollBox,"scrollBoxHeight",{get:function(){return c},set:function(e){c=e}}),Object.defineProperty(e.scrollBox,"scrollBoxWidth",{get:function(){return d},set:function(e){d=e}}),Object.defineProperty(e.scrollBox,"height",{get:function(){return r},set:function(e){r=e}}),Object.defineProperty(e.scrollBox,"width",{get:function(){return n},set:function(e){n=e}}),Object.defineProperty(e.scrollBox,"scrollTop",{get:function(){return l},set:t}),Object.defineProperty(e.scrollBox,"scrollLeft",{get:function(){return i},set:o}),Object.defineProperty(e.scrollBox,"scrollHeight",{get:function(){return a},set:function(e){l>e&&(l=Math.max(e,0)),a=e}}),Object.defineProperty(e.scrollBox,"scrollWidth",{get:function(){return s},set:function(e){i>e&&(i=Math.max(e,0)),s=e}})}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){function t(t){e.createInlineStyle(t,"canvas-datagrid-context-menu-item"+(e.mobile?"-mobile":"")),t.addEventListener("mouseover",function(){e.createInlineStyle(t,"canvas-datagrid-context-menu-item:hover")}),t.addEventListener("mouseout",function(){e.createInlineStyle(t,"canvas-datagrid-context-menu-item")})}function o(r,n,a,s){function c(){a.forEach(function(n){function l(e){e.relatedTarget===m||n.contextMenu.container===e.relatedTarget||s===e.relatedTarget||c===e.relatedTarget||n.contextMenu.container.contains(e.relatedTarget)||(n.contextMenu.dispose(),y.splice(y.indexOf(n.contextMenu),1),n.contextMenu=void 0,c.removeEventListener("mouseout",l),m.removeEventListener("mouseout",l),c.setAttribute("contextOpen","0"),c.setAttribute("opening","0"))}function i(t){if("1"===c.getAttribute("opening")&&"1"!==c.getAttribute("contextOpen")){var i=c.getBoundingClientRect();i={left:i.left+e.style.childContextMenuMarginLeft+m.offsetWidth,top:i.top+e.style.childContextMenuMarginTop,bottom:i.bottom,right:i.right},n.contextMenu=o(r,i,t,w),c.setAttribute("contextOpen","1"),c.addEventListener("mouseout",l),m.addEventListener("mouseout",l),y.push(n.contextMenu)}}function a(){var e;if("1"!==c.getAttribute("contextOpen")){if(c.setAttribute("opening","1"),"function"==typeof n.items)return void(void 0!==(e=n.items.apply(w,[function(e){i(e)}]))&&Array.isArray(e)&&i(e));i(n.items)}}var s,c=document.createElement("div");!function(o){function n(e){if(null!==e){if("function"==typeof e)return n(e(r));if("object"==typeof e)return void c.appendChild(e);t(c),c.innerHTML=e}}n(o.title),o.contextItemContainer=c,(o.items&&o.items.length>0||"function"==typeof o.items)&&(s=document.createElement("div"),e.createInlineStyle(s,"canvas-datagrid-context-child-arrow"),s.innerHTML=e.style.childContextMenuArrowHTML,c.appendChild(s),c.addEventListener("mouseover",a),c.addEventListener("mouseout",function(){c.setAttribute("opening","0")})),o.click&&c.addEventListener("click",function(t){o.click.apply(e,[t])})}(n),m.appendChild(c)})}function d(e){a[e].contextItemContainer.dispatchEvent(new Event("click"))}function u(){m.scrollTop>0?e.parentDOMNode.appendChild(x):x.parentNode&&x.parentNode.removeChild(x),m.scrollTop>=m.scrollHeight-m.offsetHeight&&p.parentNode?p.parentNode.removeChild(p):m.scrollHeight-m.offsetHeight>0&&!(m.scrollTop>=m.scrollHeight-m.offsetHeight)&&e.parentDOMNode.appendChild(p)}function h(t){return function o(){var r=e.attributes.contextHoverScrollAmount;"up"===t&&0===m.scrollTop||"down"===t&&m.scrollTop===m.scrollHeight||(m.scrollTop+="up"===t?-r:r,i=setTimeout(o,e.attributes.contextHoverScrollRateMs,t))}}function f(e){return function(){clearTimeout(i)}}var g,m=document.createElement("div"),x=document.createElement("div"),p=document.createElement("div"),y=[],v=-1,w={};if(!Array.isArray(a))throw new Error("createContextMenu expects an array.");return w.parentGrid=e.intf,w.parentContextMenu=s,w.container=m,function(){var t={},o=e.scrollOffset(e.canvas);void 0===l&&(l=e.style.contextMenuZIndex),c(),e.createInlineStyle(m,"canvas-datagrid-context-menu"+(e.mobile?"-mobile":"")),t.x=n.left-o.left,t.y=n.top-o.top,t.height=0,l+=1,m.style.position="absolute",x.style.color=e.style.contextMenuArrowColor,p.style.color=e.style.contextMenuArrowColor,[x,p].forEach(function(e){e.style.textAlign="center",e.style.position="absolute",e.style.zIndex=l+1}),m.style.zIndex=l,s&&s.inputDropdown&&(m.style.maxHeight=window.innerHeight-t.y-e.style.autocompleteBottomMargin+"px",m.style.minWidth=n.width+"px",t.y+=n.height),e.mobile&&(m.style.width=n.width+"px"),m.style.left=t.x+"px",m.style.top=t.y+"px",m.addEventListener("scroll",u),m.addEventListener("wheel",function(t){e.hasFocus&&(m.scrollTop+=t.deltaY,m.scrollLeft+=t.deltaX),u()}),x.innerHTML=e.style.contextMenuArrowUpHTML,p.innerHTML=e.style.contextMenuArrowDownHTML,m.appendChild(x),document.body.appendChild(p),document.body.appendChild(m),g=m.getBoundingClientRect(),g.bottom>window.innerHeight&&(s&&s.inputDropdown||(t.y-=g.bottom+e.style.contextMenuWindowMargin-window.innerHeight),t.y<0&&(t.y=e.style.contextMenuWindowMargin),m.offsetHeight>window.innerHeight-e.style.contextMenuWindowMargin&&(m.style.height=window.innerHeight-2*e.style.contextMenuWindowMargin+"px")),g.right>window.innerWidth&&(t.x-=g.right-window.innerWidth+e.style.contextMenuWindowMargin),t.x<0&&(t.x=e.style.contextMenuWindowMargin),t.y<0&&(t.y=e.style.contextMenuWindowMargin),m.style.left=t.x+"px",m.style.top=t.y+"px",g=m.getBoundingClientRect(),x.style.top=g.top+"px",p.style.top=g.top+g.height-p.offsetHeight+"px",x.style.left=g.left+"px",p.style.left=g.left+"px",p.style.width=m.offsetWidth+"px",x.style.width=m.offsetWidth+"px",p.addEventListener("mouseover",h("down")),p.addEventListener("mouseout",f("down")),x.addEventListener("mouseover",h("up")),x.addEventListener("mouseout",f("up")),u()}(),w.clickIndex=d,w.rect=g,w.items=a,w.upArrow=x,w.downArrow=p,w.dispose=function(){clearTimeout(i),y.forEach(function(e){e.dispose()}),[p,x,m].forEach(function(e){e.parentNode&&e.parentNode.removeChild(e)})},Object.defineProperty(w,"selectedIndex",{get:function(){return v},set:function(t){if("number"!=typeof t||isNaN(t||!isFinite(t)))throw new Error("Context menu selected index must be a sane number.");v=t,v>a.length-1&&(v=a.length-1),v<0&&(v=0),a.forEach(function(t,o){if(o===v)return e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item:hover");e.createInlineStyle(t.contextItemContainer,"canvas-datagrid-context-menu-item")})}}),w}function r(t){function r(){h.style.background=e.style.contextFilterInputBackground,h.style.color=e.style.contextFilterInputColor,e.invalidFilterRegEx&&(h.style.background=e.style.contextFilterInvalidRegExpBackground,h.style.color=e.style.contextFilterInvalidRegExpColor)}function n(){var o=0;i={},e.data.forEach(function(r){var n=r[t.cell.header.name];i[n]||o>e.attributes.maxAutoCompleteItems||(o+=1,i[n]={title:e.formatters[t.cell.header.type||"string"]({cell:{value:n}}),click:function(t){h.value=n,t.stopPropagation(),h.dispatchEvent(new Event("keyup")),e.disposeAutocomplete()}})}),i=Object.keys(i).map(function(e){return i[e]})}function l(e){e&&-1!==[40,38,13,9].indexOf(e.keyCode)||(n(),s=h.getBoundingClientRect(),a&&(a.dispose(),a=void 0),a=o(t,{left:s.left,top:s.top,right:s.right,bottom:s.bottom,height:s.height,width:s.width},i,{inputDropdown:!0}),a.selectedIndex=0)}var i,s,c=document.createElement("div"),d=document.createElement("div"),u=document.createElement("button"),h=document.createElement("input"),f=t.cell&&t.cell.header?t.cell.header.title||t.cell.header.name:"";e.createInlineStyle(d,"canvas-datagrid-context-menu-label"),e.createInlineStyle(u,"canvas-datagrid-context-menu-filter-button"),e.createInlineStyle(h,"canvas-datagrid-context-menu-filter-input"),r(),h.onclick=e.disposeAutocomplete,h.addEventListener("keydown",function(t){40===t.keyCode&&(a.selectedIndex+=1),38===t.keyCode&&(a.selectedIndex-=1),13===t.keyCode&&(a.clickIndex(a.selectedIndex),e.disposeContextMenu()),9===t.keyCode&&(a.clickIndex(a.selectedIndex),t.preventDefault()),27===t.keyCode&&e.disposeContextMenu()}),h.addEventListener("keyup",function(){e.setFilter(t.cell.header.name,h.value)}),h.addEventListener("keyup",l),["focus","blur","keydown","keyup","change"].forEach(function(e){h.addEventListener(e,r)}),h.value=t.cell.header?e.columnFilters[t.cell.header.name]||"":"",d.innerHTML=e.attributes.filterOptionText.replace(/%s/g,f),u.onclick=function(){if(a)return e.disposeAutocomplete();l()},u.innerHTML=e.style.contextFilterButtonHTML,c.addEventListener("click",function(e){return e.stopPropagation()}),c.appendChild(d),c.appendChild(h),c.appendChild(u),t.items.push({title:c}),Object.keys(e.columnFilters).length&&Object.keys(e.columnFilters).forEach(function(o){var r=e.getHeaderByName(o);t.items.push({title:e.attributes.removeFilterOptionText.replace(/%s/g,r.title||r.name),click:function(t){t.preventDefault(),e.setFilter(o,""),e.controlInput.focus()}})})}function n(o){var n=!(o.cell.isBackground||o.cell.isColumnHeaderCellCap||o.cell.isScrollBar||o.cell.isCorner||o.cell.isRowHeader)&&o.cell.header;e.attributes.showFilter&&n&&r(o),e.attributes.showCopy&&e.selections.reduce(function(e,t){return e+t.length},0)>0&&o.items.push({title:e.attributes.copyText,click:function(){document.execCommand("copy"),e.disposeContextMenu(),e.controlInput.focus()}}),e.attributes.showPaste&&e.clipBoardData&&o.items.push({title:e.attributes.pasteText,click:function(){e.paste(e.clipBoardData,o.cell.columnIndex,o.cell.rowIndex),e.draw()}}),e.attributes.showColumnSelector&&(o.items.push({title:e.attributes.columnSelectorText,items:function(){var o=[];return e.getSchema().forEach(function(r){function n(t){r.hidden=!r.hidden,e.dispatchEvent("togglecolumn",{column:r,hidden:r.hidden}),t.preventDefault(),e.stopPropagation(t),e.disposeContextMenu(),e.resize(!0),e.setStorageData()}var l=document.createElement("div");t(l),l.addEventListener("touchstart",n),l.addEventListener("click",n),l.innerHTML=(r.hidden?e.attributes.columnSelectorHiddenText:e.attributes.columnSelectorVisibleText)+(r.title||r.name),o.push({title:l})}),o}}),o.cell&&o.cell.header&&o.cell.columnIndex>-1&&o.items.push({title:e.attributes.hideColumnText.replace(/%s/gi,o.cell.header.title||o.cell.header.name),click:function(t){e.getSchema()[o.cell.columnIndex].hidden=!0,t.preventDefault(),e.stopPropagation(t),e.disposeContextMenu(),e.setStorageData(),setTimeout(function(){e.resize(!0)},10)}})),e.attributes.saveAppearance&&e.attributes.showClearSettingsOption&&(Object.keys(e.sizes.rows).length>0||Object.keys(e.sizes.columns).length>0)&&o.items.push({title:e.attributes.clearSettingsOptionText,click:function(t){t.preventDefault(),e.sizes.rows={},e.sizes.columns={},e.createRowOrders(),e.createColumnOrders(),e.storedSettings=void 0,e.dispatchEvent("resizecolumn",{columnWidth:e.style.cellWidth}),e.dispatchEvent("resizerow",{cellHeight:e.style.cellHeight}),e.setStorageData(),e.resize(!0),e.disposeContextMenu(),e.controlInput.focus()}}),e.attributes.allowSorting&&e.attributes.showOrderByOption&&n&&(o.items.push({title:e.attributes.showOrderByOptionTextAsc.replace("%s",o.cell.header.title||o.cell.header.name),click:function(t){t.preventDefault(),e.order(o.cell.header.name,"asc"),e.controlInput.focus()}}),o.items.push({title:e.attributes.showOrderByOptionTextDesc.replace("%s",o.cell.header.title||o.cell.header.name),click:function(t){t.preventDefault(),e.order(o.cell.header.name,"desc"),e.disposeContextMenu(),e.controlInput.focus()}}))}var l,i,a;e.disposeAutocomplete=function(){a&&(a.dispose(),a=void 0)},e.disposeContextMenu=function(){document.removeEventListener("click",e.disposeContextMenu),l=e.style.contextMenuZIndex,e.disposeAutocomplete(),e.contextMenu&&e.contextMenu.dispose(),e.contextMenu=void 0},e.contextmenuEvent=function(t,r){function l(){requestAnimationFrame(function(){document.addEventListener("click",e.disposeContextMenu),document.removeEventListener("mouseup",l)})}if(e.hasFocus||t.target===e.canvas){var i,a=[],s=r||e.getLayerPos(t),c={NativeEvent:t,cell:e.getCellAt(s.x,s.y),items:a};c.cell.isGrid||n(c),e.dispatchEvent("contextmenu",c)||c.cell.isGrid||(e.contextMenu&&e.disposeContextMenu(),i={left:s.x+s.rect.left+e.style.contextMenuMarginLeft+e.canvasOffsetLeft,top:s.y+s.rect.top+e.style.contextMenuMarginTop+e.canvasOffsetTop,right:c.cell.width+c.cell.x+s.rect.left,bottom:c.cell.height+c.cell.y+s.rect.top,height:c.cell.height,width:c.cell.width},e.mobile&&(i.left=e.style.mobileContextMenuMargin+"px",i.width=e.width-2*e.style.mobileContextMenuMargin+"px"),e.contextMenu=o(c,i,a),document.addEventListener("mouseup",l),t.preventDefault())}}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){e.getClippingRect=function(t){var o=e.position(e.parentNode),r=e.position(t),n=e.scrollOffset(e.canvas),l={x:0,y:0,h:0,w:0},i={x:-1/0,y:-1/0,h:1/0,w:1/0},a=e.getColumnHeaderCellHeight(),s=e.getRowHeaderCellWidth();return o.top-=n.top,o.left-=n.left,r.top-=n.top,r.left-=n.left,l.h=o.top+o.height-t.offsetTop-e.style.scrollBarWidth,l.w=o.left+o.width-t.offsetLeft-e.style.scrollBarWidth,l.x=o.left+-1*r.left+s,l.y=o.top+-1*r.top+a,{x:l.x>i.x?l.x:i.x,y:l.y>i.y?l.y:i.y,h:l.he.data.length-1&&(l=0),e.scrollIntoView(r,l),e.beginEditAt(r,l,o)}}),e.dispatchEvent("beginedit",{cell:c,input:e.input}))}}},e.createInlineStyle=function(t,o){var r={"canvas-datagrid-context-menu-filter-input":{height:"19px",verticalAlign:"bottom",marginLeft:"2px",padding:"0",background:e.style.contextFilterInputBackground,color:e.style.contextFilterInputColor,border:e.style.contextFilterInputBorder,borderRadius:e.style.contextFilterInputBorderRadius,lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextFilterInputFontFamily,fontSize:e.style.contextFilterInputFontSize},"canvas-datagrid-context-menu-filter-button":{height:"19px",verticalAlign:"bottom",marginLeft:"2px",padding:"0",background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextFilterButtonBorder,borderRadius:e.style.contextFilterButtonBorderRadius,lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFilterButtonFontFamily,fontSize:e.style.contextMenuFilterButtonFontSize},"canvas-datagrid-context-child-arrow":{cssFloat:"right",color:e.style.childContextMenuArrowColor,fontSize:e.style.contextMenuChildArrowFontSize,fontFamily:e.style.contextMenuFontFamily,verticalAlign:"middle"},"canvas-datagrid-autocomplete":{fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,position:"absolute",zIndex:9999,overflow:"hidden"},"canvas-datagrid-autocomplete-item":{background:e.style.contextMenuBackground,color:e.style.contextMenuColor},"canvas-datagrid-autocomplete-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-canvas":{position:"absolute",zIndex:"-1"},"canvas-datagrid":{display:"block"},"canvas-datagrid-control-input":{position:"fixed",top:"-5px",left:"-5px",border:"none",opacity:"0",cursor:"pointer",width:"1px",height:"1px",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize},"canvas-datagrid-edit-mobile-input":{boxSizing:"content-box",outline:"none",margin:"0",padding:"0 0 0 0",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.mobileEditFontFamily,fontSize:e.style.mobileEditFontSize,border:e.style.editCellBorder,color:e.style.editCellColor,background:e.style.editCellBackgroundColor,appearance:"none",webkitAppearance:"none",mozAppearance:"none",borderRadius:"0"},"canvas-datagrid-edit-input":{boxSizing:"content-box",outline:"none",margin:"0",padding:"0 0 0 "+e.style.editCellPaddingLeft+"px",lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.editCellFontFamily,fontSize:e.style.editCellFontSize,boxShadow:e.style.editCellBoxShadow,border:e.style.editCellBorder,color:e.style.editCellColor,background:e.style.editCellBackgroundColor,appearance:"none",webkitAppearance:"none",mozAppearance:"none",borderRadius:"0"},"canvas-datagrid-context-menu-item-mobile":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-context-menu-item":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,color:"inherit",background:"inherit",margin:e.style.contextMenuItemMargin,borderRadius:e.style.contextMenuItemBorderRadius,verticalAlign:"middle"},"canvas-datagrid-context-menu-item:hover":{background:e.style.contextMenuHoverBackground,color:e.style.contextMenuHoverColor},"canvas-datagrid-context-menu-label":{margin:e.style.contextMenuLabelMargin,display:e.style.contextMenuLabelDisplay,minWidth:e.style.contextMenuLabelMinWidth,maxWidth:e.style.contextMenuLabelMaxWidth},"canvas-datagrid-context-menu-mobile":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden",whiteSpace:"nowrap"},"canvas-datagrid-context-menu":{lineHeight:"normal",fontWeight:"normal",fontFamily:e.style.contextMenuFontFamily,fontSize:e.style.contextMenuFontSize,background:e.style.contextMenuBackground,color:e.style.contextMenuColor,border:e.style.contextMenuBorder,padding:e.style.contextMenuPadding,borderRadius:e.style.contextMenuBorderRadius,opacity:e.style.contextMenuOpacity,overflow:"hidden",whiteSpace:"nowrap",cursor:e.style.contextMenuCursor},"canvas-datagrid-invalid-search-regExp":{background:e.style.contextMenuFilterInvalidExpresion}};r[o]&&Object.keys(r[o]).map(function(e){t.style[e]=r[o][e]})},e.appendTo=function(t){e.parentNode=t,e.setDom()},e.setDom=function(){e.isChildGrid?(e.parentGrid=e.parentNode.parentGrid,e.ctx=e.parentGrid.context,e.canvas=e.parentGrid.canvas,e.controlInput=e.parentGrid.controlInput,e.eventParent=e.canvas):(e.controlInput=e.controlInput||document.createElement("input"),e.controlInput.onblur=e.intf.blur,e.createInlineStyle(e.controlInput,"canvas-datagrid-control-input"),e.isChildGrid=!1,e.parentDOMNode=e.parentNode,e.parentIsCanvas=/^canvas$/i.test(e.parentDOMNode.tagName),e.parentIsCanvas?e.canvas=e.parentDOMNode:(e.canvas=document.createElement("canvas"),e.intf.createShadowRoot&&e.parentDOMNode.appendChild(e.canvas)),document.body.appendChild(e.controlInput),e.createInlineStyle(e.canvas,"canvas-datagrid"),e.ctx=e.canvas.getContext("2d"),e.ctx.textBaseline="alphabetic",e.eventParent=e.canvas),e.parentNodeStyle=e.canvas.style,e.controlInput.setAttribute("readonly",!0),e.controlInput.addEventListener("blur",function(t){t.target!==e.canvas&&(e.hasFocus=!1)}),e.eventParent.addEventListener("scroll",e.resize,!1),e.eventParent.addEventListener("touchstart",e.touchstart,!1),e.eventParent.addEventListener("mouseup",e.mouseup,!1),e.eventParent.addEventListener("mousedown",e.mousedown,!1),e.eventParent.addEventListener("dblclick",e.dblclick,!1),e.eventParent.addEventListener("click",e.click,!1),e.eventParent.addEventListener("mousemove",e.mousemove),e[e.isChildGrid?"parentGrid":"eventParent"].addEventListener("wheel",e.scrollWheel,!1),e.canvas.addEventListener("contextmenu",e.contextmenuEvent,!1),e.controlInput.addEventListener("copy",e.copy),e.controlInput.addEventListener("cut",e.cut),e.controlInput.addEventListener("paste",e.paste),e.controlInput.addEventListener("keypress",e.keypress,!1),e.controlInput.addEventListener("keyup",e.keyup,!1),e.controlInput.addEventListener("keydown",e.keydown,!1),window.addEventListener("resize",e.resize)}}}.apply(t,r))&&(e.exports=n)},function(e,t,o){var r,n;r=[],void 0!==(n=function(){"use strict";return function(e){e.integerToAlpha=function(e){for(var t="a".charCodeAt(0),o="z".charCodeAt(0),r=o-t+1,n="";e>=0;)n=String.fromCharCode(e%r+t)+n,e=Math.floor(e/r)-1;return n},e.insertColumn=function(t,o){var r=e.getSchema();if(r.length0&&r.y>0&&r.x+r.widths;s+=1)l(s)}o||r||(e.selections=[],e.activeCell.columnIndex=t,e.activeCell.rowIndex=e.scrollIndexTop),o&&e.isColumnSelected(t)?function(t){e.data.forEach(function(o,r){e.selections[r]=e.selections[r]||[],-1!==e.selections[r].indexOf(t)&&e.selections[r].splice(e.selections[r].indexOf(t),1)})}(t):l(t),n||e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.getSelectionBounds()})},e.selectRow=function(t,o,r,n){function l(){n||e.dispatchEvent("selectionchanged",{selectedData:e.getSelectedData(),selections:e.selections,selectionBounds:e.selectionBounds})}function i(t){e.selections[t]=[],e.selections[t].push(-1),d.forEach(function(o,r){e.selections[t].push(e.orders.columns.indexOf(o.index))})}var a,s,c,d=e.getVisibleSchema();if((!1===e.dragAddToSelection||void 0===e.dragObject)&&e.selections[t]&&e.selections[t].length-1===d.length&&o)return e.selections[t]=[],void l();if(!0===e.dragAddToSelection||void 0===e.dragObject)if(r&&void 0===e.dragObject){if(!e.activeCell)return;for(s=Math.min(e.activeCell.rowIndex,t),c=Math.max(e.activeCell.rowIndex,t),a=s;c>=a;a+=1)i(a)}else i(t);l()},e.collapseTree=function(t){e.dispatchEvent("collapsetree",{childGrid:e.childGrids[t],data:e.data[t],rowIndex:t}),e.openChildren[t].blur(),e.openChildren[t].dispose(),delete e.openChildren[t],delete e.sizes.trees[t],delete e.childGrids[t],e.dispatchEvent("resizerow",{cellHeight:e.style.cellHeight}),e.resize(!0),e.draw(!0)},e.expandTree=function(t){var o,r=e.args.treeGridAttributes||{},n=e.getColumnHeaderCellHeight(),l=e.sizes.columns.cornerCell||e.style.rowHeaderCellWidth,i=e.sizes.trees[t]||e.style.treeGridHeight;e.childGrids[t]||(r.debug=e.attributes.debug,r.name=e.attributes.saveAppearance?e.attributes.name+"tree"+t:void 0,r.style=r.style||e.style,r.parentNode={parentGrid:e.intf,nodeType:"canvas-datagrid-tree",offsetHeight:i,offsetWidth:e.width-l,header:{width:e.width-l},offsetLeft:l,offsetTop:n,offsetParent:e.intf.parentNode,parentNode:e.intf.parentNode,style:"tree",data:e.data[t]},o=e.createGrid(r),e.childGrids[t]=o),o=e.childGrids[t],o.visible=!0,e.dispatchEvent("expandtree",{treeGrid:o,data:e.data[t],rowIndex:t}),e.openChildren[t]=o,e.sizes.trees[t]=i,e.dispatchEvent("resizerow",{height:e.style.cellHeight}),e.resize(!0)},e.toggleTree=function(t){if(e.openChildren[t])return e.collapseTree(t);e.expandTree(t)},e.getHeaderByName=function(t){var o,r=e.getSchema();for(o=0;o0;var r,n=e.visibleCells.length;for(r=0;re.width||t.y<0||t.y>e.height)},e.moveSelection=function(t,o){var r=[];e.selections.forEach(function(e,n){r[n+o]=[],e.forEach(function(e){r[n+o].push(e+t)})}),e.selections=r},e.moveTo=function(t,o,r){var n,l=e.getSelectedData(),i=e.getVisibleSchema(),a=t.length,s=-1/0,c=1/0,d=r-1;t.forEach(function(t,r){r!==a&&0!==t.length&&(c=Math.min(e.getVisibleColumnIndexOf(o),c),s=Math.max(s,t.length),t.forEach(function(t){t=e.getVisibleColumnIndexOf(t),i[t]&&(e.data[r]||(e.data[r]={}),e.data[r][i[t].name]=null)}))}),t.forEach(function(t,r){var a;d+=1,n=e.getVisibleColumnIndexOf(o),t.forEach(function(t,o){t=e.getVisibleColumnIndexOf(t),o>0&&(n+=t-a),a=t,-1===t||!i[n]||!i[t]||e.data.length-10},e.isRowVisible=function(t){return e.visibleCells.filter(function(e){return e.rowIndex===t}).length>0},e.getVisibleCellByIndex=function(t,o){return e.visibleCells.filter(function(e){return e.columnIndex===t&&e.rowIndex===o})[0]},e.getCellAt=function(t,o,r){if(e.visibleCells){var n,l,i,a,s,c=r?e.attributes.touchScrollZone:0,d="move"===e.attributes.borderDragBehavior,u=e.visibleCells.length,h=d?e.cursorGrab:"ew-resize",f=d?e.cursorGrab:"ns-resize";if(e.visibleCells&&e.visibleCells.length){if(e.hasFocus=!0,!(o0&&t0))return e.hasFocus=!1,{dragContext:"inherit",context:"inherit"};for(l=0;lt&&s.y-e.style.cellBorderWidtho){if(/frozen-row-marker/.test(a.style))return a.dragContext=a.style,a.context="row-resize",a;if(/frozen-column-marker/.test(a.style))return a.dragContext=a.style,a.context="col-resize",a;if(/selection-handle-/.test(a.style))return a.dragContext=a.style,a.context="crosshair",a;if(/vertical-scroll-(bar|box)/.test(a.style))return a.dragContext="vertical-scroll-box",a.context="vertical-scroll-box",a.isScrollBar=!0,a.isVerticalScrollBar=!0,o>e.scrollBox.box.v.y+e.scrollBox.scrollBoxHeight?(a.dragContext="vertical-scroll-bottom",a.context="vertical-scroll-bottom"):oe.scrollBox.box.h.x+e.scrollBox.scrollBoxWidth?(a.dragContext="horizontal-scroll-right",a.context="horizontal-scroll-right"):tt?"r":r.x-.4*e.attributes.borderResizeZonet?"l":r.y+r.height-.4*e.attributes.borderResizeZoneo?"b":r.y-.4*e.attributes.borderResizeZoneo?"t":void 0}(s),i=d&&a.selectionBorder&&-1!==a.selectionBorder.indexOf(n),-1!==["l","r"].indexOf(n)&&(e.attributes.allowColumnResize||i)&&(e.attributes.allowColumnResizeFromCell&&a.isNormal||!a.isNormal||i)&&(e.attributes.allowRowHeaderResize&&(a.isRowHeader||a.isCorner)||!a.isRowHeader||!a.isCorner)){if((a.isColumnHeader||a.isCorner||e.attributes.allowColumnResizeFromCell&&a.isNormal)&&"r"===n)return a.context="ew-resize",a.dragContext="ew-resize",a;if(!a.isColumnHeader&&!a.isCorner&&i)return a.context=h,a.dragContext=n+"-move",a}if(-1!==["t","b"].indexOf(n)&&a.rowIndex>-1&&(e.attributes.allowRowResize||i)&&(e.attributes.allowRowResizeFromCell&&a.isNormal||!a.isNormal||i)&&!a.isColumnHeader){if((a.isRowHeader||a.isCorner||e.attributes.allowRowResizeFromCell&&a.isNormal)&&"b"===n)return a.context="ns-resize",a.dragContext="ns-resize",a;if(!a.isRowHeader&&!a.isCorner&&i)return a.context=f,a.dragContext=n+"-move",a}return"columnHeaderCell"===a.style?(a.context="cell",a.dragContext="column-reorder",a):"rowHeaderCell"===a.style?(e.attributes.rowGrabZoneSize+(a.y-e.style.cellBorderWidth)o.y?r:o.y,n=Math.max.apply(null,e),l=Math.min.apply(null,e),t.x=lo.x?n:o.x}),{top:t.y,left:t.x,bottom:o.y,right:o.x}},e.getSchemaFromData=function(t){return t=t||e.data,Object.keys(t[0]||{" ":""}).map(function(o,r){var n=e.getBestGuessDataType(o,t),l={name:o,title:isNaN(parseInt(o,10))?o:e.integerToAlpha(o).toUpperCase(),index:r,type:n,filter:e.filter(n)};return e.storedSettings&&e.storedSettings.visibility&&void 0!==e.storedSettings.visibility[l.name]&&(l.hidden=!e.storedSettings.visibility[l.name]),l})},e.clearChangeLog=function(){e.changes=[]},e.selectArea=function(t,o){e.selectionBounds=t||e.selectionBounds;var r,n,l,i=e.getSchema();if(o||(e.selections=[]),e.selectionBounds.top<-1||e.selectionBounds.bottom>e.data.length||e.selectionBounds.left<-1||e.selectionBounds.right>i.length)throw new Error("Impossible selection area");for(n=e.selectionBounds.top;n<=e.selectionBounds.bottom;n+=1)for(e.selections[n]=[],l=e.selectionBounds.left;l<=e.selectionBounds.right;l+=1)-1===e.selections[n].indexOf(l)&&e.selections[n].push(l);r={selections:e.selections,selectionBounds:e.selectionBounds},Object.defineProperty(r,"selectedData",{get:function(){return e.getSelectedData()}}),e.dispatchEvent("selectionchanged",r)},e.findColumnMaxTextLength=function(t){var o=-1/0;return"cornerCell"===t?(e.ctx.font=e.style.rowHeaderCellFont,e.ctx.measureText((e.data.length+(e.attributes.showNewRow?1:0)).toString()).width+e.style.autosizePadding+e.style.autosizeHeaderCellPadding+e.style.rowHeaderCellPaddingRight+e.style.rowHeaderCellPaddingLeft+(e.attributes.tree?e.style.treeArrowWidth+e.style.treeArrowMarginLeft+e.style.treeArrowMarginRight:0)):(e.getSchema().forEach(function(r){if(r.name===t){e.ctx.font=e.style.columnHeaderCellFont;var n=e.ctx.measureText(r.title||r.name).width+e.style.headerCellPaddingRight+e.style.headerCellPaddingLeft;o=n>o?n:o}}),e.data.forEach(function(r){e.ctx.font=e.style.cellFont;var n=e.ctx.measureText(r[t]).width+e.style.cellPaddingRight+e.style.cellPaddingLeft+e.style.cellAutoResizePadding;o=n>o?n:o}),o)},e.getHeaderWidth=function(){return e.getVisibleSchema().reduce(function(t,o){return t+(o.width||e.style.cellWidth)},0)},e.getRowHeight=function(t){return(e.sizes.rows[t]||e.style.cellHeight)*e.scale},e.getColummnWidth=function(t){return(e.sizes.columns[t]||e.getSchema()[t].width||e.style.cellWidth)*e.scale},e.formatters.string=function(e){return void 0!==e.cell.value?e.cell.value:""},e.formatters.rowHeaderCell=e.formatters.string,e.formatters.headerCell=e.formatters.string,e.formatters.number=e.formatters.string,e.formatters.int=e.formatters.string,e.formatters.html=e.formatters.string,e.sorters.string=function(e,t){var o="asc"===t;return function(t,r){return void 0===t[e]||null===t[e]?1:void 0===r[e]||null===r[e]?0:o?t[e].localeCompare?t[e].localeCompare(r[e]):1:r[e].localeCompare?r[e].localeCompare(t[e]):1}},e.sorters.number=function(e,t){var o="asc"===t;return function(t,r){return o?t[e]-r[e]:r[e]-t[e]}},e.sorters.date=function(e,t){var o="asc"===t;return function(t,r){return o?new Date(t[e]).getTime()-new Date(r[e]).getTime():new Date(r[e]).getTime()-new Date(t[e]).getTime()}}}}.apply(t,r))&&(e.exports=n)}])});
//# sourceMappingURL=canvas-datagrid.map |
|