@odoo/o-spreadsheet 16.3.37 → 16.3.38

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.
@@ -5355,8 +5355,7 @@ function isCtrlKey(ev) {
5355
5355
  */
5356
5356
  function useSpreadsheetRect() {
5357
5357
  const position = owl.useState({ x: 0, y: 0, width: 0, height: 0 });
5358
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
5359
- updatePosition();
5358
+ let spreadsheetElement = null;
5360
5359
  function updatePosition() {
5361
5360
  if (!spreadsheetElement) {
5362
5361
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -21284,8 +21283,15 @@ class Composer extends owl.Component {
21284
21283
  }
21285
21284
  onPaste(ev) {
21286
21285
  if (this.env.model.getters.getEditionMode() !== "inactive") {
21286
+ // let the browser clipboard work
21287
21287
  ev.stopPropagation();
21288
21288
  }
21289
+ else {
21290
+ // the user meant to paste in the sheet, not open the composer with the pasted content
21291
+ // While we're not editing, we still have the focus and should therefore prevent
21292
+ // the native "paste" to occur.
21293
+ ev.preventDefault();
21294
+ }
21289
21295
  }
21290
21296
  /*
21291
21297
  * Triggered automatically by the content-editable between the keydown and key up
@@ -21294,10 +21300,6 @@ class Composer extends owl.Component {
21294
21300
  if (!this.shouldProcessInputEvents) {
21295
21301
  return;
21296
21302
  }
21297
- if (ev.inputType === "insertFromPaste" &&
21298
- this.env.model.getters.getEditionMode() === "inactive") {
21299
- return;
21300
- }
21301
21303
  ev.stopPropagation();
21302
21304
  let content;
21303
21305
  if (this.env.model.getters.getEditionMode() === "inactive") {
@@ -21698,10 +21700,7 @@ class GridComposer extends owl.Component {
21698
21700
  }
21699
21701
  get containerStyle() {
21700
21702
  if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
21701
- return `
21702
- position: absolute;
21703
- z-index: -1000;
21704
- `;
21703
+ return `z-index: -1000;`;
21705
21704
  }
21706
21705
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
21707
21706
  const cell = this.env.model.getters.getActiveCell();
@@ -48162,6 +48161,6 @@ exports.setTranslationMethod = setTranslationMethod;
48162
48161
  exports.tokenize = tokenize;
48163
48162
 
48164
48163
 
48165
- __info__.version = '16.3.37';
48166
- __info__.date = '2024-06-03T14:49:37.305Z';
48167
- __info__.hash = 'e7bf8e1';
48164
+ __info__.version = '16.3.38';
48165
+ __info__.date = '2024-06-10T09:33:40.314Z';
48166
+ __info__.hash = '2fcf01c';
@@ -5351,8 +5351,7 @@ function isCtrlKey(ev) {
5351
5351
  */
5352
5352
  function useSpreadsheetRect() {
5353
5353
  const position = useState({ x: 0, y: 0, width: 0, height: 0 });
5354
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
5355
- updatePosition();
5354
+ let spreadsheetElement = null;
5356
5355
  function updatePosition() {
5357
5356
  if (!spreadsheetElement) {
5358
5357
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -21280,8 +21279,15 @@ class Composer extends Component {
21280
21279
  }
21281
21280
  onPaste(ev) {
21282
21281
  if (this.env.model.getters.getEditionMode() !== "inactive") {
21282
+ // let the browser clipboard work
21283
21283
  ev.stopPropagation();
21284
21284
  }
21285
+ else {
21286
+ // the user meant to paste in the sheet, not open the composer with the pasted content
21287
+ // While we're not editing, we still have the focus and should therefore prevent
21288
+ // the native "paste" to occur.
21289
+ ev.preventDefault();
21290
+ }
21285
21291
  }
21286
21292
  /*
21287
21293
  * Triggered automatically by the content-editable between the keydown and key up
@@ -21290,10 +21296,6 @@ class Composer extends Component {
21290
21296
  if (!this.shouldProcessInputEvents) {
21291
21297
  return;
21292
21298
  }
21293
- if (ev.inputType === "insertFromPaste" &&
21294
- this.env.model.getters.getEditionMode() === "inactive") {
21295
- return;
21296
- }
21297
21299
  ev.stopPropagation();
21298
21300
  let content;
21299
21301
  if (this.env.model.getters.getEditionMode() === "inactive") {
@@ -21694,10 +21696,7 @@ class GridComposer extends Component {
21694
21696
  }
21695
21697
  get containerStyle() {
21696
21698
  if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
21697
- return `
21698
- position: absolute;
21699
- z-index: -1000;
21700
- `;
21699
+ return `z-index: -1000;`;
21701
21700
  }
21702
21701
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
21703
21702
  const cell = this.env.model.getters.getActiveCell();
@@ -48130,6 +48129,6 @@ function addFunction(functionName, functionDescription) {
48130
48129
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
48131
48130
 
48132
48131
 
48133
- __info__.version = '16.3.37';
48134
- __info__.date = '2024-06-03T14:49:37.305Z';
48135
- __info__.hash = 'e7bf8e1';
48132
+ __info__.version = '16.3.38';
48133
+ __info__.date = '2024-06-10T09:33:40.314Z';
48134
+ __info__.hash = '2fcf01c';
@@ -5352,8 +5352,7 @@
5352
5352
  */
5353
5353
  function useSpreadsheetRect() {
5354
5354
  const position = owl.useState({ x: 0, y: 0, width: 0, height: 0 });
5355
- let spreadsheetElement = document.querySelector(".o-spreadsheet");
5356
- updatePosition();
5355
+ let spreadsheetElement = null;
5357
5356
  function updatePosition() {
5358
5357
  if (!spreadsheetElement) {
5359
5358
  spreadsheetElement = document.querySelector(".o-spreadsheet");
@@ -21281,8 +21280,15 @@
21281
21280
  }
21282
21281
  onPaste(ev) {
21283
21282
  if (this.env.model.getters.getEditionMode() !== "inactive") {
21283
+ // let the browser clipboard work
21284
21284
  ev.stopPropagation();
21285
21285
  }
21286
+ else {
21287
+ // the user meant to paste in the sheet, not open the composer with the pasted content
21288
+ // While we're not editing, we still have the focus and should therefore prevent
21289
+ // the native "paste" to occur.
21290
+ ev.preventDefault();
21291
+ }
21286
21292
  }
21287
21293
  /*
21288
21294
  * Triggered automatically by the content-editable between the keydown and key up
@@ -21291,10 +21297,6 @@
21291
21297
  if (!this.shouldProcessInputEvents) {
21292
21298
  return;
21293
21299
  }
21294
- if (ev.inputType === "insertFromPaste" &&
21295
- this.env.model.getters.getEditionMode() === "inactive") {
21296
- return;
21297
- }
21298
21300
  ev.stopPropagation();
21299
21301
  let content;
21300
21302
  if (this.env.model.getters.getEditionMode() === "inactive") {
@@ -21695,10 +21697,7 @@
21695
21697
  }
21696
21698
  get containerStyle() {
21697
21699
  if (this.env.model.getters.getEditionMode() === "inactive" || !this.rect) {
21698
- return `
21699
- position: absolute;
21700
- z-index: -1000;
21701
- `;
21700
+ return `z-index: -1000;`;
21702
21701
  }
21703
21702
  const isFormula = this.env.model.getters.getCurrentContent().startsWith("=");
21704
21703
  const cell = this.env.model.getters.getActiveCell();
@@ -48161,9 +48160,9 @@
48161
48160
  Object.defineProperty(exports, '__esModule', { value: true });
48162
48161
 
48163
48162
 
48164
- __info__.version = '16.3.37';
48165
- __info__.date = '2024-06-03T14:49:37.305Z';
48166
- __info__.hash = 'e7bf8e1';
48163
+ __info__.version = '16.3.38';
48164
+ __info__.date = '2024-06-10T09:33:40.314Z';
48165
+ __info__.hash = '2fcf01c';
48167
48166
 
48168
48167
 
48169
48168
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -163,7 +163,7 @@
163
163
  }
164
164
  }
165
165
  }
166
- `;class tn extends t.Component{static size={width:G,height:295};static template="o-spreadsheet-FilterMenu";static style=en;static components={FilterMenuValueItem:Js};state=t.useState({values:[],textFilter:"",selectedValue:void 0});searchBar=t.useRef("filterMenuSearchBar");setup(){t.onWillUpdateProps((e=>{vt(e.filterPosition,this.props.filterPosition)||(this.state.values=this.getFilterValues(e.filterPosition))})),this.state.values=this.getFilterValues(this.props.filterPosition)}get isReadonly(){return this.env.model.getters.isReadonly()}getFilterValues(e){const t=this.env.model.getters.getActiveSheetId(),o=this.env.model.getters.getFilter({sheetId:t,...e});if(!o)return[];const i=(o.filteredZone?Ci(o.filteredZone):[]).filter((({row:e})=>!this.env.model.getters.isRowHidden(t,e))).map((({col:e,row:o})=>this.env.model.getters.getEvaluatedCell({sheetId:t,col:e,row:o}).formattedValue)),s=this.env.model.getters.getFilterValues({sheetId:t,...e}),n=[...i,...s],r=s.map(Et);return[...new Set(n.map(Et))].sort(((e,t)=>e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"}))).map((e=>({checked:-1===r.findIndex((t=>t===e)),string:n.find((t=>Et(t)===e))||""})))}checkValue(e){this.state.selectedValue=e.string,e.checked=!e.checked,this.searchBar.el?.focus()}onMouseMove(e){this.state.selectedValue=e.string}selectAll(){this.state.values.forEach((e=>e.checked=!0))}clearAll(){this.state.values.forEach((e=>e.checked=!1))}get filterTable(){const e=this.env.model.getters.getActiveSheetId(),t=this.props.filterPosition;return this.env.model.getters.getFilterTable({sheetId:e,...t})}get displayedValues(){return this.state.textFilter?Jo(this.state.textFilter,this.state.values,(e=>e.string)):this.state.values}confirm(){const e=this.props.filterPosition;this.env.model.dispatch("UPDATE_FILTER",{...e,sheetId:this.env.model.getters.getActiveSheetId(),values:this.state.values.filter((e=>!e.checked)).map((e=>e.string))}),this.props.onClosed?.()}cancel(){this.props.onClosed?.()}onKeyDown(e){const t=this.displayedValues;if(0===t.length)return;let o;if(void 0!==this.state.selectedValue){const e=t.findIndex((e=>e.string===this.state.selectedValue));o=-1===e?void 0:e}switch(e.key){case"ArrowDown":o=void 0===o?0:Math.min(o+1,t.length-1),e.preventDefault(),e.stopPropagation();break;case"ArrowUp":o=void 0===o?t.length-1:Math.max(o-1,0),e.preventDefault(),e.stopPropagation();break;case"Enter":void 0!==o&&this.checkValue(t[o]),e.stopPropagation(),e.preventDefault()}this.state.selectedValue=void 0!==o?t[o].string:void 0,"ArrowUp"!==e.key&&"ArrowDown"!==e.key||this.scrollListToSelectedValue(e.key)}clearScrolledToValue(){this.state.values.forEach((e=>e.scrolledTo=void 0))}scrollListToSelectedValue(e){this.clearScrolledToValue();const t=this.state.values.find((e=>e.string===this.state.selectedValue));t&&(t.scrolledTo="ArrowUp"===e?"top":"bottom")}sortFilterZone(e){const t=this.props.filterPosition,o=this.filterTable;if(!t||!o||!o.contentZone)return;const i=this.env.model.getters.getActiveSheetId();this.env.model.dispatch("SORT_CELLS",{sheetId:i,col:t.col,row:o.contentZone.top,zone:o.contentZone,sortDirection:e,sortOptions:{emptyCellAsZero:!0,sortHeaders:!0}}),this.props.onClosed?.()}}tn.props={filterPosition:Object,onClosed:{type:Function,optional:!0}};const on={onOpen:(e,t)=>({isOpen:!0,props:{filterPosition:e},Component:tn,cellCorner:"BottomLeft"})},sn=/Mac/i,nn=["Shift","Control","Alt","Meta"];function rn(e,t){return!!t.target&&e.contains(t.target)}function an(){const e=document.querySelector(".o-grid-overlay");if(e){const{top:t,left:o}=e?.getBoundingClientRect();return{top:t,left:o}}throw new Error("Can't find spreadsheet position")}function ln(e){const t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}}function*cn(e){if(yield e,e.hasChildNodes())for(let t of e.childNodes)yield*cn(t)}const hn=/^[a-zA-Z]$/;function dn(){return Boolean(sn.test(navigator.userAgent))}function un(e){return dn()?e.metaKey:e.ctrlKey}function gn(){const e=t.useState({x:0,y:0,width:0,height:0});let o=document.querySelector(".o-spreadsheet");function i(){if(o||(o=document.querySelector(".o-spreadsheet")),o){const{top:t,left:i,width:s,height:n}=o.getBoundingClientRect();e.x=i,e.y=t,e.width=s,e.height=n}}return i(),t.onMounted(i),t.onPatched(i),e}function pn(e){const o=t.useState({x:0,y:0,width:0,height:0});function i(){const t=e.el;if(null===t)return;const{top:i,left:s,width:n,height:r}=t.getBoundingClientRect();o.x=s,o.y=i,o.width=n,o.height=r}return t.onMounted(i),t.onPatched(i),o}function mn(e,t){return bn(di(fn(e),fn(t)))}function fn(e){return{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height}}function bn(e){if(e)return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}Ni`
166
+ `;class tn extends t.Component{static size={width:G,height:295};static template="o-spreadsheet-FilterMenu";static style=en;static components={FilterMenuValueItem:Js};state=t.useState({values:[],textFilter:"",selectedValue:void 0});searchBar=t.useRef("filterMenuSearchBar");setup(){t.onWillUpdateProps((e=>{vt(e.filterPosition,this.props.filterPosition)||(this.state.values=this.getFilterValues(e.filterPosition))})),this.state.values=this.getFilterValues(this.props.filterPosition)}get isReadonly(){return this.env.model.getters.isReadonly()}getFilterValues(e){const t=this.env.model.getters.getActiveSheetId(),o=this.env.model.getters.getFilter({sheetId:t,...e});if(!o)return[];const i=(o.filteredZone?Ci(o.filteredZone):[]).filter((({row:e})=>!this.env.model.getters.isRowHidden(t,e))).map((({col:e,row:o})=>this.env.model.getters.getEvaluatedCell({sheetId:t,col:e,row:o}).formattedValue)),s=this.env.model.getters.getFilterValues({sheetId:t,...e}),n=[...i,...s],r=s.map(Et);return[...new Set(n.map(Et))].sort(((e,t)=>e.localeCompare(t,void 0,{numeric:!0,sensitivity:"base"}))).map((e=>({checked:-1===r.findIndex((t=>t===e)),string:n.find((t=>Et(t)===e))||""})))}checkValue(e){this.state.selectedValue=e.string,e.checked=!e.checked,this.searchBar.el?.focus()}onMouseMove(e){this.state.selectedValue=e.string}selectAll(){this.state.values.forEach((e=>e.checked=!0))}clearAll(){this.state.values.forEach((e=>e.checked=!1))}get filterTable(){const e=this.env.model.getters.getActiveSheetId(),t=this.props.filterPosition;return this.env.model.getters.getFilterTable({sheetId:e,...t})}get displayedValues(){return this.state.textFilter?Jo(this.state.textFilter,this.state.values,(e=>e.string)):this.state.values}confirm(){const e=this.props.filterPosition;this.env.model.dispatch("UPDATE_FILTER",{...e,sheetId:this.env.model.getters.getActiveSheetId(),values:this.state.values.filter((e=>!e.checked)).map((e=>e.string))}),this.props.onClosed?.()}cancel(){this.props.onClosed?.()}onKeyDown(e){const t=this.displayedValues;if(0===t.length)return;let o;if(void 0!==this.state.selectedValue){const e=t.findIndex((e=>e.string===this.state.selectedValue));o=-1===e?void 0:e}switch(e.key){case"ArrowDown":o=void 0===o?0:Math.min(o+1,t.length-1),e.preventDefault(),e.stopPropagation();break;case"ArrowUp":o=void 0===o?t.length-1:Math.max(o-1,0),e.preventDefault(),e.stopPropagation();break;case"Enter":void 0!==o&&this.checkValue(t[o]),e.stopPropagation(),e.preventDefault()}this.state.selectedValue=void 0!==o?t[o].string:void 0,"ArrowUp"!==e.key&&"ArrowDown"!==e.key||this.scrollListToSelectedValue(e.key)}clearScrolledToValue(){this.state.values.forEach((e=>e.scrolledTo=void 0))}scrollListToSelectedValue(e){this.clearScrolledToValue();const t=this.state.values.find((e=>e.string===this.state.selectedValue));t&&(t.scrolledTo="ArrowUp"===e?"top":"bottom")}sortFilterZone(e){const t=this.props.filterPosition,o=this.filterTable;if(!t||!o||!o.contentZone)return;const i=this.env.model.getters.getActiveSheetId();this.env.model.dispatch("SORT_CELLS",{sheetId:i,col:t.col,row:o.contentZone.top,zone:o.contentZone,sortDirection:e,sortOptions:{emptyCellAsZero:!0,sortHeaders:!0}}),this.props.onClosed?.()}}tn.props={filterPosition:Object,onClosed:{type:Function,optional:!0}};const on={onOpen:(e,t)=>({isOpen:!0,props:{filterPosition:e},Component:tn,cellCorner:"BottomLeft"})},sn=/Mac/i,nn=["Shift","Control","Alt","Meta"];function rn(e,t){return!!t.target&&e.contains(t.target)}function an(){const e=document.querySelector(".o-grid-overlay");if(e){const{top:t,left:o}=e?.getBoundingClientRect();return{top:t,left:o}}throw new Error("Can't find spreadsheet position")}function ln(e){const t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}}function*cn(e){if(yield e,e.hasChildNodes())for(let t of e.childNodes)yield*cn(t)}const hn=/^[a-zA-Z]$/;function dn(){return Boolean(sn.test(navigator.userAgent))}function un(e){return dn()?e.metaKey:e.ctrlKey}function gn(){const e=t.useState({x:0,y:0,width:0,height:0});let o=null;function i(){if(o||(o=document.querySelector(".o-spreadsheet")),o){const{top:t,left:i,width:s,height:n}=o.getBoundingClientRect();e.x=i,e.y=t,e.width=s,e.height=n}}return t.onMounted(i),t.onPatched(i),e}function pn(e){const o=t.useState({x:0,y:0,width:0,height:0});function i(){const t=e.el;if(null===t)return;const{top:i,left:s,width:n,height:r}=t.getBoundingClientRect();o.x=s,o.y=i,o.width=n,o.height=r}return t.onMounted(i),t.onPatched(i),o}function mn(e,t){return bn(di(fn(e),fn(t)))}function fn(e){return{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height}}function bn(e){if(e)return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}Ni`
167
167
  .o-popover {
168
168
  position: absolute;
169
169
  z-index: ${ue.Popover};
@@ -1159,7 +1159,7 @@
1159
1159
  pointer-events: none;
1160
1160
  }
1161
1161
  }
1162
- `;class Of extends t.Component{static template="o-spreadsheet-Composer";static components={TextValueProvider:Ef,FunctionDescriptionProvider:xf};static defaultProps={inputStyle:"",isDefaultFocus:!1};composerRef=t.useRef("o_composer");contentHelper=new wf(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});isKeyStillDown=!1;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",Li(i)}return Li({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:e=>this.processF4Key(e),Tab:e=>this.processTabKey(e)};setup(){t.onMounted((()=>{const e=this.composerRef.el;this.props.isDefaultFocus&&this.env.focusableElement.setFocusableElement(e),this.contentHelper.updateEl(e),this.processContent(),this.contentHelper.scrollSelectionIntoView()})),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,e.preventDefault(),e.stopPropagation(),void Um(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),this.updateCursorIfNeeded()}processTabKey(e){if(e.preventDefault(),e.stopPropagation(),"inactive"!==this.env.model.getters.getEditionMode()){if(this.autoCompleteState.showProvider){const e=this.autoCompleteState.values[this.autoCompleteState.selectedIndex]?.text;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(),e.altKey||e.ctrlKey){const e=this.contentHelper.getCurrentSelection(),t=this.env.model.getters.getCurrentContent(),o=t.slice(0,e.start)+me+t.slice(e.end);return this.env.model.dispatch("SET_CURRENT_CONTENT",{content:o,selection:{start:e.start+1,end:e.start+1}}),this.processContent(),void this.contentHelper.scrollSelectionIntoView()}if(this.isKeyStillDown=!1,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(e){this.env.model.dispatch("CYCLE_EDITION_REFERENCES"),this.processContent(),e.stopPropagation()}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){if(!this.shouldProcessInputEvents)return;if("insertFromPaste"===e.inputType&&"inactive"===this.env.model.getters.getEditionMode())return;let t;if(e.stopPropagation(),t="inactive"===this.env.model.getters.getEditionMode()?e.data||"":this.contentHelper.getText(),"inactive"===this.props.focus)return this.props.onComposerCellFocused?.(t);this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION"),this.env.model.dispatch("SET_CURRENT_CONTENT",{content:t,selection:this.contentHelper.getCurrentSelection()})}onKeyup(e){if(this.isKeyStillDown=!1,"inactive"===this.props.focus||["Control","Alt","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.showAutocomplete(""),void this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");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",this.contentHelper.getCurrentSelection()),this.processTokenAtCursor(),this.processContent()}showAutocomplete(e){this.autoCompleteState.showProvider=!0;let t=Object.entries(Hg.content).filter((([e,{hidden:t}])=>!t)).map((([e,{description:t}])=>({text:e,description:t})));t=e?"true"===e.toLowerCase()||"false"===e.toLowerCase()?[]:Jo(e,t,(e=>e.text)):t.sort(((e,t)=>e.text.localeCompare(t.text))),this.autoCompleteState.values=t.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"),this.props.onComposerContentFocused(),this.props.focus,this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",e),this.processTokenAtCursor()}onBlur(){this.isKeyStillDown=!1}onContextMenu(e){"inactive"===this.env.model.getters.getEditionMode()&&this.props.onInputContextMenu?.(e)}processContent(){if(this.compositionActive)return;const e=this.composerRef.el?.scrollTop||0;this.contentHelper.removeAll(),this.shouldProcessInputEvents=!1,"inactive"!==this.props.focus&&(this.contentHelper.el.focus(),this.contentHelper.selectRange(0,0));const t=this.getContentLines();if(0!==t.length&&0!==t.length[0]){this.contentHelper.setText(t);const{start:o,end:i}=this.env.model.getters.getComposerSelection();"inactive"!==this.props.focus&&this.contentHelper.selectRange(o,i),function(e,t){e&&(e.scrollTop=t)}(this.composerRef.el,e)}this.shouldProcessInputEvents=!0}getContentLines(){let e=this.env.model.getters.getCurrentContent();const t=e.startsWith("=")&&this.env.model.getters.getCurrentTokens().length>0;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 n of e){switch(n.type){case"OPERATOR":case"NUMBER":case"FUNCTION":case"COMMA":case"STRING":o.push({value:n.value,color:Af[n.type]||"#000"});break;case"REFERENCE":const{xc:e,sheetName:i}=Yo(n.value);o.push({value:n.value,color:this.rangeColor(e,i)||"#000"});break;case"SYMBOL":let s=n.value;["TRUE","FALSE"].includes(s.toUpperCase())?o.push({value:n.value,color:Af.NUMBER}):o.push({value:n.value,color:"#000"});break;case"LEFT_PAREN":case"RIGHT_PAREN":t&&["LEFT_PAREN","RIGHT_PAREN"].includes(t.type)&&t.parenIndex&&t.parenIndex===n.parenIndex?o.push({value:n.value,color:Af.MATCHING_PAREN}):o.push({value:n.value,color:Af[n.type]||"#000"});break;default:o.push({value:n.value,color:"#000"})}this.env.model.getters.showSelectionIndicator()&&i===s&&i===n.end&&(o[o.length-1].class=If)}return o}splitHtmlContentIntoLines(e){const t=[];let o=[];for(const i of e)if(i.value.includes(me)){const e=i.value.split(me),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===Ri(o)?this.env.model.getters.expandZone(i,o):o,ui(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){const{xc:t}=Yo(e.value);if("FUNCTION"===e.type||"SYMBOL"===e.type&&!$o.test(t))this.showAutocomplete(e.value);else if(e.functionContext&&"UNKNOWN"!==e.type){const t=e.functionContext,o=t.parent.toUpperCase(),i=yf[o],s=t.argPosition;this.functionDescriptionState.functionName=o,this.functionDescriptionState.functionDescription=i,this.functionDescriptionState.argToFocus=i.getArgToFocus(s+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()}}Of.props={inputStyle:{type:String,optional:!0},rect:{type:Object,optional:!0},delimitation:{type:Object,optional:!0},focus:{validate:e=>["inactive","cellFocus","contentFocus"].includes(e)},onComposerCellFocused:{type:Function,optional:!0},onComposerContentFocused:Function,isDefaultFocus:{type:Boolean,optional:!0},onInputContextMenu:{type:Function,optional:!0}};const Mf=3*.4*window.devicePixelRatio||1;Ni`
1162
+ `;class Of extends t.Component{static template="o-spreadsheet-Composer";static components={TextValueProvider:Ef,FunctionDescriptionProvider:xf};static defaultProps={inputStyle:"",isDefaultFocus:!1};composerRef=t.useRef("o_composer");contentHelper=new wf(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});isKeyStillDown=!1;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",Li(i)}return Li({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:e=>this.processF4Key(e),Tab:e=>this.processTabKey(e)};setup(){t.onMounted((()=>{const e=this.composerRef.el;this.props.isDefaultFocus&&this.env.focusableElement.setFocusableElement(e),this.contentHelper.updateEl(e),this.processContent(),this.contentHelper.scrollSelectionIntoView()})),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,e.preventDefault(),e.stopPropagation(),void Um(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),this.updateCursorIfNeeded()}processTabKey(e){if(e.preventDefault(),e.stopPropagation(),"inactive"!==this.env.model.getters.getEditionMode()){if(this.autoCompleteState.showProvider){const e=this.autoCompleteState.values[this.autoCompleteState.selectedIndex]?.text;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(),e.altKey||e.ctrlKey){const e=this.contentHelper.getCurrentSelection(),t=this.env.model.getters.getCurrentContent(),o=t.slice(0,e.start)+me+t.slice(e.end);return this.env.model.dispatch("SET_CURRENT_CONTENT",{content:o,selection:{start:e.start+1,end:e.start+1}}),this.processContent(),void this.contentHelper.scrollSelectionIntoView()}if(this.isKeyStillDown=!1,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(e){this.env.model.dispatch("CYCLE_EDITION_REFERENCES"),this.processContent(),e.stopPropagation()}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():e.preventDefault()}onInput(e){if(!this.shouldProcessInputEvents)return;let t;if(e.stopPropagation(),t="inactive"===this.env.model.getters.getEditionMode()?e.data||"":this.contentHelper.getText(),"inactive"===this.props.focus)return this.props.onComposerCellFocused?.(t);this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION"),this.env.model.dispatch("SET_CURRENT_CONTENT",{content:t,selection:this.contentHelper.getCurrentSelection()})}onKeyup(e){if(this.isKeyStillDown=!1,"inactive"===this.props.focus||["Control","Alt","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.showAutocomplete(""),void this.env.model.dispatch("STOP_COMPOSER_RANGE_SELECTION");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",this.contentHelper.getCurrentSelection()),this.processTokenAtCursor(),this.processContent()}showAutocomplete(e){this.autoCompleteState.showProvider=!0;let t=Object.entries(Hg.content).filter((([e,{hidden:t}])=>!t)).map((([e,{description:t}])=>({text:e,description:t})));t=e?"true"===e.toLowerCase()||"false"===e.toLowerCase()?[]:Jo(e,t,(e=>e.text)):t.sort(((e,t)=>e.text.localeCompare(t.text))),this.autoCompleteState.values=t.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"),this.props.onComposerContentFocused(),this.props.focus,this.env.model.dispatch("CHANGE_COMPOSER_CURSOR_SELECTION",e),this.processTokenAtCursor()}onBlur(){this.isKeyStillDown=!1}onContextMenu(e){"inactive"===this.env.model.getters.getEditionMode()&&this.props.onInputContextMenu?.(e)}processContent(){if(this.compositionActive)return;const e=this.composerRef.el?.scrollTop||0;this.contentHelper.removeAll(),this.shouldProcessInputEvents=!1,"inactive"!==this.props.focus&&(this.contentHelper.el.focus(),this.contentHelper.selectRange(0,0));const t=this.getContentLines();if(0!==t.length&&0!==t.length[0]){this.contentHelper.setText(t);const{start:o,end:i}=this.env.model.getters.getComposerSelection();"inactive"!==this.props.focus&&this.contentHelper.selectRange(o,i),function(e,t){e&&(e.scrollTop=t)}(this.composerRef.el,e)}this.shouldProcessInputEvents=!0}getContentLines(){let e=this.env.model.getters.getCurrentContent();const t=e.startsWith("=")&&this.env.model.getters.getCurrentTokens().length>0;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 n of e){switch(n.type){case"OPERATOR":case"NUMBER":case"FUNCTION":case"COMMA":case"STRING":o.push({value:n.value,color:Af[n.type]||"#000"});break;case"REFERENCE":const{xc:e,sheetName:i}=Yo(n.value);o.push({value:n.value,color:this.rangeColor(e,i)||"#000"});break;case"SYMBOL":let s=n.value;["TRUE","FALSE"].includes(s.toUpperCase())?o.push({value:n.value,color:Af.NUMBER}):o.push({value:n.value,color:"#000"});break;case"LEFT_PAREN":case"RIGHT_PAREN":t&&["LEFT_PAREN","RIGHT_PAREN"].includes(t.type)&&t.parenIndex&&t.parenIndex===n.parenIndex?o.push({value:n.value,color:Af.MATCHING_PAREN}):o.push({value:n.value,color:Af[n.type]||"#000"});break;default:o.push({value:n.value,color:"#000"})}this.env.model.getters.showSelectionIndicator()&&i===s&&i===n.end&&(o[o.length-1].class=If)}return o}splitHtmlContentIntoLines(e){const t=[];let o=[];for(const i of e)if(i.value.includes(me)){const e=i.value.split(me),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===Ri(o)?this.env.model.getters.expandZone(i,o):o,ui(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){const{xc:t}=Yo(e.value);if("FUNCTION"===e.type||"SYMBOL"===e.type&&!$o.test(t))this.showAutocomplete(e.value);else if(e.functionContext&&"UNKNOWN"!==e.type){const t=e.functionContext,o=t.parent.toUpperCase(),i=yf[o],s=t.argPosition;this.functionDescriptionState.functionName=o,this.functionDescriptionState.functionDescription=i,this.functionDescriptionState.argToFocus=i.getArgToFocus(s+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()}}Of.props={inputStyle:{type:String,optional:!0},rect:{type:Object,optional:!0},delimitation:{type:Object,optional:!0},focus:{validate:e=>["inactive","cellFocus","contentFocus"].includes(e)},onComposerCellFocused:{type:Function,optional:!0},onComposerContentFocused:Function,isDefaultFocus:{type:Boolean,optional:!0},onInputContextMenu:{type:Function,optional:!0}};const Mf=3*.4*window.devicePixelRatio||1;Ni`
1163
1163
  div.o-grid-composer {
1164
1164
  z-index: ${ue.GridComposer};
1165
1165
  box-sizing: border-box;
@@ -1180,7 +1180,7 @@
1180
1180
  padding: 6px 7px;
1181
1181
  border-radius: 4px;
1182
1182
  }
1183
- `;class Nf extends t.Component{static template="o-spreadsheet-GridComposer";static components={Composer:Of};rect=this.defaultRect;isEditing=!1;isCellReferenceVisible;get defaultRect(){return{x:0,y:0,width:0,height:0}}setup(){t.onWillUpdateProps((()=>{this.updateComponentPosition(),this.updateCellReferenceVisibility()}))}get shouldDisplayCellReference(){return this.isCellReferenceVisible}get cellReference(){if(!this.env.model.getters.getCurrentEditedCell())return"";const{col:e,row:t,sheetId:o}=this.env.model.getters.getCurrentEditedCell();return`${o!==this.env.model.getters.getActiveSheetId()?$e(this.env.model.getters.getSheetName(o))+"!":""}${Zt(e,t)}`}get cellReferenceStyle(){const{x:e,y:t}=this.rect;return Li({left:e-Mf+"px",top:t-28+"px"})}get composerProps(){const{width:e,height:t}=this.env.model.getters.getSheetViewDimensionWithHeaders();return{rect:{...this.rect},delimitation:{width:e,height:t},focus:this.props.focus,isDefaultFocus:!0,onComposerContentFocused:this.props.onComposerContentFocused,onComposerCellFocused:this.props.onComposerCellFocused,onInputContextMenu:this.props.onInputContextMenu}}get containerStyle(){if("inactive"===this.env.model.getters.getEditionMode()||!this.rect)return"\n position: absolute;\n z-index: -1000;\n ";const e=this.env.model.getters.getCurrentContent().startsWith("="),t=this.env.model.getters.getActiveCell(),o=this.env.model.getters.getActivePosition(),i=this.env.model.getters.getCellComputedStyle(o),{x:s,y:n,width:r,height:a}=this.rect,l=!e&&i.fillColor||"#ffffff",c=!e&&i.textColor||"#000000",h=!e&&i.fontSize||10,d=!e&&i.bold?"bold":void 0,u=!e&&i.italic?"italic":"normal",g=e?"none":_i(i);let p="left";e||(p=i.align||t.defaultAlign);const m=this.props.gridDims.height-this.rect.y;return Li({left:s-1+"px",top:`${n}px`,"min-width":`${r+1}px`,"min-height":`${a+1}px`,"max-width":`${this.props.gridDims.width-this.rect.x}px`,"max-height":`${m}px`,background:l,color:c,"font-size":`${je(h)}px`,"font-weight":d,"font-style":u,"text-decoration":g,"text-align":p})}updateComponentPosition(){const e="inactive"!==this.env.model.getters.getEditionMode();if(this.isEditing!==e){if(this.isEditing=e,!e)return this.rect=this.defaultRect,void this.env.focusableElement.focus();const t=this.env.model.getters.getActivePosition(),o=this.env.model.getters.expandZone(t.sheetId,yi(t));this.rect=this.env.model.getters.getVisibleRect(o)}}updateCellReferenceVisibility(){if("inactive"===this.env.model.getters.getEditionMode())return void(this.isCellReferenceVisible=!1);if(this.isCellReferenceVisible)return;const e=this.env.model.getters.getActiveSheetId(),t=this.env.model.getters.getSelectedZone();vt(this.env.model.getters.getVisibleRect(t),this.rect)&&e===this.env.model.getters.getCurrentEditedCell().sheetId||(this.isCellReferenceVisible=!0)}}Nf.props={focus:{validate:e=>["inactive","cellFocus","contentFocus"].includes(e)},onComposerContentFocused:Function,gridDims:Object,onComposerCellFocused:Function,onInputContextMenu:Function};const _f=Ni`
1183
+ `;class Nf extends t.Component{static template="o-spreadsheet-GridComposer";static components={Composer:Of};rect=this.defaultRect;isEditing=!1;isCellReferenceVisible;get defaultRect(){return{x:0,y:0,width:0,height:0}}setup(){t.onWillUpdateProps((()=>{this.updateComponentPosition(),this.updateCellReferenceVisibility()}))}get shouldDisplayCellReference(){return this.isCellReferenceVisible}get cellReference(){if(!this.env.model.getters.getCurrentEditedCell())return"";const{col:e,row:t,sheetId:o}=this.env.model.getters.getCurrentEditedCell();return`${o!==this.env.model.getters.getActiveSheetId()?$e(this.env.model.getters.getSheetName(o))+"!":""}${Zt(e,t)}`}get cellReferenceStyle(){const{x:e,y:t}=this.rect;return Li({left:e-Mf+"px",top:t-28+"px"})}get composerProps(){const{width:e,height:t}=this.env.model.getters.getSheetViewDimensionWithHeaders();return{rect:{...this.rect},delimitation:{width:e,height:t},focus:this.props.focus,isDefaultFocus:!0,onComposerContentFocused:this.props.onComposerContentFocused,onComposerCellFocused:this.props.onComposerCellFocused,onInputContextMenu:this.props.onInputContextMenu}}get containerStyle(){if("inactive"===this.env.model.getters.getEditionMode()||!this.rect)return"z-index: -1000;";const e=this.env.model.getters.getCurrentContent().startsWith("="),t=this.env.model.getters.getActiveCell(),o=this.env.model.getters.getActivePosition(),i=this.env.model.getters.getCellComputedStyle(o),{x:s,y:n,width:r,height:a}=this.rect,l=!e&&i.fillColor||"#ffffff",c=!e&&i.textColor||"#000000",h=!e&&i.fontSize||10,d=!e&&i.bold?"bold":void 0,u=!e&&i.italic?"italic":"normal",g=e?"none":_i(i);let p="left";e||(p=i.align||t.defaultAlign);const m=this.props.gridDims.height-this.rect.y;return Li({left:s-1+"px",top:`${n}px`,"min-width":`${r+1}px`,"min-height":`${a+1}px`,"max-width":`${this.props.gridDims.width-this.rect.x}px`,"max-height":`${m}px`,background:l,color:c,"font-size":`${je(h)}px`,"font-weight":d,"font-style":u,"text-decoration":g,"text-align":p})}updateComponentPosition(){const e="inactive"!==this.env.model.getters.getEditionMode();if(this.isEditing!==e){if(this.isEditing=e,!e)return this.rect=this.defaultRect,void this.env.focusableElement.focus();const t=this.env.model.getters.getActivePosition(),o=this.env.model.getters.expandZone(t.sheetId,yi(t));this.rect=this.env.model.getters.getVisibleRect(o)}}updateCellReferenceVisibility(){if("inactive"===this.env.model.getters.getEditionMode())return void(this.isCellReferenceVisible=!1);if(this.isCellReferenceVisible)return;const e=this.env.model.getters.getActiveSheetId(),t=this.env.model.getters.getSelectedZone();vt(this.env.model.getters.getVisibleRect(t),this.rect)&&e===this.env.model.getters.getCurrentEditedCell().sheetId||(this.isCellReferenceVisible=!0)}}Nf.props={focus:{validate:e=>["inactive","cellFocus","contentFocus"].includes(e)},onComposerContentFocused:Function,gridDims:Object,onComposerCellFocused:Function,onInputContextMenu:Function};const _f=Ni`
1184
1184
  .o-filter-icon {
1185
1185
  color: ${T};
1186
1186
  position: absolute;
@@ -2492,4 +2492,4 @@
2492
2492
  <tableParts count="${e.filterTables.length}">
2493
2493
  ${XS(a)}
2494
2494
  </tableParts>
2495
- `}var Gw;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(Gw||(Gw={}));function qw(e,t={}){const o=Be(t);return o.type=e,o}const Zw={},jw={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:k,SCROLLBAR_WIDTH:P},Yw={autofillModifiersRegistry:Ws,autofillRulesRegistry:Gs,cellMenuRegistry:fp,colMenuRegistry:Nm,linkMenuRegistry:kn,functionRegistry:Hg,featurePluginRegistry:vE,statefulUIPluginRegistry:SE,coreViewsPluginRegistry:CE,corePluginRegistry:bE,rowMenuRegistry:Dm,sidePanelRegistry:gf,figureRegistry:Yr,chartSidePanelComponentRegistry:ef,chartComponentRegistry:Wr,chartRegistry:$r,topbarMenuRegistry:Lm,topbarComponentRegistry:pf,clickableCellRegistry:EE,otRegistry:km,inverseCommandRegistry:Jr,urlRegistry:Hi,cellPopoverRegistry:Vn,numberFormatMenuRegistry:_m,repeatLocalCommandTransformRegistry:oE,repeatCommandTransformRegistry:tE},Xw={arg:el,toBoolean:rs,toJsDate:as,toNumber:Qi,toString:os,toXC:Zt,toZone:ii,toCartesian:qt,numberToLetters:Bt,UuidGenerator:ti,formatValue:bo,computeTextWidth:qe,createEmptyWorkbookData:wC,createEmptySheet:EC,createEmptyExcelSheet:xC,getDefaultChartJsRuntime:br,chartFontColor:er,ChartColors:Jn,EvaluationError:c,CellErrorLevel:l,getFillingMode:Er,rgbaToHex:Pt,colorToRGBA:Ut,positionToZone:yi,isDefined:dt,lazy:mt,genericRepeat:iE},Kw={isMarkdownLink:it,parseMarkdownLink:rt,markdownLink:nt,openLink:Zi,urlRepresentation:qi},Qw={ChartPanel:tf,ChartFigure:qr,ChartJsComponent:Ai,Grid:cb,GridOverlay:Zf,ScorecardChart:Pi,LineConfigPanel:Km,LineBarPieDesignPanel:jm,BarConfigPanel:Hm,LineBarPieConfigPanel:Bm,GaugeChartConfigPanel:Ym,GaugeChartDesignPanel:Xm,ScorecardChartConfigPanel:Qm,ScorecardChartDesignPanel:Jm,FigureComponent:mf};e.AbstractChart=Bn,e.CorePlugin=IC,e.DispatchResult=Ns,e.EvaluationError=c,e.Model=class extends kC{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 ti,n=!0){super(),i=SC(e,i);const r=bC(e,n);this.state=new iw,this.uuidGenerator=s,this.config=this.setupConfig(o),this.session=this.setupSession(r.revisionId),this.coreGetters={},this.range=new NC(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},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new ow(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of bE.getAll())this.setupCorePlugin(e,r);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(i);for(let e of SE.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of CE.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 vE.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 GC(JE({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:n("Anonymous").toString()},o=e.transportService||new WE;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:e.external||{},transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),lazyEvaluation:!("lazyEvaluation"in e)||e.lazyEvaluation}}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,lazyEvaluation:this.config.lazyEvaluation,session:this.session}}checkDispatchAllowed(e){const t=Ms(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>0!==e))?new Ns(t.flat()):Ns.Success}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map((t=>t.allowDispatch(e)))}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(qw(e,t));dispatch=(e,t)=>{const o=qw(e,t);let i=this.status;if(this.getters.isReadonly()&&(s=o,!As.has(s.type)))return new Ns(68);var s;if(!this.session.canApplyOptimisticUpdate())return new Ns(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((()=>{Ms(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(Ms(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(Ms(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Ns.Success};dispatchFromCorePlugin=(e,t)=>{const o=qw(e,t),i=this.status;this.status=2;const s=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(s,o),this.status=i,Ns.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=wC();for(let t of this.handlers)t instanceof IC&&t.export(e);return e.revisionId=this.session.getRevisionId()||ee,e=Be(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={...wC(),sheets:[xC(fC,"Sheet1")]};for(let t of this.handlers)t instanceof yC&&t.exportForExcel(e);return e=Be(e),$w(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=zi,e.Revision=$C,e.SPREADSHEET_DIMENSIONS=jw,e.Spreadsheet=$E,e.UIPlugin=_C,e.__info__=Zw,e.addFunction=function(e,t){Hg.add(e,t)},e.astToFormula=Zv,e.compile=rS,e.components=Qw,e.convertAstNodes=qv,e.coreTypes=Os,e.findCellInNewZone=wi,e.functionCache=nS,e.helpers=Xw,e.invalidateEvaluationCommands=Rs,e.links=Kw,e.load=bC,e.parse=Wv,e.readonlyAllowedCommands=As,e.registries=Yw,e.setDefaultSheetViewSize=function(e){ge=e},e.setTranslationMethod=function(e){o=e},e.tokenize=xv,Object.defineProperty(e,"__esModule",{value:!0}),Zw.version="16.3.37",Zw.date="2024-06-03T14:49:37.305Z",Zw.hash="e7bf8e1"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2495
+ `}var Gw;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(Gw||(Gw={}));function qw(e,t={}){const o=Be(t);return o.type=e,o}const Zw={},jw={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:k,SCROLLBAR_WIDTH:P},Yw={autofillModifiersRegistry:Ws,autofillRulesRegistry:Gs,cellMenuRegistry:fp,colMenuRegistry:Nm,linkMenuRegistry:kn,functionRegistry:Hg,featurePluginRegistry:vE,statefulUIPluginRegistry:SE,coreViewsPluginRegistry:CE,corePluginRegistry:bE,rowMenuRegistry:Dm,sidePanelRegistry:gf,figureRegistry:Yr,chartSidePanelComponentRegistry:ef,chartComponentRegistry:Wr,chartRegistry:$r,topbarMenuRegistry:Lm,topbarComponentRegistry:pf,clickableCellRegistry:EE,otRegistry:km,inverseCommandRegistry:Jr,urlRegistry:Hi,cellPopoverRegistry:Vn,numberFormatMenuRegistry:_m,repeatLocalCommandTransformRegistry:oE,repeatCommandTransformRegistry:tE},Xw={arg:el,toBoolean:rs,toJsDate:as,toNumber:Qi,toString:os,toXC:Zt,toZone:ii,toCartesian:qt,numberToLetters:Bt,UuidGenerator:ti,formatValue:bo,computeTextWidth:qe,createEmptyWorkbookData:wC,createEmptySheet:EC,createEmptyExcelSheet:xC,getDefaultChartJsRuntime:br,chartFontColor:er,ChartColors:Jn,EvaluationError:c,CellErrorLevel:l,getFillingMode:Er,rgbaToHex:Pt,colorToRGBA:Ut,positionToZone:yi,isDefined:dt,lazy:mt,genericRepeat:iE},Kw={isMarkdownLink:it,parseMarkdownLink:rt,markdownLink:nt,openLink:Zi,urlRepresentation:qi},Qw={ChartPanel:tf,ChartFigure:qr,ChartJsComponent:Ai,Grid:cb,GridOverlay:Zf,ScorecardChart:Pi,LineConfigPanel:Km,LineBarPieDesignPanel:jm,BarConfigPanel:Hm,LineBarPieConfigPanel:Bm,GaugeChartConfigPanel:Ym,GaugeChartDesignPanel:Xm,ScorecardChartConfigPanel:Qm,ScorecardChartDesignPanel:Jm,FigureComponent:mf};e.AbstractChart=Bn,e.CorePlugin=IC,e.DispatchResult=Ns,e.EvaluationError=c,e.Model=class extends kC{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 ti,n=!0){super(),i=SC(e,i);const r=bC(e,n);this.state=new iw,this.uuidGenerator=s,this.config=this.setupConfig(o),this.session=this.setupSession(r.revisionId),this.coreGetters={},this.range=new NC(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},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new ow(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of bE.getAll())this.setupCorePlugin(e,r);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(i);for(let e of SE.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of CE.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 vE.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 GC(JE({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:n("Anonymous").toString()},o=e.transportService||new WE;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:e.external||{},transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),lazyEvaluation:!("lazyEvaluation"in e)||e.lazyEvaluation}}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,lazyEvaluation:this.config.lazyEvaluation,session:this.session}}checkDispatchAllowed(e){const t=Ms(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>0!==e))?new Ns(t.flat()):Ns.Success}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map((t=>t.allowDispatch(e)))}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(qw(e,t));dispatch=(e,t)=>{const o=qw(e,t);let i=this.status;if(this.getters.isReadonly()&&(s=o,!As.has(s.type)))return new Ns(68);var s;if(!this.session.canApplyOptimisticUpdate())return new Ns(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((()=>{Ms(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(Ms(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(Ms(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Ns.Success};dispatchFromCorePlugin=(e,t)=>{const o=qw(e,t),i=this.status;this.status=2;const s=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(s,o),this.status=i,Ns.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=wC();for(let t of this.handlers)t instanceof IC&&t.export(e);return e.revisionId=this.session.getRevisionId()||ee,e=Be(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={...wC(),sheets:[xC(fC,"Sheet1")]};for(let t of this.handlers)t instanceof yC&&t.exportForExcel(e);return e=Be(e),$w(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=zi,e.Revision=$C,e.SPREADSHEET_DIMENSIONS=jw,e.Spreadsheet=$E,e.UIPlugin=_C,e.__info__=Zw,e.addFunction=function(e,t){Hg.add(e,t)},e.astToFormula=Zv,e.compile=rS,e.components=Qw,e.convertAstNodes=qv,e.coreTypes=Os,e.findCellInNewZone=wi,e.functionCache=nS,e.helpers=Xw,e.invalidateEvaluationCommands=Rs,e.links=Kw,e.load=bC,e.parse=Wv,e.readonlyAllowedCommands=As,e.registries=Yw,e.setDefaultSheetViewSize=function(e){ge=e},e.setTranslationMethod=function(e){o=e},e.tokenize=xv,Object.defineProperty(e,"__esModule",{value:!0}),Zw.version="16.3.38",Zw.date="2024-06-10T09:33:40.314Z",Zw.hash="2fcf01c"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
@@ -3858,7 +3858,7 @@ https://fontawesome.com/license -->
3858
3858
  </t>
3859
3859
  </odoo>
3860
3860
  <!--
3861
- __info__.version = '16.3.37';
3862
- __info__.date = '2024-06-03T14:50:01.875Z';
3863
- __info__.hash = 'e7bf8e1';
3861
+ __info__.version = '16.3.38';
3862
+ __info__.date = '2024-06-10T09:34:03.814Z';
3863
+ __info__.hash = '2fcf01c';
3864
3864
  -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "16.3.37",
3
+ "version": "16.3.38",
4
4
  "description": "A spreadsheet component",
5
5
  "main": "dist/o-spreadsheet.cjs.js",
6
6
  "browser": "dist/o-spreadsheet.iife.js",