@odoo/o-spreadsheet 16.2.0-alpha.1 → 16.2.0-alpha.2

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.
@@ -18996,7 +18996,6 @@ class ChartPanel extends owl.Component {
18996
18996
  ...this.getChartDefinition(),
18997
18997
  ...updateDefinition,
18998
18998
  };
18999
- // TODORAR add a putain de test - c'est faux de nouveau ...
19000
18999
  return this.env.model.dispatch("UPDATE_CHART", {
19001
19000
  definition,
19002
19001
  id: this.figureId,
@@ -19009,7 +19008,6 @@ class ChartPanel extends owl.Component {
19009
19008
  throw new Error("Chart not defined.");
19010
19009
  }
19011
19010
  const definition = getChartDefinitionFromContextCreation(context, type);
19012
- // TODORAR add a putain de test - c'est faux de nouveau ...
19013
19011
  this.env.model.dispatch("UPDATE_CHART", {
19014
19012
  definition,
19015
19013
  id: this.figureId,
@@ -28142,9 +28140,6 @@ class ChartPlugin extends CorePlugin {
28142
28140
  return figureId in (this.charts[sheetId] || {});
28143
28141
  }
28144
28142
  getChartIds(sheetId) {
28145
- // TODORAR refaire ce shit truc
28146
- // on veut un truc du genre Object.keys(this.charts[sheetId] || {} a mon avis
28147
- // return (Object.values(this.charts[sheetId] || {}).filter(isDefined) as AbstractChart[]).map((chart) => chart.id);
28148
28143
  return Object.keys(this.charts[sheetId] || {});
28149
28144
  }
28150
28145
  getChartDefinition(sheetId, figureId) {
@@ -44851,6 +44846,6 @@ exports.setTranslationMethod = setTranslationMethod;
44851
44846
  exports.tokenize = tokenize;
44852
44847
 
44853
44848
 
44854
- __info__.version = '16.2.0-alpha.1';
44855
- __info__.date = '2023-03-01T07:42:43.501Z';
44856
- __info__.hash = '162451a';
44849
+ __info__.version = '16.2.0-alpha.2';
44850
+ __info__.date = '2023-03-01T14:43:49.348Z';
44851
+ __info__.hash = 'eb626ad';
@@ -18992,7 +18992,6 @@ class ChartPanel extends Component {
18992
18992
  ...this.getChartDefinition(),
18993
18993
  ...updateDefinition,
18994
18994
  };
18995
- // TODORAR add a putain de test - c'est faux de nouveau ...
18996
18995
  return this.env.model.dispatch("UPDATE_CHART", {
18997
18996
  definition,
18998
18997
  id: this.figureId,
@@ -19005,7 +19004,6 @@ class ChartPanel extends Component {
19005
19004
  throw new Error("Chart not defined.");
19006
19005
  }
19007
19006
  const definition = getChartDefinitionFromContextCreation(context, type);
19008
- // TODORAR add a putain de test - c'est faux de nouveau ...
19009
19007
  this.env.model.dispatch("UPDATE_CHART", {
19010
19008
  definition,
19011
19009
  id: this.figureId,
@@ -28138,9 +28136,6 @@ class ChartPlugin extends CorePlugin {
28138
28136
  return figureId in (this.charts[sheetId] || {});
28139
28137
  }
28140
28138
  getChartIds(sheetId) {
28141
- // TODORAR refaire ce shit truc
28142
- // on veut un truc du genre Object.keys(this.charts[sheetId] || {} a mon avis
28143
- // return (Object.values(this.charts[sheetId] || {}).filter(isDefined) as AbstractChart[]).map((chart) => chart.id);
28144
28139
  return Object.keys(this.charts[sheetId] || {});
28145
28140
  }
28146
28141
  getChartDefinition(sheetId, figureId) {
@@ -44819,6 +44814,6 @@ function addFunction(functionName, functionDescription) {
44819
44814
  export { AbstractChart, CommandResult, CorePlugin, DATETIME_FORMAT, DispatchResult, EvaluationError, Model, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, UIPlugin, __info__, addFunction, astToFormula, compile, components, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, invalidateEvaluationCommands, links, load, parse, readonlyAllowedCommands, registries, setTranslationMethod, tokenize };
44820
44815
 
44821
44816
 
44822
- __info__.version = '16.2.0-alpha.1';
44823
- __info__.date = '2023-03-01T07:42:43.501Z';
44824
- __info__.hash = '162451a';
44817
+ __info__.version = '16.2.0-alpha.2';
44818
+ __info__.date = '2023-03-01T14:43:49.348Z';
44819
+ __info__.hash = 'eb626ad';
@@ -18993,7 +18993,6 @@
18993
18993
  ...this.getChartDefinition(),
18994
18994
  ...updateDefinition,
18995
18995
  };
18996
- // TODORAR add a putain de test - c'est faux de nouveau ...
18997
18996
  return this.env.model.dispatch("UPDATE_CHART", {
18998
18997
  definition,
18999
18998
  id: this.figureId,
@@ -19006,7 +19005,6 @@
19006
19005
  throw new Error("Chart not defined.");
19007
19006
  }
19008
19007
  const definition = getChartDefinitionFromContextCreation(context, type);
19009
- // TODORAR add a putain de test - c'est faux de nouveau ...
19010
19008
  this.env.model.dispatch("UPDATE_CHART", {
19011
19009
  definition,
19012
19010
  id: this.figureId,
@@ -28139,9 +28137,6 @@
28139
28137
  return figureId in (this.charts[sheetId] || {});
28140
28138
  }
28141
28139
  getChartIds(sheetId) {
28142
- // TODORAR refaire ce shit truc
28143
- // on veut un truc du genre Object.keys(this.charts[sheetId] || {} a mon avis
28144
- // return (Object.values(this.charts[sheetId] || {}).filter(isDefined) as AbstractChart[]).map((chart) => chart.id);
28145
28140
  return Object.keys(this.charts[sheetId] || {});
28146
28141
  }
28147
28142
  getChartDefinition(sheetId, figureId) {
@@ -44850,9 +44845,9 @@
44850
44845
  Object.defineProperty(exports, '__esModule', { value: true });
44851
44846
 
44852
44847
 
44853
- __info__.version = '16.2.0-alpha.1';
44854
- __info__.date = '2023-03-01T07:42:43.501Z';
44855
- __info__.hash = '162451a';
44848
+ __info__.version = '16.2.0-alpha.2';
44849
+ __info__.date = '2023-03-01T14:43:49.348Z';
44850
+ __info__.hash = 'eb626ad';
44856
44851
 
44857
44852
 
44858
44853
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -2407,4 +2407,4 @@
2407
2407
  <tableParts count="${e.filterTables.length}">
2408
2408
  ${Wm(a)}
2409
2409
  </tableParts>
2410
- `}var XS;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(XS||(XS={}));const YS={},KS={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:O,HEADER_WIDTH:N,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:_,DEFAULT_CELL_HEIGHT:F,SCROLLBAR_WIDTH:D},QS={autofillModifiersRegistry:Lu,autofillRulesRegistry:Pu,cellMenuRegistry:Ps,colMenuRegistry:Us,linkMenuRegistry:Ku,functionRegistry:iu,featurePluginRegistry:Rb,statefulUIPluginRegistry:Tb,coreViewsPluginRegistry:Ab,corePluginRegistry:Ib,rowMenuRegistry:Vs,sidePanelRegistry:Lg,figureRegistry:og,chartSidePanelComponentRegistry:Tg,chartComponentRegistry:Nn,chartRegistry:On,topbarMenuRegistry:ag,topbarComponentRegistry:Pg,clickableCellRegistry:Mb,otRegistry:cg,inverseCommandRegistry:ng,urlRegistry:Eu,cellPopoverRegistry:eg},JS={arg:Zs,toBoolean:or,toJsDate:nr,toNumber:Qs,toString:er,toXC:Vt,toZone:_i,toCartesian:Ut,numberToLetters:Lt,UuidGenerator:Oi,formatValue:li,computeTextWidth:Le,createEmptyWorkbookData:Uf,createEmptySheet:Pf,createEmptyExcelSheet:Vf,getDefaultChartJsRuntime:on,chartFontColor:zo,ChartColors:Vo,EvaluationError:c,CellErrorLevel:l,getFillingMode:an,rgbaToHex:Et,colorToRGBA:wt,positionToZone:Ji,isDefined:et,lazy:nt},eC={isMarkdownLink:qe,parseMarkdownLink:Xe,markdownLink:je,openLink:Ru,urlRepresentation:Iu},tC={ChartPanel:Ag,ChartFigure:Xn,ChartJsComponent:oo,Grid:op,GridOverlay:Bg,ScorecardChart:go,LineConfigPanel:yg,LineBarPieDesignPanel:Sg,BarConfigPanel:gg,LineBarPieConfigPanel:ug,GaugeChartConfigPanel:Eg,GaugeChartDesignPanel:wg,ScorecardChartConfigPanel:Ig,ScorecardChartDesignPanel:Rg};e.AbstractChart=vo,e.CorePlugin=Bf,e.DATETIME_FORMAT=X,e.DispatchResult=Ro,e.EvaluationError=c,e.Model=class extends Yv{constructor(e={},i={},o=[],n=new Oi,s=!0){super(),this.corePlugins=[],this.featurePlugins=[],this.statefulUIPlugins=[],this.coreViewsPlugins=[],this.isReplayingCommand=!1,this.renderers=[],this.status=0,this.dispatch=(e,t)=>{const i={...t,type:e};let o=this.status;if(this.getters.isReadonly()&&(n=i,!yo.has(n.type)))return new Ro(67);var n;if(!this.session.canApplyOptimisticUpdate())return new Ro(64);switch(o){case 0:const t=this.checkDispatchAllowed(i);if(!t.isSuccessful)return t;this.status=1;const{changes:o,commands:n}=this.state.recordChanges((()=>{Io(i)&&this.state.addCommand(i),this.dispatchToHandlers(this.handlers,i),this.finalize()}));this.session.save(n,o),this.status=0,this.trigger("update");break;case 1:if(Io(i)){const e=this.checkDispatchAllowed(i);if(!e.isSuccessful)return e;this.state.addCommand(i)}this.dispatchToHandlers(this.handlers,i);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(Io(i))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,i)}return Ro.Success},this.dispatchFromCorePlugin=(e,t)=>{const i={...t,type:e},o=this.status;this.status=2;const n=this.isReplayingCommand?[this.range,...this.corePlugins,...this.coreViewsPlugins]:this.handlers;return this.dispatchToHandlers(n,i),this.status=o,Ro.Success},o=kf(e,o);const r=Ff(e,s);this.state=new hS,this.uuidGenerator=n,this.config=this.setupConfig(i),this.session=this.setupSession(r.revisionId),this.history=new aS(this.dispatchFromCorePlugin,this.session),this.coreGetters={},this.range=new Av(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getSelectionRangeString=this.range.getSelectionRangeString.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode,canUndo:this.history.canUndo.bind(this.history),canRedo:this.history.canRedo.bind(this.history),getClient:this.session.getClient.bind(this.session),getConnectedClients:this.session.getConnectedClients.bind(this.session),isFullySynchronized:this.session.isFullySynchronized.bind(this.session)},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new cS(this.getters),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of Ib.getAll())this.setupCorePlugin(e,r);Object.assign(this.getters,this.coreGetters);for(let e of Tb.getAll())this.statefulUIPlugins.push(this.setupUiPlugin(e));for(let e of Ab.getAll())this.coreViewsPlugins.push(this.setupUiPlugin(e));for(let e of Rb.getAll())this.featurePlugins.push(this.setupUiPlugin(e));this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.session.loadInitialMessages(o),this.joinSession(),i.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}get handlers(){return[this.range,...this.corePlugins,...this.allUIPlugins,this.history]}get allUIPlugins(){return[...this.statefulUIPlugins,...this.coreViewsPlugins,...this.featurePlugins]}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave()}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let i of e.getters){if(!(i in t))throw new Error(`Invalid getter name: ${i} for plugin ${t.constructor}`);if(i in this.getters)throw new Error(`Getter "${i}" is already defined.`);this.getters[i]=t[i].bind(t)}const i=e.layers.map((e=>[t,e]));return this.renderers.push(...i),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const i=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in i))throw new Error(`Invalid getter name: ${t} for plugin ${i.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=i[t].bind(i)}i.import(t),this.corePlugins.push(i)}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 sb(sS(e,this.state.recordChanges.bind(this.state),(e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers([this.range,...this.corePlugins,...this.coreViewsPlugins],e),this.isReplayingCommand=!1)})),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-redone",this,this.finalize),this.session.on("revision-undone",this,this.finalize),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:s("Anonymous").toString()},i=e.transportService||new Yb;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:e.external||{},transportService:i,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),lazyEvaluation:!("lazyEvaluation"in e)||e.lazyEvaluation}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,lazyEvaluation:this.config.lazyEvaluation}}checkDispatchAllowed(e){const t=this.handlers.map((t=>t.allowDispatch(e)));return new Ro(t.flat())}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}dispatchToHandlers(e,t){t=Ne(t);for(const i of e)i.beforeHandle(t);for(const i of e)i.handle(t)}drawGrid(e){for(let[t,i]of this.renderers)e.ctx.save(),t.drawGrid(e,i),e.ctx.restore()}exportData(){let e=Uf();for(let t of this.handlers)t instanceof Bf&&t.export(e);return e.revisionId=this.session.getRevisionId()||K,e=JSON.parse(JSON.stringify(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={...Uf(),sheets:[Vf(_f,"Sheet1")]};for(let t of this.handlers)t instanceof zf&&t.exportForExcel(e);return e=JSON.parse(JSON.stringify(e)),ZS(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Mn,e.Revision=ob,e.SPREADSHEET_DIMENSIONS=KS,e.Spreadsheet=Xb,e.UIPlugin=Ov,e.__info__=YS,e.addFunction=function(e,t){iu.add(e,t)},e.astToFormula=sv,e.compile=uv,e.components=tC,e.convertAstNodes=nv,e.coreTypes=xo,e.findCellInNewZone=Ki,e.functionCache=dv,e.helpers=JS,e.invalidateEvaluationCommands=Eo,e.links=eC,e.load=Ff,e.parse=iv,e.readonlyAllowedCommands=yo,e.registries=QS,e.setTranslationMethod=function(e){i=e},e.tokenize=uf,Object.defineProperty(e,"__esModule",{value:!0}),YS.version="16.2.0-alpha.1",YS.date="2023-03-01T07:42:43.501Z",YS.hash="162451a"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2410
+ `}var XS;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(XS||(XS={}));const YS={},KS={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:O,HEADER_WIDTH:N,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:_,DEFAULT_CELL_HEIGHT:F,SCROLLBAR_WIDTH:D},QS={autofillModifiersRegistry:Lu,autofillRulesRegistry:Pu,cellMenuRegistry:Ps,colMenuRegistry:Us,linkMenuRegistry:Ku,functionRegistry:iu,featurePluginRegistry:Rb,statefulUIPluginRegistry:Tb,coreViewsPluginRegistry:Ab,corePluginRegistry:Ib,rowMenuRegistry:Vs,sidePanelRegistry:Lg,figureRegistry:og,chartSidePanelComponentRegistry:Tg,chartComponentRegistry:Nn,chartRegistry:On,topbarMenuRegistry:ag,topbarComponentRegistry:Pg,clickableCellRegistry:Mb,otRegistry:cg,inverseCommandRegistry:ng,urlRegistry:Eu,cellPopoverRegistry:eg},JS={arg:Zs,toBoolean:or,toJsDate:nr,toNumber:Qs,toString:er,toXC:Vt,toZone:_i,toCartesian:Ut,numberToLetters:Lt,UuidGenerator:Oi,formatValue:li,computeTextWidth:Le,createEmptyWorkbookData:Uf,createEmptySheet:Pf,createEmptyExcelSheet:Vf,getDefaultChartJsRuntime:on,chartFontColor:zo,ChartColors:Vo,EvaluationError:c,CellErrorLevel:l,getFillingMode:an,rgbaToHex:Et,colorToRGBA:wt,positionToZone:Ji,isDefined:et,lazy:nt},eC={isMarkdownLink:qe,parseMarkdownLink:Xe,markdownLink:je,openLink:Ru,urlRepresentation:Iu},tC={ChartPanel:Ag,ChartFigure:Xn,ChartJsComponent:oo,Grid:op,GridOverlay:Bg,ScorecardChart:go,LineConfigPanel:yg,LineBarPieDesignPanel:Sg,BarConfigPanel:gg,LineBarPieConfigPanel:ug,GaugeChartConfigPanel:Eg,GaugeChartDesignPanel:wg,ScorecardChartConfigPanel:Ig,ScorecardChartDesignPanel:Rg};e.AbstractChart=vo,e.CorePlugin=Bf,e.DATETIME_FORMAT=X,e.DispatchResult=Ro,e.EvaluationError=c,e.Model=class extends Yv{constructor(e={},i={},o=[],n=new Oi,s=!0){super(),this.corePlugins=[],this.featurePlugins=[],this.statefulUIPlugins=[],this.coreViewsPlugins=[],this.isReplayingCommand=!1,this.renderers=[],this.status=0,this.dispatch=(e,t)=>{const i={...t,type:e};let o=this.status;if(this.getters.isReadonly()&&(n=i,!yo.has(n.type)))return new Ro(67);var n;if(!this.session.canApplyOptimisticUpdate())return new Ro(64);switch(o){case 0:const t=this.checkDispatchAllowed(i);if(!t.isSuccessful)return t;this.status=1;const{changes:o,commands:n}=this.state.recordChanges((()=>{Io(i)&&this.state.addCommand(i),this.dispatchToHandlers(this.handlers,i),this.finalize()}));this.session.save(n,o),this.status=0,this.trigger("update");break;case 1:if(Io(i)){const e=this.checkDispatchAllowed(i);if(!e.isSuccessful)return e;this.state.addCommand(i)}this.dispatchToHandlers(this.handlers,i);break;case 3:throw new Error("Cannot dispatch commands in the finalize state");case 2:if(Io(i))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,i)}return Ro.Success},this.dispatchFromCorePlugin=(e,t)=>{const i={...t,type:e},o=this.status;this.status=2;const n=this.isReplayingCommand?[this.range,...this.corePlugins,...this.coreViewsPlugins]:this.handlers;return this.dispatchToHandlers(n,i),this.status=o,Ro.Success},o=kf(e,o);const r=Ff(e,s);this.state=new hS,this.uuidGenerator=n,this.config=this.setupConfig(i),this.session=this.setupSession(r.revisionId),this.history=new aS(this.dispatchFromCorePlugin,this.session),this.coreGetters={},this.range=new Av(this.coreGetters),this.coreGetters.getRangeString=this.range.getRangeString.bind(this.range),this.coreGetters.getRangeFromSheetXC=this.range.getRangeFromSheetXC.bind(this.range),this.coreGetters.createAdaptedRanges=this.range.createAdaptedRanges.bind(this.range),this.coreGetters.getRangeDataFromXc=this.range.getRangeDataFromXc.bind(this.range),this.coreGetters.getRangeDataFromZone=this.range.getRangeDataFromZone.bind(this.range),this.coreGetters.getRangeFromRangeData=this.range.getRangeFromRangeData.bind(this.range),this.coreGetters.getSelectionRangeString=this.range.getSelectionRangeString.bind(this.range),this.getters={isReadonly:()=>"readonly"===this.config.mode||"dashboard"===this.config.mode,isDashboard:()=>"dashboard"===this.config.mode,canUndo:this.history.canUndo.bind(this.history),canRedo:this.history.canRedo.bind(this.history),getClient:this.session.getClient.bind(this.session),getConnectedClients:this.session.getConnectedClients.bind(this.session),isFullySynchronized:this.session.isFullySynchronized.bind(this.session)},this.uuidGenerator.setIsFastStrategy(!0),this.selection=new cS(this.getters),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of Ib.getAll())this.setupCorePlugin(e,r);Object.assign(this.getters,this.coreGetters);for(let e of Tb.getAll())this.statefulUIPlugins.push(this.setupUiPlugin(e));for(let e of Ab.getAll())this.coreViewsPlugins.push(this.setupUiPlugin(e));for(let e of Rb.getAll())this.featurePlugins.push(this.setupUiPlugin(e));this.uuidGenerator.setIsFastStrategy(!1),this.dispatch("START"),this.selection.observe(this,{handleEvent:()=>this.trigger("update")}),this.setupSessionEvents(),this.session.loadInitialMessages(o),this.joinSession(),i.snapshotRequested&&(this.session.snapshot(this.exportData()),this.garbageCollectExternalResources()),t.markRaw(this)}get handlers(){return[this.range,...this.corePlugins,...this.allUIPlugins,this.history]}get allUIPlugins(){return[...this.statefulUIPlugins,...this.coreViewsPlugins,...this.featurePlugins]}joinSession(){this.session.join(this.config.client)}leaveSession(){this.session.leave()}setupUiPlugin(e){const t=new e(this.uiPluginConfig);for(let i of e.getters){if(!(i in t))throw new Error(`Invalid getter name: ${i} for plugin ${t.constructor}`);if(i in this.getters)throw new Error(`Getter "${i}" is already defined.`);this.getters[i]=t[i].bind(t)}const i=e.layers.map((e=>[t,e]));return this.renderers.push(...i),this.renderers.sort(((e,t)=>e[1]-t[1])),t}setupCorePlugin(e,t){const i=new e(this.corePluginConfig);for(let t of e.getters){if(!(t in i))throw new Error(`Invalid getter name: ${t} for plugin ${i.constructor}`);if(t in this.coreGetters)throw new Error(`Getter "${t}" is already defined.`);this.coreGetters[t]=i[t].bind(i)}i.import(t),this.corePlugins.push(i)}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 sb(sS(e,this.state.recordChanges.bind(this.state),(e=>{this.checkDispatchAllowed(e).isSuccessful&&(this.isReplayingCommand=!0,this.dispatchToHandlers([this.range,...this.corePlugins,...this.coreViewsPlugins],e),this.isReplayingCommand=!1)})),this.config.transportService,e)}setupSessionEvents(){this.session.on("remote-revision-received",this,this.onRemoteRevisionReceived),this.session.on("revision-redone",this,this.finalize),this.session.on("revision-undone",this,this.finalize),this.session.on("unexpected-revision-id",this,(()=>this.trigger("unexpected-revision-id"))),this.session.on("collaborative-event-received",this,(()=>{this.trigger("update")}))}setupConfig(e){const t=e.client||{id:this.uuidGenerator.uuidv4(),name:s("Anonymous").toString()},i=e.transportService||new Yb;return{...e,mode:e.mode||"normal",custom:e.custom||{},external:e.external||{},transportService:i,client:t,moveClient:()=>{},snapshotRequested:!1,notifyUI:e=>this.trigger("notify-ui",e),lazyEvaluation:!("lazyEvaluation"in e)||e.lazyEvaluation}}setupCorePluginConfig(){return{getters:this.coreGetters,stateObserver:this.state,range:this.range,dispatch:this.dispatchFromCorePlugin,uuidGenerator:this.uuidGenerator,custom:this.config.custom,external:this.config.external}}setupUiPluginConfig(){return{getters:this.getters,stateObserver:this.state,dispatch:this.dispatch,selection:this.selection,moveClient:this.session.move.bind(this.session),custom:this.config.custom,uiActions:this.config,lazyEvaluation:this.config.lazyEvaluation}}checkDispatchAllowed(e){const t=this.handlers.map((t=>t.allowDispatch(e)));return new Ro(t.flat())}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}dispatchToHandlers(e,t){t=Ne(t);for(const i of e)i.beforeHandle(t);for(const i of e)i.handle(t)}drawGrid(e){for(let[t,i]of this.renderers)e.ctx.save(),t.drawGrid(e,i),e.ctx.restore()}exportData(){let e=Uf();for(let t of this.handlers)t instanceof Bf&&t.export(e);return e.revisionId=this.session.getRevisionId()||K,e=JSON.parse(JSON.stringify(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={...Uf(),sheets:[Vf(_f,"Sheet1")]};for(let t of this.handlers)t instanceof zf&&t.exportForExcel(e);return e=JSON.parse(JSON.stringify(e)),ZS(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Mn,e.Revision=ob,e.SPREADSHEET_DIMENSIONS=KS,e.Spreadsheet=Xb,e.UIPlugin=Ov,e.__info__=YS,e.addFunction=function(e,t){iu.add(e,t)},e.astToFormula=sv,e.compile=uv,e.components=tC,e.convertAstNodes=nv,e.coreTypes=xo,e.findCellInNewZone=Ki,e.functionCache=dv,e.helpers=JS,e.invalidateEvaluationCommands=Eo,e.links=eC,e.load=Ff,e.parse=iv,e.readonlyAllowedCommands=yo,e.registries=QS,e.setTranslationMethod=function(e){i=e},e.tokenize=uf,Object.defineProperty(e,"__esModule",{value:!0}),YS.version="16.2.0-alpha.2",YS.date="2023-03-01T14:43:49.348Z",YS.hash="eb626ad"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "16.2.0-alpha.1",
3
+ "version": "16.2.0-alpha.2",
4
4
  "description": "A spreadsheet component",
5
5
  "main": "dist/o-spreadsheet.cjs.js",
6
6
  "browser": "dist/o-spreadsheet.iife.js",
@@ -11,20 +11,20 @@
11
11
  "dist/*.d.ts"
12
12
  ],
13
13
  "scripts": {
14
- "serve-static": "live-server --open=demo --watch=dist/o_spreadsheet.js,dist/o_spreadsheet.xml,demo",
14
+ "serve-static": "live-server --open=demo --watch=build/o_spreadsheet.js,build/o_spreadsheet.xml,demo",
15
15
  "dev": "npm-run-all build --parallel server serve-static watch:*",
16
16
  "server": "node tools/server/main.js",
17
17
  "build:js": "tsc --module es6 --incremental",
18
18
  "bundle:js": "rollup -c -m dev",
19
19
  "bundle:xml": "node tools/bundle_xml/main.js",
20
- "build": "npm-run-all build:js bundle:*",
20
+ "build": "npm-run-all build:js bundle:js 'bundle:xml -- --outDir build'",
21
21
  "doc": "typedoc",
22
22
  "precommit": "npm run prettier && npm run doc",
23
23
  "test": "jest",
24
24
  "test:watch": "jest --watch",
25
25
  "prettier": "prettier . --write",
26
26
  "check-formatting": "prettier . --check",
27
- "dist": "tsc --module es6 --declaration --declarationDir dist/types && rollup -c && npm run bundle:xml",
27
+ "dist": "tsc --module es6 --declaration --declarationDir dist/types && rollup -c && npm run bundle:xml -- --outDir dist",
28
28
  "prepare": "husky install",
29
29
  "watch:bundle": "npm run bundle:js -- --watch",
30
30
  "watch:ts": "npm run build:js -- --watch",
@@ -130,5 +130,8 @@
130
130
  },
131
131
  "lint-staged": {
132
132
  "*": "prettier --write"
133
+ },
134
+ "publishConfig": {
135
+ "tag": "alpha"
133
136
  }
134
137
  }