@odoo/o-spreadsheet 16.1.36 → 16.1.37

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.
@@ -18404,8 +18404,8 @@ function getGroup(cell, cells) {
18404
18404
  if (x === cell) {
18405
18405
  found = true;
18406
18406
  }
18407
- const cellValue = evaluateLiteral(x === null || x === void 0 ? void 0 : x.content);
18408
- if (cellValue.type === CellValueType.number) {
18407
+ const cellValue = (x === null || x === void 0 ? void 0 : x.isFormula) ? undefined : evaluateLiteral(x === null || x === void 0 ? void 0 : x.content);
18408
+ if ((cellValue === null || cellValue === void 0 ? void 0 : cellValue.type) === CellValueType.number) {
18409
18409
  group.push(cellValue.value);
18410
18410
  }
18411
18411
  else {
@@ -44681,6 +44681,6 @@ exports.setTranslationMethod = setTranslationMethod;
44681
44681
  exports.tokenize = tokenize;
44682
44682
 
44683
44683
 
44684
- __info__.version = '16.1.36';
44685
- __info__.date = '2024-02-16T14:16:11.082Z';
44686
- __info__.hash = 'ad5301c';
44684
+ __info__.version = '16.1.37';
44685
+ __info__.date = '2024-02-28T12:25:26.784Z';
44686
+ __info__.hash = '499b3b2';
@@ -18400,8 +18400,8 @@ function getGroup(cell, cells) {
18400
18400
  if (x === cell) {
18401
18401
  found = true;
18402
18402
  }
18403
- const cellValue = evaluateLiteral(x === null || x === void 0 ? void 0 : x.content);
18404
- if (cellValue.type === CellValueType.number) {
18403
+ const cellValue = (x === null || x === void 0 ? void 0 : x.isFormula) ? undefined : evaluateLiteral(x === null || x === void 0 ? void 0 : x.content);
18404
+ if ((cellValue === null || cellValue === void 0 ? void 0 : cellValue.type) === CellValueType.number) {
18405
18405
  group.push(cellValue.value);
18406
18406
  }
18407
18407
  else {
@@ -44649,6 +44649,6 @@ function addFunction(functionName, functionDescription) {
44649
44649
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, 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, setTranslationMethod, tokenize };
44650
44650
 
44651
44651
 
44652
- __info__.version = '16.1.36';
44653
- __info__.date = '2024-02-16T14:16:11.082Z';
44654
- __info__.hash = 'ad5301c';
44652
+ __info__.version = '16.1.37';
44653
+ __info__.date = '2024-02-28T12:25:26.784Z';
44654
+ __info__.hash = '499b3b2';
@@ -18401,8 +18401,8 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
18401
18401
  if (x === cell) {
18402
18402
  found = true;
18403
18403
  }
18404
- const cellValue = evaluateLiteral(x === null || x === void 0 ? void 0 : x.content);
18405
- if (cellValue.type === CellValueType.number) {
18404
+ const cellValue = (x === null || x === void 0 ? void 0 : x.isFormula) ? undefined : evaluateLiteral(x === null || x === void 0 ? void 0 : x.content);
18405
+ if ((cellValue === null || cellValue === void 0 ? void 0 : cellValue.type) === CellValueType.number) {
18406
18406
  group.push(cellValue.value);
18407
18407
  }
18408
18408
  else {
@@ -44680,9 +44680,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
44680
44680
  Object.defineProperty(exports, '__esModule', { value: true });
44681
44681
 
44682
44682
 
44683
- __info__.version = '16.1.36';
44684
- __info__.date = '2024-02-16T14:16:11.082Z';
44685
- __info__.hash = 'ad5301c';
44683
+ __info__.version = '16.1.37';
44684
+ __info__.date = '2024-02-28T12:25:26.784Z';
44685
+ __info__.hash = '499b3b2';
44686
44686
 
44687
44687
 
44688
44688
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -304,7 +304,7 @@
304
304
  }
305
305
  }
306
306
  }
307
- `;class Eg extends t.Component{get style(){const{x:e,y:t}=this.props.position;return`top:${t}px;left:${e}px`}}Eg.style=Sg,Eg.template="o-spreadsheet-FilterIcon",Eg.props={position:Object,isActive:Boolean,onClick:Function};const wg=ci``;class yg extends t.Component{getVisibleFilterHeaders(){const e=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getFilterHeaders(e).filter((e=>this.isPositionVisible(e.col,e.row)))}getFilterHeaderPosition(e){const t=this.env.model.getters.getActiveSheetId(),o=this.env.model.getters.getRowDimensionsInViewport(t,e.row),i=this.env.model.getters.getColDimensionsInViewport(t,e.col),n=Math.floor((o.size-z)/2);return{x:i.end-z+this.props.gridPosition.x-2-1,y:o.end-z+this.props.gridPosition.y-n}}isFilterActive(e){const t=this.env.model.getters.getActiveSheetId();return this.env.model.getters.isFilterActive({sheetId:t,...e})}toggleFilterMenu(e){const t=this.env.model.getters.getPersistentPopoverTypeAtPosition(e);if(t&&"FilterMenu"===t)return void this.env.model.dispatch("CLOSE_CELL_POPOVER");const{col:o,row:i}=e;this.env.model.dispatch("OPEN_CELL_POPOVER",{col:o,row:i,popoverType:"FilterMenu"})}isPositionVisible(e,t){const o=this.env.model.getters.getVisibleRect({left:e,right:e,top:t,bottom:t});return!(0===o.width||0===o.height)}}function xg(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}yg.style=wg,yg.template="o-spreadsheet-FilterIconsOverlay",yg.components={FilterIcon:Eg},yg.defaultProps={gridPosition:{x:0,y:0}},yg.props={gridPosition:{type:Object,optional:!0}};const Ig=new On;function Rg(e,t){return{url:e=xg(e),label:t||e,isExternal:!0,isUrlEditable:!0}}Ig.add("sheet_URL",{match:e=>Qe(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=et(e);return t.tryGetSheetName(o)||r("Invalid sheet")},open(e,t){const o=et(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const Tg={createLink:Rg,match:e=>je(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function Ag(e){return Ig.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||Tg}function Mg(e,t){return Ag(e.url).urlRepresentation(e.url,t)}function Og(e,t){Ag(e.url).open(e.url,t)}function Ng(e){if("string"==typeof e){if(Ze(e)){const{label:t,url:o}=Xe(e);return Ag(o).createLink(o,t)}return je(e)?Rg(e):void 0}}function _g(e,t){return Dg(Fg(e||""),t)}function Fg(e){if(e.startsWith("="))throw new Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);return Qt(e)||We(e)?is(e):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function Dg(e,t){const o=Ng(e);return o?{...kg(Fg(o.label),t||wo(o.label)),link:o}:kg(e,t)}function kg(e,t){try{for(const o of Ug){const i=o(e,t);if(i)return i}return function(e,t){return{type:Ei.text,value:e,format:t,isAutoSummable:!0,defaultAlign:"left",formattedValue:ho(e,t)}}((e||"").toString(),t)}catch(t){return Lg((e||"").toString(),new c(a.GenericError,t.message||ae))}}function $g(e,t){return{type:Ei.number,value:e||0,format:t,isAutoSummable:!0,defaultAlign:"right",formattedValue:ho(e,t)}}const Pg={type:Ei.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};function Lg(e,t){return{type:Ei.error,value:t.errorType,error:t,isAutoSummable:!1,defaultAlign:"center",formattedValue:t.errorType}}const Ug=[function(e,t){if(""===e)return function(e){return void 0===e?Pg:{type:Ei.empty,value:"",format:e,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t)},function(e,t){if(t&&"number"==typeof e&&vo(t))return function(e,t){const o=ho(e,t);return{type:Ei.number,value:e,format:t,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t)},function(e,t){return"number"==typeof e?$g(e,t):null===e?$g(0,t):void 0},function(e,t){if("boolean"==typeof e)return function(e,t){const o=e?"TRUE":"FALSE";return{type:Ei.boolean,value:e,format:t,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t)}],Vg=new On;Vg.add("INCREMENT_MODIFIER",{apply:(e,t)=>{var o;e.current+=e.increment;const i=e.current.toString(),n=ho(e.current,null===(o=t.cell)||void 0===o?void 0:o.format);return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:i},tooltip:i?{props:{content:n}}:void 0}}}).add("COPY_MODIFIER",{apply:(e,t,o)=>{var i,n,r;const s=(null===(i=t.cell)||void 0===i?void 0:i.content)||"";return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:_g(null===(n=t.cell)||void 0===n?void 0:n.content,null===(r=t.cell)||void 0===r?void 0:r.format).formattedValue}}:void 0}}}).add("FORMULA_MODIFIER",{apply:(e,t,o,i)=>{e.current+=e.increment;let n=0,r=0;switch(i){case"up":n=0,r=-e.current;break;case"down":n=0,r=e.current;break;case"left":n=-e.current,r=0;break;case"right":n=e.current,r=0}const s=t.cell;if(!s||!s.isFormula)return{cellData:{}};const a=t.sheetId,l=o.createAdaptedRanges(s.dependencies,n,r,a),c=o.buildFormulaContent(a,s,l);return{cellData:{border:t.border,style:s.style,format:s.format,content:c},tooltip:c?{props:{content:c}}:void 0}}});const zg=new On;zg.add("simple_value_copy",{condition:(e,t)=>{var o;return 1===t.length&&!e.isFormula&&!(null===(o=e.format)||void 0===o?void 0:o.match(Y))},generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("copy_text",{condition:e=>!e.isFormula&&_g(e.content).type===Ei.text,generateRule:()=>({type:"COPY_MODIFIER"}),sequence:20}).add("update_formula",{condition:e=>e.isFormula,generateRule:(e,t)=>({type:"FORMULA_MODIFIER",increment:t.length,current:0}),sequence:30}).add("increment_number",{condition:e=>!e.isFormula&&_g(e.content).type===Ei.number,generateRule:(e,t)=>{const o=function(e,t){let o=[],i=!1;for(let n of t){n===e&&(i=!0);const t=_g(null==n?void 0:n.content);if(t.type===Ei.number)o.push(t.value);else{if(i)return o;o=[]}}return o}(e,t);let i=1;2==o.length?i=2*(o[1]-o[0]):o.length>2&&(i=function(e){const t=[];let o=e[0];for(let i=1;i<e.length;i++){const n=e[i];t.push(n-o),o=n}return t.reduce(((e,t)=>e+t),0)/t.length}(o)*o.length);const n=_g(e.content);return{type:"INCREMENT_MODIFIER",increment:i,current:n.type===Ei.number?n.value:0}},sequence:40});ci`
307
+ `;class Eg extends t.Component{get style(){const{x:e,y:t}=this.props.position;return`top:${t}px;left:${e}px`}}Eg.style=Sg,Eg.template="o-spreadsheet-FilterIcon",Eg.props={position:Object,isActive:Boolean,onClick:Function};const wg=ci``;class yg extends t.Component{getVisibleFilterHeaders(){const e=this.env.model.getters.getActiveSheetId();return this.env.model.getters.getFilterHeaders(e).filter((e=>this.isPositionVisible(e.col,e.row)))}getFilterHeaderPosition(e){const t=this.env.model.getters.getActiveSheetId(),o=this.env.model.getters.getRowDimensionsInViewport(t,e.row),i=this.env.model.getters.getColDimensionsInViewport(t,e.col),n=Math.floor((o.size-z)/2);return{x:i.end-z+this.props.gridPosition.x-2-1,y:o.end-z+this.props.gridPosition.y-n}}isFilterActive(e){const t=this.env.model.getters.getActiveSheetId();return this.env.model.getters.isFilterActive({sheetId:t,...e})}toggleFilterMenu(e){const t=this.env.model.getters.getPersistentPopoverTypeAtPosition(e);if(t&&"FilterMenu"===t)return void this.env.model.dispatch("CLOSE_CELL_POPOVER");const{col:o,row:i}=e;this.env.model.dispatch("OPEN_CELL_POPOVER",{col:o,row:i,popoverType:"FilterMenu"})}isPositionVisible(e,t){const o=this.env.model.getters.getVisibleRect({left:e,right:e,top:t,bottom:t});return!(0===o.width||0===o.height)}}function xg(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}yg.style=wg,yg.template="o-spreadsheet-FilterIconsOverlay",yg.components={FilterIcon:Eg},yg.defaultProps={gridPosition:{x:0,y:0}},yg.props={gridPosition:{type:Object,optional:!0}};const Ig=new On;function Rg(e,t){return{url:e=xg(e),label:t||e,isExternal:!0,isUrlEditable:!0}}Ig.add("sheet_URL",{match:e=>Qe(e),createLink:(e,t)=>({label:t,url:e,isExternal:!1,isUrlEditable:!1}),urlRepresentation(e,t){const o=et(e);return t.tryGetSheetName(o)||r("Invalid sheet")},open(e,t){const o=et(e);t.model.dispatch("ACTIVATE_SHEET",{sheetIdFrom:t.model.getters.getActiveSheetId(),sheetIdTo:o})},sequence:0});const Tg={createLink:Rg,match:e=>je(e),open:e=>window.open(e,"_blank"),urlRepresentation:e=>e,sequence:0};function Ag(e){return Ig.getAll().sort(((e,t)=>e.sequence-t.sequence)).find((t=>t.match(e)))||Tg}function Mg(e,t){return Ag(e.url).urlRepresentation(e.url,t)}function Og(e,t){Ag(e.url).open(e.url,t)}function Ng(e){if("string"==typeof e){if(Ze(e)){const{label:t,url:o}=Xe(e);return Ag(o).createLink(o,t)}return je(e)?Rg(e):void 0}}function _g(e,t){return Dg(Fg(e||""),t)}function Fg(e){if(e.startsWith("="))throw new Error(`Cannot parse "${e}" because it's not a literal value. It's a formula`);return Qt(e)||We(e)?is(e):function(e){const t=e.toUpperCase();return"TRUE"===t||"FALSE"===t}(e)?"TRUE"===e.toUpperCase():e}function Dg(e,t){const o=Ng(e);return o?{...kg(Fg(o.label),t||wo(o.label)),link:o}:kg(e,t)}function kg(e,t){try{for(const o of Ug){const i=o(e,t);if(i)return i}return function(e,t){return{type:Ei.text,value:e,format:t,isAutoSummable:!0,defaultAlign:"left",formattedValue:ho(e,t)}}((e||"").toString(),t)}catch(t){return Lg((e||"").toString(),new c(a.GenericError,t.message||ae))}}function $g(e,t){return{type:Ei.number,value:e||0,format:t,isAutoSummable:!0,defaultAlign:"right",formattedValue:ho(e,t)}}const Pg={type:Ei.empty,value:"",format:void 0,isAutoSummable:!0,defaultAlign:"left",formattedValue:""};function Lg(e,t){return{type:Ei.error,value:t.errorType,error:t,isAutoSummable:!1,defaultAlign:"center",formattedValue:t.errorType}}const Ug=[function(e,t){if(""===e)return function(e){return void 0===e?Pg:{type:Ei.empty,value:"",format:e,isAutoSummable:!0,defaultAlign:"left",formattedValue:""}}(t)},function(e,t){if(t&&"number"==typeof e&&vo(t))return function(e,t){const o=ho(e,t);return{type:Ei.number,value:e,format:t,isAutoSummable:!1,defaultAlign:"right",formattedValue:o}}(e,t)},function(e,t){return"number"==typeof e?$g(e,t):null===e?$g(0,t):void 0},function(e,t){if("boolean"==typeof e)return function(e,t){const o=e?"TRUE":"FALSE";return{type:Ei.boolean,value:e,format:t,isAutoSummable:!1,defaultAlign:"center",formattedValue:o}}(e,t)}],Vg=new On;Vg.add("INCREMENT_MODIFIER",{apply:(e,t)=>{var o;e.current+=e.increment;const i=e.current.toString(),n=ho(e.current,null===(o=t.cell)||void 0===o?void 0:o.format);return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:i},tooltip:i?{props:{content:n}}:void 0}}}).add("COPY_MODIFIER",{apply:(e,t,o)=>{var i,n,r;const s=(null===(i=t.cell)||void 0===i?void 0:i.content)||"";return{cellData:{border:t.border,style:t.cell&&t.cell.style,format:t.cell&&t.cell.format,content:s},tooltip:s?{props:{content:_g(null===(n=t.cell)||void 0===n?void 0:n.content,null===(r=t.cell)||void 0===r?void 0:r.format).formattedValue}}:void 0}}}).add("FORMULA_MODIFIER",{apply:(e,t,o,i)=>{e.current+=e.increment;let n=0,r=0;switch(i){case"up":n=0,r=-e.current;break;case"down":n=0,r=e.current;break;case"left":n=-e.current,r=0;break;case"right":n=e.current,r=0}const s=t.cell;if(!s||!s.isFormula)return{cellData:{}};const a=t.sheetId,l=o.createAdaptedRanges(s.dependencies,n,r,a),c=o.buildFormulaContent(a,s,l);return{cellData:{border:t.border,style:s.style,format:s.format,content:c},tooltip:c?{props:{content:c}}:void 0}}});const zg=new On;zg.add("simple_value_copy",{condition:(e,t)=>{var o;return 1===t.length&&!e.isFormula&&!(null===(o=e.format)||void 0===o?void 0:o.match(Y))},generateRule:()=>({type:"COPY_MODIFIER"}),sequence:10}).add("copy_text",{condition:e=>!e.isFormula&&_g(e.content).type===Ei.text,generateRule:()=>({type:"COPY_MODIFIER"}),sequence:20}).add("update_formula",{condition:e=>e.isFormula,generateRule:(e,t)=>({type:"FORMULA_MODIFIER",increment:t.length,current:0}),sequence:30}).add("increment_number",{condition:e=>!e.isFormula&&_g(e.content).type===Ei.number,generateRule:(e,t)=>{const o=function(e,t){let o=[],i=!1;for(let n of t){n===e&&(i=!0);const t=(null==n?void 0:n.isFormula)?void 0:_g(null==n?void 0:n.content);if((null==t?void 0:t.type)===Ei.number)o.push(t.value);else{if(i)return o;o=[]}}return o}(e,t);let i=1;2==o.length?i=2*(o[1]-o[0]):o.length>2&&(i=function(e){const t=[];let o=e[0];for(let i=1;i<e.length;i++){const n=e[i];t.push(n-o),o=n}return t.reduce(((e,t)=>e+t),0)/t.length}(o)*o.length);const n=_g(e.content);return{type:"INCREMENT_MODIFIER",increment:i,current:n.type===Ei.number?n.value:0}},sequence:40});ci`
308
308
  .o-error-tooltip {
309
309
  font-size: 13px;
310
310
  background-color: white;
@@ -2470,4 +2470,4 @@
2470
2470
  <tableParts count="${e.filterTables.length}">
2471
2471
  ${qf(a)}
2472
2472
  </tableParts>
2473
- `}var WC;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(WC||(WC={}));const GC={},qC={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:O,HEADER_WIDTH:N,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:_,DEFAULT_CELL_HEIGHT:F,SCROLLBAR_WIDTH:D},ZC={autofillModifiersRegistry:Vg,autofillRulesRegistry:zg,cellMenuRegistry:zr,colMenuRegistry:Br,linkMenuRegistry:Xg,functionRegistry:lu,featurePluginRegistry:Mb,statefulUIPluginRegistry:Ob,coreViewsPluginRegistry:Nb,corePluginRegistry:Ab,rowMenuRegistry:Hr,sidePanelRegistry:kp,figureRegistry:op,sheetMenuRegistry:sp,chartSidePanelComponentRegistry:Rp,chartComponentRegistry:_n,chartRegistry:Nn,topbarMenuRegistry:lp,topbarComponentRegistry:$p,clickableCellRegistry:_b,otRegistry:cp,inverseCommandRegistry:ip,urlRegistry:Ig,cellPopoverRegistry:Jg},jC={args:Kr,toBoolean:cs,toJsDate:hs,toNumber:is,toString:rs,toXC:zt,toZone:ko,toCartesian:Vt,numberToLetters:Lt,createFullMenuItem:Dn,UuidGenerator:Fo,formatValue:ho,computeTextWidth:Pe,createEmptyWorkbookData:bv,createEmptySheet:vv,createEmptyExcelSheet:Cv,getDefaultChartJsRuntime:rn,chartFontColor:Bi,getMenuChildren:Un,ChartColors:zi,EvaluationError:c,CellErrorLevel:l,getFillingMode:ln,rgbaToHex:Et,colorToRGBA:wt,positionToZone:oi,isDefined:tt},YC={isMarkdownLink:Ze,parseMarkdownLink:Xe,markdownLink:Ye,openLink:Og,urlRepresentation:Mg},XC={ChartPanel:Tp,ChartFigure:Qn,ChartJsComponent:si,Grid:om,GridOverlay:Vp,ScorecardChart:mi,LineConfigPanel:wp,LineBarPieDesignPanel:bp,BarConfigPanel:gp,LineBarPieConfigPanel:up,GaugeChartConfigPanel:Sp,GaugeChartDesignPanel:Ep,ScorecardChartConfigPanel:xp,ScorecardChartDesignPanel:Ip};e.AbstractChart=Ci,e.CorePlugin=Sv,e.DATETIME_FORMAT=Y,e.DispatchResult=Ai,e.EvaluationError=c,e.Model=class extends nb{constructor(e={},o={},i=[],n=new Fo,r=!0){super(),this.corePlugins=[],this.featurePlugins=[],this.statefulUIPlugins=[],this.coreViewsPlugins=[],this.isReplayingCommand=!1,this.renderers=[],this.status=0,this.handlers=[],this.coreHandlers=[],this.dispatch=(e,t)=>{const o={...t,type:e};let i=this.status;if(this.getters.isReadonly()&&(n=o,!Ii.has(n.type)))return new Ai(68);var n;if(!this.session.canApplyOptimisticUpdate())return new Ai(65);switch(i){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:i,commands:n}=this.state.recordChanges((()=>{Ti(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(n,i),this.status=0,this.trigger("update");break;case 1:if(Ti(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(Ti(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Ai.Success},this.dispatchFromCorePlugin=(e,t)=>{const o={...t,type:e},i=this.status;this.status=2;const n=this.isReplayingCommand?[this.range,...this.corePlugins,...this.coreViewsPlugins]:this.handlers;return this.dispatchToHandlers(n,o),this.status=i,Ai.Success},i=mv(e,i);const s=gv(e,r);this.state=new rC,this.uuidGenerator=n,this.config=this.setupConfig(o),this.session=this.setupSession(s.revisionId),this.history=new oC(this.dispatchFromCorePlugin,this.session),this.coreGetters={},this.range=new Pv(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getSelectionRangeString=this.range.getSelectionRangeString.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode,canUndo:this.history.canUndo.bind(this.history),canRedo:this.history.canRedo.bind(this.history),getClient:this.session.getClient.bind(this.session),getConnectedClients:this.session.getConnectedClients.bind(this.session),isFullySynchronized:this.session.isFullySynchronized.bind(this.session)},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new nC(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of Ab.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters);for(let e of Ob.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t)}for(let e of Nb.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.coreHandlers.push(t)}for(let e of Mb.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.handlers.push(this.history),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.session.loadInitialMessages(i),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 gb(eC(e,this.state.recordChanges.bind(this.state),(e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers([this.range,...this.corePlugins,...this.coreViewsPlugins],e),this.isReplayingCommand=!1)})),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-redone",this,this.finalize),this.session.on("revision-undone",this,this.finalize),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:r("Anonymous").toString()},o=e.transportService||new Gb;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}}checkDispatchAllowed(e){const t=this.handlers.map((t=>t.allowDispatch(e)));return t.some((e=>0!==e))?new Ai(t.flat()):Ai.Success}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}dispatchToHandlers(e,t){t=_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=bv();for(let t of this.handlers)t instanceof Sv&&t.export(e);return e.revisionId=this.session.getRevisionId()||K,e=_e(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={...bv(),sheets:[Cv(uv,"Sheet1")]};for(let t of this.handlers)t instanceof og&&t.exportForExcel(e);return e=_e(e),BC(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=On,e.Revision=db,e.SPREADSHEET_DIMENSIONS=qC,e.Spreadsheet=Wb,e.UIPlugin=ig,e.__info__=GC,e.addFunction=function(e,t){lu.add(e,t)},e.astToFormula=Pu,e.compile=Ku,e.components=XC,e.convertAstNodes=$u,e.coreTypes=Ri,e.findCellInNewZone=ei,e.functionCache=Xu,e.helpers=jC,e.invalidateEvaluationCommands=yi,e.links=YC,e.load=gv,e.parse=Du,e.readonlyAllowedCommands=Ii,e.registries=ZC,e.setTranslationMethod=function(e){o=e},e.tokenize=uu,Object.defineProperty(e,"__esModule",{value:!0}),GC.version="16.1.36",GC.date="2024-02-16T14:16:11.082Z",GC.hash="ad5301c"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2473
+ `}var WC;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(WC||(WC={}));const GC={},qC={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:O,HEADER_WIDTH:N,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:_,DEFAULT_CELL_HEIGHT:F,SCROLLBAR_WIDTH:D},ZC={autofillModifiersRegistry:Vg,autofillRulesRegistry:zg,cellMenuRegistry:zr,colMenuRegistry:Br,linkMenuRegistry:Xg,functionRegistry:lu,featurePluginRegistry:Mb,statefulUIPluginRegistry:Ob,coreViewsPluginRegistry:Nb,corePluginRegistry:Ab,rowMenuRegistry:Hr,sidePanelRegistry:kp,figureRegistry:op,sheetMenuRegistry:sp,chartSidePanelComponentRegistry:Rp,chartComponentRegistry:_n,chartRegistry:Nn,topbarMenuRegistry:lp,topbarComponentRegistry:$p,clickableCellRegistry:_b,otRegistry:cp,inverseCommandRegistry:ip,urlRegistry:Ig,cellPopoverRegistry:Jg},jC={args:Kr,toBoolean:cs,toJsDate:hs,toNumber:is,toString:rs,toXC:zt,toZone:ko,toCartesian:Vt,numberToLetters:Lt,createFullMenuItem:Dn,UuidGenerator:Fo,formatValue:ho,computeTextWidth:Pe,createEmptyWorkbookData:bv,createEmptySheet:vv,createEmptyExcelSheet:Cv,getDefaultChartJsRuntime:rn,chartFontColor:Bi,getMenuChildren:Un,ChartColors:zi,EvaluationError:c,CellErrorLevel:l,getFillingMode:ln,rgbaToHex:Et,colorToRGBA:wt,positionToZone:oi,isDefined:tt},YC={isMarkdownLink:Ze,parseMarkdownLink:Xe,markdownLink:Ye,openLink:Og,urlRepresentation:Mg},XC={ChartPanel:Tp,ChartFigure:Qn,ChartJsComponent:si,Grid:om,GridOverlay:Vp,ScorecardChart:mi,LineConfigPanel:wp,LineBarPieDesignPanel:bp,BarConfigPanel:gp,LineBarPieConfigPanel:up,GaugeChartConfigPanel:Sp,GaugeChartDesignPanel:Ep,ScorecardChartConfigPanel:xp,ScorecardChartDesignPanel:Ip};e.AbstractChart=Ci,e.CorePlugin=Sv,e.DATETIME_FORMAT=Y,e.DispatchResult=Ai,e.EvaluationError=c,e.Model=class extends nb{constructor(e={},o={},i=[],n=new Fo,r=!0){super(),this.corePlugins=[],this.featurePlugins=[],this.statefulUIPlugins=[],this.coreViewsPlugins=[],this.isReplayingCommand=!1,this.renderers=[],this.status=0,this.handlers=[],this.coreHandlers=[],this.dispatch=(e,t)=>{const o={...t,type:e};let i=this.status;if(this.getters.isReadonly()&&(n=o,!Ii.has(n.type)))return new Ai(68);var n;if(!this.session.canApplyOptimisticUpdate())return new Ai(65);switch(i){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:i,commands:n}=this.state.recordChanges((()=>{Ti(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(n,i),this.status=0,this.trigger("update");break;case 1:if(Ti(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(Ti(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Ai.Success},this.dispatchFromCorePlugin=(e,t)=>{const o={...t,type:e},i=this.status;this.status=2;const n=this.isReplayingCommand?[this.range,...this.corePlugins,...this.coreViewsPlugins]:this.handlers;return this.dispatchToHandlers(n,o),this.status=i,Ai.Success},i=mv(e,i);const s=gv(e,r);this.state=new rC,this.uuidGenerator=n,this.config=this.setupConfig(o),this.session=this.setupSession(s.revisionId),this.history=new oC(this.dispatchFromCorePlugin,this.session),this.coreGetters={},this.range=new Pv(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getSelectionRangeString=this.range.getSelectionRangeString.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode,canUndo:this.history.canUndo.bind(this.history),canRedo:this.history.canRedo.bind(this.history),getClient:this.session.getClient.bind(this.session),getConnectedClients:this.session.getConnectedClients.bind(this.session),isFullySynchronized:this.session.isFullySynchronized.bind(this.session)},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new nC(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of Ab.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters);for(let e of Ob.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t)}for(let e of Nb.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.coreHandlers.push(t)}for(let e of Mb.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.handlers.push(this.history),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.session.loadInitialMessages(i),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 gb(eC(e,this.state.recordChanges.bind(this.state),(e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers([this.range,...this.corePlugins,...this.coreViewsPlugins],e),this.isReplayingCommand=!1)})),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-redone",this,this.finalize),this.session.on("revision-undone",this,this.finalize),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:r("Anonymous").toString()},o=e.transportService||new Gb;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}}checkDispatchAllowed(e){const t=this.handlers.map((t=>t.allowDispatch(e)));return t.some((e=>0!==e))?new Ai(t.flat()):Ai.Success}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}dispatchToHandlers(e,t){t=_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=bv();for(let t of this.handlers)t instanceof Sv&&t.export(e);return e.revisionId=this.session.getRevisionId()||K,e=_e(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={...bv(),sheets:[Cv(uv,"Sheet1")]};for(let t of this.handlers)t instanceof og&&t.exportForExcel(e);return e=_e(e),BC(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=On,e.Revision=db,e.SPREADSHEET_DIMENSIONS=qC,e.Spreadsheet=Wb,e.UIPlugin=ig,e.__info__=GC,e.addFunction=function(e,t){lu.add(e,t)},e.astToFormula=Pu,e.compile=Ku,e.components=XC,e.convertAstNodes=$u,e.coreTypes=Ri,e.findCellInNewZone=ei,e.functionCache=Xu,e.helpers=jC,e.invalidateEvaluationCommands=yi,e.links=YC,e.load=gv,e.parse=Du,e.readonlyAllowedCommands=Ii,e.registries=ZC,e.setTranslationMethod=function(e){o=e},e.tokenize=uu,Object.defineProperty(e,"__esModule",{value:!0}),GC.version="16.1.37",GC.date="2024-02-28T12:25:26.784Z",GC.hash="499b3b2"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
@@ -3304,7 +3304,7 @@ https://fontawesome.com/license -->
3304
3304
  </t>
3305
3305
  </odoo>
3306
3306
  <!--
3307
- __info__.version = '16.1.36';
3308
- __info__.date = '2024-02-16T14:16:34.256Z';
3309
- __info__.hash = 'ad5301c';
3307
+ __info__.version = '16.1.37';
3308
+ __info__.date = '2024-02-28T12:25:49.681Z';
3309
+ __info__.hash = '499b3b2';
3310
3310
  -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "16.1.36",
3
+ "version": "16.1.37",
4
4
  "description": "A spreadsheet component",
5
5
  "main": "dist/o-spreadsheet.cjs.js",
6
6
  "browser": "dist/o-spreadsheet.iife.js",