diff --git a/docs/assets/trial_eventcalendar.png b/docs/assets/trial_eventcalendar.png new file mode 100644 index 0000000..300ce0e Binary files /dev/null and b/docs/assets/trial_eventcalendar.png differ diff --git a/docs/guides/integration_with_angular.md b/docs/guides/integration_with_angular.md index fa24c20..02a8c25 100644 --- a/docs/guides/integration_with_angular.md +++ b/docs/guides/integration_with_angular.md @@ -6,6 +6,259 @@ description: You can learn about the integration with Angular in the documentati # Integration with Angular -DHTMLX Event Calendar is compatible with **Angular**. We have prepared code examples of how to use DHTMLX Event Calendar with **Angular**. To check online samples, please refer to the corresponding [**Examples on CodeSandbox**](https://codesandbox.io/u/DHTMLX). +:::tip +You should be familiar with basic concepts and patterns of **Angular** before reading this documentation. To refresh your knowledge, please refer to the [**Angular documentation**](https://angular.io/docs). +::: - +DHTMLX Event Calendar is compatible with **Angular**. We have prepared code examples on how to use DHTMLX Event Calendar with **Angular**. For more information, refer to the corresponding [**Example on GitHub**](https://github.com/DHTMLX/angular-event-calendar-demo). + +## Creating a project + +:::info +Before you start to create a new project, install [**Angular CLI**](https://angular.io/cli) and [**Node.js**](https://nodejs.org/en/). +::: + +Create a new **my-angular-event-calendar-app** project using Angular CLI. Run the following command for this purpose: + +~~~json +ng new my-angular-event-calendar-app +~~~ + +The command above installs all the necessary tools and dependencies, so you don't need to run any additional commands. + +### Installation of dependencies + +Go to the app directory: + +~~~json +cd my-angular-event-calendar-app +~~~ + +Run the app with the following command: + +~~~json +yarn install +yarn start +~~~ + +The app should run on a localhost (for instance `http://localhost:3000`). + +## Creating Event Calendar + +Now you should get the DHTMLX Event Calendar code. First of all, stop the app and proceed with installing the Event Calendar package. + +### Step 1. Package installation + +Download the [**trial Event Calendar package**](/how_to_start/#installing-event-calendar-via-npm-and-yarn) and follow steps mentioned in the README file. Note that trial Event Calendar is available 30 days only. + +### Step 2. Component creation + +Now you need to create a component, to add an Event Calendar into the application. Create the **event-calendar** folder in the **src/app/** directory, add a new file into it and name it **event-calendar.component.ts**. Then complete the steps described below. + +#### Importing source files + +Open the file and import Event Calendar source files. Note that: + +- if you use PRO version and install the Event Calendar package from a local folder, the imported paths look like this: + +~~~jsx +import { EventCalendar } from 'dhx-eventcalendar-package'; +import 'dhx-eventcalendar-package/dist/eventcalendar.css'; +~~~ + +Note that depending on the used package, the source files can be minified. In this case make sure that you are importing the CSS file as **event-calendar.min.css**. + +- if you use the trial version of Event Calendar, specify the following paths: + +~~~jsx +import { EventCalendar } from '@dhx/trial-eventcalendar'; +import '@dhx/trial-eventcalendar/dist/eventcalendar.css'; +~~~ + +In this tutorial you can see how to configure the **trial** version of Event Calendar. + +#### Setting the container and adding Event Calendar + +To display Event Calendar on the page, you need to set the container to render the component inside. Use the code below: + +~~~jsx title="event-calendar.component.ts" +import { EventCalendar } from '@dhx/trial-eventcalendar'; +import '@dhx/trial-eventcalendar/dist/eventcalendar.css'; +import { Component, ElementRef, OnInit, ViewChild, OnDestroy} from '@angular/core'; + +@Component({ + selector: 'event-calendar', + template: '
' +}) +export class EventCalendarComponent implements OnInit { + @ViewChild('container', { static: true }) container!: ElementRef; +} +~~~ + +Then you need to render our Event Calendar in the container. To do that, use the `ngOnInit()` method of Angular: + +~~~jsx {6-9} title="event-calendar.component.ts" +export class EventCalendarComponent implements OnInit, OnDestroy { + @ViewChild('container', { static: true }) container!: ElementRef; + + private _calendar: any; + + ngOnInit() { + const calendar = new EventCalendar(this.container.nativeElement,{}); + this._calendar = calendar; + } + + ngOnDestroy() { + this._calendar.destructor(); + } +} +~~~ + +In the above code you also specified the `ngOnDestroy()` method that contains the `_calendar.destructor()` expression to clear the component when it is no longer needed. + +#### Loading data + +To add data into Event Calendar, you need to provide a data set. You can create the **data.ts** file in the **src/app/event-calendar/** directory and add some data into it: + +~~~jsx title="data.ts" +export function getData() { + return [ + { + id: '27', + type: 'work', + start_date: new Date('2024-06-10T14:00:00'), + end_date: new Date('2024-06-10T18:30:00'), + text: ' Olympiastadion - Berlin ', + details: ' Berlin, GER ' + }, + { + id: '28', + type: 'rest', + start_date: new Date('2024-06-12T14:00:00'), + end_date: new Date('2024-06-12T16:00:00'), + text: ' Commerz Bank Arena ', + details: ' Frankfurt, GER ' + }, + { + id: '29', + type: 'meeting', + start_date: new Date('2024-06-13T11:00:00'), + end_date: new Date('2024-06-13T16:00:00'), + text: ' Olympic Stadium - Munich ', + details: ' Munich, GER ' + } + ]; +} +~~~ + +Then open the ***event-calendar.component.ts*** file. Import the file with data and specify the corresponding data properties to the configuration object of Event Calendar within the `ngOnInit()` method, as shown below. + +~~~jsx {2,5,7} title="event-calendar.component.ts" +// importing the data file +import { getData } from './data'; + +ngOnInit() { + const events = getData(); + const calendar = new EventCalendar(this.container.nativeElement, { + events + }); +} +~~~ + +You can also use the `parse()` method inside the `ngOnInit()` method of Angular to load data into Event Calendar. It will reload data on each applied change. + +~~~jsx {11} title="event-calendar.component.ts" +// importing the data file +import { getData } from './data'; + +ngOnInit() { + const events = getData(); + const calendar = new EventCalendar(this.container.nativeElement, {}); + + calendar.parse(events); +} +~~~ + +Now the Event Calendar component is ready. When the element will be added to the page, it will initialize the Event Calendar object with data. You can provide necessary configuration settings as well. Visit our [Event Calendar API docs](/api/overview/properties_overview/) to check the full list of available properties. + +#### Handling events + +When a user makes some action in the Event Calendar, it invokes an event. You can use these events to detect the action and run the desired code for it. See the [full list of events](/api/overview/events_overview/). + +Open the **event-calendar.component.ts** file and complete the `ngOnInit()` method as in: + +~~~jsx {4-6} title="event-calendar.component.ts" +ngOnInit() { + const calendar = new EventCalendar(this.container.nativeElement,{ /*...*/ }); + + calendar.events.on("add-event", (obj) => { + console.log(obj); + }); +} +~~~ + +### Step 3. Adding Event Calendar into the app + +Now it's time to add the component into our app. Open ***src/app/app.component.ts*** and use *EventCalendarComponent* instead of the default content by inserting the code below: + +~~~jsx title="app.component.ts" +import { Component } from "@angular/core"; + +@Component({ + selector: "app-root", + template: `` +}) +export class AppComponent { + name = ""; +} +~~~ + +Then create the ***app.module.ts*** file in the ***src/app/*** directory and insert the *EventCalendarComponent* as provided below: + +~~~jsx title="app.module.ts" +import { NgModule } from "@angular/core"; +import { BrowserModule } from "@angular/platform-browser"; + +import { AppComponent } from "./app.component"; +import { EventCalendarComponent } from "./event-calendar/event-calendar.component"; + +@NgModule({ + declarations: [AppComponent, EventCalendarComponent], + imports: [BrowserModule], + providers: [], + bootstrap: [AppComponent] +}) +export class AppModule {} +~~~ + +For correct rendering of fonts, open the ***angular.json*** file and complete the "assets" array in the following way (replace *eventcalendar_package* with the name of your local folder that contains Event Calendar source files): + +~~~jsx {5-9} title="angular.json" +... +"assets": [ + "src/favicon.ico", + "src/assets", + { + "input": "./eventcalendar_package/dist/fonts", + "glob": "**/*", + "output": "assets" + } +], +... +~~~ + +The last step is to open the ***src/main.ts*** file and replace the existing code with the following one: + +~~~jsx title="main.ts" +import { platformBrowserDynamic } from "@angular/platform-browser-dynamic"; +import { AppModule } from "./app/app.module"; +platformBrowserDynamic() + .bootstrapModule(AppModule) + .catch((err) => console.error(err)); +~~~ + +After that, when you can start the app to see Event Calendar loaded with data on a page. + +![Event Calendar initialization](../assets/trial_eventcalendar.png) + +Now you know how to integrate DHTMLX Event Calendar with Angular. You can customize the code according to your specific requirements. The final example you can find on [**GitHub**](https://github.com/DHTMLX/angular-event-calendar-demo). diff --git a/docs/guides/integration_with_react.md b/docs/guides/integration_with_react.md index f69021a..8ef94ad 100644 --- a/docs/guides/integration_with_react.md +++ b/docs/guides/integration_with_react.md @@ -6,6 +6,238 @@ description: You can learn about the integration with React in the documentation # Integration with React -DHTMLX Event Calendar is compatible with **React**. We have prepared code examples of how to use DHTMLX Event Calendar with **React**. To check online samples, please refer to the corresponding [**Examples on CodeSandbox**](https://codesandbox.io/u/DHTMLX). +:::tip +You should be familiar with the basic concepts and patterns of [**React**](https://react.dev) before reading this documentation. To refresh your knowledge, please refer to the [**React documentation**](https://reactjs.org/docs/getting-started.html). +::: - +DHTMLX Event Calendar is compatible with **React**. We have prepared code examples on how to use DHTMLX Event Calendar with **React**. For more information, refer to the corresponding [**Example on GitHub**](https://github.com/DHTMLX/react-event-calendar-demo). + +## Creating a project + +:::info +Before you start to create a new project, install [**Vite**](https://vitejs.dev/) (optional) and [**Node.js**](https://nodejs.org/en/). +::: + +You can create a basic **React** project or use **React with Vite**: + +~~~json +npx create-vite my-react-event-calendar-app --template react +~~~ + +### Installation of dependencies + +Go to the app directory. Let's name the project as **my-react-event-calendar-app** and run: + +~~~json +cd my-react-event-calendar-app +~~~ + +Install dependencies and start the dev server. For this, use a package manager: + +- if you use [**yarn**](https://yarnpkg.com/), run the following commands: + +~~~json +yarn install +yarn dev +~~~ + +- if you use [**npm**](https://www.npmjs.com/), run the following commands: + +~~~json +npm install +npm run dev +~~~ + +The app should run on a localhost (for instance `http://localhost:3000`). + +## Creating Event Calendar + +Now you should get the DHTMLX Event Calendar code. First of all, stop the app and proceed with installing the Event Calendar package. + +### Step 1. Package installation + +Download the [**trial Event Calendar package**](/how_to_start/#installing-event-calendar-via-npm-and-yarn) and follow steps mentioned in the README file. Note that trial Event Calendar is available 30 days only. + +### Step 2. Component creation + +Now you need to create a React component, to add a Event Calendar into the application. Create a new file in the ***src/*** directory and name it ***EventCalendar.jsx***. + +#### Importing source files + +Open the ***EventCalendar.jsx*** file and import Event Calendar source files. Note that: + +- if you use PRO version and install the Event Calendar package from a local folder, the import paths look like this: + +~~~jsx title="EventCalendar.jsx" +import { EventCalendar } from 'dhx-eventcalendar-package'; +import 'dhx-eventcalendar-package/dist/event-calendar.css'; +~~~ + +Note that depending on the used package, the source files can be minified. In this case make sure that you are importing the CSS file as **event-calendar.min.css**. + +- if you use the trial version of Event Calendar, specify the following paths: + +~~~jsx title="EventCalendar.jsx" +import { EventCalendar } from '@dhx/trial-eventcalendar'; +import "@dhx/trial-eventcalendar/dist/event-calendar.css"; +~~~ + +In this tutorial you can see how to configure the **trial** version of Event Calendar. + +#### Setting the container and adding Event Calendar + +To display Event Calendar on the page, you need to set the container to render the component inside. Check the code below: + +~~~jsx title="EventCalendar.jsx" +import { EventCalendar } from '@dhx/trial-eventcalendar'; +import '@dhx/trial-eventcalendar/dist/event-calendar.css'; + +// eslint-disable-next-line react/prop-types +const EventCalendarComponent = () => { + let container = useRef(); + + return
; +}; + +export default EventCalendarComponent; +~~~ + +Then you need to add Event Calendar into the container. For this purpose, import the `useEffect()` method of React and use it to render the Event Calendar instance and destruct when it is no longer needed: + +~~~jsx {2,8-12} title="EventCalendar.jsx" +// ... +import { useEffect, useRef} from "react"; + +// eslint-disable-next-line react/prop-types +const EventCalendarComponent = () => { + let container = useRef(); + + useEffect(() => { + new EventCalendar(container.current, {}); + + return () => (container.current.innerHTML = ""); + }, []); + + return
; +}; + +export default EventCalendarComponent; +~~~ + +#### Loading data + +To add data into the Event Calendar, you need to provide a data set. You can create the ***data.js*** file in the ***src/*** directory and add some data into it: + +~~~jsx title="data.js" +export function getData() { + return [ + { + id: '27', + type: 'work', + start_date: new Date('2024-06-10T14:00:00'), + end_date: new Date('2024-06-10T18:30:00'), + text: ' Olympiastadion - Berlin ', + details: ' Berlin, GER ' + }, + { + id: '28', + type: 'rest', + start_date: new Date('2024-06-12T14:00:00'), + end_date: new Date('2024-06-12T16:00:00'), + text: ' Commerz Bank Arena ', + details: ' Frankfurt, GER ' + }, + { + id: '29', + type: 'meeting', + start_date: new Date('2024-06-13T11:00:00'), + end_date: new Date('2024-06-13T16:00:00'), + text: ' Olympic Stadium - Munich ', + details: ' Munich, GER ' + } + ]; +} +~~~ + +Then open the ***EventCalendar.jsx*** file, pass the name of the data file to the component constructor function: + +~~~jsx {1,6-7} title="EventCalendar.jsx" +const EventCalendarComponent = (props) => { + let container = useRef(); + + useEffect(() => { + new EventCalendar(container.current, { + events: props.events, + date: props.date + }); + return () => (container.current.innerHTML = ""); + }, []); + + return
; +}; + +export default EventCalendarComponent; +~~~ + +You can also use the `parse()` method inside the `useEffect()` method of React to load data into Event Calendar: + +~~~jsx {7} title="EventCalendar.jsx" +const EventCalendarComponent = (props) => { + let container = useRef(); + let events = props.events; + + useEffect(() => { + const calendar = new EventCalendar(container.current, {}); + + calendar.parse(events); + + return () => (container.current.innerHTML = ""); + }, []); + + return
; +}; +~~~ + +The `calendar.parse(events);` line provides data reloading on each applied change. + +Now the Event Calendar component is ready. When the element will be added to the page, it will initialize the Event Calendar object with data. You can provide necessary configuration settings as well. Visit our [Event Calendar API docs](/api/overview/properties_overview/) to check the full list of available properties. + +#### Handling events + +When a user makes some action in the Event Calendar, it invokes an event. You can use these events to detect the action and run the desired code for it. See the [full list of events](/api/overview/events_overview/). + +Open **EventCalendar.jsx** and complete the `useEffect()` method in the following way: + +~~~jsx {4-6} title="EventCalendar.jsx" +useEffect(() => { + const calendar = new EventCalendar(container.current, {}); + + calendar.events.on("add-event", (obj) => { + console.log(obj); + }); + + return () => (container.current.innerHTML = ""); +}, []); +~~~ + +### Step 3. Adding Event Calendar into the app + +To add the component into our app, open the **App.jsx** file and replace the default code with the following one: + +~~~jsx title="App.jsx" +import EventCalendar from "./EventCalendar"; +import { getData } from "./data"; + +function App() { + const events= getData(); + return ; +} + +export default App; +~~~ + +After that, when you can start the app to see Event Calendar loaded with data on a page. + +![Event Calendar initialization](../assets/trial_eventcalendar.png) + +Now you know how to integrate DHTMLX Event Calendar with React. You can customize the code according to your specific requirements. The final example you can find on [**GitHub**](https://github.com/DHTMLX/react-event-calendar-demo). diff --git a/docs/guides/integration_with_svelte.md b/docs/guides/integration_with_svelte.md index 2f308b5..5088402 100644 --- a/docs/guides/integration_with_svelte.md +++ b/docs/guides/integration_with_svelte.md @@ -6,6 +6,239 @@ description: You can learn about the integration with Svelte in the documentatio # Integration with Svelte -DHTMLX Event Calendar is compatible with **Svelte**. We have prepared code examples of how to use DHTMLX Event Calendar with **Svelte**. To check online samples, please refer to the corresponding [**Examples on CodeSandbox**](https://codesandbox.io/u/DHTMLX). +:::tip +You should be familiar with the basic concepts and patterns of **Svelte** before reading this documentation. To refresh your knowledge, please refer to the [**Svelte documentation**](https://svelte.dev/). +::: - +DHTMLX Event Calendar is compatible with **Svelte**. We have prepared code examples on how to use DHTMLX Event Calendar with **Svelte**. For more information, refer to the corresponding [**Example on GitHub**](https://github.com/DHTMLX/svelte-event-calendar-demo). + +## Creating a project + +:::info +Before you start to create a new project, install [**Vite**](https://vitejs.dev/) (optional) and [**Node.js**](https://nodejs.org/en/). +::: + +There are several ways of creating a project: + +- you can use the [**SvelteKit**](https://kit.svelte.dev/) + +or + +- you can also use **Svelte with Vite** (but without SvelteKit): + +~~~json +npm create vite@latest +~~~ + +Check the details in the [related article](https://svelte.dev/docs/introduction#start-a-new-project-alternatives-to-sveltekit). + +### Installation of dependencies + +Let's name the project as **my-svelte-event-calendar-app** and go to the app directory: + +~~~json +cd my-svelte-event-calendar-app +~~~ + +Install dependencies and run the app. For this, use a package manager: + +- if you use [**yarn**](https://yarnpkg.com/), run the following commands: + +~~~json +yarn install +yarn dev +~~~ + +- if you use [**npm**](https://www.npmjs.com/), run the following commands: + +~~~json +npm install +npm run dev +~~~ + +The app should run on a localhost (for instance `http://localhost:3000`). + +## Creating Event Calendar + +Now you should get the DHTMLX Event Calendar code. First of all, stop the app and proceed with installing the Event Calendar package. + +### Step 1. Package installation + +Download the [**trial Event Calendar package**](/how_to_start/#installing-event-calendar-via-npm-and-yarn) and follow steps mentioned in the README file. Note that trial Event Calendar is available 30 days only. + +### Step 2. Component creation + +Now you need to create a Svelte component, to add a Event Calendar into the application. Let's create a new file in the ***src/*** directory and name it ***EventCalendar.svelte***. + +#### Importing source files + +Open the ***EventCalendar.svelte*** file and import Event Calendar source files. Note that: + +- if you use PRO version and install the Event Calendar package from a local folder, the import paths look like this: + +~~~html title="EventCalendar.svelte" +import { EventCalendar } from 'dhx-eventcalendar-package'; +import 'dhx-eventcalendar-package/dist/event-calendar.css'; +~~~ + +Note that depending on the used package, the source files can be minified. In this case make sure that you are importing the CSS file as **event-calendar.min.css**. + +- if you use the trial version of Event Calendar, specify the following paths: + +~~~html title="EventCalendar.svelte" +import { EventCalendar } from '@dhx/trial-eventcalendar'; +import '@dhx/trial-eventcalendar/dist/event-calendar.css'; +~~~ + +In this tutorial you can see how to configure the **trial** version of Event Calendar. + +#### Setting the container and adding Event Calendar + +To display Event Calendar on the page, you need to set the container to render the component inside. Check the code below: + +~~~html {5,8} title="EventCalendar.svelte" + + +
+~~~ + +Then you need to render Event Calendar in the container. Use the `new EventCalendar()` constructor inside the `onMount()` method of Svelte, to initialize Event Calendar inside of the container: + +~~~html {4,8-10} title="EventCalendar.svelte" + + +
+~~~ + +#### Loading data + +To add data into the Event Calendar, we need to provide a data set. You can create the ***data.js*** file in the ***src/*** directory and add some data into it: + +~~~jsx title="data.js" +export function getData() { + return [ + { + id: '27', + type: 'work', + start_date: new Date('2024-06-10T14:00:00'), + end_date: new Date('2024-06-10T18:30:00'), + text: ' Olympiastadion - Berlin ', + details: ' Berlin, GER ' + }, + { + id: '28', + type: 'rest', + start_date: new Date('2024-06-12T14:00:00'), + end_date: new Date('2024-06-12T16:00:00'), + text: ' Commerz Bank Arena ', + details: ' Frankfurt, GER ' + }, + { + id: '29', + type: 'meeting', + start_date: new Date('2024-06-13T11:00:00'), + end_date: new Date('2024-06-13T16:00:00'), + text: ' Olympic Stadium - Munich ', + details: ' Munich, GER ' + } + ]; +} +~~~ + +Then open the ***App.svelte*** file, import data, and pass it into the new created `` components as **props**: + +~~~html {3-4,7} title="App.svelte" + + + +~~~ + +Open the ***EventCalendar.svelte*** file and apply the passed **props** to the Event Calendar configuration object: + +~~~html {3,8-11} title="EventCalendar.svelte" + + +
+~~~ + +You can also use the `parse()` method inside the `onMount()` method of Svelte to load data into Event Calendar: + +~~~html {3-4,8-11} title="App.svelte" + + +~~~ + +Now the Event Calendar component is ready. When the element will be added to the page, it will initialize the Event Calendar object with data. You can provide necessary configuration settings as well. Visit our [Event Calendar API docs](/api/overview/properties_overview/) to check the full list of available properties. + +#### Handling events + +When a user makes some action in the Event Calendar, it invokes an event. You can use these events to detect the action and run the desired code for it. See the [full list of events](/api/overview/events_overview/). + +Open ***EventCalendar.svelte*** and complete the `onMount()` method as in: + +~~~jsx title="EventCalendar.svelte" +onMount(() => { + const calendar = new EventCalendar(container, { columns, cards }); + calendar.events.on("add-event", (obj) => { + console.log(obj); + }); +}); +~~~ + +### Step 3. Adding Event Calendar into the app + +To add the component into the app, open the **App.svelte** file and replace the default code with the following one: + +~~~html title="App.svelte" + + + +~~~ + +After that, when we start the app, we should see Event Calendar loaded with data on a page. + +![Event Calendar initialization](../assets/trial_eventcalendar.png) + +Now you know how to integrate DHTMLX Event Calendar with Svelte. You can customize the code according to your specific requirements. The final example you can find on [**GitHub**](https://github.com/DHTMLX/svelte-event-calendar-demo). diff --git a/docs/guides/integration_with_vue.md b/docs/guides/integration_with_vue.md index bb4149c..bf3b7b7 100644 --- a/docs/guides/integration_with_vue.md +++ b/docs/guides/integration_with_vue.md @@ -6,6 +6,279 @@ description: You can learn about the integration with Vue in the documentation o # Integration with Vue -DHTMLX Event Calendar is compatible with **Vue**. We have prepared code examples of how to use DHTMLX Event Calendar with **Vue**. To check online samples, please refer to the corresponding [**Examples on CodeSandbox**](https://codesandbox.io/u/DHTMLX). +:::tip +You should be familiar with the basic concepts and patterns of [**Vue**](https://vuejs.org/) before reading this documentation. To refresh your knowledge, please refer to the [**Vue 3 documentation**](https://v3.vuejs.org/guide/introduction.html#getting-started). +::: - +DHTMLX Event Calendar is compatible with **Vue**. We have prepared code examples on how to use DHTMLX Event Calendar with **Vue 3**. For more information, refer to the corresponding [**Example on GitHub**](https://github.com/DHTMLX/vue-event-calendar-demo). + +## Creating a project + +:::info +Before you start to create a new project, install [**Node.js**](https://nodejs.org/en/). +::: + +To create a **Vue** project, run the following command: + +~~~json +npm create vue@latest +~~~ + +This command installs and executes `create-vue`, the official **Vue** project scaffolding tool. Check the details in the [Vue.js Quick Start](https://vuejs.org/guide/quick-start.html#creating-a-vue-application). + +Let's name the project as **my-vue-event-calendar-app**. + +### Installation of dependencies + +Go to the app directory: + +~~~json +cd my-vue-event-calendar-app +~~~ + +Install dependencies and start the dev server. For this, use a package manager: + +- if you use [**yarn**](https://yarnpkg.com/), run the following commands: + +~~~json +yarn install +yarn dev +~~~ + +- if you use [**npm**](https://www.npmjs.com/), run the following commands: + +~~~json +npm install +npm run dev +~~~ + +The app should run on a localhost (for instance `http://localhost:3000`). + +## Creating Event Calendar + +Now you should get the DHTMLX Event Calendar code. First of all, stop the app and proceed with installing the Event Calendar package. + +### Step 1. Package installation + +Download the [**trial Event Calendar package**](/how_to_start/#installing-event-calendar-via-npm-and-yarn) and follow steps mentioned in the README file. Note that trial Event Calendar is available 30 days only. + +### Step 2. Component creation + +Now you need to create a Vue component, to add a Event Calendar into the application. Create a new file in the ***src/components/*** directory and name it ***EventCalendarComponent***. + +#### Importing source files + +Open the ***EventCalendarComponent.vue*** file and import Event Calendar source files. Note that: + +- if you use PRO version and install the Event Calendar package from a local folder, the import paths look like this: + +~~~html title="EventCalendarComponent.vue" +import { EventCalendar } from 'dhx-eventcalendar-package'; +import 'dhx-eventcalendar-package/dist/event-calendar.css'; +~~~ + +Note that depending on the used package, the source files can be minified. In this case make sure that you are importing the CSS file as **event-calendar.min.css**. + +- if you use the trial version of Event Calendar, specify the following paths: + +~~~html title="EventCalendarComponent.vue" +import { EventCalendar } from '@dhx/trial-eventcalendar'; +import '@dhx/trial-eventcalendar/dist/event-calendar.css'; +~~~ + +In this tutorial you can see how to configure the **trial** version of Event Calendar. + +#### Setting the container and adding Event Calendar + +To display Event Calendar on the page, you need to set the container to render the component inside. Check the code below: + +~~~html {6-8} title="EventCalendarComponent.vue" + + + +~~~ + +Then you need to render Event Calendar in the container. Use the `new EventCalendar()` constructor inside the `mounted()` method of Vue to initialize Event Calendar inside of the container: + +~~~html title="EventCalendarComponent.vue" + + + +~~~ + +To clear the component as it has unmounted, use the `calendar.destructor()` call and remove the container after that inside the `unmounted()` method of ***Vue.js***, as follows: + +~~~html {7-10} title="EventCalendarComponent.vue" + + + +~~~ + +#### Loading data + +To add data into the Event Calendar, you need to provide a data set. You can create the ***data.js*** file in the ***src/*** directory and add some data into it: + +~~~jsx title="data.js" +export function getData() { + return [ + { + id: '27', + type: 'work', + start_date: new Date('2024-06-10T14:00:00'), + end_date: new Date('2024-06-10T18:30:00'), + text: ' Olympiastadion - Berlin ', + details: ' Berlin, GER ' + }, + { + id: '28', + type: 'rest', + start_date: new Date('2024-06-12T14:00:00'), + end_date: new Date('2024-06-12T16:00:00'), + text: ' Commerz Bank Arena ', + details: ' Frankfurt, GER ' + }, + { + id: '29', + type: 'meeting', + start_date: new Date('2024-06-13T11:00:00'), + end_date: new Date('2024-06-13T16:00:00'), + text: ' Olympic Stadium - Munich ', + details: ' Munich, GER ' + } + ]; +} +~~~ + +Then open the ***App.vue*** file, import data, and initialize it via the inner `data()` method. After this you can pass data into the new created `` components as **props**: + +~~~html {3,9,17} title="App.vue" + + + +~~~ + +Open the ***EventCalendarComponent.vue*** file and apply the passed **props** to the Event Calendar configuration object: + +~~~html {3,7-8} title="EventCalendarComponent.vue" + +~~~ + +You can also use the `parse()` method inside the `mounted()` method of Vue to load data into Event Calendar: + +~~~html {7} title="EventCalendarComponent.vue" + +~~~ + +Now the Event Calendar component is ready. When the element will be added to the page, it will initialize the Event Calendar object with data. You can provide necessary configuration settings as well. Visit our [Event Calendar API docs](/api/overview/properties_overview/) to check the full list of available properties. + +#### Handling events + +When a user makes some action in the Event Calendar, it invokes an event. You can use these events to detect the action and run the desired code for it. See the [full list of events](/api/overview/events_overview/). + +Open ***EventCalendarComponent.vue*** and complete the `mounted()` method: + +~~~html {6-8} title="EventCalendarComponent.vue" + +~~~ + +### Step 3. Adding Event Calendar into the app + +To add the component into the app, open the **App.vue** file and replace the default code with the following one: + +~~~html title="App.vue" + + + +~~~ + +After that, when you can start the app to see Event Calendar loaded with data on a page. + +![Event Calendar initialization](../assets/trial_eventcalendar.png) + +Now you know how to integrate DHTMLX Event Calendar with Vue. You can customize the code according to your specific requirements. The final example you can find on [**GitHub**](https://github.com/DHTMLX/vue-event-calendar-demo). diff --git a/docs/how_to_start.md b/docs/how_to_start.md index 31fc4b3..3db9c95 100644 --- a/docs/how_to_start.md +++ b/docs/how_to_start.md @@ -33,24 +33,20 @@ There are two necessary files: ~~~ -:::info -You can also import Event Calendar into your project using `yarn` or `npm` commands. To get the trial version of Event Calendar, run the following commands: +### Installing Event Calendar via npm and yarn -~~~jsx {2-3,6-7} -// npm -npm config set @dhx:registry https://npm.dhtmlx.com -npm i @dhx/trial-eventcalendar +You can import JavaScript Event Calendar into your project using `yarn` or `npm` package manager. -// yarn -yarn config set @dhx:registry https://npm.dhtmlx.com -yarn add @dhx/trial-eventcalendar -~~~ +#### Installing trial Event Calendar via npm and yarn -To get Event Calendar under the proprietary license, refer to **[Support Center](https://dhtmlx.com/docs/technical-support.shtml)**! +:::info +If you want to use trial version of Event Calendar, download the [**trial Event Calendar package**](https://dhtmlx.com/docs/products/dhtmlxEventCalendar/download.shtml) and follow steps mentioned in the *README* file. Note that trial Event Calendar is available 30 days only. ::: -:::tip -If you want to integrate JavaScript Event Calendar into React, Angular or Vue projects, refer to the corresponding [**Examples on CodeSandbox**](https://codesandbox.io/u/DHTMLX) for more information. +#### Installing PRO Event Calendar via npm and yarn + +:::info +If you have already own Event Calendar under the proprietary license, send your **license number** on the *contact@dhtmlx.com* email to receive *login* and *password* for private **npm** as well as detailed guide on how to install Event Calendar. Note that private **npm** is available before the expiration of the proprietary Event Calendar license. ::: ## Step 2. Creating Event Calendar diff --git a/docs/news/whats_new.md b/docs/news/whats_new.md index cee7b6d..f06f42e 100644 --- a/docs/news/whats_new.md +++ b/docs/news/whats_new.md @@ -8,6 +8,19 @@ description: You can explore what's new in DHTMLX Event Calendar and its release If you are updating Event Calendar from an older version, check [Migration to newer versions](news/migration.md) for details. +## Version 2.2.2 + +Released on June 7, 2024 + +### Fixes + +- Agenda view. The "Today" column text is cut off +- Incorrect state on select weekly recurring that is longer than 7 days +- Month view. The hidden events are still rendered to DOM +- Redundant calls of subscription to reactive bounds +- The [showEventInfo()](/api/methods/js_eventcalendar_showeventinfo_method/) method works incorrectly +- Unable to open a popup after editing a recurring event + ## Version 2.2.1 Released on May 7, 2024