datastake-daf 0.6.100 → 0.6.102

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 (67) hide show
  1. package/dist/components/index.css +1 -1
  2. package/dist/components/index.js +2722 -226
  3. package/package.json +1 -1
  4. package/rollup.config.js +41 -83
  5. package/src/@daf/core/components/Dashboard/Map/helper.js +434 -439
  6. package/src/@daf/core/components/Dashboard/Map/storyConfig1.js +230 -233
  7. package/src/@daf/core/components/EditForm/components/AjaxSubGroup/index.js +0 -2
  8. package/src/@daf/core/components/PdfForm/components/AjaxSubGroup.js +106 -0
  9. package/src/@daf/core/components/PdfForm/components/ajaxSubGroupHandler.js +12 -0
  10. package/src/@daf/core/components/PdfForm/components/dataLinkGroupHandler.js +24 -15
  11. package/src/@daf/core/components/PdfForm/components/dataLinkHandler.js +51 -17
  12. package/src/@daf/core/components/PdfForm/index.js +208 -22
  13. package/src/@daf/core/components/PdfForm/storyConfig.js +464 -163
  14. package/src/@daf/core/components/PdfForm/style.scss +145 -3
  15. package/src/@daf/core/components/PdfForm/utils/fieldData.js +82 -3
  16. package/src/@daf/core/components/PdfForm/utils/fieldRenderer.js +14 -6
  17. package/src/helpers/Map.js +6 -82
  18. package/src/styles/_index.scss +1 -1
  19. package/src/styles/datastake.scss +4454 -1
  20. package/.vscode/settings.json +0 -13
  21. package/dist/style/datastake/_index.css +0 -5
  22. package/dist/style/datastake/datastake.css +0 -5081
  23. package/dist/style/datastake/fonts/Outfit-Black.ttf +0 -0
  24. package/dist/style/datastake/fonts/Outfit-Bold.ttf +0 -0
  25. package/dist/style/datastake/fonts/Outfit-ExtraBold.ttf +0 -0
  26. package/dist/style/datastake/fonts/Outfit-ExtraLight.ttf +0 -0
  27. package/dist/style/datastake/fonts/Outfit-Light.ttf +0 -0
  28. package/dist/style/datastake/fonts/Outfit-Medium.ttf +0 -0
  29. package/dist/style/datastake/fonts/Outfit-Regular.ttf +0 -0
  30. package/dist/style/datastake/fonts/Outfit-SemiBold.ttf +0 -0
  31. package/dist/style/datastake/fonts/Outfit-Thin.ttf +0 -0
  32. package/dist/style/datastake/fonts/outfit.css +0 -62
  33. package/dist/style/datastake/fonts/sf-ui-display-black-58646a6b80d5a.woff +0 -0
  34. package/dist/style/datastake/fonts/sf-ui-display-bold-58646a511e3d9.woff +0 -0
  35. package/dist/style/datastake/fonts/sf-ui-display-heavy-586470160b9e5.woff +0 -0
  36. package/dist/style/datastake/fonts/sf-ui-display-light-58646b33e0551.woff +0 -0
  37. package/dist/style/datastake/fonts/sf-ui-display-medium-58646be638f96.woff +0 -0
  38. package/dist/style/datastake/fonts/sf-ui-display-semibold-58646eddcae92.woff +0 -0
  39. package/dist/style/datastake/fonts/sf-ui-display-thin-58646e9b26e8b.woff +0 -0
  40. package/dist/style/datastake/fonts/sf-ui-display-ultralight-58646b19bf205.woff +0 -0
  41. package/dist/style/datastake/fonts/sfDisplay.css +0 -59
  42. package/dist/style/datastake/leaflet.css +0 -671
  43. package/dist/style/datastake/leaflet.markercluster.css +0 -60
  44. package/dist/style/style.css +0 -1
  45. package/src/styles/datastake/_index.css +0 -5
  46. package/src/styles/datastake/datastake.css +0 -5081
  47. package/src/styles/datastake/fonts/Outfit-Black.ttf +0 -0
  48. package/src/styles/datastake/fonts/Outfit-Bold.ttf +0 -0
  49. package/src/styles/datastake/fonts/Outfit-ExtraBold.ttf +0 -0
  50. package/src/styles/datastake/fonts/Outfit-ExtraLight.ttf +0 -0
  51. package/src/styles/datastake/fonts/Outfit-Light.ttf +0 -0
  52. package/src/styles/datastake/fonts/Outfit-Medium.ttf +0 -0
  53. package/src/styles/datastake/fonts/Outfit-Regular.ttf +0 -0
  54. package/src/styles/datastake/fonts/Outfit-SemiBold.ttf +0 -0
  55. package/src/styles/datastake/fonts/Outfit-Thin.ttf +0 -0
  56. package/src/styles/datastake/fonts/outfit.css +0 -62
  57. package/src/styles/datastake/fonts/sf-ui-display-black-58646a6b80d5a.woff +0 -0
  58. package/src/styles/datastake/fonts/sf-ui-display-bold-58646a511e3d9.woff +0 -0
  59. package/src/styles/datastake/fonts/sf-ui-display-heavy-586470160b9e5.woff +0 -0
  60. package/src/styles/datastake/fonts/sf-ui-display-light-58646b33e0551.woff +0 -0
  61. package/src/styles/datastake/fonts/sf-ui-display-medium-58646be638f96.woff +0 -0
  62. package/src/styles/datastake/fonts/sf-ui-display-semibold-58646eddcae92.woff +0 -0
  63. package/src/styles/datastake/fonts/sf-ui-display-thin-58646e9b26e8b.woff +0 -0
  64. package/src/styles/datastake/fonts/sf-ui-display-ultralight-58646b19bf205.woff +0 -0
  65. package/src/styles/datastake/fonts/sfDisplay.css +0 -59
  66. package/src/styles/datastake/leaflet.css +0 -671
  67. package/src/styles/datastake/leaflet.markercluster.css +0 -60
