@isma91/react-scheduler 4.0.0 → 4.0.1
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/package.json +4 -76
- package/.github/workflows/publish.yml +0 -29
- package/.github/workflows/tests.yml +0 -35
- package/.gitignore +0 -32
- package/.husky/pre-commit +0 -2
- package/.prettierignore +0 -1
- package/.prettierrc.json +0 -7
- package/.yarnrc.yml +0 -1
- package/dist/LICENSE +0 -24
- package/dist/README.md +0 -172
- package/dist/package.json +0 -65
- package/eslint.config.js +0 -79
- package/index.html +0 -41
- package/jest.config.ts +0 -194
- package/public/favicon.ico +0 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +0 -25
- package/public/robots.txt +0 -3
- package/scripts/post-pack.js +0 -34
- package/src/App.tsx +0 -25
- package/src/Page1.tsx +0 -67
- package/src/events.tsx +0 -227
- package/src/index.tsx +0 -21
- package/src/lib/SchedulerComponent.tsx +0 -78
- package/src/lib/__tests__/index.test.tsx +0 -24
- package/src/lib/components/common/Cell.tsx +0 -52
- package/src/lib/components/common/LocaleArrow.tsx +0 -38
- package/src/lib/components/common/ResourceHeader.tsx +0 -73
- package/src/lib/components/common/Tabs.tsx +0 -119
- package/src/lib/components/common/TodayTypo.tsx +0 -44
- package/src/lib/components/common/WithResources.tsx +0 -98
- package/src/lib/components/events/Actions.tsx +0 -65
- package/src/lib/components/events/AgendaEventsList.tsx +0 -115
- package/src/lib/components/events/CurrentTimeBar.tsx +0 -59
- package/src/lib/components/events/EmptyAgenda.tsx +0 -27
- package/src/lib/components/events/EventItem.tsx +0 -180
- package/src/lib/components/events/EventItemPopover.tsx +0 -179
- package/src/lib/components/events/MonthEvents.tsx +0 -141
- package/src/lib/components/events/TodayEvents.tsx +0 -99
- package/src/lib/components/hoc/DateProvider.tsx +0 -19
- package/src/lib/components/inputs/DatePicker.tsx +0 -95
- package/src/lib/components/inputs/Input.tsx +0 -113
- package/src/lib/components/inputs/SelectInput.tsx +0 -164
- package/src/lib/components/month/MonthTable.tsx +0 -207
- package/src/lib/components/nav/DayDateBtn.tsx +0 -77
- package/src/lib/components/nav/MonthDateBtn.tsx +0 -80
- package/src/lib/components/nav/Navigation.tsx +0 -201
- package/src/lib/components/nav/WeekDateBtn.tsx +0 -89
- package/src/lib/components/week/WeekTable.tsx +0 -229
- package/src/lib/helpers/constants.ts +0 -4
- package/src/lib/helpers/generals.tsx +0 -354
- package/src/lib/hooks/useArrowDisable.ts +0 -26
- package/src/lib/hooks/useCellAttributes.ts +0 -67
- package/src/lib/hooks/useDragAttributes.ts +0 -31
- package/src/lib/hooks/useEventPermissions.ts +0 -42
- package/src/lib/hooks/useStore.ts +0 -8
- package/src/lib/hooks/useSyncScroll.ts +0 -31
- package/src/lib/hooks/useWindowResize.ts +0 -37
- package/src/lib/index.tsx +0 -14
- package/src/lib/positionManger/context.ts +0 -14
- package/src/lib/positionManger/provider.tsx +0 -113
- package/src/lib/positionManger/usePosition.ts +0 -8
- package/src/lib/store/context.ts +0 -5
- package/src/lib/store/default.ts +0 -157
- package/src/lib/store/provider.tsx +0 -211
- package/src/lib/store/types.ts +0 -33
- package/src/lib/styles/styles.ts +0 -256
- package/src/lib/types.ts +0 -423
- package/src/lib/views/Day.tsx +0 -265
- package/src/lib/views/DayAgenda.tsx +0 -57
- package/src/lib/views/Editor.tsx +0 -258
- package/src/lib/views/Month.tsx +0 -82
- package/src/lib/views/MonthAgenda.tsx +0 -84
- package/src/lib/views/Week.tsx +0 -92
- package/src/lib/views/WeekAgenda.tsx +0 -81
- package/src/vite-env.d.ts +0 -3
- package/tsconfig.build.json +0 -5
- package/tsconfig.json +0 -27
- package/vite.config.js +0 -40
- /package/{dist/SchedulerComponent.d.ts → SchedulerComponent.d.ts} +0 -0
- /package/{dist/components → components}/common/Cell.d.ts +0 -0
- /package/{dist/components → components}/common/LocaleArrow.d.ts +0 -0
- /package/{dist/components → components}/common/ResourceHeader.d.ts +0 -0
- /package/{dist/components → components}/common/Tabs.d.ts +0 -0
- /package/{dist/components → components}/common/TodayTypo.d.ts +0 -0
- /package/{dist/components → components}/common/WithResources.d.ts +0 -0
- /package/{dist/components → components}/events/Actions.d.ts +0 -0
- /package/{dist/components → components}/events/AgendaEventsList.d.ts +0 -0
- /package/{dist/components → components}/events/CurrentTimeBar.d.ts +0 -0
- /package/{dist/components → components}/events/EmptyAgenda.d.ts +0 -0
- /package/{dist/components → components}/events/EventItem.d.ts +0 -0
- /package/{dist/components → components}/events/EventItemPopover.d.ts +0 -0
- /package/{dist/components → components}/events/MonthEvents.d.ts +0 -0
- /package/{dist/components → components}/events/TodayEvents.d.ts +0 -0
- /package/{dist/components → components}/hoc/DateProvider.d.ts +0 -0
- /package/{dist/components → components}/inputs/DatePicker.d.ts +0 -0
- /package/{dist/components → components}/inputs/Input.d.ts +0 -0
- /package/{dist/components → components}/inputs/SelectInput.d.ts +0 -0
- /package/{dist/components → components}/month/MonthTable.d.ts +0 -0
- /package/{dist/components → components}/nav/DayDateBtn.d.ts +0 -0
- /package/{dist/components → components}/nav/MonthDateBtn.d.ts +0 -0
- /package/{dist/components → components}/nav/Navigation.d.ts +0 -0
- /package/{dist/components → components}/nav/WeekDateBtn.d.ts +0 -0
- /package/{dist/components → components}/week/WeekTable.d.ts +0 -0
- /package/{dist/helpers → helpers}/constants.d.ts +0 -0
- /package/{dist/helpers → helpers}/generals.d.ts +0 -0
- /package/{dist/hooks → hooks}/useArrowDisable.d.ts +0 -0
- /package/{dist/hooks → hooks}/useCellAttributes.d.ts +0 -0
- /package/{dist/hooks → hooks}/useDragAttributes.d.ts +0 -0
- /package/{dist/hooks → hooks}/useEventPermissions.d.ts +0 -0
- /package/{dist/hooks → hooks}/useStore.d.ts +0 -0
- /package/{dist/hooks → hooks}/useSyncScroll.d.ts +0 -0
- /package/{dist/hooks → hooks}/useWindowResize.d.ts +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/positionManger → positionManger}/context.d.ts +0 -0
- /package/{dist/positionManger → positionManger}/provider.d.ts +0 -0
- /package/{dist/positionManger → positionManger}/usePosition.d.ts +0 -0
- /package/{dist/store → store}/context.d.ts +0 -0
- /package/{dist/store → store}/default.d.ts +0 -0
- /package/{dist/store → store}/provider.d.ts +0 -0
- /package/{dist/store → store}/types.d.ts +0 -0
- /package/{dist/styles → styles}/styles.d.ts +0 -0
- /package/{dist/types.d.ts → types.d.ts} +0 -0
- /package/{dist/views → views}/Day.d.ts +0 -0
- /package/{dist/views → views}/DayAgenda.d.ts +0 -0
- /package/{dist/views → views}/Editor.d.ts +0 -0
- /package/{dist/views → views}/Month.d.ts +0 -0
- /package/{dist/views → views}/MonthAgenda.d.ts +0 -0
- /package/{dist/views → views}/Week.d.ts +0 -0
- /package/{dist/views → views}/WeekAgenda.d.ts +0 -0
package/jest.config.ts
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* For a detailed explanation regarding each configuration property and type check, visit:
|
|
3
|
-
* https://jestjs.io/docs/configuration
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export default {
|
|
7
|
-
// All imported modules in your tests should be mocked automatically
|
|
8
|
-
// automock: false,
|
|
9
|
-
|
|
10
|
-
// Stop running tests after `n` failures
|
|
11
|
-
// bail: 0,
|
|
12
|
-
|
|
13
|
-
// The directory where Jest should store its cached dependency information
|
|
14
|
-
// cacheDirectory: "/tmp/jest_rs",
|
|
15
|
-
|
|
16
|
-
// Automatically clear mock calls, instances and results before every test
|
|
17
|
-
// clearMocks: false,
|
|
18
|
-
|
|
19
|
-
// Indicates whether the coverage information should be collected while executing the test
|
|
20
|
-
// collectCoverage: false,
|
|
21
|
-
|
|
22
|
-
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
23
|
-
// collectCoverageFrom: undefined,
|
|
24
|
-
|
|
25
|
-
// The directory where Jest should output its coverage files
|
|
26
|
-
// coverageDirectory: undefined,
|
|
27
|
-
|
|
28
|
-
// An array of regexp pattern strings used to skip coverage collection
|
|
29
|
-
// coveragePathIgnorePatterns: [
|
|
30
|
-
// "/node_modules/"
|
|
31
|
-
// ],
|
|
32
|
-
|
|
33
|
-
// Indicates which provider should be used to instrument code for coverage
|
|
34
|
-
// coverageProvider: "babel",
|
|
35
|
-
|
|
36
|
-
// A list of reporter names that Jest uses when writing coverage reports
|
|
37
|
-
// coverageReporters: [
|
|
38
|
-
// "json",
|
|
39
|
-
// "text",
|
|
40
|
-
// "lcov",
|
|
41
|
-
// "clover"
|
|
42
|
-
// ],
|
|
43
|
-
|
|
44
|
-
// An object that configures minimum threshold enforcement for coverage results
|
|
45
|
-
// coverageThreshold: undefined,
|
|
46
|
-
|
|
47
|
-
// A path to a custom dependency extractor
|
|
48
|
-
// dependencyExtractor: undefined,
|
|
49
|
-
|
|
50
|
-
// Make calling deprecated APIs throw helpful error messages
|
|
51
|
-
// errorOnDeprecated: false,
|
|
52
|
-
|
|
53
|
-
// Force coverage collection from ignored files using an array of glob patterns
|
|
54
|
-
// forceCoverageMatch: [],
|
|
55
|
-
|
|
56
|
-
// A path to a module which exports an async function that is triggered once before all test suites
|
|
57
|
-
// globalSetup: undefined,
|
|
58
|
-
|
|
59
|
-
// A path to a module which exports an async function that is triggered once after all test suites
|
|
60
|
-
// globalTeardown: undefined,
|
|
61
|
-
|
|
62
|
-
// A set of global variables that need to be available in all test environments
|
|
63
|
-
// globals: {},
|
|
64
|
-
|
|
65
|
-
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
66
|
-
// maxWorkers: "50%",
|
|
67
|
-
|
|
68
|
-
// An array of directory names to be searched recursively up from the requiring module's location
|
|
69
|
-
// moduleDirectories: [
|
|
70
|
-
// "node_modules"
|
|
71
|
-
// ],
|
|
72
|
-
|
|
73
|
-
// An array of file extensions your modules use
|
|
74
|
-
// moduleFileExtensions: [
|
|
75
|
-
// "js",
|
|
76
|
-
// "jsx",
|
|
77
|
-
// "ts",
|
|
78
|
-
// "tsx",
|
|
79
|
-
// "json",
|
|
80
|
-
// "node"
|
|
81
|
-
// ],
|
|
82
|
-
|
|
83
|
-
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
|
84
|
-
// moduleNameMapper: {},
|
|
85
|
-
|
|
86
|
-
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
87
|
-
// modulePathIgnorePatterns: [],
|
|
88
|
-
|
|
89
|
-
// Activates notifications for test results
|
|
90
|
-
// notify: false,
|
|
91
|
-
|
|
92
|
-
// An enum that specifies notification mode. Requires { notify: true }
|
|
93
|
-
// notifyMode: "failure-change",
|
|
94
|
-
|
|
95
|
-
// A preset that is used as a base for Jest's configuration
|
|
96
|
-
// preset: undefined,
|
|
97
|
-
|
|
98
|
-
// Run tests from one or more projects
|
|
99
|
-
// projects: undefined,
|
|
100
|
-
|
|
101
|
-
// Use this configuration option to add custom reporters to Jest
|
|
102
|
-
// reporters: undefined,
|
|
103
|
-
|
|
104
|
-
// Automatically reset mock state before every test
|
|
105
|
-
// resetMocks: false,
|
|
106
|
-
|
|
107
|
-
// Reset the module registry before running each individual test
|
|
108
|
-
// resetModules: false,
|
|
109
|
-
|
|
110
|
-
// A path to a custom resolver
|
|
111
|
-
// resolver: undefined,
|
|
112
|
-
|
|
113
|
-
// Automatically restore mock state and implementation before every test
|
|
114
|
-
// restoreMocks: false,
|
|
115
|
-
|
|
116
|
-
// The root directory that Jest should scan for tests and modules within
|
|
117
|
-
// rootDir: undefined,
|
|
118
|
-
|
|
119
|
-
// A list of paths to directories that Jest should use to search for files in
|
|
120
|
-
roots: ["<rootDir>/src"],
|
|
121
|
-
|
|
122
|
-
// Allows you to use a custom runner instead of Jest's default test runner
|
|
123
|
-
// runner: "jest-runner",
|
|
124
|
-
|
|
125
|
-
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
126
|
-
// setupFiles: [],
|
|
127
|
-
|
|
128
|
-
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
129
|
-
// setupFilesAfterEnv: [],
|
|
130
|
-
|
|
131
|
-
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
|
132
|
-
// slowTestThreshold: 5,
|
|
133
|
-
|
|
134
|
-
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
135
|
-
// snapshotSerializers: [],
|
|
136
|
-
|
|
137
|
-
// The test environment that will be used for testing
|
|
138
|
-
testEnvironment: "jest-environment-jsdom",
|
|
139
|
-
|
|
140
|
-
// Options that will be passed to the testEnvironment
|
|
141
|
-
// testEnvironmentOptions: {},
|
|
142
|
-
|
|
143
|
-
// Adds a location field to test results
|
|
144
|
-
// testLocationInResults: false,
|
|
145
|
-
|
|
146
|
-
// The glob patterns Jest uses to detect test files
|
|
147
|
-
// testMatch: [
|
|
148
|
-
// "**/__tests__/**/*.[jt]s?(x)",
|
|
149
|
-
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
|
150
|
-
// ],
|
|
151
|
-
|
|
152
|
-
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
153
|
-
// testPathIgnorePatterns: [
|
|
154
|
-
// "/node_modules/"
|
|
155
|
-
// ],
|
|
156
|
-
|
|
157
|
-
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
158
|
-
// testRegex: [],
|
|
159
|
-
|
|
160
|
-
// This option allows the use of a custom results processor
|
|
161
|
-
// testResultsProcessor: undefined,
|
|
162
|
-
|
|
163
|
-
// This option allows use of a custom test runner
|
|
164
|
-
// testRunner: "jest-circus/runner",
|
|
165
|
-
|
|
166
|
-
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
|
|
167
|
-
// testURL: "http://localhost",
|
|
168
|
-
|
|
169
|
-
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
|
|
170
|
-
// timers: "real",
|
|
171
|
-
|
|
172
|
-
// A map from regular expressions to paths to transformers
|
|
173
|
-
transform: {
|
|
174
|
-
"^.+\\.(ts|js)x?$": "ts-jest",
|
|
175
|
-
},
|
|
176
|
-
|
|
177
|
-
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
178
|
-
// transformIgnorePatterns: [
|
|
179
|
-
// "/node_modules/",
|
|
180
|
-
// "\\.pnp\\.[^\\/]+$"
|
|
181
|
-
// ],
|
|
182
|
-
|
|
183
|
-
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
184
|
-
// unmockedModulePathPatterns: undefined,
|
|
185
|
-
|
|
186
|
-
// Indicates whether each individual test should be reported during the run
|
|
187
|
-
// verbose: undefined,
|
|
188
|
-
|
|
189
|
-
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
190
|
-
// watchPathIgnorePatterns: [],
|
|
191
|
-
|
|
192
|
-
// Whether to use watchman for file crawling
|
|
193
|
-
// watchman: true,
|
|
194
|
-
};
|
package/public/favicon.ico
DELETED
|
Binary file
|
package/public/logo192.png
DELETED
|
Binary file
|
package/public/logo512.png
DELETED
|
Binary file
|
package/public/manifest.json
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"short_name": "React App",
|
|
3
|
-
"name": "Create React App Sample",
|
|
4
|
-
"icons": [
|
|
5
|
-
{
|
|
6
|
-
"src": "favicon.ico",
|
|
7
|
-
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
-
"type": "image/x-icon"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"src": "logo192.png",
|
|
12
|
-
"type": "image/png",
|
|
13
|
-
"sizes": "192x192"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
"src": "logo512.png",
|
|
17
|
-
"type": "image/png",
|
|
18
|
-
"sizes": "512x512"
|
|
19
|
-
}
|
|
20
|
-
],
|
|
21
|
-
"start_url": ".",
|
|
22
|
-
"display": "standalone",
|
|
23
|
-
"theme_color": "#000000",
|
|
24
|
-
"background_color": "#ffffff"
|
|
25
|
-
}
|
package/public/robots.txt
DELETED
package/scripts/post-pack.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
|
|
4
|
-
const init = async () => {
|
|
5
|
-
try {
|
|
6
|
-
const base = path.resolve("");
|
|
7
|
-
const files = ["LICENSE", "README.md"];
|
|
8
|
-
for (const file of files) {
|
|
9
|
-
await fs.promises.copyFile(path.join(base, file), path.join(base, "dist", file));
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// clean up package.json on the fly
|
|
13
|
-
const pkg = await fs.promises.readFile(path.join(base, "package.json"), {
|
|
14
|
-
encoding: "utf-8",
|
|
15
|
-
});
|
|
16
|
-
const obj = JSON.parse(pkg);
|
|
17
|
-
delete obj.scripts;
|
|
18
|
-
delete obj.devDependencies;
|
|
19
|
-
delete obj["lint-staged"];
|
|
20
|
-
obj.homepage = "https://github.com/aldabil21/react-scheduler#readme";
|
|
21
|
-
|
|
22
|
-
await fs.promises.writeFile(
|
|
23
|
-
path.join(base, "dist", "package.json"),
|
|
24
|
-
JSON.stringify(obj, null, 2),
|
|
25
|
-
{
|
|
26
|
-
encoding: "utf-8",
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
} catch (error) {
|
|
30
|
-
throw error;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
init();
|
package/src/App.tsx
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Scheduler } from "./lib";
|
|
2
|
-
import { EVENTS } from "./events";
|
|
3
|
-
import { useRef } from "react";
|
|
4
|
-
import { SchedulerRef } from "./lib/types";
|
|
5
|
-
import { Link } from "react-router-dom";
|
|
6
|
-
|
|
7
|
-
function App() {
|
|
8
|
-
const calendarRef = useRef<SchedulerRef>(null);
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<>
|
|
12
|
-
<div>
|
|
13
|
-
<Link to="/1">Go to page 1</Link>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<Scheduler
|
|
17
|
-
ref={calendarRef}
|
|
18
|
-
events={EVENTS}
|
|
19
|
-
// events={generateRandomEvents(200)}
|
|
20
|
-
/>
|
|
21
|
-
</>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export default App;
|
package/src/Page1.tsx
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Scheduler } from "./lib";
|
|
2
|
-
import { EVENTS } from "./events";
|
|
3
|
-
import { useCallback, useRef, useState } from "react";
|
|
4
|
-
import { SchedulerRef } from "./lib/types";
|
|
5
|
-
import { Link } from "react-router-dom";
|
|
6
|
-
import { Button } from "@mui/material";
|
|
7
|
-
|
|
8
|
-
function Page1() {
|
|
9
|
-
const calendarRef = useRef<SchedulerRef>(null);
|
|
10
|
-
const [loading, setLoading] = useState(false);
|
|
11
|
-
|
|
12
|
-
const handleRefresh = () => {
|
|
13
|
-
setLoading(true);
|
|
14
|
-
setTimeout(() => {
|
|
15
|
-
setLoading(false);
|
|
16
|
-
}, 2000);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const customHeader = useCallback(
|
|
20
|
-
() => <Button onClick={handleRefresh}>{loading ? "LOADING..." : "Refresh"}</Button>,
|
|
21
|
-
[loading, handleRefresh]
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<>
|
|
26
|
-
<div style={{ height: "200vh" }}>
|
|
27
|
-
<div>
|
|
28
|
-
<Link to="/">Go to home</Link>
|
|
29
|
-
<button onClick={() => setLoading((prev) => !prev)}>
|
|
30
|
-
Toggle Loading ({loading ? "ON" : "OFF"})
|
|
31
|
-
</button>
|
|
32
|
-
</div>
|
|
33
|
-
|
|
34
|
-
<div style={{ marginTop: "50px" }}>
|
|
35
|
-
<Scheduler
|
|
36
|
-
day={{
|
|
37
|
-
startHour: 0,
|
|
38
|
-
endHour: 24,
|
|
39
|
-
step: 60,
|
|
40
|
-
navigation: true,
|
|
41
|
-
}}
|
|
42
|
-
week={{
|
|
43
|
-
weekDays: [0, 1, 2, 3, 4, 5, 6],
|
|
44
|
-
weekStartOn: 1,
|
|
45
|
-
startHour: 0,
|
|
46
|
-
endHour: 24,
|
|
47
|
-
step: 60,
|
|
48
|
-
navigation: true,
|
|
49
|
-
disableGoToDay: true,
|
|
50
|
-
}}
|
|
51
|
-
ref={calendarRef}
|
|
52
|
-
events={EVENTS}
|
|
53
|
-
loading={loading}
|
|
54
|
-
customHeaderContent={customHeader}
|
|
55
|
-
stickyNavigation={true}
|
|
56
|
-
stickyNavigationOffset={64}
|
|
57
|
-
currentTimeBarColor="#ff00c3ff"
|
|
58
|
-
forceInlineMultiDay={true}
|
|
59
|
-
// events={generateRandomEvents(200)}
|
|
60
|
-
/>
|
|
61
|
-
</div>
|
|
62
|
-
</div>
|
|
63
|
-
</>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export default Page1;
|
package/src/events.tsx
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
import { datetime, RRule } from "rrule";
|
|
2
|
-
import { ProcessedEvent } from "./lib/types";
|
|
3
|
-
|
|
4
|
-
export const EVENTS: ProcessedEvent[] = [
|
|
5
|
-
{
|
|
6
|
-
event_id: 1,
|
|
7
|
-
title: "Event 1 (Disabled)",
|
|
8
|
-
subtitle: "This event is disabled",
|
|
9
|
-
start: new Date(new Date(new Date().setHours(9)).setMinutes(0)),
|
|
10
|
-
end: new Date(new Date(new Date().setHours(10)).setMinutes(0)),
|
|
11
|
-
disabled: true,
|
|
12
|
-
admin_id: [1, 2, 3, 4],
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
event_id: 2,
|
|
16
|
-
title: "Event 2",
|
|
17
|
-
subtitle: "This event is draggable",
|
|
18
|
-
start: new Date(new Date(new Date().setHours(10)).setMinutes(0)),
|
|
19
|
-
end: new Date(new Date(new Date().setHours(12)).setMinutes(0)),
|
|
20
|
-
admin_id: 2,
|
|
21
|
-
color: "#50b500",
|
|
22
|
-
agendaAvatar: "E",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
event_id: 3,
|
|
26
|
-
title: "Event 3",
|
|
27
|
-
subtitle: "This event is not editable",
|
|
28
|
-
start: new Date(new Date(new Date().setHours(11)).setMinutes(0)),
|
|
29
|
-
end: new Date(new Date(new Date().setHours(12)).setMinutes(0)),
|
|
30
|
-
admin_id: 1,
|
|
31
|
-
editable: false,
|
|
32
|
-
deletable: false,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
event_id: 4,
|
|
36
|
-
title: "Event 4",
|
|
37
|
-
start: new Date(
|
|
38
|
-
new Date(new Date(new Date().setHours(9)).setMinutes(30)).setDate(new Date().getDate() - 2)
|
|
39
|
-
),
|
|
40
|
-
end: new Date(
|
|
41
|
-
new Date(new Date(new Date().setHours(11)).setMinutes(0)).setDate(new Date().getDate() - 2)
|
|
42
|
-
),
|
|
43
|
-
admin_id: [2, 3],
|
|
44
|
-
color: "#900000",
|
|
45
|
-
allDay: true,
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
event_id: 5,
|
|
49
|
-
title: "Event 5",
|
|
50
|
-
subtitle: "This event is editable",
|
|
51
|
-
start: new Date(
|
|
52
|
-
new Date(new Date(new Date().setHours(10)).setMinutes(30)).setDate(new Date().getDate() - 2)
|
|
53
|
-
),
|
|
54
|
-
end: new Date(
|
|
55
|
-
new Date(new Date(new Date().setHours(14)).setMinutes(0)).setDate(new Date().getDate() - 2)
|
|
56
|
-
),
|
|
57
|
-
admin_id: 2,
|
|
58
|
-
editable: true,
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
event_id: 6,
|
|
62
|
-
title: "Event 6",
|
|
63
|
-
subtitle: "This event is all day",
|
|
64
|
-
start: new Date(
|
|
65
|
-
new Date(new Date(new Date().setHours(20)).setMinutes(30)).setDate(new Date().getDate() - 3)
|
|
66
|
-
),
|
|
67
|
-
end: new Date(new Date(new Date().setHours(23)).setMinutes(0)),
|
|
68
|
-
admin_id: 2,
|
|
69
|
-
allDay: true,
|
|
70
|
-
sx: { color: "purple" },
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
event_id: 7,
|
|
74
|
-
title: "Event 7 (Not draggable)",
|
|
75
|
-
subtitle: "This event is not draggable",
|
|
76
|
-
start: new Date(
|
|
77
|
-
new Date(new Date(new Date().setHours(10)).setMinutes(30)).setDate(new Date().getDate() - 3)
|
|
78
|
-
),
|
|
79
|
-
end: new Date(
|
|
80
|
-
new Date(new Date(new Date().setHours(14)).setMinutes(30)).setDate(new Date().getDate() - 3)
|
|
81
|
-
),
|
|
82
|
-
admin_id: 1,
|
|
83
|
-
draggable: false,
|
|
84
|
-
color: "#8000cc",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
event_id: 8,
|
|
88
|
-
title: "Event 8",
|
|
89
|
-
subtitle: "This event has a custom color",
|
|
90
|
-
start: new Date(
|
|
91
|
-
new Date(new Date(new Date().setHours(10)).setMinutes(30)).setDate(new Date().getDate() + 30)
|
|
92
|
-
),
|
|
93
|
-
end: new Date(
|
|
94
|
-
new Date(new Date(new Date().setHours(14)).setMinutes(30)).setDate(new Date().getDate() + 30)
|
|
95
|
-
),
|
|
96
|
-
admin_id: 1,
|
|
97
|
-
color: "#8000cc",
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
event_id: 9,
|
|
101
|
-
title: "Event 9",
|
|
102
|
-
subtitle: `This event is a recurring weekly until ${new Date(
|
|
103
|
-
new Date().setMonth(
|
|
104
|
-
new Date(
|
|
105
|
-
new Date(new Date(new Date().setHours(11)).setMinutes(0)).setDate(
|
|
106
|
-
new Date().getDate() + 1
|
|
107
|
-
)
|
|
108
|
-
).getMonth() + 1
|
|
109
|
-
)
|
|
110
|
-
).toDateString()}`,
|
|
111
|
-
start: new Date(
|
|
112
|
-
new Date(new Date(new Date().setHours(10)).setMinutes(0)).setDate(new Date().getDate() + 1)
|
|
113
|
-
),
|
|
114
|
-
end: new Date(
|
|
115
|
-
new Date(new Date(new Date().setHours(11)).setMinutes(0)).setDate(new Date().getDate() + 1)
|
|
116
|
-
),
|
|
117
|
-
recurring: new RRule({
|
|
118
|
-
freq: RRule.WEEKLY,
|
|
119
|
-
dtstart: convertDateToRRuleDate(
|
|
120
|
-
new Date(
|
|
121
|
-
new Date(new Date(new Date().setHours(10)).setMinutes(0)).setDate(
|
|
122
|
-
new Date().getDate() - 20
|
|
123
|
-
)
|
|
124
|
-
)
|
|
125
|
-
),
|
|
126
|
-
until: new Date(
|
|
127
|
-
new Date().setMonth(
|
|
128
|
-
new Date(
|
|
129
|
-
new Date(new Date(new Date().setHours(11)).setMinutes(0)).setDate(
|
|
130
|
-
new Date().getDate() + 1
|
|
131
|
-
)
|
|
132
|
-
).getMonth() + 1
|
|
133
|
-
)
|
|
134
|
-
),
|
|
135
|
-
}),
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
event_id: 10,
|
|
139
|
-
title: "Event 10",
|
|
140
|
-
subtitle: "This event is a recurring hourly 3 times",
|
|
141
|
-
start: new Date(new Date(new Date().setHours(14)).setMinutes(15)),
|
|
142
|
-
end: new Date(new Date(new Date().setHours(14)).setMinutes(45)),
|
|
143
|
-
recurring: new RRule({
|
|
144
|
-
freq: RRule.HOURLY,
|
|
145
|
-
count: 3,
|
|
146
|
-
dtstart: convertDateToRRuleDate(new Date(new Date(new Date().setHours(14)).setMinutes(15))),
|
|
147
|
-
}),
|
|
148
|
-
color: "#dc4552",
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
event_id: 11,
|
|
152
|
-
title: "Event 11",
|
|
153
|
-
start: new Date(
|
|
154
|
-
new Date(new Date(new Date().setHours(9)).setMinutes(0)).setDate(new Date().getDate() - 2)
|
|
155
|
-
),
|
|
156
|
-
end: new Date(
|
|
157
|
-
new Date(new Date(new Date().setHours(2)).setMinutes(0)).setDate(new Date().getDate() + 2)
|
|
158
|
-
),
|
|
159
|
-
color: "#079000ff",
|
|
160
|
-
allDay: false,
|
|
161
|
-
},
|
|
162
|
-
];
|
|
163
|
-
|
|
164
|
-
export const RESOURCES = [
|
|
165
|
-
{
|
|
166
|
-
admin_id: 1,
|
|
167
|
-
title: "One",
|
|
168
|
-
mobile: "555666777",
|
|
169
|
-
avatar: "",
|
|
170
|
-
color: "#ab2d2d",
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
admin_id: 2,
|
|
174
|
-
title: "Two is very long name",
|
|
175
|
-
mobile: "555666777",
|
|
176
|
-
avatar: "https://picsum.photos/200/300",
|
|
177
|
-
color: "#58ab2d",
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
admin_id: 3,
|
|
181
|
-
title: "Three",
|
|
182
|
-
mobile: "555666777",
|
|
183
|
-
avatar: "https://picsum.photos/200/300",
|
|
184
|
-
color: "#a001a2",
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
admin_id: 4,
|
|
188
|
-
title: "Four",
|
|
189
|
-
mobile: "555666777",
|
|
190
|
-
avatar: "https://picsum.photos/200/300",
|
|
191
|
-
color: "#08c5bd",
|
|
192
|
-
},
|
|
193
|
-
];
|
|
194
|
-
|
|
195
|
-
export const generateRandomEvents = (total = 300) => {
|
|
196
|
-
const events = [];
|
|
197
|
-
for (let i = 0; i < total; i++) {
|
|
198
|
-
const day = Math.round(i % 15);
|
|
199
|
-
events.push({
|
|
200
|
-
event_id: Math.random(),
|
|
201
|
-
title: "Event " + (i + 1),
|
|
202
|
-
start: new Date(
|
|
203
|
-
new Date(new Date(new Date().setHours(10)).setMinutes(30)).setDate(
|
|
204
|
-
new Date().getDate() + day
|
|
205
|
-
)
|
|
206
|
-
),
|
|
207
|
-
end: new Date(
|
|
208
|
-
new Date(new Date(new Date().setHours(14)).setMinutes(0)).setDate(
|
|
209
|
-
new Date().getDate() + day
|
|
210
|
-
)
|
|
211
|
-
),
|
|
212
|
-
// allDay: Math.random() > 0.5,
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return events;
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
function convertDateToRRuleDate(date: Date) {
|
|
220
|
-
return datetime(
|
|
221
|
-
date.getFullYear(),
|
|
222
|
-
date.getMonth() + 1,
|
|
223
|
-
date.getDate(),
|
|
224
|
-
date.getHours(),
|
|
225
|
-
date.getMinutes()
|
|
226
|
-
);
|
|
227
|
-
}
|
package/src/index.tsx
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { CssBaseline, ThemeProvider, createTheme } from "@mui/material";
|
|
3
|
-
import { createRoot } from "react-dom/client";
|
|
4
|
-
import App from "./App";
|
|
5
|
-
import { BrowserRouter, Route, Routes } from "react-router-dom";
|
|
6
|
-
import Page1 from "./Page1";
|
|
7
|
-
|
|
8
|
-
const root = createRoot(document.getElementById("root") as HTMLElement);
|
|
9
|
-
root.render(
|
|
10
|
-
<React.StrictMode>
|
|
11
|
-
<ThemeProvider theme={createTheme()}>
|
|
12
|
-
<CssBaseline />
|
|
13
|
-
<BrowserRouter>
|
|
14
|
-
<Routes>
|
|
15
|
-
<Route path="/" element={<App />} />
|
|
16
|
-
<Route path="/1" element={<Page1 />} />
|
|
17
|
-
</Routes>
|
|
18
|
-
</BrowserRouter>
|
|
19
|
-
</ThemeProvider>
|
|
20
|
-
</React.StrictMode>
|
|
21
|
-
);
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Week } from "./views/Week";
|
|
2
|
-
import { Navigation } from "./components/nav/Navigation";
|
|
3
|
-
import Editor from "./views/Editor";
|
|
4
|
-
import { CircularProgress, Typography } from "@mui/material";
|
|
5
|
-
import { Month } from "./views/Month";
|
|
6
|
-
import { Day } from "./views/Day";
|
|
7
|
-
import { Table, Wrapper } from "./styles/styles";
|
|
8
|
-
import { forwardRef, useMemo } from "react";
|
|
9
|
-
import useStore from "./hooks/useStore";
|
|
10
|
-
import { SchedulerRef } from "./types";
|
|
11
|
-
import { PositionProvider } from "./positionManger/provider";
|
|
12
|
-
|
|
13
|
-
const SchedulerComponent = forwardRef<SchedulerRef, unknown>(function SchedulerComponent(_, ref) {
|
|
14
|
-
const store = useStore();
|
|
15
|
-
const { view, dialog, loading, loadingComponent, resourceViewMode, resources, translations } =
|
|
16
|
-
store;
|
|
17
|
-
|
|
18
|
-
const Views = useMemo(() => {
|
|
19
|
-
switch (view) {
|
|
20
|
-
case "month":
|
|
21
|
-
return <Month />;
|
|
22
|
-
case "week":
|
|
23
|
-
return <Week />;
|
|
24
|
-
case "day":
|
|
25
|
-
return <Day />;
|
|
26
|
-
default:
|
|
27
|
-
return "";
|
|
28
|
-
}
|
|
29
|
-
}, [view]);
|
|
30
|
-
|
|
31
|
-
const LoadingComp = useMemo(() => {
|
|
32
|
-
return (
|
|
33
|
-
<div className="rs__table_loading">
|
|
34
|
-
{loadingComponent || (
|
|
35
|
-
<div className="rs__table_loading_internal">
|
|
36
|
-
<span>
|
|
37
|
-
<CircularProgress size={50} />
|
|
38
|
-
<Typography align="center">{translations.loading}</Typography>
|
|
39
|
-
</span>
|
|
40
|
-
</div>
|
|
41
|
-
)}
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
}, [loadingComponent, translations.loading]);
|
|
45
|
-
|
|
46
|
-
return (
|
|
47
|
-
<Wrapper
|
|
48
|
-
dialog={dialog ? 1 : 0}
|
|
49
|
-
data-testid="rs-wrapper"
|
|
50
|
-
ref={(el) => {
|
|
51
|
-
const calendarRef = ref as any;
|
|
52
|
-
if (calendarRef) {
|
|
53
|
-
calendarRef.current = {
|
|
54
|
-
el,
|
|
55
|
-
scheduler: store,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}}
|
|
59
|
-
>
|
|
60
|
-
{loading ? LoadingComp : null}
|
|
61
|
-
<Navigation />
|
|
62
|
-
<Table
|
|
63
|
-
resource_count={resourceViewMode === "default" ? resources.length : 1}
|
|
64
|
-
// Temp resources/default `sticky` wontfix
|
|
65
|
-
sx={{
|
|
66
|
-
overflowX: resourceViewMode === "default" && resources.length > 1 ? "auto" : undefined,
|
|
67
|
-
flexDirection: resourceViewMode === "vertical" ? "column" : undefined,
|
|
68
|
-
}}
|
|
69
|
-
data-testid="grid"
|
|
70
|
-
>
|
|
71
|
-
<PositionProvider>{Views}</PositionProvider>
|
|
72
|
-
</Table>
|
|
73
|
-
{dialog && <Editor />}
|
|
74
|
-
</Wrapper>
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
export default SchedulerComponent;
|