vxe-gantt
Version:
A vue based gantt component
62 lines (61 loc) • 1.68 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getCalcHeight = getCalcHeight;
exports.getCellRestHeight = getCellRestHeight;
exports.getRefElem = getRefElem;
exports.getStandardGapTime = getStandardGapTime;
exports.getTaskBarLeft = getTaskBarLeft;
exports.getTaskBarWidth = getTaskBarWidth;
exports.getTaskType = getTaskType;
exports.hasMilestoneTask = hasMilestoneTask;
exports.hasSubviewTask = hasSubviewTask;
function getRefElem(refEl) {
if (refEl) {
const rest = refEl.value;
if (rest) {
return rest.$el || rest;
}
}
return null;
}
function getCalcHeight(height) {
if (height === 'unset') {
return 0;
}
return height || 0;
}
function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
}
function getStandardGapTime(type) {
switch (type) {
case 'hour':
return 1000 * 60 * 60;
case 'minute':
return 1000 * 60;
case 'second':
return 1000;
}
return 1000 * 60 * 60 * 24;
}
function getTaskBarLeft(chartRest, viewCellWidth) {
return chartRest ? viewCellWidth * chartRest.oLeftSize : 0;
}
function getTaskBarWidth(chartRest, viewCellWidth) {
return chartRest && chartRest.oWidthSize ? Math.max(1, chartRest ? Math.floor(viewCellWidth * chartRest.oWidthSize) - 1 : 0) : 0;
}
const taskTypeMaps = {
milestone: true,
subview: true
};
function hasMilestoneTask(type) {
return type === 'milestone';
}
function hasSubviewTask(type) {
return type === 'subview';
}
function getTaskType(type) {
return taskTypeMaps[type] ? type : 'default';
}