@isma91/react-scheduler 4.0.5 → 4.0.7

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.
Files changed (79) hide show
  1. package/dist/package.json +6 -6
  2. package/package.json +9 -7
  3. package/.github/workflows/publish.yml +0 -29
  4. package/.github/workflows/tests.yml +0 -35
  5. package/.gitignore +0 -32
  6. package/.husky/pre-commit +0 -2
  7. package/.prettierignore +0 -1
  8. package/.prettierrc.json +0 -7
  9. package/.yarnrc.yml +0 -1
  10. package/eslint.config.js +0 -79
  11. package/index.html +0 -41
  12. package/isma91-react-scheduler-4.0.5.tgz +0 -0
  13. package/jest.config.ts +0 -194
  14. package/public/favicon.ico +0 -0
  15. package/public/logo192.png +0 -0
  16. package/public/logo512.png +0 -0
  17. package/public/manifest.json +0 -25
  18. package/public/robots.txt +0 -3
  19. package/scripts/post-pack.js +0 -34
  20. package/src/App.tsx +0 -25
  21. package/src/Page1.tsx +0 -67
  22. package/src/events.tsx +0 -227
  23. package/src/index.tsx +0 -21
  24. package/src/lib/SchedulerComponent.tsx +0 -78
  25. package/src/lib/__tests__/index.test.tsx +0 -24
  26. package/src/lib/components/common/Cell.tsx +0 -52
  27. package/src/lib/components/common/LocaleArrow.tsx +0 -38
  28. package/src/lib/components/common/ResourceHeader.tsx +0 -73
  29. package/src/lib/components/common/Tabs.tsx +0 -119
  30. package/src/lib/components/common/TodayTypo.tsx +0 -44
  31. package/src/lib/components/common/WithResources.tsx +0 -98
  32. package/src/lib/components/events/Actions.tsx +0 -65
  33. package/src/lib/components/events/AgendaEventsList.tsx +0 -126
  34. package/src/lib/components/events/CurrentTimeBar.tsx +0 -59
  35. package/src/lib/components/events/EmptyAgenda.tsx +0 -27
  36. package/src/lib/components/events/EventItem.tsx +0 -180
  37. package/src/lib/components/events/EventItemPopover.tsx +0 -179
  38. package/src/lib/components/events/MonthEvents.tsx +0 -141
  39. package/src/lib/components/events/TodayEvents.tsx +0 -99
  40. package/src/lib/components/hoc/DateProvider.tsx +0 -19
  41. package/src/lib/components/inputs/DatePicker.tsx +0 -95
  42. package/src/lib/components/inputs/Input.tsx +0 -113
  43. package/src/lib/components/inputs/SelectInput.tsx +0 -164
  44. package/src/lib/components/month/MonthTable.tsx +0 -207
  45. package/src/lib/components/nav/DayDateBtn.tsx +0 -77
  46. package/src/lib/components/nav/MonthDateBtn.tsx +0 -80
  47. package/src/lib/components/nav/Navigation.tsx +0 -201
  48. package/src/lib/components/nav/WeekDateBtn.tsx +0 -89
  49. package/src/lib/components/week/WeekTable.tsx +0 -229
  50. package/src/lib/helpers/constants.ts +0 -4
  51. package/src/lib/helpers/generals.tsx +0 -354
  52. package/src/lib/hooks/useArrowDisable.ts +0 -26
  53. package/src/lib/hooks/useCellAttributes.ts +0 -67
  54. package/src/lib/hooks/useDragAttributes.ts +0 -31
  55. package/src/lib/hooks/useEventPermissions.ts +0 -42
  56. package/src/lib/hooks/useStore.ts +0 -8
  57. package/src/lib/hooks/useSyncScroll.ts +0 -31
  58. package/src/lib/hooks/useWindowResize.ts +0 -37
  59. package/src/lib/index.tsx +0 -14
  60. package/src/lib/positionManger/context.ts +0 -14
  61. package/src/lib/positionManger/provider.tsx +0 -113
  62. package/src/lib/positionManger/usePosition.ts +0 -8
  63. package/src/lib/store/context.ts +0 -5
  64. package/src/lib/store/default.ts +0 -159
  65. package/src/lib/store/provider.tsx +0 -226
  66. package/src/lib/store/types.ts +0 -40
  67. package/src/lib/styles/styles.ts +0 -256
  68. package/src/lib/types.ts +0 -429
  69. package/src/lib/views/Day.tsx +0 -272
  70. package/src/lib/views/DayAgenda.tsx +0 -57
  71. package/src/lib/views/Editor.tsx +0 -258
  72. package/src/lib/views/Month.tsx +0 -82
  73. package/src/lib/views/MonthAgenda.tsx +0 -84
  74. package/src/lib/views/Week.tsx +0 -92
  75. package/src/lib/views/WeekAgenda.tsx +0 -81
  76. package/src/vite-env.d.ts +0 -3
  77. package/tsconfig.build.json +0 -5
  78. package/tsconfig.json +0 -27
  79. package/vite.config.js +0 -40
