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