@odoo/o-spreadsheet 17.2.0-alpha.2 → 17.2.0-alpha.4

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.
@@ -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.2.0-alpha.2
5
- @date 2024-01-29T13:56:33.355Z
6
- @hash 03c1335
4
+ @version 17.2.0-alpha.4
5
+ @date 2024-02-09T13:11:01.066Z
6
+ @hash 1b33cf4
7
7
  -->
8
8
  <odoo>
9
9
  <t t-name="o-spreadsheet-ActionButton">
@@ -467,7 +467,7 @@
467
467
  t-on-mousedown="onMousedown"
468
468
  t-on-click="onClick"
469
469
  t-on-keyup="onKeyup"
470
- t-on-paste.stop=""
470
+ t-on-paste="onPaste"
471
471
  t-on-compositionstart="onCompositionStart"
472
472
  t-on-compositionend="onCompositionEnd"
473
473
  t-on-dblclick="onDblClick"
@@ -565,14 +565,7 @@
565
565
  t-esc="cellReference"
566
566
  />
567
567
  <div class="o-grid-composer" t-att-style="containerStyle" t-ref="gridComposer">
568
- <Composer
569
- focus="props.focus"
570
- inputStyle="composerStyle"
571
- rect="composerState.rect"
572
- delimitation="composerState.delimitation"
573
- onComposerUnmounted="props.onComposerUnmounted"
574
- onComposerContentFocused="props.onComposerContentFocused"
575
- />
568
+ <Composer t-props="composerProps"/>
576
569
  </div>
577
570
  </t>
578
571
 
@@ -581,11 +574,7 @@
581
574
  class="o-topbar-composer bg-white user-select-text"
582
575
  t-on-click.stop=""
583
576
  t-att-style="containerStyle">
584
- <Composer
585
- focus="props.focus"
586
- inputStyle="composerStyle"
587
- onComposerContentFocused="props.onComposerContentFocused"
588
- />
577
+ <Composer focus="focus" inputStyle="composerStyle" onComposerContentFocused.bind="onFocus"/>
589
578
  </div>
590
579
  </t>
591
580
 
@@ -604,7 +593,6 @@
604
593
  />
605
594
  <canvas t-ref="canvas"/>
606
595
  <GridPopover
607
- hoveredCell="hoveredCell"
608
596
  gridRect="getGridRect()"
609
597
  onMouseWheel.bind="onMouseWheel"
610
598
  onClosePopover.bind="onClosePopover"
@@ -953,9 +941,10 @@
953
941
  <div
954
942
  class="o-grid w-100 h-100"
955
943
  tabindex="-1"
956
- t-on-click="focus"
944
+ t-on-click="focusDefaultElement"
957
945
  t-on-keydown="onKeydown"
958
946
  t-on-wheel="onMouseWheel"
947
+ t-on-contextmenu="onInputContextMenu"
959
948
  t-ref="grid">
960
949
  <GridOverlay
961
950
  onCellClicked.bind="onCellClicked"
@@ -965,27 +954,10 @@
965
954
  onGridResized.bind="onGridResized"
966
955
  onGridMoved.bind="moveCanvas"
967
956
  gridOverlayDimensions="gridOverlayDimensions"
968
- onFigureDeleted.bind="focus"
957
+ onFigureDeleted.bind="focusDefaultElement"
969
958
  />
970
959
  <HeadersOverlay onOpenContextMenu="(type, x, y) => this.toggleContextMenu(type, x, y)"/>
971
-
972
- <t t-if="env.model.getters.getEditionMode() !== 'inactive'">
973
- <GridComposer
974
- onComposerUnmounted="() => this.focus()"
975
- onComposerContentFocused="props.onComposerContentFocused"
976
- focus="props.focusComposer"
977
- gridDims="env.model.getters.getSheetViewDimensionWithHeaders()"
978
- />
979
- </t>
980
- <t else="1">
981
- <input
982
- class="position-absolute"
983
- style="z-index:-1000;"
984
- t-on-input="onInput"
985
- t-on-contextmenu="onInputContextMenu"
986
- t-ref="hiddenInput"
987
- />
988
- </t>
960
+ <GridComposer gridDims="env.model.getters.getSheetViewDimensionWithHeaders()"/>
989
961
  <canvas t-ref="canvas"/>
