react-big-schedule 5.5.2-beta.4 → 6.0.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
|
@@ -1,20 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { MinusSquareOutlined, PlusSquareOutlined } from '@ant-design/icons';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import React from 'react';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports["default"] = void 0;
|
|
7
|
-
var _icons = require("@ant-design/icons");
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
12
|
-
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); }
|
|
13
|
-
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; }
|
|
14
|
-
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; }
|
|
15
|
-
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; }
|
|
16
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
17
|
-
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); } /**
|
|
5
|
+
/**
|
|
18
6
|
* Render the scheduler's resource table with hierarchical indentation, optional expand/collapse controls,
|
|
19
7
|
* clickable slot names, and support for custom slot templates or an injected resource-cell renderer.
|
|
20
8
|
*
|
|
@@ -31,63 +19,67 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
31
19
|
* `<td>` when provided; receives props `{ schedulerData, item, indents, slotClickedFunc, handleToggleExpand }`.
|
|
32
20
|
* @returns {JSX.Element} The rendered resource table element.
|
|
33
21
|
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
22
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
|
+
function ResourceView({
|
|
24
|
+
schedulerData,
|
|
25
|
+
contentScrollbarHeight,
|
|
26
|
+
slotClickedFunc,
|
|
27
|
+
slotItemTemplateResolver,
|
|
28
|
+
toggleExpandFunc,
|
|
29
|
+
CustomResourceCell,
|
|
30
|
+
isSelecting,
|
|
31
|
+
selectedResourceIds
|
|
32
|
+
}) {
|
|
33
|
+
const {
|
|
34
|
+
renderData
|
|
35
|
+
} = schedulerData;
|
|
36
|
+
const width = schedulerData.getResourceTableWidth() - 2;
|
|
37
|
+
const paddingBottom = contentScrollbarHeight;
|
|
38
|
+
const displayRenderData = renderData.filter(o => o.render);
|
|
39
|
+
const handleToggleExpand = item => {
|
|
50
40
|
if (toggleExpandFunc) {
|
|
51
41
|
toggleExpandFunc(schedulerData, item.slotId);
|
|
52
42
|
}
|
|
53
43
|
};
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
const renderSlotItem = (item, indents) => {
|
|
45
|
+
let indent = /*#__PURE__*/_jsx("span", {
|
|
56
46
|
className: "expander-space"
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
onClick:
|
|
60
|
-
return handleToggleExpand(item);
|
|
61
|
-
}
|
|
47
|
+
}, `es${item.indent}`);
|
|
48
|
+
const iconProps = {
|
|
49
|
+
onClick: () => handleToggleExpand(item)
|
|
62
50
|
};
|
|
63
51
|
if (item.hasChildren) {
|
|
64
|
-
indent = item.expanded ? /*#__PURE__*/(
|
|
52
|
+
indent = item.expanded ? /*#__PURE__*/_jsx(MinusSquareOutlined, {
|
|
53
|
+
...iconProps
|
|
54
|
+
}, `es${item.indent}`) : /*#__PURE__*/_jsx(PlusSquareOutlined, {
|
|
55
|
+
...iconProps
|
|
56
|
+
}, `es${item.indent}`);
|
|
65
57
|
}
|
|
66
58
|
indents.push(indent);
|
|
67
|
-
|
|
59
|
+
const tdStyle = {
|
|
68
60
|
height: item.rowHeight,
|
|
69
61
|
backgroundColor: item.groupOnly ? schedulerData.config.groupOnlySlotColor : undefined,
|
|
70
62
|
borderLeft: '3px solid transparent'
|
|
71
63
|
};
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
const selectedBorderColor = schedulerData.config.selectedSlotBorderColor || '#1677ff';
|
|
65
|
+
const selectedShadowColor = schedulerData.config.selectedSlotShadowColor || '#91caff';
|
|
66
|
+
const selectedSlotColor = schedulerData.config.selectedSlotColor || '#e6f4ff';
|
|
67
|
+
const hasSelectedResourceId = selectedResourceIds instanceof Set ? selectedResourceIds.has(item.slotId) : Array.isArray(selectedResourceIds) && selectedResourceIds.includes(item.slotId);
|
|
68
|
+
const isRowSelected = isSelecting && hasSelectedResourceId;
|
|
77
69
|
if (isRowSelected) {
|
|
78
|
-
tdStyle.borderLeft =
|
|
79
|
-
tdStyle.boxShadow =
|
|
70
|
+
tdStyle.borderLeft = `3px solid ${selectedBorderColor}`;
|
|
71
|
+
tdStyle.boxShadow = `inset 0 0 0 1px ${selectedShadowColor}`;
|
|
80
72
|
if (!item.groupOnly) {
|
|
81
73
|
tdStyle.backgroundColor = selectedSlotColor;
|
|
82
74
|
}
|
|
83
75
|
}
|
|
84
76
|
if (CustomResourceCell) {
|
|
85
|
-
return /*#__PURE__*/(
|
|
77
|
+
return /*#__PURE__*/_jsx("tr", {
|
|
86
78
|
"aria-selected": isRowSelected,
|
|
87
|
-
children: /*#__PURE__*/(
|
|
79
|
+
children: /*#__PURE__*/_jsx("td", {
|
|
88
80
|
"data-resource-id": item.slotId,
|
|
89
81
|
style: tdStyle,
|
|
90
|
-
children: /*#__PURE__*/(
|
|
82
|
+
children: /*#__PURE__*/_jsx(CustomResourceCell, {
|
|
91
83
|
schedulerData: schedulerData,
|
|
92
84
|
item: item,
|
|
93
85
|
indents: indents,
|
|
@@ -97,22 +89,20 @@ function ResourceView(_ref) {
|
|
|
97
89
|
})
|
|
98
90
|
}, item.slotId);
|
|
99
91
|
}
|
|
100
|
-
|
|
92
|
+
const slotCell = slotClickedFunc ? /*#__PURE__*/_jsxs("span", {
|
|
101
93
|
className: "slot-cell",
|
|
102
|
-
children: [indents, /*#__PURE__*/(
|
|
94
|
+
children: [indents, /*#__PURE__*/_jsx("button", {
|
|
103
95
|
type: "button",
|
|
104
96
|
style: {
|
|
105
97
|
cursor: 'pointer'
|
|
106
98
|
},
|
|
107
99
|
className: "slot-text rbs-txt-btn-dis",
|
|
108
|
-
onClick:
|
|
109
|
-
return slotClickedFunc(schedulerData, item);
|
|
110
|
-
},
|
|
100
|
+
onClick: () => slotClickedFunc(schedulerData, item),
|
|
111
101
|
children: item.slotName
|
|
112
102
|
})]
|
|
113
|
-
}) : /*#__PURE__*/(
|
|
103
|
+
}) : /*#__PURE__*/_jsxs("span", {
|
|
114
104
|
className: "slot-cell",
|
|
115
|
-
children: [indents, /*#__PURE__*/(
|
|
105
|
+
children: [indents, /*#__PURE__*/_jsx("button", {
|
|
116
106
|
type: "button",
|
|
117
107
|
className: "slot-text rbs-txt-btn-dis",
|
|
118
108
|
style: {
|
|
@@ -121,7 +111,7 @@ function ResourceView(_ref) {
|
|
|
121
111
|
children: item.slotName
|
|
122
112
|
})]
|
|
123
113
|
});
|
|
124
|
-
|
|
114
|
+
let slotItem = /*#__PURE__*/_jsx("div", {
|
|
125
115
|
title: item.slotTitle || item.slotName,
|
|
126
116
|
className: "overflow-text header2-text",
|
|
127
117
|
style: {
|
|
@@ -130,50 +120,50 @@ function ResourceView(_ref) {
|
|
|
130
120
|
children: slotCell
|
|
131
121
|
});
|
|
132
122
|
if (slotItemTemplateResolver) {
|
|
133
|
-
|
|
123
|
+
const resolvedTemplate = slotItemTemplateResolver(schedulerData, item, slotClickedFunc, width, 'overflow-text header2-text');
|
|
134
124
|
if (resolvedTemplate) {
|
|
135
125
|
slotItem = resolvedTemplate;
|
|
136
126
|
}
|
|
137
127
|
}
|
|
138
|
-
return /*#__PURE__*/(
|
|
128
|
+
return /*#__PURE__*/_jsx("tr", {
|
|
139
129
|
"aria-selected": isRowSelected,
|
|
140
|
-
children: /*#__PURE__*/(
|
|
130
|
+
children: /*#__PURE__*/_jsx("td", {
|
|
141
131
|
"data-resource-id": item.slotId,
|
|
142
132
|
style: tdStyle,
|
|
143
133
|
children: slotItem
|
|
144
134
|
})
|
|
145
135
|
}, item.slotId);
|
|
146
136
|
};
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
for (
|
|
150
|
-
indents.push(/*#__PURE__*/(
|
|
137
|
+
const resourceList = displayRenderData.map(item => {
|
|
138
|
+
const indents = [];
|
|
139
|
+
for (let i = 0; i < item.indent; i += 1) {
|
|
140
|
+
indents.push(/*#__PURE__*/_jsx("span", {
|
|
151
141
|
className: "expander-space"
|
|
152
|
-
},
|
|
142
|
+
}, `es${i}`));
|
|
153
143
|
}
|
|
154
144
|
return renderSlotItem(item, indents);
|
|
155
145
|
});
|
|
156
|
-
return /*#__PURE__*/(
|
|
146
|
+
return /*#__PURE__*/_jsx("section", {
|
|
157
147
|
style: {
|
|
158
|
-
paddingBottom
|
|
148
|
+
paddingBottom
|
|
159
149
|
},
|
|
160
|
-
children: /*#__PURE__*/(
|
|
150
|
+
children: /*#__PURE__*/_jsx("table", {
|
|
161
151
|
className: "resource-table",
|
|
162
|
-
children: /*#__PURE__*/(
|
|
152
|
+
children: /*#__PURE__*/_jsx("tbody", {
|
|
163
153
|
children: resourceList
|
|
164
154
|
})
|
|
165
155
|
})
|
|
166
156
|
});
|
|
167
157
|
}
|
|
168
158
|
ResourceView.propTypes = {
|
|
169
|
-
schedulerData:
|
|
170
|
-
schedulerDataVersion:
|
|
171
|
-
contentScrollbarHeight:
|
|
172
|
-
slotClickedFunc:
|
|
173
|
-
slotItemTemplateResolver:
|
|
174
|
-
toggleExpandFunc:
|
|
175
|
-
CustomResourceCell:
|
|
176
|
-
isSelecting:
|
|
177
|
-
selectedResourceIds:
|
|
159
|
+
schedulerData: PropTypes.object.isRequired,
|
|
160
|
+
schedulerDataVersion: PropTypes.number,
|
|
161
|
+
contentScrollbarHeight: PropTypes.number.isRequired,
|
|
162
|
+
slotClickedFunc: PropTypes.func,
|
|
163
|
+
slotItemTemplateResolver: PropTypes.func,
|
|
164
|
+
toggleExpandFunc: PropTypes.func,
|
|
165
|
+
CustomResourceCell: PropTypes.func,
|
|
166
|
+
isSelecting: PropTypes.bool,
|
|
167
|
+
selectedResourceIds: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number])), PropTypes.instanceOf(Set)])
|
|
178
168
|
};
|
|
179
|
-
|
|
169
|
+
export default /*#__PURE__*/React.memo(ResourceView);
|