@odoo/o-spreadsheet 18.1.0-alpha.2 → 18.1.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 18.1.0-alpha.2
5
- @date 2024-10-24T08:54:19.283Z
6
- @hash 2a01250
4
+ @version 18.1.0-alpha.4
5
+ @date 2024-11-13T15:07:31.403Z
6
+ @hash e1ad985
7
7
  -->
8
8
  <odoo>
9
9
  <t t-name="o-spreadsheet-ActionButton">
@@ -402,10 +402,12 @@
402
402
  </button>
403
403
  </div>
404
404
  </div>
405
- <div class="o-separator"/>
406
- <div class="o-buttons">
407
- <button t-on-click="resetColor" class="o-cancel">No Color</button>
408
- </div>
405
+ <t t-if="!props.disableNoColor">
406
+ <div class="o-separator"/>
407
+ <div class="o-buttons">
408
+ <button t-on-click="resetColor" class="o-cancel">No Color</button>
409
+ </div>
410
+ </t>
409
411
  </div>
410
412
  </Popover>
411
413
  </t>
@@ -1493,6 +1495,11 @@
1493
1495
  />
1494
1496
  </svg>
1495
1497
  </t>
1498
+ <t t-name="o-spreadsheet-Icon.CLIPBOARD">
1499
+ <div class="o-icon">
1500
+ <i class="fa fa-clipboard"/>
1501
+ </div>
1502
+ </t>
1496
1503
  <t t-name="o-spreadsheet-Icon.COPY">
1497
1504
  <div class="o-icon">
1498
1505
  <i class="fa fa-clone"/>
@@ -2653,7 +2660,7 @@
2653
2660
  <Section class="'pt-0'">
2654
2661
  <Checkbox
2655
2662
  name="'stacked'"
2656
- label="chartTerms.StackedBarChart"
2663
+ label="stackedLabel"
2657
2664
  value="props.definition.stacked"
2658
2665
  onChange.bind="onUpdateStacked"
2659
2666
  />
@@ -2780,6 +2787,21 @@
2780
2787
  </Section>
2781
2788
  </t>
2782
2789
 
2790
+ <t t-name="o-spreadsheet-ChartLegend">
2791
+ <Section class="'pt-0'" title.translate="Legend position">
2792
+ <select
2793
+ t-att-value="props.definition.legendPosition ?? 'top'"
2794
+ class="o-input o-chart-legend-position"
2795
+ t-on-change="this.updateLegendPosition">
2796
+ <option value="none">None</option>
2797
+ <option value="top">Top</option>
2798
+ <option value="bottom">Bottom</option>
2799
+ <option value="left">Left</option>
2800
+ <option value="right">Right</option>
2801
+ </select>
2802
+ </Section>
2803
+ </t>
2804
+
2783
2805
  <t t-name="o-spreadsheet-SeriesDesignEditor">
2784
2806
  <SidePanelCollapsible collapsedAtInit="true" title.translate="Data Series">
2785
2807
  <t t-set-slot="content">
@@ -2884,13 +2906,16 @@
2884
2906
  </div>
2885
2907
  <div class="w-50 ms-3" t-if="trendType === 'polynomial'">
2886
2908
  <span class="o-section-subtitle">Degree</span>
2887
- <input
2909
+ <select
2888
2910
  t-att-value="trend.order"
2889
- type="number"
2890
- class="w-100 o-input trend-order-input"
2891
- t-on-change="(ev) => this.onChangePolynomialDegree(index, ev)"
2892
- min="1"
2893
- />
2911
+ class="o-input trend-order-input"
2912
+ t-on-change="(ev) => this.onChangePolynomialDegree(index, ev)">
2913
+ <t t-foreach="getPolynomialDegrees(index)" t-as="degree" t-key="degree">
2914
+ <option t-att-value="degree">
2915
+ <t t-esc="degree"/>
2916
+ </option>
2917
+ </t>
2918
+ </select>
2894
2919
  </div>
2895
2920
  </div>
2896
2921
  <div class="d-flex align-items-center">
@@ -3289,24 +3314,17 @@
3289
3314
  definition="props.definition"
3290
3315
  updateChart="props.updateChart">
3291
3316
  <t t-set-slot="general-extension">