990
962
  <t
991
963
  t-foreach="env.model.getters.getClientsToDisplay()"
@@ -1001,7 +973,6 @@
1001
973
  </t>
1002
974
  <GridPopover
1003
975
  t-if="!menuState.isOpen"
1004
- hoveredCell="hoveredCell"
1005
976
  gridRect="getGridRect()"
1006
977
  onMouseWheel.bind="onMouseWheel"
1007
978
  onClosePopover.bind="onClosePopover"
@@ -1009,8 +980,9 @@
1009
980
  <t t-if="env.model.getters.isGridSelectionActive()">
1010
981
  <Autofill position="getAutofillPosition()" isVisible="isAutofillVisible"/>
1011
982
  </t>
1012
- <t t-foreach="env.model.getters.getHighlights()" t-as="highlight" t-key="highlight_index">
1013
- <t t-if="highlight.sheetId === env.model.getters.getActiveSheetId()">
983
+ <t t-foreach="highlights" t-as="highlight" t-key="highlight_index">
984
+ <t
985
+ t-if="highlight.interactive and highlight.sheetId === env.model.getters.getActiveSheetId()">
1014
986
  <Highlight zone="highlight.zone" color="highlight.color"/>
1015
987
  </t>
1016
988
  </t>
@@ -1065,7 +1037,7 @@
1065
1037
  t-att-style="style"
1066
1038
  t-on-mousedown="onMouseDown"
1067
1039
  t-on-dblclick.self="onDoubleClick"
1068
- t-on-contextmenu="onContextMenu">
1040
+ t-on-contextmenu.stop.prevent="onContextMenu">
1069
1041
  <FiguresContainer onFigureDeleted="props.onFigureDeleted"/>
1070
1042
  <DataValidationOverlay/>
1071
1043
  <GridAddRowsFooter
@@ -2450,8 +2422,9 @@ https://fontawesome.com/license -->
2450
2422
  <div
2451
2423
  t-att-title="getName(menuItem)"
2452
2424
  t-att-data-name="menuItem.id"
2453
- t-on-click="(ev) => this.onClickMenu(menuItem, menuItem_index, ev)"
2454
- t-on-mouseover="(ev) => this.onMouseOver(menuItem, menuItem_index, ev)"
2425
+ t-on-click="(ev) => this.onClickMenu(menuItem, ev)"
2426
+ t-on-mouseenter="(ev) => this.onMouseEnter(menuItem, ev)"
2427
+ t-on-mouseleave="(ev) => this.onMouseLeave(menuItem)"
2455
2428
  class="o-menu-item d-flex align-items-center"
2456
2429
  t-att-class="{ 'o-menu-root': isMenuRoot, 'disabled': !isMenuEnabled, 'o-menu-item-active': isParentMenu(subMenu, menuItem)}"
2457
2430
  t-att-style="getColor(menuItem)">
@@ -2604,12 +2577,12 @@ https://fontawesome.com/license -->
2604
2577
  />
2605
2578
  </Section>
2606
2579
  <ChartDataSeries
2607
- ranges="() => this.getDataSeriesRanges()"
2580
+ ranges="this.getDataSeriesRanges()"
2608
2581
  onSelectionChanged="(ranges) => this.onDataSeriesRangesChanged(ranges)"
2609
2582
  onSelectionConfirmed="() => this.onDataSeriesConfirmed()"
2610
2583
  />
2611
2584
  <ChartLabelRange
2612
- range="() => this.getLabelRange()"
2585
+ range="this.getLabelRange()"
2613
2586
  isInvalid="isLabelInvalid"
2614
2587
  onSelectionChanged="(ranges) => this.onLabelRangeChanged(ranges)"
2615
2588
  onSelectionConfirmed="() => this.onLabelRangeConfirmed()"
@@ -2683,7 +2656,7 @@ https://fontawesome.com/license -->
2683
2656
  <Section class="'o-data-series'">
2684
2657
  <t t-set-slot="title" t-esc="title"/>
2685
2658
  <SelectionInput
2686
- ranges="() => props.ranges()"
2659
+ ranges="props.ranges"
2687
2660
  required="true"
