react-big-schedule 7.1.1-beta.1 → 7.1.1-beta.3
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 +47 -2
- package/dist/components/HeaderView.js +43 -50
- package/dist/components/SchedulerData.js +40 -18
- package/dist/components/index.js +16 -8
- package/dist/config/default.js +2 -1
- package/dist/config/scheduler.js +4 -1
- package/dist/index.d.ts +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -260,6 +260,38 @@ constructor(date=dayjs().format(DATE_FORMAT), viewType = ViewType.Week,
|
|
|
260
260
|
- `localeDayjs` is a locale dayjs object, which is unified used in react-big-scheduler. If not provided, Scheduler will come
|
|
261
261
|
with English(en, United States) locale strings.
|
|
262
262
|
|
|
263
|
+
#### Using SchedulerData with React state
|
|
264
|
+
|
|
265
|
+
`SchedulerData` is mutable; its methods (`prev`, `next`, `setDate`, `setViewType`, `setEvents`, ...) notify the `Scheduler`, which re-renders itself. With a functional component, keep the same instance in state and call the methods in your handlers, then call `setState` with a new object only if you need the parent to re-render too:
|
|
266
|
+
|
|
267
|
+
```jsx
|
|
268
|
+
const [schedulerData, setSchedulerData] = useState(() => new SchedulerData(dayjs(), ViewType.Week));
|
|
269
|
+
|
|
270
|
+
const prevClick = data => {
|
|
271
|
+
data.prev();
|
|
272
|
+
data.setEvents(events);
|
|
273
|
+
setSchedulerData(Object.assign(Object.create(Object.getPrototypeOf(data)), data)); // optional
|
|
274
|
+
};
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### Vertical resource view
|
|
278
|
+
|
|
279
|
+
`ViewType.VerticalResource` shows resources as columns and time as rows. Events render and drag-to-create works across resources and time slots. Moving and resizing existing events by drag is not supported in this view yet (they are read-only there); use the horizontal views for that. Row height grows with the number of overlapping events, like the horizontal views. Refer to [this example](https://react-big-schedule.vercel.app/vertical-view).
|
|
280
|
+
|
|
281
|
+
#### Weekly / monthly columns
|
|
282
|
+
|
|
283
|
+
Columns are days or hours by default. A custom view (`ViewType.Custom`, `Custom1`, `Custom2`) picks its own cadence through `behaviors.getCustomDateFunc`, which returns `cellUnit: CellUnit.Week`, `CellUnit.Month`, `CellUnit.Quarter` or `CellUnit.Year` along with the date range. Events then span the week/month cells they overlap. Header text comes from `nonAgendaWeekCellHeaderFormat` / `nonAgendaMonthCellHeaderFormat` / `nonAgendaQuarterCellHeaderFormat` / `nonAgendaYearCellHeaderFormat` (use `|` to split a header into lines). Per-cell totals come from `behaviors.getSummaryFunc`. Refer to [this example](https://react-big-schedule.vercel.app/cadence).
|
|
284
|
+
|
|
285
|
+
#### Theming with antd `ConfigProvider`
|
|
286
|
+
|
|
287
|
+
The antd parts (header controls, date picker popover, event popover) pick up an antd `ConfigProvider` placed above `<Scheduler>`, so antd theme tokens apply to them. The timeline grid itself is styled by the scheduler's own CSS.
|
|
288
|
+
|
|
289
|
+
```jsx
|
|
290
|
+
<ConfigProvider theme={{ token: { colorPrimary: '#722ed1' } }}>
|
|
291
|
+
<Scheduler schedulerData={schedulerData} /* ... */ />
|
|
292
|
+
</ConfigProvider>
|
|
293
|
+
```
|
|
294
|
+
|
|
263
295
|
#### setSchedulerLocale
|
|
264
296
|
|
|
265
297
|
```js
|
|
@@ -278,6 +310,8 @@ import * as dayjsLocale from 'dayjs/locale/pt-br';
|
|
|
278
310
|
setSchedulerLocale(dayjsLocale);
|
|
279
311
|
```
|
|
280
312
|
|
|
313
|
+
The locale is kept per `SchedulerData` instance, so several schedulers (and your own dayjs usage) can use different locales without affecting each other.
|
|
314
|
+
|
|
281
315
|
By default, Scheduler comes with English(en, United States)
|
|
282
316
|
|
|
283
317
|
#### setCalendarPopoverLocale
|
|
@@ -570,7 +604,7 @@ Used to resolve the locale string of date label of Scheduler component.(Refer to
|
|
|
570
604
|
The width of Scheduler. Scheduler uses responsive layout so schedulerWidth should be a percentage.
|
|
571
605
|
|
|
572
606
|
The Scheduler renders inside a container that is `width: 100%` and `max-height: 100%` of its parent, so it fills the parent
|
|
573
|
-
and follows it when resized (it measures that container with a `ResizeObserver
|
|
607
|
+
and follows it when resized (it measures that container with a `ResizeObserver`).
|
|
574
608
|
Resource columns keep their configured width and the time columns stretch to fill the rest.
|
|
575
609
|
|
|
576
610
|
To size it differently, pass `className` (e.g. tailwind classes) or `style` to the `Scheduler` component, for example
|
|
@@ -987,7 +1021,18 @@ slotItemTemplateResolver: PropTypes.func;
|
|
|
987
1021
|
slotItemTemplateResolver(schedulerData, slot, slotClickedFunc, width, clsName);
|
|
988
1022
|
```
|
|
989
1023
|
|
|
990
|
-
Use this function, you can customize the left slot style.
|
|
1024
|
+
Use this function, you can customize the left slot style. The returned element is rendered inside the resource cell, so a resource name can be any React node:
|
|
1025
|
+
|
|
1026
|
+
```jsx
|
|
1027
|
+
<Scheduler
|
|
1028
|
+
schedulerData={schedulerData}
|
|
1029
|
+
slotItemTemplateResolver={(schedulerData, slot, slotClickedFunc, width, clsName) => (
|
|
1030
|
+
<div className={clsName} style={{ width }} onClick={() => slotClickedFunc?.(schedulerData, slot)}>
|
|
1031
|
+
<Avatar size="small" src={slot.avatar} /> <b>{slot.slotName}</b>
|
|
1032
|
+
</div>
|
|
1033
|
+
)}
|
|
1034
|
+
/>
|
|
1035
|
+
```
|
|
991
1036
|
|
|
992
1037
|
#### nonAgendaCellHeaderTemplateResolver
|
|
993
1038
|
|
|
@@ -11,7 +11,7 @@ import { CellUnit } from '../config/default';
|
|
|
11
11
|
* @returns {JSX.Element} A <thead> element containing the optional week-number row and the
|
|
12
12
|
* main header row for the scheduler table.
|
|
13
13
|
*/
|
|
14
|
-
import {
|
|
14
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
function HeaderView({
|
|
16
16
|
schedulerData,
|
|
17
17
|
nonAgendaCellHeaderTemplateResolver
|
|
@@ -24,49 +24,27 @@ function HeaderView({
|
|
|
24
24
|
} = schedulerData;
|
|
25
25
|
const {
|
|
26
26
|
showWeekNumber,
|
|
27
|
-
weekNumberRowHeight = 24
|
|
27
|
+
weekNumberRowHeight = 24,
|
|
28
|
+
showMonthRow,
|
|
29
|
+
monthRowHeight = 24
|
|
28
30
|
} = config;
|
|
29
31
|
const headerHeight = schedulerData.getTableHeaderHeight();
|
|
30
32
|
const cellWidth = schedulerData.getContentCellWidth();
|
|
31
33
|
const minuteStepsInHour = schedulerData.getMinuteStepsInHour();
|
|
32
34
|
|
|
33
|
-
//
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
const weekGroups = [];
|
|
37
|
-
let currentWeekKey = null;
|
|
38
|
-
let currentWeek = null;
|
|
39
|
-
let currentYear = null;
|
|
40
|
-
let colspan = 0;
|
|
35
|
+
// Group consecutive headers sharing a key into spanning <th>s (week number row, month row)
|
|
36
|
+
const buildGroupRow = useCallback((keyOf, labelOf, stickyLabel = false) => {
|
|
37
|
+
const groups = [];
|
|
41
38
|
headers.forEach(item => {
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
weekGroups.push({
|
|
50
|
-
week: currentWeek,
|
|
51
|
-
year: currentYear,
|
|
52
|
-
colspan
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
currentWeekKey = weekKey;
|
|
56
|
-
currentWeek = weekNum;
|
|
57
|
-
currentYear = year;
|
|
58
|
-
colspan = 1;
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// Push the last week group
|
|
63
|
-
if (currentWeekKey !== null) {
|
|
64
|
-
weekGroups.push({
|
|
65
|
-
week: currentWeek,
|
|
66
|
-
year: currentYear,
|
|
67
|
-
colspan
|
|
39
|
+
const d = localeDayjs(new Date(item.time));
|
|
40
|
+
const key = keyOf(d);
|
|
41
|
+
const last = groups[groups.length - 1];
|
|
42
|
+
if (last && last.key === key) last.colspan += 1;else groups.push({
|
|
43
|
+
key,
|
|
44
|
+
label: labelOf(d),
|
|
45
|
+
colspan: 1
|
|
68
46
|
});
|
|
69
|
-
}
|
|
47
|
+
});
|
|
70
48
|
const cellStyle = {
|
|
71
49
|
fontSize: '0.85em',
|
|
72
50
|
opacity: 0.7,
|
|
@@ -74,19 +52,28 @@ function HeaderView({
|
|
|
74
52
|
padding: '4px 8px',
|
|
75
53
|
textAlign: 'center'
|
|
76
54
|
};
|
|
77
|
-
return
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
55
|
+
return groups.map(group => /*#__PURE__*/_jsx("th", {
|
|
56
|
+
colSpan: group.colspan,
|
|
57
|
+
style: {
|
|
58
|
+
...cellStyle,
|
|
59
|
+
...(stickyLabel && {
|
|
60
|
+
textAlign: 'left'
|
|
61
|
+
}),
|
|
62
|
+
width: group.colspan * cellWidth,
|
|
63
|
+
minWidth: group.colspan * cellWidth
|
|
64
|
+
},
|
|
65
|
+
children: stickyLabel ? /*#__PURE__*/_jsx("span", {
|
|
81
66
|
style: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
minWidth: group.colspan * cellWidth
|
|
67
|
+
position: 'sticky',
|
|
68
|
+
left: 8
|
|
85
69
|
},
|
|
86
|
-
children:
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}, [
|
|
70
|
+
children: group.label
|
|
71
|
+
}) : group.label
|
|
72
|
+
}, group.key));
|
|
73
|
+
}, [headers, localeDayjs, config.headerBorderColor, cellWidth]);
|
|
74
|
+
const isGrouped = !schedulerData.isVerticalResourceView();
|
|
75
|
+
const weekNumberRow = useMemo(() => showWeekNumber && isGrouped ? buildGroupRow(d => `w-${d.year()}-${d.isoWeek()}`, d => `W${d.isoWeek()}`) : null, [showWeekNumber, isGrouped, buildGroupRow]);
|
|
76
|
+
const monthRow = useMemo(() => showMonthRow && isGrouped ? buildGroupRow(d => `m-${d.year()}-${d.month()}`, d => d.format('MMMM YYYY'), true) : null, [showMonthRow, isGrouped, buildGroupRow]);
|
|
90
77
|
|
|
91
78
|
// Extract common style creation logic
|
|
92
79
|
const createCellStyle = useCallback((item, width, isLastCell) => {
|
|
@@ -110,7 +97,8 @@ function HeaderView({
|
|
|
110
97
|
const formatMap = {
|
|
111
98
|
[CellUnit.Week]: config.nonAgendaWeekCellHeaderFormat,
|
|
112
99
|
[CellUnit.Month]: config.nonAgendaMonthCellHeaderFormat,
|
|
113
|
-
[CellUnit.Year]: config.nonAgendaYearCellHeaderFormat
|
|
100
|
+
[CellUnit.Year]: config.nonAgendaYearCellHeaderFormat,
|
|
101
|
+
[CellUnit.Quarter]: config.nonAgendaQuarterCellHeaderFormat
|
|
114
102
|
};
|
|
115
103
|
return formatMap[cellUnitParam] || config.nonAgendaOtherCellHeaderFormat;
|
|
116
104
|
}, [config]);
|
|
@@ -176,7 +164,12 @@ function HeaderView({
|
|
|
176
164
|
});
|
|
177
165
|
}, [cellUnit, headers, minuteStepsInHour, cellWidth, config, localeDayjs, createCellStyle, getCellFormat, renderCellContent, schedulerData.isVerticalResourceView]);
|
|
178
166
|
return /*#__PURE__*/_jsxs("thead", {
|
|
179
|
-
children: [
|
|
167
|
+
children: [monthRow && /*#__PURE__*/_jsx("tr", {
|
|
168
|
+
style: {
|
|
169
|
+
height: monthRowHeight
|
|
170
|
+
},
|
|
171
|
+
children: monthRow
|
|
172
|
+
}), weekNumberRow && /*#__PURE__*/_jsx("tr", {
|
|
180
173
|
style: {
|
|
181
174
|
height: weekNumberRowHeight
|
|
182
175
|
},
|
|
@@ -23,8 +23,6 @@ export default class SchedulerData {
|
|
|
23
23
|
this.scrollToSpecialDayjs = false;
|
|
24
24
|
this.documentWidth = 0;
|
|
25
25
|
this.documentHeight = 0;
|
|
26
|
-
// true once the scheduler measures its own container, so besidesWidth (a window-based offset) is not applied
|
|
27
|
-
this.measuredByContainer = false;
|
|
28
26
|
this.schedulerHeaderHeight = 0;
|
|
29
27
|
this._shouldReloadViewType = false;
|
|
30
28
|
this.version = 0;
|
|
@@ -35,7 +33,7 @@ export default class SchedulerData {
|
|
|
35
33
|
dayjs.extend(weekday);
|
|
36
34
|
dayjs.extend(utc);
|
|
37
35
|
dayjs.extend(isoWeek);
|
|
38
|
-
this.localeDayjs =
|
|
36
|
+
this.localeDayjs = this._createLocaleDayjs();
|
|
39
37
|
this.config = newConfig === undefined ? config : {
|
|
40
38
|
...config,
|
|
41
39
|
...newConfig
|
|
@@ -51,6 +49,23 @@ export default class SchedulerData {
|
|
|
51
49
|
this._createRenderData();
|
|
52
50
|
}
|
|
53
51
|
|
|
52
|
+
// Per-instance dayjs: the locale is applied to each created date instead of the global dayjs
|
|
53
|
+
// singleton, so schedulers (and the host app) don't overwrite each other's locale (#146).
|
|
54
|
+
_createLocaleDayjs() {
|
|
55
|
+
let locale;
|
|
56
|
+
const localeDayjs = (...args) => {
|
|
57
|
+
const d = dayjs(...args);
|
|
58
|
+
return locale ? d.locale(locale) : d;
|
|
59
|
+
};
|
|
60
|
+
localeDayjs.locale = preset => {
|
|
61
|
+
if (preset === undefined) return locale || dayjs.locale();
|
|
62
|
+
// dayjs accepts a locale name or a locale object; resolve (and register) it once to a name
|
|
63
|
+
locale = dayjs().locale(preset).locale();
|
|
64
|
+
return localeDayjs;
|
|
65
|
+
};
|
|
66
|
+
return localeDayjs;
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
/**
|
|
55
70
|
* Update user-facing labels from the i18n provider
|
|
56
71
|
* This allows apps to provide localized labels via setLabelsProvider()
|
|
@@ -152,12 +167,6 @@ export default class SchedulerData {
|
|
|
152
167
|
this.bumpVersion();
|
|
153
168
|
}
|
|
154
169
|
}
|
|
155
|
-
setBesidesWidth(besidesWidth) {
|
|
156
|
-
if (besidesWidth >= 0 && this.config.besidesWidth !== besidesWidth) {
|
|
157
|
-
this.config.besidesWidth = besidesWidth;
|
|
158
|
-
this.bumpVersion();
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
170
|
setUnderneathHeight(underneathHeight) {
|
|
162
171
|
if (underneathHeight >= 0 && this.config.underneathHeight !== underneathHeight) {
|
|
163
172
|
this.config.underneathHeight = underneathHeight;
|
|
@@ -372,8 +381,7 @@ export default class SchedulerData {
|
|
|
372
381
|
return !!contentCellWidth.endsWith && contentCellWidth.endsWith('%');
|
|
373
382
|
}
|
|
374
383
|
getSchedulerWidth() {
|
|
375
|
-
const
|
|
376
|
-
const baseWidth = this.documentWidth - besidesWidth > 0 ? this.documentWidth - besidesWidth : 0;
|
|
384
|
+
const baseWidth = this.documentWidth > 0 ? this.documentWidth : 0;
|
|
377
385
|
return this.isSchedulerResponsive() ? parseInt(baseWidth * Number(this.config.schedulerWidth.slice(0, -1)) / 100, 10) : this.config.schedulerWidth;
|
|
378
386
|
}
|
|
379
387
|
getSchedulerHeight() {
|
|
@@ -439,6 +447,17 @@ export default class SchedulerData {
|
|
|
439
447
|
});
|
|
440
448
|
return resource;
|
|
441
449
|
}
|
|
450
|
+
|
|
451
|
+
// height of the optional group rows (month / week number) rendered above the main header row
|
|
452
|
+
getHeaderGroupRowsHeight() {
|
|
453
|
+
const {
|
|
454
|
+
showMonthRow,
|
|
455
|
+
monthRowHeight = 24,
|
|
456
|
+
showWeekNumber,
|
|
457
|
+
weekNumberRowHeight = 24
|
|
458
|
+
} = this.config;
|
|
459
|
+
return (showMonthRow ? monthRowHeight : 0) + (showWeekNumber ? weekNumberRowHeight : 0);
|
|
460
|
+
}
|
|
442
461
|
getTableHeaderHeight() {
|
|
443
462
|
return this.config.tableHeaderHeight;
|
|
444
463
|
}
|
|
@@ -613,12 +632,6 @@ export default class SchedulerData {
|
|
|
613
632
|
const configProperty = viewConfigMap[this.viewType] || 'customCellWidth';
|
|
614
633
|
return this.config[configProperty];
|
|
615
634
|
}
|
|
616
|
-
_setMeasuredByContainer(measuredByContainer) {
|
|
617
|
-
if (this.measuredByContainer !== measuredByContainer) {
|
|
618
|
-
this.measuredByContainer = measuredByContainer;
|
|
619
|
-
this.bumpVersion();
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
635
|
_setDocumentWidth(documentWidth) {
|
|
623
636
|
if (documentWidth >= 0 && documentWidth !== this.documentWidth) {
|
|
624
637
|
this.documentWidth = documentWidth;
|
|
@@ -829,6 +842,14 @@ export default class SchedulerData {
|
|
|
829
842
|
});
|
|
830
843
|
header = header.add(1, 'months').startOf('month');
|
|
831
844
|
}
|
|
845
|
+
} else if (this.cellUnit === CellUnit.Quarter) {
|
|
846
|
+
while (header >= start && header <= end) {
|
|
847
|
+
const time = header.format(DATE_FORMAT);
|
|
848
|
+
timeSlots.push({
|
|
849
|
+
time
|
|
850
|
+
});
|
|
851
|
+
header = header.add(1, 'quarters').startOf('quarter');
|
|
852
|
+
}
|
|
832
853
|
} else if (this.cellUnit === CellUnit.Year) {
|
|
833
854
|
while (header >= start && header <= end) {
|
|
834
855
|
const time = header.format(DATE_FORMAT);
|
|
@@ -1029,7 +1050,8 @@ export default class SchedulerData {
|
|
|
1029
1050
|
[CellUnit.Hour]: 'minutes',
|
|
1030
1051
|
[CellUnit.Week]: 'weeks',
|
|
1031
1052
|
[CellUnit.Month]: 'months',
|
|
1032
|
-
[CellUnit.Year]: 'years'
|
|
1053
|
+
[CellUnit.Year]: 'years',
|
|
1054
|
+
[CellUnit.Quarter]: 'quarters'
|
|
1033
1055
|
}[this.cellUnit] || 'days';
|
|
1034
1056
|
return {
|
|
1035
1057
|
amount: unit === 'minutes' ? this.config.minuteStep : 1,
|
package/dist/components/index.js
CHANGED
|
@@ -135,7 +135,6 @@ function Scheduler(props) {
|
|
|
135
135
|
const update = () => {
|
|
136
136
|
schedulerData.beginBatch();
|
|
137
137
|
try {
|
|
138
|
-
schedulerData._setMeasuredByContainer(true);
|
|
139
138
|
schedulerData._setDocumentWidth(widthEl.clientWidth);
|
|
140
139
|
if (responsiveByParent) {
|
|
141
140
|
schedulerData._setDocumentHeight(parentEl ? getInnerHeight(parentEl) : document.documentElement.clientHeight);
|
|
@@ -160,7 +159,7 @@ function Scheduler(props) {
|
|
|
160
159
|
const updateHeaderHeight = node => {
|
|
161
160
|
const rect = node.getBoundingClientRect();
|
|
162
161
|
const style = window.getComputedStyle(node);
|
|
163
|
-
const totalHeight = rect.height + (parseFloat(style.marginTop) || 0) + (parseFloat(style.marginBottom) || 0) +
|
|
162
|
+
const totalHeight = rect.height + (parseFloat(style.marginTop) || 0) + (parseFloat(style.marginBottom) || 0) + schedulerData.getHeaderGroupRowsHeight();
|
|
164
163
|
schedulerData._setSchedulerHeaderHeight(totalHeight);
|
|
165
164
|
};
|
|
166
165
|
updateHeaderHeight(schedulerHeaderEl);
|
|
@@ -176,7 +175,7 @@ function Scheduler(props) {
|
|
|
176
175
|
}
|
|
177
176
|
};
|
|
178
177
|
}
|
|
179
|
-
}, [schedulerHeaderEl, schedulerData, schedulerData.config.showWeekNumber, schedulerData.config.weekNumberRowHeight]);
|
|
178
|
+
}, [schedulerHeaderEl, schedulerData, schedulerData.config.showWeekNumber, schedulerData.config.weekNumberRowHeight, schedulerData.config.showMonthRow, schedulerData.config.monthRowHeight]);
|
|
180
179
|
const resolveScrollbarSize = useCallback(() => {
|
|
181
180
|
const prev = scrollbarSizeRef.current;
|
|
182
181
|
const newContentHeight = schedulerContentRef.current ? schedulerContentRef.current.offsetHeight - schedulerContentRef.current.clientHeight : 17;
|
|
@@ -302,7 +301,9 @@ function Scheduler(props) {
|
|
|
302
301
|
const width = schedulerData.getSchedulerWidth();
|
|
303
302
|
const {
|
|
304
303
|
showWeekNumber,
|
|
305
|
-
weekNumberRowHeight
|
|
304
|
+
weekNumberRowHeight,
|
|
305
|
+
showMonthRow,
|
|
306
|
+
monthRowHeight
|
|
306
307
|
} = config;
|
|
307
308
|
const schedulerDataVersion = schedulerData.getVersion ? schedulerData.getVersion() : 0;
|
|
308
309
|
const schedulerWidth = schedulerData.getContentTableWidth();
|
|
@@ -407,7 +408,7 @@ function Scheduler(props) {
|
|
|
407
408
|
margin: `0px -${contentScrollbarWidth}px 0px 0px`
|
|
408
409
|
};
|
|
409
410
|
if (config.schedulerMaxHeight > 0) {
|
|
410
|
-
const totalHeaderHeight = config.tableHeaderHeight + (
|
|
411
|
+
const totalHeaderHeight = config.tableHeaderHeight + schedulerData.getHeaderGroupRowsHeight();
|
|
411
412
|
schedulerContentStyle = {
|
|
412
413
|
...schedulerContentStyle,
|
|
413
414
|
maxHeight: config.schedulerMaxHeight - totalHeaderHeight
|
|
@@ -435,7 +436,7 @@ function Scheduler(props) {
|
|
|
435
436
|
};
|
|
436
437
|
const resourceHeaderStyle = {
|
|
437
438
|
borderBottom: `1px solid ${config.headerBorderColor ?? '#e9e9e9'}`,
|
|
438
|
-
height: config.tableHeaderHeight + (
|
|
439
|
+
height: config.tableHeaderHeight + schedulerData.getHeaderGroupRowsHeight(),
|
|
439
440
|
...configTableHeaderStyle
|
|
440
441
|
};
|
|
441
442
|
const resourceHeaderScrollStyle = {
|
|
@@ -452,7 +453,7 @@ function Scheduler(props) {
|
|
|
452
453
|
const schedulerHeadWrapperStyle = {
|
|
453
454
|
overflow: 'hidden',
|
|
454
455
|
borderBottom: `1px solid ${config.headerBorderColor ?? '#e9e9e9'}`,
|
|
455
|
-
height: config.tableHeaderHeight + (
|
|
456
|
+
height: config.tableHeaderHeight + schedulerData.getHeaderGroupRowsHeight()
|
|
456
457
|
};
|
|
457
458
|
const schedulerHeadScrollStyle = {
|
|
458
459
|
overflowX: 'scroll',
|
|
@@ -475,7 +476,14 @@ function Scheduler(props) {
|
|
|
475
476
|
children: /*#__PURE__*/_jsx("table", {
|
|
476
477
|
className: "resource-table",
|
|
477
478
|
children: /*#__PURE__*/_jsxs("thead", {
|
|
478
|
-
children: [
|
|
479
|
+
children: [showMonthRow && /*#__PURE__*/_jsx("tr", {
|
|
480
|
+
style: {
|
|
481
|
+
height: monthRowHeight
|
|
482
|
+
},
|
|
483
|
+
children: /*#__PURE__*/_jsx("th", {
|
|
484
|
+
style: weekNumberThStyle
|
|
485
|
+
})
|
|
486
|
+
}), showWeekNumber && /*#__PURE__*/_jsx("tr", {
|
|
479
487
|
style: weekNumberRowStyle,
|
|
480
488
|
children: /*#__PURE__*/_jsx("th", {
|
|
481
489
|
style: weekNumberThStyle,
|
package/dist/config/default.js
CHANGED
package/dist/config/scheduler.js
CHANGED
|
@@ -11,7 +11,6 @@ import { SummaryPos, ViewType } from './default';
|
|
|
11
11
|
*/
|
|
12
12
|
export default {
|
|
13
13
|
schedulerWidth: '100%',
|
|
14
|
-
besidesWidth: 20,
|
|
15
14
|
underneathHeight: 20,
|
|
16
15
|
schedulerMaxHeight: 0,
|
|
17
16
|
tableHeaderHeight: 40,
|
|
@@ -56,6 +55,9 @@ export default {
|
|
|
56
55
|
headerBorderColor: '#e9e9e9',
|
|
57
56
|
weekNumberRowHeight: 24,
|
|
58
57
|
showWeekNumber: false,
|
|
58
|
+
// month row above the day cells (month names spanning their days), like the week number row
|
|
59
|
+
showMonthRow: false,
|
|
60
|
+
monthRowHeight: 24,
|
|
59
61
|
startResizable: true,
|
|
60
62
|
endResizable: true,
|
|
61
63
|
movable: true,
|
|
@@ -86,6 +88,7 @@ export default {
|
|
|
86
88
|
nonAgendaWeekCellHeaderFormat: 'ww/YYYY',
|
|
87
89
|
nonAgendaMonthCellHeaderFormat: 'MMM YYYY',
|
|
88
90
|
nonAgendaYearCellHeaderFormat: 'YYYY',
|
|
91
|
+
nonAgendaQuarterCellHeaderFormat: '[Q]Q YYYY',
|
|
89
92
|
nonAgendaOtherCellHeaderFormat: 'ddd M/D',
|
|
90
93
|
minuteStep: 30,
|
|
91
94
|
views: [{
|
package/dist/index.d.ts
CHANGED
|
@@ -233,6 +233,10 @@ export class DnDSource {
|
|
|
233
233
|
export enum CellUnit {
|
|
234
234
|
Day,
|
|
235
235
|
Hour,
|
|
236
|
+
Week,
|
|
237
|
+
Month,
|
|
238
|
+
Year,
|
|
239
|
+
Quarter,
|
|
236
240
|
}
|
|
237
241
|
|
|
238
242
|
export enum ViewType {
|
|
@@ -330,8 +334,6 @@ export interface State<EventType extends EventItem = EventItem> {
|
|
|
330
334
|
|
|
331
335
|
export interface SchedulerDataConfig {
|
|
332
336
|
schedulerWidth?: `${number}%`;
|
|
333
|
-
/** @deprecated The scheduler measures its own container now, so this offset is ignored. */
|
|
334
|
-
besidesWidth?: number;
|
|
335
337
|
underneathHeight?: number;
|
|
336
338
|
schedulerMaxHeight?: number;
|
|
337
339
|
tableHeaderHeight?: number;
|
|
@@ -419,6 +421,8 @@ export interface SchedulerDataConfig {
|
|
|
419
421
|
responsiveByParent?: boolean;
|
|
420
422
|
showWeekNumber?: boolean;
|
|
421
423
|
weekNumberRowHeight?: number;
|
|
424
|
+
showMonthRow?: boolean;
|
|
425
|
+
monthRowHeight?: number;
|
|
422
426
|
weekNumberLabel?: string;
|
|
423
427
|
headerBorderColor?: string;
|
|
424
428
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-big-schedule",
|
|
3
|
-
"version": "7.1.1-beta.
|
|
3
|
+
"version": "7.1.1-beta.3",
|
|
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",
|