awesome-timeline-react 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_tsup-dts-rollup.d.ts +276 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/index.d.ts +1 -277
- package/package.json +1 -1
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
|
|
3
|
+
import { Context } from "react";
|
|
4
|
+
import { CSSProperties } from "react";
|
|
5
|
+
import { default as React_2 } from "react";
|
|
6
|
+
|
|
7
|
+
declare type ContentType = {
|
|
8
|
+
rows: RowType[];
|
|
9
|
+
events: EventType[];
|
|
10
|
+
staticEvents?: EventType[];
|
|
11
|
+
setEvents: React_2.Dispatch<React_2.SetStateAction<EventType[]>>;
|
|
12
|
+
tick: number | null;
|
|
13
|
+
windowTime: number[];
|
|
14
|
+
cellWidth: number;
|
|
15
|
+
setWindowTime: React_2.Dispatch<React_2.SetStateAction<number[]>>;
|
|
16
|
+
contentWidth: number | null;
|
|
17
|
+
setCellWidth: React_2.Dispatch<React_2.SetStateAction<number>>;
|
|
18
|
+
bodyRef: React_2.MutableRefObject<HTMLDivElement | null>;
|
|
19
|
+
lineClassName?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export declare const default_alias: {
|
|
23
|
+
title: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export declare const default_alias_1: React_2.ForwardRefExoticComponent<
|
|
27
|
+
ContentType & React_2.RefAttributes<HTMLDivElement>
|
|
28
|
+
>;
|
|
29
|
+
|
|
30
|
+
export declare const default_alias_10: (dayIndex: number) => string;
|
|
31
|
+
|
|
32
|
+
export declare const default_alias_11: (
|
|
33
|
+
eventA: EventType,
|
|
34
|
+
eventB: EventType
|
|
35
|
+
) => 1 | -1;
|
|
36
|
+
|
|
37
|
+
export declare const default_alias_12: ({
|
|
38
|
+
windowTime,
|
|
39
|
+
tick,
|
|
40
|
+
contentWidth,
|
|
41
|
+
blockWidth,
|
|
42
|
+
}: {
|
|
43
|
+
windowTime: number[];
|
|
44
|
+
tick: number | null;
|
|
45
|
+
contentWidth: number | null;
|
|
46
|
+
blockWidth: number;
|
|
47
|
+
}) => {
|
|
48
|
+
dayBlocks: JSX.Element[];
|
|
49
|
+
hourBlocks: JSX.Element[];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export declare const default_alias_13: ({
|
|
53
|
+
windowTime,
|
|
54
|
+
contentWidth,
|
|
55
|
+
}: {
|
|
56
|
+
windowTime: number[];
|
|
57
|
+
contentWidth: number | null;
|
|
58
|
+
}) => {
|
|
59
|
+
numberOfHourBlocks: number;
|
|
60
|
+
blockWidth: number;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export declare const default_alias_14: ({
|
|
64
|
+
bodyRef,
|
|
65
|
+
rowsContentRef,
|
|
66
|
+
}: {
|
|
67
|
+
bodyRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
68
|
+
rowsContentRef: React.MutableRefObject<HTMLDivElement[] | null>;
|
|
69
|
+
}) => void;
|
|
70
|
+
|
|
71
|
+
export declare const default_alias_15: ({
|
|
72
|
+
rows,
|
|
73
|
+
windowTime,
|
|
74
|
+
tick,
|
|
75
|
+
events,
|
|
76
|
+
staticEvents,
|
|
77
|
+
cellWidth,
|
|
78
|
+
setEvents,
|
|
79
|
+
bodyRef,
|
|
80
|
+
}: ProduceContentType) => React_2.JSX.Element[];
|
|
81
|
+
|
|
82
|
+
export declare const default_alias_16: ({
|
|
83
|
+
windowTime,
|
|
84
|
+
setTick,
|
|
85
|
+
setCellWidth,
|
|
86
|
+
contentRef,
|
|
87
|
+
}: {
|
|
88
|
+
windowTime: number[];
|
|
89
|
+
setTick: React.Dispatch<React.SetStateAction<number | null>>;
|
|
90
|
+
setCellWidth: React.Dispatch<React.SetStateAction<number>>;
|
|
91
|
+
contentRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
92
|
+
}) => void;
|
|
93
|
+
|
|
94
|
+
export declare const default_alias_2: ({
|
|
95
|
+
id,
|
|
96
|
+
startPosition,
|
|
97
|
+
width,
|
|
98
|
+
top,
|
|
99
|
+
props,
|
|
100
|
+
}: {
|
|
101
|
+
id: string;
|
|
102
|
+
startPosition: CSSProperties["left"];
|
|
103
|
+
width: CSSProperties["width"];
|
|
104
|
+
top: CSSProperties["top"];
|
|
105
|
+
props?: EventPropsType;
|
|
106
|
+
}) => React_2.JSX.Element;
|
|
107
|
+
|
|
108
|
+
export declare const default_alias_3: ({
|
|
109
|
+
contentWidth,
|
|
110
|
+
cellWidth,
|
|
111
|
+
lineClassName,
|
|
112
|
+
}: {
|
|
113
|
+
contentWidth: number | null;
|
|
114
|
+
cellWidth: number;
|
|
115
|
+
lineClassName?: string;
|
|
116
|
+
}) => React_2.JSX.Element;
|
|
117
|
+
|
|
118
|
+
export declare const default_alias_4: React_2.ForwardRefExoticComponent<
|
|
119
|
+
RowContentProps & {
|
|
120
|
+
children?: React_2.ReactNode;
|
|
121
|
+
} & React_2.RefAttributes<HTMLDivElement>
|
|
122
|
+
>;
|
|
123
|
+
|
|
124
|
+
export declare const default_alias_5: ({
|
|
125
|
+
name,
|
|
126
|
+
id,
|
|
127
|
+
}: {
|
|
128
|
+
name: string;
|
|
129
|
+
id: string;
|
|
130
|
+
}) => React_2.JSX.Element;
|
|
131
|
+
|
|
132
|
+
export declare const default_alias_6: ({
|
|
133
|
+
rows,
|
|
134
|
+
className,
|
|
135
|
+
}: {
|
|
136
|
+
rows: RowType[];
|
|
137
|
+
className?: string;
|
|
138
|
+
}) => React_2.JSX.Element;
|
|
139
|
+
|
|
140
|
+
export declare const default_alias_7: ({
|
|
141
|
+
id,
|
|
142
|
+
startPosition,
|
|
143
|
+
width,
|
|
144
|
+
top,
|
|
145
|
+
height,
|
|
146
|
+
}: {
|
|
147
|
+
id: string;
|
|
148
|
+
startPosition: CSSProperties["left"];
|
|
149
|
+
width: CSSProperties["width"];
|
|
150
|
+
top: CSSProperties["top"];
|
|
151
|
+
height: CSSProperties["height"];
|
|
152
|
+
}) => React_2.JSX.Element;
|
|
153
|
+
|
|
154
|
+
export declare const default_alias_8: ({
|
|
155
|
+
windowTime,
|
|
156
|
+
tick,
|
|
157
|
+
contentWidth,
|
|
158
|
+
scrollWidth,
|
|
159
|
+
additionalClassNames,
|
|
160
|
+
}: {
|
|
161
|
+
windowTime: number[];
|
|
162
|
+
tick: number | null;
|
|
163
|
+
contentWidth: number | null;
|
|
164
|
+
scrollWidth: number;
|
|
165
|
+
additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
|
|
166
|
+
}) => React_2.JSX.Element;
|
|
167
|
+
|
|
168
|
+
export declare const default_alias_9: (monthIndex: number) => string;
|
|
169
|
+
|
|
170
|
+
export declare const DragStartedContext: Context<DragStartedContext_2>;
|
|
171
|
+
|
|
172
|
+
declare type DragStartedContext_2 = {
|
|
173
|
+
dragStarted: boolean;
|
|
174
|
+
setDragStarted: React.Dispatch<React.SetStateAction<boolean>>;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export declare type EventPropsType = {
|
|
178
|
+
isLocked?: boolean;
|
|
179
|
+
content?: JSX.Element | string;
|
|
180
|
+
classNames?: string[];
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
export declare type EventType = {
|
|
184
|
+
id: string;
|
|
185
|
+
rowId: string;
|
|
186
|
+
startTime: number;
|
|
187
|
+
endTime: number;
|
|
188
|
+
props?: EventPropsType;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export declare const ExternalPropertiesContext: Context<ExternalPropertiesType>;
|
|
192
|
+
|
|
193
|
+
declare type ExternalPropertiesType = {
|
|
194
|
+
onDrop?: (props: OnDropProps) => void;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export declare type ModifableElements = {
|
|
198
|
+
timeBar: string;
|
|
199
|
+
dayRow: string;
|
|
200
|
+
hourRow: string;
|
|
201
|
+
gridLine: string;
|
|
202
|
+
rowsHeader: string;
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
export declare type OnDropProps = {
|
|
206
|
+
eventId: string;
|
|
207
|
+
oldRowId: string;
|
|
208
|
+
newRowId: string;
|
|
209
|
+
startTime: number;
|
|
210
|
+
endTime: number;
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export declare type PartialRecord<K extends keyof any, T> = Partial<
|
|
214
|
+
Record<K, T>
|
|
215
|
+
>;
|
|
216
|
+
|
|
217
|
+
declare type ProduceContentType = {
|
|
218
|
+
rows: RowType[];
|
|
219
|
+
events: EventType[];
|
|
220
|
+
staticEvents?: EventType[];
|
|
221
|
+
setEvents: React_2.Dispatch<React_2.SetStateAction<EventType[]>>;
|
|
222
|
+
tick: number | null;
|
|
223
|
+
windowTime: number[];
|
|
224
|
+
cellWidth: number;
|
|
225
|
+
bodyRef: React_2.MutableRefObject<HTMLDivElement | null>;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
declare type RowContentProps = {
|
|
229
|
+
id: string;
|
|
230
|
+
setEvents: React_2.Dispatch<React_2.SetStateAction<EventType[]>>;
|
|
231
|
+
tick: number | null;
|
|
232
|
+
windowTime: number[];
|
|
233
|
+
cellWidth: number;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export declare const RowsHeightContext: Context<RowsHeightContextType | null>;
|
|
237
|
+
|
|
238
|
+
declare type RowsHeightContextType = {
|
|
239
|
+
rowsHeight: Record<string, RowsHeightType> | null;
|
|
240
|
+
setRowsHeight: React.Dispatch<
|
|
241
|
+
React.SetStateAction<Record<string, RowsHeightType> | null>
|
|
242
|
+
>;
|
|
243
|
+
allRowsHeight: number;
|
|
244
|
+
setAllRowsHeight: React.Dispatch<React.SetStateAction<number>>;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export declare type RowsHeightType = {
|
|
248
|
+
minHeight: number;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export declare type RowType = {
|
|
252
|
+
id: string;
|
|
253
|
+
name: string;
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export declare const Timeline: ({
|
|
257
|
+
rows,
|
|
258
|
+
events,
|
|
259
|
+
staticEvents,
|
|
260
|
+
onDrop,
|
|
261
|
+
startDate,
|
|
262
|
+
endDate,
|
|
263
|
+
additionalClassNames,
|
|
264
|
+
}: TimelineType) => React_2.JSX.Element;
|
|
265
|
+
|
|
266
|
+
export declare const TimelinePrimary: () => React_2.JSX.Element;
|
|
267
|
+
|
|
268
|
+
export declare type TimelineType = {
|
|
269
|
+
rows: RowType[];
|
|
270
|
+
events: EventType[];
|
|
271
|
+
staticEvents?: EventType[];
|
|
272
|
+
onDrop?: (props: OnDropProps) => void;
|
|
273
|
+
startDate: Date;
|
|
274
|
+
endDate: Date;
|
|
275
|
+
additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
|
|
276
|
+
};
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _react = require('react'); var _react2 = _interopRequireDefault(_react);var ee=({windowTime:o,contentWidth:t})=>{let n=_react.useMemo.call(void 0, ()=>(o[1]-o[0])/3600,[o]),i=t?t/n:0;return{numberOfHourBlocks:n,blockWidth:i}},$=ee;var k=_react.createContext.call(void 0, null);var oe=({contentWidth:o,cellWidth:t,lineClassName:n})=>{let i=_react.useMemo.call(void 0, ()=>{let s=[],p=n?"line "+n:"line";if(o)for(let m=t;m<o;m=m+t)s.push(_react2.default.createElement("div",{key:`line_${m}`,className:p}));return s},[t,o]),e=_react.useMemo.call(void 0, ()=>o?o-i.length*t:0,[o,t,i]);return _react2.default.createElement("div",{className:e<1?"lines-canvas hide-last-line":"lines-canvas",style:e<1?{gridTemplateColumns:`repeat(auto-fill, minmax(${t}px, 1fr))`}:{gridTemplateColumns:`repeat(auto-fill, minmax(${e}px, ${t}px))`}},i)},N=oe;var ne=({id:o,startPosition:t,width:n,top:i,height:e})=>_react2.default.createElement("div",{id:`static_event_${o}`,key:`static_event_${o}`,className:"static-event",onDrop:s=>s.stopPropagation(),style:{left:t,width:n,top:i,minHeight:e}}),j=ne;var _immer = require('immer');var P=_react.createContext.call(void 0, {dragStarted:!1,setDragStarted:()=>{}});var z=_react.createContext.call(void 0, {});var le=(o,t)=>o.startTime-t.startTime<0||o.startTime===t.startTime&&o.endTime<t.endTime?-1:1,W=le;var me=_react.forwardRef.call(void 0, (o,t)=>{let{setEvents:n,tick:i,id:e,windowTime:s,cellWidth:p,children:m}=o,{dragStarted:w,setDragStarted:l}=_react.useContext.call(void 0, P),{onDrop:a}=_react.useContext.call(void 0, z),M=_react.useCallback.call(void 0, d=>{d.preventDefault();let c=d.target,{left:b}=c.getBoundingClientRect(),f=d.dataTransfer.getData("eventId"),T=Math.round((d.clientX-b)/p),R=p*T;n(_immer.produce.call(void 0, r=>{let u=r.find(y=>y.id===f);if(u&&i){let y=s[0]+R*i,E=u.endTime-u.startTime,O=s[0]+E+R*i;a&&a({eventId:u.id,oldRowId:u.rowId,newRowId:o.id,startTime:y,endTime:O}),u.startTime=y,u.endTime=O,u.rowId=o.id}r.sort(W)})),l(!1)},[n,i,s,p]),x=_react.useContext.call(void 0, k),g=x&&x.rowsHeight&&x.rowsHeight[e]?x.rowsHeight[e].minHeight:40;return _react2.default.createElement("div",{id:`row_${e}`,ref:t,onDragOver:d=>d.preventDefault(),onDrop:M,className:w?"row-content not-clickable":"row-content","data-index":e,style:{minHeight:g}},m)}),F=me;var he=({id:o,startPosition:t,width:n,top:i,props:e})=>{let{setDragStarted:s}=_react.useContext.call(void 0, P),p=_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]),m=_react.useCallback.call(void 0, l=>{l.stopPropagation(),s(!1);let a=l.target;a.style.opacity="100%"},[s]),w=e!=null&&e.classNames?"event "+e.classNames.join(" "):"event";return _react2.default.createElement("div",{id:`event_${o}`,key:`event_${o}`,className:w,draggable:!(e!=null&&e.isLocked),onDragStart:p,onDragEnd:m,onMouseDown:l=>l.stopPropagation(),onMouseMove:l=>l.stopPropagation(),onDrop:l=>l.stopPropagation(),style:{left:t,width:n,top:i,cursor:e!=null&&e.isLocked?"not-allowed":"pointer"}},_react2.default.createElement("div",{className:"event-content"},e!=null&&e.content?e.content:null))},X=he;var be=({bodyRef:o,rowsContentRef:t})=>{let n=_react.useCallback.call(void 0, e=>{e.forEach(s=>{s.isIntersecting?s.target.classList.remove("row-hidden"):s.target.classList.add("row-hidden")})},[]),i=new IntersectionObserver(n,{root:o.current});_react.useEffect.call(void 0, ()=>(t.current&&t.current.forEach(e=>{i.observe(e)}),()=>i.disconnect()),[i])},Y=be;var Te=({rows:o,windowTime:t,tick:n,events:i,staticEvents:e,cellWidth:s,setEvents:p,bodyRef:m})=>{let w=_react.useContext.call(void 0, k),l=null,a=_react.useRef.call(void 0, []),M=0,x=_react.useMemo.call(void 0, ()=>o.map((g,d)=>{let c=0,b=[],f=0,T=n?i.filter(r=>r.rowId===g.id).map(r=>{if(r.endTime>=t[0]&&r.startTime<=t[1]){let u=0,y=!0;for(let E=0;E<=c;E++)if(b&&b[E]&&b[E].endTime>r.startTime)u+=1;else{c>f&&(f=c),c=0,y=!1;break}return y&&(c=u),b[u]=r,_react2.default.createElement(X,{key:`event_${r.id}`,id:r.id,startPosition:(r.startTime-t[0])/n,width:(r.endTime-r.startTime)/n,top:10+22*u,props:r.props})}}):null;c>f&&(f=c),l===null?l={[g.id]:{minHeight:40+f*22}}:l[g.id]={minHeight:40+f*22},M+=40+f*22;let R=n&&e?e.filter(r=>r.rowId===g.id).map(r=>{if(r.endTime>=t[0]&&r.startTime<=t[1])return _react2.default.createElement(j,{key:`static_event_${r.id}`,id:r.id,startPosition:(r.startTime-t[0])/n,width:(r.endTime-r.startTime)/n,top:10,height:20+f*22})}):null;return _react2.default.createElement(_react2.default.Fragment,{key:`row_content_${g.id}`},_react2.default.createElement(F,{id:g.id,ref:r=>{a.current&&a.current[d]&&r?a.current[d]=r:a.current&&r&&a.current.push(r)},setEvents:p,tick:n,windowTime:t,cellWidth:s},T,R))}),[o,i,n,t,s]);return Y({rowsContentRef:a,bodyRef:m}),_react.useEffect.call(void 0, ()=>{w&&(w.setRowsHeight(l),w.setAllRowsHeight(M))},[x]),x},U=Te;var Zt=_react.forwardRef.call(void 0, ({rows:o,events:t,staticEvents:n,setEvents:i,tick:e,windowTime:s,cellWidth:p,setWindowTime:m,contentWidth:w,setCellWidth:l,bodyRef:a,lineClassName:M},x)=>{let[g,d]=_react.useState.call(void 0, !1),c=_react.useRef.call(void 0, null),[b,f]=_react.useState.call(void 0, !1),{blockWidth:T}=$({windowTime:s,contentWidth:w}),R=_react.useContext.call(void 0, k),r=_react.useCallback.call(void 0, h=>{if(h.preventDefault(),!g)return;let v=h.target,{left:H}=v.getBoundingClientRect(),D=h.clientX-H,B=e?Math.floor(e*T):0;c.current&&c.current-D>=T?(c.current=D,m(C=>[C[0]+B,C[1]+B])):c.current&&D-c.current>=T&&(c.current=D,m(C=>[C[0]-B,C[1]-B]))},[T,m,g]),u=_react.useCallback.call(void 0, h=>{d(!0),h.button===1&&h.preventDefault();let v=h.target,{left:H}=v.getBoundingClientRect();c.current=h.clientX-H},[d]),y=_react.useCallback.call(void 0, ()=>{d(!1)},[d]),E=_react.useCallback.call(void 0, ()=>d(!1),[d]),O=U({rows:o,windowTime:s,tick:e,events:t,staticEvents:n,cellWidth:p,setEvents:i,bodyRef:a}),Q=_react.useCallback.call(void 0, h=>{h.preventDefault(),h.button===1&&f(v=>!v)},[]),V=_react.useCallback.call(void 0, h=>{let v=e?900/e:0;b&&l(H=>{let D=h.deltaY>0?H+v:H-v;return D<v||D>v*12?H:D})},[b,p,e]);return _react.useEffect.call(void 0, ()=>{a.current&&(a.current.style.overflow=b?"hidden":"auto")},[b]),_react2.default.createElement("div",{key:"content",ref:x,className:"content-wrapper",onMouseDown:u,onMouseUp:y,onMouseMove:r,onMouseLeave:E,onAuxClick:Q,onWheel:V,style:{cursor:g?"grabbing":"grab",height:R==null?void 0:R.allRowsHeight}},_react2.default.createElement(N,{contentWidth:w,cellWidth:p,lineClassName:M}),O)});
|
|
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 he=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=he;var ge=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=ge;var be=({windowTime:o,tick:e,contentWidth:r,blockWidth:n})=>{let{dayBlocks:t,hourBlocks:i}=_react.useMemo.call(void 0, ()=>{let c=o[0],d=[],g=[];if(e===null||r===null)return{dayBlocks:[],hourBlocks:[]};let s=r,a=1;for(;;){let u=new Date(c*1e3),w=new Date(u.getFullYear(),u.getMonth(),u.getDate(),23,59,59),f=(w.getTime()-u.getTime())/1e3/e;if(s-=f,Math.round(s)<0){let p=Math.round((f+s)/n);for(let b=0;b<p;b++)g.push(_react2.default.createElement("div",{className:"hour-block",key:`${u.getDate()}_hour_${b}`},b<10?`0${b}:00`:`${b}:00`));d.push(_react2.default.createElement("div",{className:"day-block",key:`${u.getDate()} ${u.getMonth()}`,style:{gridColumn:`${a} / ${a+p}`}},X(u.getDay())," ",u.getDate()," ",J(u.getMonth()))),a+=p;break}let m=Math.round(f/n);for(let p=24-m;p<24;p++)g.push(_react2.default.createElement("div",{className:"hour-block",key:`${u.getDate()}_hour_${p}`},p<10?`0${p}:00`:`${p}:00`));if(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,Math.round(s)===0)break;c=(w.getTime()+1e3)/1e3}return{dayBlocks:d,hourBlocks:g}},[e,o,r]);return{dayBlocks:t,hourBlocks:i}},q=be;var ve=({windowTime:o,contentWidth:e})=>{let r=_react.useMemo.call(void 0, ()=>(o[1]-o[0])/3600,[o]),n=e?e/r:0;return{numberOfHourBlocks:r,blockWidth:n}},A=ve;var ye=({windowTime:o,tick:e,contentWidth:r,scrollWidth:n,additionalClassNames:t})=>{let i=_react.useRef.call(void 0, null),{blockWidth:c}=A({windowTime:o,contentWidth:r}),{dayBlocks:d,hourBlocks:g}=q({windowTime:o,tick:e,contentWidth:r,blockWidth:c}),s=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:s},_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:a,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${c}px, 1fr))`}},d.map(w=>w)),_react2.default.createElement("div",{className:u,style:{gridTemplateColumns:`repeat(auto-fill, minmax(${c}px, 1fr))`}},g.map(w=>w))),n?_react2.default.createElement("div",{style:{width:n,height:"100%",boxSizing:"border-box",borderLeft:"1px solid yellow"}}):null)},K=ye;var D=_react.createContext.call(void 0, null);var ke=({name:o,id:e})=>{let r=_react.useContext.call(void 0, D),n=r&&r.rowsHeight&&r.rowsHeight[e]?r.rowsHeight[e].minHeight:40;return _react2.default.createElement("div",{className:"row-header",style:{minHeight:n}},o)},Q=ke;var De=({rows:o,className:e})=>{let r=e?"rows-header-wrapper "+e:"rows-header-wrapper";return _react2.default.createElement("div",{className:r},o.map(n=>_react2.default.createElement(Q,{key:`row_header_${n.id}`,id:n.id,name:n.name})))},Z=De;var He=({contentWidth:o,cellWidth:e,lineClassName:r})=>{let n=_react.useMemo.call(void 0, ()=>{let i=[],c=r?"line "+r:"line";if(o)for(let d=e;d<o;d=d+e)i.push(_react2.default.createElement("div",{key:`line_${d}`,className:c}));return i},[e,o]),t=_react.useMemo.call(void 0, ()=>o?o-n.length*e:0,[o,e,n]);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))`}},n)},oe=He;var Se=({id:o,startPosition:e,width:r,top:n,height:t})=>_react2.default.createElement("div",{id:`static_event_${o}`,key:`static_event_${o}`,className:"static-event",onDrop:i=>i.stopPropagation(),style:{left:e,width:r,top:n,minHeight:t}}),re=Se;var _immer = require('immer');var B=_react.createContext.call(void 0, {dragStarted:!1,setDragStarted:()=>{}});var N=_react.createContext.call(void 0, {});var Le=(o,e)=>o.startTime-e.startTime<0||o.startTime===e.startTime&&o.endTime<e.endTime?-1:1,j=Le;var We=_react.forwardRef.call(void 0, (o,e)=>{let{setEvents:r,tick:n,id:t,windowTime:i,cellWidth:c,children:d}=o,{dragStarted:g,setDragStarted:s}=_react.useContext.call(void 0, B),{onDrop:a}=_react.useContext.call(void 0, N),u=_react.useCallback.call(void 0, f=>{f.preventDefault();let m=f.target,{left:p}=m.getBoundingClientRect(),b=f.dataTransfer.getData("eventId"),T=Math.round((f.clientX-p)/c),R=c*T;r(_immer.produce.call(void 0, l=>{let v=l.find(y=>y.id===b);if(v&&n){let y=i[0]+R*n,E=v.endTime-v.startTime,L=i[0]+E+R*n;a&&a({eventId:v.id,oldRowId:v.rowId,newRowId:o.id,startTime:y,endTime:L}),v.startTime=y,v.endTime=L,v.rowId=o.id}l.sort(j)})),s(!1)},[r,n,i,c]),w=_react.useContext.call(void 0, D),h=w&&w.rowsHeight&&w.rowsHeight[t]?w.rowsHeight[t].minHeight:40;return _react2.default.createElement("div",{id:`row_${t}`,ref:e,onDragOver:f=>f.preventDefault(),onDrop:u,className:g?"row-content not-clickable":"row-content","data-index":t,style:{minHeight:h}},d)}),ne=We;var Ie=({id:o,startPosition:e,width:r,top:n,props:t})=>{let{setDragStarted:i}=_react.useContext.call(void 0, B),c=_react.useCallback.call(void 0, s=>{s.stopPropagation(),s.dataTransfer.setData("eventId",o),setTimeout(()=>i(!0),0);let a=s.target;a.style.opacity="50%"},[i]),d=_react.useCallback.call(void 0, s=>{s.stopPropagation(),i(!1);let a=s.target;a.style.opacity="100%"},[i]),g=t!=null&&t.classNames?"event "+t.classNames.join(" "):"event";return _react2.default.createElement("div",{id:`event_${o}`,key:`event_${o}`,className:g,draggable:!(t!=null&&t.isLocked),onDragStart:c,onDragEnd:d,onMouseDown:s=>s.stopPropagation(),onMouseMove:s=>s.stopPropagation(),onDrop:s=>s.stopPropagation(),style:{left:e,width:r,top:n,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 je=({bodyRef:o,rowsContentRef:e})=>{let r=_react.useCallback.call(void 0, t=>{t.forEach(i=>{i.isIntersecting?i.target.classList.remove("row-hidden"):i.target.classList.add("row-hidden")})},[]),n=new IntersectionObserver(r,{root:o.current});_react.useEffect.call(void 0, ()=>(e.current&&e.current.forEach(t=>{n.observe(t)}),()=>n.disconnect()),[n])},ae=je;var Ye=({rows:o,windowTime:e,tick:r,events:n,staticEvents:t,cellWidth:i,setEvents:c,bodyRef:d})=>{let g=_react.useContext.call(void 0, D),s=null,a=_react.useRef.call(void 0, []),u=0,w=_react.useMemo.call(void 0, ()=>o.map((h,f)=>{let m=0,p=[],b=0,T=r?n.filter(l=>l.rowId===h.id).map(l=>{if(l.endTime>=e[0]&&l.startTime<=e[1]){let v=0,y=!0;for(let E=0;E<=m;E++)if(p&&p[E]&&p[E].endTime>l.startTime)v+=1;else{m>b&&(b=m),m=0,y=!1;break}return y&&(m=v),p[v]=l,_react2.default.createElement(le,{key:`event_${l.id}`,id:l.id,startPosition:(l.startTime-e[0])/r,width:(l.endTime-l.startTime)/r,top:10+22*v,props:l.props})}}):null;m>b&&(b=m),s===null?s={[h.id]:{minHeight:40+b*22}}:s[h.id]={minHeight:40+b*22},u+=40+b*22;let R=r&&t?t.filter(l=>l.rowId===h.id).map(l=>{if(l.endTime>=e[0]&&l.startTime<=e[1])return _react2.default.createElement(re,{key:`static_event_${l.id}`,id:l.id,startPosition:(l.startTime-e[0])/r,width:(l.endTime-l.startTime)/r,top:10,height:20+b*22})}):null;return _react2.default.createElement(_react2.default.Fragment,{key:`row_content_${h.id}`},_react2.default.createElement(ne,{id:h.id,ref:l=>{a.current&&a.current[f]&&l?a.current[f]=l:a.current&&l&&a.current.push(l)},setEvents:c,tick:r,windowTime:e,cellWidth:i},T,R))}),[o,n,r,e,i]);return ae({rowsContentRef:a,bodyRef:d}),_react.useEffect.call(void 0, ()=>{g&&(g.setRowsHeight(s),g.setAllRowsHeight(u))},[w]),w},ce=Ye;var Ve=_react.forwardRef.call(void 0, ({rows:o,events:e,staticEvents:r,setEvents:n,tick:t,windowTime:i,cellWidth:c,setWindowTime:d,contentWidth:g,setCellWidth:s,bodyRef:a,lineClassName:u},w)=>{let[h,f]=_react.useState.call(void 0, !1),m=_react.useRef.call(void 0, null),[p,b]=_react.useState.call(void 0, !1),{blockWidth:T}=A({windowTime:i,contentWidth:g}),R=_react.useContext.call(void 0, D),l=_react.useCallback.call(void 0, x=>{if(x.preventDefault(),!h)return;let k=x.target,{left:P}=k.getBoundingClientRect(),M=x.clientX-P,_=t?Math.floor(t*T):0;m.current&&m.current-M>=T?(m.current=M,d(z=>[z[0]+_,z[1]+_])):m.current&&M-m.current>=T&&(m.current=M,d(z=>[z[0]-_,z[1]-_]))},[T,d,h]),v=_react.useCallback.call(void 0, x=>{f(!0),x.button===1&&x.preventDefault();let k=x.target,{left:P}=k.getBoundingClientRect();m.current=x.clientX-P},[f]),y=_react.useCallback.call(void 0, ()=>{f(!1)},[f]),E=_react.useCallback.call(void 0, ()=>f(!1),[f]),L=ce({rows:o,windowTime:i,tick:t,events:e,staticEvents:r,cellWidth:c,setEvents:n,bodyRef:a}),G=_react.useCallback.call(void 0, x=>{x.preventDefault(),x.button===1&&b(k=>!k)},[]),H=_react.useCallback.call(void 0, x=>{let k=t?900/t:0;p&&s(P=>{let M=x.deltaY>0?P+k:P-k;return M<k||M>k*12?P:M})},[p,c,t]);return _react.useEffect.call(void 0, ()=>{a.current&&(a.current.style.overflow=p?"hidden":"auto")},[p]),_react2.default.createElement("div",{key:"content",ref:w,className:"content-wrapper",onMouseDown:v,onMouseUp:y,onMouseMove:l,onMouseLeave:E,onAuxClick:G,onWheel:H,style:{cursor:h?"grabbing":"grab",height:R==null?void 0:R.allRowsHeight}},_react2.default.createElement(oe,{contentWidth:g,cellWidth:c,lineClassName:u}),L)}),me=Ve;var ot=({windowTime:o,setTick:e,setCellWidth:r,contentRef:n})=>{let t=_react.useRef.call(void 0, 0),i=_react.useMemo.call(void 0, ()=>new ResizeObserver(c=>{var d;for(let g of c){let s=(d=g.borderBoxSize)==null?void 0:d[0].inlineSize;if(typeof s=="number"&&s!==t.current){t.current=s;let a=o[1]-o[0],u=a/3600;e(a/g.contentRect.width),r(g.contentRect.width/u)}}}),[o]);_react.useEffect.call(void 0, ()=>(n.current&&i.observe(n.current,{box:"border-box"}),()=>i.disconnect()),[i])},pe=ot;var Lo=({rows:o,events:e,staticEvents:r,onDrop:n,startDate:t,endDate:i,additionalClassNames:c})=>{let[d,g]=_react.useState.call(void 0, [new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),0,0).getTime()/1e3,new Date(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),0,0).getTime()/1e3]),[s,a]=_react.useState.call(void 0, 0),[u,w]=_react.useState.call(void 0, []),h=_react.useRef.call(void 0, null),f=_react.useRef.call(void 0, null),m=_react.useRef.call(void 0, null),[p,b]=_react.useState.call(void 0, null),[T,R]=_react.useState.call(void 0, 0),[l,v]=_react.useState.call(void 0, null),[y,E]=_react.useState.call(void 0, 0);_react.useEffect.call(void 0, ()=>{if(h.current){let H=d[1]-d[0],x=H/3600;b(H/h.current.getBoundingClientRect().width),a(h.current.getBoundingClientRect().width/x)}},[]),_react.useEffect.call(void 0, ()=>{m.current&&R(m.current.getBoundingClientRect().width-m.current.scrollWidth)},[]),_react.useEffect.call(void 0, ()=>{w(e.sort(j))},[e]);let[L,G]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{let H=null;o.forEach(x=>{H===null?H={[x.id]:{minHeight:40}}:H[x.id]={minHeight:40}}),v(H)},[o]),pe({contentRef:h,setCellWidth:a,setTick:b,windowTime:d}),_react2.default.createElement("div",{className:"main-wrapper",ref:f},_react2.default.createElement(K,{windowTime:d,tick:p,contentWidth:h.current?h.current.getBoundingClientRect().width:null,scrollWidth:T}),_react2.default.createElement("div",{className:"body-wrapper",ref:m},_react2.default.createElement(D.Provider,{value:{rowsHeight:l,setRowsHeight:v,allRowsHeight:y,setAllRowsHeight:E}},_react2.default.createElement(Z,{rows:o,className:c==null?void 0:c.rowsHeader}),_react2.default.createElement(B.Provider,{value:{dragStarted:L,setDragStarted:G}},_react2.default.createElement(N.Provider,{value:{onDrop:n}},_react2.default.createElement(me,{events:u,staticEvents:r,rows:o,setEvents:w,tick:p,windowTime:d,cellWidth:s,setWindowTime:g,ref:h,setCellWidth:a,contentWidth:h.current?h.current.getBoundingClientRect().width:null,bodyRef:m,lineClassName:c==null?void 0:c.gridLine}))))))};exports.Timeline = Lo;
|
|
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,
|
|
1
|
+
{"version":3,"sources":["c:\\awesome-timeline-react\\dist\\index.js"],"names":[],"mappings":"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","file":"C:\\awesome-timeline-react\\dist\\index.js","sourcesContent":[null]}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,277 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Context } from "react";
|
|
4
|
-
import { CSSProperties } from "react";
|
|
5
|
-
import { default as React_2 } from "react";
|
|
6
|
-
|
|
7
|
-
declare type ContentType = {
|
|
8
|
-
rows: RowType[];
|
|
9
|
-
events: EventType[];
|
|
10
|
-
staticEvents?: EventType[];
|
|
11
|
-
setEvents: React_2.Dispatch<React_2.SetStateAction<EventType[]>>;
|
|
12
|
-
tick: number | null;
|
|
13
|
-
windowTime: number[];
|
|
14
|
-
cellWidth: number;
|
|
15
|
-
setWindowTime: React_2.Dispatch<React_2.SetStateAction<number[]>>;
|
|
16
|
-
contentWidth: number | null;
|
|
17
|
-
setCellWidth: React_2.Dispatch<React_2.SetStateAction<number>>;
|
|
18
|
-
bodyRef: React_2.MutableRefObject<HTMLDivElement | null>;
|
|
19
|
-
lineClassName?: string;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export declare const default_alias: {
|
|
23
|
-
title: string;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export declare const default_alias_1: ({
|
|
27
|
-
rows,
|
|
28
|
-
events,
|
|
29
|
-
staticEvents,
|
|
30
|
-
onDrop,
|
|
31
|
-
startDate,
|
|
32
|
-
endDate,
|
|
33
|
-
additionalClassNames,
|
|
34
|
-
}: TimelineType) => React_2.JSX.Element;
|
|
35
|
-
|
|
36
|
-
export declare const default_alias_10: (monthIndex: number) => string;
|
|
37
|
-
|
|
38
|
-
export declare const default_alias_11: (dayIndex: number) => string;
|
|
39
|
-
|
|
40
|
-
export declare const default_alias_12: (
|
|
41
|
-
eventA: EventType,
|
|
42
|
-
eventB: EventType
|
|
43
|
-
) => 1 | -1;
|
|
44
|
-
|
|
45
|
-
export declare const default_alias_13: ({
|
|
46
|
-
windowTime,
|
|
47
|
-
tick,
|
|
48
|
-
contentWidth,
|
|
49
|
-
blockWidth,
|
|
50
|
-
}: {
|
|
51
|
-
windowTime: number[];
|
|
52
|
-
tick: number | null;
|
|
53
|
-
contentWidth: number | null;
|
|
54
|
-
blockWidth: number;
|
|
55
|
-
}) => {
|
|
56
|
-
dayBlocks: JSX.Element[];
|
|
57
|
-
hourBlocks: JSX.Element[];
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export declare const default_alias_14: ({
|
|
61
|
-
windowTime,
|
|
62
|
-
contentWidth,
|
|
63
|
-
}: {
|
|
64
|
-
windowTime: number[];
|
|
65
|
-
contentWidth: number | null;
|
|
66
|
-
}) => {
|
|
67
|
-
numberOfHourBlocks: number;
|
|
68
|
-
blockWidth: number;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export declare const default_alias_15: ({
|
|
72
|
-
bodyRef,
|
|
73
|
-
rowsContentRef,
|
|
74
|
-
}: {
|
|
75
|
-
bodyRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
76
|
-
rowsContentRef: React.MutableRefObject<HTMLDivElement[] | null>;
|
|
77
|
-
}) => void;
|
|
78
|
-
|
|
79
|
-
export declare const default_alias_16: ({
|
|
80
|
-
rows,
|
|
81
|
-
windowTime,
|
|
82
|
-
tick,
|
|
83
|
-
events,
|
|
84
|
-
staticEvents,
|
|
85
|
-
cellWidth,
|
|
86
|
-
setEvents,
|
|
87
|
-
bodyRef,
|
|
88
|
-
}: ProduceContentType) => React_2.JSX.Element[];
|
|
89
|
-
|
|
90
|
-
export declare const default_alias_17: ({
|
|
91
|
-
windowTime,
|
|
92
|
-
setTick,
|
|
93
|
-
setCellWidth,
|
|
94
|
-
contentRef,
|
|
95
|
-
}: {
|
|
96
|
-
windowTime: number[];
|
|
97
|
-
setTick: React.Dispatch<React.SetStateAction<number | null>>;
|
|
98
|
-
setCellWidth: React.Dispatch<React.SetStateAction<number>>;
|
|
99
|
-
contentRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
100
|
-
}) => void;
|
|
101
|
-
|
|
102
|
-
export declare const default_alias_2: React_2.ForwardRefExoticComponent<
|
|
103
|
-
ContentType & React_2.RefAttributes<HTMLDivElement>
|
|
104
|
-
>;
|
|
105
|
-
|
|
106
|
-
export declare const default_alias_3: ({
|
|
107
|
-
id,
|
|
108
|
-
startPosition,
|
|
109
|
-
width,
|
|
110
|
-
top,
|
|
111
|
-
props,
|
|
112
|
-
}: {
|
|
113
|
-
id: string;
|
|
114
|
-
startPosition: CSSProperties["left"];
|
|
115
|
-
width: CSSProperties["width"];
|
|
116
|
-
top: CSSProperties["top"];
|
|
117
|
-
props?: EventPropsType;
|
|
118
|
-
}) => React_2.JSX.Element;
|
|
119
|
-
|
|
120
|
-
export declare const default_alias_4: ({
|
|
121
|
-
contentWidth,
|
|
122
|
-
cellWidth,
|
|
123
|
-
lineClassName,
|
|
124
|
-
}: {
|
|
125
|
-
contentWidth: number | null;
|
|
126
|
-
cellWidth: number;
|
|
127
|
-
lineClassName?: string;
|
|
128
|
-
}) => React_2.JSX.Element;
|
|
129
|
-
|
|
130
|
-
export declare const default_alias_5: React_2.ForwardRefExoticComponent<
|
|
131
|
-
RowContentProps & {
|
|
132
|
-
children?: React_2.ReactNode;
|
|
133
|
-
} & React_2.RefAttributes<HTMLDivElement>
|
|
134
|
-
>;
|
|
135
|
-
|
|
136
|
-
export declare const default_alias_6: ({
|
|
137
|
-
name,
|
|
138
|
-
id,
|
|
139
|
-
}: {
|
|
140
|
-
name: string;
|
|
141
|
-
id: string;
|
|
142
|
-
}) => React_2.JSX.Element;
|
|
143
|
-
|
|
144
|
-
export declare const default_alias_7: ({
|
|
145
|
-
rows,
|
|
146
|
-
className,
|
|
147
|
-
}: {
|
|
148
|
-
rows: RowType[];
|
|
149
|
-
className?: string;
|
|
150
|
-
}) => React_2.JSX.Element;
|
|
151
|
-
|
|
152
|
-
export declare const default_alias_8: ({
|
|
153
|
-
id,
|
|
154
|
-
startPosition,
|
|
155
|
-
width,
|
|
156
|
-
top,
|
|
157
|
-
height,
|
|
158
|
-
}: {
|
|
159
|
-
id: string;
|
|
160
|
-
startPosition: CSSProperties["left"];
|
|
161
|
-
width: CSSProperties["width"];
|
|
162
|
-
top: CSSProperties["top"];
|
|
163
|
-
height: CSSProperties["height"];
|
|
164
|
-
}) => React_2.JSX.Element;
|
|
165
|
-
|
|
166
|
-
export declare const default_alias_9: ({
|
|
167
|
-
windowTime,
|
|
168
|
-
tick,
|
|
169
|
-
contentWidth,
|
|
170
|
-
scrollWidth,
|
|
171
|
-
additionalClassNames,
|
|
172
|
-
}: {
|
|
173
|
-
windowTime: number[];
|
|
174
|
-
tick: number | null;
|
|
175
|
-
contentWidth: number | null;
|
|
176
|
-
scrollWidth: number;
|
|
177
|
-
additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
|
|
178
|
-
}) => React_2.JSX.Element;
|
|
179
|
-
|
|
180
|
-
export declare const DragStartedContext: Context<DragStartedContext_2>;
|
|
181
|
-
|
|
182
|
-
declare type DragStartedContext_2 = {
|
|
183
|
-
dragStarted: boolean;
|
|
184
|
-
setDragStarted: React.Dispatch<React.SetStateAction<boolean>>;
|
|
185
|
-
};
|
|
186
|
-
export declare type EventPropsType = {
|
|
187
|
-
isLocked?: boolean;
|
|
188
|
-
content?: JSX.Element | string;
|
|
189
|
-
classNames?: string[];
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
export declare type EventType = {
|
|
193
|
-
id: string;
|
|
194
|
-
rowId: string;
|
|
195
|
-
startTime: number;
|
|
196
|
-
endTime: number;
|
|
197
|
-
props?: EventPropsType;
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
export declare const ExternalPropertiesContext: Context<ExternalPropertiesType>;
|
|
201
|
-
|
|
202
|
-
declare type ExternalPropertiesType = {
|
|
203
|
-
onDrop?: (props: OnDropProps) => void;
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
export declare type ModifableElements = {
|
|
207
|
-
timeBar: string;
|
|
208
|
-
dayRow: string;
|
|
209
|
-
hourRow: string;
|
|
210
|
-
gridLine: string;
|
|
211
|
-
rowsHeader: string;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
export declare type OnDropProps = {
|
|
215
|
-
eventId: string;
|
|
216
|
-
oldRowId: string;
|
|
217
|
-
newRowId: string;
|
|
218
|
-
startTime: number;
|
|
219
|
-
endTime: number;
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
export declare type PartialRecord<K extends keyof any, T> = Partial<
|
|
223
|
-
Record<K, T>
|
|
224
|
-
>;
|
|
225
|
-
|
|
226
|
-
declare type ProduceContentType = {
|
|
227
|
-
rows: RowType[];
|
|
228
|
-
events: EventType[];
|
|
229
|
-
staticEvents?: EventType[];
|
|
230
|
-
setEvents: React_2.Dispatch<React_2.SetStateAction<EventType[]>>;
|
|
231
|
-
tick: number | null;
|
|
232
|
-
windowTime: number[];
|
|
233
|
-
cellWidth: number;
|
|
234
|
-
bodyRef: React_2.MutableRefObject<HTMLDivElement | null>;
|
|
235
|
-
};
|
|
236
|
-
|
|
237
|
-
declare type RowContentProps = {
|
|
238
|
-
id: string;
|
|
239
|
-
setEvents: React_2.Dispatch<React_2.SetStateAction<EventType[]>>;
|
|
240
|
-
tick: number | null;
|
|
241
|
-
windowTime: number[];
|
|
242
|
-
cellWidth: number;
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
export declare const RowsHeightContext: Context<RowsHeightContextType | null>;
|
|
246
|
-
|
|
247
|
-
declare type RowsHeightContextType = {
|
|
248
|
-
rowsHeight: Record<string, RowsHeightType> | null;
|
|
249
|
-
setRowsHeight: React.Dispatch<
|
|
250
|
-
React.SetStateAction<Record<string, RowsHeightType> | null>
|
|
251
|
-
>;
|
|
252
|
-
allRowsHeight: number;
|
|
253
|
-
setAllRowsHeight: React.Dispatch<React.SetStateAction<number>>;
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
export declare type RowsHeightType = {
|
|
257
|
-
minHeight: number;
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
export declare type RowType = {
|
|
261
|
-
id: string;
|
|
262
|
-
name: string;
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
export declare const TimelinePrimary: () => React_2.JSX.Element;
|
|
266
|
-
|
|
267
|
-
export declare type TimelineType = {
|
|
268
|
-
rows: RowType[];
|
|
269
|
-
events: EventType[];
|
|
270
|
-
staticEvents?: EventType[];
|
|
271
|
-
onDrop?: (props: OnDropProps) => void;
|
|
272
|
-
startDate: Date;
|
|
273
|
-
endDate: Date;
|
|
274
|
-
additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
export {};
|
|
1
|
+
export { Timeline } from '../_tsup-dts-rollup';
|