2688
2661
  hasSingleRange="props.hasSingleRange"
2689
2662
  onSelectionChanged="(ranges) => props.onSelectionChanged(ranges)"
@@ -2702,7 +2675,7 @@ https://fontawesome.com/license -->
2702
2675
  <Section class="'o-data-labels'">
2703
2676
  <t t-set-slot="title" t-esc="props.title"/>
2704
2677
  <SelectionInput
2705
- ranges="() => [props.range()]"
2678
+ ranges="[props.range]"
2706
2679
  isInvalid="props.isInvalid"
2707
2680
  hasSingleRange="true"
2708
2681
  required="props.required"
@@ -2737,7 +2710,7 @@ https://fontawesome.com/license -->
2737
2710
  <t t-name="o-spreadsheet-GaugeChartConfigPanel">
2738
2711
  <div>
2739
2712
  <ChartDataSeries
2740
- ranges="() => [this.getDataRange()]"
2713
+ ranges="[this.getDataRange()]"
2741
2714
  onSelectionChanged="(ranges) => this.onDataRangeChanged(ranges)"
2742
2715
  onSelectionConfirmed="() => this.updateDataRange()"
2743
2716
  hasSingleRange="true"
@@ -2876,12 +2849,12 @@ https://fontawesome.com/license -->
2876
2849
  <t t-name="o-spreadsheet-LineBarPieConfigPanel">
2877
2850
  <div>
2878
2851
  <ChartDataSeries
2879
- ranges="() => this.getDataSeriesRanges()"
2852
+ ranges="this.getDataSeriesRanges()"
2880
2853
  onSelectionChanged="(ranges) => this.onDataSeriesRangesChanged(ranges)"
2881
2854
  onSelectionConfirmed="() => this.onDataSeriesConfirmed()"
2882
2855
  />
2883
2856
  <ChartLabelRange
2884
- range="() => this.getLabelRange()"
2857
+ range="this.getLabelRange()"
2885
2858
  isInvalid="isLabelInvalid"
2886
2859
  onSelectionChanged="(ranges) => this.onLabelRangeChanged(ranges)"
2887
2860
  onSelectionConfirmed="() => this.onLabelRangeConfirmed()"
@@ -2940,12 +2913,12 @@ https://fontawesome.com/license -->
2940
2913
  />
2941
2914
  </Section>
2942
2915
  <ChartDataSeries
2943
- ranges="() => this.getDataSeriesRanges()"
2916
+ ranges="this.getDataSeriesRanges()"
2944
2917
  onSelectionChanged="(ranges) => this.onDataSeriesRangesChanged(ranges)"
2945
2918
  onSelectionConfirmed="() => this.onDataSeriesConfirmed()"
2946
2919
  />
2947
2920
  <ChartLabelRange
2948
- range="() => this.getLabelRange()"
2921
+ range="this.getLabelRange()"
2949
2922
  isInvalid="isLabelInvalid"
2950
2923
  onSelectionChanged="(ranges) => this.onLabelRangeChanged(ranges)"
2951
2924
  onSelectionConfirmed="() => this.onLabelRangeConfirmed()"
@@ -3089,7 +3062,7 @@ https://fontawesome.com/license -->
3089
3062
  <Section class="'o-data-series'">
3090
3063
  <t t-set-slot="title">Key value</t>
3091
3064
  <SelectionInput
3092
- ranges="() => [this.getKeyValueRange()]"
3065
+ ranges="[this.getKeyValueRange()]"
3093
3066
  isInvalid="isKeyValueInvalid"
3094
3067
  hasSingleRange="true"
3095
3068
  required="true"
@@ -3101,7 +3074,7 @@ https://fontawesome.com/license -->
3101
3074
  <t t-set-slot="title">Baseline configuration</t>
3102
3075
  <div class="o-section-subtitle">Baseline value</div>
3103
3076
  <SelectionInput
3104
- ranges="() => [this.getBaselineRange()]"
3077
+ ranges="[this.getBaselineRange()]"
3105
3078
  isInvalid="isBaselineInvalid"
3106
3079
  hasSingleRange="true"
3107
3080
  onSelectionChanged="(ranges) => this.onBaselineRangeChanged(ranges)"
