Skip to content

Commit

Permalink
Merge pull request #2211 from apuliasoft/fix/kup-data-table-empty-column
Browse files Browse the repository at this point in the history
Fix/kup data table empty column
  • Loading branch information
lucafoscili authored Nov 20, 2024
2 parents 901afe8 + 16456d7 commit d582ed4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
32 changes: 10 additions & 22 deletions packages/ketchup/src/components/kup-data-table/kup-data-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3703,10 +3703,7 @@ export class KupDataTable {
const totalFixedColumns =
this.fixedColumns +
(this.#hasRowActions() ||
this.#kupManager.data.column.hasCodVer(this.data.columns) ||
this.#kupManager.data.action.hasCommandsWithBlankObj(
this.commands
)
this.#kupManager.data.column.hasCodVer(this.data.columns)
? 1
: 0) +
(this.selection === SelectionMode.MULTIPLE_CHECKBOX ? 1 : 0);
Expand Down Expand Up @@ -4127,8 +4124,7 @@ export class KupDataTable {

if (
this.#hasRowActions() ||
this.#kupManager.data.column.hasCodVer(this.data.columns) ||
this.#kupManager.data.action.hasCommandsWithBlankObj(this.commands)
this.#kupManager.data.column.hasCodVer(this.data.columns)
) {
colSpan += 1;
}
Expand Down Expand Up @@ -4353,8 +4349,8 @@ export class KupDataTable {
let actionsColumn = null;
if (
this.#hasRowActions() ||
this.#kupManager.data.column.hasCodVer(this.data.columns) ||
this.#kupManager.data.action.hasCommandsWithBlankObj(this.commands)
this.#kupManager.data.column.hasCodVer(this.data.columns)

) {
specialExtraCellsCount++;
const selectionStyleAndClass = this.#composeFixedCellStyleAndClass(
Expand Down Expand Up @@ -4545,8 +4541,7 @@ export class KupDataTable {
let actionsColumn = null;
if (
this.#hasRowActions() ||
this.#kupManager.data.column.hasCodVer(this.data.columns) ||
this.#kupManager.data.action.hasCommandsWithBlankObj(this.commands)
this.#kupManager.data.column.hasCodVer(this.data.columns)
) {
specialExtraCellsCount++;
const selectionStyleAndClass = this.#composeFixedCellStyleAndClass(
Expand Down Expand Up @@ -4682,8 +4677,7 @@ export class KupDataTable {
let actionsCell = null;
if (
this.#hasRowActions() ||
this.#kupManager.data.column.hasCodVer(this.data.columns) ||
this.#kupManager.data.action.hasCommandsWithBlankObj(this.commands)
this.#kupManager.data.column.hasCodVer(this.data.columns)
) {
extraCells++;
const selectionStyleAndClass = this.#composeFixedCellStyleAndClass(
Expand All @@ -4706,6 +4700,7 @@ export class KupDataTable {
}
/>
);

}

const footerCells = this.getVisibleColumns().map(
Expand Down Expand Up @@ -4965,10 +4960,7 @@ export class KupDataTable {
const cells = [];
if (
this.#hasRowActions() ||
this.#kupManager.data.column.hasCodVer(this.data.columns) ||
this.#kupManager.data.action.hasCommandsWithBlankObj(
this.commands
)
this.#kupManager.data.column.hasCodVer(this.data.columns)
) {
cells.push(<td></td>);
}
Expand Down Expand Up @@ -5162,10 +5154,7 @@ export class KupDataTable {
let rowActionsCell = null;
if (
this.#hasRowActions() ||
this.#kupManager.data.column.hasCodVer(this.data.columns) ||
this.#kupManager.data.action.hasCommandsWithBlankObj(
this.commands
)
this.#kupManager.data.column.hasCodVer(this.data.columns)
) {
// Increments
specialExtraCellsCount++;
Expand All @@ -5189,7 +5178,6 @@ export class KupDataTable {
this.rowActions,
this.commands ?? []
);

if (
this.#kupManager.data.action.checkEveryActionHasOnlyIcon(
rowActions
Expand All @@ -5215,14 +5203,14 @@ export class KupDataTable {
});
}
);

actionsOnRow.push(imageProp);
});
} else {
const textPopulatedRowActions =
this.#kupManager.data.action.createActionsWithText(
rowActions
);

const imageProp: FImageProps =
this.#kupManager.data.action.buildImageProp(
'chevron-down',
Expand Down
6 changes: 5 additions & 1 deletion packages/ketchup/src/managers/kup-data/kup-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,11 @@ export class KupData {
* @returns { boolean } if COD_VER founded or not.
*/
hasCodVer: (columns: KupDataColumn[]) => {
return columns.some((col) => this.column.isCodVer(col));
return columns.some(
(col) =>
this.column.isCodVer(col) &&
(!('visible' in col) || col.visible)
);
},
};
node = {
Expand Down

0 comments on commit d582ed4

Please sign in to comment.