documents.js 1.62.0 → 1.64.0
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/README.md +150 -24
- package/dist/convert/convert.cjs +72 -20
- package/dist/convert/convert.d.cts +6 -2
- package/dist/convert/convert.d.ts +6 -2
- package/dist/convert/convert.js +73 -21
- package/dist/convert/local.cjs +15 -2
- package/dist/convert/local.js +15 -2
- package/dist/convert/port.d.cts +8 -4
- package/dist/convert/port.d.ts +8 -4
- package/dist/edit/docx/content.d.cts +1 -1
- package/dist/edit/docx/content.d.ts +1 -1
- package/dist/edit/docx/paragraph.d.cts +3 -3
- package/dist/edit/docx/paragraph.d.ts +3 -3
- package/dist/edit/ods/address.cjs +42 -24
- package/dist/edit/ods/address.d.cts +12 -2
- package/dist/edit/ods/address.d.ts +12 -2
- package/dist/edit/ods/address.js +39 -25
- package/dist/edit/ods/column-row.cjs +68 -6
- package/dist/edit/ods/column-row.d.cts +5 -1
- package/dist/edit/ods/column-row.d.ts +5 -1
- package/dist/edit/ods/column-row.js +68 -10
- package/dist/edit/ods/content.cjs +10 -2
- package/dist/edit/ods/content.js +10 -2
- package/dist/edit/ods/floating.cjs +90 -0
- package/dist/edit/ods/floating.d.cts +7 -0
- package/dist/edit/ods/floating.d.ts +7 -0
- package/dist/edit/ods/floating.js +88 -0
- package/dist/edit/ods/print-settings.cjs +158 -2
- package/dist/edit/ods/print-settings.js +159 -3
- package/dist/edit/ods/sheet.cjs +13 -0
- package/dist/edit/ods/sheet.d.cts +5 -1
- package/dist/edit/ods/sheet.d.ts +5 -1
- package/dist/edit/ods/sheet.js +14 -1
- package/dist/edit/odt/content.cjs +8 -4
- package/dist/edit/odt/content.js +8 -4
- package/dist/edit/odt/editor.cjs +7 -0
- package/dist/edit/odt/editor.d.cts +3 -0
- package/dist/edit/odt/editor.d.ts +3 -0
- package/dist/edit/odt/editor.js +7 -0
- package/dist/edit/odt/formula.cjs +19 -0
- package/dist/edit/odt/formula.d.cts +8 -0
- package/dist/edit/odt/formula.d.ts +8 -0
- package/dist/edit/odt/formula.js +17 -0
- package/dist/evaluate-BU5N1Jk1.d.ts +11 -0
- package/dist/evaluate-BhMXY6DM.d.cts +11 -0
- package/dist/firebird/backup.d.cts +1 -1
- package/dist/firebird/backup.d.ts +1 -1
- package/dist/firebird/data.cjs +30 -16
- package/dist/firebird/data.d.cts +3 -2
- package/dist/firebird/data.d.ts +3 -2
- package/dist/firebird/data.js +30 -17
- package/dist/fonts/obfuscation.cjs +50 -0
- package/dist/fonts/obfuscation.d.cts +9 -0
- package/dist/fonts/obfuscation.d.ts +9 -0
- package/dist/fonts/obfuscation.js +46 -0
- package/dist/fonts/odf.cjs +86 -0
- package/dist/fonts/odf.d.cts +9 -0
- package/dist/fonts/odf.d.ts +9 -0
- package/dist/fonts/odf.js +84 -0
- package/dist/fonts/ooxml.cjs +129 -0
- package/dist/fonts/ooxml.d.cts +9 -0
- package/dist/fonts/ooxml.d.ts +9 -0
- package/dist/fonts/ooxml.js +127 -0
- package/dist/fonts/registry.cjs +18 -0
- package/dist/fonts/registry.d.cts +2 -0
- package/dist/fonts/registry.d.ts +2 -0
- package/dist/fonts/registry.js +16 -0
- package/dist/formula-CgydMiTt.d.ts +10 -0
- package/dist/formula-CiwPw8nY.d.cts +10 -0
- package/dist/hsqldb/binary-script.d.cts +1 -1
- package/dist/hsqldb/binary-script.d.ts +1 -1
- package/dist/hsqldb/cache.d.cts +1 -1
- package/dist/hsqldb/cache.d.ts +1 -1
- package/dist/hsqldb/rowformat.cjs +22 -13
- package/dist/hsqldb/rowformat.js +22 -13
- package/dist/hsqldb/script.d.cts +1 -18
- package/dist/hsqldb/script.d.ts +1 -18
- package/dist/index.cjs +88 -0
- package/dist/index.d.cts +27 -9
- package/dist/index.d.ts +27 -9
- package/dist/index.js +20 -3
- package/dist/layout/sheets.cjs +30 -24
- package/dist/layout/sheets.js +31 -25
- package/dist/layout/slides.cjs +6 -4
- package/dist/layout/slides.js +7 -5
- package/dist/lexer-DGPWx_f2.d.cts +42 -0
- package/dist/lexer-DGPWx_f2.d.ts +42 -0
- package/dist/mathml/layout.d.cts +1 -1
- package/dist/mathml/layout.d.ts +1 -1
- package/dist/mathml/variant.d.cts +1 -6
- package/dist/mathml/variant.d.ts +1 -6
- package/dist/odb/csv.d.cts +1 -1
- package/dist/odb/csv.d.ts +1 -1
- package/dist/odb/formula/definition.cjs +49 -0
- package/dist/odb/formula/definition.d.cts +8 -0
- package/dist/odb/formula/definition.d.ts +8 -0
- package/dist/odb/formula/definition.js +46 -0
- package/dist/odb/formula/errors.cjs +47 -0
- package/dist/odb/formula/errors.d.cts +21 -0
- package/dist/odb/formula/errors.d.ts +21 -0
- package/dist/odb/formula/errors.js +43 -0
- package/dist/odb/formula/evaluate.cjs +283 -0
- package/dist/odb/formula/evaluate.d.cts +43 -0
- package/dist/odb/formula/evaluate.d.ts +43 -0
- package/dist/odb/formula/evaluate.js +281 -0
- package/dist/odb/formula/parser.cjs +198 -0
- package/dist/odb/formula/parser.d.cts +29 -0
- package/dist/odb/formula/parser.d.ts +29 -0
- package/dist/odb/formula/parser.js +197 -0
- package/dist/odb/read.d.cts +1 -1
- package/dist/odb/read.d.ts +1 -1
- package/dist/odb/report/content.cjs +27 -0
- package/dist/odb/report/content.d.cts +14 -0
- package/dist/odb/report/content.d.ts +14 -0
- package/dist/odb/report/content.js +25 -0
- package/dist/odb/report/render.cjs +106 -0
- package/dist/odb/report/render.d.cts +7 -0
- package/dist/odb/report/render.d.ts +7 -0
- package/dist/odb/report/render.js +106 -0
- package/dist/odb/report/source.cjs +45 -0
- package/dist/odb/report/source.d.cts +14 -0
- package/dist/odb/report/source.d.ts +14 -0
- package/dist/odb/report/source.js +42 -0
- package/dist/odb/spreadsheet.d.cts +1 -1
- package/dist/odb/spreadsheet.d.ts +1 -1
- package/dist/odb/sql/errors.cjs +38 -0
- package/dist/odb/sql/errors.d.cts +17 -0
- package/dist/odb/sql/errors.d.ts +17 -0
- package/dist/odb/sql/errors.js +35 -0
- package/dist/odb/sql/evaluate.cjs +312 -0
- package/dist/odb/sql/evaluate.d.cts +2 -0
- package/dist/odb/sql/evaluate.d.ts +2 -0
- package/dist/odb/sql/evaluate.js +311 -0
- package/dist/odb/sql/lexer.cjs +282 -0
- package/dist/odb/sql/lexer.d.cts +2 -0
- package/dist/odb/sql/lexer.d.ts +2 -0
- package/dist/odb/sql/lexer.js +281 -0
- package/dist/odb/sql/parser.cjs +479 -0
- package/dist/odb/sql/parser.d.cts +2 -0
- package/dist/odb/sql/parser.d.ts +2 -0
- package/dist/odb/sql/parser.js +478 -0
- package/dist/odb/values.cjs +75 -0
- package/dist/odb/values.d.cts +2 -0
- package/dist/odb/values.d.ts +2 -0
- package/dist/odb/values.js +69 -0
- package/dist/odf/odt/read.cjs +43 -21
- package/dist/odf/odt/read.js +43 -21
- package/dist/odf-package/formula.cjs +59 -0
- package/dist/odf-package/formula.d.cts +11 -0
- package/dist/odf-package/formula.d.ts +11 -0
- package/dist/odf-package/formula.js +58 -0
- package/dist/odf-package/manifest.cjs +29 -0
- package/dist/odf-package/manifest.d.cts +5 -2
- package/dist/odf-package/manifest.d.ts +5 -2
- package/dist/odf-package/manifest.js +30 -2
- package/dist/odf-package/media.cjs +2 -1
- package/dist/odf-package/media.js +2 -2
- package/dist/omml/read.cjs +265 -0
- package/dist/omml/read.d.cts +12 -0
- package/dist/omml/read.d.ts +12 -0
- package/dist/omml/read.js +263 -0
- package/dist/omml/shared.cjs +67 -0
- package/dist/omml/shared.d.cts +2 -0
- package/dist/omml/shared.d.ts +2 -0
- package/dist/omml/shared.js +64 -0
- package/dist/omml/write.cjs +3 -51
- package/dist/omml/write.d.cts +2 -2
- package/dist/omml/write.d.ts +2 -2
- package/dist/omml/write.js +1 -49
- package/dist/ooxml/docx/extras.cjs +15 -0
- package/dist/ooxml/docx/extras.d.cts +12 -0
- package/dist/ooxml/docx/extras.d.ts +12 -0
- package/dist/ooxml/docx/extras.js +14 -0
- package/dist/ooxml/docx/formula.cjs +109 -0
- package/dist/ooxml/docx/formula.d.cts +2 -0
- package/dist/ooxml/docx/formula.d.ts +2 -0
- package/dist/ooxml/docx/formula.js +108 -0
- package/dist/ooxml/docx/read.cjs +10 -2
- package/dist/ooxml/docx/read.d.cts +6 -2
- package/dist/ooxml/docx/read.d.ts +6 -2
- package/dist/ooxml/docx/read.js +11 -3
- package/dist/parser-B9vC1T6T.d.cts +101 -0
- package/dist/parser-DQSgYJzQ.d.ts +101 -0
- package/dist/registry-CrSqLIcn.d.ts +19 -0
- package/dist/registry-lqJej0Jr.d.cts +19 -0
- package/dist/script-DsGGIzGU.d.cts +19 -0
- package/dist/script-DsGGIzGU.d.ts +19 -0
- package/dist/shared-DLZ3IQUl.d.cts +15 -0
- package/dist/shared-DUOzjwcL.d.ts +15 -0
- package/dist/values-BetetbaH.d.cts +23 -0
- package/dist/values-BetetbaH.d.ts +23 -0
- package/dist/variant-BMrebjMw.d.cts +7 -0
- package/dist/variant-BMrebjMw.d.ts +7 -0
- package/dist/{write-DuyfnbL_.d.cts → write-BQ6SK8r8.d.cts} +2 -6
- package/dist/{write-Zqwx6pka.d.ts → write-THs7ipBq.d.ts} +2 -6
- package/package.json +1 -1
package/dist/layout/sheets.cjs
CHANGED
|
@@ -218,39 +218,45 @@ function renderCellText(cell, frameYDown, rowCells, columnAxis, pageHeightPt, me
|
|
|
218
218
|
const alignment = cell.alignment ?? defaultAlignmentForValue(cell.value.kind);
|
|
219
219
|
const numericLike = isNumericLikeValue(cell.value.kind);
|
|
220
220
|
const styledRuns = cellStyledRuns(cell);
|
|
221
|
-
const
|
|
221
|
+
const lines = (0, pdf_codec.wrapRunsToWidth)(styledRuns, measurer, Number.POSITIVE_INFINITY);
|
|
222
|
+
const naturalLine = lines[0];
|
|
222
223
|
let availableWidthPt = Math.max(0, ownWidthPt - 4);
|
|
223
224
|
let fragments = naturalLine.fragments;
|
|
224
225
|
let lineWidthPt = naturalLine.widthPt;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
availableWidthPt
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
226
|
+
let overflowed = false;
|
|
227
|
+
if (lineWidthPt > availableWidthPt) {
|
|
228
|
+
overflowed = true;
|
|
229
|
+
if (numericLike) {
|
|
230
|
+
const overflowRuns = [{
|
|
231
|
+
text: NUMERIC_OVERFLOW_TEXT,
|
|
232
|
+
font: styledRuns[0].font,
|
|
233
|
+
sizePt: styledRuns[0].sizePt,
|
|
234
|
+
color: styledRuns[0].color
|
|
235
|
+
}];
|
|
236
|
+
const overflowLine = (0, pdf_codec.wrapRunsToWidth)(overflowRuns, measurer, Number.POSITIVE_INFINITY)[0];
|
|
237
|
+
fragments = overflowLine.fragments;
|
|
238
|
+
lineWidthPt = overflowLine.widthPt;
|
|
239
|
+
} else if (cell.value.kind === "string") {
|
|
240
|
+
let spillColumn = cell.column + (cell.colSpan ?? 1);
|
|
241
|
+
while (lineWidthPt > availableWidthPt) {
|
|
242
|
+
const neighborPosition = columnAxis.positionByIndex.get(spillColumn);
|
|
243
|
+
if (neighborPosition === void 0 || !isCellVisuallyEmpty(rowCells?.get(spillColumn))) break;
|
|
244
|
+
availableWidthPt += columnAxis.sizesPt[neighborPosition];
|
|
245
|
+
spillColumn++;
|
|
246
|
+
}
|
|
247
|
+
if (lineWidthPt > availableWidthPt) fragments = truncateFragmentsToWidth(fragments, measurer, availableWidthPt);
|
|
248
|
+
} else fragments = truncateFragmentsToWidth(fragments, measurer, availableWidthPt);
|
|
249
|
+
}
|
|
245
250
|
const alignOffsetPt = require_layout_shared.alignmentOffsetPt(alignment, availableWidthPt, lineWidthPt);
|
|
246
251
|
const textStartXPt = xLeftPt + CELL_TEXT_PADDING_PT + alignOffsetPt;
|
|
247
252
|
const lineHeightPt = require_layout_shared.lineNaturalHeightPt(naturalLine, measurer, styledRuns[0]);
|
|
248
253
|
const baselineYDownPt = verticalLineTopYDownPt(cell.verticalAlignment ?? DEFAULT_CELL_VERTICAL_ALIGNMENT, yTopDownPt, heightPt, lineHeightPt) + naturalLine.ascentPt;
|
|
249
|
-
|
|
254
|
+
const justifyGapsPt = alignment === "justify" && !overflowed && lines.length > 1 ? require_layout_shared.justifyLineGapsPt(naturalLine, availableWidthPt, measurer) : void 0;
|
|
255
|
+
fragments.forEach((fragment, fragmentIndex) => {
|
|
250
256
|
const textItem = {
|
|
251
257
|
kind: "text",
|
|
252
258
|
text: fragment.text,
|
|
253
|
-
xPt: textStartXPt + fragment.xOffsetPt,
|
|
259
|
+
xPt: textStartXPt + fragment.xOffsetPt + (justifyGapsPt?.[fragmentIndex] ?? 0),
|
|
254
260
|
yPt: pageHeightPt - baselineYDownPt,
|
|
255
261
|
font: fragment.font,
|
|
256
262
|
sizePt: fragment.sizePt,
|
|
@@ -259,7 +265,7 @@ function renderCellText(cell, frameYDown, rowCells, columnAxis, pageHeightPt, me
|
|
|
259
265
|
sourcePath: fragment.sourcePath
|
|
260
266
|
};
|
|
261
267
|
out.push(textItem);
|
|
262
|
-
}
|
|
268
|
+
});
|
|
263
269
|
}
|
|
264
270
|
function renderHeaderLabels(gutter, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, measurer, out) {
|
|
265
271
|
const lineHeightPt = measurer.lineHeightAtSize(document_schema_js.DEFAULT_LAYOUT_FONT, HEADER_LABEL_SIZE_PT);
|
package/dist/layout/sheets.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { flipY } from "../model/geometry.js";
|
|
2
2
|
import { COLOR_BLACK as COLOR_BLACK$1, rgbHexToColor } from "../model/color.js";
|
|
3
3
|
import { DEFAULT_LAYOUT_FONT } from "../model/style.js";
|
|
4
|
-
import { alignmentOffsetPt, lineNaturalHeightPt, pushCellBorderLines, sumColumnWidthsPt, toStyledRuns } from "./shared.js";
|
|
4
|
+
import { alignmentOffsetPt, justifyLineGapsPt, lineNaturalHeightPt, pushCellBorderLines, sumColumnWidthsPt, toStyledRuns } from "./shared.js";
|
|
5
5
|
import { throwIfAborted } from "../ports/abort.js";
|
|
6
6
|
import { LAYOUT_FORMAT_VERSION } from "document-schema.js";
|
|
7
7
|
import { wrapRunsToWidth } from "pdf-codec";
|
|
@@ -219,39 +219,45 @@ function renderCellText(cell, frameYDown, rowCells, columnAxis, pageHeightPt, me
|
|
|
219
219
|
const alignment = cell.alignment ?? defaultAlignmentForValue(cell.value.kind);
|
|
220
220
|
const numericLike = isNumericLikeValue(cell.value.kind);
|
|
221
221
|
const styledRuns = cellStyledRuns(cell);
|
|
222
|
-
const
|
|
222
|
+
const lines = wrapRunsToWidth(styledRuns, measurer, Number.POSITIVE_INFINITY);
|
|
223
|
+
const naturalLine = lines[0];
|
|
223
224
|
let availableWidthPt = Math.max(0, ownWidthPt - 4);
|
|
224
225
|
let fragments = naturalLine.fragments;
|
|
225
226
|
let lineWidthPt = naturalLine.widthPt;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
availableWidthPt
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
227
|
+
let overflowed = false;
|
|
228
|
+
if (lineWidthPt > availableWidthPt) {
|
|
229
|
+
overflowed = true;
|
|
230
|
+
if (numericLike) {
|
|
231
|
+
const overflowRuns = [{
|
|
232
|
+
text: NUMERIC_OVERFLOW_TEXT,
|
|
233
|
+
font: styledRuns[0].font,
|
|
234
|
+
sizePt: styledRuns[0].sizePt,
|
|
235
|
+
color: styledRuns[0].color
|
|
236
|
+
}];
|
|
237
|
+
const overflowLine = wrapRunsToWidth(overflowRuns, measurer, Number.POSITIVE_INFINITY)[0];
|
|
238
|
+
fragments = overflowLine.fragments;
|
|
239
|
+
lineWidthPt = overflowLine.widthPt;
|
|
240
|
+
} else if (cell.value.kind === "string") {
|
|
241
|
+
let spillColumn = cell.column + (cell.colSpan ?? 1);
|
|
242
|
+
while (lineWidthPt > availableWidthPt) {
|
|
243
|
+
const neighborPosition = columnAxis.positionByIndex.get(spillColumn);
|
|
244
|
+
if (neighborPosition === void 0 || !isCellVisuallyEmpty(rowCells?.get(spillColumn))) break;
|
|
245
|
+
availableWidthPt += columnAxis.sizesPt[neighborPosition];
|
|
246
|
+
spillColumn++;
|
|
247
|
+
}
|
|
248
|
+
if (lineWidthPt > availableWidthPt) fragments = truncateFragmentsToWidth(fragments, measurer, availableWidthPt);
|
|
249
|
+
} else fragments = truncateFragmentsToWidth(fragments, measurer, availableWidthPt);
|
|
250
|
+
}
|
|
246
251
|
const alignOffsetPt = alignmentOffsetPt(alignment, availableWidthPt, lineWidthPt);
|
|
247
252
|
const textStartXPt = xLeftPt + CELL_TEXT_PADDING_PT + alignOffsetPt;
|
|
248
253
|
const lineHeightPt = lineNaturalHeightPt(naturalLine, measurer, styledRuns[0]);
|
|
249
254
|
const baselineYDownPt = verticalLineTopYDownPt(cell.verticalAlignment ?? DEFAULT_CELL_VERTICAL_ALIGNMENT, yTopDownPt, heightPt, lineHeightPt) + naturalLine.ascentPt;
|
|
250
|
-
|
|
255
|
+
const justifyGapsPt = alignment === "justify" && !overflowed && lines.length > 1 ? justifyLineGapsPt(naturalLine, availableWidthPt, measurer) : void 0;
|
|
256
|
+
fragments.forEach((fragment, fragmentIndex) => {
|
|
251
257
|
const textItem = {
|
|
252
258
|
kind: "text",
|
|
253
259
|
text: fragment.text,
|
|
254
|
-
xPt: textStartXPt + fragment.xOffsetPt,
|
|
260
|
+
xPt: textStartXPt + fragment.xOffsetPt + (justifyGapsPt?.[fragmentIndex] ?? 0),
|
|
255
261
|
yPt: pageHeightPt - baselineYDownPt,
|
|
256
262
|
font: fragment.font,
|
|
257
263
|
sizePt: fragment.sizePt,
|
|
@@ -260,7 +266,7 @@ function renderCellText(cell, frameYDown, rowCells, columnAxis, pageHeightPt, me
|
|
|
260
266
|
sourcePath: fragment.sourcePath
|
|
261
267
|
};
|
|
262
268
|
out.push(textItem);
|
|
263
|
-
}
|
|
269
|
+
});
|
|
264
270
|
}
|
|
265
271
|
function renderHeaderLabels(gutter, columnAxis, rowAxis, gridLeftXPt, gridTopYDownPt, pageHeightPt, measurer, out) {
|
|
266
272
|
const lineHeightPt = measurer.lineHeightAtSize(DEFAULT_LAYOUT_FONT, HEADER_LABEL_SIZE_PT);
|
package/dist/layout/slides.cjs
CHANGED
|
@@ -31,14 +31,16 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
|
|
|
31
31
|
const fallbackRun = effectiveRuns[0];
|
|
32
32
|
const paragraphLeftXDown = contentLeftXDown + (paragraph.indentLeftPt ?? 0);
|
|
33
33
|
const paragraphWidthPt = Math.max(0, contentWidthPt - (paragraph.indentLeftPt ?? 0));
|
|
34
|
-
(0, pdf_codec.wrapRunsToWidth)(effectiveRuns, measurer, paragraphWidthPt)
|
|
34
|
+
const lines = (0, pdf_codec.wrapRunsToWidth)(effectiveRuns, measurer, paragraphWidthPt);
|
|
35
|
+
lines.forEach((line, lineIndex) => {
|
|
35
36
|
const scaledLineHeightPt = require_layout_shared.lineNaturalHeightPt(line, measurer, fallbackRun) * (paragraph.lineSpacing ?? 1) * spacingScale;
|
|
36
37
|
const baselineYDown = cursorYDown + line.ascentPt;
|
|
37
38
|
const firstLineIndentPt = lineIndex === 0 ? paragraph.indentFirstLinePt ?? 0 : 0;
|
|
38
39
|
const alignOffsetPt = require_layout_shared.alignmentOffsetPt(paragraph.alignment, paragraphWidthPt, line.widthPt);
|
|
39
|
-
|
|
40
|
+
const justifyGapsPt = paragraph.alignment === "justify" && lineIndex < lines.length - 1 ? require_layout_shared.justifyLineGapsPt(line, paragraphWidthPt, measurer) : void 0;
|
|
41
|
+
line.fragments.forEach((fragment, fragmentIndex) => {
|
|
40
42
|
const unrotated = {
|
|
41
|
-
x: paragraphLeftXDown + firstLineIndentPt + alignOffsetPt + fragment.xOffsetPt,
|
|
43
|
+
x: paragraphLeftXDown + firstLineIndentPt + alignOffsetPt + fragment.xOffsetPt + (justifyGapsPt?.[fragmentIndex] ?? 0),
|
|
42
44
|
y: slideHeightPt - baselineYDown
|
|
43
45
|
};
|
|
44
46
|
const placed = placement.place(unrotated);
|
|
@@ -72,7 +74,7 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
|
|
|
72
74
|
};
|
|
73
75
|
out.push(link);
|
|
74
76
|
}
|
|
75
|
-
}
|
|
77
|
+
});
|
|
76
78
|
cursorYDown += scaledLineHeightPt;
|
|
77
79
|
});
|
|
78
80
|
cursorYDown += paragraph.spacingAfterPt ?? 0;
|
package/dist/layout/slides.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { flipY } from "../model/geometry.js";
|
|
2
2
|
import { formulaOfBlock } from "../model/formula.js";
|
|
3
3
|
import { layoutFormula } from "../mathml/layout.js";
|
|
4
|
-
import { alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, lineNaturalHeightPt, registerImage, sumColumnWidthsPt } from "./shared.js";
|
|
4
|
+
import { alignmentOffsetPt, effectiveStyledRuns, estimateRowHeightPt, justifyLineGapsPt, lineNaturalHeightPt, registerImage, sumColumnWidthsPt } from "./shared.js";
|
|
5
5
|
import { COLOR_BLACK, LAYOUT_FORMAT_VERSION } from "document-schema.js";
|
|
6
6
|
import { loadMathFont, rotatePointAboutCenter, wrapRunsToWidth } from "pdf-codec";
|
|
7
7
|
//#region src/layout/slides.ts
|
|
@@ -30,14 +30,16 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
|
|
|
30
30
|
const fallbackRun = effectiveRuns[0];
|
|
31
31
|
const paragraphLeftXDown = contentLeftXDown + (paragraph.indentLeftPt ?? 0);
|
|
32
32
|
const paragraphWidthPt = Math.max(0, contentWidthPt - (paragraph.indentLeftPt ?? 0));
|
|
33
|
-
wrapRunsToWidth(effectiveRuns, measurer, paragraphWidthPt)
|
|
33
|
+
const lines = wrapRunsToWidth(effectiveRuns, measurer, paragraphWidthPt);
|
|
34
|
+
lines.forEach((line, lineIndex) => {
|
|
34
35
|
const scaledLineHeightPt = lineNaturalHeightPt(line, measurer, fallbackRun) * (paragraph.lineSpacing ?? 1) * spacingScale;
|
|
35
36
|
const baselineYDown = cursorYDown + line.ascentPt;
|
|
36
37
|
const firstLineIndentPt = lineIndex === 0 ? paragraph.indentFirstLinePt ?? 0 : 0;
|
|
37
38
|
const alignOffsetPt = alignmentOffsetPt(paragraph.alignment, paragraphWidthPt, line.widthPt);
|
|
38
|
-
|
|
39
|
+
const justifyGapsPt = paragraph.alignment === "justify" && lineIndex < lines.length - 1 ? justifyLineGapsPt(line, paragraphWidthPt, measurer) : void 0;
|
|
40
|
+
line.fragments.forEach((fragment, fragmentIndex) => {
|
|
39
41
|
const unrotated = {
|
|
40
|
-
x: paragraphLeftXDown + firstLineIndentPt + alignOffsetPt + fragment.xOffsetPt,
|
|
42
|
+
x: paragraphLeftXDown + firstLineIndentPt + alignOffsetPt + fragment.xOffsetPt + (justifyGapsPt?.[fragmentIndex] ?? 0),
|
|
41
43
|
y: slideHeightPt - baselineYDown
|
|
42
44
|
};
|
|
43
45
|
const placed = placement.place(unrotated);
|
|
@@ -71,7 +73,7 @@ function layoutParagraph(paragraph, contentLeftXDown, contentWidthPt, startYDown
|
|
|
71
73
|
};
|
|
72
74
|
out.push(link);
|
|
73
75
|
}
|
|
74
|
-
}
|
|
76
|
+
});
|
|
75
77
|
cursorYDown += scaledLineHeightPt;
|
|
76
78
|
});
|
|
77
79
|
cursorYDown += paragraph.spacingAfterPt ?? 0;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/odb/sql/lexer.d.ts
|
|
2
|
+
type SqlComparisonOperator = '=' | '<>' | '<' | '>' | '<=' | '>=';
|
|
3
|
+
type SqlPunctuation = '(' | ')' | ',' | '.' | '*' | ';' | '-';
|
|
4
|
+
type SqlToken = {
|
|
5
|
+
readonly kind: 'keyword';
|
|
6
|
+
readonly keyword: string;
|
|
7
|
+
readonly text: string;
|
|
8
|
+
readonly start: number;
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: 'identifier';
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly quoted: boolean;
|
|
13
|
+
readonly text: string;
|
|
14
|
+
readonly start: number;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'string';
|
|
17
|
+
readonly value: string;
|
|
18
|
+
readonly text: string;
|
|
19
|
+
readonly start: number;
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'number';
|
|
22
|
+
readonly value: number;
|
|
23
|
+
readonly text: string;
|
|
24
|
+
readonly start: number;
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'operator';
|
|
27
|
+
readonly operator: SqlComparisonOperator;
|
|
28
|
+
readonly text: string;
|
|
29
|
+
readonly start: number;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: 'punctuation';
|
|
32
|
+
readonly punctuation: SqlPunctuation;
|
|
33
|
+
readonly text: string;
|
|
34
|
+
readonly start: number;
|
|
35
|
+
} | {
|
|
36
|
+
readonly kind: 'end';
|
|
37
|
+
readonly text: string;
|
|
38
|
+
readonly start: number;
|
|
39
|
+
};
|
|
40
|
+
declare function tokenizeSql(sql: string): readonly SqlToken[];
|
|
41
|
+
//#endregion
|
|
42
|
+
export { tokenizeSql as i, SqlPunctuation as n, SqlToken as r, SqlComparisonOperator as t };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
//#region src/odb/sql/lexer.d.ts
|
|
2
|
+
type SqlComparisonOperator = '=' | '<>' | '<' | '>' | '<=' | '>=';
|
|
3
|
+
type SqlPunctuation = '(' | ')' | ',' | '.' | '*' | ';' | '-';
|
|
4
|
+
type SqlToken = {
|
|
5
|
+
readonly kind: 'keyword';
|
|
6
|
+
readonly keyword: string;
|
|
7
|
+
readonly text: string;
|
|
8
|
+
readonly start: number;
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: 'identifier';
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly quoted: boolean;
|
|
13
|
+
readonly text: string;
|
|
14
|
+
readonly start: number;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'string';
|
|
17
|
+
readonly value: string;
|
|
18
|
+
readonly text: string;
|
|
19
|
+
readonly start: number;
|
|
20
|
+
} | {
|
|
21
|
+
readonly kind: 'number';
|
|
22
|
+
readonly value: number;
|
|
23
|
+
readonly text: string;
|
|
24
|
+
readonly start: number;
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: 'operator';
|
|
27
|
+
readonly operator: SqlComparisonOperator;
|
|
28
|
+
readonly text: string;
|
|
29
|
+
readonly start: number;
|
|
30
|
+
} | {
|
|
31
|
+
readonly kind: 'punctuation';
|
|
32
|
+
readonly punctuation: SqlPunctuation;
|
|
33
|
+
readonly text: string;
|
|
34
|
+
readonly start: number;
|
|
35
|
+
} | {
|
|
36
|
+
readonly kind: 'end';
|
|
37
|
+
readonly text: string;
|
|
38
|
+
readonly start: number;
|
|
39
|
+
};
|
|
40
|
+
declare function tokenizeSql(sql: string): readonly SqlToken[];
|
|
41
|
+
//#endregion
|
|
42
|
+
export { tokenizeSql as i, SqlPunctuation as n, SqlToken as r, SqlComparisonOperator as t };
|
package/dist/mathml/layout.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { t as MathVariant } from "../variant-BMrebjMw.cjs";
|
|
1
2
|
import { r as MathMlNode } from "../nodes-pArN9ilm.cjs";
|
|
2
3
|
import { MathBox, MathColor, MathDiagnostic, MathLayoutResult } from "./layout-types.cjs";
|
|
3
4
|
import { MathFontMetrics } from "./metrics.cjs";
|
|
4
|
-
import { MathVariant } from "./variant.cjs";
|
|
5
5
|
//#region src/mathml/layout.d.ts
|
|
6
6
|
interface LayoutFormulaOptions {
|
|
7
7
|
readonly metrics: MathFontMetrics;
|
package/dist/mathml/layout.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { t as MathVariant } from "../variant-BMrebjMw.js";
|
|
1
2
|
import { r as MathMlNode } from "../nodes-pArN9ilm.js";
|
|
2
3
|
import { MathBox, MathColor, MathDiagnostic, MathLayoutResult } from "./layout-types.js";
|
|
3
4
|
import { MathFontMetrics } from "./metrics.js";
|
|
4
|
-
import { MathVariant } from "./variant.js";
|
|
5
5
|
//#region src/mathml/layout.d.ts
|
|
6
6
|
interface LayoutFormulaOptions {
|
|
7
7
|
readonly metrics: MathFontMetrics;
|
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
type MathVariant = 'normal' | 'bold' | 'italic' | 'bold-italic' | 'double-struck' | 'bold-fraktur' | 'script' | 'bold-script' | 'fraktur' | 'sans-serif' | 'bold-sans-serif' | 'sans-serif-italic' | 'sans-serif-bold-italic' | 'monospace';
|
|
3
|
-
declare function mapMathVariant(codePoint: number, variant: MathVariant): number;
|
|
4
|
-
declare function applyMathVariant(text: string, variant: MathVariant): string;
|
|
5
|
-
declare function isMathVariant(value: string): value is MathVariant;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { i as mapMathVariant, n as applyMathVariant, r as isMathVariant, t as MathVariant } from "../variant-BMrebjMw.cjs";
|
|
7
2
|
export { MathVariant, applyMathVariant, isMathVariant, mapMathVariant };
|
package/dist/mathml/variant.d.ts
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
type MathVariant = 'normal' | 'bold' | 'italic' | 'bold-italic' | 'double-struck' | 'bold-fraktur' | 'script' | 'bold-script' | 'fraktur' | 'sans-serif' | 'bold-sans-serif' | 'sans-serif-italic' | 'sans-serif-bold-italic' | 'monospace';
|
|
3
|
-
declare function mapMathVariant(codePoint: number, variant: MathVariant): number;
|
|
4
|
-
declare function applyMathVariant(text: string, variant: MathVariant): string;
|
|
5
|
-
declare function isMathVariant(value: string): value is MathVariant;
|
|
6
|
-
//#endregion
|
|
1
|
+
import { i as mapMathVariant, n as applyMathVariant, r as isMathVariant, t as MathVariant } from "../variant-BMrebjMw.js";
|
|
7
2
|
export { MathVariant, applyMathVariant, isMathVariant, mapMathVariant };
|
package/dist/odb/csv.d.cts
CHANGED
package/dist/odb/csv.d.ts
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_odb_formula_errors = require("./errors.cjs");
|
|
3
|
+
//#region src/odb/formula/definition.ts
|
|
4
|
+
function rptBandDefinition(band) {
|
|
5
|
+
return { formulas: band.elements.map((element) => element.formula) };
|
|
6
|
+
}
|
|
7
|
+
function bandDefinition(band) {
|
|
8
|
+
return band === void 0 ? void 0 : rptBandDefinition(band);
|
|
9
|
+
}
|
|
10
|
+
function odbReportGroupChain(report) {
|
|
11
|
+
const chain = [];
|
|
12
|
+
let level = report.groups;
|
|
13
|
+
while (level.length > 0) {
|
|
14
|
+
if (level.length > 1) throw new require_odb_formula_errors.RptReportStructureError(`${String(level.length)} sibling groups are declared at one nesting level, but Report Builder nests groups strictly and this engine's scoping is defined only for a chain`, report.name);
|
|
15
|
+
const group = level[0];
|
|
16
|
+
if (group === void 0) throw new require_odb_formula_errors.RptReportStructureError("a group nesting level reported a non-zero length but held no group", report.name);
|
|
17
|
+
chain.push(group);
|
|
18
|
+
level = group.groups;
|
|
19
|
+
}
|
|
20
|
+
return chain;
|
|
21
|
+
}
|
|
22
|
+
function groupDefinition(group, level, reportName) {
|
|
23
|
+
if (group.groupExpression === void 0) throw new require_odb_formula_errors.RptReportStructureError(`the group at nesting level ${String(level)} declares no rpt:group-expression, so there is no break test to evaluate`, reportName);
|
|
24
|
+
return {
|
|
25
|
+
groupExpression: group.groupExpression,
|
|
26
|
+
functions: group.functions.map((declaration) => ({
|
|
27
|
+
name: declaration.name,
|
|
28
|
+
formula: declaration.formula
|
|
29
|
+
})),
|
|
30
|
+
header: bandDefinition(group.header),
|
|
31
|
+
footer: bandDefinition(group.footer)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function rptDefinitionFromReport(report) {
|
|
35
|
+
return {
|
|
36
|
+
functions: report.functions.map((declaration) => ({
|
|
37
|
+
name: declaration.name,
|
|
38
|
+
formula: declaration.formula
|
|
39
|
+
})),
|
|
40
|
+
reportHeader: bandDefinition(report.reportHeader),
|
|
41
|
+
groups: odbReportGroupChain(report).map((group, level) => groupDefinition(group, level, report.name)),
|
|
42
|
+
detail: bandDefinition(report.detail),
|
|
43
|
+
reportFooter: bandDefinition(report.reportFooter)
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
exports.odbReportGroupChain = odbReportGroupChain;
|
|
48
|
+
exports.rptBandDefinition = rptBandDefinition;
|
|
49
|
+
exports.rptDefinitionFromReport = rptDefinitionFromReport;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RptBandDefinition, RptReportDefinition } from "./evaluate.cjs";
|
|
2
|
+
import { OdbReport, OdbReportBand, OdbReportGroup } from "odf.js";
|
|
3
|
+
//#region src/odb/formula/definition.d.ts
|
|
4
|
+
declare function rptBandDefinition(band: OdbReportBand): RptBandDefinition;
|
|
5
|
+
declare function odbReportGroupChain(report: OdbReport): readonly OdbReportGroup[];
|
|
6
|
+
declare function rptDefinitionFromReport(report: OdbReport): RptReportDefinition;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { odbReportGroupChain, rptBandDefinition, rptDefinitionFromReport };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RptBandDefinition, RptReportDefinition } from "./evaluate.js";
|
|
2
|
+
import { OdbReport, OdbReportBand, OdbReportGroup } from "odf.js";
|
|
3
|
+
//#region src/odb/formula/definition.d.ts
|
|
4
|
+
declare function rptBandDefinition(band: OdbReportBand): RptBandDefinition;
|
|
5
|
+
declare function odbReportGroupChain(report: OdbReport): readonly OdbReportGroup[];
|
|
6
|
+
declare function rptDefinitionFromReport(report: OdbReport): RptReportDefinition;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { odbReportGroupChain, rptBandDefinition, rptDefinitionFromReport };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RptReportStructureError } from "./errors.js";
|
|
2
|
+
//#region src/odb/formula/definition.ts
|
|
3
|
+
function rptBandDefinition(band) {
|
|
4
|
+
return { formulas: band.elements.map((element) => element.formula) };
|
|
5
|
+
}
|
|
6
|
+
function bandDefinition(band) {
|
|
7
|
+
return band === void 0 ? void 0 : rptBandDefinition(band);
|
|
8
|
+
}
|
|
9
|
+
function odbReportGroupChain(report) {
|
|
10
|
+
const chain = [];
|
|
11
|
+
let level = report.groups;
|
|
12
|
+
while (level.length > 0) {
|
|
13
|
+
if (level.length > 1) throw new RptReportStructureError(`${String(level.length)} sibling groups are declared at one nesting level, but Report Builder nests groups strictly and this engine's scoping is defined only for a chain`, report.name);
|
|
14
|
+
const group = level[0];
|
|
15
|
+
if (group === void 0) throw new RptReportStructureError("a group nesting level reported a non-zero length but held no group", report.name);
|
|
16
|
+
chain.push(group);
|
|
17
|
+
level = group.groups;
|
|
18
|
+
}
|
|
19
|
+
return chain;
|
|
20
|
+
}
|
|
21
|
+
function groupDefinition(group, level, reportName) {
|
|
22
|
+
if (group.groupExpression === void 0) throw new RptReportStructureError(`the group at nesting level ${String(level)} declares no rpt:group-expression, so there is no break test to evaluate`, reportName);
|
|
23
|
+
return {
|
|
24
|
+
groupExpression: group.groupExpression,
|
|
25
|
+
functions: group.functions.map((declaration) => ({
|
|
26
|
+
name: declaration.name,
|
|
27
|
+
formula: declaration.formula
|
|
28
|
+
})),
|
|
29
|
+
header: bandDefinition(group.header),
|
|
30
|
+
footer: bandDefinition(group.footer)
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
function rptDefinitionFromReport(report) {
|
|
34
|
+
return {
|
|
35
|
+
functions: report.functions.map((declaration) => ({
|
|
36
|
+
name: declaration.name,
|
|
37
|
+
formula: declaration.formula
|
|
38
|
+
})),
|
|
39
|
+
reportHeader: bandDefinition(report.reportHeader),
|
|
40
|
+
groups: odbReportGroupChain(report).map((group, level) => groupDefinition(group, level, report.name)),
|
|
41
|
+
detail: bandDefinition(report.detail),
|
|
42
|
+
reportFooter: bandDefinition(report.reportFooter)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { odbReportGroupChain, rptBandDefinition, rptDefinitionFromReport };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/odb/formula/errors.ts
|
|
3
|
+
const MESSAGE_FORMULA_PREVIEW_LENGTH = 200;
|
|
4
|
+
function truncateForMessage(formula) {
|
|
5
|
+
return formula.length > MESSAGE_FORMULA_PREVIEW_LENGTH ? `${formula.slice(0, MESSAGE_FORMULA_PREVIEW_LENGTH)}...` : formula;
|
|
6
|
+
}
|
|
7
|
+
var RptFormulaUnsupportedError = class extends Error {
|
|
8
|
+
functionName;
|
|
9
|
+
formula;
|
|
10
|
+
constructor(functionName, formula) {
|
|
11
|
+
super(`Report Builder formula: rpt:${functionName} is not supported by this bounded formula engine -- supported functions are HASCHANGED, LEFT, SUM, COUNT, AVG, MIN, MAX -- in formula: ${truncateForMessage(formula)}`);
|
|
12
|
+
this.name = "RptFormulaUnsupportedError";
|
|
13
|
+
this.functionName = functionName;
|
|
14
|
+
this.formula = formula;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
var RptFormulaParseError = class extends Error {
|
|
18
|
+
formula;
|
|
19
|
+
offset;
|
|
20
|
+
constructor(message, formula, offset) {
|
|
21
|
+
super(`Report Builder formula parse error at offset ${String(offset)}: ${message} -- in formula: ${truncateForMessage(formula)}`);
|
|
22
|
+
this.name = "RptFormulaParseError";
|
|
23
|
+
this.formula = formula;
|
|
24
|
+
this.offset = offset;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var RptFormulaEvaluationError = class extends Error {
|
|
28
|
+
formula;
|
|
29
|
+
constructor(message, formula) {
|
|
30
|
+
super(`Report Builder formula evaluation error: ${message} -- in formula: ${truncateForMessage(formula)}`);
|
|
31
|
+
this.name = "RptFormulaEvaluationError";
|
|
32
|
+
this.formula = formula;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
var RptReportStructureError = class extends Error {
|
|
36
|
+
reportName;
|
|
37
|
+
constructor(message, reportName) {
|
|
38
|
+
super(`Report Builder report structure error in report "${reportName}": ${message}`);
|
|
39
|
+
this.name = "RptReportStructureError";
|
|
40
|
+
this.reportName = reportName;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
exports.RptFormulaEvaluationError = RptFormulaEvaluationError;
|
|
45
|
+
exports.RptFormulaParseError = RptFormulaParseError;
|
|
46
|
+
exports.RptFormulaUnsupportedError = RptFormulaUnsupportedError;
|
|
47
|
+
exports.RptReportStructureError = RptReportStructureError;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/odb/formula/errors.d.ts
|
|
2
|
+
declare class RptFormulaUnsupportedError extends Error {
|
|
3
|
+
readonly functionName: string;
|
|
4
|
+
readonly formula: string;
|
|
5
|
+
constructor(functionName: string, formula: string);
|
|
6
|
+
}
|
|
7
|
+
declare class RptFormulaParseError extends Error {
|
|
8
|
+
readonly formula: string;
|
|
9
|
+
readonly offset: number;
|
|
10
|
+
constructor(message: string, formula: string, offset: number);
|
|
11
|
+
}
|
|
12
|
+
declare class RptFormulaEvaluationError extends Error {
|
|
13
|
+
readonly formula: string;
|
|
14
|
+
constructor(message: string, formula: string);
|
|
15
|
+
}
|
|
16
|
+
declare class RptReportStructureError extends Error {
|
|
17
|
+
readonly reportName: string;
|
|
18
|
+
constructor(message: string, reportName: string);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, RptReportStructureError };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/odb/formula/errors.d.ts
|
|
2
|
+
declare class RptFormulaUnsupportedError extends Error {
|
|
3
|
+
readonly functionName: string;
|
|
4
|
+
readonly formula: string;
|
|
5
|
+
constructor(functionName: string, formula: string);
|
|
6
|
+
}
|
|
7
|
+
declare class RptFormulaParseError extends Error {
|
|
8
|
+
readonly formula: string;
|
|
9
|
+
readonly offset: number;
|
|
10
|
+
constructor(message: string, formula: string, offset: number);
|
|
11
|
+
}
|
|
12
|
+
declare class RptFormulaEvaluationError extends Error {
|
|
13
|
+
readonly formula: string;
|
|
14
|
+
constructor(message: string, formula: string);
|
|
15
|
+
}
|
|
16
|
+
declare class RptReportStructureError extends Error {
|
|
17
|
+
readonly reportName: string;
|
|
18
|
+
constructor(message: string, reportName: string);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, RptReportStructureError };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
//#region src/odb/formula/errors.ts
|
|
2
|
+
const MESSAGE_FORMULA_PREVIEW_LENGTH = 200;
|
|
3
|
+
function truncateForMessage(formula) {
|
|
4
|
+
return formula.length > MESSAGE_FORMULA_PREVIEW_LENGTH ? `${formula.slice(0, MESSAGE_FORMULA_PREVIEW_LENGTH)}...` : formula;
|
|
5
|
+
}
|
|
6
|
+
var RptFormulaUnsupportedError = class extends Error {
|
|
7
|
+
functionName;
|
|
8
|
+
formula;
|
|
9
|
+
constructor(functionName, formula) {
|
|
10
|
+
super(`Report Builder formula: rpt:${functionName} is not supported by this bounded formula engine -- supported functions are HASCHANGED, LEFT, SUM, COUNT, AVG, MIN, MAX -- in formula: ${truncateForMessage(formula)}`);
|
|
11
|
+
this.name = "RptFormulaUnsupportedError";
|
|
12
|
+
this.functionName = functionName;
|
|
13
|
+
this.formula = formula;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var RptFormulaParseError = class extends Error {
|
|
17
|
+
formula;
|
|
18
|
+
offset;
|
|
19
|
+
constructor(message, formula, offset) {
|
|
20
|
+
super(`Report Builder formula parse error at offset ${String(offset)}: ${message} -- in formula: ${truncateForMessage(formula)}`);
|
|
21
|
+
this.name = "RptFormulaParseError";
|
|
22
|
+
this.formula = formula;
|
|
23
|
+
this.offset = offset;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
var RptFormulaEvaluationError = class extends Error {
|
|
27
|
+
formula;
|
|
28
|
+
constructor(message, formula) {
|
|
29
|
+
super(`Report Builder formula evaluation error: ${message} -- in formula: ${truncateForMessage(formula)}`);
|
|
30
|
+
this.name = "RptFormulaEvaluationError";
|
|
31
|
+
this.formula = formula;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var RptReportStructureError = class extends Error {
|
|
35
|
+
reportName;
|
|
36
|
+
constructor(message, reportName) {
|
|
37
|
+
super(`Report Builder report structure error in report "${reportName}": ${message}`);
|
|
38
|
+
this.name = "RptReportStructureError";
|
|
39
|
+
this.reportName = reportName;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
export { RptFormulaEvaluationError, RptFormulaParseError, RptFormulaUnsupportedError, RptReportStructureError };
|