@salesforce/plugin-omnistudio-migration-tool 2.0.0-beta.5 → 2.0.0-beta.7

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.
@@ -0,0 +1,195 @@
1
+ function toggleFilterDropdown(tableId) {
2
+ const reportTable = document.getElementById(tableId);
3
+ const dropdown = reportTable.querySelector('#filter-dropdown');
4
+ const chevronUp = reportTable.querySelector('#chevron-up');
5
+ const chevronDown = reportTable.querySelector('#chevron-down');
6
+
7
+ if (dropdown && chevronUp && chevronDown) {
8
+ dropdown.classList.toggle('show');
9
+ chevronUp.classList.toggle('hidden');
10
+ chevronDown.classList.toggle('hidden');
11
+ }
12
+ }
13
+
14
+ function toggleDiffModal(name) {
15
+ const modal = document.getElementById(`myModal_${name}`);
16
+ modal.style.display = modal.style.display === 'none' ? 'flex' : 'none';
17
+ }
18
+
19
+ function toggleDiffModal(name) {
20
+ const modal = document.getElementById(`myModal_${name}`);
21
+ modal.style.display = modal.style.display === 'none' ? 'flex' : 'none';
22
+ }
23
+
24
+ function filterAndSearchTable(tableId) {
25
+ const reportTable = document.getElementById(tableId);
26
+ const table = reportTable.querySelector('#filterable-table-body');
27
+ const checkboxes = reportTable.querySelectorAll('.filter-checkbox');
28
+ const searchInput = reportTable.querySelector('#name-search-input');
29
+ const searchText = searchInput.value.trim().toLowerCase();
30
+ const filters = {};
31
+ const rows = Array.from(table?.rows || []);
32
+ let visibleRowCount = 0;
33
+
34
+ // Gather checked filter options
35
+ checkboxes.forEach((cb) => {
36
+ const key = cb.getAttribute('data-filter-key');
37
+ if (!key) return;
38
+ if (!filters[key]) filters[key] = [];
39
+ if (cb.checked) filters[key].push(cb.value);
40
+ });
41
+
42
+ const noRowsMessage = reportTable.querySelector('#no-rows-message');
43
+
44
+ // NEW: If any filter group has zero selected values → show no rows
45
+ const activeFilterKeys = [...new Set([...checkboxes].map((cb) => cb.getAttribute('data-filter-key')))];
46
+ const hasEmptyGroup = activeFilterKeys.some((key) => !filters[key] || filters[key].length === 0);
47
+ if (hasEmptyGroup) {
48
+ // Hide all rows and show no match message
49
+ rows.forEach((row) => {
50
+ if (row.id !== 'no-rows-message') row.style.display = 'none';
51
+ });
52
+ if (noRowsMessage) noRowsMessage.style.display = '';
53
+
54
+ // Update visible row count
55
+ const visibleRows = Array.from(table.rows).filter(
56
+ (row) => row.style.display !== 'none' && row.id !== 'no-rows-message'
57
+ );
58
+ reportTable.querySelector('#row-count').textContent = `Showing ${visibleRows.length} record${
59
+ visibleRows.length !== 1 ? 's' : ''
60
+ }`;
61
+ return;
62
+ }
63
+
64
+ // Otherwise, apply filters and search
65
+ let processedClasses = new Set();
66
+ rows.forEach((row) => {
67
+ if (row.id === 'no-rows-message') return;
68
+
69
+ let show = true;
70
+
71
+ // Apply checkbox filters
72
+ for (const key of Object.keys(filters)) {
73
+ const selectedValues = filters[key];
74
+ const cell = Array.from(row.cells).find((c) => c.getAttribute('key') === key);
75
+ const cellValue = cell?.getAttribute('value') || '';
76
+ if (!selectedValues.includes(cellValue)) {
77
+ show = false;
78
+ break;
79
+ }
80
+ }
81
+
82
+ // Apply name search filter
83
+ if (show && searchText !== '') {
84
+ const nameCell = row.querySelector('td[data-name]');
85
+ const nameValue = nameCell?.getAttribute('data-name')?.toLowerCase() || '';
86
+ if (!nameValue.includes(searchText)) {
87
+ show = false;
88
+ }
89
+ }
90
+
91
+ // row.style.display = show ? '' : 'none';
92
+ if (!processedClasses.has(row.classList[0])) {
93
+ hideOrShowData(reportTable, row.classList[0], show);
94
+ processedClasses.add(row.classList[0]);
95
+ }
96
+ if (show) visibleRowCount++;
97
+ });
98
+
99
+ if (noRowsMessage) {
100
+ noRowsMessage.style.display = visibleRowCount === 0 ? '' : 'none';
101
+ }
102
+
103
+ // Update visible row count
104
+ const visibleRows = Array.from(table.rows).filter(
105
+ (row) => row.style.display !== 'none' && row.id !== 'no-rows-message'
106
+ );
107
+ reportTable.querySelector('#row-count').textContent = `Showing ${visibleRows.length} record${
108
+ visibleRows.length !== 1 ? 's' : ''
109
+ }`;
110
+ }
111
+
112
+ function toggleCtaSummaryPanel() {
113
+ const panel = document.getElementById('cta-summary-panel');
114
+ const main = document.getElementById('main-panel');
115
+ const wrapper = document.getElementById('scrollable-wrapper');
116
+
117
+ const isVisible = panel.classList.contains('visible');
118
+ panel.classList.toggle('visible');
119
+ main.classList.toggle('shrunk');
120
+
121
+ // Ensure smooth scroll into view when opened
122
+ if (!isVisible) {
123
+ setTimeout(() => {
124
+ wrapper.scrollLeft = wrapper.scrollWidth;
125
+ }, 200); // wait for transition
126
+ }
127
+ }
128
+ function hideOrShowData(reportTable, rowClass, show) {
129
+ const rows = Array.from(reportTable.querySelectorAll(`.${rowClass}`));
130
+ rows.forEach((row) => {
131
+ row.style.display = show ? '' : 'none';
132
+ });
133
+ }
134
+
135
+ document.addEventListener('DOMContentLoaded', () => {
136
+ document.querySelectorAll('.collapsible-content').forEach((collapsibleContent) => {
137
+ collapsibleContent.style.display = 'none';
138
+ });
139
+
140
+ var coll = document.getElementsByClassName('collapsible');
141
+ var i;
142
+
143
+ for (i = 0; i < coll.length; i++) {
144
+ coll[i].addEventListener('click', function () {
145
+ this.classList.toggle('active');
146
+ var content = this.nextElementSibling;
147
+ if (content.style.display === 'block') {
148
+ content.style.display = 'none';
149
+ } else {
150
+ content.style.display = 'block';
151
+ }
152
+ });
153
+ }
154
+
155
+ document.querySelectorAll('.rpt-table-container').forEach((tableContainer) => {
156
+ filterAndSearchTable(tableContainer.id);
157
+ });
158
+ });
159
+
160
+ function openReport(ele) {
161
+ const file = ele.dataset.summary;
162
+ window.open(file, '_blank');
163
+ }
164
+
165
+ function toggleCtaPanel() {
166
+ const panel = document.getElementById('ctaPanel');
167
+ const overlay = document.getElementById('overlay');
168
+
169
+ if (panel.classList.contains('open')) {
170
+ closeCtaPanel();
171
+ } else {
172
+ panel.classList.add('open');
173
+ overlay.classList.add('open');
174
+ }
175
+ }
176
+
177
+ function closeCtaPanel() {
178
+ const panel = document.getElementById('ctaPanel');
179
+ const overlay = document.getElementById('overlay');
180
+
181
+ panel.classList.remove('open');
182
+ overlay.classList.remove('open');
183
+ }
184
+
185
+ // Close panel on escape key
186
+ document.addEventListener('keydown', function (event) {
187
+ if (event.key === 'Escape') {
188
+ closeCtaPanel();
189
+ }
190
+ });
191
+
192
+ // Expose globally so HTML inline event handlers can access them
193
+ window.toggleFilterDropdown = toggleFilterDropdown;
194
+ window.filterAndSearchTable = filterAndSearchTable;
195
+ window.toggleCtaSummaryPanel = toggleCtaSummaryPanel;
@@ -0,0 +1,86 @@
1
+ .dashboard-root {
2
+ background: #fafafa;
3
+ min-height: 100vh;
4
+ padding: 32px;
5
+ }
6
+
7
+ .dashboard-warning {
8
+ background: #fdebc8;
9
+ padding: 12px;
10
+ border-radius: 6px;
11
+ margin: 16px 0;
12
+ }
13
+
14
+ .dashboard-orginfo {
15
+ display: flex;
16
+ gap: 32px;
17
+ background: #fff;
18
+ padding: 24px;
19
+ border-radius: 8px;
20
+ margin-bottom: 32px;
21
+ }
22
+
23
+ .dashboard-modules {
24
+ display: flex;
25
+ flex-wrap: wrap;
26
+ gap: 24px;
27
+ }
28
+
29
+ .dashboard-module-card {
30
+ background: #fff;
31
+ border-radius: 8px;
32
+ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
33
+ flex: 1 1 320px;
34
+ min-width: 320px;
35
+ padding: 24px;
36
+ display: flex;
37
+ flex-direction: column;
38
+ justify-content: space-between;
39
+ }
40
+
41
+ .dashboard-module-title {
42
+ font-weight: 600;
43
+ font-size: 18px;
44
+ }
45
+
46
+ .dashboard-module-total {
47
+ font-size: 24px;
48
+ font-weight: 700;
49
+ margin-bottom: 16px;
50
+ }
51
+
52
+ .dashboard-module-row {
53
+ color: #888;
54
+ margin-bottom: 8px;
55
+ display: flex;
56
+ justify-content: space-between;
57
+ }
58
+
59
+ .dashboard-module-warn {
60
+ color: #d32f2f;
61
+ }
62
+
63
+ .dashboard-module-neutral {
64
+ color: #888;
65
+ }
66
+
67
+ .dashboard-module-success {
68
+ color: #388e3c;
69
+ }
70
+
71
+ .dashboard-module-btn {
72
+ margin-top: 16px;
73
+ padding: 8px 0;
74
+ border: 1px solid #1976d2;
75
+ border-radius: 4px;
76
+ background: #fff;
77
+ color: #1976d2;
78
+ cursor: pointer;
79
+ font-weight: 500;
80
+ transition: background 0.2s, color 0.2s;
81
+ }
82
+
83
+ .dashboard-module-btn:hover {
84
+ background: #1976d2;
85
+ color: #fff;
86
+ }