@mui/x-data-grid-pro
Version:
The Pro plan edition of the MUI X Data Grid components.
37 lines (35 loc) • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.RowReorderExecutor = exports.BaseReorderOperation = void 0;
var _warning = require("@mui/x-internals/warning");
/**
* Base class for all reorder operations.
* Provides abstract methods for operation detection and execution.
*/
class BaseReorderOperation {}
/**
* 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.
*/
exports.BaseReorderOperation = BaseReorderOperation;
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 API method resulted in a no-op.', 'Consider looking at the documentation at https://mui.com/x/react-data-grid/row-ordering/'], 'warning');
}
}
exports.RowReorderExecutor = RowReorderExecutor;