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

Commit

Permalink
FLOW-1004 FLOW-1005 f-color-picker alignment issue fixed and hea… (#209)
Browse files Browse the repository at this point in the history
* main FLOW-1004 FLOW-1005 f-color-picker alignment issue fixed and header-input event added in f-table-schema

* FLOW-1004 toogle all rows feature fixed

* FLOW-1004 selectAll row beahvior fixed
  • Loading branch information
vikas-cldcvr authored Dec 12, 2023
1 parent a50ee62 commit 19fee15
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/flow-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# Change Log

## [2.6.2] - 2023-12-12

### Bug fixes

- `f-color-picker` alignment fix when used in row direction with other inputs.

## [2.6.1] - 2023-12-04

### Bug fixes
Expand Down
2 changes: 1 addition & 1 deletion packages/flow-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cldcvr/flow-core",
"version": "2.6.1",
"version": "2.6.2",
"description": "Core package of flow design system",
"module": "dist/flow-core.es.js",
"main": "dist/flow-core.cjs.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ f-color-picker {
height: fit-content;
max-width: 100%;
max-height: 100%;
display: inline-flex;
vertical-align: top;
}
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class FColorPicker extends FRoot {
render() {
const classes = { focused: this.isOpen, "no-color": this.isValueEmpty };
// render empty string, since there no need of any child element
return html`<f-div direction="column" gap="x-small" width="hug-content">
return html`<f-div direction="column" width="hug-content">
<f-form-field>
<f-div
.width=${this.sizeMap[this.size ?? "medium"]}
Expand Down
6 changes: 6 additions & 0 deletions packages/flow-table/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

# Change Log

## [2.2.1] - 2023-12-12

### Improvements

- `f-table-schema` : `@header-input` emitted when checkbox from header is clicked.

## [2.2.0] - 2023-11-28

### Minor Changes
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.2.0",
"version": "2.2.1",
"description": "Table component for flow library",
"module": "dist/flow-table.es.js",
"main": "dist/flow-table.cjs.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ export class FTableSchema extends FRoot {
?sticky-left=${ifDefined(sticky)}
?sticky-top=${ifDefined(this.stickyHeader)}
@selected-column=${this.handleColumnSelection}
@update-row-selection=${(event: CustomEvent<boolean>) =>
this.handleHeaderInput(event, columnHeader[1])}
>
<f-div gap="small" height="100%" width="fit-content">
${this.getHeaderCellTemplate(columnHeader[1])}
Expand Down Expand Up @@ -449,6 +451,22 @@ export class FTableSchema extends FRoot {
}
}

handleHeaderInput(event: CustomEvent<boolean>, headerCell: FTableSchemaHeaderCell) {
this.toggleAllRows(event.detail);
const toggle = new CustomEvent("header-input", {
detail: { value: event.detail, header: headerCell },
bubbles: true,
composed: true
});
this.dispatchEvent(toggle);
}

toggleAllRows(val: boolean) {
this.data.rows.forEach(row => {
row.selected = val;
});
}

paginate() {
if (this.filteredRows.length < this.searchedRows.length) {
this.offset += this.max;
Expand Down
1 change: 0 additions & 1 deletion packages/flow-table/src/components/f-table/f-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ export class FTable extends FRoot {
} else if (selectedRows.length === rowsWithoutHeader.length) {
headerRow.selected = true;
} else {
headerRow.selected = false;
firstCell.checkbox.value = "indeterminate";
}
}
Expand Down
29 changes: 29 additions & 0 deletions stories/flow-table/f-table-schema.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,35 @@ export const HeaderSelected = {
name: "@header-selected"
};

export const HeaderInput = {
render: () => {
const data = getFakeUsers(10, 5);
const fieldRef = createRef();

const handleEvent = (event: CustomEvent) => {
if (fieldRef.value) {
fieldRef.value.textContent = JSON.stringify(event.detail, undefined, 2);
}
};

return html`<f-div direction="column" state="subtle" padding="small" gap="large">
<f-text
>'header-input' event emitted whenever checkbox is checked/unchecked in header</f-text
>
<f-table-schema .data=${data} selectable="multiple" @header-input=${handleEvent}>
</f-table-schema>
<f-divider></f-divider>
</f-div>
<br />
<f-divider></f-divider>
<br />
<f-text state="secondary">'event.detail' will display here</f-text>
<pre ${ref(fieldRef)}></pre> `;
},

name: "@header-input"
};

export const Sort = {
render: () => {
const data = getFakeUsers(50, 5);
Expand Down

0 comments on commit 19fee15

Please sign in to comment.