@odoo/o-spreadsheet 18.4.4 → 18.4.6
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.
- package/dist/o-spreadsheet.cjs.js +94 -47
- package/dist/o-spreadsheet.d.ts +3 -1
- package/dist/o-spreadsheet.esm.js +94 -47
- package/dist/o-spreadsheet.iife.js +94 -47
- package/dist/o-spreadsheet.iife.min.js +390 -391
- package/dist/o_spreadsheet.xml +4 -4
- package/package.json +1 -1
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* This file is generated by o-spreadsheet build tools. Do not edit it.
|
|
4
4
|
* @see https://github.com/odoo/o-spreadsheet
|
|
5
|
-
* @version 18.4.
|
|
6
|
-
* @date 2025-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.4.6
|
|
6
|
+
* @date 2025-08-18T08:16:33.453Z
|
|
7
|
+
* @hash 9c7c143
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
(function (exports, owl) {
|
|
@@ -1057,16 +1057,21 @@
|
|
|
1057
1057
|
"#001f3f",
|
|
1058
1058
|
];
|
|
1059
1059
|
/*
|
|
1060
|
-
* transform a color number (R * 256^2 + G * 256 + B) into classic
|
|
1060
|
+
* transform a color number (R * 256^2 + G * 256 + B) into classic hex (+alpha) value
|
|
1061
1061
|
* */
|
|
1062
|
-
function
|
|
1063
|
-
|
|
1062
|
+
function colorNumberToHex(color, alpha = 1) {
|
|
1063
|
+
const alphaHex = alpha !== 1
|
|
1064
|
+
? Math.round(alpha * 255)
|
|
1065
|
+
.toString(16)
|
|
1066
|
+
.padStart(2, "0")
|
|
1067
|
+
: "";
|
|
1068
|
+
return toHex(color.toString(16).padStart(6, "0")) + alphaHex;
|
|
1064
1069
|
}
|
|
1065
1070
|
function colorToNumber(color) {
|
|
1066
1071
|
if (typeof color === "number") {
|
|
1067
1072
|
return color;
|
|
1068
1073
|
}
|
|
1069
|
-
return Number.parseInt(toHex(color).slice(1), 16);
|
|
1074
|
+
return Number.parseInt(toHex(color).slice(1, 7), 16);
|
|
1070
1075
|
}
|
|
1071
1076
|
/**
|
|
1072
1077
|
* Converts any CSS color value to a standardized hex6 value.
|
|
@@ -1325,6 +1330,12 @@
|
|
|
1325
1330
|
function hexToHSLA(hex) {
|
|
1326
1331
|
return rgbaToHSLA(colorToRGBA(hex));
|
|
1327
1332
|
}
|
|
1333
|
+
function colorOrNumberToRGBA(color) {
|
|
1334
|
+
if (typeof color === "number") {
|
|
1335
|
+
return colorToRGBA(colorNumberToHex(color));
|
|
1336
|
+
}
|
|
1337
|
+
return colorToRGBA(color);
|
|
1338
|
+
}
|
|
1328
1339
|
/**
|
|
1329
1340
|
* Will compare two color strings
|
|
1330
1341
|
* A tolerance can be provided to account for small differences that could
|
|
@@ -1606,6 +1617,8 @@
|
|
|
1606
1617
|
const sortedColorScalePoints = [...colorScalePoints.sort((a, b) => a.value - b.value)];
|
|
1607
1618
|
const thresholds = [];
|
|
1608
1619
|
for (let i = 1; i < sortedColorScalePoints.length; i++) {
|
|
1620
|
+
const minColorAlpha = colorOrNumberToRGBA(sortedColorScalePoints[i - 1].color).a;
|
|
1621
|
+
const maxColorAlpha = colorOrNumberToRGBA(sortedColorScalePoints[i].color).a;
|
|
1609
1622
|
const minColor = colorToNumber(sortedColorScalePoints[i - 1].color);
|
|
1610
1623
|
const maxColor = colorToNumber(sortedColorScalePoints[i].color);
|
|
1611
1624
|
thresholds.push({
|
|
@@ -1613,19 +1626,21 @@
|
|
|
1613
1626
|
max: sortedColorScalePoints[i].value,
|
|
1614
1627
|
minColor,
|
|
1615
1628
|
maxColor,
|
|
1629
|
+
minColorAlpha: minColorAlpha,
|
|
1630
|
+
maxColorAlpha: maxColorAlpha,
|
|
1616
1631
|
colorDiff: computeColorDiffUnits(sortedColorScalePoints[i - 1].value, sortedColorScalePoints[i].value, minColor, maxColor),
|
|
1617
1632
|
});
|
|
1618
1633
|
}
|
|
1619
1634
|
return (value) => {
|
|
1620
1635
|
if (value < thresholds[0].min) {
|
|
1621
|
-
return
|
|
1636
|
+
return colorNumberToHex(thresholds[0].minColor, thresholds[0].minColorAlpha);
|
|
1622
1637
|
}
|
|
1623
1638
|
for (const threshold of thresholds) {
|
|
1624
1639
|
if (value >= threshold.min && value <= threshold.max) {
|
|
1625
|
-
return
|
|
1640
|
+
return colorNumberToHex(colorCell(value, threshold.min, threshold.minColor, threshold.colorDiff), threshold.maxColorAlpha);
|
|
1626
1641
|
}
|
|
1627
1642
|
}
|
|
1628
|
-
return
|
|
1643
|
+
return colorNumberToHex(thresholds[thresholds.length - 1].maxColor, thresholds[thresholds.length - 1].maxColorAlpha);
|
|
1629
1644
|
};
|
|
1630
1645
|
}
|
|
1631
1646
|
function computeColorDiffUnits(minValue, maxValue, minColor, maxColor) {
|
|
@@ -19625,7 +19640,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
19625
19640
|
right: startingCol + offsetWidth - 1,
|
|
19626
19641
|
bottom: startingRow + offsetHeight - 1,
|
|
19627
19642
|
};
|
|
19628
|
-
const range = this.getters.getRangeFromZone(
|
|
19643
|
+
const range = this.getters.getRangeFromZone(sheetId, dependencyZone);
|
|
19629
19644
|
if (range.invalidXc || range.invalidSheetName) {
|
|
19630
19645
|
return new InvalidReferenceError();
|
|
19631
19646
|
}
|
|
@@ -22761,6 +22776,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
22761
22776
|
this.animationStore = useStore(ChartAnimationStore);
|
|
22762
22777
|
}
|
|
22763
22778
|
owl.onMounted(() => {
|
|
22779
|
+
registerChartJSExtensions();
|
|
22764
22780
|
const runtime = this.chartRuntime;
|
|
22765
22781
|
this.currentRuntime = runtime;
|
|
22766
22782
|
// Note: chartJS modify the runtime in place, so it's important to give it a copy
|
|
@@ -43816,7 +43832,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
43816
43832
|
env.openSidePanel("DataValidationEditor", {
|
|
43817
43833
|
rule: localizeDataValidationRule(rule, env.model.getters.getLocale()),
|
|
43818
43834
|
onExit: () => {
|
|
43819
|
-
env.
|
|
43835
|
+
env.replaceSidePanel("DataValidation", "DataValidationEditor");
|
|
43820
43836
|
},
|
|
43821
43837
|
});
|
|
43822
43838
|
},
|
|
@@ -51844,16 +51860,16 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
51844
51860
|
return cssPropertiesToCss(cellStyleToCss(rule.style));
|
|
51845
51861
|
}
|
|
51846
51862
|
else if (rule.type === "ColorScaleRule") {
|
|
51847
|
-
const minColor =
|
|
51848
|
-
const midColor = rule.midpoint ?
|
|
51849
|
-
const maxColor =
|
|
51863
|
+
const minColor = colorNumberToHex(rule.minimum.color);
|
|
51864
|
+
const midColor = rule.midpoint ? colorNumberToHex(rule.midpoint.color) : null;
|
|
51865
|
+
const maxColor = colorNumberToHex(rule.maximum.color);
|
|
51850
51866
|
const baseString = "background-image: linear-gradient(to right, ";
|
|
51851
51867
|
return midColor
|
|
51852
51868
|
? baseString + minColor + ", " + midColor + ", " + maxColor + ")"
|
|
51853
51869
|
: baseString + minColor + ", " + maxColor + ")";
|
|
51854
51870
|
}
|
|
51855
51871
|
else if (rule.type === "DataBarRule") {
|
|
51856
|
-
const color =
|
|
51872
|
+
const color = colorNumberToHex(rule.color);
|
|
51857
51873
|
return `background-image: linear-gradient(to right, ${color} 50%, white 50%)`;
|
|
51858
51874
|
}
|
|
51859
51875
|
return "";
|
|
@@ -52061,7 +52077,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52061
52077
|
icons = ICONS;
|
|
52062
52078
|
iconSets = ICON_SETS;
|
|
52063
52079
|
getTextDecoration = getTextDecoration;
|
|
52064
|
-
|
|
52080
|
+
colorNumberToHex = colorNumberToHex;
|
|
52065
52081
|
state;
|
|
52066
52082
|
setup() {
|
|
52067
52083
|
this.state = owl.useState({
|
|
@@ -52312,9 +52328,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52312
52328
|
}
|
|
52313
52329
|
getPreviewGradient() {
|
|
52314
52330
|
const rule = this.state.rules.colorScale;
|
|
52315
|
-
const minColor =
|
|
52316
|
-
const midColor =
|
|
52317
|
-
const maxColor =
|
|
52331
|
+
const minColor = colorNumberToHex(rule.minimum.color);
|
|
52332
|
+
const midColor = colorNumberToHex(rule.midpoint?.color || DEFAULT_COLOR_SCALE_MIDPOINT_COLOR);
|
|
52333
|
+
const maxColor = colorNumberToHex(rule.maximum.color);
|
|
52318
52334
|
const baseString = "background-image: linear-gradient(to right, ";
|
|
52319
52335
|
return rule.midpoint === undefined
|
|
52320
52336
|
? baseString + minColor + ", " + maxColor + ")"
|
|
@@ -52322,8 +52338,8 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
52322
52338
|
}
|
|
52323
52339
|
getThresholdColor(threshold) {
|
|
52324
52340
|
return threshold
|
|
52325
|
-
?
|
|
52326
|
-
:
|
|
52341
|
+
? colorNumberToHex(threshold.color)
|
|
52342
|
+
: colorNumberToHex(DEFAULT_COLOR_SCALE_MIDPOINT_COLOR);
|
|
52327
52343
|
}
|
|
52328
52344
|
onMidpointChange(ev) {
|
|
52329
52345
|
const type = ev.target.value;
|
|
@@ -53636,11 +53652,15 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
53636
53652
|
this.store = useLocalStore(PivotMeasureDisplayPanelStore, this.props.pivotId, this.props.measure);
|
|
53637
53653
|
}
|
|
53638
53654
|
onSave() {
|
|
53639
|
-
this.env.
|
|
53655
|
+
this.env.replaceSidePanel("PivotSidePanel", `pivot_measure_display_${this.props.pivotId}_${this.props.measure.id}`, {
|
|
53656
|
+
pivotId: this.props.pivotId,
|
|
53657
|
+
});
|
|
53640
53658
|
}
|
|
53641
53659
|
onCancel() {
|
|
53642
53660
|
this.store.cancelMeasureDisplayEdition();
|
|
53643
|
-
this.env.
|
|
53661
|
+
this.env.replaceSidePanel("PivotSidePanel", `pivot_measure_display_${this.props.pivotId}_${this.props.measure.id}`, {
|
|
53662
|
+
pivotId: this.props.pivotId,
|
|
53663
|
+
});
|
|
53644
53664
|
}
|
|
53645
53665
|
get fieldChoices() {
|
|
53646
53666
|
return this.store.fields.map((field) => ({
|
|
@@ -54102,7 +54122,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54102
54122
|
});
|
|
54103
54123
|
}
|
|
54104
54124
|
openShowValuesAs() {
|
|
54105
|
-
this.env.
|
|
54125
|
+
this.env.replaceSidePanel("PivotMeasureDisplayPanel", `pivot_key_${this.props.pivotId}`, {
|
|
54106
54126
|
pivotId: this.props.pivotId,
|
|
54107
54127
|
measure: this.props.measure,
|
|
54108
54128
|
});
|
|
@@ -54362,7 +54382,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
54362
54382
|
this.props.onDimensionsUpdated(update);
|
|
54363
54383
|
}
|
|
54364
54384
|
getMeasureId(fieldName, aggregator) {
|
|
54365
|
-
const baseId = fieldName + (aggregator ? `:${aggregator}` : "");
|
|
54385
|
+
const baseId = fieldName.replaceAll("'", "") + (aggregator ? `:${aggregator}` : "");
|
|
54366
54386
|
let id = baseId;
|
|
54367
54387
|
let i = 2;
|
|
54368
54388
|
while (this.props.definition.measures.some((m) => m.id === id)) {
|
|
@@ -57201,7 +57221,11 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57201
57221
|
try {
|
|
57202
57222
|
// This will throw if the pivot or measure does not exist
|
|
57203
57223
|
getters.getPivot(props.pivotId).getMeasure(props.measure.id);
|
|
57204
|
-
return {
|
|
57224
|
+
return {
|
|
57225
|
+
isOpen: true,
|
|
57226
|
+
props,
|
|
57227
|
+
key: `pivot_measure_display_${props.pivotId}_${props.measure.id}`,
|
|
57228
|
+
};
|
|
57205
57229
|
}
|
|
57206
57230
|
catch (e) {
|
|
57207
57231
|
return { isOpen: false };
|
|
@@ -57226,6 +57250,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57226
57250
|
class SidePanelStore extends SpreadsheetStore {
|
|
57227
57251
|
mutators = [
|
|
57228
57252
|
"open",
|
|
57253
|
+
"replace",
|
|
57229
57254
|
"toggle",
|
|
57230
57255
|
"close",
|
|
57231
57256
|
"changePanelSize",
|
|
@@ -57287,8 +57312,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57287
57312
|
if (!state.isOpen) {
|
|
57288
57313
|
return;
|
|
57289
57314
|
}
|
|
57290
|
-
|
|
57291
|
-
if (!this.mainPanel || !this.mainPanel.isPinned || mainPanelKey === state.key) {
|
|
57315
|
+
if (!this.mainPanel || !this.mainPanel.isPinned || this.mainPanelKey === state.key) {
|
|
57292
57316
|
this._openPanel("mainPanel", newPanelInfo, state);
|
|
57293
57317
|
return;
|
|
57294
57318
|
}
|
|
@@ -57307,6 +57331,34 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57307
57331
|
}
|
|
57308
57332
|
this._openPanel("secondaryPanel", newPanelInfo, state);
|
|
57309
57333
|
}
|
|
57334
|
+
replace(componentTag, currentPanelKey, initialPanelProps = {}) {
|
|
57335
|
+
const newPanelInfo = { initialPanelProps, componentTag, size: DEFAULT_SIDE_PANEL_SIZE };
|
|
57336
|
+
const state = this.computeState(newPanelInfo);
|
|
57337
|
+
if (!state.isOpen) {
|
|
57338
|
+
return;
|
|
57339
|
+
}
|
|
57340
|
+
const ensureMainPanelExpanded = () => {
|
|
57341
|
+
if (this.mainPanel?.isCollapsed) {
|
|
57342
|
+
this.toggleCollapsePanel("mainPanel");
|
|
57343
|
+
}
|
|
57344
|
+
};
|
|
57345
|
+
// Close the current panel if the target panel is already open
|
|
57346
|
+
const isMainPanel = this.mainPanelKey === state.key;
|
|
57347
|
+
const isSecondaryPanel = this.secondaryPanelKey === state.key;
|
|
57348
|
+
if (isMainPanel && this.secondaryPanel) {
|
|
57349
|
+
this.close();
|
|
57350
|
+
ensureMainPanelExpanded();
|
|
57351
|
+
return;
|
|
57352
|
+
}
|
|
57353
|
+
if (isSecondaryPanel) {
|
|
57354
|
+
this.closeMainPanel();
|
|
57355
|
+
this.togglePinPanel();
|
|
57356
|
+
ensureMainPanelExpanded();
|
|
57357
|
+
return;
|
|
57358
|
+
}
|
|
57359
|
+
const targetPanel = this.mainPanelKey === currentPanelKey ? "mainPanel" : "secondaryPanel";
|
|
57360
|
+
this._openPanel(targetPanel, newPanelInfo, state);
|
|
57361
|
+
}
|
|
57310
57362
|
_openPanel(panel, newPanel, state) {
|
|
57311
57363
|
const currentPanel = this[panel];
|
|
57312
57364
|
if (currentPanel && newPanel.componentTag !== currentPanel.componentTag) {
|
|
@@ -57366,11 +57418,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
57366
57418
|
panelInfo.size = size;
|
|
57367
57419
|
}
|
|
57368
57420
|
resetPanelSize(panel) {
|
|
57369
|
-
|
|
57370
|
-
|
|
57371
|
-
return;
|
|
57421
|
+
if (this[panel]) {
|
|
57422
|
+
this[panel].size = DEFAULT_SIDE_PANEL_SIZE;
|
|
57372
57423
|
}
|
|
57373
|
-
panelInfo.size = DEFAULT_SIDE_PANEL_SIZE;
|
|
57374
57424
|
}
|
|
57375
57425
|
togglePinPanel() {
|
|
57376
57426
|
if (!this.mainPanel) {
|
|
@@ -66546,9 +66596,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66546
66596
|
formatColors.push(rule.style.fillColor);
|
|
66547
66597
|
}
|
|
66548
66598
|
else if (rule.type === "ColorScaleRule") {
|
|
66549
|
-
formatColors.push(
|
|
66550
|
-
formatColors.push(rule.midpoint ?
|
|
66551
|
-
formatColors.push(
|
|
66599
|
+
formatColors.push(colorNumberToHex(rule.minimum.color));
|
|
66600
|
+
formatColors.push(rule.midpoint ? colorNumberToHex(rule.midpoint.color) : undefined);
|
|
66601
|
+
formatColors.push(colorNumberToHex(rule.maximum.color));
|
|
66552
66602
|
}
|
|
66553
66603
|
}
|
|
66554
66604
|
return formatColors.filter(isDefined);
|
|
@@ -66919,7 +66969,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
66919
66969
|
if (!computedDataBars[col])
|
|
66920
66970
|
computedDataBars[col] = [];
|
|
66921
66971
|
computedDataBars[col][row] = {
|
|
66922
|
-
color:
|
|
66972
|
+
color: colorNumberToHex(color),
|
|
66923
66973
|
percentage: (cell.value * 100) / max,
|
|
66924
66974
|
};
|
|
66925
66975
|
}
|
|
@@ -77764,9 +77814,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
77764
77814
|
}
|
|
77765
77815
|
if (!(xc in clickableCells[sheetId])) {
|
|
77766
77816
|
const clickableCell = this.findClickableItem(position);
|
|
77767
|
-
|
|
77768
|
-
clickableCells[sheetId][xc] = clickableCell;
|
|
77769
|
-
}
|
|
77817
|
+
clickableCells[sheetId][xc] = clickableCell;
|
|
77770
77818
|
}
|
|
77771
77819
|
return clickableCells[sheetId][xc];
|
|
77772
77820
|
}
|
|
@@ -79936,7 +79984,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
79936
79984
|
}
|
|
79937
79985
|
}
|
|
79938
79986
|
|
|
79939
|
-
.o-spreadsheet-topbar-wrapper,
|
|
79940
79987
|
.o-spreadsheet-bottombar-wrapper {
|
|
79941
79988
|
z-index: ${ComponentsImportance.ScrollBar + 1};
|
|
79942
79989
|
}
|
|
@@ -80009,6 +80056,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
80009
80056
|
loadLocales: this.model.config.external.loadLocales,
|
|
80010
80057
|
isDashboard: () => this.model.getters.isDashboard(),
|
|
80011
80058
|
openSidePanel: this.sidePanel.open.bind(this.sidePanel),
|
|
80059
|
+
replaceSidePanel: this.sidePanel.replace.bind(this.sidePanel),
|
|
80012
80060
|
toggleSidePanel: this.sidePanel.toggle.bind(this.sidePanel),
|
|
80013
80061
|
clipboard: this.env.clipboard || instantiateClipboard(),
|
|
80014
80062
|
startCellEdition: (content) => this.composerFocusStore.focusActiveComposer({ content }),
|
|
@@ -80051,7 +80099,6 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
80051
80099
|
this.checkViewportSize();
|
|
80052
80100
|
stores.on("store-updated", this, render);
|
|
80053
80101
|
resizeObserver.observe(this.spreadsheetRef.el);
|
|
80054
|
-
registerChartJSExtensions();
|
|
80055
80102
|
});
|
|
80056
80103
|
owl.onWillUnmount(() => {
|
|
80057
80104
|
this.unbindModelEvents();
|
|
@@ -82584,7 +82631,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
82584
82631
|
<dataBar>
|
|
82585
82632
|
<cfvo type="min" val="0"/>
|
|
82586
82633
|
<cfvo type="max" val="100"/>
|
|
82587
|
-
<color rgb="${toXlsxHexColor(
|
|
82634
|
+
<color rgb="${toXlsxHexColor(colorNumberToHex(rule.color))}"/>
|
|
82588
82635
|
</dataBar>
|
|
82589
82636
|
</cfRule>
|
|
82590
82637
|
</conditionalFormatting>
|
|
@@ -82612,7 +82659,7 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
82612
82659
|
continue;
|
|
82613
82660
|
}
|
|
82614
82661
|
cfValueObject.push(thresholdAttributes(threshold, position));
|
|
82615
|
-
colors.push([["rgb", toXlsxHexColor(
|
|
82662
|
+
colors.push([["rgb", toXlsxHexColor(colorNumberToHex(threshold.color))]]);
|
|
82616
82663
|
}
|
|
82617
82664
|
if (!canExport) {
|
|
82618
82665
|
console.warn("Conditional formats with formula rules are not supported at the moment. The rule is therefore skipped.");
|
|
@@ -84671,9 +84718,9 @@ stores.inject(MyMetaStore, storeInstance);
|
|
|
84671
84718
|
exports.tokenize = tokenize;
|
|
84672
84719
|
|
|
84673
84720
|
|
|
84674
|
-
__info__.version = "18.4.
|
|
84675
|
-
__info__.date = "2025-
|
|
84676
|
-
__info__.hash = "
|
|
84721
|
+
__info__.version = "18.4.6";
|
|
84722
|
+
__info__.date = "2025-08-18T08:16:33.453Z";
|
|
84723
|
+
__info__.hash = "9c7c143";
|
|
84677
84724
|
|
|
84678
84725
|
|
|
84679
84726
|
})(this.o_spreadsheet = this.o_spreadsheet || {}, owl);
|