@tap-payments/os-micro-frontend-shared 0.1.431-test.2 → 0.1.431-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.
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
2
2
  import { TextAndLang } from './common';
3
3
  import { SxProps, Theme } from '@mui/material/styles';
4
4
  export interface ColumnsView {
5
+ code?: string;
5
6
  name: TextAndLang[];
6
7
  sorting?: 'ascending' | 'descending';
7
8
  sort_order: number;
@@ -30,6 +31,7 @@ export interface ColumnsView {
30
31
  }>;
31
32
  }
32
33
  export interface ColumnViewProps {
34
+ code?: string;
33
35
  label?: string | null | ReactNode;
34
36
  name: string;
35
37
  icon?: ReactNode;
@@ -3,11 +3,17 @@ import { getNameText } from './index.js';
3
3
  export function filterShownColumns(columns, tableViews) {
4
4
  return columns.filter((column) => {
5
5
  var _a, _b, _c, _d, _e;
6
- const selectedColumn = tableViews.find((view) => { var _a; return ((_a = view.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (column === null || column === void 0 ? void 0 : column.id) && view.selected; });
7
- const isColumnWithMenuItems = !!column.tableViewId && (((_a = selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.menuItems) === null || _a === void 0 ? void 0 : _a.length) || 0) > 1;
8
- const isMenuItemSelected = (_c = (_b = selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.menuItems) === null || _b === void 0 ? void 0 : _b.find((item) => item.name === column.tableViewId)) === null || _c === void 0 ? void 0 : _c.selected;
6
+ const columnId = (_a = column === null || column === void 0 ? void 0 : column.id) === null || _a === void 0 ? void 0 : _a.toString();
7
+ const selectedColumn = tableViews.find((view) => {
8
+ var _a, _b;
9
+ const codeMatch = ((_a = view.code) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (columnId === null || columnId === void 0 ? void 0 : columnId.toLowerCase());
10
+ const nameMatch = ((_b = view.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === (columnId === null || columnId === void 0 ? void 0 : columnId.toLowerCase());
11
+ return (codeMatch || nameMatch) && view.selected;
12
+ });
13
+ const isColumnWithMenuItems = !!column.tableViewId && (((_b = selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.menuItems) === null || _b === void 0 ? void 0 : _b.length) || 0) > 1;
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;
9
15
  const isColumnSelected = !!selectedColumn && (isMenuItemSelected || !isColumnWithMenuItems);
10
- const isBasicColumn = ['actions', 'action_icon'].includes((_e = (_d = column.id) === null || _d === void 0 ? void 0 : _d.toString()) === null || _e === void 0 ? void 0 : _e.toLowerCase());
16
+ const isBasicColumn = ['actions', 'action_icon'].includes((_e = columnId === null || columnId === void 0 ? void 0 : columnId.toLowerCase()) !== null && _e !== void 0 ? _e : '');
11
17
  if (isColumnSelected || isBasicColumn) {
12
18
  return true;
13
19
  }
@@ -16,13 +22,19 @@ export function filterShownColumns(columns, tableViews) {
16
22
  }
17
23
  export function isParameterSelected(columns, columnId, parameter) {
18
24
  var _a, _b, _c;
19
- return (((_c = (_b = (_a = columns === null || columns === void 0 ? void 0 : columns.find((view) => { var _a; return ((_a = view.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === columnId.toLowerCase(); })) === null || _a === void 0 ? void 0 : _a.menuItems) === null || _b === void 0 ? void 0 : _b.find((item) => { var _a; return ((_a = item.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === parameter.toLowerCase() && item.selected; })) === null || _c === void 0 ? void 0 : _c.selected) || false);
25
+ return (((_c = (_b = (_a = columns === null || columns === void 0 ? void 0 : columns.find((view) => {
26
+ var _a, _b;
27
+ const codeMatch = ((_a = view.code) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === columnId.toLowerCase();
28
+ const nameMatch = ((_b = view.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === columnId.toLowerCase();
29
+ return codeMatch || nameMatch;
30
+ })) === null || _a === void 0 ? void 0 : _a.menuItems) === null || _b === void 0 ? void 0 : _b.find((item) => { var _a; return ((_a = item.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === parameter.toLowerCase() && item.selected; })) === null || _c === void 0 ? void 0 : _c.selected) || false);
20
31
  }
21
32
  export function mapDataToViews(columnData, language) {
22
33
  var _a;
23
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) => {
24
35
  var _a;
25
36
  return ({
37
+ code: column.code,
26
38
  label: getNameText(column.name, language),
27
39
  name: getNameText(column.name, language) || '',
28
40
  selected: (column === null || column === void 0 ? void 0 : column.selected) !== false,
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.431-test.2",
5
- "testVersion": 2,
4
+ "version": "0.1.431-test.3",
5
+ "testVersion": 3,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",