@tap-payments/os-micro-frontend-shared 0.1.375-test.1 → 0.1.375-test.1-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 (52) hide show
  1. package/build/components/Sandbox/style.js +3 -2
  2. package/build/components/TableHeader/FiltersRow.d.ts +1 -1
  3. package/build/components/TableHeader/FiltersRow.js +4 -2
  4. package/build/components/TableHeader/TableHeader.d.ts +1 -1
  5. package/build/components/TableHeader/TableHeader.js +2 -2
  6. package/build/components/TableHeader/TableView/CreateViewDialog.d.ts +3 -0
  7. package/build/components/TableHeader/TableView/CreateViewDialog.js +91 -0
  8. package/build/components/TableHeader/TableView/CustomViews.js +1 -1
  9. package/build/components/TableHeader/TableView/TableView.js +0 -1
  10. package/build/components/TableHeader/TableView/ViewSelector.d.ts +5 -0
  11. package/build/components/TableHeader/TableView/ViewSelector.js +81 -0
  12. package/build/components/TableHeader/TableView/ViewsDropdown.d.ts +5 -0
  13. package/build/components/TableHeader/TableView/ViewsDropdown.js +198 -0
  14. package/build/components/TableHeader/TableView/components/ColumnList.d.ts +3 -0
  15. package/build/components/TableHeader/TableView/components/ColumnList.js +70 -0
  16. package/build/components/TableHeader/TableView/components/ViewsSubmenu.d.ts +3 -0
  17. package/build/components/TableHeader/TableView/components/ViewsSubmenu.js +71 -0
  18. package/build/components/TableHeader/TableView/components/index.d.ts +2 -0
  19. package/build/components/TableHeader/TableView/components/index.js +2 -0
  20. package/build/components/TableHeader/TableView/constants.d.ts +10 -0
  21. package/build/components/TableHeader/TableView/constants.js +10 -0
  22. package/build/components/TableHeader/TableView/data.d.ts +5 -0
  23. package/build/components/TableHeader/TableView/data.js +48 -0
  24. package/build/components/TableHeader/TableView/hooks/index.d.ts +6 -0
  25. package/build/components/TableHeader/TableView/hooks/index.js +6 -0
  26. package/build/components/TableHeader/TableView/hooks/useCreateViewDialog.d.ts +22 -0
  27. package/build/components/TableHeader/TableView/hooks/useCreateViewDialog.js +86 -0
  28. package/build/components/TableHeader/TableView/hooks/useDialogPosition.d.ts +8 -0
  29. package/build/components/TableHeader/TableView/hooks/useDialogPosition.js +16 -0
  30. package/build/components/TableHeader/TableView/hooks/useNestedSubmenu.d.ts +7 -0
  31. package/build/components/TableHeader/TableView/hooks/useNestedSubmenu.js +34 -0
  32. package/build/components/TableHeader/TableView/hooks/useOriginalColumns.d.ts +6 -0
  33. package/build/components/TableHeader/TableView/hooks/useOriginalColumns.js +18 -0
  34. package/build/components/TableHeader/TableView/hooks/useSubmenuHover.d.ts +8 -0
  35. package/build/components/TableHeader/TableView/hooks/useSubmenuHover.js +43 -0
  36. package/build/components/TableHeader/TableView/hooks/useViewSelector.d.ts +50 -0
  37. package/build/components/TableHeader/TableView/hooks/useViewSelector.js +239 -0
  38. package/build/components/TableHeader/TableView/hooks/useViewsManager.d.ts +20 -0
  39. package/build/components/TableHeader/TableView/hooks/useViewsManager.js +96 -0
  40. package/build/components/TableHeader/TableView/index.d.ts +12 -3
  41. package/build/components/TableHeader/TableView/index.js +13 -3
  42. package/build/components/TableHeader/TableView/styles.d.ts +127 -0
  43. package/build/components/TableHeader/TableView/styles.js +426 -0
  44. package/build/components/TableHeader/TableView/types.d.ts +183 -0
  45. package/build/components/TableHeader/TableView/types.js +1 -0
  46. package/build/components/TableHeader/TableView/utils.d.ts +121 -0
  47. package/build/components/TableHeader/TableView/utils.js +463 -0
  48. package/build/components/TableHeader/index.d.ts +1 -0
  49. package/build/components/TableHeader/type.d.ts +15 -1
  50. package/build/constants/assets.d.ts +1 -0
  51. package/build/constants/assets.js +1 -0
  52. package/package.json +3 -2
