@app-studio/web 0.9.34 → 0.9.35
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/components/Calendar/Calendar/Calendar.style.d.ts +4 -0
- package/dist/components/index.d.ts +0 -3
- package/dist/web.cjs.development.js +166 -605
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +167 -605
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +169 -607
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- package/docs/components/Calendar.mdx +22 -110
- package/docs/components/KanbanBoard.mdx +156 -0
- package/package.json +1 -1
- package/dist/components/CalendarWeek/CalendarWeek/CalendarWeek.props.d.ts +0 -51
- package/dist/components/CalendarWeek/CalendarWeek/CalendarWeek.style.d.ts +0 -90
- package/dist/components/CalendarWeek/CalendarWeek/CalendarWeek.utils.d.ts +0 -51
- package/dist/components/CalendarWeek/CalendarWeek/CalendarWeek.view.d.ts +0 -3
- package/dist/components/CalendarWeek/CalendarWeek.d.ts +0 -1
|
@@ -38,9 +38,8 @@ var contrast = _interopDefault(require('contrast'));
|
|
|
38
38
|
require('core-js/modules/es.promise.js');
|
|
39
39
|
require('core-js/modules/es.array.reduce.js');
|
|
40
40
|
require('core-js/modules/es.number.to-fixed.js');
|
|
41
|
-
require('core-js/modules/es.string.pad-start.js');
|
|
42
41
|
require('core-js/modules/es.array.sort.js');
|
|
43
|
-
|
|
42
|
+
require('core-js/modules/es.string.pad-start.js');
|
|
44
43
|
var format = _interopDefault(require('date-fns/format'));
|
|
45
44
|
require('core-js/modules/es.regexp.constructor.js');
|
|
46
45
|
var formik = require('formik');
|
|
@@ -7844,7 +7843,6 @@ var KanbanBoardView = _ref => {
|
|
|
7844
7843
|
borderRadius: 10,
|
|
7845
7844
|
padding: "12px",
|
|
7846
7845
|
boxShadow: "0 1px 2px 0 rgba(16, 24, 40, 0.08)",
|
|
7847
|
-
opacity: draggedCardId === card.id ? 0.6 : 1,
|
|
7848
7846
|
onDragStart: event => onCardDragStart(column.id, card.id, event),
|
|
7849
7847
|
onDragEnd: onCardDragEnd,
|
|
7850
7848
|
onDragOver: event => {
|
|
@@ -8117,8 +8115,8 @@ var monthTitleStyles = {
|
|
|
8117
8115
|
* Month grid styles (7 columns for days)
|
|
8118
8116
|
*/
|
|
8119
8117
|
var monthGridStyles = {
|
|
8120
|
-
display: '
|
|
8121
|
-
|
|
8118
|
+
display: 'flex',
|
|
8119
|
+
flexDirection: 'column',
|
|
8122
8120
|
backgroundColor: 'color.white'
|
|
8123
8121
|
};
|
|
8124
8122
|
/**
|
|
@@ -8148,15 +8146,32 @@ var weekdayLabelStyles = {
|
|
|
8148
8146
|
*/
|
|
8149
8147
|
var dayCellStyles = {
|
|
8150
8148
|
border: '1px solid',
|
|
8151
|
-
borderColor: 'color.gray.
|
|
8152
|
-
minHeight:
|
|
8153
|
-
padding:
|
|
8154
|
-
paddingTop:
|
|
8149
|
+
borderColor: 'color.gray.100',
|
|
8150
|
+
minHeight: 120,
|
|
8151
|
+
padding: 4,
|
|
8152
|
+
paddingTop: 2,
|
|
8155
8153
|
backgroundColor: 'color.white',
|
|
8156
8154
|
position: 'relative',
|
|
8157
8155
|
display: 'flex',
|
|
8158
8156
|
flexDirection: 'column'
|
|
8159
8157
|
};
|
|
8158
|
+
/**
|
|
8159
|
+
* Day date styles (the circular number)
|
|
8160
|
+
*/
|
|
8161
|
+
var dayDateStyles = {
|
|
8162
|
+
width: 36,
|
|
8163
|
+
height: 36,
|
|
8164
|
+
display: 'flex',
|
|
8165
|
+
alignItems: 'center',
|
|
8166
|
+
justifyContent: 'center',
|
|
8167
|
+
borderRadius: '50%',
|
|
8168
|
+
fontSize: 13,
|
|
8169
|
+
fontWeight: 400,
|
|
8170
|
+
color: 'color.gray.900',
|
|
8171
|
+
cursor: 'pointer',
|
|
8172
|
+
transition: 'all 0.2s',
|
|
8173
|
+
border: '2px solid transparent'
|
|
8174
|
+
};
|
|
8160
8175
|
/**
|
|
8161
8176
|
* Day cell from different month
|
|
8162
8177
|
*/
|
|
@@ -8291,6 +8306,9 @@ var ResizeHandle = _ref => {
|
|
|
8291
8306
|
onMouseLeave: () => setIsHovered(false)
|
|
8292
8307
|
}));
|
|
8293
8308
|
};
|
|
8309
|
+
var MONTH_EVENT_ROW_HEIGHT = 22;
|
|
8310
|
+
var MONTH_EVENT_ROW_GAP = 4;
|
|
8311
|
+
var MONTH_EVENT_TOP_OFFSET = 32;
|
|
8294
8312
|
var Calendar = _ref2 => {
|
|
8295
8313
|
var {
|
|
8296
8314
|
initialDate = new Date(),
|
|
@@ -8354,10 +8372,64 @@ var Calendar = _ref2 => {
|
|
|
8354
8372
|
return [currentDate];
|
|
8355
8373
|
}
|
|
8356
8374
|
}, [currentDate, currentView, currentMonth, weekStartsOn]);
|
|
8375
|
+
var monthWeeks = React.useMemo(() => {
|
|
8376
|
+
var chunks = [];
|
|
8377
|
+
for (var i = 0; i < calendarDates.length; i += 7) {
|
|
8378
|
+
chunks.push(calendarDates.slice(i, i + 7));
|
|
8379
|
+
}
|
|
8380
|
+
return chunks;
|
|
8381
|
+
}, [calendarDates]);
|
|
8357
8382
|
// Layout events
|
|
8358
8383
|
var {
|
|
8359
8384
|
items: positionedEvents
|
|
8360
8385
|
} = React.useMemo(() => layoutEvents(localEvents, calendarDates), [localEvents, calendarDates]);
|
|
8386
|
+
var monthWeeksWithEvents = React.useMemo(() => {
|
|
8387
|
+
return monthWeeks.map((dates, weekIndex) => {
|
|
8388
|
+
var weekStartIdx = weekIndex * 7;
|
|
8389
|
+
var weekEndIdx = weekStartIdx + dates.length - 1;
|
|
8390
|
+
var segments = positionedEvents.filter(event => !(event.startDay > weekEndIdx || event.endDay < weekStartIdx)).map(event => {
|
|
8391
|
+
var segmentStart = Math.max(event.startDay, weekStartIdx);
|
|
8392
|
+
var segmentEnd = Math.min(event.endDay, weekEndIdx);
|
|
8393
|
+
return Object.assign({}, event, {
|
|
8394
|
+
weekIndex,
|
|
8395
|
+
segmentStartDay: segmentStart - weekStartIdx,
|
|
8396
|
+
segmentEndDay: segmentEnd - weekStartIdx,
|
|
8397
|
+
segmentDuration: segmentEnd - segmentStart + 1,
|
|
8398
|
+
segmentRow: 0
|
|
8399
|
+
});
|
|
8400
|
+
});
|
|
8401
|
+
segments.sort((a, b) => {
|
|
8402
|
+
if (a.segmentStartDay !== b.segmentStartDay) {
|
|
8403
|
+
return a.segmentStartDay - b.segmentStartDay;
|
|
8404
|
+
}
|
|
8405
|
+
return b.segmentDuration - a.segmentDuration;
|
|
8406
|
+
});
|
|
8407
|
+
var rows = [];
|
|
8408
|
+
segments.forEach(segment => {
|
|
8409
|
+
var placed = false;
|
|
8410
|
+
for (var rowIdx = 0; rowIdx < rows.length; rowIdx++) {
|
|
8411
|
+
var row = rows[rowIdx];
|
|
8412
|
+
var conflict = row.some(existing => !(segment.segmentStartDay > existing.segmentEndDay || segment.segmentEndDay < existing.segmentStartDay));
|
|
8413
|
+
if (!conflict) {
|
|
8414
|
+
segment.segmentRow = rowIdx;
|
|
8415
|
+
row.push(segment);
|
|
8416
|
+
placed = true;
|
|
8417
|
+
break;
|
|
8418
|
+
}
|
|
8419
|
+
}
|
|
8420
|
+
if (!placed) {
|
|
8421
|
+
segment.segmentRow = rows.length;
|
|
8422
|
+
rows.push([segment]);
|
|
8423
|
+
}
|
|
8424
|
+
});
|
|
8425
|
+
return {
|
|
8426
|
+
weekIndex,
|
|
8427
|
+
dates,
|
|
8428
|
+
segments,
|
|
8429
|
+
rowCount: rows.length
|
|
8430
|
+
};
|
|
8431
|
+
});
|
|
8432
|
+
}, [monthWeeks, positionedEvents]);
|
|
8361
8433
|
// Get day names
|
|
8362
8434
|
var dayNames = React.useMemo(() => getDayNames(weekStartsOn), [weekStartsOn]);
|
|
8363
8435
|
// Handle navigation
|
|
@@ -8417,10 +8489,9 @@ var Calendar = _ref2 => {
|
|
|
8417
8489
|
onEventAdd(start, end);
|
|
8418
8490
|
}
|
|
8419
8491
|
}, [onEventAdd]);
|
|
8420
|
-
// Handle event
|
|
8421
|
-
var
|
|
8422
|
-
e.
|
|
8423
|
-
e.dataTransfer.setData('eventId', event.id);
|
|
8492
|
+
// Handle mouse down on event (start dragging)
|
|
8493
|
+
var handleEventMouseDown = React.useCallback((e, event) => {
|
|
8494
|
+
e.preventDefault();
|
|
8424
8495
|
dragStateRef.current = {
|
|
8425
8496
|
isDragging: true,
|
|
8426
8497
|
isResizing: false,
|
|
@@ -8433,52 +8504,7 @@ var Calendar = _ref2 => {
|
|
|
8433
8504
|
originalEnd: event.end
|
|
8434
8505
|
};
|
|
8435
8506
|
}, []);
|
|
8436
|
-
// Handle
|
|
8437
|
-
var handleDragOver = React.useCallback((e, dayIndex) => {
|
|
8438
|
-
e.preventDefault();
|
|
8439
|
-
e.dataTransfer.dropEffect = 'move';
|
|
8440
|
-
setDropTargetDays([dayIndex]);
|
|
8441
|
-
}, []);
|
|
8442
|
-
// Handle drag leave
|
|
8443
|
-
var handleDragLeave = React.useCallback(() => {
|
|
8444
|
-
setDropTargetDays([]);
|
|
8445
|
-
}, []);
|
|
8446
|
-
// Handle drop on day cell
|
|
8447
|
-
var handleDrop = React.useCallback((e, dayIndex) => {
|
|
8448
|
-
e.preventDefault();
|
|
8449
|
-
setDropTargetDays([]);
|
|
8450
|
-
var dragState = dragStateRef.current;
|
|
8451
|
-
if (!dragState.event || !dragState.originalStart || !dragState.originalEnd) return;
|
|
8452
|
-
// Calculate date difference
|
|
8453
|
-
var targetDate = calendarDates[dayIndex];
|
|
8454
|
-
if (!targetDate) return;
|
|
8455
|
-
var daysDiff = daysBetweenUTC(targetDate, dragState.originalStart.slice(0, 10));
|
|
8456
|
-
// Update event dates
|
|
8457
|
-
var newStart = addDateDays(dragState.originalStart.slice(0, 10), daysDiff);
|
|
8458
|
-
var newEnd = addDateDays(dragState.originalEnd.slice(0, 10), daysDiff);
|
|
8459
|
-
var updatedEvent = Object.assign({}, dragState.event, {
|
|
8460
|
-
start: newStart,
|
|
8461
|
-
end: newEnd
|
|
8462
|
-
});
|
|
8463
|
-
// Update local events
|
|
8464
|
-
var updatedEvents = localEvents.map(ev => ev.id === dragState.event.id ? updatedEvent : ev);
|
|
8465
|
-
setLocalEvents(updatedEvents);
|
|
8466
|
-
// Call callback
|
|
8467
|
-
onEventDrop == null || onEventDrop(updatedEvent);
|
|
8468
|
-
// Reset drag state
|
|
8469
|
-
dragStateRef.current = {
|
|
8470
|
-
isDragging: false,
|
|
8471
|
-
isResizing: false,
|
|
8472
|
-
resizeDirection: null,
|
|
8473
|
-
event: null,
|
|
8474
|
-
startX: 0,
|
|
8475
|
-
startDay: 0,
|
|
8476
|
-
startDuration: 0,
|
|
8477
|
-
originalStart: null,
|
|
8478
|
-
originalEnd: null
|
|
8479
|
-
};
|
|
8480
|
-
}, [localEvents, calendarDates, onEventDrop]);
|
|
8481
|
-
// Handle resize start (FIXED - using pixel-based approach like CalendarWeek)
|
|
8507
|
+
// Handle resize start
|
|
8482
8508
|
var handleResizeStart = React.useCallback((e, event, direction) => {
|
|
8483
8509
|
e.preventDefault();
|
|
8484
8510
|
e.stopPropagation();
|
|
@@ -8494,7 +8520,7 @@ var Calendar = _ref2 => {
|
|
|
8494
8520
|
originalEnd: event.end
|
|
8495
8521
|
};
|
|
8496
8522
|
}, []);
|
|
8497
|
-
// Handle mouse move during resize
|
|
8523
|
+
// Handle mouse move during resize or drag
|
|
8498
8524
|
var handleMouseMove = React.useCallback(e => {
|
|
8499
8525
|
var dragState = dragStateRef.current;
|
|
8500
8526
|
if (!dragState.event || !dragState.isDragging && !dragState.isResizing) return;
|
|
@@ -8616,54 +8642,89 @@ var Calendar = _ref2 => {
|
|
|
8616
8642
|
key: index
|
|
8617
8643
|
}, weekdayLabelStyles, views.weekdayLabel), dayName)))), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
8618
8644
|
ref: gridRef
|
|
8619
|
-
}, monthGridStyles, views.monthGrid),
|
|
8620
|
-
var
|
|
8621
|
-
var
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
}
|
|
8639
|
-
|
|
8645
|
+
}, monthGridStyles, views.monthGrid), monthWeeksWithEvents.map(week => {
|
|
8646
|
+
var weekStartIdx = week.weekIndex * 7;
|
|
8647
|
+
var weekEndIdx = weekStartIdx + week.dates.length - 1;
|
|
8648
|
+
return /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
8649
|
+
key: "week-" + week.weekIndex,
|
|
8650
|
+
position: "relative"
|
|
8651
|
+
}, /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
8652
|
+
display: "grid",
|
|
8653
|
+
gridTemplateColumns: "repeat(7, 1fr)"
|
|
8654
|
+
}, week.dates.map((dateISO, dayOffset) => {
|
|
8655
|
+
var dateNum = getDateNumber(dateISO);
|
|
8656
|
+
var isToday = dateISO === today;
|
|
8657
|
+
var isSelected = dateISO === selectedDate;
|
|
8658
|
+
var isCurrentMonth = isInMonth(dateISO, currentMonth);
|
|
8659
|
+
var dayIndex = weekStartIdx + dayOffset;
|
|
8660
|
+
var isDropTarget = dropTargetDays.includes(dayIndex);
|
|
8661
|
+
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
8662
|
+
key: dateISO,
|
|
8663
|
+
"data-date": dateISO
|
|
8664
|
+
}, dayCellStyles, !isCurrentMonth && otherMonthDayCellStyles, isDropTarget && dropTargetStyles, {
|
|
8665
|
+
onClick: () => handleDateClick(dateISO),
|
|
8666
|
+
onDoubleClick: () => handleDateDoubleClick(dateISO)
|
|
8667
|
+
}, views.dayCell), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, dayNumberStyles, isToday && todayDayNumberStyles, isSelected && !isToday && selectedDayNumberStyles, {
|
|
8668
|
+
style: {
|
|
8669
|
+
cursor: 'pointer'
|
|
8670
|
+
}
|
|
8671
|
+
}, views.dayNumber), dateNum));
|
|
8672
|
+
})), week.segments.length > 0 && (/*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
8673
|
+
position: "absolute",
|
|
8674
|
+
left: 0,
|
|
8675
|
+
right: 0,
|
|
8676
|
+
top: MONTH_EVENT_TOP_OFFSET,
|
|
8677
|
+
pointerEvents: "none"
|
|
8678
|
+
}, week.segments.map(event => {
|
|
8679
|
+
var _dragStateRef$current, _dragStateRef$current2;
|
|
8640
8680
|
var colorConfig = EVENT_COLORS[event.color || 'blue'];
|
|
8641
|
-
var
|
|
8642
|
-
var
|
|
8643
|
-
|
|
8681
|
+
var dayWidth = 100 / week.dates.length;
|
|
8682
|
+
var left = event.segmentStartDay * dayWidth;
|
|
8683
|
+
var width = event.segmentDuration * dayWidth;
|
|
8684
|
+
var isDragging = dragStateRef.current.isDragging && ((_dragStateRef$current = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current.id) === event.id;
|
|
8685
|
+
var isResizing = dragStateRef.current.isResizing && ((_dragStateRef$current2 = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current2.id) === event.id;
|
|
8686
|
+
var showLeftHandle = event.startDay >= weekStartIdx && event.startDay <= weekEndIdx && event.segmentStartDay === event.startDay - weekStartIdx;
|
|
8687
|
+
var showRightHandle = event.endDay >= weekStartIdx && event.endDay <= weekEndIdx && event.segmentEndDay === event.endDay - weekStartIdx;
|
|
8644
8688
|
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
8645
|
-
key: event.id,
|
|
8646
|
-
position: "
|
|
8647
|
-
|
|
8689
|
+
key: event.id + "-" + event.weekIndex + "-" + event.segmentStartDay,
|
|
8690
|
+
position: "absolute",
|
|
8691
|
+
height: MONTH_EVENT_ROW_HEIGHT,
|
|
8692
|
+
display: "flex",
|
|
8693
|
+
alignItems: "center",
|
|
8694
|
+
paddingLeft: 8,
|
|
8695
|
+
paddingRight: 8,
|
|
8696
|
+
borderRadius: 4,
|
|
8648
8697
|
backgroundColor: colorConfig.background,
|
|
8698
|
+
borderLeft: "3px solid",
|
|
8649
8699
|
borderLeftColor: colorConfig.border,
|
|
8650
8700
|
color: colorConfig.text,
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8701
|
+
fontSize: 11,
|
|
8702
|
+
fontWeight: 500,
|
|
8703
|
+
overflow: "hidden",
|
|
8704
|
+
cursor: isDragging ? 'grabbing' : 'grab',
|
|
8705
|
+
opacity: isDragging || isResizing ? 0.7 : 1,
|
|
8706
|
+
boxShadow: isDragging || isResizing ? '0 4px 12px rgba(0,0,0,0.3)' : '0 1px 2px rgba(0,0,0,0.1)',
|
|
8707
|
+
transition: isDragging || isResizing ? 'none' : 'box-shadow 0.2s',
|
|
8708
|
+
pointerEvents: "auto",
|
|
8709
|
+
userSelect: "none",
|
|
8710
|
+
left: "calc(" + left + "% + 4px)",
|
|
8711
|
+
width: "calc(" + width + "% - 8px)",
|
|
8712
|
+
top: event.segmentRow * (MONTH_EVENT_ROW_HEIGHT + MONTH_EVENT_ROW_GAP) + "px",
|
|
8713
|
+
onMouseDown: e => handleEventMouseDown(e, event),
|
|
8714
|
+
title: event.title
|
|
8654
8715
|
}, views.event), /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
8655
8716
|
overflow: "hidden",
|
|
8656
8717
|
textOverflow: "ellipsis",
|
|
8657
8718
|
whiteSpace: "nowrap",
|
|
8658
8719
|
width: "100%"
|
|
8659
|
-
}, event.title,
|
|
8720
|
+
}, event.title), showLeftHandle && (/*#__PURE__*/React__default.createElement(ResizeHandle, {
|
|
8660
8721
|
direction: "left",
|
|
8661
8722
|
onMouseDown: e => handleResizeStart(e, event, 'left')
|
|
8662
|
-
}), /*#__PURE__*/React__default.createElement(ResizeHandle, {
|
|
8723
|
+
})), showRightHandle && (/*#__PURE__*/React__default.createElement(ResizeHandle, {
|
|
8663
8724
|
direction: "right",
|
|
8664
8725
|
onMouseDown: e => handleResizeStart(e, event, 'right')
|
|
8665
|
-
}));
|
|
8666
|
-
})));
|
|
8726
|
+
})));
|
|
8727
|
+
}))));
|
|
8667
8728
|
}))));
|
|
8668
8729
|
// Render week view
|
|
8669
8730
|
var renderWeekView = () => (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, weekdayHeaderStyles, views.weekdayHeader), calendarDates.map((dateISO, index) => {
|
|
@@ -8677,7 +8738,7 @@ var Calendar = _ref2 => {
|
|
|
8677
8738
|
alignItems: "center",
|
|
8678
8739
|
padding: 8,
|
|
8679
8740
|
gap: 4
|
|
8680
|
-
}, views.weekdayLabel), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, weekdayLabelStyles), DAY_NAMES[dayOfWeek]), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({},
|
|
8741
|
+
}, views.weekdayLabel), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, weekdayLabelStyles), DAY_NAMES[dayOfWeek]), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, dayDateStyles, isToday && todayDayNumberStyles, {
|
|
8681
8742
|
fontSize: 16,
|
|
8682
8743
|
fontWeight: isToday ? 500 : 400
|
|
8683
8744
|
}), dateNum));
|
|
@@ -8695,14 +8756,14 @@ var Calendar = _ref2 => {
|
|
|
8695
8756
|
}, dayCellStyles, isDropTarget && dropTargetStyles, {
|
|
8696
8757
|
minHeight: 400,
|
|
8697
8758
|
onClick: () => handleDateClick(dateISO),
|
|
8698
|
-
onDoubleClick: () => handleDateDoubleClick(dateISO)
|
|
8699
|
-
onDragOver: e => handleDragOver(e, index),
|
|
8700
|
-
onDragLeave: handleDragLeave,
|
|
8701
|
-
onDrop: e => handleDrop(e, index)
|
|
8759
|
+
onDoubleClick: () => handleDateDoubleClick(dateISO)
|
|
8702
8760
|
}), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, eventsAreaStyles, views.eventsArea), dayEvents.map(event => {
|
|
8761
|
+
var _dragStateRef$current3, _dragStateRef$current4;
|
|
8703
8762
|
var colorConfig = EVENT_COLORS[event.color || 'blue'];
|
|
8704
8763
|
var isFirstDay = event.isFirstDay !== false;
|
|
8705
8764
|
if (!isFirstDay) return null;
|
|
8765
|
+
var isDragging = dragStateRef.current.isDragging && ((_dragStateRef$current3 = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current3.id) === event.id;
|
|
8766
|
+
var isResizing = dragStateRef.current.isResizing && ((_dragStateRef$current4 = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current4.id) === event.id;
|
|
8706
8767
|
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
8707
8768
|
key: event.id,
|
|
8708
8769
|
position: "relative"
|
|
@@ -8710,8 +8771,12 @@ var Calendar = _ref2 => {
|
|
|
8710
8771
|
backgroundColor: colorConfig.background,
|
|
8711
8772
|
borderLeftColor: colorConfig.border,
|
|
8712
8773
|
color: colorConfig.text,
|
|
8713
|
-
|
|
8714
|
-
|
|
8774
|
+
cursor: isDragging ? 'grabbing' : 'grab',
|
|
8775
|
+
opacity: isDragging || isResizing ? 0.7 : 1,
|
|
8776
|
+
boxShadow: isDragging || isResizing ? '0 4px 12px rgba(0,0,0,0.3)' : '0 1px 2px rgba(0,0,0,0.1)',
|
|
8777
|
+
transition: isDragging || isResizing ? 'none' : 'box-shadow 0.2s',
|
|
8778
|
+
userSelect: "none",
|
|
8779
|
+
onMouseDown: e => handleEventMouseDown(e, event),
|
|
8715
8780
|
title: event.title
|
|
8716
8781
|
}, views.event), /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
8717
8782
|
overflow: "hidden",
|
|
@@ -8830,509 +8895,6 @@ var Calendar = _ref2 => {
|
|
|
8830
8895
|
}, views.navButton), "\u203A")))), currentView === 'month' && renderMonthView(), currentView === 'week' && renderWeekView(), currentView === 'day' && renderDayView());
|
|
8831
8896
|
};
|
|
8832
8897
|
|
|
8833
|
-
/**
|
|
8834
|
-
* Convert an ISO date string to a UTC Date object
|
|
8835
|
-
*/
|
|
8836
|
-
var dateUTC$1 = iso => {
|
|
8837
|
-
return new Date(iso + (iso.includes('T') ? '' : 'T00:00:00Z'));
|
|
8838
|
-
};
|
|
8839
|
-
/**
|
|
8840
|
-
* Calculate the number of days between two ISO date strings
|
|
8841
|
-
*/
|
|
8842
|
-
var daysBetweenUTC$1 = (a, b) => {
|
|
8843
|
-
return Math.floor((dateUTC$1(a).getTime() - dateUTC$1(b).getTime()) / 86400000);
|
|
8844
|
-
};
|
|
8845
|
-
/**
|
|
8846
|
-
* Add a number of days to an ISO date string
|
|
8847
|
-
*/
|
|
8848
|
-
var addDateDays$1 = (dateISO, days) => {
|
|
8849
|
-
var d = new Date(dateISO + 'T00:00:00Z');
|
|
8850
|
-
d.setUTCDate(d.getUTCDate() + days);
|
|
8851
|
-
return d.toISOString().slice(0, 10);
|
|
8852
|
-
};
|
|
8853
|
-
/**
|
|
8854
|
-
* Get the day of the week (0-6) from an ISO date string
|
|
8855
|
-
*/
|
|
8856
|
-
var getDayOfWeek$1 = dateISO => {
|
|
8857
|
-
return dateUTC$1(dateISO).getUTCDay();
|
|
8858
|
-
};
|
|
8859
|
-
/**
|
|
8860
|
-
* Get the date number (1-31) from an ISO date string
|
|
8861
|
-
*/
|
|
8862
|
-
var getDateNumber$1 = dateISO => {
|
|
8863
|
-
return dateUTC$1(dateISO).getUTCDate();
|
|
8864
|
-
};
|
|
8865
|
-
/**
|
|
8866
|
-
* Layout events with proper positioning to avoid overlaps
|
|
8867
|
-
* Returns positioned events and the total number of rows needed
|
|
8868
|
-
*/
|
|
8869
|
-
var layoutEvents$1 = (events, weekStart) => {
|
|
8870
|
-
// Convert events to positioned items with day indices
|
|
8871
|
-
var items = events.map(ev => {
|
|
8872
|
-
var startIdx = daysBetweenUTC$1(ev.start, weekStart);
|
|
8873
|
-
var endIdx = daysBetweenUTC$1(ev.end, weekStart);
|
|
8874
|
-
// Clamp to week boundaries
|
|
8875
|
-
var clampedStart = Math.max(0, Math.min(6, startIdx));
|
|
8876
|
-
var clampedEnd = Math.max(0, Math.min(6, endIdx));
|
|
8877
|
-
// Skip if completely outside week
|
|
8878
|
-
if (endIdx < 0 || startIdx > 6) return null;
|
|
8879
|
-
var duration = clampedEnd - clampedStart + 1;
|
|
8880
|
-
return Object.assign({}, ev, {
|
|
8881
|
-
startDay: clampedStart,
|
|
8882
|
-
endDay: clampedEnd,
|
|
8883
|
-
duration: duration,
|
|
8884
|
-
row: 0
|
|
8885
|
-
});
|
|
8886
|
-
}).filter(item => item !== null);
|
|
8887
|
-
// Sort by start day, then by duration (longer first)
|
|
8888
|
-
items.sort((a, b) => {
|
|
8889
|
-
if (a.startDay !== b.startDay) return a.startDay - b.startDay;
|
|
8890
|
-
return b.duration - a.duration;
|
|
8891
|
-
});
|
|
8892
|
-
// Assign rows using greedy algorithm to prevent overlaps
|
|
8893
|
-
var rows = [];
|
|
8894
|
-
items.forEach(item => {
|
|
8895
|
-
var placed = false;
|
|
8896
|
-
for (var i = 0; i < rows.length; i++) {
|
|
8897
|
-
var row = rows[i];
|
|
8898
|
-
var hasConflict = row.some(existing => !(item.startDay > existing.endDay || item.endDay < existing.startDay));
|
|
8899
|
-
if (!hasConflict) {
|
|
8900
|
-
row.push(item);
|
|
8901
|
-
item.row = i;
|
|
8902
|
-
placed = true;
|
|
8903
|
-
break;
|
|
8904
|
-
}
|
|
8905
|
-
}
|
|
8906
|
-
if (!placed) {
|
|
8907
|
-
item.row = rows.length;
|
|
8908
|
-
rows.push([item]);
|
|
8909
|
-
}
|
|
8910
|
-
});
|
|
8911
|
-
return {
|
|
8912
|
-
items,
|
|
8913
|
-
rowCount: rows.length
|
|
8914
|
-
};
|
|
8915
|
-
};
|
|
8916
|
-
/**
|
|
8917
|
-
* Day names array (Sunday to Saturday)
|
|
8918
|
-
*/
|
|
8919
|
-
var DAY_NAMES$1 = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
8920
|
-
/**
|
|
8921
|
-
* Get the date ISO string for a specific day in the week
|
|
8922
|
-
*/
|
|
8923
|
-
var getDateForDay = (weekStart, dayIndex) => {
|
|
8924
|
-
return addDateDays$1(weekStart, dayIndex);
|
|
8925
|
-
};
|
|
8926
|
-
|
|
8927
|
-
/**
|
|
8928
|
-
* Event color configurations
|
|
8929
|
-
*/
|
|
8930
|
-
var EVENT_COLORS$1 = {
|
|
8931
|
-
blue: {
|
|
8932
|
-
background: 'color.blue.50',
|
|
8933
|
-
border: 'color.blue.500',
|
|
8934
|
-
text: 'color.blue.700'
|
|
8935
|
-
},
|
|
8936
|
-
red: {
|
|
8937
|
-
background: 'color.red.50',
|
|
8938
|
-
border: 'color.red.500',
|
|
8939
|
-
text: 'color.red.700'
|
|
8940
|
-
},
|
|
8941
|
-
green: {
|
|
8942
|
-
background: 'color.green.50',
|
|
8943
|
-
border: 'color.green.500',
|
|
8944
|
-
text: 'color.green.700'
|
|
8945
|
-
},
|
|
8946
|
-
purple: {
|
|
8947
|
-
background: 'color.purple.50',
|
|
8948
|
-
border: 'color.purple.500',
|
|
8949
|
-
text: 'color.purple.700'
|
|
8950
|
-
},
|
|
8951
|
-
orange: {
|
|
8952
|
-
background: 'color.orange.50',
|
|
8953
|
-
border: 'color.orange.500',
|
|
8954
|
-
text: 'color.orange.700'
|
|
8955
|
-
}
|
|
8956
|
-
};
|
|
8957
|
-
/**
|
|
8958
|
-
* Base styles for the calendar container
|
|
8959
|
-
*/
|
|
8960
|
-
var containerStyles$1 = {
|
|
8961
|
-
width: '100%',
|
|
8962
|
-
maxWidth: 1200,
|
|
8963
|
-
border: '1px solid',
|
|
8964
|
-
borderColor: 'color.gray.200',
|
|
8965
|
-
borderRadius: 8,
|
|
8966
|
-
overflow: 'hidden',
|
|
8967
|
-
backgroundColor: 'color.white'
|
|
8968
|
-
};
|
|
8969
|
-
/**
|
|
8970
|
-
* Individual day column styles
|
|
8971
|
-
*/
|
|
8972
|
-
var dayColumnStyles = {
|
|
8973
|
-
borderRight: '1px solid',
|
|
8974
|
-
borderColor: 'color.gray.200',
|
|
8975
|
-
display: 'flex',
|
|
8976
|
-
flexDirection: 'column',
|
|
8977
|
-
minHeight: 160,
|
|
8978
|
-
backgroundColor: 'color.white',
|
|
8979
|
-
position: 'relative'
|
|
8980
|
-
};
|
|
8981
|
-
/**
|
|
8982
|
-
* Day header styles
|
|
8983
|
-
*/
|
|
8984
|
-
var dayHeaderStyles = {
|
|
8985
|
-
padding: 8,
|
|
8986
|
-
borderBottom: '1px solid',
|
|
8987
|
-
borderColor: 'color.gray.200',
|
|
8988
|
-
backgroundColor: 'color.gray.50',
|
|
8989
|
-
minHeight: 60,
|
|
8990
|
-
display: 'flex',
|
|
8991
|
-
flexDirection: 'column',
|
|
8992
|
-
alignItems: 'center',
|
|
8993
|
-
justifyContent: 'center',
|
|
8994
|
-
gap: 4
|
|
8995
|
-
};
|
|
8996
|
-
/**
|
|
8997
|
-
* Day name styles (e.g., "Mon", "Tue")
|
|
8998
|
-
*/
|
|
8999
|
-
var dayNameStyles = {
|
|
9000
|
-
fontSize: 11,
|
|
9001
|
-
fontWeight: 500,
|
|
9002
|
-
color: 'color.gray.700',
|
|
9003
|
-
textTransform: 'uppercase',
|
|
9004
|
-
letterSpacing: 0.5
|
|
9005
|
-
};
|
|
9006
|
-
/**
|
|
9007
|
-
* Day date styles (the circular number)
|
|
9008
|
-
*/
|
|
9009
|
-
var dayDateStyles = {
|
|
9010
|
-
width: 36,
|
|
9011
|
-
height: 36,
|
|
9012
|
-
display: 'flex',
|
|
9013
|
-
alignItems: 'center',
|
|
9014
|
-
justifyContent: 'center',
|
|
9015
|
-
borderRadius: '50%',
|
|
9016
|
-
fontSize: 13,
|
|
9017
|
-
fontWeight: 400,
|
|
9018
|
-
color: 'color.gray.900',
|
|
9019
|
-
cursor: 'pointer',
|
|
9020
|
-
transition: 'all 0.2s',
|
|
9021
|
-
border: '2px solid transparent'
|
|
9022
|
-
};
|
|
9023
|
-
/**
|
|
9024
|
-
* Today date styles
|
|
9025
|
-
*/
|
|
9026
|
-
var todayDateStyles = {
|
|
9027
|
-
backgroundColor: 'color.blue.500',
|
|
9028
|
-
color: 'color.white',
|
|
9029
|
-
fontWeight: 500
|
|
9030
|
-
};
|
|
9031
|
-
/**
|
|
9032
|
-
* Selected date styles
|
|
9033
|
-
*/
|
|
9034
|
-
var selectedDateStyles = {
|
|
9035
|
-
borderColor: 'color.blue.500'
|
|
9036
|
-
};
|
|
9037
|
-
/**
|
|
9038
|
-
* Events area styles
|
|
9039
|
-
*/
|
|
9040
|
-
var eventsAreaStyles$1 = {
|
|
9041
|
-
padding: 8,
|
|
9042
|
-
paddingLeft: 6,
|
|
9043
|
-
paddingRight: 6,
|
|
9044
|
-
flex: 1,
|
|
9045
|
-
position: 'relative'
|
|
9046
|
-
};
|
|
9047
|
-
/**
|
|
9048
|
-
* Drop target indicator styles
|
|
9049
|
-
*/
|
|
9050
|
-
var dropTargetStyles$1 = {
|
|
9051
|
-
backgroundColor: 'rgba(26, 115, 232, 0.05)'
|
|
9052
|
-
};
|
|
9053
|
-
/**
|
|
9054
|
-
* Calculate event position styles
|
|
9055
|
-
*/
|
|
9056
|
-
var getEventPositionStyles = (startDay, duration, row) => {
|
|
9057
|
-
var dayWidth = 100 / 7;
|
|
9058
|
-
var left = startDay * dayWidth;
|
|
9059
|
-
var width = duration * dayWidth;
|
|
9060
|
-
return {
|
|
9061
|
-
left: "calc(" + left + "% + 6px)",
|
|
9062
|
-
width: "calc(" + width + "% - 12px)",
|
|
9063
|
-
top: 8 + row * 26 + "px"
|
|
9064
|
-
};
|
|
9065
|
-
};
|
|
9066
|
-
|
|
9067
|
-
var ResizeHandle$1 = _ref => {
|
|
9068
|
-
var {
|
|
9069
|
-
direction,
|
|
9070
|
-
onMouseDown
|
|
9071
|
-
} = _ref;
|
|
9072
|
-
var [isHovered, setIsHovered] = React.useState(false);
|
|
9073
|
-
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
9074
|
-
position: "absolute",
|
|
9075
|
-
top: 0,
|
|
9076
|
-
bottom: 0,
|
|
9077
|
-
width: 8,
|
|
9078
|
-
opacity: isHovered ? 1 : 0,
|
|
9079
|
-
transition: "opacity 0.2s",
|
|
9080
|
-
cursor: direction === 'left' ? 'w-resize' : 'e-resize',
|
|
9081
|
-
zIndex: 10,
|
|
9082
|
-
backgroundColor: isHovered ? 'rgba(0,0,0,0.1)' : 'transparent'
|
|
9083
|
-
}, direction === 'left' ? {
|
|
9084
|
-
left: 0
|
|
9085
|
-
} : {
|
|
9086
|
-
right: 0
|
|
9087
|
-
}, {
|
|
9088
|
-
onMouseDown: onMouseDown,
|
|
9089
|
-
onMouseEnter: () => setIsHovered(true),
|
|
9090
|
-
onMouseLeave: () => setIsHovered(false)
|
|
9091
|
-
}));
|
|
9092
|
-
};
|
|
9093
|
-
var CalendarWeek = _ref2 => {
|
|
9094
|
-
var {
|
|
9095
|
-
startDate,
|
|
9096
|
-
events = [],
|
|
9097
|
-
today = new Date().toISOString().slice(0, 10),
|
|
9098
|
-
onEventDrop,
|
|
9099
|
-
onEventResize,
|
|
9100
|
-
onDateClick,
|
|
9101
|
-
views = {},
|
|
9102
|
-
width = '100%',
|
|
9103
|
-
maxWidth = 1200
|
|
9104
|
-
} = _ref2;
|
|
9105
|
-
var {
|
|
9106
|
-
getColor
|
|
9107
|
-
} = appStudio.useTheme();
|
|
9108
|
-
var weekGridRef = React.useRef(null);
|
|
9109
|
-
var [selectedDate, setSelectedDate] = React.useState(null);
|
|
9110
|
-
var [localEvents, setLocalEvents] = React.useState(events);
|
|
9111
|
-
var [dropTargetDays, setDropTargetDays] = React.useState([]);
|
|
9112
|
-
var dragStateRef = React.useRef({
|
|
9113
|
-
isDragging: false,
|
|
9114
|
-
isResizing: false,
|
|
9115
|
-
resizeDirection: null,
|
|
9116
|
-
event: null,
|
|
9117
|
-
startX: 0,
|
|
9118
|
-
startDay: 0,
|
|
9119
|
-
startDuration: 0,
|
|
9120
|
-
originalStart: null,
|
|
9121
|
-
originalEnd: null
|
|
9122
|
-
});
|
|
9123
|
-
// Update local events when props change
|
|
9124
|
-
React__default.useEffect(() => {
|
|
9125
|
-
setLocalEvents(events);
|
|
9126
|
-
}, [events]);
|
|
9127
|
-
// Layout events
|
|
9128
|
-
var {
|
|
9129
|
-
items: positionedEvents
|
|
9130
|
-
} = React.useMemo(() => layoutEvents$1(localEvents, startDate), [localEvents, startDate]);
|
|
9131
|
-
// Get day index from mouse X position
|
|
9132
|
-
var getDayFromMouseX = React.useCallback(clientX => {
|
|
9133
|
-
if (!weekGridRef.current) return 0;
|
|
9134
|
-
var rect = weekGridRef.current.getBoundingClientRect();
|
|
9135
|
-
var relativeX = clientX - rect.left;
|
|
9136
|
-
var dayWidth = rect.width / 7;
|
|
9137
|
-
return Math.max(0, Math.min(6, Math.floor(relativeX / dayWidth)));
|
|
9138
|
-
}, []);
|
|
9139
|
-
// Handle date click
|
|
9140
|
-
var handleDateClick = React.useCallback(dateISO => {
|
|
9141
|
-
setSelectedDate(dateISO);
|
|
9142
|
-
onDateClick == null || onDateClick(dateISO);
|
|
9143
|
-
}, [onDateClick]);
|
|
9144
|
-
// Handle mouse down on event (start dragging)
|
|
9145
|
-
var handleEventMouseDown = React.useCallback((e, event) => {
|
|
9146
|
-
e.preventDefault();
|
|
9147
|
-
dragStateRef.current = {
|
|
9148
|
-
isDragging: true,
|
|
9149
|
-
isResizing: false,
|
|
9150
|
-
resizeDirection: null,
|
|
9151
|
-
event,
|
|
9152
|
-
startX: e.clientX,
|
|
9153
|
-
startDay: event.startDay,
|
|
9154
|
-
startDuration: event.duration,
|
|
9155
|
-
originalStart: event.start,
|
|
9156
|
-
originalEnd: event.end
|
|
9157
|
-
};
|
|
9158
|
-
}, []);
|
|
9159
|
-
// Handle mouse down on resize handle
|
|
9160
|
-
var handleResizeMouseDown = React.useCallback((e, event, direction) => {
|
|
9161
|
-
e.preventDefault();
|
|
9162
|
-
e.stopPropagation();
|
|
9163
|
-
dragStateRef.current = {
|
|
9164
|
-
isDragging: false,
|
|
9165
|
-
isResizing: true,
|
|
9166
|
-
resizeDirection: direction,
|
|
9167
|
-
event,
|
|
9168
|
-
startX: e.clientX,
|
|
9169
|
-
startDay: event.startDay,
|
|
9170
|
-
startDuration: event.duration,
|
|
9171
|
-
originalStart: event.start,
|
|
9172
|
-
originalEnd: event.end
|
|
9173
|
-
};
|
|
9174
|
-
}, []);
|
|
9175
|
-
// Handle mouse move (dragging or resizing)
|
|
9176
|
-
var handleMouseMove = React.useCallback(e => {
|
|
9177
|
-
var dragState = dragStateRef.current;
|
|
9178
|
-
if (!dragState.event || !dragState.isDragging && !dragState.isResizing) return;
|
|
9179
|
-
if (!weekGridRef.current) return;
|
|
9180
|
-
var rect = weekGridRef.current.getBoundingClientRect();
|
|
9181
|
-
var dayWidth = rect.width / 7;
|
|
9182
|
-
var deltaX = e.clientX - dragState.startX;
|
|
9183
|
-
var daysDelta = Math.round(deltaX / dayWidth);
|
|
9184
|
-
if (dragState.isDragging) {
|
|
9185
|
-
// Calculate new position
|
|
9186
|
-
var newStartDay = Math.max(0, Math.min(6, dragState.startDay + daysDelta));
|
|
9187
|
-
var duration = dragState.event.duration;
|
|
9188
|
-
var newEndDay = Math.min(6, newStartDay + duration - 1);
|
|
9189
|
-
// Update drop target indicators
|
|
9190
|
-
var targetDays = [];
|
|
9191
|
-
for (var i = newStartDay; i <= newEndDay; i++) {
|
|
9192
|
-
targetDays.push(i);
|
|
9193
|
-
}
|
|
9194
|
-
setDropTargetDays(targetDays);
|
|
9195
|
-
// Update event position immediately for smooth dragging
|
|
9196
|
-
var updatedEvents = localEvents.map(ev => ev.id === dragState.event.id ? Object.assign({}, ev, {
|
|
9197
|
-
start: addDateDays$1(dragState.originalStart, newStartDay - dragState.startDay),
|
|
9198
|
-
end: addDateDays$1(dragState.originalEnd, newStartDay - dragState.startDay)
|
|
9199
|
-
}) : ev);
|
|
9200
|
-
setLocalEvents(updatedEvents);
|
|
9201
|
-
} else if (dragState.isResizing) {
|
|
9202
|
-
// Handle resizing
|
|
9203
|
-
if (dragState.resizeDirection === 'right') {
|
|
9204
|
-
var newDuration = Math.max(1, dragState.startDuration + daysDelta);
|
|
9205
|
-
var _newEndDay = Math.min(6, dragState.startDay + newDuration - 1);
|
|
9206
|
-
var actualDuration = _newEndDay - dragState.startDay + 1;
|
|
9207
|
-
var _updatedEvents = localEvents.map(ev => ev.id === dragState.event.id ? Object.assign({}, ev, {
|
|
9208
|
-
end: addDateDays$1(dragState.originalStart, actualDuration - 1)
|
|
9209
|
-
}) : ev);
|
|
9210
|
-
setLocalEvents(_updatedEvents);
|
|
9211
|
-
} else if (dragState.resizeDirection === 'left') {
|
|
9212
|
-
var _newStartDay = Math.max(0, Math.min(dragState.startDay + dragState.startDuration - 1, dragState.startDay + daysDelta));
|
|
9213
|
-
var _updatedEvents2 = localEvents.map(ev => ev.id === dragState.event.id ? Object.assign({}, ev, {
|
|
9214
|
-
start: addDateDays$1(dragState.originalStart, _newStartDay - dragState.startDay)
|
|
9215
|
-
}) : ev);
|
|
9216
|
-
setLocalEvents(_updatedEvents2);
|
|
9217
|
-
}
|
|
9218
|
-
}
|
|
9219
|
-
}, [localEvents]);
|
|
9220
|
-
// Handle mouse up (finish dragging or resizing)
|
|
9221
|
-
var handleMouseUp = React.useCallback(e => {
|
|
9222
|
-
var dragState = dragStateRef.current;
|
|
9223
|
-
if (!dragState.event || !dragState.isDragging && !dragState.isResizing) return;
|
|
9224
|
-
setDropTargetDays([]);
|
|
9225
|
-
// Find the updated event
|
|
9226
|
-
var updatedEvent = localEvents.find(ev => ev.id === dragState.event.id);
|
|
9227
|
-
if (!updatedEvent) return;
|
|
9228
|
-
// Call appropriate callback
|
|
9229
|
-
if (dragState.isDragging) {
|
|
9230
|
-
onEventDrop == null || onEventDrop(updatedEvent);
|
|
9231
|
-
} else if (dragState.isResizing) {
|
|
9232
|
-
onEventResize == null || onEventResize(updatedEvent);
|
|
9233
|
-
}
|
|
9234
|
-
// Reset drag state
|
|
9235
|
-
dragStateRef.current = {
|
|
9236
|
-
isDragging: false,
|
|
9237
|
-
isResizing: false,
|
|
9238
|
-
resizeDirection: null,
|
|
9239
|
-
event: null,
|
|
9240
|
-
startX: 0,
|
|
9241
|
-
startDay: 0,
|
|
9242
|
-
startDuration: 0,
|
|
9243
|
-
originalStart: null,
|
|
9244
|
-
originalEnd: null
|
|
9245
|
-
};
|
|
9246
|
-
}, [localEvents, onEventDrop, onEventResize]);
|
|
9247
|
-
// Set up global mouse event listeners
|
|
9248
|
-
React__default.useEffect(() => {
|
|
9249
|
-
document.addEventListener('mousemove', handleMouseMove);
|
|
9250
|
-
document.addEventListener('mouseup', handleMouseUp);
|
|
9251
|
-
return () => {
|
|
9252
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
9253
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
9254
|
-
};
|
|
9255
|
-
}, [handleMouseMove, handleMouseUp]);
|
|
9256
|
-
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, containerStyles$1, {
|
|
9257
|
-
width: width,
|
|
9258
|
-
maxWidth: maxWidth
|
|
9259
|
-
}, views.container), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
9260
|
-
ref: weekGridRef,
|
|
9261
|
-
display: "grid",
|
|
9262
|
-
gridTemplateColumns: "repeat(7, 1fr)",
|
|
9263
|
-
position: "relative",
|
|
9264
|
-
width: "100%"
|
|
9265
|
-
}, views.weekGrid), Array.from({
|
|
9266
|
-
length: 7
|
|
9267
|
-
}).map((_, dayIdx) => {
|
|
9268
|
-
var dateISO = getDateForDay(startDate, dayIdx);
|
|
9269
|
-
var dayOfWeek = getDayOfWeek$1(dateISO);
|
|
9270
|
-
var dateNum = getDateNumber$1(dateISO);
|
|
9271
|
-
var isToday = dateISO === today;
|
|
9272
|
-
var isSelected = dateISO === selectedDate;
|
|
9273
|
-
var isDropTarget = dropTargetDays.includes(dayIdx);
|
|
9274
|
-
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
9275
|
-
key: dayIdx
|
|
9276
|
-
}, dayColumnStyles, isDropTarget && dropTargetStyles$1, {
|
|
9277
|
-
borderRight: dayIdx === 6 ? 'none' : '1px solid'
|
|
9278
|
-
}, views.dayColumn), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, dayHeaderStyles, views.dayHeader), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, dayNameStyles, views.dayName), DAY_NAMES$1[dayOfWeek]), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, dayDateStyles, isToday && todayDateStyles, isSelected && !isToday && selectedDateStyles, {
|
|
9279
|
-
onClick: () => handleDateClick(dateISO)
|
|
9280
|
-
}, views.dayDate), dateNum)), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, eventsAreaStyles$1, views.eventsArea)));
|
|
9281
|
-
}), /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
9282
|
-
position: "absolute",
|
|
9283
|
-
top: 60,
|
|
9284
|
-
left: 0,
|
|
9285
|
-
right: 0,
|
|
9286
|
-
bottom: 0,
|
|
9287
|
-
pointerEvents: "none"
|
|
9288
|
-
}, positionedEvents.map(event => {
|
|
9289
|
-
var _dragStateRef$current, _dragStateRef$current2;
|
|
9290
|
-
var colorConfig = EVENT_COLORS$1[event.color || 'blue'];
|
|
9291
|
-
var positionStyles = getEventPositionStyles(event.startDay, event.duration, event.row);
|
|
9292
|
-
var isDragging = dragStateRef.current.isDragging && ((_dragStateRef$current = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current.id) === event.id;
|
|
9293
|
-
var isResizing = dragStateRef.current.isResizing && ((_dragStateRef$current2 = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current2.id) === event.id;
|
|
9294
|
-
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
9295
|
-
key: event.id,
|
|
9296
|
-
position: "absolute",
|
|
9297
|
-
height: 22,
|
|
9298
|
-
display: "flex",
|
|
9299
|
-
alignItems: "center",
|
|
9300
|
-
padding: 8,
|
|
9301
|
-
paddingLeft: 8,
|
|
9302
|
-
paddingRight: 8,
|
|
9303
|
-
borderRadius: 4,
|
|
9304
|
-
backgroundColor: colorConfig.background,
|
|
9305
|
-
borderLeft: "3px solid",
|
|
9306
|
-
borderLeftColor: colorConfig.border,
|
|
9307
|
-
color: colorConfig.text,
|
|
9308
|
-
fontSize: 12,
|
|
9309
|
-
fontWeight: 500,
|
|
9310
|
-
overflow: "hidden",
|
|
9311
|
-
cursor: isDragging ? 'grabbing' : 'grab',
|
|
9312
|
-
opacity: isDragging || isResizing ? 0.7 : 1,
|
|
9313
|
-
boxShadow: isDragging || isResizing ? '0 4px 12px rgba(0,0,0,0.3)' : '0 1px 2px rgba(0,0,0,0.1)',
|
|
9314
|
-
transition: isDragging || isResizing ? 'none' : 'box-shadow 0.2s',
|
|
9315
|
-
pointerEvents: "auto",
|
|
9316
|
-
userSelect: "none",
|
|
9317
|
-
left: positionStyles.left,
|
|
9318
|
-
width: positionStyles.width,
|
|
9319
|
-
top: positionStyles.top,
|
|
9320
|
-
onMouseDown: e => handleEventMouseDown(e, event)
|
|
9321
|
-
}, views.event), /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
9322
|
-
overflow: "hidden",
|
|
9323
|
-
textOverflow: "ellipsis",
|
|
9324
|
-
whiteSpace: "nowrap",
|
|
9325
|
-
width: "100%"
|
|
9326
|
-
}, event.title), /*#__PURE__*/React__default.createElement(ResizeHandle$1, {
|
|
9327
|
-
direction: "left",
|
|
9328
|
-
onMouseDown: e => handleResizeMouseDown(e, event, 'left')
|
|
9329
|
-
}), /*#__PURE__*/React__default.createElement(ResizeHandle$1, {
|
|
9330
|
-
direction: "right",
|
|
9331
|
-
onMouseDown: e => handleResizeMouseDown(e, event, 'right')
|
|
9332
|
-
}));
|
|
9333
|
-
}))));
|
|
9334
|
-
};
|
|
9335
|
-
|
|
9336
8898
|
/**
|
|
9337
8899
|
* Custom hook to manage cookie consent state
|
|
9338
8900
|
* @param cookieExpiration Number of days until the cookie expires
|
|
@@ -37661,7 +37223,6 @@ exports.BookmarkIcon = BookmarkIcon;
|
|
|
37661
37223
|
exports.Button = Button;
|
|
37662
37224
|
exports.Calendar = Calendar;
|
|
37663
37225
|
exports.CalendarIcon = CalendarIcon;
|
|
37664
|
-
exports.CalendarWeek = CalendarWeek;
|
|
37665
37226
|
exports.CameraIcon = CameraIcon;
|
|
37666
37227
|
exports.Card = Card;
|
|
37667
37228
|
exports.Carousel = Carousel;
|