@@ -2,7 +2,7 @@
2
2
  .pdf-form {
3
3
  color: #333;
4
4
  background: white;
5
-
5
+
6
6
  // Document header styling
7
7
  .document-header {
8
8
  display: flex;
@@ -151,6 +151,24 @@
151
151
  }
152
152
  }
153
153
 
154
+ &.level-4.leaf:not(.parent) {
155
+ &::before {
156
+ left: 84px !important;
157
+ right: 0;
158
+ height: 1px;
159
+ background-color: #e8e8e8;
160
+ }
161
+ }
162
+
163
+ &.level-5.leaf:not(.parent) {
164
+ &::before {
165
+ left: 84px !important;
166
+ right: 0;
167
+ height: 1px;
168
+ background-color: #e8e8e8;
169
+ }
170
+ }
171
+
154
172
  .tree-node-content {
155
173
  display: flex;
156
174
  align-items: center;
@@ -176,6 +194,15 @@
176
194
  width: 1px;
177
195
  background-color: #d9d9d9;
178
196
  }
197
+
198
+ &.level-4, &.level-5, &.level-6 {
199
+ &::before {
200
+ height: 46px;
201
+ }
202
+ &::after {
203
+ display: none;
204
+ }
205
+ }
179
206
 
180
207
  &::after {
181
208
  display: none;
@@ -342,13 +369,101 @@
342
369
 
343
370
  &.level-4 {
344
371
  .tree-node-content .tree-node-title .tree-value-container {
345
- margin-left: -40px;
372
+ margin-left: -60px;
346
373
  }
347
374
  }
348
375
 
349
376
  &.level-5 {
350
377
  .tree-node-content .tree-node-title .tree-value-container {
351
- margin-left: -50px;
378
+ margin-left: -80px;
379
+ }
380
+ }
381
+
382
+ &.level-6 {
383
+ .tree-node-content .tree-node-title .tree-value-container {
384
+ margin-left: -100px;
385
+ }
386
+ }
387
+
388
+ &.level-4.leaf:not(.parent) {
389
+ &::before {
390
+ left: 90px !important;
391
+ right: 0;
392
+ }
393
+ }
394
+
395
+ &.level-5.leaf:not(.parent) {
396
+ &::before {
397
+ left: 120px !important;
398
+ right: 0;
399
+ }
400
+ }
401
+ &.level-6.leaf:not(.parent) {
402
+ &::before {
403
+ left: 140px !important;
404
+ right: 0;
405
+ }
406
+ }
407
+
408
+ &.parent {
409
+ &.level-3::after {
410
+ left: 84px;
411
+ }
412
+
413
+ &.level-4::after {
414
+ left: 84px;
415
+ }
416
+
417
+ &.level-5::after {
418
+ left: 84px;
419
+ }
420
+
421
+ &.level-6::after {
422
+ left: 140px;
423
+ }
424
+ }
425
+
426
+ // Style adjustments for header type elements at different levels
427
+ &[data-node-type="header"] {
428
+ &.level-1 {
429
+ margin-bottom: 15px;
430
+
431
+ > .tree-node-content > .tree-node-title .tree-label {
432
+ font-size: 13px;
433
+ font-weight: 700;
434
+ color: #1a202c;
435
+ text-transform: uppercase;
436
+ letter-spacing: 0.5px;
437
+ }
438
+ }
439
+
440
+ &.level-2 {
441
+ margin-bottom: 10px;
442
+
443
+ > .tree-node-content > .tree-node-title .tree-label {
444
+ font-size: 12px;
445
+ font-weight: 600;
446
+ color: #2d3748;
447
+ }
448
+ }
449
+ }
450
+
451
+ // Update leaf node styling to match the new line positioning
452
+ &.level-3.leaf:not(.parent) {
453
+ &::before {
454
+ left: 84px;
455
+ }
456
+ }
457
+
458
+ &.level-4.leaf:not(.parent) {
459
+ &::before {
460
+ left: 84px; // Align with the continuous vertical line
461
+ }
462
+ }
463
+
464
+ &.level-5.leaf:not(.parent) {
465
+ &::before {
466
+ left: 84px; // Align with the continuous vertical line
352
467
  }
353
468
  }
354
469
  }
