@multiplatform.one/components 10.2.0 → 10.2.1
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/views/Gantt.cjs +54 -37
- package/dist/cjs/views/Gantt.native.cjs +45 -30
- package/dist/cjs/views/Gantt.native.js +45 -30
- package/dist/cjs/views/Gantt.native.js.map +1 -1
- package/dist/cjs/views/GanttDateGrip.cjs +3 -3
- package/dist/cjs/views/GanttDateGrip.native.cjs +3 -3
- package/dist/cjs/views/GanttDateGrip.native.js +3 -3
- package/dist/cjs/views/GanttDateGrip.native.js.map +1 -1
- package/dist/cjs/views/eventTint.cjs +16 -4
- package/dist/cjs/views/eventTint.native.cjs +17 -4
- package/dist/cjs/views/eventTint.native.js +17 -4
- package/dist/cjs/views/eventTint.native.js.map +1 -1
- package/dist/cjs/views/ganttMath.cjs +10 -0
- package/dist/cjs/views/ganttMath.native.cjs +10 -0
- package/dist/cjs/views/ganttMath.native.js +10 -0
- package/dist/cjs/views/ganttMath.native.js.map +1 -1
- package/dist/cjs/views/index.cjs +3 -0
- package/dist/cjs/views/index.native.cjs +3 -0
- package/dist/cjs/views/index.native.js +3 -0
- package/dist/cjs/views/index.native.js.map +1 -1
- package/dist/esm/views/Gantt.mjs +58 -41
- package/dist/esm/views/Gantt.mjs.map +1 -1
- package/dist/esm/views/Gantt.native.js +49 -34
- package/dist/esm/views/Gantt.native.js.map +1 -1
- package/dist/esm/views/GanttDateGrip.mjs +3 -3
- package/dist/esm/views/GanttDateGrip.mjs.map +1 -1
- package/dist/esm/views/GanttDateGrip.native.js +3 -3
- package/dist/esm/views/GanttDateGrip.native.js.map +1 -1
- package/dist/esm/views/eventTint.mjs +15 -5
- package/dist/esm/views/eventTint.mjs.map +1 -1
- package/dist/esm/views/eventTint.native.js +16 -5
- package/dist/esm/views/eventTint.native.js.map +1 -1
- package/dist/esm/views/ganttMath.mjs +8 -1
- package/dist/esm/views/ganttMath.mjs.map +1 -1
- package/dist/esm/views/ganttMath.native.js +8 -1
- package/dist/esm/views/ganttMath.native.js.map +1 -1
- package/dist/esm/views/index.mjs +2 -2
- package/dist/esm/views/index.native.js +2 -2
- package/dist/jsx/views/Gantt.mjs +58 -41
- package/dist/jsx/views/Gantt.mjs.map +1 -1
- package/dist/jsx/views/Gantt.native.cjs +45 -30
- package/dist/jsx/views/Gantt.native.js +45 -30
- package/dist/jsx/views/Gantt.native.js.map +1 -1
- package/dist/jsx/views/GanttDateGrip.mjs +3 -3
- package/dist/jsx/views/GanttDateGrip.mjs.map +1 -1
- package/dist/jsx/views/GanttDateGrip.native.cjs +3 -3
- package/dist/jsx/views/GanttDateGrip.native.js +3 -3
- package/dist/jsx/views/GanttDateGrip.native.js.map +1 -1
- package/dist/jsx/views/eventTint.mjs +15 -5
- package/dist/jsx/views/eventTint.mjs.map +1 -1
- package/dist/jsx/views/eventTint.native.cjs +17 -4
- package/dist/jsx/views/eventTint.native.js +17 -4
- package/dist/jsx/views/eventTint.native.js.map +1 -1
- package/dist/jsx/views/ganttMath.mjs +8 -1
- package/dist/jsx/views/ganttMath.mjs.map +1 -1
- package/dist/jsx/views/ganttMath.native.cjs +10 -0
- package/dist/jsx/views/ganttMath.native.js +10 -0
- package/dist/jsx/views/ganttMath.native.js.map +1 -1
- package/dist/jsx/views/index.mjs +2 -2
- package/dist/jsx/views/index.native.cjs +3 -0
- package/dist/jsx/views/index.native.js +3 -0
- package/dist/jsx/views/index.native.js.map +1 -1
- package/package.json +7 -7
- package/src/views/Gantt.barInk.spec.tsx +149 -21
- package/src/views/Gantt.grips.spec.tsx +21 -4
- package/src/views/Gantt.phone.spec.tsx +205 -0
- package/src/views/Gantt.spec.tsx +15 -2
- package/src/views/Gantt.tint.palette.spec.ts +14 -7
- package/src/views/Gantt.tsx +144 -101
- package/src/views/GanttDateGrip.tsx +4 -4
- package/src/views/eventTint.ts +23 -4
- package/src/views/ganttMath.ts +26 -0
- package/src/views/index.ts +3 -0
- package/types/views/Gantt.d.ts.map +1 -1
- package/types/views/eventTint.d.ts +5 -2
- package/types/views/eventTint.d.ts.map +1 -1
- package/types/views/ganttMath.d.ts +14 -0
- package/types/views/ganttMath.d.ts.map +1 -1
- package/types/views/index.d.ts +1 -1
- package/types/views/index.d.ts.map +1 -1
package/dist/cjs/views/Gantt.cjs
CHANGED
|
@@ -190,10 +190,10 @@ function BarIntentWrap({ intent, children }) {
|
|
|
190
190
|
children
|
|
191
191
|
});
|
|
192
192
|
}
|
|
193
|
+
const MONTH_LABEL_MIN_PX = 36;
|
|
193
194
|
const STRIP_INSET_PX = 4;
|
|
194
|
-
const STRIP_BOTTOM_PX = 2;
|
|
195
195
|
const STRIP_TRACK_OPACITY = .3;
|
|
196
|
-
function GanttBarLabel({ title, fill, state, surface, dark }) {
|
|
196
|
+
function GanttBarLabel({ title, fill, state, surface, dark, stripBand }) {
|
|
197
197
|
const { knobProps } = (0, import_theme.useResolvedKnobs)();
|
|
198
198
|
const theme = (0, import_tamagui2.useTheme)();
|
|
199
199
|
const solid = dark || state === "ghost" ? null : (0, import_eventTint.eventSolid)(theme, fill, state);
|
|
@@ -206,6 +206,7 @@ function GanttBarLabel({ title, fill, state, surface, dark }) {
|
|
|
206
206
|
...knobProps.label,
|
|
207
207
|
numberOfLines: 1,
|
|
208
208
|
paddingHorizontal: knobProps.control.paddingHorizontal,
|
|
209
|
+
marginBottom: stripBand,
|
|
209
210
|
pointerEvents: "none",
|
|
210
211
|
zIndex: 1,
|
|
211
212
|
"aria-hidden": true,
|
|
@@ -281,20 +282,20 @@ function GanttIntervalFill({ fill, surface, openStart, openEnd, width, rtl, stat
|
|
|
281
282
|
}
|
|
282
283
|
}, edge);
|
|
283
284
|
}),
|
|
284
|
-
|
|
285
|
+
strip && progress != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
285
286
|
position: "absolute",
|
|
286
|
-
bottom:
|
|
287
|
+
bottom: import_eventTint.EVENT_STRIP_BOTTOM_PX,
|
|
287
288
|
height: import_eventTint.EVENT_BAR_PX,
|
|
288
289
|
...rtl ? { right: stripStart } : { left: stripStart },
|
|
289
290
|
width: Math.max(0, width - stripStart - STRIP_INSET_PX),
|
|
290
291
|
borderRadius: import_eventTint.EVENT_BAR_PX / 2,
|
|
291
|
-
backgroundColor:
|
|
292
|
+
backgroundColor: strip,
|
|
292
293
|
opacity: STRIP_TRACK_OPACITY,
|
|
293
|
-
...{ "data-gantt-progress-track":
|
|
294
|
+
...{ "data-gantt-progress-track": strip }
|
|
294
295
|
}),
|
|
295
296
|
stripWidth > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
296
297
|
position: "absolute",
|
|
297
|
-
bottom:
|
|
298
|
+
bottom: import_eventTint.EVENT_STRIP_BOTTOM_PX,
|
|
298
299
|
height: import_eventTint.EVENT_BAR_PX,
|
|
299
300
|
...rtl ? { right: stripStart } : { left: stripStart },
|
|
300
301
|
width: stripWidth,
|
|
@@ -331,6 +332,7 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
331
332
|
const canvasBackground = canvasTheme.background?.val;
|
|
332
333
|
const canvasGround = typeof canvasBackground === "string" ? canvasBackground : void 0;
|
|
333
334
|
const dark = (0, import_eventTint.useEventDark)();
|
|
335
|
+
const sizeClass = (0, import_theme.useLayoutSizeClass)();
|
|
334
336
|
const { t } = (0, import_i18n.useTranslation)();
|
|
335
337
|
const { knobProps } = (0, import_theme.useResolvedKnobs)();
|
|
336
338
|
const [zoom, setZoom] = (0, import_react.useState)(initialZoom);
|
|
@@ -352,6 +354,10 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
352
354
|
const pxPerDay = controlHeight * (zoom === "day" ? 1.6 : zoom === "week" ? .6 : .2);
|
|
353
355
|
const barInset = controlGap;
|
|
354
356
|
const barHeight = rowHeight - barInset * 2;
|
|
357
|
+
const hasLabelColumn = sizeClass !== "compact";
|
|
358
|
+
const columnWidth = hasLabelColumn ? labelWidth : 0;
|
|
359
|
+
const labelPadding = Number(knobProps.control.paddingHorizontal);
|
|
360
|
+
const labelFontSize = (0, import_tamagui2.getFontSize)(String(knobProps.label.fontSize), { font: String(knobProps.label.fontFamily) });
|
|
355
361
|
const railHeight = barHeight / 2;
|
|
356
362
|
const transition = knobProps.motion.slide.transition;
|
|
357
363
|
const webLayoutTransition = import_tamagui.isWeb ? transition : void 0;
|
|
@@ -400,7 +406,7 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
400
406
|
const viewportWidth = canvasViewportRef.current;
|
|
401
407
|
if (viewportWidth === null) pendingAnchorRef.current = date;
|
|
402
408
|
const x = (0, import_ganttMath.scrollAnchorX)(date, range.start, pxPerDay, {
|
|
403
|
-
labelWidth,
|
|
409
|
+
labelWidth: columnWidth,
|
|
404
410
|
chartWidth,
|
|
405
411
|
viewportWidth,
|
|
406
412
|
rtl
|
|
@@ -420,7 +426,7 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
420
426
|
}, [
|
|
421
427
|
range.start,
|
|
422
428
|
pxPerDay,
|
|
423
|
-
|
|
429
|
+
columnWidth,
|
|
424
430
|
rtl,
|
|
425
431
|
chartWidth
|
|
426
432
|
]);
|
|
@@ -955,18 +961,21 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
955
961
|
const barTitle = span.title ?? task.title;
|
|
956
962
|
const fill = barColor ?? (barIntent && barIntent !== "accent" ? "$color-9" : identity);
|
|
957
963
|
const progress = bounded && !ghost ? clampProgress(span.progress ?? task.progress) : null;
|
|
958
|
-
const
|
|
959
|
-
const
|
|
964
|
+
const fitsLabel = (0, import_ganttMath.labelFitsBar)(barTitle, liveWidth, labelPadding, labelFontSize);
|
|
965
|
+
const carriesOutside = !geom.eternal && !ghost && resolveSpans(task).length === 1;
|
|
966
|
+
const labelReadsInside = liveWidth >= 44 && (fitsLabel || !carriesOutside);
|
|
967
|
+
const showLabel = (!geom.eternal || !hasLabelColumn) && labelReadsInside;
|
|
968
|
+
const labelOutside = carriesOutside && !labelReadsInside;
|
|
960
969
|
const isBarFocused = focusedBarId === barKey;
|
|
961
970
|
const showHandles = hoveredId === task.id || sessionLive || isBarFocused;
|
|
962
|
-
const barState = ghost ? "ghost" : showHandles
|
|
971
|
+
const barState = ghost ? "ghost" : showHandles ? "selected" : "rest";
|
|
963
972
|
const handleWidth = bounded ? geom.width >= 24 ? 8 : geom.width >= 12 ? 4 : 0 : 0;
|
|
964
973
|
const physicalLeftEdge = rtl ? "end" : "start";
|
|
965
974
|
const physicalRightEdge = rtl ? "start" : "end";
|
|
966
975
|
const logicalLeft = geom.x + liveTransformX * dirSign;
|
|
967
976
|
const gripShift = (edge) => {
|
|
968
|
-
const at = edge === "start" ? logicalLeft : logicalLeft + liveWidth;
|
|
969
|
-
const inside = Math.max(visibleWindow.start
|
|
977
|
+
const at = edge === "start" ? logicalLeft : logicalLeft + liveWidth - import_eventTint.EVENT_GRIP_DOT_PX;
|
|
978
|
+
const inside = Math.max(visibleWindow.start, Math.min(at, visibleWindow.end - import_eventTint.EVENT_GRIP_DOT_PX));
|
|
970
979
|
return (inside - at) * dirSign;
|
|
971
980
|
};
|
|
972
981
|
const squareStart = rtl ? {
|
|
@@ -1087,7 +1096,8 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1087
1096
|
fill,
|
|
1088
1097
|
state: barState,
|
|
1089
1098
|
surface: canvasGround,
|
|
1090
|
-
dark
|
|
1099
|
+
dark,
|
|
1100
|
+
stripBand: progress != null ? import_eventTint.EVENT_STRIP_BAND_PX : 0
|
|
1091
1101
|
}),
|
|
1092
1102
|
labelOutside && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
1093
1103
|
position: "absolute",
|
|
@@ -1136,8 +1146,8 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1136
1146
|
onPointerDown: (e) => handleResizePointerDown(task, ref, physicalLeftEdge, e),
|
|
1137
1147
|
...{ "data-gantt-resize-handle": physicalLeftEdge },
|
|
1138
1148
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GanttGripDot.GanttGripDot, {
|
|
1139
|
-
left: gripShift(physicalLeftEdge)
|
|
1140
|
-
top:
|
|
1149
|
+
left: gripShift(physicalLeftEdge),
|
|
1150
|
+
top: physicalLeftEdge === "start" ? height2 - import_eventTint.EVENT_GRIP_DOT_PX : 0,
|
|
1141
1151
|
color: fill,
|
|
1142
1152
|
shown: showHandles,
|
|
1143
1153
|
edge: physicalLeftEdge
|
|
@@ -1152,8 +1162,8 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1152
1162
|
onPointerDown: (e) => handleResizePointerDown(task, ref, physicalRightEdge, e),
|
|
1153
1163
|
...{ "data-gantt-resize-handle": physicalRightEdge },
|
|
1154
1164
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GanttGripDot.GanttGripDot, {
|
|
1155
|
-
left: handleWidth
|
|
1156
|
-
top:
|
|
1165
|
+
left: handleWidth - import_eventTint.EVENT_GRIP_DOT_PX + gripShift(physicalRightEdge),
|
|
1166
|
+
top: physicalRightEdge === "start" ? height2 - import_eventTint.EVENT_GRIP_DOT_PX : 0,
|
|
1157
1167
|
color: fill,
|
|
1158
1168
|
shown: showHandles,
|
|
1159
1169
|
edge: physicalRightEdge
|
|
@@ -1215,7 +1225,7 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1215
1225
|
const showSkeleton = !error && isLoading && tasks.length === 0;
|
|
1216
1226
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AsyncBoundary.AsyncBoundary, {
|
|
1217
1227
|
loading: showSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GanttSkeleton, {
|
|
1218
|
-
labelWidth,
|
|
1228
|
+
labelWidth: columnWidth,
|
|
1219
1229
|
rowHeight
|
|
1220
1230
|
}) : false,
|
|
1221
1231
|
empty: !error && !isLoading && tasks.length === 0,
|
|
@@ -1246,7 +1256,7 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1246
1256
|
onPress: () => scrollToDate(/* @__PURE__ */ new Date(), true),
|
|
1247
1257
|
children: t("Today")
|
|
1248
1258
|
}),
|
|
1249
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.SizableText, {
|
|
1259
|
+
sizeClass === "compact" ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.SizableText, {
|
|
1250
1260
|
...import_componentColors.sectionHeading,
|
|
1251
1261
|
...knobProps.heading,
|
|
1252
1262
|
numberOfLines: 1,
|
|
@@ -1276,8 +1286,8 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1276
1286
|
...import_theme.hairline.bottom,
|
|
1277
1287
|
borderColor: "border-color",
|
|
1278
1288
|
"data-gantt-axis-row": "true",
|
|
1279
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.XStack, {
|
|
1280
|
-
width:
|
|
1289
|
+
children: [hasLabelColumn ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.XStack, {
|
|
1290
|
+
width: columnWidth,
|
|
1281
1291
|
flexShrink: 0,
|
|
1282
1292
|
height: axisHeight,
|
|
1283
1293
|
alignItems: "center",
|
|
@@ -1291,7 +1301,7 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1291
1301
|
numberOfLines: 1,
|
|
1292
1302
|
children: t("Task")
|
|
1293
1303
|
})
|
|
1294
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ScrollView.ScrollView, {
|
|
1304
|
+
}) : null, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ScrollView.ScrollView, {
|
|
1295
1305
|
ref: axisScrollRef,
|
|
1296
1306
|
horizontal: true,
|
|
1297
1307
|
flex: 1,
|
|
@@ -1327,16 +1337,23 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1327
1337
|
opacity: .16,
|
|
1328
1338
|
pointerEvents: "none"
|
|
1329
1339
|
}),
|
|
1330
|
-
months.map((band) =>
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
+
months.map((band) => {
|
|
1341
|
+
const bandEnd = band.x + band.width;
|
|
1342
|
+
const shown = Math.min(bandEnd, visibleWindow.end) - Math.max(band.x, visibleWindow.start);
|
|
1343
|
+
if (shown < MONTH_LABEL_MIN_PX) return null;
|
|
1344
|
+
const x = Math.min(Math.max(band.x, visibleWindow.start), bandEnd - MONTH_LABEL_MIN_PX);
|
|
1345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Text, {
|
|
1346
|
+
position: "absolute",
|
|
1347
|
+
...rtl ? { right: x + 4 } : { left: x + 4 },
|
|
1348
|
+
top: 2,
|
|
1349
|
+
width: Math.max(0, bandEnd - x - 8),
|
|
1350
|
+
...knobProps.label,
|
|
1351
|
+
color: knobProps.textAccentColor,
|
|
1352
|
+
numberOfLines: 1,
|
|
1353
|
+
...{ "data-gantt-month": band.key },
|
|
1354
|
+
children: band.label
|
|
1355
|
+
}, band.key);
|
|
1356
|
+
}),
|
|
1340
1357
|
ticks.map((tick) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Text, {
|
|
1341
1358
|
position: "absolute",
|
|
1342
1359
|
...rtl ? { right: tick.x + 4 } : { left: tick.x + 4 },
|
|
@@ -1406,8 +1423,8 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1406
1423
|
scrollEnabled: !scrollLocked,
|
|
1407
1424
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tamagui.XStack, {
|
|
1408
1425
|
...{ "data-gantt-scroll-body": "true" },
|
|
1409
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
1410
|
-
width:
|
|
1426
|
+
children: [hasLabelColumn ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
1427
|
+
width: columnWidth,
|
|
1411
1428
|
flexShrink: 0,
|
|
1412
1429
|
...hairlineEnd,
|
|
1413
1430
|
borderColor: "border-color",
|
|
@@ -1449,7 +1466,7 @@ function GanttView({ tasks, zoom: initialZoom = "week", onZoomChange, onItemPres
|
|
|
1449
1466
|
})
|
|
1450
1467
|
}, task.id);
|
|
1451
1468
|
})
|
|
1452
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CanvasScroller, {
|
|
1469
|
+
}) : null, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CanvasScroller, {
|
|
1453
1470
|
keyboardShouldPersistTaps: "handled",
|
|
1454
1471
|
ref: hScrollRef,
|
|
1455
1472
|
horizontal: true,
|
|
@@ -205,11 +205,11 @@ function BarIntentWrap(param) {
|
|
|
205
205
|
children
|
|
206
206
|
});
|
|
207
207
|
}
|
|
208
|
+
var MONTH_LABEL_MIN_PX = 36;
|
|
208
209
|
var STRIP_INSET_PX = 4;
|
|
209
|
-
var STRIP_BOTTOM_PX = 2;
|
|
210
210
|
var STRIP_TRACK_OPACITY = .3;
|
|
211
211
|
function GanttBarLabel(param) {
|
|
212
|
-
var { title, fill, state, surface, dark } = param;
|
|
212
|
+
var { title, fill, state, surface, dark, stripBand } = param;
|
|
213
213
|
var _ref;
|
|
214
214
|
var { knobProps } = (0, import_theme.useResolvedKnobs)();
|
|
215
215
|
var theme = (0, import_tamagui2.useTheme)();
|
|
@@ -223,6 +223,7 @@ function GanttBarLabel(param) {
|
|
|
223
223
|
...knobProps.label,
|
|
224
224
|
numberOfLines: 1,
|
|
225
225
|
paddingHorizontal: knobProps.control.paddingHorizontal,
|
|
226
|
+
marginBottom: stripBand,
|
|
226
227
|
pointerEvents: "none",
|
|
227
228
|
zIndex: 1,
|
|
228
229
|
"aria-hidden": true,
|
|
@@ -295,20 +296,20 @@ function GanttIntervalFill(param) {
|
|
|
295
296
|
[`data-gantt-open-${edge}`]: "true"
|
|
296
297
|
}, edge);
|
|
297
298
|
}),
|
|
298
|
-
|
|
299
|
+
strip && progress != null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
299
300
|
position: "absolute",
|
|
300
|
-
bottom:
|
|
301
|
+
bottom: import_eventTint.EVENT_STRIP_BOTTOM_PX,
|
|
301
302
|
height: import_eventTint.EVENT_BAR_PX,
|
|
302
303
|
...rtl ? { right: stripStart } : { left: stripStart },
|
|
303
304
|
width: Math.max(0, width - stripStart - STRIP_INSET_PX),
|
|
304
305
|
borderRadius: import_eventTint.EVENT_BAR_PX / 2,
|
|
305
|
-
backgroundColor:
|
|
306
|
+
backgroundColor: strip,
|
|
306
307
|
opacity: STRIP_TRACK_OPACITY,
|
|
307
|
-
"data-gantt-progress-track":
|
|
308
|
+
"data-gantt-progress-track": strip
|
|
308
309
|
}),
|
|
309
310
|
stripWidth > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
310
311
|
position: "absolute",
|
|
311
|
-
bottom:
|
|
312
|
+
bottom: import_eventTint.EVENT_STRIP_BOTTOM_PX,
|
|
312
313
|
height: import_eventTint.EVENT_BAR_PX,
|
|
313
314
|
...rtl ? { right: stripStart } : { left: stripStart },
|
|
314
315
|
width: stripWidth,
|
|
@@ -346,6 +347,7 @@ function GanttView(param) {
|
|
|
346
347
|
var canvasBackground = (_canvasTheme_background = canvasTheme.background) === null || _canvasTheme_background === void 0 ? void 0 : _canvasTheme_background.val;
|
|
347
348
|
var canvasGround = typeof canvasBackground === "string" ? canvasBackground : void 0;
|
|
348
349
|
var dark = (0, import_eventTint.useEventDark)();
|
|
350
|
+
var sizeClass = (0, import_theme.useLayoutSizeClass)();
|
|
349
351
|
var { t } = (0, import_i18n.useTranslation)();
|
|
350
352
|
var { knobProps } = (0, import_theme.useResolvedKnobs)();
|
|
351
353
|
var [zoom, setZoom] = (0, import_react.useState)(initialZoom);
|
|
@@ -369,6 +371,10 @@ function GanttView(param) {
|
|
|
369
371
|
var pxPerDay = controlHeight * (zoom === "day" ? 1.6 : zoom === "week" ? .6 : .2);
|
|
370
372
|
var barInset = controlGap;
|
|
371
373
|
var barHeight = rowHeight - barInset * 2;
|
|
374
|
+
var hasLabelColumn = sizeClass !== "compact";
|
|
375
|
+
var columnWidth = hasLabelColumn ? labelWidth : 0;
|
|
376
|
+
var labelPadding = Number(knobProps.control.paddingHorizontal);
|
|
377
|
+
var labelFontSize = (0, import_tamagui2.getFontSize)(String(knobProps.label.fontSize), { font: String(knobProps.label.fontFamily) });
|
|
372
378
|
var railHeight = barHeight / 2;
|
|
373
379
|
var transition = knobProps.motion.slide.transition;
|
|
374
380
|
var webLayoutTransition = import_tamagui.isWeb ? transition : void 0;
|
|
@@ -465,7 +471,7 @@ function GanttView(param) {
|
|
|
465
471
|
var viewportWidth = canvasViewportRef.current;
|
|
466
472
|
if (viewportWidth === null) pendingAnchorRef.current = date;
|
|
467
473
|
var x = (0, import_ganttMath.scrollAnchorX)(date, range.start, pxPerDay, {
|
|
468
|
-
labelWidth,
|
|
474
|
+
labelWidth: columnWidth,
|
|
469
475
|
chartWidth,
|
|
470
476
|
viewportWidth,
|
|
471
477
|
rtl
|
|
@@ -487,7 +493,7 @@ function GanttView(param) {
|
|
|
487
493
|
}, [
|
|
488
494
|
range.start,
|
|
489
495
|
pxPerDay,
|
|
490
|
-
|
|
496
|
+
columnWidth,
|
|
491
497
|
rtl,
|
|
492
498
|
chartWidth
|
|
493
499
|
]);
|
|
@@ -1080,18 +1086,21 @@ function GanttView(param) {
|
|
|
1080
1086
|
var barTitle = (_span_title = span.title) !== null && _span_title !== void 0 ? _span_title : task.title;
|
|
1081
1087
|
var fill = barColor !== null && barColor !== void 0 ? barColor : barIntent && barIntent !== "accent" ? "$color-9" : identity;
|
|
1082
1088
|
var progress = bounded && !ghost ? clampProgress((_span_progress = span.progress) !== null && _span_progress !== void 0 ? _span_progress : task.progress) : null;
|
|
1083
|
-
var
|
|
1084
|
-
var
|
|
1089
|
+
var fitsLabel = (0, import_ganttMath.labelFitsBar)(barTitle, liveWidth, labelPadding, labelFontSize);
|
|
1090
|
+
var carriesOutside = !geom.eternal && !ghost && resolveSpans(task).length === 1;
|
|
1091
|
+
var labelReadsInside = liveWidth >= 44 && (fitsLabel || !carriesOutside);
|
|
1092
|
+
var showLabel = (!geom.eternal || !hasLabelColumn) && labelReadsInside;
|
|
1093
|
+
var labelOutside = carriesOutside && !labelReadsInside;
|
|
1085
1094
|
var isBarFocused = focusedBarId === barKey;
|
|
1086
1095
|
var showHandles = hoveredId === task.id || sessionLive || isBarFocused;
|
|
1087
|
-
var barState = ghost ? "ghost" : showHandles
|
|
1096
|
+
var barState = ghost ? "ghost" : showHandles ? "selected" : "rest";
|
|
1088
1097
|
var handleWidth = bounded ? geom.width >= 24 ? 8 : geom.width >= 12 ? 4 : 0 : 0;
|
|
1089
1098
|
var physicalLeftEdge = rtl ? "end" : "start";
|
|
1090
1099
|
var physicalRightEdge = rtl ? "start" : "end";
|
|
1091
1100
|
var logicalLeft = geom.x + liveTransformX * dirSign;
|
|
1092
1101
|
var gripShift = function gripShift2(edge) {
|
|
1093
|
-
var at = edge === "start" ? logicalLeft : logicalLeft + liveWidth;
|
|
1094
|
-
var inside = Math.max(visibleWindow.start
|
|
1102
|
+
var at = edge === "start" ? logicalLeft : logicalLeft + liveWidth - import_eventTint.EVENT_GRIP_DOT_PX;
|
|
1103
|
+
var inside = Math.max(visibleWindow.start, Math.min(at, visibleWindow.end - import_eventTint.EVENT_GRIP_DOT_PX));
|
|
1095
1104
|
return (inside - at) * dirSign;
|
|
1096
1105
|
};
|
|
1097
1106
|
var squareStart = rtl ? {
|
|
@@ -1223,7 +1232,8 @@ function GanttView(param) {
|
|
|
1223
1232
|
fill,
|
|
1224
1233
|
state: barState,
|
|
1225
1234
|
surface: canvasGround,
|
|
1226
|
-
dark
|
|
1235
|
+
dark,
|
|
1236
|
+
stripBand: progress != null ? import_eventTint.EVENT_STRIP_BAND_PX : 0
|
|
1227
1237
|
}),
|
|
1228
1238
|
labelOutside && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
1229
1239
|
position: "absolute",
|
|
@@ -1274,8 +1284,8 @@ function GanttView(param) {
|
|
|
1274
1284
|
},
|
|
1275
1285
|
"data-gantt-resize-handle": physicalLeftEdge,
|
|
1276
1286
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GanttGripDot.GanttGripDot, {
|
|
1277
|
-
left: gripShift(physicalLeftEdge)
|
|
1278
|
-
top:
|
|
1287
|
+
left: gripShift(physicalLeftEdge),
|
|
1288
|
+
top: physicalLeftEdge === "start" ? height2 - import_eventTint.EVENT_GRIP_DOT_PX : 0,
|
|
1279
1289
|
color: fill,
|
|
1280
1290
|
shown: showHandles,
|
|
1281
1291
|
edge: physicalLeftEdge
|
|
@@ -1292,8 +1302,8 @@ function GanttView(param) {
|
|
|
1292
1302
|
},
|
|
1293
1303
|
"data-gantt-resize-handle": physicalRightEdge,
|
|
1294
1304
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_GanttGripDot.GanttGripDot, {
|
|
1295
|
-
left: handleWidth
|
|
1296
|
-
top:
|
|
1305
|
+
left: handleWidth - import_eventTint.EVENT_GRIP_DOT_PX + gripShift(physicalRightEdge),
|
|
1306
|
+
top: physicalRightEdge === "start" ? height2 - import_eventTint.EVENT_GRIP_DOT_PX : 0,
|
|
1297
1307
|
color: fill,
|
|
1298
1308
|
shown: showHandles,
|
|
1299
1309
|
edge: physicalRightEdge
|
|
@@ -1363,7 +1373,7 @@ function GanttView(param) {
|
|
|
1363
1373
|
var showSkeleton = !error && isLoading && tasks.length === 0;
|
|
1364
1374
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_AsyncBoundary.AsyncBoundary, {
|
|
1365
1375
|
loading: showSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GanttSkeleton, {
|
|
1366
|
-
labelWidth,
|
|
1376
|
+
labelWidth: columnWidth,
|
|
1367
1377
|
rowHeight
|
|
1368
1378
|
}) : false,
|
|
1369
1379
|
empty: !error && !isLoading && tasks.length === 0,
|
|
@@ -1396,7 +1406,7 @@ function GanttView(param) {
|
|
|
1396
1406
|
},
|
|
1397
1407
|
children: t("Today")
|
|
1398
1408
|
}),
|
|
1399
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.SizableText, {
|
|
1409
|
+
sizeClass === "compact" ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.SizableText, {
|
|
1400
1410
|
...import_componentColors.sectionHeading,
|
|
1401
1411
|
...knobProps.heading,
|
|
1402
1412
|
numberOfLines: 1,
|
|
@@ -1428,8 +1438,8 @@ function GanttView(param) {
|
|
|
1428
1438
|
...import_theme.hairline.bottom,
|
|
1429
1439
|
borderColor: "border-color",
|
|
1430
1440
|
"data-gantt-axis-row": "true",
|
|
1431
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.XStack, {
|
|
1432
|
-
width:
|
|
1441
|
+
children: [hasLabelColumn ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.XStack, {
|
|
1442
|
+
width: columnWidth,
|
|
1433
1443
|
flexShrink: 0,
|
|
1434
1444
|
height: axisHeight,
|
|
1435
1445
|
alignItems: "center",
|
|
@@ -1443,7 +1453,7 @@ function GanttView(param) {
|
|
|
1443
1453
|
numberOfLines: 1,
|
|
1444
1454
|
children: t("Task")
|
|
1445
1455
|
})
|
|
1446
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ScrollView.ScrollView, {
|
|
1456
|
+
}) : null, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ScrollView.ScrollView, {
|
|
1447
1457
|
ref: axisScrollRef,
|
|
1448
1458
|
horizontal: true,
|
|
1449
1459
|
flex: 1,
|
|
@@ -1480,14 +1490,19 @@ function GanttView(param) {
|
|
|
1480
1490
|
pointerEvents: "none"
|
|
1481
1491
|
}),
|
|
1482
1492
|
months.map(function(band) {
|
|
1483
|
-
|
|
1493
|
+
var bandEnd = band.x + band.width;
|
|
1494
|
+
var shown = Math.min(bandEnd, visibleWindow.end) - Math.max(band.x, visibleWindow.start);
|
|
1495
|
+
if (shown < MONTH_LABEL_MIN_PX) return null;
|
|
1496
|
+
var x = Math.min(Math.max(band.x, visibleWindow.start), bandEnd - MONTH_LABEL_MIN_PX);
|
|
1497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.Text, {
|
|
1484
1498
|
position: "absolute",
|
|
1485
|
-
...rtl ? { right:
|
|
1499
|
+
...rtl ? { right: x + 4 } : { left: x + 4 },
|
|
1486
1500
|
top: 2,
|
|
1487
|
-
width: Math.max(0,
|
|
1501
|
+
width: Math.max(0, bandEnd - x - 8),
|
|
1488
1502
|
...knobProps.label,
|
|
1489
1503
|
color: knobProps.textAccentColor,
|
|
1490
1504
|
numberOfLines: 1,
|
|
1505
|
+
"data-gantt-month": band.key,
|
|
1491
1506
|
children: band.label
|
|
1492
1507
|
}, band.key);
|
|
1493
1508
|
}),
|
|
@@ -1565,8 +1580,8 @@ function GanttView(param) {
|
|
|
1565
1580
|
scrollEnabled: !scrollLocked,
|
|
1566
1581
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tamagui.XStack, {
|
|
1567
1582
|
"data-gantt-scroll-body": "true",
|
|
1568
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
1569
|
-
width:
|
|
1583
|
+
children: [hasLabelColumn ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tamagui.YStack, {
|
|
1584
|
+
width: columnWidth,
|
|
1570
1585
|
flexShrink: 0,
|
|
1571
1586
|
...hairlineEnd,
|
|
1572
1587
|
borderColor: "border-color",
|
|
@@ -1618,7 +1633,7 @@ function GanttView(param) {
|
|
|
1618
1633
|
})
|
|
1619
1634
|
}, task.id);
|
|
1620
1635
|
})
|
|
1621
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CanvasScroller, {
|
|
1636
|
+
}) : null, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CanvasScroller, {
|
|
1622
1637
|
keyboardShouldPersistTaps: "handled",
|
|
1623
1638
|
ref: hScrollRef,
|
|
1624
1639
|
horizontal: true,
|