react-big-schedule 7.1.1-beta.2 → 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 CHANGED
@@ -274,6 +274,14 @@ const prevClick = data => {
274
274
  };
275
275
  ```
276
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
+
277
285
  #### Theming with antd `ConfigProvider`
278
286
 
279
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.
@@ -596,7 +604,7 @@ Used to resolve the locale string of date label of Scheduler component.(Refer to
596
604
  The width of Scheduler. Scheduler uses responsive layout so schedulerWidth should be a percentage.
597
605
 
598
606
  The Scheduler renders inside a container that is `width: 100%` and `max-height: 100%` of its parent, so it fills the parent
599
- and follows it when resized (it measures that container with a `ResizeObserver`; `besidesWidth` is no longer needed).
607
+ and follows it when resized (it measures that container with a `ResizeObserver`).
600
608
  Resource columns keep their configured width and the time columns stretch to fill the rest.
601
609
 
602
610
  To size it differently, pass `className` (e.g. tailwind classes) or `style` to the `Scheduler` component, for example
@@ -97,7 +97,8 @@ function HeaderView({
97
97
  const formatMap = {
98
98
  [CellUnit.Week]: config.nonAgendaWeekCellHeaderFormat,
99
99
  [CellUnit.Month]: config.nonAgendaMonthCellHeaderFormat,
100
- [CellUnit.Year]: config.nonAgendaYearCellHeaderFormat
100
+ [CellUnit.Year]: config.nonAgendaYearCellHeaderFormat,
101
+ [CellUnit.Quarter]: config.nonAgendaQuarterCellHeaderFormat
101
102
  };
102
103
  return formatMap[cellUnitParam] || config.nonAgendaOtherCellHeaderFormat;
103
104
  }, [config]);
@@ -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;
@@ -169,12 +167,6 @@ export default class SchedulerData {
169
167
  this.bumpVersion();
170
168
  }
171
169
  }
172
- setBesidesWidth(besidesWidth) {
173
- if (besidesWidth >= 0 && this.config.besidesWidth !== besidesWidth) {
174
- this.config.besidesWidth = besidesWidth;
175
- this.bumpVersion();
176
- }
177
- }
178
170
  setUnderneathHeight(underneathHeight) {
179
171
  if (underneathHeight >= 0 && this.config.underneathHeight !== underneathHeight) {
180
172
  this.config.underneathHeight = underneathHeight;
@@ -389,8 +381,7 @@ export default class SchedulerData {
389
381
  return !!contentCellWidth.endsWith && contentCellWidth.endsWith('%');
390
382
  }
391
383
  getSchedulerWidth() {
392
- const besidesWidth = this.measuredByContainer ? 0 : this.config.besidesWidth;
393
- const baseWidth = this.documentWidth - besidesWidth > 0 ? this.documentWidth - besidesWidth : 0;
384
+ const baseWidth = this.documentWidth > 0 ? this.documentWidth : 0;
394
385
  return this.isSchedulerResponsive() ? parseInt(baseWidth * Number(this.config.schedulerWidth.slice(0, -1)) / 100, 10) : this.config.schedulerWidth;
395
386
  }
396
387
  getSchedulerHeight() {
@@ -641,12 +632,6 @@ export default class SchedulerData {
641
632
  const configProperty = viewConfigMap[this.viewType] || 'customCellWidth';
642
633
  return this.config[configProperty];
643
634
  }
644
- _setMeasuredByContainer(measuredByContainer) {
645
- if (this.measuredByContainer !== measuredByContainer) {
646
- this.measuredByContainer = measuredByContainer;
647
- this.bumpVersion();
648
- }
649
- }
650
635
  _setDocumentWidth(documentWidth) {
651
636
  if (documentWidth >= 0 && documentWidth !== this.documentWidth) {
652
637
  this.documentWidth = documentWidth;
@@ -857,6 +842,14 @@ export default class SchedulerData {
857
842
  });
858
843
  header = header.add(1, 'months').startOf('month');
859
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
+ }
860
853
  } else if (this.cellUnit === CellUnit.Year) {
861
854
  while (header >= start && header <= end) {
862
855
  const time = header.format(DATE_FORMAT);
@@ -1057,7 +1050,8 @@ export default class SchedulerData {
1057
1050
  [CellUnit.Hour]: 'minutes',
1058
1051
  [CellUnit.Week]: 'weeks',
1059
1052
  [CellUnit.Month]: 'months',
1060
- [CellUnit.Year]: 'years'
1053
+ [CellUnit.Year]: 'years',
1054
+ [CellUnit.Quarter]: 'quarters'
1061
1055
  }[this.cellUnit] || 'days';
1062
1056
  return {
1063
1057
  amount: unit === 'minutes' ? this.config.minuteStep : 1,
@@ -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);
@@ -16,7 +16,8 @@ export const CellUnit = {
16
16
  Hour: 1,
17
17
  Week: 2,
18
18
  Month: 3,
19
- Year: 4
19
+ Year: 4,
20
+ Quarter: 5
20
21
  };
21
22
  export const SummaryPos = {
22
23
  Top: 0,
@@ -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,
@@ -89,6 +88,7 @@ export default {
89
88
  nonAgendaWeekCellHeaderFormat: 'ww/YYYY',
90
89
  nonAgendaMonthCellHeaderFormat: 'MMM YYYY',
91
90
  nonAgendaYearCellHeaderFormat: 'YYYY',
91
+ nonAgendaQuarterCellHeaderFormat: '[Q]Q YYYY',
92
92
  nonAgendaOtherCellHeaderFormat: 'ddd M/D',
93
93
  minuteStep: 30,
94
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-big-schedule",
3
- "version": "7.1.1-beta.2",
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",