@tap-payments/os-micro-frontend-shared 0.1.374-test.1 → 0.1.374-test.1-test.2-test.3-test.4

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 (71) hide show
  1. package/build/components/FilterDropdown/FilterDropdown.d.ts +4 -11
  2. package/build/components/FilterDropdown/FilterDropdown.js +4 -18
  3. package/build/components/FilterDropdown/style.js +1 -1
  4. package/build/components/RangeCalender/RangeCalender.js +2 -4
  5. package/build/components/Sandbox/style.js +3 -2
  6. package/build/components/TableHeader/FiltersRow.d.ts +1 -1
  7. package/build/components/TableHeader/FiltersRow.js +4 -2
  8. package/build/components/TableHeader/TableHeader.d.ts +1 -1
  9. package/build/components/TableHeader/TableHeader.js +2 -2
  10. package/build/components/TableHeader/TableView/CreateViewDialog.d.ts +3 -0
  11. package/build/components/TableHeader/TableView/CreateViewDialog.js +91 -0
  12. package/build/components/TableHeader/TableView/CustomViews.js +1 -1
  13. package/build/components/TableHeader/TableView/TableView.js +0 -1
  14. package/build/components/TableHeader/TableView/ViewSelector.d.ts +5 -0
  15. package/build/components/TableHeader/TableView/ViewSelector.js +88 -0
  16. package/build/components/TableHeader/TableView/ViewsDropdown.d.ts +5 -0
  17. package/build/components/TableHeader/TableView/ViewsDropdown.js +184 -0
  18. package/build/components/TableHeader/TableView/components/ColumnList.d.ts +3 -0
  19. package/build/components/TableHeader/TableView/components/ColumnList.js +70 -0
  20. package/build/components/TableHeader/TableView/components/ViewsSubmenu.d.ts +3 -0
  21. package/build/components/TableHeader/TableView/components/ViewsSubmenu.js +71 -0
  22. package/build/components/TableHeader/TableView/components/index.d.ts +2 -0
  23. package/build/components/TableHeader/TableView/components/index.js +2 -0
  24. package/build/components/TableHeader/TableView/constants.d.ts +10 -0
  25. package/build/components/TableHeader/TableView/constants.js +10 -0
  26. package/build/components/TableHeader/TableView/data.d.ts +5 -0
  27. package/build/components/TableHeader/TableView/data.js +48 -0
  28. package/build/components/TableHeader/TableView/hooks/index.d.ts +6 -0
  29. package/build/components/TableHeader/TableView/hooks/index.js +6 -0
  30. package/build/components/TableHeader/TableView/hooks/useCreateViewDialog.d.ts +22 -0
  31. package/build/components/TableHeader/TableView/hooks/useCreateViewDialog.js +88 -0
  32. package/build/components/TableHeader/TableView/hooks/useDialogPosition.d.ts +8 -0
  33. package/build/components/TableHeader/TableView/hooks/useDialogPosition.js +16 -0
  34. package/build/components/TableHeader/TableView/hooks/useNestedSubmenu.d.ts +7 -0
  35. package/build/components/TableHeader/TableView/hooks/useNestedSubmenu.js +34 -0
  36. package/build/components/TableHeader/TableView/hooks/useOriginalColumns.d.ts +6 -0
  37. package/build/components/TableHeader/TableView/hooks/useOriginalColumns.js +18 -0
  38. package/build/components/TableHeader/TableView/hooks/useSubmenuHover.d.ts +8 -0
  39. package/build/components/TableHeader/TableView/hooks/useSubmenuHover.js +43 -0
  40. package/build/components/TableHeader/TableView/hooks/useViewSelector.d.ts +60 -0
  41. package/build/components/TableHeader/TableView/hooks/useViewSelector.js +175 -0
  42. package/build/components/TableHeader/TableView/hooks/useViewsManager.d.ts +20 -0
  43. package/build/components/TableHeader/TableView/hooks/useViewsManager.js +89 -0
  44. package/build/components/TableHeader/TableView/index.d.ts +12 -3
  45. package/build/components/TableHeader/TableView/index.js +13 -3
  46. package/build/components/TableHeader/TableView/styles.d.ts +127 -0
  47. package/build/components/TableHeader/TableView/styles.js +426 -0
  48. package/build/components/TableHeader/TableView/types.d.ts +199 -0
  49. package/build/components/TableHeader/TableView/utils.d.ts +121 -0
  50. package/build/components/TableHeader/TableView/utils.js +463 -0
  51. package/build/components/TableHeader/type.d.ts +22 -1
  52. package/build/components/Toolbar/Toolbar.js +1 -1
  53. package/build/components/index.d.ts +0 -1
  54. package/build/components/index.js +0 -1
  55. package/build/constants/apps.js +0 -2
  56. package/build/constants/assets.d.ts +1 -2
  57. package/build/constants/assets.js +1 -2
  58. package/build/types/index.d.ts +0 -1
  59. package/build/types/index.js +0 -1
  60. package/build/types/reports.d.ts +0 -21
  61. package/build/utils/date.d.ts +0 -5
  62. package/build/utils/date.js +0 -37
  63. package/package.json +3 -2
  64. package/build/components/MultiDatakeyDonut/MultiDatakeyDonut.d.ts +0 -12
  65. package/build/components/MultiDatakeyDonut/MultiDatakeyDonut.js +0 -19
  66. package/build/components/MultiDatakeyDonut/index.d.ts +0 -1
  67. package/build/components/MultiDatakeyDonut/index.js +0 -1
  68. package/build/components/MultiDatakeyDonut/style.d.ts +0 -10
  69. package/build/components/MultiDatakeyDonut/style.js +0 -23
  70. package/build/types/toggleOptions.d.ts +0 -2
  71. /package/build/{types/toggleOptions.js → components/TableHeader/TableView/types.js} +0 -0