@@ -469,3 +584,30 @@
469
584
  }
470
585
  }
471
586
  }
587
+
588
+ // Alternative approach - target by the content or add a class
589
+ .pdf-form .tree-node .tree-node-content .tree-node-title .tree-label {
590
+ &[data-is-comment="true"] {
591
+ font-size: 10px;
592
+ color: #666;
593
+ font-weight: 400;
594
+ }
595
+ }
596
+
597
+ .tree-node.comment-node .tree-label.comment-label {
598
+ font-size: 10px !important;
599
+ color: #666 !important;
600
+ font-weight: 400 !important;
601
+ }
602
+
603
+ .tree-node.comment-node {
604
+ .tree-label.comment-label {
605
+ font-size: 10px !important;
606
+ color: #888 !important;
607
+ font-weight: 400 !important;
608
+ }
609
+
610
+ .tree-node-content {
611
+ padding-left: 10px;
612
+ }
613
+ }
@@ -4,20 +4,93 @@ import { AjaxSelectRenderer } from './ajaxSelectFieldData';
4
4
  import { findOptions } from '../../../../../helpers/StringHelper';
5
5
  import Geolocation from '../../ViewForm/components/geolocation';
6
6
 
7
+ export const evaluateShowIfCondition = (condition, item) => {
8
+ if (!condition || !item) return false;
9
+
10
+ // Handle boolean AND operations
11
+ if (condition.includes(' && ')) {
12
+ const andParts = condition.split(' && ');
13
+ return andParts.every(part => evaluateShowIfCondition(part.trim(), item));
14
+ }
15
+
16
+ // Handle "includes" conditions
17
+ if (condition.includes(' includes ')) {
18
+ const parts = condition.split(' includes ');
19
+ if (parts.length === 2) {
20
+ const [field, expectedValue] = parts.map(p => p.trim());
21
+ const fieldValue = item[field];
22
+ if (Array.isArray(fieldValue)) {
23
+ return fieldValue.includes(expectedValue);
24
+ }
25
+ if (typeof fieldValue === 'string') {
26
+ return fieldValue.split(',').map(v => v.trim()).includes(expectedValue);
27
+ }
28
+ return false;
29
+ }
30
+ }
31
+
32
+ // Handle "not" conditions
33
+ if (condition.includes(' not ')) {
34
+ const parts = condition.split(' not ');
35
+ if (parts.length === 2) {
36
+ const [field, expectedValue] = parts.map(p => p.trim());
37
+ return item[field] !== expectedValue;
38
+ }
39
+ }
40
+
41
+ // Handle "is" conditions (existing logic)
42
+ const parts = condition.split(' is ');
43
+ if (parts.length === 2) {
44
+ const [field, expectedValue] = parts.map(p => p.trim());
45
+ return item[field] === expectedValue;
46
+ }
47
+
48
+ return false;
49
+ };
50
+
51
+ export const processConditionalTableKeys = (tableKeys, item) => {
52
+ const processedKeys = [];
53
+
54
+ tableKeys.forEach(tableKey => {
55
+ if (typeof tableKey === 'string') {
56
+ processedKeys.push(tableKey);
57
+ } else if (tableKey && typeof tableKey === 'object' && tableKey.content) {
58
+ tableKey.content.forEach(contentItem => {
59
+ if (contentItem.key) {
60
+ if (!contentItem.showIf || evaluateShowIfCondition(contentItem.showIf, item)) {
61
+ processedKeys.push(contentItem.key);
62
+ }
63
+ }
64
+ });
65
+ } else if (tableKey && typeof tableKey === 'object' && tableKey.key) {
66
+ if (!tableKey.showIf || evaluateShowIfCondition(tableKey.showIf, item)) {
67
+ processedKeys.push(tableKey.key);
68
+ }
69
+ }
70
+ });
71
+
72
+ return processedKeys;
73
+ };
7
74
 
