ywana-core8 0.1.11 → 0.1.13
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 +70 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +7 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +70 -27
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +70 -27
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/TablePage2.js +14 -3
- package/src/incubator/planner.css +5 -0
- package/src/incubator/planner.js +36 -20
- package/src/site/site.css +2 -0
package/dist/index.umd.js
CHANGED
@@ -5938,6 +5938,7 @@
|
|
5938
5938
|
rowHeaderTitle = _ref.rowHeaderTitle,
|
5939
5939
|
EventRenderer = _ref.EventRenderer,
|
5940
5940
|
onSelectCell = _ref.onSelectCell,
|
5941
|
+
onCellDrop = _ref.onCellDrop,
|
5941
5942
|
_ref$hideEmptyRows = _ref.hideEmptyRows,
|
5942
5943
|
hideEmptyRows = _ref$hideEmptyRows === void 0 ? false : _ref$hideEmptyRows;
|
5943
5944
|
var _useState = React.useState([]),
|
@@ -5945,6 +5946,9 @@
|
|
5945
5946
|
setDays = _useState[1];
|
5946
5947
|
var lastDay = new Date(to);
|
5947
5948
|
var today = new Date();
|
5949
|
+
var _useState2 = React.useState(null),
|
5950
|
+
dragOverCell = _useState2[0],
|
5951
|
+
setDragOverCell = _useState2[1];
|
5948
5952
|
React.useEffect(function () {
|
5949
5953
|
var day = new Date(from);
|
5950
5954
|
var nextDays = [];
|
@@ -5980,11 +5984,28 @@
|
|
5980
5984
|
function selectCell(cell) {
|
5981
5985
|
if (onSelectCell) onSelectCell(cell);
|
5982
5986
|
}
|
5983
|
-
function
|
5984
|
-
|
5987
|
+
function onDragOver(event) {
|
5988
|
+
event.preventDefault();
|
5989
|
+
setDragOverCell(event.target.id);
|
5990
|
+
}
|
5991
|
+
function onDragLeave(event) {
|
5992
|
+
event.preventDefault();
|
5993
|
+
setDragOverCell(null);
|
5994
|
+
}
|
5995
|
+
function drop(event, _ref2) {
|
5996
|
+
var lane = _ref2.lane,
|
5997
|
+
date = _ref2.date;
|
5998
|
+
event.preventDefault();
|
5999
|
+
var data = event.dataTransfer.getData("text");
|
6000
|
+
if (onCellDrop) onCellDrop({
|
6001
|
+
data: data,
|
6002
|
+
lane: lane,
|
6003
|
+
date: date
|
6004
|
+
});
|
6005
|
+
setDragOverCell(null);
|
5985
6006
|
}
|
5986
|
-
var uniqueMonths = Array.from(new Set(days.map(function (
|
5987
|
-
var month =
|
6007
|
+
var uniqueMonths = Array.from(new Set(days.map(function (_ref3) {
|
6008
|
+
var month = _ref3.month;
|
5988
6009
|
return month;
|
5989
6010
|
})));
|
5990
6011
|
var monthWidths = uniqueMonths.map(function (month) {
|
@@ -6031,15 +6052,15 @@
|
|
6031
6052
|
minWidth: rowHeaderWidth + "rem",
|
6032
6053
|
maxWidth: rowHeaderWidth + "rem"
|
6033
6054
|
}
|
6034
|
-
}, rowHeaderTitle), days.map(function (
|
6035
|
-
var day =
|
6036
|
-
weekday =
|
6037
|
-
month =
|
6038
|
-
|
6039
|
-
isToday =
|
6040
|
-
|
6041
|
-
isWeekend =
|
6042
|
-
isInCurrentWeek =
|
6055
|
+
}, rowHeaderTitle), days.map(function (_ref4) {
|
6056
|
+
var day = _ref4.day,
|
6057
|
+
weekday = _ref4.weekday,
|
6058
|
+
month = _ref4.month,
|
6059
|
+
_ref4$isToday = _ref4.isToday,
|
6060
|
+
isToday = _ref4$isToday === void 0 ? false : _ref4$isToday,
|
6061
|
+
_ref4$isWeekend = _ref4.isWeekend,
|
6062
|
+
isWeekend = _ref4$isWeekend === void 0 ? false : _ref4$isWeekend,
|
6063
|
+
isInCurrentWeek = _ref4.isInCurrentWeek;
|
6043
6064
|
var todayClass = isToday ? 'today' : '';
|
6044
6065
|
var weekendClass = isWeekend ? 'weekend' : '';
|
6045
6066
|
var currentWeekClass = isInCurrentWeek ? 'current-week' : '';
|
@@ -6063,10 +6084,10 @@
|
|
6063
6084
|
if (laneEvents.length === 0) return null;
|
6064
6085
|
|
6065
6086
|
// find days with event for this lane in the period
|
6066
|
-
var daysWithEvents = days.filter(function (
|
6067
|
-
var day =
|
6068
|
-
monthNum =
|
6069
|
-
year =
|
6087
|
+
var daysWithEvents = days.filter(function (_ref5) {
|
6088
|
+
var day = _ref5.day,
|
6089
|
+
monthNum = _ref5.monthNum,
|
6090
|
+
year = _ref5.year;
|
6070
6091
|
return laneEvents.find(function (event) {
|
6071
6092
|
var eventDate = new Date(event.date);
|
6072
6093
|
return eventDate.getDate() === day && eventDate.getMonth() === monthNum - 1 && eventDate.getFullYear() === year;
|
@@ -6077,6 +6098,7 @@
|
|
6077
6098
|
if (daysWithEvents.length === 0) return null;
|
6078
6099
|
}
|
6079
6100
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
6101
|
+
key: "content-row-" + index,
|
6080
6102
|
className: "content-row " + lane.className,
|
6081
6103
|
style: {
|
6082
6104
|
width: totalDaysWidth + "rem"
|
@@ -6087,21 +6109,23 @@
|
|
6087
6109
|
minWidth: rowHeaderWidth + "rem",
|
6088
6110
|
maxWidth: rowHeaderWidth + "rem"
|
6089
6111
|
}
|
6090
|
-
}, lane.title), days.map(function (
|
6091
|
-
var day =
|
6092
|
-
month =
|
6093
|
-
monthNum =
|
6094
|
-
year =
|
6095
|
-
isWeekend =
|
6112
|
+
}, lane.title), days.map(function (_ref6) {
|
6113
|
+
var day = _ref6.day,
|
6114
|
+
month = _ref6.month,
|
6115
|
+
monthNum = _ref6.monthNum,
|
6116
|
+
year = _ref6.year,
|
6117
|
+
isWeekend = _ref6.isWeekend;
|
6096
6118
|
var dayDate = new Date(year, monthNum - 1, day);
|
6097
6119
|
var dayEvents = laneEvents.filter(function (event) {
|
6098
6120
|
var eventDate = new Date(event.date);
|
6099
6121
|
return eventDate.getDate() === dayDate.getDate() && eventDate.getMonth() === dayDate.getMonth() && eventDate.getFullYear() === dayDate.getFullYear();
|
6100
6122
|
});
|
6101
6123
|
var weekendClass = isWeekend ? 'weekend' : '';
|
6124
|
+
var dragOverStyle = dragOverCell === "cell" + index + "_" + year + "-" + month + "-" + day ? 'drag-over' : '';
|
6102
6125
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
6126
|
+
id: "cell" + index + "_" + year + "-" + month + "-" + day,
|
6103
6127
|
key: "content" + index + "_" + year + "-" + month + "-" + day,
|
6104
|
-
className: "content-cell " + weekendClass,
|
6128
|
+
className: "content-cell " + weekendClass + " " + dragOverStyle,
|
6105
6129
|
style: {
|
6106
6130
|
minWidth: dayWidth,
|
6107
6131
|
maxWidth: dayWidth
|
@@ -6112,7 +6136,14 @@
|
|
6112
6136
|
date: dayDate
|
6113
6137
|
});
|
6114
6138
|
},
|
6115
|
-
|
6139
|
+
onDragOver: onDragOver,
|
6140
|
+
onDragLeave: onDragLeave,
|
6141
|
+
onDrop: function onDrop(event) {
|
6142
|
+
return drop(event, {
|
6143
|
+
lane: lane.id,
|
6144
|
+
date: dayDate
|
6145
|
+
});
|
6146
|
+
}
|
6116
6147
|
}, dayEvents.map(function (event, index) {
|
6117
6148
|
return /*#__PURE__*/React__default["default"].createElement(EventRenderer, {
|
6118
6149
|
key: event.id + "-" + index,
|
@@ -9362,6 +9393,7 @@
|
|
9362
9393
|
_props$editorFilter = props.editorFilter,
|
9363
9394
|
editorFilter = _props$editorFilter === void 0 ? false : _props$editorFilter,
|
9364
9395
|
tabbedBy = props.tabbedBy,
|
9396
|
+
sortedBy = props.sortedBy,
|
9365
9397
|
tableClassName = props.tableClassName,
|
9366
9398
|
children = props.children,
|
9367
9399
|
onSelect = props.onSelect;
|
@@ -9512,6 +9544,7 @@
|
|
9512
9544
|
editable: editable,
|
9513
9545
|
tabbedBy: tabbedBy,
|
9514
9546
|
groupBy: groupBy,
|
9547
|
+
sortedBy: sortedBy,
|
9515
9548
|
filter: tableFilter,
|
9516
9549
|
actions: tableActions,
|
9517
9550
|
canDelete: canDelete,
|
@@ -9796,7 +9829,8 @@
|
|
9796
9829
|
filter = props.filter,
|
9797
9830
|
actions = props.actions,
|
9798
9831
|
className = props.className,
|
9799
|
-
tabbedBy = props.tabbedBy
|
9832
|
+
tabbedBy = props.tabbedBy,
|
9833
|
+
sortedBy = props.sortedBy;
|
9800
9834
|
var _useState4 = React.useState(props.groupBy),
|
9801
9835
|
groupBy = _useState4[0],
|
9802
9836
|
setGroupBy = _useState4[1];
|
@@ -9929,7 +9963,7 @@
|
|
9929
9963
|
groups[groupName].push(item);
|
9930
9964
|
return groups;
|
9931
9965
|
}, {});
|
9932
|
-
var sections = Object.keys(groups).map(function (groupName) {
|
9966
|
+
var sections = Object.keys(groups).sort().map(function (groupName) {
|
9933
9967
|
var rows = groups[groupName].map(function (item) {
|
9934
9968
|
item.checked = pageContext.checked ? pageContext.checked.has(item.id) : false;
|
9935
9969
|
item.actions = actions ? actions.map(function (_action2) {
|
@@ -9959,6 +9993,15 @@
|
|
9959
9993
|
}));
|
9960
9994
|
return item;
|
9961
9995
|
});
|
9996
|
+
if (sortedBy) {
|
9997
|
+
rows.sort(function (a, b) {
|
9998
|
+
var valueA = a[sortedBy];
|
9999
|
+
var valueB = b[sortedBy];
|
10000
|
+
if (valueA < valueB) return -1;
|
10001
|
+
if (valueA > valueB) return 1;
|
10002
|
+
return 0;
|
10003
|
+
});
|
10004
|
+
}
|
9962
10005
|
table.rows = rows;
|
9963
10006
|
return {
|
9964
10007
|
id: groupName,
|