@remotelock/react-week-scheduler
Advanced tools
Comparing version 3.5.3 to 4.0.0
{ | ||
"branches": [ | ||
"+([1-9])?(.{+([1-9]),x}).x", | ||
"master", | ||
"develop", | ||
{ | ||
"name": "alpha", | ||
"prerelease": true | ||
}, | ||
{ | ||
"name": "beta", | ||
"prerelease": true | ||
} | ||
], | ||
"analyzeCommits": { | ||
@@ -3,0 +16,0 @@ "preset": "angular", |
276
index.js
@@ -7,4 +7,3 @@ 'use strict'; | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
var React = _interopDefault(require('react')); | ||
var useComponentSize = _interopDefault(require('@rehooks/component-size')); | ||
@@ -22,4 +21,4 @@ var classcat = _interopDefault(require('classcat')); | ||
var en = _interopDefault(require('date-fns/locale/en')); | ||
var rxjs = require('rxjs'); | ||
var operators = require('rxjs/operators'); | ||
var rxjs = _interopDefault(require('rxjs')); | ||
var operators = _interopDefault(require('rxjs/operators')); | ||
var Mousetrap = _interopDefault(require('mousetrap')); | ||
@@ -195,4 +194,4 @@ var clamp = _interopDefault(require('lodash/clamp')); | ||
var DefaultEventRootComponent = /*#__PURE__*/React__default.memo( /*#__PURE__*/ | ||
React__default.forwardRef(function DefaultEventRootComponent(_ref, | ||
var DefaultEventRootComponent = /*#__PURE__*/React.memo( /*#__PURE__*/ | ||
React.forwardRef(function DefaultEventRootComponent(_ref, | ||
@@ -209,3 +208,3 @@ | ||
{var isActive = _ref.isActive,handleDelete = _ref.handleDelete,cellIndex = _ref.cellIndex,rangeIndex = _ref.rangeIndex,classes = _ref.classes,disabled = _ref.disabled,props = _objectWithoutProperties(_ref, ["isActive", "handleDelete", "cellIndex", "rangeIndex", "classes", "disabled"]); | ||
return React__default.createElement("div", _extends({ ref: ref, "aria-disabled": disabled }, props)); | ||
return React.createElement("div", _extends({ ref: ref, "aria-disabled": disabled }, props)); | ||
})); | ||
@@ -242,3 +241,9 @@ | ||
var prevent = /*#__PURE__*/operators.tap(function (e) { | ||
var | ||
useCallback = React.useCallback,useEffect = React.useEffect,useState = React.useState;var | ||
fromEvent = rxjs.fromEvent,merge = rxjs.merge,of = rxjs.of;var | ||
delay = operators.delay,filter = operators.filter,map = operators.map,mergeMap = operators.mergeMap,startWith = operators.startWith,takeUntil = operators.takeUntil,tap = operators.tap; | ||
var prevent = /*#__PURE__*/tap(function (e) { | ||
e.preventDefault(); | ||
@@ -252,3 +257,3 @@ e.stopPropagation(); | ||
{var _useState = | ||
React.useState({ | ||
useState({ | ||
transform: 'translate(0, 0)', | ||
@@ -258,8 +263,8 @@ width: 0, | ||
React.useState(null),_useState4 = _slicedToArray(_useState3, 2),box = _useState4[0],setBox = _useState4[1];var _useState5 = | ||
React.useState(false),_useState6 = _slicedToArray(_useState5, 2),isDragging = _useState6[0],setIsDragging = _useState6[1];var _useState7 = | ||
React.useState(false),_useState8 = _slicedToArray(_useState7, 2),hasFinishedDragging = _useState8[0],setHasFinishedDragging = _useState8[1]; | ||
useState(null),_useState4 = _slicedToArray(_useState3, 2),box = _useState4[0],setBox = _useState4[1];var _useState5 = | ||
useState(false),_useState6 = _slicedToArray(_useState5, 2),isDragging = _useState6[0],setIsDragging = _useState6[1];var _useState7 = | ||
useState(false),_useState8 = _slicedToArray(_useState7, 2),hasFinishedDragging = _useState8[0],setHasFinishedDragging = _useState8[1]; | ||
var container = ref.current; | ||
React.useEffect(function () { | ||
useEffect(function () { | ||
if (!container || isDisabled) { | ||
@@ -271,11 +276,11 @@ return; | ||
var touchMove$ = rxjs.fromEvent(window, 'touchmove', { | ||
var touchMove$ = fromEvent(window, 'touchmove', { | ||
passive: false }). | ||
pipe(prevent); | ||
var touchEnd$ = rxjs.fromEvent(window, 'touchend', { | ||
var touchEnd$ = fromEvent(window, 'touchend', { | ||
passive: true }); | ||
var touchStart$ = rxjs.fromEvent(container, 'touchstart', { | ||
var touchStart$ = fromEvent(container, 'touchstart', { | ||
passive: false }); | ||
@@ -285,6 +290,6 @@ | ||
var touchStartWithDelay$ = touchStart$.pipe( | ||
operators.mergeMap(function (start) {return ( | ||
rxjs.of(start).pipe( | ||
operators.delay(300), | ||
operators.takeUntil(touchMove$), | ||
mergeMap(function (start) {return ( | ||
of(start).pipe( | ||
delay(300), | ||
takeUntil(touchMove$), | ||
prevent));})); | ||
@@ -295,21 +300,21 @@ | ||
var mouseDown$ = rxjs.fromEvent(container, 'mousedown', { | ||
var mouseDown$ = fromEvent(container, 'mousedown', { | ||
passive: true }). | ||
pipe(operators.filter(function (event) {return event.which === 1;})); | ||
pipe(filter(function (event) {return event.which === 1;})); | ||
var mouseMove$ = rxjs.fromEvent(window, 'mousemove', { | ||
var mouseMove$ = fromEvent(window, 'mousemove', { | ||
passive: true }); | ||
var mouseUp$ = rxjs.fromEvent(window, 'mouseup', { | ||
var mouseUp$ = fromEvent(window, 'mouseup', { | ||
passive: true }); | ||
var dragStart$ = rxjs.merge(mouseDown$, touchStartWithDelay$).pipe( | ||
operators.map(mapCoordsToContainer)); | ||
var dragStart$ = merge(mouseDown$, touchStartWithDelay$).pipe( | ||
map(mapCoordsToContainer)); | ||
var dragEnd$ = rxjs.merge(mouseUp$, touchEnd$).pipe( | ||
operators.map(mapCoordsToContainer), | ||
operators.tap(function () { | ||
var dragEnd$ = merge(mouseUp$, touchEnd$).pipe( | ||
map(mapCoordsToContainer), | ||
tap(function () { | ||
setIsDragging(false); | ||
@@ -320,13 +325,13 @@ setHasFinishedDragging(true); | ||
var move$ = rxjs.merge(mouseMove$, touchMove$).pipe(operators.map(mapCoordsToContainer)); | ||
var move$ = merge(mouseMove$, touchMove$).pipe(map(mapCoordsToContainer)); | ||
var box$ = dragStart$.pipe( | ||
operators.tap(function () { | ||
tap(function () { | ||
setIsDragging(true); | ||
setHasFinishedDragging(false); | ||
}), | ||
operators.mergeMap(function (down) { | ||
mergeMap(function (down) { | ||
return move$.pipe( | ||
operators.startWith(down), | ||
operators.map( | ||
startWith(down), | ||
map( | ||
function (move) { | ||
@@ -356,6 +361,6 @@ var startX = Math.max(down.x, 0); | ||
operators.takeUntil(dragEnd$)); | ||
takeUntil(dragEnd$)); | ||
}), | ||
operators.map(function (rect) { | ||
map(function (rect) { | ||
return rect.width === 0 && rect.height === 0 ? null : rect; | ||
@@ -366,3 +371,3 @@ })); | ||
var style$ = box$.pipe( | ||
operators.map(function (rect) { | ||
map(function (rect) { | ||
if (rect !== null) {var | ||
@@ -390,3 +395,3 @@ width = rect.width,height = rect.height,left = rect.left,top = rect.top; | ||
var cancel = React.useCallback(function () { | ||
var cancel = useCallback(function () { | ||
setIsDragging(false); | ||
@@ -400,8 +405,12 @@ setHasFinishedDragging(false); | ||
var | ||
useEffect$1 = React.useEffect,useRef = React.useRef; | ||
/** | ||
* Use mousetrap hook | ||
* | ||
* @param handlerKey - A key, key combo or array of combos according to Mousetrap documentation. | ||
* @param handlerCallback - A function that is triggered on key combo catch. | ||
*/ | ||
* Use mousetrap hook | ||
* | ||
* @param handlerKey - A key, key combo or array of combos according to Mousetrap documentation. | ||
* @param handlerCallback - A function that is triggered on key combo catch. | ||
*/ | ||
function useMousetrap( | ||
@@ -412,3 +421,3 @@ handlerKey, | ||
{ | ||
var actionRef = React.useRef(null); | ||
var actionRef = useRef(null); | ||
actionRef.current = handlerCallback; | ||
@@ -418,3 +427,3 @@ var element = | ||
React.useEffect(function () { | ||
useEffect$1(function () { | ||
var instance = new Mousetrap(element); | ||
@@ -632,3 +641,3 @@ | ||
var Cell = /*#__PURE__*/React__default.memo(function Cell(_ref) | ||
var Cell = /*#__PURE__*/React.memo(function Cell(_ref) | ||
@@ -658,3 +667,3 @@ | ||
return ( | ||
React__default.createElement("div", { | ||
React.createElement("div", { | ||
role: "button", | ||
@@ -742,3 +751,3 @@ onClick: onClick, | ||
var EventContent = /*#__PURE__*/React__default.memo(function EventContent(_ref) | ||
var EventContent = /*#__PURE__*/React.memo(function EventContent(_ref) | ||
@@ -750,4 +759,4 @@ | ||
{var width = _ref.width,height = _ref.height,classes = _ref.classes,dateRange = _ref.dateRange,isStart = _ref.isStart,isEnd = _ref.isEnd;var _useContext = | ||
React.useContext(SchedulerContext),locale = _useContext.locale;var _getFormattedComponen = | ||
{var width = _ref.width,height = _ref.height,classes = _ref.classes,dateRange = _ref.dateRange,isStart = _ref.isStart,isEnd = _ref.isEnd;var _React$useContext = | ||
React.useContext(SchedulerContext),locale = _React$useContext.locale;var _getFormattedComponen = | ||
getFormattedComponentsForDateRange({ | ||
@@ -760,13 +769,13 @@ dateRange: dateRange, | ||
return ( | ||
React__default.createElement("div", { | ||
React.createElement("div", { | ||
style: { width: width - 20, height: height }, | ||
className: classes['event-content'] }, | ||
React__default.createElement(VisuallyHidden, null, | ||
React.createElement(VisuallyHidden, null, | ||
getTextForDateRange({ dateRange: dateRange, locale: locale })), | ||
React__default.createElement("span", { "aria-hidden": true, className: classes.start }, | ||
React.createElement("span", { "aria-hidden": true, className: classes.start }, | ||
isStart && start), | ||
React__default.createElement("span", { "aria-hidden": true, className: classes.end }, | ||
React.createElement("span", { "aria-hidden": true, className: classes.end }, | ||
isEnd && end))); | ||
@@ -778,6 +787,8 @@ | ||
var RangeBox = /*#__PURE__*/React__default.memo(function RangeBox(_ref2) | ||
var | ||
useCallback$1 = React.useCallback,useEffect$2 = React.useEffect,useMemo = React.useMemo,useRef$1 = React.useRef,useState$1 = React.useState; | ||
var RangeBox = /*#__PURE__*/React.memo(function RangeBox(_ref2) | ||
@@ -803,7 +814,10 @@ | ||
{var _ref4;var classes = _ref2.classes,grid = _ref2.grid,rangeIndex = _ref2.rangeIndex,cellIndex = _ref2.cellIndex,cellArray = _ref2.cellArray,cell = _ref2.cell,className = _ref2.className,onChange = _ref2.onChange,cellInfoToDateRange = _ref2.cellInfoToDateRange,isResizable = _ref2.isResizable,moveAxis = _ref2.moveAxis,onActiveChange = _ref2.onActiveChange,onClick = _ref2.onClick,getIsActive = _ref2.getIsActive,_ref2$eventContentCom = _ref2.eventContentComponent,EventContentComponent = _ref2$eventContentCom === void 0 ? EventContent : _ref2$eventContentCom,_ref2$eventRootCompon = _ref2.eventRootComponent,EventRootComponent = _ref2$eventRootCompon === void 0 ? DefaultEventRootComponent : _ref2$eventRootCompon,disabled = _ref2.disabled; | ||
var ref = React.useRef(null);var _useState = | ||
React.useState(cell),_useState2 = _slicedToArray(_useState, 2),modifiedCell = _useState2[0],setModifiedCell = _useState2[1]; | ||
var originalRect = React.useMemo(function () {return grid.getRectFromCell(cell);}, [cell, grid]); | ||
var rect = React.useMemo(function () {return grid.getRectFromCell(modifiedCell);}, [ | ||
var ref = useRef$1(null);var _useState = | ||
useState$1(cell),_useState2 = _slicedToArray(_useState, 2),modifiedCell = _useState2[0],setModifiedCell = _useState2[1]; | ||
var originalRect = useMemo(function () {return grid.getRectFromCell(cell);}, [cell, grid]); | ||
var rect = useMemo(function () {return grid.getRectFromCell(modifiedCell);}, [ | ||
modifiedCell, | ||
@@ -813,7 +827,7 @@ grid]); | ||
React.useEffect(function () { | ||
useEffect$2(function () { | ||
setModifiedCell(cell); | ||
}, [cell]); | ||
var modifiedDateRange = React.useMemo(function () {return cellInfoToDateRange(modifiedCell);}, [ | ||
var modifiedDateRange = useMemo(function () {return cellInfoToDateRange(modifiedCell);}, [ | ||
cellInfoToDateRange, | ||
@@ -828,3 +842,3 @@ modifiedCell]);var | ||
var handleStop = React.useCallback(function () { | ||
var handleStop = useCallback$1(function () { | ||
if (!onChange || disabled) { | ||
@@ -837,3 +851,3 @@ return; | ||
var isActive = React.useMemo(function () {return getIsActive({ cellIndex: cellIndex, rangeIndex: rangeIndex });}, [ | ||
var isActive = useMemo(function () {return getIsActive({ cellIndex: cellIndex, rangeIndex: rangeIndex });}, [ | ||
cellIndex, | ||
@@ -947,3 +961,3 @@ rangeIndex, | ||
var handleDrag = React.useCallback( | ||
var handleDrag = useCallback$1( | ||
function (event, _ref3) {var y = _ref3.y,x = _ref3.x; | ||
@@ -999,3 +1013,3 @@ if (moveAxis === 'none' || disabled) { | ||
var handleResize = React.useCallback( | ||
var handleResize = useCallback$1( | ||
function (event, direction, _ref, delta) { | ||
@@ -1042,3 +1056,3 @@ if (!isResizable || disabled) { | ||
var handleDelete = React.useCallback(function () { | ||
var handleDelete = useCallback$1(function () { | ||
if (!onChange || disabled) { | ||
@@ -1051,3 +1065,3 @@ return; | ||
var handleOnFocus = React.useCallback(function () { | ||
var handleOnFocus = useCallback$1(function () { | ||
if (!onActiveChange || disabled) { | ||
@@ -1060,3 +1074,3 @@ return; | ||
var handleOnClick = React.useCallback(function () { | ||
var handleOnClick = useCallback$1(function () { | ||
if (!onClick || disabled || !isActive) { | ||
@@ -1071,3 +1085,3 @@ return; | ||
var cancelClasses = React.useMemo( | ||
var cancelClasses = useMemo( | ||
function () {return ( | ||
@@ -1084,3 +1098,3 @@ classes.handle ? | ||
return ( | ||
React__default.createElement(Draggable, { | ||
React.createElement(Draggable, { | ||
axis: moveAxis, | ||
@@ -1099,3 +1113,3 @@ bounds: { | ||
React__default.createElement(EventRootComponent, { | ||
React.createElement(EventRootComponent, { | ||
role: "button", | ||
@@ -1122,3 +1136,3 @@ disabled: disabled, | ||
React__default.createElement(Resizable, { | ||
React.createElement(Resizable, { | ||
size: _objectSpread({}, originalRect, { width: originalRect.width - 20 }), | ||
@@ -1150,3 +1164,3 @@ key: "".concat(rangeIndex, ".").concat(cellIndex, ".").concat(cellArray.length, ".").concat( | ||
React__default.createElement(EventContentComponent, { | ||
React.createElement(EventContentComponent, { | ||
width: width, | ||
@@ -1165,3 +1179,3 @@ height: height, | ||
var Schedule = /*#__PURE__*/React__default.memo(function Schedule(_ref) | ||
var Schedule = /*#__PURE__*/React.memo(function Schedule(_ref) | ||
@@ -1190,9 +1204,9 @@ | ||
return ( | ||
React__default.createElement("div", { className: classes['range-boxes'] }, | ||
React.createElement("div", { className: classes['range-boxes'] }, | ||
ranges.map(function (dateRange, rangeIndex) { | ||
return ( | ||
React__default.createElement("span", { key: rangeIndex }, | ||
React.createElement("span", { key: rangeIndex }, | ||
dateRangeToCells(dateRange).map(function (cell, cellIndex, cellArray) { | ||
return ( | ||
React__default.createElement(RangeBox, { | ||
React.createElement(RangeBox, { | ||
classes: classes, | ||
@@ -1229,2 +1243,6 @@ onActiveChange: onActiveChange, | ||
var | ||
useCallback$2 = React.useCallback,useContext = React.useContext,useEffect$3 = React.useEffect,useMemo$1 = React.useMemo,useRef$2 = React.useRef,useState$2 = React.useState; | ||
var MINS_IN_DAY = 24 * 60; | ||
@@ -1236,3 +1254,3 @@ var horizontalPrecision = 1; | ||
var TimeGridScheduler = /*#__PURE__*/React__default.memo(function TimeGridScheduler(_ref) | ||
var TimeGridScheduler = /*#__PURE__*/React.memo(function TimeGridScheduler(_ref) | ||
@@ -1299,14 +1317,14 @@ | ||
{var _ref$verticalPrecisio = _ref.verticalPrecision,verticalPrecision = _ref$verticalPrecisio === void 0 ? 30 : _ref$verticalPrecisio,_ref$visualGridVertic = _ref.visualGridVerticalPrecision,visualGridVerticalPrecision = _ref$visualGridVertic === void 0 ? 30 : _ref$visualGridVertic,_ref$cellClickPrecisi = _ref.cellClickPrecision,cellClickPrecision = _ref$cellClickPrecisi === void 0 ? visualGridVerticalPrecision : _ref$cellClickPrecisi,style = _ref.style,schedule = _ref.schedule,_ref$originDate = _ref.originDate,_originDate = _ref$originDate === void 0 ? new Date() : _ref$originDate,_ref$defaultHours = _ref.defaultHours,defaultHours = _ref$defaultHours === void 0 ? [9, 15] : _ref$defaultHours,classes = _ref.classes,className = _ref.className,onChange = _ref.onChange,onEventClick = _ref.onEventClick,eventContentComponent = _ref.eventContentComponent,eventRootComponent = _ref.eventRootComponent,disabled = _ref.disabled;var _useContext = | ||
React.useContext(SchedulerContext),locale = _useContext.locale; | ||
var originDate = React.useMemo(function () {return startOfDay(_originDate);}, [_originDate]); | ||
useContext(SchedulerContext),locale = _useContext.locale; | ||
var originDate = useMemo$1(function () {return startOfDay(_originDate);}, [_originDate]); | ||
var numVerticalCells = MINS_IN_DAY / verticalPrecision; | ||
var numHorizontalCells = 7 / horizontalPrecision; | ||
var toMin = React.useCallback(function (y) {return y * verticalPrecision;}, [ | ||
var toMin = useCallback$2(function (y) {return y * verticalPrecision;}, [ | ||
verticalPrecision]); | ||
var toY = React.useCallback(function (mins) {return mins / verticalPrecision;}, [ | ||
var toY = useCallback$2(function (mins) {return mins / verticalPrecision;}, [ | ||
verticalPrecision]); | ||
var cellInfoToDateRanges = React.useMemo(function () { | ||
var cellInfoToDateRanges = useMemo$1(function () { | ||
return createMapCellInfoToRecurringTimeRange({ | ||
@@ -1319,3 +1337,3 @@ originDate: originDate, | ||
var cellInfoToSingleDateRange = React.useCallback( | ||
var cellInfoToSingleDateRange = useCallback$2( | ||
function (cell) {var _cellInfoToDateRanges = | ||
@@ -1335,3 +1353,3 @@ cellInfoToDateRanges(cell),_cellInfoToDateRanges2 = _toArray(_cellInfoToDateRanges),first = _cellInfoToDateRanges2[0],rest = _cellInfoToDateRanges2.slice(1); | ||
var dateRangeToCells = React.useMemo(function () { | ||
var dateRangeToCells = useMemo$1(function () { | ||
return createMapDateRangeToCells({ | ||
@@ -1346,4 +1364,4 @@ originDate: originDate, | ||
var root = React.useRef(null); | ||
var parent = React.useRef(null); | ||
var root = useRef$2(null); | ||
var parent = useRef$2(null); | ||
@@ -1361,9 +1379,9 @@ var size = useComponentSize(parent);var _useClickAndDrag = | ||
React.useState(null),_useState2 = _slicedToArray(_useState, 2),pendingCreation = _useState2[0],setPendingCreation = _useState2[1];var _useState3 = | ||
useState$2(null),_useState2 = _slicedToArray(_useState, 2),pendingCreation = _useState2[0],setPendingCreation = _useState2[1];var _useState3 = | ||
React.useState([0, 0]),_useState4 = _slicedToArray(_useState3, 2),_useState4$ = _slicedToArray(_useState4[0], 2),totalHeight = _useState4$[0],totalWidth = _useState4$[1],setDimensions = _useState4[1]; | ||
useState$2([0, 0]),_useState4 = _slicedToArray(_useState3, 2),_useState4$ = _slicedToArray(_useState4[0], 2),totalHeight = _useState4$[0],totalWidth = _useState4$[1],setDimensions = _useState4[1]; | ||
var numVisualVerticalCells = 24 * 60 / visualGridVerticalPrecision; | ||
React.useEffect( | ||
useEffect$3( | ||
function updateGridDimensionsOnSizeOrCellCountChange() { | ||
@@ -1380,3 +1398,3 @@ if (!parent.current) { | ||
var grid = React.useMemo(function () { | ||
var grid = useMemo$1(function () { | ||
if (totalHeight === null || totalWidth === null) { | ||
@@ -1394,3 +1412,3 @@ return null; | ||
React.useEffect( | ||
useEffect$3( | ||
function updatePendingCreationOnDragBoxUpdate() { | ||
@@ -1410,7 +1428,7 @@ if (grid === null || box === null) { | ||
React.useState( | ||
useState$2( | ||
[null, null]),_useState6 = _slicedToArray(_useState5, 2),_useState6$ = _slicedToArray(_useState6[0], 2),activeRangeIndex = _useState6$[0],activeCellIndex = _useState6$[1],setActive = _useState6[1]; | ||
React.useEffect( | ||
useEffect$3( | ||
function updateScheduleAfterDraggingFinished() { | ||
@@ -1436,3 +1454,3 @@ if (disabled) { | ||
React.useEffect( | ||
useEffect$3( | ||
function clearActiveBlockAfterCreation() { | ||
@@ -1446,3 +1464,3 @@ if (pendingCreation === null) { | ||
var handleEventChange = React.useCallback( | ||
var handleEventChange = useCallback$2( | ||
function (newDateRange, rangeIndex) { | ||
@@ -1490,3 +1508,3 @@ if (disabled) { | ||
var getIsActive = React.useCallback( | ||
var getIsActive = useCallback$2( | ||
function (_ref2) {var rangeIndex = _ref2.rangeIndex,cellIndex = _ref2.cellIndex; | ||
@@ -1498,3 +1516,3 @@ return rangeIndex === activeRangeIndex && cellIndex === activeCellIndex; | ||
var handleDelete = React.useCallback( | ||
var handleDelete = useCallback$2( | ||
function (e) { | ||
@@ -1514,3 +1532,3 @@ if (activeRangeIndex === null || disabled) { | ||
React.useEffect( | ||
useEffect$3( | ||
function cancelPendingCreationOnSizeChange() { | ||
@@ -1522,3 +1540,3 @@ cancel(); | ||
var getDateRangeForVisualGrid = React.useMemo(function () { | ||
var getDateRangeForVisualGrid = useMemo$1(function () { | ||
return createMapCellInfoToRecurringTimeRange({ | ||
@@ -1531,3 +1549,3 @@ originDate: originDate, | ||
React.useEffect( | ||
useEffect$3( | ||
function scrollToActiveTimeBlock() { | ||
@@ -1551,7 +1569,7 @@ if (!document.activeElement) { | ||
React.useState( | ||
useState$2( | ||
false),_useState8 = _slicedToArray(_useState7, 2),wasInitialScrollPerformed = _useState8[0],setWasInitialScrollPerformed = _useState8[1]; | ||
React.useEffect( | ||
useEffect$3( | ||
function performInitialScroll() { | ||
@@ -1594,3 +1612,3 @@ if (wasInitialScrollPerformed || !root.current || !grid) { | ||
var handleBlur = React.useCallback( | ||
var handleBlur = useCallback$2( | ||
function (event) { | ||
@@ -1604,3 +1622,3 @@ if (!event.target.contains(document.activeElement)) { | ||
var handleCellClick = React.useCallback( | ||
var handleCellClick = useCallback$2( | ||
function (dayIndex, timeIndex) {return function (event) { | ||
@@ -1632,3 +1650,3 @@ if (!grid || disabled) { | ||
return ( | ||
React__default.createElement("div", { | ||
React.createElement("div", { | ||
ref: root, | ||
@@ -1645,18 +1663,18 @@ style: style, | ||
React__default.createElement("div", { className: classes['grid-root'] }, | ||
React__default.createElement("div", { | ||
React.createElement("div", { className: classes['grid-root'] }, | ||
React.createElement("div", { | ||
"aria-hidden": true, | ||
className: classcat([classes.timeline, classes['sticky-left']]) }, | ||
React__default.createElement("div", { className: classes.header }, | ||
React__default.createElement("div", { className: classes['day-column'] }, | ||
React__default.createElement("div", { className: classcat([classes.cell, classes.title]) }, "T"))), | ||
React.createElement("div", { className: classes.header }, | ||
React.createElement("div", { className: classes['day-column'] }, | ||
React.createElement("div", { className: classcat([classes.cell, classes.title]) }, "T"))), | ||
React__default.createElement("div", { className: classes.calendar }, | ||
React__default.createElement("div", { className: classes['day-column'] }, | ||
React__default.createElement("div", { className: classes['day-hours'] }, | ||
React.createElement("div", { className: classes.calendar }, | ||
React.createElement("div", { className: classes['day-column'] }, | ||
React.createElement("div", { className: classes['day-hours'] }, | ||
times(numVisualVerticalCells).map(function (timeIndex) { | ||
return ( | ||
React__default.createElement(Cell, { | ||
React.createElement(Cell, { | ||
classes: classes, | ||
@@ -1670,3 +1688,3 @@ getDateRangeForVisualGrid: getDateRangeForVisualGrid, | ||
return ( | ||
React__default.createElement("div", { className: classes.time }, | ||
React.createElement("div", { className: classes.time }, | ||
format(start, 'h a', { locale: locale }))); | ||
@@ -1686,3 +1704,3 @@ | ||
React__default.createElement("div", { | ||
React.createElement("div", { | ||
className: classcat([ | ||
@@ -1693,3 +1711,3 @@ classes['sticky-top'], | ||
React__default.createElement("div", { | ||
React.createElement("div", { | ||
role: "presentation", | ||
@@ -1699,3 +1717,3 @@ className: classcat([classes.calendar, classes.header]) }, | ||
times(7).map(function (i) {return ( | ||
React__default.createElement("div", { | ||
React.createElement("div", { | ||
key: i, | ||
@@ -1705,3 +1723,3 @@ role: "presentation", | ||
React__default.createElement("div", { className: classcat([classes.cell, classes.title]) }, | ||
React.createElement("div", { className: classcat([classes.cell, classes.title]) }, | ||
format(addDays(originDate, i), 'ddd', { locale: locale }))));}))), | ||
@@ -1713,10 +1731,10 @@ | ||
React__default.createElement("div", { className: classes['layer-container'] }, | ||
React.createElement("div", { className: classes['layer-container'] }, | ||
isDragging && | ||
React__default.createElement("div", { className: classes['drag-box'], style: dragBoxStyle }, | ||
hasFinishedDragging && React__default.createElement("div", { className: classes.popup })), | ||
React.createElement("div", { className: classes['drag-box'], style: dragBoxStyle }, | ||
hasFinishedDragging && React.createElement("div", { className: classes.popup })), | ||
grid && pendingCreation && isDragging && | ||
React__default.createElement(Schedule, { | ||
React.createElement(Schedule, { | ||
classes: classes, | ||
@@ -1734,3 +1752,3 @@ dateRangeToCells: dateRangeToCells, | ||
grid && !pendingCreation && | ||
React__default.createElement(Schedule, { | ||
React.createElement(Schedule, { | ||
classes: classes, | ||
@@ -1754,6 +1772,6 @@ onActiveChange: setActive, | ||
React__default.createElement("div", { ref: parent, role: "grid", className: classes.calendar }, | ||
React.createElement("div", { ref: parent, role: "grid", className: classes.calendar }, | ||
times(7).map(function (dayIndex) { | ||
return ( | ||
React__default.createElement("div", { | ||
React.createElement("div", { | ||
role: "gridcell", | ||
@@ -1763,6 +1781,6 @@ key: dayIndex, | ||
React__default.createElement("div", { className: classes['day-hours'] }, | ||
React.createElement("div", { className: classes['day-hours'] }, | ||
times(numVisualVerticalCells).map(function (timeIndex) { | ||
return ( | ||
React__default.createElement(Cell, { | ||
React.createElement(Cell, { | ||
classes: classes, | ||
@@ -1769,0 +1787,0 @@ onClick: handleCellClick( |
{ | ||
"name": "@remotelock/react-week-scheduler", | ||
"version": "3.5.3", | ||
"version": "4.0.0", | ||
"publishConfig": { | ||
"tag": "next" | ||
}, | ||
"license": "MIT", | ||
@@ -38,6 +41,6 @@ "description": "", | ||
"peerDependencies": { | ||
"pepjs": "^0.5.0", | ||
"react": "^16.8.4", | ||
"react-dom": "^16.8.4", | ||
"resize-observer-polyfill": "^1.5.1", | ||
"pepjs": "^0.5.0" | ||
"resize-observer-polyfill": "^1.5.1" | ||
}, | ||
@@ -101,3 +104,3 @@ "devDependencies": { | ||
"scroll-into-view-if-needed": "^2.2.20", | ||
"semantic-release": "^15.13.3", | ||
"semantic-release": "^16.0.0-beta.22", | ||
"source-map-explorer": "^1.7.0", | ||
@@ -104,0 +107,0 @@ "stylelint": "^9.10.1", |
@@ -1,6 +0,6 @@ | ||
/// <reference types="react" /> | ||
import en from 'date-fns/locale/en'; | ||
export declare const SchedulerContext: import("react").Context<{ | ||
import React from 'react'; | ||
export declare const SchedulerContext: React.Context<{ | ||
locale: typeof en; | ||
}>; | ||
//# sourceMappingURL=context.d.ts.map |
import en from 'date-fns/locale/en'; | ||
import { createContext } from 'react'; | ||
import React from 'react'; | ||
export const SchedulerContext = createContext({ locale: en }); | ||
export const SchedulerContext = React.createContext({ locale: en }); |
@@ -1,15 +0,11 @@ | ||
import React, { useCallback, useEffect, useState } from 'react'; | ||
import { fromEvent, merge, Observable, of } from 'rxjs'; | ||
import { | ||
delay, | ||
filter, | ||
map, | ||
mergeMap, | ||
startWith, | ||
takeUntil, | ||
tap, | ||
} from 'rxjs/operators'; | ||
import React from 'react'; | ||
import rxjs, { Observable } from 'rxjs'; | ||
import operators from 'rxjs/operators'; | ||
import { Rect } from '../types'; | ||
import { createPageMapCoordsToContainer } from '../utils/createPageMapCoordsToContainer'; | ||
const { useCallback, useEffect, useState } = React; | ||
const { fromEvent, merge, of } = rxjs; | ||
const { delay, filter, map, mergeMap, startWith, takeUntil, tap } = operators; | ||
const prevent = tap((e: TouchEvent) => { | ||
@@ -16,0 +12,0 @@ e.preventDefault(); |
@@ -1,2 +0,2 @@ | ||
/// <reference types="react" /> | ||
import React from 'react'; | ||
export declare function useEventListener<K extends keyof HTMLElementEventMap, Element extends HTMLElement>(ref: React.RefObject<Element>, event: K, listener: (this: Element, event: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions, { enabled }?: { | ||
@@ -3,0 +3,0 @@ enabled?: boolean | undefined; |
@@ -1,2 +0,2 @@ | ||
import { useEffect } from 'react'; | ||
import React from 'react'; | ||
@@ -15,3 +15,3 @@ export function useEventListener< | ||
useEffect(() => { | ||
React.useEffect(() => { | ||
if (current === null) { | ||
@@ -18,0 +18,0 @@ return; |
/// <reference types="mousetrap" /> | ||
/// <reference types="react" /> | ||
import React from 'react'; | ||
/** | ||
@@ -4,0 +4,0 @@ * Use mousetrap hook |
import Mousetrap from 'mousetrap'; | ||
import { useEffect, useRef } from 'react'; | ||
import React from 'react'; | ||
const { useEffect, useRef } = React; | ||
/** | ||
@@ -5,0 +7,0 @@ * Use mousetrap hook |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1003237
4741