3292
- <Section class="'pt-0'" title.translate="Legend position">
3293
- <select
3294
- t-att-value="props.definition.legendPosition ?? 'top'"
3295
- class="o-input"
3296
- t-on-change="this.updateLegendPosition">
3297
- <option value="none">None</option>
3298
- <option value="top">Top</option>
3299
- <option value="bottom">Bottom</option>
3300
- <option value="left">Left</option>
3301
- <option value="right">Right</option>
3302
- </select>
3303
- </Section>
3317
+ <ChartLegend
3318
+ figureId="props.figureId"
3319
+ definition="props.definition"
3320
+ updateChart="props.updateChart"
3321
+ />
3304
3322
  <Section class="'pt-0'" title.translate="Values">
3305
3323
  <Checkbox
3306
3324
  name="'showValues'"
3307
3325
  label.translate="Show values"
3308
3326
  value="props.definition.showValues"
3309
- onChange="showValues => props.updateChart(this.props.figureId, {showValues})"
3327
+ onChange="(showValues) => props.updateChart(this.props.figureId, { showValues })"
3310
3328
  />
3311
3329
  </Section>
3312
3330
  </t>
@@ -3349,22 +3367,15 @@
3349
3367
  definition="props.definition"
3350
3368
  updateChart="props.updateChart">
3351
3369
  <t t-set-slot="general-extension">
3352
- <Section class="'pt-0'" title.translate="Legend position">
3353
- <select
3354
- t-att-value="props.definition.legendPosition ?? 'top'"
3355
- class="o-input"
3356
- t-on-change="this.updateLegendPosition">
3357
- <option value="none">None</option>
3358
- <option value="top">Top</option>
3359
- <option value="bottom">Bottom</option>
3360
- <option value="left">Left</option>
3361
- <option value="right">Right</option>
3362
- </select>
3363
- </Section>
3370
+ <ChartLegend
3371
+ figureId="props.figureId"
3372
+ definition="props.definition"
3373
+ updateChart="props.updateChart"
3374
+ />
3364
3375
  <Section class="'pt-0'" title.translate="Values">
3365
3376
  <Checkbox
3366
3377
  name="'showValues'"
3367
- label="showValuesLabel"
3378
+ label.translate="Show values"
3368
3379
  value="props.definition.showValues"
3369
3380
  onChange="showValues => props.updateChart(this.props.figureId, {showValues})"
3370
3381
  />
@@ -3627,24 +3638,17 @@
3627
3638
  definition="props.definition"
3628
3639
  updateChart="props.updateChart">
3629
3640
  <t t-set-slot="general-extension">
3630
- <Section class="'pt-0'" title.translate="Legend position">
3631
- <select
3632
- t-att-value="props.definition.legendPosition ?? 'top'"
3633
- class="o-input"
3634
- t-on-change="(ev) => this.updateLegendPosition(ev)">
3635
- <option value="none">None</option>
3636
- <option value="top">Top</option>
3637
- <option value="bottom">Bottom</option>
3638
- <option value="left">Left</option>
3639
- <option value="right">Right</option>
3640
- </select>
3641
- </Section>
3642
- <Section title.translate="Values">
3641
+ <ChartLegend
3642
+ figureId="props.figureId"
3643
+ definition="props.definition"
3644
+ updateChart="props.updateChart"
3645
+ />
3646
+ <Section class="'pt-0'" title.translate="Values">
3643
3647
  <Checkbox
3644
3648
  name="'showValues'"
3645
3649
  label.translate="Show values"
3646
3650
  value="props.definition.showValues"
3647
- onChange="showValues => props.updateChart(this.props.figureId, {showValues})"
3651
+ onChange="(showValues) => props.updateChart(this.props.figureId, { showValues })"
3648
3652
  />
3649
3653
  </Section>
3650
3654
  </t>
@@ -3657,17 +3661,18 @@
3657
3661
  definition="props.definition"
3658
3662
  updateChart="props.updateChart">
3659
3663
  <t t-set-slot="general-extension">
3660
- <Section class="'pt-0'" title.translate="Legend Position">
3661
- <select
3662
- t-att-value="props.definition.legendPosition ?? 'top'"
3663
- class="o-input"
3664
- t-on-change="this.updateLegendPosition">
3665
- <option value="none">None</option>
3666
- <option value="top">Top</option>
3667
- <option value="bottom">Bottom</option>
3668
- <option value="left">Left</option>
3669
- <option value="right">Right</option>
3670
- </select>
3664
+ <ChartLegend
3665
+ figureId="props.figureId"
3666
+ definition="props.definition"
3667
+ updateChart="props.updateChart"
3668
+ />
3669
+ <Section class="'pt-0'" title.translate="Values">
3670
+ <Checkbox
3671
+ name="'showValues'"
3672
+ label.translate="Show values"
3673
+ value="props.definition.showValues"
3674
+ onChange="(showValues) => props.updateChart(this.props.figureId, { showValues })"
3675
+ />
3671
3676
  </Section>