@@ -3299,7 +3272,7 @@ https://fontawesome.com/license -->
3299
3272
  <t t-set-slot="title">Apply to range</t>
3300
3273
  <div class="o-selection-cf">
3301
3274
  <SelectionInput
3302
- ranges="() => state.currentCF.ranges"
3275
+ ranges="state.currentCF.ranges"
3303
3276
  class="'o-range'"
3304
3277
  isInvalid="isRangeValid"
3305
3278
  onSelectionChanged="(ranges) => this.onRangesChanged(ranges)"
@@ -3571,27 +3544,15 @@ https://fontawesome.com/license -->
3571
3544
  </div>
3572
3545
  </t>
3573
3546
 
3574
- <t t-name="o-spreadsheet-ConditionalFormatPreviewList">
3575
- <div class="o-cf-preview-list h-100 overflow-auto" t-ref="cfList">
3576
- <t t-foreach="props.conditionalFormats" t-as="cf" t-key="cf.id">
3577
- <t t-call="o-spreadsheet-ConditionalFormattingPanelPreview"/>
3578
- </t>
3579
- <div
3580
- class="btn btn-link o-sidePanel-btn-link o-cf-add float-end"
3581
- t-on-click.prevent.stop="props.onAddConditionalFormat">
3582
- + Add another rule
3583
- </div>
3584
- </div>
3585
- </t>
3586
-
3587
- <t t-name="o-spreadsheet-ConditionalFormattingPanelPreview">
3547
+ <t t-name="o-spreadsheet-ConditionalFormatPreview">
3548
+ <t t-set="cf" t-value="props.conditionalFormat"/>
3588
3549
  <div
3589
- class="o-cf-preview d-flex position-relative"
3590
- t-att-class="{ 'o-cf-dragging': dragAndDrop.draggedItemId === cf.id }"
3591
- t-att-style="getPreviewDivStyle(cf)"
3550
+ class="o-cf-preview w-100"
3551
+ t-ref="cfPreview"
3552
+ t-att-class="props.class"
3592
3553
  t-att-data-id="cf.id"
3593
- t-on-click="(ev) => props.onPreviewClick(cf)"
3594
- t-on-mousedown="(ev) => this.onMouseDown(cf, ev)">
3554
+ t-on-click="props.onPreviewClick"
3555
+ t-on-mousedown="(ev) => this.onMouseDown(ev)">
3595
3556
  <div class="position-relative h-100 w-100 d-flex align-items-center">
3596
3557
  <div class="o-cf-drag-handle h-100 position-absolute d-flex align-items-center text-muted">
3597
3558
  <t t-call="o-spreadsheet-Icon.THIN_DRAG_HANDLE"/>
@@ -3630,6 +3591,28 @@ https://fontawesome.com/license -->
3630
3591
  </div>
3631
3592
  </t>
3632
3593
 
3594
+ <t t-name="o-spreadsheet-ConditionalFormatPreviewList">
3595
+ <div class="o-cf-preview-list h-100 overflow-auto" t-ref="cfList">
3596
+ <t t-foreach="props.conditionalFormats" t-as="cf" t-key="cf.id">
3597
+ <div
3598
+ class="o-cf-preview-container d-flex position-relative"
3599
+ t-att-style="getPreviewDivStyle(cf)">
3600
+ <ConditionalFormatPreview
3601
+ conditionalFormat="cf"
3602
+ class="dragAndDrop.draggedItemId === cf.id ? 'o-cf-dragging' : ''"
3603
+ onMouseDown="(ev) => this.onPreviewMouseDown(cf, ev)"
3604
+ onPreviewClick="() => props.onPreviewClick(cf)"
3605
+ />
3606
+ </div>
3607
+ </t>
3608
+ <div
3609
+ class="btn btn-link o-sidePanel-btn-link o-cf-add float-end"
3610
+ t-on-click.prevent.stop="props.onAddConditionalFormat">
3611
+ + Add another rule
3612
+ </div>
3613
+ </div>
3614
+ </t>
3615
+
3633
3616
  <t t-name="o-spreadsheet-ConditionalFormattingPanel">
3634
3617
  <div class="o-cf h-100">
3635
3618
  <t t-if="state.mode === 'list'">
