@reportwright/viewer 0.12.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 +55 -1
  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-EOVGKHAS.js → chunk-NR2G4TMG.js} +59 -51
  18. package/dist/chunk-NR2G4TMG.js.map +6 -0
  19. package/dist/{chunk-5N6OFCHJ.js → chunk-PGP3QA6L.js} +22 -10
  20. package/dist/chunk-PGP3QA6L.js.map +6 -0
  21. package/dist/{chunk-FARG6X2U.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-M6GENFAH.js → chunk-VNOWPSE6.js} +527 -1461
  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 +41 -31
  33. package/dist/designer.js.map +2 -2
  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-NPYKZINU.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-KBT6ZGGO.js → chunk-TSC4RAH3.js} +22 -10
  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-MCJPN2KL.js → chunk-WSNRD2AQ.js} +14 -9
  49. package/dist/peer/chunk-WSNRD2AQ.js.map +6 -0
  50. package/dist/peer/designer.js +41 -31
  51. package/dist/peer/designer.js.map +2 -2
  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-5N6OFCHJ.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-EOVGKHAS.js.map +0 -6
  65. package/dist/chunk-FARG6X2U.js.map +0 -6
  66. package/dist/chunk-M6GENFAH.js.map +0 -6
  67. package/dist/chunk-SBD55ZES.js.map +0 -6
  68. package/dist/chunk-SR2TQ2ZK.js.map +0 -6
  69. package/dist/peer/chunk-76ZABVTI.js.map +0 -6
  70. package/dist/peer/chunk-GBITRNHE.js +0 -14806
  71. package/dist/peer/chunk-GBITRNHE.js.map +0 -6
  72. package/dist/peer/chunk-IMQRHDR4.js +0 -12
  73. package/dist/peer/chunk-IPU2YRL2.js.map +0 -6
  74. package/dist/peer/chunk-KBT6ZGGO.js.map +0 -6
  75. package/dist/peer/chunk-MCJPN2KL.js.map +0 -6
  76. package/dist/peer/chunk-NPYKZINU.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-EOVGKHAS.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-M6GENFAH.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;
@@ -6960,7 +6968,7 @@ function nestedFields(rows) {
6960
6968
  return [...top2].filter(([, m]) => m.size).map(([name2, m]) => ({ name: name2, type: "object", fields: [...m].map(([n, t3]) => ({ name: n, type: t3 === "null" ? "string" : t3 })) }));
6961
6969
  }
6962
6970
 
