vxe-gantt
Version:
A vue based gantt component
49 lines (48 loc) • 1.38 kB
JavaScript
export function getRefElem(refEl) {
if (refEl) {
const rest = refEl.value;
if (rest) {
return (rest.$el || rest);
}
}
return null;
}
export function getCalcHeight(height) {
if (height === 'unset') {
return 0;
}
return height || 0;
}
export function getCellRestHeight(rowRest, cellOpts, rowOpts, defaultRowHeight) {
return rowRest.resizeHeight || cellOpts.height || rowOpts.height || rowRest.height || defaultRowHeight;
}
export 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;
}
export function getTaskBarLeft(chartRest, viewCellWidth) {
return chartRest ? viewCellWidth * chartRest.oLeftSize : 0;
}
export 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
};
export function hasMilestoneTask(type) {
return type === 'milestone';
}
export function hasSubviewTask(type) {
return type === 'subview';
}
export function getTaskType(type) {
return taskTypeMaps[type] ? type : 'default';
}