@schedule-x/react 2.25.0-alpha.0 → 2.25.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/dist/index.cjs +8 -5
- package/dist/index.cjs.js +8 -5
- package/dist/index.js +8 -5
- package/dist/types/schedule-x-calendar.d.ts +2 -2
- package/dist/types/use-calendar-app.d.ts +2 -4
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -17,11 +17,11 @@ function ScheduleXCalendar({ calendarApp, customComponents }) {
|
|
|
17
17
|
const setComponent = (component) => {
|
|
18
18
|
setCustomComponentsMeta((prev) => {
|
|
19
19
|
var _a, _b;
|
|
20
|
-
const ccid = (_b = (_a = component.wrapperElement) === null || _a ===
|
|
20
|
+
const ccid = (_b = (_a = component.wrapperElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.ccid;
|
|
21
21
|
if (!ccid)
|
|
22
22
|
return prev;
|
|
23
23
|
const newComponents = [...prev];
|
|
24
|
-
const existingComponent = newComponents.find((c) => { var _a, _b; return ((_b = (_a = c.wrapperElement) === null || _a ===
|
|
24
|
+
const existingComponent = newComponents.find((c) => { var _a, _b; return ((_b = (_a = c.wrapperElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.ccid) === ccid; });
|
|
25
25
|
if (existingComponent) {
|
|
26
26
|
newComponents.splice(newComponents.indexOf(existingComponent), 1);
|
|
27
27
|
}
|
|
@@ -33,7 +33,7 @@ function ScheduleXCalendar({ calendarApp, customComponents }) {
|
|
|
33
33
|
}, []);
|
|
34
34
|
react.useEffect(() => {
|
|
35
35
|
if (!calendarApp)
|
|
36
|
-
return; //
|
|
36
|
+
return; // before useEffect runs for the first time calendarApp is null
|
|
37
37
|
for (const [componentName, Component] of Object.entries(customComponents || {})) {
|
|
38
38
|
if (!Component)
|
|
39
39
|
continue;
|
|
@@ -53,11 +53,14 @@ function ScheduleXCalendar({ calendarApp, customComponents }) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function useCalendarApp(config, plugins) {
|
|
56
|
-
const [calendarApp] = react.useState(
|
|
56
|
+
const [calendarApp, setCalendarApp] = react.useState(null);
|
|
57
|
+
react.useEffect(() => {
|
|
58
|
+
setCalendarApp(calendar.createCalendar(config, plugins));
|
|
59
|
+
}, []);
|
|
57
60
|
return calendarApp;
|
|
58
61
|
}
|
|
59
62
|
function useNextCalendarApp(config, plugins) {
|
|
60
|
-
const [calendarApp, setCalendarApp] = react.useState();
|
|
63
|
+
const [calendarApp, setCalendarApp] = react.useState(null);
|
|
61
64
|
react.useEffect(() => {
|
|
62
65
|
if (typeof window !== 'undefined') {
|
|
63
66
|
setCalendarApp(calendar.createCalendar(config, plugins));
|
package/dist/index.cjs.js
CHANGED
|
@@ -17,11 +17,11 @@ function ScheduleXCalendar({ calendarApp, customComponents }) {
|
|
|
17
17
|
const setComponent = (component) => {
|
|
18
18
|
setCustomComponentsMeta((prev) => {
|
|
19
19
|
var _a, _b;
|
|
20
|
-
const ccid = (_b = (_a = component.wrapperElement) === null || _a ===
|
|
20
|
+
const ccid = (_b = (_a = component.wrapperElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.ccid;
|
|
21
21
|
if (!ccid)
|
|
22
22
|
return prev;
|
|
23
23
|
const newComponents = [...prev];
|
|
24
|
-
const existingComponent = newComponents.find((c) => { var _a, _b; return ((_b = (_a = c.wrapperElement) === null || _a ===
|
|
24
|
+
const existingComponent = newComponents.find((c) => { var _a, _b; return ((_b = (_a = c.wrapperElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.ccid) === ccid; });
|
|
25
25
|
if (existingComponent) {
|
|
26
26
|
newComponents.splice(newComponents.indexOf(existingComponent), 1);
|
|
27
27
|
}
|
|
@@ -33,7 +33,7 @@ function ScheduleXCalendar({ calendarApp, customComponents }) {
|
|
|
33
33
|
}, []);
|
|
34
34
|
react.useEffect(() => {
|
|
35
35
|
if (!calendarApp)
|
|
36
|
-
return; //
|
|
36
|
+
return; // before useEffect runs for the first time calendarApp is null
|
|
37
37
|
for (const [componentName, Component] of Object.entries(customComponents || {})) {
|
|
38
38
|
if (!Component)
|
|
39
39
|
continue;
|
|
@@ -53,11 +53,14 @@ function ScheduleXCalendar({ calendarApp, customComponents }) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function useCalendarApp(config, plugins) {
|
|
56
|
-
const [calendarApp] = react.useState(
|
|
56
|
+
const [calendarApp, setCalendarApp] = react.useState(null);
|
|
57
|
+
react.useEffect(() => {
|
|
58
|
+
setCalendarApp(calendar.createCalendar(config, plugins));
|
|
59
|
+
}, []);
|
|
57
60
|
return calendarApp;
|
|
58
61
|
}
|
|
59
62
|
function useNextCalendarApp(config, plugins) {
|
|
60
|
-
const [calendarApp, setCalendarApp] = react.useState();
|
|
63
|
+
const [calendarApp, setCalendarApp] = react.useState(null);
|
|
61
64
|
react.useEffect(() => {
|
|
62
65
|
if (typeof window !== 'undefined') {
|
|
63
66
|
setCalendarApp(calendar.createCalendar(config, plugins));
|
package/dist/index.js
CHANGED
|
@@ -15,11 +15,11 @@ function ScheduleXCalendar({ calendarApp, customComponents }) {
|
|
|
15
15
|
const setComponent = (component) => {
|
|
16
16
|
setCustomComponentsMeta((prev) => {
|
|
17
17
|
var _a, _b;
|
|
18
|
-
const ccid = (_b = (_a = component.wrapperElement) === null || _a ===
|
|
18
|
+
const ccid = (_b = (_a = component.wrapperElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.ccid;
|
|
19
19
|
if (!ccid)
|
|
20
20
|
return prev;
|
|
21
21
|
const newComponents = [...prev];
|
|
22
|
-
const existingComponent = newComponents.find((c) => { var _a, _b; return ((_b = (_a = c.wrapperElement) === null || _a ===
|
|
22
|
+
const existingComponent = newComponents.find((c) => { var _a, _b; return ((_b = (_a = c.wrapperElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.ccid) === ccid; });
|
|
23
23
|
if (existingComponent) {
|
|
24
24
|
newComponents.splice(newComponents.indexOf(existingComponent), 1);
|
|
25
25
|
}
|
|
@@ -31,7 +31,7 @@ function ScheduleXCalendar({ calendarApp, customComponents }) {
|
|
|
31
31
|
}, []);
|
|
32
32
|
useEffect(() => {
|
|
33
33
|
if (!calendarApp)
|
|
34
|
-
return; //
|
|
34
|
+
return; // before useEffect runs for the first time calendarApp is null
|
|
35
35
|
for (const [componentName, Component] of Object.entries(customComponents || {})) {
|
|
36
36
|
if (!Component)
|
|
37
37
|
continue;
|
|
@@ -51,11 +51,14 @@ function ScheduleXCalendar({ calendarApp, customComponents }) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function useCalendarApp(config, plugins) {
|
|
54
|
-
const [calendarApp] = useState(
|
|
54
|
+
const [calendarApp, setCalendarApp] = useState(null);
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
setCalendarApp(createCalendar(config, plugins));
|
|
57
|
+
}, []);
|
|
55
58
|
return calendarApp;
|
|
56
59
|
}
|
|
57
60
|
function useNextCalendarApp(config, plugins) {
|
|
58
|
-
const [calendarApp, setCalendarApp] = useState();
|
|
61
|
+
const [calendarApp, setCalendarApp] = useState(null);
|
|
59
62
|
useEffect(() => {
|
|
60
63
|
if (typeof window !== 'undefined') {
|
|
61
64
|
setCalendarApp(createCalendar(config, plugins));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CalendarApp } from '@schedule-x/calendar';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { CustomComponentName } from
|
|
3
|
+
import { CustomComponentName } from '@schedule-x/shared';
|
|
4
4
|
type ReactComponent = React.ComponentType<any>;
|
|
5
5
|
type props = {
|
|
6
|
-
calendarApp: CalendarApp |
|
|
6
|
+
calendarApp: CalendarApp | null;
|
|
7
7
|
customComponents?: {
|
|
8
8
|
[key in CustomComponentName]?: ReactComponent;
|
|
9
9
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { CalendarApp, CalendarConfig } from '@schedule-x/calendar';
|
|
2
2
|
import { PluginBase } from '@schedule-x/shared';
|
|
3
|
-
export declare function useCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp
|
|
4
|
-
|
|
5
|
-
}>; };
|
|
6
|
-
export declare function useNextCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp | undefined;
|
|
3
|
+
export declare function useCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp | null;
|
|
4
|
+
export declare function useNextCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp | null;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"main": "dist/index.cjs",
|
|
16
16
|
"module": "dist/index.js",
|
|
17
17
|
"types": "dist/types/index.d.ts",
|
|
18
|
-
"version": "2.25.0
|
|
18
|
+
"version": "2.25.0",
|
|
19
19
|
"type": "module",
|
|
20
20
|
"files": [
|
|
21
21
|
"dist"
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"build:publish": "npm run build && npm publish"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@schedule-x/calendar": "2.25.0
|
|
34
|
+
"@schedule-x/calendar": "^2.25.0",
|
|
35
35
|
"react": "^16.7.0 || ^17 || ^18 || ^19",
|
|
36
36
|
"react-dom": "^16.7.0 || ^17 || ^18 || ^19"
|
|
37
37
|
},
|
|
@@ -40,15 +40,15 @@
|
|
|
40
40
|
"@rollup/plugin-commonjs": "^28.0.0",
|
|
41
41
|
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
42
42
|
"@rollup/plugin-typescript": "^11.1.5",
|
|
43
|
-
"@schedule-x/calendar-controls": "^2.25.0
|
|
44
|
-
"@schedule-x/drag-and-drop": "^2.25.0
|
|
45
|
-
"@schedule-x/e2e-testing": "^2.25.0
|
|
43
|
+
"@schedule-x/calendar-controls": "^2.25.0",
|
|
44
|
+
"@schedule-x/drag-and-drop": "^2.25.0",
|
|
45
|
+
"@schedule-x/e2e-testing": "^2.25.0",
|
|
46
46
|
"@schedule-x/eslint-config": "^2.22.0",
|
|
47
|
-
"@schedule-x/event-modal": "^2.25.0
|
|
48
|
-
"@schedule-x/events-service": "^2.25.0
|
|
49
|
-
"@schedule-x/prettier-config": "^2.25.0
|
|
50
|
-
"@schedule-x/shared": "^2.25.0
|
|
51
|
-
"@schedule-x/theme-default": "^2.25.0
|
|
47
|
+
"@schedule-x/event-modal": "^2.25.0",
|
|
48
|
+
"@schedule-x/events-service": "^2.25.0",
|
|
49
|
+
"@schedule-x/prettier-config": "^2.25.0",
|
|
50
|
+
"@schedule-x/shared": "^2.25.0",
|
|
51
|
+
"@schedule-x/theme-default": "^2.25.0",
|
|
52
52
|
"@semantic-release/changelog": "^6.0.3",
|
|
53
53
|
"@semantic-release/git": "^10.0.1",
|
|
54
54
|
"@types/react": "^18.2.43",
|