documents.js 1.63.0 → 1.65.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 +124 -25
- package/dist/convert/convert.cjs +3 -3
- package/dist/convert/convert.d.cts +5 -2
- package/dist/convert/convert.d.ts +4 -1
- package/dist/convert/convert.js +3 -3
- 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/ooxml.d.cts +1 -1
- package/dist/fonts/registry.d.cts +1 -1
- 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 +56 -0
- package/dist/index.d.cts +24 -10
- package/dist/index.d.ts +23 -9
- package/dist/index.js +15 -2
- 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/compose.cjs +8 -0
- package/dist/mathml/compose.js +8 -0
- package/dist/mathml/layout-types.d.cts +14 -2
- package/dist/mathml/layout-types.d.ts +14 -2
- package/dist/mathml/layout.cjs +62 -3
- package/dist/mathml/layout.d.cts +1 -1
- package/dist/mathml/layout.d.ts +1 -1
- package/dist/mathml/layout.js +62 -3
- package/dist/mathml/metrics.d.cts +17 -1
- package/dist/mathml/metrics.d.ts +17 -1
- package/dist/mathml/operators.cjs +1 -1
- package/dist/mathml/operators.js +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-CtPhMD0f.d.cts → registry-lqJej0Jr.d.cts} +1 -1
- 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 +2 -2
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_odb_formula_errors = require("./errors.cjs");
|
|
3
|
+
//#region src/odb/formula/parser.ts
|
|
4
|
+
const AGGREGATE_FUNCTIONS = /* @__PURE__ */ new Set([
|
|
5
|
+
"COUNT",
|
|
6
|
+
"SUM",
|
|
7
|
+
"AVG",
|
|
8
|
+
"MIN",
|
|
9
|
+
"MAX"
|
|
10
|
+
]);
|
|
11
|
+
function isAggregateFunction(name) {
|
|
12
|
+
return AGGREGATE_FUNCTIONS.has(name);
|
|
13
|
+
}
|
|
14
|
+
const FIELD_PREFIX = "field:";
|
|
15
|
+
const RPT_PREFIX = "rpt:";
|
|
16
|
+
function isNameCharacter(character) {
|
|
17
|
+
return character >= "A" && character <= "Z" || character >= "a" && character <= "z" || character >= "0" && character <= "9" || character === "_";
|
|
18
|
+
}
|
|
19
|
+
var FormulaScanner = class {
|
|
20
|
+
formula;
|
|
21
|
+
offset = 0;
|
|
22
|
+
constructor(formula) {
|
|
23
|
+
this.formula = formula;
|
|
24
|
+
}
|
|
25
|
+
get position() {
|
|
26
|
+
return this.offset;
|
|
27
|
+
}
|
|
28
|
+
fail(message) {
|
|
29
|
+
throw new require_odb_formula_errors.RptFormulaParseError(message, this.formula, this.offset);
|
|
30
|
+
}
|
|
31
|
+
skipWhitespace() {
|
|
32
|
+
while (this.offset < this.formula.length && /\s/.test(this.formula.charAt(this.offset))) this.offset += 1;
|
|
33
|
+
}
|
|
34
|
+
atEnd() {
|
|
35
|
+
this.skipWhitespace();
|
|
36
|
+
return this.offset >= this.formula.length;
|
|
37
|
+
}
|
|
38
|
+
peek() {
|
|
39
|
+
this.skipWhitespace();
|
|
40
|
+
return this.formula.charAt(this.offset);
|
|
41
|
+
}
|
|
42
|
+
tryConsume(text) {
|
|
43
|
+
this.skipWhitespace();
|
|
44
|
+
if (!this.formula.startsWith(text, this.offset)) return false;
|
|
45
|
+
this.offset += text.length;
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
expect(character, what) {
|
|
49
|
+
this.skipWhitespace();
|
|
50
|
+
if (this.formula.charAt(this.offset) !== character) this.fail(`expected ${what} ("${character}") but found ${this.offset >= this.formula.length ? "the end of the formula" : `"${this.formula.charAt(this.offset)}"`}`);
|
|
51
|
+
this.offset += 1;
|
|
52
|
+
}
|
|
53
|
+
readName(what) {
|
|
54
|
+
this.skipWhitespace();
|
|
55
|
+
const start = this.offset;
|
|
56
|
+
while (this.offset < this.formula.length && isNameCharacter(this.formula.charAt(this.offset))) this.offset += 1;
|
|
57
|
+
if (this.offset === start) this.fail(`expected ${what}`);
|
|
58
|
+
return this.formula.slice(start, this.offset);
|
|
59
|
+
}
|
|
60
|
+
readBracketReference() {
|
|
61
|
+
this.expect("[", "the opening bracket of a column reference");
|
|
62
|
+
const start = this.offset;
|
|
63
|
+
const close = this.formula.indexOf("]", this.offset);
|
|
64
|
+
if (close < 0) {
|
|
65
|
+
this.offset = this.formula.length;
|
|
66
|
+
this.fail("unterminated column reference -- no closing \"]\"");
|
|
67
|
+
}
|
|
68
|
+
this.offset = close + 1;
|
|
69
|
+
return {
|
|
70
|
+
name: this.formula.slice(start, close),
|
|
71
|
+
spelling: "bracket"
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
readQuotedReference() {
|
|
75
|
+
this.expect("\"", "the opening quote of a name reference");
|
|
76
|
+
let name = "";
|
|
77
|
+
for (;;) {
|
|
78
|
+
if (this.offset >= this.formula.length) this.fail("unterminated name reference -- no closing double quote");
|
|
79
|
+
const character = this.formula.charAt(this.offset);
|
|
80
|
+
this.offset += 1;
|
|
81
|
+
if (character !== "\"") {
|
|
82
|
+
name += character;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (this.formula.charAt(this.offset) === "\"") {
|
|
86
|
+
name += "\"";
|
|
87
|
+
this.offset += 1;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
name,
|
|
92
|
+
spelling: "quote"
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
readNumber() {
|
|
97
|
+
this.skipWhitespace();
|
|
98
|
+
const start = this.offset;
|
|
99
|
+
if (this.formula.charAt(this.offset) === "-") this.offset += 1;
|
|
100
|
+
while (this.offset < this.formula.length && this.formula.charAt(this.offset) >= "0" && this.formula.charAt(this.offset) <= "9") this.offset += 1;
|
|
101
|
+
if (this.formula.charAt(this.offset) === ".") {
|
|
102
|
+
this.offset += 1;
|
|
103
|
+
while (this.offset < this.formula.length && this.formula.charAt(this.offset) >= "0" && this.formula.charAt(this.offset) <= "9") this.offset += 1;
|
|
104
|
+
}
|
|
105
|
+
const text = this.formula.slice(start, this.offset);
|
|
106
|
+
const value = Number(text);
|
|
107
|
+
if (text === "" || text === "-" || !Number.isFinite(value)) {
|
|
108
|
+
this.offset = start;
|
|
109
|
+
this.fail("expected a number");
|
|
110
|
+
}
|
|
111
|
+
return value;
|
|
112
|
+
}
|
|
113
|
+
readArgument() {
|
|
114
|
+
const next = this.peek();
|
|
115
|
+
if (next === "") this.fail("expected an argument but found the end of the formula");
|
|
116
|
+
if (next === "[") return {
|
|
117
|
+
kind: "reference",
|
|
118
|
+
reference: this.readBracketReference()
|
|
119
|
+
};
|
|
120
|
+
if (next === "\"") return {
|
|
121
|
+
kind: "reference",
|
|
122
|
+
reference: this.readQuotedReference()
|
|
123
|
+
};
|
|
124
|
+
return {
|
|
125
|
+
kind: "number",
|
|
126
|
+
value: this.readNumber()
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
function referenceArgument(argument, functionName, ordinal, scanner) {
|
|
131
|
+
if (argument?.kind !== "reference") scanner.fail(`rpt:${functionName}'s ${ordinal} argument must be a column or function reference ([NAME] or "NAME")`);
|
|
132
|
+
return argument.reference;
|
|
133
|
+
}
|
|
134
|
+
function expectArgumentCount(argumentValues, expected, functionName, scanner) {
|
|
135
|
+
if (argumentValues.length !== expected) scanner.fail(`rpt:${functionName} takes exactly ${String(expected)} argument${expected === 1 ? "" : "s"}, but ${String(argumentValues.length)} ${argumentValues.length === 1 ? "was" : "were"} given`);
|
|
136
|
+
}
|
|
137
|
+
function buildCall(functionName, argumentValues, formula, scanner) {
|
|
138
|
+
const canonical = functionName.toUpperCase();
|
|
139
|
+
if (canonical === "HASCHANGED") {
|
|
140
|
+
expectArgumentCount(argumentValues, 1, functionName, scanner);
|
|
141
|
+
return {
|
|
142
|
+
kind: "hasChanged",
|
|
143
|
+
reference: referenceArgument(argumentValues[0], functionName, "first", scanner),
|
|
144
|
+
text: formula
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
if (canonical === "LEFT") {
|
|
148
|
+
expectArgumentCount(argumentValues, 2, functionName, scanner);
|
|
149
|
+
const reference = referenceArgument(argumentValues[0], functionName, "first", scanner);
|
|
150
|
+
const lengthArgument = argumentValues[1];
|
|
151
|
+
if (lengthArgument?.kind !== "number") scanner.fail(`rpt:${functionName}'s second argument must be a number of characters`);
|
|
152
|
+
if (!Number.isInteger(lengthArgument.value) || lengthArgument.value < 0) scanner.fail(`rpt:${functionName}'s second argument must be a non-negative whole number of characters, but was ${String(lengthArgument.value)}`);
|
|
153
|
+
return {
|
|
154
|
+
kind: "left",
|
|
155
|
+
reference,
|
|
156
|
+
length: lengthArgument.value,
|
|
157
|
+
text: formula
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
if (isAggregateFunction(canonical)) {
|
|
161
|
+
expectArgumentCount(argumentValues, 1, functionName, scanner);
|
|
162
|
+
return {
|
|
163
|
+
kind: "aggregate",
|
|
164
|
+
aggregate: canonical,
|
|
165
|
+
reference: referenceArgument(argumentValues[0], functionName, "first", scanner),
|
|
166
|
+
text: formula
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
throw new require_odb_formula_errors.RptFormulaUnsupportedError(functionName, formula);
|
|
170
|
+
}
|
|
171
|
+
function parseRptFormula(formula) {
|
|
172
|
+
const scanner = new FormulaScanner(formula);
|
|
173
|
+
if (scanner.tryConsume(FIELD_PREFIX)) {
|
|
174
|
+
const reference = scanner.readBracketReference();
|
|
175
|
+
if (!scanner.atEnd()) scanner.fail("unexpected trailing text after a field: reference");
|
|
176
|
+
return {
|
|
177
|
+
kind: "field",
|
|
178
|
+
reference,
|
|
179
|
+
text: formula
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
if (!scanner.tryConsume(RPT_PREFIX)) scanner.fail(`expected a formula beginning "${FIELD_PREFIX}" or "${RPT_PREFIX}"`);
|
|
183
|
+
const functionName = scanner.readName("an rpt: function name");
|
|
184
|
+
scanner.expect("(", "the opening parenthesis of a function's argument list");
|
|
185
|
+
const argumentValues = [];
|
|
186
|
+
if (scanner.peek() !== ")") {
|
|
187
|
+
argumentValues.push(scanner.readArgument());
|
|
188
|
+
while (scanner.peek() === ";") {
|
|
189
|
+
scanner.expect(";", "an argument separator");
|
|
190
|
+
argumentValues.push(scanner.readArgument());
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
scanner.expect(")", "the closing parenthesis of a function's argument list");
|
|
194
|
+
if (!scanner.atEnd()) scanner.fail("unexpected trailing text after a function call");
|
|
195
|
+
return buildCall(functionName, argumentValues, formula, scanner);
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
exports.parseRptFormula = parseRptFormula;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { n as CellAggregateFunction } from "../../values-BetetbaH.cjs";
|
|
2
|
+
//#region src/odb/formula/parser.d.ts
|
|
3
|
+
type RptAggregateFunction = CellAggregateFunction;
|
|
4
|
+
interface RptReference {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly spelling: 'bracket' | 'quote';
|
|
7
|
+
}
|
|
8
|
+
type RptFormula = {
|
|
9
|
+
readonly kind: 'field';
|
|
10
|
+
readonly reference: RptReference;
|
|
11
|
+
readonly text: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: 'hasChanged';
|
|
14
|
+
readonly reference: RptReference;
|
|
15
|
+
readonly text: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: 'left';
|
|
18
|
+
readonly reference: RptReference;
|
|
19
|
+
readonly length: number;
|
|
20
|
+
readonly text: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: 'aggregate';
|
|
23
|
+
readonly aggregate: RptAggregateFunction;
|
|
24
|
+
readonly reference: RptReference;
|
|
25
|
+
readonly text: string;
|
|
26
|
+
};
|
|
27
|
+
declare function parseRptFormula(formula: string): RptFormula;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { RptAggregateFunction, RptFormula, RptReference, parseRptFormula };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { n as CellAggregateFunction } from "../../values-BetetbaH.js";
|
|
2
|
+
//#region src/odb/formula/parser.d.ts
|
|
3
|
+
type RptAggregateFunction = CellAggregateFunction;
|
|
4
|
+
interface RptReference {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly spelling: 'bracket' | 'quote';
|
|
7
|
+
}
|
|
8
|
+
type RptFormula = {
|
|
9
|
+
readonly kind: 'field';
|
|
10
|
+
readonly reference: RptReference;
|
|
11
|
+
readonly text: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: 'hasChanged';
|
|
14
|
+
readonly reference: RptReference;
|
|
15
|
+
readonly text: string;
|
|
16
|
+
} | {
|
|
17
|
+
readonly kind: 'left';
|
|
18
|
+
readonly reference: RptReference;
|
|
19
|
+
readonly length: number;
|
|
20
|
+
readonly text: string;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: 'aggregate';
|
|
23
|
+
readonly aggregate: RptAggregateFunction;
|
|
24
|
+
readonly reference: RptReference;
|
|
25
|
+
readonly text: string;
|
|
26
|
+
};
|
|
27
|
+
declare function parseRptFormula(formula: string): RptFormula;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { RptAggregateFunction, RptFormula, RptReference, parseRptFormula };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { RptFormulaParseError, RptFormulaUnsupportedError } from "./errors.js";
|
|
2
|
+
//#region src/odb/formula/parser.ts
|
|
3
|
+
const AGGREGATE_FUNCTIONS = /* @__PURE__ */ new Set([
|
|
4
|
+
"COUNT",
|
|
5
|
+
"SUM",
|
|
6
|
+
"AVG",
|
|
7
|
+
"MIN",
|
|
8
|
+
"MAX"
|
|
9
|
+
]);
|
|
10
|
+
function isAggregateFunction(name) {
|
|
11
|
+
return AGGREGATE_FUNCTIONS.has(name);
|
|
12
|
+
}
|
|
13
|
+
const FIELD_PREFIX = "field:";
|
|
14
|
+
const RPT_PREFIX = "rpt:";
|
|
15
|
+
function isNameCharacter(character) {
|
|
16
|
+
return character >= "A" && character <= "Z" || character >= "a" && character <= "z" || character >= "0" && character <= "9" || character === "_";
|
|
17
|
+
}
|
|
18
|
+
var FormulaScanner = class {
|
|
19
|
+
formula;
|
|
20
|
+
offset = 0;
|
|
21
|
+
constructor(formula) {
|
|
22
|
+
this.formula = formula;
|
|
23
|
+
}
|
|
24
|
+
get position() {
|
|
25
|
+
return this.offset;
|
|
26
|
+
}
|
|
27
|
+
fail(message) {
|
|
28
|
+
throw new RptFormulaParseError(message, this.formula, this.offset);
|
|
29
|
+
}
|
|
30
|
+
skipWhitespace() {
|
|
31
|
+
while (this.offset < this.formula.length && /\s/.test(this.formula.charAt(this.offset))) this.offset += 1;
|
|
32
|
+
}
|
|
33
|
+
atEnd() {
|
|
34
|
+
this.skipWhitespace();
|
|
35
|
+
return this.offset >= this.formula.length;
|
|
36
|
+
}
|
|
37
|
+
peek() {
|
|
38
|
+
this.skipWhitespace();
|
|
39
|
+
return this.formula.charAt(this.offset);
|
|
40
|
+
}
|
|
41
|
+
tryConsume(text) {
|
|
42
|
+
this.skipWhitespace();
|
|
43
|
+
if (!this.formula.startsWith(text, this.offset)) return false;
|
|
44
|
+
this.offset += text.length;
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
expect(character, what) {
|
|
48
|
+
this.skipWhitespace();
|
|
49
|
+
if (this.formula.charAt(this.offset) !== character) this.fail(`expected ${what} ("${character}") but found ${this.offset >= this.formula.length ? "the end of the formula" : `"${this.formula.charAt(this.offset)}"`}`);
|
|
50
|
+
this.offset += 1;
|
|
51
|
+
}
|
|
52
|
+
readName(what) {
|
|
53
|
+
this.skipWhitespace();
|
|
54
|
+
const start = this.offset;
|
|
55
|
+
while (this.offset < this.formula.length && isNameCharacter(this.formula.charAt(this.offset))) this.offset += 1;
|
|
56
|
+
if (this.offset === start) this.fail(`expected ${what}`);
|
|
57
|
+
return this.formula.slice(start, this.offset);
|
|
58
|
+
}
|
|
59
|
+
readBracketReference() {
|
|
60
|
+
this.expect("[", "the opening bracket of a column reference");
|
|
61
|
+
const start = this.offset;
|
|
62
|
+
const close = this.formula.indexOf("]", this.offset);
|
|
63
|
+
if (close < 0) {
|
|
64
|
+
this.offset = this.formula.length;
|
|
65
|
+
this.fail("unterminated column reference -- no closing \"]\"");
|
|
66
|
+
}
|
|
67
|
+
this.offset = close + 1;
|
|
68
|
+
return {
|
|
69
|
+
name: this.formula.slice(start, close),
|
|
70
|
+
spelling: "bracket"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
readQuotedReference() {
|
|
74
|
+
this.expect("\"", "the opening quote of a name reference");
|
|
75
|
+
let name = "";
|
|
76
|
+
for (;;) {
|
|
77
|
+
if (this.offset >= this.formula.length) this.fail("unterminated name reference -- no closing double quote");
|
|
78
|
+
const character = this.formula.charAt(this.offset);
|
|
79
|
+
this.offset += 1;
|
|
80
|
+
if (character !== "\"") {
|
|
81
|
+
name += character;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (this.formula.charAt(this.offset) === "\"") {
|
|
85
|
+
name += "\"";
|
|
86
|
+
this.offset += 1;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
name,
|
|
91
|
+
spelling: "quote"
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
readNumber() {
|
|
96
|
+
this.skipWhitespace();
|
|
97
|
+
const start = this.offset;
|
|
98
|
+
if (this.formula.charAt(this.offset) === "-") this.offset += 1;
|
|
99
|
+
while (this.offset < this.formula.length && this.formula.charAt(this.offset) >= "0" && this.formula.charAt(this.offset) <= "9") this.offset += 1;
|
|
100
|
+
if (this.formula.charAt(this.offset) === ".") {
|
|
101
|
+
this.offset += 1;
|
|
102
|
+
while (this.offset < this.formula.length && this.formula.charAt(this.offset) >= "0" && this.formula.charAt(this.offset) <= "9") this.offset += 1;
|
|
103
|
+
}
|
|
104
|
+
const text = this.formula.slice(start, this.offset);
|
|
105
|
+
const value = Number(text);
|
|
106
|
+
if (text === "" || text === "-" || !Number.isFinite(value)) {
|
|
107
|
+
this.offset = start;
|
|
108
|
+
this.fail("expected a number");
|
|
109
|
+
}
|
|
110
|
+
return value;
|
|
111
|
+
}
|
|
112
|
+
readArgument() {
|
|
113
|
+
const next = this.peek();
|
|
114
|
+
if (next === "") this.fail("expected an argument but found the end of the formula");
|
|
115
|
+
if (next === "[") return {
|
|
116
|
+
kind: "reference",
|
|
117
|
+
reference: this.readBracketReference()
|
|
118
|
+
};
|
|
119
|
+
if (next === "\"") return {
|
|
120
|
+
kind: "reference",
|
|
121
|
+
reference: this.readQuotedReference()
|
|
122
|
+
};
|
|
123
|
+
return {
|
|
124
|
+
kind: "number",
|
|
125
|
+
value: this.readNumber()
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
function referenceArgument(argument, functionName, ordinal, scanner) {
|
|
130
|
+
if (argument?.kind !== "reference") scanner.fail(`rpt:${functionName}'s ${ordinal} argument must be a column or function reference ([NAME] or "NAME")`);
|
|
131
|
+
return argument.reference;
|
|
132
|
+
}
|
|
133
|
+
function expectArgumentCount(argumentValues, expected, functionName, scanner) {
|
|
134
|
+
if (argumentValues.length !== expected) scanner.fail(`rpt:${functionName} takes exactly ${String(expected)} argument${expected === 1 ? "" : "s"}, but ${String(argumentValues.length)} ${argumentValues.length === 1 ? "was" : "were"} given`);
|
|
135
|
+
}
|
|
136
|
+
function buildCall(functionName, argumentValues, formula, scanner) {
|
|
137
|
+
const canonical = functionName.toUpperCase();
|
|
138
|
+
if (canonical === "HASCHANGED") {
|
|
139
|
+
expectArgumentCount(argumentValues, 1, functionName, scanner);
|
|
140
|
+
return {
|
|
141
|
+
kind: "hasChanged",
|
|
142
|
+
reference: referenceArgument(argumentValues[0], functionName, "first", scanner),
|
|
143
|
+
text: formula
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (canonical === "LEFT") {
|
|
147
|
+
expectArgumentCount(argumentValues, 2, functionName, scanner);
|
|
148
|
+
const reference = referenceArgument(argumentValues[0], functionName, "first", scanner);
|
|
149
|
+
const lengthArgument = argumentValues[1];
|
|
150
|
+
if (lengthArgument?.kind !== "number") scanner.fail(`rpt:${functionName}'s second argument must be a number of characters`);
|
|
151
|
+
if (!Number.isInteger(lengthArgument.value) || lengthArgument.value < 0) scanner.fail(`rpt:${functionName}'s second argument must be a non-negative whole number of characters, but was ${String(lengthArgument.value)}`);
|
|
152
|
+
return {
|
|
153
|
+
kind: "left",
|
|
154
|
+
reference,
|
|
155
|
+
length: lengthArgument.value,
|
|
156
|
+
text: formula
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if (isAggregateFunction(canonical)) {
|
|
160
|
+
expectArgumentCount(argumentValues, 1, functionName, scanner);
|
|
161
|
+
return {
|
|
162
|
+
kind: "aggregate",
|
|
163
|
+
aggregate: canonical,
|
|
164
|
+
reference: referenceArgument(argumentValues[0], functionName, "first", scanner),
|
|
165
|
+
text: formula
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
throw new RptFormulaUnsupportedError(functionName, formula);
|
|
169
|
+
}
|
|
170
|
+
function parseRptFormula(formula) {
|
|
171
|
+
const scanner = new FormulaScanner(formula);
|
|
172
|
+
if (scanner.tryConsume(FIELD_PREFIX)) {
|
|
173
|
+
const reference = scanner.readBracketReference();
|
|
174
|
+
if (!scanner.atEnd()) scanner.fail("unexpected trailing text after a field: reference");
|
|
175
|
+
return {
|
|
176
|
+
kind: "field",
|
|
177
|
+
reference,
|
|
178
|
+
text: formula
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
if (!scanner.tryConsume(RPT_PREFIX)) scanner.fail(`expected a formula beginning "${FIELD_PREFIX}" or "${RPT_PREFIX}"`);
|
|
182
|
+
const functionName = scanner.readName("an rpt: function name");
|
|
183
|
+
scanner.expect("(", "the opening parenthesis of a function's argument list");
|
|
184
|
+
const argumentValues = [];
|
|
185
|
+
if (scanner.peek() !== ")") {
|
|
186
|
+
argumentValues.push(scanner.readArgument());
|
|
187
|
+
while (scanner.peek() === ";") {
|
|
188
|
+
scanner.expect(";", "an argument separator");
|
|
189
|
+
argumentValues.push(scanner.readArgument());
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
scanner.expect(")", "the closing parenthesis of a function's argument list");
|
|
193
|
+
if (!scanner.atEnd()) scanner.fail("unexpected trailing text after a function call");
|
|
194
|
+
return buildCall(functionName, argumentValues, formula, scanner);
|
|
195
|
+
}
|
|
196
|
+
//#endregion
|
|
197
|
+
export { parseRptFormula };
|
package/dist/odb/read.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.cjs";
|
|
2
|
-
import { HsqldbTable } from "../
|
|
2
|
+
import { r as HsqldbTable } from "../script-DsGGIzGU.cjs";
|
|
3
3
|
import { Package } from "odf.js";
|
|
4
4
|
//#region src/odb/read.d.ts
|
|
5
5
|
declare class OdbNoEmbeddedDataSourceError extends Error {
|
package/dist/odb/read.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as HsqldbDecodeOptions } from "../rowformat-Cl2exlEh.js";
|
|
2
|
-
import { HsqldbTable } from "../
|
|
2
|
+
import { r as HsqldbTable } from "../script-DsGGIzGU.js";
|
|
3
3
|
import { Package } from "odf.js";
|
|
4
4
|
//#region src/odb/read.d.ts
|
|
5
5
|
declare class OdbNoEmbeddedDataSourceError extends Error {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_odb_report_render = require("./render.cjs");
|
|
3
|
+
const require_odb_report_source = require("./source.cjs");
|
|
4
|
+
let odf_js = require("odf.js");
|
|
5
|
+
//#region src/odb/report/content.ts
|
|
6
|
+
var OdbReportNotSpecifiedError = class extends Error {
|
|
7
|
+
availableReports;
|
|
8
|
+
constructor(availableReports) {
|
|
9
|
+
super(availableReports.length === 0 ? "readOdbReportContent: this .odb declares no reports at all" : `readOdbReportContent: this .odb declares more than one report (${availableReports.join(", ")}) -- pass { report: '<name>' } to select one`);
|
|
10
|
+
this.name = "OdbReportNotSpecifiedError";
|
|
11
|
+
this.availableReports = availableReports;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
function selectReport(pkg, reportName) {
|
|
15
|
+
if (reportName !== void 0) return (0, odf_js.readOdbReport)(pkg, reportName);
|
|
16
|
+
const declared = (0, odf_js.readOdbInventory)(pkg).reports;
|
|
17
|
+
const only = declared.length === 1 ? declared[0] : void 0;
|
|
18
|
+
if (only === void 0) throw new OdbReportNotSpecifiedError(declared.map((component) => component.name));
|
|
19
|
+
return (0, odf_js.readOdbReport)(pkg, only.name);
|
|
20
|
+
}
|
|
21
|
+
function readOdbReportContent(pkg, options) {
|
|
22
|
+
const report = selectReport(pkg, options?.report);
|
|
23
|
+
return require_odb_report_render.renderOdbReportContent(report, require_odb_report_source.resolveOdbReportRows(pkg, report, options));
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
exports.OdbReportNotSpecifiedError = OdbReportNotSpecifiedError;
|
|
27
|
+
exports.readOdbReportContent = readOdbReportContent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { n as HsqldbDecodeOptions } from "../../rowformat-Cl2exlEh.cjs";
|
|
2
|
+
import { ContentDocument } from "document-schema.js";
|
|
3
|
+
import { Package } from "odf.js";
|
|
4
|
+
//#region src/odb/report/content.d.ts
|
|
5
|
+
declare class OdbReportNotSpecifiedError extends Error {
|
|
6
|
+
readonly availableReports: readonly string[];
|
|
7
|
+
constructor(availableReports: readonly string[]);
|
|
8
|
+
}
|
|
9
|
+
interface OdbReportContentOptions extends HsqldbDecodeOptions {
|
|
10
|
+
readonly report?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function readOdbReportContent(pkg: Package, options?: OdbReportContentOptions): ContentDocument;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { OdbReportContentOptions, OdbReportNotSpecifiedError, readOdbReportContent };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { n as HsqldbDecodeOptions } from "../../rowformat-Cl2exlEh.js";
|
|
2
|
+
import { ContentDocument } from "document-schema.js";
|
|
3
|
+
import { Package } from "odf.js";
|
|
4
|
+
//#region src/odb/report/content.d.ts
|
|
5
|
+
declare class OdbReportNotSpecifiedError extends Error {
|
|
6
|
+
readonly availableReports: readonly string[];
|
|
7
|
+
constructor(availableReports: readonly string[]);
|
|
8
|
+
}
|
|
9
|
+
interface OdbReportContentOptions extends HsqldbDecodeOptions {
|
|
10
|
+
readonly report?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function readOdbReportContent(pkg: Package, options?: OdbReportContentOptions): ContentDocument;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { OdbReportContentOptions, OdbReportNotSpecifiedError, readOdbReportContent };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { renderOdbReportContent } from "./render.js";
|
|
2
|
+
import { resolveOdbReportRows } from "./source.js";
|
|
3
|
+
import { readOdbInventory, readOdbReport } from "odf.js";
|
|
4
|
+
//#region src/odb/report/content.ts
|
|
5
|
+
var OdbReportNotSpecifiedError = class extends Error {
|
|
6
|
+
availableReports;
|
|
7
|
+
constructor(availableReports) {
|
|
8
|
+
super(availableReports.length === 0 ? "readOdbReportContent: this .odb declares no reports at all" : `readOdbReportContent: this .odb declares more than one report (${availableReports.join(", ")}) -- pass { report: '<name>' } to select one`);
|
|
9
|
+
this.name = "OdbReportNotSpecifiedError";
|
|
10
|
+
this.availableReports = availableReports;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function selectReport(pkg, reportName) {
|
|
14
|
+
if (reportName !== void 0) return readOdbReport(pkg, reportName);
|
|
15
|
+
const declared = readOdbInventory(pkg).reports;
|
|
16
|
+
const only = declared.length === 1 ? declared[0] : void 0;
|
|
17
|
+
if (only === void 0) throw new OdbReportNotSpecifiedError(declared.map((component) => component.name));
|
|
18
|
+
return readOdbReport(pkg, only.name);
|
|
19
|
+
}
|
|
20
|
+
function readOdbReportContent(pkg, options) {
|
|
21
|
+
const report = selectReport(pkg, options?.report);
|
|
22
|
+
return renderOdbReportContent(report, resolveOdbReportRows(pkg, report, options));
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { OdbReportNotSpecifiedError, readOdbReportContent };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_hsqldb_script = require("../../hsqldb/script.cjs");
|
|
3
|
+
const require_odb_formula_evaluate = require("../formula/evaluate.cjs");
|
|
4
|
+
const require_odb_formula_definition = require("../formula/definition.cjs");
|
|
5
|
+
let document_schema_js = require("document-schema.js");
|
|
6
|
+
//#region src/odb/report/render.ts
|
|
7
|
+
const MARGIN_PT = 56.69291338582677;
|
|
8
|
+
const CONTENT_WIDTH_PT = document_schema_js.PAGE_SIZE_A4.widthPt - 2 * MARGIN_PT;
|
|
9
|
+
const REPORT_HEADER_STYLE = "Report Header";
|
|
10
|
+
const PAGE_HEADER_STYLE = "Page Header";
|
|
11
|
+
const DETAIL_STYLE = "Detail";
|
|
12
|
+
const PAGE_FOOTER_STYLE = "Page Footer";
|
|
13
|
+
const REPORT_FOOTER_STYLE = "Report Footer";
|
|
14
|
+
function groupBandStyle(kind, level) {
|
|
15
|
+
return `${kind === "group-header" ? "Group Header" : "Group Footer"} ${String(level + 1)}`;
|
|
16
|
+
}
|
|
17
|
+
function printedBand(band, styleId, values) {
|
|
18
|
+
if (band === void 0) throw new Error(`rpt report render: a "${styleId}" band instance was emitted for a band this report does not declare`);
|
|
19
|
+
return {
|
|
20
|
+
styleId,
|
|
21
|
+
elements: band.elements,
|
|
22
|
+
values
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function bandOfInstance(report, groups, instance) {
|
|
26
|
+
switch (instance.kind) {
|
|
27
|
+
case "report-header": return printedBand(report.reportHeader, REPORT_HEADER_STYLE, instance.values);
|
|
28
|
+
case "detail": return printedBand(report.detail, DETAIL_STYLE, instance.values);
|
|
29
|
+
case "report-footer": return printedBand(report.reportFooter, REPORT_FOOTER_STYLE, instance.values);
|
|
30
|
+
case "group-header":
|
|
31
|
+
case "group-footer": {
|
|
32
|
+
const level = instance.groupLevel;
|
|
33
|
+
if (level === void 0) throw new Error(`rpt report render: a ${instance.kind} band instance carries no group level`);
|
|
34
|
+
const group = groups[level];
|
|
35
|
+
if (group === void 0) throw new Error(`rpt report render: a ${instance.kind} band instance names group level ${String(level)}, which this report's own chain of ${String(groups.length)} group(s) does not reach`);
|
|
36
|
+
return printedBand(instance.kind === "group-header" ? group.header : group.footer, groupBandStyle(instance.kind, level), instance.values);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function elementText(element, value) {
|
|
41
|
+
if (element.formula === void 0) return element.text ?? "";
|
|
42
|
+
if (value === void 0) throw new Error(`rpt report render: control "${element.formula}" carries a formula but the run produced no value for it`);
|
|
43
|
+
return require_hsqldb_script.displayTextFor(value);
|
|
44
|
+
}
|
|
45
|
+
function cellParagraph(element, value, styleId) {
|
|
46
|
+
const text = elementText(element, value);
|
|
47
|
+
return {
|
|
48
|
+
kind: "paragraph",
|
|
49
|
+
styleId,
|
|
50
|
+
runs: text === "" ? [] : [{ text }]
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function bandTable(band) {
|
|
54
|
+
if (band.elements.length === 0) return;
|
|
55
|
+
if (band.values.length !== band.elements.length) throw new Error(`rpt report render: the "${band.styleId}" band printed ${String(band.values.length)} values for ${String(band.elements.length)} control(s)`);
|
|
56
|
+
const columnWidthPt = CONTENT_WIDTH_PT / band.elements.length;
|
|
57
|
+
return {
|
|
58
|
+
kind: "table",
|
|
59
|
+
columnWidthsPt: band.elements.map(() => columnWidthPt),
|
|
60
|
+
rows: [{ cells: band.elements.map((element, index) => ({ blocks: [cellParagraph(element, band.values[index], band.styleId)] })) }]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function bandBlocks(bands) {
|
|
64
|
+
return bands.flatMap((band) => {
|
|
65
|
+
const table = bandTable(band);
|
|
66
|
+
return table === void 0 ? [] : [table];
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function pageBands(definition, band, styleId, resultSet) {
|
|
70
|
+
if (band === void 0) return [];
|
|
71
|
+
return [{
|
|
72
|
+
styleId,
|
|
73
|
+
elements: band.elements,
|
|
74
|
+
values: require_odb_formula_evaluate.evaluateRptBandOutsideData(definition, require_odb_formula_definition.rptBandDefinition(band), resultSet)
|
|
75
|
+
}];
|
|
76
|
+
}
|
|
77
|
+
function renderOdbReportContent(report, resultSet) {
|
|
78
|
+
const definition = require_odb_formula_definition.rptDefinitionFromReport(report);
|
|
79
|
+
const groups = require_odb_formula_definition.odbReportGroupChain(report);
|
|
80
|
+
const instances = require_odb_formula_evaluate.runRptReport(definition, resultSet).bands;
|
|
81
|
+
const printed = (matches) => instances.filter((instance) => matches(instance.kind)).map((instance) => bandOfInstance(report, groups, instance));
|
|
82
|
+
const section = {
|
|
83
|
+
pageSize: document_schema_js.PAGE_SIZE_A4,
|
|
84
|
+
margins: {
|
|
85
|
+
topPt: MARGIN_PT,
|
|
86
|
+
rightPt: MARGIN_PT,
|
|
87
|
+
bottomPt: MARGIN_PT,
|
|
88
|
+
leftPt: MARGIN_PT
|
|
89
|
+
},
|
|
90
|
+
blocks: [
|
|
91
|
+
...bandBlocks(printed((kind) => kind === "report-header")),
|
|
92
|
+
...bandBlocks(pageBands(definition, report.pageHeader, PAGE_HEADER_STYLE, resultSet)),
|
|
93
|
+
...bandBlocks(printed((kind) => kind !== "report-header" && kind !== "report-footer")),
|
|
94
|
+
...bandBlocks(pageBands(definition, report.pageFooter, PAGE_FOOTER_STYLE, resultSet)),
|
|
95
|
+
...bandBlocks(printed((kind) => kind === "report-footer"))
|
|
96
|
+
]
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
kind: "wordprocessing",
|
|
100
|
+
formatVersion: document_schema_js.CONTENT_FORMAT_VERSION,
|
|
101
|
+
metadata: { title: report.caption ?? report.name },
|
|
102
|
+
sections: [section]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
exports.renderOdbReportContent = renderOdbReportContent;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { t as SqlResultSet } from "../../evaluate-BhMXY6DM.cjs";
|
|
2
|
+
import { ContentDocument } from "document-schema.js";
|
|
3
|
+
import { OdbReport } from "odf.js";
|
|
4
|
+
//#region src/odb/report/render.d.ts
|
|
5
|
+
declare function renderOdbReportContent(report: OdbReport, resultSet: SqlResultSet): ContentDocument;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { renderOdbReportContent };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { t as SqlResultSet } from "../../evaluate-BU5N1Jk1.js";
|
|
2
|
+
import { ContentDocument } from "document-schema.js";
|
|
3
|
+
import { OdbReport } from "odf.js";
|
|
4
|
+
//#region src/odb/report/render.d.ts
|
|
5
|
+
declare function renderOdbReportContent(report: OdbReport, resultSet: SqlResultSet): ContentDocument;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { renderOdbReportContent };
|