@odoo/o-spreadsheet 17.3.0-alpha.6 → 17.3.0-alpha.9

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.3.0-alpha.6
5
- @date 2024-04-26T07:40:36.934Z
6
- @hash f58a0d5
4
+ @version 17.3.0-alpha.9
5
+ @date 2024-05-24T11:32:57.581Z
6
+ @hash aac246d
7
7
  -->
8
8
  <odoo>
9
9
  <t t-name="o-spreadsheet-ActionButton">
@@ -4170,18 +4170,6 @@
4170
4170
  </div>
4171
4171
  </t>
4172
4172
 
4173
- <div t-name="o-spreadsheet-AllPivotsSidePanel" class="o_spreadsheet_pivot_side_panel">
4174
- <t t-foreach="env.model.getters.getPivotIds()" t-as="pivotId" t-key="pivotId">
4175
- <PivotPreview pivotId="pivotId"/>
4176
- </t>
4177
- </div>
4178
-
4179
- <t t-name="o-spreadsheet-PivotPreview">
4180
- <div class="o_side_panel_select" t-ref="pivotPreview" t-on-click="this.selectPivot">
4181
- <span t-esc="env.model.getters.getPivotDisplayName(props.pivotId)"/>
4182
- </div>
4183
- </t>
4184
-
4185
4173
  <t t-name="o-spreadsheet-EditableName">
4186
4174
  <t t-if="state.isEditing">
4187
4175
  <div>
@@ -4205,32 +4193,31 @@
4205
4193
  Add
4206
4194
  </span>
4207
4195
  <Popover t-if="popover.isOpen" t-props="popoverProps">
4208
- <div class="p-2 bg-white border-bottom d-flex align-items-baseline pivot-dimension-search">
4196
+ <div
4197
+ class="p-2 bg-white border-bottom d-flex sticky-top align-items-baseline pivot-dimension-search">
4209
4198
  <i class="pe-1 pivot-dimension-search-field-icon">
4210
4199
  <t t-call="o-spreadsheet-Icon.SEARCH"/>
4211
4200
  </i>
4212
4201
  <input
4213
- t-model="search.input"
4202
+ t-on-input="(ev) => this.updateSearch(ev.target.value)"
4214
4203
  t-on-keydown="onKeyDown"
4215
4204
  class="border-0 w-100 pivot-dimension-search-field"
4216
- autofocus="1"
4205
+ t-ref="autofocus"
4217
4206
  />
4218
4207
  </div>
4219
- <div
4220
- t-foreach="filteredFields"
4221
- t-as="field"
4222
- t-key="field.name"
4223
- t-esc="field.string"
4224
- t-att-title="field.help"
4225
- t-on-click="() => this.pickField(field)"
4226
- class="p-1 px-2 pivot-dimension-field"
4227
- role="button"
4208
+ <TextValueProvider
4209
+ proposals="autoComplete.provider.proposals"
4210
+ selectedIndex="autoComplete.selectedIndex"
4211
+ onValueSelected="autoComplete.provider.selectProposal"
4212
+ onValueHovered="() => {}"
4228
4213
  />
4229
4214
  </Popover>
4230
4215
  </t>
4231
4216
 
4232
4217
  <t t-name="o-spreadsheet-PivotDimension">
4233
- <div class="border py-1 px-2 d-flex flex-column shadow-sm pivot-dimension">
4218
+ <div
4219
+ class="border py-1 px-2 d-flex flex-column shadow-sm pivot-dimension"
4220
+ t-att-class="{'bg-danger': !props.dimension.isValid}">
4234
4221
  <div class="d-flex flex-row justify-content-between align-items-center">
4235
4222
  <span class="fw-bold" t-esc="props.dimension.displayName"/>
4236
4223
  <i
@@ -4252,7 +4239,7 @@
4252
4239
  class="o_input flex-basis-50"
4253
4240
  t-on-change="(ev) => props.onUpdated(props.dimension, ev.target.value)">
4254
4241
  <option
4255
- t-foreach="allGranularities"
4242
+ t-foreach="props.allGranularities"
4256
4243
  t-as="granularity"
4257
4244
  t-key="granularity"
4258
4245
  t-if="props.availableGranularities.has(granularity) || granularity === props.dimension.granularity"
