@odoo/o-spreadsheet 16.1.1 → 16.1.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.
@@ -20518,7 +20518,6 @@ class ChartPanel extends owl.Component {
20518
20518
  ...this.getChartDefinition(),
20519
20519
  ...updateDefinition,
20520
20520
  };
20521
- // TODORAR add a putain de test - c'est faux de nouveau ...
20522
20521
  return this.env.model.dispatch("UPDATE_CHART", {
20523
20522
  definition,
20524
20523
  id: this.figureId,
@@ -20531,7 +20530,6 @@ class ChartPanel extends owl.Component {
20531
20530
  throw new Error("Chart not defined.");
20532
20531
  }
20533
20532
  const definition = getChartDefinitionFromContextCreation(context, type);
20534
- // TODORAR add a putain de test - c'est faux de nouveau ...
20535
20533
  this.env.model.dispatch("UPDATE_CHART", {
20536
20534
  definition,
20537
20535
  id: this.figureId,
@@ -28569,9 +28567,6 @@ class ChartPlugin extends CorePlugin {
28569
28567
  return figureId in (this.charts[sheetId] || {});
28570
28568
  }
28571
28569
  getChartIds(sheetId) {
28572
- // TODORAR refaire ce shit truc
28573
- // on veut un truc du genre Object.keys(this.charts[sheetId] || {} a mon avis
28574
- // return (Object.values(this.charts[sheetId] || {}).filter(isDefined) as AbstractChart[]).map((chart) => chart.id);
28575
28570
  return Object.keys(this.charts[sheetId] || {});
28576
28571
  }
28577
28572
  getChartDefinition(sheetId, figureId) {
@@ -43853,6 +43848,6 @@ exports.setTranslationMethod = setTranslationMethod;
43853
43848
  exports.tokenize = tokenize;
43854
43849
 
43855
43850
 
43856
- __info__.version = '16.1.1';
43857
- __info__.date = '2023-02-28T09:39:22.910Z';
43858
- __info__.hash = '943d80d';
43851
+ __info__.version = '16.1.2';
43852
+ __info__.date = '2023-03-01T14:43:45.667Z';
43853
+ __info__.hash = '59bec2d';
@@ -20514,7 +20514,6 @@ class ChartPanel extends Component {
20514
20514
  ...this.getChartDefinition(),
20515
20515
  ...updateDefinition,
20516
20516
  };
20517
- // TODORAR add a putain de test - c'est faux de nouveau ...
20518
20517
  return this.env.model.dispatch("UPDATE_CHART", {
20519
20518
  definition,
20520
20519
  id: this.figureId,
@@ -20527,7 +20526,6 @@ class ChartPanel extends Component {
20527
20526
  throw new Error("Chart not defined.");
20528
20527
  }
20529
20528
  const definition = getChartDefinitionFromContextCreation(context, type);
20530
- // TODORAR add a putain de test - c'est faux de nouveau ...
20531
20529
  this.env.model.dispatch("UPDATE_CHART", {
20532
20530
  definition,
20533
20531
  id: this.figureId,
@@ -28565,9 +28563,6 @@ class ChartPlugin extends CorePlugin {
28565
28563
  return figureId in (this.charts[sheetId] || {});
28566
28564
  }
28567
28565
  getChartIds(sheetId) {
28568
- // TODORAR refaire ce shit truc
28569
- // on veut un truc du genre Object.keys(this.charts[sheetId] || {} a mon avis
28570
- // return (Object.values(this.charts[sheetId] || {}).filter(isDefined) as AbstractChart[]).map((chart) => chart.id);
28571
28566
  return Object.keys(this.charts[sheetId] || {});
28572
28567
  }
28573
28568
  getChartDefinition(sheetId, figureId) {
@@ -43821,6 +43816,6 @@ function addFunction(functionName, functionDescription) {
43821
43816
  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 };
43822
43817
 
43823
43818
 
43824
- __info__.version = '16.1.1';
43825
- __info__.date = '2023-02-28T09:39:22.910Z';
43826
- __info__.hash = '943d80d';
43819
+ __info__.version = '16.1.2';
43820
+ __info__.date = '2023-03-01T14:43:45.667Z';
43821
+ __info__.hash = '59bec2d';
@@ -20515,7 +20515,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20515
20515
  ...this.getChartDefinition(),
20516
20516
  ...updateDefinition,
20517
20517
  };
20518
- // TODORAR add a putain de test - c'est faux de nouveau ...
20519
20518
  return this.env.model.dispatch("UPDATE_CHART", {
20520
20519
  definition,
20521
20520
  id: this.figureId,
@@ -20528,7 +20527,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
20528
20527
  throw new Error("Chart not defined.");
20529
20528
  }
20530
20529
  const definition = getChartDefinitionFromContextCreation(context, type);
20531
- // TODORAR add a putain de test - c'est faux de nouveau ...
20532
20530
  this.env.model.dispatch("UPDATE_CHART", {
20533
20531
  definition,
20534
20532
  id: this.figureId,
@@ -28566,9 +28564,6 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
28566
28564
  return figureId in (this.charts[sheetId] || {});
28567
28565
  }
28568
28566
  getChartIds(sheetId) {
28569
- // TODORAR refaire ce shit truc
28570
- // on veut un truc du genre Object.keys(this.charts[sheetId] || {} a mon avis
28571
- // return (Object.values(this.charts[sheetId] || {}).filter(isDefined) as AbstractChart[]).map((chart) => chart.id);
28572
28567
  return Object.keys(this.charts[sheetId] || {});
28573
28568
  }
28574
28569
  getChartDefinition(sheetId, figureId) {
@@ -43852,9 +43847,9 @@ day_count_convention (number, default=${DEFAULT_DAY_COUNT_CONVENTION} ) ${_lt("A
43852
43847
  Object.defineProperty(exports, '__esModule', { value: true });
43853
43848
 
43854
43849
 
43855
- __info__.version = '16.1.1';
43856
- __info__.date = '2023-02-28T09:39:22.910Z';
43857
- __info__.hash = '943d80d';
43850
+ __info__.version = '16.1.2';
43851
+ __info__.date = '2023-03-01T14:43:45.667Z';
43852
+ __info__.hash = '59bec2d';
43858
43853
 
43859
43854
 
43860
43855
  })(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
@@ -2451,4 +2451,4 @@
2451
2451
  <tableParts count="${e.filterTables.length}">
2452
2452
  ${Of(a)}
2453
2453
  </tableParts>
2454
- `}var RS;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(RS||(RS={}));const TS={},AS={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:O,HEADER_WIDTH:M,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:N,DEFAULT_CELL_HEIGHT:_,SCROLLBAR_WIDTH:F},OS={autofillModifiersRegistry:xg,autofillRulesRegistry:Ig,cellMenuRegistry:Tr,colMenuRegistry:Ar,linkMenuRegistry:Dg,functionRegistry:qd,featurePluginRegistry:ub,statefulUIPluginRegistry:gb,coreViewsPluginRegistry:pb,corePluginRegistry:db,rowMenuRegistry:Or,sidePanelRegistry:Sp,figureRegistry:Vg,sheetMenuRegistry:Wg,chartSidePanelComponentRegistry:hp,chartComponentRegistry:wn,chartRegistry:En,topbarMenuRegistry:qg,topbarComponentRegistry:Cp,clickableCellRegistry:mb,otRegistry:Zg,inverseCommandRegistry:zg,urlRegistry:cg,cellPopoverRegistry:Pg},MS={args:Pr,toBoolean:jr,toJsDate:Xr,toNumber:Hr,toString:Gr,toXC:Ft,toZone:Io,toCartesian:_t,numberToLetters:Mt,createFullMenuItem:xn,UuidGenerator:yo,formatValue:oo,computeTextWidth:ke,createEmptyWorkbookData:tv,createEmptySheet:ev,createEmptyExcelSheet:ov,getDefaultChartJsRuntime:ji,chartFontColor:_i,getMenuChildren:On,ChartColors:Ni,EvaluationError:c,CellErrorLevel:l,getFillingMode:Ki,rgbaToHex:mt,colorToRGBA:ft,positionToZone:qo,isDefined:Qe},NS={isMarkdownLink:We,parseMarkdownLink:Ze,markdownLink:qe,openLink:pg,urlRepresentation:gg},_S={ChartPanel:dp,ChartFigure:Un,ChartJsComponent:Yo,Grid:Vp,GridOverlay:xp,ScorecardChart:ri,LineConfigPanel:sp,LineBarPieDesignPanel:op,BarConfigPanel:Kg,LineBarPieConfigPanel:Yg,GaugeChartConfigPanel:np,GaugeChartDesignPanel:rp,ScorecardChartConfigPanel:lp,ScorecardChartDesignPanel:cp};e.AbstractChart=ci,e.CorePlugin=iv,e.DATETIME_FORMAT=j,e.DispatchResult=bi,e.EvaluationError=c,e.Model=class extends zv{constructor(e={},o={},i=[],n=new yo,r=!0){super(),this.corePlugins=[],this.featurePlugins=[],this.statefulUIPlugins=[],this.coreViewsPlugins=[],this.isReplayingCommand=!1,this.renderers=[],this.status=0,this.dispatch=(e,t)=>{const o={...t,type:e};let i=this.status;if(this.getters.isReadonly()&&(n=o,!mi.has(n.type)))return new bi(67);var n;if(!this.session.canApplyOptimisticUpdate())return new bi(64);switch(i){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:i,commands:n}=this.state.recordChanges((()=>{vi(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(n,i),this.status=0,this.trigger("update");break;case 1:if(vi(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(vi(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return bi.Success},this.dispatchFromCorePlugin=(e,t)=>{const o={...t,type:e},i=this.status;this.status=2;const n=this.isReplayingCommand?[this.range,...this.corePlugins,...this.coreViewsPlugins]:this.handlers;return this.dispatchToHandlers(n,o),this.status=i,bi.Success},i=Qf(e,i);const s=Yf(e,r);this.state=new zb,this.uuidGenerator=n,this.config=this.setupConfig(o),this.session=this.setupSession(s.revisionId),this.history=new Lb(this.dispatchFromCorePlugin,this.session),this.coreGetters={},this.range=new Cv(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 Vb(this.getters),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of db.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters);for(let e of gb.getAll())this.statefulUIPlugins.push(this.setupUiPlugin(e));for(let e of pb.getAll())this.coreViewsPlugins.push(this.setupUiPlugin(e));for(let e of ub.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(i),this.joinSession(),o.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 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)}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 Yv($b(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:r("Anonymous").toString()},o=e.transportService||new Tb;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}}checkDispatchAllowed(e){const t=this.handlers.map((t=>t.allowDispatch(e)));return new bi(t.flat())}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}dispatchToHandlers(e,t){t=Me(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=tv();for(let t of this.handlers)t instanceof iv&&t.export(e);return e.revisionId=this.session.getRevisionId()||Y,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={...tv(),sheets:[ov(Xf,"Sheet1")]};for(let t of this.handlers)t instanceof Vu&&t.exportForExcel(e);return e=JSON.parse(JSON.stringify(e)),xS(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Cn,e.Revision=jv,e.SPREADSHEET_DIMENSIONS=AS,e.Spreadsheet=Rb,e.UIPlugin=zu,e.__info__=TS,e.addFunction=function(e,t){qd.add(e,t)},e.astToFormula=Eu,e.compile=ku,e.components=_S,e.convertAstNodes=Cu,e.coreTypes=fi,e.findCellInNewZone=Wo,e.functionCache=Du,e.helpers=MS,e.invalidateEvaluationCommands=gi,e.links=NS,e.load=Yf,e.parse=bu,e.readonlyAllowedCommands=mi,e.registries=OS,e.setTranslationMethod=function(e){o=e},e.tokenize=Yd,Object.defineProperty(e,"__esModule",{value:!0}),TS.version="16.1.1",TS.date="2023-02-28T09:39:22.910Z",TS.hash="943d80d"}(this.o_spreadsheet=this.o_spreadsheet||{},owl);
2454
+ `}var RS;!function(e){e[e.Ready=0]="Ready",e[e.Running=1]="Running",e[e.RunningCore=2]="RunningCore",e[e.Finalizing=3]="Finalizing"}(RS||(RS={}));const TS={},AS={MIN_ROW_HEIGHT:10,MIN_COL_WIDTH:5,HEADER_HEIGHT:O,HEADER_WIDTH:M,TOPBAR_HEIGHT:63,BOTTOMBAR_HEIGHT:36,DEFAULT_CELL_WIDTH:N,DEFAULT_CELL_HEIGHT:_,SCROLLBAR_WIDTH:F},OS={autofillModifiersRegistry:xg,autofillRulesRegistry:Ig,cellMenuRegistry:Tr,colMenuRegistry:Ar,linkMenuRegistry:Dg,functionRegistry:qd,featurePluginRegistry:ub,statefulUIPluginRegistry:gb,coreViewsPluginRegistry:pb,corePluginRegistry:db,rowMenuRegistry:Or,sidePanelRegistry:Sp,figureRegistry:Vg,sheetMenuRegistry:Wg,chartSidePanelComponentRegistry:hp,chartComponentRegistry:wn,chartRegistry:En,topbarMenuRegistry:qg,topbarComponentRegistry:Cp,clickableCellRegistry:mb,otRegistry:Zg,inverseCommandRegistry:zg,urlRegistry:cg,cellPopoverRegistry:Pg},MS={args:Pr,toBoolean:jr,toJsDate:Xr,toNumber:Hr,toString:Gr,toXC:Ft,toZone:Io,toCartesian:_t,numberToLetters:Mt,createFullMenuItem:xn,UuidGenerator:yo,formatValue:oo,computeTextWidth:ke,createEmptyWorkbookData:tv,createEmptySheet:ev,createEmptyExcelSheet:ov,getDefaultChartJsRuntime:ji,chartFontColor:_i,getMenuChildren:On,ChartColors:Ni,EvaluationError:c,CellErrorLevel:l,getFillingMode:Ki,rgbaToHex:mt,colorToRGBA:ft,positionToZone:qo,isDefined:Qe},NS={isMarkdownLink:We,parseMarkdownLink:Ze,markdownLink:qe,openLink:pg,urlRepresentation:gg},_S={ChartPanel:dp,ChartFigure:Un,ChartJsComponent:Yo,Grid:Vp,GridOverlay:xp,ScorecardChart:ri,LineConfigPanel:sp,LineBarPieDesignPanel:op,BarConfigPanel:Kg,LineBarPieConfigPanel:Yg,GaugeChartConfigPanel:np,GaugeChartDesignPanel:rp,ScorecardChartConfigPanel:lp,ScorecardChartDesignPanel:cp};e.AbstractChart=ci,e.CorePlugin=iv,e.DATETIME_FORMAT=j,e.DispatchResult=bi,e.EvaluationError=c,e.Model=class extends zv{constructor(e={},o={},i=[],n=new yo,r=!0){super(),this.corePlugins=[],this.featurePlugins=[],this.statefulUIPlugins=[],this.coreViewsPlugins=[],this.isReplayingCommand=!1,this.renderers=[],this.status=0,this.dispatch=(e,t)=>{const o={...t,type:e};let i=this.status;if(this.getters.isReadonly()&&(n=o,!mi.has(n.type)))return new bi(67);var n;if(!this.session.canApplyOptimisticUpdate())return new bi(64);switch(i){case 0:const t=this.checkDispatchAllowed(o);if(!t.isSuccessful)return t;this.status=1;const{changes:i,commands:n}=this.state.recordChanges((()=>{vi(o)&&this.state.addCommand(o),this.dispatchToHandlers(this.handlers,o),this.finalize()}));this.session.save(n,i),this.status=0,this.trigger("update");break;case 1:if(vi(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(vi(o))throw new Error(`A UI plugin cannot dispatch ${e} while handling a core command`);this.dispatchToHandlers(this.handlers,o)}return bi.Success},this.dispatchFromCorePlugin=(e,t)=>{const o={...t,type:e},i=this.status;this.status=2;const n=this.isReplayingCommand?[this.range,...this.corePlugins,...this.coreViewsPlugins]:this.handlers;return this.dispatchToHandlers(n,o),this.status=i,bi.Success},i=Qf(e,i);const s=Yf(e,r);this.state=new zb,this.uuidGenerator=n,this.config=this.setupConfig(o),this.session=this.setupSession(s.revisionId),this.history=new Lb(this.dispatchFromCorePlugin,this.session),this.coreGetters={},this.range=new Cv(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 Vb(this.getters),this.corePluginConfig=this.setupCorePluginConfig(),this.uiPluginConfig=this.setupUiPluginConfig();for(let e of db.getAll())this.setupCorePlugin(e,s);Object.assign(this.getters,this.coreGetters);for(let e of gb.getAll())this.statefulUIPlugins.push(this.setupUiPlugin(e));for(let e of pb.getAll())this.coreViewsPlugins.push(this.setupUiPlugin(e));for(let e of ub.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(i),this.joinSession(),o.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 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)}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 Yv($b(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:r("Anonymous").toString()},o=e.transportService||new Tb;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}}checkDispatchAllowed(e){const t=this.handlers.map((t=>t.allowDispatch(e)));return new bi(t.flat())}finalize(){this.status=3;for(const e of this.handlers)e.finalize();this.status=0}dispatchToHandlers(e,t){t=Me(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=tv();for(let t of this.handlers)t instanceof iv&&t.export(e);return e.revisionId=this.session.getRevisionId()||Y,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={...tv(),sheets:[ov(Xf,"Sheet1")]};for(let t of this.handlers)t instanceof Vu&&t.exportForExcel(e);return e=JSON.parse(JSON.stringify(e)),xS(e)}garbageCollectExternalResources(){for(const e of this.corePlugins)e.garbageCollectExternalResources()}},e.Registry=Cn,e.Revision=jv,e.SPREADSHEET_DIMENSIONS=AS,e.Spreadsheet=Rb,e.UIPlugin=zu,e.__info__=TS,e.addFunction=function(e,t){qd.add(e,t)},e.astToFormula=Eu,e.compile=ku,e.components=_S,e.convertAstNodes=Cu,e.coreTypes=fi,e.findCellInNewZone=Wo,e.functionCache=Du,e.helpers=MS,e.invalidateEvaluationCommands=gi,e.links=NS,e.load=Yf,e.parse=bu,e.readonlyAllowedCommands=mi,e.registries=OS,e.setTranslationMethod=function(e){o=e},e.tokenize=Yd,Object.defineProperty(e,"__esModule",{value:!0}),TS.version="16.1.2",TS.date="2023-03-01T14:43:45.667Z",TS.hash="59bec2d"}(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.1.1",
3
+ "version": "16.1.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": "latest"
133
136
  }
134
137
  }