@mui/x-data-grid-premium
Version:
The Premium plan edition of the MUI X Data Grid Components.
31 lines (30 loc) • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.rowGroupingReorderExecutor = void 0;
var _warning = require("@mui/x-internals/warning");
var _operations = require("./operations");
/**
* Executor class for handling row reorder operations in grouped data grids.
*
* This class coordinates the execution of different reorder operation types,
* trying each operation in order until one succeeds or all fail.
*/
class RowReorderExecutor {
constructor(operations) {
this.operations = operations;
}
async execute(ctx) {
for (const operation of this.operations) {
const detectedOperation = operation.detectOperation(ctx);
if (detectedOperation) {
// eslint-disable-next-line no-await-in-loop
await operation.executeOperation(detectedOperation, ctx);
return;
}
}
(0, _warning.warnOnce)(['MUI X: The parameters provided to the `setRowIndex()` resulted in a no-op.', 'Consider looking at the documentation at https://mui.com/x/react-data-grid/row-grouping/'], 'warning');
}
}
const rowGroupingReorderExecutor = exports.rowGroupingReorderExecutor = new RowReorderExecutor([new _operations.SameParentSwapOperation(), new _operations.CrossParentLeafOperation(), new _operations.CrossParentGroupOperation()]);