akfatimeline 2.2.0 → 2.2.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/CHANGELOG.md +5 -0
- package/dist/Timeline.js +61 -42
- package/dist/components/Timeline/Timeline.jsx +8 -6
- package/dist/components/Timeline/TimelineContent.jsx +49 -31
- package/dist/hooks/useEventManagement.js +0 -1
- package/dist/hooks/useKeyboardShortcuts.js +4 -4
- package/package.json +2 -2
- package/src/App.js +13 -9
- package/src/components/Timeline/Timeline.jsx +8 -6
- package/src/components/Timeline/TimelineContent.jsx +49 -31
- package/src/hooks/useEventManagement.js +0 -1
- package/src/hooks/useKeyboardShortcuts.js +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.2.1] - 2025-12-29
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- NPM publish hatası düzeltildi (versiyon çakışması)
|
|
12
|
+
|
|
8
13
|
## [2.2.0] - 2025-12-29
|
|
9
14
|
|
|
10
15
|
### Added
|
package/dist/Timeline.js
CHANGED
|
@@ -3920,7 +3920,7 @@ const TimelineContent = _ref => {
|
|
|
3920
3920
|
|
|
3921
3921
|
// Past Date Protection
|
|
3922
3922
|
preventPastEvents = false,
|
|
3923
|
-
|
|
3923
|
+
preventPastEventsDate = null,
|
|
3924
3924
|
// Weekend Highlighting
|
|
3925
3925
|
highlightWeekends = false,
|
|
3926
3926
|
// Cell Tooltip
|
|
@@ -4090,12 +4090,12 @@ const TimelineContent = _ref => {
|
|
|
4090
4090
|
}
|
|
4091
4091
|
|
|
4092
4092
|
// Geçmiş tarih kontrolü
|
|
4093
|
-
if (preventPastEvents &&
|
|
4094
|
-
const
|
|
4093
|
+
if (preventPastEvents && preventPastEventsDate) {
|
|
4094
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
4095
4095
|
// Sadece tarih karşılaştırması (saat bilgisi olmadan)
|
|
4096
4096
|
const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
|
|
4097
|
-
const
|
|
4098
|
-
if (startDateOnly <
|
|
4097
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
4098
|
+
if (startDateOnly < preventPastEventsDateOnly) {
|
|
4099
4099
|
// Geçmiş tarihe tıklama engellendi
|
|
4100
4100
|
return;
|
|
4101
4101
|
}
|
|
@@ -4149,22 +4149,22 @@ const TimelineContent = _ref => {
|
|
|
4149
4149
|
const startCellIndex = (_tempEvent$startCellI = tempEvent.startCellIndex) !== null && _tempEvent$startCellI !== void 0 ? _tempEvent$startCellI : 0;
|
|
4150
4150
|
|
|
4151
4151
|
// Geçmiş tarih kontrolü - eğer aktifse, minimum tarihten önceki cell'lere gitmeyi engelle
|
|
4152
|
-
if (preventPastEvents &&
|
|
4152
|
+
if (preventPastEvents && preventPastEventsDate && dates[currentCellIndex]) {
|
|
4153
4153
|
const currentDate = parseDate(dates[currentCellIndex].fullDate);
|
|
4154
|
-
const
|
|
4154
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
4155
4155
|
const currentDateOnly = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
|
|
4156
|
-
const
|
|
4156
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
4157
4157
|
|
|
4158
4158
|
// Eğer geçmiş tarihe gidiyorsak, minimum tarihe sabitle
|
|
4159
|
-
if (currentDateOnly <
|
|
4159
|
+
if (currentDateOnly < preventPastEventsDateOnly) {
|
|
4160
4160
|
// Minimum tarihin cell index'ini bul
|
|
4161
|
-
const
|
|
4161
|
+
const preventPastEventsDateIndex = dates.findIndex(d => {
|
|
4162
4162
|
const dDate = parseDate(d.fullDate);
|
|
4163
4163
|
const dDateOnly = new Date(dDate.getFullYear(), dDate.getMonth(), dDate.getDate());
|
|
4164
|
-
return dDateOnly.getTime() ===
|
|
4164
|
+
return dDateOnly.getTime() === preventPastEventsDateOnly.getTime();
|
|
4165
4165
|
});
|
|
4166
|
-
if (
|
|
4167
|
-
currentCellIndex = Math.max(startCellIndex,
|
|
4166
|
+
if (preventPastEventsDateIndex !== -1) {
|
|
4167
|
+
currentCellIndex = Math.max(startCellIndex, preventPastEventsDateIndex);
|
|
4168
4168
|
} else {
|
|
4169
4169
|
currentCellIndex = startCellIndex; // Minimum tarih bulunamazsa başlangıç pozisyonuna dön
|
|
4170
4170
|
}
|
|
@@ -4208,27 +4208,27 @@ const TimelineContent = _ref => {
|
|
|
4208
4208
|
}
|
|
4209
4209
|
|
|
4210
4210
|
// Geçmiş tarih kontrolü - geçmiş tarihlere event uzamasını engelle (disabled kontrolünden sonra)
|
|
4211
|
-
if (preventPastEvents &&
|
|
4211
|
+
if (preventPastEvents && preventPastEventsDate && dates[currentCellIndex]) {
|
|
4212
4212
|
const currentDate = parseDate(dates[currentCellIndex].fullDate);
|
|
4213
|
-
const
|
|
4213
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
4214
4214
|
const currentDateOnly = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
|
|
4215
|
-
const
|
|
4215
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
4216
4216
|
|
|
4217
4217
|
// Eğer geçmiş tarihe gidiyorsak, son geçerli tarihe sabitle
|
|
4218
|
-
if (currentDateOnly <
|
|
4218
|
+
if (currentDateOnly < preventPastEventsDateOnly) {
|
|
4219
4219
|
// Minimum tarihin cell index'ini bul
|
|
4220
|
-
const
|
|
4220
|
+
const preventPastEventsDateIndex = dates.findIndex(d => {
|
|
4221
4221
|
const dDate = parseDate(d.fullDate);
|
|
4222
4222
|
const dDateOnly = new Date(dDate.getFullYear(), dDate.getMonth(), dDate.getDate());
|
|
4223
|
-
return dDateOnly.getTime() ===
|
|
4223
|
+
return dDateOnly.getTime() === preventPastEventsDateOnly.getTime();
|
|
4224
4224
|
});
|
|
4225
|
-
if (
|
|
4225
|
+
if (preventPastEventsDateIndex !== -1) {
|
|
4226
4226
|
// Başlangıç tarihinden önceki bir tarihe gidiyorsak, minimum tarihe sabitle
|
|
4227
4227
|
// Ama başlangıç tarihinden sonraki bir tarihe gidiyorsak, başlangıç tarihine sabitle
|
|
4228
4228
|
if (currentCellIndex < startCellIndex) {
|
|
4229
|
-
currentCellIndex = Math.max(startCellIndex,
|
|
4229
|
+
currentCellIndex = Math.max(startCellIndex, preventPastEventsDateIndex);
|
|
4230
4230
|
} else {
|
|
4231
|
-
currentCellIndex = Math.max(startCellIndex,
|
|
4231
|
+
currentCellIndex = Math.max(startCellIndex, preventPastEventsDateIndex);
|
|
4232
4232
|
}
|
|
4233
4233
|
} else {
|
|
4234
4234
|
currentCellIndex = startCellIndex; // Minimum tarih bulunamazsa başlangıç pozisyonuna dön
|
|
@@ -4273,7 +4273,7 @@ const TimelineContent = _ref => {
|
|
|
4273
4273
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
4274
4274
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
4275
4275
|
};
|
|
4276
|
-
}, [createNewEventOn, isCreating, mode, tempEvent, events, onCreateEventInfo, setEvents, totalDays, dates, preventPastEvents,
|
|
4276
|
+
}, [createNewEventOn, isCreating, mode, tempEvent, events, onCreateEventInfo, setEvents, totalDays, dates, preventPastEvents, preventPastEventsDate, disableDates, eventAlignmentMode]);
|
|
4277
4277
|
|
|
4278
4278
|
// ------------------- Drag Logic -------------------
|
|
4279
4279
|
const handleDragStartSafe = (e, eventId) => {
|
|
@@ -4462,12 +4462,21 @@ const TimelineContent = _ref => {
|
|
|
4462
4462
|
|
|
4463
4463
|
// Geçmiş tarih kontrolü
|
|
4464
4464
|
let isPastDate = false;
|
|
4465
|
-
if (preventPastEvents &&
|
|
4465
|
+
if (preventPastEvents && preventPastEventsDate) {
|
|
4466
4466
|
const cellDate = parseDate(dateObj.fullDate);
|
|
4467
|
-
const
|
|
4467
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
4468
4468
|
const cellDateOnly = new Date(cellDate.getFullYear(), cellDate.getMonth(), cellDate.getDate());
|
|
4469
|
-
const
|
|
4470
|
-
isPastDate = cellDateOnly <
|
|
4469
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
4470
|
+
isPastDate = cellDateOnly < preventPastEventsDateOnly;
|
|
4471
|
+
// Debug: İlk birkaç hücre için log
|
|
4472
|
+
if (colIndex < 3 && groupIndex === 0) {
|
|
4473
|
+
console.log('[TimelineContent] Past date check:', {
|
|
4474
|
+
cellDate: cellDateOnly.toISOString().split('T')[0],
|
|
4475
|
+
preventPastEventsDateValue: preventPastEventsDateOnly.toISOString().split('T')[0],
|
|
4476
|
+
isPastDate,
|
|
4477
|
+
preventPastEvents
|
|
4478
|
+
});
|
|
4479
|
+
}
|
|
4471
4480
|
}
|
|
4472
4481
|
|
|
4473
4482
|
// Disabled tarih kontrolü
|
|
@@ -4644,12 +4653,21 @@ const TimelineContent = _ref => {
|
|
|
4644
4653
|
}, tempEvent.title), dates.map((dateObj, colIndex) => {
|
|
4645
4654
|
// Geçmiş tarih kontrolü
|
|
4646
4655
|
let isPastDate = false;
|
|
4647
|
-
if (preventPastEvents &&
|
|
4656
|
+
if (preventPastEvents && preventPastEventsDate) {
|
|
4648
4657
|
const cellDate = parseDate(dateObj.fullDate);
|
|
4649
|
-
const
|
|
4658
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
4650
4659
|
const cellDateOnly = new Date(cellDate.getFullYear(), cellDate.getMonth(), cellDate.getDate());
|
|
4651
|
-
const
|
|
4652
|
-
isPastDate = cellDateOnly <
|
|
4660
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
4661
|
+
isPastDate = cellDateOnly < preventPastEventsDateOnly;
|
|
4662
|
+
// Debug: İlk birkaç hücre için log
|
|
4663
|
+
if (colIndex < 3 && rowIndex === 0 && groupIndex === 0) {
|
|
4664
|
+
console.log('[TimelineContent] Cell past date check:', {
|
|
4665
|
+
cellDate: cellDateOnly.toISOString().split('T')[0],
|
|
4666
|
+
preventPastEventsDateValue: preventPastEventsDateOnly.toISOString().split('T')[0],
|
|
4667
|
+
isPastDate,
|
|
4668
|
+
preventPastEvents
|
|
4669
|
+
});
|
|
4670
|
+
}
|
|
4653
4671
|
}
|
|
4654
4672
|
|
|
4655
4673
|
// Hafta sonu kontrolü
|
|
@@ -5420,8 +5438,8 @@ const useKeyboardShortcuts = _ref => {
|
|
|
5420
5438
|
keyMap = {},
|
|
5421
5439
|
enabled = true
|
|
5422
5440
|
} = _ref;
|
|
5423
|
-
// Default key mappings
|
|
5424
|
-
const defaultKeyMap = {
|
|
5441
|
+
// Default key mappings - useMemo ile sarmaladık
|
|
5442
|
+
const defaultKeyMap = (0,external_react_.useMemo)(() => ({
|
|
5425
5443
|
navigateLeft: keyMap.navigateLeft || 'ArrowLeft',
|
|
5426
5444
|
navigateRight: keyMap.navigateRight || 'ArrowRight',
|
|
5427
5445
|
navigateUp: keyMap.navigateUp || 'ArrowUp',
|
|
@@ -5451,7 +5469,7 @@ const useKeyboardShortcuts = _ref => {
|
|
|
5451
5469
|
key: '-',
|
|
5452
5470
|
ctrl: true
|
|
5453
5471
|
}
|
|
5454
|
-
};
|
|
5472
|
+
}), [keyMap]);
|
|
5455
5473
|
const handleKeyDown = (0,external_react_.useCallback)(e => {
|
|
5456
5474
|
if (!enabled) return;
|
|
5457
5475
|
const key = e.key;
|
|
@@ -5618,7 +5636,6 @@ const useEventManagement = function () {
|
|
|
5618
5636
|
let targetResourceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
5619
5637
|
if (copiedEvents.length === 0) return;
|
|
5620
5638
|
const newEvents = [...events];
|
|
5621
|
-
const baseDate = targetDate || new Date();
|
|
5622
5639
|
copiedEvents.forEach(event => {
|
|
5623
5640
|
const newEvent = useEventManagement_objectSpread(useEventManagement_objectSpread({}, event), {}, {
|
|
5624
5641
|
id: "".concat(event.id, "-copy-").concat(Date.now(), "-").concat(Math.random()),
|
|
@@ -5776,8 +5793,8 @@ const Timeline_Timeline_Timeline = _ref => {
|
|
|
5776
5793
|
// Past Date Protection
|
|
5777
5794
|
preventPastEvents = false,
|
|
5778
5795
|
// Geçmiş tarihlere rezervasyon oluşturmayı engelle
|
|
5779
|
-
|
|
5780
|
-
//
|
|
5796
|
+
preventPastEventsDate = null,
|
|
5797
|
+
// Geçmiş tarih koruması için minimum tarih (programDate ve indicatorDate'ten bağımsız)
|
|
5781
5798
|
|
|
5782
5799
|
// Weekend Highlighting
|
|
5783
5800
|
highlightWeekends = false,
|
|
@@ -5889,10 +5906,12 @@ const Timeline_Timeline_Timeline = _ref => {
|
|
|
5889
5906
|
});
|
|
5890
5907
|
const [localEvents, setLocalEvents] = (0,external_react_.useState)(events);
|
|
5891
5908
|
|
|
5892
|
-
//
|
|
5893
|
-
|
|
5894
|
-
const
|
|
5895
|
-
|
|
5909
|
+
// setDropInfo - eğer external yoksa no-op fonksiyon kullan
|
|
5910
|
+
// Not: internalDropInfo state'i kaldırıldı çünkü dropInfo hiçbir yerde okunmuyor
|
|
5911
|
+
const setDropInfo = externalSetDropInfo || (() => {
|
|
5912
|
+
// No-op: Eğer parent'tan setDropInfo gelmezse, hiçbir şey yapma
|
|
5913
|
+
console.warn('[Timeline] setDropInfo called but no external handler provided');
|
|
5914
|
+
});
|
|
5896
5915
|
|
|
5897
5916
|
// Update local events when events prop changes
|
|
5898
5917
|
(0,external_react_.useEffect)(() => {
|
|
@@ -6196,7 +6215,7 @@ const Timeline_Timeline_Timeline = _ref => {
|
|
|
6196
6215
|
eventStyleResolver: eventStyleResolver,
|
|
6197
6216
|
eventAlignmentMode: eventAlignmentMode,
|
|
6198
6217
|
preventPastEvents: preventPastEvents,
|
|
6199
|
-
|
|
6218
|
+
preventPastEventsDate: preventPastEventsDate || (preventPastEvents ? new Date().toISOString().split('T')[0] : null),
|
|
6200
6219
|
highlightWeekends: highlightWeekends,
|
|
6201
6220
|
cellTooltipOn: cellTooltipOn,
|
|
6202
6221
|
cellTooltipResolver: cellTooltipResolver,
|
|
@@ -73,7 +73,7 @@ const Timeline = ({
|
|
|
73
73
|
|
|
74
74
|
// Past Date Protection
|
|
75
75
|
preventPastEvents = false, // Geçmiş tarihlere rezervasyon oluşturmayı engelle
|
|
76
|
-
|
|
76
|
+
preventPastEventsDate = null, // Geçmiş tarih koruması için minimum tarih (programDate ve indicatorDate'ten bağımsız)
|
|
77
77
|
|
|
78
78
|
// Weekend Highlighting
|
|
79
79
|
highlightWeekends = false, // Hafta sonlarını farklı renkte göster
|
|
@@ -166,10 +166,12 @@ const Timeline = ({
|
|
|
166
166
|
|
|
167
167
|
const [localEvents, setLocalEvents] = useState(events);
|
|
168
168
|
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
169
|
+
// setDropInfo - eğer external yoksa no-op fonksiyon kullan
|
|
170
|
+
// Not: internalDropInfo state'i kaldırıldı çünkü dropInfo hiçbir yerde okunmuyor
|
|
171
|
+
const setDropInfo = externalSetDropInfo || (() => {
|
|
172
|
+
// No-op: Eğer parent'tan setDropInfo gelmezse, hiçbir şey yapma
|
|
173
|
+
console.warn('[Timeline] setDropInfo called but no external handler provided');
|
|
174
|
+
});
|
|
173
175
|
|
|
174
176
|
// Update local events when events prop changes
|
|
175
177
|
useEffect(() => {
|
|
@@ -507,7 +509,7 @@ const Timeline = ({
|
|
|
507
509
|
eventStyleResolver={eventStyleResolver}
|
|
508
510
|
eventAlignmentMode={eventAlignmentMode}
|
|
509
511
|
preventPastEvents={preventPastEvents}
|
|
510
|
-
|
|
512
|
+
preventPastEventsDate={preventPastEventsDate || (preventPastEvents ? new Date().toISOString().split('T')[0] : null)}
|
|
511
513
|
highlightWeekends={highlightWeekends}
|
|
512
514
|
cellTooltipOn={cellTooltipOn}
|
|
513
515
|
cellTooltipResolver={cellTooltipResolver}
|
|
@@ -44,7 +44,7 @@ const TimelineContent = ({
|
|
|
44
44
|
|
|
45
45
|
// Past Date Protection
|
|
46
46
|
preventPastEvents = false,
|
|
47
|
-
|
|
47
|
+
preventPastEventsDate = null,
|
|
48
48
|
|
|
49
49
|
// Weekend Highlighting
|
|
50
50
|
highlightWeekends = false,
|
|
@@ -210,13 +210,13 @@ const TimelineContent = ({
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
// Geçmiş tarih kontrolü
|
|
213
|
-
if (preventPastEvents &&
|
|
214
|
-
const
|
|
213
|
+
if (preventPastEvents && preventPastEventsDate) {
|
|
214
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
215
215
|
// Sadece tarih karşılaştırması (saat bilgisi olmadan)
|
|
216
216
|
const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
|
|
217
|
-
const
|
|
217
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
218
218
|
|
|
219
|
-
if (startDateOnly <
|
|
219
|
+
if (startDateOnly < preventPastEventsDateOnly) {
|
|
220
220
|
// Geçmiş tarihe tıklama engellendi
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
@@ -272,22 +272,22 @@ const TimelineContent = ({
|
|
|
272
272
|
const startCellIndex = tempEvent.startCellIndex ?? 0;
|
|
273
273
|
|
|
274
274
|
// Geçmiş tarih kontrolü - eğer aktifse, minimum tarihten önceki cell'lere gitmeyi engelle
|
|
275
|
-
if (preventPastEvents &&
|
|
275
|
+
if (preventPastEvents && preventPastEventsDate && dates[currentCellIndex]) {
|
|
276
276
|
const currentDate = parseDate(dates[currentCellIndex].fullDate);
|
|
277
|
-
const
|
|
277
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
278
278
|
const currentDateOnly = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
|
|
279
|
-
const
|
|
279
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
280
280
|
|
|
281
281
|
// Eğer geçmiş tarihe gidiyorsak, minimum tarihe sabitle
|
|
282
|
-
if (currentDateOnly <
|
|
282
|
+
if (currentDateOnly < preventPastEventsDateOnly) {
|
|
283
283
|
// Minimum tarihin cell index'ini bul
|
|
284
|
-
const
|
|
284
|
+
const preventPastEventsDateIndex = dates.findIndex((d) => {
|
|
285
285
|
const dDate = parseDate(d.fullDate);
|
|
286
286
|
const dDateOnly = new Date(dDate.getFullYear(), dDate.getMonth(), dDate.getDate());
|
|
287
|
-
return dDateOnly.getTime() ===
|
|
287
|
+
return dDateOnly.getTime() === preventPastEventsDateOnly.getTime();
|
|
288
288
|
});
|
|
289
|
-
if (
|
|
290
|
-
currentCellIndex = Math.max(startCellIndex,
|
|
289
|
+
if (preventPastEventsDateIndex !== -1) {
|
|
290
|
+
currentCellIndex = Math.max(startCellIndex, preventPastEventsDateIndex);
|
|
291
291
|
} else {
|
|
292
292
|
currentCellIndex = startCellIndex; // Minimum tarih bulunamazsa başlangıç pozisyonuna dön
|
|
293
293
|
}
|
|
@@ -334,27 +334,27 @@ const TimelineContent = ({
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
// Geçmiş tarih kontrolü - geçmiş tarihlere event uzamasını engelle (disabled kontrolünden sonra)
|
|
337
|
-
if (preventPastEvents &&
|
|
337
|
+
if (preventPastEvents && preventPastEventsDate && dates[currentCellIndex]) {
|
|
338
338
|
const currentDate = parseDate(dates[currentCellIndex].fullDate);
|
|
339
|
-
const
|
|
339
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
340
340
|
const currentDateOnly = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
|
|
341
|
-
const
|
|
341
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
342
342
|
|
|
343
343
|
// Eğer geçmiş tarihe gidiyorsak, son geçerli tarihe sabitle
|
|
344
|
-
if (currentDateOnly <
|
|
344
|
+
if (currentDateOnly < preventPastEventsDateOnly) {
|
|
345
345
|
// Minimum tarihin cell index'ini bul
|
|
346
|
-
const
|
|
346
|
+
const preventPastEventsDateIndex = dates.findIndex((d) => {
|
|
347
347
|
const dDate = parseDate(d.fullDate);
|
|
348
348
|
const dDateOnly = new Date(dDate.getFullYear(), dDate.getMonth(), dDate.getDate());
|
|
349
|
-
return dDateOnly.getTime() ===
|
|
349
|
+
return dDateOnly.getTime() === preventPastEventsDateOnly.getTime();
|
|
350
350
|
});
|
|
351
|
-
if (
|
|
351
|
+
if (preventPastEventsDateIndex !== -1) {
|
|
352
352
|
// Başlangıç tarihinden önceki bir tarihe gidiyorsak, minimum tarihe sabitle
|
|
353
353
|
// Ama başlangıç tarihinden sonraki bir tarihe gidiyorsak, başlangıç tarihine sabitle
|
|
354
354
|
if (currentCellIndex < startCellIndex) {
|
|
355
|
-
currentCellIndex = Math.max(startCellIndex,
|
|
355
|
+
currentCellIndex = Math.max(startCellIndex, preventPastEventsDateIndex);
|
|
356
356
|
} else {
|
|
357
|
-
currentCellIndex = Math.max(startCellIndex,
|
|
357
|
+
currentCellIndex = Math.max(startCellIndex, preventPastEventsDateIndex);
|
|
358
358
|
}
|
|
359
359
|
} else {
|
|
360
360
|
currentCellIndex = startCellIndex; // Minimum tarih bulunamazsa başlangıç pozisyonuna dön
|
|
@@ -404,7 +404,7 @@ const TimelineContent = ({
|
|
|
404
404
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
405
405
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
406
406
|
};
|
|
407
|
-
}, [createNewEventOn, isCreating, mode, tempEvent, events, onCreateEventInfo, setEvents, totalDays, dates, preventPastEvents,
|
|
407
|
+
}, [createNewEventOn, isCreating, mode, tempEvent, events, onCreateEventInfo, setEvents, totalDays, dates, preventPastEvents, preventPastEventsDate, disableDates, eventAlignmentMode]);
|
|
408
408
|
|
|
409
409
|
// ------------------- Drag Logic -------------------
|
|
410
410
|
const handleDragStartSafe = (e, eventId) => {
|
|
@@ -614,12 +614,21 @@ const TimelineContent = ({
|
|
|
614
614
|
|
|
615
615
|
// Geçmiş tarih kontrolü
|
|
616
616
|
let isPastDate = false;
|
|
617
|
-
if (preventPastEvents &&
|
|
617
|
+
if (preventPastEvents && preventPastEventsDate) {
|
|
618
618
|
const cellDate = parseDate(dateObj.fullDate);
|
|
619
|
-
const
|
|
619
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
620
620
|
const cellDateOnly = new Date(cellDate.getFullYear(), cellDate.getMonth(), cellDate.getDate());
|
|
621
|
-
const
|
|
622
|
-
isPastDate = cellDateOnly <
|
|
621
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
622
|
+
isPastDate = cellDateOnly < preventPastEventsDateOnly;
|
|
623
|
+
// Debug: İlk birkaç hücre için log
|
|
624
|
+
if (colIndex < 3 && groupIndex === 0) {
|
|
625
|
+
console.log('[TimelineContent] Past date check:', {
|
|
626
|
+
cellDate: cellDateOnly.toISOString().split('T')[0],
|
|
627
|
+
preventPastEventsDateValue: preventPastEventsDateOnly.toISOString().split('T')[0],
|
|
628
|
+
isPastDate,
|
|
629
|
+
preventPastEvents
|
|
630
|
+
});
|
|
631
|
+
}
|
|
623
632
|
}
|
|
624
633
|
|
|
625
634
|
// Disabled tarih kontrolü
|
|
@@ -831,12 +840,21 @@ const TimelineContent = ({
|
|
|
831
840
|
{dates.map((dateObj, colIndex) => {
|
|
832
841
|
// Geçmiş tarih kontrolü
|
|
833
842
|
let isPastDate = false;
|
|
834
|
-
if (preventPastEvents &&
|
|
843
|
+
if (preventPastEvents && preventPastEventsDate) {
|
|
835
844
|
const cellDate = parseDate(dateObj.fullDate);
|
|
836
|
-
const
|
|
845
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
837
846
|
const cellDateOnly = new Date(cellDate.getFullYear(), cellDate.getMonth(), cellDate.getDate());
|
|
838
|
-
const
|
|
839
|
-
isPastDate = cellDateOnly <
|
|
847
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
848
|
+
isPastDate = cellDateOnly < preventPastEventsDateOnly;
|
|
849
|
+
// Debug: İlk birkaç hücre için log
|
|
850
|
+
if (colIndex < 3 && rowIndex === 0 && groupIndex === 0) {
|
|
851
|
+
console.log('[TimelineContent] Cell past date check:', {
|
|
852
|
+
cellDate: cellDateOnly.toISOString().split('T')[0],
|
|
853
|
+
preventPastEventsDateValue: preventPastEventsDateOnly.toISOString().split('T')[0],
|
|
854
|
+
isPastDate,
|
|
855
|
+
preventPastEvents
|
|
856
|
+
});
|
|
857
|
+
}
|
|
840
858
|
}
|
|
841
859
|
|
|
842
860
|
// Hafta sonu kontrolü
|
|
@@ -92,7 +92,6 @@ const useEventManagement = (initialEvents = [], onEventsChange = null, maxHistor
|
|
|
92
92
|
if (copiedEvents.length === 0) return;
|
|
93
93
|
|
|
94
94
|
const newEvents = [...events];
|
|
95
|
-
const baseDate = targetDate || new Date();
|
|
96
95
|
|
|
97
96
|
copiedEvents.forEach((event) => {
|
|
98
97
|
const newEvent = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useCallback } from 'react';
|
|
1
|
+
import { useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Keyboard shortcuts hook
|
|
@@ -32,8 +32,8 @@ const useKeyboardShortcuts = ({
|
|
|
32
32
|
keyMap = {},
|
|
33
33
|
enabled = true,
|
|
34
34
|
}) => {
|
|
35
|
-
// Default key mappings
|
|
36
|
-
const defaultKeyMap = {
|
|
35
|
+
// Default key mappings - useMemo ile sarmaladık
|
|
36
|
+
const defaultKeyMap = useMemo(() => ({
|
|
37
37
|
navigateLeft: keyMap.navigateLeft || 'ArrowLeft',
|
|
38
38
|
navigateRight: keyMap.navigateRight || 'ArrowRight',
|
|
39
39
|
navigateUp: keyMap.navigateUp || 'ArrowUp',
|
|
@@ -45,7 +45,7 @@ const useKeyboardShortcuts = ({
|
|
|
45
45
|
paste: keyMap.paste || { key: 'v', ctrl: true },
|
|
46
46
|
zoomIn: keyMap.zoomIn || { key: '=', ctrl: true },
|
|
47
47
|
zoomOut: keyMap.zoomOut || { key: '-', ctrl: true },
|
|
48
|
-
};
|
|
48
|
+
}), [keyMap]);
|
|
49
49
|
|
|
50
50
|
const handleKeyDown = useCallback(
|
|
51
51
|
(e) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "akfatimeline",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "A customizable timeline component for React applications with disableDates, custom header buttons, and past date protection features",
|
|
5
5
|
"main": "./src/library.js",
|
|
6
6
|
"module": "./src/library.js",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"akfatimeline": "^2.
|
|
73
|
+
"akfatimeline": "^2.2.1",
|
|
74
74
|
"react": "^19.2.3",
|
|
75
75
|
"react-dom": "^19.2.3",
|
|
76
76
|
"react-scripts": "^5.0.1",
|
package/src/App.js
CHANGED
|
@@ -14,13 +14,22 @@ const App = () => {
|
|
|
14
14
|
date.setDate(date.getDate() - 3); // 3 gün öncesinden başla
|
|
15
15
|
return date.toISOString().split('T')[0]; // YYYY-MM-DD formatı
|
|
16
16
|
});
|
|
17
|
+
|
|
18
|
+
// Geçmiş tarih koruması için minimum tarih (programDate ve indicatorDate'ten bağımsız)
|
|
19
|
+
// Örnek: Bugünden 5 gün sonrasına kadar geçmiş tarih koruması yok
|
|
20
|
+
// const preventPastEventsDateForProtection = new Date();
|
|
21
|
+
// preventPastEventsDateForProtection.setDate(preventPastEventsDateForProtection.getDate() + 5);
|
|
22
|
+
// const preventPastEventsDateString = preventPastEventsDateForProtection.toISOString().split('T')[0];
|
|
23
|
+
|
|
24
|
+
// Veya sadece bugünün tarihi (varsayılan):
|
|
25
|
+
const preventPastEventsDateString = new Date().toISOString().split('T')[0];
|
|
17
26
|
|
|
18
27
|
const [dayRange, setDayRange] = useState(30);
|
|
19
28
|
const [themeType, setThemeType] = useState("dark");
|
|
20
29
|
const [eventAlignmentMode, setEventAlignmentMode] = useState("center"); // "center" | "full"
|
|
21
30
|
const [zoomLevel, setZoomLevel] = useState(1.0); // Zoom seviyesi (1.0 = %100)
|
|
22
31
|
const [selectedResource, setSelectedResource] = useState(null); // Autocomplete için seçili değer
|
|
23
|
-
const [cellContextMenuOn
|
|
32
|
+
const [cellContextMenuOn] = useState(true); // Cell context menu açık/kapalı
|
|
24
33
|
|
|
25
34
|
// Event Management ve Keyboard Shortcuts
|
|
26
35
|
const [eventManagementOn, setEventManagementOn] = useState(true);
|
|
@@ -361,12 +370,7 @@ const resources = [
|
|
|
361
370
|
setProgramDate(currentDate.toISOString().split('T')[0]);
|
|
362
371
|
};
|
|
363
372
|
|
|
364
|
-
|
|
365
|
-
// İstenilen tarihe git (Timeline'dan gelen tarih seçimi)
|
|
366
|
-
const date = new Date(selectedDate);
|
|
367
|
-
date.setDate(date.getDate() - 3); // 3 gün öncesinden başla
|
|
368
|
-
setProgramDate(date.toISOString().split('T')[0]);
|
|
369
|
-
};
|
|
373
|
+
// handleDateSelect kaldırıldı - Timeline'ın kendi handleDateChange'i kullanılıyor
|
|
370
374
|
|
|
371
375
|
const handleDropInfo = (dropInfo) => {
|
|
372
376
|
console.log("Event dropped with info:", dropInfo);
|
|
@@ -477,10 +481,10 @@ const resources = [
|
|
|
477
481
|
setDropInfo={handleDropInfo} // Callback'i buradan bağlıyoruz
|
|
478
482
|
onExtendInfo={handleExtendInfo} // Uzatma bilgisi
|
|
479
483
|
onCreateEventInfo={handleCreateEventInfo} // Yeni etkinlik bilgisi
|
|
480
|
-
indicatorDate={programDate} //
|
|
484
|
+
indicatorDate={programDate} // Timeline'ın gösterileceği tarih (programDate state'i)
|
|
481
485
|
eventAlignmentMode={eventAlignmentMode}
|
|
482
486
|
preventPastEvents={true} // Geçmiş tarihlere rezervasyon oluşturmayı engelle
|
|
483
|
-
|
|
487
|
+
preventPastEventsDate={programDate} // Geçmiş tarih koruması için minimum tarih (programDate ve indicatorDate'ten bağımsız)
|
|
484
488
|
highlightWeekends={true} // Hafta sonlarını farklı renkte göster
|
|
485
489
|
cellTooltipOn={true} // Cell tooltip'lerini aktif et
|
|
486
490
|
cellTooltipResolver={getCellTooltipContent} // Fiyat bilgisi göster
|
|
@@ -73,7 +73,7 @@ const Timeline = ({
|
|
|
73
73
|
|
|
74
74
|
// Past Date Protection
|
|
75
75
|
preventPastEvents = false, // Geçmiş tarihlere rezervasyon oluşturmayı engelle
|
|
76
|
-
|
|
76
|
+
preventPastEventsDate = null, // Geçmiş tarih koruması için minimum tarih (programDate ve indicatorDate'ten bağımsız)
|
|
77
77
|
|
|
78
78
|
// Weekend Highlighting
|
|
79
79
|
highlightWeekends = false, // Hafta sonlarını farklı renkte göster
|
|
@@ -166,10 +166,12 @@ const Timeline = ({
|
|
|
166
166
|
|
|
167
167
|
const [localEvents, setLocalEvents] = useState(events);
|
|
168
168
|
|
|
169
|
-
//
|
|
170
|
-
|
|
171
|
-
const
|
|
172
|
-
|
|
169
|
+
// setDropInfo - eğer external yoksa no-op fonksiyon kullan
|
|
170
|
+
// Not: internalDropInfo state'i kaldırıldı çünkü dropInfo hiçbir yerde okunmuyor
|
|
171
|
+
const setDropInfo = externalSetDropInfo || (() => {
|
|
172
|
+
// No-op: Eğer parent'tan setDropInfo gelmezse, hiçbir şey yapma
|
|
173
|
+
console.warn('[Timeline] setDropInfo called but no external handler provided');
|
|
174
|
+
});
|
|
173
175
|
|
|
174
176
|
// Update local events when events prop changes
|
|
175
177
|
useEffect(() => {
|
|
@@ -507,7 +509,7 @@ const Timeline = ({
|
|
|
507
509
|
eventStyleResolver={eventStyleResolver}
|
|
508
510
|
eventAlignmentMode={eventAlignmentMode}
|
|
509
511
|
preventPastEvents={preventPastEvents}
|
|
510
|
-
|
|
512
|
+
preventPastEventsDate={preventPastEventsDate || (preventPastEvents ? new Date().toISOString().split('T')[0] : null)}
|
|
511
513
|
highlightWeekends={highlightWeekends}
|
|
512
514
|
cellTooltipOn={cellTooltipOn}
|
|
513
515
|
cellTooltipResolver={cellTooltipResolver}
|
|
@@ -44,7 +44,7 @@ const TimelineContent = ({
|
|
|
44
44
|
|
|
45
45
|
// Past Date Protection
|
|
46
46
|
preventPastEvents = false,
|
|
47
|
-
|
|
47
|
+
preventPastEventsDate = null,
|
|
48
48
|
|
|
49
49
|
// Weekend Highlighting
|
|
50
50
|
highlightWeekends = false,
|
|
@@ -210,13 +210,13 @@ const TimelineContent = ({
|
|
|
210
210
|
}
|
|
211
211
|
|
|
212
212
|
// Geçmiş tarih kontrolü
|
|
213
|
-
if (preventPastEvents &&
|
|
214
|
-
const
|
|
213
|
+
if (preventPastEvents && preventPastEventsDate) {
|
|
214
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
215
215
|
// Sadece tarih karşılaştırması (saat bilgisi olmadan)
|
|
216
216
|
const startDateOnly = new Date(startDate.getFullYear(), startDate.getMonth(), startDate.getDate());
|
|
217
|
-
const
|
|
217
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
218
218
|
|
|
219
|
-
if (startDateOnly <
|
|
219
|
+
if (startDateOnly < preventPastEventsDateOnly) {
|
|
220
220
|
// Geçmiş tarihe tıklama engellendi
|
|
221
221
|
return;
|
|
222
222
|
}
|
|
@@ -272,22 +272,22 @@ const TimelineContent = ({
|
|
|
272
272
|
const startCellIndex = tempEvent.startCellIndex ?? 0;
|
|
273
273
|
|
|
274
274
|
// Geçmiş tarih kontrolü - eğer aktifse, minimum tarihten önceki cell'lere gitmeyi engelle
|
|
275
|
-
if (preventPastEvents &&
|
|
275
|
+
if (preventPastEvents && preventPastEventsDate && dates[currentCellIndex]) {
|
|
276
276
|
const currentDate = parseDate(dates[currentCellIndex].fullDate);
|
|
277
|
-
const
|
|
277
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
278
278
|
const currentDateOnly = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
|
|
279
|
-
const
|
|
279
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
280
280
|
|
|
281
281
|
// Eğer geçmiş tarihe gidiyorsak, minimum tarihe sabitle
|
|
282
|
-
if (currentDateOnly <
|
|
282
|
+
if (currentDateOnly < preventPastEventsDateOnly) {
|
|
283
283
|
// Minimum tarihin cell index'ini bul
|
|
284
|
-
const
|
|
284
|
+
const preventPastEventsDateIndex = dates.findIndex((d) => {
|
|
285
285
|
const dDate = parseDate(d.fullDate);
|
|
286
286
|
const dDateOnly = new Date(dDate.getFullYear(), dDate.getMonth(), dDate.getDate());
|
|
287
|
-
return dDateOnly.getTime() ===
|
|
287
|
+
return dDateOnly.getTime() === preventPastEventsDateOnly.getTime();
|
|
288
288
|
});
|
|
289
|
-
if (
|
|
290
|
-
currentCellIndex = Math.max(startCellIndex,
|
|
289
|
+
if (preventPastEventsDateIndex !== -1) {
|
|
290
|
+
currentCellIndex = Math.max(startCellIndex, preventPastEventsDateIndex);
|
|
291
291
|
} else {
|
|
292
292
|
currentCellIndex = startCellIndex; // Minimum tarih bulunamazsa başlangıç pozisyonuna dön
|
|
293
293
|
}
|
|
@@ -334,27 +334,27 @@ const TimelineContent = ({
|
|
|
334
334
|
}
|
|
335
335
|
|
|
336
336
|
// Geçmiş tarih kontrolü - geçmiş tarihlere event uzamasını engelle (disabled kontrolünden sonra)
|
|
337
|
-
if (preventPastEvents &&
|
|
337
|
+
if (preventPastEvents && preventPastEventsDate && dates[currentCellIndex]) {
|
|
338
338
|
const currentDate = parseDate(dates[currentCellIndex].fullDate);
|
|
339
|
-
const
|
|
339
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
340
340
|
const currentDateOnly = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
|
|
341
|
-
const
|
|
341
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
342
342
|
|
|
343
343
|
// Eğer geçmiş tarihe gidiyorsak, son geçerli tarihe sabitle
|
|
344
|
-
if (currentDateOnly <
|
|
344
|
+
if (currentDateOnly < preventPastEventsDateOnly) {
|
|
345
345
|
// Minimum tarihin cell index'ini bul
|
|
346
|
-
const
|
|
346
|
+
const preventPastEventsDateIndex = dates.findIndex((d) => {
|
|
347
347
|
const dDate = parseDate(d.fullDate);
|
|
348
348
|
const dDateOnly = new Date(dDate.getFullYear(), dDate.getMonth(), dDate.getDate());
|
|
349
|
-
return dDateOnly.getTime() ===
|
|
349
|
+
return dDateOnly.getTime() === preventPastEventsDateOnly.getTime();
|
|
350
350
|
});
|
|
351
|
-
if (
|
|
351
|
+
if (preventPastEventsDateIndex !== -1) {
|
|
352
352
|
// Başlangıç tarihinden önceki bir tarihe gidiyorsak, minimum tarihe sabitle
|
|
353
353
|
// Ama başlangıç tarihinden sonraki bir tarihe gidiyorsak, başlangıç tarihine sabitle
|
|
354
354
|
if (currentCellIndex < startCellIndex) {
|
|
355
|
-
currentCellIndex = Math.max(startCellIndex,
|
|
355
|
+
currentCellIndex = Math.max(startCellIndex, preventPastEventsDateIndex);
|
|
356
356
|
} else {
|
|
357
|
-
currentCellIndex = Math.max(startCellIndex,
|
|
357
|
+
currentCellIndex = Math.max(startCellIndex, preventPastEventsDateIndex);
|
|
358
358
|
}
|
|
359
359
|
} else {
|
|
360
360
|
currentCellIndex = startCellIndex; // Minimum tarih bulunamazsa başlangıç pozisyonuna dön
|
|
@@ -404,7 +404,7 @@ const TimelineContent = ({
|
|
|
404
404
|
window.removeEventListener("mousemove", handleMouseMove);
|
|
405
405
|
window.removeEventListener("mouseup", handleMouseUp);
|
|
406
406
|
};
|
|
407
|
-
}, [createNewEventOn, isCreating, mode, tempEvent, events, onCreateEventInfo, setEvents, totalDays, dates, preventPastEvents,
|
|
407
|
+
}, [createNewEventOn, isCreating, mode, tempEvent, events, onCreateEventInfo, setEvents, totalDays, dates, preventPastEvents, preventPastEventsDate, disableDates, eventAlignmentMode]);
|
|
408
408
|
|
|
409
409
|
// ------------------- Drag Logic -------------------
|
|
410
410
|
const handleDragStartSafe = (e, eventId) => {
|
|
@@ -614,12 +614,21 @@ const TimelineContent = ({
|
|
|
614
614
|
|
|
615
615
|
// Geçmiş tarih kontrolü
|
|
616
616
|
let isPastDate = false;
|
|
617
|
-
if (preventPastEvents &&
|
|
617
|
+
if (preventPastEvents && preventPastEventsDate) {
|
|
618
618
|
const cellDate = parseDate(dateObj.fullDate);
|
|
619
|
-
const
|
|
619
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
620
620
|
const cellDateOnly = new Date(cellDate.getFullYear(), cellDate.getMonth(), cellDate.getDate());
|
|
621
|
-
const
|
|
622
|
-
isPastDate = cellDateOnly <
|
|
621
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
622
|
+
isPastDate = cellDateOnly < preventPastEventsDateOnly;
|
|
623
|
+
// Debug: İlk birkaç hücre için log
|
|
624
|
+
if (colIndex < 3 && groupIndex === 0) {
|
|
625
|
+
console.log('[TimelineContent] Past date check:', {
|
|
626
|
+
cellDate: cellDateOnly.toISOString().split('T')[0],
|
|
627
|
+
preventPastEventsDateValue: preventPastEventsDateOnly.toISOString().split('T')[0],
|
|
628
|
+
isPastDate,
|
|
629
|
+
preventPastEvents
|
|
630
|
+
});
|
|
631
|
+
}
|
|
623
632
|
}
|
|
624
633
|
|
|
625
634
|
// Disabled tarih kontrolü
|
|
@@ -831,12 +840,21 @@ const TimelineContent = ({
|
|
|
831
840
|
{dates.map((dateObj, colIndex) => {
|
|
832
841
|
// Geçmiş tarih kontrolü
|
|
833
842
|
let isPastDate = false;
|
|
834
|
-
if (preventPastEvents &&
|
|
843
|
+
if (preventPastEvents && preventPastEventsDate) {
|
|
835
844
|
const cellDate = parseDate(dateObj.fullDate);
|
|
836
|
-
const
|
|
845
|
+
const preventPastEventsDateObj = parseDate(preventPastEventsDate);
|
|
837
846
|
const cellDateOnly = new Date(cellDate.getFullYear(), cellDate.getMonth(), cellDate.getDate());
|
|
838
|
-
const
|
|
839
|
-
isPastDate = cellDateOnly <
|
|
847
|
+
const preventPastEventsDateOnly = new Date(preventPastEventsDateObj.getFullYear(), preventPastEventsDateObj.getMonth(), preventPastEventsDateObj.getDate());
|
|
848
|
+
isPastDate = cellDateOnly < preventPastEventsDateOnly;
|
|
849
|
+
// Debug: İlk birkaç hücre için log
|
|
850
|
+
if (colIndex < 3 && rowIndex === 0 && groupIndex === 0) {
|
|
851
|
+
console.log('[TimelineContent] Cell past date check:', {
|
|
852
|
+
cellDate: cellDateOnly.toISOString().split('T')[0],
|
|
853
|
+
preventPastEventsDateValue: preventPastEventsDateOnly.toISOString().split('T')[0],
|
|
854
|
+
isPastDate,
|
|
855
|
+
preventPastEvents
|
|
856
|
+
});
|
|
857
|
+
}
|
|
840
858
|
}
|
|
841
859
|
|
|
842
860
|
// Hafta sonu kontrolü
|
|
@@ -92,7 +92,6 @@ const useEventManagement = (initialEvents = [], onEventsChange = null, maxHistor
|
|
|
92
92
|
if (copiedEvents.length === 0) return;
|
|
93
93
|
|
|
94
94
|
const newEvents = [...events];
|
|
95
|
-
const baseDate = targetDate || new Date();
|
|
96
95
|
|
|
97
96
|
copiedEvents.forEach((event) => {
|
|
98
97
|
const newEvent = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useCallback } from 'react';
|
|
1
|
+
import { useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Keyboard shortcuts hook
|
|
@@ -32,8 +32,8 @@ const useKeyboardShortcuts = ({
|
|
|
32
32
|
keyMap = {},
|
|
33
33
|
enabled = true,
|
|
34
34
|
}) => {
|
|
35
|
-
// Default key mappings
|
|
36
|
-
const defaultKeyMap = {
|
|
35
|
+
// Default key mappings - useMemo ile sarmaladık
|
|
36
|
+
const defaultKeyMap = useMemo(() => ({
|
|
37
37
|
navigateLeft: keyMap.navigateLeft || 'ArrowLeft',
|
|
38
38
|
navigateRight: keyMap.navigateRight || 'ArrowRight',
|
|
39
39
|
navigateUp: keyMap.navigateUp || 'ArrowUp',
|
|
@@ -45,7 +45,7 @@ const useKeyboardShortcuts = ({
|
|
|
45
45
|
paste: keyMap.paste || { key: 'v', ctrl: true },
|
|
46
46
|
zoomIn: keyMap.zoomIn || { key: '=', ctrl: true },
|
|
47
47
|
zoomOut: keyMap.zoomOut || { key: '-', ctrl: true },
|
|
48
|
-
};
|
|
48
|
+
}), [keyMap]);
|
|
49
49
|
|
|
50
50
|
const handleKeyDown = useCallback(
|
|
51
51
|
(e) => {
|