@multiplatform.one/components 10.1.1 → 10.1.3
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/dist/cjs/MiddleEllipsisText/index.native.cjs +5 -1
- package/dist/cjs/MiddleEllipsisText/index.native.js +5 -1
- package/dist/cjs/MiddleEllipsisText/index.native.js.map +1 -1
- package/dist/cjs/Tabs/index.cjs +3 -2
- package/dist/cjs/Tabs/index.native.cjs +3 -2
- package/dist/cjs/Tabs/index.native.js +3 -2
- package/dist/cjs/Tabs/index.native.js.map +1 -1
- package/dist/cjs/layouts/timeline.cjs +0 -1
- package/dist/cjs/layouts/timeline.native.cjs +0 -1
- package/dist/cjs/layouts/timeline.native.js +0 -1
- package/dist/cjs/layouts/timeline.native.js.map +1 -1
- package/dist/cjs/views/Calendar.cjs +54 -76
- package/dist/cjs/views/Calendar.native.cjs +54 -76
- package/dist/cjs/views/Calendar.native.js +54 -76
- package/dist/cjs/views/Calendar.native.js.map +1 -1
- package/dist/cjs/views/Gantt.cjs +185 -69
- package/dist/cjs/views/Gantt.native.cjs +190 -72
- package/dist/cjs/views/Gantt.native.js +190 -72
- package/dist/cjs/views/Gantt.native.js.map +1 -1
- package/dist/cjs/views/GanttDateGrip.cjs +20 -14
- package/dist/cjs/views/GanttDateGrip.native.cjs +24 -14
- package/dist/cjs/views/GanttDateGrip.native.js +24 -14
- package/dist/cjs/views/GanttDateGrip.native.js.map +1 -1
- package/dist/cjs/views/GanttGripDot.cjs +43 -0
- package/dist/cjs/views/GanttGripDot.native.cjs +46 -0
- package/dist/cjs/views/GanttGripDot.native.js +48 -0
- package/dist/cjs/views/GanttGripDot.native.js.map +1 -0
- package/dist/cjs/views/eventTint.cjs +242 -0
- package/dist/cjs/views/eventTint.native.cjs +346 -0
- package/dist/cjs/views/eventTint.native.js +348 -0
- package/dist/cjs/views/eventTint.native.js.map +1 -0
- package/dist/esm/MiddleEllipsisText/index.native.js +2 -1
- package/dist/esm/MiddleEllipsisText/index.native.js.map +1 -1
- package/dist/esm/Tabs/index.mjs +3 -2
- package/dist/esm/Tabs/index.mjs.map +1 -1
- package/dist/esm/Tabs/index.native.js +3 -2
- package/dist/esm/Tabs/index.native.js.map +1 -1
- package/dist/esm/layouts/timeline.mjs +0 -1
- package/dist/esm/layouts/timeline.mjs.map +1 -1
- package/dist/esm/layouts/timeline.native.js +0 -1
- package/dist/esm/layouts/timeline.native.js.map +1 -1
- package/dist/esm/views/Calendar.mjs +53 -75
- package/dist/esm/views/Calendar.mjs.map +1 -1
- package/dist/esm/views/Calendar.native.js +53 -75
- package/dist/esm/views/Calendar.native.js.map +1 -1
- package/dist/esm/views/Gantt.mjs +186 -70
- package/dist/esm/views/Gantt.mjs.map +1 -1
- package/dist/esm/views/Gantt.native.js +191 -73
- package/dist/esm/views/Gantt.native.js.map +1 -1
- package/dist/esm/views/GanttDateGrip.mjs +21 -15
- package/dist/esm/views/GanttDateGrip.mjs.map +1 -1
- package/dist/esm/views/GanttDateGrip.native.js +25 -15
- package/dist/esm/views/GanttDateGrip.native.js.map +1 -1
- package/dist/esm/views/GanttGripDot.mjs +24 -0
- package/dist/esm/views/GanttGripDot.mjs.map +1 -0
- package/dist/esm/views/GanttGripDot.native.js +25 -0
- package/dist/esm/views/GanttGripDot.native.js.map +1 -0
- package/dist/esm/views/eventTint.mjs +196 -0
- package/dist/esm/views/eventTint.mjs.map +1 -0
- package/dist/esm/views/eventTint.native.js +298 -0
- package/dist/esm/views/eventTint.native.js.map +1 -0
- package/dist/jsx/MiddleEllipsisText/index.native.cjs +5 -1
- package/dist/jsx/MiddleEllipsisText/index.native.js +5 -1
- package/dist/jsx/MiddleEllipsisText/index.native.js.map +1 -1
- package/dist/jsx/Tabs/index.mjs +3 -2
- package/dist/jsx/Tabs/index.mjs.map +1 -1
- package/dist/jsx/Tabs/index.native.cjs +3 -2
- package/dist/jsx/Tabs/index.native.js +3 -2
- package/dist/jsx/Tabs/index.native.js.map +1 -1
- package/dist/jsx/layouts/timeline.mjs +0 -1
- package/dist/jsx/layouts/timeline.mjs.map +1 -1
- package/dist/jsx/layouts/timeline.native.cjs +0 -1
- package/dist/jsx/layouts/timeline.native.js +0 -1
- package/dist/jsx/layouts/timeline.native.js.map +1 -1
- package/dist/jsx/views/Calendar.mjs +53 -75
- package/dist/jsx/views/Calendar.mjs.map +1 -1
- package/dist/jsx/views/Calendar.native.cjs +54 -76
- package/dist/jsx/views/Calendar.native.js +54 -76
- package/dist/jsx/views/Calendar.native.js.map +1 -1
- package/dist/jsx/views/Gantt.mjs +186 -70
- package/dist/jsx/views/Gantt.mjs.map +1 -1
- package/dist/jsx/views/Gantt.native.cjs +190 -72
- package/dist/jsx/views/Gantt.native.js +190 -72
- package/dist/jsx/views/Gantt.native.js.map +1 -1
- package/dist/jsx/views/GanttDateGrip.mjs +21 -15
- package/dist/jsx/views/GanttDateGrip.mjs.map +1 -1
- package/dist/jsx/views/GanttDateGrip.native.cjs +24 -14
- package/dist/jsx/views/GanttDateGrip.native.js +24 -14
- package/dist/jsx/views/GanttDateGrip.native.js.map +1 -1
- package/dist/jsx/views/GanttGripDot.mjs +24 -0
- package/dist/jsx/views/GanttGripDot.mjs.map +1 -0
- package/dist/jsx/views/GanttGripDot.native.cjs +46 -0
- package/dist/jsx/views/GanttGripDot.native.js +48 -0
- package/dist/jsx/views/GanttGripDot.native.js.map +1 -0
- package/dist/jsx/views/eventTint.mjs +196 -0
- package/dist/jsx/views/eventTint.mjs.map +1 -0
- package/dist/jsx/views/eventTint.native.cjs +346 -0
- package/dist/jsx/views/eventTint.native.js +348 -0
- package/dist/jsx/views/eventTint.native.js.map +1 -0
- package/package.json +7 -7
- package/src/MiddleEllipsisText/MiddleEllipsisText.native.spec.tsx +9 -0
- package/src/MiddleEllipsisText/index.native.tsx +1 -0
- package/src/Tabs/Tabs.measurement.spec.tsx +40 -1
- package/src/Tabs/index.tsx +3 -2
- package/src/hoverTouchPath.coarse.spec.tsx +28 -4
- package/src/layouts/timeline.replyInset.spec.tsx +72 -22
- package/src/layouts/timeline.tsx +0 -1
- package/src/views/Calendar.eventFill.spec.tsx +44 -9
- package/src/views/Calendar.tsx +23 -31
- package/src/views/Gantt.barInk.spec.tsx +257 -0
- package/src/views/Gantt.grips.spec.tsx +226 -0
- package/src/views/Gantt.tint.palette.spec.ts +288 -0
- package/src/views/Gantt.tsx +224 -65
- package/src/views/GanttDateGrip.native.spec.tsx +8 -0
- package/src/views/GanttDateGrip.tsx +28 -17
- package/src/views/GanttGripDot.tsx +36 -0
- package/src/views/dataIdentity.spec.tsx +29 -13
- package/src/views/eventTint.ts +305 -0
- package/types/MiddleEllipsisText/index.native.d.ts +1 -0
- package/types/MiddleEllipsisText/index.native.d.ts.map +1 -1
- package/types/Tabs/index.d.ts.map +1 -1
- package/types/layouts/timeline.d.ts.map +1 -1
- package/types/views/Calendar.d.ts.map +1 -1
- package/types/views/Gantt.d.ts.map +1 -1
- package/types/views/GanttDateGrip.d.ts +7 -0
- package/types/views/GanttDateGrip.d.ts.map +1 -1
- package/types/views/GanttGripDot.d.ts +9 -0
- package/types/views/GanttGripDot.d.ts.map +1 -0
- package/types/views/eventTint.d.ts +72 -0
- package/types/views/eventTint.d.ts.map +1 -0
package/dist/jsx/views/Gantt.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Intent, MIN_PRESS_TARGET, ensureKeyboardModalityTracking, formatAbsoluteDate, formatDayOfMonth, formatMonthYear, hairline, hairlineWidth, keyboardFocusRingProps, transitionProps, useChartPalette,
|
|
1
|
+
import { Intent, MIN_PRESS_TARGET, ensureKeyboardModalityTracking, formatAbsoluteDate, formatDayOfMonth, formatMonthYear, hairline, hairlineWidth, keyboardFocusRingProps, transitionProps, useChartPalette, useResolvedKnobs, wasKeyboardFocus } from "@multiplatform.one/theme";
|
|
2
2
|
import { componentColors, sectionHeading } from "../componentColors.mjs";
|
|
3
3
|
import { AsyncBoundary } from "../layouts/AsyncBoundary.mjs";
|
|
4
4
|
import { Skeleton } from "../Skeleton/index.mjs";
|
|
@@ -14,6 +14,8 @@ import { ScrollView as ScrollView$1 } from "../ScrollView.mjs";
|
|
|
14
14
|
import { LinearGradient } from "tamagui/linear-gradient";
|
|
15
15
|
import { normalizeColor } from "@tamagui/core";
|
|
16
16
|
import { GanttDateGrip } from "./GanttDateGrip.mjs";
|
|
17
|
+
import { GanttGripDot } from "./GanttGripDot.mjs";
|
|
18
|
+
import { EVENT_BAR_PX, EVENT_GRIP_DOT_PX, eventLabelInk, eventPaint, eventSolid, eventStripPaint, useEventDark } from "./eventTint.mjs";
|
|
17
19
|
import { intervalEdgeX, intervalViewport } from "./ganttIntervals.mjs";
|
|
18
20
|
import { addDays, barGeometry, clampResizeDayDelta, computeGanttRange, dateLineX, dateToX, dayDiff, dxToDayDelta, formatRangeLabel, formatSpanLabel, ganttTaskAccessibleLabel, generateTicks, isBoundedSpan, openBarGeometry, openSpanExtents, openSpanLabelParts, rangeDays, resizeSpanByDays, scrollAnchorX, shiftSpanByDays, spanInclusiveDays, startOfDay, todayLineX } from "./ganttMath.mjs";
|
|
19
21
|
import { Text as Text$1 } from "../Text.mjs";
|
|
@@ -165,29 +167,55 @@ function BarIntentWrap({ intent, children }) {
|
|
|
165
167
|
children
|
|
166
168
|
});
|
|
167
169
|
}
|
|
168
|
-
|
|
170
|
+
const STRIP_INSET_PX = 4;
|
|
171
|
+
const STRIP_BOTTOM_PX = 2;
|
|
172
|
+
const STRIP_TRACK_OPACITY = .3;
|
|
173
|
+
function GanttBarLabel({ title, fill, state, surface, dark }) {
|
|
169
174
|
const { knobProps } = useResolvedKnobs();
|
|
170
|
-
const
|
|
175
|
+
const theme = useTheme();
|
|
176
|
+
const solid = dark || state === "ghost" ? null : eventSolid(theme, fill, state);
|
|
177
|
+
const ink = solid?.ink ?? eventLabelInk(theme, fill, [eventPaint(theme, fill, state, {
|
|
178
|
+
dark,
|
|
179
|
+
surface
|
|
180
|
+
})], dark, state === "ghost" ? "secondary" : "primary");
|
|
171
181
|
return /* @__PURE__ */ jsx(Text, {
|
|
172
|
-
color: ink
|
|
182
|
+
color: ink,
|
|
173
183
|
...knobProps.label,
|
|
174
184
|
numberOfLines: 1,
|
|
175
185
|
paddingHorizontal: knobProps.control.paddingHorizontal,
|
|
176
186
|
pointerEvents: "none",
|
|
177
187
|
zIndex: 1,
|
|
178
188
|
"aria-hidden": true,
|
|
189
|
+
...{
|
|
190
|
+
"data-gantt-bar-ink": ink,
|
|
191
|
+
"data-gantt-ghost-label": state === "ghost" ? "true" : void 0
|
|
192
|
+
},
|
|
179
193
|
children: `${title}\u200B`
|
|
180
194
|
});
|
|
181
195
|
}
|
|
182
|
-
function GanttIntervalFill({ fill, openStart, openEnd, width, rtl,
|
|
196
|
+
function GanttIntervalFill({ fill, surface, openStart, openEnd, width, rtl, state, dark, progress, lead }) {
|
|
183
197
|
const { knobProps } = useResolvedKnobs();
|
|
184
198
|
const theme = useTheme();
|
|
199
|
+
const values = theme;
|
|
185
200
|
const fillKey = fill.startsWith("$") ? fill.slice(1) : fill;
|
|
186
|
-
const color = theme[fillKey]?.val ?? getTokenValue(fillKey, "color") ?? fill;
|
|
187
|
-
const
|
|
201
|
+
const color = String(theme[fillKey]?.val ?? getTokenValue(fillKey, "color") ?? fill);
|
|
202
|
+
const solid = dark || state === "ghost" ? null : eventSolid(values, fill, state);
|
|
203
|
+
const paint = solid?.paint ?? eventPaint(values, fill, state, {
|
|
204
|
+
dark,
|
|
205
|
+
surface
|
|
206
|
+
});
|
|
207
|
+
const body = paint ?? color;
|
|
208
|
+
const strip = solid ? solid.ink : paint ? eventStripPaint(values, fill, {
|
|
209
|
+
dark,
|
|
210
|
+
surface
|
|
211
|
+
}) : null;
|
|
212
|
+
const leading = lead && !solid;
|
|
213
|
+
const clear = normalizeColor(body, 0) ?? "transparent";
|
|
188
214
|
const fadeWidth = Math.min(Number(knobProps.control.height), width / 2);
|
|
189
215
|
const leftOpen = rtl ? openEnd : openStart;
|
|
190
216
|
const rightOpen = rtl ? openStart : openEnd;
|
|
217
|
+
const stripStart = (leading ? EVENT_BAR_PX : 0) + STRIP_INSET_PX;
|
|
218
|
+
const stripWidth = progress != null ? Math.max(0, width - stripStart - STRIP_INSET_PX) * progress / 100 : 0;
|
|
191
219
|
return /* @__PURE__ */ jsxs(YStack, {
|
|
192
220
|
position: "absolute",
|
|
193
221
|
top: 0,
|
|
@@ -195,34 +223,75 @@ function GanttIntervalFill({ fill, openStart, openEnd, width, rtl, ghost }) {
|
|
|
195
223
|
left: 0,
|
|
196
224
|
right: 0,
|
|
197
225
|
pointerEvents: "none",
|
|
198
|
-
opacity: ghost ? .25 : 1,
|
|
199
226
|
overflow: "hidden",
|
|
200
227
|
...knobProps.borderRadius,
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}), ["start", "end"].map((edge) => {
|
|
209
|
-
if (edge === "start" ? !openStart : !openEnd) return null;
|
|
210
|
-
const left = edge === "start" !== rtl;
|
|
211
|
-
return /* @__PURE__ */ jsx(LinearGradient, {
|
|
228
|
+
borderWidth: 0,
|
|
229
|
+
...{
|
|
230
|
+
"data-gantt-bar-state": state,
|
|
231
|
+
"data-gantt-bar-paint": paint ?? void 0
|
|
232
|
+
},
|
|
233
|
+
children: [
|
|
234
|
+
/* @__PURE__ */ jsx(YStack, {
|
|
212
235
|
position: "absolute",
|
|
213
236
|
top: 0,
|
|
214
237
|
bottom: 0,
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
238
|
+
left: leftOpen ? fadeWidth : 0,
|
|
239
|
+
right: rightOpen ? fadeWidth : 0,
|
|
240
|
+
backgroundColor: body,
|
|
241
|
+
...{ "data-gantt-bar-fill": fill }
|
|
242
|
+
}),
|
|
243
|
+
["start", "end"].map((edge) => {
|
|
244
|
+
if (edge === "start" ? !openStart : !openEnd) return null;
|
|
245
|
+
const left = edge === "start" !== rtl;
|
|
246
|
+
return /* @__PURE__ */ jsx(LinearGradient, {
|
|
247
|
+
position: "absolute",
|
|
248
|
+
top: 0,
|
|
249
|
+
bottom: 0,
|
|
250
|
+
...left ? { left: 0 } : { right: 0 },
|
|
251
|
+
width: fadeWidth,
|
|
252
|
+
colors: left ? [clear, body] : [body, clear],
|
|
253
|
+
start: [0, 0],
|
|
254
|
+
end: [1, 0],
|
|
255
|
+
...{
|
|
256
|
+
"data-gantt-open-fade": edge,
|
|
257
|
+
[`data-gantt-open-${edge}`]: "true"
|
|
258
|
+
}
|
|
259
|
+
}, edge);
|
|
260
|
+
}),
|
|
261
|
+
solid && progress != null && /* @__PURE__ */ jsx(YStack, {
|
|
262
|
+
position: "absolute",
|
|
263
|
+
bottom: STRIP_BOTTOM_PX,
|
|
264
|
+
height: EVENT_BAR_PX,
|
|
265
|
+
...rtl ? { right: stripStart } : { left: stripStart },
|
|
266
|
+
width: Math.max(0, width - stripStart - STRIP_INSET_PX),
|
|
267
|
+
borderRadius: EVENT_BAR_PX / 2,
|
|
268
|
+
backgroundColor: solid.ink,
|
|
269
|
+
opacity: STRIP_TRACK_OPACITY,
|
|
270
|
+
...{ "data-gantt-progress-track": solid.ink }
|
|
271
|
+
}),
|
|
272
|
+
stripWidth > 0 && /* @__PURE__ */ jsx(YStack, {
|
|
273
|
+
position: "absolute",
|
|
274
|
+
bottom: STRIP_BOTTOM_PX,
|
|
275
|
+
height: EVENT_BAR_PX,
|
|
276
|
+
...rtl ? { right: stripStart } : { left: stripStart },
|
|
277
|
+
width: stripWidth,
|
|
278
|
+
borderRadius: EVENT_BAR_PX / 2,
|
|
279
|
+
backgroundColor: strip ?? color,
|
|
220
280
|
...{
|
|
221
|
-
"data-gantt-
|
|
222
|
-
|
|
281
|
+
"data-gantt-progress": String(progress),
|
|
282
|
+
"data-gantt-progress-paint": strip
|
|
223
283
|
}
|
|
224
|
-
},
|
|
225
|
-
|
|
284
|
+
}),
|
|
285
|
+
leading && /* @__PURE__ */ jsx(YStack, {
|
|
286
|
+
position: "absolute",
|
|
287
|
+
top: 0,
|
|
288
|
+
bottom: 0,
|
|
289
|
+
...rtl ? { right: 0 } : { left: 0 },
|
|
290
|
+
width: EVENT_BAR_PX,
|
|
291
|
+
backgroundColor: color,
|
|
292
|
+
...{ "data-gantt-bar-lead": "true" }
|
|
293
|
+
})
|
|
294
|
+
]
|
|
226
295
|
});
|
|
227
296
|
}
|
|
228
297
|
function GanttTaskName({ title, selected, body }) {
|
|
@@ -235,6 +304,10 @@ function GanttTaskName({ title, selected, body }) {
|
|
|
235
304
|
}
|
|
236
305
|
function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPress, onItemMove, enableItemDrag, onIntervalChange, snapUnit = "day", isLoading = false, error = null, onRetry, emptyTitle, emptyDescription, height: heightProp, labelWidth = 180, showToday = true, showNavigation = true, showZoomSwitcher = true, firstDayOfWeek = 0, initialDate, markerDate, onMarkerDateChange, enableMarkerDrag, markerLabel, ...stackProps }) {
|
|
237
306
|
const identity = useChartPalette().single;
|
|
307
|
+
const canvasTheme = useTheme();
|
|
308
|
+
const canvasBackground = canvasTheme.background?.val;
|
|
309
|
+
const canvasGround = typeof canvasBackground === "string" ? canvasBackground : void 0;
|
|
310
|
+
const dark = useEventDark();
|
|
238
311
|
const { t } = useTranslation();
|
|
239
312
|
const { knobProps } = useResolvedKnobs();
|
|
240
313
|
const [zoom, setZoom] = useState(initialZoom);
|
|
@@ -556,6 +629,8 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
556
629
|
if (!session) return;
|
|
557
630
|
if (session.liftTimer) clearTimeout(session.liftTimer);
|
|
558
631
|
if (!session.dragging) {
|
|
632
|
+
setFocusedBarId(session.ref.key);
|
|
633
|
+
setBarKeyboardRing(false);
|
|
559
634
|
onItemPress?.(session.task);
|
|
560
635
|
return;
|
|
561
636
|
}
|
|
@@ -858,11 +933,19 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
858
933
|
const fill = barColor ?? (barIntent && barIntent !== "accent" ? "$color-9" : identity);
|
|
859
934
|
const progress = bounded && !ghost ? clampProgress(span.progress ?? task.progress) : null;
|
|
860
935
|
const showLabel = !geom.eternal && liveWidth >= 44;
|
|
936
|
+
const labelOutside = !showLabel && !geom.eternal && !ghost && resolveSpans(task).length === 1;
|
|
861
937
|
const isBarFocused = focusedBarId === barKey;
|
|
862
938
|
const showHandles = hoveredId === task.id || sessionLive || isBarFocused;
|
|
939
|
+
const barState = ghost ? "ghost" : showHandles || geom.eternal ? "selected" : "rest";
|
|
863
940
|
const handleWidth = bounded ? geom.width >= 24 ? 8 : geom.width >= 12 ? 4 : 0 : 0;
|
|
864
941
|
const physicalLeftEdge = rtl ? "end" : "start";
|
|
865
942
|
const physicalRightEdge = rtl ? "start" : "end";
|
|
943
|
+
const logicalLeft = geom.x + liveTransformX * dirSign;
|
|
944
|
+
const gripShift = (edge) => {
|
|
945
|
+
const at = edge === "start" ? logicalLeft : logicalLeft + liveWidth;
|
|
946
|
+
const inside = Math.max(visibleWindow.start + EVENT_GRIP_DOT_PX / 2, Math.min(at, visibleWindow.end - EVENT_GRIP_DOT_PX / 2));
|
|
947
|
+
return (inside - at) * dirSign;
|
|
948
|
+
};
|
|
866
949
|
const squareStart = rtl ? {
|
|
867
950
|
borderTopRightRadius: 0,
|
|
868
951
|
borderBottomRightRadius: 0
|
|
@@ -911,8 +994,8 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
911
994
|
borderStyle: "dashed",
|
|
912
995
|
borderWidth: hairlineWidth,
|
|
913
996
|
borderColor: fill
|
|
914
|
-
} : {},
|
|
915
|
-
opacity: `${sessionLive ? .85 :
|
|
997
|
+
} : { borderWidth: 0 },
|
|
998
|
+
opacity: `${sessionLive ? .85 : 1} press:0.8`,
|
|
916
999
|
cursor: bounded && webDragEnabled ? "grab" : onItemPress ? "pointer" : void 0,
|
|
917
1000
|
justifyContent: "center",
|
|
918
1001
|
...transitionProps({
|
|
@@ -960,38 +1043,47 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
960
1043
|
onPress: nativeDragEnabled && bounded ? void 0 : (e) => {
|
|
961
1044
|
e?.stopPropagation?.();
|
|
962
1045
|
if (suppressClickRef.current) return;
|
|
1046
|
+
setFocusedBarId(barKey);
|
|
963
1047
|
onItemPress?.(task);
|
|
964
1048
|
},
|
|
965
1049
|
children: [
|
|
966
1050
|
/* @__PURE__ */ jsx(GanttIntervalFill, {
|
|
967
1051
|
fill,
|
|
1052
|
+
surface: canvasGround,
|
|
968
1053
|
openStart: geom.openStart,
|
|
969
1054
|
openEnd: geom.openEnd,
|
|
970
1055
|
width: liveWidth,
|
|
971
1056
|
rtl,
|
|
972
|
-
|
|
1057
|
+
state: barState,
|
|
1058
|
+
dark,
|
|
1059
|
+
progress,
|
|
1060
|
+
lead: !ghost && !geom.openStart
|
|
1061
|
+
}),
|
|
1062
|
+
showLabel && /* @__PURE__ */ jsx(GanttBarLabel, {
|
|
1063
|
+
title: barTitle,
|
|
1064
|
+
fill,
|
|
1065
|
+
state: barState,
|
|
1066
|
+
surface: canvasGround,
|
|
1067
|
+
dark
|
|
973
1068
|
}),
|
|
974
|
-
|
|
1069
|
+
labelOutside && /* @__PURE__ */ jsx(YStack, {
|
|
975
1070
|
position: "absolute",
|
|
976
1071
|
top: 0,
|
|
977
1072
|
bottom: 0,
|
|
978
|
-
...rtl ? { right:
|
|
979
|
-
width:
|
|
980
|
-
|
|
981
|
-
opacity: .22,
|
|
1073
|
+
...rtl ? { right: liveWidth } : { left: liveWidth },
|
|
1074
|
+
width: Math.max(0, chartWidth - geom.x - liveWidth),
|
|
1075
|
+
justifyContent: "center",
|
|
982
1076
|
pointerEvents: "none",
|
|
983
|
-
"data-gantt-
|
|
1077
|
+
...{ "data-gantt-bar-outside-label": "true" },
|
|
1078
|
+
children: /* @__PURE__ */ jsx(Text, {
|
|
1079
|
+
...knobProps.label,
|
|
1080
|
+
color: "$color",
|
|
1081
|
+
numberOfLines: 1,
|
|
1082
|
+
paddingHorizontal: knobProps.control.paddingHorizontal,
|
|
1083
|
+
"aria-hidden": true,
|
|
1084
|
+
children: barTitle
|
|
1085
|
+
})
|
|
984
1086
|
}),
|
|
985
|
-
showLabel && (ghost ? /* @__PURE__ */ jsx(Text$1, {
|
|
986
|
-
...knobProps.label,
|
|
987
|
-
color: "$color",
|
|
988
|
-
numberOfLines: 1,
|
|
989
|
-
pointerEvents: "none",
|
|
990
|
-
children: barTitle
|
|
991
|
-
}) : /* @__PURE__ */ jsx(GanttBarLabel, {
|
|
992
|
-
title: barTitle,
|
|
993
|
-
fill
|
|
994
|
-
})),
|
|
995
1087
|
previewSpan && /* @__PURE__ */ jsx(XStack, {
|
|
996
1088
|
position: "absolute",
|
|
997
1089
|
top: -(axisHeight - 6),
|
|
@@ -1018,10 +1110,15 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1018
1110
|
bottom: 0,
|
|
1019
1111
|
width: handleWidth,
|
|
1020
1112
|
cursor: "ew-resize",
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1113
|
+
onPointerDown: (e) => handleResizePointerDown(task, ref, physicalLeftEdge, e),
|
|
1114
|
+
...{ "data-gantt-resize-handle": physicalLeftEdge },
|
|
1115
|
+
children: /* @__PURE__ */ jsx(GanttGripDot, {
|
|
1116
|
+
left: gripShift(physicalLeftEdge) - EVENT_GRIP_DOT_PX / 2,
|
|
1117
|
+
top: (physicalLeftEdge === "start" ? height2 : 0) - EVENT_GRIP_DOT_PX / 2,
|
|
1118
|
+
color: fill,
|
|
1119
|
+
shown: showHandles,
|
|
1120
|
+
edge: physicalLeftEdge
|
|
1121
|
+
})
|
|
1025
1122
|
}), /* @__PURE__ */ jsx(YStack, {
|
|
1026
1123
|
position: "absolute",
|
|
1027
1124
|
right: 0,
|
|
@@ -1029,10 +1126,15 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1029
1126
|
bottom: 0,
|
|
1030
1127
|
width: handleWidth,
|
|
1031
1128
|
cursor: "ew-resize",
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1129
|
+
onPointerDown: (e) => handleResizePointerDown(task, ref, physicalRightEdge, e),
|
|
1130
|
+
...{ "data-gantt-resize-handle": physicalRightEdge },
|
|
1131
|
+
children: /* @__PURE__ */ jsx(GanttGripDot, {
|
|
1132
|
+
left: handleWidth + gripShift(physicalRightEdge) - EVENT_GRIP_DOT_PX / 2,
|
|
1133
|
+
top: (physicalRightEdge === "start" ? height2 : 0) - EVENT_GRIP_DOT_PX / 2,
|
|
1134
|
+
color: fill,
|
|
1135
|
+
shown: showHandles,
|
|
1136
|
+
edge: physicalRightEdge
|
|
1137
|
+
})
|
|
1036
1138
|
})] }),
|
|
1037
1139
|
nativeDragEnabled && bounded && /* @__PURE__ */ jsx(YStack, {
|
|
1038
1140
|
position: "absolute",
|
|
@@ -1061,6 +1163,13 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1061
1163
|
snapUnit,
|
|
1062
1164
|
firstDayOfWeek,
|
|
1063
1165
|
label: `${barTitle}: ${edge === "start" ? t("Start") : t("End")}`,
|
|
1166
|
+
barWidth: liveWidth,
|
|
1167
|
+
barTop: barInset + (barHeight - height2) / 2,
|
|
1168
|
+
barBottom: barInset + (barHeight + height2) / 2,
|
|
1169
|
+
color: fill,
|
|
1170
|
+
shown: showHandles || activeInterval,
|
|
1171
|
+
gripOf: barKey,
|
|
1172
|
+
onHoverChange: (hovered) => setHoveredId((id) => hovered ? task.id : id === task.id ? null : id),
|
|
1064
1173
|
valueText: span[edge] ? formatAbsoluteDate(span[edge]) : edge === "start" ? t("No start") : t("No end"),
|
|
1065
1174
|
onPreview: (next) => setIntervalPreview((previous) => next ? {
|
|
1066
1175
|
key: ref.key,
|
|
@@ -1336,6 +1445,16 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1336
1445
|
position: "relative",
|
|
1337
1446
|
...{ "data-gantt-body": "true" },
|
|
1338
1447
|
children: [
|
|
1448
|
+
tasks.map((task, index) => hoveredId === task.id || resolveSpans(task).some((ref) => ref.key === focusedBarId) ? /* @__PURE__ */ jsx(YStack, {
|
|
1449
|
+
position: "absolute",
|
|
1450
|
+
left: 0,
|
|
1451
|
+
right: 0,
|
|
1452
|
+
top: index * rowHeight,
|
|
1453
|
+
height: rowHeight,
|
|
1454
|
+
backgroundColor: componentColors.interactive.background,
|
|
1455
|
+
pointerEvents: "none",
|
|
1456
|
+
...{ "data-gantt-row-band": task.id }
|
|
1457
|
+
}, `row-band-${task.id}`) : null),
|
|
1339
1458
|
weekends.map((col) => /* @__PURE__ */ jsx(YStack, {
|
|
1340
1459
|
position: "absolute",
|
|
1341
1460
|
...canvasPos(col.x),
|
|
@@ -1367,17 +1486,26 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1367
1486
|
backgroundColor: tick.major ? majorGridColor : minorGridColor,
|
|
1368
1487
|
pointerEvents: "none"
|
|
1369
1488
|
}, tick.date.toISOString())),
|
|
1489
|
+
todayX !== null && /* @__PURE__ */ jsx(YStack, {
|
|
1490
|
+
position: "absolute",
|
|
1491
|
+
...canvasPos(todayX - 1),
|
|
1492
|
+
top: 0,
|
|
1493
|
+
bottom: 0,
|
|
1494
|
+
width: 2,
|
|
1495
|
+
backgroundColor: componentColors.indicator.mark,
|
|
1496
|
+
opacity: .9,
|
|
1497
|
+
pointerEvents: "none",
|
|
1498
|
+
...{ "data-gantt-today": "true" }
|
|
1499
|
+
}),
|
|
1370
1500
|
tasks.map((task, index) => {
|
|
1371
1501
|
const refs = resolveSpans(task);
|
|
1372
|
-
const selected = refs.some((ref) => ref.key === focusedBarId);
|
|
1373
|
-
const hovered = hoveredId === task.id;
|
|
1374
1502
|
const last = index === tasks.length - 1;
|
|
1375
1503
|
return /* @__PURE__ */ jsx(XStack, {
|
|
1376
1504
|
height: rowHeight,
|
|
1377
1505
|
position: "relative",
|
|
1378
1506
|
...last ? null : hairline.bottom,
|
|
1379
1507
|
borderColor: minorGridColor,
|
|
1380
|
-
backgroundColor:
|
|
1508
|
+
backgroundColor: "transparent",
|
|
1381
1509
|
...{
|
|
1382
1510
|
onHoverIn: () => setHoveredId(task.id),
|
|
1383
1511
|
onHoverOut: () => setHoveredId((id) => id === task.id ? null : id)
|
|
@@ -1397,18 +1525,6 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1397
1525
|
pointerEvents: "none",
|
|
1398
1526
|
zIndex: 2,
|
|
1399
1527
|
"data-gantt-marker": "true"
|
|
1400
|
-
}),
|
|
1401
|
-
todayX !== null && /* @__PURE__ */ jsx(YStack, {
|
|
1402
|
-
position: "absolute",
|
|
1403
|
-
...canvasPos(todayX - 1),
|
|
1404
|
-
top: 0,
|
|
1405
|
-
bottom: 0,
|
|
1406
|
-
width: 2,
|
|
1407
|
-
backgroundColor: componentColors.indicator.mark,
|
|
1408
|
-
opacity: .9,
|
|
1409
|
-
pointerEvents: "none",
|
|
1410
|
-
zIndex: 2,
|
|
1411
|
-
...{ "data-gantt-today": "true" }
|
|
1412
1528
|
})
|
|
1413
1529
|
]
|
|
1414
1530
|
})
|