@colisweb/rescript-toolkit 5.48.0 → 5.48.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
CHANGED
|
@@ -44,9 +44,11 @@ type state = {
|
|
|
44
44
|
measuringScale: measuringScale,
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
type contentParams = {index: int}
|
|
48
|
+
|
|
47
49
|
type timelinePointExtras = {
|
|
48
50
|
className?: string,
|
|
49
|
-
content?: React.element,
|
|
51
|
+
content?: contentParams => React.element,
|
|
50
52
|
popoverContent?: React.element,
|
|
51
53
|
popoverContentOptions?: Radix.Popover.Content.options,
|
|
52
54
|
}
|
|
@@ -223,6 +225,7 @@ module Timeline = {
|
|
|
223
225
|
~markerClassName="",
|
|
224
226
|
~measuringScale,
|
|
225
227
|
~setMeasuringScale,
|
|
228
|
+
~index: int,
|
|
226
229
|
) => {
|
|
227
230
|
let markerOffset = getMarkerOffset(~marker, ~measuringScale)
|
|
228
231
|
|
|
@@ -273,7 +276,7 @@ module Timeline = {
|
|
|
273
276
|
}
|
|
274
277
|
}}
|
|
275
278
|
style={{
|
|
276
|
-
"--x-offset": `${
|
|
279
|
+
"--x-offset": `${markerOffset.offsetStart->Float.toString}px`,
|
|
277
280
|
"--markerWidth": (markerOffset.width < 1. ? markerWidth : markerOffset.width)->formatToPx,
|
|
278
281
|
"--markerHeight": switch marker {
|
|
279
282
|
| Cluster(_) => markerWidth +. 10.
|
|
@@ -291,32 +294,33 @@ module Timeline = {
|
|
|
291
294
|
},
|
|
292
295
|
])}>
|
|
293
296
|
{switch marker {
|
|
294
|
-
| Cluster(p) =>
|
|
297
|
+
| Cluster(p) =>
|
|
298
|
+
<span className={"font-bold text-neutral-700"}> {p->Array.length->React.int} </span>
|
|
295
299
|
| Point({extras}) =>
|
|
296
300
|
switch extras.popoverContent {
|
|
297
301
|
| None =>
|
|
298
302
|
<div
|
|
299
|
-
className={"w-full h-[--markerHeight]
|
|
303
|
+
className={"w-full h-[--markerHeight] text-center font-semibold text-sm"}
|
|
300
304
|
style={{
|
|
301
305
|
"--markerHeight": switch marker {
|
|
302
306
|
| Cluster(_) => markerWidth +. 10.
|
|
303
307
|
| Point(_) => markerWidth
|
|
304
308
|
}->formatToPx,
|
|
305
309
|
}->Obj.magic}>
|
|
306
|
-
{extras.content->Option.
|
|
310
|
+
{extras.content->Option.mapWithDefault(React.null, fn => fn({index: index}))}
|
|
307
311
|
</div>
|
|
308
312
|
| Some(c) =>
|
|
309
313
|
<Toolkit__Ui_Popover
|
|
310
314
|
triggerAsChild={true}
|
|
311
315
|
trigger={<div
|
|
312
|
-
className={"w-full h-[--markerHeight] cursor-pointer"}
|
|
316
|
+
className={"w-full h-[--markerHeight] cursor-pointer text-center font-semibold text-sm"}
|
|
313
317
|
style={{
|
|
314
318
|
"--markerHeight": switch marker {
|
|
315
319
|
| Cluster(_) => markerWidth +. 10.
|
|
316
320
|
| Point(_) => markerWidth
|
|
317
321
|
}->formatToPx,
|
|
318
322
|
}->Obj.magic}>
|
|
319
|
-
{extras.content->Option.
|
|
323
|
+
{extras.content->Option.mapWithDefault(React.null, fn => fn({index: index}))}
|
|
320
324
|
</div>}
|
|
321
325
|
contentOptions=?{extras.popoverContentOptions}
|
|
322
326
|
content={c}
|
|
@@ -394,7 +398,11 @@ module Timeline = {
|
|
|
394
398
|
{markers
|
|
395
399
|
->Array.mapWithIndex((i, marker) => {
|
|
396
400
|
<Marker
|
|
397
|
-
|
|
401
|
+
index={i}
|
|
402
|
+
key={`${timeline.id}-task-${i->Int.toString}`}
|
|
403
|
+
marker
|
|
404
|
+
measuringScale
|
|
405
|
+
setMeasuringScale
|
|
398
406
|
/>
|
|
399
407
|
})
|
|
400
408
|
->React.array}
|