From 18616bb4bd25355b8f7923e263d9ab61554ea8c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8F=BD=E6=98=9F?= Date: Wed, 26 Aug 2020 19:40:34 +0800 Subject: [PATCH 1/4] add renderEvent className config --- package.json | 2 +- src/calendarFullUtil.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 468e051b..84bf7fdd 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "uxcore-calendar", "version": "0.10.34", "description": "calendar componment for react", - "main": "build/index.js", + "main": "src/index.js", "scripts": { "start": "uxcore-tools run start", "server": "uxcore-tools run server", diff --git a/src/calendarFullUtil.js b/src/calendarFullUtil.js index 892e1c88..174557ea 100644 --- a/src/calendarFullUtil.js +++ b/src/calendarFullUtil.js @@ -840,7 +840,7 @@ function getVisibleEvent(events, maxCount, opts, callback = () => {}) { }} >
{ const eventName = e.currentTarget.getAttribute('data-event-name'); @@ -857,7 +857,7 @@ function getVisibleEvent(events, maxCount, opts, callback = () => {}) { }} >
From 9d98a725b94c168feab030c678ff2d24d201a86a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8F=BD=E6=98=9F?= Date: Wed, 26 Aug 2020 19:44:26 +0800 Subject: [PATCH 2/4] add defaultMaxCount config --- src/calendarFullUtil.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calendarFullUtil.js b/src/calendarFullUtil.js index 174557ea..bd0acf22 100644 --- a/src/calendarFullUtil.js +++ b/src/calendarFullUtil.js @@ -910,7 +910,7 @@ function getMonthTopAndMaxCount(tableHeight) { * render: function(){} * }) */ -const generateScheduleContent = (events, callback) => +const generateScheduleContent = (events, callback, defaultMaxCount) => function scheduleRender(evts, opts, tableHeight) { if (!evts || !evts.length) { return; @@ -973,7 +973,7 @@ const generateScheduleContent = (events, callback) => resultScheduleHtml.push(
- {getVisibleEvent(rangeEvents, monthMaxCount, opts, callback)} + {getVisibleEvent(rangeEvents, defaultMaxCount || monthMaxCount, opts, callback)}
, ); } From 1371fc6be463900bd5478b755a1f3437106ac2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8F=BD=E6=98=9F?= Date: Wed, 12 Aug 2020 19:49:26 +0800 Subject: [PATCH 3/4] add miniOffset config --- src/CalendarFullHeader.jsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/CalendarFullHeader.jsx b/src/CalendarFullHeader.jsx index 91caed5e..cd020fca 100644 --- a/src/CalendarFullHeader.jsx +++ b/src/CalendarFullHeader.jsx @@ -127,8 +127,8 @@ class CalendarHeader extends Component { } todayElement() { - const { showToday, locale } = this.props; - const isSuperMini = this.fullHeader ? this.fullHeader.offsetWidth <= 380 : false; + const { showToday, locale, miniOffset } = this.props; + const isSuperMini = this.fullHeader ? this.fullHeader.offsetWidth <= miniOffset : false; const cls = classnames({ 'today-btn': true, 'super-mini': isSuperMini, @@ -176,11 +176,11 @@ class CalendarHeader extends Component { } renderSwitcher() { - const { showTypeSwitch } = this.props; + const { showTypeSwitch, miniOffset } = this.props; if (!showTypeSwitch) { return null; } - if (this.fullHeader && this.fullHeader.offsetWidth < 380) { + if (this.fullHeader && this.fullHeader.offsetWidth < miniOffset) { return this.getSelectSwitcher(); } return this.getExpandedSwitcher(); @@ -206,6 +206,7 @@ class CalendarHeader extends Component { CalendarHeader.propTypes = { yearSelectOffset: PropTypes.number, yearSelectTotal: PropTypes.number, + miniOffset: PropTypes.number, onValueChange: PropTypes.func, typeChange: PropTypes.func, prefixCls: PropTypes.string, @@ -216,6 +217,7 @@ CalendarHeader.propTypes = { CalendarHeader.defaultProps = { yearSelectOffset: 10, yearSelectTotal: 20, + miniOffset: 380, onValueChange: null, showToday: true, type: 'time', From 52fdb913a1a8f28772fbc5cca7093b8d8ddbdacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8F=BD=E6=98=9F?= Date: Wed, 26 Aug 2020 19:55:51 +0800 Subject: [PATCH 4/4] add defaultCellHeight config --- package.json | 2 +- src/date/DateTable.jsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 84bf7fdd..468e051b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "uxcore-calendar", "version": "0.10.34", "description": "calendar componment for react", - "main": "src/index.js", + "main": "build/index.js", "scripts": { "start": "uxcore-tools run start", "server": "uxcore-tools run server", diff --git a/src/date/DateTable.jsx b/src/date/DateTable.jsx index 5deb5124..0be635a1 100644 --- a/src/date/DateTable.jsx +++ b/src/date/DateTable.jsx @@ -44,12 +44,12 @@ export default class DateTable extends React.Component { } render() { - const { prefixCls } = this.props; + const { prefixCls, defaultCellHeight } = this.props; const fullTableHeight = this.fullTable ? this.fullTable.offsetHeight : 0; const cellHeight = 0.8 * (fullTableHeight - 32) / 6; const tableCls = classnames({ [`${prefixCls}-table`]: true, - 'super-mini': cellHeight <= 42 && cellHeight > 0, + 'super-mini': cellHeight <= (defaultCellHeight || 42) && cellHeight > 0, }); return (