@tap-payments/os-micro-frontend-shared 0.1.442-test.2 → 0.1.442-test.4-test.5

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.
@@ -88,7 +88,7 @@ export function useCustomTableViews({ templates, setTemplates, createTemplate, u
88
88
  for (const mod of columnModifiers) {
89
89
  result = updateColumnSelection({
90
90
  columnsViewData: result,
91
- columnsName: mod.columnsName,
91
+ columnsId: mod.columnsId,
92
92
  selected: mod.selected,
93
93
  });
94
94
  }
@@ -181,7 +181,7 @@ export interface UseViewsManagerProps {
181
181
  lang?: string;
182
182
  }
183
183
  export interface ColumnModifier {
184
- columnsName: string[];
184
+ columnsId: string[];
185
185
  selected: boolean;
186
186
  }
187
187
  export interface UseTableViewsProps {
@@ -2,9 +2,7 @@ export const isDateColumn = (name) => name.toLowerCase() === 'date';
2
2
  export const transformLayoutToColumns = (layout, lang = 'en') => {
3
3
  const columns = [];
4
4
  layout.forEach((section) => {
5
- [...section.columns]
6
- .sort((a, b) => { var _a, _b; return ((_a = a.order) !== null && _a !== void 0 ? _a : 999999) - ((_b = b.order) !== null && _b !== void 0 ? _b : 999999); })
7
- .forEach((col) => {
5
+ section.columns.forEach((col) => {
8
6
  var _a, _b, _c, _d;
9
7
  const label = ((_a = col.name.find((n) => n.lang === lang)) === null || _a === void 0 ? void 0 : _a.text) || ((_b = col.name[0]) === null || _b === void 0 ? void 0 : _b.text) || col.code;
10
8
  const menuItems = ((_c = col.fields) === null || _c === void 0 ? void 0 : _c.length)
@@ -3,8 +3,8 @@ export declare function filterShownColumns(columns: IColumnProps[], tableViews:
3
3
  export declare function isParameterSelected(columns: ColumnViewProps[], columnId: string, parameter: string): boolean;
4
4
  export declare function mapDataToViews(columnData?: ColumnsView[], language?: string): ColumnViewProps[];
5
5
  export declare function mapViewsToData(columns: ColumnViewProps[]): ColumnsView[];
6
- export declare const updateColumnSelection: ({ columnsViewData, columnsName, selected, }: {
6
+ export declare const updateColumnSelection: ({ columnsViewData, columnsId, selected, }: {
7
7
  columnsViewData: ColumnsView[];
8
- columnsName: string[];
8
+ columnsId: string[];
9
9
  selected: boolean;
10
10
  }) => ColumnsView[];
@@ -70,15 +70,14 @@ export function mapViewsToData(columns) {
70
70
  })) || [] });
71
71
  });
72
72
  }
73
- export const updateColumnSelection = ({ columnsViewData, columnsName, selected, }) => {
74
- return columnsViewData.map((column) => {
75
- var _a, _b;
76
- if (columnsName.includes((_a = column.name[0]) === null || _a === void 0 ? void 0 : _a.text)) {
77
- return Object.assign(Object.assign({}, column), { selected, fields: (_b = column.fields) === null || _b === void 0 ? void 0 : _b.map((field) => {
78
- var _a, _b;
79
- return (Object.assign(Object.assign({}, field), { parameters: (_b = (_a = field.parameters) === null || _a === void 0 ? void 0 : _a.map((p) => (Object.assign(Object.assign({}, p), { selected })))) !== null && _b !== void 0 ? _b : [] }));
80
- }) });
81
- }
82
- return column;
83
- });
73
+ export const updateColumnSelection = ({ columnsViewData, columnsId, selected, }) => {
74
+ const ids = new Set(columnsId.map((id) => id === null || id === void 0 ? void 0 : id.toLowerCase()));
75
+ const withSelected = (col) => {
76
+ var _a;
77
+ return (Object.assign(Object.assign({}, col), { selected, fields: (_a = col.fields) === null || _a === void 0 ? void 0 : _a.map((field) => {
78
+ var _a, _b;
79
+ return (Object.assign(Object.assign({}, field), { parameters: (_b = (_a = field.parameters) === null || _a === void 0 ? void 0 : _a.map((p) => (Object.assign(Object.assign({}, p), { selected })))) !== null && _b !== void 0 ? _b : [] }));
80
+ }) }));
81
+ };
82
+ return columnsViewData.map((column) => { var _a, _b; return ids.has((_b = (_a = column.code) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : '') ? withSelected(column) : column; });
84
83
  };
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.442-test.2",
5
- "testVersion": 2,
4
+ "version": "0.1.442-test.4-test.5",
5
+ "testVersion": 5,
6
6
  "type": "module",
7
7
  "main": "build/index.js",
8
8
  "module": "build/index.js",