@odoo/o-spreadsheet 18.0.2 → 18.0.3
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 +53 -24
- package/dist/o-spreadsheet.d.ts +28 -0
- package/dist/o-spreadsheet.esm.js +53 -24
- package/dist/o-spreadsheet.iife.js +53 -24
- package/dist/o-spreadsheet.iife.min.js +7 -7
- package/dist/o_spreadsheet.xml +5 -5
- 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.0.
|
|
6
|
-
* @date 2024-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.3
|
|
6
|
+
* @date 2024-11-08T12:17:49.992Z
|
|
7
|
+
* @hash 5fa5fbb
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
'use strict';
|
|
@@ -9346,14 +9346,19 @@ function interpolateData(config, values, labels, newLabels) {
|
|
|
9346
9346
|
if (values.length < 2 || labels.length < 2 || newLabels.length === 0) {
|
|
9347
9347
|
return [];
|
|
9348
9348
|
}
|
|
9349
|
+
const labelMin = Math.min(...labels);
|
|
9350
|
+
const labelMax = Math.max(...labels);
|
|
9351
|
+
const labelRange = labelMax - labelMin;
|
|
9352
|
+
const normalizedLabels = labels.map((v) => (v - labelMin) / labelRange);
|
|
9353
|
+
const normalizedNewLabels = newLabels.map((v) => (v - labelMin) / labelRange);
|
|
9349
9354
|
switch (config.type) {
|
|
9350
9355
|
case "polynomial": {
|
|
9351
9356
|
const order = config.order ?? 2;
|
|
9352
9357
|
if (order === 1) {
|
|
9353
|
-
return predictLinearValues([values], [
|
|
9358
|
+
return predictLinearValues([values], [normalizedLabels], [normalizedNewLabels], true)[0];
|
|
9354
9359
|
}
|
|
9355
|
-
const coeffs = polynomialRegression(values,
|
|
9356
|
-
return
|
|
9360
|
+
const coeffs = polynomialRegression(values, normalizedLabels, order, true).flat();
|
|
9361
|
+
return normalizedNewLabels.map((v) => evaluatePolynomial(coeffs, v, order));
|
|
9357
9362
|
}
|
|
9358
9363
|
case "exponential": {
|
|
9359
9364
|
const positiveLogValues = [];
|
|
@@ -9361,16 +9366,16 @@ function interpolateData(config, values, labels, newLabels) {
|
|
|
9361
9366
|
for (let i = 0; i < values.length; i++) {
|
|
9362
9367
|
if (values[i] > 0) {
|
|
9363
9368
|
positiveLogValues.push(Math.log(values[i]));
|
|
9364
|
-
filteredLabels.push(
|
|
9369
|
+
filteredLabels.push(normalizedLabels[i]);
|
|
9365
9370
|
}
|
|
9366
9371
|
}
|
|
9367
9372
|
if (!filteredLabels.length) {
|
|
9368
9373
|
return [];
|
|
9369
9374
|
}
|
|
9370
|
-
return expM(predictLinearValues([positiveLogValues], [filteredLabels], [
|
|
9375
|
+
return expM(predictLinearValues([positiveLogValues], [filteredLabels], [normalizedNewLabels], true))[0];
|
|
9371
9376
|
}
|
|
9372
9377
|
case "logarithmic": {
|
|
9373
|
-
return predictLinearValues([values], logM([
|
|
9378
|
+
return predictLinearValues([values], logM([normalizedLabels]), logM([normalizedNewLabels]), true)[0];
|
|
9374
9379
|
}
|
|
9375
9380
|
default:
|
|
9376
9381
|
return [];
|
|
@@ -9506,6 +9511,10 @@ function drawHorizontalBarChartValues(chart, options, ctx) {
|
|
|
9506
9511
|
function drawPieChartValues(chart, options, ctx) {
|
|
9507
9512
|
for (const dataset of chart._metasets) {
|
|
9508
9513
|
for (let i = 0; i < dataset._parsed.length; i++) {
|
|
9514
|
+
const value = Number(dataset._parsed[i]);
|
|
9515
|
+
if (isNaN(value) || value === 0) {
|
|
9516
|
+
continue;
|
|
9517
|
+
}
|
|
9509
9518
|
const bar = dataset.data[i];
|
|
9510
9519
|
const { startAngle, endAngle, innerRadius, outerRadius } = bar;
|
|
9511
9520
|
const midAngle = (startAngle + endAngle) / 2;
|
|
@@ -9514,8 +9523,8 @@ function drawPieChartValues(chart, options, ctx) {
|
|
|
9514
9523
|
const y = bar.y + midRadius * Math.sin(midAngle) + 7;
|
|
9515
9524
|
ctx.fillStyle = chartFontColor(options.background);
|
|
9516
9525
|
ctx.strokeStyle = options.background || "#ffffff";
|
|
9517
|
-
const
|
|
9518
|
-
drawTextWithBackground(
|
|
9526
|
+
const displayValue = options.callback(value);
|
|
9527
|
+
drawTextWithBackground(displayValue, x, y, ctx);
|
|
9519
9528
|
}
|
|
9520
9529
|
}
|
|
9521
9530
|
}
|
|
@@ -14594,7 +14603,7 @@ const FILTER = {
|
|
|
14594
14603
|
const result = [];
|
|
14595
14604
|
for (let i = 0; i < _array.length; i++) {
|
|
14596
14605
|
const row = _array[i];
|
|
14597
|
-
if (_conditions.every((c) => c[i])) {
|
|
14606
|
+
if (_conditions.every((c) => (typeof c[i] === "boolean" || typeof c[i] === "number") && c[i])) {
|
|
14598
14607
|
result.push(row);
|
|
14599
14608
|
}
|
|
14600
14609
|
}
|
|
@@ -16989,7 +16998,10 @@ function parseOperand(tokens) {
|
|
|
16989
16998
|
case "STRING":
|
|
16990
16999
|
return { type: "STRING", value: removeStringQuotes(current.value) };
|
|
16991
17000
|
case "INVALID_REFERENCE":
|
|
16992
|
-
|
|
17001
|
+
return {
|
|
17002
|
+
type: "REFERENCE",
|
|
17003
|
+
value: CellErrorType.InvalidReference,
|
|
17004
|
+
};
|
|
16993
17005
|
case "REFERENCE":
|
|
16994
17006
|
if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
|
|
16995
17007
|
tokens.shift();
|
|
@@ -27873,6 +27885,7 @@ const ChartTerms = {
|
|
|
27873
27885
|
StackedBarChart: _t("Stacked bar chart"),
|
|
27874
27886
|
StackedLineChart: _t("Stacked line chart"),
|
|
27875
27887
|
StackedAreaChart: _t("Stacked area chart"),
|
|
27888
|
+
StackedColumnChart: _t("Stacked column chart"),
|
|
27876
27889
|
CumulativeData: _t("Cumulative data"),
|
|
27877
27890
|
TreatLabelsAsText: _t("Treat labels as text"),
|
|
27878
27891
|
AggregatedChart: _t("Aggregate"),
|
|
@@ -28811,8 +28824,8 @@ function getTrendDatasetForLineChart(config, dataset, axisType, locale) {
|
|
|
28811
28824
|
break;
|
|
28812
28825
|
case "time":
|
|
28813
28826
|
for (const point of dataset.data) {
|
|
28814
|
-
const date =
|
|
28815
|
-
if (
|
|
28827
|
+
const date = toNumber({ value: point.x }, locale);
|
|
28828
|
+
if (point.y !== null) {
|
|
28816
28829
|
filteredValues.push(point.y);
|
|
28817
28830
|
filteredLabels.push(date);
|
|
28818
28831
|
}
|
|
@@ -29044,10 +29057,6 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
29044
29057
|
return {
|
|
29045
29058
|
chartJsConfig: config,
|
|
29046
29059
|
background: chart.background || BACKGROUND_CHART_COLOR,
|
|
29047
|
-
dataSetsValues,
|
|
29048
|
-
labelValues,
|
|
29049
|
-
dataSetFormat,
|
|
29050
|
-
labelFormat,
|
|
29051
29060
|
};
|
|
29052
29061
|
}
|
|
29053
29062
|
|
|
@@ -36282,6 +36291,12 @@ class GenericChartConfigPanel extends owl.Component {
|
|
|
36282
36291
|
|
|
36283
36292
|
class BarConfigPanel extends GenericChartConfigPanel {
|
|
36284
36293
|
static template = "o-spreadsheet-BarConfigPanel";
|
|
36294
|
+
get stackedLabel() {
|
|
36295
|
+
const definition = this.props.definition;
|
|
36296
|
+
return definition.horizontal
|
|
36297
|
+
? this.chartTerms.StackedBarChart
|
|
36298
|
+
: this.chartTerms.StackedColumnChart;
|
|
36299
|
+
}
|
|
36285
36300
|
onUpdateStacked(stacked) {
|
|
36286
36301
|
this.props.updateChart(this.props.figureId, {
|
|
36287
36302
|
stacked,
|
|
@@ -37604,7 +37619,9 @@ class LineConfigPanel extends GenericChartConfigPanel {
|
|
|
37604
37619
|
}
|
|
37605
37620
|
get stackedLabel() {
|
|
37606
37621
|
const definition = this.props.definition;
|
|
37607
|
-
return definition.fillArea
|
|
37622
|
+
return definition.fillArea
|
|
37623
|
+
? this.chartTerms.StackedAreaChart
|
|
37624
|
+
: this.chartTerms.StackedLineChart;
|
|
37608
37625
|
}
|
|
37609
37626
|
getLabelRangeOptions() {
|
|
37610
37627
|
const options = super.getLabelRangeOptions();
|
|
@@ -59618,6 +59635,10 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
59618
59635
|
if (!pivot.isValid()) {
|
|
59619
59636
|
return EMPTY_PIVOT_CELL;
|
|
59620
59637
|
}
|
|
59638
|
+
if (functionName === "PIVOT" &&
|
|
59639
|
+
!cell.content.replaceAll(" ", "").toUpperCase().startsWith("=PIVOT")) {
|
|
59640
|
+
return EMPTY_PIVOT_CELL;
|
|
59641
|
+
}
|
|
59621
59642
|
if (functionName === "PIVOT") {
|
|
59622
59643
|
const includeTotal = args[2] === false ? false : undefined;
|
|
59623
59644
|
const includeColumnHeaders = args[3] === false ? false : undefined;
|
|
@@ -70391,7 +70412,8 @@ function addFormula(cell) {
|
|
|
70391
70412
|
}
|
|
70392
70413
|
const attrs = [["t", type]];
|
|
70393
70414
|
const XlsxFormula = adaptFormulaToExcel(formula);
|
|
70394
|
-
const
|
|
70415
|
+
const exportedValue = adaptFormulaValueToExcel(cell.value);
|
|
70416
|
+
const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
|
|
70395
70417
|
return { attrs, node };
|
|
70396
70418
|
}
|
|
70397
70419
|
function addContent(content, sharedStrings, forceString = false) {
|
|
@@ -70426,8 +70448,14 @@ function adaptFormulaToExcel(formulaText) {
|
|
|
70426
70448
|
ast = addMissingRequiredArgs(ast);
|
|
70427
70449
|
return ast;
|
|
70428
70450
|
});
|
|
70451
|
+
ast = convertAstNodes(ast, "REFERENCE", (ast) => {
|
|
70452
|
+
return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
|
|
70453
|
+
});
|
|
70429
70454
|
return ast ? astToFormula(ast) : formulaText;
|
|
70430
70455
|
}
|
|
70456
|
+
function adaptFormulaValueToExcel(formulaValue) {
|
|
70457
|
+
return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
|
|
70458
|
+
}
|
|
70431
70459
|
/**
|
|
70432
70460
|
* Some Excel function need required args that might not be mandatory in o-spreadsheet.
|
|
70433
70461
|
* This adds those missing args.
|
|
@@ -72402,6 +72430,7 @@ const constants = {
|
|
|
72402
72430
|
PIVOT_TABLE_CONFIG,
|
|
72403
72431
|
TREND_LINE_XAXIS_ID,
|
|
72404
72432
|
CHART_AXIS_CHOICES,
|
|
72433
|
+
ChartTerms,
|
|
72405
72434
|
};
|
|
72406
72435
|
|
|
72407
72436
|
exports.AbstractCellClipboardHandler = AbstractCellClipboardHandler;
|
|
@@ -72450,6 +72479,6 @@ exports.tokenColors = tokenColors;
|
|
|
72450
72479
|
exports.tokenize = tokenize;
|
|
72451
72480
|
|
|
72452
72481
|
|
|
72453
|
-
__info__.version = "18.0.
|
|
72454
|
-
__info__.date = "2024-
|
|
72455
|
-
__info__.hash = "
|
|
72482
|
+
__info__.version = "18.0.3";
|
|
72483
|
+
__info__.date = "2024-11-08T12:17:49.992Z";
|
|
72484
|
+
__info__.hash = "5fa5fbb";
|
package/dist/o-spreadsheet.d.ts
CHANGED
|
@@ -6881,6 +6881,7 @@ declare class GenericChartConfigPanel extends Component<Props$$, SpreadsheetChil
|
|
|
6881
6881
|
StackedBarChart: string;
|
|
6882
6882
|
StackedLineChart: string;
|
|
6883
6883
|
StackedAreaChart: string;
|
|
6884
|
+
StackedColumnChart: string;
|
|
6884
6885
|
CumulativeData: string;
|
|
6885
6886
|
TreatLabelsAsText: string;
|
|
6886
6887
|
AggregatedChart: string;
|
|
@@ -6932,6 +6933,7 @@ declare class GenericChartConfigPanel extends Component<Props$$, SpreadsheetChil
|
|
|
6932
6933
|
|
|
6933
6934
|
declare class BarConfigPanel extends GenericChartConfigPanel {
|
|
6934
6935
|
static template: string;
|
|
6936
|
+
get stackedLabel(): string;
|
|
6935
6937
|
onUpdateStacked(stacked: boolean): void;
|
|
6936
6938
|
onUpdateAggregated(aggregated: boolean): void;
|
|
6937
6939
|
}
|
|
@@ -12441,6 +12443,32 @@ declare const constants: {
|
|
|
12441
12443
|
value: string;
|
|
12442
12444
|
label: string;
|
|
12443
12445
|
}[];
|
|
12446
|
+
ChartTerms: {
|
|
12447
|
+
Series: string;
|
|
12448
|
+
BackgroundColor: string;
|
|
12449
|
+
StackedBarChart: string;
|
|
12450
|
+
StackedLineChart: string;
|
|
12451
|
+
StackedAreaChart: string;
|
|
12452
|
+
StackedColumnChart: string;
|
|
12453
|
+
CumulativeData: string;
|
|
12454
|
+
TreatLabelsAsText: string;
|
|
12455
|
+
AggregatedChart: string;
|
|
12456
|
+
Errors: {
|
|
12457
|
+
Unexpected: string;
|
|
12458
|
+
InvalidDataSet: string;
|
|
12459
|
+
InvalidLabelRange: string;
|
|
12460
|
+
InvalidScorecardKeyValue: string;
|
|
12461
|
+
InvalidScorecardBaseline: string;
|
|
12462
|
+
InvalidGaugeDataRange: string;
|
|
12463
|
+
EmptyGaugeRangeMin: string;
|
|
12464
|
+
GaugeRangeMinNaN: string;
|
|
12465
|
+
EmptyGaugeRangeMax: string;
|
|
12466
|
+
GaugeRangeMaxNaN: string;
|
|
12467
|
+
GaugeRangeMinBiggerThanRangeMax: string;
|
|
12468
|
+
GaugeLowerInflectionPointNaN: string;
|
|
12469
|
+
GaugeUpperInflectionPointNaN: string;
|
|
12470
|
+
};
|
|
12471
|
+
};
|
|
12444
12472
|
};
|
|
12445
12473
|
|
|
12446
12474
|
export { AST, ASTFuncall, AboveAverageRule, AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, ActivateNextSheetCommand, ActivatePreviousSheetCommand, ActivateSheetCommand, AddColumnsRowsCommand, AddConditionalFormatCommand, AddDataValidationCommand, AddFunctionDescription, AddMergeCommand, AddPivotCommand, Aggregator, Alias, Align, AlphanumericIncrementModifier, AnchorZone, ApplyRangeChange, ApplyRangeChangeResult, Arg, ArgDefinition, ArgType, AutoFillCellCommand, AutofillAutoCommand, AutofillCellData, AutofillCommand, AutofillData, AutofillModifier, AutofillModifierImplementation, AutofillResult, AutofillSelectCommand, AutofillTableCommand, AutoresizeColumnsCommand, AutoresizeRowsCommand, AxesDesign, AxisDesign, AxisType, BeginsWithRule, BooleanCell, Border$1 as Border, BorderData, BorderDescr, BorderDescription, BorderPosition, BorderStyle, Box, BoxTextContent, CHART_TYPES, CSSProperties, CancelledReason, Cell, CellData, CellErrorType, CellIsRule, CellPosition, CellValue, CellValueType, ChangeType, ChartCreationContext, ChartDefinition, ChartJSRuntime, ChartRuntime, ChartType, ChartWithAxisDefinition, CleanClipBoardHighlightCommand, ClearCellCommand, ClearCellsCommand, ClearFormattingCommand, Client, ClientId, ClientJoinedMessage, ClientLeftMessage, ClientMovedMessage, ClientPosition, ClipboardCell, ClipboardCellData, ClipboardContent, ClipboardData, ClipboardFigureData, ClipboardMIMEType, ClipboardOperation, ClipboardOptions, ClipboardPasteOptions, ClipboardPasteTarget, Cloneable, CollaborationMessage, CollaborativeEvent, CollaborativeEventReceived, CollaborativeEventTypes, Color, ColorScaleMidPointThreshold, ColorScaleRule, ColorScaleThreshold, ColorSheetCommand, Command, CommandDispatcher, CommandHandler, CommandResult, CommandTypes, CommonPivotCoreDefinition, CompiledFormula, ComposerFocusType, ComputeFunction, ComputedTableStyle, ConditionalFormat, ConditionalFormatInternal, ConditionalFormatRule, ConditionalFormatRuleInternal, ConditionalFormattingOperatorValues, ConsecutiveIndexes, ContainsTextRule, CopyCommand, CopyModifier, CopyPasteCellsAboveCommand, CopyPasteCellsOnLeftCommand, CoreCommand, CoreCommandDispatcher, CoreCommandTypes, CoreGetters, CorePlugin, CoreTable, CoreTableType, CoreViewCommand, CoreViewCommandTypes, CreateChartCommand, CreateFigureCommand, CreateImageOverCommand, CreateRevisionOptions, CreateSheetCommand, CreateTableCommand, CreateTableStyleCommand, Currency, CustomFormulaCriterion, CustomizedDataSet, CutCommand, DEFAULT_LOCALE, DEFAULT_LOCALES, DIRECTION, DOMCoordinates, DOMDimension, DataBarFill, DataBarRule, DataBarRuleInternal, DataSet, DataValidationCriterion, DataValidationCriterionType, DataValidationDateCriterion, DataValidationRule, DataValidationRuleData, DatasetDesign, DatasetValues, DateCriterionValue, DateIncrementModifier, DateIsAfterCriterion, DateIsBeforeCriterion, DateIsBetweenCriterion, DateIsCriterion, DateIsNotBetweenCriterion, DateIsOnOrAfterCriterion, DateIsOnOrBeforeCriterion, DateIsValidCriterion, DebouncedFunction, DeleteCellCommand, DeleteContentCommand, DeleteFigureCommand, DeleteSheetCommand, Dependencies, Dimension, DimensionTree, DimensionTreeNode, Direction$1 as Direction, DispatchResult, DuplicatePivotCommand, DuplicatePivotInNewSheetCommand, DuplicateSheetCommand, DynamicTable, EdgeScrollInfo, EditTextOptions, EditionMode, EmptyCell, EndsWithRule, EnrichedToken, EnsureRange, ErrorCell, EvalContext, EvaluateCellsCommand, EvaluatedCell, EvaluationError, ExcelCellData, ExcelChartDataset, ExcelChartDefinition, ExcelChartType, ExcelFigureSize, ExcelFilterData, ExcelHeaderData, ExcelSheetData, ExcelTableData, ExcelWorkbookData, ExpressionRule, Figure, FigureData, FigureSize, Filter, FilterId, FoldAllHeaderGroupsCommand, FoldHeaderGroupCommand, FoldHeaderGroupsInZoneCommand, Format, FormattedValue, FormulaCell, FormulaModifier, FormulaToExecute, FreezeColumnsCommand, FreezeRowsCommand, FunctionDescription, FunctionRegistry, FunctionResultNumber, FunctionResultObject, GeneratorCell, GetSymbolValue, Getters, Granularity, GridClickModifiers, GridRenderingContext, GroupHeadersCommand, HSLA, HeaderData, HeaderDimensions, HeaderGroup, HeaderIndex, HeadersDependentCommand, HideColumnsRowsCommand, HideSheetCommand, Highlight$1 as Highlight, HistoryChange, IconSet, IconSetRule, IconThreshold, Image, Immutable, Increment, IncrementModifier, InformationNotification, InitPivotParams, InsertCellCommand, InsertNewPivotCommand, InsertPivotCommand, InsertPivotWithTableCommand, IsBetweenCriterion, IsCheckboxCriterion, IsEqualCriterion, IsGreaterOrEqualToCriterion, IsGreaterThanCriterion, IsLessOrEqualToCriterion, IsLessThanCriterion, IsNotBetweenCriterion, IsNotEqualCriterion, IsValueInListCriterion, IsValueInRangeCriterion, LabelValues, LayerName, Lazy, Link, LiteralCell, LocalCommand, Locale, LocaleCode, LocaleFormat, Matrix, Maybe, MenuMouseEvent, Merge, Model, MoveColumnsRowsCommand, MoveConditionalFormatCommand, MoveRangeCommand, MoveSheetCommand, MoveViewportDownCommand, MoveViewportToCellCommand, MoveViewportUpCommand, NewLocalStateUpdateEvent, NotContainsTextRule, NotificationType, NumberCell, Offset, OperationSequenceNode, OrderedLayers, PaintFormat, PaneDivision, PasteCommand, PasteFromOSClipboardCommand, Pivot, PivotColRowDomain, PivotCoreDefinition, PivotCoreDimension, PivotCoreMeasure, PivotDimension$1 as PivotDimension, PivotDomain, PivotEmptyCell, PivotField, PivotFields, PivotHeaderCell, PivotMeasure, PivotMeasureDisplay, PivotMeasureDisplayType, PivotMeasureHeaderCell, PivotNode, PivotRuntimeDefinition, PivotTableCell, PivotTableColumn, PivotTableData, PivotTableRow, PivotTimeAdapter, PivotTimeAdapterNotNull, PivotValueCell, Pixel, PixelPosition, Position$1 as Position, PositionDependentCommand, PropsOf, RGBA, Range, RangeCompiledFormula, RangeData, RangePart, RangeProvider, RangesDependentCommand, Rect, RedoCommand, Ref, ReferenceDenormalizer, RefreshPivotCommand, Registry, RemoteRevisionMessage, RemoteRevisionReceivedEvent, RemoveColumnsRowsCommand, RemoveConditionalFormatCommand, RemoveDataValidationCommand, RemoveDuplicatesCommand, RemoveMergeCommand, RemovePivotCommand, RemoveTableCommand, RemoveTableStyleCommand, RenamePivotCommand, RenameSheetCommand, RepeatPasteCommand, ReplaceSearchCommand, RequestRedoCommand, RequestUndoCommand, ResizeColumnsRowsCommand, ResizeDirection, ResizeTableCommand, ResizeViewportCommand, Revision, RevisionAcknowledgedEvent, RevisionData, RevisionRedone, RevisionRedoneMessage, RevisionUndone, RevisionUndoneMessage, RevisionsDroppedEvent, Row, SPREADSHEET_DIMENSIONS, ScrollDirection$1 as ScrollDirection, SelectFigureCommand, Selection, SelectionStep, SetBorderCommand, SetContextualFormatCommand, SetDecimalCommand, SetDecimalStep, SetFormattingCommand, SetGridLinesVisibilityCommand, SetViewportOffsetCommand, SetZoneBordersCommand, Sheet, SheetDOMScrollInfo, SheetData, SheetDependentCommand, SheetScrollInfo, ShowFormulaCommand, ShowSheetCommand, SingleColorRule, SingleColorRules, SnapshotEvent, SortCommand, SortDirection, SortOptions, SplitPivotFormulaCommand, SplitTextIntoColumnsCommand, Spreadsheet, SpreadsheetChildEnv, SpreadsheetPivotCoreDefinition, SpreadsheetPivotTable, StartChangeHighlightCommand, StartCommand, StaticTable, StoreConstructor, StoreParams, Style, SumSelectionCommand, Table, TableBorder, TableConfig, TableData, TableElementStyle, TableId, TableStyle, TableStyleData, TableStyleTemplateName, TargetDependentCommand, TechnicalName, TextCell, TextContainsCriterion, TextIsCriterion, TextIsEmailCriterion, TextIsLinkCriterion, TextNotContainsCriterion, TextRule, ThresholdType, TimePeriodRule, TitleDesign, Token, Tooltip, Top10Rule, Transformation, TransformationFactory, TransportService, TrendConfiguration, TrendType, TrimWhitespaceCommand, UID, UIPlugin, UnGroupHeadersCommand, UnboundedZone, UndoCommand, UnexpectedRevisionIdEvent, UnfoldAllHeaderGroupsCommand, UnfoldHeaderGroupCommand, UnfoldHeaderGroupsInZoneCommand, UnfreezeColumnsCommand, UnfreezeColumnsRowsCommand, UnfreezeRowsCommand, UnhideColumnsRowsCommand, UpdateCellCommand, UpdateCellData, UpdateCellPositionCommand, UpdateChartCommand, UpdateFigureCommand, UpdateFilterCommand, UpdateLocaleCommand, UpdatePivotCommand, UpdateTableCommand, Validation, VerticalAlign, Viewport, WorkbookData, WorkbookHistory, Wrapping, Zone, ZoneDependentCommand, ZoneDimension, __info__, addFunction, addRenderingLayer, astToFormula, borderStyles, canExecuteInReadonly, compile, compileTokens, components, constants, containsBlanksRule, containsErrorsRule, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateBordersCommands, invalidateCFEvaluationCommands, invalidateChartEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, isCoreCommand, isHeadersDependant, isMatrix, isPositionDependent, isRangeDependant, isSheetDependent, isTargetDependent, isZoneDependent, iterateAstNodes, links, load, notContainsBlanksRule, notContainsErrorsRule, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
@@ -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.0.
|
|
6
|
-
* @date 2024-
|
|
7
|
-
* @hash
|
|
5
|
+
* @version 18.0.3
|
|
6
|
+
* @date 2024-11-08T12:17:49.992Z
|
|
7
|
+
* @hash 5fa5fbb
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { useEnv, useSubEnv, onWillUnmount, useComponent, status, Component, useRef, onMounted, useEffect, useState, onPatched, onWillPatch, onWillUpdateProps, useExternalListener, onWillStart, xml, useChildSubEnv, markRaw, toRaw } from '@odoo/owl';
|
|
@@ -9344,14 +9344,19 @@ function interpolateData(config, values, labels, newLabels) {
|
|
|
9344
9344
|
if (values.length < 2 || labels.length < 2 || newLabels.length === 0) {
|
|
9345
9345
|
return [];
|
|
9346
9346
|
}
|
|
9347
|
+
const labelMin = Math.min(...labels);
|
|
9348
|
+
const labelMax = Math.max(...labels);
|
|
9349
|
+
const labelRange = labelMax - labelMin;
|
|
9350
|
+
const normalizedLabels = labels.map((v) => (v - labelMin) / labelRange);
|
|
9351
|
+
const normalizedNewLabels = newLabels.map((v) => (v - labelMin) / labelRange);
|
|
9347
9352
|
switch (config.type) {
|
|
9348
9353
|
case "polynomial": {
|
|
9349
9354
|
const order = config.order ?? 2;
|
|
9350
9355
|
if (order === 1) {
|
|
9351
|
-
return predictLinearValues([values], [
|
|
9356
|
+
return predictLinearValues([values], [normalizedLabels], [normalizedNewLabels], true)[0];
|
|
9352
9357
|
}
|
|
9353
|
-
const coeffs = polynomialRegression(values,
|
|
9354
|
-
return
|
|
9358
|
+
const coeffs = polynomialRegression(values, normalizedLabels, order, true).flat();
|
|
9359
|
+
return normalizedNewLabels.map((v) => evaluatePolynomial(coeffs, v, order));
|
|
9355
9360
|
}
|
|
9356
9361
|
case "exponential": {
|
|
9357
9362
|
const positiveLogValues = [];
|
|
@@ -9359,16 +9364,16 @@ function interpolateData(config, values, labels, newLabels) {
|
|
|
9359
9364
|
for (let i = 0; i < values.length; i++) {
|
|
9360
9365
|
if (values[i] > 0) {
|
|
9361
9366
|
positiveLogValues.push(Math.log(values[i]));
|
|
9362
|
-
filteredLabels.push(
|
|
9367
|
+
filteredLabels.push(normalizedLabels[i]);
|
|
9363
9368
|
}
|
|
9364
9369
|
}
|
|
9365
9370
|
if (!filteredLabels.length) {
|
|
9366
9371
|
return [];
|
|
9367
9372
|
}
|
|
9368
|
-
return expM(predictLinearValues([positiveLogValues], [filteredLabels], [
|
|
9373
|
+
return expM(predictLinearValues([positiveLogValues], [filteredLabels], [normalizedNewLabels], true))[0];
|
|
9369
9374
|
}
|
|
9370
9375
|
case "logarithmic": {
|
|
9371
|
-
return predictLinearValues([values], logM([
|
|
9376
|
+
return predictLinearValues([values], logM([normalizedLabels]), logM([normalizedNewLabels]), true)[0];
|
|
9372
9377
|
}
|
|
9373
9378
|
default:
|
|
9374
9379
|
return [];
|
|
@@ -9504,6 +9509,10 @@ function drawHorizontalBarChartValues(chart, options, ctx) {
|
|
|
9504
9509
|
function drawPieChartValues(chart, options, ctx) {
|
|
9505
9510
|
for (const dataset of chart._metasets) {
|
|
9506
9511
|
for (let i = 0; i < dataset._parsed.length; i++) {
|
|
9512
|
+
const value = Number(dataset._parsed[i]);
|
|
9513
|
+
if (isNaN(value) || value === 0) {
|
|
9514
|
+
continue;
|
|
9515
|
+
}
|
|
9507
9516
|
const bar = dataset.data[i];
|
|
9508
9517
|
const { startAngle, endAngle, innerRadius, outerRadius } = bar;
|
|
9509
9518
|
const midAngle = (startAngle + endAngle) / 2;
|
|
@@ -9512,8 +9521,8 @@ function drawPieChartValues(chart, options, ctx) {
|
|
|
9512
9521
|
const y = bar.y + midRadius * Math.sin(midAngle) + 7;
|
|
9513
9522
|
ctx.fillStyle = chartFontColor(options.background);
|
|
9514
9523
|
ctx.strokeStyle = options.background || "#ffffff";
|
|
9515
|
-
const
|
|
9516
|
-
drawTextWithBackground(
|
|
9524
|
+
const displayValue = options.callback(value);
|
|
9525
|
+
drawTextWithBackground(displayValue, x, y, ctx);
|
|
9517
9526
|
}
|
|
9518
9527
|
}
|
|
9519
9528
|
}
|
|
@@ -14592,7 +14601,7 @@ const FILTER = {
|
|
|
14592
14601
|
const result = [];
|
|
14593
14602
|
for (let i = 0; i < _array.length; i++) {
|
|
14594
14603
|
const row = _array[i];
|
|
14595
|
-
if (_conditions.every((c) => c[i])) {
|
|
14604
|
+
if (_conditions.every((c) => (typeof c[i] === "boolean" || typeof c[i] === "number") && c[i])) {
|
|
14596
14605
|
result.push(row);
|
|
14597
14606
|
}
|
|
14598
14607
|
}
|
|
@@ -16987,7 +16996,10 @@ function parseOperand(tokens) {
|
|
|
16987
16996
|
case "STRING":
|
|
16988
16997
|
return { type: "STRING", value: removeStringQuotes(current.value) };
|
|
16989
16998
|
case "INVALID_REFERENCE":
|
|
16990
|
-
|
|
16999
|
+
return {
|
|
17000
|
+
type: "REFERENCE",
|
|
17001
|
+
value: CellErrorType.InvalidReference,
|
|
17002
|
+
};
|
|
16991
17003
|
case "REFERENCE":
|
|
16992
17004
|
if (tokens[0]?.value === ":" && tokens[1]?.type === "REFERENCE") {
|
|
16993
17005
|
tokens.shift();
|
|
@@ -27871,6 +27883,7 @@ const ChartTerms = {
|
|
|
27871
27883
|
StackedBarChart: _t("Stacked bar chart"),
|
|
27872
27884
|
StackedLineChart: _t("Stacked line chart"),
|
|
27873
27885
|
StackedAreaChart: _t("Stacked area chart"),
|
|
27886
|
+
StackedColumnChart: _t("Stacked column chart"),
|
|
27874
27887
|
CumulativeData: _t("Cumulative data"),
|
|
27875
27888
|
TreatLabelsAsText: _t("Treat labels as text"),
|
|
27876
27889
|
AggregatedChart: _t("Aggregate"),
|
|
@@ -28809,8 +28822,8 @@ function getTrendDatasetForLineChart(config, dataset, axisType, locale) {
|
|
|
28809
28822
|
break;
|
|
28810
28823
|
case "time":
|
|
28811
28824
|
for (const point of dataset.data) {
|
|
28812
|
-
const date =
|
|
28813
|
-
if (
|
|
28825
|
+
const date = toNumber({ value: point.x }, locale);
|
|
28826
|
+
if (point.y !== null) {
|
|
28814
28827
|
filteredValues.push(point.y);
|
|
28815
28828
|
filteredLabels.push(date);
|
|
28816
28829
|
}
|
|
@@ -29042,10 +29055,6 @@ function createLineOrScatterChartRuntime(chart, getters) {
|
|
|
29042
29055
|
return {
|
|
29043
29056
|
chartJsConfig: config,
|
|
29044
29057
|
background: chart.background || BACKGROUND_CHART_COLOR,
|
|
29045
|
-
dataSetsValues,
|
|
29046
|
-
labelValues,
|
|
29047
|
-
dataSetFormat,
|
|
29048
|
-
labelFormat,
|
|
29049
29058
|
};
|
|
29050
29059
|
}
|
|
29051
29060
|
|
|
@@ -36280,6 +36289,12 @@ class GenericChartConfigPanel extends Component {
|
|
|
36280
36289
|
|
|
36281
36290
|
class BarConfigPanel extends GenericChartConfigPanel {
|
|
36282
36291
|
static template = "o-spreadsheet-BarConfigPanel";
|
|
36292
|
+
get stackedLabel() {
|
|
36293
|
+
const definition = this.props.definition;
|
|
36294
|
+
return definition.horizontal
|
|
36295
|
+
? this.chartTerms.StackedBarChart
|
|
36296
|
+
: this.chartTerms.StackedColumnChart;
|
|
36297
|
+
}
|
|
36283
36298
|
onUpdateStacked(stacked) {
|
|
36284
36299
|
this.props.updateChart(this.props.figureId, {
|
|
36285
36300
|
stacked,
|
|
@@ -37602,7 +37617,9 @@ class LineConfigPanel extends GenericChartConfigPanel {
|
|
|
37602
37617
|
}
|
|
37603
37618
|
get stackedLabel() {
|
|
37604
37619
|
const definition = this.props.definition;
|
|
37605
|
-
return definition.fillArea
|
|
37620
|
+
return definition.fillArea
|
|
37621
|
+
? this.chartTerms.StackedAreaChart
|
|
37622
|
+
: this.chartTerms.StackedLineChart;
|
|
37606
37623
|
}
|
|
37607
37624
|
getLabelRangeOptions() {
|
|
37608
37625
|
const options = super.getLabelRangeOptions();
|
|
@@ -59616,6 +59633,10 @@ class PivotUIPlugin extends UIPlugin {
|
|
|
59616
59633
|
if (!pivot.isValid()) {
|
|
59617
59634
|
return EMPTY_PIVOT_CELL;
|
|
59618
59635
|
}
|
|
59636
|
+
if (functionName === "PIVOT" &&
|
|
59637
|
+
!cell.content.replaceAll(" ", "").toUpperCase().startsWith("=PIVOT")) {
|
|
59638
|
+
return EMPTY_PIVOT_CELL;
|
|
59639
|
+
}
|
|
59619
59640
|
if (functionName === "PIVOT") {
|
|
59620
59641
|
const includeTotal = args[2] === false ? false : undefined;
|
|
59621
59642
|
const includeColumnHeaders = args[3] === false ? false : undefined;
|
|
@@ -70389,7 +70410,8 @@ function addFormula(cell) {
|
|
|
70389
70410
|
}
|
|
70390
70411
|
const attrs = [["t", type]];
|
|
70391
70412
|
const XlsxFormula = adaptFormulaToExcel(formula);
|
|
70392
|
-
const
|
|
70413
|
+
const exportedValue = adaptFormulaValueToExcel(cell.value);
|
|
70414
|
+
const node = escapeXml /*xml*/ `<f>${XlsxFormula}</f><v>${exportedValue}</v>`;
|
|
70393
70415
|
return { attrs, node };
|
|
70394
70416
|
}
|
|
70395
70417
|
function addContent(content, sharedStrings, forceString = false) {
|
|
@@ -70424,8 +70446,14 @@ function adaptFormulaToExcel(formulaText) {
|
|
|
70424
70446
|
ast = addMissingRequiredArgs(ast);
|
|
70425
70447
|
return ast;
|
|
70426
70448
|
});
|
|
70449
|
+
ast = convertAstNodes(ast, "REFERENCE", (ast) => {
|
|
70450
|
+
return ast.value === CellErrorType.InvalidReference ? { ...ast, value: "#REF!" } : ast;
|
|
70451
|
+
});
|
|
70427
70452
|
return ast ? astToFormula(ast) : formulaText;
|
|
70428
70453
|
}
|
|
70454
|
+
function adaptFormulaValueToExcel(formulaValue) {
|
|
70455
|
+
return formulaValue === CellErrorType.InvalidReference ? "#REF!" : formulaValue;
|
|
70456
|
+
}
|
|
70429
70457
|
/**
|
|
70430
70458
|
* Some Excel function need required args that might not be mandatory in o-spreadsheet.
|
|
70431
70459
|
* This adds those missing args.
|
|
@@ -72400,11 +72428,12 @@ const constants = {
|
|
|
72400
72428
|
PIVOT_TABLE_CONFIG,
|
|
72401
72429
|
TREND_LINE_XAXIS_ID,
|
|
72402
72430
|
CHART_AXIS_CHOICES,
|
|
72431
|
+
ChartTerms,
|
|
72403
72432
|
};
|
|
72404
72433
|
|
|
72405
72434
|
export { AbstractCellClipboardHandler, AbstractChart, AbstractFigureClipboardHandler, CellErrorType, CommandResult, CorePlugin, DispatchResult, EvaluationError, Model, PivotRuntimeDefinition, Registry, Revision, SPREADSHEET_DIMENSIONS, Spreadsheet, SpreadsheetPivotTable, UIPlugin, __info__, addFunction, addRenderingLayer, astToFormula, compile, compileTokens, components, constants, convertAstNodes, coreTypes, findCellInNewZone, functionCache, helpers, hooks, invalidateCFEvaluationCommands, invalidateDependenciesCommands, invalidateEvaluationCommands, iterateAstNodes, links, load, parse, parseTokens, readonlyAllowedCommands, registries, setDefaultSheetViewSize, setTranslationMethod, stores, tokenColors, tokenize };
|
|
72406
72435
|
|
|
72407
72436
|
|
|
72408
|
-
__info__.version = "18.0.
|
|
72409
|
-
__info__.date = "2024-
|
|
72410
|
-
__info__.hash = "
|
|
72437
|
+
__info__.version = "18.0.3";
|
|
72438
|
+
__info__.date = "2024-11-08T12:17:49.992Z";
|
|
72439
|
+
__info__.hash = "5fa5fbb";
|