@evotecit/officeimo 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/README.md +59 -51
  2. package/bundles/officeimo-canopyx.js +1553 -314
  3. package/bundles/officeimo-canopyx.mjs +1497 -269
  4. package/bundles/officeimo-csv.js +18 -15
  5. package/bundles/officeimo-csv.mjs +16 -13
  6. package/bundles/officeimo-datatables.js +463 -301
  7. package/bundles/officeimo-datatables.mjs +420 -259
  8. package/bundles/officeimo-pdf.js +148 -65
  9. package/bundles/officeimo-pdf.mjs +124 -41
  10. package/bundles/officeimo-xlsx.js +177 -101
  11. package/bundles/officeimo-xlsx.mjs +149 -74
  12. package/bundles/officeimo.js +461 -299
  13. package/bundles/officeimo.mjs +419 -258
  14. package/dist/csv/index.js +16 -13
  15. package/dist/integrations/canopyx/diagnostics.d.ts +3 -0
  16. package/dist/integrations/canopyx/diagnostics.js +17 -0
  17. package/dist/integrations/canopyx/grouping.d.ts +6 -0
  18. package/dist/integrations/canopyx/grouping.js +198 -0
  19. package/dist/integrations/canopyx/index.d.ts +2 -2
  20. package/dist/integrations/canopyx/index.js +89 -15
  21. package/dist/integrations/canopyx/metadata.d.ts +4 -0
  22. package/dist/integrations/canopyx/metadata.js +51 -0
  23. package/dist/integrations/canopyx/pdf-layout.d.ts +5 -0
  24. package/dist/integrations/canopyx/pdf-layout.js +97 -0
  25. package/dist/integrations/canopyx/pdf-number.d.ts +3 -0
  26. package/dist/integrations/canopyx/pdf-number.js +64 -0
  27. package/dist/integrations/canopyx/pivot.d.ts +15 -0
  28. package/dist/integrations/canopyx/pivot.js +67 -0
  29. package/dist/integrations/canopyx/presentation.d.ts +8 -0
  30. package/dist/integrations/canopyx/presentation.js +40 -0
  31. package/dist/integrations/canopyx/rule-predicates.d.ts +3 -0
  32. package/dist/integrations/canopyx/rule-predicates.js +110 -0
  33. package/dist/integrations/canopyx/rules.d.ts +6 -0
  34. package/dist/integrations/canopyx/rules.js +176 -0
  35. package/dist/integrations/canopyx/source.js +69 -31
  36. package/dist/integrations/canopyx/types.d.ts +134 -10
  37. package/dist/integrations/canopyx/workbook.d.ts +6 -0
  38. package/dist/integrations/canopyx/workbook.js +52 -0
  39. package/dist/opc/index.js +9 -0
  40. package/dist/pdf/font-resources.js +33 -14
  41. package/dist/pdf/pages.js +60 -14
  42. package/dist/pdf/table-band-flow.js +7 -2
  43. package/dist/pdf/table-band-plan.js +9 -1
  44. package/dist/pdf/table-layout.js +6 -2
  45. package/dist/pdf/table-structure.js +9 -8
  46. package/dist/xlsx/index.d.ts +1 -1
  47. package/dist/xlsx/options.js +1 -1
  48. package/dist/xlsx/outlines.d.ts +3 -0
  49. package/dist/xlsx/outlines.js +39 -0
  50. package/dist/xlsx/types.d.ts +9 -0
  51. package/dist/xlsx/values.js +11 -2
  52. package/dist/xlsx/workbook.js +2 -0
  53. package/dist/xlsx/worksheet.js +14 -6
  54. package/package.json +2 -2
@@ -1110,7 +1110,7 @@ _modules.set("81b3d47c02b7d8443b79e02b3cfb52032d6b73d9a3fb592b777ebe028ad0ef00",
1110
1110
  return _exports;
1111
1111
  })();
1112
1112
 