8
- export const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app) => {
75
+ export const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, allValues) => {
9
76
  switch(type) {
10
77
  case 'year':
11
- return renderDateFormatted(value, 'YYYY', 'en');
78
+ return value !== '-' ? renderDateFormatted(value, 'YYYY', 'en') : '-';
12
79
  case 'date': {
13
80
  const language = user?.language && user?.language === 'sp' ? 'es' : user?.language
14
- return renderDateFormatted(value, 'DD MMM YYYY', language || 'en');
81
+ return value !== '-' ? renderDateFormatted(value, 'DD MMM YYYY', language || 'en') : '-';
15
82
  }
16
83
  case 'select': {
17
84
  const options = config?.options || [];
18
85
  const option = findOptions(value, options);
19
86
  return option
20
87
  }
88
+ case 'multiselect': {
89
+ const options = config?.options || [];
90
+ const _val = typeof value === 'string' ? value.split(',').map(v => v.trim()) : value;
91
+ const option = findOptions(_val, options);
92
+ return option.join(', ');
93
+ }
21
94
  case 'ajaxSelect':
22
95
  return <AjaxSelectRenderer value={value} config={config} getApiBaseUrl={getApiBaseUrl} getAppHeader={getAppHeader} app={app} />;
23
96
  case 'percentage':
@@ -26,6 +99,12 @@ export const renderFieldData = (type, value, user, config, getApiBaseUrl = () =>
26
99
  const val = JSON.parse(value) || {};
27
100
  return <Geolocation val={val} showViewOnMap={false} t={() => {}} />;
28
101
  }
102
+ case 'imageUpload':
103
+ case 'upload':
104
+ case 'videoUpload':{
105
+ const documentName = allValues?.map((item) => item?.name).join(', ');
106
+ return documentName;
107
+ }
29
108
  default:
30
109
  return value;
31
110
  }
@@ -30,17 +30,17 @@ export const renderValue = ({ value, hasChildren, config, user, getApiBaseUrl =
30
30
  }).filter(val => val !== '');
31
31
 
32
32
  const combinedValue = values.join(' ');
33
- return combinedValue ? <span className="tree-value groupInputs-type">{combinedValue}</span> : null;
33
+ return combinedValue ? <span className="tree-value groupInputs-type">{combinedValue}</span> : <span className="tree-value empty">-</span>;
34
34
  }
