choerodon-ui
Version:
An enterprise-class UI design language and React-based implementation
71 lines (54 loc) • 1.75 kB
JavaScript
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
import _createClass from "@babel/runtime/helpers/createClass";
import { __decorate } from "tslib";
import { action, computed, observable, runInAction } from 'mobx';
import { ROW_GROUP_HEIGHT } from './TableRowGroup';
var VirtualRowMetaData = /*#__PURE__*/function () {
function VirtualRowMetaData(store, type, prev, record) {
var _this = this;
_classCallCheck(this, VirtualRowMetaData);
this.store = store;
this.type = type;
this.prev = prev;
if (record !== undefined) {
runInAction(function () {
_this.record = record;
});
}
}
_createClass(VirtualRowMetaData, [{
key: "height",
get: function get() {
if (this.type === 'group') {
return ROW_GROUP_HEIGHT;
}
var actualHeight = this.actualHeight;
if (actualHeight === undefined) {
return this.store.virtualRowHeight;
}
return actualHeight;
}
}, {
key: "offset",
get: function get() {
var prev = this.prev;
if (prev) {
return prev.offset + prev.height;
}
return 0;
}
}, {
key: "setHeight",
value: function setHeight(height) {
this.actualHeight = height;
this.aggregation = this.store.aggregation;
}
}]);
return VirtualRowMetaData;
}();
export { VirtualRowMetaData as default };
__decorate([observable], VirtualRowMetaData.prototype, "actualHeight", void 0);
__decorate([observable], VirtualRowMetaData.prototype, "record", void 0);
__decorate([computed], VirtualRowMetaData.prototype, "offset", null);
__decorate([action], VirtualRowMetaData.prototype, "setHeight", null);
//# sourceMappingURL=VirtualRowMetaData.js.map