From b0177749f94ed581106f794383ef47006917c6ba Mon Sep 17 00:00:00 2001 From: fs-nathan Date: Mon, 13 May 2024 15:37:38 +0700 Subject: [PATCH] fix: bug undefined --- dist/react-big-calendar.esm.js | 8 +++++++ dist/react-big-calendar.js | 6 ------ dist/react-big-calendar.min.js | 5 +++-- lib/CustomWeekEvents.js | 39 +++++++++++++++++----------------- lib/EventCustomRow.js | 10 +++++++++ lib/EventRow.js | 10 +++++++++ lib/ResourceHeader.js | 9 ++++++++ lib/TimeSlotGroup.js | 11 ++++++++++ src/CustomWeekEvents.js | 29 +++++++++++++------------ 9 files changed, 86 insertions(+), 41 deletions(-) diff --git a/dist/react-big-calendar.esm.js b/dist/react-big-calendar.esm.js index 689df4f..eaac9d7 100644 --- a/dist/react-big-calendar.esm.js +++ b/dist/react-big-calendar.esm.js @@ -4247,6 +4247,14 @@ var ResourceHeader = function ResourceHeader(_ref) { var label = _ref.label return /*#__PURE__*/ React.createElement(React.Fragment, null, label) } +ResourceHeader.propTypes = + process.env.NODE_ENV !== 'production' + ? { + label: PropTypes.node, + index: PropTypes.number, + resource: PropTypes.object, + } + : {} var TimeGridHeader = /*#__PURE__*/ (function (_React$Component) { _inherits(TimeGridHeader, _React$Component) diff --git a/dist/react-big-calendar.js b/dist/react-big-calendar.js index 4e534f4..c91f3c3 100644 --- a/dist/react-big-calendar.js +++ b/dist/react-big-calendar.js @@ -47708,12 +47708,6 @@ label ) } - Header.propTypes = - 'development' !== 'production' - ? { - label: propTypesExports.node, - } - : {} var DateHeader = function DateHeader(_ref) { var label = _ref.label, diff --git a/dist/react-big-calendar.min.js b/dist/react-big-calendar.min.js index f227c46..0aa1d0c 100644 --- a/dist/react-big-calendar.min.js +++ b/dist/react-big-calendar.min.js @@ -13924,8 +13924,9 @@ t ) : le.createElement('span', null, t) - }, - gk = ['date', 'className'], + } + mk.propTypes = {} + var gk = ['date', 'className'], yk = (function (e) { function t() { var e diff --git a/lib/CustomWeekEvents.js b/lib/CustomWeekEvents.js index 8e3b7c3..162f1d7 100644 --- a/lib/CustomWeekEvents.js +++ b/lib/CustomWeekEvents.js @@ -76,26 +76,27 @@ var DayEvents = function DayEvents(props) { gap: eventGap, }, }, - Array.from(Array(visibleNumber).keys()).map(function (idx) { - var event = events[idx] - var title = event.title, - color = event.color, - name = event.name, - id = event.id - return /*#__PURE__*/ _react.default.createElement( - 'div', - { - className: 'rbc-custom-week-day-event', - key: id, - style: { - width: eventWidth, - background: color, + visibleNumber > 0 && + Array.from(Array(visibleNumber).keys()).map(function (idx) { + var event = events[idx] + var title = event.title, + color = event.color, + name = event.name, + id = event.id + return /*#__PURE__*/ _react.default.createElement( + 'div', + { + className: 'rbc-custom-week-day-event', + key: id, + style: { + width: eventWidth, + background: color, + }, + title: name, }, - title: name, - }, - title - ) - }) + title + ) + }) ) ) } diff --git a/lib/EventCustomRow.js b/lib/EventCustomRow.js index ea5890d..e7ceead 100644 --- a/lib/EventCustomRow.js +++ b/lib/EventCustomRow.js @@ -21,6 +21,7 @@ var _callSuper2 = _interopRequireDefault( var _inherits2 = _interopRequireDefault( require('@babel/runtime/helpers/inherits') ) +var _propTypes = _interopRequireDefault(require('prop-types')) var _clsx = _interopRequireDefault(require('clsx')) var _react = _interopRequireDefault(require('react')) var _EventRowMixin = _interopRequireDefault(require('./EventRowMixin')) @@ -73,6 +74,15 @@ var EventCustomRow = /*#__PURE__*/ (function (_React$Component) { ]) return EventCustomRow })(_react.default.Component) +EventCustomRow.propTypes = + process.env.NODE_ENV !== 'production' + ? (0, _objectSpread2.default)( + { + segments: _propTypes.default.array, + }, + _EventRowMixin.default.propTypes + ) + : {} EventCustomRow.defaultProps = (0, _objectSpread2.default)( {}, _EventRowMixin.default.defaultProps diff --git a/lib/EventRow.js b/lib/EventRow.js index 920a22d..26a3280 100644 --- a/lib/EventRow.js +++ b/lib/EventRow.js @@ -21,6 +21,7 @@ var _callSuper2 = _interopRequireDefault( var _inherits2 = _interopRequireDefault( require('@babel/runtime/helpers/inherits') ) +var _propTypes = _interopRequireDefault(require('prop-types')) var _clsx = _interopRequireDefault(require('clsx')) var _react = _interopRequireDefault(require('react')) var _EventRowMixin = _interopRequireDefault(require('./EventRowMixin')) @@ -73,6 +74,15 @@ var EventRow = /*#__PURE__*/ (function (_React$Component) { ]) return EventRow })(_react.default.Component) +EventRow.propTypes = + process.env.NODE_ENV !== 'production' + ? (0, _objectSpread2.default)( + { + segments: _propTypes.default.array, + }, + _EventRowMixin.default.propTypes + ) + : {} EventRow.defaultProps = (0, _objectSpread2.default)( {}, _EventRowMixin.default.defaultProps diff --git a/lib/ResourceHeader.js b/lib/ResourceHeader.js index 8381338..babe904 100644 --- a/lib/ResourceHeader.js +++ b/lib/ResourceHeader.js @@ -6,6 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true, }) exports.default = void 0 +var _propTypes = _interopRequireDefault(require('prop-types')) var _react = _interopRequireDefault(require('react')) var ResourceHeader = function ResourceHeader(_ref) { var label = _ref.label @@ -15,4 +16,12 @@ var ResourceHeader = function ResourceHeader(_ref) { label ) } +ResourceHeader.propTypes = + process.env.NODE_ENV !== 'production' + ? { + label: _propTypes.default.node, + index: _propTypes.default.number, + resource: _propTypes.default.object, + } + : {} var _default = (exports.default = ResourceHeader) diff --git a/lib/TimeSlotGroup.js b/lib/TimeSlotGroup.js index 75fba85..386e28e 100644 --- a/lib/TimeSlotGroup.js +++ b/lib/TimeSlotGroup.js @@ -21,6 +21,7 @@ var _inherits2 = _interopRequireDefault( require('@babel/runtime/helpers/inherits') ) var _clsx = _interopRequireDefault(require('clsx')) +var _propTypes = _interopRequireDefault(require('prop-types')) var _react = _interopRequireWildcard(require('react')) var _BackgroundWrapper = _interopRequireDefault(require('./BackgroundWrapper')) var TimeSlotGroup = (exports.default = /*#__PURE__*/ (function (_Component) { @@ -82,3 +83,13 @@ var TimeSlotGroup = (exports.default = /*#__PURE__*/ (function (_Component) { ]) return TimeSlotGroup })(_react.Component)) +TimeSlotGroup.propTypes = + process.env.NODE_ENV !== 'production' + ? { + renderSlot: _propTypes.default.func, + group: _propTypes.default.array.isRequired, + resource: _propTypes.default.any, + components: _propTypes.default.object, + getters: _propTypes.default.object, + } + : {} diff --git a/src/CustomWeekEvents.js b/src/CustomWeekEvents.js index 42879c4..82dc982 100644 --- a/src/CustomWeekEvents.js +++ b/src/CustomWeekEvents.js @@ -47,21 +47,22 @@ const DayEvents = (props) => { className="rbc-custom-week-day-events" style={{ padding, gap: eventGap }} > - {Array.from(Array(visibleNumber).keys()).map((idx) => { - const event = events[idx] + {visibleNumber > 0 && + Array.from(Array(visibleNumber).keys()).map((idx) => { + const event = events[idx] - const { title, color, name, id } = event - return ( -
- {title} -
- ) - })} + const { title, color, name, id } = event + return ( +
+ {title} +
+ ) + })} )