@m4l/components 0.1.93 → 0.1.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.
Files changed (64) hide show
  1. package/components/AccountPopover/{index.2ef0bf6d.js → index.3711d526.js} +1 -1
  2. package/components/AppBar/{index.16fe42a1.js → index.512042a9.js} +1 -1
  3. package/components/CommonActions/components/ActionCancel/{index.c3e23ad4.js → index.bb383946.js} +1 -1
  4. package/components/CommonActions/components/ActionFormCancel/{index.6da52418.js → index.97ecdeef.js} +2 -2
  5. package/components/CommonActions/components/ActionFormIntro/{index.c3af6d1d.js → index.3deddb07.js} +1 -1
  6. package/components/CommonActions/components/ActionIntro/{index.49631fcb.js → index.4bc5780e.js} +1 -1
  7. package/components/DataGrid/{index.abedf2c0.js → index.47a152d0.js} +5 -5
  8. package/components/DataGrid/subcomponents/Actions/{index.c8408b73.js → index.8d9feca6.js} +7 -7
  9. package/components/DynamicFilter/{index.cb1402aa.js → index.a50a1483.js} +9 -9
  10. package/components/GridLayout/{index.1421f0d4.js → index.4a245d9e.js} +1 -1
  11. package/components/GridLayout/subcomponents/Griditem/{index.b2342897.js → index.ea745285.js} +2 -2
  12. package/components/GridLayout/subcomponents/Responsive/{index.f459804c.js → index.edb59c22.js} +2 -2
  13. package/components/Icon/{index.3211023d.js → index.11a7a77c.js} +1 -1
  14. package/components/Image/{index.611cd930.js → index.9799dfc0.js} +1 -1
  15. package/components/LanguagePopover/{index.b6dc03d0.js → index.087b430d.js} +2 -2
  16. package/components/LoadingError/{index.96bdc803.js → index.08cf9728.js} +2 -2
  17. package/components/MFLoader/{index.caee87dd.js → index.4b531d2d.js} +1 -1
  18. package/components/NoItemSelected/{index.3e29c208.js → index.8a2a13f8.js} +1 -1
  19. package/components/ObjectLogs/{index.38fd657f.js → index.55b5c933.js} +4 -4
  20. package/components/Page/{index.c4642a29.js → index.49d18c85.js} +1 -1
  21. package/components/PaperForm/{index.cce9ed39.js → index.a2b69977.js} +1 -1
  22. package/components/Period/{index.c35c6a6c.js → index.8cccbb4b.js} +1 -1
  23. package/components/PrintingSystem/index.d1fd7818.js +223 -0
  24. package/components/PrintingSystem/subcomponents/BodyNode/index.f6410daa.js +48 -0
  25. package/components/PrintingSystem/subcomponents/ChartNode/index.6b30abe0.js +91 -0
  26. package/components/PrintingSystem/subcomponents/DividerNode/index.dcac3bc0.js +19 -0
  27. package/components/PrintingSystem/subcomponents/FooterNode/index.dd21921e.js +48 -0
  28. package/components/PrintingSystem/subcomponents/GridNode/index.eb5ebe06.js +73 -0
  29. package/components/PrintingSystem/subcomponents/HeaderNode/index.48e8769c.js +48 -0
  30. package/components/PrintingSystem/subcomponents/PaperNode/index.ccec72dc.js +46 -0
  31. package/components/PrintingSystem/subcomponents/PropertyValueNode/index.807e0343.js +43 -0
  32. package/components/PrintingSystem/subcomponents/SectionNode/index.622df623.js +48 -0
  33. package/components/PrintingSystem/subcomponents/TextBoxNode/index.f06ac3d5.js +28 -0
  34. package/components/PropertyValue/classes/index.d.ts +1 -1
  35. package/components/PropertyValue/{index.3ee95452.js → index.4ae0bb21.js} +1 -1
  36. package/components/SideBar/{index.5fd648d2.js → index.ce301edd.js} +3 -3
  37. package/components/areas/components/AreasAdmin/{index.ddb384a1.js → index.3c182644.js} +8 -8
  38. package/components/areas/components/AreasViewer/{index.625bf23b.js → index.a0a969e7.js} +10 -10
  39. package/components/areas/contexts/AreasContext/{index.646f3c8f.js → index.d43aceaf.js} +4 -4
  40. package/components/areas/hooks/useAreas/{index.ee66240b.js → index.6a1d525c.js} +1 -1
  41. package/components/formatters/BooleanFormatter/{index.3c2df7a8.js → index.00596be3.js} +3 -10
  42. package/components/formatters/dictionary.d.ts +0 -1
  43. package/components/formatters/{index.dc77adb7.js → index.1906141f.js} +1 -11
  44. package/components/hook-form/RHFAutocomplete/{index.52387f0f.js → index.a5f1034a.js} +2 -2
  45. package/components/hook-form/RHFAutocompleteAsync/{index.638bd2ae.js → index.047ff594.js} +1 -1
  46. package/components/hook-form/RHFDateTime/{index.66e334b0.js → index.a273293c.js} +1 -1
  47. package/components/hook-form/RHFPeriod/{index.23099265.js → index.53827a17.js} +1 -1
  48. package/components/hook-form/RHFTextField/{index.25b3627e.js → index.5801338a.js} +1 -1
  49. package/components/hook-form/RHFUpload/{index.65588e08.js → index.f04df1c9.js} +2 -2
  50. package/components/modal/{WindowBase.161ec78a.js → WindowBase.beb2fb3e.js} +2 -2
  51. package/components/modal/{WindowConfirm.7eed7c35.js → WindowConfirm.477e6f63.js} +4 -4
  52. package/components/mui_extended/Accordion/{index.92aae1a4.js → index.08ff7e2f.js} +3 -3
  53. package/components/mui_extended/Button/{index.94fec33c.js → index.857c2dfe.js} +1 -1
  54. package/components/mui_extended/IconButton/{index.53cd6388.js → index.5499ffdb.js} +1 -1
  55. package/components/mui_extended/MenuActions/{index.dd9f65a2.js → index.d8d0c00e.js} +2 -2
  56. package/components/mui_extended/Pager/{index.de0bd62c.js → index.47343062.js} +1 -1
  57. package/components/mui_extended/Tab/{index.1fcabba2.js → index.2f9a6815.js} +1 -1
  58. package/contexts/RHFormContext/classes/index.d.ts +1 -1
  59. package/hooks/useFormAddEdit/{index.3584a29f.js → index.b9ccd95f.js} +1 -1
  60. package/index.js +69 -58
  61. package/package.json +1 -1
  62. package/{vendor.71883626.js → vendor.6019bf6e.js} +43 -43
  63. package/components/PrintingSystem/index.e18a2fa8.js +0 -634
  64. package/node_modules.b55d04d9.js +0 -15267
