@datapos/datapos-shared 0.3.94 → 0.3.95

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.
@@ -1,4 +1,4 @@
1
- const R = 0, F = (e) => e, L = () => Date.now(), k = {
1
+ const C = 0, R = (e) => e, F = () => Date.now(), L = {
2
2
  cartesian_area: { categoryId: "cartesian", typeId: "area", label: { "en-gb": "Area" }, options: { highchartsType: "area" } },
3
3
  cartesian_bar: { categoryId: "cartesian", typeId: "bar", label: { "en-gb": "Bar" }, options: { highchartsType: "bar" } },
4
4
  cartesian_column: { categoryId: "cartesian", typeId: "column", label: { "en-gb": "Column" }, options: { highchartsType: "column" } },
@@ -14,63 +14,63 @@ const R = 0, F = (e) => e, L = () => Date.now(), k = {
14
14
  streamgraph: { categoryId: "streamgraph", label: { "en-gb": "Streamgraph" }, options: {} },
15
15
  values: { categoryId: "values", label: { "en-gb": "Values" }, options: {} }
16
16
  };
17
- class I extends Error {
17
+ class x extends Error {
18
18
  locator;
19
19
  constructor(t, a, r) {
20
20
  super(t, r), this.name = "DataPosError", this.locator = a, Error.captureStackTrace?.(this, new.target);
21
21
  }
22
22
  }
23
- class m extends I {
23
+ class m extends x {
24
24
  constructor(t, a, r) {
25
25
  super(t, a, r), this.name = "ApplicationError";
26
26
  }
27
27
  }
28
- class O extends m {
28
+ class k extends m {
29
29
  constructor(t, a, r) {
30
30
  super(t, a, r), this.name = "APIError";
31
31
  }
32
32
  }
33
- class _ extends m {
33
+ class M extends m {
34
34
  constructor(t, a, r) {
35
35
  super(t, a, r), this.name = "EngineError";
36
36
  }
37
37
  }
38
- class D extends m {
38
+ class w extends m {
39
39
  body;
40
40
  constructor(t, a, r, o) {
41
41
  super(t, a, o), this.name = "FetchError", this.body = r;
42
42
  }
43
43
  }
44
- class v extends m {
44
+ class T extends m {
45
45
  componentName;
46
46
  info;
47
47
  constructor(t, a, r, o, n) {
48
48
  super(t, a, n), this.name = "VueHandledError", this.info = r, this.componentName = o;
49
49
  }
50
50
  }
51
- class M extends m {
51
+ class O extends m {
52
52
  constructor(t, a, r) {
53
53
  super(t, a, r), this.name = "WindowHandledRuntimeError";
54
54
  }
55
55
  }
56
- class U extends m {
56
+ class _ extends m {
57
57
  constructor(t, a, r) {
58
58
  super(t, a, r), this.name = "WindowHandledPromiseRejectionError";
59
59
  }
60
60
  }
61
- class B extends I {
61
+ class U extends x {
62
62
  constructor(t, a, r) {
63
63
  super(t, a, r), this.name = "OperationalError";
64
64
  }
65
65
  }
66
- async function j(e, t, a) {
66
+ async function B(e, t, a) {
67
67
  const r = `${t} Response status '${e.status}${e.statusText ? ` - ${e.statusText}` : ""}' received.`, o = await e.text();
68
- return new D(r, a, o);
68
+ return new w(r, a, o);
69
69
  }
70
- function H(e) {
70
+ function j(e) {
71
71
  return e.map((t) => t.message).join(" ");
72
72
  }
73
- function W(e, t = "Unknown error.") {
73
+ function H(e, t = "Unknown error.") {
74
74
  if (e instanceof Error) return e;
75
75
  if (typeof e == "string") return new Error(e);
76
76
  try {
@@ -79,17 +79,17 @@ function W(e, t = "Unknown error.") {
79
79
  return new Error(t);
80
80
  }
81
81
  }
82
- function z(e) {
82
+ function V(e) {
83
83
  const t = /* @__PURE__ */ new Set(), a = [];
84
84
  let r = e;
85
85
  for (; r && !t.has(r); ) {
86
86
  t.add(r);
87
87
  let o;
88
- if (r instanceof D)
88
+ if (r instanceof w)
89
89
  o = { body: r.body, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
90
- else if (r instanceof v)
90
+ else if (r instanceof T)
91
91
  o = { componentName: r.componentName, info: r.info, locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
92
- else if (r instanceof I)
92
+ else if (r instanceof x)
93
93
  o = { locator: r.locator, message: r.message, name: r.name, stack: r.stack }, r = r.cause;
94
94
  else if (r instanceof Error) {
95
95
  const n = r;
@@ -99,64 +99,64 @@ function z(e) {
99
99
  }
100
100
  return a;
101
101
  }
102
- function V() {
102
+ function W() {
103
103
  function e(t, a, r) {
104
104
  r.textContent = "Cytoscape.js diagram goes here...";
105
105
  }
106
106
  return { render: e };
107
107
  }
108
- function X() {
108
+ function z() {
109
109
  function e(t, a, r) {
110
110
  r.textContent = "values table goes here...";
111
111
  }
112
112
  return { render: e };
113
113
  }
114
- const S = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", x = "highcharts";
115
- let b, w = !1;
116
- function G() {
117
- async function e(n, s, u, g, p) {
114
+ const v = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", E = "highcharts";
115
+ let b, I = !1;
116
+ function X() {
117
+ async function e(n, s, u, g) {
118
118
  await r();
119
119
  const l = [];
120
- for (const E of s.data.measures)
121
- l.push({ type: n.options.highchartsType, name: E.name, data: u });
122
- const h = {
120
+ for (const h of s.data.measures)
121
+ l.push({ type: n.options.highchartsType, name: h.name, data: getMeasureValues([h.id]) });
122
+ const p = {
123
123
  chart: { type: n.options.highchartsType },
124
124
  plotOptions: { series: { borderColor: "#333" } },
125
125
  series: l,
126
126
  title: { text: s.title.text },
127
127
  xAxis: { categories: s.data.categoryLabels },
128
128
  yAxis: { title: { text: s.data.name } }
129
- }, c = b.chart(g, h, p);
130
- return { chart: c, resize: () => c.reflow(), vendorId: x };
129
+ }, c = b.chart(u, p, g);
130
+ return { chart: c, resize: () => c.reflow(), vendorId: E };
131
131
  }
132
- async function t(n, s, u, g, p) {
132
+ async function t(n, s, u, g) {
133
133
  await Promise.all([r(), o()]);
134
134
  const l = [];
135
- for (const E of s.data.measures)
136
- l.push({ type: n.options.highchartsType, name: E.name, data: u });
137
- const h = {
135
+ for (const h of s.data.measures)
136
+ l.push({ type: n.options.highchartsType, name: h.name, data: getMeasureValues([h.id]) });
137
+ const p = {
138
138
  chart: { polar: !0 },
139
139
  plotOptions: { series: { borderColor: "#333" } },
140
140
  series: l,
141
141
  title: { text: s.title.text },
142
142
  xAxis: { categories: s.data.categoryLabels },
143
143
  yAxis: { title: { text: s.data.name } }
144
- }, c = b.chart(g, h, p);
145
- return { chart: c, resize: () => c.reflow(), vendorId: x };
144
+ }, c = b.chart(u, p, g);
145
+ return { chart: c, resize: () => c.reflow(), vendorId: E };
146
146
  }
147
- async function a(n, s, u, g, p) {
147
+ async function a(n, s, u, g) {
148
148
  await Promise.all([r(), o()]);
149
149
  const l = [];
150
- l.push({ type: n.options.highchartsType, name: "Unknown", data: u });
151
- const h = {
150
+ l.push({ type: n.options.highchartsType, name: "Unknown", data: getMeasureValues([s.data.measures[0].id, s.data.measures[1].id]) });
151
+ const p = {
152
152
  chart: { type: n.options.highchartsType, inverted: n.options.inverted },
153
153
  plotOptions: { series: { borderColor: "#333" } },
154
154
  series: l,
155
155
  title: { text: s.title.text },
156
156
  xAxis: { categories: s.data.categoryLabels },
157
157
  yAxis: { title: { text: s.data.name } }
158
- }, c = b.chart(g, h, p);
159
- return { chart: c, resize: () => c.reflow(), vendorId: x };
158
+ }, c = b.chart(u, p, g);
159
+ return { chart: c, resize: () => c.reflow(), vendorId: E };
160
160
  }
161
161
  async function r() {
162
162
  if (b) return;
@@ -170,12 +170,12 @@ function G() {
170
170
  );
171
171
  }
172
172
  async function o() {
173
- if (w) return;
174
- await import(`${S}highcharts-more.src.js`), w = !0;
173
+ if (I) return;
174
+ await import(`${v}highcharts-more.src.js`), I = !0;
175
175
  }
176
176
  return { renderCartesianChart: e, renderPolarChart: t, renderRangeChart: a };
177
177
  }
178
- const T = "en-US", f = {}, P = (e) => {
178
+ const D = "en-US", f = {}, G = (e) => {
179
179
  switch (e) {
180
180
  case "Edm.Binary":
181
181
  return "unknown";
@@ -214,17 +214,17 @@ const T = "en-US", f = {}, P = (e) => {
214
214
  default:
215
215
  return "unknown";
216
216
  }
217
- }, J = (e) => {
217
+ }, P = (e) => {
218
218
  if (e) {
219
219
  const t = e.lastIndexOf("/"), a = e.lastIndexOf(".", t > -1 ? t : e.length);
220
220
  return a > -1 ? e.substring(0, a) : e;
221
221
  }
222
- }, K = (e) => {
222
+ }, J = (e) => {
223
223
  if (e) {
224
224
  const t = e.lastIndexOf(".");
225
225
  if (t > -1) return e.substring(t + 1);
226
226
  }
227
- }, i = (e, t = 2, a = t, r = T) => {
227
+ }, i = (e, t = 2, a = t, r = D) => {
228
228
  if (e == null) return "";
229
229
  const o = `${r}decimal${t}.${a}`;
230
230
  let n = f[o];
@@ -236,7 +236,7 @@ const T = "en-US", f = {}, P = (e) => {
236
236
  style: "decimal",
237
237
  useGrouping: !0
238
238
  }), f[o] = n), n.format(e);
239
- }, q = (e) => e == null ? "" : e < 1e3 ? y(e) : e < 1e6 ? `${i(e / 1e3, 2, 0)}K` : e < 1e9 ? `${i(e / 1e6, 2, 0)}M` : e < 1e12 ? `${i(e / 1e9, 2, 0)}B` : `${i(e / 1e12, 2, 0)}T`, Q = (e) => e == null ? "" : e === 1 ? "1 byte" : e < 1024 ? `${y(e)} bytes` : e < 1048576 ? `${i(e / 1024, 2, 0)} KB` : e < 1073741824 ? `${i(e / 1048576, 2, 0)} MB` : e < 1099511627776 ? `${i(e / 1073741824, 2, 0)} GB` : `${i(e / 1099511627776, 2, 0)} TB`, Y = (e) => e == null ? "" : e < 1e3 ? `${y(e)} ms` : e === 1e3 ? `${y(e)} sec` : e < 6e4 ? `${i(e / 1e3, 2, 0)} secs` : e === 6e4 ? "1 min" : e < 36e5 ? `${i(e / 6e4, 2, 0)} mins` : e === 36e5 ? "1 hr" : e < 864e5 ? `${i(e / 36e5, 2, 0)} hrs` : e === 864e5 ? "1 day" : `${i(e / 864e5, 2, 0)} days`, y = (e, t = T) => {
239
+ }, K = (e) => e == null ? "" : e < 1e3 ? y(e) : e < 1e6 ? `${i(e / 1e3, 2, 0)}K` : e < 1e9 ? `${i(e / 1e6, 2, 0)}M` : e < 1e12 ? `${i(e / 1e9, 2, 0)}B` : `${i(e / 1e12, 2, 0)}T`, q = (e) => e == null ? "" : e === 1 ? "1 byte" : e < 1024 ? `${y(e)} bytes` : e < 1048576 ? `${i(e / 1024, 2, 0)} KB` : e < 1073741824 ? `${i(e / 1048576, 2, 0)} MB` : e < 1099511627776 ? `${i(e / 1073741824, 2, 0)} GB` : `${i(e / 1099511627776, 2, 0)} TB`, Q = (e) => e == null ? "" : e < 1e3 ? `${y(e)} ms` : e === 1e3 ? `${y(e)} sec` : e < 6e4 ? `${i(e / 1e3, 2, 0)} secs` : e === 6e4 ? "1 min" : e < 36e5 ? `${i(e / 6e4, 2, 0)} mins` : e === 36e5 ? "1 hr" : e < 864e5 ? `${i(e / 36e5, 2, 0)} hrs` : e === 864e5 ? "1 day" : `${i(e / 864e5, 2, 0)} days`, y = (e, t = D) => {
240
240
  if (e == null) return "";
241
241
  const a = `${t}decimal0.0`;
242
242
  let r = f[a];
@@ -248,7 +248,7 @@ const T = "en-US", f = {}, P = (e) => {
248
248
  style: "decimal",
249
249
  useGrouping: !0
250
250
  }), f[a] = r), r.format(e);
251
- }, Z = (e) => {
251
+ }, Y = (e) => {
252
252
  switch (e) {
253
253
  case "csv":
254
254
  return "text/csv";
@@ -262,7 +262,7 @@ const T = "en-US", f = {}, P = (e) => {
262
262
  default:
263
263
  return "application/octet-stream";
264
264
  }
265
- }, A = [
265
+ }, S = [
266
266
  { id: "dtv", label: { "en-gb": "Delimited Text" } },
267
267
  { id: "e/e", label: { "en-gb": "Entity/Event" } },
268
268
  { id: "jsonArray", label: { "en-gb": "JSON Array" } },
@@ -270,22 +270,22 @@ const T = "en-US", f = {}, P = (e) => {
270
270
  { id: "xls", label: { "en-gb": "XLS" } },
271
271
  { id: "xlsx", label: { "en-gb": "XLSX" } },
272
272
  { id: "xml", label: { "en-gb": "XML" } }
273
- ], ee = (e = d) => {
273
+ ], Z = (e = d) => {
274
274
  const t = [];
275
- for (const a of A) t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
275
+ for (const a of S) t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
276
276
  return t;
277
- }, N = [
277
+ }, A = [
278
278
  { id: `
279
279
  `, label: { "en-gb": "Newline" } },
280
280
  { id: "\r", label: { "en-gb": "Carriage Return" } },
281
281
  { id: `\r
282
282
  `, label: { "en-gb": "Carriage Return/Newline" } }
283
- ], re = (e = d) => {
283
+ ], ee = (e = d) => {
284
284
  const t = [];
285
- for (const a of N)
285
+ for (const a of A)
286
286
  t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
287
287
  return t;
288
- }, $ = [
288
+ }, N = [
289
289
  { id: ":", label: { "en-gb": "Colon" } },
290
290
  { id: ",", label: { "en-gb": "Comma" } },
291
291
  { id: "!", label: { "en-gb": "Exclamation Mark" } },
@@ -297,12 +297,12 @@ const T = "en-US", f = {}, P = (e) => {
297
297
  { id: "_", label: { "en-gb": "Underscore" } },
298
298
  { id: "0x1F", label: { "en-gb": "Unit Separator" } },
299
299
  { id: "|", label: { "en-gb": "Vertical Bar" } }
300
- ], te = (e = d) => {
300
+ ], re = (e = d) => {
301
301
  const t = [];
302
- for (const a of $)
302
+ for (const a of N)
303
303
  t.push({ ...a, label: a.label[e] || a.label[d] || a.id });
304
304
  return t;
305
- }, C = [
305
+ }, $ = [
306
306
  { id: "alpha", color: "red", label: { "en-gb": "alpha" } },
307
307
  { id: "beta", color: "amber", label: { "en-gb": "beta" } },
308
308
  { id: "generalAvailability", color: "green", label: { "en-gb": "" } },
@@ -312,42 +312,42 @@ const T = "en-US", f = {}, P = (e) => {
312
312
  { id: "releaseCandidate", color: "green", label: { "en-gb": "release-candidate" } },
313
313
  { id: "unavailable", color: "other", label: { "en-gb": "unavailable" } },
314
314
  { id: "underReview", color: "other", label: { "en-gb": "under-review" } }
315
- ], ae = (e, t = d) => {
316
- const a = C.find((r) => r.id === e);
315
+ ], te = (e, t = d) => {
316
+ const a = $.find((r) => r.id === e);
317
317
  return a ? { ...a, label: a.label[t] || a.label[d] || e } : { id: e, color: "other", label: e };
318
318
  }, d = "en-gb";
319
319
  export {
320
- O as APIError,
320
+ k as APIError,
321
321
  m as ApplicationError,
322
322
  d as DEFAULT_LOCALE_CODE,
323
- R as DefaultTimestamp,
324
- _ as EngineError,
325
- D as FetchError,
326
- B as OperationalError,
327
- v as VueError,
328
- U as WindowPromiseRejectionError,
329
- M as WindowRuntimeError,
330
- j as buildFetchError,
331
- H as concatenateSerialisedErrorMessages,
332
- F as convertMillisecondsToTimestamp,
333
- P as convertODataTypeIdToUsageTypeId,
334
- K as extractExtensionFromPath,
335
- J as extractNameFromPath,
323
+ C as DefaultTimestamp,
324
+ M as EngineError,
325
+ w as FetchError,
326
+ U as OperationalError,
327
+ T as VueError,
328
+ _ as WindowPromiseRejectionError,
329
+ O as WindowRuntimeError,
330
+ B as buildFetchError,
331
+ j as concatenateSerialisedErrorMessages,
332
+ R as convertMillisecondsToTimestamp,
333
+ G as convertODataTypeIdToUsageTypeId,
334
+ J as extractExtensionFromPath,
335
+ P as extractNameFromPath,
336
336
  i as formatNumberAsDecimalNumber,
337
- Y as formatNumberAsDuration,
338
- q as formatNumberAsSize,
339
- Q as formatNumberAsStorageSize,
337
+ Q as formatNumberAsDuration,
338
+ K as formatNumberAsSize,
339
+ q as formatNumberAsStorageSize,
340
340
  y as formatNumberAsWholeNumber,
341
- ae as getComponentStatus,
342
- L as getCurrentTimestamp,
343
- ee as getDataFormats,
344
- re as getRecordDelimiters,
345
- te as getValueDelimiters,
346
- Z as lookupMimeTypeForExtension,
347
- W as normalizeToError,
348
- k as presentationViewTypeMap,
349
- z as serialiseError,
350
- V as useCytoscapeJS,
351
- X as useDataTable,
352
- G as useHighcharts
341
+ te as getComponentStatus,
342
+ F as getCurrentTimestamp,
343
+ Z as getDataFormats,
344
+ ee as getRecordDelimiters,
345
+ re as getValueDelimiters,
346
+ Y as lookupMimeTypeForExtension,
347
+ H as normalizeToError,
348
+ L as presentationViewTypeMap,
349
+ V as serialiseError,
350
+ W as useCytoscapeJS,
351
+ z as useDataTable,
352
+ X as useHighcharts
353
353
  };
@@ -4,7 +4,7 @@ export interface HighchartsView extends PresentationView {
4
4
  chart: Chart;
5
5
  }
6
6
  export declare function useHighcharts(): {
7
- renderCartesianChart: (type: PresentationVisualCartesianViewType, contentConfig: PresentationVisualContentConfig, data: number[][], element: HTMLElement, callback?: () => void) => Promise<HighchartsView>;
8
- renderPolarChart: (type: PresentationVisualPolarViewType, content: PresentationVisualContentConfig, data: number[][], element: HTMLElement, callback?: () => void) => Promise<HighchartsView>;
9
- renderRangeChart: (type: PresentationVisualRangeViewType, content: PresentationVisualContentConfig, data: number[][], element: HTMLElement, callback?: () => void) => Promise<HighchartsView>;
7
+ renderCartesianChart: (type: PresentationVisualCartesianViewType, contentConfig: PresentationVisualContentConfig, element: HTMLElement, callback?: () => void) => Promise<HighchartsView>;
8
+ renderPolarChart: (type: PresentationVisualPolarViewType, content: PresentationVisualContentConfig, element: HTMLElement, callback?: () => void) => Promise<HighchartsView>;
9
+ renderRangeChart: (type: PresentationVisualRangeViewType, content: PresentationVisualContentConfig, element: HTMLElement, callback?: () => void) => Promise<HighchartsView>;
10
10
  };
@@ -4,7 +4,7 @@ export interface Presenter {
4
4
  readonly config: PresenterConfig;
5
5
  readonly tools: PresenterTools;
6
6
  list(): ComponentRef[];
7
- render(presentationPath: string, renderTo: HTMLElement): Promise<void>;
7
+ render(presentationPath: string, renderTo: HTMLElement, data?: unknown): Promise<void>;
8
8
  }
9
9
  export interface PresenterConfig extends ComponentConfig {
10
10
  presentations: ComponentRef[];
@@ -39,6 +39,7 @@ export type PresentationVisualContentConfig = {
39
39
  measures: {
40
40
  id: string;
41
41
  name: string;
42
+ data?: number[][];
42
43
  }[];
43
44
  };
44
45
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@datapos/datapos-shared",
3
3
  "license": "MIT",
4
4
  "private": false,
5
- "version": "0.3.94",
5
+ "version": "0.3.95",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"