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.cjs
CHANGED
@@ -5945,6 +5945,7 @@ var Planner2 = function Planner2(_ref) {
|
|
5945
5945
|
rowHeaderTitle = _ref.rowHeaderTitle,
|
5946
5946
|
EventRenderer = _ref.EventRenderer,
|
5947
5947
|
onSelectCell = _ref.onSelectCell,
|
5948
|
+
onCellDrop = _ref.onCellDrop,
|
5948
5949
|
_ref$hideEmptyRows = _ref.hideEmptyRows,
|
5949
5950
|
hideEmptyRows = _ref$hideEmptyRows === void 0 ? false : _ref$hideEmptyRows;
|
5950
5951
|
var _useState = React.useState([]),
|
@@ -5952,6 +5953,9 @@ var Planner2 = function Planner2(_ref) {
|
|
5952
5953
|
setDays = _useState[1];
|
5953
5954
|
var lastDay = new Date(to);
|
5954
5955
|
var today = new Date();
|
5956
|
+
var _useState2 = React.useState(null),
|
5957
|
+
dragOverCell = _useState2[0],
|
5958
|
+
setDragOverCell = _useState2[1];
|
5955
5959
|
React.useEffect(function () {
|
5956
5960
|
var day = new Date(from);
|
5957
5961
|
var nextDays = [];
|
@@ -5987,11 +5991,28 @@ var Planner2 = function Planner2(_ref) {
|
|
5987
5991
|
function selectCell(cell) {
|
5988
5992
|
if (onSelectCell) onSelectCell(cell);
|
5989
5993
|
}
|
5990
|
-
function
|
5991
|
-
|
5994
|
+
function onDragOver(event) {
|
5995
|
+
event.preventDefault();
|
5996
|
+
setDragOverCell(event.target.id);
|
5997
|
+
}
|
5998
|
+
function onDragLeave(event) {
|
5999
|
+
event.preventDefault();
|
6000
|
+
setDragOverCell(null);
|
6001
|
+
}
|
6002
|
+
function drop(event, _ref2) {
|
6003
|
+
var lane = _ref2.lane,
|
6004
|
+
date = _ref2.date;
|
6005
|
+
event.preventDefault();
|
6006
|
+
var data = event.dataTransfer.getData("text");
|
6007
|
+
if (onCellDrop) onCellDrop({
|
6008
|
+
data: data,
|
6009
|
+
lane: lane,
|
6010
|
+
date: date
|
6011
|
+
});
|
6012
|
+
setDragOverCell(null);
|
5992
6013
|
}
|
5993
|
-
var uniqueMonths = Array.from(new Set(days.map(function (
|
5994
|
-
var month =
|
6014
|
+
var uniqueMonths = Array.from(new Set(days.map(function (_ref3) {
|
6015
|
+
var month = _ref3.month;
|
5995
6016
|
return month;
|
5996
6017
|
})));
|
5997
6018
|
var monthWidths = uniqueMonths.map(function (month) {
|
@@ -6038,15 +6059,15 @@ var Planner2 = function Planner2(_ref) {
|
|
6038
6059
|
minWidth: rowHeaderWidth + "rem",
|
6039
6060
|
maxWidth: rowHeaderWidth + "rem"
|
6040
6061
|
}
|
6041
|
-
}, rowHeaderTitle), days.map(function (
|
6042
|
-
var day =
|
6043
|
-
weekday =
|
6044
|
-
month =
|
6045
|
-
|
6046
|
-
isToday =
|
6047
|
-
|
6048
|
-
isWeekend =
|
6049
|
-
isInCurrentWeek =
|
6062
|
+
}, rowHeaderTitle), days.map(function (_ref4) {
|
6063
|
+
var day = _ref4.day,
|
6064
|
+
weekday = _ref4.weekday,
|
6065
|
+
month = _ref4.month,
|
6066
|
+
_ref4$isToday = _ref4.isToday,
|
6067
|
+
isToday = _ref4$isToday === void 0 ? false : _ref4$isToday,
|
6068
|
+
_ref4$isWeekend = _ref4.isWeekend,
|
6069
|
+
isWeekend = _ref4$isWeekend === void 0 ? false : _ref4$isWeekend,
|
6070
|
+
isInCurrentWeek = _ref4.isInCurrentWeek;
|
6050
6071
|
var todayClass = isToday ? 'today' : '';
|
6051
6072
|
var weekendClass = isWeekend ? 'weekend' : '';
|
6052
6073
|
var currentWeekClass = isInCurrentWeek ? 'current-week' : '';
|
@@ -6070,10 +6091,10 @@ var Planner2 = function Planner2(_ref) {
|
|
6070
6091
|
if (laneEvents.length === 0) return null;
|
6071
6092
|
|
6072
6093
|
// find days with event for this lane in the period
|
6073
|
-
var daysWithEvents = days.filter(function (
|
6074
|
-
var day =
|
6075
|
-
monthNum =
|
6076
|
-
year =
|
6094
|
+
var daysWithEvents = days.filter(function (_ref5) {
|
6095
|
+
var day = _ref5.day,
|
6096
|
+
monthNum = _ref5.monthNum,
|
6097
|
+
year = _ref5.year;
|
6077
6098
|
return laneEvents.find(function (event) {
|
6078
6099
|
var eventDate = new Date(event.date);
|
6079
6100
|
return eventDate.getDate() === day && eventDate.getMonth() === monthNum - 1 && eventDate.getFullYear() === year;
|
@@ -6084,6 +6105,7 @@ var Planner2 = function Planner2(_ref) {
|
|
6084
6105
|
if (daysWithEvents.length === 0) return null;
|
6085
6106
|
}
|
6086
6107
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
6108
|
+
key: "content-row-" + index,
|
6087
6109
|
className: "content-row " + lane.className,
|
6088
6110
|
style: {
|
6089
6111
|
width: totalDaysWidth + "rem"
|
@@ -6094,21 +6116,23 @@ var Planner2 = function Planner2(_ref) {
|
|
6094
6116
|
minWidth: rowHeaderWidth + "rem",
|
6095
6117
|
maxWidth: rowHeaderWidth + "rem"
|
6096
6118
|
}
|
6097
|
-
}, lane.title), days.map(function (
|
6098
|
-
var day =
|
6099
|
-
month =
|
6100
|
-
monthNum =
|
6101
|
-
year =
|
6102
|
-
isWeekend =
|
6119
|
+
}, lane.title), days.map(function (_ref6) {
|
6120
|
+
var day = _ref6.day,
|
6121
|
+
month = _ref6.month,
|
6122
|
+
monthNum = _ref6.monthNum,
|
6123
|
+
year = _ref6.year,
|
6124
|
+
isWeekend = _ref6.isWeekend;
|
6103
6125
|
var dayDate = new Date(year, monthNum - 1, day);
|
6104
6126
|
var dayEvents = laneEvents.filter(function (event) {
|
6105
6127
|
var eventDate = new Date(event.date);
|
6106
6128
|
return eventDate.getDate() === dayDate.getDate() && eventDate.getMonth() === dayDate.getMonth() && eventDate.getFullYear() === dayDate.getFullYear();
|
6107
6129
|
});
|
6108
6130
|
var weekendClass = isWeekend ? 'weekend' : '';
|
6131
|
+
var dragOverStyle = dragOverCell === "cell" + index + "_" + year + "-" + month + "-" + day ? 'drag-over' : '';
|
6109
6132
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
6133
|
+
id: "cell" + index + "_" + year + "-" + month + "-" + day,
|
6110
6134
|
key: "content" + index + "_" + year + "-" + month + "-" + day,
|
6111
|
-
className: "content-cell " + weekendClass,
|
6135
|
+
className: "content-cell " + weekendClass + " " + dragOverStyle,
|
6112
6136
|
style: {
|
6113
6137
|
minWidth: dayWidth,
|
6114
6138
|
maxWidth: dayWidth
|
@@ -6119,7 +6143,14 @@ var Planner2 = function Planner2(_ref) {
|
|
6119
6143
|
date: dayDate
|
6120
6144
|
});
|
6121
6145
|
},
|
6122
|
-
|
6146
|
+
onDragOver: onDragOver,
|
6147
|
+
onDragLeave: onDragLeave,
|
6148
|
+
onDrop: function onDrop(event) {
|
6149
|
+
return drop(event, {
|
6150
|
+
lane: lane.id,
|
6151
|
+
date: dayDate
|
6152
|
+
});
|
6153
|
+
}
|
6123
6154
|
}, dayEvents.map(function (event, index) {
|
6124
6155
|
return /*#__PURE__*/React__default["default"].createElement(EventRenderer, {
|
6125
6156
|
key: event.id + "-" + index,
|
@@ -9369,6 +9400,7 @@ var TablePage2 = function TablePage2(props) {
|
|
9369
9400
|
_props$editorFilter = props.editorFilter,
|
9370
9401
|
editorFilter = _props$editorFilter === void 0 ? false : _props$editorFilter,
|
9371
9402
|
tabbedBy = props.tabbedBy,
|
9403
|
+
sortedBy = props.sortedBy,
|
9372
9404
|
tableClassName = props.tableClassName,
|
9373
9405
|
children = props.children,
|
9374
9406
|
onSelect = props.onSelect;
|
@@ -9519,6 +9551,7 @@ var TablePage2 = function TablePage2(props) {
|
|
9519
9551
|
editable: editable,
|
9520
9552
|
tabbedBy: tabbedBy,
|
9521
9553
|
groupBy: groupBy,
|
9554
|
+
sortedBy: sortedBy,
|
9522
9555
|
filter: tableFilter,
|
9523
9556
|
actions: tableActions,
|
9524
9557
|
canDelete: canDelete,
|
@@ -9803,7 +9836,8 @@ var TableEditor$1 = function TableEditor(props) {
|
|
9803
9836
|
filter = props.filter,
|
9804
9837
|
actions = props.actions,
|
9805
9838
|
className = props.className,
|
9806
|
-
tabbedBy = props.tabbedBy
|
9839
|
+
tabbedBy = props.tabbedBy,
|
9840
|
+
sortedBy = props.sortedBy;
|
9807
9841
|
var _useState4 = React.useState(props.groupBy),
|
9808
9842
|
groupBy = _useState4[0],
|
9809
9843
|
setGroupBy = _useState4[1];
|
@@ -9936,7 +9970,7 @@ var TableEditor$1 = function TableEditor(props) {
|
|
9936
9970
|
groups[groupName].push(item);
|
9937
9971
|
return groups;
|
9938
9972
|
}, {});
|
9939
|
-
var sections = Object.keys(groups).map(function (groupName) {
|
9973
|
+
var sections = Object.keys(groups).sort().map(function (groupName) {
|
9940
9974
|
var rows = groups[groupName].map(function (item) {
|
9941
9975
|
item.checked = pageContext.checked ? pageContext.checked.has(item.id) : false;
|
9942
9976
|
item.actions = actions ? actions.map(function (_action2) {
|
@@ -9966,6 +10000,15 @@ var TableEditor$1 = function TableEditor(props) {
|
|
9966
10000
|
}));
|
9967
10001
|
return item;
|
9968
10002
|
});
|
10003
|
+
if (sortedBy) {
|
10004
|
+
rows.sort(function (a, b) {
|
10005
|
+
var valueA = a[sortedBy];
|
10006
|
+
var valueB = b[sortedBy];
|
10007
|
+
if (valueA < valueB) return -1;
|
10008
|
+
if (valueA > valueB) return 1;
|
10009
|
+
return 0;
|
10010
|
+
});
|
10011
|
+
}
|
9969
10012
|
table.rows = rows;
|
9970
10013
|
return {
|
9971
10014
|
id: groupName,
|