3672
3677
  </t>
3673
3678
  </GeneralDesignEditor>
@@ -3759,7 +3764,7 @@
3759
3764
  placeholder="Baseline description"
3760
3765
  />
3761
3766
  </Section>
3762
- <Section class="'o-chart-baseline-color'" title="colorsSectionTitle">
3767
+ <Section class="'o-chart-baseline-color pt-0'" title="colorsSectionTitle">
3763
3768
  <div class="d-flex align-items-center mb-2">
3764
3769
  <RoundColorPicker
3765
3770
  currentColor="props.definition.baselineColorUp"
@@ -3787,7 +3792,7 @@
3787
3792
  definition="props.definition"
3788
3793
  updateChart="props.updateChart">
3789
3794
  <t t-set-slot="general-extension">
3790
- <Section class="'o-vertical-axis-selection'" title.translate="Vertical axis position">
3795
+ <Section class="'o-vertical-axis-selection pt-0'" title.translate="Vertical axis position">
3791
3796
  <RadioSelection
3792
3797
  choices="axisChoices"
3793
3798
  selectedValue="props.definition.verticalAxisPosition"
@@ -3795,24 +3800,17 @@
3795
3800
  onChange.bind="updateVerticalAxisPosition"
3796
3801
  />
3797
3802
  </Section>
3798
- <Section title.translate="Legend position">
3799
- <select
3800
- t-att-value="props.definition.legendPosition"
3801
- class="o-input o-chart-legend-position"
3802
- t-on-change="(ev) => this.updateLegendPosition(ev)">
3803
- <option value="none">None</option>
3804
- <option value="top">Top</option>
3805
- <option value="bottom">Bottom</option>
3806
- <option value="left">Left</option>
3807
- <option value="right">Right</option>
3808
- </select>
3809
- </Section>
3810
- <Section title.translate="Values">
3803
+ <ChartLegend
3804
+ figureId="props.figureId"
3805
+ definition="props.definition"
3806
+ updateChart="props.updateChart"
3807
+ />
3808
+ <Section class="'pt-0'" title.translate="Values">
3811
3809
  <Checkbox
3812
3810
  name="'showValues'"
3813
3811
  label.translate="Show values"
3814
3812
  value="props.definition.showValues"
3815
- onChange="showValues => props.updateChart(this.props.figureId, {showValues})"
3813
+ onChange="(showValues) => props.updateChart(this.props.figureId, { showValues })"
3816
3814
  />
3817
3815
  </Section>
3818
3816
  </t>
@@ -3844,7 +3842,7 @@
3844
3842
  onChange.bind="onUpdateShowConnectorLines"
3845
3843
  />
3846
3844
  </Section>
3847
- <Section title.translate="Colors">
3845
+ <Section class="'pt-0'" title.translate="Colors">
3848
3846
  <div class="o-waterfall-positive-color d-flex align-items-center mb-2">
3849
3847
  <RoundColorPicker
3850
3848
  currentColor="positiveValuesColor"
@@ -3992,6 +3990,7 @@
3992
3990
  anchorRect="colorPickerAnchorRect"
3993
3991
  onColorPicked.bind="onColorPicked"
3994
3992
  currentColor="props.currentColor"
3993
+ disableNoColor="props.disableNoColor"
3995
3994
  />
3996
3995
  </t>
3997
3996
 
@@ -4025,9 +4024,15 @@
4025
4024
  <t t-set="text_color">Text Color</t>
4026
4025
  <div class="o-cf-cell-is-rule">
4027
4026
  <div class="o-section-subtitle">Format cells if...</div>
4028
- <select t-model="rule.operator" class="o-input o-cell-is-operator mb-3">
4029
- <t t-foreach="Object.keys(cellIsOperators)" t-as="op" t-key="op_index">
4030
- <option t-att-value="op" t-esc="cellIsOperators[op]"/>
4027
+ <select
4028
+ class="o-input o-cell-is-operator mb-3"
4029
+ t-on-change="(ev) => this.editOperator(ev.target.value)">
4030
+ <t t-foreach="cellIsOperators" t-as="op" t-key="op_index">
4031
+ <option
4032
+ t-att-value="op"
4033
+ t-esc="cellIsOperators[op]"
4034
+ t-att-selected="rule.operator === op"
4035
+ />
4031
4036
  </t>