@@ -4272,17 +4259,23 @@
4272
4259
  <select
4273
4260
  class="o_input flex-basis-50"
4274
4261
  t-on-change="(ev) => props.onUpdated(props.dimension, ev.target.value)">
4275
- <option value="" t-att-selected="props.dimension.order === undefined">Automatic</option>
4276
4262
  <option value="asc" t-att-selected="props.dimension.order === 'asc'">Ascending</option>
4277
4263
  <option value="desc" t-att-selected="props.dimension.order === 'desc'">Descending</option>
4264
+ <option
4265
+ t-if="props.dimension.type !== 'date'"
4266
+ value=""
4267
+ t-att-selected="props.dimension.order === undefined">
4268
+ Unsorted
4269
+ </option>
4278
4270
  </select>
4279
4271
  </div>
4280
4272
  </div>
4281
4273
  </t>
4282
4274
 
4283
- <t t-name="o-spreadsheet-PivotDimensions">
4284
- <div class="o_side_panel_section pivot-dimensions" t-ref="pivot-dimensions">
4285
- <div class="fw-bold py-1 d-flex flex-row justify-content-between align-items-center">
4275
+ <t t-name="o-spreadsheet-PivotLayoutConfigurator">
4276
+ <div class="o_side_panel_section pivot-dimensions o-section" t-ref="pivot-dimensions">
4277
+ <div
4278
+ class="fw-bold py-1 d-flex flex-row justify-content-between align-items-center o-section-title">
4286
4279
  Columns
4287
4280
  <AddDimensionButton
4288
4281
  onFieldPicked.bind="addColumnDimension"
@@ -4300,13 +4293,14 @@
4300
4293
  dimension="col"
4301
4294
  onUpdated.bind="this.updateGranularity"
4302
4295
  availableGranularities="props.unusedDateTimeGranularities[col.name]"
4296
+ allGranularities="props.allGranularities"
4303
4297
  />
4304
4298
  <PivotDimensionOrder dimension="col" onUpdated.bind="this.updateOrder"/>
4305
4299
  </PivotDimension>
4306
4300
  </div>
4307
4301
  </t>
4308
4302
  <div
4309
- class="fw-bold pt-4 pb-1 d-flex flex-row justify-content-between align-items-center"
4303
+ class="fw-bold pt-4 pb-1 d-flex flex-row justify-content-between align-items-center o-section-title"
4310
4304
  t-att-style="dragAndDrop.itemsStyle['__rows_title__']">
4311
4305
  Rows
4312
4306
  <AddDimensionButton
@@ -4325,12 +4319,14 @@
4325
4319
  dimension="row"
4326
4320
  onUpdated.bind="this.updateGranularity"
4327
4321
  availableGranularities="props.unusedDateTimeGranularities[row.name]"
4322
+ allGranularities="props.allGranularities"
4328
4323
  />
4329
4324
  <PivotDimensionOrder dimension="row" onUpdated.bind="this.updateOrder"/>
4330
4325
  </PivotDimension>
4331
4326
  </div>
4332
4327
  </t>
4333
- <div class="fw-bold pt-4 pb-1 d-flex flex-row justify-content-between align-items-center">
4328
+ <div
4329
+ class="fw-bold pt-4 pb-1 d-flex flex-row justify-content-between align-items-center o-section-title">
4334
4330
  Measures
4335
4331
  <AddDimensionButton
4336
4332
  onFieldPicked.bind="addMeasureDimension"
@@ -4366,6 +4362,93 @@
4366
4362
  </div>
4367
4363
  </t>
4368
4364
 
