@datapos/datapos-shared 0.3.94 → 0.3.96

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.
@@ -20,40 +20,40 @@ class I extends Error {
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 p extends I {
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 O extends p {
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 _ extends p {
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 D extends p {
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 v extends p {
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 M extends p {
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 U extends p {
57
57
  constructor(t, a, r) {
58
58
  super(t, a, r), this.name = "WindowHandledPromiseRejectionError";
59
59
  }
@@ -111,52 +111,54 @@ function X() {
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";
114
+ const S = "https://cdn.jsdelivr.net/npm/highcharts@11.4.3/es-modules/masters/", E = "highcharts";
115
115
  let b, w = !1;
116
116
  function G() {
117
- async function e(n, s, u, g, p) {
117
+ async function e(n, s, u, h) {
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 c of s.data.measures)
121
+ l.push({ type: n.options.highchartsType, name: c.name, data: c.data });
122
+ const g = {
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
+ }, m = b.chart(u, g, h);
130
+ return { chart: m, resize: () => m.reflow(), vendorId: E };
131
131
  }
132
- async function t(n, s, u, g, p) {
132
+ async function t(n, s, u, h) {
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 c of s.data.measures)
136
+ l.push({ type: n.options.highchartsType, name: c.name, data: c.data });
137
+ const g = {
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
+ }, m = b.chart(u, g, h);
145
+ return { chart: m, resize: () => m.reflow(), vendorId: E };
146
146
  }
147
- async function a(n, s, u, g, p) {
147
+ async function a(n, s, u, h) {
148
148
  await Promise.all([r(), o()]);
149
- const l = [];
150
- l.push({ type: n.options.highchartsType, name: "Unknown", data: u });
151
- const h = {
149
+ const l = [], g = [];
150
+ for (let f = 0; f++; f < s.data.measures[0].data.length)
151
+ g.push([s.data.measures[0].data[f], s.data.measures[1].data[f]]);
152
+ l.push({ type: n.options.highchartsType, name: "Unknown", data: g });
153
+ const m = {
152
154
  chart: { type: n.options.highchartsType, inverted: n.options.inverted },
153
155
  plotOptions: { series: { borderColor: "#333" } },
154
156
  series: l,
155
157
  title: { text: s.title.text },
156
158
  xAxis: { categories: s.data.categoryLabels },
157
159
  yAxis: { title: { text: s.data.name } }
158
- }, c = b.chart(g, h, p);
159
- return { chart: c, resize: () => c.reflow(), vendorId: x };
160
+ }, c = b.chart(u, m, h);
161
+ return { chart: c, resize: () => c.reflow(), vendorId: E };
160
162
  }
161
163
  async function r() {
162
164
  if (b) return;
@@ -175,7 +177,7 @@ function G() {
175
177
  }
176
178
  return { renderCartesianChart: e, renderPolarChart: t, renderRangeChart: a };
177
179
  }
178
- const T = "en-US", f = {}, P = (e) => {
180
+ const T = "en-US", y = {}, P = (e) => {
179
181
  switch (e) {
180
182
  case "Edm.Binary":
181
183
  return "unknown";
@@ -227,7 +229,7 @@ const T = "en-US", f = {}, P = (e) => {
227
229
  }, i = (e, t = 2, a = t, r = T) => {
228
230
  if (e == null) return "";
229
231
  const o = `${r}decimal${t}.${a}`;
230
- let n = f[o];
232
+ let n = y[o];
231
233
  return n || (n = new Intl.NumberFormat(r, {
232
234
  localeMatcher: "best fit",
233
235
  maximumFractionDigits: t,
@@ -235,11 +237,11 @@ const T = "en-US", f = {}, P = (e) => {
235
237
  minimumIntegerDigits: 1,
236
238
  style: "decimal",
237
239
  useGrouping: !0
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) => {
240
+ }), y[o] = n), n.format(e);
241
+ }, q = (e) => e == null ? "" : e < 1e3 ? x(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 ? `${x(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 ? `${x(e)} ms` : e === 1e3 ? `${x(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`, x = (e, t = T) => {
240
242
  if (e == null) return "";
241
243
  const a = `${t}decimal0.0`;
242
- let r = f[a];
244
+ let r = y[a];
243
245
  return r || (r = new Intl.NumberFormat(t, {
244
246
  localeMatcher: "best fit",
245
247
  maximumFractionDigits: 0,
@@ -247,7 +249,7 @@ const T = "en-US", f = {}, P = (e) => {
247
249
  minimumIntegerDigits: 1,
248
250
  style: "decimal",
249
251
  useGrouping: !0
250
- }), f[a] = r), r.format(e);
252
+ }), y[a] = r), r.format(e);
251
253
  }, Z = (e) => {
252
254
  switch (e) {
253
255
  case "csv":
@@ -318,7 +320,7 @@ const T = "en-US", f = {}, P = (e) => {
318
320
  }, d = "en-gb";
319
321
  export {
320
322
  O as APIError,
321
- m as ApplicationError,
323
+ p as ApplicationError,
322
324
  d as DEFAULT_LOCALE_CODE,
323
325
  R as DefaultTimestamp,
324
326
  _ as EngineError,
@@ -337,7 +339,7 @@ export {
337
339
  Y as formatNumberAsDuration,
338
340
  q as formatNumberAsSize,
339
341
  Q as formatNumberAsStorageSize,
340
- y as formatNumberAsWholeNumber,
342
+ x as formatNumberAsWholeNumber,
341
343
  ae as getComponentStatus,
342
344
  L as getCurrentTimestamp,
343
345
  ee as getDataFormats,
@@ -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.96",
6
6
  "type": "module",
7
7
  "files": [
8
8
  "dist"