@schedule-x/react
Advanced tools
+5
-8
@@ -20,7 +20,7 @@ 'use strict'; | ||
| var _a, _b; | ||
| const ccid = (_b = (_a = component.wrapperElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.ccid; | ||
| const ccid = (_b = (_a = component.wrapperElement) === null || _a === undefined ? undefined : _a.dataset) === null || _b === undefined ? undefined : _b.ccid; | ||
| if (!ccid) | ||
| return prev; | ||
| const newComponents = [...prev]; | ||
| 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; }); | ||
| const existingComponent = newComponents.find((c) => { var _a, _b; return ((_b = (_a = c.wrapperElement) === null || _a === undefined ? undefined : _a.dataset) === null || _b === undefined ? undefined : _b.ccid) === ccid; }); | ||
| if (existingComponent) { | ||
@@ -37,3 +37,3 @@ newComponents.splice(newComponents.indexOf(existingComponent), 1); | ||
| if (!calendarApp) | ||
| return; // before useEffect runs for the first time calendarApp is null | ||
| return; // in SSR, calendarApp will be undefined | ||
| for (const [componentName, Component] of Object.entries(customComponents || {})) { | ||
@@ -58,10 +58,7 @@ if (!Component) | ||
| function useCalendarApp(config, plugins) { | ||
| const [calendarApp, setCalendarApp] = react.useState(null); | ||
| react.useEffect(() => { | ||
| setCalendarApp(calendar.createCalendar(config, plugins)); | ||
| }, []); | ||
| const [calendarApp] = react.useState(() => calendar.createCalendar(config, plugins)); | ||
| return calendarApp; | ||
| } | ||
| function useNextCalendarApp(config, plugins) { | ||
| const [calendarApp, setCalendarApp] = react.useState(null); | ||
| const [calendarApp, setCalendarApp] = react.useState(); | ||
| react.useEffect(() => { | ||
@@ -68,0 +65,0 @@ if (typeof window !== 'undefined') { |
@@ -20,7 +20,7 @@ 'use strict'; | ||
| var _a, _b; | ||
| const ccid = (_b = (_a = component.wrapperElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.ccid; | ||
| const ccid = (_b = (_a = component.wrapperElement) === null || _a === undefined ? undefined : _a.dataset) === null || _b === undefined ? undefined : _b.ccid; | ||
| if (!ccid) | ||
| return prev; | ||
| const newComponents = [...prev]; | ||
| 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; }); | ||
| const existingComponent = newComponents.find((c) => { var _a, _b; return ((_b = (_a = c.wrapperElement) === null || _a === undefined ? undefined : _a.dataset) === null || _b === undefined ? undefined : _b.ccid) === ccid; }); | ||
| if (existingComponent) { | ||
@@ -37,3 +37,3 @@ newComponents.splice(newComponents.indexOf(existingComponent), 1); | ||
| if (!calendarApp) | ||
| return; // before useEffect runs for the first time calendarApp is null | ||
| return; // in SSR, calendarApp will be undefined | ||
| for (const [componentName, Component] of Object.entries(customComponents || {})) { | ||
@@ -58,10 +58,7 @@ if (!Component) | ||
| function useCalendarApp(config, plugins) { | ||
| const [calendarApp, setCalendarApp] = react.useState(null); | ||
| react.useEffect(() => { | ||
| setCalendarApp(calendar.createCalendar(config, plugins)); | ||
| }, []); | ||
| const [calendarApp] = react.useState(() => calendar.createCalendar(config, plugins)); | ||
| return calendarApp; | ||
| } | ||
| function useNextCalendarApp(config, plugins) { | ||
| const [calendarApp, setCalendarApp] = react.useState(null); | ||
| const [calendarApp, setCalendarApp] = react.useState(); | ||
| react.useEffect(() => { | ||
@@ -68,0 +65,0 @@ if (typeof window !== 'undefined') { |
+5
-8
@@ -18,7 +18,7 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime'; | ||
| var _a, _b; | ||
| const ccid = (_b = (_a = component.wrapperElement) === null || _a === void 0 ? void 0 : _a.dataset) === null || _b === void 0 ? void 0 : _b.ccid; | ||
| const ccid = (_b = (_a = component.wrapperElement) === null || _a === undefined ? undefined : _a.dataset) === null || _b === undefined ? undefined : _b.ccid; | ||
| if (!ccid) | ||
| return prev; | ||
| const newComponents = [...prev]; | ||
| 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; }); | ||
| const existingComponent = newComponents.find((c) => { var _a, _b; return ((_b = (_a = c.wrapperElement) === null || _a === undefined ? undefined : _a.dataset) === null || _b === undefined ? undefined : _b.ccid) === ccid; }); | ||
| if (existingComponent) { | ||
@@ -35,3 +35,3 @@ newComponents.splice(newComponents.indexOf(existingComponent), 1); | ||
| if (!calendarApp) | ||
| return; // before useEffect runs for the first time calendarApp is null | ||
| return; // in SSR, calendarApp will be undefined | ||
| for (const [componentName, Component] of Object.entries(customComponents || {})) { | ||
@@ -56,10 +56,7 @@ if (!Component) | ||
| function useCalendarApp(config, plugins) { | ||
| const [calendarApp, setCalendarApp] = useState(null); | ||
| useEffect(() => { | ||
| setCalendarApp(createCalendar(config, plugins)); | ||
| }, []); | ||
| const [calendarApp] = useState(() => createCalendar(config, plugins)); | ||
| return calendarApp; | ||
| } | ||
| function useNextCalendarApp(config, plugins) { | ||
| const [calendarApp, setCalendarApp] = useState(null); | ||
| const [calendarApp, setCalendarApp] = useState(); | ||
| useEffect(() => { | ||
@@ -66,0 +63,0 @@ if (typeof window !== 'undefined') { |
| import { CalendarApp } from '@schedule-x/calendar'; | ||
| import React from 'react'; | ||
| import { CustomComponentName } from '@schedule-x/shared'; | ||
| import { CustomComponentName } from "@schedule-x/shared"; | ||
| type ReactComponent = React.ComponentType<any>; | ||
| type props = { | ||
| calendarApp: CalendarApp | null; | ||
| calendarApp: CalendarApp | undefined; | ||
| customComponents?: { | ||
@@ -8,0 +8,0 @@ [key in CustomComponentName]?: ReactComponent; |
| import { CalendarApp, CalendarConfig } from '@schedule-x/calendar'; | ||
| import { PluginBase } from '@schedule-x/shared'; | ||
| export declare function useCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp | null; | ||
| export declare function useNextCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp | null; | ||
| export declare function useCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp & { [Name in Plugins[number]["name"]]: Extract<Plugins[number], { | ||
| name: Name; | ||
| }>; }; | ||
| export declare function useNextCalendarApp<Plugins extends PluginBase<string>[]>(config: CalendarConfig, plugins?: Plugins): CalendarApp | undefined; |
+11
-11
@@ -18,3 +18,3 @@ { | ||
| "types": "dist/types/index.d.ts", | ||
| "version": "2.24.0", | ||
| "version": "2.25.0-alpha.0", | ||
| "type": "module", | ||
@@ -35,3 +35,3 @@ "files": [ | ||
| "peerDependencies": { | ||
| "@schedule-x/calendar": "^2.18.0", | ||
| "@schedule-x/calendar": "2.25.0-alpha.0", | ||
| "react": "^16.7.0 || ^17 || ^18 || ^19", | ||
@@ -45,11 +45,11 @@ "react-dom": "^16.7.0 || ^17 || ^18 || ^19" | ||
| "@rollup/plugin-typescript": "^11.1.5", | ||
| "@schedule-x/calendar-controls": "^2.18.0", | ||
| "@schedule-x/drag-and-drop": "^2.18.0", | ||
| "@schedule-x/e2e-testing": "^2.18.0", | ||
| "@schedule-x/eslint-config": "^2.18.0", | ||
| "@schedule-x/event-modal": "^2.18.0", | ||
| "@schedule-x/events-service": "^2.18.0", | ||
| "@schedule-x/prettier-config": "^2.18.0", | ||
| "@schedule-x/shared": "^2.18.0", | ||
| "@schedule-x/theme-default": "^2.18.0", | ||
| "@schedule-x/calendar-controls": "^2.25.0-alpha.0", | ||
| "@schedule-x/drag-and-drop": "^2.25.0-alpha.0", | ||
| "@schedule-x/e2e-testing": "^2.25.0-alpha.0", | ||
| "@schedule-x/eslint-config": "^2.22.0", | ||
| "@schedule-x/event-modal": "^2.25.0-alpha.0", | ||
| "@schedule-x/events-service": "^2.25.0-alpha.0", | ||
| "@schedule-x/prettier-config": "^2.25.0-alpha.0", | ||
| "@schedule-x/shared": "^2.25.0-alpha.0", | ||
| "@schedule-x/theme-default": "^2.25.0-alpha.0", | ||
| "@semantic-release/changelog": "^6.0.3", | ||
@@ -56,0 +56,0 @@ "@semantic-release/git": "^10.0.1", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
15895
-0.46%259
-2.63%1
Infinity%