@tap-payments/os-micro-frontend-shared 0.1.438-test.30 → 0.1.438-test.31
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/utils/columns.d.ts +6 -6
- package/build/utils/columns.js +12 -5
- package/package.json +2 -2
package/build/utils/columns.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { IColumnProps, ColumnViewProps, ColumnsView } from '../types/index.js';
|
|
2
|
-
export declare function
|
|
3
|
-
columnsViewData: ColumnsView[];
|
|
4
|
-
columnsName: string[];
|
|
5
|
-
selected: boolean;
|
|
6
|
-
}): ColumnsView[];
|
|
7
|
-
export declare function filterShownColumns(columns: IColumnProps[], tableViews: ColumnViewProps[]): IColumnProps<any>[];
|
|
2
|
+
export declare function filterShownColumns(columns: IColumnProps[], tableViews: ColumnViewProps[], isCustomView?: boolean): IColumnProps<any>[];
|
|
8
3
|
export declare function isParameterSelected(columns: ColumnViewProps[], columnId: string, parameter: string): boolean;
|
|
9
4
|
export declare function mapDataToViews(columnData?: ColumnsView[], language?: string): ColumnViewProps[];
|
|
10
5
|
export declare function mapViewsToData(columns: ColumnViewProps[]): ColumnsView[];
|
|
6
|
+
export declare const updateColumnSelection: ({ columnsViewData, columnsName, selected, }: {
|
|
7
|
+
columnsViewData: ColumnsView[];
|
|
8
|
+
columnsName: string[];
|
|
9
|
+
selected: boolean;
|
|
10
|
+
}) => ColumnsView[];
|
package/build/utils/columns.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import startCase from 'lodash/startCase';
|
|
2
2
|
import { getNameText } from './index.js';
|
|
3
|
-
export function
|
|
4
|
-
return 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); });
|
|
5
|
-
}
|
|
6
|
-
export function filterShownColumns(columns, tableViews) {
|
|
3
|
+
export function filterShownColumns(columns, tableViews, isCustomView) {
|
|
7
4
|
return columns.filter((column) => {
|
|
8
5
|
var _a, _b, _c, _d, _e;
|
|
9
6
|
const columnId = (_a = column === null || column === void 0 ? void 0 : column.id) === null || _a === void 0 ? void 0 : _a.toString();
|
|
@@ -16,7 +13,8 @@ export function filterShownColumns(columns, tableViews) {
|
|
|
16
13
|
const isColumnWithMenuItems = !!column.tableViewId && (((_b = selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.menuItems) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0;
|
|
17
14
|
const isMenuItemSelected = (_d = (_c = selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.menuItems) === null || _c === void 0 ? void 0 : _c.find((item) => { var _a, _b, _c; return ((_a = item.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_c = (_b = column.tableViewId) === null || _b === void 0 ? void 0 : _b.toString()) === null || _c === void 0 ? void 0 : _c.toLowerCase()); })) === null || _d === void 0 ? void 0 : _d.selected;
|
|
18
15
|
const isColumnSelected = !!selectedColumn && (isMenuItemSelected || !isColumnWithMenuItems);
|
|
19
|
-
const
|
|
16
|
+
const customViewFixedColumns = isCustomView ? ['index', 'date'] : [];
|
|
17
|
+
const isBasicColumn = ['actions', 'action_icon', ...customViewFixedColumns].includes((_e = columnId === null || columnId === void 0 ? void 0 : columnId.toLowerCase()) !== null && _e !== void 0 ? _e : '');
|
|
20
18
|
if (isColumnSelected || isBasicColumn) {
|
|
21
19
|
return true;
|
|
22
20
|
}
|
|
@@ -72,3 +70,12 @@ export function mapViewsToData(columns) {
|
|
|
72
70
|
})) || [] });
|
|
73
71
|
});
|
|
74
72
|
}
|
|
73
|
+
export const updateColumnSelection = ({ columnsViewData, columnsName, selected, }) => {
|
|
74
|
+
return columnsViewData.map((column) => {
|
|
75
|
+
var _a;
|
|
76
|
+
if (columnsName.includes((_a = column.name[0]) === null || _a === void 0 ? void 0 : _a.text)) {
|
|
77
|
+
return Object.assign(Object.assign({}, column), { selected });
|
|
78
|
+
}
|
|
79
|
+
return column;
|
|
80
|
+
});
|
|
81
|
+
};
|
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.31",
|
|
5
|
+
"testVersion": 31,
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "build/index.js",
|
|
8
8
|
"module": "build/index.js",
|