akfatimeline 1.0.5 → 1.0.6

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/Timeline.js CHANGED
@@ -2371,7 +2371,6 @@ const Indicator = _ref => {
2371
2371
  totalDays
2372
2372
  } = _ref;
2373
2373
  if (todayIndex < 0 || todayIndex >= totalDays) {
2374
- console.log("Indicator not visible: Out of bounds");
2375
2374
  return null; // Bugün timeline dışında ise çizgiyi gösterme
2376
2375
  }
2377
2376
  return /*#__PURE__*/external_react_default().createElement("div", {
@@ -2610,7 +2609,6 @@ const TimelineContent = _ref => {
2610
2609
  const daysToAdd = Math.floor(deltaX / cellW);
2611
2610
  const newEndDate = new Date((originalEndDate !== null && originalEndDate !== void 0 ? originalEndDate : new Date()).getTime());
2612
2611
  newEndDate.setDate(newEndDate.getDate() + daysToAdd);
2613
- console.log(">>> Extending ID:", extendingEvent.id, "=>", newEndDate);
2614
2612
  setEvents(prev => prev.map(evt => evt.id === extendingEvent.id ? TimelineContent_objectSpread(TimelineContent_objectSpread({}, evt), {}, {
2615
2613
  endDate: newEndDate
2616
2614
  }) : evt));
@@ -3052,6 +3050,7 @@ const Timeline_Timeline_Timeline = _ref => {
3052
3050
  // Özelleştirilebilir Tooltip bileşeni
3053
3051
  tempEventStyle = {},
3054
3052
  eventStyleResolver = () => ({}),
3053
+ indicatorDate = new Date(),
3055
3054
  onToday,
3056
3055
  onAdvance,
3057
3056
  onRetreat,
@@ -3132,7 +3131,8 @@ const Timeline_Timeline_Timeline = _ref => {
3132
3131
  const endIndex = startIndex + dayRange;
3133
3132
  const filteredDates = startIndex !== -1 ? dates.slice(startIndex, Math.min(endIndex, dates.length)) : [];
3134
3133
  const today = programDate ? new Date(programDate) : new Date();
3135
- const todayIndex = filteredDates.findIndex(d => new Date(d.fullDate).toDateString() === today.toDateString());
3134
+ today.setDate(today.getDate() - 3);
3135
+ const todayIndex = filteredDates.findIndex(d => new Date(d.fullDate).toDateString() === new Date(indicatorDate).toDateString());
3136
3136
  const totalDays = filteredDates.length;
3137
3137
 
3138
3138
  // ---------------------------------------------------------
@@ -3152,8 +3152,8 @@ const Timeline_Timeline_Timeline = _ref => {
3152
3152
  setSelectedDate(new Date(newDate));
3153
3153
  };
3154
3154
  const handleToday = () => {
3155
- const today = new Date();
3156
- today.setDate(today.getDate() - 3); // Bugünden 3 gün öncesini ayarla
3155
+ const today = programDate ? new Date(programDate) : new Date();
3156
+ today.setDate(today.getDate() - 3); // Program tarihinden 3 gün öncesini ayarla
3157
3157
  setSelectedDate(today);
3158
3158
  };
3159
3159
  const handleAdvance = () => {
@@ -3245,7 +3245,7 @@ const Timeline_Timeline_Timeline = _ref => {
3245
3245
  events: localEvents,
3246
3246
  setEvents: setLocalEvents,
3247
3247
  onEventClick: onEventClick,
3248
- todayIndex: filteredDates.findIndex(d => new Date(d.fullDate).toDateString() === new Date().toDateString()),
3248
+ todayIndex: todayIndex,
3249
3249
  indicatorOn: indicatorOn,
3250
3250
  resourceSettings: resourceSettings,
3251
3251
  toggleGroupCollapse: toggleGroupCollapse,
@@ -2,12 +2,9 @@ import React from "react";
2
2
 
3
3
  const Indicator = ({ todayIndex, totalDays }) => {
4
4
  if (todayIndex < 0 || todayIndex >= totalDays) {
5
- console.log("Indicator not visible: Out of bounds");
6
5
  return null; // Bugün timeline dışında ise çizgiyi gösterme
7
6
  }
8
7
 
9
-
10
-
11
8
  return (
12
9
  <div
13
10
  style={{
@@ -44,8 +44,8 @@ const Timeline = ({
44
44
  tooltipComponent: TooltipComponent, // Özelleştirilebilir Tooltip bileşeni
45
45
  tempEventStyle = {},
46
46
  eventStyleResolver = () => ({}),
47
-
48
- onToday,
47
+ indicatorDate = new Date(),
48
+ onToday,
49
49
  onAdvance,
50
50
  onRetreat,
51
51
  onMonthAdvance,
@@ -125,10 +125,15 @@ const Timeline = ({
125
125
  const filteredDates =
126
126
  startIndex !== -1 ? dates.slice(startIndex, Math.min(endIndex, dates.length)) : [];
127
127
 
128
- const today = programDate ? new Date(programDate) : new Date();
129
- const todayIndex = filteredDates.findIndex(
130
- (d) => new Date(d.fullDate).toDateString() === today.toDateString()
131
- );
128
+ const today = programDate ? new Date(programDate) : new Date();
129
+ today.setDate(today.getDate() - 3);
130
+
131
+
132
+
133
+ const todayIndex = filteredDates.findIndex(
134
+ (d) => new Date(d.fullDate).toDateString() === new Date(indicatorDate).toDateString()
135
+ );
136
+
132
137
  const totalDays = filteredDates.length;
133
138
 
134
139
  // ---------------------------------------------------------
@@ -152,11 +157,12 @@ const Timeline = ({
152
157
  };
153
158
 
154
159
  const handleToday = () => {
155
- const today = new Date();
156
- today.setDate(today.getDate() - 3); // Bugünden 3 gün öncesini ayarla
160
+ const today = programDate ? new Date(programDate) : new Date();
161
+ today.setDate(today.getDate() - 3); // Program tarihinden 3 gün öncesini ayarla
157
162
  setSelectedDate(today);
158
163
  };
159
164
 
165
+
160
166
 
161
167
  const handleAdvance = () => {
162
168
  setSelectedDate((prev) => new Date(prev.getTime() + 5 * 24 * 60 * 60 * 1000));
@@ -262,9 +268,8 @@ const Timeline = ({
262
268
  events={localEvents}
263
269
  setEvents={setLocalEvents}
264
270
  onEventClick={onEventClick}
265
- todayIndex={filteredDates.findIndex(
266
- (d) => new Date(d.fullDate).toDateString() === new Date().toDateString()
267
- )}
271
+
272
+ todayIndex={todayIndex}
268
273
  indicatorOn={indicatorOn}
269
274
  resourceSettings={resourceSettings}
270
275
  toggleGroupCollapse={toggleGroupCollapse}
@@ -202,7 +202,6 @@ const TimelineContent = ({
202
202
  const newEndDate = new Date((originalEndDate ?? new Date()).getTime());
203
203
  newEndDate.setDate(newEndDate.getDate() + daysToAdd);
204
204
 
205
- console.log(">>> Extending ID:", extendingEvent.id, "=>", newEndDate);
206
205
 
207
206
  setEvents((prev) =>
208
207
  prev.map((evt) => (evt.id === extendingEvent.id ? { ...evt, endDate: newEndDate } : evt))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akfatimeline",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "A customizable timeline component for React applications",
5
5
  "main": "dist/Timeline.js",
6
6
  "module": "dist/Timeline.js",
package/src/App.js CHANGED
@@ -3,7 +3,7 @@ import Timeline from "./components/Timeline/Timeline";
3
3
  import EventTooltip from "./components/Timeline/EventTooltip"; // Tooltip bileşenini import ediyoruz
4
4
 
5
5
  const App = () => {
6
- const programDate = "2025-01-02";
6
+ const programDate = "2025-01-08";
7
7
 
8
8
  const events = [
9
9
  {
@@ -200,6 +200,8 @@ const resources = [
200
200
  setDropInfo={handleDropInfo} // Callback'i buradan bağlıyoruz
201
201
  onExtendInfo={handleExtendInfo} // Uzatma bilgisi
202
202
  onCreateEventInfo={handleCreateEventInfo} // Yeni etkinlik bilgisi
203
+ indicatorDate="2025-01-09" // İstediğiniz tarihi gönderin
204
+
203
205
  />
204
206
  </div>
205
207
  );
@@ -2,12 +2,9 @@ import React from "react";
2
2
 
3
3
  const Indicator = ({ todayIndex, totalDays }) => {
4
4
  if (todayIndex < 0 || todayIndex >= totalDays) {
5
- console.log("Indicator not visible: Out of bounds");
6
5
  return null; // Bugün timeline dışında ise çizgiyi gösterme
7
6
  }
8
7
 
9
-
10
-
11
8
  return (
12
9
  <div
13
10
  style={{
@@ -44,8 +44,8 @@ const Timeline = ({
44
44
  tooltipComponent: TooltipComponent, // Özelleştirilebilir Tooltip bileşeni
45
45
  tempEventStyle = {},
46
46
  eventStyleResolver = () => ({}),
47
-
48
- onToday,
47
+ indicatorDate = new Date(),
48
+ onToday,
49
49
  onAdvance,
50
50
  onRetreat,
51
51
  onMonthAdvance,
@@ -125,10 +125,15 @@ const Timeline = ({
125
125
  const filteredDates =
126
126
  startIndex !== -1 ? dates.slice(startIndex, Math.min(endIndex, dates.length)) : [];
127
127
 
128
- const today = programDate ? new Date(programDate) : new Date();
129
- const todayIndex = filteredDates.findIndex(
130
- (d) => new Date(d.fullDate).toDateString() === today.toDateString()
131
- );
128
+ const today = programDate ? new Date(programDate) : new Date();
129
+ today.setDate(today.getDate() - 3);
130
+
131
+
132
+
133
+ const todayIndex = filteredDates.findIndex(
134
+ (d) => new Date(d.fullDate).toDateString() === new Date(indicatorDate).toDateString()
135
+ );
136
+
132
137
  const totalDays = filteredDates.length;
133
138
 
134
139
  // ---------------------------------------------------------
@@ -152,11 +157,12 @@ const Timeline = ({
152
157
  };
153
158
 
154
159
  const handleToday = () => {
155
- const today = new Date();
156
- today.setDate(today.getDate() - 3); // Bugünden 3 gün öncesini ayarla
160
+ const today = programDate ? new Date(programDate) : new Date();
161
+ today.setDate(today.getDate() - 3); // Program tarihinden 3 gün öncesini ayarla
157
162
  setSelectedDate(today);
158
163
  };
159
164
 
165
+
160
166
 
161
167
  const handleAdvance = () => {
162
168
  setSelectedDate((prev) => new Date(prev.getTime() + 5 * 24 * 60 * 60 * 1000));
@@ -262,9 +268,8 @@ const Timeline = ({
262
268
  events={localEvents}
263
269
  setEvents={setLocalEvents}
264
270
  onEventClick={onEventClick}
265
- todayIndex={filteredDates.findIndex(
266
- (d) => new Date(d.fullDate).toDateString() === new Date().toDateString()
267
- )}
271
+
272
+ todayIndex={todayIndex}
268
273
  indicatorOn={indicatorOn}
269
274
  resourceSettings={resourceSettings}
270
275
  toggleGroupCollapse={toggleGroupCollapse}
@@ -202,7 +202,6 @@ const TimelineContent = ({
202
202
  const newEndDate = new Date((originalEndDate ?? new Date()).getTime());
203
203
  newEndDate.setDate(newEndDate.getDate() + daysToAdd);
204
204
 
205
- console.log(">>> Extending ID:", extendingEvent.id, "=>", newEndDate);
206
205
 
207
206
  setEvents((prev) =>
208
207
  prev.map((evt) => (evt.id === extendingEvent.id ? { ...evt, endDate: newEndDate } : evt))