@nocobase/plugin-gantt 2.1.0-beta.37 → 2.1.0-beta.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client-v2.d.ts +2 -0
- package/client-v2.js +3 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/143.1a8cf1cd5ce17b64.js +10 -0
- package/dist/client-v2/416.b7bb09162520e448.js +10 -0
- package/dist/client-v2/617.de3dc437887f3f07.js +10 -0
- package/dist/client-v2/872.e640aca77c79d895.js +10 -0
- package/dist/client-v2/index.d.ts +10 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/locale.d.ts +78 -0
- package/dist/client-v2/models/GanttBlockModel.d.ts +98 -0
- package/dist/client-v2/models/GanttBlockModel.helpers.d.ts +31 -0
- package/dist/client-v2/models/GanttBlockModel.settings.d.ts +9 -0
- package/dist/client-v2/models/actions/GanttActionModels.d.ts +33 -0
- package/dist/client-v2/models/actions/GanttPopupModels.d.ts +26 -0
- package/dist/client-v2/models/components/GanttBlock.d.ts +13 -0
- package/dist/client-v2/models/components/GanttBlock.helpers.d.ts +22 -0
- package/dist/client-v2/models/components/GanttBlock.styles.d.ts +22 -0
- package/dist/client-v2/models/components/GanttBlock.tree.d.ts +46 -0
- package/dist/client-v2/models/components/getLabelFormatValue.d.ts +11 -0
- package/dist/client-v2/models/index.d.ts +11 -0
- package/dist/client-v2/plugin.d.ts +13 -0
- package/dist/externalVersion.js +7 -6
- package/dist/locale/de-DE.json +2 -0
- package/dist/locale/en-US.json +25 -1
- package/dist/locale/es-ES.json +2 -0
- package/dist/locale/fr-FR.json +2 -0
- package/dist/locale/hu-HU.json +2 -0
- package/dist/locale/id-ID.json +2 -0
- package/dist/locale/it-IT.json +2 -0
- package/dist/locale/ja-JP.json +2 -0
- package/dist/locale/ko-KR.json +2 -0
- package/dist/locale/nl-NL.json +2 -0
- package/dist/locale/pt-BR.json +2 -0
- package/dist/locale/ru-RU.json +2 -0
- package/dist/locale/tr-TR.json +2 -0
- package/dist/locale/uk-UA.json +2 -0
- package/dist/locale/vi-VN.json +2 -0
- package/dist/locale/zh-CN.json +25 -1
- package/dist/locale/zh-TW.json +4 -0
- package/dist/node_modules/@ctrl/tinycolor/LICENSE +7 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/bundles/tinycolor.umd.min.js +2 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/conversion.d.ts +61 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/conversion.js +250 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/css-color-names.d.ts +4 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/css-color-names.js +157 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/format-input.d.ts +37 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/format-input.js +189 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/from-ratio.d.ts +14 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/from-ratio.js +30 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/index.d.ts +207 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/index.js +512 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/interfaces.d.ts +46 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/interfaces.js +2 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/conversion.js +235 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/css-color-names.js +154 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/format-input.js +183 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/from-ratio.js +25 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/index.js +508 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/interfaces.js +1 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/public_api.js +12 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/random.js +278 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/readability.js +80 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/to-ms-filter.js +16 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/umd_api.js +20 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/module/util.js +82 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/public_api.d.ts +11 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/public_api.js +1 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/random.d.ts +24 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/random.js +282 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/readability.d.ts +46 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/readability.js +86 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/to-ms-filter.d.ts +5 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/to-ms-filter.js +20 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/umd_api.d.ts +23 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/umd_api.js +22 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/util.d.ts +36 -0
- package/dist/node_modules/@ctrl/tinycolor/dist/util.js +92 -0
- package/dist/node_modules/@ctrl/tinycolor/package.json +1 -0
- package/dist/shared/components/calendar/calendar.d.ts +22 -0
- package/dist/shared/components/calendar/calendar.js +417 -0
- package/dist/shared/components/calendar/style.d.ts +14 -0
- package/dist/shared/components/calendar/style.js +79 -0
- package/dist/shared/components/calendar/top-part-of-calendar.d.ts +19 -0
- package/dist/shared/components/calendar/top-part-of-calendar.js +57 -0
- package/dist/shared/components/gantt/style.d.ts +14 -0
- package/dist/shared/components/gantt/style.js +74 -0
- package/dist/shared/components/gantt/task-gantt-content.d.ts +35 -0
- package/dist/shared/components/gantt/task-gantt-content.js +337 -0
- package/dist/shared/components/gantt/task-gantt.d.ts +24 -0
- package/dist/shared/components/gantt/task-gantt.js +128 -0
- package/dist/shared/components/grid/grid-body.d.ts +21 -0
- package/dist/shared/components/grid/grid-body.js +114 -0
- package/dist/shared/components/grid/grid.d.ts +12 -0
- package/dist/shared/components/grid/grid.js +50 -0
- package/dist/shared/components/grid/style.d.ts +14 -0
- package/dist/shared/components/grid/style.js +54 -0
- package/dist/shared/components/other/arrow.d.ts +20 -0
- package/dist/shared/components/other/arrow.js +90 -0
- package/dist/shared/components/other/horizontal-scroll.d.ts +16 -0
- package/dist/shared/components/other/horizontal-scroll.js +64 -0
- package/dist/shared/components/other/style.d.ts +16 -0
- package/dist/shared/components/other/style.js +125 -0
- package/dist/shared/components/other/tooltip.d.ts +36 -0
- package/dist/shared/components/other/tooltip.js +137 -0
- package/dist/shared/components/other/vertical-scroll.d.ts +17 -0
- package/dist/shared/components/other/vertical-scroll.js +74 -0
- package/dist/shared/components/task-item/bar/bar-date-handle.d.ts +19 -0
- package/dist/shared/components/task-item/bar/bar-date-handle.js +62 -0
- package/dist/shared/components/task-item/bar/bar-display.d.ts +29 -0
- package/dist/shared/components/task-item/bar/bar-display.js +98 -0
- package/dist/shared/components/task-item/bar/bar-progress-handle.d.ts +15 -0
- package/dist/shared/components/task-item/bar/bar-progress-handle.js +49 -0
- package/dist/shared/components/task-item/bar/bar-small.d.ts +11 -0
- package/dist/shared/components/task-item/bar/bar-small.js +85 -0
- package/dist/shared/components/task-item/bar/bar.d.ts +11 -0
- package/dist/shared/components/task-item/bar/bar.js +113 -0
- package/dist/shared/components/task-item/bar/style.d.ts +10 -0
- package/dist/shared/components/task-item/bar/style.js +58 -0
- package/dist/shared/components/task-item/milestone/milestone.d.ts +11 -0
- package/dist/shared/components/task-item/milestone/milestone.js +72 -0
- package/dist/shared/components/task-item/milestone/style.d.ts +10 -0
- package/dist/shared/components/task-item/milestone/style.js +45 -0
- package/dist/shared/components/task-item/project/project.d.ts +11 -0
- package/dist/shared/components/task-item/project/project.js +77 -0
- package/dist/shared/components/task-item/project/style.d.ts +11 -0
- package/dist/shared/components/task-item/project/style.js +51 -0
- package/dist/shared/components/task-item/style.d.ts +12 -0
- package/dist/shared/components/task-item/style.js +74 -0
- package/dist/shared/components/task-item/task-item.d.ts +23 -0
- package/dist/shared/components/task-item/task-item.js +132 -0
- package/dist/shared/helpers/bar-helper.d.ts +22 -0
- package/dist/shared/helpers/bar-helper.js +415 -0
- package/dist/shared/helpers/date-helper.d.ts +27 -0
- package/dist/shared/helpers/date-helper.js +231 -0
- package/dist/shared/helpers/other-helper.d.ts +17 -0
- package/dist/shared/helpers/other-helper.js +97 -0
- package/dist/shared/types/bar-task.d.ts +30 -0
- package/dist/shared/types/bar-task.js +24 -0
- package/dist/shared/types/date-setup.d.ts +13 -0
- package/dist/shared/types/date-setup.js +24 -0
- package/dist/shared/types/gantt-task-actions.d.ts +16 -0
- package/dist/shared/types/gantt-task-actions.js +24 -0
- package/dist/shared/types/public-types.d.ts +145 -0
- package/dist/shared/types/public-types.js +46 -0
- package/package.json +2 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { EventOption } from '../../types/public-types';
|
|
11
|
+
import { BarTask } from '../../types/bar-task';
|
|
12
|
+
import { GanttEvent } from '../../types/gantt-task-actions';
|
|
13
|
+
export type TaskGanttContentProps = {
|
|
14
|
+
tasks: BarTask[];
|
|
15
|
+
dates: Date[];
|
|
16
|
+
ganttEvent: GanttEvent;
|
|
17
|
+
selectedTask: BarTask | undefined;
|
|
18
|
+
rowHeight: number;
|
|
19
|
+
columnWidth: number;
|
|
20
|
+
timeStep: number;
|
|
21
|
+
svg?: React.RefObject<SVGSVGElement>;
|
|
22
|
+
svgWidth: number;
|
|
23
|
+
taskHeight: number;
|
|
24
|
+
arrowColor: string;
|
|
25
|
+
arrowIndent: number;
|
|
26
|
+
fontSize: string;
|
|
27
|
+
fontFamily: string;
|
|
28
|
+
rtl: boolean;
|
|
29
|
+
setGanttEvent: (value: GanttEvent) => void;
|
|
30
|
+
setFailedTask: (value: BarTask | null) => void;
|
|
31
|
+
setSelectedTask: (taskId: string) => void;
|
|
32
|
+
loading?: boolean;
|
|
33
|
+
enableDragToReschedule?: boolean;
|
|
34
|
+
} & EventOption;
|
|
35
|
+
export declare const TaskGanttContent: React.FC<TaskGanttContentProps>;
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var task_gantt_content_exports = {};
|
|
38
|
+
__export(task_gantt_content_exports, {
|
|
39
|
+
TaskGanttContent: () => TaskGanttContent
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(task_gantt_content_exports);
|
|
42
|
+
var import_react = __toESM(require("react"));
|
|
43
|
+
var import_arrow = require("../other/arrow");
|
|
44
|
+
var import_bar_helper = require("../../helpers/bar-helper");
|
|
45
|
+
var import_other_helper = require("../../helpers/other-helper");
|
|
46
|
+
var import_task_item = require("../task-item/task-item");
|
|
47
|
+
const TaskGanttContent = ({
|
|
48
|
+
tasks,
|
|
49
|
+
dates,
|
|
50
|
+
ganttEvent,
|
|
51
|
+
selectedTask,
|
|
52
|
+
rowHeight,
|
|
53
|
+
columnWidth,
|
|
54
|
+
timeStep,
|
|
55
|
+
svg,
|
|
56
|
+
taskHeight,
|
|
57
|
+
arrowColor,
|
|
58
|
+
arrowIndent,
|
|
59
|
+
fontFamily,
|
|
60
|
+
fontSize,
|
|
61
|
+
rtl,
|
|
62
|
+
setGanttEvent,
|
|
63
|
+
setFailedTask,
|
|
64
|
+
setSelectedTask,
|
|
65
|
+
onDateChange,
|
|
66
|
+
onProgressChange,
|
|
67
|
+
onDoubleClick,
|
|
68
|
+
onClick,
|
|
69
|
+
onDelete,
|
|
70
|
+
enableDragToReschedule = true
|
|
71
|
+
}) => {
|
|
72
|
+
const [xStep, setXStep] = (0, import_react.useState)(0);
|
|
73
|
+
const [initEventX1Delta, setInitEventX1Delta] = (0, import_react.useState)(0);
|
|
74
|
+
const lastActionRef = (0, import_react.useRef)(null);
|
|
75
|
+
const lastStartRef = (0, import_react.useRef)(null);
|
|
76
|
+
const ganttEventRef = (0, import_react.useRef)(ganttEvent);
|
|
77
|
+
const xStepRef = (0, import_react.useRef)(xStep);
|
|
78
|
+
const initEventX1DeltaRef = (0, import_react.useRef)(initEventX1Delta);
|
|
79
|
+
const rtlRef = (0, import_react.useRef)(rtl);
|
|
80
|
+
const mouseLeaveTimeoutRef = (0, import_react.useRef)(null);
|
|
81
|
+
ganttEventRef.current = ganttEvent;
|
|
82
|
+
xStepRef.current = xStep;
|
|
83
|
+
initEventX1DeltaRef.current = initEventX1Delta;
|
|
84
|
+
rtlRef.current = rtl;
|
|
85
|
+
const taskById = (0, import_react.useMemo)(() => new Map(tasks.map((task) => [String(task.id), task])), [tasks]);
|
|
86
|
+
const hasChangedTask = !!ganttEvent.changedTask;
|
|
87
|
+
(0, import_react.useEffect)(() => {
|
|
88
|
+
return () => {
|
|
89
|
+
if (mouseLeaveTimeoutRef.current) {
|
|
90
|
+
clearTimeout(mouseLeaveTimeoutRef.current);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}, []);
|
|
94
|
+
(0, import_react.useEffect)(() => {
|
|
95
|
+
var _a, _b, _c, _d;
|
|
96
|
+
const dateDelta = ((_a = dates[1]) == null ? void 0 : _a.getTime()) - ((_b = dates[0]) == null ? void 0 : _b.getTime()) - ((_c = dates[1]) == null ? void 0 : _c.getTimezoneOffset()) * 60 * 1e3 + ((_d = dates[0]) == null ? void 0 : _d.getTimezoneOffset()) * 60 * 1e3;
|
|
97
|
+
const newXStep = timeStep * columnWidth / dateDelta;
|
|
98
|
+
setXStep(newXStep);
|
|
99
|
+
}, [columnWidth, dates, timeStep]);
|
|
100
|
+
const getSvgCursorX = (0, import_react.useCallback)(
|
|
101
|
+
(event, svgElement = svg == null ? void 0 : svg.current) => {
|
|
102
|
+
const screenCTM = svgElement == null ? void 0 : svgElement.getScreenCTM();
|
|
103
|
+
if (!svgElement || !screenCTM) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const point = svgElement.createSVGPoint();
|
|
107
|
+
point.x = event.clientX;
|
|
108
|
+
return point.matrixTransform(screenCTM.inverse()).x;
|
|
109
|
+
},
|
|
110
|
+
[svg]
|
|
111
|
+
);
|
|
112
|
+
(0, import_react.useEffect)(() => {
|
|
113
|
+
const svgElement = svg == null ? void 0 : svg.current;
|
|
114
|
+
const handleMouseMove = async (event) => {
|
|
115
|
+
const currentEvent = ganttEventRef.current;
|
|
116
|
+
if (!currentEvent.changedTask || !svgElement) return;
|
|
117
|
+
event.preventDefault();
|
|
118
|
+
const cursorX = getSvgCursorX(event, svgElement);
|
|
119
|
+
if (cursorX === null) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const { isChanged, changedTask } = (0, import_bar_helper.handleTaskBySVGMouseEvent)(
|
|
123
|
+
cursorX,
|
|
124
|
+
currentEvent.action,
|
|
125
|
+
currentEvent.changedTask,
|
|
126
|
+
xStepRef.current,
|
|
127
|
+
timeStep,
|
|
128
|
+
initEventX1DeltaRef.current,
|
|
129
|
+
rtlRef.current
|
|
130
|
+
);
|
|
131
|
+
if (isChanged) {
|
|
132
|
+
setGanttEvent({
|
|
133
|
+
...currentEvent,
|
|
134
|
+
changedTask
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const handleMouseUp = async (event) => {
|
|
139
|
+
const { action, originalSelectedTask, changedTask } = ganttEventRef.current;
|
|
140
|
+
if (!changedTask || !svgElement || !originalSelectedTask) {
|
|
141
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
142
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
143
|
+
setGanttEvent({ action: "" });
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
event.preventDefault();
|
|
147
|
+
const cursorX = getSvgCursorX(event, svgElement);
|
|
148
|
+
if (cursorX === null) {
|
|
149
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
150
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
151
|
+
setGanttEvent({ action: "" });
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const { changedTask: newChangedTask } = (0, import_bar_helper.handleTaskBySVGMouseEvent)(
|
|
155
|
+
cursorX,
|
|
156
|
+
action,
|
|
157
|
+
changedTask,
|
|
158
|
+
xStepRef.current,
|
|
159
|
+
timeStep,
|
|
160
|
+
initEventX1DeltaRef.current,
|
|
161
|
+
rtlRef.current
|
|
162
|
+
);
|
|
163
|
+
const isNotLikeOriginal = originalSelectedTask.start !== newChangedTask.start || originalSelectedTask.end !== newChangedTask.end || originalSelectedTask.progress !== newChangedTask.progress;
|
|
164
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
165
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
166
|
+
setGanttEvent({ action: "" });
|
|
167
|
+
let operationSuccess = true;
|
|
168
|
+
if ((action === "move" || action === "end" || action === "start") && onDateChange && isNotLikeOriginal) {
|
|
169
|
+
try {
|
|
170
|
+
const result = await onDateChange(newChangedTask, newChangedTask.barChildren);
|
|
171
|
+
if (result !== void 0) {
|
|
172
|
+
operationSuccess = result;
|
|
173
|
+
}
|
|
174
|
+
} catch (error) {
|
|
175
|
+
operationSuccess = false;
|
|
176
|
+
}
|
|
177
|
+
} else if (onProgressChange && isNotLikeOriginal) {
|
|
178
|
+
try {
|
|
179
|
+
const result = await onProgressChange(newChangedTask, newChangedTask.barChildren);
|
|
180
|
+
if (result !== void 0) {
|
|
181
|
+
operationSuccess = result;
|
|
182
|
+
}
|
|
183
|
+
} catch (error) {
|
|
184
|
+
operationSuccess = false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (!operationSuccess) {
|
|
188
|
+
setFailedTask(originalSelectedTask);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
if ((ganttEvent.action === "move" || ganttEvent.action === "end" || ganttEvent.action === "start" || ganttEvent.action === "progress") && hasChangedTask && svgElement) {
|
|
192
|
+
window.addEventListener("mousemove", handleMouseMove);
|
|
193
|
+
window.addEventListener("mouseup", handleMouseUp);
|
|
194
|
+
}
|
|
195
|
+
return () => {
|
|
196
|
+
window.removeEventListener("mousemove", handleMouseMove);
|
|
197
|
+
window.removeEventListener("mouseup", handleMouseUp);
|
|
198
|
+
};
|
|
199
|
+
}, [
|
|
200
|
+
ganttEvent.action,
|
|
201
|
+
hasChangedTask,
|
|
202
|
+
onProgressChange,
|
|
203
|
+
timeStep,
|
|
204
|
+
onDateChange,
|
|
205
|
+
svg,
|
|
206
|
+
getSvgCursorX,
|
|
207
|
+
setFailedTask,
|
|
208
|
+
setGanttEvent
|
|
209
|
+
]);
|
|
210
|
+
const handleBarEventStart = async (action, task, event) => {
|
|
211
|
+
if (!event) {
|
|
212
|
+
if (action === "select") {
|
|
213
|
+
setSelectedTask(task.id);
|
|
214
|
+
}
|
|
215
|
+
} else if ((0, import_other_helper.isKeyboardEvent)(event)) {
|
|
216
|
+
if (action === "delete") {
|
|
217
|
+
if (onDelete) {
|
|
218
|
+
try {
|
|
219
|
+
const result = await onDelete(task);
|
|
220
|
+
if (result !== void 0 && result) {
|
|
221
|
+
setGanttEvent({ action, changedTask: task });
|
|
222
|
+
}
|
|
223
|
+
} catch (error) {
|
|
224
|
+
console.error("Error on Delete. " + error);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
} else if (action === "mouseenter") {
|
|
229
|
+
if (mouseLeaveTimeoutRef.current) {
|
|
230
|
+
clearTimeout(mouseLeaveTimeoutRef.current);
|
|
231
|
+
mouseLeaveTimeoutRef.current = null;
|
|
232
|
+
}
|
|
233
|
+
const currentEvent = ganttEventRef.current;
|
|
234
|
+
if (!currentEvent.action || currentEvent.action === "mouseenter") {
|
|
235
|
+
setGanttEvent({
|
|
236
|
+
action,
|
|
237
|
+
changedTask: task,
|
|
238
|
+
originalSelectedTask: task
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
} else if (action === "mouseleave") {
|
|
242
|
+
const leavingTaskId = task.id;
|
|
243
|
+
if (ganttEventRef.current.action === "mouseenter") {
|
|
244
|
+
if (mouseLeaveTimeoutRef.current) {
|
|
245
|
+
clearTimeout(mouseLeaveTimeoutRef.current);
|
|
246
|
+
}
|
|
247
|
+
mouseLeaveTimeoutRef.current = setTimeout(() => {
|
|
248
|
+
var _a;
|
|
249
|
+
const currentEvent = ganttEventRef.current;
|
|
250
|
+
if (currentEvent.action === "mouseenter" && ((_a = currentEvent.changedTask) == null ? void 0 : _a.id) === leavingTaskId) {
|
|
251
|
+
setGanttEvent({ action: "" });
|
|
252
|
+
}
|
|
253
|
+
mouseLeaveTimeoutRef.current = null;
|
|
254
|
+
}, 300);
|
|
255
|
+
}
|
|
256
|
+
} else if (action === "dblclick") {
|
|
257
|
+
!!onDoubleClick && onDoubleClick(task);
|
|
258
|
+
} else if (action === "click") {
|
|
259
|
+
const targetElement = event.target;
|
|
260
|
+
if (targetElement.tagName === "rect") {
|
|
261
|
+
setGanttEvent({ action: "" });
|
|
262
|
+
!!onClick && onClick(task);
|
|
263
|
+
}
|
|
264
|
+
} else if (action === "move") {
|
|
265
|
+
const cursorX = getSvgCursorX(event);
|
|
266
|
+
if (cursorX === null) return;
|
|
267
|
+
setInitEventX1Delta(cursorX - task.x1);
|
|
268
|
+
setGanttEvent({
|
|
269
|
+
action,
|
|
270
|
+
changedTask: task,
|
|
271
|
+
originalSelectedTask: task
|
|
272
|
+
});
|
|
273
|
+
} else {
|
|
274
|
+
setGanttEvent({
|
|
275
|
+
action,
|
|
276
|
+
changedTask: task,
|
|
277
|
+
originalSelectedTask: task
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
const handleBarEvent = (action, task, event) => {
|
|
282
|
+
if (["click"].includes(action)) {
|
|
283
|
+
if (!["start", "end", "progress"].includes(lastActionRef.current) && (!lastStartRef.current || lastStartRef.current === task.start)) {
|
|
284
|
+
handleBarEventStart(action, task, event);
|
|
285
|
+
}
|
|
286
|
+
lastActionRef.current = null;
|
|
287
|
+
lastStartRef.current = null;
|
|
288
|
+
} else if (["move", "select"].includes(action)) {
|
|
289
|
+
lastStartRef.current = task.start;
|
|
290
|
+
handleBarEventStart(action, task, event);
|
|
291
|
+
} else {
|
|
292
|
+
lastStartRef.current = task.start;
|
|
293
|
+
lastActionRef.current = action;
|
|
294
|
+
handleBarEventStart(action, task, event);
|
|
295
|
+
}
|
|
296
|
+
};
|
|
297
|
+
return /* @__PURE__ */ import_react.default.createElement("g", { className: "content" }, /* @__PURE__ */ import_react.default.createElement("g", { className: "arrows", fill: arrowColor, stroke: arrowColor }, tasks.map((task) => {
|
|
298
|
+
return task.barChildren.map((child) => {
|
|
299
|
+
const taskTo = taskById.get(String(child.id));
|
|
300
|
+
if (!taskTo) {
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
304
|
+
import_arrow.Arrow,
|
|
305
|
+
{
|
|
306
|
+
key: `Arrow from ${task.id} to ${child.id}`,
|
|
307
|
+
taskFrom: task,
|
|
308
|
+
taskTo,
|
|
309
|
+
rowHeight,
|
|
310
|
+
taskHeight,
|
|
311
|
+
arrowIndent,
|
|
312
|
+
rtl
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
});
|
|
316
|
+
})), /* @__PURE__ */ import_react.default.createElement("g", { className: "bar", fontFamily, fontSize }, tasks.map((task) => {
|
|
317
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
318
|
+
import_task_item.TaskItem,
|
|
319
|
+
{
|
|
320
|
+
task,
|
|
321
|
+
arrowIndent,
|
|
322
|
+
taskHeight,
|
|
323
|
+
isProgressChangeable: !!onProgressChange && !task.isDisabled,
|
|
324
|
+
isDateChangeable: enableDragToReschedule && !!onDateChange && !task.isDisabled,
|
|
325
|
+
isDelete: !task.isDisabled,
|
|
326
|
+
onEventStart: handleBarEvent,
|
|
327
|
+
key: task.id,
|
|
328
|
+
isSelected: !!selectedTask && task.id === selectedTask.id,
|
|
329
|
+
rtl
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
})));
|
|
333
|
+
};
|
|
334
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
335
|
+
0 && (module.exports = {
|
|
336
|
+
TaskGanttContent
|
|
337
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { CalendarProps } from '../calendar/calendar';
|
|
11
|
+
import { GridProps } from '../grid/grid';
|
|
12
|
+
import { TaskGanttContentProps } from './task-gantt-content';
|
|
13
|
+
export type TaskGanttProps = {
|
|
14
|
+
gridProps: GridProps;
|
|
15
|
+
calendarProps: CalendarProps;
|
|
16
|
+
barProps: TaskGanttContentProps;
|
|
17
|
+
ganttHeight?: number;
|
|
18
|
+
ganttFullHeight?: number;
|
|
19
|
+
scrollY: number;
|
|
20
|
+
ref: any;
|
|
21
|
+
onHorizontalScroll?: (scrollLeft: number) => void;
|
|
22
|
+
showLeftBorder?: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare const TaskGantt: React.FC<TaskGanttProps>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var task_gantt_exports = {};
|
|
38
|
+
__export(task_gantt_exports, {
|
|
39
|
+
TaskGantt: () => TaskGantt
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(task_gantt_exports);
|
|
42
|
+
var import_react = __toESM(require("react"));
|
|
43
|
+
var import_antd = require("antd");
|
|
44
|
+
var import_calendar = require("../calendar/calendar");
|
|
45
|
+
var import_grid = require("../grid/grid");
|
|
46
|
+
var import_task_gantt_content = require("./task-gantt-content");
|
|
47
|
+
var import_style = __toESM(require("./style"));
|
|
48
|
+
const TaskGantt = (0, import_react.forwardRef)(
|
|
49
|
+
({
|
|
50
|
+
gridProps,
|
|
51
|
+
calendarProps,
|
|
52
|
+
barProps,
|
|
53
|
+
ganttHeight,
|
|
54
|
+
ganttFullHeight,
|
|
55
|
+
scrollY,
|
|
56
|
+
onHorizontalScroll,
|
|
57
|
+
showLeftBorder = true
|
|
58
|
+
}, ref) => {
|
|
59
|
+
const ganttSVGRef = (0, import_react.useRef)(null);
|
|
60
|
+
const horizontalContainerRef = (0, import_react.useRef)(null);
|
|
61
|
+
const newBarProps = { ...barProps, svg: ganttSVGRef };
|
|
62
|
+
const { styles } = (0, import_style.default)();
|
|
63
|
+
(0, import_react.useEffect)(() => {
|
|
64
|
+
if (horizontalContainerRef.current) {
|
|
65
|
+
horizontalContainerRef.current.scrollTop = scrollY;
|
|
66
|
+
}
|
|
67
|
+
}, [scrollY]);
|
|
68
|
+
(0, import_react.useEffect)(() => {
|
|
69
|
+
const container = ref.current;
|
|
70
|
+
if (!container || !onHorizontalScroll) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const handleScroll = () => {
|
|
74
|
+
onHorizontalScroll(container.scrollLeft);
|
|
75
|
+
};
|
|
76
|
+
container.addEventListener("scroll", handleScroll);
|
|
77
|
+
return () => {
|
|
78
|
+
container.removeEventListener("scroll", handleScroll);
|
|
79
|
+
};
|
|
80
|
+
}, [onHorizontalScroll, ref]);
|
|
81
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
className: styles.ganttverticalcontainer,
|
|
85
|
+
ref,
|
|
86
|
+
dir: "ltr",
|
|
87
|
+
style: { borderLeft: showLeftBorder ? void 0 : "none" }
|
|
88
|
+
},
|
|
89
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
90
|
+
"svg",
|
|
91
|
+
{
|
|
92
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
93
|
+
width: gridProps.svgWidth,
|
|
94
|
+
height: calendarProps.headerHeight,
|
|
95
|
+
fontFamily: barProps.fontFamily,
|
|
96
|
+
className: "ganttHeader"
|
|
97
|
+
},
|
|
98
|
+
/* @__PURE__ */ import_react.default.createElement(import_calendar.Calendar, { ...calendarProps })
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ import_react.default.createElement(import_antd.Spin, { spinning: barProps == null ? void 0 : barProps.loading }, /* @__PURE__ */ import_react.default.createElement(
|
|
101
|
+
"div",
|
|
102
|
+
{
|
|
103
|
+
ref: horizontalContainerRef,
|
|
104
|
+
className: styles.horizontalcontainer,
|
|
105
|
+
style: ganttHeight ? { maxHeight: ganttHeight, width: gridProps.svgWidth } : { width: gridProps.svgWidth }
|
|
106
|
+
},
|
|
107
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
108
|
+
"svg",
|
|
109
|
+
{
|
|
110
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
111
|
+
width: gridProps.svgWidth,
|
|
112
|
+
height: ganttFullHeight ?? barProps.rowHeight * barProps.tasks.length,
|
|
113
|
+
fontFamily: barProps.fontFamily,
|
|
114
|
+
ref: ganttSVGRef,
|
|
115
|
+
className: "ganttBody"
|
|
116
|
+
},
|
|
117
|
+
/* @__PURE__ */ import_react.default.createElement(import_grid.Grid, { ...gridProps }),
|
|
118
|
+
/* @__PURE__ */ import_react.default.createElement(import_task_gantt_content.TaskGanttContent, { ...newBarProps })
|
|
119
|
+
)
|
|
120
|
+
))
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
TaskGantt.displayName = "TaskGantt";
|
|
125
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
+
0 && (module.exports = {
|
|
127
|
+
TaskGantt
|
|
128
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Task } from '../../types/public-types';
|
|
11
|
+
export type GridBodyProps = {
|
|
12
|
+
tasks: Task[];
|
|
13
|
+
dates: Date[];
|
|
14
|
+
svgWidth: number;
|
|
15
|
+
rowHeight: number;
|
|
16
|
+
columnWidth: number;
|
|
17
|
+
todayColor: string;
|
|
18
|
+
rtl: boolean;
|
|
19
|
+
selectedRowKeys: React.Key[];
|
|
20
|
+
};
|
|
21
|
+
export declare const GridBody: React.FC<GridBodyProps>;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var grid_body_exports = {};
|
|
38
|
+
__export(grid_body_exports, {
|
|
39
|
+
GridBody: () => GridBody
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(grid_body_exports);
|
|
42
|
+
var import_css = require("@emotion/css");
|
|
43
|
+
var import_react = __toESM(require("react"));
|
|
44
|
+
var import_date_helper = require("../../helpers/date-helper");
|
|
45
|
+
var import_style = __toESM(require("./style"));
|
|
46
|
+
const GridBody = ({
|
|
47
|
+
tasks,
|
|
48
|
+
dates,
|
|
49
|
+
rowHeight,
|
|
50
|
+
svgWidth,
|
|
51
|
+
columnWidth,
|
|
52
|
+
todayColor,
|
|
53
|
+
rtl,
|
|
54
|
+
selectedRowKeys
|
|
55
|
+
}) => {
|
|
56
|
+
const { styles } = (0, import_style.default)();
|
|
57
|
+
const data = tasks;
|
|
58
|
+
let y = 0;
|
|
59
|
+
const fullHeight = data.length * rowHeight;
|
|
60
|
+
const gridRows = [];
|
|
61
|
+
const rowLines = [
|
|
62
|
+
/* @__PURE__ */ import_react.default.createElement("line", { key: "RowLineFirst", x: "0", y1: 0, x2: svgWidth, y2: 0, className: (0, import_css.cx)("gridRowLine") })
|
|
63
|
+
];
|
|
64
|
+
for (const task of data) {
|
|
65
|
+
gridRows.push(
|
|
66
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
67
|
+
"rect",
|
|
68
|
+
{
|
|
69
|
+
key: "Row" + task.id,
|
|
70
|
+
x: "0",
|
|
71
|
+
y,
|
|
72
|
+
width: svgWidth,
|
|
73
|
+
height: rowHeight,
|
|
74
|
+
className: (selectedRowKeys == null ? void 0 : selectedRowKeys.includes(String(task.id))) ? styles.gridHeightRow : styles.gridRow
|
|
75
|
+
}
|
|
76
|
+
)
|
|
77
|
+
);
|
|
78
|
+
rowLines.push(
|
|
79
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
80
|
+
"line",
|
|
81
|
+
{
|
|
82
|
+
key: "RowLine" + task.id,
|
|
83
|
+
x: "0",
|
|
84
|
+
y1: y + rowHeight,
|
|
85
|
+
x2: svgWidth,
|
|
86
|
+
y2: y + rowHeight,
|
|
87
|
+
className: (0, import_css.cx)("gridRowLine")
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
);
|
|
91
|
+
y += rowHeight;
|
|
92
|
+
}
|
|
93
|
+
const now = /* @__PURE__ */ new Date();
|
|
94
|
+
let tickX = 0;
|
|
95
|
+
const ticks = [];
|
|
96
|
+
let today = /* @__PURE__ */ import_react.default.createElement("rect", null);
|
|
97
|
+
for (let i = 0; i < dates.length; i++) {
|
|
98
|
+
const date = dates[i];
|
|
99
|
+
ticks.push(/* @__PURE__ */ import_react.default.createElement("line", { key: date.getTime(), x1: tickX, y1: 0, x2: tickX, y2: fullHeight, className: (0, import_css.cx)("gridTick") }));
|
|
100
|
+
if (i + 1 !== dates.length && date.getTime() < now.getTime() && dates[i + 1].getTime() >= now.getTime() || // if current date is last
|
|
101
|
+
i !== 0 && i + 1 === dates.length && date.getTime() < now.getTime() && (0, import_date_helper.addToDate)(date, date.getTime() - dates[i - 1].getTime(), "millisecond").getTime() >= now.getTime()) {
|
|
102
|
+
today = /* @__PURE__ */ import_react.default.createElement("rect", { x: tickX, y: 0, width: columnWidth, height: fullHeight, fill: todayColor });
|
|
103
|
+
}
|
|
104
|
+
if (rtl && i + 1 !== dates.length && date.getTime() >= now.getTime() && dates[i + 1].getTime() < now.getTime()) {
|
|
105
|
+
today = /* @__PURE__ */ import_react.default.createElement("rect", { x: tickX + columnWidth, y: 0, width: columnWidth, height: fullHeight, fill: todayColor });
|
|
106
|
+
}
|
|
107
|
+
tickX += columnWidth;
|
|
108
|
+
}
|
|
109
|
+
return /* @__PURE__ */ import_react.default.createElement("g", { className: (0, import_css.cx)(`gridBody`, styles.nbGridbody) }, /* @__PURE__ */ import_react.default.createElement("g", { className: "rows" }, gridRows), /* @__PURE__ */ import_react.default.createElement("g", { className: "rowLines" }, rowLines), /* @__PURE__ */ import_react.default.createElement("g", { className: "ticks" }, ticks), /* @__PURE__ */ import_react.default.createElement("g", { className: "today" }, today));
|
|
110
|
+
};
|
|
111
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
112
|
+
0 && (module.exports = {
|
|
113
|
+
GridBody
|
|
114
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { GridBodyProps } from './grid-body';
|
|
11
|
+
export type GridProps = GridBodyProps;
|
|
12
|
+
export declare const Grid: React.FC<GridProps>;
|