@tap-payments/os-micro-frontend-shared 0.1.371 → 0.1.372-test.2-test.3

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 (94) hide show
  1. package/build/components/AnimatedSpinnerIcon/style.d.ts +0 -1
  2. package/build/components/Chip/style.d.ts +0 -1
  3. package/build/components/CountBadge/style.d.ts +0 -1
  4. package/build/components/Dialog/style.d.ts +0 -1
  5. package/build/components/FlippingCard/style.d.ts +0 -1
  6. package/build/components/ImageWrapper/ImageWrapper.d.ts +0 -1
  7. package/build/components/JSONViewer/style.d.ts +0 -1
  8. package/build/components/LeftPeekRightExpandingChip/style.d.ts +0 -1
  9. package/build/components/RightLeftExpandingCenterChip/style.d.ts +0 -1
  10. package/build/components/Sandbox/style.js +3 -2
  11. package/build/components/SearchButton/styles.d.ts +0 -1
  12. package/build/components/StatusIcons/AuthIcons/style.d.ts +0 -1
  13. package/build/components/StatusIcons/AuthorizationAutoIcons/style.d.ts +0 -1
  14. package/build/components/StatusIcons/ChargeStatusIcon/style.d.ts +0 -1
  15. package/build/components/StatusIcons/SourceIcons/style.d.ts +0 -1
  16. package/build/components/TableCells/CustomCells/ActionCell/style.d.ts +0 -1
  17. package/build/components/TableCells/CustomCells/AgreementCell/style.d.ts +0 -1
  18. package/build/components/TableCells/CustomCells/ApplicationStatusCell/style.d.ts +0 -1
  19. package/build/components/TableCells/CustomCells/AuthenticationCell/style.d.ts +0 -1
  20. package/build/components/TableCells/CustomCells/AuthenticationStatusCell/style.d.ts +0 -1
  21. package/build/components/TableCells/CustomCells/AuthenticationTypeCell/style.d.ts +0 -1
  22. package/build/components/TableCells/CustomCells/BalanceCell/style.d.ts +0 -1
  23. package/build/components/TableCells/CustomCells/ChannelsCell/style.d.ts +0 -1
  24. package/build/components/TableCells/CustomCells/CheckoutStatusCell/style.d.ts +0 -1
  25. package/build/components/TableCells/CustomCells/DestinationStatusCell/style.d.ts +0 -1
  26. package/build/components/TableCells/CustomCells/DueDateCell/style.d.ts +0 -1
  27. package/build/components/TableCells/CustomCells/IDButton/style.d.ts +0 -1
  28. package/build/components/TableCells/CustomCells/IntentsStatusCell/style.d.ts +0 -1
  29. package/build/components/TableCells/CustomCells/InvoiceStatusCell/style.d.ts +0 -1
  30. package/build/components/TableCells/CustomCells/PayoutReportCell/style.d.ts +0 -1
  31. package/build/components/TableCells/CustomCells/PayoutStatusCell/style.d.ts +0 -1
  32. package/build/components/TableCells/CustomCells/ProductsCell/style.d.ts +0 -1
  33. package/build/components/TableCells/CustomCells/ReferenceCell/style.d.ts +0 -1
  34. package/build/components/TableCells/CustomCells/RefundChargeCell/style.d.ts +0 -1
  35. package/build/components/TableCells/CustomCells/RefundStatusCell/style.d.ts +0 -1
  36. package/build/components/TableCells/CustomCells/SalesChannelCell/style.d.ts +0 -1
  37. package/build/components/TableCells/CustomCells/SegmentsCell/style.d.ts +0 -1
  38. package/build/components/TableCells/CustomCells/StatusCell/style.d.ts +0 -1
  39. package/build/components/TableCells/CustomCells/TokenStatusCell/style.d.ts +0 -1
  40. package/build/components/TableCells/CustomCells/style.d.ts +0 -1
  41. package/build/components/TableHeader/FiltersRow.d.ts +1 -1
  42. package/build/components/TableHeader/FiltersRow.js +4 -2
  43. package/build/components/TableHeader/TableHeader.d.ts +1 -1
  44. package/build/components/TableHeader/TableHeader.js +2 -2
  45. package/build/components/TableHeader/TableView/CreateViewDialog.d.ts +3 -0
  46. package/build/components/TableHeader/TableView/CreateViewDialog.js +58 -0
  47. package/build/components/TableHeader/TableView/CustomViews.js +1 -1
  48. package/build/components/TableHeader/TableView/TableView.js +0 -1
  49. package/build/components/TableHeader/TableView/ViewSelector.d.ts +5 -0
  50. package/build/components/TableHeader/TableView/ViewSelector.js +46 -0
  51. package/build/components/TableHeader/TableView/ViewsDropdown.d.ts +5 -0
  52. package/build/components/TableHeader/TableView/ViewsDropdown.js +182 -0
  53. package/build/components/TableHeader/TableView/components/ColumnList.d.ts +3 -0
  54. package/build/components/TableHeader/TableView/components/ColumnList.js +54 -0
  55. package/build/components/TableHeader/TableView/components/ViewsSubmenu.d.ts +3 -0
  56. package/build/components/TableHeader/TableView/components/ViewsSubmenu.js +45 -0
  57. package/build/components/TableHeader/TableView/components/index.d.ts +2 -0
  58. package/build/components/TableHeader/TableView/components/index.js +2 -0
  59. package/build/components/TableHeader/TableView/constants.d.ts +10 -0
  60. package/build/components/TableHeader/TableView/constants.js +10 -0
  61. package/build/components/TableHeader/TableView/data.d.ts +5 -0
  62. package/build/components/TableHeader/TableView/data.js +48 -0
  63. package/build/components/TableHeader/TableView/hooks/index.d.ts +6 -0
  64. package/build/components/TableHeader/TableView/hooks/index.js +6 -0
  65. package/build/components/TableHeader/TableView/hooks/useCreateViewDialog.d.ts +22 -0
  66. package/build/components/TableHeader/TableView/hooks/useCreateViewDialog.js +76 -0
  67. package/build/components/TableHeader/TableView/hooks/useDialogPosition.d.ts +8 -0
  68. package/build/components/TableHeader/TableView/hooks/useDialogPosition.js +16 -0
  69. package/build/components/TableHeader/TableView/hooks/useNestedSubmenu.d.ts +7 -0
  70. package/build/components/TableHeader/TableView/hooks/useNestedSubmenu.js +34 -0
  71. package/build/components/TableHeader/TableView/hooks/useOriginalColumns.d.ts +6 -0
  72. package/build/components/TableHeader/TableView/hooks/useOriginalColumns.js +18 -0
  73. package/build/components/TableHeader/TableView/hooks/useSubmenuHover.d.ts +8 -0
  74. package/build/components/TableHeader/TableView/hooks/useSubmenuHover.js +43 -0
  75. package/build/components/TableHeader/TableView/hooks/useViewSelector.d.ts +54 -0
  76. package/build/components/TableHeader/TableView/hooks/useViewSelector.js +110 -0
  77. package/build/components/TableHeader/TableView/hooks/useViewsManager.d.ts +11 -0
  78. package/build/components/TableHeader/TableView/hooks/useViewsManager.js +87 -0
  79. package/build/components/TableHeader/TableView/index.d.ts +12 -3
  80. package/build/components/TableHeader/TableView/index.js +11 -3
  81. package/build/components/TableHeader/TableView/styles.d.ts +127 -0
  82. package/build/components/TableHeader/TableView/styles.js +417 -0
  83. package/build/components/TableHeader/TableView/types.d.ts +175 -0
  84. package/build/components/TableHeader/TableView/types.js +1 -0
  85. package/build/components/TableHeader/TableView/utils.d.ts +115 -0
  86. package/build/components/TableHeader/TableView/utils.js +410 -0
  87. package/build/components/TableHeader/type.d.ts +20 -0
  88. package/build/components/TableReports/components/DownloadButton/style.d.ts +0 -1
  89. package/build/components/TableReports/style.d.ts +0 -1
  90. package/build/components/Toolbar/Toolbar.js +1 -1
  91. package/build/components/VirtualTables/components/style.d.ts +0 -1
  92. package/build/constants/assets.d.ts +1 -0
  93. package/build/constants/assets.js +1 -0
  94. package/package.json +3 -3
