react-big-schedule 4.2.4 → 4.3.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 CHANGED
@@ -1,51 +1,56 @@
1
- # React Big Schedule (react-big-schedule)
2
- [![NPM version][npm-image]][npm-url] [![MIT License][mit-image]][mit-url] [![CodeQL][codeql-image]][codeql-url]
3
-
4
- [npm-image]: http://img.shields.io/npm/v/react-big-schedule.svg
5
- [npm-url]: http://npmjs.org/package/react-big-schedule
6
- [mit-image]: https://img.shields.io/badge/License-MIT-green.svg
7
- [mit-url]: https://github.com/react-scheduler/react-big-schedule/blob/master/LICENSE
8
- [codeql-image]: https://github.com/react-scheduler/react-big-schedule/actions/workflows/github-code-scanning/codeql/badge.svg?branch=master
9
- [codeql-url]: https://github.com/react-scheduler/react-big-schedule/actions/workflows/github-code-scanning/codeql
1
+ # React Big Schedule (react-big-schedule)
10
2
 
3
+ [![NPM version][npm-image]][npm-url] [![MIT License][mit-image]][mit-url] [![CodeQL][codeql-image]][codeql-url] [![CodeFactor][codeFactor-badge]][codeFactor-link]
4
+
5
+ [npm-image]: http://img.shields.io/npm/v/react-big-schedule.svg
6
+ [npm-url]: http://npmjs.org/package/react-big-schedule
7
+ [mit-image]: https://img.shields.io/badge/License-MIT-green.svg
8
+ [mit-url]: https://github.com/react-scheduler/react-big-schedule/blob/master/LICENSE
9
+ [codeql-image]: https://github.com/react-scheduler/react-big-schedule/actions/workflows/github-code-scanning/codeql/badge.svg?branch=master
10
+ [codeql-url]: https://github.com/react-scheduler/react-big-schedule/actions/workflows/github-code-scanning/codeql
11
+ [codeFactor-badge]: https://www.codefactor.io/repository/github/react-scheduler/react-big-schedule/badge
12
+ [codeFactor-link]: https://www.codefactor.io/repository/github/react-scheduler/react-big-schedule
11
13
 
12
14
  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.
13
15
 
14
- 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.
16
+ 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.
15
17
 
16
18
  Unlock the potential of your React projects with react-big-schedule and revolutionize the way you handle scheduling and resource planning.
17
19
 
18
20
  ### This project code is forked from:
