@odoo/o-spreadsheet 16.0.35 → 16.0.36

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.
@@ -20437,6 +20437,10 @@ class Composer extends owl.Component {
20437
20437
  if (!this.isKeyStillDown) {
20438
20438
  this.processContent();
20439
20439
  }
20440
+ // Required because typing '=SUM' and double-clicking another cell leaves ShowProvider and ShowDescription true
20441
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20442
+ this.processTokenAtCursor();
20443
+ }
20440
20444
  });
20441
20445
  }
20442
20446
  // ---------------------------------------------------------------------------
@@ -43291,6 +43295,6 @@ exports.setTranslationMethod = setTranslationMethod;
43291
43295
  exports.tokenize = tokenize;
43292
43296
 
43293
43297
 
43294
- __info__.version = '16.0.35';
43295
- __info__.date = '2024-03-15T10:57:14.362Z';
43296
- __info__.hash = '5cba28b';
43298
+ __info__.version = '16.0.36';
43299
+ __info__.date = '2024-03-25T09:36:40.811Z';
43300
+ __info__.hash = '2c2117b';
@@ -20433,6 +20433,10 @@ class Composer extends Component {
20433
20433
  if (!this.isKeyStillDown) {
20434
20434
  this.processContent();
20435
20435
  }
20436
+ // Required because typing '=SUM' and double-clicking another cell leaves ShowProvider and ShowDescription true
20437
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20438
+ this.processTokenAtCursor();
20439
+ }
20436
20440
  });
20437
20441
  }
20438
20442
  // ---------------------------------------------------------------------------
@@ -43259,6 +43263,6 @@ function addFunction(functionName, functionDescription) {
43259
43263
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, cellTypes, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
43260
43264
 
43261
43265
 
43262
- __info__.version = '16.0.35';
43263
- __info__.date = '2024-03-15T10:57:14.362Z';
43264
- __info__.hash = '5cba28b';
43266
+ __info__.version = '16.0.36';
43267
+ __info__.date = '2024-03-25T09:36:40.811Z';
43268
+ __info__.hash = '2c2117b';
@@ -20434,6 +20434,10 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20434
20434
  if (!this.isKeyStillDown) {
20435
20435
  this.processContent();
20436
20436
  }
20437
+ // Required because typing '=SUM' and double-clicking another cell leaves ShowProvider and ShowDescription true
20438
+ if (this.env.model.getters.getEditionMode() === "inactive") {
20439
+ this.processTokenAtCursor();
20440
+ }
20437
20441
  });
20438
20442
  }
20439
20443
  // ---------------------------------------------------------------------------
@@ -43290,9 +43294,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43290
43294
  Object.defineProperty(exports, '__esModule', { value: true });
43291
43295
 
43292
43296
 
43293
- __info__.version = '16.0.35';
43294
- __info__.date = '2024-03-15T10:57:14.362Z';
43295
- __info__.hash = '5cba28b';
43297
+ __info__.version = '16.0.36';
43298
+ __info__.date = '2024-03-25T09:36:40.811Z';
43299
+ __info__.hash = '2c2117b';
43296
43300
 
43297
43301
 
43298
43302
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -1093,7 +1093,7 @@
1093
1093
  .o-topbar-toolbar .o-composer-container {
1094
1094
  z-index: ${oe.TopBarComposer};
1095
1095
  }