@@ -0,0 +1,410 @@
1
+ import { advancedColumns, sheetColumns } from './data';
2
+ /**
3
+ * Transform API layout response to internal ColumnViewProps format
4
+ */
5
+ export const transformLayoutToColumns = (layout, lang = 'en') => {
6
+ const columns = [];
7
+ layout.forEach((section) => {
8
+ section.columns.forEach((col) => {
9
+ var _a, _b, _c, _d;
10
+ const label = ((_a = col.name.find((n) => n.lang === lang)) === null || _a === void 0 ? void 0 : _a.text) || ((_b = col.name[0]) === null || _b === void 0 ? void 0 : _b.text) || col.code;
11
+ const menuItems = ((_c = col.fields) === null || _c === void 0 ? void 0 : _c.length)
12
+ ? col.fields.map((field) => {
13
+ var _a, _b;
14
+ return ({
15
+ name: field.code,
16
+ label: ((_a = field.name.find((n) => n.lang === lang || n.lang === '')) === null || _a === void 0 ? void 0 : _a.text) || field.code,
17
+ selected: (_b = field.default) !== null && _b !== void 0 ? _b : false,
18
+ });
19
+ })
20
+ : undefined;
21
+ columns.push({
22
+ name: col.code,
23
+ label,
24
+ selected: (_d = col.default) !== null && _d !== void 0 ? _d : false,
25
+ menuItems: (menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) ? menuItems : undefined,
26
+ });
27
+ });
28
+ });
29
+ return columns;
30
+ };
31
+ export const getColumnsByMode = (mode, layoutData) => {
32
+ if (layoutData && layoutData.length > 0) {
33
+ const section = layoutData.find((s) => s.code.toLowerCase() === mode.toLowerCase());
34
+ if (section) {
35
+ return transformLayoutToColumns([section]);
36
+ }
37
+ }
38
+ return mode === 'advanced' ? [...advancedColumns] : [...sheetColumns];
39
+ };
40
+ export const isDateColumn = (name) => {
41
+ return name.toLowerCase() === 'date';
42
+ };
43
+ export const getColumnCheckState = (column) => {
44
+ var _a, _b;
45
+ if (!((_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.length)) {
46
+ return { checked: (_b = column.selected) !== null && _b !== void 0 ? _b : false, indeterminate: false };
47
+ }
48
+ const selectedCount = column.menuItems.filter((item) => item.selected).length;
49
+ return {
50
+ checked: selectedCount > 0,
51
+ indeterminate: selectedCount > 0 && selectedCount < column.menuItems.length,
52
+ };
53
+ };
54
+ export const createCustomViewMenuItem = (name, selectedColumns, isDefault = false) => ({
55
+ label: name,
56
+ id: `custom_${Date.now()}`,
57
+ columns: selectedColumns.map((col) => col.name),
58
+ submenu: selectedColumns,
59
+ isCustom: true,
60
+ default: isDefault,
61
+ });
62
+ /**
63
+ * Extract layout data from templates (combine all sections from all templates)
64
+ * This is used for the built-in "Default" view's layoutData prop
65
+ */
66
+ export const getLayoutDataFromTemplates = (templates) => {
67
+ const sectionsMap = new Map();
68
+ templates.forEach((template) => {
69
+ template.layout.forEach((section) => {
70
+ const existingSection = sectionsMap.get(section.code);
71
+ if (existingSection) {
72
+ // Merge columns, avoiding duplicates
73
+ const existingCodes = new Set(existingSection.columns.map((col) => col.code));
74
+ section.columns.forEach((col) => {
75
+ if (!existingCodes.has(col.code)) {
76
+ existingSection.columns.push(col);
77
+ }
78
+ });
79
+ }
80
+ else {
81
+ sectionsMap.set(section.code, Object.assign(Object.assign({}, section), { columns: [...section.columns] }));
82
+ }
83
+ });
84
+ });
85
+ return Array.from(sectionsMap.values());
86
+ };
87
+ /**
88
+ * Set a view as default and ensure only one view is default at a time
89
+ */
90
+ export const setViewAsDefault = (views, viewId) => {
91
+ return views.map((view) => (Object.assign(Object.assign({}, view), { default: view.id === viewId })));
92
+ };
93
+ /**
94
+ * Transform API templates response to ViewMenuItem array
95
+ * Filters templates by mode and only shows the section matching the current mode
96
+ * Separates default templates (to be merged into built-in Default view) from custom views
97
+ */
98
+ export const transformTemplatesToViewMenuItems = (templates, mode = 'sheet', lang = 'en') => {
99
+ const customViews = [];
100
+ let defaultTemplateColumns;
101
+ templates.forEach((template) => {
102
+ // Get columns for the specified mode
103
+ const section = template.layout.find((s) => s.code.toLowerCase() === mode.toLowerCase());
104
+ const columns = section ? transformLayoutToColumns([section], lang) : [];
105
+ if (template.default) {
106
+ // Store default template columns to merge into built-in Default view
107
+ defaultTemplateColumns = columns;
108
+ }
109
+ else {
110
+ // Add non-default templates as custom views
111
+ customViews.push({
112
+ id: template.id,
113
+ label: template.name,
114
+ isCustom: true,
115
+ default: false,
116
+ columns: columns.map((col) => col.name),
117
+ submenu: columns,
118
+ });
119
+ }
120
+ });
121
+ return { customViews, defaultTemplateColumns };
122
+ };
123
+ /**
124
+ * Convert ColumnViewProps back to LayoutSection format for API requests
125
+ */
126
+ export const convertColumnsToLayoutSection = (columns, mode, lang = 'en') => {
127
+ const columnItems = columns.map((col, index) => {
128
+ var _a, _b;
129
+ const fieldItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((field) => {
130
+ var _a;
131
+ return ({
132
+ code: field.name,
133
+ name: [
134
+ {
135
+ text: typeof field.label === 'string' ? field.label : field.name,
136
+ lang: lang || '',
137
+ },
138
+ ],
139
+ default: (_a = field.selected) !== null && _a !== void 0 ? _a : false,
140
+ });
141
+ });
142
+ const columnLabel = typeof col.label === 'string' ? col.label : col.name;
143
+ return Object.assign({ code: col.name, name: [
144
+ {
145
+ text: columnLabel,
146
+ lang,
147
+ },
148
+ ], order: index + 1, default: (_b = col.selected) !== null && _b !== void 0 ? _b : false }, (fieldItems && fieldItems.length > 0 && { fields: fieldItems }));
149
+ });
150
+ return {
151
+ code: mode === 'advanced' ? 'Advanced' : 'Sheet',
152
+ columns: columnItems,
153
+ };
154
+ };
155
+ /**
156
+ * Initialize columns for editing mode
157
+ */
158
+ export const initializeEditingColumns = (editingColumns, availableColumns) => {
159
+ return availableColumns
160
+ .filter((col) => !isDateColumn(col.name))
161
+ .map((col) => {
162
+ var _a;
163
+ const savedCol = editingColumns.find((ec) => ec.name === col.name);
164
+ return (savedCol || Object.assign(Object.assign({}, col), { selected: false, menuItems: (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: false }))) }));
165
+ });
166
+ };
167
+ /**
168
+ * Initialize columns for create mode (all unchecked except date)
169
+ */
170
+ export const initializeCreateColumns = (availableColumns) => {
171
+ return availableColumns
172
+ .filter((col) => !isDateColumn(col.name))
173
+ .map((col) => {
174
+ var _a;
175
+ return (Object.assign(Object.assign({}, col), { selected: false, menuItems: (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: false }))) }));
176
+ });
177
+ };
178
+ /**
179
+ * Initialize columns for create mode with current tableViews state (preserves checked/unchecked values)
180
+ */
181
+ export const initializeCreateColumnsWithCurrentState = (availableColumns, currentTableViews) => {
182
+ return availableColumns
183
+ .filter((col) => !isDateColumn(col.name))
184
+ .map((col) => {
185
+ var _a, _b, _c;
186
+ const currentCol = currentTableViews.find((tc) => tc.name === col.name);
187
+ if (currentCol) {
188
+ return Object.assign(Object.assign({}, col), { selected: (_a = currentCol.selected) !== null && _a !== void 0 ? _a : false, menuItems: (_b = col.menuItems) === null || _b === void 0 ? void 0 : _b.map((item) => {
189
+ var _a, _b;
190
+ const currentMenuItem = (_a = currentCol.menuItems) === null || _a === void 0 ? void 0 : _a.find((mi) => mi.name === item.name);
191
+ return Object.assign(Object.assign({}, item), { selected: (_b = currentMenuItem === null || currentMenuItem === void 0 ? void 0 : currentMenuItem.selected) !== null && _b !== void 0 ? _b : false });
192
+ }) });
193
+ }
194
+ return Object.assign(Object.assign({}, col), { selected: false, menuItems: (_c = col.menuItems) === null || _c === void 0 ? void 0 : _c.map((item) => (Object.assign(Object.assign({}, item), { selected: false }))) });
195
+ });
196
+ };
197
+ /**
198
+ * Reset columns to their default selection state
199
+ */
200
+ export const resetColumnsToDefault = (columns) => {
201
+ return columns
202
+ .filter((col) => !isDateColumn(col.name))
203
+ .map((col) => {
204
+ var _a, _b;
205
+ return (Object.assign(Object.assign({}, col), { selected: (_a = col.selected) !== null && _a !== void 0 ? _a : false, menuItems: (_b = col.menuItems) === null || _b === void 0 ? void 0 : _b.map((item) => { var _a; return (Object.assign(Object.assign({}, item), { selected: (_a = item.selected) !== null && _a !== void 0 ? _a : false })); }) }));
206
+ });
207
+ };
208
+ /**
209
+ * Toggle a column's selection (including all children if present)
210
+ */
211
+ export const toggleColumn = (columns, columnName) => {
212
+ return columns.map((col) => {
213
+ var _a;
214
+ if (col.name !== columnName)
215
+ return col;
216
+ const newSelected = !col.selected;
217
+ const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: newSelected })));
218
+ return Object.assign(Object.assign({}, col), { selected: newSelected, menuItems: updatedMenuItems });
219
+ });
220
+ };
221
+ /**
222
+ * Toggle a sub-item's selection and update parent state
223
+ */
224
+ export const toggleSubItem = (columns, columnName, subItemName) => {
225
+ return columns.map((col) => {
226
+ var _a, _b;
227
+ if (col.name !== columnName)
228
+ return col;
229
+ const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (item.name === subItemName ? Object.assign(Object.assign({}, item), { selected: !item.selected }) : item));
230
+ const hasSelectedChildren = (_b = updatedMenuItems === null || updatedMenuItems === void 0 ? void 0 : updatedMenuItems.some((item) => item.selected)) !== null && _b !== void 0 ? _b : false;
231
+ return Object.assign(Object.assign({}, col), { menuItems: updatedMenuItems, selected: hasSelectedChildren });
232
+ });
233
+ };
234
+ /**
235
+ * Select or deselect all columns (except date)
236
+ */
237
+ export const toggleAllColumns = (columns, selectAll) => {
238
+ return columns.map((col) => {
239
+ var _a;
240
+ if (isDateColumn(col.name))
241
+ return col;
242
+ const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: selectAll })));
243
+ return Object.assign(Object.assign({}, col), { selected: selectAll, menuItems: updatedMenuItems });
244
+ });
245
+ };
246
+ /**
247
+ * Check if all non-date columns are selected
248
+ */
249
+ export const areAllColumnsSelected = (columns) => {
250
+ const nonDateColumns = columns.filter((col) => !isDateColumn(col.name));
251
+ return (nonDateColumns.length > 0 &&
252
+ nonDateColumns.every((col) => {
253
+ var _a;
254
+ if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
255
+ // For columns with menuItems, all items must be selected
256
+ return col.menuItems.every((item) => item.selected);
257
+ }
258
+ return col.selected;
259
+ }));
260
+ };
261
+ /**
262
+ * Check if some (but not all) non-date columns are selected
263
+ */
264
+ export const areSomeColumnsSelected = (columns, allSelected) => {
265
+ const nonDateColumns = columns.filter((col) => !isDateColumn(col.name));
266
+ const hasAnySelected = nonDateColumns.some((col) => {
267
+ var _a;
268
+ if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
269
+ return col.menuItems.some((item) => item.selected);
270
+ }
271
+ return col.selected;
272
+ });
273
+ return hasAnySelected && !allSelected;
274
+ };
275
+ /**
276
+ * Validate template name
277
+ */
278
+ export const isValidTemplateName = (name, maxLength) => {
279
+ return name.trim().length > 0 && name.length <= maxLength;
280
+ };
281
+ /**
282
+ * Deep clone columns array with all nested properties
283
+ */
284
+ export const deepCloneColumns = (columns) => {
285
+ return columns.map((col) => {
286
+ var _a, _b;
287
+ return (Object.assign(Object.assign({}, col), { selected: (_a = col.selected) !== null && _a !== void 0 ? _a : false, menuItems: (_b = col.menuItems) === null || _b === void 0 ? void 0 : _b.map((item) => {
288
+ var _a;
289
+ return (Object.assign(Object.assign({}, item), { selected: (_a = item.selected) !== null && _a !== void 0 ? _a : false }));
290
+ }) }));
291
+ });
292
+ };
293
+ /**
294
+ * Toggle a single column's selection state
295
+ */
296
+ export const toggleSingleColumn = (columns, columnName) => {
297
+ return columns.map((col) => {
298
+ var _a;
299
+ if (col.name !== columnName)
300
+ return col;
301
+ const newSelected = !col.selected;
302
+ const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: newSelected })));
303
+ return Object.assign(Object.assign({}, col), { selected: newSelected, menuItems: updatedMenuItems });
304
+ });
305
+ };
306
+ /**
307
+ * Get submenu items for a view menu item
308
+ */
309
+ export const getSubmenuItems = (item, defaultColumns) => {
310
+ var _a;
311
+ if (item.isCustom && ((_a = item.submenu) === null || _a === void 0 ? void 0 : _a.length)) {
312
+ return item.submenu;
313
+ }
314
+ if (item.id === 'default') {
315
+ return defaultColumns;
316
+ }
317
+ return item.submenu || [];
318
+ };
319
+ /**
320
+ * Check if a view menu item has submenu
321
+ */
322
+ export const hasSubmenu = (item, defaultColumns) => {
323
+ return getSubmenuItems(item, defaultColumns).length > 0;
324
+ };
325
+ /**
326
+ * Check if all columns in current state are selected
327
+ */
328
+ export const areAllCurrentColumnsSelected = (columns) => {
329
+ if (columns.length === 0)
330
+ return false;
331
+ return columns.every((col) => {
332
+ var _a;
333
+ if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
334
+ // For columns with menuItems, all items must be selected
335
+ return col.menuItems.every((item) => item.selected);
336
+ }
337
+ return col.selected;
338
+ });
339
+ };
340
+ /**
341
+ * Check if some (but not all) columns in current state are selected
342
+ */
343
+ export const areSomeCurrentColumnsSelected = (columns, allSelected) => {
344
+ if (columns.length === 0)
345
+ return false;
346
+ const hasAny = columns.some((col) => {
347
+ var _a;
348
+ if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
349
+ return col.menuItems.some((item) => item.selected);
350
+ }
351
+ return col.selected;
352
+ });
353
+ return hasAny && !allSelected;
354
+ };
355
+ /**
356
+ * Toggle all columns selection (select all or unselect all)
357
+ */
358
+ export const toggleAllCurrentColumns = (columns, shouldSelect) => {
359
+ return columns.map((col) => {
360
+ var _a;
361
+ const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: shouldSelect })));
362
+ return Object.assign(Object.assign({}, col), { selected: shouldSelect, menuItems: updatedMenuItems });
363
+ });
364
+ };
365
+ /**
366
+ * Normalize columns by converting undefined selected values to false for consistent comparison
367
+ */
368
+ export const normalizeColumnsSelected = (columns) => {
369
+ return columns.map((col) => {
370
+ var _a, _b;
371
+ return (Object.assign(Object.assign({}, col), { selected: (_a = col.selected) !== null && _a !== void 0 ? _a : false, menuItems: (_b = col.menuItems) === null || _b === void 0 ? void 0 : _b.map((item) => {
372
+ var _a;
373
+ return (Object.assign(Object.assign({}, item), { selected: (_a = item.selected) !== null && _a !== void 0 ? _a : false }));
374
+ }) }));
375
+ });
376
+ };
377
+ /**
378
+ * Compare two columns arrays to check if they are equal (same order, same selection states)
379
+ */
380
+ export const areColumnsEqual = (cols1, cols2) => {
381
+ if (cols1.length !== cols2.length)
382
+ return false;
383
+ const normalizedCols1 = normalizeColumnsSelected(cols1);
384
+ const normalizedCols2 = normalizeColumnsSelected(cols2);
385
+ for (let i = 0; i < normalizedCols1.length; i++) {
386
+ const col1 = normalizedCols1[i];
387
+ const col2 = normalizedCols2[i];
388
+ if (col1.name !== col2.name)
389
+ return false;
390
+ if (col1.selected !== col2.selected)
391
+ return false;
392
+ if (col1.menuItems && col2.menuItems) {
393
+ if (col1.menuItems.length !== col2.menuItems.length)
394
+ return false;
395
+ for (let j = 0; j < col1.menuItems.length; j++) {
396
+ const item1 = col1.menuItems[j];
397
+ const item2 = col2.menuItems[j];
398
+ if (item1.name !== item2.name)
399
+ return false;
400
+ if (item1.selected !== item2.selected) {
401
+ return false;
402
+ }
403
+ }
404
+ }
405
+ else if (col1.menuItems || col2.menuItems) {
406
+ return false;
407
+ }
408
+ }
409
+ return true;
410
+ };
@@ -2,6 +2,7 @@ import React, { ReactNode } from 'react';
2
2
  import type { CalenderMode, TableHeaderStatus, ColumnViewProps, TableMode, Timezone, SegmentCountry } from '../../types/index.js';
