react-big-schedule 4.1.3 → 4.2.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/dist/components/SchedulerData.js +19 -37
- package/dist/index.d.ts +247 -0
- package/package.json +1 -1
|
@@ -14,12 +14,6 @@ var _behaviors = _interopRequireDefault(require("../helper/behaviors"));
|
|
|
14
14
|
var _index = require("./index");
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
16
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
17
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
18
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
20
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
|
-
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
22
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
17
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
24
18
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
25
19
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -63,29 +57,17 @@ var SchedulerData = /*#__PURE__*/function () {
|
|
|
63
57
|
}
|
|
64
58
|
_createClass(SchedulerData, [{
|
|
65
59
|
key: "setSchedulerLocale",
|
|
66
|
-
value: function setSchedulerLocale(preset
|
|
60
|
+
value: function setSchedulerLocale(preset) {
|
|
67
61
|
if (!preset) return;
|
|
68
|
-
|
|
69
|
-
if (typeof preset === 'string') {
|
|
70
|
-
l = require("dayjs/locale/".concat(preset, ".js"));
|
|
71
|
-
if (!!object) {
|
|
72
|
-
Object.entries(object).forEach(function (_ref) {
|
|
73
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
|
74
|
-
key = _ref2[0],
|
|
75
|
-
value = _ref2[1];
|
|
76
|
-
return l[key] = value;
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
this.localeDayjs.locale(l);
|
|
62
|
+
this.localeDayjs.locale(preset);
|
|
81
63
|
this._shouldReloadViewType = true;
|
|
82
64
|
this.setViewType(this.viewType, this.showAgenda, this.isEventPerspective);
|
|
83
65
|
}
|
|
84
66
|
}, {
|
|
85
67
|
key: "setCalendarPopoverLocale",
|
|
86
68
|
value: function setCalendarPopoverLocale(lang) {
|
|
87
|
-
if (!!lang
|
|
88
|
-
this.calendarPopoverLocale =
|
|
69
|
+
if (!!lang) {
|
|
70
|
+
this.calendarPopoverLocale = lang;
|
|
89
71
|
}
|
|
90
72
|
}
|
|
91
73
|
}, {
|
|
@@ -476,26 +458,26 @@ var SchedulerData = /*#__PURE__*/function () {
|
|
|
476
458
|
value: function swapEvent(eventSource, eventDest) {
|
|
477
459
|
// Swap group or resource IDs
|
|
478
460
|
if (this.isEventPerspective) {
|
|
479
|
-
var
|
|
480
|
-
eventSource.groupId =
|
|
481
|
-
eventDest.groupId =
|
|
482
|
-
var
|
|
483
|
-
eventSource.groupName =
|
|
484
|
-
eventDest.groupName =
|
|
461
|
+
var _ref = [eventDest.groupId, eventSource.groupId];
|
|
462
|
+
eventSource.groupId = _ref[0];
|
|
463
|
+
eventDest.groupId = _ref[1];
|
|
464
|
+
var _ref2 = [eventDest.groupName, eventSource.groupName];
|
|
465
|
+
eventSource.groupName = _ref2[0];
|
|
466
|
+
eventDest.groupName = _ref2[1];
|
|
485
467
|
} else {
|
|
486
|
-
var
|
|
487
|
-
eventSource.resourceId =
|
|
488
|
-
eventDest.resourceId =
|
|
468
|
+
var _ref3 = [eventDest.resourceId, eventSource.resourceId];
|
|
469
|
+
eventSource.resourceId = _ref3[0];
|
|
470
|
+
eventDest.resourceId = _ref3[1];
|
|
489
471
|
}
|
|
490
472
|
|
|
491
473
|
// Swap start and end times
|
|
492
|
-
var
|
|
493
|
-
eventSource.start =
|
|
494
|
-
eventDest.start =
|
|
474
|
+
var _ref4 = [eventDest.start, eventSource.start];
|
|
475
|
+
eventSource.start = _ref4[0];
|
|
476
|
+
eventDest.start = _ref4[1];
|
|
495
477
|
// Update the events
|
|
496
|
-
var
|
|
497
|
-
eventSource.end =
|
|
498
|
-
eventDest.end =
|
|
478
|
+
var _ref5 = [eventDest.end, eventSource.end];
|
|
479
|
+
eventSource.end = _ref5[0];
|
|
480
|
+
eventDest.end = _ref5[1];
|
|
499
481
|
this._detachEvent(eventSource);
|
|
500
482
|
this._detachEvent(eventDest);
|
|
501
483
|
this._attachEvent(eventSource);
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { Dayjs } from 'dayjs';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
export const DATE_FORMAT: string;
|
|
5
|
+
export const DATETIME_FORMAT: string;
|
|
6
|
+
|
|
7
|
+
export class Scheduler<T extends EventItem = EventItem> extends React.Component<SchedulerProps<T>, any> {}
|
|
8
|
+
export class SchedulerData {}
|
|
9
|
+
|
|
10
|
+
export enum ViewType {
|
|
11
|
+
Day = 'Day',
|
|
12
|
+
Week = 'Week',
|
|
13
|
+
Month = 'Month',
|
|
14
|
+
Quarter = 'Quarter',
|
|
15
|
+
Year = 'Year',
|
|
16
|
+
Custom = 'Custom',
|
|
17
|
+
Custom1 = 'Custom1',
|
|
18
|
+
Custom2 = 'Custom2',
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export enum CellUnit {
|
|
22
|
+
Day = 'Day',
|
|
23
|
+
Hour = 'Hour',
|
|
24
|
+
Week = 'Week',
|
|
25
|
+
Month = 'Month',
|
|
26
|
+
Year = 'Year',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export enum SummaryPos {
|
|
30
|
+
Top = 'Top',
|
|
31
|
+
TopRight = 'TopRight',
|
|
32
|
+
TopLeft = 'TopLeft',
|
|
33
|
+
Bottom = 'Bottom',
|
|
34
|
+
BottomRight = 'BottomRight',
|
|
35
|
+
BottomLeft = 'BottomLeft',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export class DnDSource {}
|
|
39
|
+
export class DnDContext {}
|
|
40
|
+
export class AddMorePopover extends React.Component<AddMorePopoverProps, any> {}
|
|
41
|
+
export class DemoData {}
|
|
42
|
+
export function wrapperFun(): void {}
|
|
43
|
+
|
|
44
|
+
export interface SchedulerProps<T extends EventItem = EventItem> {}
|
|
45
|
+
export interface AddMorePopoverProps {}
|
|
46
|
+
export class SchedulerData {}
|
|
47
|
+
|
|
48
|
+
export interface View {
|
|
49
|
+
viewName?: string;
|
|
50
|
+
viewType: ViewType;
|
|
51
|
+
showAgenda: boolean;
|
|
52
|
+
isEventPerspective: boolean;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface EventGroup {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
state: EventItem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface EventItem {
|
|
62
|
+
id: number | string;
|
|
63
|
+
start: string;
|
|
64
|
+
end: string;
|
|
65
|
+
resourceId: string;
|
|
66
|
+
title: string;
|
|
67
|
+
bgColor?: string;
|
|
68
|
+
rrule?: string;
|
|
69
|
+
showPopover?: boolean;
|
|
70
|
+
resizable?: boolean;
|
|
71
|
+
movable?: boolean;
|
|
72
|
+
startResizable?: boolean;
|
|
73
|
+
endResizable?: boolean;
|
|
74
|
+
groupId?: string;
|
|
75
|
+
groupName?: string;
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated This property should not be used as EXRULE has been [deprecated in RFC 5545](https://icalendar.org/iCalendar-RFC-5545/a-3-deprecated-features.html) and does not support a DTSTART property
|
|
78
|
+
*/
|
|
79
|
+
exrule?: string;
|
|
80
|
+
exdates: string[];
|
|
81
|
+
[x: string]: unknown;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface ResourceEvent {
|
|
85
|
+
id: number;
|
|
86
|
+
name: string;
|
|
87
|
+
parentId?: string;
|
|
88
|
+
groupOnly?: boolean;
|
|
89
|
+
hasSummary?: boolean;
|
|
90
|
+
expanded?: boolean;
|
|
91
|
+
headerItems?: EventItem[];
|
|
92
|
+
render?: boolean;
|
|
93
|
+
rowHeight: number;
|
|
94
|
+
rowMaxCount: number;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface Resource {
|
|
98
|
+
id: string;
|
|
99
|
+
name: string;
|
|
100
|
+
parentId?: string;
|
|
101
|
+
groupOnly?: boolean;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface HeaderItem {
|
|
105
|
+
time: string;
|
|
106
|
+
start: string;
|
|
107
|
+
end: string;
|
|
108
|
+
addMore: number;
|
|
109
|
+
addMoreIndex: number;
|
|
110
|
+
count: number;
|
|
111
|
+
nonWorkingTime: boolean;
|
|
112
|
+
events: EventItem[];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface HeaderEvent {
|
|
116
|
+
render: boolean;
|
|
117
|
+
span: number;
|
|
118
|
+
eventItem: EventItem;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export interface State {
|
|
122
|
+
headerItem: HeaderItem;
|
|
123
|
+
left: number;
|
|
124
|
+
top: number;
|
|
125
|
+
height: number;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface SchedulerDataConfig {
|
|
129
|
+
schedulerWidth?: `${number}%`;
|
|
130
|
+
besidesWidth?: number;
|
|
131
|
+
schedulerMaxHeight?: number;
|
|
132
|
+
tableHeaderHeight?: number;
|
|
133
|
+
schedulerContentHeight?: string | number;
|
|
134
|
+
agendaResourceTableWidth?: string | number;
|
|
135
|
+
agendaMaxEventWidth?: string | number;
|
|
136
|
+
dayResourceTableWidth?: string | number;
|
|
137
|
+
weekResourceTableWidth?: string | number;
|
|
138
|
+
monthResourceTableWidth?: string | number;
|
|
139
|
+
quarterResourceTableWidth?: string | number;
|
|
140
|
+
yearResourceTableWidth?: string | number;
|
|
141
|
+
customResourceTableWidth?: string | number;
|
|
142
|
+
dayCellWidth?: string | number;
|
|
143
|
+
weekCellWidth?: string | number;
|
|
144
|
+
monthCellWidth?: string | number;
|
|
145
|
+
quarterCellWidth?: string | number;
|
|
146
|
+
yearCellWidth?: string | number;
|
|
147
|
+
customCellWidth?: string | number;
|
|
148
|
+
dayMaxEvents?: number;
|
|
149
|
+
weekMaxEvents?: number;
|
|
150
|
+
monthMaxEvents?: number;
|
|
151
|
+
quarterMaxEvents?: number;
|
|
152
|
+
yearMaxEvents?: number;
|
|
153
|
+
customMaxEvents?: number;
|
|
154
|
+
eventItemPopoverTrigger?: 'hover' | 'click';
|
|
155
|
+
eventItemPopoverPlacement?:
|
|
156
|
+
| 'topLeftMousePosition'
|
|
157
|
+
| 'bottomLeftMousePosition'
|
|
158
|
+
| 'topRightMousePosition'
|
|
159
|
+
| 'bottomRightMousePosition'
|
|
160
|
+
| 'top'
|
|
161
|
+
| 'left'
|
|
162
|
+
| 'right'
|
|
163
|
+
| 'bottom'
|
|
164
|
+
| 'topLeft'
|
|
165
|
+
| 'topRight'
|
|
166
|
+
| 'bottomLeft'
|
|
167
|
+
| 'bottomRight'
|
|
168
|
+
| 'leftTop'
|
|
169
|
+
| 'leftBottom'
|
|
170
|
+
| 'rightTop'
|
|
171
|
+
| 'rightBottom';
|
|
172
|
+
eventItemPopoverWidth?: number;
|
|
173
|
+
eventItemHeight?: number;
|
|
174
|
+
eventItemLineHeight?: number;
|
|
175
|
+
nonAgendaSlotMinHeight?: number;
|
|
176
|
+
dayStartFrom?: number;
|
|
177
|
+
dayStopTo?: number;
|
|
178
|
+
defaultEventBgColor?: string;
|
|
179
|
+
selectedAreaColor?: string;
|
|
180
|
+
nonWorkingTimeHeadColor?: string;
|
|
181
|
+
nonWorkingTimeHeadBgColor?: string;
|
|
182
|
+
nonWorkingTimeBodyBgColor?: string;
|
|
183
|
+
summaryColor?: string;
|
|
184
|
+
summaryPos?: SummaryPos;
|
|
185
|
+
groupOnlySlotColor?: string;
|
|
186
|
+
startResizable?: boolean;
|
|
187
|
+
endResizable?: boolean;
|
|
188
|
+
movable?: boolean;
|
|
189
|
+
creatable?: boolean;
|
|
190
|
+
crossResourceMove?: boolean;
|
|
191
|
+
checkConflict?: boolean;
|
|
192
|
+
scrollToSpecialDaysjsEnabled?: boolean;
|
|
193
|
+
eventItemPopoverEnabled?: boolean;
|
|
194
|
+
calendarPopoverEnabled?: boolean;
|
|
195
|
+
recurringEventsEnabled?: boolean;
|
|
196
|
+
viewChangeSpinEnabled?: boolean;
|
|
197
|
+
dateChangeSpinEnabled?: boolean;
|
|
198
|
+
headerEnabled?: boolean;
|
|
199
|
+
resourceViewEnabled?: boolean;
|
|
200
|
+
displayWeekend?: boolean;
|
|
201
|
+
relativeMove?: boolean;
|
|
202
|
+
defaultExpanded?: boolean;
|
|
203
|
+
dragAndDropEnabled?: boolean;
|
|
204
|
+
schedulerHeaderEventsFuncsTimeoutMs?: number;
|
|
205
|
+
resourceName?: string;
|
|
206
|
+
taskName?: string;
|
|
207
|
+
agendaViewHeader?: string;
|
|
208
|
+
addMorePopoverHeaderFormat?: string;
|
|
209
|
+
eventItemPopoverDateFormat?: string;
|
|
210
|
+
nonAgendaDayCellHeaderFormat?: string;
|
|
211
|
+
nonAgendaOtherCellHeaderFormat?: string;
|
|
212
|
+
minuteStep?: number;
|
|
213
|
+
views?: View[];
|
|
214
|
+
responsiveByParent?: boolean;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface SchedulerDataBehaviors {
|
|
218
|
+
isNonWorkingTimeFunc?: (schedulerData: SchedulerData, time: string) => boolean;
|
|
219
|
+
getCustomDateFunc?: (schedulerData: SchedulerData, num: number, date?: string | Dayjs) => { startDate: string | Dayjs; endDate: string | Dayjs; cellUnit: CellUnit };
|
|
220
|
+
getEventTextFunc?: (schedulerData: SchedulerData, event: EventItem) => string;
|
|
221
|
+
getDateLabel?: (schedulerData: SchedulerData, viewType: ViewType, startDate: string | Date, endDate: string | Date) => string;
|
|
222
|
+
getScrollSpecialDayjs?: (schedulerData: SchedulerData, startDayjs: Dayjs, endDays: Dayjs) => Dayjs;
|
|
223
|
+
getSummaryFunc?: (
|
|
224
|
+
schedulerData: SchedulerData,
|
|
225
|
+
headerEvents: HeaderEvent[],
|
|
226
|
+
slotId: string,
|
|
227
|
+
slotName: string,
|
|
228
|
+
headerStart: string,
|
|
229
|
+
headerEnd: string
|
|
230
|
+
) => { text: string; color: string; fontSize: string };
|
|
231
|
+
getNonAgendaViewBodyCellBgColorFunc?: (schedulerData: SchedulerData, slotId: string, header: { nonWorkingTime: boolean; time: string }) => string;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export {
|
|
235
|
+
DATE_FORMAT,
|
|
236
|
+
DATETIME_FORMAT,
|
|
237
|
+
Scheduler,
|
|
238
|
+
SchedulerData,
|
|
239
|
+
ViewType,
|
|
240
|
+
CellUnit,
|
|
241
|
+
SummaryPos,
|
|
242
|
+
DnDSource,
|
|
243
|
+
DnDContext,
|
|
244
|
+
AddMorePopover,
|
|
245
|
+
DemoData,
|
|
246
|
+
wrapperFun,
|
|
247
|
+
} from './components/index';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-big-schedule",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.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",
|