Skip to content

Commit 8d693b0

Browse files
authored
refactor: align updatePart parameter order with other methods (#10481)
1 parent 5b4a6f7 commit 8d693b0

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

packages/grid-pro/src/vaadin-grid-pro-inline-editing-mixin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ export const InlineEditingMixin = (superClass) =>
553553
iterateRowCells(row, (cell) => {
554554
const isEditable = !row.hasAttribute('loading') && this._isCellEditable(cell);
555555
const target = cell._focusButton || cell;
556-
updatePart(target, isEditable, 'editable-cell');
556+
updatePart(target, 'editable-cell', isEditable);
557557
});
558558
}
559559

packages/grid/src/vaadin-grid-helpers.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ export function updateState(element, attribute, value) {
8181

8282
/**
8383
* @param {!HTMLElement} element
84-
* @param {boolean | string | null | undefined} value
8584
* @param {string} part
85+
* @param {boolean | string | null | undefined} value
8686
*/
87-
export function updatePart(element, value, part) {
87+
export function updatePart(element, part, value) {
8888
if (value || value === '') {
8989
addValueToAttribute(element, 'part', part);
9090
} else {
@@ -99,7 +99,7 @@ export function updatePart(element, value, part) {
9999
*/
100100
export function updateCellsPart(cells, part, value) {
101101
cells.forEach((cell) => {
102-
updatePart(cell, value, part);
102+
updatePart(cell, part, value);
103103
});
104104
}
105105

@@ -117,7 +117,7 @@ export function updateBooleanRowStates(row, states) {
117117
const rowPart = `${state}-row`;
118118

119119
// Row part attribute
120-
updatePart(row, value, rowPart);
120+
updatePart(row, rowPart, value);
121121

122122
// Cells part attribute
123123
updateCellsPart(cells, `${rowPart}-cell`, value);
@@ -140,14 +140,14 @@ export function updateStringRowStates(row, states) {
140140
// remove previous part from row and cells if there was any
141141
if (prevValue) {
142142
const prevRowPart = `${state}-${prevValue}-row`;
143-
updatePart(row, false, prevRowPart);
143+
updatePart(row, prevRowPart, false);
144144
updateCellsPart(cells, `${prevRowPart}-cell`, false);
145145
}
146146

147147
// set new part to rows and cells if there is a value
148148
if (value) {
149149
const rowPart = `${state}-${value}-row`;
150-
updatePart(row, value, rowPart);
150+
updatePart(row, rowPart, value);
151151
updateCellsPart(cells, `${rowPart}-cell`, value);
152152
}
153153
});
@@ -166,11 +166,11 @@ export function updateCellState(cell, attribute, value, part, oldPart) {
166166

167167
// Remove old part from the attribute
168168
if (oldPart) {
169-
updatePart(cell, false, oldPart);
169+
updatePart(cell, oldPart, false);
170170
}
171171

172172
// Add new part to the cell attribute
173-
updatePart(cell, value, part || `${attribute}-cell`);
173+
updatePart(cell, part || `${attribute}-cell`, value);
174174
}
175175

176176
/**

packages/grid/src/vaadin-grid-mixin.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,12 +757,12 @@ export const GridMixin = (superClass) =>
757757
__updateHeaderFooterRowParts(section) {
758758
const visibleRows = [...this.$[section].querySelectorAll('tr:not([hidden])')];
759759
[...this.$[section].children].forEach((row) => {
760-
updatePart(row, row === visibleRows.at(0), `first-${section}-row`);
761-
updatePart(row, row === visibleRows.at(-1), `last-${section}-row`);
760+
updatePart(row, `first-${section}-row`, row === visibleRows.at(0));
761+
updatePart(row, `last-${section}-row`, row === visibleRows.at(-1));
762762

763763
getBodyRowCells(row).forEach((cell) => {
764-
updatePart(cell, row === visibleRows.at(0), `first-${section}-row-cell`);
765-
updatePart(cell, row === visibleRows.at(-1), `last-${section}-row-cell`);
764+
updatePart(cell, `first-${section}-row-cell`, row === visibleRows.at(0));
765+
updatePart(cell, `last-${section}-row-cell`, row === visibleRows.at(-1));
766766
});
767767
});
768768
}

packages/grid/src/vaadin-grid-styling-mixin.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export const StylingMixin = (superClass) =>
131131
if (cell.__generatedParts) {
132132
cell.__generatedParts.forEach((partName) => {
133133
// Remove previously generated part names
134-
updatePart(cell, null, partName);
134+
updatePart(cell, partName, null);
135135
});
136136
}
137137
if (this.cellPartNameGenerator && !row.hasAttribute('loading')) {
@@ -140,7 +140,7 @@ export const StylingMixin = (superClass) =>
140140
if (cell.__generatedParts) {
141141
cell.__generatedParts.forEach((partName) => {
142142
// Add the newly generated names to part
143-
updatePart(cell, true, partName);
143+
updatePart(cell, partName, true);
144144
});
145145
}
146146
}

0 commit comments

Comments
 (0)