3
3
  import { AvailableStatus } from '../StatusBar/type';
4
4
  import { PartialExcept } from '../../types/index.js';
5
+ import type { ViewMenuItem, LayoutSection } from './TableView/types';
5
6
  type ViewsOptions = {
6
7
  default: {};
7
8
  developer: {};
@@ -44,6 +45,25 @@ export interface TableHeaderProps<IStatus extends TableHeaderStatus | TableHeade
44
45
  id: string;
45
46
  label: string;
46
47
  }) => void;
48
+ customViews?: ViewMenuItem[];
49
+ onCreateCustomView?: (data: {
50
+ name: string;
51
+ selectedColumns: ColumnViewProps[];
52
+ layout: LayoutSection;
53
+ }) => Promise<void>;
54
+ onEditCustomView?: (viewId: string, data: {
55
+ name: string;
56
+ selectedColumns: ColumnViewProps[];
57
+ layout: LayoutSection;
58
+ }) => Promise<void>;
59
+ onDeleteCustomView?: (viewId: string) => Promise<void>;
60
+ onTableViewsChange?: (tableViews: ColumnViewProps[]) => void;
61
+ initialTableViews?: ColumnViewProps[];
62
+ onCustomViewsChange?: (customViews: ViewMenuItem[]) => void;
63
+ initialCustomViews?: ViewMenuItem[];
64
+ layoutData?: import('./TableView/types').LayoutSection[];
65
+ templates?: import('./TableView/types').TemplatesListResponse | import('./TableView/types').TemplateResponse[];
66
+ lang?: string;
47
67
  onToggleTextButtonClick?: () => void;
