ethercalc
Version:
Multi-User Spreadsheet Server — TypeScript rewrite (Cloudflare fullstack)
1,001 lines (976 loc) • 827 kB
JavaScript
// Opening half of a UMD IIFE. Inlined in build.ts — not a standalone module.
//
// Taken from https://github.com/umdjs/umd/blob/master/templates/returnExports.js
// (c) by The UMD contributors
// MIT License: https://github.com/umdjs/umd/blob/master/LICENSE.md
(function (root, factory) {
// Evaluate once and fan out to both deliveries:
// * browser / globalThis (root.SocialCalc) — always set
// * CommonJS / Node (module.exports) — when present
// AMD was dropped from this wrapper: the npm package is its
// canonical entry point today, and AMD loaders (RequireJS, Dojo
// legacy) have been unmaintained for years. Anyone still wiring
// AMD can wrap the CommonJS module themselves.
var exported = factory.call(root, root);
root.SocialCalc = exported;
if (typeof module === 'object' && module && module.exports) {
module.exports = exported;
}
})(typeof globalThis !== 'undefined' ? globalThis : this, function (window) {
// Factory-local bag. Formerly created in socialcalcconstants as
// `var SocialCalc; if (!SocialCalc) SocialCalc = {}`. Hoisted here so
// converted TypeScript sources can typecheck against the ambient
// `declare namespace SocialCalc` without a runtime `var SocialCalc`
// that would shadow/collapse the namespace during `tsc`.
var SocialCalc = {};
// In-place TypeScript conversion of socialcalcconstants.js (SocialCalc global script).
// Ambient API types live in socialcalcconstants.d.ts (referenced by dist/SocialCalc.d.ts).
// Vite+ strips types with Oxc before UMD concat — no runtime tax.
// Runtime SocialCalc bag is created in module-wrapper-top.js (UMD factory-local).
//
/*
// The module of the SocialCalc package with customizable constants, strings, etc.
// This is where most of the common localizations are done.
//
// (c) Copyright 2008, 2009, 2010 Socialtext, Inc.
// All Rights Reserved.
//
// The contents of this file are subject to the Artistic License 2.0; you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at http://socialcalc.org/licenses/al-20/.
//
// Some of the other files in the SocialCalc package are licensed under
// different licenses. Please note the licenses of the modules you use.
//
// Code History:
//
// Initially coded by Dan Bricklin of Software Garden, Inc., for Socialtext, Inc.
// Based in part on the SocialCalc 1.1.0 code written in Perl.
// The SocialCalc 1.1.0 code was:
// Portions (c) Copyright 2005, 2006, 2007 Software Garden, Inc.
// All Rights Reserved.
// Portions (c) Copyright 2007 Socialtext, Inc.
// All Rights Reserved.
// The Perl SocialCalc started as modifications to the wikiCalc(R) program, version 1.0.
// wikiCalc 1.0 was written by Software Garden, Inc.
// Unless otherwise specified, referring to "SocialCalc" in comments refers to this
// JavaScript version of the code, not the SocialCalc Perl code.
//
*/
// SocialCalc bag: created by module-wrapper-top.js inside the UMD factory.
// Implementation-only mutable view for progressive init of ambient `const` members.
const ConstantsRoot = SocialCalc;
ConstantsRoot.Constants = {
cellDataType: {
v: 'value',
n: 'value',
t: 'text',
f: 'formula',
c: 'constant',
},
textdatadefaulttype: 't',
s_BrowserNotSupported: 'Browser not supported.',
s_InternalError: 'Internal SocialCalc error (probably an internal bug): ',
s_pssUnknownColType: 'Unknown col type item',
s_pssUnknownRowType: 'Unknown row type item',
s_pssUnknownLineType: 'Unknown line type',
s_cfspUnknownCellType: 'Unknown cell type item',
doCanonicalizeSheet: true,
s_escUnknownSheetCmd: 'Unknown sheet command: ',
s_escUnknownSetCoordCmd: 'Unknown set coord command: ',
s_escUnknownCmd: 'Unknown command: ',
s_caccCircRef: 'Circular reference to ',
defaultRowNameWidth: '30',
defaultAssumedRowHeight: 15,
defaultCellIDPrefix: 'cell_',
defaultCellLayout: 'padding:2px 2px 1px 2px;vertical-align:top;',
defaultCellFontStyle: 'normal normal',
defaultCellFontSize: 'small',
defaultCellFontFamily: 'Verdana,Arial,Helvetica,sans-serif',
defaultPaneDividerWidth: '3',
defaultPaneDividerHeight: '3',
defaultGridCSS: '1px solid #C0C0C0;',
defaultCommentClass: '',
defaultCommentStyle:
'background-repeat:no-repeat;background-position:top right;background-image:url(images/sc-commentbg.gif);',
defaultCommentNoGridClass: '',
defaultCommentNoGridStyle: '',
defaultReadonlyClass: '',
defaultReadonlyStyle:
'background-repeat:no-repeat;background-position:top right;background-image:url(images/sc-lockbg.gif);',
defaultReadonlyNoGridClass: '',
defaultReadonlyNoGridStyle: '',
defaultReadonlyComment: 'Locked cell',
defaultColWidth: '80',
defaultMinimumColWidth: 10,
defaultHighlightTypeCursorClass: '',
defaultHighlightTypeCursorStyle: 'color:#FFF;backgroundColor:#A6A6A6;',
defaultHighlightTypeRangeClass: '',
defaultHighlightTypeRangeStyle: 'color:#000;backgroundColor:#E5E5E5;',
defaultColnameClass: '',
defaultColnameStyle:
'overflow:visible;font-size:small;text-align:center;color:#FFFFFF;background-color:#808080;',
defaultSelectedColnameClass: '',
defaultSelectedColnameStyle:
'overflow:visible;font-size:small;text-align:center;color:#FFFFFF;background-color:#404040;',
defaultRownameClass: '',
defaultRownameStyle:
'position:relative;overflow:visible;font-size:small;text-align:right;color:#FFFFFF;background-color:#808080;',
defaultSelectedRownameClass: '',
defaultSelectedRownameStyle:
'position:relative;overflow:visible;font-size:small;text-align:right;color:#FFFFFF;background-color:#404040;',
defaultUpperLeftClass: '',
defaultUpperLeftStyle: 'font-size:small;',
defaultSkippedCellClass: '',
defaultSkippedCellStyle: 'font-size:small;background-color:#CCC',
defaultPaneDividerClass: '',
defaultPaneDividerStyle: 'font-size:small;background-color:#C0C0C0;padding:0px;',
defaultUnhideLeftClass: '',
defaultUnhideLeftStyle:
'float:right;width:9px;height:12px;cursor:pointer;background-image:url(images/sc-unhideleft.gif);padding:0;',
defaultUnhideRightClass: '',
defaultUnhideRightStyle:
'float:left;width:9px;height:12px;cursor:pointer;background-image:url(images/sc-unhideright.gif);padding:0;',
defaultUnhideTopClass: '',
defaultUnhideTopStyle:
'float:left;left:1px;position:absolute;bottom:-4px;width:12px;height:9px;cursor:pointer;background-image:url(images/sc-unhidetop.gif);padding:0;',
defaultUnhideBottomClass: '',
defaultUnhideBottomStyle:
'float:left;width:12px;height:9px;cursor:pointer;background-image:url(images/sc-unhidebottom.gif);padding:0;',
defaultColResizeBarClass: 'col-resize-bar',
defaultRowResizeBarClass: 'row-resize-bar',
s_rcMissingSheet: 'Render Context must have a sheet object',
defaultLinkFormatString:
'<span style="font-size:smaller;text-decoration:none !important;background-color:#66B;color:#FFF;">Link</span>',
defaultPageLinkFormatString:
'<span style="font-size:smaller;text-decoration:none !important;background-color:#66B;color:#FFF;">Page</span>',
defaultFormatp: '#,##0.0%',
defaultFormatc: '[$$]#,##0.00',
defaultFormatdt: 'd-mmm-yyyy h:mm:ss',
defaultFormatd: 'd-mmm-yyyy',
defaultFormatt: '[h]:mm:ss',
defaultDisplayTRUE: 'TRUE',
defaultDisplayFALSE: 'FALSE',
defaultImagePrefix: 'images/sc_',
defaultTableEditorIDPrefix: 'te_',
defaultPageUpDnAmount: 15,
AllowCtrlS: true,
defaultTableControlThickness: 20,
cteGriddivClass: '',
s_statusline_executing: 'Executing...',
s_statusline_displaying: 'Displaying...',
s_statusline_ordering: 'Ordering...',
s_statusline_calculating: 'Calculating...',
s_statusline_calculatingls: 'Calculating... Loading Sheet...',
s_statusline_doingserverfunc: 'doing server function ',
s_statusline_incell: ' in cell ',
s_statusline_calcstart: 'Calculation start...',
s_statusline_sum: 'SUM',
s_statusline_recalcneeded: '<span style="color:#999;">(Recalc needed)</span>',
s_statusline_circref: '<span style="color:red;">Circular reference: ',
s_statusline_sendemail: 'Sending Email ',
s_inputboxdisplaymultilinetext: '[Multi-line text: Click icon on right to edit]',
defaultInputEchoClass: '',
defaultInputEchoStyle:
'filter:alpha(opacity=90);opacity:.9;backgroundColor:#FFD;border:1px solid #884;' +
'fontSize:small;padding:2px 10px 1px 2px;cursor:default;',
defaultInputEchoPromptClass: '',
defaultInputEchoPromptStyle:
'filter:alpha(opacity=90);opacity:.9;backgroundColor:#FFD;' +
'borderLeft:1px solid #884;borderRight:1px solid #884;borderBottom:1px solid #884;' +
'fontSize:small;fontStyle:italic;padding:2px 10px 1px 2px;cursor:default;',
defaultInputEchoHintClass: '',
defaultInputEchoHintStyle:
'filter:alpha(opacity=80);opacity:.8;backgroundColor:#884;border:1px solid #884;' +
'fontSize:small;fontWeight:bold;padding:2px 2px 2px 2px;color:#FFF;position:absolute;top:-20px;cursor:default;',
ietUnknownFunction: 'Unknown function ',
CH_radius1: 29,
CH_radius2: 41,
s_CHfillAllTooltip: 'Fill Contents and Formats Down/Right',
s_CHfillContentsTooltip: 'Fill Contents Only Down/Right',
s_CHmovePasteAllTooltip: 'Move Contents and Formats',
s_CHmovePasteContentsTooltip: 'Move Contents Only',
s_CHmoveInsertAllTooltip: 'Slide Contents and Formats within Row/Col',
s_CHmoveInsertContentsTooltip: 'Slide Contents within Row/Col',
s_CHindicatorOperationLookup: {
Fill: 'Fill',
FillC: 'Fill Contents',
Move: 'Move',
MoveI: 'Slide',
MoveC: 'Move Contents',
MoveIC: 'Slide Contents',
},
s_CHindicatorDirectionLookup: {
Down: ' Down',
Right: ' Right',
Horizontal: ' Horizontal',
Vertical: ' Vertical',
},
defaultTCSliderThickness: 9,
defaultTCButtonThickness: 20,
defaultTCThumbThickness: 15,
TCmainStyle: 'backgroundColor:#EEE;',
TCmainClass: '',
TCendcapStyle: 'backgroundColor:#FFF;',
TCendcapClass: '',
TCpanesliderClass: 'tc-paneslider',
s_panesliderTooltiph: 'Drag to lock pane vertically',
s_panesliderTooltipv: 'Drag to lock pane horizontally',
TClessbuttonStyle: 'backgroundColor:#AAA;',
TClessbuttonClass: '',
TClessbuttonRepeatWait: 300,
TClessbuttonRepeatInterval: 20,
TCmorebuttonStyle: 'backgroundColor:#AAA;',
TCmorebuttonClass: '',
TCmorebuttonRepeatWait: 300,
TCmorebuttonRepeatInterval: 20,
TCscrollareaStyle: 'backgroundColor:#DDD;',
TCscrollareaClass: '',
TCscrollareaRepeatWait: 500,
TCscrollareaRepeatInterval: 100,
TCthumbClass: '',
TCthumbStyle: 'backgroundColor:#CCC;',
TCPStrackinglineClass: 'tracklingine',
TCPStrackinglineStyle: 'overflow:hidden;position:absolute;zIndex:100;',
TCPStrackinglineThickness: '2px',
TCTDFSthumbstatusvClass: '',
TCTDFSthumbstatusvStyle:
'height:20px;width:auto;border:3px solid #808080;overflow:hidden;' +
'backgroundColor:#FFF;fontSize:small;position:absolute;zIndex:100;',
TCTDFSthumbstatushClass: '',
TCTDFSthumbstatushStyle:
'height:20px;width:auto;border:1px solid black;padding:2px;' +
'backgroundColor:#FFF;fontSize:small;position:absolute;zIndex:100;',
TCTDFSthumbstatusrownumClass: '',
TCTDFSthumbstatusrownumStyle:
'color:#FFF;background-color:#808080;font-size:small;white-space:nowrap;padding:3px;',
TCTDFStopOffsetv: 0,
TCTDFSleftOffsetv: -80,
s_TCTDFthumbstatusPrefixv: 'Row ',
TCTDFStopOffseth: -30,
TCTDFSleftOffseth: 0,
s_TCTDFthumbstatusPrefixh: 'Col ',
TooltipOffsetX: 2,
TooltipOffsetY: 10,
TDpopupElementClass: '',
TDpopupElementStyle:
'border:1px solid black;padding:1px 2px 2px 2px;textAlign:center;backgroundColor:#FFF;' +
'fontSize:7pt;fontFamily:Verdana,Arial,Helvetica,sans-serif;' +
'position:absolute;width:auto;zIndex:110;',
SCToolbarbackground: 'background-color:#ffffff;',
SCTabbackground: 'background-color:#CCC;',
SCTabselectedCSS:
'font-size:small;padding:6px 30px 6px 8px;color:#FFF;background-color:#404040;cursor:default;border-right:1px solid #CCC;',
SCTabplainCSS:
'font-size:small;padding:6px 30px 6px 8px;color:#FFF;background-color:#808080;cursor:default;border-right:1px solid #CCC;',
SCToolbartext: 'font-size:x-small;font-weight:bold;color:#888',
SCFormulabarheight: 30,
SCStatuslineheight: 20,
SCStatuslineCSS: 'font-size:10px;padding:3px 0px;',
SCFormatNumberFormats:
'[cancel]:|[break]:|%loc!Default!:|[custom]:|%loc!Automatic!:general|%loc!Auto w/ commas!:[,]General|[break]:|' +
'00:00|000:000|0000:0000|00000:00000|[break]:|%loc!Formula!:formula|%loc!Hidden!:hidden|[newcol]:' +
'1234:0|1,234:#,##0|1,234.5:#,##0.0|1,234.56:#,##0.00|1,234.567:#,##0.000|1,234.5678:#,##0.0000|' +
'[break]:|1,234%:#,##0%|1,234.5%:#,##0.0%|1,234.56%:#,##0.00%|' +
'[newcol]:|$1,234:$#,##0|$1,234.5:$#,##0.0|$1,234.56:$#,##0.00|[break]:|' +
'(1,234):#,##0_);(#,##0)|(1,234.5):#,##0.0_);(#,##0.0)|(1,234.56):#,##0.00_);(#,##0.00)|[break]:|' +
'($1,234):$#,##0_);($#,##0)|($1,234.5):$#,##0.0_);($#,##0.0)|($1,234.56):$#,##0.00_);($#,##0.00)|' +
'[newcol]:|1/4/06:m/d/yy|01/04/2006:mm/dd/yyyy|2006-01-04:yyyy-mm-dd|4-Jan-06:d-mmm-yy|04-Jan-2006:dd-mmm-yyyy|January 4, 2006:mmmm d, yyyy|' +
'[break]:|1\\c23:h:mm|1\\c23 PM:h:mm AM/PM|1\\c23\\c45:h:mm:ss|01\\c23\\c45:hh:mm:ss|26\\c23 (h\\cm):[hh]:mm|69\\c45 (m\\cs):[mm]:ss|69 (s):[ss]|' +
'[newcol]:|2006-01-04 01\\c23\\c45:yyyy-mm-dd hh:mm:ss|January 4, 2006:mmmm d, yyyy hh:mm:ss|Wed:ddd|Wednesday:dddd|',
SCFormatTextFormats:
'[cancel]:|[break]:|%loc!Default!:|[custom]:|%loc!Automatic!:general|%loc!Plain Text!:text-plain|' +
'HTML:text-html|%loc!Wikitext!:text-wiki|%loc!Link!:text-link|%loc!Formula!:formula|%loc!Hidden!:hidden|',
SCFormatPadsizes:
'[cancel]:|[break]:|%loc!Default!:|[custom]:|%loc!No padding!:0px|' +
'[newcol]:|1 pixel:1px|2 pixels:2px|3 pixels:3px|4 pixels:4px|5 pixels:5px|' +
'6 pixels:6px|7 pixels:7px|8 pixels:8px|[newcol]:|9 pixels:9px|10 pixels:10px|11 pixels:11px|' +
'12 pixels:12px|13 pixels:13px|14 pixels:14px|16 pixels:16px|' +
'18 pixels:18px|[newcol]:|20 pixels:20px|22 pixels:22px|24 pixels:24px|28 pixels:28px|36 pixels:36px|',
SCFormatFontsizes:
'[cancel]:|[break]:|%loc!Default!:|[custom]:|X-Small:x-small|Small:small|Medium:medium|Large:large|X-Large:x-large|' +
'[newcol]:|6pt:6pt|7pt:7pt|8pt:8pt|9pt:9pt|10pt:10pt|11pt:11pt|12pt:12pt|14pt:14pt|16pt:16pt|' +
'[newcol]:|18pt:18pt|20pt:20pt|22pt:22pt|24pt:24pt|28pt:28pt|36pt:36pt|48pt:48pt|72pt:72pt|' +
'[newcol]:|8 pixels:8px|9 pixels:9px|10 pixels:10px|11 pixels:11px|' +
'12 pixels:12px|13 pixels:13px|14 pixels:14px|[newcol]:|16 pixels:16px|' +
'18 pixels:18px|20 pixels:20px|22 pixels:22px|24 pixels:24px|28 pixels:28px|36 pixels:36px|',
SCFormatFontfamilies:
'[cancel]:|[break]:|%loc!Default!:|[custom]:|Verdana:Verdana,Arial,Helvetica,sans-serif|' +
"Arial:arial,helvetica,sans-serif|Courier:'Courier New',Courier,monospace|",
SCFormatFontlook:
'[cancel]:|[break]:|%loc!Default!:|%loc!Normal!:normal normal|%loc!Bold!:normal bold|%loc!Italic!:italic normal|' +
'%loc!Bold Italic!:italic bold',
SCFormatTextAlignhoriz:
'[cancel]:|[break]:|%loc!Default!:|%loc!Left!:left|%loc!Center!:center|%loc!Right!:right|',
SCFormatNumberAlignhoriz:
'[cancel]:|[break]:|%loc!Default!:|%loc!Left!:left|%loc!Center!:center|%loc!Right!:right|',
SCFormatAlignVertical:
'[cancel]:|[break]:|%loc!Default!:|%loc!Top!:top|%loc!Middle!:middle|%loc!Bottom!:bottom|',
SCFormatColwidth:
'[cancel]:|[break]:|%loc!Default!:|[custom]:|[newcol]:|' +
'20 pixels:20|40:40|60:60|80:80|100:100|120:120|140:140|160:160|' +
'[newcol]:|180 pixels:180|200:200|220:220|240:240|260:260|280:280|300:300|',
SCFormatRecalc: '[cancel]:|[break]:|%loc!Auto!:|%loc!Manual!:off|',
SCFormatUserMaxCol:
'[cancel]:|[break]:|%loc!Default!:|[custom]:|[newcol]:|' +
'Unlimited:0|10:10|20:20|30:30|40:40|50:50|60:60|80:80|100:100|',
SCFormatUserMaxRow:
'[cancel]:|[break]:|%loc!Default!:|[custom]:|[newcol]:|' +
'Unlimited:0|10:10|20:20|30:30|40:40|50:50|60:60|80:80|100:100|',
ISCButtonNormalBackground: 'transparent',
ISCButtonBorderNormal: 'none',
ISCButtonBorderHover: 'none',
ISCButtonBorderDown: 'none',
ISCButtonDownBackground: '#888',
s_PopupListCancel: '[Cancel]',
s_PopupListCustom: 'Custom',
s_loc_align_center: 'Align Center',
s_loc_align_left: 'Align Left',
s_loc_align_right: 'Align Right',
s_loc_alignment: 'Alignment',
s_loc_audit: 'Audit',
s_loc_audit_trail_this_session: 'Audit Trail This Session',
s_loc_auto: 'Auto',
s_loc_auto_sum: 'Auto Sum',
s_loc_auto_wX_commas: 'Auto w/ commas',
s_loc_automatic: 'Automatic',
s_loc_background: 'Background',
s_loc_bold: 'Bold',
s_loc_bold_XampX_italics: 'Bold & Italics',
s_loc_bold_italic: 'Bold Italic',
s_loc_borders: 'Borders',
s_loc_borders_off: 'Borders Off',
s_loc_borders_on: 'Borders On',
s_loc_bottom: 'Bottom',
s_loc_bottom_border: 'Bottom Border',
s_loc_cell_settings: 'CELL SETTINGS',
s_loc_csv_format: 'CSV format',
s_loc_cancel: 'Cancel',
s_loc_category: 'Category',
s_loc_center: 'Center',
s_loc_clear: 'Clear',
s_loc_clear_socialcalc_clipboard: 'Clear SocialCalc Clipboard',
s_loc_clipboard: 'Clipboard',
s_loc_color: 'Color',
s_loc_column_: 'Column ',
s_loc_comment: 'Comment',
s_loc_copy: 'Copy',
s_loc_custom: 'Custom',
s_loc_cut: 'Cut',
s_loc_default: 'Default',
s_loc_default_alignment: 'Default Alignment',
s_loc_default_column_width: 'Default Column Width',
s_loc_default_font: 'Default Font',
s_loc_default_format: 'Default Format',
s_loc_default_padding: 'Default Padding',
s_loc_delete: 'Delete',
s_loc_delete_column: 'Delete Column',
s_loc_delete_contents: 'Delete Cell Contents',
s_loc_delete_row: 'Delete Row',
s_loc_description: 'Description',
s_loc_display_clipboard_in: 'Display Clipboard in',
s_loc_down: 'Down',
s_loc_edit: 'Edit',
s_loc_existing_names: 'Existing Names',
s_loc_family: 'Family',
s_loc_fill_down: 'Fill Down',
s_loc_fill_right: 'Fill Right',
s_loc_font: 'Font',
s_loc_format: 'Format',
s_loc_formula: 'Formula',
s_loc_function_list: 'Function List',
s_loc_functions: 'Functions',
s_loc_grid: 'Grid',
s_loc_hidden: 'Hidden',
s_loc_hide_column: 'Hide Column',
s_loc_hide_row: 'Hide Row',
s_loc_horizontal: 'Horizontal',
s_loc_insert_column: 'Insert Column Before',
s_loc_insert_row: 'Insert Row Before',
s_loc_italic: 'Italic',
s_loc_last_sort: 'Last Sort',
s_loc_left: 'Left',
s_loc_left_border: 'Left Border',
s_loc_link: 'Link',
s_loc_link_input_box: 'Link Input Box',
s_loc_list: 'List',
s_loc_load_socialcalc_clipboard_with_this: 'Load SocialCalc Clipboard With This',
s_loc_lock_cell: 'Lock Cell',
s_loc_major_sort: 'Major Sort',
s_loc_manual: 'Manual',
s_loc_merge_cells: 'Merge/Unmerge Cells',
s_loc_middle: 'Middle',
s_loc_minor_sort: 'Minor Sort',
s_loc_move_insert: 'Move Insert',
s_loc_move_paste: 'Move Paste',
s_loc_multiXline_input_box: 'Multi-line Input Box',
s_loc_name: 'Name',
s_loc_names: 'Names',
s_loc_no_padding: 'No padding',
s_loc_normal: 'Normal',
s_loc_number: 'Number',
s_loc_number_horizontal: 'Number Horizontal',
s_loc_ok: 'OK',
s_loc_padding: 'Padding',
s_loc_page_name: 'Page Name',
s_loc_paste: 'Paste',
s_loc_paste_formats: 'Paste Formats',
s_loc_plain_text: 'Plain Text',
s_loc_recalc: 'Recalc',
s_loc_recalculation: 'Recalculation',
s_loc_redo: 'Redo',
s_loc_right: 'Right',
s_loc_right_border: 'Right Border',
s_loc_sheet_settings: 'SHEET SETTINGS',
s_loc_save: 'Save',
s_loc_save_to: 'Save to',
s_loc_set_cell_contents: 'Set Cell Contents',
s_loc_set_cells_to_sort: 'Set Cells To Sort',
s_loc_set_value_to: 'Set Value To',
s_loc_set_to_link_format: 'Set to Link format',
s_loc_setXclear_move_from: 'Set/Clear Move From',
s_loc_show_cell_settings: 'Show Cell Settings',
s_loc_show_sheet_settings: 'Show Sheet Settings',
s_loc_show_in_new_browser_window: 'Show in new browser window',
s_loc_size: 'Size',
s_loc_socialcalcXsave_format: 'SocialCalc-save format',
s_loc_sort: 'Sort',
s_loc_sort_: 'Sort ',
s_loc_sort_cells: 'Sort Cells',
s_loc_swap_colors: 'Swap Colors',
s_loc_tabXdelimited_format: 'Tab-delimited format',
s_loc_text: 'Text',
s_loc_text_horizontal: 'Text Horizontal',
s_loc_this_is_aXbrXsample: 'This is a<br>sample',
s_loc_top: 'Top',
s_loc_top_border: 'Top Border',
s_loc_undone_steps: 'UNDONE STEPS',
s_loc_url: 'URL',
s_loc_undo: 'Undo',
s_loc_unlock_cell: 'Unlock Cell',
s_loc_unmerge_cells: 'Unmerge Cells',
s_loc_up: 'Up',
s_loc_value: 'Value',
s_loc_vertical: 'Vertical',
s_loc_wikitext: 'Wikitext',
s_loc_workspace: 'Workspace',
s_loc_XnewX: '[New]',
s_loc_XnoneX: '[None]',
s_loc_Xselect_rangeX: '[select range]',
SVStatuslineheight: 20,
SVStatuslineCSS: 'font-size:10px;padding:3px 0px;',
FormatNumber_separatorchar: ',',
FormatNumber_decimalchar: '.',
FormatNumber_defaultCurrency: '$',
s_FormatNumber_daynames: [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday',
],
s_FormatNumber_daynames3: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
s_FormatNumber_monthnames: [
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December',
],
s_FormatNumber_monthnames3: [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec',
],
s_FormatNumber_am: 'AM',
s_FormatNumber_am1: 'A',
s_FormatNumber_pm: 'PM',
s_FormatNumber_pm1: 'P',
s_parseerrexponent: 'Improperly formed number exponent',
s_parseerrchar: 'Unexpected character in formula',
s_parseerrstring: 'Improperly formed string',
s_parseerrspecialvalue: 'Improperly formed special value',
s_parseerrtwoops: 'Error in formula (two operators inappropriately in a row)',
s_parseerrmissingopenparen: 'Missing open parenthesis in list with comma(s). ',
s_parseerrcloseparennoopen: 'Closing parenthesis without open parenthesis. ',
s_parseerrmissingcloseparen: 'Missing close parenthesis. ',
s_parseerrmissingoperand: 'Missing operand. ',
s_parseerrerrorinformula: 'Error in formula.',
s_calcerrerrorvalueinformula: 'Error value in formula',
s_parseerrerrorinformulabadval: 'Error in formula resulting in bad value',
s_formularangeresult: 'Formula results in range value:',
s_calcerrnumericnan: 'Formula results in a bad numeric value',
s_calcerrnumericoverflow: 'Numeric overflow',
s_sheetunavailable: 'Sheet unavailable:',
s_calcerrcellrefmissing: 'Cell reference missing when expected.',
s_calcerrsheetnamemissing: 'Sheet name missing when expected.',
s_circularnameref: 'Circular name reference to name',
s_calcerrunknownname: 'Unknown name',
s_calcerrincorrectargstofunction: 'Incorrect arguments to function',
s_sheetfuncunknownfunction: 'Unknown function',
s_sheetfunclnarg: 'LN argument must be greater than 0',
s_sheetfunclog10arg: 'LOG10 argument must be greater than 0',
s_sheetfunclogsecondarg: 'LOG second argument must be numeric greater than 0',
s_sheetfunclogfirstarg: 'LOG first argument must be greater than 0',
s_sheetfuncroundsecondarg: 'ROUND second argument must be numeric',
s_sheetfuncddblife: 'DDB life must be greater than 1',
s_sheetfuncslnlife: 'SLN life must be greater than 1',
s_fdef_ABS: 'Absolute value function. ',
s_fdef_ACOS: 'Trigonometric arccosine function. ',
s_fdef_AND: 'True if all arguments are true. ',
s_fdef_ASIN: 'Trigonometric arcsine function. ',
s_fdef_ATAN: 'Trigonometric arctan function. ',
s_fdef_ATAN2: 'Trigonometric arc tangent function (result is in radians). ',
s_fdef_AVERAGE: 'Averages the values. ',
s_fdef_CHOOSE: 'Returns the value specified by the index. The values may be ranges of cells. ',
s_fdef_COLUMNS: 'Returns the number of columns in the range. ',
s_fdef_COS: 'Trigonometric cosine function (value is in radians). ',
s_fdef_CONCAT: 'Join Together Text & Values to Create a Single Combined Text String. ',
s_fdef_CONCATENATE: 'Join Together Text & Values to Create a Single Combined Text String. ',
s_fdef_COUNT: 'Counts the number of numeric values, not blank, text, or error. ',
s_fdef_COUNTA: 'Counts the number of non-blank values. ',
s_fdef_COUNTBLANK: 'Counts the number of blank values. (Note: "" is not blank.) ',
s_fdef_COUNTIF:
'Counts the number of number of cells in the range that meet the criteria. The criteria may be a value ("x", 15, 1+3) or a test (>25). ',
s_fdef_DATE:
'Returns the appropriate date value given numbers for year, month, and day. For example: DATE(2006,2,1) for February 1, 2006. Note: In this program, day "1" is December 31, 1899 and the year 1900 is not a leap year. Some programs use January 1, 1900, as day "1" and treat 1900 as a leap year. In both cases, though, dates on or after March 1, 1900, are the same. ',
s_fdef_DAVERAGE:
'Averages the values in the specified field in records that meet the criteria. ',
s_fdef_DAY: 'Returns the day of month for a date value. ',
s_fdef_DCOUNT:
'Counts the number of numeric values, not blank, text, or error, in the specified field in records that meet the criteria. ',
s_fdef_DCOUNTA:
'Counts the number of non-blank values in the specified field in records that meet the criteria. ',
s_fdef_DDB:
'Returns the amount of depreciation at the given period of time (the default factor is 2 for double-declining balance). ',
s_fdef_DEGREES: 'Converts value in radians into degrees. ',
s_fdef_DGET:
'Returns the value of the specified field in the single record that meets the criteria. ',
s_fdef_DMAX:
'Returns the maximum of the numeric values in the specified field in records that meet the criteria. ',
s_fdef_DMIN:
'Returns the minimum of the numeric values in the specified field in records that meet the criteria. ',
s_fdef_DPRODUCT:
'Returns the result of multiplying the numeric values in the specified field in records that meet the criteria. ',
s_fdef_DSTDEV:
'Returns the sample standard deviation of the numeric values in the specified field in records that meet the criteria. ',
s_fdef_DSTDEVP:
'Returns the standard deviation of the numeric values in the specified field in records that meet the criteria. ',
s_fdef_DSUM:
'Returns the sum of the numeric values in the specified field in records that meet the criteria. ',
s_fdef_DVAR:
'Returns the sample variance of the numeric values in the specified field in records that meet the criteria. ',
s_fdef_DVARP:
'Returns the variance of the numeric values in the specified field in records that meet the criteria. ',
s_fdef_EVEN: 'Rounds the value up in magnitude to the nearest even integer. ',
s_fdef_EXACT: 'Returns "true" if the values are exactly the same, including case, type, etc. ',
s_fdef_EXP: 'Returns e raised to the value power. ',
s_fdef_FACT: 'Returns factorial of the value. ',
s_fdef_FALSE: 'Returns the logical value "false". ',
s_fdef_FIND:
'Returns the starting position within string2 of the first occurrence of string1 at or after "start". If start is omitted, 1 is assumed. ',
s_fdef_FV:
'Returns the future value of repeated payments of money invested at the given rate for the specified number of periods, with optional present value (default 0) and payment type (default 0 = at end of period, 1 = beginning of period). ',
s_fdef_HLOOKUP:
'Look for the matching value for the given value in the range and return the corresponding value in the cell specified by the row offset. If rangelookup is 1 (the default) and not 0, match if within numeric brackets (match<=value) instead of exact match. ',
s_fdef_HOUR: 'Returns the hour portion of a time or date/time value. ',
s_fdef_IF:
'Results in true-value if logical-expression is TRUE or non-zero, otherwise results in false-value. ',
s_fdef_INDEX:
'Returns a cell or range reference for the specified row and column in the range. If range is 1-dimensional, then only one of rownum or colnum are needed. If range is 2-dimensional and rownum or colnum are zero, a reference to the range of just the specified column or row is returned. You can use the returned reference value in a range, e.g., sum(A1:INDEX(A2:A10,4)). ',
s_fdef_INT: 'Returns the value rounded down to the nearest integer (towards -infinity). ',
s_fdef_IRR:
'Returns the interest rate at which the cash flows in the range have a net present value of zero. Uses an iterative process that will return #NUM! error if it does not converge. There may be more than one possible solution. Providing the optional guess value may help in certain situations where it does not converge or finds an inappropriate solution (the default guess is 10%). ',
s_fdef_ISBLANK: 'Returns "true" if the value is a reference to a blank cell. ',
s_fdef_ISERR: 'Returns "true" if the value is of type "Error" but not "NA". ',
s_fdef_ISERROR: 'Returns "true" if the value is of type "Error". ',
s_fdef_ISLOGICAL: 'Returns "true" if the value is of type "Logical" (true/false). ',
s_fdef_ISNA: 'Returns "true" if the value is the error type "NA". ',
s_fdef_ISNONTEXT: 'Returns "true" if the value is not of type "Text". ',
s_fdef_ISNUMBER: 'Returns "true" if the value is of type "Number" (including logical values). ',
s_fdef_ISTEXT: 'Returns "true" if the value is of type "Text". ',
s_fdef_LEFT:
'Returns the specified number of characters from the text value. If count is omitted, 1 is assumed. ',
s_fdef_LEN: 'Returns the number of characters in the text value. ',
s_fdef_LN: 'Returns the natural logarithm of the value. ',
s_fdef_LOG: 'Returns the logarithm of the value using the specified base. ',
s_fdef_LOG10: 'Returns the base 10 logarithm of the value. ',
s_fdef_LOWER: 'Returns the text value with all uppercase characters converted to lowercase. ',
s_fdef_MATCH:
'Look for the matching value for the given value in the range and return position (the first is 1) in that range. If rangelookup is 1 (the default) and not 0, match if within numeric brackets (match<=value) instead of exact match. If rangelookup is -1, act like 1 but the bracket is match>=value. ',
s_fdef_MAX: 'Returns the maximum of the numeric values. ',
s_fdef_MID:
'Returns the specified number of characters from the text value starting from the specified position. ',
s_fdef_MIN: 'Returns the minimum of the numeric values. ',
s_fdef_MINUTE: 'Returns the minute portion of a time or date/time value. ',
s_fdef_MOD: 'Returns the remainder of the first value divided by the second. ',
s_fdef_MONTH: 'Returns the month part of a date value. ',
s_fdef_N: 'Returns the value if it is a numeric value otherwise an error. ',
s_fdef_NA: 'Returns the #N/A error value which propagates through most operations. ',
s_fdef_NOT: 'Returns FALSE if value is true, and TRUE if it is false. ',
s_fdef_NOW: 'Returns the current date/time. ',
s_fdef_NPER:
'Returns the number of periods at which payments invested each period at the given rate with optional future value (default 0) and payment type (default 0 = at end of period, 1 = beginning of period) has the given present value. ',
s_fdef_NPV:
'Returns the net present value of cash flows (which may be individual values and/or ranges) at the given rate. The flows are positive if income, negative if paid out, and are assumed at the end of each period. ',
s_fdef_ODD: 'Rounds the value up in magnitude to the nearest odd integer. ',
s_fdef_OR: 'True if any argument is true ',
s_fdef_PI: 'The value 3.1415926... ',
s_fdef_PMT:
'Returns the amount of each payment that must be invested at the given rate for the specified number of periods to have the specified present value, with optional future value (default 0) and payment type (default 0 = at end of period, 1 = beginning of period). ',
s_fdef_POWER: 'Returns the first value raised to the second value power. ',
s_fdef_PRODUCT: 'Returns the result of multiplying the numeric values. ',
s_fdef_PROPER:
'Returns the text value with the first letter of each word converted to uppercase and the others to lowercase. ',
s_fdef_PV:
'Returns the present value of the given number of payments each invested at the given rate, with optional future value (default 0) and payment type (default 0 = at end of period, 1 = beginning of period). ',
s_fdef_RADIANS: 'Converts value in degrees into radians. ',
s_fdef_RATE:
'Returns the rate at which the given number of payments each invested at the given rate has the specified present value, with optional future value (default 0) and payment type (default 0 = at end of period, 1 = beginning of period). Uses an iterative process that will return #NUM! error if it does not converge. There may be more than one possible solution. Providing the optional guess value may help in certain situations where it does not converge or finds an inappropriate solution (the default guess is 10%). ',
s_fdef_REPLACE:
'Returns text1 with the specified number of characters starting from the specified position replaced by text2. ',
s_fdef_REPT: 'Returns the text repeated the specified number of times. ',
s_fdef_RIGHT:
'Returns the specified number of characters from the text value starting from the end. If count is omitted, 1 is assumed. ',
s_fdef_ROUND:
'Rounds the value to the specified number of decimal places. If precision is negative, then round to powers of 10. The default precision is 0 (round to integer). ',
s_fdef_ROWS: 'Returns the number of rows in the range. ',
s_fdef_SECOND:
'Returns the second portion of a time or date/time value (truncated to an integer). ',
s_fdef_SIN: 'Trigonometric sine function (value is in radians) ',
s_fdef_SLN:
'Returns the amount of depreciation at each period of time using the straight-line method. ',
s_fdef_SQRT: 'Square root of the value ',
s_fdef_STDEV: 'Returns the sample standard deviation of the numeric values. ',
s_fdef_STDEVP: 'Returns the standard deviation of the numeric values. ',
s_fdef_SUBSTITUTE:
'Returns text1 with the all occurrences of oldtext replaced by newtext. If "occurrence" is present, then only that occurrence is replaced. ',
s_fdef_SUM:
'Adds the numeric values. The values to the sum function may be ranges in the form similar to A1:B5. ',
s_fdef_SUMIF:
'Sums the numeric values of cells in the range that meet the criteria. The criteria may be a value ("x", 15, 1+3) or a test (>25). If range2 is present, then range1 is tested and the corresponding range2 value is summed. ',
s_fdef_SUMIFS:
'Sums the numeric values of cells in the sum_range that meet the multiple criteria. The criteria may be a value ("x", 15, 1+3) or a test (>25). ',
s_fdef_SYD: "Depreciation by Sum of Year's Digits method. ",
s_fdef_T: 'Returns the text value or else a null string. ',
s_fdef_TAN: 'Trigonometric tangent function (value is in radians) ',
s_fdef_TIME: 'Returns the time value given the specified hour, minute, and second. ',
s_fdef_TODAY:
'Returns the current date (an integer). Note: In this program, day "1" is December 31, 1899 and the year 1900 is not a leap year. Some programs use January 1, 1900, as day "1" and treat 1900 as a leap year. In both cases, though, dates on or after March 1, 1900, are the same. ',
s_fdef_TRIM: 'Returns the text value with leading, trailing, and repeated spaces removed. ',
s_fdef_TRUE: 'Returns the logical value "true". ',
s_fdef_TRUNC:
'Truncates the value to the specified number of decimal places. If precision is negative, truncate to powers of 10. ',
s_fdef_UPPER: 'Returns the text value with all lowercase characters converted to uppercase. ',
s_fdef_VALUE:
'Converts the specified text value into a numeric value. Various forms that look like numbers (including digits followed by %, forms that look like dates, etc.) are handled. This may not handle all of the forms accepted by other spreadsheets and may be locale dependent. ',
s_fdef_VAR: 'Returns the sample variance of the numeric values. ',
s_fdef_VARP: 'Returns the variance of the numeric values. ',
s_fdef_VLOOKUP:
'Look for the matching value for the given value in the range and return the corresponding value in the cell specified by the column offset. If rangelookup is 1 (the default) and not 0, match if within numeric brackets (match>=value) instead of exact match. ',
s_fdef_WEEKDAY:
'Returns the day of week specified by the date value. If type is 1 (the default), Sunday is day and Saturday is day 7. If type is 2, Monday is day 1 and Sunday is day 7. If type is 3, Monday is day 0 and Sunday is day 6. ',
s_fdef_YEAR: 'Returns the year part of a date value. ',
s_fdef_SUMPRODUCT:
'Sums the pairwise products of 2 or more ranges. The ranges must be of equal length.',
s_fdef_CEILING:
'Rounds the given number up to the nearest integer or multiple of significance. Significance is the value to whose multiple of ten the value is to be rounded up (.01, .1, 1, 10, etc.)',
s_fdef_FLOOR:
'Rounds the given number down to the nearest multiple of significance. Significance is the value to whose multiple of ten the number is to be rounded down (.01, .1, 1, 10, etc.)',
s_farg_v: 'value',
s_farg_vn: 'value1, value2, ...',
s_farg_xy: 'valueX, valueY',
s_farg_choose: 'index, value1, value2, ...',
s_farg_range: 'range',
s_farg_rangec: 'range, criteria',
s_farg_date: 'year, month, day',
s_farg_dfunc: 'databaserange, fieldname, criteriarange',
s_farg_ddb: 'cost, salvage, lifetime, period, [factor]',
s_farg_find: 'string1, string2, [start]',
s_farg_fv: 'rate, n, payment, [pv, [paytype]]',
s_farg_hlookup: 'value, range, row, [rangelookup]',
s_farg_iffunc: 'logical-expression, true-value, [false-value]',
s_farg_index: 'range, rownum, colnum',
s_farg_irr: 'range, [guess]',
s_farg_tc: 'text, count',
s_farg_log: 'value, base',
s_farg_match: 'value, range, [rangelookup]',
s_farg_mid: 'text, start, length',
s_farg_nper: 'rate, payment, pv, [fv, [paytype]]',
s_farg_npv: 'rate, value1, value2, ...',
s_farg_pmt: 'rate, n, pv, [fv, [paytype]]',
s_farg_pv: 'rate, n, payment, [fv, [paytype]]',
s_farg_rate: 'n, payment, pv, [fv, [paytype, [guess]]]',
s_farg_replace: 'text1, start, length, text2',
s_farg_vp: 'value, [precision]',
s_farg_valpre: 'value, precision',
s_farg_csl: 'cost, salvage, lifetime',
s_farg_cslp: 'cost, salvage, lifetime, period',
s_farg_subs: 'text1, oldtext, newtext, [occurrence]',
s_farg_sumif: 'range1, criteria, [range2]',
s_farg_hms: 'hour, minute, second',
s_farg_txt: 'text',
s_farg_vlookup: 'value, range, col, [rangelookup]',
s_farg_weekday: 'date, [type]',
s_farg_dt: 'date',
s_farg_rangen: 'range1, range2, ...',
s_farg_vsig: 'value, [significance]',
function_classlist: [
'all',
'stat',
'lookup',
'datetime',
'financial',
'test',
'math',
'text',
'gui',
'action',
],
s_fclass_all: 'All',
s_fclass_stat: 'Statistics',
s_fclass_lookup: 'Lookup',
s_fclass_datetime: 'Date & Time',
s_fclass_financial: 'Financial',
s_fclass_test: 'Test',
s_fclass_math: 'Math',
s_fclass_text: 'Text',
s_fclass_action: 'Email & Copy',
s_fclass_gui: 'Button & Input',
lastone: null,
};
ConstantsRoot.ConstantsDefaultClasses = {
defaultComment: '',
defaultCommentNoGrid: '',
defaultHighlightTypeCursor: '',
defaultHighlightTypeRange: '',
defaultColname: '',
defaultSelectedColname: '',
defaultRowname: '',
defaultSelectedRowname: '',
defaultUpperLeft: '',
defaultSkippedCell: '',
defaultPaneDivider: '',
cteGriddiv: '',
defaultInputEcho: {
classname: '',
style: 'filter:alpha(opacity=90);opacity:.9;',
},
TCmain: '',
TCendcap: '',
TCpaneslider: '',
TClessbutton: '',
TCmorebutton: '',
TCscrollarea: '',
TCthumb: '',
TCPStrackingline: '',
TCTDFSthumbstatus: '',
TDpopupElement: '',
};
ConstantsRoot.ConstantsSetClasses = function (prefix) {
var defaults = SocialCalc.ConstantsDefaultClasses;
var scc = SocialCalc.Constants;
var item;
prefix = prefix || '';
for (item in defaults) {
if (typeof defaults[item] == 'string') {
scc[item + 'Class'] = prefix + (defaults[item] || item);
if (scc[item + 'Style'] !== undefined) {
scc[item + 'Style'] = '';
}
} else if (typeof defaults[item] == 'object') {
scc[item + 'Class'] = prefix + (defaults[item].classname || item);
scc[item + 'Style'] = defaults[item].style;
}
}
};
ConstantsRoot.ConstantsSetImagePrefix = function (imagePrefix) {
var scc = SocialCalc.Constants;
var oldPrefix = scc.defaultImagePrefix;
var oldHyphen = oldPrefix.endsWith('_') ? oldPrefix.slice(0, -1) + '-' : oldPrefix;
var newHyphen = imagePrefix.endsWith('_') ? imagePrefix.slice(0, -1) + '-' : imagePrefix;
for (var item in scc) {
if (typeof scc[item] == 'string') {
var s = scc[item];
if (oldPrefix) {
s = s.split(oldPrefix).join(imagePrefix);
}
if (oldHyphen && oldHyphen !== oldPrefix) {
s = s.split(oldHyphen).join(newHyphen);
}
scc[item] = s;
}
}
scc.defaultImagePrefix = imagePrefix;
};
// In-place TypeScript conversion of socialcalc-3.js (SocialCalc global script).
// Ambient API types live in socialcalc-3.d.ts (referenced by dist/SocialCalc.d.ts).
// Vite+ strips types with Oxc before UMD concat — no runtime tax.
// Typechecked core after removing @ts-nocheck.
// The main SocialCalc code module of the SocialCalc package
//
/*
// (c) Copyright 2010 Socialtext, Inc.
// All Rights Reserved.
//
// The contents of this file are subject to the Artistic License 2.0; you may not
// use this file except in compliance with the License. You may obtain a copy of
// the License at http://socialcalc.org/licenses/al-20/.
//
// Some of the other files in the SocialCalc package are licensed under
// different licenses. Please note the licenses of the modules you use.
//
// Code History:
//
// Initially coded by Dan Bricklin of Software Garden, Inc., for Socialtext, Inc.
// Based in part on the SocialCalc 1.1.0 code written in Perl.
// The SocialCalc 1.1.0 code was:
// Portions (c) Copyright 2005, 2006, 2007 Software Garden, Inc.
// All Rights Reserved.
// Portions (c) Copyright 2007 Socialtext, Inc.
// All Rights Reserved.
// The Perl SocialCalc started as modifications to the wikiCalc(R) program, version 1.0.
// wikiCalc 1.0 was written by Software Garden, Inc.
// Unless otherwise specified, referring to "SocialCalc" in comments refers to this
// JavaScript version of the code, not the SocialCalc Perl code.
//
*/
// Mutable progressive-init bridges for ambient nested namespaces.
/*
**** Overview ****
This is the beginning of a library of routines for displaying and editing spreadsheet
data in a browser. The HTML that includes this does not need to have anything
specific to the spreadsheet or editor already present -- everything is dynamically
added to the DOM by this code, including the rendered sheet and any editing controls.
The library has a few parts. This is the main SocialCalc code module.
Other parts are the Table Editor module, the Formula module, and the Format Number module.
Note: The Table Editor module is licensed under a different license than this module.
The class/object style is derived from O'Reilly's JavaScript by Flanagan, 5th Edition,
section 9.3, page 157.
All of the data, object definitions, functions, etc., are stored as properties of the SocialCalc
object so as not to clutter up the global variables nor conflict with other names.
A design goal (not tested yet for success) is to make it possible to have more than one
spreadsheet active on a page, perhaps even open for editing. It is assumed, though, that
there is only one mouse and one keyboard (a good assumption on most PCs today but not in the
new "touch and surface world" Apple and Microsoft are working towards).
The testing has been on Windows Firefox (2 and 3),
Internet Explorer (6 and 7), Opera (9.23 and mainly later), Mac Safari (3.1), and Mac Firefox (2.0.0.6).
There are small issues with Firefox before 2.0 (cosmetic with drag handles) and larger ones
with Opera before 9.5 (the Delete key isn't recognized in some cases -- the 9.5 version was still
in beta and this bug affects other products like GMail, I believe).
The data is stored in a SocialCalc.Sheet object. The data is organized in a form similar to that
used by SocialCalc 1.1.0. There is a function for converting a normal SocialCalc spreadsheet
save data string (the spreadsheet part of a SocialCalc data file) into this internal form.
The SocialCalc.RenderContext class provides methods for rendering a table into the DOM representing
part of the spreadsheet. It is assumed that the spreadsheet could possibly be very large
and that rendering the whole thing at once could be too time consuming. It is also set up so
that it might be possible to have some of the sheet data only be loaded on demand (such as by Ajax).
The rendering can render cells to the right and below the already active area of the spreadsheet
so that you can scroll to that "clean" area without explicitly doing "add row/column". The class also
does simple operations such as "scrolling" within that table. The table may optionally include
row and column headers and may be split into panes. Most of the code assumes any number of panes,
but only the rightmost pane has scrolling code. In normal operation there would be one or two
panes horizontally and vertically. The panes may start on any row/column, though a given row/column
should only appear in one pane at a time (not all code enforces this, yet).
The RenderContext is designed to be rendered as part of a SocialCalc.TableEditor. The TableEditor
includes the spreadsheet grid as well as scrollbars, pane sliders, and (eventually) editing controls.
The layout is dynamic and may be recomputed on the fly, such as in response to resizing the browser
window.
The scrollbars and pane sliders are created using SocialCalc.TableControl objects. These in turn
make use of Dragging, ToolTip, Button, and MouseWheel functions.
The keyboard input is handled by keyboard code.
There are also some helper routines.
More comments yet to come...
*/
// SocialCalc is always defined by socialcalcconstants.js (which concatenates
// before this file in the UMD bundle). Redundant `if (!SocialCalc)` guard
// removed.
const SC = SocialCalc;
const defaultSecurityPolicy = {
sanitizeHtml: null,
allowedUrlSchemes: ['http:', 'https:', 'mailto:'],
allowedDataMimeTypes: [],
};
SC.Callbacks = {
expand_wiki: null,
expand_markup: function (displayvalue, sheetobj, linkstyle) {
return SocialCalc.default_expand_markup(displayvalue, sheetobj, linkstyle);
},
MakePageLink: null,
NormalizeSheetName: null,
untrustedContent: false,
securityPolicy: defaultSecurityPolicy,
};
SC.Cell = function (coord) {
this.coord = coord;
this.datavalue = '';
this.datatype = null;
this.formula = '';
this.valuetype = 'b';
this.readonly = false;
};
SC.CellProperties = {
coord: 1,
datavalue: 1,
datatype: 1,
formula: 1,
valuetype: 1,
errors: 1,
comment: 1,
readonly: 1,
bt: 2,
br: 2,
bb: 2,
bl: 2,
layout: 2,
font: 2,
color: 2,
bgcolor: 2,
cellformat: 2,
nontextvalueformat: 2,
textvalueformat: 2,
colspan: 2,
rowspan: 2,
cssc: 2,
csss: 2,
mod: 2,
displaystring: 3,
parseinfo: 3,
hcolspan: 3,
hrowspan: 3,
};
SC.CellPropertiesTable = {
bt: 'borderstyle',
br: 'borderstyle',
bb: 'borderstyle',
bl: 'borderstyle',
layout: 'layout',
font: 'font',
color: 'color',
bgcolor: 'color',
cellformat: 'cellformat',
nontextvalueformat: 'valueformat',
textvalueformat: 'valueformat',
};
SC.Sheet = function () {
SocialCalc.ResetSheet(this);
this.statuscallback = null;
this.statuscall