Skip to content

Commit 5bc3685

Browse files
authored
refactor!: rename updateItem to updateRow, mark it as private (#9695)
1 parent fe076ed commit 5bc3685

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,16 +544,16 @@ export const InlineEditingMixin = (superClass) =>
544544
/**
545545
* @param {!HTMLElement} row
546546
* @param {GridItem} item
547-
* @protected
547+
* @private
548548
*/
549-
_updateItem(row, item) {
549+
__updateRow(row, item = row._item) {
550550
if (this.__edited) {
551551
const { cell, model } = this.__edited;
552552
if (cell.parentNode === row && model.item !== item) {
553553
this._stopEdit();
554554
}
555555
}
556-
super._updateItem(row, item);
556+
super.__updateRow(row, item);
557557
}
558558

559559
/**
@@ -588,7 +588,7 @@ export const InlineEditingMixin = (superClass) =>
588588
const isEditable = column.isCellEditable(model);
589589

590590
// Cancel editing if the cell is currently edited one and becomes no longer editable
591-
// TODO: should be moved to `_updateItem` when Grid connector is updated to use it.
591+
// TODO: should be moved to `__updateRow` when Grid connector is updated to use it.
592592
if (this.__edited && this.__edited.cell === cell && !isEditable) {
593593
this._stopEdit(true, true);
594594
}

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -184,21 +184,21 @@ export const DataProviderMixin = (superClass) =>
184184

185185
/**
186186
* @param {number} index
187-
* @param {HTMLElement} el
187+
* @param {HTMLElement} row
188188
* @protected
189189
*/
190-
_getItem(index, el) {
191-
el.index = index;
190+
_getItem(index, row) {
191+
row.index = index;
192192

193193
const { item } = this._dataProviderController.getFlatIndexContext(index);
194194
if (item) {
195-
this.__updateLoading(el, false);
196-
this._updateItem(el, item);
195+
this.__updateLoading(row, false);
196+
this.__updateRow(row, item);
197197
if (this._isExpanded(item)) {
198198
this._dataProviderController.ensureFlatIndexHierarchy(index);
199199
}
200200
} else {
201-
this.__updateLoading(el, true);
201+
this.__updateLoading(row, true);
202202
this._dataProviderController.ensureFlatIndexLoaded(index);
203203
}
204204
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,9 +742,9 @@ export const GridMixin = (superClass) =>
742742
/**
743743
* @param {!HTMLElement} row
744744
* @param {GridItem} item
745-
* @protected
745+
* @private
746746
*/
747-
_updateItem(row, item) {
747+
__updateRow(row, item = row._item) {
748748
row._item = item;
749749
const model = this.__getRowModel(row);
750750

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ export const RowDetailsMixin = (superClass) =>
9898
iterateChildren(this.$.items, (row) => {
9999
// Re-renders the row to possibly close the previously opened details.
100100
if (row.hasAttribute('details-opened')) {
101-
this._updateItem(row, row._item);
101+
this.__updateRow(row);
102102
return;
103103
}
104104

105105
// Re-renders the row to open the details when a row details renderer is provided.
106106
if (rowDetailsRenderer && this._isDetailsOpened(row._item)) {
107-
this._updateItem(row, row._item);
107+
this.__updateRow(row);
108108
}
109109
});
110110
}
@@ -140,7 +140,7 @@ export const RowDetailsMixin = (superClass) =>
140140
}
141141

142142
// Assigns a renderer when the details cell is opened.
143-
// The details cell content is rendered later in the `_updateItem` method.
143+
// The details cell content is rendered later in the `__updateRow` method.
144144
if (this.rowDetailsRenderer) {
145145
cell._renderer = this.rowDetailsRenderer;
146146
}

packages/grid/test/data-provider.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ describe('data provider', () => {
323323

324324
grid.dataProvider.resetHistory();
325325
const renderSpy = sinon.spy(grid, '_flatSizeChanged');
326-
const updateItemSpy = sinon.spy(grid, '_updateItem');
326+
const updateItemSpy = sinon.spy(grid, '__updateRow');
327327
grid.clearCache();
328328

329329
expect(grid.dataProvider.callCount).to.equal(2);
@@ -607,7 +607,7 @@ describe('data provider', () => {
607607

608608
describe('rendering', () => {
609609
function getFirstRowUpdateCount() {
610-
const callsForFirstIndex = grid._updateItem.getCalls().filter((call) => {
610+
const callsForFirstIndex = grid.__updateRow.getCalls().filter((call) => {
611611
const item = call.args[1];
612612
return item.value === '0';
613613
});
@@ -626,14 +626,14 @@ describe('data provider', () => {
626626

627627
cb(pageItems, 3);
628628
};
629-
sinon.spy(grid, '_updateItem');
629+
sinon.spy(grid, '__updateRow');
630630
await nextFrame();
631631
});
632632

633633
it('should limit row updates', async () => {
634634
grid.expandedItems = [{ value: '0' }, { value: '1' }, { value: '1-0' }, { value: '2' }];
635635
await nextFrame();
636-
// There are currently two _updateItem calls for a row. The extra one (a direct update request)
636+
// There are currently two __updateRow calls for a row. The extra one (a direct update request)
637637
// is coming from _expandedItemsChanged.
638638
expect(getFirstRowUpdateCount()).to.equal(2);
639639
});

0 commit comments

Comments
 (0)