48
68
  children?: ReactNode;
49
69
  calendarGroupBy?: string;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  export declare const Button: import("@emotion/styled").StyledComponent<{
4
3
  hidden?: boolean | undefined;
5
4
  color?: string | undefined;
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  type ExportButtonProps = {
4
3
  notificationState?: {
5
4
  success: boolean;
@@ -15,6 +15,6 @@ import { ToolbarStyled, StyledBox, ActionsBox } from './style';
15
15
  import WindowAppIcon from '../WindowAppIcon';
16
16
  function Toolbar(_a) {
17
17
  var { onMouseEnter, onMouseLeave, isMaximized, isHovered, children, rightActions, leftActions, title, icon } = _a, props = __rest(_a, ["onMouseEnter", "onMouseLeave", "isMaximized", "isHovered", "children", "rightActions", "leftActions", "title", "icon"]);
18
- return (_jsx(ToolbarStyled, Object.assign({ onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, maximized: isMaximized, id: "toolbar", isHovered: isHovered }, props, { children: _jsxs(StyledBox, Object.assign({ className: "toolbar-wrapper" }, { children: [leftActions ? _jsx(ActionsBox, Object.assign({ className: "action-box" }, { children: leftActions })) : _jsx("div", {}), _jsx(WindowAppIcon, { title: title, icon: icon }), rightActions ? _jsx(ActionsBox, Object.assign({ className: "action-box" }, { children: rightActions })) : _jsx("div", {})] })) })));
18
+ return (_jsx(ToolbarStyled, Object.assign({ onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, maximized: isMaximized, id: "toolbar", isHovered: isHovered }, props, { children: _jsxs(StyledBox, Object.assign({ className: "toolbar-wrapper" }, { children: [leftActions ? _jsx(ActionsBox, Object.assign({ className: "action-box" }, { children: leftActions })) : _jsx("div", {}), _jsx(WindowAppIcon, { title: title, icon: icon }), rightActions ? (_jsx(ActionsBox, Object.assign({ sx: { justifyContent: 'flex-end' }, className: "action-box" }, { children: rightActions }))) : (_jsx("div", {}))] })) })));
19
19
  }
20
20
  export default memo(Toolbar);
@@ -1,5 +1,4 @@
1
1
  /// <reference types="react" />
2
- /// <reference types="react" />
3
2
  interface TableWrapperProps {
4
3
  showNoDataView?: boolean;
5
4
  }
@@ -338,6 +338,7 @@ export declare const TAP3DSPROVIDERIcon: string;
338
338
  export declare const greyPlusIcon: string;
339
339
  export declare const greyMinusIcon: string;
340
340
  export declare const noPreviewIcon: string;
341
+ export declare const editIcon: string;
341
342
  export declare const viewInvoiceIcon: string;
342
343
  export declare const checkoutStatusIcon: string;
343
344
  export declare const checkoutStatusBlueIcon: string;
@@ -344,6 +344,7 @@ export const TAP3DSPROVIDERIcon = `${lightUrl}/provider/TAP3DS.svg`;
344
344
  export const greyPlusIcon = `${lightUrl}/greyPlusIcon.svg`;
345
345
  export const greyMinusIcon = `${lightUrl}/greyMinusIcon.svg`;
346
346
  export const noPreviewIcon = `${lightUrl}/noPreviewIcon.svg`;
347
+ export const editIcon = `${lightUrl}/other/editIcon.svg`;
347
348
  export const viewInvoiceIcon = `${appBaseUrl}/viewInvoice.svg`;
348
349
  export const checkoutStatusIcon = `${appBaseUrl}/checkoutStatus.svg`;
349
350
  export const checkoutStatusBlueIcon = `${appBaseUrl}/checkStatusOutBlue.svg`;
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tap-payments/os-micro-frontend-shared",
3
3
  "description": "Shared components and utilities for Tap Payments micro frontends",
4
- "version": "0.1.371",
5
- "testVersion": 0,
4
+ "version": "0.1.372-test.2-test.3",
5
+ "testVersion": 3,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",
@@ -164,4 +164,4 @@
164
164
  "publishConfig": {
165
165
  "registry": "https://registry.npmjs.org/"
166
166
  }
167
- }
167
+ }