@@ -3832,7 +3815,7 @@ https://fontawesome.com/license -->
3832
3815
 
3833
3816
  <t t-name="o-spreadsheet-DataValidationValueInRangeCriterionForm">
3834
3817
  <SelectionInput
3835
- ranges="() => [props.criterion.values[0] || '']"
3818
+ ranges="[props.criterion.values[0] || '']"
3836
3819
  onSelectionChanged="(ranges) => this.onRangeChanged(ranges[0])"
3837
3820
  required="true"
3838
3821
  hasSingleRange="true"
@@ -3852,7 +3835,7 @@ https://fontawesome.com/license -->
3852
3835
  <Section class="'o-dv-range'">
3853
3836
  <t t-set-slot="title">Apply to range</t>
3854
3837
  <SelectionInput
3855
- ranges="() => state.rule.ranges"
3838
+ ranges="state.rule.ranges"
3856
3839
  onSelectionChanged="(ranges) => this.onRangesChanged(ranges)"
3857
3840
  required="true"
3858
3841
  />
@@ -3896,7 +3879,7 @@ https://fontawesome.com/license -->
3896
3879
  </t>
3897
3880
 
3898
3881
  <t t-name="o-spreadsheet-DataValidationPreview">
3899
- <div class="o-dv-preview p-3" t-on-click="props.onClick">
3882
+ <div class="o-dv-preview p-3" t-on-click="props.onClick" t-ref="dvPreview">
3900
3883
  <div class="d-flex justify-content-between">
3901
3884
  <div class="o-dv-container d-flex flex-column">
3902
3885
  <div class="o-dv-preview-description fw-bold text-truncate" t-esc="descriptionString"/>
@@ -3920,16 +3903,18 @@ https://fontawesome.com/license -->
3920
3903
  type="text"
3921
3904
  t-ref="searchInput"
3922
3905
  class="o-input o-input-with-count"
3923
- t-on-input="onInput"
3906
+ t-on-input="onSearchInput"
3924
3907
  t-on-focus="onFocusSearch"
3925
3908
  t-on-keydown="onKeydownSearch"
3926
3909
  />
3927
3910
  <div class="o-input-count" t-if="hasSearchResult">
3928
- <t t-esc="env.model.getters.getCurrentSelectedMatchIndex()+1"/>
3911
+ <t t-esc="store.selectedMatchIndex+1"/>
3929
3912
  /
3930
- <t t-esc="env.model.getters.getSearchMatches().length"/>
3913
+ <t t-esc="store.searchMatches.length"/>
3914
+ </div>
3915
+ <div t-elif="!store.pendingSearch and store.toSearch !== ''" class="o-input-count">
3916
+ 0 / 0
3931
3917
  </div>
3932
- <div t-elif="!pendingSearch and toSearch !== ''" class="o-input-count">0 / 0</div>
3933
3918
  </div>
3934
3919
  <select
3935
3920
  class="o-input o-type-selector o-type-range-selector mt-3 mb-3"
@@ -3940,7 +3925,7 @@ https://fontawesome.com/license -->
3940
3925
  </select>
3941
3926
  <div t-if="searchOptions.searchScope === 'specificRange'">
3942
3927
  <SelectionInput
3943
- ranges="() => [this.dataRange]"
3928
+ ranges="[this.dataRange]"
3944
3929
  onSelectionChanged="(ranges) => this.onSearchRangeChanged(ranges)"
3945
3930
  onSelectionConfirmed.bind="updateDataRange"
3946
3931
  hasSingleRange="true"
@@ -3968,7 +3953,7 @@ https://fontawesome.com/license -->
3968
3953
  onChange.bind="searchFormulas"
3969
3954
  />
3970
3955
  </div>
3971
- <div class="o-matches-count mt-4" t-if="toSearch !== ''">
3956
+ <div class="o-matches-count mt-4" t-if="store.toSearch !== ''">
3972
3957
  <div t-if="searchOptions.searchScope === 'specificRange' and dataRange != ''">
3973
3958
  <t t-esc="specificRangeMatchesCount"/>
3974
3959
  </div>
@@ -3983,11 +3968,14 @@ https://fontawesome.com/license -->
3983
3968
  <div class="o-sidePanelButtons">
