react-big-schedule 8.1.0 → 9.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 +20 -1129
- package/dist/calendar/Calendar.d.ts +28 -0
- package/dist/calendar/Calendar.js +95 -0
- package/dist/calendar/Toolbar.d.ts +18 -0
- package/dist/calendar/Toolbar.js +6 -0
- package/dist/calendar/recurrence.check.d.ts +1 -0
- package/dist/calendar/recurrence.check.js +49 -0
- package/dist/calendar/recurrence.d.ts +8 -0
- package/dist/calendar/recurrence.js +90 -0
- package/dist/calendar/timezone.d.ts +6 -0
- package/dist/calendar/timezone.js +14 -0
- package/dist/calendar/types.d.ts +187 -0
- package/dist/calendar/types.js +1 -0
- package/dist/calendar/useEventSources.d.ts +11 -0
- package/dist/calendar/useEventSources.js +89 -0
- package/dist/calendar/useRecurrence.d.ts +4 -0
- package/dist/calendar/useRecurrence.js +15 -0
- package/dist/calendar/utils.d.ts +38 -0
- package/dist/calendar/utils.js +143 -0
- package/dist/calendar/views/DayGridView.d.ts +3 -0
- package/dist/calendar/views/DayGridView.js +375 -0
- package/dist/calendar/views/ListView.d.ts +4 -0
- package/dist/calendar/views/ListView.js +56 -0
- package/dist/calendar/views/MultiMonthView.d.ts +4 -0
- package/dist/calendar/views/MultiMonthView.js +36 -0
- package/dist/calendar/views/TimeGridView.d.ts +3 -0
- package/dist/calendar/views/TimeGridView.js +334 -0
- package/dist/calendar/views/daygrid/DayCell.d.ts +19 -0
- package/dist/calendar/views/daygrid/DayCell.js +17 -0
- package/dist/calendar/views/daygrid/EventChip.d.ts +19 -0
- package/dist/calendar/views/daygrid/EventChip.js +40 -0
- package/dist/calendar/views/daygrid/layout.d.ts +30 -0
- package/dist/calendar/views/daygrid/layout.js +63 -0
- package/dist/calendar/views/list/bucket.d.ts +8 -0
- package/dist/calendar/views/list/bucket.js +37 -0
- package/dist/calendar/views/multimonth/Cell.d.ts +12 -0
- package/dist/calendar/views/multimonth/Cell.js +44 -0
- package/dist/calendar/views/multimonth/Continuous.d.ts +8 -0
- package/dist/calendar/views/multimonth/Continuous.js +28 -0
- package/dist/calendar/views/multimonth/MonthGrid.d.ts +10 -0
- package/dist/calendar/views/multimonth/MonthGrid.js +36 -0
- package/dist/calendar/views/multimonth/shared.d.ts +27 -0
- package/dist/calendar/views/multimonth/shared.js +40 -0
- package/dist/calendar/views/timegrid/DayColumn.d.ts +49 -0
- package/dist/calendar/views/timegrid/DayColumn.js +86 -0
- package/dist/calendar/views/timegrid/model.d.ts +55 -0
- package/dist/calendar/views/timegrid/model.js +102 -0
- package/dist/components/AddMore.d.ts +13 -0
- package/dist/components/AddMore.js +9 -42
- package/dist/components/AddMorePopover.d.ts +13 -0
- package/dist/components/AddMorePopover.js +24 -95
- package/dist/components/AgendaEventItem.d.ts +10 -0
- package/dist/components/AgendaEventItem.js +33 -81
- package/dist/components/AgendaResourceEvents.d.ts +10 -0
- package/dist/components/AgendaResourceEvents.js +37 -91
- package/dist/components/AgendaView.d.ts +9 -0
- package/dist/components/AgendaView.js +10 -69
- package/dist/components/BodyView.d.ts +11 -0
- package/dist/components/BodyView.js +36 -67
- package/dist/components/DnDContext.d.ts +48 -0
- package/dist/components/DnDContext.js +200 -221
- package/dist/components/DnDSource.d.ts +49 -0
- package/dist/components/DnDSource.js +125 -120
- package/dist/components/EventItem.d.ts +41 -0
- package/dist/components/EventItem.js +585 -787
- package/dist/components/EventItemPopover.d.ts +12 -0
- package/dist/components/EventItemPopover.js +19 -143
- package/dist/components/HeaderView.d.ts +14 -0
- package/dist/components/HeaderView.js +123 -186
- package/dist/components/ResourceEvents.d.ts +54 -0
- package/dist/components/ResourceEvents.js +534 -703
- package/dist/components/ResourceView.d.ts +26 -0
- package/dist/components/ResourceView.js +64 -184
- package/dist/components/SchedulerData.d.ts +136 -0
- package/dist/components/SchedulerData.js +1296 -1226
- package/dist/components/SchedulerHeader.d.ts +25 -0
- package/dist/components/SchedulerHeader.js +50 -150
- package/dist/components/SelectedArea.d.ts +8 -0
- package/dist/components/SelectedArea.js +11 -26
- package/dist/components/Summary.d.ts +11 -0
- package/dist/components/Summary.js +21 -50
- package/dist/components/WrapperFun.d.ts +2 -0
- package/dist/components/WrapperFun.js +5 -10
- package/dist/components/index.d.ts +44 -0
- package/dist/components/index.js +428 -654
- package/dist/components/ui/Icons.d.ts +8 -0
- package/dist/components/ui/Icons.js +7 -0
- package/dist/components/ui/MiniCalendar.d.ts +9 -0
- package/dist/components/ui/MiniCalendar.js +17 -0
- package/dist/components/ui/Popover.d.ts +13 -0
- package/dist/components/ui/Popover.js +80 -0
- package/dist/config/default.d.ts +36 -0
- package/dist/config/default.js +17 -26
- package/dist/config/i18n.d.ts +27 -0
- package/dist/config/i18n.js +21 -37
- package/dist/config/scheduler.d.ts +12 -0
- package/dist/config/scheduler.js +126 -119
- package/dist/css/style.css +2 -316
- package/dist/helper/behaviors.d.ts +14 -0
- package/dist/helper/behaviors.js +75 -75
- package/dist/helper/utility.d.ts +26 -0
- package/dist/helper/utility.js +23 -30
- package/dist/index.d.ts +6 -477
- package/dist/index.js +4 -2
- package/dist/sample-data/sample1.d.ts +11 -0
- package/dist/sample-data/sample1.js +427 -372
- package/dist/types.d.ts +267 -0
- package/dist/types.js +1 -0
- package/package.json +35 -26
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
|
+
type IconProps = SVGProps<SVGSVGElement>;
|
|
3
|
+
export declare const ChevronLeft: (props: IconProps) => import("react").JSX.Element;
|
|
4
|
+
export declare const ChevronRight: (props: IconProps) => import("react").JSX.Element;
|
|
5
|
+
export declare const Close: (props: IconProps) => import("react").JSX.Element;
|
|
6
|
+
export declare const PlusSquare: (props: IconProps) => import("react").JSX.Element;
|
|
7
|
+
export declare const MinusSquare: (props: IconProps) => import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const svg = (d, props) => (_jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: "1.6", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", focusable: "false", ...props, children: d }));
|
|
3
|
+
export const ChevronLeft = (props) => svg(_jsx("path", { d: "M10 3 5 8l5 5" }), props);
|
|
4
|
+
export const ChevronRight = (props) => svg(_jsx("path", { d: "m6 3 5 5-5 5" }), props);
|
|
5
|
+
export const Close = (props) => svg(_jsx("path", { d: "m4 4 8 8M12 4l-8 8" }), props);
|
|
6
|
+
export const PlusSquare = (props) => svg(_jsxs(_Fragment, { children: [_jsx("rect", { x: "2", y: "2", width: "12", height: "12", rx: "2" }), _jsx("path", { d: "M8 5v6M5 8h6" })] }), props);
|
|
7
|
+
export const MinusSquare = (props) => svg(_jsxs(_Fragment, { children: [_jsx("rect", { x: "2", y: "2", width: "12", height: "12", rx: "2" }), _jsx("path", { d: "M5 8h6" })] }), props);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Dayjs } from 'dayjs';
|
|
2
|
+
interface MiniCalendarProps {
|
|
3
|
+
value: string;
|
|
4
|
+
/** The scheduler's locale-bound dayjs. */
|
|
5
|
+
dayjs: (date?: string | Date) => Dayjs;
|
|
6
|
+
onSelect: (date: Dayjs) => void;
|
|
7
|
+
}
|
|
8
|
+
declare function MiniCalendar({ value, dayjs, onSelect }: MiniCalendarProps): import("react").JSX.Element;
|
|
9
|
+
export default MiniCalendar;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { ChevronLeft, ChevronRight } from './Icons';
|
|
4
|
+
function MiniCalendar({ value, dayjs, onSelect }) {
|
|
5
|
+
const selected = dayjs(value);
|
|
6
|
+
const [month, setMonth] = useState(selected.startOf('month'));
|
|
7
|
+
const first = month.startOf('week');
|
|
8
|
+
const days = Array.from({ length: 42 }, (_, i) => first.add(i, 'day'));
|
|
9
|
+
const today = dayjs();
|
|
10
|
+
const nav = (label, delta, Icon) => (_jsx("button", { type: "button", "aria-label": label, className: "rbs-icon-btn", onClick: () => setMonth(month.add(delta, 'month')), children: _jsx(Icon, {}) }));
|
|
11
|
+
return (_jsxs("div", { className: "rbs-mini-calendar rbs:w-72 rbs:p-2", children: [_jsxs("div", { className: "rbs:mb-2 rbs:flex rbs:items-center rbs:justify-between", children: [nav('Previous month', -1, ChevronLeft), _jsx("span", { className: "rbs:text-sm rbs:font-medium", children: month.format('MMMM YYYY') }), nav('Next month', 1, ChevronRight)] }), _jsxs("div", { className: "rbs:grid rbs:grid-cols-7 rbs:gap-0.5 rbs:text-center rbs:text-xs", children: [days.slice(0, 7).map(d => (_jsx("span", { className: "rbs:py-1 rbs:text-muted", children: d.format('dd') }, d.format('d')))), days.map(d => {
|
|
12
|
+
const outside = d.month() !== month.month();
|
|
13
|
+
const isSelected = d.isSame(selected, 'day');
|
|
14
|
+
return (_jsx("button", { type: "button", "data-selected": isSelected || undefined, "data-today": d.isSame(today, 'day') || undefined, "data-outside": outside || undefined, className: "rbs-mini-day", onClick: () => onSelect(d), children: d.date() }, d.format('YYYY-MM-DD')));
|
|
15
|
+
})] })] }));
|
|
16
|
+
}
|
|
17
|
+
export default MiniCalendar;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export interface PopoverProps {
|
|
3
|
+
content: ReactNode;
|
|
4
|
+
placement?: string;
|
|
5
|
+
trigger?: 'hover' | 'click';
|
|
6
|
+
open?: boolean;
|
|
7
|
+
onOpenChange?: (open: boolean) => void;
|
|
8
|
+
offset?: [number, number];
|
|
9
|
+
className?: string;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
declare function Popover({ content, placement, trigger, open, onOpenChange, offset, className, children, }: PopoverProps): import("react").JSX.Element;
|
|
13
|
+
export default Popover;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
const GAP = 6;
|
|
5
|
+
const EDGE = 4;
|
|
6
|
+
// placement: top|bottom + Left|Right|(centre); offset: [x, y] nudge in px
|
|
7
|
+
function place(anchor, pop, placement, [dx, dy]) {
|
|
8
|
+
const a = anchor.getBoundingClientRect();
|
|
9
|
+
const p = pop.getBoundingClientRect();
|
|
10
|
+
const above = a.top - p.height - GAP;
|
|
11
|
+
const below = a.bottom + GAP;
|
|
12
|
+
let top = placement.startsWith('top') ? above : below;
|
|
13
|
+
if (top < 0 && above < 0)
|
|
14
|
+
top = below;
|
|
15
|
+
else if (top + p.height > window.innerHeight && above > 0)
|
|
16
|
+
top = above;
|
|
17
|
+
let left = a.left + (a.width - p.width) / 2;
|
|
18
|
+
if (placement.endsWith('Left'))
|
|
19
|
+
left = a.left;
|
|
20
|
+
else if (placement.endsWith('Right'))
|
|
21
|
+
left = a.right - p.width;
|
|
22
|
+
left = Math.max(EDGE, Math.min(left + dx, window.innerWidth - p.width - EDGE));
|
|
23
|
+
return { top: top + dy, left };
|
|
24
|
+
}
|
|
25
|
+
function Popover({ content, placement = 'bottomLeft', trigger = 'hover', open, onOpenChange, offset = [0, 0], className = '', children, }) {
|
|
26
|
+
const [innerOpen, setInnerOpen] = useState(false);
|
|
27
|
+
const [pos, setPos] = useState(null);
|
|
28
|
+
const [theme, setTheme] = useState();
|
|
29
|
+
const anchorRef = useRef(null);
|
|
30
|
+
const popRef = useRef(null);
|
|
31
|
+
const timer = useRef(undefined);
|
|
32
|
+
const isControlled = open !== undefined;
|
|
33
|
+
const shown = isControlled ? open : innerOpen;
|
|
34
|
+
const isHover = trigger === 'hover';
|
|
35
|
+
const setShown = (value) => {
|
|
36
|
+
if (!isControlled)
|
|
37
|
+
setInnerOpen(value);
|
|
38
|
+
onOpenChange?.(value);
|
|
39
|
+
};
|
|
40
|
+
const show = () => {
|
|
41
|
+
clearTimeout(timer.current);
|
|
42
|
+
setShown(true);
|
|
43
|
+
};
|
|
44
|
+
const hide = () => {
|
|
45
|
+
clearTimeout(timer.current);
|
|
46
|
+
timer.current = setTimeout(() => setShown(false), 100);
|
|
47
|
+
};
|
|
48
|
+
useLayoutEffect(() => {
|
|
49
|
+
const anchor = anchorRef.current?.firstElementChild;
|
|
50
|
+
const pop = popRef.current;
|
|
51
|
+
if (!shown || !anchor || !pop) {
|
|
52
|
+
setPos(null);
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
setTheme(anchor.closest('[data-rbs-theme]')?.dataset.rbsTheme);
|
|
56
|
+
const update = () => setPos(place(anchor, pop, placement, offset));
|
|
57
|
+
update();
|
|
58
|
+
window.addEventListener('resize', update);
|
|
59
|
+
window.addEventListener('scroll', update, true);
|
|
60
|
+
return () => {
|
|
61
|
+
window.removeEventListener('resize', update);
|
|
62
|
+
window.removeEventListener('scroll', update, true);
|
|
63
|
+
};
|
|
64
|
+
}, [shown, placement, offset[0], offset[1], content]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!shown || trigger !== 'click')
|
|
67
|
+
return undefined;
|
|
68
|
+
const onDown = (e) => {
|
|
69
|
+
const target = e.target;
|
|
70
|
+
if (!anchorRef.current?.contains(target) && !popRef.current?.contains(target))
|
|
71
|
+
setShown(false);
|
|
72
|
+
};
|
|
73
|
+
document.addEventListener('mousedown', onDown);
|
|
74
|
+
return () => document.removeEventListener('mousedown', onDown);
|
|
75
|
+
}, [shown, trigger]);
|
|
76
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
77
|
+
return (_jsxs(_Fragment, { children: [_jsx("span", { ref: anchorRef, style: { display: 'contents' }, onMouseEnter: isHover ? show : undefined, onMouseLeave: isHover ? hide : undefined, onClick: trigger === 'click' ? () => setShown(!shown) : undefined, children: children }), shown &&
|
|
78
|
+
createPortal(_jsx("div", { ref: popRef, role: "tooltip", "data-rbs-theme": theme, className: `rbs-popover ${className}`, style: { top: pos?.top ?? 0, left: pos?.left ?? 0, visibility: pos ? 'visible' : 'hidden' }, onMouseEnter: isHover ? show : undefined, onMouseLeave: isHover ? hide : undefined, children: content }), document.body)] }));
|
|
79
|
+
}
|
|
80
|
+
export default Popover;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const DATE_FORMAT = "YYYY-MM-DD";
|
|
2
|
+
export declare const DATETIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
|
|
3
|
+
export declare const ViewType: {
|
|
4
|
+
readonly Day: 0;
|
|
5
|
+
readonly Week: 1;
|
|
6
|
+
readonly Month: 2;
|
|
7
|
+
readonly Quarter: 3;
|
|
8
|
+
readonly Year: 4;
|
|
9
|
+
readonly Custom: 5;
|
|
10
|
+
readonly Custom1: 6;
|
|
11
|
+
readonly Custom2: 7;
|
|
12
|
+
readonly VerticalResource: 8;
|
|
13
|
+
};
|
|
14
|
+
export type ViewType = (typeof ViewType)[keyof typeof ViewType];
|
|
15
|
+
export declare const CellUnit: {
|
|
16
|
+
readonly Day: 0;
|
|
17
|
+
readonly Hour: 1;
|
|
18
|
+
readonly Week: 2;
|
|
19
|
+
readonly Month: 3;
|
|
20
|
+
readonly Year: 4;
|
|
21
|
+
readonly Quarter: 5;
|
|
22
|
+
};
|
|
23
|
+
export type CellUnit = (typeof CellUnit)[keyof typeof CellUnit];
|
|
24
|
+
export declare const SummaryPos: {
|
|
25
|
+
readonly Top: 0;
|
|
26
|
+
readonly TopRight: 1;
|
|
27
|
+
readonly TopLeft: 2;
|
|
28
|
+
readonly Bottom: 3;
|
|
29
|
+
readonly BottomRight: 4;
|
|
30
|
+
readonly BottomLeft: 5;
|
|
31
|
+
};
|
|
32
|
+
export type SummaryPos = (typeof SummaryPos)[keyof typeof SummaryPos];
|
|
33
|
+
export declare const DnDTypes: {
|
|
34
|
+
readonly EVENT: 'event';
|
|
35
|
+
};
|
|
36
|
+
export type DnDTypes = (typeof DnDTypes)[keyof typeof DnDTypes];
|
package/dist/config/default.js
CHANGED
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
export const DATE_FORMAT = 'YYYY-MM-DD';
|
|
2
2
|
export const DATETIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
|
3
3
|
export const ViewType = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
};
|
|
14
|
-
export const CellUnit = {
|
|
15
|
-
Day: 0,
|
|
16
|
-
Hour: 1,
|
|
17
|
-
Week: 2,
|
|
18
|
-
Month: 3,
|
|
19
|
-
Year: 4,
|
|
20
|
-
Quarter: 5
|
|
4
|
+
Day: 0,
|
|
5
|
+
Week: 1,
|
|
6
|
+
Month: 2,
|
|
7
|
+
Quarter: 3,
|
|
8
|
+
Year: 4,
|
|
9
|
+
Custom: 5,
|
|
10
|
+
Custom1: 6,
|
|
11
|
+
Custom2: 7,
|
|
12
|
+
VerticalResource: 8,
|
|
21
13
|
};
|
|
14
|
+
export const CellUnit = { Day: 0, Hour: 1, Week: 2, Month: 3, Year: 4, Quarter: 5 };
|
|
22
15
|
export const SummaryPos = {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
Top: 0,
|
|
17
|
+
TopRight: 1,
|
|
18
|
+
TopLeft: 2,
|
|
19
|
+
Bottom: 3,
|
|
20
|
+
BottomRight: 4,
|
|
21
|
+
BottomLeft: 5,
|
|
29
22
|
};
|
|
30
|
-
export const DnDTypes = {
|
|
31
|
-
EVENT: 'event'
|
|
32
|
-
};
|
|
23
|
+
export const DnDTypes = { EVENT: 'event' };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* i18n configuration and labels provider
|
|
3
|
+
*
|
|
4
|
+
* This module provides a centralized way to manage user-facing strings in the scheduler.
|
|
5
|
+
* Users can provide localized labels either through the config or by setting a custom
|
|
6
|
+
* labels provider function.
|
|
7
|
+
*/
|
|
8
|
+
export type LabelKey = 'resourceName' | 'taskName' | 'agendaViewHeader' | 'weekNumberLabel';
|
|
9
|
+
type Labels = Record<LabelKey, string>;
|
|
10
|
+
export type LabelsProvider = ((key: LabelKey, locale?: string) => string | undefined | null) | Partial<Labels>;
|
|
11
|
+
/**
|
|
12
|
+
* Get the current label for a given key
|
|
13
|
+
*/
|
|
14
|
+
export declare function getLabel(key: LabelKey, locale?: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Set a custom labels provider
|
|
17
|
+
*/
|
|
18
|
+
export declare function setLabelsProvider(provider: LabelsProvider | null): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get all default labels
|
|
21
|
+
*/
|
|
22
|
+
export declare function getDefaultLabels(): Labels;
|
|
23
|
+
/**
|
|
24
|
+
* Reset to default English labels
|
|
25
|
+
*/
|
|
26
|
+
export declare function resetLabelsProvider(): void;
|
|
27
|
+
export {};
|
package/dist/config/i18n.js
CHANGED
|
@@ -5,62 +5,46 @@
|
|
|
5
5
|
* Users can provide localized labels either through the config or by setting a custom
|
|
6
6
|
* labels provider function.
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
// Default English labels
|
|
10
8
|
const defaultLabels = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
resourceName: 'Resource Name',
|
|
10
|
+
taskName: 'Task Name',
|
|
11
|
+
agendaViewHeader: 'Agenda',
|
|
12
|
+
weekNumberLabel: 'Week No.',
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
// Current labels provider (can be a function or object)
|
|
18
15
|
let labelsProvider = null;
|
|
19
|
-
|
|
20
16
|
/**
|
|
21
17
|
* Get the current label for a given key
|
|
22
|
-
* @param {string} key - The label key (e.g., 'resourceName', 'taskName')
|
|
23
|
-
* @param {string} locale - Optional locale code for locale-specific translations
|
|
24
|
-
* @returns {string} The localized label or the default English label
|
|
25
18
|
*/
|
|
26
|
-
export function getLabel(key, locale
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// Fall back to default English labels
|
|
40
|
-
return defaultLabels[key];
|
|
19
|
+
export function getLabel(key, locale) {
|
|
20
|
+
// If a custom provider function is set, use it
|
|
21
|
+
if (typeof labelsProvider === 'function') {
|
|
22
|
+
const label = labelsProvider(key, locale);
|
|
23
|
+
return label ?? defaultLabels[key];
|
|
24
|
+
}
|
|
25
|
+
// If a labels object provider is set, use it with fallback
|
|
26
|
+
if (labelsProvider && typeof labelsProvider === 'object') {
|
|
27
|
+
const label = labelsProvider[key];
|
|
28
|
+
return label ?? defaultLabels[key];
|
|
29
|
+
}
|
|
30
|
+
// Fall back to default English labels
|
|
31
|
+
return defaultLabels[key];
|
|
41
32
|
}
|
|
42
|
-
|
|
43
33
|
/**
|
|
44
34
|
* Set a custom labels provider
|
|
45
|
-
* @param {Function|Object} provider - Either a function(key, locale) -> string or an object with label key-value pairs
|
|
46
35
|
*/
|
|
47
36
|
export function setLabelsProvider(provider) {
|
|
48
|
-
|
|
37
|
+
labelsProvider = provider;
|
|
49
38
|
}
|
|
50
|
-
|
|
51
39
|
/**
|
|
52
40
|
* Get all default labels
|
|
53
|
-
* @returns {Object} Object with all default English labels
|
|
54
41
|
*/
|
|
55
42
|
export function getDefaultLabels() {
|
|
56
|
-
|
|
57
|
-
...defaultLabels
|
|
58
|
-
};
|
|
43
|
+
return { ...defaultLabels };
|
|
59
44
|
}
|
|
60
|
-
|
|
61
45
|
/**
|
|
62
46
|
* Reset to default English labels
|
|
63
47
|
*/
|
|
64
48
|
export function resetLabelsProvider() {
|
|
65
|
-
|
|
66
|
-
}
|
|
49
|
+
labelsProvider = null;
|
|
50
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SchedulerConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Default scheduler configuration
|
|
4
|
+
*
|
|
5
|
+
* User-facing strings (resourceName, taskName, agendaViewHeader, weekNumberLabel)
|
|
6
|
+
* are set to English defaults but can be overridden through:
|
|
7
|
+
* 1. Passing a custom config object when creating SchedulerData
|
|
8
|
+
* 2. Using setLabelsProvider() from the i18n module to set a custom labels provider
|
|
9
|
+
* 3. Directly modifying config properties after instantiation
|
|
10
|
+
*/
|
|
11
|
+
declare const config: SchedulerConfig;
|
|
12
|
+
export default config;
|
package/dist/config/scheduler.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SummaryPos, ViewType } from './default';
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Default scheduler configuration
|
|
5
4
|
*
|
|
@@ -9,121 +8,129 @@ import { SummaryPos, ViewType } from './default';
|
|
|
9
8
|
* 2. Using setLabelsProvider() from the i18n module to set a custom labels provider
|
|
10
9
|
* 3. Directly modifying config properties after instantiation
|
|
11
10
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
11
|
+
const config = {
|
|
12
|
+
schedulerWidth: '100%',
|
|
13
|
+
underneathHeight: 20,
|
|
14
|
+
schedulerMaxHeight: 0,
|
|
15
|
+
tableHeaderHeight: 40,
|
|
16
|
+
schedulerContentHeight: '100%',
|
|
17
|
+
responsiveByParent: false,
|
|
18
|
+
agendaResourceTableWidth: 160,
|
|
19
|
+
agendaMaxEventWidth: 100,
|
|
20
|
+
dayResourceTableWidth: 160,
|
|
21
|
+
weekResourceTableWidth: '16%',
|
|
22
|
+
monthResourceTableWidth: 160,
|
|
23
|
+
quarterResourceTableWidth: 160,
|
|
24
|
+
yearResourceTableWidth: 160,
|
|
25
|
+
customResourceTableWidth: 160,
|
|
26
|
+
dayCellWidth: 30,
|
|
27
|
+
weekCellWidth: '12%',
|
|
28
|
+
monthCellWidth: 80,
|
|
29
|
+
quarterCellWidth: 80,
|
|
30
|
+
yearCellWidth: 80,
|
|
31
|
+
customCellWidth: 80,
|
|
32
|
+
dayMaxEvents: 99,
|
|
33
|
+
weekMaxEvents: 99,
|
|
34
|
+
monthMaxEvents: 99,
|
|
35
|
+
quarterMaxEvents: 99,
|
|
36
|
+
yearMaxEvents: 99,
|
|
37
|
+
customMaxEvents: 99,
|
|
38
|
+
eventItemPopoverTrigger: 'hover',
|
|
39
|
+
eventItemPopoverPlacement: 'bottomLeft',
|
|
40
|
+
eventItemPopoverWidth: 300,
|
|
41
|
+
eventItemHeight: 22,
|
|
42
|
+
eventItemLineHeight: 24,
|
|
43
|
+
nonAgendaSlotMinHeight: 0,
|
|
44
|
+
dayStartFrom: 0,
|
|
45
|
+
dayStopTo: 23,
|
|
46
|
+
defaultEventBgColor: 'var(--rbs-accent)',
|
|
47
|
+
selectedAreaColor: '#7EC2F3',
|
|
48
|
+
nonWorkingTimeHeadColor: 'var(--rbs-muted)',
|
|
49
|
+
nonWorkingTimeHeadBgColor: 'var(--rbs-nonworking-bg)',
|
|
50
|
+
nonWorkingTimeBodyBgColor: 'var(--rbs-nonworking-bg)',
|
|
51
|
+
summaryColor: 'var(--rbs-muted)',
|
|
52
|
+
summaryPos: SummaryPos.TopRight,
|
|
53
|
+
groupOnlySlotColor: 'var(--rbs-group-bg)',
|
|
54
|
+
headerBorderColor: 'var(--rbs-border)',
|
|
55
|
+
weekNumberRowHeight: 24,
|
|
56
|
+
showWeekNumber: false,
|
|
57
|
+
// month row above the day cells (month names spanning their days), like the week number row
|
|
58
|
+
showMonthRow: false,
|
|
59
|
+
monthRowHeight: 24,
|
|
60
|
+
// box shown on the row/cell where a dragged event, task or resource would be placed
|
|
61
|
+
dropPreviewEnabled: true,
|
|
62
|
+
dropPreviewClassName: '',
|
|
63
|
+
dropPreviewStyle: undefined,
|
|
64
|
+
startResizable: true,
|
|
65
|
+
endResizable: true,
|
|
66
|
+
movable: true,
|
|
67
|
+
creatable: true,
|
|
68
|
+
crossResourceMove: true,
|
|
69
|
+
checkConflict: false,
|
|
70
|
+
scrollToSpecialDayjsEnabled: true,
|
|
71
|
+
eventItemPopoverEnabled: true,
|
|
72
|
+
eventItemPopoverShowColor: true,
|
|
73
|
+
calendarPopoverEnabled: true,
|
|
74
|
+
recurringEventsEnabled: true,
|
|
75
|
+
viewChangeSpinEnabled: true,
|
|
76
|
+
dateChangeSpinEnabled: true,
|
|
77
|
+
headerEnabled: true,
|
|
78
|
+
resourceViewEnabled: true,
|
|
79
|
+
displayWeekend: true,
|
|
80
|
+
relativeMove: true,
|
|
81
|
+
defaultExpanded: true,
|
|
82
|
+
dragAndDropEnabled: true,
|
|
83
|
+
schedulerHeaderEventsFuncsTimeoutMs: 100,
|
|
84
|
+
resourceName: 'Resource Name',
|
|
85
|
+
taskName: 'Task Name',
|
|
86
|
+
agendaViewHeader: 'Agenda',
|
|
87
|
+
weekNumberLabel: 'Week No.',
|
|
88
|
+
addMorePopoverHeaderFormat: 'MMM D, YYYY dddd',
|
|
89
|
+
eventItemPopoverDateFormat: 'MMM D',
|
|
90
|
+
nonAgendaDayCellHeaderFormat: 'ha',
|
|
91
|
+
nonAgendaWeekCellHeaderFormat: 'ww/YYYY',
|
|
92
|
+
nonAgendaMonthCellHeaderFormat: 'MMM YYYY',
|
|
93
|
+
nonAgendaYearCellHeaderFormat: 'YYYY',
|
|
94
|
+
nonAgendaQuarterCellHeaderFormat: '[Q]Q YYYY',
|
|
95
|
+
nonAgendaOtherCellHeaderFormat: 'ddd M/D',
|
|
96
|
+
minuteStep: 30,
|
|
97
|
+
views: [
|
|
98
|
+
{
|
|
99
|
+
viewName: 'Day',
|
|
100
|
+
viewType: ViewType.Day,
|
|
101
|
+
showAgenda: false,
|
|
102
|
+
isEventPerspective: false,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
viewName: 'Week',
|
|
106
|
+
viewType: ViewType.Week,
|
|
107
|
+
showAgenda: false,
|
|
108
|
+
isEventPerspective: false,
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
viewName: 'Month',
|
|
112
|
+
viewType: ViewType.Month,
|
|
113
|
+
showAgenda: false,
|
|
114
|
+
isEventPerspective: false,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
viewName: 'Quarter',
|
|
118
|
+
viewType: ViewType.Quarter,
|
|
119
|
+
showAgenda: false,
|
|
120
|
+
isEventPerspective: false,
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
viewName: 'Year',
|
|
124
|
+
viewType: ViewType.Year,
|
|
125
|
+
showAgenda: false,
|
|
126
|
+
isEventPerspective: false,
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
viewName: 'Vertical',
|
|
130
|
+
viewType: ViewType.VerticalResource,
|
|
131
|
+
showAgenda: false,
|
|
132
|
+
isEventPerspective: false,
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
export default config;
|