19
- * [react-big-scheduler](https://stephenchou1017.github.io/scheduler/#/).
20
- * [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
21
+
22
+ - [react-big-scheduler](https://stephenchou1017.github.io/scheduler/#/).
23
+ - [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
21
24
 
22
25
  ## Installation
23
26
 
24
27
  To install react-big-schedule, use npm:
28
+
25
29
  ```bash
26
30
  npm install react-big-schedule
27
31
  ```
28
32
 
29
- ## Tech Stack
33
+ ## Tech Stack
30
34
 
31
- * React
32
- * Ant Design
33
- * react-dnd
34
- * react-dnd-html5-backend
35
- * webpack
36
- * dayjs
35
+ - React
36
+ - Ant Design
37
+ - react-dnd
38
+ - react-dnd-html5-backend
39
+ - webpack
40
+ - dayjs
37
41
 
38
42
  ## Features
39
43
 
40
- * Modern and intuitive scheduler component for React applications.
41
- * Seamless integration with React projects.
42
- * Drag-and-drop functionality for effortless scheduling.
43
- * Interactive user interface for a smooth user experience
44
- * Granular views to manage time, appointments, and resources effectively.
45
- * Optimized for time management and calendar-based operations.
46
- * Perfect for applications requiring advanced scheduling capabilities.
44
+ - Modern and intuitive scheduler component for React applications.
45
+ - Seamless integration with React projects.
46
+ - Drag-and-drop functionality for effortless scheduling.
47
+ - Interactive user interface for a smooth user experience
48
+ - Granular views to manage time, appointments, and resources effectively.
49
+ - Optimized for time management and calendar-based operations.
50
+ - Perfect for applications requiring advanced scheduling capabilities.
47
51
 
48
52
  ## Contributions
53
+
49
54
  Contributions to react-big-schedule are welcome! If you find a bug or want to contribute to the project, please follow these steps:
50
55
 
51
56
  1. Fork the repository on GitHub.
@@ -57,41 +62,48 @@ Contributions to react-big-schedule are welcome! If you find a bug or want to co
57
62
  Please ensure that your code adheres to the project's coding conventions and includes appropriate tests.
58
63
 
59
64
  ## License
65
+
60
66
  React Big Schedule is released under the MIT License. See the [LICENSE](https://github.com/react-scheduler/react-big-schedule/blob/master/LICENSE) file for more details.
61
67
 
62
68
  ## Support
69
+
63
70
  If you have any questions or need support, please create an issue in the [GitHub repository](https://github.com/react-scheduler/react-big-schedule/issues).
64
71
 
65
72
  ## Credits
73
+
66
74
  React Big Schedule is developed and maintained by the React Big Schedule team. We would like to thank the open-source community for their valuable contributions and feedback.
67
75
 
68
76
  Special thanks to the following contributors:
69
- * Ansul Agrawal ([@ansulagrawal](https://github.com/ansulagrawal))
70
- * Jitendra Soni ([@JitendraSoni1234](https://github.com/JitendraSoni1234))
71
- * hbatalhaStch [[@hbatalhaStch](https://github.com/hbatalhaStch))
72
- * DamyanBG ([@DamyanBG](https://github.com/DamyanBG))
77
+
78
+ - Ansul Agrawal ([@ansulagrawal](https://github.com/ansulagrawal))
79
+ - Jitendra Soni ([@JitendraSoni1234](https://github.com/JitendraSoni1234))
80
+ - hbatalhaStch [[@hbatalhaStch](https://github.com/hbatalhaStch))
81
+ - DamyanBG ([@DamyanBG](https://github.com/DamyanBG))
73
82
 
74
83
  ## Acknowledgments
84
+
75
85
  We would like to acknowledge the following projects for their inspiration and contributions:
76
- * [react-big-scheduler](https://stephenchou1017.github.io/scheduler/#/).
77
- * [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
86
+
87
+ - [react-big-scheduler](https://stephenchou1017.github.io/scheduler/#/).
88
+ - [react-big-scheduler-stch](https://github.com/hbatalhaStch/react-big-scheduler).
78
89
 
79
90
  ## Roadmap
80
- * Additional view options for different scheduling needs.
81
- * Support for recurring appointments.
82
- * Integration with popular calendar services.
83
- * Improved accessibility and localization support.
84
- * Performance optimizations for handling large data sets.
91
+
92
+ - Additional view options for different scheduling needs.
93
+ - Support for recurring appointments.
94
+ - Integration with popular calendar services.
95
+ - Improved accessibility and localization support.
96
+ - Performance optimizations for handling large data sets.
85
97
 
86
98
  We are continuously working on enhancing react-big-schedule and welcome your feedback and suggestions for future improvements.
87
99
 
88
100
  ## Changelog
89
- Please refer to the [CHANGELOG.md](https://github.com/react-scheduler/react-big-schedule/blob/master/CHANGELOG.md) file.
90
101
 
102
+ Please refer to the [CHANGELOG.md](https://github.com/react-scheduler/react-big-schedule/blob/master/CHANGELOG.md) file.
91
103
 
92
104
  ## Use and Setup
93
105
 
94
- 1.) Installation
106
+ 1.) Installation
95
107
 
96
108
  ```
97
109
  npm i react-big-schedule
@@ -112,19 +124,20 @@ import "react-big-schedule/dist/css/style.css";
112
124
  ```
113
125
 
114
126
  3.) Basic Usage
127
+
115
128
  ```js
116
- const schedulerData = new SchedulerData( new dayjs().format(DATE_FORMAT), ViewType.Week );
129
+ const schedulerData = new SchedulerData(new dayjs().format(DATE_FORMAT), ViewType.Week);
117
130
 
118
131
  //set locale dayjs to the schedulerData, if your locale isn't English. By default, Scheduler comes with English(en, United States).
119
- schedulerData.setSchedulerLocale("pt-br"); // this uses dayjs, but it doesn't require dayjs to be installed as its called dynamically
120
- schedulerData.setCalendarPopoverLocale("pt_BR"); // this uses antd [List of supported locales](https://ant.design/docs/react/i18n#supported-languages)
132
+ schedulerData.setSchedulerLocale('pt-br'); // this uses dayjs, but it doesn't require dayjs to be installed as its called dynamically
133
+ schedulerData.setCalendarPopoverLocale('pt_BR'); // this uses antd [List of supported locales](https://ant.design/docs/react/i18n#supported-languages)
121
134
 
122
135
  schedulerData.setResources([
123
- { id: "r0", name: "Resource0", groupOnly: true},
124
- { id: "r1", name: "Resource1" },
125
- { id: "r2", name: "Resource2", parentId: "r0" },
126
- { id: "r3", name: "Resource3", parentId: "r4" },
127
- { id: "r4", name: "Resource4", parentId: "r2" },
136
+ { id: 'r0', name: 'Resource0', groupOnly: true },
137
+ { id: 'r1', name: 'Resource1' },
138
+ { id: 'r2', name: 'Resource2', parentId: 'r0' },
139
+ { id: 'r3', name: 'Resource3', parentId: 'r4' },
140
+ { id: 'r4', name: 'Resource4', parentId: 'r2' },
128
141
  ]);
129
142
 
130
143
  // the event array should be sorted in ascending order by event.start property
@@ -132,44 +145,44 @@ schedulerData.setResources([
132
145
  schedulerData.setEvents([
133
146
  {
134
147
  id: 1,
135
- start: "2022-12-18 09:30:00",
136
- end: "2022-12-19 23:30:00",
137
- resourceId: "r1",
138
- title: "I am finished",
139
- bgColor: "#D9D9D9",
148
+ start: '2022-12-18 09:30:00',
149
+ end: '2022-12-19 23:30:00',
150
+ resourceId: 'r1',
151
+ title: 'I am finished',
152
+ bgColor: '#D9D9D9',
140
153
  },
141
154
  {
142
155
  id: 2,
143
- start: "2022-12-18 12:30:00",
144
- end: "2022-12-26 23:30:00",
145
- resourceId: "r2",
146
- title: "I am not resizable",
156
+ start: '2022-12-18 12:30:00',
157
+ end: '2022-12-26 23:30:00',
158
+ resourceId: 'r2',
159
+ title: 'I am not resizable',
147
160
  resizable: false,
148
161
  },
149
162
  {
150
163
  id: 3,
151
- start: "2022-12-19 12:30:00",
152
- end: "2022-12-20 23:30:00",
153
- resourceId: "r3",
154
- title: "I am not movable",
164
+ start: '2022-12-19 12:30:00',
165
+ end: '2022-12-20 23:30:00',
166
+ resourceId: 'r3',
167
+ title: 'I am not movable',
155
168
  movable: false,
156
169
  },
157
170
  {
158
171
  id: 4,
159
- start: "2022-12-19 14:30:00",
160
- end: "2022-12-20 23:30:00",
161
- resourceId: "r1",
162
- title: "I am not start-resizable",
172
+ start: '2022-12-19 14:30:00',
173
+ end: '2022-12-20 23:30:00',
174
+ resourceId: 'r1',
175
+ title: 'I am not start-resizable',
163
176
  startResizable: false,
164
177
  },
165
178
  {
166
179
  id: 5,
167
- start: "2022-12-19 15:30:00",
168
- end: "2022-12-20 23:30:00",
169
- resourceId: "r2",
170
- title: "R2 has recurring tasks every week on Tuesday, Friday",
171
- rrule: "FREQ=WEEKLY;DTSTART=20221219T013000Z;BYDAY=TU,FR",
172
- bgColor: "#f759ab",
180
+ start: '2022-12-19 15:30:00',
181
+ end: '2022-12-20 23:30:00',
182
+ resourceId: 'r2',
183
+ title: 'R2 has recurring tasks every week on Tuesday, Friday',
184
+ rrule: 'FREQ=WEEKLY;DTSTART=20221219T013000Z;BYDAY=TU,FR',
185
+ bgColor: '#f759ab',
173
186
  },
174
187
  ]);
175
188
 
@@ -187,10 +200,8 @@ schedulerData.setEvents([
187
200
  />;
188
201
  ```
189
202
 
190
-
191
203
  ### Run examples locally
192
204
 
193
-
194
205
  - Clone this repository
195
206
  - Retrieve dependencies: `npm install` or `npm i`
196
207
  - Start: `npm run start`
@@ -200,7 +211,6 @@ If you fail to execute the `npm install` command, remove the package-lock.json f
200
211
 
201
212
  # API
202
213
 
203
-
204
214
  ### SchedulerData
205
215
 
206
216
  SchedulerData is the view model of Scheduler, we can modify it to control the view of the Scheduler.
@@ -250,6 +260,7 @@ Used to set locale to the scheduler, it uses dayjs locales ([List of supported l
250
260
  `preset` will be locale imported from dayjs.
251
261
 
252
262
  #### example:
263
+
253
264
  ```js
254
265
  import * as dayjsLocale from 'dayjs/locale/pt-br';
255
266
 
@@ -267,6 +278,7 @@ setCalendarPopoverLocale(lang);
267
278
  Used to set locale to the calendar popover. it uses antd locales ([List of supported locales](https://ant.design/docs/react/i18n#supported-languages)). By default, it comes with English(en, United States)
268
279
 
269
280
  #### example:
281
+
270
282
  ```js
271
283
  import * as antdLocale from 'antd/locale/pt_BR';
272
284
 
@@ -305,7 +317,6 @@ Let the time window scroll to the left once. When `SchedulerData,viewType` is `V
305
317
  scroll a month, when `SchedulerData,viewType` is `ViewType.Week`, the time window will scroll a week. `SchedulerData.events`
306
318
  will be clear after calling this method.
307
319
 
308
-
309
320
  #### next
310
321
 
311
322
  ```js
@@ -325,11 +336,7 @@ Let the time window jump to the provided `date` directly. `SchedulerData.events`
325
336
  #### setViewType
326
337
 
327
338
  ```js
328
- setViewType(
329
- (viewType = ViewType.Week),
330
- (showAgenda = false),
331
- (isEventPerspective = false)
332
- );
339
+ setViewType((viewType = ViewType.Week), (showAgenda = false), (isEventPerspective = false));
333
340
  ```
334
341
 
335
342
  Tell SchedulerData to change current view, the `viewType`, `showAgenda` and `isEventPerspective` group should be
@@ -755,14 +762,7 @@ Method that defines non-working time.
755
762
  #### getSummaryFunc
756
763
 
757
764
  ```js
758
- getSummary(
759
- schedulerData,
760
- headerEvents,
761
- slotId,
762
- slotName,
763
- headerStart,
764
- headerEnd
765
- );
765
+ getSummary(schedulerData, headerEvents, slotId, slotName, headerStart, headerEnd);
766
766
  ```
767
767
 
768
768
  Method that defines the summary text displayed in the Scheduler cells.Refer
@@ -912,16 +912,7 @@ to [this example](https://stephenchou1017.github.io/scheduler/#/customheader).
912
912
 
913
913
  ```js
914
914
  conflictOccurred: PropTypes.func;
915
- conflictOccurred(
916
- schedulerData,
917
- action,
918
- event,
919
- type,
920
- slotId,
921
- slotName,
922
- start,
923
- end
924
- );
915
+ conflictOccurred(schedulerData, action, event, type, slotId, slotName, start, end);
925
916
  ```
926
917
 
927
918
  Callback function fired when there is a conflict. This could happen when creating, resizing or moving an event, and when
@@ -931,16 +922,7 @@ Callback function fired when there is a conflict. This could happen when creatin
931
922
 
932
923
  ```js
933
924
  eventItemTemplateResolver: PropTypes.func;
934
- eventItemTemplateResolver(
935
- schedulerData,
936
- event,
937
- bgColor,
938
- isStart,
939
- isEnd,
940
- mustAddCssClass,
941
- mustBeHeight,
942
- agendaMaxEventWidth
943
- );
925
+ eventItemTemplateResolver(schedulerData, event, bgColor, isStart, isEnd, mustAddCssClass, mustBeHeight, agendaMaxEventWidth);
944
926
  ```
945
927
 
946
928
  Use this function, you can customize the event style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/customeventstyle).
@@ -949,14 +931,7 @@ Use this function, you can customize the event style. Refer to [this example](ht
949
931
 
950
932
  ```js
951
933
  eventItemPopoverTemplateResolver: PropTypes.func;
952
- eventItemPopoverTemplateResolver(
953
- schedulerData,
954
- eventItem,
955
- title,
956
- start,
957
- end,
958
- statusColor
959
- );
934
+ eventItemPopoverTemplateResolver(schedulerData, eventItem, title, start, end, statusColor);
960
935
  ```
961
936
 
962
937
  Use this function, you can customize the event's popover style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/custompopover).
@@ -974,12 +949,7 @@ Use this function, you can customize the left slot style.
974
949
 
975
950
  ```js
976
951
  nonAgendaCellHeaderTemplateResolver: PropTypes.func;
977
- nonAgendaCellHeaderTemplateResolver(
978
- schedulerData,
979
- item,
980
- formattedDateItems,
981
- style
982
- );
952
+ nonAgendaCellHeaderTemplateResolver(schedulerData, item, formattedDateItems, style);
983
953
  ```
984
954
 
985
955
  Use this function, you can customize the table header cell style. Refer to [this example](https://stephenchou1017.github.io/scheduler/#/customtableheaders).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-big-schedule",
3
- "version": "4.2.4",
3
+ "version": "4.3.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",
@@ -54,12 +54,14 @@
54
54
  "scripts": {
55
55
  "build": "node scripts/build.js",
56
56
  "start": "webpack serve --mode development --config ./webpack/webpack.dev.config.js",
57
- "clean": "rimraf ./dist && mkdir dist"
57
+ "clean": "rimraf ./dist && mkdir dist",
58
+ "lint": "eslint ./src",
59
+ "fix": "eslint ./"
58
60
  },
59
61
  "dependencies": {
60
- "@ant-design/icons": "^5.1.4",
61
- "antd": "^5.7.0",
62
- "dayjs": "^1.11.9",
62
+ "@ant-design/icons": "^5.2.6",
63
+ "antd": "^5.10.1",
64
+ "dayjs": "^1.11.10",
63
65
  "prop-types": "^15.8.1",
64
66
  "react": "^18.2.0",
65
67
  "react-dnd": "^14.0.5",
@@ -68,17 +70,25 @@
68
70
  "rrule": "^2.7.2"
69
71
  },
70
72
  "devDependencies": {
71
- "@babel/cli": "^7.22.9",
72
- "@babel/core": "^7.22.9",
73
- "@babel/preset-env": "^7.22.9",
74
- "@babel/preset-react": "^7.22.5",
73
+ "@babel/cli": "^7.23.0",
74
+ "@babel/core": "^7.23.2",
75
+ "@babel/eslint-parser": "^7.22.15",
76
+ "@babel/preset-env": "^7.23.2",
77
+ "@babel/preset-react": "^7.22.15",
75
78
  "babel-loader": "^9.1.3",
76
79
  "copy-webpack-plugin": "^11.0.0",
77
80
  "css-loader": "^6.8.1",
81
+ "eslint": "^8.51.0",
82
+ "eslint-config-airbnb": "^19.0.4",
83
+ "eslint-plugin-import": "^2.28.1",
84
+ "eslint-plugin-jsx-a11y": "^6.7.1",
85
+ "eslint-plugin-react": "^7.33.2",
86
+ "eslint-plugin-react-hooks": "^4.6.0",
87
+ "eslint-webpack-plugin": "^4.0.1",
78
88
  "fs-extra": "^11.1.1",
79
89
  "html-webpack-plugin": "^5.5.3",
80
90
  "style-loader": "^3.3.3",
81
- "webpack": "^5.88.1",
91
+ "webpack": "^5.89.0",
82
92
  "webpack-cli": "^5.1.4",
83
93
  "webpack-dev-server": "^4.15.1"
84
94
  }
@@ -1,48 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
- var _react = _interopRequireDefault(require("react"));
8
- var _propTypes = _interopRequireDefault(require("prop-types"));
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
- var AddMore = function AddMore(_ref) {
11
- var schedulerData = _ref.schedulerData,
12
- number = _ref.number,
13
- left = _ref.left,
14
- width = _ref.width,
15
- top = _ref.top,
16
- clickAction = _ref.clickAction,
17
- headerItem = _ref.headerItem;
18
- var config = schedulerData.config;
19
- var content = "+".concat(number, " more");
20
- return /*#__PURE__*/_react["default"].createElement("a", {
21
- className: "timeline-event",
22
- style: {
23
- left: left,
24
- width: width,
25
- top: top
26
- },
27
- onClick: function onClick() {
28
- return clickAction(headerItem);
29
- }
30
- }, /*#__PURE__*/_react["default"].createElement("div", {
31
- style: {
32
- height: config.eventItemHeight,
33
- color: '#999',
34
- textAlign: 'center'
35
- }
36
- }, content));
37
- };
38
- AddMore.propTypes = {
39
- schedulerData: _propTypes["default"].object.isRequired,
40
- number: _propTypes["default"].number.isRequired,
41
- left: _propTypes["default"].number.isRequired,
42
- width: _propTypes["default"].number.isRequired,
43
- top: _propTypes["default"].number.isRequired,
44
- clickAction: _propTypes["default"].func.isRequired,
45
- headerItem: _propTypes["default"].object.isRequired
46
- };
47
- var _default = AddMore;
48
- exports["default"] = _default;
@@ -1,108 +0,0 @@
1
- "use strict";
2
-
3
- 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); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _antd = require("antd");
11
- var _icons = require("@ant-design/icons");
12
- var _EventItem = _interopRequireDefault(require("./EventItem"));
13
- var _DnDSource = _interopRequireDefault(require("./DnDSource"));
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
16
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
18
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
19
- 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."); }
20
- 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); }
21
- 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; }
22
- 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; } }
23
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
- function AddMorePopover(props) {
25
- var schedulerData = props.schedulerData,
26
- headerItem = props.headerItem,
27
- left = props.left,
28
- top = props.top,
29
- height = props.height,
30
- closeAction = props.closeAction;
31
- var config = schedulerData.config,
32
- localeDayjs = schedulerData.localeDayjs;
33
- var time = headerItem.time,
34
- start = headerItem.start,
35
- end = headerItem.end,
36
- events = headerItem.events;
37
- var _useState = (0, _react.useState)(new _DnDSource["default"](function (p) {
38
- return p.eventItem;
39
- }, _EventItem["default"], schedulerData.config.dragAndDropEnabled)),
40
- _useState2 = _slicedToArray(_useState, 1),
41
- dndSource = _useState2[0];
42
- var header = localeDayjs(new Date(time)).format(config.addMorePopoverHeaderFormat);
43
- var durationStart = localeDayjs(new Date(start));
44
- var durationEnd = localeDayjs(end);
45
- var DnDEventItem = dndSource.getDragSource();
46
- var eventList = events.map(function (evt, i) {
47
- if (evt !== undefined) {
48
- var eventStart = localeDayjs(evt.eventItem.start);
49
- var eventEnd = localeDayjs(evt.eventItem.end);
50
- var isStart = eventStart >= durationStart;
51
- var isEnd = eventEnd < durationEnd;
52
- var eventItemTop = 12 + (i + 1) * config.eventItemLineHeight;
53
- return /*#__PURE__*/_react["default"].createElement(DnDEventItem, _extends({}, props, {
54
- key: evt.eventItem.id,
55
- eventItem: evt.eventItem,
56
- leftIndex: 0,
57
- isInPopover: true,
58
- isStart: isStart,
59
- isEnd: isEnd,
60
- rightIndex: 1,
61
- left: 10,
62
- width: 138,
63
- top: eventItemTop
64
- }));
65
- }
66
- return null;
67
- });
68
- return /*#__PURE__*/_react["default"].createElement("div", {
69
- className: "add-more-popover-overlay",
70
- style: {
71
- left: left,
72
- top: top,
73
- height: height,
74
- width: '170px'
75
- }
76
- }, /*#__PURE__*/_react["default"].createElement(_antd.Row, {
77
- justify: "space-between",
78
- align: "middle"
79
- }, /*#__PURE__*/_react["default"].createElement(_antd.Col, {
80
- span: 22
81
- }, /*#__PURE__*/_react["default"].createElement("span", {
82
- className: "base-text"
83
- }, header)), /*#__PURE__*/_react["default"].createElement(_antd.Col, {
84
- span: 2
85
- }, /*#__PURE__*/_react["default"].createElement("span", {
86
- onClick: function onClick() {
87
- return closeAction(undefined);
88
- }
89
- }, /*#__PURE__*/_react["default"].createElement(_icons.CloseOutlined, null)))), eventList === null || eventList === void 0 ? void 0 : eventList.filter(Boolean));
90
- }
91
- AddMorePopover.propTypes = {
92
- schedulerData: _propTypes["default"].object.isRequired,
93
- headerItem: _propTypes["default"].object.isRequired,
94
- left: _propTypes["default"].number.isRequired,
95
- top: _propTypes["default"].number.isRequired,
96
- height: _propTypes["default"].number.isRequired,
97
- closeAction: _propTypes["default"].func.isRequired,
98
- subtitleGetter: _propTypes["default"].func,
99
- moveEvent: _propTypes["default"].func,
100
- eventItemClick: _propTypes["default"].func,
101
- viewEventClick: _propTypes["default"].func,
102
- viewEventText: _propTypes["default"].string,
103
- viewEvent2Click: _propTypes["default"].func,
104
- viewEvent2Text: _propTypes["default"].string,
105
- eventItemTemplateResolver: _propTypes["default"].func
106
- };
107
- var _default = AddMorePopover;
108
- exports["default"] = _default;