forked from myliang/x-spreadsheet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxspreadsheet.js.map
1 lines (1 loc) · 415 KB
/
xspreadsheet.js.map
1
{"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/button.js","webpack:///./src/canvas/draw.js","webpack:///./src/core/font.js","webpack:///./src/core/cell.js","webpack:///./src/core/formula.js","webpack:///./src/core/format.js","webpack:///./src/component/table.js","webpack:///./src/component/print.js","webpack:///./src/component/contextmenu.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/print.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/modal_validation.js","webpack:///./src/component/sort_filter.js","webpack:///./src/component/message.js","webpack:///./src/component/sheet.js","webpack:///./src/component/bottombar.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","removeChild","arg","createTextNode","appendChild","contains","classList","add","remove","cls","toggleClass","toggle","flag","addClass","removeClass","active","_this3","setAttribute","getAttribute","removeAttribute","content","innerHTML","focus","_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","condition","_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","digits","a","numberCalc","a1","a2","Number","isNaN","al1","al2","num1","num2","toFixed","max","helper","cloneDeep","obj","apply","equals","obj1","obj2","v1","v2","ai","arrayEquals","sum","objOrAry","total","rangeEach","min","rangeSum","getv","rangeReduceIf","inits","initv","ifv","deleteProperty","oldv","Rows","len","row_classCallCheck","isHide","row","getOrNew","idx","setHide","hide","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","substring","setCell","ncellmm","each","eachCells","setCellText","ndata","_this6","rndata","_this7","_this8","deleteCell","col","ks","entries","_ref2","_ref3","_ref4","_ref5","assign","Cols","indexWidth","minWidth","col_classCallCheck","getWidth","sumWidth","$lang","$messages","en","toolbar","undo","redo","print","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","deleteSheet","deleteRow","deleteColumn","deleteCellText","validation","cellprintable","cellnonprintable","celleditable","cellnoneditable","orientation","orientations","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","next","cancel","save","ok","desc","asc","empty","dataValidation","criteria","modeType","column","list","phone","email","be","nbe","lt","lte","gt","gte","eq","neq","translate","messages","message","x_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","isClear","isCopy","isCut","txt","lines","srcRange","_selector$range2","cri","cci","getFirstIncludes","unmerge","_selector$range","isSignleSelected","mergeIndexes","_merges$ii","mri","mci","splice","_cell$merge2","mrl","mcl","bottom","right","getCellMerge","_selector$size2","nfont","oldCell","oldText","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","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","_rows$maxCell2","maxCell","exceptRows","exceptRowTH","viewHeight","viewWidth","viewRange","filterIntersects","_selector$size6","rlen","clen","_selector$range6","unhide","frary","_toConsumableArray","offset","rowHeight","colWidth","nstyle","_this19","target","fn","unbind","removeEventListener","unbindClickoutside","xclickoutside","body","bindClickoutside","detail","mouseMoveUp","movefunc","upfunc","xEvtUp","calTouchDirection","spanx","spany","abs","cssPrefix","devicePixelRatio","Resizer","vertical","minDistance","resizer_classCallCheck","moving","children","unhideHoverEl","on","mousedblclickHandler","hoverEl","mousedownHandler","lineEl","cRect","finishedFn","unhideFn","unhideIndex","show","rect","line","hideUnhide","startEvt","distance","e","buttons","movementX","movementY","Scrollbar","scrollbar_classCallCheck","moveFn","contentEl","_evt$target","contentDistance","cssKey","startZIndex","SelectorElement","useHideInput","component_selector_classCallCheck","inputChange","cornerEl","areaEl","clipboardEl","autofillEl","hideInput","hideInputDiv","of","val","calBRAreaOffset","ftwidth","ftheight","calTAreaOffset","calLAreaOffset","setBRAreaOffset","br","setAreaOffset","setTAreaOffset","setLAreaOffset","setLClipboardOffset","setClipboardOffset","setBRClipboardOffset","setTClipboardOffset","setAllAreaOffset","tl","setAllClipboardOffset","areaOffset","indexes","arange","lastri","lastci","resetAreaOffset","freezeHeight","freezeWidth","setOffset","coffset","getClipboardRect","resetOffset","indexesUpdated","calSelectedRangeByStart","setIndexes","moveIndexes","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","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","txts","maxTxtSize","editor_toConsumableArray","fontWidth","tlineWidth","maxWidth","viewFn","h1","twidth","keydownEventHandler","altKey","itxt","selectionEnd","ntxt","setSelectionRange","setText","position","blur","setTimeout","Editor","formulas","editor_classCallCheck","suggest","start","lastIndexOf","sit","eit","indexOf","datepicker","dateFormat","editable","search","bindInputEvents","setItems","suggestPosition","elOffset","sOffset","Button","button_classCallCheck","button_possibleConstructorReturn","button_getPrototypeOf","dpr","thinLineWidth","npx","px","npxLine","DrawBox","padding","draw_classCallCheck","borderTop","borderRight","borderBottom","borderLeft","drawFontLine","tx","ty","blheight","blwidth","floffset","Draw","ctx","getContext","resize","scale","clearRect","options","beginPath","restore","fillRect","fillText","mtxt","box","attr","textWrap","textx","textAlign","textBaseline","fillStyle","strokeStyle","biw","innerWidth","ntxts","txtWidth","measureText","textLine","substr","txtHeight","texty","lineWidth","setLineDash","draw_slicedToArray","moveTo","lineTo","stroke","draw_toConsumableArray","topxys","rightxys","bottomxys","leftxys","sx","sy","closePath","fill","dtextcb","clip","baseFonts","fontSizes","pt","infixExprToSuffixExpr","operatorStack","stack","subStrs","fnArgType","fnArgOperator","fnArgsLen","oldc","join","c1","cell_slicedToArray","ex","ey","rangelen","nc","evalSubExpr","subExpr","cellRender","fl","expr","evalSuffixExpr","srcStack","formulaMap","cellList","fc","_expr","params","render","reverse","core_cell","getCellText","baseFormulas","ary","reduce","formula_toConsumableArray","formula_slicedToArray","f","every","some","formulam","formatStringRender","formatNumberRender","_v1$split2","format_toArray","first","parts","format_toConsumableArray","baseFormats","formatm","cellPaddingWidth","tableFixedHeaderCleanStyle","tableGridStyle","getDrawBox","rindex","yoffset","_data$cellRect","renderCell","draw","nrindex","frozen","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","PAGER_SIZES","PAGER_ORIENTATIONS","inches2px","inc","btnClick","toPrint","Print","print_classCallCheck","paper","print_toConsumableArray","ps","preview","iwidth","iheight","contentRange","pages","canvases","mViewRange","_loop","th","yo","wrap","canvas","rh","yof","contentWindow","idoc","head","cloneNode","drawImage","menuItems","buildMenu","ContextMenu","contextmenu_classCallCheck","contextmenu_toConsumableArray","setMode","hideEl","vhf","Item","shortcut","item_classCallCheck","tip","element","_target$getBoundingCl","elBox","tooltip","DropdownItem","dd","getValue","_get","dropdown_item_getPrototypeOf","setTitle","Dropdown","showArrow","placement","dropdown_classCallCheck","dropdown_possibleConstructorReturn","dropdown_getPrototypeOf","headerClick","setContentChildren","headerEl","_this$contentEl","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","toolbar_print_classCallCheck","print_possibleConstructorReturn","print_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","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","fieldLabelWidth","ModalValidation","modal_validation_classCallCheck","mf","rf","cf","criteriaSelected","criteriaOperatorSelected","minvf","maxvf","svf","vf","modal_validation_possibleConstructorReturn","modal_validation_getPrototypeOf","action","attrs","field","isShow","clsName","buildSortItem","resetFilterHeader","filterhEl","filterValues","checked","SortFilter","sort_filter_classCallCheck","filterbEl","filterClick","sortAscEl","sortDescEl","sortDesc","tindex","xtoast","_el$box","throttle","func","wait","timeout","that","selectorSet","contextMenu","trigger","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","cdata","clipboardData","pasteFromText","unhideRowsOrCols","overlayerMousedown","sortFilter","offsetX","offsetY","isAutofillEl","getCellRectByXY","getSort","shiftKey","_data$getCellRectByXY","paintformatActive","paintformatToggle","editorSetOffset","sPosition","editorSet","getSelectedCell","getSelectedValidator","dataSetCellText","setSelectedCellText","_data$selector","insertDeleteRowColumn","setSelectedCellAttr","toolbarChange","_data$selector2","sheetInitEvents","end","startx","starty","rowResizer","colResizer","modalValidation","tRect","showUnhide","xyInSelectedRect","setPosition","deltaY","deltaX","loopValue","vFunc","moveY","tempY","tempX","temp","horizontal","moveX","_evt$touches$","touches","pageX","pageY","_evt$changedTouches$","changedTouches","_evt$changedTouches$2","setAutoFilter","scrolly","resetBRLAreaOffset","scrollx","resetBRTAreaOffset","itext","_this5$data","addValidation","removeValidation","getSelectedValidation","hideRowsOrCols","reload","focusing","which","metaKey","Sheet","targetEl","sheet_classCallCheck","eventMap","_data$settings","_eventMap$get","_len3","_key3","resetData","setFreeze","_this$data","_this$getRect","bottombar_classCallCheck","bottombar_possibleConstructorReturn","bottombar_getPrototypeOf","contentClick","bottombar_toConsumableArray","_h$css","Bottombar","addFunc","swapFunc","deleteFunc","updateFunc","dataNames","activeEl","deleteEl","clickSwap2","menuEl","nindex","renameItem","clickSwap","bottombar_slicedToArray","Spreadsheet","selectors","src_classCallCheck","sheetIndex","datas","querySelector","bottombar","addSheet","sheet","rootEl","_this2$sheet","addItem","_this$bottombar$delet2","src_slicedToArray","deleteItem","oldIndex","ds","nd","getCellStyle","spreadsheet"],"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,EAAAE,GAAA,iBAAAF,EAAA,QAAAM,KAAAN,EAAArB,EAAAU,EAAAe,EAAAE,EAA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0B,GAAGzmB,EAAW2xC,GAClBxyC,wCAKP,OADwBA,KAAKI,KAArBid,YACW3C,OAAOnS,MAAQ,iCAG7Bd,GAEL,OADAzH,KAAKs7C,MAAMh0B,GAAG,SAAU7f,GACjBzH,4CAQLi8C,GAAc,SAACh8C,GAAD,IAAK20B,EAALh1B,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAe,GAAf,OAAsB,IAAIk7C,GAAY76C,EAAI20B,IAE1D7zB,SACFA,OAAOuY,cAAgB2iC,GACvBl7C,OAAOuY,cAAcE,OAAS,SAACC,EAAMJ,GAAP,OAAmBG,EAAOC,EAAMJ,KAGjDyhC","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 = 2);\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 removeChild(el) {\n this.el.removeChild(el);\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 focus() {\n this.el.focus();\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","import './_.prototypes';\n\nconst 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\n/** index number 2 letters\n * @example stringAt(26) ==> 'AA'\n * @date 2019-10-10\n * @export\n * @param {number} index\n * @returns {string}\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\n/** translate letter in A1-tag to number\n * @date 2019-10-10\n * @export\n * @param {string} str \"AA\" in A1-tag \"AA1\"\n * @returns {number}\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\n/** translate A1-tag to XY-tag\n * @date 2019-10-10\n * @export\n * @param {tagA1} src\n * @returns {tagXY}\n */\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/** translate XY-tag to A1-tag\n * @example x,y => B10\n * @date 2019-10-10\n * @export\n * @param {number} x\n * @param {number} y\n * @returns {tagA1}\n */\nexport function xy2expr(x, y) {\n return `${stringAt(x)}${y + 1}`;\n}\n\n/** translate A1-tag src by (xn, yn)\n * @date 2019-10-10\n * @export\n * @param {tagA1} src\n * @param {number} xn\n * @param {number} yn\n * @returns {tagA1}\n */\nexport function expr2expr(src, xn, yn, condition = () => true) {\n if (xn === 0 && yn === 0) return src;\n const [x, y] = expr2xy(src);\n if (!condition(x, y)) return 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\nfunction digits(a) {\n const v = `${a}`;\n let ret = 0;\n let flag = false;\n for (let i = 0; i < v.length; i += 1) {\n if (flag === true) ret += 1;\n if (v.charAt(i) === '.') flag = true;\n }\n return ret;\n}\n\nexport function numberCalc(type, a1, a2) {\n if (Number.isNaN(a1) || Number.isNaN(a2)) {\n return a1 + type + a2;\n }\n const al1 = digits(a1);\n const al2 = digits(a2);\n const num1 = Number(a1);\n const num2 = Number(a2);\n let ret = 0;\n if (type === '-') {\n ret = num1 - num2;\n } else if (type === '+') {\n ret = num1 + num2;\n } else if (type === '*') {\n ret = num1 * num2;\n } else if (type === '/') {\n ret = num1 / num2;\n if (digits(ret) > 5) return ret.toFixed(2);\n return ret;\n }\n return ret.toFixed(Math.max(al1, al2));\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 numberCalc,\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 if (this.isHide(ri)) return 0;\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 unhide(idx) {\n let index = idx;\n while (index > 0) {\n index -= 1;\n if (this.isHide(index)) {\n this.setHide(index, false);\n } else break;\n }\n }\n\n isHide(ri) {\n const row = this.get(ri);\n return row && row.hide;\n }\n\n setHide(ri, v) {\n const row = this.getOrNew(ri);\n if (v === true) row.hide = true;\n else delete row.hide;\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 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(/[a-zA-Z]{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 if (/^\\d+$/.test(word)) return word;\n return expr2expr(word, xn, yn);\n });\n } else if ((rn <= 1 && cn > 1 && (dsri > eri || deri < sri))\n || (cn <= 1 && rn > 1 && (dsci > eci || deci < sci))\n || (rn <= 1 && cn <= 1)) {\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 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 // src: Array<Array<String>>\n paste(src, dstCellRange) {\n if (src.length <= 0) return;\n const { sri, sci } = dstCellRange;\n src.forEach((row, i) => {\n const ri = sri + i;\n row.forEach((cell, j) => {\n const ci = sci + j;\n this.setCellText(ri, ci, cell);\n });\n });\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 this.eachCells(ri, (ci, cell) => {\n if (cell.text && cell.text[0] === '=') {\n cell.text = cell.text.replace(/[a-zA-Z]{1,3}\\d+/g, word => expr2expr(word, 0, n, (x, y) => y >= sri));\n }\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 this.eachCells(ri, (ci, cell) => {\n if (cell.text && cell.text[0] === '=') {\n cell.text = cell.text.replace(/[a-zA-Z]{1,3}\\d+/g, word => expr2expr(word, 0, -n, (x, y) => y > eri));\n }\n });\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 if (cell.text && cell.text[0] === '=') {\n cell.text = cell.text.replace(/[a-zA-Z]{1,3}\\d+/g, word => expr2expr(word, n, 0, x => x >= sci));\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 if (cell.text && cell.text[0] === '=') {\n cell.text = cell.text.replace(/[a-zA-Z]{1,3}\\d+/g, word => expr2expr(word, -n, 0, x => x > eci));\n }\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 maxCell() {\n const keys = Object.keys(this._);\n const ri = keys[keys.length - 1];\n const col = this._[ri];\n if (col) {\n const { cells } = col;\n const ks = Object.keys(cells);\n const ci = ks[ks.length - 1];\n return [parseInt(ri, 10), parseInt(ci, 10)];\n }\n return [0, 0];\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 if (this.isHide(i)) return 0;\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 unhide(idx) {\n let index = idx;\n while (index > 0) {\n index -= 1;\n if (this.isHide(index)) {\n this.setHide(index, false);\n } else break;\n }\n }\n\n isHide(ci) {\n const col = this._[ci];\n return col && col.hide;\n }\n\n setHide(ci, v) {\n const col = this.getOrNew(ci);\n if (v === true) col.hide = true;\n else delete col.hide;\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_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 print: 'Print',\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 hide: 'Hide',\n insertRow: 'Insert row',\n insertColumn: 'Insert column',\n deleteSheet: 'Delete',\n deleteRow: 'Delete row',\n deleteColumn: 'Delete column',\n deleteCell: 'Delete cell',\n deleteCellText: 'Delete cell text',\n validation: 'Data validations',\n cellprintable: 'Enable export',\n cellnonprintable: 'Disable export',\n celleditable: 'Enable editing',\n cellnoneditable: 'Disable editing',\n },\n print: {\n size: 'Paper size',\n orientation: 'Page orientation',\n orientations: ['Landscape', 'Portrait'],\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 next: 'Next',\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 mode: 'edit', // edit | read\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 format: 'normal',\n },\n};\n\nconst toolbarHeight = 41;\nconst bottombarHeight = 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 cstyle = helper.merge(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 pasteFromText(txt) {\n const lines = txt.split('\\r\\n').map(it => it.replace(/\"/g, '').split('\\t'));\n if (lines.length > 0) lines.length -= 1;\n const { rows, selector } = this;\n this.changeData(() => {\n rows.paste(lines, selector.range);\n });\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 } else {\n cell[property] = value;\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 h -= bottombarHeight;\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 contentRange() {\n const { rows, cols } = this;\n const [ri, ci] = rows.maxCell();\n const h = rows.sumHeight(0, ri + 1);\n const w = cols.sumWidth(0, ci + 1);\n return new CellRange(0, 0, ri, ci, w, h);\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 // console.log('scroll:', scroll, ', freeze:', freeze)\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 hideRowsOrCols() {\n const { rows, cols, selector } = this;\n const [rlen, clen] = selector.size();\n const {\n sri, sci, eri, eci,\n } = selector.range;\n if (rlen === rows.len) {\n for (let ci = sci; ci <= eci; ci += 1) {\n cols.setHide(ci, true);\n }\n } else if (clen === cols.len) {\n for (let ri = sri; ri <= eri; ri += 1) {\n rows.setHide(ri, true);\n }\n }\n }\n\n // type: row | col\n // index row-index | col-index\n unhideRowsOrCols(type, index) {\n this[`${type}s`].unhide(index);\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 if (rowHeight > 0) {\n cb(i, y, rowHeight);\n y += rowHeight;\n if (y > this.viewHeight()) break;\n }\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 if (colWidth > 0) {\n cb(i, x, colWidth);\n x += colWidth;\n if (x > this.viewWidth()) break;\n }\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 (property === 'autofilter') {\n this.autoFilter.setData(d[property]);\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.unhideHoverEl = h('div', `${cssPrefix}-resizer-hover`)\n .on('dblclick.stop', evt => this.mousedblclickHandler(evt))\n .css('position', 'absolute').hide(),\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 this.unhideFn = () => {};\n }\n\n showUnhide(index) {\n this.unhideIndex = index;\n this.unhideHoverEl.show();\n }\n\n hideUnhide() {\n this.unhideHoverEl.hide();\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 unhideHoverEl,\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 unhideHoverEl.offset({\n left: vertical ? 5 - width : left,\n top: vertical ? top : 5 - height,\n width: vertical ? 5 : width,\n height: vertical ? height : 5,\n });\n }\n\n hide() {\n this.el.offset({\n left: 0,\n top: 0,\n }).hide();\n this.hideUnhide();\n }\n\n mousedblclickHandler() {\n if (this.unhideIndex) this.unhideFn(this.unhideIndex);\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(useHideInput = false) {\n this.useHideInput = useHideInput;\n this.inputChange = () => {};\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 if (useHideInput) {\n this.hideInput = h('input', '')\n .on('compositionend', (evt) => {\n this.inputChange(evt.target.value);\n });\n this.el.child(this.hideInputDiv = h('div', 'hide-input').child(this.hideInput));\n this.el.child(this.hideInputDiv = h('div', 'hide-input').child(this.hideInput));\n }\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 const of = {\n width: width - selectorHeightBorderWidth + 0.8,\n height: height - selectorHeightBorderWidth + 0.8,\n left: left - 0.8,\n top: top - 0.8,\n };\n this.areaEl.offset(of).show();\n if (this.useHideInput) {\n this.hideInputDiv.offset(of);\n this.hideInput.val('').focus();\n }\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.inputChange = () => {};\n this.data = data;\n this.br = new SelectorElement(true);\n this.t = new SelectorElement();\n this.l = new SelectorElement();\n this.tl = new SelectorElement();\n this.br.inputChange = (v) => {\n this.inputChange(v);\n };\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 resetData(data) {\n this.data = data;\n this.range = data.selector.range;\n this.resetAreaOffset();\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 const { inputText } = this;\n if (!/^\\s*$/.test(inputText)) {\n const {\n textlineEl, textEl, areaOffset,\n } = this;\n const txts = inputText.split('\\n');\n const maxTxtSize = Math.max(...txts.map(it => it.length));\n const tlOffset = textlineEl.offset();\n const fontWidth = tlOffset.width / inputText.length;\n const tlineWidth = (maxTxtSize + 1) * fontWidth + 5;\n const maxWidth = this.viewFn().width - areaOffset.left - fontWidth;\n let h1 = txts.length;\n if (tlineWidth > areaOffset.width) {\n let twidth = tlineWidth;\n if (tlineWidth > maxWidth) {\n twidth = maxWidth;\n h1 += parseInt(tlineWidth / maxWidth, 10);\n h1 += (tlineWidth % maxWidth) > 0 ? 1 : 0;\n }\n textEl.css('width', `${twidth}px`);\n }\n h1 *= this.rowHeight;\n if (h1 > areaOffset.height) {\n textEl.css('height', `${h1}px`);\n }\n }\n}\n\nfunction insertText({ target }, itxt) {\n const { value, selectionEnd } = target;\n const ntxt = `${value.slice(0, selectionEnd)}${itxt}${value.slice(selectionEnd)}`;\n target.value = ntxt;\n target.setSelectionRange(selectionEnd + 1, selectionEnd + 1);\n\n this.inputText = ntxt;\n this.textlineEl.html(ntxt);\n resetTextareaSize.call(this);\n}\n\nfunction keydownEventHandler(evt) {\n const { keyCode, altKey } = evt;\n if (keyCode !== 13 && keyCode !== 9) evt.stopPropagation();\n if (keyCode === 13 && altKey) {\n insertText.call(this, evt, '\\n');\n evt.stopPropagation();\n }\n if (keyCode === 13 && !altKey) evt.preventDefault();\n}\n\nfunction inputEventHandler(evt) {\n const v = evt.target.value;\n // console.log(evt, 'v:', v);\n const { suggest, textlineEl, validator } = this;\n const { cell } = this;\n if (cell !== null) {\n if (('editable' in cell && cell.editable === true) || (cell.editable === undefined)) {\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 } else {\n evt.target.value = '';\n }\n } else {\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}\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 .on('paste.stop', () => {})\n .on('keydown', evt => keydownEventHandler.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 { 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","/* 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) - 2;\n }\n\n innerHeight() {\n return this.height - (this.padding * 2) - 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, h) {\n const { height, padding } = this;\n let { y } = this;\n if (align === 'top') {\n y += padding;\n } else if (align === 'middle') {\n y += height / 2 - h / 2;\n } else if (align === 'bottom') {\n y += height - padding - h;\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 scale(x, y) {\n this.ctx.scale(x, 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(mtxt, 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 txts = `${mtxt}`.split('\\n');\n const biw = box.innerWidth();\n const ntxts = [];\n txts.forEach((it) => {\n const txtWidth = ctx.measureText(it).width;\n if (textWrap && txtWidth > npx(biw)) {\n let textLine = { w: 0, len: 0, start: 0 };\n for (let i = 0; i < it.length; i += 1) {\n if (textLine.w >= npx(biw)) {\n ntxts.push(it.substr(textLine.start, textLine.len));\n textLine = { w: 0, len: 0, start: i };\n }\n textLine.len += 1;\n textLine.w += ctx.measureText(it[i]).width + 1;\n }\n if (textLine.len > 0) {\n ntxts.push(it.substr(textLine.start, textLine.len));\n }\n } else {\n ntxts.push(it);\n }\n });\n const txtHeight = (ntxts.length - 1) * (font.size + 2);\n let ty = box.texty(valign, txtHeight);\n ntxts.forEach((txt) => {\n const txtWidth = ctx.measureText(txt).width;\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 ty += font.size + 2;\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 ctx.beginPath();\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 // 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 frozen(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(0, 255, 0, .85)';\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","// docs\nimport './_.prototypes';\n\n/** default font list\n * @type {BaseFont[]}\n */\nconst 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\n/** default fontSize list\n * @type {FontSize[]}\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\n/** map pt to px\n * @date 2019-10-10\n * @param {fontsizePT} pt\n * @returns {fontsizePX}\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\n/** transform baseFonts to map\n * @date 2019-10-10\n * @param {BaseFont[]} [ary=[]]\n * @returns {object}\n */\nfunction 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';\nimport { numberCalc } from './helper';\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 let oldc = '';\n for (let i = 0; i < src.length; i += 1) {\n const c = src.charAt(i);\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 if (c === '-' && /[+\\-*/,(]/.test(oldc)) {\n subStrs.push(c);\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 === '=' || 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('xxxx:', 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 } else if (operatorStack.length > 0) {\n const top = operatorStack[operatorStack.length - 1];\n if (top === '*' || top === '/') stack.push(operatorStack.pop());\n }\n operatorStack.push(c);\n }\n subStrs = [];\n }\n oldc = c;\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 const [fl] = subExpr;\n let expr = subExpr;\n if (fl === '\"') {\n return subExpr.substring(1);\n }\n let ret = 1;\n if (fl === '-') {\n expr = subExpr.substring(1);\n ret = -1;\n }\n if (expr[0] >= '0' && expr[0] <= '9') {\n return ret * Number(expr);\n }\n const [x, y] = expr2xy(expr);\n return ret * 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(numberCalc('+', stack.pop(), top));\n } else if (expr === '-') {\n if (stack.length === 1) {\n const top = stack.pop();\n stack.push(numberCalc('*', top, -1));\n } else {\n const top = stack.pop();\n stack.push(numberCalc('-', stack.pop(), top));\n }\n } else if (expr === '*') {\n stack.push(numberCalc('*', stack.pop(), stack.pop()));\n } else if (expr === '/') {\n const top = stack.pop();\n stack.push(numberCalc('/', stack.pop(), top));\n } else if (fc === '=' || fc === '>' || fc === '<') {\n let top = stack.pop();\n if (!Number.isNaN(top)) top = Number(top);\n let left = stack.pop();\n if (!Number.isNaN(left)) left = Number(left);\n let ret = false;\n if (fc === '=') {\n ret = (left === top);\n } else if (expr === '>') {\n ret = (left > top);\n } else if (expr === '>=') {\n ret = (left >= top);\n } else if (expr === '<') {\n ret = (left < top);\n } else if (expr === '<=') {\n ret = (left <= top);\n }\n stack.push(ret);\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 stack.push(formulaMap[formula].render(params.reverse()));\n } else {\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 cellList.pop();\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*/\n/**\n * @typedef {object} Formula\n * @property {string} key\n * @property {function} title\n * @property {function} render\n */\nimport { tf } from '../locale/locale';\nimport { numberCalc } from './helper';\n\n/** @type {Formula[]} */\nconst baseFormulas = [\n {\n key: 'SUM',\n title: tf('formula.sum'),\n render: ary => ary.reduce((a, b) => numberCalc('+', a, 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 // match \"-12.1\" or \"12\" or \"12.1\"\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","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(data, rindex, cindex, yoffset = 0) {\n const {\n left, top, width, height,\n } = data.cellRect(rindex, cindex);\n return new DrawBox(left, top + yoffset, 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\nexport function renderCell(draw, data, rindex, cindex, yoffset = 0) {\n const { sortedRowMap, rows, cols } = data;\n if (rows.isHide(rindex) || cols.isHide(cindex)) return;\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 let frozen = false;\n if ('editable' in cell && cell.editable === false) {\n frozen = true;\n }\n\n const style = data.getCellStyleOrDefault(nrindex, cindex);\n const dbox = getDrawBox(data, rindex, cindex, yoffset);\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 if (frozen) {\n draw.frozen(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(data, 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(draw, data, 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(draw, data, 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 if (i > 0 && data.rows.isHide(i - 1)) {\n draw.save();\n draw.attr({ strokeStyle: '#c6c6c6' });\n draw.line([5, y + 5], [w - 5, y + 5]);\n draw.restore();\n }\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 if (i > 0 && data.cols.isHide(i - 1)) {\n draw.save();\n draw.attr({ strokeStyle: '#c6c6c6' });\n draw.line([x + 5, 5], [x + 5, h - 5]);\n draw.restore();\n }\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 resetData(data) {\n this.data = data;\n this.render();\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","/* global window document */\nimport { h } from './element';\nimport { cssPrefix } from '../config';\nimport Button from './button';\nimport { Draw } from '../canvas/draw';\nimport { renderCell } from './table';\nimport { t } from '../locale/locale';\n\n// resolution: 72 => 595 x 842\n// 150 => 1240 x 1754\n// 200 => 1654 x 2339\n// 300 => 2479 x 3508\n// 96 * cm / 2.54 , 96 * cm / 2.54\n\nconst PAGER_SIZES = [\n ['A3', 11.69, 16.54],\n ['A4', 8.27, 11.69],\n ['A5', 5.83, 8.27],\n ['B4', 9.84, 13.90],\n ['B5', 6.93, 9.84],\n];\n\nconst PAGER_ORIENTATIONS = ['landscape', 'portrait'];\n\nfunction inches2px(inc) {\n return parseInt(96 * inc, 10);\n}\n\nfunction btnClick(type) {\n if (type === 'cancel') {\n this.el.hide();\n } else {\n this.toPrint();\n }\n}\n\nfunction pagerSizeChange(evt) {\n const { paper } = this;\n const { value } = evt.target;\n const ps = PAGER_SIZES[value];\n paper.w = inches2px(ps[1]);\n paper.h = inches2px(ps[2]);\n // console.log('paper:', ps, paper);\n this.preview();\n}\nfunction pagerOrientationChange(evt) {\n const { paper } = this;\n const { value } = evt.target;\n const v = PAGER_ORIENTATIONS[value];\n paper.orientation = v;\n this.preview();\n}\n\nexport default class Print {\n constructor(data) {\n this.paper = {\n w: inches2px(PAGER_SIZES[0][1]),\n h: inches2px(PAGER_SIZES[0][2]),\n padding: 50,\n orientation: PAGER_ORIENTATIONS[0],\n get width() {\n return this.orientation === 'landscape' ? this.h : this.w;\n },\n get height() {\n return this.orientation === 'landscape' ? this.w : this.h;\n },\n };\n this.data = data;\n this.el = h('div', `${cssPrefix}-print`)\n .children(\n h('div', `${cssPrefix}-print-bar`)\n .children(\n h('div', '-title').child('Print settings'),\n h('div', '-right').children(\n h('div', `${cssPrefix}-buttons`).children(\n new Button('cancel').on('click', btnClick.bind(this, 'cancel')),\n new Button('next', 'primary').on('click', btnClick.bind(this, 'next')),\n ),\n ),\n ),\n h('div', `${cssPrefix}-print-content`)\n .children(\n this.contentEl = h('div', '-content'),\n h('div', '-sider').child(\n h('form', '').children(\n h('fieldset', '').children(\n h('label', '').child(`${t('print.size')}`),\n h('select', '').children(\n ...PAGER_SIZES.map((it, index) => h('option', '').attr('value', index).child(`${it[0]} ( ${it[1]}''x${it[2]}'' )`)),\n ).on('change', pagerSizeChange.bind(this)),\n ),\n h('fieldset', '').children(\n h('label', '').child(`${t('print.orientation')}`),\n h('select', '').children(\n ...PAGER_ORIENTATIONS.map((it, index) => h('option', '').attr('value', index).child(`${t('print.orientations')[index]}`)),\n ).on('change', pagerOrientationChange.bind(this)),\n ),\n ),\n ),\n ),\n ).hide();\n }\n\n resetData(data) {\n this.data = data;\n }\n\n preview() {\n const { data, paper } = this;\n const { width, height, padding } = paper;\n const iwidth = width - padding * 2;\n const iheight = height - padding * 2;\n const cr = data.contentRange();\n const pages = parseInt(cr.h / iheight, 10) + 1;\n const scale = iwidth / cr.w;\n let left = padding;\n const top = padding;\n if (scale > 1) {\n left += (iwidth - cr.w) / 2;\n }\n let ri = 0;\n let yoffset = 0;\n this.contentEl.html('');\n this.canvases = [];\n const mViewRange = {\n sri: 0,\n sci: 0,\n eri: 0,\n eci: 0,\n };\n for (let i = 0; i < pages; i += 1) {\n let th = 0;\n let yo = 0;\n const wrap = h('div', `${cssPrefix}-canvas-card`);\n const canvas = h('canvas', `${cssPrefix}-canvas`);\n this.canvases.push(canvas.el);\n const draw = new Draw(canvas.el, width, height);\n // cell-content\n draw.save();\n draw.translate(left, top);\n if (scale < 1) draw.scale(scale, scale);\n // console.log('ri:', ri, cr.eri, yoffset);\n for (; ri <= cr.eri; ri += 1) {\n const rh = data.rows.getHeight(ri);\n th += rh;\n if (th < iheight) {\n for (let ci = 0; ci <= cr.eci; ci += 1) {\n renderCell(draw, data, ri, ci, yoffset);\n mViewRange.eci = ci;\n }\n } else {\n yo = -(th - rh);\n break;\n }\n }\n mViewRange.eri = ri;\n draw.restore();\n // merge-cell\n draw.save();\n draw.translate(left, top);\n if (scale < 1) draw.scale(scale, scale);\n const yof = yoffset;\n data.eachMergesInView(mViewRange, ({ sri, sci }) => {\n renderCell(draw, data, sri, sci, yof);\n });\n draw.restore();\n\n mViewRange.sri = mViewRange.eri;\n mViewRange.sci = mViewRange.eci;\n yoffset += yo;\n this.contentEl.child(h('div', `${cssPrefix}-canvas-card-wraper`).child(wrap.child(canvas)));\n }\n this.el.show();\n }\n\n toPrint() {\n this.el.hide();\n const { paper } = this;\n const iframe = h('iframe', '').hide();\n const { el } = iframe;\n window.document.body.appendChild(el);\n const { contentWindow } = el;\n const idoc = contentWindow.document;\n const style = document.createElement('style');\n style.innerHTML = `\n @page { size: ${paper.width}px ${paper.height}px; };\n canvas {\n page-break-before: auto; \n page-break-after: always;\n image-rendering: pixelated;\n };\n `;\n idoc.head.appendChild(style);\n this.canvases.forEach((it) => {\n const cn = it.cloneNode(false);\n const ctx = cn.getContext('2d');\n // ctx.imageSmoothingEnabled = true;\n ctx.drawImage(it, 0, 0);\n idoc.body.appendChild(cn);\n });\n contentWindow.print();\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: 'hide', title: tf('contextmenu.hide') },\n { key: 'divider' },\n { key: 'validation', title: tf('contextmenu.validation') },\n { key: 'divider' },\n { key: 'cell-printable', title: tf('contextmenu.cellprintable') },\n { key: 'cell-non-printable', title: tf('contextmenu.cellnonprintable') },\n { key: 'divider' },\n { key: 'cell-editable', title: tf('contextmenu.celleditable') },\n { key: 'cell-non-editable', title: tf('contextmenu.cellnoneditable') },\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.menuItems = buildMenu.call(this);\n this.el = h('div', `${cssPrefix}-contextmenu`)\n .children(...this.menuItems)\n .hide();\n this.viewFn = viewFn;\n this.itemClick = () => {};\n this.isHide = isHide;\n this.setMode('range');\n }\n\n // row-col: the whole rows or the whole cols\n // range: select range\n setMode(mode) {\n const hideEl = this.menuItems[12];\n if (mode === 'row-col') {\n hideEl.show();\n } else {\n hideEl.hide();\n }\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 { width } = el.show().offset();\n const view = this.viewFn();\n const vhf = view.height / 2;\n let left = x;\n if (view.width - x <= width) {\n left -= width;\n }\n el.css('left', `${left}px`);\n if (y > vhf) {\n el.css('bottom', `${view.height - y}px`)\n .css('max-height', `${y}px`)\n .css('top', 'auto');\n } else {\n el.css('top', `${y}px`)\n .css('max-height', `${view.height - y}px`)\n .css('bottom', 'auto');\n }\n bindClickoutside(el);\n }\n}\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 if (shortcut) this.tip += ` (${shortcut})`;\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 this.headerClick = () => {};\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 .css('width', width)\n .hide();\n\n this.setContentChildren(...children);\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 setContentChildren(...children) {\n this.contentEl.html('');\n if (children.length > 0) {\n this.contentEl.children(...children);\n }\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 IconItem from './icon_item';\n\nexport default class Print extends IconItem {\n constructor() {\n super('print', 'Ctrl+P');\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 Print from './print';\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 new Print(),\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 resetData(data) {\n this.data = data;\n this.reset();\n }\n\n reset() {\n if (this.isHide) return;\n const { data } = this;\n const style = data.getSelectedCellStyle();\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, format } = style;\n this.formatEl.setState(format);\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 }\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 focus() {\n setTimeout(() => {\n this.input.el.focus();\n }, 10);\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 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 Print from './print';\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\n/**\n * @desc throttle fn\n * @param func function\n * @param wait Delay in milliseconds\n */\nfunction throttle(func, wait) {\n let timeout;\n return (...arg) => {\n const that = this;\n const args = arg;\n if (!timeout) {\n timeout = setTimeout(() => {\n timeout = null;\n func.apply(that, args);\n }, wait);\n }\n };\n}\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 const {\n table, selector, toolbar, data,\n contextMenu,\n } = this;\n contextMenu.setMode((ri === -1 || ci === -1) ? 'row-col' : 'range');\n const cell = data.getCell(ri, ci);\n if (multiple) {\n selector.setEnd(ri, ci, moving);\n this.trigger('cells-selected', cell, selector.range);\n } else {\n // trigger click event\n selector.set(ri, ci, indexesUpdated);\n this.trigger('cell-selected', cell, ri, ci);\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 if (rows.isHide(cRect.ri - 1)) {\n rowResizer.showUnhide(cRect.ri);\n } else {\n rowResizer.hideUnhide();\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 if (cols.isHide(cRect.ci - 1)) {\n colResizer.showUnhide(cRect.ci);\n } else {\n colResizer.hideUnhide();\n }\n } else {\n colResizer.hide();\n }\n}\n\nfunction overlayerMousescroll(evt) {\n const { verticalScrollbar, horizontalScrollbar, data } = this;\n const { top } = verticalScrollbar.scroll();\n const { left } = horizontalScrollbar.scroll();\n // console.log('evt:::', evt.wheelDelta, evt.detail * 40);\n\n const { rows, cols } = data;\n\n // deltaY for vertical delta\n const { deltaY, deltaX } = evt;\n const loopValue = (ii, vFunc) => {\n let i = ii;\n let v = 0;\n do {\n v = vFunc(i);\n i += 1;\n } while (v <= 0);\n return v;\n };\n // console.log('deltaX', deltaX, 'evt.detail', evt.detail);\n // if (evt.detail) deltaY = evt.detail * 40;\n const moveY = (vertical) => {\n if (vertical > 0) {\n // up\n const ri = data.scroll.ri + 1;\n if (ri < rows.len) {\n const rh = loopValue(ri, i => rows.getHeight(i));\n verticalScrollbar.move({ top: top + rh - 1 });\n }\n } else {\n // down\n const ri = data.scroll.ri - 1;\n if (ri >= 0) {\n const rh = loopValue(ri, i => rows.getHeight(i));\n verticalScrollbar.move({ top: ri === 0 ? 0 : top - rh });\n }\n }\n };\n\n // deltaX for Mac horizontal scroll\n const moveX = (horizontal) => {\n if (horizontal > 0) {\n // left\n const ci = data.scroll.ci + 1;\n if (ci < cols.len) {\n const cw = loopValue(ci, i => cols.getWidth(i));\n horizontalScrollbar.move({ left: left + cw - 1 });\n }\n } else {\n // right\n const ci = data.scroll.ci - 1;\n if (ci >= 0) {\n const cw = loopValue(ci, i => cols.getWidth(i));\n horizontalScrollbar.move({ left: ci === 0 ? 0 : left - cw });\n }\n }\n };\n const tempY = Math.abs(deltaY);\n const tempX = Math.abs(deltaX);\n const temp = Math.max(tempY, tempX);\n // detail for windows/mac firefox vertical scroll\n if (/Firefox/i.test(window.navigator.userAgent)) throttle(moveY(evt.detail), 50);\n if (temp === tempX) throttle(moveX(deltaX), 50);\n if (temp === tempY) throttle(moveY(deltaY), 50);\n}\n\nfunction overlayerTouch(direction, distance) {\n const { verticalScrollbar, horizontalScrollbar } = this;\n const { top } = verticalScrollbar.scroll();\n const { left } = horizontalScrollbar.scroll();\n\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, evt) {\n const { data } = this;\n if (data.settings.mode === 'read') return;\n if (data.paste(what, msg => xtoast('Tip', msg))) {\n sheetReset.call(this);\n } else if (evt) {\n const cdata = evt.clipboardData.getData('text/plain');\n this.data.pasteFromText(cdata);\n sheetReset.call(this);\n }\n}\n\nfunction hideRowsOrCols() {\n this.data.hideRowsOrCols();\n sheetReset.call(this);\n}\n\nfunction unhideRowsOrCols(type, index) {\n this.data.unhideRowsOrCols(type, index);\n sheetReset.call(this);\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.hide();\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 && selector.arange && data.settings.mode !== 'read') {\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 if (data.settings.mode === 'read') return;\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 if (data.settings.mode === 'read') return;\n data.setSelectedCellText(text, state);\n const { ri, ci } = data.selector;\n if (state === 'finished') {\n table.render();\n } else {\n this.trigger('cell-edited', text, ri, ci);\n }\n}\n\nfunction insertDeleteRowColumn(type) {\n const { data } = this;\n if (data.settings.mode === 'read') return;\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 } else if (type === 'cell-printable') {\n data.setSelectedCellAttr('printable', true);\n } else if (type === 'cell-non-printable') {\n data.setSelectedCellAttr('printable', false);\n } else if (type === 'cell-editable') {\n data.setSelectedCellAttr('editable', true);\n } else if (type === 'cell-non-editable') {\n data.setSelectedCellAttr('editable', false);\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 this.print.preview();\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 selector,\n overlayerEl,\n rowResizer,\n colResizer,\n verticalScrollbar,\n horizontalScrollbar,\n editor,\n contextMenu,\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 editor.clear();\n contextMenu.hide();\n // the left mouse button: mousedown → mouseup → click\n // the right mouse button: mousedown → contenxtmenu → mouseup\n if (evt.buttons === 2) {\n if (this.data.xyInSelectedRect(evt.offsetX, evt.offsetY)) {\n contextMenu.setPosition(evt.offsetX, evt.offsetY);\n } else {\n overlayerMousedown.call(this, evt);\n contextMenu.setPosition(evt.offsetX, evt.offsetY);\n }\n evt.stopPropagation();\n } else if (evt.detail === 2) {\n editorSet.call(this);\n } else {\n overlayerMousedown.call(this, evt);\n }\n })\n .on('mousewheel.stop', (evt) => {\n overlayerMousescroll.call(this, evt);\n })\n .on('mouseout', (evt) => {\n const { offsetX, offsetY } = evt;\n if (offsetY <= 0) colResizer.hide();\n if (offsetX <= 0) rowResizer.hide();\n });\n\n selector.inputChange = (v) => {\n dataSetCellText.call(this, v, 'input');\n editorSet.call(this);\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 // resizer unhide callback\n rowResizer.unhideFn = (index) => {\n unhideRowsOrCols.call(this, 'row', index);\n };\n colResizer.unhideFn = (index) => {\n unhideRowsOrCols.call(this, 'col', index);\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 this.data.addValidation(...args);\n } else {\n this.data.removeValidation();\n }\n };\n // contextmenu\n contextMenu.itemClick = (type) => {\n // console.log('type:', type);\n if (type === 'validation') {\n modalValidation.setValue(this.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 if (type === 'hide') {\n hideRowsOrCols.call(this);\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 bind(window, 'paste', (evt) => {\n paste.call(this, 'all', evt);\n evt.preventDefault();\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, 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\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, this.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, this.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 this.eventMap = new Map();\n const { view, showToolbar, showContextmenu } = data.settings;\n this.el = h('div', `${cssPrefix}-sheet`);\n this.toolbar = new Toolbar(data, view.width, !showToolbar);\n this.print = new Print(data);\n targetEl.children(this.toolbar.el, this.el, this.print.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.getRect(), !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 on(eventName, func) {\n this.eventMap.set(eventName, func);\n return this;\n }\n\n trigger(eventName, ...args) {\n const { eventMap } = this;\n if (eventMap.has(eventName)) {\n eventMap.get(eventName).call(this, ...args);\n }\n }\n\n resetData(data) {\n // before\n this.editor.clear();\n // after\n this.data = data;\n verticalScrollbarSet.call(this);\n horizontalScrollbarSet.call(this);\n this.toolbar.resetData(data);\n this.print.resetData(data);\n this.selector.resetData(data);\n this.table.resetData(data);\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","import { h } from './element';\nimport { bindClickoutside, unbindClickoutside } from './event';\nimport { cssPrefix } from '../config';\nimport Icon from './icon';\nimport FormInput from './form_input';\nimport Dropdown from './dropdown';\nimport { xtoast } from './message';\nimport { tf } from '../locale/locale';\n\nclass DropdownMore extends Dropdown {\n constructor(click) {\n const icon = new Icon('ellipsis');\n super(icon, 'auto', false, 'top-left');\n this.contentClick = click;\n }\n\n reset(items) {\n const eles = items.map((it, i) => h('div', `${cssPrefix}-item`)\n .css('width', '150px')\n .css('font-weight', 'normal')\n .on('click', () => {\n this.contentClick(i);\n this.hide();\n })\n .child(it));\n this.setContentChildren(...eles);\n }\n\n setTitle() {}\n}\n\nconst menuItems = [\n { key: 'delete', title: tf('contextmenu.deleteSheet') },\n];\n\nfunction buildMenuItem(item) {\n return h('div', `${cssPrefix}-item`)\n .child(item.title())\n .on('click', () => {\n this.itemClick(item.key);\n this.hide();\n });\n}\n\nfunction buildMenu() {\n return menuItems.map(it => buildMenuItem.call(this, it));\n}\n\nclass ContextMenu {\n constructor() {\n this.el = h('div', `${cssPrefix}-contextmenu`)\n .css('width', '160px')\n .children(...buildMenu.call(this))\n .hide();\n this.itemClick = () => {};\n }\n\n hide() {\n const { el } = this;\n el.hide();\n unbindClickoutside(el);\n }\n\n setOffset(offset) {\n const { el } = this;\n el.offset(offset);\n el.show();\n bindClickoutside(el);\n }\n}\n\nexport default class Bottombar {\n constructor(addFunc = () => {},\n swapFunc = () => {},\n deleteFunc = () => {},\n updateFunc = () => {}) {\n this.swapFunc = swapFunc;\n this.updateFunc = updateFunc;\n this.dataNames = [];\n this.activeEl = null;\n this.deleteEl = null;\n this.items = [];\n this.moreEl = new DropdownMore((i) => {\n this.clickSwap2(this.items[i]);\n });\n this.contextMenu = new ContextMenu();\n this.contextMenu.itemClick = deleteFunc;\n this.el = h('div', `${cssPrefix}-bottombar`).children(\n this.contextMenu.el,\n this.menuEl = h('ul', `${cssPrefix}-menu`).child(\n h('li', '').children(\n new Icon('add').on('click', () => {\n if (this.dataNames.length < 10) {\n addFunc();\n } else {\n xtoast('tip', 'it less than or equal to 10');\n }\n }),\n h('span', '').child(this.moreEl),\n ),\n ),\n );\n }\n\n addItem(name, active) {\n this.dataNames.push(name);\n const item = h('li', active ? 'active' : '').child(name);\n item.on('click', () => {\n this.clickSwap2(item);\n }).on('contextmenu', (evt) => {\n const { offsetLeft, offsetHeight } = evt.target;\n this.contextMenu.setOffset({ left: offsetLeft, bottom: offsetHeight + 1 });\n this.deleteEl = item;\n }).on('dblclick', () => {\n const v = item.html();\n const input = new FormInput('auto', '');\n input.val(v);\n input.input.on('blur', ({ target }) => {\n const { value } = target;\n const nindex = this.dataNames.findIndex(it => it === v);\n this.renameItem(nindex, value);\n /*\n this.dataNames.splice(nindex, 1, value);\n this.moreEl.reset(this.dataNames);\n item.html('').child(value);\n this.updateFunc(nindex, value);\n */\n });\n item.html('').child(input.el);\n input.focus();\n });\n if (active) {\n this.clickSwap(item);\n }\n this.items.push(item);\n this.menuEl.child(item);\n this.moreEl.reset(this.dataNames);\n }\n\n renameItem(index, value) {\n this.dataNames.splice(index, 1, value);\n this.moreEl.reset(this.dataNames);\n this.items[index].html('').child(value);\n this.updateFunc(index, value);\n }\n\n clear() {\n this.items.forEach((it) => {\n this.menuEl.removeChild(it.el);\n });\n this.items = [];\n this.dataNames = [];\n this.moreEl.reset(this.dataNames);\n }\n\n deleteItem() {\n const { activeEl, deleteEl } = this;\n if (this.items.length > 1) {\n const index = this.items.findIndex(it => it === deleteEl);\n this.items.splice(index, 1);\n this.dataNames.splice(index, 1);\n this.menuEl.removeChild(deleteEl.el);\n this.moreEl.reset(this.dataNames);\n if (activeEl === deleteEl) {\n const [f] = this.items;\n this.activeEl = f;\n this.activeEl.toggle();\n return [index, 0];\n }\n return [index, -1];\n }\n return [-1];\n }\n\n clickSwap2(item) {\n const index = this.items.findIndex(it => it === item);\n this.clickSwap(item);\n this.activeEl.toggle();\n this.swapFunc(index);\n }\n\n clickSwap(item) {\n if (this.activeEl !== null) {\n this.activeEl.toggle();\n }\n this.activeEl = item;\n }\n}\n","/* global window, document */\nimport { h } from './component/element';\nimport DataProxy from './core/data_proxy';\nimport Sheet from './component/sheet';\nimport Bottombar from './component/bottombar';\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 this.options = options;\n this.sheetIndex = 1;\n this.datas = [];\n if (typeof selectors === 'string') {\n targetEl = document.querySelector(selectors);\n }\n this.bottombar = new Bottombar(() => {\n const d = this.addSheet();\n this.sheet.resetData(d);\n }, (index) => {\n const d = this.datas[index];\n this.sheet.resetData(d);\n }, () => {\n this.deleteSheet();\n }, (index, value) => {\n this.datas[index].name = value;\n });\n this.data = this.addSheet();\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 rootEl.child(this.bottombar.el);\n }\n\n addSheet(name, active = true) {\n const n = name || `sheet${this.sheetIndex}`;\n const d = new DataProxy(n, this.options);\n d.change = (...args) => {\n this.sheet.trigger('change', ...args);\n };\n this.datas.push(d);\n // console.log('d:', n, d, this.datas);\n this.bottombar.addItem(n, active);\n this.sheetIndex += 1;\n return d;\n }\n\n deleteSheet() {\n const [oldIndex, nindex] = this.bottombar.deleteItem();\n if (oldIndex >= 0) {\n this.datas.splice(oldIndex, 1);\n if (nindex >= 0) this.sheet.resetData(this.datas[nindex]);\n }\n }\n\n loadData(data) {\n const ds = Array.isArray(data) ? data : [data];\n this.bottombar.clear();\n this.datas = [];\n if (ds.length > 0) {\n for (let i = 0; i < ds.length; i += 1) {\n const it = ds[i];\n const nd = this.addSheet(it.name, i === 0);\n nd.setData(it);\n if (i === 0) {\n this.sheet.resetData(nd);\n }\n }\n }\n return this;\n }\n\n getData() {\n return this.datas.map(it => it.getData());\n }\n\n cellText(ri, ci, text, sheetIndex = 0) {\n this.datas[sheetIndex].setCellText(ri, ci, text, 'finished');\n return this;\n }\n\n cell(ri, ci, sheetIndex = 0) {\n return this.datas[sheetIndex].getCell(ri, ci);\n }\n\n cellStyle(ri, ci, sheetIndex = 0) {\n return this.datas[sheetIndex].getCellStyle(ri, ci);\n }\n\n reRender() {\n this.sheet.table.render();\n return this;\n }\n\n on(eventName, func) {\n this.sheet.on(eventName, func);\n return this;\n }\n\n validate() {\n const { validations } = this.data;\n return validations.errors.size <= 0;\n }\n\n change(cb) {\n this.sheet.on('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_spreadsheet = spreadsheet;\n window.x_spreadsheet.locale = (lang, message) => locale(lang, message);\n}\n\nexport default Spreadsheet;\nexport {\n spreadsheet,\n};\n"],"sourceRoot":""}