diff --git a/modules/calendar/lib/async-calendar/js/DayCell.jsx b/modules/calendar/lib/async-calendar/js/DayCell.jsx index ebee9272..ec6f4b0f 100644 --- a/modules/calendar/lib/async-calendar/js/DayCell.jsx +++ b/modules/calendar/lib/async-calendar/js/DayCell.jsx @@ -55,7 +55,6 @@ export default function DayCell(props) { return ( {label} ); diff --git a/modules/calendar/lib/async-calendar/js/Functions.jsx b/modules/calendar/lib/async-calendar/js/Functions.jsx index 21762664..73362ebb 100644 --- a/modules/calendar/lib/async-calendar/js/Functions.jsx +++ b/modules/calendar/lib/async-calendar/js/Functions.jsx @@ -138,7 +138,7 @@ export function getPostLinksElement(linkData, handleOnClick) { if (linkData.url) { return ({linkData.label}); } else if (linkData.action) { - return ( handleOnClick(e, linkData)}>{linkData.label}); + return ( handleOnClick(e, linkData)}>{linkData.label}); } } diff --git a/modules/calendar/lib/async-calendar/js/ItemPopup.jsx b/modules/calendar/lib/async-calendar/js/ItemPopup.jsx index 50aa1a8c..6bddbff5 100644 --- a/modules/calendar/lib/async-calendar/js/ItemPopup.jsx +++ b/modules/calendar/lib/async-calendar/js/ItemPopup.jsx @@ -159,7 +159,7 @@ export default function ItemPopup(props) { ); } else if (linkData.action) { links.push( - handleOnClick(e, linkData)}>{linkData.label} + handleOnClick(e, linkData)}>{linkData.label} ); } diff --git a/modules/calendar/lib/async-calendar/js/index.min.js b/modules/calendar/lib/async-calendar/js/index.min.js index 36a5d9b6..6340e0d2 100644 --- a/modules/calendar/lib/async-calendar/js/index.min.js +++ b/modules/calendar/lib/async-calendar/js/index.min.js @@ -118,7 +118,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return DayCell; });\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Functions */ \"./modules/calendar/lib/async-calendar/js/Functions.jsx\");\n/* harmony import */ var _Item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Item */ \"./modules/calendar/lib/async-calendar/js/Item.jsx\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\nfunction DayCell(props) {\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n uncollapseItems = _React$useState2[0],\n setUncollapseItems = _React$useState2[1];\n\n var itemIndex = 0;\n\n var getDayItemClassName = function getDayItemClassName(dayDate, todayDate) {\n var businessDays = [1, 2, 3, 4, 5];\n var dayItemClassName = businessDays.indexOf(dayDate.getDay()) >= 0 ? 'business-day' : 'weekend-day';\n\n if (todayDate.getFullYear() === dayDate.getFullYear() && todayDate.getMonth() === dayDate.getMonth() && todayDate.getDate() === dayDate.getDate()) {\n dayItemClassName += ' publishpress-calendar-today';\n }\n\n if (props.isLoading) {\n dayItemClassName += ' publishpress-calendar-loading';\n }\n\n if (uncollapseItems) {\n dayItemClassName += ' publishpress-calendar-uncollapse';\n }\n\n if (dayDate.getDate() === 1) {\n dayItemClassName += ' publishpress-calendar-first-day-of-month';\n }\n\n if (props.isHovering) {\n dayItemClassName += ' publishpress-calendar-hovering';\n }\n\n return 'publishpress-calendar-' + dayItemClassName;\n };\n\n var toggleUncollapseItems = function toggleUncollapseItems() {\n setUncollapseItems(!uncollapseItems);\n };\n\n var uncollapseButton = function uncollapseButton() {\n if (props.maxVisibleItems === -1) {\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n }\n\n if (props.items.length > props.maxVisibleItems) {\n var numberOfExtraItems = props.items.length - props.maxVisibleItems;\n var label = uncollapseItems ? 'Hide the ' + numberOfExtraItems + ' last items' : 'Show ' + numberOfExtraItems + ' more';\n var className = uncollapseItems ? 'publishpress-calendar-hide-items' : 'publishpress-calendar-show-more';\n var iconClass = uncollapseItems ? 'hidden' : 'visibility';\n return /*#__PURE__*/React.createElement(\"a\", {\n href: \"javascript:void(0);\",\n className: className,\n onClick: toggleUncollapseItems\n }, /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons dashicons-' + iconClass\n }), \" \", label);\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n };\n\n var visibleItems = uncollapseItems || props.maxVisibleItems === -1 ? props.items : props.items.slice(0, props.maxVisibleItems);\n return /*#__PURE__*/React.createElement(\"td\", {\n className: getDayItemClassName(props.date, props.todayDate),\n \"data-year\": props.date.getFullYear(),\n \"data-month\": props.date.getMonth() + 1,\n \"data-day\": props.date.getDate()\n }, /*#__PURE__*/React.createElement(\"div\", null, /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-cell-header\"\n }, props.shouldDisplayMonthName && /*#__PURE__*/React.createElement(\"span\", {\n className: \"publishpress-calendar-month-name\"\n }, Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"getMonthNameByMonthIndex\"])(props.date.getMonth())), /*#__PURE__*/React.createElement(\"span\", {\n className: \"publishpress-calendar-date\"\n }, props.date.getDate()), props.isHovering && /*#__PURE__*/React.createElement(\"span\", {\n className: \"publishpress-calendar-cell-click-to-add\"\n }, props.strings.clickToAdd)), /*#__PURE__*/React.createElement(\"ul\", {\n className: \"publishpress-calendar-day-items\"\n }, visibleItems.map(function (item) {\n var isPopupOpened = item.id === props.openedItemId;\n return /*#__PURE__*/React.createElement(_Item__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n key: 'item-' + item.id + '-' + props.date.getTime(),\n icon: item.icon,\n color: item.color,\n label: item.label,\n id: item.id,\n timestamp: item.timestamp,\n timeFormat: props.timeFormat,\n showTime: item.showTime,\n showIcon: true,\n index: itemIndex++,\n canMove: item.canEdit,\n isPopupOpened: isPopupOpened,\n getPopupItemDataCallback: props.getOpenedItemDataCallback,\n onClickItemCallback: props.onClickItemCallback,\n onItemActionClickCallback: props.onItemActionClickCallback,\n ajaxUrl: props.ajaxUrl,\n strings: props.strings\n });\n })), uncollapseButton()));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/DayCell.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return DayCell; });\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Functions */ \"./modules/calendar/lib/async-calendar/js/Functions.jsx\");\n/* harmony import */ var _Item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Item */ \"./modules/calendar/lib/async-calendar/js/Item.jsx\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\n\nfunction DayCell(props) {\n var _React$useState = React.useState(false),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n uncollapseItems = _React$useState2[0],\n setUncollapseItems = _React$useState2[1];\n\n var itemIndex = 0;\n\n var getDayItemClassName = function getDayItemClassName(dayDate, todayDate) {\n var businessDays = [1, 2, 3, 4, 5];\n var dayItemClassName = businessDays.indexOf(dayDate.getDay()) >= 0 ? 'business-day' : 'weekend-day';\n\n if (todayDate.getFullYear() === dayDate.getFullYear() && todayDate.getMonth() === dayDate.getMonth() && todayDate.getDate() === dayDate.getDate()) {\n dayItemClassName += ' publishpress-calendar-today';\n }\n\n if (props.isLoading) {\n dayItemClassName += ' publishpress-calendar-loading';\n }\n\n if (uncollapseItems) {\n dayItemClassName += ' publishpress-calendar-uncollapse';\n }\n\n if (dayDate.getDate() === 1) {\n dayItemClassName += ' publishpress-calendar-first-day-of-month';\n }\n\n if (props.isHovering) {\n dayItemClassName += ' publishpress-calendar-hovering';\n }\n\n return 'publishpress-calendar-' + dayItemClassName;\n };\n\n var toggleUncollapseItems = function toggleUncollapseItems() {\n setUncollapseItems(!uncollapseItems);\n };\n\n var uncollapseButton = function uncollapseButton() {\n if (props.maxVisibleItems === -1) {\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n }\n\n if (props.items.length > props.maxVisibleItems) {\n var numberOfExtraItems = props.items.length - props.maxVisibleItems;\n var label = uncollapseItems ? 'Hide the ' + numberOfExtraItems + ' last items' : 'Show ' + numberOfExtraItems + ' more';\n var className = uncollapseItems ? 'publishpress-calendar-hide-items' : 'publishpress-calendar-show-more';\n var iconClass = uncollapseItems ? 'hidden' : 'visibility';\n return /*#__PURE__*/React.createElement(\"a\", {\n className: className,\n onClick: toggleUncollapseItems\n }, /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons dashicons-' + iconClass\n }), \" \", label);\n }\n\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n };\n\n var visibleItems = uncollapseItems || props.maxVisibleItems === -1 ? props.items : props.items.slice(0, props.maxVisibleItems);\n return /*#__PURE__*/React.createElement(\"td\", {\n className: getDayItemClassName(props.date, props.todayDate),\n \"data-year\": props.date.getFullYear(),\n \"data-month\": props.date.getMonth() + 1,\n \"data-day\": props.date.getDate()\n }, /*#__PURE__*/React.createElement(\"div\", null, /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-cell-header\"\n }, props.shouldDisplayMonthName && /*#__PURE__*/React.createElement(\"span\", {\n className: \"publishpress-calendar-month-name\"\n }, Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"getMonthNameByMonthIndex\"])(props.date.getMonth())), /*#__PURE__*/React.createElement(\"span\", {\n className: \"publishpress-calendar-date\"\n }, props.date.getDate()), props.isHovering && /*#__PURE__*/React.createElement(\"span\", {\n className: \"publishpress-calendar-cell-click-to-add\"\n }, props.strings.clickToAdd)), /*#__PURE__*/React.createElement(\"ul\", {\n className: \"publishpress-calendar-day-items\"\n }, visibleItems.map(function (item) {\n var isPopupOpened = item.id === props.openedItemId;\n return /*#__PURE__*/React.createElement(_Item__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n key: 'item-' + item.id + '-' + props.date.getTime(),\n icon: item.icon,\n color: item.color,\n label: item.label,\n id: item.id,\n timestamp: item.timestamp,\n timeFormat: props.timeFormat,\n showTime: item.showTime,\n showIcon: true,\n index: itemIndex++,\n canMove: item.canEdit,\n isPopupOpened: isPopupOpened,\n getPopupItemDataCallback: props.getOpenedItemDataCallback,\n onClickItemCallback: props.onClickItemCallback,\n onItemActionClickCallback: props.onItemActionClickCallback,\n ajaxUrl: props.ajaxUrl,\n strings: props.strings\n });\n })), uncollapseButton()));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/DayCell.jsx?"); /***/ }), @@ -142,7 +142,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBeginDateOfWeekByWeekNumber\", function() { return getBeginDateOfWeekByWeekNumber; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWeekNumberByDate\", function() { return getWeekNumberByDate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBeginDateOfWeekByDate\", function() { return getBeginDateOfWeekByDate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getHourStringOnFormat\", function() { return getHourStringOnFormat; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDateAsStringInWpFormat\", function() { return getDateAsStringInWpFormat; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"calculateWeeksInMilliseconds\", function() { return calculateWeeksInMilliseconds; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getMonthNameByMonthIndex\", function() { return getMonthNameByMonthIndex; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDateWithNoTimezoneOffset\", function() { return getDateWithNoTimezoneOffset; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getPostLinksElement\", function() { return getPostLinksElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"callAjaxAction\", function() { return callAjaxAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"callAjaxPostAction\", function() { return callAjaxPostAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getTodayMidnight\", function() { return getTodayMidnight; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDateInstanceFromString\", function() { return getDateInstanceFromString; });\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n/**\n * Base on :\n * https://stackoverflow.com/questions/16590500/javascript-calculate-date-from-week-number\n */\nfunction getBeginDateOfWeekByWeekNumber(weekNumber, year) {\n var weekStartsOnSunday = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var simpleDate = new Date(year, 0, 1 + (weekNumber - 1) * 7);\n var dayOfWeek = simpleDate.getDay();\n var weekStartISO = simpleDate;\n\n if (dayOfWeek <= 4) {\n weekStartISO.setDate(simpleDate.getDate() - simpleDate.getDay() + 1);\n } else {\n weekStartISO.setDate(simpleDate.getDate() + 8 - simpleDate.getDay());\n }\n\n if (weekStartsOnSunday) {\n weekStartISO.setDate(weekStartISO.getDate() - 1);\n }\n\n return weekStartISO;\n}\n/* For a given date, get the ISO week number\n *\n * Based on information at:\n *\n * http://www.merlyn.demon.co.uk/weekcalc.htm#WNR\n *\n * Algorithm is to find nearest thursday, it's year\n * is the year of the week number. Then get weeks\n * between that date and the first day of that year.\n *\n * Note that dates in one year can be weeks of previous\n * or next year, overlap is up to 3 days.\n *\n * e.g. 2014/12/29 is Monday in week 1 of 2015\n * 2012/1/1 is Sunday in week 52 of 2011\n */\n\nfunction getWeekNumberByDate(theDate) {\n var weekStartsOnSunday = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n // Copy date so don't modify original\n var theDateCopy = new Date(theDate.getFullYear(), theDate.getMonth(), theDate.getDate(), theDate.getHours(), theDate.getMinutes(), theDate.getSeconds(), theDate.getMilliseconds());\n var dayOfWeek = theDateCopy.getDay(); // Set to nearest Thursday: current date + 4 - current day number\n // Make Sunday's day number 7\n\n theDateCopy.setDate(theDateCopy.getDate() + 4 - (theDateCopy.getDay() || 7)); // Get first day of year\n\n var yearStart = new Date(theDateCopy.getFullYear(), 0, 1); // Calculate full weeks to nearest Thursday\n\n var weekNo = Math.round(((theDateCopy - yearStart) / 86400000 + 1) / 7);\n\n if (weekStartsOnSunday && dayOfWeek === 0) {\n weekNo++;\n } // Return array of year and week number\n\n\n return [theDateCopy.getFullYear(), weekNo];\n}\nfunction getBeginDateOfWeekByDate(theDate) {\n var weekStartsOnSunday = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var weekNumber = getWeekNumberByDate(theDate, weekStartsOnSunday);\n return getBeginDateOfWeekByWeekNumber(weekNumber[1], weekNumber[0], weekStartsOnSunday);\n}\nfunction getHourStringOnFormat(timestamp) {\n var timeFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ga';\n var hours = timestamp.getHours();\n\n if (timeFormat === 'ga' || timeFormat === 'ha') {\n if (hours === 0) {\n hours = '12am';\n } else if (hours < 12) {\n if (timeFormat === 'ha') {\n hours = hours.toString().padStart(2, '0');\n }\n\n hours += 'am';\n } else {\n if (hours > 12) {\n hours -= 12;\n }\n\n if (timeFormat === 'ha') {\n hours = hours.toString().padStart(2, '0');\n }\n\n hours += 'pm';\n }\n } else {\n hours = hours.toString().padStart(2, '0');\n }\n\n return hours;\n}\nfunction getDateAsStringInWpFormat(theDate) {\n return theDate.getFullYear() + '-' + (theDate.getMonth() + 1).toString().padStart(2, '0') + '-' + theDate.getDate().toString().padStart(2, '0');\n}\nfunction calculateWeeksInMilliseconds(weeks) {\n return weeks * 7 * 24 * 60 * 60 * 1000;\n}\nfunction getMonthNameByMonthIndex(month) {\n var strings = publishpressCalendarParams.strings;\n var monthNames = [strings.monthJan, strings.monthFeb, strings.monthMar, strings.monthApr, strings.monthMay, strings.monthJun, strings.monthJul, strings.monthAug, strings.monthSep, strings.monthOct, strings.monthNov, strings.monthDec];\n return monthNames[month];\n}\nfunction getDateWithNoTimezoneOffset(dateString) {\n var date = new Date(dateString);\n var browserTimezoneOffset = date.getTimezoneOffset() * 60000;\n return new Date(date.getTime() + browserTimezoneOffset);\n}\nfunction getPostLinksElement(linkData, handleOnClick) {\n if (linkData.url) {\n return /*#__PURE__*/React.createElement(\"a\", {\n key: \"link-\".concat(linkData.url, \"-\").concat(linkData.label),\n href: linkData.url\n }, linkData.label);\n } else if (linkData.action) {\n return /*#__PURE__*/React.createElement(\"a\", {\n key: \"link-\".concat(linkData.url, \"-\").concat(linkData.label),\n href: \"javascript:void(0);\",\n onClick: function onClick(e) {\n return handleOnClick(e, linkData);\n }\n }, linkData.label);\n }\n}\nfunction callAjaxAction(_x, _x2, _x3) {\n return _callAjaxAction.apply(this, arguments);\n}\n\nfunction _callAjaxAction() {\n _callAjaxAction = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(action, args, ajaxUrl) {\n var dataUrl, argumentName, response;\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n dataUrl = ajaxUrl + '?action=' + action;\n _context.t0 = regeneratorRuntime.keys(args);\n\n case 2:\n if ((_context.t1 = _context.t0()).done) {\n _context.next = 9;\n break;\n }\n\n argumentName = _context.t1.value;\n\n if (args.hasOwnProperty(argumentName)) {\n _context.next = 6;\n break;\n }\n\n return _context.abrupt(\"continue\", 2);\n\n case 6:\n dataUrl += '&' + argumentName + '=' + args[argumentName];\n _context.next = 2;\n break;\n\n case 9:\n _context.next = 11;\n return fetch(dataUrl);\n\n case 11:\n response = _context.sent;\n _context.next = 14;\n return response.json();\n\n case 14:\n return _context.abrupt(\"return\", _context.sent);\n\n case 15:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _callAjaxAction.apply(this, arguments);\n}\n\nfunction callAjaxPostAction(_x4, _x5, _x6, _x7) {\n return _callAjaxPostAction.apply(this, arguments);\n}\n\nfunction _callAjaxPostAction() {\n _callAjaxPostAction = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(action, args, ajaxUrl, body) {\n var dataUrl, argumentName, response;\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n dataUrl = ajaxUrl + '?action=' + action;\n _context2.t0 = regeneratorRuntime.keys(args);\n\n case 2:\n if ((_context2.t1 = _context2.t0()).done) {\n _context2.next = 9;\n break;\n }\n\n argumentName = _context2.t1.value;\n\n if (args.hasOwnProperty(argumentName)) {\n _context2.next = 6;\n break;\n }\n\n return _context2.abrupt(\"continue\", 2);\n\n case 6:\n dataUrl += '&' + argumentName + '=' + args[argumentName];\n _context2.next = 2;\n break;\n\n case 9:\n _context2.next = 11;\n return fetch(dataUrl, {\n method: 'post',\n body: body\n });\n\n case 11:\n response = _context2.sent;\n _context2.next = 14;\n return response.json();\n\n case 14:\n return _context2.abrupt(\"return\", _context2.sent);\n\n case 15:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n return _callAjaxPostAction.apply(this, arguments);\n}\n\nfunction getTodayMidnight() {\n var today = new Date();\n today.setHours(0, 0, 0, 0);\n return today;\n}\nfunction getDateInstanceFromString(dateString) {\n // The \"-\" char is replaced to make it compatible to Safari browser. Issue #1001.\n return new Date(String(dateString).replace(/-/g, \"/\"));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/Functions.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBeginDateOfWeekByWeekNumber\", function() { return getBeginDateOfWeekByWeekNumber; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getWeekNumberByDate\", function() { return getWeekNumberByDate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getBeginDateOfWeekByDate\", function() { return getBeginDateOfWeekByDate; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getHourStringOnFormat\", function() { return getHourStringOnFormat; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDateAsStringInWpFormat\", function() { return getDateAsStringInWpFormat; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"calculateWeeksInMilliseconds\", function() { return calculateWeeksInMilliseconds; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getMonthNameByMonthIndex\", function() { return getMonthNameByMonthIndex; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDateWithNoTimezoneOffset\", function() { return getDateWithNoTimezoneOffset; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getPostLinksElement\", function() { return getPostLinksElement; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"callAjaxAction\", function() { return callAjaxAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"callAjaxPostAction\", function() { return callAjaxPostAction; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getTodayMidnight\", function() { return getTodayMidnight; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"getDateInstanceFromString\", function() { return getDateInstanceFromString; });\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\n/**\n * Base on :\n * https://stackoverflow.com/questions/16590500/javascript-calculate-date-from-week-number\n */\nfunction getBeginDateOfWeekByWeekNumber(weekNumber, year) {\n var weekStartsOnSunday = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;\n var simpleDate = new Date(year, 0, 1 + (weekNumber - 1) * 7);\n var dayOfWeek = simpleDate.getDay();\n var weekStartISO = simpleDate;\n\n if (dayOfWeek <= 4) {\n weekStartISO.setDate(simpleDate.getDate() - simpleDate.getDay() + 1);\n } else {\n weekStartISO.setDate(simpleDate.getDate() + 8 - simpleDate.getDay());\n }\n\n if (weekStartsOnSunday) {\n weekStartISO.setDate(weekStartISO.getDate() - 1);\n }\n\n return weekStartISO;\n}\n/* For a given date, get the ISO week number\n *\n * Based on information at:\n *\n * http://www.merlyn.demon.co.uk/weekcalc.htm#WNR\n *\n * Algorithm is to find nearest thursday, it's year\n * is the year of the week number. Then get weeks\n * between that date and the first day of that year.\n *\n * Note that dates in one year can be weeks of previous\n * or next year, overlap is up to 3 days.\n *\n * e.g. 2014/12/29 is Monday in week 1 of 2015\n * 2012/1/1 is Sunday in week 52 of 2011\n */\n\nfunction getWeekNumberByDate(theDate) {\n var weekStartsOnSunday = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n // Copy date so don't modify original\n var theDateCopy = new Date(theDate.getFullYear(), theDate.getMonth(), theDate.getDate(), theDate.getHours(), theDate.getMinutes(), theDate.getSeconds(), theDate.getMilliseconds());\n var dayOfWeek = theDateCopy.getDay(); // Set to nearest Thursday: current date + 4 - current day number\n // Make Sunday's day number 7\n\n theDateCopy.setDate(theDateCopy.getDate() + 4 - (theDateCopy.getDay() || 7)); // Get first day of year\n\n var yearStart = new Date(theDateCopy.getFullYear(), 0, 1); // Calculate full weeks to nearest Thursday\n\n var weekNo = Math.round(((theDateCopy - yearStart) / 86400000 + 1) / 7);\n\n if (weekStartsOnSunday && dayOfWeek === 0) {\n weekNo++;\n } // Return array of year and week number\n\n\n return [theDateCopy.getFullYear(), weekNo];\n}\nfunction getBeginDateOfWeekByDate(theDate) {\n var weekStartsOnSunday = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var weekNumber = getWeekNumberByDate(theDate, weekStartsOnSunday);\n return getBeginDateOfWeekByWeekNumber(weekNumber[1], weekNumber[0], weekStartsOnSunday);\n}\nfunction getHourStringOnFormat(timestamp) {\n var timeFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'ga';\n var hours = timestamp.getHours();\n\n if (timeFormat === 'ga' || timeFormat === 'ha') {\n if (hours === 0) {\n hours = '12am';\n } else if (hours < 12) {\n if (timeFormat === 'ha') {\n hours = hours.toString().padStart(2, '0');\n }\n\n hours += 'am';\n } else {\n if (hours > 12) {\n hours -= 12;\n }\n\n if (timeFormat === 'ha') {\n hours = hours.toString().padStart(2, '0');\n }\n\n hours += 'pm';\n }\n } else {\n hours = hours.toString().padStart(2, '0');\n }\n\n return hours;\n}\nfunction getDateAsStringInWpFormat(theDate) {\n return theDate.getFullYear() + '-' + (theDate.getMonth() + 1).toString().padStart(2, '0') + '-' + theDate.getDate().toString().padStart(2, '0');\n}\nfunction calculateWeeksInMilliseconds(weeks) {\n return weeks * 7 * 24 * 60 * 60 * 1000;\n}\nfunction getMonthNameByMonthIndex(month) {\n var strings = publishpressCalendarParams.strings;\n var monthNames = [strings.monthJan, strings.monthFeb, strings.monthMar, strings.monthApr, strings.monthMay, strings.monthJun, strings.monthJul, strings.monthAug, strings.monthSep, strings.monthOct, strings.monthNov, strings.monthDec];\n return monthNames[month];\n}\nfunction getDateWithNoTimezoneOffset(dateString) {\n var date = new Date(dateString);\n var browserTimezoneOffset = date.getTimezoneOffset() * 60000;\n return new Date(date.getTime() + browserTimezoneOffset);\n}\nfunction getPostLinksElement(linkData, handleOnClick) {\n if (linkData.url) {\n return /*#__PURE__*/React.createElement(\"a\", {\n key: \"link-\".concat(linkData.url, \"-\").concat(linkData.label),\n href: linkData.url\n }, linkData.label);\n } else if (linkData.action) {\n return /*#__PURE__*/React.createElement(\"a\", {\n key: \"link-\".concat(linkData.url, \"-\").concat(linkData.label),\n onClick: function onClick(e) {\n return handleOnClick(e, linkData);\n }\n }, linkData.label);\n }\n}\nfunction callAjaxAction(_x, _x2, _x3) {\n return _callAjaxAction.apply(this, arguments);\n}\n\nfunction _callAjaxAction() {\n _callAjaxAction = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(action, args, ajaxUrl) {\n var dataUrl, argumentName, response;\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n dataUrl = ajaxUrl + '?action=' + action;\n _context.t0 = regeneratorRuntime.keys(args);\n\n case 2:\n if ((_context.t1 = _context.t0()).done) {\n _context.next = 9;\n break;\n }\n\n argumentName = _context.t1.value;\n\n if (args.hasOwnProperty(argumentName)) {\n _context.next = 6;\n break;\n }\n\n return _context.abrupt(\"continue\", 2);\n\n case 6:\n dataUrl += '&' + argumentName + '=' + args[argumentName];\n _context.next = 2;\n break;\n\n case 9:\n _context.next = 11;\n return fetch(dataUrl);\n\n case 11:\n response = _context.sent;\n _context.next = 14;\n return response.json();\n\n case 14:\n return _context.abrupt(\"return\", _context.sent);\n\n case 15:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee);\n }));\n return _callAjaxAction.apply(this, arguments);\n}\n\nfunction callAjaxPostAction(_x4, _x5, _x6, _x7) {\n return _callAjaxPostAction.apply(this, arguments);\n}\n\nfunction _callAjaxPostAction() {\n _callAjaxPostAction = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(action, args, ajaxUrl, body) {\n var dataUrl, argumentName, response;\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n dataUrl = ajaxUrl + '?action=' + action;\n _context2.t0 = regeneratorRuntime.keys(args);\n\n case 2:\n if ((_context2.t1 = _context2.t0()).done) {\n _context2.next = 9;\n break;\n }\n\n argumentName = _context2.t1.value;\n\n if (args.hasOwnProperty(argumentName)) {\n _context2.next = 6;\n break;\n }\n\n return _context2.abrupt(\"continue\", 2);\n\n case 6:\n dataUrl += '&' + argumentName + '=' + args[argumentName];\n _context2.next = 2;\n break;\n\n case 9:\n _context2.next = 11;\n return fetch(dataUrl, {\n method: 'post',\n body: body\n });\n\n case 11:\n response = _context2.sent;\n _context2.next = 14;\n return response.json();\n\n case 14:\n return _context2.abrupt(\"return\", _context2.sent);\n\n case 15:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2);\n }));\n return _callAjaxPostAction.apply(this, arguments);\n}\n\nfunction getTodayMidnight() {\n var today = new Date();\n today.setHours(0, 0, 0, 0);\n return today;\n}\nfunction getDateInstanceFromString(dateString) {\n // The \"-\" char is replaced to make it compatible to Safari browser. Issue #1001.\n return new Date(String(dateString).replace(/-/g, \"/\"));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/Functions.jsx?"); /***/ }), @@ -178,7 +178,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return ItemPopup; });\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Functions */ \"./modules/calendar/lib/async-calendar/js/Functions.jsx\");\n/* harmony import */ var _fields_DateTimeField__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fields/DateTimeField */ \"./modules/calendar/lib/async-calendar/js/fields/DateTimeField.jsx\");\n/* harmony import */ var _fields_AuthorsField__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fields/AuthorsField */ \"./modules/calendar/lib/async-calendar/js/fields/AuthorsField.jsx\");\n/* harmony import */ var _fields_PostTypeField__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fields/PostTypeField */ \"./modules/calendar/lib/async-calendar/js/fields/PostTypeField.jsx\");\n/* harmony import */ var _fields_SelectField__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fields/SelectField */ \"./modules/calendar/lib/async-calendar/js/fields/SelectField.jsx\");\n/* harmony import */ var _fields_PostStatusField__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./fields/PostStatusField */ \"./modules/calendar/lib/async-calendar/js/fields/PostStatusField.jsx\");\n/* harmony import */ var _fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./fields/TaxonomyField */ \"./modules/calendar/lib/async-calendar/js/fields/TaxonomyField.jsx\");\n/* harmony import */ var _fields_CheckboxField__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fields/CheckboxField */ \"./modules/calendar/lib/async-calendar/js/fields/CheckboxField.jsx\");\n/* harmony import */ var _fields_LocationField__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./fields/LocationField */ \"./modules/calendar/lib/async-calendar/js/fields/LocationField.jsx\");\n/* harmony import */ var _fields_TextArea__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./fields/TextArea */ \"./modules/calendar/lib/async-calendar/js/fields/TextArea.jsx\");\n/* harmony import */ var _fields_TextField__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./fields/TextField */ \"./modules/calendar/lib/async-calendar/js/fields/TextField.jsx\");\n/* harmony import */ var _fields_UserField__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./fields/UserField */ \"./modules/calendar/lib/async-calendar/js/fields/UserField.jsx\");\n/* harmony import */ var _fields_NumberField__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./fields/NumberField */ \"./modules/calendar/lib/async-calendar/js/fields/NumberField.jsx\");\n/* harmony import */ var _fields_TimeField__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./fields/TimeField */ \"./modules/calendar/lib/async-calendar/js/fields/TimeField.jsx\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar $ = jQuery;\nfunction ItemPopup(props) {\n if (!props.data) {\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n }\n\n if (!props.target.current) {\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n }\n\n var offsetX = 10;\n var offsetWidth = 180;\n var targetPosition = $(props.target.current).position();\n var targetOffset = $(props.target.current).offset();\n var targetWidth = $(props.target.current).width();\n var popupWidth = 380;\n\n var isWiderThanParentWidth = function isWiderThanParentWidth() {\n return targetOffset.left + popupWidth + offsetX + offsetWidth >= $(document).width();\n };\n\n var getPositionOnRightSide = function getPositionOnRightSide() {\n return targetPosition.left + targetWidth + offsetX;\n };\n\n var getPositionOnLeftSide = function getPositionOnLeftSide() {\n return targetPosition.left - offsetX * 2.5 - popupWidth;\n };\n\n var closePopup = function closePopup() {\n $(document).trigger('publishpress_calendar:close_popup');\n };\n\n var positionTop = targetPosition.top;\n var positionLeft = isWiderThanParentWidth() ? getPositionOnLeftSide() : getPositionOnRightSide();\n\n var getFieldRows = function getFieldRows() {\n var fieldRows = [];\n var dataProperty;\n var field;\n\n for (var dataPropertyName in props.data.fields) {\n if (!props.data.fields.hasOwnProperty(dataPropertyName)) {\n continue;\n }\n\n dataProperty = props.data.fields[dataPropertyName];\n\n switch (dataProperty.type) {\n case 'date':\n field = /*#__PURE__*/React.createElement(_fields_DateTimeField__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n value: dataProperty.value,\n valueString: dataProperty.valueString || null,\n isEditing: false\n });\n break;\n\n case 'time':\n field = /*#__PURE__*/React.createElement(_fields_TimeField__WEBPACK_IMPORTED_MODULE_13__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'authors':\n field = /*#__PURE__*/React.createElement(_fields_AuthorsField__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'select':\n field = /*#__PURE__*/React.createElement(_fields_SelectField__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'type':\n field = /*#__PURE__*/React.createElement(_fields_PostTypeField__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'status':\n field = /*#__PURE__*/React.createElement(_fields_PostStatusField__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'taxonomy':\n field = /*#__PURE__*/React.createElement(_fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'checkbox':\n field = /*#__PURE__*/React.createElement(_fields_CheckboxField__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'location':\n field = /*#__PURE__*/React.createElement(_fields_LocationField__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'paragraph':\n field = /*#__PURE__*/React.createElement(_fields_TextArea__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'text':\n field = /*#__PURE__*/React.createElement(_fields_TextField__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'user':\n field = /*#__PURE__*/React.createElement(_fields_UserField__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'number':\n field = /*#__PURE__*/React.createElement(_fields_NumberField__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n default:\n field = null;\n break;\n }\n\n fieldRows.push( /*#__PURE__*/React.createElement(\"tr\", {\n key: \"field-rows-popup-\".concat(fieldRows.length)\n }, /*#__PURE__*/React.createElement(\"th\", null, dataProperty.label, \":\"), /*#__PURE__*/React.createElement(\"td\", null, field)));\n }\n\n return fieldRows;\n };\n\n var handleOnClick = function handleOnClick(e, linkData) {\n e.preventDefault();\n Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"callAjaxAction\"])(linkData.action, linkData.args, props.ajaxUrl).then(function (result) {\n props.onItemActionClickCallback(linkData.action, props.id, result);\n });\n };\n\n var getPostLinks = function getPostLinks() {\n var links = [];\n var linkData;\n\n for (var linkName in props.data.links) {\n if (!props.data.links.hasOwnProperty(linkName)) {\n continue;\n }\n\n linkData = props.data.links[linkName];\n\n if (linkData.url) {\n links.push( /*#__PURE__*/React.createElement(\"a\", {\n key: \"links-popup-\".concat(links.length),\n href: linkData.url\n }, linkData.label));\n } else if (linkData.action) {\n links.push( /*#__PURE__*/React.createElement(\"a\", {\n key: \"links-popup-\".concat(links.length),\n href: \"javascript:void(0);\",\n onClick: function onClick(e) {\n return handleOnClick(e, linkData);\n }\n }, linkData.label));\n }\n\n links.push( /*#__PURE__*/React.createElement(\"span\", {\n key: \"links-popup-\".concat(links.length)\n }, \"|\"));\n }\n\n links.pop();\n return links;\n };\n\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-popup\",\n style: {\n top: positionTop,\n left: positionLeft\n }\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-popup-title\",\n style: {\n backgroundColor: props.color\n }\n }, props.icon && /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons ' + props.icon + ' publishpress-calendar-icon'\n }), /*#__PURE__*/React.createElement(\"span\", {\n dangerouslySetInnerHTML: {\n __html: props.title\n }\n }), /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons dashicons-no publishpress-calendar-popup-close',\n title: props.strings.close,\n onClick: closePopup\n })), /*#__PURE__*/React.createElement(\"table\", null, /*#__PURE__*/React.createElement(\"tbody\", null, getFieldRows())), /*#__PURE__*/React.createElement(\"hr\", null), /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-popup-links\"\n }, getPostLinks()));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/ItemPopup.jsx?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return ItemPopup; });\n/* harmony import */ var _Functions__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Functions */ \"./modules/calendar/lib/async-calendar/js/Functions.jsx\");\n/* harmony import */ var _fields_DateTimeField__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fields/DateTimeField */ \"./modules/calendar/lib/async-calendar/js/fields/DateTimeField.jsx\");\n/* harmony import */ var _fields_AuthorsField__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fields/AuthorsField */ \"./modules/calendar/lib/async-calendar/js/fields/AuthorsField.jsx\");\n/* harmony import */ var _fields_PostTypeField__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fields/PostTypeField */ \"./modules/calendar/lib/async-calendar/js/fields/PostTypeField.jsx\");\n/* harmony import */ var _fields_SelectField__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./fields/SelectField */ \"./modules/calendar/lib/async-calendar/js/fields/SelectField.jsx\");\n/* harmony import */ var _fields_PostStatusField__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./fields/PostStatusField */ \"./modules/calendar/lib/async-calendar/js/fields/PostStatusField.jsx\");\n/* harmony import */ var _fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./fields/TaxonomyField */ \"./modules/calendar/lib/async-calendar/js/fields/TaxonomyField.jsx\");\n/* harmony import */ var _fields_CheckboxField__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fields/CheckboxField */ \"./modules/calendar/lib/async-calendar/js/fields/CheckboxField.jsx\");\n/* harmony import */ var _fields_LocationField__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./fields/LocationField */ \"./modules/calendar/lib/async-calendar/js/fields/LocationField.jsx\");\n/* harmony import */ var _fields_TextArea__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./fields/TextArea */ \"./modules/calendar/lib/async-calendar/js/fields/TextArea.jsx\");\n/* harmony import */ var _fields_TextField__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./fields/TextField */ \"./modules/calendar/lib/async-calendar/js/fields/TextField.jsx\");\n/* harmony import */ var _fields_UserField__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./fields/UserField */ \"./modules/calendar/lib/async-calendar/js/fields/UserField.jsx\");\n/* harmony import */ var _fields_NumberField__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./fields/NumberField */ \"./modules/calendar/lib/async-calendar/js/fields/NumberField.jsx\");\n/* harmony import */ var _fields_TimeField__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./fields/TimeField */ \"./modules/calendar/lib/async-calendar/js/fields/TimeField.jsx\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar $ = jQuery;\nfunction ItemPopup(props) {\n if (!props.data) {\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n }\n\n if (!props.target.current) {\n return /*#__PURE__*/React.createElement(React.Fragment, null);\n }\n\n var offsetX = 10;\n var offsetWidth = 180;\n var targetPosition = $(props.target.current).position();\n var targetOffset = $(props.target.current).offset();\n var targetWidth = $(props.target.current).width();\n var popupWidth = 380;\n\n var isWiderThanParentWidth = function isWiderThanParentWidth() {\n return targetOffset.left + popupWidth + offsetX + offsetWidth >= $(document).width();\n };\n\n var getPositionOnRightSide = function getPositionOnRightSide() {\n return targetPosition.left + targetWidth + offsetX;\n };\n\n var getPositionOnLeftSide = function getPositionOnLeftSide() {\n return targetPosition.left - offsetX * 2.5 - popupWidth;\n };\n\n var closePopup = function closePopup() {\n $(document).trigger('publishpress_calendar:close_popup');\n };\n\n var positionTop = targetPosition.top;\n var positionLeft = isWiderThanParentWidth() ? getPositionOnLeftSide() : getPositionOnRightSide();\n\n var getFieldRows = function getFieldRows() {\n var fieldRows = [];\n var dataProperty;\n var field;\n\n for (var dataPropertyName in props.data.fields) {\n if (!props.data.fields.hasOwnProperty(dataPropertyName)) {\n continue;\n }\n\n dataProperty = props.data.fields[dataPropertyName];\n\n switch (dataProperty.type) {\n case 'date':\n field = /*#__PURE__*/React.createElement(_fields_DateTimeField__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n value: dataProperty.value,\n valueString: dataProperty.valueString || null,\n isEditing: false\n });\n break;\n\n case 'time':\n field = /*#__PURE__*/React.createElement(_fields_TimeField__WEBPACK_IMPORTED_MODULE_13__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'authors':\n field = /*#__PURE__*/React.createElement(_fields_AuthorsField__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'select':\n field = /*#__PURE__*/React.createElement(_fields_SelectField__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'type':\n field = /*#__PURE__*/React.createElement(_fields_PostTypeField__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'status':\n field = /*#__PURE__*/React.createElement(_fields_PostStatusField__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'taxonomy':\n field = /*#__PURE__*/React.createElement(_fields_TaxonomyField__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'checkbox':\n field = /*#__PURE__*/React.createElement(_fields_CheckboxField__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'location':\n field = /*#__PURE__*/React.createElement(_fields_LocationField__WEBPACK_IMPORTED_MODULE_8__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'paragraph':\n field = /*#__PURE__*/React.createElement(_fields_TextArea__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'text':\n field = /*#__PURE__*/React.createElement(_fields_TextField__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'user':\n field = /*#__PURE__*/React.createElement(_fields_UserField__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n case 'number':\n field = /*#__PURE__*/React.createElement(_fields_NumberField__WEBPACK_IMPORTED_MODULE_12__[\"default\"], {\n value: dataProperty.value,\n isEditing: false\n });\n break;\n\n default:\n field = null;\n break;\n }\n\n fieldRows.push( /*#__PURE__*/React.createElement(\"tr\", {\n key: \"field-rows-popup-\".concat(fieldRows.length)\n }, /*#__PURE__*/React.createElement(\"th\", null, dataProperty.label, \":\"), /*#__PURE__*/React.createElement(\"td\", null, field)));\n }\n\n return fieldRows;\n };\n\n var handleOnClick = function handleOnClick(e, linkData) {\n e.preventDefault();\n Object(_Functions__WEBPACK_IMPORTED_MODULE_0__[\"callAjaxAction\"])(linkData.action, linkData.args, props.ajaxUrl).then(function (result) {\n props.onItemActionClickCallback(linkData.action, props.id, result);\n });\n };\n\n var getPostLinks = function getPostLinks() {\n var links = [];\n var linkData;\n\n for (var linkName in props.data.links) {\n if (!props.data.links.hasOwnProperty(linkName)) {\n continue;\n }\n\n linkData = props.data.links[linkName];\n\n if (linkData.url) {\n links.push( /*#__PURE__*/React.createElement(\"a\", {\n key: \"links-popup-\".concat(links.length),\n href: linkData.url\n }, linkData.label));\n } else if (linkData.action) {\n links.push( /*#__PURE__*/React.createElement(\"a\", {\n key: \"links-popup-\".concat(links.length),\n onClick: function onClick(e) {\n return handleOnClick(e, linkData);\n }\n }, linkData.label));\n }\n\n links.push( /*#__PURE__*/React.createElement(\"span\", {\n key: \"links-popup-\".concat(links.length)\n }, \"|\"));\n }\n\n links.pop();\n return links;\n };\n\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-popup\",\n style: {\n top: positionTop,\n left: positionLeft\n }\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-popup-title\",\n style: {\n backgroundColor: props.color\n }\n }, props.icon && /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons ' + props.icon + ' publishpress-calendar-icon'\n }), /*#__PURE__*/React.createElement(\"span\", {\n dangerouslySetInnerHTML: {\n __html: props.title\n }\n }), /*#__PURE__*/React.createElement(\"span\", {\n className: 'dashicons dashicons-no publishpress-calendar-popup-close',\n title: props.strings.close,\n onClick: closePopup\n })), /*#__PURE__*/React.createElement(\"table\", null, /*#__PURE__*/React.createElement(\"tbody\", null, getFieldRows())), /*#__PURE__*/React.createElement(\"hr\", null), /*#__PURE__*/React.createElement(\"div\", {\n className: \"publishpress-calendar-popup-links\"\n }, getPostLinks()));\n}\n\n//# sourceURL=webpack:///./modules/calendar/lib/async-calendar/js/ItemPopup.jsx?"); /***/ }),