@schedule-x/react
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -5,8 +5,14 @@ # Changelog | ||
## [1.2.1](https://github.com/schedule-x/react/compare/v1.2.0...v1.2.1) (2024-01-04) | ||
### Bug Fixes | ||
* usage in nextjs ([#22](https://github.com/schedule-x/react/issues/22)) ([70f81df](https://github.com/schedule-x/react/commit/70f81dff94c7c3334cf69ed5935aa4b0fdf6966d)) | ||
# [1.2.0](https://github.com/schedule-x/react/compare/v1.1.1...v1.2.0) (2024-01-04) | ||
### Features | ||
* bump calendar monorepo packages to 1.3.0 ([#21](https://github.com/schedule-x/react/issues/21)) ([bcba535](https://github.com/schedule-x/react/commit/bcba5359d430942ea82ec5662c9848791c9b2f13)) | ||
- bump calendar monorepo packages to 1.3.0 ([#21](https://github.com/schedule-x/react/issues/21)) ([bcba535](https://github.com/schedule-x/react/commit/bcba5359d430942ea82ec5662c9848791c9b2f13)) | ||
@@ -13,0 +19,0 @@ ## [1.1.1](https://github.com/schedule-x/react/compare/v1.1.0...v1.1.1) (2023-12-29) |
import { createCalendarHeaderPageObject } from '@schedule-x/e2e-testing' | ||
describe('Smoke Test', () => { | ||
describe('Smoke test', () => { | ||
const calendarHeader = createCalendarHeaderPageObject() | ||
@@ -5,0 +5,0 @@ |
@@ -15,3 +15,3 @@ 'use strict'; | ||
function ScheduleXCalendar({ calendarApp, customComponents }) { | ||
const randomId = 'sx' + Math.random().toString(36).substring(2, 11); | ||
const [randomId, setRandomId] = react.useState(''); | ||
const [customComponentsMeta, setCustomComponentsMeta] = react.useState([]); | ||
@@ -30,7 +30,13 @@ const setComponent = (component) => { | ||
react.useEffect(() => { | ||
setRandomId('sx' + Math.random().toString(36).substring(2, 11)); | ||
}, []); | ||
react.useEffect(() => { | ||
for (const [componentName, Component] of Object.entries(customComponents || {})) { | ||
calendarApp._setCustomComponentFn(componentName, createCustomComponentFn(setComponent, Component)); | ||
} | ||
calendarApp.render(document.getElementById(randomId)); | ||
}, [calendarApp, randomId, customComponents]); | ||
const calendarElement = document.getElementById(randomId); | ||
if (!calendarElement) | ||
return; | ||
calendarApp.render(calendarElement); | ||
}, [calendarApp, customComponents, randomId]); | ||
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs(react.Fragment, { children: [jsxRuntime.jsx("div", { className: "sx-react-calendar-wrapper", id: randomId }), customComponentsMeta.map(({ Component, wrapperElement }) => { | ||
@@ -37,0 +43,0 @@ return reactDom.createPortal(Component, wrapperElement); |
@@ -13,3 +13,3 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime'; | ||
function ScheduleXCalendar({ calendarApp, customComponents }) { | ||
const randomId = 'sx' + Math.random().toString(36).substring(2, 11); | ||
const [randomId, setRandomId] = useState(''); | ||
const [customComponentsMeta, setCustomComponentsMeta] = useState([]); | ||
@@ -28,7 +28,13 @@ const setComponent = (component) => { | ||
useEffect(() => { | ||
setRandomId('sx' + Math.random().toString(36).substring(2, 11)); | ||
}, []); | ||
useEffect(() => { | ||
for (const [componentName, Component] of Object.entries(customComponents || {})) { | ||
calendarApp._setCustomComponentFn(componentName, createCustomComponentFn(setComponent, Component)); | ||
} | ||
calendarApp.render(document.getElementById(randomId)); | ||
}, [calendarApp, randomId, customComponents]); | ||
const calendarElement = document.getElementById(randomId); | ||
if (!calendarElement) | ||
return; | ||
calendarApp.render(calendarElement); | ||
}, [calendarApp, customComponents, randomId]); | ||
return (jsx(Fragment, { children: jsxs(Fragment$1, { children: [jsx("div", { className: "sx-react-calendar-wrapper", id: randomId }), customComponentsMeta.map(({ Component, wrapperElement }) => { | ||
@@ -35,0 +41,0 @@ return createPortal(Component, wrapperElement); |
@@ -17,3 +17,3 @@ { | ||
"types": "dist/types/index.d.ts", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"type": "module", | ||
@@ -20,0 +20,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94012
65
1716
1