4365
+ <t t-name="o-spreadsheet-PivotListItem">
4366
+ <div
4367
+ class="o_pivot_list_item p-4 border-bottom"
4368
+ t-ref="pivotListItem"
4369
+ t-on-click="this.selectPivot">
4370
+ <span t-esc="env.model.getters.getPivotDisplayName(props.pivotId)"/>
4371
+ </div>
4372
+ </t>
4373
+
4374
+ <t t-name="o-spreadsheet-PivotSidePanel">
4375
+ <t t-if="props.pivotId" t-component="sidePanelEditor" t-props="props"/>
4376
+ <t t-else="">
4377
+ <t t-foreach="env.model.getters.getPivotIds()" t-as="pivotId" t-key="pivotId">
4378
+ <PivotListItem pivotId="pivotId"/>
4379
+ </t>
4380
+ </t>
4381
+ </t>
4382
+
4383
+ <t t-name="o-spreadsheet-PivotSpreadsheetSidePanel">
4384
+ <div class="d-flex flex-column h-100 justify-content-between overflow-hidden">
4385
+ <div class="h-100 overflow-auto">
4386
+ <Section>
4387
+ <t t-set-slot="title">Name</t>
4388
+ <EditableName name="name" displayName="displayName" onChanged.bind="onNameChanged"/>
4389
+ <div class="btn btn-link o_duplicate_pivot" t-on-click="duplicatePivot">
4390
+ <i class="fa fa-solid fa-copy me-1"/>
4391
+ Duplicate Pivot
4392
+ </div>
4393
+ </Section>
4394
+ <Section>
4395
+ <t t-set-slot="title">Range</t>
4396
+ <SelectionInput
4397
+ ranges="ranges"
4398
+ required="true"
4399
+ isInvalid="shouldDisplayInvalidRangeError"
4400
+ hasSingleRange="true"
4401
+ onSelectionChanged="(ranges) => this.onSelectionChanged(ranges)"
4402
+ onSelectionConfirmed="() => this.onSelectionConfirmed()"
4403
+ />
4404
+ <span
4405
+ class="text-danger sp_range_error_message"
4406
+ t-if="shouldDisplayInvalidRangeError"
4407
+ t-esc="pivot.invalidRangeMessage"
4408
+ />
4409
+ </Section>
4410
+
4411
+ <PivotLayoutConfigurator
4412
+ t-if="!pivot.isInvalidRange"
4413
+ unusedGroupableFields="store.unusedGroupableFields"
4414
+ unusedMeasureFields="store.unusedMeasureFields"
4415
+ unusedDateTimeGranularities="store.unusedDateTimeGranularities"
4416
+ allGranularities="store.allGranularities"
4417
+ definition="definition"
4418
+ onDimensionsUpdated.bind="onDimensionsUpdated"
4419
+ />
4420
+ <Section>
4421
+ <button class="btn btn-link sp_back" t-on-click="back">Back</button>
4422
+ <button class="btn btn-link sp_delete" t-on-click="delete">Delete</button>
4423
+ </Section>
4424
+ </div>
4425
+ <Section
4426
+ class="'align-items-center border-top d-flex flex-row justify-content-between py-1 pivot-defer-update'">
4427
+ <Checkbox
4428
+ label="deferUpdatesLabel"
4429
+ title="deferUpdatesTooltip"
4430
+ value="store.updatesAreDeferred"
4431
+ onChange="(value) => store.deferUpdates(value)"
4432
+ />
4433
+ <div>
4434
+ <i
4435
+ t-if="store.isDirty"
4436
+ class="btn btn-sm pe-0 fa fa-undo"
4437
+ title="Discard all changes"
4438
+ t-on-click="() => store.discardPendingUpdate()"
4439
+ />
4440
+ <span
4441
+ t-if="store.isDirty"
4442
+ class="btn btm-sm btn-link sp_apply_update"
4443
+ title="Apply all changes"
4444
+ t-on-click="() => store.applyUpdate()">
4445
+ Update
4446
+ </span>
4447
+ </div>
4448
+ </Section>
4449
+ </div>
4450
+ </t>
4451
+
4369
4452
  <t t-name="o-spreadsheet-RemoveDuplicatesPanel">
4370
4453
  <div class="o-remove-duplicates">
4371
4454
  <Section>
@@ -4644,42 +4727,34 @@
4644
4727
  <Section class="'pt-1'">
4645
4728
  <t t-set-slot="title">Style color</t>
4646
4729
  <div class="d-flex align-items-center">
4647
- <div
4648
- class="o-color-preview"
4649
- t-att-style="colorPreviewStyle"
4650
- t-on-click.stop="togglePicker"
4651
- />
4652
- <span class="pe-1">Primary table style color</span>
4653
- <ColorPickerWidget
4654
- currentColor="state.primaryColor"
4655
- showColorPicker="state.pickerOpened"
4656
- toggleColorPicker.bind="togglePicker"
4657
- onColorPicked.bind="onColorPicked"
4658
- icon="'o-spreadsheet-Icon.FILL_COLOR'"
4659
- />
4730
+ <span class="pe-2">Primary table style color</span>
4731
+ <RoundColorPicker currentColor="state.primaryColor" onColorPicked.bind="onColorPicked"/>
4660
4732
  </div>
