@odoo/o-spreadsheet 17.4.35 → 17.4.36

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.
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.4.35
6
- * @date 2025-05-13T17:49:44.553Z
7
- * @hash 534c5f4
5
+ * @version 17.4.36
6
+ * @date 2025-05-20T05:54:11.995Z
7
+ * @hash fabd931
8
8
  */
9
9
 
10
10
  'use strict';
@@ -37075,7 +37075,9 @@ function compareDimensionValues(dimension, a, b) {
37075
37075
  return dimension.order === "asc" ? -1 : 1;
37076
37076
  }
37077
37077
  if (dimension.type === "integer" || dimension.type === "date") {
37078
- return dimension.order === "asc" ? Number(a) - Number(b) : Number(b) - Number(a);
37078
+ return dimension.order === "asc"
37079
+ ? toNumber(a, DEFAULT_LOCALE) - toNumber(b, DEFAULT_LOCALE)
37080
+ : toNumber(b, DEFAULT_LOCALE) - toNumber(a, DEFAULT_LOCALE);
37079
37081
  }
37080
37082
  return dimension.order === "asc" ? a.localeCompare(b) : b.localeCompare(a);
37081
37083
  }
@@ -69563,6 +69565,6 @@ exports.tokenColors = tokenColors;
69563
69565
  exports.tokenize = tokenize;
69564
69566
 
69565
69567
 
69566
- __info__.version = "17.4.35";
69567
- __info__.date = "2025-05-13T17:49:44.553Z";
69568
- __info__.hash = "534c5f4";
69568
+ __info__.version = "17.4.36";
69569
+ __info__.date = "2025-05-20T05:54:11.995Z";
69570
+ __info__.hash = "fabd931";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.4.35
6
- * @date 2025-05-13T17:49:44.553Z
7
- * @hash 534c5f4
5
+ * @version 17.4.36
6
+ * @date 2025-05-20T05:54:11.995Z
7
+ * @hash fabd931
8
8
  */
9
9
 
10
10
  import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
@@ -37073,7 +37073,9 @@ function compareDimensionValues(dimension, a, b) {
37073
37073
  return dimension.order === "asc" ? -1 : 1;
37074
37074
  }
37075
37075
  if (dimension.type === "integer" || dimension.type === "date") {
37076
- return dimension.order === "asc" ? Number(a) - Number(b) : Number(b) - Number(a);
37076
+ return dimension.order === "asc"
37077
+ ? toNumber(a, DEFAULT_LOCALE) - toNumber(b, DEFAULT_LOCALE)
37078
+ : toNumber(b, DEFAULT_LOCALE) - toNumber(a, DEFAULT_LOCALE);
37077
37079
  }
37078
37080
  return dimension.order === "asc" ? a.localeCompare(b) : b.localeCompare(a);
37079
37081
  }
@@ -69518,6 +69520,6 @@ const constants = {
69518
69520
  export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
69519
69521
 
69520
69522
 
69521
- __info__.version = "17.4.35";
69522
- __info__.date = "2025-05-13T17:49:44.553Z";
69523
- __info__.hash = "534c5f4";
69523
+ __info__.version = "17.4.36";
69524
+ __info__.date = "2025-05-20T05:54:11.995Z";
69525
+ __info__.hash = "fabd931";
@@ -2,9 +2,9 @@
2
2
  /**
3
3
  * This file is generated by o-spreadsheet build tools. Do not edit it.
4
4
  * @see https://github.com/odoo/o-spreadsheet
5
- * @version 17.4.35
6
- * @date 2025-05-13T17:49:44.553Z
7
- * @hash 534c5f4
5
+ * @version 17.4.36
6
+ * @date 2025-05-20T05:54:11.995Z
7
+ * @hash fabd931
8
8
  */
9
9
 
10
10
  (function (exports, owl) {
@@ -37074,7 +37074,9 @@ stores.inject(MyMetaStore, storeInstance);
37074
37074
  return dimension.order === "asc" ? -1 : 1;
37075
37075
  }
37076
37076
  if (dimension.type === "integer" || dimension.type === "date") {
37077
- return dimension.order === "asc" ? Number(a) - Number(b) : Number(b) - Number(a);
37077
+ return dimension.order === "asc"
37078
+ ? toNumber(a, DEFAULT_LOCALE) - toNumber(b, DEFAULT_LOCALE)
37079
+ : toNumber(b, DEFAULT_LOCALE) - toNumber(a, DEFAULT_LOCALE);
37078
37080
  }
37079
37081
  return dimension.order === "asc" ? a.localeCompare(b) : b.localeCompare(a);
37080
37082
  }
@@ -69562,9 +69564,9 @@ stores.inject(MyMetaStore, storeInstance);
69562
69564
  exports.tokenize = tokenize;
69563
69565
 
69564
69566
 
69565
- __info__.version = "17.4.35";
69566
- __info__.date = "2025-05-13T17:49:44.553Z";
69567
- __info__.hash = "534c5f4";
69567
+ __info__.version = "17.4.36";
69568
+ __info__.date = "2025-05-20T05:54:11.995Z";
69569
+ __info__.hash = "fabd931";
69568
69570
 
69569
69571
 
69570
69572
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -1228,7 +1228,7 @@
1228
1228
  }
1229
1229
  }
1230
1230
  }
