@odoo/o-spreadsheet 16.3.7 → 16.3.8
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.
|
@@ -46564,7 +46564,14 @@ function addCellWiseConditionalFormatting(dxfs // cell-wise CF
|
|
|
46564
46564
|
`;
|
|
46565
46565
|
}
|
|
46566
46566
|
|
|
46567
|
-
const
|
|
46567
|
+
const TABLE_DEFAULT_ATTRS = [
|
|
46568
|
+
["name", "TableStyleLight8"],
|
|
46569
|
+
["showFirstColumn", "0"],
|
|
46570
|
+
["showLastColumn", "0"],
|
|
46571
|
+
["showRowStripes", "0"],
|
|
46572
|
+
["showColumnStripes", "0"],
|
|
46573
|
+
];
|
|
46574
|
+
const TABLE_DEFAULT_STYLE = escapeXml /*xml*/ `<tableStyleInfo ${formatAttributes(TABLE_DEFAULT_ATTRS)}/>`;
|
|
46568
46575
|
function createTable(table, tableId, sheetData) {
|
|
46569
46576
|
const tableAttributes = [
|
|
46570
46577
|
["id", tableId],
|
|
@@ -47656,6 +47663,6 @@ exports.setTranslationMethod = setTranslationMethod;
|
|
|
47656
47663
|
exports.tokenize = tokenize;
|
|
47657
47664
|
|
|
47658
47665
|
|
|
47659
|
-
__info__.version = '16.3.
|
|
47660
|
-
__info__.date = '2023-08-
|
|
47661
|
-
__info__.hash = '
|
|
47666
|
+
__info__.version = '16.3.8';
|
|
47667
|
+
__info__.date = '2023-08-17T11:06:03.177Z';
|
|
47668
|
+
__info__.hash = 'af65228';
|
|
@@ -46560,7 +46560,14 @@ function addCellWiseConditionalFormatting(dxfs // cell-wise CF
|
|
|
46560
46560
|
`;
|
|
46561
46561
|
}
|
|
46562
46562
|
|
|
46563
|
-
const
|
|
46563
|
+
const TABLE_DEFAULT_ATTRS = [
|
|
46564
|
+
["name", "TableStyleLight8"],
|
|
46565
|
+
["showFirstColumn", "0"],
|
|
46566
|
+
["showLastColumn", "0"],
|
|
46567
|
+
["showRowStripes", "0"],
|
|
46568
|
+
["showColumnStripes", "0"],
|
|
46569
|
+
];
|
|
46570
|
+
const TABLE_DEFAULT_STYLE = escapeXml /*xml*/ `<tableStyleInfo ${formatAttributes(TABLE_DEFAULT_ATTRS)}/>`;
|
|
46564
46571
|
function createTable(table, tableId, sheetData) {
|
|
46565
46572
|
const tableAttributes = [
|
|
46566
46573
|
["id", tableId],
|
|
@@ -47624,6 +47631,6 @@ function addFunction(functionName, functionDescription) {
|
|
|
47624
47631
|
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 };
|
|
47625
47632
|
|
|
47626
47633
|
|
|
47627
|
-
__info__.version = '16.3.
|
|
47628
|
-
__info__.date = '2023-08-
|
|
47629
|
-
__info__.hash = '
|
|
47634
|
+
__info__.version = '16.3.8';
|
|
47635
|
+
__info__.date = '2023-08-17T11:06:03.177Z';
|
|
47636
|
+
__info__.hash = 'af65228';
|
|
@@ -46561,7 +46561,14 @@
|
|
|
46561
46561
|
`;
|
|
46562
46562
|
}
|
|
46563
46563
|
|
|
46564
|
-
const
|
|
46564
|
+
const TABLE_DEFAULT_ATTRS = [
|
|
46565
|
+
["name", "TableStyleLight8"],
|
|
46566
|
+
["showFirstColumn", "0"],
|
|
46567
|
+
["showLastColumn", "0"],
|
|
46568
|
+
["showRowStripes", "0"],
|
|
46569
|
+
["showColumnStripes", "0"],
|
|
46570
|
+
];
|
|
46571
|
+
const TABLE_DEFAULT_STYLE = escapeXml /*xml*/ `<tableStyleInfo ${formatAttributes(TABLE_DEFAULT_ATTRS)}/>`;
|
|
46565
46572
|
function createTable(table, tableId, sheetData) {
|
|
46566
46573
|
const tableAttributes = [
|
|
46567
46574
|
["id", tableId],
|
|
@@ -47655,9 +47662,9 @@
|
|
|
47655
47662
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47656
47663
|
|
|
47657
47664
|
|
|
47658
|
-
__info__.version = '16.3.
|
|
47659
|
-
__info__.date = '2023-08-
|
|
47660
|
-
__info__.hash = '
|
|
47665
|
+
__info__.version = '16.3.8';
|
|
47666
|
+
__info__.date = '2023-08-17T11:06:03.177Z';
|
|
47667
|
+
__info__.hash = 'af65228';
|
|
47661
47668
|
|
|
47662
47669
|
|
|
47663
47670
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|
|
@@ -2306,7 +2306,7 @@
|
|
|
2306
2306
|
</font>
|
|
2307
2307
|
`}function Ew(e){return e?PS([["style",e.style]]):zS``}function ww(e){return e?zS`
|
|
2308
2308
|
<color ${PS([["rgb",Or(e.color.rgb)]])}/>
|
|
2309
|
-
`:zS``}const xw=zS`<tableStyleInfo name
|
|
2309
|
+
`:zS``}const xw=zS`<tableStyleInfo ${PS([["name","TableStyleLight8"],["showFirstColumn","0"],["showLastColumn","0"],["showRowStripes","0"],["showColumnStripes","0"]])}/>`;function yw(e,t,o){const i=zS`
|
|
2310
2310
|
<table ${PS([["id",t],["name",`Table${t}`],["displayName",`Table${t}`],["ref",e.range],["xmlns",ib.table],["xmlns:xr",ib.revision],["xmlns:xr3",ib.revision3],["xmlns:mc",ib.markupCompatibility]])}>
|
|
2311
2311
|
${function(e){const t=[["ref",e.range]];return zS`
|
|
2312
2312
|
<autoFilter ${PS(t)}>
|
|
@@ -2496,4 +2496,4 @@
|
|
|
2496
2496
|
<tableParts count="${e.filterTables.length}">
|
|
2497
2497
|
${VS(a)}
|
|
2498
2498
|
</tableParts>
|
|
2499
|
-
`}var Dw;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(Dw||(Dw={}));function Lw(e,t={}){const o=ze(t);return o.type=e,o}const Pw={},kw={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:F,HEADER_WIDTH:D,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:L,DEFAULT_CELL_HEIGHT:P,SCROLLBAR_WIDTH:k},Uw={autofillModifiersRegistry:Vs,autofillRulesRegistry:zs,cellMenuRegistry:rp,colMenuRegistry:Cm,linkMenuRegistry:Ir,functionRegistry:Ng,featurePluginRegistry:aE,statefulUIPluginRegistry:lE,coreViewsPluginRegistry:cE,corePluginRegistry:nE,rowMenuRegistry:xm,sidePanelRegistry:tf,figureRegistry:Vn,chartSidePanelComponentRegistry:$m,chartComponentRegistry:Dn,chartRegistry:Fn,topbarMenuRegistry:ym,topbarComponentRegistry:of,clickableCellRegistry:hE,otRegistry:Im,inverseCommandRegistry:$n,urlRegistry:Ui,cellPopoverRegistry:Ar,numberFormatMenuRegistry:Em,repeatLocalCommandTransformRegistry:GC,repeatCommandTransformRegistry:WC},Vw={arg:Wa,toBoolean:ts,toJsDate:os,toNumber:ji,toString:Qi,toXC:Gt,toZone:Jo,toCartesian:Wt,numberToLetters:Vt,UuidGenerator:Ko,formatValue:mo,computeTextWidth:Ge,createEmptyWorkbookData:dC,createEmptySheet:hC,createEmptyExcelSheet:uC,getDefaultChartJsRuntime:an,chartFontColor:$r,ChartColors:Hr,EvaluationError:c,CellErrorLevel:l,getFillingMode:dn,rgbaToHex:Lt,colorToRGBA:Pt,positionToZone:Ci,isDefined:ht,lazy:mt,genericRepeat:qC},zw={isMarkdownLink:ot,parseMarkdownLink:rt,markdownLink:st,openLink:$i,urlRepresentation:Hi},Bw={ChartPanel:Wm,ChartFigure:Pn,ChartJsComponent:yi,Grid:Qf,GridOverlay:Pf,ScorecardChart:Fi,LineConfigPanel:zm,LineBarPieDesignPanel:km,BarConfigPanel:Nm,LineBarPieConfigPanel:Mm,GaugeChartConfigPanel:Um,GaugeChartDesignPanel:Vm,ScorecardChartConfigPanel:Bm,ScorecardChartDesignPanel:Hm,FigureComponent:sf};e.AbstractChart=Mr,e.CorePlugin=pC,e.DispatchResult=Rs,e.EvaluationError=c,e.Model=class extends IC{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 Ko,r=!0){super(),i=lC(e,i);const n=nC(e,r);this.state=new qE,this.uuidGenerator=s,this.config=this.setupConfig(o),this.session=this.setupSession(n.revisionId),this.coreGetters={},this.range=new CC(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 GE(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of nE.getAll())this.setupCorePlugin(e,n);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(i);for(let e of lE.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 aE.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 DC(HE({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:r("Anonymous").toString()},o=e.transportService||new FE;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){return Is(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e)}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),new Rs(t.flat())}checkDispatchAllowedLocalCommand(e){const t=this.uiHandlers.map((t=>t.allowDispatch(e)));return new Rs(t.flat())}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(Lw(e,t));dispatch=(e,t)=>{const o=Lw(e,t);let i=this.status;if(this.getters.isReadonly()&&(s=o,!xs.has(s.type)))return new Rs(67);var s;if(!this.session.canApplyOptimisticUpdate())return new Rs(64);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((()=>{Is(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(Is(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(Is(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Rs.Success};dispatchFromCorePlugin=(e,t)=>{const o=Lw(e,t),i=this.status;this.status=2;const s=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(s,o),this.status=i,Rs.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=dC();for(let t of this.handlers)t instanceof pC&&t.export(e);return e.revisionId=this.session.getRevisionId()||ee,e=ze(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={...dC(),sheets:[uC(rC,"Sheet1")]};for(let t of this.handlers)t instanceof gC&&t.exportForExcel(e);return e=ze(e),_w(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Pi,e.Revision=_C,e.SPREADSHEET_DIMENSIONS=kw,e.Spreadsheet=_E,e.UIPlugin=EC,e.__info__=Pw,e.addFunction=function(e,t){Ng.add(e,t)},e.astToFormula=Pv,e.compile=Yv,e.components=Bw,e.convertAstNodes=Lv,e.coreTypes=ys,e.findCellInNewZone=vi,e.functionCache=jv,e.helpers=Vw,e.invalidateEvaluationCommands=Es,e.links=zw,e.load=nC,e.parse=Fv,e.readonlyAllowedCommands=xs,e.registries=Uw,e.setDefaultSheetViewSize=function(e){ge=e},e.setTranslationMethod=function(e){o=e},e.tokenize=uv,Object.defineProperty(e,"__esModule",{value:!0}),Pw.version="16.3.
|
|
2499
|
+
`}var Dw;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(Dw||(Dw={}));function Lw(e,t={}){const o=ze(t);return o.type=e,o}const Pw={},kw={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:F,HEADER_WIDTH:D,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:L,DEFAULT_CELL_HEIGHT:P,SCROLLBAR_WIDTH:k},Uw={autofillModifiersRegistry:Vs,autofillRulesRegistry:zs,cellMenuRegistry:rp,colMenuRegistry:Cm,linkMenuRegistry:Ir,functionRegistry:Ng,featurePluginRegistry:aE,statefulUIPluginRegistry:lE,coreViewsPluginRegistry:cE,corePluginRegistry:nE,rowMenuRegistry:xm,sidePanelRegistry:tf,figureRegistry:Vn,chartSidePanelComponentRegistry:$m,chartComponentRegistry:Dn,chartRegistry:Fn,topbarMenuRegistry:ym,topbarComponentRegistry:of,clickableCellRegistry:hE,otRegistry:Im,inverseCommandRegistry:$n,urlRegistry:Ui,cellPopoverRegistry:Ar,numberFormatMenuRegistry:Em,repeatLocalCommandTransformRegistry:GC,repeatCommandTransformRegistry:WC},Vw={arg:Wa,toBoolean:ts,toJsDate:os,toNumber:ji,toString:Qi,toXC:Gt,toZone:Jo,toCartesian:Wt,numberToLetters:Vt,UuidGenerator:Ko,formatValue:mo,computeTextWidth:Ge,createEmptyWorkbookData:dC,createEmptySheet:hC,createEmptyExcelSheet:uC,getDefaultChartJsRuntime:an,chartFontColor:$r,ChartColors:Hr,EvaluationError:c,CellErrorLevel:l,getFillingMode:dn,rgbaToHex:Lt,colorToRGBA:Pt,positionToZone:Ci,isDefined:ht,lazy:mt,genericRepeat:qC},zw={isMarkdownLink:ot,parseMarkdownLink:rt,markdownLink:st,openLink:$i,urlRepresentation:Hi},Bw={ChartPanel:Wm,ChartFigure:Pn,ChartJsComponent:yi,Grid:Qf,GridOverlay:Pf,ScorecardChart:Fi,LineConfigPanel:zm,LineBarPieDesignPanel:km,BarConfigPanel:Nm,LineBarPieConfigPanel:Mm,GaugeChartConfigPanel:Um,GaugeChartDesignPanel:Vm,ScorecardChartConfigPanel:Bm,ScorecardChartDesignPanel:Hm,FigureComponent:sf};e.AbstractChart=Mr,e.CorePlugin=pC,e.DispatchResult=Rs,e.EvaluationError=c,e.Model=class extends IC{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 Ko,r=!0){super(),i=lC(e,i);const n=nC(e,r);this.state=new qE,this.uuidGenerator=s,this.config=this.setupConfig(o),this.session=this.setupSession(n.revisionId),this.coreGetters={},this.range=new CC(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 GE(this.getters),this.coreHandlers.push(this.range),this.handlers.push(this.range),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of nE.getAll())this.setupCorePlugin(e,n);Object.assign(this.getters,this.coreGetters),this.session.loadInitialMessages(i);for(let e of lE.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 aE.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 DC(HE({initialRevisionId:e,recordChanges:this.state.recordChanges.bind(this.state),dispatch:e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers(this.coreHandlers,e),this.isReplayingCommand=!1)}}),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-undone",this,(({commands:e})=>{this.dispatchFromCorePlugin("UNDO",{commands:e}),this.finalize()})),this.session.on("revision-redone",this,(({commands:e})=>{this.dispatchFromCorePlugin("REDO",{commands:e}),this.finalize()})),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:r("Anonymous").toString()},o=e.transportService||new FE;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){return Is(e)?this.checkDispatchAllowedCoreCommand(e):this.checkDispatchAllowedLocalCommand(e)}checkDispatchAllowedCoreCommand(e){const t=this.corePlugins.map((t=>t.allowDispatch(e)));return t.push(this.range.allowDispatch(e)),new Rs(t.flat())}checkDispatchAllowedLocalCommand(e){const t=this.uiHandlers.map((t=>t.allowDispatch(e)));return new Rs(t.flat())}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}canDispatch=(e,t)=>this.checkDispatchAllowed(Lw(e,t));dispatch=(e,t)=>{const o=Lw(e,t);let i=this.status;if(this.getters.isReadonly()&&(s=o,!xs.has(s.type)))return new Rs(67);var s;if(!this.session.canApplyOptimisticUpdate())return new Rs(64);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((()=>{Is(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(Is(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(Is(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return Rs.Success};dispatchFromCorePlugin=(e,t)=>{const o=Lw(e,t),i=this.status;this.status=2;const s=this.isReplayingCommand?this.coreHandlers:this.handlers;return this.dispatchToHandlers(s,o),this.status=i,Rs.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=dC();for(let t of this.handlers)t instanceof pC&&t.export(e);return e.revisionId=this.session.getRevisionId()||ee,e=ze(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={...dC(),sheets:[uC(rC,"Sheet1")]};for(let t of this.handlers)t instanceof gC&&t.exportForExcel(e);return e=ze(e),_w(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Pi,e.Revision=_C,e.SPREADSHEET_DIMENSIONS=kw,e.Spreadsheet=_E,e.UIPlugin=EC,e.__info__=Pw,e.addFunction=function(e,t){Ng.add(e,t)},e.astToFormula=Pv,e.compile=Yv,e.components=Bw,e.convertAstNodes=Lv,e.coreTypes=ys,e.findCellInNewZone=vi,e.functionCache=jv,e.helpers=Vw,e.invalidateEvaluationCommands=Es,e.links=zw,e.load=nC,e.parse=Fv,e.readonlyAllowedCommands=xs,e.registries=Uw,e.setDefaultSheetViewSize=function(e){ge=e},e.setTranslationMethod=function(e){o=e},e.tokenize=uv,Object.defineProperty(e,"__esModule",{value:!0}),Pw.version="16.3.8",Pw.date="2023-08-17T11:06:03.177Z",Pw.hash="af65228"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
|