4661
4733
  </Section>
4662
4734
  <Section class="'pt-1'">
4663
4735
  <t t-set-slot="title">Style template</t>
4664
4736
  <div class="d-flex flex-wrap">
4665
- <div
4666
- class="o-table-style-list-item"
4667
- t-foreach="tableTemplates"
4668
- t-as="templateName"
4669
- t-key="templateName"
4670
- t-att-class="{ 'selected': templateName === state.selectedTemplateName }"
4671
- t-on-click="() => this.onTemplatePicked(templateName)">
4672
- <div class="o-table-style-edit-template-preview">
4673
- <TableStylePreview
4674
- tableConfig="previewTableConfig"
4675
- tableStyle="computeTableStyle(templateName)"
4676
- />
4677
- </div>
4678
- </div>
4737
+ <t t-foreach="tableTemplates" t-as="templateName" t-key="templateName">
4738
+ <TableStylePreview
4739
+ class="'o-table-style-edit-template-preview'"
4740
+ selected="templateName === state.selectedTemplateName"
4741
+ tableConfig="previewTableConfig"
4742
+ tableStyle="computeTableStyle(templateName)"
4743
+ onClick="() => this.onTemplatePicked(templateName)"
4744
+ />
4745
+ </t>
4679
4746
  </div>
4680
4747
  <div class="o-sidePanelButtons">
4681
- <button t-on-click="onCancel" class="o-cancel o-button">Cancel</button>
4682
- <button t-on-click="onConfirm" class="o-confirm o-button">Confirm</button>
4748
+ <button
4749
+ t-if="props.styleId"
4750
+ t-on-click="onDelete"
4751
+ class="o-delete o-button o-button-grey danger">
4752
+ Delete
4753
+ </button>
4754
+ <button t-on-click="onCancel" class="o-cancel o-button o-button-grey">Cancel</button>
4755
+ <button t-on-click="onConfirm" class="o-confirm o-button o-button-grey primary">
4756
+ Confirm
4757
+ </button>
4683
4758
  </div>
4684
4759
  </Section>
4685
4760
  </div>
@@ -4746,23 +4821,16 @@
4746
4821
  <t t-name="o-spreadsheet-TableStylePicker">
4747
4822
  <div class="o-table-style-picker d-flex flew-row justify-content-between ps-1">
4748
4823
  <div class="d-flex flex-row overflow-hidden">
4749
- <div
4750
- class="o-table-style-list-item"
4751
- t-att-class="{ 'selected': styleId === props.table.config.styleId }"
4752
- t-foreach="getDisplayedTableStyles()"
4753
- t-as="styleId"
4754
- t-key="styleId"
4755
- t-att-title="getStyleName(styleId)"
4756
- t-att-data-id="styleId"
4757
- t-on-click="() => this.onStylePicked(styleId)"
4758
- t-on-contextmenu.prevent="(ev) => this.onContextMenu(ev, styleId)">
4759
- <div class="o-table-style-picker-preview">
4760
- <TableStylePreview
4761
- tableConfig="props.table.config"
4762
- tableStyle="env.model.getters.getTableStyle(styleId)"
4763
- />
4764
- </div>
4765
- </div>
4824
+ <t t-foreach="getDisplayedTableStyles()" t-as="styleId" t-key="styleId">
4825
+ <TableStylePreview
4826
+ class="'o-table-style-picker-preview'"
4827
+ selected="styleId === props.table.config.styleId"
4828
+ tableConfig="props.table.config"
4829
+ tableStyle="env.model.getters.getTableStyle(styleId)"
4830
+ styleId="styleId"
4831
+ onClick="() => this.onStylePicked(styleId)"
4832
+ />
4833
+ </t>
4766
4834
  </div>
4767
4835
  <div
4768
4836
  class="o-table-style-picker-arrow d-flex align-items-center px-1"
@@ -4777,6 +4845,27 @@
4777
4845
  popoverProps="state.popoverProps"
4778
4846
  closePopover.bind="closePopover"
4779
4847
  />
