ywana-core8 0.0.937 → 0.0.939
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/dist/index.cjs +30 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +19 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +30 -6
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +30 -6
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/incubator/planner.css +19 -0
- package/src/incubator/planner.js +45 -24
package/dist/index.umd.js
CHANGED
@@ -5742,10 +5742,13 @@
|
|
5742
5742
|
days = _useState[0],
|
5743
5743
|
setDays = _useState[1];
|
5744
5744
|
var lastDay = new Date(to);
|
5745
|
+
var today = new Date();
|
5745
5746
|
React.useEffect(function () {
|
5746
5747
|
var day = new Date(from);
|
5747
5748
|
var nextDays = [];
|
5748
5749
|
while (day <= lastDay) {
|
5750
|
+
var isToday = day.getDate() === today.getDate() && day.getMonth() === today.getMonth() && day.getFullYear() === today.getFullYear();
|
5751
|
+
var isWeekend = day.getDay() === 0 || day.getDay() === 6;
|
5749
5752
|
nextDays.push({
|
5750
5753
|
day: day.getDate(),
|
5751
5754
|
weekday: day.toLocaleString('en-US', {
|
@@ -5755,12 +5758,23 @@
|
|
5755
5758
|
month: 'short'
|
5756
5759
|
}),
|
5757
5760
|
monthNum: day.getMonth() + 1,
|
5758
|
-
year: day.getFullYear()
|
5761
|
+
year: day.getFullYear(),
|
5762
|
+
isToday: isToday,
|
5763
|
+
isWeekend: isWeekend,
|
5764
|
+
isInCurrentWeek: isInCurrentWeek(day)
|
5759
5765
|
});
|
5760
5766
|
day.setDate(day.getDate() + 1);
|
5761
5767
|
}
|
5762
5768
|
setDays(nextDays);
|
5763
5769
|
}, [from, to]);
|
5770
|
+
function isInCurrentWeek(date) {
|
5771
|
+
var today = new Date();
|
5772
|
+
var first = today.getDate() - today.getDay();
|
5773
|
+
var last = first + 5;
|
5774
|
+
var firstDay = new Date(today.setDate(first));
|
5775
|
+
var lastDay = new Date(today.setDate(last));
|
5776
|
+
return date >= firstDay && date <= lastDay;
|
5777
|
+
}
|
5764
5778
|
function selectCell(cell) {
|
5765
5779
|
if (onSelectCell) onSelectCell(cell);
|
5766
5780
|
}
|
@@ -5815,9 +5829,17 @@
|
|
5815
5829
|
}), days.map(function (_ref3) {
|
5816
5830
|
var day = _ref3.day,
|
5817
5831
|
weekday = _ref3.weekday,
|
5818
|
-
month = _ref3.month
|
5832
|
+
month = _ref3.month,
|
5833
|
+
_ref3$isToday = _ref3.isToday,
|
5834
|
+
isToday = _ref3$isToday === void 0 ? false : _ref3$isToday,
|
5835
|
+
_ref3$isWeekend = _ref3.isWeekend,
|
5836
|
+
isWeekend = _ref3$isWeekend === void 0 ? false : _ref3$isWeekend,
|
5837
|
+
isInCurrentWeek = _ref3.isInCurrentWeek;
|
5838
|
+
var todayClass = isToday ? 'today' : '';
|
5839
|
+
var weekendClass = isWeekend ? 'weekend' : '';
|
5840
|
+
var currentWeekClass = isInCurrentWeek ? 'current-week' : '';
|
5819
5841
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
5820
|
-
className: "day-cell",
|
5842
|
+
className: "day-cell " + todayClass + " " + weekendClass + " " + currentWeekClass,
|
5821
5843
|
style: {
|
5822
5844
|
minWidth: dayWidth,
|
5823
5845
|
maxWidth: dayWidth
|
@@ -5847,14 +5869,16 @@
|
|
5847
5869
|
var day = _ref4.day,
|
5848
5870
|
month = _ref4.month,
|
5849
5871
|
monthNum = _ref4.monthNum,
|
5850
|
-
year = _ref4.year
|
5872
|
+
year = _ref4.year,
|
5873
|
+
isWeekend = _ref4.isWeekend;
|
5851
5874
|
var dayDate = new Date(year, monthNum - 1, day);
|
5852
5875
|
var dayEvents = laneEvents.filter(function (event) {
|
5853
5876
|
var eventDate = new Date(event.date);
|
5854
5877
|
return eventDate.getDate() === dayDate.getDate() && eventDate.getMonth() === dayDate.getMonth() && eventDate.getFullYear() === dayDate.getFullYear();
|
5855
5878
|
});
|
5879
|
+
var weekendClass = isWeekend ? 'weekend' : '';
|
5856
5880
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
5857
|
-
className: "content-cell",
|
5881
|
+
className: "content-cell " + weekendClass,
|
5858
5882
|
style: {
|
5859
5883
|
minWidth: dayWidth,
|
5860
5884
|
maxWidth: dayWidth
|
@@ -5862,7 +5886,7 @@
|
|
5862
5886
|
key: "content" + index + "_" + year + "-" + month + "-" + day,
|
5863
5887
|
onClick: function onClick() {
|
5864
5888
|
return selectCell({
|
5865
|
-
|
5889
|
+
lane: lane.id,
|
5866
5890
|
date: dayDate
|
5867
5891
|
});
|
5868
5892
|
}
|