awesome-timeline-react 0.1.5 → 0.1.7

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/README.md CHANGED
@@ -2,10 +2,16 @@
2
2
 
3
3
  ## Introduction
4
4
 
5
- **Awesome Timeline React** is a component that developers can include in their projects. It provides a Gantt timeline for visualizing and managing events. With simple configuration, powerful performance, and customization options, it's an excellent choice for your project. The component is not published yet; it will be released as a beta version first. If you have any ideas for features or encounter any bugs, please email me at [jakub.plata@yahoo.pl](mailto:jakub.plata@yahoo.pl).
5
+ **Awesome Timeline React** is a component that developers can include in their projects. It provides a Gantt timeline for visualizing and managing events. With simple configuration, powerful performance, and customization options, it's an excellent choice for your project. Current releases are pre-releases. If you have any ideas for features or encounter any bugs, please email me at [jakub.plata@yahoo.pl](mailto:jakub.plata@yahoo.pl).
6
6
 
7
7
  ![](https://raw.githubusercontent.com/Plageros/awesome-timeline-react/master/public/gifs/demo-overview.gif)
8
8
 
9
+ ## Instalation
10
+
11
+ ```sh
12
+ npm install awesome-react-timeline
13
+ ```
14
+
9
15
  ## Ladle
10
16
 
11
17
  To run ladle stories, type:
@@ -16,7 +22,14 @@ npm run ladle
16
22
 
17
23
  ## Configuration
18
24
 
19
- First, import the `Timeline` component into your project. The following properties are available:
25
+ First, import the `Timeline` component and css into your project.
26
+
27
+ ```sh
28
+ import { Timeline } from "awesome-timeline-react";
29
+ import "awesome-timeline-react/dist/index.css";
30
+ ```
31
+
32
+ The following properties for Timeline component are available:
20
33
 
21
34
  - `rows` – an array of objects that define rows. The order within the array will be preserved in the Timeline.
22
35
 
@@ -42,12 +55,15 @@ First, import the `Timeline` component into your project. The following properti
42
55
  - `endDate`: `number` (timestamp in seconds)
43
56
 
44
57
  - `additionalClassNames` – contains additional class names that will be included within elements:
58
+
45
59
  - `timeBar`: `string`
46
60
  - `dayRow`: `string`
47
61
  - `hourRow`: `string`
48
62
  - `line`: `string`
49
63
  - `rowsHeader`: `string`
50
64
 
65
+ - `showRTIndicator` – property that controls wheter Real Time Indicator will be show (default as true)
66
+
51
67
  ## Awesome Features
52
68
 
53
69
  One of the awesome features (currently hidden from the interface) is adjusting the granulation of the grid. To achieve this, click the wheel on the mouse. This will hide the scroll bar, and you can adjust the grid granulation by scrolling the wheel. Each scroll iteration adjusts the grid by ±15 minutes, depending on the scroll direction.
@@ -59,7 +75,7 @@ One of the awesome features (currently hidden from the interface) is adjusting t
59
75
  Here, we will store major features planned for future releases (from highest to lowest priority):
60
76
 
61
77
  1. Resize events
62
- 2. Real time line
78
+ 2. ~~Real time line~~ - published in 0.1.7 version
63
79
  3. Customizable prompts after hovering over an event
64
80
  4. Customizable second row of the time bar
65
81
  5. Intersection observer with `display: none` property to further improve performance
@@ -27,14 +27,16 @@ export declare const default_alias_1: React_2.ForwardRefExoticComponent<
27
27
  ContentType & React_2.RefAttributes<HTMLDivElement>
28
28
  >;
29
29
 
30
- export declare const default_alias_10: (dayIndex: number) => string;
30
+ export declare const default_alias_10: (monthIndex: number) => string;
31
31
 
32
- export declare const default_alias_11: (
32
+ export declare const default_alias_11: (dayIndex: number) => string;
33
+
34
+ export declare const default_alias_12: (
33
35
  eventA: EventType,
34
36
  eventB: EventType
35
37
  ) => 1 | -1;
36
38
 
37
- export declare const default_alias_12: ({
39
+ export declare const default_alias_13: ({
38
40
  windowTime,
39
41
  tick,
40
42
  contentWidth,
@@ -49,7 +51,7 @@ export declare const default_alias_12: ({
49
51
  hourBlocks: JSX.Element[];
50
52
  };
51
53
 
52
- export declare const default_alias_13: ({
54
+ export declare const default_alias_14: ({
53
55
  windowTime,
54
56
  contentWidth,
55
57
  }: {
@@ -60,7 +62,7 @@ export declare const default_alias_13: ({
60
62
  blockWidth: number;
61
63
  };
62
64
 
63
- export declare const default_alias_14: ({
65
+ export declare const default_alias_15: ({
64
66
  bodyRef,
65
67
  rowsContentRef,
66
68
  }: {
@@ -68,7 +70,7 @@ export declare const default_alias_14: ({
68
70
  rowsContentRef: React.MutableRefObject<HTMLDivElement[] | null>;
69
71
  }) => void;
70
72
 
71
- export declare const default_alias_15: ({
73
+ export declare const default_alias_16: ({
72
74
  rows,
73
75
  windowTime,
74
76
  tick,
@@ -79,7 +81,7 @@ export declare const default_alias_15: ({
79
81
  bodyRef,
80
82
  }: ProduceContentType) => React_2.JSX.Element[];
81
83
 
82
- export declare const default_alias_16: ({
84
+ export declare const default_alias_17: ({
83
85
  windowTime,
84
86
  setTick,
85
87
  setCellWidth,
@@ -138,6 +140,14 @@ export declare const default_alias_6: ({
138
140
  }) => React_2.JSX.Element;
139
141
 
140
142
  export declare const default_alias_7: ({
143
+ tick,
144
+ windowTime,
145
+ }: {
146
+ tick: number | null;
147
+ windowTime: number[];
148
+ }) => React_2.JSX.Element;
149
+
150
+ export declare const default_alias_8: ({
141
151
  id,
142
152
  startPosition,
143
153
  width,
@@ -151,7 +161,7 @@ export declare const default_alias_7: ({
151
161
  height: CSSProperties["height"];
152
162
  }) => React_2.JSX.Element;
153
163
 
154
- export declare const default_alias_8: ({
164
+ export declare const default_alias_9: ({
155
165
  windowTime,
156
166
  tick,
157
167
  contentWidth,
@@ -165,8 +175,6 @@ export declare const default_alias_8: ({
165
175
  additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
166
176
  }) => React_2.JSX.Element;
167
177
 
168
- export declare const default_alias_9: (monthIndex: number) => string;
169
-
170
178
  export declare const DragStartedContext: Context<DragStartedContext_2>;
171
179
 
172
180
  declare type DragStartedContext_2 = {
@@ -261,6 +269,7 @@ declare const Timeline: ({
261
269
  startDate,
262
270
  endDate,
263
271
  additionalClassNames,
272
+ showRTIndicator,
264
273
  }: TimelineType) => React_2.JSX.Element;
265
274
  export { Timeline };
266
275
  export { Timeline as Timeline_alias_1 };
@@ -275,6 +284,7 @@ export declare type TimelineType = {
275
284
  startDate: Date;
276
285
  endDate: Date;
277
286
  additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
287
+ showRTIndicator?: boolean;
278
288
  };
279
289
 
280
290
  export {};
package/dist/index.css CHANGED
@@ -1,2 +1,2 @@
1
- .rows-header-wrapper{width:100px;height:fit-content;border-right:1px solid yellow;background-color:#272424;color:#fff;box-sizing:border-box;.row-header:not(:last-child){border-bottom:1px solid yellow}box-shadow:4px 0 20px #000}.main-wrapper{display:flex;flex-direction:column;height:100%;width:100%}.body-wrapper{display:flex;flex-direction:row;border-left:1px solid black;border-bottom:1px solid black;border-right:1px solid black;width:100%;overflow:auto;box-sizing:border-box}.day-block{height:100%;text-align:center;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:4px}.hour-block{display:block;width:100%;text-align:center;padding:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.content-wrapper{position:relative;display:flex;flex-direction:column;width:100%;.row-content:not(:last-child){border-bottom:1px solid #e4dcdc}}.row-header{display:flex;justify-content:center;align-items:center;width:100px;transition:min-height .5s ease-in-out;box-sizing:border-box}.row-content{position:relative;width:100%;padding-top:10px;padding-bottom:10px;overflow:hidden;z-index:0;transition:min-height .5s ease-in-out;box-sizing:border-box}.event{position:absolute;height:20px;border:1px solid black;z-index:1;transition:top .5s ease-in-out;box-sizing:border-box;display:flex;border-radius:5px;box-shadow:inset 0 0 5px gray}.event-content{width:100%;height:100%}.static-event{position:absolute;background-color:#e0e0e0;z-index:0;border:1px solid transparent;box-sizing:border-box;border-radius:5px}.time-bar{display:flex;flex-direction:row;width:100%;height:50px;min-height:50px;border:1px solid yellow;background-color:#272424;color:#fff;box-sizing:border-box}.empty-block{width:100px;min-width:100px;border-right:1px solid yellow;box-sizing:border-box}.time-content{display:flex;flex-direction:column;height:100%}.day-row{display:grid;height:50%;width:auto;border-bottom:1px solid yellow;div:not(:last-child){border-right:1px solid yellow}}.hour-row{display:grid;height:50%;div:not(:last-child){border-right:1px solid yellow;box-sizing:border-box}box-shadow:0 4px 20px #000}.not-clickable{div{pointer-events:none}}.line{height:100%;width:100%;border-right:1px solid #e4dcdc;box-sizing:border-box}.lines-canvas{position:absolute;top:0;display:grid;height:100%;width:100%;overflow:hidden}.hide-last-line{div:last-child{border-right:none}}.row-hidden{visibility:hidden}
1
+ .rows-header-wrapper{width:100px;height:fit-content;border-right:1px solid yellow;background-color:#272424;color:#fff;box-sizing:border-box;.row-header:not(:last-child){border-bottom:1px solid yellow}box-shadow:4px 0 20px #000}.main-wrapper{position:relative;display:flex;flex-direction:column;height:100%;width:100%}.body-wrapper{display:flex;flex-direction:row;border-left:1px solid black;border-bottom:1px solid black;border-right:1px solid black;width:100%;overflow:auto;box-sizing:border-box}.day-block{height:100%;text-align:center;box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:4px}.hour-block{display:block;width:100%;text-align:center;padding:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.content-wrapper{position:relative;display:flex;flex-direction:column;width:100%;.row-content:not(:last-child){border-bottom:1px solid #e4dcdc}}.row-header{display:flex;justify-content:center;align-items:center;width:100px;transition:min-height .5s ease-in-out;box-sizing:border-box}.row-content{position:relative;width:100%;padding-top:10px;padding-bottom:10px;overflow:hidden;z-index:0;transition:min-height .5s ease-in-out;box-sizing:border-box}.event{position:absolute;height:20px;border:1px solid black;z-index:1;transition:top .5s ease-in-out;box-sizing:border-box;display:flex;border-radius:5px;box-shadow:inset 0 0 5px gray}.event-content{width:100%;height:100%}.static-event{position:absolute;background-color:#e0e0e0;z-index:0;border:1px solid transparent;box-sizing:border-box;border-radius:5px}.time-bar{display:flex;flex-direction:row;width:100%;height:50px;min-height:50px;border:1px solid yellow;background-color:#272424;color:#fff;box-sizing:border-box}.empty-block{width:100px;min-width:100px;border-right:1px solid yellow;box-sizing:border-box}.time-content{display:flex;flex-direction:column;height:100%}.day-row{display:grid;height:50%;width:auto;border-bottom:1px solid yellow;div:not(:last-child){border-right:1px solid yellow}}.hour-row{display:grid;height:50%;div:not(:last-child){border-right:1px solid yellow;box-sizing:border-box}box-shadow:0 4px 20px #000}.not-clickable{div{pointer-events:none}}.line{height:100%;width:100%;border-right:1px solid #e4dcdc;box-sizing:border-box}.lines-canvas{position:absolute;top:0;display:grid;height:100%;width:100%;overflow:hidden}.hide-last-line{div:last-child{border-right:none}}.row-hidden{visibility:hidden}.rt-line{position:absolute;height:calc(100% - 24px);top:24px;width:2px;box-sizing:border-box;border-right:dotted 2px red}.rt-arrow{position:absolute;top:0;width:0;height:0;border-left:15px solid transparent;border-right:15px solid transparent;border-top:26px solid red}
2
2
  /*# sourceMappingURL=index.css.map */
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/style.css","../src/components/style.css"],"sourcesContent":[".rows-header-wrapper {\r\n width: 100px;\r\n height: fit-content;\r\n border-right: 1px solid yellow;\r\n background-color: rgb(39, 36, 36);\r\n color: white;\r\n box-sizing: border-box;\r\n .row-header:not(:last-child) {\r\n border-bottom: 1px solid yellow;\r\n }\r\n box-shadow: 4px 0px 20px black;\r\n}\r\n\r\n.main-wrapper {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%;\r\n width: 100%;\r\n}\r\n\r\n.body-wrapper {\r\n display: flex;\r\n flex-direction: row;\r\n border-left: 1px solid black;\r\n border-bottom: 1px solid black;\r\n border-right: 1px solid black;\r\n width: 100%;\r\n overflow: auto;\r\n box-sizing: border-box;\r\n}\r\n\r\n.day-block {\r\n height: 100%;\r\n text-align: center;\r\n box-sizing: border-box;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n padding: 4px;\r\n}\r\n\r\n.hour-block {\r\n display: block;\r\n width: 100%;\r\n text-align: center;\r\n padding: 4px;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n}\r\n",".content-wrapper {\r\n position: relative;\r\n display: flex;\r\n flex-direction: column;\r\n width: 100%;\r\n .row-content:not(:last-child) {\r\n border-bottom: 1px solid #e4dcdc;\r\n }\r\n}\r\n\r\n.row-header {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n width: 100px;\r\n transition: min-height 0.5s ease-in-out;\r\n box-sizing: border-box;\r\n}\r\n\r\n.row-content {\r\n position: relative;\r\n width: 100%;\r\n padding-top: 10px;\r\n padding-bottom: 10px;\r\n overflow: hidden;\r\n z-index: 0;\r\n transition: min-height 0.5s ease-in-out;\r\n box-sizing: border-box;\r\n}\r\n\r\n.event {\r\n position: absolute;\r\n height: 20px;\r\n border: 1px solid black;\r\n z-index: 1;\r\n transition: top 0.5s ease-in-out;\r\n box-sizing: border-box;\r\n display: flex;\r\n border-radius: 5px;\r\n box-shadow: inset 0px 0px 5px gray;\r\n}\r\n\r\n.event-content {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.static-event {\r\n position: absolute;\r\n background-color: #e0e0e0;\r\n z-index: 0;\r\n border: 1px solid transparent;\r\n box-sizing: border-box;\r\n border-radius: 5px;\r\n}\r\n\r\n.time-bar {\r\n display: flex;\r\n flex-direction: row;\r\n width: 100%;\r\n height: 50px;\r\n min-height: 50px;\r\n border: 1px solid yellow;\r\n background-color: rgb(39, 36, 36);\r\n color: white;\r\n box-sizing: border-box;\r\n}\r\n\r\n.empty-block {\r\n width: 100px;\r\n min-width: 100px;\r\n border-right: 1px solid yellow;\r\n box-sizing: border-box;\r\n}\r\n\r\n.time-content {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%;\r\n}\r\n\r\n.day-row {\r\n display: grid;\r\n height: 50%;\r\n width: auto;\r\n border-bottom: 1px solid yellow;\r\n div:not(:last-child) {\r\n border-right: 1px solid yellow;\r\n }\r\n}\r\n\r\n.hour-row {\r\n display: grid;\r\n height: 50%;\r\n div:not(:last-child) {\r\n border-right: 1px solid yellow;\r\n box-sizing: border-box;\r\n }\r\n box-shadow: 0px 4px 20px black;\r\n}\r\n\r\n.not-clickable {\r\n div {\r\n pointer-events: none;\r\n }\r\n}\r\n\r\n.line {\r\n height: 100%;\r\n width: 100%;\r\n border-right: 1px solid #e4dcdc;\r\n box-sizing: border-box;\r\n}\r\n\r\n.lines-canvas {\r\n position: absolute;\r\n top: 0;\r\n display: grid;\r\n height: 100%;\r\n width: 100%;\r\n overflow: hidden;\r\n}\r\n\r\n.hide-last-line {\r\n div:last-child {\r\n border-right: none;\r\n }\r\n}\r\n\r\n.row-hidden {\r\n visibility: hidden;\r\n}\r\n"],"mappings":"AAAA,CAAC,oBACC,MAAO,MACP,OAAQ,YACR,aAAc,IAAI,MAAM,OACxB,iBAAkB,QAClB,MAAO,KACP,WAAY,WACZ,CAAC,UAAU,KAAK,aACd,cAAe,IAAI,MAAM,MAC3B,CACA,WAAY,IAAI,EAAI,KAAK,IAC3B,CAEA,CAAC,aACC,QAAS,KACT,eAAgB,OAChB,OAAQ,KACR,MAAO,IACT,CAEA,CAAC,aACC,QAAS,KACT,eAAgB,IAChB,YAAa,IAAI,MAAM,MACvB,cAAe,IAAI,MAAM,MACzB,aAAc,IAAI,MAAM,MACxB,MAAO,KACP,SAAU,KACV,WAAY,UACd,CAEA,CAAC,UACC,OAAQ,KACR,WAAY,OACZ,WAAY,WACZ,SAAU,OACV,cAAe,SACf,YAAa,OArCf,QAsCW,GACX,CAEA,CAAC,WACC,QAAS,MACT,MAAO,KACP,WAAY,OA5Cd,QA6CW,IACT,SAAU,OACV,cAAe,SACf,YAAa,MACf,CCjDA,CAAC,gBACC,SAAU,SACV,QAAS,KACT,eAAgB,OAChB,MAAO,KACP,CAAC,WAAW,KAAK,aACf,cAAe,IAAI,MAAM,OAC3B,CACF,CAEA,CAAC,WACC,QAAS,KACT,gBAAiB,OACjB,YAAa,OACb,MAAO,MACP,WAAY,WAAW,IAAK,YAC5B,WAAY,UACd,CAEA,CAdG,YAeD,SAAU,SACV,MAAO,KACP,YAAa,KACb,eAAgB,KAChB,SAAU,OACV,QAAS,EACT,WAAY,WAAW,IAAK,YAC5B,WAAY,UACd,CAEA,CAAC,MACC,SAAU,SACV,OAAQ,KACR,OAAQ,IAAI,MAAM,MAClB,QAAS,EACT,WAAY,IAAI,IAAK,YACrB,WAAY,WACZ,QAAS,KArCX,cAsCiB,IACf,WAAY,MAAM,EAAI,EAAI,IAAI,IAChC,CAEA,CAAC,cACC,MAAO,KACP,OAAQ,IACV,CAEA,CAAC,aACC,SAAU,SACV,iBAAkB,QAClB,QAAS,EACT,OAAQ,IAAI,MAAM,YAClB,WAAY,WApDd,cAqDiB,GACjB,CAEA,CAAC,SACC,QAAS,KACT,eAAgB,IAChB,MAAO,KACP,OAAQ,KACR,WAAY,KACZ,OAAQ,IAAI,MAAM,OAClB,iBAAkB,QAClB,MAAO,KACP,WAAY,UACd,CAEA,CAAC,YACC,MAAO,MACP,UAAW,MACX,aAAc,IAAI,MAAM,OACxB,WAAY,UACd,CAEA,CAAC,aACC,QAAS,KACT,eAAgB,OAChB,OAAQ,IACV,CAEA,CAAC,QACC,QAAS,KACT,OAAQ,IACR,MAAO,KACP,cAAe,IAAI,MAAM,OACzB,GAAG,KAAK,aACN,aAAc,IAAI,MAAM,MAC1B,CACF,CAEA,CAAC,SACC,QAAS,KACT,OAAQ,IACR,GAAG,KAAK,aACN,aAAc,IAAI,MAAM,OACxB,WAAY,UACd,CACA,WAAY,EAAI,IAAI,KAAK,IAC3B,CAEA,CAAC,cACC,IACE,eAAgB,IAClB,CACF,CAEA,CAAC,KACC,OAAQ,KACR,MAAO,KACP,aAAc,IAAI,MAAM,QACxB,WAAY,UACd,CAEA,CAAC,aACC,SAAU,SACV,IAAK,EACL,QAAS,KACT,OAAQ,KACR,MAAO,KACP,SAAU,MACZ,CAEA,CAAC,eACC,GAAG,YACD,aAAc,IAChB,CACF,CAEA,CAAC,WACC,WAAY,MACd","names":[]}
1
+ {"version":3,"sources":["../src/style.css","../src/components/style.css"],"sourcesContent":[".rows-header-wrapper {\r\n width: 100px;\r\n height: fit-content;\r\n border-right: 1px solid yellow;\r\n background-color: rgb(39, 36, 36);\r\n color: white;\r\n box-sizing: border-box;\r\n .row-header:not(:last-child) {\r\n border-bottom: 1px solid yellow;\r\n }\r\n box-shadow: 4px 0px 20px black;\r\n}\r\n\r\n.main-wrapper {\r\n position: relative;\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%;\r\n width: 100%;\r\n}\r\n\r\n.body-wrapper {\r\n display: flex;\r\n flex-direction: row;\r\n border-left: 1px solid black;\r\n border-bottom: 1px solid black;\r\n border-right: 1px solid black;\r\n width: 100%;\r\n overflow: auto;\r\n box-sizing: border-box;\r\n}\r\n\r\n.day-block {\r\n height: 100%;\r\n text-align: center;\r\n box-sizing: border-box;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n padding: 4px;\r\n}\r\n\r\n.hour-block {\r\n display: block;\r\n width: 100%;\r\n text-align: center;\r\n padding: 4px;\r\n overflow: hidden;\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n}\r\n",".content-wrapper {\r\n position: relative;\r\n display: flex;\r\n flex-direction: column;\r\n width: 100%;\r\n .row-content:not(:last-child) {\r\n border-bottom: 1px solid #e4dcdc;\r\n }\r\n}\r\n\r\n.row-header {\r\n display: flex;\r\n justify-content: center;\r\n align-items: center;\r\n width: 100px;\r\n transition: min-height 0.5s ease-in-out;\r\n box-sizing: border-box;\r\n}\r\n\r\n.row-content {\r\n position: relative;\r\n width: 100%;\r\n padding-top: 10px;\r\n padding-bottom: 10px;\r\n overflow: hidden;\r\n z-index: 0;\r\n transition: min-height 0.5s ease-in-out;\r\n box-sizing: border-box;\r\n}\r\n\r\n.event {\r\n position: absolute;\r\n height: 20px;\r\n border: 1px solid black;\r\n z-index: 1;\r\n transition: top 0.5s ease-in-out;\r\n box-sizing: border-box;\r\n display: flex;\r\n border-radius: 5px;\r\n box-shadow: inset 0px 0px 5px gray;\r\n}\r\n\r\n.event-content {\r\n width: 100%;\r\n height: 100%;\r\n}\r\n\r\n.static-event {\r\n position: absolute;\r\n background-color: #e0e0e0;\r\n z-index: 0;\r\n border: 1px solid transparent;\r\n box-sizing: border-box;\r\n border-radius: 5px;\r\n}\r\n\r\n.time-bar {\r\n display: flex;\r\n flex-direction: row;\r\n width: 100%;\r\n height: 50px;\r\n min-height: 50px;\r\n border: 1px solid yellow;\r\n background-color: rgb(39, 36, 36);\r\n color: white;\r\n box-sizing: border-box;\r\n}\r\n\r\n.empty-block {\r\n width: 100px;\r\n min-width: 100px;\r\n border-right: 1px solid yellow;\r\n box-sizing: border-box;\r\n}\r\n\r\n.time-content {\r\n display: flex;\r\n flex-direction: column;\r\n height: 100%;\r\n}\r\n\r\n.day-row {\r\n display: grid;\r\n height: 50%;\r\n width: auto;\r\n border-bottom: 1px solid yellow;\r\n div:not(:last-child) {\r\n border-right: 1px solid yellow;\r\n }\r\n}\r\n\r\n.hour-row {\r\n display: grid;\r\n height: 50%;\r\n div:not(:last-child) {\r\n border-right: 1px solid yellow;\r\n box-sizing: border-box;\r\n }\r\n box-shadow: 0px 4px 20px black;\r\n}\r\n\r\n.not-clickable {\r\n div {\r\n pointer-events: none;\r\n }\r\n}\r\n\r\n.line {\r\n height: 100%;\r\n width: 100%;\r\n border-right: 1px solid #e4dcdc;\r\n box-sizing: border-box;\r\n}\r\n\r\n.lines-canvas {\r\n position: absolute;\r\n top: 0;\r\n display: grid;\r\n height: 100%;\r\n width: 100%;\r\n overflow: hidden;\r\n}\r\n\r\n.hide-last-line {\r\n div:last-child {\r\n border-right: none;\r\n }\r\n}\r\n\r\n.row-hidden {\r\n visibility: hidden;\r\n}\r\n\r\n.rt-line {\r\n position: absolute;\r\n height: calc(100% - 24px);\r\n top: 24px;\r\n width: 2px;\r\n box-sizing: border-box;\r\n border-right: dotted 2px red;\r\n}\r\n\r\n.rt-arrow {\r\n position: absolute;\r\n top: 0px;\r\n width: 0;\r\n height: 0;\r\n border-left: 15px solid transparent;\r\n border-right: 15px solid transparent;\r\n\r\n border-top: 26px solid red;\r\n}\r\n"],"mappings":"AAAA,CAAC,oBACC,MAAO,MACP,OAAQ,YACR,aAAc,IAAI,MAAM,OACxB,iBAAkB,QAClB,MAAO,KACP,WAAY,WACZ,CAAC,UAAU,KAAK,aACd,cAAe,IAAI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,QAClB,MAAO,KACP,WAAY,UACd,CAEA,CAAC,YACC,MAAO,MACP,UAAW,MACX,aAAc,IAAI,MAAM,OACxB,WAAY,UACd,CAEA,CAAC,aACC,QAAS,KACT,eAAgB,OAChB,OAAQ,IACV,CAEA,CAAC,QACC,QAAS,KACT,OAAQ,IACR,MAAO,KACP,cAAe,IAAI,MAAM,OACzB,GAAG,KAAK,aACN,aAAc,IAAI,MAAM,MAC1B,CACF,CAEA,CAAC,SACC,QAAS,KACT,OAAQ,IACR,GAAG,KAAK,aACN,aAAc,IAAI,MAAM,OACxB,WAAY,UACd,CACA,WAAY,EAAI,IAAI,KAAK,IAC3B,CAEA,CAAC,cACC,IACE,eAAgB,IAClB,CACF,CAEA,CAAC,KACC,OAAQ,KACR,MAAO,KACP,aAAc,IAAI,MAAM,QACxB,WAAY,UACd,CAEA,CAAC,aACC,SAAU,SACV,IAAK,EACL,QAAS,KACT,OAAQ,KACR,MAAO,KACP,SAAU,MACZ,CAEA,CAAC,eACC,GAAG,YACD,aAAc,IAChB,CACF,CAEA,CAAC,WACC,WAAY,MACd,CAEA,CAAC,QACC,SAAU,SACV,OAAQ,KAAK,KAAK,EAAE,MACpB,IAAK,KACL,MAAO,IACP,WAAY,WACZ,aAAc,OAAO,IAAI,GAC3B,CAEA,CAAC,SACC,SAAU,SACV,IAAK,EACL,MAAO,EACP,OAAQ,EACR,YAAa,KAAK,MAAM,YACxB,aAAc,KAAK,MAAM,YAEzB,WAAY,KAAK,MAAM,GACzB","names":[]}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _react = require('react'); var _react2 = _interopRequireDefault(_react);var ge=o=>{let e=null;switch(o){case 0:e="Jan";break;case 1:e="Feb";break;case 2:e="Mar";break;case 3:e="Apr";break;case 4:e="May";break;case 5:e="Jun";break;case 6:e="Jul";break;case 7:e="Aug";break;case 8:e="Sep";break;case 9:e="Oct";break;case 10:e="Nov";break;case 11:e="Dec";break;default:e="Jan"}return e},J=ge;var fe=o=>{let e=null;switch(o){case 0:e="Mon";break;case 1:e="Tue";break;case 2:e="Wed";break;case 3:e="Thu";break;case 4:e="Fri";break;case 5:e="Sat";break;case 6:e="Sun";break;default:e="Mon"}return e},X=fe;var we=({windowTime:o,tick:e,contentWidth:r,blockWidth:i})=>{let{dayBlocks:t,hourBlocks:s}=_react.useMemo.call(void 0, ()=>{let c=o[0],d=[],h=[];if(e===null||r===null)return{dayBlocks:[],hourBlocks:[]};let l=r,a=1;for(;;){let u=new Date(c*1e3),f=new Date(u.getFullYear(),u.getMonth(),u.getDate(),23,59,59),p=(f.getTime()-u.getTime())/1e3/e;if(l-=p,Math.round(l)<0){let m=Math.round((p+l)/i);for(let w=0;w<m;w++)h.push(_react2.default.createElement("div",{className:"hour-block",key:`${u.getDate()}_hour_${w}`},w<10?`0${w}:00`:`${w}:00`));d.push(_react2.default.createElement("div",{className:"day-block",key:`${u.getDate()} ${u.getMonth()}`,style:{gridColumn:`${a} / ${a+m}`}},X(u.getDay())," ",u.getDate()," ",J(u.getMonth()))),a+=m;break}let g=Math.round(p/i);for(let m=24-g;m<24;m++)h.push(_react2.default.createElement("div",{className:"hour-block",key:`${u.getDate()}_hour_${m}`},m<10?`0${m}:00`:`${m}:00`));if(d.push(_react2.default.createElement("div",{className:"day-block",key:`${u.getDate()} ${u.getMonth()}`,style:{gridColumn:`${a} / ${a+g}`}},X(u.getDay())," ",u.getDate()," ",J(u.getMonth()))),a+=g,Math.round(l)===0)break;c=(f.getTime()+1e3)/1e3}return{dayBlocks:d,hourBlocks:h}},[e,o,r]);return{dayBlocks:t,hourBlocks:s}},q=we;var xe=({windowTime:o,contentWidth:e})=>{let r=_react.useMemo.call(void 0, ()=>(o[1]-o[0])/3600,[o]),i=e?e/r:0;return{numberOfHourBlocks:r,blockWidth:i}},I=xe;var Te=({windowTime:o,tick:e,contentWidth:r,scrollWidth:i,additionalClassNames:t})=>{let s=_react.useRef.call(void 0, null),{blockWidth:c}=I({windowTime:o,contentWidth:r}),{dayBlocks:d,hourBlocks:h}=q({windowTime:o,tick:e,contentWidth:r,blockWidth:c}),l=t!=null&&t.timeBar?"time-bar "+t.timeBar:"time-bar",a=t!=null&&t.dayRow?"day-row "+t.dayRow:"day-row",u=t!=null&&t.hourRow?"hour-row "+t.hourRow:"hour-row";return _react2.default.createElement("div",{className:l},_react2.default.createElement("div",{className:"empty-block"}),_react2.default.createElement("div",{className:"time-content",ref:s,style:{minWidth:r||0}},_react2.default.createElement("div",{className:a,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${c}px, 1fr))`}},d.map(f=>f)),_react2.default.createElement("div",{className:u,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${c}px, 1fr))`}},h.map(f=>f))),i?_react2.default.createElement("div",{style:{width:i,height:"100%",boxSizing:"border-box",borderLeft:"1px solid yellow"}}):null)},K=Te;var k=_react.createContext.call(void 0, null);var De=({name:o,id:e})=>{let r=_react.useContext.call(void 0, k),i=r&&r.rowsHeight&&r.rowsHeight[e]?r.rowsHeight[e].minHeight:40;return _react2.default.createElement("div",{className:"row-header",style:{minHeight:i}},o)},Q=De;var He=({rows:o,className:e})=>{let r=e?"rows-header-wrapper "+e:"rows-header-wrapper";return _react2.default.createElement("div",{className:r},o.map(i=>_react2.default.createElement(Q,{key:`row_header_${i.id}`,id:i.id,name:i.name})))},Z=He;var Me=({contentWidth:o,cellWidth:e,lineClassName:r})=>{let i=_react.useMemo.call(void 0, ()=>{let s=[],c=r?"line "+r:"line";if(o)for(let d=e;d<o;d=d+e)s.push(_react2.default.createElement("div",{key:`line_${d}`,className:c}));return s},[e,o]),t=_react.useMemo.call(void 0, ()=>o?o-i.length*e:0,[o,e,i]);return _react2.default.createElement("div",{className:t<1?"lines-canvas hide-last-line":"lines-canvas",style:t<1?{gridTemplateColumns:`repeat(auto-fill, minmax(${e}px, 1fr))`}:{gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, ${e}px))`}},i)},oe=Me;var Ce=({id:o,startPosition:e,width:r,top:i,height:t})=>_react2.default.createElement("div",{id:`static_event_${o}`,key:`static_event_${o}`,className:"static-event",onDrop:s=>s.stopPropagation(),style:{left:e,width:r,top:i,minHeight:t}}),re=Ce;var _immer = require('immer');var B=_react.createContext.call(void 0, {dragStarted:!1,setDragStarted:()=>{}});var N=_react.createContext.call(void 0, {});var Oe=(o,e)=>o.startTime-e.startTime<0||o.startTime===e.startTime&&o.endTime<e.endTime?-1:1,j=Oe;var _e=_react.forwardRef.call(void 0, (o,e)=>{let{setEvents:r,tick:i,id:t,windowTime:s,cellWidth:c,children:d}=o,{dragStarted:h,setDragStarted:l}=_react.useContext.call(void 0, B),{onDrop:a}=_react.useContext.call(void 0, N),u=_react.useCallback.call(void 0, p=>{p.preventDefault();let g=p.target,{left:m}=g.getBoundingClientRect(),w=p.dataTransfer.getData("eventId"),x=Math.round((p.clientX-m)/c),R=c*x;r(_immer.produce.call(void 0, H=>{let n=H.find(y=>y.id===w);if(n&&i){let y=s[0]+R*i,M=n.endTime-n.startTime,T=s[0]+M+R*i;a&&a({eventId:n.id,oldRowId:n.rowId,newRowId:o.id,startTime:y,endTime:T}),n.startTime=y,n.endTime=T,n.rowId=o.id}H.sort(j)})),l(!1)},[r,i,s,c]),f=_react.useContext.call(void 0, k),b=f&&f.rowsHeight&&f.rowsHeight[t]?f.rowsHeight[t].minHeight:40;return _react2.default.createElement("div",{id:`row_${t}`,ref:e,onDragOver:p=>p.preventDefault(),onDrop:u,className:h?"row-content not-clickable":"row-content","data-index":t,style:{minHeight:b}},d)}),ne=_e;var Ie=({id:o,startPosition:e,width:r,top:i,props:t})=>{let{setDragStarted:s}=_react.useContext.call(void 0, B),c=_react.useCallback.call(void 0, l=>{l.stopPropagation(),l.dataTransfer.setData("eventId",o),setTimeout(()=>s(!0),0);let a=l.target;a.style.opacity="50%"},[s]),d=_react.useCallback.call(void 0, l=>{l.stopPropagation(),s(!1);let a=l.target;a.style.opacity="100%"},[s]),h=t!=null&&t.classNames?"event "+t.classNames.join(" "):"event";return _react2.default.createElement("div",{id:`event_${o}`,key:`event_${o}`,className:h,draggable:!(t!=null&&t.isLocked),onDragStart:c,onDragEnd:d,onMouseDown:l=>l.stopPropagation(),onMouseMove:l=>l.stopPropagation(),onDrop:l=>l.stopPropagation(),style:{left:e,width:r,top:i,cursor:t!=null&&t.isLocked?"not-allowed":"pointer"}},_react2.default.createElement("div",{className:"event-content"},t!=null&&t.content?t.content:null))},le=Ie;var Fe=({bodyRef:o,rowsContentRef:e})=>{let r=_react.useCallback.call(void 0, t=>{t.forEach(s=>{s.isIntersecting?s.target.classList.remove("row-hidden"):s.target.classList.add("row-hidden")})},[]),i=new IntersectionObserver(r,{root:o.current});_react.useEffect.call(void 0, ()=>(e.current&&e.current.forEach(t=>{i.observe(t)}),()=>i.disconnect()),[i])},ae=Fe;var Ye=({rows:o,windowTime:e,tick:r,events:i,staticEvents:t,cellWidth:s,setEvents:c,bodyRef:d})=>{let h=_react.useContext.call(void 0, k),l=_react.useRef.call(void 0, null),a=_react.useRef.call(void 0, []),[u,f]=_react.useMemo.call(void 0, ()=>{let b=0;return[o.map((p,g)=>{let m=0,w=[],x=0,R=r?i.filter(n=>n.rowId===p.id).map(n=>{if(n.endTime>=e[0]&&n.startTime<=e[1]){let y=0,M=!0;for(let T=0;T<=m;T++)if(w&&w[T]&&w[T].endTime>n.startTime)y+=1;else{m>x&&(x=m),m=0,M=!1;break}return M&&(m=y),w[y]=n,_react2.default.createElement(le,{key:`event_${n.id}`,id:n.id,startPosition:(n.startTime-e[0])/r,width:(n.endTime-n.startTime)/r,top:10+22*y,props:n.props})}}):null;m>x&&(x=m),l.current===null?l.current={[p.id]:{minHeight:40+x*22}}:l.current[p.id]={minHeight:40+x*22},b+=40+x*22;let H=r&&t?t.filter(n=>n.rowId===p.id).map(n=>{if(n.endTime>=e[0]&&n.startTime<=e[1])return _react2.default.createElement(re,{key:`static_event_${n.id}`,id:n.id,startPosition:(n.startTime-e[0])/r,width:(n.endTime-n.startTime)/r,top:10,height:20+x*22})}):null;return _react2.default.createElement(_react2.default.Fragment,{key:`row_content_${p.id}`},_react2.default.createElement(ne,{id:p.id,ref:n=>{a.current&&a.current[g]&&n?a.current[g]=n:a.current&&n&&a.current.push(n)},setEvents:c,tick:r,windowTime:e,cellWidth:s},R,H))}),b]},[o,i,r,e,s]);return ae({rowsContentRef:a,bodyRef:d}),_react.useEffect.call(void 0, ()=>{h&&(h.setRowsHeight(l.current),h.setAllRowsHeight(f))},[u,f]),u},de=Ye;var Ve=_react.forwardRef.call(void 0, ({rows:o,events:e,staticEvents:r,setEvents:i,tick:t,windowTime:s,cellWidth:c,setWindowTime:d,contentWidth:h,setCellWidth:l,bodyRef:a,lineClassName:u},f)=>{let[b,p]=_react.useState.call(void 0, !1),g=_react.useRef.call(void 0, null),[m,w]=_react.useState.call(void 0, !1),{blockWidth:x}=I({windowTime:s,contentWidth:h}),R=_react.useContext.call(void 0, k),H=_react.useCallback.call(void 0, v=>{if(v.preventDefault(),!b)return;let E=v.target,{left:L}=E.getBoundingClientRect(),S=v.clientX-L,_=t?Math.floor(t*x):0;g.current&&g.current-S>=x?(g.current=S,d(z=>[z[0]+_,z[1]+_])):g.current&&S-g.current>=x&&(g.current=S,d(z=>[z[0]-_,z[1]-_]))},[x,d,b]),n=_react.useCallback.call(void 0, v=>{p(!0),v.button===1&&v.preventDefault();let E=v.target,{left:L}=E.getBoundingClientRect();g.current=v.clientX-L},[p]),y=_react.useCallback.call(void 0, ()=>{p(!1)},[p]),M=_react.useCallback.call(void 0, ()=>p(!1),[p]),T=de({rows:o,windowTime:s,tick:t,events:e,staticEvents:r,cellWidth:c,setEvents:i,bodyRef:a}),G=_react.useCallback.call(void 0, v=>{v.preventDefault(),v.button===1&&w(E=>!E)},[]),D=_react.useCallback.call(void 0, v=>{let E=t?900/t:0;m&&l(L=>{let S=v.deltaY>0?L+E:L-E;return S<E||S>E*12?L:S})},[m,c,t]);return _react.useEffect.call(void 0, ()=>{a.current&&(a.current.style.overflow=m?"hidden":"auto")},[m]),_react2.default.createElement("div",{key:"content",ref:f,className:"content-wrapper",onMouseDown:n,onMouseUp:y,onMouseMove:H,onMouseLeave:M,onAuxClick:G,onWheel:D,style:{cursor:b?"grabbing":"grab",height:R==null?void 0:R.allRowsHeight}},_react2.default.createElement(oe,{contentWidth:h,cellWidth:c,lineClassName:u}),T)}),pe=Ve;var ot=({windowTime:o,setTick:e,setCellWidth:r,contentRef:i})=>{let t=_react.useRef.call(void 0, 0),s=_react.useMemo.call(void 0, ()=>new ResizeObserver(c=>{var d;for(let h of c){let l=(d=h.borderBoxSize)==null?void 0:d[0].inlineSize;if(typeof l=="number"&&l!==t.current){t.current=l;let a=o[1]-o[0],u=a/3600;e(a/h.contentRect.width),r(h.contentRect.width/u)}}}),[o]);_react.useEffect.call(void 0, ()=>(i.current&&s.observe(i.current,{box:"border-box"}),()=>s.disconnect()),[s])},he=ot;var Lo=({rows:o,events:e,staticEvents:r,onDrop:i,startDate:t,endDate:s,additionalClassNames:c})=>{let[d,h]=_react.useState.call(void 0, [new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),0,0).getTime()/1e3,new Date(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),0,0).getTime()/1e3]),[l,a]=_react.useState.call(void 0, 0),[u,f]=_react.useState.call(void 0, []),b=_react.useRef.call(void 0, null),p=_react.useRef.call(void 0, null),g=_react.useRef.call(void 0, null),[m,w]=_react.useState.call(void 0, null),[x,R]=_react.useState.call(void 0, 0),[H,n]=_react.useState.call(void 0, null),[y,M]=_react.useState.call(void 0, 0);_react.useEffect.call(void 0, ()=>{if(b.current){let D=d[1]-d[0],v=D/3600;w(D/b.current.getBoundingClientRect().width),a(b.current.getBoundingClientRect().width/v)}},[]),_react.useEffect.call(void 0, ()=>{g.current&&R(g.current.getBoundingClientRect().width-g.current.scrollWidth)},[]),_react.useEffect.call(void 0, ()=>{f(e.sort(j))},[e]);let[T,G]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{let D=null;o.forEach(v=>{D===null?D={[v.id]:{minHeight:40}}:D[v.id]={minHeight:40}}),n(D)},[o]),he({contentRef:b,setCellWidth:a,setTick:w,windowTime:d}),_react2.default.createElement("div",{className:"main-wrapper",ref:p},_react2.default.createElement(K,{windowTime:d,tick:m,contentWidth:b.current?b.current.getBoundingClientRect().width:null,scrollWidth:x}),_react2.default.createElement("div",{className:"body-wrapper",ref:g},_react2.default.createElement(k.Provider,{value:{rowsHeight:H,setRowsHeight:n,allRowsHeight:y,setAllRowsHeight:M}},_react2.default.createElement(Z,{rows:o,className:c==null?void 0:c.rowsHeader}),_react2.default.createElement(B.Provider,{value:{dragStarted:T,setDragStarted:G}},_react2.default.createElement(N.Provider,{value:{onDrop:i}},_react2.default.createElement(pe,{events:u,staticEvents:r,rows:o,setEvents:f,tick:m,windowTime:d,cellWidth:l,setWindowTime:h,ref:b,setCellWidth:a,contentWidth:b.current?b.current.getBoundingClientRect().width:null,bodyRef:g,lineClassName:c==null?void 0:c.gridLine}))))))};exports.Timeline = Lo;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var st=Object.defineProperty;var Ee=Object.getOwnPropertySymbols;var at=Object.prototype.hasOwnProperty,ct=Object.prototype.propertyIsEnumerable;var Te=(e,t,r)=>t in e?st(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,De=(e,t)=>{for(var r in t||(t={}))at.call(t,r)&&Te(e,r,t[r]);if(Ee)for(var r of Ee(t))ct.call(t,r)&&Te(e,r,t[r]);return e};var _react = require('react'); var _react2 = _interopRequireDefault(_react);var lt=e=>{let t=null;switch(e){case 0:t="Jan";break;case 1:t="Feb";break;case 2:t="Mar";break;case 3:t="Apr";break;case 4:t="May";break;case 5:t="Jun";break;case 6:t="Jul";break;case 7:t="Aug";break;case 8:t="Sep";break;case 9:t="Oct";break;case 10:t="Nov";break;case 11:t="Dec";break;default:t="Jan"}return t},le=lt;var ut=e=>{let t=null;switch(e){case 0:t="Mon";break;case 1:t="Tue";break;case 2:t="Wed";break;case 3:t="Thu";break;case 4:t="Fri";break;case 5:t="Sat";break;case 6:t="Sun";break;default:t="Mon"}return t},ue=ut;var dt=({windowTime:e,tick:t,contentWidth:r,blockWidth:n})=>{let{dayBlocks:o,hourBlocks:i}=_react.useMemo.call(void 0, ()=>{let s=e[0],a=[],l=[];if(t===null||r===null)return{dayBlocks:[],hourBlocks:[]};let u=r,d=1;for(;;){let p=new Date(s*1e3),y=new Date(p.getFullYear(),p.getMonth(),p.getDate(),23,59,59),f=(y.getTime()-p.getTime())/1e3/t;if(u-=f,Math.round(u)<0){let m=Math.round((f+u)/n);for(let g=0;g<m;g++)l.push(_react2.default.createElement("div",{className:"hour-block",key:`${p.getDate()}_hour_${g}`},g<10?`0${g}:00`:`${g}:00`));a.push(_react2.default.createElement("div",{className:"day-block",key:`${p.getDate()} ${p.getMonth()}`,style:{gridColumn:`${d} / ${d+m}`}},ue(p.getDay())," ",p.getDate()," ",le(p.getMonth()))),d+=m;break}let b=Math.round(f/n);for(let m=24-b;m<24;m++)l.push(_react2.default.createElement("div",{className:"hour-block",key:`${p.getDate()}_hour_${m}`},m<10?`0${m}:00`:`${m}:00`));if(a.push(_react2.default.createElement("div",{className:"day-block",key:`${p.getDate()} ${p.getMonth()}`,style:{gridColumn:`${d} / ${d+b}`}},ue(p.getDay())," ",p.getDate()," ",le(p.getMonth()))),d+=b,Math.round(u)===0)break;s=(y.getTime()+1e3)/1e3}return{dayBlocks:a,hourBlocks:l}},[t,e,r]);return{dayBlocks:o,hourBlocks:i}},Re=dt;var mt=({windowTime:e,contentWidth:t})=>{let r=_react.useMemo.call(void 0, ()=>(e[1]-e[0])/3600,[e]),n=t?t/r:0;return{numberOfHourBlocks:r,blockWidth:n}},V=mt;var gt=({windowTime:e,tick:t,contentWidth:r,scrollWidth:n,additionalClassNames:o})=>{let i=_react.useRef.call(void 0, null),{blockWidth:s}=V({windowTime:e,contentWidth:r}),{dayBlocks:a,hourBlocks:l}=Re({windowTime:e,tick:t,contentWidth:r,blockWidth:s}),u=o!=null&&o.timeBar?"time-bar "+o.timeBar:"time-bar",d=o!=null&&o.dayRow?"day-row "+o.dayRow:"day-row",p=o!=null&&o.hourRow?"hour-row "+o.hourRow:"hour-row";return _react2.default.createElement("div",{className:u},_react2.default.createElement("div",{className:"empty-block"}),_react2.default.createElement("div",{className:"time-content",ref:i,style:{minWidth:r||0}},_react2.default.createElement("div",{className:d,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${s}px, 1fr))`}},a.map(y=>y)),_react2.default.createElement("div",{className:p,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${s}px, 1fr))`}},l.map(y=>y))),n?_react2.default.createElement("div",{style:{width:n,height:"100%",boxSizing:"border-box",borderLeft:"1px solid yellow"}}):null)},Se=gt;var P=_react.createContext.call(void 0, null);var wt=({name:e,id:t})=>{let r=_react.useContext.call(void 0, P),n=r&&r.rowsHeight&&r.rowsHeight[t]?r.rowsHeight[t].minHeight:40;return _react2.default.createElement("div",{className:"row-header",style:{minHeight:n}},e)},Pe=wt;var vt=({rows:e,className:t})=>{let r=t?"rows-header-wrapper "+t:"rows-header-wrapper";return _react2.default.createElement("div",{className:r},e.map(n=>_react2.default.createElement(Pe,{key:`row_header_${n.id}`,id:n.id,name:n.name})))},ke=vt;var xt=({contentWidth:e,cellWidth:t,lineClassName:r})=>{let n=_react.useMemo.call(void 0, ()=>{let i=[],s=r?"line "+r:"line";if(e)for(let a=t;a<e;a=a+t)i.push(_react2.default.createElement("div",{key:`line_${a}`,className:s}));return i},[t,e]),o=_react.useMemo.call(void 0, ()=>e?e-n.length*t:0,[e,t,n]);return _react2.default.createElement("div",{className:o<1?"lines-canvas hide-last-line":"lines-canvas",style:o<1?{gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, 1fr))`}:{gridTemplateColumns:`repeat(auto-fill, minmax(${o}px, ${t}px))`}},n)},Oe=xt;var Tt=({id:e,startPosition:t,width:r,top:n,height:o})=>_react2.default.createElement("div",{id:`static_event_${e}`,key:`static_event_${e}`,className:"static-event",onDrop:i=>i.stopPropagation(),style:{left:t,width:r,top:n,minHeight:o}}),ze=Tt;var Fe=Symbol.for("immer-nothing"),Ae=Symbol.for("immer-draftable"),E=Symbol.for("immer-state"),Dt=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function x(e,...t){if(process.env.NODE_ENV!=="production"){let r=Dt[e],n=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var L=Object.getPrototypeOf;function F(e){return!!e&&!!e[E]}function N(e){var t;return e?Be(e)||Array.isArray(e)||!!e[Ae]||!!((t=e.constructor)!=null&&t[Ae])||te(e)||re(e):!1}var Rt=Object.prototype.constructor.toString();function Be(e){if(!e||typeof e!="object")return!1;let t=L(e);if(t===null)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===Rt}function q(e,t){ee(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function ee(e){let t=e[E];return t?t.type_:Array.isArray(e)?1:te(e)?2:re(e)?3:0}function pe(e,t){return ee(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function We(e,t,r){let n=ee(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function St(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function te(e){return e instanceof Map}function re(e){return e instanceof Set}function A(e){return e.copy_||e.base_}function me(e,t){if(te(e))return new Map(e);if(re(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=Be(e);if(t===!0||t==="class_only"&&!r){let n=Object.getOwnPropertyDescriptors(e);delete n[E];let o=Reflect.ownKeys(n);for(let i=0;i<o.length;i++){let s=o[i],a=n[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(n[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(L(e),n)}else{let n=L(e);if(n!==null&&r)return De({},e);let o=Object.create(n);return Object.assign(o,e)}}function _e(e,t=!1){return ne(e)||F(e)||!N(e)||(ee(e)>1&&(e.set=e.add=e.clear=e.delete=Pt),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>_e(n,!0))),e}function Pt(){x(2)}function ne(e){return Object.isFrozen(e)}var Mt={};function I(e){let t=Mt[e];return t||x(0,e),t}var U;function Ge(){return U}function kt(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ne(e,t){t&&(I("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function he(e){ge(e),e.drafts_.forEach(Ct),e.drafts_=null}function ge(e){e===U&&(U=e.parent_)}function Ie(e){return U=kt(U,e)}function Ct(e){let t=e[E];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function $e(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[E].modified_&&(he(t),x(4)),N(e)&&(e=Q(t,e),t.parent_||Z(t,e)),t.patches_&&I("Patches").generateReplacementPatches_(r[E].base_,e,t.patches_,t.inversePatches_)):e=Q(t,r,[]),he(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Fe?e:void 0}function Q(e,t,r){if(ne(t))return t;let n=t[E];if(!n)return q(t,(o,i)=>Le(e,n,t,o,i,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return Z(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;let o=n.copy_,i=o,s=!1;n.type_===3&&(i=new Set(o),o.clear(),s=!0),q(i,(a,l)=>Le(e,n,o,a,l,r,s)),Z(e,o,!1),r&&e.patches_&&I("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function Le(e,t,r,n,o,i,s){if(process.env.NODE_ENV!=="production"&&o===r&&x(5),F(o)){let a=i&&t&&t.type_!==3&&!pe(t.assigned_,n)?i.concat(n):void 0,l=Q(e,o,a);if(We(r,n,l),F(l))e.canAutoFreeze_=!1;else return}else s&&r.add(o);if(N(o)&&!ne(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Q(e,o),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&Z(e,o)}}function Z(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&_e(t,r)}function Ht(e,t){let r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:Ge(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},o=n,i=we;r&&(o=[n],i=X);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,a}var we={get(e,t){if(t===E)return e;let r=A(e);if(!pe(r,t))return Ot(e,r,t);let n=r[t];return e.finalized_||!N(n)?n:n===fe(e.base_,t)?(de(e),e.copy_[t]=be(n,e)):n},has(e,t){return t in A(e)},ownKeys(e){return Reflect.ownKeys(A(e))},set(e,t,r){let n=Je(A(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=fe(A(e),t),i=o==null?void 0:o[E];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(St(r,o)&&(r!==void 0||pe(e.base_,t)))return!0;de(e),ye(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return fe(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,de(e),ye(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=A(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){x(11)},getPrototypeOf(e){return L(e.base_)},setPrototypeOf(){x(12)}},X={};q(we,(e,t)=>{X[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});X.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&x(13),X.set.call(this,e,t,void 0)};X.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&x(14),we.set.call(this,e[0],t,r,e[0])};function fe(e,t){let r=e[E];return(r?A(r):e)[t]}function Ot(e,t,r){var o;let n=Je(t,r);return n?"value"in n?n.value:(o=n.get)==null?void 0:o.call(e.draft_):void 0}function Je(e,t){if(!(t in e))return;let r=L(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=L(r)}}function ye(e){e.modified_||(e.modified_=!0,e.parent_&&ye(e.parent_))}function de(e){e.copy_||(e.copy_=me(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var zt=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){let i=r;r=t;let s=this;return function(l=i,...u){return s.produce(l,d=>r.call(this,d,...u))}}typeof r!="function"&&x(6),n!==void 0&&typeof n!="function"&&x(7);let o;if(N(t)){let i=Ie(this),s=be(t,void 0),a=!0;try{o=r(s),a=!1}finally{a?he(i):ge(i)}return Ne(i,n),$e(o,i)}else if(!t||typeof t!="object"){if(o=r(t),o===void 0&&(o=t),o===Fe&&(o=void 0),this.autoFreeze_&&_e(o,!0),n){let i=[],s=[];I("Patches").generateReplacementPatches_(t,o,i,s),n(i,s)}return o}else x(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,l=>t(l,...a));let n,o;return[this.produce(t,r,(s,a)=>{n=s,o=a}),n,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){N(e)||x(8),F(e)&&(e=At(e));let t=Ie(this),r=be(e,void 0);return r[E].isManual_=!0,ge(t),r}finishDraft(e,t){let r=e&&e[E];(!r||!r.isManual_)&&x(9);let{scope_:n}=r;return Ne(n,t),$e(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));let n=I("Patches").applyPatches_;return F(e)?n(e,t):this.produce(e,o=>n(o,t))}};function be(e,t){let r=te(e)?I("MapSet").proxyMap_(e,t):re(e)?I("MapSet").proxySet_(e,t):Ht(e,t);return(t?t.scope_:Ge()).drafts_.push(r),r}function At(e){return F(e)||x(10,e),Ue(e)}function Ue(e){if(!N(e)||ne(e))return e;let t=e[E],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=me(e,t.scope_.immer_.useStrictShallowCopy_)}else r=me(e,!0);return q(r,(n,o)=>{We(r,n,Ue(o))}),t&&(t.finalized_=!1),r}var T=new zt,Xe=T.produce,Ur=T.produceWithPatches.bind(T),Xr=T.setAutoFreeze.bind(T),jr=T.setUseStrictShallowCopy.bind(T),Yr=T.applyPatches.bind(T),Kr=T.createDraft.bind(T),Vr=T.finishDraft.bind(T);var B=_react.createContext.call(void 0, {dragStarted:!1,setDragStarted:()=>{}});var oe=_react.createContext.call(void 0, {});var $t=(e,t)=>e.startTime-t.startTime<0||e.startTime===t.startTime&&e.endTime<t.endTime?-1:1,ie=$t;var Wt=_react.forwardRef.call(void 0, (e,t)=>{let{setEvents:r,tick:n,id:o,windowTime:i,cellWidth:s,children:a}=e,{dragStarted:l,setDragStarted:u}=_react.useContext.call(void 0, B),{onDrop:d}=_react.useContext.call(void 0, oe),p=_react.useCallback.call(void 0, f=>{f.preventDefault();let b=f.target,{left:m}=b.getBoundingClientRect(),g=f.dataTransfer.getData("eventId"),_=Math.round((f.clientX-m)/s),S=s*_;r(Xe(k=>{let c=k.find(v=>v.id===g);if(c&&n){let v=i[0]+S*n,C=c.endTime-c.startTime,R=i[0]+C+S*n;d&&d({eventId:c.id,oldRowId:c.rowId,newRowId:e.id,startTime:v,endTime:R}),c.startTime=v,c.endTime=R,c.rowId=e.id}k.sort(ie)})),u(!1)},[r,n,i,s]),y=_react.useContext.call(void 0, P),D=y&&y.rowsHeight&&y.rowsHeight[o]?y.rowsHeight[o].minHeight:40;return _react2.default.createElement("div",{id:`row_${o}`,ref:t,onDragOver:f=>f.preventDefault(),onDrop:p,className:l?"row-content not-clickable":"row-content","data-index":o,style:{minHeight:D}},a)}),je=Wt;var Jt=({id:e,startPosition:t,width:r,top:n,props:o})=>{let{setDragStarted:i}=_react.useContext.call(void 0, B),s=_react.useCallback.call(void 0, u=>{u.stopPropagation(),u.dataTransfer.setData("eventId",e),setTimeout(()=>i(!0),0);let d=u.target;d.style.opacity="50%"},[i]),a=_react.useCallback.call(void 0, u=>{u.stopPropagation(),i(!1);let d=u.target;d.style.opacity="100%"},[i]),l=o!=null&&o.classNames?"event "+o.classNames.join(" "):"event";return _react2.default.createElement("div",{id:`event_${e}`,key:`event_${e}`,className:l,draggable:!(o!=null&&o.isLocked),onDragStart:s,onDragEnd:a,onMouseDown:u=>u.stopPropagation(),onMouseMove:u=>u.stopPropagation(),onDrop:u=>u.stopPropagation(),style:{left:t,width:r,top:n,cursor:o!=null&&o.isLocked?"not-allowed":"pointer"}},_react2.default.createElement("div",{className:"event-content"},o!=null&&o.content?o.content:null))},Ve=Jt;var jt=({bodyRef:e,rowsContentRef:t})=>{let r=_react.useCallback.call(void 0, o=>{o.forEach(i=>{i.isIntersecting?i.target.classList.remove("row-hidden"):i.target.classList.add("row-hidden")})},[]),n=new IntersectionObserver(r,{root:e.current});_react.useEffect.call(void 0, ()=>(t.current&&t.current.forEach(o=>{n.observe(o)}),()=>n.disconnect()),[n])},qe=jt;var qt=({rows:e,windowTime:t,tick:r,events:n,staticEvents:o,cellWidth:i,setEvents:s,bodyRef:a})=>{let l=_react.useContext.call(void 0, P),u=_react.useRef.call(void 0, null),d=_react.useRef.call(void 0, []),[p,y]=_react.useMemo.call(void 0, ()=>{let D=0;return[e.map((f,b)=>{let m=0,g=[],_=0,S=r?n.filter(c=>c.rowId===f.id).map(c=>{if(c.endTime>=t[0]&&c.startTime<=t[1]){let v=0,C=!0;for(let R=0;R<=m;R++)if(g&&g[R]&&g[R].endTime>c.startTime)v+=1;else{m>_&&(_=m),m=0,C=!1;break}return C&&(m=v),g[v]=c,_react2.default.createElement(Ve,{key:`event_${c.id}`,id:c.id,startPosition:(c.startTime-t[0])/r,width:(c.endTime-c.startTime)/r,top:10+22*v,props:c.props})}}):null;m>_&&(_=m),u.current===null?u.current={[f.id]:{minHeight:40+_*22}}:u.current[f.id]={minHeight:40+_*22},D+=40+_*22;let k=r&&o?o.filter(c=>c.rowId===f.id).map(c=>{if(c.endTime>=t[0]&&c.startTime<=t[1])return _react2.default.createElement(ze,{key:`static_event_${c.id}`,id:c.id,startPosition:(c.startTime-t[0])/r,width:(c.endTime-c.startTime)/r,top:10,height:20+_*22})}):null;return _react2.default.createElement(_react2.default.Fragment,{key:`row_content_${f.id}`},_react2.default.createElement(je,{id:f.id,ref:c=>{d.current&&d.current[b]&&c?d.current[b]=c:d.current&&c&&d.current.push(c)},setEvents:s,tick:r,windowTime:t,cellWidth:i},S,k))}),D]},[e,n,r,t,i]);return qe({rowsContentRef:d,bodyRef:a}),_react.useEffect.call(void 0, ()=>{l&&(l.setRowsHeight(u.current),l.setAllRowsHeight(y))},[p,y]),p},Ze=qt;var rr=_react.forwardRef.call(void 0, ({rows:e,events:t,staticEvents:r,setEvents:n,tick:o,windowTime:i,cellWidth:s,setWindowTime:a,contentWidth:l,setCellWidth:u,bodyRef:d,lineClassName:p},y)=>{let[D,f]=_react.useState.call(void 0, !1),b=_react.useRef.call(void 0, null),[m,g]=_react.useState.call(void 0, !1),{blockWidth:_}=V({windowTime:i,contentWidth:l}),S=_react.useContext.call(void 0, P),k=_react.useCallback.call(void 0, h=>{if(h.preventDefault(),!D)return;let w=h.target,{left:z}=w.getBoundingClientRect(),H=h.clientX-z,Y=o?Math.floor(o*_):0;b.current&&b.current-H>=_?(b.current=H,a(J=>[J[0]+Y,J[1]+Y])):b.current&&H-b.current>=_&&(b.current=H,a(J=>[J[0]-Y,J[1]-Y]))},[_,a,D]),c=_react.useCallback.call(void 0, h=>{f(!0),h.button===1&&h.preventDefault();let w=h.target,{left:z}=w.getBoundingClientRect();b.current=h.clientX-z},[f]),v=_react.useCallback.call(void 0, ()=>{f(!1)},[f]),C=_react.useCallback.call(void 0, ()=>f(!1),[f]),R=Ze({rows:e,windowTime:i,tick:o,events:t,staticEvents:r,cellWidth:s,setEvents:n,bodyRef:d}),ae=_react.useCallback.call(void 0, h=>{h.preventDefault(),h.button===1&&g(w=>!w)},[]),ce=_react.useCallback.call(void 0, h=>{let w=o?900/o:0;m&&u(z=>{let H=h.deltaY>0?z+w:z-w;return H<w||H>w*12?z:H})},[m,s,o]);return _react.useEffect.call(void 0, ()=>{d.current&&(d.current.style.overflow=m?"hidden":"auto")},[m]),_react2.default.createElement("div",{key:"content",ref:y,className:"content-wrapper",onMouseDown:c,onMouseUp:v,onMouseMove:k,onMouseLeave:C,onAuxClick:ae,onWheel:ce,style:{cursor:D?"grabbing":"grab",height:S==null?void 0:S.allRowsHeight}},_react2.default.createElement(Oe,{contentWidth:l,cellWidth:s,lineClassName:p}),R)}),rt=rr;var sr=({windowTime:e,setTick:t,setCellWidth:r,contentRef:n})=>{let o=_react.useRef.call(void 0, 0),i=_react.useMemo.call(void 0, ()=>new ResizeObserver(s=>{var a;for(let l of s){let u=(a=l.borderBoxSize)==null?void 0:a[0].inlineSize;if(typeof u=="number"&&u!==o.current){o.current=u;let d=e[1]-e[0],p=d/3600;t(d/l.contentRect.width),r(l.contentRect.width/p)}}}),[e]);_react.useEffect.call(void 0, ()=>(n.current&&i.observe(n.current,{box:"border-box"}),()=>i.disconnect()),[i])},nt=sr;var lr=({tick:e,windowTime:t})=>{let[r,n]=_react.useState.call(void 0, new Date().getTime()/1e3),[o,i]=_react.useState.call(void 0, 0),s=_react.useRef.call(void 0, null);return _react.useEffect.call(void 0, ()=>{if(e){let a=r-t[0];i(Math.round(a/e)),s.current!==null&&clearInterval(s.current);let l=setInterval(()=>{n(new Date().getTime()/1e3)},e*1e3);s.current=l}},[e,t,r]),_react2.default.createElement(_react2.default.Fragment,null,t[0]<=r&&r<=t[1]&&_react2.default.createElement(_react2.default.Fragment,null,_react2.default.createElement("div",{className:"rt-arrow",style:{left:86+o}}),_react2.default.createElement("div",{className:"rt-line",style:{left:100+o}})))},it=lr;var Qn=({rows:e,events:t,staticEvents:r,onDrop:n,startDate:o,endDate:i,additionalClassNames:s,showRTIndicator:a=!0})=>{let[l,u]=_react.useState.call(void 0, [new Date(o.getFullYear(),o.getMonth(),o.getDate(),o.getHours(),0,0).getTime()/1e3,new Date(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),0,0).getTime()/1e3]),[d,p]=_react.useState.call(void 0, 0),[y,D]=_react.useState.call(void 0, []),f=_react.useRef.call(void 0, null),b=_react.useRef.call(void 0, null),m=_react.useRef.call(void 0, null),[g,_]=_react.useState.call(void 0, null),[S,k]=_react.useState.call(void 0, 0),[c,v]=_react.useState.call(void 0, null),[C,R]=_react.useState.call(void 0, 0);_react.useEffect.call(void 0, ()=>{if(f.current){let h=l[1]-l[0],w=h/3600;_(h/f.current.getBoundingClientRect().width),p(f.current.getBoundingClientRect().width/w)}},[]),_react.useEffect.call(void 0, ()=>{m.current&&k(m.current.getBoundingClientRect().width-m.current.scrollWidth)},[]),_react.useEffect.call(void 0, ()=>{D(t.sort(ie))},[t]);let[ae,ce]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{let h=null;e.forEach(w=>{h===null?h={[w.id]:{minHeight:40}}:h[w.id]={minHeight:40}}),v(h)},[e]),nt({contentRef:f,setCellWidth:p,setTick:_,windowTime:l}),_react2.default.createElement("div",{className:"main-wrapper",ref:b},a&&_react2.default.createElement(it,{tick:g,windowTime:l}),_react2.default.createElement(Se,{windowTime:l,tick:g,contentWidth:f.current?f.current.getBoundingClientRect().width:null,scrollWidth:S}),_react2.default.createElement("div",{className:"body-wrapper",ref:m},_react2.default.createElement(P.Provider,{value:{rowsHeight:c,setRowsHeight:v,allRowsHeight:C,setAllRowsHeight:R}},_react2.default.createElement(ke,{rows:e,className:s==null?void 0:s.rowsHeader}),_react2.default.createElement(B.Provider,{value:{dragStarted:ae,setDragStarted:ce}},_react2.default.createElement(oe.Provider,{value:{onDrop:n}},_react2.default.createElement(rt,{events:y,staticEvents:r,rows:e,setEvents:D,tick:g,windowTime:l,cellWidth:d,setWindowTime:u,ref:f,setCellWidth:p,contentWidth:f.current?f.current.getBoundingClientRect().width:null,bodyRef:m,lineClassName:s==null?void 0:s.gridLine}))))))};exports.Timeline = Qn;
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["c:\\awesome-timeline-react\\dist\\index.js"],"names":[],"mappings":"AAAA,qPAA8D,IAA8F,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CA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W,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,eAAC,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAA","file":"C:\\awesome-timeline-react\\dist\\index.js","sourcesContent":[null]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awesome-timeline-react",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "awesome timeline for react applications",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -43,6 +43,7 @@
43
43
  "eslint": "^8.57.0",
44
44
  "eslint-plugin-react": "^7.34.1",
45
45
  "globals": "^15.1.0",
46
+ "immer": "^10.1.1",
46
47
  "jest": "^29.7.0",
47
48
  "react": "^18.3.1",
48
49
  "react-dom": "^18.3.1",
@@ -52,9 +53,6 @@
52
53
  "typescript": "^5.4.5",
53
54
  "typescript-eslint": "^7.8.0"
54
55
  },
55
- "dependencies": {
56
- "immer": "^10.1.1"
57
- },
58
56
  "peerDependencies": {
59
57
  "react": "^18",
60
58
  "react-dom": "^18"