awesome-timeline-react 0.1.9 → 0.1.11
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/_tsup-dts-rollup.d.mts +29 -27
- package/dist/_tsup-dts-rollup.d.ts +29 -27
- package/dist/index.css +8 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +89 -89
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -49,7 +49,7 @@ __export(src_exports, {
|
|
|
49
49
|
module.exports = __toCommonJS(src_exports);
|
|
50
50
|
|
|
51
51
|
// src/timeline.tsx
|
|
52
|
-
var
|
|
52
|
+
var import_react22 = __toESM(require("react"));
|
|
53
53
|
|
|
54
54
|
// src/components/time-bar.tsx
|
|
55
55
|
var import_react4 = __toESM(require("react"));
|
|
@@ -355,7 +355,7 @@ var RowsHeader = ({
|
|
|
355
355
|
var rows_header_default = RowsHeader;
|
|
356
356
|
|
|
357
357
|
// src/components/content.tsx
|
|
358
|
-
var
|
|
358
|
+
var import_react19 = __toESM(require("react"));
|
|
359
359
|
|
|
360
360
|
// src/components/lines-canvas.tsx
|
|
361
361
|
var import_react8 = __toESM(require("react"));
|
|
@@ -394,8 +394,8 @@ var LinesCanvas = ({
|
|
|
394
394
|
var lines_canvas_default = LinesCanvas;
|
|
395
395
|
|
|
396
396
|
// src/hooks/use-produce-content.tsx
|
|
397
|
-
var
|
|
398
|
-
var
|
|
397
|
+
var import_react17 = require("react");
|
|
398
|
+
var import_react18 = __toESM(require("react"));
|
|
399
399
|
|
|
400
400
|
// src/components/static-event.tsx
|
|
401
401
|
var import_react10 = __toESM(require("react"));
|
|
@@ -1195,12 +1195,14 @@ var RowContent = (0, import_react13.forwardRef)((props, ref) => {
|
|
|
1195
1195
|
var row_content_default = RowContent;
|
|
1196
1196
|
|
|
1197
1197
|
// src/components/event.tsx
|
|
1198
|
-
var
|
|
1198
|
+
var import_react15 = __toESM(require("react"));
|
|
1199
1199
|
|
|
1200
|
-
// src/
|
|
1201
|
-
var
|
|
1202
|
-
var
|
|
1203
|
-
|
|
1200
|
+
// src/components/resize-icon.tsx
|
|
1201
|
+
var import_react14 = __toESM(require("react"));
|
|
1202
|
+
var ResizeIcon = () => {
|
|
1203
|
+
return /* @__PURE__ */ import_react14.default.createElement("div", { style: { display: "flex", gap: "1px" } }, /* @__PURE__ */ import_react14.default.createElement("div", { className: "resize-bar" }), /* @__PURE__ */ import_react14.default.createElement("div", { className: "resize-bar" }));
|
|
1204
|
+
};
|
|
1205
|
+
var resize_icon_default = ResizeIcon;
|
|
1204
1206
|
|
|
1205
1207
|
// src/components/event.tsx
|
|
1206
1208
|
var Event = ({
|
|
@@ -1212,10 +1214,10 @@ var Event = ({
|
|
|
1212
1214
|
setEvents,
|
|
1213
1215
|
tick
|
|
1214
1216
|
}) => {
|
|
1215
|
-
const { setDragStarted } = (0,
|
|
1216
|
-
const { onResize, eventsResize } = (0,
|
|
1217
|
-
const initialPositionForResizeRef = (0,
|
|
1218
|
-
const handleOnDragStart = (0,
|
|
1217
|
+
const { setDragStarted } = (0, import_react15.useContext)(DragStartedContext);
|
|
1218
|
+
const { onResize, eventsResize } = (0, import_react15.useContext)(ExternalPropertiesContext);
|
|
1219
|
+
const initialPositionForResizeRef = (0, import_react15.useRef)(0);
|
|
1220
|
+
const handleOnDragStart = (0, import_react15.useCallback)(
|
|
1219
1221
|
(event) => {
|
|
1220
1222
|
event.stopPropagation();
|
|
1221
1223
|
event.dataTransfer.setData("eventId", id);
|
|
@@ -1225,7 +1227,7 @@ var Event = ({
|
|
|
1225
1227
|
},
|
|
1226
1228
|
[setDragStarted]
|
|
1227
1229
|
);
|
|
1228
|
-
const handleOnDragEnd = (0,
|
|
1230
|
+
const handleOnDragEnd = (0, import_react15.useCallback)(
|
|
1229
1231
|
(event) => {
|
|
1230
1232
|
event.stopPropagation();
|
|
1231
1233
|
setDragStarted(false);
|
|
@@ -1235,12 +1237,12 @@ var Event = ({
|
|
|
1235
1237
|
[setDragStarted]
|
|
1236
1238
|
);
|
|
1237
1239
|
const classNames = (props == null ? void 0 : props.classNames) ? "event " + props.classNames.join(" ") : "event";
|
|
1238
|
-
const [draggableEvent, setDraggableEvent] = (0,
|
|
1239
|
-
const [resizeOffset, setResizeOffset] = (0,
|
|
1240
|
-
const resizeOffsetRef = (0,
|
|
1241
|
-
const [resizeStarted, setResizeStarted] = (0,
|
|
1242
|
-
const resizeDirectionRef = (0,
|
|
1243
|
-
const handleDocumentOnMouseMoveResize = (0,
|
|
1240
|
+
const [draggableEvent, setDraggableEvent] = (0, import_react15.useState)(true);
|
|
1241
|
+
const [resizeOffset, setResizeOffset] = (0, import_react15.useState)(0);
|
|
1242
|
+
const resizeOffsetRef = (0, import_react15.useRef)(0);
|
|
1243
|
+
const [resizeStarted, setResizeStarted] = (0, import_react15.useState)(false);
|
|
1244
|
+
const resizeDirectionRef = (0, import_react15.useRef)(null);
|
|
1245
|
+
const handleDocumentOnMouseMoveResize = (0, import_react15.useCallback)(
|
|
1244
1246
|
(event) => {
|
|
1245
1247
|
const offset = event.clientX - initialPositionForResizeRef.current;
|
|
1246
1248
|
setResizeOffset(
|
|
@@ -1250,7 +1252,7 @@ var Event = ({
|
|
|
1250
1252
|
},
|
|
1251
1253
|
[setResizeOffset]
|
|
1252
1254
|
);
|
|
1253
|
-
const handleDocumentOnMouseUp = (0,
|
|
1255
|
+
const handleDocumentOnMouseUp = (0, import_react15.useCallback)(
|
|
1254
1256
|
(event, resizeDirection) => {
|
|
1255
1257
|
initialPositionForResizeRef.current = 0;
|
|
1256
1258
|
setResizeStarted(false);
|
|
@@ -1299,7 +1301,7 @@ var Event = ({
|
|
|
1299
1301
|
sort_events_default
|
|
1300
1302
|
]
|
|
1301
1303
|
);
|
|
1302
|
-
const handleOnMouseDownEventResizer = (0,
|
|
1304
|
+
const handleOnMouseDownEventResizer = (0, import_react15.useCallback)(
|
|
1303
1305
|
(event, resizeDirection) => {
|
|
1304
1306
|
event.stopPropagation();
|
|
1305
1307
|
resizeDirectionRef.current = resizeDirection;
|
|
@@ -1318,7 +1320,7 @@ var Event = ({
|
|
|
1318
1320
|
},
|
|
1319
1321
|
[handleDocumentOnMouseMoveResize, handleDocumentOnMouseUp]
|
|
1320
1322
|
);
|
|
1321
|
-
const handleOnMouseMove = (0,
|
|
1323
|
+
const handleOnMouseMove = (0, import_react15.useCallback)(
|
|
1322
1324
|
(event) => {
|
|
1323
1325
|
if (!resizeStarted) {
|
|
1324
1326
|
event.stopPropagation();
|
|
@@ -1326,7 +1328,7 @@ var Event = ({
|
|
|
1326
1328
|
},
|
|
1327
1329
|
[resizeStarted]
|
|
1328
1330
|
);
|
|
1329
|
-
return /* @__PURE__ */
|
|
1331
|
+
return /* @__PURE__ */ import_react15.default.createElement(
|
|
1330
1332
|
"div",
|
|
1331
1333
|
{
|
|
1332
1334
|
id: `event_${id}`,
|
|
@@ -1345,42 +1347,40 @@ var Event = ({
|
|
|
1345
1347
|
cursor: (props == null ? void 0 : props.isLocked) ? "not-allowed" : "pointer"
|
|
1346
1348
|
}
|
|
1347
1349
|
},
|
|
1348
|
-
/* @__PURE__ */
|
|
1349
|
-
"
|
|
1350
|
+
/* @__PURE__ */ import_react15.default.createElement("div", { className: "event-content" }, !(props == null ? void 0 : props.isLocked) && (eventsResize || (props == null ? void 0 : props.isResizable)) && /* @__PURE__ */ import_react15.default.createElement(
|
|
1351
|
+
"div",
|
|
1350
1352
|
{
|
|
1351
1353
|
className: "event-resize",
|
|
1352
1354
|
style: resizeStarted ? { opacity: "100%" } : void 0,
|
|
1353
|
-
src: grip_lines_vertical_solid_default,
|
|
1354
|
-
alt: "resize-icon",
|
|
1355
1355
|
draggable: false,
|
|
1356
1356
|
onMouseEnter: () => setDraggableEvent(false),
|
|
1357
1357
|
onMouseLeave: () => setDraggableEvent(true),
|
|
1358
1358
|
onMouseDown: (event) => handleOnMouseDownEventResizer(event, "left")
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
|
|
1359
|
+
},
|
|
1360
|
+
/* @__PURE__ */ import_react15.default.createElement(resize_icon_default, null)
|
|
1361
|
+
), (props == null ? void 0 : props.content) ? props.content : null, !(props == null ? void 0 : props.isLocked) && (eventsResize || (props == null ? void 0 : props.isResizable)) && /* @__PURE__ */ import_react15.default.createElement(
|
|
1362
|
+
"div",
|
|
1362
1363
|
{
|
|
1363
1364
|
className: "event-resize",
|
|
1364
1365
|
style: resizeStarted ? { opacity: "100%" } : void 0,
|
|
1365
|
-
src: grip_lines_vertical_solid_default,
|
|
1366
|
-
alt: "resize-icon",
|
|
1367
1366
|
draggable: false,
|
|
1368
1367
|
onMouseEnter: () => setDraggableEvent(false),
|
|
1369
1368
|
onMouseLeave: () => setDraggableEvent(true),
|
|
1370
1369
|
onMouseDown: (event) => handleOnMouseDownEventResizer(event, "right")
|
|
1371
|
-
}
|
|
1370
|
+
},
|
|
1371
|
+
/* @__PURE__ */ import_react15.default.createElement(resize_icon_default, null)
|
|
1372
1372
|
))
|
|
1373
1373
|
);
|
|
1374
1374
|
};
|
|
1375
1375
|
var event_default = Event;
|
|
1376
1376
|
|
|
1377
1377
|
// src/hooks/use-intersection-observer.ts
|
|
1378
|
-
var
|
|
1378
|
+
var import_react16 = require("react");
|
|
1379
1379
|
var useIntersectionObserver = ({
|
|
1380
1380
|
bodyRef,
|
|
1381
1381
|
rowsContentRef
|
|
1382
1382
|
}) => {
|
|
1383
|
-
const callback = (0,
|
|
1383
|
+
const callback = (0, import_react16.useCallback)((entries) => {
|
|
1384
1384
|
entries.forEach((entry) => {
|
|
1385
1385
|
if (entry.isIntersecting) {
|
|
1386
1386
|
entry.target.classList.remove("row-hidden");
|
|
@@ -1392,7 +1392,7 @@ var useIntersectionObserver = ({
|
|
|
1392
1392
|
const observer = new IntersectionObserver(callback, {
|
|
1393
1393
|
root: bodyRef.current
|
|
1394
1394
|
});
|
|
1395
|
-
(0,
|
|
1395
|
+
(0, import_react16.useEffect)(() => {
|
|
1396
1396
|
if (rowsContentRef.current) {
|
|
1397
1397
|
rowsContentRef.current.forEach((row) => {
|
|
1398
1398
|
observer.observe(row);
|
|
@@ -1414,10 +1414,10 @@ var useProduceContent = ({
|
|
|
1414
1414
|
setEvents,
|
|
1415
1415
|
bodyRef
|
|
1416
1416
|
}) => {
|
|
1417
|
-
const rowsHeightContext = (0,
|
|
1418
|
-
const tempRowsHeightRef = (0,
|
|
1419
|
-
const rowsContentRef = (0,
|
|
1420
|
-
const [content, internalAllRowsHeight] = (0,
|
|
1417
|
+
const rowsHeightContext = (0, import_react17.useContext)(RowsHeightContext);
|
|
1418
|
+
const tempRowsHeightRef = (0, import_react17.useRef)(null);
|
|
1419
|
+
const rowsContentRef = (0, import_react17.useRef)([]);
|
|
1420
|
+
const [content, internalAllRowsHeight] = (0, import_react17.useMemo)(() => {
|
|
1421
1421
|
let internalAllRowsHeight2 = 0;
|
|
1422
1422
|
return [
|
|
1423
1423
|
rows.map((row, i) => {
|
|
@@ -1444,7 +1444,7 @@ var useProduceContent = ({
|
|
|
1444
1444
|
eventOrder = tempEventOrder;
|
|
1445
1445
|
}
|
|
1446
1446
|
prevEvent[tempEventOrder] = event;
|
|
1447
|
-
return /* @__PURE__ */
|
|
1447
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
1448
1448
|
event_default,
|
|
1449
1449
|
{
|
|
1450
1450
|
key: `event_${event.id}`,
|
|
@@ -1474,7 +1474,7 @@ var useProduceContent = ({
|
|
|
1474
1474
|
internalAllRowsHeight2 += 40 + highestEventOrder * 22;
|
|
1475
1475
|
const rowStaticEvents = tick && staticEvents ? staticEvents.filter((event) => event.rowId === row.id).map((event) => {
|
|
1476
1476
|
if (event.endTime >= windowTime[0] && event.startTime <= windowTime[1]) {
|
|
1477
|
-
return /* @__PURE__ */
|
|
1477
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
1478
1478
|
static_event_default,
|
|
1479
1479
|
{
|
|
1480
1480
|
key: `static_event_${event.id}`,
|
|
@@ -1487,7 +1487,7 @@ var useProduceContent = ({
|
|
|
1487
1487
|
);
|
|
1488
1488
|
}
|
|
1489
1489
|
}) : null;
|
|
1490
|
-
return /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, { key: `row_content_${row.id}` }, /* @__PURE__ */ import_react18.default.createElement(
|
|
1491
1491
|
row_content_default,
|
|
1492
1492
|
{
|
|
1493
1493
|
id: row.id,
|
|
@@ -1514,7 +1514,7 @@ var useProduceContent = ({
|
|
|
1514
1514
|
rowsContentRef,
|
|
1515
1515
|
bodyRef
|
|
1516
1516
|
});
|
|
1517
|
-
(0,
|
|
1517
|
+
(0, import_react17.useEffect)(() => {
|
|
1518
1518
|
if (rowsHeightContext) {
|
|
1519
1519
|
rowsHeightContext.setRowsHeight(tempRowsHeightRef.current);
|
|
1520
1520
|
rowsHeightContext.setAllRowsHeight(internalAllRowsHeight);
|
|
@@ -1525,7 +1525,7 @@ var useProduceContent = ({
|
|
|
1525
1525
|
var use_produce_content_default = useProduceContent;
|
|
1526
1526
|
|
|
1527
1527
|
// src/components/content.tsx
|
|
1528
|
-
var Content = (0,
|
|
1528
|
+
var Content = (0, import_react19.forwardRef)(
|
|
1529
1529
|
({
|
|
1530
1530
|
rows,
|
|
1531
1531
|
events,
|
|
@@ -1540,12 +1540,12 @@ var Content = (0, import_react18.forwardRef)(
|
|
|
1540
1540
|
bodyRef,
|
|
1541
1541
|
lineClassName
|
|
1542
1542
|
}, ref) => {
|
|
1543
|
-
const [mouseDown, setMouseDown] = (0,
|
|
1544
|
-
const startMovePosition = (0,
|
|
1545
|
-
const [changeGrid, setChangeGrid] = (0,
|
|
1543
|
+
const [mouseDown, setMouseDown] = (0, import_react19.useState)(false);
|
|
1544
|
+
const startMovePosition = (0, import_react19.useRef)(null);
|
|
1545
|
+
const [changeGrid, setChangeGrid] = (0, import_react19.useState)(false);
|
|
1546
1546
|
const { blockWidth } = use_get_block_properties_default({ windowTime, contentWidth });
|
|
1547
|
-
const rowsHeightContext = (0,
|
|
1548
|
-
const handleOnMouseMove = (0,
|
|
1547
|
+
const rowsHeightContext = (0, import_react19.useContext)(RowsHeightContext);
|
|
1548
|
+
const handleOnMouseMove = (0, import_react19.useCallback)(
|
|
1549
1549
|
(event) => {
|
|
1550
1550
|
event.preventDefault();
|
|
1551
1551
|
if (!mouseDown) {
|
|
@@ -1571,7 +1571,7 @@ var Content = (0, import_react18.forwardRef)(
|
|
|
1571
1571
|
},
|
|
1572
1572
|
[blockWidth, setWindowTime, mouseDown]
|
|
1573
1573
|
);
|
|
1574
|
-
const handleOnMouseDown = (0,
|
|
1574
|
+
const handleOnMouseDown = (0, import_react19.useCallback)(
|
|
1575
1575
|
(event) => {
|
|
1576
1576
|
setMouseDown(true);
|
|
1577
1577
|
if (event.button === 1) {
|
|
@@ -1583,10 +1583,10 @@ var Content = (0, import_react18.forwardRef)(
|
|
|
1583
1583
|
},
|
|
1584
1584
|
[setMouseDown]
|
|
1585
1585
|
);
|
|
1586
|
-
const handleOnMouseUp = (0,
|
|
1586
|
+
const handleOnMouseUp = (0, import_react19.useCallback)(() => {
|
|
1587
1587
|
setMouseDown(false);
|
|
1588
1588
|
}, [setMouseDown]);
|
|
1589
|
-
const handleOnMouseLeave = (0,
|
|
1589
|
+
const handleOnMouseLeave = (0, import_react19.useCallback)(
|
|
1590
1590
|
() => setMouseDown(false),
|
|
1591
1591
|
[setMouseDown]
|
|
1592
1592
|
);
|
|
@@ -1600,7 +1600,7 @@ var Content = (0, import_react18.forwardRef)(
|
|
|
1600
1600
|
setEvents,
|
|
1601
1601
|
bodyRef
|
|
1602
1602
|
});
|
|
1603
|
-
const handleAuxClick = (0,
|
|
1603
|
+
const handleAuxClick = (0, import_react19.useCallback)(
|
|
1604
1604
|
(event) => {
|
|
1605
1605
|
event.preventDefault();
|
|
1606
1606
|
if (event.button === 1) {
|
|
@@ -1609,7 +1609,7 @@ var Content = (0, import_react18.forwardRef)(
|
|
|
1609
1609
|
},
|
|
1610
1610
|
[]
|
|
1611
1611
|
);
|
|
1612
|
-
const handleOnWheel = (0,
|
|
1612
|
+
const handleOnWheel = (0, import_react19.useCallback)(
|
|
1613
1613
|
(event) => {
|
|
1614
1614
|
const pixelsToCalculate = tick ? 900 / tick : 0;
|
|
1615
1615
|
if (changeGrid) {
|
|
@@ -1624,12 +1624,12 @@ var Content = (0, import_react18.forwardRef)(
|
|
|
1624
1624
|
},
|
|
1625
1625
|
[changeGrid, cellWidth, tick]
|
|
1626
1626
|
);
|
|
1627
|
-
(0,
|
|
1627
|
+
(0, import_react19.useEffect)(() => {
|
|
1628
1628
|
if (bodyRef.current) {
|
|
1629
1629
|
bodyRef.current.style.overflow = changeGrid ? "hidden" : "auto";
|
|
1630
1630
|
}
|
|
1631
1631
|
}, [changeGrid]);
|
|
1632
|
-
return /* @__PURE__ */
|
|
1632
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1633
1633
|
"div",
|
|
1634
1634
|
{
|
|
1635
1635
|
key: "content",
|
|
@@ -1646,7 +1646,7 @@ var Content = (0, import_react18.forwardRef)(
|
|
|
1646
1646
|
height: rowsHeightContext == null ? void 0 : rowsHeightContext.allRowsHeight
|
|
1647
1647
|
}
|
|
1648
1648
|
},
|
|
1649
|
-
/* @__PURE__ */
|
|
1649
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
1650
1650
|
lines_canvas_default,
|
|
1651
1651
|
{
|
|
1652
1652
|
contentWidth,
|
|
@@ -1661,15 +1661,15 @@ var Content = (0, import_react18.forwardRef)(
|
|
|
1661
1661
|
var content_default = Content;
|
|
1662
1662
|
|
|
1663
1663
|
// src/hooks/use-resize-observer.ts
|
|
1664
|
-
var
|
|
1664
|
+
var import_react20 = require("react");
|
|
1665
1665
|
var useResizeObserver = ({
|
|
1666
1666
|
windowTime,
|
|
1667
1667
|
setTick,
|
|
1668
1668
|
setCellWidth,
|
|
1669
1669
|
contentRef
|
|
1670
1670
|
}) => {
|
|
1671
|
-
const prevWidthRef = (0,
|
|
1672
|
-
const resizeObserver = (0,
|
|
1671
|
+
const prevWidthRef = (0, import_react20.useRef)(0);
|
|
1672
|
+
const resizeObserver = (0, import_react20.useMemo)(() => {
|
|
1673
1673
|
return new ResizeObserver((entries) => {
|
|
1674
1674
|
var _a;
|
|
1675
1675
|
for (const entry of entries) {
|
|
@@ -1684,7 +1684,7 @@ var useResizeObserver = ({
|
|
|
1684
1684
|
}
|
|
1685
1685
|
});
|
|
1686
1686
|
}, [windowTime]);
|
|
1687
|
-
(0,
|
|
1687
|
+
(0, import_react20.useEffect)(() => {
|
|
1688
1688
|
if (contentRef.current) {
|
|
1689
1689
|
resizeObserver.observe(contentRef.current, { box: "border-box" });
|
|
1690
1690
|
}
|
|
@@ -1694,15 +1694,15 @@ var useResizeObserver = ({
|
|
|
1694
1694
|
var use_resize_observer_default = useResizeObserver;
|
|
1695
1695
|
|
|
1696
1696
|
// src/components/rt-indicator.tsx
|
|
1697
|
-
var
|
|
1697
|
+
var import_react21 = __toESM(require("react"));
|
|
1698
1698
|
var RTIndicator = ({
|
|
1699
1699
|
tick,
|
|
1700
1700
|
windowTime
|
|
1701
1701
|
}) => {
|
|
1702
|
-
const [currentTime, setCurrentTime] = (0,
|
|
1703
|
-
const [leftOffset, setLeftOffset] = (0,
|
|
1704
|
-
const intervalIdRef = (0,
|
|
1705
|
-
(0,
|
|
1702
|
+
const [currentTime, setCurrentTime] = (0, import_react21.useState)((/* @__PURE__ */ new Date()).getTime() / 1e3);
|
|
1703
|
+
const [leftOffset, setLeftOffset] = (0, import_react21.useState)(0);
|
|
1704
|
+
const intervalIdRef = (0, import_react21.useRef)(null);
|
|
1705
|
+
(0, import_react21.useEffect)(() => {
|
|
1706
1706
|
if (tick) {
|
|
1707
1707
|
const leftOffsetTime = currentTime - windowTime[0];
|
|
1708
1708
|
setLeftOffset(Math.round(leftOffsetTime / tick));
|
|
@@ -1715,7 +1715,7 @@ var RTIndicator = ({
|
|
|
1715
1715
|
intervalIdRef.current = intervalId;
|
|
1716
1716
|
}
|
|
1717
1717
|
}, [tick, windowTime, currentTime]);
|
|
1718
|
-
return /* @__PURE__ */
|
|
1718
|
+
return /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, windowTime[0] <= currentTime && currentTime <= windowTime[1] && /* @__PURE__ */ import_react21.default.createElement(import_react21.default.Fragment, null, /* @__PURE__ */ import_react21.default.createElement("div", { className: "rt-arrow", style: { left: 86 + leftOffset } }), /* @__PURE__ */ import_react21.default.createElement("div", { className: "rt-line", style: { left: 100 + leftOffset } })));
|
|
1719
1719
|
};
|
|
1720
1720
|
var rt_indicator_default = RTIndicator;
|
|
1721
1721
|
|
|
@@ -1732,7 +1732,7 @@ var Timeline = ({
|
|
|
1732
1732
|
showRTIndicator = true,
|
|
1733
1733
|
eventsResize = true
|
|
1734
1734
|
}) => {
|
|
1735
|
-
const [windowTime, setWindowTime] = (0,
|
|
1735
|
+
const [windowTime, setWindowTime] = (0, import_react22.useState)([
|
|
1736
1736
|
new Date(
|
|
1737
1737
|
startDate.getFullYear(),
|
|
1738
1738
|
startDate.getMonth(),
|
|
@@ -1750,16 +1750,16 @@ var Timeline = ({
|
|
|
1750
1750
|
0
|
|
1751
1751
|
).getTime() / 1e3
|
|
1752
1752
|
]);
|
|
1753
|
-
const [cellWidth, setCellWidth] = (0,
|
|
1754
|
-
const [internalEvents, setInternalEvents] = (0,
|
|
1755
|
-
const contentRef = (0,
|
|
1756
|
-
const mainRef = (0,
|
|
1757
|
-
const bodyRef = (0,
|
|
1758
|
-
const [tick, setTick] = (0,
|
|
1759
|
-
const [scrollWidth, setScrollWidth] = (0,
|
|
1760
|
-
const [rowsHeight, setRowsHeight] = (0,
|
|
1761
|
-
const [allRowsHeight, setAllRowsHeight] = (0,
|
|
1762
|
-
(0,
|
|
1753
|
+
const [cellWidth, setCellWidth] = (0, import_react22.useState)(0);
|
|
1754
|
+
const [internalEvents, setInternalEvents] = (0, import_react22.useState)([]);
|
|
1755
|
+
const contentRef = (0, import_react22.useRef)(null);
|
|
1756
|
+
const mainRef = (0, import_react22.useRef)(null);
|
|
1757
|
+
const bodyRef = (0, import_react22.useRef)(null);
|
|
1758
|
+
const [tick, setTick] = (0, import_react22.useState)(null);
|
|
1759
|
+
const [scrollWidth, setScrollWidth] = (0, import_react22.useState)(0);
|
|
1760
|
+
const [rowsHeight, setRowsHeight] = (0, import_react22.useState)(null);
|
|
1761
|
+
const [allRowsHeight, setAllRowsHeight] = (0, import_react22.useState)(0);
|
|
1762
|
+
(0, import_react22.useEffect)(() => {
|
|
1763
1763
|
if (contentRef.current) {
|
|
1764
1764
|
const windowDuration = windowTime[1] - windowTime[0];
|
|
1765
1765
|
const numberOfHourBlocks = windowDuration / 3600;
|
|
@@ -1771,18 +1771,18 @@ var Timeline = ({
|
|
|
1771
1771
|
);
|
|
1772
1772
|
}
|
|
1773
1773
|
}, []);
|
|
1774
|
-
(0,
|
|
1774
|
+
(0, import_react22.useEffect)(() => {
|
|
1775
1775
|
if (bodyRef.current) {
|
|
1776
1776
|
setScrollWidth(
|
|
1777
1777
|
bodyRef.current.getBoundingClientRect().width - bodyRef.current.scrollWidth
|
|
1778
1778
|
);
|
|
1779
1779
|
}
|
|
1780
1780
|
}, []);
|
|
1781
|
-
(0,
|
|
1781
|
+
(0, import_react22.useEffect)(() => {
|
|
1782
1782
|
setInternalEvents(events.sort(sort_events_default));
|
|
1783
1783
|
}, [events]);
|
|
1784
|
-
const [dragStarted, setDragStarted] = (0,
|
|
1785
|
-
(0,
|
|
1784
|
+
const [dragStarted, setDragStarted] = (0, import_react22.useState)(false);
|
|
1785
|
+
(0, import_react22.useEffect)(() => {
|
|
1786
1786
|
let tempRowsHeight = null;
|
|
1787
1787
|
rows.forEach((row) => {
|
|
1788
1788
|
if (tempRowsHeight === null) {
|
|
@@ -1794,7 +1794,7 @@ var Timeline = ({
|
|
|
1794
1794
|
setRowsHeight(tempRowsHeight);
|
|
1795
1795
|
}, [rows]);
|
|
1796
1796
|
use_resize_observer_default({ contentRef, setCellWidth, setTick, windowTime });
|
|
1797
|
-
return /* @__PURE__ */
|
|
1797
|
+
return /* @__PURE__ */ import_react22.default.createElement("div", { className: "main-wrapper", ref: mainRef }, showRTIndicator && /* @__PURE__ */ import_react22.default.createElement(rt_indicator_default, { tick, windowTime }), /* @__PURE__ */ import_react22.default.createElement(
|
|
1798
1798
|
time_bar_default,
|
|
1799
1799
|
{
|
|
1800
1800
|
windowTime,
|
|
@@ -1802,24 +1802,24 @@ var Timeline = ({
|
|
|
1802
1802
|
contentWidth: contentRef.current ? contentRef.current.getBoundingClientRect().width : null,
|
|
1803
1803
|
scrollWidth
|
|
1804
1804
|
}
|
|
1805
|
-
), /* @__PURE__ */
|
|
1805
|
+
), /* @__PURE__ */ import_react22.default.createElement("div", { className: "body-wrapper", ref: bodyRef }, /* @__PURE__ */ import_react22.default.createElement(
|
|
1806
1806
|
RowsHeightContext.Provider,
|
|
1807
1807
|
{
|
|
1808
1808
|
value: { rowsHeight, setRowsHeight, allRowsHeight, setAllRowsHeight }
|
|
1809
1809
|
},
|
|
1810
|
-
/* @__PURE__ */
|
|
1810
|
+
/* @__PURE__ */ import_react22.default.createElement(
|
|
1811
1811
|
rows_header_default,
|
|
1812
1812
|
{
|
|
1813
1813
|
rows,
|
|
1814
1814
|
className: additionalClassNames == null ? void 0 : additionalClassNames.rowsHeader
|
|
1815
1815
|
}
|
|
1816
1816
|
),
|
|
1817
|
-
/* @__PURE__ */
|
|
1817
|
+
/* @__PURE__ */ import_react22.default.createElement(DragStartedContext.Provider, { value: { dragStarted, setDragStarted } }, /* @__PURE__ */ import_react22.default.createElement(
|
|
1818
1818
|
ExternalPropertiesContext.Provider,
|
|
1819
1819
|
{
|
|
1820
1820
|
value: { onDrop, onResize, eventsResize }
|
|
1821
1821
|
},
|
|
1822
|
-
/* @__PURE__ */
|
|
1822
|
+
/* @__PURE__ */ import_react22.default.createElement(
|
|
1823
1823
|
content_default,
|
|
1824
1824
|
{
|
|
1825
1825
|
events: internalEvents,
|