1113
- const _m0 = _modules.get("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1") ?? (() => {
1113
+ const _m0 = _modules.get("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4") ?? (() => {
1114
1114
  const { beginTask, checkAbort, consumeRows, taskYieldDue, withAbort } = _m1;
1115
1115
 
1116
1116
  const { BlobByteSink, ChunkedTextSink, withDestination } = _m2;
@@ -1135,29 +1135,32 @@ const { captureCsvOptions } = _m15;
1135
1135
 
1136
1136
 
1137
1137
 
1138
- function csvField(value, delimiter, protect, quote, booleanText, nullValue) {
1139
- if (value == null && nullValue !== undefined)
1140
- value = nullValue;
1138
+ function csvField(value, delimiter, protect, quote, booleanText) {
1139
+ const kind = typeof value;
1141
1140
  let text;
1142
1141
  if (value == null)
1143
1142
  text = "";
1143
+ else if (kind === "string")
1144
+ text = value;
1145
+ else if (kind === "number") {
1146
+ text = Number.isFinite(value) ? String(value) : "";
1147
+ // Numeric text has no CSV delimiter, quote or line break to escape.
1148
+ return quote === "all" ? '"' + text + '"' : text;
1149
+ }
1150
+ else if (kind === "boolean")
1151
+ text = booleanText[value ? "true" : "false"];
1144
1152
  else if (isDate(value))
1145
1153
  text = Number.isFinite(value.getTime()) ? value.toISOString() : "";
1146
- else if (typeof value === "boolean")
1147
- text = booleanText[value ? "true" : "false"];
1148
- else if (typeof value === "number")
1149
- text = Number.isFinite(value) ? String(value) : "";
1150
- else if (typeof value === "string")
1151
- text = value;
1152
1154
  else {
1153
1155
  if (typeof value.then === "function")
1154
1156
  void Promise.resolve(value).catch(() => { });
1155
1157
  throw new TypeError("CSV cells and formatter results must be synchronous strings, numbers, booleans, Dates or null.");
1156
1158
  }
1157
- if (protect && (typeof value === "string" || typeof value === "boolean") && /^ *[=+\-@\t\r\n]/.test(text))
1159
+ // Only ASCII spaces, controls and markers through @ can begin the protected prefix.
1160
+ if (protect && (kind === "string" || kind === "boolean") && text.charCodeAt(0) <= 64 && /^ *[=+\-@\t\r\n]/.test(text))
1158
1161
  text = "'" + text;
1159
- return quote === "all" || (quote === "strings" && typeof value === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
1160
- ? '"' + text.replace(/"/g, '""') + '"' : text;
1162
+ return quote === "all" || (quote === "strings" && kind === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
1163
+ ? '"' + (text.includes('"') ? text.replace(/"/g, '""') : text) + '"' : text;
1161
1164
  }
1162
1165
  async function writeCsvTo(rows, destination, configuration) {
1163
1166
  const options = captureCsvOptions(configuration);
@@ -1209,7 +1212,7 @@ async function write(rows, sink, options) {
1209
1212
  value = options.nullValue;
1210
1213
  budget.cell(typeof value === "boolean" ? booleanText[value ? "true" : "false"] : value);
1211
1214
  checkAbort(signal);
1212
- text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText, options.nullValue);
1215
+ text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText);
1213
1216
  if (text.length >= buffer.chunkSize || (i & 127) === 127 && taskYieldDue()) {
1214
1217
  if (buffer.append(text))
1215
1218
  return buffer.flush().then(() => record(values, header, i + 1, snapshot));
@@ -1257,7 +1260,7 @@ async function writeCsv(rows, configuration) {
1257
1260
  }
1258
1261
  }
1259
1262
  const _exports = Object.freeze({ saveBlob: _m16.saveBlob, ExportCell: _m6.ExportCell, writeCsvTo: writeCsvTo, writeCsv: writeCsv });
1260
- _modules.set("b6dbf755b495baef5c7d7651e6a55b2098f2ee304edca2c8b285a0bd7ec127a1", _exports);
1263
+ _modules.set("b48bcab805d4c75294dd8d8e8dc57f96d9db3f5af31a8f0ddc6562f010f566e4", _exports);
1261
1264
  return _exports;
1262
1265
  })();
1263
1266
  Object.assign(officeimo, _m0, { core: _m16, csv: _m0 });
@@ -1111,29 +1111,32 @@ const { captureCsvOptions } = _m15;
1111
1111
 
1112
1112
 
1113
1113
 
1114
- function csvField(value, delimiter, protect, quote, booleanText, nullValue) {
1115
- if (value == null && nullValue !== undefined)
1116
- value = nullValue;
1114
+ function csvField(value, delimiter, protect, quote, booleanText) {
1115
+ const kind = typeof value;
1117
1116
  let text;
1118
1117
  if (value == null)
1119
1118
  text = "";
1119
+ else if (kind === "string")
1120
+ text = value;
1121
+ else if (kind === "number") {
1122
+ text = Number.isFinite(value) ? String(value) : "";
1123
+ // Numeric text has no CSV delimiter, quote or line break to escape.
1124
+ return quote === "all" ? '"' + text + '"' : text;
1125
+ }
1126
+ else if (kind === "boolean")
1127
+ text = booleanText[value ? "true" : "false"];
1120
1128
  else if (isDate(value))
1121
1129
  text = Number.isFinite(value.getTime()) ? value.toISOString() : "";
1122
- else if (typeof value === "boolean")
1123
- text = booleanText[value ? "true" : "false"];
1124
- else if (typeof value === "number")
1125
- text = Number.isFinite(value) ? String(value) : "";
1126
- else if (typeof value === "string")
1127
- text = value;
1128
1130
  else {
1129
1131
  if (typeof value.then === "function")
1130
1132
  void Promise.resolve(value).catch(() => { });
1131
1133
  throw new TypeError("CSV cells and formatter results must be synchronous strings, numbers, booleans, Dates or null.");
1132
1134
  }
1133
- if (protect && (typeof value === "string" || typeof value === "boolean") && /^ *[=+\-@\t\r\n]/.test(text))
1135
+ // Only ASCII spaces, controls and markers through @ can begin the protected prefix.
1136
+ if (protect && (kind === "string" || kind === "boolean") && text.charCodeAt(0) <= 64 && /^ *[=+\-@\t\r\n]/.test(text))
1134
1137
  text = "'" + text;
1135
- return quote === "all" || (quote === "strings" && typeof value === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
1136
- ? '"' + text.replace(/"/g, '""') + '"' : text;
1138
+ return quote === "all" || (quote === "strings" && kind === "string") || text.includes(delimiter) || /["\r\n]/.test(text)
1139
+ ? '"' + (text.includes('"') ? text.replace(/"/g, '""') : text) + '"' : text;
1137
1140
  }
1138
1141
  async function writeCsvTo(rows, destination, configuration) {
1139
1142
  const options = captureCsvOptions(configuration);
@@ -1185,7 +1188,7 @@ async function write(rows, sink, options) {
1185
1188
  value = options.nullValue;
1186
1189
  budget.cell(typeof value === "boolean" ? booleanText[value ? "true" : "false"] : value);
1187
1190
  checkAbort(signal);
1188
- text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText, options.nullValue);
1191
+ text += (i ? delimiter : "") + csvField(value, delimiter, protect, quote, booleanText);
1189
1192
  if (text.length >= buffer.chunkSize || (i & 127) === 127 && taskYieldDue()) {
1190
1193
  if (buffer.append(text))
1191
1194
  return buffer.flush().then(() => record(values, header, i + 1, snapshot));