datastake-daf 0.6.101 → 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.
@@ -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 =>
@@ -9,5 +9,4 @@
9
9
  @import './EditForm/index';
10
10
  @import './DynamicForm/index';
11
11
  @import "./Badge/index.scss";
12
- @import "./Screens/index.scss";
13
- @import "./ProgressTabs/index";
12
+ @import "./Screens/index.scss";
package/src/index.js CHANGED
@@ -85,7 +85,6 @@ export { AjaxSelectMain as AjaxSelect } from "./@daf/core/components/EditForm/co
85
85
  export { default as ProgressBar } from "./@daf/core/components/ProgressBar/index.jsx";
86
86
  export { default as MultiBarProgress } from "./@daf/core/components/ProgressBar/MultiBarProgress/index.jsx";
87
87
  export { default as ProgressBarSideIcon } from "./@daf/core/components/ProgressBar/components/SideIcon/index.jsx";
88
- export { default as ProgressTabs } from "./@daf/core/components/ProgressTabs/index.jsx";
89
88
 
90
89
  // Data Store
91
90
  export { default as DataStore } from "./@daf/core/components/DataStore/index.js";
@@ -1,118 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { CheckOutlined, ScanOutlined, FileTextOutlined, CheckCircleOutlined } from '@ant-design/icons';
3
- import ProgressTabs from './index';
4
-
5
- export default {
6
- title: 'Components/ProgressTabs',
7
- component: ProgressTabs,
8
- parameters: {
9
- layout: 'centered',
10
- },
11
- argTypes: {
12
- value: {
13
- control: { type: 'select', options: ['setup', 'scan', 'review', 'status'] },
14
- description: 'Current selected value',
15
- },
16
- onChange: {
17
- action: 'changed',
18
- description: 'Callback when selection changes',
19
- },
20
- },
21
- };
22
-
23
- const Template = (args) => {
24
- const [value, setValue] = useState(args.value || 'setup');
25
-
26
- const handleChange = (newValue) => {
27
- setValue(newValue);
28
- args.onChange?.(newValue);
29
- };
30
-
31
- return (
32
- <div style={{ width: '600px', padding: '20px' }}>
33
- <ProgressTabs
34
- {...args}
35
- value={value}
36
- onChange={handleChange}
37
- />
38
- </div>
39
- );
40
- };
41
-
42
- export const Default = Template.bind({});
43
- Default.args = {
44
- value: 'setup',
45
- };
46
-
47
- export const SecondStep = Template.bind({});
48
- SecondStep.args = {
49
- value: 'scan',
50
- };
51
-
52
- export const ThirdStep = Template.bind({});
53
- ThirdStep.args = {
54
- value: 'review',
55
- };
56
-
57
- export const LastStep = Template.bind({});
58
- LastStep.args = {
59
- value: 'status',
60
- };
61
-
62
- export const CustomOptions = Template.bind({});
63
- CustomOptions.args = {
64
- value: 'data',
65
- options: [
66
- { label: 'Initial Setup', value: 'init' },
67
- { label: 'Data Collection', value: 'data' },
68
- { label: 'Analysis', value: 'analysis' },
69
- { label: 'Final Report', value: 'report' }
70
- ],
71
- };
72
-
73
- export const WithIcons = Template.bind({});
74
- WithIcons.args = {
75
- value: 'setup',
76
- options: [
77
- { label: 'Set Up', value: 'setup', icon: <CheckOutlined /> },
78
- { label: 'Project Scan', value: 'scan', icon: <ScanOutlined /> },
79
- { label: 'Review & Submission', value: 'review', icon: <FileTextOutlined /> },
80
- { label: 'Submission Status', value: 'status', icon: <CheckCircleOutlined /> }
81
- ],
82
- };
83
-
84
- export const WithDisabled = Template.bind({});
85
- WithDisabled.args = {
86
- value: 'setup',
87
- options: [
88
- { label: 'Set Up', value: 'setup' },
89
- { label: 'Project Scan', value: 'scan', isDisabled: true },
90
- { label: 'Review & Submission', value: 'review', isDisabled: true },
91
- { label: 'Submission Status', value: 'status', isDisabled: true }
92
- ],
93
- };
94
-
95
- export const WithIconsAndDisabled = Template.bind({});
96
- WithIconsAndDisabled.args = {
97
- value: 'setup',
98
- options: [
99
- { label: 'Set Up', value: 'setup', icon: <CheckOutlined /> },
100
- { label: 'Project Scan', value: 'scan', icon: <ScanOutlined />, isDisabled: true },
101
- { label: 'Review & Submission', value: 'review', icon: <FileTextOutlined />, isDisabled: true },
102
- { label: 'Submission Status', value: 'status', icon: <CheckCircleOutlined />, isDisabled: true }
103
- ],
104
- };
105
-
106
- export const CustomWidth = Template.bind({});
107
- CustomWidth.args = {
108
- value: 'scan',
109
- width: '400px',
110
- };
111
-
112
- export const SmallWidth = Template.bind({});
113
- SmallWidth.args = {
114
- value: 'review',
115
- width: '300px',
116
- };
117
-
118
-
@@ -1,100 +0,0 @@
1
- .progress-tabs {
2
- width: 100%;
3
- padding: 16px 0;
4
-
5
- &__segmented {
6
- .ant-segmented {
7
- background: #f8f9fa;
8
- border-radius: 8px;
9
- padding: 4px;
10
- border: 1px solid #e6e7eb;
11
- width: 100%;
12
- height: 36px;
13
- }
14
-
15
- .ant-segmented-group {
16
- display: flex;
17
- width: 100%;
18
- }
19
-
20
- .ant-segmented-item {
21
- flex: 1;
22
- text-align: center;
23
- border: none;
24
- background: transparent;
25
- margin: 0;
26
- padding: 8px 16px;
27
- border-radius: 6px;
28
- transition: all 0.3s ease;
29
- font-size: 14px;
30
- font-weight: 500;
31
- color: #6b7280;
32
- position: relative;
33
-
34
- &:hover:not(.ant-segmented-item-disabled) {
35
- color: #6b7280;
36
- background: rgba(255, 255, 255, 0.5);
37
- }
38
-
39
- &.ant-segmented-item-selected {
40
- background: #ffffff;
41
- color: #374151;
42
- font-weight: 600;
43
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
44
- }
45
-
46
- &.ant-segmented-item-disabled {
47
- color: #d1d5db;
48
- cursor: not-allowed;
49
- opacity: 0.5;
50
-
51
- &:hover {
52
- background: transparent;
53
- color: #d1d5db;
54
- }
55
- }
56
- }
57
-
58
- // Custom option content styling
59
- .progress-tabs__option-content {
60
- display: flex;
61
- align-items: center;
62
- justify-content: center;
63
- gap: 6px;
64
- }
65
-
66
- .progress-tabs__icon {
67
- display: flex;
68
- align-items: center;
69
- font-size: 14px;
70
- }
71
-
72
- .progress-tabs__label {
73
- display: flex;
74
- align-items: center;
75
- }
76
-
77
- .ant-segmented-thumb {
78
- display: none;
79
- }
80
- }
81
-
82
- // Responsive design
83
- @media (max-width: 768px) {
84
- &__segmented {
85
- .ant-segmented-item {
86
- font-size: 12px;
87
- padding: 6px 12px;
88
- }
89
- }
90
- }
91
-
92
- @media (max-width: 480px) {
93
- &__segmented {
94
- .ant-segmented-item {
95
- font-size: 11px;
96
- padding: 4px 8px;
97
- }
98
- }
99
- }
100
- }