1231
- `;class eR extends t.Component{static template="o-spreadsheet-CogWheelMenu";static components={Popover:qv};static props={items:Array};buttonRef=t.useRef("button");popover=t.useState({isOpen:!1});setup(){t.useExternalListener(window,"click",(e=>{e.target!==this.buttonRef.el&&(this.popover.isOpen=!1)}))}onClick(e){e.onClick(),this.popover.isOpen=!1}get popoverProps(){const{x:e,y:t,width:o,height:s}=this.buttonRef.el.getBoundingClientRect();return{anchorRect:{x:e,y:t,width:o,height:s},positioning:"BottomLeft"}}togglePopover(){this.popover.isOpen=!this.popover.isOpen}}class tR extends t.Component{static template="o-spreadsheet-EditableName";static props={name:String,displayName:String,onChanged:Function};state;setup(){this.state=t.useState({isEditing:!1,name:""})}rename(){this.state.isEditing=!0,this.state.name=this.props.name}save(){this.props.onChanged(this.state.name.trim()),this.state.isEditing=!1}}class oR extends t.Component{static template="o-spreadsheet-PivotTitleSection";static components={CogWheelMenu:eR,Section:_E,EditableName:tR};static props={pivotId:String,flipAxis:Function};get cogWheelMenuItems(){return[{name:Co("Flip axes"),icon:"fa-exchange",onClick:this.props.flipAxis},{name:Co("Duplicate"),icon:"fa-copy",onClick:()=>this.duplicatePivot()},{name:Co("Delete"),icon:"fa-trash",onClick:()=>this.delete()}]}get name(){return this.env.model.getters.getPivotName(this.props.pivotId)}get displayName(){return this.env.model.getters.getPivotDisplayName(this.props.pivotId)}duplicatePivot(){const e=this.env.model.uuidGenerator.smallUuid(),t=this.env.model.uuidGenerator.smallUuid(),o=this.env.model.dispatch("DUPLICATE_PIVOT_IN_NEW_SHEET",{pivotId:this.props.pivotId,newPivotId:e,newSheetId:t}),s=o.isSuccessful?Co("Pivot duplicated."):Co("Pivot duplication failed"),i=o.isSuccessful?"success":"danger";this.env.notifyUser({text:s,sticky:!1,type:i}),o.isSuccessful&&this.env.openSidePanel("PivotSidePanel",{pivotId:e})}delete(){this.env.askConfirmation(Co("Are you sure you want to delete this pivot?"),(()=>{this.env.model.dispatch("REMOVE_PIVOT",{pivotId:this.props.pivotId})}))}onNameChanged(e){const t=this.env.model.getters.getPivotCoreDefinition(this.props.pivotId);this.env.model.dispatch("UPDATE_PIVOT",{pivotId:this.props.pivotId,pivot:{...t,name:e}})}}class sR{measures;columns;rows;constructor(e,t){this.measures=e.measures.map((e=>function(e,t){const o=t.name,s="__count"===o?{name:"__count",string:Co("Count"),type:"integer",aggregator:"sum"}:e[o],i=t.aggregator;return{nameWithAggregator:o+(i?`:${i}`:""),displayName:s?.string??o,name:o,aggregator:i,type:"__count"===o?"integer":s?.type??"integer",isValid:!!s}}(t,e))),this.columns=e.columns.map((e=>iR(t,e))),this.rows=e.rows.map((e=>iR(t,e)))}getDimension(e){const t=this.columns.find((t=>t.nameWithGranularity===e))||this.rows.find((t=>t.nameWithGranularity===e));if(!t)throw new Go(Co("Dimension %s does not exist",e));return t}getMeasure(e){const t=this.measures.find((t=>t.name===e));if(!t)throw new Go(Co("Field %s is not a measure",e));return t}}function iR(e,t){const o=e[t.name],s=o?.type??"integer",i=o&&aa(o)?t.granularity:void 0;return{displayName:o?.string??t.name,nameWithGranularity:t.name+(i?`:${i}`:""),name:t.name,granularity:i,type:s,order:t.order,isValid:!!o}}class nR extends sR{range;constructor(e,t,o){if(super(e,t),e.dataSet){const{sheetId:t,zone:s}=e.dataSet;this.range=o.getRangeFromZone(t,s)}}}class rR{columns;rows;measures;fieldsType;maxIndent;pivotCells={};constructor(e,t,o,s){this.columns=e.map((e=>{let t=1;return e.map((e=>(e={...e,offset:t},t+=e.width,e)))})),this.rows=t,this.measures=o,this.fieldsType=s,this.maxIndent=Math.max(...this.rows.map((e=>e.indent)))}getNumberOfDataColumns(){return this.columns.at(-1)?.length||0}getPivotCells(e=!0,t=!0){const o=JSON.stringify({includeTotal:e,includeColumnHeaders:t});if(!this.pivotCells[o]){const s=this.rows.length,i=this.getNumberOfDataColumns();let n=this.columns.length+s,r=1+i;e||1===s||(n-=1),e||i===this.measures.length||(r-=this.measures.length);const a=[],l=t?0:this.columns.length;for(let t=0;t<r;t++){a.push([]);for(let o=l;o<n;o++)(e||o!==n)&&a[t].push(this.getPivotCell(t,o,e))}this.pivotCells[o]=a}return this.pivotCells[o]}isTotalRow(e){return this.rows[e].indent!==this.maxIndent}getPivotCell(e,t,o=!0){const s=this.columns.length;if(e>0&&t===s-1){const o=this.getColHeaderDomain(e,t);if(!o)return aR;const s=o.at(-1)?.value?.toString()||"";return{type:"MEASURE_HEADER",domain:o.slice(0,-1),measure:s}}if(t<=s-1){const o=this.getColHeaderDomain(e,t);return o?{type:"HEADER",domain:o}:aR}if(0===e){const e=t-s;return{type:"HEADER",domain:this.getRowDomain(e)}}{const i=t-s;if(!o&&this.isTotalRow(i))return aR;return{type:"VALUE",domain:[...this.getRowDomain(i),...this.getColDomain(e)],measure:this.getColMeasure(e)}}}getColHeaderDomain(e,t){if(0===e)return;const o=[],s=this.columns[t].find((t=>t.offset===e));if(s){for(let e=0;e<s.fields.length;e++){const t=s.fields[e],{name:i,granularity:n}=ra(t),r=this.fieldsType[i]||"char";o.push({type:r,field:t,value:da({displayName:i,type:r,granularity:n},s.values[e])})}return o}}getColDomain(e){const t=this.getColHeaderDomain(e,this.columns.length-1);return t?t.slice(0,-1):[]}getColMeasure(e){const t=this.getColHeaderDomain(e,this.columns.length-1),o=t?.at(-1)?.value;if(null==o)throw new Error("Measure is missing");return o.toString()}getRowDomain(e){const t=[];for(let o=0;o<this.rows[e].fields.length;o++){const s=this.rows[e].fields[o],{name:i,granularity:n}=ra(s),r=this.fieldsType[i]||"char";t.push({type:r,field:s,value:da({displayName:i,type:r,granularity:n},this.rows[e].values[o])})}return t}export(){return{cols:this.columns,rows:this.rows,measures:this.measures,fieldsType:this.fieldsType}}}const aR={type:"EMPTY"};function lR(e,t){const o=hR(e,t.columns,0);dR(o,t.measures.length);const s=function(e,t){const o=t.columns.map((e=>e.nameWithGranularity)),s=o.length,i=t.measures.length,n=new Array(s).fill(0).map((()=>[]));function r(e,t,i){const a=n[t];for(const n of e){const e=i.concat([n.value]),l={fields:o.slice(0,t+1),values:e,width:n.width,offset:0};a.push(l),t<=s-1&&r(n.children,t+1,e)}}r(e,0,[]);const a=o.length>0,l=[];a&&n[n.length-1].forEach((e=>{t.measures.forEach((t=>{const o={fields:[...e.fields,"measure"],values:[...e.values,t.name],width:1,offset:0};l.push(o)}))}));t.measures.forEach((e=>{const t={fields:["measure"],values:[e.name],width:1,offset:0};l.push(t)})),n.push(l),1===n.length&&n.unshift([]);return n[n.length-2].push({fields:[],values:[],width:i,offset:0}),n}(o,t),i=cR(e,0,t.rows,[],[]);i.push({fields:[],values:[],indent:0});const n=t.measures.map((e=>e.name)),r={};for(const e of t.columns)r[e.name]=e.type;for(const e of t.rows)r[e.name]=e.type;return new rR(s,i,n,r)}function cR(e,t,o,s,i){if(t>=o.length)return[];const n=o[t],r=n.nameWithGranularity,a=uR(e,n),l=gR(a,n),c=[],h=s.concat(r);for(const e of l){const s=i.concat(e);c.push({fields:h,values:s,indent:t});const n=a[e];n&&c.push(...cR(n,t+1,o,h,s))}return c}function hR(e,t,o){if(o>=t.length)return[];const s=t[o],i=t[o].nameWithGranularity,n=uR(e,s);return gR(n,t[o]).map((e=>({value:e,field:i,children:hR(n[e]||[],t,o+1),width:0})))}function dR(e,t){for(const o in e){const s=e[o];0===s.children.length?s.width=t:(dR(s.children,t),s.width=s.children.reduce(((e,t)=>e+t.width),0))}}function uR(e,t){return Object.groupBy(e,function(e){const t=e.nameWithGranularity;return e=>`${e[t]?.value??null}`}(t))}function gR(e,t){return t.order?Object.keys(e).sort(((e,o)=>function(e,t,o){if("null"===t)return"asc"===e.order?1:-1;if("null"===o)return"asc"===e.order?-1:1;if("integer"===e.type||"date"===e.type)return"asc"===e.order?Number(t)-Number(o):Number(o)-Number(t);return"asc"===e.order?t.localeCompare(o):o.localeCompare(t)}(t,e,o))):Object.keys(e)}const pR=Symbol("NULL");function mR(e,t,o){const s=e.granularity||"month";if(!(s in fR))throw new Error(`Unknown date granularity: ${s}`);const i="number"==typeof t||"string"==typeof t?t:pR;if(!fR[s].set.has(t)){fR[s].set.add(t);let n=null;if("number"==typeof t||"string"==typeof t){const e=ps(t,o);switch(s){case"year":n=e.getFullYear();break;case"quarter_number":n=Math.floor(e.getMonth()/3)+1;break;case"month_number":n=e.getMonth()+1;break;case"month":case"day":n=Math.floor(os(t,o));break;case"iso_week_number":n=e.getIsoWeek();break;case"day_of_month":n=e.getDate()}}fR[s].values[i]=da(e,n)}return fR[s].values[i]}const fR={year:{set:new Set,values:{}},quarter_number:{set:new Set,values:{}},month_number:{set:new Set,values:{}},month:{set:new Set,values:{}},iso_week_number:{set:new Set,values:{}},day_of_month:{set:new Set,values:{}},day:{set:new Set,values:{}}};const bR=new n;bR.add("SPREADSHEET",{ui:class{type="SPREADSHEET";getters;_definition;coreDefinition;dataEntries=[];fields={};fieldKeys=[];table;invalidRangeError;needsReevaluation=!0;constructor(e,t){this.getters=t.getters,this.coreDefinition=t.definition}init(e={}){if(!this._definition||e.reload){if(this.invalidRangeError=void 0,this.coreDefinition.dataSet){const{zone:e,sheetId:t}=this.coreDefinition.dataSet,o=this.getters.getRangeFromZone(t,e);try{({fields:this.fields,fieldKeys:this.fieldKeys}=this.extractFieldsFromRange(o))}catch(e){this.fields={},this.fieldKeys=[],this.invalidRangeError=e}}else this.invalidRangeError=new Go(Co("The pivot cannot be created because the dataset is missing."));this._definition=new nR(this.coreDefinition,this.fields,this.getters),this.table=void 0,this.dataEntries=[];const e=this._definition.range;this.isValid()&&e&&(this.dataEntries=this.extractDataEntriesFromRange(e)),this.needsReevaluation=!1}}get isInvalidRange(){return!!this.invalidRangeError}get invalidRangeMessage(){return this.invalidRangeError?.message}get definition(){if(this._definition||this.init(),!this._definition)throw new Error("Pivot definition should be defined at this point.");return this._definition}isValid(){if(this.invalidRangeError||!this.definition)return!1;for(const e of this.definition.measures)if(!e.isValid)return!1;for(const e of this.definition.columns)if(!e.isValid)return!1;for(const e of this.definition.rows)if(!e.isValid)return!1;return!0}assertIsValid({throwOnError:e}){if(!this.isValid()){if(e)throw this.invalidRangeError?this.invalidRangeError:new Go(Co("At least one measure and/or dimension is not correct."));return{value:$o.GenericError,message:this.invalidRangeError?.message??Co("At least one measure and/or dimension is not correct.")}}}areDomainArgsFieldsValid(e){let t=e.filter(((e,t)=>t%2==0)).map(hs);return t.length&&"measure"===t.at(-1)&&(t=t.slice(0,-1)),ca(t,this.definition)}parseArgsToPivotDomain(e){const t=[];for(let o=0;o<e.length-1;o+=2){const s=hs(e[o]),i=this.getTypeOfDimension(s),n="measure"===s?hs(e[o+1]):da(this.getDimension(s),e[o+1]);t.push({field:s,value:n,type:i})}return t}markAsDirtyForEvaluation(){this.needsReevaluation=!0}getMeasure(e){return this.definition.getMeasure(e)}getPivotMeasureValue(e){return{value:this.getMeasure(e).displayName}}getPivotHeaderValueAndFormat(e){const t=e.at(-1);if(!t)return{value:Co("Total")};const o=this.getDimension(t.field),s=this.filterDataEntriesFromDomain(this.dataEntries,e),i=s[0]?.[o.nameWithGranularity];if("date"===o.type){return Wr(o.granularity||"month").toValueAndFormat(t.value,this.getters.getLocale())}return i?null===i.value?{value:Co("(Undefined)")}:{value:i.value,format:i.format}:{value:""}}getPivotCellValueAndFormat(e,t){const o=this.filterDataEntriesFromDomain(this.dataEntries,t);if(0===o.length)return{value:""};const s=o.map((t=>t[e])).filter((e=>e&&e.type!==xo.empty)).filter(Ue),i=this.getMeasure(e).aggregator,n=oa[i];if(!n)throw new Error(`Aggregator ${i} does not exist`);try{return{value:s.length?n.fn([s],this.getters.getLocale()):"",format:n.format(s[0])}}catch(e){return mv(e,i.toUpperCase())}}getPossibleFieldValues(e){const t=[];for(const o in uR(this.dataEntries,e))t.push({value:o,label:""});return t}getTableStructure(){if(!this.isValid())throw new Error("Pivot is not valid !");return this.table||(this.table=lR(this.dataEntries,this.definition)),this.table}getFields(){return this.fields}getTypeOfDimension(e){if("measure"===e)return"char";const{name:t}=ra(e),o=this.fields[t]?.type;if(!o)throw new Error(`Field ${t} does not exist`);return o}filterDataEntriesFromDomain(e,t){return t.reduce(((e,t)=>this.filterDataEntriesFromDomainNode(e,t)),e)}filterDataEntriesFromDomainNode(e,t){const{field:o,value:s}=t,{nameWithGranularity:i}=this.getDimension(o);return e.filter((e=>e[i]?.value===s))}getDimension(e){return this.definition.getDimension(e)}getTypeFromZone(e,t){const o=this.getters.getEvaluatedCellsInZone(e,t).filter((e=>e.type!==xo.empty));return 0===o.length?"integer":o.every((e=>e.type===xo.number&&e.format&&si(e.format)))?"date":o.every((e=>e.type===xo.boolean))?"boolean":o.some((e=>e.type===xo.text))?"char":"integer"}assertCellIsValidField(e,t,o){if(o.type===xo.error)throw new Go(Co("The pivot cannot be created because cell %s contains an error",Pt(e,t)));if(o.type===xo.empty||""===o.value)throw new Go(Co("The pivot cannot be created because cell %s is empty",Pt(e,t)));if("__count"===o.value)throw new Go(Co("The pivot cannot be created because cell %s contains a reserved value",Pt(e,t)))}extractFieldsFromRange(e){const t={},o=[],s=e.sheetId,i=e.zone.top;for(let n=e.zone.left;n<=e.zone.right;n++){const r=this.getters.getEvaluatedCell({sheetId:s,col:n,row:i});this.assertCellIsValidField(n,i,r);const a=r.value?.toString();if(a){const i=this.getTypeFromZone(s,{top:e.zone.top+1,left:n,bottom:e.zone.bottom,right:n}),r=this.findName(a,t);t[r]={name:r,type:i,string:r,aggregator:"integer"===i?"sum":"count"},o.push(r)}}return{fields:t,fieldKeys:o}}findName(e,t){let o=1;const s=e;for(;e in t;)e=`${s}${++o}`;return e}extractDataEntriesFromRange(e){const t=[];for(let o=e.zone.top+1;o<=e.zone.bottom;o++){const s={top:o,bottom:o,left:e.zone.left,right:e.zone.right},i=this.getters.getEvaluatedCellsInZone(e.sheetId,s),n={};for(const e in i){const t=i[e],o=this.fields[this.fieldKeys[e]];if(!o)throw new Error(`Field ${this.fieldKeys[e]} does not exist`);""===t.value?n[o.name]={value:null,type:xo.empty}:"char"===o.type?n[o.name]={...t,value:t.formattedValue||null}:n[o.name]=t}n.__count={value:1,type:xo.number},t.push(n)}const o=this.definition.columns.concat(this.definition.rows).filter((e=>"date"===e.type));if(o.length)for(const e of t)for(const t of o)e[t.nameWithGranularity]={value:mR(t,e[t.name]?.value||null,this.getters.getLocale()),type:e[t.name]?.type||xo.empty,format:e[t.name]?.format};return t}},definition:nR,externalData:!1,onIterationEndEvaluation:e=>e.markAsDirtyForEvaluation(),granularities:["year","quarter_number","month_number","month","iso_week_number","day_of_month","day"],isMeasureCandidate:e=>!["date","boolean"].includes(e.type),isGroupable:()=>!0});class vR extends Gl{pivotId;mutators=["reset","deferUpdates","applyUpdate","discardPendingUpdate","update"];updatesAreDeferred=!1;draft=null;notification=this.get(jl);alreadyNotified=!1;constructor(e,t){super(e),this.pivotId=t}handle(e){if("UPDATE_PIVOT"===e.type)e.pivotId===this.pivotId&&this.getters.getPivot(this.pivotId).init()}get fields(){return this.pivot.getFields()}get pivot(){return this.getters.getPivot(this.pivotId)}get definition(){const e=bR.get(this.pivot.type).definition;return this.draft?new e(this.draft,this.fields,this.getters):this.pivot.definition}get isDirty(){return!!this.draft}get unusedMeasureFields(){const e=[{name:"__count",string:Co("Count"),type:"integer",aggregator:"sum"}],t=this.fields;for(const o in t){const s=t[o];s&&(bR.get(this.pivot.type).isMeasureCandidate(s)&&e.push(s))}const{rows:o,columns:s,measures:i}=this.definition,n=i.concat(o).concat(s).map((e=>e.name));return e.filter((e=>!n.includes(e.name))).sort(((e,t)=>e.string.localeCompare(t.string)))}get unusedGroupableFields(){const e=[],t=this.fields;for(const o in t){const s=t[o];s&&(bR.get(this.pivot.type).isGroupable(s)&&e.push(s))}const{columns:o,rows:s,measures:i}=this.definition,n=i.concat(s).concat(o).map((e=>e.name)),r=this.unusedDateTimeGranularities;return e.filter((e=>aa(e)?!n.includes(e.name)||r[e.name].size>0:!n.includes(e.name))).sort(((e,t)=>e.string.localeCompare(t.string)))}get allGranularities(){return bR.get(this.pivot.type).granularities}get unusedDateTimeGranularities(){return this.getUnusedDateTimeGranularities(this.fields,this.draft??this.getters.getPivotCoreDefinition(this.pivotId))}reset(e){this.pivotId=e,this.updatesAreDeferred=!0,this.draft=null}deferUpdates(e){this.updatesAreDeferred=e,!1===e&&this.draft&&this.applyUpdate()}applyUpdate(){if(this.draft&&(this.model.dispatch("UPDATE_PIVOT",{pivotId:this.pivotId,pivot:this.draft}),this.draft=null,!this.alreadyNotified&&!this.isDynamicPivotInViewport())){const e=`=PIVOT(${this.getters.getPivotFormulaId(this.pivotId)})`;this.alreadyNotified=!0,this.notification.notifyUser({type:"info",text:Co("Pivot updates only work with dynamic pivot tables. Use %s or re-insert the static pivot from the Data menu.",e),sticky:!1})}}discardPendingUpdate(){this.draft=null}update(e){const t=this.getters.getPivotCoreDefinition(this.pivotId),o={...t,...this.draft,...e},s={...o,columns:o.columns.map((e=>({name:e.name,order:e.order,granularity:e.granularity}))),rows:o.rows.map((e=>({name:e.name,order:e.order,granularity:e.granularity}))),measures:o.measures.map((e=>({name:e.name,aggregator:e.aggregator})))};if(!this.draft&&je(t,s))return;const i=this.addDefaultDateTimeGranularity(this.fields,s);this.draft=i,this.updatesAreDeferred||this.applyUpdate()}isDynamicPivotInViewport(){const e=this.getters.getActiveSheetId();for(const t of this.getters.getSheetViewVisibleCols())for(const o of this.getters.getSheetViewVisibleRows()){if(this.getters.isSpillPivotFormula({sheetId:e,col:t,row:o}))return!0}return!1}addDefaultDateTimeGranularity(e,t){const{columns:o,rows:s}=t,i=Se(o),n=Se(s),r=this.getUnusedDateTimeGranularities(e,t);for(const t of i.concat(n)){const o=e[t.name]?.type;if(("date"===o||"datetime"===o)&&!t.granularity){const e=r[t.name]?.values().next().value||"year";r[t.name]?.delete(e),t.granularity=e}}return{...t,columns:i,rows:n}}getUnusedDateTimeGranularities(e,t){const{columns:o,rows:s}=t,i=o.concat(s).filter((t=>{const o=e[t.name]?.type;return"date"===o||"datetime"===o})),n=this.allGranularities,r={};for(const e of i)r[e.name]=new Set(n);for(const e of i)r[e.name].delete(e.granularity||"month");return r}}class SR extends t.Component{static template="o-spreadsheet-PivotSpreadsheetSidePanel";static props={pivotId:String,onCloseSidePanel:Function};static components={PivotLayoutConfigurator:JI,Section:_E,SelectionInput:ME,Checkbox:OE,PivotDeferUpdate:jI,PivotTitleSection:oR};store;state;pivotSidePanelRef=t.useRef("pivotSidePanel");setup(){this.store=Vl(vR,this.props.pivotId),this.state=t.useState({range:void 0,rangeHasChanged:!1})}get shouldDisplayInvalidRangeError(){return(!this.store.isDirty||!this.state.rangeHasChanged)&&this.pivot.isInvalidRange}get ranges(){return this.state.range?[this.state.range]:this.definition.range?[this.env.model.getters.getRangeString(this.definition.range,"forceSheetReference")]:[]}get pivot(){return this.store.pivot}get definition(){return this.store.definition}getScrollableContainerEl(){return this.pivotSidePanelRef.el}onSelectionChanged(e){this.state.rangeHasChanged=!0,this.state.range=e[0]}onSelectionConfirmed(){if(this.state.range){const e=this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(),this.state.range);if(e.invalidSheetName||e.invalidXc)return;const t={sheetId:e.sheetId,zone:e.zone};this.store.update({dataSet:t}),this.store.applyUpdate()}}flipAxis(){const{rows:e,columns:t}=this.definition;this.onDimensionsUpdated({rows:t,columns:e})}onDimensionsUpdated(e){this.store.update(e)}}const yR=new n;yR.add("SPREADSHEET",{editor:SR});class CR extends t.Component{static template="o-spreadsheet-PivotSidePanel";static props={pivotId:String,onCloseSidePanel:Function};static components={PivotLayoutConfigurator:JI,Section:_E};get sidePanelEditor(){const e=this.env.model.getters.getPivotCoreDefinition(this.props.pivotId);if(!e)throw new Error("pivotId does not correspond to a pivot.");return yR.get(e.type).editor}}wv`
1231
+ `;class eR extends t.Component{static template="o-spreadsheet-CogWheelMenu";static components={Popover:qv};static props={items:Array};buttonRef=t.useRef("button");popover=t.useState({isOpen:!1});setup(){t.useExternalListener(window,"click",(e=>{e.target!==this.buttonRef.el&&(this.popover.isOpen=!1)}))}onClick(e){e.onClick(),this.popover.isOpen=!1}get popoverProps(){const{x:e,y:t,width:o,height:s}=this.buttonRef.el.getBoundingClientRect();return{anchorRect:{x:e,y:t,width:o,height:s},positioning:"BottomLeft"}}togglePopover(){this.popover.isOpen=!this.popover.isOpen}}class tR extends t.Component{static template="o-spreadsheet-EditableName";static props={name:String,displayName:String,onChanged:Function};state;setup(){this.state=t.useState({isEditing:!1,name:""})}rename(){this.state.isEditing=!0,this.state.name=this.props.name}save(){this.props.onChanged(this.state.name.trim()),this.state.isEditing=!1}}class oR extends t.Component{static template="o-spreadsheet-PivotTitleSection";static components={CogWheelMenu:eR,Section:_E,EditableName:tR};static props={pivotId:String,flipAxis:Function};get cogWheelMenuItems(){return[{name:Co("Flip axes"),icon:"fa-exchange",onClick:this.props.flipAxis},{name:Co("Duplicate"),icon:"fa-copy",onClick:()=>this.duplicatePivot()},{name:Co("Delete"),icon:"fa-trash",onClick:()=>this.delete()}]}get name(){return this.env.model.getters.getPivotName(this.props.pivotId)}get displayName(){return this.env.model.getters.getPivotDisplayName(this.props.pivotId)}duplicatePivot(){const e=this.env.model.uuidGenerator.smallUuid(),t=this.env.model.uuidGenerator.smallUuid(),o=this.env.model.dispatch("DUPLICATE_PIVOT_IN_NEW_SHEET",{pivotId:this.props.pivotId,newPivotId:e,newSheetId:t}),s=o.isSuccessful?Co("Pivot duplicated."):Co("Pivot duplication failed"),i=o.isSuccessful?"success":"danger";this.env.notifyUser({text:s,sticky:!1,type:i}),o.isSuccessful&&this.env.openSidePanel("PivotSidePanel",{pivotId:e})}delete(){this.env.askConfirmation(Co("Are you sure you want to delete this pivot?"),(()=>{this.env.model.dispatch("REMOVE_PIVOT",{pivotId:this.props.pivotId})}))}onNameChanged(e){const t=this.env.model.getters.getPivotCoreDefinition(this.props.pivotId);this.env.model.dispatch("UPDATE_PIVOT",{pivotId:this.props.pivotId,pivot:{...t,name:e}})}}class sR{measures;columns;rows;constructor(e,t){this.measures=e.measures.map((e=>function(e,t){const o=t.name,s="__count"===o?{name:"__count",string:Co("Count"),type:"integer",aggregator:"sum"}:e[o],i=t.aggregator;return{nameWithAggregator:o+(i?`:${i}`:""),displayName:s?.string??o,name:o,aggregator:i,type:"__count"===o?"integer":s?.type??"integer",isValid:!!s}}(t,e))),this.columns=e.columns.map((e=>iR(t,e))),this.rows=e.rows.map((e=>iR(t,e)))}getDimension(e){const t=this.columns.find((t=>t.nameWithGranularity===e))||this.rows.find((t=>t.nameWithGranularity===e));if(!t)throw new Go(Co("Dimension %s does not exist",e));return t}getMeasure(e){const t=this.measures.find((t=>t.name===e));if(!t)throw new Go(Co("Field %s is not a measure",e));return t}}function iR(e,t){const o=e[t.name],s=o?.type??"integer",i=o&&aa(o)?t.granularity:void 0;return{displayName:o?.string??t.name,nameWithGranularity:t.name+(i?`:${i}`:""),name:t.name,granularity:i,type:s,order:t.order,isValid:!!o}}class nR extends sR{range;constructor(e,t,o){if(super(e,t),e.dataSet){const{sheetId:t,zone:s}=e.dataSet;this.range=o.getRangeFromZone(t,s)}}}class rR{columns;rows;measures;fieldsType;maxIndent;pivotCells={};constructor(e,t,o,s){this.columns=e.map((e=>{let t=1;return e.map((e=>(e={...e,offset:t},t+=e.width,e)))})),this.rows=t,this.measures=o,this.fieldsType=s,this.maxIndent=Math.max(...this.rows.map((e=>e.indent)))}getNumberOfDataColumns(){return this.columns.at(-1)?.length||0}getPivotCells(e=!0,t=!0){const o=JSON.stringify({includeTotal:e,includeColumnHeaders:t});if(!this.pivotCells[o]){const s=this.rows.length,i=this.getNumberOfDataColumns();let n=this.columns.length+s,r=1+i;e||1===s||(n-=1),e||i===this.measures.length||(r-=this.measures.length);const a=[],l=t?0:this.columns.length;for(let t=0;t<r;t++){a.push([]);for(let o=l;o<n;o++)(e||o!==n)&&a[t].push(this.getPivotCell(t,o,e))}this.pivotCells[o]=a}return this.pivotCells[o]}isTotalRow(e){return this.rows[e].indent!==this.maxIndent}getPivotCell(e,t,o=!0){const s=this.columns.length;if(e>0&&t===s-1){const o=this.getColHeaderDomain(e,t);if(!o)return aR;const s=o.at(-1)?.value?.toString()||"";return{type:"MEASURE_HEADER",domain:o.slice(0,-1),measure:s}}if(t<=s-1){const o=this.getColHeaderDomain(e,t);return o?{type:"HEADER",domain:o}:aR}if(0===e){const e=t-s;return{type:"HEADER",domain:this.getRowDomain(e)}}{const i=t-s;if(!o&&this.isTotalRow(i))return aR;return{type:"VALUE",domain:[...this.getRowDomain(i),...this.getColDomain(e)],measure:this.getColMeasure(e)}}}getColHeaderDomain(e,t){if(0===e)return;const o=[],s=this.columns[t].find((t=>t.offset===e));if(s){for(let e=0;e<s.fields.length;e++){const t=s.fields[e],{name:i,granularity:n}=ra(t),r=this.fieldsType[i]||"char";o.push({type:r,field:t,value:da({displayName:i,type:r,granularity:n},s.values[e])})}return o}}getColDomain(e){const t=this.getColHeaderDomain(e,this.columns.length-1);return t?t.slice(0,-1):[]}getColMeasure(e){const t=this.getColHeaderDomain(e,this.columns.length-1),o=t?.at(-1)?.value;if(null==o)throw new Error("Measure is missing");return o.toString()}getRowDomain(e){const t=[];for(let o=0;o<this.rows[e].fields.length;o++){const s=this.rows[e].fields[o],{name:i,granularity:n}=ra(s),r=this.fieldsType[i]||"char";t.push({type:r,field:s,value:da({displayName:i,type:r,granularity:n},this.rows[e].values[o])})}return t}export(){return{cols:this.columns,rows:this.rows,measures:this.measures,fieldsType:this.fieldsType}}}const aR={type:"EMPTY"};function lR(e,t){const o=hR(e,t.columns,0);dR(o,t.measures.length);const s=function(e,t){const o=t.columns.map((e=>e.nameWithGranularity)),s=o.length,i=t.measures.length,n=new Array(s).fill(0).map((()=>[]));function r(e,t,i){const a=n[t];for(const n of e){const e=i.concat([n.value]),l={fields:o.slice(0,t+1),values:e,width:n.width,offset:0};a.push(l),t<=s-1&&r(n.children,t+1,e)}}r(e,0,[]);const a=o.length>0,l=[];a&&n[n.length-1].forEach((e=>{t.measures.forEach((t=>{const o={fields:[...e.fields,"measure"],values:[...e.values,t.name],width:1,offset:0};l.push(o)}))}));t.measures.forEach((e=>{const t={fields:["measure"],values:[e.name],width:1,offset:0};l.push(t)})),n.push(l),1===n.length&&n.unshift([]);return n[n.length-2].push({fields:[],values:[],width:i,offset:0}),n}(o,t),i=cR(e,0,t.rows,[],[]);i.push({fields:[],values:[],indent:0});const n=t.measures.map((e=>e.name)),r={};for(const e of t.columns)r[e.name]=e.type;for(const e of t.rows)r[e.name]=e.type;return new rR(s,i,n,r)}function cR(e,t,o,s,i){if(t>=o.length)return[];const n=o[t],r=n.nameWithGranularity,a=uR(e,n),l=gR(a,n),c=[],h=s.concat(r);for(const e of l){const s=i.concat(e);c.push({fields:h,values:s,indent:t});const n=a[e];n&&c.push(...cR(n,t+1,o,h,s))}return c}function hR(e,t,o){if(o>=t.length)return[];const s=t[o],i=t[o].nameWithGranularity,n=uR(e,s);return gR(n,t[o]).map((e=>({value:e,field:i,children:hR(n[e]||[],t,o+1),width:0})))}function dR(e,t){for(const o in e){const s=e[o];0===s.children.length?s.width=t:(dR(s.children,t),s.width=s.children.reduce(((e,t)=>e+t.width),0))}}function uR(e,t){return Object.groupBy(e,function(e){const t=e.nameWithGranularity;return e=>`${e[t]?.value??null}`}(t))}function gR(e,t){return t.order?Object.keys(e).sort(((e,o)=>function(e,t,o){if("null"===t)return"asc"===e.order?1:-1;if("null"===o)return"asc"===e.order?-1:1;if("integer"===e.type||"date"===e.type)return"asc"===e.order?os(t,ko)-os(o,ko):os(o,ko)-os(t,ko);return"asc"===e.order?t.localeCompare(o):o.localeCompare(t)}(t,e,o))):Object.keys(e)}const pR=Symbol("NULL");function mR(e,t,o){const s=e.granularity||"month";if(!(s in fR))throw new Error(`Unknown date granularity: ${s}`);const i="number"==typeof t||"string"==typeof t?t:pR;if(!fR[s].set.has(t)){fR[s].set.add(t);let n=null;if("number"==typeof t||"string"==typeof t){const e=ps(t,o);switch(s){case"year":n=e.getFullYear();break;case"quarter_number":n=Math.floor(e.getMonth()/3)+1;break;case"month_number":n=e.getMonth()+1;break;case"month":case"day":n=Math.floor(os(t,o));break;case"iso_week_number":n=e.getIsoWeek();break;case"day_of_month":n=e.getDate()}}fR[s].values[i]=da(e,n)}return fR[s].values[i]}const fR={year:{set:new Set,values:{}},quarter_number:{set:new Set,values:{}},month_number:{set:new Set,values:{}},month:{set:new Set,values:{}},iso_week_number:{set:new Set,values:{}},day_of_month:{set:new Set,values:{}},day:{set:new Set,values:{}}};const bR=new n;bR.add("SPREADSHEET",{ui:class{type="SPREADSHEET";getters;_definition;coreDefinition;dataEntries=[];fields={};fieldKeys=[];table;invalidRangeError;needsReevaluation=!0;constructor(e,t){this.getters=t.getters,this.coreDefinition=t.definition}init(e={}){if(!this._definition||e.reload){if(this.invalidRangeError=void 0,this.coreDefinition.dataSet){const{zone:e,sheetId:t}=this.coreDefinition.dataSet,o=this.getters.getRangeFromZone(t,e);try{({fields:this.fields,fieldKeys:this.fieldKeys}=this.extractFieldsFromRange(o))}catch(e){this.fields={},this.fieldKeys=[],this.invalidRangeError=e}}else this.invalidRangeError=new Go(Co("The pivot cannot be created because the dataset is missing."));this._definition=new nR(this.coreDefinition,this.fields,this.getters),this.table=void 0,this.dataEntries=[];const e=this._definition.range;this.isValid()&&e&&(this.dataEntries=this.extractDataEntriesFromRange(e)),this.needsReevaluation=!1}}get isInvalidRange(){return!!this.invalidRangeError}get invalidRangeMessage(){return this.invalidRangeError?.message}get definition(){if(this._definition||this.init(),!this._definition)throw new Error("Pivot definition should be defined at this point.");return this._definition}isValid(){if(this.invalidRangeError||!this.definition)return!1;for(const e of this.definition.measures)if(!e.isValid)return!1;for(const e of this.definition.columns)if(!e.isValid)return!1;for(const e of this.definition.rows)if(!e.isValid)return!1;return!0}assertIsValid({throwOnError:e}){if(!this.isValid()){if(e)throw this.invalidRangeError?this.invalidRangeError:new Go(Co("At least one measure and/or dimension is not correct."));return{value:$o.GenericError,message:this.invalidRangeError?.message??Co("At least one measure and/or dimension is not correct.")}}}areDomainArgsFieldsValid(e){let t=e.filter(((e,t)=>t%2==0)).map(hs);return t.length&&"measure"===t.at(-1)&&(t=t.slice(0,-1)),ca(t,this.definition)}parseArgsToPivotDomain(e){const t=[];for(let o=0;o<e.length-1;o+=2){const s=hs(e[o]),i=this.getTypeOfDimension(s),n="measure"===s?hs(e[o+1]):da(this.getDimension(s),e[o+1]);t.push({field:s,value:n,type:i})}return t}markAsDirtyForEvaluation(){this.needsReevaluation=!0}getMeasure(e){return this.definition.getMeasure(e)}getPivotMeasureValue(e){return{value:this.getMeasure(e).displayName}}getPivotHeaderValueAndFormat(e){const t=e.at(-1);if(!t)return{value:Co("Total")};const o=this.getDimension(t.field),s=this.filterDataEntriesFromDomain(this.dataEntries,e),i=s[0]?.[o.nameWithGranularity];if("date"===o.type){return Wr(o.granularity||"month").toValueAndFormat(t.value,this.getters.getLocale())}return i?null===i.value?{value:Co("(Undefined)")}:{value:i.value,format:i.format}:{value:""}}getPivotCellValueAndFormat(e,t){const o=this.filterDataEntriesFromDomain(this.dataEntries,t);if(0===o.length)return{value:""};const s=o.map((t=>t[e])).filter((e=>e&&e.type!==xo.empty)).filter(Ue),i=this.getMeasure(e).aggregator,n=oa[i];if(!n)throw new Error(`Aggregator ${i} does not exist`);try{return{value:s.length?n.fn([s],this.getters.getLocale()):"",format:n.format(s[0])}}catch(e){return mv(e,i.toUpperCase())}}getPossibleFieldValues(e){const t=[];for(const o in uR(this.dataEntries,e))t.push({value:o,label:""});return t}getTableStructure(){if(!this.isValid())throw new Error("Pivot is not valid !");return this.table||(this.table=lR(this.dataEntries,this.definition)),this.table}getFields(){return this.fields}getTypeOfDimension(e){if("measure"===e)return"char";const{name:t}=ra(e),o=this.fields[t]?.type;if(!o)throw new Error(`Field ${t} does not exist`);return o}filterDataEntriesFromDomain(e,t){return t.reduce(((e,t)=>this.filterDataEntriesFromDomainNode(e,t)),e)}filterDataEntriesFromDomainNode(e,t){const{field:o,value:s}=t,{nameWithGranularity:i}=this.getDimension(o);return e.filter((e=>e[i]?.value===s))}getDimension(e){return this.definition.getDimension(e)}getTypeFromZone(e,t){const o=this.getters.getEvaluatedCellsInZone(e,t).filter((e=>e.type!==xo.empty));return 0===o.length?"integer":o.every((e=>e.type===xo.number&&e.format&&si(e.format)))?"date":o.every((e=>e.type===xo.boolean))?"boolean":o.some((e=>e.type===xo.text))?"char":"integer"}assertCellIsValidField(e,t,o){if(o.type===xo.error)throw new Go(Co("The pivot cannot be created because cell %s contains an error",Pt(e,t)));if(o.type===xo.empty||""===o.value)throw new Go(Co("The pivot cannot be created because cell %s is empty",Pt(e,t)));if("__count"===o.value)throw new Go(Co("The pivot cannot be created because cell %s contains a reserved value",Pt(e,t)))}extractFieldsFromRange(e){const t={},o=[],s=e.sheetId,i=e.zone.top;for(let n=e.zone.left;n<=e.zone.right;n++){const r=this.getters.getEvaluatedCell({sheetId:s,col:n,row:i});this.assertCellIsValidField(n,i,r);const a=r.value?.toString();if(a){const i=this.getTypeFromZone(s,{top:e.zone.top+1,left:n,bottom:e.zone.bottom,right:n}),r=this.findName(a,t);t[r]={name:r,type:i,string:r,aggregator:"integer"===i?"sum":"count"},o.push(r)}}return{fields:t,fieldKeys:o}}findName(e,t){let o=1;const s=e;for(;e in t;)e=`${s}${++o}`;return e}extractDataEntriesFromRange(e){const t=[];for(let o=e.zone.top+1;o<=e.zone.bottom;o++){const s={top:o,bottom:o,left:e.zone.left,right:e.zone.right},i=this.getters.getEvaluatedCellsInZone(e.sheetId,s),n={};for(const e in i){const t=i[e],o=this.fields[this.fieldKeys[e]];if(!o)throw new Error(`Field ${this.fieldKeys[e]} does not exist`);""===t.value?n[o.name]={value:null,type:xo.empty}:"char"===o.type?n[o.name]={...t,value:t.formattedValue||null}:n[o.name]=t}n.__count={value:1,type:xo.number},t.push(n)}const o=this.definition.columns.concat(this.definition.rows).filter((e=>"date"===e.type));if(o.length)for(const e of t)for(const t of o)e[t.nameWithGranularity]={value:mR(t,e[t.name]?.value||null,this.getters.getLocale()),type:e[t.name]?.type||xo.empty,format:e[t.name]?.format};return t}},definition:nR,externalData:!1,onIterationEndEvaluation:e=>e.markAsDirtyForEvaluation(),granularities:["year","quarter_number","month_number","month","iso_week_number","day_of_month","day"],isMeasureCandidate:e=>!["date","boolean"].includes(e.type),isGroupable:()=>!0});class vR extends Gl{pivotId;mutators=["reset","deferUpdates","applyUpdate","discardPendingUpdate","update"];updatesAreDeferred=!1;draft=null;notification=this.get(jl);alreadyNotified=!1;constructor(e,t){super(e),this.pivotId=t}handle(e){if("UPDATE_PIVOT"===e.type)e.pivotId===this.pivotId&&this.getters.getPivot(this.pivotId).init()}get fields(){return this.pivot.getFields()}get pivot(){return this.getters.getPivot(this.pivotId)}get definition(){const e=bR.get(this.pivot.type).definition;return this.draft?new e(this.draft,this.fields,this.getters):this.pivot.definition}get isDirty(){return!!this.draft}get unusedMeasureFields(){const e=[{name:"__count",string:Co("Count"),type:"integer",aggregator:"sum"}],t=this.fields;for(const o in t){const s=t[o];s&&(bR.get(this.pivot.type).isMeasureCandidate(s)&&e.push(s))}const{rows:o,columns:s,measures:i}=this.definition,n=i.concat(o).concat(s).map((e=>e.name));return e.filter((e=>!n.includes(e.name))).sort(((e,t)=>e.string.localeCompare(t.string)))}get unusedGroupableFields(){const e=[],t=this.fields;for(const o in t){const s=t[o];s&&(bR.get(this.pivot.type).isGroupable(s)&&e.push(s))}const{columns:o,rows:s,measures:i}=this.definition,n=i.concat(s).concat(o).map((e=>e.name)),r=this.unusedDateTimeGranularities;return e.filter((e=>aa(e)?!n.includes(e.name)||r[e.name].size>0:!n.includes(e.name))).sort(((e,t)=>e.string.localeCompare(t.string)))}get allGranularities(){return bR.get(this.pivot.type).granularities}get unusedDateTimeGranularities(){return this.getUnusedDateTimeGranularities(this.fields,this.draft??this.getters.getPivotCoreDefinition(this.pivotId))}reset(e){this.pivotId=e,this.updatesAreDeferred=!0,this.draft=null}deferUpdates(e){this.updatesAreDeferred=e,!1===e&&this.draft&&this.applyUpdate()}applyUpdate(){if(this.draft&&(this.model.dispatch("UPDATE_PIVOT",{pivotId:this.pivotId,pivot:this.draft}),this.draft=null,!this.alreadyNotified&&!this.isDynamicPivotInViewport())){const e=`=PIVOT(${this.getters.getPivotFormulaId(this.pivotId)})`;this.alreadyNotified=!0,this.notification.notifyUser({type:"info",text:Co("Pivot updates only work with dynamic pivot tables. Use %s or re-insert the static pivot from the Data menu.",e),sticky:!1})}}discardPendingUpdate(){this.draft=null}update(e){const t=this.getters.getPivotCoreDefinition(this.pivotId),o={...t,...this.draft,...e},s={...o,columns:o.columns.map((e=>({name:e.name,order:e.order,granularity:e.granularity}))),rows:o.rows.map((e=>({name:e.name,order:e.order,granularity:e.granularity}))),measures:o.measures.map((e=>({name:e.name,aggregator:e.aggregator})))};if(!this.draft&&je(t,s))return;const i=this.addDefaultDateTimeGranularity(this.fields,s);this.draft=i,this.updatesAreDeferred||this.applyUpdate()}isDynamicPivotInViewport(){const e=this.getters.getActiveSheetId();for(const t of this.getters.getSheetViewVisibleCols())for(const o of this.getters.getSheetViewVisibleRows()){if(this.getters.isSpillPivotFormula({sheetId:e,col:t,row:o}))return!0}return!1}addDefaultDateTimeGranularity(e,t){const{columns:o,rows:s}=t,i=Se(o),n=Se(s),r=this.getUnusedDateTimeGranularities(e,t);for(const t of i.concat(n)){const o=e[t.name]?.type;if(("date"===o||"datetime"===o)&&!t.granularity){const e=r[t.name]?.values().next().value||"year";r[t.name]?.delete(e),t.granularity=e}}return{...t,columns:i,rows:n}}getUnusedDateTimeGranularities(e,t){const{columns:o,rows:s}=t,i=o.concat(s).filter((t=>{const o=e[t.name]?.type;return"date"===o||"datetime"===o})),n=this.allGranularities,r={};for(const e of i)r[e.name]=new Set(n);for(const e of i)r[e.name].delete(e.granularity||"month");return r}}class SR extends t.Component{static template="o-spreadsheet-PivotSpreadsheetSidePanel";static props={pivotId:String,onCloseSidePanel:Function};static components={PivotLayoutConfigurator:JI,Section:_E,SelectionInput:ME,Checkbox:OE,PivotDeferUpdate:jI,PivotTitleSection:oR};store;state;pivotSidePanelRef=t.useRef("pivotSidePanel");setup(){this.store=Vl(vR,this.props.pivotId),this.state=t.useState({range:void 0,rangeHasChanged:!1})}get shouldDisplayInvalidRangeError(){return(!this.store.isDirty||!this.state.rangeHasChanged)&&this.pivot.isInvalidRange}get ranges(){return this.state.range?[this.state.range]:this.definition.range?[this.env.model.getters.getRangeString(this.definition.range,"forceSheetReference")]:[]}get pivot(){return this.store.pivot}get definition(){return this.store.definition}getScrollableContainerEl(){return this.pivotSidePanelRef.el}onSelectionChanged(e){this.state.rangeHasChanged=!0,this.state.range=e[0]}onSelectionConfirmed(){if(this.state.range){const e=this.env.model.getters.getRangeFromSheetXC(this.env.model.getters.getActiveSheetId(),this.state.range);if(e.invalidSheetName||e.invalidXc)return;const t={sheetId:e.sheetId,zone:e.zone};this.store.update({dataSet:t}),this.store.applyUpdate()}}flipAxis(){const{rows:e,columns:t}=this.definition;this.onDimensionsUpdated({rows:t,columns:e})}onDimensionsUpdated(e){this.store.update(e)}}const yR=new n;yR.add("SPREADSHEET",{editor:SR});class CR extends t.Component{static template="o-spreadsheet-PivotSidePanel";static props={pivotId:String,onCloseSidePanel:Function};static components={PivotLayoutConfigurator:JI,Section:_E};get sidePanelEditor(){const e=this.env.model.getters.getPivotCoreDefinition(this.props.pivotId);if(!e)throw new Error("pivotId does not correspond to a pivot.");return yR.get(e.type).editor}}wv`
1232
1232
  .o-checkbox-selection {
1233
1233
  height: 150px;
1234
1234
  }