4032
4037
  </select>
4033
4038
  <t t-if="rule.operator !== 'IsEmpty' and rule.operator !== 'IsNotEmpty'">
@@ -4102,10 +4107,11 @@
4102
4107
  <Section class="'o-cf-range pb-0'" title.translate="Apply to range">
4103
4108
  <div class="o-selection-cf">
4104
4109
  <SelectionInput
4105
- ranges="state.currentCF.ranges"
4110
+ ranges="state.ranges"
4106
4111
  class="'o-range'"
4107
4112
  isInvalid="isRangeValid"
4108
- onSelectionChanged="(ranges) => this.onRangesChanged(ranges)"
4113
+ onSelectionChanged.bind="onRangeUpdate"
4114
+ onSelectionConfirmed.bind="onRangeConfirmed"
4109
4115
  required="true"
4110
4116
  />
4111
4117
  </div>
@@ -4137,8 +4143,11 @@
4137
4143
  </Section>
4138
4144
  <Section class="'pt-1'">
4139
4145
  <div class="o-sidePanelButtons">
4140
- <button t-on-click="props.onExitEdition" class="o-button o-cf-cancel">Cancel</button>
4141
- <button t-on-click="saveConditionalFormat" class="o-button primary o-cf-save">
4146
+ <button t-on-click="props.onCancel" class="o-button o-cf-cancel">Cancel</button>
4147
+ <button
4148
+ t-on-click="onSave"
4149
+ class="o-button primary o-cf-save"
4150
+ t-att-disabled="state.errors.length !== 0">
4142
4151
  Save
4143
4152
  </button>
4144
4153
  </div>
@@ -4172,14 +4181,18 @@
4172
4181
  <select
4173
4182
  class="o-input me-2"
4174
4183
  name="valueType"
4175
- t-model="threshold.type"
4184
+ t-on-change="(ev) => this.updateThresholdType(thresholdType, ev.target.value)"
4176
4185
  t-on-click="closeMenus"
4177
4186
  t-att-class="{ 'o-select-with-input': threshold?.type !== 'value' }">
4178
- <option value="value">Cell values</option>
4179
- <option value="number">Number</option>
4180
- <option value="percentage">Percentage</option>
4181
- <option value="percentile">Percentile</option>
4182
- <option value="formula">Formula</option>
4187
+ <option value="value" t-att-selected="threshold.type === 'value'">Cell values</option>
4188
+ <option value="number" t-att-selected="threshold.type === 'number'">Number</option>
4189
+ <option value="percentage" t-att-selected="threshold.type === 'percentage'">
4190
+ Percentage
4191
+ </option>
4192
+ <option value="percentile" t-att-selected="threshold.type === 'percentile'">
4193
+ Percentile
4194
+ </option>
4195
+ <option value="formula" t-att-selected="threshold.type === 'formula'">Formula</option>
4183
4196
  </select>
4184
4197
  </t>
4185
4198
  <div class="o-threshold-value me-2" t-if="threshold and threshold.type !== 'value'">
@@ -4187,7 +4200,8 @@
4187
4200
  t-if="threshold.type !== 'formula'"
4188
4201
  type="text"
4189
4202
  class="o-input"
4190
- t-model="rule[thresholdType].value"
4203
+ t-att-value="threshold.value"
4204
+ t-on-change="(ev) => this.updateThresholdValue(thresholdType, ev.target.value)"
4191
4205
  t-att-class="{ 'o-invalid': isValueInvalid(thresholdType), 'invisible': threshold === undefined }"
4192
4206
  />
4193
4207
  <StandaloneComposer t-else="" t-props="getColorScaleComposerProps(thresholdType)"/>
@@ -4197,6 +4211,7 @@
4197
4211
  currentColor="getThresholdColor(threshold)"
4198
4212
  onColorPicked="(color) => this.setColorScaleColor(thresholdType, color)"
4199
4213
  title="fill_color"
4214
+ disableNoColor="true"
4200
4215
  />
4201
4216
  </div>
4202
4217
  </div>
@@ -4239,7 +4254,8 @@
4239
4254
  class="'o-range'"