1096
- `;class Zg extends t.Component{constructor(){super(...arguments),this.composerRef=t.useRef("o_composer"),this.contentHelper=new Ug(this.composerRef.el),this.composerState=t.useState({positionStart:0,positionEnd:0}),this.autoCompleteState=t.useState({showProvider:!1,provider:"functions",search:""}),this.functionDescriptionState=t.useState({showDescription:!1,functionName:"",functionDescription:{},argToFocus:0}),this.isKeyStillDown=!1,this.compositionActive=!1,this.borderStyle="box-shadow: 0 1px 4px 3px rgba(60, 64, 67, 0.15);",this.shouldProcessInputEvents=!1,this.tokens=[],this.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)}}get assistantStyle(){if(this.props.delimitation&&this.props.rect){const{x:e,y:t,height:i}=this.props.rect;let n="";return t>this.props.delimitation.height-(t+i)&&(n+="\n top: -8px;\n transform: translate(0, -100%);\n "),e+300>this.props.delimitation.width&&(n+="right:0px;"),n+="width:300px;"}return"width:300px;"}setup(){t.onMounted((()=>{const e=this.composerRef.el;this.props.isDefaultFocus&&this.env.focusableElement.setFocusableElement(e),this.contentHelper.updateEl(e),this.processContent()})),t.onPatched((()=>{this.isKeyStillDown||this.processContent()}))}processArrowKeys(e){if(this.env.model.getters.isSelectingForComposer()||"inactive"===this.env.model.getters.getEditionMode())return this.functionDescriptionState.showDescription=!1,void e.preventDefault();const t=this.env.model.getters.getCurrentContent();"cellFocus"!==this.props.focus||this.autoCompleteState.showProvider||t.startsWith("=")?(e.stopPropagation(),["ArrowUp","ArrowDown"].includes(e.key)&&this.autoCompleteState.showProvider&&this.autocompleteAPI&&(e.preventDefault(),"ArrowUp"===e.key?this.autocompleteAPI.moveUp():this.autocompleteAPI.moveDown()),this.updateCursorIfNeeded()):this.env.model.dispatch("STOP_EDITION")}processTabKey(e){if(e.preventDefault(),e.stopPropagation(),"inactive"!==this.env.model.getters.getEditionMode()){if(this.autoCompleteState.showProvider&&this.autocompleteAPI){const e=this.autocompleteAPI.getValueToFill();if(e)return void this.autoComplete(e)}else this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");this.env.model.dispatch("STOP_EDITION")}const t=e.shiftKey?"left":"right";this.env.model.selection.moveAnchorCell(t,1)}processEnterKey(e){if(e.preventDefault(),e.stopPropagation(),this.isKeyStillDown=!1,this.autoCompleteState.showProvider&&this.autocompleteAPI){const e=this.autocompleteAPI.getValueToFill();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()}onCompositionStart(){this.compositionActive=!0}onCompositionEnd(){this.compositionActive=!1}onKeydown(e){if("inactive"===this.env.model.getters.getEditionMode())return;let t=this.keyMapping[e.key];t?t.call(this,e):(e.stopPropagation(),this.updateCursorIfNeeded())}updateCursorIfNeeded(){if(!(this.env.model.getters.isSelectingForComposer()||"inactive"===this.env.model.getters.getEditionMode())){const{start:e,end:t}=this.contentHelper.getCurrentSelection();this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:e,end:t}),this.isKeyStillDown=!0}}onPaste(e){"inactive"!==this.env.model.getters.getEditionMode()&&e.stopPropagation()}onInput(e){var t,i;if(!this.shouldProcessInputEvents)return;if("insertFromPaste"===e.inputType&&"inactive"===this.env.model.getters.getEditionMode())return;let n;if(e.stopPropagation(),"inactive"===this.env.model.getters.getEditionMode())n=e.data||"";else{const e=this.composerRef.el;n=e.childNodes.length?e.textContent:""}if("inactive"===this.props.focus)return null===(i=(t=this.props).onComposerCellFocused)||void 0===i?void 0:i.call(t,n);this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION"),this.env.model.dispatch("SET_CURRENT_CONTENT",{content:n,selection:this.contentHelper.getCurrentSelection()})}onKeyup(e){if(this.isKeyStillDown=!1,"inactive"===this.props.focus||["Control","Shift","Tab","Enter","F4"].includes(e.key))return;if(this.autoCompleteState.showProvider&&["ArrowUp","ArrowDown"].includes(e.key))return;if(this.env.model.getters.isSelectingForComposer()&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key))return;if(e.preventDefault(),e.stopPropagation(),this.autoCompleteState.showProvider=!1,e.ctrlKey&&" "===e.key)return this.autoCompleteState.search="",this.autoCompleteState.showProvider=!0,void this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");const{start:t,end:i}=this.env.model.getters.getComposerSelection(),{start:n,end:o}=this.contentHelper.getCurrentSelection();n===t&&o===i||this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",this.contentHelper.getCurrentSelection()),this.processTokenAtCursor(),this.processContent()}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"),this.props.onComposerContentFocused(),this.props.focus,this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",e),this.processTokenAtCursor()}onBlur(){this.isKeyStillDown=!1}onCompleted(e){e&&this.autoComplete(e)}processContent(){if(this.compositionActive)return;this.contentHelper.removeAll(),this.shouldProcessInputEvents=!1,"inactive"!==this.props.focus&&(this.contentHelper.el.focus(),this.contentHelper.selectRange(0,0));const e=this.getContent();if(0!==e.length){this.contentHelper.setText(e);const{start:t,end:i}=this.env.model.getters.getComposerSelection();"inactive"!==this.props.focus&&this.contentHelper.selectRange(t,i)}this.shouldProcessInputEvents=!0}getContent(){let e;const t=this.env.model.getters.getCurrentContent(),i=t.startsWith("=")&&this.env.model.getters.getCurrentTokens().length>0;return e=""===t?[]:i&&"inactive"!==this.props.focus?this.getColoredTokens():[{value:t}],e}getColoredTokens(){const e=this.env.model.getters.getCurrentTokens(),t=this.env.model.getters.getTokenAtCursor(),i=[],{start:n,end:o}=this.env.model.getters.getComposerSelection();for(const r of e){switch(r.type){case"OPERATOR":case"NUMBER":case"FUNCTION":case"COMMA":case"STRING":i.push({value:r.value,color:qg[r.type]||"#000"});break;case"REFERENCE":const{xc:e,sheetName:n}=Dt(r.value);i.push({value:r.value,color:this.rangeColor(e,n)||"#000"});break;case"SYMBOL":let o=r.value;["TRUE","FALSE"].includes(o.toUpperCase())?i.push({value:r.value,color:Wg}):i.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?i.push({value:r.value,color:"black"}):i.push({value:r.value,color:qg[r.type]||"#000"});break;default:i.push({value:r.value,color:"#000"})}this.env.model.getters.showSelectionIndicator()&&o===n&&o===r.end&&(i[i.length-1].class=Gg)}return i}rangeColor(e,t){if("inactive"===this.props.focus)return;const i=this.env.model.getters.getHighlights(),n=t?this.env.model.getters.getSheetIdByName(t):this.env.model.getters.getEditionSheet(),o=i.find((t=>{if(t.sheetId!==n)return!1;let i=this.env.model.getters.getRangeFromSheetXC(n,e).zone;const{height:o,width:r}=Hi(i);return i=o*r==1?this.env.model.getters.expandZone(n,i):i,Li(i,t.zone)}));return o&&o.color?o.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){const{xc:t}=Dt(e.value);if("FUNCTION"===e.type||"SYMBOL"===e.type&&!At.test(t))this.autoCompleteState.search=e.value,this.autoCompleteState.showProvider=!0;else if(e.functionContext&&"UNKNOWN"!==e.type){const t=e.functionContext,i=t.parent.toUpperCase(),n=zg[i],o=t.argPosition;this.functionDescriptionState.functionName=i,this.functionDescriptionState.functionDescription=n,this.functionDescriptionState.argToFocus=n.getArgToFocus(o+1)-1,this.functionDescriptionState.showDescription=!0}}}}autoComplete(e){if(e){const t=this.env.model.getters.getTokenAtCursor();if(t){let i=t.end,n=t.end;["SYMBOL","FUNCTION"].includes(t.type)&&(i=t.start);const o=this.env.model.getters.getCurrentTokens();if(this.autoCompleteState.provider&&o.length){e+="(";const i=o.map((e=>e.start)).indexOf(t.start);if(i+1<o.length){"LEFT_PAREN"===o[i+1].type&&n++}}this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:i,end:n})}this.env.model.dispatch("REPLACE_COMPOSER_CURSOR_SELECTION",{text:e})}this.processTokenAtCursor()}}Zg.template="o-spreadsheet-Composer",Zg.components={TextValueProvider:Pg,FunctionDescriptionProvider:Vg},Zg.defaultProps={inputStyle:"",focus:"inactive",isDefaultFocus:!1};const jg=3*.4*window.devicePixelRatio||1;bn`
1096
+ `;class Zg extends t.Component{constructor(){super(...arguments),this.composerRef=t.useRef("o_composer"),this.contentHelper=new Ug(this.composerRef.el),this.composerState=t.useState({positionStart:0,positionEnd:0}),this.autoCompleteState=t.useState({showProvider:!1,provider:"functions",search:""}),this.functionDescriptionState=t.useState({showDescription:!1,functionName:"",functionDescription:{},argToFocus:0}),this.isKeyStillDown=!1,this.compositionActive=!1,this.borderStyle="box-shadow: 0 1px 4px 3px rgba(60, 64, 67, 0.15);",this.shouldProcessInputEvents=!1,this.tokens=[],this.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)}}get assistantStyle(){if(this.props.delimitation&&this.props.rect){const{x:e,y:t,height:i}=this.props.rect;let n="";return t>this.props.delimitation.height-(t+i)&&(n+="\n top: -8px;\n transform: translate(0, -100%);\n "),e+300>this.props.delimitation.width&&(n+="right:0px;"),n+="width:300px;"}return"width:300px;"}setup(){t.onMounted((()=>{const e=this.composerRef.el;this.props.isDefaultFocus&&this.env.focusableElement.setFocusableElement(e),this.contentHelper.updateEl(e),this.processContent()})),t.onPatched((()=>{this.isKeyStillDown||this.processContent(),"inactive"===this.env.model.getters.getEditionMode()&&this.processTokenAtCursor()}))}processArrowKeys(e){if(this.env.model.getters.isSelectingForComposer()||"inactive"===this.env.model.getters.getEditionMode())return this.functionDescriptionState.showDescription=!1,void e.preventDefault();const t=this.env.model.getters.getCurrentContent();"cellFocus"!==this.props.focus||this.autoCompleteState.showProvider||t.startsWith("=")?(e.stopPropagation(),["ArrowUp","ArrowDown"].includes(e.key)&&this.autoCompleteState.showProvider&&this.autocompleteAPI&&(e.preventDefault(),"ArrowUp"===e.key?this.autocompleteAPI.moveUp():this.autocompleteAPI.moveDown()),this.updateCursorIfNeeded()):this.env.model.dispatch("STOP_EDITION")}processTabKey(e){if(e.preventDefault(),e.stopPropagation(),"inactive"!==this.env.model.getters.getEditionMode()){if(this.autoCompleteState.showProvider&&this.autocompleteAPI){const e=this.autocompleteAPI.getValueToFill();if(e)return void this.autoComplete(e)}else this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");this.env.model.dispatch("STOP_EDITION")}const t=e.shiftKey?"left":"right";this.env.model.selection.moveAnchorCell(t,1)}processEnterKey(e){if(e.preventDefault(),e.stopPropagation(),this.isKeyStillDown=!1,this.autoCompleteState.showProvider&&this.autocompleteAPI){const e=this.autocompleteAPI.getValueToFill();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()}onCompositionStart(){this.compositionActive=!0}onCompositionEnd(){this.compositionActive=!1}onKeydown(e){if("inactive"===this.env.model.getters.getEditionMode())return;let t=this.keyMapping[e.key];t?t.call(this,e):(e.stopPropagation(),this.updateCursorIfNeeded())}updateCursorIfNeeded(){if(!(this.env.model.getters.isSelectingForComposer()||"inactive"===this.env.model.getters.getEditionMode())){const{start:e,end:t}=this.contentHelper.getCurrentSelection();this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:e,end:t}),this.isKeyStillDown=!0}}onPaste(e){"inactive"!==this.env.model.getters.getEditionMode()&&e.stopPropagation()}onInput(e){var t,i;if(!this.shouldProcessInputEvents)return;if("insertFromPaste"===e.inputType&&"inactive"===this.env.model.getters.getEditionMode())return;let n;if(e.stopPropagation(),"inactive"===this.env.model.getters.getEditionMode())n=e.data||"";else{const e=this.composerRef.el;n=e.childNodes.length?e.textContent:""}if("inactive"===this.props.focus)return null===(i=(t=this.props).onComposerCellFocused)||void 0===i?void 0:i.call(t,n);this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION"),this.env.model.dispatch("SET_CURRENT_CONTENT",{content:n,selection:this.contentHelper.getCurrentSelection()})}onKeyup(e){if(this.isKeyStillDown=!1,"inactive"===this.props.focus||["Control","Shift","Tab","Enter","F4"].includes(e.key))return;if(this.autoCompleteState.showProvider&&["ArrowUp","ArrowDown"].includes(e.key))return;if(this.env.model.getters.isSelectingForComposer()&&["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(e.key))return;if(e.preventDefault(),e.stopPropagation(),this.autoCompleteState.showProvider=!1,e.ctrlKey&&" "===e.key)return this.autoCompleteState.search="",this.autoCompleteState.showProvider=!0,void this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");const{start:t,end:i}=this.env.model.getters.getComposerSelection(),{start:n,end:o}=this.contentHelper.getCurrentSelection();n===t&&o===i||this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",this.contentHelper.getCurrentSelection()),this.processTokenAtCursor(),this.processContent()}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"),this.props.onComposerContentFocused(),this.props.focus,this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",e),this.processTokenAtCursor()}onBlur(){this.isKeyStillDown=!1}onCompleted(e){e&&this.autoComplete(e)}processContent(){if(this.compositionActive)return;this.contentHelper.removeAll(),this.shouldProcessInputEvents=!1,"inactive"!==this.props.focus&&(this.contentHelper.el.focus(),this.contentHelper.selectRange(0,0));const e=this.getContent();if(0!==e.length){this.contentHelper.setText(e);const{start:t,end:i}=this.env.model.getters.getComposerSelection();"inactive"!==this.props.focus&&this.contentHelper.selectRange(t,i)}this.shouldProcessInputEvents=!0}getContent(){let e;const t=this.env.model.getters.getCurrentContent(),i=t.startsWith("=")&&this.env.model.getters.getCurrentTokens().length>0;return e=""===t?[]:i&&"inactive"!==this.props.focus?this.getColoredTokens():[{value:t}],e}getColoredTokens(){const e=this.env.model.getters.getCurrentTokens(),t=this.env.model.getters.getTokenAtCursor(),i=[],{start:n,end:o}=this.env.model.getters.getComposerSelection();for(const r of e){switch(r.type){case"OPERATOR":case"NUMBER":case"FUNCTION":case"COMMA":case"STRING":i.push({value:r.value,color:qg[r.type]||"#000"});break;case"REFERENCE":const{xc:e,sheetName:n}=Dt(r.value);i.push({value:r.value,color:this.rangeColor(e,n)||"#000"});break;case"SYMBOL":let o=r.value;["TRUE","FALSE"].includes(o.toUpperCase())?i.push({value:r.value,color:Wg}):i.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?i.push({value:r.value,color:"black"}):i.push({value:r.value,color:qg[r.type]||"#000"});break;default:i.push({value:r.value,color:"#000"})}this.env.model.getters.showSelectionIndicator()&&o===n&&o===r.end&&(i[i.length-1].class=Gg)}return i}rangeColor(e,t){if("inactive"===this.props.focus)return;const i=this.env.model.getters.getHighlights(),n=t?this.env.model.getters.getSheetIdByName(t):this.env.model.getters.getEditionSheet(),o=i.find((t=>{if(t.sheetId!==n)return!1;let i=this.env.model.getters.getRangeFromSheetXC(n,e).zone;const{height:o,width:r}=Hi(i);return i=o*r==1?this.env.model.getters.expandZone(n,i):i,Li(i,t.zone)}));return o&&o.color?o.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){const{xc:t}=Dt(e.value);if("FUNCTION"===e.type||"SYMBOL"===e.type&&!At.test(t))this.autoCompleteState.search=e.value,this.autoCompleteState.showProvider=!0;else if(e.functionContext&&"UNKNOWN"!==e.type){const t=e.functionContext,i=t.parent.toUpperCase(),n=zg[i],o=t.argPosition;this.functionDescriptionState.functionName=i,this.functionDescriptionState.functionDescription=n,this.functionDescriptionState.argToFocus=n.getArgToFocus(o+1)-1,this.functionDescriptionState.showDescription=!0}}}}autoComplete(e){if(e){const t=this.env.model.getters.getTokenAtCursor();if(t){let i=t.end,n=t.end;["SYMBOL","FUNCTION"].includes(t.type)&&(i=t.start);const o=this.env.model.getters.getCurrentTokens();if(this.autoCompleteState.provider&&o.length){e+="(";const i=o.map((e=>e.start)).indexOf(t.start);if(i+1<o.length){"LEFT_PAREN"===o[i+1].type&&n++}}this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:i,end:n})}this.env.model.dispatch("REPLACE_COMPOSER_CURSOR_SELECTION",{text:e})}this.processTokenAtCursor()}}Zg.template="o-spreadsheet-Composer",Zg.components={TextValueProvider:Pg,FunctionDescriptionProvider:Vg},Zg.defaultProps={inputStyle:"",focus:"inactive",isDefaultFocus:!1};const jg=3*.4*window.devicePixelRatio||1;bn`
1097
1097
  div.o-grid-composer {
1098
1098
  z-index: ${oe.GridComposer};
1099
1099
  box-sizing: border-box;
@@ -2432,4 +2432,4 @@
2432
2432
  <tableParts count="${e.filterTables.length}">
2433
2433
  ${Ef(a)}
2434
2434
  </tableParts>
2435
- `}var gS;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(gS||(gS={}));const pS={},mS={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:N,HEADER_WIDTH:O,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:_,DEFAULT_CELL_HEIGHT:F,SCROLLBAR_WIDTH:D},fS={autofillModifiersRegistry:on,autofillRulesRegistry:mn,cellMenuRegistry:Uo,colMenuRegistry:Vo,linkMenuRegistry:Hn,functionRegistry:Pu,uiPluginRegistry:ib,corePluginRegistry:tb,rowMenuRegistry:zo,sidePanelRegistry:fs,figureRegistry:Yn,sheetMenuRegistry:Ho,chartSidePanelComponentRegistry:as,chartComponentRegistry:tn,chartRegistry:en,topbarMenuRegistry:Ko,topbarComponentRegistry:vs,clickableCellRegistry:nb,otRegistry:Qo,inverseCommandRegistry:Xn,cellRegistry:Zn,cellPopoverRegistry:qn},vS={LinkCell:Ip},bS={args:Ns,toBoolean:Bs,toJsDate:Hs,toNumber:$s,toString:Ps,toXC:Pt,toZone:Ai,toCartesian:Lt,numberToLetters:kt,createFullMenuItem:Vn,UuidGenerator:Ii,formatValue:Xt,computeTextWidth:_e,isMarkdownLink:He,parseMarkdownLink:Ge,markdownLink:We,createEmptyWorkbookData:Zf,createEmptySheet:qf,createEmptyExcelSheet:jf,getDefaultChartJsRuntime:Rr,chartFontColor:fr,getMenuChildren:Tn,ChartColors:mr,EvaluationError:c,CellErrorLevel:l,getFillingMode:Ar,rgbaToHex:bt,colorToRGBA:St,positionToZone:Yi},SS={ChartPanel:ls,ChartFigure:ws,ChartJsComponent:nn,Grid:Sp,GridOverlay:np,ScorecardChart:Ss,LineConfigPanel:ns,LineBarPieDesignPanel:Jr,BarConfigPanel:ir,LineBarPieConfigPanel:tr,GaugeChartConfigPanel:ts,GaugeChartDesignPanel:is,ScorecardChartConfigPanel:rs,ScorecardChartDesignPanel:ss};e.AbstractChart=nr,e.CorePlugin=Yf,e.DATETIME_FORMAT=Y,e.DispatchResult=dn,e.EvaluationError=c,e.Model=class extends Pv{constructor(e={},i={},n=[],o=new Ii,r=!0){super(),this.corePlugins=[],this.uiPlugins=[],this.isReplayingCommand=!1,this.renderers=[],this.status=0,this.handlers=[],this.coreHandlers=[],this.dispatch=(e,t)=>{const i={type:e,...t};let n=this.status;if(this.getters.isReadonly()&&(o=i,!ln.has(o.type)))return new dn(67);var o;if(!this.session.canApplyOptimisticUpdate())return new dn(64);switch(n){case 0:const t=this.checkDispatchAllowed(i);if(!t.isSuccessful)return t;this.status=1;const{changes:n,commands:o}=this.state.recordChanges((()=>{hn(i)&&this.state.addCommand(i),this.dispatchToHandlers(this.handlers,i),this.finalize()}));this.session.save(o,n),this.status=0,this.trigger("update");break;case 1:if(hn(i)){const e=this.checkDispatchAllowed(i);if(!e.isSuccessful)return e;this.state.addCommand(i),this.dispatchToHandlers(this.handlers,i)}else this.dispatchToHandlers(this.handlers,i);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(hn(i))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,i)}return dn.Success},this.dispatchFromCorePlugin=(e,t)=>{const i={type:e,...t},n=this.status;this.status=2;const o=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(o,i),this.status=n,dn.Success},n=Wf(e,n);const s=Bf(e,r);this.state=new Ab,this.uuidGenerator=o,this.config=this.setupConfig(i),this.session=this.setupSession(s.revisionId),this.config.moveClient=this.session.move.bind(this.session),this.history=new xb(this.dispatchFromCorePlugin,this.session),this.coreGetters={},this.range=new Rb(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.getSelectionRangeString=this.range.getSelectionRangeString.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode,canUndo:this.history.canUndo.bind(this.history),canRedo:this.history.canRedo.bind(this.history),getClient:this.session.getClient.bind(this.session),getConnectedClients:this.session.getConnectedClients.bind(this.session),isFullySynchronized:this.session.isFullySynchronized.bind(this.session)},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new Tb(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range);for(let e of tb.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters);for(let e of ib.getAll())this.setupUiPlugin(e);this.uuidGenerator.setIsFastStrategy(!1),this.handlers.push(this.history),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.session.loadInitialMessages(n),this.joinSession(),i.snapshotRequested&&this.session.snapshot(this.exportData()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave()}setupUiPlugin(e){const t=new e(this.getters,this.state,this.dispatch,this.config,this.selection);for(let i of e.getters){if(!(i in t))throw new Error(`Invalid getter name: ${i} for plugin ${t.constructor}`);if(i in this.getters)throw new Error(`Getter "${i}" is already defined.`);this.getters[i]=t[i].bind(t)}this.uiPlugins.push(t),this.handlers.push(t);const i=e.layers.map((e=>[t,e]));this.renderers.push(...i),this.renderers.sort(((e,t)=>e[1]-t[1]))}setupCorePlugin(e,t){const i=new e(this.coreGetters,this.state,this.range,this.dispatchFromCorePlugin,this.config,this.uuidGenerator);for(let t of e.getters){if(!(t in i))throw new Error(`Invalid getter name: ${t} for plugin ${i.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=i[t].bind(i)}i.import(t),this.corePlugins.push(i),this.coreHandlers.push(i),this.handlers.push(i)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.uiPlugins,t),this.status=e}this.finalize()}setupSession(e){return new Zv(wb(e,this.state.recordChanges.bind(this.state),(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-redone",this,this.finalize),this.session.on("revision-undone",this,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()},i=e.transportService||new gb;return{...e,mode:e.mode||"normal",evalContext:e.evalContext||{},transportService:i,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e)}}checkDispatchAllowed(e){const t=this.handlers.map((t=>t.allowDispatch(e)));return t.some((e=>0!==e))?new dn(t.flat()):dn.Success}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}dispatchToHandlers(e,t){t=Ae(t);for(const i of e)i.beforeHandle(t);for(const i of e)i.handle(t)}drawGrid(e){for(let[t,i]of this.renderers)e.ctx.save(),t.drawGrid(e,i),e.ctx.restore()}exportData(){let e=Zf();for(let t of this.handlers)t instanceof Yf&&t.export(e);return e.revisionId=this.session.getRevisionId()||K,e=Ae(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={...Zf(),sheets:[jf(zf,"Sheet1")]};for(let t of this.handlers)t instanceof _g&&t.exportForExcel(e);return e=Ae(e),dS(e)}},e.Registry=Ji,e.Revision=Gv,e.SPREADSHEET_DIMENSIONS=mS,e.Spreadsheet=ub,e.UIPlugin=Fg,e.__info__=pS,e.addFunction=function(e,t){Pu.add(e,t)},e.astToFormula=gg,e.cellTypes=vS,e.compile=Tg,e.components=SS,e.convertAstNodes=ug,e.coreTypes=cn,e.findCellInNewZone=Zi,e.functionCache=Ig,e.helpers=bS,e.invalidateEvaluationCommands=sn,e.load=Bf,e.parse=hg,e.readonlyAllowedCommands=ln,e.registries=fS,e.setTranslationMethod=function(e){i=e},e.tokenize=Bu,Object.defineProperty(e,"__esModule",{value:!0}),pS.version="16.0.35",pS.date="2024-03-15T10:57:14.362Z",pS.hash="5cba28b"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2435
+ `}var gS;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(gS||(gS={}));const pS={},mS={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:N,HEADER_WIDTH:O,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:_,DEFAULT_CELL_HEIGHT:F,SCROLLBAR_WIDTH:D},fS={autofillModifiersRegistry:on,autofillRulesRegistry:mn,cellMenuRegistry:Uo,colMenuRegistry:Vo,linkMenuRegistry:Hn,functionRegistry:Pu,uiPluginRegistry:ib,corePluginRegistry:tb,rowMenuRegistry:zo,sidePanelRegistry:fs,figureRegistry:Yn,sheetMenuRegistry:Ho,chartSidePanelComponentRegistry:as,chartComponentRegistry:tn,chartRegistry:en,topbarMenuRegistry:Ko,topbarComponentRegistry:vs,clickableCellRegistry:nb,otRegistry:Qo,inverseCommandRegistry:Xn,cellRegistry:Zn,cellPopoverRegistry:qn},vS={LinkCell:Ip},bS={args:Ns,toBoolean:Bs,toJsDate:Hs,toNumber:$s,toString:Ps,toXC:Pt,toZone:Ai,toCartesian:Lt,numberToLetters:kt,createFullMenuItem:Vn,UuidGenerator:Ii,formatValue:Xt,computeTextWidth:_e,isMarkdownLink:He,parseMarkdownLink:Ge,markdownLink:We,createEmptyWorkbookData:Zf,createEmptySheet:qf,createEmptyExcelSheet:jf,getDefaultChartJsRuntime:Rr,chartFontColor:fr,getMenuChildren:Tn,ChartColors:mr,EvaluationError:c,CellErrorLevel:l,getFillingMode:Ar,rgbaToHex:bt,colorToRGBA:St,positionToZone:Yi},SS={ChartPanel:ls,ChartFigure:ws,ChartJsComponent:nn,Grid:Sp,GridOverlay:np,ScorecardChart:Ss,LineConfigPanel:ns,LineBarPieDesignPanel:Jr,BarConfigPanel:ir,LineBarPieConfigPanel:tr,GaugeChartConfigPanel:ts,GaugeChartDesignPanel:is,ScorecardChartConfigPanel:rs,ScorecardChartDesignPanel:ss};e.AbstractChart=nr,e.CorePlugin=Yf,e.DATETIME_FORMAT=Y,e.DispatchResult=dn,e.EvaluationError=c,e.Model=class extends Pv{constructor(e={},i={},n=[],o=new Ii,r=!0){super(),this.corePlugins=[],this.uiPlugins=[],this.isReplayingCommand=!1,this.renderers=[],this.status=0,this.handlers=[],this.coreHandlers=[],this.dispatch=(e,t)=>{const i={type:e,...t};let n=this.status;if(this.getters.isReadonly()&&(o=i,!ln.has(o.type)))return new dn(67);var o;if(!this.session.canApplyOptimisticUpdate())return new dn(64);switch(n){case 0:const t=this.checkDispatchAllowed(i);if(!t.isSuccessful)return t;this.status=1;const{changes:n,commands:o}=this.state.recordChanges((()=>{hn(i)&&this.state.addCommand(i),this.dispatchToHandlers(this.handlers,i),this.finalize()}));this.session.save(o,n),this.status=0,this.trigger("update");break;case 1:if(hn(i)){const e=this.checkDispatchAllowed(i);if(!e.isSuccessful)return e;this.state.addCommand(i),this.dispatchToHandlers(this.handlers,i)}else this.dispatchToHandlers(this.handlers,i);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(hn(i))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,i)}return dn.Success},this.dispatchFromCorePlugin=(e,t)=>{const i={type:e,...t},n=this.status;this.status=2;const o=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(o,i),this.status=n,dn.Success},n=Wf(e,n);const s=Bf(e,r);this.state=new Ab,this.uuidGenerator=o,this.config=this.setupConfig(i),this.session=this.setupSession(s.revisionId),this.config.moveClient=this.session.move.bind(this.session),this.history=new xb(this.dispatchFromCorePlugin,this.session),this.coreGetters={},this.range=new Rb(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.getSelectionRangeString=this.range.getSelectionRangeString.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode,canUndo:this.history.canUndo.bind(this.history),canRedo:this.history.canRedo.bind(this.history),getClient:this.session.getClient.bind(this.session),getConnectedClients:this.session.getConnectedClients.bind(this.session),isFullySynchronized:this.session.isFullySynchronized.bind(this.session)},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new Tb(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range);for(let e of tb.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters);for(let e of ib.getAll())this.setupUiPlugin(e);this.uuidGenerator.setIsFastStrategy(!1),this.handlers.push(this.history),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.session.loadInitialMessages(n),this.joinSession(),i.snapshotRequested&&this.session.snapshot(this.exportData()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave()}setupUiPlugin(e){const t=new e(this.getters,this.state,this.dispatch,this.config,this.selection);for(let i of e.getters){if(!(i in t))throw new Error(`Invalid getter name: ${i} for plugin ${t.constructor}`);if(i in this.getters)throw new Error(`Getter "${i}" is already defined.`);this.getters[i]=t[i].bind(t)}this.uiPlugins.push(t),this.handlers.push(t);const i=e.layers.map((e=>[t,e]));this.renderers.push(...i),this.renderers.sort(((e,t)=>e[1]-t[1]))}setupCorePlugin(e,t){const i=new e(this.coreGetters,this.state,this.range,this.dispatchFromCorePlugin,this.config,this.uuidGenerator);for(let t of e.getters){if(!(t in i))throw new Error(`Invalid getter name: ${t} for plugin ${i.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=i[t].bind(i)}i.import(t),this.corePlugins.push(i),this.coreHandlers.push(i),this.handlers.push(i)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.uiPlugins,t),this.status=e}this.finalize()}setupSession(e){return new Zv(wb(e,this.state.recordChanges.bind(this.state),(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-redone",this,this.finalize),this.session.on("revision-undone",this,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()},i=e.transportService||new gb;return{...e,mode:e.mode||"normal",evalContext:e.evalContext||{},transportService:i,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e)}}checkDispatchAllowed(e){const t=this.handlers.map((t=>t.allowDispatch(e)));return t.some((e=>0!==e))?new dn(t.flat()):dn.Success}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}dispatchToHandlers(e,t){t=Ae(t);for(const i of e)i.beforeHandle(t);for(const i of e)i.handle(t)}drawGrid(e){for(let[t,i]of this.renderers)e.ctx.save(),t.drawGrid(e,i),e.ctx.restore()}exportData(){let e=Zf();for(let t of this.handlers)t instanceof Yf&&t.export(e);return e.revisionId=this.session.getRevisionId()||K,e=Ae(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={...Zf(),sheets:[jf(zf,"Sheet1")]};for(let t of this.handlers)t instanceof _g&&t.exportForExcel(e);return e=Ae(e),dS(e)}},e.Registry=Ji,e.Revision=Gv,e.SPREADSHEET_DIMENSIONS=mS,e.Spreadsheet=ub,e.UIPlugin=Fg,e.__info__=pS,e.addFunction=function(e,t){Pu.add(e,t)},e.astToFormula=gg,e.cellTypes=vS,e.compile=Tg,e.components=SS,e.convertAstNodes=ug,e.coreTypes=cn,e.findCellInNewZone=Zi,e.functionCache=Ig,e.helpers=bS,e.invalidateEvaluationCommands=sn,e.load=Bf,e.parse=hg,e.readonlyAllowedCommands=ln,e.registries=fS,e.setTranslationMethod=function(e){i=e},e.tokenize=Bu,Object.defineProperty(e,"__esModule",{value:!0}),pS.version="16.0.36",pS.date="2024-03-25T09:36:40.811Z",pS.hash="2c2117b"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
@@ -3238,7 +3238,7 @@ https://fontawesome.com/license -->
3238
3238
  </t>
3239
3239
  </odoo>
3240
3240
  <!--
3241
- __info__.version = '16.0.35';
3242
- __info__.date = '2024-03-15T10:57:36.770Z';
3243
- __info__.hash = '5cba28b';
3241
+ __info__.version = '16.0.36';
3242
+ __info__.date = '2024-03-25T09:37:03.176Z';
3243
+ __info__.hash = '2c2117b';
3244
3244
  -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "16.0.35",
3
+ "version": "16.0.36",
4
4
  "description": "A spreadsheet component",
5
5
  "main": "dist/o-spreadsheet.cjs.js",
6
6
  "browser": "dist/o-spreadsheet.iife.js",