react-big-schedule 5.5.2-beta.5 → 6.1.0
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/README.md +6 -0
- package/dist/components/AddMore.js +29 -35
- package/dist/components/AddMorePopover.js +65 -83
- package/dist/components/AgendaEventItem.js +44 -54
- package/dist/components/AgendaResourceEvents.js +55 -65
- package/dist/components/AgendaView.js +50 -53
- package/dist/components/BodyView.js +30 -35
- package/dist/components/DnDContext.js +144 -159
- package/dist/components/DnDSource.js +107 -116
- package/dist/components/EventItem.js +659 -704
- package/dist/components/EventItemPopover.js +74 -83
- package/dist/components/HeaderView.js +81 -91
- package/dist/components/ResourceEvents.js +613 -675
- package/dist/components/ResourceView.js +71 -81
- package/dist/components/SchedulerData.js +1031 -1258
- package/dist/components/SchedulerHeader.js +83 -116
- package/dist/components/SelectedArea.js +18 -22
- package/dist/components/Summary.js +36 -45
- package/dist/components/WrapperFun.js +9 -19
- package/dist/components/index.js +317 -463
- package/dist/config/default.js +6 -12
- package/dist/config/i18n.js +13 -27
- package/dist/config/scheduler.js +8 -13
- package/dist/helper/behaviors.js +53 -61
- package/dist/helper/utility.js +40 -26
- package/dist/index.js +2 -103
- package/dist/sample-data/sample1.js +44 -8
- package/package.json +18 -18
package/dist/config/default.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ViewType = exports.SummaryPos = exports.DnDTypes = exports.DATE_FORMAT = exports.DATETIME_FORMAT = exports.CellUnit = void 0;
|
|
7
|
-
var DATE_FORMAT = exports.DATE_FORMAT = 'YYYY-MM-DD';
|
|
8
|
-
var DATETIME_FORMAT = exports.DATETIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
|
9
|
-
var ViewType = exports.ViewType = {
|
|
1
|
+
export const DATE_FORMAT = 'YYYY-MM-DD';
|
|
2
|
+
export const DATETIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
|
3
|
+
export const ViewType = {
|
|
10
4
|
Day: 0,
|
|
11
5
|
Week: 1,
|
|
12
6
|
Month: 2,
|
|
@@ -16,14 +10,14 @@ var ViewType = exports.ViewType = {
|
|
|
16
10
|
Custom1: 6,
|
|
17
11
|
Custom2: 7
|
|
18
12
|
};
|
|
19
|
-
|
|
13
|
+
export const CellUnit = {
|
|
20
14
|
Day: 0,
|
|
21
15
|
Hour: 1,
|
|
22
16
|
Week: 2,
|
|
23
17
|
Month: 3,
|
|
24
18
|
Year: 4
|
|
25
19
|
};
|
|
26
|
-
|
|
20
|
+
export const SummaryPos = {
|
|
27
21
|
Top: 0,
|
|
28
22
|
TopRight: 1,
|
|
29
23
|
TopLeft: 2,
|
|
@@ -31,6 +25,6 @@ var SummaryPos = exports.SummaryPos = {
|
|
|
31
25
|
BottomRight: 4,
|
|
32
26
|
BottomLeft: 5
|
|
33
27
|
};
|
|
34
|
-
|
|
28
|
+
export const DnDTypes = {
|
|
35
29
|
EVENT: 'event'
|
|
36
30
|
};
|
package/dist/config/i18n.js
CHANGED
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getDefaultLabels = getDefaultLabels;
|
|
7
|
-
exports.getLabel = getLabel;
|
|
8
|
-
exports.resetLabelsProvider = resetLabelsProvider;
|
|
9
|
-
exports.setLabelsProvider = setLabelsProvider;
|
|
10
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
11
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
12
|
-
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
16
1
|
/**
|
|
17
2
|
* i18n configuration and labels provider
|
|
18
3
|
*
|
|
@@ -22,7 +7,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
22
7
|
*/
|
|
23
8
|
|
|
24
9
|
// Default English labels
|
|
25
|
-
|
|
10
|
+
const defaultLabels = {
|
|
26
11
|
resourceName: 'Resource Name',
|
|
27
12
|
taskName: 'Task Name',
|
|
28
13
|
agendaViewHeader: 'Agenda',
|
|
@@ -30,7 +15,7 @@ var defaultLabels = {
|
|
|
30
15
|
};
|
|
31
16
|
|
|
32
17
|
// Current labels provider (can be a function or object)
|
|
33
|
-
|
|
18
|
+
let labelsProvider = null;
|
|
34
19
|
|
|
35
20
|
/**
|
|
36
21
|
* Get the current label for a given key
|
|
@@ -38,18 +23,17 @@ var labelsProvider = null;
|
|
|
38
23
|
* @param {string} locale - Optional locale code for locale-specific translations
|
|
39
24
|
* @returns {string} The localized label or the default English label
|
|
40
25
|
*/
|
|
41
|
-
function getLabel(key) {
|
|
42
|
-
var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
26
|
+
export function getLabel(key, locale = undefined) {
|
|
43
27
|
// If a custom provider function is set, use it
|
|
44
28
|
if (typeof labelsProvider === 'function') {
|
|
45
|
-
|
|
29
|
+
const label = labelsProvider(key, locale);
|
|
46
30
|
return label !== undefined && label !== null ? label : defaultLabels[key];
|
|
47
31
|
}
|
|
48
32
|
|
|
49
33
|
// If a labels object provider is set, use it with fallback
|
|
50
|
-
if (labelsProvider &&
|
|
51
|
-
|
|
52
|
-
return
|
|
34
|
+
if (labelsProvider && typeof labelsProvider === 'object') {
|
|
35
|
+
const label = labelsProvider[key];
|
|
36
|
+
return label !== undefined && label !== null ? label : defaultLabels[key];
|
|
53
37
|
}
|
|
54
38
|
|
|
55
39
|
// Fall back to default English labels
|
|
@@ -60,7 +44,7 @@ function getLabel(key) {
|
|
|
60
44
|
* Set a custom labels provider
|
|
61
45
|
* @param {Function|Object} provider - Either a function(key, locale) -> string or an object with label key-value pairs
|
|
62
46
|
*/
|
|
63
|
-
function setLabelsProvider(provider) {
|
|
47
|
+
export function setLabelsProvider(provider) {
|
|
64
48
|
labelsProvider = provider;
|
|
65
49
|
}
|
|
66
50
|
|
|
@@ -68,13 +52,15 @@ function setLabelsProvider(provider) {
|
|
|
68
52
|
* Get all default labels
|
|
69
53
|
* @returns {Object} Object with all default English labels
|
|
70
54
|
*/
|
|
71
|
-
function getDefaultLabels() {
|
|
72
|
-
return
|
|
55
|
+
export function getDefaultLabels() {
|
|
56
|
+
return {
|
|
57
|
+
...defaultLabels
|
|
58
|
+
};
|
|
73
59
|
}
|
|
74
60
|
|
|
75
61
|
/**
|
|
76
62
|
* Reset to default English labels
|
|
77
63
|
*/
|
|
78
|
-
function resetLabelsProvider() {
|
|
64
|
+
export function resetLabelsProvider() {
|
|
79
65
|
labelsProvider = null;
|
|
80
66
|
}
|
package/dist/config/scheduler.js
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { SummaryPos, ViewType } from './default';
|
|
2
2
|
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _default2 = require("./default");
|
|
8
3
|
/**
|
|
9
4
|
* Default scheduler configuration
|
|
10
5
|
*
|
|
@@ -14,7 +9,7 @@ var _default2 = require("./default");
|
|
|
14
9
|
* 2. Using setLabelsProvider() from the i18n module to set a custom labels provider
|
|
15
10
|
* 3. Directly modifying config properties after instantiation
|
|
16
11
|
*/
|
|
17
|
-
|
|
12
|
+
export default {
|
|
18
13
|
schedulerWidth: '100%',
|
|
19
14
|
besidesWidth: 20,
|
|
20
15
|
underneathHeight: 20,
|
|
@@ -56,7 +51,7 @@ var _default = exports["default"] = {
|
|
|
56
51
|
nonWorkingTimeHeadBgColor: '#fff0f6',
|
|
57
52
|
nonWorkingTimeBodyBgColor: '#fff0f6',
|
|
58
53
|
summaryColor: '#666',
|
|
59
|
-
summaryPos:
|
|
54
|
+
summaryPos: SummaryPos.TopRight,
|
|
60
55
|
groupOnlySlotColor: '#F8F8F8',
|
|
61
56
|
headerBorderColor: '#e9e9e9',
|
|
62
57
|
weekNumberRowHeight: 24,
|
|
@@ -95,27 +90,27 @@ var _default = exports["default"] = {
|
|
|
95
90
|
minuteStep: 30,
|
|
96
91
|
views: [{
|
|
97
92
|
viewName: 'Day',
|
|
98
|
-
viewType:
|
|
93
|
+
viewType: ViewType.Day,
|
|
99
94
|
showAgenda: false,
|
|
100
95
|
isEventPerspective: false
|
|
101
96
|
}, {
|
|
102
97
|
viewName: 'Week',
|
|
103
|
-
viewType:
|
|
98
|
+
viewType: ViewType.Week,
|
|
104
99
|
showAgenda: false,
|
|
105
100
|
isEventPerspective: false
|
|
106
101
|
}, {
|
|
107
102
|
viewName: 'Month',
|
|
108
|
-
viewType:
|
|
103
|
+
viewType: ViewType.Month,
|
|
109
104
|
showAgenda: false,
|
|
110
105
|
isEventPerspective: false
|
|
111
106
|
}, {
|
|
112
107
|
viewName: 'Quarter',
|
|
113
|
-
viewType:
|
|
108
|
+
viewType: ViewType.Quarter,
|
|
114
109
|
showAgenda: false,
|
|
115
110
|
isEventPerspective: false
|
|
116
111
|
}, {
|
|
117
112
|
viewName: 'Year',
|
|
118
|
-
viewType:
|
|
113
|
+
viewType: ViewType.Year,
|
|
119
114
|
showAgenda: false,
|
|
120
115
|
isEventPerspective: false
|
|
121
116
|
}]
|
package/dist/helper/behaviors.js
CHANGED
|
@@ -1,89 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { CellUnit, ViewType } from '../config/default';
|
|
2
|
+
export const getSummary = () => ({
|
|
3
|
+
text: 'Summary',
|
|
4
|
+
color: 'red',
|
|
5
|
+
fontSize: '1.2rem'
|
|
5
6
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var date = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : schedulerData.startDate;
|
|
17
|
-
var viewType = schedulerData.viewType,
|
|
18
|
-
localeDayjs = schedulerData.localeDayjs;
|
|
19
|
-
var startDate;
|
|
20
|
-
var endDate;
|
|
21
|
-
var cellUnit;
|
|
22
|
-
if (viewType === _default2.ViewType.Custom1) {
|
|
23
|
-
var monday = localeDayjs(new Date(date)).startOf('week');
|
|
7
|
+
export const getCustomDate = (schedulerData, num, date = schedulerData.startDate) => {
|
|
8
|
+
const {
|
|
9
|
+
viewType,
|
|
10
|
+
localeDayjs
|
|
11
|
+
} = schedulerData;
|
|
12
|
+
let startDate;
|
|
13
|
+
let endDate;
|
|
14
|
+
let cellUnit;
|
|
15
|
+
if (viewType === ViewType.Custom1) {
|
|
16
|
+
const monday = localeDayjs(new Date(date)).startOf('week');
|
|
24
17
|
startDate = num === 0 ? monday : localeDayjs(new Date(monday)).add(2 * num, 'weeks');
|
|
25
18
|
endDate = localeDayjs(new Date(startDate)).add(1, 'weeks').endOf('week');
|
|
26
|
-
cellUnit =
|
|
27
|
-
} else if (viewType ===
|
|
28
|
-
|
|
19
|
+
cellUnit = CellUnit.Day;
|
|
20
|
+
} else if (viewType === ViewType.Custom2) {
|
|
21
|
+
const firstDayOfMonth = localeDayjs(new Date(date)).startOf('month');
|
|
29
22
|
startDate = num === 0 ? firstDayOfMonth : localeDayjs(new Date(firstDayOfMonth)).add(2 * num, 'months');
|
|
30
23
|
endDate = localeDayjs(new Date(startDate)).add(1, 'months').endOf('month');
|
|
31
|
-
cellUnit =
|
|
24
|
+
cellUnit = CellUnit.Day;
|
|
32
25
|
} else {
|
|
33
26
|
startDate = num === 0 ? date : localeDayjs(new Date(date)).add(2 * num, 'days');
|
|
34
27
|
endDate = localeDayjs(new Date(startDate)).add(1, 'days');
|
|
35
|
-
cellUnit =
|
|
28
|
+
cellUnit = CellUnit.Hour;
|
|
36
29
|
}
|
|
37
30
|
return {
|
|
38
|
-
startDate
|
|
39
|
-
endDate
|
|
40
|
-
cellUnit
|
|
31
|
+
startDate,
|
|
32
|
+
endDate,
|
|
33
|
+
cellUnit
|
|
41
34
|
};
|
|
42
35
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (viewType ===
|
|
52
|
-
dateLabel =
|
|
53
|
-
if (start.month() !== end.month()) dateLabel =
|
|
54
|
-
if (start.year() !== end.year()) dateLabel =
|
|
55
|
-
} else if (viewType ===
|
|
36
|
+
export const getNonAgendaViewBodyCellBgColor = (_schedulerData, _slotId, header) => header.nonWorkingTime ? undefined : '#87e8de';
|
|
37
|
+
export const getDateLabel = (schedulerData, viewType, startDate, endDate) => {
|
|
38
|
+
const {
|
|
39
|
+
localeDayjs
|
|
40
|
+
} = schedulerData;
|
|
41
|
+
const start = localeDayjs(new Date(startDate));
|
|
42
|
+
const end = localeDayjs(endDate);
|
|
43
|
+
let dateLabel = '';
|
|
44
|
+
if (viewType === ViewType.Week || start !== end && (viewType === ViewType.Custom || viewType === ViewType.Custom1 || viewType === ViewType.Custom2)) {
|
|
45
|
+
dateLabel = `${start.format('MMM D')}-${end.format('D, YYYY')}`;
|
|
46
|
+
if (start.month() !== end.month()) dateLabel = `${start.format('MMM D')}-${end.format('MMM D, YYYY')}`;
|
|
47
|
+
if (start.year() !== end.year()) dateLabel = `${start.format('MMM D, YYYY')}-${end.format('MMM D, YYYY')}`;
|
|
48
|
+
} else if (viewType === ViewType.Month) {
|
|
56
49
|
dateLabel = start.format('MMMM YYYY');
|
|
57
|
-
} else if (viewType ===
|
|
58
|
-
dateLabel =
|
|
59
|
-
} else if (viewType ===
|
|
50
|
+
} else if (viewType === ViewType.Quarter) {
|
|
51
|
+
dateLabel = `${start.format('MMM D')}-${end.format('MMM D, YYYY')}`;
|
|
52
|
+
} else if (viewType === ViewType.Year) {
|
|
60
53
|
dateLabel = start.format('YYYY');
|
|
61
54
|
} else {
|
|
62
55
|
dateLabel = start.format('MMM D, YYYY');
|
|
63
56
|
}
|
|
64
57
|
return dateLabel;
|
|
65
58
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var getScrollSpecialDayjs = exports.getScrollSpecialDayjs = function getScrollSpecialDayjs(schedulerData) {
|
|
73
|
-
var localeDayjs = schedulerData.localeDayjs;
|
|
59
|
+
export const getEventText = (schedulerData, event) => schedulerData.isEventPerspective ? schedulerData.resources.find(item => item.id === event.resourceId)?.name || event.title : event.title;
|
|
60
|
+
export const getScrollSpecialDayjs = schedulerData => {
|
|
61
|
+
const {
|
|
62
|
+
localeDayjs
|
|
63
|
+
} = schedulerData;
|
|
74
64
|
return localeDayjs(new Date());
|
|
75
65
|
};
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
export const isNonWorkingTime = (schedulerData, time) => {
|
|
67
|
+
const {
|
|
68
|
+
localeDayjs,
|
|
69
|
+
cellUnit
|
|
70
|
+
} = schedulerData;
|
|
71
|
+
if (cellUnit === CellUnit.Hour) {
|
|
72
|
+
const hour = localeDayjs(new Date(time)).hour();
|
|
81
73
|
return hour < 9 || hour > 18;
|
|
82
74
|
}
|
|
83
|
-
|
|
75
|
+
const dayOfWeek = localeDayjs(new Date(time)).day();
|
|
84
76
|
return dayOfWeek === 0 || dayOfWeek === 6;
|
|
85
77
|
};
|
|
86
|
-
|
|
78
|
+
export default {
|
|
87
79
|
getSummaryFunc: undefined,
|
|
88
80
|
getCustomDateFunc: undefined,
|
|
89
81
|
getNonAgendaViewBodyCellBgColorFunc: undefined,
|
package/dist/helper/utility.js
CHANGED
|
@@ -1,28 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.getNextNumericEventId = getNextNumericEventId;
|
|
7
|
-
exports.getPos = getPos;
|
|
8
|
-
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
9
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
-
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
12
|
-
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
13
|
-
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
-
function getPos(element) {
|
|
15
|
-
var x = 0;
|
|
16
|
-
var y = 0;
|
|
17
|
-
var currentElement = element;
|
|
1
|
+
import dayjs from 'dayjs';
|
|
2
|
+
export function getPos(element) {
|
|
3
|
+
let x = 0;
|
|
4
|
+
let y = 0;
|
|
5
|
+
let currentElement = element;
|
|
18
6
|
while (currentElement) {
|
|
19
7
|
x += currentElement.offsetLeft - currentElement.scrollLeft;
|
|
20
8
|
y += currentElement.offsetTop - currentElement.scrollTop;
|
|
21
9
|
currentElement = currentElement.offsetParent;
|
|
22
10
|
}
|
|
23
11
|
return {
|
|
24
|
-
x
|
|
25
|
-
y
|
|
12
|
+
x,
|
|
13
|
+
y
|
|
26
14
|
};
|
|
27
15
|
}
|
|
28
16
|
|
|
@@ -32,11 +20,37 @@ function getPos(element) {
|
|
|
32
20
|
* @param {Array} events - Array of event objects with id properties
|
|
33
21
|
* @returns {number} The next available numeric ID
|
|
34
22
|
*/
|
|
35
|
-
function getNextNumericEventId(events) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
export function getNextNumericEventId(events) {
|
|
24
|
+
const numericIds = events.map(event => event.id).filter(id => typeof id === 'number' && Number.isFinite(id));
|
|
25
|
+
return Math.max(...numericIds, 0) + 1;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Returns true if the string is a date-only value (YYYY-MM-DD) with no time component.
|
|
30
|
+
*/
|
|
31
|
+
export function isDateOnly(dateStr) {
|
|
32
|
+
return typeof dateStr === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(dateStr);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Normalizes an event start date string to a dayjs object.
|
|
37
|
+
* Date-only strings are treated as start-of-day.
|
|
38
|
+
*/
|
|
39
|
+
export function normalizeEventStart(dateStr) {
|
|
40
|
+
if (isDateOnly(dateStr)) {
|
|
41
|
+
return dayjs(dateStr).startOf('day');
|
|
42
|
+
}
|
|
43
|
+
return dayjs(dateStr);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Normalizes an event end date string to a dayjs object.
|
|
48
|
+
* Date-only strings are treated as end-of-day to avoid UTC midnight timezone shifting
|
|
49
|
+
* causing off-by-one errors in day-cell span calculations (particularly in Month view).
|
|
50
|
+
*/
|
|
51
|
+
export function normalizeEventEnd(dateStr) {
|
|
52
|
+
if (isDateOnly(dateStr)) {
|
|
53
|
+
return dayjs(dateStr).endOf('day');
|
|
54
|
+
}
|
|
55
|
+
return dayjs(dateStr);
|
|
42
56
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,103 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "AddMorePopover", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _index.AddMorePopover;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "CellUnit", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function get() {
|
|
15
|
-
return _index.CellUnit;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
Object.defineProperty(exports, "DATETIME_FORMAT", {
|
|
19
|
-
enumerable: true,
|
|
20
|
-
get: function get() {
|
|
21
|
-
return _index.DATETIME_FORMAT;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(exports, "DATE_FORMAT", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
get: function get() {
|
|
27
|
-
return _index.DATE_FORMAT;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
Object.defineProperty(exports, "DemoData", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
get: function get() {
|
|
33
|
-
return _index.DemoData;
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(exports, "DnDContext", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function get() {
|
|
39
|
-
return _index.DnDContext;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(exports, "DnDSource", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function get() {
|
|
45
|
-
return _index.DnDSource;
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
Object.defineProperty(exports, "Scheduler", {
|
|
49
|
-
enumerable: true,
|
|
50
|
-
get: function get() {
|
|
51
|
-
return _index.Scheduler;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
Object.defineProperty(exports, "SchedulerData", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
get: function get() {
|
|
57
|
-
return _index.SchedulerData;
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
Object.defineProperty(exports, "SummaryPos", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function get() {
|
|
63
|
-
return _index.SummaryPos;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
Object.defineProperty(exports, "ViewType", {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function get() {
|
|
69
|
-
return _index.ViewType;
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
Object.defineProperty(exports, "getDefaultLabels", {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
get: function get() {
|
|
75
|
-
return _i18n.getDefaultLabels;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(exports, "getLabel", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
get: function get() {
|
|
81
|
-
return _i18n.getLabel;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
Object.defineProperty(exports, "resetLabelsProvider", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function get() {
|
|
87
|
-
return _i18n.resetLabelsProvider;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(exports, "setLabelsProvider", {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: function get() {
|
|
93
|
-
return _i18n.setLabelsProvider;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(exports, "wrapperFun", {
|
|
97
|
-
enumerable: true,
|
|
98
|
-
get: function get() {
|
|
99
|
-
return _index.wrapperFun;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
|
-
var _index = require("./components/index");
|
|
103
|
-
var _i18n = require("./config/i18n");
|
|
1
|
+
export { AddMorePopover, CellUnit, DATE_FORMAT, DATETIME_FORMAT, DemoData, DnDContext, DnDSource, Scheduler, SchedulerData, SummaryPos, ViewType, wrapperFun } from './components/index';
|
|
2
|
+
export { getDefaultLabels, getLabel, resetLabelsProvider, setLabelsProvider } from './config/i18n';
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var DemoData = {
|
|
1
|
+
const DemoData = {
|
|
8
2
|
resources: [{
|
|
9
3
|
id: 'r0',
|
|
10
4
|
name: 'Resource0',
|
|
@@ -132,6 +126,48 @@ var DemoData = {
|
|
|
132
126
|
end: '2022-12-27 23:30:00',
|
|
133
127
|
resourceId: 'r1',
|
|
134
128
|
title: 'R1 has many tasks 6'
|
|
129
|
+
}, {
|
|
130
|
+
id: 15,
|
|
131
|
+
start: '2022-12-06',
|
|
132
|
+
end: '2022-12-09',
|
|
133
|
+
resourceId: 'r3',
|
|
134
|
+
title: 'SAMPLE TASK (DATE-ONLY FORMAT)'
|
|
135
|
+
}, {
|
|
136
|
+
id: 16,
|
|
137
|
+
start: '2022-12-12',
|
|
138
|
+
end: '2022-12-14',
|
|
139
|
+
resourceId: 'r3',
|
|
140
|
+
title: 'SAMPLE TASK (DATE-ONLY FORMAT)'
|
|
141
|
+
}, {
|
|
142
|
+
id: 17,
|
|
143
|
+
resourceId: 'r4',
|
|
144
|
+
title: '#198 Sat→Mon',
|
|
145
|
+
start: '2022-12-17 23:00:00',
|
|
146
|
+
end: '2022-12-19 09:00:00'
|
|
147
|
+
}, {
|
|
148
|
+
id: 18,
|
|
149
|
+
resourceId: 'r5',
|
|
150
|
+
title: '#198 Sun→Mon',
|
|
151
|
+
start: '2022-12-18 10:00:00',
|
|
152
|
+
end: '2022-12-19 10:00:00'
|
|
153
|
+
}, {
|
|
154
|
+
id: 19,
|
|
155
|
+
resourceId: 'r6',
|
|
156
|
+
title: '#198 prev-month carry',
|
|
157
|
+
start: '2022-11-30 10:00:00',
|
|
158
|
+
end: '2022-12-15 10:00:00'
|
|
159
|
+
}, {
|
|
160
|
+
id: 20,
|
|
161
|
+
resourceId: 'r7',
|
|
162
|
+
title: '#198 month boundary',
|
|
163
|
+
start: '2022-11-30 10:00:00',
|
|
164
|
+
end: '2022-12-02 10:00:00'
|
|
165
|
+
}, {
|
|
166
|
+
id: 21,
|
|
167
|
+
resourceId: 'r4',
|
|
168
|
+
title: '#112 short',
|
|
169
|
+
start: '2022-12-19 10:10:00',
|
|
170
|
+
end: '2022-12-19 11:20:00'
|
|
135
171
|
}],
|
|
136
172
|
eventsForTaskView: [{
|
|
137
173
|
id: 1,
|
|
@@ -334,4 +370,4 @@ var DemoData = {
|
|
|
334
370
|
type: 3
|
|
335
371
|
}]
|
|
336
372
|
};
|
|
337
|
-
|
|
373
|
+
export default DemoData;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-big-schedule",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "React Big Schedule is a powerful and intuitive scheduler and resource planning solution built with React. Seamlessly integrate this modern browser-compatible component into your applications to effectively manage time, appointments, and resources. With drag-and-drop functionality, interactive UI, and granular views, react-big-schedule empowers users to effortlessly schedule and allocate resources with precision. Enhance productivity and streamline your workflow with this React-based solution, designed to optimize time management and simplify calendar-based operations. Perfect for applications requiring advanced scheduling capabilities, react-big-schedule offers a seamless and intuitive experience for managing appointments, resource allocation, and time slots. Unlock the potential of your React projects with react-big-schedule and revolutionize the way you handle scheduling and resource planning. It is the updated version of react-big-scheduler",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-big-schedule",
|
|
@@ -61,31 +61,31 @@
|
|
|
61
61
|
"fix": "biome check --write ."
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@ant-design/icons": "^6.
|
|
65
|
-
"antd": "^6.
|
|
66
|
-
"dayjs": "^1.11.
|
|
64
|
+
"@ant-design/icons": "^6.3.4",
|
|
65
|
+
"antd": "^6.6.5",
|
|
66
|
+
"dayjs": "^1.11.23",
|
|
67
67
|
"prop-types": "^15.8.1",
|
|
68
|
-
"react": "^19.
|
|
68
|
+
"react": "^19.3.0",
|
|
69
69
|
"react-dnd": "^16.0.1",
|
|
70
70
|
"react-dnd-html5-backend": "^16.0.1",
|
|
71
|
-
"react-dom": "^19.
|
|
72
|
-
"react-router-dom": "^7.
|
|
71
|
+
"react-dom": "^19.3.0",
|
|
72
|
+
"react-router-dom": "^7.18.4",
|
|
73
73
|
"rrule": "^2.8.1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@babel/cli": "^
|
|
77
|
-
"@babel/core": "^
|
|
78
|
-
"@babel/preset-env": "^
|
|
79
|
-
"@babel/preset-react": "^
|
|
80
|
-
"@biomejs/biome": "^2.
|
|
76
|
+
"@babel/cli": "^8.0.6",
|
|
77
|
+
"@babel/core": "^8.0.7",
|
|
78
|
+
"@babel/preset-env": "^8.0.7",
|
|
79
|
+
"@babel/preset-react": "^8.0.1",
|
|
80
|
+
"@biomejs/biome": "^2.5.15",
|
|
81
81
|
"babel-loader": "^10.1.1",
|
|
82
82
|
"copy-webpack-plugin": "^14.0.0",
|
|
83
|
-
"css-loader": "^7.1.
|
|
84
|
-
"fs-extra": "^11.
|
|
85
|
-
"html-webpack-plugin": "^5.6.
|
|
83
|
+
"css-loader": "^7.1.5",
|
|
84
|
+
"fs-extra": "^11.4.1",
|
|
85
|
+
"html-webpack-plugin": "^5.6.8",
|
|
86
86
|
"style-loader": "^4.0.0",
|
|
87
|
-
"webpack": "^5.
|
|
88
|
-
"webpack-cli": "^7.
|
|
89
|
-
"webpack-dev-server": "^
|
|
87
|
+
"webpack": "^5.111.1",
|
|
88
|
+
"webpack-cli": "^7.2.3",
|
|
89
|
+
"webpack-dev-server": "^6.0.0"
|
|
90
90
|
}
|
|
91
91
|
}
|