@odoo/o-spreadsheet 15.2.8 → 15.2.9

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.
@@ -27438,6 +27438,7 @@ class Composer extends owl.Component {
27438
27438
  this.autocompleteAPI.moveDown();
27439
27439
  }
27440
27440
  }
27441
+ this.updateCursorIfNeeded();
27441
27442
  }
27442
27443
  processTabKey(ev) {
27443
27444
  ev.preventDefault();
@@ -27491,9 +27492,12 @@ class Composer extends owl.Component {
27491
27492
  }
27492
27493
  else {
27493
27494
  ev.stopPropagation();
27495
+ this.updateCursorIfNeeded();
27494
27496
  }
27495
- const { start, end } = this.contentHelper.getCurrentSelection();
27497
+ }
27498
+ updateCursorIfNeeded() {
27496
27499
  if (!this.getters.isSelectingForComposer()) {
27500
+ const { start, end } = this.contentHelper.getCurrentSelection();
27497
27501
  this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
27498
27502
  this.isKeyStillDown = true;
27499
27503
  }
@@ -31336,6 +31340,6 @@ exports.registries = registries;
31336
31340
  exports.setTranslationMethod = setTranslationMethod;
31337
31341
 
31338
31342
 
31339
- __info__.version = '15.2.8';
31340
- __info__.date = '2023-06-02T10:11:55.097Z';
31341
- __info__.hash = '3e00f8b';
31343
+ __info__.version = '15.2.9';
31344
+ __info__.date = '2023-06-12T13:42:56.116Z';
31345
+ __info__.hash = 'e4aee80';
@@ -4787,6 +4787,7 @@ declare class Composer extends Component<Props$a, SpreadsheetEnv> {
4787
4787
  onCompositionStart(): void;
4788
4788
  onCompositionEnd(): void;
4789
4789
  onKeydown(ev: KeyboardEvent): void;
4790
+ private updateCursorIfNeeded;
4790
4791
  onInput(): void;
4791
4792
  onKeyup(ev: KeyboardEvent): void;
4792
4793
  onMousedown(ev: MouseEvent): void;
@@ -27415,6 +27415,7 @@ class Composer extends Component {
27415
27415
  this.autocompleteAPI.moveDown();
27416
27416
  }
27417
27417
  }
27418
+ this.updateCursorIfNeeded();
27418
27419
  }
27419
27420
  processTabKey(ev) {
27420
27421
  ev.preventDefault();
@@ -27468,9 +27469,12 @@ class Composer extends Component {
27468
27469
  }
27469
27470
  else {
27470
27471
  ev.stopPropagation();
27472
+ this.updateCursorIfNeeded();
27471
27473
  }
27472
- const { start, end } = this.contentHelper.getCurrentSelection();
27474
+ }
27475
+ updateCursorIfNeeded() {
27473
27476
  if (!this.getters.isSelectingForComposer()) {
27477
+ const { start, end } = this.contentHelper.getCurrentSelection();
27474
27478
  this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
27475
27479
  this.isKeyStillDown = true;
27476
27480
  }
@@ -31290,6 +31294,6 @@ const helpers = {
31290
31294
  export { CommandResult, CorePlugin, DATETIME_FORMAT, DataSource, DispatchResult, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, DEBUG as __DEBUG__, __info__, astToFormula, cellTypes, compile, convertAstNodes, coreTypes, functionCache, helpers, invalidateEvaluationCommands, parse, readonlyAllowedCommands, registries, setTranslationMethod };
31291
31295
 
31292
31296
 
31293
- __info__.version = '15.2.8';
31294
- __info__.date = '2023-06-02T10:11:55.097Z';
31295
- __info__.hash = '3e00f8b';
31297
+ __info__.version = '15.2.9';
31298
+ __info__.date = '2023-06-12T13:42:56.116Z';
31299
+ __info__.hash = 'e4aee80';
@@ -27435,6 +27435,7 @@
27435
27435
  this.autocompleteAPI.moveDown();
27436
27436
  }
27437
27437
  }
27438
+ this.updateCursorIfNeeded();
27438
27439
  }
27439
27440
  processTabKey(ev) {
27440
27441
  ev.preventDefault();
@@ -27488,9 +27489,12 @@
27488
27489
  }
27489
27490
  else {
27490
27491
  ev.stopPropagation();
27492
+ this.updateCursorIfNeeded();
27491
27493
  }