@@ -1,634 +0,0 @@
1
- import { generateUtilityClasses } from "@mui/material";
2
- import { unstable_composeClasses } from "@mui/base";
3
- import { g as getComponentUtilityClass } from "../../utils/index.6469f148.js";
4
- import { styled, useTheme } from "@mui/material/styles";
5
- import clsx from "clsx";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { useBase, getPropertyByString, evaluateWithContext } from "@m4l/core";
8
- import { a as ImageNode } from "../Image/index.611cd930.js";
9
- import { createRef, useEffect, forwardRef, useRef, useImperativeHandle } from "react";
10
- import { C as Chart, S as ScatterWithErrorBarsController, L as LineWithErrorBarsChart, P as PointWithErrorBar, r as registerables } from "../../node_modules.b55d04d9.js";
11
- import { P as PagerNode, a as PageRender } from "../Page/index.c4642a29.js";
12
- const componentName = "M4LPrintingSystem";
13
- const classes = generateUtilityClasses(componentName, [
14
- "root",
15
- "pageNodeRoot",
16
- "sectionNodeRoot",
17
- "dividerNodeRoot",
18
- "dividerNodeVertical",
19
- "dividerNodeHorizontal",
20
- "textBoxNodeVariant",
21
- "textBoxNodeRoot",
22
- "headerNodeRoot",
23
- "imageNodeRoot",
24
- "paperNodeRoot",
25
- "paperNodeTitle",
26
- "paperNodeContent",
27
- "propertyValueNodeRoot",
28
- "propertyValueNodeTitle",
29
- "propertyValueNodeContent",
30
- "propertyValueNodeHorizontal",
31
- "propertyValueNodeVertical",
32
- "gridNodeRoot",
33
- "footerNodeRoot",
34
- "bodyNodeRoot",
35
- "paperNodeContainerTitles",
36
- "paperNodeTitleSecondary",
37
- "pagerNodeRoot",
38
- "gridNodeTh",
39
- "gridNodeTr",
40
- "gridNodeTd",
41
- "chartNodeRoot"
42
- ]);
43
- const printingSystemUtilityClasses = () => {
44
- const slots = {
45
- root: ["root"],
46
- pageNodeRoot: ["pageNodeRoot"],
47
- sectionNodeRoot: ["sectionNodeRoot"],
48
- dividerNodeRoot: ["dividerNodeRoot"],
49
- dividerNodeVertical: ["dividerNodeVertical"],
50
- dividerNodeHorizontal: ["dividerNodeHorizontal"],
51
- textBoxNodeVariant: ["textBoxNodeVariant"],
52
- textBoxNodeRoot: ["textBoxNodeRoot"],
53
- headerNodeRoot: ["headerNodeRoot"],
54
- imageNodeRoot: ["imageNodeRoot"],
55
- paperNodeRoot: ["paperNodeRoot"],
56
- paperNodeTitle: ["paperNodeTitle"],
57
- paperNodeContent: ["paperNodeContent"],
58
- propertyValueNodeRoot: ["propertyValueNodeRoot"],
59
- propertyValueNodeTitle: ["propertyValueNodeTitle"],
60
- propertyValueNodeContent: ["propertyValueNodeContent"],
61
- propertyValueNodeHorizontal: ["propertyValueNodeHorizontal"],
62
- propertyValueNodeVertical: ["propertyValueNodeVertical"],
63
- gridNodeRoot: ["gridNodeRoot"],
64
- footerNodeRoot: ["footerNodeRoot"],
65
- bodyNodeRoot: ["bodyNodeRoot"],
66
- paperNodeContainerTitles: ["paperNodeContainerTitles"],
67
- paperNodeTitleSecondary: ["paperNodeTitleSecondary"],
68
- pagerNodeRoot: ["pagerNodeRoot"],
69
- gridNodeTh: ["gridNodeTh"],
70
- gridNodeTr: ["gridNodeTr"],
71
- gridNodeTd: ["gridNodeTd"],
72
- chartNodeRoot: ["chartNodeRoot"]
73
- };
74
- const composedClasses = unstable_composeClasses(slots, getComponentUtilityClass(componentName), {});
75
- return {
76
- ...composedClasses
77
- };
78
- };
79
- const PrintingSystemRoot = styled("div")(({
80
- theme
81
- }) => ({
82
- ...theme.components?.M4LPrintingSystem?.styleOverrides
83
- }));
84
- const DividerNode = (props) => {
85
- const {
86
- direction = "vertical",
87
- className = "",
88
- style = {}
89
- } = props;
90
- return /* @__PURE__ */ jsx("div", {
91
- className: clsx(classes.dividerNodeRoot, className, direction === "vertical" ? classes.dividerNodeVertical : classes.dividerNodeHorizontal),
92
- style: {
93
- ...style
94
- }
95
- });
96
- };
97
- const getSize = (value, unitSize) => {
98
- if (typeof value === "number") {
99
- return `${value}${unitSize}`;
100
- } else {
101
- return value;
102
- }
103
- };
104
- const SectionNode = (props) => {
105
- const {
106
- children,
107
- className,
108
- direction = "row",
109
- gap = "unset",
110
- style,
111
- width = "auto",
112
- height = "auto",
113
- paddingTop = "unset",
114
- paddingRight = "unset",
115
- paddingBottom = "unset",
116
- paddingLeft = "unset",
117
- alignX = "unset",
118
- alignY = "unset",
119
- grow = false
120
- } = props;
121
- const {
122
- unitSize
123
- } = useBase();
124
- return /* @__PURE__ */ jsx("div", {
125
- className: clsx(classes.sectionNodeRoot, className),
126
- style: {
127
- flexDirection: direction,
128
- gap: getSize(gap, unitSize),
129
- width: getSize(width, unitSize),
130
- height: getSize(height, unitSize),
131
- minWidth: getSize(width, unitSize),
132
- minHeight: getSize(height, unitSize),
133
- paddingTop: getSize(paddingTop, unitSize),
134
- paddingRight: getSize(paddingRight, unitSize),
135
- paddingBottom: getSize(paddingBottom, unitSize),
136
- paddingLeft: getSize(paddingLeft, unitSize),
137
- justifyContent: direction === "row" ? alignX : alignY,
138
- alignItems: direction === "row" ? alignY : alignX,
139
- flex: grow ? 1 : "unset",
140
- ...style
141
- },
142
- children
143
- });
144
- };
145
- const getEvalValue = (sourceData, key) => {
146
- const regexPattern = /\${([^${}]+(?:\${[^{}]*}[^${}]*)*)}/g;
147
- if (regexPattern.test(key)) {
148
- const matches = [];
149
- let match;
150
- let localRegex = new RegExp(regexPattern);
151
- while ((match = localRegex.exec(key)) !== null) {
152
- matches.push(match[1]);
153
- }
154
- const finalValue = new Array();
155
- matches.map((findMatch) => {
156
- const nestedRegex = /\${([^${}]+(?:\${[^{}]*}[^${}]*)*)}/g;
157
- if (nestedRegex.test(findMatch)) {
158
- const regexKeyReady = /([^ ${]+)/;
159
- let matchKeyReady = regexKeyReady.exec(findMatch) || "";
160
- let nestedKey = findMatch.match(regexPattern) || "";
161
- finalValue.push(getPropertyByString(sourceData, matchKeyReady[1]));
162
- finalValue.push(getEvalValue(sourceData, nestedKey[0]));
163
- } else {
164
- finalValue.push(getPropertyByString(sourceData, findMatch));
165
- }
166
- });
167
- return finalValue.join(" ");
168
- } else {
169
- return key;
170
- }
171
- };
172
- const TextBoxNode = (props) => {
173
- const {
174
- variant = "body",
175
- style,
176
- className,
177
- textAlign = "start",
178
- children
179
- } = props;
180
- const {
181
- sourceData
182
- } = useBase();
183
- const textFormated = getEvalValue(sourceData, children[1]);
184
- return /* @__PURE__ */ jsx("span", {
185
- className: clsx(classes.textBoxNodeRoot, className, `${classes.textBoxNodeVariant}-${variant}`),
186
- style: {
187
- textAlign,
188
- ...style
189
- },
190
- children: textFormated
191
- });
192
- };
193
- const HeaderNode = (props) => {
194
- const {
195
- children,
196
- className,
197
- direction = "row",
198
- gap = "unset",
199
- style,
200
- width = "auto",
201
- height = "auto",
202
- paddingTop = "unset",
203
- paddingRight = "unset",
204
- paddingBottom = "unset",
205
- paddingLeft = "unset",
206
- alignX = "unset",
207
- alignY = "unset",
208
- grow = false
209
- } = props;
210
- const {
211
- unitSize
212
- } = useBase();
213
- return /* @__PURE__ */ jsx("div", {
214
- className: clsx(classes.headerNodeRoot, className),
215
- style: {
216
- flexDirection: direction,
217
- gap: getSize(gap, unitSize),
218
- width: getSize(width, unitSize),
219
- height: getSize(height, unitSize),
220
- minWidth: getSize(width, unitSize),
221
- minHeight: getSize(height, unitSize),
222
- paddingTop: getSize(paddingTop, unitSize),
223
- paddingRight: getSize(paddingRight, unitSize),
224
- paddingBottom: getSize(paddingBottom, unitSize),
225
- paddingLeft: getSize(paddingLeft, unitSize),
226
- justifyContent: direction === "row" ? alignX : alignY,
227
- alignItems: direction === "row" ? alignY : alignX,
228
- flex: grow ? 1 : "unset",
229
- ...style
230
- },
231
- children
232
- });
233
- };
234
- const BodyNode = (props) => {
235
- const {
236
- children,
237
- className,
238
- direction = "row",
239
- gap = "unset",
240
- style,
241
- width = "auto",
242
- height = "auto",
243
- paddingTop = "unset",
244
- paddingRight = "unset",
245
- paddingBottom = "unset",
246
- paddingLeft = "unset",
247
- alignX = "unset",
248
- alignY = "unset",
249
- grow = false
250
- } = props;
251
- const {
252
- unitSize
253
- } = useBase();
254
- return /* @__PURE__ */ jsx("div", {
255
- className: clsx(classes.bodyNodeRoot, className),
256
- style: {
257
- flexDirection: direction,
258
- gap: getSize(gap, unitSize),
259
- width: getSize(width, unitSize),
260
- height: getSize(height, unitSize),
261
- minWidth: getSize(width, unitSize),
262
- minHeight: getSize(height, unitSize),
263
- paddingTop: getSize(paddingTop, unitSize),
264
- paddingRight: getSize(paddingRight, unitSize),
265
- paddingBottom: getSize(paddingBottom, unitSize),
266
- paddingLeft: getSize(paddingLeft, unitSize),
267
- justifyContent: direction === "row" ? alignX : alignY,
268
- alignItems: direction === "row" ? alignY : alignX,
269
- flex: grow ? 1 : "unset",
270
- ...style
271
- },
272
- children
273
- });
274
- };
275
- const FooterNode = (props) => {
276
- const {
277
- children,
278
- className,
279
- direction = "row",
280
- gap = "unset",
281
- style,
282
- width = "auto",
283
- height = "auto",
284
- paddingTop = "unset",
285
- paddingRight = "unset",
286
- paddingBottom = "unset",
287
- paddingLeft = "unset",
288
- alignX = "unset",
289
- alignY = "unset",
290
- grow = false
291
- } = props;
292
- const {
293
- unitSize
294
- } = useBase();
295
- return /* @__PURE__ */ jsx("div", {
296
- className: clsx(classes.footerNodeRoot, className),
297
- style: {
298
- flexDirection: direction,
299
- gap: getSize(gap, unitSize),
300
- width: getSize(width, unitSize),
301
- height: getSize(height, unitSize),
302
- minWidth: getSize(width, unitSize),
303
- minHeight: getSize(height, unitSize),
304
- paddingTop: getSize(paddingTop, unitSize),
305
- paddingRight: getSize(paddingRight, unitSize),
306
- paddingBottom: getSize(paddingBottom, unitSize),
307
- paddingLeft: getSize(paddingLeft, unitSize),
308
- justifyContent: direction === "row" ? alignX : alignY,
309
- alignItems: direction === "row" ? alignY : alignX,
310
- flex: grow ? 1 : "unset",
311
- ...style
312
- },
313
- children
314
- });
315
- };
316
- const PaperNode = (props) => {
317
- const {
318
- children,
319
- style = {},
320
- className = "",
321
- title,
322
- titleSecondary
323
- } = props;
324
- const {
325
- mainColor
326
- } = useBase();
327
- const {
328
- sourceData
329
- } = useBase();
330
- const titleFormated = getEvalValue(sourceData, title);
331
- const titleSecondaryFormated = getEvalValue(sourceData, titleSecondary || "");
332
- return /* @__PURE__ */ jsxs("div", {
333
- className: clsx(classes.paperNodeRoot, className),
334
- style: {
335
- ...style
336
- },
337
- children: [/* @__PURE__ */ jsxs("div", {
338
- className: classes.paperNodeContainerTitles,
339
- children: [/* @__PURE__ */ jsx("div", {
340
- className: classes.paperNodeTitle,
341
- children: titleFormated
342
- }), titleSecondary ? /* @__PURE__ */ jsx("div", {
343
- className: classes.paperNodeTitleSecondary,
344
- style: {
345
- color: mainColor
346
- },
347
- children: titleSecondaryFormated
348
- }) : null]
349
- }), /* @__PURE__ */ jsx("div", {
350
- className: classes.paperNodeContent,
351
- children
352
- })]
353
- });
354
- };
355
- const PropertyValueNode = (props) => {
356
- const {
357
- style = {},
358
- className = "",
359
- property,
360
- value,
361
- direction,
362
- propertyWidth = "auto"
363
- } = props;
364
- console.log();
365
- const {
366
- unitSize,
367
- mainColor,
368
- sourceData
369
- } = useBase();
370
- const propertyFormated = evaluateWithContext(sourceData, property);
371
- const valueFormated = evaluateWithContext(sourceData, value);
372
- return /* @__PURE__ */ jsxs("div", {
373
- className: clsx(classes.propertyValueNodeRoot, direction === "column" ? classes.propertyValueNodeHorizontal : classes.propertyValueNodeVertical, className),
374
- style: {
375
- ...style
376
- },
377
- children: [/* @__PURE__ */ jsx("div", {
378
- className: classes.propertyValueNodeTitle,
379
- style: {
380
- width: getSize(propertyWidth, unitSize),
381
- minWidth: getSize(propertyWidth, unitSize),
382
- borderColor: mainColor
383
- },
384
- children: propertyFormated
385
- }), /* @__PURE__ */ jsx("div", {
386
- className: classes.propertyValueNodeContent,
387
- children: valueFormated
388
- })]
389
- });
390
- };
391
- const GridNode = (props) => {
392
- const {
393
- style = {},
394
- className = "",
395
- rows,
396
- columns
397
- } = props;
398
- const regexPattern = /\$\{([^{}]+)\}/g;
399
- const rowMaybeString = typeof rows === "string" && regexPattern.exec(rows) || "";
400
- const dataColumns = Array.isArray(columns) && columns.length > 0 ? columns : [];
401
- const {
402
- unitSize,
403
- sourceData
404
- } = useBase();
405
- const result = getPropertyByString(sourceData, typeof rows === "string" ? rowMaybeString[1] : "");
406
- console.log("rows", rows);
407
- console.log("result", result);
408
- const rowEval = Array.isArray(result) ? result : typeof result === "object" ? [{
409
- ...result
410
- }] : [];
411
- console.log("rows", rows);
412
- console.log("rowEval", rowEval);
413
- const rowsFormated = typeof rows === "string" ? rowEval : rows;
414
- if (dataColumns.length > 0) {
415
- return /* @__PURE__ */ jsxs("table", {
416
- className: clsx(classes.gridNodeRoot, className),
417
- style: {
418
- ...style
419
- },
420
- children: [/* @__PURE__ */ jsx("thead", {
421
- children: /* @__PURE__ */ jsx("tr", {
422
- className: classes.gridNodeTr,
423
- children: columns.map((column) => {
424
- return /* @__PURE__ */ jsx("th", {
425
- className: classes.gridNodeTh,
426
- style: {
427
- minWidth: column.width ? getSize(column.width, unitSize) : "auto",
428
- maxWidth: column.width ? getSize(column.width, unitSize) : "auto",
429
- justifyContent: column.alignX ? column.alignX : "center"
430
- },
431
- children: getEvalValue(sourceData, column.title)
432
- }, `th-${Math.random().toString(36).substring(7)}`);
433
- })
434
- }, `tr-${Math.random().toString(36).substring(7)}`)
435
- }), /* @__PURE__ */ jsx("tbody", {
436
- children: rowsFormated.map((row) => {
437
- return /* @__PURE__ */ jsx("tr", {
438
- className: classes.gridNodeTr,
439
- children: columns.map((cell, id) => {
440
- const isNested = cell.nestedValue ? true : false;
441
- return /* @__PURE__ */ jsx("td", {
442
- className: classes.gridNodeTd,
443
- style: {
444
- minWidth: getSize(dataColumns[id].width || "auto", unitSize),
445
- justifyContent: cell.alignX ? cell.alignX : "center"
446
- },
447
- children: isNested ? getPropertyByString(row, dataColumns[id].nestedValue || "") : row[dataColumns[id].key]
448
- }, `td-${Math.random().toString(36).substring(7)}`);
449
- })
450
- }, `tr-${Math.random().toString(36).substring(7)}`);
451
- })
452
- })]
453
- });
454
- }
455
- return null;
456
- };
457
- Chart.register(ScatterWithErrorBarsController, LineWithErrorBarsChart, PointWithErrorBar, ...registerables);
458
- const ChartNode = (props) => {
459
- const {
460
- style = {},
461
- className = "",
462
- points,
463
- messageX,
464
- messageY
465
- } = props;
466
- const canvasRef = createRef();
467
- const regexPattern = /\$\{([^{}]+)\}/g;
468
- const {
469
- sourceData
470
- } = useBase();
471
- const pointsMaybeString = typeof points === "string" && regexPattern.exec(points) || "";
472
- const formatPoints = typeof points === "string" ? getPropertyByString(sourceData, pointsMaybeString[1]) : points;
473
- const data = Array.isArray(formatPoints) && formatPoints.length > 0 ? formatPoints.map((point) => {
474
- return {
475
- x: 0,
476
- xMin: 0,
477
- xMax: 0,
478
- y: point.correction,
479
- yMin: point.correction - point.uncertainty,
480
- yMax: point.correction + point.uncertainty
481
- };
482
- }) : [];
483
- useEffect(() => {
484
- const canvas = canvasRef.current;
485
- if (canvas != null) {
486
- const ctx = canvas.getContext("2d");
487
- if (ctx != null) {
488
- new LineWithErrorBarsChart(ctx, {
489
- data: {
490
- labels: Array.isArray(formatPoints) && formatPoints.length > 0 ? formatPoints.map((point) => point.avg) : [],
491
- datasets: [{
492
- data,
493
- borderWidth: 0,
494
- pointBorderWidth: 0
495
- }]
496
- },
497
- options: {
498
- plugins: {
499
- legend: {
500
- display: false
501
- }
502
- },
503
- elements: {
504
- pointWithErrorBar: {
505
- radius: 5,
506
- backgroundColor: "black"
507
- }
508
- },
509
- scales: {
510
- x: {
511
- title: {
512
- display: true,
513
- text: getEvalValue(sourceData, messageX)
514
- }
515
- },
516
- y: {
517
- title: {
518
- display: true,
519
- text: getEvalValue(sourceData, messageY)
520
- }
521
- }
522
- }
523
- }
524
- });
525
- }
526
- }
527
- }, [canvasRef, points]);
528
- return /* @__PURE__ */ jsx("div", {
529
- className: clsx(classes.chartNodeRoot, className),
530
- style: {
531
- ...style
532
- },
533
- children: /* @__PURE__ */ jsx("canvas", {
534
- ref: canvasRef
535
- })
536
- });
537
- };
538
- const FactoryRender = (props) => {
539
- const {
540
- data: parent
541
- } = props;
542
- const {
543
- children,
544
- ...otherProps
545
- } = parent || {};
546
- const strategiesComponents = {
547
- section: SectionNode,
548
- textBox: TextBoxNode,
549
- divider: DividerNode,
550
- image: ImageNode,
551
- header: HeaderNode,
552
- body: BodyNode,
553
- footer: FooterNode,
554
- paper: PaperNode,
555
- propertyValue: PropertyValueNode,
556
- grid: GridNode,
557
- chart: ChartNode,
558
- pager: PagerNode,
559
- __default__: () => {
560
- throw new Error("Type no defined");
561
- }
562
- };
563
- const Component = strategiesComponents[parent.type] ?? strategiesComponents.__default__;
564
- return /* @__PURE__ */ jsxs(Component, {
565
- ...otherProps,
566
- children: [Array.isArray(children) && children.length > 0 ? children.map((subComponent, _id) => {
567
- return /* @__PURE__ */ jsx(FactoryRender, {
568
- data: subComponent
569
- }, `${subComponent.key}-${Math.random().toString(36).substring(7)}`);
570
- }) : null, typeof children === "string" ? children : null]
571
- });
572
- };
573
- const PrintingSystem = forwardRef((props, ref) => {
574
- const {
575
- templateData: nodeRoot,
576
- sourceData,
577
- className
578
- } = props;
579
- const theme = useTheme();
580
- console.log("sourceData", sourceData);
581
- const classes2 = printingSystemUtilityClasses();
582
- const listPages = Array.isArray(nodeRoot.pages) && nodeRoot.pages.length > 0 ? nodeRoot.pages : [];
583
- const rootRef = useRef(null);
584
- useImperativeHandle(ref, () => ({
585
- GoPrint: async () => {
586
- if (rootRef.current) {
587
- const content = rootRef.current;
588
- const printWindow = window.open("", "_blank");
589
- if (printWindow) {
590
- const printDocument = printWindow.document;
591
- printDocument.write("<html><head><title>Contenido a imprimir</title></head><body></body></html>");
592
- printDocument.body.appendChild(content.cloneNode(true));
593
- const styleElement = printDocument.createElement("style");
594
- styleElement.textContent = `
595
- ${theme.components?.M4LPrintingSystem?.styleOverrides}
596
- `;
597
- printDocument.head.appendChild(styleElement);
598
- printDocument.close();
599
- printWindow.print();
600
- }
601
- }
602
- }
603
- }));
604
- const Header = () => /* @__PURE__ */ jsx(FactoryRender, {
605
- data: nodeRoot.header[0]
606
- });
607
- const Footer = () => /* @__PURE__ */ jsx(FactoryRender, {
608
- data: nodeRoot.footer[0]
609
- });
610
- return /* @__PURE__ */ jsx(PrintingSystemRoot, {
611
- className: clsx(classes2.root, className),
612
- ref: rootRef,
613
- children: listPages.map((page, id) => {
614
- return /* @__PURE__ */ jsx(PageRender, {
615
- data: page,
616
- id: id + 1,
617
- unitSize: nodeRoot.unitSizes,
618
- mainColor: nodeRoot.mainColor,
619
- countPages: listPages.length,
620
- HeaderGeneral: Header,
621
- FooterGeneral: Footer,
622
- sourceData,
623
- templateData: nodeRoot
624
- }, page.key);
625
- })
626
- });
627
- });
628
- export {
629
- FactoryRender as F,
630
- PrintingSystem as P,
631
- getSize as a,
632
- classes as c,
633
- getEvalValue as g
634
- };