4848
+ </t>
4849
+
4850
+ <t t-name="o-spreadsheet-TableStylePreview">
4851
+ <div
4852
+ class="o-table-style-list-item position-relative"
4853
+ t-att-class="{ 'selected': props.selected }"
4854
+ t-att-data-id="props.styleId"
4855
+ t-att-title="styleName"
4856
+ t-on-click="props.onClick"
4857
+ t-on-contextmenu.prevent="(ev) => this.onContextMenu(ev)">
4858
+ <div t-att-class="props.class">
4859
+ <canvas t-ref="canvas" class="w-100 h-100"/>
4860
+ </div>
4861
+ <div
4862
+ class="o-table-style-edit-button position-absolute d-none"
4863
+ t-if="isStyleEditable"
4864
+ t-on-click="this.editTableStyle"
4865
+ title="Edit custom table style">
4866
+ <t t-call="o-spreadsheet-Icon.EDIT"/>
4867
+ </div>
4868
+ </div>
4780
4869
  <Menu
4781
4870
  t-if="menu.isOpen"
4782
4871
  menuItems="menu.menuItems"
@@ -4785,10 +4874,6 @@
4785
4874
  />
4786
4875
  </t>
4787
4876
 
4788
- <t t-name="o-spreadsheet-TableStylePreview">
4789
- <canvas t-ref="canvas" class="w-100 h-100"/>
4790
- </t>
4791
-
4792
4877
  <t t-name="o-spreadsheet-TableStylesPopover">
4793
4878
  <Popover t-if="props.popoverProps" t-props="props.popoverProps">
4794
4879
  <div
@@ -4818,22 +4903,16 @@
4818
4903
  </div>
4819
4904
  <hr class="hr my-2"/>
4820
4905
  <div class="d-flex flex-wrap">
4821
- <div
4822
- class="o-table-style-list-item"
4823
- t-att-class="{ 'selected': styleId === props.selectedStyleId }"
4824
- t-foreach="displayedStyles"
4825
- t-as="styleId"
4826
- t-key="styleId"
4827
- t-att-title="getStyleName(styleId)"
4828
- t-on-click="() => this.props.onStylePicked(styleId)"
4829
- t-on-contextmenu.prevent="(ev) => this.onContextMenu(ev, styleId)">
4830
- <div class="o-table-style-popover-preview">
4831
- <TableStylePreview
4832
- tableConfig="props.tableConfig"
4833
- tableStyle="env.model.getters.getTableStyle(styleId)"
4834
- />
4835
- </div>
4836
- </div>
4906
+ <t t-foreach="displayedStyles" t-as="styleId" t-key="styleId">
4907
+ <TableStylePreview
4908
+ class="'o-table-style-popover-preview'"
4909
+ styleId="styleId"
4910
+ selected="styleId === props.selectedStyleId"
4911
+ tableConfig="props.tableConfig"
4912
+ tableStyle="env.model.getters.getTableStyle(styleId)"
4913
+ onClick="() => this.props.onStylePicked(styleId)"
4914
+ />
4915
+ </t>
4837
4916
  <div
4838
4917
  t-if="state.selectedCategory === 'custom'"
4839
4918
  class="o-new-table-style o-table-style-list-item o-table-style-popover-preview d-flex justify-content-center align-items-center"
@@ -4842,12 +4921,6 @@
4842
4921
  </div>
4843
4922
  </div>
4844
4923
  </div>
4845
- <Menu
4846
- t-if="menu.isOpen"
4847
- menuItems="menu.menuItems"
4848
- position="menu.position"
4849
- onClose.bind="this.closeMenu"
4850
- />
4851
4924
  </Popover>
4852
4925
  </t>
4853
4926
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "17.3.0-alpha.6",
3
+ "version": "17.3.0-alpha.9",
4
4
  "description": "A spreadsheet component",
5
5
  "type": "module",
6
6
  "main": "dist/o-spreadsheet.cjs.js",
@@ -101,7 +101,7 @@
101
101
  },
102
102
  "dependencies": {
103
103
  "@odoo/owl": "2.2.10",
104
- "bootstrap": "^5.1.3",
104
+ "bootstrap": "^5.3.3",
105
105
  "font-awesome": "^4.7.0",
106
106
  "rbush": "^3.0.1"
107
107
  },