4240
4255
  isInvalid="false"
4241
4256
  hasSingleRange="true"
4242
- onSelectionChanged="(ranges) => this.onDataBarRangeUpdate(ranges)"
4257
+ onSelectionChanged.bind="onDataBarRangeUpdate"
4258
+ onSelectionConfirmed.bind="onDataBarRangeChange"
4243
4259
  required="false"
4244
4260
  />
4245
4261
  </div>
@@ -4284,11 +4300,14 @@
4284
4300
  </td>
4285
4301
  <td>When value is</td>
4286
4302
  <td>
4287
- <select class="o-input" name="valueType" t-model="inflectionPointValue.operator">
4288
- <option value="gt">
4303
+ <select
4304
+ class="o-input"
4305
+ name="valueType"
4306
+ t-on-change="(ev) => this.setInflectionOperator(inflectionPoint, ev.target.value)">
4307
+ <option value="gt" t-att-selected="inflectionPointValue.operator === 'gt'">
4289
4308
  <span>&#62;</span>
4290
4309
  </option>
4291
- <option value="ge">
4310
+ <option value="ge" t-att-selected="inflectionPointValue.operator === 'ge'">
4292
4311
  <span>&#8805;</span>
4293
4312
  </option>
4294
4313
  </select>
@@ -4300,17 +4319,29 @@
4300
4319
  t-if="inflectionPointValue.type !== 'formula'"
4301
4320
  class="o-input"
4302
4321
  t-att-class="{ 'o-invalid': isInflectionPointInvalid(inflectionPoint) }"
4303
- t-model="rule[inflectionPoint].value"
4322
+ t-att-value="rule[inflectionPoint].value"
4323
+ t-on-change="(ev) => this.setInflectionValue(inflectionPoint, ev.target.value)"
4304
4324
  />
4305
4325
  <StandaloneComposer t-else="" t-props="getColorIconSetComposerProps(inflectionPoint)"/>
4306
4326
  </div>
4307
4327
  </td>
4308
4328
  <td>
4309
- <select class="o-input" name="valueType" t-model="inflectionPointValue.type">
4310
- <option value="number">Number</option>
4311
- <option value="percentage">Percentage</option>
4312
- <option value="percentile">Percentile</option>
4313
- <option value="formula">Formula</option>
4329
+ <select
4330
+ class="o-input"
4331
+ name="valueType"
4332
+ t-on-change="(ev) => this.setInflectionType(inflectionPoint, ev.target.value, ev)">
4333
+ <option value="number" t-att-selected="inflectionPointValue.type === 'number'">
4334
+ Number
4335
+ </option>
4336
+ <option value="percentage" t-att-selected="inflectionPointValue.type === 'percentage'">
4337
+ Percentage
4338
+ </option>
4339
+ <option value="percentile" t-att-selected="inflectionPointValue.type === 'percentile'">
4340
+ Percentile
4341
+ </option>
4342
+ <option value="formula" t-att-selected="inflectionPointValue.type === 'formula'">
4343
+ Formula
4344
+ </option>
4314
4345
  </select>
4315
4346
  </td>
4316
4347
  </tr>
@@ -4453,7 +4484,11 @@
4453
4484
  />
4454
4485
  </t>
4455
4486
  <t t-if="state.mode === 'edit'">
4456
- <ConditionalFormattingEditor editedCf="state.editedCf" onExitEdition.bind="switchToList"/>
4487
+ <ConditionalFormattingEditor
4488
+ editedCf="editedCF"
4489
+ onSave.bind="switchToList"
4490
+ onCancel.bind="cancelEdition"
4491
+ />
4457
4492
  </t>
4458
4493
  </div>
4459
4494
  </t>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odoo/o-spreadsheet",
3
- "version": "18.1.0-alpha.2",
3
+ "version": "18.1.0-alpha.4",
4
4
  "description": "A spreadsheet component",
5
5
  "type": "module",
6
6
  "main": "dist/o-spreadsheet.cjs.js",
@@ -64,7 +64,7 @@
64
64
  "@types/rbush": "^3.0.3",
65
65
  "babel-eslint": "^10.1.0",
66
66
  "body-parser": "^1.19.0",
67
- "chart.js": "4.4.1",
67
+ "chart.js": "4.4.5",
68
68
  "chartjs-adapter-luxon": "^1.3.1",
69
69
  "cors": "^2.8.5",
70
70
  "eslint": "^6.8.0",