27492
- const { start, end } = this.contentHelper.getCurrentSelection();
27494
+ }
27495
+ updateCursorIfNeeded() {
27493
27496
  if (!this.getters.isSelectingForComposer()) {
27497
+ const { start, end } = this.contentHelper.getCurrentSelection();
27494
27498
  this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION", { start, end });
27495
27499
  this.isKeyStillDown = true;
27496
27500
  }
@@ -31335,9 +31339,9 @@
31335
31339
  Object.defineProperty(exports, '__esModule', { value: true });
31336
31340
 
31337
31341
 
31338
- __info__.version = '15.2.8';
31339
- __info__.date = '2023-06-02T10:11:55.097Z';
31340
- __info__.hash = '3e00f8b';
31342
+ __info__.version = '15.2.9';
31343
+ __info__.date = '2023-06-12T13:42:56.116Z';
31344
+ __info__.hash = 'e4aee80';
31341
31345
 
31342
31346
 
31343
31347
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -1926,7 +1926,7 @@
1926
1926
  .o-topbar-toolbar .o-composer-container:focus-within {
1927
1927
  border: 1px solid ${p};
1928
1928
  }
1929
- `;class tg extends t.Component{constructor(){super(...arguments),this.composerRef=Vp("o_composer"),this.getters=this.env.getters,this.dispatch=this.env.dispatch,this.composerState=Bp({positionStart:0,positionEnd:0}),this.autoCompleteState=Bp({showProvider:!1,provider:"functions",search:""}),this.functionDescriptionState=Bp({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:()=>console.warn("Not implemented"),Tab:e=>this.processTabKey(e)},this.contentHelper=new Lp(this.composerRef.el)}get assistantStyle(){if(this.props.delimitation&&this.props.rect){const[e,t,,s]=this.props.rect;let o="";return t>this.props.delimitation.height-(t+s)&&(o+="\n top: -8px;\n transform: translate(0, -100%);\n "),e+300>this.props.delimitation.width&&(o+="right:0px;"),o+="width:300px;"}return"width:300px;"}setup(){Hp((()=>{Os.composer=this;const e=this.composerRef.el;this.contentHelper.updateEl(e),this.processContent()})),Zp((()=>{var e,t;delete Os.composer,null===(t=(e=this.props).onComposerUnmounted)||void 0===t||t.call(e)})),zp((()=>{this.isKeyStillDown||this.processContent()}))}processArrowKeys(e){if(this.getters.isSelectingForComposer())return this.functionDescriptionState.showDescription=!1,void e.preventDefault();("cellFocus"!==this.props.focus||this.autoCompleteState.showProvider)&&(e.stopPropagation(),["ArrowUp","ArrowDown"].includes(e.key)&&this.autoCompleteState.showProvider&&this.autocompleteAPI&&(e.preventDefault(),"ArrowUp"===e.key?this.autocompleteAPI.moveUp():this.autocompleteAPI.moveDown()))}processTabKey(e){if(e.preventDefault(),e.stopPropagation(),this.autoCompleteState.showProvider&&this.autocompleteAPI){const e=this.autocompleteAPI.getValueToFill();if(e)return void this.autoComplete(e)}else this.dispatch("STOP_COMPOSER_RANGE_SELECTION");const t=e.shiftKey?-1:1;this.dispatch("MOVE_POSITION",{deltaX:t,deltaY:0})}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.dispatch("STOP_EDITION"),this.dispatch("MOVE_POSITION",{deltaX:0,deltaY:e.shiftKey?-1:1})}processEscapeKey(){this.dispatch("STOP_EDITION",{cancel:!0})}onCompositionStart(){this.compositionActive=!0}onCompositionEnd(){this.compositionActive=!1}onKeydown(e){let t=this.keyMapping[e.key];t?t.call(this,e):e.stopPropagation();const{start:s,end:o}=this.contentHelper.getCurrentSelection();this.getters.isSelectingForComposer()||(this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:s,end:o}),this.isKeyStillDown=!0)}onInput(){if("inactive"===this.props.focus||!this.shouldProcessInputEvents)return;this.dispatch("STOP_COMPOSER_RANGE_SELECTION");const e=this.composerRef.el;this.dispatch("SET_CURRENT_CONTENT",{content:e.childNodes.length?e.textContent:"",selection:this.contentHelper.getCurrentSelection()})}onKeyup(e){if(this.isKeyStillDown=!1,"inactive"===this.props.focus||["Control","Shift","Tab","Enter"].includes(e.key))return;if(this.autoCompleteState.showProvider&&["ArrowUp","ArrowDown"].includes(e.key))return;if(this.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.dispatch("STOP_COMPOSER_RANGE_SELECTION");const{start:t,end:s}=this.getters.getComposerSelection(),{start:o,end:i}=this.contentHelper.getCurrentSelection();o===t&&i===s||this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",this.contentHelper.getCurrentSelection()),this.processTokenAtCursor(),this.processContent()}onMousedown(e){e.button>0||this.contentHelper.removeSelection()}onClick(){if(this.getters.isReadonly())return;const e=this.contentHelper.getCurrentSelection();this.dispatch("STOP_COMPOSER_RANGE_SELECTION"),"inactive"===this.props.focus&&this.props.onComposerContentFocused(e),this.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.selectRange(0,0);const e=this.getContent();if(0!==e.length){this.contentHelper.setText(e);const{start:t,end:s}=this.getters.getComposerSelection();"inactive"!==this.props.focus&&this.contentHelper.selectRange(t,s)}this.shouldProcessInputEvents=!0}getContent(){let e;const t=this.getters.getCurrentContent(),s=t.startsWith("=")&&this.getters.getCurrentTokens().length>0;return e=""===t?[]:s&&"inactive"!==this.getters.getEditionMode()?this.getColoredTokens():[{value:t}],e}getColoredTokens(){const e=this.getters.getCurrentTokens(),t=this.getters.getTokenAtCursor(),s=[],{end:o}=this.getters.getComposerSelection();for(const i of e){switch(i.type){case"OPERATOR":case"NUMBER":case"FUNCTION":case"COMMA":case"STRING":s.push({value:i.value,color:Qp[i.type]||"#000"});break;case"REFERENCE":const{xc:e,sheetName:o}=ts(i.value);s.push({value:i.value,color:this.rangeColor(e,o)||"#000"});break;case"SYMBOL":let n=i.value;["TRUE","FALSE"].includes(n.toUpperCase())?s.push({value:i.value,color:Yp}):s.push({value:i.value,color:"#000"});break;case"LEFT_PAREN":case"RIGHT_PAREN":t&&["LEFT_PAREN","RIGHT_PAREN"].includes(t.type)&&t.parenIndex&&t.parenIndex===i.parenIndex?s.push({value:i.value,color:"pink"}):s.push({value:i.value,color:Qp[i.type]||"#000"});break;default:s.push({value:i.value,color:"#000"})}"waitingForRangeSelection"===this.getters.getEditionMode()&&o===i.end&&(s[s.length-1].class=Kp)}return s}rangeColor(e,t){if("inactive"===this.getters.getEditionMode())return;const s=this.getters.getHighlights(),o=t?this.getters.getSheetIdByName(t):this.getters.getEditionSheet(),i=s.find((t=>{if(t.sheet!==o)return!1;let s=Ws(e);const{height:i,width:n}=oo(s);return s=i*n==1?this.getters.expandZone(o,Ws(e)):s,t.sheet===o&&Qs(s,t.zone)}));return i&&i.color?i.color:void 0}processTokenAtCursor(){let e=this.getters.getCurrentContent();if(this.autoCompleteState.showProvider=!1,this.functionDescriptionState.showDescription=!1,e.startsWith("=")){const e=this.getters.getTokenAtCursor();if(e){const{xc:t}=ts(e.value);if("FUNCTION"===e.type||"SYMBOL"===e.type&&!es.test(t))this.autoCompleteState.search=e.value,this.autoCompleteState.showProvider=!0;else if(e.functionContext&&"UNKNOWN"!==e.type){const t=e.functionContext,s=t.parent.toUpperCase(),o=qp[s],i=t.argPosition;this.functionDescriptionState.functionName=s,this.functionDescriptionState.functionDescription=o,this.functionDescriptionState.argToFocus=o.getArgToFocus(i+1)-1,this.functionDescriptionState.showDescription=!0}}}}autoComplete(e){if(e){const t=this.getters.getTokenAtCursor();if(t){let s=t.end,o=t.end;["SYMBOL","FUNCTION"].includes(t.type)&&(s=t.start);const i=this.getters.getCurrentTokens();if(this.autoCompleteState.provider&&i.length){e+="(";const s=i.map((e=>e.start)).indexOf(t.start);if(s+1<i.length){"LEFT_PAREN"===i[s+1].type&&o++}}this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:s,end:o})}this.dispatch("REPLACE_COMPOSER_CURSOR_SELECTION",{text:e})}this.processTokenAtCursor()}}tg.template=Jp,tg.style=eg,tg.components={TextValueProvider:Rp,FunctionDescriptionProvider:Up},tg.defaultProps={inputStyle:"",focus:"inactive"};const{useState:sg,onMounted:og}=t.hooks,{xml:ig,css:ng}=t.tags,rg=ig`
1929
+ `;class tg extends t.Component{constructor(){super(...arguments),this.composerRef=Vp("o_composer"),this.getters=this.env.getters,this.dispatch=this.env.dispatch,this.composerState=Bp({positionStart:0,positionEnd:0}),this.autoCompleteState=Bp({showProvider:!1,provider:"functions",search:""}),this.functionDescriptionState=Bp({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:()=>console.warn("Not implemented"),Tab:e=>this.processTabKey(e)},this.contentHelper=new Lp(this.composerRef.el)}get assistantStyle(){if(this.props.delimitation&&this.props.rect){const[e,t,,s]=this.props.rect;let o="";return t>this.props.delimitation.height-(t+s)&&(o+="\n top: -8px;\n transform: translate(0, -100%);\n "),e+300>this.props.delimitation.width&&(o+="right:0px;"),o+="width:300px;"}return"width:300px;"}setup(){Hp((()=>{Os.composer=this;const e=this.composerRef.el;this.contentHelper.updateEl(e),this.processContent()})),Zp((()=>{var e,t;delete Os.composer,null===(t=(e=this.props).onComposerUnmounted)||void 0===t||t.call(e)})),zp((()=>{this.isKeyStillDown||this.processContent()}))}processArrowKeys(e){if(this.getters.isSelectingForComposer())return this.functionDescriptionState.showDescription=!1,void e.preventDefault();("cellFocus"!==this.props.focus||this.autoCompleteState.showProvider)&&(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())}processTabKey(e){if(e.preventDefault(),e.stopPropagation(),this.autoCompleteState.showProvider&&this.autocompleteAPI){const e=this.autocompleteAPI.getValueToFill();if(e)return void this.autoComplete(e)}else this.dispatch("STOP_COMPOSER_RANGE_SELECTION");const t=e.shiftKey?-1:1;this.dispatch("MOVE_POSITION",{deltaX:t,deltaY:0})}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.dispatch("STOP_EDITION"),this.dispatch("MOVE_POSITION",{deltaX:0,deltaY:e.shiftKey?-1:1})}processEscapeKey(){this.dispatch("STOP_EDITION",{cancel:!0})}onCompositionStart(){this.compositionActive=!0}onCompositionEnd(){this.compositionActive=!1}onKeydown(e){let t=this.keyMapping[e.key];t?t.call(this,e):(e.stopPropagation(),this.updateCursorIfNeeded())}updateCursorIfNeeded(){if(!this.getters.isSelectingForComposer()){const{start:e,end:t}=this.contentHelper.getCurrentSelection();this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:e,end:t}),this.isKeyStillDown=!0}}onInput(){if("inactive"===this.props.focus||!this.shouldProcessInputEvents)return;this.dispatch("STOP_COMPOSER_RANGE_SELECTION");const e=this.composerRef.el;this.dispatch("SET_CURRENT_CONTENT",{content:e.childNodes.length?e.textContent:"",selection:this.contentHelper.getCurrentSelection()})}onKeyup(e){if(this.isKeyStillDown=!1,"inactive"===this.props.focus||["Control","Shift","Tab","Enter"].includes(e.key))return;if(this.autoCompleteState.showProvider&&["ArrowUp","ArrowDown"].includes(e.key))return;if(this.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.dispatch("STOP_COMPOSER_RANGE_SELECTION");const{start:t,end:s}=this.getters.getComposerSelection(),{start:o,end:i}=this.contentHelper.getCurrentSelection();o===t&&i===s||this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",this.contentHelper.getCurrentSelection()),this.processTokenAtCursor(),this.processContent()}onMousedown(e){e.button>0||this.contentHelper.removeSelection()}onClick(){if(this.getters.isReadonly())return;const e=this.contentHelper.getCurrentSelection();this.dispatch("STOP_COMPOSER_RANGE_SELECTION"),"inactive"===this.props.focus&&this.props.onComposerContentFocused(e),this.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.selectRange(0,0);const e=this.getContent();if(0!==e.length){this.contentHelper.setText(e);const{start:t,end:s}=this.getters.getComposerSelection();"inactive"!==this.props.focus&&this.contentHelper.selectRange(t,s)}this.shouldProcessInputEvents=!0}getContent(){let e;const t=this.getters.getCurrentContent(),s=t.startsWith("=")&&this.getters.getCurrentTokens().length>0;return e=""===t?[]:s&&"inactive"!==this.getters.getEditionMode()?this.getColoredTokens():[{value:t}],e}getColoredTokens(){const e=this.getters.getCurrentTokens(),t=this.getters.getTokenAtCursor(),s=[],{end:o}=this.getters.getComposerSelection();for(const i of e){switch(i.type){case"OPERATOR":case"NUMBER":case"FUNCTION":case"COMMA":case"STRING":s.push({value:i.value,color:Qp[i.type]||"#000"});break;case"REFERENCE":const{xc:e,sheetName:o}=ts(i.value);s.push({value:i.value,color:this.rangeColor(e,o)||"#000"});break;case"SYMBOL":let n=i.value;["TRUE","FALSE"].includes(n.toUpperCase())?s.push({value:i.value,color:Yp}):s.push({value:i.value,color:"#000"});break;case"LEFT_PAREN":case"RIGHT_PAREN":t&&["LEFT_PAREN","RIGHT_PAREN"].includes(t.type)&&t.parenIndex&&t.parenIndex===i.parenIndex?s.push({value:i.value,color:"pink"}):s.push({value:i.value,color:Qp[i.type]||"#000"});break;default:s.push({value:i.value,color:"#000"})}"waitingForRangeSelection"===this.getters.getEditionMode()&&o===i.end&&(s[s.length-1].class=Kp)}return s}rangeColor(e,t){if("inactive"===this.getters.getEditionMode())return;const s=this.getters.getHighlights(),o=t?this.getters.getSheetIdByName(t):this.getters.getEditionSheet(),i=s.find((t=>{if(t.sheet!==o)return!1;let s=Ws(e);const{height:i,width:n}=oo(s);return s=i*n==1?this.getters.expandZone(o,Ws(e)):s,t.sheet===o&&Qs(s,t.zone)}));return i&&i.color?i.color:void 0}processTokenAtCursor(){let e=this.getters.getCurrentContent();if(this.autoCompleteState.showProvider=!1,this.functionDescriptionState.showDescription=!1,e.startsWith("=")){const e=this.getters.getTokenAtCursor();if(e){const{xc:t}=ts(e.value);if("FUNCTION"===e.type||"SYMBOL"===e.type&&!es.test(t))this.autoCompleteState.search=e.value,this.autoCompleteState.showProvider=!0;else if(e.functionContext&&"UNKNOWN"!==e.type){const t=e.functionContext,s=t.parent.toUpperCase(),o=qp[s],i=t.argPosition;this.functionDescriptionState.functionName=s,this.functionDescriptionState.functionDescription=o,this.functionDescriptionState.argToFocus=o.getArgToFocus(i+1)-1,this.functionDescriptionState.showDescription=!0}}}}autoComplete(e){if(e){const t=this.getters.getTokenAtCursor();if(t){let s=t.end,o=t.end;["SYMBOL","FUNCTION"].includes(t.type)&&(s=t.start);const i=this.getters.getCurrentTokens();if(this.autoCompleteState.provider&&i.length){e+="(";const s=i.map((e=>e.start)).indexOf(t.start);if(s+1<i.length){"LEFT_PAREN"===i[s+1].type&&o++}}this.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",{start:s,end:o})}this.dispatch("REPLACE_COMPOSER_CURSOR_SELECTION",{text:e})}this.processTokenAtCursor()}}tg.template=Jp,tg.style=eg,tg.components={TextValueProvider:Rp,FunctionDescriptionProvider:Up},tg.defaultProps={inputStyle:"",focus:"inactive"};const{useState:sg,onMounted:og}=t.hooks,{xml:ig,css:ng}=t.tags,rg=ig`
1930
1930
  <div class="o-grid-composer" t-att-style="containerStyle">
1931
1931
  <Composer
1932
1932
  focus = "props.focus"
@@ -3087,4 +3087,4 @@
3087
3087
  height: ${15}px;
3088
3088
  vertical-align: sub;
3089
3089
  }
