@jsb188/schedule 1.1.2
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/package.json +62 -0
- package/src/constants/schedule.ts +549 -0
- package/src/css.d.ts +7 -0
- package/src/libs/gantt-geometry.ts +771 -0
- package/src/libs/gantt-histogram.ts +124 -0
- package/src/libs/gantt-keyboard.ts +113 -0
- package/src/libs/gantt-state.ts +57 -0
- package/src/libs/gantt-url.ts +63 -0
- package/src/modules/Gantt.helpers.ts +119 -0
- package/src/modules/Gantt.tsx +584 -0
- package/src/types/schedule.d.ts +1149 -0
- package/src/ui/ActivityFormUI.tsx +133 -0
- package/src/ui/GanttEditorsUI.tsx +102 -0
- package/src/ui/GanttHistogramUI.tsx +236 -0
- package/src/ui/GanttUI.tsx +792 -0
- package/src/ui/ProjectFormUI.tsx +250 -0
- package/src/ui/ProjectMobileListUI.tsx +80 -0
- package/src/ui/ProjectToolbarUI.tsx +54 -0
- package/src/ui/RelationshipListUI.tsx +176 -0
- package/src/ui/ScheduleRunUI.tsx +173 -0
- package/src/ui/ScheduleSettingsUI.tsx +420 -0
- package/src/utils/coverage.helpers.ts +679 -0
- package/src/utils/coverage.ts +630 -0
- package/src/utils/cpm.helpers.ts +674 -0
- package/src/utils/cpm.ts +907 -0
- package/src/utils/cpmLeveling.helpers.ts +564 -0
- package/src/utils/cpmLeveling.ts +367 -0
- package/src/utils/defaults.ts +8 -0
- package/src/utils/eligibility.ts +457 -0
- package/src/utils/planCsv.ts +344 -0
- package/src/utils/predecessorText.ts +96 -0
- package/src/utils/recurrence.ts +616 -0
- package/src/utils/request.ts +153 -0
- package/src/utils/resource.ts +182 -0
- package/src/utils/rule.ts +216 -0
- package/src/utils/run.ts +43 -0
- package/src/utils/series.ts +161 -0
- package/src/utils/slot.ts +208 -0
- package/src/utils/workTime.ts +1382 -0
- package/tests/coverage.fixtures.ts +111 -0
- package/tests/coverage.test.ts +503 -0
- package/tests/cpm.bench.test.ts +154 -0
- package/tests/cpm.test.ts +354 -0
- package/tests/cpmCorrectness.test.ts +327 -0
- package/tests/cpmLeveling.test.ts +471 -0
- package/tests/eligibility.test.ts +320 -0
- package/tests/gantt-geometry.test.ts +367 -0
- package/tests/gantt-histogram.test.ts +78 -0
- package/tests/gantt-keyboard.test.ts +69 -0
- package/tests/helpers/cpmFixtures.ts +101 -0
- package/tests/projectInputs.test.ts +165 -0
- package/tests/recurrence.test.ts +68 -0
- package/tests/request.test.ts +99 -0
- package/tests/resource.test.ts +95 -0
- package/tests/rule.test.ts +98 -0
- package/tests/series.test.ts +120 -0
- package/tests/workTime.test.ts +1007 -0
- package/tests/workTimeContracts.test.ts +111 -0
- package/tsconfig.json +13 -0
- package/vitest.config.ts +8 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { memo, useEffect, useRef, useState, type ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface ActivityFieldObj {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
type?: 'text' | 'number' | 'date' | 'textarea';
|
|
8
|
+
options?: Array<{ value: string; text: string }>;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
min?: number;
|
|
11
|
+
max?: number;
|
|
12
|
+
step?: string;
|
|
13
|
+
}
|
|
14
|
+
/* Keep a field draft local and commit one changed value when focus leaves it. */
|
|
15
|
+
const ActivityFieldUI = memo(
|
|
16
|
+
(p: {
|
|
17
|
+
field: ActivityFieldObj;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
onCommit: (key: string, value: string) => void;
|
|
20
|
+
}) => {
|
|
21
|
+
const [value, setValue] = useState(p.field.value);
|
|
22
|
+
const canceled = useRef(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
setValue(p.field.value);
|
|
25
|
+
}, [p.field.value]);
|
|
26
|
+
/* Save only a changed value so inspecting a field never writes. */
|
|
27
|
+
const commit = () => {
|
|
28
|
+
if (canceled.current) {
|
|
29
|
+
canceled.current = false;
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (value !== p.field.value) p.onCommit(p.field.key, value);
|
|
33
|
+
};
|
|
34
|
+
return (
|
|
35
|
+
<label className="v_stretch gap_xs mt_sm">
|
|
36
|
+
<span className="ft_xxs cl_lt">{p.field.label}</span>
|
|
37
|
+
{p.field.readOnly ? (
|
|
38
|
+
<span className="ft_xs">
|
|
39
|
+
{p.field.options?.find((option) => option.value === p.field.value)
|
|
40
|
+
?.text ||
|
|
41
|
+
p.field.value ||
|
|
42
|
+
'—'}
|
|
43
|
+
</span>
|
|
44
|
+
) : p.field.options ? (
|
|
45
|
+
<select
|
|
46
|
+
className="w_f bg_alt bd_1 bd_bd r_sm ft_xs"
|
|
47
|
+
aria-label={p.field.label}
|
|
48
|
+
value={value}
|
|
49
|
+
disabled={p.disabled}
|
|
50
|
+
onChange={(event) => {
|
|
51
|
+
setValue(event.target.value);
|
|
52
|
+
p.onCommit(p.field.key, event.target.value);
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{p.field.options.map((option) => (
|
|
56
|
+
<option
|
|
57
|
+
key={option.value}
|
|
58
|
+
value={option.value}
|
|
59
|
+
>
|
|
60
|
+
{option.text}
|
|
61
|
+
</option>
|
|
62
|
+
))}
|
|
63
|
+
</select>
|
|
64
|
+
) : p.field.type === 'textarea' ? (
|
|
65
|
+
<textarea
|
|
66
|
+
className="w_f bg_alt bd_1 bd_bd r_sm ft_xs"
|
|
67
|
+
aria-label={p.field.label}
|
|
68
|
+
value={value}
|
|
69
|
+
disabled={p.disabled}
|
|
70
|
+
onChange={(event) => setValue(event.target.value)}
|
|
71
|
+
onBlur={commit}
|
|
72
|
+
/>
|
|
73
|
+
) : (
|
|
74
|
+
<input
|
|
75
|
+
className="w_f bg_alt bd_1 bd_bd r_sm ft_xs"
|
|
76
|
+
aria-label={p.field.label}
|
|
77
|
+
type={p.field.type || 'text'}
|
|
78
|
+
min={p.field.min}
|
|
79
|
+
max={p.field.max}
|
|
80
|
+
step={p.field.step}
|
|
81
|
+
value={value}
|
|
82
|
+
disabled={p.disabled}
|
|
83
|
+
onChange={(event) => setValue(event.target.value)}
|
|
84
|
+
onBlur={commit}
|
|
85
|
+
onKeyDown={(event) => {
|
|
86
|
+
if (event.key === 'Enter') event.currentTarget.blur();
|
|
87
|
+
if (event.key === 'Escape') {
|
|
88
|
+
canceled.current = true;
|
|
89
|
+
setValue(p.field.value);
|
|
90
|
+
event.currentTarget.blur();
|
|
91
|
+
}
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
)}
|
|
95
|
+
</label>
|
|
96
|
+
);
|
|
97
|
+
},
|
|
98
|
+
);
|
|
99
|
+
/* Render the activity inspector's typed fields; all domain mapping and translations belong to its caller. */
|
|
100
|
+
export const ActivityFormUI = memo(
|
|
101
|
+
(p: {
|
|
102
|
+
headingText: string;
|
|
103
|
+
fields: ActivityFieldObj[];
|
|
104
|
+
readOnly?: boolean;
|
|
105
|
+
errorText?: string | null;
|
|
106
|
+
children?: ReactNode;
|
|
107
|
+
onCommit: (key: string, value: string) => void;
|
|
108
|
+
}) => (
|
|
109
|
+
<div
|
|
110
|
+
className="v_stretch"
|
|
111
|
+
style={{ padding: 12 }}
|
|
112
|
+
>
|
|
113
|
+
<span className="ft_sm ft_semibold">{p.headingText}</span>
|
|
114
|
+
{p.errorText ? (
|
|
115
|
+
<p
|
|
116
|
+
className="ft_xs cl_err"
|
|
117
|
+
role="alert"
|
|
118
|
+
>
|
|
119
|
+
{p.errorText}
|
|
120
|
+
</p>
|
|
121
|
+
) : null}
|
|
122
|
+
{p.fields.map((field) => (
|
|
123
|
+
<ActivityFieldUI
|
|
124
|
+
key={field.key}
|
|
125
|
+
field={{ ...field, readOnly: p.readOnly || field.readOnly }}
|
|
126
|
+
onCommit={p.onCommit}
|
|
127
|
+
/>
|
|
128
|
+
))}
|
|
129
|
+
{p.children}
|
|
130
|
+
</div>
|
|
131
|
+
),
|
|
132
|
+
);
|
|
133
|
+
ActivityFormUI.displayName = 'ActivityFormUI';
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { memo, useMemo, useState } from 'react';
|
|
2
|
+
/* Pick resource demand using stable ids and explicit daily units, keeping server commands in the caller. */
|
|
3
|
+
export const GanttResourcePickerUI = memo(
|
|
4
|
+
(p: {
|
|
5
|
+
resources: Array<{
|
|
6
|
+
id: string;
|
|
7
|
+
name: string;
|
|
8
|
+
maxUnitsPerDay: number | null;
|
|
9
|
+
}>;
|
|
10
|
+
assignments: Array<{
|
|
11
|
+
id: string;
|
|
12
|
+
resourceId: string;
|
|
13
|
+
unitsPerDay: number | null;
|
|
14
|
+
}>;
|
|
15
|
+
searchLabel: string;
|
|
16
|
+
unitsLabel: string;
|
|
17
|
+
readOnly?: boolean;
|
|
18
|
+
onChange: (
|
|
19
|
+
resourceId: string,
|
|
20
|
+
selected: boolean,
|
|
21
|
+
units: number | null,
|
|
22
|
+
) => void;
|
|
23
|
+
}) => {
|
|
24
|
+
const [search, setSearch] = useState('');
|
|
25
|
+
const normalizedSearch = search.toLowerCase();
|
|
26
|
+
const assignmentsByResourceId = useMemo(() => {
|
|
27
|
+
const assignments = new Map<string, (typeof p.assignments)[number]>();
|
|
28
|
+
for (const assignment of p.assignments) {
|
|
29
|
+
if (!assignments.has(assignment.resourceId))
|
|
30
|
+
assignments.set(assignment.resourceId, assignment);
|
|
31
|
+
}
|
|
32
|
+
return assignments;
|
|
33
|
+
}, [p.assignments]);
|
|
34
|
+
const visibleResources = useMemo(
|
|
35
|
+
() =>
|
|
36
|
+
p.resources.filter((row) =>
|
|
37
|
+
row.name.toLowerCase().includes(normalizedSearch),
|
|
38
|
+
),
|
|
39
|
+
[p.resources, normalizedSearch],
|
|
40
|
+
);
|
|
41
|
+
return (
|
|
42
|
+
<div className="v_stretch gap_xs">
|
|
43
|
+
<input
|
|
44
|
+
className="bg_alt bd_1 bd_bd ft_xs"
|
|
45
|
+
aria-label={p.searchLabel}
|
|
46
|
+
placeholder={p.searchLabel}
|
|
47
|
+
value={search}
|
|
48
|
+
onChange={(event) => setSearch(event.target.value)}
|
|
49
|
+
/>
|
|
50
|
+
{visibleResources.map((row) => {
|
|
51
|
+
const assignment = assignmentsByResourceId.get(row.id);
|
|
52
|
+
return (
|
|
53
|
+
<div
|
|
54
|
+
key={row.id}
|
|
55
|
+
className="h_item gap_xs"
|
|
56
|
+
>
|
|
57
|
+
<label className="f h_item gap_xs ft_xs">
|
|
58
|
+
<input
|
|
59
|
+
type="checkbox"
|
|
60
|
+
checked={!!assignment}
|
|
61
|
+
disabled={p.readOnly}
|
|
62
|
+
onChange={(event) =>
|
|
63
|
+
p.onChange(
|
|
64
|
+
row.id,
|
|
65
|
+
event.target.checked,
|
|
66
|
+
assignment?.unitsPerDay ?? row.maxUnitsPerDay,
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
/>
|
|
70
|
+
{row.name}
|
|
71
|
+
</label>
|
|
72
|
+
{assignment ? (
|
|
73
|
+
<input
|
|
74
|
+
key={`${row.id}:${assignment.unitsPerDay}`}
|
|
75
|
+
className="bg_alt bd_1 bd_bd ft_xs"
|
|
76
|
+
style={{ width: 64 }}
|
|
77
|
+
type="number"
|
|
78
|
+
step="any"
|
|
79
|
+
min="0.001"
|
|
80
|
+
aria-label={`${p.unitsLabel}: ${row.name}`}
|
|
81
|
+
defaultValue={assignment.unitsPerDay ?? ''}
|
|
82
|
+
disabled={p.readOnly}
|
|
83
|
+
onBlur={(event) => {
|
|
84
|
+
const text = event.target.value;
|
|
85
|
+
const units = text ? Number(text) : null;
|
|
86
|
+
if (
|
|
87
|
+
(units == null ||
|
|
88
|
+
(Number.isFinite(units) && units > 0)) &&
|
|
89
|
+
units !== assignment.unitsPerDay
|
|
90
|
+
)
|
|
91
|
+
p.onChange(row.id, true, units);
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
) : null}
|
|
95
|
+
</div>
|
|
96
|
+
);
|
|
97
|
+
})}
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
},
|
|
101
|
+
);
|
|
102
|
+
GanttResourcePickerUI.displayName = 'GanttResourcePickerUI';
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { memo, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import type { GanttScaleObj } from '../libs/gantt-geometry.ts';
|
|
3
|
+
import {
|
|
4
|
+
buildGanttHistogram,
|
|
5
|
+
buildGanttHistogramScale,
|
|
6
|
+
type GanttUsageDay,
|
|
7
|
+
} from '../libs/gantt-histogram.ts';
|
|
8
|
+
|
|
9
|
+
export interface GanttHistogramUIProps {
|
|
10
|
+
rows: GanttUsageDay[];
|
|
11
|
+
resources: Array<{ id: string; name: string }>;
|
|
12
|
+
fromDate: string;
|
|
13
|
+
toDate: string;
|
|
14
|
+
timeZone: string;
|
|
15
|
+
selectedIds?: string[];
|
|
16
|
+
scale?: GanttScaleObj;
|
|
17
|
+
scrollLeft?: number;
|
|
18
|
+
tableWidth?: number;
|
|
19
|
+
labels: {
|
|
20
|
+
empty: string;
|
|
21
|
+
overallocatedDays: (count: number) => string;
|
|
22
|
+
usage: (
|
|
23
|
+
date: string,
|
|
24
|
+
demand: number,
|
|
25
|
+
available: number | null,
|
|
26
|
+
external: number,
|
|
27
|
+
) => string;
|
|
28
|
+
clamped?: string;
|
|
29
|
+
};
|
|
30
|
+
onSelect?: (resourceId: string, date: string) => void;
|
|
31
|
+
onScrollLeft?: (left: number) => void;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* Draw only visible daily bars, keeping the resource labels fixed beside the synchronized time axis. */
|
|
35
|
+
export const GanttHistogramUI = memo((p: GanttHistogramUIProps) => {
|
|
36
|
+
const body = useRef<HTMLDivElement>(null);
|
|
37
|
+
const frame = useRef<number | null>(null);
|
|
38
|
+
const [viewport, setViewport] = useState({ left: 0, width: 1000 });
|
|
39
|
+
const latest = useRef(p);
|
|
40
|
+
latest.current = p;
|
|
41
|
+
const scale = useMemo(
|
|
42
|
+
() => p.scale || buildGanttHistogramScale(p.fromDate, p.toDate, p.timeZone),
|
|
43
|
+
[p.scale, p.fromDate, p.toDate, p.timeZone],
|
|
44
|
+
);
|
|
45
|
+
const resources = useMemo(() => {
|
|
46
|
+
const selectedIds = p.selectedIds?.length ? new Set(p.selectedIds) : null;
|
|
47
|
+
const visible = [] as typeof p.resources;
|
|
48
|
+
for (const resource of p.resources) {
|
|
49
|
+
if (!selectedIds || selectedIds.has(resource.id)) visible.push(resource);
|
|
50
|
+
if (visible.length === 8) break;
|
|
51
|
+
}
|
|
52
|
+
return visible;
|
|
53
|
+
}, [p.resources, p.selectedIds]);
|
|
54
|
+
const lanes = useMemo(() => {
|
|
55
|
+
const rowsByResourceId = new Map(
|
|
56
|
+
resources.map((resource) => [resource.id, [] as typeof p.rows]),
|
|
57
|
+
);
|
|
58
|
+
for (const row of p.rows) rowsByResourceId.get(row.resourceId)?.push(row);
|
|
59
|
+
return resources.map((resource) => {
|
|
60
|
+
const bars = buildGanttHistogram(
|
|
61
|
+
rowsByResourceId.get(resource.id)!,
|
|
62
|
+
scale,
|
|
63
|
+
resource.id,
|
|
64
|
+
);
|
|
65
|
+
return {
|
|
66
|
+
resource,
|
|
67
|
+
bars,
|
|
68
|
+
overallocatedDays: bars.reduce(
|
|
69
|
+
(count, bar) => count + Number(bar.overallocated),
|
|
70
|
+
0,
|
|
71
|
+
),
|
|
72
|
+
};
|
|
73
|
+
});
|
|
74
|
+
}, [resources, p.rows, scale]);
|
|
75
|
+
const tableWidth = p.tableWidth ?? 240;
|
|
76
|
+
/* Coalesce native scrolling and resizing so a large axis never causes per-pixel React updates. */
|
|
77
|
+
const measure = () => {
|
|
78
|
+
if (frame.current !== null) return;
|
|
79
|
+
frame.current = requestAnimationFrame(() => {
|
|
80
|
+
frame.current = null;
|
|
81
|
+
if (!body.current) return;
|
|
82
|
+
const left = body.current.scrollLeft;
|
|
83
|
+
const width = Math.max(1, body.current.clientWidth - tableWidth);
|
|
84
|
+
setViewport((current) => {
|
|
85
|
+
return current.left === left && current.width === width
|
|
86
|
+
? current
|
|
87
|
+
: { left, width };
|
|
88
|
+
});
|
|
89
|
+
latest.current.onScrollLeft?.(left);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
const observer =
|
|
94
|
+
typeof ResizeObserver === 'undefined'
|
|
95
|
+
? null
|
|
96
|
+
: new ResizeObserver(measure);
|
|
97
|
+
if (body.current) observer?.observe(body.current);
|
|
98
|
+
measure();
|
|
99
|
+
return () => {
|
|
100
|
+
observer?.disconnect();
|
|
101
|
+
if (frame.current !== null) cancelAnimationFrame(frame.current);
|
|
102
|
+
};
|
|
103
|
+
}, [tableWidth]);
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if (
|
|
106
|
+
body.current &&
|
|
107
|
+
p.scrollLeft !== undefined &&
|
|
108
|
+
Math.abs(body.current.scrollLeft - p.scrollLeft) > 1
|
|
109
|
+
) {
|
|
110
|
+
body.current.scrollLeft = p.scrollLeft;
|
|
111
|
+
measure();
|
|
112
|
+
}
|
|
113
|
+
}, [p.scrollLeft]);
|
|
114
|
+
const left = viewport.left - viewport.width;
|
|
115
|
+
const right = viewport.left + viewport.width * 2;
|
|
116
|
+
return (
|
|
117
|
+
<div className="v_stretch of">
|
|
118
|
+
{p.labels.clamped && (
|
|
119
|
+
<div className="p_xs ft_xs cl_warn">{p.labels.clamped}</div>
|
|
120
|
+
)}
|
|
121
|
+
{!lanes.length ? (
|
|
122
|
+
<p className="p_sm ft_sm cl_lt">{p.labels.empty}</p>
|
|
123
|
+
) : (
|
|
124
|
+
<div
|
|
125
|
+
ref={body}
|
|
126
|
+
onScroll={measure}
|
|
127
|
+
className="of auto_x app_scr"
|
|
128
|
+
>
|
|
129
|
+
<div style={{ width: tableWidth + scale.totalWidth }}>
|
|
130
|
+
<div
|
|
131
|
+
className="h_item bd_b_1 bd_b_bd"
|
|
132
|
+
style={{ height: 28 }}
|
|
133
|
+
>
|
|
134
|
+
<div
|
|
135
|
+
className="sticky bg no_shrink"
|
|
136
|
+
style={{ left: 0, width: tableWidth, zIndex: 2 }}
|
|
137
|
+
/>
|
|
138
|
+
<div
|
|
139
|
+
className="rel"
|
|
140
|
+
style={{ width: scale.totalWidth, height: 28 }}
|
|
141
|
+
>
|
|
142
|
+
{scale.majorTicks
|
|
143
|
+
.filter(
|
|
144
|
+
(tick) => tick.x + tick.width >= left && tick.x <= right,
|
|
145
|
+
)
|
|
146
|
+
.map((tick) => (
|
|
147
|
+
<span
|
|
148
|
+
key={tick.x}
|
|
149
|
+
className="abs ft_xs cl_lt px_xs"
|
|
150
|
+
style={{ left: tick.x, width: tick.width }}
|
|
151
|
+
>
|
|
152
|
+
{tick.label}
|
|
153
|
+
</span>
|
|
154
|
+
))}
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
{lanes.map(({ resource, bars, overallocatedDays }) => (
|
|
158
|
+
<div
|
|
159
|
+
key={resource.id}
|
|
160
|
+
className="h_item bd_b_1 bd_b_bd"
|
|
161
|
+
style={{ height: 60 }}
|
|
162
|
+
>
|
|
163
|
+
<div
|
|
164
|
+
className="sticky bg no_shrink px_sm bd_r_1 bd_r_bd"
|
|
165
|
+
style={{ left: 0, width: tableWidth, zIndex: 2 }}
|
|
166
|
+
>
|
|
167
|
+
<div className="ft_sm ellip">{resource.name}</div>
|
|
168
|
+
<div className="ft_xs cl_lt">
|
|
169
|
+
{p.labels.overallocatedDays(overallocatedDays)}
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
<div
|
|
173
|
+
className="rel"
|
|
174
|
+
style={{ width: scale.totalWidth, height: 24 }}
|
|
175
|
+
>
|
|
176
|
+
{bars
|
|
177
|
+
.filter(
|
|
178
|
+
(bar) => bar.x + bar.width >= left && bar.x <= right,
|
|
179
|
+
)
|
|
180
|
+
.map((bar) => (
|
|
181
|
+
<button
|
|
182
|
+
key={bar.date}
|
|
183
|
+
type="button"
|
|
184
|
+
className="abs pointer"
|
|
185
|
+
title={p.labels.usage(
|
|
186
|
+
bar.date,
|
|
187
|
+
bar.demandUnits,
|
|
188
|
+
bar.availableUnits,
|
|
189
|
+
bar.externalUnits,
|
|
190
|
+
)}
|
|
191
|
+
aria-label={`${resource.name}: ${p.labels.usage(bar.date, bar.demandUnits, bar.availableUnits, bar.externalUnits)}`}
|
|
192
|
+
onClick={() => p.onSelect?.(resource.id, bar.date)}
|
|
193
|
+
style={{
|
|
194
|
+
left: bar.x,
|
|
195
|
+
width: Math.max(1, bar.width - 1),
|
|
196
|
+
height: 24,
|
|
197
|
+
padding: 0,
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
<span
|
|
201
|
+
className="abs bg_medium"
|
|
202
|
+
style={{
|
|
203
|
+
left: 0,
|
|
204
|
+
right: 0,
|
|
205
|
+
bottom: 0,
|
|
206
|
+
height: bar.externalHeight,
|
|
207
|
+
}}
|
|
208
|
+
/>
|
|
209
|
+
<span
|
|
210
|
+
className={
|
|
211
|
+
bar.overallocated ? 'abs bg_err' : 'abs bg_primary'
|
|
212
|
+
}
|
|
213
|
+
style={{
|
|
214
|
+
left: 0,
|
|
215
|
+
right: 0,
|
|
216
|
+
bottom: bar.externalHeight,
|
|
217
|
+
height: bar.demandHeight,
|
|
218
|
+
}}
|
|
219
|
+
/>
|
|
220
|
+
<span
|
|
221
|
+
className="abs bd_t_1 bd_t_contrast"
|
|
222
|
+
style={{ left: 0, right: 0, top: bar.availableY }}
|
|
223
|
+
/>
|
|
224
|
+
</button>
|
|
225
|
+
))}
|
|
226
|
+
</div>
|
|
227
|
+
</div>
|
|
228
|
+
))}
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
)}
|
|
232
|
+
</div>
|
|
233
|
+
);
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
GanttHistogramUI.displayName = 'GanttHistogramUI';
|