xspreadsheet.js.map 361.3 KB
{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/component/element.js","webpack:///./src/core/alphabet.js","webpack:///./src/core/cell_range.js","webpack:///./src/core/selector.js","webpack:///./src/core/scroll.js","webpack:///./src/core/history.js","webpack:///./src/core/clipboard.js","webpack:///./src/core/auto_filter.js","webpack:///./src/core/merge.js","webpack:///./src/core/helper.js","webpack:///./src/core/row.js","webpack:///./src/core/col.js","webpack:///./src/locale/locale.js","webpack:///./src/locale/en.js","webpack:///./src/core/validator.js","webpack:///./src/core/validation.js","webpack:///./src/core/data_proxy.js","webpack:///./src/component/event.js","webpack:///./src/config.js","webpack:///./src/component/resizer.js","webpack:///./src/component/scrollbar.js","webpack:///./src/component/selector.js","webpack:///./src/component/suggest.js","webpack:///./src/component/icon.js","webpack:///./src/component/calendar.js","webpack:///./src/component/datepicker.js","webpack:///./src/component/editor.js","webpack:///./src/component/contextmenu.js","webpack:///./src/core/font.js","webpack:///./src/core/cell.js","webpack:///./src/core/formula.js","webpack:///./src/core/format.js","webpack:///./src/canvas/draw.js","webpack:///./src/component/table.js","webpack:///./src/component/toolbar/item.js","webpack:///./src/component/tooltip.js","webpack:///./src/component/toolbar/dropdown_item.js","webpack:///./src/component/dropdown.js","webpack:///./src/component/dropdown_align.js","webpack:///./src/component/toolbar/align.js","webpack:///./src/component/toolbar/valign.js","webpack:///./src/component/toolbar/toggle_item.js","webpack:///./src/component/toolbar/autofilter.js","webpack:///./src/component/toolbar/bold.js","webpack:///./src/component/toolbar/italic.js","webpack:///./src/component/toolbar/strike.js","webpack:///./src/component/toolbar/underline.js","webpack:///./src/component/color_palette.js","webpack:///./src/component/dropdown_color.js","webpack:///./src/component/dropdown_linetype.js","webpack:///./src/component/border_palette.js","webpack:///./src/component/dropdown_border.js","webpack:///./src/component/toolbar/border.js","webpack:///./src/component/toolbar/icon_item.js","webpack:///./src/component/toolbar/clearformat.js","webpack:///./src/component/toolbar/paintformat.js","webpack:///./src/component/toolbar/text_color.js","webpack:///./src/component/toolbar/fill_color.js","webpack:///./src/component/dropdown_fontsize.js","webpack:///./src/component/toolbar/font_size.js","webpack:///./src/component/dropdown_font.js","webpack:///./src/component/toolbar/font.js","webpack:///./src/component/dropdown_format.js","webpack:///./src/component/toolbar/format.js","webpack:///./src/component/dropdown_formula.js","webpack:///./src/component/toolbar/formula.js","webpack:///./src/component/toolbar/freeze.js","webpack:///./src/component/toolbar/merge.js","webpack:///./src/component/toolbar/redo.js","webpack:///./src/component/toolbar/undo.js","webpack:///./src/component/toolbar/textwrap.js","webpack:///./src/component/toolbar/more.js","webpack:///./src/component/toolbar/index.js","webpack:///./src/component/modal.js","webpack:///./src/component/form_input.js","webpack:///./src/component/form_select.js","webpack:///./src/component/form_field.js","webpack:///./src/component/button.js","webpack:///./src/component/modal_validation.js","webpack:///./src/component/sort_filter.js","webpack:///./src/component/message.js","webpack:///./src/component/sheet.js","webpack:///./src/index.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","Element","tag","className","arguments","length","undefined","_classCallCheck","this","el","document","createElement","data","eventNames","handler","_eventNames$split2","_toArray","split","fen","oen","slice","eventName","test","window","navigator","userAgent","addEventListener","evt","k","button","stopPropagation","_this","keys","forEach","css","concat","_this$el","top","offsetTop","left","offsetLeft","height","offsetHeight","width","offsetWidth","v","scrollLeft","scrollTop","getBoundingClientRect","parentNode","_this2","_len","eles","Array","_key","childNodes","ele","child","arg","createTextNode","appendChild","contains","classList","add","remove","cls","toggleClass","toggle","flag","addClass","removeClass","active","_this3","setAttribute","getAttribute","removeAttribute","content","innerHTML","_this4","_len2","_key2","style","removeProperty","_this5","getComputedStyle","h","alphabets","stringAt","index","str","cindex","parseInt","last","indexAt","ret","charCodeAt","exponet","Math","pow","expr2xy","src","x","y","charAt","xy2expr","expr2expr","xn","yn","_expr2xy2","_slicedToArray","CellRange","sri","sci","eri","eci","w","cell_range_classCallCheck","ref","refs","_expr2xy4","cell_range_slicedToArray","_expr2xy6","ri","ci","args","_expr2xy","cb","rowFilter","j","other","addRet","push","dsr","dsc","der","dec","multiple","Selector","selector_classCallCheck","range","size","Scroll","scroll_classCallCheck","History","history_classCallCheck","undoItems","redoItems","JSON","stringify","currentd","canUndo","parse","pop","canRedo","Clipboard","clipboard_classCallCheck","state","cellRange","Filter","operator","auto_filter_classCallCheck","includes","Sort","order","AutoFilter","filters","sort","_ref","fitlers","map","it","getData","filter","getFilter","set","hrange","getCell","rset","Set","fset","_this$range","cell","ctext","text","_this$range2","cnt","valueOf","Merges","merge_classCallCheck","_","cr","within","intersects","union","deleteWithin","type","cbWithin","rn","cn","it1","merges","merge","toString","mergeDeep","sources","source","isArray","helper","cloneDeep","obj","apply","equals","obj1","obj2","v1","v2","ai","arrayEquals","a1","a2","sum","objOrAry","total","rangeEach","min","max","rangeSum","getv","rangeReduceIf","inits","initv","ifv","deleteProperty","oldv","Rows","len","row_classCallCheck","row","getOrNew","exceptSet","has","getHeight","sumHeight","cells","what","getCellOrNew","srcCellRange","dstCellRange","autofill","dsri","dsci","deri","deci","_srcCellRange$size","_srcCellRange$size2","row_slicedToArray","_dstCellRange$size","_dstCellRange$size2","drn","dcn","isAdd","dn","ii","jj","nri","nci","ncell","replace","word","result","exec","Number","substring","setCell","ncellmm","each","eachCells","ndata","rndata","deleteCell","entries","_ref2","_ref3","_ref4","_ref5","assign","Cols","indexWidth","minWidth","col_classCallCheck","col","getWidth","sumWidth","$lang","$messages","en","toolbar","undo","redo","paintformat","clearformat","format","fontName","fontSize","fontBold","fontItalic","underline","strike","color","bgcolor","border","align","valign","textwrap","freeze","autofilter","formula","more","contextmenu","copy","cut","paste","pasteValue","pasteFormat","insertRow","insertColumn","deleteRow","deleteColumn","deleteCellText","validation","normal","number","percent","rmb","usd","eur","date","time","datetime","duration","average","_if","and","or","required","notMatch","between","notBetween","notIn","equal","notEqual","lessThan","lessThanEqual","greaterThan","greaterThanEqual","error","pasteForMergedCell","calendar","weeks","months","cancel","save","ok","desc","asc","empty","dataValidation","criteria","modeType","column","list","phone","email","be","nbe","lt","lte","gt","gte","eq","neq","translate","messages","message","spreadsheet","tf","locale","lang","rules","returnMessage","Validator","validator_classCallCheck","Date","values","parseValue","_value","validator_slicedToArray","_value2","Validation","validator","validation_classCallCheck","nrefs","difference","Validations","errors","Map","_v$validator$validate2","validation_slicedToArray","validate","getByValidator","addRef","defaultSettings","view","documentElement","clientHeight","clientWidth","showGrid","showToolbar","showContextmenu","font","bold","italic","canPaste","dst","clone","_src$size2","data_proxy_slicedToArray","srn","scn","_dst$size2","copyPaste","rows","deleteCells","_cell$merge","cutPaste","clipboard","move","clear","setStyleBorder","bss","styles","cstyle","addStyle","DataProxy","settings","data_proxy_classCallCheck","cols","validations","hyperlinks","comments","selector","scroll","history","autoFilter","change","exceptRowSet","sortedRowMap","unsortedRowMap","changeData","_this$selector","_this$selector2","setData","_this6","isClear","isCopy","isCut","_this7","srcRange","_selector$range2","cri","cci","getFirstIncludes","_this8","unmerge","_selector$range","isSignleSelected","mergeIndexes","_merges$ii","mri","mci","splice","_cell$merge2","mrl","mcl","bottom","right","getCellMerge","_selector$size2","nfont","oldCell","oldText","setCellText","vIndex","findIndex","_this$selector3","_this$getSelectedRect","getSelectedRect","x1","y1","getRect","left0","top0","fsh","freezeTotalHeight","fsw","freezeTotalWidth","_getCellRowByY$call","scrollOffsety","frset","_getCellColByX$call","scrollOffsetx","_helper$rangeReduceIf2","totalWidth","totalHeight","_this$cellRect","cellRect","_this$selector$range","_cell$merge3","_this$selector$range2","_cell$merge4","_this9","_selector$size4","_selector$range3","_this10","_selector$range4","_this11","addFilter","setSort","resetAutoFilter","_this12","_autoFilter$filteredR","filteredRows","fary","from","oldAry","a","b","_this13","_this14","_this14$selector$rang","si","insert","shift","_this15","_selector$range5","_selector$range$size2","rsize","csize","fci","_helper$rangeReduceIf4","fri","_helper$rangeReduceIf6","_cell$merge5","cellStyle","defaultStyle","_this$selector4","getCellStyleOrDefault","_this$freeze","_this16","_this17","setHeight","_this18","setWidth","_this$settings","_this$freeze2","exceptRows","exceptRowTH","viewHeight","viewWidth","viewRange","filterIntersects","frary","_toConsumableArray","offset","rowHeight","colWidth","nstyle","_this19","target","fn","unbind","removeEventListener","unbindClickoutside","xclickoutside","body","bindClickoutside","detail","hide","mouseMoveUp","movefunc","upfunc","xEvtUp","calTouchDirection","spanx","spany","abs","cssPrefix","devicePixelRatio","Resizer","vertical","minDistance","resizer_classCallCheck","moving","children","hoverEl","on","mousedownHandler","lineEl","cRect","finishedFn","rect","line","show","startEvt","distance","e","buttons","movementX","movementY","Scrollbar","scrollbar_classCallCheck","moveFn","contentEl","_evt$target","contentDistance","cssKey","startZIndex","SelectorElement","component_selector_classCallCheck","cornerEl","areaEl","clipboardEl","autofillEl","calBRAreaOffset","ftwidth","ftheight","calTAreaOffset","calLAreaOffset","setBRAreaOffset","br","setAreaOffset","setTAreaOffset","setLAreaOffset","setLClipboardOffset","setClipboardOffset","setBRClipboardOffset","setTClipboardOffset","setAllAreaOffset","tl","setAllClipboardOffset","areaOffset","indexes","arange","lastri","lastci","freezeHeight","freezeWidth","setOffset","coffset","getClipboardRect","resetOffset","indexesUpdated","calSelectedRangeByStart","setIndexes","moveIndexes","resetAreaOffset","calSelectedRangeByEnd","_this$data$selector$r","setEnd","ern","ecn","showAutofill","hideAutofill","showClipboard","hideClipboard","inputEnter","preventDefault","filterItems","itemIndex","click","Suggest","items","itemClick","suggest_classCallCheck","cssRemoveKeys","parent","_el$html","startsWith","toUpperCase","title","item","label","html","suggest_toConsumableArray","input","keyCode","ctrlKey","Icon","icon_classCallCheck","_possibleConstructorReturn","_getPrototypeOf","iconNameEl","addMonth","step","setMonth","getMonth","weekday","setDate","getDay","Calendar","_h","calendar_classCallCheck","cvalue","headerLeftEl","bodyEl","buildAll","prev","next","calendar_toConsumableArray","week","selectChange","buildHeaderLeft","buildBody","getFullYear","_bodyEl$html","trs","year","month","cdate","startDate","datess","disabled","getDate","monthDays","_h2","tds","Datepicker","datepicker_classCallCheck","setValue","RegExp","resetTextareaSize","inputText","textlineEl","textEl","tlineWidth","maxWidth","viewFn","twidth","h1","setText","position","blur","val","setTimeout","focus","setSelectionRange","Editor","formulas","editor_classCallCheck","suggest","start","lastIndexOf","sit","eit","indexOf","datepicker","dateFormat","search","bindInputEvents","setItems","suggestPosition","elOffset","sOffset","menuItems","buildMenu","ContextMenu","isHide","contextmenu_classCallCheck","contextmenu_toConsumableArray","_el$show$offset","baseFonts","fontSizes","pt","px","infixExprToSuffixExpr","operatorStack","stack","subStrs","fnArgType","fnArgOperator","fnArgsLen","join","c1","cell_slicedToArray","ex","ey","sx","sy","rangelen","nc","evalSubExpr","subExpr","cellRender","evalSuffixExpr","srcStack","formulaMap","cellList","expr","fc","Fn","Function","_expr","params","render","reverse","core_cell","getCellText","baseFormulas","ary","reduce","formula_toConsumableArray","formula_slicedToArray","f","every","some","formulam","formatStringRender","formatNumberRender","_v1$split2","format_toArray","toFixed","first","parts","format_toConsumableArray","baseFormats","formatm","dpr","thinLineWidth","npx","npxLine","DrawBox","padding","draw_classCallCheck","borderTop","borderRight","borderBottom","borderLeft","hoffset","drawFontLine","tx","ty","blheight","blwidth","floffset","Draw","ctx","getContext","resize","scale","clearRect","options","beginPath","restore","fillRect","fillText","txt","box","attr","textWrap","textx","textAlign","textBaseline","fillStyle","strokeStyle","txtWidth","measureText","ceil","innerWidth","texty","textLine","lineWidth","setLineDash","draw_slicedToArray","moveTo","lineTo","stroke","draw_toConsumableArray","topxys","rightxys","bottomxys","leftxys","closePath","fill","dtextcb","clip","cellPaddingWidth","tableFixedHeaderCleanStyle","tableGridStyle","getDrawBox","rindex","_data$cellRect","renderCell","draw","nrindex","dbox","setBorders","strokeBorders","cellText","_cell","getCellTextOrDefault","getFontSizePxByPt","getError","renderContent","fw","fh","exceptRowTotalHeight","filteredTranslateFunc","eachMergesInView","afRange","dropdown","renderSelectedHeaderCell","renderFixedHeaders","nty","ntx","_data$selector$range","rowEach","colEach","renderContentGrid","ch","cw","Table","table_classCallCheck","_data$scroll","_data$freeze","table_slicedToArray","vr","freezeViewRange","ftw","fth","theight","Item","shortcut","item_classCallCheck","tip","element","_target$getBoundingCl","elBox","removeChild","tooltip","DropdownItem","dd","getValue","_get","dropdown_item_getPrototypeOf","setTitle","Dropdown","showArrow","placement","dropdown_classCallCheck","dropdown_possibleConstructorReturn","dropdown_getPrototypeOf","headerEl","DropdownAlign","aligns","_getPrototypeOf2","dropdown_align_classCallCheck","icon","naligns","iconName","dropdown_align_possibleConstructorReturn","dropdown_align_getPrototypeOf","dropdown_align_toConsumableArray","setName","Align","align_classCallCheck","align_possibleConstructorReturn","align_getPrototypeOf","Valign","valign_classCallCheck","valign_possibleConstructorReturn","valign_getPrototypeOf","ToggleItem","toggle_item_get","toggle_item_getPrototypeOf","hasClass","Autofilter","autofilter_classCallCheck","autofilter_possibleConstructorReturn","autofilter_getPrototypeOf","Bold","bold_classCallCheck","bold_possibleConstructorReturn","bold_getPrototypeOf","Italic","italic_classCallCheck","italic_possibleConstructorReturn","italic_getPrototypeOf","Strike","strike_classCallCheck","strike_possibleConstructorReturn","strike_getPrototypeOf","Underline","underline_classCallCheck","underline_possibleConstructorReturn","underline_getPrototypeOf","themeColorPlaceHolders","themeColors","standardColors","buildTd","ColorPalette","_h4","color_palette_classCallCheck","table","color_palette_toConsumableArray","_h3","DropdownColor","dropdown_color_classCallCheck","colorPalette","dropdown_color_possibleConstructorReturn","dropdown_color_getPrototypeOf","lineTypes","DropdownLineType","dropdown_linetype_classCallCheck","beforei","lineTypeEls","iti","dropdown_linetype_possibleConstructorReturn","dropdown_linetype_getPrototypeOf","dropdown_linetype_toConsumableArray","buildTable","BorderPalette","border_palette_classCallCheck","ddColor","ddType","border_palette_slicedToArray","border_palette_toConsumableArray","DropdownBorder","dropdown_border_classCallCheck","borderPalette","dropdown_border_possibleConstructorReturn","dropdown_border_getPrototypeOf","Border","border_classCallCheck","border_possibleConstructorReturn","border_getPrototypeOf","IconItem","icon_item_get","icon_item_getPrototypeOf","Clearformat","clearformat_classCallCheck","clearformat_possibleConstructorReturn","clearformat_getPrototypeOf","Paintformat","paintformat_classCallCheck","paintformat_possibleConstructorReturn","paintformat_getPrototypeOf","TextColor","text_color_classCallCheck","text_color_possibleConstructorReturn","text_color_getPrototypeOf","FillColor","fill_color_classCallCheck","fill_color_possibleConstructorReturn","fill_color_getPrototypeOf","DropdownFontSize","dropdown_fontsize_classCallCheck","nfontSizes","dropdown_fontsize_possibleConstructorReturn","dropdown_fontsize_getPrototypeOf","dropdown_fontsize_toConsumableArray","Format","font_size_classCallCheck","font_size_possibleConstructorReturn","font_size_getPrototypeOf","DropdownFontsize","DropdownFont","dropdown_font_classCallCheck","nfonts","dropdown_font_possibleConstructorReturn","dropdown_font_getPrototypeOf","dropdown_font_toConsumableArray","Font","font_classCallCheck","font_possibleConstructorReturn","font_getPrototypeOf","DropdownFormat","dropdown_format_classCallCheck","nformats","dropdown_format_possibleConstructorReturn","dropdown_format_getPrototypeOf","dropdown_format_toConsumableArray","format_classCallCheck","format_possibleConstructorReturn","format_getPrototypeOf","DropdownFormula","dropdown_formula_classCallCheck","nformulas","dropdown_formula_possibleConstructorReturn","dropdown_formula_getPrototypeOf","dropdown_formula_toConsumableArray","formula_classCallCheck","formula_possibleConstructorReturn","formula_getPrototypeOf","Freeze","freeze_classCallCheck","freeze_possibleConstructorReturn","freeze_getPrototypeOf","Merge","toolbar_merge_classCallCheck","merge_possibleConstructorReturn","merge_getPrototypeOf","Redo","redo_classCallCheck","redo_possibleConstructorReturn","redo_getPrototypeOf","Undo","undo_classCallCheck","undo_possibleConstructorReturn","undo_getPrototypeOf","Textwrap","textwrap_classCallCheck","textwrap_possibleConstructorReturn","textwrap_getPrototypeOf","DropdownMore","more_classCallCheck","moreBtns","more_possibleConstructorReturn","more_getPrototypeOf","More","buildDivider","moreResize","_btns$html","_moreBtns$html","btns","moreEl","btns2","_moreEl$dd","widthFn","sumWidth2","list1","list2","toolbar_slicedToArray","Toolbar","toolbar_classCallCheck","undoEl","redoEl","paintformatEl","clearformatEl","formatEl","fontEl","fontSizeEl","FontSize","boldEl","italicEl","underlineEl","strikeEl","textColorEl","fillColorEl","borderEl","mergeEl","alignEl","valignEl","textwrapEl","freezeEl","autofilterEl","formulaEl","Formula","reset","_el$computedStyle","computedStyle","marginLeft","marginRight","_it$computedStyle","getSelectedCellStyle","getSelectedCell","setState","canUnmerge","canAutofilter","freezeIsActive","Modal","modal_classCallCheck","modal_toConsumableArray","dimmer","_this$el$show$box","_document$documentEle","xkeydownEsc","FormInput","hint","form_input_classCallCheck","vchange","FormSelect","getTitle","form_select_classCallCheck","itemEl","patterns","FormField","rule","labelWidth","form_field_classCallCheck","pattern","Button","button_classCallCheck","button_possibleConstructorReturn","button_getPrototypeOf","fieldLabelWidth","ModalValidation","modal_validation_classCallCheck","mf","rf","cf","criteriaSelected","of","criteriaOperatorSelected","minvf","maxvf","svf","vf","modal_validation_possibleConstructorReturn","modal_validation_getPrototypeOf","btnClick","action","attrs","field","isShow","clsName","buildSortItem","resetFilterHeader","filterhEl","filterValues","checked","SortFilter","sort_filter_classCallCheck","filterbEl","filterClick","sortAscEl","sortDescEl","sortDesc","tindex","xtoast","_el$box","selectorSet","selectorMove","direction","_selector$indexes","sheet_slicedToArray","_selector$moveIndexes","verticalScrollbar","horizontalScrollbar","_data$getSelectedRect","tableOffset","getTableOffset","verticalScrollbarSet","erth","horizontalScrollbarSet","sheetReset","tableEl","overlayerEl","overlayerCEl","tOffset","vRect","editor","fwidth","fheight","setFreezeLengths","clearClipboard","msg","overlayerMousedown","sortFilter","offsetX","offsetY","isAutofillEl","getCellRectByXY","getSort","shiftKey","_data$getCellRectByXY","paintformatActive","paintformatToggle","editorSetOffset","sPosition","editorSet","getSelectedValidator","dataSetCellText","setSelectedCellText","insertDeleteRowColumn","toolbarChange","_data$selector","setSelectedCellAttr","sheetInitEvents","end","startx","starty","rowResizer","colResizer","contextMenu","modalValidation","tRect","xyInSelectedRect","setPosition","delta","deltaY","_evt$touches$","touches","pageX","pageY","_evt$changedTouches$","changedTouches","_evt$changedTouches$2","setAutoFilter","scrolly","resetBRLAreaOffset","scrollx","resetBRTAreaOffset","itext","addValidation","removeValidation","getSelectedValidation","reload","focusing","which","altKey","metaKey","trigger","Sheet","targetEl","sheet_classCallCheck","_data$settings","setFreeze","_this$data","_this$getRect","Spreadsheet","selectors","src_classCallCheck","querySelector","rootEl","sheet","loadData"],"mappings":"aACA,IAAAA,EAAA,GAGA,SAAAC,EAAAC,GAGA,GAAAF,EAAAE,GACA,OAAAF,EAAAE,GAAAC,QAGA,IAAAC,EAAAJ,EAAAE,GAAA,CACAG,EAAAH,EACAI,GAAA,EACAH,QAAA,IAUA,OANAI,EAAAL,GAAAM,KAAAJ,EAAAD,QAAAC,IAAAD,QAAAF,GAGAG,EAAAE,GAAA,EAGAF,EAAAD,QAKAF,EAAAQ,EAAAF,EAGAN,EAAAS,EAAAV,EAGAC,EAAAU,EAAA,SAAAR,EAAAS,EAAAC,GACAZ,EAAAa,EAAAX,EAAAS,IACAG,OAAAC,eAAAb,EAAAS,EAAA,CAA0CK,YAAA,EAAAC,IAAAL,KAK1CZ,EAAAkB,EAAA,SAAAhB,GACA,oBAAAiB,eAAAC,aACAN,OAAAC,eAAAb,EAAAiB,OAAAC,YAAA,CAAwDC,MAAA,WAExDP,OAAAC,eAAAb,EAAA,cAAiDmB,OAAA,KAQjDrB,EAAAsB,EAAA,SAAAD,EAAAE,GAEA,GADA,EAAAA,IAAAF,EAAArB,EAAAqB,IACA,EAAAE,EAAA,OAAAF,EACA,KAAAE,GAAA,iBAAAF,QAAAG,WAAA,OAAAH,EACA,IAAAI,EAAAX,OAAAY,OAAA,MAGA,GAFA1B,EAAAkB,EAAAO,GACAX,OAAAC,eAAAU,EAAA,WAAyCT,YAAA,EAAAK,UACzC,E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yC,KAAKI,2DAsBxBuX,EAAMJ,GAClBG,EAAOC,EAAMJ,yCApBNnX,GAEP,OADAJ,KAAK8yC,MAAMC,SAAS3yC,GACbJ,uCAIP,OAAOA,KAAKI,KAAK+J,6CAKjB,OADwBnK,KAAKI,KAArBmb,YACW3C,OAAOxQ,MAAQ,iCAG7Bd,GAEL,OADAtH,KAAKI,KAAK0b,OAASxU,EACZtH,4CAQLwX,GAAc,SAACvX,GAAD,IAAKm1B,EAALx1B,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAe,GAAf,OAAsB,IAAI6yC,GAAYxyC,EAAIm1B,IAE1Dr0B,SACFA,OAAO8E,EAAI9E,OAAO8E,GAAK,GACvB9E,OAAO8E,EAAE2R,YAAcA,GACvBzW,OAAO8E,EAAE2R,YAAYE,OAAS,SAACC,EAAMJ,GAAP,OAAmBG,EAAOC,EAAMJ,KAGjDk7B","file":"xspreadsheet.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n","/* global document */\n/* global window */\nclass Element {\n  constructor(tag, className = '') {\n    if (typeof tag === 'string') {\n      this.el = document.createElement(tag);\n      this.el.className = className;\n    } else {\n      this.el = tag;\n    }\n    this.data = {};\n  }\n\n  data(key, value) {\n    if (value !== undefined) {\n      this.data[key] = value;\n      return this;\n    }\n    return this.data[key];\n  }\n\n  on(eventNames, handler) {\n    const [fen, ...oen] = eventNames.split('.');\n    let eventName = fen;\n    if (eventName === 'mousewheel' && /Firefox/i.test(window.navigator.userAgent)) {\n      eventName = 'DOMMouseScroll';\n    }\n    this.el.addEventListener(eventName, (evt) => {\n      handler(evt);\n      for (let i = 0; i < oen.length; i += 1) {\n        const k = oen[i];\n        if (k === 'left' && evt.button !== 0) {\n          return;\n        }\n        if (k === 'right' && evt.button !== 2) {\n          return;\n        }\n        if (k === 'stop') {\n          evt.stopPropagation();\n        }\n      }\n    });\n    return this;\n  }\n\n  offset(value) {\n    if (value !== undefined) {\n      Object.keys(value).forEach((k) => {\n        this.css(k, `${value[k]}px`);\n      });\n      return this;\n    }\n    const {\n      offsetTop, offsetLeft, offsetHeight, offsetWidth,\n    } = this.el;\n    return {\n      top: offsetTop,\n      left: offsetLeft,\n      height: offsetHeight,\n      width: offsetWidth,\n    };\n  }\n\n  scroll(v) {\n    const { el } = this;\n    if (v !== undefined) {\n      if (v.left !== undefined) {\n        el.scrollLeft = v.left;\n      }\n      if (v.top !== undefined) {\n        el.scrollTop = v.top;\n      }\n    }\n    return { left: el.scrollLeft, top: el.scrollTop };\n  }\n\n  box() {\n    return this.el.getBoundingClientRect();\n  }\n\n  parent() {\n    return new Element(this.el.parentNode);\n  }\n\n  children(...eles) {\n    if (arguments.length === 0) {\n      return this.el.childNodes;\n    }\n    eles.forEach(ele => this.child(ele));\n    return this;\n  }\n\n  /*\n  first() {\n    return this.el.firstChild;\n  }\n\n  last() {\n    return this.el.lastChild;\n  }\n\n  remove(ele) {\n    return this.el.removeChild(ele);\n  }\n\n  prepend(ele) {\n    const { el } = this;\n    if (el.children.length > 0) {\n      el.insertBefore(ele, el.firstChild);\n    } else {\n      el.appendChild(ele);\n    }\n    return this;\n  }\n\n  prev() {\n    return this.el.previousSibling;\n  }\n\n  next() {\n    return this.el.nextSibling;\n  }\n  */\n\n  child(arg) {\n    let ele = arg;\n    if (typeof arg === 'string') {\n      ele = document.createTextNode(arg);\n    } else if (arg instanceof Element) {\n      ele = arg.el;\n    }\n    this.el.appendChild(ele);\n    return this;\n  }\n\n  contains(ele) {\n    return this.el.contains(ele);\n  }\n\n  className(v) {\n    if (v !== undefined) {\n      this.el.className = v;\n      return this;\n    }\n    return this.el.className;\n  }\n\n  addClass(name) {\n    this.el.classList.add(name);\n    return this;\n  }\n\n  hasClass(name) {\n    return this.el.classList.contains(name);\n  }\n\n  removeClass(name) {\n    this.el.classList.remove(name);\n    return this;\n  }\n\n  toggle(cls = 'active') {\n    return this.toggleClass(cls);\n  }\n\n  toggleClass(name) {\n    return this.el.classList.toggle(name);\n  }\n\n  active(flag = true, cls = 'active') {\n    if (flag) this.addClass(cls);\n    else this.removeClass(cls);\n    return this;\n  }\n\n  checked(flag = true) {\n    this.active(flag, 'checked');\n    return this;\n  }\n\n  disabled(flag = true) {\n    if (flag) this.addClass('disabled');\n    else this.removeClass('disabled');\n    return this;\n  }\n\n  // key, value\n  // key\n  // {k, v}...\n  attr(key, value) {\n    if (value !== undefined) {\n      this.el.setAttribute(key, value);\n    } else {\n      if (typeof key === 'string') {\n        return this.el.getAttribute(key);\n      }\n      Object.keys(key).forEach((k) => {\n        this.el.setAttribute(k, key[k]);\n      });\n    }\n    return this;\n  }\n\n  removeAttr(key) {\n    this.el.removeAttribute(key);\n    return this;\n  }\n\n  html(content) {\n    if (content !== undefined) {\n      this.el.innerHTML = content;\n      return this;\n    }\n    return this.el.innerHTML;\n  }\n\n  val(v) {\n    if (v !== undefined) {\n      this.el.value = v;\n      return this;\n    }\n    return this.el.value;\n  }\n\n  cssRemoveKeys(...keys) {\n    keys.forEach(k => this.el.style.removeProperty(k));\n    return this;\n  }\n\n  // css( propertyName )\n  // css( propertyName, value )\n  // css( properties )\n  css(name, value) {\n    if (value === undefined && typeof name !== 'string') {\n      Object.keys(name).forEach((k) => {\n        this.el.style[k] = name[k];\n      });\n      return this;\n    }\n    if (value !== undefined) {\n      this.el.style[name] = value;\n      return this;\n    }\n    return this.el.style[name];\n  }\n\n  computedStyle() {\n    return window.getComputedStyle(this.el, null);\n  }\n\n  show() {\n    this.css('display', 'block');\n    return this;\n  }\n\n  hide() {\n    this.css('display', 'none');\n    return this;\n  }\n}\n\nconst h = (tag, className = '') => new Element(tag, className);\n\nexport {\n  Element,\n  h,\n};\n","const alphabets = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];\n\nexport function stringAt(index) {\n  let str = '';\n  let cindex = index;\n  while (cindex >= alphabets.length) {\n    cindex /= alphabets.length;\n    cindex -= 1;\n    str += alphabets[parseInt(cindex, 10) % alphabets.length];\n  }\n  const last = index % alphabets.length;\n  str += alphabets[last];\n  return str;\n}\n\nexport function indexAt(str) {\n  let ret = 0;\n  for (let i = 0; i < str.length - 1; i += 1) {\n    const cindex = str.charCodeAt(i) - 65;\n    const exponet = str.length - 1 - i;\n    ret += (alphabets.length ** exponet) + (alphabets.length * cindex);\n  }\n  ret += str.charCodeAt(str.length - 1) - 65;\n  return ret;\n}\n\n// B10 => x,y\nexport function expr2xy(src) {\n  let x = '';\n  let y = '';\n  for (let i = 0; i < src.length; i += 1) {\n    if (src.charAt(i) >= '0' && src.charAt(i) <= '9') {\n      y += src.charAt(i);\n    } else {\n      x += src.charAt(i);\n    }\n  }\n  return [indexAt(x), parseInt(y, 10) - 1];\n}\n\n// x,y => B10\nexport function xy2expr(x, y) {\n  return `${stringAt(x)}${y + 1}`;\n}\n\nexport function expr2expr(src, xn, yn) {\n  const [x, y] = expr2xy(src);\n  return xy2expr(x + xn, y + yn);\n}\n\nexport default {\n  stringAt,\n  indexAt,\n  expr2xy,\n  xy2expr,\n  expr2expr,\n};\n","import { xy2expr, expr2xy } from './alphabet';\n\nclass CellRange {\n  constructor(sri, sci, eri, eci, w = 0, h = 0) {\n    this.sri = sri;\n    this.sci = sci;\n    this.eri = eri;\n    this.eci = eci;\n    this.w = w;\n    this.h = h;\n  }\n\n  set(sri, sci, eri, eci) {\n    this.sri = sri;\n    this.sci = sci;\n    this.eri = eri;\n    this.eci = eci;\n  }\n\n  multiple() {\n    return this.eri - this.sri > 0 || this.eci - this.sci > 0;\n  }\n\n  // cell-index: ri, ci\n  // cell-ref: A10\n  includes(...args) {\n    let [ri, ci] = [0, 0];\n    if (args.length === 1) {\n      [ci, ri] = expr2xy(args[0]);\n    } else if (args.length === 2) {\n      [ri, ci] = args;\n    }\n    const {\n      sri, sci, eri, eci,\n    } = this;\n    return sri <= ri && ri <= eri && sci <= ci && ci <= eci;\n  }\n\n  each(cb, rowFilter = () => true) {\n    const {\n      sri, sci, eri, eci,\n    } = this;\n    for (let i = sri; i <= eri; i += 1) {\n      if (rowFilter(i)) {\n        for (let j = sci; j <= eci; j += 1) {\n          cb(i, j);\n        }\n      }\n    }\n  }\n\n  contains(other) {\n    return this.sri <= other.sri\n      && this.sci <= other.sci\n      && this.eri >= other.eri\n      && this.eci >= other.eci;\n  }\n\n  // within\n  within(other) {\n    return this.sri >= other.sri\n      && this.sci >= other.sci\n      && this.eri <= other.eri\n      && this.eci <= other.eci;\n  }\n\n  // disjoint\n  disjoint(other) {\n    return this.sri > other.eri\n      || this.sci > other.eci\n      || other.sri > this.eri\n      || other.sci > this.eci;\n  }\n\n  // intersects\n  intersects(other) {\n    return this.sri <= other.eri\n      && this.sci <= other.eci\n      && other.sri <= this.eri\n      && other.sci <= this.eci;\n  }\n\n  // union\n  union(other) {\n    const {\n      sri, sci, eri, eci,\n    } = this;\n    return new CellRange(\n      other.sri < sri ? other.sri : sri,\n      other.sci < sci ? other.sci : sci,\n      other.eri > eri ? other.eri : eri,\n      other.eci > eci ? other.eci : eci,\n    );\n  }\n\n  // intersection\n  // intersection(other) {}\n\n  // Returns Array<CellRange> that represents that part of this that does not intersect with other\n  // difference\n  difference(other) {\n    const ret = [];\n    const addRet = (sri, sci, eri, eci) => {\n      ret.push(new CellRange(sri, sci, eri, eci));\n    };\n    const {\n      sri, sci, eri, eci,\n    } = this;\n    const dsr = other.sri - sri;\n    const dsc = other.sci - sci;\n    const der = eri - other.eri;\n    const dec = eci - other.eci;\n    if (dsr > 0) {\n      addRet(sri, sci, other.sri - 1, eci);\n      if (der > 0) {\n        addRet(other.eri + 1, sci, eri, eci);\n        if (dsc > 0) {\n          addRet(other.sri, sci, other.eri, other.sci - 1);\n        }\n        if (dec > 0) {\n          addRet(other.sri, other.eci + 1, other.eri, eci);\n        }\n      } else {\n        if (dsc > 0) {\n          addRet(other.sri, sci, eri, other.sci - 1);\n        }\n        if (dec > 0) {\n          addRet(other.sri, other.eci + 1, eri, eci);\n        }\n      }\n    } else if (der > 0) {\n      addRet(other.eri + 1, sci, eri, eci);\n      if (dsc > 0) {\n        addRet(sri, sci, other.eri, other.sci - 1);\n      }\n      if (dec > 0) {\n        addRet(sri, other.eci + 1, other.eri, eci);\n      }\n    }\n    if (dsc > 0) {\n      addRet(sri, sci, eri, other.sci - 1);\n      if (dec > 0) {\n        addRet(sri, other.eri + 1, eri, eci);\n        if (dsr > 0) {\n          addRet(sri, other.sci, other.sri - 1, other.eci);\n        }\n        if (der > 0) {\n          addRet(other.sri + 1, other.sci, eri, other.eci);\n        }\n      } else {\n        if (dsr > 0) {\n          addRet(sri, other.sci, other.sri - 1, eci);\n        }\n        if (der > 0) {\n          addRet(other.sri + 1, other.sci, eri, eci);\n        }\n      }\n    } else if (dec > 0) {\n      addRet(eri, other.eci + 1, eri, eci);\n      if (dsr > 0) {\n        addRet(sri, sci, other.sri - 1, other.eci);\n      }\n      if (der > 0) {\n        addRet(other.eri + 1, sci, eri, other.eci);\n      }\n    }\n    return ret;\n  }\n\n  size() {\n    return [\n      this.eri - this.sri + 1,\n      this.eci - this.sci + 1,\n    ];\n  }\n\n  toString() {\n    const {\n      sri, sci, eri, eci,\n    } = this;\n    let ref = xy2expr(sci, sri);\n    if (this.multiple()) {\n      ref = `${ref}:${xy2expr(eci, eri)}`;\n    }\n    return ref;\n  }\n\n  clone() {\n    const {\n      sri, sci, eri, eci, w, h,\n    } = this;\n    return new CellRange(sri, sci, eri, eci, w, h);\n  }\n\n  /*\n  toJSON() {\n    return this.toString();\n  }\n  */\n\n  equals(other) {\n    return this.eri === other.eri\n      && this.eci === other.eci\n      && this.sri === other.sri\n      && this.sci === other.sci;\n  }\n\n  static valueOf(ref) {\n    // B1:B8, B1 => 1 x 1 cell range\n    const refs = ref.split(':');\n    const [sci, sri] = expr2xy(refs[0]);\n    let [eri, eci] = [sri, sci];\n    if (refs.length > 1) {\n      [eci, eri] = expr2xy(refs[1]);\n    }\n    return new CellRange(sri, sci, eri, eci);\n  }\n}\n\nexport default CellRange;\n\nexport {\n  CellRange,\n};\n","import { CellRange } from './cell_range';\n\nexport default class Selector {\n  constructor() {\n    this.range = new CellRange(0, 0, 0, 0);\n    this.ri = 0;\n    this.ci = 0;\n  }\n\n  multiple() {\n    return this.range.multiple();\n  }\n\n  setIndexes(ri, ci) {\n    this.ri = ri;\n    this.ci = ci;\n  }\n\n  size() {\n    return this.range.size();\n  }\n}\n","export default class Scroll {\n  constructor() {\n    this.x = 0; // left\n    this.y = 0; // top\n    this.ri = 0; // cell row-index\n    this.ci = 0; // cell col-index\n  }\n}\n","// import helper from '../helper';\n\nexport default class History {\n  constructor() {\n    this.undoItems = [];\n    this.redoItems = [];\n  }\n\n  add(data) {\n    this.undoItems.push(JSON.stringify(data));\n    this.redoItems = [];\n  }\n\n  canUndo() {\n    return this.undoItems.length > 0;\n  }\n\n  canRedo() {\n    return this.redoItems.length > 0;\n  }\n\n  undo(currentd, cb) {\n    const { undoItems, redoItems } = this;\n    if (this.canUndo()) {\n      redoItems.push(JSON.stringify(currentd));\n      cb(JSON.parse(undoItems.pop()));\n    }\n  }\n\n  redo(currentd, cb) {\n    const { undoItems, redoItems } = this;\n    if (this.canRedo()) {\n      undoItems.push(JSON.stringify(currentd));\n      cb(JSON.parse(redoItems.pop()));\n    }\n  }\n}\n","export default class Clipboard {\n  constructor() {\n    this.range = null; // CellRange\n    this.state = 'clear';\n  }\n\n  copy(cellRange) {\n    this.range = cellRange;\n    this.state = 'copy';\n    return this;\n  }\n\n  cut(cellRange) {\n    this.range = cellRange;\n    this.state = 'cut';\n    return this;\n  }\n\n  isCopy() {\n    return this.state === 'copy';\n  }\n\n  isCut() {\n    return this.state === 'cut';\n  }\n\n  isClear() {\n    return this.state === 'clear';\n  }\n\n  clear() {\n    this.range = null;\n    this.state = 'clear';\n  }\n}\n","import { CellRange } from './cell_range';\n// operator: all|eq|neq|gt|gte|lt|lte|in|be\n// value:\n//   in => []\n//   be => [min, max]\nclass Filter {\n  constructor(ci, operator, value) {\n    this.ci = ci;\n    this.operator = operator;\n    this.value = value;\n  }\n\n  set(operator, value) {\n    this.operator = operator;\n    this.value = value;\n  }\n\n  includes(v) {\n    const { operator, value } = this;\n    if (operator === 'all') {\n      return true;\n    }\n    if (operator === 'in') {\n      return value.includes(v);\n    }\n    return false;\n  }\n\n  vlength() {\n    const { operator, value } = this;\n    if (operator === 'in') {\n      return value.length;\n    }\n    return 0;\n  }\n\n  getData() {\n    const { ci, operator, value } = this;\n    return { ci, operator, value };\n  }\n}\n\nclass Sort {\n  constructor(ci, order) {\n    this.ci = ci;\n    this.order = order;\n  }\n\n  asc() {\n    return this.order === 'asc';\n  }\n\n  desc() {\n    return this.order === 'desc';\n  }\n}\n\nexport default class AutoFilter {\n  constructor() {\n    this.ref = null;\n    this.filters = [];\n    this.sort = null;\n  }\n\n  setData({ ref, filters, sort }) {\n    if (ref != null) {\n      this.ref = ref;\n      this.fitlers = filters.map(it => new Filter(it.ci, it.operator, it.value));\n      if (sort) {\n        this.sort = new Sort(sort.ci, sort.order);\n      }\n    }\n  }\n\n  getData() {\n    if (this.active()) {\n      const { ref, filters, sort } = this;\n      return { ref, filters: filters.map(it => it.getData()), sort };\n    }\n    return {};\n  }\n\n  addFilter(ci, operator, value) {\n    const filter = this.getFilter(ci);\n    if (filter == null) {\n      this.filters.push(new Filter(ci, operator, value));\n    } else {\n      filter.set(operator, value);\n    }\n  }\n\n  setSort(ci, order) {\n    this.sort = order ? new Sort(ci, order) : null;\n  }\n\n  includes(ri, ci) {\n    if (this.active()) {\n      return this.hrange().includes(ri, ci);\n    }\n    return false;\n  }\n\n  getSort(ci) {\n    const { sort } = this;\n    if (sort && sort.ci === ci) {\n      return sort;\n    }\n    return null;\n  }\n\n  getFilter(ci) {\n    const { filters } = this;\n    for (let i = 0; i < filters.length; i += 1) {\n      if (filters[i].ci === ci) {\n        return filters[i];\n      }\n    }\n    return null;\n  }\n\n  filteredRows(getCell) {\n    // const ary = [];\n    // let lastri = 0;\n    const rset = new Set();\n    const fset = new Set();\n    if (this.active()) {\n      const { sri, eri } = this.range();\n      const { filters } = this;\n      for (let ri = sri + 1; ri <= eri; ri += 1) {\n        for (let i = 0; i < filters.length; i += 1) {\n          const filter = filters[i];\n          const cell = getCell(ri, filter.ci);\n          const ctext = cell ? cell.text : '';\n          if (!filter.includes(ctext)) {\n            rset.add(ri);\n            break;\n          } else {\n            fset.add(ri);\n          }\n        }\n      }\n    }\n    return { rset, fset };\n  }\n\n  items(ci, getCell) {\n    const m = {};\n    if (this.active()) {\n      const { sri, eri } = this.range();\n      for (let ri = sri + 1; ri <= eri; ri += 1) {\n        const cell = getCell(ri, ci);\n        if (cell !== null && !/^\\s*$/.test(cell.text)) {\n          const key = cell.text;\n          const cnt = (m[key] || 0) + 1;\n          m[key] = cnt;\n        } else {\n          m[''] = (m[''] || 0) + 1;\n        }\n      }\n    }\n    return m;\n  }\n\n  range() {\n    return CellRange.valueOf(this.ref);\n  }\n\n  hrange() {\n    const r = this.range();\n    r.eri = r.sri;\n    return r;\n  }\n\n  clear() {\n    this.ref = null;\n    this.filters = [];\n    this.sort = null;\n  }\n\n  active() {\n    return this.ref !== null;\n  }\n}\n","import { CellRange } from './cell_range';\n\nclass Merges {\n  constructor(d = []) {\n    this._ = d;\n  }\n\n  forEach(cb) {\n    this._.forEach(cb);\n  }\n\n  deleteWithin(cr) {\n    this._ = this._.filter(it => !it.within(cr));\n  }\n\n  getFirstIncludes(ri, ci) {\n    for (let i = 0; i < this._.length; i += 1) {\n      const it = this._[i];\n      if (it.includes(ri, ci)) {\n        return it;\n      }\n    }\n    return null;\n  }\n\n  filterIntersects(cellRange) {\n    return new Merges(this._.filter(it => it.intersects(cellRange)));\n  }\n\n  intersects(cellRange) {\n    for (let i = 0; i < this._.length; i += 1) {\n      const it = this._[i];\n      if (it.intersects(cellRange)) {\n        // console.log('intersects');\n        return true;\n      }\n    }\n    return false;\n  }\n\n  union(cellRange) {\n    let cr = cellRange;\n    this._.forEach((it) => {\n      if (it.intersects(cr)) {\n        cr = it.union(cr);\n      }\n    });\n    return cr;\n  }\n\n  add(cr) {\n    this.deleteWithin(cr);\n    this._.push(cr);\n  }\n\n  // type: row | column\n  shift(type, index, n, cbWithin) {\n    this._.forEach((cellRange) => {\n      const {\n        sri, sci, eri, eci,\n      } = cellRange;\n      const range = cellRange;\n      if (type === 'row') {\n        if (sri >= index) {\n          range.sri += n;\n          range.eri += n;\n        } else if (sri < index && index <= eri) {\n          range.eri += n;\n          cbWithin(sri, sci, n, 0);\n        }\n      } else if (type === 'column') {\n        if (sci >= index) {\n          range.sci += n;\n          range.eci += n;\n        } else if (sci < index && index <= eci) {\n          range.eci += n;\n          cbWithin(sri, sci, 0, n);\n        }\n      }\n    });\n  }\n\n  move(cellRange, rn, cn) {\n    this._.forEach((it1) => {\n      const it = it1;\n      if (it.within(cellRange)) {\n        it.eri += rn;\n        it.sri += rn;\n        it.sci += cn;\n        it.eci += cn;\n      }\n    });\n  }\n\n  setData(merges) {\n    this._ = merges.map(merge => CellRange.valueOf(merge));\n    return this;\n  }\n\n  getData() {\n    return this._.map(merge => merge.toString());\n  }\n}\n\nexport default {};\nexport {\n  Merges,\n};\n","/* eslint-disable no-param-reassign */\nfunction cloneDeep(obj) {\n  return JSON.parse(JSON.stringify(obj));\n}\n\nconst mergeDeep = (object = {}, ...sources) => {\n  sources.forEach((source) => {\n    Object.keys(source).forEach((key) => {\n      const v = source[key];\n      // console.log('k:', key, ', v:', source[key], typeof v, v instanceof Object);\n      if (typeof v === 'string' || typeof v === 'number' || typeof v === 'boolean') {\n        object[key] = v;\n      } else if (typeof v !== 'function' && !Array.isArray(v) && v instanceof Object) {\n        object[key] = object[key] || {};\n        mergeDeep(object[key], v);\n      } else {\n        object[key] = v;\n      }\n    });\n  });\n  // console.log('::', object);\n  return object;\n};\n\nfunction equals(obj1, obj2) {\n  const keys = Object.keys(obj1);\n  if (keys.length !== Object.keys(obj2).length) return false;\n  for (let i = 0; i < keys.length; i += 1) {\n    const k = keys[i];\n    const v1 = obj1[k];\n    const v2 = obj2[k];\n    if (v2 === undefined) return false;\n    if (typeof v1 === 'string' || typeof v1 === 'number' || typeof v1 === 'boolean') {\n      if (v1 !== v2) return false;\n    } else if (Array.isArray(v1)) {\n      if (v1.length !== v2.length) return false;\n      for (let ai = 0; ai < v1.length; ai += 1) {\n        if (!equals(v1[ai], v2[ai])) return false;\n      }\n    } else if (typeof v1 !== 'function' && !Array.isArray(v1) && v1 instanceof Object) {\n      if (!equals(v1, v2)) return false;\n    }\n  }\n  return true;\n}\n\n/*\n  objOrAry: obejct or Array\n  cb: (value, index | key) => { return value }\n*/\nconst sum = (objOrAry, cb = value => value) => {\n  let total = 0;\n  let size = 0;\n  Object.keys(objOrAry).forEach((key) => {\n    total += cb(objOrAry[key], key);\n    size += 1;\n  });\n  return [total, size];\n};\n\nfunction deleteProperty(obj, property) {\n  const oldv = obj[`${property}`];\n  delete obj[`${property}`];\n  return oldv;\n}\n\nfunction rangeReduceIf(min, max, inits, initv, ifv, getv) {\n  let s = inits;\n  let v = initv;\n  let i = min;\n  for (; i < max; i += 1) {\n    if (s > ifv) break;\n    v = getv(i);\n    s += v;\n  }\n  return [i, s - v, v];\n}\n\nfunction rangeSum(min, max, getv) {\n  let s = 0;\n  for (let i = min; i < max; i += 1) {\n    s += getv(i);\n  }\n  return s;\n}\n\nfunction rangeEach(min, max, cb) {\n  for (let i = min; i < max; i += 1) {\n    cb(i);\n  }\n}\n\nfunction arrayEquals(a1, a2) {\n  if (a1.length === a2.length) {\n    for (let i = 0; i < a1.length; i += 1) {\n      if (a1[i] !== a2[i]) return false;\n    }\n  } else return false;\n  return true;\n}\n\nexport default {\n  cloneDeep,\n  merge: (...sources) => mergeDeep({}, ...sources),\n  equals,\n  arrayEquals,\n  sum,\n  rangeEach,\n  rangeSum,\n  rangeReduceIf,\n  deleteProperty,\n};\n","import helper from './helper';\nimport { expr2expr } from './alphabet';\n\nclass Rows {\n  constructor({ len, height }) {\n    this._ = {};\n    this.len = len;\n    // default row height\n    this.height = height;\n  }\n\n  getHeight(ri) {\n    const row = this.get(ri);\n    if (row && row.height) {\n      return row.height;\n    }\n    return this.height;\n  }\n\n  setHeight(ri, v) {\n    const row = this.getOrNew(ri);\n    row.height = v;\n  }\n\n  setStyle(ri, style) {\n    const row = this.getOrNew(ri);\n    row.style = style;\n  }\n\n  sumHeight(min, max, exceptSet) {\n    return helper.rangeSum(min, max, (i) => {\n      if (exceptSet && exceptSet.has(i)) return 0;\n      return this.getHeight(i);\n    });\n  }\n\n  totalHeight() {\n    return this.sumHeight(0, this.len);\n  }\n\n  get(ri) {\n    return this._[ri];\n  }\n\n  getOrNew(ri) {\n    this._[ri] = this._[ri] || { cells: {} };\n    return this._[ri];\n  }\n\n  getCell(ri, ci) {\n    const row = this.get(ri);\n    if (row !== undefined && row.cells !== undefined && row.cells[ci] !== undefined) {\n      return row.cells[ci];\n    }\n    return null;\n  }\n\n  getCellMerge(ri, ci) {\n    const cell = this.getCell(ri, ci);\n    if (cell && cell.merge) return cell.merge;\n    return [0, 0];\n  }\n\n  getCellOrNew(ri, ci) {\n    const row = this.getOrNew(ri);\n    row.cells[ci] = row.cells[ci] || {};\n    return row.cells[ci];\n  }\n\n  // what: all | text | format\n  setCell(ri, ci, cell, what = 'all') {\n    const row = this.getOrNew(ri);\n    if (what === 'all') {\n      row.cells[ci] = cell;\n    } else if (what === 'text') {\n      row.cells[ci] = row.cells[ci] || {};\n      row.cells[ci].text = cell.text;\n    } else if (what === 'format') {\n      row.cells[ci] = row.cells[ci] || {};\n      row.cells[ci].style = cell.style;\n      if (cell.merge) row.cells[ci].merge = cell.merge;\n    }\n  }\n\n  setCellText(ri, ci, text) {\n    const cell = this.getCellOrNew(ri, ci);\n    cell.text = text;\n  }\n\n  // what: all | format | text\n  copyPaste(srcCellRange, dstCellRange, what, autofill = false, cb = () => {}) {\n    const {\n      sri, sci, eri, eci,\n    } = srcCellRange;\n    const dsri = dstCellRange.sri;\n    const dsci = dstCellRange.sci;\n    const deri = dstCellRange.eri;\n    const deci = dstCellRange.eci;\n    const [rn, cn] = srcCellRange.size();\n    const [drn, dcn] = dstCellRange.size();\n    // console.log(srcIndexes, dstIndexes);\n    let isAdd = true;\n    let dn = 0;\n    if (deri < sri || deci < sci) {\n      isAdd = false;\n      if (deri < sri) dn = drn;\n      else dn = dcn;\n    }\n    // console.log('drn:', drn, ', dcn:', dcn, dn, isAdd);\n    for (let i = sri; i <= eri; i += 1) {\n      if (this._[i]) {\n        for (let j = sci; j <= eci; j += 1) {\n          if (this._[i].cells && this._[i].cells[j]) {\n            for (let ii = dsri; ii <= deri; ii += rn) {\n              for (let jj = dsci; jj <= deci; jj += cn) {\n                const nri = ii + (i - sri);\n                const nci = jj + (j - sci);\n                const ncell = helper.cloneDeep(this._[i].cells[j]);\n                // ncell.text\n                if (autofill && ncell && ncell.text && ncell.text.length > 0) {\n                  const { text } = ncell;\n                  let n = (jj - dsci) + (ii - dsri) + 2;\n                  if (!isAdd) {\n                    n -= dn + 1;\n                  }\n                  if (text[0] === '=') {\n                    ncell.text = text.replace(/\\w{1,3}\\d/g, (word) => {\n                      let [xn, yn] = [0, 0];\n                      if (sri === dsri) {\n                        xn = n - 1;\n                        // if (isAdd) xn -= 1;\n                      } else {\n                        yn = n - 1;\n                      }\n                      // console.log('xn:', xn, ', yn:', yn, word, expr2expr(word, xn, yn));\n                      return expr2expr(word, xn, yn);\n                    });\n                  } else {\n                    const result = /[\\\\.\\d]+$/.exec(text);\n                    // console.log('result:', result);\n                    if (result !== null) {\n                      const index = Number(result[0]) + n - 1;\n                      ncell.text = text.substring(0, result.index) + index;\n                    }\n                  }\n                }\n                // console.log('ncell:', nri, nci, ncell);\n                this.setCell(nri, nci, ncell, what);\n                cb(nri, nci, ncell);\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n\n  cutPaste(srcCellRange, dstCellRange) {\n    const ncellmm = {};\n    this.each((ri) => {\n      this.eachCells(ri, (ci) => {\n        let nri = parseInt(ri, 10);\n        let nci = parseInt(ci, 10);\n        if (srcCellRange.includes(ri, ci)) {\n          nri = dstCellRange.sri + (nri - srcCellRange.sri);\n          nci = dstCellRange.sci + (nci - srcCellRange.sci);\n        }\n        ncellmm[nri] = ncellmm[nri] || { cells: {} };\n        ncellmm[nri].cells[nci] = this._[ri].cells[ci];\n      });\n    });\n    this._ = ncellmm;\n  }\n\n  insert(sri, n = 1) {\n    const ndata = {};\n    this.each((ri, row) => {\n      let nri = parseInt(ri, 10);\n      if (nri >= sri) {\n        nri += n;\n      }\n      ndata[nri] = row;\n    });\n    this._ = ndata;\n    this.len += n;\n  }\n\n  delete(sri, eri) {\n    const n = eri - sri + 1;\n    const ndata = {};\n    this.each((ri, row) => {\n      const nri = parseInt(ri, 10);\n      if (nri < sri) {\n        ndata[nri] = row;\n      } else if (ri > eri) {\n        ndata[nri - n] = row;\n      }\n    });\n    this._ = ndata;\n    this.len -= n;\n  }\n\n  insertColumn(sci, n = 1) {\n    this.each((ri, row) => {\n      const rndata = {};\n      this.eachCells(ri, (ci, cell) => {\n        let nci = parseInt(ci, 10);\n        if (nci >= sci) {\n          nci += n;\n        }\n        rndata[nci] = cell;\n      });\n      row.cells = rndata;\n    });\n  }\n\n  deleteColumn(sci, eci) {\n    const n = eci - sci + 1;\n    this.each((ri, row) => {\n      const rndata = {};\n      this.eachCells(ri, (ci, cell) => {\n        const nci = parseInt(ci, 10);\n        if (nci < sci) {\n          rndata[nci] = cell;\n        } else if (nci > eci) {\n          rndata[nci - n] = cell;\n        }\n      });\n      row.cells = rndata;\n    });\n  }\n\n  // what: all | text | format | merge\n  deleteCells(cellRange, what = 'all') {\n    cellRange.each((i, j) => {\n      this.deleteCell(i, j, what);\n    });\n  }\n\n  // what: all | text | format | merge\n  deleteCell(ri, ci, what = 'all') {\n    const row = this.get(ri);\n    if (row !== null) {\n      const cell = this.getCell(ri, ci);\n      if (cell !== null) {\n        if (what === 'all') {\n          delete row.cells[ci];\n        } else if (what === 'text') {\n          if (cell.text) delete cell.text;\n          if (cell.value) delete cell.value;\n        } else if (what === 'format') {\n          if (cell.style !== undefined) delete cell.style;\n          if (cell.merge) delete cell.merge;\n        } else if (what === 'merge') {\n          if (cell.merge) delete cell.merge;\n        }\n      }\n    }\n  }\n\n  each(cb) {\n    Object.entries(this._).forEach(([ri, row]) => {\n      cb(ri, row);\n    });\n  }\n\n  eachCells(ri, cb) {\n    if (this._[ri] && this._[ri].cells) {\n      Object.entries(this._[ri].cells).forEach(([ci, cell]) => {\n        cb(ci, cell);\n      });\n    }\n  }\n\n  setData(d) {\n    if (d.len) {\n      this.len = d.len;\n      delete d.len;\n    }\n    this._ = d;\n  }\n\n  getData() {\n    const { len } = this;\n    return Object.assign({ len }, this._);\n  }\n}\n\nexport default {};\nexport {\n  Rows,\n};\n","import helper from './helper';\n\nclass Cols {\n  constructor({\n    len, width, indexWidth, minWidth,\n  }) {\n    this._ = {};\n    this.len = len;\n    this.width = width;\n    this.indexWidth = indexWidth;\n    this.minWidth = minWidth;\n  }\n\n  setData(d) {\n    if (d.len) {\n      this.len = d.len;\n      delete d.len;\n    }\n    this._ = d;\n  }\n\n  getData() {\n    const { len } = this;\n    return Object.assign({ len }, this._);\n  }\n\n  getWidth(i) {\n    const col = this._[i];\n    if (col && col.width) {\n      return col.width;\n    }\n    return this.width;\n  }\n\n  getOrNew(ci) {\n    this._[ci] = this._[ci] || {};\n    return this._[ci];\n  }\n\n  setWidth(ci, width) {\n    const col = this.getOrNew(ci);\n    col.width = width;\n  }\n\n  setStyle(ci, style) {\n    const col = this.getOrNew(ci);\n    col.style = style;\n  }\n\n  sumWidth(min, max) {\n    return helper.rangeSum(min, max, i => this.getWidth(i));\n  }\n\n  totalWidth() {\n    return this.sumWidth(0, this.len);\n  }\n}\n\nexport default {};\nexport {\n  Cols,\n};\n","/* global window */\nimport en from './en';\n\nlet $lang = 'en';\nconst $messages = {\n  en,\n};\n\nfunction translate(key, messages) {\n  if (messages && messages[$lang]) {\n    let message = messages[$lang];\n    const keys = key.split('.');\n    for (let i = 0; i < keys.length; i += 1) {\n      const property = keys[i];\n      const value = message[property];\n      if (i === keys.length - 1) return value;\n      if (!value) return undefined;\n      message = value;\n    }\n  }\n  return undefined;\n}\n\nfunction t(key) {\n  let v = translate(key, $messages);\n  if (!v && window && window.x && window.x.spreadsheet && window.x.spreadsheet.$messages) {\n    v = translate(key, window.x.spreadsheet.$messages);\n  }\n  return v || '';\n}\n\nfunction tf(key) {\n  return () => t(key);\n}\n\nfunction locale(lang, message) {\n  $lang = lang;\n  if (message) {\n    $messages[lang] = message;\n  }\n}\n\nexport default {\n  t,\n};\n\nexport {\n  locale,\n  t,\n  tf,\n};\n","export default {\n  toolbar: {\n    undo: 'Undo',\n    redo: 'Redo',\n    paintformat: 'Paint format',\n    clearformat: 'Clear format',\n    format: 'Format',\n    fontName: 'Font',\n    fontSize: 'Font size',\n    fontBold: 'Font bold',\n    fontItalic: 'Font italic',\n    underline: 'Underline',\n    strike: 'Strike',\n    color: 'Text color',\n    bgcolor: 'Fill color',\n    border: 'Borders',\n    merge: 'Merge cells',\n    align: 'Horizontal align',\n    valign: 'Vertical align',\n    textwrap: 'Text wrapping',\n    freeze: 'Freeze cell',\n    autofilter: 'Filter',\n    formula: 'Functions',\n    more: 'More',\n  },\n  contextmenu: {\n    copy: 'Copy',\n    cut: 'Cut',\n    paste: 'Paste',\n    pasteValue: 'Paste values only',\n    pasteFormat: 'Paste format only',\n    insertRow: 'Insert row',\n    insertColumn: 'Insert column',\n    deleteRow: 'Delete row',\n    deleteColumn: 'Delete column',\n    deleteCell: 'Delete cell',\n    deleteCellText: 'Delete cell text',\n    validation: 'Data validations',\n  },\n  format: {\n    normal: 'Normal',\n    text: 'Plain Text',\n    number: 'Number',\n    percent: 'Percent',\n    rmb: 'RMB',\n    usd: 'USD',\n    eur: 'EUR',\n    date: 'Date',\n    time: 'Time',\n    datetime: 'Date time',\n    duration: 'Duration',\n  },\n  formula: {\n    sum: 'Sum',\n    average: 'Average',\n    max: 'Max',\n    min: 'Min',\n    _if: 'IF',\n    and: 'AND',\n    or: 'OR',\n    concat: 'Concat',\n  },\n  validation: {\n    required: 'it must be required',\n    notMatch: 'it not match its validation rule',\n    between: 'it is between {} and {}',\n    notBetween: 'it is not between {} and {}',\n    notIn: 'it is not in list',\n    equal: 'it equal to {}',\n    notEqual: 'it not equal to {}',\n    lessThan: 'it less than {}',\n    lessThanEqual: 'it less than or equal to {}',\n    greaterThan: 'it greater than {}',\n    greaterThanEqual: 'it greater than or equal to {}',\n  },\n  error: {\n    pasteForMergedCell: 'Unable to do this for merged cells',\n  },\n  calendar: {\n    weeks: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],\n    months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],\n  },\n  button: {\n    cancel: 'Cancel',\n    remove: 'Remove',\n    save: 'Save',\n    ok: 'OK',\n  },\n  sort: {\n    desc: 'Sort Z -> A',\n    asc: 'Sort A -> Z',\n  },\n  filter: {\n    empty: 'empty',\n  },\n  dataValidation: {\n    mode: 'Mode',\n    range: 'Cell Range',\n    criteria: 'Criteria',\n    modeType: {\n      cell: 'Cell',\n      column: 'Colun',\n      row: 'Row',\n    },\n    type: {\n      list: 'List',\n      number: 'Number',\n      date: 'Date',\n      phone: 'Phone',\n      email: 'Email',\n    },\n    operator: {\n      be: 'between',\n      nbe: 'not betwwen',\n      lt: 'less than',\n      lte: 'less than or equal to',\n      gt: 'greater than',\n      gte: 'greater than or equal to',\n      eq: 'equal to',\n      neq: 'not equal to',\n    },\n  },\n};\n","import { t } from '../locale/locale';\nimport helper from './helper';\n\nconst rules = {\n  phone: /^[1-9]\\d{10}$/,\n  email: /w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*/,\n};\n\nfunction returnMessage(flag, key, ...arg) {\n  let message = '';\n  if (!flag) {\n    message = t(`validation.${key}`, ...arg);\n  }\n  return [flag, message];\n}\n\nexport default class Validator {\n  // operator: b|nb|eq|neq|lt|lte|gt|gte\n  // type: date|number|list|phone|email\n  constructor(type, required, value, operator) {\n    this.required = required;\n    this.value = value;\n    this.type = type;\n    this.operator = operator;\n    this.message = '';\n  }\n\n  parseValue(v) {\n    const { type } = this;\n    if (type === 'date') {\n      return new Date(v);\n    }\n    if (type === 'number') {\n      return Number(v);\n    }\n    return v;\n  }\n\n  equals(other) {\n    let flag = this.type === other.type\n      && this.required === other.required\n      && this.operator === other.operator;\n    if (flag) {\n      if (Array.isArray(this.value)) {\n        flag = helper.arrayEquals(this.value, other.value);\n      } else {\n        flag = this.value === other.value;\n      }\n    }\n    return flag;\n  }\n\n  values() {\n    return this.value.split(',');\n  }\n\n  validate(v) {\n    const {\n      required, operator, value, type,\n    } = this;\n    if (required && /^\\s*$/.test(v)) {\n      return returnMessage(false, 'required');\n    }\n    if (/^\\s*$/.test(v)) return [true];\n    if (rules[type] && !rules[type].test(v)) {\n      return returnMessage(false, 'notMatch');\n    }\n    if (type === 'list') {\n      return returnMessage(this.values().includes(v), 'notIn');\n    }\n    if (operator) {\n      const v1 = this.parseValue(v);\n      if (operator === 'be') {\n        const [min, max] = value;\n        return returnMessage(\n          v1 >= this.parseValue(min) && v1 <= this.parseValue(max),\n          'between',\n          min,\n          max,\n        );\n      }\n      if (operator === 'nbe') {\n        const [min, max] = value;\n        return returnMessage(\n          v1 < this.parseValue(min) || v1 > this.parseValue(max),\n          'notBetween',\n          min,\n          max,\n        );\n      }\n      if (operator === 'eq') {\n        return returnMessage(\n          v1 === this.parseValue(value),\n          'equal',\n          value,\n        );\n      }\n      if (operator === 'neq') {\n        return returnMessage(\n          v1 !== this.parseValue(value),\n          'notEqual',\n          value,\n        );\n      }\n      if (operator === 'lt') {\n        return returnMessage(\n          v1 < this.parseValue(value),\n          'lessThan',\n          value,\n        );\n      }\n      if (operator === 'lte') {\n        return returnMessage(\n          v1 <= this.parseValue(value),\n          'lessThanEqual',\n          value,\n        );\n      }\n      if (operator === 'gt') {\n        return returnMessage(\n          v1 > this.parseValue(value),\n          'greaterThan',\n          value,\n        );\n      }\n      if (operator === 'gte') {\n        return returnMessage(\n          v1 >= this.parseValue(value),\n          'greaterThanEqual',\n          value,\n        );\n      }\n    }\n    return [true];\n  }\n}\n","import Validator from './validator';\nimport { CellRange } from './cell_range';\n\nclass Validation {\n  constructor(mode, refs, validator) {\n    this.refs = refs;\n    this.mode = mode; // cell\n    this.validator = validator;\n  }\n\n  includes(ri, ci) {\n    const { refs } = this;\n    for (let i = 0; i < refs.length; i += 1) {\n      const cr = CellRange.valueOf(refs[i]);\n      if (cr.includes(ri, ci)) return true;\n    }\n    return false;\n  }\n\n  addRef(ref) {\n    this.remove(CellRange.valueOf(ref));\n    this.refs.push(ref);\n  }\n\n  remove(cellRange) {\n    const nrefs = [];\n    this.refs.forEach((it) => {\n      const cr = CellRange.valueOf(it);\n      if (cr.intersects(cellRange)) {\n        const crs = cr.difference(cellRange);\n        crs.forEach(it1 => nrefs.push(it1.toString()));\n      } else {\n        nrefs.push(it);\n      }\n    });\n    this.refs = nrefs;\n  }\n\n  getData() {\n    const { refs, mode, validator } = this;\n    const {\n      type, required, operator, value,\n    } = validator;\n    return {\n      refs, mode, type, required, operator, value,\n    };\n  }\n\n  static valueOf({\n    refs, mode, type, required, operator, value,\n  }) {\n    return new Validation(mode, refs, new Validator(type, required, value, operator));\n  }\n}\nclass Validations {\n  constructor() {\n    this._ = [];\n    // ri_ci: errMessage\n    this.errors = new Map();\n  }\n\n  getError(ri, ci) {\n    return this.errors.get(`${ri}_${ci}`);\n  }\n\n  validate(ri, ci, text) {\n    const v = this.get(ri, ci);\n    const key = `${ri}_${ci}`;\n    const { errors } = this;\n    if (v !== null) {\n      const [flag, message] = v.validator.validate(text);\n      if (!flag) {\n        errors.set(key, message);\n      } else {\n        errors.delete(key);\n      }\n    } else {\n      errors.delete(key);\n    }\n    return true;\n  }\n\n  // type: date|number|phone|email|list\n  // validator: { required, value, operator }\n  add(mode, ref, {\n    type, required, value, operator,\n  }) {\n    const validator = new Validator(\n      type, required, value, operator,\n    );\n    const v = this.getByValidator(validator);\n    if (v !== null) {\n      v.addRef(ref);\n    } else {\n      this._.push(new Validation(mode, [ref], validator));\n    }\n  }\n\n  getByValidator(validator) {\n    for (let i = 0; i < this._.length; i += 1) {\n      const v = this._[i];\n      if (v.validator.equals(validator)) {\n        return v;\n      }\n    }\n    return null;\n  }\n\n  get(ri, ci) {\n    for (let i = 0; i < this._.length; i += 1) {\n      const v = this._[i];\n      if (v.includes(ri, ci)) return v;\n    }\n    return null;\n  }\n\n  remove(cellRange) {\n    this.each((it) => {\n      it.remove(cellRange);\n    });\n  }\n\n  each(cb) {\n    this._.forEach(it => cb(it));\n  }\n\n  getData() {\n    return this._.filter(it => it.refs.length > 0).map(it => it.getData());\n  }\n\n  setData(d) {\n    this._ = d.map(it => Validation.valueOf(it));\n  }\n}\n\nexport default {};\nexport {\n  Validations,\n};\n","/* global document */\n\nimport Selector from './selector';\nimport Scroll from './scroll';\nimport History from './history';\nimport Clipboard from './clipboard';\nimport AutoFilter from './auto_filter';\nimport { Merges } from './merge';\nimport helper from './helper';\nimport { Rows } from './row';\nimport { Cols } from './col';\nimport { Validations } from './validation';\nimport { CellRange } from './cell_range';\nimport { expr2xy, xy2expr } from './alphabet';\nimport { t } from '../locale/locale';\n\n// private methods\n/*\n * {\n *  name: ''\n *  freeze: [0, 0],\n *  formats: [],\n *  styles: [\n *    {\n *      bgcolor: '',\n *      align: '',\n *      valign: '',\n *      textwrap: false,\n *      strike: false,\n *      underline: false,\n *      color: '',\n *      format: 1,\n *      border: {\n *        left: [style, color],\n *        right: [style, color],\n *        top: [style, color],\n *        bottom: [style, color],\n *      },\n *      font: {\n *        name: 'Helvetica',\n *        size: 10,\n *        bold: false,\n *        italic: false,\n *      }\n *    }\n *  ],\n *  merges: [\n *    'A1:F11',\n *    ...\n *  ],\n *  rows: {\n *    1: {\n *      height: 50,\n *      style: 1,\n *      cells: {\n *        1: {\n *          style: 2,\n *          type: 'string',\n *          text: '',\n *          value: '', // cal result\n *        }\n *      }\n *    },\n *    ...\n *  },\n *  cols: {\n *    2: { width: 100, style: 1 }\n *  }\n * }\n */\nconst defaultSettings = {\n  view: {\n    height: () => document.documentElement.clientHeight,\n    width: () => document.documentElement.clientWidth,\n  },\n  showGrid: true,\n  showToolbar: true,\n  showContextmenu: true,\n  row: {\n    len: 100,\n    height: 25,\n  },\n  col: {\n    len: 26,\n    width: 100,\n    indexWidth: 60,\n    minWidth: 60,\n  },\n  style: {\n    bgcolor: '#ffffff',\n    align: 'left',\n    valign: 'middle',\n    textwrap: false,\n    strike: false,\n    underline: false,\n    color: '#0a0a0a',\n    font: {\n      name: 'Arial',\n      size: 10,\n      bold: false,\n      italic: false,\n    },\n  },\n};\n\nconst toolbarHeight = 41;\n\n\n// src: cellRange\n// dst: cellRange\nfunction canPaste(src, dst, error = () => {}) {\n  const { merges } = this;\n  const cellRange = dst.clone();\n  const [srn, scn] = src.size();\n  const [drn, dcn] = dst.size();\n  if (srn > drn) {\n    cellRange.eri = dst.sri + srn - 1;\n  }\n  if (scn > dcn) {\n    cellRange.eci = dst.sci + scn - 1;\n  }\n  if (merges.intersects(cellRange)) {\n    error(t('error.pasteForMergedCell'));\n    return false;\n  }\n  return true;\n}\nfunction copyPaste(srcCellRange, dstCellRange, what, autofill = false) {\n  const { rows, merges } = this;\n  // delete dest merge\n  if (what === 'all' || what === 'format') {\n    rows.deleteCells(dstCellRange, what);\n    merges.deleteWithin(dstCellRange);\n  }\n  rows.copyPaste(srcCellRange, dstCellRange, what, autofill, (ri, ci, cell) => {\n    if (cell && cell.merge) {\n      // console.log('cell:', ri, ci, cell);\n      const [rn, cn] = cell.merge;\n      if (rn <= 0 && cn <= 0) return;\n      merges.add(new CellRange(ri, ci, ri + rn, ci + cn));\n    }\n  });\n}\n\nfunction cutPaste(srcCellRange, dstCellRange) {\n  const { clipboard, rows, merges } = this;\n  rows.cutPaste(srcCellRange, dstCellRange);\n  merges.move(srcCellRange,\n    dstCellRange.sri - srcCellRange.sri,\n    dstCellRange.sci - srcCellRange.sci);\n  clipboard.clear();\n}\n\n// bss: { top, bottom, left, right }\nfunction setStyleBorder(ri, ci, bss) {\n  const { styles, rows } = this;\n  const cell = rows.getCellOrNew(ri, ci);\n  let cstyle = {};\n  if (cell.style !== undefined) {\n    cstyle = helper.cloneDeep(styles[cell.style]);\n  }\n  Object.assign(cstyle, { border: bss });\n  cell.style = this.addStyle(cstyle);\n}\n\nfunction setStyleBorders({ mode, style, color }) {\n  const { styles, selector, rows } = this;\n  const {\n    sri, sci, eri, eci,\n  } = selector.range;\n  const multiple = !this.isSignleSelected();\n  if (!multiple) {\n    if (mode === 'inside' || mode === 'horizontal' || mode === 'vertical') {\n      return;\n    }\n  }\n  if (mode === 'outside' && !multiple) {\n    setStyleBorder.call(this, sri, sci, {\n      top: [style, color], bottom: [style, color], left: [style, color], right: [style, color],\n    });\n  } else if (mode === 'none') {\n    selector.range.each((ri, ci) => {\n      const cell = rows.getCell(ri, ci);\n      if (cell && cell.style !== undefined) {\n        const ns = helper.cloneDeep(styles[cell.style]);\n        delete ns.border;\n        // ['bottom', 'top', 'left', 'right'].forEach((prop) => {\n        //   if (ns[prop]) delete ns[prop];\n        // });\n        cell.style = this.addStyle(ns);\n      }\n    });\n  } else if (mode === 'all' || mode === 'inside' || mode === 'outside'\n    || mode === 'horizontal' || mode === 'vertical') {\n    const merges = [];\n    for (let ri = sri; ri <= eri; ri += 1) {\n      for (let ci = sci; ci <= eci; ci += 1) {\n        // jump merges -- start\n        const mergeIndexes = [];\n        for (let ii = 0; ii < merges.length; ii += 1) {\n          const [mri, mci, rn, cn] = merges[ii];\n          if (ri === mri + rn + 1) mergeIndexes.push(ii);\n          if (mri <= ri && ri <= mri + rn) {\n            if (ci === mci) {\n              ci += cn + 1;\n              break;\n            }\n          }\n        }\n        mergeIndexes.forEach(it => merges.splice(it, 1));\n        if (ci > eci) break;\n        // jump merges -- end\n        const cell = rows.getCell(ri, ci);\n        let [rn, cn] = [0, 0];\n        if (cell && cell.merge) {\n          [rn, cn] = cell.merge;\n          merges.push([ri, ci, rn, cn]);\n        }\n        const mrl = rn > 0 && ri + rn === eri;\n        const mcl = cn > 0 && ci + cn === eci;\n        let bss = {};\n        if (mode === 'all') {\n          bss = {\n            bottom: [style, color],\n            top: [style, color],\n            left: [style, color],\n            right: [style, color],\n          };\n        } else if (mode === 'inside') {\n          if (!mcl && ci < eci) bss.right = [style, color];\n          if (!mrl && ri < eri) bss.bottom = [style, color];\n        } else if (mode === 'horizontal') {\n          if (!mrl && ri < eri) bss.bottom = [style, color];\n        } else if (mode === 'vertical') {\n          if (!mcl && ci < eci) bss.right = [style, color];\n        } else if (mode === 'outside' && multiple) {\n          if (sri === ri) bss.top = [style, color];\n          if (mrl || eri === ri) bss.bottom = [style, color];\n          if (sci === ci) bss.left = [style, color];\n          if (mcl || eci === ci) bss.right = [style, color];\n        }\n        if (Object.keys(bss).length > 0) {\n          setStyleBorder.call(this, ri, ci, bss);\n        }\n        ci += cn;\n      }\n    }\n  } else if (mode === 'top' || mode === 'bottom') {\n    for (let ci = sci; ci <= eci; ci += 1) {\n      if (mode === 'top') {\n        setStyleBorder.call(this, sri, ci, { top: [style, color] });\n        ci += rows.getCellMerge(sri, ci)[1];\n      }\n      if (mode === 'bottom') {\n        setStyleBorder.call(this, eri, ci, { bottom: [style, color] });\n        ci += rows.getCellMerge(eri, ci)[1];\n      }\n    }\n  } else if (mode === 'left' || mode === 'right') {\n    for (let ri = sri; ri <= eri; ri += 1) {\n      if (mode === 'left') {\n        setStyleBorder.call(this, ri, sci, { left: [style, color] });\n        ri += rows.getCellMerge(ri, sci)[0];\n      }\n      if (mode === 'right') {\n        setStyleBorder.call(this, ri, eci, { right: [style, color] });\n        ri += rows.getCellMerge(ri, eci)[0];\n      }\n    }\n  }\n}\n\nfunction getCellRowByY(y, scrollOffsety) {\n  const { rows } = this;\n  const fsh = this.freezeTotalHeight();\n  // console.log('y:', y, ', fsh:', fsh);\n  let inits = rows.height;\n  if (fsh + rows.height < y) inits -= scrollOffsety;\n\n  // handle ri in autofilter\n  const frset = this.exceptRowSet;\n\n  let ri = 0;\n  let top = inits;\n  let { height } = rows;\n  for (; ri < rows.len; ri += 1) {\n    if (top > y) break;\n    if (!frset.has(ri)) {\n      height = rows.getHeight(ri);\n      top += height;\n    }\n  }\n  top -= height;\n  // console.log('ri:', ri, ', top:', top, ', height:', height);\n\n  if (top <= 0) {\n    return { ri: -1, top: 0, height };\n  }\n\n  return { ri: ri - 1, top, height };\n}\n\nfunction getCellColByX(x, scrollOffsetx) {\n  const { cols } = this;\n  const fsw = this.freezeTotalWidth();\n  let inits = cols.indexWidth;\n  if (fsw + cols.indexWidth < x) inits -= scrollOffsetx;\n  const [ci, left, width] = helper.rangeReduceIf(\n    0,\n    cols.len,\n    inits,\n    cols.indexWidth,\n    x,\n    i => cols.getWidth(i),\n  );\n  if (left <= 0) {\n    return { ci: -1, left: 0, width: cols.indexWidth };\n  }\n  return { ci: ci - 1, left, width };\n}\n\nexport default class DataProxy {\n  constructor(name, settings) {\n    this.settings = helper.merge(defaultSettings, settings || {});\n    // save data begin\n    this.name = name || 'sheet';\n    this.freeze = [0, 0];\n    this.styles = []; // Array<Style>\n    this.merges = new Merges(); // [CellRange, ...]\n    this.rows = new Rows(this.settings.row);\n    this.cols = new Cols(this.settings.col);\n    this.validations = new Validations();\n    this.hyperlinks = {};\n    this.comments = {};\n    // save data end\n\n    // don't save object\n    this.selector = new Selector();\n    this.scroll = new Scroll();\n    this.history = new History();\n    this.clipboard = new Clipboard();\n    this.autoFilter = new AutoFilter();\n    this.change = () => {};\n    this.exceptRowSet = new Set();\n    this.sortedRowMap = new Map();\n    this.unsortedRowMap = new Map();\n  }\n\n  addValidation(mode, ref, validator) {\n    // console.log('mode:', mode, ', ref:', ref, ', validator:', validator);\n    this.changeData(() => {\n      this.validations.add(mode, ref, validator);\n    });\n  }\n\n  removeValidation() {\n    const { range } = this.selector;\n    this.changeData(() => {\n      this.validations.remove(range);\n    });\n  }\n\n  getSelectedValidator() {\n    const { ri, ci } = this.selector;\n    const v = this.validations.get(ri, ci);\n    return v ? v.validator : null;\n  }\n\n  getSelectedValidation() {\n    const { ri, ci, range } = this.selector;\n    const v = this.validations.get(ri, ci);\n    const ret = { ref: range.toString() };\n    if (v !== null) {\n      ret.mode = v.mode;\n      ret.validator = v.validator;\n    }\n    return ret;\n  }\n\n  canUndo() {\n    return this.history.canUndo();\n  }\n\n  canRedo() {\n    return this.history.canRedo();\n  }\n\n  undo() {\n    this.history.undo(this.getData(), (d) => {\n      this.setData(d);\n    });\n  }\n\n  redo() {\n    this.history.redo(this.getData(), (d) => {\n      this.setData(d);\n    });\n  }\n\n  copy() {\n    this.clipboard.copy(this.selector.range);\n  }\n\n  cut() {\n    this.clipboard.cut(this.selector.range);\n  }\n\n  // what: all | text | format\n  paste(what = 'all', error = () => {}) {\n    // console.log('sIndexes:', sIndexes);\n    const { clipboard, selector } = this;\n    if (clipboard.isClear()) return false;\n    if (!canPaste.call(this, clipboard.range, selector.range, error)) return false;\n\n    this.changeData(() => {\n      if (clipboard.isCopy()) {\n        copyPaste.call(this, clipboard.range, selector.range, what);\n      } else if (clipboard.isCut()) {\n        cutPaste.call(this, clipboard.range, selector.range);\n      }\n    });\n    return true;\n  }\n\n  autofill(cellRange, what, error = () => {}) {\n    const srcRange = this.selector.range;\n    if (!canPaste.call(this, srcRange, cellRange, error)) return false;\n    this.changeData(() => {\n      copyPaste.call(this, srcRange, cellRange, what, true);\n    });\n    return true;\n  }\n\n  clearClipboard() {\n    this.clipboard.clear();\n  }\n\n  calSelectedRangeByEnd(ri, ci) {\n    const {\n      selector, rows, cols, merges,\n    } = this;\n    let {\n      sri, sci, eri, eci,\n    } = selector.range;\n    const cri = selector.ri;\n    const cci = selector.ci;\n    let [nri, nci] = [ri, ci];\n    if (ri < 0) nri = rows.len - 1;\n    if (ci < 0) nci = cols.len - 1;\n    if (nri > cri) [sri, eri] = [cri, nri];\n    else [sri, eri] = [nri, cri];\n    if (nci > cci) [sci, eci] = [cci, nci];\n    else [sci, eci] = [nci, cci];\n    selector.range = merges.union(new CellRange(\n      sri, sci, eri, eci,\n    ));\n    selector.range = merges.union(selector.range);\n    // console.log('selector.range:', selector.range);\n    return selector.range;\n  }\n\n  calSelectedRangeByStart(ri, ci) {\n    const {\n      selector, rows, cols, merges,\n    } = this;\n    let cellRange = merges.getFirstIncludes(ri, ci);\n    // console.log('cellRange:', cellRange, ri, ci, merges);\n    if (cellRange === null) {\n      cellRange = new CellRange(ri, ci, ri, ci);\n      if (ri === -1) {\n        cellRange.sri = 0;\n        cellRange.eri = rows.len - 1;\n      }\n      if (ci === -1) {\n        cellRange.sci = 0;\n        cellRange.eci = cols.len - 1;\n      }\n    }\n    selector.range = cellRange;\n    return cellRange;\n  }\n\n  setSelectedCellAttr(property, value) {\n    this.changeData(() => {\n      const { selector, styles, rows } = this;\n      if (property === 'merge') {\n        if (value) this.merge();\n        else this.unmerge();\n      } else if (property === 'border') {\n        setStyleBorders.call(this, value);\n      } else if (property === 'formula') {\n        // console.log('>>>', selector.multiple());\n        const { ri, ci, range } = selector;\n        if (selector.multiple()) {\n          const [rn, cn] = selector.size();\n          const {\n            sri, sci, eri, eci,\n          } = range;\n          if (rn > 1) {\n            for (let i = sci; i <= eci; i += 1) {\n              const cell = rows.getCellOrNew(eri + 1, i);\n              cell.text = `=${value}(${xy2expr(i, sri)}:${xy2expr(i, eri)})`;\n            }\n          } else if (cn > 1) {\n            const cell = rows.getCellOrNew(ri, eci + 1);\n            cell.text = `=${value}(${xy2expr(sci, ri)}:${xy2expr(eci, ri)})`;\n          }\n        } else {\n          const cell = rows.getCellOrNew(ri, ci);\n          cell.text = `=${value}()`;\n        }\n      } else {\n        selector.range.each((ri, ci) => {\n          const cell = rows.getCellOrNew(ri, ci);\n          let cstyle = {};\n          if (cell.style !== undefined) {\n            cstyle = helper.cloneDeep(styles[cell.style]);\n          }\n          if (property === 'format') {\n            cstyle.format = value;\n            cell.style = this.addStyle(cstyle);\n          } else if (property === 'font-bold' || property === 'font-italic'\n            || property === 'font-name' || property === 'font-size') {\n            const nfont = {};\n            nfont[property.split('-')[1]] = value;\n            cstyle.font = Object.assign(cstyle.font || {}, nfont);\n            cell.style = this.addStyle(cstyle);\n          } else if (property === 'strike' || property === 'textwrap'\n            || property === 'underline'\n            || property === 'align' || property === 'valign'\n            || property === 'color' || property === 'bgcolor') {\n            cstyle[property] = value;\n            cell.style = this.addStyle(cstyle);\n          }\n        });\n      }\n    });\n  }\n\n  // state: input | finished\n  setSelectedCellText(text, state = 'input') {\n    const { autoFilter, selector, rows } = this;\n    const { ri, ci } = selector;\n    let nri = ri;\n    if (this.unsortedRowMap.has(ri)) {\n      nri = this.unsortedRowMap.get(ri);\n    }\n    const oldCell = rows.getCell(nri, ci);\n    const oldText = oldCell ? oldCell.text : '';\n    this.setCellText(nri, ci, text, state);\n    // replace filter.value\n    if (autoFilter.active()) {\n      const filter = autoFilter.getFilter(ci);\n      if (filter) {\n        const vIndex = filter.value.findIndex(v => v === oldText);\n        if (vIndex >= 0) {\n          filter.value.splice(vIndex, 1, text);\n        }\n        // console.log('filter:', filter, oldCell);\n      }\n    }\n    // this.resetAutoFilter();\n  }\n\n  getSelectedCell() {\n    const { ri, ci } = this.selector;\n    let nri = ri;\n    if (this.unsortedRowMap.has(ri)) {\n      nri = this.unsortedRowMap.get(ri);\n    }\n    return this.rows.getCell(nri, ci);\n  }\n\n  xyInSelectedRect(x, y) {\n    const {\n      left, top, width, height,\n    } = this.getSelectedRect();\n    const x1 = x - this.cols.indexWidth;\n    const y1 = y - this.rows.height;\n    // console.log('x:', x, ',y:', y, 'left:', left, 'top:', top);\n    return x1 > left && x1 < (left + width)\n      && y1 > top && y1 < (top + height);\n  }\n\n  getSelectedRect() {\n    return this.getRect(this.selector.range);\n  }\n\n  getClipboardRect() {\n    const { clipboard } = this;\n    if (!clipboard.isClear()) {\n      return this.getRect(clipboard.range);\n    }\n    return { left: -100, top: -100 };\n  }\n\n  getRect(cellRange) {\n    const {\n      scroll, rows, cols, exceptRowSet,\n    } = this;\n    const {\n      sri, sci, eri, eci,\n    } = cellRange;\n    // console.log('sri:', sri, ',sci:', sci, ', eri:', eri, ', eci:', eci);\n    // no selector\n    if (sri < 0 && sci < 0) {\n      return {\n        left: 0, l: 0, top: 0, t: 0, scroll,\n      };\n    }\n    const left = cols.sumWidth(0, sci);\n    const top = rows.sumHeight(0, sri, exceptRowSet);\n    const height = rows.sumHeight(sri, eri + 1, exceptRowSet);\n    const width = cols.sumWidth(sci, eci + 1);\n    // console.log('sri:', sri, ', sci:', sci, ', eri:', eri, ', eci:', eci);\n    let left0 = left - scroll.x;\n    let top0 = top - scroll.y;\n    const fsh = this.freezeTotalHeight();\n    const fsw = this.freezeTotalWidth();\n    if (fsw > 0 && fsw > left) {\n      left0 = left;\n    }\n    if (fsh > 0 && fsh > top) {\n      top0 = top;\n    }\n    return {\n      l: left,\n      t: top,\n      left: left0,\n      top: top0,\n      height,\n      width,\n      scroll,\n    };\n  }\n\n  getCellRectByXY(x, y) {\n    const {\n      scroll, merges, rows, cols,\n    } = this;\n    let { ri, top, height } = getCellRowByY.call(this, y, scroll.y);\n    let { ci, left, width } = getCellColByX.call(this, x, scroll.x);\n    if (ci === -1) {\n      width = cols.totalWidth();\n    }\n    if (ri === -1) {\n      height = rows.totalHeight();\n    }\n    if (ri >= 0 || ci >= 0) {\n      const merge = merges.getFirstIncludes(ri, ci);\n      if (merge) {\n        ri = merge.sri;\n        ci = merge.sci;\n        ({\n          left, top, width, height,\n        } = this.cellRect(ri, ci));\n      }\n    }\n    return {\n      ri, ci, left, top, width, height,\n    };\n  }\n\n  isSignleSelected() {\n    const {\n      sri, sci, eri, eci,\n    } = this.selector.range;\n    const cell = this.getCell(sri, sci);\n    if (cell && cell.merge) {\n      const [rn, cn] = cell.merge;\n      if (sri + rn === eri && sci + cn === eci) return true;\n    }\n    return !this.selector.multiple();\n  }\n\n  canUnmerge() {\n    const {\n      sri, sci, eri, eci,\n    } = this.selector.range;\n    const cell = this.getCell(sri, sci);\n    if (cell && cell.merge) {\n      const [rn, cn] = cell.merge;\n      if (sri + rn === eri && sci + cn === eci) return true;\n    }\n    return false;\n  }\n\n  merge() {\n    const { selector, rows } = this;\n    if (this.isSignleSelected()) return;\n    const [rn, cn] = selector.size();\n    // console.log('merge:', rn, cn);\n    if (rn > 1 || cn > 1) {\n      const { sri, sci } = selector.range;\n      this.changeData(() => {\n        const cell = rows.getCellOrNew(sri, sci);\n        cell.merge = [rn - 1, cn - 1];\n        this.merges.add(selector.range);\n        // delete merge cells\n        this.rows.deleteCells(selector.range);\n        // console.log('cell:', cell, this.d);\n        this.rows.setCell(sri, sci, cell);\n      });\n    }\n  }\n\n  unmerge() {\n    const { selector } = this;\n    if (!this.isSignleSelected()) return;\n    const { sri, sci } = selector.range;\n    this.changeData(() => {\n      this.rows.deleteCell(sri, sci, 'merge');\n      this.merges.deleteWithin(selector.range);\n    });\n  }\n\n  canAutofilter() {\n    return !this.autoFilter.active();\n  }\n\n  autofilter() {\n    const { autoFilter, selector } = this;\n    this.changeData(() => {\n      if (autoFilter.active()) {\n        autoFilter.clear();\n        this.exceptRowSet = new Set();\n        this.sortedRowMap = new Map();\n        this.unsortedRowMap = new Map();\n      } else {\n        autoFilter.ref = selector.range.toString();\n      }\n    });\n  }\n\n  setAutoFilter(ci, order, operator, value) {\n    const { autoFilter } = this;\n    autoFilter.addFilter(ci, operator, value);\n    autoFilter.setSort(ci, order);\n    this.resetAutoFilter();\n  }\n\n  resetAutoFilter() {\n    const { autoFilter, rows } = this;\n    if (!autoFilter.active()) return;\n    const { sort } = autoFilter;\n    const { rset, fset } = autoFilter.filteredRows((r, c) => rows.getCell(r, c));\n    const fary = Array.from(fset);\n    const oldAry = Array.from(fset);\n    if (sort) {\n      fary.sort((a, b) => {\n        if (sort.order === 'asc') return a - b;\n        if (sort.order === 'desc') return b - a;\n        return 0;\n      });\n    }\n    this.exceptRowSet = rset;\n    this.sortedRowMap = new Map();\n    this.unsortedRowMap = new Map();\n    fary.forEach((it, index) => {\n      this.sortedRowMap.set(oldAry[index], it);\n      this.unsortedRowMap.set(it, oldAry[index]);\n    });\n  }\n\n  deleteCell(what = 'all') {\n    const { selector } = this;\n    this.changeData(() => {\n      this.rows.deleteCells(selector.range, what);\n      if (what === 'all' || what === 'format') {\n        this.merges.deleteWithin(selector.range);\n      }\n    });\n  }\n\n  // type: row | column\n  insert(type, n = 1) {\n    this.changeData(() => {\n      const { sri, sci } = this.selector.range;\n      const { rows, merges, cols } = this;\n      let si = sri;\n      if (type === 'row') {\n        rows.insert(sri, n);\n      } else if (type === 'column') {\n        rows.insertColumn(sci, n);\n        si = sci;\n        cols.len += 1;\n      }\n      merges.shift(type, si, n, (ri, ci, rn, cn) => {\n        const cell = rows.getCell(ri, ci);\n        cell.merge[0] += rn;\n        cell.merge[1] += cn;\n      });\n    });\n  }\n\n  // type: row | column\n  delete(type) {\n    this.changeData(() => {\n      const {\n        rows, merges, selector, cols,\n      } = this;\n      const { range } = selector;\n      const {\n        sri, sci, eri, eci,\n      } = selector.range;\n      const [rsize, csize] = selector.range.size();\n      let si = sri;\n      let size = rsize;\n      if (type === 'row') {\n        rows.delete(sri, eri);\n      } else if (type === 'column') {\n        rows.deleteColumn(sci, eci);\n        si = range.sci;\n        size = csize;\n        cols.len -= 1;\n      }\n      // console.log('type:', type, ', si:', si, ', size:', size);\n      merges.shift(type, si, -size, (ri, ci, rn, cn) => {\n        // console.log('ri:', ri, ', ci:', ci, ', rn:', rn, ', cn:', cn);\n        const cell = rows.getCell(ri, ci);\n        cell.merge[0] += rn;\n        cell.merge[1] += cn;\n        if (cell.merge[0] === 0 && cell.merge[1] === 0) {\n          delete cell.merge;\n        }\n      });\n    });\n  }\n\n  scrollx(x, cb) {\n    const { scroll, freeze, cols } = this;\n    const [, fci] = freeze;\n    const [\n      ci, left, width,\n    ] = helper.rangeReduceIf(fci, cols.len, 0, 0, x, i => cols.getWidth(i));\n    // console.log('fci:', fci, ', ci:', ci);\n    let x1 = left;\n    if (x > 0) x1 += width;\n    if (scroll.x !== x1) {\n      scroll.ci = x > 0 ? ci : 0;\n      scroll.x = x1;\n      cb();\n    }\n  }\n\n  scrolly(y, cb) {\n    const { scroll, freeze, rows } = this;\n    const [fri] = freeze;\n    const [\n      ri, top, height,\n    ] = helper.rangeReduceIf(fri, rows.len, 0, 0, y, i => rows.getHeight(i));\n    let y1 = top;\n    if (y > 0) y1 += height;\n    // console.log('ri:', ri, ' ,y:', y1);\n    if (scroll.y !== y1) {\n      scroll.ri = y > 0 ? ri : 0;\n      scroll.y = y1;\n      cb();\n    }\n  }\n\n  cellRect(ri, ci) {\n    const { rows, cols } = this;\n    const left = cols.sumWidth(0, ci);\n    const top = rows.sumHeight(0, ri);\n    const cell = rows.getCell(ri, ci);\n    let width = cols.getWidth(ci);\n    let height = rows.getHeight(ri);\n    if (cell !== null) {\n      if (cell.merge) {\n        const [rn, cn] = cell.merge;\n        // console.log('cell.merge:', cell.merge);\n        if (rn > 0) {\n          for (let i = 1; i <= rn; i += 1) {\n            height += rows.getHeight(ri + i);\n          }\n        }\n        if (cn > 0) {\n          for (let i = 1; i <= cn; i += 1) {\n            width += cols.getWidth(ci + i);\n          }\n        }\n      }\n    }\n    // console.log('data:', this.d);\n    return {\n      left, top, width, height, cell,\n    };\n  }\n\n  getCell(ri, ci) {\n    return this.rows.getCell(ri, ci);\n  }\n\n  getCellTextOrDefault(ri, ci) {\n    const cell = this.getCell(ri, ci);\n    return (cell && cell.text) ? cell.text : '';\n  }\n\n  getCellStyle(ri, ci) {\n    const cell = this.getCell(ri, ci);\n    if (cell && cell.style !== undefined) {\n      return this.styles[cell.style];\n    }\n    return null;\n  }\n\n  getCellStyleOrDefault(ri, ci) {\n    const { styles, rows } = this;\n    const cell = rows.getCell(ri, ci);\n    const cellStyle = (cell && cell.style !== undefined) ? styles[cell.style] : {};\n    return helper.merge(this.defaultStyle(), cellStyle);\n  }\n\n  getSelectedCellStyle() {\n    const { ri, ci } = this.selector;\n    return this.getCellStyleOrDefault(ri, ci);\n  }\n\n  // state: input | finished\n  setCellText(ri, ci, text, state) {\n    const { rows, history, validations } = this;\n    if (state === 'finished') {\n      rows.setCellText(ri, ci, '');\n      history.add(this.getData());\n      rows.setCellText(ri, ci, text);\n    } else {\n      rows.setCellText(ri, ci, text);\n      this.change(this.getData());\n    }\n    // validator\n    validations.validate(ri, ci, text);\n  }\n\n  freezeIsActive() {\n    const [ri, ci] = this.freeze;\n    return ri > 0 || ci > 0;\n  }\n\n  setFreeze(ri, ci) {\n    this.changeData(() => {\n      this.freeze = [ri, ci];\n    });\n  }\n\n  freezeTotalWidth() {\n    return this.cols.sumWidth(0, this.freeze[1]);\n  }\n\n  freezeTotalHeight() {\n    return this.rows.sumHeight(0, this.freeze[0]);\n  }\n\n  setRowHeight(ri, height) {\n    this.changeData(() => {\n      this.rows.setHeight(ri, height);\n    });\n  }\n\n  setColWidth(ci, width) {\n    this.changeData(() => {\n      this.cols.setWidth(ci, width);\n    });\n  }\n\n  viewHeight() {\n    const { view, showToolbar } = this.settings;\n    let h = view.height();\n    if (showToolbar) {\n      h -= toolbarHeight;\n    }\n    return h;\n  }\n\n  viewWidth() {\n    return this.settings.view.width();\n  }\n\n  freezeViewRange() {\n    const [ri, ci] = this.freeze;\n    return new CellRange(0, 0, ri - 1, ci - 1, this.freezeTotalWidth(), this.freezeTotalHeight());\n  }\n\n  exceptRowTotalHeight(sri, eri) {\n    const { exceptRowSet, rows } = this;\n    const exceptRows = Array.from(exceptRowSet);\n    let exceptRowTH = 0;\n    exceptRows.forEach((ri) => {\n      if (ri < sri || ri > eri) {\n        const height = rows.getHeight(ri);\n        exceptRowTH += height;\n      }\n    });\n    return exceptRowTH;\n  }\n\n  viewRange() {\n    const {\n      scroll, rows, cols, freeze, exceptRowSet,\n    } = this;\n    let { ri, ci } = scroll;\n    if (ri <= 0) [ri] = freeze;\n    if (ci <= 0) [, ci] = freeze;\n\n    let [x, y] = [0, 0];\n    let [eri, eci] = [rows.len, cols.len];\n    for (let i = ri; i < rows.len; i += 1) {\n      if (!exceptRowSet.has(i)) {\n        y += rows.getHeight(i);\n        eri = i;\n      }\n      if (y > this.viewHeight()) break;\n    }\n    for (let j = ci; j < cols.len; j += 1) {\n      x += cols.getWidth(j);\n      eci = j;\n      if (x > this.viewWidth()) break;\n    }\n    // console.log(ri, ci, eri, eci, x, y);\n    return new CellRange(ri, ci, eri, eci, x, y);\n  }\n\n  eachMergesInView(viewRange, cb) {\n    this.merges.filterIntersects(viewRange)\n      .forEach(it => cb(it));\n  }\n\n  rowEach(min, max, cb) {\n    let y = 0;\n    const { rows } = this;\n    const frset = this.exceptRowSet;\n    const frary = [...frset];\n    let offset = 0;\n    for (let i = 0; i < frary.length; i += 1) {\n      if (frary[i] < min) {\n        offset += 1;\n      }\n    }\n    // console.log('min:', min, ', max:', max, ', scroll:', scroll);\n    for (let i = min + offset; i <= max + offset; i += 1) {\n      if (frset.has(i)) {\n        offset += 1;\n      } else {\n        const rowHeight = rows.getHeight(i);\n        cb(i, y, rowHeight);\n        y += rowHeight;\n        if (y > this.viewHeight()) break;\n      }\n    }\n  }\n\n  colEach(min, max, cb) {\n    let x = 0;\n    const { cols } = this;\n    for (let i = min; i <= max; i += 1) {\n      const colWidth = cols.getWidth(i);\n      cb(i, x, colWidth);\n      x += colWidth;\n      if (x > this.viewWidth()) break;\n    }\n  }\n\n  defaultStyle() {\n    return this.settings.style;\n  }\n\n  addStyle(nstyle) {\n    const { styles } = this;\n    // console.log('old.styles:', styles, nstyle);\n    for (let i = 0; i < styles.length; i += 1) {\n      const style = styles[i];\n      if (helper.equals(style, nstyle)) return i;\n    }\n    styles.push(nstyle);\n    return styles.length - 1;\n  }\n\n  changeData(cb) {\n    this.history.add(this.getData());\n    cb();\n    this.change(this.getData());\n  }\n\n  setData(d) {\n    Object.keys(d).forEach((property) => {\n      if (property === 'merges' || property === 'rows'\n        || property === 'cols' || property === 'validations') {\n        this[property].setData(d[property]);\n      } else if (property === 'freeze') {\n        const [x, y] = expr2xy(d[property]);\n        this.freeze = [y, x];\n      } else if (d[property] !== undefined) {\n        this[property] = d[property];\n      }\n    });\n    return this;\n  }\n\n  getData() {\n    const {\n      name, freeze, styles, merges, rows, cols, validations, autoFilter,\n    } = this;\n    return {\n      name,\n      freeze: xy2expr(freeze[1], freeze[0]),\n      styles,\n      merges: merges.getData(),\n      rows: rows.getData(),\n      cols: cols.getData(),\n      validations: validations.getData(),\n      autofilter: autoFilter.getData(),\n    };\n  }\n}\n","/* global window */\nexport function bind(target, name, fn) {\n  target.addEventListener(name, fn);\n}\nexport function unbind(target, name, fn) {\n  target.removeEventListener(name, fn);\n}\nexport function unbindClickoutside(el) {\n  if (el.xclickoutside) {\n    unbind(window.document.body, 'click', el.xclickoutside);\n    delete el.xclickoutside;\n  }\n}\n\n// the left mouse button: mousedown → mouseup → click\n// the right mouse button: mousedown → contenxtmenu → mouseup\n// the right mouse button in firefox(>65.0): mousedown → contenxtmenu → mouseup → click on window\nexport function bindClickoutside(el, cb) {\n  el.xclickoutside = (evt) => {\n    // ignore double click\n    // console.log('evt:', evt);\n    if (evt.detail === 2 || el.contains(evt.target)) return;\n    if (cb) cb(el);\n    else {\n      el.hide();\n      unbindClickoutside(el);\n    }\n  };\n  bind(window.document.body, 'click', el.xclickoutside);\n}\nexport function mouseMoveUp(target, movefunc, upfunc) {\n  bind(target, 'mousemove', movefunc);\n  const t = target;\n  t.xEvtUp = (evt) => {\n    // console.log('mouseup>>>');\n    unbind(target, 'mousemove', movefunc);\n    unbind(target, 'mouseup', target.xEvtUp);\n    upfunc(evt);\n  };\n  bind(target, 'mouseup', target.xEvtUp);\n}\n\nfunction calTouchDirection(spanx, spany, evt, cb) {\n  let direction = '';\n  // console.log('spanx:', spanx, ', spany:', spany);\n  if (Math.abs(spanx) > Math.abs(spany)) {\n    // horizontal\n    direction = spanx > 0 ? 'right' : 'left';\n    cb(direction, spanx, evt);\n  } else {\n    // vertical\n    direction = spany > 0 ? 'down' : 'up';\n    cb(direction, spany, evt);\n  }\n}\n// cb = (direction, distance) => {}\nexport function bindTouch(target, { move, end }) {\n  let startx = 0;\n  let starty = 0;\n  bind(target, 'touchstart', (evt) => {\n    const { pageX, pageY } = evt.touches[0];\n    startx = pageX;\n    starty = pageY;\n  });\n  bind(target, 'touchmove', (evt) => {\n    if (!move) return;\n    const { pageX, pageY } = evt.changedTouches[0];\n    const spanx = pageX - startx;\n    const spany = pageY - starty;\n    if (Math.abs(spanx) > 10 || Math.abs(spany) > 10) {\n      // console.log('spanx:', spanx, ', spany:', spany);\n      calTouchDirection(spanx, spany, evt, move);\n      startx = pageX;\n      starty = pageY;\n    }\n    evt.preventDefault();\n  });\n  bind(target, 'touchend', (evt) => {\n    if (!end) return;\n    const { pageX, pageY } = evt.changedTouches[0];\n    const spanx = pageX - startx;\n    const spany = pageY - starty;\n    calTouchDirection(spanx, spany, evt, end);\n  });\n}\n","/* global window */\nexport const cssPrefix = 'x-spreadsheet';\nexport const dpr = window.devicePixelRatio || 1;\nexport default {\n  cssPrefix,\n  dpr,\n};\n","/* global window */\nimport { h } from './element';\nimport { mouseMoveUp } from './event';\nimport { cssPrefix } from '../config';\n\nexport default class Resizer {\n  constructor(vertical = false, minDistance) {\n    this.moving = false;\n    this.vertical = vertical;\n    this.el = h('div', `${cssPrefix}-resizer ${vertical ? 'vertical' : 'horizontal'}`).children(\n      this.hoverEl = h('div', `${cssPrefix}-resizer-hover`)\n        .on('mousedown.stop', evt => this.mousedownHandler(evt)),\n      this.lineEl = h('div', `${cssPrefix}-resizer-line`).hide(),\n    ).hide();\n    // cell rect\n    this.cRect = null;\n    this.finishedFn = null;\n    this.minDistance = minDistance;\n  }\n\n  // rect : {top, left, width, height}\n  // line : {width, height}\n  show(rect, line) {\n    const {\n      moving, vertical, hoverEl, lineEl, el,\n    } = this;\n    if (moving) return;\n    this.cRect = rect;\n    const {\n      left, top, width, height,\n    } = rect;\n    el.offset({\n      left: vertical ? left + width - 5 : left,\n      top: vertical ? top : top + height - 5,\n    }).show();\n    hoverEl.offset({\n      width: vertical ? 5 : width,\n      height: vertical ? height : 5,\n    });\n    lineEl.offset({\n      width: vertical ? 0 : line.width,\n      height: vertical ? line.height : 0,\n    });\n  }\n\n  hide() {\n    this.el.offset({\n      left: 0,\n      top: 0,\n    }).hide();\n  }\n\n  mousedownHandler(evt) {\n    let startEvt = evt;\n    const {\n      el, lineEl, cRect, vertical, minDistance,\n    } = this;\n    let distance = vertical ? cRect.width : cRect.height;\n    // console.log('distance:', distance);\n    lineEl.show();\n    mouseMoveUp(window, (e) => {\n      this.moving = true;\n      if (startEvt !== null && e.buttons === 1) {\n        // console.log('top:', top, ', left:', top, ', cRect:', cRect);\n        if (vertical) {\n          distance += e.movementX;\n          if (distance > minDistance) {\n            el.css('left', `${cRect.left + distance}px`);\n          }\n        } else {\n          distance += e.movementY;\n          if (distance > minDistance) {\n            el.css('top', `${cRect.top + distance}px`);\n          }\n        }\n        startEvt = e;\n      }\n    }, () => {\n      startEvt = null;\n      lineEl.hide();\n      this.moving = false;\n      this.hide();\n      if (this.finishedFn) {\n        if (distance < minDistance) distance = minDistance;\n        this.finishedFn(cRect, distance);\n      }\n    });\n  }\n}\n","import { h } from './element';\nimport { cssPrefix } from '../config';\n\nexport default class Scrollbar {\n  constructor(vertical) {\n    this.vertical = vertical;\n    this.moveFn = null;\n    this.el = h('div', `${cssPrefix}-scrollbar ${vertical ? 'vertical' : 'horizontal'}`)\n      .child(this.contentEl = h('div', ''))\n      .on('mousemove.stop', () => {})\n      .on('scroll.stop', (evt) => {\n        const { scrollTop, scrollLeft } = evt.target;\n        // console.log('scrollTop:', scrollTop);\n        if (this.moveFn) {\n          this.moveFn(this.vertical ? scrollTop : scrollLeft, evt);\n        }\n        // console.log('evt:::', evt);\n      });\n  }\n\n  move(v) {\n    this.el.scroll(v);\n    return this;\n  }\n\n  scroll() {\n    return this.el.scroll();\n  }\n\n  set(distance, contentDistance) {\n    const d = distance - 1;\n    // console.log('distance:', distance, ', contentDistance:', contentDistance);\n    if (contentDistance > d) {\n      const cssKey = this.vertical ? 'height' : 'width';\n      // console.log('d:', d);\n      this.el.css(cssKey, `${d - 15}px`).show();\n      this.contentEl\n        .css(this.vertical ? 'width' : 'height', '1px')\n        .css(cssKey, `${contentDistance}px`);\n    } else {\n      this.el.hide();\n    }\n    return this;\n  }\n}\n","import { h } from './element';\nimport { cssPrefix } from '../config';\nimport { CellRange } from '../core/cell_range';\n\nconst selectorHeightBorderWidth = 2 * 2 - 1;\nlet startZIndex = 10;\n\nclass SelectorElement {\n  constructor() {\n    this.cornerEl = h('div', `${cssPrefix}-selector-corner`);\n    this.areaEl = h('div', `${cssPrefix}-selector-area`)\n      .child(this.cornerEl).hide();\n    this.clipboardEl = h('div', `${cssPrefix}-selector-clipboard`).hide();\n    this.autofillEl = h('div', `${cssPrefix}-selector-autofill`).hide();\n    this.el = h('div', `${cssPrefix}-selector`)\n      .css('z-index', `${startZIndex}`)\n      .children(this.areaEl, this.clipboardEl, this.autofillEl)\n      .hide();\n    startZIndex += 1;\n  }\n\n  setOffset(v) {\n    this.el.offset(v).show();\n    return this;\n  }\n\n  hide() {\n    this.el.hide();\n    return this;\n  }\n\n  setAreaOffset(v) {\n    const {\n      left, top, width, height,\n    } = v;\n    this.areaEl.offset({\n      width: width - selectorHeightBorderWidth + 0.8,\n      height: height - selectorHeightBorderWidth + 0.8,\n      left: left - 0.8,\n      top: top - 0.8,\n    }).show();\n  }\n\n  setClipboardOffset(v) {\n    const {\n      left, top, width, height,\n    } = v;\n    this.clipboardEl.offset({\n      left,\n      top,\n      width: width - 5,\n      height: height - 5,\n    });\n  }\n\n  showAutofill(v) {\n    const {\n      left, top, width, height,\n    } = v;\n    this.autofillEl.offset({\n      width: width - selectorHeightBorderWidth,\n      height: height - selectorHeightBorderWidth,\n      left,\n      top,\n    }).show();\n  }\n\n  hideAutofill() {\n    this.autofillEl.hide();\n  }\n\n  showClipboard() {\n    this.clipboardEl.show();\n  }\n\n  hideClipboard() {\n    this.clipboardEl.hide();\n  }\n}\n\nfunction calBRAreaOffset(offset) {\n  const { data } = this;\n  const {\n    left, top, width, height, scroll, l, t,\n  } = offset;\n  const ftwidth = data.freezeTotalWidth();\n  const ftheight = data.freezeTotalHeight();\n  let left0 = left - ftwidth;\n  if (ftwidth > l) left0 -= scroll.x;\n  let top0 = top - ftheight;\n  if (ftheight > t) top0 -= scroll.y;\n  return {\n    left: left0,\n    top: top0,\n    width,\n    height,\n  };\n}\n\nfunction calTAreaOffset(offset) {\n  const { data } = this;\n  const {\n    left, width, height, l, t, scroll,\n  } = offset;\n  const ftwidth = data.freezeTotalWidth();\n  let left0 = left - ftwidth;\n  if (ftwidth > l) left0 -= scroll.x;\n  return {\n    left: left0, top: t, width, height,\n  };\n}\n\nfunction calLAreaOffset(offset) {\n  const { data } = this;\n  const {\n    top, width, height, l, t, scroll,\n  } = offset;\n  const ftheight = data.freezeTotalHeight();\n  let top0 = top - ftheight;\n  // console.log('ftheight:', ftheight, ', t:', t);\n  if (ftheight > t) top0 -= scroll.y;\n  return {\n    left: l, top: top0, width, height,\n  };\n}\n\nfunction setBRAreaOffset(offset) {\n  const { br } = this;\n  br.setAreaOffset(calBRAreaOffset.call(this, offset));\n}\n\nfunction setTLAreaOffset(offset) {\n  const { tl } = this;\n  tl.setAreaOffset(offset);\n}\n\nfunction setTAreaOffset(offset) {\n  const { t } = this;\n  t.setAreaOffset(calTAreaOffset.call(this, offset));\n}\n\nfunction setLAreaOffset(offset) {\n  const { l } = this;\n  l.setAreaOffset(calLAreaOffset.call(this, offset));\n}\n\nfunction setLClipboardOffset(offset) {\n  const { l } = this;\n  l.setClipboardOffset(calLAreaOffset.call(this, offset));\n}\n\nfunction setBRClipboardOffset(offset) {\n  const { br } = this;\n  br.setClipboardOffset(calBRAreaOffset.call(this, offset));\n}\n\nfunction setTLClipboardOffset(offset) {\n  const { tl } = this;\n  tl.setClipboardOffset(offset);\n}\n\nfunction setTClipboardOffset(offset) {\n  const { t } = this;\n  t.setClipboardOffset(calTAreaOffset.call(this, offset));\n}\n\nfunction setAllAreaOffset(offset) {\n  setBRAreaOffset.call(this, offset);\n  setTLAreaOffset.call(this, offset);\n  setTAreaOffset.call(this, offset);\n  setLAreaOffset.call(this, offset);\n}\n\nfunction setAllClipboardOffset(offset) {\n  setBRClipboardOffset.call(this, offset);\n  setTLClipboardOffset.call(this, offset);\n  setTClipboardOffset.call(this, offset);\n  setLClipboardOffset.call(this, offset);\n}\n\nexport default class Selector {\n  constructor(data) {\n    this.data = data;\n    this.br = new SelectorElement();\n    this.t = new SelectorElement();\n    this.l = new SelectorElement();\n    this.tl = new SelectorElement();\n    this.br.el.show();\n    this.offset = null;\n    this.areaOffset = null;\n    this.indexes = null;\n    this.range = null;\n    this.arange = null;\n    this.el = h('div', `${cssPrefix}-selectors`)\n      .children(\n        this.tl.el,\n        this.t.el,\n        this.l.el,\n        this.br.el,\n      ).hide();\n\n    // for performance\n    this.lastri = -1;\n    this.lastci = -1;\n\n    startZIndex += 1;\n  }\n\n  hide() {\n    this.el.hide();\n  }\n\n  resetOffset() {\n    const {\n      data, tl, t, l, br,\n    } = this;\n    const freezeHeight = data.freezeTotalHeight();\n    const freezeWidth = data.freezeTotalWidth();\n    if (freezeHeight > 0 || freezeWidth > 0) {\n      tl.setOffset({ width: freezeWidth, height: freezeHeight });\n      t.setOffset({ left: freezeWidth, height: freezeHeight });\n      l.setOffset({ top: freezeHeight, width: freezeWidth });\n      br.setOffset({ left: freezeWidth, top: freezeHeight });\n    } else {\n      tl.hide();\n      t.hide();\n      l.hide();\n      br.setOffset({ left: 0, top: 0 });\n    }\n  }\n\n  resetAreaOffset() {\n    // console.log('offset:', offset);\n    const offset = this.data.getSelectedRect();\n    const coffset = this.data.getClipboardRect();\n    setAllAreaOffset.call(this, offset);\n    setAllClipboardOffset.call(this, coffset);\n    this.resetOffset();\n  }\n\n  resetBRTAreaOffset() {\n    const offset = this.data.getSelectedRect();\n    const coffset = this.data.getClipboardRect();\n    setBRAreaOffset.call(this, offset);\n    setTAreaOffset.call(this, offset);\n    setBRClipboardOffset.call(this, coffset);\n    setTClipboardOffset.call(this, coffset);\n    this.resetOffset();\n  }\n\n  resetBRLAreaOffset() {\n    const offset = this.data.getSelectedRect();\n    const coffset = this.data.getClipboardRect();\n    setBRAreaOffset.call(this, offset);\n    setLAreaOffset.call(this, offset);\n    setBRClipboardOffset.call(this, coffset);\n    setLClipboardOffset.call(this, coffset);\n    this.resetOffset();\n  }\n\n  set(ri, ci, indexesUpdated = true) {\n    const { data } = this;\n    const cellRange = data.calSelectedRangeByStart(ri, ci);\n    const { sri, sci } = cellRange;\n    if (indexesUpdated) {\n      let [cri, cci] = [ri, ci];\n      if (ri < 0) cri = 0;\n      if (ci < 0) cci = 0;\n      data.selector.setIndexes(cri, cci);\n      this.indexes = [cri, cci];\n    }\n\n    this.moveIndexes = [sri, sci];\n    // this.sIndexes = sIndexes;\n    // this.eIndexes = eIndexes;\n    this.range = cellRange;\n    this.resetAreaOffset();\n    this.el.show();\n  }\n\n  setEnd(ri, ci, moving = true) {\n    const { data, lastri, lastci } = this;\n    if (moving) {\n      if (ri === lastri && ci === lastci) return;\n      this.lastri = ri;\n      this.lastci = ci;\n    }\n    this.range = data.calSelectedRangeByEnd(ri, ci);\n    setAllAreaOffset.call(this, this.data.getSelectedRect());\n  }\n\n  reset() {\n    // console.log('::::', this.data);\n    const { eri, eci } = this.data.selector.range;\n    this.setEnd(eri, eci);\n  }\n\n  showAutofill(ri, ci) {\n    if (ri === -1 && ci === -1) return;\n    // console.log('ri:', ri, ', ci:', ci);\n    // const [sri, sci] = this.sIndexes;\n    // const [eri, eci] = this.eIndexes;\n    const {\n      sri, sci, eri, eci,\n    } = this.range;\n    const [nri, nci] = [ri, ci];\n    // const rn = eri - sri;\n    // const cn = eci - sci;\n    const srn = sri - ri;\n    const scn = sci - ci;\n    const ern = eri - ri;\n    const ecn = eci - ci;\n    if (scn > 0) {\n      // left\n      // console.log('left');\n      this.arange = new CellRange(sri, nci, eri, sci - 1);\n      // this.saIndexes = [sri, nci];\n      // this.eaIndexes = [eri, sci - 1];\n      // data.calRangeIndexes2(\n    } else if (srn > 0) {\n      // top\n      // console.log('top');\n      // nri = sri;\n      this.arange = new CellRange(nri, sci, sri - 1, eci);\n      // this.saIndexes = [nri, sci];\n      // this.eaIndexes = [sri - 1, eci];\n    } else if (ecn < 0) {\n      // right\n      // console.log('right');\n      // nci = eci;\n      this.arange = new CellRange(sri, eci + 1, eri, nci);\n      // this.saIndexes = [sri, eci + 1];\n      // this.eaIndexes = [eri, nci];\n    } else if (ern < 0) {\n      // bottom\n      // console.log('bottom');\n      // nri = eri;\n      this.arange = new CellRange(eri + 1, sci, nri, eci);\n      // this.saIndexes = [eri + 1, sci];\n      // this.eaIndexes = [nri, eci];\n    } else {\n      // console.log('else:');\n      this.arange = null;\n      // this.saIndexes = null;\n      // this.eaIndexes = null;\n      return;\n    }\n    if (this.arange !== null) {\n      // console.log(this.saIndexes, ':', this.eaIndexes);\n      const offset = this.data.getRect(this.arange);\n      offset.width += 2;\n      offset.height += 2;\n      const {\n        br, l, t, tl,\n      } = this;\n      br.showAutofill(calBRAreaOffset.call(this, offset));\n      l.showAutofill(calLAreaOffset.call(this, offset));\n      t.showAutofill(calTAreaOffset.call(this, offset));\n      tl.showAutofill(offset);\n    }\n  }\n\n  hideAutofill() {\n    ['br', 'l', 't', 'tl'].forEach((property) => {\n      this[property].hideAutofill();\n    });\n  }\n\n  showClipboard() {\n    const coffset = this.data.getClipboardRect();\n    setAllClipboardOffset.call(this, coffset);\n    ['br', 'l', 't', 'tl'].forEach((property) => {\n      this[property].showClipboard();\n    });\n  }\n\n  hideClipboard() {\n    ['br', 'l', 't', 'tl'].forEach((property) => {\n      this[property].hideClipboard();\n    });\n  }\n}\n","import { h } from './element';\nimport { bindClickoutside, unbindClickoutside } from './event';\nimport { cssPrefix } from '../config';\n\nfunction inputMovePrev(evt) {\n  evt.preventDefault();\n  evt.stopPropagation();\n  const { filterItems } = this;\n  if (filterItems.length <= 0) return;\n  if (this.itemIndex >= 0) filterItems[this.itemIndex].toggle();\n  this.itemIndex -= 1;\n  if (this.itemIndex < 0) {\n    this.itemIndex = filterItems.length - 1;\n  }\n  filterItems[this.itemIndex].toggle();\n}\n\nfunction inputMoveNext(evt) {\n  evt.stopPropagation();\n  const { filterItems } = this;\n  if (filterItems.length <= 0) return;\n  if (this.itemIndex >= 0) filterItems[this.itemIndex].toggle();\n  this.itemIndex += 1;\n  if (this.itemIndex > filterItems.length - 1) {\n    this.itemIndex = 0;\n  }\n  filterItems[this.itemIndex].toggle();\n}\n\nfunction inputEnter(evt) {\n  evt.preventDefault();\n  const { filterItems } = this;\n  if (filterItems.length <= 0) return;\n  evt.stopPropagation();\n  if (this.itemIndex < 0) this.itemIndex = 0;\n  filterItems[this.itemIndex].el.click();\n  this.hide();\n}\n\nfunction inputKeydownHandler(evt) {\n  const { keyCode } = evt;\n  if (evt.ctrlKey) {\n    evt.stopPropagation();\n  }\n  switch (keyCode) {\n    case 37: // left\n      evt.stopPropagation();\n      break;\n    case 38: // up\n      inputMovePrev.call(this, evt);\n      break;\n    case 39: // right\n      evt.stopPropagation();\n      break;\n    case 40: // down\n      inputMoveNext.call(this, evt);\n      break;\n    case 13: // enter\n      inputEnter.call(this, evt);\n      break;\n    case 9:\n      inputEnter.call(this, evt);\n      break;\n    default:\n      evt.stopPropagation();\n      break;\n  }\n}\n\nexport default class Suggest {\n  constructor(items, itemClick, width = '200px') {\n    this.filterItems = [];\n    this.items = items;\n    this.el = h('div', `${cssPrefix}-suggest`).css('width', width).hide();\n    this.itemClick = itemClick;\n    this.itemIndex = -1;\n  }\n\n  setOffset(v) {\n    this.el.cssRemoveKeys('top', 'bottom')\n      .offset(v);\n  }\n\n  hide() {\n    const { el } = this;\n    this.filterItems = [];\n    this.itemIndex = -1;\n    el.hide();\n    unbindClickoutside(this.el.parent());\n  }\n\n  setItems(items) {\n    this.items = items;\n    // this.search('');\n  }\n\n  search(word) {\n    let { items } = this;\n    if (!/^\\s*$/.test(word)) {\n      items = items.filter(it => (it.key || it).startsWith(word.toUpperCase()));\n    }\n    items = items.map((it) => {\n      let { title } = it;\n      if (title) {\n        if (typeof title === 'function') {\n          title = title();\n        }\n      } else {\n        title = it;\n      }\n      const item = h('div', `${cssPrefix}-item`)\n        .child(title)\n        .on('click.stop', () => {\n          this.itemClick(it);\n          this.hide();\n        });\n      if (it.label) {\n        item.child(h('div', 'label').html(it.label));\n      }\n      return item;\n    });\n    this.filterItems = items;\n    if (items.length <= 0) {\n      return;\n    }\n    const { el } = this;\n    // items[0].toggle();\n    el.html('').children(...items).show();\n    bindClickoutside(el.parent(), () => { this.hide(); });\n  }\n\n  bindInputEvents(input) {\n    input.on('keydown', evt => inputKeydownHandler.call(this, evt));\n  }\n}\n","import { Element, h } from './element';\nimport { cssPrefix } from '../config';\n\nexport default class Icon extends Element {\n  constructor(name) {\n    super('div', `${cssPrefix}-icon`);\n    this.iconNameEl = h('div', `${cssPrefix}-icon-img ${name}`);\n    this.child(this.iconNameEl);\n  }\n\n  setName(name) {\n    this.iconNameEl.className(`${cssPrefix}-icon-img ${name}`);\n  }\n}\n","import { h } from './element';\nimport Icon from './icon';\nimport { t } from '../locale/locale';\n\nfunction addMonth(date, step) {\n  date.setMonth(date.getMonth() + step);\n}\n\nfunction weekday(date, index) {\n  const d = new Date(date);\n  d.setDate(index - date.getDay() + 1);\n  return d;\n}\n\nfunction monthDays(year, month, cdate) {\n  // the first day of month\n  const startDate = new Date(year, month, 1, 23, 59, 59);\n  const datess = [[], [], [], [], [], []];\n  for (let i = 0; i < 6; i += 1) {\n    for (let j = 0; j < 7; j += 1) {\n      const index = i * 7 + j;\n      const d = weekday(startDate, index);\n      const disabled = d.getMonth() !== month;\n      // console.log('d:', d, ', cdate:', cdate);\n      const active = d.getMonth() === cdate.getMonth() && d.getDate() === cdate.getDate();\n      datess[i][j] = { d, disabled, active };\n    }\n  }\n  return datess;\n}\n\nexport default class Calendar {\n  constructor(value) {\n    this.value = value;\n    this.cvalue = new Date(value);\n\n    this.headerLeftEl = h('div', 'calendar-header-left');\n    this.bodyEl = h('tbody', '');\n    this.buildAll();\n    this.el = h('div', 'x-spreadsheet-calendar')\n      .children(\n        h('div', 'calendar-header').children(\n          this.headerLeftEl,\n          h('div', 'calendar-header-right').children(\n            h('a', 'calendar-prev')\n              .on('click.stop', () => this.prev())\n              .child(new Icon('chevron-left')),\n            h('a', 'calendar-next')\n              .on('click.stop', () => this.next())\n              .child(new Icon('chevron-right')),\n          ),\n        ),\n        h('table', 'calendar-body').children(\n          h('thead', '').child(\n            h('tr', '').children(\n              ...t('calendar.weeks').map(week => h('th', 'cell').child(week)),\n            ),\n          ),\n          this.bodyEl,\n        ),\n      );\n    this.selectChange = () => {};\n  }\n\n  setValue(value) {\n    this.value = value;\n    this.cvalue = new Date(value);\n    this.buildAll();\n  }\n\n  prev() {\n    const { value } = this;\n    addMonth(value, -1);\n    this.buildAll();\n  }\n\n  next() {\n    const { value } = this;\n    addMonth(value, 1);\n    this.buildAll();\n  }\n\n  buildAll() {\n    this.buildHeaderLeft();\n    this.buildBody();\n  }\n\n  buildHeaderLeft() {\n    const { value } = this;\n    this.headerLeftEl.html(`${t('calendar.months')[value.getMonth()]} ${value.getFullYear()}`);\n  }\n\n  buildBody() {\n    const { value, cvalue, bodyEl } = this;\n    const mDays = monthDays(value.getFullYear(), value.getMonth(), cvalue);\n    const trs = mDays.map((it) => {\n      const tds = it.map((it1) => {\n        let cls = 'cell';\n        if (it1.disabled) cls += ' disabled';\n        if (it1.active) cls += ' active';\n        return h('td', '').child(\n          h('div', cls)\n            .on('click.stop', () => {\n              this.selectChange(it1.d);\n            })\n            .child(it1.d.getDate().toString()),\n        );\n      });\n      return h('tr', '').children(...tds);\n    });\n    bodyEl.html('').children(...trs);\n  }\n}\n","import Calendar from './calendar';\nimport { h } from './element';\nimport { cssPrefix } from '../config';\n\nexport default class Datepicker {\n  constructor() {\n    this.calendar = new Calendar(new Date());\n    this.el = h('div', `${cssPrefix}-datepicker`).child(\n      this.calendar.el,\n    ).hide();\n  }\n\n  setValue(date) {\n    // console.log(':::::::', date, typeof date, date instanceof string);\n    const { calendar } = this;\n    if (typeof date === 'string') {\n      // console.log(/^\\d{4}-\\d{1,2}-\\d{1,2}$/.test(date));\n      if (/^\\d{4}-\\d{1,2}-\\d{1,2}$/.test(date)) {\n        calendar.setValue(new Date(date.replace(new RegExp('-', 'g'), '/')));\n      }\n    } else if (date instanceof Date) {\n      calendar.setValue(date);\n    }\n    return this;\n  }\n\n  change(cb) {\n    this.calendar.selectChange = (d) => {\n      cb(d);\n      this.hide();\n    };\n  }\n\n  show() {\n    this.el.show();\n  }\n\n  hide() {\n    this.el.hide();\n  }\n}\n","//* global window */\nimport { h } from './element';\nimport Suggest from './suggest';\nimport Datepicker from './datepicker';\nimport { cssPrefix } from '../config';\n// import { mouseMoveUp } from '../event';\n\nfunction resetTextareaSize() {\n  if (!/^\\s*$/.test(this.inputText)) {\n    const {\n      textlineEl, textEl, areaOffset,\n    } = this;\n    const tlineWidth = textlineEl.offset().width + 9;\n    const maxWidth = this.viewFn().width - areaOffset.left - 9;\n    // console.log('tlineWidth:', tlineWidth, ':', maxWidth);\n    if (tlineWidth > areaOffset.width) {\n      let twidth = tlineWidth;\n      if (tlineWidth > maxWidth) {\n        twidth = maxWidth;\n        let h1 = parseInt(tlineWidth / maxWidth, 10);\n        h1 += (tlineWidth % maxWidth) > 0 ? 1 : 0;\n        h1 *= this.rowHeight;\n        if (h1 > areaOffset.height) {\n          textEl.css('height', `${h1}px`);\n        }\n      }\n      textEl.css('width', `${twidth}px`);\n    }\n  }\n}\n\nfunction inputEventHandler(evt) {\n  const v = evt.target.value;\n  // console.log(evt, 'v:', v);\n  const { suggest, textlineEl, validator } = this;\n  this.inputText = v;\n  if (validator) {\n    if (validator.type === 'list') {\n      suggest.search(v);\n    } else {\n      suggest.hide();\n    }\n  } else {\n    const start = v.lastIndexOf('=');\n    if (start !== -1) {\n      suggest.search(v.substring(start + 1));\n    } else {\n      suggest.hide();\n    }\n  }\n  textlineEl.html(v);\n  resetTextareaSize.call(this);\n  this.change('input', v);\n}\n\nfunction setTextareaRange(position) {\n  const { el } = this.textEl;\n  setTimeout(() => {\n    el.focus();\n    el.setSelectionRange(position, position);\n  }, 0);\n}\n\nfunction setText(text, position) {\n  const { textEl, textlineEl } = this;\n  // firefox bug\n  textEl.el.blur();\n\n  textEl.val(text);\n  textlineEl.html(text);\n  setTextareaRange.call(this, position);\n}\n\nfunction suggestItemClick(it) {\n  const { inputText, validator } = this;\n  let position = 0;\n  if (validator && validator.type === 'list') {\n    this.inputText = it;\n    position = this.inputText.length;\n  } else {\n    const start = inputText.lastIndexOf('=');\n    const sit = inputText.substring(0, start + 1);\n    let eit = inputText.substring(start + 1);\n    if (eit.indexOf(')') !== -1) {\n      eit = eit.substring(eit.indexOf(')'));\n    } else {\n      eit = '';\n    }\n    this.inputText = `${sit + it.key}(`;\n    // console.log('inputText:', this.inputText);\n    position = this.inputText.length;\n    this.inputText += `)${eit}`;\n  }\n  setText.call(this, this.inputText, position);\n}\n\nfunction resetSuggestItems() {\n  this.suggest.setItems(this.formulas);\n}\n\nfunction dateFormat(d) {\n  let month = d.getMonth() + 1;\n  let date = d.getDate();\n  if (month < 10) month = `0${month}`;\n  if (date < 10) date = `0${date}`;\n  return `${d.getFullYear()}-${month}-${date}`;\n}\n\nexport default class Editor {\n  constructor(formulas, viewFn, rowHeight) {\n    this.viewFn = viewFn;\n    this.rowHeight = rowHeight;\n    this.formulas = formulas;\n    this.suggest = new Suggest(formulas, (it) => {\n      suggestItemClick.call(this, it);\n    });\n    this.datepicker = new Datepicker();\n    this.datepicker.change((d) => {\n      // console.log('d:', d);\n      this.setText(dateFormat(d));\n      this.clear();\n    });\n    this.areaEl = h('div', `${cssPrefix}-editor-area`)\n      .children(\n        this.textEl = h('textarea', '')\n          .on('input', evt => inputEventHandler.call(this, evt)),\n        this.textlineEl = h('div', 'textline'),\n        this.suggest.el,\n        this.datepicker.el,\n      )\n      .on('mousemove.stop', () => {})\n      .on('mousedown.stop', () => {});\n    this.el = h('div', `${cssPrefix}-editor`)\n      .child(this.areaEl).hide();\n    this.suggest.bindInputEvents(this.textEl);\n\n    this.areaOffset = null;\n    this.freeze = { w: 0, h: 0 };\n    this.cell = null;\n    this.inputText = '';\n    this.change = () => {};\n  }\n\n  setFreezeLengths(width, height) {\n    this.freeze.w = width;\n    this.freeze.h = height;\n  }\n\n  clear() {\n    // const { cell } = this;\n    // const cellText = (cell && cell.text) || '';\n    if (this.inputText !== '') {\n      this.change('finished', this.inputText);\n    }\n    this.cell = null;\n    this.areaOffset = null;\n    this.inputText = '';\n    this.el.hide();\n    this.textEl.val('');\n    this.textlineEl.html('');\n    resetSuggestItems.call(this);\n    this.datepicker.hide();\n  }\n\n  setOffset(offset, suggestPosition = 'top') {\n    const {\n      textEl, areaEl, suggest, freeze, el,\n    } = this;\n    if (offset) {\n      this.areaOffset = offset;\n      const {\n        left, top, width, height, l, t,\n      } = offset;\n      // console.log('left:', left, ',top:', top, ', freeze:', freeze);\n      const elOffset = { left: 0, top: 0 };\n      // top left\n      if (freeze.w > l && freeze.h > t) {\n        //\n      } else if (freeze.w < l && freeze.h < t) {\n        elOffset.left = freeze.w;\n        elOffset.top = freeze.h;\n      } else if (freeze.w > l) {\n        elOffset.top = freeze.h;\n      } else if (freeze.h > t) {\n        elOffset.left = freeze.w;\n      }\n      el.offset(elOffset);\n      areaEl.offset({ left: left - elOffset.left - 0.8, top: top - elOffset.top - 0.8 });\n      textEl.offset({ width: width - 9 + 0.8, height: height - 3 + 0.8 });\n      const sOffset = { left: 0 };\n      sOffset[suggestPosition] = height;\n      suggest.setOffset(sOffset);\n      suggest.hide();\n    }\n  }\n\n  setCell(cell, validator) {\n    // console.log('::', validator);\n    const { el, datepicker, suggest } = this;\n    el.show();\n    this.cell = cell;\n    const text = (cell && cell.text) || '';\n    this.setText(text);\n\n    this.validator = validator;\n    if (validator) {\n      const { type } = validator;\n      if (type === 'date') {\n        datepicker.show();\n        if (!/^\\s*$/.test(text)) {\n          datepicker.setValue(text);\n        }\n      }\n      if (type === 'list') {\n        suggest.setItems(validator.values());\n        suggest.search('');\n      }\n    }\n  }\n\n  setText(text) {\n    this.inputText = text;\n    // console.log('text>>:', text);\n    setText.call(this, text, text.length);\n    resetTextareaSize.call(this);\n  }\n}\n","import { h } from './element';\nimport { bindClickoutside, unbindClickoutside } from './event';\nimport { cssPrefix } from '../config';\nimport { tf } from '../locale/locale';\n\nconst menuItems = [\n  { key: 'copy', title: tf('contextmenu.copy'), label: 'Ctrl+C' },\n  { key: 'cut', title: tf('contextmenu.cut'), label: 'Ctrl+X' },\n  { key: 'paste', title: tf('contextmenu.paste'), label: 'Ctrl+V' },\n  { key: 'paste-value', title: tf('contextmenu.pasteValue'), label: 'Ctrl+Shift+V' },\n  { key: 'paste-format', title: tf('contextmenu.pasteFormat'), label: 'Ctrl+Alt+V' },\n  { key: 'divider' },\n  { key: 'insert-row', title: tf('contextmenu.insertRow') },\n  { key: 'insert-column', title: tf('contextmenu.insertColumn') },\n  { key: 'divider' },\n  { key: 'delete-row', title: tf('contextmenu.deleteRow') },\n  { key: 'delete-column', title: tf('contextmenu.deleteColumn') },\n  { key: 'delete-cell-text', title: tf('contextmenu.deleteCellText') },\n  { key: 'divider' },\n  { key: 'validation', title: tf('contextmenu.validation') },\n];\n\nfunction buildMenuItem(item) {\n  if (item.key === 'divider') {\n    return h('div', `${cssPrefix}-item divider`);\n  }\n  return h('div', `${cssPrefix}-item`)\n    .on('click', () => {\n      this.itemClick(item.key);\n      this.hide();\n    })\n    .children(\n      item.title(),\n      h('div', 'label').child(item.label || ''),\n    );\n}\n\nfunction buildMenu() {\n  return menuItems.map(it => buildMenuItem.call(this, it));\n}\n\nexport default class ContextMenu {\n  constructor(viewFn, isHide = false) {\n    this.el = h('div', `${cssPrefix}-contextmenu`)\n      .children(...buildMenu.call(this))\n      .hide();\n    this.viewFn = viewFn;\n    this.itemClick = () => {};\n    this.isHide = isHide;\n  }\n\n  hide() {\n    const { el } = this;\n    el.hide();\n    unbindClickoutside(el);\n  }\n\n  setPosition(x, y) {\n    if (this.isHide) return;\n    const { el } = this;\n    const { height, width } = el.show().offset();\n    const view = this.viewFn();\n    let top = y;\n    let left = x;\n    if (view.height - y <= height) {\n      top -= height;\n    }\n    if (view.width - x <= width) {\n      left -= width;\n    }\n    el.offset({ left, top });\n    bindClickoutside(el);\n  }\n}\n","const baseFonts = [\n  { key: 'Arial', title: 'Arial' },\n  { key: 'Helvetica', title: 'Helvetica' },\n  { key: 'Source Sans Pro', title: 'Source Sans Pro' },\n  { key: 'Comic Sans MS', title: 'Comic Sans MS' },\n  { key: 'Courier New', title: 'Courier New' },\n  { key: 'Verdana', title: 'Verdana' },\n  { key: 'Lato', title: 'Lato' },\n];\n\nconst fontSizes = [\n  { pt: 7.5, px: 10 },\n  { pt: 8, px: 11 },\n  { pt: 9, px: 12 },\n  { pt: 10, px: 13 },\n  { pt: 10.5, px: 14 },\n  { pt: 11, px: 15 },\n  { pt: 12, px: 16 },\n  { pt: 14, px: 18.7 },\n  { pt: 15, px: 20 },\n  { pt: 16, px: 21.3 },\n  { pt: 18, px: 24 },\n  { pt: 22, px: 29.3 },\n  { pt: 24, px: 32 },\n  { pt: 26, px: 34.7 },\n  { pt: 36, px: 48 },\n  { pt: 42, px: 56 },\n  // { pt: 54, px: 71.7 },\n  // { pt: 63, px: 83.7 },\n  // { pt: 72, px: 95.6 },\n];\n\nfunction getFontSizePxByPt(pt) {\n  for (let i = 0; i < fontSizes.length; i += 1) {\n    const fontSize = fontSizes[i];\n    if (fontSize.pt === pt) {\n      return fontSize.px;\n    }\n  }\n  return pt;\n}\n\nconst fonts = (ary = []) => {\n  const map = {};\n  baseFonts.concat(ary).forEach((f) => {\n    map[f.key] = f;\n  });\n  return map;\n};\n\nexport default {};\nexport {\n  fontSizes,\n  fonts,\n  baseFonts,\n  getFontSizePxByPt,\n};\n","import { expr2xy, xy2expr } from './alphabet';\n\n// Converting infix expression to a suffix expression\n// src: AVERAGE(SUM(A1,A2), B1) + 50 + B20\n// return: [A1, A2], SUM[, B1],AVERAGE,50,+,B20,+\nconst infixExprToSuffixExpr = (src) => {\n  const operatorStack = [];\n  const stack = [];\n  let subStrs = []; // SUM, A1, B2, 50 ...\n  let fnArgType = 0; // 1 => , 2 => :\n  let fnArgOperator = '';\n  let fnArgsLen = 1; // A1,A2,A3...\n  for (let i = 0; i < src.length; i += 1) {\n    const c = src.charAt(i);\n    // console.log('c:', c);\n    if (c !== ' ') {\n      if (c >= 'a' && c <= 'z') {\n        subStrs.push(c.toUpperCase());\n      } else if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || c === '.') {\n        subStrs.push(c);\n      } else if (c === '\"') {\n        i += 1;\n        while (src.charAt(i) !== '\"') {\n          subStrs.push(src.charAt(i));\n          i += 1;\n        }\n        stack.push(`\"${subStrs.join('')}`);\n        subStrs = [];\n      } else {\n        // console.log('subStrs:', subStrs.join(''), stack);\n        if (c !== '(' && subStrs.length > 0) {\n          stack.push(subStrs.join(''));\n        }\n        if (c === ')') {\n          let c1 = operatorStack.pop();\n          if (fnArgType === 2) {\n            // fn argument range => A1:B5\n            try {\n              const [ex, ey] = expr2xy(stack.pop());\n              const [sx, sy] = expr2xy(stack.pop());\n              // console.log('::', sx, sy, ex, ey);\n              let rangelen = 0;\n              for (let x = sx; x <= ex; x += 1) {\n                for (let y = sy; y <= ey; y += 1) {\n                  stack.push(xy2expr(x, y));\n                  rangelen += 1;\n                }\n              }\n              stack.push([c1, rangelen]);\n            } catch (e) {\n              // console.log(e);\n            }\n          } else if (fnArgType === 1 || fnArgType === 3) {\n            if (fnArgType === 3) stack.push(fnArgOperator);\n            // fn argument => A1,A2,B5\n            stack.push([c1, fnArgsLen]);\n            fnArgsLen = 1;\n          } else {\n            // console.log('c1:', c1, fnArgType, stack, operatorStack);\n            while (c1 !== '(') {\n              stack.push(c1);\n              if (operatorStack.length <= 0) break;\n              c1 = operatorStack.pop();\n            }\n          }\n          fnArgType = 0;\n        } else if (c === '=' || c === '>' || c === '<') {\n          const nc = src.charAt(i + 1);\n          fnArgOperator = c;\n          if (nc === '=') {\n            fnArgOperator += nc;\n            i += 1;\n          }\n          fnArgType = 3;\n        } else if (c === ':') {\n          fnArgType = 2;\n        } else if (c === ',') {\n          if (fnArgType === 3) {\n            stack.push(fnArgOperator);\n          }\n          fnArgType = 1;\n          fnArgsLen += 1;\n        } else if (c === '(' && subStrs.length > 0) {\n          // function\n          operatorStack.push(subStrs.join(''));\n        } else {\n          // priority: */ > +-\n          // console.log(operatorStack, c, stack);\n          if (operatorStack.length > 0 && (c === '+' || c === '-')) {\n            let top = operatorStack[operatorStack.length - 1];\n            if (top !== '(') stack.push(operatorStack.pop());\n            if (top === '*' || top === '/') {\n              while (operatorStack.length > 0) {\n                top = operatorStack[operatorStack.length - 1];\n                if (top !== '(') stack.push(operatorStack.pop());\n                else break;\n              }\n            }\n          }\n          operatorStack.push(c);\n        }\n        subStrs = [];\n      }\n    }\n  }\n  if (subStrs.length > 0) {\n    stack.push(subStrs.join(''));\n  }\n  while (operatorStack.length > 0) {\n    stack.push(operatorStack.pop());\n  }\n  return stack;\n};\n\nconst evalSubExpr = (subExpr, cellRender) => {\n  if (subExpr[0] >= '0' && subExpr[0] <= '9') {\n    return Number(subExpr);\n  }\n  if (subExpr[0] === '\"') {\n    return subExpr.substring(1);\n  }\n  const [x, y] = expr2xy(subExpr);\n  return cellRender(x, y);\n};\n\n// evaluate the suffix expression\n// srcStack: <= infixExprToSufixExpr\n// formulaMap: {'SUM': {}, ...}\n// cellRender: (x, y) => {}\nconst evalSuffixExpr = (srcStack, formulaMap, cellRender, cellList) => {\n  const stack = [];\n  // console.log(':::::formulaMap:', formulaMap);\n  for (let i = 0; i < srcStack.length; i += 1) {\n    // console.log(':::>>>', srcStack[i]);\n    const expr = srcStack[i];\n    const fc = expr[0];\n    if (expr === '+') {\n      const top = stack.pop();\n      stack.push(Number(stack.pop()) + Number(top));\n    } else if (expr === '-') {\n      const top = stack.pop();\n      stack.push(Number(stack.pop()) - Number(top));\n    } else if (expr === '*') {\n      stack.push(Number(stack.pop()) * Number(stack.pop()));\n    } else if (expr === '/') {\n      const top = stack.pop();\n      stack.push(Number(stack.pop()) / Number(top));\n    } else if (fc === '=' || fc === '>' || fc === '<') {\n      const top = stack.pop();\n      const Fn = Function;\n      stack.push(new Fn(`return ${stack.pop()} ${expr === '=' ? '==' : expr} ${top}`)());\n    } else if (Array.isArray(expr)) {\n      const [formula, len] = expr;\n      const params = [];\n      for (let j = 0; j < len; j += 1) {\n        params.push(stack.pop());\n      }\n      // console.log('::::params:', formulaMap, expr,  formula, params);\n      stack.push(formulaMap[formula].render(params.reverse()));\n    } else {\n      // console.log('cellList:', cellList, expr);\n      if (cellList.includes(expr)) {\n        return 0;\n      }\n      if ((fc >= 'a' && fc <= 'z') || (fc >= 'A' && fc <= 'Z')) {\n        cellList.push(expr);\n      }\n      stack.push(evalSubExpr(expr, cellRender));\n    }\n    // console.log('stack:', stack);\n  }\n  return stack[0];\n};\n\nconst cellRender = (src, formulaMap, getCellText, cellList = []) => {\n  if (src[0] === '=') {\n    const stack = infixExprToSuffixExpr(src.substring(1));\n    if (stack.length <= 0) return src;\n    return evalSuffixExpr(\n      stack,\n      formulaMap,\n      (x, y) => cellRender(getCellText(x, y), formulaMap, getCellText, cellList),\n      cellList,\n    );\n  }\n  return src;\n};\n\nexport default {\n  render: cellRender,\n};\nexport {\n  infixExprToSuffixExpr,\n};\n","/**\n  formula:\n    key\n    title\n    render\n*/\nimport { tf } from '../locale/locale';\n\nconst baseFormulas = [\n  {\n    key: 'SUM',\n    title: tf('formula.sum'),\n    render: ary => ary.reduce((a, b) => Number(a) + Number(b), 0),\n  },\n  {\n    key: 'AVERAGE',\n    title: tf('formula.average'),\n    render: ary => ary.reduce((a, b) => Number(a) + Number(b), 0) / ary.length,\n  },\n  {\n    key: 'MAX',\n    title: tf('formula.max'),\n    render: ary => Math.max(...ary.map(v => Number(v))),\n  },\n  {\n    key: 'MIN',\n    title: tf('formula.min'),\n    render: ary => Math.min(...ary.map(v => Number(v))),\n  },\n  {\n    key: 'IF',\n    title: tf('formula._if'),\n    render: ([b, t, f]) => (b ? t : f),\n  },\n  {\n    key: 'AND',\n    title: tf('formula.and'),\n    render: ary => ary.every(it => it),\n  },\n  {\n    key: 'OR',\n    title: tf('formula.or'),\n    render: ary => ary.some(it => it),\n  },\n  {\n    key: 'CONCAT',\n    title: tf('formula.concat'),\n    render: ary => ary.join(''),\n  },\n  /* support:  1 + A1 + B2 * 3\n  {\n    key: 'DIVIDE',\n    title: tf('formula.divide'),\n    render: ary => ary.reduce((a, b) => Number(a) / Number(b)),\n  },\n  {\n    key: 'PRODUCT',\n    title: tf('formula.product'),\n    render: ary => ary.reduce((a, b) => Number(a) * Number(b),1),\n  },\n  {\n    key: 'SUBTRACT',\n    title: tf('formula.subtract'),\n    render: ary => ary.reduce((a, b) => Number(a) - Number(b)),\n  },\n  */\n];\n\nconst formulas = baseFormulas;\n\n// const formulas = (formulaAry = []) => {\n//   const formulaMap = {};\n//   baseFormulas.concat(formulaAry).forEach((f) => {\n//     formulaMap[f.key] = f;\n//   });\n//   return formulaMap;\n// };\nconst formulam = {};\nbaseFormulas.forEach((f) => {\n  formulam[f.key] = f;\n});\n\nexport default {\n};\n\nexport {\n  formulam,\n  formulas,\n  baseFormulas,\n};\n","import { tf } from '../locale/locale';\n\nconst formatStringRender = v => v;\n\nconst formatNumberRender = (v) => {\n  if (/^(-?\\d*.?\\d*)$/.test(v)) {\n    const v1 = Number(v).toFixed(2).toString();\n    const [first, ...parts] = v1.split('\\\\.');\n    return [first.replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1,'), ...parts];\n  }\n  return v;\n};\n\nconst baseFormats = [\n  {\n    key: 'normal',\n    title: tf('format.normal'),\n    type: 'string',\n    render: formatStringRender,\n  },\n  {\n    key: 'text',\n    title: tf('format.text'),\n    type: 'string',\n    render: formatStringRender,\n  },\n  {\n    key: 'number',\n    title: tf('format.number'),\n    type: 'number',\n    label: '1,000.12',\n    render: formatNumberRender,\n  },\n  {\n    key: 'percent',\n    title: tf('format.percent'),\n    type: 'number',\n    label: '10.12%',\n    render: v => `${v}%`,\n  },\n  {\n    key: 'rmb',\n    title: tf('format.rmb'),\n    type: 'number',\n    label: '¥10.00',\n    render: v => `¥${formatNumberRender(v)}`,\n  },\n  {\n    key: 'usd',\n    title: tf('format.usd'),\n    type: 'number',\n    label: '$10.00',\n    render: v => `$${formatNumberRender(v)}`,\n  },\n  {\n    key: 'eur',\n    title: tf('format.eur'),\n    type: 'number',\n    label: '€10.00',\n    render: v => `€${formatNumberRender(v)}`,\n  },\n  {\n    key: 'date',\n    title: tf('format.date'),\n    type: 'date',\n    label: '26/09/2008',\n    render: formatStringRender,\n  },\n  {\n    key: 'time',\n    title: tf('format.time'),\n    type: 'date',\n    label: '15:59:00',\n    render: formatStringRender,\n  },\n  {\n    key: 'datetime',\n    title: tf('format.datetime'),\n    type: 'date',\n    label: '26/09/2008 15:59:00',\n    render: formatStringRender,\n  },\n  {\n    key: 'duration',\n    title: tf('format.duration'),\n    type: 'date',\n    label: '24:01:00',\n    render: formatStringRender,\n  },\n];\n\n// const formats = (ary = []) => {\n//   const map = {};\n//   baseFormats.concat(ary).forEach((f) => {\n//     map[f.key] = f;\n//   });\n//   return map;\n// };\nconst formatm = {};\nbaseFormats.forEach((f) => {\n  formatm[f.key] = f;\n});\n\nexport default {\n};\nexport {\n  formatm,\n  baseFormats,\n};\n","/* global window */\nfunction dpr() {\n  return window.devicePixelRatio || 1;\n}\n\nfunction thinLineWidth() {\n  return dpr() - 0.5;\n}\n\nfunction npx(px) {\n  return parseInt(px * dpr(), 10);\n}\n\nfunction npxLine(px) {\n  const n = npx(px);\n  return n > 0 ? n - 0.5 : 0.5;\n}\n\nclass DrawBox {\n  constructor(x, y, w, h, padding = 0) {\n    this.x = x;\n    this.y = y;\n    this.width = w;\n    this.height = h;\n    this.padding = padding;\n    this.bgcolor = '#ffffff';\n    // border: [width, style, color]\n    this.borderTop = null;\n    this.borderRight = null;\n    this.borderBottom = null;\n    this.borderLeft = null;\n  }\n\n  setBorders({\n    top, bottom, left, right,\n  }) {\n    if (top) this.borderTop = top;\n    if (right) this.borderRight = right;\n    if (bottom) this.borderBottom = bottom;\n    if (left) this.borderLeft = left;\n  }\n\n  innerWidth() {\n    return this.width - (this.padding * 2);\n  }\n\n  innerHeight() {\n    return this.height - (this.padding * 2);\n  }\n\n  textx(align) {\n    const { width, padding } = this;\n    let { x } = this;\n    if (align === 'left') {\n      x += padding;\n    } else if (align === 'center') {\n      x += width / 2;\n    } else if (align === 'right') {\n      x += width - padding;\n    }\n    return x;\n  }\n\n  texty(align, fontSize, hoffset) {\n    const { height, padding } = this;\n    let { y } = this;\n    if (align === 'top') {\n      y += padding;\n    } else if (align === 'middle') {\n      y = y + height / 2 - hoffset;\n      // y = y1;\n      // const y2 = y + padding + fontSize / 2 + 1;\n      // if (y1 < y2) y = y2;\n      // else y = y1;\n    } else if (align === 'bottom') {\n      y += height - hoffset * 2 - padding;\n    }\n    return y;\n  }\n\n  topxys() {\n    const { x, y, width } = this;\n    return [[x, y], [x + width, y]];\n  }\n\n  rightxys() {\n    const {\n      x, y, width, height,\n    } = this;\n    return [[x + width, y], [x + width, y + height]];\n  }\n\n  bottomxys() {\n    const {\n      x, y, width, height,\n    } = this;\n    return [[x, y + height], [x + width, y + height]];\n  }\n\n  leftxys() {\n    const {\n      x, y, height,\n    } = this;\n    return [[x, y], [x, y + height]];\n  }\n}\n\nfunction drawFontLine(type, tx, ty, align, valign, blheight, blwidth) {\n  const floffset = { x: 0, y: 0 };\n  if (type === 'underline') {\n    if (valign === 'bottom') {\n      floffset.y = 0;\n    } else if (valign === 'top') {\n      floffset.y = -(blheight + 2);\n    } else {\n      floffset.y = -blheight / 2;\n    }\n  } else if (type === 'strike') {\n    if (valign === 'bottom') {\n      floffset.y = blheight / 2;\n    } else if (valign === 'top') {\n      floffset.y = -((blheight / 2) + 2);\n    }\n  }\n\n  if (align === 'center') {\n    floffset.x = blwidth / 2;\n  } else if (align === 'right') {\n    floffset.x = blwidth;\n  }\n  this.line(\n    [tx - floffset.x, ty - floffset.y],\n    [tx - floffset.x + blwidth, ty - floffset.y],\n  );\n}\n\nclass Draw {\n  constructor(el, width, height) {\n    this.el = el;\n    this.ctx = el.getContext('2d');\n    this.resize(width, height);\n    this.ctx.scale(dpr(), dpr());\n  }\n\n  resize(width, height) {\n    // console.log('dpr:', dpr);\n    this.el.style.width = `${width}px`;\n    this.el.style.height = `${height}px`;\n    this.el.width = npx(width);\n    this.el.height = npx(height);\n  }\n\n  clear() {\n    const { width, height } = this.el;\n    this.ctx.clearRect(0, 0, width, height);\n    return this;\n  }\n\n  attr(options) {\n    Object.assign(this.ctx, options);\n    return this;\n  }\n\n  save() {\n    this.ctx.save();\n    this.ctx.beginPath();\n    return this;\n  }\n\n  restore() {\n    this.ctx.restore();\n    return this;\n  }\n\n  beginPath() {\n    this.ctx.beginPath();\n    return this;\n  }\n\n  translate(x, y) {\n    this.ctx.translate(npx(x), npx(y));\n    return this;\n  }\n\n  clearRect(x, y, w, h) {\n    this.ctx.clearRect(x, y, w, h);\n    return this;\n  }\n\n  fillRect(x, y, w, h) {\n    this.ctx.fillRect(npx(x) - 0.5, npx(y) - 0.5, npx(w), npx(h));\n    return this;\n  }\n\n  fillText(text, x, y) {\n    this.ctx.fillText(text, npx(x), npx(y));\n    return this;\n  }\n\n  /*\n    txt: render text\n    box: DrawBox\n    attr: {\n      align: left | center | right\n      valign: top | middle | bottom\n      color: '#333333',\n      strike: false,\n      font: {\n        name: 'Arial',\n        size: 14,\n        bold: false,\n        italic: false,\n      }\n    }\n    textWrap: text wrapping\n  */\n  text(txt, box, attr = {}, textWrap = true) {\n    const { ctx } = this;\n    const {\n      align, valign, font, color, strike, underline,\n    } = attr;\n    const tx = box.textx(align);\n    ctx.save();\n    ctx.beginPath();\n    this.attr({\n      textAlign: align,\n      textBaseline: valign,\n      font: `${font.italic ? 'italic' : ''} ${font.bold ? 'bold' : ''} ${npx(font.size)}px ${font.name}`,\n      fillStyle: color,\n      strokeStyle: color,\n    });\n    const txtWidth = ctx.measureText(txt).width;\n    let hoffset = 0;\n    if (textWrap) {\n      const n = Math.ceil(txtWidth / box.innerWidth());\n      hoffset = ((n - 1) * font.size) / 2;\n    }\n    let ty = box.texty(valign, font.size, hoffset);\n    // console.log('tx: ', tx, ', ty:', ty);\n    if (textWrap && txtWidth > box.innerWidth()) {\n      const textLine = { len: 0, start: 0 };\n      for (let i = 0; i < txt.length; i += 1) {\n        if (textLine.len >= box.innerWidth()) {\n          this.fillText(txt.substring(textLine.start, i), tx, ty);\n          if (strike) {\n            drawFontLine.call(this, 'strike', tx, ty, align, valign, font.size, textLine.len);\n          }\n          if (underline) {\n            drawFontLine.call(this, 'underline', tx, ty, align, valign, font.size, textLine.len);\n          }\n          ty += font.size + 2;\n          textLine.len = 0;\n          textLine.start = i;\n        }\n        textLine.len += ctx.measureText(txt[i]).width;\n      }\n      if (textLine.len > 0) {\n        this.fillText(txt.substring(textLine.start), tx, ty);\n        if (strike) {\n          drawFontLine.call(this, 'strike', tx, ty, align, valign, font.size, textLine.len);\n        }\n        if (underline) {\n          drawFontLine.call(this, 'underline', tx, ty, align, valign, font.size, textLine.len);\n        }\n      }\n    } else {\n      this.fillText(txt, tx, ty);\n      if (strike) {\n        drawFontLine.call(this, 'strike', tx, ty, align, valign, font.size, txtWidth);\n      }\n      if (underline) {\n        drawFontLine.call(this, 'underline', tx, ty, align, valign, font.size, txtWidth);\n      }\n    }\n    ctx.restore();\n    return this;\n  }\n\n  border(style, color) {\n    const { ctx } = this;\n    ctx.lineWidth = thinLineWidth;\n    ctx.strokeStyle = color;\n    // console.log('style:', style);\n    if (style === 'medium') {\n      ctx.lineWidth = npx(2) - 0.5;\n    } else if (style === 'thick') {\n      ctx.lineWidth = npx(3);\n    } else if (style === 'dashed') {\n      ctx.setLineDash([npx(3), npx(2)]);\n    } else if (style === 'dotted') {\n      ctx.setLineDash([npx(1), npx(1)]);\n    } else if (style === 'double') {\n      ctx.setLineDash([npx(2), 0]);\n    }\n    return this;\n  }\n\n  line(...xys) {\n    const { ctx } = this;\n    if (xys.length > 1) {\n      const [x, y] = xys[0];\n      ctx.moveTo(npxLine(x), npxLine(y));\n      for (let i = 1; i < xys.length; i += 1) {\n        const [x1, y1] = xys[i];\n        ctx.lineTo(npxLine(x1), npxLine(y1));\n      }\n      ctx.stroke();\n    }\n    return this;\n  }\n\n  strokeBorders(box) {\n    const { ctx } = this;\n    ctx.save();\n    ctx.beginPath();\n    // border\n    const {\n      borderTop, borderRight, borderBottom, borderLeft,\n    } = box;\n    if (borderTop) {\n      this.border(...borderTop);\n      // console.log('box.topxys:', box.topxys());\n      this.line(...box.topxys());\n    }\n    if (borderRight) {\n      this.border(...borderRight);\n      this.line(...box.rightxys());\n    }\n    if (borderBottom) {\n      this.border(...borderBottom);\n      this.line(...box.bottomxys());\n    }\n    if (borderLeft) {\n      this.border(...borderLeft);\n      this.line(...box.leftxys());\n    }\n    ctx.restore();\n  }\n\n  dropdown(box) {\n    const { ctx } = this;\n    const {\n      x, y, width, height,\n    } = box;\n    const sx = x + width - 15;\n    const sy = y + height - 15;\n    ctx.save();\n    ctx.beginPath();\n    ctx.moveTo(npx(sx), npx(sy));\n    ctx.lineTo(npx(sx + 8), npx(sy));\n    ctx.lineTo(npx(sx + 4), npx(sy + 6));\n    ctx.closePath();\n    ctx.fillStyle = 'rgba(0, 0, 0, .45)';\n    ctx.fill();\n    ctx.restore();\n  }\n\n  error(box) {\n    const { ctx } = this;\n    const { x, y, width } = box;\n    const sx = x + width - 1;\n    ctx.save();\n    ctx.beginPath();\n    ctx.moveTo(npx(sx - 8), npx(y - 1));\n    ctx.lineTo(npx(sx), npx(y - 1));\n    ctx.lineTo(npx(sx), npx(y + 8));\n    ctx.closePath();\n    ctx.fillStyle = 'rgba(255, 0, 0, .65)';\n    ctx.fill();\n    ctx.restore();\n  }\n\n  rect(box, dtextcb) {\n    const { ctx } = this;\n    const {\n      x, y, width, height, bgcolor,\n    } = box;\n    ctx.save();\n    ctx.beginPath();\n    ctx.fillStyle = bgcolor || '#fff';\n    ctx.rect(npxLine(x + 1), npxLine(y + 1), npx(width - 2), npx(height - 2));\n    ctx.clip();\n    ctx.fill();\n    dtextcb();\n    ctx.restore();\n  }\n}\n\nexport default {};\nexport {\n  Draw,\n  DrawBox,\n  thinLineWidth,\n  npx,\n};\n","import { stringAt } from '../core/alphabet';\nimport { getFontSizePxByPt } from '../core/font';\nimport _cell from '../core/cell';\nimport { formulam } from '../core/formula';\nimport { formatm } from '../core/format';\n\nimport {\n  Draw, DrawBox, thinLineWidth, npx,\n} from '../canvas/draw';\n// gobal var\nconst cellPaddingWidth = 5;\nconst tableFixedHeaderCleanStyle = { fillStyle: '#f4f5f8' };\nconst tableGridStyle = {\n  fillStyle: '#fff',\n  lineWidth: thinLineWidth,\n  strokeStyle: '#e6e6e6',\n};\nfunction tableFixedHeaderStyle() {\n  return {\n    textAlign: 'center',\n    textBaseline: 'middle',\n    font: `500 ${npx(12)}px Source Sans Pro`,\n    fillStyle: '#585757',\n    lineWidth: thinLineWidth(),\n    strokeStyle: '#e6e6e6',\n  };\n}\n\nfunction getDrawBox(rindex, cindex) {\n  const { data } = this;\n  const {\n    left, top, width, height,\n  } = data.cellRect(rindex, cindex);\n  return new DrawBox(left, top, width, height, cellPaddingWidth);\n}\n/*\nfunction renderCellBorders(bboxes, translateFunc) {\n  const { draw } = this;\n  if (bboxes) {\n    const rset = new Set();\n    // console.log('bboxes:', bboxes);\n    bboxes.forEach(({ ri, ci, box }) => {\n      if (!rset.has(ri)) {\n        rset.add(ri);\n        translateFunc(ri);\n      }\n      draw.strokeBorders(box);\n    });\n  }\n}\n*/\n\nfunction renderCell(rindex, cindex) {\n  const { draw, data } = this;\n  const { sortedRowMap } = data;\n  let nrindex = rindex;\n  if (sortedRowMap.has(rindex)) {\n    nrindex = sortedRowMap.get(rindex);\n  }\n\n  const cell = data.getCell(nrindex, cindex);\n  if (cell === null) return;\n\n  const style = data.getCellStyleOrDefault(nrindex, cindex);\n  // console.log('style:', style);\n  const dbox = getDrawBox.call(this, rindex, cindex);\n  dbox.bgcolor = style.bgcolor;\n  if (style.border !== undefined) {\n    dbox.setBorders(style.border);\n    // bboxes.push({ ri: rindex, ci: cindex, box: dbox });\n    draw.strokeBorders(dbox);\n  }\n  draw.rect(dbox, () => {\n    // render text\n    let cellText = _cell.render(cell.text || '', formulam, (y, x) => (data.getCellTextOrDefault(x, y)));\n    if (style.format) {\n      // console.log(data.formatm, '>>', cell.format);\n      cellText = formatm[style.format].render(cellText);\n    }\n    const font = Object.assign({}, style.font);\n    font.size = getFontSizePxByPt(font.size);\n    // console.log('style:', style);\n    draw.text(cellText, dbox, {\n      align: style.align,\n      valign: style.valign,\n      font,\n      color: style.color,\n      strike: style.strike,\n      underline: style.underline,\n    }, style.textwrap);\n    // error\n    const error = data.validations.getError(rindex, cindex);\n    if (error) {\n      // console.log('error:', rindex, cindex, error);\n      draw.error(dbox);\n    }\n  });\n}\n\nfunction renderAutofilter(viewRange) {\n  const { data, draw } = this;\n  if (viewRange) {\n    const { autoFilter } = data;\n    if (!autoFilter.active()) return;\n    const afRange = autoFilter.hrange();\n    if (viewRange.intersects(afRange)) {\n      afRange.each((ri, ci) => {\n        const dbox = getDrawBox.call(this, ri, ci);\n        draw.dropdown(dbox);\n      });\n    }\n  }\n}\n\nfunction renderContent(viewRange, fw, fh, tx, ty) {\n  const { draw, data } = this;\n  draw.save();\n  draw.translate(fw, fh)\n    .translate(tx, ty);\n\n  const { exceptRowSet } = data;\n  // const exceptRows = Array.from(exceptRowSet);\n  const filteredTranslateFunc = (ri) => {\n    const ret = exceptRowSet.has(ri);\n    if (ret) {\n      const height = data.rows.getHeight(ri);\n      draw.translate(0, -height);\n    }\n    return !ret;\n  };\n\n  const exceptRowTotalHeight = data.exceptRowTotalHeight(viewRange.sri, viewRange.eri);\n  // 1 render cell\n  draw.save();\n  draw.translate(0, -exceptRowTotalHeight);\n  viewRange.each((ri, ci) => {\n    renderCell.call(this, ri, ci);\n  }, ri => filteredTranslateFunc(ri));\n  draw.restore();\n\n\n  // 2 render mergeCell\n  const rset = new Set();\n  draw.save();\n  draw.translate(0, -exceptRowTotalHeight);\n  data.eachMergesInView(viewRange, ({ sri, sci, eri }) => {\n    if (!exceptRowSet.has(sri)) {\n      renderCell.call(this, sri, sci);\n    } else if (!rset.has(sri)) {\n      rset.add(sri);\n      const height = data.rows.sumHeight(sri, eri + 1);\n      draw.translate(0, -height);\n    }\n  });\n  draw.restore();\n\n  // 3 render autofilter\n  renderAutofilter.call(this, viewRange);\n\n  draw.restore();\n}\n\nfunction renderSelectedHeaderCell(x, y, w, h) {\n  const { draw } = this;\n  draw.save();\n  draw.attr({ fillStyle: 'rgba(75, 137, 255, 0.08)' })\n    .fillRect(x, y, w, h);\n  draw.restore();\n}\n\n// viewRange\n// type: all | left | top\n// w: the fixed width of header\n// h: the fixed height of header\n// tx: moving distance on x-axis\n// ty: moving distance on y-axis\nfunction renderFixedHeaders(type, viewRange, w, h, tx, ty) {\n  const { draw, data } = this;\n  const sumHeight = viewRange.h; // rows.sumHeight(viewRange.sri, viewRange.eri + 1);\n  const sumWidth = viewRange.w; // cols.sumWidth(viewRange.sci, viewRange.eci + 1);\n  const nty = ty + h;\n  const ntx = tx + w;\n\n  draw.save();\n  // draw rect background\n  draw.attr(tableFixedHeaderCleanStyle);\n  if (type === 'all' || type === 'left') draw.fillRect(0, nty, w, sumHeight);\n  if (type === 'all' || type === 'top') draw.fillRect(ntx, 0, sumWidth, h);\n\n  const {\n    sri, sci, eri, eci,\n  } = data.selector.range;\n  // console.log(data.selectIndexes);\n  // draw text\n  // text font, align...\n  draw.attr(tableFixedHeaderStyle());\n  // y-header-text\n  if (type === 'all' || type === 'left') {\n    data.rowEach(viewRange.sri, viewRange.eri, (i, y1, rowHeight) => {\n      const y = nty + y1;\n      const ii = i;\n      draw.line([0, y], [w, y]);\n      if (sri <= ii && ii < eri + 1) {\n        renderSelectedHeaderCell.call(this, 0, y, w, rowHeight);\n      }\n      draw.fillText(ii + 1, w / 2, y + (rowHeight / 2));\n    });\n    draw.line([0, sumHeight + nty], [w, sumHeight + nty]);\n    draw.line([w, nty], [w, sumHeight + nty]);\n  }\n  // x-header-text\n  if (type === 'all' || type === 'top') {\n    data.colEach(viewRange.sci, viewRange.eci, (i, x1, colWidth) => {\n      const x = ntx + x1;\n      const ii = i;\n      draw.line([x, 0], [x, h]);\n      if (sci <= ii && ii < eci + 1) {\n        renderSelectedHeaderCell.call(this, x, 0, colWidth, h);\n      }\n      draw.fillText(stringAt(ii), x + (colWidth / 2), h / 2);\n    });\n    draw.line([sumWidth + ntx, 0], [sumWidth + ntx, h]);\n    draw.line([0, h], [sumWidth + ntx, h]);\n  }\n  draw.restore();\n}\n\nfunction renderFixedLeftTopCell(fw, fh) {\n  const { draw } = this;\n  draw.save();\n  // left-top-cell\n  draw.attr({ fillStyle: '#f4f5f8' })\n    .fillRect(0, 0, fw, fh);\n  draw.restore();\n}\n\nfunction renderContentGrid({\n  sri, sci, eri, eci, w, h,\n}, fw, fh, tx, ty) {\n  const { draw, data } = this;\n  const { settings } = data;\n\n  draw.save();\n  draw.attr(tableGridStyle)\n    .translate(fw + tx, fh + ty);\n  // const sumWidth = cols.sumWidth(sci, eci + 1);\n  // const sumHeight = rows.sumHeight(sri, eri + 1);\n  // console.log('sumWidth:', sumWidth);\n  draw.clearRect(0, 0, w, h);\n  if (!settings.showGrid) {\n    draw.restore();\n    return;\n  }\n  // console.log('rowStart:', rowStart, ', rowLen:', rowLen);\n  data.rowEach(sri, eri, (i, y, ch) => {\n    // console.log('y:', y);\n    if (i !== sri) draw.line([0, y], [w, y]);\n    if (i === eri) draw.line([0, y + ch], [w, y + ch]);\n  });\n  data.colEach(sci, eci, (i, x, cw) => {\n    if (i !== sci) draw.line([x, 0], [x, h]);\n    if (i === eci) draw.line([x + cw, 0], [x + cw, h]);\n  });\n  draw.restore();\n}\n\nfunction renderFreezeHighlightLine(fw, fh, ftw, fth) {\n  const { draw, data } = this;\n  const twidth = data.viewWidth() - fw;\n  const theight = data.viewHeight() - fh;\n  draw.save()\n    .translate(fw, fh)\n    .attr({ strokeStyle: 'rgba(75, 137, 255, .6)' });\n  draw.line([0, fth], [twidth, fth]);\n  draw.line([ftw, 0], [ftw, theight]);\n  draw.restore();\n}\n\n/** end */\nclass Table {\n  constructor(el, data) {\n    this.el = el;\n    this.draw = new Draw(el, data.viewWidth(), data.viewHeight());\n    this.data = data;\n  }\n\n  render() {\n    // resize canvas\n    const { data } = this;\n    const { rows, cols } = data;\n    // fixed width of header\n    const fw = cols.indexWidth;\n    // fixed height of header\n    const fh = rows.height;\n\n    this.draw.resize(data.viewWidth(), data.viewHeight());\n    this.clear();\n\n    const viewRange = data.viewRange();\n    // renderAll.call(this, viewRange, data.scroll);\n    const tx = data.freezeTotalWidth();\n    const ty = data.freezeTotalHeight();\n    const { x, y } = data.scroll;\n    // 1\n    renderContentGrid.call(this, viewRange, fw, fh, tx, ty);\n    renderContent.call(this, viewRange, fw, fh, -x, -y);\n    renderFixedHeaders.call(this, 'all', viewRange, fw, fh, tx, ty);\n    renderFixedLeftTopCell.call(this, fw, fh);\n    const [fri, fci] = data.freeze;\n    if (fri > 0 || fci > 0) {\n      // 2\n      if (fri > 0) {\n        const vr = viewRange.clone();\n        vr.sri = 0;\n        vr.eri = fri - 1;\n        vr.h = ty;\n        renderContentGrid.call(this, vr, fw, fh, tx, 0);\n        renderContent.call(this, vr, fw, fh, -x, 0);\n        renderFixedHeaders.call(this, 'top', vr, fw, fh, tx, 0);\n      }\n      // 3\n      if (fci > 0) {\n        const vr = viewRange.clone();\n        vr.sci = 0;\n        vr.eci = fci - 1;\n        vr.w = tx;\n        renderContentGrid.call(this, vr, fw, fh, 0, ty);\n        renderFixedHeaders.call(this, 'left', vr, fw, fh, 0, ty);\n        renderContent.call(this, vr, fw, fh, 0, -y);\n      }\n      // 4\n      const freezeViewRange = data.freezeViewRange();\n      renderContentGrid.call(this, freezeViewRange, fw, fh, 0, 0);\n      renderFixedHeaders.call(this, 'all', freezeViewRange, fw, fh, 0, 0);\n      renderContent.call(this, freezeViewRange, fw, fh, 0, 0);\n      // 5\n      renderFreezeHighlightLine.call(this, fw, fh, tx, ty);\n    }\n  }\n\n  clear() {\n    this.draw.clear();\n  }\n}\n\nexport default Table;\n","import { cssPrefix } from '../../config';\nimport tooltip from '../tooltip';\nimport { h } from '../element';\nimport { t } from '../../locale/locale';\n\nexport default class Item {\n  // tooltip\n  // tag: the subclass type\n  // shortcut: shortcut key\n  constructor(tag, shortcut, value) {\n    this.tip = t(`toolbar.${tag.replace(/-[a-z]/g, c => c[1].toUpperCase())}`);\n    this.tag = tag;\n    this.shortcut = shortcut;\n    this.value = value;\n    this.el = this.element();\n    this.change = () => {};\n  }\n\n  element() {\n    const { tip } = this;\n    return h('div', `${cssPrefix}-toolbar-btn`)\n      .on('mouseenter', (evt) => {\n        tooltip(tip, evt.target);\n      })\n      .attr('data-tooltip', tip);\n  }\n\n  setState() {}\n}\n","/* global document */\nimport { h } from './element';\nimport { bind } from './event';\nimport { cssPrefix } from '../config';\n\nexport default function tooltip(html, target) {\n  if (target.classList.contains('active')) {\n    return;\n  }\n  const {\n    left, top, width, height,\n  } = target.getBoundingClientRect();\n  const el = h('div', `${cssPrefix}-tooltip`).html(html).show();\n  document.body.appendChild(el.el);\n  const elBox = el.box();\n  // console.log('elBox:', elBox);\n  el.css('left', `${left + (width / 2) - (elBox.width / 2)}px`)\n    .css('top', `${top + height + 2}px`);\n\n  bind(target, 'mouseleave', () => {\n    if (document.body.contains(el.el)) {\n      document.body.removeChild(el.el);\n    }\n  });\n\n  bind(target, 'click', () => {\n    if (document.body.contains(el.el)) {\n      document.body.removeChild(el.el);\n    }\n  });\n}\n","import Item from './item';\n\nexport default class DropdownItem extends Item {\n  dropdown() {}\n\n  getValue(v) {\n    return v;\n  }\n\n  element() {\n    const { tag } = this;\n    this.dd = this.dropdown();\n    this.dd.change = it => this.change(tag, this.getValue(it));\n    return super.element().child(\n      this.dd,\n    );\n  }\n\n  setState(v) {\n    if (v) {\n      this.value = v;\n      this.dd.setTitle(v);\n    }\n  }\n}\n","import { Element, h } from './element';\nimport { bindClickoutside, unbindClickoutside } from './event';\nimport { cssPrefix } from '../config';\n\nexport default class Dropdown extends Element {\n  constructor(title, width, showArrow, placement, ...children) {\n    super('div', `${cssPrefix}-dropdown ${placement}`);\n    this.title = title;\n    this.change = () => {};\n    if (typeof title === 'string') {\n      this.title = h('div', `${cssPrefix}-dropdown-title`).child(title);\n    } else if (showArrow) {\n      this.title.addClass('arrow-left');\n    }\n    this.contentEl = h('div', `${cssPrefix}-dropdown-content`)\n      .children(...children)\n      .css('width', width)\n      .hide();\n\n    this.headerEl = h('div', `${cssPrefix}-dropdown-header`);\n    this.headerEl.on('click', () => {\n      if (this.contentEl.css('display') !== 'block') {\n        this.show();\n      } else {\n        this.hide();\n      }\n    }).children(\n      this.title,\n      showArrow ? h('div', `${cssPrefix}-icon arrow-right`).child(\n        h('div', `${cssPrefix}-icon-img arrow-down`),\n      ) : '',\n    );\n    this.children(this.headerEl, this.contentEl);\n  }\n\n  setTitle(title) {\n    this.title.html(title);\n    this.hide();\n  }\n\n  show() {\n    const { contentEl } = this;\n    contentEl.show();\n    this.parent().active();\n    bindClickoutside(this.parent(), () => {\n      this.hide();\n    });\n  }\n\n  hide() {\n    this.parent().active(false);\n    this.contentEl.hide();\n    unbindClickoutside(this.parent());\n  }\n}\n","import Dropdown from './dropdown';\nimport { h } from './element';\nimport Icon from './icon';\nimport { cssPrefix } from '../config';\n\nfunction buildItemWithIcon(iconName) {\n  return h('div', `${cssPrefix}-item`).child(new Icon(iconName));\n}\n\nexport default class DropdownAlign extends Dropdown {\n  constructor(aligns, align) {\n    const icon = new Icon(`align-${align}`);\n    const naligns = aligns.map(it => buildItemWithIcon(`align-${it}`)\n      .on('click', () => {\n        this.setTitle(it);\n        this.change(it);\n      }));\n    super(icon, 'auto', true, 'bottom-left', ...naligns);\n  }\n\n  setTitle(align) {\n    this.title.setName(`align-${align}`);\n    this.hide();\n  }\n}\n","import DropdownItem from './dropdown_item';\nimport DropdownAlign from '../dropdown_align';\n\nexport default class Align extends DropdownItem {\n  constructor(value) {\n    super('align', '', value);\n  }\n\n  dropdown() {\n    const { value } = this;\n    return new DropdownAlign(['left', 'center', 'right'], value);\n  }\n}\n","import DropdownItem from './dropdown_item';\nimport DropdownAlign from '../dropdown_align';\n\nexport default class Valign extends DropdownItem {\n  constructor(value) {\n    super('valign', '', value);\n  }\n\n  dropdown() {\n    const { value } = this;\n    return new DropdownAlign(['top', 'middle', 'bottom'], value);\n  }\n}\n","import Item from './item';\nimport Icon from '../icon';\n\nexport default class ToggleItem extends Item {\n  element() {\n    const { tag } = this;\n    return super.element()\n      .child(new Icon(tag))\n      .on('click', () => this.click());\n  }\n\n  click() {\n    this.change(this.tag, this.toggle());\n  }\n\n  setState(active) {\n    this.el.active(active);\n  }\n\n  toggle() {\n    return this.el.toggle();\n  }\n\n  active() {\n    return this.el.hasClass('active');\n  }\n}\n","import ToggleItem from './toggle_item';\n\nexport default class Autofilter extends ToggleItem {\n  constructor() {\n    super('autofilter');\n  }\n\n  setState() {}\n}\n","import ToggleItem from './toggle_item';\n\nexport default class Bold extends ToggleItem {\n  constructor() {\n    super('font-bold', 'Ctrl+B');\n  }\n}\n","import ToggleItem from './toggle_item';\n\nexport default class Italic extends ToggleItem {\n  constructor() {\n    super('font-italic', 'Ctrl+I');\n  }\n}\n","import ToggleItem from './toggle_item';\n\nexport default class Strike extends ToggleItem {\n  constructor() {\n    super('strike', 'Ctrl+U');\n  }\n}\n","import ToggleItem from './toggle_item';\n\nexport default class Underline extends ToggleItem {\n  constructor() {\n    super('underline', 'Ctrl+U');\n  }\n}\n","import { h } from './element';\nimport { cssPrefix } from '../config';\n\nconst themeColorPlaceHolders = ['#ffffff', '#000100', '#e7e5e6', '#445569', '#5b9cd6', '#ed7d31', '#a5a5a5', '#ffc001', '#4371c6', '#71ae47'];\n\nconst themeColors = [\n  ['#f2f2f2', '#7f7f7f', '#d0cecf', '#d5dce4', '#deeaf6', '#fce5d5', '#ededed', '#fff2cd', '#d9e2f3', '#e3efd9'],\n  ['#d8d8d8', '#595959', '#afabac', '#adb8ca', '#bdd7ee', '#f7ccac', '#dbdbdb', '#ffe59a', '#b3c6e7', '#c5e0b3'],\n  ['#bfbfbf', '#3f3f3f', '#756f6f', '#8596b0', '#9cc2e6', '#f4b184', '#c9c9c9', '#fed964', '#8eaada', '#a7d08c'],\n  ['#a5a5a5', '#262626', '#3a3839', '#333f4f', '#2e75b5', '#c45a10', '#7b7b7b', '#bf8e01', '#2f5596', '#538136'],\n  ['#7f7f7f', '#0c0c0c', '#171516', '#222a35', '#1f4e7a', '#843c0a', '#525252', '#7e6000', '#203864', '#365624'],\n];\n\nconst standardColors = ['#c00000', '#fe0000', '#fdc101', '#ffff01', '#93d051', '#00b04e', '#01b0f1', '#0170c1', '#012060', '#7030a0'];\n\nfunction buildTd(bgcolor) {\n  return h('td', '').child(\n    h('div', `${cssPrefix}-color-palette-cell`)\n      .on('click.stop', () => this.change(bgcolor))\n      .css('background-color', bgcolor),\n  );\n}\n\nexport default class ColorPalette {\n  constructor() {\n    this.el = h('div', `${cssPrefix}-color-palette`);\n    this.change = () => {};\n    const table = h('table', '').children(\n      h('tbody', '').children(\n        h('tr', `${cssPrefix}-theme-color-placeholders`).children(\n          ...themeColorPlaceHolders.map(color => buildTd.call(this, color)),\n        ),\n        ...themeColors.map(it => h('tr', `${cssPrefix}-theme-colors`).children(\n          ...it.map(color => buildTd.call(this, color)),\n        )),\n        h('tr', `${cssPrefix}-standard-colors`).children(\n          ...standardColors.map(color => buildTd.call(this, color)),\n        ),\n      ),\n    );\n    this.el.child(table);\n  }\n}\n","import Dropdown from './dropdown';\nimport Icon from './icon';\nimport ColorPalette from './color_palette';\n\nexport default class DropdownColor extends Dropdown {\n  constructor(iconName, color) {\n    const icon = new Icon(iconName)\n      .css('height', '16px')\n      .css('border-bottom', `3px solid ${color}`);\n    const colorPalette = new ColorPalette();\n    colorPalette.change = (v) => {\n      this.setTitle(v);\n      this.change(v);\n    };\n    super(icon, 'auto', false, 'bottom-left', colorPalette.el);\n  }\n\n  setTitle(color) {\n    this.title.css('border-color', color);\n    this.hide();\n  }\n}\n","import Dropdown from './dropdown';\nimport { h } from './element';\nimport Icon from './icon';\nimport { cssPrefix } from '../config';\n\nconst lineTypes = [\n  ['thin', '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"50\" height=\"1\" style=\"user-select: none;\"><line x1=\"0\" y1=\"0.5\" x2=\"50\" y2=\"0.5\" stroke-width=\"1\" stroke=\"black\" style=\"user-select: none;\"></line></svg>'],\n  ['medium', '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"50\" height=\"2\" style=\"user-select: none;\"><line x1=\"0\" y1=\"1.0\" x2=\"50\" y2=\"1.0\" stroke-width=\"2\" stroke=\"black\" style=\"user-select: none;\"></line></svg>'],\n  ['thick', '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"50\" height=\"3\" style=\"user-select: none;\"><line x1=\"0\" y1=\"1.5\" x2=\"50\" y2=\"1.5\" stroke-width=\"3\" stroke=\"black\" style=\"user-select: none;\"></line></svg>'],\n  ['dashed', '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"50\" height=\"1\" style=\"user-select: none;\"><line x1=\"0\" y1=\"0.5\" x2=\"50\" y2=\"0.5\" stroke-width=\"1\" stroke=\"black\" stroke-dasharray=\"2\" style=\"user-select: none;\"></line></svg>'],\n  ['dotted', '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"50\" height=\"1\" style=\"user-select: none;\"><line x1=\"0\" y1=\"0.5\" x2=\"50\" y2=\"0.5\" stroke-width=\"1\" stroke=\"black\" stroke-dasharray=\"1\" style=\"user-select: none;\"></line></svg>'],\n  // ['double', '<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"50\" height=\"3\" style=\"user-select: none;\"><line x1=\"0\" y1=\"0.5\" x2=\"50\" y2=\"0.5\" stroke-width=\"1\" stroke=\"black\" style=\"user-select: none;\"></line><line x1=\"0\" y1=\"2.5\" x2=\"50\" y2=\"2.5\" stroke-width=\"1\" stroke=\"black\" style=\"user-select: none;\"></line></svg>'],\n];\n\nexport default class DropdownLineType extends Dropdown {\n  constructor(type) {\n    const icon = new Icon('line-type');\n    let beforei = 0;\n    const lineTypeEls = lineTypes.map((it, iti) => h('div', `${cssPrefix}-item state ${type === it[0] ? 'checked' : ''}`)\n      .on('click', () => {\n        lineTypeEls[beforei].toggle('checked');\n        lineTypeEls[iti].toggle('checked');\n        beforei = iti;\n        this.hide();\n        this.change(it);\n      })\n      .child(\n        h('div', `${cssPrefix}-line-type`).html(it[1]),\n      ));\n\n    super(icon, 'auto', false, 'bottom-left', ...lineTypeEls);\n  }\n}\n","import { h } from './element';\nimport Icon from './icon';\nimport DropdownColor from './dropdown_color';\nimport DropdownLineType from './dropdown_linetype';\nimport { cssPrefix } from '../config';\n\nfunction buildTable(...trs) {\n  return h('table', '').child(\n    h('tbody', '').children(...trs),\n  );\n}\n\nfunction buildTd(iconName) {\n  return h('td', '').child(\n    h('div', `${cssPrefix}-border-palette-cell`).child(\n      new Icon(`border-${iconName}`),\n    ).on('click', () => {\n      this.mode = iconName;\n      const { mode, style, color } = this;\n      this.change({ mode, style, color });\n    }),\n  );\n}\n\nexport default class BorderPalette {\n  constructor() {\n    this.color = '#000';\n    this.style = 'thin';\n    this.mode = 'all';\n    this.change = () => {};\n    this.ddColor = new DropdownColor('line-color', this.color);\n    this.ddColor.change = (color) => {\n      this.color = color;\n    };\n    this.ddType = new DropdownLineType(this.style);\n    this.ddType.change = ([s]) => {\n      this.style = s;\n    };\n    this.el = h('div', `${cssPrefix}-border-palette`);\n    const table = buildTable(\n      h('tr', '').children(\n        h('td', `${cssPrefix}-border-palette-left`).child(\n          buildTable(\n            h('tr', '').children(\n              ...['all', 'inside', 'horizontal', 'vertical', 'outside'].map(it => buildTd.call(this, it)),\n            ),\n            h('tr', '').children(\n              ...['left', 'top', 'right', 'bottom', 'none'].map(it => buildTd.call(this, it)),\n            ),\n          ),\n        ),\n        h('td', `${cssPrefix}-border-palette-right`).children(\n          h('div', `${cssPrefix}-toolbar-btn`).child(this.ddColor.el),\n          h('div', `${cssPrefix}-toolbar-btn`).child(this.ddType.el),\n        ),\n      ),\n    );\n    this.el.child(table);\n  }\n}\n","import Dropdown from './dropdown';\nimport Icon from './icon';\nimport BorderPalette from './border_palette';\n\nexport default class DropdownBorder extends Dropdown {\n  constructor() {\n    const icon = new Icon('border-all');\n    const borderPalette = new BorderPalette();\n    borderPalette.change = (v) => {\n      this.change(v);\n      this.hide();\n    };\n    super(icon, 'auto', false, 'bottom-left', borderPalette.el);\n  }\n}\n","import DropdownItem from './dropdown_item';\nimport DropdownBorder from '../dropdown_border';\n\nexport default class Border extends DropdownItem {\n  constructor() {\n    super('border');\n  }\n\n  dropdown() {\n    return new DropdownBorder();\n  }\n}\n","import Item from './item';\nimport Icon from '../icon';\n\nexport default class IconItem extends Item {\n  element() {\n    return super.element()\n      .child(new Icon(this.tag))\n      .on('click', () => this.change(this.tag));\n  }\n\n  setState(disabled) {\n    this.el.disabled(disabled);\n  }\n}\n","import IconItem from './icon_item';\n\nexport default class Clearformat extends IconItem {\n  constructor() {\n    super('clearformat');\n  }\n}\n","import ToggleItem from './toggle_item';\n\nexport default class Paintformat extends ToggleItem {\n  constructor() {\n    super('paintformat');\n  }\n\n  setState() {}\n}\n","import DropdownItem from './dropdown_item';\nimport DropdownColor from '../dropdown_color';\n\nexport default class TextColor extends DropdownItem {\n  constructor(color) {\n    super('color', undefined, color);\n  }\n\n  dropdown() {\n    const { tag, value } = this;\n    return new DropdownColor(tag, value);\n  }\n}\n","import DropdownItem from './dropdown_item';\nimport DropdownColor from '../dropdown_color';\n\nexport default class FillColor extends DropdownItem {\n  constructor(color) {\n    super('bgcolor', undefined, color);\n  }\n\n  dropdown() {\n    const { tag, value } = this;\n    return new DropdownColor(tag, value);\n  }\n}\n","import Dropdown from './dropdown';\nimport { h } from './element';\nimport { fontSizes } from '../core/font';\nimport { cssPrefix } from '../config';\n\nexport default class DropdownFontSize extends Dropdown {\n  constructor() {\n    const nfontSizes = fontSizes.map(it => h('div', `${cssPrefix}-item`)\n      .on('click', () => {\n        this.setTitle(`${it.pt}`);\n        this.change(it);\n      })\n      .child(`${it.pt}`));\n    super('10', '60px', true, 'bottom-left', ...nfontSizes);\n  }\n}\n","import DropdownItem from './dropdown_item';\nimport DropdownFontsize from '../dropdown_fontsize';\n\nexport default class Format extends DropdownItem {\n  constructor() {\n    super('font-size');\n  }\n\n  getValue(it) {\n    return it.pt;\n  }\n\n  dropdown() {\n    return new DropdownFontsize();\n  }\n}\n","import Dropdown from './dropdown';\nimport { h } from './element';\nimport { baseFonts } from '../core/font';\nimport { cssPrefix } from '../config';\n\nexport default class DropdownFont extends Dropdown {\n  constructor() {\n    const nfonts = baseFonts.map(it => h('div', `${cssPrefix}-item`)\n      .on('click', () => {\n        this.setTitle(it.title);\n        this.change(it);\n      })\n      .child(it.title));\n    super(baseFonts[0].title, '160px', true, 'bottom-left', ...nfonts);\n  }\n}\n","import DropdownItem from './dropdown_item';\nimport DropdownFont from '../dropdown_font';\n\nexport default class Font extends DropdownItem {\n  constructor() {\n    super('font-name');\n  }\n\n  getValue(it) {\n    return it.key;\n  }\n\n  dropdown() {\n    return new DropdownFont();\n  }\n}\n","import Dropdown from './dropdown';\nimport { h } from './element';\nimport { baseFormats } from '../core/format';\nimport { cssPrefix } from '../config';\n\nexport default class DropdownFormat extends Dropdown {\n  constructor() {\n    let nformats = baseFormats.slice(0);\n    nformats.splice(2, 0, { key: 'divider' });\n    nformats.splice(8, 0, { key: 'divider' });\n    nformats = nformats.map((it) => {\n      const item = h('div', `${cssPrefix}-item`);\n      if (it.key === 'divider') {\n        item.addClass('divider');\n      } else {\n        item.child(it.title())\n          .on('click', () => {\n            this.setTitle(it.title());\n            this.change(it);\n          });\n        if (it.label) item.child(h('div', 'label').html(it.label));\n      }\n      return item;\n    });\n    super('Normal', '220px', true, 'bottom-left', ...nformats);\n  }\n\n  setTitle(key) {\n    for (let i = 0; i < baseFormats.length; i += 1) {\n      if (baseFormats[i].key === key) {\n        this.title.html(baseFormats[i].title);\n      }\n    }\n    this.hide();\n  }\n}\n","import DropdownItem from './dropdown_item';\nimport DropdownFormat from '../dropdown_format';\n\nexport default class Format extends DropdownItem {\n  constructor() {\n    super('format');\n  }\n\n  getValue(it) {\n    return it.key;\n  }\n\n  dropdown() {\n    return new DropdownFormat();\n  }\n}\n","import Dropdown from './dropdown';\nimport Icon from './icon';\nimport { h } from './element';\nimport { baseFormulas } from '../core/formula';\nimport { cssPrefix } from '../config';\n\nexport default class DropdownFormula extends Dropdown {\n  constructor() {\n    const nformulas = baseFormulas.map(it => h('div', `${cssPrefix}-item`)\n      .on('click', () => {\n        this.hide();\n        this.change(it);\n      })\n      .child(it.key));\n    super(new Icon('formula'), '180px', true, 'bottom-left', ...nformulas);\n  }\n}\n","import DropdownItem from './dropdown_item';\nimport DropdownFormula from '../dropdown_formula';\n\nexport default class Format extends DropdownItem {\n  constructor() {\n    super('formula');\n  }\n\n  getValue(it) {\n    return it.key;\n  }\n\n  dropdown() {\n    return new DropdownFormula();\n  }\n}\n","import ToggleItem from './toggle_item';\n\nexport default class Freeze extends ToggleItem {\n  constructor() {\n    super('freeze');\n  }\n}\n","import ToggleItem from './toggle_item';\n\nexport default class Merge extends ToggleItem {\n  constructor() {\n    super('merge');\n  }\n\n  setState(active, disabled) {\n    this.el.active(active).disabled(disabled);\n  }\n}\n","import IconItem from './icon_item';\n\nexport default class Redo extends IconItem {\n  constructor() {\n    super('redo', 'Ctrl+Y');\n  }\n}\n","import IconItem from './icon_item';\n\nexport default class Undo extends IconItem {\n  constructor() {\n    super('undo', 'Ctrl+Z');\n  }\n}\n","import ToggleItem from './toggle_item';\n\nexport default class Textwrap extends ToggleItem {\n  constructor() {\n    super('textwrap');\n  }\n}\n","import Dropdown from '../dropdown';\nimport DropdownItem from './dropdown_item';\n\nimport { cssPrefix } from '../../config';\nimport { h } from '../element';\nimport Icon from '../icon';\n\nclass DropdownMore extends Dropdown {\n  constructor() {\n    const icon = new Icon('ellipsis');\n    const moreBtns = h('div', `${cssPrefix}-toolbar-more`);\n    super(icon, 'auto', false, 'bottom-right', moreBtns);\n    this.moreBtns = moreBtns;\n    this.contentEl.css('max-width', '420px');\n  }\n}\n\nexport default class More extends DropdownItem {\n  constructor() {\n    super('more');\n    this.el.hide();\n  }\n\n  dropdown() {\n    return new DropdownMore();\n  }\n\n  show() {\n    this.el.show();\n  }\n\n  hide() {\n    this.el.hide();\n  }\n}\n","/* global window */\n\nimport Align from './align';\nimport Valign from './valign';\nimport Autofilter from './autofilter';\nimport Bold from './bold';\nimport Italic from './italic';\nimport Strike from './strike';\nimport Underline from './underline';\nimport Border from './border';\nimport Clearformat from './clearformat';\nimport Paintformat from './paintformat';\nimport TextColor from './text_color';\nimport FillColor from './fill_color';\nimport FontSize from './font_size';\nimport Font from './font';\nimport Format from './format';\nimport Formula from './formula';\nimport Freeze from './freeze';\nimport Merge from './merge';\nimport Redo from './redo';\nimport Undo from './undo';\nimport Textwrap from './textwrap';\nimport More from './more';\n\nimport { h } from '../element';\nimport { cssPrefix } from '../../config';\nimport { bind } from '../event';\n\nfunction buildDivider() {\n  return h('div', `${cssPrefix}-toolbar-divider`);\n}\n\nfunction initBtns2() {\n  this.btns2 = [];\n  this.items.forEach((it) => {\n    if (Array.isArray(it)) {\n      it.forEach(({ el }) => {\n        const rect = el.box();\n        const { marginLeft, marginRight } = el.computedStyle();\n        this.btns2.push([el, rect.width + parseInt(marginLeft, 10) + parseInt(marginRight, 10)]);\n      });\n    } else {\n      const rect = it.box();\n      const { marginLeft, marginRight } = it.computedStyle();\n      this.btns2.push([it, rect.width + parseInt(marginLeft, 10) + parseInt(marginRight, 10)]);\n    }\n  });\n}\n\nfunction moreResize() {\n  const {\n    el, btns, moreEl, btns2,\n  } = this;\n  const { moreBtns, contentEl } = moreEl.dd;\n  el.css('width', `${this.widthFn() - 60}px`);\n  const elBox = el.box();\n\n  let sumWidth = 160;\n  let sumWidth2 = 12;\n  const list1 = [];\n  const list2 = [];\n  btns2.forEach(([it, w], index) => {\n    sumWidth += w;\n    if (index === btns2.length - 1 || sumWidth < elBox.width) {\n      list1.push(it);\n    } else {\n      sumWidth2 += w;\n      list2.push(it);\n    }\n  });\n  btns.html('').children(...list1);\n  moreBtns.html('').children(...list2);\n  contentEl.css('width', `${sumWidth2}px`);\n  if (list2.length > 0) {\n    moreEl.show();\n  } else {\n    moreEl.hide();\n  }\n}\n\nexport default class Toolbar {\n  constructor(data, widthFn, isHide = false) {\n    this.data = data;\n    this.change = () => {};\n    this.widthFn = widthFn;\n    this.isHide = isHide;\n    const style = data.defaultStyle();\n    this.items = [\n      [\n        this.undoEl = new Undo(),\n        this.redoEl = new Redo(),\n        this.paintformatEl = new Paintformat(),\n        this.clearformatEl = new Clearformat(),\n      ],\n      buildDivider(),\n      [\n        this.formatEl = new Format(),\n      ],\n      buildDivider(),\n      [\n        this.fontEl = new Font(),\n        this.fontSizeEl = new FontSize(),\n      ],\n      buildDivider(),\n      [\n        this.boldEl = new Bold(),\n        this.italicEl = new Italic(),\n        this.underlineEl = new Underline(),\n        this.strikeEl = new Strike(),\n        this.textColorEl = new TextColor(style.color),\n      ],\n      buildDivider(),\n      [\n        this.fillColorEl = new FillColor(style.bgcolor),\n        this.borderEl = new Border(),\n        this.mergeEl = new Merge(),\n      ],\n      buildDivider(),\n      [\n        this.alignEl = new Align(style.align),\n        this.valignEl = new Valign(style.valign),\n        this.textwrapEl = new Textwrap(),\n      ],\n      buildDivider(),\n      [\n        this.freezeEl = new Freeze(),\n        this.autofilterEl = new Autofilter(),\n        this.formulaEl = new Formula(),\n        this.moreEl = new More(),\n      ],\n    ];\n\n    this.el = h('div', `${cssPrefix}-toolbar`);\n    this.btns = h('div', `${cssPrefix}-toolbar-btns`);\n\n    this.items.forEach((it) => {\n      if (Array.isArray(it)) {\n        it.forEach((i) => {\n          this.btns.child(i.el);\n          i.change = (...args) => {\n            this.change(...args);\n          };\n        });\n      } else {\n        this.btns.child(it.el);\n      }\n    });\n\n    this.el.child(this.btns);\n    if (isHide) {\n      this.el.hide();\n    } else {\n      this.reset();\n      setTimeout(() => {\n        initBtns2.call(this);\n        moreResize.call(this);\n      }, 0);\n      bind(window, 'resize', () => {\n        moreResize.call(this);\n      });\n    }\n  }\n\n  paintformatActive() {\n    return this.paintformatEl.active();\n  }\n\n  paintformatToggle() {\n    this.paintformatEl.toggle();\n  }\n\n  trigger(type) {\n    this[`${type}El`].click();\n  }\n\n  reset() {\n    if (this.isHide) return;\n    const { data } = this;\n    const style = data.getSelectedCellStyle();\n    const cell = data.getSelectedCell();\n    // console.log('canUndo:', data.canUndo());\n    this.undoEl.setState(!data.canUndo());\n    this.redoEl.setState(!data.canRedo());\n    this.mergeEl.setState(data.canUnmerge(), !data.selector.multiple());\n    this.autofilterEl.setState(!data.canAutofilter());\n    // this.mergeEl.disabled();\n    // console.log('selectedCell:', style, cell);\n    const { font } = style;\n    this.fontEl.setState(font.name);\n    this.fontSizeEl.setState(font.size);\n    this.boldEl.setState(font.bold);\n    this.italicEl.setState(font.italic);\n    this.underlineEl.setState(style.underline);\n    this.strikeEl.setState(style.strike);\n    this.textColorEl.setState(style.color);\n    this.fillColorEl.setState(style.bgcolor);\n    this.alignEl.setState(style.align);\n    this.valignEl.setState(style.valign);\n    this.textwrapEl.setState(style.textwrap);\n    // console.log('freeze is Active:', data.freezeIsActive());\n    this.freezeEl.setState(data.freezeIsActive());\n    if (cell) {\n      if (cell.format) {\n        this.formatEl.setState(cell.format);\n      }\n    }\n  }\n}\n","/* global document */\n/* global window */\nimport { h } from './element';\nimport Icon from './icon';\nimport { cssPrefix } from '../config';\nimport { bind, unbind } from './event';\n\nexport default class Modal {\n  constructor(title, content, width = '600px') {\n    this.title = title;\n    this.el = h('div', `${cssPrefix}-modal`).css('width', width).children(\n      h('div', `${cssPrefix}-modal-header`).children(\n        new Icon('close').on('click.stop', () => this.hide()),\n        this.title,\n      ),\n      h('div', `${cssPrefix}-modal-content`).children(...content),\n    ).hide();\n  }\n\n  show() {\n    // dimmer\n    this.dimmer = h('div', `${cssPrefix}-dimmer active`);\n    document.body.appendChild(this.dimmer.el);\n    const { width, height } = this.el.show().box();\n    const { clientHeight, clientWidth } = document.documentElement;\n    this.el.offset({\n      left: (clientWidth - width) / 2,\n      top: (clientHeight - height) / 3,\n    });\n    window.xkeydownEsc = (evt) => {\n      if (evt.keyCode === 27) {\n        this.hide();\n      }\n    };\n    bind(window, 'keydown', window.xkeydownEsc);\n  }\n\n  hide() {\n    this.el.hide();\n    document.body.removeChild(this.dimmer.el);\n    unbind(window, 'keydown', window.xkeydownEsc);\n    delete window.xkeydownEsc;\n  }\n}\n","import { h } from './element';\nimport { cssPrefix } from '../config';\n\nexport default class FormInput {\n  constructor(width, hint) {\n    this.vchange = () => {};\n    this.el = h('div', `${cssPrefix}-form-input`);\n    this.input = h('input', '').css('width', width)\n      .on('input', evt => this.vchange(evt))\n      .attr('placeholder', hint);\n    this.el.child(this.input);\n  }\n\n  hint(v) {\n    this.input.attr('placeholder', v);\n  }\n\n  val(v) {\n    return this.input.val(v);\n  }\n}\n","import { h } from './element';\nimport Suggest from './suggest';\nimport { cssPrefix } from '../config';\n\nexport default class FormSelect {\n  constructor(key, items, width, getTitle = it => it, change = () => {}) {\n    this.key = key;\n    this.getTitle = getTitle;\n    this.vchange = () => {};\n    this.el = h('div', `${cssPrefix}-form-select`);\n    this.suggest = new Suggest(items.map(it => ({ key: it, title: this.getTitle(it) })), (it) => {\n      this.itemClick(it.key);\n      change(it.key);\n      this.vchange(it.key);\n    }, width, this.el);\n    this.el.children(\n      this.itemEl = h('div', 'input-text').html(this.getTitle(key)),\n      this.suggest.el,\n    ).on('click', () => this.show());\n  }\n\n  show() {\n    this.suggest.search('');\n  }\n\n  itemClick(it) {\n    this.key = it;\n    this.itemEl.html(this.getTitle(it));\n  }\n\n  val(v) {\n    if (v !== undefined) {\n      this.key = v;\n      this.itemEl.html(this.getTitle(v));\n      return this;\n    }\n    return this.key;\n  }\n}\n","import { h } from './element';\nimport { cssPrefix } from '../config';\nimport { t } from '../locale/locale';\n\nconst patterns = {\n  number: /(^\\d+$)|(^\\d+(\\.\\d{0,4})?$)/,\n  date: /^\\d{4}-\\d{1,2}-\\d{1,2}$/,\n};\n\n// rule: { required: false, type, pattern: // }\nexport default class FormField {\n  constructor(input, rule, label, labelWidth) {\n    this.label = '';\n    this.rule = rule;\n    if (label) {\n      this.label = h('label', 'label').css('width', `${labelWidth}px`).html(label);\n    }\n    this.tip = h('div', 'tip').child('tip').hide();\n    this.input = input;\n    this.input.vchange = () => this.validate();\n    this.el = h('div', `${cssPrefix}-form-field`)\n      .children(this.label, input.el, this.tip);\n  }\n\n  isShow() {\n    return this.el.css('display') !== 'none';\n  }\n\n  show() {\n    this.el.show();\n  }\n\n  hide() {\n    this.el.hide();\n    return this;\n  }\n\n  val(v) {\n    return this.input.val(v);\n  }\n\n  hint(hint) {\n    this.input.hint(hint);\n  }\n\n  validate() {\n    const {\n      input, rule, tip, el,\n    } = this;\n    const v = input.val();\n    if (rule.required) {\n      if (/^\\s*$/.test(v)) {\n        tip.html(t('validation.required'));\n        el.addClass('error');\n        return false;\n      }\n    }\n    if (rule.type || rule.pattern) {\n      const pattern = rule.pattern || patterns[rule.type];\n      if (!pattern.test(v)) {\n        tip.html(t('validation.notMatch'));\n        el.addClass('error');\n        return false;\n      }\n    }\n    el.removeClass('error');\n    return true;\n  }\n}\n","import { Element } from './element';\nimport { cssPrefix } from '../config';\nimport { t } from '../locale/locale';\n\nexport default class Button extends Element {\n  // type: primary\n  constructor(title, type = '') {\n    super('div', `${cssPrefix}-button ${type}`);\n    this.child(t(`button.${title}`));\n  }\n}\n","import Modal from './modal';\nimport FormInput from './form_input';\nimport FormSelect from './form_select';\nimport FormField from './form_field';\nimport Button from './button';\nimport { t } from '../locale/locale';\nimport { h } from './element';\nimport { cssPrefix } from '../config';\n\nconst fieldLabelWidth = 100;\n\nexport default class ModalValidation extends Modal {\n  constructor() {\n    const mf = new FormField(\n      new FormSelect('cell',\n        ['cell'], // cell|row|column\n        '100%',\n        it => t(`dataValidation.modeType.${it}`)),\n      { required: true },\n      `${t('dataValidation.range')}:`,\n      fieldLabelWidth,\n    );\n    const rf = new FormField(\n      new FormInput('120px', 'E3 or E3:F12'),\n      { required: true, pattern: /^([A-Z]{1,2}[1-9]\\d*)(:[A-Z]{1,2}[1-9]\\d*)?$/ },\n    );\n    const cf = new FormField(\n      new FormSelect('list',\n        ['list', 'number', 'date', 'phone', 'email'],\n        '100%',\n        it => t(`dataValidation.type.${it}`),\n        it => this.criteriaSelected(it)),\n      { required: true },\n      `${t('dataValidation.criteria')}:`,\n      fieldLabelWidth,\n    );\n\n    // operator\n    const of = new FormField(\n      new FormSelect('be',\n        ['be', 'nbe', 'eq', 'neq', 'lt', 'lte', 'gt', 'gte'],\n        '160px',\n        it => t(`dataValidation.operator.${it}`),\n        it => this.criteriaOperatorSelected(it)),\n      { required: true },\n    ).hide();\n    // min, max\n    const minvf = new FormField(\n      new FormInput('70px', '10'),\n      { required: true },\n    ).hide();\n    const maxvf = new FormField(\n      new FormInput('70px', '100'),\n      { required: true, type: 'number' },\n    ).hide();\n    // value\n    const svf = new FormField(\n      new FormInput('120px', 'a,b,c'),\n      { required: true },\n    );\n    const vf = new FormField(\n      new FormInput('70px', '10'),\n      { required: true, type: 'number' },\n    ).hide();\n\n    super(t('contextmenu.validation'), [\n      h('div', `${cssPrefix}-form-fields`).children(\n        mf.el,\n        rf.el,\n      ),\n      h('div', `${cssPrefix}-form-fields`).children(\n        cf.el,\n        of.el,\n        minvf.el,\n        maxvf.el,\n        vf.el,\n        svf.el,\n      ),\n      h('div', `${cssPrefix}-buttons`).children(\n        new Button('cancel').on('click', () => this.btnClick('cancel')),\n        new Button('remove').on('click', () => this.btnClick('remove')),\n        new Button('save', 'primary').on('click', () => this.btnClick('save')),\n      ),\n    ]);\n    this.mf = mf;\n    this.rf = rf;\n    this.cf = cf;\n    this.of = of;\n    this.minvf = minvf;\n    this.maxvf = maxvf;\n    this.vf = vf;\n    this.svf = svf;\n    this.change = () => {};\n  }\n\n  showVf(it) {\n    const hint = it === 'date' ? '2018-11-12' : '10';\n    const { vf } = this;\n    vf.input.hint(hint);\n    vf.show();\n  }\n\n  criteriaSelected(it) {\n    const {\n      of, minvf, maxvf, vf, svf,\n    } = this;\n    if (it === 'date' || it === 'number') {\n      of.show();\n      minvf.rule.type = it;\n      maxvf.rule.type = it;\n      if (it === 'date') {\n        minvf.hint('2018-11-12');\n        maxvf.hint('2019-11-12');\n      } else {\n        minvf.hint('10');\n        maxvf.hint('100');\n      }\n      minvf.show();\n      maxvf.show();\n      vf.hide();\n      svf.hide();\n    } else {\n      if (it === 'list') {\n        svf.show();\n      } else {\n        svf.hide();\n      }\n      vf.hide();\n      of.hide();\n      minvf.hide();\n      maxvf.hide();\n    }\n  }\n\n  criteriaOperatorSelected(it) {\n    if (!it) return;\n    const {\n      minvf, maxvf, vf,\n    } = this;\n    if (it === 'be' || it === 'nbe') {\n      minvf.show();\n      maxvf.show();\n      vf.hide();\n    } else {\n      const type = this.cf.val();\n      vf.rule.type = type;\n      if (type === 'date') {\n        vf.hint('2018-11-12');\n      } else {\n        vf.hint('10');\n      }\n      vf.show();\n      minvf.hide();\n      maxvf.hide();\n    }\n  }\n\n  btnClick(action) {\n    if (action === 'cancel') {\n      this.hide();\n    } else if (action === 'remove') {\n      this.change('remove');\n      this.hide();\n    } else if (action === 'save') {\n      // validate\n      const attrs = ['mf', 'rf', 'cf', 'of', 'svf', 'vf', 'minvf', 'maxvf'];\n      for (let i = 0; i < attrs.length; i += 1) {\n        const field = this[attrs[i]];\n        // console.log('field:', field);\n        if (field.isShow()) {\n          // console.log('it:', it);\n          if (!field.validate()) return;\n        }\n      }\n\n      const mode = this.mf.val();\n      const ref = this.rf.val();\n      const type = this.cf.val();\n      const operator = this.of.val();\n      let value = this.svf.val();\n      if (type === 'number' || type === 'date') {\n        if (operator === 'be' || operator === 'nbe') {\n          value = [this.minvf.val(), this.maxvf.val()];\n        } else {\n          value = this.vf.val();\n        }\n      }\n      // console.log(mode, ref, type, operator, value);\n      this.change('save',\n        mode,\n        ref,\n        {\n          type, operator, required: false, value,\n        });\n      this.hide();\n    }\n  }\n\n  // validation: { mode, ref, validator }\n  setValue(v) {\n    if (v) {\n      const {\n        mf, rf, cf, of, svf, vf, minvf, maxvf,\n      } = this;\n      const {\n        mode, ref, validator,\n      } = v;\n      const {\n        type, operator, value,\n      } = validator || { type: 'list' };\n      mf.val(mode || 'cell');\n      rf.val(ref);\n      cf.val(type);\n      of.val(operator);\n      if (Array.isArray(value)) {\n        minvf.val(value[0]);\n        maxvf.val(value[1]);\n      } else {\n        svf.val(value || '');\n        vf.val(value || '');\n      }\n      this.criteriaSelected(type);\n      this.criteriaOperatorSelected(operator);\n    }\n    this.show();\n  }\n}\n","import { h } from './element';\nimport Button from './button';\nimport { bindClickoutside, unbindClickoutside } from './event';\nimport { cssPrefix } from '../config';\nimport { t } from '../locale/locale';\n\nfunction buildMenu(clsName) {\n  return h('div', `${cssPrefix}-item ${clsName}`);\n}\n\nfunction buildSortItem(it) {\n  return buildMenu('state').child(t(`sort.${it}`))\n    .on('click.stop', () => this.itemClick(it));\n}\n\nfunction buildFilterBody(items) {\n  const { filterbEl, filterValues } = this;\n  filterbEl.html('');\n  const itemKeys = Object.keys(items);\n  itemKeys.forEach((it, index) => {\n    const cnt = items[it];\n    const active = filterValues.includes(it) ? 'checked' : '';\n    filterbEl.child(h('div', `${cssPrefix}-item state ${active}`)\n      .on('click.stop', () => this.filterClick(index, it))\n      .children(it === '' ? t('filter.empty') : it, h('div', 'label').html(`(${cnt})`)));\n  });\n}\n\nfunction resetFilterHeader() {\n  const { filterhEl, filterValues, values } = this;\n  filterhEl.html(`${filterValues.length} / ${values.length}`);\n  filterhEl.checked(filterValues.length === values.length);\n}\n\nexport default class SortFilter {\n  constructor() {\n    this.filterbEl = h('div', `${cssPrefix}-body`);\n    this.filterhEl = h('div', `${cssPrefix}-header state`).on('click.stop', () => this.filterClick(0, 'all'));\n    this.el = h('div', `${cssPrefix}-sort-filter`).children(\n      this.sortAscEl = buildSortItem.call(this, 'asc'),\n      this.sortDescEl = buildSortItem.call(this, 'desc'),\n      buildMenu('divider'),\n      h('div', `${cssPrefix}-filter`).children(\n        this.filterhEl,\n        this.filterbEl,\n      ),\n      h('div', `${cssPrefix}-buttons`).children(\n        new Button('cancel').on('click', () => this.btnClick('cancel')),\n        new Button('ok', 'primary').on('click', () => this.btnClick('ok')),\n      ),\n    ).hide();\n    // this.setFilters(['test1', 'test2', 'text3']);\n    this.ci = null;\n    this.sortDesc = null;\n    this.values = null;\n    this.filterValues = [];\n  }\n\n  btnClick(it) {\n    if (it === 'ok') {\n      const { ci, sort, filterValues } = this;\n      if (this.ok) {\n        this.ok(ci, sort, 'in', filterValues);\n      }\n    }\n    this.hide();\n  }\n\n  itemClick(it) {\n    // console.log('it:', it);\n    this.sort = it;\n    const { sortAscEl, sortDescEl } = this;\n    sortAscEl.checked(it === 'asc');\n    sortDescEl.checked(it === 'desc');\n  }\n\n  filterClick(index, it) {\n    // console.log('index:', index, it);\n    const { filterbEl, filterValues, values } = this;\n    const children = filterbEl.children();\n    if (it === 'all') {\n      if (children.length === filterValues.length) {\n        this.filterValues = [];\n        children.forEach(i => h(i).checked(false));\n      } else {\n        this.filterValues = Array.from(values);\n        children.forEach(i => h(i).checked(true));\n      }\n    } else {\n      const checked = h(children[index]).toggle('checked');\n      if (checked) {\n        filterValues.push(it);\n      } else {\n        filterValues.splice(filterValues.findIndex(i => i === it), 1);\n      }\n    }\n    resetFilterHeader.call(this);\n  }\n\n  // v: autoFilter\n  // items: {value: cnt}\n  // sort { ci, order }\n  set(ci, items, filter, sort) {\n    this.ci = ci;\n    const { sortAscEl, sortDescEl } = this;\n    if (sort !== null) {\n      this.sort = sort.order;\n      sortAscEl.checked(sort.asc());\n      sortDescEl.checked(sort.desc());\n    } else {\n      this.sortDesc = null;\n      sortAscEl.checked(false);\n      sortDescEl.checked(false);\n    }\n    // this.setFilters(items, filter);\n    this.values = Object.keys(items);\n    this.filterValues = filter ? Array.from(filter.value) : Object.keys(items);\n    buildFilterBody.call(this, items, filter);\n    resetFilterHeader.call(this);\n  }\n\n  setOffset(v) {\n    this.el.offset(v).show();\n    let tindex = 1;\n    bindClickoutside(this.el, () => {\n      if (tindex <= 0) {\n        this.hide();\n      }\n      tindex -= 1;\n    });\n  }\n\n  show() {\n    this.el.show();\n  }\n\n  hide() {\n    this.el.hide();\n    unbindClickoutside(this.el);\n  }\n}\n","/* global document */\nimport { h } from './element';\nimport Icon from './icon';\nimport { cssPrefix } from '../config';\n\nexport function xtoast(title, content) {\n  const el = h('div', `${cssPrefix}-toast`);\n  const dimmer = h('div', `${cssPrefix}-dimmer active`);\n  const remove = () => {\n    document.body.removeChild(el.el);\n    document.body.removeChild(dimmer.el);\n  };\n\n  el.children(\n    h('div', `${cssPrefix}-toast-header`).children(\n      new Icon('close').on('click.stop', () => remove()),\n      title,\n    ),\n    h('div', `${cssPrefix}-toast-content`).html(content),\n  );\n  document.body.appendChild(el.el);\n  document.body.appendChild(dimmer.el);\n  // set offset\n  const { width, height } = el.box();\n  const { clientHeight, clientWidth } = document.documentElement;\n  el.offset({\n    left: (clientWidth - width) / 2,\n    top: (clientHeight - height) / 3,\n  });\n}\n\nexport default {};\n","/* global window */\nimport { h } from './element';\nimport { bind, mouseMoveUp, bindTouch } from './event';\nimport Resizer from './resizer';\nimport Scrollbar from './scrollbar';\nimport Selector from './selector';\nimport Editor from './editor';\nimport ContextMenu from './contextmenu';\nimport Table from './table';\nimport Toolbar from './toolbar/index';\nimport ModalValidation from './modal_validation';\nimport SortFilter from './sort_filter';\nimport { xtoast } from './message';\nimport { cssPrefix } from '../config';\nimport { formulas } from '../core/formula';\n\nfunction scrollbarMove() {\n  const {\n    data, verticalScrollbar, horizontalScrollbar,\n  } = this;\n  const {\n    l, t, left, top, width, height,\n  } = data.getSelectedRect();\n  const tableOffset = this.getTableOffset();\n  // console.log(',l:', l, ', left:', left, ', tOffset.left:', tableOffset.width);\n  if (Math.abs(left) + width > tableOffset.width) {\n    horizontalScrollbar.move({ left: l + width - tableOffset.width });\n  } else {\n    const fsw = data.freezeTotalWidth();\n    if (left < fsw) {\n      horizontalScrollbar.move({ left: l - 1 - fsw });\n    }\n  }\n  // console.log('top:', top, ', height:', height, ', tof.height:', tableOffset.height);\n  if (Math.abs(top) + height > tableOffset.height) {\n    verticalScrollbar.move({ top: t + height - tableOffset.height - 1 });\n  } else {\n    const fsh = data.freezeTotalHeight();\n    if (top < fsh) {\n      verticalScrollbar.move({ top: t - 1 - fsh });\n    }\n  }\n}\n\nfunction selectorSet(multiple, ri, ci, indexesUpdated = true, moving = false) {\n  if (ri === -1 && ci === -1) return;\n  // console.log(multiple, ', ri:', ri, ', ci:', ci);\n  const {\n    table, selector, toolbar,\n  } = this;\n  if (multiple) {\n    selector.setEnd(ri, ci, moving);\n  } else {\n    selector.set(ri, ci, indexesUpdated);\n  }\n  toolbar.reset();\n  table.render();\n}\n\n// multiple: boolean\n// direction: left | right | up | down | row-first | row-last | col-first | col-last\nfunction selectorMove(multiple, direction) {\n  const {\n    selector, data,\n  } = this;\n  const { rows, cols } = data;\n  let [ri, ci] = selector.indexes;\n  const { eri, eci } = selector.range;\n  if (multiple) {\n    [ri, ci] = selector.moveIndexes;\n  }\n  // console.log('selector.move:', ri, ci);\n  if (direction === 'left') {\n    if (ci > 0) ci -= 1;\n  } else if (direction === 'right') {\n    if (eci !== ci) ci = eci;\n    if (ci < cols.len - 1) ci += 1;\n  } else if (direction === 'up') {\n    if (ri > 0) ri -= 1;\n  } else if (direction === 'down') {\n    if (eri !== ri) ri = eri;\n    if (ri < rows.len - 1) ri += 1;\n  } else if (direction === 'row-first') {\n    ci = 0;\n  } else if (direction === 'row-last') {\n    ci = cols.len - 1;\n  } else if (direction === 'col-first') {\n    ri = 0;\n  } else if (direction === 'col-last') {\n    ri = rows.len - 1;\n  }\n  if (multiple) {\n    selector.moveIndexes = [ri, ci];\n  }\n  selectorSet.call(this, multiple, ri, ci);\n  scrollbarMove.call(this);\n}\n\n// private methods\nfunction overlayerMousemove(evt) {\n  // console.log('x:', evt.offsetX, ', y:', evt.offsetY);\n  if (evt.buttons !== 0) return;\n  if (evt.target.className === `${cssPrefix}-resizer-hover`) return;\n  const { offsetX, offsetY } = evt;\n  const {\n    rowResizer, colResizer, tableEl, data,\n  } = this;\n  const { rows, cols } = data;\n  if (offsetX > cols.indexWidth && offsetY > rows.height) {\n    rowResizer.hide();\n    colResizer.hide();\n    return;\n  }\n  const tRect = tableEl.box();\n  const cRect = data.getCellRectByXY(evt.offsetX, evt.offsetY);\n  if (cRect.ri >= 0 && cRect.ci === -1) {\n    cRect.width = cols.indexWidth;\n    rowResizer.show(cRect, {\n      width: tRect.width,\n    });\n  } else {\n    rowResizer.hide();\n  }\n  if (cRect.ri === -1 && cRect.ci >= 0) {\n    cRect.height = rows.height;\n    colResizer.show(cRect, {\n      height: tRect.height,\n    });\n  } else {\n    colResizer.hide();\n  }\n}\n\nfunction overlayerMousescroll(evt) {\n  const { verticalScrollbar, data } = this;\n  const { top } = verticalScrollbar.scroll();\n  // console.log('evt:::', evt.wheelDelta, evt.detail * 40);\n  let delta = evt.deltaY;\n  const { rows } = data;\n  if (evt.detail) delta = evt.detail * 40;\n  if (delta > 0) {\n    // up\n    const ri = data.scroll.ri + 1;\n    if (ri < rows.len) {\n      verticalScrollbar.move({ top: top + rows.getHeight(ri) - 1 });\n    }\n  } else {\n    // down\n    const ri = data.scroll.ri - 1;\n    if (ri >= 0) {\n      verticalScrollbar.move({ top: ri === 0 ? 0 : top - rows.getHeight(ri) });\n    }\n  }\n}\n\nfunction overlayerTouch(direction, distance) {\n  const { verticalScrollbar, horizontalScrollbar } = this;\n  const { top } = verticalScrollbar.scroll();\n  const { left } = horizontalScrollbar.scroll();\n  // console.log('direction:', direction, ', distance:', distance, left);\n  if (direction === 'left' || direction === 'right') {\n    horizontalScrollbar.move({ left: left - distance });\n  } else if (direction === 'up' || direction === 'down') {\n    verticalScrollbar.move({ top: top - distance });\n  }\n}\n\nfunction verticalScrollbarSet() {\n  const { data, verticalScrollbar } = this;\n  const { height } = this.getTableOffset();\n  const erth = data.exceptRowTotalHeight(0, -1);\n  // console.log('erth:', erth);\n  verticalScrollbar.set(height, data.rows.totalHeight() - erth);\n}\n\nfunction horizontalScrollbarSet() {\n  const { data, horizontalScrollbar } = this;\n  const { width } = this.getTableOffset();\n  if (data) {\n    horizontalScrollbar.set(width, data.cols.totalWidth());\n  }\n}\n\nfunction sheetFreeze() {\n  const {\n    selector, data, editor,\n  } = this;\n  const [ri, ci] = data.freeze;\n  if (ri > 0 || ci > 0) {\n    const fwidth = data.freezeTotalWidth();\n    const fheight = data.freezeTotalHeight();\n    editor.setFreezeLengths(fwidth, fheight);\n  }\n  selector.resetAreaOffset();\n}\n\nfunction sheetReset() {\n  const {\n    tableEl,\n    overlayerEl,\n    overlayerCEl,\n    table,\n    toolbar,\n    selector,\n    el,\n  } = this;\n  const tOffset = this.getTableOffset();\n  const vRect = this.getRect();\n  tableEl.attr(vRect);\n  overlayerEl.offset(vRect);\n  overlayerCEl.offset(tOffset);\n  el.css('width', `${vRect.width}px`);\n  verticalScrollbarSet.call(this);\n  horizontalScrollbarSet.call(this);\n  sheetFreeze.call(this);\n  table.render();\n  toolbar.reset();\n  selector.reset();\n}\n\nfunction clearClipboard() {\n  const { data, selector } = this;\n  data.clearClipboard();\n  selector.hideClipboard();\n}\n\nfunction copy() {\n  const { data, selector } = this;\n  data.copy();\n  selector.showClipboard();\n}\n\nfunction cut() {\n  const { data, selector } = this;\n  data.cut();\n  selector.showClipboard();\n}\n\nfunction paste(what) {\n  const { data } = this;\n  if (data.paste(what, msg => xtoast('Tip', msg))) {\n    sheetReset.call(this);\n  }\n}\n\nfunction autofilter() {\n  const { data } = this;\n  data.autofilter();\n  sheetReset.call(this);\n}\n\nfunction toolbarChangePaintformatPaste() {\n  const { toolbar } = this;\n  if (toolbar.paintformatActive()) {\n    paste.call(this, 'format');\n    clearClipboard.call(this);\n    toolbar.paintformatToggle();\n  }\n}\n\nfunction overlayerMousedown(evt) {\n  // console.log(':::::overlayer.mousedown:', evt.detail, evt.button, evt.buttons, evt.shiftKey);\n  // console.log('evt.target.className:', evt.target.className);\n  const {\n    selector, data, table, sortFilter,\n  } = this;\n  const { offsetX, offsetY } = evt;\n  const isAutofillEl = evt.target.className === `${cssPrefix}-selector-corner`;\n  const cellRect = data.getCellRectByXY(offsetX, offsetY);\n  const {\n    left, top, width, height,\n  } = cellRect;\n  let { ri, ci } = cellRect;\n  // sort or filter\n  const { autoFilter } = data;\n  if (autoFilter.includes(ri, ci)) {\n    if (left + width - 20 < offsetX && top + height - 20 < offsetY) {\n      const items = autoFilter.items(ci, (r, c) => data.rows.getCell(r, c));\n      sortFilter.set(ci, items, autoFilter.getFilter(ci), autoFilter.getSort(ci));\n      sortFilter.setOffset({ left, top: top + height + 2 });\n      return;\n    }\n  }\n\n  // console.log('ri:', ri, ', ci:', ci);\n  if (!evt.shiftKey) {\n    // console.log('selectorSetStart:::');\n    if (isAutofillEl) {\n      selector.showAutofill(ri, ci);\n    } else {\n      selectorSet.call(this, false, ri, ci);\n    }\n\n    // mouse move up\n    mouseMoveUp(window, (e) => {\n      // console.log('mouseMoveUp::::');\n      ({ ri, ci } = data.getCellRectByXY(e.offsetX, e.offsetY));\n      if (isAutofillEl) {\n        selector.showAutofill(ri, ci);\n      } else if (e.buttons === 1 && !e.shiftKey) {\n        selectorSet.call(this, true, ri, ci, true, true);\n      }\n    }, () => {\n      if (isAutofillEl) {\n        if (data.autofill(selector.arange, 'all', msg => xtoast('Tip', msg))) {\n          table.render();\n        }\n      }\n      selector.hideAutofill();\n      toolbarChangePaintformatPaste.call(this);\n    });\n  }\n\n  if (!isAutofillEl && evt.buttons === 1) {\n    if (evt.shiftKey) {\n      // console.log('shiftKey::::');\n      selectorSet.call(this, true, ri, ci);\n    }\n  }\n}\n\nfunction editorSetOffset() {\n  const { editor, data } = this;\n  const sOffset = data.getSelectedRect();\n  const tOffset = this.getTableOffset();\n  let sPosition = 'top';\n  // console.log('sOffset:', sOffset, ':', tOffset);\n  if (sOffset.top > tOffset.height / 2) {\n    sPosition = 'bottom';\n  }\n  editor.setOffset(sOffset, sPosition);\n}\n\nfunction editorSet() {\n  const { editor, data } = this;\n  editorSetOffset.call(this);\n  editor.setCell(data.getSelectedCell(), data.getSelectedValidator());\n  clearClipboard.call(this);\n}\n\nfunction verticalScrollbarMove(distance) {\n  const { data, table, selector } = this;\n  data.scrolly(distance, () => {\n    selector.resetBRLAreaOffset();\n    editorSetOffset.call(this);\n    table.render();\n  });\n}\n\nfunction horizontalScrollbarMove(distance) {\n  const { data, table, selector } = this;\n  data.scrollx(distance, () => {\n    selector.resetBRTAreaOffset();\n    editorSetOffset.call(this);\n    table.render();\n  });\n}\n\nfunction rowResizerFinished(cRect, distance) {\n  const { ri } = cRect;\n  const { table, selector, data } = this;\n  data.rows.setHeight(ri, distance);\n  table.render();\n  selector.resetAreaOffset();\n  verticalScrollbarSet.call(this);\n  editorSetOffset.call(this);\n}\n\nfunction colResizerFinished(cRect, distance) {\n  const { ci } = cRect;\n  const { table, selector, data } = this;\n  data.cols.setWidth(ci, distance);\n  // console.log('data:', data);\n  table.render();\n  selector.resetAreaOffset();\n  horizontalScrollbarSet.call(this);\n  editorSetOffset.call(this);\n}\n\nfunction dataSetCellText(text, state = 'finished') {\n  const { data, table } = this;\n  // const [ri, ci] = selector.indexes;\n  data.setSelectedCellText(text, state);\n  if (state === 'finished') table.render();\n}\n\nfunction insertDeleteRowColumn(type) {\n  const { data } = this;\n  if (type === 'insert-row') {\n    data.insert('row');\n  } else if (type === 'delete-row') {\n    data.delete('row');\n  } else if (type === 'insert-column') {\n    data.insert('column');\n  } else if (type === 'delete-column') {\n    data.delete('column');\n  } else if (type === 'delete-cell') {\n    data.deleteCell();\n  } else if (type === 'delete-cell-format') {\n    data.deleteCell('format');\n  } else if (type === 'delete-cell-text') {\n    data.deleteCell('text');\n  }\n  clearClipboard.call(this);\n  sheetReset.call(this);\n}\n\nfunction toolbarChange(type, value) {\n  const { data } = this;\n  if (type === 'undo') {\n    this.undo();\n  } else if (type === 'redo') {\n    this.redo();\n  } else if (type === 'print') {\n    // print\n  } else if (type === 'paintformat') {\n    if (value === true) copy.call(this);\n    else clearClipboard.call(this);\n  } else if (type === 'clearformat') {\n    insertDeleteRowColumn.call(this, 'delete-cell-format');\n  } else if (type === 'link') {\n    // link\n  } else if (type === 'chart') {\n    // chart\n  } else if (type === 'autofilter') {\n    // filter\n    autofilter.call(this);\n  } else if (type === 'freeze') {\n    if (value) {\n      const { ri, ci } = data.selector;\n      this.freeze(ri, ci);\n    } else {\n      this.freeze(0, 0);\n    }\n  } else {\n    data.setSelectedCellAttr(type, value);\n    if (type === 'formula' && !data.selector.multiple()) {\n      editorSet.call(this);\n    }\n    sheetReset.call(this);\n  }\n}\n\nfunction sortFilterChange(ci, order, operator, value) {\n  // console.log('sort:', sortDesc, operator, value);\n  this.data.setAutoFilter(ci, order, operator, value);\n  sheetReset.call(this);\n}\n\nfunction sheetInitEvents() {\n  const {\n    overlayerEl,\n    rowResizer,\n    colResizer,\n    verticalScrollbar,\n    horizontalScrollbar,\n    editor,\n    contextMenu,\n    data,\n    toolbar,\n    modalValidation,\n    sortFilter,\n  } = this;\n  // overlayer\n  overlayerEl\n    .on('mousemove', (evt) => {\n      overlayerMousemove.call(this, evt);\n    })\n    .on('mousedown', (evt) => {\n      // the left mouse button: mousedown → mouseup → click\n      // the right mouse button: mousedown → contenxtmenu → mouseup\n      if (evt.buttons === 2) {\n        if (data.xyInSelectedRect(evt.offsetX, evt.offsetY)) {\n          contextMenu.setPosition(evt.offsetX, evt.offsetY);\n          evt.stopPropagation();\n        } else {\n          contextMenu.hide();\n        }\n      } else if (evt.detail === 2) {\n        editorSet.call(this);\n      } else {\n        editor.clear();\n        overlayerMousedown.call(this, evt);\n      }\n    }).on('mousewheel.stop', (evt) => {\n      overlayerMousescroll.call(this, evt);\n    });\n\n  // slide on mobile\n  bindTouch(overlayerEl.el, {\n    move: (direction, d) => {\n      overlayerTouch.call(this, direction, d);\n    },\n  });\n\n  // toolbar change\n  toolbar.change = (type, value) => toolbarChange.call(this, type, value);\n\n  // sort filter ok\n  sortFilter.ok = (ci, order, o, v) => sortFilterChange.call(this, ci, order, o, v);\n\n  // resizer finished callback\n  rowResizer.finishedFn = (cRect, distance) => {\n    rowResizerFinished.call(this, cRect, distance);\n  };\n  colResizer.finishedFn = (cRect, distance) => {\n    colResizerFinished.call(this, cRect, distance);\n  };\n  // scrollbar move callback\n  verticalScrollbar.moveFn = (distance, evt) => {\n    verticalScrollbarMove.call(this, distance, evt);\n  };\n  horizontalScrollbar.moveFn = (distance, evt) => {\n    horizontalScrollbarMove.call(this, distance, evt);\n  };\n  // editor\n  editor.change = (state, itext) => {\n    dataSetCellText.call(this, itext, state);\n  };\n  // modal validation\n  modalValidation.change = (action, ...args) => {\n    if (action === 'save') {\n      data.addValidation(...args);\n    } else {\n      data.removeValidation();\n    }\n  };\n  // contextmenu\n  contextMenu.itemClick = (type) => {\n    // console.log('type:', type);\n    if (type === 'validation') {\n      modalValidation.setValue(data.getSelectedValidation());\n    } else if (type === 'copy') {\n      copy.call(this);\n    } else if (type === 'cut') {\n      cut.call(this);\n    } else if (type === 'paste') {\n      paste.call(this, 'all');\n    } else if (type === 'paste-value') {\n      paste.call(this, 'text');\n    } else if (type === 'paste-format') {\n      paste.call(this, 'format');\n    } else {\n      insertDeleteRowColumn.call(this, type);\n    }\n  };\n\n  bind(window, 'resize', () => {\n    this.reload();\n  });\n\n  bind(window, 'click', (evt) => {\n    this.focusing = overlayerEl.contains(evt.target);\n  });\n\n  // for selector\n  bind(window, 'keydown', (evt) => {\n    if (!this.focusing) return;\n    const keyCode = evt.keyCode || evt.which;\n    const {\n      key, ctrlKey, shiftKey, altKey, metaKey,\n    } = evt;\n    // console.log('keydown.evt: ', keyCode);\n    if (ctrlKey || metaKey) {\n      // const { sIndexes, eIndexes } = selector;\n      let what = 'all';\n      if (shiftKey) what = 'text';\n      if (altKey) what = 'format';\n      switch (keyCode) {\n        case 90:\n          // undo: ctrl + z\n          this.undo();\n          evt.preventDefault();\n          break;\n        case 89:\n          // redo: ctrl + y\n          this.redo();\n          evt.preventDefault();\n          break;\n        case 67:\n          // ctrl + c\n          copy.call(this);\n          evt.preventDefault();\n          break;\n        case 88:\n          // ctrl + x\n          cut.call(this);\n          evt.preventDefault();\n          break;\n        case 85:\n          // ctrl + u\n          toolbar.trigger('underline');\n          evt.preventDefault();\n          break;\n        case 86:\n          // ctrl + v\n          paste.call(this, what);\n          evt.preventDefault();\n          break;\n        case 37:\n          // ctrl + left\n          selectorMove.call(this, shiftKey, 'row-first');\n          evt.preventDefault();\n          break;\n        case 38:\n          // ctrl + up\n          selectorMove.call(this, shiftKey, 'col-first');\n          evt.preventDefault();\n          break;\n        case 39:\n          // ctrl + right\n          selectorMove.call(this, shiftKey, 'row-last');\n          evt.preventDefault();\n          break;\n        case 40:\n          // ctrl + down\n          selectorMove.call(this, shiftKey, 'col-last');\n          evt.preventDefault();\n          break;\n        case 32:\n          // ctrl + space, all cells in col\n          selectorSet.call(this, false, -1, data.selector.ci, false);\n          evt.preventDefault();\n          break;\n        case 66:\n          // ctrl + B\n          toolbar.trigger('bold');\n          break;\n        case 73:\n          // ctrl + I\n          toolbar.trigger('italic');\n          break;\n        default:\n          break;\n      }\n    } else {\n      // console.log('evt.keyCode:', evt.keyCode);\n      switch (keyCode) {\n        case 32:\n          if (shiftKey) {\n            // shift + space, all cells in row\n            selectorSet.call(this, false, data.selector.ri, -1, false);\n          }\n          break;\n        case 27: // esc\n          contextMenu.hide();\n          clearClipboard.call(this);\n          break;\n        case 37: // left\n          selectorMove.call(this, shiftKey, 'left');\n          evt.preventDefault();\n          break;\n        case 38: // up\n          selectorMove.call(this, shiftKey, 'up');\n          evt.preventDefault();\n          break;\n        case 39: // right\n          selectorMove.call(this, shiftKey, 'right');\n          evt.preventDefault();\n          break;\n        case 40: // down\n          selectorMove.call(this, shiftKey, 'down');\n          evt.preventDefault();\n          break;\n        case 9: // tab\n          editor.clear();\n          // shift + tab => move left\n          // tab => move right\n          selectorMove.call(this, false, shiftKey ? 'left' : 'right');\n          evt.preventDefault();\n          break;\n        case 13: // enter\n          editor.clear();\n          // shift + enter => move up\n          // enter => move down\n          selectorMove.call(this, false, shiftKey ? 'up' : 'down');\n          evt.preventDefault();\n          break;\n        case 8: // backspace\n          insertDeleteRowColumn.call(this, 'delete-cell-text');\n          evt.preventDefault();\n          break;\n        default:\n          break;\n      }\n\n      if (key === 'Delete') {\n        insertDeleteRowColumn.call(this, 'delete-cell-text');\n        evt.preventDefault();\n      } else if ((keyCode >= 65 && keyCode <= 90)\n        || (keyCode >= 48 && keyCode <= 57)\n        || (keyCode >= 96 && keyCode <= 105)\n        || evt.key === '='\n      ) {\n        dataSetCellText.call(this, evt.key, 'input');\n        editorSet.call(this);\n      } else if (keyCode === 113) {\n        // F2\n        editorSet.call(this);\n      }\n    }\n  });\n}\n\nexport default class Sheet {\n  constructor(targetEl, data) {\n    const { view, showToolbar, showContextmenu } = data.settings;\n    this.el = h('div', `${cssPrefix}-sheet`);\n    this.toolbar = new Toolbar(data, view.width, !showToolbar);\n    targetEl.children(this.toolbar.el, this.el);\n    this.data = data;\n    // table\n    this.tableEl = h('canvas', `${cssPrefix}-table`);\n    // resizer\n    this.rowResizer = new Resizer(false, data.rows.height);\n    this.colResizer = new Resizer(true, data.cols.minWidth);\n    // scrollbar\n    this.verticalScrollbar = new Scrollbar(true);\n    this.horizontalScrollbar = new Scrollbar(false);\n    // editor\n    this.editor = new Editor(\n      formulas,\n      () => this.getTableOffset(),\n      data.rows.height,\n    );\n    // data validation\n    this.modalValidation = new ModalValidation();\n    // contextMenu\n    this.contextMenu = new ContextMenu(() => this.getTableOffset(), !showContextmenu);\n    // selector\n    this.selector = new Selector(data);\n    this.overlayerCEl = h('div', `${cssPrefix}-overlayer-content`)\n      .children(\n        this.editor.el,\n        this.selector.el,\n      );\n    this.overlayerEl = h('div', `${cssPrefix}-overlayer`)\n      .child(this.overlayerCEl);\n    // sortFilter\n    this.sortFilter = new SortFilter();\n    // root element\n    this.el.children(\n      this.tableEl,\n      this.overlayerEl.el,\n      this.rowResizer.el,\n      this.colResizer.el,\n      this.verticalScrollbar.el,\n      this.horizontalScrollbar.el,\n      this.contextMenu.el,\n      this.modalValidation.el,\n      this.sortFilter.el,\n    );\n    // table\n    this.table = new Table(this.tableEl.el, data);\n    sheetInitEvents.call(this);\n    sheetReset.call(this);\n    // init selector [0, 0]\n    selectorSet.call(this, false, 0, 0);\n  }\n\n  loadData(data) {\n    this.data.setData(data);\n    sheetReset.call(this);\n    return this;\n  }\n\n  // freeze rows or cols\n  freeze(ri, ci) {\n    const { data } = this;\n    data.setFreeze(ri, ci);\n    sheetReset.call(this);\n    return this;\n  }\n\n  undo() {\n    this.data.undo();\n    sheetReset.call(this);\n  }\n\n  redo() {\n    this.data.redo();\n    sheetReset.call(this);\n  }\n\n  reload() {\n    sheetReset.call(this);\n    return this;\n  }\n\n  getRect() {\n    const { data } = this;\n    return { width: data.viewWidth(), height: data.viewHeight() };\n  }\n\n  getTableOffset() {\n    const { rows, cols } = this.data;\n    const { width, height } = this.getRect();\n    return {\n      width: width - cols.indexWidth,\n      height: height - rows.height,\n      left: cols.indexWidth,\n      top: rows.height,\n    };\n  }\n}\n","/* global window, document */\nimport { h } from './component/element';\nimport DataProxy from './core/data_proxy';\nimport Sheet from './component/sheet';\nimport { cssPrefix } from './config';\nimport { locale } from './locale/locale';\nimport './index.less';\n\n\nclass Spreadsheet {\n  constructor(selectors, options = {}) {\n    let targetEl = selectors;\n    if (typeof selectors === 'string') {\n      targetEl = document.querySelector(selectors);\n    }\n    this.data = new DataProxy('sheet1', options);\n    const rootEl = h('div', `${cssPrefix}`)\n      .on('contextmenu', evt => evt.preventDefault());\n    // create canvas element\n    targetEl.appendChild(rootEl.el);\n    this.sheet = new Sheet(rootEl, this.data);\n  }\n\n  loadData(data) {\n    this.sheet.loadData(data);\n    return this;\n  }\n\n  getData() {\n    return this.data.getData();\n  }\n\n  validate() {\n    const { validations } = this.data;\n    return validations.errors.size <= 0;\n  }\n\n  change(cb) {\n    this.data.change = cb;\n    return this;\n  }\n\n  static locale(lang, message) {\n    locale(lang, message);\n  }\n}\n\nconst spreadsheet = (el, options = {}) => new Spreadsheet(el, options);\n\nif (window) {\n  window.x = window.x || {};\n  window.x.spreadsheet = spreadsheet;\n  window.x.spreadsheet.locale = (lang, message) => locale(lang, message);\n}\n\nexport default Spreadsheet;\nexport {\n  spreadsheet,\n};\n"],"sourceRoot":""}