@@ -0,0 +1,121 @@
1
+ import type { ColumnViewProps, TableMode } from '../../../types/index.js';
2
+ import type { LayoutSection, ViewMenuItem, ColumnCheckState } from './types';
3
+ /**
4
+ * Transform API layout response to internal ColumnViewProps format
5
+ */
6
+ export declare const transformLayoutToColumns: (layout: LayoutSection[], lang?: string) => ColumnViewProps[];
7
+ export declare const getColumnsByMode: (mode: TableMode, layoutData?: LayoutSection[]) => ColumnViewProps[];
8
+ export declare const isDateColumn: (name: string) => boolean;
9
+ export declare const getColumnCheckState: (column: ColumnViewProps) => ColumnCheckState;
10
+ export declare const createCustomViewMenuItem: (name: string, selectedColumns: ColumnViewProps[], isDefault?: boolean) => ViewMenuItem;
11
+ /**
12
+ * Extract layout data from templates (combine all sections from all templates)
13
+ * This is used for the built-in "Default" view's layoutData prop
14
+ */
15
+ export declare const getLayoutDataFromTemplates: (templates: Array<{
16
+ layout: LayoutSection[];
17
+ }>) => LayoutSection[];
18
+ /**
19
+ * Set a view as default and ensure only one view is default at a time
20
+ */
21
+ export declare const setViewAsDefault: (views: ViewMenuItem[], viewId: string) => ViewMenuItem[];
22
+ /**
23
+ * Transform API templates response to ViewMenuItem array
24
+ * Filters templates by mode and only shows the section matching the current mode
25
+ * Separates default templates (to be merged into built-in Default view) from custom views
26
+ */
27
+ export declare const transformTemplatesToViewMenuItems: (templates: Array<{
28
+ id: string | {
29
+ timestamp: number;
30
+ date: string;
31
+ };
32
+ name: string;
33
+ default: boolean;
34
+ layout: LayoutSection[];
35
+ templateId: string;
36
+ }>, mode?: TableMode, lang?: string) => {
37
+ customViews: ViewMenuItem[];
38
+ defaultTemplateColumns?: ColumnViewProps[] | undefined;
39
+ defaultTemplate?: ViewMenuItem | undefined;
40
+ };
41
+ /**
42
+ * Convert ColumnViewProps back to LayoutSection format for API requests
43
+ */
44
+ export declare const convertColumnsToLayoutSection: (columns: ColumnViewProps[], mode: TableMode, lang?: string) => LayoutSection;
45
+ /**
46
+ * Initialize columns for editing mode
47
+ */
48
+ export declare const initializeEditingColumns: (editingColumns: ColumnViewProps[], availableColumns: ColumnViewProps[]) => ColumnViewProps[];
49
+ /**
50
+ * Initialize columns for create mode (all unchecked except date)
51
+ */
52
+ export declare const initializeCreateColumns: (availableColumns: ColumnViewProps[]) => ColumnViewProps[];
53
+ /**
54
+ * Initialize columns for create mode with current tableViews state (preserves checked/unchecked values)
55
+ */
56
+ export declare const initializeCreateColumnsWithCurrentState: (availableColumns: ColumnViewProps[], currentTableViews: ColumnViewProps[]) => ColumnViewProps[];
57
+ /**
58
+ * Reset columns to their default selection state
59
+ */
60
+ export declare const resetColumnsToDefault: (columns: ColumnViewProps[]) => ColumnViewProps[];
61
+ /**
62
+ * Toggle a column's selection (including all children if present)
63
+ */
64
+ export declare const toggleColumn: (columns: ColumnViewProps[], columnName: string) => ColumnViewProps[];
65
+ /**
66
+ * Toggle a sub-item's selection and update parent state
67
+ */
68
+ export declare const toggleSubItem: (columns: ColumnViewProps[], columnName: string, subItemName: string) => ColumnViewProps[];
69
+ /**
70
+ * Select or deselect all columns (except date)
71
+ */
72
+ export declare const toggleAllColumns: (columns: ColumnViewProps[], selectAll: boolean) => ColumnViewProps[];
73
+ /**
74
+ * Check if all non-date columns are selected
75
+ */
76
+ export declare const areAllColumnsSelected: (columns: ColumnViewProps[]) => boolean;
77
+ /**
78
+ * Check if some (but not all) non-date columns are selected
79
+ */
80
+ export declare const areSomeColumnsSelected: (columns: ColumnViewProps[], allSelected: boolean) => boolean;
81
+ /**
82
+ * Validate template name
83
+ */
84
+ export declare const isValidTemplateName: (name: string, maxLength: number) => boolean;
85
+ /**
86
+ * Deep clone columns array with all nested properties
87
+ */
88
+ export declare const deepCloneColumns: (columns: ColumnViewProps[]) => ColumnViewProps[];
89
+ /**
90
+ * Toggle a single column's selection state
91
+ */
92
+ export declare const toggleSingleColumn: (columns: ColumnViewProps[], columnName: string) => ColumnViewProps[];
93
+ /**
94
+ * Get submenu items for a view menu item
95
+ * Always includes the date column at the beginning
96
+ */
97
+ export declare const getSubmenuItems: (item: ViewMenuItem, defaultColumns: ColumnViewProps[]) => ColumnViewProps[];
98
+ /**
99
+ * Check if a view menu item has submenu
100
+ */
101
+ export declare const hasSubmenu: (item: ViewMenuItem, defaultColumns: ColumnViewProps[]) => boolean;
102
+ /**
103
+ * Check if all columns in current state are selected
104
+ */
105
+ export declare const areAllCurrentColumnsSelected: (columns: ColumnViewProps[]) => boolean;
106
+ /**
107
+ * Check if some (but not all) columns in current state are selected
108
+ */
109
+ export declare const areSomeCurrentColumnsSelected: (columns: ColumnViewProps[], allSelected: boolean) => boolean;
110
+ /**
111
+ * Toggle all columns selection (select all or unselect all)
112
+ */
113
+ export declare const toggleAllCurrentColumns: (columns: ColumnViewProps[], shouldSelect: boolean) => ColumnViewProps[];
114
+ /**
115
+ * Normalize columns by converting undefined selected values to false for consistent comparison
116
+ */
117
+ export declare const normalizeColumnsSelected: (columns: ColumnViewProps[]) => ColumnViewProps[];
118
+ /**
119
+ * Compare two columns arrays to check if they are equal (same order, same selection states)
120
+ */
121
+ export declare const areColumnsEqual: (cols1: ColumnViewProps[], cols2: ColumnViewProps[]) => boolean;
@@ -0,0 +1,463 @@
1
+ import { DATE_COLUMN_CONFIG } from './constants';
2
+ // Note: advancedColumns and sheetColumns are only used in demo - not imported here to avoid default data
3
+ /**
4
+ * Transform API layout response to internal ColumnViewProps format
5
+ */
6
+ export const transformLayoutToColumns = (layout, lang = 'en') => {
7
+ const columns = [];
8
+ layout.forEach((section) => {
9
+ section.columns.forEach((col) => {
10
+ var _a, _b, _c, _d;
11
+ 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;
12
+ const menuItems = ((_c = col.fields) === null || _c === void 0 ? void 0 : _c.length)
13
+ ? col.fields.map((field) => {
14
+ var _a, _b;
15
+ return ({
16
+ name: field.code,
17
+ label: ((_a = field.name.find((n) => n.lang === lang || n.lang === '')) === null || _a === void 0 ? void 0 : _a.text) || field.code,
18
+ selected: (_b = field.default) !== null && _b !== void 0 ? _b : false,
19
+ });
20
+ })
21
+ : undefined;
22
+ columns.push({
23
+ name: col.code,
24
+ label,
25
+ selected: (_d = col.default) !== null && _d !== void 0 ? _d : false,
26
+ menuItems: (menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) ? menuItems : undefined,
27
+ });
28
+ });
29
+ });
30
+ return columns;
31
+ };
32
+ export const getColumnsByMode = (mode, layoutData) => {
33
+ if (layoutData && layoutData.length > 0) {
34
+ // Map TableMode to layout section code: 'default' → 'Advanced', 'sheet' → 'Sheet'
35
+ const sectionCode = mode === 'sheet' ? 'sheet' : 'advanced';
36
+ const section = layoutData.find((s) => s.code.toLowerCase() === sectionCode);
37
+ if (section) {
38
+ return transformLayoutToColumns([section]);
39
+ }
40
+ }
41
+ // Return empty array - all data should come from API
42
+ return [];
43
+ };
44
+ export const isDateColumn = (name) => {
45
+ return name.toLowerCase() === 'date';
46
+ };
47
+ export const getColumnCheckState = (column) => {
48
+ var _a, _b;
49
+ if (!((_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.length)) {
50
+ return { checked: (_b = column.selected) !== null && _b !== void 0 ? _b : false, indeterminate: false };
51
+ }
52
+ const selectedCount = column.menuItems.filter((item) => item.selected).length;
53
+ return {
54
+ checked: selectedCount > 0,
55
+ indeterminate: selectedCount > 0 && selectedCount < column.menuItems.length,
56
+ };
57
+ };
58
+ export const createCustomViewMenuItem = (name, selectedColumns, isDefault = false) => ({
59
+ label: name,
60
+ id: `custom_${Date.now()}`,
61
+ columns: selectedColumns.map((col) => col.name),
62
+ submenu: selectedColumns,
63
+ isCustom: true,
64
+ default: isDefault,
65
+ });
66
+ /**
67
+ * Extract layout data from templates (combine all sections from all templates)
68
+ * This is used for the built-in "Default" view's layoutData prop
69
+ */
70
+ export const getLayoutDataFromTemplates = (templates) => {
71
+ const sectionsMap = new Map();
72
+ templates.forEach((template) => {
73
+ template.layout.forEach((section) => {
74
+ const existingSection = sectionsMap.get(section.code);
75
+ if (existingSection) {
76
+ // Merge columns, avoiding duplicates
77
+ const existingCodes = new Set(existingSection.columns.map((col) => col.code));
78
+ section.columns.forEach((col) => {
79
+ if (!existingCodes.has(col.code)) {
80
+ existingSection.columns.push(col);
81
+ }
82
+ });
83
+ }
84
+ else {
85
+ sectionsMap.set(section.code, Object.assign(Object.assign({}, section), { columns: [...section.columns] }));
86
+ }
87
+ });
88
+ });
89
+ return Array.from(sectionsMap.values());
90
+ };
91
+ /**
92
+ * Set a view as default and ensure only one view is default at a time
93
+ */
94
+ export const setViewAsDefault = (views, viewId) => {
95
+ return views.map((view) => (Object.assign(Object.assign({}, view), { default: view.id === viewId })));
96
+ };
97
+ /**
98
+ * Transform API templates response to ViewMenuItem array
99
+ * Filters templates by mode and only shows the section matching the current mode
100
+ * Separates default templates (to be merged into built-in Default view) from custom views
101
+ */
102
+ export const transformTemplatesToViewMenuItems = (templates, mode = 'sheet', lang = 'en') => {
103
+ const customViews = [];
104
+ let defaultTemplateColumns;
105
+ let defaultTemplate;
106
+ templates.forEach((template) => {
107
+ // Get columns for the specified mode
108
+ // Map TableMode to layout section code: 'default' → 'Advanced', 'sheet' → 'Sheet'
109
+ const sectionCode = mode === 'sheet' ? 'sheet' : 'advanced';
110
+ const section = template.layout.find((s) => s.code.toLowerCase() === sectionCode);
111
+ const columns = section ? transformLayoutToColumns([section], lang) : [];
112
+ // Handle id as either string or object
113
+ const templateIdString = typeof template.id === 'string' ? template.id : template.templateId;
114
+ const viewId = typeof template.id === 'string' ? template.id : template.templateId;
115
+ // Always include date column at the beginning
116
+ const dateColumn = DATE_COLUMN_CONFIG;
117
+ const columnsWithDate = columns.some((col) => col.name.toLowerCase() === 'date') ? columns : [dateColumn, ...columns];
118
+ // Ensure date column is first
119
+ const dateColumnIndex = columnsWithDate.findIndex((col) => col.name.toLowerCase() === 'date');
120
+ const finalColumns = dateColumnIndex > 0
121
+ ? [columnsWithDate[dateColumnIndex], ...columnsWithDate.filter((col) => col.name.toLowerCase() !== 'date')]
122
+ : columnsWithDate;
123
+ if (template.default) {
124
+ // Store default template columns to merge into built-in Default view
125
+ defaultTemplateColumns = finalColumns;
126
+ // Also create a ViewMenuItem for the default template
127
+ defaultTemplate = {
128
+ id: 'default',
129
+ templateId: template.templateId,
130
+ label: template.name,
131
+ isCustom: false,
132
+ default: true,
133
+ columns: finalColumns.map((col) => col.name),
134
+ submenu: finalColumns,
135
+ };
136
+ }
137
+ else {
138
+ // Add non-default templates as custom views
139
+ customViews.push({
140
+ id: viewId,
141
+ templateId: template.templateId,
142
+ label: template.name,
143
+ isCustom: true,
144
+ default: false,
145
+ columns: finalColumns.map((col) => col.name),
146
+ submenu: finalColumns,
147
+ });
148
+ }
149
+ });
150
+ return { customViews, defaultTemplateColumns, defaultTemplate };
151
+ };
152
+ /**
153
+ * Convert ColumnViewProps back to LayoutSection format for API requests
154
+ */
155
+ export const convertColumnsToLayoutSection = (columns, mode, lang = 'en') => {
156
+ const columnItems = columns.map((col, index) => {
157
+ var _a, _b;
158
+ const fieldItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((field) => {
159
+ var _a;
160
+ return ({
161
+ code: field.name,
162
+ name: [
163
+ {
164
+ text: typeof field.label === 'string' ? field.label : field.name,
165
+ lang: lang || '',
166
+ },
167
+ ],
168
+ default: (_a = field.selected) !== null && _a !== void 0 ? _a : false,
169
+ });
170
+ });
171
+ const columnLabel = typeof col.label === 'string' ? col.label : col.name;
172
+ return Object.assign({ code: col.name, name: [
173
+ {
174
+ text: columnLabel,
175
+ lang,
176
+ },
177
+ ], order: index + 1, default: (_b = col.selected) !== null && _b !== void 0 ? _b : false }, (fieldItems && fieldItems.length > 0 && { fields: fieldItems }));
178
+ });
179
+ // Map TableMode to layout section code: 'default' → 'Advanced', 'sheet' → 'Sheet'
180
+ const sectionCode = mode === 'sheet' ? 'Sheet' : 'Advanced';
181
+ return {
182
+ code: sectionCode,
183
+ columns: columnItems,
184
+ };
185
+ };
186
+ /**
187
+ * Initialize columns for editing mode
188
+ */
189
+ export const initializeEditingColumns = (editingColumns, availableColumns) => {
190
+ return availableColumns
191
+ .filter((col) => !isDateColumn(col.name))
192
+ .map((col) => {
193
+ var _a;
194
+ const savedCol = editingColumns.find((ec) => ec.name === col.name);
195
+ 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 }))) }));
196
+ });
197
+ };
198
+ /**
199
+ * Initialize columns for create mode (all unchecked except date)
200
+ */
201
+ export const initializeCreateColumns = (availableColumns) => {
202
+ return availableColumns
203
+ .filter((col) => !isDateColumn(col.name))
204
+ .map((col) => {
205
+ var _a;
206
+ 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 }))) }));
207
+ });
208
+ };
209
+ /**
210
+ * Initialize columns for create mode with current tableViews state (preserves checked/unchecked values)
211
+ */
212
+ export const initializeCreateColumnsWithCurrentState = (availableColumns, currentTableViews) => {
213
+ return availableColumns
214
+ .filter((col) => !isDateColumn(col.name))
215
+ .map((col) => {
216
+ var _a, _b, _c;
217
+ const currentCol = currentTableViews.find((tc) => tc.name === col.name);
218
+ if (currentCol) {
219
+ 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) => {
220
+ var _a, _b;
221
+ const currentMenuItem = (_a = currentCol.menuItems) === null || _a === void 0 ? void 0 : _a.find((mi) => mi.name === item.name);
222
+ return Object.assign(Object.assign({}, item), { selected: (_b = currentMenuItem === null || currentMenuItem === void 0 ? void 0 : currentMenuItem.selected) !== null && _b !== void 0 ? _b : false });
223
+ }) });
224
+ }
225
+ 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 }))) });
226
+ });
227
+ };
228
+ /**
229
+ * Reset columns to their default selection state
230
+ */
231
+ export const resetColumnsToDefault = (columns) => {
232
+ return columns
233
+ .filter((col) => !isDateColumn(col.name))
234
+ .map((col) => {
235
+ var _a, _b;
236
+ 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 })); }) }));
237
+ });
238
+ };
239
+ /**
240
+ * Toggle a column's selection (including all children if present)
241
+ */
242
+ export const toggleColumn = (columns, columnName) => {
243
+ return columns.map((col) => {
244
+ var _a;
245
+ if (col.name !== columnName)
246
+ return col;
247
+ const newSelected = !col.selected;
248
+ const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: newSelected })));
249
+ return Object.assign(Object.assign({}, col), { selected: newSelected, menuItems: updatedMenuItems });
250
+ });
251
+ };
252
+ /**
253
+ * Toggle a sub-item's selection and update parent state
254
+ */
255
+ export const toggleSubItem = (columns, columnName, subItemName) => {
256
+ return columns.map((col) => {
257
+ var _a, _b;
258
+ if (col.name !== columnName)
259
+ return col;
260
+ 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));
261
+ const hasSelectedChildren = (_b = updatedMenuItems === null || updatedMenuItems === void 0 ? void 0 : updatedMenuItems.some((item) => item.selected)) !== null && _b !== void 0 ? _b : false;
262
+ return Object.assign(Object.assign({}, col), { menuItems: updatedMenuItems, selected: hasSelectedChildren });
263
+ });
264
+ };
265
+ /**
266
+ * Select or deselect all columns (except date)
267
+ */
268
+ export const toggleAllColumns = (columns, selectAll) => {
269
+ return columns.map((col) => {
270
+ var _a;
271
+ if (isDateColumn(col.name))
272
+ return col;
273
+ const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: selectAll })));
274
+ return Object.assign(Object.assign({}, col), { selected: selectAll, menuItems: updatedMenuItems });
275
+ });
276
+ };
277
+ /**
278
+ * Check if all non-date columns are selected
279
+ */
280
+ export const areAllColumnsSelected = (columns) => {
281
+ const nonDateColumns = columns.filter((col) => !isDateColumn(col.name));
282
+ return (nonDateColumns.length > 0 &&
283
+ nonDateColumns.every((col) => {
284
+ var _a;
285
+ if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
286
+ // For columns with menuItems, all items must be selected
287
+ return col.menuItems.every((item) => item.selected);
288
+ }
289
+ return col.selected;
290
+ }));
291
+ };
292
+ /**
293
+ * Check if some (but not all) non-date columns are selected
294
+ */
295
+ export const areSomeColumnsSelected = (columns, allSelected) => {
296
+ const nonDateColumns = columns.filter((col) => !isDateColumn(col.name));
297
+ const hasAnySelected = nonDateColumns.some((col) => {
298
+ var _a;
299
+ if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
300
+ return col.menuItems.some((item) => item.selected);
301
+ }
302
+ return col.selected;
303
+ });
304
+ return hasAnySelected && !allSelected;
305
+ };
306
+ /**
307
+ * Validate template name
308
+ */
309
+ export const isValidTemplateName = (name, maxLength) => {
310
+ return name.trim().length > 0 && name.length <= maxLength;
311
+ };
312
+ /**
313
+ * Deep clone columns array with all nested properties
314
+ */
315
+ export const deepCloneColumns = (columns) => {
316
+ return columns.map((col) => {
317
+ var _a, _b;
318
+ 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) => {
319
+ var _a;
320
+ return (Object.assign(Object.assign({}, item), { selected: (_a = item.selected) !== null && _a !== void 0 ? _a : false }));
321
+ }) }));
322
+ });
323
+ };
324
+ /**
325
+ * Toggle a single column's selection state
326
+ */
327
+ export const toggleSingleColumn = (columns, columnName) => {
328
+ return columns.map((col) => {
329
+ var _a;
330
+ if (col.name !== columnName)
331
+ return col;
332
+ const newSelected = !col.selected;
333
+ const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: newSelected })));
334
+ return Object.assign(Object.assign({}, col), { selected: newSelected, menuItems: updatedMenuItems });
335
+ });
336
+ };
337
+ /**
338
+ * Get submenu items for a view menu item
339
+ * Always includes the date column at the beginning
340
+ */
341
+ export const getSubmenuItems = (item, defaultColumns) => {
342
+ var _a;
343
+ let columns = [];
344
+ if (item.isCustom && ((_a = item.submenu) === null || _a === void 0 ? void 0 : _a.length)) {
345
+ columns = item.submenu;
346
+ }
347
+ else if (item.id === 'default') {
348
+ columns = defaultColumns;
349
+ }
350
+ else {
351
+ columns = item.submenu || [];
352
+ }
353
+ // Always include date column at the beginning if it's not already present
354
+ const hasDateColumn = columns.some((col) => col.name.toLowerCase() === 'date');
355
+ if (!hasDateColumn) {
356
+ const dateColumn = {
357
+ name: 'date',
358
+ label: 'Date',
359
+ selected: true,
360
+ };
361
+ return [dateColumn, ...columns];
362
+ }
363
+ // Ensure date column is first
364
+ const dateColumnIndex = columns.findIndex((col) => col.name.toLowerCase() === 'date');
365
+ if (dateColumnIndex > 0) {
366
+ const dateColumn = columns[dateColumnIndex];
367
+ const otherColumns = columns.filter((col) => col.name.toLowerCase() !== 'date');
368
+ return [dateColumn, ...otherColumns];
369
+ }
370
+ return columns;
371
+ };
372
+ /**
373
+ * Check if a view menu item has submenu
374
+ */
375
+ export const hasSubmenu = (item, defaultColumns) => {
376
+ return getSubmenuItems(item, defaultColumns).length > 0;
377
+ };
378
+ /**
379
+ * Check if all columns in current state are selected
380
+ */
381
+ export const areAllCurrentColumnsSelected = (columns) => {
382
+ if (columns.length === 0)
383
+ return false;
384
+ return columns.every((col) => {
385
+ var _a;
386
+ if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
387
+ // For columns with menuItems, all items must be selected
388
+ return col.menuItems.every((item) => item.selected);
389
+ }
390
+ return col.selected;
391
+ });
392
+ };
393
+ /**
394
+ * Check if some (but not all) columns in current state are selected
395
+ */
396
+ export const areSomeCurrentColumnsSelected = (columns, allSelected) => {
397
+ if (columns.length === 0)
398
+ return false;
399
+ const hasAny = columns.some((col) => {
400
+ var _a;
401
+ if ((_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.length) {
402
+ return col.menuItems.some((item) => item.selected);
403
+ }
404
+ return col.selected;
405
+ });
406
+ return hasAny && !allSelected;
407
+ };
408
+ /**
409
+ * Toggle all columns selection (select all or unselect all)
410
+ */
411
+ export const toggleAllCurrentColumns = (columns, shouldSelect) => {
412
+ return columns.map((col) => {
413
+ var _a;
414
+ const updatedMenuItems = (_a = col.menuItems) === null || _a === void 0 ? void 0 : _a.map((item) => (Object.assign(Object.assign({}, item), { selected: shouldSelect })));
415
+ return Object.assign(Object.assign({}, col), { selected: shouldSelect, menuItems: updatedMenuItems });
416
+ });
417
+ };
418
+ /**
419
+ * Normalize columns by converting undefined selected values to false for consistent comparison
420
+ */
421
+ export const normalizeColumnsSelected = (columns) => {
422
+ return columns.map((col) => {
423
+ var _a, _b;
424
+ 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) => {
425
+ var _a;
426
+ return (Object.assign(Object.assign({}, item), { selected: (_a = item.selected) !== null && _a !== void 0 ? _a : false }));
427
+ }) }));
428
+ });
429
+ };
430
+ /**
431
+ * Compare two columns arrays to check if they are equal (same order, same selection states)
432
+ */
433
+ export const areColumnsEqual = (cols1, cols2) => {
434
+ if (cols1.length !== cols2.length)
435
+ return false;
436
+ const normalizedCols1 = normalizeColumnsSelected(cols1);
437
+ const normalizedCols2 = normalizeColumnsSelected(cols2);
438
+ for (let i = 0; i < normalizedCols1.length; i++) {
439
+ const col1 = normalizedCols1[i];
440
+ const col2 = normalizedCols2[i];
441
+ if (col1.name !== col2.name)
442
+ return false;
443
+ if (col1.selected !== col2.selected)
444
+ return false;
445
+ if (col1.menuItems && col2.menuItems) {
446
+ if (col1.menuItems.length !== col2.menuItems.length)
447
+ return false;
448
+ for (let j = 0; j < col1.menuItems.length; j++) {
449
+ const item1 = col1.menuItems[j];
450
+ const item2 = col2.menuItems[j];
451
+ if (item1.name !== item2.name)
452
+ return false;
453
+ if (item1.selected !== item2.selected) {
454
+ return false;
455
+ }
456
+ }
457
+ }
458
+ else if (col1.menuItems || col2.menuItems) {
459
+ return false;
460
+ }
461
+ }
462
+ return true;
463
+ };
@@ -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, TemplateAPIMetadata } from './TableView/types';
5
6
  type ViewsOptions = {
6
7
  default: {};
7
8
  developer: {};
@@ -22,7 +23,7 @@ export interface TableHeaderProps<IStatus extends TableHeaderStatus | TableHeade
22
23
  calendarMode?: CalenderMode;
23
24
  onStatusChange?: <T extends IStatus>(status?: T) => void;
24
25
  onSearch?: (search: string) => void;
25
- onViewChange?: () => void;
26
+ onViewChange?: (selectedView?: ViewMenuItem) => void;
26
27
  onDateChange?: (date: Date | [Date, Date]) => void;
27
28
  tableReportsComponent?: React.ReactNode;
28
29
  tableFilterComponent?: React.ReactNode;
@@ -44,6 +45,26 @@ 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;
67
+ apiMetadata?: TemplateAPIMetadata;
47
68
  onToggleTextButtonClick?: () => void;
48
69
  children?: ReactNode;
49
70
  calendarGroupBy?: string;
@@ -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("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);
@@ -153,4 +153,3 @@ export * from './SalesChannelFilter';
153
153
  export * from './ReferenceTypeFilter';
154
154
  export * from './ListColumnFilter';
155
155
  export * from './VerificationIcon';
156
- export * from './MultiDatakeyDonut';
@@ -153,4 +153,3 @@ export * from './SalesChannelFilter';
153
153
  export * from './ReferenceTypeFilter';
154
154
  export * from './ListColumnFilter';
155
155
  export * from './VerificationIcon';
156
- export * from './MultiDatakeyDonut';
@@ -492,6 +492,4 @@ export const MF_APPS_MAPPER = new Set([
492
492
  APP_CODES.payouts.code,
493
493
  APP_CODES.reports.code,
494
494
  APP_CODES.leads.code,
495
- APP_CODES.wallet.code,
496
- APP_CODES.authentication.code,
497
495
  ]);
@@ -76,14 +76,12 @@ export declare const closeIcon: string;
76
76
  export declare const dashedCheckIcon: string;
77
77
  export declare const deactivatedIcon: string;
78
78
  export declare const topUpIcon: string;
79
- export declare const AIOverviewIcon: string;
80
79
  export declare const deMaximizeIcon: string;
81
80
  export declare const pendingFlag: string;
82
81
  export declare const ibanIcon: string;
83
82
  export declare const payoutIcon: string;
84
83
  export declare const releasedFlag: string;
85
84
  export declare const acceptedFlag: string;
86
- export declare const clearIcon: string;
87
85
  export declare const unCapturedIcon: string;
88
86
  export declare const newWindowIcon: string;
89
87
  export declare const viewAllIcon: string;
@@ -340,6 +338,7 @@ export declare const TAP3DSPROVIDERIcon: string;
340
338
  export declare const greyPlusIcon: string;
341
339
  export declare const greyMinusIcon: string;
342
340
  export declare const noPreviewIcon: string;
341
+ export declare const editIcon: string;
343
342
  export declare const viewInvoiceIcon: string;
344
343
  export declare const checkoutStatusIcon: string;
345
344
  export declare const checkoutStatusBlueIcon: string;