35
35
 
36
36
  if (hasChildren) return null;
37
37
 
38
38
  let displayValue = '';
39
39
  if (value === null || value === undefined || value === '') {
40
- displayValue = '';
40
+ displayValue = '-'; // Changed from '' to '-'
41
41
  } else if (typeof value === 'object' && value !== null) {
42
42
  if (Array.isArray(value)) {
43
- displayValue = value.length > 0 ? value.join(', ') : '';
43
+ displayValue = value.length > 0 ? value.join(', ') : '-'; // Changed from '' to '-'
44
44
  } else if (value.name || value.fullName) {
45
45
  displayValue = value.name || value.fullName;
46
46
  } else if (value.label) {
@@ -54,22 +54,30 @@ export const renderValue = ({ value, hasChildren, config, user, getApiBaseUrl =
54
54
 
55
55
  const fieldType = config?.type || 'text';
56
56
  let cssClass = `tree-value ${fieldType}-type`;
57
+
58
+ if (displayValue === '-') {
59
+ cssClass += ' empty';
60
+ }
57
61
 
58
- displayValue = renderFieldData(fieldType, displayValue, user, config, getApiBaseUrl, getAppHeader, app);
62
+ displayValue = renderFieldData(fieldType, displayValue, user, config, getApiBaseUrl, getAppHeader, app, value);
59
63
 
60
- return displayValue ? <span className={cssClass}>{displayValue}</span> : null;
64
+ return <span className={cssClass}>{displayValue}</span>;
61
65
  };
62
66
 
63
67
  export const determineHasChildren = ({ config, level }) => {
64
- // groupInputs should be treated as leaf nodes, not parent nodes
65
68
  if (config?.type === 'groupInputs') {
66
69
  return false;
67
70
  }
68
71
 
72
+ if (config?.type === 'header' && config?.inputs && Object.keys(config.inputs).length > 0) {
73
+ return true;
74
+ }
75
+
69
76
  return config?.inputs ||
70
77
  config?.type === 'group' ||
71
78
  config?.type === 'dataLinkGroup' ||
72
79
  config?.type === 'section' ||
80
+ config?.type === 'ajaxSubGroup' || // Add this line
73
81
  (config?.type === 'dataLink' && config?.meta?.tableKeys) ||
74
82
  (level === 0 && config && typeof config === 'object' &&
75
83
  Object.keys(config).some(key =>
@@ -1,10 +1,4 @@
1
- import L from "leaflet";
2
- const EVENT_COLORS = {
3
- MAJOR: "#cf1322", // Red for major incidents
4
- MODERATE: "#fa8c16", // Orange for moderate incidents
5
- MINOR: "#fadb14", // Yellow for minor incidents
6
- CORRECTIVE: "#12b76a", // Green for corrective actions
7
- };
1
+ import L from 'leaflet';
8
2
 
9
3
  /**
10
4
  * Converts a latitude or longitude coordinate to degrees, minutes and seconds.
@@ -21,7 +15,7 @@ export const toDegreesMinutesAndSeconds = (coordinate) => {
21
15
  var minutes = Math.floor(minutesNotTruncated);
22
16
  var seconds = Math.floor((minutesNotTruncated - minutes) * 60);
23
17
  return degrees + "°" + minutes + "'" + seconds;
24
- };
18
+ }
25
19
 
26
20
  /**
27
21
  * Converts latitude and longitude coordinates in decimal degrees to degrees, minutes and seconds.
@@ -34,82 +28,12 @@ export const toDegreesMinutesAndSeconds = (coordinate) => {
34
28
  */
35
29
  export const convertDMS = (lat, lng) => {
36
30
  const latitude = toDegreesMinutesAndSeconds(lat);
37
- const latitudeCardinal = lat >= 0 ? "N" : "S";
31
+ const latitudeCardinal = lat >= 0 ? 'N' : 'S';
38
32
  const longitude = toDegreesMinutesAndSeconds(lng);
39
- const longitudeCardinal = lng >= 0 ? "E" : "W";
40
- return [
41
- latitude + '"' + latitudeCardinal,
42
- longitude + '"' + longitudeCardinal,
43
- ];
44
- };
33
+ const longitudeCardinal = lng >= 0 ? 'E' : 'W';
34
+ return [(latitude + '"' + latitudeCardinal), (longitude + '"' + longitudeCardinal)];
35
+ }
45
36
 
46
37
  export const southWest = L.latLng(85, -180),
47
38
  northEast = L.latLng(-85, 180),
48
39
  maxBounds = L.latLngBounds(southWest, northEast);
49
-
50
- export const getEventMarkerStyle = (data) => {
51
- const incidents = data?.data || [];
52
-
53
- const totals = {
54
- major: incidents.filter((d) => d.type === "major_incident").length,
55
- minor: incidents.filter((d) => d.type === "minor_incident").length,
56
- moderate: incidents.filter((d) => d.type === "moderate_incident").length,
57
- correctiveActions: incidents.filter((d) => d.type === "correctiveActions")
58
- .length,
59
- };
60
-
61
- const total = incidents.length;
62
- let background = "#f1f1f1";
63
-
64
- if (total > 0) {
65
- // Build a dynamic array of categories with colors & percentages
66
- const categories = [
67
- { key: "major", value: totals.major, color: EVENT_COLORS.MAJOR },
68
- {
69
- key: "moderate",
70
- value: totals.moderate,
71
- color: EVENT_COLORS.MODERATE,
72
- },
73
- { key: "minor", value: totals.minor, color: EVENT_COLORS.MINOR },
74
- {
75
- key: "corrective",
76
- value: totals.correctiveActions,
77
- color: EVENT_COLORS.CORRECTIVE,
78
- },
79
- ]
80
- .filter((c) => c.value > 0)
81
- .map((c) => ({ ...c, perc: (c.value / total) * 100 }));
82
-
83
- if (categories.length === 1) {
84
- background = categories[0].color;
85
- } else {
86
- let currentStop = 0;
87
- const gradientStops = categories.map((cat, index) => {
88
- const stop = categories
89
- .slice(0, index)
90
- .reduce((acc, c) => acc + c.perc, 0);
91
-
92
- return `${cat.color} ${Math.round(stop)}%`;
93
- });
94
-
95
- background = `radial-gradient(circle, ${gradientStops.join(", ")})`;
96
- }
97
- }
98
-
99
- let radius = 35;
100
-
101
- if (data.total > 20) {
102
- radius = 65;
103
- } else if (data.total > 10) {
104
- radius = 50;
105
- } else {
106
- radius = 40;
107
- }
108
-
109
- return {
110
- radius,
111
- background,
112
- totals,
113
- total,
114
- };
115
- };
@@ -6,7 +6,7 @@
6
6
  @import "./layout/index";
7
7
  @import "./pages/index";
8
8
  @import "./xyflow.scss";
9
- /* @import "./datastake.scss"; */
9
+ @import "./datastake.scss";
10
10
  // form classes
11
11
 
12
12
  .max-char-cont {