3984
3969
  <button
3985
3970
  t-att-disabled="!hasSearchResult"
3986
- t-on-click="onSelectPreviousCell"
3971
+ t-on-click="() => store.selectPreviousMatch()"
3987
3972
  class="o-button">
3988
3973
  Previous
3989
3974
  </button>
3990
- <button t-att-disabled="!hasSearchResult" t-on-click="onSelectNextCell" class="o-button">
3975
+ <button
3976
+ t-att-disabled="!hasSearchResult"
3977
+ t-on-click="() => store.selectNextMatch()"
3978
+ class="o-button">
3991
3979
  Next
3992
3980
  </button>
3993
3981
  </div>
@@ -3997,22 +3985,22 @@ https://fontawesome.com/license -->
3997
3985
  <input
3998
3986
  type="text"
3999
3987
  class="o-input o-input-without-count"
4000
- t-ref="replaceInput"
4001
3988
  t-on-keydown="onKeydownReplace"
3989
+ t-model="store.toReplace"
4002
3990
  />
4003
3991
  </div>
4004
3992
  </Section>
4005
3993
 
4006
3994
  <div class="o-sidePanelButtons" t-if="!env.model.getters.isReadonly()">
4007
3995
  <button
4008
- t-att-disabled="env.model.getters.getCurrentSelectedMatchIndex() === null"
4009
- t-on-click="replace"
3996
+ t-att-disabled="store.selectedMatchIndex === null"
3997
+ t-on-click="() => store.replace()"
4010
3998
  class="o-button">
4011
3999
  Replace
4012
4000
  </button>
4013
4001
  <button
4014
- t-att-disabled="env.model.getters.getCurrentSelectedMatchIndex() === null"
4015
- t-on-click="replaceAll"
4002
+ t-att-disabled="store.selectedMatchIndex === null"
4003
+ t-on-click="() => store.replaceAll()"
4016
4004
  class="o-button">
4017
4005
  Replace all
4018
4006
  </button>
@@ -4212,12 +4200,7 @@ https://fontawesome.com/license -->
4212
4200
  <SpreadsheetDashboard/>
4213
4201
  </t>
4214
4202
  <t t-else="">
4215
- <TopBar
4216
- onClick="() => this.focusGrid()"
4217
- onComposerContentFocused="(selection) => this.onTopBarComposerFocused(selection)"
4218
- focusComposer="focusTopBarComposer"
4219
- dropdownMaxHeight="gridHeight"
4220
- />
4203
+ <TopBar onClick="() => this.focusGrid()" dropdownMaxHeight="gridHeight"/>
4221
4204
  <div
4222
4205
  class="o-grid-container"
4223
4206
  t-att-class="{'o-two-columns': !sidePanel.isOpen}"
@@ -4233,10 +4216,7 @@ https://fontawesome.com/license -->
4233
4216
  <div class="o-group-grid overflow-hidden">
4234
4217
  <Grid
4235
4218
  sidePanelIsOpen="sidePanel.isOpen"
4236
- focusComposer="focusGridComposer"
4237
4219
  exposeFocus="(focus) => this._focusGrid = focus"
4238
- onComposerContentFocused="() => this.onGridComposerContentFocused()"
4239
- onGridComposerCellFocused="(content, selection) => this.onGridComposerCellFocused(content, selection)"
4240
4220
  />
4241
4221
  </div>
4242
4222
  </div>
@@ -4419,10 +4399,7 @@ https://fontawesome.com/license -->
4419
4399
  <ActionButton action="VIEW.createRemoveFilter" class="'o-hoverable-button'"/>
4420
4400
  </div>
4421
4401
  </div>
4422
- <TopBarComposer
4423
- focus="props.focusComposer"
4424
- onComposerContentFocused="props.onComposerContentFocused"
4425
- />
4402
+ <TopBarComposer/>
4426
4403
  </div>
4427
4404
  </div>
4428
4405
  <Menu
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "17.2.0-alpha.2",
3
+ "version": "17.2.0-alpha.4",
4
4
  "description": "A spreadsheet component",
5
5
  "type": "module",
6
6
  "main": "dist/o-spreadsheet.cjs.js",