@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
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('core-js/modules/es.object.assign.js'), require('react'), require('core-js/modules/es.array.includes.js'), require('core-js/modules/es.array.iterator.js'), require('core-js/modules/es.string.includes.js'), require('core-js/modules/web.dom-collections.iterator.js'), require('core-js/modules/es.regexp.to-string.js'), require('app-studio'), require('core-js/modules/es.symbol.description.js'), require('core-js/modules/es.parse-float.js'), require('core-js/modules/es.string.trim-end.js'), require('core-js/modules/es.parse-int.js'), require('core-js/modules/es.regexp.exec.js'), require('core-js/modules/es.string.replace.js'), require('core-js/modules/es.string.starts-with.js'), require('core-js/modules/es.string.trim.js'), require('core-js/modules/es.array-buffer.constructor.js'), require('core-js/modules/es.array-buffer.slice.js'), require('core-js/modules/es.typed-array.uint8-array.js'), require('core-js/modules/es.typed-array.fill.js'), require('core-js/modules/es.typed-array.set.js'), require('core-js/modules/es.typed-array.sort.js'), require('core-js/modules/es.typed-array.to-locale-string.js'), require('core-js/modules/web.url.js'), require('core-js/modules/web.url.to-json.js'), require('core-js/modules/web.url-search-params.js'), require('zustand'), require('react-router-dom'), require('core-js/modules/es.string.ends-with.js'), require('contrast'), require('core-js/modules/es.promise.js'), require('core-js/modules/es.array.reduce.js'), require('core-js/modules/es.number.to-fixed.js'), require('core-js/modules/es.
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'core-js/modules/es.object.assign.js', 'react', 'core-js/modules/es.array.includes.js', 'core-js/modules/es.array.iterator.js', 'core-js/modules/es.string.includes.js', 'core-js/modules/web.dom-collections.iterator.js', 'core-js/modules/es.regexp.to-string.js', 'app-studio', 'core-js/modules/es.symbol.description.js', 'core-js/modules/es.parse-float.js', 'core-js/modules/es.string.trim-end.js', 'core-js/modules/es.parse-int.js', 'core-js/modules/es.regexp.exec.js', 'core-js/modules/es.string.replace.js', 'core-js/modules/es.string.starts-with.js', 'core-js/modules/es.string.trim.js', 'core-js/modules/es.array-buffer.constructor.js', 'core-js/modules/es.array-buffer.slice.js', 'core-js/modules/es.typed-array.uint8-array.js', 'core-js/modules/es.typed-array.fill.js', 'core-js/modules/es.typed-array.set.js', 'core-js/modules/es.typed-array.sort.js', 'core-js/modules/es.typed-array.to-locale-string.js', 'core-js/modules/web.url.js', 'core-js/modules/web.url.to-json.js', 'core-js/modules/web.url-search-params.js', 'zustand', 'react-router-dom', 'core-js/modules/es.string.ends-with.js', 'contrast', 'core-js/modules/es.promise.js', 'core-js/modules/es.array.reduce.js', 'core-js/modules/es.number.to-fixed.js', 'core-js/modules/es.
|
|
4
|
-
(global = global || self, factory(global['@app-studio/web'] = {}, null, global.React, null, null, null, null, null, global.appStudio, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, global.zustand, global.reactRouterDom, null, global.contrast, null, null, null, null, null, global.
|
|
5
|
-
}(this, (function (exports, es_object_assign_js, React, es_array_includes_js, es_array_iterator_js, es_string_includes_js, web_domCollections_iterator_js, es_regexp_toString_js, appStudio, es_symbol_description_js, es_parseFloat_js, es_string_trimEnd_js, es_parseInt_js, es_regexp_exec_js, es_string_replace_js, es_string_startsWith_js, es_string_trim_js, es_arrayBuffer_constructor_js, es_arrayBuffer_slice_js, es_typedArray_uint8Array_js, es_typedArray_fill_js, es_typedArray_set_js, es_typedArray_sort_js, es_typedArray_toLocaleString_js, web_url_js, web_url_toJson_js, web_urlSearchParams_js, zustand, reactRouterDom, es_string_endsWith_js, contrast, es_promise_js, es_array_reduce_js, es_number_toFixed_js,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('core-js/modules/es.object.assign.js'), require('react'), require('core-js/modules/es.array.includes.js'), require('core-js/modules/es.array.iterator.js'), require('core-js/modules/es.string.includes.js'), require('core-js/modules/web.dom-collections.iterator.js'), require('core-js/modules/es.regexp.to-string.js'), require('app-studio'), require('core-js/modules/es.symbol.description.js'), require('core-js/modules/es.parse-float.js'), require('core-js/modules/es.string.trim-end.js'), require('core-js/modules/es.parse-int.js'), require('core-js/modules/es.regexp.exec.js'), require('core-js/modules/es.string.replace.js'), require('core-js/modules/es.string.starts-with.js'), require('core-js/modules/es.string.trim.js'), require('core-js/modules/es.array-buffer.constructor.js'), require('core-js/modules/es.array-buffer.slice.js'), require('core-js/modules/es.typed-array.uint8-array.js'), require('core-js/modules/es.typed-array.fill.js'), require('core-js/modules/es.typed-array.set.js'), require('core-js/modules/es.typed-array.sort.js'), require('core-js/modules/es.typed-array.to-locale-string.js'), require('core-js/modules/web.url.js'), require('core-js/modules/web.url.to-json.js'), require('core-js/modules/web.url-search-params.js'), require('zustand'), require('react-router-dom'), require('core-js/modules/es.string.ends-with.js'), require('contrast'), require('core-js/modules/es.promise.js'), require('core-js/modules/es.array.reduce.js'), require('core-js/modules/es.number.to-fixed.js'), require('core-js/modules/es.array.sort.js'), require('core-js/modules/es.string.pad-start.js'), require('date-fns/format'), require('core-js/modules/es.regexp.constructor.js'), require('formik'), require('src/services/api'), require('core-js/modules/es.promise.finally.js'), require('core-js/modules/es.string.match.js'), require('core-js/modules/es.string.search.js'), require('core-js/modules/es.array.flat-map.js'), require('core-js/modules/es.array.unscopables.flat-map.js')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'core-js/modules/es.object.assign.js', 'react', 'core-js/modules/es.array.includes.js', 'core-js/modules/es.array.iterator.js', 'core-js/modules/es.string.includes.js', 'core-js/modules/web.dom-collections.iterator.js', 'core-js/modules/es.regexp.to-string.js', 'app-studio', 'core-js/modules/es.symbol.description.js', 'core-js/modules/es.parse-float.js', 'core-js/modules/es.string.trim-end.js', 'core-js/modules/es.parse-int.js', 'core-js/modules/es.regexp.exec.js', 'core-js/modules/es.string.replace.js', 'core-js/modules/es.string.starts-with.js', 'core-js/modules/es.string.trim.js', 'core-js/modules/es.array-buffer.constructor.js', 'core-js/modules/es.array-buffer.slice.js', 'core-js/modules/es.typed-array.uint8-array.js', 'core-js/modules/es.typed-array.fill.js', 'core-js/modules/es.typed-array.set.js', 'core-js/modules/es.typed-array.sort.js', 'core-js/modules/es.typed-array.to-locale-string.js', 'core-js/modules/web.url.js', 'core-js/modules/web.url.to-json.js', 'core-js/modules/web.url-search-params.js', 'zustand', 'react-router-dom', 'core-js/modules/es.string.ends-with.js', 'contrast', 'core-js/modules/es.promise.js', 'core-js/modules/es.array.reduce.js', 'core-js/modules/es.number.to-fixed.js', 'core-js/modules/es.array.sort.js', 'core-js/modules/es.string.pad-start.js', 'date-fns/format', 'core-js/modules/es.regexp.constructor.js', 'formik', 'src/services/api', 'core-js/modules/es.promise.finally.js', 'core-js/modules/es.string.match.js', 'core-js/modules/es.string.search.js', 'core-js/modules/es.array.flat-map.js', 'core-js/modules/es.array.unscopables.flat-map.js'], factory) :
|
|
4
|
+
(global = global || self, factory(global['@app-studio/web'] = {}, null, global.React, null, null, null, null, null, global.appStudio, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, global.zustand, global.reactRouterDom, null, global.contrast, null, null, null, null, null, global.format, null, global.formik, global.api));
|
|
5
|
+
}(this, (function (exports, es_object_assign_js, React, es_array_includes_js, es_array_iterator_js, es_string_includes_js, web_domCollections_iterator_js, es_regexp_toString_js, appStudio, es_symbol_description_js, es_parseFloat_js, es_string_trimEnd_js, es_parseInt_js, es_regexp_exec_js, es_string_replace_js, es_string_startsWith_js, es_string_trim_js, es_arrayBuffer_constructor_js, es_arrayBuffer_slice_js, es_typedArray_uint8Array_js, es_typedArray_fill_js, es_typedArray_set_js, es_typedArray_sort_js, es_typedArray_toLocaleString_js, web_url_js, web_url_toJson_js, web_urlSearchParams_js, zustand, reactRouterDom, es_string_endsWith_js, contrast, es_promise_js, es_array_reduce_js, es_number_toFixed_js, es_array_sort_js, es_string_padStart_js, format, es_regexp_constructor_js, formik, api) { 'use strict';
|
|
6
6
|
|
|
7
7
|
var React__default = 'default' in React ? React['default'] : React;
|
|
8
8
|
contrast = contrast && Object.prototype.hasOwnProperty.call(contrast, 'default') ? contrast['default'] : contrast;
|
|
@@ -7801,7 +7801,6 @@
|
|
|
7801
7801
|
borderRadius: 10,
|
|
7802
7802
|
padding: "12px",
|
|
7803
7803
|
boxShadow: "0 1px 2px 0 rgba(16, 24, 40, 0.08)",
|
|
7804
|
-
opacity: draggedCardId === card.id ? 0.6 : 1,
|
|
7805
7804
|
onDragStart: event => onCardDragStart(column.id, card.id, event),
|
|
7806
7805
|
onDragEnd: onCardDragEnd,
|
|
7807
7806
|
onDragOver: event => {
|
|
@@ -8074,8 +8073,8 @@
|
|
|
8074
8073
|
* Month grid styles (7 columns for days)
|
|
8075
8074
|
*/
|
|
8076
8075
|
var monthGridStyles = {
|
|
8077
|
-
display: '
|
|
8078
|
-
|
|
8076
|
+
display: 'flex',
|
|
8077
|
+
flexDirection: 'column',
|
|
8079
8078
|
backgroundColor: 'color.white'
|
|
8080
8079
|
};
|
|
8081
8080
|
/**
|
|
@@ -8105,15 +8104,32 @@
|
|
|
8105
8104
|
*/
|
|
8106
8105
|
var dayCellStyles = {
|
|
8107
8106
|
border: '1px solid',
|
|
8108
|
-
borderColor: 'color.gray.
|
|
8109
|
-
minHeight:
|
|
8110
|
-
padding:
|
|
8111
|
-
paddingTop:
|
|
8107
|
+
borderColor: 'color.gray.100',
|
|
8108
|
+
minHeight: 120,
|
|
8109
|
+
padding: 4,
|
|
8110
|
+
paddingTop: 2,
|
|
8112
8111
|
backgroundColor: 'color.white',
|
|
8113
8112
|
position: 'relative',
|
|
8114
8113
|
display: 'flex',
|
|
8115
8114
|
flexDirection: 'column'
|
|
8116
8115
|
};
|
|
8116
|
+
/**
|
|
8117
|
+
* Day date styles (the circular number)
|
|
8118
|
+
*/
|
|
8119
|
+
var dayDateStyles = {
|
|
8120
|
+
width: 36,
|
|
8121
|
+
height: 36,
|
|
8122
|
+
display: 'flex',
|
|
8123
|
+
alignItems: 'center',
|
|
8124
|
+
justifyContent: 'center',
|
|
8125
|
+
borderRadius: '50%',
|
|
8126
|
+
fontSize: 13,
|
|
8127
|
+
fontWeight: 400,
|
|
8128
|
+
color: 'color.gray.900',
|
|
8129
|
+
cursor: 'pointer',
|
|
8130
|
+
transition: 'all 0.2s',
|
|
8131
|
+
border: '2px solid transparent'
|
|
8132
|
+
};
|
|
8117
8133
|
/**
|
|
8118
8134
|
* Day cell from different month
|
|
8119
8135
|
*/
|
|
@@ -8248,6 +8264,9 @@
|
|
|
8248
8264
|
onMouseLeave: () => setIsHovered(false)
|
|
8249
8265
|
}));
|
|
8250
8266
|
};
|
|
8267
|
+
var MONTH_EVENT_ROW_HEIGHT = 22;
|
|
8268
|
+
var MONTH_EVENT_ROW_GAP = 4;
|
|
8269
|
+
var MONTH_EVENT_TOP_OFFSET = 32;
|
|
8251
8270
|
var Calendar = _ref2 => {
|
|
8252
8271
|
var {
|
|
8253
8272
|
initialDate = new Date(),
|
|
@@ -8311,10 +8330,64 @@
|
|
|
8311
8330
|
return [currentDate];
|
|
8312
8331
|
}
|
|
8313
8332
|
}, [currentDate, currentView, currentMonth, weekStartsOn]);
|
|
8333
|
+
var monthWeeks = React.useMemo(() => {
|
|
8334
|
+
var chunks = [];
|
|
8335
|
+
for (var i = 0; i < calendarDates.length; i += 7) {
|
|
8336
|
+
chunks.push(calendarDates.slice(i, i + 7));
|
|
8337
|
+
}
|
|
8338
|
+
return chunks;
|
|
8339
|
+
}, [calendarDates]);
|
|
8314
8340
|
// Layout events
|
|
8315
8341
|
var {
|
|
8316
8342
|
items: positionedEvents
|
|
8317
8343
|
} = React.useMemo(() => layoutEvents(localEvents, calendarDates), [localEvents, calendarDates]);
|
|
8344
|
+
var monthWeeksWithEvents = React.useMemo(() => {
|
|
8345
|
+
return monthWeeks.map((dates, weekIndex) => {
|
|
8346
|
+
var weekStartIdx = weekIndex * 7;
|
|
8347
|
+
var weekEndIdx = weekStartIdx + dates.length - 1;
|
|
8348
|
+
var segments = positionedEvents.filter(event => !(event.startDay > weekEndIdx || event.endDay < weekStartIdx)).map(event => {
|
|
8349
|
+
var segmentStart = Math.max(event.startDay, weekStartIdx);
|
|
8350
|
+
var segmentEnd = Math.min(event.endDay, weekEndIdx);
|
|
8351
|
+
return Object.assign({}, event, {
|
|
8352
|
+
weekIndex,
|
|
8353
|
+
segmentStartDay: segmentStart - weekStartIdx,
|
|
8354
|
+
segmentEndDay: segmentEnd - weekStartIdx,
|
|
8355
|
+
segmentDuration: segmentEnd - segmentStart + 1,
|
|
8356
|
+
segmentRow: 0
|
|
8357
|
+
});
|
|
8358
|
+
});
|
|
8359
|
+
segments.sort((a, b) => {
|
|
8360
|
+
if (a.segmentStartDay !== b.segmentStartDay) {
|
|
8361
|
+
return a.segmentStartDay - b.segmentStartDay;
|
|
8362
|
+
}
|
|
8363
|
+
return b.segmentDuration - a.segmentDuration;
|
|
8364
|
+
});
|
|
8365
|
+
var rows = [];
|
|
8366
|
+
segments.forEach(segment => {
|
|
8367
|
+
var placed = false;
|
|
8368
|
+
for (var rowIdx = 0; rowIdx < rows.length; rowIdx++) {
|
|
8369
|
+
var row = rows[rowIdx];
|
|
8370
|
+
var conflict = row.some(existing => !(segment.segmentStartDay > existing.segmentEndDay || segment.segmentEndDay < existing.segmentStartDay));
|
|
8371
|
+
if (!conflict) {
|
|
8372
|
+
segment.segmentRow = rowIdx;
|
|
8373
|
+
row.push(segment);
|
|
8374
|
+
placed = true;
|
|
8375
|
+
break;
|
|
8376
|
+
}
|
|
8377
|
+
}
|
|
8378
|
+
if (!placed) {
|
|
8379
|
+
segment.segmentRow = rows.length;
|
|
8380
|
+
rows.push([segment]);
|
|
8381
|
+
}
|
|
8382
|
+
});
|
|
8383
|
+
return {
|
|
8384
|
+
weekIndex,
|
|
8385
|
+
dates,
|
|
8386
|
+
segments,
|
|
8387
|
+
rowCount: rows.length
|
|
8388
|
+
};
|
|
8389
|
+
});
|
|
8390
|
+
}, [monthWeeks, positionedEvents]);
|
|
8318
8391
|
// Get day names
|
|
8319
8392
|
var dayNames = React.useMemo(() => getDayNames(weekStartsOn), [weekStartsOn]);
|
|
8320
8393
|
// Handle navigation
|
|
@@ -8374,10 +8447,9 @@
|
|
|
8374
8447
|
onEventAdd(start, end);
|
|
8375
8448
|
}
|
|
8376
8449
|
}, [onEventAdd]);
|
|
8377
|
-
// Handle event
|
|
8378
|
-
var
|
|
8379
|
-
e.
|
|
8380
|
-
e.dataTransfer.setData('eventId', event.id);
|
|
8450
|
+
// Handle mouse down on event (start dragging)
|
|
8451
|
+
var handleEventMouseDown = React.useCallback((e, event) => {
|
|
8452
|
+
e.preventDefault();
|
|
8381
8453
|
dragStateRef.current = {
|
|
8382
8454
|
isDragging: true,
|
|
8383
8455
|
isResizing: false,
|
|
@@ -8390,52 +8462,7 @@
|
|
|
8390
8462
|
originalEnd: event.end
|
|
8391
8463
|
};
|
|
8392
8464
|
}, []);
|
|
8393
|
-
// Handle
|
|
8394
|
-
var handleDragOver = React.useCallback((e, dayIndex) => {
|
|
8395
|
-
e.preventDefault();
|
|
8396
|
-
e.dataTransfer.dropEffect = 'move';
|
|
8397
|
-
setDropTargetDays([dayIndex]);
|
|
8398
|
-
}, []);
|
|
8399
|
-
// Handle drag leave
|
|
8400
|
-
var handleDragLeave = React.useCallback(() => {
|
|
8401
|
-
setDropTargetDays([]);
|
|
8402
|
-
}, []);
|
|
8403
|
-
// Handle drop on day cell
|
|
8404
|
-
var handleDrop = React.useCallback((e, dayIndex) => {
|
|
8405
|
-
e.preventDefault();
|
|
8406
|
-
setDropTargetDays([]);
|
|
8407
|
-
var dragState = dragStateRef.current;
|
|
8408
|
-
if (!dragState.event || !dragState.originalStart || !dragState.originalEnd) return;
|
|
8409
|
-
// Calculate date difference
|
|
8410
|
-
var targetDate = calendarDates[dayIndex];
|
|
8411
|
-
if (!targetDate) return;
|
|
8412
|
-
var daysDiff = daysBetweenUTC(targetDate, dragState.originalStart.slice(0, 10));
|
|
8413
|
-
// Update event dates
|
|
8414
|
-
var newStart = addDateDays(dragState.originalStart.slice(0, 10), daysDiff);
|
|
8415
|
-
var newEnd = addDateDays(dragState.originalEnd.slice(0, 10), daysDiff);
|
|
8416
|
-
var updatedEvent = Object.assign({}, dragState.event, {
|
|
8417
|
-
start: newStart,
|
|
8418
|
-
end: newEnd
|
|
8419
|
-
});
|
|
8420
|
-
// Update local events
|
|
8421
|
-
var updatedEvents = localEvents.map(ev => ev.id === dragState.event.id ? updatedEvent : ev);
|
|
8422
|
-
setLocalEvents(updatedEvents);
|
|
8423
|
-
// Call callback
|
|
8424
|
-
onEventDrop == null || onEventDrop(updatedEvent);
|
|
8425
|
-
// Reset drag state
|
|
8426
|
-
dragStateRef.current = {
|
|
8427
|
-
isDragging: false,
|
|
8428
|
-
isResizing: false,
|
|
8429
|
-
resizeDirection: null,
|
|
8430
|
-
event: null,
|
|
8431
|
-
startX: 0,
|
|
8432
|
-
startDay: 0,
|
|
8433
|
-
startDuration: 0,
|
|
8434
|
-
originalStart: null,
|
|
8435
|
-
originalEnd: null
|
|
8436
|
-
};
|
|
8437
|
-
}, [localEvents, calendarDates, onEventDrop]);
|
|
8438
|
-
// Handle resize start (FIXED - using pixel-based approach like CalendarWeek)
|
|
8465
|
+
// Handle resize start
|
|
8439
8466
|
var handleResizeStart = React.useCallback((e, event, direction) => {
|
|
8440
8467
|
e.preventDefault();
|
|
8441
8468
|
e.stopPropagation();
|
|
@@ -8451,7 +8478,7 @@
|
|
|
8451
8478
|
originalEnd: event.end
|
|
8452
8479
|
};
|
|
8453
8480
|
}, []);
|
|
8454
|
-
// Handle mouse move during resize
|
|
8481
|
+
// Handle mouse move during resize or drag
|
|
8455
8482
|
var handleMouseMove = React.useCallback(e => {
|
|
8456
8483
|
var dragState = dragStateRef.current;
|
|
8457
8484
|
if (!dragState.event || !dragState.isDragging && !dragState.isResizing) return;
|
|
@@ -8573,54 +8600,89 @@
|
|
|
8573
8600
|
key: index
|
|
8574
8601
|
}, weekdayLabelStyles, views.weekdayLabel), dayName)))), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
8575
8602
|
ref: gridRef
|
|
8576
|
-
}, monthGridStyles, views.monthGrid),
|
|
8577
|
-
var
|
|
8578
|
-
var
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
|
|
8590
|
-
|
|
8591
|
-
|
|
8592
|
-
|
|
8593
|
-
|
|
8594
|
-
|
|
8595
|
-
}
|
|
8596
|
-
|
|
8603
|
+
}, monthGridStyles, views.monthGrid), monthWeeksWithEvents.map(week => {
|
|
8604
|
+
var weekStartIdx = week.weekIndex * 7;
|
|
8605
|
+
var weekEndIdx = weekStartIdx + week.dates.length - 1;
|
|
8606
|
+
return /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
8607
|
+
key: "week-" + week.weekIndex,
|
|
8608
|
+
position: "relative"
|
|
8609
|
+
}, /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
8610
|
+
display: "grid",
|
|
8611
|
+
gridTemplateColumns: "repeat(7, 1fr)"
|
|
8612
|
+
}, week.dates.map((dateISO, dayOffset) => {
|
|
8613
|
+
var dateNum = getDateNumber(dateISO);
|
|
8614
|
+
var isToday = dateISO === today;
|
|
8615
|
+
var isSelected = dateISO === selectedDate;
|
|
8616
|
+
var isCurrentMonth = isInMonth(dateISO, currentMonth);
|
|
8617
|
+
var dayIndex = weekStartIdx + dayOffset;
|
|
8618
|
+
var isDropTarget = dropTargetDays.includes(dayIndex);
|
|
8619
|
+
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
8620
|
+
key: dateISO,
|
|
8621
|
+
"data-date": dateISO
|
|
8622
|
+
}, dayCellStyles, !isCurrentMonth && otherMonthDayCellStyles, isDropTarget && dropTargetStyles, {
|
|
8623
|
+
onClick: () => handleDateClick(dateISO),
|
|
8624
|
+
onDoubleClick: () => handleDateDoubleClick(dateISO)
|
|
8625
|
+
}, views.dayCell), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, dayNumberStyles, isToday && todayDayNumberStyles, isSelected && !isToday && selectedDayNumberStyles, {
|
|
8626
|
+
style: {
|
|
8627
|
+
cursor: 'pointer'
|
|
8628
|
+
}
|
|
8629
|
+
}, views.dayNumber), dateNum));
|
|
8630
|
+
})), week.segments.length > 0 && (/*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
8631
|
+
position: "absolute",
|
|
8632
|
+
left: 0,
|
|
8633
|
+
right: 0,
|
|
8634
|
+
top: MONTH_EVENT_TOP_OFFSET,
|
|
8635
|
+
pointerEvents: "none"
|
|
8636
|
+
}, week.segments.map(event => {
|
|
8637
|
+
var _dragStateRef$current, _dragStateRef$current2;
|
|
8597
8638
|
var colorConfig = EVENT_COLORS[event.color || 'blue'];
|
|
8598
|
-
var
|
|
8599
|
-
var
|
|
8600
|
-
|
|
8639
|
+
var dayWidth = 100 / week.dates.length;
|
|
8640
|
+
var left = event.segmentStartDay * dayWidth;
|
|
8641
|
+
var width = event.segmentDuration * dayWidth;
|
|
8642
|
+
var isDragging = dragStateRef.current.isDragging && ((_dragStateRef$current = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current.id) === event.id;
|
|
8643
|
+
var isResizing = dragStateRef.current.isResizing && ((_dragStateRef$current2 = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current2.id) === event.id;
|
|
8644
|
+
var showLeftHandle = event.startDay >= weekStartIdx && event.startDay <= weekEndIdx && event.segmentStartDay === event.startDay - weekStartIdx;
|
|
8645
|
+
var showRightHandle = event.endDay >= weekStartIdx && event.endDay <= weekEndIdx && event.segmentEndDay === event.endDay - weekStartIdx;
|
|
8601
8646
|
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
8602
|
-
key: event.id,
|
|
8603
|
-
position: "
|
|
8604
|
-
|
|
8647
|
+
key: event.id + "-" + event.weekIndex + "-" + event.segmentStartDay,
|
|
8648
|
+
position: "absolute",
|
|
8649
|
+
height: MONTH_EVENT_ROW_HEIGHT,
|
|
8650
|
+
display: "flex",
|
|
8651
|
+
alignItems: "center",
|
|
8652
|
+
paddingLeft: 8,
|
|
8653
|
+
paddingRight: 8,
|
|
8654
|
+
borderRadius: 4,
|
|
8605
8655
|
backgroundColor: colorConfig.background,
|
|
8656
|
+
borderLeft: "3px solid",
|
|
8606
8657
|
borderLeftColor: colorConfig.border,
|
|
8607
8658
|
color: colorConfig.text,
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8659
|
+
fontSize: 11,
|
|
8660
|
+
fontWeight: 500,
|
|
8661
|
+
overflow: "hidden",
|
|
8662
|
+
cursor: isDragging ? 'grabbing' : 'grab',
|
|
8663
|
+
opacity: isDragging || isResizing ? 0.7 : 1,
|
|
8664
|
+
boxShadow: isDragging || isResizing ? '0 4px 12px rgba(0,0,0,0.3)' : '0 1px 2px rgba(0,0,0,0.1)',
|
|
8665
|
+
transition: isDragging || isResizing ? 'none' : 'box-shadow 0.2s',
|
|
8666
|
+
pointerEvents: "auto",
|
|
8667
|
+
userSelect: "none",
|
|
8668
|
+
left: "calc(" + left + "% + 4px)",
|
|
8669
|
+
width: "calc(" + width + "% - 8px)",
|
|
8670
|
+
top: event.segmentRow * (MONTH_EVENT_ROW_HEIGHT + MONTH_EVENT_ROW_GAP) + "px",
|
|
8671
|
+
onMouseDown: e => handleEventMouseDown(e, event),
|
|
8672
|
+
title: event.title
|
|
8611
8673
|
}, views.event), /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
8612
8674
|
overflow: "hidden",
|
|
8613
8675
|
textOverflow: "ellipsis",
|
|
8614
8676
|
whiteSpace: "nowrap",
|
|
8615
8677
|
width: "100%"
|
|
8616
|
-
}, event.title,
|
|
8678
|
+
}, event.title), showLeftHandle && (/*#__PURE__*/React__default.createElement(ResizeHandle, {
|
|
8617
8679
|
direction: "left",
|
|
8618
8680
|
onMouseDown: e => handleResizeStart(e, event, 'left')
|
|
8619
|
-
}), /*#__PURE__*/React__default.createElement(ResizeHandle, {
|
|
8681
|
+
})), showRightHandle && (/*#__PURE__*/React__default.createElement(ResizeHandle, {
|
|
8620
8682
|
direction: "right",
|
|
8621
8683
|
onMouseDown: e => handleResizeStart(e, event, 'right')
|
|
8622
|
-
}));
|
|
8623
|
-
})));
|
|
8684
|
+
})));
|
|
8685
|
+
}))));
|
|
8624
8686
|
}))));
|
|
8625
8687
|
// Render week view
|
|
8626
8688
|
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) => {
|
|
@@ -8634,7 +8696,7 @@
|
|
|
8634
8696
|
alignItems: "center",
|
|
8635
8697
|
padding: 8,
|
|
8636
8698
|
gap: 4
|
|
8637
|
-
}, views.weekdayLabel), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, weekdayLabelStyles), DAY_NAMES[dayOfWeek]), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({},
|
|
8699
|
+
}, 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, {
|
|
8638
8700
|
fontSize: 16,
|
|
8639
8701
|
fontWeight: isToday ? 500 : 400
|
|
8640
8702
|
}), dateNum));
|
|
@@ -8652,14 +8714,14 @@
|
|
|
8652
8714
|
}, dayCellStyles, isDropTarget && dropTargetStyles, {
|
|
8653
8715
|
minHeight: 400,
|
|
8654
8716
|
onClick: () => handleDateClick(dateISO),
|
|
8655
|
-
onDoubleClick: () => handleDateDoubleClick(dateISO)
|
|
8656
|
-
onDragOver: e => handleDragOver(e, index),
|
|
8657
|
-
onDragLeave: handleDragLeave,
|
|
8658
|
-
onDrop: e => handleDrop(e, index)
|
|
8717
|
+
onDoubleClick: () => handleDateDoubleClick(dateISO)
|
|
8659
8718
|
}), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, eventsAreaStyles, views.eventsArea), dayEvents.map(event => {
|
|
8719
|
+
var _dragStateRef$current3, _dragStateRef$current4;
|
|
8660
8720
|
var colorConfig = EVENT_COLORS[event.color || 'blue'];
|
|
8661
8721
|
var isFirstDay = event.isFirstDay !== false;
|
|
8662
8722
|
if (!isFirstDay) return null;
|
|
8723
|
+
var isDragging = dragStateRef.current.isDragging && ((_dragStateRef$current3 = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current3.id) === event.id;
|
|
8724
|
+
var isResizing = dragStateRef.current.isResizing && ((_dragStateRef$current4 = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current4.id) === event.id;
|
|
8663
8725
|
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
8664
8726
|
key: event.id,
|
|
8665
8727
|
position: "relative"
|
|
@@ -8667,8 +8729,12 @@
|
|
|
8667
8729
|
backgroundColor: colorConfig.background,
|
|
8668
8730
|
borderLeftColor: colorConfig.border,
|
|
8669
8731
|
color: colorConfig.text,
|
|
8670
|
-
|
|
8671
|
-
|
|
8732
|
+
cursor: isDragging ? 'grabbing' : 'grab',
|
|
8733
|
+
opacity: isDragging || isResizing ? 0.7 : 1,
|
|
8734
|
+
boxShadow: isDragging || isResizing ? '0 4px 12px rgba(0,0,0,0.3)' : '0 1px 2px rgba(0,0,0,0.1)',
|
|
8735
|
+
transition: isDragging || isResizing ? 'none' : 'box-shadow 0.2s',
|
|
8736
|
+
userSelect: "none",
|
|
8737
|
+
onMouseDown: e => handleEventMouseDown(e, event),
|
|
8672
8738
|
title: event.title
|
|
8673
8739
|
}, views.event), /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
8674
8740
|
overflow: "hidden",
|
|
@@ -8787,509 +8853,6 @@
|
|
|
8787
8853
|
}, views.navButton), "\u203A")))), currentView === 'month' && renderMonthView(), currentView === 'week' && renderWeekView(), currentView === 'day' && renderDayView());
|
|
8788
8854
|
};
|
|
8789
8855
|
|
|
8790
|
-
/**
|
|
8791
|
-
* Convert an ISO date string to a UTC Date object
|
|
8792
|
-
*/
|
|
8793
|
-
var dateUTC$1 = iso => {
|
|
8794
|
-
return new Date(iso + (iso.includes('T') ? '' : 'T00:00:00Z'));
|
|
8795
|
-
};
|
|
8796
|
-
/**
|
|
8797
|
-
* Calculate the number of days between two ISO date strings
|
|
8798
|
-
*/
|
|
8799
|
-
var daysBetweenUTC$1 = (a, b) => {
|
|
8800
|
-
return Math.floor((dateUTC$1(a).getTime() - dateUTC$1(b).getTime()) / 86400000);
|
|
8801
|
-
};
|
|
8802
|
-
/**
|
|
8803
|
-
* Add a number of days to an ISO date string
|
|
8804
|
-
*/
|
|
8805
|
-
var addDateDays$1 = (dateISO, days) => {
|
|
8806
|
-
var d = new Date(dateISO + 'T00:00:00Z');
|
|
8807
|
-
d.setUTCDate(d.getUTCDate() + days);
|
|
8808
|
-
return d.toISOString().slice(0, 10);
|
|
8809
|
-
};
|
|
8810
|
-
/**
|
|
8811
|
-
* Get the day of the week (0-6) from an ISO date string
|
|
8812
|
-
*/
|
|
8813
|
-
var getDayOfWeek$1 = dateISO => {
|
|
8814
|
-
return dateUTC$1(dateISO).getUTCDay();
|
|
8815
|
-
};
|
|
8816
|
-
/**
|
|
8817
|
-
* Get the date number (1-31) from an ISO date string
|
|
8818
|
-
*/
|
|
8819
|
-
var getDateNumber$1 = dateISO => {
|
|
8820
|
-
return dateUTC$1(dateISO).getUTCDate();
|
|
8821
|
-
};
|
|
8822
|
-
/**
|
|
8823
|
-
* Layout events with proper positioning to avoid overlaps
|
|
8824
|
-
* Returns positioned events and the total number of rows needed
|
|
8825
|
-
*/
|
|
8826
|
-
var layoutEvents$1 = (events, weekStart) => {
|
|
8827
|
-
// Convert events to positioned items with day indices
|
|
8828
|
-
var items = events.map(ev => {
|
|
8829
|
-
var startIdx = daysBetweenUTC$1(ev.start, weekStart);
|
|
8830
|
-
var endIdx = daysBetweenUTC$1(ev.end, weekStart);
|
|
8831
|
-
// Clamp to week boundaries
|
|
8832
|
-
var clampedStart = Math.max(0, Math.min(6, startIdx));
|
|
8833
|
-
var clampedEnd = Math.max(0, Math.min(6, endIdx));
|
|
8834
|
-
// Skip if completely outside week
|
|
8835
|
-
if (endIdx < 0 || startIdx > 6) return null;
|
|
8836
|
-
var duration = clampedEnd - clampedStart + 1;
|
|
8837
|
-
return Object.assign({}, ev, {
|
|
8838
|
-
startDay: clampedStart,
|
|
8839
|
-
endDay: clampedEnd,
|
|
8840
|
-
duration: duration,
|
|
8841
|
-
row: 0
|
|
8842
|
-
});
|
|
8843
|
-
}).filter(item => item !== null);
|
|
8844
|
-
// Sort by start day, then by duration (longer first)
|
|
8845
|
-
items.sort((a, b) => {
|
|
8846
|
-
if (a.startDay !== b.startDay) return a.startDay - b.startDay;
|
|
8847
|
-
return b.duration - a.duration;
|
|
8848
|
-
});
|
|
8849
|
-
// Assign rows using greedy algorithm to prevent overlaps
|
|
8850
|
-
var rows = [];
|
|
8851
|
-
items.forEach(item => {
|
|
8852
|
-
var placed = false;
|
|
8853
|
-
for (var i = 0; i < rows.length; i++) {
|
|
8854
|
-
var row = rows[i];
|
|
8855
|
-
var hasConflict = row.some(existing => !(item.startDay > existing.endDay || item.endDay < existing.startDay));
|
|
8856
|
-
if (!hasConflict) {
|
|
8857
|
-
row.push(item);
|
|
8858
|
-
item.row = i;
|
|
8859
|
-
placed = true;
|
|
8860
|
-
break;
|
|
8861
|
-
}
|
|
8862
|
-
}
|
|
8863
|
-
if (!placed) {
|
|
8864
|
-
item.row = rows.length;
|
|
8865
|
-
rows.push([item]);
|
|
8866
|
-
}
|
|
8867
|
-
});
|
|
8868
|
-
return {
|
|
8869
|
-
items,
|
|
8870
|
-
rowCount: rows.length
|
|
8871
|
-
};
|
|
8872
|
-
};
|
|
8873
|
-
/**
|
|
8874
|
-
* Day names array (Sunday to Saturday)
|
|
8875
|
-
*/
|
|
8876
|
-
var DAY_NAMES$1 = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
8877
|
-
/**
|
|
8878
|
-
* Get the date ISO string for a specific day in the week
|
|
8879
|
-
*/
|
|
8880
|
-
var getDateForDay = (weekStart, dayIndex) => {
|
|
8881
|
-
return addDateDays$1(weekStart, dayIndex);
|
|
8882
|
-
};
|
|
8883
|
-
|
|
8884
|
-
/**
|
|
8885
|
-
* Event color configurations
|
|
8886
|
-
*/
|
|
8887
|
-
var EVENT_COLORS$1 = {
|
|
8888
|
-
blue: {
|
|
8889
|
-
background: 'color.blue.50',
|
|
8890
|
-
border: 'color.blue.500',
|
|
8891
|
-
text: 'color.blue.700'
|
|
8892
|
-
},
|
|
8893
|
-
red: {
|
|
8894
|
-
background: 'color.red.50',
|
|
8895
|
-
border: 'color.red.500',
|
|
8896
|
-
text: 'color.red.700'
|
|
8897
|
-
},
|
|
8898
|
-
green: {
|
|
8899
|
-
background: 'color.green.50',
|
|
8900
|
-
border: 'color.green.500',
|
|
8901
|
-
text: 'color.green.700'
|
|
8902
|
-
},
|
|
8903
|
-
purple: {
|
|
8904
|
-
background: 'color.purple.50',
|
|
8905
|
-
border: 'color.purple.500',
|
|
8906
|
-
text: 'color.purple.700'
|
|
8907
|
-
},
|
|
8908
|
-
orange: {
|
|
8909
|
-
background: 'color.orange.50',
|
|
8910
|
-
border: 'color.orange.500',
|
|
8911
|
-
text: 'color.orange.700'
|
|
8912
|
-
}
|
|
8913
|
-
};
|
|
8914
|
-
/**
|
|
8915
|
-
* Base styles for the calendar container
|
|
8916
|
-
*/
|
|
8917
|
-
var containerStyles$1 = {
|
|
8918
|
-
width: '100%',
|
|
8919
|
-
maxWidth: 1200,
|
|
8920
|
-
border: '1px solid',
|
|
8921
|
-
borderColor: 'color.gray.200',
|
|
8922
|
-
borderRadius: 8,
|
|
8923
|
-
overflow: 'hidden',
|
|
8924
|
-
backgroundColor: 'color.white'
|
|
8925
|
-
};
|
|
8926
|
-
/**
|
|
8927
|
-
* Individual day column styles
|
|
8928
|
-
*/
|
|
8929
|
-
var dayColumnStyles = {
|
|
8930
|
-
borderRight: '1px solid',
|
|
8931
|
-
borderColor: 'color.gray.200',
|
|
8932
|
-
display: 'flex',
|
|
8933
|
-
flexDirection: 'column',
|
|
8934
|
-
minHeight: 160,
|
|
8935
|
-
backgroundColor: 'color.white',
|
|
8936
|
-
position: 'relative'
|
|
8937
|
-
};
|
|
8938
|
-
/**
|
|
8939
|
-
* Day header styles
|
|
8940
|
-
*/
|
|
8941
|
-
var dayHeaderStyles = {
|
|
8942
|
-
padding: 8,
|
|
8943
|
-
borderBottom: '1px solid',
|
|
8944
|
-
borderColor: 'color.gray.200',
|
|
8945
|
-
backgroundColor: 'color.gray.50',
|
|
8946
|
-
minHeight: 60,
|
|
8947
|
-
display: 'flex',
|
|
8948
|
-
flexDirection: 'column',
|
|
8949
|
-
alignItems: 'center',
|
|
8950
|
-
justifyContent: 'center',
|
|
8951
|
-
gap: 4
|
|
8952
|
-
};
|
|
8953
|
-
/**
|
|
8954
|
-
* Day name styles (e.g., "Mon", "Tue")
|
|
8955
|
-
*/
|
|
8956
|
-
var dayNameStyles = {
|
|
8957
|
-
fontSize: 11,
|
|
8958
|
-
fontWeight: 500,
|
|
8959
|
-
color: 'color.gray.700',
|
|
8960
|
-
textTransform: 'uppercase',
|
|
8961
|
-
letterSpacing: 0.5
|
|
8962
|
-
};
|
|
8963
|
-
/**
|
|
8964
|
-
* Day date styles (the circular number)
|
|
8965
|
-
*/
|
|
8966
|
-
var dayDateStyles = {
|
|
8967
|
-
width: 36,
|
|
8968
|
-
height: 36,
|
|
8969
|
-
display: 'flex',
|
|
8970
|
-
alignItems: 'center',
|
|
8971
|
-
justifyContent: 'center',
|
|
8972
|
-
borderRadius: '50%',
|
|
8973
|
-
fontSize: 13,
|
|
8974
|
-
fontWeight: 400,
|
|
8975
|
-
color: 'color.gray.900',
|
|
8976
|
-
cursor: 'pointer',
|
|
8977
|
-
transition: 'all 0.2s',
|
|
8978
|
-
border: '2px solid transparent'
|
|
8979
|
-
};
|
|
8980
|
-
/**
|
|
8981
|
-
* Today date styles
|
|
8982
|
-
*/
|
|
8983
|
-
var todayDateStyles = {
|
|
8984
|
-
backgroundColor: 'color.blue.500',
|
|
8985
|
-
color: 'color.white',
|
|
8986
|
-
fontWeight: 500
|
|
8987
|
-
};
|
|
8988
|
-
/**
|
|
8989
|
-
* Selected date styles
|
|
8990
|
-
*/
|
|
8991
|
-
var selectedDateStyles = {
|
|
8992
|
-
borderColor: 'color.blue.500'
|
|
8993
|
-
};
|
|
8994
|
-
/**
|
|
8995
|
-
* Events area styles
|
|
8996
|
-
*/
|
|
8997
|
-
var eventsAreaStyles$1 = {
|
|
8998
|
-
padding: 8,
|
|
8999
|
-
paddingLeft: 6,
|
|
9000
|
-
paddingRight: 6,
|
|
9001
|
-
flex: 1,
|
|
9002
|
-
position: 'relative'
|
|
9003
|
-
};
|
|
9004
|
-
/**
|
|
9005
|
-
* Drop target indicator styles
|
|
9006
|
-
*/
|
|
9007
|
-
var dropTargetStyles$1 = {
|
|
9008
|
-
backgroundColor: 'rgba(26, 115, 232, 0.05)'
|
|
9009
|
-
};
|
|
9010
|
-
/**
|
|
9011
|
-
* Calculate event position styles
|
|
9012
|
-
*/
|
|
9013
|
-
var getEventPositionStyles = (startDay, duration, row) => {
|
|
9014
|
-
var dayWidth = 100 / 7;
|
|
9015
|
-
var left = startDay * dayWidth;
|
|
9016
|
-
var width = duration * dayWidth;
|
|
9017
|
-
return {
|
|
9018
|
-
left: "calc(" + left + "% + 6px)",
|
|
9019
|
-
width: "calc(" + width + "% - 12px)",
|
|
9020
|
-
top: 8 + row * 26 + "px"
|
|
9021
|
-
};
|
|
9022
|
-
};
|
|
9023
|
-
|
|
9024
|
-
var ResizeHandle$1 = _ref => {
|
|
9025
|
-
var {
|
|
9026
|
-
direction,
|
|
9027
|
-
onMouseDown
|
|
9028
|
-
} = _ref;
|
|
9029
|
-
var [isHovered, setIsHovered] = React.useState(false);
|
|
9030
|
-
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
9031
|
-
position: "absolute",
|
|
9032
|
-
top: 0,
|
|
9033
|
-
bottom: 0,
|
|
9034
|
-
width: 8,
|
|
9035
|
-
opacity: isHovered ? 1 : 0,
|
|
9036
|
-
transition: "opacity 0.2s",
|
|
9037
|
-
cursor: direction === 'left' ? 'w-resize' : 'e-resize',
|
|
9038
|
-
zIndex: 10,
|
|
9039
|
-
backgroundColor: isHovered ? 'rgba(0,0,0,0.1)' : 'transparent'
|
|
9040
|
-
}, direction === 'left' ? {
|
|
9041
|
-
left: 0
|
|
9042
|
-
} : {
|
|
9043
|
-
right: 0
|
|
9044
|
-
}, {
|
|
9045
|
-
onMouseDown: onMouseDown,
|
|
9046
|
-
onMouseEnter: () => setIsHovered(true),
|
|
9047
|
-
onMouseLeave: () => setIsHovered(false)
|
|
9048
|
-
}));
|
|
9049
|
-
};
|
|
9050
|
-
var CalendarWeek = _ref2 => {
|
|
9051
|
-
var {
|
|
9052
|
-
startDate,
|
|
9053
|
-
events = [],
|
|
9054
|
-
today = new Date().toISOString().slice(0, 10),
|
|
9055
|
-
onEventDrop,
|
|
9056
|
-
onEventResize,
|
|
9057
|
-
onDateClick,
|
|
9058
|
-
views = {},
|
|
9059
|
-
width = '100%',
|
|
9060
|
-
maxWidth = 1200
|
|
9061
|
-
} = _ref2;
|
|
9062
|
-
var {
|
|
9063
|
-
getColor
|
|
9064
|
-
} = appStudio.useTheme();
|
|
9065
|
-
var weekGridRef = React.useRef(null);
|
|
9066
|
-
var [selectedDate, setSelectedDate] = React.useState(null);
|
|
9067
|
-
var [localEvents, setLocalEvents] = React.useState(events);
|
|
9068
|
-
var [dropTargetDays, setDropTargetDays] = React.useState([]);
|
|
9069
|
-
var dragStateRef = React.useRef({
|
|
9070
|
-
isDragging: false,
|
|
9071
|
-
isResizing: false,
|
|
9072
|
-
resizeDirection: null,
|
|
9073
|
-
event: null,
|
|
9074
|
-
startX: 0,
|
|
9075
|
-
startDay: 0,
|
|
9076
|
-
startDuration: 0,
|
|
9077
|
-
originalStart: null,
|
|
9078
|
-
originalEnd: null
|
|
9079
|
-
});
|
|
9080
|
-
// Update local events when props change
|
|
9081
|
-
React__default.useEffect(() => {
|
|
9082
|
-
setLocalEvents(events);
|
|
9083
|
-
}, [events]);
|
|
9084
|
-
// Layout events
|
|
9085
|
-
var {
|
|
9086
|
-
items: positionedEvents
|
|
9087
|
-
} = React.useMemo(() => layoutEvents$1(localEvents, startDate), [localEvents, startDate]);
|
|
9088
|
-
// Get day index from mouse X position
|
|
9089
|
-
var getDayFromMouseX = React.useCallback(clientX => {
|
|
9090
|
-
if (!weekGridRef.current) return 0;
|
|
9091
|
-
var rect = weekGridRef.current.getBoundingClientRect();
|
|
9092
|
-
var relativeX = clientX - rect.left;
|
|
9093
|
-
var dayWidth = rect.width / 7;
|
|
9094
|
-
return Math.max(0, Math.min(6, Math.floor(relativeX / dayWidth)));
|
|
9095
|
-
}, []);
|
|
9096
|
-
// Handle date click
|
|
9097
|
-
var handleDateClick = React.useCallback(dateISO => {
|
|
9098
|
-
setSelectedDate(dateISO);
|
|
9099
|
-
onDateClick == null || onDateClick(dateISO);
|
|
9100
|
-
}, [onDateClick]);
|
|
9101
|
-
// Handle mouse down on event (start dragging)
|
|
9102
|
-
var handleEventMouseDown = React.useCallback((e, event) => {
|
|
9103
|
-
e.preventDefault();
|
|
9104
|
-
dragStateRef.current = {
|
|
9105
|
-
isDragging: true,
|
|
9106
|
-
isResizing: false,
|
|
9107
|
-
resizeDirection: null,
|
|
9108
|
-
event,
|
|
9109
|
-
startX: e.clientX,
|
|
9110
|
-
startDay: event.startDay,
|
|
9111
|
-
startDuration: event.duration,
|
|
9112
|
-
originalStart: event.start,
|
|
9113
|
-
originalEnd: event.end
|
|
9114
|
-
};
|
|
9115
|
-
}, []);
|
|
9116
|
-
// Handle mouse down on resize handle
|
|
9117
|
-
var handleResizeMouseDown = React.useCallback((e, event, direction) => {
|
|
9118
|
-
e.preventDefault();
|
|
9119
|
-
e.stopPropagation();
|
|
9120
|
-
dragStateRef.current = {
|
|
9121
|
-
isDragging: false,
|
|
9122
|
-
isResizing: true,
|
|
9123
|
-
resizeDirection: direction,
|
|
9124
|
-
event,
|
|
9125
|
-
startX: e.clientX,
|
|
9126
|
-
startDay: event.startDay,
|
|
9127
|
-
startDuration: event.duration,
|
|
9128
|
-
originalStart: event.start,
|
|
9129
|
-
originalEnd: event.end
|
|
9130
|
-
};
|
|
9131
|
-
}, []);
|
|
9132
|
-
// Handle mouse move (dragging or resizing)
|
|
9133
|
-
var handleMouseMove = React.useCallback(e => {
|
|
9134
|
-
var dragState = dragStateRef.current;
|
|
9135
|
-
if (!dragState.event || !dragState.isDragging && !dragState.isResizing) return;
|
|
9136
|
-
if (!weekGridRef.current) return;
|
|
9137
|
-
var rect = weekGridRef.current.getBoundingClientRect();
|
|
9138
|
-
var dayWidth = rect.width / 7;
|
|
9139
|
-
var deltaX = e.clientX - dragState.startX;
|
|
9140
|
-
var daysDelta = Math.round(deltaX / dayWidth);
|
|
9141
|
-
if (dragState.isDragging) {
|
|
9142
|
-
// Calculate new position
|
|
9143
|
-
var newStartDay = Math.max(0, Math.min(6, dragState.startDay + daysDelta));
|
|
9144
|
-
var duration = dragState.event.duration;
|
|
9145
|
-
var newEndDay = Math.min(6, newStartDay + duration - 1);
|
|
9146
|
-
// Update drop target indicators
|
|
9147
|
-
var targetDays = [];
|
|
9148
|
-
for (var i = newStartDay; i <= newEndDay; i++) {
|
|
9149
|
-
targetDays.push(i);
|
|
9150
|
-
}
|
|
9151
|
-
setDropTargetDays(targetDays);
|
|
9152
|
-
// Update event position immediately for smooth dragging
|
|
9153
|
-
var updatedEvents = localEvents.map(ev => ev.id === dragState.event.id ? Object.assign({}, ev, {
|
|
9154
|
-
start: addDateDays$1(dragState.originalStart, newStartDay - dragState.startDay),
|
|
9155
|
-
end: addDateDays$1(dragState.originalEnd, newStartDay - dragState.startDay)
|
|
9156
|
-
}) : ev);
|
|
9157
|
-
setLocalEvents(updatedEvents);
|
|
9158
|
-
} else if (dragState.isResizing) {
|
|
9159
|
-
// Handle resizing
|
|
9160
|
-
if (dragState.resizeDirection === 'right') {
|
|
9161
|
-
var newDuration = Math.max(1, dragState.startDuration + daysDelta);
|
|
9162
|
-
var _newEndDay = Math.min(6, dragState.startDay + newDuration - 1);
|
|
9163
|
-
var actualDuration = _newEndDay - dragState.startDay + 1;
|
|
9164
|
-
var _updatedEvents = localEvents.map(ev => ev.id === dragState.event.id ? Object.assign({}, ev, {
|
|
9165
|
-
end: addDateDays$1(dragState.originalStart, actualDuration - 1)
|
|
9166
|
-
}) : ev);
|
|
9167
|
-
setLocalEvents(_updatedEvents);
|
|
9168
|
-
} else if (dragState.resizeDirection === 'left') {
|
|
9169
|
-
var _newStartDay = Math.max(0, Math.min(dragState.startDay + dragState.startDuration - 1, dragState.startDay + daysDelta));
|
|
9170
|
-
var _updatedEvents2 = localEvents.map(ev => ev.id === dragState.event.id ? Object.assign({}, ev, {
|
|
9171
|
-
start: addDateDays$1(dragState.originalStart, _newStartDay - dragState.startDay)
|
|
9172
|
-
}) : ev);
|
|
9173
|
-
setLocalEvents(_updatedEvents2);
|
|
9174
|
-
}
|
|
9175
|
-
}
|
|
9176
|
-
}, [localEvents]);
|
|
9177
|
-
// Handle mouse up (finish dragging or resizing)
|
|
9178
|
-
var handleMouseUp = React.useCallback(e => {
|
|
9179
|
-
var dragState = dragStateRef.current;
|
|
9180
|
-
if (!dragState.event || !dragState.isDragging && !dragState.isResizing) return;
|
|
9181
|
-
setDropTargetDays([]);
|
|
9182
|
-
// Find the updated event
|
|
9183
|
-
var updatedEvent = localEvents.find(ev => ev.id === dragState.event.id);
|
|
9184
|
-
if (!updatedEvent) return;
|
|
9185
|
-
// Call appropriate callback
|
|
9186
|
-
if (dragState.isDragging) {
|
|
9187
|
-
onEventDrop == null || onEventDrop(updatedEvent);
|
|
9188
|
-
} else if (dragState.isResizing) {
|
|
9189
|
-
onEventResize == null || onEventResize(updatedEvent);
|
|
9190
|
-
}
|
|
9191
|
-
// Reset drag state
|
|
9192
|
-
dragStateRef.current = {
|
|
9193
|
-
isDragging: false,
|
|
9194
|
-
isResizing: false,
|
|
9195
|
-
resizeDirection: null,
|
|
9196
|
-
event: null,
|
|
9197
|
-
startX: 0,
|
|
9198
|
-
startDay: 0,
|
|
9199
|
-
startDuration: 0,
|
|
9200
|
-
originalStart: null,
|
|
9201
|
-
originalEnd: null
|
|
9202
|
-
};
|
|
9203
|
-
}, [localEvents, onEventDrop, onEventResize]);
|
|
9204
|
-
// Set up global mouse event listeners
|
|
9205
|
-
React__default.useEffect(() => {
|
|
9206
|
-
document.addEventListener('mousemove', handleMouseMove);
|
|
9207
|
-
document.addEventListener('mouseup', handleMouseUp);
|
|
9208
|
-
return () => {
|
|
9209
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
9210
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
9211
|
-
};
|
|
9212
|
-
}, [handleMouseMove, handleMouseUp]);
|
|
9213
|
-
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, containerStyles$1, {
|
|
9214
|
-
width: width,
|
|
9215
|
-
maxWidth: maxWidth
|
|
9216
|
-
}, views.container), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
9217
|
-
ref: weekGridRef,
|
|
9218
|
-
display: "grid",
|
|
9219
|
-
gridTemplateColumns: "repeat(7, 1fr)",
|
|
9220
|
-
position: "relative",
|
|
9221
|
-
width: "100%"
|
|
9222
|
-
}, views.weekGrid), Array.from({
|
|
9223
|
-
length: 7
|
|
9224
|
-
}).map((_, dayIdx) => {
|
|
9225
|
-
var dateISO = getDateForDay(startDate, dayIdx);
|
|
9226
|
-
var dayOfWeek = getDayOfWeek$1(dateISO);
|
|
9227
|
-
var dateNum = getDateNumber$1(dateISO);
|
|
9228
|
-
var isToday = dateISO === today;
|
|
9229
|
-
var isSelected = dateISO === selectedDate;
|
|
9230
|
-
var isDropTarget = dropTargetDays.includes(dayIdx);
|
|
9231
|
-
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
9232
|
-
key: dayIdx
|
|
9233
|
-
}, dayColumnStyles, isDropTarget && dropTargetStyles$1, {
|
|
9234
|
-
borderRight: dayIdx === 6 ? 'none' : '1px solid'
|
|
9235
|
-
}, 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, {
|
|
9236
|
-
onClick: () => handleDateClick(dateISO)
|
|
9237
|
-
}, views.dayDate), dateNum)), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({}, eventsAreaStyles$1, views.eventsArea)));
|
|
9238
|
-
}), /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
9239
|
-
position: "absolute",
|
|
9240
|
-
top: 60,
|
|
9241
|
-
left: 0,
|
|
9242
|
-
right: 0,
|
|
9243
|
-
bottom: 0,
|
|
9244
|
-
pointerEvents: "none"
|
|
9245
|
-
}, positionedEvents.map(event => {
|
|
9246
|
-
var _dragStateRef$current, _dragStateRef$current2;
|
|
9247
|
-
var colorConfig = EVENT_COLORS$1[event.color || 'blue'];
|
|
9248
|
-
var positionStyles = getEventPositionStyles(event.startDay, event.duration, event.row);
|
|
9249
|
-
var isDragging = dragStateRef.current.isDragging && ((_dragStateRef$current = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current.id) === event.id;
|
|
9250
|
-
var isResizing = dragStateRef.current.isResizing && ((_dragStateRef$current2 = dragStateRef.current.event) == null ? void 0 : _dragStateRef$current2.id) === event.id;
|
|
9251
|
-
return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
|
|
9252
|
-
key: event.id,
|
|
9253
|
-
position: "absolute",
|
|
9254
|
-
height: 22,
|
|
9255
|
-
display: "flex",
|
|
9256
|
-
alignItems: "center",
|
|
9257
|
-
padding: 8,
|
|
9258
|
-
paddingLeft: 8,
|
|
9259
|
-
paddingRight: 8,
|
|
9260
|
-
borderRadius: 4,
|
|
9261
|
-
backgroundColor: colorConfig.background,
|
|
9262
|
-
borderLeft: "3px solid",
|
|
9263
|
-
borderLeftColor: colorConfig.border,
|
|
9264
|
-
color: colorConfig.text,
|
|
9265
|
-
fontSize: 12,
|
|
9266
|
-
fontWeight: 500,
|
|
9267
|
-
overflow: "hidden",
|
|
9268
|
-
cursor: isDragging ? 'grabbing' : 'grab',
|
|
9269
|
-
opacity: isDragging || isResizing ? 0.7 : 1,
|
|
9270
|
-
boxShadow: isDragging || isResizing ? '0 4px 12px rgba(0,0,0,0.3)' : '0 1px 2px rgba(0,0,0,0.1)',
|
|
9271
|
-
transition: isDragging || isResizing ? 'none' : 'box-shadow 0.2s',
|
|
9272
|
-
pointerEvents: "auto",
|
|
9273
|
-
userSelect: "none",
|
|
9274
|
-
left: positionStyles.left,
|
|
9275
|
-
width: positionStyles.width,
|
|
9276
|
-
top: positionStyles.top,
|
|
9277
|
-
onMouseDown: e => handleEventMouseDown(e, event)
|
|
9278
|
-
}, views.event), /*#__PURE__*/React__default.createElement(appStudio.View, {
|
|
9279
|
-
overflow: "hidden",
|
|
9280
|
-
textOverflow: "ellipsis",
|
|
9281
|
-
whiteSpace: "nowrap",
|
|
9282
|
-
width: "100%"
|
|
9283
|
-
}, event.title), /*#__PURE__*/React__default.createElement(ResizeHandle$1, {
|
|
9284
|
-
direction: "left",
|
|
9285
|
-
onMouseDown: e => handleResizeMouseDown(e, event, 'left')
|
|
9286
|
-
}), /*#__PURE__*/React__default.createElement(ResizeHandle$1, {
|
|
9287
|
-
direction: "right",
|
|
9288
|
-
onMouseDown: e => handleResizeMouseDown(e, event, 'right')
|
|
9289
|
-
}));
|
|
9290
|
-
}))));
|
|
9291
|
-
};
|
|
9292
|
-
|
|
9293
8856
|
/**
|
|
9294
8857
|
* Custom hook to manage cookie consent state
|
|
9295
8858
|
* @param cookieExpiration Number of days until the cookie expires
|
|
@@ -37618,7 +37181,6 @@
|
|
|
37618
37181
|
exports.Button = Button;
|
|
37619
37182
|
exports.Calendar = Calendar;
|
|
37620
37183
|
exports.CalendarIcon = CalendarIcon;
|
|
37621
|
-
exports.CalendarWeek = CalendarWeek;
|
|
37622
37184
|
exports.CameraIcon = CameraIcon;
|
|
37623
37185
|
exports.Card = Card;
|
|
37624
37186
|
exports.Carousel = Carousel;
|