@odoo/o-spreadsheet 16.4.3 → 16.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24069,8 +24069,10 @@ class Composer extends owl.Component {
24069
24069
  }
24070
24070
  onKeyup(ev) {
24071
24071
  if (this.contentHelper.el === document.activeElement) {
24072
- const isSelectingForComposer = this.env.model.getters.isSelectingForComposer();
24073
- if (isSelectingForComposer && ev.key?.startsWith("Arrow")) {
24072
+ if (this.autoCompleteState.showProvider && ["ArrowUp", "ArrowDown"].includes(ev.key)) {
24073
+ return;
24074
+ }
24075
+ if (this.env.model.getters.isSelectingForComposer() && ev.key?.startsWith("Arrow")) {
24074
24076
  return;
24075
24077
  }
24076
24078
  const { start: oldStart, end: oldEnd } = this.env.model.getters.getComposerSelection();
@@ -48737,6 +48739,9 @@ function numberRef(reference) {
48737
48739
 
48738
48740
  function addFormula(cell) {
48739
48741
  const formula = cell.content;
48742
+ if (!formula) {
48743
+ return { attrs: [], node: escapeXml `` };
48744
+ }
48740
48745
  const attrs = [];
48741
48746
  let node = escapeXml ``;
48742
48747
  let cycle = escapeXml ``;
@@ -49440,7 +49445,14 @@ function addCellWiseConditionalFormatting(dxfs // cell-wise CF
49440
49445
  `;
49441
49446
  }
49442
49447
 
49443
- const TABLE_DEFAULT_STYLE = escapeXml /*xml*/ `<tableStyleInfo name="TableStyleLight8" showFirstColumn="0" showLastColumn="0" showRowStripes="0" showColumnStripes="0"/>`;
49448
+ const TABLE_DEFAULT_ATTRS = [
49449
+ ["name", "TableStyleLight8"],
49450
+ ["showFirstColumn", "0"],
49451
+ ["showLastColumn", "0"],
49452
+ ["showRowStripes", "0"],
49453
+ ["showColumnStripes", "0"],
49454
+ ];
49455
+ const TABLE_DEFAULT_STYLE = escapeXml /*xml*/ `<tableStyleInfo ${formatAttributes(TABLE_DEFAULT_ATTRS)}/>`;
49444
49456
  function createTable(table, tableId, sheetData) {
49445
49457
  const tableAttributes = [
49446
49458
  ["id", tableId],
@@ -50546,6 +50558,6 @@ exports.setTranslationMethod = setTranslationMethod;
50546
50558
  exports.tokenize = tokenize;
50547
50559
 
50548
50560
 
50549
- __info__.version = '16.4.3';
50550
- __info__.date = '2023-08-09T09:08:41.454Z';
50551
- __info__.hash = '1dbd302';
50561
+ __info__.version = '16.4.4';
50562
+ __info__.date = '2023-08-17T11:08:07.524Z';
50563
+ __info__.hash = 'bdb3a4c';
@@ -24065,8 +24065,10 @@ class Composer extends Component {
24065
24065
  }
24066
24066
  onKeyup(ev) {
24067
24067
  if (this.contentHelper.el === document.activeElement) {
24068
- const isSelectingForComposer = this.env.model.getters.isSelectingForComposer();
24069
- if (isSelectingForComposer && ev.key?.startsWith("Arrow")) {
24068
+ if (this.autoCompleteState.showProvider && ["ArrowUp", "ArrowDown"].includes(ev.key)) {
24069
+ return;
24070
+ }
24071
+ if (this.env.model.getters.isSelectingForComposer() && ev.key?.startsWith("Arrow")) {
24070
24072
  return;
24071
24073
  }
24072
24074
  const { start: oldStart, end: oldEnd } = this.env.model.getters.getComposerSelection();
@@ -48733,6 +48735,9 @@ function numberRef(reference) {
48733
48735
 
48734
48736
  function addFormula(cell) {
48735
48737
  const formula = cell.content;
48738
+ if (!formula) {
48739
+ return { attrs: [], node: escapeXml `` };
48740
+ }
48736
48741
  const attrs = [];
48737
48742
  let node = escapeXml ``;
48738
48743
  let cycle = escapeXml ``;
@@ -49436,7 +49441,14 @@ function addCellWiseConditionalFormatting(dxfs // cell-wise CF
49436
49441
  `;
49437
49442
  }
49438
49443
 
49439
- const TABLE_DEFAULT_STYLE = escapeXml /*xml*/ `<tableStyleInfo name="TableStyleLight8" showFirstColumn="0" showLastColumn="0" showRowStripes="0" showColumnStripes="0"/>`;
49444
+ const TABLE_DEFAULT_ATTRS = [
49445
+ ["name", "TableStyleLight8"],
49446
+ ["showFirstColumn", "0"],
49447
+ ["showLastColumn", "0"],
49448
+ ["showRowStripes", "0"],
49449
+ ["showColumnStripes", "0"],
49450
+ ];
49451
+ const TABLE_DEFAULT_STYLE = escapeXml /*xml*/ `<tableStyleInfo ${formatAttributes(TABLE_DEFAULT_ATTRS)}/>`;
49440
49452
  function createTable(table, tableId, sheetData) {
49441
49453
  const tableAttributes = [
49442
49454
  ["id", tableId],
@@ -50510,6 +50522,6 @@ const constants = {
50510
50522
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
50511
50523
 
50512
50524
 
50513
- __info__.version = '16.4.3';
50514
- __info__.date = '2023-08-09T09:08:41.454Z';
50515
- __info__.hash = '1dbd302';
50525
+ __info__.version = '16.4.4';
50526
+ __info__.date = '2023-08-17T11:08:07.524Z';
50527
+ __info__.hash = 'bdb3a4c';
@@ -24066,8 +24066,10 @@
24066
24066
  }
24067
24067
  onKeyup(ev) {
24068
24068
  if (this.contentHelper.el === document.activeElement) {
24069
- const isSelectingForComposer = this.env.model.getters.isSelectingForComposer();
24070
- if (isSelectingForComposer && ev.key?.startsWith("Arrow")) {
24069
+ if (this.autoCompleteState.showProvider && ["ArrowUp", "ArrowDown"].includes(ev.key)) {
24070
+ return;
24071
+ }
24072
+ if (this.env.model.getters.isSelectingForComposer() && ev.key?.startsWith("Arrow")) {
24071
24073
  return;
24072
24074
  }
24073
24075
  const { start: oldStart, end: oldEnd } = this.env.model.getters.getComposerSelection();
@@ -48734,6 +48736,9 @@
48734
48736
 
48735
48737
  function addFormula(cell) {
48736
48738
  const formula = cell.content;
48739
+ if (!formula) {
48740
+ return { attrs: [], node: escapeXml `` };
48741
+ }
48737
48742
  const attrs = [];
48738
48743
  let node = escapeXml ``;
48739
48744
  let cycle = escapeXml ``;
@@ -49437,7 +49442,14 @@
49437
49442
  `;
49438
49443
  }
49439
49444
 
49440
- const TABLE_DEFAULT_STYLE = escapeXml /*xml*/ `<tableStyleInfo name="TableStyleLight8" showFirstColumn="0" showLastColumn="0" showRowStripes="0" showColumnStripes="0"/>`;
49445
+ const TABLE_DEFAULT_ATTRS = [
49446
+ ["name", "TableStyleLight8"],
49447
+ ["showFirstColumn", "0"],
49448
+ ["showLastColumn", "0"],
49449
+ ["showRowStripes", "0"],
49450
+ ["showColumnStripes", "0"],
49451
+ ];
49452
+ const TABLE_DEFAULT_STYLE = escapeXml /*xml*/ `<tableStyleInfo ${formatAttributes(TABLE_DEFAULT_ATTRS)}/>`;
49441
49453
  function createTable(table, tableId, sheetData) {
49442
49454
  const tableAttributes = [
49443
49455
  ["id", tableId],
@@ -50545,9 +50557,9 @@
50545
50557
  Object.defineProperty(exports, '__esModule', { value: true });
50546
50558
 
50547
50559
 
50548
- __info__.version = '16.4.3';
50549
- __info__.date = '2023-08-09T09:08:41.454Z';
50550
- __info__.hash = '1dbd302';
50560
+ __info__.version = '16.4.4';
50561
+ __info__.date = '2023-08-17T11:08:07.524Z';
50562
+ __info__.hash = 'bdb3a4c';
50551
50563
 
50552
50564
 
50553
50565
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -1200,7 +1200,7 @@
1200
1200
  pointer-events: none;
1201
1201
  }
1202
1202
  }
1203
- `;class Pv extends t.Component{static template="o-spreadsheet-Composer";static components={TextValueProvider:Tv,FunctionDescriptionProvider:Nv};static defaultProps={inputStyle:""};composerRef=t.useRef("o_composer");contentHelper=new Av(this.composerRef.el);composerState=t.useState({positionStart:0,positionEnd:0});autoCompleteState=t.useState({showProvider:!1,values:[],selectedIndex:0});functionDescriptionState=t.useState({showDescription:!1,functionName:"",functionDescription:{},argToFocus:0});compositionActive=!1;get assistantStyle(){if(this.props.delimitation&&this.props.rect){const{x:e,y:t,height:o}=this.props.rect;let i={};return t>this.props.delimitation.height-(t+o)&&(i.top="-3px",i.transform="translate(0, -100%)"),e+300>this.props.delimitation.width&&(i.right="0px"),i.width="300px",qi(i)}return qi({width:"300px"})}shouldProcessInputEvents=!1;tokens=[];keyMapping={ArrowUp:this.processArrowKeys,ArrowDown:this.processArrowKeys,ArrowLeft:this.processArrowKeys,ArrowRight:this.processArrowKeys,Enter:this.processEnterKey,Escape:this.processEscapeKey,F2:()=>console.warn("Not implemented"),F4:this.processF4Key,Tab:e=>this.processTabKey(e)," ":e=>this.processSpaceKey(e)};keyCodeMapping={NumpadDecimal:this.processNumpadDecimal};setup(){t.onMounted((()=>{const e=this.composerRef.el;this.contentHelper.updateEl(e)})),t.onWillUnmount((()=>{this.props.onComposerUnmounted?.()})),t.useEffect((()=>{this.processContent()}))}processArrowKeys(e){if(this.env.model.getters.isSelectingForComposer())return this.functionDescriptionState.showDescription=!1,e.preventDefault(),e.stopPropagation(),void Wb(e,this.env.model.selection);const t=this.env.model.getters.getCurrentContent();"cellFocus"!==this.props.focus||this.autoCompleteState.showProvider||t.startsWith("=")?(e.stopPropagation(),this.handleArrowKeysForAutocomplete(e)):this.env.model.dispatch("STOP_EDITION")}handleArrowKeysForAutocomplete(e){["ArrowUp","ArrowDown"].includes(e.key)&&this.autoCompleteState.showProvider&&(e.preventDefault(),"ArrowUp"===e.key?(this.autoCompleteState.selectedIndex--,this.autoCompleteState.selectedIndex<0&&(this.autoCompleteState.selectedIndex=this.autoCompleteState.values.length-1)):this.autoCompleteState.selectedIndex=(this.autoCompleteState.selectedIndex+1)%this.autoCompleteState.values.length)}processTabKey(e){if(e.preventDefault(),e.stopPropagation(),this.autoCompleteState.showProvider){const e=this.autoCompleteState.values[this.autoCompleteState.selectedIndex]?.text;if(e)return void this.autoComplete(e)}const t=e.shiftKey?"left":"right";this.env.model.dispatch("STOP_EDITION"),this.env.model.selection.moveAnchorCell(t,1)}processSpaceKey(e){e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),this.showAutocomplete(""),this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION"))}processEnterKey(e){if(e.preventDefault(),e.stopPropagation(),e.altKey||e.ctrlKey)return void this.composerRef.el?.dispatchEvent(new InputEvent("input",{inputType:"insertParagraph",bubbles:!0,isComposing:!1}));if(this.autoCompleteState.showProvider){const e=this.autoCompleteState.values[this.autoCompleteState.selectedIndex]?.text;if(e)return void this.autoComplete(e)}this.env.model.dispatch("STOP_EDITION");const t=e.shiftKey?"up":"down";this.env.model.selection.moveAnchorCell(t,1)}processEscapeKey(){this.env.model.dispatch("STOP_EDITION",{cancel:!0})}processF4Key(){this.env.model.dispatch("CYCLE_EDITION_REFERENCES"),this.processContent()}processNumpadDecimal(e){e.stopPropagation(),e.preventDefault();const t=this.env.model.getters.getLocale(),o=this.contentHelper.getCurrentSelection(),i=this.env.model.getters.getCurrentContent(),s=i.slice(0,o.start)+t.decimalSeparator+i.slice(o.end);this.env.model.dispatch("SET_CURRENT_CONTENT",{content:s,selection:{start:o.start+1,end:o.start+1}}),this.processContent()}onCompositionStart(){this.compositionActive=!0}onCompositionEnd(){this.compositionActive=!1}onKeydown(e){let t=this.keyMapping[e.key]||this.keyCodeMapping[e.code];t?t.call(this,e):e.stopPropagation()}onInput(e){if("inactive"===this.props.focus||!this.shouldProcessInputEvents)return;let t=this.contentHelper.getText(),o=this.contentHelper.getCurrentSelection();if("insertParagraph"===e.inputType){const e=Math.min(o.start,o.end),i=Math.max(o.start,o.end);t=t.slice(0,e)+fe+t.slice(i),o={start:e+1,end:e+1}}this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION"),this.env.model.dispatch("SET_CURRENT_CONTENT",{content:t,selection:o}),this.processTokenAtCursor()}onKeyup(e){if(this.contentHelper.el===document.activeElement){if(this.env.model.getters.isSelectingForComposer()&&e.key?.startsWith("Arrow"))return;const{start:t,end:o}=this.env.model.getters.getComposerSelection(),{start:i,end:s}=this.contentHelper.getCurrentSelection();i===t&&s===o||this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:i,end:s}),this.processTokenAtCursor()}}showAutocomplete(e){const t=e.toUpperCase();if(!this.env.model.getters.getCurrentContent().startsWith("=")||"TRUE"===t||"FALSE"===t)return;this.autoCompleteState.showProvider=!0;let o=Object.entries(cu.content).filter((([e,{hidden:t}])=>!t)).map((([e,{description:t}])=>({text:e,description:t})));o=e?Ti(e,o,(e=>e.text)):o.sort(((e,t)=>e.text.localeCompare(t.text))),this.autoCompleteState.values=o.slice(0,10),this.autoCompleteState.selectedIndex=0}onMousedown(e){e.button>0||this.contentHelper.removeSelection()}onClick(){if(this.env.model.getters.isReadonly())return;const e=this.contentHelper.getCurrentSelection();this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION"),"inactive"===this.props.focus&&this.props.onComposerContentFocused(e),this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",e),this.processTokenAtCursor()}onDblClick(){if(this.env.model.getters.isReadonly())return;const e=this.env.model.getters.getCurrentContent();if(e.startsWith("=")){const t=this.env.model.getters.getCurrentTokens(),o=this.contentHelper.getCurrentSelection();if(o.start===o.end)return;const i=e.substring(o.start,o.end),s=t.filter((e=>e.value.includes(i)&&e.start<=o.start&&e.end>=o.end))[0];"REFERENCE"===s.type&&this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:s.start,end:s.end})}}processContent(){if(this.compositionActive)return;this.shouldProcessInputEvents=!1,"inactive"!==this.props.focus&&this.contentHelper.el.focus();const e=this.getContentLines();if(this.contentHelper.setText(e),0!==e.length&&0!==e.length[0]){if("inactive"!==this.props.focus){const{start:e,end:t}=this.env.model.getters.getComposerSelection();this.contentHelper.selectRange(e,t)}this.contentHelper.scrollSelectionIntoView()}this.shouldProcessInputEvents=!0}getContentLines(){let e=this.env.model.getters.getCurrentContent();const t=e.startsWith("=");return""===e?[]:t&&"inactive"!==this.props.focus?this.splitHtmlContentIntoLines(this.getColoredTokens()):this.splitHtmlContentIntoLines([{value:e}])}getColoredTokens(){const e=this.env.model.getters.getCurrentTokens(),t=this.env.model.getters.getTokenAtCursor(),o=[],{end:i,start:s}=this.env.model.getters.getComposerSelection();for(const r of e){switch(r.type){case"OPERATOR":case"NUMBER":case"ARG_SEPARATOR":case"STRING":o.push({value:r.value,color:Lv[r.type]||"#000"});break;case"REFERENCE":const{xc:e,sheetName:i}=Xo(r.value);o.push({value:r.value,color:this.rangeColor(e,i)||"#000"});break;case"SYMBOL":const s=r.value.toUpperCase();"TRUE"===s||"FALSE"===s?o.push({value:r.value,color:Lv.NUMBER}):s in cu.content?o.push({value:r.value,color:Lv.FUNCTION}):o.push({value:r.value,color:"#000"});break;case"LEFT_PAREN":case"RIGHT_PAREN":t&&["LEFT_PAREN","RIGHT_PAREN"].includes(t.type)&&t.parenIndex&&t.parenIndex===r.parenIndex?o.push({value:r.value,color:Lv.MATCHING_PAREN}):o.push({value:r.value,color:Lv[r.type]||"#000"});break;default:o.push({value:r.value,color:"#000"})}this.env.model.getters.showSelectionIndicator()&&i===s&&i===r.end&&(o[o.length-1].class=_v)}return o}splitHtmlContentIntoLines(e){const t=[];let o=[];for(const i of e)if(i.value.includes(fe)){const e=i.value.split(fe),s=e.pop();for(const s of e)o.push({color:i.color,value:s}),t.push(o),o=[];o.push({...i,value:s})}else o.push(i);o.length&&t.push(o);const i=[];for(const e of t)e.every(this.isContentEmpty)?i.push([e[0]]):i.push(e.filter((e=>!this.isContentEmpty(e))));return i}isContentEmpty(e){return!(e.value||e.class)}rangeColor(e,t){if("inactive"===this.props.focus)return;const o=this.env.model.getters.getHighlights(),i=t?this.env.model.getters.getSheetIdByName(t):this.env.model.getters.getCurrentEditedCell().sheetId,s=o.find((t=>{if(t.sheetId!==i)return!1;let o=this.env.model.getters.getRangeFromSheetXC(i,e).zone;return o=1===wi(o)?this.env.model.getters.expandZone(i,o):o,ai(o,t.zone)}));return s&&s.color?s.color:void 0}processTokenAtCursor(){let e=this.env.model.getters.getCurrentContent();if(this.autoCompleteState.showProvider=!1,this.functionDescriptionState.showDescription=!1,e.startsWith("=")){const e=this.env.model.getters.getTokenAtCursor();if(!e)return;if("SYMBOL"===e.type)return void this.showAutocomplete(e.value);const t=e.functionContext,o=t?.parent.toUpperCase();if(t&&o&&o in Mv&&"UNKNOWN"!==e.type){const e=Mv[o],i=t.argPosition;this.functionDescriptionState.functionName=o,this.functionDescriptionState.functionDescription=e,this.functionDescriptionState.argToFocus=e.getArgToFocus(i+1)-1,this.functionDescriptionState.showDescription=!0}}}autoComplete(e){if(e){const t=this.env.model.getters.getTokenAtCursor();if(t){let o=t.end,i=t.end;["SYMBOL","FUNCTION"].includes(t.type)&&(o=t.start);const s=this.env.model.getters.getCurrentTokens();if(s.length){e+="(";const o=s.map((e=>e.start)).indexOf(t.start);if(o+1<s.length){"LEFT_PAREN"===s[o+1].type&&i++}}this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:o,end:i})}this.env.model.dispatch("REPLACE_COMPOSER_CURSOR_SELECTION",{text:e})}this.processTokenAtCursor()}}Pv.props={focus:{validate:e=>["inactive","cellFocus","contentFocus"].includes(e)},onComposerContentFocused:Function,inputStyle:{type:String,optional:!0},rect:{type:Object,optional:!0},delimitation:{type:Object,optional:!0},onComposerUnmounted:{type:Function,optional:!0}};const kv=3*.4*window.devicePixelRatio||1;Hi`
1203
+ `;class Pv extends t.Component{static template="o-spreadsheet-Composer";static components={TextValueProvider:Tv,FunctionDescriptionProvider:Nv};static defaultProps={inputStyle:""};composerRef=t.useRef("o_composer");contentHelper=new Av(this.composerRef.el);composerState=t.useState({positionStart:0,positionEnd:0});autoCompleteState=t.useState({showProvider:!1,values:[],selectedIndex:0});functionDescriptionState=t.useState({showDescription:!1,functionName:"",functionDescription:{},argToFocus:0});compositionActive=!1;get assistantStyle(){if(this.props.delimitation&&this.props.rect){const{x:e,y:t,height:o}=this.props.rect;let i={};return t>this.props.delimitation.height-(t+o)&&(i.top="-3px",i.transform="translate(0, -100%)"),e+300>this.props.delimitation.width&&(i.right="0px"),i.width="300px",qi(i)}return qi({width:"300px"})}shouldProcessInputEvents=!1;tokens=[];keyMapping={ArrowUp:this.processArrowKeys,ArrowDown:this.processArrowKeys,ArrowLeft:this.processArrowKeys,ArrowRight:this.processArrowKeys,Enter:this.processEnterKey,Escape:this.processEscapeKey,F2:()=>console.warn("Not implemented"),F4:this.processF4Key,Tab:e=>this.processTabKey(e)," ":e=>this.processSpaceKey(e)};keyCodeMapping={NumpadDecimal:this.processNumpadDecimal};setup(){t.onMounted((()=>{const e=this.composerRef.el;this.contentHelper.updateEl(e)})),t.onWillUnmount((()=>{this.props.onComposerUnmounted?.()})),t.useEffect((()=>{this.processContent()}))}processArrowKeys(e){if(this.env.model.getters.isSelectingForComposer())return this.functionDescriptionState.showDescription=!1,e.preventDefault(),e.stopPropagation(),void Wb(e,this.env.model.selection);const t=this.env.model.getters.getCurrentContent();"cellFocus"!==this.props.focus||this.autoCompleteState.showProvider||t.startsWith("=")?(e.stopPropagation(),this.handleArrowKeysForAutocomplete(e)):this.env.model.dispatch("STOP_EDITION")}handleArrowKeysForAutocomplete(e){["ArrowUp","ArrowDown"].includes(e.key)&&this.autoCompleteState.showProvider&&(e.preventDefault(),"ArrowUp"===e.key?(this.autoCompleteState.selectedIndex--,this.autoCompleteState.selectedIndex<0&&(this.autoCompleteState.selectedIndex=this.autoCompleteState.values.length-1)):this.autoCompleteState.selectedIndex=(this.autoCompleteState.selectedIndex+1)%this.autoCompleteState.values.length)}processTabKey(e){if(e.preventDefault(),e.stopPropagation(),this.autoCompleteState.showProvider){const e=this.autoCompleteState.values[this.autoCompleteState.selectedIndex]?.text;if(e)return void this.autoComplete(e)}const t=e.shiftKey?"left":"right";this.env.model.dispatch("STOP_EDITION"),this.env.model.selection.moveAnchorCell(t,1)}processSpaceKey(e){e.ctrlKey&&(e.preventDefault(),e.stopPropagation(),this.showAutocomplete(""),this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION"))}processEnterKey(e){if(e.preventDefault(),e.stopPropagation(),e.altKey||e.ctrlKey)return void this.composerRef.el?.dispatchEvent(new InputEvent("input",{inputType:"insertParagraph",bubbles:!0,isComposing:!1}));if(this.autoCompleteState.showProvider){const e=this.autoCompleteState.values[this.autoCompleteState.selectedIndex]?.text;if(e)return void this.autoComplete(e)}this.env.model.dispatch("STOP_EDITION");const t=e.shiftKey?"up":"down";this.env.model.selection.moveAnchorCell(t,1)}processEscapeKey(){this.env.model.dispatch("STOP_EDITION",{cancel:!0})}processF4Key(){this.env.model.dispatch("CYCLE_EDITION_REFERENCES"),this.processContent()}processNumpadDecimal(e){e.stopPropagation(),e.preventDefault();const t=this.env.model.getters.getLocale(),o=this.contentHelper.getCurrentSelection(),i=this.env.model.getters.getCurrentContent(),s=i.slice(0,o.start)+t.decimalSeparator+i.slice(o.end);this.env.model.dispatch("SET_CURRENT_CONTENT",{content:s,selection:{start:o.start+1,end:o.start+1}}),this.processContent()}onCompositionStart(){this.compositionActive=!0}onCompositionEnd(){this.compositionActive=!1}onKeydown(e){let t=this.keyMapping[e.key]||this.keyCodeMapping[e.code];t?t.call(this,e):e.stopPropagation()}onInput(e){if("inactive"===this.props.focus||!this.shouldProcessInputEvents)return;let t=this.contentHelper.getText(),o=this.contentHelper.getCurrentSelection();if("insertParagraph"===e.inputType){const e=Math.min(o.start,o.end),i=Math.max(o.start,o.end);t=t.slice(0,e)+fe+t.slice(i),o={start:e+1,end:e+1}}this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION"),this.env.model.dispatch("SET_CURRENT_CONTENT",{content:t,selection:o}),this.processTokenAtCursor()}onKeyup(e){if(this.contentHelper.el===document.activeElement){if(this.autoCompleteState.showProvider&&["ArrowUp","ArrowDown"].includes(e.key))return;if(this.env.model.getters.isSelectingForComposer()&&e.key?.startsWith("Arrow"))return;const{start:t,end:o}=this.env.model.getters.getComposerSelection(),{start:i,end:s}=this.contentHelper.getCurrentSelection();i===t&&s===o||this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:i,end:s}),this.processTokenAtCursor()}}showAutocomplete(e){const t=e.toUpperCase();if(!this.env.model.getters.getCurrentContent().startsWith("=")||"TRUE"===t||"FALSE"===t)return;this.autoCompleteState.showProvider=!0;let o=Object.entries(cu.content).filter((([e,{hidden:t}])=>!t)).map((([e,{description:t}])=>({text:e,description:t})));o=e?Ti(e,o,(e=>e.text)):o.sort(((e,t)=>e.text.localeCompare(t.text))),this.autoCompleteState.values=o.slice(0,10),this.autoCompleteState.selectedIndex=0}onMousedown(e){e.button>0||this.contentHelper.removeSelection()}onClick(){if(this.env.model.getters.isReadonly())return;const e=this.contentHelper.getCurrentSelection();this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION"),"inactive"===this.props.focus&&this.props.onComposerContentFocused(e),this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",e),this.processTokenAtCursor()}onDblClick(){if(this.env.model.getters.isReadonly())return;const e=this.env.model.getters.getCurrentContent();if(e.startsWith("=")){const t=this.env.model.getters.getCurrentTokens(),o=this.contentHelper.getCurrentSelection();if(o.start===o.end)return;const i=e.substring(o.start,o.end),s=t.filter((e=>e.value.includes(i)&&e.start<=o.start&&e.end>=o.end))[0];"REFERENCE"===s.type&&this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:s.start,end:s.end})}}processContent(){if(this.compositionActive)return;this.shouldProcessInputEvents=!1,"inactive"!==this.props.focus&&this.contentHelper.el.focus();const e=this.getContentLines();if(this.contentHelper.setText(e),0!==e.length&&0!==e.length[0]){if("inactive"!==this.props.focus){const{start:e,end:t}=this.env.model.getters.getComposerSelection();this.contentHelper.selectRange(e,t)}this.contentHelper.scrollSelectionIntoView()}this.shouldProcessInputEvents=!0}getContentLines(){let e=this.env.model.getters.getCurrentContent();const t=e.startsWith("=");return""===e?[]:t&&"inactive"!==this.props.focus?this.splitHtmlContentIntoLines(this.getColoredTokens()):this.splitHtmlContentIntoLines([{value:e}])}getColoredTokens(){const e=this.env.model.getters.getCurrentTokens(),t=this.env.model.getters.getTokenAtCursor(),o=[],{end:i,start:s}=this.env.model.getters.getComposerSelection();for(const r of e){switch(r.type){case"OPERATOR":case"NUMBER":case"ARG_SEPARATOR":case"STRING":o.push({value:r.value,color:Lv[r.type]||"#000"});break;case"REFERENCE":const{xc:e,sheetName:i}=Xo(r.value);o.push({value:r.value,color:this.rangeColor(e,i)||"#000"});break;case"SYMBOL":const s=r.value.toUpperCase();"TRUE"===s||"FALSE"===s?o.push({value:r.value,color:Lv.NUMBER}):s in cu.content?o.push({value:r.value,color:Lv.FUNCTION}):o.push({value:r.value,color:"#000"});break;case"LEFT_PAREN":case"RIGHT_PAREN":t&&["LEFT_PAREN","RIGHT_PAREN"].includes(t.type)&&t.parenIndex&&t.parenIndex===r.parenIndex?o.push({value:r.value,color:Lv.MATCHING_PAREN}):o.push({value:r.value,color:Lv[r.type]||"#000"});break;default:o.push({value:r.value,color:"#000"})}this.env.model.getters.showSelectionIndicator()&&i===s&&i===r.end&&(o[o.length-1].class=_v)}return o}splitHtmlContentIntoLines(e){const t=[];let o=[];for(const i of e)if(i.value.includes(fe)){const e=i.value.split(fe),s=e.pop();for(const s of e)o.push({color:i.color,value:s}),t.push(o),o=[];o.push({...i,value:s})}else o.push(i);o.length&&t.push(o);const i=[];for(const e of t)e.every(this.isContentEmpty)?i.push([e[0]]):i.push(e.filter((e=>!this.isContentEmpty(e))));return i}isContentEmpty(e){return!(e.value||e.class)}rangeColor(e,t){if("inactive"===this.props.focus)return;const o=this.env.model.getters.getHighlights(),i=t?this.env.model.getters.getSheetIdByName(t):this.env.model.getters.getCurrentEditedCell().sheetId,s=o.find((t=>{if(t.sheetId!==i)return!1;let o=this.env.model.getters.getRangeFromSheetXC(i,e).zone;return o=1===wi(o)?this.env.model.getters.expandZone(i,o):o,ai(o,t.zone)}));return s&&s.color?s.color:void 0}processTokenAtCursor(){let e=this.env.model.getters.getCurrentContent();if(this.autoCompleteState.showProvider=!1,this.functionDescriptionState.showDescription=!1,e.startsWith("=")){const e=this.env.model.getters.getTokenAtCursor();if(!e)return;if("SYMBOL"===e.type)return void this.showAutocomplete(e.value);const t=e.functionContext,o=t?.parent.toUpperCase();if(t&&o&&o in Mv&&"UNKNOWN"!==e.type){const e=Mv[o],i=t.argPosition;this.functionDescriptionState.functionName=o,this.functionDescriptionState.functionDescription=e,this.functionDescriptionState.argToFocus=e.getArgToFocus(i+1)-1,this.functionDescriptionState.showDescription=!0}}}autoComplete(e){if(e){const t=this.env.model.getters.getTokenAtCursor();if(t){let o=t.end,i=t.end;["SYMBOL","FUNCTION"].includes(t.type)&&(o=t.start);const s=this.env.model.getters.getCurrentTokens();if(s.length){e+="(";const o=s.map((e=>e.start)).indexOf(t.start);if(o+1<s.length){"LEFT_PAREN"===s[o+1].type&&i++}}this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:o,end:i})}this.env.model.dispatch("REPLACE_COMPOSER_CURSOR_SELECTION",{text:e})}this.processTokenAtCursor()}}Pv.props={focus:{validate:e=>["inactive","cellFocus","contentFocus"].includes(e)},onComposerContentFocused:Function,inputStyle:{type:String,optional:!0},rect:{type:Object,optional:!0},delimitation:{type:Object,optional:!0},onComposerUnmounted:{type:Function,optional:!0}};const kv=3*.4*window.devicePixelRatio||1;Hi`
1204
1204
  div.o-grid-composer {
1205
1205
  z-index: ${ge.GridComposer};
1206
1206
  box-sizing: border-box;
@@ -2236,12 +2236,12 @@
2236
2236
  <c:f>${e}</c:f>
2237
2237
  <c:numCache />
2238
2238
  </c:numRef>
2239
- `}function Wy(e){const t=[];let o=pE``,i=pE``;const s=qy(e.content);return e.value===a.CircularDependency&&(t.push(["t","str"]),i=pE`<v>${e.value}</v>`),o=pE`
2239
+ `}function Wy(e){const t=e.content;if(!t)return{attrs:[],node:pE``};const o=[];let i=pE``,s=pE``;const r=qy(t);return e.value===a.CircularDependency&&(o.push(["t","str"]),s=pE`<v>${e.value}</v>`),i=pE`
2240
2240
  <f>
2241
- ${s}
2241
+ ${r}
2242
2242
  </f>
2243
- ${i}
2244
- `,{attrs:t,node:o}}function Gy(e,t,o=!1){let i=e;const s=[],r=i.trim().toUpperCase();if(!o&&["TRUE","FALSE"].includes(r))i="TRUE"===r?"1":"0",s.push(["t","b"]);else if(o||!oo(i,Jt)){const{id:o}=_C(e,t);i=o.toString(),s.push(["t","s"])}return{attrs:s,node:pE`<v>${i}</v>`}}function qy(e){let t;"="===e[0]&&(e=e.slice(1));try{t=Uu(e)}catch(t){return e}return t=zu(t,"STRING",Zy),t=zu(t,"FUNCALL",(e=>e=function(e){const t=e.value.toUpperCase(),o=e.args,i=LS[t];if(i){const s=cu.content[t].args.filter((e=>!e.optional)),r=s.length-e.args.length;if(r)for(let t=e.args.length;t<s.length;t++){const e=i[t-r];o.push({type:e.type,value:e.value})}}return{...e,args:o}}(e=function(e){const t=e.value.toUpperCase();return{...e,value:PS.includes(t)?`_xlfn.${t}`:t}}(e={...e,value:e.value.toUpperCase()})))),t?Wu(t):e}function Zy(e){const t=e.value.replace(new RegExp('"',"g"),""),o=kt(t,Jt);if(o){let i=[];return(Mt.test(t)||_t.test(t))&&i.push("yyyy-mm-dd"),Lt.test(t)&&i.push("hh:mm:ss"),{...e,value:mo(o.value,{format:i.join(" "),locale:Jt})}}return{...e,value:e.value.replace(/\\"/g,'""')}}function jy(e,t){const o=[];for(const i of t)switch(i.rule.type){case"CellIsRule":o.push(Yy(i,i.rule,e));break;case"ColorScaleRule":o.push(Xy(i,i.rule));break;case"IconSetRule":o.push(Ky(i,i.rule));break;default:console.warn(`Conditional formatting ${i.rule.type} not implemented`)}return o}function Yy(e,t,o){const i=Qy(e),s=IC(t.operator);i.push(...function(e){const t=IC(e.operator);switch(e.operator){case"ContainsText":case"NotContains":case"BeginsWith":case"EndsWith":return[["type",t],["text",e.values[0]]];case"IsEmpty":case"IsNotEmpty":return[["type",t]];case"Equal":case"NotEqual":case"GreaterThan":case"GreaterThanOrEqual":case"LessThan":case"LessThanOrEqual":case"Between":case"NotBetween":return[["type","cellIs"]]}}(t),["operator",s]);const r=function(e,t){const o=e[0].split(":")[0],i=t.values;switch(t.operator){case"ContainsText":return[`NOT(ISERROR(SEARCH("${i[0]}",${o})))`];case"NotContains":return[`ISERROR(SEARCH("${i[0]}",${o}))`];case"BeginsWith":return[`LEFT(${o},LEN("${i[0]}"))="${i[0]}"`];case"EndsWith":return[`RIGHT(${o},LEN("${i[0]}"))="${i[0]}"`];case"IsEmpty":return[`LEN(TRIM(${o}))=0`];case"IsNotEmpty":return[`LEN(TRIM(${o}))>0`];case"Equal":case"NotEqual":case"GreaterThan":case"GreaterThanOrEqual":case"LessThan":case"LessThanOrEqual":return[i[0]];case"Between":case"NotBetween":return[i[0],i[1]]}}(e.ranges,t).map((e=>pE`<formula>${e}</formula>`)),n={font:{color:{rgb:t.style.textColor},bold:t.style.bold,italic:t.style.italic,strike:t.style.strikethrough,underline:t.style.underline}};t.style.fillColor&&(n.fill={fgColor:{rgb:t.style.fillColor}});const{id:a}=_C(n,o);return i.push(["dxfId",a]),pE`
2243
+ ${s}
2244
+ `,{attrs:o,node:i}}function Gy(e,t,o=!1){let i=e;const s=[],r=i.trim().toUpperCase();if(!o&&["TRUE","FALSE"].includes(r))i="TRUE"===r?"1":"0",s.push(["t","b"]);else if(o||!oo(i,Jt)){const{id:o}=_C(e,t);i=o.toString(),s.push(["t","s"])}return{attrs:s,node:pE`<v>${i}</v>`}}function qy(e){let t;"="===e[0]&&(e=e.slice(1));try{t=Uu(e)}catch(t){return e}return t=zu(t,"STRING",Zy),t=zu(t,"FUNCALL",(e=>e=function(e){const t=e.value.toUpperCase(),o=e.args,i=LS[t];if(i){const s=cu.content[t].args.filter((e=>!e.optional)),r=s.length-e.args.length;if(r)for(let t=e.args.length;t<s.length;t++){const e=i[t-r];o.push({type:e.type,value:e.value})}}return{...e,args:o}}(e=function(e){const t=e.value.toUpperCase();return{...e,value:PS.includes(t)?`_xlfn.${t}`:t}}(e={...e,value:e.value.toUpperCase()})))),t?Wu(t):e}function Zy(e){const t=e.value.replace(new RegExp('"',"g"),""),o=kt(t,Jt);if(o){let i=[];return(Mt.test(t)||_t.test(t))&&i.push("yyyy-mm-dd"),Lt.test(t)&&i.push("hh:mm:ss"),{...e,value:mo(o.value,{format:i.join(" "),locale:Jt})}}return{...e,value:e.value.replace(/\\"/g,'""')}}function jy(e,t){const o=[];for(const i of t)switch(i.rule.type){case"CellIsRule":o.push(Yy(i,i.rule,e));break;case"ColorScaleRule":o.push(Xy(i,i.rule));break;case"IconSetRule":o.push(Ky(i,i.rule));break;default:console.warn(`Conditional formatting ${i.rule.type} not implemented`)}return o}function Yy(e,t,o){const i=Qy(e),s=IC(t.operator);i.push(...function(e){const t=IC(e.operator);switch(e.operator){case"ContainsText":case"NotContains":case"BeginsWith":case"EndsWith":return[["type",t],["text",e.values[0]]];case"IsEmpty":case"IsNotEmpty":return[["type",t]];case"Equal":case"NotEqual":case"GreaterThan":case"GreaterThanOrEqual":case"LessThan":case"LessThanOrEqual":case"Between":case"NotBetween":return[["type","cellIs"]]}}(t),["operator",s]);const r=function(e,t){const o=e[0].split(":")[0],i=t.values;switch(t.operator){case"ContainsText":return[`NOT(ISERROR(SEARCH("${i[0]}",${o})))`];case"NotContains":return[`ISERROR(SEARCH("${i[0]}",${o}))`];case"BeginsWith":return[`LEFT(${o},LEN("${i[0]}"))="${i[0]}"`];case"EndsWith":return[`RIGHT(${o},LEN("${i[0]}"))="${i[0]}"`];case"IsEmpty":return[`LEN(TRIM(${o}))=0`];case"IsNotEmpty":return[`LEN(TRIM(${o}))>0`];case"Equal":case"NotEqual":case"GreaterThan":case"GreaterThanOrEqual":case"LessThan":case"LessThanOrEqual":return[i[0]];case"Between":case"NotBetween":return[i[0],i[1]]}}(e.ranges,t).map((e=>pE`<formula>${e}</formula>`)),n={font:{color:{rgb:t.style.textColor},bold:t.style.bold,italic:t.style.italic,strike:t.style.strikethrough,underline:t.style.underline}};t.style.fillColor&&(n.fill={fgColor:{rgb:t.style.fillColor}});const{id:a}=_C(n,o);return i.push(["dxfId",a]),pE`
2245
2245
  <conditionalFormatting sqref="${e.ranges.join(" ")}">
2246
2246
  <cfRule ${hE(i)}>
2247
2247
  ${gE(r)}
@@ -2348,7 +2348,7 @@
2348
2348
  </font>
2349
2349
  `}function ax(e){return e?hE([["style",e.style]]):pE``}function lx(e){return e?pE`
2350
2350
  <color ${hE([["rgb",Dg(e.color.rgb)]])}/>
2351
- `:pE``}const cx=pE`<tableStyleInfo name="TableStyleLight8" showFirstColumn="0" showLastColumn="0" showRowStripes="0" showColumnStripes="0"/>`;function hx(e,t,o){const i=pE`
2351
+ `:pE``}const cx=pE`<tableStyleInfo ${hE([["name","TableStyleLight8"],["showFirstColumn","0"],["showLastColumn","0"],["showRowStripes","0"],["showColumnStripes","0"]])}/>`;function hx(e,t,o){const i=pE`
2352
2352
  <table ${hE([["id",t],["name",`Table${t}`],["displayName",`Table${t}`],["ref",e.range],["xmlns",wS.table],["xmlns:xr",wS.revision],["xmlns:xr3",wS.revision3],["xmlns:mc",wS.markupCompatibility]])}>
2353
2353
  ${function(e){const t=[["ref",e.range]];return pE`
2354
2354
  <autoFilter ${hE(t)}>
@@ -2538,4 +2538,4 @@
2538
2538
  <tableParts count="${e.filterTables.length}">
2539
2539
  ${gE(a)}
2540
2540
  </tableParts>
2541
- `}var Cx;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(Cx||(Cx={}));function Ex(e,t={}){const o=Ee(t);return o.type=e,o}const wx={},yx={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:F,HEADER_WIDTH:D,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:L,DEFAULT_CELL_HEIGHT:P,SCROLLBAR_WIDTH:k},xx={autofillModifiersRegistry:ar,autofillRulesRegistry:lr,cellMenuRegistry:ff,colMenuRegistry:kb,linkMenuRegistry:Ng,functionRegistry:cu,featurePluginRegistry:qw,statefulUIPluginRegistry:Zw,coreViewsPluginRegistry:jw,corePluginRegistry:Gw,rowMenuRegistry:zb,sidePanelRegistry:Ev,figureRegistry:$p,chartSidePanelComponentRegistry:lv,chartComponentRegistry:Up,chartRegistry:kp,topbarMenuRegistry:Bb,topbarComponentRegistry:wv,clickableCellRegistry:Yw,otRegistry:Hb,inverseCommandRegistry:Zp,urlRegistry:Ji,cellPopoverRegistry:Fg,numberFormatMenuRegistry:Ub,repeatLocalCommandTransformRegistry:Aw,repeatCommandTransformRegistry:Tw},Ix={arg:Ur,toBoolean:Ms,toJsDate:_s,toNumber:ys,toString:As,toXC:xt,toZone:Qo,toCartesian:yt,numberToLetters:vt,UuidGenerator:Ui,formatValue:mo,createCurrencyFormat:Mo,computeTextWidth:Mi,createEmptyWorkbookData:VE,createEmptySheet:UE,createEmptyExcelSheet:zE,getDefaultChartJsRuntime:dp,chartFontColor:jg,ChartColors:Zg,EvaluationError:c,CellErrorLevel:l,getFillingMode:mp,rgbaToHex:ut,colorToRGBA:gt,positionToZone:Ci,isDefined:Ue,lazy:$e,genericRepeat:Ow},Rx={isMarkdownLink:Ne,parseMarkdownLink:Fe,markdownLink:_e,openLink:ss,urlRepresentation:is},Tx={ChartPanel:cv,ChartFigure:zp,ChartJsComponent:Vi,Grid:bS,GridOverlay:tS,ScorecardChart:ji,LineConfigPanel:rv,LineBarPieDesignPanel:ov,BarConfigPanel:Yb,LineBarPieConfigPanel:jb,GaugeChartConfigPanel:iv,GaugeChartDesignPanel:sv,ScorecardChartConfigPanel:nv,ScorecardChartDesignPanel:av,FigureComponent:yv};const Ax={DEFAULT_LOCALE:Jt};e.AbstractChart=Lg,e.CorePlugin=HE,e.DispatchResult=ps,e.EvaluationError=c,e.Model=class extends lw{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},o={},i=[],s=new Ui,r=!0){super(),i=PE(e,i);const n=DE(e,r);this.state=new _y,this.uuidGenerator=s,this.config=this.setupConfig(o),this.session=this.setupSession(n.revisionId),this.coreGetters={},this.range=new YE(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new My(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of Gw.getAll())this.setupCorePlugin(e,n);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(i);for(let e of jw.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of Zw.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of qw.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),o.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave()}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o),this.coreHandlers.push(o),this.handlers.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new bw(Ay({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:r("Anonymous").toString()},o=e.transportService||new Sy;return{...e,mode:e.mode||"normal",custom:e.custom||{},defaultCurrencyFormat:e.defaultCurrencyFormat||"[$$]#,##0.00",external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e)}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(Qt));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session}}checkDispatchAllowed(e){return gs(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e)}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),new ps(t.flat())}checkDispatchAllowedLocalCommand(e){const t=this.uiHandlers.map((t=>t.allowDispatch(e)));return new ps(t.flat())}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(Ex(e,t));dispatch=(e,t)=>{const o=Ex(e,t);let i=this.status;if(this.getters.isReadonly()&&(s=o,!ds.has(s.type)))return new ps(68);var s;if(!this.session.canApplyOptimisticUpdate())return new ps(65);switch(i){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:i,commands:s}=this.state.recordChanges((()=>{gs(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(o,s,i),this.status=0,this.trigger("update");break;case 1:if(gs(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(gs(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return ps.Success};dispatchFromCorePlugin=(e,t)=>{const o=Ex(e,t),i=this.status;this.status=2;const s=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(s,o),this.status=i,ps.Success};dispatchToHandlers(e,t){for(const o of e)o.beforeHandle(t);for(const o of e)o.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=VE();for(let t of this.handlers)t instanceof HE&&t.export(e);return e.revisionId=this.session.getRevisionId()||te,e=Ee(e),e}updateMode(e){"normal"!==e&&this.dispatch("STOP_EDITION",{cancel:!0}),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...VE(),sheets:[zE(FE,"Sheet1")]};for(let t of this.handlers)t instanceof BE&&t.exportForExcel(e);return e=Ee(e),vx(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Ki,e.Revision=mw,e.SPREADSHEET_DIMENSIONS=yx,e.Spreadsheet=vy,e.UIPlugin=XE,e.__info__=wx,e.addFunction=function(e,t){cu.add(e,t)},e.astToFormula=Wu,e.compile=ig,e.components=Tx,e.constants=Ax,e.convertAstNodes=zu,e.coreTypes=us,e.findCellInNewZone=vi,e.functionCache=og,e.helpers=Ix,e.invalidateCFEvaluationCommands=hs,e.invalidateDependenciesCommands=cs,e.invalidateEvaluationCommands=ls,e.iterateAstNodes=Bu,e.links=Rx,e.load=DE,e.parse=Uu,e.readonlyAllowedCommands=ds,e.registries=xx,e.setDefaultSheetViewSize=function(e){pe=e},e.setTranslationMethod=function(e){o=e},e.tokenize=fu,Object.defineProperty(e,"__esModule",{value:!0}),wx.version="16.4.3",wx.date="2023-08-09T09:08:41.454Z",wx.hash="1dbd302"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2541
+ `}var Cx;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(Cx||(Cx={}));function Ex(e,t={}){const o=Ee(t);return o.type=e,o}const wx={},yx={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:F,HEADER_WIDTH:D,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:L,DEFAULT_CELL_HEIGHT:P,SCROLLBAR_WIDTH:k},xx={autofillModifiersRegistry:ar,autofillRulesRegistry:lr,cellMenuRegistry:ff,colMenuRegistry:kb,linkMenuRegistry:Ng,functionRegistry:cu,featurePluginRegistry:qw,statefulUIPluginRegistry:Zw,coreViewsPluginRegistry:jw,corePluginRegistry:Gw,rowMenuRegistry:zb,sidePanelRegistry:Ev,figureRegistry:$p,chartSidePanelComponentRegistry:lv,chartComponentRegistry:Up,chartRegistry:kp,topbarMenuRegistry:Bb,topbarComponentRegistry:wv,clickableCellRegistry:Yw,otRegistry:Hb,inverseCommandRegistry:Zp,urlRegistry:Ji,cellPopoverRegistry:Fg,numberFormatMenuRegistry:Ub,repeatLocalCommandTransformRegistry:Aw,repeatCommandTransformRegistry:Tw},Ix={arg:Ur,toBoolean:Ms,toJsDate:_s,toNumber:ys,toString:As,toXC:xt,toZone:Qo,toCartesian:yt,numberToLetters:vt,UuidGenerator:Ui,formatValue:mo,createCurrencyFormat:Mo,computeTextWidth:Mi,createEmptyWorkbookData:VE,createEmptySheet:UE,createEmptyExcelSheet:zE,getDefaultChartJsRuntime:dp,chartFontColor:jg,ChartColors:Zg,EvaluationError:c,CellErrorLevel:l,getFillingMode:mp,rgbaToHex:ut,colorToRGBA:gt,positionToZone:Ci,isDefined:Ue,lazy:$e,genericRepeat:Ow},Rx={isMarkdownLink:Ne,parseMarkdownLink:Fe,markdownLink:_e,openLink:ss,urlRepresentation:is},Tx={ChartPanel:cv,ChartFigure:zp,ChartJsComponent:Vi,Grid:bS,GridOverlay:tS,ScorecardChart:ji,LineConfigPanel:rv,LineBarPieDesignPanel:ov,BarConfigPanel:Yb,LineBarPieConfigPanel:jb,GaugeChartConfigPanel:iv,GaugeChartDesignPanel:sv,ScorecardChartConfigPanel:nv,ScorecardChartDesignPanel:av,FigureComponent:yv};const Ax={DEFAULT_LOCALE:Jt};e.AbstractChart=Lg,e.CorePlugin=HE,e.DispatchResult=ps,e.EvaluationError=c,e.Model=class extends lw{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},o={},i=[],s=new Ui,r=!0){super(),i=PE(e,i);const n=DE(e,r);this.state=new _y,this.uuidGenerator=s,this.config=this.setupConfig(o),this.session=this.setupSession(n.revisionId),this.coreGetters={},this.range=new YE(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new My(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of Gw.getAll())this.setupCorePlugin(e,n);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(i);for(let e of jw.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of Zw.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of qw.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),o.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave()}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o),this.coreHandlers.push(o),this.handlers.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new bw(Ay({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:r("Anonymous").toString()},o=e.transportService||new Sy;return{...e,mode:e.mode||"normal",custom:e.custom||{},defaultCurrencyFormat:e.defaultCurrencyFormat||"[$$]#,##0.00",external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e)}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(Qt));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session}}checkDispatchAllowed(e){return gs(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e)}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),new ps(t.flat())}checkDispatchAllowedLocalCommand(e){const t=this.uiHandlers.map((t=>t.allowDispatch(e)));return new ps(t.flat())}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(Ex(e,t));dispatch=(e,t)=>{const o=Ex(e,t);let i=this.status;if(this.getters.isReadonly()&&(s=o,!ds.has(s.type)))return new ps(68);var s;if(!this.session.canApplyOptimisticUpdate())return new ps(65);switch(i){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:i,commands:s}=this.state.recordChanges((()=>{gs(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(o,s,i),this.status=0,this.trigger("update");break;case 1:if(gs(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(gs(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return ps.Success};dispatchFromCorePlugin=(e,t)=>{const o=Ex(e,t),i=this.status;this.status=2;const s=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(s,o),this.status=i,ps.Success};dispatchToHandlers(e,t){for(const o of e)o.beforeHandle(t);for(const o of e)o.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=VE();for(let t of this.handlers)t instanceof HE&&t.export(e);return e.revisionId=this.session.getRevisionId()||te,e=Ee(e),e}updateMode(e){"normal"!==e&&this.dispatch("STOP_EDITION",{cancel:!0}),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...VE(),sheets:[zE(FE,"Sheet1")]};for(let t of this.handlers)t instanceof BE&&t.exportForExcel(e);return e=Ee(e),vx(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Ki,e.Revision=mw,e.SPREADSHEET_DIMENSIONS=yx,e.Spreadsheet=vy,e.UIPlugin=XE,e.__info__=wx,e.addFunction=function(e,t){cu.add(e,t)},e.astToFormula=Wu,e.compile=ig,e.components=Tx,e.constants=Ax,e.convertAstNodes=zu,e.coreTypes=us,e.findCellInNewZone=vi,e.functionCache=og,e.helpers=Ix,e.invalidateCFEvaluationCommands=hs,e.invalidateDependenciesCommands=cs,e.invalidateEvaluationCommands=ls,e.iterateAstNodes=Bu,e.links=Rx,e.load=DE,e.parse=Uu,e.readonlyAllowedCommands=ds,e.registries=xx,e.setDefaultSheetViewSize=function(e){pe=e},e.setTranslationMethod=function(e){o=e},e.tokenize=fu,Object.defineProperty(e,"__esModule",{value:!0}),wx.version="16.4.4",wx.date="2023-08-17T11:08:07.524Z",wx.hash="bdb3a4c"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "16.4.3",
3
+ "version": "16.4.4",
4
4
  "description": "A spreadsheet component",
5
5
  "main": "dist/o-spreadsheet.cjs.js",
6
6
  "browser": "dist/o-spreadsheet.iife.js",