@odoo/o-spreadsheet 16.3.38 → 16.3.39

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.
@@ -5493,7 +5493,7 @@ class Popover extends owl.Component {
5493
5493
  if (!anchor)
5494
5494
  return;
5495
5495
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
5496
- const elDims = {
5496
+ let elDims = {
5497
5497
  width: el.getBoundingClientRect().width,
5498
5498
  height: el.getBoundingClientRect().height,
5499
5499
  };
@@ -5501,7 +5501,14 @@ class Popover extends owl.Component {
5501
5501
  const popoverPositionHelper = this.props.positioning === "BottomLeft"
5502
5502
  ? new BottomLeftPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect)
5503
5503
  : new TopRightPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect);
5504
- const style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5504
+ el.style["max-height"] = popoverPositionHelper.getMaxHeight(elDims.height) + "px";
5505
+ el.style["max-width"] = popoverPositionHelper.getMaxWidth(elDims.width) + "px";
5506
+ // Re-compute the dimensions after setting the max-width and max-height
5507
+ elDims = {
5508
+ width: el.getBoundingClientRect().width,
5509
+ height: el.getBoundingClientRect().height,
5510
+ };
5511
+ let style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5505
5512
  for (const property of Object.keys(style)) {
5506
5513
  el.style[property] = style[property];
5507
5514
  }
@@ -5577,8 +5584,6 @@ class PopoverPositionContext {
5577
5584
  const shouldRenderAtRight = this.shouldRenderAtRight(elDims.width);
5578
5585
  verticalOffset = shouldRenderAtBottom ? verticalOffset : -verticalOffset;
5579
5586
  const cssProperties = {
5580
- "max-height": maxHeight + "px",
5581
- "max-width": maxWidth + "px",
5582
5587
  top: this.getTopCoordinate(actualHeight, shouldRenderAtBottom) -
5583
5588
  this.spreadsheetOffset.y -
5584
5589
  verticalOffset +
@@ -22283,7 +22288,7 @@ class FiguresContainer extends owl.Component {
22283
22288
  });
22284
22289
  }
22285
22290
  getContainerRect(container) {
22286
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
22291
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
22287
22292
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
22288
22293
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
22289
22294
  const width = viewWidth - x;
@@ -48101,6 +48106,7 @@ const helpers = {
48101
48106
  isDefined: isDefined$1,
48102
48107
  lazy,
48103
48108
  genericRepeat,
48109
+ deepEquals,
48104
48110
  };
48105
48111
  const links = {
48106
48112
  isMarkdownLink,
@@ -48161,6 +48167,6 @@ exports.setTranslationMethod = setTranslationMethod;
48161
48167
  exports.tokenize = tokenize;
48162
48168
 
48163
48169
 
48164
- __info__.version = '16.3.38';
48165
- __info__.date = '2024-06-10T09:33:40.314Z';
48166
- __info__.hash = '2fcf01c';
48170
+ __info__.version = '16.3.39';
48171
+ __info__.date = '2024-06-14T09:57:15.035Z';
48172
+ __info__.hash = '9701da6';
@@ -963,6 +963,10 @@ declare function isDefined<T>(argument: T | undefined): argument is T;
963
963
  * Lazy value computed by the provided function.
964
964
  */
965
965
  declare function lazy<T>(fn: (() => T) | T): Lazy<T>;
966
+ /**
967
+ * Compares two objects.
968
+ */
969
+ declare function deepEquals(o1: any, o2: any): boolean;
966
970
 
967
971
  interface ConstructorArgs {
968
972
  readonly zone: Readonly<Zone | UnboundedZone>;
@@ -7218,6 +7222,7 @@ declare const helpers: {
7218
7222
  isDefined: typeof isDefined;
7219
7223
  lazy: typeof lazy;
7220
7224
  genericRepeat: typeof genericRepeat;
7225
+ deepEquals: typeof deepEquals;
7221
7226
  };
7222
7227
  declare const links: {
7223
7228
  isMarkdownLink: typeof isMarkdownLink;
@@ -5489,7 +5489,7 @@ class Popover extends Component {
5489
5489
  if (!anchor)
5490
5490
  return;
5491
5491
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
5492
- const elDims = {
5492
+ let elDims = {
5493
5493
  width: el.getBoundingClientRect().width,
5494
5494
  height: el.getBoundingClientRect().height,
5495
5495
  };
@@ -5497,7 +5497,14 @@ class Popover extends Component {
5497
5497
  const popoverPositionHelper = this.props.positioning === "BottomLeft"
5498
5498
  ? new BottomLeftPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect)
5499
5499
  : new TopRightPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect);
5500
- const style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5500
+ el.style["max-height"] = popoverPositionHelper.getMaxHeight(elDims.height) + "px";
5501
+ el.style["max-width"] = popoverPositionHelper.getMaxWidth(elDims.width) + "px";
5502
+ // Re-compute the dimensions after setting the max-width and max-height
5503
+ elDims = {
5504
+ width: el.getBoundingClientRect().width,
5505
+ height: el.getBoundingClientRect().height,
5506
+ };
5507
+ let style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5501
5508
  for (const property of Object.keys(style)) {
5502
5509
  el.style[property] = style[property];
5503
5510
  }
@@ -5573,8 +5580,6 @@ class PopoverPositionContext {
5573
5580
  const shouldRenderAtRight = this.shouldRenderAtRight(elDims.width);
5574
5581
  verticalOffset = shouldRenderAtBottom ? verticalOffset : -verticalOffset;
5575
5582
  const cssProperties = {
5576
- "max-height": maxHeight + "px",
5577
- "max-width": maxWidth + "px",
5578
5583
  top: this.getTopCoordinate(actualHeight, shouldRenderAtBottom) -
5579
5584
  this.spreadsheetOffset.y -
5580
5585
  verticalOffset +
@@ -22279,7 +22284,7 @@ class FiguresContainer extends Component {
22279
22284
  });
22280
22285
  }
22281
22286
  getContainerRect(container) {
22282
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
22287
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
22283
22288
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
22284
22289
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
22285
22290
  const width = viewWidth - x;
@@ -48097,6 +48102,7 @@ const helpers = {
48097
48102
  isDefined: isDefined$1,
48098
48103
  lazy,
48099
48104
  genericRepeat,
48105
+ deepEquals,
48100
48106
  };
48101
48107
  const links = {
48102
48108
  isMarkdownLink,
@@ -48129,6 +48135,6 @@ function addFunction(functionName, functionDescription) {
48129
48135
  export { AbstractChart, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, tokenize };
48130
48136
 
48131
48137
 
48132
- __info__.version = '16.3.38';
48133
- __info__.date = '2024-06-10T09:33:40.314Z';
48134
- __info__.hash = '2fcf01c';
48138
+ __info__.version = '16.3.39';
48139
+ __info__.date = '2024-06-14T09:57:15.035Z';
48140
+ __info__.hash = '9701da6';
@@ -5490,7 +5490,7 @@
5490
5490
  if (!anchor)
5491
5491
  return;
5492
5492
  const propsMaxSize = { width: this.props.maxWidth, height: this.props.maxHeight };
5493
- const elDims = {
5493
+ let elDims = {
5494
5494
  width: el.getBoundingClientRect().width,
5495
5495
  height: el.getBoundingClientRect().height,
5496
5496
  };
@@ -5498,7 +5498,14 @@
5498
5498
  const popoverPositionHelper = this.props.positioning === "BottomLeft"
5499
5499
  ? new BottomLeftPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect)
5500
5500
  : new TopRightPopoverContext(anchor, this.containerRect, propsMaxSize, spreadsheetRect);
5501
- const style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5501
+ el.style["max-height"] = popoverPositionHelper.getMaxHeight(elDims.height) + "px";
5502
+ el.style["max-width"] = popoverPositionHelper.getMaxWidth(elDims.width) + "px";
5503
+ // Re-compute the dimensions after setting the max-width and max-height
5504
+ elDims = {
5505
+ width: el.getBoundingClientRect().width,
5506
+ height: el.getBoundingClientRect().height,
5507
+ };
5508
+ let style = popoverPositionHelper.getCss(elDims, this.props.verticalOffset);
5502
5509
  for (const property of Object.keys(style)) {
5503
5510
  el.style[property] = style[property];
5504
5511
  }
@@ -5574,8 +5581,6 @@
5574
5581
  const shouldRenderAtRight = this.shouldRenderAtRight(elDims.width);
5575
5582
  verticalOffset = shouldRenderAtBottom ? verticalOffset : -verticalOffset;
5576
5583
  const cssProperties = {
5577
- "max-height": maxHeight + "px",
5578
- "max-width": maxWidth + "px",
5579
5584
  top: this.getTopCoordinate(actualHeight, shouldRenderAtBottom) -
5580
5585
  this.spreadsheetOffset.y -
5581
5586
  verticalOffset +
@@ -22280,7 +22285,7 @@
22280
22285
  });
22281
22286
  }
22282
22287
  getContainerRect(container) {
22283
- const { width: viewWidth, height: viewHeight } = this.env.model.getters.getMainViewportRect();
22288
+ const { width: viewWidth, height: viewHeight } = this.env.model.getters.getSheetViewDimension();
22284
22289
  const { x: viewportX, y: viewportY } = this.env.model.getters.getMainViewportCoordinates();
22285
22290
  const x = ["bottomRight", "topRight"].includes(container) ? viewportX : 0;
22286
22291
  const width = viewWidth - x;
@@ -48098,6 +48103,7 @@
48098
48103
  isDefined: isDefined$1,
48099
48104
  lazy,
48100
48105
  genericRepeat,
48106
+ deepEquals,
48101
48107
  };
48102
48108
  const links = {
48103
48109
  isMarkdownLink,
@@ -48160,9 +48166,9 @@
48160
48166
  Object.defineProperty(exports, '__esModule', { value: true });
48161
48167
 
48162
48168
 
48163
- __info__.version = '16.3.38';
48164
- __info__.date = '2024-06-10T09:33:40.314Z';
48165
- __info__.hash = '2fcf01c';
48169
+ __info__.version = '16.3.39';
48170
+ __info__.date = '2024-06-14T09:57:15.035Z';
48171
+ __info__.hash = '9701da6';
48166
48172
 
48167
48173
 
48168
48174
  })(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 vn extends t.Component{static template="o-spreadsheet-Popover";static defaultProps={positioning:"BottomLeft",verticalOffset:0,onMouseWheel:()=>{},onPopoverMoved:()=>{},onPopoverHidden:()=>{},zIndex:ue.Popover};popoverRef=t.useRef("popover");currentPosition=void 0;currentDisplayValue=void 0;spreadsheetRect=gn();containerRect;setup(){this.containerRect=function(){const e=t.useState({x:0,y:0,width:0,height:0}),o=t.useComponent(),i=gn();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=mn(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},n=this.spreadsheetRect,r="BottomLeft"===this.props.positioning?new Cn(t,this.containerRect,i,n):new En(t,this.containerRect,i,n),a=r.getCss(s,this.props.verticalOffset);for(const t of Object.keys(a))e.style[t]=a[t];const l=r.getCurrentPosition(s);this.currentPosition&&l!==this.currentPosition&&this.props.onPopoverMoved?.(),this.currentPosition=l}))}get popoverStyle(){return Li({"z-index":`${this.props.zIndex}`})}}vn.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 Sn{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),n=Math.min(i,e.width),r=this.shouldRenderAtBottom(e.height),a=this.shouldRenderAtRight(e.width);t=r?t:-t;return{"max-height":o+"px","max-width":i+"px",top:this.getTopCoordinate(s,r)-this.spreadsheetOffset.y-t+"px",left:this.getLeftCoordinate(n,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 Cn extends Sn{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 En extends Sn{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}}Ni`
175
+ `;class vn extends t.Component{static template="o-spreadsheet-Popover";static defaultProps={positioning:"BottomLeft",verticalOffset:0,onMouseWheel:()=>{},onPopoverMoved:()=>{},onPopoverHidden:()=>{},zIndex:ue.Popover};popoverRef=t.useRef("popover");currentPosition=void 0;currentDisplayValue=void 0;spreadsheetRect=gn();containerRect;setup(){this.containerRect=function(){const e=t.useState({x:0,y:0,width:0,height:0}),o=t.useComponent(),i=gn();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=mn(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 n=this.spreadsheetRect,r="BottomLeft"===this.props.positioning?new Cn(t,this.containerRect,i,n):new En(t,this.containerRect,i,n);e.style["max-height"]=r.getMaxHeight(s.height)+"px",e.style["max-width"]=r.getMaxWidth(s.width)+"px",s={width:e.getBoundingClientRect().width,height:e.getBoundingClientRect().height};let a=r.getCss(s,this.props.verticalOffset);for(const t of Object.keys(a))e.style[t]=a[t];const l=r.getCurrentPosition(s);this.currentPosition&&l!==this.currentPosition&&this.props.onPopoverMoved?.(),this.currentPosition=l}))}get popoverStyle(){return Li({"z-index":`${this.props.zIndex}`})}}vn.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 Sn{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),n=Math.min(i,e.width),r=this.shouldRenderAtBottom(e.height),a=this.shouldRenderAtRight(e.width);t=r?t:-t;return{top:this.getTopCoordinate(s,r)-this.spreadsheetOffset.y-t+"px",left:this.getLeftCoordinate(n,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 Cn extends Sn{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 En extends Sn{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}}Ni`
176
176
  .o-menu {
177
177
  background-color: white;
178
178
  padding: ${6}px 0px;
@@ -1207,7 +1207,7 @@
1207
1207
  height: 0px;
1208
1208
  }
1209
1209
  }
1210
- `;class Gf extends t.Component{static template="o-spreadsheet-FiguresContainer";static components={FigureComponent:mf};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 Li({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(),n=["bottomRight","topRight"].includes(e)?i:0,r=t-n,a=["bottomRight","bottomLeft"].includes(e)?s:0;return{x:n,y:a,width:r,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 Li({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:n,y:r}=kf(this.env.model.getters,e),a={...e,x:n,y:r};ff((t=>{const o=this.env.model.getters,n=function({x:e,y:t},{x:o,y:i},s,{x:n,y:r},{maxX:a,maxY:l},{scrollX:c,scrollY:h}){const d=n?0:-c,u=r?0:-h,g=e-o,p=zf(s.x+g,d,a-s.width-c),m=t-i,f=zf(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()),r=this.getOtherFigures(e.id),l=function(e,t,o){const i={...t},s=$f(e,i,["hCenter","right","left"],o,["hCenter","right","left"]),n=$f(e,i,["vCenter","bottom","top"],o,["vCenter","bottom","top"]),{y:r,x:a}=e.getMainViewportCoordinates(),{scrollY:l,scrollX:c}=e.getActiveSheetScrollInfo();if(n){i.y-=n.snapOffset;const e=t.y<r,o=i.y<r;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:n}}(o,Pf(o,n),r);this.dnd.draggedFigure=kf(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}=Pf(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:n,y:r}=kf(this.env.model.getters,e),a={...e,x:n,y:r},l=Yr.get(e.tag).keepRatio||!1,c=Yr.get(e.tag).minFigSize||80;ff((i=>{const n={x:i.clientX,y:i.clientY},r=function(e,t,o,{x:i,y:s},{x:n,y:r},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*(n-i),e.width-l),c=Math.min(o*(r-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-n),l-e.width),c=Math.max(o*(s-r),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,n,s,l,c,this.env.model.getters.getActiveSheetScrollInfo()),h=this.getOtherFigures(e.id),d=function(e,t,o,i,s){const n={...i},r=$f(e,n,[-1===t?"left":"right"],s,["right","left"]);r&&(1===t?n.width-=r.snapOffset:-1===t&&(n.x-=r.snapOffset,n.width+=r.snapOffset));const a=$f(e,n,[-1===o?"top":"bottom"],s,["bottom","top"]);return a&&(1===o?n.height-=a.snapOffset:-1===o&&(n.y-=a.snapOffset,n.height+=a.snapOffset)),n.x=Math.round(n.x),n.y=Math.round(n.y),n.height=Math.round(n.height),n.width=Math.round(n.width),{snappedFigure:n,verticalSnapLine:r,horizontalSnapLine:a}}(this.env.model.getters,t,o,r,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:n}=Pf(this.env.model.getters,this.dnd.draggedFigure);const r={x:s,y:n};t&&(r.width=this.dnd.draggedFigure.width),o&&(r.height=this.dnd.draggedFigure.height),this.env.model.dispatch("UPDATE_FIGURE",{sheetId:this.env.model.getters.getActiveSheetId(),id:e.id,...r}),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?"":Li({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(dt).map((e=>{const t=kf(this.env.model.getters,e),o=this.getFigureContainer(e);return mn(t,this.getContainerRect(o))})).filter(dt),o=function(...e){return bn(hi(...e.map(fn)))}(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)?Li({top:e.position-t.y+"px",left:"0px",width:"100%"}):Li({top:"0px",left:e.position-t.x+"px",height:"100%"}):""}}function qf(e,o,i){let s={col:void 0,row:void 0};const{Date:n}=window;let r=0,a=0,l=0;function c(){return{col:e.model.getters.getColIndex(r),row:e.model.getters.getRowIndex(a)}}const{pause:h,resume:d}=function(e,o){let i;const{setInterval:s,clearInterval:n}=window;return t.useEffect((()=>(i=s(e,o),()=>n(i))),(()=>[o])),{pause:()=>{n(i),i=void 0},resume:()=>{void 0===i&&(i=s(e,o))}}}((function(){const{col:e,row:t}=c(),o=n.now()-l;o>300&&(e!==s.col||t!==s.row)&&p(void 0,void 0);if(o>300){if(e<0||t<0)return;p(e,t)}}),200);function u(e){o.el===e.target&&(r=e.offsetX,a=e.offsetY,l=n.now())}function g(){const{col:e,row:t}=c();e===s.col&&t===s.row||p(void 0,void 0)}function p(e,t){e===s.col&&t===s.row||(s.col=e,s.row=t,i({col:e,row:t}))}return t.onMounted((()=>{const e=o.el;e.addEventListener("mousemove",u),e.addEventListener("mouseleave",h),e.addEventListener("mouseenter",d),e.addEventListener("mousedown",g)})),t.onWillUnmount((()=>{const e=o.el;e.removeEventListener("mousemove",u),e.removeEventListener("mouseleave",h),e.removeEventListener("mouseenter",d),e.removeEventListener("mousedown",g)})),s}Gf.props={onFigureDeleted:Function};class Zf extends t.Component{static template="o-spreadsheet-GridOverlay";static components={FiguresContainer:Gf};static defaultProps={onCellHovered:()=>{},onCellDoubleClicked:()=>{},onCellClicked:()=>{},onCellRightClicked:()=>{},onGridResized:()=>{},onFigureDeleted:()=>{}};gridOverlay;setup(){this.gridOverlay=t.useRef("gridOverlay"),qf(this.env,this.gridOverlay,this.props.onCellHovered);const e=new ResizeObserver((()=>{this.props.onGridResized({height:this.gridOverlayEl.clientHeight,width:this.gridOverlayEl.clientWidth})}));t.onMounted((()=>{e.observe(this.gridOverlayEl)})),t.onWillUnmount((()=>{e.disconnect()})),function(e,o,i){let s=null,n=null;function r(e){1===e.touches.length&&(s=e.touches[0].clientX,n=e.touches[0].clientY)}function a(){s=null,n=null}function l(e){if(1!==e.touches.length)return;i()&&(e.preventDefault(),e.stopPropagation());const t=e.touches[0].clientX,r=e.touches[0].clientY;o(s-t,n-r),s=t,n=r}t.onMounted((()=>{e.el.addEventListener("touchstart",r),e.el.addEventListener("touchend",a),e.el.addEventListener("touchmove",l)})),t.onWillUnmount((()=>{e.el.removeEventListener("touchstart",r),e.el.removeEventListener("touchend",a),e.el.removeEventListener("touchmove",l)}))}(this.gridOverlay,this.props.onGridMoved,(()=>{const{scrollY:e}=this.env.model.getters.getActiveSheetDOMScrollInfo();return e>0}))}get gridOverlayEl(){if(!this.gridOverlay.el)throw new Error("GridOverlay el is not defined.");return this.gridOverlay.el}onMouseDown(e){if(e.button>0)return;const[t,o]=this.getCartesianCoordinates(e);this.props.onCellClicked(t,o,{expandZone:e.shiftKey,addZone:un(e)})}onDoubleClick(e){const[t,o]=this.getCartesianCoordinates(e);this.props.onCellDoubleClicked(t,o)}onContextMenu(e){const[t,o]=this.getCartesianCoordinates(e);this.props.onCellRightClicked(t,o,{x:e.clientX,y:e.clientY})}getCartesianCoordinates(e){return[this.env.model.getters.getColIndex(e.offsetX),this.env.model.getters.getRowIndex(e.offsetY)]}}Zf.props={onCellHovered:{type:Function,optional:!0},onCellDoubleClicked:{type:Function,optional:!0},onCellClicked:{type:Function,optional:!0},onCellRightClicked:{type:Function,optional:!0},onGridResized:{type:Function,optional:!0},onFigureDeleted:{type:Function,optional:!0},onGridMoved:Function,gridOverlayDimensions:String};class jf extends t.Component{static template="o-spreadsheet-GridPopover";static components={Popover:vn};zIndex=ue.GridPopover;get cellPopover(){const e=this.env.model.getters.getCellPopover(this.props.hoveredCell);if(!e.isOpen)return{isOpen:!1};const t=e.anchorRect;return{...e,anchorRect:{...t,x:t.x+this.props.gridRect.x,y:t.y+this.props.gridRect.y}}}}jf.props={hoveredCell:Object,onClosePopover:Function,onMouseWheel:Function,gridRect:Object};class Yf extends t.Component{PADDING=0;MAX_SIZE_MARGIN=0;MIN_ELEMENT_SIZE=0;lastSelectedElementIndex=null;state=t.useState({resizerIsActive:!1,isResizing:!1,isMoving:!1,isSelecting:!1,waitingForMove:!1,activeElement:0,draggerLinePosition:0,draggerShadowPosition:0,draggerShadowThickness:0,delta:0,base:0,position:"before"});_computeHandleDisplay(e){const t=this._getEvOffset(e),o=this._getElementIndex(t);if(o<0)return;const i=this._getDimensionsInViewport(o);t-i.start<this.PADDING&&o!==this._getViewportOffset()?(this.state.resizerIsActive=!0,this.state.draggerLinePosition=i.start,this.state.activeElement=this._getPreviousVisibleElement(o)):i.end-t<this.PADDING?(this.state.resizerIsActive=!0,this.state.draggerLinePosition=i.end,this.state.activeElement=o):this.state.resizerIsActive=!1}_computeGrabDisplay(e){const t=this._getElementIndex(this._getEvOffset(e)),o=this._getActiveElements(),i=this._getSelectedZoneStart(),s=this._getSelectedZoneEnd();o.has(i)&&i<=t&&t<=s?this.state.waitingForMove=!0:this.state.waitingForMove=!1}onMouseMove(e){this.state.isResizing||this.state.isMoving||this.state.isSelecting||(this._computeHandleDisplay(e),this._computeGrabDisplay(e))}onMouseLeave(){this.state.resizerIsActive=this.state.isResizing,this.state.waitingForMove=!1}onDblClick(e){this._fitElementSize(this.state.activeElement),this.state.isResizing=!1,this._computeHandleDisplay(e),this._computeGrabDisplay(e)}onMouseDown(e){this.state.isResizing=!0,this.state.delta=0;const t=this._getClientPosition(e),o=this.state.draggerLinePosition,i=this._getElementSize(this.state.activeElement),s=o-i+this.MIN_ELEMENT_SIZE,n=this._getMaxSize();ff((e=>{this.state.delta=this._getClientPosition(e)-t,this.state.draggerLinePosition=o+this.state.delta,this.state.draggerLinePosition<s&&(this.state.draggerLinePosition=s,this.state.delta=this.MIN_ELEMENT_SIZE-i),this.state.draggerLinePosition>n&&(this.state.draggerLinePosition=n,this.state.delta=n-o)}),(e=>{this.state.isResizing=!1,0!==this.state.delta&&this._updateSize()}))}select(e){if(e.button>0)return;const t=this._getElementIndex(this._getEvOffset(e));t<0||(!0!==this.state.waitingForMove?("editing"===this.env.model.getters.getEditionMode()&&this.env.model.selection.getBackToDefault(),this.startSelection(e,t)):this.env.model.getters.isGridSelectionActive()?this.startMovement(e):this._selectElement(t,!1))}startMovement(e){this.state.waitingForMove=!1,this.state.isMoving=!0;const t=this._getDimensionsInViewport(this._getSelectedZoneStart()),o=this._getDimensionsInViewport(this._getSelectedZoneEnd()),i=t.start;this.state.draggerLinePosition=i,this.state.base=this._getSelectedZoneStart(),this.state.draggerShadowPosition=i,this.state.draggerShadowThickness=o.end-t.start;bf(this.env,((e,o)=>{let i="COL"===this._getType()?e:o;if(i>=0){const e=this._getDimensionsInViewport(i);i<=this._getSelectedZoneStart()?(this.state.draggerLinePosition=e.start,this.state.draggerShadowPosition=e.start,this.state.base=i,this.state.position="before"):this._getSelectedZoneEnd()<i?(this.state.draggerLinePosition=e.end,this.state.draggerShadowPosition=e.end-this.state.draggerShadowThickness,this.state.base=i,this.state.position="after"):(this.state.draggerLinePosition=t.start,this.state.draggerShadowPosition=t.start,this.state.base=this._getSelectedZoneStart())}}),(()=>{this.state.isMoving=!1,this.state.base!==this._getSelectedZoneStart()&&this._moveElements(),this._computeGrabDisplay(e)}))}startSelection(e,t){this.state.isSelecting=!0,e.shiftKey?this._increaseSelection(t):this._selectElement(t,un(e)),this.lastSelectedElementIndex=t;bf(this.env,((e,t)=>{let o="COL"===this._getType()?e:t;o!==this.lastSelectedElementIndex&&-1!==o&&(this._increaseSelection(o),this.lastSelectedElementIndex=o)}),(()=>{this.state.isSelecting=!1,this.lastSelectedElementIndex=null,this.env.model.dispatch(un(e)?"PREPARE_SELECTION_INPUT_EXPANSION":"STOP_SELECTION_INPUT"),this._computeGrabDisplay(e)}))}onMouseUp(e){this.lastSelectedElementIndex=null}onContextMenu(e){e.preventDefault();const t=this._getElementIndex(this._getEvOffset(e));if(t<0)return;this._getActiveElements().has(t)||this._selectElement(t,!1);const o=this._getType();this.props.onOpenContextMenu(o,e.clientX,e.clientY)}}Ni`
1210
+ `;class Gf extends t.Component{static template="o-spreadsheet-FiguresContainer";static components={FigureComponent:mf};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 Li({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(),n=["bottomRight","topRight"].includes(e)?i:0,r=t-n,a=["bottomRight","bottomLeft"].includes(e)?s:0;return{x:n,y:a,width:r,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 Li({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:n,y:r}=kf(this.env.model.getters,e),a={...e,x:n,y:r};ff((t=>{const o=this.env.model.getters,n=function({x:e,y:t},{x:o,y:i},s,{x:n,y:r},{maxX:a,maxY:l},{scrollX:c,scrollY:h}){const d=n?0:-c,u=r?0:-h,g=e-o,p=zf(s.x+g,d,a-s.width-c),m=t-i,f=zf(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()),r=this.getOtherFigures(e.id),l=function(e,t,o){const i={...t},s=$f(e,i,["hCenter","right","left"],o,["hCenter","right","left"]),n=$f(e,i,["vCenter","bottom","top"],o,["vCenter","bottom","top"]),{y:r,x:a}=e.getMainViewportCoordinates(),{scrollY:l,scrollX:c}=e.getActiveSheetScrollInfo();if(n){i.y-=n.snapOffset;const e=t.y<r,o=i.y<r;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:n}}(o,Pf(o,n),r);this.dnd.draggedFigure=kf(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}=Pf(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:n,y:r}=kf(this.env.model.getters,e),a={...e,x:n,y:r},l=Yr.get(e.tag).keepRatio||!1,c=Yr.get(e.tag).minFigSize||80;ff((i=>{const n={x:i.clientX,y:i.clientY},r=function(e,t,o,{x:i,y:s},{x:n,y:r},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*(n-i),e.width-l),c=Math.min(o*(r-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-n),l-e.width),c=Math.max(o*(s-r),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,n,s,l,c,this.env.model.getters.getActiveSheetScrollInfo()),h=this.getOtherFigures(e.id),d=function(e,t,o,i,s){const n={...i},r=$f(e,n,[-1===t?"left":"right"],s,["right","left"]);r&&(1===t?n.width-=r.snapOffset:-1===t&&(n.x-=r.snapOffset,n.width+=r.snapOffset));const a=$f(e,n,[-1===o?"top":"bottom"],s,["bottom","top"]);return a&&(1===o?n.height-=a.snapOffset:-1===o&&(n.y-=a.snapOffset,n.height+=a.snapOffset)),n.x=Math.round(n.x),n.y=Math.round(n.y),n.height=Math.round(n.height),n.width=Math.round(n.width),{snappedFigure:n,verticalSnapLine:r,horizontalSnapLine:a}}(this.env.model.getters,t,o,r,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:n}=Pf(this.env.model.getters,this.dnd.draggedFigure);const r={x:s,y:n};t&&(r.width=this.dnd.draggedFigure.width),o&&(r.height=this.dnd.draggedFigure.height),this.env.model.dispatch("UPDATE_FIGURE",{sheetId:this.env.model.getters.getActiveSheetId(),id:e.id,...r}),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?"":Li({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(dt).map((e=>{const t=kf(this.env.model.getters,e),o=this.getFigureContainer(e);return mn(t,this.getContainerRect(o))})).filter(dt),o=function(...e){return bn(hi(...e.map(fn)))}(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)?Li({top:e.position-t.y+"px",left:"0px",width:"100%"}):Li({top:"0px",left:e.position-t.x+"px",height:"100%"}):""}}function qf(e,o,i){let s={col:void 0,row:void 0};const{Date:n}=window;let r=0,a=0,l=0;function c(){return{col:e.model.getters.getColIndex(r),row:e.model.getters.getRowIndex(a)}}const{pause:h,resume:d}=function(e,o){let i;const{setInterval:s,clearInterval:n}=window;return t.useEffect((()=>(i=s(e,o),()=>n(i))),(()=>[o])),{pause:()=>{n(i),i=void 0},resume:()=>{void 0===i&&(i=s(e,o))}}}((function(){const{col:e,row:t}=c(),o=n.now()-l;o>300&&(e!==s.col||t!==s.row)&&p(void 0,void 0);if(o>300){if(e<0||t<0)return;p(e,t)}}),200);function u(e){o.el===e.target&&(r=e.offsetX,a=e.offsetY,l=n.now())}function g(){const{col:e,row:t}=c();e===s.col&&t===s.row||p(void 0,void 0)}function p(e,t){e===s.col&&t===s.row||(s.col=e,s.row=t,i({col:e,row:t}))}return t.onMounted((()=>{const e=o.el;e.addEventListener("mousemove",u),e.addEventListener("mouseleave",h),e.addEventListener("mouseenter",d),e.addEventListener("mousedown",g)})),t.onWillUnmount((()=>{const e=o.el;e.removeEventListener("mousemove",u),e.removeEventListener("mouseleave",h),e.removeEventListener("mouseenter",d),e.removeEventListener("mousedown",g)})),s}Gf.props={onFigureDeleted:Function};class Zf extends t.Component{static template="o-spreadsheet-GridOverlay";static components={FiguresContainer:Gf};static defaultProps={onCellHovered:()=>{},onCellDoubleClicked:()=>{},onCellClicked:()=>{},onCellRightClicked:()=>{},onGridResized:()=>{},onFigureDeleted:()=>{}};gridOverlay;setup(){this.gridOverlay=t.useRef("gridOverlay"),qf(this.env,this.gridOverlay,this.props.onCellHovered);const e=new ResizeObserver((()=>{this.props.onGridResized({height:this.gridOverlayEl.clientHeight,width:this.gridOverlayEl.clientWidth})}));t.onMounted((()=>{e.observe(this.gridOverlayEl)})),t.onWillUnmount((()=>{e.disconnect()})),function(e,o,i){let s=null,n=null;function r(e){1===e.touches.length&&(s=e.touches[0].clientX,n=e.touches[0].clientY)}function a(){s=null,n=null}function l(e){if(1!==e.touches.length)return;i()&&(e.preventDefault(),e.stopPropagation());const t=e.touches[0].clientX,r=e.touches[0].clientY;o(s-t,n-r),s=t,n=r}t.onMounted((()=>{e.el.addEventListener("touchstart",r),e.el.addEventListener("touchend",a),e.el.addEventListener("touchmove",l)})),t.onWillUnmount((()=>{e.el.removeEventListener("touchstart",r),e.el.removeEventListener("touchend",a),e.el.removeEventListener("touchmove",l)}))}(this.gridOverlay,this.props.onGridMoved,(()=>{const{scrollY:e}=this.env.model.getters.getActiveSheetDOMScrollInfo();return e>0}))}get gridOverlayEl(){if(!this.gridOverlay.el)throw new Error("GridOverlay el is not defined.");return this.gridOverlay.el}onMouseDown(e){if(e.button>0)return;const[t,o]=this.getCartesianCoordinates(e);this.props.onCellClicked(t,o,{expandZone:e.shiftKey,addZone:un(e)})}onDoubleClick(e){const[t,o]=this.getCartesianCoordinates(e);this.props.onCellDoubleClicked(t,o)}onContextMenu(e){const[t,o]=this.getCartesianCoordinates(e);this.props.onCellRightClicked(t,o,{x:e.clientX,y:e.clientY})}getCartesianCoordinates(e){return[this.env.model.getters.getColIndex(e.offsetX),this.env.model.getters.getRowIndex(e.offsetY)]}}Zf.props={onCellHovered:{type:Function,optional:!0},onCellDoubleClicked:{type:Function,optional:!0},onCellClicked:{type:Function,optional:!0},onCellRightClicked:{type:Function,optional:!0},onGridResized:{type:Function,optional:!0},onFigureDeleted:{type:Function,optional:!0},onGridMoved:Function,gridOverlayDimensions:String};class jf extends t.Component{static template="o-spreadsheet-GridPopover";static components={Popover:vn};zIndex=ue.GridPopover;get cellPopover(){const e=this.env.model.getters.getCellPopover(this.props.hoveredCell);if(!e.isOpen)return{isOpen:!1};const t=e.anchorRect;return{...e,anchorRect:{...t,x:t.x+this.props.gridRect.x,y:t.y+this.props.gridRect.y}}}}jf.props={hoveredCell:Object,onClosePopover:Function,onMouseWheel:Function,gridRect:Object};class Yf extends t.Component{PADDING=0;MAX_SIZE_MARGIN=0;MIN_ELEMENT_SIZE=0;lastSelectedElementIndex=null;state=t.useState({resizerIsActive:!1,isResizing:!1,isMoving:!1,isSelecting:!1,waitingForMove:!1,activeElement:0,draggerLinePosition:0,draggerShadowPosition:0,draggerShadowThickness:0,delta:0,base:0,position:"before"});_computeHandleDisplay(e){const t=this._getEvOffset(e),o=this._getElementIndex(t);if(o<0)return;const i=this._getDimensionsInViewport(o);t-i.start<this.PADDING&&o!==this._getViewportOffset()?(this.state.resizerIsActive=!0,this.state.draggerLinePosition=i.start,this.state.activeElement=this._getPreviousVisibleElement(o)):i.end-t<this.PADDING?(this.state.resizerIsActive=!0,this.state.draggerLinePosition=i.end,this.state.activeElement=o):this.state.resizerIsActive=!1}_computeGrabDisplay(e){const t=this._getElementIndex(this._getEvOffset(e)),o=this._getActiveElements(),i=this._getSelectedZoneStart(),s=this._getSelectedZoneEnd();o.has(i)&&i<=t&&t<=s?this.state.waitingForMove=!0:this.state.waitingForMove=!1}onMouseMove(e){this.state.isResizing||this.state.isMoving||this.state.isSelecting||(this._computeHandleDisplay(e),this._computeGrabDisplay(e))}onMouseLeave(){this.state.resizerIsActive=this.state.isResizing,this.state.waitingForMove=!1}onDblClick(e){this._fitElementSize(this.state.activeElement),this.state.isResizing=!1,this._computeHandleDisplay(e),this._computeGrabDisplay(e)}onMouseDown(e){this.state.isResizing=!0,this.state.delta=0;const t=this._getClientPosition(e),o=this.state.draggerLinePosition,i=this._getElementSize(this.state.activeElement),s=o-i+this.MIN_ELEMENT_SIZE,n=this._getMaxSize();ff((e=>{this.state.delta=this._getClientPosition(e)-t,this.state.draggerLinePosition=o+this.state.delta,this.state.draggerLinePosition<s&&(this.state.draggerLinePosition=s,this.state.delta=this.MIN_ELEMENT_SIZE-i),this.state.draggerLinePosition>n&&(this.state.draggerLinePosition=n,this.state.delta=n-o)}),(e=>{this.state.isResizing=!1,0!==this.state.delta&&this._updateSize()}))}select(e){if(e.button>0)return;const t=this._getElementIndex(this._getEvOffset(e));t<0||(!0!==this.state.waitingForMove?("editing"===this.env.model.getters.getEditionMode()&&this.env.model.selection.getBackToDefault(),this.startSelection(e,t)):this.env.model.getters.isGridSelectionActive()?this.startMovement(e):this._selectElement(t,!1))}startMovement(e){this.state.waitingForMove=!1,this.state.isMoving=!0;const t=this._getDimensionsInViewport(this._getSelectedZoneStart()),o=this._getDimensionsInViewport(this._getSelectedZoneEnd()),i=t.start;this.state.draggerLinePosition=i,this.state.base=this._getSelectedZoneStart(),this.state.draggerShadowPosition=i,this.state.draggerShadowThickness=o.end-t.start;bf(this.env,((e,o)=>{let i="COL"===this._getType()?e:o;if(i>=0){const e=this._getDimensionsInViewport(i);i<=this._getSelectedZoneStart()?(this.state.draggerLinePosition=e.start,this.state.draggerShadowPosition=e.start,this.state.base=i,this.state.position="before"):this._getSelectedZoneEnd()<i?(this.state.draggerLinePosition=e.end,this.state.draggerShadowPosition=e.end-this.state.draggerShadowThickness,this.state.base=i,this.state.position="after"):(this.state.draggerLinePosition=t.start,this.state.draggerShadowPosition=t.start,this.state.base=this._getSelectedZoneStart())}}),(()=>{this.state.isMoving=!1,this.state.base!==this._getSelectedZoneStart()&&this._moveElements(),this._computeGrabDisplay(e)}))}startSelection(e,t){this.state.isSelecting=!0,e.shiftKey?this._increaseSelection(t):this._selectElement(t,un(e)),this.lastSelectedElementIndex=t;bf(this.env,((e,t)=>{let o="COL"===this._getType()?e:t;o!==this.lastSelectedElementIndex&&-1!==o&&(this._increaseSelection(o),this.lastSelectedElementIndex=o)}),(()=>{this.state.isSelecting=!1,this.lastSelectedElementIndex=null,this.env.model.dispatch(un(e)?"PREPARE_SELECTION_INPUT_EXPANSION":"STOP_SELECTION_INPUT"),this._computeGrabDisplay(e)}))}onMouseUp(e){this.lastSelectedElementIndex=null}onContextMenu(e){e.preventDefault();const t=this._getElementIndex(this._getEvOffset(e));if(t<0)return;this._getActiveElements().has(t)||this._selectElement(t,!1);const o=this._getType();this.props.onOpenContextMenu(o,e.clientX,e.clientY)}}Ni`
1211
1211
  .o-col-resizer {
1212
1212
  position: absolute;
1213
1213
  top: 0;
@@ -2492,4 +2492,4 @@
2492
2492
  <tableParts count="${e.filterTables.length}">
2493
2493
  ${XS(a)}
2494
2494
  </tableParts>
2495
- `}var Gw;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(Gw||(Gw={}));function qw(e,t={}){const o=Be(t);return o.type=e,o}const Zw={},jw={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:F,HEADER_WIDTH:D,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:L,DEFAULT_CELL_HEIGHT:k,SCROLLBAR_WIDTH:P},Yw={autofillModifiersRegistry:Ws,autofillRulesRegistry:Gs,cellMenuRegistry:fp,colMenuRegistry:Nm,linkMenuRegistry:kn,functionRegistry:Hg,featurePluginRegistry:vE,statefulUIPluginRegistry:SE,coreViewsPluginRegistry:CE,corePluginRegistry:bE,rowMenuRegistry:Dm,sidePanelRegistry:gf,figureRegistry:Yr,chartSidePanelComponentRegistry:ef,chartComponentRegistry:Wr,chartRegistry:$r,topbarMenuRegistry:Lm,topbarComponentRegistry:pf,clickableCellRegistry:EE,otRegistry:km,inverseCommandRegistry:Jr,urlRegistry:Hi,cellPopoverRegistry:Vn,numberFormatMenuRegistry:_m,repeatLocalCommandTransformRegistry:oE,repeatCommandTransformRegistry:tE},Xw={arg:el,toBoolean:rs,toJsDate:as,toNumber:Qi,toString:os,toXC:Zt,toZone:ii,toCartesian:qt,numberToLetters:Bt,UuidGenerator:ti,formatValue:bo,computeTextWidth:qe,createEmptyWorkbookData:wC,createEmptySheet:EC,createEmptyExcelSheet:xC,getDefaultChartJsRuntime:br,chartFontColor:er,ChartColors:Jn,EvaluationError:c,CellErrorLevel:l,getFillingMode:Er,rgbaToHex:Pt,colorToRGBA:Ut,positionToZone:yi,isDefined:dt,lazy:mt,genericRepeat:iE},Kw={isMarkdownLink:it,parseMarkdownLink:rt,markdownLink:nt,openLink:Zi,urlRepresentation:qi},Qw={ChartPanel:tf,ChartFigure:qr,ChartJsComponent:Ai,Grid:cb,GridOverlay:Zf,ScorecardChart:Pi,LineConfigPanel:Km,LineBarPieDesignPanel:jm,BarConfigPanel:Hm,LineBarPieConfigPanel:Bm,GaugeChartConfigPanel:Ym,GaugeChartDesignPanel:Xm,ScorecardChartConfigPanel:Qm,ScorecardChartDesignPanel:Jm,FigureComponent:mf};e.AbstractChart=Bn,e.CorePlugin=IC,e.DispatchResult=Ns,e.EvaluationError=c,e.Model=class extends kC{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},o={},i=[],s=new ti,n=!0){super(),i=SC(e,i);const r=bC(e,n);this.state=new iw,this.uuidGenerator=s,this.config=this.setupConfig(o),this.session=this.setupSession(r.revisionId),this.coreGetters={},this.range=new NC(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getSelectionRangeString=this.range.getSelectionRangeString.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new ow(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of bE.getAll())this.setupCorePlugin(e,r);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(i);for(let e of SE.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of CE.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of vE.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),o.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave()}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o),this.coreHandlers.push(o),this.handlers.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new GC(JE({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:n("Anonymous").toString()},o=e.transportService||new WE;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:e.external||{},transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),lazyEvaluation:!("lazyEvaluation"in e)||e.lazyEvaluation}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,lazyEvaluation:this.config.lazyEvaluation,session:this.session}}checkDispatchAllowed(e){const t=Ms(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>0!==e))?new Ns(t.flat()):Ns.Success}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map((t=>t.allowDispatch(e)))}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(qw(e,t));dispatch=(e,t)=>{const o=qw(e,t);let i=this.status;if(this.getters.isReadonly()&&(s=o,!As.has(s.type)))return new Ns(68);var s;if(!this.session.canApplyOptimisticUpdate())return new Ns(65);switch(i){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:i,commands:s}=this.state.recordChanges((()=>{Ms(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(o,s,i),this.status=0,this.trigger("update");break;case 1:if(Ms(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(Ms(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Ns.Success};dispatchFromCorePlugin=(e,t)=>{const o=qw(e,t),i=this.status;this.status=2;const s=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(s,o),this.status=i,Ns.Success};dispatchToHandlers(e,t){for(const o of e)o.beforeHandle(t);for(const o of e)o.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=wC();for(let t of this.handlers)t instanceof IC&&t.export(e);return e.revisionId=this.session.getRevisionId()||ee,e=Be(e),e}updateMode(e){"normal"!==e&&this.dispatch("STOP_EDITION",{cancel:!0}),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...wC(),sheets:[xC(fC,"Sheet1")]};for(let t of this.handlers)t instanceof yC&&t.exportForExcel(e);return e=Be(e),$w(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=zi,e.Revision=$C,e.SPREADSHEET_DIMENSIONS=jw,e.Spreadsheet=$E,e.UIPlugin=_C,e.__info__=Zw,e.addFunction=function(e,t){Hg.add(e,t)},e.astToFormula=Zv,e.compile=rS,e.components=Qw,e.convertAstNodes=qv,e.coreTypes=Os,e.findCellInNewZone=wi,e.functionCache=nS,e.helpers=Xw,e.invalidateEvaluationCommands=Rs,e.links=Kw,e.load=bC,e.parse=Wv,e.readonlyAllowedCommands=As,e.registries=Yw,e.setDefaultSheetViewSize=function(e){ge=e},e.setTranslationMethod=function(e){o=e},e.tokenize=xv,Object.defineProperty(e,"__esModule",{value:!0}),Zw.version="16.3.38",Zw.date="2024-06-10T09:33:40.314Z",Zw.hash="2fcf01c"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2495
+ `}var Gw;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(Gw||(Gw={}));function qw(e,t={}){const o=Be(t);return o.type=e,o}const Zw={},jw={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:F,HEADER_WIDTH:D,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:L,DEFAULT_CELL_HEIGHT:k,SCROLLBAR_WIDTH:P},Yw={autofillModifiersRegistry:Ws,autofillRulesRegistry:Gs,cellMenuRegistry:fp,colMenuRegistry:Nm,linkMenuRegistry:kn,functionRegistry:Hg,featurePluginRegistry:vE,statefulUIPluginRegistry:SE,coreViewsPluginRegistry:CE,corePluginRegistry:bE,rowMenuRegistry:Dm,sidePanelRegistry:gf,figureRegistry:Yr,chartSidePanelComponentRegistry:ef,chartComponentRegistry:Wr,chartRegistry:$r,topbarMenuRegistry:Lm,topbarComponentRegistry:pf,clickableCellRegistry:EE,otRegistry:km,inverseCommandRegistry:Jr,urlRegistry:Hi,cellPopoverRegistry:Vn,numberFormatMenuRegistry:_m,repeatLocalCommandTransformRegistry:oE,repeatCommandTransformRegistry:tE},Xw={arg:el,toBoolean:rs,toJsDate:as,toNumber:Qi,toString:os,toXC:Zt,toZone:ii,toCartesian:qt,numberToLetters:Bt,UuidGenerator:ti,formatValue:bo,computeTextWidth:qe,createEmptyWorkbookData:wC,createEmptySheet:EC,createEmptyExcelSheet:xC,getDefaultChartJsRuntime:br,chartFontColor:er,ChartColors:Jn,EvaluationError:c,CellErrorLevel:l,getFillingMode:Er,rgbaToHex:Pt,colorToRGBA:Ut,positionToZone:yi,isDefined:dt,lazy:mt,genericRepeat:iE,deepEquals:vt},Kw={isMarkdownLink:it,parseMarkdownLink:rt,markdownLink:nt,openLink:Zi,urlRepresentation:qi},Qw={ChartPanel:tf,ChartFigure:qr,ChartJsComponent:Ai,Grid:cb,GridOverlay:Zf,ScorecardChart:Pi,LineConfigPanel:Km,LineBarPieDesignPanel:jm,BarConfigPanel:Hm,LineBarPieConfigPanel:Bm,GaugeChartConfigPanel:Ym,GaugeChartDesignPanel:Xm,ScorecardChartConfigPanel:Qm,ScorecardChartDesignPanel:Jm,FigureComponent:mf};e.AbstractChart=Bn,e.CorePlugin=IC,e.DispatchResult=Ns,e.EvaluationError=c,e.Model=class extends kC{corePlugins=[];featurePlugins=[];statefulUIPlugins=[];coreViewsPlugins=[];range;session;isReplayingCommand=!1;renderers=[];status=0;config;corePluginConfig;uiPluginConfig;state;selection;getters;coreGetters;uuidGenerator;handlers=[];uiHandlers=[];coreHandlers=[];constructor(e={},o={},i=[],s=new ti,n=!0){super(),i=SC(e,i);const r=bC(e,n);this.state=new iw,this.uuidGenerator=s,this.config=this.setupConfig(o),this.session=this.setupSession(r.revisionId),this.coreGetters={},this.range=new NC(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getSelectionRangeString=this.range.getSelectionRangeString.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new ow(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of bE.getAll())this.setupCorePlugin(e,r);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(i);for(let e of SE.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of CE.getAll()){const t=this.setupUiPlugin(e);this.coreViewsPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t),this.coreHandlers.push(t)}for(let e of vE.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),o.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave()}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let o of e.getters){if(!(o in t))throw new Error(`Invalid getter name: ${o} for plugin ${t.constructor}`);if(o in this.getters)throw new Error(`Getter "${o}" is already defined.`);this.getters[o]=t[o].bind(t)}const o=e.layers.map((e=>[t,e]));return this.renderers.push(...o),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const o=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in o))throw new Error(`Invalid getter name: ${t} for plugin ${o.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=o[t].bind(o)}o.import(t),this.corePlugins.push(o),this.coreHandlers.push(o),this.handlers.push(o)}onRemoteRevisionReceived({commands:e}){for(let t of e){const e=this.status;this.status=2,this.dispatchToHandlers(this.statefulUIPlugins,t),this.status=e}this.finalize()}setupSession(e){return new GC(JE({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:n("Anonymous").toString()},o=e.transportService||new WE;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:e.external||{},transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),lazyEvaluation:!("lazyEvaluation"in e)||e.lazyEvaluation}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,lazyEvaluation:this.config.lazyEvaluation,session:this.session}}checkDispatchAllowed(e){const t=Ms(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>0!==e))?new Ns(t.flat()):Ns.Success}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),t}checkDispatchAllowedLocalCommand(e){return this.uiHandlers.map((t=>t.allowDispatch(e)))}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(qw(e,t));dispatch=(e,t)=>{const o=qw(e,t);let i=this.status;if(this.getters.isReadonly()&&(s=o,!As.has(s.type)))return new Ns(68);var s;if(!this.session.canApplyOptimisticUpdate())return new Ns(65);switch(i){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:i,commands:s}=this.state.recordChanges((()=>{Ms(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(o,s,i),this.status=0,this.trigger("update");break;case 1:if(Ms(o)){const e=this.checkDispatchAllowed(o);if(!e.isSuccessful)return e;this.state.addCommand(o)}this.dispatchToHandlers(this.handlers,o);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(Ms(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Ns.Success};dispatchFromCorePlugin=(e,t)=>{const o=qw(e,t),i=this.status;this.status=2;const s=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(s,o),this.status=i,Ns.Success};dispatchToHandlers(e,t){for(const o of e)o.beforeHandle(t);for(const o of e)o.handle(t)}drawGrid(e){for(let[t,o]of this.renderers)e.ctx.save(),t.drawGrid(e,o),e.ctx.restore()}exportData(){let e=wC();for(let t of this.handlers)t instanceof IC&&t.export(e);return e.revisionId=this.session.getRevisionId()||ee,e=Be(e),e}updateMode(e){"normal"!==e&&this.dispatch("STOP_EDITION",{cancel:!0}),this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...wC(),sheets:[xC(fC,"Sheet1")]};for(let t of this.handlers)t instanceof yC&&t.exportForExcel(e);return e=Be(e),$w(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=zi,e.Revision=$C,e.SPREADSHEET_DIMENSIONS=jw,e.Spreadsheet=$E,e.UIPlugin=_C,e.__info__=Zw,e.addFunction=function(e,t){Hg.add(e,t)},e.astToFormula=Zv,e.compile=rS,e.components=Qw,e.convertAstNodes=qv,e.coreTypes=Os,e.findCellInNewZone=wi,e.functionCache=nS,e.helpers=Xw,e.invalidateEvaluationCommands=Rs,e.links=Kw,e.load=bC,e.parse=Wv,e.readonlyAllowedCommands=As,e.registries=Yw,e.setDefaultSheetViewSize=function(e){ge=e},e.setTranslationMethod=function(e){o=e},e.tokenize=xv,Object.defineProperty(e,"__esModule",{value:!0}),Zw.version="16.3.39",Zw.date="2024-06-14T09:57:15.035Z",Zw.hash="9701da6"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
@@ -3858,7 +3858,7 @@ https://fontawesome.com/license -->
3858
3858
  </t>
3859
3859
  </odoo>
3860
3860
  <!--
3861
- __info__.version = '16.3.38';
3862
- __info__.date = '2024-06-10T09:34:03.814Z';
3863
- __info__.hash = '2fcf01c';
3861
+ __info__.version = '16.3.39';
3862
+ __info__.date = '2024-06-14T09:57:39.164Z';
3863
+ __info__.hash = '9701da6';
3864
3864
  -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "16.3.38",
3
+ "version": "16.3.39",
4
4
  "description": "A spreadsheet component",
5
5
  "main": "dist/o-spreadsheet.cjs.js",
6
6
  "browser": "dist/o-spreadsheet.iife.js",