6963
- // ../reportwright/node_modules/zustand/esm/vanilla.mjs
6971
+ // node_modules/zustand/esm/vanilla.mjs
6964
6972
  var createStoreImpl = (createState) => {
6965
6973
  let state;
6966
6974
  const listeners = /* @__PURE__ */ new Set();
@@ -6984,7 +6992,7 @@ var createStoreImpl = (createState) => {
6984
6992
  };
6985
6993
  var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
6986
6994
 
6987
- // ../reportwright/node_modules/zustand/esm/react.mjs
6995
+ // node_modules/zustand/esm/react.mjs
6988
6996
  var import_react = __toESM(require_react(), 1);
6989
6997
  var identity = (arg) => arg;
6990
6998
  function useStore(api, selector = identity) {
@@ -7004,7 +7012,7 @@ var createImpl = (createState) => {
7004
7012
  };
7005
7013
  var create = ((createState) => createState ? createImpl(createState) : createImpl);
7006
7014
 
7007
- // ../reportwright/node_modules/immer/dist/immer.mjs
7015
+ // node_modules/immer/dist/immer.mjs
7008
7016
  var NOTHING = /* @__PURE__ */ Symbol.for("immer-nothing");
7009
7017
  var DRAFTABLE = /* @__PURE__ */ Symbol.for("immer-draftable");
7010
7018
  var DRAFT_STATE = /* @__PURE__ */ Symbol.for("immer-state");
@@ -10517,7 +10525,7 @@ var import_react9 = __toESM(require_react(), 1);
10517
10525
  // src/designer/ExprCode.jsx
10518
10526
  var import_react8 = __toESM(require_react(), 1);
10519
10527
 
10520
- // ../reportwright/node_modules/@marijn/find-cluster-break/src/index.js
10528
+ // node_modules/@marijn/find-cluster-break/src/index.js
10521
10529
  var rangeFrom = [];
10522
10530
  var rangeTo = [];
10523
10531
  (() => {
@@ -10594,7 +10602,7 @@ function codePointSize(code2) {
10594
10602
  return code2 < 65536 ? 1 : 2;
10595
10603
  }
10596
10604
 
10597
- // ../reportwright/node_modules/@codemirror/state/dist/index.js
10605
+ // node_modules/@codemirror/state/dist/index.js
10598
10606
  var Text = class _Text {
10599
10607
  /**
10600
10608
  Get the line description around the given position.
@@ -14006,7 +14014,7 @@ function findColumn(string2, col, tabSize, strict) {
14006
14014
  return strict === true ? -1 : string2.length;
14007
14015
  }
14008
14016
 
14009
- // ../reportwright/node_modules/style-mod/src/style-mod.js
14017
+ // node_modules/style-mod/src/style-mod.js
14010
14018
  var C = "ͼ";
14011
14019
  var COUNT = typeof Symbol == "undefined" ? "__" + C : Symbol.for(C);
14012
14020
  var SET = typeof Symbol == "undefined" ? "__styleSet" + Math.floor(Math.random() * 1e8) : /* @__PURE__ */ Symbol("styleSet");
@@ -14142,7 +14150,7 @@ var StyleSet = class {
14142
14150
  }
14143
14151
  };
14144
14152
 
14145
- // ../reportwright/node_modules/w3c-keyname/index.js
14153
+ // node_modules/w3c-keyname/index.js
14146
14154
  var base = {
14147
14155
  8: "Backspace",
14148
14156
  9: "Tab",
@@ -14248,7 +14256,7 @@ function keyName(event) {
14248
14256
  return name2;
14249
14257
  }
14250
14258
 
14251
- // ../reportwright/node_modules/@codemirror/view/dist/index.js
14259
+ // node_modules/@codemirror/view/dist/index.js
14252
14260
  var nav = typeof navigator != "undefined" ? navigator : { userAgent: "", vendor: "", platform: "" };
14253
14261
  var doc = typeof document != "undefined" ? document : { documentElement: { style: {} } };
14254
14262
  var ie_edge = /* @__PURE__ */ /Edge\/(\d+)/.exec(nav.userAgent);
@@ -23124,7 +23132,7 @@ GutterMarker.prototype.mapMode = MapMode.TrackBefore;
23124
23132
  GutterMarker.prototype.startSide = GutterMarker.prototype.endSide = -1;
23125
23133
  GutterMarker.prototype.point = true;
23126
23134
 
23127
- // ../reportwright/node_modules/@lezer/common/dist/index.js
23135
+ // node_modules/@lezer/common/dist/index.js
23128
23136
  var DefaultBufferLength = 1024;
23129
23137
  var nextPropID = 0;
23130
23138
  var Range2 = class {
@@ -24748,7 +24756,7 @@ var StringInput = class {
24748
24756
  };
24749
24757
  var stoppedInner = new NodeProp({ perNode: true });
24750
24758
 
24751
- // ../reportwright/node_modules/@lezer/highlight/dist/index.js
24759
+ // node_modules/@lezer/highlight/dist/index.js
24752
24760
  var nextTagID = 0;
24753
24761
  var Tag = class _Tag {
24754
24762
  /**
@@ -25472,7 +25480,7 @@ var classHighlighter = tagHighlighter([
25472
25480
  { tag: tags.punctuation, class: "tok-punctuation" }
25473
25481
  ]);
25474
25482
 
25475
- // ../reportwright/node_modules/@codemirror/language/dist/index.js
25483
+ // node_modules/@codemirror/language/dist/index.js
25476
25484
  var _a;
25477
25485
  var languageDataProp = /* @__PURE__ */ new NodeProp();
25478
25486
  function defineLanguageFacet(baseData) {
@@ -27099,7 +27107,7 @@ var marks = {
27099
27107
  auto: /* @__PURE__ */ Decoration.mark({ class: "cm-iso", inclusive: true, attributes: { dir: "auto" }, bidiIsolate: null })
27100
27108
  };
27101
27109
 
27102
- // ../reportwright/node_modules/@codemirror/commands/dist/index.js
27110
+ // node_modules/@codemirror/commands/dist/index.js
27103
27111
  var toggleComment = (target) => {
27104
27112
  let { state } = target, line2 = state.doc.lineAt(state.selection.main.from), config2 = getConfig(target.state, line2.from);
27105
27113
  return config2.line ? toggleLineComment(target) : config2.block ? toggleBlockCommentByLine(target) : false;
@@ -28193,7 +28201,7 @@ var defaultKeymap = /* @__PURE__ */ [
28193
28201
  { key: "Ctrl-m", mac: "Shift-Alt-m", run: toggleTabFocusMode }
28194
28202
  ].concat(standardKeymap);
28195
28203
 
28196
- // ../reportwright/node_modules/@codemirror/autocomplete/dist/index.js
28204
+ // node_modules/@codemirror/autocomplete/dist/index.js
28197
28205
  var CompletionContext = class {
28198
28206
  /**
28199
28207
  Create a new completion context. (Mostly useful for testing
@@ -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>';