gc.spread.sheets.vue.13.1.0.min.js 17 KB

123456789101112
  1. /*!
  2. *
  3. * SpreadJS Wrapper Components for Vue 13.1.0
  4. *
  5. * Copyright(c) GrapeCity, Inc. All rights reserved.
  6. *
  7. * Licensed under the SpreadJS Commercial License.
  8. * us.sales@grapecity.com
  9. * http://www.grapecity.com/licensing/grapecity/
  10. *
  11. */
  12. !function a(b,c){"object"==typeof exports&&"object"==typeof module?module.exports=c():"function"==typeof define&&define.amd?define([],c):"object"==typeof exports?exports.SpreadSheetsComponents=c():b.SpreadSheetsComponents=c()}(this,function(){return function(a){var b={};function c(d){if(b[d])return b[d].exports;var e=b[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,c),e.loaded=!0,e.exports}return c.m=a,c.c=b,c.p="",c(0)}([function(a,b,c){"use strict";Object.defineProperty(b,"__esModule",{value:!0});var d=c(1);Object.keys(d).forEach(function(a){"default"!==a&&"__esModule"!==a&&Object.defineProperty(b,a,{enumerable:!0,get:function b(){return d[a]}})})},function(a,b,c){"use strict";var d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;Object.defineProperty(b,"__esModule",{value:!0}),b.GcColumn=b.GcWorksheet=b.GcSpreadSheets=void 0,d=c(2),e=A(d),f=c(3),g=A(f);function A(a){return a&&a.__esModule?a:{default:a}}h="gc-spread-sheets",i="gc-worksheet",j="gc-column",k="gc-vue-sheet",l="gc-vue-column",m=200,n=20,o=new e.default,p=["hostStyle","hostClass","name","allowUserZoom","allowUserResize","allowUserDragMerge","allowUndo","allowSheetReorder","allowContextMenu","allowUserDeselect","allowUserEditFormula","autoFitType","allowUserDragFill","allowUserDragDrop","allowCopyPasteExcelStyle","allowExtendPasteRange","tabStripVisible","tabEditable","tabStripRatio","tabNavigationVisible","newTabVisible","highlightInvalidData","referenceStyle","resizeZeroIndicator","backColor","cutCopyIndicatorVisible","cutCopyIndicatorBorderColor","copyPasteHeaderOptions","grayAreaBackColor","backgroundImage","backgroundImageLayout","defaultDragFillType","enableFormulaTextbox","hideSelection","showVerticalScrollbar","showHorizontalScrollbar","showDragFillSmartTag","scrollbarShowMax","scrollbarMaxAlign","showScrollTip","showResizeTip","showDragDropTip","showDragFillTip","scrollIgnoreHidden","useTouchLayout"],q=g.default.createWatchData(p,"setSpreadOptions"),r=["name","frozenColumnCount","frozenRowCount","frozenTrailingColumnCount","frozenTrailingRowCount","allowCellOverflow","frozenlineColor","sheetTabColor","selectionPolicy","selectionUnit","zoom","currentTheme","clipBoardOptions","rowHeaderVisible","columnHeaderVisible","rowHeaderAutoText","columnHeaderAutoText","rowHeaderAutoTextIndex","columnHeaderAutoTextIndex","isProtected","showRowOutline","showColumnOutline","selectionBackColor","selectionBorderColor","defaultStyle","rowOutlineInfo","columnOutlineInfo","autoGenerateColumns"],s=g.default.createWatchData(r,"setSheetOptions"),t=["dataField","headerText","width","visible","resizable","autoFit","columnStyle","headerStyle","cellType","formatter"],u=g.default.createWatchData(t,"setColumnOptions"),v=(new e.default).$data.__ob__,w=v&&v.constructor;function B(a){a.__ob__=new w({})}e.default.component(h,{render:function a(b){return b("div",{class:this.hostClass,style:this.hostStyle,slot:i},[this.$slots.default])},props:p,data:function a(){return{spread:null,sheetCount:0,isInit:!1}},computed:{},mounted:function a(){this.ad()},methods:{ad:function a(){var b,c=this.$el,d=this.getSheetTagCount(),e=void 0;e=d>0?0:1,b=g.default.createWorkBook(c,e),B(b),this.spread=b,this.initSpread(),this.bindSpreadEvent(b)},getSheetTagCount:function a(){return this.$el.getElementsByClassName(k).length},bindSpreadEvent:function a(b){var c=this,d=["ValidationError","CellClick","CellDoubleClick","EnterCell","LeaveCell","ValueChanged","TopRowChanged","LeftColumnChanged","InvalidOperation","RangeFiltering","RangeFiltered","TableFiltering","TableFiltered","RangeSorting","RangeSorted","ClipboardChanging","ClipboardChanged","ClipboardPasting","ClipboardPasted","ColumnWidthChanging","ColumnWidthChanged","RowHeightChanging","RowHeightChanged","DragDropBlock","DragDropBlockCompleted","DragFillBlock","DragFillBlockCompleted","EditStarting","EditChange","EditEnding","EditEnd","EditEnded","RangeGroupStateChanging","RangeGroupStateChanged","SelectionChanging","SelectionChanged","SheetTabClick","SheetTabDoubleClick","SheetNameChanging","SheetNameChanged","UserZooming","UserFormulaEntered","CellChanged","ColumnChanged","RowChanged","ActiveSheetChanging","ActiveSheetChanged","SparklineChanged","RangeChanged","ButtonClicked","EditorStatusChanged","FloatingObjectChanged","FloatingObjectSelectionChanged","PictureChanged","FloatingObjectRemoving","FloatingObjectRemoved","PictureSelectionChanged","FloatingObjectLoaded","TouchToolStripOpening","CommentChanged","CommentRemoving","CommentRemoved","SlicerChanged"];d.forEach(function(a){g.default.bindEvent(b,a,function(){var b=arguments,d=a.charAt(0).toLocaleLowerCase()+a.substr(1);c.$emit(d,b[0],b[1])})})},getSheetCount:function a(){var b,c=0,d=this.$children.length;for(b=0;b<d;b++)this.$children[b].$options.name===i&&c++;return c},setSpreadOptions:function a(b,c){var d=this.spread;switch(b){case"name":d.name=c;break;case"allowUserZoom":case"allowUserResize":case"tabStripVisible":case"tabEditable":case"tabStripRatio":case"tabNavigationVisible":case"newTabVisible":case"allowUserEditFormula":case"allowUserDragFill":case"allowUserDragDrop":case"allowUserDragMerge":case"allowUndo":case"allowSheetReorder":case"allowContextMenu":case"allowUserDeselect":case"allowCopyPasteExcelStyle":case"allowExtendPasteRange":case"cutCopyIndicatorVisible":case"enableFormulaTextbox":case"highlightInvalidData":case"hideSelection":case"showVerticalScrollbar":case"showHorizontalScrollbar":case"showDragDropTip":case"showDragFillTip":case"showDragFillSmartTag":case"scrollbarShowMax":case"scrollbarMaxAlign":case"scrollIgnoreHidden":case"useTouchLayout":g.default.setSpreadOptions(d,b,!!c);break;case"autoFitType":case"referenceStyle":case"resizeZeroIndicator":case"backColor":case"cutCopyIndicatorBorderColor":case"copyPasteHeaderOptions":case"grayAreaBackColor":case"backgroundImage":case"backgroundImageLayout":case"defaultDragFillType":case"showScrollTip":case"showResizeTip":g.default.setSpreadOptions(d,b,c)}},initSpread:function a(){var b,c=p.length;for(b=0;b<c;b++)void 0!==this[p[b]]&&this.setSpreadOptions(p[b],this[p[b]]);this.$nextTick(function(){this.isInit||(this.$emit("workbookInitialized",this.spread),this.isInit=!0)})}},activated:function a(){this.ad()},deactivated:function a(){g.default.destroyedSpread(this.spread)},destroyed:function a(){g.default.destroyedSpread(this.spread)},watch:g.default.extendObejct({},q)}),e.default.component(i,{render:function a(b){return b("div",{class:k},[this.$slots.default])},props:r.concat(["dataSource","rowCount","colCount"]),data:function a(){return{sheet:null,sheetName:void 0}},computed:{spread:function a(){return this.$parent.spread}},methods:{getColCount:function a(){var b=this.$children.length,c=this.colCount,d=void 0;return b>0&&void 0!==c?d=this.colCount-b:b>0&&void 0===c?d=b:0===b&&void 0===c?d=n:0===b&&(d=this.colCount),d},initSheet:function a(){var b,c;this.spread&&(b=this.getSheetIndex(),c=g.default.addSheet(this.spread,this.name,b),B(c),this.sheet=c,this.sheetName=g.default.getSheetName(this.sheet),this.initSheetOptions())},getSheetIndex:function a(){var b,c=0,d=this.$parent.$el,e=this.$el,f=d.getElementsByClassName(k);for(b in f){if(f[b]===e)break;c++}return c},initSheetOptions:function a(){var b,c=r.length,d=void 0;for(b=0;b<c;b++)d=r[b],void 0!==this[d]&&this.setSheetOptions(d,this[d]);this.reSizeSheet(),this.$nextTick(function(){this.setSheetOptionsAfterSheetInit()})},setSheetOptionsAfterSheetInit:function a(){this.rowOutlineInfo&&g.default.setRowOutlineInfo(this.sheet,this.rowOutlineInfo),this.columnOutlineInfo&&g.default.setColumnOutlineInfo(this.sheet,this.columnOutlineInfo),this.frozenColumnCount&&g.default.setSheetAttribute(this.sheet,"frozenColumnCount",parseInt(this.frozenColumnCount,10))},setSheetOptions:function a(b,c){var d=this.sheet;switch(b){case"name":g.default.setSheetAttribute(d,b,c),this.sheetName=c;break;case"frozenColumnCount":case"frozenRowCount":case"frozenTrailingColumnCount":case"frozenTrailingRowCount":g.default.setSheetAttribute(d,b,parseInt(c,10));break;case"selectionPolicy":case"selectionUnit":case"zoom":case"currentTheme":case"showRowOutline":case"showColumnOutline":g.default.setSheetAttribute(d,b,c);break;case"autoGenerateColumns":g.default.setSheetAttributeData(d,b,c);break;case"isProtected":case"allowCellOverflow":case"frozenlineColor":case"sheetTabColor":case"clipBoardOptions":case"rowHeaderVisible":case"selectionBackColor":case"selectionBorderColor":case"rowHeaderAutoText":case"rowHeaderAutoTextIndex":g.default.setSheetOptions(d,b,c);break;case"columnHeaderAutoTextIndex":g.default.setSheetOptions(d,"colHeaderAutoTextIndex",c);break;case"columnHeaderVisible":g.default.setSheetOptions(d,"colHeaderVisible",c);break;case"columnHeaderAutoText":g.default.setSheetOptions(d,"colHeaderAutoText",c);break;case"defaultStyle":g.default.setSheetDefaultStyle(d,c);break;case"rowOutlineInfo":g.default.setRowOutlineInfo(d,c);break;case"columnOutlineInfo":g.default.setColumnOutlineInfo(d,c)}},reSizeSheet:function a(){var b="",c=this.dataSource,d=this.$children.length,e=this.colCount;switch(b+=null===c||void 0===c?"0":"1",b+=d>0?"1":"0",b+=e>0?"1":"0",g.default.setDataSource(this.sheet,null,!0),b){case"000":case"001":g.default.setColCount(this.sheet,this.colCount||n),g.default.setRowCount(this.sheet,this.rowCount||m);break;case"010":case"011":g.default.setColCount(this.sheet,0),g.default.setRowCount(this.sheet,this.rowCount||m);break;case"100":case"101":g.default.setDataSource(this.sheet,c,!0);break;case"110":case"111":g.default.setDataSource(this.sheet,c,!1),g.default.setColCount(this.sheet,0)}},dataSourceChangeHandle:function a(b,c){var d=this.$children.length;c&&!b?(g.default.setDataSource(this.sheet,null,!0),g.default.setRowCount(this.sheet,this.rowCount||m),g.default.setColCount(this.sheet,d||this.colCount||n)):c?g.default.setDataSource(this.sheet,b,!0):b&&(g.default.setDataSource(this.sheet,b,!0),d&&g.default.setColCount(this.sheet,d)),o.$emit("gc-sheet:dataSourceChanged",this.sheet.name()),this.frozenColumnCount&&g.default.setSheetAttribute(this.sheet,"frozenColumnCount",parseInt(this.frozenColumnCount,10))},rowCountChangeHandle:function a(){this.dataSource||g.default.setRowCount(this.sheet,this.rowCount||m)},colCountChangeHandle:function a(){var b=this.$children.length;this.dataSource||g.default.setColCount(this.sheet,b||this.colCount||n)}},mounted:function a(){var b=this;this.initSheet(),o.$on("gc-column:mounted",function(a,c){a===b.sheet&&0===c&&g.default.setColCount(b.sheet,1)}),o.$on("gc-column:destroyed",function(a,c){if(a===b.sheet){var d=b.$children.length;0===d&&(b.dataSource?(g.default.setDataSource(b.sheet,null,!0),g.default.setDataSource(b.sheet,b.dataSource,!0)):g.default.setColCount(b.sheet,b.colCount||n))}})},destroyed:function a(){var b=this.spread.getSheetIndex(this.sheet.name());null!==b&&this.spread.removeSheet(b)},watch:g.default.extendObejct({dataSource:function a(b,c){this.dataSourceChangeHandle(b,c)},colCount:function a(b,c){this.colCountChangeHandle(b,c)},rowCount:function a(){this.rowCountChangeHandle()},spread:function a(){this.initSheet()}},s)}),e.default.component(j,{render:function a(b){return b("div",{class:l})},props:t,data:function a(){return{columnIndex:void 0}},computed:{sheet:function a(){return this.$parent.sheet}},methods:{getColumnIndex:function a(){var b,c=0,d=this.$parent.$el,e=this.$el,f=d.getElementsByClassName(l);for(b=0;b<f.length;b++)f[b]===e&&(c=b);return c},setColumnOptions:function a(b,c){var d=this.sheet,e=this.getColumnIndex();switch(g.default.suspendPaint(d),g.default.suspendEvent(d),b){case"dataField":g.default.bindColumn(d,e,{name:c,displayName:this.headerText}),void 0!==this.width&&g.default.setColumnWidth(d,e,this.width),void 0!==this.visible&&g.default.setColumnVisible(d,e,this.visible),void 0!==this.resizable&&g.default.setColumnResizable(d,e,this.resizable);break;case"headerText":c&&g.default.bindColumn(d,e,{name:this.dataField,displayName:c}),void 0!==this.width&&g.default.setColumnWidth(d,e,this.width),void 0!==this.visible&&g.default.setColumnVisible(d,e,this.visible),void 0!==this.resizable&&g.default.setColumnResizable(d,e,this.resizable);break;case"width":g.default.setColumnWidth(d,e,c);break;case"visible":g.default.setColumnVisible(d,e,c);break;case"resizable":g.default.setColumnResizable(d,e,c);break;case"autoFit":c&&g.default.setAutoFitColumn(d,e);break;case"columnStyle":g.default.setColumnStyle(d,e,c);break;case"headerStyle":g.default.setHeaderStyle(d,e,c);break;case"cellType":g.default.setCellType(d,e,c);break;case"formatter":g.default.setFormatter(d,e,c)}g.default.resumeEvent(d),g.default.resumePaint(d)},initColumn:function a(){var b,c,d,e=this.getColumnIndex();for(this.columnIndex=e,g.default.addColumn(this.sheet,e),b=t.length,d=0;d<b;d++)c=t[d],void 0!==this[c]&&this.setColumnOptions(c,this[c])}},created:function a(){var b=this;o.$on("gc-sheet:dataSourceChanged",function(a){if(b.sheet&&(!b.sheet||b.sheet.name()===a)){var c=b.sheet,d=b.getColumnIndex();(b.headerText||b.dataField)&&g.default.bindColumn(b.sheet,b.getColumnIndex(),{name:b.dataField,displayName:b.headerText}),void 0!==b.width&&g.default.setColumnWidth(c,d,b.width),void 0!==b.visible&&g.default.setColumnVisible(c,d,b.visible),void 0!==b.resizable&&g.default.setColumnResizable(c,d,b.resizable)}}),o.$on("gc-column:mounted",function(a){!b.sheet||b.sheet&&b.sheet!==a||(b.columnIndex=b.getColumnIndex())})},beforeMount:function a(){var b,c=this.$parent.$el;c&&(b=c.getElementsByClassName(l),this.beforeMountCloumnTagCount=b.length)},mounted:function a(){this.sheet&&(this.initColumn(),o.$emit("gc-column:mounted",this.sheet,this.beforeMountCloumnTagCount))},destroyed:function a(){var b=this.columnIndex;this.sheet.getParent()&&(g.default.deleteColumn(this.sheet,b),o.$emit("gc-column:destroyed",this.sheet,b))},watch:g.default.extendObejct({sheet:function a(){this.sheet&&this.initColumn()}},u)}),x=b.GcSpreadSheets=e.default.options.components["gc-spread-sheets"],y=b.GcWorksheet=e.default.options.components["gc-worksheet"],z=b.GcColumn=e.default.options.components["gc-column"]},function(a,b){"use strict";Object.defineProperty(b,"__esModule",{value:!0});var c=window.Vue;b.default=c},function(a,b,c){"use strict";var d,e;Object.defineProperty(b,"__esModule",{value:!0}),d=c(4),e=f(d);function f(a){return a&&a.__esModule?a:{default:a}}b.default={extendObejct:function a(b,c){for(var d in c)c.hasOwnProperty(d)&&(b[d]=c[d]);return b},createWatchData:function a(b,c){var d,e={},f=b.length;for(d=0;d<f;d++)e[b[d]]=function(a){return function(b){this[c](a,b)}}(b[d]);return e},setSpreadOptions:function a(b,c,d){b.suspendPaint(),b.options[c]=d,b.resumePaint()},createWorkBook:function a(b,c){return new e.default.Spread.Sheets.Workbook(b,{sheetCount:c})},destroyedSpread:function a(b){b.destroy()},bindEvent:function a(b,c,d){var f=e.default.Spread.Sheets.Events;b.bind(f[c],d)},setSheetAttribute:function a(b,c,d){return b[c](d)},setSheetAttributeData:function a(b,c,d){return b[c]=d},setSheetOptions:function a(b,c,d){b.suspendPaint(),b.options[c]=d,b.resumePaint()},setRowCount:function a(b,c){b.suspendPaint(),b.setRowCount(c),b.resumePaint()},setFrozenColumnCount:function a(b,c){b.frozenColumnCount(c)},suspendPaint:function a(b){b.suspendPaint()},resumePaint:function a(b){b.resumePaint()},suspendEvent:function a(b){b.suspendEvent()},resumeEvent:function a(b){b.resumeEvent()},createSheet:function a(b){return new e.default.Spread.Sheets.Worksheet(b)},addSheet:function a(b,c,d){var e=this.createSheet(c);return void 0===d&&(d=b.getSheetCount()),b.addSheet(d,e),e},getSheetName:function a(b){return b.name()},setSheetDefaultStyle:function a(b,c){b.suspendPaint(),b.setDefaultStyle(c),b.resumePaint()},setRowOutlineInfo:function a(b,c){b.suspendPaint(),c.forEach(function(a){b.rowOutlines.group(a.index,a.count)}),b.resumePaint()},setColumnOutlineInfo:function a(b,c){b.suspendPaint(),c.forEach(function(a){b.columnOutlines.group(a.index,a.count)}),b.resumePaint()},setDataSource:function a(b,c,d){b.suspendPaint(),b.setDataSource(c,d),b.resumePaint()},setColCount:function a(b,c){b.suspendPaint(),b.setColumnCount(c),b.resumePaint()},addColumn:function a(b,c){b.suspendPaint(),b.addColumns(c,1),b.resumePaint()},deleteColumn:function a(b,c){b.suspendPaint(),b.deleteColumns(c,1),b.resumePaint()},bindColumn:function a(b,c,d){b.suspendPaint(),b.bindColumn(c,d),b.resumePaint()},setColumnWidth:function a(b,c,d){b.suspendPaint(),d=parseInt(d,10),b.setColumnWidth(c,d),b.resumePaint()},setColumnVisible:function a(b,c,d){b.suspendPaint(),b.setColumnVisible(c,d),b.resumePaint()},setColumnResizable:function a(b,c,d){b.suspendPaint(),b.setColumnResizable(c,d),b.resumePaint()},setAutoFitColumn:function a(b,c){b.autoFitColumn(c)},setColumnStyle:function a(b,c,d){b.suspendPaint(),b.setStyle(-1,c,d),b.resumePaint()},setHeaderStyle:function a(b,c,d){b.suspendPaint(),b.setStyle(-1,c,d,e.default.Spread.Sheets.SheetArea.colHeader),b.resumePaint()},setCellType:function a(b,c,d){b.suspendPaint(),b.setCellType(-1,c,d),b.resumePaint()},setFormatter:function a(b,c,d){b.suspendPaint(),b.setFormatter(-1,c,d,e.default.Spread.Sheets.SheetArea.viewport),b.resumePaint()}}},function(a,b){"use strict";Object.defineProperty(b,"__esModule",{value:!0});var c=window.GC;b.default=c}])});