awesome-timeline-react 0.1.6 → 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 +11 -2
- package/dist/_tsup-dts-rollup.d.ts +20 -10
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
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.
|
|
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
|

|
|
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:
|
|
@@ -49,12 +55,15 @@ The following properties for Timeline component are available:
|
|
|
49
55
|
- `endDate`: `number` (timestamp in seconds)
|
|
50
56
|
|
|
51
57
|
- `additionalClassNames` – contains additional class names that will be included within elements:
|
|
58
|
+
|
|
52
59
|
- `timeBar`: `string`
|
|
53
60
|
- `dayRow`: `string`
|
|
54
61
|
- `hourRow`: `string`
|
|
55
62
|
- `line`: `string`
|
|
56
63
|
- `rowsHeader`: `string`
|
|
57
64
|
|
|
65
|
+
- `showRTIndicator` – property that controls wheter Real Time Indicator will be show (default as true)
|
|
66
|
+
|
|
58
67
|
## Awesome Features
|
|
59
68
|
|
|
60
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.
|
|
@@ -66,7 +75,7 @@ One of the awesome features (currently hidden from the interface) is adjusting t
|
|
|
66
75
|
Here, we will store major features planned for future releases (from highest to lowest priority):
|
|
67
76
|
|
|
68
77
|
1. Resize events
|
|
69
|
-
2. Real time line
|
|
78
|
+
2. ~~Real time line~~ - published in 0.1.7 version
|
|
70
79
|
3. Customizable prompts after hovering over an event
|
|
71
80
|
4. Customizable second row of the time bar
|
|
72
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: (
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 */
|
package/dist/index.css.map
CHANGED
|
@@ -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,
|
|
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,MAAM,MAC3B,CACA,WAAY,IAAI,EAAI,KAAK,IAC3B,CAEA,CAAC,aACC,SAAU,SACV,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,OAtCf,QAuCW,GACX,CAEA,CAAC,WACC,QAAS,MACT,MAAO,KACP,WAAY,OA7Cd,QA8CW,IACT,SAAU,OACV,cAAe,SACf,YAAa,MACf,CClDA,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,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 nt=Object.defineProperty;var xe=Object.getOwnPropertySymbols;var ot=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable;var Ee=(e,t,r)=>t in e?nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Te=(e,t)=>{for(var r in t||(t={}))ot.call(t,r)&&Ee(e,r,t[r]);if(xe)for(var r of xe(t))it.call(t,r)&&Ee(e,r,t[r]);return e};var _react = require('react'); var _react2 = _interopRequireDefault(_react);var st=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},ce=st;var at=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},le=at;var lt=({windowTime:e,tick:t,contentWidth:r,blockWidth:n})=>{let{dayBlocks:o,hourBlocks:i}=_react.useMemo.call(void 0, ()=>{let s=e[0],a=[],f=[];if(t===null||r===null)return{dayBlocks:[],hourBlocks:[]};let l=r,u=1;for(;;){let d=new Date(s*1e3),g=new Date(d.getFullYear(),d.getMonth(),d.getDate(),23,59,59),m=(g.getTime()-d.getTime())/1e3/t;if(l-=m,Math.round(l)<0){let p=Math.round((m+l)/n);for(let b=0;b<p;b++)f.push(_react2.default.createElement("div",{className:"hour-block",key:`${d.getDate()}_hour_${b}`},b<10?`0${b}:00`:`${b}:00`));a.push(_react2.default.createElement("div",{className:"day-block",key:`${d.getDate()} ${d.getMonth()}`,style:{gridColumn:`${u} / ${u+p}`}},le(d.getDay())," ",d.getDate()," ",ce(d.getMonth()))),u+=p;break}let h=Math.round(m/n);for(let p=24-h;p<24;p++)f.push(_react2.default.createElement("div",{className:"hour-block",key:`${d.getDate()}_hour_${p}`},p<10?`0${p}:00`:`${p}:00`));if(a.push(_react2.default.createElement("div",{className:"day-block",key:`${d.getDate()} ${d.getMonth()}`,style:{gridColumn:`${u} / ${u+h}`}},le(d.getDay())," ",d.getDate()," ",ce(d.getMonth()))),u+=h,Math.round(l)===0)break;s=(g.getTime()+1e3)/1e3}return{dayBlocks:a,hourBlocks:f}},[t,e,r]);return{dayBlocks:o,hourBlocks:i}},De=lt;var ft=({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=ft;var pt=({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:f}=De({windowTime:e,tick:t,contentWidth:r,blockWidth:s}),l=o!=null&&o.timeBar?"time-bar "+o.timeBar:"time-bar",u=o!=null&&o.dayRow?"day-row "+o.dayRow:"day-row",d=o!=null&&o.hourRow?"hour-row "+o.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:i,style:{minWidth:r||0}},_react2.default.createElement("div",{className:u,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${s}px, 1fr))`}},a.map(g=>g)),_react2.default.createElement("div",{className:d,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${s}px, 1fr))`}},f.map(g=>g))),n?_react2.default.createElement("div",{style:{width:n,height:"100%",boxSizing:"border-box",borderLeft:"1px solid yellow"}}):null)},Re=pt;var P=_react.createContext.call(void 0, null);var yt=({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)},Se=yt;var bt=({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(Se,{key:`row_header_${n.id}`,id:n.id,name:n.name})))},Me=bt;var _t=({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)},He=_t;var vt=({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}}),Oe=vt;var Le=Symbol.for("immer-nothing"),ze=Symbol.for("immer-draftable"),E=Symbol.for("immer-state"),xt=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 v(e,...t){if(process.env.NODE_ENV!=="production"){let r=xt[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 F=Object.getPrototypeOf;function B(e){return!!e&&!!e[E]}function $(e){var t;return e?Fe(e)||Array.isArray(e)||!!e[ze]||!!((t=e.constructor)!=null&&t[ze])||te(e)||re(e):!1}var Et=Object.prototype.constructor.toString();function Fe(e){if(!e||typeof e!="object")return!1;let t=F(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)===Et}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 de(e,t){return ee(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Be(e,t,r){let n=ee(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function Tt(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 N(e){return e.copy_||e.base_}function pe(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=Fe(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(F(e),n)}else{let n=F(e);if(n!==null&&r)return Te({},e);let o=Object.create(n);return Object.assign(o,e)}}function be(e,t=!1){return ne(e)||B(e)||!$(e)||(ee(e)>1&&(e.set=e.add=e.clear=e.delete=Dt),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>be(n,!0))),e}function Dt(){v(2)}function ne(e){return Object.isFrozen(e)}var Rt={};function I(e){let t=Rt[e];return t||v(0,e),t}var U;function We(){return U}function St(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ae(e,t){t&&(I("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function me(e){he(e),e.drafts_.forEach(Pt),e.drafts_=null}function he(e){e===U&&(U=e.parent_)}function Ne(e){return U=St(U,e)}function Pt(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_&&(me(t),v(4)),$(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,[]),me(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Le?e:void 0}function Q(e,t,r){if(ne(t))return t;let n=t[E];if(!n)return q(t,(o,i)=>Ie(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,f)=>Ie(e,n,o,a,f,r,s)),Z(e,o,!1),r&&e.patches_&&I("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function Ie(e,t,r,n,o,i,s){if(process.env.NODE_ENV!=="production"&&o===r&&v(5),B(o)){let a=i&&t&&t.type_!==3&&!de(t.assigned_,n)?i.concat(n):void 0,f=Q(e,o,a);if(Be(r,n,f),B(f))e.canAutoFreeze_=!1;else return}else s&&r.add(o);if($(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_&&be(t,r)}function Mt(e,t){let r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:We(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},o=n,i=_e;r&&(o=[n],i=X);let{revoke:s,proxy:a}=Proxy.revocable(o,i);return n.draft_=a,n.revoke_=s,a}var _e={get(e,t){if(t===E)return e;let r=N(e);if(!de(r,t))return kt(e,r,t);let n=r[t];return e.finalized_||!$(n)?n:n===ue(e.base_,t)?(fe(e),e.copy_[t]=ye(n,e)):n},has(e,t){return t in N(e)},ownKeys(e){return Reflect.ownKeys(N(e))},set(e,t,r){let n=Ge(N(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){let o=ue(N(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(Tt(r,o)&&(r!==void 0||de(e.base_,t)))return!0;fe(e),ge(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 ue(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,fe(e),ge(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=N(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){v(11)},getPrototypeOf(e){return F(e.base_)},setPrototypeOf(){v(12)}},X={};q(_e,(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))&&v(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))&&v(14),_e.set.call(this,e[0],t,r,e[0])};function ue(e,t){let r=e[E];return(r?N(r):e)[t]}function kt(e,t,r){var o;let n=Ge(t,r);return n?"value"in n?n.value:(o=n.get)==null?void 0:o.call(e.draft_):void 0}function Ge(e,t){if(!(t in e))return;let r=F(e);for(;r;){let n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=F(r)}}function ge(e){e.modified_||(e.modified_=!0,e.parent_&&ge(e.parent_))}function fe(e){e.copy_||(e.copy_=pe(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Ct=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(f=i,...l){return s.produce(f,u=>r.call(this,u,...l))}}typeof r!="function"&&v(6),n!==void 0&&typeof n!="function"&&v(7);let o;if($(t)){let i=Ne(this),s=ye(t,void 0),a=!0;try{o=r(s),a=!1}finally{a?me(i):he(i)}return Ae(i,n),$e(o,i)}else if(!t||typeof t!="object"){if(o=r(t),o===void 0&&(o=t),o===Le&&(o=void 0),this.autoFreeze_&&be(o,!0),n){let i=[],s=[];I("Patches").generateReplacementPatches_(t,o,i,s),n(i,s)}return o}else v(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,f=>t(f,...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){$(e)||v(8),B(e)&&(e=Ht(e));let t=Ne(this),r=ye(e,void 0);return r[E].isManual_=!0,he(t),r}finishDraft(e,t){let r=e&&e[E];(!r||!r.isManual_)&&v(9);let{scope_:n}=r;return Ae(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 B(e)?n(e,t):this.produce(e,o=>n(o,t))}};function ye(e,t){let r=te(e)?I("MapSet").proxyMap_(e,t):re(e)?I("MapSet").proxySet_(e,t):Mt(e,t);return(t?t.scope_:We()).drafts_.push(r),r}function Ht(e){return B(e)||v(10,e),Je(e)}function Je(e){if(!$(e)||ne(e))return e;let t=e[E],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=pe(e,t.scope_.immer_.useStrictShallowCopy_)}else r=pe(e,!0);return q(r,(n,o)=>{Be(r,n,Je(o))}),t&&(t.finalized_=!1),r}var T=new Ct,Ue=T.produce,Lr=T.produceWithPatches.bind(T),Fr=T.setAutoFreeze.bind(T),Br=T.setUseStrictShallowCopy.bind(T),Wr=T.applyPatches.bind(T),Gr=T.createDraft.bind(T),Jr=T.finishDraft.bind(T);var W=_react.createContext.call(void 0, {dragStarted:!1,setDragStarted:()=>{}});var oe=_react.createContext.call(void 0, {});var At=(e,t)=>e.startTime-t.startTime<0||e.startTime===t.startTime&&e.endTime<t.endTime?-1:1,ie=At;var Lt=_react.forwardRef.call(void 0, (e,t)=>{let{setEvents:r,tick:n,id:o,windowTime:i,cellWidth:s,children:a}=e,{dragStarted:f,setDragStarted:l}=_react.useContext.call(void 0, W),{onDrop:u}=_react.useContext.call(void 0, oe),d=_react.useCallback.call(void 0, m=>{m.preventDefault();let h=m.target,{left:p}=h.getBoundingClientRect(),b=m.dataTransfer.getData("eventId"),w=Math.round((m.clientX-p)/s),R=s*w;r(Ue(k=>{let c=k.find(x=>x.id===b);if(c&&n){let x=i[0]+R*n,C=c.endTime-c.startTime,D=i[0]+C+R*n;u&&u({eventId:c.id,oldRowId:c.rowId,newRowId:e.id,startTime:x,endTime:D}),c.startTime=x,c.endTime=D,c.rowId=e.id}k.sort(ie)})),l(!1)},[r,n,i,s]),g=_react.useContext.call(void 0, P),y=g&&g.rowsHeight&&g.rowsHeight[o]?g.rowsHeight[o].minHeight:40;return _react2.default.createElement("div",{id:`row_${o}`,ref:t,onDragOver:m=>m.preventDefault(),onDrop:d,className:f?"row-content not-clickable":"row-content","data-index":o,style:{minHeight:y}},a)}),Xe=Lt;var Bt=({id:e,startPosition:t,width:r,top:n,props:o})=>{let{setDragStarted:i}=_react.useContext.call(void 0, W),s=_react.useCallback.call(void 0, l=>{l.stopPropagation(),l.dataTransfer.setData("eventId",e),setTimeout(()=>i(!0),0);let u=l.target;u.style.opacity="50%"},[i]),a=_react.useCallback.call(void 0, l=>{l.stopPropagation(),i(!1);let u=l.target;u.style.opacity="100%"},[i]),f=o!=null&&o.classNames?"event "+o.classNames.join(" "):"event";return _react2.default.createElement("div",{id:`event_${e}`,key:`event_${e}`,className:f,draggable:!(o!=null&&o.isLocked),onDragStart:s,onDragEnd:a,onMouseDown:l=>l.stopPropagation(),onMouseMove:l=>l.stopPropagation(),onDrop:l=>l.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))},Ke=Bt;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])},Ve=Jt;var Yt=({rows:e,windowTime:t,tick:r,events:n,staticEvents:o,cellWidth:i,setEvents:s,bodyRef:a})=>{let f=_react.useContext.call(void 0, P),l=_react.useRef.call(void 0, null),u=_react.useRef.call(void 0, []),[d,g]=_react.useMemo.call(void 0, ()=>{let y=0;return[e.map((m,h)=>{let p=0,b=[],w=0,R=r?n.filter(c=>c.rowId===m.id).map(c=>{if(c.endTime>=t[0]&&c.startTime<=t[1]){let x=0,C=!0;for(let D=0;D<=p;D++)if(b&&b[D]&&b[D].endTime>c.startTime)x+=1;else{p>w&&(w=p),p=0,C=!1;break}return C&&(p=x),b[x]=c,_react2.default.createElement(Ke,{key:`event_${c.id}`,id:c.id,startPosition:(c.startTime-t[0])/r,width:(c.endTime-c.startTime)/r,top:10+22*x,props:c.props})}}):null;p>w&&(w=p),l.current===null?l.current={[m.id]:{minHeight:40+w*22}}:l.current[m.id]={minHeight:40+w*22},y+=40+w*22;let k=r&&o?o.filter(c=>c.rowId===m.id).map(c=>{if(c.endTime>=t[0]&&c.startTime<=t[1])return _react2.default.createElement(Oe,{key:`static_event_${c.id}`,id:c.id,startPosition:(c.startTime-t[0])/r,width:(c.endTime-c.startTime)/r,top:10,height:20+w*22})}):null;return _react2.default.createElement(_react2.default.Fragment,{key:`row_content_${m.id}`},_react2.default.createElement(Xe,{id:m.id,ref:c=>{u.current&&u.current[h]&&c?u.current[h]=c:u.current&&c&&u.current.push(c)},setEvents:s,tick:r,windowTime:t,cellWidth:i},R,k))}),y]},[e,n,r,t,i]);return Ve({rowsContentRef:u,bodyRef:a}),_react.useEffect.call(void 0, ()=>{f&&(f.setRowsHeight(l.current),f.setAllRowsHeight(g))},[d,g]),d},Qe=Yt;var Zt=_react.forwardRef.call(void 0, ({rows:e,events:t,staticEvents:r,setEvents:n,tick:o,windowTime:i,cellWidth:s,setWindowTime:a,contentWidth:f,setCellWidth:l,bodyRef:u,lineClassName:d},g)=>{let[y,m]=_react.useState.call(void 0, !1),h=_react.useRef.call(void 0, null),[p,b]=_react.useState.call(void 0, !1),{blockWidth:w}=V({windowTime:i,contentWidth:f}),R=_react.useContext.call(void 0, P),k=_react.useCallback.call(void 0, _=>{if(_.preventDefault(),!y)return;let S=_.target,{left:A}=S.getBoundingClientRect(),H=_.clientX-A,Y=o?Math.floor(o*w):0;h.current&&h.current-H>=w?(h.current=H,a(J=>[J[0]+Y,J[1]+Y])):h.current&&H-h.current>=w&&(h.current=H,a(J=>[J[0]-Y,J[1]-Y]))},[w,a,y]),c=_react.useCallback.call(void 0, _=>{m(!0),_.button===1&&_.preventDefault();let S=_.target,{left:A}=S.getBoundingClientRect();h.current=_.clientX-A},[m]),x=_react.useCallback.call(void 0, ()=>{m(!1)},[m]),C=_react.useCallback.call(void 0, ()=>m(!1),[m]),D=Qe({rows:e,windowTime:i,tick:o,events:t,staticEvents:r,cellWidth:s,setEvents:n,bodyRef:u}),ae=_react.useCallback.call(void 0, _=>{_.preventDefault(),_.button===1&&b(S=>!S)},[]),M=_react.useCallback.call(void 0, _=>{let S=o?900/o:0;p&&l(A=>{let H=_.deltaY>0?A+S:A-S;return H<S||H>S*12?A:H})},[p,s,o]);return _react.useEffect.call(void 0, ()=>{u.current&&(u.current.style.overflow=p?"hidden":"auto")},[p]),_react2.default.createElement("div",{key:"content",ref:g,className:"content-wrapper",onMouseDown:c,onMouseUp:x,onMouseMove:k,onMouseLeave:C,onAuxClick:ae,onWheel:M,style:{cursor:y?"grabbing":"grab",height:R==null?void 0:R.allRowsHeight}},_react2.default.createElement(He,{contentWidth:f,cellWidth:s,lineClassName:d}),D)}),tt=Zt;var nr=({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 f of s){let l=(a=f.borderBoxSize)==null?void 0:a[0].inlineSize;if(typeof l=="number"&&l!==o.current){o.current=l;let u=e[1]-e[0],d=u/3600;t(u/f.contentRect.width),r(f.contentRect.width/d)}}}),[e]);_react.useEffect.call(void 0, ()=>(n.current&&i.observe(n.current,{box:"border-box"}),()=>i.disconnect()),[i])},rt=nr;var Gn=({rows:e,events:t,staticEvents:r,onDrop:n,startDate:o,endDate:i,additionalClassNames:s})=>{let[a,f]=_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]),[l,u]=_react.useState.call(void 0, 0),[d,g]=_react.useState.call(void 0, []),y=_react.useRef.call(void 0, null),m=_react.useRef.call(void 0, null),h=_react.useRef.call(void 0, null),[p,b]=_react.useState.call(void 0, null),[w,R]=_react.useState.call(void 0, 0),[k,c]=_react.useState.call(void 0, null),[x,C]=_react.useState.call(void 0, 0);_react.useEffect.call(void 0, ()=>{if(y.current){let M=a[1]-a[0],_=M/3600;b(M/y.current.getBoundingClientRect().width),u(y.current.getBoundingClientRect().width/_)}},[]),_react.useEffect.call(void 0, ()=>{h.current&&R(h.current.getBoundingClientRect().width-h.current.scrollWidth)},[]),_react.useEffect.call(void 0, ()=>{g(t.sort(ie))},[t]);let[D,ae]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{let M=null;e.forEach(_=>{M===null?M={[_.id]:{minHeight:40}}:M[_.id]={minHeight:40}}),c(M)},[e]),rt({contentRef:y,setCellWidth:u,setTick:b,windowTime:a}),_react2.default.createElement("div",{className:"main-wrapper",ref:m},_react2.default.createElement(Re,{windowTime:a,tick:p,contentWidth:y.current?y.current.getBoundingClientRect().width:null,scrollWidth:w}),_react2.default.createElement("div",{className:"body-wrapper",ref:h},_react2.default.createElement(P.Provider,{value:{rowsHeight:k,setRowsHeight:c,allRowsHeight:x,setAllRowsHeight:C}},_react2.default.createElement(Me,{rows:e,className:s==null?void 0:s.rowsHeader}),_react2.default.createElement(W.Provider,{value:{dragStarted:D,setDragStarted:ae}},_react2.default.createElement(oe.Provider,{value:{onDrop:n}},_react2.default.createElement(tt,{events:d,staticEvents:r,rows:e,setEvents:g,tick:p,windowTime:a,cellWidth:l,setWindowTime:f,ref:y,setCellWidth:u,contentWidth:y.current?y.current.getBoundingClientRect().width:null,bodyRef:h,lineClassName:s==null?void 0:s.gridLine}))))))};exports.Timeline = Gn;
|
|
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
|