@@ -0,0 +1,239 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { useState, useCallback, useEffect, useRef } from 'react';
11
+ import { deepCloneColumns } from '../utils';
12
+ export const useViewSelector = ({ mode, onViewChange, onCreateCustomView, onEditCustomView, onDeleteCustomView, customViews, defaultColumns, defaultTemplate, allTemplates, setInternalCustomViews, }) => {
13
+ const [anchorViewEl, setAnchorViewEl] = useState(null);
14
+ const [defaultViewEl, setDefaultViewElement] = useState(null);
15
+ const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false);
16
+ const [editingView, setEditingView] = useState(null);
17
+ const [selectedViewInfo, setSelectedViewInfo] = useState({ id: 'default', label: 'Default' });
18
+ const [shouldUseCurrentState, setShouldUseCurrentState] = useState(false);
19
+ const [selectedView, setSelectedView] = useState(undefined);
20
+ // Current view columns - this is what gets displayed and can be modified
21
+ const [currentViewColumns, setCurrentViewColumns] = useState([]);
22
+ const hasInitializedRef = useRef(false);
23
+ // Helper: Filter view to only include selected columns for parent
24
+ const getViewForParent = useCallback((view) => {
25
+ var _a;
26
+ const selectedColumns = ((_a = view.submenu) === null || _a === void 0 ? void 0 : _a.filter((col) => col.selected)) || [];
27
+ return Object.assign(Object.assign({}, view), { submenu: selectedColumns, columns: selectedColumns.map((col) => col.name) });
28
+ }, []);
29
+ // Initialize with default template on mount
30
+ useEffect(() => {
31
+ if (hasInitializedRef.current)
32
+ return;
33
+ if (!defaultTemplate)
34
+ return;
35
+ setSelectedView(defaultTemplate);
36
+ setCurrentViewColumns(deepCloneColumns(defaultColumns));
37
+ onViewChange === null || onViewChange === void 0 ? void 0 : onViewChange(getViewForParent(defaultTemplate));
38
+ hasInitializedRef.current = true;
39
+ }, [defaultTemplate, defaultColumns, onViewChange, getViewForParent]);
40
+ // Sync currentViewColumns with defaultColumns when they change (e.g., after save)
41
+ useEffect(() => {
42
+ if (!hasInitializedRef.current)
43
+ return;
44
+ if ((selectedView === null || selectedView === void 0 ? void 0 : selectedView.default) && defaultColumns.length > 0) {
45
+ setCurrentViewColumns(deepCloneColumns(defaultColumns));
46
+ }
47
+ }, [defaultColumns, selectedView === null || selectedView === void 0 ? void 0 : selectedView.default]);
48
+ // Track the last mode we successfully synced columns for
49
+ const lastSyncedModeRef = useRef(null);
50
+ // Handle mode changes - sync with allTemplates updates
51
+ // This effect needs to run whenever mode changes OR when defaultColumns/allTemplates update
52
+ useEffect(() => {
53
+ if (!hasInitializedRef.current)
54
+ return;
55
+ if (!selectedView)
56
+ return;
57
+ // Check if we need to sync: either mode changed, or we haven't synced for current mode yet
58
+ const needsSync = lastSyncedModeRef.current !== mode;
59
+ if (!needsSync)
60
+ return;
61
+ // For default template, wait until defaultColumns has data for the new mode
62
+ if (selectedView.default) {
63
+ if (defaultColumns.length === 0)
64
+ return; // Wait for columns to load
65
+ const newView = Object.assign(Object.assign({}, selectedView), { submenu: deepCloneColumns(defaultColumns), columns: defaultColumns.map((col) => col.name) });
66
+ setSelectedView(newView);
67
+ setCurrentViewColumns(deepCloneColumns(defaultColumns));
68
+ lastSyncedModeRef.current = mode; // Mark as synced only after successful update
69
+ onViewChange === null || onViewChange === void 0 ? void 0 : onViewChange(getViewForParent(newView));
70
+ }
71
+ else {
72
+ // Custom template: find it in allTemplates (which has new mode's columns)
73
+ const updatedTemplate = allTemplates.find((t) => t.templateId === selectedView.templateId || t.id === selectedView.id);
74
+ if (updatedTemplate && updatedTemplate.submenu && updatedTemplate.submenu.length > 0) {
75
+ const newView = Object.assign(Object.assign({}, updatedTemplate), { submenu: deepCloneColumns(updatedTemplate.submenu) });
76
+ setSelectedView(newView);
77
+ setCurrentViewColumns(deepCloneColumns(updatedTemplate.submenu));
78
+ lastSyncedModeRef.current = mode; // Mark as synced only after successful update
79
+ onViewChange === null || onViewChange === void 0 ? void 0 : onViewChange(getViewForParent(newView));
80
+ }
81
+ }
82
+ }, [mode, defaultColumns, selectedView, allTemplates, onViewChange]);
83
+ // Track template updates ref to detect external changes
84
+ const templatesUpdateRef = useRef(0);
85
+ // Sync selected view when templates change (for edits/updates)
86
+ // This ensures that template edits automatically reflect in the selected view
87
+ // ONLY when triggered by explicit save actions (Okay/Update buttons)
88
+ useEffect(() => {
89
+ var _a;
90
+ if (!hasInitializedRef.current)
91
+ return;
92
+ if (!selectedView)
93
+ return;
94
+ // Find the current selected view in updated allTemplates
95
+ const updatedTemplate = allTemplates.find((t) => {
96
+ const templateId = t.templateId || t.id;
97
+ const selectedId = selectedView.templateId || selectedView.id;
98
+ return templateId === selectedId;
99
+ });
100
+ if (!updatedTemplate)
101
+ return;
102
+ // Check if the template has actually changed by comparing submenu
103
+ const currentSubmenu = selectedView.submenu || [];
104
+ const updatedSubmenu = updatedTemplate.submenu || [];
105
+ // Simple check: if lengths differ or selected states differ, update
106
+ const hasChanged = currentSubmenu.length !== updatedSubmenu.length ||
107
+ currentSubmenu.some((col, idx) => {
108
+ const updatedCol = updatedSubmenu[idx];
109
+ if (!updatedCol)
110
+ return true;
111
+ return col.selected !== updatedCol.selected || col.name !== updatedCol.name;
112
+ });
113
+ if (hasChanged) {
114
+ console.log('🔄 Template updated, syncing selected view:', selectedView.label);
115
+ console.log(' Old columns count:', currentSubmenu.length, 'New columns count:', updatedSubmenu.length);
116
+ console.log(' Old selected:', currentSubmenu.filter((c) => c.selected).length, 'New selected:', updatedSubmenu.filter((c) => c.selected).length);
117
+ // Store the full view internally (with all columns)
118
+ const fullView = Object.assign(Object.assign({}, updatedTemplate), { submenu: deepCloneColumns(updatedTemplate.submenu || []) });
119
+ setSelectedView(fullView);
120
+ setCurrentViewColumns(deepCloneColumns(updatedTemplate.submenu || []));
121
+ // Pass only selected columns to parent
122
+ const viewForParent = getViewForParent(fullView);
123
+ console.log('✅ Calling onViewChange with', (_a = viewForParent.submenu) === null || _a === void 0 ? void 0 : _a.length, 'selected columns');
124
+ onViewChange === null || onViewChange === void 0 ? void 0 : onViewChange(viewForParent);
125
+ templatesUpdateRef.current++;
126
+ }
127
+ }, [allTemplates, selectedView, onViewChange]);
128
+ const handleViewButtonClick = useCallback((event) => {
129
+ setAnchorViewEl(event.currentTarget);
130
+ setDefaultViewElement(event.currentTarget);
131
+ }, []);
132
+ const handleCloseViewDropdown = useCallback(() => {
133
+ setDefaultViewElement(null);
134
+ }, []);
135
+ const handleSelectedViewInfo = useCallback((selected, viewMenuItem) => {
136
+ setSelectedViewInfo(selected);
137
+ const newSelectedView = viewMenuItem || undefined;
138
+ setSelectedView(newSelectedView);
139
+ setCurrentViewColumns(deepCloneColumns((newSelectedView === null || newSelectedView === void 0 ? void 0 : newSelectedView.submenu) || []));
140
+ if (newSelectedView) {
141
+ onViewChange === null || onViewChange === void 0 ? void 0 : onViewChange(getViewForParent(newSelectedView));
142
+ }
143
+ else {
144
+ onViewChange === null || onViewChange === void 0 ? void 0 : onViewChange(undefined);
145
+ }
146
+ handleCloseViewDropdown();
147
+ }, [handleCloseViewDropdown, onViewChange, getViewForParent]);
148
+ // Update selected view with modified columns
149
+ const updateSelectedView = useCallback((updatedView) => {
150
+ var _a, _b;
151
+ console.log('🔴 updateSelectedView called:', {
152
+ id: updatedView.id,
153
+ columnsCount: (_a = updatedView.submenu) === null || _a === void 0 ? void 0 : _a.length,
154
+ selectedColumns: (_b = updatedView.submenu) === null || _b === void 0 ? void 0 : _b.filter((c) => c.selected).length,
155
+ });
156
+ // CRITICAL: Force new object/array references to trigger React re-renders
157
+ const viewWithNewRefs = Object.assign(Object.assign({}, updatedView), { submenu: updatedView.submenu ? [...updatedView.submenu] : undefined, columns: updatedView.columns ? [...updatedView.columns] : undefined });
158
+ setSelectedView(viewWithNewRefs);
159
+ setCurrentViewColumns(deepCloneColumns(viewWithNewRefs.submenu || []));
160
+ setSelectedViewInfo({ id: viewWithNewRefs.id, label: viewWithNewRefs.label });
161
+ onViewChange === null || onViewChange === void 0 ? void 0 : onViewChange(getViewForParent(viewWithNewRefs));
162
+ }, [onViewChange, getViewForParent]);
163
+ // Update current view columns (for temporary modifications)
164
+ const updateCurrentViewColumns = useCallback((columns) => {
165
+ setCurrentViewColumns(columns);
166
+ }, []);
167
+ const handleOpenCreateDialog = useCallback((useCurrentState = false) => {
168
+ setEditingView(null);
169
+ setShouldUseCurrentState(useCurrentState);
170
+ setIsCreateDialogOpen(true);
171
+ setDefaultViewElement(null);
172
+ }, []);
173
+ const handleOpenEditDialog = useCallback((view) => {
174
+ setEditingView(view);
175
+ setShouldUseCurrentState(true);
176
+ setIsCreateDialogOpen(true);
177
+ }, []);
178
+ const handleCloseCreateDialog = useCallback(() => {
179
+ setIsCreateDialogOpen(false);
180
+ setEditingView(null);
181
+ setShouldUseCurrentState(false);
182
+ }, []);
183
+ const handleSaveView = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
184
+ if (editingView) {
185
+ const templateId = editingView.templateId || editingView.id;
186
+ // Call the edit handler - parent will update templates
187
+ yield (onEditCustomView === null || onEditCustomView === void 0 ? void 0 : onEditCustomView(templateId, data));
188
+ // After edit completes successfully, the template will be updated externally via templates prop
189
+ // The useEffect watching allTemplates will automatically sync the view
190
+ console.log('✅ View saved - templates will update and trigger sync');
191
+ }
192
+ else {
193
+ // Call the create handler - parent will add new template
194
+ yield (onCreateCustomView === null || onCreateCustomView === void 0 ? void 0 : onCreateCustomView(data));
195
+ // After create completes successfully, the new template will be added externally via templates prop
196
+ // The new template will automatically appear in the dropdown
197
+ console.log('✅ View created - new template will appear in dropdown');
198
+ }
199
+ }), [editingView, onEditCustomView, onCreateCustomView]);
200
+ const handleDeleteView = useCallback((viewId) => __awaiter(void 0, void 0, void 0, function* () {
201
+ const viewToDelete = allTemplates.find((view) => view.id === viewId || view.templateId === viewId);
202
+ const templateId = (viewToDelete === null || viewToDelete === void 0 ? void 0 : viewToDelete.templateId) || viewId;
203
+ yield (onDeleteCustomView === null || onDeleteCustomView === void 0 ? void 0 : onDeleteCustomView(templateId));
204
+ // If deleted view was selected, reset to default
205
+ if ((selectedView === null || selectedView === void 0 ? void 0 : selectedView.id) === viewId || (selectedView === null || selectedView === void 0 ? void 0 : selectedView.templateId) === viewId) {
206
+ setSelectedView(defaultTemplate);
207
+ setCurrentViewColumns(deepCloneColumns(defaultColumns));
208
+ if (defaultTemplate) {
209
+ onViewChange === null || onViewChange === void 0 ? void 0 : onViewChange(getViewForParent(defaultTemplate));
210
+ }
211
+ }
212
+ }), [allTemplates, onDeleteCustomView, selectedView, defaultTemplate, defaultColumns, onViewChange, getViewForParent]);
213
+ // Reset views to default
214
+ const handleResetViews = useCallback(() => {
215
+ setCurrentViewColumns(deepCloneColumns(defaultColumns));
216
+ }, [defaultColumns]);
217
+ return {
218
+ anchorViewEl,
219
+ defaultViewEl,
220
+ setDefaultViewElement,
221
+ isCreateDialogOpen,
222
+ editingView,
223
+ selectedViewInfo,
224
+ shouldUseCurrentState,
225
+ selectedView,
226
+ currentViewColumns,
227
+ handleViewButtonClick,
228
+ handleCloseViewDropdown,
229
+ handleSelectedViewInfo,
230
+ handleOpenCreateDialog,
231
+ handleOpenEditDialog,
232
+ handleCloseCreateDialog,
233
+ handleSaveView,
234
+ handleDeleteView,
235
+ handleResetViews,
236
+ updateSelectedView,
237
+ updateCurrentViewColumns,
238
+ };
239
+ };
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ import type { ColumnViewProps } from '../../../../types/index.js';
3
+ import type { UseViewsManagerProps, ViewMenuItem } from '../types';
4
+ /**
5
+ * Simplified hook for managing templates and views.
6
+ *
7
+ * Key principles:
8
+ * - Templates from parent are parsed into allTemplates
9
+ * - defaultColumns is the local working copy that can be modified
10
+ * - When user modifies default template, we keep changes locally
11
+ */
12
+ export declare const useViewsManager: ({ tableMode, templates, lang }: UseViewsManagerProps) => {
13
+ defaultTemplate: ViewMenuItem | undefined;
14
+ customViews: ViewMenuItem[];
15
+ allTemplates: ViewMenuItem[];
16
+ defaultColumns: ColumnViewProps[];
17
+ updateDefaultColumns: (columns: ColumnViewProps[]) => void;
18
+ internalCustomViews: ViewMenuItem[];
19
+ setInternalCustomViews: import("react").Dispatch<import("react").SetStateAction<ViewMenuItem[]>>;
20
+ };
@@ -0,0 +1,96 @@
1
+ import { useState, useEffect, useMemo, useCallback } from 'react';
2
+ import { transformTemplatesToViewMenuItems, deepCloneColumns } from '../utils';
3
+ /**
4
+ * Simplified hook for managing templates and views.
5
+ *
6
+ * Key principles:
7
+ * - Templates from parent are parsed into allTemplates
8
+ * - defaultColumns is the local working copy that can be modified
9
+ * - When user modifies default template, we keep changes locally
10
+ */
11
+ export const useViewsManager = ({ tableMode, templates, lang = 'en' }) => {
12
+ // Parse templates (this just transforms the data, doesn't manage modifications)
13
+ const parsedTemplates = useMemo(() => {
14
+ if (!templates || templates.length === 0) {
15
+ return {
16
+ customViews: [],
17
+ defaultTemplate: undefined,
18
+ templateDefaultColumns: [],
19
+ allTemplates: [],
20
+ };
21
+ }
22
+ const { customViews, defaultTemplate } = transformTemplatesToViewMenuItems(templates, tableMode, lang);
23
+ // Combine all templates for easy access
24
+ const allTemplates = defaultTemplate ? [defaultTemplate, ...customViews] : customViews;
25
+ return {
26
+ customViews,
27
+ defaultTemplate,
28
+ templateDefaultColumns: (defaultTemplate === null || defaultTemplate === void 0 ? void 0 : defaultTemplate.submenu) || [],
29
+ allTemplates,
30
+ };
31
+ }, [templates, tableMode, lang]);
32
+ // Local state for default columns - this is the working copy that can be modified
33
+ const [defaultColumns, setDefaultColumns] = useState([]);
34
+ // Track if we've initialized for this mode (to avoid resetting user modifications)
35
+ const [initializedMode, setInitializedMode] = useState(null);
36
+ // Initialize defaultColumns when templates load or mode changes
37
+ useEffect(() => {
38
+ // Only initialize if mode changed or we haven't initialized yet
39
+ if (initializedMode !== tableMode && parsedTemplates.templateDefaultColumns.length > 0) {
40
+ setDefaultColumns(deepCloneColumns(parsedTemplates.templateDefaultColumns));
41
+ setInitializedMode(tableMode);
42
+ }
43
+ }, [tableMode, parsedTemplates.templateDefaultColumns, initializedMode]);
44
+ // Custom views state
45
+ const [internalCustomViews, setInternalCustomViews] = useState([]);
46
+ useEffect(() => {
47
+ setInternalCustomViews([...parsedTemplates.customViews]);
48
+ }, [parsedTemplates.customViews]);
49
+ // Function to update default columns (called when user modifies and clicks Okay)
50
+ const updateDefaultColumns = useCallback((columns) => {
51
+ setDefaultColumns(deepCloneColumns(columns));
52
+ }, []);
53
+ // Create an updated default template with current defaultColumns
54
+ // IMPORTANT: When mode just changed (initializedMode !== tableMode), use parsedTemplates
55
+ // directly because defaultColumns state hasn't updated yet
56
+ const updatedDefaultTemplate = useMemo(() => {
57
+ if (!parsedTemplates.defaultTemplate) {
58
+ return parsedTemplates.defaultTemplate;
59
+ }
60
+ // If mode just changed, use the fresh parsed columns, not the stale state
61
+ const columnsToUse = initializedMode !== tableMode ? parsedTemplates.templateDefaultColumns : defaultColumns;
62
+ if (columnsToUse.length === 0) {
63
+ return parsedTemplates.defaultTemplate;
64
+ }
65
+ return Object.assign(Object.assign({}, parsedTemplates.defaultTemplate), { submenu: columnsToUse, columns: columnsToUse.map((col) => col.name) });
66
+ }, [parsedTemplates.defaultTemplate, parsedTemplates.templateDefaultColumns, defaultColumns, initializedMode, tableMode]);
67
+ // Build allTemplates with the updated default template
68
+ const updatedAllTemplates = useMemo(() => {
69
+ if (!updatedDefaultTemplate) {
70
+ return parsedTemplates.customViews;
71
+ }
72
+ return [updatedDefaultTemplate, ...parsedTemplates.customViews];
73
+ }, [updatedDefaultTemplate, parsedTemplates.customViews]);
74
+ // For mode changes, provide the correct columns
75
+ // Key: ALWAYS prefer state columns if they exist (preserves user modifications)
76
+ const effectiveDefaultColumns = useMemo(() => {
77
+ // If mode just changed AND we have no initialized state, use parsed columns
78
+ if (initializedMode !== tableMode && defaultColumns.length === 0) {
79
+ return parsedTemplates.templateDefaultColumns;
80
+ }
81
+ // Otherwise use state columns (which may include user edits)
82
+ return defaultColumns.length > 0 ? defaultColumns : parsedTemplates.templateDefaultColumns;
83
+ }, [initializedMode, tableMode, defaultColumns, parsedTemplates.templateDefaultColumns]);
84
+ return {
85
+ // Template data (with updated default template including modifications)
86
+ defaultTemplate: updatedDefaultTemplate,
87
+ customViews: parsedTemplates.customViews,
88
+ allTemplates: updatedAllTemplates,
89
+ // Default columns - preserves user edits
90
+ defaultColumns: effectiveDefaultColumns,
91
+ updateDefaultColumns,
92
+ // Internal state
93
+ internalCustomViews,
94
+ setInternalCustomViews,
95
+ };
96
+ };
@@ -1,3 +1,12 @@
1
- import TableView from './TableView';
2
- export * from './TableView';
3
- export default TableView;
1
+ export { default } from './TableView';
2
+ export { default as TableView } from './TableView';
3
+ export { default as DefaultViews } from './DefaultViews';
4
+ export { default as CustomViews } from './CustomViews';
5
+ export { default as ViewSelector } from './ViewSelector';
6
+ export { default as ViewsDropdown } from './ViewsDropdown';
7
+ export { default as CreateViewDialog } from './CreateViewDialog';
8
+ export type { ViewMenuItem, CreateCustomViewDialogProps, LayoutSection, ColumnItem, FieldItem, Template, CreateTemplatePayload, UpdateTemplatePayload, } from './types';
9
+ export { transformLayoutToColumns, getColumnsByMode, createCustomViewMenuItem, setViewAsDefault, transformTemplatesToViewMenuItems, convertColumnsToLayoutSection, isDateColumn, getColumnCheckState, } from './utils';
10
+ export { useSubmenuHover, useViewsManager, useViewSelector } from './hooks';
11
+ export { DIALOG_WIDTH, DIALOG_HEIGHT, MAX_CUSTOM_VIEWS, TEMPLATE_NAME_MAX_LENGTH } from './constants';
12
+ export { defaultViewList, advancedColumns, sheetColumns } from './data';
@@ -1,3 +1,13 @@
1
- import TableView from './TableView';
2
- export * from './TableView';
3
- export default TableView;
1
+ export { default } from './TableView';
2
+ export { default as TableView } from './TableView';
3
+ export { default as DefaultViews } from './DefaultViews';
4
+ export { default as CustomViews } from './CustomViews';
5
+ export { default as ViewSelector } from './ViewSelector';
6
+ export { default as ViewsDropdown } from './ViewsDropdown';
7
+ export { default as CreateViewDialog } from './CreateViewDialog';
8
+ export { transformLayoutToColumns, getColumnsByMode, createCustomViewMenuItem, setViewAsDefault, transformTemplatesToViewMenuItems, convertColumnsToLayoutSection, isDateColumn, getColumnCheckState, } from './utils';
9
+ export { useSubmenuHover, useViewsManager, useViewSelector } from './hooks';
10
+ export { DIALOG_WIDTH, DIALOG_HEIGHT, MAX_CUSTOM_VIEWS, TEMPLATE_NAME_MAX_LENGTH } from './constants';
11
+ // Note: defaultViewList, advancedColumns, sheetColumns are only exported for demo purposes
12
+ // They should not be used as defaults in production - all data should come from API
13
+ export { defaultViewList, advancedColumns, sheetColumns } from './data';
@@ -0,0 +1,127 @@
1
+ /// <reference types="react" />
2
+ import type { SxProps, Theme } from '@mui/material/styles';
3
+ export declare const ButtonStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
4
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
5
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
6
+ export declare const ViewWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
7
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
8
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
9
+ export declare const ListStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
10
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
11
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
12
+ export declare const DropdownStyled: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
13
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
14
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
15
+ export declare const MenuItem: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
16
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
17
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme> & {
18
+ addColumnViewEl?: boolean | undefined;
19
+ }, {}, {}>;
20
+ export declare const Space: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
21
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
22
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
23
+ export declare const SpaceAfter: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
24
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
25
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
26
+ export declare const DialogContentWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
27
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
28
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
29
+ export declare const ScrollableContent: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
30
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
31
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
32
+ export declare const TitleSection: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
33
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
34
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
35
+ export declare const ColumnListContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
36
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
37
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
38
+ export declare const SelectAllHeader: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
39
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
40
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
41
+ export declare const ColumnItemRow: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
42
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
43
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme> & {
44
+ isHovered?: boolean | undefined;
45
+ isDate?: boolean | undefined;
46
+ }, {}, {}>;
47
+ export declare const DragIconWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
48
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
49
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
50
+ export declare const CheckboxWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
51
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
52
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
53
+ export declare const FooterBar: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
54
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
55
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
56
+ export declare const CreateButtonWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
57
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
58
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
59
+ export declare const SubmenuPaper: import("@emotion/styled").StyledComponent<import("@mui/material").PaperOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
60
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
61
+ }, "classes" | "className" | "style" | "children" | "sx" | "variant" | "square" | "elevation"> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
62
+ export declare const SubmenuItem: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
63
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
64
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
65
+ export declare const DeleteButton: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
66
+ ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
67
+ }, "color" | "disabled" | "classes" | "className" | "style" | "tabIndex" | "children" | "sx" | "variant" | "size" | "fullWidth" | "href" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
68
+ export declare const CreateButton: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
69
+ ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
70
+ }, "color" | "disabled" | "classes" | "className" | "style" | "tabIndex" | "children" | "sx" | "variant" | "size" | "fullWidth" | "href" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
71
+ export declare const NameTextField: import("@emotion/styled").StyledComponent<{
72
+ variant?: import("@mui/material").TextFieldVariants | undefined;
73
+ } & Omit<import("@mui/material").FilledTextFieldProps | import("@mui/material").OutlinedTextFieldProps | import("@mui/material").StandardTextFieldProps, "variant"> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
74
+ export declare const checkboxSx: SxProps<Theme>;
75
+ export declare const getDialogPaperStyle: (width: number, height: number) => {
76
+ margin: number;
77
+ maxHeight: string;
78
+ maxWidth: string;
79
+ width: number;
80
+ height: number;
81
+ borderRadius: number;
82
+ overflow: string;
83
+ boxShadow: string;
84
+ };
85
+ export declare const dialogSx: {
86
+ backgroundColor: string;
87
+ pointerEvents: string;
88
+ zIndex: number;
89
+ '& .MuiDialog-container': {
90
+ transition: string;
91
+ zIndex: number;
92
+ };
93
+ '& .MuiDialog-paper': {
94
+ transition: string;
95
+ pointerEvents: string;
96
+ zIndex: number;
97
+ };
98
+ };
99
+ export declare const ResetHeaderBox: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
100
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
101
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
102
+ export declare const ResetCheckboxSx: SxProps<Theme>;
103
+ export declare const SubmenuContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
104
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
105
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
106
+ export declare const ColumnItemsContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
107
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
108
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
109
+ export declare const SaveCustomViewBox: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
110
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
111
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
112
+ export declare const SaveCustomViewInnerBox: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
113
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
114
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme> & {
115
+ disabled?: boolean | undefined;
116
+ }, {}, {}>;
117
+ export declare const ButtonsContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
118
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
119
+ }, keyof import("@mui/system").BoxOwnProps<Theme>> & import("@mui/system").MUIStyledCommonProps<Theme>, {}, {}>;
120
+ export declare const CancelButtonSx: SxProps<Theme>;
121
+ export declare const OkayButtonSx: SxProps<Theme>;
122
+ export declare const ModifiedTextSx: {
123
+ readonly color: "#20232B80";
124
+ readonly fontSize: "9px";
125
+ readonly fontWeight: 500;
126
+ readonly marginLeft: "4px";
127
+ };