ЦИТК-784 (Добавлена возможность работы с цветом прогресса, градиентная заливка легенды)

This commit is contained in:
Dollerino 2024-02-05 16:17:09 +03:00
parent 72958217b3
commit de4fb84a7f
3 changed files with 21 additions and 3 deletions

View File

@ -59,7 +59,8 @@ const P8P_GANTT_TASK_SHAPE = PropTypes.shape({
readOnlyDates: PropTypes.bool,
readOnlyProgress: PropTypes.bool,
bgColor: PropTypes.string,
textColor: PropTypes.string
textColor: PropTypes.string,
bgProgressColor: PropTypes.string
});
//Структура динамического атрибута задачи
@ -72,6 +73,7 @@ const P8P_GANTT_TASK_ATTRIBUTE_SHAPE = PropTypes.shape({
const P8P_GANTT_TASK_COLOR_SHAPE = PropTypes.shape({
bgColor: PropTypes.string,
textColor: PropTypes.string,
bgProgressColor: PropTypes.string,
desc: PropTypes.string.isRequired
});
@ -126,14 +128,24 @@ const P8PGanttTaskEditor = ({
//Описание легенды для задачи
let legend = null;
if (Array.isArray(taskColors)) {
const colorDesc = taskColors.find(color => task.bgColor === color.bgColor && task.textColor === color.textColor);
const colorDesc = taskColors.find(
color => task.bgColor === color.bgColor && task.textColor === color.textColor && task.bgProgressColor === color.bgProgressColor
);
if (colorDesc)
legend = (
<ListItemText
secondaryTypographyProps={{
p: 1,
sx: {
...(colorDesc.bgColor ? { backgroundColor: colorDesc.bgColor } : {}),
...(colorDesc.bgProgressColor
? {
background: `linear-gradient(to right, ${colorDesc.bgProgressColor} ,${
colorDesc.bgColor ? colorDesc.bgColor : "transparent"
})}`
}
: colorDesc.bgColor
? { backgroundColor: colorDesc.bgColor }
: {}),
...(colorDesc.textColor ? { color: colorDesc.textColor } : {})
}
}}

View File

@ -2019,6 +2019,9 @@ text="Формат data_grid и gant как в chart"
if (RGANTT.RTASK_COLORS(I).STEXT_COLOR is not null) then
PKG_XFAST.ATTR(SNAME => SRESP_ATTR_TASK_TEXT_COLOR, SVALUE => RGANTT.RTASK_COLORS(I).STEXT_COLOR);
end if;
if (RGANTT.RTASK_COLORS(I).SBG_PROGRESS_COLOR is not null) then
PKG_XFAST.ATTR(SNAME => SRESP_ATTR_TASK_BG_PRG_COLOR, SVALUE => RGANTT.RTASK_COLORS(I).SBG_PROGRESS_COLOR);
end if;
PKG_XFAST.ATTR(SNAME => SRESP_ATTR_DESC, SVALUE => RGANTT.RTASK_COLORS(I).SDESC);
/* Закрываем описание цвета задачи */
PKG_XFAST.UP();

View File

@ -473,6 +473,9 @@ var Gantt = (function () {
class: 'bar-progress',
append_to: this.bar_group,
});
//ЦИТК
if (this.task.bgProgressColor) this.$bar_progress.style.fill = this.task.bgProgressColor;
//ЦИТК
animateSVG(this.$bar_progress, 'width', 0, this.progress_width);
}