@@ -1,84 +0,0 @@
1
- import { useMemo } from "react";
2
- import { format, isSameMonth, getDaysInMonth, isToday } from "date-fns";
3
- import { AgendaDiv } from "../styles/styles";
4
- import { DefaultResource, ProcessedEvent } from "../types";
5
- import useStore from "../hooks/useStore";
6
- import { Typography } from "@mui/material";
7
- import { filterTodayAgendaEvents, isTimeZonedToday } from "../helpers/generals";
8
- import AgendaEventsList from "../components/events/AgendaEventsList";
9
- import EmptyAgenda from "../components/events/EmptyAgenda";
10
-
11
- type Props = {
12
- events: ProcessedEvent[];
13
- resource?: DefaultResource;
14
- };
15
- const MonthAgenda = ({ events, resource }: Props) => {
16
- const {
17
- month,
18
- handleGotoDay,
19
- locale,
20
- timeZone,
21
- selectedDate,
22
- translations,
23
- alwaysShowAgendaDays,
24
- stickyNavigationOffset,
25
- stickyNavigationHeight,
26
- } = useStore();
27
- const { disableGoToDay, headRenderer } = month!;
28
- const daysOfMonth = getDaysInMonth(selectedDate);
29
- const daysList = Array.from({ length: daysOfMonth }, (_, i) => i + 1);
30
-
31
- const monthEvents = useMemo(() => {
32
- return events.filter((event) => isSameMonth(event.start, selectedDate));
33
- }, [events, selectedDate]);
34
-
35
- if (!alwaysShowAgendaDays && !monthEvents.length) {
36
- return <EmptyAgenda />;
37
- }
38
-
39
- return (
40
- <AgendaDiv stickyOffset={stickyNavigationOffset} stickyHeight={stickyNavigationHeight}>
41
- {daysList.map((i) => {
42
- const day = new Date(selectedDate.getFullYear(), selectedDate.getMonth(), i);
43
- const today = isTimeZonedToday({ dateLeft: day, timeZone });
44
- const dayEvents = filterTodayAgendaEvents(events, day);
45
-
46
- if (!alwaysShowAgendaDays && !dayEvents.length) return null;
47
-
48
- return (
49
- <div key={i} className={`rs__agenda_row ${isToday(day) ? "rs__today_cell" : ""}`}>
50
- <div className="rs__cell rs__agenda__cell">
51
- {typeof headRenderer === "function" ? (
52
- <div>{headRenderer({ day, events, resource })}</div>
53
- ) : (
54
- <Typography
55
- sx={{ fontWeight: today ? "bold" : "inherit" }}
56
- color={today ? "primary" : "inherit"}
57
- variant="body2"
58
- className={!disableGoToDay ? "rs__hover__op" : ""}
59
- onClick={(e) => {
60
- e.stopPropagation();
61
- if (!disableGoToDay) {
62
- handleGotoDay(day);
63
- }
64
- }}
65
- >
66
- {format(day, "dd E", { locale })}
67
- </Typography>
68
- )}
69
- </div>
70
- <div className="rs__cell rs__agenda_items">
71
- {dayEvents.length > 0 ? (
72
- <AgendaEventsList day={day} events={dayEvents} />
73
- ) : (
74
- <Typography sx={{ padding: 1 }}>{translations.noDataToDisplay}</Typography>
75
- )}
76
- </div>
77
- </div>
78
- );
79
- })}
80
- </AgendaDiv>
81
- );
82
- };
83
-
84
- export { MonthAgenda };
@@ -1,92 +0,0 @@
1
- import { useEffect, useCallback } from "react";
2
- import { startOfWeek, addDays, eachMinuteOfInterval, endOfDay, startOfDay, set } from "date-fns";
3
- import { DefaultResource } from "../types";
4
- import { calcCellHeight, calcMinuteHeight, getResourcedEvents } from "../helpers/generals";
5
- import { WithResources } from "../components/common/WithResources";
6
- import useStore from "../hooks/useStore";
7
- import { WeekAgenda } from "./WeekAgenda";
8
- import WeekTable from "../components/week/WeekTable";
9
-
10
- const Week = () => {
11
- const {
12
- week,
13
- selectedDate,
14
- height,
15
- events,
16
- getRemoteEvents,
17
- triggerLoading,
18
- handleState,
19
- resources,
20
- resourceFields,
21
- fields,
22
- agenda,
23
- _refetchToken,
24
- } = useStore();
25
- const { weekStartOn, weekDays, startHour, endHour, step } = week!;
26
- const _weekStart = startOfWeek(selectedDate, { weekStartsOn: weekStartOn });
27
- const daysList = weekDays.map((d) => addDays(_weekStart, d));
28
- const weekStart = startOfDay(daysList[0]);
29
- const weekEnd = endOfDay(daysList[daysList.length - 1]);
30
- const START_TIME = set(selectedDate, { hours: startHour, minutes: 0, seconds: 0 });
31
- const END_TIME = set(selectedDate, { hours: endHour, minutes: -step, seconds: 0 });
32
- const hours = eachMinuteOfInterval(
33
- {
34
- start: START_TIME,
35
- end: END_TIME,
36
- },
37
- { step }
38
- );
39
- const CELL_HEIGHT = calcCellHeight(height, hours.length);
40
- const MINUTE_HEIGHT = calcMinuteHeight(CELL_HEIGHT, step);
41
-
42
- const fetchEvents = useCallback(async () => {
43
- try {
44
- triggerLoading(true);
45
-
46
- const events = await getRemoteEvents!({
47
- start: weekStart,
48
- end: weekEnd,
49
- view: "week",
50
- });
51
- if (Array.isArray(events)) {
52
- handleState(events, "events");
53
- }
54
- } catch (error) {
55
- throw error;
56
- } finally {
57
- triggerLoading(false);
58
- }
59
- }, [getRemoteEvents, _refetchToken, selectedDate]);
60
-
61
- useEffect(() => {
62
- if (getRemoteEvents instanceof Function) {
63
- fetchEvents();
64
- }
65
- }, [fetchEvents, getRemoteEvents, _refetchToken]);
66
-
67
- const renderTable = (resource?: DefaultResource) => {
68
- let resourcedEvents = events;
69
- if (resource) {
70
- resourcedEvents = getResourcedEvents(events, resource, resourceFields, fields);
71
- }
72
-
73
- if (agenda) {
74
- return <WeekAgenda daysList={daysList} resource={resource} events={resourcedEvents} />;
75
- }
76
-
77
- return (
78
- <WeekTable
79
- resourcedEvents={resourcedEvents}
80
- resource={resource}
81
- hours={hours}
82
- cellHeight={CELL_HEIGHT}
83
- minutesHeight={MINUTE_HEIGHT}
84
- daysList={daysList}
85
- />
86
- );
87
- };
88
-
89
- return resources.length ? <WithResources renderChildren={renderTable} /> : renderTable();
90
- };
91
-
92
- export { Week };
@@ -1,81 +0,0 @@
1
- import { useMemo } from "react";
2
- import { format, isToday } from "date-fns";
3
- import { AgendaDiv } from "../styles/styles";
4
- import { DefaultResource, ProcessedEvent } from "../types";
5
- import useStore from "../hooks/useStore";
6
- import { Typography } from "@mui/material";
7
- import { filterTodayAgendaEvents, isTimeZonedToday } from "../helpers/generals";
8
- import AgendaEventsList from "../components/events/AgendaEventsList";
9
- import EmptyAgenda from "../components/events/EmptyAgenda";
10
-
11
- type Props = {
12
- daysList: Date[];
13
- resource?: DefaultResource;
14
- events: ProcessedEvent[];
15
- };
16
- const WeekAgenda = ({ daysList, resource, events }: Props) => {
17
- const {
18
- week,
19
- handleGotoDay,
20
- locale,
21
- timeZone,
22
- translations,
23
- alwaysShowAgendaDays,
24
- stickyNavigationOffset,
25
- stickyNavigationHeight,
26
- } = useStore();
27
- const { disableGoToDay, headRenderer } = week!;
28
-
29
- const hasEvents = useMemo(() => {
30
- return daysList.some((day) => filterTodayAgendaEvents(events, day).length > 0);
31
- }, [daysList, events]);
32
-
33
- if (!alwaysShowAgendaDays && !hasEvents) {
34
- return <EmptyAgenda />;
35
- }
36
-
37
- return (
38
- <AgendaDiv stickyOffset={stickyNavigationOffset} stickyHeight={stickyNavigationHeight}>
39
- {daysList.map((day, i) => {
40
- const today = isTimeZonedToday({ dateLeft: day, timeZone });
41
- const dayEvents = filterTodayAgendaEvents(events, day);
42
-
43
- if (!alwaysShowAgendaDays && !dayEvents.length) return null;
44
-
45
- return (
46
- <div key={i} className={`rs__agenda_row ${isToday(day) ? "rs__today_cell" : ""}`}>
47
- <div className="rs__cell rs__agenda__cell">
48
- {typeof headRenderer === "function" ? (
49
- <div>{headRenderer({ day, events, resource })}</div>
50
- ) : (
51
- <Typography
52
- sx={{ fontWeight: today ? "bold" : "inherit" }}
53
- color={today ? "primary" : "inherit"}
54
- variant="body2"
55
- className={!disableGoToDay ? "rs__hover__op" : ""}
56
- onClick={(e) => {
57
- e.stopPropagation();
58
- if (!disableGoToDay) {
59
- handleGotoDay(day);
60
- }
61
- }}
62
- >
63
- {format(day, "dd E", { locale })}
64
- </Typography>
65
- )}
66
- </div>
67
- <div className="rs__cell rs__agenda_items">
68
- {dayEvents.length > 0 ? (
69
- <AgendaEventsList day={day} events={dayEvents} />
70
- ) : (
71
- <Typography sx={{ padding: 1 }}>{translations.noDataToDisplay}</Typography>
72
- )}
73
- </div>
74
- </div>
75
- );
76
- })}
77
- </AgendaDiv>
78
- );
79
- };
80
-
81
- export { WeekAgenda };
package/src/vite-env.d.ts DELETED
@@ -1,3 +0,0 @@
1
- /// <reference types="vite/client" />
2
-
3
- /// <reference types="vite-plugin-svgr/client" />
@@ -1,5 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["src/lib/**/*"],
4
- "exclude": ["node_modules", "**/__tests__/**"]
5
- }
package/tsconfig.json DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
- "incremental": true,
5
- "target": "ES2022",
6
- "useDefineForClassFields": true,
7
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
8
- "module": "ESNext",
9
- "skipLibCheck": true,
10
- "esModuleInterop": true,
11
-
12
- /* Bundler mode */
13
- "moduleResolution": "bundler",
14
- "allowImportingTsExtensions": true,
15
- "isolatedModules": true,
16
- "moduleDetection": "force",
17
- "noEmit": true,
18
- "jsx": "react-jsx",
19
-
20
- /* Linting */
21
- "strict": true,
22
- "noUnusedLocals": true,
23
- "noUnusedParameters": true,
24
- "noFallthroughCasesInSwitch": true
25
- },
26
- "include": ["src"]
27
- }
package/vite.config.js DELETED
@@ -1,40 +0,0 @@
1
- import { dirname, resolve } from "node:path";
2
- import { fileURLToPath } from "node:url";
3
- import { defineConfig } from "vite";
4
- import react from "@vitejs/plugin-react";
5
- import dts from "vite-plugin-dts";
6
- import tsconfigPaths from "vite-tsconfig-paths";
7
- import peerDepsExternal from "rollup-plugin-peer-deps-external";
8
-
9
- const __dirname = dirname(fileURLToPath(import.meta.url));
10
-
11
- export default defineConfig(() => ({
12
- plugins: [
13
- react(),
14
- tsconfigPaths({
15
- configNames: ["tsconfig.json"],
16
- }),
17
- dts({ tsconfigPath: "./tsconfig.build.json" }),
18
- peerDepsExternal(),
19
- ],
20
- server: {
21
- port: 3000,
22
- host: true,
23
- },
24
- preview: {
25
- port: 3000,
26
- },
27
- build: {
28
- lib: {
29
- entry: {
30
- index: resolve(__dirname, "src/lib/index.tsx"),
31
- },
32
- name: "Scheduler",
33
- formats: ["es"],
34
- },
35
- copyPublicDir: false,
36
- },
37
- resolve: {
38
- extensions: [".js", ".ts", ".tsx", ".jsx"],
39
- },
40
- }));