@tap-payments/os-micro-frontend-shared 0.1.438-test.1-test.2 → 0.1.438-test.26
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.
- package/build/components/DropdownMenu/styles.d.ts +2 -2
- package/build/components/RFH/Inputs/MultiSelect/style.d.ts +1 -1
- package/build/components/TableHeader/TableView/ViewsDropdown.js +1 -3
- package/build/components/TableHeader/TableView/ViewsMenu.js +3 -8
- package/build/components/TableHeader/TableView/components/ColumnList.js +4 -1
- package/build/components/TableHeader/TableView/components/ViewsSubmenu.js +4 -1
- package/build/components/TableHeader/TableView/constants.d.ts +14 -0
- package/build/components/TableHeader/TableView/constants.js +14 -0
- package/build/components/TableHeader/TableView/hooks/useCustomTableViews.js +55 -58
- package/build/components/TableHeader/TableView/hooks/useViewsManager.js +7 -2
- package/build/components/TableHeader/TableView/hooks/useViewsMenu.js +12 -2
- package/build/components/TableHeader/TableView/types.d.ts +0 -2
- package/build/components/TableHeader/TableView/utils/customTableViews.d.ts +20 -0
- package/build/components/TableHeader/TableView/utils/customTableViews.js +30 -0
- package/build/components/TableHeader/TableView/utils/index.d.ts +1 -0
- package/build/components/TableHeader/TableView/utils/index.js +1 -0
- package/build/components/TableHeader/TableView/utils/viewMenu.js +2 -1
- package/build/components/VirtualTables/SheetViewVirtualTable/style.d.ts +1 -1
- package/build/components/VirtualTables/components/TableHeader/style.d.ts +1 -1
- package/build/components/VirtualTables/components/style.d.ts +1 -1
- package/build/constants/reports.d.ts +0 -1
- package/build/constants/reports.js +1 -11
- package/build/utils/columns.d.ts +0 -5
- package/build/utils/columns.js +3 -14
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const StyledMenuItem: import("@emotion/styled").StyledComponent<import("@mui/material").MenuItemOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
3
3
|
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
4
|
-
}, "disabled" | "classes" | "autoFocus" | "className" | "style" | "tabIndex" | "children" | "
|
|
4
|
+
}, "disabled" | "classes" | "autoFocus" | "className" | "style" | "tabIndex" | "children" | "sx" | "dense" | "action" | "selected" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters" | "divider"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
5
5
|
alwaysShowRightAction?: boolean | undefined;
|
|
6
6
|
}, {}, {}>;
|
|
7
7
|
export declare const StyledMenu: import("@emotion/styled").StyledComponent<import("@mui/material").MenuProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
@@ -12,7 +12,7 @@ export declare const StyledListItemText: import("@emotion/styled").StyledCompone
|
|
|
12
12
|
export declare const StyledSelect: import("@emotion/styled").StyledComponent<import("@mui/material").SelectProps<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
13
13
|
export declare const StyledOption: import("@emotion/styled").StyledComponent<import("@mui/material").MenuItemOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
14
14
|
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
15
|
-
}, "disabled" | "classes" | "autoFocus" | "className" | "style" | "tabIndex" | "children" | "
|
|
15
|
+
}, "disabled" | "classes" | "autoFocus" | "className" | "style" | "tabIndex" | "children" | "sx" | "dense" | "action" | "selected" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters" | "divider"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
16
16
|
export declare const StyledSelectComponent: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
17
17
|
export declare const StyledMenuTitle: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, {}>;
|
|
18
18
|
export declare const StyledIconForDropDown: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").ImgHTMLAttributes<HTMLImageElement>, HTMLImageElement>, {}>;
|
|
@@ -3,4 +3,4 @@ export declare const CheckboxStyled: import("@emotion/styled").StyledComponent<i
|
|
|
3
3
|
export declare const SearchInputStyled: import("@emotion/styled").StyledComponent<import("@mui/material/Input").InputProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
4
4
|
export declare const SearchMenuItemStyled: import("@emotion/styled").StyledComponent<import("@mui/material/MenuItem").MenuItemOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & {
|
|
5
5
|
ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
|
|
6
|
-
}, "disabled" | "classes" | "autoFocus" | "className" | "style" | "tabIndex" | "children" | "
|
|
6
|
+
}, "disabled" | "classes" | "autoFocus" | "className" | "style" | "tabIndex" | "children" | "sx" | "dense" | "action" | "selected" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableGutters" | "divider"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -18,7 +18,6 @@ function ViewsDropdown({ open, selectedViewInfo, setSelectedViewInfo, anchorEl,
|
|
|
18
18
|
const { t } = useTranslation();
|
|
19
19
|
const { hoveredColumn: hoveredViewId, anchorEl: submenuAnchorEl, openSubmenu, closeSubmenu, cancelClose, forceClose } = useSubmenuHover();
|
|
20
20
|
const [hoveredCustomId, setHoveredCustomId] = React.useState(null);
|
|
21
|
-
const [showModifiedBadge, setShowModifiedBadge] = React.useState(false);
|
|
22
21
|
const [draftColumns, setDraftColumns] = React.useState(null);
|
|
23
22
|
const { originalColumns, saveOriginalState, clearOriginalState } = useOriginalColumns(defaultColumns);
|
|
24
23
|
const views = useMemo(() => {
|
|
@@ -82,7 +81,6 @@ function ViewsDropdown({ open, selectedViewInfo, setSelectedViewInfo, anchorEl,
|
|
|
82
81
|
if (isDefaultView && defaultTemplate && colsToApply.length) {
|
|
83
82
|
if (draftHasChanges) {
|
|
84
83
|
onSaveDefaultColumns === null || onSaveDefaultColumns === void 0 ? void 0 : onSaveDefaultColumns(colsToApply);
|
|
85
|
-
setShowModifiedBadge(true);
|
|
86
84
|
}
|
|
87
85
|
updateSelectedView === null || updateSelectedView === void 0 ? void 0 : updateSelectedView(Object.assign(Object.assign({}, defaultTemplate), { id: String(defaultTemplate.id), submenu: deepCloneColumns(colsToApply), columns: colsToApply.map((c) => c.name) }));
|
|
88
86
|
}
|
|
@@ -136,7 +134,7 @@ function ViewsDropdown({ open, selectedViewInfo, setSelectedViewInfo, anchorEl,
|
|
|
136
134
|
setHoveredCustomId(null);
|
|
137
135
|
else if (hasSubmenu(item, defaultColumns))
|
|
138
136
|
closeSubmenu();
|
|
139
|
-
}, onClick: () => selectView(item), sx: { position: 'relative', cursor: 'pointer', pr: 1.5 } }, { children: [item.id === selectedViewInfo.id ? _jsx("img", { style: { width: 15, height: 15 }, src: smallBlueCheckIcon, alt: "check" }) : _jsx(Space, {}), _jsxs("span", Object.assign({ style: { flex: 1, fontSize: 11 } }, { children: [item.label, item.default && item.id === selectedViewInfo.id &&
|
|
137
|
+
}, onClick: () => selectView(item), sx: { position: 'relative', cursor: 'pointer', pr: 1.5 } }, { children: [item.id === selectedViewInfo.id ? _jsx("img", { style: { width: 15, height: 15 }, src: smallBlueCheckIcon, alt: "check" }) : _jsx(Space, {}), _jsxs("span", Object.assign({ style: { flex: 1, fontSize: 11 } }, { children: [item.label, item.default && item.id === selectedViewInfo.id && modifiedFromBase && _jsx("span", Object.assign({ style: ModifiedTextSx }, { children: "(Modified)" }))] })), item.isCustom && hoveredCustomId === item.id && (_jsx("img", { src: editIcon, alt: "edit", style: { width: 12, height: 12, cursor: 'pointer' }, onClick: (e) => {
|
|
140
138
|
e.stopPropagation();
|
|
141
139
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
142
140
|
onEditCustomView === null || onEditCustomView === void 0 ? void 0 : onEditCustomView(item);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useCallback
|
|
2
|
+
import { memo, useCallback } from 'react';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import ClickAwayListener from '@mui/material/ClickAwayListener';
|
|
5
5
|
import { Icon, StyledButton } from '../../index.js';
|
|
@@ -10,9 +10,7 @@ import { ViewWrapper } from './styles';
|
|
|
10
10
|
import { useViewsManager } from './hooks';
|
|
11
11
|
import { useViewsMenu } from './hooks/useViewsMenu';
|
|
12
12
|
function ViewsMenu({ onViewChange, templates, onCreateCustomView, onEditCustomView, onDeleteCustomView, onUpdateDefaultView, tableMode = 'default', lang = 'en', }) {
|
|
13
|
-
var _a;
|
|
14
13
|
const { t } = useTranslation();
|
|
15
|
-
const [modifiedModes, setModifiedModes] = useState({});
|
|
16
14
|
const { defaultColumns, defaultTemplate, customViews, allTemplates, baseDefaultColumns } = useViewsManager({
|
|
17
15
|
tableMode,
|
|
18
16
|
templates,
|
|
@@ -32,10 +30,7 @@ function ViewsMenu({ onViewChange, templates, onCreateCustomView, onEditCustomVi
|
|
|
32
30
|
if (!(defaultTemplate === null || defaultTemplate === void 0 ? void 0 : defaultTemplate.id))
|
|
33
31
|
return;
|
|
34
32
|
onUpdateDefaultView === null || onUpdateDefaultView === void 0 ? void 0 : onUpdateDefaultView(columns);
|
|
35
|
-
|
|
36
|
-
}, [
|
|
37
|
-
return (_jsxs(_Fragment, { children: [_jsx(ClickAwayListener, Object.assign({ onClickAway: handleCloseViewDropdown }, { children: _jsxs(ViewWrapper, Object.assign({ sx: { width: '32px' }, "data-testid": "ViewsMenu" }, { children: [_jsx(StyledButton, Object.assign({ title: t('tableView'), "data-testid": "ViewsMenu_button", onClick: handleViewButtonClick }, { children: _jsx(Icon, { src: viewIcon, alt: "view", sx: { width: 14, height: 14 } }) })), _jsx(ViewsDropdown, { open: Boolean(anchorEl), anchorEl: anchorEl, onClose: handleCloseViewDropdown, defaultModified: (_a = modifiedModes[tableMode]) !== null && _a !== void 0 ? _a : false, onMarkDefaultModified: () => {
|
|
38
|
-
setModifiedModes((current) => (Object.assign(Object.assign({}, current), { [tableMode]: true })));
|
|
39
|
-
}, setSelectedViewInfo: handleSelectedViewInfo, selectedViewInfo: selectedViewInfo, onCreateCustomView: handleOpenCreateDialog, customViews: customViews, onEditCustomView: handleOpenEditDialog, onSaveDefaultColumns: handleSaveDefaultColumns, defaultColumns: defaultColumns, updateSelectedView: updateSelectedView, baseDefaultColumns: baseDefaultColumns, mode: tableMode, defaultTemplate: defaultTemplate })] })) })), _jsx(CreateViewDialog, { open: isCreateDialogOpen, onClose: handleCloseCreateDialog, availableColumns: defaultColumns, defaultColumns: defaultColumns, onCreate: handleSaveView, editingView: editingView, onDelete: handleDeleteView, tableViews: shouldUseCurrentState ? initialColumnsForCreate !== null && initialColumnsForCreate !== void 0 ? initialColumnsForCreate : currentViewColumns : undefined, mode: tableMode })] }));
|
|
33
|
+
}, [defaultTemplate, onUpdateDefaultView]);
|
|
34
|
+
return (_jsxs(_Fragment, { children: [_jsx(ClickAwayListener, Object.assign({ onClickAway: handleCloseViewDropdown }, { children: _jsxs(ViewWrapper, Object.assign({ sx: { width: '32px' }, "data-testid": "ViewsMenu" }, { children: [_jsx(StyledButton, Object.assign({ title: t('tableView'), "data-testid": "ViewsMenu_button", onClick: handleViewButtonClick }, { children: _jsx(Icon, { src: viewIcon, alt: "view", sx: { width: 14, height: 14 } }) })), _jsx(ViewsDropdown, { open: Boolean(anchorEl), anchorEl: anchorEl, onClose: handleCloseViewDropdown, setSelectedViewInfo: handleSelectedViewInfo, selectedViewInfo: selectedViewInfo, onCreateCustomView: handleOpenCreateDialog, customViews: customViews, onEditCustomView: handleOpenEditDialog, onSaveDefaultColumns: handleSaveDefaultColumns, defaultColumns: defaultColumns, updateSelectedView: updateSelectedView, baseDefaultColumns: baseDefaultColumns, mode: tableMode, defaultTemplate: defaultTemplate })] })) })), _jsx(CreateViewDialog, { open: isCreateDialogOpen, onClose: handleCloseCreateDialog, availableColumns: defaultColumns, defaultColumns: defaultColumns, onCreate: handleSaveView, editingView: editingView, onDelete: handleDeleteView, tableViews: shouldUseCurrentState ? initialColumnsForCreate !== null && initialColumnsForCreate !== void 0 ? initialColumnsForCreate : currentViewColumns : undefined, mode: tableMode })] }));
|
|
40
35
|
}
|
|
41
36
|
export default memo(ViewsMenu);
|
|
@@ -64,7 +64,10 @@ export const ColumnList = ({ selectedColumns, columnNames, allSelected, someSele
|
|
|
64
64
|
},
|
|
65
65
|
] }, { children: _jsxs(Box, Object.assign({ onMouseEnter: onCancelClose, onMouseLeave: onSubmenuLeave, sx: { display: 'flex', pl: 0.5 } }, { children: [_jsx(Box, { sx: { width: 8, height: '100%', position: 'absolute', left: -8, top: 0, bottom: 0 } }), _jsx(SubmenuPaper, { children: (_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.map((subItem, subItemIndex) => {
|
|
66
66
|
var _a, _b;
|
|
67
|
-
return (_jsxs(React.Fragment, { children: [_jsx(MenuItem, Object.assign({ isSelected: subItem.selected,
|
|
67
|
+
return (_jsxs(React.Fragment, { children: [_jsx(MenuItem, Object.assign({ isSelected: subItem.selected, isDisabled: isDate, onClick: () => {
|
|
68
|
+
if (!isDate)
|
|
69
|
+
onSubItemToggle(column.name, subItem.name);
|
|
70
|
+
} }, { children: subItem.label || subItem.name })), subItemIndex < ((_b = (_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) - 1 && _jsx(Divider, {})] }, subItem.name));
|
|
68
71
|
}) })] })) })))] }), column.name));
|
|
69
72
|
}) })) }))] }));
|
|
70
73
|
};
|
|
@@ -62,7 +62,10 @@ export const ViewsSubmenu = ({ columns, allCurrentSelected, someCurrentSelected,
|
|
|
62
62
|
}
|
|
63
63
|
}, sx: { flex: 1, display: 'flex', alignItems: 'center' } }, { children: _jsx("span", { children: column.label || column.name }) })), hasNestedSubmenu && (_jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', pr: 1, pointerEvents: 'none' } }, { children: _jsx("img", { src: blackRightArrowIcon, alt: "arrow", style: { height: 12 } }) })))] })), hasNestedSubmenu && (_jsx(Popper, Object.assign({ open: hoveredNestedColumn === column.name, anchorEl: nestedSubmenuAnchorEl, placement: "right-start", sx: { zIndex: 10000 } }, { children: _jsxs(Box, Object.assign({ onMouseEnter: cancelNestedClose, onMouseLeave: closeNestedSubmenu, sx: { display: 'flex', pl: 0.5 } }, { children: [_jsx(Box, { sx: { width: 8, height: '100%', position: 'absolute', left: -8, top: 0, bottom: 0 } }), _jsx(SubmenuPaper, { children: (_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.map((subItem, subItemIndex) => {
|
|
64
64
|
var _a, _b;
|
|
65
|
-
return (_jsxs(React.Fragment, { children: [_jsx(MenuItem, Object.assign({ isSelected: subItem.selected,
|
|
65
|
+
return (_jsxs(React.Fragment, { children: [_jsx(MenuItem, Object.assign({ isSelected: subItem.selected, isDisabled: isDate, onClick: () => {
|
|
66
|
+
if (!isDate)
|
|
67
|
+
onNestedItemToggle(column.name, subItem.name);
|
|
68
|
+
} }, { children: subItem.label || subItem.name })), subItemIndex < ((_b = (_a = column.menuItems) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) - 1 && _jsx(Divider, {})] }, subItem.name));
|
|
66
69
|
}) })] })) })))] })), columnIndex < columns.length - 1 && _jsx(Divider, {})] }), column.name));
|
|
67
70
|
}) })) })] }));
|
|
68
71
|
};
|
|
@@ -23,3 +23,17 @@ export declare const DATE_COLUMN_CONFIG: {
|
|
|
23
23
|
readonly isDefaultPinned: true;
|
|
24
24
|
readonly pinnable: true;
|
|
25
25
|
};
|
|
26
|
+
export declare const CUSTOM_TABLE_REQUIRED_COLUMN_LABELS: {
|
|
27
|
+
readonly date: "Date";
|
|
28
|
+
readonly index: "Index";
|
|
29
|
+
};
|
|
30
|
+
export declare const CUSTOM_TABLE_MODE_ALIASES: {
|
|
31
|
+
sheet: string[];
|
|
32
|
+
default: string[];
|
|
33
|
+
text: string[];
|
|
34
|
+
};
|
|
35
|
+
export declare const OTHER_SECTION_CODE: {
|
|
36
|
+
readonly sheet: "Advanced";
|
|
37
|
+
readonly default: "Sheet";
|
|
38
|
+
readonly text: "text";
|
|
39
|
+
};
|
|
@@ -23,3 +23,17 @@ export const DATE_COLUMN_CONFIG = {
|
|
|
23
23
|
isDefaultPinned: true,
|
|
24
24
|
pinnable: true,
|
|
25
25
|
};
|
|
26
|
+
export const CUSTOM_TABLE_REQUIRED_COLUMN_LABELS = {
|
|
27
|
+
date: 'Date',
|
|
28
|
+
index: 'Index',
|
|
29
|
+
};
|
|
30
|
+
export const CUSTOM_TABLE_MODE_ALIASES = {
|
|
31
|
+
sheet: ['sheet'],
|
|
32
|
+
default: ['advanced', 'default'],
|
|
33
|
+
text: ['text'],
|
|
34
|
+
};
|
|
35
|
+
export const OTHER_SECTION_CODE = {
|
|
36
|
+
sheet: 'Advanced',
|
|
37
|
+
default: 'Sheet',
|
|
38
|
+
text: 'text',
|
|
39
|
+
};
|
|
@@ -7,26 +7,47 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
11
|
-
import {
|
|
12
|
-
import { handleTemplateUpdate,
|
|
10
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
11
|
+
import { OTHER_SECTION_CODE } from '../constants';
|
|
12
|
+
import { handleTemplateUpdate, mapColumnsToLayoutSection, convertTemplateToColumnsView, convertTemplatesToColumnsView, isTemplateMatchingId, replaceTemplateInList, updateCurrentTemplate, addRequiredColumns, hasLayoutSectionForMode, updateColumnSelection, } from '../utils';
|
|
13
13
|
export function useCustomTableViews({ templates, setTemplates, createTemplate, updateTemplate, deleteTemplate, tableMode, lang = 'en', columnModifiers, }) {
|
|
14
|
-
const [
|
|
14
|
+
const [selectedTemplateId, setSelectedTemplateId] = useState(undefined);
|
|
15
|
+
const defaultTemplate = useMemo(() => { var _a; return (_a = templates.find((t) => t.default)) !== null && _a !== void 0 ? _a : templates[0]; }, [templates]);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (!defaultTemplate)
|
|
18
|
+
setSelectedTemplateId(undefined);
|
|
19
|
+
}, [defaultTemplate]);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (defaultTemplate && !selectedTemplateId)
|
|
22
|
+
setSelectedTemplateId(defaultTemplate.id);
|
|
23
|
+
}, [defaultTemplate, selectedTemplateId]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (!selectedTemplateId)
|
|
26
|
+
return;
|
|
27
|
+
const isSelectedTemplateExists = templates.some((t) => isTemplateMatchingId(t, selectedTemplateId));
|
|
28
|
+
if (!isSelectedTemplateExists)
|
|
29
|
+
setSelectedTemplateId(defaultTemplate === null || defaultTemplate === void 0 ? void 0 : defaultTemplate.id);
|
|
30
|
+
}, [templates, selectedTemplateId, defaultTemplate === null || defaultTemplate === void 0 ? void 0 : defaultTemplate.id]);
|
|
15
31
|
const onCreateCustomView = useCallback(({ name, layout }) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var _a;
|
|
32
|
+
var _a, _b, _c, _d;
|
|
17
33
|
const created = yield createTemplate({ name, layout: [layout] });
|
|
18
34
|
if (created) {
|
|
19
|
-
const
|
|
35
|
+
const otherCode = (_a = OTHER_SECTION_CODE[tableMode]) !== null && _a !== void 0 ? _a : OTHER_SECTION_CODE.default;
|
|
36
|
+
const hasOtherSection = (_b = created.layout) === null || _b === void 0 ? void 0 : _b.some((s) => { var _a; return ((_a = s.code) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === otherCode.toLowerCase(); });
|
|
37
|
+
const templateWithOtherLayout = hasOtherSection
|
|
38
|
+
? created
|
|
39
|
+
: Object.assign(Object.assign({}, created), { layout: [...((_c = created.layout) !== null && _c !== void 0 ? _c : []), { code: otherCode, columns: [] }] });
|
|
40
|
+
const normalized = handleTemplateUpdate(templateWithOtherLayout);
|
|
20
41
|
setTemplates((prev) => [...prev, normalized]);
|
|
21
|
-
|
|
22
|
-
return { id: created.id, name: (
|
|
42
|
+
setSelectedTemplateId(normalized.id);
|
|
43
|
+
return { id: created.id, name: (_d = created.name) !== null && _d !== void 0 ? _d : '' };
|
|
23
44
|
}
|
|
24
45
|
}), [createTemplate, setTemplates, tableMode]);
|
|
25
46
|
const onDeleteCustomView = useCallback((templateId) => __awaiter(this, void 0, void 0, function* () {
|
|
26
47
|
yield deleteTemplate(templateId);
|
|
27
48
|
setTemplates((prev) => prev.filter((t) => !isTemplateMatchingId(t, templateId)));
|
|
28
|
-
|
|
29
|
-
}), [deleteTemplate, setTemplates]);
|
|
49
|
+
setSelectedTemplateId((current) => (current === templateId ? defaultTemplate === null || defaultTemplate === void 0 ? void 0 : defaultTemplate.id : current));
|
|
50
|
+
}), [deleteTemplate, setTemplates, defaultTemplate]);
|
|
30
51
|
const onUpdateDefaultView = useCallback((columns) => {
|
|
31
52
|
const defaultTemplate = templates.find((t) => t.default);
|
|
32
53
|
if (!defaultTemplate)
|
|
@@ -43,9 +64,9 @@ export function useCustomTableViews({ templates, setTemplates, createTemplate, u
|
|
|
43
64
|
if (updated) {
|
|
44
65
|
const normalized = handleTemplateUpdate(updated);
|
|
45
66
|
setTemplates((prev) => replaceTemplateInList(prev, (t) => isTemplateMatchingId(t, viewId), normalized));
|
|
46
|
-
|
|
67
|
+
setSelectedTemplateId(normalized.id);
|
|
47
68
|
}
|
|
48
|
-
}), [templates,
|
|
69
|
+
}), [templates, updateTemplate, setTemplates]);
|
|
49
70
|
const customViews = useMemo(() => ({
|
|
50
71
|
templates,
|
|
51
72
|
onCreateCustomView,
|
|
@@ -54,51 +75,27 @@ export function useCustomTableViews({ templates, setTemplates, createTemplate, u
|
|
|
54
75
|
onUpdateDefaultView,
|
|
55
76
|
}), [templates, onCreateCustomView, onEditCustomView, onDeleteCustomView, onUpdateDefaultView]);
|
|
56
77
|
const onViewChange = useCallback((view) => {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
name: menuItem.name,
|
|
70
|
-
selected: menuItem.selected,
|
|
71
|
-
})),
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
const columnsSignature = (_b = selectedView.columns) !== null && _b !== void 0 ? _b : [];
|
|
75
|
-
const viewWithLayout = selectedView;
|
|
76
|
-
const layoutSignature = ((_c = viewWithLayout.layout) !== null && _c !== void 0 ? _c : []).map((layout) => {
|
|
77
|
-
var _a;
|
|
78
|
-
return ({
|
|
79
|
-
code: layout.code,
|
|
80
|
-
columns: ((_a = layout.columns) !== null && _a !== void 0 ? _a : []).map((col) => col.code),
|
|
81
|
-
});
|
|
82
|
-
});
|
|
83
|
-
return JSON.stringify({
|
|
84
|
-
id: selectedView.id,
|
|
85
|
-
columns: columnsSignature,
|
|
86
|
-
submenu: submenuSignature,
|
|
87
|
-
layout: layoutSignature,
|
|
88
|
-
});
|
|
89
|
-
}, [selectedView]);
|
|
78
|
+
var _a;
|
|
79
|
+
if (!defaultTemplate) {
|
|
80
|
+
setSelectedTemplateId(undefined);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!(view === null || view === void 0 ? void 0 : view.id) || view.id === 'default') {
|
|
84
|
+
setSelectedTemplateId(defaultTemplate.id);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const matchingTemplate = templates.find((t) => isTemplateMatchingId(t, view.id));
|
|
88
|
+
setSelectedTemplateId((_a = matchingTemplate === null || matchingTemplate === void 0 ? void 0 : matchingTemplate.id) !== null && _a !== void 0 ? _a : defaultTemplate.id);
|
|
89
|
+
}, [templates, defaultTemplate]);
|
|
90
90
|
const columnsViewData = useMemo(() => {
|
|
91
|
-
|
|
91
|
+
var _a;
|
|
92
|
+
const selectedTemplate = (_a = templates.find((t) => (selectedTemplateId ? isTemplateMatchingId(t, selectedTemplateId) : false))) !== null && _a !== void 0 ? _a : defaultTemplate;
|
|
92
93
|
let templateColumnsView = [];
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
templateColumnsView = convertTemplateToColumnsView(viewWithLayout, tableMode);
|
|
97
|
-
if (templateColumnsView.length === 0 && !hasLayout && (templates === null || templates === void 0 ? void 0 : templates.length) > 0) {
|
|
98
|
-
templateColumnsView = convertTemplatesToColumnsView(templates, tableMode);
|
|
99
|
-
}
|
|
94
|
+
const hasSelectedModeLayoutSection = hasLayoutSectionForMode(selectedTemplate, tableMode);
|
|
95
|
+
if (selectedTemplate) {
|
|
96
|
+
templateColumnsView = convertTemplateToColumnsView(selectedTemplate, tableMode);
|
|
100
97
|
}
|
|
101
|
-
if (templateColumnsView.length === 0 &&
|
|
98
|
+
if (templateColumnsView.length === 0 && (templates === null || templates === void 0 ? void 0 : templates.length) > 0 && !hasSelectedModeLayoutSection) {
|
|
102
99
|
templateColumnsView = convertTemplatesToColumnsView(templates, tableMode);
|
|
103
100
|
}
|
|
104
101
|
if (templateColumnsView.length === 0) {
|
|
@@ -113,14 +110,14 @@ export function useCustomTableViews({ templates, setTemplates, createTemplate, u
|
|
|
113
110
|
selected: mod.selected,
|
|
114
111
|
});
|
|
115
112
|
}
|
|
116
|
-
return result;
|
|
113
|
+
return addRequiredColumns(result, tableMode);
|
|
117
114
|
}
|
|
118
|
-
return templateColumnsView;
|
|
119
|
-
}, [tableMode, templates,
|
|
115
|
+
return addRequiredColumns(templateColumnsView, tableMode);
|
|
116
|
+
}, [tableMode, templates, selectedTemplateId, defaultTemplate, columnModifiers]);
|
|
120
117
|
return {
|
|
121
118
|
customViews,
|
|
122
119
|
onViewChange,
|
|
123
120
|
columnsViewData,
|
|
124
|
-
selectedViewId:
|
|
121
|
+
selectedViewId: selectedTemplateId,
|
|
125
122
|
};
|
|
126
123
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { useMemo, useRef } from 'react';
|
|
2
2
|
import { mapTemplatesToMenuItems, deepCloneColumns } from '../utils';
|
|
3
3
|
export const useViewsManager = ({ tableMode, templates, lang = 'en' }) => {
|
|
4
|
+
var _a;
|
|
5
|
+
const initialDefaultColumnsRef = useRef({});
|
|
4
6
|
const parsedData = useMemo(() => {
|
|
5
7
|
if (!templates || templates.length === 0) {
|
|
6
8
|
return {
|
|
@@ -19,6 +21,9 @@ export const useViewsManager = ({ tableMode, templates, lang = 'en' }) => {
|
|
|
19
21
|
defaultColumns,
|
|
20
22
|
};
|
|
21
23
|
}, [templates, tableMode, lang]);
|
|
24
|
+
if (!initialDefaultColumnsRef.current[tableMode] && parsedData.defaultColumns.length > 0) {
|
|
25
|
+
initialDefaultColumnsRef.current[tableMode] = parsedData.defaultColumns;
|
|
26
|
+
}
|
|
22
27
|
return {
|
|
23
28
|
menuItems: parsedData.menuItems,
|
|
24
29
|
defaultItem: parsedData.defaultItem,
|
|
@@ -27,6 +32,6 @@ export const useViewsManager = ({ tableMode, templates, lang = 'en' }) => {
|
|
|
27
32
|
customViews: parsedData.menuItems,
|
|
28
33
|
defaultTemplate: parsedData.defaultItem,
|
|
29
34
|
allTemplates: parsedData.allItems,
|
|
30
|
-
baseDefaultColumns: parsedData.defaultColumns,
|
|
35
|
+
baseDefaultColumns: (_a = initialDefaultColumnsRef.current[tableMode]) !== null && _a !== void 0 ? _a : parsedData.defaultColumns,
|
|
31
36
|
};
|
|
32
37
|
};
|
|
@@ -98,16 +98,26 @@ export const useViewsMenu = ({ mode, onViewChange, onCreateCustomView, onEditCus
|
|
|
98
98
|
setAnchorEl(null);
|
|
99
99
|
}, []);
|
|
100
100
|
const handleOpenEditDialog = useCallback((view) => {
|
|
101
|
-
|
|
101
|
+
var _a;
|
|
102
|
+
const latestView = (_a = allTemplates.find((templateView) => templateView.id === view.id)) !== null && _a !== void 0 ? _a : view;
|
|
103
|
+
setEditingView(latestView);
|
|
102
104
|
setShouldUseCurrentState(true);
|
|
103
105
|
setIsCreateDialogOpen(true);
|
|
104
|
-
}, []);
|
|
106
|
+
}, [allTemplates]);
|
|
105
107
|
const handleCloseCreateDialog = useCallback(() => {
|
|
106
108
|
setIsCreateDialogOpen(false);
|
|
107
109
|
setEditingView(null);
|
|
108
110
|
setShouldUseCurrentState(false);
|
|
109
111
|
setInitialColumnsForCreate(null);
|
|
110
112
|
}, []);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!isCreateDialogOpen || !(editingView === null || editingView === void 0 ? void 0 : editingView.id))
|
|
115
|
+
return;
|
|
116
|
+
const latestEditingView = allTemplates.find((view) => view.id === editingView.id);
|
|
117
|
+
if (latestEditingView) {
|
|
118
|
+
setEditingView(latestEditingView);
|
|
119
|
+
}
|
|
120
|
+
}, [isCreateDialogOpen, editingView === null || editingView === void 0 ? void 0 : editingView.id, allTemplates]);
|
|
111
121
|
const handleSaveView = useCallback((data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
122
|
if (editingView) {
|
|
113
123
|
const viewId = editingView.id;
|
|
@@ -125,8 +125,6 @@ export interface ViewsDropdownProps {
|
|
|
125
125
|
setSelectedViewInfo: (selected: ViewOption, viewMenuItem?: ViewMenuItem) => void;
|
|
126
126
|
anchorEl: Element | null;
|
|
127
127
|
onClose?: () => void;
|
|
128
|
-
defaultModified?: boolean;
|
|
129
|
-
onMarkDefaultModified?: () => void;
|
|
130
128
|
onCreateCustomView?: (useCurrentState?: boolean, initialColumns?: ColumnViewProps[]) => void;
|
|
131
129
|
customViews?: ViewMenuItem[];
|
|
132
130
|
onEditCustomView?: (view: ViewMenuItem) => void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ColumnsView, TableMode } from '../../../../types/index.js';
|
|
2
|
+
import type { Template } from '../types';
|
|
3
|
+
export declare const getLayoutCodesForMode: (mode: TableMode) => string[];
|
|
4
|
+
export declare const getOtherModeSectionCode: (mode: TableMode) => string;
|
|
5
|
+
export declare const buildRequiredColumnView: (code: 'date' | 'index', sortOrder: number) => {
|
|
6
|
+
code: "date" | "index";
|
|
7
|
+
name: {
|
|
8
|
+
text: "Date" | "Index";
|
|
9
|
+
lang: string;
|
|
10
|
+
}[];
|
|
11
|
+
selected: boolean;
|
|
12
|
+
sort_order: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const addRequiredColumns: (columns: ColumnsView[], mode: TableMode) => ColumnsView[];
|
|
15
|
+
export declare const hasLayoutSectionForMode: (template: Template | undefined, mode: TableMode) => boolean;
|
|
16
|
+
export declare const updateColumnSelection: ({ columnsViewData, columnsName, selected, }: {
|
|
17
|
+
columnsViewData: ColumnsView[];
|
|
18
|
+
columnsName: string[];
|
|
19
|
+
selected: boolean;
|
|
20
|
+
}) => ColumnsView[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CUSTOM_TABLE_MODE_ALIASES, OTHER_SECTION_CODE, CUSTOM_TABLE_REQUIRED_COLUMN_LABELS } from '../constants';
|
|
2
|
+
import { isTableSheetMode } from '../../../../utils/index.js';
|
|
3
|
+
const getColumnKey = (column) => { var _a, _b, _c, _d; return (_d = ((_a = column.code) !== null && _a !== void 0 ? _a : (_c = (_b = column.name) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.text)) === null || _d === void 0 ? void 0 : _d.toLowerCase(); };
|
|
4
|
+
export const getLayoutCodesForMode = (mode) => { var _a; return [...((_a = CUSTOM_TABLE_MODE_ALIASES[mode]) !== null && _a !== void 0 ? _a : CUSTOM_TABLE_MODE_ALIASES.default)]; };
|
|
5
|
+
export const getOtherModeSectionCode = (mode) => { var _a; return (_a = OTHER_SECTION_CODE[mode]) !== null && _a !== void 0 ? _a : OTHER_SECTION_CODE.default; };
|
|
6
|
+
export const buildRequiredColumnView = (code, sortOrder) => ({
|
|
7
|
+
code,
|
|
8
|
+
name: [{ text: CUSTOM_TABLE_REQUIRED_COLUMN_LABELS[code], lang: 'en' }],
|
|
9
|
+
selected: true,
|
|
10
|
+
sort_order: sortOrder,
|
|
11
|
+
});
|
|
12
|
+
export const addRequiredColumns = (columns, mode) => {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const updatedColumns = [...columns];
|
|
15
|
+
const existingDate = updatedColumns.find((column) => getColumnKey(column) === 'date');
|
|
16
|
+
const dateColumn = existingDate ? Object.assign(Object.assign({}, existingDate), { code: (_a = existingDate.code) !== null && _a !== void 0 ? _a : 'date', selected: true }) : buildRequiredColumnView('date', 1);
|
|
17
|
+
const existingIndex = updatedColumns.find((column) => getColumnKey(column) === 'index');
|
|
18
|
+
const indexColumn = isTableSheetMode(mode)
|
|
19
|
+
? existingIndex
|
|
20
|
+
? Object.assign(Object.assign({}, existingIndex), { code: (_b = existingIndex.code) !== null && _b !== void 0 ? _b : 'index', selected: true }) : buildRequiredColumnView('index', 0)
|
|
21
|
+
: undefined;
|
|
22
|
+
const restColumns = updatedColumns.filter((column) => {
|
|
23
|
+
const key = getColumnKey(column);
|
|
24
|
+
return key !== 'index' && key !== 'date';
|
|
25
|
+
});
|
|
26
|
+
const orderedColumns = isTableSheetMode(mode) ? [indexColumn, dateColumn, ...restColumns] : [dateColumn, ...restColumns];
|
|
27
|
+
return orderedColumns.filter((column) => Boolean(column));
|
|
28
|
+
};
|
|
29
|
+
export const hasLayoutSectionForMode = (template, mode) => { var _a, _b; return (_b = (_a = template === null || template === void 0 ? void 0 : template.layout) === null || _a === void 0 ? void 0 : _a.some((section) => { var _a, _b; return getLayoutCodesForMode(mode).includes((_b = (_a = section.code) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : ''); })) !== null && _b !== void 0 ? _b : false; };
|
|
30
|
+
export const updateColumnSelection = ({ columnsViewData, columnsName, selected, }) => columnsViewData.map((column) => { var _a; return (columnsName.includes((_a = column.name[0]) === null || _a === void 0 ? void 0 : _a.text) ? Object.assign(Object.assign({}, column), { selected }) : column); });
|
|
@@ -4,3 +4,4 @@ export { getColumnCheckState, toggleColumn, toggleSubItem, toggleAllColumns, are
|
|
|
4
4
|
export { getSubmenuFromTemplateLayout, getColumnOrder, handleTemplateUpdate, templateToViewMenuItem, convertTemplateToColumnsView, convertTemplatesToColumnsView, } from './templateToColumnsView';
|
|
5
5
|
export { isTemplateMatchingId, replaceTemplateInList, updateCurrentTemplate } from './templateState';
|
|
6
6
|
export type { TemplateLike } from './templateState';
|
|
7
|
+
export { getLayoutCodesForMode, getOtherModeSectionCode, buildRequiredColumnView, addRequiredColumns, hasLayoutSectionForMode, updateColumnSelection, } from './customTableViews';
|
|
@@ -3,3 +3,4 @@ export { createCustomViewMenuItem, setViewAsDefault, transformTemplatesToViewMen
|
|
|
3
3
|
export { getColumnCheckState, toggleColumn, toggleSubItem, toggleAllColumns, areAllColumnsSelected, areSomeColumnsSelected, isValidTemplateName, deepCloneColumns, toggleSingleColumn, toggleAllCurrentColumns, areAllCurrentColumnsSelected, areSomeCurrentColumnsSelected, normalizeColumnsSelected, areColumnsEqual, resetColumnsToDefault, initializeEditingColumns, initializeCreateColumns, initializeCreateColumnsWithCurrentState, } from './columnState';
|
|
4
4
|
export { getSubmenuFromTemplateLayout, getColumnOrder, handleTemplateUpdate, templateToViewMenuItem, convertTemplateToColumnsView, convertTemplatesToColumnsView, } from './templateToColumnsView';
|
|
5
5
|
export { isTemplateMatchingId, replaceTemplateInList, updateCurrentTemplate } from './templateState';
|
|
6
|
+
export { getLayoutCodesForMode, getOtherModeSectionCode, buildRequiredColumnView, addRequiredColumns, hasLayoutSectionForMode, updateColumnSelection, } from './customTableViews';
|
|
@@ -23,7 +23,8 @@ export const transformTemplatesToViewMenuItems = (templates, mode = 'sheet', lan
|
|
|
23
23
|
const withDate = columns.some((c) => { var _a; return ((_a = c.name) !== null && _a !== void 0 ? _a : '').toLowerCase() === 'date'; }) ? columns : [dateColumn, ...columns];
|
|
24
24
|
const dateIndex = withDate.findIndex((c) => { var _a; return ((_a = c.name) !== null && _a !== void 0 ? _a : '').toLowerCase() === 'date'; });
|
|
25
25
|
const withDateFirst = dateIndex > 0 ? [withDate[dateIndex], ...withDate.filter((c) => { var _a; return ((_a = c.name) !== null && _a !== void 0 ? _a : '').toLowerCase() !== 'date'; })] : withDate;
|
|
26
|
-
const
|
|
26
|
+
const withoutIndex = withDateFirst.filter((c) => { var _a; return ((_a = c.name) !== null && _a !== void 0 ? _a : '').toLowerCase() !== 'index'; });
|
|
27
|
+
const finalColumns = [indexColumn, ...withoutIndex];
|
|
27
28
|
const item = {
|
|
28
29
|
id: template.default ? 'default' : viewId,
|
|
29
30
|
label: template.name,
|
|
@@ -10,7 +10,7 @@ export declare const StyledHeader: import("@emotion/styled").StyledComponent<imp
|
|
|
10
10
|
}, {}, {}>;
|
|
11
11
|
export declare const StyledMUITableRow: import("@emotion/styled").StyledComponent<import("@mui/material/TableRow").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
12
12
|
ref?: ((instance: HTMLTableRowElement | null) => void) | import("react").RefObject<HTMLTableRowElement> | null | undefined;
|
|
13
|
-
}, "classes" | "className" | "style" | "children" | "
|
|
13
|
+
}, "classes" | "className" | "style" | "children" | "sx" | "selected" | "hover"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
14
14
|
component: string;
|
|
15
15
|
}, {}, {}>;
|
|
16
16
|
export declare const SheetViewVirtualTableWrapper: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -6,7 +6,7 @@ export declare const StyledHeader: import("@emotion/styled").StyledComponent<imp
|
|
|
6
6
|
}, {}, {}>;
|
|
7
7
|
export declare const StyledMUITableRow: import("@emotion/styled").StyledComponent<import("@mui/material/TableRow").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
8
8
|
ref?: ((instance: HTMLTableRowElement | null) => void) | import("react").RefObject<HTMLTableRowElement> | null | undefined;
|
|
9
|
-
}, "classes" | "className" | "style" | "children" | "
|
|
9
|
+
}, "classes" | "className" | "style" | "children" | "sx" | "selected" | "hover"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
10
10
|
isSheetView?: boolean | undefined;
|
|
11
11
|
component: string;
|
|
12
12
|
}, {}, {}>;
|
|
@@ -32,7 +32,7 @@ export declare const StyledVirtualList: import("@emotion/styled").StyledComponen
|
|
|
32
32
|
} & import("react").RefAttributes<import("react-window").VariableSizeList<any>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & StyledVirtualListProps, {}, {}>;
|
|
33
33
|
export declare const StyledTableRow: import("@emotion/styled").StyledComponent<import("@mui/material").TableRowOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLTableRowElement>, HTMLTableRowElement>, "ref"> & {
|
|
34
34
|
ref?: ((instance: HTMLTableRowElement | null) => void) | import("react").RefObject<HTMLTableRowElement> | null | undefined;
|
|
35
|
-
}, "classes" | "className" | "style" | "children" | "
|
|
35
|
+
}, "classes" | "className" | "style" | "children" | "sx" | "selected" | "hover"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
36
36
|
showShadowHighlight?: boolean | undefined;
|
|
37
37
|
showLoadedStyle?: boolean | undefined;
|
|
38
38
|
isSheetView?: boolean | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { APP_CODES } from './apps';
|
|
2
|
-
import { acceptanceAppIcon,
|
|
2
|
+
import { acceptanceAppIcon, billingAppIcon, payoutsAppIcon, walletAppIcon } from './assets';
|
|
3
3
|
/**
|
|
4
4
|
* Backend report filter types (used by reports APIs)
|
|
5
5
|
*
|
|
@@ -23,8 +23,6 @@ export const REPORT_FILTER_TYPES = {
|
|
|
23
23
|
PAYOUT: 'PAYOUT',
|
|
24
24
|
MERCHANT_PAYOUT: 'MERCHANT_PAYOUT',
|
|
25
25
|
RETAILER_PAYOUT: 'RETAILER_PAYOUT',
|
|
26
|
-
// Authentication
|
|
27
|
-
AUTHENTICATION: 'AUTHENTICATION',
|
|
28
26
|
};
|
|
29
27
|
/**
|
|
30
28
|
* Maps report **source codes** (app or service)
|
|
@@ -63,8 +61,6 @@ export const reportFilterTypesMap = {
|
|
|
63
61
|
[APP_CODES.payouts.services.merchantPayout.code]: [REPORT_FILTER_TYPES.MERCHANT_PAYOUT],
|
|
64
62
|
[APP_CODES.payouts.services.retailerPayout.code]: [REPORT_FILTER_TYPES.RETAILER_PAYOUT],
|
|
65
63
|
[APP_CODES.payouts.code]: [REPORT_FILTER_TYPES.PAYOUT, REPORT_FILTER_TYPES.MERCHANT_PAYOUT, REPORT_FILTER_TYPES.RETAILER_PAYOUT],
|
|
66
|
-
// Authentication
|
|
67
|
-
[APP_CODES.authentication.code]: [REPORT_FILTER_TYPES.AUTHENTICATION],
|
|
68
64
|
};
|
|
69
65
|
/**
|
|
70
66
|
* Reports apps
|
|
@@ -110,10 +106,4 @@ export const REPORTS_APPS = [
|
|
|
110
106
|
{ name: 'Retailer Payouts', code: APP_CODES.payouts.services.retailerPayout.code },
|
|
111
107
|
],
|
|
112
108
|
},
|
|
113
|
-
{
|
|
114
|
-
code: APP_CODES.authentication.code,
|
|
115
|
-
name: 'Authentication',
|
|
116
|
-
icon: authenticationAppIcon,
|
|
117
|
-
services: [{ name: 'Authentication', code: APP_CODES.authentication.services.authentication.code }],
|
|
118
|
-
},
|
|
119
109
|
];
|
package/build/utils/columns.d.ts
CHANGED
|
@@ -9,8 +9,3 @@ export declare function filterShownColumns<T>(columns: Array<IColumnProps<T & {
|
|
|
9
9
|
export declare function isParameterSelected(columns: ColumnViewProps[], columnId: string, parameter: string): boolean;
|
|
10
10
|
export declare function mapDataToViews(columnData?: ColumnsView[], language?: string): ColumnViewProps[];
|
|
11
11
|
export declare function mapViewsToData(columns: ColumnViewProps[]): ColumnsView[];
|
|
12
|
-
export declare const updateColumnSelection: ({ columnsViewData, columnsName, selected, }: {
|
|
13
|
-
columnsViewData: ColumnsView[];
|
|
14
|
-
columnsName: string[];
|
|
15
|
-
selected: boolean;
|
|
16
|
-
}) => ColumnsView[];
|
package/build/utils/columns.js
CHANGED
|
@@ -32,14 +32,13 @@ export function isParameterSelected(columns, columnId, parameter) {
|
|
|
32
32
|
export function mapDataToViews(columnData, language) {
|
|
33
33
|
var _a;
|
|
34
34
|
return (((_a = columnData === null || columnData === void 0 ? void 0 : columnData.filter((c) => { var _a, _b; return !!((_b = (_a = c.name) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.text); })) === null || _a === void 0 ? void 0 : _a.map((column) => {
|
|
35
|
-
var _a;
|
|
35
|
+
var _a, _b, _c;
|
|
36
36
|
return ({
|
|
37
37
|
code: column.code,
|
|
38
38
|
label: getNameText(column.name, language),
|
|
39
39
|
name: getNameText(column.name, language) || '',
|
|
40
40
|
selected: (column === null || column === void 0 ? void 0 : column.selected) !== false,
|
|
41
|
-
menuItems: (_a = column.fields
|
|
42
|
-
.map((field) => {
|
|
41
|
+
menuItems: (_c = (_b = (_a = column.fields) === null || _a === void 0 ? void 0 : _a.map((field) => {
|
|
43
42
|
var _a, _b;
|
|
44
43
|
return (_b = (_a = field.parameters) === null || _a === void 0 ? void 0 : _a.filter((p) => !!p.code)) === null || _b === void 0 ? void 0 : _b.map((param) => {
|
|
45
44
|
return {
|
|
@@ -48,8 +47,7 @@ export function mapDataToViews(columnData, language) {
|
|
|
48
47
|
selected: (param === null || param === void 0 ? void 0 : param.selected) !== false,
|
|
49
48
|
};
|
|
50
49
|
});
|
|
51
|
-
})
|
|
52
|
-
.flat()) === null || _a === void 0 ? void 0 : _a.filter((item) => !!item.name),
|
|
50
|
+
})) === null || _b === void 0 ? void 0 : _b.flat()) === null || _c === void 0 ? void 0 : _c.filter((item) => !!item.name),
|
|
53
51
|
});
|
|
54
52
|
})) || []);
|
|
55
53
|
}
|
|
@@ -71,12 +69,3 @@ export function mapViewsToData(columns) {
|
|
|
71
69
|
})) || [] });
|
|
72
70
|
});
|
|
73
71
|
}
|
|
74
|
-
export const updateColumnSelection = ({ columnsViewData, columnsName, selected, }) => {
|
|
75
|
-
return columnsViewData.map((column) => {
|
|
76
|
-
var _a;
|
|
77
|
-
if (columnsName.includes((_a = column.name[0]) === null || _a === void 0 ? void 0 : _a.text)) {
|
|
78
|
-
return Object.assign(Object.assign({}, column), { selected });
|
|
79
|
-
}
|
|
80
|
-
return column;
|
|
81
|
-
});
|
|
82
|
-
};
|
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.438-test.
|
|
5
|
-
"testVersion":
|
|
4
|
+
"version": "0.1.438-test.26",
|
|
5
|
+
"testVersion": 26,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|