Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

Commit

Permalink
FLOW-957 f-table grid template creation bug fixed for vue 3 (#184)
Browse files Browse the repository at this point in the history
* FLOW-957 f-table grid template creation bug fixed for vue 3

* FLOW-957 f-table grid template creation bug fixed for vue 3
  • Loading branch information
vikas-cldcvr authored Nov 1, 2023
1 parent 0346277 commit 3c9ef64
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
7 changes: 6 additions & 1 deletion packages/flow-table/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<h4 className="margin-btm-8">Release Notes</h4>


# Change Log

## [2.0.5] - 2023-11-01

### Bug Fixes

- Vue : `f-table` gridTemplate creation fixed

## [2.0.4] - 2023-10-16

### Improvements
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-table/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cldcvr/flow-table",
"version": "2.0.4",
"version": "2.0.5",
"description": "Table component for flow library",
"module": "dist/flow-table.es.js",
"main": "dist/flow-table.cjs.js",
Expand Down
29 changes: 18 additions & 11 deletions packages/flow-table/src/components/f-table/f-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export class FTable extends FRoot {
@selected-column=${this.toggleColumnSelected}
@highlight-column=${this.toggleColumnHighlight}
@selected-row=${this.handleHeaderRowSelection}
@slotchange=${this.updateGridTemplateColumns}
></slot>
<slot @slotchange=${this.propogateProps} @selected-row=${this.handleRowSelection}></slot>`;
}
Expand Down Expand Up @@ -90,19 +91,25 @@ export class FTable extends FRoot {

updateGridTemplateColumns() {
const firstRow = this.querySelector(":scope > f-trow");
const firstRowCells = firstRow?.querySelectorAll<FTcell>(":scope > f-tcell");
const noOfCells = firstRowCells?.length ?? 0;
let gridColumnTemplate = ``;
for (let i = 0; i < noOfCells; i++) {
const cellElement = firstRowCells?.item(i);
if (cellElement?.width) {
gridColumnTemplate += `${cellElement?.width} `;
} else {
gridColumnTemplate += `auto `;
if (firstRow !== null) {
/**
* following query is not working vue app so replaced with firstRow.children
* firstRow?.querySelectorAll<FTcell>(":scope > f-tcell");
* */
const firstRowCells = firstRow.children;
const noOfCells = firstRowCells.length;
let gridColumnTemplate = ``;
for (let i = 0; i < noOfCells; i++) {
const cellElement = firstRowCells.item(i) as FTcell;
if (cellElement.width) {
gridColumnTemplate += `${cellElement?.width} `;
} else {
gridColumnTemplate += `auto `;
}
}
}

this.style.gridTemplateColumns = gridColumnTemplate;
this.style.gridTemplateColumns = gridColumnTemplate;
}
}

/**
Expand Down

0 comments on commit 3c9ef64

Please sign in to comment.