@@ -3139,4 +3139,4 @@
3139
3139
  <tableParts count="${e.tables.length}">
3140
3140
  ${BO(a)}
3141
3141
  </tableParts>
3142
- `}var AM;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(AM||(AM={}));function OM(e,t={}){const o=Se(t);return o.type=e,o}const _M={},DM={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:M,HEADER_WIDTH:P,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:N,DEFAULT_CELL_HEIGHT:L,SCROLLBAR_WIDTH:k},FM={autoCompleteProviders:dl,autofillModifiersRegistry:jS,autofillRulesRegistry:YS,cellMenuRegistry:Nw,colMenuRegistry:CE,errorTypes:Wo,linkMenuRegistry:uS,functionRegistry:gv,featurePluginRegistry:GD,iconsOnCellRegistry:uI,statefulUIPluginRegistry:qD,coreViewsPluginRegistry:ZD,corePluginRegistry:WD,rowMenuRegistry:IE,sidePanelRegistry:WR,figureRegistry:Ly,chartSidePanelComponentRegistry:lI,chartComponentRegistry:Oy,chartRegistry:Ay,chartSubtypeRegistry:Dy,topbarMenuRegistry:TE,topbarComponentRegistry:GR,clickableCellRegistry:jD,otRegistry:AE,inverseCommandRegistry:Hy,urlRegistry:ja,cellPopoverRegistry:Vv,numberFormatMenuRegistry:wE,repeatLocalCommandTransformRegistry:HD,repeatCommandTransformRegistry:UD,clipboardHandlersRegistries:Sa,pivotRegistry:bR,pivotTimeAdapterRegistry:$r,pivotSidePanelRegistry:yR,pivotNormalizationValueRegistry:ma,supportedPivotPositionalFormulaRegistry:ZS,pivotToFunctionValueRegistry:fa},MM={arg:vh,isEvaluationError:es,toBoolean:gs,toJsDate:ps,toNumber:os,toString:hs,toNormalizedPivotValue:da,toXC:Pt,toZone:Gi,toUnboundedZone:Wi,toCartesian:Mt,numberToLetters:_t,lettersToNumber:Dt,UuidGenerator:jn,formatValue:Xs,createCurrencyFormat:ui,ColorGenerator:Ot,computeTextWidth:Mn,createEmptyWorkbookData:b_,createEmptySheet:f_,createEmptyExcelSheet:v_,getDefaultChartJsRuntime:ih,chartFontColor:ac,getChartAxisTitleRuntime:dc,getFillingMode:ch,rgbaToHex:St,colorToRGBA:yt,positionToZone:un,isDefined:Ue,isMatrix:Uo,lazy:Ge,genericRepeat:zD,createAction:i,createActions:o,transformRangeData:Ca,deepEquals:je,overlap:on,union:Ji,isInside:sn,deepCopy:Se,expandZoneOnInsertion:Yi,reduceZoneOnDeletion:Qi,unquote:Ce,getMaxObjectId:sa,getFunctionsFromTokens:US,getFirstPivotFunction:GS,getNumberOfPivotFunctions:qS,parseDimension:ra,isDateField:aa,makeFieldProposal:zS,insertTokenAfterArgSeparator:BS,insertTokenAfterLeftParenthesis:$S,mergeContiguousZones:bn,getPivotHighlights:RE,pivotTimeAdapter:Wr,UNDO_REDO_PIVOT_COMMANDS:uD,createPivotFormula:ha,areDomainArgsFieldsValid:ca,formatTickValue:gc,sanitizeSheetName:xe,isNumber:uo,isDateTime:jt},PM={isMarkdownLink:De,parseMarkdownLink:Pe,markdownLink:Me,openLink:Ja,urlRepresentation:Qa},NM={Checkbox:OE,Section:_E,RoundColorPicker:XE,ChartDataSeries:PE,ChartErrorSection:LE,ChartLabelRange:kE,ChartTitle:KE,ChartPanel:dI,ChartFigure:My,ChartJsComponent:gh,Grid:BT,GridOverlay:CT,ScorecardChart:ph,LineConfigPanel:sI,BarConfigPanel:UE,PieChartDesignPanel:iI,GenericChartConfigPanel:VE,ChartWithAxisDesignPanel:eI,GaugeChartConfigPanel:tI,GaugeChartDesignPanel:oI,ScorecardChartConfigPanel:nI,ScorecardChartDesignPanel:rI,ChartTypePicker:cI,FigureComponent:qR,Menu:gS,Popover:qv,SelectionInput:ME,ValidationMessages:NE,AddDimensionButton:YI,PivotDimensionGranularity:KI,PivotDimensionOrder:QI,PivotDimension:XI,PivotLayoutConfigurator:JI,EditableName:tR,PivotDeferUpdate:jI,PivotTitleSection:oR,CogWheelMenu:eR},LM={useDragAndDropListItems:bI,useHighlights:EI,useHighlightsOnHover:xI},kM={useStoreProvider:Ll,DependencyContainer:Ml,CellPopoverStore:Hv,ComposerFocusStore:Kl,ComposerStore:Xl,FindAndReplaceStore:WI,HighlightStore:Zl,HoveredCellStore:Uv,ModelStore:Bl,NotificationStore:jl,RendererStore:Wl,SelectionInputStore:FE,SpreadsheetStore:Gl,useStore:kl,useLocalStore:Vl,SidePanelStore:VT,PivotSidePanelStore:vR};const VM={DEFAULT_LOCALE:ko,HIGHLIGHT_COLOR:a,PIVOT_TABLE_CONFIG:me,ChartTerms:vl};e.AbstractCellClipboardHandler=Qn,e.AbstractChart=Uc,e.AbstractFigureClipboardHandler=va,e.CellErrorType=$o,e.CorePlugin=y_,e.DispatchResult=Fo,e.EvaluationError=Go,e.Model=class extends Fl{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={},s=[],i=new jn,n=!0){const r=performance.now();console.debug("##### Model creation #####"),super(),vo===fo&&So===bo&&(So=()=>!0),s=g_(e,s);const a=d_(e,n);this.state=new LF,this.uuidGenerator=i,this.config=this.setupConfig(o),this.session=this.setupSession(a.revisionId),this.coreGetters={},this.range=new R_(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.coreGetters.recomputeRanges=this.range.recomputeRanges.bind(this.range),this.coreGetters.isRangeValid=this.range.isRangeValid.bind(this.range),this.coreGetters.extendRange=this.range.extendRange.bind(this.range),this.coreGetters.getRangesUnion=this.range.getRangesUnion.bind(this.range),this.coreGetters.removeRangesSheetPrefix=this.range.removeRangesSheetPrefix.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.selection=new PF(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of WD.getAll())this.setupCorePlugin(e,a);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(s);for(let e of ZD.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 qD.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of GD.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}if(this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),o.snapshotRequested){const e=performance.now();console.debug("Snapshot requested"),this.session.snapshot(this.exportData()),this.garbageCollectExternalResources(),console.debug("Snapshot taken in",performance.now()-e,"ms")}t.markRaw(this),console.debug("Model created in",performance.now()-r,"ms"),console.debug("######")}joinSession(){this.session.join(this.config.client)}async leaveSession(){const e=this.getters.isReadonly()?void 0:Ge((()=>this.exportData()));await this.session.leave(e)}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)}for(const o of e.layers)this.renderers[o]||(this.renderers[o]=[]),this.renderers[o].push(t);return 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 TD(DF({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.dispatchToHandlers(this.coreHandlers,{type:"UNDO",commands:[e]})}}),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.smallUuid(),name:Co("Anonymous").toString()},o=e.transportService||new xF;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),raiseBlockingErrorUI:e=>this.trigger("raise-error-ui",{text:e}),customColors:e.customColors||[]}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(Lo));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,canDispatch:this.canDispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrencyFormat:this.config.defaultCurrencyFormat,customColors:this.config.customColors||[]}}checkDispatchAllowed(e){const t=Do(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new Fo(t.flat()):Fo.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,this.trigger("command-finalized")}canDispatch=(e,t)=>this.checkDispatchAllowed(OM(e,t));dispatch=(e,t)=>{const o=OM(e,t);let s=this.status;if(this.getters.isReadonly()&&(i=o,!Oo.has(i.type)))return new Fo("Readonly");var i;if(!this.session.canApplyOptimisticUpdate())return new Fo("WaitingSessionConfirmation");switch(s){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:s,commands:i}=this.state.recordChanges((()=>{const t=performance.now();Do(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize();const s=performance.now()-t;s>5&&console.debug(e,s,"ms")}));this.session.save(o,i,s),this.status=0,this.trigger("update");break;case 1:if(Do(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(Do(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Fo.Success};dispatchFromCorePlugin=(e,t)=>{const o=OM(e,t),s=this.status;this.status=2;const i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,o),this.status=s,Fo.Success};dispatchToHandlers(e,t){const o=Do(t);for(const s of e)!o&&s instanceof y_||s.beforeHandle(t);for(const s of e)!o&&s instanceof y_||s.handle(t);this.trigger("command-dispatched",t)}drawLayer(e,t){const o=this.renderers[t];if(o)for(const s of o)e.ctx.save(),s.drawLayer(e,t),e.ctx.restore()}exportData(){let e=b_();for(let t of this.handlers)t instanceof y_&&t.export(e);return e.revisionId=this.session.getRevisionId()||J,e=Se(e),e}updateMode(e){this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...b_(),sheets:[v_(h_,"Sheet1")]};for(let t of this.handlers)t instanceof S_&&t.exportForExcel(e);return e=Se(e),RM(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.PivotRuntimeDefinition=sR,e.Registry=n,e.Revision=ID,e.SPREADSHEET_DIMENSIONS=DM,e.Spreadsheet=wF,e.SpreadsheetPivotTable=rR,e.UIPlugin=A_,e.__info__=_M,e.addFunction=function e(t,o){return gv.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.addRenderingLayer=function(e,t){if(zo[e])throw new Error(`Layer ${e} already exists`);zo[e]=t},e.astToFormula=$a,e.compile=NS,e.compileTokens=LS,e.components=NM,e.constants=VM,e.convertAstNodes=Ua,e.coreTypes=_o,e.findCellInNewZone=dn,e.functionCache=PS,e.helpers=MM,e.hooks=LM,e.invalidateCFEvaluationCommands=To,e.invalidateDependenciesCommands=Ro,e.invalidateEvaluationCommands=Io,e.iterateAstNodes=Ha,e.links=PM,e.load=d_,e.parse=ka,e.parseTokens=Va,e.readonlyAllowedCommands=Oo,e.registries=FM,e.setDefaultSheetViewSize=function(e){de=e},e.setTranslationMethod=function(e,t=(()=>!0)){vo=e,So=t},e.stores=kM,e.tokenColors=IS,e.tokenize=tr,_M.version="17.4.35",_M.date="2025-05-13T17:49:44.553Z",_M.hash="534c5f4"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
3142
+ `}var AM;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(AM||(AM={}));function OM(e,t={}){const o=Se(t);return o.type=e,o}const _M={},DM={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:M,HEADER_WIDTH:P,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:N,DEFAULT_CELL_HEIGHT:L,SCROLLBAR_WIDTH:k},FM={autoCompleteProviders:dl,autofillModifiersRegistry:jS,autofillRulesRegistry:YS,cellMenuRegistry:Nw,colMenuRegistry:CE,errorTypes:Wo,linkMenuRegistry:uS,functionRegistry:gv,featurePluginRegistry:GD,iconsOnCellRegistry:uI,statefulUIPluginRegistry:qD,coreViewsPluginRegistry:ZD,corePluginRegistry:WD,rowMenuRegistry:IE,sidePanelRegistry:WR,figureRegistry:Ly,chartSidePanelComponentRegistry:lI,chartComponentRegistry:Oy,chartRegistry:Ay,chartSubtypeRegistry:Dy,topbarMenuRegistry:TE,topbarComponentRegistry:GR,clickableCellRegistry:jD,otRegistry:AE,inverseCommandRegistry:Hy,urlRegistry:ja,cellPopoverRegistry:Vv,numberFormatMenuRegistry:wE,repeatLocalCommandTransformRegistry:HD,repeatCommandTransformRegistry:UD,clipboardHandlersRegistries:Sa,pivotRegistry:bR,pivotTimeAdapterRegistry:$r,pivotSidePanelRegistry:yR,pivotNormalizationValueRegistry:ma,supportedPivotPositionalFormulaRegistry:ZS,pivotToFunctionValueRegistry:fa},MM={arg:vh,isEvaluationError:es,toBoolean:gs,toJsDate:ps,toNumber:os,toString:hs,toNormalizedPivotValue:da,toXC:Pt,toZone:Gi,toUnboundedZone:Wi,toCartesian:Mt,numberToLetters:_t,lettersToNumber:Dt,UuidGenerator:jn,formatValue:Xs,createCurrencyFormat:ui,ColorGenerator:Ot,computeTextWidth:Mn,createEmptyWorkbookData:b_,createEmptySheet:f_,createEmptyExcelSheet:v_,getDefaultChartJsRuntime:ih,chartFontColor:ac,getChartAxisTitleRuntime:dc,getFillingMode:ch,rgbaToHex:St,colorToRGBA:yt,positionToZone:un,isDefined:Ue,isMatrix:Uo,lazy:Ge,genericRepeat:zD,createAction:i,createActions:o,transformRangeData:Ca,deepEquals:je,overlap:on,union:Ji,isInside:sn,deepCopy:Se,expandZoneOnInsertion:Yi,reduceZoneOnDeletion:Qi,unquote:Ce,getMaxObjectId:sa,getFunctionsFromTokens:US,getFirstPivotFunction:GS,getNumberOfPivotFunctions:qS,parseDimension:ra,isDateField:aa,makeFieldProposal:zS,insertTokenAfterArgSeparator:BS,insertTokenAfterLeftParenthesis:$S,mergeContiguousZones:bn,getPivotHighlights:RE,pivotTimeAdapter:Wr,UNDO_REDO_PIVOT_COMMANDS:uD,createPivotFormula:ha,areDomainArgsFieldsValid:ca,formatTickValue:gc,sanitizeSheetName:xe,isNumber:uo,isDateTime:jt},PM={isMarkdownLink:De,parseMarkdownLink:Pe,markdownLink:Me,openLink:Ja,urlRepresentation:Qa},NM={Checkbox:OE,Section:_E,RoundColorPicker:XE,ChartDataSeries:PE,ChartErrorSection:LE,ChartLabelRange:kE,ChartTitle:KE,ChartPanel:dI,ChartFigure:My,ChartJsComponent:gh,Grid:BT,GridOverlay:CT,ScorecardChart:ph,LineConfigPanel:sI,BarConfigPanel:UE,PieChartDesignPanel:iI,GenericChartConfigPanel:VE,ChartWithAxisDesignPanel:eI,GaugeChartConfigPanel:tI,GaugeChartDesignPanel:oI,ScorecardChartConfigPanel:nI,ScorecardChartDesignPanel:rI,ChartTypePicker:cI,FigureComponent:qR,Menu:gS,Popover:qv,SelectionInput:ME,ValidationMessages:NE,AddDimensionButton:YI,PivotDimensionGranularity:KI,PivotDimensionOrder:QI,PivotDimension:XI,PivotLayoutConfigurator:JI,EditableName:tR,PivotDeferUpdate:jI,PivotTitleSection:oR,CogWheelMenu:eR},LM={useDragAndDropListItems:bI,useHighlights:EI,useHighlightsOnHover:xI},kM={useStoreProvider:Ll,DependencyContainer:Ml,CellPopoverStore:Hv,ComposerFocusStore:Kl,ComposerStore:Xl,FindAndReplaceStore:WI,HighlightStore:Zl,HoveredCellStore:Uv,ModelStore:Bl,NotificationStore:jl,RendererStore:Wl,SelectionInputStore:FE,SpreadsheetStore:Gl,useStore:kl,useLocalStore:Vl,SidePanelStore:VT,PivotSidePanelStore:vR};const VM={DEFAULT_LOCALE:ko,HIGHLIGHT_COLOR:a,PIVOT_TABLE_CONFIG:me,ChartTerms:vl};e.AbstractCellClipboardHandler=Qn,e.AbstractChart=Uc,e.AbstractFigureClipboardHandler=va,e.CellErrorType=$o,e.CorePlugin=y_,e.DispatchResult=Fo,e.EvaluationError=Go,e.Model=class extends Fl{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={},s=[],i=new jn,n=!0){const r=performance.now();console.debug("##### Model creation #####"),super(),vo===fo&&So===bo&&(So=()=>!0),s=g_(e,s);const a=d_(e,n);this.state=new LF,this.uuidGenerator=i,this.config=this.setupConfig(o),this.session=this.setupSession(a.revisionId),this.coreGetters={},this.range=new R_(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.coreGetters.recomputeRanges=this.range.recomputeRanges.bind(this.range),this.coreGetters.isRangeValid=this.range.isRangeValid.bind(this.range),this.coreGetters.extendRange=this.range.extendRange.bind(this.range),this.coreGetters.getRangesUnion=this.range.getRangesUnion.bind(this.range),this.coreGetters.removeRangesSheetPrefix=this.range.removeRangesSheetPrefix.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode},this.selection=new PF(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of WD.getAll())this.setupCorePlugin(e,a);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(s);for(let e of ZD.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 qD.getAll()){const t=this.setupUiPlugin(e);this.statefulUIPlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}for(let e of GD.getAll()){const t=this.setupUiPlugin(e);this.featurePlugins.push(t),this.handlers.push(t),this.uiHandlers.push(t)}if(this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.joinSession(),o.snapshotRequested){const e=performance.now();console.debug("Snapshot requested"),this.session.snapshot(this.exportData()),this.garbageCollectExternalResources(),console.debug("Snapshot taken in",performance.now()-e,"ms")}t.markRaw(this),console.debug("Model created in",performance.now()-r,"ms"),console.debug("######")}joinSession(){this.session.join(this.config.client)}async leaveSession(){const e=this.getters.isReadonly()?void 0:Ge((()=>this.exportData()));await this.session.leave(e)}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)}for(const o of e.layers)this.renderers[o]||(this.renderers[o]=[]),this.renderers[o].push(t);return 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 TD(DF({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.dispatchToHandlers(this.coreHandlers,{type:"UNDO",commands:[e]})}}),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.smallUuid(),name:Co("Anonymous").toString()},o=e.transportService||new xF;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:this.setupExternalConfig(e.external||{}),transportService:o,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),raiseBlockingErrorUI:e=>this.trigger("raise-error-ui",{text:e}),customColors:e.customColors||[]}}setupExternalConfig(e){const t=e.loadLocales||(()=>Promise.resolve(Lo));return{...e,loadLocales:t}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,canDispatch:this.canDispatch,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,canDispatch:this.canDispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,session:this.session,defaultCurrencyFormat:this.config.defaultCurrencyFormat,customColors:this.config.customColors||[]}}checkDispatchAllowed(e){const t=Do(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e);return t.some((e=>"Success"!==e))?new Fo(t.flat()):Fo.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,this.trigger("command-finalized")}canDispatch=(e,t)=>this.checkDispatchAllowed(OM(e,t));dispatch=(e,t)=>{const o=OM(e,t);let s=this.status;if(this.getters.isReadonly()&&(i=o,!Oo.has(i.type)))return new Fo("Readonly");var i;if(!this.session.canApplyOptimisticUpdate())return new Fo("WaitingSessionConfirmation");switch(s){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:s,commands:i}=this.state.recordChanges((()=>{const t=performance.now();Do(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize();const s=performance.now()-t;s>5&&console.debug(e,s,"ms")}));this.session.save(o,i,s),this.status=0,this.trigger("update");break;case 1:if(Do(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(Do(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Fo.Success};dispatchFromCorePlugin=(e,t)=>{const o=OM(e,t),s=this.status;this.status=2;const i=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(i,o),this.status=s,Fo.Success};dispatchToHandlers(e,t){const o=Do(t);for(const s of e)!o&&s instanceof y_||s.beforeHandle(t);for(const s of e)!o&&s instanceof y_||s.handle(t);this.trigger("command-dispatched",t)}drawLayer(e,t){const o=this.renderers[t];if(o)for(const s of o)e.ctx.save(),s.drawLayer(e,t),e.ctx.restore()}exportData(){let e=b_();for(let t of this.handlers)t instanceof y_&&t.export(e);return e.revisionId=this.session.getRevisionId()||J,e=Se(e),e}updateMode(e){this.config.mode=e,this.trigger("update")}exportXLSX(){this.dispatch("EVALUATE_CELLS");let e={...b_(),sheets:[v_(h_,"Sheet1")]};for(let t of this.handlers)t instanceof S_&&t.exportForExcel(e);return e=Se(e),RM(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.PivotRuntimeDefinition=sR,e.Registry=n,e.Revision=ID,e.SPREADSHEET_DIMENSIONS=DM,e.Spreadsheet=wF,e.SpreadsheetPivotTable=rR,e.UIPlugin=A_,e.__info__=_M,e.addFunction=function e(t,o){return gv.add(t,o),{addFunction:(t,o)=>e(t,o)}},e.addRenderingLayer=function(e,t){if(zo[e])throw new Error(`Layer ${e} already exists`);zo[e]=t},e.astToFormula=$a,e.compile=NS,e.compileTokens=LS,e.components=NM,e.constants=VM,e.convertAstNodes=Ua,e.coreTypes=_o,e.findCellInNewZone=dn,e.functionCache=PS,e.helpers=MM,e.hooks=LM,e.invalidateCFEvaluationCommands=To,e.invalidateDependenciesCommands=Ro,e.invalidateEvaluationCommands=Io,e.iterateAstNodes=Ha,e.links=PM,e.load=d_,e.parse=ka,e.parseTokens=Va,e.readonlyAllowedCommands=Oo,e.registries=FM,e.setDefaultSheetViewSize=function(e){de=e},e.setTranslationMethod=function(e,t=(()=>!0)){vo=e,So=t},e.stores=kM,e.tokenColors=IS,e.tokenize=tr,_M.version="17.4.36",_M.date="2025-05-20T05:54:11.995Z",_M.hash="fabd931"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
@@ -1,9 +1,9 @@
1
1
  <!--
2
2
  This file is generated by o-spreadsheet build tools. Do not edit it.
3
3
  @see https://github.com/odoo/o-spreadsheet
4
- @version 17.4.35
5
- @date 2025-05-13T17:50:28.661Z
6
- @hash 534c5f4
4
+ @version 17.4.36
5
+ @date 2025-05-20T05:54:57.760Z
6
+ @hash fabd931
7
7
  -->
8
8
  <odoo>
9
9
  <t t-name="o-spreadsheet-ActionButton">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "17.4.35",
3
+ "version": "17.4.36",
4
4
  "description": "A spreadsheet component",
5
5
  "type": "module",
6
6
  "main": "dist/o-spreadsheet.cjs.js",