@reportwright/viewer 0.11.0 → 0.12.1

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 (83) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/README.md +27 -5
  3. package/dist/{chunk-KJTRZJHN.js → chunk-2BPBQMH2.js} +4 -3
  4. package/dist/chunk-2BPBQMH2.js.map +6 -0
  5. package/dist/{chunk-ODREGGKA.js → chunk-3D2KFKG2.js} +5 -4
  6. package/dist/chunk-3D2KFKG2.js.map +6 -0
  7. package/dist/chunk-6TPZ7G74.js +494 -0
  8. package/dist/chunk-6TPZ7G74.js.map +6 -0
  9. package/dist/chunk-BRB34AJ2.js +16 -0
  10. package/dist/{chunk-APRPSQOD.js → chunk-DPVJEFKP.js} +28 -9
  11. package/dist/chunk-DPVJEFKP.js.map +6 -0
  12. package/dist/{chunk-RYHJUQSV.js → chunk-DXHLIJEY.js} +2 -2
  13. package/dist/{chunk-SR2TQ2ZK.js → chunk-F6RMRXIN.js} +2 -2
  14. package/dist/chunk-F6RMRXIN.js.map +6 -0
  15. package/dist/{chunk-3D43XGIN.js → chunk-M6AYND5G.js} +8 -638
  16. package/dist/chunk-M6AYND5G.js.map +6 -0
  17. package/dist/{chunk-HAMBWF6C.js → chunk-NR2G4TMG.js} +39 -31
  18. package/dist/chunk-NR2G4TMG.js.map +6 -0
  19. package/dist/{chunk-66QZ3RDV.js → chunk-PGP3QA6L.js} +526 -508
  20. package/dist/chunk-PGP3QA6L.js.map +6 -0
  21. package/dist/{chunk-N5WHQ4DM.js → chunk-Q6MMPKQA.js} +14 -9
  22. package/dist/chunk-Q6MMPKQA.js.map +6 -0
  23. package/dist/{chunk-SBD55ZES.js → chunk-S2IUUI6N.js} +76 -32
  24. package/dist/chunk-S2IUUI6N.js.map +6 -0
  25. package/dist/chunk-ULKEEARQ.js +553 -0
  26. package/dist/chunk-ULKEEARQ.js.map +6 -0
  27. package/dist/{chunk-WQOBRZAL.js → chunk-VNOWPSE6.js} +579 -1484
  28. package/dist/chunk-VNOWPSE6.js.map +6 -0
  29. package/dist/chunk-Z7MKH66Z.js +642 -0
  30. package/dist/chunk-Z7MKH66Z.js.map +6 -0
  31. package/dist/designer.d.ts +10 -3
  32. package/dist/designer.js +28 -18
  33. package/dist/designer.js.map +1 -1
  34. package/dist/engine.worker.js +71 -0
  35. package/dist/engine.worker.js.map +6 -0
  36. package/dist/peer/chunk-2FZTYEDE.js +15 -0
  37. package/dist/peer/{chunk-776OR56A.js → chunk-6I2EAAVN.js} +39 -31
  38. package/dist/peer/chunk-6I2EAAVN.js.map +6 -0
  39. package/dist/peer/{chunk-IPU2YRL2.js → chunk-BMAXIBP2.js} +28 -9
  40. package/dist/peer/chunk-BMAXIBP2.js.map +6 -0
  41. package/dist/peer/chunk-BQFI3DHK.js +494 -0
  42. package/dist/peer/chunk-BQFI3DHK.js.map +6 -0
  43. package/dist/peer/{chunk-76ZABVTI.js → chunk-R4VX5UC7.js} +4 -3
  44. package/dist/peer/{chunk-5X4ZSSJT.js → chunk-TSC4RAH3.js} +526 -508
  45. package/dist/peer/chunk-TSC4RAH3.js.map +6 -0
  46. package/dist/peer/{chunk-M4AGFUWE.js → chunk-V42KN7HD.js} +2 -2
  47. package/dist/peer/{chunk-Y5CAHLXS.js → chunk-WQGENQZO.js} +5 -4
  48. package/dist/peer/{chunk-EKWTFHVE.js → chunk-WSNRD2AQ.js} +14 -9
  49. package/dist/peer/chunk-WSNRD2AQ.js.map +6 -0
  50. package/dist/peer/designer.js +28 -18
  51. package/dist/peer/designer.js.map +1 -1
  52. package/dist/peer/engine.worker.js +70 -0
  53. package/dist/peer/engine.worker.js.map +6 -0
  54. package/dist/peer/viewer.js +12 -5
  55. package/dist/peer/viewer.js.map +1 -1
  56. package/dist/viewer.d.ts +9 -1
  57. package/dist/viewer.js +12 -5
  58. package/dist/viewer.js.map +1 -1
  59. package/package.json +1 -1
  60. package/dist/chunk-3D43XGIN.js.map +0 -6
  61. package/dist/chunk-66QZ3RDV.js.map +0 -6
  62. package/dist/chunk-AH47FS6Y.js +0 -13
  63. package/dist/chunk-APRPSQOD.js.map +0 -6
  64. package/dist/chunk-HAMBWF6C.js.map +0 -6
  65. package/dist/chunk-N5WHQ4DM.js.map +0 -6
  66. package/dist/chunk-SBD55ZES.js.map +0 -6
  67. package/dist/chunk-SR2TQ2ZK.js.map +0 -6
  68. package/dist/chunk-WQOBRZAL.js.map +0 -6
  69. package/dist/peer/chunk-5X4ZSSJT.js.map +0 -6
  70. package/dist/peer/chunk-6YO42ALN.js +0 -14777
  71. package/dist/peer/chunk-6YO42ALN.js.map +0 -6
  72. package/dist/peer/chunk-76ZABVTI.js.map +0 -6
  73. package/dist/peer/chunk-776OR56A.js.map +0 -6
  74. package/dist/peer/chunk-EKWTFHVE.js.map +0 -6
  75. package/dist/peer/chunk-IMQRHDR4.js +0 -12
  76. package/dist/peer/chunk-IPU2YRL2.js.map +0 -6
  77. package/dist/peer/chunk-Y5CAHLXS.js.map +0 -6
  78. /package/dist/{chunk-AH47FS6Y.js.map → chunk-BRB34AJ2.js.map} +0 -0
  79. /package/dist/{chunk-RYHJUQSV.js.map → chunk-DXHLIJEY.js.map} +0 -0
  80. /package/dist/peer/{chunk-IMQRHDR4.js.map → chunk-2FZTYEDE.js.map} +0 -0
  81. /package/dist/{chunk-KJTRZJHN.js.map → peer/chunk-R4VX5UC7.js.map} +0 -0
  82. /package/dist/peer/{chunk-M4AGFUWE.js.map → chunk-V42KN7HD.js.map} +0 -0
  83. /package/dist/{chunk-ODREGGKA.js.map → peer/chunk-WQGENQZO.js.map} +0 -0
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * @typedef {{ label?: string, source: { name: string, type: string, [key: string]: unknown } }} DataSourceTemplate
3
3
  * @typedef {{ server?: string, fontsUrl?: string, report?: string, definition?: object, lang?: string, height?: string,
4
- * onSave?: (definition: object) => unknown, onOpen?: () => object | null | undefined | Promise<object | null | undefined>, readOnly?: boolean,
5
- * toolbox?: { hide?: string[] }, panels?: { data?: boolean, inspector?: boolean }, dataSourceTemplates?: DataSourceTemplate[], nonce?: string }} DesignerOptions
4
+ * onSave?: (definition: import('@reportwright/engine/report').Report) => unknown, onOpen?: () => object | null | undefined | Promise<object | null | undefined>, readOnly?: boolean,
5
+ * toolbox?: { hide?: string[] }, panels?: { data?: boolean, inspector?: boolean }, dataSourceTemplates?: DataSourceTemplate[], nonce?: string,
6
+ * allowHosts?: string[], unsafeFetch?: boolean, fetch?: typeof fetch }} DesignerOptions (allowHosts, unsafeFetch, fetch: as mountViewer's)
6
7
  * @typedef {{ unmount: () => void, getDefinition: () => object, save: () => Promise<void> }} DesignerHandle
7
8
  */
8
9
  /**
@@ -21,6 +22,9 @@ export type DataSourceTemplate = {
21
22
  [key: string]: unknown;
22
23
  };
23
24
  };
25
+ /**
26
+ * (allowHosts, unsafeFetch, fetch: as mountViewer's)
27
+ */
24
28
  export type DesignerOptions = {
25
29
  server?: string;
26
30
  fontsUrl?: string;
@@ -28,7 +32,7 @@ export type DesignerOptions = {
28
32
  definition?: object;
29
33
  lang?: string;
30
34
  height?: string;
31
- onSave?: (definition: object) => unknown;
35
+ onSave?: (definition: import('@reportwright/engine/report').Report) => unknown;
32
36
  onOpen?: () => object | null | undefined | Promise<object | null | undefined>;
33
37
  readOnly?: boolean;
34
38
  toolbox?: {
@@ -40,6 +44,9 @@ export type DesignerOptions = {
40
44
  };
41
45
  dataSourceTemplates?: DataSourceTemplate[];
42
46
  nonce?: string;
47
+ allowHosts?: string[];
48
+ unsafeFetch?: boolean;
49
+ fetch?: typeof fetch;
43
50
  };
44
51
  export type DesignerHandle = {
45
52
  unmount: () => void;
package/dist/designer.js CHANGED
@@ -13,7 +13,16 @@ import {
13
13
  setShadowStyles,
14
14
  t,
15
15
  uiFontCss
16
- } from "./chunk-HAMBWF6C.js";
16
+ } from "./chunk-NR2G4TMG.js";
17
+ import {
18
+ customFonts,
19
+ fontStore,
20
+ fontsBase,
21
+ loadModelFonts,
22
+ origin,
23
+ setAssetBase,
24
+ setStandalone
25
+ } from "./chunk-6TPZ7G74.js";
17
26
  import {
18
27
  BASE_STYLE,
19
28
  DEFAULT_THEME,
@@ -26,19 +35,14 @@ import {
26
35
  PALETTES,
27
36
  TEXT_STYLE_PROPS,
28
37
  THEME_COLORS,
29
- TextMeasurer,
30
38
  XmlError,
31
39
  bestXmlRows,
32
40
  buildDataSets,
33
41
  checkFunctions,
34
42
  checkValue,
35
- customFonts,
36
43
  detectFields,
37
44
  evalValue,
38
45
  findItemNamed,
39
- finishText,
40
- fontStore,
41
- fontsBase,
42
46
  fromPt,
43
47
  functionTable,
44
48
  isDynamic,
@@ -47,20 +51,17 @@ import {
47
51
  jsonPath,
48
52
  layoutItems,
49
53
  loadBarcodes,
50
- loadModelFonts,
51
54
  loadSources,
52
55
  normBox,
53
56
  normalizeMatrix,
54
57
  odataMetadata,
55
- origin,
56
58
  parseBorder,
57
59
  parseXml,
58
60
  render,
59
61
  reportFetch,
60
62
  resolvePage,
61
63
  resolveParameters,
62
- setAssetBase,
63
- setStandalone,
64
+ setFetchPolicy,
64
65
  shiftItems,
65
66
  sourceRows,
66
67
  sourceUrl,
@@ -71,22 +72,28 @@ import {
71
72
  validate,
72
73
  withPartProps,
73
74
  xmlRowPaths
74
- } from "./chunk-WQOBRZAL.js";
75
+ } from "./chunk-VNOWPSE6.js";
76
+ import {
77
+ TextMeasurer,
78
+ finishText
79
+ } from "./chunk-ULKEEARQ.js";
80
+ import "./chunk-72S6DETS.js";
75
81
  import {
76
82
  currencyOf
77
83
  } from "./chunk-GJS242RR.js";
78
- import "./chunk-72S6DETS.js";
79
- import "./chunk-SR2TQ2ZK.js";
84
+ import "./chunk-F6RMRXIN.js";
85
+ import {
86
+ fontFaceCss,
87
+ fontFamilyCss,
88
+ pageToSvg
89
+ } from "./chunk-M6AYND5G.js";
80
90
  import {
81
91
  BUNDLED_FAMILIES,
82
92
  FONT_FAMILIES,
83
93
  allFontKeys,
84
94
  fallbackKeys,
85
- fontFaceCss,
86
- fontFamilyCss,
87
- pageToSvg,
88
95
  resolveFontKey
89
- } from "./chunk-3D43XGIN.js";
96
+ } from "./chunk-Z7MKH66Z.js";
90
97
  import {
91
98
  __toESM
92
99
  } from "./chunk-OLLMACWA.js";
@@ -6146,7 +6153,8 @@ function toRdlx3(root, notes, reportName) {
6146
6153
  const on = prop(b, "aggregateOn") ?? simpleList(b, "aggregateOn")[0]?.text;
6147
6154
  const gc = { ...c, group: on && on !== "All" ? on : void 0 };
6148
6155
  if (fn3) {
6149
- const arg = listProp(b, "arguments").map((x) => prop(x, "value")).find((x) => x != null);
6156
+ const arg = listProp(b, "arguments").map((x) => prop(x, "value")).find((x) => x != null) ?? prop(b, "expression");
6157
+ if (arg == null && fn3 !== "count") throw new Untranslatable2(`the aggregate ${fn3.toUpperCase()} with no expression`);
6150
6158
  const inner2 = arg != null ? vb2(arg, { ...c, inSet: false }, depth) : "1";
6151
6159
  if (prop(b, "filterExpr")) throw new Untranslatable2(`the bound column "${prop(b, "name")}", an aggregate with a filter`);
6152
6160
  const all = gc.group ?? c.region;
@@ -35451,6 +35459,7 @@ a.cell-name:hover { color: var(--accent); }
35451
35459
  .vfrozen-head { position: absolute; top: 0; background: var(--paper); box-shadow: 0 3px 8px rgba(16, 24, 40, .18); pointer-events: none; }
35452
35460
  .vfrozen-head svg { display: block; width: 100%; height: 100%; }
35453
35461
  .search .opt { font-size: var(--fs-xs); font-weight: var(--fw-strong); }
35462
+ .search .opt .ww::before { content: "ab"; text-decoration: underline; } /* CSS, not text: the name is "Whole word" alone */
35454
35463
  .search .opt[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
35455
35464
  .vmatches button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
35456
35465
  .vmatches button[aria-current] { background: var(--accent-soft); color: var(--accent); }
@@ -35835,6 +35844,7 @@ function mountDesigner(target, opts = {}) {
35835
35844
  const server2 = String(opts.server || "").replace(/\/$/, "");
35836
35845
  setAssetBase(server2);
35837
35846
  setStandalone({ standalone: !server2, fontsUrl: opts.fontsUrl });
35847
+ setFetchPolicy({ allowHosts: opts.allowHosts, unsafeFetch: opts.unsafeFetch, fetch: opts.fetch });
35838
35848
  if (server2) declareDocumentStyles("pw-embed-fonts", uiFontCss(server2), opts.nonce);
35839
35849
  const shadow = el.shadowRoot || el.attachShadow({ mode: "open" });
35840
35850
  shadow.innerHTML = '<div class="pw-embed"></div>';