@panneau/list-calendar 4.0.2 → 4.0.4
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/es/index.js +86 -73
- package/package.json +8 -8
package/es/index.js
CHANGED
|
@@ -7,6 +7,7 @@ import { useState, useMemo, useCallback, useEffect } from 'react';
|
|
|
7
7
|
import { useIntl, FormattedDate } from 'react-intl';
|
|
8
8
|
import Button from '@panneau/element-button';
|
|
9
9
|
import Icon from '@panneau/element-icon';
|
|
10
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
10
11
|
|
|
11
12
|
var styles = {"container":"panneau-list-calendar-container","inner":"panneau-list-calendar-inner","calendarHeader":"panneau-list-calendar-calendarHeader","activePeriod":"panneau-list-calendar-activePeriod","activePeriodWithDates":"panneau-list-calendar-activePeriodWithDates","arrow":"panneau-list-calendar-arrow","calendarGrid":"panneau-list-calendar-calendarGrid","calendarBox":"panneau-list-calendar-calendarBox","headerBox":"panneau-list-calendar-headerBox","day":"panneau-list-calendar-day","isToday":"panneau-list-calendar-isToday","isPast":"panneau-list-calendar-isPast","dayButton":"panneau-list-calendar-dayButton","active":"panneau-list-calendar-active"};
|
|
12
13
|
|
|
@@ -173,79 +174,91 @@ function CalendarList(_ref) {
|
|
|
173
174
|
}
|
|
174
175
|
return acc;
|
|
175
176
|
}, false);
|
|
176
|
-
return /*#__PURE__*/
|
|
177
|
-
className: classNames([styles.container, _defineProperty({}, className, className !== null)])
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
177
|
+
return /*#__PURE__*/jsx("div", {
|
|
178
|
+
className: classNames([styles.container, _defineProperty({}, className, className !== null)]),
|
|
179
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
180
|
+
className: styles.inner,
|
|
181
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
182
|
+
className: styles.calendarHeader,
|
|
183
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
184
|
+
className: styles.arrow,
|
|
185
|
+
onClick: function onClick(e) {
|
|
186
|
+
return onClickPeriodChange(e, true);
|
|
187
|
+
},
|
|
188
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
189
|
+
name: "arrow-left"
|
|
190
|
+
})
|
|
191
|
+
}), mode === 'weekly' ? /*#__PURE__*/jsx("div", {
|
|
192
|
+
className: styles.activePeriod,
|
|
193
|
+
children: weekHasDates ? /*#__PURE__*/jsx("span", {
|
|
194
|
+
className: styles.activePeriodWithDates,
|
|
195
|
+
children: /*#__PURE__*/jsx(FormattedDate, {
|
|
196
|
+
value: activeDate,
|
|
197
|
+
day: "numeric",
|
|
198
|
+
month: "long",
|
|
199
|
+
year: "numeric"
|
|
200
|
+
})
|
|
201
|
+
}) : /*#__PURE__*/jsx(FormattedDate, {
|
|
202
|
+
value: activeDate,
|
|
203
|
+
day: "numeric",
|
|
204
|
+
month: "long",
|
|
205
|
+
year: "numeric"
|
|
206
|
+
})
|
|
207
|
+
}) : /*#__PURE__*/jsx("div", {
|
|
208
|
+
className: styles.activePeriod,
|
|
209
|
+
children: monthHasDates ? /*#__PURE__*/jsx("span", {
|
|
210
|
+
className: styles.activePeriodWithDates,
|
|
211
|
+
children: /*#__PURE__*/jsx(FormattedDate, {
|
|
212
|
+
value: activeDate,
|
|
213
|
+
month: "long",
|
|
214
|
+
year: "numeric"
|
|
215
|
+
})
|
|
216
|
+
}) : /*#__PURE__*/jsx(FormattedDate, {
|
|
217
|
+
value: activeDate,
|
|
218
|
+
month: "long",
|
|
219
|
+
year: "numeric"
|
|
220
|
+
})
|
|
221
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
222
|
+
className: classNames([styles.arrow, styles.right]),
|
|
223
|
+
onClick: onClickPeriodChange,
|
|
224
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
225
|
+
name: "arrow-right"
|
|
226
|
+
})
|
|
227
|
+
})]
|
|
228
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
229
|
+
className: styles.calendarGrid,
|
|
230
|
+
children: [days.map(function (d, i) {
|
|
231
|
+
return /*#__PURE__*/jsx("div", {
|
|
232
|
+
className: classNames([styles.calendarBox, styles.headerBox]),
|
|
233
|
+
children: d
|
|
234
|
+
}, "day-".concat(i + 1));
|
|
235
|
+
}), datesArray.map(function (d, i) {
|
|
236
|
+
var dTime = format(d, 'yyyy-MM-dd');
|
|
237
|
+
var isCurrentYear = d.getUTCFullYear() === currentYear;
|
|
238
|
+
var isCurrentMonth = d.getUTCMonth() === currentMonth;
|
|
239
|
+
var isToday = isCurrentYear && isCurrentMonth && d.getDate() === currentDayOfTheMonth;
|
|
240
|
+
var eventTime = d.getTime();
|
|
241
|
+
var todayTime = currentDate.getTime();
|
|
242
|
+
var isPast = eventTime < todayTime && !isToday;
|
|
243
|
+
var hasItem = dates.includes(dTime);
|
|
244
|
+
var inner = hasItem ? /*#__PURE__*/jsx(Button, {
|
|
245
|
+
onClick: function onClick(e) {
|
|
246
|
+
return onSelectDate(e, dTime);
|
|
247
|
+
},
|
|
248
|
+
className: classNames(styles.day, styles.dayButton, _defineProperty(_defineProperty(_defineProperty({}, styles.isToday, isToday), styles.isPast, isPast), styles.active, dates.includes(dTime))),
|
|
249
|
+
children: format(d, 'd')
|
|
250
|
+
}) : /*#__PURE__*/jsx("div", {
|
|
251
|
+
className: classNames(styles.day, _defineProperty({}, styles.isToday, isToday)),
|
|
252
|
+
children: format(d, 'd')
|
|
253
|
+
});
|
|
254
|
+
return /*#__PURE__*/jsx("div", {
|
|
255
|
+
className: styles.calendarBox,
|
|
256
|
+
children: d.getUTCMonth() !== activeMonth && mode === 'monthly' ? '' : inner
|
|
257
|
+
}, "date-".concat(d.getTime, "-").concat(i + 1));
|
|
258
|
+
})]
|
|
259
|
+
})]
|
|
260
|
+
})
|
|
261
|
+
});
|
|
249
262
|
}
|
|
250
263
|
|
|
251
264
|
export { CalendarList as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@panneau/list-calendar",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "Calendar list",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"javascript"
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"@babel/runtime": "^7.12.5",
|
|
54
|
-
"@panneau/core": "^4.0.
|
|
55
|
-
"@panneau/element-button": "^4.0.
|
|
56
|
-
"@panneau/element-card": "^4.0.
|
|
57
|
-
"@panneau/element-icon": "^4.0.
|
|
58
|
-
"@panneau/element-loading": "^4.0.
|
|
59
|
-
"@panneau/themes": "^4.0.
|
|
54
|
+
"@panneau/core": "^4.0.4",
|
|
55
|
+
"@panneau/element-button": "^4.0.4",
|
|
56
|
+
"@panneau/element-card": "^4.0.4",
|
|
57
|
+
"@panneau/element-icon": "^4.0.4",
|
|
58
|
+
"@panneau/element-loading": "^4.0.4",
|
|
59
|
+
"@panneau/themes": "^4.0.4",
|
|
60
60
|
"classnames": "^2.5.1",
|
|
61
61
|
"date-fns": "^3.3.1",
|
|
62
62
|
"lodash-es": "^4.17.21",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "e854451a718c6bc7dcde2b804c9913d8ac0297ff"
|
|
71
71
|
}
|