@odoo/o-spreadsheet 16.4.36 → 16.4.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.
@@ -5927,7 +5927,7 @@ class Popover extends owl.Component {
5927
5927
  if (!anchor)
5928
5928
  return;
5929
5929
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
5930
- const elDims = {
5930
+ let elDims = {
5931
5931
  width: el.getBoundingClientRect().width,
5932
5932
  height: el.getBoundingClientRect().height,
5933
5933
  };
@@ -5935,7 +5935,14 @@ class Popover extends owl.Component {
5935
5935
  const popoverPositionHelper = this.props.positioning === "BottomLeft"
5936
5936
  ? new BottomLeftPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect)
5937
5937
  : new TopRightPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect);
5938
- const style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5938
+ el.style["max-height"] = popoverPositionHelper.getMaxHeight(elDims.height) + "px";
5939
+ el.style["max-width"] = popoverPositionHelper.getMaxWidth(elDims.width) + "px";
5940
+ // Re-compute the dimensions after setting the max-width and max-height
5941
+ elDims = {
5942
+ width: el.getBoundingClientRect().width,
5943
+ height: el.getBoundingClientRect().height,
5944
+ };
5945
+ let style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5939
5946
  for (const property of Object.keys(style)) {
5940
5947
  el.style[property] = style[property];
5941
5948
  }
@@ -6011,8 +6018,6 @@ class PopoverPositionContext {
6011
6018
  const shouldRenderAtRight = this.shouldRenderAtRight(elDims.width);
6012
6019
  verticalOffset = shouldRenderAtBottom ? verticalOffset : -verticalOffset;
6013
6020
  const cssProperties = {
6014
- "max-height": maxHeight + "px",
6015
- "max-width": maxWidth + "px",
6016
6021
  top: this.getTopCoordinate(actualHeight, shouldRenderAtBottom) -
6017
6022
  this.spreadsheetOffset.y -
6018
6023
  verticalOffset +
@@ -25389,7 +25394,7 @@ class FiguresContainer extends owl.Component {
25389
25394
  });
25390
25395
  }
25391
25396
  getContainerRect(container) {
25392
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
25397
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
25393
25398
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
25394
25399
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
25395
25400
  const width = viewWidth - x;
@@ -52128,6 +52133,7 @@ const helpers = {
52128
52133
  isDefined: isDefined$1,
52129
52134
  lazy,
52130
52135
  genericRepeat,
52136
+ deepEquals,
52131
52137
  };
52132
52138
  const links = {
52133
52139
  isMarkdownLink,
@@ -52195,6 +52201,6 @@ exports.setTranslationMethod = setTranslationMethod;
52195
52201
  exports.tokenize = tokenize;
52196
52202
 
52197
52203
 
52198
- __info__.version = '16.4.36';
52199
- __info__.date = '2024-06-10T09:33:43.623Z';
52200
- __info__.hash = '3b15ed5';
52204
+ __info__.version = '16.4.37';
52205
+ __info__.date = '2024-06-14T10:00:27.521Z';
52206
+ __info__.hash = '195b41b';
@@ -967,6 +967,10 @@ declare function isDefined<T>(argument: T | undefined): argument is T;
967
967
  * Lazy value computed by the provided function.
968
968
  */
969
969
  declare function lazy<T>(fn: (() => T) | T): Lazy<T>;
970
+ /**
971
+ * Compares two objects.
972
+ */
973
+ declare function deepEquals(o1: any, o2: any): boolean;
970
974
 
971
975
  interface ConstructorArgs {
972
976
  readonly zone: Readonly<Zone | UnboundedZone>;
@@ -7363,6 +7367,7 @@ declare const helpers: {
7363
7367
  isDefined: typeof isDefined;
7364
7368
  lazy: typeof lazy;
7365
7369
  genericRepeat: typeof genericRepeat;
7370
+ deepEquals: typeof deepEquals;
7366
7371
  };
7367
7372
  declare const links: {
7368
7373
  isMarkdownLink: typeof isMarkdownLink;
@@ -5923,7 +5923,7 @@ class Popover extends Component {
5923
5923
  if (!anchor)
5924
5924
  return;
5925
5925
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
5926
- const elDims = {
5926
+ let elDims = {
5927
5927
  width: el.getBoundingClientRect().width,
5928
5928
  height: el.getBoundingClientRect().height,
5929
5929
  };
@@ -5931,7 +5931,14 @@ class Popover extends Component {
5931
5931
  const popoverPositionHelper = this.props.positioning === "BottomLeft"
5932
5932
  ? new BottomLeftPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect)
5933
5933
  : new TopRightPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect);
5934
- const style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5934
+ el.style["max-height"] = popoverPositionHelper.getMaxHeight(elDims.height) + "px";
5935
+ el.style["max-width"] = popoverPositionHelper.getMaxWidth(elDims.width) + "px";
5936
+ // Re-compute the dimensions after setting the max-width and max-height
5937
+ elDims = {
5938
+ width: el.getBoundingClientRect().width,
5939
+ height: el.getBoundingClientRect().height,
5940
+ };
5941
+ let style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5935
5942
  for (const property of Object.keys(style)) {
5936
5943
  el.style[property] = style[property];
5937
5944
  }
@@ -6007,8 +6014,6 @@ class PopoverPositionContext {
6007
6014
  const shouldRenderAtRight = this.shouldRenderAtRight(elDims.width);
6008
6015
  verticalOffset = shouldRenderAtBottom ? verticalOffset : -verticalOffset;
6009
6016
  const cssProperties = {
6010
- "max-height": maxHeight + "px",
6011
- "max-width": maxWidth + "px",
6012
6017
  top: this.getTopCoordinate(actualHeight, shouldRenderAtBottom) -
6013
6018
  this.spreadsheetOffset.y -
6014
6019
  verticalOffset +
@@ -25385,7 +25390,7 @@ class FiguresContainer extends Component {
25385
25390
  });
25386
25391
  }
25387
25392
  getContainerRect(container) {
25388
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
25393
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
25389
25394
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
25390
25395
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
25391
25396
  const width = viewWidth - x;
@@ -52124,6 +52129,7 @@ const helpers = {
52124
52129
  isDefined: isDefined$1,
52125
52130
  lazy,
52126
52131
  genericRepeat,
52132
+ deepEquals,
52127
52133
  };
52128
52134
  const links = {
52129
52135
  isMarkdownLink,
@@ -52159,6 +52165,6 @@ const constants = {
52159
52165
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
52160
52166
 
52161
52167
 
52162
- __info__.version = '16.4.36';
52163
- __info__.date = '2024-06-10T09:33:43.623Z';
52164
- __info__.hash = '3b15ed5';
52168
+ __info__.version = '16.4.37';
52169
+ __info__.date = '2024-06-14T10:00:27.521Z';
52170
+ __info__.hash = '195b41b';
@@ -5924,7 +5924,7 @@
5924
5924
  if (!anchor)
5925
5925
  return;
5926
5926
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
5927
- const elDims = {
5927
+ let elDims = {
5928
5928
  width: el.getBoundingClientRect().width,
5929
5929
  height: el.getBoundingClientRect().height,
5930
5930
  };
@@ -5932,7 +5932,14 @@
5932
5932
  const popoverPositionHelper = this.props.positioning === "BottomLeft"
5933
5933
  ? new BottomLeftPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect)
5934
5934
  : new TopRightPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect);
5935
- const style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5935
+ el.style["max-height"] = popoverPositionHelper.getMaxHeight(elDims.height) + "px";
5936
+ el.style["max-width"] = popoverPositionHelper.getMaxWidth(elDims.width) + "px";
5937
+ // Re-compute the dimensions after setting the max-width and max-height
5938
+ elDims = {
5939
+ width: el.getBoundingClientRect().width,
5940
+ height: el.getBoundingClientRect().height,
5941
+ };
5942
+ let style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5936
5943
  for (const property of Object.keys(style)) {
5937
5944
  el.style[property] = style[property];
5938
5945
  }
@@ -6008,8 +6015,6 @@
6008
6015
  const shouldRenderAtRight = this.shouldRenderAtRight(elDims.width);
6009
6016
  verticalOffset = shouldRenderAtBottom ? verticalOffset : -verticalOffset;
6010
6017
  const cssProperties = {
6011
- "max-height": maxHeight + "px",
6012
- "max-width": maxWidth + "px",
6013
6018
  top: this.getTopCoordinate(actualHeight, shouldRenderAtBottom) -
6014
6019
  this.spreadsheetOffset.y -
6015
6020
  verticalOffset +
@@ -25386,7 +25391,7 @@
25386
25391
  });
25387
25392
  }
25388
25393
  getContainerRect(container) {
25389
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
25394
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
25390
25395
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
25391
25396
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
25392
25397
  const width = viewWidth - x;
@@ -52125,6 +52130,7 @@
52125
52130
  isDefined: isDefined$1,
52126
52131
  lazy,
52127
52132
  genericRepeat,
52133
+ deepEquals,
52128
52134
  };
52129
52135
  const links = {
52130
52136
  isMarkdownLink,
@@ -52194,9 +52200,9 @@
52194
52200
  Object.defineProperty(exports, '__esModule', { value: true });
52195
52201
 
52196
52202
 
52197
- __info__.version = '16.4.36';
52198
- __info__.date = '2024-06-10T09:33:43.623Z';
52199
- __info__.hash = '3b15ed5';
52203
+ __info__.version = '16.4.37';
52204
+ __info__.date = '2024-06-14T10:00:27.521Z';
52205
+ __info__.hash = '195b41b';
52200
52206
 
52201
52207
 
52202
52208
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -172,7 +172,7 @@
172
172
  width: fit-content;
173
173
  height: fit-content;
174
174
  }
175
- `;class kr extends t.Component{static template="o-spreadsheet-Popover";static defaultProps={positioning:"BottomLeft",verticalOffset:0,onMouseWheel:()=>{},onPopoverMoved:()=>{},onPopoverHidden:()=>{},zIndex:ge.Popover};popoverRef=t.useRef("popover");currentPosition=void 0;currentDisplayValue=void 0;spreadsheetRect=_r();containerRect;setup(){this.containerRect=function(){const e=t.useState({x:0,y:0,width:0,height:0}),o=t.useComponent(),i=_r();function s(){const t=o.env,s="getPopoverContainerRect"in t?t.getPopoverContainerRect():i;e.x=s.x,e.y=s.y,e.width=s.width,e.height=s.height}return s(),t.onMounted(s),t.onPatched(s),e}(),t.useEffect((()=>{if(!this.containerRect)throw new Error("Popover container is not defined");const e=this.popoverRef.el,t=Dr(this.props.anchorRect,this.containerRect),o=t?"block":"none";if("none"!==this.currentDisplayValue&&"none"===o&&this.props.onPopoverHidden?.(),e.style.display=o,this.currentDisplayValue=o,!t)return;const i={width:this.props.maxWidth,height:this.props.maxHeight},s={width:e.getBoundingClientRect().width,height:e.getBoundingClientRect().height},r=this.spreadsheetRect,n="BottomLeft"===this.props.positioning?new Vr(t,this.containerRect,i,r):new Br(t,this.containerRect,i,r),a=n.getCss(s,this.props.verticalOffset);for(const t of Object.keys(a))e.style[t]=a[t];const l=n.getCurrentPosition(s);this.currentPosition&&l!==this.currentPosition&&this.props.onPopoverMoved?.(),this.currentPosition=l}))}get popoverStyle(){return Yi({"z-index":`${this.props.zIndex}`})}}kr.props={anchorRect:Object,containerRect:{type:Object,optional:!0},positioning:{type:String,optional:!0},maxWidth:{type:Number,optional:!0},maxHeight:{type:Number,optional:!0},verticalOffset:{type:Number,optional:!0},onMouseWheel:{type:Function,optional:!0},onPopoverHidden:{type:Function,optional:!0},onPopoverMoved:{type:Function,optional:!0},zIndex:{type:Number,optional:!0},slots:Object};class Ur{anchorRect;containerRect;propsMaxSize;spreadsheetOffset;constructor(e,t,o,i){this.anchorRect=e,this.containerRect=t,this.propsMaxSize=o,this.spreadsheetOffset=i}shouldRenderAtBottom(e){return e<=this.availableHeightDown||this.availableHeightDown>=this.availableHeightUp}shouldRenderAtRight(e){return e<=this.availableWidthRight||this.availableWidthRight>=this.availableWidthLeft}getMaxHeight(e){const t=this.shouldRenderAtBottom(e)?this.availableHeightDown:this.availableHeightUp;return this.propsMaxSize.height?Math.min(t,this.propsMaxSize.height):t}getMaxWidth(e){const t=this.shouldRenderAtRight(e)?this.availableWidthRight:this.availableWidthLeft;return this.propsMaxSize.width?Math.min(t,this.propsMaxSize.width):t}getCss(e,t){const o=this.getMaxHeight(e.height),i=this.getMaxWidth(e.width),s=Math.min(o,e.height),r=Math.min(i,e.width),n=this.shouldRenderAtBottom(e.height),a=this.shouldRenderAtRight(e.width);t=n?t:-t;return{"max-height":o+"px","max-width":i+"px",top:this.getTopCoordinate(s,n)-this.spreadsheetOffset.y-t+"px",left:this.getLeftCoordinate(r,a)-this.spreadsheetOffset.x+"px"}}getCurrentPosition(e){const t=this.shouldRenderAtBottom(e.height),o=this.shouldRenderAtRight(e.width);return t&&o?"BottomRight":t&&!o?"BottomLeft":!t&&o?"TopRight":"TopLeft"}}class Vr extends Ur{get availableHeightUp(){return this.anchorRect.y-this.containerRect.y}get availableHeightDown(){return this.containerRect.height-this.availableHeightUp-this.anchorRect.height}get availableWidthRight(){return this.containerRect.x+this.containerRect.width-this.anchorRect.x}get availableWidthLeft(){return this.anchorRect.x+this.anchorRect.width-this.containerRect.x}getTopCoordinate(e,t){return t?this.anchorRect.y+this.anchorRect.height:this.anchorRect.y-e}getLeftCoordinate(e,t){return t?this.anchorRect.x:this.anchorRect.x+this.anchorRect.width-e}}class Br extends Ur{get availableHeightUp(){return this.anchorRect.y+this.anchorRect.height-this.containerRect.y}get availableHeightDown(){return this.containerRect.y+this.containerRect.height-this.anchorRect.y}get availableWidthRight(){return this.containerRect.width-this.anchorRect.width-this.availableWidthLeft}get availableWidthLeft(){return this.anchorRect.x-this.containerRect.x}getTopCoordinate(e,t){return t?this.anchorRect.y:this.anchorRect.y+this.anchorRect.height-e}getLeftCoordinate(e,t){return t?this.anchorRect.x+this.anchorRect.width:this.anchorRect.x-e}}Wi`
175
+ `;class kr extends t.Component{static template="o-spreadsheet-Popover";static defaultProps={positioning:"BottomLeft",verticalOffset:0,onMouseWheel:()=>{},onPopoverMoved:()=>{},onPopoverHidden:()=>{},zIndex:ge.Popover};popoverRef=t.useRef("popover");currentPosition=void 0;currentDisplayValue=void 0;spreadsheetRect=_r();containerRect;setup(){this.containerRect=function(){const e=t.useState({x:0,y:0,width:0,height:0}),o=t.useComponent(),i=_r();function s(){const t=o.env,s="getPopoverContainerRect"in t?t.getPopoverContainerRect():i;e.x=s.x,e.y=s.y,e.width=s.width,e.height=s.height}return s(),t.onMounted(s),t.onPatched(s),e}(),t.useEffect((()=>{if(!this.containerRect)throw new Error("Popover container is not defined");const e=this.popoverRef.el,t=Dr(this.props.anchorRect,this.containerRect),o=t?"block":"none";if("none"!==this.currentDisplayValue&&"none"===o&&this.props.onPopoverHidden?.(),e.style.display=o,this.currentDisplayValue=o,!t)return;const i={width:this.props.maxWidth,height:this.props.maxHeight};let s={width:e.getBoundingClientRect().width,height:e.getBoundingClientRect().height};const r=this.spreadsheetRect,n="BottomLeft"===this.props.positioning?new Vr(t,this.containerRect,i,r):new Br(t,this.containerRect,i,r);e.style["max-height"]=n.getMaxHeight(s.height)+"px",e.style["max-width"]=n.getMaxWidth(s.width)+"px",s={width:e.getBoundingClientRect().width,height:e.getBoundingClientRect().height};let a=n.getCss(s,this.props.verticalOffset);for(const t of Object.keys(a))e.style[t]=a[t];const l=n.getCurrentPosition(s);this.currentPosition&&l!==this.currentPosition&&this.props.onPopoverMoved?.(),this.currentPosition=l}))}get popoverStyle(){return Yi({"z-index":`${this.props.zIndex}`})}}kr.props={anchorRect:Object,containerRect:{type:Object,optional:!0},positioning:{type:String,optional:!0},maxWidth:{type:Number,optional:!0},maxHeight:{type:Number,optional:!0},verticalOffset:{type:Number,optional:!0},onMouseWheel:{type:Function,optional:!0},onPopoverHidden:{type:Function,optional:!0},onPopoverMoved:{type:Function,optional:!0},zIndex:{type:Number,optional:!0},slots:Object};class Ur{anchorRect;containerRect;propsMaxSize;spreadsheetOffset;constructor(e,t,o,i){this.anchorRect=e,this.containerRect=t,this.propsMaxSize=o,this.spreadsheetOffset=i}shouldRenderAtBottom(e){return e<=this.availableHeightDown||this.availableHeightDown>=this.availableHeightUp}shouldRenderAtRight(e){return e<=this.availableWidthRight||this.availableWidthRight>=this.availableWidthLeft}getMaxHeight(e){const t=this.shouldRenderAtBottom(e)?this.availableHeightDown:this.availableHeightUp;return this.propsMaxSize.height?Math.min(t,this.propsMaxSize.height):t}getMaxWidth(e){const t=this.shouldRenderAtRight(e)?this.availableWidthRight:this.availableWidthLeft;return this.propsMaxSize.width?Math.min(t,this.propsMaxSize.width):t}getCss(e,t){const o=this.getMaxHeight(e.height),i=this.getMaxWidth(e.width),s=Math.min(o,e.height),r=Math.min(i,e.width),n=this.shouldRenderAtBottom(e.height),a=this.shouldRenderAtRight(e.width);t=n?t:-t;return{top:this.getTopCoordinate(s,n)-this.spreadsheetOffset.y-t+"px",left:this.getLeftCoordinate(r,a)-this.spreadsheetOffset.x+"px"}}getCurrentPosition(e){const t=this.shouldRenderAtBottom(e.height),o=this.shouldRenderAtRight(e.width);return t&&o?"BottomRight":t&&!o?"BottomLeft":!t&&o?"TopRight":"TopLeft"}}class Vr extends Ur{get availableHeightUp(){return this.anchorRect.y-this.containerRect.y}get availableHeightDown(){return this.containerRect.height-this.availableHeightUp-this.anchorRect.height}get availableWidthRight(){return this.containerRect.x+this.containerRect.width-this.anchorRect.x}get availableWidthLeft(){return this.anchorRect.x+this.anchorRect.width-this.containerRect.x}getTopCoordinate(e,t){return t?this.anchorRect.y+this.anchorRect.height:this.anchorRect.y-e}getLeftCoordinate(e,t){return t?this.anchorRect.x:this.anchorRect.x+this.anchorRect.width-e}}class Br extends Ur{get availableHeightUp(){return this.anchorRect.y+this.anchorRect.height-this.containerRect.y}get availableHeightDown(){return this.containerRect.y+this.containerRect.height-this.anchorRect.y}get availableWidthRight(){return this.containerRect.width-this.anchorRect.width-this.availableWidthLeft}get availableWidthLeft(){return this.anchorRect.x-this.containerRect.x}getTopCoordinate(e,t){return t?this.anchorRect.y:this.anchorRect.y+this.anchorRect.height-e}getLeftCoordinate(e,t){return t?this.anchorRect.x+this.anchorRect.width:this.anchorRect.x-e}}Wi`
176
176
  .o-menu {
177
177
  background-color: white;
178
178
  padding: ${6}px 0px;
@@ -1253,7 +1253,7 @@
1253
1253
  height: 0px;
1254
1254
  }
1255
1255
  }
1256
- `;class aS extends t.Component{static template="o-spreadsheet-FiguresContainer";static components={FigureComponent:_v};dnd=t.useState({draggedFigure:void 0,horizontalSnap:void 0,verticalSnap:void 0});setup(){t.onMounted((()=>{this.render()}))}getVisibleFigures(){const e=this.env.model.getters.getVisibleFigures();return this.dnd.draggedFigure&&!e.some((e=>e.id===this.dnd.draggedFigure?.id))&&e.push(this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(),this.dnd.draggedFigure?.id)),e}get containers(){const e=this.getVisibleFigures(),t=[];for(const o of["topLeft","topRight","bottomLeft","bottomRight"]){const i=e.filter((e=>this.getFigureContainer(e)===o));i.length>0&&t.push({type:o,figures:i,style:this.getContainerStyle(o),inverseViewportStyle:this.getInverseViewportPositionStyle(o)})}return this.dnd.draggedFigure&&t.push({type:"dnd",figures:[this.getDndFigure()],style:this.getContainerStyle("dnd"),inverseViewportStyle:this.getInverseViewportPositionStyle("dnd")}),t}getContainerStyle(e){return this.rectToCss(this.getContainerRect(e))}rectToCss(e){return Yi({left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`})}getContainerRect(e){const{width:t,height:o}=this.env.model.getters.getMainViewportRect(),{x:i,y:s}=this.env.model.getters.getMainViewportCoordinates(),r=["bottomRight","topRight"].includes(e)?i:0,n=t-r,a=["bottomRight","bottomLeft"].includes(e)?s:0;return{x:r,y:a,width:n,height:o-a}}getInverseViewportPositionStyle(e){const{scrollX:t,scrollY:o}=this.env.model.getters.getActiveSheetScrollInfo(),{x:i,y:s}=this.env.model.getters.getMainViewportCoordinates();return Yi({left:`${["bottomRight","topRight"].includes(e)?-(i+t):0}px`,top:`${["bottomRight","bottomLeft"].includes(e)?-(s+o):0}px`})}getFigureContainer(e){const{x:t,y:o}=this.env.model.getters.getMainViewportCoordinates();return e.id===this.dnd.draggedFigure?.id?"dnd":e.x<t&&e.y<o?"topLeft":e.x<t?"bottomLeft":e.y<o?"topRight":"bottomRight"}startDraggingFigure(e,t){if(t.button>0||this.env.model.getters.isReadonly())return;if(!this.env.model.dispatch("SELECT_FIGURE",{id:e.id}).isSuccessful)return;const o=this.env.model.getters.getActiveSheetId(),i={x:t.clientX,y:t.clientY},s={maxX:this.env.model.getters.getColDimensions(o,this.env.model.getters.getNumberCols(o)-1).end,maxY:this.env.model.getters.getRowDimensions(o,this.env.model.getters.getNumberRows(o)-1).end},{x:r,y:n}=Qv(this.env.model.getters,e),a={...e,x:r,y:n};rv((t=>{const o=this.env.model.getters,r=function({x:e,y:t},{x:o,y:i},s,{x:r,y:n},{maxX:a,maxY:l},{scrollX:c,scrollY:h}){const d=r?0:-c,u=n?0:-h,g=e-o,p=oS(s.x+g,d,a-s.width-c),m=t-i,f=oS(s.y+m,u,l-s.height-h);return{...s,x:p,y:f}}({x:t.clientX,y:t.clientY},i,a,this.env.model.getters.getMainViewportCoordinates(),s,o.getActiveSheetScrollInfo()),n=this.getOtherFigures(e.id),l=function(e,t,o){const i={...t},s=rS(e,i,["hCenter","right","left"],o,["hCenter","right","left"]),r=rS(e,i,["vCenter","bottom","top"],o,["vCenter","bottom","top"]),{y:n,x:a}=e.getMainViewportCoordinates(),{scrollY:l,scrollX:c}=e.getActiveSheetScrollInfo();if(r){i.y-=r.snapOffset;const e=t.y<n,o=i.y<n;e&&!o?i.y+=l:!e&&o&&(i.y-=l)}if(s){i.x-=s.snapOffset;const e=t.x<a,o=i.x<a;e&&!o?i.x+=c:!e&&o&&(i.x-=c)}return{snappedFigure:i,verticalSnapLine:s,horizontalSnapLine:r}}(o,Jv(o,r),n);this.dnd.draggedFigure=Qv(o,l.snappedFigure),this.dnd.horizontalSnap=this.getSnap(l.horizontalSnapLine),this.dnd.verticalSnap=this.getSnap(l.verticalSnapLine)}),(t=>{if(!this.dnd.draggedFigure)return;let{x:i,y:s}=Jv(this.env.model.getters,this.dnd.draggedFigure);this.dnd.draggedFigure=void 0,this.dnd.horizontalSnap=void 0,this.dnd.verticalSnap=void 0,this.env.model.dispatch("UPDATE_FIGURE",{sheetId:o,id:e.id,x:i,y:s})}))}startResize(e,t,o,i){i.stopPropagation();const s={x:i.clientX,y:i.clientY},{x:r,y:n}=Qv(this.env.model.getters,e),a={...e,x:r,y:n},l=em.get(e.tag).keepRatio||!1,c=em.get(e.tag).minFigSize||80;rv((i=>{const r={x:i.clientX,y:i.clientY},n=function(e,t,o,{x:i,y:s},{x:r,y:n},a,l,{scrollX:c,scrollY:h}){let{x:d,y:u,width:g,height:p}=e;if(a&&0!=t&&0!=o){const a=Math.min(t*(r-i),e.width-l),c=Math.min(o*(n-s),e.height-l),h=Math.min(a/e.width,c/e.height);g=e.width*(1-h),p=e.height*(1-h),t<0&&(d=e.x+e.width*h),o<0&&(u=e.y+e.height*h)}else{const a=Math.max(t*(i-r),l-e.width),c=Math.max(o*(s-n),l-e.height);g=e.width+a,p=e.height+c,t<0&&(d=e.x-a),o<0&&(u=e.y-c)}return d+c<=0&&(g=g+d+c,d=-c),u+h<=0&&(p=p+u+h,u=-h),{...e,x:d,y:u,width:g,height:p}}(a,t,o,r,s,l,c,this.env.model.getters.getActiveSheetScrollInfo()),h=this.getOtherFigures(e.id),d=function(e,t,o,i,s){const r={...i},n=rS(e,r,[-1===t?"left":"right"],s,["right","left"]);n&&(1===t?r.width-=n.snapOffset:-1===t&&(r.x-=n.snapOffset,r.width+=n.snapOffset));const a=rS(e,r,[-1===o?"top":"bottom"],s,["bottom","top"]);return a&&(1===o?r.height-=a.snapOffset:-1===o&&(r.y-=a.snapOffset,r.height+=a.snapOffset)),r.x=Math.round(r.x),r.y=Math.round(r.y),r.height=Math.round(r.height),r.width=Math.round(r.width),{snappedFigure:r,verticalSnapLine:n,horizontalSnapLine:a}}(this.env.model.getters,t,o,n,h);this.dnd.draggedFigure=d.snappedFigure,this.dnd.horizontalSnap=this.getSnap(d.horizontalSnapLine),this.dnd.verticalSnap=this.getSnap(d.verticalSnapLine)}),(i=>{if(!this.dnd.draggedFigure)return;let{x:s,y:r}=Jv(this.env.model.getters,this.dnd.draggedFigure);const n={x:s,y:r};t&&(n.width=this.dnd.draggedFigure.width),o&&(n.height=this.dnd.draggedFigure.height),this.env.model.dispatch("UPDATE_FIGURE",{sheetId:this.env.model.getters.getActiveSheetId(),id:e.id,...n}),this.dnd.draggedFigure=void 0,this.dnd.horizontalSnap=void 0,this.dnd.verticalSnap=void 0}))}getOtherFigures(e){return this.getVisibleFigures().filter((t=>t.id!==e))}getDndFigure(){const e=this.getVisibleFigures().find((e=>e.id===this.dnd.draggedFigure?.id));if(!e)throw new Error("Dnd figure not found");return{...e,...this.dnd.draggedFigure}}getFigureStyle(e){return e.id!==this.dnd.draggedFigure?.id?"":Yi({opacity:"0.9",cursor:"grabbing"})}getSnap(e){if(!e||!this.dnd.draggedFigure)return;const t=e.matchedFigIds.map((e=>this.getVisibleFigures().find((t=>t.id===e)))).filter(ke).map((e=>{const t=Qv(this.env.model.getters,e),o=this.getFigureContainer(e);return Dr(t,this.getContainerRect(o))})).filter(ke),o=function(...e){return Pr(li(...e.map(Lr)))}(this.dnd.draggedFigure,...t);return{line:e,containerStyle:this.rectToCss(o),lineStyle:this.getSnapLineStyle(e,o)}}getSnapLineStyle(e,t){return e?["top","vCenter","bottom"].includes(e.snappedAxisType)?Yi({top:e.position-t.y+"px",left:"0px",width:"100%"}):Yi({top:"0px",left:e.position-t.x+"px",height:"100%"}):""}}function lS(e,...o){t.useEffect((e=>(e?.addEventListener(...o),()=>e?.removeEventListener(...o))),(()=>[e.el]))}aS.props={onFigureDeleted:Function};function cS(e,o,i){let s={col:void 0,row:void 0};const{Date:r}=window;let n=0,a=0,l=0;function c(){return{col:e.model.getters.getColIndex(n),row:e.model.getters.getRowIndex(a)}}const{pause:h,resume:d}=function(e,o){let i;const{setInterval:s,clearInterval:r}=window;return t.useEffect((()=>(i=s(e,o),()=>r(i))),(()=>[o])),{pause:()=>{r(i),i=void 0},resume:()=>{void 0===i&&(i=s(e,o))}}}((function(){const{col:e,row:t}=c(),o=r.now()-l;o>300&&(e!==s.col||t!==s.row)&&u(void 0,void 0);if(o>300){if(e<0||t<0)return;u(e,t)}}),200);function u(e,t){e===s.col&&t===s.row||(s.col=e,s.row=t,i({col:e,row:t}))}return lS(o,"mousemove",(function(e){o.el===e.target&&(n=e.offsetX,a=e.offsetY,l=r.now())})),lS(o,"mouseleave",h),lS(o,"mouseenter",d),lS(o,"mousedown",(function(){const{col:e,row:t}=c();e===s.col&&t===s.row||u(void 0,void 0)})),s}Wi`
1256
+ `;class aS extends t.Component{static template="o-spreadsheet-FiguresContainer";static components={FigureComponent:_v};dnd=t.useState({draggedFigure:void 0,horizontalSnap:void 0,verticalSnap:void 0});setup(){t.onMounted((()=>{this.render()}))}getVisibleFigures(){const e=this.env.model.getters.getVisibleFigures();return this.dnd.draggedFigure&&!e.some((e=>e.id===this.dnd.draggedFigure?.id))&&e.push(this.env.model.getters.getFigure(this.env.model.getters.getActiveSheetId(),this.dnd.draggedFigure?.id)),e}get containers(){const e=this.getVisibleFigures(),t=[];for(const o of["topLeft","topRight","bottomLeft","bottomRight"]){const i=e.filter((e=>this.getFigureContainer(e)===o));i.length>0&&t.push({type:o,figures:i,style:this.getContainerStyle(o),inverseViewportStyle:this.getInverseViewportPositionStyle(o)})}return this.dnd.draggedFigure&&t.push({type:"dnd",figures:[this.getDndFigure()],style:this.getContainerStyle("dnd"),inverseViewportStyle:this.getInverseViewportPositionStyle("dnd")}),t}getContainerStyle(e){return this.rectToCss(this.getContainerRect(e))}rectToCss(e){return Yi({left:`${e.x}px`,top:`${e.y}px`,width:`${e.width}px`,height:`${e.height}px`})}getContainerRect(e){const{width:t,height:o}=this.env.model.getters.getSheetViewDimension(),{x:i,y:s}=this.env.model.getters.getMainViewportCoordinates(),r=["bottomRight","topRight"].includes(e)?i:0,n=t-r,a=["bottomRight","bottomLeft"].includes(e)?s:0;return{x:r,y:a,width:n,height:o-a}}getInverseViewportPositionStyle(e){const{scrollX:t,scrollY:o}=this.env.model.getters.getActiveSheetScrollInfo(),{x:i,y:s}=this.env.model.getters.getMainViewportCoordinates();return Yi({left:`${["bottomRight","topRight"].includes(e)?-(i+t):0}px`,top:`${["bottomRight","bottomLeft"].includes(e)?-(s+o):0}px`})}getFigureContainer(e){const{x:t,y:o}=this.env.model.getters.getMainViewportCoordinates();return e.id===this.dnd.draggedFigure?.id?"dnd":e.x<t&&e.y<o?"topLeft":e.x<t?"bottomLeft":e.y<o?"topRight":"bottomRight"}startDraggingFigure(e,t){if(t.button>0||this.env.model.getters.isReadonly())return;if(!this.env.model.dispatch("SELECT_FIGURE",{id:e.id}).isSuccessful)return;const o=this.env.model.getters.getActiveSheetId(),i={x:t.clientX,y:t.clientY},s={maxX:this.env.model.getters.getColDimensions(o,this.env.model.getters.getNumberCols(o)-1).end,maxY:this.env.model.getters.getRowDimensions(o,this.env.model.getters.getNumberRows(o)-1).end},{x:r,y:n}=Qv(this.env.model.getters,e),a={...e,x:r,y:n};rv((t=>{const o=this.env.model.getters,r=function({x:e,y:t},{x:o,y:i},s,{x:r,y:n},{maxX:a,maxY:l},{scrollX:c,scrollY:h}){const d=r?0:-c,u=n?0:-h,g=e-o,p=oS(s.x+g,d,a-s.width-c),m=t-i,f=oS(s.y+m,u,l-s.height-h);return{...s,x:p,y:f}}({x:t.clientX,y:t.clientY},i,a,this.env.model.getters.getMainViewportCoordinates(),s,o.getActiveSheetScrollInfo()),n=this.getOtherFigures(e.id),l=function(e,t,o){const i={...t},s=rS(e,i,["hCenter","right","left"],o,["hCenter","right","left"]),r=rS(e,i,["vCenter","bottom","top"],o,["vCenter","bottom","top"]),{y:n,x:a}=e.getMainViewportCoordinates(),{scrollY:l,scrollX:c}=e.getActiveSheetScrollInfo();if(r){i.y-=r.snapOffset;const e=t.y<n,o=i.y<n;e&&!o?i.y+=l:!e&&o&&(i.y-=l)}if(s){i.x-=s.snapOffset;const e=t.x<a,o=i.x<a;e&&!o?i.x+=c:!e&&o&&(i.x-=c)}return{snappedFigure:i,verticalSnapLine:s,horizontalSnapLine:r}}(o,Jv(o,r),n);this.dnd.draggedFigure=Qv(o,l.snappedFigure),this.dnd.horizontalSnap=this.getSnap(l.horizontalSnapLine),this.dnd.verticalSnap=this.getSnap(l.verticalSnapLine)}),(t=>{if(!this.dnd.draggedFigure)return;let{x:i,y:s}=Jv(this.env.model.getters,this.dnd.draggedFigure);this.dnd.draggedFigure=void 0,this.dnd.horizontalSnap=void 0,this.dnd.verticalSnap=void 0,this.env.model.dispatch("UPDATE_FIGURE",{sheetId:o,id:e.id,x:i,y:s})}))}startResize(e,t,o,i){i.stopPropagation();const s={x:i.clientX,y:i.clientY},{x:r,y:n}=Qv(this.env.model.getters,e),a={...e,x:r,y:n},l=em.get(e.tag).keepRatio||!1,c=em.get(e.tag).minFigSize||80;rv((i=>{const r={x:i.clientX,y:i.clientY},n=function(e,t,o,{x:i,y:s},{x:r,y:n},a,l,{scrollX:c,scrollY:h}){let{x:d,y:u,width:g,height:p}=e;if(a&&0!=t&&0!=o){const a=Math.min(t*(r-i),e.width-l),c=Math.min(o*(n-s),e.height-l),h=Math.min(a/e.width,c/e.height);g=e.width*(1-h),p=e.height*(1-h),t<0&&(d=e.x+e.width*h),o<0&&(u=e.y+e.height*h)}else{const a=Math.max(t*(i-r),l-e.width),c=Math.max(o*(s-n),l-e.height);g=e.width+a,p=e.height+c,t<0&&(d=e.x-a),o<0&&(u=e.y-c)}return d+c<=0&&(g=g+d+c,d=-c),u+h<=0&&(p=p+u+h,u=-h),{...e,x:d,y:u,width:g,height:p}}(a,t,o,r,s,l,c,this.env.model.getters.getActiveSheetScrollInfo()),h=this.getOtherFigures(e.id),d=function(e,t,o,i,s){const r={...i},n=rS(e,r,[-1===t?"left":"right"],s,["right","left"]);n&&(1===t?r.width-=n.snapOffset:-1===t&&(r.x-=n.snapOffset,r.width+=n.snapOffset));const a=rS(e,r,[-1===o?"top":"bottom"],s,["bottom","top"]);return a&&(1===o?r.height-=a.snapOffset:-1===o&&(r.y-=a.snapOffset,r.height+=a.snapOffset)),r.x=Math.round(r.x),r.y=Math.round(r.y),r.height=Math.round(r.height),r.width=Math.round(r.width),{snappedFigure:r,verticalSnapLine:n,horizontalSnapLine:a}}(this.env.model.getters,t,o,n,h);this.dnd.draggedFigure=d.snappedFigure,this.dnd.horizontalSnap=this.getSnap(d.horizontalSnapLine),this.dnd.verticalSnap=this.getSnap(d.verticalSnapLine)}),(i=>{if(!this.dnd.draggedFigure)return;let{x:s,y:r}=Jv(this.env.model.getters,this.dnd.draggedFigure);const n={x:s,y:r};t&&(n.width=this.dnd.draggedFigure.width),o&&(n.height=this.dnd.draggedFigure.height),this.env.model.dispatch("UPDATE_FIGURE",{sheetId:this.env.model.getters.getActiveSheetId(),id:e.id,...n}),this.dnd.draggedFigure=void 0,this.dnd.horizontalSnap=void 0,this.dnd.verticalSnap=void 0}))}getOtherFigures(e){return this.getVisibleFigures().filter((t=>t.id!==e))}getDndFigure(){const e=this.getVisibleFigures().find((e=>e.id===this.dnd.draggedFigure?.id));if(!e)throw new Error("Dnd figure not found");return{...e,...this.dnd.draggedFigure}}getFigureStyle(e){return e.id!==this.dnd.draggedFigure?.id?"":Yi({opacity:"0.9",cursor:"grabbing"})}getSnap(e){if(!e||!this.dnd.draggedFigure)return;const t=e.matchedFigIds.map((e=>this.getVisibleFigures().find((t=>t.id===e)))).filter(ke).map((e=>{const t=Qv(this.env.model.getters,e),o=this.getFigureContainer(e);return Dr(t,this.getContainerRect(o))})).filter(ke),o=function(...e){return Pr(li(...e.map(Lr)))}(this.dnd.draggedFigure,...t);return{line:e,containerStyle:this.rectToCss(o),lineStyle:this.getSnapLineStyle(e,o)}}getSnapLineStyle(e,t){return e?["top","vCenter","bottom"].includes(e.snappedAxisType)?Yi({top:e.position-t.y+"px",left:"0px",width:"100%"}):Yi({top:"0px",left:e.position-t.x+"px",height:"100%"}):""}}function lS(e,...o){t.useEffect((e=>(e?.addEventListener(...o),()=>e?.removeEventListener(...o))),(()=>[e.el]))}aS.props={onFigureDeleted:Function};function cS(e,o,i){let s={col:void 0,row:void 0};const{Date:r}=window;let n=0,a=0,l=0;function c(){return{col:e.model.getters.getColIndex(n),row:e.model.getters.getRowIndex(a)}}const{pause:h,resume:d}=function(e,o){let i;const{setInterval:s,clearInterval:r}=window;return t.useEffect((()=>(i=s(e,o),()=>r(i))),(()=>[o])),{pause:()=>{r(i),i=void 0},resume:()=>{void 0===i&&(i=s(e,o))}}}((function(){const{col:e,row:t}=c(),o=r.now()-l;o>300&&(e!==s.col||t!==s.row)&&u(void 0,void 0);if(o>300){if(e<0||t<0)return;u(e,t)}}),200);function u(e,t){e===s.col&&t===s.row||(s.col=e,s.row=t,i({col:e,row:t}))}return lS(o,"mousemove",(function(e){o.el===e.target&&(n=e.offsetX,a=e.offsetY,l=r.now())})),lS(o,"mouseleave",h),lS(o,"mouseenter",d),lS(o,"mousedown",(function(){const{col:e,row:t}=c();e===s.col&&t===s.row||u(void 0,void 0)})),s}Wi`
1257
1257
  .o-paint-format-cursor {
1258
1258
  cursor: url("data:image/svg+xml,${encodeURIComponent('\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="14" height="16"><path d="M6.5.4c1.3-.8 2.9-.1 3.8 1.4l2.9 5.1c.2.4.9 1.6-.4 2.3l-1.6.9 1.8 3.1c.2.4.1 1-.2 1.2l-1.6 1c-.3.1-.9 0-1.1-.4l-1.8-3.1-1.6 1c-.6.4-1.7 0-2.2-.8L0 4.3"/><path fill="#fff" d="M9.1 2a1.4 1.1 60 0 0-1.7-.6L5.5 2.5l.9 1.6-1 .6-.9-1.6-.6.4 1.8 3.1-1.3.7-1.8-3.1-1 .6 3.8 6.6 6.8-3.98M3.9 8.8 10.82 5l.795 1.4-6.81 3.96"/></svg>\n')}"), auto;
1259
1259
  }
@@ -2538,4 +2538,4 @@
2538
2538
  <tableParts count="${e.filterTables.length}">
2539
2539
  ${wE(a)}
2540
2540
  </tableParts>
2541
- `}var iI;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(iI||(iI={}));function sI(e,t={}){const o=Ce(t);return o.type=e,o}const rI={},nI={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:F,HEADER_WIDTH:D,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:L,DEFAULT_CELL_HEIGHT:P,SCROLLBAR_WIDTH:k},aI={autofillModifiersRegistry:hr,autofillRulesRegistry:dr,cellMenuRegistry:Rf,colMenuRegistry:qb,linkMenuRegistry:zg,functionRegistry:vu,featurePluginRegistry:Ox,statefulUIPluginRegistry:Mx,coreViewsPluginRegistry:Nx,corePluginRegistry:Ax,rowMenuRegistry:jb,sidePanelRegistry:Mv,figureRegistry:em,chartSidePanelComponentRegistry:bv,chartComponentRegistry:jp,chartRegistry:Yp,topbarMenuRegistry:Xb,topbarComponentRegistry:Nv,clickableCellRegistry:_x,otRegistry:Kb,inverseCommandRegistry:sm,urlRegistry:ts,cellPopoverRegistry:Wg,numberFormatMenuRegistry:Zb,repeatLocalCommandTransformRegistry:dx,repeatCommandTransformRegistry:hx},lI={arg:qr,toBoolean:Ds,toJsDate:Ls,toNumber:Is,toString:Ms,toXC:xt,toZone:ti,toCartesian:wt,numberToLetters:bt,UuidGenerator:Bi,formatValue:fo,createCurrencyFormat:_o,computeTextWidth:Fi,createEmptyWorkbookData:jE,createEmptySheet:YE,createEmptyExcelSheet:XE,getDefaultChartJsRuntime:wp,chartFontColor:rp,ChartColors:sp,EvaluationError:c,CellErrorLevel:l,getFillingMode:Rp,rgbaToHex:dt,colorToRGBA:ut,positionToZone:wi,isDefined:ke,lazy:ze,genericRepeat:ux},cI={isMarkdownLink:Oe,parseMarkdownLink:_e,markdownLink:Ne,openLink:ns,urlRepresentation:rs},hI={ChartPanel:vv,ChartFigure:Kp,ChartJsComponent:zi,Grid:RS,GridOverlay:hS,ScorecardChart:Xi,LineConfigPanel:pv,LineBarPieDesignPanel:dv,BarConfigPanel:sv,LineBarPieConfigPanel:iv,GaugeChartConfigPanel:uv,GaugeChartDesignPanel:gv,ScorecardChartConfigPanel:mv,ScorecardChartDesignPanel:fv,FigureComponent:_v};const dI={DEFAULT_LOCALE:eo};e.AbstractChart=qg,e.CorePlugin=QE,e.DispatchResult=fs,e.EvaluationError=c,e.Model=class extends Gw{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 Bi,r=!0){super(),i=GE(e,i);const n=$E(e,r);this.state=new my,this.uuidGenerator=s,this.config=this.setupConfig(o),this.session=this.setupSession(n.revisionId),this.coreGetters={},this.range=new rw(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new py(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of Ax.getAll())this.setupCorePlugin(e,n);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(i);for(let e of Nx.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 Mx.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of Ox.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 ex(dy({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:r("Anonymous").toString()},o=e.transportService||new oy;return{...e,mode:e.mode||"normal",custom:e.custom||{},defaultCurrencyFormat:e.defaultCurrencyFormat||"[$$]#,##0.00",external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e)}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(Jt));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session}}checkDispatchAllowed(e){const t=ms(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>0!==e))?new fs(t.flat()):fs.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(sI(e,t));dispatch=(e,t)=>{const o=sI(e,t);let i=this.status;if(this.getters.isReadonly()&&(s=o,!gs.has(s.type)))return new fs(70);var s;if(!this.session.canApplyOptimisticUpdate())return new fs(67);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 fs.Success};dispatchFromCorePlugin=(e,t)=>{const o=sI(e,t),i=this.status;this.status=2;const s=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(s,o),this.status=i,fs.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=jE();for(let t of this.handlers)t instanceof QE&&t.export(e);return e.revisionId=this.session.getRevisionId()||te,e=Ce(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={...jE(),sheets:[XE(HE,"Sheet1")]};for(let t of this.handlers)t instanceof KE&&t.exportForExcel(e);return e=Ce(e),tI(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Ji,e.Revision=Qw,e.SPREADSHEET_DIMENSIONS=nI,e.Spreadsheet=ty,e.UIPlugin=nw,e.__info__=rI,e.addFunction=function(e,t){vu.add(e,t)},e.astToFormula=Ju,e.compile=ug,e.components=hI,e.constants=dI,e.convertAstNodes=ju,e.coreTypes=ps,e.findCellInNewZone=Ci,e.functionCache=dg,e.helpers=lI,e.invalidateCFEvaluationCommands=us,e.invalidateDependenciesCommands=ds,e.invalidateEvaluationCommands=hs,e.iterateAstNodes=Xu,e.links=cI,e.load=$E,e.parse=Zu,e.readonlyAllowedCommands=gs,e.registries=aI,e.setDefaultSheetViewSize=function(e){pe=e},e.setTranslationMethod=function(e){o=e},e.tokenize=Iu,Object.defineProperty(e,"__esModule",{value:!0}),rI.version="16.4.36",rI.date="2024-06-10T09:33:43.623Z",rI.hash="3b15ed5"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2541
+ `}var iI;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(iI||(iI={}));function sI(e,t={}){const o=Ce(t);return o.type=e,o}const rI={},nI={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:F,HEADER_WIDTH:D,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:L,DEFAULT_CELL_HEIGHT:P,SCROLLBAR_WIDTH:k},aI={autofillModifiersRegistry:hr,autofillRulesRegistry:dr,cellMenuRegistry:Rf,colMenuRegistry:qb,linkMenuRegistry:zg,functionRegistry:vu,featurePluginRegistry:Ox,statefulUIPluginRegistry:Mx,coreViewsPluginRegistry:Nx,corePluginRegistry:Ax,rowMenuRegistry:jb,sidePanelRegistry:Mv,figureRegistry:em,chartSidePanelComponentRegistry:bv,chartComponentRegistry:jp,chartRegistry:Yp,topbarMenuRegistry:Xb,topbarComponentRegistry:Nv,clickableCellRegistry:_x,otRegistry:Kb,inverseCommandRegistry:sm,urlRegistry:ts,cellPopoverRegistry:Wg,numberFormatMenuRegistry:Zb,repeatLocalCommandTransformRegistry:dx,repeatCommandTransformRegistry:hx},lI={arg:qr,toBoolean:Ds,toJsDate:Ls,toNumber:Is,toString:Ms,toXC:xt,toZone:ti,toCartesian:wt,numberToLetters:bt,UuidGenerator:Bi,formatValue:fo,createCurrencyFormat:_o,computeTextWidth:Fi,createEmptyWorkbookData:jE,createEmptySheet:YE,createEmptyExcelSheet:XE,getDefaultChartJsRuntime:wp,chartFontColor:rp,ChartColors:sp,EvaluationError:c,CellErrorLevel:l,getFillingMode:Rp,rgbaToHex:dt,colorToRGBA:ut,positionToZone:wi,isDefined:ke,lazy:ze,genericRepeat:ux,deepEquals:We},cI={isMarkdownLink:Oe,parseMarkdownLink:_e,markdownLink:Ne,openLink:ns,urlRepresentation:rs},hI={ChartPanel:vv,ChartFigure:Kp,ChartJsComponent:zi,Grid:RS,GridOverlay:hS,ScorecardChart:Xi,LineConfigPanel:pv,LineBarPieDesignPanel:dv,BarConfigPanel:sv,LineBarPieConfigPanel:iv,GaugeChartConfigPanel:uv,GaugeChartDesignPanel:gv,ScorecardChartConfigPanel:mv,ScorecardChartDesignPanel:fv,FigureComponent:_v};const dI={DEFAULT_LOCALE:eo};e.AbstractChart=qg,e.CorePlugin=QE,e.DispatchResult=fs,e.EvaluationError=c,e.Model=class extends Gw{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 Bi,r=!0){super(),i=GE(e,i);const n=$E(e,r);this.state=new my,this.uuidGenerator=s,this.config=this.setupConfig(o),this.session=this.setupSession(n.revisionId),this.coreGetters={},this.range=new rw(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getRangeFromZone=this.range.getRangeFromZone.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new py(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of Ax.getAll())this.setupCorePlugin(e,n);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(i);for(let e of Nx.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 Mx.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of Ox.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 ex(dy({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:r("Anonymous").toString()},o=e.transportService||new oy;return{...e,mode:e.mode||"normal",custom:e.custom||{},defaultCurrencyFormat:e.defaultCurrencyFormat||"[$$]#,##0.00",external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e)}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(Jt));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session}}checkDispatchAllowed(e){const t=ms(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>0!==e))?new fs(t.flat()):fs.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(sI(e,t));dispatch=(e,t)=>{const o=sI(e,t);let i=this.status;if(this.getters.isReadonly()&&(s=o,!gs.has(s.type)))return new fs(70);var s;if(!this.session.canApplyOptimisticUpdate())return new fs(67);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 fs.Success};dispatchFromCorePlugin=(e,t)=>{const o=sI(e,t),i=this.status;this.status=2;const s=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(s,o),this.status=i,fs.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=jE();for(let t of this.handlers)t instanceof QE&&t.export(e);return e.revisionId=this.session.getRevisionId()||te,e=Ce(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={...jE(),sheets:[XE(HE,"Sheet1")]};for(let t of this.handlers)t instanceof KE&&t.exportForExcel(e);return e=Ce(e),tI(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Ji,e.Revision=Qw,e.SPREADSHEET_DIMENSIONS=nI,e.Spreadsheet=ty,e.UIPlugin=nw,e.__info__=rI,e.addFunction=function(e,t){vu.add(e,t)},e.astToFormula=Ju,e.compile=ug,e.components=hI,e.constants=dI,e.convertAstNodes=ju,e.coreTypes=ps,e.findCellInNewZone=Ci,e.functionCache=dg,e.helpers=lI,e.invalidateCFEvaluationCommands=us,e.invalidateDependenciesCommands=ds,e.invalidateEvaluationCommands=hs,e.iterateAstNodes=Xu,e.links=cI,e.load=$E,e.parse=Zu,e.readonlyAllowedCommands=gs,e.registries=aI,e.setDefaultSheetViewSize=function(e){pe=e},e.setTranslationMethod=function(e){o=e},e.tokenize=Iu,Object.defineProperty(e,"__esModule",{value:!0}),rI.version="16.4.37",rI.date="2024-06-14T10:00:27.521Z",rI.hash="195b41b"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
@@ -3958,7 +3958,7 @@ https://fontawesome.com/license -->
3958
3958
  </t>
3959
3959
  </odoo>
3960
3960
  <!--
3961
- __info__.version = '16.4.36';
3962
- __info__.date = '2024-06-10T09:34:10.377Z';
3963
- __info__.hash = '3b15ed5';
3961
+ __info__.version = '16.4.37';
3962
+ __info__.date = '2024-06-14T10:00:54.652Z';
3963
+ __info__.hash = '195b41b';
3964
3964
  -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "16.4.36",
3
+ "version": "16.4.37",
4
4
  "description": "A spreadsheet component",
5
5
  "main": "dist/o-spreadsheet.cjs.js",
6
6
  "browser": "dist/o-spreadsheet.iife.js",