3090
- `;class Wf extends t.Component{constructor(e,s={}){super(e,s),this.model=new Nu(this.props.data,{evalContext:{env:this.env},transportService:this.props.transportService,client:this.props.client,isReadonly:this.props.isReadonly,snapshotRequested:this.props.snapshotRequested},this.props.stateUpdateMessages),this.sidePanel=t.useState({isOpen:!1,panelProps:{}}),this.linkEditor=t.useState({isOpen:!1}),this.composer=t.useState({topBarFocus:"inactive",gridFocusMode:"inactive"}),this.keyDownMapping={"CTRL+H":()=>this.toggleSidePanel("FindAndReplace",{}),"CTRL+F":()=>this.toggleSidePanel("FindAndReplace",{})},Pf({openSidePanel:(e,t={})=>this.openSidePanel(e,t),toggleSidePanel:(e,t={})=>this.toggleSidePanel(e,t),dispatch:this.model.dispatch,getters:this.model.getters,uuidGenerator:this.model.uuidGenerator,_t:Wf._t,clipboard:navigator.clipboard,export:this.model.exportData.bind(this.model),waitForIdle:this.model.waitForIdle.bind(this.model),exportXLSX:this.model.exportXLSX.bind(this.model),openLinkEditor:()=>this.openLinkEditor()}),this.activateFirstSheet()}setup(){Df(window,"resize",this.render),Df(document.body,"keyup",this.onKeyup.bind(this)),Df(window,"beforeunload",this.leaveCollaborativeSession.bind(this)),Uf((()=>this.initiateModelEvents())),Vf((()=>this.leaveCollaborativeSession())),Bf((e=>this.checkReadonly(e)))}get focusTopBarComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.topBarFocus}get focusGridComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.gridFocusMode}initiateModelEvents(){this.model.on("update",this,this.render),this.model.on("notify-ui",this,this.onNotifyUI),this.model.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.props.client&&this.model.joinSession(this.props.client)}onNotifyUI(e){if("NOTIFICATION"===e.type)this.env.notifyUser(e.text)}checkReadonly(e){this.props.isReadonly!==e.isReadonly&&this.model.updateReadOnly(e.isReadonly)}leaveCollaborativeSession(){this.model.off("update",this),this.model.leaveSession()}activateFirstSheet(){const e=this.model.getters.getActiveSheetId(),[t]=this.model.getters.getSheets();t.id!==e&&this.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:e,sheetIdTo:t.id})}destroy(){this.model.destroy(),super.destroy()}openSidePanel(e,t){this.sidePanel.component=e,this.sidePanel.panelProps=t,this.sidePanel.isOpen=!0}closeSidePanel(){this.sidePanel.isOpen=!1,this.focusGrid()}openLinkEditor(){this.linkEditor.isOpen=!0}closeLinkEditor(){this.linkEditor.isOpen=!1,this.focusGrid()}toggleSidePanel(e,t){this.sidePanel.isOpen&&e===this.sidePanel.component?(this.sidePanel.isOpen=!1,this.focusGrid()):this.openSidePanel(e,t)}focusGrid(){if(!this._focusGrid)throw new Error("_focusGrid should be exposed by the grid component");this._focusGrid()}save(){this.trigger("save-content",{data:this.model.exportData()})}onKeyup(e){"Control"===e.key&&this.model.getters.getSelectionMode()!==Rh.expanding&&this.model.dispatch("STOP_SELECTION")}onKeydown(e){"Control"!==e.key||e.repeat||this.model.dispatch(this.model.getters.getSelectionMode()===Rh.idle?"PREPARE_SELECTION_EXPANSION":"START_SELECTION_EXPANSION");let t="";(e.ctrlKey||e.metaKey)&&(t+="CTRL+"),t+=e.key.toUpperCase();let s=this.keyDownMapping[t];if(s)return e.preventDefault(),e.stopPropagation(),void s()}onTopBarComposerFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="contentFocus",this.composer.gridFocusMode="inactive",this.setComposerContent({selection:e}||{}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}onGridComposerContentFocused(){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="contentFocus",this.setComposerContent({}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}onGridComposerCellFocused(e,t){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="cellFocus",this.setComposerContent({content:e,selection:t}||{}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}setComposerContent({content:e,selection:t}){"inactive"===this.model.getters.getEditionMode()?this.model.dispatch("START_EDITION",{text:e,selection:t}):e&&this.model.dispatch("SET_CURRENT_CONTENT",{content:e,selection:t})}}Wf.template=Zf,Wf.style=Gf,Wf.components={TopBar:$f,Grid:wf,BottomBar:ip,SidePanel:Mf,LinkEditor:ef},Wf._t=e=>e;const qf={},jf={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:m,HEADER_WIDTH:v,TOPBAR_HEIGHT:E,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:b,DEFAULT_CELL_HEIGHT:S,SCROLLBAR_WIDTH:C},Xf={autofillModifiersRegistry:La,autofillRulesRegistry:Ma,cellMenuRegistry:gl,colMenuRegistry:fl,linkMenuRegistry:ml,functionRegistry:cr,uiPluginRegistry:ad,corePluginRegistry:rd,rowMenuRegistry:vl,sidePanelRegistry:bh,sheetMenuRegistry:bl,topbarMenuRegistry:Sl,topbarComponentRegistry:Sh,otRegistry:Cl,inverseCommandRegistry:_a,cellRegistry:Wr},Yf={LinkCell:ta},Kf={args:Oe,toBoolean:fe,toNumber:de,toString:pe,toXC:is,toZone:Ws,toCartesian:os,numberToLetters:ss,createFullMenuItem:ka,UuidGenerator:Bs,formatDecimal:ae,computeTextWidth:vs,isMarkdownLink:xs,parseMarkdownLink:Rs,markdownLink:Ts,createEmptyWorkbookData:ga};e.CorePlugin=ma,e.DATETIME_FORMAT=_,e.DataSource=hd,e.DispatchResult=Ve,e.Model=Nu,e.Registry=Me,e.Revision=Kh,e.SPREADSHEET_DIMENSIONS=jf,e.Spreadsheet=Wf,e.UIPlugin=Ch,e.__DEBUG__=Os,e.__info__=qf,e.astToFormula=Fr,e.cellTypes=Yf,e.compile=Zr,e.convertAstNodes=kr,e.coreTypes=Pe,e.functionCache=zr,e.helpers=Kf,e.invalidateEvaluationCommands=$e,e.parse=Or,e.readonlyAllowedCommands=De,e.registries=Xf,e.setTranslationMethod=function(e){i=e},Object.defineProperty(e,"__esModule",{value:!0}),qf.version="15.2.8",qf.date="2023-06-02T10:11:55.097Z",qf.hash="3e00f8b"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
3090
+ `;class Wf extends t.Component{constructor(e,s={}){super(e,s),this.model=new Nu(this.props.data,{evalContext:{env:this.env},transportService:this.props.transportService,client:this.props.client,isReadonly:this.props.isReadonly,snapshotRequested:this.props.snapshotRequested},this.props.stateUpdateMessages),this.sidePanel=t.useState({isOpen:!1,panelProps:{}}),this.linkEditor=t.useState({isOpen:!1}),this.composer=t.useState({topBarFocus:"inactive",gridFocusMode:"inactive"}),this.keyDownMapping={"CTRL+H":()=>this.toggleSidePanel("FindAndReplace",{}),"CTRL+F":()=>this.toggleSidePanel("FindAndReplace",{})},Pf({openSidePanel:(e,t={})=>this.openSidePanel(e,t),toggleSidePanel:(e,t={})=>this.toggleSidePanel(e,t),dispatch:this.model.dispatch,getters:this.model.getters,uuidGenerator:this.model.uuidGenerator,_t:Wf._t,clipboard:navigator.clipboard,export:this.model.exportData.bind(this.model),waitForIdle:this.model.waitForIdle.bind(this.model),exportXLSX:this.model.exportXLSX.bind(this.model),openLinkEditor:()=>this.openLinkEditor()}),this.activateFirstSheet()}setup(){Df(window,"resize",this.render),Df(document.body,"keyup",this.onKeyup.bind(this)),Df(window,"beforeunload",this.leaveCollaborativeSession.bind(this)),Uf((()=>this.initiateModelEvents())),Vf((()=>this.leaveCollaborativeSession())),Bf((e=>this.checkReadonly(e)))}get focusTopBarComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.topBarFocus}get focusGridComposer(){return"inactive"===this.model.getters.getEditionMode()?"inactive":this.composer.gridFocusMode}initiateModelEvents(){this.model.on("update",this,this.render),this.model.on("notify-ui",this,this.onNotifyUI),this.model.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.props.client&&this.model.joinSession(this.props.client)}onNotifyUI(e){if("NOTIFICATION"===e.type)this.env.notifyUser(e.text)}checkReadonly(e){this.props.isReadonly!==e.isReadonly&&this.model.updateReadOnly(e.isReadonly)}leaveCollaborativeSession(){this.model.off("update",this),this.model.leaveSession()}activateFirstSheet(){const e=this.model.getters.getActiveSheetId(),[t]=this.model.getters.getSheets();t.id!==e&&this.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:e,sheetIdTo:t.id})}destroy(){this.model.destroy(),super.destroy()}openSidePanel(e,t){this.sidePanel.component=e,this.sidePanel.panelProps=t,this.sidePanel.isOpen=!0}closeSidePanel(){this.sidePanel.isOpen=!1,this.focusGrid()}openLinkEditor(){this.linkEditor.isOpen=!0}closeLinkEditor(){this.linkEditor.isOpen=!1,this.focusGrid()}toggleSidePanel(e,t){this.sidePanel.isOpen&&e===this.sidePanel.component?(this.sidePanel.isOpen=!1,this.focusGrid()):this.openSidePanel(e,t)}focusGrid(){if(!this._focusGrid)throw new Error("_focusGrid should be exposed by the grid component");this._focusGrid()}save(){this.trigger("save-content",{data:this.model.exportData()})}onKeyup(e){"Control"===e.key&&this.model.getters.getSelectionMode()!==Rh.expanding&&this.model.dispatch("STOP_SELECTION")}onKeydown(e){"Control"!==e.key||e.repeat||this.model.dispatch(this.model.getters.getSelectionMode()===Rh.idle?"PREPARE_SELECTION_EXPANSION":"START_SELECTION_EXPANSION");let t="";(e.ctrlKey||e.metaKey)&&(t+="CTRL+"),t+=e.key.toUpperCase();let s=this.keyDownMapping[t];if(s)return e.preventDefault(),e.stopPropagation(),void s()}onTopBarComposerFocused(e){this.model.getters.isReadonly()||(this.composer.topBarFocus="contentFocus",this.composer.gridFocusMode="inactive",this.setComposerContent({selection:e}||{}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}onGridComposerContentFocused(){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="contentFocus",this.setComposerContent({}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}onGridComposerCellFocused(e,t){this.model.getters.isReadonly()||(this.composer.topBarFocus="inactive",this.composer.gridFocusMode="cellFocus",this.setComposerContent({content:e,selection:t}||{}),this.env.dispatch("UNFOCUS_SELECTION_INPUT"))}setComposerContent({content:e,selection:t}){"inactive"===this.model.getters.getEditionMode()?this.model.dispatch("START_EDITION",{text:e,selection:t}):e&&this.model.dispatch("SET_CURRENT_CONTENT",{content:e,selection:t})}}Wf.template=Zf,Wf.style=Gf,Wf.components={TopBar:$f,Grid:wf,BottomBar:ip,SidePanel:Mf,LinkEditor:ef},Wf._t=e=>e;const qf={},jf={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:m,HEADER_WIDTH:v,TOPBAR_HEIGHT:E,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:b,DEFAULT_CELL_HEIGHT:S,SCROLLBAR_WIDTH:C},Xf={autofillModifiersRegistry:La,autofillRulesRegistry:Ma,cellMenuRegistry:gl,colMenuRegistry:fl,linkMenuRegistry:ml,functionRegistry:cr,uiPluginRegistry:ad,corePluginRegistry:rd,rowMenuRegistry:vl,sidePanelRegistry:bh,sheetMenuRegistry:bl,topbarMenuRegistry:Sl,topbarComponentRegistry:Sh,otRegistry:Cl,inverseCommandRegistry:_a,cellRegistry:Wr},Yf={LinkCell:ta},Kf={args:Oe,toBoolean:fe,toNumber:de,toString:pe,toXC:is,toZone:Ws,toCartesian:os,numberToLetters:ss,createFullMenuItem:ka,UuidGenerator:Bs,formatDecimal:ae,computeTextWidth:vs,isMarkdownLink:xs,parseMarkdownLink:Rs,markdownLink:Ts,createEmptyWorkbookData:ga};e.CorePlugin=ma,e.DATETIME_FORMAT=_,e.DataSource=hd,e.DispatchResult=Ve,e.Model=Nu,e.Registry=Me,e.Revision=Kh,e.SPREADSHEET_DIMENSIONS=jf,e.Spreadsheet=Wf,e.UIPlugin=Ch,e.__DEBUG__=Os,e.__info__=qf,e.astToFormula=Fr,e.cellTypes=Yf,e.compile=Zr,e.convertAstNodes=kr,e.coreTypes=Pe,e.functionCache=zr,e.helpers=Kf,e.invalidateEvaluationCommands=$e,e.parse=Or,e.readonlyAllowedCommands=De,e.registries=Xf,e.setTranslationMethod=function(e){i=e},Object.defineProperty(e,"__esModule",{value:!0}),qf.version="15.2.9",qf.date="2023-06-12T13:42:56.116Z",qf.hash="e4aee80"}(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": "15.2.8",
3
+ "version": "15.2.9",
4
4
  "description": "A spreadsheet component",
5
5
  "main": "dist/o-spreadsheet.cjs.js",
6
6
  "browser": "dist/o-spreadsheet.iife.js",