|
1 | 1 | # 
|
2 | 2 |
|
3 |
| -> A JavaScript schedule calendar that is full featured. Now your service just got the customizable calendar. |
| 3 | +> A JavaScript calendar that is full featured. Now your service just got the customizable calendar. |
4 | 4 |
|
5 | 5 | [](https://www.npmjs.com/package/@toast-ui/calendar)
|
| 6 | +[](https://github.com/nhn/tui.calendar/blob/master/LICENSE) |
| 7 | +[](https://github.com/nhn/tui.calendar/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) |
| 8 | +[](https://github.com/nhn) |
6 | 9 |
|
7 | 10 | ## 🚩 Table of Contents
|
8 | 11 |
|
| 12 | +- [📙 Documents](#-documents) |
9 | 13 | - [Collect statistics on the use of open source](#collect-statistics-on-the-use-of-open-source)
|
10 | 14 | - [💾 Install](#-install)
|
11 |
| - - [Via Package Manager](#via-package-manager) |
12 |
| - - [npm](#npm) |
| 15 | + - [Using npm](#using-npm) |
| 16 | + - [Via Contents Delivery Network (CDN)](#via-contents-delivery-network-cdn) |
13 | 17 | - [Download Source Files](#download-source-files)
|
14 |
| -- [🔨 Usage](#-usage) |
15 |
| - - [HTML](#html) |
16 |
| - - [JavaScript](#javascript) |
17 |
| - - [Load](#load) |
| 18 | +- [📅 Usage](#-usage) |
| 19 | + - [Load](#load) |
| 20 | + - [Implement](#implement) |
| 21 | +- [🔧 Pull Request Steps](#-pull-request-steps) |
| 22 | + - [Setup](#setup) |
| 23 | + - [Develop](#develop) |
| 24 | + - [Pull Request](#pull-request) |
| 25 | +- [💬 Contributing](#-contributing) |
| 26 | +- [📜 License](#-license) |
18 | 27 |
|
19 |
| -## 🚧 The new version is coming out |
20 |
| - |
21 |
| -You're now looking at the `main` branch of the latest version of TOAST UI Calendar. You can try [the alpha version](https://github.com/nhn/tui.calendar/releases/tag/v2.0.0-alpha.4) of the new calendar. |
22 |
| - |
23 |
| -```sh |
24 |
| -npm install --save @toast-ui/calendar |
25 |
| -``` |
| 28 | +## 📙 Documents |
26 | 29 |
|
27 |
| -For the previous version, Please check out the [`v1` branch](https://github.com/nhn/tui.calendar/tree/v1). |
| 30 | +- [English](./docs/README.md) |
| 31 | +- [Korean](./docs/ko/README.md) |
28 | 32 |
|
29 | 33 | ## Collect statistics on the use of open source
|
30 | 34 |
|
31 |
| -TOAST UI Calendar applies Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI Calendar is used throughout the world. It also serves as important index to determine the future course of projects. location.hostname (e.g. > “ui.toast.com") is to be collected and the sole purpose is nothing but to measure statistics on the usage. To disable GA, use the following `usageStatistics` option when creating a calendar. |
| 35 | +TOAST UI Calendar applies Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI Calendar is used throughout the world. It also serves as important index to determine the future course of projects. location.hostname (e.g. > “ui.toast.com") is to be collected and the sole purpose is nothing but to measure statistics on the usage. |
32 | 36 |
|
33 |
| -To disable GA use the [options](https://nhn.github.io/tui.calendar/2.0.0-alpha/?path=/story/documentation-%ED%95%9C%EA%B5%AD%EC%96%B4-api-%EC%98%B5%EC%85%98--page#usagestatistics): |
| 37 | +To disable GA, set the [`usageStatistics` option](/docs/en/apis/options.md#usagestatistics) to `false`: |
34 | 38 |
|
35 | 39 | ```js
|
36 | 40 | const calendar = new Calendar('#calendar', {
|
37 | 41 | usageStatistics: false
|
38 | 42 | });
|
39 | 43 | ```
|
40 | 44 |
|
41 |
| -## 📙 Documents |
42 |
| - |
43 |
| -- [English](../../docs/README.md) |
44 |
| -- [Korean](../../docs/ko/README.md) |
45 |
| - |
46 | 45 | ## 💾 Install
|
47 | 46 |
|
48 |
| -TOAST UI products can be used by using the package manager or downloading the source directly. |
49 |
| -However, we highly recommend using the package manager. |
50 |
| - |
51 |
| -### Via Package Manager |
| 47 | +### Using npm |
52 | 48 |
|
53 |
| -TOAST UI products are registered in [npm](https://www.npmjs.com/). |
54 |
| -You can conveniently install it using the commands provided by each package manager. |
55 |
| -When using npm, be sure to use it in the environment [Node.js](https://nodejs.org) is installed. |
56 |
| - |
57 |
| -#### npm |
58 |
| - |
59 |
| -``` sh |
60 |
| -$ npm install --save @toast-ui/ [email protected] |
| 49 | +```sh |
| 50 | +npm install --save @toast-ui/calendar |
61 | 51 | ```
|
62 | 52 |
|
63 | 53 | ### Via Contents Delivery Network (CDN)
|
64 | 54 |
|
65 |
| -🚧 **CDN assets are not provided in alpha.** 🚧 |
66 |
| - |
67 | 55 | TOAST UI products are available over the CDN powered by [NHN Cloud](https://www.toast.com).
|
68 | 56 |
|
69 |
| -You can use the CDN as below. |
70 |
| - |
71 |
| -Insert style sheet files |
72 |
| - |
73 | 57 | ```html
|
74 |
| -<link rel="stylesheet" type="text/css" href="https://uicdn.toast.com/tui-calendar/latest/toastui-calendar.min.css" /> |
75 |
| - |
76 |
| -<!-- If you use the default popups, use this. --> |
77 |
| -<link rel="stylesheet" type="text/css" href="https://uicdn.toast.com/tui.date-picker/latest/tui-date-picker.css" /> |
78 |
| -<link rel="stylesheet" type="text/css" href="https://uicdn.toast.com/tui.time-picker/latest/tui-time-picker.css" /> |
79 |
| -``` |
| 58 | +<link rel="stylesheet" href="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.css" /> |
| 59 | +<script src="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.js"></script> |
80 | 60 |
|
81 |
| -Insert JavaScript file |
| 61 | +<!-- To get bundle file for legacy browser --> |
| 62 | +<!-- <script src="https://uicdn.toast.com/calendar /latest/toastui-calendar.ie11.min.js"></script> --> |
82 | 63 |
|
83 |
| -```html |
84 |
| -<script src="https://uicdn.toast.com/tui.time-picker/latest/tui-time-picker.min.js"></script> |
85 |
| -<script src="https://uicdn.toast.com/tui.date-picker/latest/tui-date-picker.min.js"></script> |
86 |
| -<script src="https://uicdn.toast.com/tui-calendar/latest/tui-calendar.js"></script> |
| 64 | +<!-- Import as es module --> |
| 65 | +<!-- <script type="module" src="https:// uicdn.toast.com/calendar/latest/toastui-calendar.mjs"></script> --> |
87 | 66 | ```
|
88 | 67 |
|
89 | 68 | If you want to use a specific version, use the tag name instead of `latest` in the url's path.
|
90 | 69 |
|
91 | 70 | The CDN directory has the following structure.
|
92 | 71 |
|
93 | 72 | ```
|
94 |
| -tui-calendar/ |
95 |
| -├─ latest/ |
96 |
| -│ ├─ tui-calendar.js |
97 |
| -│ └─ tui-calendar.min.js |
98 |
| -│ └─ tui-calendar.css |
99 |
| -│ └─ tui-calendar.min.css |
100 |
| -├─ v1.0.0/ |
101 |
| -│ ├─ ... |
| 73 | +- uicdn.toast.com/ |
| 74 | + ├─ calendar/ |
| 75 | + │ ├─ latest |
| 76 | + │ │ ├─ toastui-calendar.css |
| 77 | + │ │ ├─ toastui-calendar.js |
| 78 | + │ │ ├─ toastui-calendar.min.css |
| 79 | + │ │ ├─ toastui-calendar.min.js |
| 80 | + │ │ ├─ toastui-calendar.ie11.js |
| 81 | + │ │ ├─ toastui-calendar.ie11.min.js |
| 82 | + │ │ │ toastui-calendar.mjs |
| 83 | + │ ├─ v2.0.0/ |
102 | 84 | ```
|
103 | 85 |
|
104 | 86 | ### Download Source Files
|
105 | 87 |
|
106 |
| -* [Download all sources for each version](https://github.com/nhn/tui.calendar/releases) |
| 88 | +- [Download all sources for each version](https://github.com/nhn/tui.calendar/releases) |
107 | 89 |
|
108 |
| -## 🔨 Usage |
| 90 | +## 📅 Usage |
109 | 91 |
|
110 |
| -### HTML |
| 92 | +### Load |
111 | 93 |
|
112 |
| -Place a `<div></div>` where you want TOAST UI Calendar rendered. |
| 94 | +TOAST UI Calendar can be instantiated through the constructor function. There are three ways to access the constructor function depending on the environment. |
113 | 95 |
|
114 |
| -```html |
115 |
| -<body> |
116 |
| -... |
117 |
| -<div id="calendar" style="height: 800px;"></div> |
118 |
| -... |
119 |
| -</body> |
| 96 | +```js |
| 97 | +/* ES6 module in Node.js environment */ |
| 98 | +import Calendar from '@toast-ui/calendar'; |
| 99 | +import '@toast-ui/calendar/toastui-calendar.css'; |
120 | 100 | ```
|
121 | 101 |
|
122 |
| -### JavaScript |
123 |
| - |
124 |
| -#### Using namespace in browser environment |
125 |
| - |
126 |
| -```javascript |
127 |
| -const Calendar = tui.Calendar; |
| 102 | +```js |
| 103 | +/* CommonJS in Node.js environment */ |
| 104 | +const Calendar = require('@toast-ui/calendar'); |
| 105 | +require('@toast-ui/calendar/toastui-calendar.css'); |
128 | 106 | ```
|
129 | 107 |
|
130 |
| -#### Using module format in node environment |
131 |
| - |
132 |
| -```javascript |
133 |
| -const Calendar = require('tui-calendar'); /* CommonJS */ |
134 |
| -require("tui-calendar/dist/tui-calendar.css"); |
135 |
| - |
136 |
| -// If you use the default popups, use this. |
137 |
| -require("tui-date-picker/dist/tui-date-picker.css"); |
138 |
| -require("tui-time-picker/dist/tui-time-picker.css"); |
| 108 | +```js |
| 109 | +/* in the browser environment namespace */ |
| 110 | +const Calendar = tui.Calendar; |
139 | 111 | ```
|
140 | 112 |
|
141 |
| -```javascript |
142 |
| -import Calendar from 'tui-calendar'; /* ES Modules */ |
143 |
| -import "tui-calendar/dist/tui-calendar.css"; |
| 113 | +### Implement |
144 | 114 |
|
145 |
| -// If you use the default popups, use this. |
146 |
| -import 'tui-date-picker/dist/tui-date-picker.css'; |
147 |
| -import 'tui-time-picker/dist/tui-time-picker.css'; |
| 115 | +```html |
| 116 | +<div id="calendar" style="height: 800px"></div> |
148 | 117 | ```
|
149 | 118 |
|
150 |
| -Then you can create a calendar instance with [options](https://nhn.github.io/tui.calendar/2.0.0-alpha/?path=/story/documentation-%ED%95%9C%EA%B5%AD%EC%96%B4-api-%EC%98%B5%EC%85%98--page) to set configuration. |
151 |
| - |
152 | 119 | ```javascript
|
153 | 120 | const calendar = new Calendar('#calendar', {
|
154 |
| - defaultView: 'month', |
155 |
| - taskView: true, |
| 121 | + defaultView: 'week', |
156 | 122 | template: {
|
157 |
| - monthDayName: (dayName) => { |
158 |
| - return '<span class="calendar-week-day-name__name">' + dayName.label + '</span>'; |
159 |
| - } |
160 |
| - ... |
161 |
| - } |
| 123 | + time(event) { |
| 124 | + const { start, end, title } = event; |
| 125 | + |
| 126 | + return `<span style="color: white;">${formatTime(start)}~${formatTime(end)} ${title}</span>`; |
| 127 | + }, |
| 128 | + allday(event) { |
| 129 | + return `<span style="color: gray;">${event.title}</span>`; |
| 130 | + }, |
| 131 | + }, |
| 132 | + calendars: [ |
| 133 | + { |
| 134 | + id: 'cal1', |
| 135 | + name: 'Personal', |
| 136 | + backgroundColor: '#03bd9e', |
| 137 | + }, |
| 138 | + { |
| 139 | + id: 'cal2', |
| 140 | + name: 'Work', |
| 141 | + backgroundColor: '#00a9ff', |
| 142 | + }, |
| 143 | + ], |
162 | 144 | });
|
163 | 145 | ```
|
| 146 | + |
| 147 | +## 🔧 Pull Request Steps |
| 148 | + |
| 149 | +TOAST UI products are open source, so you can create a pull request(PR) after you fix issues. |
| 150 | +Run npm scripts and develop yourself with the following process. |
| 151 | + |
| 152 | +### Setup |
| 153 | + |
| 154 | +Fork `develop` branch into your personal repository. |
| 155 | +Clone it to local computer. Install node modules. |
| 156 | +Before starting development, you should check to have any errors. |
| 157 | + |
| 158 | +``` sh |
| 159 | +git clone https://github.com/{your-personal-repo}/[[repo name]].git |
| 160 | +cd [[repo name]] |
| 161 | +npm install |
| 162 | +``` |
| 163 | + |
| 164 | +### Develop |
| 165 | + |
| 166 | +Let's start development! |
| 167 | + |
| 168 | +### Pull Request |
| 169 | + |
| 170 | +Before PR, check to test lastly and then check any errors. |
| 171 | +If it has no error, commit and then push it! |
| 172 | + |
| 173 | +For more information on PR's step, please see links of Contributing section. |
| 174 | + |
| 175 | +## 💬 Contributing |
| 176 | + |
| 177 | +- [Code of Conduct](/CODE_OF_CONDUCT.md) |
| 178 | +- [Contributing Guidelines](/CONTRIBUTING.md) |
| 179 | +- [Commit Message Convention](/docs/COMMIT_MESSAGE_CONVENTION.md) |
| 180 | + |
| 181 | +## 📜 License |
| 182 | + |
| 183 | +This software is licensed under the [MIT](/LICENSE) © [NHN Cloud](https://github.com/nhn). |
0 commit comments